Rio Project 4.2 API Documentation



org.rioproject.watch
Class Watch

java.lang.Object
  extended by org.rioproject.watch.Watch
All Implemented Interfaces:
WatchMBean
Direct Known Subclasses:
ThresholdWatch

public class Watch
extends Object
implements WatchMBean

The Watch provides a mechanism to collect information and associate it to a WatchDataSource


Field Summary
protected static String COMPONENT
          Use for configuration and logger
static String DEFAULT_VIEW
          Default View class
protected  String id
          The identifier for this watch.
protected  WatchDataSourceImpl localRef
          The WatchDataSourceImpl, this may be null if not created by the Watch
protected static Logger logger
          A Logger
protected  WatchDataSource watchDataSource
          The WatchDataSource associated with this Watch.
 
Constructor Summary
Watch(String id)
          Creates new Watch, creates and exports a WatchDataSourceImpl
Watch(String id, Configuration config)
          Creates a new Watch, creates and exports a WatchDataSourceImpl if the WatchDataSource is null using the Configuration object provided
Watch(WatchDataSource watchDataSource, String id)
          Creates new Watch
 
Method Summary
 void addWatchRecord(Calculable calc)
          Add a watch record to the history
 void clear()
          Clear the collected values
 boolean equals(Object obj)
          Indicates whether some other object is "equal to" this one.
 TabularData getCalculables()
          Get all collected Calculable values as TabularData
 String getId()
          Getter for property id.
 double getLastCalculableValue()
          Get the last Calculable as a CompositeData object
 String getView()
          Get the view for the Watch
 WatchDataSource getWatchDataSource()
          Getter for property watchDataSource.
 int hashCode()
          Returns a hash code value for the object.
static void main(String[] args)
           
 void setView(String viewClass)
          Set the view for the Watch
 void setWatchDataSource(WatchDataSource wds)
          Sets the WatchDataSource for the Watch.
 String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

watchDataSource

protected WatchDataSource watchDataSource
The WatchDataSource associated with this Watch.


id

protected String id
The identifier for this watch.


localRef

protected WatchDataSourceImpl localRef
The WatchDataSourceImpl, this may be null if not created by the Watch


COMPONENT

protected static final String COMPONENT
Use for configuration and logger

See Also:
Constant Field Values

logger

protected static final Logger logger
A Logger


DEFAULT_VIEW

public static final String DEFAULT_VIEW
Default View class

See Also:
Constant Field Values
Constructor Detail

Watch

public Watch(String id)
Creates new Watch, creates and exports a WatchDataSourceImpl

Parameters:
id - The identifier for this watch

Watch

public Watch(String id,
             Configuration config)
Creates a new Watch, creates and exports a WatchDataSourceImpl if the WatchDataSource is null using the Configuration object provided

Parameters:
id - The identifier for this watch
config - Configuration object used for constructing a WatchDataSource

Watch

public Watch(WatchDataSource watchDataSource,
             String id)
Creates new Watch

Parameters:
id - the identifier for this watch
watchDataSource - the watch data source associated with this watch
Method Detail

getWatchDataSource

public WatchDataSource getWatchDataSource()
Getter for property watchDataSource.

Returns:
Value of property watchDataSource.

setWatchDataSource

public void setWatchDataSource(WatchDataSource wds)
Sets the WatchDataSource for the Watch.

Parameters:
wds - The new WatchDataSource. The WatchDataSource will have the id, configuration and view properties injected, and will also be initialized.

getView

public String getView()
Get the view for the Watch

Returns:
The view for the Watch

setView

public void setView(String viewClass)
Set the view for the Watch

Parameters:
viewClass - Fully qualified classname, suitable for use with Class.forName(), of the class to use to visualize the Watch

getId

public String getId()
Description copied from interface: WatchMBean
Getter for property id.

Specified by:
getId in interface WatchMBean
Returns:
Value of property id.
See Also:
WatchMBean.getId()

getLastCalculableValue

public double getLastCalculableValue()
Description copied from interface: WatchMBean
Get the last Calculable as a CompositeData object

Specified by:
getLastCalculableValue in interface WatchMBean
Returns:
The last Calculable as a CompositeData object
See Also:
WatchMBean.getLastCalculableValue()

getCalculables

public TabularData getCalculables()
Description copied from interface: WatchMBean
Get all collected Calculable values as TabularData

Specified by:
getCalculables in interface WatchMBean
Returns:
All Calculable values as TabularData
See Also:
WatchMBean.getCalculables()

clear

public void clear()
Description copied from interface: WatchMBean
Clear the collected values

Specified by:
clear in interface WatchMBean
See Also:
WatchMBean.clear()

addWatchRecord

public void addWatchRecord(Calculable calc)
Add a watch record to the history

Parameters:
calc - the Calculable record to be added

equals

public boolean equals(Object obj)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class Object
Parameters:
obj - the object to compare to this one
Returns:
true if the objects are equal

hashCode

public int hashCode()
Returns a hash code value for the object.

Overrides:
hashCode in class Object
Returns:
a hash code value for the object.

toString

public String toString()
Returns a string representation of the object.

Overrides:
toString in class Object
Returns:
a string representation of the object.

main

public static void main(String[] args)

Copyright © Rio Project.

Copyright © 2006-2011 Rio Project. All Rights Reserved.