com.legstar.coxb.transform
Class AbstractHostToXmlTransformer

java.lang.Object
  extended by com.legstar.coxb.transform.AbstractXmlTransformer
      extended by com.legstar.coxb.transform.AbstractHostToXmlTransformer
All Implemented Interfaces:
IHostToXmlTransformer

public abstract class AbstractHostToXmlTransformer
extends AbstractXmlTransformer
implements IHostToXmlTransformer

Generic methods to transform host data to XML.


Constructor Summary
AbstractHostToXmlTransformer(IHostToJavaTransformer hostToJavaTransformer)
          Create an Host to XML transformer using a Host to Java transformer.
 
Method Summary
abstract  String getElementName()
           
 IHostToJavaTransformer getHostToJavaTransformer()
           
abstract  String getNamespace()
           
 void getXmlFromObject(Object valueObject, Writer writer)
          Marshal JAXB value object to get the XML.
 Marshaller getXmlMarshaller()
           
abstract  boolean isXmlRootElement()
           
 void transform(byte[] hostData, int offset, Writer writer)
          Transforms host data to XML.
 void transform(byte[] hostData, int offset, Writer writer, HostTransformStatus status)
          Transforms host data to XML.
 void transform(byte[] hostData, int offset, Writer writer, String hostCharset)
          Transforms host data to XML with a specific host character set.
 void transform(byte[] hostData, int offset, Writer writer, String hostCharset, HostTransformStatus status)
          Transforms host data to XML with a specific host character set.
 void transform(byte[] hostData, Writer writer)
          Transforms host data to XML.
 void transform(byte[] hostData, Writer writer, HostTransformStatus status)
          Transforms host data to XML.
 void transform(byte[] hostData, Writer writer, String hostCharset)
          Transforms host data to XML with a specific host character set.
 void transform(byte[] hostData, Writer writer, String hostCharset, HostTransformStatus status)
          Transforms host data to XML 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

AbstractHostToXmlTransformer

public AbstractHostToXmlTransformer(IHostToJavaTransformer hostToJavaTransformer)
                             throws HostTransformException
Create an Host to XML transformer using a Host to Java transformer.

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

transform

public void transform(byte[] hostData,
                      int offset,
                      Writer writer,
                      String hostCharset,
                      HostTransformStatus status)
               throws HostTransformException
Transforms host data to XML with a specific host character set.

Specified by:
transform in interface IHostToXmlTransformer
Parameters:
hostData - a byte array containing host data
offset - index of first byte to process in hostData
writer - XML will be sent to this writer.
hostCharset - the host character set
status - will contain information on the transformation after it is executed
Throws:
HostTransformException - if transformation fails

transform

public void transform(byte[] hostData,
                      int offset,
                      Writer writer,
                      String hostCharset)
               throws HostTransformException
Transforms host data to XML with a specific host character set.

Specified by:
transform in interface IHostToXmlTransformer
Parameters:
hostData - a byte array containing host data
offset - index of first byte to process in hostData
writer - XML will be sent to this writer.
hostCharset - the host character set
Throws:
HostTransformException - if transformation fails

transform

public void transform(byte[] hostData,
                      Writer writer,
                      String hostCharset)
               throws HostTransformException
Transforms host data to XML with a specific host character set.

Specified by:
transform in interface IHostToXmlTransformer
Parameters:
hostData - a byte array containing host data
writer - XML will be sent to this writer.
hostCharset - the host character set
Throws:
HostTransformException - if transformation fails

transform

public void transform(byte[] hostData,
                      Writer writer)
               throws HostTransformException
Transforms host data to XML.

Specified by:
transform in interface IHostToXmlTransformer
Parameters:
hostData - a byte array containing host data
writer - XML will be sent to this writer.
Throws:
HostTransformException - if transformation fails

transform

public void transform(byte[] hostData,
                      int offset,
                      Writer writer)
               throws HostTransformException
Transforms host data to XML.

Specified by:
transform in interface IHostToXmlTransformer
Parameters:
hostData - a byte array containing host data
offset - index of first byte to process in hostData
writer - XML will be sent to this writer.
Throws:
HostTransformException - if transformation fails

transform

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

Specified by:
transform in interface IHostToXmlTransformer
Parameters:
hostData - a byte array containing host data
writer - XML will be sent to this writer.
hostCharset - the host character set
status - will contain information on the transformation after it is executed
Throws:
HostTransformException - if transformation fails

transform

public void transform(byte[] hostData,
                      Writer writer,
                      HostTransformStatus status)
               throws HostTransformException
Transforms host data to XML.

Specified by:
transform in interface IHostToXmlTransformer
Parameters:
hostData - a byte array containing host data
writer - XML will be sent to this writer.
status - will contain information on the transformation after it is executed
Throws:
HostTransformException - if transformation fails

transform

public void transform(byte[] hostData,
                      int offset,
                      Writer writer,
                      HostTransformStatus status)
               throws HostTransformException
Transforms host data to XML.

Specified by:
transform in interface IHostToXmlTransformer
Parameters:
hostData - a byte array containing host data
offset - index of first byte to process in hostData
writer - XML will be sent to this writer.
status - will contain information on the transformation after it is executed
Throws:
HostTransformException - if transformation fails

getXmlFromObject

public void getXmlFromObject(Object valueObject,
                             Writer writer)
                      throws HostTransformException
Marshal JAXB value object to get the XML.

Root elements can be marshalled directly while non-root elements must be encapsulated in a JAXBElement before they can be marshalled.

Parameters:
valueObject - the JAXB value object
writer - XML will be sent to this writer.
Throws:
HostTransformException - if transformation fails

isXmlRootElement

public abstract boolean isXmlRootElement()
Returns:
true if the JAXB element is marked as XmlRootElement which means it does not need to be encapsulated in a JAXBElement.

getNamespace

public abstract String getNamespace()
Returns:
the XML Schema namespace

getElementName

public abstract String getElementName()
Returns:
the element name is given either by the XmlRootElement annotation or the XmlType annotation.

getHostToJavaTransformer

public IHostToJavaTransformer getHostToJavaTransformer()
Returns:
the Host to Java transformer

getXmlMarshaller

public Marshaller getXmlMarshaller()
Returns:
the JAXB Marshaller (Object to XML)


Copyright © 2015 LegSem. All Rights Reserved.