1.0.0

org.eclipse.soda.dk.command
Class Command

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.command.Command
All Implemented Interfaces:
CommandService, ControlService, MeasurementListener, SignalListener, ErrorListener
Direct Known Subclasses:
Commands, DeviceCommand, MethodCommand, SleepCommand, StateCommand

public class Command
extends Control
implements CommandService, SignalListener, MeasurementListener

The Command class implements the CommandService interface.

Version:
1.0.0
See Also:
Control, CommandService, ControlService, ErrorListener, MeasurementListener, MessageHandler, SignalListener

Field Summary
 
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
 
Constructor Summary
Command(java.lang.String key)
          Constructs an Command object using the input parameter(s).
 
Method Summary
 void addCommandListener(CommandListener commandListener)
          Adds the specified listener to receive listener notification.
 void execute()
          Perform the execute action method.
 void execute(java.lang.Object data)
          Perform the execute action method.
 void fireCommandExecuted(CommandListener commandListener, java.lang.Object timestamp)
          Perform the fireCommandExecuted action method.
 void fireCommandExecuted(CommandListener commandListener, java.lang.Object timestamp, java.lang.Object data)
          Perform the fireCommandExecuted action method.
protected  void fireErrorOccurred(CommandListener commandListener, java.lang.Object timestamp, java.lang.Object data)
          Fire error occurred with the specified command 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.
 CommandListener getCommandListener()
          Gets the CommandListener commandListener property value.
 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 removeCommandListener(CommandListener commandListener)
          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 setCommandListener(CommandListener commandListener)
          Sets the commandListener.
 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.Control
attemptRecoveryFromError, equalsValue, errorOccurred, getCodeKey, getErrorSeverity, getKey, getQualifiedKey, getResource, setKey, setQualifiedKey, toString
 
Methods inherited from class org.eclipse.soda.dk.core.EscObject
createDefaultLogService, createException, createException, createInteger, createIntegerTable, createNumber, format, getBoolean, getConfigurationService, getCurrentTimestamp, getDefaultLogService, getDefaultResource, getFloat, getInt, getLoadLibraryName, getLogDetails, getLogDetails0, getLogDetails1, getLogDetails2, getLogDetails3, getLogDetails4, getLogDetails5, getLogDetails6, getLogDetails7, getLogService, getLong, getObject, getOutputName, getSimpleClassName, getStaticBoolean, getStaticFloat, getStaticInt, getStaticLong, getStaticObject, getStaticString, getString, getTraceLevel, getVmLibraryVersion, handleError, handleError, handleError, handleStaticError, handleStaticException, isDebug, isTrace, loadService, log, log, report, report, report, report, report, report, reportSystemInfo, setDebug, setDefaultLogService, setLogService, setTraceLevel, 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
 
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

Command

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

Parameters:
key - The key (String) parameter.
Method Detail

addCommandListener

public void addCommandListener(CommandListener commandListener)
Adds the specified listener to receive listener notification. The org.eclipse.soda.dk.command.service.CommandListener listener to be added.

Specified by:
addCommandListener in interface CommandService
Parameters:
commandListener - The command listener (CommandListener) parameter.
See Also:
CommandService.addCommandListener(org.eclipse.soda.dk.command.service.CommandListener), getCommandListener(), removeCommandListener(CommandListener), setCommandListener(CommandListener)

execute

public void execute()
Perform the execute action method.

Specified by:
execute in interface CommandService
See Also:
CommandService.execute(), execute(Object)

execute

public void execute(java.lang.Object data)
Perform the execute action method. java.lang.Object

Specified by:
execute in interface CommandService
Parameters:
data - The data (Object) parameter.
See Also:
CommandService.execute(), execute()

fireCommandExecuted

public void fireCommandExecuted(CommandListener commandListener,
                                java.lang.Object timestamp,
                                java.lang.Object data)
Perform the fireCommandExecuted action method. The command listener (must not be null). java.lang.Object java.lang.Object

Parameters:
commandListener - The command listener (CommandListener) parameter.
timestamp - The timestamp (Object) parameter.
data - The data (Object) parameter.
See Also:
fireCommandExecuted(CommandListener,Object)

fireCommandExecuted

public void fireCommandExecuted(CommandListener commandListener,
                                java.lang.Object timestamp)
Perform the fireCommandExecuted action method. The command listener (must not be null). java.lang.Object

Parameters:
commandListener - The command listener (CommandListener) parameter.
timestamp - The timestamp (Object) parameter.
See Also:
fireCommandExecuted(CommandListener,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 timestamp (Object) parameter.
data - The data (Object) parameter.
See Also:
fireErrorOccurred(CommandListener,Object,Object)

fireErrorOccurred

protected void fireErrorOccurred(CommandListener commandListener,
                                 java.lang.Object timestamp,
                                 java.lang.Object data)
Fire error occurred with the specified command listener, timestamp and data parameters.

Parameters:
commandListener - The command listener (CommandListener) parameter.
timestamp - The timestamp (Object) parameter.
data - The data (Object) parameter.
See Also:
fireErrorOccurred(Object,Object)

getCommandListener

public CommandListener getCommandListener()
Gets the CommandListener commandListener property value.

Returns:
Results of the get command listener (CommandListener) value.
See Also:
addCommandListener(CommandListener), removeCommandListener(CommandListener), setCommandListener(CommandListener)

measurementChanged

public 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. Since other notifications are blocked until this method returns, implementors of this method should: MeasurementService which changed. The time at which the value change was detected. The new value of the MeasurementService. The old value of the MeasurementService.

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.

removeCommandListener

public void removeCommandListener(CommandListener commandListener)
Removes the specified listener from receiving listener notification. The org.eclipse.soda.dk.command.service.CommandListener listener to be removed.

Specified by:
removeCommandListener in interface CommandService
Parameters:
commandListener - The command listener (CommandListener) parameter.
See Also:
CommandService.removeCommandListener(org.eclipse.soda.dk.command.service.CommandListener), addCommandListener(CommandListener), getCommandListener(), setCommandListener(CommandListener)

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[])

setCommandListener

public void setCommandListener(CommandListener commandListener)
Sets the commandListener. The commandListener to set

Parameters:
commandListener - The command listener (CommandListener) parameter.
See Also:
addCommandListener(CommandListener), getCommandListener(), removeCommandListener(CommandListener)

signalOccurred

public void signalOccurred(SignalService source,
                           java.lang.Object timestamp,
                           java.lang.Object data)
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: The SignalService which fired. The time at which the signal was detected. Contains any data which was contained within the signal.

Specified by:
signalOccurred in interface SignalListener
Parameters:
source - The source (SignalService) parameter.
timestamp - The timestamp (Object) parameter.
data - The data (Object) parameter.
See Also:
fireErrorOccurred(Object,Object), fireErrorOccurred(CommandListener,Object,Object)

1.0.0

Copyright (c) 1999, 2007 IBM