Search in sources :

Example 1 with MCRTransformerPipe

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

the class MCRLayoutTransformerFactory method buildLayoutTransformer.

private static MCRContentTransformer buildLayoutTransformer(String id) throws Exception {
    String idStripped = id.replaceAll("-default$", "");
    LOGGER.info("Configure property MCR.ContentTransformer.{}.Class if you do not want to use default behaviour.", idStripped);
    String stylesheet = getResourceName(id);
    if (stylesheet == null) {
        LOGGER.info("Using noop transformer for {}", idStripped);
        return NOOP_TRANSFORMER;
    }
    String[] stylesheets = getStylesheets(idStripped, stylesheet);
    MCRContentTransformer transformer = MCRXSLTransformer.getInstance(stylesheets);
    String mimeType = transformer.getMimeType();
    if (isPDF(mimeType)) {
        transformer = new MCRTransformerPipe(transformer, fopper);
        LOGGER.info("Using stylesheet '{}' for {} and MCRFopper for PDF output.", Lists.newArrayList(stylesheets), idStripped);
    } else {
        LOGGER.info("Using stylesheet '{}' for {}", Lists.newArrayList(stylesheets), idStripped);
    }
    transformers.put(id, transformer);
    return transformer;
}
Also used : MCRTransformerPipe(org.mycore.common.content.transformer.MCRTransformerPipe) MCRContentTransformer(org.mycore.common.content.transformer.MCRContentTransformer)

Aggregations

MCRContentTransformer (org.mycore.common.content.transformer.MCRContentTransformer)1 MCRTransformerPipe (org.mycore.common.content.transformer.MCRTransformerPipe)1