Package com.ibm.di.fc

Class 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 Detail

      • ScriptedFC

        public ScriptedFC()
    • Method Detail

      • initialize

        public void initialize​(java.lang.Object obj)
                        throws java.lang.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:
        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 interface FunctionInterface
        Overrides:
        terminate in class Function
        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 function
        params - 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 interface java.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 interface FunctionInterface
        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 interface VersionInfoInterface
        Returns:
        The version value