com.legstar.coxb.transform
Class AbstractXmlTransformers

java.lang.Object
  extended by com.legstar.coxb.transform.AbstractXmlTransformers
All Implemented Interfaces:
IHostXmlTransformers

public abstract class AbstractXmlTransformers
extends Object
implements IHostXmlTransformers

A generic class that provides transformer capabilities for a given structure.

A structure maps to an XSD and a COBOL structure. This class does not implement the transformers, it acts as a container.

Classes derived from this one will typically implement a constructor that creates the directional transformers, XML to host and host to XML.


Constructor Summary
AbstractXmlTransformers()
          No arg constructor.
AbstractXmlTransformers(IXmlToHostTransformer xmlToHost, IHostToXmlTransformer hostToXml)
          Creates a provider with its directional transformers.
 
Method Summary
 IHostToXmlTransformer getHostToXml()
           
 IXmlToHostTransformer getXmlToHost()
           
 void setHostToXml(IHostToXmlTransformer hostToXml)
           
 void setXmlToHost(IXmlToHostTransformer xmlToHost)
           
 byte[] toHost(Source source)
          Transforms XML to host data.
 byte[] toHost(Source source, HostTransformStatus status)
          Transforms XML source to host data.
 byte[] toHost(Source source, String hostCharset)
          Transforms XML to host data with a specific host character set.
 byte[] toHost(Source source, String hostCharset, HostTransformStatus status)
          Transforms XML source to host data with a specific host character set.
 void toXml(byte[] hostData, Writer writer)
          Transforms host data to XML.
 void toXml(byte[] hostData, Writer writer, HostTransformStatus status)
          Transforms host data to XML.
 void toXml(byte[] hostData, Writer writer, String hostCharset)
          Transforms host data to XML with a specific host character set.
 void toXml(byte[] hostData, Writer writer, String hostCharset, HostTransformStatus status)
          Transforms host data to XML using a specific host character set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractXmlTransformers

public AbstractXmlTransformers()
No arg constructor. Caller is responsible for setting the internal transformers.


AbstractXmlTransformers

public AbstractXmlTransformers(IXmlToHostTransformer xmlToHost,
                               IHostToXmlTransformer hostToXml)
Creates a provider with its directional transformers.

Parameters:
xmlToHost - XML to host transformer
hostToXml - host to XML transformer
Method Detail

getXmlToHost

public IXmlToHostTransformer getXmlToHost()
Returns:
the transformer that turns a XML into host data

setXmlToHost

public void setXmlToHost(IXmlToHostTransformer xmlToHost)
Parameters:
xmlToHost - the transformer that turns an XML into host data to set

getHostToXml

public IHostToXmlTransformer getHostToXml()
Returns:
the transformer that turns host data into an XML

setHostToXml

public void setHostToXml(IHostToXmlTransformer hostToXml)
Parameters:
hostToXml - the transformer that turns host data into an XML to set

toHost

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

Specified by:
toHost in interface IHostXmlTransformers
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

toHost

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

Specified by:
toHost in interface IHostXmlTransformers
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

toXml

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

Specified by:
toXml in interface IHostXmlTransformers
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

toXml

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

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

toHost

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

Specified by:
toHost in interface IHostXmlTransformers
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

toHost

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

Specified by:
toHost in interface IHostXmlTransformers
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

toXml

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

Specified by:
toXml in interface IHostXmlTransformers
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

toXml

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

Specified by:
toXml in interface IHostXmlTransformers
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


Copyright © 2015 LegSem. All Rights Reserved.