2009-01-09 1.2.0

org.eclipse.soda.dk.measurement
Class Measurement

java.lang.Object
  extended by org.eclipse.soda.dk.core.EscObject
      extended by org.eclipse.soda.dk.device.Control
          extended by org.eclipse.soda.dk.measurement.Measurement
All Implemented Interfaces:
ControlService, MeasurementService, ErrorListener
Direct Known Subclasses:
MeasurementFieldMeasurement, Measurements, MethodMeasurement, ReadOnlyMeasurement, UnitsMeasurement

public class Measurement
extends Control
implements MeasurementService

The DkMeasurement class implements the MeasurementService interface.

Since:
1.0
Version:
1.2.0
See Also:
Control, ControlService, ErrorListener, MeasurementService, MessageHandler, Object

Field Summary
 
Fields inherited from class org.eclipse.soda.dk.device.Control
EXCEPTION_READ_FAILED_RESOURCE, SET_VALUE_EXCEPTION_RESOURCE
 
Fields inherited from class org.eclipse.soda.dk.core.EscObject
CLONE_EXCEPTION_RESOURCE, EMPTY_BYTES, EMPTY_STRING, ERROR_OCCURRED_EXCEPTION_RESOURCE, ID_FILTER_KEY, ID_KEY, ID_KEY_ANY, ID_NAME_KEY, INTEGER_TABLE, INTEGER_TABLE_SIZE, KEY_KEY, LOG_DEBUG, LOG_DEFAULT, LOG_ERROR, LOG_INFO, LOG_LEVEL_KEY, LOG_TRACE, LOG_WARNING, LONG_TABLE, LONG_TABLE_SIZE, PREFIX_KEY, READONLY_EMPTY_COLLECTION, READONLY_EMPTY_LIST, READONLY_EMPTY_MAP, RESOURCE_BUNDLE, SLEEP_EXCEPTION_RESOURCE, SYSTEM_INFO_RESOURCE, TO_STRING_CONFIGURATION_KEYS, TRACE_LEVEL_HIGH, TRACE_LEVEL_LOW, TRACE_LEVEL_MAX, TRACE_LEVEL_MIN, TRACE_LEVEL_NONE, TRACE_LEVEL_NORMAL, TRACELEVEL_KEY, UNKNOWN_ERROR_RESOURCE, Unmodifiable
 
Constructor Summary
Measurement(java.lang.String key)
          Constructs an Measurement object using the input parameter(s).
Measurement(java.lang.String key, java.lang.Object value)
          Constructs an Measurement object using the input parameter(s).
 
Method Summary
 void addMeasurementListener(java.util.Collection channels, MeasurementListener measurementListener)
          Adds the specified listener to receive listener notification and notify current value for all channels.
 void addMeasurementListener(MeasurementListener measurementListener)
          Adds the specified listener to receive listener notification and notify current value.
 void executeRead()
          Perform the executeRead action method.
 void executeRead(ChannelService channel)
          Execute read with the specified channel parameter.
 void executeWrite(ChannelService channel, java.lang.Object value)
          Execute write with the specified channel and value parameters.
 void executeWrite(java.lang.Object value)
          Perform the executeWrite action method.
protected  void fireErrorOccurred(MeasurementListener measurementListener, java.lang.Object timestamp, java.lang.Object data)
          Fire error occurred with the specified measurement listener, timestamp and data parameters.
 void fireErrorOccurred(java.lang.Object timestamp, java.lang.Object data)
          Fire error occurred with the specified timestamp and data parameters.
 void fireValueChanged(MeasurementListener measurementListener, java.lang.Object timestamp, ChannelService channel, java.lang.Object newValue, java.lang.Object oldValue)
          Fire value changed with the specified measurement listener, timestamp, channel, new value and old value parameters.
 void fireValueChanged(MeasurementListener measurementListener, java.lang.Object timestamp, java.lang.Object newValue, java.lang.Object oldValue)
          Fire value changed with the specified measurement listener, timestamp, new value and old value parameters.
 MeasurementListener getMeasurementListener()
          Gets the MeasurementListener measurementListener property value.
 java.lang.Object getTimestamp()
          Gets the Object timestamp property value.
 java.lang.Object getTimestamp(ChannelService channel)
          Get timestamp with the specified channel parameter and return the Object result.
 java.lang.String getTimestampKey()
          Gets the timestamp key (String) value.
 UnitsService getUnits()
          Gets the UnitsService units property value.
 java.lang.Object getValue()
          Gets the Object value property value.
 java.lang.Object getValue(ChannelService channel)
          Get value with the specified channel parameter and return the Object result.
 java.lang.Object getValueRaw()
           
 java.lang.Object getValueRaw(ChannelService channel)
          Get value raw with the specified channel parameter and return the Object result.
 java.lang.Object read(ChannelService channel, long timeout)
          Read with the specified channel and timeout parameters and return the Object result.
 java.lang.Object read(long timeout)
          Perform the read method and return the Object result.
 void removeMeasurementListener(MeasurementListener measurementListener)
          Removes the specified listener from receiving listener notification.
protected  void reportError(int errorNumber, java.lang.Throwable error, java.lang.Object[] errorObjects)
          Report error with the specified error number, error and error objects parameters.
 void setMeasurementListener(MeasurementListener measurementListener)
          Sets the measurementListener.
protected  void setRawValue(ChannelService channel, java.lang.Object data, java.lang.Object timestamp)
          Set raw value with the specified channel, data and timestamp parameters.
protected  void setRawValue(java.lang.Object data, java.lang.Object timestamp)
          Perform the setRawValue action method.
 void setTimestamp(ChannelService channel, java.lang.Object timestamp)
          Set timestamp with the specified channel and timestamp parameters.
 void setTimestamp(java.lang.Object timestamp)
          Sets the timestamp property.
 void setValue(ChannelService channel, java.lang.Object value)
          Set value with the specified channel and value parameters.
 void setValue(ChannelService channel, java.lang.Object value, java.lang.Object timestamp)
          Set value with the specified channel, value and timestamp parameters.
 void setValue(java.lang.Object value)
          This method forces a synchronous write of the locally cached value.
 void setValue(java.lang.Object value, java.lang.Object timestamp)
          Perform the setValue action method.
 
Methods inherited from class org.eclipse.soda.dk.device.Control
attemptRecoveryFromError, equalsValue, errorOccurred, findMethod, getCodeKey, getErrorSeverity, getKey, getQualifiedKey, getResource, setKey, setQualifiedKey, toString
 
Methods inherited from class org.eclipse.soda.dk.core.EscObject
createBoolean, createDefaultLogService, createException, createException, createInteger, createIntegerTable, createLong, createLongTable, createNumber, format, getBoolean, getByte, getChar, getConfigurationService, getCurrentTimestamp, getDefaultLogService, getDefaultResource, getDouble, getFloat, getId, getIdName, getInt, getLoadLibraryName, getLogDetails, getLogDetails, getLogDetails0, getLogDetails1, getLogDetails2, getLogDetails3, getLogDetails4, getLogDetails5, getLogDetails6, getLogDetails7, getLogLevel, getLogService, getLong, getObject, getOutputName, getReadOnlyEmptyCollection, getReadOnlyEmptyList, getReadOnlyEmptyMap, getShort, getSimpleClassName, getStaticBoolean, getStaticByte, getStaticChar, getStaticDouble, getStaticFloat, getStaticInt, getStaticLong, getStaticObject, getStaticShort, getStaticString, getString, getTraceLevel, getVmLibraryVersion, handleError, handleError, handleError, handleError, handleErrorInternal, handleStaticError, handleStaticException, isBackward, isDebug, isLogging, isTrace, isUnmodifiable, loadService, log, log, log, report, report, report, report, report, report, report, reportSystemInfo, setBackward, setDebug, setDefaultLogService, setLogService, setTraceLevel, setUnmodifiable, shouldLog, sleep, startupEscStatic, toStringConfigurationKeys, toStringInfo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.soda.dk.device.service.ControlService
getKey
 

Constructor Detail

Measurement

public Measurement(java.lang.String key)
Constructs an Measurement object using the input parameter(s).

Parameters:
key - The key (String) parameter.
See Also:
Measurement(String,Object)

Measurement

public Measurement(java.lang.String key,
                   java.lang.Object value)
Constructs an Measurement object using the input parameter(s).

Parameters:
key - The key (String) parameter.
value - The value (Object) parameter.
See Also:
Measurement(String)
Method Detail

addMeasurementListener

public void addMeasurementListener(java.util.Collection channels,
                                   MeasurementListener measurementListener)
Adds the specified listener to receive listener notification and notify current value for all channels.

Parameters:
channels - The channels (Collection) parameter.
measurementListener - The measurement listener (MeasurementListener) parameter.
Since:
1.2
See Also:
MeasurementService.addMeasurementListener(org.eclipse.soda.dk.measurement.service.MeasurementListener), addMeasurementListener(MeasurementListener), getMeasurementListener(), removeMeasurementListener(MeasurementListener), setMeasurementListener(MeasurementListener)

addMeasurementListener

public void addMeasurementListener(MeasurementListener measurementListener)
Adds the specified listener to receive listener notification and notify current value.

Specified by:
addMeasurementListener in interface MeasurementService
Parameters:
measurementListener - The measurement listener (MeasurementListener) parameter.
See Also:
MeasurementService.addMeasurementListener(org.eclipse.soda.dk.measurement.service.MeasurementListener), addMeasurementListener(Collection,MeasurementListener), getMeasurementListener(), removeMeasurementListener(MeasurementListener), setMeasurementListener(MeasurementListener)

executeRead

public void executeRead()
Perform the executeRead action method.

Specified by:
executeRead in interface MeasurementService
See Also:
MeasurementService.executeRead(), executeRead(ChannelService)

executeRead

public void executeRead(ChannelService channel)
Execute read with the specified channel parameter.

Specified by:
executeRead in interface MeasurementService
Parameters:
channel - The channel (ChannelService) parameter.
Since:
1.2
See Also:
executeRead()

executeWrite

public void executeWrite(ChannelService channel,
                         java.lang.Object value)
Execute write with the specified channel and value parameters.

Specified by:
executeWrite in interface MeasurementService
Parameters:
channel - The channel (ChannelService) parameter.
value - The value (Object) parameter.
Since:
1.2
See Also:
executeWrite(Object)

executeWrite

public void executeWrite(java.lang.Object value)
Perform the executeWrite action method.

Specified by:
executeWrite in interface MeasurementService
Parameters:
value - The value (Object) parameter.
See Also:
MeasurementService.executeWrite(org.eclipse.soda.dk.multiplex.connection.service.ChannelService, java.lang.Object), executeWrite(ChannelService,Object)

fireErrorOccurred

protected void fireErrorOccurred(MeasurementListener measurementListener,
                                 java.lang.Object timestamp,
                                 java.lang.Object data)
Fire error occurred with the specified measurement listener, timestamp and data parameters.

Parameters:
measurementListener - The measurement listener (MeasurementListener) parameter.
timestamp - The time stamp (Object) parameter.
data - The data (Object) parameter.
See Also:
fireErrorOccurred(Object,Object)

fireErrorOccurred

public void fireErrorOccurred(java.lang.Object timestamp,
                              java.lang.Object data)
Fire error occurred with the specified timestamp and data parameters.

Parameters:
timestamp - The time stamp (Object) parameter.
data - The data (Object) parameter.
See Also:
fireErrorOccurred(MeasurementListener,Object,Object)

fireValueChanged

public void fireValueChanged(MeasurementListener measurementListener,
                             java.lang.Object timestamp,
                             ChannelService channel,
                             java.lang.Object newValue,
                             java.lang.Object oldValue)
Fire value changed with the specified measurement listener, timestamp, channel, new value and old value parameters.

Parameters:
measurementListener - The measurement listener (MeasurementListener) parameter.
timestamp - The time stamp (Object) parameter.
channel - The channel (ChannelService) parameter.
newValue - The new value (Object) parameter.
oldValue - The old value (Object) parameter.
Since:
1.2
See Also:
fireValueChanged(MeasurementListener,Object,Object,Object)

fireValueChanged

public void fireValueChanged(MeasurementListener measurementListener,
                             java.lang.Object timestamp,
                             java.lang.Object newValue,
                             java.lang.Object oldValue)
Fire value changed with the specified measurement listener, timestamp, new value and old value parameters.

Parameters:
measurementListener - The measurement listener (MeasurementListener) parameter.
timestamp - The time stamp (Object) parameter.
newValue - The new value (Object) parameter.
oldValue - The old value (Object) parameter.
Since:
1.2
See Also:
fireValueChanged(MeasurementListener,Object,ChannelService,Object,Object)

getMeasurementListener

public MeasurementListener getMeasurementListener()
Gets the MeasurementListener measurementListener property value.

Returns:
Results of the get measurement listener (MeasurementListener) value.
Since:
1.2
See Also:
addMeasurementListener(Collection,MeasurementListener), addMeasurementListener(MeasurementListener), removeMeasurementListener(MeasurementListener), setMeasurementListener(MeasurementListener)

getTimestamp

public java.lang.Object getTimestamp()
Gets the Object timestamp property value.

Specified by:
getTimestamp in interface MeasurementService
Returns:
Results of the get timestamp (Object) value.
See Also:
MeasurementService.getTimestamp(), getTimestamp(ChannelService), setTimestamp(ChannelService,Object), setTimestamp(Object)

getTimestamp

public java.lang.Object getTimestamp(ChannelService channel)
Get timestamp with the specified channel parameter and return the Object result.

Specified by:
getTimestamp in interface MeasurementService
Parameters:
channel - The channel (ChannelService) parameter.
Returns:
Results of the get timestamp (Object) value.
Since:
1.2
See Also:
getTimestamp(), setTimestamp(ChannelService,Object), setTimestamp(Object)

getTimestampKey

public java.lang.String getTimestampKey()
Gets the timestamp key (String) value.

Returns:
The timestamp key (String) value.
Since:
1.2

getUnits

public UnitsService getUnits()
Gets the UnitsService units property value.

Returns:
Results of the get units (UnitsService) value.

getValue

public java.lang.Object getValue()
Gets the Object value property value.

Specified by:
getValue in interface MeasurementService
Returns:
Results of the get value (Object) value.
See Also:
MeasurementService.getValue(), getValue(ChannelService), setRawValue(ChannelService,Object,Object), setRawValue(Object,Object), setValue(ChannelService,Object), setValue(ChannelService,Object,Object), setValue(Object), setValue(Object,Object)

getValue

public java.lang.Object getValue(ChannelService channel)
Get value with the specified channel parameter and return the Object result.

Specified by:
getValue in interface MeasurementService
Parameters:
channel - The channel (ChannelService) parameter.
Returns:
Results of the get value (Object) value.
Since:
1.2
See Also:
getValue(), setRawValue(ChannelService,Object,Object), setRawValue(Object,Object), setValue(ChannelService,Object), setValue(ChannelService,Object,Object), setValue(Object), setValue(Object,Object)

getValueRaw

public java.lang.Object getValueRaw()
Returns:
The value raw (Object) value.
See Also:
getValueRaw(ChannelService)

getValueRaw

public java.lang.Object getValueRaw(ChannelService channel)
Get value raw with the specified channel parameter and return the Object result.

Parameters:
channel - The channel (ChannelService) parameter.
Returns:
Results of the get value raw (Object) value.
Since:
1.2
See Also:
getValueRaw()

read

public java.lang.Object read(ChannelService channel,
                             long timeout)
                      throws java.lang.RuntimeException
Read with the specified channel and timeout parameters and return the Object result.

Specified by:
read in interface MeasurementService
Parameters:
channel - The channel (ChannelService) parameter.
timeout - The timeout (long) parameter.
Returns:
Results of the read (Object) value.
Throws:
java.lang.RuntimeException - Runtime Exception.
Since:
1.2
See Also:
read(long)

read

public java.lang.Object read(long timeout)
Perform the read method and return the Object result.

Specified by:
read in interface MeasurementService
Parameters:
timeout - The timeout (long) parameter.
Returns:
Results of the read (Object) value.
See Also:
MeasurementService.read(org.eclipse.soda.dk.multiplex.connection.service.ChannelService, long), read(ChannelService,long)

removeMeasurementListener

public void removeMeasurementListener(MeasurementListener measurementListener)
Removes the specified listener from receiving listener notification.

Specified by:
removeMeasurementListener in interface MeasurementService
Parameters:
measurementListener - The measurement listener (MeasurementListener) parameter.
See Also:
MeasurementService.removeMeasurementListener(org.eclipse.soda.dk.measurement.service.MeasurementListener), addMeasurementListener(Collection,MeasurementListener), addMeasurementListener(MeasurementListener), getMeasurementListener(), setMeasurementListener(MeasurementListener)

reportError

protected void reportError(int errorNumber,
                           java.lang.Throwable error,
                           java.lang.Object[] errorObjects)
                    throws java.lang.RuntimeException
Report error with the specified error number, error and error objects parameters.

Overrides:
reportError in class EscObject
Parameters:
errorNumber - The error number (int) parameter.
error - The error (Throwable) parameter.
errorObjects - The error objects (Object[]) parameter.
Throws:
java.lang.RuntimeException - Runtime Exception.
See Also:
EscObject.handleStaticError(String), EscObject.attemptRecoveryFromError(int,Throwable), EscObject.handleError(Throwable,int), EscObject.handleError(Throwable,int,Object), EscObject.handleError(Throwable,int,Object,Object), EscObject.handleError(Throwable,int,Object[])

setMeasurementListener

public void setMeasurementListener(MeasurementListener measurementListener)
Sets the measurementListener.

Parameters:
measurementListener - The measurement listener (MeasurementListener) parameter.
See Also:
addMeasurementListener(Collection,MeasurementListener), addMeasurementListener(MeasurementListener), getMeasurementListener(), removeMeasurementListener(MeasurementListener)

setRawValue

protected void setRawValue(ChannelService channel,
                           java.lang.Object data,
                           java.lang.Object timestamp)
Set raw value with the specified channel, data and timestamp parameters.

Parameters:
channel - The channel (ChannelService) parameter.
data - The data (Object) parameter.
timestamp - The time stamp (Object) parameter.
Since:
1.2
See Also:
setRawValue(Object,Object)

setRawValue

protected void setRawValue(java.lang.Object data,
                           java.lang.Object timestamp)
Perform the setRawValue action method.

Parameters:
data - The data (Object) parameter.
timestamp - The time stamp (Object) parameter.
See Also:
setRawValue(ChannelService,Object,Object)

setTimestamp

public void setTimestamp(ChannelService channel,
                         java.lang.Object timestamp)
Set timestamp with the specified channel and timestamp parameters.

Parameters:
channel - The channel (ChannelService) parameter.
timestamp - The time stamp (Object) parameter.
Since:
1.2
See Also:
getTimestamp(), getTimestamp(ChannelService), setTimestamp(Object)

setTimestamp

public void setTimestamp(java.lang.Object timestamp)
Sets the timestamp property.

Parameters:
timestamp - The time stamp (Object) parameter.
See Also:
getTimestamp(), getTimestamp(ChannelService), setTimestamp(ChannelService,Object)

setValue

public void setValue(ChannelService channel,
                     java.lang.Object value)
Set value with the specified channel and value parameters.

Specified by:
setValue in interface MeasurementService
Parameters:
channel - The channel (ChannelService) parameter.
value - The value (Object) parameter.
Since:
1.2
See Also:
getValue(), getValue(ChannelService), setRawValue(ChannelService,Object,Object), setRawValue(Object,Object), setValue(ChannelService,Object,Object), setValue(Object), setValue(Object,Object)

setValue

public void setValue(ChannelService channel,
                     java.lang.Object value,
                     java.lang.Object timestamp)
Set value with the specified channel, value and timestamp parameters.

Parameters:
channel - The channel (ChannelService) parameter.
value - The value (Object) parameter.
timestamp - The time stamp (Object) parameter.
Since:
1.2
See Also:
getValue(), getValue(ChannelService), setRawValue(ChannelService,Object,Object), setRawValue(Object,Object), setValue(ChannelService,Object), setValue(Object), setValue(Object,Object)

setValue

public void setValue(java.lang.Object value)
This method forces a synchronous write of the locally cached value. This method should only be used for simulation and testing purposes, as it will insert false data into the measurement.

Specified by:
setValue in interface MeasurementService
Parameters:
value - The value (Object) parameter.
See Also:
getValue(), getValue(ChannelService), setRawValue(ChannelService,Object,Object), setRawValue(Object,Object), setValue(ChannelService,Object), setValue(ChannelService,Object,Object), setValue(Object,Object)

setValue

public void setValue(java.lang.Object value,
                     java.lang.Object timestamp)
Perform the setValue action method.

Parameters:
value - The value (Object) parameter.
timestamp - The time stamp (Object) parameter.
See Also:
getValue(), getValue(ChannelService), setRawValue(ChannelService,Object,Object), setRawValue(Object,Object), setValue(ChannelService,Object), setValue(ChannelService,Object,Object), setValue(Object)

2009-01-09 1.2.0

Copyright (c) 2009 IBM. See license in Legal section.