com.legstar.coxb.transform
Class AbstractXmlToHostTransformer

java.lang.Object
  extended by com.legstar.coxb.transform.AbstractXmlTransformer
      extended by com.legstar.coxb.transform.AbstractXmlToHostTransformer
All Implemented Interfaces:
IXmlToHostTransformer

public abstract class AbstractXmlToHostTransformer
extends AbstractXmlTransformer
implements IXmlToHostTransformer

Generic methods to transform XML to host data.


Constructor Summary
AbstractXmlToHostTransformer(IJavaToHostTransformer javaToHostTransformer)
          Create an XML to Host transformer using a Java to Host transformer.
 
Method Summary
 IJavaToHostTransformer getJavaToHostTransformer()
           
 Object getObjectFromXml(Source source)
          Unmarshal an XML to get the JAXB value object.
 Unmarshaller getXmlUnmarshaller()
           
 byte[] transform(Source source)
          Transforms XML to host data.
 byte[] transform(Source source, HostTransformStatus status)
          Transforms XML to host data.
 byte[] transform(Source source, String hostCharset)
          Transforms XML to host data with a specific host character set.
 byte[] transform(Source source, String hostCharset, HostTransformStatus status)
          Transforms XML to host data with a specific host character set.
 
Methods inherited from class com.legstar.coxb.transform.AbstractXmlTransformer
getJAXBContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractXmlToHostTransformer

public AbstractXmlToHostTransformer(IJavaToHostTransformer javaToHostTransformer)
                             throws HostTransformException
Create an XML to Host transformer using a Java to Host transformer.

Parameters:
javaToHostTransformer - the java to host transformer
Throws:
HostTransformException - if transformer cannot be created
Method Detail

transform

public byte[] transform(Source source,
                        String hostCharset,
                        HostTransformStatus status)
                 throws HostTransformException
Transforms XML to host data with a specific host character set.

Specified by:
transform in interface IXmlToHostTransformer
Parameters:
source - the XML Source to unmarshal XML data from (such as SAXSource, DOMSource, and StreamSource)
hostCharset - the host character set
status - will contain information on the transformation after it is executed
Returns:
a byte array with host data
Throws:
HostTransformException - if transformation fails

transform

public byte[] transform(Source source,
                        String hostCharset)
                 throws HostTransformException
Transforms XML to host data with a specific host character set.

Specified by:
transform in interface IXmlToHostTransformer
Parameters:
source - the XML Source to unmarshal XML data from (such as SAXSource, DOMSource, and StreamSource)
hostCharset - the host character set
Returns:
a byte array with host data
Throws:
HostTransformException - if transformation fails

transform

public byte[] transform(Source source)
                 throws HostTransformException
Transforms XML to host data.

Specified by:
transform in interface IXmlToHostTransformer
Parameters:
source - the XML Source to unmarshal XML data from (such as SAXSource, DOMSource, and StreamSource)
Returns:
a byte array with host data
Throws:
HostTransformException - if transformation fails

transform

public byte[] transform(Source source,
                        HostTransformStatus status)
                 throws HostTransformException
Transforms XML to host data.

Specified by:
transform in interface IXmlToHostTransformer
Parameters:
source - the XML Source to unmarshal XML data from (such as SAXSource, DOMSource, and StreamSource)
status - will contain information on the transformation after it is executed
Returns:
a byte array with host data
Throws:
HostTransformException - if transformation fails

getObjectFromXml

public Object getObjectFromXml(Source source)
                        throws HostTransformException
Unmarshal an XML to get the JAXB value object.

Parameters:
source - the XML Source to unmarshal XML data from (such as SAXSource, DOMSource, and StreamSource)
Returns:
a JAXB value object
Throws:
HostTransformException - if transformation fails

getJavaToHostTransformer

public IJavaToHostTransformer getJavaToHostTransformer()
Returns:
the Java to Host transformer

getXmlUnmarshaller

public Unmarshaller getXmlUnmarshaller()
Returns:
the JAXB Unmarshaller (Object to XML)


Copyright © 2015 LegSem. All Rights Reserved.