|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.umber.catalan.process.workers.BaseMetadataHolder org.umber.catalan.process.workers.BaseWorker
Shared implementation of the IWorker interface.
Constructor Summary | |
BaseWorker()
Creates a new instance of BaseWorker with default autogenerated metadata. |
|
BaseWorker(IWorkMetadata info)
Creates a new instance of BaseWorker. |
Method Summary | |
protected abstract void |
doWork()
Core executor for descendents of BaseWorker. |
protected java.util.List |
getActiveNodes()
Retrieves the nodes currently active for processing. |
protected IQueue |
getActiveQueue()
Retrieves the primary target queue for this IWorker. |
IWorkProperties |
getDefaultProperties()
Retrieves the default properties for this IWorker. |
IWorkProperties |
getRuntimeProperties()
Retrieves this IWorker's default and runtime properties. |
protected IWorkspace |
getWorkspace()
Retrieves current IWorkspace if inside the process() method,
or null if outside. |
protected void |
handleErrorProblem(java.lang.String message,
ProcessException e)
Handles an ERROR problem; might throw the exception or post it as an Alert in the AlertQueue, or both, depending on the config of the IWorker. |
protected void |
handleFatalProblem(java.lang.String message,
ProcessException e)
Handles a FATAL problem; might throw the exception or post it as an Alert in the AlertQueue, or both, depending on the config of the IWorker. |
protected void |
handleInfoProblem(java.lang.String message,
ProcessException e)
Handles an INFO problem; might throw the exception or post it as an Alert in the AlertQueue, or both, depending on the config of the IWorker. |
protected void |
handleWarningProblem(java.lang.String message,
ProcessException e)
Handles a WARNING problem; might throw the exception or post it as an Alert in the AlertQueue, or both, depending on the config of the IWorker. |
boolean |
isProcessing()
Determines if the IWorker is currently processing data in its process() method. |
void |
process(IWorkProperties runtimeProps,
IWorkspace workspace)
Perform one stage of processing in the workspace. |
void |
setDefaultProperties(IWorkProperties defaultProps)
Initializes IWorker with default properties. |
protected void |
setTerminalPriority(AlertPriority priority)
Assigns the AlertPriority level at which this IWorker will throw an exception. |
Methods inherited from class org.umber.catalan.process.workers.BaseMetadataHolder |
getMetadata, setOptionalProperties, setRequiredProperties, validateProperties, validateType |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.umber.catalan.process.workers.IMetadataHolder |
getMetadata, validateProperties, validateType |
Constructor Detail |
public BaseWorker()
public BaseWorker(IWorkMetadata info)
info
- metadata for this workerMethod Detail |
public IWorkProperties getDefaultProperties()
getDefaultProperties
in interface IWorker
public void setDefaultProperties(IWorkProperties defaultProps) throws WorkPropertyException
If the Object[] constructor is used to create this IWorker object, it will attempt to validate the "command" property if it is set.
setDefaultProperties
in interface IWorker
defaultProps
- default initialization data
WorkPropertyException
- if any given config parameters are invalidpublic boolean isProcessing()
process()
method.
public IWorkProperties getRuntimeProperties() throws WorkPropertyException
getDefaultProperties()
, and
runtime properties are pulled from the runtimeProps parameter of the
process()
method. If a property exists in both the runtime
and default property sets, the runtime property will be used. If this
method is called outside the process()
method, it
will throw an exception.
WorkPropertyException
- if called outside of process()
protected IWorkspace getWorkspace()
process()
method,
or null if outside.
protected final IQueue getActiveQueue() throws WorkPropertyException
process()
; if called
elsewhere, it should always return a null.
Lookup order:
WorkPropertyException
- if called outside of process()protected java.util.List getActiveNodes() throws WorkPropertyException
getActiveQueue()
to get the current IQueue, and the
"start-index" and "end-index" properties to choose a subset of
the nodes in the active queue. Both start and end indices are
inclusive, so given an array of [0, 1, 2, 3, 4], with a start-index
of 1 and an end-index of 3, the subset of active nodes would be
[1, 2, 3].
WorkPropertyException
- if called outside of process()protected abstract void doWork() throws ProcessException
process()
method sets up the in-process properties, then
calls into this method.
ProcessException
- if a fatal error occurs during processingpublic void process(IWorkProperties runtimeProps, IWorkspace workspace) throws ProcessException
The process()
method can be called many times for a single
IWorker instance throughout a processing run; state should not be cached
between process()
invocations.
process
in interface IWorker
runtimeProps
- extra runtime parametersworkspace
- processing environment
ProcessException
- if a fatal error occurs during processing,
if any mandatory parameters are missing, if any parameters
are invalid, or if workspace parameter is nullprotected void setTerminalPriority(AlertPriority priority)
The problem levels are, in order of decreasing priority:
AlertPriority.FATAL
AlertPriority.ERROR
AlertPriority.WARNING
AlertPriority.INFO
priority
- level or above to throw exceptions, or null to never
throw exceptionsprotected void handleFatalProblem(java.lang.String message, ProcessException e) throws ProcessException
message
- problem descriptione
- the thrown exception, if any
ProcessException
- if IWorker is set up to rethrow this type of
problem; will always be the same exception passed inprotected void handleErrorProblem(java.lang.String message, ProcessException e) throws ProcessException
message
- problem descriptione
- the thrown exception, if any
ProcessException
- if IWorker is set up to rethrow this type of
problem; will always be the same exception passed inprotected void handleWarningProblem(java.lang.String message, ProcessException e) throws ProcessException
message
- problem descriptione
- the thrown exception, if any
ProcessException
- if IWorker is set up to rethrow this type of
problem; will always be the same exception passed inprotected void handleInfoProblem(java.lang.String message, ProcessException e) throws ProcessException
message
- problem descriptione
- the thrown exception, if any
ProcessException
- if IWorker is set up to rethrow this type of
problem; will always be the same exception passed in
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |