org.xcmis.search.content.interceptors
Class CommandInterceptor

java.lang.Object
  extended by org.xcmis.search.content.interceptors.AbstractVisitor
      extended by org.xcmis.search.content.interceptors.CommandInterceptor
All Implemented Interfaces:
Visitor, Startable
Direct Known Subclasses:
ContentReaderInterceptor, QueryableIndexStorage, QueryProcessorInterceptor

public class CommandInterceptor
extends AbstractVisitor
implements Startable

This is the base class for all interceptors to extend, and implements the Visitor interface allowing it to intercept invocations on VisitableCommands.

When writing interceptors, authors can either override a specific visitXXX() method or the more generic handleDefault(InvocationContext , VisitableCommand) which is the default behaviour of any visit method, as defined in AbstractVisitor.handleDefault(InvocationContext , VisitableCommand).

The preferred approach is to override the specific visitXXX() methods that are of interest rather than to override handleDefault(InvocationContext , VisitableCommand) and then write a series of if statements or a switch block, if command-specific behaviour is needed.


Constructor Summary
CommandInterceptor()
           
 
Method Summary
 CommandInterceptor getNext()
          Retrieves the next interceptor in the chain.
protected  Object handleDefault(InvocationContext ctx, VisitableCommand command)
          The default behaviour of the visitXXX methods, which is to ignore the call and pass the call up to the next interceptor in the chain.
 boolean hasNext()
           
 Object invokeNextInterceptor(InvocationContext ctx, VisitableCommand command)
          Invokes the next interceptor in the chain.
 void setNext(CommandInterceptor next)
          Sets the next interceptor in the chain to the interceptor passed in.
 void start()
           
 void stop()
           
 
Methods inherited from class org.xcmis.search.content.interceptors.AbstractVisitor
visitChildEntriesCommand, visitExecuteSelectorCommand, visitGetContentEntryCommand, visitGetUnfiledEntriesCommand, visitModifyIndexCommand, visitProcessQueryCommand
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandInterceptor

public CommandInterceptor()
Method Detail

getNext

public CommandInterceptor getNext()
Retrieves the next interceptor in the chain.

Returns:
the next interceptor in the chain.

hasNext

public boolean hasNext()
Returns:
true if there is another interceptor in the chain after this; false otherwise.

setNext

public void setNext(CommandInterceptor next)
Sets the next interceptor in the chain to the interceptor passed in.

Parameters:
next - next interceptor in the chain.

invokeNextInterceptor

public Object invokeNextInterceptor(InvocationContext ctx,
                                    VisitableCommand command)
                             throws Throwable
Invokes the next interceptor in the chain. This is how interceptor implementations should pass a call up the chain to the next interceptor.

Parameters:
ctx - invocation context
command - command to pass up the chain.
Returns:
return value of the invocation
Throws:
Throwable - in the event of problems

handleDefault

protected Object handleDefault(InvocationContext ctx,
                               VisitableCommand command)
                        throws Throwable
The default behaviour of the visitXXX methods, which is to ignore the call and pass the call up to the next interceptor in the chain.

Overrides:
handleDefault in class AbstractVisitor
Parameters:
ctx - invocation context
command - command to invoke
Returns:
return value
Throws:
Throwable - in the event of problems

start

public void start()
Specified by:
start in interface Startable
See Also:
Startable.start()

stop

public void stop()
Specified by:
stop in interface Startable
See Also:
Startable.stop()


Copyright © 2003-2013 eXo Platform SAS. All Rights Reserved.