ConfigHandler.java revision d81978a0815d5b8a75633c35e3e1f8708d36f017
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at
* trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
* add the following below this CDDL HEADER, with the fields enclosed
* by brackets "[]" replaced with your own identifying information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
*/
/**
* Parse a XML config file.
*/
public class ConfigHandler extends DefaultHandler {
/**
* Main class of the client.
*/
private MonitoringClient client;
private Properties parsedArguments;
/**
* The parsed properties.
*/
/**
* The locator used for display informations about the line and the column
* number of the error.
*/
/**
* The name of the protocol markup.
*/
private String inProtocol;
/**
* Indicate if a attribute markup have already been open.
*/
private boolean inAttribute;
/**
* The constructor of the handler.
*
* @param client The main class of the client
* @param parsedArguments The parsed arguments
*/
super();
this.parsedArguments = parsedArguments;
inProtocol = "";
inAttribute = false;
}
/**
* Set the document locator to display information about the line or column
* number of the error.
*
* @param locator The locator used for display informations about the line and
* the column number of the error.
*/
}
/**
* If an element is open, set the parameters of the client or add an attribute
* to monitor.
*
* @param uri The Namespace URI, or the empty string if the element
* has no Namespace URI or if Namespace processing is not being performed.
* @param localName The local name (without prefix), or the empty string if
* Namespace processing is not being performed.
* @param qName The qualified name (with prefix), or the empty string if
* qualified names are not available.
* @param 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.
*/
}
}
}
"name"), params);
} else {
"oid"), params);
}
inAttribute = true;
}
}
/**
* Verify the syntax of the XML file.
*
* @param uri The Namespace URI, or the empty string if the element has
* no Namespace URI or if Namespace processing is not being performed.
* @param localName The local name (without prefix), or the empty string if
* Namespace processing is not being performed.
* @param 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.
*/
throws SAXException {
inProtocol = "";
locator));
inAttribute = false;
}
}
/**
* At the end of the file, set the configuration of the client.
*
* @throws org.xml.sax.SAXException Any SAX exception, possibly wrapping
* another exception.
*/
public void endDocument() throws SAXException {
}
/**
* Display a warning.
*
* @param e Any SAX exception, possibly wrapping another exception.
* @throws org.xml.sax.SAXException Any SAX exception, possibly wrapping
* another exception.
*/
printInfo(e);
}
/**
* Display an error an exit the application.
*
* @param e The warning information encoded as an exception.
* @throws org.xml.sax.SAXException Any SAX exception, possibly wrapping
* another exception.
*/
printInfo(e);
}
/**
* Display a fatal error an exit the application.
*
* @param e The warning information encoded as an exception.
* @throws org.xml.sax.SAXException Any SAX exception, possibly wrapping
* another exception.
*/
printInfo(e);
}
/**
* Display the errors infos.
* @param e The error to display
*/
private void printInfo(SAXParseException e) {
}
}