com.ibm.di.fc.castorbind
Class CastorXMLToJava

java.lang.Object
  extended by com.ibm.di.fc.Function
      extended by com.ibm.di.fc.castorbind.CastorXMLToJava
All Implemented Interfaces:
FunctionInterface, VersionInfoInterface

public class CastorXMLToJava
extends Function

This is the CastorXMLToJava class. The CastorXMLToJava Function Component creates an Entry or a general Java object from an XML document. CastorXMLToJava provides the option to get data from certain parts of the XML tree when unmarshalling the XML document.


Field Summary
 
Fields inherited from class com.ibm.di.fc.Function
logger
 
Constructor Summary
CastorXMLToJava()
           
 
Method Summary
 String getVersion()
          Version information.
 void initialize(Object obj)
          In the initialize method the FC initializes its parameters.
 Object perform(Object obj)
          This method retruns an XML document from a Java object or an Entry object.
 Entry unmarshal(Entry aEntry, String aMappingFile, List aAttributeList)
          This method is called when the CastorXMLToJava FC is passed an Entry object.
 Object unmarshal(Object aInputXML, String aMappingFile)
          This method is called when the CastorXMLToJava FC is passed a java.lang.Object.
 
Methods inherited from class com.ibm.di.fc.Function
debug, getConfiguration, getContext, getDebug, getLog, getParam, getRSInterface, getUI, initialize, logmsg, querySchema, setConfiguration, setContext, setDebug, setLog, setParam, setRSInterface, terminate, updateSchema, verifyInitialized
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CastorXMLToJava

public CastorXMLToJava()
Method Detail

initialize

public void initialize(Object obj)
                throws Exception
In the initialize method the FC initializes its parameters.

Specified by:
initialize in interface FunctionInterface
Overrides:
initialize in class Function
Parameters:
obj - not used.
Throws:
Exception - If the mapping file parameter is missing or the return type is not valid.

perform

public Object perform(Object obj)
               throws Exception
This method retruns an XML document from a Java object or an Entry object. When the method is passed an Entry object on input, it will return an Entry object. This mode of operation is called Entry mode. If the "inputXMLType" parameter specifies "DOMElement", the method will expect on input an Entry with an Attribute named "xmlDOMElement" with value of type "org.w3c.dom.Element". If the "inputXMLType" parameter specifies "String", an Entry with an Attribute named "xmlString" and value of type "java.lang.String" is expected on input. The output generated is an Entry whose Attributes are the unmarshalled XML elements as specified by the "attributeSpecs" parameter and the mapping file. When the method is passed an object that is not an Entry on input (string or a DOM element) it returns the raw Java object as it is unmarshalled by Castor. This mode of operation is called non-Entry mode. If the "inputXMLType" parameter specifies "DOMElement", the method will expect on input a "org.w3c.dom.Element" object. If the "inputXMLType" parameter specifies "String", a "java.lang.String" object is expected on input.

Parameters:
obj - this is the input data passed to the FC.
Returns:
Returns an Entry or a Java object depending on the input data.
Throws:
Exception - If initialization is not performed or if an Exception occur during the marshaling process.

unmarshal

public Entry unmarshal(Entry aEntry,
                       String aMappingFile,
                       List aAttributeList)
                throws Exception
This method is called when the CastorXMLToJava FC is passed an Entry object. The output generated is an Entry whose Attributes are the unmarshalled XML elements as specified by the "attributeSpecs" parameter and the mapping file.

Parameters:
aEntry - the input data as an Entry object.
aMappingFile - the path to the Castor XML Mapping File that defines mapping rules.
aAttributeList - List of attributes which contains the attributes specified in the Attribute Specification section of the FC.
Returns:
Returns an Entry object which contains the unmarshalled XML.
Throws:
Exception - If an Exception occurs during the object unmarshaling.

unmarshal

public Object unmarshal(Object aInputXML,
                        String aMappingFile)
                 throws Exception
This method is called when the CastorXMLToJava FC is passed a java.lang.Object.

Parameters:
aInputXML - the input data as a java.lang.Object.
aMappingFile - the path to the Castor XML Mapping File that defines mapping rules.
Returns:
Returns the raw Java object as it is unmarshalled by Castor.
Throws:
Exception - If an Exception occurs during the object unmarshaling.

getVersion

public String getVersion()
Version information.

Returns:
version information.