org.apache.directory.ldap.client.api
Class LdapConnection

java.lang.Object
  extended by org.apache.mina.core.service.IoHandlerAdapter
      extended by org.apache.directory.ldap.client.api.LdapConnection
All Implemented Interfaces:
org.apache.mina.core.service.IoHandler

public class LdapConnection
extends org.apache.mina.core.service.IoHandlerAdapter

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.

Version:
$Rev$, $Date$
Author:
Apache Directory Project

Constructor Summary
LdapConnection()
          Create a new instance of a LdapConnection on localhost, port 389.
LdapConnection(boolean useSsl)
          Create a new instance of a LdapConnection on localhost, port 389 if the SSL flag is off, or 636 otherwise.
LdapConnection(LdapConnectionConfig config)
          Creates a new instance of LdapConnection with the given connection configuration.
LdapConnection(java.lang.String server)
          Create a new instance of a LdapConnection on a given server, using the default port (389).
LdapConnection(java.lang.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.
LdapConnection(java.lang.String server, int port)
          Create a new instance of a LdapConnection on a given server and a given port.
LdapConnection(java.lang.String server, int port, boolean useSsl)
          Create a new instance of a LdapConnection on a given server, and a give port.
 
Method Summary
 void abandon(AbandonRequest abandonRequest)
          An abandon request essentially with the request message ID of the operation to be cancelled 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 The abandonRequest is always non-blocking, because no response is expected
 AddResponse add(AddRequest addRequest)
          Add an entry present in the AddRequest to the server.
 AddResponse add(org.apache.directory.shared.ldap.entry.Entry entry)
          Add an entry to the server.
 AddFuture addAsync(AddRequest addRequest)
          Add an entry present in the AddRequest to the server.
 AddFuture addAsync(org.apache.directory.shared.ldap.entry.Entry entry)
          Add an entry to the server asynchronously.
 BindResponse bind()
          Anonymous Bind on a server.
 BindResponse bind(BindRequest bindRequest)
          Bind to the server using a BindRequest object.
 BindResponse bind(org.apache.directory.shared.ldap.name.DN name, java.lang.String credentials)
          Simple Bind on a server.
 BindResponse bind(java.lang.String name, java.lang.String credentials)
          Simple Bind on a server.
 BindFuture bindAsync()
          Anonymous asynchronous Bind on a server.
 BindFuture bindAsync(BindRequest bindRequest)
          Do an asynchronous bind, based on a BindRequest.
 BindFuture bindAsync(org.apache.directory.shared.ldap.name.DN name, java.lang.String credentials)
          Simple asynchronous Bind on a server.
 BindFuture bindAsync(java.lang.String name, java.lang.String credentials)
          Simple asynchronous Bind on a server.
 boolean close()
          Disconnect from the remote LDAP server
 CompareResponse compare(CompareRequest compareRequest)
          compares an entry's attribute's value with that of the given value
 CompareResponse compare(org.apache.directory.shared.ldap.name.DN dn, java.lang.String attributeName, byte[] value)
          Compares a whether a given attribute's value matches that of the existing value of the attribute present in the entry with the given DN
 CompareResponse compare(org.apache.directory.shared.ldap.name.DN dn, java.lang.String attributeName, java.lang.String value)
          Compares a whether a given attribute's value matches that of the existing value of the attribute present in the entry with the given DN
 CompareResponse compare(org.apache.directory.shared.ldap.name.DN dn, java.lang.String attributeName, org.apache.directory.shared.ldap.entry.Value<?> value)
          Compares a whether a given attribute's value matches that of the existing value of the attribute present in the entry with the given DN
 CompareResponse compare(java.lang.String dn, java.lang.String attributeName, byte[] value)
          Compares a whether a given attribute's value matches that of the existing value of the attribute present in the entry with the given DN
 CompareResponse compare(java.lang.String dn, java.lang.String attributeName, java.lang.String value)
          Compares a whether a given attribute's value matches that of the existing value of the attribute present in the entry with the given DN
 CompareResponse compare(java.lang.String dn, java.lang.String attributeName, org.apache.directory.shared.ldap.entry.Value<?> value)
          Compares a whether a given attribute's value matches that of the existing value of the attribute present in the entry with the given DN
 CompareFuture compareAsync(CompareRequest compareRequest)
          Asynchronously compares an entry's attribute's value with that of the given value
 boolean connect()
          Connect to the remote LDAP server.
 DeleteResponse delete(DeleteRequest deleteRequest)
          Performs a delete operation based on the delete request object.
 DeleteResponse delete(org.apache.directory.shared.ldap.name.DN dn)
          deletes the entry with the given DN
 DeleteResponse delete(java.lang.String dn)
          deletes the entry with the given DN
 DeleteFuture deleteAsync(DeleteRequest delRequest)
          Performs an asynchronous delete operation based on the delete request object.
 DeleteResponse deleteTree(org.apache.directory.shared.ldap.name.DN dn)
          deletes the entry with the given DN, and all its children
 DeleteResponse deleteTree(java.lang.String dn)
          deletes the entry with the given DN, and all its children
 boolean doesFutureExistFor(java.lang.Integer messageId)
          checks if there is a ResponseFuture associated with the given message id
 ExtendedResponse extended(ExtendedRequest extendedRequest)
          Performs an extended operation based on the Extended request object.
 ExtendedResponse extended(org.apache.directory.shared.asn1.primitives.OID oid)
           
 ExtendedResponse extended(org.apache.directory.shared.asn1.primitives.OID oid, byte[] value)
          sends a extended operation request to the server with the given OID and value
 ExtendedResponse extended(java.lang.String oid)
           
 ExtendedResponse extended(java.lang.String oid, byte[] value)
           
 ExtendedFuture extendedAsync(ExtendedRequest extendedRequest)
          Asynchronously requests the server to perform an extended operation based on the given request.
 LdapConnectionConfig getConfig()
          gives the configuration information of the connection
 org.apache.directory.shared.ldap.codec.LdapMessageCodec getResponse()
          Return the response stored into the current session.
 org.apache.directory.shared.ldap.schema.SchemaManager getSchemaManager()
           
 java.util.List<java.lang.String> getSupportedControls()
          get the Controls supported by server.
 boolean isAuthenticated()
          Check if we are authenticated
 boolean isConnected()
          Check if we are connected
 boolean isControlSupported(java.lang.String controlOID)
          checks if a control with the given OID is supported
 void loadSchema()
          loads the default schema that is bundled in the shared-ldap-schema.jar
 SearchResponse lookup(java.lang.String dn)
           
 SearchResponse lookup(java.lang.String dn, java.lang.String... attributes)
          searches for an entry having the given DN
 void messageReceived(org.apache.mina.core.session.IoSession session, java.lang.Object message)
          Handle the incoming LDAP messages.
 ModifyResponse modify(org.apache.directory.shared.ldap.entry.Entry entry, org.apache.directory.shared.ldap.entry.ModificationOperation modOp)
          modifies all the attributes present in the entry by applying the same operation.
 ModifyResponse modify(ModifyRequest modRequest)
          Performs an modify operation based on the modifications present in the ModifyRequest.
 ModifyFuture modifyAsync(ModifyRequest modRequest)
          Performs an asynchronous modify operation based on the modifications present in the ModifyRequest.
 ModifyDnResponse modifyDn(ModifyDnRequest modDnRequest)
          performs the modifyDn operation based on the given ModifyDnRequest.
 ModifyDnFuture modifyDnAsync(ModifyDnRequest modDnRequest)
          performs the modifyDn operation based on the given ModifyDnRequest.
 ModifyDnResponse move(org.apache.directory.shared.ldap.name.DN entryDn, org.apache.directory.shared.ldap.name.DN newSuperiorDn)
          moves the given entry DN under the new superior DN
 ModifyDnResponse move(java.lang.String entryDn, java.lang.String newSuperiorDn)
           
 ModifyDnResponse rename(org.apache.directory.shared.ldap.name.DN entryDn, org.apache.directory.shared.ldap.name.RDN newRdn)
          renames the given entryDn with new RDN and deletes the old RDN.
 ModifyDnResponse rename(org.apache.directory.shared.ldap.name.DN entryDn, org.apache.directory.shared.ldap.name.RDN newRdn, boolean deleteOldRdn)
          renames the given entryDn with new RDN and deletes the old Rdn if deleteOldRdn is set to true.
 ModifyDnResponse rename(java.lang.String entryDn, java.lang.String newRdn)
          renames the given entryDn with new Rdn and deletes the old RDN.
 ModifyDnResponse rename(java.lang.String entryDn, java.lang.String newRdn, boolean deleteOldRdn)
           
 org.apache.directory.shared.ldap.cursor.Cursor<SearchResponse> search(SearchRequest searchRequest)
          Performs search in a synchronous mode.
 org.apache.directory.shared.ldap.cursor.Cursor<SearchResponse> search(java.lang.String baseDn, java.lang.String filter, org.apache.directory.shared.ldap.filter.SearchScope scope, java.lang.String... attributes)
          Do a search, on the base object, using the given filter.
 SearchFuture searchAsync(SearchRequest searchRequest)
          Do a search, on the base object, using the given filter.
 SearchFuture searchAsync(java.lang.String baseDn, java.lang.String filter, org.apache.directory.shared.ldap.filter.SearchScope scope, java.lang.String... attributes)
          Do an asynchronous search, on the base object, using the given filter.
 void setConnector(org.apache.mina.core.service.IoConnector connector)
          Set the connector to use.
 void setTimeOut(long timeOut)
          Set the timeOut for the responses.
 void unBind()
          UnBind from a server.
 
Methods inherited from class org.apache.mina.core.service.IoHandlerAdapter
exceptionCaught, messageSent, sessionClosed, sessionCreated, sessionIdle, sessionOpened
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LdapConnection

public LdapConnection()
Create a new instance of a LdapConnection on localhost, port 389.


LdapConnection

public LdapConnection(LdapConnectionConfig config)
Creates a new instance of LdapConnection with the given connection configuration.

Parameters:
config - the configuration of the LdapConnection

LdapConnection

public LdapConnection(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.

LdapConnection

public LdapConnection(java.lang.String server)
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

LdapConnection

public LdapConnection(java.lang.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.

Parameters:
server - The server we want to be connected to
useSsl - A flag to tell if it's a SSL connection or not.

LdapConnection

public LdapConnection(java.lang.String server,
                      int port)
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
port - The port the server is listening to

LdapConnection

public LdapConnection(java.lang.String server,
                      int port,
                      boolean useSsl)
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
port - The port the server is listening to
useSsl - A flag to tell if it's a SSL connection or not.
Method Detail

isConnected

public boolean isConnected()
Check if we are connected

Returns:
true if we are connected.

isAuthenticated

public boolean isAuthenticated()
Check if we are authenticated

Returns:
true if we are connected.

getResponse

public org.apache.directory.shared.ldap.codec.LdapMessageCodec getResponse()
Return the response stored into the current session.

Returns:
The last request response

connect

public boolean connect()
                throws LdapException,
                       java.io.IOException
Connect to the remote LDAP server.

Returns:
true if the connection is established, false otherwise
Throws:
LdapException - if some error has occured
java.io.IOException

close

public boolean close()
              throws java.io.IOException
Disconnect from the remote LDAP server

Returns:
true if the connection is closed, false otherwise
Throws:
java.io.IOException - if some I/O error occurs

add

public AddResponse add(org.apache.directory.shared.ldap.entry.Entry entry)
                throws LdapException
Add an entry to the server. This is a blocking add : the user has to wait for the response until the AddResponse is returned.

Parameters:
entry - The entry to add
Throws:
LdapException

addAsync

public AddFuture addAsync(org.apache.directory.shared.ldap.entry.Entry entry)
                   throws 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.

Parameters:
entry - The entry to add
Throws:
LdapException

add

public AddResponse add(AddRequest addRequest)
                throws LdapException
Add an entry present in the AddRequest to the server.

Parameters:
addRequest - the request object containing an entry and controls(if any)
Returns:
the add operation's response
Throws:
LdapException

addAsync

public AddFuture addAsync(AddRequest addRequest)
                   throws LdapException
Add an entry present in the AddRequest to the server.

Parameters:
addRequest - the request object containing an entry and controls(if any)
Returns:
the add operation's response
Throws:
LdapException

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

Parameters:
messageId - the ID of the request message sent to the server

abandon

public void abandon(AbandonRequest abandonRequest)
An abandon request essentially with the request message ID of the operation to be cancelled 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

Parameters:
abandonRequest - the abandon operation's request

bind

public BindResponse bind()
                  throws LdapException,
                         java.io.IOException
Anonymous Bind on a server.

Returns:
The BindResponse LdapResponse
Throws:
LdapException
java.io.IOException

bindAsync

public BindFuture bindAsync()
                     throws LdapException,
                            java.io.IOException
Anonymous asynchronous Bind on a server.

Returns:
The BindFuture
Throws:
LdapException
java.io.IOException

bind

public BindResponse bind(java.lang.String name,
                         java.lang.String credentials)
                  throws LdapException,
                         java.io.IOException
Simple Bind on a server.

Parameters:
name - The name we use to authenticate the user. It must be a valid DN
credentials - The password. It can't be null
Returns:
The BindResponse LdapResponse
Throws:
LdapException
java.io.IOException

bindAsync

public BindFuture bindAsync(java.lang.String name,
                            java.lang.String credentials)
                     throws LdapException,
                            java.io.IOException
Simple asynchronous Bind on a server.

Parameters:
name - The name we use to authenticate the user. It must be a valid DN
credentials - The password. It can't be null
Returns:
The BindResponse LdapResponse
Throws:
LdapException
java.io.IOException

bind

public BindResponse bind(org.apache.directory.shared.ldap.name.DN name,
                         java.lang.String credentials)
                  throws LdapException,
                         java.io.IOException
Simple Bind on a server.

Parameters:
name - The name we use to authenticate the user. It must be a valid DN
credentials - The password. It can't be null
Returns:
The BindResponse LdapResponse
Throws:
LdapException
java.io.IOException

bindAsync

public BindFuture bindAsync(org.apache.directory.shared.ldap.name.DN name,
                            java.lang.String credentials)
                     throws LdapException,
                            java.io.IOException
Simple asynchronous Bind on a server.

Parameters:
name - The name we use to authenticate the user. It must be a valid DN
credentials - The password. It can't be null
Returns:
The BindResponse LdapResponse
Throws:
LdapException
java.io.IOException

bind

public BindResponse bind(BindRequest bindRequest)
                  throws LdapException,
                         java.io.IOException
Bind to the server using a BindRequest object.

Parameters:
bindRequest - The BindRequest POJO containing all the needed parameters
Returns:
A LdapResponse containing the result
Throws:
LdapException
java.io.IOException

bindAsync

public BindFuture bindAsync(BindRequest bindRequest)
                     throws LdapException,
                            java.io.IOException
Do an asynchronous bind, based on a BindRequest.

Parameters:
bindRequest - The BindRequest to send
Returns:
BindFuture A future
Throws:
LdapException
java.io.IOException

search

public org.apache.directory.shared.ldap.cursor.Cursor<SearchResponse> search(java.lang.String baseDn,
                                                                             java.lang.String filter,
                                                                             org.apache.directory.shared.ldap.filter.SearchScope scope,
                                                                             java.lang.String... attributes)
                                                                      throws 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.

Parameters:
baseDn - The base for the search. It must be a valid DN, and can't be emtpy
filterString - The filter to use for this search. It can't be empty
scope - The sarch scope : OBJECT, ONELEVEL or SUBTREE
Returns:
A cursor on the result.
Throws:
LdapException

searchAsync

public SearchFuture searchAsync(java.lang.String baseDn,
                                java.lang.String filter,
                                org.apache.directory.shared.ldap.filter.SearchScope scope,
                                java.lang.String... attributes)
                         throws 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.

Parameters:
baseDn - The base for the search. It must be a valid DN, and can't be emtpy
filterString - The filter to use for this search. It can't be empty
scope - The sarch scope : OBJECT, ONELEVEL or SUBTREE
Returns:
A cursor on the result.
Throws:
LdapException

searchAsync

public SearchFuture searchAsync(SearchRequest searchRequest)
                         throws 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.

Parameters:
searchRequest - The search request to send to the server
Returns:
A Future
Throws:
LdapException

search

public org.apache.directory.shared.ldap.cursor.Cursor<SearchResponse> search(SearchRequest searchRequest)
                                                                      throws LdapException
Performs search in a synchronous mode.

Parameters:
searchRequest - The search configuration
Returns:
A Cursor containing Entries and Referencs
Throws:
LdapException - @TODO

unBind

public void unBind()
            throws java.lang.Exception
UnBind from a server. this is a request which expect no response.

Throws:
java.lang.Exception

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 wont wait longer than this value.

Parameters:
timeOut - The timeout, in milliseconds

messageReceived

public void messageReceived(org.apache.mina.core.session.IoSession session,
                            java.lang.Object message)
                     throws java.lang.Exception
Handle the incoming LDAP messages. This is where we feed the cursor for search requests, or call the listener.

Specified by:
messageReceived in interface org.apache.mina.core.service.IoHandler
Overrides:
messageReceived in class org.apache.mina.core.service.IoHandlerAdapter
Throws:
java.lang.Exception

modify

public ModifyResponse modify(org.apache.directory.shared.ldap.entry.Entry entry,
                             org.apache.directory.shared.ldap.entry.ModificationOperation modOp)
                      throws LdapException
modifies all the attributes present in the entry by applying the same operation.

Parameters:
entry - the entry whise attributes to be modified
modOp - the operation to be applied on all the attributes of the above entry
Returns:
the modify operation's response
Throws:
LdapException - in case of modify operation failure or timeout happens

modify

public ModifyResponse modify(ModifyRequest modRequest)
                      throws LdapException
Performs an modify operation based on the modifications present in the ModifyRequest.

Parameters:
modRequest - the request for modify operation
Returns:
the modify operation's r"esponse
Throws:
LdapException - in case of modify operation failure or timeout happens

modifyAsync

public ModifyFuture modifyAsync(ModifyRequest modRequest)
                         throws LdapException
Performs an asynchronous modify operation based on the modifications present in the ModifyRequest.

Parameters:
modRequest - the request for modify operation
Returns:
the modify operation's future
Throws:
LdapException - in case of modify operation failure or timeout happens

rename

public ModifyDnResponse rename(java.lang.String entryDn,
                               java.lang.String newRdn)
                        throws LdapException
renames the given entryDn with new Rdn and deletes the old RDN.

Throws:
LdapException
See Also:
rename(String, String, boolean)

rename

public ModifyDnResponse rename(org.apache.directory.shared.ldap.name.DN entryDn,
                               org.apache.directory.shared.ldap.name.RDN newRdn)
                        throws LdapException
renames the given entryDn with new RDN and deletes the old RDN.

Throws:
LdapException
See Also:
rename(DN, RDN, boolean)

rename

public ModifyDnResponse rename(java.lang.String entryDn,
                               java.lang.String newRdn,
                               boolean deleteOldRdn)
                        throws LdapException
Throws:
LdapException
See Also:
rename(DN, RDN, boolean)

rename

public ModifyDnResponse rename(org.apache.directory.shared.ldap.name.DN entryDn,
                               org.apache.directory.shared.ldap.name.RDN newRdn,
                               boolean deleteOldRdn)
                        throws LdapException
renames the given entryDn with new RDN and deletes the old Rdn if deleteOldRdn is set to true.

Parameters:
entryDn - the target DN
newRdn - new Rdn for the target DN
deleteOldRdn - flag to indicate whether to delete the old Rdn
Returns:
modifyDn operations response
Throws:
LdapException

move

public ModifyDnResponse move(java.lang.String entryDn,
                             java.lang.String newSuperiorDn)
                      throws LdapException
Throws:
LdapException
See Also:
move(DN, DN)

move

public ModifyDnResponse move(org.apache.directory.shared.ldap.name.DN entryDn,
                             org.apache.directory.shared.ldap.name.DN newSuperiorDn)
                      throws LdapException
moves the given entry DN under the new superior DN

Parameters:
entryDn - the DN of the target entry
newSuperiorDn - DN of the new parent/superior
Returns:
modifyDn operations response
Throws:
LdapException

modifyDn

public ModifyDnResponse modifyDn(ModifyDnRequest modDnRequest)
                          throws LdapException
performs the modifyDn operation based on the given ModifyDnRequest.

Parameters:
modDnRequest - the request
Returns:
modifyDn operations response, null if non-null listener is provided
Throws:
LdapException

modifyDnAsync

public ModifyDnFuture modifyDnAsync(ModifyDnRequest modDnRequest)
                             throws LdapException
performs the modifyDn operation based on the given ModifyDnRequest.

Parameters:
modDnRequest - the request
listener - callback listener which will be called after the operation is completed
Returns:
modifyDn operations response, null if non-null listener is provided
Throws:
LdapException

delete

public DeleteResponse delete(java.lang.String dn)
                      throws LdapException
deletes the entry with the given DN

Parameters:
dn - the target entry's DN as a String
Throws:
LdapException - If the DN is not valid or if the deletion failed

delete

public DeleteResponse delete(org.apache.directory.shared.ldap.name.DN dn)
                      throws LdapException
deletes the entry with the given DN

Parameters:
dn - the target entry's DN
Throws:
LdapException - If the DN is not valid or if the deletion failed

deleteTree

public DeleteResponse deleteTree(org.apache.directory.shared.ldap.name.DN dn)
                          throws LdapException
deletes the entry with the given DN, and all its children

Parameters:
dn - the target entry's DN
Returns:
operation's response
Throws:
LdapException - If the DN is not valid or if the deletion failed

deleteTree

public DeleteResponse deleteTree(java.lang.String dn)
                          throws LdapException
deletes the entry with the given DN, and all its children

Parameters:
dn - the target entry's DN as a String
Returns:
operation's response
Throws:
LdapException - If the DN is not valid or if the deletion failed

delete

public DeleteResponse delete(DeleteRequest deleteRequest)
                      throws LdapException
Performs a delete operation based on the delete request object.

Parameters:
deleteRequest - the delete operation's request
Returns:
delete operation's response, null if a non-null listener value is provided
Throws:
LdapException - If the DN is not valid or if the deletion failed

deleteAsync

public DeleteFuture deleteAsync(DeleteRequest delRequest)
                         throws LdapException
Performs an asynchronous delete operation based on the delete request object.

Parameters:
delRequest - the delete operation's request
Returns:
delete operation's response, null if a non-null listener value is provided
Throws:
LdapException - If the DN is not valid or if the deletion failed

compare

public CompareResponse compare(java.lang.String dn,
                               java.lang.String attributeName,
                               java.lang.String value)
                        throws LdapException
Compares a whether a given attribute's value matches that of the existing value of the attribute present in the entry with the given DN

Parameters:
dn - the target entry's String DN
attributeName - the attribute's name
value - a String value with which the target entry's attribute value to be compared with
Returns:
compare operation's response
Throws:
LdapException

compare

public CompareResponse compare(java.lang.String dn,
                               java.lang.String attributeName,
                               byte[] value)
                        throws LdapException
Compares a whether a given attribute's value matches that of the existing value of the attribute present in the entry with the given DN

Parameters:
dn - the target entry's String DN
attributeName - the attribute's name
value - a byte[] value with which the target entry's attribute value to be compared with
Returns:
compare operation's response
Throws:
LdapException

compare

public CompareResponse compare(java.lang.String dn,
                               java.lang.String attributeName,
                               org.apache.directory.shared.ldap.entry.Value<?> value)
                        throws LdapException
Compares a whether a given attribute's value matches that of the existing value of the attribute present in the entry with the given DN

Parameters:
dn - the target entry's String DN
attributeName - the attribute's name
value - a Value value with which the target entry's attribute value to be compared with
Returns:
compare operation's response
Throws:
LdapException

compare

public CompareResponse compare(org.apache.directory.shared.ldap.name.DN dn,
                               java.lang.String attributeName,
                               java.lang.String value)
                        throws LdapException
Compares a whether a given attribute's value matches that of the existing value of the attribute present in the entry with the given DN

Parameters:
dn - the target entry's DN
attributeName - the attribute's name
value - a String value with which the target entry's attribute value to be compared with
Returns:
compare operation's response
Throws:
LdapException

compare

public CompareResponse compare(org.apache.directory.shared.ldap.name.DN dn,
                               java.lang.String attributeName,
                               byte[] value)
                        throws LdapException
Compares a whether a given attribute's value matches that of the existing value of the attribute present in the entry with the given DN

Parameters:
dn - the target entry's DN
attributeName - the attribute's name
value - a byte[] value with which the target entry's attribute value to be compared with
Returns:
compare operation's response
Throws:
LdapException

compare

public CompareResponse compare(org.apache.directory.shared.ldap.name.DN dn,
                               java.lang.String attributeName,
                               org.apache.directory.shared.ldap.entry.Value<?> value)
                        throws LdapException
Compares a whether a given attribute's value matches that of the existing value of the attribute present in the entry with the given DN

Parameters:
dn - the target entry's DN
attributeName - the attribute's name
value - a Value value with which the target entry's attribute value to be compared with
Returns:
compare operation's response
Throws:
LdapException

compare

public CompareResponse compare(CompareRequest compareRequest)
                        throws LdapException
compares an entry's attribute's value with that of the given value

Parameters:
compareRequest - the CompareRequest which contains the target DN, attribute name and value
Returns:
compare operation's response
Throws:
LdapException

compareAsync

public CompareFuture compareAsync(CompareRequest compareRequest)
                           throws LdapException
Asynchronously compares an entry's attribute's value with that of the given value

Parameters:
compareRequest - the CompareRequest which contains the target DN, attribute name and value
Returns:
compare operation's future
Throws:
LdapException

extended

public ExtendedResponse extended(java.lang.String oid)
                          throws LdapException
Throws:
LdapException
See Also:
extended(OID, byte[])

extended

public ExtendedResponse extended(java.lang.String oid,
                                 byte[] value)
                          throws LdapException
Throws:
LdapException
See Also:
extended(OID, byte[])

extended

public ExtendedResponse extended(org.apache.directory.shared.asn1.primitives.OID oid)
                          throws LdapException
Throws:
LdapException
See Also:
extended(OID, byte[])

extended

public ExtendedResponse extended(org.apache.directory.shared.asn1.primitives.OID oid,
                                 byte[] value)
                          throws LdapException
sends a extended operation request to the server with the given OID and value

Parameters:
oid - the object identifier of the extended operation
value - value to be used by the extended operation, can be a null value
Returns:
extended operation's response
Throws:
LdapException

extended

public ExtendedResponse extended(ExtendedRequest extendedRequest)
                          throws LdapException
Performs an extended operation based on the Extended request object.

Parameters:
extendedRequest - the extended operation's request
Returns:
Extended operation's response
Throws:
LdapException - If the DN is not valid or if the extended operation failed

extendedAsync

public ExtendedFuture extendedAsync(ExtendedRequest extendedRequest)
                             throws LdapException
Asynchronously requests the server to perform an extended operation based on the given request.

Parameters:
extendedRequest - the object containing the details of the extended operation to be performed
Returns:
extended operation's Future
Throws:
LdapException

lookup

public SearchResponse lookup(java.lang.String dn)
                      throws LdapException
Throws:
LdapException
See Also:
lookup(String, String...)

lookup

public SearchResponse lookup(java.lang.String dn,
                             java.lang.String... attributes)
                      throws LdapException
searches for an entry having the given DN

Parameters:
dn - the DN of the entry to be fetched
attributes - the attributes to be returned along with entry
Returns:
the Entry with the given DN or null if no entry exists with that DN
Throws:
LdapException - in case of any problems while searching for the DN

isControlSupported

public boolean isControlSupported(java.lang.String controlOID)
                           throws LdapException
checks if a control with the given OID is supported

Parameters:
controlOID - the OID of the control
Returns:
true if the control is supported, false otherwise
Throws:
LdapException

getSupportedControls

public java.util.List<java.lang.String> getSupportedControls()
                                                      throws LdapException
get the Controls supported by server.

Returns:
a list of control OIDs supported by server
Throws:
LdapException

loadSchema

public void loadSchema()
                throws LdapException
loads the default schema that is bundled in the shared-ldap-schema.jar

Throws:
LdapException - in case of problems while loading the schema

getSchemaManager

public org.apache.directory.shared.ldap.schema.SchemaManager getSchemaManager()

getConfig

public LdapConnectionConfig getConfig()
gives the configuration information of the connection

Returns:
the configuration of the connection

doesFutureExistFor

public boolean doesFutureExistFor(java.lang.Integer messageId)
checks if there is a ResponseFuture associated with the given message id

Parameters:
messageId - ID of the request
Returns:
true if there is a non-null future exists, false otherwise


Copyright © 2009-2011 Apache Software Foundation. All Rights Reserved.