org.objectweb.cjdbc.console.monitoring
Class MonitoringGraph

java.lang.Object
  extended byjava.lang.Thread
      extended byorg.objectweb.cjdbc.console.monitoring.MonitoringGraph
All Implemented Interfaces:
java.lang.Runnable

public class MonitoringGraph
extends java.lang.Thread

Encapsulate the JFreeChart classes and methods to provide easiness of configuration for a monitoring graph. This MonitoringGraph also contains the thread that retrieves the information at the moment.

TODO: Should take out this Thread so that it connects to a monitoring repository.

Author:
Nicolas Modrzyk

Field Summary
private  org.jfree.data.XYSeries buffer
           
private  org.jfree.chart.JFreeChart chart
           
private  AbstractDataCollector collector
           
private  org.jfree.data.XYSeriesCollection dataset
           
private  boolean display
           
private  long displayFrequency
           
private  long displayFrequencyCount
           
private  javax.swing.JFrame frame
           
private  boolean framed
           
private  int frameHeight
           
private  int frameWidth
           
private  long frequency
           
private  DataCollectorMBean jmxClient
           
private  org.jfree.chart.ChartPanel panel
           
private  long poolingSpeed
           
private  long repeat
           
private  boolean saveOnFinish
           
private  org.jfree.data.XYSeries series
           
private  boolean stop
           
private  java.lang.String text
           
private  int timeFrame
           
private  long timeStarted
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
MonitoringGraph(AbstractDataCollector collector, DataCollectorMBean jmxClient)
          Creates a new MonitoringGraph object
 
Method Summary
 void addData(long newValue)
          Add a data entry to the current serie.
 void display()
          Display the graph on screen
 org.jfree.chart.JFreeChart getChart()
           
 AbstractDataCollector getCollector()
           
 boolean getDisplay()
           
 long getDisplayFrequency()
           
 javax.swing.JFrame getFrame()
           
 boolean getFramed()
           
 int getFrameHeight()
           
 int getFrameWidth()
           
 long getFrequency()
           
 org.jfree.chart.ChartPanel getPanel()
           
 long getPoolingSpeed()
           
 long getRepeat()
           
 boolean getSaveOnFinish()
           
 boolean getStop()
           
 java.lang.String getText()
           
 int getTimeFrame()
           
 long getTimeStarted()
           
 void run()
           
 void saveAs()
          Save the graph into a file
 void setCollector(AbstractDataCollector collector)
           
 void setDisplay(boolean display)
           
 void setDisplayFrequency(long displayFrequency)
           
 void setFrame(javax.swing.JFrame frame)
           
 void setFramed(boolean framed)
           
 void setFrameHeight(int frameHeight)
           
 void setFrameWidth(int frameWidth)
           
 void setFrequency(long frequency)
           
 void setPoolingSpeed(long poolingSpeed)
           
 void setRepeat(long repeat)
           
 void setSaveOnFinish(boolean saveOnFinish)
           
 void setStop(boolean stop)
           
 void setText(java.lang.String text)
           
 void setTimeFrame(int timeFrame)
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

collector

private AbstractDataCollector collector

chart

private org.jfree.chart.JFreeChart chart

panel

private org.jfree.chart.ChartPanel panel

series

private org.jfree.data.XYSeries series

dataset

private org.jfree.data.XYSeriesCollection dataset

jmxClient

private DataCollectorMBean jmxClient

frame

private javax.swing.JFrame frame

frameHeight

private int frameHeight

frameWidth

private int frameWidth

frequency

private long frequency

displayFrequency

private long displayFrequency

poolingSpeed

private long poolingSpeed

timeStarted

private long timeStarted

timeFrame

private int timeFrame

repeat

private long repeat

stop

private boolean stop

framed

private boolean framed

saveOnFinish

private boolean saveOnFinish

display

private boolean display

text

private java.lang.String text

displayFrequencyCount

private long displayFrequencyCount

buffer

private org.jfree.data.XYSeries buffer
Constructor Detail

MonitoringGraph

public MonitoringGraph(AbstractDataCollector collector,
                       DataCollectorMBean jmxClient)
Creates a new MonitoringGraph object

Parameters:
collector - An AbstractDataCollector object
jmxClient - a DataCollectorJmxClient object
Method Detail

display

public void display()
Display the graph on screen


addData

public void addData(long newValue)
Add a data entry to the current serie. Bufferize given the buffer series size

Parameters:
newValue - new data to add

saveAs

public void saveAs()
            throws java.io.IOException
Save the graph into a file

Throws:
java.io.IOException - if an error occurs

run

public void run()
See Also:
Runnable.run()

getCollector

public AbstractDataCollector getCollector()
Returns:
Returns the collector.

setCollector

public void setCollector(AbstractDataCollector collector)
Parameters:
collector - The collector to set.

getFrame

public javax.swing.JFrame getFrame()
Returns:
Returns the frame.

setFrame

public void setFrame(javax.swing.JFrame frame)
Parameters:
frame - The frame to set.

getFramed

public boolean getFramed()
Returns:
Returns the framed.

setFramed

public void setFramed(boolean framed)
Parameters:
framed - The framed to set.

getFrequency

public long getFrequency()
Returns:
Returns the frequency.

setFrequency

public void setFrequency(long frequency)
Parameters:
frequency - The frequency to set.

getRepeat

public long getRepeat()
Returns:
Returns the repeat.

setRepeat

public void setRepeat(long repeat)
Parameters:
repeat - The repeat to set.

getStop

public boolean getStop()
Returns:
Returns the stop.

setStop

public void setStop(boolean stop)
Parameters:
stop - The stop to set.

getTimeFrame

public int getTimeFrame()
Returns:
Returns the timeFrame.

setTimeFrame

public void setTimeFrame(int timeFrame)
Parameters:
timeFrame - The timeFrame to set.

getChart

public org.jfree.chart.JFreeChart getChart()
Returns:
Returns the chart.

getPanel

public org.jfree.chart.ChartPanel getPanel()
Returns:
Returns the panel.

getTimeStarted

public long getTimeStarted()
Returns:
Returns the timeStarted.

getDisplay

public boolean getDisplay()
Returns:
Returns the display.

setDisplay

public void setDisplay(boolean display)
Parameters:
display - The display to set.

getFrameHeight

public int getFrameHeight()
Returns:
Returns the frameHeight.

setFrameHeight

public void setFrameHeight(int frameHeight)
Parameters:
frameHeight - The frameHeight to set.

getFrameWidth

public int getFrameWidth()
Returns:
Returns the frameWidth.

setFrameWidth

public void setFrameWidth(int frameWidth)
Parameters:
frameWidth - The frameWidth to set.

getSaveOnFinish

public boolean getSaveOnFinish()
Returns:
Returns the saveOnFinish.

setSaveOnFinish

public void setSaveOnFinish(boolean saveOnFinish)
Parameters:
saveOnFinish - The saveOnFinish to set.

getText

public java.lang.String getText()
Returns:
Returns the text.

setText

public void setText(java.lang.String text)
Parameters:
text - The text to set.

getPoolingSpeed

public long getPoolingSpeed()
Returns:
Returns the poolingSpeed.

setPoolingSpeed

public void setPoolingSpeed(long poolingSpeed)
Parameters:
poolingSpeed - The poolingSpeed to set.

getDisplayFrequency

public long getDisplayFrequency()
Returns:
Returns the displayFrequency.

setDisplayFrequency

public void setDisplayFrequency(long displayFrequency)
Parameters:
displayFrequency - The displayFrequency to set.


Copyright © 2002, 2005 - ObjectWeb Consortium - All Rights Reserved.