org.ow2.jasmine.probe.collectors
Class JCollector

java.lang.Object
  extended by org.ow2.jasmine.probe.collectors.JCollector
All Implemented Interfaces:
org.ow2.jasmine.probe.collector.JasmineCollector
Direct Known Subclasses:
ConstantCollector

public abstract class JCollector
extends java.lang.Object
implements org.ow2.jasmine.probe.collector.JasmineCollector

This object represents a Collector in use. It may be associated to more than one JProbe It is abstract, because implementation may be various. These implementations are in separate modules.

Author:
durieuxp, danesa

Field Summary
protected  java.lang.String hostName
           
protected  org.ow2.jasmine.probe.JasmineIndicator indicator
          Indicator definition
protected  org.ow2.util.log.Log logger
          Logger.
protected  java.lang.String name
          Name used to identify this Collector
protected  int period
          period of polling in seconds
protected  org.ow2.jasmine.probe.probemanager.ProbeManager probeManager
          reference to the ProbeManager.
 
Constructor Summary
JCollector(java.lang.String name, org.ow2.jasmine.probe.JasmineIndicator def, int period)
          Constructor
 
Method Summary
protected  long addJsr(java.util.Collection<org.ow2.jasmine.probe.JasmineSingleResult> jsrs)
          Add the values of a list of JSRs.
protected  long addValues(java.util.Collection<java.lang.Number> values)
          Add a list of values of same type
protected  java.lang.Number averageJsr(java.util.Collection<org.ow2.jasmine.probe.JasmineSingleResult> jsrs)
           
protected  long diffJsr(java.util.Collection<org.ow2.jasmine.probe.JasmineSingleResult> jsrs)
          Make a diff between 2 same type values of a list containing 2 JSRs.
protected  long diffValues(java.lang.Number v1, java.lang.Number v2)
          Make a diff between 2 values
protected  float divideJsr(java.util.Collection<org.ow2.jasmine.probe.JasmineSingleResult> jsrs)
          Make a division of 2 values of 2 JSRs contained in a given JSRs list
protected  float divideValues(java.lang.Number v1, java.lang.Number v2)
          Make a div between 2 values
protected  java.lang.String getDomainName()
           
 org.ow2.jasmine.probe.JasmineIndicator getIndicator()
           
abstract  org.ow2.jasmine.probe.JasmineIndicatorValue getLastResult()
          return the last result for this indicator
 java.lang.String getName()
           
protected  java.lang.String getServerName()
           
protected  java.util.HashMap<java.lang.String,java.lang.String> jsrProps(java.util.Collection<org.ow2.jasmine.probe.JasmineSingleResult> jsrs)
          Construct properties for a JSR by aggregating the properties of a collection of JSRs.
protected  long longValue(java.lang.Number nb)
          Try to cast a Number into a long value
protected  java.lang.Number maxJsr(java.util.Collection<org.ow2.jasmine.probe.JasmineSingleResult> jsrs)
          Return the max value in a collection of JSRs.
protected  java.lang.Number minJsr(java.util.Collection<org.ow2.jasmine.probe.JasmineSingleResult> jsrs)
          Return the min value in a collection of JSRs.
protected  long multiplyJsr(java.util.Collection<org.ow2.jasmine.probe.JasmineSingleResult> jsrs)
          Multiply the values of a list of JSRs.
protected  long multiplyValues(java.util.Collection<java.lang.Number> values)
          Multiply a list of values of same type
 void setProbeManager(org.ow2.jasmine.probe.probemanager.ProbeManager probeManager)
          Set the probeManager ref when it is needed, for some Collectors.
abstract  void startPolling()
          Restart polling
abstract  void stopPolling()
          Stop polling
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected org.ow2.util.log.Log logger
Logger.


indicator

protected org.ow2.jasmine.probe.JasmineIndicator indicator
Indicator definition


period

protected int period
period of polling in seconds


name

protected java.lang.String name
Name used to identify this Collector


probeManager

protected org.ow2.jasmine.probe.probemanager.ProbeManager probeManager
reference to the ProbeManager.


hostName

protected java.lang.String hostName
Constructor Detail

JCollector

public JCollector(java.lang.String name,
                  org.ow2.jasmine.probe.JasmineIndicator def,
                  int period)
Constructor

Method Detail

getIndicator

public org.ow2.jasmine.probe.JasmineIndicator getIndicator()

setProbeManager

public void setProbeManager(org.ow2.jasmine.probe.probemanager.ProbeManager probeManager)
Set the probeManager ref when it is needed, for some Collectors.

Parameters:
probeManager -

getDomainName

protected java.lang.String getDomainName()

getServerName

protected java.lang.String getServerName()

getName

public java.lang.String getName()
Specified by:
getName in interface org.ow2.jasmine.probe.collector.JasmineCollector
Returns:
name of this Collector

getLastResult

public abstract org.ow2.jasmine.probe.JasmineIndicatorValue getLastResult()
                                                                   throws org.ow2.jasmine.probe.collector.JasmineCollectorException
return the last result for this indicator

Specified by:
getLastResult in interface org.ow2.jasmine.probe.collector.JasmineCollector
Returns:
JasmineIndicatorValue or null if no value available
Throws:
org.ow2.jasmine.probe.collector.JasmineCollectorException

stopPolling

public abstract void stopPolling()
Stop polling

Specified by:
stopPolling in interface org.ow2.jasmine.probe.collector.JasmineCollector

startPolling

public abstract void startPolling()
Restart polling

Specified by:
startPolling in interface org.ow2.jasmine.probe.collector.JasmineCollector

maxJsr

protected java.lang.Number maxJsr(java.util.Collection<org.ow2.jasmine.probe.JasmineSingleResult> jsrs)
                           throws org.ow2.jasmine.probe.collector.JasmineCollectorException
Return the max value in a collection of JSRs.

Parameters:
jsrs - collection of JSRs to be aggregated
Returns:
the maximum numeric value
Throws:
org.ow2.jasmine.probe.collector.JasmineCollectorException

minJsr

protected java.lang.Number minJsr(java.util.Collection<org.ow2.jasmine.probe.JasmineSingleResult> jsrs)
                           throws org.ow2.jasmine.probe.collector.JasmineCollectorException
Return the min value in a collection of JSRs.

Parameters:
jsrs - collection of JSRs to be aggregated
Returns:
the minimum numeric value
Throws:
org.ow2.jasmine.probe.collector.JasmineCollectorException

averageJsr

protected java.lang.Number averageJsr(java.util.Collection<org.ow2.jasmine.probe.JasmineSingleResult> jsrs)
                               throws org.ow2.jasmine.probe.collector.JasmineCollectorException
Throws:
org.ow2.jasmine.probe.collector.JasmineCollectorException

diffValues

protected long diffValues(java.lang.Number v1,
                          java.lang.Number v2)
                   throws org.ow2.jasmine.probe.collector.JasmineCollectorException
Make a diff between 2 values

Parameters:
v1 -
v2 -
Returns:
v1 - v2
Throws:
org.ow2.jasmine.probe.collector.JasmineCollectorException

diffJsr

protected long diffJsr(java.util.Collection<org.ow2.jasmine.probe.JasmineSingleResult> jsrs)
                throws org.ow2.jasmine.probe.collector.JasmineCollectorException
Make a diff between 2 same type values of a list containing 2 JSRs.

Parameters:
jsrs - the list of JSRs
Returns:
Object of same type representing the diff
Throws:
org.ow2.jasmine.probe.collector.JasmineCollectorException

divideValues

protected float divideValues(java.lang.Number v1,
                             java.lang.Number v2)
                      throws org.ow2.jasmine.probe.collector.JasmineCollectorException
Make a div between 2 values

Parameters:
v1 -
v2 -
Returns:
v1 / v2
Throws:
org.ow2.jasmine.probe.collector.JasmineCollectorException

divideJsr

protected float divideJsr(java.util.Collection<org.ow2.jasmine.probe.JasmineSingleResult> jsrs)
                   throws org.ow2.jasmine.probe.collector.JasmineCollectorException
Make a division of 2 values of 2 JSRs contained in a given JSRs list

Parameters:
jsrs - the list of 2 JSRs
Returns:
Object of same type representing the division
Throws:
org.ow2.jasmine.probe.collector.JasmineCollectorException

addValues

protected long addValues(java.util.Collection<java.lang.Number> values)
                  throws org.ow2.jasmine.probe.collector.JasmineCollectorException
Add a list of values of same type

Parameters:
values -
Returns:
Object of same type representing the sum of all values
Throws:
org.ow2.jasmine.probe.collector.JasmineCollectorException

addJsr

protected long addJsr(java.util.Collection<org.ow2.jasmine.probe.JasmineSingleResult> jsrs)
               throws org.ow2.jasmine.probe.collector.JasmineCollectorException
Add the values of a list of JSRs.

Parameters:
jsrs - the list of JSRs
Returns:
Object of same type representing the sum of all the JSR values.
Throws:
org.ow2.jasmine.probe.collector.JasmineCollectorException

multiplyValues

protected long multiplyValues(java.util.Collection<java.lang.Number> values)
                       throws org.ow2.jasmine.probe.collector.JasmineCollectorException
Multiply a list of values of same type

Parameters:
values -
Returns:
Object of same type representing the product of all values
Throws:
org.ow2.jasmine.probe.collector.JasmineCollectorException

multiplyJsr

protected long multiplyJsr(java.util.Collection<org.ow2.jasmine.probe.JasmineSingleResult> jsrs)
                    throws org.ow2.jasmine.probe.collector.JasmineCollectorException
Multiply the values of a list of JSRs.

Parameters:
jsrs - the list of JSRs
Returns:
Object of same type representing the product of all the JSR values.
Throws:
org.ow2.jasmine.probe.collector.JasmineCollectorException

longValue

protected long longValue(java.lang.Number nb)
                  throws org.ow2.jasmine.probe.collector.JasmineCollectorException
Try to cast a Number into a long value

Parameters:
nb -
Returns:
Throws:
org.ow2.jasmine.probe.collector.JasmineCollectorException

jsrProps

protected java.util.HashMap<java.lang.String,java.lang.String> jsrProps(java.util.Collection<org.ow2.jasmine.probe.JasmineSingleResult> jsrs)
Construct properties for a JSR by aggregating the properties of a collection of JSRs.

Parameters:
jsrs -
Returns:


Copyright © 2011 OW2 Consortium. All Rights Reserved.