XML Deployment Adapters

com.stylusstudio.xmlpipeline.runtime
Interface PipelineOperation


public interface PipelineOperation

The java code for a Stylus Studio XML Pipeline implements this interface. The Stylus Studio XML Pipeline deployer creates a Java class file which implements the user's pipeline. This class contains a main() method and can be run as a standalone Java application. It can also be called from a user written Java program using the methods of this interface. The embedding java program should:


An instance of PipelineOperation is not thread safe, it must be accessed by only one thread at a time. Furthermore, it is not reusable. You can call the go() method only once.


Method Summary
 void bindInputObject(String portName, Object obj, ContentType type)
          Bind a DOM, InputStream, or a String to the named Pipeline Input node.
 void bindInputUrl(String portName, String url, ContentType type)
          Bind a URL to the named Pipeline Input node.
 void bindOutputObject(String portName, Object obj)
          Bind a DOM or OutputStream to the named Pipeline Output node.
 void bindOutputUrl(String portName, String url)
          Bind a Pipeline Output node to a URL.
 boolean canAcceptSAX(String portName)
          Determine if the named Pipeline Input node is able to accept SAX events.
 void close()
          Close all nodes in this pipeline and release all operating system resources.
 ContentHandler getContentHandler(String portName)
          Get a ContentHandler with which SAX events can be sent to the named Pipeline Input node.
 void go()
          Execute the pipeline and wait for it to terminate.
 boolean isReady(String portName)
          Check if any data was written to the named output port.
 void setBaseURI(String baseURI)
          Set the BaseURI to be used while executing the pipeline.
 

Method Detail

setBaseURI

public void setBaseURI(String baseURI)
Set the BaseURI to be used while executing the pipeline. The pipeline contains, internally, a BaseURI. If the generated java code and related files (.xquery, .xslt, etc) are then moved to a different location, the internal BaseURI must be overridden by calling this method immediately after invoking the default pipeline constructor.

Parameters:
baseURI - The URI which should be used when resolving all relative URI references.

bindInputObject

public void bindInputObject(String portName,
                            Object obj,
                            ContentType type)
                     throws PipelineException
Bind a DOM, InputStream, or a String to the named Pipeline Input node.

Parameters:
portName - The name of the Pipeline Input node.
obj - The object to be bound. It must be an instance of Document, InputStream or String.
type - Indicates what type of data the input object contains.
Throws:
PipelineException

bindInputUrl

public void bindInputUrl(String portName,
                         String url,
                         ContentType type)
                  throws PipelineException
Bind a URL to the named Pipeline Input node. The URL will be resolved by the StylusFileFactory URIResolver, and its contents will be read and bound to the named Pipeline Input node.

Parameters:
portName - The name of the Pipeline Input node.
url - The url to be bound.
type - Indicates what type of data will be read fro the URL.
Throws:
PipelineException

getContentHandler

public ContentHandler getContentHandler(String portName)
                                 throws PipelineException
Get a ContentHandler with which SAX events can be sent to the named Pipeline Input node.

Parameters:
portName - The name of the Pipeline Input node.
Returns:
the ContentHandler ready to receive SAX events. The returned object also implements the LexicalHandler interface. This method will return null if the named Pipeline Input node is not currently able to accept SAX events.
Throws:
PipelineException

canAcceptSAX

public boolean canAcceptSAX(String portName)
                     throws PipelineException
Determine if the named Pipeline Input node is able to accept SAX events. Note: getContentHandler may return a null pointer even if this method returns true.

Parameters:
portName - The name of the Pipeline Input node.
Returns:
true if the Pipeline Input node is unable to accept SAX events. false, otherwise.
Throws:
PipelineException

bindOutputObject

public void bindOutputObject(String portName,
                             Object obj)
                      throws PipelineException
Bind a DOM or OutputStream to the named Pipeline Output node.

Parameters:
portName - The name of the Pipeline Output node.
obj - The object to be bound. It must be an instance of Document or OutputStream.
Throws:
PipelineException

bindOutputUrl

public void bindOutputUrl(String portName,
                          String url)
                   throws PipelineException
Bind a Pipeline Output node to a URL. The URL will be resolved using the StylusFileFactory URIResolver and opened for output.

Parameters:
portName - The name of the Pipeline Output node.
url - The url to be bound
Throws:
PipelineException

isReady

public boolean isReady(String portName)
                throws PipelineException
Check if any data was written to the named output port. If this method is called before go(), it will return false. After go() returns, this method will return true if the pipeline sent data to the named output port.

Throws:
PipelineException

go

public void go()
        throws PipelineException
Execute the pipeline and wait for it to terminate.

Throws:
PipelineException

close

public void close()
Close all nodes in this pipeline and release all operating system resources. This method does NOT invalidate the pipeline object itself. The isReady(java.lang.String) method can still be called and will return correct values. The pipeline instance cannot be reused either before or after the call to close().



XML Deployment Adapters