public class OperationHandler
extends java.lang.Object
OperationHandler
provides global convenient methods for
IOperation
s.
It provides logging capabilities when a IOperation
is started and
finished. Therefore, logging must be enabled using the application model
policy or via enableOperationLogging(boolean)
.
In addition, the OperationHandler
provides a global entry point
to intercept operations. This can be done by overwriting
getCacheHandler(IOperation)
.
Constructor and Description |
---|
OperationHandler() |
Modifier and Type | Method and Description |
---|---|
void |
enableOperationLogging(boolean enabled)
Enable or disable operation logging based on the passed boolean value.
|
IOperationCacheHandler |
getCacheHandler(IOperation operation) |
boolean |
isOperationLoggingEnabled()
Returns a boolean value indicating if the execution of any
IOperation
should be logged. |
void |
onOperationFinished(IOperation operation)
Notifies that the passed
IOperation is finished. |
void |
onOperationStarted(IOperation operation)
Notifies that the passed
IOperation has been started. |
public void onOperationStarted(IOperation operation)
IOperation
has been started.
Logs this event if isOperationLoggingEnabled()
returns true. Note
that Logger.getLogLevel()
must be at least Logger.DEBUG
.
public void onOperationFinished(IOperation operation)
IOperation
is finished.
Logs this event if isOperationLoggingEnabled()
returns true. Note
that Logger.getLogLevel()
must be at least Logger.DEBUG
.
public void enableOperationLogging(boolean enabled)
IOperation.getResponse()
to the console.
The default value is false
.
public boolean isOperationLoggingEnabled()
IOperation
should be logged.public IOperationCacheHandler getCacheHandler(IOperation operation)
IOperationCacheHandler
that should be used for the given
IOperation
. Can be overwritten by subclasses to globally
define the IOperationCacheHandler
for all or many
IOperation
s.