Class MCRContentTransformer

java.lang.Object
org.mycore.common.content.transformer.MCRContentTransformer
Direct Known Subclasses:
MCRBibTeX2MODSTransformer, MCRBibUtilsTransformer, MCRCSLJSONTransformer, MCRDebuggingTransformer, MCRFopper, MCRHTML2XHTMLContentTransformer, MCRIdentityTransformer, MCRParameterizedTransformer, MCRToJSONTransformer, MCRToPrettyXML, MCRXHTML2PDFTransformer

public abstract class MCRContentTransformer extends Object
Subclasses of MCRContentTransformer implement different methods to transform MCRContent. They may have their own additional configuration properties. Every transformer instance has a unique ID. The implementing class is configured using the property MCR.ContentTransformer.{ID}.Class Optionally, a transformer can set its returning MIME Type via MCR.ContentTransformer.{ID}.MIMEType
Author:
Frank Lützenkirchen
  • Field Details

    • mimeType

      protected String mimeType
      The MIME type of the output generated by this transformer
    • fileExtension

      protected String fileExtension
    • contentDisposition

      protected String contentDisposition
    • DEFAULT_CONTENT_DISPOSITION

      public static final String DEFAULT_CONTENT_DISPOSITION
      See Also:
  • Constructor Details

    • MCRContentTransformer

      public MCRContentTransformer()
  • Method Details

    • init

      public void init(String id)
      Called by the factory to initialize configuration of this transformer
    • transform

      public abstract MCRContent transform(MCRContent source) throws IOException
      Transforms MCRContent. Subclasses implement different transformation methods
      Throws:
      IOException
    • transform

      public void transform(MCRContent source, OutputStream out) throws IOException
      Throws:
      IOException
    • getMimeType

      public String getMimeType() throws Exception
      Returns the MIME type of the transformed content, may return the default mime type
      Throws:
      Exception
    • getEncoding

      public String getEncoding() throws Exception
      Returns the encoding of characters in the binary stream. Will return null if the encoding is unknown or the results does not represent character data.
      Throws:
      Exception
    • getFileExtension

      public String getFileExtension() throws Exception
      Returns the file extension that is usually related to the transformed content.
      Throws:
      Exception
    • getContentDisposition

      public String getContentDisposition()
    • getDefaultExtension

      protected String getDefaultExtension()
    • getDefaultMimeType

      protected String getDefaultMimeType()