1.0.0

org.eclipse.soda.dk.device
Class TransportDevice

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.device.TransportDevice
All Implemented Interfaces:
java.lang.Runnable, ControlService, DeviceService, ErrorListener, MessageListener, TransportListener
Direct Known Subclasses:
QueueDevice, ThreadDevice

public abstract class TransportDevice
extends Device
implements TransportListener

The TransportDevice class implements the DeviceService interface.

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

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
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
TransportDevice()
          Constructs an TransportDevice object.
 
Method Summary
 void errorOccurred(java.lang.Object source, java.lang.Object timestamp, java.lang.Object data)
          The errorOccurred method is called when an error has occurred.
 void exit()
          Exit.
abstract  TransportService getDefaultTransport()
          Gets the default transport (TransportService) value.
 InterestService getInterest()
          Gets the interest filter for the device.
 java.util.Hashtable getMessageListeners()
          Gets the Hashtable messageHandlers property value.
 TransportService getTransport()
          Gets the Transport transport property value.
protected  void load(ControlService control)
          Perform the load action method.
 void messageReceived(TransportService transportService, java.lang.Object timestamp, MessageService message)
          This API will be called each time the TransportService receives a valid message.
 void register(TransportService transport)
          Register with the specified transport parameter.
 void registerMessageHandler(MessageService[] messages, MessageHandler value)
          Perform the registerMessageHandler action method.
 void registerMessageHandler(MessageService message, MessageHandler value)
          Register message handler with the specified message and value parameters.
 void send(MessageService message)
          Perform the send action method.
 void setState(int state)
          Sets the state value.
 void setTransport(TransportService transport)
          Sets the transport property.
 void setup()
          Method setup.
 void start()
          Perform the start action method.
 void stop()
          Perform the stop action method.
 void transportChanged(TransportService transportService, java.lang.Object timestamp, int newState, int oldState)
          This method will be called when the state of the TransportService changes.
 void unregister(TransportService transport)
          Unregister with the specified transport parameter.
 
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, put, remove, removeDeviceListener, restart, run, setDeviceListener, setReadTimeout, setRunning, setStarted, setThread, startup
 
Methods inherited from class org.eclipse.soda.dk.device.Container
activate, addQualifiedKeys, attemptRecoveryFromError, broadcast, broadcastStatus, broadcastStatus, changeIds, createFilter, deactivate, elements, get, getBundleContext, getCommand, getConfigurationInformation, getConfigurationInformation, getConfigurationService, getControlCapacity, getControls, getDefaultStyle, getErrorSeverity, getId, getInformation, getLogDetails4, getLogDetails5, getLogDetails6, getMeasurement, getNotificationController, getNotificationService, getPrefix, getSignal, getState, getStatusDictionary, getString, getStyle, initializeMeasurements, isInitializeMeasurements, keys, notificationReceived, prependPrefix, prependPrefix, put, putConfigurationInformation, register, register, removeListeners, removeQualifiedKeys, setBundleContext, setConfigurationInformation, setInformation, setListenersNull, setNotificationController, setNotificationService, setStyle, 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, get, getCommand, getConfigurationInformation, getMeasurement, getNotificationService, getSignal, getState, setConfigurationInformation, setNotificationService
 
Methods inherited from interface org.eclipse.soda.dk.device.service.ControlService
getKey
 

Constructor Detail

TransportDevice

public TransportDevice()
Constructs an TransportDevice object.

Method Detail

errorOccurred

public void errorOccurred(java.lang.Object source,
                          java.lang.Object timestamp,
                          java.lang.Object data)
The errorOccurred method is called when an error has occurred. Since other notifications are blocked until this method returns, implementors of this method should: The source object that detected the error. The time at which the error was detected. Contains any data about the error.

Specified by:
errorOccurred in interface ErrorListener
Overrides:
errorOccurred in class Container
Parameters:
source - The source (Object) parameter.
timestamp - The timestamp (Object) parameter.
data - The data (Object) parameter.
See Also:
Container.fireErrorOccurred(Object,Object)

exit

public void exit()
Exit.

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

getDefaultTransport

public abstract TransportService getDefaultTransport()
Gets the default transport (TransportService) value.

Returns:
The default transport (TransportService) value.

getInterest

public InterestService getInterest()
Gets the interest filter for the device.

Returns:
InterestService The interest filter for this device.

getMessageListeners

public java.util.Hashtable getMessageListeners()
Gets the Hashtable messageHandlers property value.

Returns:
Results of the get message listeners (Hashtable) value.

getTransport

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

Specified by:
getTransport in interface DeviceService
Overrides:
getTransport in class Container
Returns:
Results of the get transport (TransportService) value.
See Also:
DeviceService.getTransport(), getDefaultTransport(), setTransport(TransportService)

load

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

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

messageReceived

public void messageReceived(TransportService transportService,
                            java.lang.Object timestamp,
                            MessageService message)
This API will be called each time the TransportService receives a valid message. Since other notifications are blocked until this method returns, implementors of this method should: The transport that received the message. The timestamp when the message was detected. The message received.

Specified by:
messageReceived in interface MessageListener
Parameters:
transportService - The transport service (TransportService) parameter.
timestamp - The timestamp (Object) parameter.
message - The message (MessageService) parameter.

register

public void register(TransportService transport)
Register with the specified transport parameter. The transport (TransportService) parameter.

Parameters:
transport - The transport (TransportService) parameter.

registerMessageHandler

public void registerMessageHandler(MessageService[] messages,
                                   MessageHandler value)
Perform the registerMessageHandler action method. org.eclipse.soda.dk.message.service.MessageService[] org.eclipse.soda.dk.device.MessageHandler

Parameters:
messages - The messages (MessageService[]) parameter.
value - The value (MessageHandler) parameter.
See Also:
registerMessageHandler(MessageService,MessageHandler)

registerMessageHandler

public void registerMessageHandler(MessageService message,
                                   MessageHandler value)
Register message handler with the specified message and value parameters. The message (MessageService) parameter. The value (MessageHandler) parameter.

Parameters:
message - The message (MessageService) parameter.
value - The value (MessageHandler) parameter.
See Also:
registerMessageHandler(MessageService[],MessageHandler)

send

public void send(MessageService message)
          throws java.lang.RuntimeException
Perform the send action method. org.eclipse.soda.dk.message.service.MessageService

Specified by:
send in interface DeviceService
Overrides:
send in class Container
Parameters:
message - The message (MessageService) parameter.
Throws:
java.lang.RuntimeException - Runtime Exception.
See Also:
Runtime Exception.

setState

public void setState(int state)
Sets the state value. The state (int) parameter.

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

setTransport

public void setTransport(TransportService transport)
Sets the transport property. The new property value (org.eclipse.soda.dk.transport.service.TransportService).

Specified by:
setTransport in interface DeviceService
Overrides:
setTransport in class Container
Parameters:
transport - The transport (TransportService) parameter.
See Also:
getDefaultTransport(), getTransport()

setup

public void setup()
Description copied from class: Container
Method setup.

Overrides:
setup in class Container
See Also:
Container.setup()

start

public void start()
Description copied from class: Device
Perform the start action method.

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

stop

public void stop()
Perform the stop action method.

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

transportChanged

public void transportChanged(TransportService transportService,
                             java.lang.Object timestamp,
                             int newState,
                             int oldState)
This method will be called when the state of the TransportService 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 transport may not be the same as the newState input parameter. org.eclipse.soda.dk.transport.service.TransportService java.lang.Object The new state of the TransportService when the notification process started. The old state of the TransportService.

Specified by:
transportChanged in interface TransportListener
Parameters:
transportService - The transport service (TransportService) parameter.
timestamp - The timestamp (Object) parameter.
newState - The new state (int) parameter.
oldState - The old state (int) parameter.

unregister

public void unregister(TransportService transport)
Unregister with the specified transport parameter. The transport (TransportService) parameter.

Parameters:
transport - The transport (TransportService) parameter.

1.0.0

Copyright (c) 1999, 2007 IBM