com.oroad.stxx.transform
Class AbstractSAXTransformer

java.lang.Object
  extended bycom.oroad.stxx.transform.AbstractSAXTransformer
All Implemented Interfaces:
Transformer
Direct Known Subclasses:
AbstractXSLTransformer, DOMWriteTransformer

public abstract class AbstractSAXTransformer
extends java.lang.Object
implements Transformer

This class provides common methods and variables used by transformers that convert stxx documents into SAX events.

Author:
Don Brown

Field Summary
protected  boolean allowURLDebug
          Whether the URL debugging is enabled
protected  SAXDocumentBuilder builder
          The class that will build the document by firing SAX events
protected  Cache cache
          Templates cache
protected  javax.servlet.ServletContext context
          The servlet context used for resolving paths
protected  java.lang.String debugXMLPath
          The path to write the debugging information
protected  long expiryTime
          Cached Template expiration time
protected  org.apache.commons.logging.Log log
          Logging
protected  java.lang.String name
          The name of this transformer
protected  boolean resolveFromTemplatePath
          Resolve XSL imports and includes from the directory of the parent XSL
protected  BuilderRules rules
          Defines what information should be included in the transformation
protected  java.lang.String transFactory
          The name of the factory to use
protected  boolean writeXMLDebug
          Whether upon URL debugging, information will be written to disk
 
Fields inherited from interface com.oroad.stxx.transform.Transformer
PROPS_PREFIX
 
Constructor Summary
AbstractSAXTransformer()
          Constructor for the AbstractSAXTransformer object
 
Method Summary
protected  javax.xml.transform.sax.SAXTransformerFactory getFactory()
          Gets a factory to create transformer objects
 void init(java.lang.String name, StxxProperties props, javax.servlet.ServletContext context, BuilderRules rules)
          Initializes the transformer
 void setCache(Cache cache, long expiryTime)
          Sets the cache for the transformer
abstract  void transform(ActionTransform trans, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Handles the transform stage
protected  void writeXML(javax.xml.transform.sax.SAXTransformerFactory factory, SAXDocumentBuilder builder, javax.servlet.http.HttpServletRequest request)
          Writes the XML to disk
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cache

protected Cache cache
Templates cache


expiryTime

protected long expiryTime
Cached Template expiration time


name

protected java.lang.String name
The name of this transformer


context

protected javax.servlet.ServletContext context
The servlet context used for resolving paths


rules

protected BuilderRules rules
Defines what information should be included in the transformation


builder

protected SAXDocumentBuilder builder
The class that will build the document by firing SAX events


resolveFromTemplatePath

protected boolean resolveFromTemplatePath
Resolve XSL imports and includes from the directory of the parent XSL


transFactory

protected java.lang.String transFactory
The name of the factory to use


allowURLDebug

protected boolean allowURLDebug
Whether the URL debugging is enabled


writeXMLDebug

protected boolean writeXMLDebug
Whether upon URL debugging, information will be written to disk


debugXMLPath

protected java.lang.String debugXMLPath
The path to write the debugging information


log

protected final org.apache.commons.logging.Log log
Logging

Constructor Detail

AbstractSAXTransformer

public AbstractSAXTransformer()
Constructor for the AbstractSAXTransformer object

Method Detail

setCache

public void setCache(Cache cache,
                     long expiryTime)
Sets the cache for the transformer

Specified by:
setCache in interface Transformer
Parameters:
cache - The cache
expiryTime - The expiration time for objects in milliseconds

init

public void init(java.lang.String name,
                 StxxProperties props,
                 javax.servlet.ServletContext context,
                 BuilderRules rules)
Initializes the transformer

Specified by:
init in interface Transformer
Parameters:
name - The name of the transformer
props - The properties
context - The servlet context
rules - The builder rules

transform

public abstract void transform(ActionTransform trans,
                               javax.servlet.http.HttpServletRequest request,
                               javax.servlet.http.HttpServletResponse response)
                        throws TransformerException
Handles the transform stage

Specified by:
transform in interface Transformer
Parameters:
trans - The value object holding transformation information
response - The response object (to set content-type, etc)
request - The request object
Throws:
TransformerException - If something goes wrong

getFactory

protected javax.xml.transform.sax.SAXTransformerFactory getFactory()
                                                            throws TransformerException
Gets a factory to create transformer objects

Returns:
The factory value
Throws:
TransformerException - If something goes wrong

writeXML

protected void writeXML(javax.xml.transform.sax.SAXTransformerFactory factory,
                        SAXDocumentBuilder builder,
                        javax.servlet.http.HttpServletRequest request)
Writes the XML to disk

Parameters:
builder - The document builder
request - The http request
factory - The sax transformer factory