org.jfree.report.modules.parser.base
Class ReportParser

java.lang.Object
  |
  +--org.xml.sax.helpers.DefaultHandler
        |
        +--org.jfree.xml.FrontendDefaultHandler
              |
              +--org.jfree.xml.parser.RootXmlReadHandler
                    |
                    +--org.jfree.report.modules.parser.base.ReportParser
Direct Known Subclasses:
IncludeParser

public class ReportParser
extends org.jfree.xml.parser.RootXmlReadHandler

The report parser initializes the parsing engine and coordinates the parsing process. Once the parsing is complete, the generated report instance can be queries with getResult();

This parser produces JFreeReport objects.

Author:
Thomas Morgner
See Also:
Serialized Form

Field Summary
static java.lang.String HELPER_OBJ_REPORT_NAME
          The key that stores the report defintion in the helper objects collection.
 
Fields inherited from class org.jfree.xml.FrontendDefaultHandler
CONTENTBASE_KEY
 
Constructor Summary
ReportParser()
          Default constuctor.
 
Method Summary
 void endElement(java.lang.String tagName, java.lang.String namespace, java.lang.String qName)
          Handles the end of an element.
 void error(org.xml.sax.SAXParseException e)
          Receive notification of a recoverable parser error.
 void fatalError(org.xml.sax.SAXParseException e)
          Report a fatal XML parsing error.
 org.jfree.xml.util.ObjectFactory getFactoryLoader()
          Returns the object factory.
 ReportBuilderHints getParserHints()
          Returns the report builder hints instance used to collect all comments and other valueable information that cannot be restored with just the parsed object model.
 java.lang.Object getResult()
          Returns the parsered object.
 void info(java.lang.String message)
          Places an informational message on the message queue.
 boolean isIncluded()
          Checks whether this report is a included report and not the main report definition.
 org.jfree.xml.FrontendDefaultHandler newInstance()
          Returns a new instance of the parser.
protected  void setParserHints(ReportBuilderHints hints)
           
 void startElement(java.lang.String tagName, java.lang.String namespace, java.lang.String qName, org.xml.sax.Attributes attributes)
          Handles the start of an element.
 void warning(org.xml.sax.SAXParseException e)
          Receive notification of a parser warning.
 
Methods inherited from class org.jfree.xml.parser.RootXmlReadHandler
addDefaultMappings, addManualMapping, addMultiplexMapping, characters, createHandler, delegate, getCurrentHandler, getHelperObject, getRootHandler, loadClass, loadHandlerClass, recurse, setHelperObject, setRootHandler, startDocument, unwind
 
Methods inherited from class org.jfree.xml.FrontendDefaultHandler
findPropertyKeys, getCommentHandler, getConfigProperties, getConfigProperty, getConfigProperty, getContentBase, getLocator, setConfigProperty, setDocumentLocator
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HELPER_OBJ_REPORT_NAME

public static final java.lang.String HELPER_OBJ_REPORT_NAME
The key that stores the report defintion in the helper objects collection.
Constructor Detail

ReportParser

public ReportParser()
Default constuctor. Initalizes the parser to use the JFreeReport parser files.
Method Detail

getFactoryLoader

public org.jfree.xml.util.ObjectFactory getFactoryLoader()
Returns the object factory.
Overrides:
getFactoryLoader in class org.jfree.xml.parser.RootXmlReadHandler
Returns:
The object factory.

newInstance

public org.jfree.xml.FrontendDefaultHandler newInstance()
Returns a new instance of the parser.
Overrides:
newInstance in class org.jfree.xml.FrontendDefaultHandler
Returns:
The instance.

getResult

public java.lang.Object getResult()
                           throws org.xml.sax.SAXException
Returns the parsered object. This method will return the currently parsed JFreeReport object.
Overrides:
getResult in class org.jfree.xml.parser.RootXmlReadHandler
Returns:
the parsed JFreeReport instance.

getParserHints

public ReportBuilderHints getParserHints()
Returns the report builder hints instance used to collect all comments and other valueable information that cannot be restored with just the parsed object model. This information is optional but may support other automated tools like the ReportWriter.
Returns:
the report builder hints used to build this report.

setParserHints

protected void setParserHints(ReportBuilderHints hints)

isIncluded

public boolean isIncluded()
Checks whether this report is a included report and not the main report definition.
Returns:
true, if the report is included, false otherwise.

endElement

public void endElement(java.lang.String tagName,
                       java.lang.String namespace,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Handles the end of an element.
Overrides:
endElement in class org.jfree.xml.parser.RootXmlReadHandler
Parameters:
tagName - the tagname of the element.
namespace - the current namespace
qName - the fully qualified name
Throws:
org.xml.sax.SAXException - if an error occured.
See Also:
(java.lang.String, java.lang.String, java.lang.String)

startElement

public void startElement(java.lang.String tagName,
                         java.lang.String namespace,
                         java.lang.String qName,
                         org.xml.sax.Attributes attributes)
                  throws org.xml.sax.SAXException
Handles the start of an element.
Overrides:
startElement in class org.jfree.xml.parser.RootXmlReadHandler
Parameters:
tagName - the tagname of the element.
namespace - the current namespace
qName - the fully qualified name
attributes - the elements attributes.
Throws:
org.xml.sax.SAXException - if an error occured.
See Also:
(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)

fatalError

public void fatalError(org.xml.sax.SAXParseException e)
                throws org.xml.sax.SAXException
Report a fatal XML parsing error.

The default implementation throws a SAXParseException. Application writers may override this method in a subclass if they need to take specific actions for each fatal error (such as collecting all of the errors into a single report): in any case, the application must stop all regular processing when this method is invoked, since the document is no longer reliable, and the parser may no longer report parsing events.

Overrides:
fatalError in class org.xml.sax.helpers.DefaultHandler
Parameters:
e - The error information encoded as an exception.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ErrorHandler.fatalError(org.xml.sax.SAXParseException), SAXParseException

warning

public void warning(org.xml.sax.SAXParseException e)
             throws org.xml.sax.SAXException
Receive notification of a parser warning.

The default implementation does nothing. Application writers may override this method in a subclass to take specific actions for each warning, such as inserting the message in a log file or printing it to the console.

Overrides:
warning in class org.xml.sax.helpers.DefaultHandler
Parameters:
e - The warning information encoded as an exception.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ErrorHandler.warning(org.xml.sax.SAXParseException), SAXParseException

error

public void error(org.xml.sax.SAXParseException e)
           throws org.xml.sax.SAXException
Receive notification of a recoverable parser error.

The default implementation does nothing. Application writers may override this method in a subclass to take specific actions for each error, such as inserting the message in a log file or printing it to the console.

Overrides:
error in class org.xml.sax.helpers.DefaultHandler
Parameters:
e - The warning information encoded as an exception.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ErrorHandler.warning(org.xml.sax.SAXParseException), SAXParseException

info

public void info(java.lang.String message)
          throws org.xml.sax.SAXException
Places an informational message on the message queue.
Parameters:
message - the message.
Throws:
org.xml.sax.SAXException - if an error occurs.