public abstract class ACommand extends java.lang.Object implements ICommand
ACommand
is like AAttribute
is for Attributes,
the mother of all commands. It holds all common behaviour of Commands,
and delegates the handeling of input and output to its
ACommandHelper
instances, the inputHelper and the outputHelper.Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
alias |
protected java.lang.String |
error |
protected int |
executionCount |
protected ACommandHelper |
inputHelper |
protected java.lang.String |
name |
protected java.lang.String |
nameSansDevice |
protected java.util.List |
oldResult |
protected java.lang.Throwable |
oldt |
protected ACommandHelper |
outputHelper |
protected EventSupport |
propChanges |
protected java.util.Map<java.lang.String,Property> |
propertyMap |
ACCESS_READ, ACCESS_SERVICE, ACCESS_WRITE, ARCHIVE_EVENT, ATT_CONF_EVENT, Attr_AdmName, Attr_Description, Attr_Name, Attr_State, Attr_Status, Attr_Unknown, ATTRIBUTE, BY_CLASS, BY_DEVICE, BY_PROCESS, CHANGE_EVENT, COMMAND, CONTROL_SYSTEM, DATA_READY_EVENT, DEFAULT_LOCK_VALIDITY, eventNames, INTERFACE_CHANGE, LOGGING_CONSOLE_TARGET, LOGGING_CONSOLE_TARGET_ID, LOGGING_DEBUG, LOGGING_DEF_RFT, LOGGING_DEVICE_TARGET, LOGGING_DEVICE_TARGET_ID, LOGGING_ERROR, LOGGING_FATAL, LOGGING_FILE_TARGET, LOGGING_FILE_TARGET_ID, LOGGING_INFO, LOGGING_LEVELS, LOGGING_MAX_RFT, LOGGING_MIN_RFT, LOGGING_OFF, LOGGING_SEPARATOR, LOGGING_UNKNOWN_TARGET_ID, LOGGING_WARN, NO_SYNC, NOT_STATELESS, NotANumber, Op_BlackBox, Op_Command, Op_Command_2, Op_Command_inout, Op_Command_inout_2, Op_Command_inout_history_2, Op_Command_list, Op_Command_list_2, Op_Get_Attr_Config, Op_Get_Attr_Config_2, Op_Info, Op_Ping, Op_Read_Attr, Op_Read_Attr_2, Op_Read_Attr_history_2, Op_Set_Attr_Config, Op_Unknown, Op_Write_Attr, PERIODIC_EVENT, PIPE_EVENT, QUALITY_EVENT, Req_Attribute, Req_Operation, Req_Unknown, SERVICE_PROP_NAME, STATELESS, Tango_AllAttr, Tango_AllAttr_3, Tango_AlrmValueNotSpec, Tango_AssocWritNotSpec, Tango_AttrDataFormatName, Tango_CLNT_TIMEOUT, Tango_CmdArgTypeName, Tango_CONST_DEV_STRING, Tango_DbObjName, Tango_DEFAULT_POLL_OLD_FACTOR, Tango_DEFAULT_TIMEOUT, Tango_DEFAULT_TIMEOUT_SEC, Tango_DefaultBlackBoxDepth, Tango_DefaultDocUrl, Tango_DefaultPollRingDepth, Tango_DefaultWritableProp, Tango_DELTA_T, Tango_DescNotSet, Tango_DescNotSpec, Tango_DEV_BOOLEAN, Tango_DEV_CHAR, Tango_DEV_DOUBLE, Tango_DEV_ENCODED, Tango_DEV_ENUM, Tango_DEV_FLOAT, Tango_DEV_INT, Tango_DEV_LONG, Tango_DEV_LONG64, Tango_DEV_PIPE_BLOB, Tango_DEV_SHORT, Tango_DEV_STATE, Tango_DEV_STRING, Tango_DEV_UCHAR, Tango_DEV_ULONG, Tango_DEV_ULONG64, Tango_DEV_USHORT, Tango_DEV_VOID, Tango_DevStateName, Tango_DEVVAR_CHARARRAY, Tango_DEVVAR_DOUBLEARRAY, Tango_DEVVAR_DOUBLESTRINGARRAY, Tango_DEVVAR_FLOATARRAY, Tango_DEVVAR_LONG64ARRAY, Tango_DEVVAR_LONGARRAY, Tango_DEVVAR_LONGSTRINGARRAY, Tango_DEVVAR_SHORTARRAY, Tango_DEVVAR_STRINGARRAY, Tango_DEVVAR_ULONG64ARRAY, Tango_DEVVAR_ULONGARRAY, Tango_DEVVAR_USHORTARRAY, Tango_DevVersion, Tango_DISCARD_THRESHOLD, Tango_DispUnitNotSpec, Tango_DSDeviceDomain, Tango_EXPERT_ATTR, Tango_EXPERT_CMD, Tango_FormatNotSpec, Tango_InitialOutput, Tango_LabelNotSpec, TANGO_LOG_PATH, Tango_MAX_TRANSFER_SIZE, Tango_MaxServerNameLength, Tango_MIN_POLL_PERIOD, Tango_OPERATOR_ATTR, Tango_OPERATOR_CMD, Tango_POLL_ADD_OBJ, Tango_POLL_ATTR, Tango_POLL_CMD, Tango_POLL_REM_DEV, Tango_POLL_REM_OBJ, Tango_POLL_START, Tango_POLL_STOP, Tango_POLL_UPD_PERIOD, Tango_PollAttribute, Tango_PollCommand, Tango_QualityName, Tango_REL_1, Tango_REL_2, Tango_ResNotDefined, Tango_StdUnitNotSpec, Tango_SysProperty, Tango_TG_IMP_MINOR_DEVFAILED, Tango_TG_IMP_MINOR_NON_DEVFAILED, Tango_TG_IMP_MINOR_TO, Tango_TgLibVers, Tango_UnitNotSpec, USER_EVENT
Constructor and Description |
---|
ACommand() |
Modifier and Type | Method and Description |
---|---|
void |
addErrorListener(IErrorListener l)
An
IErrorListener is an object that listens to
error property changes from this object. |
void |
addResultListener(IResultListener l)
addResultListener adds a listener to the result of
executing this command. |
protected boolean |
checkArgin(java.util.List l) |
protected void |
cmdError(java.lang.String message,
java.lang.Throwable t)
cmdError sends off an error event to all the
errorlisteners of this command. |
boolean |
doesArrayOutput()
doesArrayOutput returns true if this command does
output in form of an array |
boolean |
doesOutput()
doesOutput returns true if this command does ouput |
void |
execute()
execute executes the command without input. |
void |
execute(java.util.List l)
execute executes the command and uses the
input in whatever way it feels
appropriate. |
java.lang.String |
getAlias() |
Device |
getDevice()
getDevice |
int |
getExecutionCount() |
java.lang.String |
getInTypeDescription()
getInTypeDescription returns the description of the
in type |
java.lang.String |
getInTypeElemName()
getInTypeElemName returns the type name of an element of the array
if this command has an "array" input argument. |
java.lang.String |
getLevel() |
AtkEventListenerList |
getListenerList() |
java.lang.String |
getName()
Gets the name of this
IEntity |
java.lang.String |
getNameSansDevice() |
java.lang.String |
getOutTypeDescription()
getOutTypeDescription returns the description of the
out type |
java.lang.String |
getOutTypeElemName() |
Property |
getProperty(java.lang.String name)
getProperty returns the CommandProperty with the
given name if such a beast exists. |
java.util.Map<java.lang.String,Property> |
getPropertyMap()
getPropertyMap returns a Map containing this entitys
properties. |
java.lang.String |
getTag() |
protected java.lang.String |
getTypeName(int type) |
java.lang.String |
getVersion() |
protected void |
init(Device d,
java.lang.String cmdName,
fr.esrf.TangoApi.CommandInfo info)
init initializes the Command, |
static boolean |
isArray(int type) |
static boolean |
isBoolean(int type) |
boolean |
isExpert() |
boolean |
isOperator() |
static boolean |
isScalar(int type) |
static boolean |
isString(int type) |
static boolean |
isTable(int type) |
static boolean |
isVoid(int type) |
protected void |
publishResult(java.util.List result) |
void |
refresh()
refreshes the listeners of this particular object.
|
void |
removeErrorListener(IErrorListener l)
Removes the given
IErrorListener from this objects
list of errorlisteners. |
void |
removeResultListener(IResultListener l)
removeResultListener removes a listenener from
this command |
void |
setAlias(java.lang.String alias) |
protected void |
setProperty(java.lang.String name,
fr.esrf.Tango.DispLevel value) |
void |
storeConfig() |
boolean |
takesArrayInput()
takesArrayInput returns true if this command takes
array-input |
boolean |
takesInput()
takesInput returns true if this command takes input |
boolean |
takesScalarInput()
takesScalarInput return strue if this command
takes scalar-input |
boolean |
takesTableInput()
takesArrayInput returns true if this command takes
array-input |
java.lang.String |
toString() |
protected ACommandHelper inputHelper
protected ACommandHelper outputHelper
protected java.util.Map<java.lang.String,Property> propertyMap
protected java.lang.String name
protected java.lang.String nameSansDevice
protected java.lang.String error
protected java.util.List oldResult
protected EventSupport propChanges
protected java.lang.Throwable oldt
protected java.lang.String alias
protected int executionCount
public java.lang.String getVersion()
protected void init(Device d, java.lang.String cmdName, fr.esrf.TangoApi.CommandInfo info)
init
initializes the Command,d
- the Device
this command is connected tocmdName
- a String
value holding the name of this
command.info
- a DevCmdInfo
value holding the
DevCmdInfo
for this commandpublic Device getDevice()
getDevice
protected void cmdError(java.lang.String message, java.lang.Throwable t)
cmdError
sends off an error event to all the
errorlisteners of this command.message
- a String
valuet
- a Throwable
valuepublic void storeConfig()
storeConfig
in interface IEntity
public Property getProperty(java.lang.String name)
getProperty
returns the CommandProperty with the
given name if such a beast exists. Null otherwisegetProperty
in interface IEntity
name
- a String
valueProperty
valueprotected java.lang.String getTypeName(int type)
public java.lang.String getInTypeElemName()
getInTypeElemName
returns the type name of an element of the array
if this command has an "array" input argument.getInTypeElemName
in interface ICommand
int
value containing the in_type.java.util.NoSuchElementException
- if no such property exists.TangoConst
public java.lang.String getOutTypeElemName()
getOutTypeElemName
in interface ICommand
public java.lang.String getInTypeDescription()
getInTypeDescription
returns the description of the
in typegetInTypeDescription
in interface ICommand
String
value holding the descriptionpublic java.lang.String getOutTypeDescription()
getOutTypeDescription
returns the description of the
out typegetOutTypeDescription
in interface ICommand
String
valuepublic java.util.Map<java.lang.String,Property> getPropertyMap()
IEntity
getPropertyMap
returns a Map containing this entitys
properties.getPropertyMap
in interface IEntity
Map
valueprotected void setProperty(java.lang.String name, fr.esrf.Tango.DispLevel value)
public void refresh()
IRefreshee
refresh
in interface IRefreshee
public int getExecutionCount()
public java.lang.String getName()
IEntity
IEntity
public java.lang.String getNameSansDevice()
getNameSansDevice
in interface IEntity
public java.lang.String toString()
toString
in class java.lang.Object
public void addErrorListener(IErrorListener l)
IEntity
IErrorListener
is an object that listens to
error property changes from this object.addErrorListener
in interface IEntity
l
- an IErrorListener
valuepublic void removeErrorListener(IErrorListener l)
IEntity
IErrorListener
from this objects
list of errorlisteners.removeErrorListener
in interface IEntity
l
- an IErrorListener
valuepublic boolean takesInput()
ICommand
takesInput
returns true if this command takes inputtakesInput
in interface ICommand
boolean
valuepublic boolean takesTableInput()
ICommand
takesArrayInput
returns true if this command takes
array-inputtakesTableInput
in interface ICommand
boolean
valuepublic boolean takesArrayInput()
ICommand
takesArrayInput
returns true if this command takes
array-inputtakesArrayInput
in interface ICommand
boolean
valuepublic boolean takesScalarInput()
ICommand
takesScalarInput
return strue if this command
takes scalar-inputtakesScalarInput
in interface ICommand
boolean
valuepublic boolean doesOutput()
ICommand
doesOutput
returns true if this command does ouputdoesOutput
in interface ICommand
boolean
valuepublic boolean doesArrayOutput()
ICommand
doesArrayOutput
returns true if this command does
output in form of an arraydoesArrayOutput
in interface ICommand
boolean
valuepublic static boolean isVoid(int type)
public static boolean isBoolean(int type)
public static boolean isString(int type)
public static boolean isScalar(int type)
public static boolean isArray(int type)
public static boolean isTable(int type)
public void execute()
ICommand
execute
executes the command without input.execute
in interface ICommand
ICommand.execute(java.util.List input)
public void addResultListener(IResultListener l)
ICommand
addResultListener
adds a listener to the result of
executing this command.addResultListener
in interface ICommand
l
- an IResultListener
valueIResultListener
public void removeResultListener(IResultListener l)
ICommand
removeResultListener
removes a listenener from
this commandremoveResultListener
in interface ICommand
l
- an IResultListener
valueprotected void publishResult(java.util.List result)
protected boolean checkArgin(java.util.List l)
public void execute(java.util.List l)
ICommand
execute
executes the command and uses the
input
in whatever way it feels
appropriate. Results are published to all listeners which have
registered by calling addResultListener
public boolean isOperator()
isOperator
in interface IEntity
public AtkEventListenerList getListenerList()
getListenerList
in interface IEntity