GigaSpaces - Open Spaces

org.openspaces.core.space.filter
Class FilterOperationDelegate

java.lang.Object
  extended by org.openspaces.core.space.filter.FilterOperationDelegate
All Implemented Interfaces:
com.j_spaces.core.filters.ISpaceFilter

public class FilterOperationDelegate
extends Object
implements com.j_spaces.core.filters.ISpaceFilter

An ISpaceFilter implementation that acts as an adapter delegating the execution of the filter lifecycle methods and specific operation to pluggable reflection based methods.

Holds a Method representing an init callback, and one representing close callback. Both can be null for cases where no delegation is required.

Holds a map of FilterOperationDelegateInvoker per operation code. Once process is called, a FilterOperationDelegateInvoker is required based on the operation code, and if found, the invocation is delegated to it.

Author:
kimchy
See Also:
FilterOperationDelegateInvoker

Constructor Summary
FilterOperationDelegate(Object delegate, Map<Integer,org.openspaces.core.space.filter.FilterOperationDelegateInvoker> invokerLookup)
          Constructs a new filter operation delegate.
 
Method Summary
 void close()
          If closeMethod is supplied, will invoke it.
 void init(com.j_spaces.core.IJSpace space, String filterId, String url, int priority)
          If initMethod is supplied, will invoke it.
 void process(com.j_spaces.core.SpaceContext context, com.j_spaces.core.filters.entry.ISpaceFilterEntry[] entries, int operationCode)
          Fetch a FilterOperationDelegateInvoker based on the operation code.
 void process(com.j_spaces.core.SpaceContext context, com.j_spaces.core.filters.entry.ISpaceFilterEntry entry, int operationCode)
          Fetch a FilterOperationDelegateInvoker based on the operation code.
 void setCloseMethod(Method closeMethod)
          Sets an optional close method callback.
 void setInitMethod(Method initMethod)
          Sets an optional init method callback.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilterOperationDelegate

public FilterOperationDelegate(Object delegate,
                               Map<Integer,org.openspaces.core.space.filter.FilterOperationDelegateInvoker> invokerLookup)
Constructs a new filter operation delegate. Providing the delegate to perform the invocation on and a map of operation per FilterOperationDelegateInvoker.

Method Detail

setInitMethod

public void setInitMethod(Method initMethod)
Sets an optional init method callback.


setCloseMethod

public void setCloseMethod(Method closeMethod)
Sets an optional close method callback.


init

public void init(com.j_spaces.core.IJSpace space,
                 String filterId,
                 String url,
                 int priority)
          throws RuntimeException
If initMethod is supplied, will invoke it. The method signature can have no parameters or can have a single IJSpace.

Specified by:
init in interface com.j_spaces.core.filters.ISpaceFilter
Throws:
RuntimeException

process

public void process(com.j_spaces.core.SpaceContext context,
                    com.j_spaces.core.filters.entry.ISpaceFilterEntry entry,
                    int operationCode)
             throws RuntimeException
Fetch a FilterOperationDelegateInvoker based on the operation code. If found, delegates to its process method.

Specified by:
process in interface com.j_spaces.core.filters.ISpaceFilter
Throws:
RuntimeException

process

public void process(com.j_spaces.core.SpaceContext context,
                    com.j_spaces.core.filters.entry.ISpaceFilterEntry[] entries,
                    int operationCode)
             throws RuntimeException
Fetch a FilterOperationDelegateInvoker based on the operation code. If found, delegates to its process method.

Specified by:
process in interface com.j_spaces.core.filters.ISpaceFilter
Throws:
RuntimeException

close

public void close()
           throws RuntimeException
If closeMethod is supplied, will invoke it. The method signature should have no parameters.

Specified by:
close in interface com.j_spaces.core.filters.ISpaceFilter
Throws:
RuntimeException

GigaSpaces - Open Spaces

Copyright © GigaSpaces.