com.ibm.di.fc.emf
Class EmfSdoToXml

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

public class EmfSdoToXml
extends Function

Function Component that using XML Schema converts Data Objects to an XML document. It also implements a discover schema functionality through its updateSchema method.


Field Summary
 
Fields inherited from class com.ibm.di.fc.Function
logger
 
Constructor Summary
EmfSdoToXml()
           
 
Method Summary
static commonj.sdo.DataObject createRootObject(String xsdFile)
          Creates and returns a Data Object corresponding to the root object of a document compliant to the XML Schema specified in the xsdFile file.
 String getVersion()
          Returns function component's version
 void initialize(Object obj)
          Initializes the function component.
 Object perform(Object obj)
          Serializes Data Objects to XML document according to the XML Schema specified by the xsdFile function component parameter.
 boolean updateSchema(FunctionConfig config)
          Implements the discovery schema functionality.
 
Methods inherited from class com.ibm.di.fc.Function
debug, getConfiguration, getContext, getLog, getParam, getUI, initialize, logmsg, setConfiguration, setContext, setLog, setParam, terminate, verifyInitialized
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmfSdoToXml

public EmfSdoToXml()
Method Detail

createRootObject

public static commonj.sdo.DataObject createRootObject(String xsdFile)
                                               throws Exception
Creates and returns a Data Object corresponding to the root object of a document compliant to the XML Schema specified in the xsdFile file.

Parameters:
xsdFile - location of a XML Schema file.
Returns:
Data Object corresponding to the root object of a document compliant to the XML Schema specified
Throws:
Exception - if the specified file cannot be found or is not valid XML Schema. if the XML Schema does not define a root element.

initialize

public void initialize(Object obj)
                throws Exception
Initializes the function component. Sets instance members corresponding to the function component paramters.

Specified by:
initialize in interface FunctionInterface
Overrides:
initialize in class Function
Parameters:
obj - this object provides information to the Function Component needed on initialization
Throws:
Exception - if the xsdFile parameter is not specified

perform

public Object perform(Object obj)
               throws Exception
Serializes Data Objects to XML document according to the XML Schema specified by the xsdFile function component parameter. The Data Objects are stored in the Entry Attributes of the TDI Entry passed as parameter to the function.

Parameters:
obj - the object is the working TDI Entry and should be of type com.ibm.di.entry.Entry.
Returns:
TDI Entry containing Entry Attributes coresponding to the XML elements and attributes.
Throws:
Exception - if the names of the Entry Attributes do not represent valid XML elements. if an Entry Attribute for the root element does not exist in the entry and the XML Schema does not define a root element.

updateSchema

public boolean updateSchema(FunctionConfig config)
                     throws Exception
Implements the discovery schema functionality. The method reads the specified XML Schema File and creates Entry Attribute names based on the nesting of the XML elements.

Specified by:
updateSchema in interface FunctionInterface
Overrides:
updateSchema in class Function
Parameters:
config - contains the function configuration parameter.
Returns:
returns true on success
Throws:
Exception - If the the xsdFile parameter is not specified. If the the specified file extension is not .xsd If the target file is not found If the target file is not valid XML Schema file

getVersion

public String getVersion()
Returns function component's version