Class LdapNetworkConnection
java.lang.Object
org.apache.mina.core.service.IoHandlerAdapter
org.apache.directory.ldap.client.api.AbstractLdapConnection
org.apache.directory.ldap.client.api.LdapNetworkConnection
- All Implemented Interfaces:
Closeable, AutoCloseable, LdapAsyncConnection, LdapConnection, org.apache.mina.core.service.IoHandler
This class is the base for every operations sent or received to and
from a LDAP server.
A connection instance is necessary to send requests to the server. The connection
is valid until either the client closes it, the server closes it or the
client does an unbind.
- Author:
- Apache Directory Project
-
Field Summary
Fields inherited from class AbstractLdapConnection
codec, messageId, schemaManager -
Constructor Summary
ConstructorsConstructorDescriptionCreate 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 instanceLdapNetworkConnection(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 instanceLdapNetworkConnection(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, TrustManager... trustManagers) Create a new instance of a LdapConnection on a given server, and a give 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, org.apache.directory.api.ldap.codec.api.LdapApiService ldapApiService) Creates a new LdapNetworkConnection instanceCreates 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 -
Method Summary
Modifier and TypeMethodDescriptionvoidabandon(int messageId) Abandons a request submitted to the server for performing a particular operation.voidabandon(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).voidadd(org.apache.directory.api.ldap.model.entry.Entry entry) Add an entry to the server.org.apache.directory.api.ldap.model.message.AddResponseadd(org.apache.directory.api.ldap.model.message.AddRequest addRequest) Add an entry present in theAddRequestto the server.addAsync(org.apache.directory.api.ldap.model.entry.Entry entry) Add an entry to the server asynchronously.addAsync(org.apache.directory.api.ldap.model.message.AddRequest addRequest) Add an entry present in the AddRequest to the server.voidAdds the connection closed event listener.voidparses the given schema file present in OpenLDAP schema format and adds all the SchemaObjects present in it to the SchemaManagervoidAdd a SchemavoidAnonymous bind on a server.Anonymous asynchronous Bind on a server.voidbind()Bind on a server, using theLdapConnectionConfiginformation of this connection.org.apache.directory.api.ldap.model.message.BindResponsebind(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.BindResponsebind(SaslCramMd5Request request) Bind to the server using a CramMd5Request object.org.apache.directory.api.ldap.model.message.BindResponsebind(SaslDigestMd5Request request) Bind to the server using a DigestMd5Request object.org.apache.directory.api.ldap.model.message.BindResponsebind(SaslExternalRequest request) Bind to the server using a SaslExternalRequest object.org.apache.directory.api.ldap.model.message.BindResponsebind(SaslGssApiRequest request) Bind to the server using a GssApiRequest object.org.apache.directory.api.ldap.model.message.BindResponsebind(SaslPlainRequest request) Bind to the server using a PlainRequest object.org.apache.directory.api.ldap.model.message.BindResponsebind(SaslRequest request) Bind to the server using a SaslRequest object.Asynchronous Bind on a server, using the LdapConnectionConfig informations.Asynchronous unauthenticated authentication bindSimple asynchronous Bind on a server.bindAsync(org.apache.directory.api.ldap.model.message.BindRequest bindRequest) Do an asynchronous bind, based on a BindRequest.bindAsync(org.apache.directory.api.ldap.model.name.Dn name) Asynchronous unauthenticated authentication Bind on a server.Simple asynchronous Bind on a server.bindAsync(SaslGssApiRequest request) Do an asynchronous bind, based on a GssApiRequest.bindAsync(SaslRequest request) Do an asynchronous bind, based on a SaslPlainRequest.bindSasl(SaslRequest saslRequest) Process the SASL Bind.org.apache.directory.api.ldap.model.message.BindResponsebindSaslCramMd5(String userName, String credentials) Bind to the server using the SASL CRAM-MD5 mechanism.org.apache.directory.api.ldap.model.message.BindResponsebindSaslDigestMd5(String userName, String credentials) Bind to the server using the SASL DIGEST-MD5 mechanism.org.apache.directory.api.ldap.model.message.BindResponsebindSaslPlain(String authcid, String credentials) SASL PLAIN Bind on a server.org.apache.directory.api.ldap.model.message.BindResponsebindSaslPlain(String authzid, String authcid, String credentials) SASL PLAIN Bind on a server.voidclose()Disconnect from the remote LDAP server.booleanCompares whether a given attribute's value matches that of the existing value of the attribute present in the entry with the given distinguished name.booleanCompares whether a given attribute's value matches that of the existing value of the attribute present in the entry with the given distinguished name.booleanCompares whether a given attribute's value matches that of the existing value of the attribute present in the entry with the given distinguished name.org.apache.directory.api.ldap.model.message.CompareResponsecompare(org.apache.directory.api.ldap.model.message.CompareRequest compareRequest) Compares an entry's attribute's value with that of the given value.booleanCompares whether a given attribute's value matches that of the existing value of the attribute present in the entry with the given distinguished name.booleanCompares whether a given attribute's value matches that of the existing value of the attribute present in the entry with the given distinguished name.booleancompare(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.compareAsync(org.apache.directory.api.ldap.model.message.CompareRequest compareRequest) Asynchronously compares an entry's attribute's value with that of the given valuebooleanconnect()Connect to the remote LDAP server.org.apache.mina.core.future.ConnectFutureDo an asynchronous connection attemptvoidDeletes the entry with the given distinguished name.org.apache.directory.api.ldap.model.message.DeleteResponsedelete(org.apache.directory.api.ldap.model.message.DeleteRequest deleteRequest) Performs a delete operation based on the delete request object.voiddelete(org.apache.directory.api.ldap.model.name.Dn dn) Deletes the entry with the given distinguished name.deleteAsync(org.apache.directory.api.ldap.model.message.DeleteRequest deleteRequest) Performs an asynchronous delete operation based on the delete request object.voiddeleteTree(String dn) deletes the entry with the given Dn, and all its childrenvoiddeleteTree(org.apache.directory.api.ldap.model.name.Dn dn) deletes the entry with the given Dn, and all its childrenbooleandoesFutureExistFor(int messageId) Checks if there is a ResponseFuture associated with the given message ID.voidevent(org.apache.mina.core.session.IoSession session, org.apache.mina.filter.FilterEvent event) tell if an exception was caught while processing the request or a response.voidexceptionCaught(org.apache.mina.core.session.IoSession session, Throwable cause) Handle the exception we got.booleanTells if an entry exists in the server.booleanexists(org.apache.directory.api.ldap.model.name.Dn dn) Tells if an Entry exists in the server.org.apache.directory.api.ldap.model.message.ExtendedResponseSends a extended operation request to the server with the given OID and no value.org.apache.directory.api.ldap.model.message.ExtendedResponseSends a extended operation request to the server with the given OID and value.org.apache.directory.api.ldap.model.message.ExtendedResponseextended(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.ExtendedResponseextended(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.ExtendedResponseextended(org.apache.directory.api.ldap.model.message.ExtendedRequest extendedRequest) Performs an extended operation based on the extended request object.extendedAsync(org.apache.directory.api.ldap.model.message.ExtendedRequest extendedRequest) Asynchronously requests the server to perform an extended operation based on the given request.org.apache.directory.api.ldap.codec.api.BinaryAttributeDetectorGet the BinaryAttribute dectore instanceorg.apache.directory.api.ldap.codec.api.LdapApiServiceGets the LDAP CODEC service responsible for encoding and decoding messages.gives the configuration information of the connectionorg.apache.directory.api.ldap.model.entry.EntryGet back the RooDSE from the connected server.org.apache.directory.api.ldap.model.entry.EntrygetRootDse(String... attributes) Get back the RooDSE from the connected server.org.apache.directory.api.ldap.model.schema.SchemaManagerGet the SchemaManager instanceorg.apache.mina.transport.socket.SocketSessionConfigGet the SockectSession configurationGets theSSLSessionassociated with the connection.Get the Controls supported by server.longgetTimeout(long configuredTimeout, int searchTimeLimitInSeconds) Get the largest timeout from the search time limit and the connection timeout.voidinputClosed(org.apache.mina.core.session.IoSession session) booleanCheck if the connection is authenticated.booleanCheck if the connection is establishedbooleanisControlSupported(String controlOID) Checks if a control with the given OID is supported.booleanisRequestCompleted(int messageId) Checks if a request has been completed, or not.booleanTells if the connection is using a secured channelvoidLoads all the default schemas that are bundled with the API.
Note: This method enables all schemas prior to loading.voidloadSchema(org.apache.directory.api.ldap.model.schema.registries.SchemaLoader loader) loads schema using the specified schema loadervoidLoads 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.EntrySearches for an entry having the given distinguished name.org.apache.directory.api.ldap.model.entry.EntrySearches for an entry having the given distinguished name.org.apache.directory.api.ldap.model.entry.Entrylookup(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.Entrylookup(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.EntrySearches for an entry having the given distinguished name.org.apache.directory.api.ldap.model.entry.Entrylookup(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.voidmessageReceived(org.apache.mina.core.session.IoSession session, Object message) Handle the incoming LDAP messages.voidApplies all the modifications to the entry specified by its distinguished name.voidmodify(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.ModifyResponsemodify(org.apache.directory.api.ldap.model.message.ModifyRequest modRequest) Performs an modify operation based on the modifications present in the modify request.voidmodify(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.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.ModifyDnResponsemodifyDn(org.apache.directory.api.ldap.model.message.ModifyDnRequest modDnRequest) Performs the modifyDn operation based on the given request object.modifyDnAsync(org.apache.directory.api.ldap.model.message.ModifyDnRequest modDnRequest) Performs the modifyDn operation based on the given ModifyDnRequest.voidMoves the given entry distinguished name under the new superior distinguished name.voidmove(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.voidmoveAndRename(String entryDn, String newDn) Moves and renames the given entry distinguished name.voidmoveAndRename(String entryDn, String newDn, boolean deleteOldRdn) Moves and renames the given entryDn.voidmoveAndRename(org.apache.directory.api.ldap.model.name.Dn entryDn, org.apache.directory.api.ldap.model.name.Dn newDn) Moves and renames the given entryDn.voidmoveAndRename(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.voidRenames the given entryDn with new relative distinguished name and deletes the old relative distinguished name.voidRenames the given entryDn with new relative distinguished name and deletes the old relative distinguished name if deleteOldRdn is set to true.voidrename(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.voidrename(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.org.apache.directory.api.ldap.model.cursor.EntryCursorsearch(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.org.apache.directory.api.ldap.model.cursor.SearchCursorsearch(org.apache.directory.api.ldap.model.message.SearchRequest searchRequest) Performs search using a search request object.org.apache.directory.api.ldap.model.cursor.SearchCursorsearch(org.apache.directory.api.ldap.model.message.SearchRequest searchRequest, long localSearchTimeout) Search operation with explicit specification of operation timeout.org.apache.directory.api.ldap.model.cursor.EntryCursorsearch(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.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.searchAsync(org.apache.directory.api.ldap.model.message.SearchRequest searchRequest) Do a search, on the base object, using the given filter.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.voidsessionClosed(org.apache.mina.core.session.IoSession session) voidsessionCreated(org.apache.mina.core.session.IoSession session) This method is called when a new session is created.voidsetBinaryAttributeDetector(org.apache.directory.api.ldap.codec.api.BinaryAttributeDetector binaryAttributeDetector) Sets the object responsible for the detection of binary attributes.voidsetConnector(org.apache.mina.core.service.IoConnector connector) Set the connector to use.voidsetSchemaManager(org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager) sets a SchemaManager to be used by this connectionvoidsetSocketSessionConfig(org.apache.mina.transport.socket.SocketSessionConfig socketSessionConfig) Set the SockectSession configurationvoidsetTimeOut(long timeout) Set the timeout for the responses.voidstartTls()Sends the StartTLS extended request to server and adds a security layer upon receiving a response with successful result.org.apache.mina.core.future.ConnectFutureProcess the connect.voidunBind()UnBind from a server.Methods inherited from class AbstractLdapConnection
bind, bind, bind, bind, createBindRequestMethods inherited from class org.apache.mina.core.service.IoHandlerAdapter
messageSent, sessionIdle, sessionOpenedMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface LdapConnection
bind, bind, bind, bind
-
Constructor Details
-
LdapNetworkConnection
public LdapNetworkConnection()Create a new instance of a LdapConnection on localhost, port 389. -
LdapNetworkConnection
Creates a new instance of LdapConnection with the given connection configuration.- Parameters:
config- the configuration of the LdapConnection
-
LdapNetworkConnection
public LdapNetworkConnection(LdapConnectionConfig config, org.apache.directory.api.ldap.codec.api.LdapApiService ldapApiService) Creates a new LdapNetworkConnection instance- Parameters:
config- The configuration to useldapApiService- The LDAP API Service to use
-
LdapNetworkConnection
public LdapNetworkConnection(boolean useSsl) Create a new instance of a LdapConnection on localhost, port 389 if the SSL flag is off, or 636 otherwise.- Parameters:
useSsl- A flag to tell if it's a SSL connection or not.
-
LdapNetworkConnection
public LdapNetworkConnection(boolean useSsl, org.apache.directory.api.ldap.codec.api.LdapApiService ldapApiService) Creates a new LdapNetworkConnection instance- Parameters:
useSsl- If we are going to create a secure connection or notldapApiService- The LDAP API Service to use
-
LdapNetworkConnection
Create a new instance of a LdapConnection on a given server, using the default port (389).- Parameters:
server- The server we want to be connected to. If null or empty, we will default to LocalHost.
-
LdapNetworkConnection
public LdapNetworkConnection(String server, org.apache.directory.api.ldap.codec.api.LdapApiService ldapApiService) Creates a new LdapNetworkConnection instance- Parameters:
server- The server we want to be connected to. If null or empty, we will default to LocalHost.ldapApiService- The LDAP API Service to use
-
LdapNetworkConnection
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.- Parameters:
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.
-
LdapNetworkConnection
public LdapNetworkConnection(String server, boolean useSsl, org.apache.directory.api.ldap.codec.api.LdapApiService ldapApiService) Creates a new LdapNetworkConnection instance- Parameters:
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 use
-
LdapNetworkConnection
Create a new instance of a LdapConnection on a given server and a given port. We don't use ssl.- Parameters:
server- The server we want to be connected toport- The port the server is listening to
-
LdapNetworkConnection
public 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. We don't use ssl.- Parameters:
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 use
-
LdapNetworkConnection
Create a new instance of a LdapConnection on a given server, and a give port. We set the SSL flag accordingly to the last parameter.- Parameters:
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.
-
LdapNetworkConnection
Create a new instance of a LdapConnection on a given server, and a give port. This SSL connection will use the provided TrustManagers- Parameters:
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 use
-
LdapNetworkConnection
public 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. We don't use ssl.- Parameters:
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 use
-
-
Method Details
-
isConnected
public boolean isConnected()Check if the connection is established- Specified by:
isConnectedin interfaceLdapConnection- Returns:
trueif the connection is established
-
isAuthenticated
public boolean isAuthenticated()Check if the connection is authenticated.- Specified by:
isAuthenticatedin interfaceLdapConnection- Returns:
trueif the connection is authenticated
-
isSecured
public boolean isSecured()Tells if the connection is using a secured channel- Returns:
trueif the session is using a secured channel
-
exceptionCaught
tell if an exception was caught while processing the request or a response.- Specified by:
exceptionCaughtin interfaceLdapConnection- Returns:
- The exception if there was one thrown while processing a request or a response
-
getTimeout
public long getTimeout(long configuredTimeout, int searchTimeLimitInSeconds) Get the largest timeout from the search time limit and the connection timeout.- Parameters:
configuredTimeout- Timeout configured in LdapNetworkConnectionsearchTimeLimitInSeconds- Search timeout- Returns:
- The largest timeout
-
tryConnect
public org.apache.mina.core.future.ConnectFuture tryConnect() throws org.apache.directory.api.ldap.model.exception.LdapExceptionProcess the connect.- Returns:
- A Future that can be used to check the status of the connection
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- If we weren't able to connect
-
connect
public boolean connect() throws org.apache.directory.api.ldap.model.exception.LdapExceptionConnect to the remote LDAP server.- Specified by:
connectin interfaceLdapConnection- Returns:
trueif the connection is established, false otherwise- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
connectAsync
public org.apache.mina.core.future.ConnectFuture connectAsync() throws org.apache.directory.api.ldap.model.exception.LdapExceptionDo an asynchronous connection attempt- Specified by:
connectAsyncin interfaceLdapAsyncConnection- Returns:
- the connection's future
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
close
public void close()Disconnect from the remote LDAP server.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceLdapConnection
-
add
public void add(org.apache.directory.api.ldap.model.entry.Entry entry) throws org.apache.directory.api.ldap.model.exception.LdapException Add an entry to the server.- Specified by:
addin interfaceLdapConnection- Parameters:
entry- The entry to add- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
addAsync
public AddFuture addAsync(org.apache.directory.api.ldap.model.entry.Entry entry) throws org.apache.directory.api.ldap.model.exception.LdapException Add an entry to the server asynchronously. This is a non blocking add : the user has to get for the response from the returned Future.- Specified by:
addAsyncin interfaceLdapAsyncConnection- Parameters:
entry- The entry to add- Returns:
- the add operation's future
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
add
public 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 Add an entry present in theAddRequestto the server.- Specified by:
addin interfaceLdapConnection- Parameters:
addRequest- the request object containing an entry and controls (if any)- Returns:
- the add operation's response
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
addAsync
public AddFuture addAsync(org.apache.directory.api.ldap.model.message.AddRequest addRequest) throws org.apache.directory.api.ldap.model.exception.LdapException Add an entry present in the AddRequest to the server.- Specified by:
addAsyncin interfaceLdapAsyncConnection- Parameters:
addRequest- the request object containing an entry and controls(if any)- Returns:
- the add operation's future
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
abandon
public void abandon(int messageId) Abandons a request submitted to the server for performing a particular operation. The abandonRequest is always non-blocking, because no response is expected- Specified by:
abandonin interfaceLdapConnection- Parameters:
messageId- the ID of the request message sent to the server
-
abandon
public 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). The abandonRequest is always non-blocking, because no response is expected.- Specified by:
abandonin interfaceLdapConnection- Parameters:
abandonRequest- the abandon operation's request
-
bind
public void bind() throws org.apache.directory.api.ldap.model.exception.LdapExceptionBind on a server, using theLdapConnectionConfiginformation of this connection.- Specified by:
bindin interfaceLdapConnection- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
anonymousBind
public void anonymousBind() throws org.apache.directory.api.ldap.model.exception.LdapExceptionAnonymous bind on a server.- Specified by:
anonymousBindin interfaceLdapConnection- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
bindAsync
Asynchronous Bind on a server, using the LdapConnectionConfig informations.- Specified by:
bindAsyncin interfaceLdapAsyncConnection- Returns:
- the bind operation's future
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
anonymousBindAsync
public BindFuture anonymousBindAsync() throws org.apache.directory.api.ldap.model.exception.LdapExceptionAnonymous asynchronous Bind on a server.- Specified by:
anonymousBindAsyncin interfaceLdapAsyncConnection- Returns:
- the bind operation's future
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
bindAsync
public BindFuture bindAsync(String name) throws org.apache.directory.api.ldap.model.exception.LdapException Asynchronous unauthenticated authentication bind- Parameters:
name- The name we use to authenticate the user. It must be a valid Dn- Returns:
- The BindResponse LdapResponse
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
bindAsync
public BindFuture bindAsync(String name, String credentials) throws org.apache.directory.api.ldap.model.exception.LdapException Simple asynchronous Bind on a server.- Specified by:
bindAsyncin interfaceLdapAsyncConnection- Parameters:
name- The name we use to authenticate the user, it must be a valid Dncredentials- The password, it can't be null- Returns:
- the bind operation's future
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
bindAsync
public BindFuture bindAsync(org.apache.directory.api.ldap.model.name.Dn name) throws org.apache.directory.api.ldap.model.exception.LdapException Asynchronous unauthenticated authentication Bind on a server.- Parameters:
name- The name we use to authenticate the user. It must be a valid Dn- Returns:
- The BindResponse LdapResponse
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
bindAsync
public BindFuture bindAsync(org.apache.directory.api.ldap.model.name.Dn name, String credentials) throws org.apache.directory.api.ldap.model.exception.LdapException Simple asynchronous Bind on a server.- Specified by:
bindAsyncin interfaceLdapAsyncConnection- Parameters:
name- The name we use to authenticate the user, it must be a valid Dncredentials- The password, it can't be null- Returns:
- the bind operation's future
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
bind
public 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 to the server using a bind request object.- Specified by:
bindin interfaceLdapConnection- Parameters:
bindRequest- The bind request object containing all the needed parameters- Returns:
- A
BindResponsecontaining the result - Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
bindAsync
public BindFuture bindAsync(org.apache.directory.api.ldap.model.message.BindRequest bindRequest) throws org.apache.directory.api.ldap.model.exception.LdapException Do an asynchronous bind, based on a BindRequest.- Specified by:
bindAsyncin interfaceLdapAsyncConnection- Parameters:
bindRequest- The BindRequest to send- Returns:
- the bind operation's future
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
bindSaslPlain
public org.apache.directory.api.ldap.model.message.BindResponse bindSaslPlain(String authcid, String credentials) throws org.apache.directory.api.ldap.model.exception.LdapException SASL PLAIN Bind on a server.- Parameters:
authcid- The Authentication identitycredentials- The password. It can't be null- Returns:
- The BindResponse LdapResponse
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
bindSaslPlain
public org.apache.directory.api.ldap.model.message.BindResponse bindSaslPlain(String authzid, String authcid, String credentials) throws org.apache.directory.api.ldap.model.exception.LdapException SASL PLAIN Bind on a server.- Parameters:
authzid- The Authorization identityauthcid- The Authentication identitycredentials- The password. It can't be null- Returns:
- The BindResponse LdapResponse
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
bind
public org.apache.directory.api.ldap.model.message.BindResponse bind(SaslRequest request) throws org.apache.directory.api.ldap.model.exception.LdapException Bind to the server using a SaslRequest object.- Specified by:
bindin interfaceLdapConnection- Parameters:
request- The SaslRequest POJO containing all the needed parameters- Returns:
- A LdapResponse containing the result
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
bindSaslCramMd5
public org.apache.directory.api.ldap.model.message.BindResponse bindSaslCramMd5(String userName, String credentials) throws org.apache.directory.api.ldap.model.exception.LdapException Bind to the server using the SASL CRAM-MD5 mechanism.- Parameters:
userName- The user namecredentials- The user credentials- Returns:
- A LdapResponse containing the result
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
bindSaslDigestMd5
public org.apache.directory.api.ldap.model.message.BindResponse bindSaslDigestMd5(String userName, String credentials) throws org.apache.directory.api.ldap.model.exception.LdapException Bind to the server using the SASL DIGEST-MD5 mechanism.- Parameters:
userName- The user namecredentials- The user credentials- Returns:
- A LdapResponse containing the result
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
bind
public org.apache.directory.api.ldap.model.message.BindResponse bind(SaslCramMd5Request request) throws org.apache.directory.api.ldap.model.exception.LdapException Bind to the server using a CramMd5Request object.- Parameters:
request- The CramMd5Request POJO containing all the needed parameters- Returns:
- A LdapResponse containing the result
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
bind
public org.apache.directory.api.ldap.model.message.BindResponse bind(SaslPlainRequest request) throws org.apache.directory.api.ldap.model.exception.LdapException Bind to the server using a PlainRequest object.- Parameters:
request- The PlainRequest POJO containing all the needed parameters- Returns:
- A LdapResponse containing the result
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
bindAsync
public BindFuture bindAsync(SaslRequest request) throws org.apache.directory.api.ldap.model.exception.LdapException Do an asynchronous bind, based on a SaslPlainRequest.- Parameters:
request- The SaslPlainRequest POJO containing all the needed parameters- Returns:
- The bind operation's future
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
bind
public org.apache.directory.api.ldap.model.message.BindResponse bind(SaslDigestMd5Request request) throws org.apache.directory.api.ldap.model.exception.LdapException Bind to the server using a DigestMd5Request object.- Parameters:
request- The DigestMd5Request POJO containing all the needed parameters- Returns:
- A LdapResponse containing the result
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
bind
public org.apache.directory.api.ldap.model.message.BindResponse bind(SaslGssApiRequest request) throws org.apache.directory.api.ldap.model.exception.LdapException Bind to the server using a GssApiRequest object.- Parameters:
request- The GssApiRequest POJO containing all the needed parameters- Returns:
- A LdapResponse containing the result
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
bind
public org.apache.directory.api.ldap.model.message.BindResponse bind(SaslExternalRequest request) throws org.apache.directory.api.ldap.model.exception.LdapException Bind to the server using a SaslExternalRequest object.- Parameters:
request- The SaslExternalRequest POJO containing all the needed parameters- Returns:
- A LdapResponse containing the result
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
bindAsync
public BindFuture bindAsync(SaslGssApiRequest request) throws org.apache.directory.api.ldap.model.exception.LdapException Do an asynchronous bind, based on a GssApiRequest.- Parameters:
request- The GssApiRequest POJO containing all the needed parameters- Returns:
- The bind operation's future
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
search
public 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 Do a search, on the base object, using the given filter and scope. The SearchRequest parameters default to- DerefAlias : ALWAYS
- SizeLimit : none
- TimeLimit : none
- TypesOnly : false
- Specified by:
searchin interfaceLdapConnection- Parameters:
baseDn- 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 search- Returns:
- An
EntryCursoron the result. - Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
search
public 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 Do a search, on the base object, using the given filter and scope. The SearchRequest parameters default to- DerefAlias : ALWAYS
- SizeLimit : none
- TimeLimit : none
- TypesOnly : false
- Specified by:
searchin interfaceLdapConnection- Parameters:
baseDn- 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 search- Returns:
- An
EntryCursoron the result. - Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
searchAsync
public 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 Do an asynchronous search, on the base object, using the given filter. The SearchRequest parameters default to :Scope : ONE DerefAlias : ALWAYS SizeLimit : none TimeLimit : none TypesOnly : false Attributes : all the user's attributes. This method is blocking.
- Specified by:
searchAsyncin interfaceLdapAsyncConnection- Parameters:
baseDn- 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 search- Returns:
- the search operation's future
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
searchAsync
public 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 Do an asynchronous search, on the base object, using the given filter. The SearchRequest parameters default to :Scope : ONE DerefAlias : ALWAYS SizeLimit : none TimeLimit : none TypesOnly : false Attributes : all the user's attributes. This method is blocking.
- Specified by:
searchAsyncin interfaceLdapAsyncConnection- Parameters:
baseDn- 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 search- Returns:
- the search operation's future
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
searchAsync
public SearchFuture searchAsync(org.apache.directory.api.ldap.model.message.SearchRequest searchRequest) throws org.apache.directory.api.ldap.model.exception.LdapException Do a search, on the base object, using the given filter. The SearchRequest parameters default to :Scope : ONE DerefAlias : ALWAYS SizeLimit : none TimeLimit : none TypesOnly : false Attributes : all the user's attributes. This method is blocking.
- Specified by:
searchAsyncin interfaceLdapAsyncConnection- Parameters:
searchRequest- The search request to send to the server- Returns:
- the search operation's future
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
search
public 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 Performs search using a search request object.- Specified by:
searchin interfaceLdapConnection- Parameters:
searchRequest- The search request object containing all the needed information- Returns:
- a search cursor on the result.
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
search
public org.apache.directory.api.ldap.model.cursor.SearchCursor search(org.apache.directory.api.ldap.model.message.SearchRequest searchRequest, long localSearchTimeout) throws org.apache.directory.api.ldap.model.exception.LdapException Search operation with explicit specification of operation timeout. This is very useful for special-purpose search operations, such as connection liveliness test. In that case we want to make a very quick search with a very short timeout. We do not want to use the default search timeout in this case, as that is likely to be in order of seconds. That is too long for quick connection check. searchRequest.timeLimit is not going to work either, as it has very rough granularity (seconds).- Parameters:
searchRequest- The SearchRequst to processlocalSearchTimeout- The local timeout in seconds- Returns:
- A SearchCursor instance
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- If the search has failed
-
unBind
public void unBind() throws org.apache.directory.api.ldap.model.exception.LdapExceptionUnBind from a server. This is a request which expects no response.- Specified by:
unBindin interfaceLdapConnection- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
setConnector
public void setConnector(org.apache.mina.core.service.IoConnector connector) Set the connector to use.- Parameters:
connector- The connector to use
-
setTimeOut
public void setTimeOut(long timeout) Set the timeout for the responses. We won't wait longer than this value.- Specified by:
setTimeOutin interfaceLdapConnection- Parameters:
timeout- The timeout, in milliseconds
-
exceptionCaught
public void exceptionCaught(org.apache.mina.core.session.IoSession session, Throwable cause) throws Exception Handle the exception we got.- Specified by:
exceptionCaughtin interfaceorg.apache.mina.core.service.IoHandler- Overrides:
exceptionCaughtin classorg.apache.mina.core.service.IoHandlerAdapter- Parameters:
session- The session we got the exception oncause- The exception cause- Throws:
Exception- If we have had another exception
-
messageReceived
public void messageReceived(org.apache.mina.core.session.IoSession session, Object message) throws Exception Handle the incoming LDAP messages. This is where we feed the cursor for search requests, or call the listener.- Specified by:
messageReceivedin interfaceorg.apache.mina.core.service.IoHandler- Overrides:
messageReceivedin classorg.apache.mina.core.service.IoHandlerAdapter- Parameters:
session- The session that received a messagemessage- The received message- Throws:
Exception- If there is some error while processing the message
-
modify
public 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 Modifies all the attributes present in the entry by applying the same operation.- Specified by:
modifyin interfaceLdapConnection- Parameters:
entry- the entry with the attributes to be modifiedmodOp- the operation to be applied on all the attributes of the above entry- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- in case of modify operation failure or timeout happens
-
modify
public 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 Applies all the modifications to the entry specified by its distinguished name.- Specified by:
modifyin interfaceLdapConnection- Parameters:
dn- The entry's distinguished namemodifications- The list of modifications to be applied- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- in case of modify operation failure or timeout happens
-
modify
public void modify(String dn, org.apache.directory.api.ldap.model.entry.Modification... modifications) throws org.apache.directory.api.ldap.model.exception.LdapException Applies all the modifications to the entry specified by its distinguished name.- Specified by:
modifyin interfaceLdapConnection- Parameters:
dn- The entry's distinguished name, it must be a valid distinguished name.modifications- The list of modifications to be applied- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- in case of modify operation failure or timeout happens
-
modify
public 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 Performs an modify operation based on the modifications present in the modify request.- Specified by:
modifyin interfaceLdapConnection- Parameters:
modRequest- the modify request object- Returns:
- the modify operation's response
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- in case of modify operation failure or timeout happens
-
modifyAsync
public ModifyFuture modifyAsync(org.apache.directory.api.ldap.model.message.ModifyRequest modRequest) throws org.apache.directory.api.ldap.model.exception.LdapException Performs an asynchronous modify operation based on the modifications present in the ModifyRequest.- Specified by:
modifyAsyncin interfaceLdapAsyncConnection- Parameters:
modRequest- the request for modify operation- Returns:
- the modify operation's future
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- in case of modify operation failure or timeout happens
-
rename
public void rename(String entryDn, String newRdn) throws org.apache.directory.api.ldap.model.exception.LdapException Renames the given entryDn with new relative distinguished name and deletes the old relative distinguished name.- Specified by:
renamein interfaceLdapConnection- Parameters:
entryDn- the target distinguished name.newRdn- new relative distinguished name for the target distinguished name.- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred- See Also:
-
rename
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 Renames the given entryDn with new relative distinguished name and deletes the old relative distinguished name.- Specified by:
renamein interfaceLdapConnection- Parameters:
entryDn- the target distinguished name.newRdn- new relative distinguished name for the target distinguished name.- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred- See Also:
-
rename
public void rename(String entryDn, String newRdn, boolean deleteOldRdn) throws org.apache.directory.api.ldap.model.exception.LdapException Renames the given entryDn with new relative distinguished name and deletes the old relative distinguished name if deleteOldRdn is set to true.- Specified by:
renamein interfaceLdapConnection- Parameters:
entryDn- 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 name- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred- See Also:
-
rename
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 Renames the given entryDn with new relative distinguished name and deletes the old relative distinguished name if deleteOldRdn is set to true.- Specified by:
renamein interfaceLdapConnection- Parameters:
entryDn- 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 name- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
move
public void move(String entryDn, String newSuperiorDn) throws org.apache.directory.api.ldap.model.exception.LdapException Moves the given entry distinguished name under the new superior distinguished name.- Specified by:
movein interfaceLdapConnection- Parameters:
entryDn- the distinguished name of the target entrynewSuperiorDn- distinguished name of the new parent/superior- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred- See Also:
-
move
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 Moves the given entry distinguished name under the new superior distinguished name.- Specified by:
movein interfaceLdapConnection- Parameters:
entryDn- the distinguished name of the target entrynewSuperiorDn- distinguished name of the new parent/superior- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
moveAndRename
public 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 Moves and renames the given entryDn. The old relative distinguished name will be deleted.- Specified by:
moveAndRenamein interfaceLdapConnection- Parameters:
entryDn- The original entry distinguished name.newDn- The new entry distinguished name.- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred- See Also:
-
moveAndRename
public void moveAndRename(String entryDn, String newDn) throws org.apache.directory.api.ldap.model.exception.LdapException Moves and renames the given entry distinguished name. The old relative distinguished name will be deleted- Specified by:
moveAndRenamein interfaceLdapConnection- Parameters:
entryDn- The original entry distinguished name.newDn- The new entry distinguished name.- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred- See Also:
-
moveAndRename
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 Moves and renames the given entryDn. The old relative distinguished name will be deleted if requested.- Specified by:
moveAndRenamein interfaceLdapConnection- Parameters:
entryDn- The original entry distinguished name.newDn- The new entry distinguished name.deleteOldRdn- Tells if the old relative distinguished name must be removed- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
moveAndRename
public void moveAndRename(String entryDn, String newDn, boolean deleteOldRdn) throws org.apache.directory.api.ldap.model.exception.LdapException Moves and renames the given entryDn. The old relative distinguished name will be deleted if requested.- Specified by:
moveAndRenamein interfaceLdapConnection- Parameters:
entryDn- The original entry distinguished name.newDn- The new entry distinguished name.deleteOldRdn- Tells if the old relative distinguished name must be removed- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
modifyDn
public 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 Performs the modifyDn operation based on the given request object.- Specified by:
modifyDnin interfaceLdapConnection- Parameters:
modDnRequest- the request object- Returns:
- modifyDn operation's response
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
modifyDnAsync
public ModifyDnFuture modifyDnAsync(org.apache.directory.api.ldap.model.message.ModifyDnRequest modDnRequest) throws org.apache.directory.api.ldap.model.exception.LdapException Performs the modifyDn operation based on the given ModifyDnRequest.- Specified by:
modifyDnAsyncin interfaceLdapAsyncConnection- Parameters:
modDnRequest- the request- Returns:
- modifyDn operation's future
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
delete
Deletes the entry with the given distinguished name.- Specified by:
deletein interfaceLdapConnection- Parameters:
dn- the target entry's distinguished name, it must be a valid distinguished name.- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- If the distinguished name is not valid or if the deletion failed
-
delete
public void delete(org.apache.directory.api.ldap.model.name.Dn dn) throws org.apache.directory.api.ldap.model.exception.LdapException Deletes the entry with the given distinguished name.- Specified by:
deletein interfaceLdapConnection- Parameters:
dn- the target entry's distinguished name- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- If the distinguished name is not valid or if the deletion failed
-
deleteTree
public void deleteTree(org.apache.directory.api.ldap.model.name.Dn dn) throws org.apache.directory.api.ldap.model.exception.LdapException deletes the entry with the given Dn, and all its children- Parameters:
dn- the target entry's Dn- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- If the Dn is not valid or if the deletion failed
-
deleteTree
public void deleteTree(String dn) throws org.apache.directory.api.ldap.model.exception.LdapException deletes the entry with the given Dn, and all its children- Parameters:
dn- the target entry's Dn as a String- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- If the Dn is not valid or if the deletion failed
-
delete
public 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 Performs a delete operation based on the delete request object.- Specified by:
deletein interfaceLdapConnection- Parameters:
deleteRequest- the delete operation's request- Returns:
- delete operation's response
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- If the distinguished name is not valid or if the deletion failed
-
deleteAsync
public DeleteFuture deleteAsync(org.apache.directory.api.ldap.model.message.DeleteRequest deleteRequest) throws org.apache.directory.api.ldap.model.exception.LdapException Performs an asynchronous delete operation based on the delete request object.- Specified by:
deleteAsyncin interfaceLdapAsyncConnection- Parameters:
deleteRequest- the delete operation's request- Returns:
- delete operation's future
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- If the Dn is not valid or if the deletion failed
-
compare
public boolean compare(String dn, String attributeName, String value) throws org.apache.directory.api.ldap.model.exception.LdapException 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.- Specified by:
comparein interfaceLdapConnection- Parameters:
dn- 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 with- Returns:
trueif the value matches,falseotherwise- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
compare
public boolean compare(String dn, String attributeName, byte[] value) throws org.apache.directory.api.ldap.model.exception.LdapException 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.- Specified by:
comparein interfaceLdapConnection- Parameters:
dn- 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 with- Returns:
trueif the value matches,falseotherwise- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
compare
public boolean compare(String dn, String attributeName, org.apache.directory.api.ldap.model.entry.Value value) throws org.apache.directory.api.ldap.model.exception.LdapException 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.- Specified by:
comparein interfaceLdapConnection- Parameters:
dn- 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 with- Returns:
trueif the value matches,falseotherwise- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
compare
public boolean compare(org.apache.directory.api.ldap.model.name.Dn dn, String attributeName, String value) throws org.apache.directory.api.ldap.model.exception.LdapException 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.- Specified by:
comparein interfaceLdapConnection- Parameters:
dn- the target entry's distinguished nameattributeName- the attribute's namevalue- a String value with which the target entry's attribute value to be compared with- Returns:
trueif the value matches,falseotherwise- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
compare
public boolean compare(org.apache.directory.api.ldap.model.name.Dn dn, String attributeName, byte[] value) throws org.apache.directory.api.ldap.model.exception.LdapException 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.- Specified by:
comparein interfaceLdapConnection- Parameters:
dn- the target entry's distinguished nameattributeName- the attribute's namevalue- a byte[] value with which the target entry's attribute value to be compared with- Returns:
trueif the value matches,falseotherwise- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
compare
public 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 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.- Specified by:
comparein interfaceLdapConnection- Parameters:
dn- the target entry's distinguished nameattributeName- the attribute's namevalue- a Value<?> value with which the target entry's attribute value to be compared with- Returns:
trueif the value matches,falseotherwise- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
compare
public 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 Compares an entry's attribute's value with that of the given value.- Specified by:
comparein interfaceLdapConnection- Parameters:
compareRequest- the compare request which contains the target distinguished name, attribute name and value- Returns:
- compare operation's response
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
compareAsync
public CompareFuture compareAsync(org.apache.directory.api.ldap.model.message.CompareRequest compareRequest) throws org.apache.directory.api.ldap.model.exception.LdapException Asynchronously compares an entry's attribute's value with that of the given value- Specified by:
compareAsyncin interfaceLdapAsyncConnection- Parameters:
compareRequest- the CompareRequest which contains the target Dn, attribute name and value- Returns:
- compare operation's future
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
extended
public org.apache.directory.api.ldap.model.message.ExtendedResponse extended(String oid) throws org.apache.directory.api.ldap.model.exception.LdapException Sends a extended operation request to the server with the given OID and no value.- Specified by:
extendedin interfaceLdapConnection- Parameters:
oid- the object identifier of the extended operation- Returns:
- extended operation's response
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred- See Also:
-
extended
public org.apache.directory.api.ldap.model.message.ExtendedResponse extended(String oid, byte[] value) throws org.apache.directory.api.ldap.model.exception.LdapException Sends a extended operation request to the server with the given OID and value.- Specified by:
extendedin interfaceLdapConnection- Parameters:
oid- the object identifier of the extended operationvalue- value to be used by the extended operation, can be a null value- Returns:
- extended operation's response
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred- See Also:
-
extended
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 Sends a extended operation request to the server with the given OID and no value.- Specified by:
extendedin interfaceLdapConnection- Parameters:
oid- the object identifier of the extended operation- Returns:
- extended operation's response
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred- See Also:
-
extended
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 Sends a extended operation request to the server with the given OID and value.- Specified by:
extendedin interfaceLdapConnection- Parameters:
oid- the object identifier of the extended operationvalue- value to be used by the extended operation, can be a null value- Returns:
- extended operation's response
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
extended
public 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 Performs an extended operation based on the extended request object.- Specified by:
extendedin interfaceLdapConnection- Parameters:
extendedRequest- the extended operation's request- Returns:
- Extended operation's response
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if the extended operation failed
-
extendedAsync
public ExtendedFuture extendedAsync(org.apache.directory.api.ldap.model.message.ExtendedRequest extendedRequest) throws org.apache.directory.api.ldap.model.exception.LdapException Asynchronously requests the server to perform an extended operation based on the given request.- Specified by:
extendedAsyncin interfaceLdapAsyncConnection- Parameters:
extendedRequest- the object containing the details of the extended operation to be performed- Returns:
- extended operation's Future
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
exists
Tells if an entry exists in the server.- Specified by:
existsin interfaceLdapConnection- Parameters:
dn- The distinguished name of the entry to check for existence, must be a valid distinguished name.- Returns:
trueif the entry exists,falseotherwise. Note that if the entry exists but if the user does not have the permission to read it,falsewill also be returned- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
exists
public boolean exists(org.apache.directory.api.ldap.model.name.Dn dn) throws org.apache.directory.api.ldap.model.exception.LdapException Tells if an Entry exists in the server.- Specified by:
existsin interfaceLdapConnection- Parameters:
dn- The distinguished name of the entry to check for existence- Returns:
trueif the entry exists,falseotherwise. Note that if the entry exists but if the user does not have the permission to read it,falsewill also be returned- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
getRootDse
public org.apache.directory.api.ldap.model.entry.Entry getRootDse() throws org.apache.directory.api.ldap.model.exception.LdapExceptionGet back the RooDSE from the connected server. All user and operational attributes are returned.- Specified by:
getRootDsein interfaceLdapConnection- Returns:
- The Entry containing all the information about the rootDSE
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- If the rootDSE can't be read
-
getRootDse
public org.apache.directory.api.ldap.model.entry.Entry getRootDse(String... attributes) throws org.apache.directory.api.ldap.model.exception.LdapException Get back the RooDSE from the connected server. The user can provide the list of attributes he wants to get back. Sending "*" will return all the user attributes, sending "+" will return all the operational attributes.- Specified by:
getRootDsein interfaceLdapConnection- Parameters:
attributes- The list of attributes to return- Returns:
- The Entry containing all the information about the rootDSE
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- If the rootDSE can't be read
-
lookup
public 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 Searches for an entry having the given distinguished name..- Specified by:
lookupin interfaceLdapConnection- Parameters:
dn- the distinguished name of the entry to be fetched- Returns:
- the Entry with the given distinguished name or null if no entry exists with that distinguished name.
- Throws:
org.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 referral- See Also:
-
lookup
public org.apache.directory.api.ldap.model.entry.Entry lookup(String dn) throws org.apache.directory.api.ldap.model.exception.LdapException Searches for an entry having the given distinguished name.- Specified by:
lookupin interfaceLdapConnection- Parameters:
dn- the distinguished name of the entry to be fetched- Returns:
- the Entry with the given distinguished name or null if no entry exists with that distinguished name.
- Throws:
org.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 referral- See Also:
-
lookup
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 Searches for an entry having the given distinguished name.- Specified by:
lookupin interfaceLdapConnection- Parameters:
dn- the distinguished name of the entry to be fetchedattributes- the attributes to be returned along with entry- Returns:
- the Entry with the given distinguished name or null if no entry exists with that distinguished name.
- Throws:
org.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 referral
-
lookup
public 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 Searches for an entry having the given distinguished name.- Specified by:
lookupin interfaceLdapConnection- Parameters:
dn- the distinguished name of the entry to be fetchedcontrols- the controls to useattributes- the attributes to be returned along with entry- Returns:
- the Entry with the given distinguished name or null if no entry exists with that distinguished name.
- Throws:
org.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 referral
-
lookup
public org.apache.directory.api.ldap.model.entry.Entry lookup(String dn, String... attributes) throws org.apache.directory.api.ldap.model.exception.LdapException Searches for an entry having the given distinguished name.- Specified by:
lookupin interfaceLdapConnection- Parameters:
dn- the distinguished name of the entry to be fetchedattributes- the attributes to be returned along with entry- Returns:
- the Entry with the given distinguished name or null if no entry exists with that distinguished name.
- Throws:
org.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 referral- See Also:
-
lookup
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 Searches for an entry having the given distinguished name.- Specified by:
lookupin interfaceLdapConnection- Parameters:
dn- the distinguished name of the entry to be fetchedcontrols- the controls to useattributes- the attributes to be returned along with entry- Returns:
- the Entry with the given distinguished name or null if no entry exists with that distinguished name.
- Throws:
org.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 referral- See Also:
-
isControlSupported
public boolean isControlSupported(String controlOID) throws org.apache.directory.api.ldap.model.exception.LdapException Checks if a control with the given OID is supported.- Specified by:
isControlSupportedin interfaceLdapConnection- Parameters:
controlOID- the OID of the control- Returns:
- true if the control is supported, false otherwise
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
getSupportedControls
public List<String> getSupportedControls() throws org.apache.directory.api.ldap.model.exception.LdapExceptionGet the Controls supported by server.- Specified by:
getSupportedControlsin interfaceLdapConnection- Returns:
- a list of control OIDs supported by server
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
loadSchema
public void loadSchema() throws org.apache.directory.api.ldap.model.exception.LdapExceptionLoads all the default schemas that are bundled with the API.
Note: This method enables all schemas prior to loading.- Specified by:
loadSchemain interfaceLdapConnection- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- in case of problems while loading the schema
-
loadSchemaRelaxed
public void loadSchemaRelaxed() throws org.apache.directory.api.ldap.model.exception.LdapExceptionLoads 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.- Specified by:
loadSchemaRelaxedin interfaceLdapConnection- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- in case of problems while loading the schema
-
loadSchema
public void loadSchema(org.apache.directory.api.ldap.model.schema.registries.SchemaLoader loader) throws org.apache.directory.api.ldap.model.exception.LdapException loads schema using the specified schema loader- Parameters:
loader- theSchemaLoaderto be used to load schema- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- If the schema loading failed
-
addSchema
public void addSchema(File schemaFile) throws org.apache.directory.api.ldap.model.exception.LdapException parses the given schema file present in OpenLDAP schema format and adds all the SchemaObjects present in it to the SchemaManager- Parameters:
schemaFile- the schema file in OpenLDAP schema format- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- in case of any errors while parsing
-
addSchema
public void addSchema(String schemaFileName) throws org.apache.directory.api.ldap.model.exception.LdapException Add a Schema- Parameters:
schemaFileName- The schema file name to add- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- If the schema addition failed- See Also:
-
getCodecService
public org.apache.directory.api.ldap.codec.api.LdapApiService getCodecService()Gets the LDAP CODEC service responsible for encoding and decoding messages.- Specified by:
getCodecServicein interfaceLdapConnection- Returns:
- The LDAP CODEC service.
-
getSchemaManager
public org.apache.directory.api.ldap.model.schema.SchemaManager getSchemaManager()Get the SchemaManager instance- Specified by:
getSchemaManagerin interfaceLdapConnection- Returns:
- The SchemaManager associated with this LdapConection if any
-
getConfig
gives the configuration information of the connection- Specified by:
getConfigin interfaceLdapAsyncConnection- Returns:
- the configuration of the connection
-
isRequestCompleted
public boolean isRequestCompleted(int messageId) Checks if a request has been completed, or not.- Specified by:
isRequestCompletedin interfaceLdapConnection- Parameters:
messageId- ID of the request- Returns:
- true if the request has been completed, false is still being processed
-
doesFutureExistFor
public boolean doesFutureExistFor(int messageId) Checks if there is a ResponseFuture associated with the given message ID.- Specified by:
doesFutureExistForin interfaceLdapConnection- Parameters:
messageId- ID of the request- Returns:
- true if there is a non-null future exists, false otherwise
-
addConnectionClosedEventListener
Adds the connection closed event listener.- Parameters:
ccListener- the connection closed listener
-
inputClosed
-
sessionCreated
This method is called when a new session is created. We will store some informations that the session will need to process incoming requests.- Specified by:
sessionCreatedin interfaceorg.apache.mina.core.service.IoHandler- Overrides:
sessionCreatedin classorg.apache.mina.core.service.IoHandlerAdapter- Parameters:
session- the newly created session- Throws:
Exception
-
sessionClosed
-
startTls
public void startTls() throws org.apache.directory.api.ldap.model.exception.LdapExceptionSends the StartTLS extended request to server and adds a security layer upon receiving a response with successful result. Note that we will use the default LDAP connection.- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- If the StartTLS operation failed
-
bindSasl
public BindFuture bindSasl(SaslRequest saslRequest) throws org.apache.directory.api.ldap.model.exception.LdapException Process the SASL Bind. It's a dialog with the server, we will send a first BindRequest, receive a response and the, if this response is a challenge, continue by sending a new BindRequest with the requested informations.- Parameters:
saslRequest- The SASL request object containing all the needed parameters- Returns:
- A
BindResponsecontaining the result - Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
getBinaryAttributeDetector
public org.apache.directory.api.ldap.codec.api.BinaryAttributeDetector getBinaryAttributeDetector()Get the BinaryAttribute dectore instance- Specified by:
getBinaryAttributeDetectorin interfaceLdapConnection- Returns:
- the object responsible for the detection of binary attributes
-
setBinaryAttributeDetector
public void setBinaryAttributeDetector(org.apache.directory.api.ldap.codec.api.BinaryAttributeDetector binaryAttributeDetector) Sets the object responsible for the detection of binary attributes.- Specified by:
setBinaryAttributeDetectorin interfaceLdapConnection- Parameters:
binaryAttributeDetector- The Binary Attribute Detector to use
-
setSchemaManager
public void setSchemaManager(org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager) sets a SchemaManager to be used by this connection- Specified by:
setSchemaManagerin interfaceLdapConnection- Parameters:
schemaManager- The SchemaManager to set
-
getSocketSessionConfig
public org.apache.mina.transport.socket.SocketSessionConfig getSocketSessionConfig()Get the SockectSession configuration- Returns:
- the socketSessionConfig
-
setSocketSessionConfig
public void setSocketSessionConfig(org.apache.mina.transport.socket.SocketSessionConfig socketSessionConfig) Set the SockectSession configuration- Parameters:
socketSessionConfig- the socketSessionConfig to set
-
event
-
getSslSession
Gets theSSLSessionassociated with the connection.- Returns:
- the
SSLSessionassociated with the connection or null if the connection is not secured
-