Class LdapConnectionWrapper
- java.lang.Object
-
- org.apache.directory.ldap.client.api.LdapConnectionWrapper
-
- All Implemented Interfaces:
Closeable,AutoCloseable,LdapConnection,Wrapper<LdapConnection>
- Direct Known Subclasses:
MonitoringLdapConnection
public class LdapConnectionWrapper extends Object implements LdapConnection, Wrapper<LdapConnection>
Provides a base implementation of aWrapperforLdapConnectionobjects. All methods are passed through to the wrappedLdapConnection.- Author:
- Apache Directory Project
-
-
Field Summary
Fields Modifier and Type Field Description protected LdapConnectionconnectionThe wrapped connection
-
Constructor Summary
Constructors Modifier Constructor Description protectedLdapConnectionWrapper(LdapConnection connection)Creates a new LdapConnectionWrapper instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabandon(int messageId)Abandons a request submitted to the server for performing a particular operation.voidabandon(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(Entry entry)Add an entry to the server.AddResponseadd(AddRequest addRequest)Add an entry present in theAddRequestto the server.voidanonymousBind()Anonymous bind on a server.voidbind()Bind on a server, using theLdapConnectionConfiginformation of this connection.voidbind(String name)Unauthenticated authentication bind on a server.voidbind(String name, String credentials)Simple bind on a server.BindResponsebind(BindRequest bindRequest)Bind to the server using a bind request object.voidbind(Dn name)Unauthenticated authentication bind on a server.voidbind(Dn name, String credentials)Simple bind on a server.BindResponsebind(SaslRequest saslRequest)SASL Bind to the server using a SASL request object.voidclose()Disconnect from the remote LDAP server.booleancompare(String dn, String attributeName, byte[] value)Compares whether a given attribute's value matches that of the existing value of the attribute present in the entry with the given distinguished name.booleancompare(String dn, String attributeName, String value)Compares whether a given attribute's value matches that of the existing value of the attribute present in the entry with the given distinguished name.booleancompare(String dn, String attributeName, 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.CompareResponsecompare(CompareRequest compareRequest)Compares an entry's attribute's value with that of the given value.booleancompare(Dn dn, String attributeName, byte[] value)Compares whether a given attribute's value matches that of the existing value of the attribute present in the entry with the given distinguished name.booleancompare(Dn dn, String attributeName, String value)Compares whether a given attribute's value matches that of the existing value of the attribute present in the entry with the given distinguished name.booleancompare(Dn dn, String attributeName, 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.booleanconnect()Connect to the remote LDAP server.voiddelete(String dn)Deletes the entry with the given distinguished name.DeleteResponsedelete(DeleteRequest deleteRequest)Performs a delete operation based on the delete request object.voiddelete(Dn dn)Deletes the entry with the given distinguished name.booleandoesFutureExistFor(int messageId)Checks if there is a ResponseFuture associated with the given message ID.ThrowableexceptionCaught()tell if an exception was caught while processing the request or a response.booleanexists(String dn)Tells if an entry exists in the server.booleanexists(Dn dn)Tells if an Entry exists in the server.ExtendedResponseextended(String oid)Sends a extended operation request to the server with the given OID and no value.ExtendedResponseextended(String oid, byte[] value)Sends a extended operation request to the server with the given OID and value.ExtendedResponseextended(Oid oid)Sends a extended operation request to the server with the given OID and no value.ExtendedResponseextended(Oid oid, byte[] value)Sends a extended operation request to the server with the given OID and value.ExtendedResponseextended(ExtendedRequest extendedRequest)Performs an extended operation based on the extended request object.BinaryAttributeDetectorgetBinaryAttributeDetector()LdapApiServicegetCodecService()Gets the LDAP CODEC service responsible for encoding and decoding messages.EntrygetRootDse()Get back the RooDSE from the connected server.EntrygetRootDse(String... attributes)Get back the RooDSE from the connected server.SchemaManagergetSchemaManager()List<String>getSupportedControls()Get the Controls supported by server.booleanisAuthenticated()Check if the connection is authenticated.booleanisConnected()Check 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.voidloadSchema()Loads all the default schemas that are bundled with the API.
Note: This method enables all schemas prior to loading.voidloadSchemaRelaxed()Loads all the default schemas that are bundled with the API, in a relaxed mode.
Note: This method enables all schemas prior to loading.
The relaxed mode will allow inconsistencies in the schema.Entrylookup(String dn)Searches for an entry having the given distinguished name.Entrylookup(String dn, String... attributes)Searches for an entry having the given distinguished name.Entrylookup(String dn, Control[] controls, String... attributes)Searches for an entry having the given distinguished name.Entrylookup(Dn dn)Searches for an entry having the given distinguished name..Entrylookup(Dn dn, String... attributes)Searches for an entry having the given distinguished name.Entrylookup(Dn dn, Control[] controls, String... attributes)Searches for an entry having the given distinguished name.voidmodify(String dn, Modification... modifications)Applies all the modifications to the entry specified by its distinguished name.voidmodify(Entry entry, ModificationOperation modOp)Modifies all the attributes present in the entry by applying the same operation.ModifyResponsemodify(ModifyRequest modRequest)Performs an modify operation based on the modifications present in the modify request.voidmodify(Dn dn, Modification... modifications)Applies all the modifications to the entry specified by its distinguished name.ModifyDnResponsemodifyDn(ModifyDnRequest modDnRequest)Performs the modifyDn operation based on the given request object.voidmove(String entryDn, String newSuperiorDn)Moves the given entry distinguished name under the new superior distinguished name.voidmove(Dn entryDn, 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(Dn entryDn, Dn newDn)Moves and renames the given entryDn.voidmoveAndRename(Dn entryDn, Dn newDn, boolean deleteOldRdn)Moves and renames the given entryDn.voidrename(String entryDn, String newRdn)Renames the given entryDn with new relative distinguished name and deletes the old relative distinguished name.voidrename(String entryDn, String newRdn, boolean deleteOldRdn)Renames the given entryDn with new relative distinguished name and deletes the old relative distinguished name if deleteOldRdn is set to true.voidrename(Dn entryDn, Rdn newRdn)Renames the given entryDn with new relative distinguished name and deletes the old relative distinguished name.voidrename(Dn entryDn, 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.EntryCursorsearch(String baseDn, String filter, SearchScope scope, String... attributes)Do a search, on the base object, using the given filter and scope.SearchCursorsearch(SearchRequest searchRequest)Performs search using a search request object.EntryCursorsearch(Dn baseDn, String filter, SearchScope scope, String... attributes)Do a search, on the base object, using the given filter and scope.voidsetBinaryAttributeDetector(BinaryAttributeDetector binaryAttributeDetecter)Sets the object responsible for the detection of binary attributes.voidsetSchemaManager(SchemaManager schemaManager)sets a SchemaManager to be used by this connectionvoidsetTimeOut(long timeOut)Set the timeout for the responses.voidunBind()UnBind from a server.LdapConnectionwrapped()Returns the wrapped object.
-
-
-
Field Detail
-
connection
protected LdapConnection connection
The wrapped connection
-
-
Constructor Detail
-
LdapConnectionWrapper
protected LdapConnectionWrapper(LdapConnection connection)
Creates a new LdapConnectionWrapper instance- Parameters:
connection- The wrapped connection
-
-
Method Detail
-
wrapped
public LdapConnection wrapped()
Returns the wrapped object.- Specified by:
wrappedin interfaceWrapper<LdapConnection>- Returns:
- The wrapped object
-
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
-
connect
public boolean connect() throws LdapExceptionConnect to the remote LDAP server.- Specified by:
connectin interfaceLdapConnection- Returns:
trueif the connection is established, false otherwise- Throws:
LdapException- if some error occurred
-
exceptionCaught
public Throwable 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
-
close
public void close() throws IOExceptionDisconnect from the remote LDAP server.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceLdapConnection- Throws:
IOException- if some I/O error occurs
-
add
public void add(Entry entry) throws LdapException
Add an entry to the server.- Specified by:
addin interfaceLdapConnection- Parameters:
entry- The entry to add- Throws:
LdapException- if some error occurred
-
add
public AddResponse add(AddRequest addRequest) throws 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:
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(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 LdapExceptionBind on a server, using theLdapConnectionConfiginformation of this connection.- Specified by:
bindin interfaceLdapConnection- Throws:
LdapException- if some error occurred
-
anonymousBind
public void anonymousBind() throws LdapExceptionAnonymous bind on a server.- Specified by:
anonymousBindin interfaceLdapConnection- Throws:
LdapException- if some error occurred
-
bind
public void bind(String name) throws LdapException
Unauthenticated authentication bind on a server.- Specified by:
bindin interfaceLdapConnection- Parameters:
name- The name used to authenticate the user. It must be a valid distinguished name.- Throws:
LdapException- if some error occurred
-
bind
public void bind(String name, String credentials) throws LdapException
Simple bind on a server.- Specified by:
bindin interfaceLdapConnection- Parameters:
name- The name used to authenticate the user. It must be a valid distinguished name.credentials- The password, it can't benull- Throws:
LdapException- if some error occurred
-
bind
public void bind(Dn name) throws LdapException
Unauthenticated authentication bind on a server.- Specified by:
bindin interfaceLdapConnection- Parameters:
name- The name used to authenticate the user.- Throws:
LdapException- if some error occurred
-
bind
public void bind(Dn name, String credentials) throws LdapException
Simple bind on a server.- Specified by:
bindin interfaceLdapConnection- Parameters:
name- The name used to authenticate the user.credentials- The password, it can't be null- Throws:
LdapException- if some error occurred
-
bind
public BindResponse bind(BindRequest bindRequest) throws 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:
LdapException- if some error occurred
-
bind
public BindResponse bind(SaslRequest saslRequest) throws LdapException
SASL Bind to the server using a SASL request object.- Specified by:
bindin interfaceLdapConnection- Parameters:
saslRequest- The SASL request object containing all the needed parameters- Returns:
- A
BindResponsecontaining the result - Throws:
LdapException- if some error occurred
-
search
public EntryCursor search(Dn baseDn, String filter, SearchScope scope, String... attributes) throws 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:
LdapException- if some error occurred
-
search
public EntryCursor search(String baseDn, String filter, SearchScope scope, String... attributes) throws 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:
LdapException- if some error occurred
-
search
public SearchCursor search(SearchRequest searchRequest) throws 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:
LdapException- if some error occurred
-
unBind
public void unBind() throws LdapExceptionUnBind from a server. This is a request which expects no response.- Specified by:
unBindin interfaceLdapConnection- Throws:
LdapException- if some error occurred
-
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
-
modify
public void modify(Dn dn, Modification... modifications) throws 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:
LdapException- in case of modify operation failure or timeout happens
-
modify
public void modify(String dn, Modification... modifications) throws 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:
LdapException- in case of modify operation failure or timeout happens
-
modify
public void modify(Entry entry, ModificationOperation modOp) throws 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:
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 modify request.- Specified by:
modifyin interfaceLdapConnection- Parameters:
modRequest- the modify request object- Returns:
- the modify operation's response
- Throws:
LdapException- in case of modify operation failure or timeout happens
-
rename
public void rename(String entryDn, String newRdn) throws 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:
LdapException- if some error occurred- See Also:
LdapConnection.rename(String, String, boolean)
-
rename
public void rename(Dn entryDn, Rdn newRdn) throws 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:
LdapException- if some error occurred- See Also:
LdapConnection.rename(Dn, Rdn, boolean)
-
rename
public void rename(String entryDn, String newRdn, boolean deleteOldRdn) throws 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:
LdapException- if some error occurred- See Also:
LdapConnection.rename(Dn, Rdn, boolean)
-
rename
public void rename(Dn entryDn, Rdn newRdn, boolean deleteOldRdn) throws 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:
LdapException- if some error occurred
-
move
public void move(String entryDn, String newSuperiorDn) throws 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:
LdapException- if some error occurred- See Also:
LdapConnection.move(Dn, Dn)
-
move
public void move(Dn entryDn, Dn newSuperiorDn) throws 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:
LdapException- if some error occurred
-
moveAndRename
public void moveAndRename(Dn entryDn, Dn newDn) throws 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:
LdapException- if some error occurred- See Also:
LdapConnection.moveAndRename(Dn, Dn, boolean)
-
moveAndRename
public void moveAndRename(String entryDn, String newDn) throws 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:
LdapException- if some error occurred- See Also:
LdapConnection.moveAndRename(Dn, Dn, boolean)
-
moveAndRename
public void moveAndRename(Dn entryDn, Dn newDn, boolean deleteOldRdn) throws 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:
LdapException- if some error occurred
-
moveAndRename
public void moveAndRename(String entryDn, String newDn, boolean deleteOldRdn) throws 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:
LdapException- if some error occurred
-
modifyDn
public ModifyDnResponse modifyDn(ModifyDnRequest modDnRequest) throws 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:
LdapException- if some error occurred
-
delete
public void delete(String dn) throws LdapException
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:
LdapException- If the distinguished name is not valid or if the deletion failed
-
delete
public void delete(Dn dn) throws LdapException
Deletes the entry with the given distinguished name.- Specified by:
deletein interfaceLdapConnection- Parameters:
dn- the target entry's distinguished name- Throws:
LdapException- If the distinguished name 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.- Specified by:
deletein interfaceLdapConnection- Parameters:
deleteRequest- the delete operation's request- Returns:
- delete operation's response
- Throws:
LdapException- If the distinguished name is not valid or if the deletion failed
-
compare
public boolean compare(String dn, String attributeName, String value) throws 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:
LdapException- if some error occurred
-
compare
public boolean compare(String dn, String attributeName, byte[] value) throws 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:
LdapException- if some error occurred
-
compare
public boolean compare(String dn, String attributeName, Value value) throws 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:
LdapException- if some error occurred
-
compare
public boolean compare(Dn dn, String attributeName, String value) throws 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:
LdapException- if some error occurred
-
compare
public boolean compare(Dn dn, String attributeName, byte[] value) throws 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:
LdapException- if some error occurred
-
compare
public boolean compare(Dn dn, String attributeName, Value value) throws 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:
LdapException- if some error occurred
-
compare
public CompareResponse compare(CompareRequest compareRequest) throws 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:
LdapException- if some error occurred
-
extended
public ExtendedResponse extended(String oid) throws 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:
LdapException- if some error occurred- See Also:
LdapConnection.extended(org.apache.directory.api.asn1.util.Oid, byte[])
-
extended
public ExtendedResponse extended(String oid, byte[] value) throws 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:
LdapException- if some error occurred- See Also:
LdapConnection.extended(org.apache.directory.api.asn1.util.Oid, byte[])
-
extended
public ExtendedResponse extended(Oid oid) throws 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:
LdapException- if some error occurred- See Also:
LdapConnection.extended(org.apache.directory.api.asn1.util.Oid, byte[])
-
extended
public ExtendedResponse extended(Oid oid, byte[] value) throws 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:
LdapException- if some error occurred
-
extended
public ExtendedResponse extended(ExtendedRequest extendedRequest) throws 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:
LdapException- if the extended operation failed
-
exists
public boolean exists(String dn) throws 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, 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:
LdapException- if some error occurred
-
exists
public boolean exists(Dn dn) throws 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:
LdapException- if some error occurred
-
getRootDse
public Entry getRootDse() throws LdapException
Get 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:
LdapException- If the rootDSE can't be read
-
getRootDse
public Entry getRootDse(String... attributes) throws 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:
LdapException- If the rootDSE can't be read
-
lookup
public Entry lookup(Dn dn) throws 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:
LdapException- in case of any problems while searching for the distinguished name or if the returned response contains a referral- See Also:
LdapConnection.lookup(Dn, String...)
-
lookup
public Entry lookup(String dn) throws 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:
LdapException- in case of any problems while searching for the distinguished name or if the returned response contains a referral- See Also:
LdapConnection.lookup(String, String...)
-
lookup
public Entry lookup(Dn dn, String... attributes) throws 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:
LdapException- in case of any problems while searching for the distinguished name or if the returned response contains a referral
-
lookup
public Entry lookup(Dn dn, Control[] controls, String... attributes) throws 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:
LdapException- in case of any problems while searching for the distinguished name or if the returned response contains a referral
-
lookup
public Entry lookup(String dn, String... attributes) throws 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:
LdapException- in case of any problems while searching for the distinguished name or if the returned response contains a referral- See Also:
LdapConnection.lookup(Dn, String...)
-
lookup
public Entry lookup(String dn, Control[] controls, String... attributes) throws 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:
LdapException- in case of any problems while searching for the distinguished name or if the returned response contains a referral- See Also:
LdapConnection.lookup(Dn, String...)
-
isControlSupported
public boolean isControlSupported(String controlOID) throws 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:
LdapException- if some error occurred
-
getSupportedControls
public List<String> getSupportedControls() throws LdapException
Get the Controls supported by server.- Specified by:
getSupportedControlsin interfaceLdapConnection- Returns:
- a list of control OIDs supported by server
- Throws:
LdapException- if some error occurred
-
loadSchema
public void loadSchema() throws 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:
LdapException- in case of problems while loading the schema
-
getSchemaManager
public SchemaManager getSchemaManager()
- Specified by:
getSchemaManagerin interfaceLdapConnection- Returns:
- The SchemaManager associated with this LdapConection if any
-
getCodecService
public LdapApiService getCodecService()
Gets the LDAP CODEC service responsible for encoding and decoding messages.- Specified by:
getCodecServicein interfaceLdapConnection- Returns:
- The LDAP CODEC service.
-
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
-
getBinaryAttributeDetector
public BinaryAttributeDetector getBinaryAttributeDetector()
- Specified by:
getBinaryAttributeDetectorin interfaceLdapConnection- Returns:
- the object responsible for the detection of binary attributes
-
setBinaryAttributeDetector
public void setBinaryAttributeDetector(BinaryAttributeDetector binaryAttributeDetecter)
Sets the object responsible for the detection of binary attributes.- Specified by:
setBinaryAttributeDetectorin interfaceLdapConnection- Parameters:
binaryAttributeDetecter- The Binary Attribute Detector to use
-
setSchemaManager
public void setSchemaManager(SchemaManager schemaManager)
sets a SchemaManager to be used by this connection- Specified by:
setSchemaManagerin interfaceLdapConnection- Parameters:
schemaManager- The SchemaManager to set
-
loadSchemaRelaxed
public void loadSchemaRelaxed() throws 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:
LdapException- in case of problems while loading the schema
-
-