protected static class DefaultConnectionFactory.DefaultConnection extends Object implements Connection
Modifier and Type | Field and Description |
---|---|
private ConnectionConfig |
config
Connection configuration.
|
protected Logger |
logger
Logger for this class.
|
private ProviderConnection |
providerConnection
Provider connection.
|
private ProviderConnectionFactory<?> |
providerConnectionFactory
Connection factory.
|
Constructor and Description |
---|
DefaultConnection(ConnectionConfig cc,
ProviderConnectionFactory<?> cf)
Creates a new default connection.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
This will close the connection to the LDAP.
|
void |
close(RequestControl[] controls)
This will close the connection to the LDAP using the supplied controls.
|
protected void |
finalize() |
ConnectionConfig |
getConnectionConfig()
Returns the connection config for this connection.
|
ProviderConnection |
getProviderConnection()
Returns the provider specific connection.
|
boolean |
isOpen()
Returns whether the underlying provider connection is not null.
|
Response<Void> |
open()
This will establish a connection if one does not already exist.
|
Response<Void> |
open(BindRequest request)
This will establish a connection if one does not already exist and bind to the LDAP using the supplied bind
request.
|
Response<Void> |
reopen()
This will close an existing connection to the LDAP and establish a new connection to the LDAP.
|
Response<Void> |
reopen(BindRequest request)
This will close an existing connection to the LDAP and establish a new connection to the LDAP using the supplied
bind request.
|
String |
toString() |
protected final Logger logger
private final ConnectionConfig config
private final ProviderConnectionFactory<?> providerConnectionFactory
private ProviderConnection providerConnection
public DefaultConnection(ConnectionConfig cc, ProviderConnectionFactory<?> cf)
cc
- connection configurationcf
- provider connection factorypublic ConnectionConfig getConnectionConfig()
Connection
getConnectionConfig
in interface Connection
public ProviderConnection getProviderConnection()
open()
.getProviderConnection
in interface Connection
IllegalStateException
- if the connection is not openpublic Response<Void> open() throws LdapException
close()
.open
in interface Connection
ConnectionInitializer
or an empty response if no connection
initializer was configuredIllegalStateException
- if the connection is already openLdapException
- if the LDAP cannot be reachedpublic Response<Void> open(BindRequest request) throws LdapException
close()
.open
in interface Connection
request
- bind requestIllegalStateException
- if the connection is already openLdapException
- if the LDAP cannot be reachedpublic boolean isOpen()
isOpen
in interface Connection
public void close()
Connection
close
in interface AutoCloseable
close
in interface Connection
public void close(RequestControl[] controls)
Connection
close
in interface Connection
controls
- request controlspublic Response<Void> reopen() throws LdapException
Connection
reopen
in interface Connection
ConnectionInitializer
or an empty response if no connection
initializer was configuredLdapException
- if the LDAP cannot be reachedpublic Response<Void> reopen(BindRequest request) throws LdapException
Connection
reopen
in interface Connection
request
- containing bind informationLdapException
- if the LDAP cannot be reachedCopyright © 2003-2019 Virginia Tech. All Rights Reserved.