org.apache.ldap.server.interceptor
Interface Interceptor

All Known Implementing Classes:
BaseInterceptor

public interface Interceptor

Filters invocations on ContextPartitionNexus. Interceptor filters most method calls performed on ContextPartitionNexus just like Servlet filters do.

Interceptor Chaining

Interceptors should usually pass the control of current invocation to the next interceptor by calling an appropriate method on NextInterceptor. The flow control is returned when the next interceptor's filter method returns. You can therefore implement pre-, post-, around- invocation handler by how you place the statement. Otherwise, you can transform the invocation into other(s).

Pre-invocation Filtering

 public void delete( NextInterceptor nextInterceptor, Name name )
 {
     System.out.println( "Starting invocation." );
     nextInterceptor.delete( name );
 }
 

Post-invocation Filtering

 public void delete( NextInterceptor nextInterceptor, Name name )
 {
     nextInterceptor.delete( name );
     System.out.println( "Invocation ended." );
 }
 

Around-invocation Filtering

 public void delete( NextInterceptor nextInterceptor, Name name )
 {
     long startTime = System.currentTimeMillis();
     try
     {
         nextInterceptor.delete( name );
     }
     finally
     {
         long endTime = System.currentTimeMillis();
         System.out.println( ( endTime - startTime ) + "ms elapsed." );
     }
 }
 

Transforming invocations

 public void delete( NextInterceptor nextInterceptor, Name name )
 {
     // transform deletion into modification.
     Attribute mark = new BasicAttribute( "entryDeleted", "true" );
     nextInterceptor.modify( name, DirContext.REPLACE_ATTRIBUTE, mark );
 }
 

Version:
$Rev: 264732 $, $Date: 2005-08-30 04:04:51 -0400 (Tue, 30 Aug 2005) $
Author:
Apache Directory Project
See Also:
NextInterceptor

Method Summary
 void add(NextInterceptor next, java.lang.String userProvidedName, javax.naming.Name normalizedName, javax.naming.directory.Attributes entry)
          Filters ContextPartition.add(String, Name, Attributes) call.
 void addContextPartition(NextInterceptor next, ContextPartitionConfiguration cfg)
          Filters ContextPartitionNexus.addContextPartition(ContextPartitionConfiguration) call.
 void delete(NextInterceptor next, javax.naming.Name name)
          Filters ContextPartition.delete(Name) call.
 void destroy()
          Deinitializes this interceptor.
 javax.naming.Name getMatchedName(NextInterceptor next, javax.naming.Name name, boolean normalized)
          Filters ContextPartitionNexus.getMatchedName(Name, boolean) call.
 javax.naming.directory.Attributes getRootDSE(NextInterceptor next)
          Filters ContextPartitionNexus.getRootDSE() call.
 javax.naming.Name getSuffix(NextInterceptor next, javax.naming.Name name, boolean normalized)
          Filters ContextPartitionNexus.getSuffix(Name, boolean) call.
 boolean hasEntry(NextInterceptor next, javax.naming.Name name)
          Filters ContextPartition.lookup(Name, String[]) call.
 void init(ContextFactoryConfiguration factoryCfg, InterceptorConfiguration cfg)
          Intializes this interceptor.
 boolean isSuffix(NextInterceptor next, javax.naming.Name name)
          Filters ContextPartition.isSuffix(Name) call.
 javax.naming.NamingEnumeration list(NextInterceptor next, javax.naming.Name baseName)
          Filters ContextPartition.list(Name) call.
 java.util.Iterator listSuffixes(NextInterceptor next, boolean normalized)
          Filters ContextPartitionNexus.listSuffixes(boolean) call.
 javax.naming.directory.Attributes lookup(NextInterceptor next, javax.naming.Name name)
          Filters ContextPartition.lookup(Name) call.
 javax.naming.directory.Attributes lookup(NextInterceptor next, javax.naming.Name dn, java.lang.String[] attrIds)
          Filters ContextPartition.lookup(Name, String[]) call.
 void modify(NextInterceptor next, javax.naming.Name name, int modOp, javax.naming.directory.Attributes attributes)
          Filters ContextPartition.modify(Name, int, Attributes) call.
 void modify(NextInterceptor next, javax.naming.Name name, javax.naming.directory.ModificationItem[] items)
          Filters ContextPartition.modify(Name, ModificationItem[]) call.
 void modifyRn(NextInterceptor next, javax.naming.Name name, java.lang.String newRn, boolean deleteOldRn)
          Filters ContextPartition.modifyRn(Name, String, boolean) call.
 void move(NextInterceptor next, javax.naming.Name oldName, javax.naming.Name newParentName)
          Filters ContextPartition.move(Name, Name) call.
 void move(NextInterceptor next, javax.naming.Name oldName, javax.naming.Name newParentName, java.lang.String newRn, boolean deleteOldRn)
          Filters ContextPartition.move(Name, Name, String, boolean) call.
 void removeContextPartition(NextInterceptor next, javax.naming.Name suffix)
          Filters ContextPartitionNexus.removeContextPartition(Name) call.
 javax.naming.NamingEnumeration search(NextInterceptor next, javax.naming.Name baseName, java.util.Map environment, org.apache.ldap.common.filter.ExprNode filter, javax.naming.directory.SearchControls searchControls)
          Filters ContextPartition.search(Name, Map, ExprNode, SearchControls) call.
 

Method Detail

init

public void init(ContextFactoryConfiguration factoryCfg,
                 InterceptorConfiguration cfg)
          throws javax.naming.NamingException
Intializes this interceptor. This is invoked by InterceptorChain when this intercepter is loaded into interceptor chain.

Throws:
javax.naming.NamingException

destroy

public void destroy()
Deinitializes this interceptor. This is invoked by InterceptorChain when this intercepter is unloaded from interceptor chain.


getRootDSE

public javax.naming.directory.Attributes getRootDSE(NextInterceptor next)
                                             throws javax.naming.NamingException
Filters ContextPartitionNexus.getRootDSE() call.

Throws:
javax.naming.NamingException

getMatchedName

public javax.naming.Name getMatchedName(NextInterceptor next,
                                        javax.naming.Name name,
                                        boolean normalized)
                                 throws javax.naming.NamingException
Filters ContextPartitionNexus.getMatchedName(Name, boolean) call.

Throws:
javax.naming.NamingException

getSuffix

public javax.naming.Name getSuffix(NextInterceptor next,
                                   javax.naming.Name name,
                                   boolean normalized)
                            throws javax.naming.NamingException
Filters ContextPartitionNexus.getSuffix(Name, boolean) call.

Throws:
javax.naming.NamingException

listSuffixes

public java.util.Iterator listSuffixes(NextInterceptor next,
                                       boolean normalized)
                                throws javax.naming.NamingException
Filters ContextPartitionNexus.listSuffixes(boolean) call.

Throws:
javax.naming.NamingException

addContextPartition

public void addContextPartition(NextInterceptor next,
                                ContextPartitionConfiguration cfg)
                         throws javax.naming.NamingException
Filters ContextPartitionNexus.addContextPartition(ContextPartitionConfiguration) call.

Throws:
javax.naming.NamingException

removeContextPartition

public void removeContextPartition(NextInterceptor next,
                                   javax.naming.Name suffix)
                            throws javax.naming.NamingException
Filters ContextPartitionNexus.removeContextPartition(Name) call.

Throws:
javax.naming.NamingException

delete

public void delete(NextInterceptor next,
                   javax.naming.Name name)
            throws javax.naming.NamingException
Filters ContextPartition.delete(Name) call.

Throws:
javax.naming.NamingException

add

public void add(NextInterceptor next,
                java.lang.String userProvidedName,
                javax.naming.Name normalizedName,
                javax.naming.directory.Attributes entry)
         throws javax.naming.NamingException
Filters ContextPartition.add(String, Name, Attributes) call.

Throws:
javax.naming.NamingException

modify

public void modify(NextInterceptor next,
                   javax.naming.Name name,
                   int modOp,
                   javax.naming.directory.Attributes attributes)
            throws javax.naming.NamingException
Filters ContextPartition.modify(Name, int, Attributes) call.

Throws:
javax.naming.NamingException

modify

public void modify(NextInterceptor next,
                   javax.naming.Name name,
                   javax.naming.directory.ModificationItem[] items)
            throws javax.naming.NamingException
Filters ContextPartition.modify(Name, ModificationItem[]) call.

Throws:
javax.naming.NamingException

list

public javax.naming.NamingEnumeration list(NextInterceptor next,
                                           javax.naming.Name baseName)
                                    throws javax.naming.NamingException
Filters ContextPartition.list(Name) call.

Throws:
javax.naming.NamingException

search

public javax.naming.NamingEnumeration search(NextInterceptor next,
                                             javax.naming.Name baseName,
                                             java.util.Map environment,
                                             org.apache.ldap.common.filter.ExprNode filter,
                                             javax.naming.directory.SearchControls searchControls)
                                      throws javax.naming.NamingException
Filters ContextPartition.search(Name, Map, ExprNode, SearchControls) call.

Throws:
javax.naming.NamingException

lookup

public javax.naming.directory.Attributes lookup(NextInterceptor next,
                                                javax.naming.Name name)
                                         throws javax.naming.NamingException
Filters ContextPartition.lookup(Name) call.

Throws:
javax.naming.NamingException

lookup

public javax.naming.directory.Attributes lookup(NextInterceptor next,
                                                javax.naming.Name dn,
                                                java.lang.String[] attrIds)
                                         throws javax.naming.NamingException
Filters ContextPartition.lookup(Name, String[]) call.

Throws:
javax.naming.NamingException

hasEntry

public boolean hasEntry(NextInterceptor next,
                        javax.naming.Name name)
                 throws javax.naming.NamingException
Filters ContextPartition.lookup(Name, String[]) call.

Throws:
javax.naming.NamingException

isSuffix

public boolean isSuffix(NextInterceptor next,
                        javax.naming.Name name)
                 throws javax.naming.NamingException
Filters ContextPartition.isSuffix(Name) call.

Throws:
javax.naming.NamingException

modifyRn

public void modifyRn(NextInterceptor next,
                     javax.naming.Name name,
                     java.lang.String newRn,
                     boolean deleteOldRn)
              throws javax.naming.NamingException
Filters ContextPartition.modifyRn(Name, String, boolean) call.

Throws:
javax.naming.NamingException

move

public void move(NextInterceptor next,
                 javax.naming.Name oldName,
                 javax.naming.Name newParentName)
          throws javax.naming.NamingException
Filters ContextPartition.move(Name, Name) call.

Throws:
javax.naming.NamingException

move

public void move(NextInterceptor next,
                 javax.naming.Name oldName,
                 javax.naming.Name newParentName,
                 java.lang.String newRn,
                 boolean deleteOldRn)
          throws javax.naming.NamingException
Filters ContextPartition.move(Name, Name, String, boolean) call.

Throws:
javax.naming.NamingException