org.ikasan.framework.component.transformation
Class XMLReaderTransformer

java.lang.Object
  extended by org.ikasan.framework.component.transformation.XMLReaderTransformer
All Implemented Interfaces:
Transformer, FlowComponent

public class XMLReaderTransformer
extends Object
implements Transformer

This class is a Transformer that acts on incoming Payloads within an Event and transforms the content to XML based on the supplied XMLReader instance.

This is a copy transform working off of the SAX call backs on the reader to provide an output XML.

NOTE: This is not a stylesheet transformer. This implementation is notable for the following reasons:

1) It is intended to be thread safe with respect to the underlying javax.xml.transform.Transformer as a new instance is created every time the business method (onEvent) is called.

2) Its intended use is to transform non-xml Payloads to XML through the configuration of a content specific XMLReader. e.g. an XMLReader implementation capable of reading fixed length flat files can be injected on construction thus allowing flat file (fixed length) payloads to be transformed to XML.

3) Rather than relying on the default ErrorListener this transformer supplies its own implementation designed to propagate the exceptions thrown for parse time errors and warnings

Author:
Ikasan Development Team

Constructor Summary
XMLReaderTransformer(TransformerFactory transformerFactory, XMLReader xmlReader)
          Constructor
 
Method Summary
 void onEvent(Event event)
          Transforms or otherwise changes the passed in Event
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLReaderTransformer

public XMLReaderTransformer(TransformerFactory transformerFactory,
                            XMLReader xmlReader)
Constructor

Parameters:
transformerFactory - The transformer factory that provides the transformers
xmlReader - The XML REader to use
Method Detail

onEvent

public void onEvent(Event event)
             throws TransformationException
Description copied from interface: Transformer
Transforms or otherwise changes the passed in Event

Specified by:
onEvent in interface Transformer
Parameters:
event - Event to transform
Throws:
TransformationException - Exception if we could not transform


Copyright © 2007-2012 Ikasan. All Rights Reserved.