org.ow2.jasmine.monitoring.mbeancmd.sampling
Class SampleData

java.lang.Object
  extended byorg.ow2.jasmine.monitoring.mbeancmd.sampling.SampleData
Direct Known Subclasses:
CpuSunData, DSData, EntityData, JCACFData, JoramQData, ServerData, ServletData, SFBData, SLBData, TxData, WebData, XSampleData

public abstract class SampleData
extends java.lang.Object

Base class for all data classes.


Field Summary
private  java.util.Map atts
          Attributes.
protected static java.text.DecimalFormat decimalFormat
          Decimal formatter.
private  java.lang.String domain
          Domain name of the server.
private  java.lang.String name
          Name set for the server in the jmxurls.properties file.
private  java.lang.String objectName
          Object name.
private  long sampleTime
          Time at which data has been sampled.
private static java.lang.String separator
          Separator.
private  java.lang.String server
          Name of the server.
private static java.text.SimpleDateFormat simpleDateFormat
          Date formatter.
private  boolean status
          Is data valid ?
 
Constructor Summary
SampleData()
           
 
Method Summary
abstract  void compute(SampleData prev)
          Compute based on a previous measurement, will fill all fields that are marked as being "computed" and don't have a public setter.
protected  java.lang.Object getAttribute(java.lang.String name)
           
protected  double getAttributeAsDouble(java.lang.String name)
           
protected  int getAttributeAsInt(java.lang.String name)
           
protected  long getAttributeAsLong(java.lang.String name)
           
protected  java.lang.String getDomain()
           
protected abstract  java.lang.String getInnerPrintData()
           
protected abstract  java.lang.String getInnerPrintHeader()
           
protected  java.lang.String getName()
           
 java.lang.String getPrintHeader()
          Returns the full printout header for this data.
protected  long getSampleTime()
           
protected static java.lang.String getSeparator()
           
protected  java.lang.String getServer()
           
protected  boolean isValid()
           
 void printData(java.io.PrintStream out)
          Prints out all data in attributes based on the print header.
protected  void setAttribute(javax.management.Attribute att)
           
protected  void setObjectName(javax.management.ObjectName on)
           
protected  void setSampleTime(long t)
           
static void setSeparator(java.lang.String s)
           
protected  void setServerInfo(java.lang.String name, java.lang.String server, java.lang.String domain)
           
protected  void setValid(boolean status)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sampleTime

private long sampleTime
Time at which data has been sampled.


name

private java.lang.String name
Name set for the server in the jmxurls.properties file.


server

private java.lang.String server
Name of the server.


domain

private java.lang.String domain
Domain name of the server.


objectName

private java.lang.String objectName
Object name.


status

private boolean status
Is data valid ?


decimalFormat

protected static final java.text.DecimalFormat decimalFormat
Decimal formatter.


simpleDateFormat

private static java.text.SimpleDateFormat simpleDateFormat
Date formatter.


separator

private static java.lang.String separator
Separator.


atts

private java.util.Map atts
Attributes.

Constructor Detail

SampleData

public SampleData()
Method Detail

compute

public abstract void compute(SampleData prev)
Compute based on a previous measurement, will fill all fields that are marked as being "computed" and don't have a public setter.

Parameters:
prev - Previous measurement.

getPrintHeader

public final java.lang.String getPrintHeader()
Returns the full printout header for this data. The child class should not implement this method, it should only implement getInnerPrintHeader() instead.

Returns:
The printout header format for this data.

getInnerPrintHeader

protected abstract java.lang.String getInnerPrintHeader()
Returns:
The inner (specialized) part of the header for this data type.

printData

public void printData(java.io.PrintStream out)
Prints out all data in attributes based on the print header.

Parameters:
out - Stream to print data values into.
See Also:
getPrintHeader(), getInnerPrintData()

getInnerPrintData

protected abstract java.lang.String getInnerPrintData()
Returns:
The inner (specialized) part of the data for this data type.

setObjectName

protected final void setObjectName(javax.management.ObjectName on)
Parameters:
on - Object name to set.

getSampleTime

protected final long getSampleTime()
Returns:
Time of sampling, origin is 01/01/1970.

setSampleTime

protected final void setSampleTime(long t)
Parameters:
t - Time of sampling, origin is 01/01/1970.

setAttribute

protected final void setAttribute(javax.management.Attribute att)
Parameters:
att - Attribute to add in the list of data attributes.

getAttribute

protected final java.lang.Object getAttribute(java.lang.String name)
Parameters:
name - Name of the attribute to get.
Returns:
Attribute corresponding to name, null if none match.

getAttributeAsInt

protected final int getAttributeAsInt(java.lang.String name)
Parameters:
name - Name of the attribute to get.
Returns:
Attribute corresponding to name, transformed into an integer.

getAttributeAsLong

protected final long getAttributeAsLong(java.lang.String name)
Parameters:
name - Name of the attribute to get.
Returns:
Attribute corresponding to name, transformed into a long.

getAttributeAsDouble

protected final double getAttributeAsDouble(java.lang.String name)
Parameters:
name - Name of the attribute to get.
Returns:
Attribute corresponding to name, transformed into a double.

getSeparator

protected static final java.lang.String getSeparator()
Returns:
Current separator.

setSeparator

public static final void setSeparator(java.lang.String s)
Parameters:
s - Separator to set.

getName

protected final java.lang.String getName()
Returns:
Name set for the server in the jmxurls.properties file.

getServer

protected final java.lang.String getServer()
Returns:
Name of the server.

getDomain

protected final java.lang.String getDomain()
Returns:
Name of the server's domain.

setServerInfo

protected final void setServerInfo(java.lang.String name,
                                   java.lang.String server,
                                   java.lang.String domain)
Parameters:
name - Name set for the server in the jmxurls.properties file.
server - Name of the server.
domain - Domain name of the server.

setValid

protected final void setValid(boolean status)
Parameters:
status - true to mark the data as valid, false otherwise.

isValid

protected final boolean isValid()
Returns:
true if data valid, false otherwise.