org.apache.xalan.xsltc.trax
Class SmartTransformerFactoryImpl

java.lang.Object
  extended by javax.xml.transform.TransformerFactory
      extended by javax.xml.transform.sax.SAXTransformerFactory
          extended by org.apache.xalan.xsltc.trax.SmartTransformerFactoryImpl

public class SmartTransformerFactoryImpl
extends javax.xml.transform.sax.SAXTransformerFactory

Implementation of a transformer factory that uses an XSLTC transformer factory for the creation of Templates objects and uses the Xalan processor transformer factory for the creation of Transformer objects.


Field Summary
private  javax.xml.transform.sax.SAXTransformerFactory _currFactory
           
private  javax.xml.transform.ErrorListener _errorlistener
           
private  javax.xml.transform.URIResolver _uriresolver
           
private  javax.xml.transform.sax.SAXTransformerFactory _xalanFactory
           
private  javax.xml.transform.sax.SAXTransformerFactory _xsltcFactory
           
private static java.lang.String CLASS_NAME
          Name of class as a constant to use for debugging.
private  boolean featureSecureProcessing
          State of secure processing feature.
 
Fields inherited from class javax.xml.transform.sax.SAXTransformerFactory
FEATURE, FEATURE_XMLFILTER
 
Constructor Summary
SmartTransformerFactoryImpl()
          implementation of the SmartTransformerFactory.
 
Method Summary
private  void createXalanTransformerFactory()
           
private  void createXSLTCTransformerFactory()
           
 javax.xml.transform.Source getAssociatedStylesheet(javax.xml.transform.Source source, java.lang.String media, java.lang.String title, java.lang.String charset)
           
 java.lang.Object getAttribute(java.lang.String name)
           
 javax.xml.transform.ErrorListener getErrorListener()
           
 boolean getFeature(java.lang.String name)
          javax.xml.transform.sax.TransformerFactory implementation.
 javax.xml.transform.URIResolver getURIResolver()
           
 javax.xml.transform.Templates newTemplates(javax.xml.transform.Source source)
          Create a Templates object that from the input stylesheet Uses the org.apache.xalan.xsltc.trax.TransformerFactory.
 javax.xml.transform.sax.TemplatesHandler newTemplatesHandler()
          Get a TemplatesHandler object that can process SAX ContentHandler events into a Templates object.
 javax.xml.transform.Transformer newTransformer()
          Create a Transformer object that copies the input document to the result.
 javax.xml.transform.Transformer newTransformer(javax.xml.transform.Source source)
          Create a Transformer object that from the input stylesheet Uses the org.apache.xalan.processor.TransformerFactory.
 javax.xml.transform.sax.TransformerHandler newTransformerHandler()
          Get a TransformerHandler object that can process SAX ContentHandler events based on a copy transformer.
 javax.xml.transform.sax.TransformerHandler newTransformerHandler(javax.xml.transform.Source src)
          Get a TransformerHandler object that can process SAX ContentHandler events based on a transformer specified by the stylesheet Source.
 javax.xml.transform.sax.TransformerHandler newTransformerHandler(javax.xml.transform.Templates templates)
          Get a TransformerHandler object that can process SAX ContentHandler events based on a transformer specified by the stylesheet Source.
 org.xml.sax.XMLFilter newXMLFilter(javax.xml.transform.Source src)
          Create an XMLFilter that uses the given source as the transformation instructions.
 org.xml.sax.XMLFilter newXMLFilter(javax.xml.transform.Templates templates)
           
 void setAttribute(java.lang.String name, java.lang.Object value)
           
 void setErrorListener(javax.xml.transform.ErrorListener listener)
           
 void setFeature(java.lang.String name, boolean value)
          Set a feature for this SmartTransformerFactory and Transformers or Templates created by this factory.
 void setURIResolver(javax.xml.transform.URIResolver resolver)
           
 
Methods inherited from class javax.xml.transform.TransformerFactory
newInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_NAME

private static final java.lang.String CLASS_NAME

Name of class as a constant to use for debugging.

See Also:
Constant Field Values

_xsltcFactory

private javax.xml.transform.sax.SAXTransformerFactory _xsltcFactory

_xalanFactory

private javax.xml.transform.sax.SAXTransformerFactory _xalanFactory

_currFactory

private javax.xml.transform.sax.SAXTransformerFactory _currFactory

_errorlistener

private javax.xml.transform.ErrorListener _errorlistener

_uriresolver

private javax.xml.transform.URIResolver _uriresolver

featureSecureProcessing

private boolean featureSecureProcessing

State of secure processing feature.

Constructor Detail

SmartTransformerFactoryImpl

public SmartTransformerFactoryImpl()
implementation of the SmartTransformerFactory. This factory uses org.apache.xalan.xsltc.trax.TransformerFactory to return Templates objects; and uses org.apache.xalan.processor.TransformerFactory to return Transformer objects.

Method Detail

createXSLTCTransformerFactory

private void createXSLTCTransformerFactory()

createXalanTransformerFactory

private void createXalanTransformerFactory()

setErrorListener

public void setErrorListener(javax.xml.transform.ErrorListener listener)
                      throws java.lang.IllegalArgumentException
Specified by:
setErrorListener in class javax.xml.transform.TransformerFactory
Throws:
java.lang.IllegalArgumentException

getErrorListener

public javax.xml.transform.ErrorListener getErrorListener()
Specified by:
getErrorListener in class javax.xml.transform.TransformerFactory

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
                              throws java.lang.IllegalArgumentException
Specified by:
getAttribute in class javax.xml.transform.TransformerFactory
Throws:
java.lang.IllegalArgumentException

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
                  throws java.lang.IllegalArgumentException
Specified by:
setAttribute in class javax.xml.transform.TransformerFactory
Throws:
java.lang.IllegalArgumentException

setFeature

public void setFeature(java.lang.String name,
                       boolean value)
                throws javax.xml.transform.TransformerConfigurationException

Set a feature for this SmartTransformerFactory and Transformers or Templates created by this factory.

Feature names are fully qualified URIs. Implementations may define their own features. An TransformerConfigurationException is thrown if this TransformerFactory or the Transformers or Templates it creates cannot support the feature. It is possible for an TransformerFactory to expose a feature value but be unable to change its state.

See TransformerFactory for full documentation of specific features.

Specified by:
setFeature in class javax.xml.transform.TransformerFactory
Parameters:
name - Feature name.
value - Is feature state true or false.
Throws:
javax.xml.transform.TransformerConfigurationException - if this TransformerFactory or the Transformers or Templates it creates cannot support this feature.
java.lang.NullPointerException - If the name parameter is null.

getFeature

public boolean getFeature(java.lang.String name)
javax.xml.transform.sax.TransformerFactory implementation. Look up the value of a feature (to see if it is supported). This method must be updated as the various methods and features of this class are implemented.

Specified by:
getFeature in class javax.xml.transform.TransformerFactory
Parameters:
name - The feature name
Returns:
'true' if feature is supported, 'false' if not

getURIResolver

public javax.xml.transform.URIResolver getURIResolver()
Specified by:
getURIResolver in class javax.xml.transform.TransformerFactory

setURIResolver

public void setURIResolver(javax.xml.transform.URIResolver resolver)
Specified by:
setURIResolver in class javax.xml.transform.TransformerFactory

getAssociatedStylesheet

public javax.xml.transform.Source getAssociatedStylesheet(javax.xml.transform.Source source,
                                                          java.lang.String media,
                                                          java.lang.String title,
                                                          java.lang.String charset)
                                                   throws javax.xml.transform.TransformerConfigurationException
Specified by:
getAssociatedStylesheet in class javax.xml.transform.TransformerFactory
Throws:
javax.xml.transform.TransformerConfigurationException

newTransformer

public javax.xml.transform.Transformer newTransformer()
                                               throws javax.xml.transform.TransformerConfigurationException
Create a Transformer object that copies the input document to the result. Uses the org.apache.xalan.processor.TransformerFactory.

Specified by:
newTransformer in class javax.xml.transform.TransformerFactory
Returns:
A Transformer object.
Throws:
javax.xml.transform.TransformerConfigurationException

newTransformer

public javax.xml.transform.Transformer newTransformer(javax.xml.transform.Source source)
                                               throws javax.xml.transform.TransformerConfigurationException
Create a Transformer object that from the input stylesheet Uses the org.apache.xalan.processor.TransformerFactory.

Specified by:
newTransformer in class javax.xml.transform.TransformerFactory
Parameters:
source - the stylesheet.
Returns:
A Transformer object.
Throws:
javax.xml.transform.TransformerConfigurationException

newTemplates

public javax.xml.transform.Templates newTemplates(javax.xml.transform.Source source)
                                           throws javax.xml.transform.TransformerConfigurationException
Create a Templates object that from the input stylesheet Uses the org.apache.xalan.xsltc.trax.TransformerFactory.

Specified by:
newTemplates in class javax.xml.transform.TransformerFactory
Parameters:
source - the stylesheet.
Returns:
A Templates object.
Throws:
javax.xml.transform.TransformerConfigurationException

newTemplatesHandler

public javax.xml.transform.sax.TemplatesHandler newTemplatesHandler()
                                                             throws javax.xml.transform.TransformerConfigurationException
Get a TemplatesHandler object that can process SAX ContentHandler events into a Templates object. Uses the org.apache.xalan.xsltc.trax.TransformerFactory.

Specified by:
newTemplatesHandler in class javax.xml.transform.sax.SAXTransformerFactory
Throws:
javax.xml.transform.TransformerConfigurationException

newTransformerHandler

public javax.xml.transform.sax.TransformerHandler newTransformerHandler()
                                                                 throws javax.xml.transform.TransformerConfigurationException
Get a TransformerHandler object that can process SAX ContentHandler events based on a copy transformer. Uses org.apache.xalan.processor.TransformerFactory.

Specified by:
newTransformerHandler in class javax.xml.transform.sax.SAXTransformerFactory
Throws:
javax.xml.transform.TransformerConfigurationException

newTransformerHandler

public javax.xml.transform.sax.TransformerHandler newTransformerHandler(javax.xml.transform.Source src)
                                                                 throws javax.xml.transform.TransformerConfigurationException
Get a TransformerHandler object that can process SAX ContentHandler events based on a transformer specified by the stylesheet Source. Uses org.apache.xalan.processor.TransformerFactory.

Specified by:
newTransformerHandler in class javax.xml.transform.sax.SAXTransformerFactory
Throws:
javax.xml.transform.TransformerConfigurationException

newTransformerHandler

public javax.xml.transform.sax.TransformerHandler newTransformerHandler(javax.xml.transform.Templates templates)
                                                                 throws javax.xml.transform.TransformerConfigurationException
Get a TransformerHandler object that can process SAX ContentHandler events based on a transformer specified by the stylesheet Source. Uses org.apache.xalan.xsltc.trax.TransformerFactory.

Specified by:
newTransformerHandler in class javax.xml.transform.sax.SAXTransformerFactory
Throws:
javax.xml.transform.TransformerConfigurationException

newXMLFilter

public org.xml.sax.XMLFilter newXMLFilter(javax.xml.transform.Source src)
                                   throws javax.xml.transform.TransformerConfigurationException
Create an XMLFilter that uses the given source as the transformation instructions. Uses org.apache.xalan.xsltc.trax.TransformerFactory.

Specified by:
newXMLFilter in class javax.xml.transform.sax.SAXTransformerFactory
Throws:
javax.xml.transform.TransformerConfigurationException

newXMLFilter

public org.xml.sax.XMLFilter newXMLFilter(javax.xml.transform.Templates templates)
                                   throws javax.xml.transform.TransformerConfigurationException
Specified by:
newXMLFilter in class javax.xml.transform.sax.SAXTransformerFactory
Throws:
javax.xml.transform.TransformerConfigurationException