public abstract class ScadaRecord extends java.lang.Object implements DataListener, java.lang.Cloneable
Ported from XAL on Jul 15, 2014.
· Jonathan M. Freed
| Modifier and Type | Class and Description |
|---|---|
static interface |
ScadaRecord.IFieldDescriptor
Used by enumerations in data structures
to indicate that they known aspects
of the data fields they represent.
|
| Modifier | Constructor and Description |
|---|---|
protected |
ScadaRecord()
Create a new
ScadaStruct object. |
protected |
ScadaRecord(AcceleratorNode smfDev)
Creates a new
ScadaStruct object which is initialized from the
data provided by the given hardware object. |
protected |
ScadaRecord(java.lang.Class<? extends AScada.Record> clsRecord)
Creates a new instance of
ScadaRecord initializing the connections
from the SCADA records in the annotated argument. |
protected |
ScadaRecord(DataAdaptor daptInitSrc)
Creates a new
ScadaStruct object which is initialized from the
data stored behind the given data source. |
protected |
ScadaRecord(java.util.List<ScadaFieldDescriptor> lstFldDscr)
Create a new
ScadaStruct object. |
protected |
ScadaRecord(ScadaFieldDescriptor... arrFldDscr)
Create a new
ScadaStruct object. |
protected |
ScadaRecord(ScadaRecord clone)
Creates a new
ScadaStruct object which is a deep copy of the argument. |
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.Object |
clone()
Make a deep copy of this
ScadaStruct object. |
ScadaFieldDescriptor |
getFieldDescriptor(java.lang.String strName)
Returns the PV field descriptor for this structure with the given
name.
|
java.util.Map<java.lang.String,ScadaFieldDescriptor> |
getFieldDescriptorMap()
Returns a map of (field name, ScadaFieldDescriptor) pairs for this data
structure.
|
java.util.List<ScadaFieldDescriptor> |
getFieldDescriptors()
Returns the set of PV/data field descriptors for
this data structure.
|
void |
loadHardwareValues(AcceleratorNode smfDev)
Populate the fields of this data set with the current
Process Variable values of the given device.
|
protected void |
setFieldFromPV(java.lang.String strFldName,
java.lang.String strHndPv,
AcceleratorNode smfDev)
Set the value of of the given data field using the
value obtained from the PV attached to the given device.
|
void |
setHardwareValues(AcceleratorNode smfDev)
Sets the parameters of the given hardware device, to the values
in this data structure.
|
protected void |
setPvFromField(java.lang.String strFldName,
java.lang.String strHndPv,
AcceleratorNode smfDev)
Sets the given PV with the value of the data structure field
given by name.
|
java.lang.String |
toString()
Write out a text description of the data structure field
values.
|
void |
update(DataAdaptor daptSrc)
Read in the values of the data structure fields from the data
source behind the data adaptor interface.
|
void |
write(DataAdaptor daptSink)
Save the data structure field values to the given data sink behind
the
DataAdaptor interface. |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdataLabelprotected ScadaRecord()
throws BadStructException
ScadaStruct object. The field
descriptors are taken from annotations in the source code.
The structure fields in the derived class should be annotated using the
AScada.Field annotation to be recognized and
included in the list of field descriptors.BadStructException - no SCADA fields (@Scada.Field) were found in data structure,
CKA: I have removed this for nowprotected ScadaRecord(ScadaRecord clone) throws java.lang.CloneNotSupportedException
ScadaStruct object which is a deep copy of the argument.clone - the ScadaStruct to be clonedjava.lang.CloneNotSupportedException - occurs when a defining ScadaFieldDescriptor cannot be copiedprotected ScadaRecord(java.lang.Class<? extends AScada.Record> clsRecord)
ScadaRecord initializing the connections
from the SCADA records in the annotated argument.clsRecord - connects the SCADA connections as annotation metadataprotected ScadaRecord(DataAdaptor daptInitSrc)
ScadaStruct object which is initialized from the
data stored behind the given data source.daptInitSrc - data source containing initialization informationprotected ScadaRecord(AcceleratorNode smfDev) throws ConnectionException, GetException, BadStructException
ScadaStruct object which is initialized from the
data provided by the given hardware object.smfDev - device to be queried for initialization informationBadStructException - data structure fields are ill-defined/incompatibleConnectionException - unable to connect to a descriptor read back channelGetException - unable to get PV value from channel access orprotected ScadaRecord(java.util.List<ScadaFieldDescriptor> lstFldDscr)
ScadaStruct object. Called
by child classes to define their data fields and PVs
(with ScadaFieldDescriptors) directly. That is,
without the annotation option.lstFldDscr - list of PV field descriptors for this data setBadStructException - no SCADA fields (@Scada.Field) were found in data structureprotected ScadaRecord(ScadaFieldDescriptor... arrFldDscr)
ScadaStruct object. Called
by child classes to define their data fields and PVs
(with ScadaFieldDescriptors) directly. That is,
without the annotation option.arrFldDscr - set of PV field descriptors for this data setBadStructException - no SCADA fields (@Scada.Field) were found in data structurepublic ScadaFieldDescriptor getFieldDescriptor(java.lang.String strName)
strName - field namenull if not foundpublic java.util.List<ScadaFieldDescriptor> getFieldDescriptors()
public java.util.Map<java.lang.String,ScadaFieldDescriptor> getFieldDescriptorMap()
public void loadHardwareValues(AcceleratorNode smfDev) throws BadStructException, ConnectionException, GetException
smfDev - hardware device from which values are obtainedBadStructException - data structure fields are ill-defined/incompatibleConnectionException - unable to connect to a descriptor read back channelGetException - unable to get PV value from channel access orpublic void setHardwareValues(AcceleratorNode smfDev) throws BadStructException, ConnectionException, PutException
smfDev - hardware device to receive new parameter valuesBadStructException - data structure fields are ill-defined/incompatibleConnectionException - unable to connect to PV channelPutException - general put exception (unable to set all parameter values)public java.lang.String toString()
toString in class java.lang.ObjectObject.toString()public void update(DataAdaptor daptSrc) throws java.util.MissingResourceException, BadStructException
update in interface DataListenerdaptSrc - The adaptor from which to update the datajava.util.MissingResourceException - a data field was missing from the data sourceBadStructException - data structure fields are ill-defined/incompatiblegov.sns.tools.data.DataListener#update(gov.sns.tools.data.DataAdaptor)public void write(DataAdaptor daptSink) throws BadStructException
DataAdaptor interface. Each value is stored
as the value of an attribute being the field name.write in interface DataListenerdaptSink - The adaptor to which the receiver's data is writtenjava.lang.TypeNotPresentException - Bad structure definitionBadStructException - data structure fields are ill-defined/incompatiblegov.sns.tools.data.DataListener#write(gov.sns.tools.data.DataAdaptor)protected java.lang.Object clone()
throws java.lang.CloneNotSupportedException
ScadaStruct object.
The field descriptors do not need to be duplicated, however, for they
are immutable.clone in class java.lang.Objectjava.lang.CloneNotSupportedExceptionObject.clone()protected void setFieldFromPV(java.lang.String strFldName,
java.lang.String strHndPv,
AcceleratorNode smfDev)
throws BadStructException,
ConnectionException,
GetException
strFldName - the name of the data field in this structurestrHndPv - the (get) channel handle for the PVsmfDev - the PV belongs to this deviceBadStructException - data structure fields are ill-defined/incompatibleConnectionException - unable to connect to descriptor read back channelGetException - unable to get PV valueprotected void setPvFromField(java.lang.String strFldName,
java.lang.String strHndPv,
AcceleratorNode smfDev)
throws BadStructException,
ConnectionException,
PutException
Sets the given PV with the value of the data structure field given by name. Of course all this is for the SMF hardware device given in the argument. Thus, the given device must contain the given PV, and this data structure must contain the named field.
We check the type of the named data field. The PV is set using this
type (not the data type specified in the PvDescriptor
given in the arguments.
strFldName - name of the data field within this data structurestrHndPv - handle of the (set) PV channelsmfDev - Hardware device containing the PVBadStructException - general field incompatibility exceptionConnectionException - unable to connect to descriptor set value channelPutException - unable to set PV value