public interface LdapConnection
Modifier and Type | Method and Description |
---|---|
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).
|
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.
|
void |
add(Entry entry)
Add an entry to the server.
|
void |
anonymousBind()
Anonymous Bind on a server.
|
void |
bind()
Bind on a server, using the LdapConnectionConfig informations
|
BindResponse |
bind(BindRequest bindRequest)
Bind to the server using a BindRequest object.
|
void |
bind(Dn name)
Unauthenticated authentication Bind on a server.
|
void |
bind(Dn name,
String credentials)
Simple Bind on a server.
|
void |
bind(String name)
Unauthenticated authentication bind
|
void |
bind(String name,
String credentials)
Simple 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.
|
boolean |
compare(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 Dn.
|
boolean |
compare(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 Dn.
|
boolean |
compare(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 Dn.
|
boolean |
compare(String dn,
String attributeName,
byte[] value)
Compares whether a given attribute's value matches that of the
existing value of the attribute present in the entry with the given Dn.
|
boolean |
compare(String dn,
String attributeName,
String value)
Compares whether a given attribute's value matches that of the
existing value of the attribute present in the entry with the given Dn.
|
boolean |
compare(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 Dn.
|
boolean |
connect()
Connect to the remote LDAP server.
|
DeleteResponse |
delete(DeleteRequest deleteRequest)
Performs a delete operation based on the delete request object.
|
void |
delete(Dn dn)
Deletes the entry with the given Dn.
|
void |
delete(String dn)
Deletes the entry with the given Dn.
|
boolean |
doesFutureExistFor(int messageId)
Checks if there is a ResponseFuture associated with the given message ID.
|
boolean |
exists(Dn dn)
Tells if an Entry exists in the server.
|
boolean |
exists(String dn)
Tells if an Entry exists in the server.
|
ExtendedResponse |
extended(ExtendedRequest extendedRequest)
Performs an extended operation based on the Extended request object.
|
ExtendedResponse |
extended(Oid oid)
Sends a extended operation request to the server with the given OID and no value.
|
ExtendedResponse |
extended(Oid oid,
byte[] value)
Sends a extended operation request to the server with the given OID and value.
|
ExtendedResponse |
extended(String oid)
Sends a extended operation request to the server with the given OID and no value.
|
ExtendedResponse |
extended(String oid,
byte[] value)
Sends a extended operation request to the server with the given OID and value.
|
LdapApiService |
getCodecService()
Gets the LDAP CODEC service responsible for encoding and decoding
messages.
|
SchemaManager |
getSchemaManager() |
List<String> |
getSupportedControls()
Get the Controls supported by server.
|
boolean |
isAuthenticated()
Check if we are authenticated
|
boolean |
isConnected()
Check if we are connected
|
boolean |
isControlSupported(String controlOID)
Checks if a control with the given OID is supported.
|
void |
loadSchema()
Loads all the default schemas that are bundled with the API.
Note: This method enables all schemas prior to loading |
Entry |
lookup(Dn dn)
Searches for an entry having the given Dn.
|
Entry |
lookup(Dn dn,
Control[] controls,
String... attributes)
Searches for an entry having the given Dn.
|
Entry |
lookup(Dn dn,
String... attributes)
Searches for an entry having the given Dn.
|
Entry |
lookup(String dn)
Searches for an entry having the given Dn.
|
Entry |
lookup(String dn,
Control[] controls,
String... attributes)
Searches for an entry having the given Dn.
|
Entry |
lookup(String dn,
String... attributes)
Searches for an entry having the given Dn.
|
void |
modify(Dn dn,
Modification... modifications)
Applies all the modifications to the entry specified by its Dn.
|
void |
modify(Entry 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.
|
void |
modify(String dn,
Modification... modifications)
Applies all the modifications to the entry specified by its Dn.
|
ModifyDnResponse |
modifyDn(ModifyDnRequest modDnRequest)
Performs the modifyDn operation based on the given ModifyDnRequest.
|
void |
move(Dn entryDn,
Dn newSuperiorDn)
Moves the given entry Dn under the new superior Dn.
|
void |
move(String entryDn,
String newSuperiorDn)
Moves the given entry Dn under the new superior Dn.
|
void |
moveAndRename(Dn entryDn,
Dn newDn)
Moves and renames the given entryDn.
|
void |
moveAndRename(Dn entryDn,
Dn newDn,
boolean deleteOldRdn)
Moves and renames the given entryDn.
|
void |
moveAndRename(String entryDn,
String newDn)
Moves and renames the given entryDn.The old Rdn will be deleted
|
void |
moveAndRename(String entryDn,
String newDn,
boolean deleteOldRdn)
Moves and renames the given entryDn.
|
void |
rename(Dn entryDn,
Rdn newRdn)
Renames the given entryDn with new Rdn and deletes the old Rdn.
|
void |
rename(Dn entryDn,
Rdn newRdn,
boolean deleteOldRdn)
Renames the given entryDn with new Rdn and deletes the old Rdn if
deleteOldRdn is set to true.
|
void |
rename(String entryDn,
String newRdn)
Renames the given entryDn with new Rdn and deletes the old Rdn.
|
void |
rename(String entryDn,
String newRdn,
boolean deleteOldRdn)
Renames the given entryDn with new Rdn and deletes the old Rdn if
deleteOldRdn is set to true.
|
EntryCursor |
search(Dn baseDn,
String filter,
SearchScope scope,
String... attributes)
Do a search, on the base object, using the given filter.
|
SearchCursor |
search(SearchRequest searchRequest)
Performs search in a synchronous mode.
|
EntryCursor |
search(String baseDn,
String filter,
SearchScope scope,
String... attributes)
Do a search, on the base object, using the given filter.
|
void |
setTimeOut(long timeOut)
Set the timeOut for the responses.
|
void |
unBind()
UnBind from a server.
|
boolean isConnected()
true
if we are connected.boolean isAuthenticated()
true
if we are connected.boolean connect() throws LdapException, IOException
true
if the connection is established, false otherwiseLdapException
- if some error occurredIOException
- if an I/O exception occurredboolean close() throws IOException
true
if the connection is closed, false otherwiseIOException
- if some I/O error occursvoid add(Entry entry) throws LdapException
entry
- The entry to addLdapException
- if some error occurredAddResponse add(AddRequest addRequest) throws LdapException
addRequest
- the request object containing an entry and controls(if any)LdapException
- if some error occurredvoid abandon(int messageId)
messageId
- the ID of the request message sent to the servervoid abandon(AbandonRequest abandonRequest)
abandonRequest
- the abandon operation's requestvoid bind() throws LdapException, IOException
LdapException
- if some error occurredIOException
- if an I/O exception occurredvoid anonymousBind() throws LdapException, IOException
LdapException
- if some error occurredIOException
- if an I/O exception occurredvoid bind(String name) throws LdapException, IOException
name
- The name we use to authenticate the user. It must be a
valid DnLdapException
- if some error occurredIOException
- if an I/O exception occurredvoid bind(String name, String credentials) throws LdapException, IOException
name
- The name we use to authenticate the user. It must be a
valid Dncredentials
- The password. It can't be nullLdapException
- if some error occurredIOException
- if an I/O exception occurredvoid bind(Dn name) throws LdapException, IOException
name
- The name we use to authenticate the user. It must be a
valid DnLdapException
- if some error occurredIOException
- if an I/O exception occurredvoid bind(Dn name, String credentials) throws LdapException, IOException
name
- The name we use to authenticate the user. It must be a
valid Dncredentials
- The password. It can't be nullLdapException
- if some error occurredIOException
- if an I/O exception occurredBindResponse bind(BindRequest bindRequest) throws LdapException, IOException
bindRequest
- The BindRequest POJO containing all the needed
parametersLdapException
- if some error occurredIOException
- if an I/O exception occurredEntryCursor search(Dn baseDn, String filter, SearchScope scope, String... attributes) throws LdapException
baseDn
- The base for the search. It must be a valid
Dn, and can't be emtpyfilter
- The filter to use for this search. It can't be emptyscope
- The search scope : OBJECT, ONELEVEL or SUBTREEattributes
- The attributes to use for this searchLdapException
- if some error occurredEntryCursor search(String baseDn, String filter, SearchScope scope, String... attributes) throws LdapException
baseDn
- The base for the search. It must be a valid
Dn, and can't be emtpyfilter
- The filter to use for this search. It can't be emptyscope
- The search scope : OBJECT, ONELEVEL or SUBTREEattributes
- The attributes to use for this searchLdapException
- if some error occurredSearchCursor search(SearchRequest searchRequest) throws LdapException
searchRequest
- The search configurationLdapException
- if some error occurredvoid unBind() throws LdapException
LdapException
- if some error occurredvoid setTimeOut(long timeOut)
timeOut
- The timeout, in millisecondsvoid modify(Dn dn, Modification... modifications) throws LdapException
dn
- The entry's Dnmodifications
- The list of modifications to be appliedLdapException
- in case of modify operation failure or timeout happensvoid modify(String dn, Modification... modifications) throws LdapException
dn
- The entry's Dnmodifications
- The list of modifications to be appliedLdapException
- in case of modify operation failure or timeout happensvoid modify(Entry entry, ModificationOperation modOp) throws LdapException
entry
- the entry with the attributes to be modifiedmodOp
- the operation to be applied on all the attributes of the above entryLdapException
- in case of modify operation failure or timeout happensModifyResponse modify(ModifyRequest modRequest) throws LdapException
modRequest
- the request for modify operationLdapException
- in case of modify operation failure or timeout happensvoid rename(String entryDn, String newRdn) throws LdapException
entryDn
- the target DnnewRdn
- new Rdn for the target DnLdapException
- if some error occurredrename(String, String, boolean)
void rename(Dn entryDn, Rdn newRdn) throws LdapException
entryDn
- the target DnnewRdn
- new Rdn for the target DnLdapException
- if some error occurredrename(org.apache.directory.shared.ldap.model.name.Dn, org.apache.directory.shared.ldap.model.name.Rdn, boolean)
void rename(String entryDn, String newRdn, boolean deleteOldRdn) throws LdapException
entryDn
- the target DnnewRdn
- new Rdn for the target DndeleteOldRdn
- flag to indicate whether to delete the old RdnLdapException
- if some error occurredrename(org.apache.directory.shared.ldap.model.name.Dn, org.apache.directory.shared.ldap.model.name.Rdn, boolean)
void rename(Dn entryDn, Rdn newRdn, boolean deleteOldRdn) throws LdapException
entryDn
- the target DnnewRdn
- new Rdn for the target DndeleteOldRdn
- flag to indicate whether to delete the old RdnLdapException
- if some error occurredvoid move(String entryDn, String newSuperiorDn) throws LdapException
entryDn
- the Dn of the target entrynewSuperiorDn
- Dn of the new parent/superiorLdapException
- if some error occurredmove(org.apache.directory.shared.ldap.model.name.Dn, org.apache.directory.shared.ldap.model.name.Dn)
void move(Dn entryDn, Dn newSuperiorDn) throws LdapException
entryDn
- the Dn of the target entrynewSuperiorDn
- Dn of the new parent/superiorLdapException
- if some error occurredvoid moveAndRename(Dn entryDn, Dn newDn) throws LdapException
entryDn
- The original entry DnnewDn
- The new Entry DnLdapException
- if some error occurredmoveAndRename(org.apache.directory.shared.ldap.model.name.Dn, org.apache.directory.shared.ldap.model.name.Dn, boolean)
void moveAndRename(String entryDn, String newDn) throws LdapException
entryDn
- The original entry DnnewDn
- The new Entry DnLdapException
- if some error occurredmoveAndRename(org.apache.directory.shared.ldap.model.name.Dn, org.apache.directory.shared.ldap.model.name.Dn, boolean)
void moveAndRename(Dn entryDn, Dn newDn, boolean deleteOldRdn) throws LdapException
entryDn
- The original entry DnnewDn
- The new Entry DndeleteOldRdn
- Tells if the old Rdn must be removedLdapException
- if some error occurredvoid moveAndRename(String entryDn, String newDn, boolean deleteOldRdn) throws LdapException
entryDn
- The original entry DnnewDn
- The new Entry DndeleteOldRdn
- Tells if the old Rdn must be removedLdapException
- if some error occurredModifyDnResponse modifyDn(ModifyDnRequest modDnRequest) throws LdapException
modDnRequest
- the requestLdapException
- if some error occurredvoid delete(String dn) throws LdapException
dn
- the target entry's Dn as a StringLdapException
- If the Dn is not valid or if the deletion failedvoid delete(Dn dn) throws LdapException
dn
- the target entry's DnLdapException
- If the Dn is not valid or if the deletion failedDeleteResponse delete(DeleteRequest deleteRequest) throws LdapException
deleteRequest
- the delete operation's requestLdapException
- If the Dn is not valid or if the deletion failedboolean compare(String dn, String attributeName, String value) throws LdapException
dn
- the target entry's String DnattributeName
- the attribute's namevalue
- a String value with which the target entry's attribute value to be compared withLdapException
- if some error occurredboolean compare(String dn, String attributeName, byte[] value) throws LdapException
dn
- the target entry's String DnattributeName
- the attribute's namevalue
- a byte[] value with which the target entry's attribute value to be compared withLdapException
- if some error occurredboolean compare(String dn, String attributeName, Value<?> value) throws LdapException
dn
- the target entry's String DnattributeName
- the attribute's namevalue
- a Value> value with which the target entry's attribute value to be compared withLdapException
- if some error occurredboolean compare(Dn dn, String attributeName, String value) throws LdapException
dn
- the target entry's DnattributeName
- the attribute's namevalue
- a String value with which the target entry's attribute value to be compared withLdapException
- if some error occurredboolean compare(Dn dn, String attributeName, byte[] value) throws LdapException
dn
- the target entry's DnattributeName
- the attribute's namevalue
- a byte[] value with which the target entry's attribute value to be compared withLdapException
- if some error occurredboolean compare(Dn dn, String attributeName, Value<?> value) throws LdapException
dn
- the target entry's DnattributeName
- the attribute's namevalue
- a Value> value with which the target entry's attribute value to be compared withLdapException
- if some error occurredCompareResponse compare(CompareRequest compareRequest) throws LdapException
compareRequest
- the CompareRequest which contains the target Dn, attribute name and valueLdapException
- if some error occurredExtendedResponse extended(String oid) throws LdapException
oid
- the object identifier of the extended operationLdapException
- if some error occurredextended(org.apache.directory.shared.asn1.util.Oid, byte[])
ExtendedResponse extended(String oid, byte[] value) throws LdapException
oid
- the object identifier of the extended operationvalue
- value to be used by the extended operation, can be a null valueLdapException
- if some error occurredextended(org.apache.directory.shared.asn1.util.Oid, byte[])
ExtendedResponse extended(Oid oid) throws LdapException
oid
- the object identifier of the extended operationLdapException
- if some error occurredextended(org.apache.directory.shared.asn1.util.Oid, byte[])
ExtendedResponse extended(Oid oid, byte[] value) throws LdapException
oid
- the object identifier of the extended operationvalue
- value to be used by the extended operation, can be a null valueLdapException
- if some error occurredExtendedResponse extended(ExtendedRequest extendedRequest) throws LdapException
extendedRequest
- the extended operation's requestLdapException
- If the Dn is not valid or if the extended operation failedboolean exists(String dn) throws LdapException
dn
- The Dn for the entry we want to check the existencetrue
if the entry exists, false
otherwise.
Note that if the entry exists but if the user does not have the permission to
read it, false
will also be returnedLdapException
- if some error occurredboolean exists(Dn dn) throws LdapException
dn
- The Dn for the entry we want to check the existencetrue
if the entry exists, false
otherwise.
Note that if the entry exists but if the user does not have the permission to
read it, false
will also be returnedLdapException
- if some error occurredEntry lookup(Dn dn) throws LdapException
dn
- the Dn of the entry to be fetchedLdapException
- in case of any problems while searching for the Dn or if the returned response contains a referrallookup(org.apache.directory.shared.ldap.model.name.Dn, String...)
Entry lookup(String dn) throws LdapException
dn
- the Dn of the entry to be fetchedLdapException
- in case of any problems while searching for the Dn or if the returned response contains a referrallookup(String, String...)
Entry lookup(Dn dn, String... attributes) throws LdapException
dn
- the Dn of the entry to be fetchedattributes
- the attributes to be returned along with entryLdapException
- in case of any problems while searching for the Dn or if the returned response contains a referralEntry lookup(Dn dn, Control[] controls, String... attributes) throws LdapException
dn
- the Dn of the entry to be fetchedcontrols
- the controls to useattributes
- the attributes to be returned along with entryLdapException
- in case of any problems while searching for the Dn or if the returned response contains a referralEntry lookup(String dn, String... attributes) throws LdapException
dn
- the Dn of the entry to be fetchedattributes
- the attributes to be returned along with entryLdapException
- in case of any problems while searching for the Dn or if the returned response contains a referrallookup(org.apache.directory.shared.ldap.model.name.Dn, String...)
Entry lookup(String dn, Control[] controls, String... attributes) throws LdapException
dn
- the Dn of the entry to be fetchedcontrols
- the controls to useattributes
- the attributes to be returned along with entryLdapException
- in case of any problems while searching for the Dn or if the returned response contains a referrallookup(org.apache.directory.shared.ldap.model.name.Dn, String...)
boolean isControlSupported(String controlOID) throws LdapException
controlOID
- the OID of the controlLdapException
- if some error occurredList<String> getSupportedControls() throws LdapException
LdapException
- if some error occurredvoid loadSchema() throws LdapException
LdapException
- in case of problems while loading the schemaSchemaManager getSchemaManager()
LdapApiService getCodecService()
boolean doesFutureExistFor(int messageId)
messageId
- ID of the requestCopyright © 2003-2014 The Apache Software Foundation. All Rights Reserved.