Class ScriptParser

  • All Implemented Interfaces:
    ParserInterface, VersionInfoInterface

    public class ScriptParser
    extends ParserImpl
    To operate, a Script Parser must implement a few functions. The functions do not use parameters. Passing data between the hosting Connector and the script is done by using predefined objects. One of these predefined objects is the result object which is used to communicate status information. Upon entry into either function, the status field is set to normal which causes the hosting Parser to continue calls. Signaling end-of-input or errors is done by setting the status and message fields in this object. The entry object is populated on calls to writeEntry and is expected to be populated in the readEntry function. When reading entries you have the inp BufferedReader object available for reading character data from a stream. When writing entries you have the out BufferedWriter object available for writing character data to a stream.
    • Constructor Detail

      • ScriptParser

        public ScriptParser()
    • Method Detail

      • initParser

        public void initParser()
                        throws java.lang.Exception
        Initializes parser's components.
        Specified by:
        initParser in interface ParserInterface
        Overrides:
        initParser in class ParserImpl
        Throws:
        java.lang.Exception - if an error occurs.
      • getName

        public java.lang.String getName()
        Retrieves name of the FC.
        Returns:
        component's name.
      • writeEntry

        public void writeEntry​(Entry entry)
                        throws java.lang.Exception
        Write an entry to the current output stream.
        Parameters:
        entry - The entry to write
        Throws:
        java.lang.Exception - if an error occurs.
      • readEntry

        public Entry readEntry()
                        throws java.lang.Exception
        Return the next entry from the current input stream.
        Returns:
        The next entry from the input stream
        Throws:
        java.lang.Exception
      • querySchema

        public java.lang.Object querySchema​(java.lang.Object source)
                                     throws java.lang.Exception
        Discover the schema for the Parser. For example, a XML Parser could return a representation of the XML Schema or the DTD referenced in a XML file.
        Specified by:
        querySchema in interface ParserInterface
        Overrides:
        querySchema in class ParserImpl
        Parameters:
        source - The object on which to discover schema
        Returns:
        A Vector of com.ibm.di.entry.Entry objects describing each entity
        Throws:
        java.lang.Exception - If an I/O error occurs
      • getVersion

        public java.lang.String getVersion()
        Version information.
        Returns:
        version information
      • closeParser

        public void closeParser()
                         throws java.lang.Exception
        This method is called by the hosting component (e.g. connector) to close and release parser resources.
        Specified by:
        closeParser in interface ParserInterface
        Overrides:
        closeParser in class ParserImpl
        Throws:
        java.lang.Exception - If an I/O error occurs
      • flush

        public void flush()
                   throws java.lang.Exception
        This method is called by the hosting component (e.g. connector) to close and release parser resources.
        Specified by:
        flush in interface ParserInterface
        Overrides:
        flush in class ParserImpl
        Throws:
        java.lang.Exception - If an I/O error occurs