com.ibm.di.parser
Class XSLbasedXMLParser

java.lang.Object
  extended by com.ibm.di.parser.ParserImpl
      extended by com.ibm.di.parser.XSLbasedXMLParser
All Implemented Interfaces:
ParserInterface, CheckpointRestartInterface, VersionInfoInterface, ErrorHandler

public class XSLbasedXMLParser
extends ParserImpl
implements ErrorHandler, CheckpointRestartInterface

A class reading and writing Entries in XML format.


Field Summary
 NodeList children
           
 int curindex
           
 DocumentBuilder db
           
 String entrytag
           
 Document inputDoc
           
 Document outputDoc
           
 Element toplevel
           
 Element toplevelInput
           
 boolean useCData
           
 String valuetag
           
 
Fields inherited from class com.ibm.di.parser.ParserImpl
_debug, myConfiguration
 
Fields inherited from interface com.ibm.di.server.CheckpointRestartInterface
RESTART_AFTER, RESTART_BEFORE, RESTART_IN
 
Constructor Summary
XSLbasedXMLParser()
           
 
Method Summary
 void closeParser()
          Close parser and deallocate resources.
 void error(SAXParseException exception)
           
 void fatalError(SAXParseException exception)
           
 void flush()
          This function is called when the parser is closing to serialize the in memory DOM tree, for a connector in add/update mode
 Entry getCheckpointInformation()
          Returns the state information for the parser.
 boolean getOmitXMLDeclaration()
           
 String getVersion()
          Return version information
 void initInput()
          This function is called as a part of parser initialisation, when the connector having this parser is in Iterator mode
 void initOutput()
          This function is called as a part of parser initialization, when the connector having this parser is in Add mode
 void initParser()
          This function is called by the connector containing this parser
 boolean isCheckpointRestartEnabled(int mode)
          Components that support checkpoint/restart for a specific mode must return TRUE from this method.
 void prepareForRestart(ALState state, Entry restartInfo, int restartPoint)
          Notifies of a restart situation.
 Entry readEntry()
          Constructs the next entry from the data structure read in initially.
 void registerScriptBeans(ScriptEngine se)
          Register objects in the script engine.
 void setOmitXMLDeclaration(boolean omit)
           
 void warning(SAXParseException err)
           
 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, 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
 

Field Detail

inputDoc

public Document inputDoc

outputDoc

public Document outputDoc

toplevel

public Element toplevel

toplevelInput

public Element toplevelInput

children

public NodeList children

curindex

public int curindex

useCData

public boolean useCData

entrytag

public String entrytag

valuetag

public String valuetag

db

public DocumentBuilder db
Constructor Detail

XSLbasedXMLParser

public XSLbasedXMLParser()
Method Detail

registerScriptBeans

public void registerScriptBeans(ScriptEngine se)
                         throws Exception
Description copied from class: ParserImpl
Register objects in the script engine. This method may be called by a hosting object to let the parser register objects in the script engine. This allows the user to access parser specific objects using predefined names in the scripting environment. The default implementation is to declare parser as a reference to the parser class instance.

Specified by:
registerScriptBeans in interface ParserInterface
Overrides:
registerScriptBeans in class ParserImpl
Parameters:
se - The script engine
Throws:
Exception

initParser

public void initParser()
                throws Exception
This function is called by the connector containing this parser

Specified by:
initParser in interface ParserInterface
Overrides:
initParser in class ParserImpl
Throws:
Exception

closeParser

public void closeParser()
                 throws Exception
Description copied from class: ParserImpl
Close parser and deallocate resources. This method closes the input and output streams.

Specified by:
closeParser in interface ParserInterface
Overrides:
closeParser in class ParserImpl
Throws:
Exception

flush

public void flush()
           throws Exception
This function is called when the parser is closing to serialize the in memory DOM tree, for a connector in add/update mode

Specified by:
flush in interface ParserInterface
Overrides:
flush in class ParserImpl
Throws:
Exception

initOutput

public void initOutput()
                throws Exception
This function is called as a part of parser initialization, when the connector having this parser is in Add mode

Throws:
Exception

initInput

public void initInput()
               throws Exception
This function is called as a part of parser initialisation, when the connector having this parser is in Iterator mode

Throws:
Exception

readEntry

public Entry readEntry()
                throws Exception
Constructs the next entry from the data structure read in initially. If end of data encountered a null value is returned.

Specified by:
readEntry in interface ParserInterface
Returns:
the next Entry
Throws:
Exception

writeEntry

public void writeEntry(Entry entry)
                throws Exception
Description copied from interface: ParserInterface
Write an entry to the current output stream

Specified by:
writeEntry in interface ParserInterface
Parameters:
entry - The entry to write
Throws:
Exception

setOmitXMLDeclaration

public void setOmitXMLDeclaration(boolean omit)

getOmitXMLDeclaration

public boolean getOmitXMLDeclaration()

fatalError

public void fatalError(SAXParseException exception)
Specified by:
fatalError in interface ErrorHandler

error

public void error(SAXParseException exception)
           throws SAXException
Specified by:
error in interface ErrorHandler
Throws:
SAXException

warning

public void warning(SAXParseException err)
             throws SAXException
Specified by:
warning in interface ErrorHandler
Throws:
SAXException

isCheckpointRestartEnabled

public boolean isCheckpointRestartEnabled(int mode)
Components that support checkpoint/restart for a specific mode must return TRUE from this method. If a restart has no meaning for mode then the component should still return TRUE.

Specified by:
isCheckpointRestartEnabled in interface CheckpointRestartInterface
Parameters:
mode - The mode the connector runs in
Returns:
true if checkpoint is supported in mode
See Also:
ServerConstants

getCheckpointInformation

public Entry getCheckpointInformation()
                               throws Exception
Returns the state information for the parser. If for some reason the parser decidies that a restart is impossible it must throw an exception. The method is called immediatly before any component methods are called. If there is no need to save any state information a null value should be returned. For eventhandlers this method is called by the dispatcher routine.

Specified by:
getCheckpointInformation in interface CheckpointRestartInterface
Returns:
The entry the parser needs to do a restart or null if that is not needed.
Throws:
Exception

prepareForRestart

public void prepareForRestart(ALState state,
                              Entry restartInfo,
                              int restartPoint)
                       throws Exception
Notifies of a restart situation. This method is called after the connector has been loaded and before any other method calls are made to the connector.

Specified by:
prepareForRestart in interface CheckpointRestartInterface
Parameters:
restartInfo - The last entry object returned by the connector in the getCheckpointInformation method
state - The ALState object for the AssemblyLine
restartPoint - The relative point where restarting is taking place (e.g. RESTART_BEFORE ...)
Throws:
Exception

getVersion

public String getVersion()
Return version information

Specified by:
getVersion in interface VersionInfoInterface