net.sf.nachocalendar.customizer
Class XMLCustomizer

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by net.sf.nachocalendar.customizer.XMLCustomizer
All Implemented Interfaces:
Customizer, org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class XMLCustomizer
extends org.xml.sax.helpers.DefaultHandler
implements Customizer

This class reads an xml file to get properties values.

Author:
Ignacio Merani

Constructor Summary
XMLCustomizer(java.io.InputStream config)
           
 
Method Summary
 void characters(char[] ch, int start, int length)
           
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
           
 boolean getBoolean(java.lang.String key)
          Returns a boolean related to the key.
 double getDouble(java.lang.String key)
          Returns a double related to the key.
 float getFloat(java.lang.String key)
          Returns a float related to the key.
 int getInteger(java.lang.String key)
          Returns an int related to the key.
 long getLong(java.lang.String key)
          Returns a long related to the key.
 java.lang.String getString(java.lang.String key)
          Returns a String related to the key.
 java.util.Set keySet()
          Returns a Set with the properties names.
 void startDocument()
           
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLCustomizer

public XMLCustomizer(java.io.InputStream config)
              throws org.xml.sax.SAXException,
                     java.io.IOException,
                     javax.xml.parsers.ParserConfigurationException
Throws:
org.xml.sax.SAXException
java.io.IOException
javax.xml.parsers.ParserConfigurationException
Method Detail

getInteger

public int getInteger(java.lang.String key)
Description copied from interface: Customizer
Returns an int related to the key.

Specified by:
getInteger in interface Customizer
Returns:

getBoolean

public boolean getBoolean(java.lang.String key)
Description copied from interface: Customizer
Returns a boolean related to the key.

Specified by:
getBoolean in interface Customizer
Returns:

getString

public java.lang.String getString(java.lang.String key)
Description copied from interface: Customizer
Returns a String related to the key.

Specified by:
getString in interface Customizer
Returns:

getLong

public long getLong(java.lang.String key)
Description copied from interface: Customizer
Returns a long related to the key.

Specified by:
getLong in interface Customizer
Returns:

getFloat

public float getFloat(java.lang.String key)
Description copied from interface: Customizer
Returns a float related to the key.

Specified by:
getFloat in interface Customizer
Returns:

getDouble

public double getDouble(java.lang.String key)
Description copied from interface: Customizer
Returns a double related to the key.

Specified by:
getDouble in interface Customizer
Returns:

keySet

public java.util.Set keySet()
Description copied from interface: Customizer
Returns a Set with the properties names.

Specified by:
keySet in interface Customizer
Returns:

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Specified by:
startDocument in interface org.xml.sax.ContentHandler
Overrides:
startDocument in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException