org.apache.cocoon.components.naming
Class LDAPEntryManager

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.components.naming.LDAPEntryManager
All Implemented Interfaces:
Poolable, Recyclable, Disposable, LogEnabled, Parameterizable, EntryManager

public class LDAPEntryManager
extends AbstractLogEnabled
implements EntryManager, Parameterizable, Disposable, Recyclable

The LDAPEntryManager is an Avalon Component for managing Entries in a Javax Naming Directory. This is the LDAP implementation of the EntryManager interface. This is designed to be used from FlowScript, it uses Maps instead of NamingEnumerations and Attributes.

Author:
Jeremy Quinn http://apache.org/~jeremy. Example configuration (goes in cocoon.xconf)

        <component role="org.apache.cocoon.component.EntryManager" class="org.apache.cocoon.components.naming.LDAPEntryManager" logger="flow.ldap">
          <parameter name="ldap-host" value="ldap://hostname:port"/>
          <parameter name="ldap-base" value="dc=example,dc=com"/>
          <parameter name="ldap-user" value="username"/>
          <parameter name="ldap-pass" value="password"/>
  </component>
   


Field Summary
protected  DirContext context
           
protected  Hashtable environment
           
protected static String LDAP_BASE_PARAM
           
protected static String LDAP_HOST_PARAM
           
protected static String LDAP_PASS_PARAM
           
protected static String LDAP_USER_PARAM
           
 
Fields inherited from interface org.apache.cocoon.components.naming.EntryManager
ADD_ATTRIBUTE, REMOVE_ATTRIBUTE, REPLACE_ATTRIBUTE, ROLE
 
Constructor Summary
LDAPEntryManager()
           
 
Method Summary
 void create(String name, Map attributes)
          Creates a new Entry
 void dispose()
           
 Map find(Map attributes)
          Finds Entries based on matching their Attributes
 Map find(String cntx, Map attributes)
          Finds Entries based on their Attributes
 Map get(String name)
          Retrieves a named Entry's Attributes
protected  void initialize()
           
 void modify(String name, int mod_op, Map attributes)
          Modifies an existing Entry
 void parameterize(Parameters params)
          Avalon, Parameterize this Class
 void recycle()
           
 void remove(String name)
          Deletes an Entry
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LDAP_HOST_PARAM

protected static final String LDAP_HOST_PARAM
See Also:
Constant Field Values

LDAP_USER_PARAM

protected static final String LDAP_USER_PARAM
See Also:
Constant Field Values

LDAP_PASS_PARAM

protected static final String LDAP_PASS_PARAM
See Also:
Constant Field Values

LDAP_BASE_PARAM

protected static final String LDAP_BASE_PARAM
See Also:
Constant Field Values

context

protected DirContext context

environment

protected Hashtable environment
Constructor Detail

LDAPEntryManager

public LDAPEntryManager()
Method Detail

parameterize

public void parameterize(Parameters params)
                  throws ParameterException
Avalon, Parameterize this Class

Specified by:
parameterize in interface Parameterizable
Throws:
ParameterException

recycle

public final void recycle()
Specified by:
recycle in interface Recyclable

dispose

public final void dispose()
Specified by:
dispose in interface Disposable

initialize

protected void initialize()
                   throws Exception
Throws:
Exception

create

public void create(String name,
                   Map attributes)
            throws ProcessingException
Creates a new Entry

Specified by:
create in interface EntryManager
Parameters:
name - The name of the Entry to create
attributes - The Map of Attributes to create it with
Throws:
ProcessingException

get

public Map get(String name)
        throws ProcessingException
Retrieves a named Entry's Attributes

Specified by:
get in interface EntryManager
Parameters:
name - The name of the Entry to modify
Returns:
a Map of the Attributes
Throws:
ProcessingException

find

public Map find(Map attributes)
         throws ProcessingException
Finds Entries based on matching their Attributes

Specified by:
find in interface EntryManager
Parameters:
attributes - The Attributes to match
Returns:
a Map of the results, each with a Map of their Attributes
Throws:
ProcessingException

find

public Map find(String cntx,
                Map attributes)
         throws ProcessingException
Finds Entries based on their Attributes

Specified by:
find in interface EntryManager
Parameters:
cntx - The sub-context to search
attributes - The Attributes to match
Returns:
a Map of the results, each with a Map of their Attributes
Throws:
ProcessingException

modify

public void modify(String name,
                   int mod_op,
                   Map attributes)
            throws ProcessingException
Modifies an existing Entry

Specified by:
modify in interface EntryManager
Parameters:
name - The name of the Entry to modify
mod_op - The modification mode to use
attributes - The Map of modifications
Throws:
ProcessingException

remove

public void remove(String name)
            throws ProcessingException
Deletes an Entry

Specified by:
remove in interface EntryManager
Parameters:
name - The name of the Entry to delete
Throws:
ProcessingException


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.