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

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

public class Configurator
extends Constants
implements Configuration

Reads the configuration from the XML configuration file.


Nested Class Summary
private  class Configurator.MyEntityResolver
          Entity resolver.
 
Field Summary
private  java.lang.String abscissColumn
          Absciss column.
private  org.dom4j.Document doc
          XML document.
private  java.util.Map graphs
          Map of graphs.
private  java.lang.String mbeanColumn
          MBean column.
private  java.lang.String separator
          Field separator.
private  java.util.Map series
          Map of series.
private  java.text.SimpleDateFormat simpleDateFormat
          Date format.
 
Fields inherited from class org.ow2.jasmine.monitoring.mbeancmd.graph.conf.Constants
DOUBLE, GRAPH_CONFIG_PATH, LONG, TIME
 
Fields inherited from interface org.ow2.jasmine.monitoring.mbeancmd.graph.conf.Configuration
DEFAULT_ABSCISS_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 getAbscissColumn()
          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.
 void loadConfig(java.lang.String conf)
          Implementation of inherited method.
static void main(java.lang.String[] args)
          Tests the Configurator implementation.
private  void parseGraphs()
          Parses the graph based on the XML configuration.
private  void parseParent()
          Parses topmost properties.
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 org.ow2.jasmine.monitoring.mbeancmd.graph.conf.Constants
getType
 
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 series
Map of series.


graphs

private java.util.Map graphs
Map of graphs.


doc

private org.dom4j.Document doc
XML document.


separator

private java.lang.String separator
Field separator.


abscissColumn

private java.lang.String abscissColumn
Absciss column.


mbeanColumn

private java.lang.String mbeanColumn
MBean column.


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()

getAbscissColumn

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

Specified by:
getAbscissColumn in interface Configuration
Returns:
The absciss column title string.
See Also:
Configuration.getAbscissColumn()

getDateFormat

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

Specified by:
getDateFormat in interface Configuration
Returns:
The date format. If null, date format is long.
See Also:
Configuration.getDateFormat()

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.

parseParent

private void parseParent()
Parses topmost properties.