Search in sources :

Example 1 with AbstractTranslet

use of org.apache.xalan.xsltc.runtime.AbstractTranslet in project servicemix-bundles by apache.

the class TemplatesImpl method getTransletInstance.

/**
 * 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.
 */
private Translet getTransletInstance() throws TransformerConfigurationException {
    try {
        if (_name == null)
            return null;
        if (_class == null)
            defineTransletClasses();
        // The translet needs to keep a reference to all its auxiliary
        // class to prevent the GC from collecting them
        AbstractTranslet translet = (AbstractTranslet) _class[_transletIndex].newInstance();
        translet.postInitialization();
        translet.setTemplates(this);
        if (_auxClasses != null) {
            translet.setAuxiliaryClasses(_auxClasses);
        }
        return translet;
    } catch (InstantiationException e) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.TRANSLET_OBJECT_ERR, _name);
        throw new TransformerConfigurationException(err.toString());
    } catch (IllegalAccessException e) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.TRANSLET_OBJECT_ERR, _name);
        throw new TransformerConfigurationException(err.toString());
    }
}
Also used : TransformerConfigurationException(javax.xml.transform.TransformerConfigurationException) ErrorMsg(org.apache.xalan.xsltc.compiler.util.ErrorMsg) AbstractTranslet(org.apache.xalan.xsltc.runtime.AbstractTranslet)

Aggregations

TransformerConfigurationException (javax.xml.transform.TransformerConfigurationException)1 ErrorMsg (org.apache.xalan.xsltc.compiler.util.ErrorMsg)1 AbstractTranslet (org.apache.xalan.xsltc.runtime.AbstractTranslet)1