at.spardat.xma.boot.comp.data
Class XMAAppParser

java.lang.Object
  extended byorg.xml.sax.helpers.DefaultHandler
      extended byat.spardat.xma.boot.comp.data.XMAAppParser
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class XMAAppParser
extends org.xml.sax.helpers.DefaultHandler
implements org.xml.sax.DTDHandler

class: XMAAppParser


Constructor Summary
XMAAppParser(ILogger log_)
          constructor
XMAAppParser(ILogger log_, boolean bValidation)
           
 
Method Summary
 void endDocument()
           
 void endElement(java.lang.String nsURI, java.lang.String localName, java.lang.String qName)
           
 void error(org.xml.sax.SAXParseException e)
           
 void fatalError(org.xml.sax.SAXParseException e)
           
protected static java.lang.String fixCodebaseString(java.lang.String s)
          This is a helper method to make sure a codebase string will work as a codebase URL by forcing a "/" on the end of the string.
protected  void handleApp(org.xml.sax.Attributes attrs)
           
protected  void handleComponent(org.xml.sax.Attributes attrs)
          handle component parsing
protected  void handlePluginImpl(org.xml.sax.Attributes attrs)
          handles parsing of plug in impl info
protected  void handlePluginSpec(org.xml.sax.Attributes attrs)
          handles parsing of tag plugin spec
protected  void handlePreinstall(org.xml.sax.Attributes attrs)
          handles parsing of tag preinstall
protected  void handleResLink(org.xml.sax.Attributes attrs)
          handle parsing of resource links
protected  void handleResource(org.xml.sax.Attributes attrs)
          e.g.:
protected  void handleSWTDescription(org.xml.sax.Attributes attrs)
          handles parsing of tag swt-description
protected  void initParser()
          initialize parser
 XMAApp parse(java.io.InputStream is)
          parse is the main method for parsing configuration files
 XMAApp parse(java.lang.String strURI)
          parse is the main method for parsing configuration files
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
          get the dtd out of the classloader.
 void startDocument()
           
 void startElement(java.lang.String nsURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attrs)
           
protected  void switchElementHandler(java.lang.String nsURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attrs)
          see element dispatcher
 void warning(org.xml.sax.SAXParseException e)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xml.sax.DTDHandler
notationDecl, unparsedEntityDecl
 

Constructor Detail

XMAAppParser

public XMAAppParser(ILogger log_,
                    boolean bValidation)

XMAAppParser

public XMAAppParser(ILogger log_)
constructor

Method Detail

initParser

protected void initParser()
                   throws javax.xml.parsers.ParserConfigurationException,
                          org.xml.sax.SAXException
initialize parser

Throws:
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException

resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                             java.lang.String systemId)
get the dtd out of the classloader. on development, if class-directory is seperated, build should copy the dtd into the classes dir.

Specified by:
resolveEntity in interface org.xml.sax.EntityResolver

parse

public XMAApp parse(java.io.InputStream is)
             throws java.io.IOException,
                    org.xml.sax.SAXException
parse is the main method for parsing configuration files

Parameters:
is - the input stream to the data to parse
Throws:
java.io.IOException
org.xml.sax.SAXException

parse

public XMAApp parse(java.lang.String strURI)
             throws java.io.IOException,
                    org.xml.sax.SAXException
parse is the main method for parsing configuration files

Parameters:
strURI - Is a String parameter. It is used as a URI to the XML-file location.
Throws:
java.io.IOException
org.xml.sax.SAXException

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Specified by:
startDocument in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException
See Also:
ContentHandler.startDocument()

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Specified by:
endDocument in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException
See Also:
ContentHandler.endDocument()

startElement

public void startElement(java.lang.String nsURI,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes attrs)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException
See Also:
ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)

endElement

public void endElement(java.lang.String nsURI,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Specified by:
endElement in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException
See Also:
ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)

switchElementHandler

protected void switchElementHandler(java.lang.String nsURI,
                                    java.lang.String localName,
                                    java.lang.String qName,
                                    org.xml.sax.Attributes attrs)
                             throws org.xml.sax.SAXException
see element dispatcher

Throws:
org.xml.sax.SAXException

handleApp

protected void handleApp(org.xml.sax.Attributes attrs)
                  throws org.xml.sax.SAXException
Parameters:
attrs - Attributes to this element
Throws:
org.xml.sax.SAXException

handleComponent

protected void handleComponent(org.xml.sax.Attributes attrs)
                        throws org.xml.sax.SAXException
handle component parsing

Throws:
org.xml.sax.SAXException

handleResource

protected void handleResource(org.xml.sax.Attributes attrs)
                       throws org.xml.sax.SAXException
e.g.:

Parameters:
attrs - Attributes to this element
Throws:
org.xml.sax.SAXException

handleResLink

protected void handleResLink(org.xml.sax.Attributes attrs)
                      throws org.xml.sax.SAXException
handle parsing of resource links

Throws:
org.xml.sax.SAXException

handlePluginImpl

protected void handlePluginImpl(org.xml.sax.Attributes attrs)
                         throws org.xml.sax.SAXException
handles parsing of plug in impl info

Throws:
org.xml.sax.SAXException

handlePluginSpec

protected void handlePluginSpec(org.xml.sax.Attributes attrs)
                         throws org.xml.sax.SAXException
handles parsing of tag plugin spec

Throws:
org.xml.sax.SAXException

handleSWTDescription

protected void handleSWTDescription(org.xml.sax.Attributes attrs)
                             throws org.xml.sax.SAXException
handles parsing of tag swt-description

Throws:
org.xml.sax.SAXException

handlePreinstall

protected void handlePreinstall(org.xml.sax.Attributes attrs)
                         throws org.xml.sax.SAXException
handles parsing of tag preinstall

Throws:
org.xml.sax.SAXException

fixCodebaseString

protected static final java.lang.String fixCodebaseString(java.lang.String s)
This is a helper method to make sure a codebase string will work as a codebase URL by forcing a "/" on the end of the string.


fatalError

public void fatalError(org.xml.sax.SAXParseException e)
                throws org.xml.sax.SAXParseException
Specified by:
fatalError in interface org.xml.sax.ErrorHandler
Throws:
org.xml.sax.SAXParseException
See Also:
ErrorHandler.fatalError(org.xml.sax.SAXParseException)

warning

public void warning(org.xml.sax.SAXParseException e)
Specified by:
warning in interface org.xml.sax.ErrorHandler
See Also:
ErrorHandler.warning(org.xml.sax.SAXParseException)

error

public void error(org.xml.sax.SAXParseException e)
           throws org.xml.sax.SAXParseException
Specified by:
error in interface org.xml.sax.ErrorHandler
Throws:
org.xml.sax.SAXParseException
See Also:
ErrorHandler.error(org.xml.sax.SAXParseException)