Package org.ldaptive.beans.persistence
Class DefaultLdapEntryManager<T>
java.lang.Object
org.ldaptive.AbstractFreezable
org.ldaptive.beans.persistence.DefaultLdapEntryManager<T>
- Type Parameters:
T- type of object to manage
- All Implemented Interfaces:
LdapEntryManager<T>,Freezable
Default implementation of an ldap entry manager. Uses an
LdapEntryMapper to convert objects to entries, then
invokes LDAP operations with those objects. By default, all attributes are requested using both the '*' and '+'
syntaxes. For attributes that must be requested by name, use DefaultLdapEntryManager(LdapEntryMapper, ConnectionFactory, String[]).-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AddOperationAdd operation used to add a new entry.private final ConnectionFactoryConnection factory for LDAP communication.private DeleteOperationDelete operation used to remove an entry.private final LdapEntryMapper<T>Mapper for converting ldap entry to object type.protected final LoggerLogger for this class.private MergeOperationMerge operation used to merge an entry.private final String[]Additional attributes to include in searches.private SearchOperationSearch operation used to find an entry. -
Constructor Summary
ConstructorsConstructorDescriptionDefaultLdapEntryManager(LdapEntryMapper<T> mapper, ConnectionFactory factory) Creates a new default ldap entry manager.DefaultLdapEntryManager(LdapEntryMapper<T> mapper, ConnectionFactory factory, String[] attrs) Creates a new default ldap entry manager. -
Method Summary
Modifier and TypeMethodDescriptionAdds the supplied annotated object to an LDAP.add(T object, ResultPredicate predicate) Adds the supplied annotated object to an LDAP.Deletes the supplied annotated object from an LDAP.delete(T object, ResultPredicate predicate) Deletes the supplied annotated object from an LDAP.Searches for the supplied annotated object in an LDAP and returns the object mapped with its ldap attribute properties set.Returns the add operation.Returns the connection factory.Returns the delete operation.Returns the ldap entry mapper.Returns the merge operation.String[]Returns the return attributes.Returns the search operation.Merges the supplied annotated object in an LDAP.merge(T object, ResultPredicate predicate) Merges the supplied annotated object in an LDAP.voidsetAddOperation(AddOperation operation) Sets the add operation.voidsetDeleteOperation(DeleteOperation operation) Sets the delete operation.voidsetMergeOperation(MergeOperation operation) Sets the merge operation.voidsetSearchOperation(SearchOperation operation) Sets the search operation.Methods inherited from class org.ldaptive.AbstractFreezable
assertMutable, freeze, freeze, freeze, isFrozen
-
Field Details
-
logger
Logger for this class. -
ldapEntryMapper
Mapper for converting ldap entry to object type. -
connectionFactory
Connection factory for LDAP communication. -
returnAttributes
Additional attributes to include in searches. -
searchOperation
Search operation used to find an entry. -
addOperation
Add operation used to add a new entry. -
mergeOperation
Merge operation used to merge an entry. -
deleteOperation
Delete operation used to remove an entry.
-
-
Constructor Details
-
DefaultLdapEntryManager
Creates a new default ldap entry manager.- Parameters:
mapper- for object conversionfactory- for LDAP communication
-
DefaultLdapEntryManager
public DefaultLdapEntryManager(LdapEntryMapper<T> mapper, ConnectionFactory factory, String[] attrs) Creates a new default ldap entry manager. Use of attrs is for cases where a directory does not support either the '*' or '+' syntaxes for returning all attributes of a given type.- Parameters:
mapper- for object conversionfactory- for LDAP communicationattrs- additional return attributes
-
-
Method Details
-
getLdapEntryMapper
Returns the ldap entry mapper.- Returns:
- ldap entry mapper
-
getConnectionFactory
Returns the connection factory.- Returns:
- connection factory
-
getReturnAttributes
Returns the return attributes.- Returns:
- additional attributes to include in searches.
-
getSearchOperation
Returns the search operation.- Returns:
- search operation
-
setSearchOperation
Sets the search operation.- Parameters:
operation- search operation
-
getAddOperation
Returns the add operation.- Returns:
- add operation
-
setAddOperation
Sets the add operation.- Parameters:
operation- add operation
-
getMergeOperation
Returns the merge operation.- Returns:
- merge operation
-
setMergeOperation
Sets the merge operation.- Parameters:
operation- merge operation
-
getDeleteOperation
Returns the delete operation.- Returns:
- delete operation
-
setDeleteOperation
Sets the delete operation.- Parameters:
operation- delete operation
-
find
Description copied from interface:LdapEntryManagerSearches for the supplied annotated object in an LDAP and returns the object mapped with its ldap attribute properties set.- Specified by:
findin interfaceLdapEntryManager<T>- Parameters:
object- to find- Returns:
- mapped object
- Throws:
LdapException- if the object cannot be found
-
add
Description copied from interface:LdapEntryManagerAdds the supplied annotated object to an LDAP.- Specified by:
addin interfaceLdapEntryManager<T>- Parameters:
object- to add- Returns:
- LDAP response from the add operation
- Throws:
LdapException- if the add fails
-
add
Adds the supplied annotated object to an LDAP.- Parameters:
object- to addpredicate- to test the result and throw on failure- Returns:
- LDAP response from the add operation
- Throws:
LdapException- if the add fails
-
merge
Description copied from interface:LdapEntryManagerMerges the supplied annotated object in an LDAP. SeeMergeOperation.- Specified by:
mergein interfaceLdapEntryManager<T>- Parameters:
object- to merge- Returns:
- LDAP response from the merge operation
- Throws:
LdapException- if the merge fails
-
merge
Merges the supplied annotated object in an LDAP. SeeMergeOperation.- Parameters:
object- to mergepredicate- to test the result and throw on failure- Returns:
- LDAP response from the merge operation
- Throws:
LdapException- if the merge fails
-
delete
Description copied from interface:LdapEntryManagerDeletes the supplied annotated object from an LDAP.- Specified by:
deletein interfaceLdapEntryManager<T>- Parameters:
object- to delete- Returns:
- LDAP response from the delete operation
- Throws:
LdapException- if the delete fails
-
delete
Deletes the supplied annotated object from an LDAP.- Parameters:
object- to deletepredicate- to test the result and throw on failure- Returns:
- LDAP response from the delete operation
- Throws:
LdapException- if the delete fails
-