2008-02-07 1.1.0

org.eclipse.soda.dk.adapter
Class Adapter

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
                  extended by org.eclipse.soda.dk.adapter.Adapter
All Implemented Interfaces:
java.lang.Runnable, AdapterService, CommandListener, ControlService, DeviceListener, DeviceService, MeasurementListener, SignalListener, ErrorListener
Direct Known Subclasses:
DeviceAdapter, TestAdapter

public class Adapter
extends Device
implements AdapterService, CommandListener, SignalListener, MeasurementListener, DeviceListener

Version:
1.1.0

Field Summary
 
Fields inherited from class org.eclipse.soda.dk.device.Device
POLL_COMMAND_NAME, START_COMMAND_NAME, STARTED_MASK, STOP_COMMAND_NAME
 
Fields inherited from class org.eclipse.soda.dk.device.Container
broadcastCommandCount, broadcastMeasurementCount, broadcastSignalCount, 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, metrics, 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, INTEGER_TABLE_SIZE, 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.adapter.service.AdapterService
ALL_COMMANDS, ALL_MEASUREMENTS, ALL_SIGNALS, Capabilities, CAPABILITIES_EXTERNAL_KEY, CAPABILITIES_GET_EXTERNAL_KEY, CAPABILITIES_READ_EXTERNAL_KEY, CAPABILITIES_WRITE_EXTERNAL_KEY, Configuration, CONFIGURATION_EXTERNAL_KEY, CONFIGURATION_GET_EXTERNAL_KEY, CONFIGURATION_READ_EXTERNAL_KEY, CONFIGURATION_WRITE_EXTERNAL_KEY, SERVICE_NAME, Status, STATUS_EXTERNAL_KEY, STATUS_GET_EXTERNAL_KEY, STATUS_READ_EXTERNAL_KEY, STATUS_WRITE_EXTERNAL_KEY
 
Fields inherited from interface org.eclipse.soda.dk.device.service.DeviceService
ACTIVE, ALIVE, AUTOSTART, BLOCKPROCESSING, BROADCAST_COMMAND_COUNT_DATA_KEY, BROADCAST_MEASUREMENT_COUNT_DATA_KEY, BROADCAST_SIGNAL_COUNT_DATA_KEY, CONFIGURATION_DATA_KEY, CONNECTED, CREATED, DEAD, ERROR_EXTERNAL_KEY, EVENPROCESSING, EXECUTE_EXTERNAL_KEY, GET_EXTERNAL_KEY, INITIALIZEMEASUREMENTS, KEYS_DATA_KEY, Metrics, METRICS_EXTERNAL_KEY, METRICS_GET_EXTERNAL_KEY, NULL, READ_EXTERNAL_KEY, RECEIVED_KEY_DATA_KEY, SET_EXTERNAL_KEY, SOURCE_DATA_KEY, STARTED, STATE_DATA_KEY, STATE_OLD_DATA_KEY, TIMESTAMP_DATA_KEY, TRIGGER_EXTERNAL_KEY, VALUE_DATA_KEY, VALUE_OLD_DATA_KEY, WRITE_EXTERNAL_KEY
 
Fields inherited from interface org.eclipse.soda.dk.device.service.DeviceListener
ADDED, CHANGED, REMOVED
 
Constructor Summary
Adapter()
          Constructs an instance of this class.
 
Method Summary
 void addProfile(ProfileService profile)
           
 void commandExecuted(CommandService source, java.lang.Object timestamp, java.lang.Object data)
          This method is fired to all Listeners each time the command is executed.
 void controlChanged(DeviceService container, java.lang.Object timestamp, ControlService control, int code)
          The controlChanged method is called when a control was changed.
 void deviceChanged(DeviceService source, java.lang.Object timestamp, int newState, int oldState)
          This method will be called when the state of the DeviceService changes.
 void deviceChangedCustom(DeviceService source, java.lang.Object timestamp, int newState, int oldState)
           
 void exit()
          Exit.
 DeviceService getDefaultDevice()
          Gets the default device (DeviceService) value.
 DeviceService getDevice()
          Gets the device (DeviceService) value.
 java.lang.Object getLogDetails6()
          Gets the log details6 (Object) value.
 java.util.Map getProfiles()
          Gets the profiles (Map) value.
 java.lang.String getResource(int resourceId)
          Gets the string resource using the supplied resourceId.
 TransportService getTransport()
          Gets the transport (TransportService) value.
 void initializeCommand(CommandService command)
           
 void initializeMeasurement(MeasurementService measurement)
          Initialize measurement with the specified measurement parameter.
 void initializeSignal(SignalService signal)
           
 void measurementChanged(MeasurementService source, java.lang.Object timestamp, java.lang.Object newValue, java.lang.Object oldValue)
          This method is fired to all Listeners each time the value of the measurement changes.
 void removeProfile(ProfileService profile)
           
 void setDevice(DeviceService device)
           
 void setDeviceCustom(DeviceService device)
           
 void setProfiles(java.util.Map profiles)
           
 void setState(int state)
          The state (int) parameter.
 void setup()
          Setup.
 void signalOccurred(SignalService source, java.lang.Object timestamp, java.lang.Object data)
          This method is fired to all Listeners each time the signal triggerred.
 
Methods inherited from class org.eclipse.soda.dk.device.Device
addDeviceListener, controlAdded, controlRemoved, finalize, fireContainerChanged, fireErrorOccurred, getCapabilities, getConfiguration, getDefaultKey, getDeviceListener, getMessageCapacity, getMessageKey, getPriority, getReadTimeout, getStatus, getThread, hasListeners, isAutoStart, isBlockProcessing, isEvenProcessing, isRunning, isStarted, isThreadNeeded, load, put, remove, removeDeviceListener, restart, run, setDeviceListener, setReadTimeout, setRunning, setStarted, setThread, start, startup, stop
 
Methods inherited from class org.eclipse.soda.dk.device.Container
activate, addQualifiedKeys, attemptRecoveryFromError, broadcast, broadcastStatus, broadcastStatus, changeIds, collectMetrics, createFilter, deactivate, elements, errorOccurred, get, getBroadcastCommandCount, getBroadcastMeasurementCount, getBroadcastSignalCount, getBundleContext, getCommand, getConfigurationInformation, getConfigurationInformation, getConfigurationService, getControlCapacity, getControls, getDefaultStyle, getErrorSeverity, getId, getInformation, getLogDetails4, getLogDetails5, getMeasurement, getMetrics, getNotificationController, getNotificationService, getPrefix, getSignal, getState, getStatusDictionary, getString, getStyle, handleMethodMetrics, initializeMeasurements, isInitializeMeasurements, keys, notificationReceived, prependPrefix, prependPrefix, put, putConfigurationInformation, register, register, removeListeners, removeQualifiedKeys, send, setBroadcastCommandCount, setBroadcastMeasurementCount, setBroadcastSignalCount, setBundleContext, setConfigurationInformation, setInformation, setListenersNull, setMetrics, setNotificationController, setNotificationService, setStyle, setTransport, setupCustom, setupNotification, setupNotificationCustom, startupCommands, toString, toStringInfo, transportStartedWait, unregister, unsubscribe, updateBroadcastCommandCount, updateBroadcastMeasurementCount, updateBroadcastSignalCount, validConfigurationId
 
Methods inherited from class org.eclipse.soda.dk.device.Control
equalsValue, findMethod, getCodeKey, getKey, getQualifiedKey, 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, handleErrorInternal, 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
addDeviceListener, elements, get, getCommand, getConfigurationInformation, getMeasurement, getNotificationService, getSignal, getState, isStarted, put, remove, removeDeviceListener, send, setConfigurationInformation, setNotificationService, setTransport, start, stop
 
Methods inherited from interface org.eclipse.soda.dk.device.service.ControlService
getKey
 
Methods inherited from interface org.eclipse.soda.dk.transport.service.ErrorListener
errorOccurred
 
Methods inherited from interface org.eclipse.soda.dk.transport.service.ErrorListener
errorOccurred
 
Methods inherited from interface org.eclipse.soda.dk.transport.service.ErrorListener
errorOccurred
 
Methods inherited from interface org.eclipse.soda.dk.transport.service.ErrorListener
errorOccurred
 

Constructor Detail

Adapter

public Adapter()
Constructs an instance of this class.

Method Detail

addProfile

public void addProfile(ProfileService profile)
Parameters:
profile - The profile (ProfileService) parameter.
See Also:
removeProfile(ProfileService)

commandExecuted

public void commandExecuted(CommandService source,
                            java.lang.Object timestamp,
                            java.lang.Object data)
Description copied from interface: CommandListener
This method is fired to all Listeners each time the command is executed. Since other notifications are blocked until this method returns, implementors of this method should:

Specified by:
commandExecuted in interface CommandListener
Parameters:
source - The source (CommandService) parameter.
timestamp - The timestamp (Object) parameter.
data - The data (Object) parameter.

controlChanged

public void controlChanged(DeviceService container,
                           java.lang.Object timestamp,
                           ControlService control,
                           int code)
Description copied from interface: DeviceListener
The controlChanged method is called when a control was changed. A notification method to all DeviceListeners that a ControlService, specified by the control argument, and contained within the DeviceService, specified in the device arguement, was Added, Removed, or Modified, specified by the code argument in accordance with the above constants, at the time specified by the timestamp argument. In English : A control of the DeviceService was changed in the following manner at this time. Since other notifications are blocked until this method returns, implementors of this method should:

Specified by:
controlChanged in interface DeviceListener
Parameters:
container - The container (DeviceService) parameter.
timestamp - The timestamp (Object) parameter.
control - The control (ControlService) parameter.
code - The code (int) parameter.
See Also:
deviceChanged(DeviceService,Object,int,int), measurementChanged(MeasurementService,Object,Object,Object)

deviceChanged

public void deviceChanged(DeviceService source,
                          java.lang.Object timestamp,
                          int newState,
                          int oldState)
Description copied from interface: DeviceListener
This method will be called when the state of the DeviceService changes. Since other notifications are blocked until this method returns, implementors of this method should: Because of the multiple threads and quickly changing states, the current state of the device may not be the same as the newState input parameter.

Specified by:
deviceChanged in interface DeviceListener
Parameters:
source - The source (DeviceService) parameter.
timestamp - The timestamp (Object) parameter.
newState - The new state (int) parameter.
oldState - The old state (int) parameter.
See Also:
controlChanged(DeviceService,Object,ControlService,int), measurementChanged(MeasurementService,Object,Object,Object)

deviceChangedCustom

public void deviceChangedCustom(DeviceService source,
                                java.lang.Object timestamp,
                                int newState,
                                int oldState)
Parameters:
source - The source (DeviceService) parameter.
timestamp - The timestamp (Object) parameter.
newState - The new state (int) parameter.
oldState - The old state (int) parameter.

exit

public void exit()
Exit.

Specified by:
exit in interface DeviceService
Overrides:
exit in class Container

getDefaultDevice

public DeviceService getDefaultDevice()
Gets the default device (DeviceService) value.

Returns:
The default device (DeviceService) value.

getDevice

public DeviceService getDevice()
Gets the device (DeviceService) value.

Specified by:
getDevice in interface AdapterService
Returns:
The device (DeviceService) value.
See Also:
getDefaultDevice(), setDevice(DeviceService)

getLogDetails6

public java.lang.Object getLogDetails6()
Gets the log details6 (Object) value.

Overrides:
getLogDetails6 in class Container
Returns:
The log details6 (Object) value.

getProfiles

public java.util.Map getProfiles()
Gets the profiles (Map) value.

Returns:
The profiles (Map) value.
See Also:
setProfiles(Map)

getResource

public java.lang.String getResource(int resourceId)
Description copied from class: Control
Gets the string resource using the supplied resourceId.

Overrides:
getResource in class Control
Parameters:
resourceId - The resource id (int) parameter.
Returns:
Results of the get resource (String) value.
See Also:
EscObject.getDefaultResource(int)

getTransport

public TransportService getTransport()
Gets the transport (TransportService) value.

Specified by:
getTransport in interface DeviceService
Overrides:
getTransport in class Container
Returns:
The transport (TransportService) value.
See Also:
Container.setTransport(TransportService)

initializeCommand

public void initializeCommand(CommandService command)
Parameters:
command - The command (CommandService) parameter.

initializeMeasurement

public void initializeMeasurement(MeasurementService measurement)
Initialize measurement with the specified measurement parameter. The measurement (MeasurementService) parameter. The measurement (MeasurementService) parameter.

Parameters:
measurement - The measurement (MeasurementService) parameter.

initializeSignal

public void initializeSignal(SignalService signal)
Parameters:
signal - The signal (SignalService) parameter.

measurementChanged

public void measurementChanged(MeasurementService source,
                               java.lang.Object timestamp,
                               java.lang.Object newValue,
                               java.lang.Object oldValue)
Description copied from interface: MeasurementListener
This method is fired to all Listeners each time the value of the measurement changes. Since other notifications are blocked until this method returns, implementors of this method should:

Specified by:
measurementChanged in interface MeasurementListener
Parameters:
source - The source (MeasurementService) parameter.
timestamp - The timestamp (Object) parameter.
newValue - The new value (Object) parameter.
oldValue - The old value (Object) parameter.
See Also:
controlChanged(DeviceService,Object,ControlService,int), deviceChanged(DeviceService,Object,int,int)

removeProfile

public void removeProfile(ProfileService profile)
Parameters:
profile - The profile (ProfileService) parameter.
See Also:
addProfile(ProfileService)

setDevice

public void setDevice(DeviceService device)
Specified by:
setDevice in interface AdapterService
Parameters:
device - The device (DeviceService) parameter.
See Also:
getDefaultDevice(), getDevice()

setDeviceCustom

public void setDeviceCustom(DeviceService device)
Parameters:
device - The device (DeviceService) parameter.

setProfiles

public void setProfiles(java.util.Map profiles)
Parameters:
profiles - The profiles (Map) parameter.
See Also:
getProfiles()

setState

public void setState(int state)
Description copied from class: Container
The state (int) parameter. The state (int) parameter.

Overrides:
setState in class Container
Parameters:
state - The state (int) parameter.
See Also:
Container.getState()

setup

public void setup()
Setup.

Overrides:
setup in class Container

signalOccurred

public void signalOccurred(SignalService source,
                           java.lang.Object timestamp,
                           java.lang.Object data)
Description copied from interface: SignalListener
This method is fired to all Listeners each time the signal triggerred. The signal can be triggered when a message is recevied from the hardware or when the trigger method is invoked by the application. Since other notifications are blocked until this method returns, implementors of this method should:

Specified by:
signalOccurred in interface SignalListener
Parameters:
source - The source (SignalService) parameter.
timestamp - The timestamp (Object) parameter.
data - The data (Object) parameter.

2008-02-07 1.1.0

Copyright (c) 1999, 2008 IBM and others. See license in Legal section. OSGi Framework Version 3.3.1.R33x_v20070828