fr.esrf.tangoatk.core
Class AEntityFactory

java.lang.Object
  extended by fr.esrf.tangoatk.core.AEntityFactory
All Implemented Interfaces:
fr.esrf.TangoDs.TangoConst, java.io.Serializable
Direct Known Subclasses:
AttributeFactory, CommandFactory

public abstract class AEntityFactory
extends java.lang.Object
implements fr.esrf.TangoDs.TangoConst, java.io.Serializable

AEntityFactory keeps all the code that is common for the AttributeFactory and the CommandFactory. It is used by AEntityList.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface fr.esrf.TangoDs.TangoConst
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, 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, 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_FLOAT, Tango_DEV_INT, Tango_DEV_LONG, Tango_DEV_LONG64, 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 Summary
AEntityFactory()
           
 
Method Summary
static java.lang.String extractDeviceName(java.lang.String entityName)
          extractDeviceName extracts the device name from an entityName
static java.lang.String extractDeviceNameAdvanced(java.lang.String name)
          extractDeviceNameAdvanced extracts the device name from an entity name, a device name, or an alias.
static java.lang.String extractEntityName(java.lang.String entityName)
          extractEntityName Given an entityname of the form aa/bb/cc/EntityName, this method will return EntityName
protected  Device getDevice(java.lang.String deviceName)
          getDevice
 java.util.List<IEntity> getEntities(java.lang.String name)
          getEntities returns a list of entities corresponding to the name passed as a parameter.
static java.lang.String getFQName(Device device, java.lang.String name)
           
protected abstract  IEntity getSingleEntity(java.lang.String name, Device d)
          getSingleEntity is called if isWIldCard(name) is false
abstract  int getSize()
          Returns the number of entity present in this factory.
abstract  java.lang.String getVersion()
          Return release information of this factory.
protected abstract  java.util.List<IEntity> getWildCardEntities(java.lang.String name, Device device)
          getWildCardEntities is called if isWildCard(name) is true.
static boolean isWildCard(java.lang.String entityName)
          isWildCard returns true if the entityName contains a *
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AEntityFactory

public AEntityFactory()
Method Detail

extractDeviceName

public static java.lang.String extractDeviceName(java.lang.String entityName)
extractDeviceName extracts the device name from an entityName

Parameters:
entityName - a String value
Returns:
a String value containing the deviceName.

extractDeviceNameAdvanced

public static java.lang.String extractDeviceNameAdvanced(java.lang.String name)
                                                  throws fr.esrf.Tango.DevFailed
extractDeviceNameAdvanced extracts the device name from an entity name, a device name, or an alias.

Parameters:
name - a String value
Returns:
a String value containing the deviceName. Returns null if no device name can match.
Throws:
fr.esrf.Tango.DevFailed - in case of error connecting with database

getFQName

public static java.lang.String getFQName(Device device,
                                         java.lang.String name)

extractEntityName

public static java.lang.String extractEntityName(java.lang.String entityName)
extractEntityName Given an entityname of the form aa/bb/cc/EntityName, this method will return EntityName

Parameters:
entityName - a String value
Returns:
a String value containing the entity name.

isWildCard

public static boolean isWildCard(java.lang.String entityName)
isWildCard returns true if the entityName contains a *

Parameters:
entityName - a String value
Returns:
a boolean value

getDevice

protected Device getDevice(java.lang.String deviceName)
                    throws ConnectionException
getDevice

Parameters:
deviceName - a String value containing the name of the device to get.
Returns:
a Device if this device is already known.
Throws:
ConnectionException - if an error occurs
See Also:
DeviceFactory.getDevice(java.lang.String)

getEntities

public java.util.List<IEntity> getEntities(java.lang.String name)
                                    throws ConnectionException
getEntities returns a list of entities corresponding to the name passed as a parameter. If the name is a wildcard, the returned list might contain more than one entity.

Parameters:
name - a String value containing the name of the entity wanted. Might be a wildcard.
Returns:
a List value containing the corresponding entities
Throws:
ConnectionException - if an error occurs
See Also:
isWildCard(String)

getWildCardEntities

protected abstract java.util.List<IEntity> getWildCardEntities(java.lang.String name,
                                                               Device device)
                                                        throws fr.esrf.Tango.DevFailed
getWildCardEntities is called if isWildCard(name) is true.

Parameters:
name - a String value containing the name of the entity
device - a Device value containing the device from which the entity is to be obtained.
Returns:
a List value containing the entities corresponding to the name
Throws:
fr.esrf.Tango.DevFailed - if an error occurs
See Also:
isWildCard(String)

getSingleEntity

protected abstract IEntity getSingleEntity(java.lang.String name,
                                           Device d)
                                    throws fr.esrf.Tango.DevFailed
getSingleEntity is called if isWIldCard(name) is false

Parameters:
name - a String value containing hte name of the entity
d - a Device value containing the device from which the entity is to be obtained
Returns:
an IEntity value containing the entity corresponding to the name.
Throws:
fr.esrf.Tango.DevFailed - if an error occurs

getSize

public abstract int getSize()
Returns the number of entity present in this factory.

Returns:
Number of entity

getVersion

public abstract java.lang.String getVersion()
Return release information of this factory.

Returns:
Release information.