org.opends.testqa.monitoringclient
Class ConfigHandler

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.opends.testqa.monitoringclient.ConfigHandler
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class ConfigHandler
extends org.xml.sax.helpers.DefaultHandler

Parse a XML config file.


Constructor Summary
ConfigHandler(MonitoringClient client, java.util.Properties parsedArguments)
          The constructor of the handler.
 
Method Summary
 void endDocument()
          At the end of the file, set the configuration of the client.
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
          Verify the syntax of the XML file.
 void error(org.xml.sax.SAXParseException e)
          Display an error an exit the application.
 void fatalError(org.xml.sax.SAXParseException e)
          Display a fatal error an exit the application.
 void setDocumentLocator(org.xml.sax.Locator locator)
          Set the document locator to display information about the line or column number of the error.
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)
          If an element is open, set the parameters of the client or add an attribute to monitor.
 void warning(org.xml.sax.SAXParseException e)
          Display a warning.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigHandler

public ConfigHandler(MonitoringClient client,
                     java.util.Properties parsedArguments)
The constructor of the handler.

Parameters:
client - The main class of the client
parsedArguments - The parsed arguments
Method Detail

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)
Set the document locator to display information about the line or column number of the error.

Specified by:
setDocumentLocator in interface org.xml.sax.ContentHandler
Overrides:
setDocumentLocator in class org.xml.sax.helpers.DefaultHandler
Parameters:
locator - The locator used for display informations about the line and the column number of the error.

startElement

public void startElement(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes attributes)
                  throws org.xml.sax.SAXException
If an element is open, set the parameters of the client or add an attribute to monitor.

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
localName - The local name (without prefix), or the empty string if Namespace processing is not being performed.
qName - The qualified name (with prefix), or the empty string if qualified names are not available.
attributes - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Verify the syntax of the XML file.

Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
localName - The local name (without prefix), or the empty string if Namespace processing is not being performed.
qName - The qualified name (with prefix), or the empty string if qualified names are not available.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
At the end of the file, set the configuration of the client.

Specified by:
endDocument in interface org.xml.sax.ContentHandler
Overrides:
endDocument in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

warning

public void warning(org.xml.sax.SAXParseException e)
             throws org.xml.sax.SAXException
Display a warning.

Specified by:
warning in interface org.xml.sax.ErrorHandler
Overrides:
warning in class org.xml.sax.helpers.DefaultHandler
Parameters:
e - Any SAX exception, possibly wrapping another exception.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

error

public void error(org.xml.sax.SAXParseException e)
           throws org.xml.sax.SAXException
Display an error an exit the application.

Specified by:
error in interface org.xml.sax.ErrorHandler
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.

fatalError

public void fatalError(org.xml.sax.SAXParseException e)
                throws org.xml.sax.SAXException
Display a fatal error an exit the application.

Specified by:
fatalError in interface org.xml.sax.ErrorHandler
Overrides:
fatalError 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.