org.jbpm.xml
Class Parse

java.lang.Object
  extended by org.jbpm.xml.Parse
All Implemented Interfaces:
java.io.Serializable, org.xml.sax.ErrorHandler

public class Parse
extends java.lang.Object
implements java.io.Serializable, org.xml.sax.ErrorHandler

information related to one single parse operation, for instructions see Parser.

Author:
Tom Baeyens
See Also:
Serialized Form

Field Summary
protected  java.lang.ClassLoader classLoader
           
protected  org.w3c.dom.Document document
           
protected  javax.xml.parsers.DocumentBuilder documentBuilder
           
protected  java.lang.Object documentObject
           
protected  org.xml.sax.InputSource inputSource
           
protected  java.io.InputStream inputStream
           
protected  java.util.Stack<java.lang.Object> objectStack
           
protected  Parser parser
           
protected  java.util.List<Problem> problems
           
protected  StreamSource streamSource
           
 
Constructor Summary
protected Parse(Parser parser)
           
 
Method Summary
 void addProblem(Problem problem)
          to add parsing problems during XML parsing and DOM walking.
 void addProblem(java.lang.String msg)
          add a problem with the default severity.
 void addProblem(java.lang.String msg, java.lang.Exception e)
          add a problem with an exception cause and the default severity.
 void addProblem(java.lang.String msg, java.lang.Exception e, java.lang.String severity)
          adds a problem given message, exception cause and severity
 void addWarning(java.lang.String msg)
          adds a problem with severity warning.
 void addWarning(java.lang.String msg, java.lang.Exception e)
          adds a problem with severity warning and an exception as the cause.
 Parse checkProblems(java.lang.String description)
          throws if error level problems are present and logs all problems and warnings.
 void error(org.xml.sax.SAXParseException e)
          part of ErrorHandler to capture XML parsing problems.
 Parse execute()
          perform the actual parse operation with the specified input source.
 void fatalError(org.xml.sax.SAXParseException e)
          part of ErrorHandler to capture XML parsing problems.
<T> T
findObject(java.lang.Class<T> clazz)
          search a contextual object in the stack by type.
 java.lang.ClassLoader getClassLoader()
          the ClassLoader used to resolve input resources.
 org.w3c.dom.Document getDocument()
          the Document Object Model (DOM).
 java.lang.Object getDocumentObject()
          the result of this parse operation.
 java.util.List<Problem> getProblems()
          all problems encountered
 boolean hasProblems()
          indicates presence of problems
 java.lang.Object peekObject()
          look up the top contextual object from the stack.
 java.lang.Object popObject()
          remove a contextual object from the stack.
 Parse pushObject(java.lang.Object object)
          push a contextual object on the stack of this parse.
 Parse setClassLoader(java.lang.ClassLoader classLoader)
          specify the classLoader to be used for resource input (this is optional)
 Parse setDocument(org.w3c.dom.Document document)
          normally the Document Object Model is created during the parse execution, but providing a document can be convenient when the DOM is already available and only the walking of the DOM needs to be done by the parser.
 void setDocumentObject(java.lang.Object object)
          provides the result of this parse operation.
 Parse setFile(java.io.File file)
          specify a file as the source for this parse
 Parse setInputSource(org.xml.sax.InputSource inputSource)
          specify an InputStream as the source for this parse
 Parse setInputStream(java.io.InputStream inputStream)
          specify an input stream as the source for this parse
 Parse setProblems(java.util.List<Problem> problems)
          allows to provide the list object that should be used to capture the parsing problems.
 Parse setResource(java.lang.String resource)
          specify a resource as the source for this parse
 Parse setStreamSource(StreamSource streamSource)
          specify a StreamSource as the source for this parse
 Parse setString(java.lang.String xmlString)
          specify an XML string as the source for this parse
 Parse setUrl(java.net.URL url)
          specify a URL as the source for this parse
 void warning(org.xml.sax.SAXParseException e)
          part of ErrorHandler to capture XML parsing problems.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parser

protected Parser parser

classLoader

protected java.lang.ClassLoader classLoader

streamSource

protected StreamSource streamSource

inputStream

protected java.io.InputStream inputStream

inputSource

protected org.xml.sax.InputSource inputSource

documentBuilder

protected javax.xml.parsers.DocumentBuilder documentBuilder

document

protected org.w3c.dom.Document document

objectStack

protected java.util.Stack<java.lang.Object> objectStack

problems

protected java.util.List<Problem> problems

documentObject

protected java.lang.Object documentObject
Constructor Detail

Parse

protected Parse(Parser parser)
Method Detail

setInputStream

public Parse setInputStream(java.io.InputStream inputStream)
specify an input stream as the source for this parse


setUrl

public Parse setUrl(java.net.URL url)
specify a URL as the source for this parse


setFile

public Parse setFile(java.io.File file)
specify a file as the source for this parse


setClassLoader

public Parse setClassLoader(java.lang.ClassLoader classLoader)
specify the classLoader to be used for resource input (this is optional)


setResource

public Parse setResource(java.lang.String resource)
specify a resource as the source for this parse


setString

public Parse setString(java.lang.String xmlString)
specify an XML string as the source for this parse


setStreamSource

public Parse setStreamSource(StreamSource streamSource)
specify a StreamSource as the source for this parse


setInputSource

public Parse setInputSource(org.xml.sax.InputSource inputSource)
specify an InputStream as the source for this parse


setDocument

public Parse setDocument(org.w3c.dom.Document document)
normally the Document Object Model is created during the parse execution, but providing a document can be convenient when the DOM is already available and only the walking of the DOM needs to be done by the parser. If the document is provide, building the DOM from a source is skipped.


execute

public Parse execute()
perform the actual parse operation with the specified input source.


checkProblems

public Parse checkProblems(java.lang.String description)
throws if error level problems are present and logs all problems and warnings.


getProblems

public java.util.List<Problem> getProblems()
all problems encountered


addProblem

public void addProblem(Problem problem)
to add parsing problems during XML parsing and DOM walking.


addProblem

public void addProblem(java.lang.String msg)
add a problem with the default severity.


addProblem

public void addProblem(java.lang.String msg,
                       java.lang.Exception e)
add a problem with an exception cause and the default severity.


addWarning

public void addWarning(java.lang.String msg)
adds a problem with severity warning.


addWarning

public void addWarning(java.lang.String msg,
                       java.lang.Exception e)
adds a problem with severity warning and an exception as the cause.


addProblem

public void addProblem(java.lang.String msg,
                       java.lang.Exception e,
                       java.lang.String severity)
adds a problem given message, exception cause and severity


hasProblems

public boolean hasProblems()
indicates presence of problems


setProblems

public Parse setProblems(java.util.List<Problem> problems)
allows to provide the list object that should be used to capture the parsing problems.


error

public void error(org.xml.sax.SAXParseException e)
part of ErrorHandler to capture XML parsing problems.

Specified by:
error in interface org.xml.sax.ErrorHandler

fatalError

public void fatalError(org.xml.sax.SAXParseException e)
part of ErrorHandler to capture XML parsing problems.

Specified by:
fatalError in interface org.xml.sax.ErrorHandler

warning

public void warning(org.xml.sax.SAXParseException e)
part of ErrorHandler to capture XML parsing problems.

Specified by:
warning in interface org.xml.sax.ErrorHandler

pushObject

public Parse pushObject(java.lang.Object object)
push a contextual object on the stack of this parse.


popObject

public java.lang.Object popObject()
remove a contextual object from the stack.


peekObject

public java.lang.Object peekObject()
look up the top contextual object from the stack.


findObject

public <T> T findObject(java.lang.Class<T> clazz)
search a contextual object in the stack by type.


getDocumentObject

public java.lang.Object getDocumentObject()
the result of this parse operation.


setDocumentObject

public void setDocumentObject(java.lang.Object object)
provides the result of this parse operation.


getDocument

public org.w3c.dom.Document getDocument()
the Document Object Model (DOM).


getClassLoader

public java.lang.ClassLoader getClassLoader()
the ClassLoader used to resolve input resources.