Package com.ibm.di.parser
Class ScriptParser
- java.lang.Object
-
- com.ibm.di.parser.ParserImpl
-
- 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
Constructors Constructor Description ScriptParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
closeParser()
This method is called by the hosting component (e.g.void
flush()
This method is called by the hosting component (e.g.java.lang.String
getName()
Retrieves name of the FC.java.lang.String
getVersion()
Version information.void
initParser()
Initializes parser's components.java.lang.Object
querySchema(java.lang.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
-
-
-
-
Method Detail
-
initParser
public void initParser() throws java.lang.Exception
Initializes parser's components.- Specified by:
initParser
in interfaceParserInterface
- Overrides:
initParser
in classParserImpl
- 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 interfaceParserInterface
- Overrides:
querySchema
in classParserImpl
- 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 interfaceParserInterface
- Overrides:
closeParser
in classParserImpl
- 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 interfaceParserInterface
- Overrides:
flush
in classParserImpl
- Throws:
java.lang.Exception
- If an I/O error occurs
-
-