org.ow2.jasmine.monitoring.mbeancmd.graph.conf
Class Configurator

java.lang.Object
  extended by org.ow2.jasmine.monitoring.mbeancmd.graph.conf.Configurator
All Implemented Interfaces:
Configuration, Constants

public class Configurator
extends java.lang.Object
implements Constants, Configuration

Reads the configuration from the XML configuration file.


Nested Class Summary
private  class Configurator.MyEntityResolver
          Entity resolver.
 
Nested classes/interfaces inherited from interface org.ow2.jasmine.monitoring.mbeancmd.graph.conf.Constants
Constants.DataType
 
Field Summary
private  java.lang.String abscissaColumn
          Column used as abscissa.
private  org.dom4j.Document doc
          XML document.
private  java.util.Map<java.lang.String,GraphConfig> graphs
          Map of graphs.
private  java.lang.String mbeanColumn
          Column used for the legend.
private  java.lang.String separator
          Field separator.
private  java.util.Map<java.lang.String,SerieConfig> series
          Map of series.
private  java.text.SimpleDateFormat simpleDateFormat
          Date format.
 
Fields inherited from interface org.ow2.jasmine.monitoring.mbeancmd.graph.conf.Constants
DATEFORMAT_LONG, GRAPH_CONFIG_PATH
 
Fields inherited from interface org.ow2.jasmine.monitoring.mbeancmd.graph.conf.Configuration
DEFAULT_ABSCISSA_COLUMN, DEFAULT_DATE_FORMAT, DEFAULT_MBEAN_COLUMN, DEFAULT_SEPARATOR
 
Constructor Summary
Configurator()
           
 
Method Summary
private  void addGraph(org.dom4j.Node node)
          Adds a graph.
private  void addSerie(org.dom4j.Node node)
          Adds a series.
private  java.lang.String evalINode(org.dom4j.Node inode, java.lang.String serieId)
          Evaluate a node.
 java.lang.String getAbscissaColumn()
          Implementation of inherited method.
 java.text.SimpleDateFormat getDateFormat()
          Implementation of inherited method.
static java.io.LineNumberReader getDTD()
           
 GraphConfig getGraphConfig(java.lang.String id)
          Implementation of inherited method.
 java.lang.String[] getGraphIds()
          Implementation of inherited method.
 java.lang.String getSeparator()
          Implementation of inherited method.
 SerieConfig getSerieConfig(java.lang.String id)
          Implementation of inherited method.
 java.lang.String[] getSerieIds()
          Implementation of inherited method.
 boolean isDateLong()
          Implementation of inherited method.
 void loadConfig(java.lang.String conf)
          Implementation of inherited method.
static void main(java.lang.String[] args)
          Tests the Configurator implementation.
private  void parseCommon()
          Calls all other parsers.
private  void parseGraphs()
          Parses the graph based on the XML configuration.
private  java.lang.String parseSerieLegend(org.dom4j.Node serie)
          Parses a legend.
private  void parseSeries()
          Parses the series based on the XML configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

series

private java.util.Map<java.lang.String,SerieConfig> series
Map of series.


graphs

private java.util.Map<java.lang.String,GraphConfig> graphs
Map of graphs.


doc

private org.dom4j.Document doc
XML document.


separator

private java.lang.String separator
Field separator.


abscissaColumn

private java.lang.String abscissaColumn
Column used as abscissa.


mbeanColumn

private java.lang.String mbeanColumn
Column used for the legend.


simpleDateFormat

private java.text.SimpleDateFormat simpleDateFormat
Date format.

Constructor Detail

Configurator

public Configurator()
Method Detail

main

public static void main(java.lang.String[] args)
Tests the Configurator implementation.

Parameters:
args - Ignored.

getSerieConfig

public SerieConfig getSerieConfig(java.lang.String id)
Implementation of inherited method.

Specified by:
getSerieConfig in interface Configuration
Parameters:
id - Series id.
Returns:
Series configuration for that id.
See Also:
Configuration.getSerieConfig(java.lang.String)

getSerieIds

public java.lang.String[] getSerieIds()
Implementation of inherited method.

Specified by:
getSerieIds in interface Configuration
Returns:
All series ids currently registered.
See Also:
Configuration.getSerieIds()

getGraphConfig

public GraphConfig getGraphConfig(java.lang.String id)
Implementation of inherited method.

Specified by:
getGraphConfig in interface Configuration
Parameters:
id - Graph id.
Returns:
Graph configuration for that id.
See Also:
Configuration.getGraphConfig(java.lang.String)

getGraphIds

public java.lang.String[] getGraphIds()
Implementation of inherited method.

Specified by:
getGraphIds in interface Configuration
Returns:
All graph ids currently registered.
See Also:
Configuration.getGraphIds()

loadConfig

public void loadConfig(java.lang.String conf)
Implementation of inherited method.

Specified by:
loadConfig in interface Configuration
Parameters:
conf - Configuration file path. If null, the file path is set to the GRAPH_CONFIG_PATH system property.
See Also:
Configuration.loadConfig(java.lang.String)

getDTD

public static java.io.LineNumberReader getDTD()
Returns:
The line number reader for the XML DTD.

getSeparator

public java.lang.String getSeparator()
Implementation of inherited method.

Specified by:
getSeparator in interface Configuration
Returns:
The value separator string.
See Also:
Configuration.getSeparator()

getAbscissaColumn

public java.lang.String getAbscissaColumn()
Implementation of inherited method.

Specified by:
getAbscissaColumn in interface Configuration
Returns:
Name of the column used as abscissa.
See Also:
Configuration.getAbscissaColumn()

getDateFormat

public java.text.SimpleDateFormat getDateFormat()
Implementation of inherited method.

Specified by:
getDateFormat in interface Configuration
Returns:
The date format.
See Also:
Configuration.getDateFormat()

isDateLong

public boolean isDateLong()
Implementation of inherited method.

Specified by:
isDateLong in interface Configuration
Returns:
true if date format is long (origin is 01/01/1970), false if date format is complex.
See Also:
Configuration.isDateLong()

parseSeries

private void parseSeries()
Parses the series based on the XML configuration.


addSerie

private void addSerie(org.dom4j.Node node)
Adds a series.

Parameters:
node - XML node describing the series.

parseGraphs

private void parseGraphs()
Parses the graph based on the XML configuration.


addGraph

private void addGraph(org.dom4j.Node node)
Adds a graph.

Parameters:
node - XML node describing the graph.

parseSerieLegend

private java.lang.String parseSerieLegend(org.dom4j.Node serie)
Parses a legend.

Parameters:
serie - XML node describing the legend.
Returns:
Parsed legend.

evalINode

private java.lang.String evalINode(org.dom4j.Node inode,
                                   java.lang.String serieId)
Evaluate a node. It may contain: - A ref: then it evaluates to the value associated to the ref. - A link: it is a XPath link, it evaluates to the value of the pointed to element. - A text: it evaluates to the contents of the element in the serie-def. If several attributes are present, the evaluation order is: 1. text 2. ref 3. link

Parameters:
inode - XML node.
serieId - Series ID corresponding to the node.
Returns:
Evaluated inode.

parseCommon

private void parseCommon()
Calls all other parsers.