Nuxeo Enterprise Platform 5.3

com.anwrt.ooserver.daemon
Class ConfigHandler

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by com.anwrt.ooserver.daemon.ConfigHandler
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class ConfigHandler
extends DefaultHandler
implements ContentHandler

Used to parse a configuration from an XML file using SAX

Author:
Jounayd Id Salah

Constructor Summary
ConfigHandler()
          Creates parser
 
Method Summary
 void endDocument()
           
 void endElement(String uri, String localName, String qName)
           
 void error(SAXParseException ex)
           
 Config readConfiguration(String filePath)
          Reads a configuration from an xml file
 void skippedEntity(String name)
           
 void startDocument()
           
 void startElement(String uri, String localName, String qName, Attributes attlist)
           
 void warning(SAXParseException ex)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endPrefixMapping, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, 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.ContentHandler
characters, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, startPrefixMapping
 

Constructor Detail

ConfigHandler

public ConfigHandler()
              throws Exception
Creates parser

Throws:
Exception - failed to create SAX parser
Method Detail

startDocument

public void startDocument()
Specified by:
startDocument in interface ContentHandler
Overrides:
startDocument in class DefaultHandler

endDocument

public void endDocument()
Specified by:
endDocument in interface ContentHandler
Overrides:
endDocument in class DefaultHandler

readConfiguration

public Config readConfiguration(String filePath)
                         throws FileNotFoundException,
                                SAXException,
                                IOException
Reads a configuration from an xml file

Parameters:
filePath - xml file filePath (absolute/relative)
Returns:
configuration file
Throws:
FileNotFoundException - -
SAXException - exception when parsing the xml configuration file
IOException - error when reading the xml configuration file

startElement

public void startElement(String uri,
                         String localName,
                         String qName,
                         Attributes attlist)
Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class DefaultHandler

endElement

public void endElement(String uri,
                       String localName,
                       String qName)
Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class DefaultHandler

warning

public void warning(SAXParseException ex)
Specified by:
warning in interface ErrorHandler
Overrides:
warning in class DefaultHandler

error

public void error(SAXParseException ex)
Specified by:
error in interface ErrorHandler
Overrides:
error in class DefaultHandler

skippedEntity

public void skippedEntity(String name)
                   throws SAXException
Specified by:
skippedEntity in interface ContentHandler
Overrides:
skippedEntity in class DefaultHandler
Throws:
SAXException

Nuxeo Enterprise Platform 5.3

Copyright © 2010 Nuxeo SAS. All Rights Reserved.