org.springframework.ldap.control
Class AbstractRequestControlDirContextProcessor

java.lang.Object
  extended by org.springframework.ldap.control.AbstractRequestControlDirContextProcessor
All Implemented Interfaces:
DirContextProcessor
Direct Known Subclasses:
PagedResultsRequestControl, SortControlDirContextProcessor

public abstract class AbstractRequestControlDirContextProcessor
extends java.lang.Object
implements DirContextProcessor

Abstract superclass with responsibility to apply a single RequestControl on an LdapContext, preserving any existing controls. Subclasses should implement DirContextProcessor.postProcess(DirContext) and template method createRequestControl().

Author:
Mattias Arthursson, Ulrik Sandberg

Field Summary
protected  org.apache.commons.logging.Log log
           
 
Constructor Summary
AbstractRequestControlDirContextProcessor()
           
 
Method Summary
abstract  javax.naming.ldap.Control createRequestControl()
          Create an instance of the appropriate RequestControl.
 void preProcess(javax.naming.directory.DirContext ctx)
          Get the existing RequestControls from the LdapContext, call createRequestControl() to get a new instance, build a new array of Controls and set it on the LdapContext.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.ldap.core.DirContextProcessor
postProcess
 

Field Detail

log

protected org.apache.commons.logging.Log log
Constructor Detail

AbstractRequestControlDirContextProcessor

public AbstractRequestControlDirContextProcessor()
Method Detail

preProcess

public void preProcess(javax.naming.directory.DirContext ctx)
                throws javax.naming.NamingException
Get the existing RequestControls from the LdapContext, call createRequestControl() to get a new instance, build a new array of Controls and set it on the LdapContext.

The Control feature is specific for LDAP v3 and thus applies only to LdapContext. However, the generic DirContextProcessor mechanism used for calling preProcess and postProcess uses DirContext, since it also works for LDAP v2. This is the reason that DirContext has to be cast to a LdapContext.

Specified by:
preProcess in interface DirContextProcessor
Parameters:
ctx - an LdapContext instance.
Throws:
javax.naming.NamingException
java.lang.IllegalArgumentException - if the supplied DirContext is not an LdapContext.

createRequestControl

public abstract javax.naming.ldap.Control createRequestControl()
Create an instance of the appropriate RequestControl.

Returns:
the new instance.


Copyright � 2002-2006. All Rights Reserved.