net.sourceforge.esw.service
Class DefaultHeartbeatGenerator

java.lang.Object
  |
  +--net.sourceforge.esw.util.SupportObject
        |
        +--net.sourceforge.esw.service.DefaultHeartbeatGenerator
All Implemented Interfaces:
IHeartbeatGenerator, ISupportObject, java.rmi.Remote, java.io.Serializable

public class DefaultHeartbeatGenerator
extends SupportObject
implements IHeartbeatGenerator, java.rmi.Remote

Describes the methods to generate and receive IHeartbeat instances from any application.

An IHeartbeatGenerator instance sends out an IHeartbeat instance at the interval specified by the setInterval method. One can request a current IHeartbeat instance at any time by asking for an IHeartbeat instance from the getHeartbeat method.

Objects that would like to send Telemtry data along with an IHeartbeat instance should register their intent to do so with the addTelemetrySource method.

To register intent to monitor the heartbeat of this IHeartbeatGenerator instance or to gain access to telemetry sent from this IHeartbeatGenerator instance, use the addHeartbeatMonitor method.

See Also:
IHeartbeat, IService, Serialized Form

Field Summary
protected  boolean bStarted
          States whether this DefaultHeartbeatGenerator has started sending IHeartbeat instances.
protected  ListenerSupport heartbeatMonitors
          The list of IHeartbeatMonitor instances to send IHeartbeat instances to.
protected  int interval
          The time interval for collecting and generating IHeartbeats instances.
protected  ListenerSupport telemetrySource
          The list of ITelemetrySource instances to get ITelemetry instances from.
 
Fields inherited from class net.sourceforge.esw.util.SupportObject
id, properties, propertyChildren, propertyListeners, vetoableChildren, vetoableListeners
 
Constructor Summary
DefaultHeartbeatGenerator()
          Creates a new instance of this DefaultHeartbeatGenerator.
 
Method Summary
 void addHeartbeatMonitor(IHeartbeatMonitor aMonitor)
          Adds a new IHeartbeatMonitor instance that is interested in receiving IHeartbeat instances from this IHeartbeatGenerator instance.
 void addTelemetrySource(ITelemetrySource aSource)
          Adds a new ITelemetrySource instance to this IHeartbeatGenerator instance.
 IHeartbeat getHeartbeat()
          Generates and returns a current IHeartbeat instance, This method is the pull part of the push/pull monitoring pattern.
 int getInterval()
          Returns the interval for the sending of IHeartbeat instances to the IHeartbeatMonitor instances.
 boolean isStarted()
          States whether this IHeartbeatGenerator instance is started.
 void removeHeartbeatMonitor(IHeartbeatMonitor aMonitor)
          Removes a IHeartbeatMonitor instance from this IHeartbeatGenerator instance.
 void removeTelemetrySource(ITelemetrySource aSource)
          Removes a ITelemetrySource instance from this IHeartbeatGenerator instance.
 void setInterval(int aTime)
          Sets the interval for the sending of IHeartbeat instances to the IHeartbeatMonitor instances.
 void start()
          Starts the process of generating IHeartbeat instances to each IHeartbeatMonitor instance registered with this IHeartbeatGenerator instance at the specified milliseond interval.
 void stop()
          Stops the process of generating IHeartbeat instances to each IHeartbeatMonitor instance registered with this IHeartbeatGenerator instance at the specified milliseond interval.
 
Methods inherited from class net.sourceforge.esw.util.SupportObject
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, getID, getProperty, getPropertySize, propertyKeys, removeProperty, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener, setID, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sourceforge.esw.util.ISupportObject
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, getID, getProperty, getPropertySize, propertyKeys, removeProperty, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener, setID, setProperty
 

Field Detail

interval

protected int interval
The time interval for collecting and generating IHeartbeats instances.

bStarted

protected boolean bStarted
States whether this DefaultHeartbeatGenerator has started sending IHeartbeat instances.

heartbeatMonitors

protected ListenerSupport heartbeatMonitors
The list of IHeartbeatMonitor instances to send IHeartbeat instances to.

telemetrySource

protected ListenerSupport telemetrySource
The list of ITelemetrySource instances to get ITelemetry instances from.
Constructor Detail

DefaultHeartbeatGenerator

public DefaultHeartbeatGenerator()
Creates a new instance of this DefaultHeartbeatGenerator.
Method Detail

setInterval

public void setInterval(int aTime)
Sets the interval for the sending of IHeartbeat instances to the IHeartbeatMonitor instances. This interval is in milliseconds. This IHeartbeatGenerator instance must be started before it sends any IHeartbeat instances.

Fires an IServiceResources.INTERVAL_PROPERTY property change event.

Specified by:
setInterval in interface IHeartbeatGenerator
Parameters:
aTime - the amount of time in milliseconds for this IHeartbeatGenerator instance to send IHeartbeat instances.
See Also:
getInterval()

getInterval

public int getInterval()
Returns the interval for the sending of IHeartbeat instances to the IHeartbeatMonitor instances. This interval is in milliseconds. This IHeartbeatGenerator instance must be started before it sends any IHeartbeat instances.

Specified by:
getInterval in interface IHeartbeatGenerator
Returns:
the amount of time in milliseconds for this IHeartbeatGenerator instance to send IHeartbeat instances.
See Also:
setInterval(int)

getHeartbeat

public IHeartbeat getHeartbeat()
Generates and returns a current IHeartbeat instance, This method is the pull part of the push/pull monitoring pattern.

Specified by:
getHeartbeat in interface IHeartbeatGenerator
Returns:
a newly generated IHeartbeat instance from the ITelemetrySource instances.

start

public void start()
Starts the process of generating IHeartbeat instances to each IHeartbeatMonitor instance registered with this IHeartbeatGenerator instance at the specified milliseond interval.

Fires an IServiceResources.START_PROPERTY property change event.

Specified by:
start in interface IHeartbeatGenerator
See Also:
stop(), setInterval(int)

stop

public void stop()
Stops the process of generating IHeartbeat instances to each IHeartbeatMonitor instance registered with this IHeartbeatGenerator instance at the specified milliseond interval.

Fires an IServiceResources.STOP_PROPERTY property change event.

Specified by:
stop in interface IHeartbeatGenerator
See Also:
start(), setInterval(int)

isStarted

public boolean isStarted()
States whether this IHeartbeatGenerator instance is started.

Specified by:
isStarted in interface IHeartbeatGenerator
Returns:
whether this IHeartbeatGenerator instance is started.

addTelemetrySource

public void addTelemetrySource(ITelemetrySource aSource)
Adds a new ITelemetrySource instance to this IHeartbeatGenerator instance.

The ITelemetrySource instance defines the ability for an object to send ITelemetry instances to registered IHeartbeatMonitor instances.

Fires an IServiceResources.TELEMETRY_SOURCE_PROPERTY property change event.

Specified by:
addTelemetrySource in interface IHeartbeatGenerator
Parameters:
aSource - the new ITelemetrySource instance to be added.
See Also:
removeTelemetrySource(ITelemetrySource)

removeTelemetrySource

public void removeTelemetrySource(ITelemetrySource aSource)
Removes a ITelemetrySource instance from this IHeartbeatGenerator instance.

Fires an IServiceResources.TELEMETRY_SOURCE_PROPERTY property change event.

Specified by:
removeTelemetrySource in interface IHeartbeatGenerator
Parameters:
aSource - the ITelemetrySource instance to be removed.
See Also:
addTelemetrySource(ITelemetrySource)

addHeartbeatMonitor

public void addHeartbeatMonitor(IHeartbeatMonitor aMonitor)
Adds a new IHeartbeatMonitor instance that is interested in receiving IHeartbeat instances from this IHeartbeatGenerator instance.

The IHeartbeatMonitor instance defines the ability for an object to send ITelemetry instances to registered IHeartbeatMonitor instances.

Fires an IServiceResources.HEARTBEAT_MONITOR_PROPERTY property change event.

Specified by:
addHeartbeatMonitor in interface IHeartbeatGenerator
Parameters:
aMonitor - the new IHeartbeatMonitor instance to be added.
See Also:
removeHeartbeatMonitor(IHeartbeatMonitor)

removeHeartbeatMonitor

public void removeHeartbeatMonitor(IHeartbeatMonitor aMonitor)
Removes a IHeartbeatMonitor instance from this IHeartbeatGenerator instance.

Fires an IServiceResources.HEARTBEAT_MONITOR_PROPERTY property change event.

Specified by:
removeHeartbeatMonitor in interface IHeartbeatGenerator
Parameters:
aMonitor - the new IHeartbeatMonitor instance to be removed.
See Also:
addHeartbeatMonitor(IHeartbeatMonitor)


Copyright 2002 Free Software Foundation. All Rights Reserved.