com.anwrt.ooserver.daemon
Class ConfigHandler
java.lang.Object
org.xml.sax.helpers.DefaultHandler
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
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ConfigHandler
public ConfigHandler()
throws Exception
- Creates parser
- Throws:
Exception - failed to create SAX parser
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
Copyright © 2010 Nuxeo SAS. All Rights Reserved.