Class LdapConnectionTemplate
- java.lang.Object
-
- org.apache.directory.ldap.client.template.LdapConnectionTemplate
-
- All Implemented Interfaces:
LdapConnectionOperations,ModelFactory
public class LdapConnectionTemplate extends Object implements LdapConnectionOperations, ModelFactory
A facade for LDAP operations that handles all of the boiler plate code for you allowing more concise operations through the use of callbacks.- Author:
- Apache Directory Project
- See Also:
- Template method pattern
-
-
Constructor Summary
Constructors Constructor Description LdapConnectionTemplate(LdapConnectionPool connectionPool)Creates a new instance of LdapConnectionTemplate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AddResponseadd(AddRequest addRequest)Adds an entry specified by an AddRequest to the LDAP server.AddResponseadd(Dn dn, Attribute... attributes)Adds an entry specified by a Dn and an array of Attribute's to the LDAP server.AddResponseadd(Dn dn, RequestBuilder<AddRequest> requestBuilder)Adds an entry specified by a Dn, to be filled out by a RequestBuilder, to the LDAP server.PasswordWarningauthenticate(String baseDn, String filter, SearchScope scope, char[] password)Attempts to authenticate the supplied credentials against the first entry found matching the search criteria.PasswordWarningauthenticate(SearchRequest searchRequest, char[] password)Attempts to authenticate the supplied credentials against the first entry found matching the search criteria.PasswordWarningauthenticate(Dn userDn, char[] password)Attempts to authenticate the supplied credentials.PasswordWarningauthenticate(Dn baseDn, String filter, SearchScope scope, char[] password)Attempts to authenticate the supplied credentials against the first entry found matching the search criteria.DeleteResponsedelete(DeleteRequest deleteRequest)Deletes an entry specified by a DeleteRequest from the LDAP server.DeleteResponsedelete(Dn dn)Deletes an entry specified by Dn from the LDAP server.DeleteResponsedelete(Dn dn, RequestBuilder<DeleteRequest> requestBuilder)Deletes an entry specified by Dn, and whose request is configured by a RequestBuilder, from the LDAP server.<T> Texecute(ConnectionCallback<T> connectionCallback)Executes theconnectionCallback, supplying it a managed connection.<T> Tlookup(Dn dn, String[] attributes, EntryMapper<T> entryMapper)Performs a lookup, requestingattributes, and supplies the matching entry to theentryMapper.<T> Tlookup(Dn dn, EntryMapper<T> entryMapper)Performs a lookup, and supplies the matching entry to theentryMapper.ModifyResponsemodify(ModifyRequest modifyRequest)Modifies an entry specified by a ModifyRequest on the LDAP server.ModifyResponsemodify(Dn dn, RequestBuilder<ModifyRequest> requestBuilder)Modifies an entry specified by Dn, and whose request is configured by a RequestBuilder, on the LDAP server.voidmodifyPassword(Dn userDn, char[] newPassword)Modifies the password foruserDntonewPasswordusing the admin account.voidmodifyPassword(Dn userDn, char[] oldPassword, char[] newPassword)Modifies the password foruserDnfromoldPasswordtonewPassword.voidmodifyPassword(Dn userDn, char[] oldPassword, char[] newPassword, boolean asAdmin)Modifies the password foruserDnfromoldPasswordtonewPassword, optionally using an admin account.AddRequestnewAddRequest(Entry entry)Returns a newAddRequestfor theentry.AttributenewAttribute(String name)Returns a new Attribute for with the providednameand a null value.AttributenewAttribute(String name, byte[]... values)Returns a new Attribute for with the providednameandvalue(s).AttributenewAttribute(String name, String... values)Returns a new Attribute for with the providednameandvalue(s).AttributenewAttribute(String name, Value... values)Returns a new Attribute for with the providednameandvalue(s).DeleteRequestnewDeleteRequest(Dn dn)Returns a newDeleteRequestfor thedn.DnnewDn(String dn)Returns aDnthat representsdn.EntrynewEntry(String dn)Returns aEntrywith the specifieddn.EntrynewEntry(Dn dn)Returns aEntrywith the specifieddn.ModifyRequestnewModifyRequest(String dn)Returns a newModifyRequestfor thedn.ModifyRequestnewModifyRequest(Dn dn)Returns a newModifyRequestfor thedn.SearchRequestnewSearchRequest(String baseDn, String filter, SearchScope scope)Returns a newSearchRequestoverbaseDninscopematchingfilterreturning all normal attributes for each matching entry.SearchRequestnewSearchRequest(String baseDn, String filter, SearchScope scope, String... attributes)Returns a newSearchRequestoverbaseDninscopematchingfilterreturningattributesfor each matching entry.SearchRequestnewSearchRequest(String baseDn, FilterBuilder filter, SearchScope scope)Returns a newSearchRequestoverbaseDninscopematchingfilterreturning all normal attributes for each matching entry.SearchRequestnewSearchRequest(String baseDn, FilterBuilder filter, SearchScope scope, String... attributes)Returns a newSearchRequestoverbaseDninscopematchingfilterreturningattributesfor each matching entry.SearchRequestnewSearchRequest(Dn baseDn, String filter, SearchScope scope)Returns a newSearchRequestoverbaseDninscopematchingfilterreturning all normal attributes for each matching entry.SearchRequestnewSearchRequest(Dn baseDn, String filter, SearchScope scope, String... attributes)Returns a newSearchRequestoverbaseDninscopematchingfilterreturningattributesfor each matching entry.SearchRequestnewSearchRequest(Dn baseDn, FilterBuilder filter, SearchScope scope)Returns a newSearchRequestoverbaseDninscopematchingfilterreturning all normal attributes for each matching entry.SearchRequestnewSearchRequest(Dn baseDn, FilterBuilder filter, SearchScope scope, String... attributes)Returns a newSearchRequestoverbaseDninscopematchingfilterreturningattributesfor each matching entry.<T extends ResultResponse>
TresponseOrException(T response)Checks the supplied response for its result code, and if not ResultCodeEnum#SUCCESS, an exception is thrown.<T> List<T>search(String baseDn, String filter, SearchScope scope, String[] attributes, EntryMapper<T> entryMapper)Searches for the entries matching the supplied criteria, feeding the result into theentryMapper, querying only the requested attributes.<T> List<T>search(String baseDn, String filter, SearchScope scope, EntryMapper<T> entryMapper)Searches for the entries matching the supplied criteria, feeding the result into theentryMapper.<T> List<T>search(String baseDn, FilterBuilder filter, SearchScope scope, String[] attributes, EntryMapper<T> entryMapper)Searches for the entries matching the supplied criteria, feeding the result into theentryMapper, querying only the requested attributes.<T> List<T>search(String baseDn, FilterBuilder filter, SearchScope scope, EntryMapper<T> entryMapper)Searches for the entries matching the supplied criteria, feeding the result into theentryMapper.<T> List<T>search(SearchRequest searchRequest, EntryMapper<T> entryMapper)Searches for the entries matching the suppliedsearchRequest, feeding the result into theentryMapper.<T> List<T>search(Dn baseDn, String filter, SearchScope scope, String[] attributes, EntryMapper<T> entryMapper)Searches for the entries matching the supplied criteria, feeding the result into theentryMapper, querying only the requested attributes.<T> List<T>search(Dn baseDn, String filter, SearchScope scope, EntryMapper<T> entryMapper)Searches for the entries matching the supplied criteria, feeding the result into theentryMapper.<T> List<T>search(Dn baseDn, FilterBuilder filter, SearchScope scope, String[] attributes, EntryMapper<T> entryMapper)Searches for the entries matching the supplied criteria, feeding the result into theentryMapper, querying only the requested attributes.<T> List<T>search(Dn baseDn, FilterBuilder filter, SearchScope scope, EntryMapper<T> entryMapper)Searches for the entries matching the supplied criteria, feeding the result into theentryMapper.<T> TsearchFirst(String baseDn, String filter, SearchScope scope, String[] attributes, EntryMapper<T> entryMapper)Searches for the first entry matching the supplied criteria, feeding the result into theentryMapper, querying only the requested attributes.<T> TsearchFirst(String baseDn, String filter, SearchScope scope, EntryMapper<T> entryMapper)Searches for the first entry matching the supplied criteria, feeding the result into theentryMapper.<T> TsearchFirst(String baseDn, FilterBuilder filter, SearchScope scope, String[] attributes, EntryMapper<T> entryMapper)Searches for the first entry matching the supplied criteria, feeding the result into theentryMapper, querying only the requested attributes.<T> TsearchFirst(String baseDn, FilterBuilder filter, SearchScope scope, EntryMapper<T> entryMapper)Searches for the first entry matching the supplied criteria, feeding the result into theentryMapper.<T> TsearchFirst(SearchRequest searchRequest, EntryMapper<T> entryMapper)Searches for the first entry matching the suppliedsearchRequest, feeding the result into theentryMapper.<T> TsearchFirst(Dn baseDn, String filter, SearchScope scope, String[] attributes, EntryMapper<T> entryMapper)Searches for the first entry matching the supplied criteria, feeding the result into theentryMapper, querying only the requested attributes.<T> TsearchFirst(Dn baseDn, String filter, SearchScope scope, EntryMapper<T> entryMapper)Searches for the first entry matching the supplied criteria, feeding the result into theentryMapper.<T> TsearchFirst(Dn baseDn, FilterBuilder filter, SearchScope scope, String[] attributes, EntryMapper<T> entryMapper)Searches for the first entry matching the supplied criteria, feeding the result into theentryMapper, querying only the requested attributes.<T> TsearchFirst(Dn baseDn, FilterBuilder filter, SearchScope scope, EntryMapper<T> entryMapper)Searches for the first entry matching the supplied criteria, feeding the result into theentryMapper.voidsetModelFactory(ModelFactory modelFactory)Sets themodelFactoryimplementation for this facade.voidsetPasswordPolicyResponder(PasswordPolicyResponder passwordPolicyResponder)Sets thepasswordPolicyResponderimplementation for this facade.
-
-
-
Constructor Detail
-
LdapConnectionTemplate
public LdapConnectionTemplate(LdapConnectionPool connectionPool)
Creates a new instance of LdapConnectionTemplate.- Parameters:
connectionPool- The pool to obtain connections from.
-
-
Method Detail
-
add
public AddResponse add(Dn dn, Attribute... attributes)
Adds an entry specified by a Dn and an array of Attribute's to the LDAP server.- Specified by:
addin interfaceLdapConnectionOperations- Parameters:
dn- The distinguished name of the new entryattributes- The attributes of the new entry- Returns:
- An AddResponse
-
add
public AddResponse add(Dn dn, RequestBuilder<AddRequest> requestBuilder)
Adds an entry specified by a Dn, to be filled out by a RequestBuilder, to the LDAP server.- Specified by:
addin interfaceLdapConnectionOperations- Parameters:
dn- The distinguished name of the new entryrequestBuilder- The request builder- Returns:
- An AddResponse
-
add
public AddResponse add(AddRequest addRequest)
Adds an entry specified by an AddRequest to the LDAP server.- Specified by:
addin interfaceLdapConnectionOperations- Parameters:
addRequest- The request- Returns:
- An AddResponse
-
authenticate
public PasswordWarning authenticate(String baseDn, String filter, SearchScope scope, char[] password) throws PasswordException
Attempts to authenticate the supplied credentials against the first entry found matching the search criteria. If authentication fails, a PasswordException is thrown. If successful, the response is checked for warnings, and if present, a PasswordWarning is returned. Otherwise, null is returned.- Specified by:
authenticatein interfaceLdapConnectionOperations- Parameters:
baseDn- The base DN from which to start the search for the user to authenticatefilter- The filter selecting the entriesscope- The scope to look frompassword- The password- Returns:
- A PasswordWarning or null
- Throws:
PasswordException- If the authentication failed- See Also:
LdapConnectionOperations.authenticate(Dn, char[]),LdapConnectionOperations.searchFirst(String, String, SearchScope, EntryMapper)
-
authenticate
public PasswordWarning authenticate(Dn baseDn, String filter, SearchScope scope, char[] password) throws PasswordException
Attempts to authenticate the supplied credentials against the first entry found matching the search criteria. If authentication fails, a PasswordException is thrown. If successful, the response is checked for warnings, and if present, a PasswordWarning is returned. Otherwise, null is returned.- Specified by:
authenticatein interfaceLdapConnectionOperations- Parameters:
baseDn- The base DN from which to start the search for the user to authenticatefilter- The filter selecting the entriesscope- The scope to look frompassword- The password- Returns:
- A PasswordWarning or null
- Throws:
PasswordException- If the authentication failed- See Also:
LdapConnectionOperations.authenticate(Dn, char[]),LdapConnectionOperations.searchFirst(Dn, String, SearchScope, EntryMapper)
-
authenticate
public PasswordWarning authenticate(SearchRequest searchRequest, char[] password) throws PasswordException
Attempts to authenticate the supplied credentials against the first entry found matching the search criteria. If authentication fails, a PasswordException is thrown. If successful, the response is checked for warnings, and if present, a PasswordWarning is returned. Otherwise, null is returned.- Specified by:
authenticatein interfaceLdapConnectionOperations- Parameters:
searchRequest- The SearchRequst to use to find the user to authenticatepassword- The password- Returns:
- A PasswordWarning or null
- Throws:
PasswordException- If the authentication failed- See Also:
LdapConnectionOperations.authenticate(Dn, char[]),LdapConnectionOperations.searchFirst(SearchRequest, EntryMapper)
-
authenticate
public PasswordWarning authenticate(Dn userDn, char[] password) throws PasswordException
Attempts to authenticate the supplied credentials. If authentication fails, a PasswordException is thrown. If successful, the response is checked for warnings, and if present, a PasswordWarning is returned. Otherwise, null is returned.- Specified by:
authenticatein interfaceLdapConnectionOperations- Parameters:
userDn- The distinguished name of the userpassword- The password- Returns:
- A PasswordWarning or null
- Throws:
PasswordException- If authentication fails
-
delete
public DeleteResponse delete(Dn dn)
Deletes an entry specified by Dn from the LDAP server.- Specified by:
deletein interfaceLdapConnectionOperations- Parameters:
dn- The distinguished name of the entry- Returns:
- A DeleteResponse
-
delete
public DeleteResponse delete(Dn dn, RequestBuilder<DeleteRequest> requestBuilder)
Deletes an entry specified by Dn, and whose request is configured by a RequestBuilder, from the LDAP server.- Specified by:
deletein interfaceLdapConnectionOperations- Parameters:
dn- The distinguished name of the entryrequestBuilder- The RequestBuilder- Returns:
- A DeleteResponse
-
delete
public DeleteResponse delete(DeleteRequest deleteRequest)
Deletes an entry specified by a DeleteRequest from the LDAP server.- Specified by:
deletein interfaceLdapConnectionOperations- Parameters:
deleteRequest- The request- Returns:
- A DeleteResponse
-
execute
public <T> T execute(ConnectionCallback<T> connectionCallback)
Executes theconnectionCallback, supplying it a managed connection.- Specified by:
executein interfaceLdapConnectionOperations- Type Parameters:
T- The type of the mapped entry- Parameters:
connectionCallback- The callback- Returns:
- Whatever the callback returns
-
lookup
public <T> T lookup(Dn dn, EntryMapper<T> entryMapper)
Performs a lookup, and supplies the matching entry to theentryMapper.- Specified by:
lookupin interfaceLdapConnectionOperations- Type Parameters:
T- The type of the mapped entry- Parameters:
dn- The distinguished name of the entryentryMapper- The mapper from entry to model object- Returns:
- Whatever the
entryMapperreturns
-
lookup
public <T> T lookup(Dn dn, String[] attributes, EntryMapper<T> entryMapper)
Performs a lookup, requestingattributes, and supplies the matching entry to theentryMapper.- Specified by:
lookupin interfaceLdapConnectionOperations- Type Parameters:
T- The type of the mapped entry- Parameters:
dn- The distinguished name of the entryattributes- The attributes to be fetchedentryMapper- The mapper from entry to model object- Returns:
- Whatever the
entryMapperreturns
-
modifyPassword
public void modifyPassword(Dn userDn, char[] newPassword) throws PasswordException
Modifies the password foruserDntonewPasswordusing the admin account.- Specified by:
modifyPasswordin interfaceLdapConnectionOperations- Parameters:
userDn- The DN of the entry we want to modify the pwassword fornewPassword- The new password- Throws:
PasswordException- If the password change failed- See Also:
LdapConnectionOperations.modifyPassword(Dn, char[], char[], boolean)
-
modifyPassword
public void modifyPassword(Dn userDn, char[] oldPassword, char[] newPassword) throws PasswordException
Modifies the password foruserDnfromoldPasswordtonewPassword.- Specified by:
modifyPasswordin interfaceLdapConnectionOperations- Parameters:
userDn- The DN of the entry we want to modify the pwassword foroldPassword- The old passwordnewPassword- The new password- Throws:
PasswordException- If the password change failed- See Also:
LdapConnectionOperations.modifyPassword(Dn, char[], char[], boolean)
-
modifyPassword
public void modifyPassword(Dn userDn, char[] oldPassword, char[] newPassword, boolean asAdmin) throws PasswordException
Modifies the password foruserDnfromoldPasswordtonewPassword, optionally using an admin account. IfasAdminis true, then the operation is performed in admin context which meansoldPasswordis may benull.- Specified by:
modifyPasswordin interfaceLdapConnectionOperations- Parameters:
userDn- The distinguished name of the useroldPassword- The users old password (optional if asAdmin is true)newPassword- The users new passwordasAdmin- If true, execute in admin context- Throws:
PasswordException- If the password modification fails
-
modify
public ModifyResponse modify(Dn dn, RequestBuilder<ModifyRequest> requestBuilder)
Modifies an entry specified by Dn, and whose request is configured by a RequestBuilder, on the LDAP server.- Specified by:
modifyin interfaceLdapConnectionOperations- Parameters:
dn- The distinguished name of the entryrequestBuilder- The RequestBuilder- Returns:
- A ModifyResponse
-
modify
public ModifyResponse modify(ModifyRequest modifyRequest)
Modifies an entry specified by a ModifyRequest on the LDAP server.- Specified by:
modifyin interfaceLdapConnectionOperations- Parameters:
modifyRequest- The request- Returns:
- A ModifyResponse
-
newAddRequest
public AddRequest newAddRequest(Entry entry)
Returns a newAddRequestfor theentry.- Specified by:
newAddRequestin interfaceModelFactory- Parameters:
entry- The Entry to add- Returns:
- The resulting AddRequest
-
newAttribute
public Attribute newAttribute(String name)
Returns a new Attribute for with the providednameand a null value. This is useful for clearing out an Attribute with a ModifyRequest, replace function.- Specified by:
newAttributein interfaceModelFactory- Parameters:
name- The attribute's name- Returns:
- The resulting Attribute
-
newAttribute
public Attribute newAttribute(String name, byte[]... values)
Returns a new Attribute for with the providednameandvalue(s).- Specified by:
newAttributein interfaceModelFactory- Parameters:
name- The attribute's namevalues- The attribute's values- Returns:
- The resulting Attribute
-
newAttribute
public Attribute newAttribute(String name, String... values)
Returns a new Attribute for with the providednameandvalue(s).- Specified by:
newAttributein interfaceModelFactory- Parameters:
name- The attribute's namevalues- The attribute's values- Returns:
- The resulting Attribute
-
newAttribute
public Attribute newAttribute(String name, Value... values)
Returns a new Attribute for with the providednameandvalue(s).- Specified by:
newAttributein interfaceModelFactory- Parameters:
name- The attribute's namevalues- The attribute's values- Returns:
- The resulting Attribute
-
newDeleteRequest
public DeleteRequest newDeleteRequest(Dn dn)
Returns a newDeleteRequestfor thedn.- Specified by:
newDeleteRequestin interfaceModelFactory- Parameters:
dn- The Dn for the Entry to delete- Returns:
- The resulting DeleteRequest
-
newDn
public Dn newDn(String dn)
Returns aDnthat representsdn.- Specified by:
newDnin interfaceModelFactory- Parameters:
dn- The Entry's Dn- Returns:
- The resulting Dn
-
newEntry
public Entry newEntry(String dn)
Returns aEntrywith the specifieddn.- Specified by:
newEntryin interfaceModelFactory- Parameters:
dn- The Entry's Dn- Returns:
- The resulting Entry
-
newEntry
public Entry newEntry(Dn dn)
Returns aEntrywith the specifieddn.- Specified by:
newEntryin interfaceModelFactory- Parameters:
dn- The Entry's Dn- Returns:
- The resulting Entry
-
newModifyRequest
public ModifyRequest newModifyRequest(String dn)
Returns a newModifyRequestfor thedn.- Specified by:
newModifyRequestin interfaceModelFactory- Parameters:
dn- The Dn of the entry to modify- Returns:
- The resulting ModifyRequest
-
newModifyRequest
public ModifyRequest newModifyRequest(Dn dn)
Returns a newModifyRequestfor thedn.- Specified by:
newModifyRequestin interfaceModelFactory- Parameters:
dn- The DN of the entry to modify- Returns:
- The resulting ModifyRequest
-
newSearchRequest
public SearchRequest newSearchRequest(String baseDn, FilterBuilder filter, SearchScope scope)
Returns a newSearchRequestoverbaseDninscopematchingfilterreturning all normal attributes for each matching entry.- Specified by:
newSearchRequestin interfaceModelFactory- Parameters:
baseDn- The base DN from which to start the searchfilter- The filter selecting the entriesscope- The scope to look from- Returns:
- The resulting SearchRequest
-
newSearchRequest
public SearchRequest newSearchRequest(String baseDn, String filter, SearchScope scope)
Returns a newSearchRequestoverbaseDninscopematchingfilterreturning all normal attributes for each matching entry.- Specified by:
newSearchRequestin interfaceModelFactory- Parameters:
baseDn- The base DN from which to start the searchfilter- The filter selecting the entriesscope- The scope to look from- Returns:
- The resulting SearchRequest
-
newSearchRequest
public SearchRequest newSearchRequest(Dn baseDn, FilterBuilder filter, SearchScope scope)
Returns a newSearchRequestoverbaseDninscopematchingfilterreturning all normal attributes for each matching entry.- Specified by:
newSearchRequestin interfaceModelFactory- Parameters:
baseDn- The base DN from which to start the searchfilter- The filter selecting the entriesscope- The scope to look from- Returns:
- The resulting SearchRequest
-
newSearchRequest
public SearchRequest newSearchRequest(Dn baseDn, String filter, SearchScope scope)
Returns a newSearchRequestoverbaseDninscopematchingfilterreturning all normal attributes for each matching entry.- Specified by:
newSearchRequestin interfaceModelFactory- Parameters:
baseDn- The base DN from which to start the searchfilter- The filter selecting the entriesscope- The scope to look from- Returns:
- The resulting SearchRequest
-
newSearchRequest
public SearchRequest newSearchRequest(String baseDn, FilterBuilder filter, SearchScope scope, String... attributes)
Returns a newSearchRequestoverbaseDninscopematchingfilterreturningattributesfor each matching entry.- Specified by:
newSearchRequestin interfaceModelFactory- Parameters:
baseDn- The base DN from which to start the searchfilter- The filter selecting the entriesscope- The scope to look fromattributes- The list of AttributeType to return- Returns:
- The resulting SearchRequest
-
newSearchRequest
public SearchRequest newSearchRequest(String baseDn, String filter, SearchScope scope, String... attributes)
Returns a newSearchRequestoverbaseDninscopematchingfilterreturningattributesfor each matching entry.- Specified by:
newSearchRequestin interfaceModelFactory- Parameters:
baseDn- The base DN from which to start the searchfilter- The filter selecting the entriesscope- The scope to look fromattributes- The list of AttributeType to return- Returns:
- The resulting SearchRequest
-
newSearchRequest
public SearchRequest newSearchRequest(Dn baseDn, FilterBuilder filter, SearchScope scope, String... attributes)
Returns a newSearchRequestoverbaseDninscopematchingfilterreturningattributesfor each matching entry.- Specified by:
newSearchRequestin interfaceModelFactory- Parameters:
baseDn- The base DN from which to start the searchfilter- The filter selecting the entriesscope- The scope to look fromattributes- The list of AttributeType to return- Returns:
- The resulting SearchRequest
-
newSearchRequest
public SearchRequest newSearchRequest(Dn baseDn, String filter, SearchScope scope, String... attributes)
Returns a newSearchRequestoverbaseDninscopematchingfilterreturningattributesfor each matching entry.- Specified by:
newSearchRequestin interfaceModelFactory- Parameters:
baseDn- The base DN from which to start the searchfilter- The filter selecting the entriesscope- The scope to look fromattributes- The list of AttributeType to return- Returns:
- The resulting SearchRequest
-
responseOrException
public <T extends ResultResponse> T responseOrException(T response)
Checks the supplied response for its result code, and if not ResultCodeEnum#SUCCESS, an exception is thrown. This method is intended to be used inline:template.responseOrException( template.delete( dn ) );
- Specified by:
responseOrExceptionin interfaceLdapConnectionOperations- Type Parameters:
T- The type of response- Parameters:
response- The response to check for success- Returns:
- The supplied
response
-
search
public <T> List<T> search(String baseDn, FilterBuilder filter, SearchScope scope, EntryMapper<T> entryMapper)
Searches for the entries matching the supplied criteria, feeding the result into theentryMapper.- Specified by:
searchin interfaceLdapConnectionOperations- Type Parameters:
T- The type of the mapped entry- Parameters:
baseDn- The base DN from which to start the searchfilter- The filter selecting the entriesscope- The scope to look fromentryMapper- The mapper- Returns:
- The mapped entries
- See Also:
LdapConnectionOperations.search(SearchRequest, EntryMapper)
-
search
public <T> List<T> search(String baseDn, String filter, SearchScope scope, EntryMapper<T> entryMapper)
Searches for the entries matching the supplied criteria, feeding the result into theentryMapper.- Specified by:
searchin interfaceLdapConnectionOperations- Type Parameters:
T- The type of the mapped entry- Parameters:
baseDn- The base DN from which to start the searchfilter- The filter selecting the entriesscope- The scope to look fromentryMapper- The mapper- Returns:
- The mapped entries
- See Also:
LdapConnectionOperations.search(SearchRequest, EntryMapper)
-
search
public <T> List<T> search(Dn baseDn, FilterBuilder filter, SearchScope scope, EntryMapper<T> entryMapper)
Searches for the entries matching the supplied criteria, feeding the result into theentryMapper.- Specified by:
searchin interfaceLdapConnectionOperations- Type Parameters:
T- The type of the mapped entry- Parameters:
baseDn- The base DN from which to start the searchfilter- The filter selecting the entriesscope- The scope to look fromentryMapper- The mapper- Returns:
- The mapped entries
- See Also:
LdapConnectionOperations.search(SearchRequest, EntryMapper)
-
search
public <T> List<T> search(Dn baseDn, String filter, SearchScope scope, EntryMapper<T> entryMapper)
Searches for the entries matching the supplied criteria, feeding the result into theentryMapper.- Specified by:
searchin interfaceLdapConnectionOperations- Type Parameters:
T- The type of the mapped entry- Parameters:
baseDn- The base DN from which to start the searchfilter- The filter selecting the entriesscope- The scope to look fromentryMapper- The mapper- Returns:
- The mapped entries
- See Also:
LdapConnectionOperations.search(SearchRequest, EntryMapper)
-
search
public <T> List<T> search(String baseDn, FilterBuilder filter, SearchScope scope, String[] attributes, EntryMapper<T> entryMapper)
Searches for the entries matching the supplied criteria, feeding the result into theentryMapper, querying only the requested attributes.- Specified by:
searchin interfaceLdapConnectionOperations- Type Parameters:
T- The type of the mapped entry- Parameters:
baseDn- The base DN from which to start the searchfilter- The filter selecting the entriesscope- The scope to look fromattributes- The list of AttributeType to returnentryMapper- The mapper- Returns:
- The mapped entries
- See Also:
LdapConnectionOperations.search(SearchRequest, EntryMapper)
-
search
public <T> List<T> search(String baseDn, String filter, SearchScope scope, String[] attributes, EntryMapper<T> entryMapper)
Searches for the entries matching the supplied criteria, feeding the result into theentryMapper, querying only the requested attributes.- Specified by:
searchin interfaceLdapConnectionOperations- Type Parameters:
T- The type of the mapped entry- Parameters:
baseDn- The base DN from which to start the searchfilter- The filter selecting the entriesscope- The scope to look fromattributes- The list of AttributeType to returnentryMapper- The mapper- Returns:
- The mapped entries
- See Also:
LdapConnectionOperations.search(SearchRequest, EntryMapper)
-
search
public <T> List<T> search(Dn baseDn, FilterBuilder filter, SearchScope scope, String[] attributes, EntryMapper<T> entryMapper)
Searches for the entries matching the supplied criteria, feeding the result into theentryMapper, querying only the requested attributes.- Specified by:
searchin interfaceLdapConnectionOperations- Type Parameters:
T- The type of the mapped entry- Parameters:
baseDn- The base DN from which to start the searchfilter- The filter selecting the entriesscope- The scope to look fromattributes- The list of AttributeType to returnentryMapper- The mapper- Returns:
- The mapped entries
- See Also:
LdapConnectionOperations.search(SearchRequest, EntryMapper)
-
search
public <T> List<T> search(Dn baseDn, String filter, SearchScope scope, String[] attributes, EntryMapper<T> entryMapper)
Searches for the entries matching the supplied criteria, feeding the result into theentryMapper, querying only the requested attributes.- Specified by:
searchin interfaceLdapConnectionOperations- Type Parameters:
T- The type of the mapped entry- Parameters:
baseDn- The base DN from which to start the searchfilter- The filter selecting the entriesscope- The scope to look fromattributes- The list of AttributeType to returnentryMapper- The mapper- Returns:
- The mapped entries
- See Also:
LdapConnectionOperations.search(SearchRequest, EntryMapper)
-
search
public <T> List<T> search(SearchRequest searchRequest, EntryMapper<T> entryMapper)
Searches for the entries matching the suppliedsearchRequest, feeding the result into theentryMapper.- Specified by:
searchin interfaceLdapConnectionOperations- Type Parameters:
T- The type of the mapped entry- Parameters:
searchRequest- The search requestentryMapper- The mapper- Returns:
- The mapped entries
-
searchFirst
public <T> T searchFirst(String baseDn, FilterBuilder filter, SearchScope scope, EntryMapper<T> entryMapper)
Searches for the first entry matching the supplied criteria, feeding the result into theentryMapper.- Specified by:
searchFirstin interfaceLdapConnectionOperations- Type Parameters:
T- The type of the mapped entry- Parameters:
baseDn- The base DN from which to start the searchfilter- The filter selecting the entriesscope- The scope to look fromentryMapper- The mapper- Returns:
- The mapped entries
- See Also:
LdapConnectionOperations.searchFirst(SearchRequest, EntryMapper)
-
searchFirst
public <T> T searchFirst(String baseDn, String filter, SearchScope scope, EntryMapper<T> entryMapper)
Searches for the first entry matching the supplied criteria, feeding the result into theentryMapper.- Specified by:
searchFirstin interfaceLdapConnectionOperations- Type Parameters:
T- The type of the mapped entry- Parameters:
baseDn- The base DN from which to start the searchfilter- The filter selecting the entriesscope- The scope to look fromentryMapper- The mapper- Returns:
- The mapped entries
- See Also:
LdapConnectionOperations.searchFirst(SearchRequest, EntryMapper)
-
searchFirst
public <T> T searchFirst(Dn baseDn, FilterBuilder filter, SearchScope scope, EntryMapper<T> entryMapper)
Searches for the first entry matching the supplied criteria, feeding the result into theentryMapper.- Specified by:
searchFirstin interfaceLdapConnectionOperations- Type Parameters:
T- The type of the mapped entry- Parameters:
baseDn- The base DN from which to start the searchfilter- The filter selecting the entriesscope- The scope to look fromentryMapper- The mapper- Returns:
- The mapped entries
- See Also:
LdapConnectionOperations.searchFirst(SearchRequest, EntryMapper)
-
searchFirst
public <T> T searchFirst(Dn baseDn, String filter, SearchScope scope, EntryMapper<T> entryMapper)
Searches for the first entry matching the supplied criteria, feeding the result into theentryMapper.- Specified by:
searchFirstin interfaceLdapConnectionOperations- Type Parameters:
T- The type of the mapped entry- Parameters:
baseDn- The base DN from which to start the searchfilter- The filter selecting the entriesscope- The scope to look fromentryMapper- The mapper- Returns:
- The mapped entries
- See Also:
LdapConnectionOperations.searchFirst(SearchRequest, EntryMapper)
-
searchFirst
public <T> T searchFirst(String baseDn, FilterBuilder filter, SearchScope scope, String[] attributes, EntryMapper<T> entryMapper)
Searches for the first entry matching the supplied criteria, feeding the result into theentryMapper, querying only the requested attributes.- Specified by:
searchFirstin interfaceLdapConnectionOperations- Type Parameters:
T- The type of the mapped entry- Parameters:
baseDn- The base DN from which to start the searchfilter- The filter selecting the entriesscope- The scope to look fromattributes- The list of AttributeType to returnentryMapper- The mapper- Returns:
- The mapped entries
- See Also:
LdapConnectionOperations.searchFirst(SearchRequest, EntryMapper)
-
searchFirst
public <T> T searchFirst(String baseDn, String filter, SearchScope scope, String[] attributes, EntryMapper<T> entryMapper)
Searches for the first entry matching the supplied criteria, feeding the result into theentryMapper, querying only the requested attributes.- Specified by:
searchFirstin interfaceLdapConnectionOperations- Type Parameters:
T- The type of the mapped entry- Parameters:
baseDn- The base DN from which to start the searchfilter- The filter selecting the entriesscope- The scope to look fromattributes- The list of AttributeType to returnentryMapper- The mapper- Returns:
- The mapped entries
- See Also:
LdapConnectionOperations.searchFirst(SearchRequest, EntryMapper)
-
searchFirst
public <T> T searchFirst(Dn baseDn, FilterBuilder filter, SearchScope scope, String[] attributes, EntryMapper<T> entryMapper)
Searches for the first entry matching the supplied criteria, feeding the result into theentryMapper, querying only the requested attributes.- Specified by:
searchFirstin interfaceLdapConnectionOperations- Type Parameters:
T- The type of the mapped entry- Parameters:
baseDn- The base DN from which to start the searchfilter- The filter selecting the entriesscope- The scope to look fromattributes- The list of AttributeType to returnentryMapper- The mapper- Returns:
- The mapped entries
- See Also:
LdapConnectionOperations.searchFirst(SearchRequest, EntryMapper)
-
searchFirst
public <T> T searchFirst(Dn baseDn, String filter, SearchScope scope, String[] attributes, EntryMapper<T> entryMapper)
Searches for the first entry matching the supplied criteria, feeding the result into theentryMapper, querying only the requested attributes.- Specified by:
searchFirstin interfaceLdapConnectionOperations- Type Parameters:
T- The type of the mapped entry- Parameters:
baseDn- The base DN from which to start the searchfilter- The filter selecting the entriesscope- The scope to look fromattributes- The list of AttributeType to returnentryMapper- The mapper- Returns:
- The mapped entries
- See Also:
LdapConnectionOperations.searchFirst(SearchRequest, EntryMapper)
-
searchFirst
public <T> T searchFirst(SearchRequest searchRequest, EntryMapper<T> entryMapper)
Searches for the first entry matching the suppliedsearchRequest, feeding the result into theentryMapper. This is basically the same asLdapConnectionOperations.search(SearchRequest, EntryMapper), but is optimized by modifying thesearchRequestto set its size limit to 1. ThesearchRequestis returned to its original size limit before this method returns (or throws an exception).- Specified by:
searchFirstin interfaceLdapConnectionOperations- Type Parameters:
T- The type of the mapped entry- Parameters:
searchRequest- The search requestentryMapper- The mapper- Returns:
- The mapped entry
-
setModelFactory
public void setModelFactory(ModelFactory modelFactory)
Sets themodelFactoryimplementation for this facade.- Parameters:
modelFactory- The model factory implementation
-
setPasswordPolicyResponder
public void setPasswordPolicyResponder(PasswordPolicyResponder passwordPolicyResponder)
Sets thepasswordPolicyResponderimplementation for this facade.- Parameters:
passwordPolicyResponder- The password policy responder implementation
-
-