|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.orbeon.oxf.processor.ProcessorImpl
Helper class that implements default method of the Processor interface.
Nested Class Summary | |
class |
ProcessorImpl.CacheableTransformerOutputImpl
Implementation of a caching transformer output that assumes that an output simply depends on all the inputs plus optional local information. |
protected static class |
ProcessorImpl.DigestState
|
class |
ProcessorImpl.DigestTransformerOutputImpl
Implementation of a caching transformer output that assumes that an output simply depends on all the inputs plus optional local information that can be digested. |
static class |
ProcessorImpl.KeyValidity
|
static class |
ProcessorImpl.ProcessorInputImpl
Basic implementation of ProcessorInput. |
class |
ProcessorImpl.ProcessorKey
|
static class |
ProcessorImpl.ProcessorOutputImpl
Basic implementation of ProcessorOutput. |
Field Summary | |
static org.orbeon.oxf.util.IndentedLogger |
indentedLogger
|
static String |
INPUT_CONFIG
|
static String |
INPUT_DATA
|
static char |
KEY_SEPARATOR
|
static org.apache.log4j.Logger |
logger
|
static String |
OUTPUT_DATA
|
static String |
PROCESSOR_INPUT_SCHEME
|
static String |
PROCESSOR_INPUT_SCHEME_OLD
|
static String |
PROCESSOR_VALIDATION_FLAG
|
static String |
SAX_INSPECTION_FLAG
|
static String |
USER_VALIDATION_FLAG
|
Constructor Summary | |
ProcessorImpl()
|
Method Summary | |
void |
addInput(String name,
org.orbeon.oxf.processor.ProcessorInput input)
|
protected void |
addInputInfo(ProcessorInputOutputInfo inputInfo)
|
void |
addOutput(String name,
org.orbeon.oxf.processor.ProcessorOutput output)
|
protected void |
addOutputInfo(ProcessorInputOutputInfo outputInfo)
|
void |
checkSockets()
|
org.orbeon.oxf.processor.ProcessorInput |
createInput(String name)
Creates a new input on this processor. |
org.orbeon.oxf.processor.ProcessorOutput |
createOutput(String name)
Creates a new output on this processor. |
void |
deleteInput(org.orbeon.oxf.processor.ProcessorInput input)
Deletes an input previously created with createInput(String
name) |
void |
deleteOutput(org.orbeon.oxf.processor.ProcessorOutput output)
Deletes an output previously created with createOutput(String
name) |
protected void |
executeChildren(PipelineContext context,
Runnable runnable)
For use in processor that contain other processors. |
protected static void |
executeParents(PipelineContext context,
Runnable runnable)
For use in processor that contain other processors. |
protected long |
findInputLastModified(PipelineContext pipelineContext,
org.orbeon.oxf.processor.ProcessorInput input,
boolean inputMustBeInCache)
Find the last modified timestamp of a particular input. |
protected static long |
findLastModified(Object validity)
Recursively find the last modified timestamp of a validity object. |
protected Object |
getCachedInputAsObject(PipelineContext pipelineContext,
org.orbeon.oxf.processor.ProcessorInput processorInput)
|
protected Object |
getCacheOutputObject(PipelineContext pipelineContext,
ProcessorImpl.ProcessorOutputImpl processorOutput,
String keyName,
org.orbeon.oxf.processor.OutputObjectCreator creator)
Cache an object associated with a given processor output. |
Map |
getConnectedInputs()
|
Map |
getConnectedOutputs()
|
String |
getId()
A processor may have an "identifier". |
org.orbeon.oxf.processor.ProcessorInput |
getInputByName(String name)
|
ProcessorInputOutputInfo |
getInputInfo(String name)
|
protected static org.orbeon.oxf.cache.OutputCacheKey |
getInputKey(PipelineContext context,
org.orbeon.oxf.processor.ProcessorInput input)
|
protected ProcessorImpl.KeyValidity |
getInputKeyValidity(PipelineContext context,
org.orbeon.oxf.processor.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. |
protected ProcessorImpl.KeyValidity |
getInputKeyValidity(PipelineContext context,
String inputName)
|
List |
getInputsByName(String name)
|
List |
getInputsInfo()
|
protected static Object |
getInputValidity(PipelineContext context,
org.orbeon.oxf.processor.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. |
QName |
getName()
Name of the processor, if it has been created by a factory and that factory has a name. |
org.orbeon.oxf.processor.ProcessorOutput |
getOutputByName(String name)
|
ProcessorInputOutputInfo |
getOutputInfo(String name)
|
protected Object |
getOutputObject(PipelineContext pipelineContext,
ProcessorImpl.ProcessorOutputImpl processorOutput,
String keyName)
Get a cached object associated with a given processor output. |
protected Object |
getOutputObject(PipelineContext pipelineContext,
ProcessorImpl.ProcessorOutputImpl processorOutput,
String keyName,
ProcessorImpl.KeyValidity outputKeyValidityImpl)
|
List |
getOutputsInfo()
|
protected static Object |
getParentState(PipelineContext context)
|
static String |
getProcessorInputSchemeInputName(String uri)
Return the input name if the URI is referring to a processor input, null otherwise. |
protected ProcessorImpl.ProcessorKey |
getProcessorKey(PipelineContext context)
Returns a key that should be used to store the state of the processor in the context. |
protected org.orbeon.oxf.properties.PropertySet |
getPropertySet()
Return a property set for this processor. |
Object |
getState(PipelineContext context)
This method is used to retrieve the state information set with setState(). |
protected boolean |
hasState(PipelineContext context)
|
protected boolean |
isInputInCache(PipelineContext context,
ProcessorImpl.KeyValidity keyValidity)
|
protected boolean |
isInputInCache(PipelineContext context,
org.orbeon.oxf.processor.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. |
protected boolean |
isInputInCache(PipelineContext context,
String inputName)
|
static boolean |
isProcessorInputScheme(String uri)
Check if the given URI is referring to a processor input. |
protected Document |
readCacheInputAsDOM(PipelineContext context,
String inputName)
|
protected Document |
readCacheInputAsDOM4J(PipelineContext context,
String inputName)
|
protected Object |
readCacheInputAsObject(PipelineContext context,
org.orbeon.oxf.processor.ProcessorInput input,
org.orbeon.oxf.processor.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). |
protected org.orbeon.saxon.om.DocumentInfo |
readCacheInputAsTinyTree(PipelineContext context,
String inputName)
|
protected Document |
readInputAsDOM(PipelineContext context,
org.orbeon.oxf.processor.ProcessorInput input)
|
protected Document |
readInputAsDOM(PipelineContext context,
String inputName)
|
protected Document |
readInputAsDOM4J(PipelineContext context,
org.orbeon.oxf.processor.ProcessorInput input)
|
protected Document |
readInputAsDOM4J(PipelineContext context,
String inputName)
|
protected static void |
readInputAsSAX(PipelineContext context,
org.orbeon.oxf.processor.ProcessorInput input,
ContentHandler contentHandler)
The fundamental read method based on SAX. |
protected void |
readInputAsSAX(PipelineContext context,
String inputName,
ContentHandler contentHandler)
|
protected org.orbeon.saxon.om.DocumentInfo |
readInputAsTinyTree(PipelineContext context,
org.orbeon.oxf.processor.ProcessorInput input)
|
protected void |
removeInputInfo(ProcessorInputOutputInfo inputInfo)
|
protected void |
removeOutputInfo(ProcessorInputOutputInfo outputInfo)
|
void |
reset(PipelineContext pipelineContext)
Resets the processor. |
void |
setId(String id)
|
void |
setLocationData(LocationData loc)
|
void |
setName(QName name)
|
protected 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 org.orbeon.oxf.util.IndentedLogger indentedLogger
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 final char KEY_SEPARATOR
public static final String PROCESSOR_INPUT_SCHEME_OLD
public static final String PROCESSOR_INPUT_SCHEME
Constructor Detail |
public ProcessorImpl()
Method Detail |
protected org.orbeon.oxf.properties.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 QName getName()
Processor
getName
in interface Processor
public void setName(QName name)
setName
in interface Processor
name
- The new name of this processorProcessor.getName()
public org.orbeon.oxf.processor.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 getInputsByName(String name)
public org.orbeon.oxf.processor.ProcessorInput createInput(String name)
Processor
createInput
in interface Processor
name
- Name of the input to create
public void addInput(String name, org.orbeon.oxf.processor.ProcessorInput input)
public void deleteInput(org.orbeon.oxf.processor.ProcessorInput input)
Processor
createInput(String
name)
deleteInput
in interface Processor
input
- Name of the input to deleteProcessor.createInput(java.lang.String)
public org.orbeon.oxf.processor.ProcessorOutput getOutputByName(String name)
getOutputByName
in interface Processor
name
- Name of the output
createOutput(String name)
. Returns
null
if there is no existing output with this name.Processor.createOutput(java.lang.String)
public org.orbeon.oxf.processor.ProcessorOutput createOutput(String name)
Processor
createOutput
in interface Processor
name
- Name of the output to create. null is allowed.
public void addOutput(String name, org.orbeon.oxf.processor.ProcessorOutput output)
public void deleteOutput(org.orbeon.oxf.processor.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 removeInputInfo(ProcessorInputOutputInfo inputInfo)
protected void addOutputInfo(ProcessorInputOutputInfo outputInfo)
protected void removeOutputInfo(ProcessorInputOutputInfo outputInfo)
public List 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 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 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 getConnectedOutputs()
getConnectedOutputs
in interface Processor
ProcessorOutput
objects. This is particularly
useful to detect whether optional outputs are connected.public ProcessorInputOutputInfo getOutputInfo(String name)
public void checkSockets()
protected static void readInputAsSAX(PipelineContext context, org.orbeon.oxf.processor.ProcessorInput input, ContentHandler contentHandler)
protected void readInputAsSAX(PipelineContext context, String inputName, ContentHandler contentHandler)
protected Document readInputAsDOM(PipelineContext context, org.orbeon.oxf.processor.ProcessorInput input)
protected Document readInputAsDOM4J(PipelineContext context, org.orbeon.oxf.processor.ProcessorInput input)
protected org.orbeon.saxon.om.DocumentInfo readInputAsTinyTree(PipelineContext context, org.orbeon.oxf.processor.ProcessorInput input)
protected Document readInputAsDOM(PipelineContext context, String inputName)
protected Document readInputAsDOM4J(PipelineContext context, String inputName)
protected Document readCacheInputAsDOM(PipelineContext context, String inputName)
protected Document readCacheInputAsDOM4J(PipelineContext context, String inputName)
protected org.orbeon.saxon.om.DocumentInfo readCacheInputAsTinyTree(PipelineContext context, String inputName)
protected Object readCacheInputAsObject(PipelineContext context, org.orbeon.oxf.processor.ProcessorInput input, org.orbeon.oxf.processor.CacheableInputReader reader)
input
- The input the object depends onreader
- The code constructing the object based on the input
protected Object getCachedInputAsObject(PipelineContext pipelineContext, org.orbeon.oxf.processor.ProcessorInput processorInput)
protected void executeChildren(PipelineContext context, Runnable runnable)
protected static void executeParents(PipelineContext context, Runnable runnable)
protected static Object getParentState(PipelineContext context)
public Object getState(PipelineContext context)
context
- current PipelineContext object
protected void setState(PipelineContext context, Object state)
context
- current PipelineContext objectstate
- user-defined object containing state informationprotected boolean hasState(PipelineContext context)
protected ProcessorImpl.ProcessorKey getProcessorKey(PipelineContext context)
Returns a key that should be used to store the state of the processor in the context.
This method must be called in ProcessorOutput.readImpl() or start() of the processors before read/start is called on other processors. (The key returned by getProcessorKey can be used after read/start is called.)
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)
protected static org.orbeon.oxf.cache.OutputCacheKey getInputKey(PipelineContext context, org.orbeon.oxf.processor.ProcessorInput input)
protected static Object getInputValidity(PipelineContext context, org.orbeon.oxf.processor.ProcessorInput input)
protected boolean isInputInCache(PipelineContext context, org.orbeon.oxf.processor.ProcessorInput input)
protected boolean isInputInCache(PipelineContext context, String inputName)
protected boolean isInputInCache(PipelineContext context, ProcessorImpl.KeyValidity keyValidity)
protected ProcessorImpl.KeyValidity getInputKeyValidity(PipelineContext context, org.orbeon.oxf.processor.ProcessorInput input)
protected ProcessorImpl.KeyValidity getInputKeyValidity(PipelineContext context, String inputName)
protected Object getCacheOutputObject(PipelineContext pipelineContext, ProcessorImpl.ProcessorOutputImpl processorOutput, String keyName, org.orbeon.oxf.processor.OutputObjectCreator creator)
pipelineContext
- current PipelineContextprocessorOutput
- output to associate withkeyName
- key for the object to cachecreator
- creator for the object
protected Object getOutputObject(PipelineContext pipelineContext, ProcessorImpl.ProcessorOutputImpl processorOutput, String keyName)
pipelineContext
- current PipelineContextprocessorOutput
- output to associate withkeyName
- key for the object to cache
protected Object getOutputObject(PipelineContext pipelineContext, ProcessorImpl.ProcessorOutputImpl processorOutput, String keyName, ProcessorImpl.KeyValidity outputKeyValidityImpl)
protected long findInputLastModified(PipelineContext pipelineContext, org.orbeon.oxf.processor.ProcessorInput input, boolean inputMustBeInCache)
pipelineContext
- pipeline contextinput
- input to checkinputMustBeInCache
- if true, also return 0 if the input is not currently in cache
protected static long findLastModified(Object validity)
validity
- validity object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |