Personal tools
You are here: Home CinnamonServer API TransformationEngine

TransformationEngine

Transformers in Cinnamon

Introduction

A transformer in Cinnamon is an object which defines a transformation process. This process converts a document object and, depending on the API method of the TransformationEngine, stores the result in the repository or sends it to the client. This enables Cinnamon to perform flexible conversions between different document formats, provided a Java class exists on the server which performs the requested transformation.

Examples for possible transformations

  • document conversion: HTML to PDF
  • image conversion: JPEG to PNG
  • filtering: XML => XSLT => XML

Configuration of transformers

Transformer table

Currently, transformers have to be configured in the database. A configuration via the AdminTool is not yet planned. But as the transformer_class needs to be written by a developer, this is not a real problem - if you can write a transformer, adding it to the repository is really not that difficult.

A transformer object needs (along with the base attributes like id, name, description):

  • a transformer class (this is the Java class which performs the actual conversion)
  • a source format
  • a target format

Only document objects with the correct source format may serve as input, and the transformer class guarantees that the output is of the target type.

How to use transformers

You have to enable the TransformationEngine in your cinnamon_config.xml - add the following Element to the repository:

<apiClass>server.extension.TransformationEngine</apiClass>

This will, upon restart of the Cinnamon server, add the following methods to the API:

  • listTransformers
  • transformObjectToFile
    Transform a document object and return the result as a file.
  • transformObject
    Transform a document object and replace it with the result.

Currently available Transformer classes

At the moment, only the XHTML-Transformer is available, which converts an XHTML document into a PDF file. It is based on the open source Java library Flying Saucer. Other open source or proprietary transformers are added as required. If you wish to contribute a transformer class, please take a look at the source code.

 

Document Actions