|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.xml.transform.TransformerFactory javax.xml.transform.sax.SAXTransformerFactory org.apache.xalan.xsltc.trax.TransformerFactoryImpl
public class TransformerFactoryImpl
Implementation of a JAXP1.1 TransformerFactory for Translets.
Nested Class Summary | |
---|---|
private static class |
TransformerFactoryImpl.PIParamWrapper
The above hashtable stores objects of this class. |
Field Summary | |
---|---|
private boolean |
_autoTranslet
If this is set to true , we attempt to use translet classes
for transformation if possible without compiling the stylesheet. |
private boolean |
_debug
Set to true when debugging is enabled. |
private java.lang.String |
_destinationDirectory
The destination directory for the translet |
private boolean |
_enableInlining
Set to true when templates are inlined. |
private javax.xml.transform.ErrorListener |
_errorListener
This error listener is used only for this factory and is not passed to the Templates or Transformer objects that we create. |
private boolean |
_generateTranslet
Set to true when we want to generate
translet classes from the stylesheet. |
private int |
_indentNumber
Number of indent spaces when indentation is turned on. |
private boolean |
_isSecureProcessing
State of secure processing feature. |
private java.lang.String |
_jarFileName
The jar file name which the translet classes are packaged into |
private java.lang.String |
_packageName
The package name prefix for all generated translet classes |
private java.util.Hashtable |
_piParams
This Hashtable is used to store parameters for locating processing instructions in XML docs. |
private java.lang.String |
_transletName
The class name of the translet |
private javax.xml.transform.URIResolver |
_uriResolver
This URIResolver is passed to all created Templates and Transformers |
private boolean |
_useClasspath
If this is set to true , we attempt to load the translet
from the CLASSPATH. |
static java.lang.String |
AUTO_TRANSLET
|
static java.lang.String |
DEBUG
|
protected static java.lang.String |
DEFAULT_TRANSLET_NAME
As Gregor Samsa awoke one morning from uneasy dreams he found himself transformed in his bed into a gigantic insect. |
static java.lang.String |
DESTINATION_DIRECTORY
|
static java.lang.String |
ENABLE_INLINING
|
static java.lang.String |
GENERATE_TRANSLET
|
static java.lang.String |
INDENT_NUMBER
|
static java.lang.String |
JAR_NAME
|
private java.lang.Class |
m_DTMManagerClass
The provider of the XSLTC DTM Manager service. |
static java.lang.String |
PACKAGE_NAME
|
static java.lang.String |
TRANSLET_NAME
|
static java.lang.String |
USE_CLASSPATH
|
Fields inherited from class javax.xml.transform.sax.SAXTransformerFactory |
---|
FEATURE, FEATURE_XMLFILTER |
Constructor Summary | |
---|---|
TransformerFactoryImpl()
javax.xml.transform.sax.TransformerFactory implementation. |
Method Summary | |
---|---|
void |
error(javax.xml.transform.TransformerException e)
Receive notification of a recoverable error. |
void |
fatalError(javax.xml.transform.TransformerException e)
Receive notification of a non-recoverable error. |
javax.xml.transform.Source |
getAssociatedStylesheet(javax.xml.transform.Source source,
java.lang.String media,
java.lang.String title,
java.lang.String charset)
javax.xml.transform.sax.TransformerFactory implementation. |
java.lang.Object |
getAttribute(java.lang.String name)
javax.xml.transform.sax.TransformerFactory implementation. |
private byte[][] |
getBytecodesFromClasses(javax.xml.transform.Source source,
java.lang.String fullClassName)
Load the translet classes from local .class files and return the bytecode array. |
private byte[][] |
getBytecodesFromJar(javax.xml.transform.Source source,
java.lang.String fullClassName)
Load the translet classes from the jar file and return the bytecode. |
protected java.lang.Class |
getDTMManagerClass()
Returns the Class object the provides the XSLTC DTM Manager service. |
javax.xml.transform.ErrorListener |
getErrorListener()
javax.xml.transform.sax.TransformerFactory implementation. |
boolean |
getFeature(java.lang.String name)
javax.xml.transform.sax.TransformerFactory implementation. |
private java.lang.String |
getStylesheetFileName(javax.xml.transform.Source source)
Return the local file name from the systemId of the Source object |
private java.lang.String |
getTransletBaseName(javax.xml.transform.Source source)
Return the base class name of the translet. |
javax.xml.transform.URIResolver |
getURIResolver()
javax.xml.transform.sax.TransformerFactory implementation. |
org.xml.sax.InputSource |
loadSource(java.lang.String href,
java.lang.String context,
XSLTC xsltc)
This method implements XSLTC's SourceLoader interface. |
javax.xml.transform.Templates |
newTemplates(javax.xml.transform.Source source)
javax.xml.transform.sax.TransformerFactory implementation. |
javax.xml.transform.sax.TemplatesHandler |
newTemplatesHandler()
javax.xml.transform.sax.SAXTransformerFactory implementation. |
javax.xml.transform.Transformer |
newTransformer()
javax.xml.transform.sax.TransformerFactory implementation. |
javax.xml.transform.Transformer |
newTransformer(javax.xml.transform.Source source)
javax.xml.transform.sax.TransformerFactory implementation. |
javax.xml.transform.sax.TransformerHandler |
newTransformerHandler()
javax.xml.transform.sax.SAXTransformerFactory implementation. |
javax.xml.transform.sax.TransformerHandler |
newTransformerHandler(javax.xml.transform.Source src)
javax.xml.transform.sax.SAXTransformerFactory implementation. |
javax.xml.transform.sax.TransformerHandler |
newTransformerHandler(javax.xml.transform.Templates templates)
javax.xml.transform.sax.SAXTransformerFactory implementation. |
org.xml.sax.XMLFilter |
newXMLFilter(javax.xml.transform.Source src)
javax.xml.transform.sax.SAXTransformerFactory implementation. |
org.xml.sax.XMLFilter |
newXMLFilter(javax.xml.transform.Templates templates)
javax.xml.transform.sax.SAXTransformerFactory implementation. |
private void |
passErrorsToListener(java.util.Vector messages)
Pass error messages from the compiler to the error listener |
private void |
passWarningsToListener(java.util.Vector messages)
Pass warning messages from the compiler to the error listener |
private void |
readFromInputStream(byte[] bytes,
java.io.InputStream input,
int size)
Read a given number of bytes from the InputStream into a byte array. |
private void |
resetTransientAttributes()
Reset the per-session attributes to their default values |
void |
setAttribute(java.lang.String name,
java.lang.Object value)
javax.xml.transform.sax.TransformerFactory implementation. |
void |
setErrorListener(javax.xml.transform.ErrorListener listener)
javax.xml.transform.sax.TransformerFactory implementation. |
void |
setFeature(java.lang.String name,
boolean value)
Set a feature for this TransformerFactory and Transformer s
or Template s created by this factory. |
void |
setURIResolver(javax.xml.transform.URIResolver resolver)
javax.xml.transform.sax.TransformerFactory implementation. |
void |
warning(javax.xml.transform.TransformerException e)
Receive notification of a warning. |
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 |
---|
public static final java.lang.String TRANSLET_NAME
public static final java.lang.String DESTINATION_DIRECTORY
public static final java.lang.String PACKAGE_NAME
public static final java.lang.String JAR_NAME
public static final java.lang.String GENERATE_TRANSLET
public static final java.lang.String AUTO_TRANSLET
public static final java.lang.String USE_CLASSPATH
public static final java.lang.String DEBUG
public static final java.lang.String ENABLE_INLINING
public static final java.lang.String INDENT_NUMBER
private javax.xml.transform.ErrorListener _errorListener
private javax.xml.transform.URIResolver _uriResolver
protected static final java.lang.String DEFAULT_TRANSLET_NAME
private java.lang.String _transletName
private java.lang.String _destinationDirectory
private java.lang.String _packageName
private java.lang.String _jarFileName
private java.util.Hashtable _piParams
private boolean _debug
true
when debugging is enabled.
private boolean _enableInlining
true
when templates are inlined.
private boolean _generateTranslet
true
when we want to generate
translet classes from the stylesheet.
private boolean _autoTranslet
true
, we attempt to use translet classes
for transformation if possible without compiling the stylesheet. The
translet class is only used if its timestamp is newer than the timestamp
of the stylesheet.
private boolean _useClasspath
true
, we attempt to load the translet
from the CLASSPATH.
private int _indentNumber
private java.lang.Class m_DTMManagerClass
TransformerFactory
must be instantiated.
XSLTCDTMManager.getDTMManagerClass()
private boolean _isSecureProcessing
State of secure processing feature.
Constructor Detail |
---|
public TransformerFactoryImpl()
Method Detail |
---|
public void setErrorListener(javax.xml.transform.ErrorListener listener) throws java.lang.IllegalArgumentException
setErrorListener
in class javax.xml.transform.TransformerFactory
listener
- The error listener to use with the TransformerFactory
java.lang.IllegalArgumentException
public javax.xml.transform.ErrorListener getErrorListener()
getErrorListener
in class javax.xml.transform.TransformerFactory
public java.lang.Object getAttribute(java.lang.String name) throws java.lang.IllegalArgumentException
getAttribute
in class javax.xml.transform.TransformerFactory
name
- The attribute name
java.lang.IllegalArgumentException
public void setAttribute(java.lang.String name, java.lang.Object value) throws java.lang.IllegalArgumentException
setAttribute
in class javax.xml.transform.TransformerFactory
name
- The attribute namevalue
- An object representing the attribute value
java.lang.IllegalArgumentException
public void setFeature(java.lang.String name, boolean value) throws javax.xml.transform.TransformerConfigurationException
Set a feature for this TransformerFactory
and Transformer
s
or Template
s created by this factory.
Feature names are fully qualified URI
s.
Implementations may define their own features.
An TransformerConfigurationException
is thrown if this TransformerFactory
or the
Transformer
s or Template
s 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.
setFeature
in class javax.xml.transform.TransformerFactory
name
- Feature name.value
- Is feature state true
or false
.
javax.xml.transform.TransformerConfigurationException
- if this TransformerFactory
or the Transformer
s or Template
s it creates cannot support this feature.
java.lang.NullPointerException
- If the name
parameter is null.public boolean getFeature(java.lang.String name)
getFeature
in class javax.xml.transform.TransformerFactory
name
- The feature name
public javax.xml.transform.URIResolver getURIResolver()
getURIResolver
in class javax.xml.transform.TransformerFactory
public void setURIResolver(javax.xml.transform.URIResolver resolver)
setURIResolver
in class javax.xml.transform.TransformerFactory
resolver
- The URLResolver used for this TransformerFactory and all
Templates and Transformer objects created using this factorypublic 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
getAssociatedStylesheet
in class javax.xml.transform.TransformerFactory
source
- The XML source document.media
- The media attribute to be matched. May be null, in which
case the prefered templates will be used (i.e. alternate = no).title
- The value of the title attribute to match. May be null.charset
- The value of the charset attribute to match. May be null.
javax.xml.transform.TransformerConfigurationException
public javax.xml.transform.Transformer newTransformer() throws javax.xml.transform.TransformerConfigurationException
newTransformer
in class javax.xml.transform.TransformerFactory
javax.xml.transform.TransformerConfigurationException
public javax.xml.transform.Transformer newTransformer(javax.xml.transform.Source source) throws javax.xml.transform.TransformerConfigurationException
newTransformer
in class javax.xml.transform.TransformerFactory
javax.xml.transform.TransformerConfigurationException
private void passWarningsToListener(java.util.Vector messages) throws javax.xml.transform.TransformerException
javax.xml.transform.TransformerException
private void passErrorsToListener(java.util.Vector messages)
public javax.xml.transform.Templates newTemplates(javax.xml.transform.Source source) throws javax.xml.transform.TransformerConfigurationException
newTemplates
in class javax.xml.transform.TransformerFactory
source
- The input stylesheet - DOMSource not supported!!!
javax.xml.transform.TransformerConfigurationException
public javax.xml.transform.sax.TemplatesHandler newTemplatesHandler() throws javax.xml.transform.TransformerConfigurationException
newTemplatesHandler
in class javax.xml.transform.sax.SAXTransformerFactory
javax.xml.transform.TransformerConfigurationException
public javax.xml.transform.sax.TransformerHandler newTransformerHandler() throws javax.xml.transform.TransformerConfigurationException
newTransformerHandler
in class javax.xml.transform.sax.SAXTransformerFactory
javax.xml.transform.TransformerConfigurationException
public javax.xml.transform.sax.TransformerHandler newTransformerHandler(javax.xml.transform.Source src) throws javax.xml.transform.TransformerConfigurationException
newTransformerHandler
in class javax.xml.transform.sax.SAXTransformerFactory
src
- The source of the transformation instructions.
javax.xml.transform.TransformerConfigurationException
public javax.xml.transform.sax.TransformerHandler newTransformerHandler(javax.xml.transform.Templates templates) throws javax.xml.transform.TransformerConfigurationException
newTransformerHandler
in class javax.xml.transform.sax.SAXTransformerFactory
templates
- Represents a pre-processed stylesheet
javax.xml.transform.TransformerConfigurationException
public org.xml.sax.XMLFilter newXMLFilter(javax.xml.transform.Source src) throws javax.xml.transform.TransformerConfigurationException
newXMLFilter
in class javax.xml.transform.sax.SAXTransformerFactory
src
- The source of the transformation instructions.
javax.xml.transform.TransformerConfigurationException
public org.xml.sax.XMLFilter newXMLFilter(javax.xml.transform.Templates templates) throws javax.xml.transform.TransformerConfigurationException
newXMLFilter
in class javax.xml.transform.sax.SAXTransformerFactory
templates
- The source of the transformation instructions.
javax.xml.transform.TransformerConfigurationException
public void error(javax.xml.transform.TransformerException e) throws javax.xml.transform.TransformerException
error
in interface javax.xml.transform.ErrorListener
e
- The warning information encapsulated in a transformer
exception.
javax.xml.transform.TransformerException
- if the application chooses to discontinue
the transformation (always does in our case).public void fatalError(javax.xml.transform.TransformerException e) throws javax.xml.transform.TransformerException
fatalError
in interface javax.xml.transform.ErrorListener
e
- warning information encapsulated in a transformer
exception.
javax.xml.transform.TransformerException
- if the application chooses to discontinue
the transformation (always does in our case).public void warning(javax.xml.transform.TransformerException e) throws javax.xml.transform.TransformerException
warning
in interface javax.xml.transform.ErrorListener
e
- The warning information encapsulated in a transformer
exception.
javax.xml.transform.TransformerException
- if the application chooses to discontinue
the transformation (never does in our case).public org.xml.sax.InputSource loadSource(java.lang.String href, java.lang.String context, XSLTC xsltc)
loadSource
in interface SourceLoader
href
- The URI of the document to loadcontext
- The URI of the currently loaded documentxsltc
- The compiler that resuests the document
private void resetTransientAttributes()
private byte[][] getBytecodesFromClasses(javax.xml.transform.Source source, java.lang.String fullClassName)
source
- The xsl sourcefullClassName
- The full name of the translet
private byte[][] getBytecodesFromJar(javax.xml.transform.Source source, java.lang.String fullClassName)
source
- The xsl sourcefullClassName
- The full name of the translet
private void readFromInputStream(byte[] bytes, java.io.InputStream input, int size) throws java.io.IOException
bytes
- The byte array to store the input content.input
- The input stream.size
- The number of bytes to read.
java.io.IOException
private java.lang.String getTransletBaseName(javax.xml.transform.Source source)
source
- The input Source
private java.lang.String getStylesheetFileName(javax.xml.transform.Source source)
source
- The Source
protected java.lang.Class getDTMManagerClass()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |