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

All Known Implementing Classes:
AciAuthorizationInterceptor, AuthenticationInterceptor, BaseInterceptor, ChangeLogInterceptor, CollectiveAttributeInterceptor, DefaultAuthorizationInterceptor, EventInterceptor, ExceptionInterceptor, JournalInterceptor, KeyDerivationInterceptor, MockInterceptor, NormalizationInterceptor, OperationalAttributeInterceptor, PasswordPolicyInterceptor, ReferralInterceptor, SchemaInterceptor, SubentryInterceptor, TriggerInterceptor

public interface Interceptor

Filters invocations on DefaultPartitionNexus. Interceptor filters most method calls performed on DefaultPartitionNexus 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 AttributeImpl( "entryDeleted", "true" );
     nextInterceptor.modify( name, DirIteratorContext.REPLACE_ATTRIBUTE, mark );
 }
 

Version:
$Rev: 918766 $, $Date: 2010-03-04 00:25:11 +0100 (Thu, 04 Mar 2010) $
Author:
Apache Directory Project
See Also:
NextInterceptor

Method Summary
 void add(NextInterceptor next, AddOperationContext opContext)
          Filters Partition.add( AddOperationContext ) call.
 void addContextPartition(NextInterceptor next, AddContextPartitionOperationContext opContext)
          Filters DefaultPartitionNexus#addContextPartition( AddContextPartitionOperationContext ) call.
 void bind(NextInterceptor next, BindOperationContext opContext)
          Filters Partition.bind( BindOperationContext ) call.
 boolean compare(NextInterceptor next, CompareOperationContext opContext)
          Filters DefaultPartitionNexus#compare( CompareOperationContext ) call.
 void delete(NextInterceptor next, DeleteOperationContext opContext)
          Filters Partition.delete( DeleteOperationContext ) call.
 void destroy()
          Deinitializes this interceptor.
 org.apache.directory.shared.ldap.name.DN getMatchedName(NextInterceptor next, GetMatchedNameOperationContext opContext)
          Filters DefaultPartitionNexus#getMatchedName( GetMatchedNameOperationContext ) call.
 java.lang.String getName()
          Name that must be unique in an interceptor chain
 ClonedServerEntry getRootDSE(NextInterceptor next, GetRootDSEOperationContext opContext)
          Filters DefaultPartitionNexus#getRootDSE( GetRootDSEOperationContext ) call.
 org.apache.directory.shared.ldap.name.DN getSuffix(NextInterceptor next, GetSuffixOperationContext opContext)
          Filters DefaultPartitionNexus#getSuffix( GetSuffixOperationContext ) call.
 boolean hasEntry(NextInterceptor next, EntryOperationContext opContext)
          Filters Partition.hasEntry( EntryOperationContext ) call.
 void init(DirectoryService directoryService)
          Intializes this interceptor.
 EntryFilteringCursor list(NextInterceptor next, ListOperationContext opContext)
          Filters Partition.list( ListOperationContext ) call.
 java.util.Set<java.lang.String> listSuffixes(NextInterceptor next, ListSuffixOperationContext opContext)
          Filters DefaultPartitionNexus#listSuffixes( ListSuffixOperationContext ) call.
 ClonedServerEntry lookup(NextInterceptor next, LookupOperationContext opContext)
          Filters Partition.lookup( LookupOperationContext ) call.
 void modify(NextInterceptor next, ModifyOperationContext opContext)
          Filters Partition.modify( ModifyOperationContext ) call.
 void move(NextInterceptor next, MoveOperationContext opContext)
          Filters Partition.move( MoveOperationContext ) call.
 void moveAndRename(NextInterceptor next, MoveAndRenameOperationContext opContext)
          Filters Partition.moveAndRename( MoveAndRenameOperationContext) call.
 void removeContextPartition(NextInterceptor next, RemoveContextPartitionOperationContext opContext)
          Filters DefaultPartitionNexus#removeContextPartition( RemoveContextPartitionOperationContext ) call.
 void rename(NextInterceptor next, RenameOperationContext opContext)
          Filters Partition.rename( RenameOperationContext ) call.
 EntryFilteringCursor search(NextInterceptor next, SearchOperationContext opContext)
          Filters Partition.search( SearchOperationContext ) call.
 void unbind(NextInterceptor next, UnbindOperationContext opContext)
          Filters Partition.unbind( UnbindOperationContext ) call.
 

Method Detail

getName

java.lang.String getName()
Name that must be unique in an interceptor chain

Returns:
name of this interceptor, must be unique in an interceptor chain.

init

void init(DirectoryService directoryService)
          throws java.lang.Exception
Intializes this interceptor. This is invoked by InterceptorChain when this intercepter is loaded into interceptor chain.

Throws:
java.lang.Exception

destroy

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


getRootDSE

ClonedServerEntry getRootDSE(NextInterceptor next,
                             GetRootDSEOperationContext opContext)
                             throws java.lang.Exception
Filters DefaultPartitionNexus#getRootDSE( GetRootDSEOperationContext ) call.

Throws:
java.lang.Exception

getMatchedName

org.apache.directory.shared.ldap.name.DN getMatchedName(NextInterceptor next,
                                                        GetMatchedNameOperationContext opContext)
                                                        throws java.lang.Exception
Filters DefaultPartitionNexus#getMatchedName( GetMatchedNameOperationContext ) call.

Throws:
java.lang.Exception

getSuffix

org.apache.directory.shared.ldap.name.DN getSuffix(NextInterceptor next,
                                                   GetSuffixOperationContext opContext)
                                                   throws java.lang.Exception
Filters DefaultPartitionNexus#getSuffix( GetSuffixOperationContext ) call.

Throws:
java.lang.Exception

listSuffixes

java.util.Set<java.lang.String> listSuffixes(NextInterceptor next,
                                             ListSuffixOperationContext opContext)
                                             throws java.lang.Exception
Filters DefaultPartitionNexus#listSuffixes( ListSuffixOperationContext ) call.

Throws:
java.lang.Exception

addContextPartition

void addContextPartition(NextInterceptor next,
                         AddContextPartitionOperationContext opContext)
                         throws java.lang.Exception
Filters DefaultPartitionNexus#addContextPartition( AddContextPartitionOperationContext ) call.

Throws:
java.lang.Exception

removeContextPartition

void removeContextPartition(NextInterceptor next,
                            RemoveContextPartitionOperationContext opContext)
                            throws java.lang.Exception
Filters DefaultPartitionNexus#removeContextPartition( RemoveContextPartitionOperationContext ) call.

Throws:
java.lang.Exception

compare

boolean compare(NextInterceptor next,
                CompareOperationContext opContext)
                throws java.lang.Exception
Filters DefaultPartitionNexus#compare( CompareOperationContext ) call.

Throws:
java.lang.Exception

delete

void delete(NextInterceptor next,
            DeleteOperationContext opContext)
            throws java.lang.Exception
Filters Partition.delete( DeleteOperationContext ) call.

Throws:
java.lang.Exception

add

void add(NextInterceptor next,
         AddOperationContext opContext)
         throws java.lang.Exception
Filters Partition.add( AddOperationContext ) call.

Throws:
java.lang.Exception

modify

void modify(NextInterceptor next,
            ModifyOperationContext opContext)
            throws java.lang.Exception
Filters Partition.modify( ModifyOperationContext ) call.

Throws:
java.lang.Exception

list

EntryFilteringCursor list(NextInterceptor next,
                          ListOperationContext opContext)
                          throws java.lang.Exception
Filters Partition.list( ListOperationContext ) call.

Throws:
java.lang.Exception

search

EntryFilteringCursor search(NextInterceptor next,
                            SearchOperationContext opContext)
                            throws java.lang.Exception
Filters Partition.search( SearchOperationContext ) call.

Throws:
java.lang.Exception

lookup

ClonedServerEntry lookup(NextInterceptor next,
                         LookupOperationContext opContext)
                         throws java.lang.Exception
Filters Partition.lookup( LookupOperationContext ) call.

Throws:
java.lang.Exception

hasEntry

boolean hasEntry(NextInterceptor next,
                 EntryOperationContext opContext)
                 throws java.lang.Exception
Filters Partition.hasEntry( EntryOperationContext ) call.

Throws:
java.lang.Exception

rename

void rename(NextInterceptor next,
            RenameOperationContext opContext)
            throws java.lang.Exception
Filters Partition.rename( RenameOperationContext ) call.

Throws:
java.lang.Exception

move

void move(NextInterceptor next,
          MoveOperationContext opContext)
          throws java.lang.Exception
Filters Partition.move( MoveOperationContext ) call.

Throws:
java.lang.Exception

moveAndRename

void moveAndRename(NextInterceptor next,
                   MoveAndRenameOperationContext opContext)
                   throws java.lang.Exception
Filters Partition.moveAndRename( MoveAndRenameOperationContext) call.

Throws:
java.lang.Exception

bind

void bind(NextInterceptor next,
          BindOperationContext opContext)
          throws java.lang.Exception
Filters Partition.bind( BindOperationContext ) call.

Throws:
java.lang.Exception

unbind

void unbind(NextInterceptor next,
            UnbindOperationContext opContext)
            throws java.lang.Exception
Filters Partition.unbind( UnbindOperationContext ) call.

Throws:
java.lang.Exception


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.