toolbox.ldap
Interface LDAPWorker

Package class diagram package LDAPWorker
All Known Implementing Classes:
LDAPWorkerImpl

public interface LDAPWorker

Defines an interface for developing LDAP access workers.

Implementations of this interface will provide functionality to interact with LDAP directories.


Method Summary
 java.lang.String add(java.lang.String entry, java.lang.String context, java.util.Map attrs)
          Add an entry to the LDAP directory.
 java.lang.String getContextValue(java.lang.String mapping)
          Return context value for the given context mapping.
 EntryDefinition getEntryDefinition(java.lang.String mapping)
          Return EntryDefinition for the given entry mapping.
 java.lang.String getRootContext()
          Return the root context of this worker.
 void init(java.util.Map entries, java.util.Map contexts, LDAPManager mngr)
          Initialise this worker with the supported Map of LDAP entry definitions and contexts.
 java.util.Map lookup(java.lang.String entry, java.lang.String context, java.lang.String bindName, java.lang.String[] attrs)
          Return a single entry from the LDAP directory.
 void modify(java.lang.String entry, java.lang.String context, java.lang.String bindName, int modType, java.util.Map attrs)
          Modify the attributes of the entry with given bind attribute value.
 void remove(java.lang.String entry, java.lang.String context, java.lang.String bindName)
          Remove an entry from the LDAP directory.
 java.util.List search(java.lang.String entry, java.lang.String filter, java.lang.String context, int scope, java.lang.String[] attrs)
          Search for entries in the LDAP directory.
 java.util.List search(java.lang.String entry, java.lang.String filter, java.lang.String context, int scope, java.lang.String[] attrs, java.lang.String sortAttr, java.lang.String sortOrder)
          Search for entries in the LDAP directory and sort the results as specified.
 void update(java.lang.String entry, java.lang.String context, java.util.Map attrs)
          Update an existing entry in the LDAP directory.
 

Method Detail

init

void init(java.util.Map entries,
          java.util.Map contexts,
          LDAPManager mngr)
Initialise this worker with the supported Map of LDAP entry definitions and contexts.

Parameters:
entries - Map instance containing the supported LDAP entry definitions.
contexts - Map containing the supported context's.
mngr - LDAPManager instance that created this worker.

add

java.lang.String add(java.lang.String entry,
                     java.lang.String context,
                     java.util.Map attrs)
                     throws LDAPException
Add an entry to the LDAP directory.

Parameters:
entry - String indicating the configured entry type.
context - String indicating the configured context where the the attributes should be added to the directory.
attrs - Map containing attributes. The keys will be used as attributes names. Multi-valued attributes must contain a Set instance with the attribute values.
Returns:
String containing the dn of the added entry.
Throws:
LDAPException - if the attributes cannot be added to the directory.

update

void update(java.lang.String entry,
            java.lang.String context,
            java.util.Map attrs)
            throws LDAPException
Update an existing entry in the LDAP directory.

Parameters:
entry - String indicating the configured entry type.
context - String indicating the configured context where the the attributes should be added to the directory.
attrs - Map containing attributes. The keys will be used as attributes names. Multi-valued attributes must contain a Set instance with the attribute values.
Throws:
LDAPException - if the attributes cannot be updated in the directory.

remove

void remove(java.lang.String entry,
            java.lang.String context,
            java.lang.String bindName)
            throws LDAPException
Remove an entry from the LDAP directory.

Parameters:
entry - String indicating the entry type to remove.
context - String containing the name of a configured context where the entry is located.
bindName - String containing the value of the bind attribute.
Throws:
LDAPException - if the entry cannot be removed from the given context.

modify

void modify(java.lang.String entry,
            java.lang.String context,
            java.lang.String bindName,
            int modType,
            java.util.Map attrs)
            throws LDAPException
Modify the attributes of the entry with given bind attribute value.

Parameters:
entry - String indicating the entry type.
context - String containing the name of configured context where the entry is located.
bindName - String containing the value of the bind attribute.
modType - Primitive int indication the modification operation type.
attrs - Map containing the attributes that must be modified.
Throws:
LDAPException - if the attributes cannot be modified.

lookup

java.util.Map lookup(java.lang.String entry,
                     java.lang.String context,
                     java.lang.String bindName,
                     java.lang.String[] attrs)
                     throws LDAPException
Return a single entry from the LDAP directory.

Parameters:
entry - String indicating the entry type.
context - String indicating the name of the configured context to look in.
bindName - String containing the value of the bind attribute.
attrs - String array containing the names of the attributes that must be returned.
Returns:
Map containing the attributes of the entry.
Throws:
LDAPException - if the attributes cannot be returned.

search

java.util.List search(java.lang.String entry,
                      java.lang.String filter,
                      java.lang.String context,
                      int scope,
                      java.lang.String[] attrs)
                      throws LDAPException
Search for entries in the LDAP directory.

Parameters:
entry - String containing entry type that we are searching for.
filter - String containing a valid LDAP filter.
context - String containing the name of one of the configured contexts. May be null.
scope - Primitive int indicating the search scope.
attrs - String array containing the names of the attributes that must be returned by the search.
Returns:
List containing search results as Maps of attribute name-value pairs.
Throws:
LDAPException - if the search cannot be performed.

search

java.util.List search(java.lang.String entry,
                      java.lang.String filter,
                      java.lang.String context,
                      int scope,
                      java.lang.String[] attrs,
                      java.lang.String sortAttr,
                      java.lang.String sortOrder)
                      throws LDAPException
Search for entries in the LDAP directory and sort the results as specified.

Parameters:
entry - String containing entry type that we are searching for.
filter - String containing a valid LDAP filter.
context - String containing the name of one of the configured contexts. May be null.
scope - Primitive int indicating the search scope.
attrs - String array containing the names of the attributes that must be returned by the search.
sortAttr - String containing the name of the attribute that must be sorted on.
sortOrder - String indicating the sort order. Specify "asc" for ascending order and "desc" for descending order.
Returns:
List containing search results as Maps of attribute name-value pairs.
Throws:
LDAPException - if the search cannot be performed.

getContextValue

java.lang.String getContextValue(java.lang.String mapping)
Return context value for the given context mapping.

Parameters:
mapping - String containing the context mapping.
Returns:
String containing the actual context value.

getEntryDefinition

EntryDefinition getEntryDefinition(java.lang.String mapping)
Return EntryDefinition for the given entry mapping.

Parameters:
mapping - String containing the entry mapping.
Returns:
EntryDefinition instance.

getRootContext

java.lang.String getRootContext()
                                throws LDAPException
Return the root context of this worker.

Returns:
String representing the root context of this worker.
Throws:
LDAPException - if the context cannot be returned.