Package com.ibm.di.parser
Class CBEParser
- java.lang.Object
-
- com.ibm.di.parser.ParserImpl
-
- com.ibm.di.parser.xml.XMLParser2
-
- com.ibm.di.parser.CBEParser
-
- All Implemented Interfaces:
ParserInterface
,VersionInfoInterface
public class CBEParser extends XMLParser2
A class that reads and writes CBE objects in XML format.
-
-
Field Summary
-
Fields inherited from class com.ibm.di.parser.xml.XMLParser2
attrsDeclaration, charEncoding, coalescing, currentEntryAsXML, currentEntryAsXMLString, DEFAULT_ENCODING, DUMMY_ROOT_NAME, entryTag, firstWriteStart, indentOutput, nsMap, nsTracker, skipXMLOnReading, skipXMLOnWriting, standaloneRoot, valueTag, wrapUnwrapEntry, xmlVersion, xPath, xPathStr, xsdPath
-
Fields inherited from class com.ibm.di.parser.ParserImpl
_debug, myConfiguration
-
-
Constructor Summary
Constructors Constructor Description CBEParser()
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
closeParser()
This method closes the parser's streamsjava.lang.String
getVersion()
Version information.void
initInput()
Initializes the Input.void
initOutput()
Initialize and prepare the outputStream and prepare the outputDoc.java.lang.Object
querySchema(java.lang.Object source)
This Parser does not support dynamic schema discovery and uses the default Query Schema implementation.Entry
readEntry()
Reads the inputStream and fill the Entry Object that it returnsvoid
writeEntry(Entry entry)
Create/get the CBE object and convert it to XML.-
Methods inherited from class com.ibm.di.parser.xml.XMLParser2
getCurrentEntryAsXMLStream, getCurrentEntryAsXMLString, getCurrentEntryPath, getLogger, getSchemaLocationFromXML, initParser
-
Methods inherited from class com.ibm.di.parser.ParserImpl
debug, debugMode, flush, 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
-
Methods inherited from interface com.ibm.di.parser.ParserInterface
flush, getContext, getDebug, getParam, getParser, getReader, getWriter, isDeltaSupported, registerScriptBeans, setConfiguration, setContext, setDebug, setInputStream, setInputStream, setInputStream, setOutputStream, setOutputStream, setParam, setParser
-
-
-
-
Method Detail
-
initInput
public void initInput() throws java.lang.Exception
Initializes the Input. Note: this parser relies on a Reader object to read the XML document.- Overrides:
initInput
in classXMLParser2
- Throws:
java.lang.Exception
- - in case of a read error occurs.- See Also:
ParserImpl.setInputStream(java.io.Reader)
-
readEntry
public Entry readEntry() throws java.lang.Exception
Reads the inputStream and fill the Entry Object that it returns- Specified by:
readEntry
in interfaceParserInterface
- Overrides:
readEntry
in classXMLParser2
- Returns:
- Entry - the Entry object containing the CBE attributes and the CBE object itself or null if Input is exhausted.
- Throws:
java.lang.Exception
-- Exception - If unable to parse a document to a CBE object
- FormattingException - incorrect XML is reached.
- DOMException - If unable to move or copy a node from one document to another
-
initOutput
public void initOutput() throws java.lang.Exception
Initialize and prepare the outputStream and prepare the outputDoc.- Overrides:
initOutput
in classXMLParser2
- Throws:
java.lang.Exception
- if an error occurs.
-
writeEntry
public void writeEntry(Entry entry) throws java.lang.Exception
Create/get the CBE object and convert it to XML. Then update outpuDoc and prepare it for writing. When the parser is done the flush() method will write the document to the outputStream.- Specified by:
writeEntry
in interfaceParserInterface
- Overrides:
writeEntry
in classXMLParser2
- Parameters:
entry
- - The entry that is going to be written to the outputStream as XML- Throws:
java.lang.Exception
- - in the following cases:- Invalid Document Object retrieved from the XML
- If unable to generate CBE object from attributes
- If unable to parse a XML to a Document
- If Unable to work with CBE Node from the Document
- DOMException - If unable to move or copy a node from one document to another
- ValidationException - If the passed CBE object is invalid.
-
closeParser
public void closeParser() throws java.lang.Exception
This method closes the parser's streams- Specified by:
closeParser
in interfaceParserInterface
- Overrides:
closeParser
in classXMLParser2
- Throws:
java.lang.Exception
- in case an error occurs
-
getVersion
public java.lang.String getVersion()
Version information.- Specified by:
getVersion
in interfaceVersionInfoInterface
- Overrides:
getVersion
in classXMLParser2
- Returns:
- version information
-
querySchema
public java.lang.Object querySchema(java.lang.Object source)
This Parser does not support dynamic schema discovery and uses the default Query Schema implementation.- Specified by:
querySchema
in interfaceParserInterface
- Overrides:
querySchema
in classXMLParser2
- Parameters:
source
- The object on which to discover schema- Returns:
- A Vector of com.ibm.di.entry.Entry objects describing each entity
-
-