Class Record
Record class.
- Author:
- igor@scictrl.com
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for Record.Constructor for Record.Record(String name, gov.aps.jca.dbr.DBRType type, int count, String units, Number upperDispLimit, Number lowerDispLimit, Number upperWarningLimit, Number lowerWarningLimit, Number upperAlarmLimit, Number lowerAlarmLimit, Number upperCtrlLimit, Number lowerCtrlLimit, short precision, String[] enumLabels, String description) Constructor for Record. -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate()activate.voidAdds listener to all three change events: PROPERTY_RECORD, PROPERTY_VALUE and PROPERTY_ALARM.voidAdds listener to one of three change events: PROPERTY_RECORD, PROPERTY_VALUE and PROPERTY_ALARM.voidcopyFields(Record record) copyFields.voidcopyFields(MetaData md) copyFields.voidcopyUnitsControlLimits(Record record) copyUnitsControlLimits.static MetaDataextractMetaData.voidfireAlarmChange.voidfireRecordChange.voidfireValueChange.voidfireWriteEvent.static RecordforProcessor(String name, gov.aps.jca.dbr.DBRType type, int count, String description, ValueProcessor proc, org.apache.commons.configuration.HierarchicalConfiguration config) Return new Record containing the provided processor.gov.aps.jca.dbr.SeverityGetter for the fieldalarmSeverity.gov.aps.jca.dbr.StatusGetter for the fieldalarmStatus.If this record belongs to an application, then this method returns that application, otherwisenullis returned.intgetCount()Getter for the fieldcount.Getter for the fielddatabase.Getter for the fielddescription.String[]Getter for the fieldenumLabels.Getter for the fieldlowerAlarmLimit.Getter for the fieldlowerCtrlLimit.Getter for the fieldlowerDispLimit.Getter for the fieldlowerWarningLimit.getName()Getter for the fieldname.shortGetter for the fieldprecision.Getter for the fieldprocessor.gov.aps.jca.dbr.TimeStampgetTimestamp.gov.aps.jca.dbr.DBRTypegetType()Getter for the fieldtype.getUnits()Getter for the fieldunits.Getter for the fieldupperAlarmLimit.Getter for the fieldupperCtrlLimit.Getter for the fieldupperDispLimit.Getter for the fieldupperWarningLimit.getValue()getValue.booleangetValueAsBoolean.doublegetValueAsDouble.double[]getValueAsDoubleArray.intgetValueAsInt.getValueAsString.voidinitialize(Database database) This method is called by Database when record is added to the Database.booleanisActivated.booleanisAlarm()isAlarm.booleanisAlarmUndefined.booleanisPersistent.booleanReturnstrueif this record supports value writing.voidremovePropertyChangeListener.voidremovePropertyChangeListener.voidsetApplication(Application application) This method is called by application instances for all records created by that application.voidsetCount(int count) Setter for the fieldcount.voidsetMinMax.voidsetPersistent(boolean persistent) Sets persistency flag.voidThis is part of initialization of Record, it is called afterValueProcessor.configure(Record, org.apache.commons.configuration.HierarchicalConfiguration)has been called, so processor is already configured.voidThis method sets new value to the value processor for this record.voidsetValueAsString(String value) setValueAsString.voidsetWritable(boolean writable) Sets the writable flag.static final StringtoPropertyName(String name) Converts property name to PROPERTY_VALUE or PROPERTY_ALARM, useful when parsing configuration input.toString()voidupdateAlarm(gov.aps.jca.dbr.Severity severity, gov.aps.jca.dbr.Status status) updateAlarm.voidupdateAlarm(gov.aps.jca.dbr.Severity severity, gov.aps.jca.dbr.Status status, boolean notify) updateAlarm.voidupdateNoAlarm.voidThis method sets new value to the value processor for this record.
-
Field Details
-
PROPERTY_RECORD
ConstantPROPERTY_RECORD="record"- See Also:
-
PROPERTY_VALUE
ConstantPROPERTY_VALUE="value"- See Also:
-
PROPERTY_ALARM
ConstantPROPERTY_ALARM="alarm"- See Also:
-
PROPERTY_WRITE
ConstantPROPERTY_WRITE="write"- See Also:
-
-
Constructor Details
-
Record
Constructor for Record.
- Parameters:
name- aStringobjecttype- aDBRTypeobjectcount- a int
-
Record
Constructor for Record.
-
Record
public Record(String name, gov.aps.jca.dbr.DBRType type, int count, String units, Number upperDispLimit, Number lowerDispLimit, Number upperWarningLimit, Number lowerWarningLimit, Number upperAlarmLimit, Number lowerAlarmLimit, Number upperCtrlLimit, Number lowerCtrlLimit, short precision, String[] enumLabels, String description) Constructor for Record.
- Parameters:
name- aStringobjecttype- aDBRTypeobjectcount- a intunits- aStringobjectupperDispLimit- aNumberobjectlowerDispLimit- aNumberobjectupperWarningLimit- aNumberobjectlowerWarningLimit- aNumberobjectupperAlarmLimit- aNumberobjectlowerAlarmLimit- aNumberobjectupperCtrlLimit- aNumberobjectlowerCtrlLimit- aNumberobjectprecision- a shortenumLabels- an array ofStringobjectsdescription- aStringobject
-
-
Method Details
-
extractMetaData
extractMetaData.
-
toPropertyName
Converts property name to PROPERTY_VALUE or PROPERTY_ALARM, useful when parsing configuration input.- Parameters:
name- unformatted property name, should be "value" or "alarm".- Returns:
- return PROPERTY_VALUE or PROPERTY_ALARM if matched or
nullif not matched.
-
forProcessor
public static Record forProcessor(String name, gov.aps.jca.dbr.DBRType type, int count, String description, ValueProcessor proc, org.apache.commons.configuration.HierarchicalConfiguration config) Return new Record containing the provided processor.- Parameters:
name- aStringobjecttype- aDBRTypeobjectcount- a intdescription- aStringobjectproc- aValueProcessorobjectconfig- aHierarchicalConfigurationobject- Returns:
- a
Recordobject
-
isActivated
public boolean isActivated()isActivated.
- Returns:
- a boolean
-
setPersistent
public void setPersistent(boolean persistent) Sets persistency flag. Persistent record will save it's value when changed on disk and receive last saved value at restart.- Parameters:
persistent- a boolean
-
isPersistent
public boolean isPersistent()isPersistent.
- Returns:
- a boolean
-
getApplication
If this record belongs to an application, then this method returns that application, otherwisenullis returned.- Returns:
- an application if exist or
null
-
setApplication
This method is called by application instances for all records created by that application.- Parameters:
application- aApplicationobject
-
getDescription
Getter for the field
description.- Returns:
- a
Stringobject
-
getName
Getter for the field
name.- Returns:
- a
Stringobject
-
getType
public gov.aps.jca.dbr.DBRType getType()Getter for the field
type.- Returns:
- a
DBRTypeobject
-
getCount
public int getCount()Getter for the field
count.- Returns:
- a int
-
getEnumLabels
Getter for the field
enumLabels.- Returns:
- an array of
Stringobjects
-
getLowerAlarmLimit
Getter for the field
lowerAlarmLimit.- Returns:
- a
Numberobject
-
getLowerCtrlLimit
Getter for the field
lowerCtrlLimit.- Returns:
- a
Numberobject
-
getLowerDispLimit
Getter for the field
lowerDispLimit.- Returns:
- a
Numberobject
-
getLowerWarningLimit
Getter for the field
lowerWarningLimit.- Returns:
- a
Numberobject
-
getPrecision
public short getPrecision()Getter for the field
precision.- Returns:
- a short
-
getTimestamp
public gov.aps.jca.dbr.TimeStamp getTimestamp()getTimestamp.
- Returns:
- a
TimeStampobject
-
getUnits
Getter for the field
units.- Returns:
- a
Stringobject
-
getUpperAlarmLimit
Getter for the field
upperAlarmLimit.- Returns:
- a
Numberobject
-
getUpperCtrlLimit
Getter for the field
upperCtrlLimit.- Returns:
- a
Numberobject
-
getUpperDispLimit
Getter for the field
upperDispLimit.- Returns:
- a
Numberobject
-
getUpperWarningLimit
Getter for the field
upperWarningLimit.- Returns:
- a
Numberobject
-
getValue
getValue.
- Returns:
- a
Objectobject
-
getValueAsDouble
public double getValueAsDouble()getValueAsDouble.
- Returns:
- a double
-
getValueAsInt
public int getValueAsInt()getValueAsInt.
- Returns:
- a int
-
getValueAsBoolean
public boolean getValueAsBoolean()getValueAsBoolean.
- Returns:
- a boolean
-
getValueAsDoubleArray
public double[] getValueAsDoubleArray()getValueAsDoubleArray.
- Returns:
- an array of
objects
invalid reference
double
-
getValueAsString
getValueAsString.
- Returns:
- a
Stringobject
-
setValue
This method sets new value to the value processor for this record. If current value at the processor is the same, than no value-change event is fired and none will be notified, that attempt at value change has been done.To force value processing regardless of the matching values, then call write.
- Parameters:
value- the value to be set to the processor
-
write
This method sets new value to the value processor for this record. This call might first fire thePROPERTY_VALUEonly if value was actually changed, then it will always fire thePROPERTY_WRITEchange event to signal that value change change attempt was done. This method is called from CAJ remote call handler each time a remote request is made. It is also called fromValueLinksobject when an local application or a processor wants to mimic a remote write and it is this ways processed as a remote call.- Parameters:
value- the value to be set to the processor
-
isWrittable
public boolean isWrittable()Returnstrueif this record supports value writing. If not, calling write (remote call) will not be passed to the processor.- Returns:
trueif this record supports value writing
-
setWritable
public void setWritable(boolean writable) Sets the writable flag. Iftruethen this record supports value writing. If not, calling write (remote call) will not be passed to the processor.- Parameters:
writable- the writable flag, iftruethen this record supports value writing
-
setCount
public void setCount(int count) Setter for the field
count.- Parameters:
count- a int
-
activate
public void activate()activate.
-
initialize
This method is called by Database when record is added to the Database.- Parameters:
database- a Database object to which this record was added.
-
setProcessor
This is part of initialization of Record, it is called afterValueProcessor.configure(Record, org.apache.commons.configuration.HierarchicalConfiguration)has been called, so processor is already configured.- Parameters:
vp- aValueProcessorobject
-
getDatabase
Getter for the field
database.- Returns:
- a
Databaseobject
-
addPropertyChangeListener
Adds listener to one of three change events: PROPERTY_RECORD, PROPERTY_VALUE and PROPERTY_ALARM.- Parameters:
name- the name of property, supported are: PROPERTY_RECORD, PROPERTY_VALUE, PROPERTY_ALARMl- the listener
-
addPropertyChangeListener
Adds listener to all three change events: PROPERTY_RECORD, PROPERTY_VALUE and PROPERTY_ALARM.- Parameters:
l- the listener
-
removePropertyChangeListener
removePropertyChangeListener.
- Parameters:
name- aStringobjectl- aPropertyChangeListenerobject
-
removePropertyChangeListener
removePropertyChangeListener.
- Parameters:
l- aPropertyChangeListenerobject
-
fireRecordChange
public void fireRecordChange()fireRecordChange.
-
fireValueChange
public void fireValueChange()fireValueChange.
-
fireWriteEvent
public void fireWriteEvent()fireWriteEvent.
-
fireAlarmChange
public void fireAlarmChange()fireAlarmChange.
-
getAlarmSeverity
public gov.aps.jca.dbr.Severity getAlarmSeverity()Getter for the field
alarmSeverity.- Returns:
- a
Severityobject
-
getAlarmStatus
public gov.aps.jca.dbr.Status getAlarmStatus()Getter for the field
alarmStatus.- Returns:
- a
Statusobject
-
isAlarmUndefined
public boolean isAlarmUndefined()isAlarmUndefined.
- Returns:
- a boolean
-
isAlarm
public boolean isAlarm()isAlarm.
- Returns:
- a boolean
-
updateNoAlarm
public void updateNoAlarm()updateNoAlarm.
-
updateAlarm
public void updateAlarm(gov.aps.jca.dbr.Severity severity, gov.aps.jca.dbr.Status status) updateAlarm.
- Parameters:
severity- aSeverityobjectstatus- aStatusobject
-
updateAlarm
public void updateAlarm(gov.aps.jca.dbr.Severity severity, gov.aps.jca.dbr.Status status, boolean notify) updateAlarm.
- Parameters:
severity- aSeverityobjectstatus- aStatusobjectnotify- a boolean
-
getProcessor
Getter for the field
processor.- Returns:
- a
ValueProcessorobject
-
toString
-
copyFields
copyFields.
- Parameters:
record- aRecordobject
-
copyUnitsControlLimits
copyUnitsControlLimits.
- Parameters:
record- aRecordobject
-
copyFields
copyFields.
- Parameters:
md- aMetaDataobject
-
setValueAsString
setValueAsString.
- Parameters:
value- aStringobject
-
setMinMax
setMinMax.
-