Skip navigation links

Oracle® Database XML Java API Reference
12c Release 1 (12.1)

E15981-09


oracle.xml.pipeline.controller
Class Process

java.lang.Object
  extended by oracle.xml.pipeline.controller.Process

All Implemented Interfaces:
java.lang.Runnable, PipelineConstants, ErrorHandler
Direct Known Subclasses:
CompressReaderProcess, CompressWriterProcess, DOMParserProcess, SAXParserProcess, XPathProcess, XSDSchemaBuilder, XSDValProcess, XSLProcess, XSLStylesheetProcess

public class Process
extends java.lang.Object
implements java.lang.Runnable, PipelineConstants, ErrorHandler

Base class for all pipeline process definitions. To create a custom pipeline process, you need to create a class which extends from the Process class. At the minimum, every custom process should overwrite the initialize() and execute() method of this class. If the custom process takes SAX events as input, it should overwrite the SAXContentHandler() method to return the appropriate ContentHandler which will handle incoming SAX events.


Field Summary

 

Fields inherited from interface oracle.xml.pipeline.controller.PipelineConstants
COMPSTREAMRESULT, COMPSTREAMSOURCE, DOCFRAG, DOCUMENT, DOMRESULT, DOMSOURCE, ELEMENT, PROCESS_WAITING, SAXRESULT, SAXSOURCE, STREAMRESULT, STREAMSOURCE

 

Method Summary
 void convertFromDOM(DOMResult res, Output output)
          Should be called by the Process which outputs DOM.
 void convertFromSAX(SAXResult result, Output output)
          Should be called by the Process which outputs SAX events.
 void convertFromStream(StreamResult res, Output output)
          Should be called by the Process which outputs xml as Stream.
 void error(int type, java.lang.Exception e)
          Called by a custom Process whenever an error occurs.
 XMLDocument getErrorDocument(java.lang.String errorName, boolean convert)
          Get the error element as an XML Document tree
 Source getErrorSource(java.lang.String errorName)
          Retrieve the error element as Source
 java.io.InputStream getErrorStream(java.lang.String errorName, boolean convert)
          Get the error element as an Input stream for reading error.
 void getErrorStream(java.lang.String errorName, java.io.OutputStream out, boolean convert)
          Write the error element to the outputstream provided.
 java.lang.Object getInParamValue(java.lang.String name)
          Get an input param value based on its name
 Input getInput(java.lang.String inputName)
          Retrieve the Input object by name
 java.lang.Object getOutParamValue(java.lang.String name)
          Get the output param value based on its name
 Output getOutput(java.lang.String outputName)
          Retrieve a particular output by name
 java.io.OutputStream getOutputStream(java.lang.String outputName)
          Get the output stream for printing to a specific output
 java.io.Writer getOutputWriter(java.lang.String outputName)
          Get the output writer for writing to a specific output
 ContentHandler getSAXContentHandler(Output out)
          Get the ContentHandler which will handle the sax events generated.
 ErrorHandler getSAXErrorHandler(Output out)
          Get the SAX ErrorHandler which will handle the sax error events generated.
 void info(java.lang.String msg)
          Called by a Process to report an informational message and continue with execution.
 void setOutputResult(java.lang.String outputName, Result res)
          All user defined processes (extending from Process) need to create a Result object and set it in the output using this method.

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Methods inherited from interface java.lang.Runnable
run

 

Methods inherited from interface org.xml.sax.ErrorHandler
error, fatalError, warning

 

Method Detail

getInput

public final Input getInput(java.lang.String inputName)
Retrieve the Input object by name
Parameters:
inputName - input name as String
Returns:
Input object if there one by inputName, otherwise null

getOutput

public Output getOutput(java.lang.String outputName)
Retrieve a particular output by name
Parameters:
outputName - as a String
Returns:
Output object, null if no output by this name exists

getInParamValue

public final java.lang.Object getInParamValue(java.lang.String name)
Get an input param value based on its name
Parameters:
name - name of InParam as String
Returns:
InParam value as type Object, null if none exists

getOutParamValue

public final java.lang.Object getOutParamValue(java.lang.String name)
Get the output param value based on its name
Parameters:
name - OutParam name as String
Returns:
OutParam value of type Object

setOutputResult

public final void setOutputResult(java.lang.String outputName,
                                  Result res)
All user defined processes (extending from Process) need to create a Result object and set it in the output using this method.
Parameters:
outputName - as String
res - Result object

getOutputStream

public final java.io.OutputStream getOutputStream(java.lang.String outputName)
                                           throws java.io.FileNotFoundException,
                                                  java.io.IOException
Get the output stream for printing to a specific output
Parameters:
outputName - name of output
Returns:
OutputStream for printing
Throws:
java.io.FileNotFoundException
java.io.IOException

getOutputWriter

public final java.io.Writer getOutputWriter(java.lang.String outputName)
                                     throws java.io.FileNotFoundException,
                                            java.io.IOException
Get the output writer for writing to a specific output
Parameters:
outputName - name of output
Returns:
Writer for printing
Throws:
java.io.FileNotFoundException
java.io.IOException

getErrorSource

public Source getErrorSource(java.lang.String errorName)
Retrieve the error element as Source
Parameters:
errorName - name of error from pipeline document
Returns:
Source error element as a Source object

getErrorStream

public void getErrorStream(java.lang.String errorName,
                           java.io.OutputStream out,
                           boolean convert)
                    throws java.io.IOException
Write the error element to the outputstream provided. If convert is true then convert from error node to stream.
Parameters:
errorName - name of error element
out - outputstream to write to
convert - convert from DOM to stream or not
Throws:
java.io.IOException - while writing to outputstream

getErrorStream

public final java.io.InputStream getErrorStream(java.lang.String errorName,
                                                boolean convert)
                                         throws java.io.IOException
Get the error element as an Input stream for reading error.
Parameters:
errorName - error element name as String
convert - convert from Node to InputStream or not
Returns:
InputStream of of error element
Throws:
java.io.IOException - reading from error element

getErrorDocument

public XMLDocument getErrorDocument(java.lang.String errorName,
                                    boolean convert)
                             throws SAXException,
                                    XMLParseException,
                                    java.io.IOException
Get the error element as an XML Document tree
Parameters:
errorName - error element name as String
convert - convert from stream to DOM if necessary
Returns:
XMLDocument error element as XMLDocument
Throws:
SAXException - while parsing
XMLParseException - while parsing
java.io.IOException

error

public final void error(int type,
                        java.lang.Exception e)
                 throws PipelineException
Called by a custom Process whenever an error occurs.
Parameters:
type - error type as defined in PipelineConstants
e - exception
Throws:
PipelineException

info

public void info(java.lang.String msg)
Called by a Process to report an informational message and continue with execution.
Parameters:
msg - - message to report

getSAXContentHandler

public final ContentHandler getSAXContentHandler(Output out)
                                          throws PipelineException
Get the ContentHandler which will handle the sax events generated. This function will handle the conversion from SAX to DOM or Stream if its necessary. If this method returns null, then call setProcessStatus(PROCESS_WAITING), and return from execute().
Parameters:
out - the Output object which is the SAX source
Returns:
ContentHandler for taking SAX events as input to this process
Throws:
PipelineException

getSAXErrorHandler

public final ErrorHandler getSAXErrorHandler(Output out)
Get the SAX ErrorHandler which will handle the sax error events generated.
Parameters:
out - Output object which is the SAX source
Returns:
ErrorHandler will be called on input SAX error
Throws:
PipelineException

convertFromSAX

public final void convertFromSAX(SAXResult result,
                                 Output output)
                          throws java.io.FileNotFoundException,
                                 java.io.IOException
Should be called by the Process which outputs SAX events. It is assumed that the ContentHandler used by the Process has been fetched using getSAXContentHandler. This function will check the input type of the dependent process or processes and perform the conversion from SAX to DOM/Stream. The function will call setOutputResult as there could be multiple results to be set for multiple inputs
Parameters:
result - the process result as a SAXResult object
output - output object to be associated with the SAX, to be piped into the input of the next process in pipeline
Throws:
FileNoFoundException
java.io.IOException
java.io.FileNotFoundException

convertFromDOM

public final void convertFromDOM(DOMResult res,
                                 Output output)
                          throws SAXException,
                                 java.io.IOException,
                                 PipelineException
Should be called by the Process which outputs DOM. This function will check the input type of the dependent process or processes and perform the conversion from DOM to SAX/Stream. The function will call setOutputResult as there could be multiple results to be set for multiple inputs
Parameters:
res - the process result as a DOMResult object
output - output object associated with result, to be piped to the next process in pipeline
Throws:
SAXException
java.io.IOException
PipelineException

convertFromStream

public final void convertFromStream(StreamResult res,
                                    Output output)
                             throws SAXException,
                                    java.io.IOException,
                                    PipelineException
Should be called by the Process which outputs xml as Stream. This function will check the input type of the dependent process or processes and perform the conversion from Stream to DOM/SAX. The function will call setOutputResult as there could be multiple results to be set for multiple inputs.
Parameters:
res - the process result as a StreamResult object
output - output object to be associated with the result, to be piped to the input of the next process in the pipeline
Throws:
SAXException
java.io.IOException
PipelineException

Skip navigation links

Oracle® Database XML Java API Reference
12c Release 1 (12.1)

E15981-09


Copyright © 2003, 2014, Oracle and/or its affiliates. All rights reserved.