eu.reservoir.monitoring.core
Class AbstractDataSource

java.lang.Object
  extended by eu.reservoir.monitoring.core.AbstractDataSource
All Implemented Interfaces:
DataSource, DataSourceDelegateInteracter, PlaneInteracter, ProbeManager, java.lang.Runnable
Direct Known Subclasses:
BasicDataSource

public abstract class AbstractDataSource
extends java.lang.Object
implements DataSource, PlaneInteracter, DataSourceDelegateInteracter, java.lang.Runnable

An abstract Data Source. It receives measurements from the probes and it also reports measurements to the delegate object.


Constructor Summary
AbstractDataSource()
          Construct a DataSource.
 
Method Summary
 DataSource activateProbe(ID probeID)
          Activate a Probe by ID
 DataSource activateProbe(Probe p)
          Activate a Probe
 DataSource activateProbe(java.lang.String name)
          Activate a Probe by name
 DataSource addProbe(Probe p)
          Add a new probe.
 void beginThreadBody()
          The code to run at the begining of the thread body.
 boolean connect()
          Connect to a delivery mechansim.
 DataSource deactivateProbe(ID probeID)
          Deactivate a Probe by ID
 DataSource deactivateProbe(Probe p)
          Deactivate a Probe
 DataSource deactivateProbe(java.lang.String name)
          Deactivate a Probe by name
 boolean disconnect()
          Dicconnect from a delivery mechansim.
 void endThreadBody()
          The code to run at the end of the thread body.
 ControlPlane getControlPlane()
          Get the ControlPlane this is a delegate for.
 DataPlane getDataPlane()
          Get the DataPlane this is a delegate for.
 DataSourceDelegate getDataSourceDelegate()
          Get the delegate that will recieve the measurments.
 ID getID()
          Get the Probe ID
 InfoPlane getInfoPlane()
          Get the InfoPlane this is a delegate for.
 java.lang.String getName()
          Get the name of the DataSource
 java.util.Collection<ProbeAttribute> getProbeAttributes(ID probeID)
          Get the attributes for a Probe by ID.
 java.util.Collection<ProbeAttribute> getProbeAttributes(Probe p)
          Get the attributes for a Probe.
 java.util.Collection<ProbeAttribute> getProbeAttributes(java.lang.String name)
          Get the attributes for a Probe by name.
 Probe getProbeByID(ID probeID)
          Get a probe by ID
 Probe getProbeByName(java.lang.String name)
          Get a probe by name.
 Rational getProbeDataRate(ID probeID)
          Get the data rate for a Probe by ID The data rate is a Rational.
 Rational getProbeDataRate(Probe p)
          Get the data rate for a Probe The data rate is a Rational.
 Rational getProbeDataRate(java.lang.String name)
          Get the data rate for a Probe by name The data rate is a Rational.
 ID getProbeGroupID(ID probeID)
          Get the Group ID of the Probe by ID
 ID getProbeGroupID(Probe p)
          Get the Group ID of the Probe.
 ID getProbeGroupID(java.lang.String name)
          Get the Group ID of the Probe by name
 java.util.Collection<ID> getProbeIDs()
          Get a list of probe IDs
 Measurement getProbeLastMeasurement(ID probeID)
          Get the last measurement that was collected by ID
 Measurement getProbeLastMeasurement(Probe p)
          Get the last measurement that was collected
 Measurement getProbeLastMeasurement(java.lang.String name)
          Get the last measurement that was collected by name
 Timestamp getProbeLastMeasurementCollection(ID probeID)
          Get the last time a measurement was collected by ID.
 Timestamp getProbeLastMeasurementCollection(Probe p)
          Get the last time a measurement was collected
 Timestamp getProbeLastMeasurementCollection(java.lang.String name)
          Get the last time a measurement was collected by name
 java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> getProbeMetaData()
          Get the Probe Meta Data for all the probes Returns a Map using the Probe names as the keys, and a map of probe attributes as the values.
 java.util.Map<java.lang.String,java.lang.Object> getProbeMetaData(ID probeID)
          Get the Probe Meta Data for a specified Probe by ID Returns a map of probe attributes as the values.
 java.util.Map<java.lang.String,java.lang.Object> getProbeMetaData(Probe p)
          Get the Probe Meta Data for a specified Probe.
 java.util.Map<java.lang.String,java.lang.Object> getProbeMetaData(java.lang.String name)
          Get the Probe Meta Data for a specified Probe by name Returns a map of probe attributes as the values.
 java.lang.String getProbeName(ID probeID)
          Get the name of the Probe by ID
 java.lang.String getProbeName(Probe p)
          Get the name of the Probe
 java.lang.String getProbeName(java.lang.String name)
          Get the name of the Probe by name
 java.util.Collection<java.lang.String> getProbeNames()
          Get a list of probe names.
 java.util.Collection<Probe> getProbes()
          Get a list of probes.
 ID getProbeServiceID(ID probeID)
          Get the Service ID of the Probe by ID
 ID getProbeServiceID(Probe p)
          Get the Service ID of the Probe.
 ID getProbeServiceID(java.lang.String name)
          Get the Service ID of the Probe by name
 boolean isConnected()
          Is this connected to a delivery mechansim.
 boolean isProbeActive(ID probeID)
          Has this probe been activated by ID Is the thread associated with a Probe acutally running.
 boolean isProbeActive(Probe p)
          Has this probe been activated.
 boolean isProbeActive(java.lang.String name)
          Has this probe been activated by name Is the thread associated with a Probe acutally running.
 boolean isProbeOn(ID probeID)
          Is this Probe turned on by ID The thread is running, but is the Probe getting values.
 boolean isProbeOn(Probe p)
          Is this Probe turned on.
 boolean isProbeOn(java.lang.String name)
          Is this Probe turned on by name The thread is running, but is the Probe getting values.
protected  DataPlaneMessage measurementMessage(ProbeMeasurement m)
          Create a DataPlaneMessage message from a Measurement.
 int notifyMeasurement(Measurement m)
          Recieve a measurment from the Probe and pass it onto the data source delegate.
protected  void registerProbe(Probe probe)
          Register a probe
 DataSource removeProbe(Probe p)
          Remove a probe.
 void run()
          The thread body.
 PlaneInteracter setControlPlane(ControlPlane controlPlane)
          Set the ControlPlane this is a delegate for.
 PlaneInteracter setDataPlane(DataPlane dataPlane)
          Set the DataPlane this is a delegate for.
 DataSourceDelegate setDataSourceDelegate(DataSourceDelegate dsd)
          Set the delegate that will recieve the measurments.
 DataSource setID(ID id)
          Set the DataSource ID
 PlaneInteracter setInfoPlane(InfoPlane infoPlane)
          Set the InfoPlane this is a delegate for.
 DataSource setName(java.lang.String name)
          Set the name of the DataSource
 DataSource setProbeDataRate(ID probeID, Rational dataRate)
          Set the data rate for a Probe by ID The data rate is a Rational.
 DataSource setProbeDataRate(Probe p, Rational dataRate)
          Set the data rate for a Probe The data rate is a Rational.
 DataSource setProbeDataRate(java.lang.String name, Rational dataRate)
          Set the data rate for a Probe by name The data rate is a Rational.
 boolean setProbeGroupID(ID probeID, ID id)
          Set the Group ID for a Probe by ID
 boolean setProbeGroupID(Probe p, ID id)
          Set the Group ID for a Probe
 boolean setProbeGroupID(java.lang.String name, ID id)
          Set the Group ID for a Probe by name
 boolean setProbeName(ID probeID, java.lang.String newName)
          Set the name of the Probe by ID
 boolean setProbeName(Probe p, java.lang.String newName)
          Set the name of the Probe
 boolean setProbeName(java.lang.String name, java.lang.String newName)
          Set the name of the Probe by name
 boolean setProbeServiceID(ID probeID, ID id)
          Set the Service ID for a Probe by ID
 boolean setProbeServiceID(Probe p, ID id)
          Set the Service ID for a Probe
 boolean setProbeServiceID(java.lang.String name, ID id)
          Set the Service ID for a Probe by name
protected  void startQueueHandlingThread()
          Activate the transmission from the queue to the data plane by starting the thread.
protected  void stopQueueHandlingThread()
          Deactivate the transmission from the queue to the data plane by stopping the thread.
 java.lang.String toString()
          To String
 DataSource turnOffProbe(ID probeID)
          Turn off a Probe by ID
 DataSource turnOffProbe(Probe p)
          Turn off a Probe
 DataSource turnOffProbe(java.lang.String name)
          Turn off a Probe by name
 DataSource turnOnProbe(ID probeID)
          Turn on a Probe by ID
 DataSource turnOnProbe(Probe p)
          Turn on a Probe
 DataSource turnOnProbe(java.lang.String name)
          Turn on a Probe by name
protected  void unregisterProbe(Probe probe)
          Unregister a probe
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractDataSource

public AbstractDataSource()
Construct a DataSource.

Method Detail

startQueueHandlingThread

protected void startQueueHandlingThread()
Activate the transmission from the queue to the data plane by starting the thread.


stopQueueHandlingThread

protected void stopQueueHandlingThread()
Deactivate the transmission from the queue to the data plane by stopping the thread.


addProbe

public DataSource addProbe(Probe p)
Add a new probe.

Specified by:
addProbe in interface DataSource

removeProbe

public DataSource removeProbe(Probe p)
Remove a probe.

Specified by:
removeProbe in interface DataSource

registerProbe

protected void registerProbe(Probe probe)
Register a probe


unregisterProbe

protected void unregisterProbe(Probe probe)
Unregister a probe


getID

public ID getID()
Get the Probe ID

Specified by:
getID in interface DataSource

setID

public DataSource setID(ID id)
Set the DataSource ID

Specified by:
setID in interface DataSource

getName

public java.lang.String getName()
Get the name of the DataSource

Specified by:
getName in interface DataSource

setName

public DataSource setName(java.lang.String name)
Set the name of the DataSource

Specified by:
setName in interface DataSource

getProbeNames

public java.util.Collection<java.lang.String> getProbeNames()
Get a list of probe names.

Specified by:
getProbeNames in interface DataSource

getProbeIDs

public java.util.Collection<ID> getProbeIDs()
Get a list of probe IDs

Specified by:
getProbeIDs in interface DataSource

getProbes

public java.util.Collection<Probe> getProbes()
Get a list of probes.

Specified by:
getProbes in interface DataSource

getProbeAttributes

public java.util.Collection<ProbeAttribute> getProbeAttributes(java.lang.String name)
Get the attributes for a Probe by name.

Specified by:
getProbeAttributes in interface DataSource

getProbeAttributes

public java.util.Collection<ProbeAttribute> getProbeAttributes(ID probeID)
Get the attributes for a Probe by ID.

Specified by:
getProbeAttributes in interface DataSource

getProbeAttributes

public java.util.Collection<ProbeAttribute> getProbeAttributes(Probe p)
Get the attributes for a Probe.

Specified by:
getProbeAttributes in interface DataSource

getProbeMetaData

public java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> getProbeMetaData()
Get the Probe Meta Data for all the probes Returns a Map using the Probe names as the keys, and a map of probe attributes as the values. e.g "memory" -> [name: "memory", dataRate: 720/1, active: true, on: false]

Specified by:
getProbeMetaData in interface DataSource

getProbeMetaData

public java.util.Map<java.lang.String,java.lang.Object> getProbeMetaData(java.lang.String name)
Get the Probe Meta Data for a specified Probe by name Returns a map of probe attributes as the values. e.g [name: "memory", dataRate: 720/1, active: true, on: false]

Specified by:
getProbeMetaData in interface DataSource

getProbeMetaData

public java.util.Map<java.lang.String,java.lang.Object> getProbeMetaData(ID probeID)
Get the Probe Meta Data for a specified Probe by ID Returns a map of probe attributes as the values. e.g [name: "memory", dataRate: 720/1, active: true, on: false]

Specified by:
getProbeMetaData in interface DataSource

getProbeMetaData

public java.util.Map<java.lang.String,java.lang.Object> getProbeMetaData(Probe p)
Get the Probe Meta Data for a specified Probe. Returns a map of probe attributes as the values. e.g [name: "memory", dataRate: 720/1, active: true, on: false]

Specified by:
getProbeMetaData in interface DataSource

getProbeByName

public Probe getProbeByName(java.lang.String name)
Get a probe by name.

Specified by:
getProbeByName in interface DataSource
Returns:
the Probe with name name, null otherwise

getProbeByID

public Probe getProbeByID(ID probeID)
Get a probe by ID

Specified by:
getProbeByID in interface DataSource
Returns:
the Probe with ID, null otherwise

turnOnProbe

public DataSource turnOnProbe(java.lang.String name)
Turn on a Probe by name

Specified by:
turnOnProbe in interface ProbeManager

turnOnProbe

public DataSource turnOnProbe(ID probeID)
Turn on a Probe by ID

Specified by:
turnOnProbe in interface ProbeManager

turnOnProbe

public DataSource turnOnProbe(Probe p)
Turn on a Probe

Specified by:
turnOnProbe in interface ProbeManager

turnOffProbe

public DataSource turnOffProbe(java.lang.String name)
Turn off a Probe by name

Specified by:
turnOffProbe in interface ProbeManager

turnOffProbe

public DataSource turnOffProbe(ID probeID)
Turn off a Probe by ID

Specified by:
turnOffProbe in interface ProbeManager

turnOffProbe

public DataSource turnOffProbe(Probe p)
Turn off a Probe

Specified by:
turnOffProbe in interface ProbeManager

isProbeOn

public boolean isProbeOn(java.lang.String name)
Is this Probe turned on by name The thread is running, but is the Probe getting values.

Specified by:
isProbeOn in interface ProbeManager

isProbeOn

public boolean isProbeOn(ID probeID)
Is this Probe turned on by ID The thread is running, but is the Probe getting values.

Specified by:
isProbeOn in interface ProbeManager

isProbeOn

public boolean isProbeOn(Probe p)
Is this Probe turned on. The thread is running, but is the Probe getting values.

Specified by:
isProbeOn in interface ProbeManager

activateProbe

public DataSource activateProbe(java.lang.String name)
Activate a Probe by name

Specified by:
activateProbe in interface ProbeManager

activateProbe

public DataSource activateProbe(ID probeID)
Activate a Probe by ID

Specified by:
activateProbe in interface ProbeManager

activateProbe

public DataSource activateProbe(Probe p)
Activate a Probe

Specified by:
activateProbe in interface ProbeManager

deactivateProbe

public DataSource deactivateProbe(java.lang.String name)
Deactivate a Probe by name

Specified by:
deactivateProbe in interface ProbeManager

deactivateProbe

public DataSource deactivateProbe(ID probeID)
Deactivate a Probe by ID

Specified by:
deactivateProbe in interface ProbeManager

deactivateProbe

public DataSource deactivateProbe(Probe p)
Deactivate a Probe

Specified by:
deactivateProbe in interface ProbeManager

isProbeActive

public boolean isProbeActive(java.lang.String name)
Has this probe been activated by name Is the thread associated with a Probe acutally running.

Specified by:
isProbeActive in interface ProbeManager

isProbeActive

public boolean isProbeActive(ID probeID)
Has this probe been activated by ID Is the thread associated with a Probe acutally running.

Specified by:
isProbeActive in interface ProbeManager

isProbeActive

public boolean isProbeActive(Probe p)
Has this probe been activated. Is the thread associated with a Probe acutally running.

Specified by:
isProbeActive in interface ProbeManager

getProbeName

public java.lang.String getProbeName(java.lang.String name)
Get the name of the Probe by name

Specified by:
getProbeName in interface ProbeManager

getProbeName

public java.lang.String getProbeName(ID probeID)
Get the name of the Probe by ID

Specified by:
getProbeName in interface ProbeManager

getProbeName

public java.lang.String getProbeName(Probe p)
Get the name of the Probe

Specified by:
getProbeName in interface ProbeManager

setProbeName

public boolean setProbeName(java.lang.String name,
                            java.lang.String newName)
Set the name of the Probe by name

Specified by:
setProbeName in interface ProbeManager

setProbeName

public boolean setProbeName(ID probeID,
                            java.lang.String newName)
Set the name of the Probe by ID

Specified by:
setProbeName in interface ProbeManager

setProbeName

public boolean setProbeName(Probe p,
                            java.lang.String newName)
Set the name of the Probe

Specified by:
setProbeName in interface ProbeManager

getProbeServiceID

public ID getProbeServiceID(java.lang.String name)
Get the Service ID of the Probe by name

Specified by:
getProbeServiceID in interface ProbeManager

getProbeServiceID

public ID getProbeServiceID(ID probeID)
Get the Service ID of the Probe by ID

Specified by:
getProbeServiceID in interface ProbeManager

getProbeServiceID

public ID getProbeServiceID(Probe p)
Get the Service ID of the Probe.

Specified by:
getProbeServiceID in interface ProbeManager

setProbeServiceID

public boolean setProbeServiceID(java.lang.String name,
                                 ID id)
Set the Service ID for a Probe by name

Specified by:
setProbeServiceID in interface ProbeManager

setProbeServiceID

public boolean setProbeServiceID(ID probeID,
                                 ID id)
Set the Service ID for a Probe by ID

Specified by:
setProbeServiceID in interface ProbeManager

setProbeServiceID

public boolean setProbeServiceID(Probe p,
                                 ID id)
Set the Service ID for a Probe

Specified by:
setProbeServiceID in interface ProbeManager

getProbeGroupID

public ID getProbeGroupID(java.lang.String name)
Get the Group ID of the Probe by name

Specified by:
getProbeGroupID in interface ProbeManager

getProbeGroupID

public ID getProbeGroupID(ID probeID)
Get the Group ID of the Probe by ID

Specified by:
getProbeGroupID in interface ProbeManager

getProbeGroupID

public ID getProbeGroupID(Probe p)
Get the Group ID of the Probe.

Specified by:
getProbeGroupID in interface ProbeManager

setProbeGroupID

public boolean setProbeGroupID(java.lang.String name,
                               ID id)
Set the Group ID for a Probe by name

Specified by:
setProbeGroupID in interface ProbeManager

setProbeGroupID

public boolean setProbeGroupID(ID probeID,
                               ID id)
Set the Group ID for a Probe by ID

Specified by:
setProbeGroupID in interface ProbeManager

setProbeGroupID

public boolean setProbeGroupID(Probe p,
                               ID id)
Set the Group ID for a Probe

Specified by:
setProbeGroupID in interface ProbeManager

getProbeDataRate

public Rational getProbeDataRate(java.lang.String name)
Get the data rate for a Probe by name The data rate is a Rational. Specified in measurements per hour

Specified by:
getProbeDataRate in interface ProbeManager

getProbeDataRate

public Rational getProbeDataRate(ID probeID)
Get the data rate for a Probe by ID The data rate is a Rational. Specified in measurements per hour

Specified by:
getProbeDataRate in interface ProbeManager

getProbeDataRate

public Rational getProbeDataRate(Probe p)
Get the data rate for a Probe The data rate is a Rational. Specified in measurements per hour

Specified by:
getProbeDataRate in interface ProbeManager

setProbeDataRate

public DataSource setProbeDataRate(java.lang.String name,
                                   Rational dataRate)
Set the data rate for a Probe by name The data rate is a Rational. Specified in measurements per hour

Specified by:
setProbeDataRate in interface ProbeManager

setProbeDataRate

public DataSource setProbeDataRate(ID probeID,
                                   Rational dataRate)
Set the data rate for a Probe by ID The data rate is a Rational. Specified in measurements per hour

Specified by:
setProbeDataRate in interface ProbeManager

setProbeDataRate

public DataSource setProbeDataRate(Probe p,
                                   Rational dataRate)
Set the data rate for a Probe The data rate is a Rational. Specified in measurements per hour

Specified by:
setProbeDataRate in interface ProbeManager

getProbeLastMeasurement

public Measurement getProbeLastMeasurement(java.lang.String name)
Get the last measurement that was collected by name

Specified by:
getProbeLastMeasurement in interface ProbeManager

getProbeLastMeasurement

public Measurement getProbeLastMeasurement(ID probeID)
Get the last measurement that was collected by ID

Specified by:
getProbeLastMeasurement in interface ProbeManager

getProbeLastMeasurement

public Measurement getProbeLastMeasurement(Probe p)
Get the last measurement that was collected

Specified by:
getProbeLastMeasurement in interface ProbeManager

getProbeLastMeasurementCollection

public Timestamp getProbeLastMeasurementCollection(java.lang.String name)
Get the last time a measurement was collected by name

Specified by:
getProbeLastMeasurementCollection in interface ProbeManager

getProbeLastMeasurementCollection

public Timestamp getProbeLastMeasurementCollection(ID probeID)
Get the last time a measurement was collected by ID.

Specified by:
getProbeLastMeasurementCollection in interface ProbeManager

getProbeLastMeasurementCollection

public Timestamp getProbeLastMeasurementCollection(Probe p)
Get the last time a measurement was collected

Specified by:
getProbeLastMeasurementCollection in interface ProbeManager

notifyMeasurement

public int notifyMeasurement(Measurement m)
Recieve a measurment from the Probe and pass it onto the data source delegate.

Specified by:
notifyMeasurement in interface ProbeManager
Returns:
-1 if something goes wrong

run

public void run()
The thread body. It sends stuff from the queue onto the network.

Specified by:
run in interface java.lang.Runnable

measurementMessage

protected DataPlaneMessage measurementMessage(ProbeMeasurement m)
                                       throws java.io.IOException
Create a DataPlaneMessage message from a Measurement. The measurement is wrapped up as a DataPlaneMessage message in order that we can add more data and get the Plane object to demux multiple requests.

Throws:
java.io.IOException

getDataSourceDelegate

public DataSourceDelegate getDataSourceDelegate()
Get the delegate that will recieve the measurments.

Specified by:
getDataSourceDelegate in interface DataSourceDelegateInteracter

setDataSourceDelegate

public DataSourceDelegate setDataSourceDelegate(DataSourceDelegate dsd)
Set the delegate that will recieve the measurments.

Specified by:
setDataSourceDelegate in interface DataSourceDelegateInteracter

getDataPlane

public DataPlane getDataPlane()
Get the DataPlane this is a delegate for.

Specified by:
getDataPlane in interface PlaneInteracter

setDataPlane

public PlaneInteracter setDataPlane(DataPlane dataPlane)
Set the DataPlane this is a delegate for.

Specified by:
setDataPlane in interface PlaneInteracter

getControlPlane

public ControlPlane getControlPlane()
Get the ControlPlane this is a delegate for.

Specified by:
getControlPlane in interface PlaneInteracter

setControlPlane

public PlaneInteracter setControlPlane(ControlPlane controlPlane)
Set the ControlPlane this is a delegate for.

Specified by:
setControlPlane in interface PlaneInteracter

getInfoPlane

public InfoPlane getInfoPlane()
Get the InfoPlane this is a delegate for.

Specified by:
getInfoPlane in interface PlaneInteracter

setInfoPlane

public PlaneInteracter setInfoPlane(InfoPlane infoPlane)
Set the InfoPlane this is a delegate for.

Specified by:
setInfoPlane in interface PlaneInteracter

connect

public boolean connect()
Connect to a delivery mechansim.

Specified by:
connect in interface PlaneInteracter

isConnected

public boolean isConnected()
Is this connected to a delivery mechansim.

Specified by:
isConnected in interface PlaneInteracter

disconnect

public boolean disconnect()
Dicconnect from a delivery mechansim.

Specified by:
disconnect in interface PlaneInteracter

beginThreadBody

public void beginThreadBody()
The code to run at the begining of the thread body. Used to set things up.


endThreadBody

public void endThreadBody()
The code to run at the end of the thread body. Used to tidy things up.


toString

public java.lang.String toString()
To String

Overrides:
toString in class java.lang.Object


RESERVOIR Monitoring 0.6.4