APIdia Launch Partner
Top Inners Fields Constructors Methods
com.sun.org.apache.xalan.internal.xsltc.trax

public final Class TemplatesImpl

extends Object
implements Templates, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, javax.xml.transform.Templates
Imports
com.sun.org.apache.xalan.internal.utils.ObjectFactory, com.sun.org.apache.xalan.internal.xsltc.DOM, .Translet, com.sun.org.apache.xalan.internal.xsltc.compiler.Constants, com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg, com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet, java.io.IOException, .NotSerializableException, .ObjectInputStream, .ObjectOutputStream, .ObjectStreamField, .Serializable, java.lang.RuntimePermission, java.lang.module.Configuration, .ModuleDescriptor, .ModuleFinder, .ModuleReader, .ModuleReference, java.lang.reflect.InvocationTargetException, java.security.CodeSigner, .CodeSource, .PermissionCollection, .ProtectionDomain, java.util.Arrays, .HashMap, .Map, .Optional, .Properties, .Set, javax.xml.XMLConstants, javax.xml.transform.Templates, .Transformer, .TransformerConfigurationException, .URIResolver, jdk.xml.internal.JdkConstants

Authors
Morten Jorgensen, G. Todd Millerj, Jochen Cordes , Santiago Pericas-Geertsen

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private transient String
_accessExternalStylesheet

protocols allowed for external references set by the stylesheet processing instruction, Import and Include element.

private transient Map<String, Class<?>>
_auxClasses

Contains the list of auxiliary class definitions.

private byte[][]
_bytecodes

Contains the actual class definition for the translet class and any auxiliary classes.

private Class<?>[]
_class

Contains the translet class definition(s).

private int
_indentNumber

Number of spaces to add for output indentation.

private String
_name

Name of the main class or default name if unknown.

private Properties
_outputProperties

Output properties of this translet.

private transient boolean
_overrideDefaultParser

A flag to determine whether the system-default parser may be overridden

private transient ThreadLocal<DOM>
_sdom

Cache the DTM for the stylesheet in a thread local variable, which is used by the document('') function.

private transient TransformerFactoryImpl
_tfactory

A reference to the transformer factory that this templates object belongs to.

private int
_transletIndex

The index of the main translet class in the arrays _class[] and _bytecodes.

private transient URIResolver
_uriResolver

This URIResolver is passed to all Transformers.

private static String
ABSTRACT_TRANSLET

Name of the superclass of all translets.

public static final String
private static final ObjectStreamField[]
pack-priv static final long

Constructor Summary

AccessConstructor and Description
protected
TemplatesImpl(byte[][] bytecodes, String transletName, Properties outputProperties, int indentNumber, TransformerFactoryImpl tfactory)

Create an XSLTC template object from the bytecodes.

protected
TemplatesImpl(Class<?>[] transletClasses, String transletName, Properties outputProperties, int indentNumber, TransformerFactoryImpl tfactory)

Create an XSLTC template object from the translet class definition(s).

public
TemplatesImpl()

Need for de-serialization, see readObject().

Method Summary

Modifier and TypeMethod and Description
private Module
createModule(ModuleDescriptor descriptor, ClassLoader loader)

Creates a module layer with one module that is defined to the given class loader.

private void
defineTransletClasses()

Defines the translet class and auxiliary classes.

public synchronized Properties
getOutputProperties()

Implements javax.xml.transform.Templates.getOutputProperties.

Implements JAXP's Templates.getOutputProperties().

public DOM
getStylesheetDOM()

Return the thread local copy of the stylesheet DOM.

private synchronized byte[][]
getTransletBytecodes()

Returns the translet bytecodes stored in this template Note: This method is private for security reasons.

private synchronized Class<?>[]
getTransletClasses()

Returns the translet bytecodes stored in this template Note: This method is private for security reasons.

public synchronized int
getTransletIndex()

Returns the index of the main class in array of bytecodes

private Translet
getTransletInstance()

This method generates an instance of the translet class that is wrapped inside this Template.

protected synchronized String
getTransletName()

Returns the name of the main translet class stored in this template

private void
init(String transletName, Properties outputProperties, int indentNumber, TransformerFactoryImpl tfactory)

public synchronized Transformer
newTransformer()

Implements javax.xml.transform.Templates.newTransformer.

Implements JAXP's Templates.newTransformer()

public boolean
overrideDefaultParser()

Return the state of the services mechanism feature.

private void
readObject(ObjectInputStream is)

Overrides the default readObject implementation since we decided it would be cleaner not to serialize the entire tranformer factory.

public void
setStylesheetDOM(DOM sdom)

Set the thread local copy of the stylesheet DOM.

private synchronized void
setTransletBytecodes(byte[][] bytecodes)

The TransformerFactory must pass us the translet bytecodes using this method before we can create any translet instances Note: This method is private for security reasons.

protected synchronized void
setTransletName(String name)

The TransformerFactory should call this method to set the translet name

public synchronized void
setURIResolver(URIResolver resolver)

Store URIResolver needed for Transformers.

private void
writeObject(ObjectOutputStream os)

This is to fix bugzilla bug 22438 If the user defined class implements URIResolver and Serializable then we want it to get serialized

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_accessExternalStylesheetback to summary
private transient String _accessExternalStylesheet

protocols allowed for external references set by the stylesheet processing instruction, Import and Include element.

_auxClassesback to summary
private transient Map<String, Class<?>> _auxClasses

Contains the list of auxiliary class definitions.

_bytecodesback to summary
private byte[][] _bytecodes

Contains the actual class definition for the translet class and any auxiliary classes.

_classback to summary
private Class<?>[] _class

Contains the translet class definition(s). These are created when this Templates is created or when it is read back from disk.

_indentNumberback to summary
private int _indentNumber

Number of spaces to add for output indentation.

_nameback to summary
private String _name

Name of the main class or default name if unknown.

_outputPropertiesback to summary
private Properties _outputProperties

Output properties of this translet.

_overrideDefaultParserback to summary
private transient boolean _overrideDefaultParser

A flag to determine whether the system-default parser may be overridden

_sdomback to summary
private transient ThreadLocal<DOM> _sdom

Cache the DTM for the stylesheet in a thread local variable, which is used by the document('') function. Use ThreadLocal because a DTM cannot be shared between multiple threads. Declaring it transient to fix bug 22438

_tfactoryback to summary
private transient TransformerFactoryImpl _tfactory

A reference to the transformer factory that this templates object belongs to.

_transletIndexback to summary
private int _transletIndex

The index of the main translet class in the arrays _class[] and _bytecodes.

_uriResolverback to summary
private transient URIResolver _uriResolver

This URIResolver is passed to all Transformers. Declaring it transient to fix bug 22438

ABSTRACT_TRANSLETback to summary
private static String ABSTRACT_TRANSLET

Name of the superclass of all translets. This is needed to determine which, among all classes comprising a translet, is the main one.

DESERIALIZE_TRANSLETback to summary
public static final String DESERIALIZE_TRANSLET
serialPersistentFieldsback to summary
private static final ObjectStreamField[] serialPersistentFields
Serial Fields:
_name:String
The Name of the main class
_bytecodes:byte[][]
Class definition
_class:Class[]
The translet class definition(s).
_transletIndex:int
The index of the main translet class
_outputProperties:Properties
Output properties of this translet.
_indentNumber:int
Number of spaces to add for output indentation.
serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Constructor Detail

TemplatesImplback to summary
protected TemplatesImpl(byte[][] bytecodes, String transletName, Properties outputProperties, int indentNumber, TransformerFactoryImpl tfactory)

Create an XSLTC template object from the bytecodes. The bytecodes for the translet and auxiliary classes, plus the name of the main translet class, must be supplied.

TemplatesImplback to summary
protected TemplatesImpl(Class<?>[] transletClasses, String transletName, Properties outputProperties, int indentNumber, TransformerFactoryImpl tfactory)

Create an XSLTC template object from the translet class definition(s).

TemplatesImplback to summary
public TemplatesImpl()

Need for de-serialization, see readObject().

Method Detail

createModuleback to summary
private Module createModule(ModuleDescriptor descriptor, ClassLoader loader)

Creates a module layer with one module that is defined to the given class loader.

defineTransletClassesback to summary
private void defineTransletClasses() throws TransformerConfigurationException

Defines the translet class and auxiliary classes. Returns a reference to the Class object that defines the main class

Annotations
@SuppressWarnings:removal
getOutputPropertiesback to summary
public synchronized Properties getOutputProperties()

Implements javax.xml.transform.Templates.getOutputProperties.

Implements JAXP's Templates.getOutputProperties(). We need to instanciate a translet to get the output settings, so we might as well just instanciate a Transformer and use its implementation of this method.

getStylesheetDOMback to summary
public DOM getStylesheetDOM()

Return the thread local copy of the stylesheet DOM.

getTransletBytecodesback to summary
private synchronized byte[][] getTransletBytecodes()

Returns the translet bytecodes stored in this template Note: This method is private for security reasons. See CR 6537898. When merging with Apache, we must ensure that the privateness of this method is maintained (that is why it wasn't removed).

getTransletClassesback to summary
private synchronized Class<?>[] getTransletClasses()

Returns the translet bytecodes stored in this template Note: This method is private for security reasons. See CR 6537898. When merging with Apache, we must ensure that the privateness of this method is maintained (that is why it wasn't removed).

getTransletIndexback to summary
public synchronized int getTransletIndex()

Returns the index of the main class in array of bytecodes

getTransletInstanceback to summary
private Translet getTransletInstance() throws TransformerConfigurationException

This method generates an instance of the translet class that is wrapped inside this Template. The translet instance will later be wrapped inside a Transformer object.

getTransletNameback to summary
protected synchronized String getTransletName()

Returns the name of the main translet class stored in this template

initback to summary
private void init(String transletName, Properties outputProperties, int indentNumber, TransformerFactoryImpl tfactory)
newTransformerback to summary
public synchronized Transformer newTransformer() throws TransformerConfigurationException

Implements javax.xml.transform.Templates.newTransformer.

Implements JAXP's Templates.newTransformer()

Exceptions
TransformerConfigurationException:

Doc from javax.xml.transform.Templates.newTransformer.

if a Transformer can not be created.

overrideDefaultParserback to summary
public boolean overrideDefaultParser()

Return the state of the services mechanism feature.

readObjectback to summary
private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException

Overrides the default readObject implementation since we decided it would be cleaner not to serialize the entire tranformer factory. [ ref bugzilla 12317 ] We need to check if the user defined class for URIResolver also implemented Serializable if yes then we need to deserialize the URIResolver Fix for bugzilla bug 22438

setStylesheetDOMback to summary
public void setStylesheetDOM(DOM sdom)

Set the thread local copy of the stylesheet DOM.

setTransletBytecodesback to summary
private synchronized void setTransletBytecodes(byte[][] bytecodes)

The TransformerFactory must pass us the translet bytecodes using this method before we can create any translet instances Note: This method is private for security reasons. See CR 6537898. When merging with Apache, we must ensure that the privateness of this method is maintained (that is why it wasn't removed).

setTransletNameback to summary
protected synchronized void setTransletName(String name)

The TransformerFactory should call this method to set the translet name

setURIResolverback to summary
public synchronized void setURIResolver(URIResolver resolver)

Store URIResolver needed for Transformers.

writeObjectback to summary
private void writeObject(ObjectOutputStream os) throws IOException

This is to fix bugzilla bug 22438 If the user defined class implements URIResolver and Serializable then we want it to get serialized

com.sun.org.apache.xalan.internal.xsltc.trax back to summary

pack-priv final Class TemplatesImpl.TransletClassLoader

extends ClassLoader
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final Map<String, Class<?>>

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv Class<?>
defineClass(final byte[] b)

Access to final protected superclass member from outer class.

pack-priv Class<?>
defineClass(final byte[] b, ProtectionDomain pd)

public Class<?>
loadClass(String name)

Overrides java.lang.ClassLoader.loadClass.

Loads the class with the specified binary name.

Inherited from java.lang.ClassLoader:
clearAssertionStatusdefineClassdefineClassdefineClassdefineClassdefinePackagefindClassfindClassfindLibraryfindLoadedClassfindResourcefindResourcefindResourcesfindSystemClassgetClassLoadingLockgetDefinedPackagegetDefinedPackagesgetNamegetPackagegetPackagesgetParentgetPlatformClassLoadergetResourcegetResourceAsStreamgetResourcesgetSystemClassLoadergetSystemResourcegetSystemResourceAsStreamgetSystemResourcesgetUnnamedModuleisRegisteredAsParallelCapableloadClassregisterAsParallelCapableresolveClassresourcessetClassAssertionStatussetDefaultAssertionStatussetPackageAssertionStatussetSigners

Field Detail

_loadedExternalExtensionFunctionsback to summary
private final Map<String, Class<?>> _loadedExternalExtensionFunctions

Constructor Detail

TransletClassLoaderback to summary
pack-priv TransletClassLoader(ClassLoader parent)
TransletClassLoaderback to summary
pack-priv TransletClassLoader(ClassLoader parent, Map<String, Class<?>> mapEF)

Method Detail

defineClassback to summary
pack-priv Class<?> defineClass(final byte[] b)

Access to final protected superclass member from outer class.

defineClassback to summary
pack-priv Class<?> defineClass(final byte[] b, ProtectionDomain pd)
loadClassback to summary
public Class<?> loadClass(String name) throws ClassNotFoundException

Overrides java.lang.ClassLoader.loadClass.

Doc from java.lang.ClassLoader.loadClass.

Loads the class with the specified binary name. This method searches for classes in the same manner as the loadClass(String, boolean) method. It is invoked by the Java virtual machine to resolve class references. Invoking this method is equivalent to invoking loadClass(name, false).

Annotations
@Override
Exceptions
ClassNotFoundException:
If the class was not found