|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--net.directj.jlogger.XmlConfigurator
This class is used to configure JLogger from an XML file, using DOM. The XML configuration file must follow the jlogger.dtd, that can be found in the source.
| Field Summary | |
private static java.lang.String |
CLASS_ATTR
The class attribute string. |
private java.util.Vector |
currentLoggers
The list of currently parsed logger. |
private javax.xml.parsers.DocumentBuilder |
docBuilder
The document builder. |
private static java.lang.String |
FORMATTER_TAG
The formatter tag string. |
private static java.lang.String |
LEVEL_ATTR
The level attribute string. |
private static java.lang.String |
LOGGER_TAG
The logger tag string. |
private static java.lang.String |
MANAGER_TAG
The manager tag string. |
private static java.lang.String |
NAME_ATTR
The name attribute string. |
private static java.lang.String |
NAMESPACE
The namespace attribute string. |
private static java.lang.String |
OUTPUT_TAG
The output tag string. |
private static java.lang.String |
PARAM_ATTR
The param attribute string. |
private static java.lang.String |
ROOT_TAG
The root tag string. |
| Constructor Summary | |
XmlConfigurator()
Creates a new jlogger configurator. |
|
| Method Summary | |
private void |
addLogManager(java.util.Vector _loggers,
java.lang.String _level,
java.lang.String _class,
java.lang.String _param)
Adds a LogManager to the specified logger, using the _class and _param to create it. |
private void |
addLogManager(java.util.Vector _loggers,
java.lang.String _level,
java.lang.String _formatterClass,
java.lang.String _formatterParam,
java.lang.String _outputClass,
java.lang.String _outputParam)
Adds a LogManager to the specified logger, using the specified formatter and output. |
void |
configure(java.io.InputStream _input)
Configures the JLogger tools, using an input stream (can be XML or Property file, or anything else, depending of the Configurator implementation you use). |
private java.lang.Object |
createObject(java.lang.String _class,
java.lang.Object[] _construcArgs)
Creates an object using the specified class name and the specified parameter array. |
private java.lang.String[] |
parseFormatter(org.w3c.dom.Node _formatter)
Parses a formatter node of a jlogger config file. |
private void |
parseLogger(org.w3c.dom.Node _logger)
Parses a logger node of a jlogger config file. |
private void |
parseManager(org.w3c.dom.Node _manager)
Parses a manager node of a jlogger config file. |
private java.lang.String[] |
parseOutput(org.w3c.dom.Node _output)
Parses an output node of a jlogger config file. |
private java.lang.Object[] |
parseParam(java.lang.String _lvl,
java.lang.String _args)
Parses a list of parameter and return it, as a list of object. |
private void |
parseRoot(org.w3c.dom.Node _root)
Parses a root node of a jlogger config file. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private static final java.lang.String ROOT_TAG
private static final java.lang.String LOGGER_TAG
private static final java.lang.String MANAGER_TAG
private static final java.lang.String FORMATTER_TAG
private static final java.lang.String OUTPUT_TAG
private static final java.lang.String NAME_ATTR
private static final java.lang.String LEVEL_ATTR
private static final java.lang.String CLASS_ATTR
private static final java.lang.String PARAM_ATTR
private static final java.lang.String NAMESPACE
private javax.xml.parsers.DocumentBuilder docBuilder
private java.util.Vector currentLoggers
| Constructor Detail |
public XmlConfigurator()
| Method Detail |
public void configure(java.io.InputStream _input)
configure in interface Configurator_input - The input stream to use for configuration.
private void parseRoot(org.w3c.dom.Node _root)
throws org.w3c.dom.DOMException
_root - The root node.
org.w3c.dom.DOMException - If an exception occurs while analysing (in most case, because the document is mal-formed).
private void parseLogger(org.w3c.dom.Node _logger)
throws org.w3c.dom.DOMException
_logger - The logger node.
org.w3c.dom.DOMException - If an exception occurs while analysing (in most case, because the document is mal-formed).
private void parseManager(org.w3c.dom.Node _manager)
throws org.w3c.dom.DOMException
_manager - The manager node.
org.w3c.dom.DOMException - If an exception occurs while analysing (in most case, because the document is mal-formed).
private java.lang.String[] parseOutput(org.w3c.dom.Node _output)
throws org.w3c.dom.DOMException
_output - The output node.
String[] - A string array where array[0] is the class name and array[i] is the constructor parameters.
org.w3c.dom.DOMException - If an exception occurs while analysing (in most case, because the document is mal-formed).
private java.lang.String[] parseFormatter(org.w3c.dom.Node _formatter)
throws org.w3c.dom.DOMException
_formatter - The formatter node.
String[] - A string array where array[0] is the class name and array[i] is the constructor parameters.
org.w3c.dom.DOMException - If an exception occurs while analysing (in most case, because the document is mal-formed).
private void addLogManager(java.util.Vector _loggers,
java.lang.String _level,
java.lang.String _class,
java.lang.String _param)
_loggers - The logger list to append the LogManager._level - The LogManager level, as a string._class - The LogManager class._param - The LogManager constructor param.
private void addLogManager(java.util.Vector _loggers,
java.lang.String _level,
java.lang.String _formatterClass,
java.lang.String _formatterParam,
java.lang.String _outputClass,
java.lang.String _outputParam)
_loggers - The logger list to append the LogManager._level - The LogManager level, as a string._formatterClass - The Formatter class._formatterParam - The Formatter constructor param._outputClass - The Output class._outputParam - The Output constructor param.
private java.lang.Object[] parseParam(java.lang.String _lvl,
java.lang.String _args)
_lvl - Thelevel, as a string, that will be converted to an Integer and added to the list of object. Ignored if null._args - The list of parameter, delimited with the ',' char.
Object[] - The list of Object.
private java.lang.Object createObject(java.lang.String _class,
java.lang.Object[] _construcArgs)
_class - The class name (will be used to create the class, so don't forget the package)._construcArgs - The constructor's array of parameter.
Object - The created object, an instance of the _class class instancied with the _construcArgs parameters.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||