|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.orbeon.oxf.processor.ProcessorImpl
public abstract class ProcessorImpl
Helper class that implements default method of the Processor interface.
Nested Class Summary | |
---|---|
static class |
ProcessorImpl.KeyValidity
|
class |
ProcessorImpl.ProcessorKey
|
protected class |
ProcessorImpl.ProcessorOutputImpl
|
Field Summary | |
---|---|
static String |
INPUT_CONFIG
|
static String |
INPUT_DATA
|
static org.apache.log4j.Logger |
logger
|
static String |
OUTPUT_DATA
|
protected static String |
PARENT_PROCESSORS
This is for internal pipeline engine use. |
static String |
PROCESSOR_INPUT_SCHEME
|
static int |
PROCESSOR_SEQUENCE_NUMBER
|
static String |
PROCESSOR_VALIDATION_FLAG
|
static String |
SAX_INSPECTION_FLAG
|
static String |
USER_VALIDATION_FLAG
|
Constructor Summary | |
---|---|
protected |
ProcessorImpl()
|
Method Summary | |
---|---|
void |
addInput(String inputName,
ProcessorInput input)
|
protected void |
addInputInfo(ProcessorInputOutputInfo inputInfo)
|
void |
addOutput(String name,
ProcessorOutput output)
|
protected void |
addOutputInfo(ProcessorInputOutputInfo outputInfo)
|
ProcessorInput |
createInput(String name)
Creates a new input on this processor. |
ProcessorOutput |
createOutput(String outputName)
Creates a new output on this processor. |
void |
deleteInput(ProcessorInput input)
Deletes an input previously created with createInput(String
name) |
void |
deleteOutput(ProcessorOutput output)
Deletes an output previously created with createOutput(String
name) |
long |
findInputLastModified(PipelineContext pipelineContext,
ProcessorInput input,
boolean inputMustBeInCache)
Find the last modified timestamp of a particular input. |
static long |
findLastModified(Object validity)
Recursively find the last modified timestamp of a validity object. |
Map<String,List<ProcessorInput>> |
getConnectedInputs()
|
Map<String,ProcessorOutput> |
getConnectedOutputs()
|
String |
getId()
A processor may have an "identifier". |
ProcessorInput |
getInputByName(String name)
|
ProcessorInputOutputInfo |
getInputInfo(String name)
|
static OutputCacheKey |
getInputKey(PipelineContext context,
ProcessorInput input)
|
ProcessorImpl.KeyValidity |
getInputKeyValidity(PipelineContext context,
ProcessorInput input)
Subclasses can use this utility method to obtain the key and validity associated with an input when implementing the getKey and getValidity methods. |
Set<String> |
getInputNames()
|
List<ProcessorInput> |
getInputsByName(String name)
|
List<ProcessorInputOutputInfo> |
getInputsInfo()
|
static Object |
getInputValidity(PipelineContext context,
ProcessorInput input)
|
LocationData |
getLocationData()
When this processor is created based on a declaration in an XML document, the LocationData provides information about the location of this declaration. |
org.dom4j.QName |
getName()
Name of the processor, if it has been created by a factory and that factory has a name. |
ProcessorOutput |
getOutputByName(String outputName)
|
int |
getOutputCount()
|
List<ProcessorInputOutputInfo> |
getOutputsInfo()
|
static String |
getProcessorInputSchemeInputName(String uri)
Return the input name if the URI is referring to a processor input, null otherwise. |
ProcessorImpl.ProcessorKey |
getProcessorKey(PipelineContext context)
Returns a key that should be used to store the state of the processor in the context. |
protected PropertySet |
getPropertySet()
Return a property set for this processor. |
int |
getSequenceNumber()
TODO |
Object |
getState(PipelineContext pipelineContext)
This method is used to retrieve the state information set with setState(). |
boolean |
hasState(PipelineContext context)
|
boolean |
isInputInCache(PipelineContext context,
ProcessorInput input)
Subclasses can use this utility method when implementing the getKey and getValidity methods to make sure that they don't read the whole config (if we don't already have it) just to return a key/validity. |
static boolean |
isProcessorInputScheme(String uri)
Check if the given URI is referring to a processor input. |
Document |
readCacheInputAsDOM(PipelineContext context,
String inputName)
|
org.dom4j.Document |
readCacheInputAsDOM4J(PipelineContext context,
String inputName)
|
Object |
readCacheInputAsObject(PipelineContext pipelineContext,
ProcessorInput input,
CacheableInputReader reader)
To be used in the readImpl implementation of a processor when an object is created based on an input (an the object only depends on the input). |
Object |
readCacheInputAsObject(PipelineContext pipelineContext,
ProcessorInput input,
CacheableInputReader reader,
boolean logCache)
|
org.orbeon.saxon.om.DocumentInfo |
readCacheInputAsTinyTree(PipelineContext pipelineContext,
org.orbeon.saxon.Configuration configuration,
String inputName)
|
Document |
readInputAsDOM(PipelineContext context,
ProcessorInput input)
|
org.dom4j.Document |
readInputAsDOM4J(PipelineContext context,
ProcessorInput input)
|
static void |
readInputAsSAX(PipelineContext context,
ProcessorInput input,
XMLReceiver xmlReceiver)
The fundamental read method based on SAX. |
org.orbeon.saxon.om.DocumentInfo |
readInputAsTinyTree(PipelineContext pipelineContext,
org.orbeon.saxon.Configuration configuration,
ProcessorInput input)
|
void |
reset(PipelineContext pipelineContext)
Resets the processor. |
void |
setId(String id)
|
void |
setLocationData(LocationData loc)
|
void |
setName(org.dom4j.QName name)
|
void |
setState(PipelineContext context,
Object state)
This method is used by processor implementations to store state information tied to the current execution of the current processor, across processor initialization as well as reads of all the processor's outputs. |
void |
start(PipelineContext pipelineContext)
This method is called to trigger the execution of this processor. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static org.apache.log4j.Logger logger
public static final String INPUT_DATA
public static final String INPUT_CONFIG
public static final String OUTPUT_DATA
public static final String PROCESSOR_VALIDATION_FLAG
public static final String USER_VALIDATION_FLAG
public static final String SAX_INSPECTION_FLAG
public static int PROCESSOR_SEQUENCE_NUMBER
public static final String PROCESSOR_INPUT_SCHEME
protected static final String PARENT_PROCESSORS
Constructor Detail |
---|
protected ProcessorImpl()
Method Detail |
---|
public int getSequenceNumber()
Processor
getSequenceNumber
in interface Processor
protected PropertySet getPropertySet()
public LocationData getLocationData()
Processor
getLocationData
in interface Processor
public void setLocationData(LocationData loc)
setLocationData
in interface Processor
loc
- the new LocationData of this processorProcessor.getLocationData()
public void setId(String id)
setId
in interface Processor
id
- the new id of this processorProcessor.getId()
public String getId()
Processor
getId
in interface Processor
public org.dom4j.QName getName()
Processor
getName
in interface Processor
public void setName(org.dom4j.QName name)
setName
in interface Processor
name
- The new name of this processorProcessor.getName()
public ProcessorInput getInputByName(String name)
getInputByName
in interface Processor
name
- Name of the input
createInput(String name)
. Returns null
if there is no existing input with this name.Processor.createInput(java.lang.String)
public List<ProcessorInput> getInputsByName(String name)
public ProcessorInput createInput(String name)
Processor
createInput
in interface Processor
name
- Name of the input to create
public void addInput(String inputName, ProcessorInput input)
public void deleteInput(ProcessorInput input)
Processor
createInput(String
name)
deleteInput
in interface Processor
input
- Name of the input to deleteProcessor.createInput(java.lang.String)
public ProcessorOutput getOutputByName(String outputName)
getOutputByName
in interface Processor
outputName
- Name of the output
createOutput(String name)
. Returns
null
if there is no existing output with this name.Processor.createOutput(java.lang.String)
public ProcessorOutput createOutput(String outputName)
Processor
createOutput
in interface Processor
outputName
- Name of the output to create. null is allowed.
public void addOutput(String name, ProcessorOutput output)
public int getOutputCount()
public void deleteOutput(ProcessorOutput output)
Processor
createOutput(String
name)
deleteOutput
in interface Processor
output
- Name of the output to deleteProcessor.createOutput(java.lang.String)
protected void addInputInfo(ProcessorInputOutputInfo inputInfo)
protected void addOutputInfo(ProcessorInputOutputInfo outputInfo)
public Set<String> getInputNames()
getInputNames
in interface Processor
public List<ProcessorInputOutputInfo> getInputsInfo()
getInputsInfo
in interface Processor
ProcessorInputOutputInfo
objects
corresponding to the inputs that can be created on this
processor. This exposes the "input API" of this processor.public Map<String,List<ProcessorInput>> getConnectedInputs()
getConnectedInputs
in interface Processor
ProcessorInput
objects. This is particularly
useful to detect whether optional inputs are connected.public ProcessorInputOutputInfo getInputInfo(String name)
public List<ProcessorInputOutputInfo> getOutputsInfo()
getOutputsInfo
in interface Processor
ProcessorInputOutputInfo
objects
corresponding to the outputs that can be created on this
processor. This exposes the "outputs API" of this processor.public Map<String,ProcessorOutput> getConnectedOutputs()
getConnectedOutputs
in interface Processor
ProcessorOutput
objects. This is particularly
useful to detect whether optional outputs are connected.public static void readInputAsSAX(PipelineContext context, ProcessorInput input, XMLReceiver xmlReceiver)
public Document readInputAsDOM(PipelineContext context, ProcessorInput input)
public org.dom4j.Document readInputAsDOM4J(PipelineContext context, ProcessorInput input)
public org.orbeon.saxon.om.DocumentInfo readInputAsTinyTree(PipelineContext pipelineContext, org.orbeon.saxon.Configuration configuration, ProcessorInput input)
public Document readCacheInputAsDOM(PipelineContext context, String inputName)
public org.dom4j.Document readCacheInputAsDOM4J(PipelineContext context, String inputName)
public org.orbeon.saxon.om.DocumentInfo readCacheInputAsTinyTree(PipelineContext pipelineContext, org.orbeon.saxon.Configuration configuration, String inputName)
public Object readCacheInputAsObject(PipelineContext pipelineContext, ProcessorInput input, CacheableInputReader reader)
input
- The input the object depends onreader
- The code constructing the object based on the input
public Object readCacheInputAsObject(PipelineContext pipelineContext, ProcessorInput input, CacheableInputReader reader, boolean logCache)
public Object getState(PipelineContext pipelineContext)
getState
in interface Processor
pipelineContext
- current context
public void setState(PipelineContext context, Object state)
context
- current PipelineContext objectstate
- user-defined object containing state informationpublic boolean hasState(PipelineContext context)
public ProcessorImpl.ProcessorKey getProcessorKey(PipelineContext context)
public void start(PipelineContext pipelineContext)
Processor
read
should be called on the outputs instead.
start
in interface Processor
pipelineContext
- Context in which the processor is executedpublic void reset(PipelineContext pipelineContext)
Processor
read its outputs, or by calling
start
on the processor.
- Specified by:
reset
in interface Processor
- Parameters:
pipelineContext
- Context in which the processor is executed
public static boolean isProcessorInputScheme(String uri)
public static String getProcessorInputSchemeInputName(String uri)
public static OutputCacheKey getInputKey(PipelineContext context, ProcessorInput input)
public static Object getInputValidity(PipelineContext context, ProcessorInput input)
public boolean isInputInCache(PipelineContext context, ProcessorInput input)
isInputInCache
in interface Processor
public ProcessorImpl.KeyValidity getInputKeyValidity(PipelineContext context, ProcessorInput input)
public long findInputLastModified(PipelineContext pipelineContext, ProcessorInput input, boolean inputMustBeInCache)
pipelineContext
- pipeline contextinput
- input to checkinputMustBeInCache
- if true, also return 0 if the input is not currently in cache
public static long findLastModified(Object validity)
validity
- validity object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |