1.0.0

org.eclipse.soda.dk.device
Class Device

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.device.Container
              extended by org.eclipse.soda.dk.device.Device
All Implemented Interfaces:
java.lang.Runnable, ControlService, DeviceService, ErrorListener
Direct Known Subclasses:
Adapter, BaseDevice, DeviceRegistry, Profile, TestDevice, TransportDevice

public class Device
extends Container
implements DeviceService, java.lang.Runnable

The Device class implements the DeviceService interface.

Version:
1.0.0
See Also:
Container, Control, ControlService, ErrorListener, Hashtable, MessageHandler, TransportListener

Field Summary
static java.lang.String POLL_COMMAND_NAME
          Define the poll command name (String) constant.
static java.lang.String START_COMMAND_NAME
          Define the start command name (String) constant.
protected static int STARTED_MASK
          Define the started (int) constant.
static java.lang.String STOP_COMMAND_NAME
          Define the stop command name (String) constant.
 
Fields inherited from class org.eclipse.soda.dk.device.Container
capabilities, configuration, DEVICE_ACTIVE_STATE_RESOURCE, DEVICE_ALIVE_STATE_RESOURCE, DEVICE_CHANGED_EXCEPTION_RESOURCE, DEVICE_CONNECTED_STATE_RESOURCE, DEVICE_CREATED_STATE_RESOURCE, DEVICE_DEAD_STATE_RESOURCE, DEVICE_STARTED_STATE_RESOURCE, DEVICE_STATE_RESOURCE_TABLE, EXCEPTION_NO_TRANSPORT_RESOURCE, INITIALIZE_CONFIGURATION_EXCEPTION_RESOURCE, INITIALIZE_CONFIGURATION_MISCOMPARE_RESOURCE, INITIALIZE_CONFIGURATION_RESOURCE, INITIALIZE_CONFIGURATION_SAME_RESOURCE, INITIALIZE_READ_EXCEPTION_RESOURCE, INITIALIZE_WRITE_EXCEPTION_RESOURCE, MESSAGE_RECEIVED_EXCEPTION_RESOURCE, PROCESSING_UNABLE_TO_KEEP_UP_EXCEPTION_RESOURCE, RUN_EXCEPTION_RESOURCE, SEND_EXCEPTION_RESOURCE, stateChanaged, status, TOPIC_DELIMITER
 
Fields inherited from class org.eclipse.soda.dk.device.Control
EXCEPTION_READ_FAILED_RESOURCE, SETVALUEEXCEPTION_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, INTEGER_TABLE, KEY_KEY, LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_TRACE, LOG_WARNING, PREFIX_KEY, 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
 
Fields inherited from interface org.eclipse.soda.dk.device.service.DeviceService
ACTIVE, ALIVE, ALL_COMMANDS, ALL_MEASUREMENTS, ALL_SIGNALS, AUTOSTART, BLOCKPROCESSING, Capabilities, CAPABILITIES_EXTERNAL_KEY, CAPABILITIES_GET_EXTERNAL_KEY, CAPABILITIES_READ_EXTERNAL_KEY, CAPABILITIES_WRITE_EXTERNAL_KEY, Configuration, CONFIGURATION_DATA_KEY, CONFIGURATION_EXTERNAL_KEY, CONFIGURATION_GET_EXTERNAL_KEY, CONFIGURATION_READ_EXTERNAL_KEY, CONFIGURATION_WRITE_EXTERNAL_KEY, CONNECTED, CREATED, DEAD, ERROR_EXTERNAL_KEY, EVENPROCESSING, EXECUTE_EXTERNAL_KEY, GET_EXTERNAL_KEY, INITIALIZEMEASUREMENTS, KEYS_DATA_KEY, NULL, READ_EXTERNAL_KEY, RECEIVED_KEY_DATA_KEY, SERVICE_NAME, SET_EXTERNAL_KEY, SOURCE_DATA_KEY, STARTED, STATE_DATA_KEY, STATE_OLD_DATA_KEY, Status, STATUS_EXTERNAL_KEY, STATUS_GET_EXTERNAL_KEY, STATUS_READ_EXTERNAL_KEY, STATUS_WRITE_EXTERNAL_KEY, TIMESTAMP_DATA_KEY, TRIGGER_EXTERNAL_KEY, VALUE_DATA_KEY, VALUE_OLD_DATA_KEY, WRITE_EXTERNAL_KEY
 
Constructor Summary
Device()
          Constructs a Device object.
 
Method Summary
 void addDeviceListener(DeviceListener deviceListener)
          Add device listener with the specified device listener parameter.
 void controlAdded(Container container, java.lang.Object currentTimestamp, ControlService control)
          Control added with the specified container, current timestamp and control parameters.
 void controlRemoved(Container container, java.lang.Object timestamp, ControlService control)
          Control removed with the specified container, timestamp and control parameters.
protected  void finalize()
          Perform the finalize action method.
 void fireContainerChanged(java.lang.Object timestamp, int newState, int oldState)
          Fire container changed with the specified timestamp, new state and old state parameters.
 void fireErrorOccurred(java.lang.Object timestamp, java.lang.Object data)
          Perform the fireErrorOccurred action method.
 MeasurementService getCapabilities()
          Defines the Capabilities measurement.
 MeasurementService getConfiguration()
          Defines the Configuration measurement.
 java.lang.String getDefaultKey()
          Method getDefaultKey.
 DeviceListener getDeviceListener()
          Gets the device listener value.
 int getMessageCapacity()
          Gets the message capacity.
 java.lang.Object getMessageKey(MessageService message)
          Gets the message key.
 int getPriority()
          Gets the int priority property value.
 long getReadTimeout()
          Gets the read timeout (long) value.
 MeasurementService getStatus()
          Defines the Status measurement.
 java.lang.Thread getThread()
          Gets the thread value.
 boolean hasListeners()
          Gets the listeners (boolean) value.
 boolean isAutoStart()
          Gets the boolean autoStart property value.
 boolean isBlockProcessing()
          Gets the block processing (boolean) value.
 boolean isEvenProcessing()
          Gets the even processing (boolean) value.
 boolean isRunning()
          Gets the running (boolean) value.
 boolean isStarted()
          Gets the started (boolean) value.
 boolean isThreadNeeded()
          Gets the thread needed (boolean) value.
protected  void load(ControlService control)
          Perform the load action method.
 void put(java.lang.String key, ControlService control)
          Put with the specified key and control parameters.
 void remove(java.lang.String key)
          Remove with the specified key parameter.
 void removeDeviceListener(DeviceListener deviceListener)
          Remove device listener with the specified device listener parameter.
 void restart()
          Restart.
 void run()
          Run.
 void setDeviceListener(DeviceListener deviceListener)
          Sets the device listener value.
 void setReadTimeout(long readTimeout)
          Sets the read timeout value.
 void setRunning(boolean running)
          Set the running status.
 void setStarted(boolean started)
          Sets the started property.
 void setThread(java.lang.Thread thread)
          Sets the thread value.
 void start()
          Perform the start action method.
 void startup(boolean output)
          Startup with the specified output parameter.
 void stop()
          Perform the stop action method.
 
Methods inherited from class org.eclipse.soda.dk.device.Container
activate, addQualifiedKeys, attemptRecoveryFromError, broadcast, broadcastStatus, broadcastStatus, changeIds, createFilter, deactivate, elements, errorOccurred, exit, get, getBundleContext, getCommand, getConfigurationInformation, getConfigurationInformation, getConfigurationService, getControlCapacity, getControls, getDefaultStyle, getErrorSeverity, getId, getInformation, getLogDetails4, getLogDetails5, getLogDetails6, getMeasurement, getNotificationController, getNotificationService, getPrefix, getSignal, getState, getStatusDictionary, getString, getStyle, getTransport, initializeMeasurements, isInitializeMeasurements, keys, notificationReceived, prependPrefix, prependPrefix, put, putConfigurationInformation, register, register, removeListeners, removeQualifiedKeys, send, setBundleContext, setConfigurationInformation, setInformation, setListenersNull, setNotificationController, setNotificationService, setState, setStyle, setTransport, setup, setupCustom, setupNotification, setupNotificationCustom, startupCommands, toString, toStringInfo, transportStartedWait, unregister, unsubscribe
 
Methods inherited from class org.eclipse.soda.dk.device.Control
equalsValue, getCodeKey, getKey, getQualifiedKey, getResource, setKey, setQualifiedKey
 
Methods inherited from class org.eclipse.soda.dk.core.EscObject
createDefaultLogService, createException, createException, createInteger, createIntegerTable, createNumber, format, getBoolean, getCurrentTimestamp, getDefaultLogService, getDefaultResource, getFloat, getInt, getLoadLibraryName, getLogDetails, getLogDetails0, getLogDetails1, getLogDetails2, getLogDetails3, getLogDetails7, getLogService, getLong, getObject, getOutputName, getSimpleClassName, getStaticBoolean, getStaticFloat, getStaticInt, getStaticLong, getStaticObject, getStaticString, getTraceLevel, getVmLibraryVersion, handleError, handleError, handleError, handleStaticError, handleStaticException, isDebug, isTrace, loadService, log, log, report, report, report, report, report, report, reportError, reportSystemInfo, setDebug, setDefaultLogService, setLogService, setTraceLevel, shouldLog, sleep, startupEscStatic, toStringConfigurationKeys
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.soda.dk.device.service.DeviceService
elements, exit, get, getCommand, getConfigurationInformation, getMeasurement, getNotificationService, getSignal, getState, getTransport, send, setConfigurationInformation, setNotificationService, setTransport
 
Methods inherited from interface org.eclipse.soda.dk.device.service.ControlService
getKey
 

Field Detail

START_COMMAND_NAME

public static final java.lang.String START_COMMAND_NAME
Define the start command name (String) constant.

See Also:
Constant Field Values

STOP_COMMAND_NAME

public static final java.lang.String STOP_COMMAND_NAME
Define the stop command name (String) constant.

See Also:
Constant Field Values

POLL_COMMAND_NAME

public static final java.lang.String POLL_COMMAND_NAME
Define the poll command name (String) constant.

See Also:
Constant Field Values

STARTED_MASK

protected static final int STARTED_MASK
Define the started (int) constant.

See Also:
Constant Field Values
Constructor Detail

Device

public Device()
Constructs a Device object.

Method Detail

addDeviceListener

public void addDeviceListener(DeviceListener deviceListener)
Add device listener with the specified device listener parameter. The device listener (DeviceListener) parameter.

Specified by:
addDeviceListener in interface DeviceService
Parameters:
deviceListener - The device listener (DeviceListener) parameter.
See Also:
getDeviceListener(), removeDeviceListener(DeviceListener), setDeviceListener(DeviceListener)

controlAdded

public void controlAdded(Container container,
                         java.lang.Object currentTimestamp,
                         ControlService control)
Control added with the specified container, current timestamp and control parameters. The container (Container) parameter. The current timestamp (Object) parameter. The control (ControlService) parameter.

Parameters:
container - The container (Container) parameter.
currentTimestamp - The current timestamp (Object) parameter.
control - The control (ControlService) parameter.

controlRemoved

public void controlRemoved(Container container,
                           java.lang.Object timestamp,
                           ControlService control)
Control removed with the specified container, timestamp and control parameters. The container (Container) parameter. The timestamp (Object) parameter. The control (ControlService) parameter.

Parameters:
container - The container (Container) parameter.
timestamp - The timestamp (Object) parameter.
control - The control (ControlService) parameter.

finalize

protected void finalize()
                 throws java.lang.Throwable
Perform the finalize action method. href="java.lang.Throwable.html">Throwable Thrown if the Throwable exception condition occurs.

Overrides:
finalize in class java.lang.Object
Throws:
Throwable.
java.lang.Throwable

fireContainerChanged

public void fireContainerChanged(java.lang.Object timestamp,
                                 int newState,
                                 int oldState)
Fire container changed with the specified timestamp, new state and old state parameters. The timestamp (Object) parameter. The new state (int) parameter. The old state (int) parameter.

Overrides:
fireContainerChanged in class Container
Parameters:
timestamp - The timestamp (Object) parameter.
newState - The new state (int) parameter.
oldState - The old state (int) parameter.

fireErrorOccurred

public void fireErrorOccurred(java.lang.Object timestamp,
                              java.lang.Object data)
Perform the fireErrorOccurred action method. java.lang.Object java.lang.Object The timestamp (Object) parameter. The data (Object) parameter.

Overrides:
fireErrorOccurred in class Container
Parameters:
timestamp - The timestamp (Object) parameter.
data - The data (Object) parameter.

getCapabilities

public MeasurementService getCapabilities()
Defines the Capabilities measurement.

Overrides:
getCapabilities in class Container
Returns:
Results of the get capabilities (MeasurementService) value.

getConfiguration

public MeasurementService getConfiguration()
Defines the Configuration measurement.

Overrides:
getConfiguration in class Container
Returns:
Results of the get configuration (MeasurementService) value.

getDefaultKey

public java.lang.String getDefaultKey()
Description copied from class: Container
Method getDefaultKey.

Specified by:
getDefaultKey in class Container
Returns:
Results of the get default key (String) value.
See Also:
Container.getDefaultKey()

getDeviceListener

public DeviceListener getDeviceListener()
Gets the device listener value.

Returns:
The device listener (DeviceListener) value.
See Also:
addDeviceListener(DeviceListener), removeDeviceListener(DeviceListener), setDeviceListener(DeviceListener)

getMessageCapacity

public int getMessageCapacity()
Gets the message capacity.

Returns:
int The message capacity.

getMessageKey

public java.lang.Object getMessageKey(MessageService message)
Gets the message key. The message (MessageService) parameter.

Parameters:
message - The message (MessageService) parameter.
Returns:
Results of the get message key (Object) value. The message (MessageService) parameter.

getPriority

public int getPriority()
Gets the int priority property value.

Return the priority of the thread.

Returns:
int The thread priority

getReadTimeout

public long getReadTimeout()
Gets the read timeout (long) value.

Overrides:
getReadTimeout in class Container
Returns:
The read timeout (long) value.
See Also:
setReadTimeout(long)

getStatus

public MeasurementService getStatus()
Defines the Status measurement.

Overrides:
getStatus in class Container
Returns:
Results of the get status (MeasurementService) value.
See Also:
Container.broadcastStatus(), Container.broadcastStatus(Object,int,int)

getThread

public java.lang.Thread getThread()
Gets the thread value.

Returns:
The thread (Thread) value.
See Also:
setThread(Thread)

hasListeners

public boolean hasListeners()
Gets the listeners (boolean) value.

Returns:
The listeners (boolean) value.

isAutoStart

public boolean isAutoStart()
Gets the boolean autoStart property value.

Returns:
Results of the is auto start (boolean) value.

isBlockProcessing

public boolean isBlockProcessing()
Gets the block processing (boolean) value.

Returns:
The block processing (boolean) value.

isEvenProcessing

public boolean isEvenProcessing()
Gets the even processing (boolean) value.

Returns:
The even processing (boolean) value.

isRunning

public boolean isRunning()
Gets the running (boolean) value.

Overrides:
isRunning in class Container
Returns:
The running (boolean) value.
See Also:
setRunning(boolean)

isStarted

public boolean isStarted()
Gets the started (boolean) value.

Specified by:
isStarted in interface DeviceService
Returns:
The started (boolean) value.
See Also:
setStarted(boolean)

isThreadNeeded

public boolean isThreadNeeded()
Gets the thread needed (boolean) value.

Returns:
The thread needed (boolean) value.

load

protected void load(ControlService control)
Perform the load action method. org.eclipse.soda.dk.device.service.ControlService The control (ControlService) parameter.

Overrides:
load in class Container
Parameters:
control - The control (ControlService) parameter.

put

public void put(java.lang.String key,
                ControlService control)
Put with the specified key and control parameters. The key (String) parameter. The control (ControlService) parameter.

Specified by:
put in interface DeviceService
Overrides:
put in class Container
Parameters:
key - The key (String) parameter.
control - The control (ControlService) parameter.
See Also:
Container.put(ControlService)

remove

public void remove(java.lang.String key)
Remove with the specified key parameter. The key (String) parameter.

Specified by:
remove in interface DeviceService
Overrides:
remove in class Container
Parameters:
key - The key (String) parameter.

removeDeviceListener

public void removeDeviceListener(DeviceListener deviceListener)
Remove device listener with the specified device listener parameter. The device listener (DeviceListener) parameter.

Specified by:
removeDeviceListener in interface DeviceService
Parameters:
deviceListener - The device listener (DeviceListener) parameter.
See Also:
addDeviceListener(DeviceListener), getDeviceListener(), setDeviceListener(DeviceListener)

restart

public void restart()
Restart.


run

public void run()
Run.

Specified by:
run in interface java.lang.Runnable

setDeviceListener

public void setDeviceListener(DeviceListener deviceListener)
Sets the device listener value. The device listener (DeviceListener) parameter.

Parameters:
deviceListener - The device listener (DeviceListener) parameter.
See Also:
addDeviceListener(DeviceListener), getDeviceListener(), removeDeviceListener(DeviceListener)

setReadTimeout

public void setReadTimeout(long readTimeout)
Sets the read timeout value. The read timeout (long) parameter. The read timeout (long) parameter.

Parameters:
readTimeout - The read timeout (long) parameter.
See Also:
getReadTimeout()

setRunning

public void setRunning(boolean running)
Set the running status. The running (boolean) parameter. The running (boolean) parameter.

Parameters:
running - The running (boolean) parameter.
See Also:
isRunning()

setStarted

public void setStarted(boolean started)
Sets the started property. The new property value (boolean). The started (boolean) parameter.

Parameters:
started - The started (boolean) parameter.
See Also:
isStarted()

setThread

public void setThread(java.lang.Thread thread)
Sets the thread value. The thread (Thread) parameter. The thread (Thread) parameter.

Parameters:
thread - The thread (Thread) parameter.
See Also:
getThread()

start

public void start()
Perform the start action method.

Specified by:
start in interface DeviceService
Overrides:
start in class Container
See Also:
DeviceService.start()

startup

public void startup(boolean output)
Startup with the specified output parameter. The output (boolean) parameter. The output (boolean) parameter.

Parameters:
output - The output (boolean) parameter.

stop

public void stop()
Perform the stop action method.

Specified by:
stop in interface DeviceService
Overrides:
stop in class Container
See Also:
DeviceService.stop()

1.0.0

Copyright (c) 1999, 2007 IBM