com.ibm.di.fc
Class ScriptedFC

java.lang.Object
  extended by com.ibm.di.fc.Function
      extended by com.ibm.di.fc.ScriptedFC
All Implemented Interfaces:
FunctionInterface, VersionInfoInterface, ActionListener, EventListener

public class ScriptedFC
extends Function
implements ActionListener

This is a function component that relays FC operations to a user defined script.


Field Summary
 
Fields inherited from class com.ibm.di.fc.Function
logger
 
Constructor Summary
ScriptedFC()
           
 
Method Summary
 void actionPerformed(ActionEvent event)
          This method enables the script to use action listeners.
 Object callFunction(String func, Object[] params)
          Calls a script function with given parameters.
 String getVersion()
          Return version information
 void initialize(Object obj)
          Called once to initialize the function
 Object perform(Object obj)
          If this method is called with an object of type java.lang.String, java.io.File, java.io.InputStream or java.io.Reader the configured parser is provided that object as input and the returned value is an Entry object resulting from the parsing.
 void terminate()
          This method is/should be called once before the object is released.
 
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, updateSchema, verifyInitialized
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptedFC

public ScriptedFC()
Method Detail

initialize

public void initialize(Object obj)
                throws Exception
Called once to initialize the function

Specified by:
initialize in interface FunctionInterface
Overrides:
initialize in class Function
Parameters:
obj - an initialization object passed directly to the script function "initialize"
Throws:
Exception - An exception is thrown if this method fails.

terminate

public void terminate()
               throws Exception
This method is/should be called once before the object is released.

Specified by:
terminate in interface FunctionInterface
Overrides:
terminate in class Function
Throws:
Exception

callFunction

public Object callFunction(String func,
                           Object[] params)
                    throws Exception
Calls a script function with given parameters.

Parameters:
func - Name of the function
params - Array of positional parameters
Returns:
The result from the function call
Throws:
Exception - if any error occurs.

actionPerformed

public void actionPerformed(ActionEvent event)
This method enables the script to use action listeners. The script must use addActionListener(fc), which in turn will forward the action event to the script function "actionPerformed(fc, event)".

Specified by:
actionPerformed in interface ActionListener
Parameters:
event - ActionEvent

perform

public Object perform(Object obj)
               throws Exception
If this method is called with an object of type java.lang.String, java.io.File, java.io.InputStream or java.io.Reader the configured parser is provided that object as input and the returned value is an Entry object resulting from the parsing. If this method is called with an Entry object, the parser is used to generate a byte stream that is returned either as a byte array or java.lang.String object. The latter depends on the configuration switch "returnString" setting.

Specified by:
perform in interface FunctionInterface
Parameters:
obj - the input object for the function
Returns:
the output object for the function
Throws:
Exception - An exception is thrown if this method fails.

getVersion

public String getVersion()
Return version information

Specified by:
getVersion in interface VersionInfoInterface
Returns:
The version value