Class AbstractProcessor<TDef extends IElementDef>
- java.lang.Object
-
- org.webharvest.runtime.processors.AbstractProcessor<TDef>
-
- All Implemented Interfaces:
Processor<TDef>
- Direct Known Subclasses:
BodyProcessor
,CallParamProcessor
,CallProcessor
,CaseProcessor
,ConfigProcessor
,ConstantProcessor
,EmptyProcessor
,ExitProcessor
,FileProcessor
,FunctionProcessor
,HtmlToXmlProcessor
,HttpHeaderProcessor
,HttpParamProcessor
,HttpProcessor
,IncludeProcessor
,LoopProcessor
,RegexpProcessor
,ReturnProcessor
,ScriptProcessor
,TemplateProcessor
,TextProcessor
,TryProcessor
,VarDefProcessor
,VarProcessor
,WebHarvestPlugin
,WhileProcessor
,XPathProcessor
,XQueryProcessor
,XsltProcessor
public abstract class AbstractProcessor<TDef extends IElementDef> extends Object implements Processor<TDef>
Base processor that contains common processor logic. All other processors extend this class.
-
-
Field Summary
Fields Modifier and Type Field Description protected TDef
elementDef
protected static org.slf4j.Logger
LOG
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractProcessor()
protected
AbstractProcessor(ProcessorExecutionStrategy executionStrategy)
Constructor with custom execution strategy (for testing).
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
debug(IElementDef elementDef, DynamicScopeContext context, Variable variable)
protected abstract Variable
execute(DynamicScopeContext context)
protected Variable
getBodyTextContent(IElementDef elementDef, DynamicScopeContext context)
protected Variable
getBodyTextContent(IElementDef elementDef, DynamicScopeContext context, boolean registerExecution)
protected Variable
getBodyTextContent(IElementDef elementDef, DynamicScopeContext context, boolean registerExecution, KeyValuePair[] properties)
TDef
getElementDef()
Processor
getParentProcessor()
Returns reference to parentProcessor
of this processor.int
getRunningLevel()
Returns information how deep in processors hierarchy is thisProcessor
.Variable
run(DynamicScopeContext context)
Template method that defines the execution flow.void
setElementDef(TDef elementDef)
Sets appropriate element definition to the processor.void
setParentProcessor(Processor parentProcessor)
Sets reference to parentProcessor
.protected void
setProperty(String name, Object value)
Defines processor runtime property with specified name and value.
-
-
-
Field Detail
-
LOG
protected static final org.slf4j.Logger LOG
-
elementDef
protected TDef extends IElementDef elementDef
-
-
Constructor Detail
-
AbstractProcessor
protected AbstractProcessor()
-
AbstractProcessor
protected AbstractProcessor(ProcessorExecutionStrategy executionStrategy)
Constructor with custom execution strategy (for testing).
-
-
Method Detail
-
execute
protected abstract Variable execute(DynamicScopeContext context) throws InterruptedException
- Throws:
InterruptedException
-
run
public Variable run(DynamicScopeContext context) throws InterruptedException
Template method that defines the execution flow. Uses Template Method pattern to separate common logic from specific implementation.- Specified by:
run
in interfaceProcessor<TDef extends IElementDef>
- Throws:
InterruptedException
-
setProperty
protected void setProperty(String name, Object value)
Defines processor runtime property with specified name and value.- Parameters:
name
- name of the propertyvalue
- value of the property
-
getBodyTextContent
protected Variable getBodyTextContent(IElementDef elementDef, DynamicScopeContext context, boolean registerExecution, KeyValuePair[] properties) throws InterruptedException
- Throws:
InterruptedException
-
getBodyTextContent
protected Variable getBodyTextContent(IElementDef elementDef, DynamicScopeContext context, boolean registerExecution) throws InterruptedException
- Throws:
InterruptedException
-
getBodyTextContent
protected Variable getBodyTextContent(IElementDef elementDef, DynamicScopeContext context) throws InterruptedException
- Throws:
InterruptedException
-
setElementDef
public void setElementDef(TDef elementDef)
Sets appropriate element definition to the processor.- Specified by:
setElementDef
in interfaceProcessor<TDef extends IElementDef>
- Parameters:
elementDef
- the element definition
-
getElementDef
public TDef getElementDef()
- Specified by:
getElementDef
in interfaceProcessor<TDef extends IElementDef>
-
debug
protected void debug(IElementDef elementDef, DynamicScopeContext context, Variable variable)
-
setParentProcessor
public void setParentProcessor(Processor parentProcessor)
Sets reference to parentProcessor
.- Specified by:
setParentProcessor
in interfaceProcessor<TDef extends IElementDef>
-
getParentProcessor
public Processor getParentProcessor()
Returns reference to parentProcessor
of this processor.- Specified by:
getParentProcessor
in interfaceProcessor<TDef extends IElementDef>
-
getRunningLevel
public int getRunningLevel()
Returns information how deep in processors hierarchy is thisProcessor
. Value of the lowest level is1
.- Specified by:
getRunningLevel
in interfaceProcessor<TDef extends IElementDef>
-
-