Interface LdapConnection
- All Superinterfaces:
AutoCloseable, Closeable
- All Known Subinterfaces:
LdapAsyncConnection
- All Known Implementing Classes:
AbstractLdapConnection, LdapConnectionWrapper, LdapNetworkConnection, MonitoringLdapConnection, PooledLdapConnection
The root interface for all the LDAP connection implementations. All operations defined in this interface are blocking (synchronous).
- Author:
- Apache Directory Project
-
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.voidAnonymous bind on a server.voidbind()Bind on a server, using theLdapConnectionConfiginformation of this connection.voidUnauthenticated authentication bind on a server.voidSimple bind on a server.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.voidbind(org.apache.directory.api.ldap.model.name.Dn name) Unauthenticated authentication bind on a server.voidSimple bind on a server.org.apache.directory.api.ldap.model.message.BindResponsebind(SaslRequest saslRequest) SASL Bind to the server using a SASL request object.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.booleanconnect()Connect to the remote LDAP server.voidDeletes 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.booleandoesFutureExistFor(int messageId) Deprecated.tell if an exception was caught while processing the request or a response.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.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.org.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 instanceGet the Controls supported by server.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.voidLoads all the default schemas that are bundled with the API.
Note: This method enables all schemas prior to loading.voidLoads 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.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.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.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.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.voidsetBinaryAttributeDetector(org.apache.directory.api.ldap.codec.api.BinaryAttributeDetector binaryAttributeDetecter) Sets the object responsible for the detection of binary attributes.voidsetSchemaManager(org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager) sets a SchemaManager to be used by this connectionvoidsetTimeOut(long timeOut) Set the timeout for the responses.voidunBind()UnBind from a server.
-
Method Details
-
isConnected
boolean isConnected()Check if the connection is established- Returns:
trueif the connection is established
-
isAuthenticated
boolean isAuthenticated()Check if the connection is authenticated.- Returns:
trueif the connection is authenticated
-
connect
boolean connect() throws org.apache.directory.api.ldap.model.exception.LdapExceptionConnect to the remote LDAP server.- Returns:
trueif the connection is established, false otherwise- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
exceptionCaught
Throwable exceptionCaught()tell if an exception was caught while processing the request or a response.- Returns:
- The exception if there was one thrown while processing a request or a response
-
close
Disconnect from the remote LDAP server.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException- if some I/O error occurs
-
add
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.- Parameters:
entry- The entry to add- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
add
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.- 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
-
abandon
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
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.- Parameters:
abandonRequest- the abandon operation's request
-
bind
void bind() throws org.apache.directory.api.ldap.model.exception.LdapExceptionBind on a server, using theLdapConnectionConfiginformation of this connection.- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
anonymousBind
void anonymousBind() throws org.apache.directory.api.ldap.model.exception.LdapExceptionAnonymous bind on a server.- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
bind
Unauthenticated authentication bind on a server.- Parameters:
name- The name used to authenticate the user. It must be a valid distinguished name.- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
bind
void bind(String name, String credentials) throws org.apache.directory.api.ldap.model.exception.LdapException Simple bind on a server.- Parameters:
name- The name used to authenticate the user. It must be a valid distinguished name.credentials- The password, it can't benull- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
bind
void bind(org.apache.directory.api.ldap.model.name.Dn name) throws org.apache.directory.api.ldap.model.exception.LdapException Unauthenticated authentication bind on a server.- Parameters:
name- The name used to authenticate the user.- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
bind
void bind(org.apache.directory.api.ldap.model.name.Dn name, String credentials) throws org.apache.directory.api.ldap.model.exception.LdapException Simple bind on a server.- Parameters:
name- The name used to authenticate the user.credentials- The password, it can't be null- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
bind
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.- 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
-
bind
org.apache.directory.api.ldap.model.message.BindResponse bind(SaslRequest saslRequest) throws org.apache.directory.api.ldap.model.exception.LdapException SASL Bind to the server using a SASL request object.- 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
-
search
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
- 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
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
- 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
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.- 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
-
unBind
void unBind() throws org.apache.directory.api.ldap.model.exception.LdapExceptionUnBind from a server. This is a request which expects no response.- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
setTimeOut
void setTimeOut(long timeOut) Set the timeout for the responses. We won't wait longer than this value.- Parameters:
timeOut- The timeout, in milliseconds
-
modify
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.- 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
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.- 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
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.- 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
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.- 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
-
rename
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.- 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
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.- 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
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.- 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
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.- 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
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.- 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
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.- 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
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.- 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
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- 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
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.- 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
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.- 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
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.- Parameters:
modDnRequest- the request object- Returns:
- modifyDn operation's response
- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
delete
Deletes the entry with the given distinguished name.- 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
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.- 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
-
delete
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.- 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
-
compare
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.- 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
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.- 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
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.- 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
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.- 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
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.- 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
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.- 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
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.- 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
-
extended
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.- 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
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.- 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
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.- 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
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.- 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
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.- 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
-
exists
Tells if an entry exists in the server.- 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
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.- 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
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.- 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
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.- 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
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..- 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
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.- 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
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.- 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
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.- 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
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.- 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
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.- 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
boolean isControlSupported(String controlOID) throws org.apache.directory.api.ldap.model.exception.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:
org.apache.directory.api.ldap.model.exception.LdapException- if some error occurred
-
getSupportedControls
-
loadSchema
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.- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- in case of problems while loading the schema
-
loadSchemaRelaxed
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.- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- in case of problems while loading the schema
-
getSchemaManager
org.apache.directory.api.ldap.model.schema.SchemaManager getSchemaManager()Get the SchemaManager instance- Returns:
- The SchemaManager associated with this LdapConection if any
-
getCodecService
org.apache.directory.api.ldap.codec.api.LdapApiService getCodecService()Gets the LDAP CODEC service responsible for encoding and decoding messages.- Returns:
- The LDAP CODEC service.
-
isRequestCompleted
boolean isRequestCompleted(int messageId) Checks if a request has been completed, or not.- Parameters:
messageId- ID of the request- Returns:
- true if the request has been completed, false is still being processed
-
doesFutureExistFor
Deprecated.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
-
getBinaryAttributeDetector
org.apache.directory.api.ldap.codec.api.BinaryAttributeDetector getBinaryAttributeDetector()Get the BinaryAttribute dectore instance- Returns:
- the object responsible for the detection of binary attributes
-
setBinaryAttributeDetector
void setBinaryAttributeDetector(org.apache.directory.api.ldap.codec.api.BinaryAttributeDetector binaryAttributeDetecter) Sets the object responsible for the detection of binary attributes.- Parameters:
binaryAttributeDetecter- The Binary Attribute Detector to use
-
setSchemaManager
void setSchemaManager(org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager) sets a SchemaManager to be used by this connection- Parameters:
schemaManager- The SchemaManager to set
-
isRequestCompleted(int)