Package com.ibm.di.fc
Class ScriptedFC
- java.lang.Object
-
- com.ibm.di.fc.Function
-
- com.ibm.di.fc.ScriptedFC
-
- All Implemented Interfaces:
FunctionInterface
,VersionInfoInterface
,java.awt.event.ActionListener
,java.util.EventListener
public class ScriptedFC extends Function implements java.awt.event.ActionListener
This is a function component that relays FC operations to a user defined script.
-
-
Constructor Summary
Constructors Constructor Description ScriptedFC()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent event)
This method enables the script to use action listeners.java.lang.Object
callFunction(java.lang.String func, java.lang.Object[] params)
Calls a script function with given parameters.java.lang.String
getVersion()
Return version informationvoid
initialize(java.lang.Object obj)
Called once to initialize the functionjava.lang.Object
perform(java.lang.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
-
-
-
-
Method Detail
-
initialize
public void initialize(java.lang.Object obj) throws java.lang.Exception
Called once to initialize the function- Specified by:
initialize
in interfaceFunctionInterface
- Overrides:
initialize
in classFunction
- Parameters:
obj
- an initialization object passed directly to the script function "initialize"- Throws:
java.lang.Exception
- An exception is thrown if this method fails.
-
terminate
public void terminate() throws java.lang.Exception
This method is/should be called once before the object is released.- Specified by:
terminate
in interfaceFunctionInterface
- Overrides:
terminate
in classFunction
- Throws:
java.lang.Exception
-
callFunction
public java.lang.Object callFunction(java.lang.String func, java.lang.Object[] params) throws java.lang.Exception
Calls a script function with given parameters.- Parameters:
func
- Name of the functionparams
- Array of positional parameters- Returns:
- The result from the function call
- Throws:
java.lang.Exception
- if any error occurs.
-
actionPerformed
public void actionPerformed(java.awt.event.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 interfacejava.awt.event.ActionListener
- Parameters:
event
-ActionEvent
-
perform
public java.lang.Object perform(java.lang.Object obj) throws java.lang.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 interfaceFunctionInterface
- Parameters:
obj
- the input object for the function- Returns:
- the output object for the function
- Throws:
java.lang.Exception
- An exception is thrown if this method fails.
-
getVersion
public java.lang.String getVersion()
Return version information- Specified by:
getVersion
in interfaceVersionInfoInterface
- Returns:
- The version value
-
-