com.ibm.di.parser
Class ScriptParser

java.lang.Object
  extended by com.ibm.di.parser.ParserImpl
      extended by com.ibm.di.parser.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.


Field Summary
 
Fields inherited from class com.ibm.di.parser.ParserImpl
_debug, myConfiguration
 
Constructor Summary
ScriptParser()
           
 
Method Summary
 void closeParser()
          This method is called by the hosting component (e.g.
 void flush()
          This method is called by the hosting component (e.g.
 String getName()
          Retrieves name of the FC.
 String getVersion()
          Version information.
 void initParser()
          Initializes parser's components.
 Object querySchema(Object source)
          Discover the schema for the Parser.
 Entry readEntry()
          Return the next entry from the current input stream.
 void writeEntry(Entry entry)
          Write an entry to the current output stream.
 
Methods inherited from class com.ibm.di.parser.ParserImpl
debug, debugMode, getClassInstance, getContext, getDebug, getInputStream, getOutputStream, getParam, getParser, getReader, getWriter, isDeltaSupported, logmsg, registerScriptBeans, setConfiguration, setContext, setDebug, setInputStream, setInputStream, setInputStream, setOutputStream, setOutputStream, setParam, setParser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptParser

public ScriptParser()
Method Detail

initParser

public void initParser()
                throws Exception
Initializes parser's components.

Specified by:
initParser in interface ParserInterface
Overrides:
initParser in class ParserImpl
Throws:
Exception - if an error occurs.

getName

public String getName()
Retrieves name of the FC.

Returns:
component's name.

writeEntry

public void writeEntry(Entry entry)
                throws Exception
Write an entry to the current output stream.

Parameters:
entry - The entry to write
Throws:
Exception - if an error occurs.

readEntry

public Entry readEntry()
                throws Exception
Return the next entry from the current input stream.

Returns:
The next entry from the input stream
Throws:
Exception

querySchema

public Object querySchema(Object source)
                   throws 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:
Exception - If an I/O error occurs

getVersion

public String getVersion()
Version information.

Returns:
version information

closeParser

public void closeParser()
                 throws 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:
Exception - If an I/O error occurs

flush

public void flush()
           throws 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:
Exception - If an I/O error occurs