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

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

public abstract class SampleData
extends Object

Base class for all data classes.


Field Summary
protected static DecimalFormat decimalFormat
          Decimal formatter.
 
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  double computeSamplePeriod(SampleData prev)
           
protected  void concatDataElement(StringBuffer printData, Object dataElement, boolean end)
          This method provides support for Null data elements.
protected  Object getAttribute(String name)
           
protected  Double getAttributeAsDouble(String name)
           
protected  Integer getAttributeAsInt(String name)
           
protected  Long getAttributeAsLong(String name)
           
 String getCmdId()
           
 String getDomain()
           
protected abstract  String getInnerPrintData()
           
protected abstract  String getInnerPrintHeader()
           
 String getJmxURL()
           
 String getName()
           
 String getObjectName()
           
 String getPrintHeader()
          Returns the full printout header for this data.
 long getSampleTime()
           
protected static String getSeparator()
           
 String getServer()
           
 Map<String,?> getValueOfAttributes()
           
protected  boolean isValid()
           
 void printData(PrintStream out)
          Prints out all data in attributes based on the print header.
protected  void setAttribute(Attribute att)
           
 void setCmdId(String cmdid)
           
protected  void setObjectName(ObjectName on)
           
protected  void setSampleTime(long t)
           
static void setSeparator(String s)
           
protected  void setServerInfo(String name, String jmxURL, String server, 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

decimalFormat

protected static final DecimalFormat decimalFormat
Decimal formatter.

Constructor Detail

SampleData

public SampleData()
Method Detail

compute

public abstract void compute(SampleData prev)
                      throws Exception
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.
Throws:
Exception

computeSamplePeriod

protected double computeSamplePeriod(SampleData prev)
Parameters:
prev - data obtained at the previous sampling
Returns:
the time elapsed between the 2 samplings in seconds

getPrintHeader

public final 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 String getInnerPrintHeader()
Returns:
The inner (specialized) part of the header for this data type.

printData

public void printData(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 String getInnerPrintData()
Returns:
The inner (specialized) part of the data for this data type.

getCmdId

public String getCmdId()

setCmdId

public void setCmdId(String cmdid)

getObjectName

public String getObjectName()

setObjectName

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

getSampleTime

public 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(Attribute att)
Parameters:
att - Attribute to add in the list of data attributes.

getAttribute

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

getAttributeAsInt

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

concatDataElement

protected void concatDataElement(StringBuffer printData,
                                 Object dataElement,
                                 boolean end)
This method provides support for Null data elements. The current implementation is to add only separator to the printData. If we have the String a; in printData, the result will be a;;

Parameters:
printData - the current printData
dataElement - the data to be added

getAttributeAsLong

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

getAttributeAsDouble

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

getSeparator

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

setSeparator

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

getName

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

getJmxURL

public final String getJmxURL()
Returns:
The JMX URL of the monitored server.

getServer

public final String getServer()
Returns:
Name of the server.

getDomain

public final String getDomain()
Returns:
Name of the server's domain.

setServerInfo

protected final void setServerInfo(String name,
                                   String jmxURL,
                                   String server,
                                   String domain)
Parameters:
name - Name set for the server in the jmxurls.properties file.
jmxURL - JMX URL of the monitored server.
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.

getValueOfAttributes

public Map<String,?> getValueOfAttributes()


Copyright © 2011 OW2 Consortium. All Rights Reserved.