Package org.ldaptive.beans.persistence
Class DefaultLdapEntryManager<T>
java.lang.Object
org.ldaptive.beans.persistence.DefaultLdapEntryManager<T>
- Type Parameters:
T
- type of object to manage
- All Implemented Interfaces:
LdapEntryManager<T>
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 final ConnectionFactory
Connection factory for LDAP communication.private final LdapEntryMapper
<T> Mapper for converting ldap entry to object type.protected final org.slf4j.Logger
Logger for this class.private final String[]
Additional attributes to include in searches. -
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 it's ldap attribute properties set.Returns the connection factory.Returns the ldap entry mapper.String[]
Returns the return attributes.Merges the supplied annotated object in an LDAP.merge
(T object, ResultPredicate predicate) Merges the supplied annotated object in an LDAP.
-
Field Details
-
logger
protected final org.slf4j.Logger loggerLogger 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.
-
-
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.
-
find
Description copied from interface:LdapEntryManager
Searches for the supplied annotated object in an LDAP and returns the object mapped with it's ldap attribute properties set.- Specified by:
find
in interfaceLdapEntryManager<T>
- Parameters:
object
- to find- Returns:
- mapped object
- Throws:
LdapException
- if the object cannot be found
-
add
Description copied from interface:LdapEntryManager
Adds the supplied annotated object to an LDAP.- Specified by:
add
in 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:LdapEntryManager
Merges the supplied annotated object in an LDAP. SeeMergeOperation
.- Specified by:
merge
in 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:LdapEntryManager
Deletes the supplied annotated object from an LDAP.- Specified by:
delete
in 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
-