public abstract class Processor
extends java.lang.Object
Processor lifecycle model is as follows:
create() factory method
specific to each concrete Processor class;set*() methods.
Note that Processor attributes vary regarding whether they are required
or optional (have defaults);run().run()able (note that all state set via set
set*() methods is retained through each run).MT-safety: a Processor instance is safe for concurrent access from multiple concurrent threads (all public Processor methods are synchronized).
| 限定符和类型 | 字段和说明 |
|---|---|
protected java.lang.String |
m_appName |
protected Logger |
m_log |
protected IProperties |
m_propertyOverrides |
| 限定符 | 构造器和说明 |
|---|---|
protected |
Processor() |
| 限定符和类型 | 方法和说明 |
|---|---|
protected abstract void |
_run(IProperties toolProperties)
This method is implemented by each concrete Processor class to perform
tool-specific processing.
|
void |
run()
Executes this Processor's unit of work as the following sequence:
calls
validateState() to ensure all required attributes
have been set;
creates Processor-specific properties by combining
app-global properties with
property overrides for this Processor instance;
pushes a new Logger on the thread-local stack and sets it
as m_log field;
calls _run(IProperties) with Processor-specific properties;
pops the thread-local Logger stack and clears m_log. |
void |
setAppName(java.lang.String appName)
Each processor traces its execution via logging calls to
m_log. |
void |
setPropertyOverrides(IProperties overrides)
Adds optional property overrides for this Processor instance.
|
void |
setPropertyOverrides(java.util.Properties overrides)
Adds optional property overrides for this Processor instance.
|
protected void |
validateState()
Validates attribute settings before each
_run(IProperties). |
protected java.lang.String m_appName
protected IProperties m_propertyOverrides
protected Logger m_log
public void run()
validateState() to ensure all required attributes
have been set;properties by combining
app-global properties with
property overrides for this Processor instance;Logger on the thread-local stack and sets it
as m_log field;_run(IProperties) with Processor-specific properties;m_log.public final void setAppName(java.lang.String appName)
m_log.
Trace output is prefixed with a string that can be customized via this
setter.appName - [null means no prefix in tracing]public final void setPropertyOverrides(java.util.Properties overrides)
overrides - [may be null (unsets the previous overrides)]public final void setPropertyOverrides(IProperties overrides)
IProperties class and is used by stock tools.
External tool integration can use setPropertyOverrides(Properties),
which provides equivalent functionality.overrides - [may be null (unsets the previous overrides)]protected abstract void _run(IProperties toolProperties)
toolProperties - properties incorporating app-global setting and
overrides set optionally via setPropertyOverrides(Properties) or
setPropertyOverrides(IProperties) [never null]protected void validateState()
_run(IProperties).
Overridden implementations should chain to super.validateState().
java.lang.IllegalStateException - on invalid settings state (e.g., missing
settings for required attributes)Copyright © 2018. All Rights Reserved.