Package org.ldaptive
Interface Connection
-
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
DefaultConnectionFactory.DefaultConnection
public interface Connection extends AutoCloseable
Interface for ldap connection implementations.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method 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.ConnectionConfig
getConnectionConfig()
Returns the connection config for this connection.ProviderConnection
getProviderConnection()
Returns the provider connection to invoke the provider specific implementation.boolean
isOpen()
Returns whetheropen(BindRequest)
was successfully invoked on this connection andclose()
has not been invoked.Response<Void>
open()
This will establish a connection to the LDAP.Response<Void>
open(BindRequest request)
This will establish a connection 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.
-
-
-
Method Detail
-
getConnectionConfig
ConnectionConfig getConnectionConfig()
Returns the connection config for this connection. The config may be read-only.- Returns:
- connection config
-
open
Response<Void> open() throws LdapException
This will establish a connection to the LDAP. This connection should be closed usingclose()
.- Returns:
- response associated with the
ConnectionInitializer
or an empty response if no connection initializer was configured - Throws:
IllegalStateException
- if the connection is already openLdapException
- if the LDAP cannot be reached
-
open
Response<Void> open(BindRequest request) throws LdapException
This will establish a connection to the LDAP using the supplied bind request. This connection should be closed usingclose()
.- Parameters:
request
- containing bind information- Returns:
- response associated with the bind operation
- Throws:
IllegalStateException
- if the connection is already openLdapException
- if the LDAP cannot be reached
-
isOpen
boolean isOpen()
Returns whetheropen(BindRequest)
was successfully invoked on this connection andclose()
has not been invoked. This method does not indicate the viability of this connection for use.- Returns:
- whether this connection is open
-
getProviderConnection
ProviderConnection getProviderConnection()
Returns the provider connection to invoke the provider specific implementation. Must be called after a successful call toopen()
.- Returns:
- provider connection
-
close
void close()
This will close the connection to the LDAP.- Specified by:
close
in interfaceAutoCloseable
-
close
void close(RequestControl[] controls)
This will close the connection to the LDAP using the supplied controls.- Parameters:
controls
- request controls
-
reopen
Response<Void> reopen() throws LdapException
This will close an existing connection to the LDAP and establish a new connection to the LDAP.- Returns:
- response associated with the
ConnectionInitializer
or an empty response if no connection initializer was configured - Throws:
LdapException
- if the LDAP cannot be reached
-
reopen
Response<Void> reopen(BindRequest request) throws LdapException
This will close an existing connection to the LDAP and establish a new connection to the LDAP using the supplied bind request.- Parameters:
request
- containing bind information- Returns:
- response associated with the bind operation
- Throws:
LdapException
- if the LDAP cannot be reached
-
-