org.apache.directory.server.core.interceptor
Interface Interceptor

All Known Implementing Classes:
BaseInterceptor

public interface Interceptor

Filters invocations on PartitionNexus. Interceptor filters most method calls performed on PartitionNexus 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: 434579 $, $Date: 2006-08-25 02:19:11 +0200 (Fri, 25 Aug 2006) $
Author:
Apache Directory Project
See Also:
NextInterceptor

Method Summary
 void add(NextInterceptor next, LdapDN name, javax.naming.directory.Attributes entry)
          Filters Partition#add(org.apache.directory.shared.ldap.name.LdapDN,javax.naming.directory.Attributes) call.
 void addContextPartition(NextInterceptor next, PartitionConfiguration cfg)
          Filters PartitionNexus.addContextPartition(PartitionConfiguration) call.
 void bind(NextInterceptor next, LdapDN bindDn, byte[] credentials, java.util.List mechanisms, java.lang.String saslAuthId)
          Filters Partition#bind(org.apache.directory.shared.ldap.name.LdapDN,byte[],java.util.List,String) call.
 boolean compare(NextInterceptor next, LdapDN name, java.lang.String oid, java.lang.Object value)
          Filters PartitionNexus#compare(org.apache.directory.shared.ldap.name.LdapDN,String,Object) call.
 void delete(NextInterceptor next, LdapDN name)
          Filters Partition#delete(org.apache.directory.shared.ldap.name.LdapDN) call.
 void destroy()
          Deinitializes this interceptor.
 LdapDN getMatchedName(NextInterceptor next, LdapDN name)
          Filters PartitionNexus#getMatchedName(org.apache.directory.shared.ldap.name.LdapDN) call.
 javax.naming.directory.Attributes getRootDSE(NextInterceptor next)
          Filters PartitionNexus.getRootDSE() call.
 LdapDN getSuffix(NextInterceptor next, LdapDN name)
          Filters PartitionNexus#getSuffix(org.apache.directory.shared.ldap.name.LdapDN) call.
 boolean hasEntry(NextInterceptor next, LdapDN name)
          Filters Partition#lookup(org.apache.directory.shared.ldap.name.LdapDN,String[]) call.
 void init(DirectoryServiceConfiguration factoryCfg, InterceptorConfiguration cfg)
          Intializes this interceptor.
 boolean isSuffix(NextInterceptor next, LdapDN name)
          Filters Partition#isSuffix(org.apache.directory.shared.ldap.name.LdapDN) call.
 javax.naming.NamingEnumeration list(NextInterceptor next, LdapDN baseName)
          Filters Partition#list(org.apache.directory.shared.ldap.name.LdapDN) call.
 java.util.Iterator listSuffixes(NextInterceptor next)
          Filters PartitionNexus.listSuffixes() call.
 javax.naming.directory.Attributes lookup(NextInterceptor next, LdapDN name)
          Filters Partition#lookup(org.apache.directory.shared.ldap.name.LdapDN) call.
 javax.naming.directory.Attributes lookup(NextInterceptor next, LdapDN dn, java.lang.String[] attrIds)
          Filters Partition#lookup(org.apache.directory.shared.ldap.name.LdapDN,String[]) call.
 void modify(NextInterceptor next, LdapDN name, int modOp, javax.naming.directory.Attributes attributes)
          Filters Partition#modify(org.apache.directory.shared.ldap.name.LdapDN,int,javax.naming.directory.Attributes) call.
 void modify(NextInterceptor next, LdapDN name, javax.naming.directory.ModificationItem[] items)
          Filters Partition#modify(org.apache.directory.shared.ldap.name.LdapDN,javax.naming.directory.ModificationItem[]) call.
 void modifyRn(NextInterceptor next, LdapDN name, java.lang.String newRn, boolean deleteOldRn)
          Filters Partition#modifyRn(org.apache.directory.shared.ldap.name.LdapDN,String,boolean) call.
 void move(NextInterceptor next, LdapDN oldName, LdapDN newParentName)
          Filters Partition#move(org.apache.directory.shared.ldap.name.LdapDN,org.apache.directory.shared.ldap.name.LdapDN) call.
 void move(NextInterceptor next, LdapDN oldName, LdapDN newParentName, java.lang.String newRn, boolean deleteOldRn)
          Filters Partition#move(org.apache.directory.shared.ldap.name.LdapDN,org.apache.directory.shared.ldap.name.LdapDN,String,boolean) call.
 void removeContextPartition(NextInterceptor next, LdapDN suffix)
          Filters PartitionNexus#removeContextPartition(org.apache.directory.shared.ldap.name.LdapDN) call.
 javax.naming.NamingEnumeration search(NextInterceptor next, LdapDN baseName, java.util.Map environment, ExprNode filter, javax.naming.directory.SearchControls searchControls)
          Filters Partition#search(org.apache.directory.shared.ldap.name.LdapDN,java.util.Map,org.apache.directory.shared.ldap.filter.ExprNode,javax.naming.directory.SearchControls) call.
 void unbind(NextInterceptor next, LdapDN bindDn)
          Filters Partition#unbind(org.apache.directory.shared.ldap.name.LdapDN) call.
 

Method Detail

init

public void init(DirectoryServiceConfiguration 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 PartitionNexus.getRootDSE() call.

Throws:
javax.naming.NamingException

getMatchedName

public LdapDN getMatchedName(NextInterceptor next,
                             LdapDN name)
                      throws javax.naming.NamingException
Filters PartitionNexus#getMatchedName(org.apache.directory.shared.ldap.name.LdapDN) call.

Throws:
javax.naming.NamingException

getSuffix

public LdapDN getSuffix(NextInterceptor next,
                        LdapDN name)
                 throws javax.naming.NamingException
Filters PartitionNexus#getSuffix(org.apache.directory.shared.ldap.name.LdapDN) call.

Throws:
javax.naming.NamingException

listSuffixes

public java.util.Iterator listSuffixes(NextInterceptor next)
                                throws javax.naming.NamingException
Filters PartitionNexus.listSuffixes() call.

Throws:
javax.naming.NamingException

addContextPartition

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

Throws:
javax.naming.NamingException

removeContextPartition

public void removeContextPartition(NextInterceptor next,
                                   LdapDN suffix)
                            throws javax.naming.NamingException
Filters PartitionNexus#removeContextPartition(org.apache.directory.shared.ldap.name.LdapDN) call.

Throws:
javax.naming.NamingException

compare

public boolean compare(NextInterceptor next,
                       LdapDN name,
                       java.lang.String oid,
                       java.lang.Object value)
                throws javax.naming.NamingException
Filters PartitionNexus#compare(org.apache.directory.shared.ldap.name.LdapDN,String,Object) call.

Throws:
javax.naming.NamingException

delete

public void delete(NextInterceptor next,
                   LdapDN name)
            throws javax.naming.NamingException
Filters Partition#delete(org.apache.directory.shared.ldap.name.LdapDN) call.

Throws:
javax.naming.NamingException

add

public void add(NextInterceptor next,
                LdapDN name,
                javax.naming.directory.Attributes entry)
         throws javax.naming.NamingException
Filters Partition#add(org.apache.directory.shared.ldap.name.LdapDN,javax.naming.directory.Attributes) call.

Throws:
javax.naming.NamingException

modify

public void modify(NextInterceptor next,
                   LdapDN name,
                   int modOp,
                   javax.naming.directory.Attributes attributes)
            throws javax.naming.NamingException
Filters Partition#modify(org.apache.directory.shared.ldap.name.LdapDN,int,javax.naming.directory.Attributes) call.

Throws:
javax.naming.NamingException

modify

public void modify(NextInterceptor next,
                   LdapDN name,
                   javax.naming.directory.ModificationItem[] items)
            throws javax.naming.NamingException
Filters Partition#modify(org.apache.directory.shared.ldap.name.LdapDN,javax.naming.directory.ModificationItem[]) call.

Throws:
javax.naming.NamingException

list

public javax.naming.NamingEnumeration list(NextInterceptor next,
                                           LdapDN baseName)
                                    throws javax.naming.NamingException
Filters Partition#list(org.apache.directory.shared.ldap.name.LdapDN) call.

Throws:
javax.naming.NamingException

search

public javax.naming.NamingEnumeration search(NextInterceptor next,
                                             LdapDN baseName,
                                             java.util.Map environment,
                                             ExprNode filter,
                                             javax.naming.directory.SearchControls searchControls)
                                      throws javax.naming.NamingException
Filters Partition#search(org.apache.directory.shared.ldap.name.LdapDN,java.util.Map,org.apache.directory.shared.ldap.filter.ExprNode,javax.naming.directory.SearchControls) call.

Throws:
javax.naming.NamingException

lookup

public javax.naming.directory.Attributes lookup(NextInterceptor next,
                                                LdapDN name)
                                         throws javax.naming.NamingException
Filters Partition#lookup(org.apache.directory.shared.ldap.name.LdapDN) call.

Throws:
javax.naming.NamingException

lookup

public javax.naming.directory.Attributes lookup(NextInterceptor next,
                                                LdapDN dn,
                                                java.lang.String[] attrIds)
                                         throws javax.naming.NamingException
Filters Partition#lookup(org.apache.directory.shared.ldap.name.LdapDN,String[]) call.

Throws:
javax.naming.NamingException

hasEntry

public boolean hasEntry(NextInterceptor next,
                        LdapDN name)
                 throws javax.naming.NamingException
Filters Partition#lookup(org.apache.directory.shared.ldap.name.LdapDN,String[]) call.

Throws:
javax.naming.NamingException

isSuffix

public boolean isSuffix(NextInterceptor next,
                        LdapDN name)
                 throws javax.naming.NamingException
Filters Partition#isSuffix(org.apache.directory.shared.ldap.name.LdapDN) call.

Throws:
javax.naming.NamingException

modifyRn

public void modifyRn(NextInterceptor next,
                     LdapDN name,
                     java.lang.String newRn,
                     boolean deleteOldRn)
              throws javax.naming.NamingException
Filters Partition#modifyRn(org.apache.directory.shared.ldap.name.LdapDN,String,boolean) call.

Throws:
javax.naming.NamingException

move

public void move(NextInterceptor next,
                 LdapDN oldName,
                 LdapDN newParentName)
          throws javax.naming.NamingException
Filters Partition#move(org.apache.directory.shared.ldap.name.LdapDN,org.apache.directory.shared.ldap.name.LdapDN) call.

Throws:
javax.naming.NamingException

move

public void move(NextInterceptor next,
                 LdapDN oldName,
                 LdapDN newParentName,
                 java.lang.String newRn,
                 boolean deleteOldRn)
          throws javax.naming.NamingException
Filters Partition#move(org.apache.directory.shared.ldap.name.LdapDN,org.apache.directory.shared.ldap.name.LdapDN,String,boolean) call.

Throws:
javax.naming.NamingException

bind

public void bind(NextInterceptor next,
                 LdapDN bindDn,
                 byte[] credentials,
                 java.util.List mechanisms,
                 java.lang.String saslAuthId)
          throws javax.naming.NamingException
Filters Partition#bind(org.apache.directory.shared.ldap.name.LdapDN,byte[],java.util.List,String) call.

Throws:
javax.naming.NamingException

unbind

public void unbind(NextInterceptor next,
                   LdapDN bindDn)
            throws javax.naming.NamingException
Filters Partition#unbind(org.apache.directory.shared.ldap.name.LdapDN) call.

Throws:
javax.naming.NamingException