public class LdapNetworkConnection extends AbstractLdapConnection implements LdapAsyncConnection
| Modifier and Type | Field and Description |
|---|---|
private AtomicBoolean |
authenticated
A flag indicating that the BindRequest has been issued and successfully authenticated the user
|
private List<ConnectionClosedEventListener> |
conCloseListeners
a list of listeners interested in getting notified when the
connection's session gets closed cause of network issues
|
private LdapConnectionConfig |
config
configuration object for the connection
|
private AtomicBoolean |
connected
A flag indicating that the connection is connected or not
|
private org.apache.mina.transport.socket.SocketSessionConfig |
connectionConfig
The Sockect configuratio
|
private org.apache.mina.core.service.IoConnector |
connector
The connector open with the remote server
|
private ReentrantLock |
connectorMutex
A mutex used to avoid a double close of the connector
|
private static String |
EXCEPTION_KEY
The exception stored in the session if we've got one
|
private Map<Integer,ResponseFuture<? extends org.apache.directory.api.ldap.model.message.Response>> |
futureMap
a map to hold the ResponseFutures for all operations
|
private org.apache.mina.core.filterchain.IoFilter |
ldapProtocolFilter
The Ldap codec protocol filter
|
private org.apache.mina.core.session.IoSession |
ldapSession
The created session, created when we open a connection with
the Ldap server.
|
private static org.slf4j.Logger |
LOG
logger for reporting errors that might not be handled properly upstream
|
(package private) static String |
NO_RESPONSE_ERROR |
private org.apache.directory.api.ldap.model.entry.Entry |
rootDse
The ROOT DSE entry
|
private static String |
SSL_FILTER_KEY
the SslFilter key
|
private List<String> |
supportedControls
list of controls supported by the server
|
(package private) static String |
TIME_OUT_ERROR |
private long |
timeout
The timeout used for response we are waiting for
|
codec, messageId, schemaManager| Constructor and Description |
|---|
LdapNetworkConnection()
Create a new instance of a LdapConnection on localhost,
port 389.
|
LdapNetworkConnection(boolean useSsl)
Create a new instance of a LdapConnection on localhost,
port 389 if the SSL flag is off, or 636 otherwise.
|
LdapNetworkConnection(boolean useSsl,
org.apache.directory.api.ldap.codec.api.LdapApiService ldapApiService)
Creates a new LdapNetworkConnection instance
|
LdapNetworkConnection(LdapConnectionConfig config)
Creates a new instance of LdapConnection with the given connection configuration.
|
LdapNetworkConnection(LdapConnectionConfig config,
org.apache.directory.api.ldap.codec.api.LdapApiService ldapApiService)
Creates a new LdapNetworkConnection instance
|
LdapNetworkConnection(String server)
Create a new instance of a LdapConnection on a given
server, using the default port (389).
|
LdapNetworkConnection(String server,
boolean useSsl)
Create a new instance of a LdapConnection on a given
server, using the default port (389) if the SSL flag
is off, or 636 otherwise.
|
LdapNetworkConnection(String server,
boolean useSsl,
org.apache.directory.api.ldap.codec.api.LdapApiService ldapApiService)
Creates a new LdapNetworkConnection instance
|
LdapNetworkConnection(String server,
int port)
Create a new instance of a LdapConnection on a
given server and a given port.
|
LdapNetworkConnection(String server,
int port,
boolean useSsl)
Create a new instance of a LdapConnection on a given
server, and a give port.
|
LdapNetworkConnection(String server,
int port,
boolean useSsl,
org.apache.directory.api.ldap.codec.api.LdapApiService ldapApiService)
Create a new instance of a LdapConnection on a
given server and a given port.
|
LdapNetworkConnection(String server,
int port,
org.apache.directory.api.ldap.codec.api.LdapApiService ldapApiService)
Create a new instance of a LdapConnection on a
given server and a given port.
|
LdapNetworkConnection(String server,
int port,
TrustManager... trustManagers)
Create a new instance of a LdapConnection on a given
server, and a give port.
|
LdapNetworkConnection(String server,
org.apache.directory.api.ldap.codec.api.LdapApiService ldapApiService)
Creates a new LdapNetworkConnection instance
|
| Modifier and Type | Method and Description |
|---|---|
void |
abandon(org.apache.directory.api.ldap.model.message.AbandonRequest abandonRequest)
An abandon request essentially with the request message ID of the operation to be canceled
and/or potentially some controls and timeout (the controls and timeout are not mandatory).
|
void |
abandon(int messageId)
Abandons a request submitted to the server for performing a particular operation.
|
private void |
abandonInternal(org.apache.directory.api.ldap.model.message.AbandonRequest abandonRequest)
Internal AbandonRequest handling
|
org.apache.directory.api.ldap.model.message.AddResponse |
add(org.apache.directory.api.ldap.model.message.AddRequest addRequest)
Add an entry present in the
AddRequest to the server. |
void |
add(org.apache.directory.api.ldap.model.entry.Entry entry)
Add an entry to the server.
|
AddFuture |
addAsync(org.apache.directory.api.ldap.model.message.AddRequest addRequest)
Add an entry present in the AddRequest to the server.
|
AddFuture |
addAsync(org.apache.directory.api.ldap.model.entry.Entry entry)
Add an entry to the server asynchronously.
|
void |
addConnectionClosedEventListener(ConnectionClosedEventListener ccListener)
Adds the connection closed event listener.
|
private void |
addControls(org.apache.directory.api.ldap.model.message.Message codec,
org.apache.directory.api.ldap.model.message.Message message) |
void |
addSchema(File schemaFile)
parses the given schema file present in OpenLDAP schema format
and adds all the SchemaObjects present in it to the SchemaManager
|
void |
addSchema(String schemaFileName) |
private void |
addSslFilter()
adds
SslFilter to the IOConnector or IOSession's filter chain |
private void |
addToFutureMap(int messageId,
ResponseFuture<? extends org.apache.directory.api.ldap.model.message.Response> future) |
void |
anonymousBind()
Anonymous bind on a server.
|
BindFuture |
anonymousBindAsync()
Anonymous asynchronous Bind on a server.
|
void |
bind()
Bind on a server, using the
LdapConnectionConfig information of this connection. |
org.apache.directory.api.ldap.model.message.BindResponse |
bind(org.apache.directory.api.ldap.model.message.BindRequest bindRequest)
Bind to the server using a bind request object.
|
org.apache.directory.api.ldap.model.message.BindResponse |
bind(SaslCramMd5Request request)
Bind to the server using a CramMd5Request object.
|
org.apache.directory.api.ldap.model.message.BindResponse |
bind(SaslDigestMd5Request request)
Bind to the server using a DigestMd5Request object.
|
org.apache.directory.api.ldap.model.message.BindResponse |
bind(SaslGssApiRequest request)
Bind to the server using a GssApiRequest object.
|
BindFuture |
bindAsync()
Asynchronous Bind on a server, using the LdapConnectionConfig informations.
|
BindFuture |
bindAsync(org.apache.directory.api.ldap.model.message.BindRequest bindRequest)
Do an asynchronous bind, based on a BindRequest.
|
BindFuture |
bindAsync(org.apache.directory.api.ldap.model.name.Dn name)
Asynchronous unauthenticated authentication Bind on a server.
|
BindFuture |
bindAsync(org.apache.directory.api.ldap.model.name.Dn name,
String credentials)
Simple asynchronous Bind on a server.
|
BindFuture |
bindAsync(SaslGssApiRequest request)
Do an asynchronous bind, based on a GssApiRequest.
|
BindFuture |
bindAsync(SaslRequest request)
Do an asynchronous bind, based on a SaslPlainRequest.
|
BindFuture |
bindAsync(String name)
Asynchronous unauthenticated authentication bind
|
BindFuture |
bindAsync(String name,
String credentials)
Simple asynchronous Bind on a server.
|
private BindFuture |
bindSasl(SaslRequest saslRequest)
Process the SASL Bind.
|
org.apache.directory.api.ldap.model.message.BindResponse |
bindSaslPlain(String authcid,
String credentials)
SASL PLAIN Bind on a server.
|
org.apache.directory.api.ldap.model.message.BindResponse |
bindSaslPlain(String authzid,
String authcid,
String credentials)
SASL PLAIN Bind on a server.
|
private static LdapConnectionConfig |
buildConfig(String server,
int port,
boolean useSsl) |
private void |
checkSession()
Check that a session is valid, ie we can send requests to the
server
|
private void |
clearMaps()
clears the async listener, responseQueue and future mapppings to the corresponding request IDs
|
void |
close()
Disconnect from the remote LDAP server.
|
org.apache.directory.api.ldap.model.message.CompareResponse |
compare(org.apache.directory.api.ldap.model.message.CompareRequest compareRequest)
Compares an entry's attribute's value with that of the given value.
|
boolean |
compare(org.apache.directory.api.ldap.model.name.Dn dn,
String attributeName,
byte[] value)
Compares whether a given attribute's value matches that of the
existing value of the attribute present in the entry with the given distinguished name.
|
boolean |
compare(org.apache.directory.api.ldap.model.name.Dn dn,
String attributeName,
String value)
Compares whether a given attribute's value matches that of the
existing value of the attribute present in the entry with the given distinguished name.
|
boolean |
compare(org.apache.directory.api.ldap.model.name.Dn dn,
String attributeName,
org.apache.directory.api.ldap.model.entry.Value<?> value)
Compares whether a given attribute's value matches that of the
existing value of the attribute present in the entry with the given distinguished name.
|
boolean |
compare(String dn,
String attributeName,
byte[] value)
Compares whether a given attribute's value matches that of the
existing value of the attribute present in the entry with the given distinguished name.
|
boolean |
compare(String dn,
String attributeName,
String value)
Compares whether a given attribute's value matches that of the
existing value of the attribute present in the entry with the given distinguished name.
|
boolean |
compare(String dn,
String attributeName,
org.apache.directory.api.ldap.model.entry.Value<?> value)
Compares whether a given attribute's value matches that of the
existing value of the attribute present in the entry with the given distinguished name.
|
CompareFuture |
compareAsync(org.apache.directory.api.ldap.model.message.CompareRequest compareRequest)
Asynchronously compares an entry's attribute's value with that of the given value
|
boolean |
connect()
Connect to the remote LDAP server.
|
private org.apache.directory.api.ldap.model.message.BindRequest |
createBindRequest(org.apache.directory.api.ldap.model.name.Dn name,
byte[] credentials)
Create a Simple BindRequest ready to be sent.
|
private org.apache.directory.api.ldap.model.message.BindRequest |
createBindRequest(String name,
byte[] credentials)
Create a Simple BindRequest ready to be sent.
|
private void |
createConnector()
Create the connector
|
private String |
createKrb5ConfFile(String realmName,
String kdcHost,
int kdcPort)
method to write the kerberos config in the standard MIT kerberos format
This is required cause the JGSS api is not able to recognize the port value set
in the system property java.security.krb5.kdc this issue makes it impossible
to set a kdc running non standard ports (other than 88)
e.g localhost:6088
|
org.apache.directory.api.ldap.model.message.DeleteResponse |
delete(org.apache.directory.api.ldap.model.message.DeleteRequest deleteRequest)
Performs a delete operation based on the delete request object.
|
void |
delete(org.apache.directory.api.ldap.model.name.Dn dn)
Deletes the entry with the given distinguished name.
|
void |
delete(String dn)
Deletes the entry with the given distinguished name.
|
DeleteFuture |
deleteAsync(org.apache.directory.api.ldap.model.message.DeleteRequest deleteRequest)
Performs an asynchronous delete operation based on the delete request object.
|
void |
deleteTree(org.apache.directory.api.ldap.model.name.Dn dn)
deletes the entry with the given Dn, and all its children
|
void |
deleteTree(String dn)
deletes the entry with the given Dn, and all its children
|
boolean |
doesFutureExistFor(int messageId)
Checks if there is a ResponseFuture associated with the given message ID.
|
void |
exceptionCaught(org.apache.mina.core.session.IoSession session,
Throwable cause)
Handle the exception we got.
|
boolean |
exists(org.apache.directory.api.ldap.model.name.Dn dn)
Tells if an Entry exists in the server.
|
boolean |
exists(String dn)
Tells if an entry exists in the server.
|
org.apache.directory.api.ldap.model.message.ExtendedResponse |
extended(org.apache.directory.api.ldap.model.message.ExtendedRequest extendedRequest)
Performs an extended operation based on the extended request object.
|
org.apache.directory.api.ldap.model.message.ExtendedResponse |
extended(org.apache.directory.api.asn1.util.Oid oid)
Sends a extended operation request to the server with the given OID and no value.
|
org.apache.directory.api.ldap.model.message.ExtendedResponse |
extended(org.apache.directory.api.asn1.util.Oid oid,
byte[] value)
Sends a extended operation request to the server with the given OID and value.
|
org.apache.directory.api.ldap.model.message.ExtendedResponse |
extended(String oid)
Sends a extended operation request to the server with the given OID and no value.
|
org.apache.directory.api.ldap.model.message.ExtendedResponse |
extended(String oid,
byte[] value)
Sends a extended operation request to the server with the given OID and value.
|
ExtendedFuture |
extendedAsync(org.apache.directory.api.ldap.model.message.ExtendedRequest extendedRequest)
Asynchronously requests the server to perform an extended operation based on the given request.
|
private void |
fetchRootDSE(String... explicitAttributes)
fetches the rootDSE from the server
|
org.apache.directory.api.ldap.codec.api.BinaryAttributeDetector |
getBinaryAttributeDetector() |
org.apache.directory.api.ldap.codec.api.LdapApiService |
getCodecService()
Gets the LDAP CODEC service responsible for encoding and decoding
messages.
|
LdapConnectionConfig |
getConfig()
gives the configuration information of the connection
|
org.apache.mina.transport.socket.SocketSessionConfig |
getConnectionConfig() |
private ResponseFuture<? extends org.apache.directory.api.ldap.model.message.Response> |
getFromFutureMap(int messageId) |
org.apache.directory.api.ldap.model.entry.Entry |
getRootDse()
Get back the RooDSE from the connected server.
|
org.apache.directory.api.ldap.model.entry.Entry |
getRootDse(String... attributes)
Get back the RooDSE from the connected server.
|
org.apache.directory.api.ldap.model.schema.SchemaManager |
getSchemaManager() |
List<String> |
getSupportedControls()
Get the Controls supported by server.
|
long |
getTimeout(long connectionTimoutInMS,
int searchTimeLimitInSeconds)
Get the largest timeout from the search time limit and the connection
timeout.
|
void |
inputClosed(org.apache.mina.core.session.IoSession session) |
boolean |
isAuthenticated()
Check if the connection is authenticated.
|
boolean |
isConnected()
Check if the connection is established
|
boolean |
isControlSupported(String controlOID)
Checks if a control with the given OID is supported.
|
private boolean |
isNoticeOfDisconnect(org.apache.directory.api.ldap.model.message.Message message)
Check if the message is a NoticeOfDisconnect message
|
boolean |
isRequestCompleted(int messageId)
Checks if a request has been completed, or not.
|
boolean |
isSecured()
Tells if the connection is using a secured channel
|
void |
loadSchema()
Loads all the default schemas that are bundled with the API.
Note: This method enables all schemas prior to loading. |
void |
loadSchema(org.apache.directory.api.ldap.model.schema.registries.SchemaLoader loader)
loads schema using the specified schema loader
|
void |
loadSchemaRelaxed()
Loads all the default schemas that are bundled with the API, in a relaxed mode.
Note: This method enables all schemas prior to loading. The relaxed mode will allow inconsistencies in the schema. |
org.apache.directory.api.ldap.model.entry.Entry |
lookup(org.apache.directory.api.ldap.model.name.Dn dn)
Searches for an entry having the given distinguished name.
|
org.apache.directory.api.ldap.model.entry.Entry |
lookup(org.apache.directory.api.ldap.model.name.Dn dn,
org.apache.directory.api.ldap.model.message.Control[] controls,
String... attributes)
Searches for an entry having the given distinguished name.
|
org.apache.directory.api.ldap.model.entry.Entry |
lookup(org.apache.directory.api.ldap.model.name.Dn dn,
String... attributes)
Searches for an entry having the given distinguished name.
|
org.apache.directory.api.ldap.model.entry.Entry |
lookup(String dn)
Searches for an entry having the given distinguished name.
|
org.apache.directory.api.ldap.model.entry.Entry |
lookup(String dn,
org.apache.directory.api.ldap.model.message.Control[] controls,
String... attributes)
Searches for an entry having the given distinguished name.
|
org.apache.directory.api.ldap.model.entry.Entry |
lookup(String dn,
String... attributes)
Searches for an entry having the given distinguished name.
|
void |
messageReceived(org.apache.mina.core.session.IoSession session,
Object message)
Handle the incoming LDAP messages.
|
void |
modify(org.apache.directory.api.ldap.model.name.Dn dn,
org.apache.directory.api.ldap.model.entry.Modification... modifications)
Applies all the modifications to the entry specified by its distinguished name.
|
void |
modify(org.apache.directory.api.ldap.model.entry.Entry entry,
org.apache.directory.api.ldap.model.entry.ModificationOperation modOp)
Modifies all the attributes present in the entry by applying the same operation.
|
org.apache.directory.api.ldap.model.message.ModifyResponse |
modify(org.apache.directory.api.ldap.model.message.ModifyRequest modRequest)
Performs an modify operation based on the modifications present in
the modify request.
|
void |
modify(String dn,
org.apache.directory.api.ldap.model.entry.Modification... modifications)
Applies all the modifications to the entry specified by its distinguished name.
|
ModifyFuture |
modifyAsync(org.apache.directory.api.ldap.model.message.ModifyRequest modRequest)
Performs an asynchronous modify operation based on the modifications present in
the ModifyRequest.
|
org.apache.directory.api.ldap.model.message.ModifyDnResponse |
modifyDn(org.apache.directory.api.ldap.model.message.ModifyDnRequest modDnRequest)
Performs the modifyDn operation based on the given request object.
|
ModifyDnFuture |
modifyDnAsync(org.apache.directory.api.ldap.model.message.ModifyDnRequest modDnRequest)
Performs the modifyDn operation based on the given ModifyDnRequest.
|
void |
move(org.apache.directory.api.ldap.model.name.Dn entryDn,
org.apache.directory.api.ldap.model.name.Dn newSuperiorDn)
Moves the given entry distinguished name under the new superior distinguished name.
|
void |
move(String entryDn,
String newSuperiorDn)
Moves the given entry distinguished name under the new superior distinguished name.
|
void |
moveAndRename(org.apache.directory.api.ldap.model.name.Dn entryDn,
org.apache.directory.api.ldap.model.name.Dn newDn)
Moves and renames the given entryDn.
|
void |
moveAndRename(org.apache.directory.api.ldap.model.name.Dn entryDn,
org.apache.directory.api.ldap.model.name.Dn newDn,
boolean deleteOldRdn)
Moves and renames the given entryDn.
|
void |
moveAndRename(String entryDn,
String newDn)
Moves and renames the given entry distinguished name.
|
void |
moveAndRename(String entryDn,
String newDn,
boolean deleteOldRdn)
Moves and renames the given entryDn.
|
private ResponseFuture<? extends org.apache.directory.api.ldap.model.message.Response> |
peekFromFutureMap(int messageId) |
private void |
removeFromFutureMaps(int msgId)
removes the Objects associated with the given message ID
from future and response queue maps
|
void |
rename(org.apache.directory.api.ldap.model.name.Dn entryDn,
org.apache.directory.api.ldap.model.name.Rdn newRdn)
Renames the given entryDn with new relative distinguished name and deletes the
old relative distinguished name.
|
void |
rename(org.apache.directory.api.ldap.model.name.Dn entryDn,
org.apache.directory.api.ldap.model.name.Rdn newRdn,
boolean deleteOldRdn)
Renames the given entryDn with new relative distinguished name and deletes the
old relative distinguished name if deleteOldRdn is set to true.
|
void |
rename(String entryDn,
String newRdn)
Renames the given entryDn with new relative distinguished name and deletes the
old relative distinguished name.
|
void |
rename(String entryDn,
String newRdn,
boolean deleteOldRdn)
Renames the given entryDn with new relative distinguished name and deletes the
old relative distinguished name if deleteOldRdn is set to true.
|
org.apache.directory.api.ldap.model.cursor.EntryCursor |
search(org.apache.directory.api.ldap.model.name.Dn baseDn,
String filter,
org.apache.directory.api.ldap.model.message.SearchScope scope,
String... attributes)
Do a search, on the base object, using the given filter and scope.
|
org.apache.directory.api.ldap.model.cursor.SearchCursor |
search(org.apache.directory.api.ldap.model.message.SearchRequest searchRequest)
Performs search using a search request object.
|
org.apache.directory.api.ldap.model.cursor.EntryCursor |
search(String baseDn,
String filter,
org.apache.directory.api.ldap.model.message.SearchScope scope,
String... attributes)
Do a search, on the base object, using the given filter and scope.
|
SearchFuture |
searchAsync(org.apache.directory.api.ldap.model.name.Dn baseDn,
String filter,
org.apache.directory.api.ldap.model.message.SearchScope scope,
String... attributes)
Do an asynchronous search, on the base object, using the given filter.
|
SearchFuture |
searchAsync(org.apache.directory.api.ldap.model.message.SearchRequest searchRequest)
Do a search, on the base object, using the given filter.
|
SearchFuture |
searchAsync(String baseDn,
String filter,
org.apache.directory.api.ldap.model.message.SearchScope scope,
String... attributes)
Do an asynchronous search, on the base object, using the given filter.
|
void |
sessionClosed(org.apache.mina.core.session.IoSession session) |
void |
sessionCreated(org.apache.mina.core.session.IoSession session)
This method is called when a new session is created.
|
void |
setBinaryAttributeDetector(org.apache.directory.api.ldap.codec.api.BinaryAttributeDetector binaryAttributeDetector)
Sets the object responsible for the detection of binary attributes.
|
void |
setConnectionConfig(org.apache.mina.transport.socket.SocketSessionConfig connectionConfig) |
void |
setConnector(org.apache.mina.core.service.IoConnector connector)
Set the connector to use.
|
void |
setSchemaManager(org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager)
sets a SchemaManager to be used by this connection
|
void |
setTimeOut(long timeout)
Set the timeout for the responses.
|
void |
startTls()
Sends the StartTLS extended request to server and adds a security layer
upon receiving a response with successful result.
|
void |
unBind()
UnBind from a server.
|
private void |
writeRequest(org.apache.directory.api.ldap.model.message.Request request)
a reusable code block to be used in various bind methods
|
bind, bind, bind, bind, createBindRequestmessageSent, sessionIdle, sessionOpenedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbind, bind, bind, bindprivate static final org.slf4j.Logger LOG
private long timeout
private LdapConnectionConfig config
private org.apache.mina.transport.socket.SocketSessionConfig connectionConfig
private org.apache.mina.core.service.IoConnector connector
private ReentrantLock connectorMutex
private org.apache.mina.core.session.IoSession ldapSession
private Map<Integer,ResponseFuture<? extends org.apache.directory.api.ldap.model.message.Response>> futureMap
private org.apache.directory.api.ldap.model.entry.Entry rootDse
private AtomicBoolean authenticated
private AtomicBoolean connected
private List<ConnectionClosedEventListener> conCloseListeners
private org.apache.mina.core.filterchain.IoFilter ldapProtocolFilter
private static final String SSL_FILTER_KEY
private static final String EXCEPTION_KEY
static final String TIME_OUT_ERROR
static final String NO_RESPONSE_ERROR
public LdapNetworkConnection()
public LdapNetworkConnection(LdapConnectionConfig config)
config - the configuration of the LdapConnectionpublic LdapNetworkConnection(LdapConnectionConfig config, org.apache.directory.api.ldap.codec.api.LdapApiService ldapApiService)
config - The configuration to useldapApiService - The LDAP API Service to usepublic LdapNetworkConnection(boolean useSsl)
useSsl - A flag to tell if it's a SSL connection or not.public LdapNetworkConnection(boolean useSsl,
org.apache.directory.api.ldap.codec.api.LdapApiService ldapApiService)
useSsl - If we are going to create a secure connection or notldapApiService - The LDAP API Service to usepublic LdapNetworkConnection(String server)
server - The server we want to be connected to. If null or empty,
we will default to LocalHost.public LdapNetworkConnection(String server, org.apache.directory.api.ldap.codec.api.LdapApiService ldapApiService)
server - The server we want to be connected to. If null or empty,
we will default to LocalHost.ldapApiService - The LDAP API Service to usepublic LdapNetworkConnection(String server, boolean useSsl)
server - The server we want to be connected to. If null or empty,
we will default to LocalHost.useSsl - A flag to tell if it's a SSL connection or not.public LdapNetworkConnection(String server, boolean useSsl, org.apache.directory.api.ldap.codec.api.LdapApiService ldapApiService)
server - The server we want to be connected to. If null or empty,
we will default to LocalHost.useSsl - A flag to tell if it's a SSL connection or not.ldapApiService - The LDAP API Service to usepublic LdapNetworkConnection(String server, int port)
server - The server we want to be connected to. If null or empty,
we will default to LocalHost.port - The port the server is listening onpublic LdapNetworkConnection(String server, int port, org.apache.directory.api.ldap.codec.api.LdapApiService ldapApiService)
server - The server we want to be connected to. If null or empty,
we will default to LocalHost.port - The port the server is listening onldapApiService - The LDAP API Service to usepublic LdapNetworkConnection(String server, int port, boolean useSsl)
server - The server we want to be connected to. If null or empty,
we will default to LocalHost.port - The port the server is listening touseSsl - A flag to tell if it's a SSL connection or not.public LdapNetworkConnection(String server, int port, TrustManager... trustManagers)
server - The server we want to be connected to. If null or empty,
we will default to LocalHost.port - The port the server is listening totrustManagers - The TrustManager to usepublic LdapNetworkConnection(String server, int port, boolean useSsl, org.apache.directory.api.ldap.codec.api.LdapApiService ldapApiService)
server - The server we want to be connected to. If null or empty,
we will default to LocalHost.port - The port the server is listening onuseSsl - A flag to tell if it's a SSL connection or not.ldapApiService - The LDAP API Service to usepublic boolean isConnected()
isConnected in interface LdapConnectiontrue if the connection is establishedpublic boolean isAuthenticated()
isAuthenticated in interface LdapConnectiontrue if the connection is authenticatedpublic boolean isSecured()
private void checkSession()
throws InvalidConnectionException
Exception - If the session is not validInvalidConnectionExceptionprivate void addToFutureMap(int messageId,
ResponseFuture<? extends org.apache.directory.api.ldap.model.message.Response> future)
private ResponseFuture<? extends org.apache.directory.api.ldap.model.message.Response> getFromFutureMap(int messageId)
private ResponseFuture<? extends org.apache.directory.api.ldap.model.message.Response> peekFromFutureMap(int messageId)
public long getTimeout(long connectionTimoutInMS,
int searchTimeLimitInSeconds)
connectionTimoutInMS - Connection timeoutsearchTimeLimitInSeconds - Search timeoutprivate static LdapConnectionConfig buildConfig(String server, int port, boolean useSsl)
private void createConnector()
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionpublic boolean connect()
throws org.apache.directory.api.ldap.model.exception.LdapException
connect in interface LdapConnectiontrue if the connection is established, false otherwiseorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in interface LdapConnectionIOException - if some I/O error occurspublic void add(org.apache.directory.api.ldap.model.entry.Entry entry)
throws org.apache.directory.api.ldap.model.exception.LdapException
add in interface LdapConnectionentry - The entry to addorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic AddFuture addAsync(org.apache.directory.api.ldap.model.entry.Entry entry) throws org.apache.directory.api.ldap.model.exception.LdapException
addAsync in interface LdapAsyncConnectionentry - The entry to addorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic org.apache.directory.api.ldap.model.message.AddResponse add(org.apache.directory.api.ldap.model.message.AddRequest addRequest)
throws org.apache.directory.api.ldap.model.exception.LdapException
AddRequest to the server.add in interface LdapConnectionaddRequest - the request object containing an entry and controls (if any)org.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic AddFuture addAsync(org.apache.directory.api.ldap.model.message.AddRequest addRequest) throws org.apache.directory.api.ldap.model.exception.LdapException
addAsync in interface LdapAsyncConnectionaddRequest - the request object containing an entry and controls(if any)org.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic void abandon(int messageId)
abandon in interface LdapConnectionmessageId - the ID of the request message sent to the serverpublic void abandon(org.apache.directory.api.ldap.model.message.AbandonRequest abandonRequest)
abandon in interface LdapConnectionabandonRequest - the abandon operation's requestprivate void abandonInternal(org.apache.directory.api.ldap.model.message.AbandonRequest abandonRequest)
public void bind()
throws org.apache.directory.api.ldap.model.exception.LdapException
LdapConnectionConfig information of this connection.bind in interface LdapConnectionorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic void anonymousBind()
throws org.apache.directory.api.ldap.model.exception.LdapException
anonymousBind in interface LdapConnectionorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic BindFuture bindAsync() throws org.apache.directory.api.ldap.model.exception.LdapException
bindAsync in interface LdapAsyncConnectionorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic BindFuture anonymousBindAsync() throws org.apache.directory.api.ldap.model.exception.LdapException
anonymousBindAsync in interface LdapAsyncConnectionorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic BindFuture bindAsync(String name) throws org.apache.directory.api.ldap.model.exception.LdapException
name - The name we use to authenticate the user. It must be a
valid Dnorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic BindFuture bindAsync(String name, String credentials) throws org.apache.directory.api.ldap.model.exception.LdapException
bindAsync in interface LdapAsyncConnectionname - The name we use to authenticate the user, it must be a valid Dncredentials - The password, it can't be nullorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic BindFuture bindAsync(org.apache.directory.api.ldap.model.name.Dn name) throws org.apache.directory.api.ldap.model.exception.LdapException
name - The name we use to authenticate the user. It must be a
valid Dnorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic BindFuture bindAsync(org.apache.directory.api.ldap.model.name.Dn name, String credentials) throws org.apache.directory.api.ldap.model.exception.LdapException
bindAsync in interface LdapAsyncConnectionname - The name we use to authenticate the user, it must be a valid Dncredentials - The password, it can't be nullorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic org.apache.directory.api.ldap.model.message.BindResponse bind(org.apache.directory.api.ldap.model.message.BindRequest bindRequest)
throws org.apache.directory.api.ldap.model.exception.LdapException
bind in interface LdapConnectionbindRequest - The bind request object containing all the needed parametersBindResponse containing the resultorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredprivate org.apache.directory.api.ldap.model.message.BindRequest createBindRequest(String name, byte[] credentials) throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate org.apache.directory.api.ldap.model.message.BindRequest createBindRequest(org.apache.directory.api.ldap.model.name.Dn name,
byte[] credentials)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionpublic BindFuture bindAsync(org.apache.directory.api.ldap.model.message.BindRequest bindRequest) throws org.apache.directory.api.ldap.model.exception.LdapException
bindAsync in interface LdapAsyncConnectionbindRequest - The BindRequest to sendorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic org.apache.directory.api.ldap.model.message.BindResponse bindSaslPlain(String authcid, String credentials) throws org.apache.directory.api.ldap.model.exception.LdapException
authcid - The Authentication identitycredentials - The password. It can't be nullorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic org.apache.directory.api.ldap.model.message.BindResponse bindSaslPlain(String authzid, String authcid, String credentials) throws org.apache.directory.api.ldap.model.exception.LdapException
authzid - The Authorization identityauthcid - The Authentication identitycredentials - The password. It can't be nullorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic org.apache.directory.api.ldap.model.message.BindResponse bind(SaslCramMd5Request request) throws org.apache.directory.api.ldap.model.exception.LdapException
request - The CramMd5Request POJO containing all the needed parametersorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic BindFuture bindAsync(SaslRequest request) throws org.apache.directory.api.ldap.model.exception.LdapException
request - The SaslPlainRequest POJO containing all the needed parametersorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic org.apache.directory.api.ldap.model.message.BindResponse bind(SaslDigestMd5Request request) throws org.apache.directory.api.ldap.model.exception.LdapException
request - The DigestMd5Request POJO containing all the needed parametersorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic org.apache.directory.api.ldap.model.message.BindResponse bind(SaslGssApiRequest request) throws org.apache.directory.api.ldap.model.exception.LdapException
request - The GssApiRequest POJO containing all the needed parametersorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic BindFuture bindAsync(SaslGssApiRequest request) throws org.apache.directory.api.ldap.model.exception.LdapException
request - The GssApiRequest POJO containing all the needed parametersorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic org.apache.directory.api.ldap.model.cursor.EntryCursor search(org.apache.directory.api.ldap.model.name.Dn baseDn,
String filter,
org.apache.directory.api.ldap.model.message.SearchScope scope,
String... attributes)
throws org.apache.directory.api.ldap.model.exception.LdapException
search in interface LdapConnectionbaseDn - The base for the search. It must be a valid distinguished name and can't be emtpyfilter - The filter to use for this search. It can't be emptyscope - The search scope : OBJECT, ONELEVEL or SUBTREEattributes - The attributes to use for this searchEntryCursor on the result.org.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic org.apache.directory.api.ldap.model.cursor.EntryCursor search(String baseDn, String filter, org.apache.directory.api.ldap.model.message.SearchScope scope, String... attributes) throws org.apache.directory.api.ldap.model.exception.LdapException
search in interface LdapConnectionbaseDn - The base for the search. It must be a valid distinguished name, and can't be emtpyfilter - The filter to use for this search. It can't be emptyscope - The search scope : OBJECT, ONELEVEL or SUBTREEattributes - The attributes to use for this searchEntryCursor on the result.org.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic SearchFuture searchAsync(org.apache.directory.api.ldap.model.name.Dn baseDn, String filter, org.apache.directory.api.ldap.model.message.SearchScope scope, String... attributes) throws org.apache.directory.api.ldap.model.exception.LdapException
Scope : ONE DerefAlias : ALWAYS SizeLimit : none TimeLimit : none TypesOnly : false Attributes : all the user's attributes. This method is blocking.
searchAsync in interface LdapAsyncConnectionbaseDn - The base for the search, it must be a valid Dn, and can't be emptyfilter - The filter to use for this search, it can't be emptyscope - The search scope : OBJECT, ONELEVEL or SUBTREEattributes - The attributes for this searchorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic SearchFuture searchAsync(String baseDn, String filter, org.apache.directory.api.ldap.model.message.SearchScope scope, String... attributes) throws org.apache.directory.api.ldap.model.exception.LdapException
Scope : ONE DerefAlias : ALWAYS SizeLimit : none TimeLimit : none TypesOnly : false Attributes : all the user's attributes. This method is blocking.
searchAsync in interface LdapAsyncConnectionbaseDn - The base for the search, it must be a valid Dn, and can't be emtpyfilter - The filter to use for this search, it can't be emptyscope - The search scope : OBJECT, ONELEVEL or SUBTREEattributes - The attributes for this searchorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic SearchFuture searchAsync(org.apache.directory.api.ldap.model.message.SearchRequest searchRequest) throws org.apache.directory.api.ldap.model.exception.LdapException
Scope : ONE DerefAlias : ALWAYS SizeLimit : none TimeLimit : none TypesOnly : false Attributes : all the user's attributes. This method is blocking.
searchAsync in interface LdapAsyncConnectionsearchRequest - The search request to send to the serverorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic org.apache.directory.api.ldap.model.cursor.SearchCursor search(org.apache.directory.api.ldap.model.message.SearchRequest searchRequest)
throws org.apache.directory.api.ldap.model.exception.LdapException
search in interface LdapConnectionsearchRequest - The search request object containing all the needed informationorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic void unBind()
throws org.apache.directory.api.ldap.model.exception.LdapException
unBind in interface LdapConnectionorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic void setConnector(org.apache.mina.core.service.IoConnector connector)
connector - The connector to usepublic void setTimeOut(long timeout)
setTimeOut in interface LdapConnectiontimeout - The timeout, in millisecondspublic void exceptionCaught(org.apache.mina.core.session.IoSession session,
Throwable cause)
throws Exception
exceptionCaught in interface org.apache.mina.core.service.IoHandlerexceptionCaught in class org.apache.mina.core.service.IoHandlerAdaptersession - The session we got the exception oncause - The exception causeException - The tprivate boolean isNoticeOfDisconnect(org.apache.directory.api.ldap.model.message.Message message)
public void messageReceived(org.apache.mina.core.session.IoSession session,
Object message)
throws Exception
messageReceived in interface org.apache.mina.core.service.IoHandlermessageReceived in class org.apache.mina.core.service.IoHandlerAdaptersession - The session that received a messagemessage - The received messageException - If there is some error while processing the messagepublic void modify(org.apache.directory.api.ldap.model.entry.Entry entry,
org.apache.directory.api.ldap.model.entry.ModificationOperation modOp)
throws org.apache.directory.api.ldap.model.exception.LdapException
modify in interface LdapConnectionentry - the entry with the attributes to be modifiedmodOp - the operation to be applied on all the attributes of the above entryorg.apache.directory.api.ldap.model.exception.LdapException - in case of modify operation failure or timeout happenspublic void modify(org.apache.directory.api.ldap.model.name.Dn dn,
org.apache.directory.api.ldap.model.entry.Modification... modifications)
throws org.apache.directory.api.ldap.model.exception.LdapException
modify in interface LdapConnectiondn - The entry's distinguished namemodifications - The list of modifications to be appliedorg.apache.directory.api.ldap.model.exception.LdapException - in case of modify operation failure or timeout happenspublic void modify(String dn, org.apache.directory.api.ldap.model.entry.Modification... modifications) throws org.apache.directory.api.ldap.model.exception.LdapException
modify in interface LdapConnectiondn - The entry's distinguished name, it must be a valid distinguished name.modifications - The list of modifications to be appliedorg.apache.directory.api.ldap.model.exception.LdapException - in case of modify operation failure or timeout happenspublic org.apache.directory.api.ldap.model.message.ModifyResponse modify(org.apache.directory.api.ldap.model.message.ModifyRequest modRequest)
throws org.apache.directory.api.ldap.model.exception.LdapException
modify in interface LdapConnectionmodRequest - the modify request objectorg.apache.directory.api.ldap.model.exception.LdapException - in case of modify operation failure or timeout happenspublic ModifyFuture modifyAsync(org.apache.directory.api.ldap.model.message.ModifyRequest modRequest) throws org.apache.directory.api.ldap.model.exception.LdapException
modifyAsync in interface LdapAsyncConnectionmodRequest - the request for modify operationorg.apache.directory.api.ldap.model.exception.LdapException - in case of modify operation failure or timeout happenspublic void rename(String entryDn, String newRdn) throws org.apache.directory.api.ldap.model.exception.LdapException
rename in interface LdapConnectionentryDn - the target distinguished name.newRdn - new relative distinguished name for the target distinguished name.org.apache.directory.api.ldap.model.exception.LdapException - if some error occurredLdapConnection.rename(String, String, boolean)public void rename(org.apache.directory.api.ldap.model.name.Dn entryDn,
org.apache.directory.api.ldap.model.name.Rdn newRdn)
throws org.apache.directory.api.ldap.model.exception.LdapException
rename in interface LdapConnectionentryDn - the target distinguished name.newRdn - new relative distinguished name for the target distinguished name.org.apache.directory.api.ldap.model.exception.LdapException - if some error occurredLdapConnection.rename(Dn, Rdn, boolean)public void rename(String entryDn, String newRdn, boolean deleteOldRdn) throws org.apache.directory.api.ldap.model.exception.LdapException
rename in interface LdapConnectionentryDn - the target distinguished name.newRdn - new relative distinguished name for the target distinguished name.deleteOldRdn - flag to indicate whether to delete the old relative distinguished nameorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredLdapConnection.rename(Dn, Rdn, boolean)public void rename(org.apache.directory.api.ldap.model.name.Dn entryDn,
org.apache.directory.api.ldap.model.name.Rdn newRdn,
boolean deleteOldRdn)
throws org.apache.directory.api.ldap.model.exception.LdapException
rename in interface LdapConnectionentryDn - the target distinguished name.newRdn - new relative distinguished name for the target distinguished name.deleteOldRdn - flag to indicate whether to delete the old relative distinguished nameorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic void move(String entryDn, String newSuperiorDn) throws org.apache.directory.api.ldap.model.exception.LdapException
move in interface LdapConnectionentryDn - the distinguished name of the target entrynewSuperiorDn - distinguished name of the new parent/superiororg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredLdapConnection.move(Dn, Dn)public void move(org.apache.directory.api.ldap.model.name.Dn entryDn,
org.apache.directory.api.ldap.model.name.Dn newSuperiorDn)
throws org.apache.directory.api.ldap.model.exception.LdapException
move in interface LdapConnectionentryDn - the distinguished name of the target entrynewSuperiorDn - distinguished name of the new parent/superiororg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic void moveAndRename(org.apache.directory.api.ldap.model.name.Dn entryDn,
org.apache.directory.api.ldap.model.name.Dn newDn)
throws org.apache.directory.api.ldap.model.exception.LdapException
moveAndRename in interface LdapConnectionentryDn - The original entry distinguished name.newDn - The new entry distinguished name.org.apache.directory.api.ldap.model.exception.LdapException - if some error occurredLdapConnection.moveAndRename(Dn, Dn, boolean)public void moveAndRename(String entryDn, String newDn) throws org.apache.directory.api.ldap.model.exception.LdapException
moveAndRename in interface LdapConnectionentryDn - The original entry distinguished name.newDn - The new entry distinguished name.org.apache.directory.api.ldap.model.exception.LdapException - if some error occurredLdapConnection.moveAndRename(Dn, Dn, boolean)public void moveAndRename(org.apache.directory.api.ldap.model.name.Dn entryDn,
org.apache.directory.api.ldap.model.name.Dn newDn,
boolean deleteOldRdn)
throws org.apache.directory.api.ldap.model.exception.LdapException
moveAndRename in interface LdapConnectionentryDn - The original entry distinguished name.newDn - The new entry distinguished name.deleteOldRdn - Tells if the old relative distinguished name must be removedorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic void moveAndRename(String entryDn, String newDn, boolean deleteOldRdn) throws org.apache.directory.api.ldap.model.exception.LdapException
moveAndRename in interface LdapConnectionentryDn - The original entry distinguished name.newDn - The new entry distinguished name.deleteOldRdn - Tells if the old relative distinguished name must be removedorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic org.apache.directory.api.ldap.model.message.ModifyDnResponse modifyDn(org.apache.directory.api.ldap.model.message.ModifyDnRequest modDnRequest)
throws org.apache.directory.api.ldap.model.exception.LdapException
modifyDn in interface LdapConnectionmodDnRequest - the request objectorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic ModifyDnFuture modifyDnAsync(org.apache.directory.api.ldap.model.message.ModifyDnRequest modDnRequest) throws org.apache.directory.api.ldap.model.exception.LdapException
modifyDnAsync in interface LdapAsyncConnectionmodDnRequest - the requestorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic void delete(String dn) throws org.apache.directory.api.ldap.model.exception.LdapException
delete in interface LdapConnectiondn - the target entry's distinguished name, it must be a valid distinguished name.org.apache.directory.api.ldap.model.exception.LdapException - If the distinguished name is not valid or if the deletion failedpublic void delete(org.apache.directory.api.ldap.model.name.Dn dn)
throws org.apache.directory.api.ldap.model.exception.LdapException
delete in interface LdapConnectiondn - the target entry's distinguished nameorg.apache.directory.api.ldap.model.exception.LdapException - If the distinguished name is not valid or if the deletion failedpublic void deleteTree(org.apache.directory.api.ldap.model.name.Dn dn)
throws org.apache.directory.api.ldap.model.exception.LdapException
dn - the target entry's Dnorg.apache.directory.api.ldap.model.exception.LdapException - If the Dn is not valid or if the deletion failedpublic void deleteTree(String dn) throws org.apache.directory.api.ldap.model.exception.LdapException
dn - the target entry's Dn as a Stringorg.apache.directory.api.ldap.model.exception.LdapException - If the Dn is not valid or if the deletion failedpublic org.apache.directory.api.ldap.model.message.DeleteResponse delete(org.apache.directory.api.ldap.model.message.DeleteRequest deleteRequest)
throws org.apache.directory.api.ldap.model.exception.LdapException
delete in interface LdapConnectiondeleteRequest - the delete operation's requestorg.apache.directory.api.ldap.model.exception.LdapException - If the distinguished name is not valid or if the deletion failedpublic DeleteFuture deleteAsync(org.apache.directory.api.ldap.model.message.DeleteRequest deleteRequest) throws org.apache.directory.api.ldap.model.exception.LdapException
deleteAsync in interface LdapAsyncConnectiondeleteRequest - the delete operation's requestorg.apache.directory.api.ldap.model.exception.LdapException - If the Dn is not valid or if the deletion failedpublic boolean compare(String dn, String attributeName, String value) throws org.apache.directory.api.ldap.model.exception.LdapException
compare in interface LdapConnectiondn - the target entry's distinguished name, it must be a valid distinguished name.attributeName - the attribute's namevalue - a String value with which the target entry's attribute value to be compared withtrue if the value matches, false otherwiseorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic boolean compare(String dn, String attributeName, byte[] value) throws org.apache.directory.api.ldap.model.exception.LdapException
compare in interface LdapConnectiondn - the target entry's distinguished name, it must be a valid distinguished name.attributeName - the attribute's namevalue - a byte[] value with which the target entry's attribute value to be compared withtrue if the value matches, false otherwiseorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic boolean compare(String dn, String attributeName, org.apache.directory.api.ldap.model.entry.Value<?> value) throws org.apache.directory.api.ldap.model.exception.LdapException
compare in interface LdapConnectiondn - the target entry's distinguished name, it must be a valid distinguished name.attributeName - the attribute's namevalue - a Value<?> value with which the target entry's attribute value to be compared withtrue if the value matches, false otherwiseorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic boolean compare(org.apache.directory.api.ldap.model.name.Dn dn,
String attributeName,
String value)
throws org.apache.directory.api.ldap.model.exception.LdapException
compare in interface LdapConnectiondn - the target entry's distinguished nameattributeName - the attribute's namevalue - a String value with which the target entry's attribute value to be compared withtrue if the value matches, false otherwiseorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic boolean compare(org.apache.directory.api.ldap.model.name.Dn dn,
String attributeName,
byte[] value)
throws org.apache.directory.api.ldap.model.exception.LdapException
compare in interface LdapConnectiondn - the target entry's distinguished nameattributeName - the attribute's namevalue - a byte[] value with which the target entry's attribute value to be compared withtrue if the value matches, false otherwiseorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic boolean compare(org.apache.directory.api.ldap.model.name.Dn dn,
String attributeName,
org.apache.directory.api.ldap.model.entry.Value<?> value)
throws org.apache.directory.api.ldap.model.exception.LdapException
compare in interface LdapConnectiondn - the target entry's distinguished nameattributeName - the attribute's namevalue - a Value<?> value with which the target entry's attribute value to be compared withtrue if the value matches, false otherwiseorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic org.apache.directory.api.ldap.model.message.CompareResponse compare(org.apache.directory.api.ldap.model.message.CompareRequest compareRequest)
throws org.apache.directory.api.ldap.model.exception.LdapException
compare in interface LdapConnectioncompareRequest - the compare request which contains the target distinguished name,
attribute name and valueorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic CompareFuture compareAsync(org.apache.directory.api.ldap.model.message.CompareRequest compareRequest) throws org.apache.directory.api.ldap.model.exception.LdapException
compareAsync in interface LdapAsyncConnectioncompareRequest - the CompareRequest which contains the target Dn, attribute name and valueorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic org.apache.directory.api.ldap.model.message.ExtendedResponse extended(String oid) throws org.apache.directory.api.ldap.model.exception.LdapException
extended in interface LdapConnectionoid - the object identifier of the extended operationorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredLdapConnection.extended(org.apache.directory.api.asn1.util.Oid, byte[])public org.apache.directory.api.ldap.model.message.ExtendedResponse extended(String oid, byte[] value) throws org.apache.directory.api.ldap.model.exception.LdapException
extended in interface LdapConnectionoid - the object identifier of the extended operationvalue - value to be used by the extended operation, can be a null valueorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredLdapConnection.extended(org.apache.directory.api.asn1.util.Oid, byte[])public org.apache.directory.api.ldap.model.message.ExtendedResponse extended(org.apache.directory.api.asn1.util.Oid oid)
throws org.apache.directory.api.ldap.model.exception.LdapException
extended in interface LdapConnectionoid - the object identifier of the extended operationorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredLdapConnection.extended(org.apache.directory.api.asn1.util.Oid, byte[])public org.apache.directory.api.ldap.model.message.ExtendedResponse extended(org.apache.directory.api.asn1.util.Oid oid,
byte[] value)
throws org.apache.directory.api.ldap.model.exception.LdapException
extended in interface LdapConnectionoid - the object identifier of the extended operationvalue - value to be used by the extended operation, can be a null valueorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic org.apache.directory.api.ldap.model.message.ExtendedResponse extended(org.apache.directory.api.ldap.model.message.ExtendedRequest extendedRequest)
throws org.apache.directory.api.ldap.model.exception.LdapException
extended in interface LdapConnectionextendedRequest - the extended operation's requestorg.apache.directory.api.ldap.model.exception.LdapException - if the extended operation failedpublic ExtendedFuture extendedAsync(org.apache.directory.api.ldap.model.message.ExtendedRequest extendedRequest) throws org.apache.directory.api.ldap.model.exception.LdapException
extendedAsync in interface LdapAsyncConnectionextendedRequest - the object containing the details of the extended operation to be performedorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic boolean exists(String dn) throws org.apache.directory.api.ldap.model.exception.LdapException
exists in interface LdapConnectiondn - The distinguished name of the entry to check for existence, must be a valid distinguished name.true if the entry exists, false otherwise.
Note that if the entry exists but if the user does not have the permission to
read it, false will also be returnedorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic boolean exists(org.apache.directory.api.ldap.model.name.Dn dn)
throws org.apache.directory.api.ldap.model.exception.LdapException
exists in interface LdapConnectiondn - The distinguished name of the entry to check for existencetrue if the entry exists, false otherwise.
Note that if the entry exists but if the user does not have the permission to
read it, false will also be returnedorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic org.apache.directory.api.ldap.model.entry.Entry getRootDse()
throws org.apache.directory.api.ldap.model.exception.LdapException
getRootDse in interface LdapConnectionorg.apache.directory.api.ldap.model.exception.LdapException - If the rootDSE can't be readpublic org.apache.directory.api.ldap.model.entry.Entry getRootDse(String... attributes) throws org.apache.directory.api.ldap.model.exception.LdapException
getRootDse in interface LdapConnectionattributes - The list of attributes to returnorg.apache.directory.api.ldap.model.exception.LdapException - If the rootDSE can't be readpublic org.apache.directory.api.ldap.model.entry.Entry lookup(org.apache.directory.api.ldap.model.name.Dn dn)
throws org.apache.directory.api.ldap.model.exception.LdapException
lookup in interface LdapConnectiondn - the distinguished name of the entry to be fetchedorg.apache.directory.api.ldap.model.exception.LdapException - in case of any problems while searching for the distinguished name or if the returned
response contains a referralLdapConnection.lookup(Dn, String...)public org.apache.directory.api.ldap.model.entry.Entry lookup(String dn) throws org.apache.directory.api.ldap.model.exception.LdapException
lookup in interface LdapConnectiondn - the distinguished name of the entry to be fetchedorg.apache.directory.api.ldap.model.exception.LdapException - in case of any problems while searching for the distinguished name or if the returned
response contains a referralLdapConnection.lookup(String, String...)public org.apache.directory.api.ldap.model.entry.Entry lookup(org.apache.directory.api.ldap.model.name.Dn dn,
String... attributes)
throws org.apache.directory.api.ldap.model.exception.LdapException
lookup in interface LdapConnectiondn - the distinguished name of the entry to be fetchedattributes - the attributes to be returned along with entryorg.apache.directory.api.ldap.model.exception.LdapException - in case of any problems while searching for the distinguished name
or if the returned response contains a referralpublic org.apache.directory.api.ldap.model.entry.Entry lookup(org.apache.directory.api.ldap.model.name.Dn dn,
org.apache.directory.api.ldap.model.message.Control[] controls,
String... attributes)
throws org.apache.directory.api.ldap.model.exception.LdapException
lookup in interface LdapConnectiondn - the distinguished name of the entry to be fetchedcontrols - the controls to useattributes - the attributes to be returned along with entryorg.apache.directory.api.ldap.model.exception.LdapException - in case of any problems while searching for the distinguished name
or if the returned response contains a referralpublic org.apache.directory.api.ldap.model.entry.Entry lookup(String dn, String... attributes) throws org.apache.directory.api.ldap.model.exception.LdapException
lookup in interface LdapConnectiondn - the distinguished name of the entry to be fetchedattributes - the attributes to be returned along with entryorg.apache.directory.api.ldap.model.exception.LdapException - in case of any problems while searching for the distinguished name
or if the returned response contains a referralLdapConnection.lookup(Dn, String...)public org.apache.directory.api.ldap.model.entry.Entry lookup(String dn, org.apache.directory.api.ldap.model.message.Control[] controls, String... attributes) throws org.apache.directory.api.ldap.model.exception.LdapException
lookup in interface LdapConnectiondn - the distinguished name of the entry to be fetchedcontrols - the controls to useattributes - the attributes to be returned along with entryorg.apache.directory.api.ldap.model.exception.LdapException - in case of any problems while searching for the distinguished name
or if the returned response contains a referralLdapConnection.lookup(Dn, String...)public boolean isControlSupported(String controlOID) throws org.apache.directory.api.ldap.model.exception.LdapException
isControlSupported in interface LdapConnectioncontrolOID - the OID of the controlorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic List<String> getSupportedControls() throws org.apache.directory.api.ldap.model.exception.LdapException
getSupportedControls in interface LdapConnectionorg.apache.directory.api.ldap.model.exception.LdapException - if some error occurredpublic void loadSchema()
throws org.apache.directory.api.ldap.model.exception.LdapException
loadSchema in interface LdapConnectionorg.apache.directory.api.ldap.model.exception.LdapException - in case of problems while loading the schemapublic void loadSchemaRelaxed()
throws org.apache.directory.api.ldap.model.exception.LdapException
loadSchemaRelaxed in interface LdapConnectionorg.apache.directory.api.ldap.model.exception.LdapException - in case of problems while loading the schemapublic void loadSchema(org.apache.directory.api.ldap.model.schema.registries.SchemaLoader loader)
throws org.apache.directory.api.ldap.model.exception.LdapException
loader - the SchemaLoader to be used to load schemaorg.apache.directory.api.ldap.model.exception.LdapException - If the schema loading failedpublic void addSchema(File schemaFile) throws org.apache.directory.api.ldap.model.exception.LdapException
schemaFile - the schema file in OpenLDAP schema formatorg.apache.directory.api.ldap.model.exception.LdapException - in case of any errors while parsingpublic void addSchema(String schemaFileName) throws org.apache.directory.api.ldap.model.exception.LdapException
schemaFileName - The schema file name to addorg.apache.directory.api.ldap.model.exception.LdapException - If the schema addition failedaddSchema(File)public org.apache.directory.api.ldap.codec.api.LdapApiService getCodecService()
getCodecService in interface LdapConnectionpublic org.apache.directory.api.ldap.model.schema.SchemaManager getSchemaManager()
getSchemaManager in interface LdapConnectionprivate void fetchRootDSE(String... explicitAttributes) throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionpublic LdapConnectionConfig getConfig()
getConfig in interface LdapAsyncConnectionprivate void addControls(org.apache.directory.api.ldap.model.message.Message codec,
org.apache.directory.api.ldap.model.message.Message message)
private void removeFromFutureMaps(int msgId)
msgId - id of the messageprivate void clearMaps()
public boolean doesFutureExistFor(int messageId)
doesFutureExistFor in interface LdapConnectionmessageId - ID of the requestpublic boolean isRequestCompleted(int messageId)
isRequestCompleted in interface LdapConnectionmessageId - ID of the requestpublic void addConnectionClosedEventListener(ConnectionClosedEventListener ccListener)
ccListener - the connection closed listenerpublic void inputClosed(org.apache.mina.core.session.IoSession session)
throws Exception
inputClosed in interface org.apache.mina.core.service.IoHandlerinputClosed in class org.apache.mina.core.service.IoHandlerAdapterExceptionpublic void sessionCreated(org.apache.mina.core.session.IoSession session)
throws Exception
sessionCreated in interface org.apache.mina.core.service.IoHandlersessionCreated in class org.apache.mina.core.service.IoHandlerAdaptersession - the newly created sessionExceptionpublic void sessionClosed(org.apache.mina.core.session.IoSession session)
throws Exception
sessionClosed in interface org.apache.mina.core.service.IoHandlersessionClosed in class org.apache.mina.core.service.IoHandlerAdapterExceptionpublic void startTls()
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapException - If the StartTLS operation failedprivate void addSslFilter()
throws org.apache.directory.api.ldap.model.exception.LdapException
SslFilter to the IOConnector or IOSession's filter chainorg.apache.directory.api.ldap.model.exception.LdapExceptionprivate BindFuture bindSasl(SaslRequest saslRequest) throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate void writeRequest(org.apache.directory.api.ldap.model.message.Request request)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate String createKrb5ConfFile(String realmName, String kdcHost, int kdcPort) throws IOException
[libdefaults]
default_realm = EXAMPLE.COM
[realms]
EXAMPLE.COM = {
kdc = localhost:6088
}
IOExceptionpublic org.apache.directory.api.ldap.codec.api.BinaryAttributeDetector getBinaryAttributeDetector()
getBinaryAttributeDetector in interface LdapConnectionpublic void setBinaryAttributeDetector(org.apache.directory.api.ldap.codec.api.BinaryAttributeDetector binaryAttributeDetector)
setBinaryAttributeDetector in interface LdapConnectionbinaryAttributeDetector - The Binary Attribute Detector to usepublic void setSchemaManager(org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager)
setSchemaManager in interface LdapConnectionschemaManager - The SchemaManager to setpublic org.apache.mina.transport.socket.SocketSessionConfig getConnectionConfig()
public void setConnectionConfig(org.apache.mina.transport.socket.SocketSessionConfig connectionConfig)
connectionConfig - the connectionConfig to setCopyright © 2009–2017 The Apache Software Foundation. All rights reserved.