|
GigaSpaces XAP 9.1 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.openspaces.core.space.filter.FilterOperationDelegate
public class FilterOperationDelegate
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.
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(IJSpace space,
String filterId,
String url,
int priority)
If initMethod is supplied, will invoke it. |
void |
process(SpaceContext context,
ISpaceFilterEntry[] entries,
int operationCode)
Fetch a FilterOperationDelegateInvoker based on the operation
code. |
void |
process(SpaceContext context,
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 |
---|
public FilterOperationDelegate(Object delegate, Map<Integer,org.openspaces.core.space.filter.FilterOperationDelegateInvoker> invokerLookup)
FilterOperationDelegateInvoker
.
Method Detail |
---|
public void setInitMethod(Method initMethod)
public void setCloseMethod(Method closeMethod)
public void init(IJSpace space, String filterId, String url, int priority) throws RuntimeException
initMethod
is supplied, will invoke it.
The method signature can have no parameters or can have a single IJSpace
.
init
in interface ISpaceFilter
space
- an embedded proxy to the space that contain this filter.filterId
- the name of this filter.url
- The URL that was passed when this filter was created.priority
- defines the order in which filters are activated.
RuntimeException
- if this exception is raised, the filter will
be discarded by the engine for the current engine execution ,unless defined otherwise in space configuration.public void process(SpaceContext context, ISpaceFilterEntry entry, int operationCode) throws RuntimeException
FilterOperationDelegateInvoker
based on the operation
code. If found, delegates to its process method.
process
in interface ISpaceFilter
context
- the Context passed by the caller, contains
security context. some of the filters (like ON_INIT) will always
receive a null context.entry
- the event that occurred.operationCode
- the operation that defines when this filter is activated.
The operation codes are defined in FilterOperationCodes
.
RuntimeException
- if this exception is raised for BEFORE filters,
it aborts the execution of the operation.public void process(SpaceContext context, ISpaceFilterEntry[] entries, int operationCode) throws RuntimeException
FilterOperationDelegateInvoker
based on the operation
code. If found, delegates to its process method.
process
in interface ISpaceFilter
context
- the Context passed by the caller, contains
security context. some of the filters (like ON_INIT) will always
receive a null context.entries
- an array of two elements:
On AFTER_UPDATE
: the first element
represents the old entry while the second is the new entry.
On BEFORE_NOTIFY_TRIGGER
and AFTER_NOTIFY_TRIGGER
:
the first element represents the entry while the second is the template.
operationCode
- the operation that defines when this filter is activated.
The operation codes are defined in FilterOperationCodes
.
RuntimeException
- if this exception is raised for BEFORE filters,public void close() throws RuntimeException
closeMethod
is supplied, will invoke it.
The method signature should have no parameters.
close
in interface ISpaceFilter
RuntimeException
- if this exception is raised it will be logged.
This should be used as away to report a filter internal error.
|
GigaSpaces XAP 9.1 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |