org.appng.core.model

## Class PlatformTransformer

- java.lang.Object
- - org.appng.core.model.PlatformTransformer

-     public class PlatformTransformer
      extends Object

  Responsible for transforming a XML document (retrieved from a `Platform`-object) to XHTML.
  Author:
    Matthias Müller

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PlatformTransformer()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addTemplates(List<Template> templates)` Adds the given `Template`s to the upcoming transformation.
    `static void` | `clearCache(Site site)` Clears the internal template-cache, which must be done if a `Site` is being reloaded.
    `String` | `getContentType()` Returns the content-type of the transformation result.
    `protected String` | `getDebugFilePrefix(Date now)`
    `Environment` | `getEnvironment()`
    `OutputFormat` | `getOutputFormat()` Returns the `OutputFormat` used during transformation
    `OutputType` | `getOutputType()` Returns the `OutputType` used during transformation
    `Platform` | `getPlatform(MarshallService marshallService, Path path)` Returns the `Platform`-object unmarshalled from the template's "conf/platform.xml"-file.
    `StyleSheetProvider` | `getStyleSheetProvider()`
    `void` | `setEnvironment(Environment environment)`
    `void` | `setOutputFormat(OutputFormat outputFormat)`
    `void` | `setOutputType(OutputType outputType)`
    `void` | `setStyleSheetProvider(StyleSheetProvider styleSheetProvider)`
    `void` | `setTemplatePath(String templatePath)` Sets the path to the active template of the current `Site`.
    `String` | `transform(ApplicationProvider applicationProvider, Properties platformProperties, String platformXML, String charSet, File debugFolder)` Performs the transformation.
    `protected void` | `writeDebugFiles(File outFolder, String platformXML, org.appng.core.model.PlatformTransformer.SourceAwareTemplate sourceAwareTemplate, TransformerException te)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PlatformTransformer

          public PlatformTransformer()

  - ### Method Detail

    - #### transform

          public String transform(ApplicationProvider applicationProvider,
                                  Properties platformProperties,
                                  String platformXML,
                                  String charSet,
                                  File debugFolder)
                           throws IOException,
                                  TransformerException

      Performs the transformation. Therefore a composite XSL-template is used, that is build from the `Template`s of the used `OutputType` and those previously added via `addTemplates(List)` (assumed the `OutputType` matches).
      Parameters:
        `applicationProvider` - the current `ApplicationProvider`
        `platformProperties` - the platform-`Properties`
        `platformXML` - an XML-string retrieved from a `Platform`-object
        `charSet` - the character-set to used in the returned content-type (see `getContentType()`)
        `debugFolder` - the folder to write debug files to
      Returns:
        the result of the transformation
      Throws:
        `FileNotFoundException` - if a template XSL-file could not be found
        `TransformerException` - when parsing or applying the XSLT template fails
        `IOException`

    - #### writeDebugFiles

          protected void writeDebugFiles(File outFolder,
                                         String platformXML,
                                         org.appng.core.model.PlatformTransformer.SourceAwareTemplate sourceAwareTemplate,
                                         TransformerException te)

    - #### getDebugFilePrefix

          protected String getDebugFilePrefix(Date now)

    - #### getStyleSheetProvider

          public StyleSheetProvider getStyleSheetProvider()

    - #### setStyleSheetProvider

          public void setStyleSheetProvider(StyleSheetProvider styleSheetProvider)

    - #### addTemplates

          public void addTemplates(List<Template> templates)

      Adds the given `Template`s to the upcoming transformation.
      Parameters:
        `templates` - a list of `Template`s

    - #### getEnvironment

          public Environment getEnvironment()

    - #### setEnvironment

          public void setEnvironment(Environment environment)

    - #### getPlatform

          public Platform getPlatform(MarshallService marshallService,
                                      Path path)
                               throws InvalidConfigurationException

      Returns the `Platform`-object unmarshalled from the template's "conf/platform.xml"-file. Also determines the `OutputType` and `OutputFormat` for the upcoming transformation.
      Parameters:
        `marshallService` - the `MarshallService` to use for unmarshalling
        `path` - the current `Path`-object
      Returns:
        the `Platform`-object
      Throws:
        `InvalidConfigurationException` - if the "conf/platform.xml"-file could net be found or unmarshalled.
      See Also:
        `getOutputFormat()`, `getOutputType()`

    - #### getContentType

          public String getContentType()

      Returns the content-type of the transformation result.
      Returns:
        the content-type

    - #### setTemplatePath

          public void setTemplatePath(String templatePath)

      Sets the path to the active template of the current `Site`.
      Parameters:
        `templatePath` - the absolute path to the directory where template of the `Site` resides

    - #### clearCache

          public static void clearCache(Site site)

      Clears the internal template-cache, which must be done if a `Site` is being reloaded.

    - #### getOutputFormat

          public OutputFormat getOutputFormat()

      Returns the `OutputFormat` used during transformation
      Returns:
        the `OutputFormat`

    - #### setOutputFormat

          public void setOutputFormat(OutputFormat outputFormat)

    - #### getOutputType

          public OutputType getOutputType()

      Returns the `OutputType` used during transformation
      Returns:
        the `OutputType`

    - #### setOutputType

          public void setOutputType(OutputType outputType)

Copyright © 2011–2023 aiticon GmbH. All rights reserved.