Search in sources :

Example 6 with MCRParameterizedTransformer

use of org.mycore.common.content.transformer.MCRParameterizedTransformer in project mycore by MyCoRe-Org.

the class MCRLayoutService method transform.

private MCRContent transform(MCRContentTransformer transformer, MCRContent source, MCRParameterCollector parameter, String filename) throws IOException, TransformerException, SAXException {
    LOGGER.debug("MCRLayoutService starts to output {}", getMimeType(transformer));
    long start = System.currentTimeMillis();
    try {
        if (transformer instanceof MCRParameterizedTransformer) {
            MCRParameterizedTransformer paramTransformer = (MCRParameterizedTransformer) transformer;
            return paramTransformer.transform(source, parameter);
        } else {
            return transformer.transform(source);
        }
    } finally {
        LOGGER.debug("MCRContent transformation took {} ms.", System.currentTimeMillis() - start);
    }
}
Also used : MCRParameterizedTransformer(org.mycore.common.content.transformer.MCRParameterizedTransformer)

Aggregations

MCRParameterizedTransformer (org.mycore.common.content.transformer.MCRParameterizedTransformer)6 MCRContentTransformer (org.mycore.common.content.transformer.MCRContentTransformer)4 MCRException (org.mycore.common.MCRException)3 MCRContent (org.mycore.common.content.MCRContent)3 MCRParameterCollector (org.mycore.common.xsl.MCRParameterCollector)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 IOException (java.io.IOException)1 ServletOutputStream (javax.servlet.ServletOutputStream)1 TransformerException (javax.xml.transform.TransformerException)1 MCRJDOMContent (org.mycore.common.content.MCRJDOMContent)1 MCRPathContent (org.mycore.common.content.MCRPathContent)1 MCRWrappedContent (org.mycore.common.content.MCRWrappedContent)1 MCRDerivate (org.mycore.datamodel.metadata.MCRDerivate)1 MCRObjectID (org.mycore.datamodel.metadata.MCRObjectID)1 MCRPath (org.mycore.datamodel.niofs.MCRPath)1 SAXException (org.xml.sax.SAXException)1