Package uk.gov.gchq.gaffer.graph.hook
Interface GraphHook
-
- All Known Subinterfaces:
GetFromCacheHook
- All Known Implementing Classes:
AddOperationsToChain
,FunctionAuthoriser
,GraphHookPath
,Log4jLogger
,NamedOperationResolver
,NamedViewResolver
,OperationAuthoriser
,OperationChainLimiter
,SchemaMigration
,UpdateViewHook
public interface GraphHook
A
GraphHook
can be registered with aGraph
and will be triggered before and after operation chains are executed on the graph.If an error occurs whilst running the operation chain the onFailure method will be triggered.
The
OperationChain
parameter that is given to the graph hook is a clone of the original and can be adapted or optimised in any GraphHook implementation. So please note that if you want to access the original operation chain without modifications then you can access if fromContext.getOriginalOpChain()
. This original operation chain should not be modified.
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default <T> T
onFailure(T result, OperationChain<?> opChain, Context context, Exception e)
Called fromGraph
if an error occurs whilst executing theOperationChain
.default <T> T
postExecute(T result, OperationChain<?> opChain, Context context)
Called fromGraph
after anOperationChain
is executed.default void
preExecute(OperationChain<?> opChain, Context context)
Called fromGraph
before anOperationChain
is executed.
-
-
-
Method Detail
-
preExecute
default void preExecute(OperationChain<?> opChain, Context context)
Called fromGraph
before anOperationChain
is executed.- Parameters:
opChain
- theOperationChain
being executed. This can be modified/optimised in any GraphHook.context
- theContext
in which the operation chain was executed. The context also holds a reference to the original operation chain.
-
postExecute
default <T> T postExecute(T result, OperationChain<?> opChain, Context context)
Called fromGraph
after anOperationChain
is executed.- Type Parameters:
T
- the result type- Parameters:
result
- the result from the operation chainopChain
- theOperationChain
that was executed. This can be modified/optimised in any GraphHook.context
- theContext
in which the operation chain was executed. The context also holds a reference to the original operation chain.- Returns:
- result object
-
onFailure
default <T> T onFailure(T result, OperationChain<?> opChain, Context context, Exception e)
Called fromGraph
if an error occurs whilst executing theOperationChain
.- Type Parameters:
T
- the result type- Parameters:
result
- the result from the operation chain - likely to be null.opChain
- theOperationChain
that was executed. This can be modified/optimised in any GraphHook.context
- theContext
in which the operation chain was executed. The context also holds a reference to the original operation chain.e
- the exception- Returns:
- result object
-
-