Class EmbeddedApplicationServer
java.lang.Object
org.scictrl.csshell.epics.server.application.AbstractApplication
org.scictrl.csshell.epics.server.application.EmbeddedApplicationServer
- All Implemented Interfaces:
Application
,OnDemandValueProcessor.ValueProvider
EmbeddedApplicationServer class.
- Author:
- igor@scictrl.com
-
Field Summary
Fields inherited from class org.scictrl.csshell.epics.server.application.AbstractApplication
database, DEFAULT_NAME_DELIMITER, dynamicRecordCreator, ERROR_SUM, LINK_ERROR, LINK_ERROR_STRING, links, log, name, NAME_DELIMITER, nameDelimiter, records
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addRecordChangeListener.void
addRecordWriteListener.connectLinks
(String name, String... linkNames) Starts ValueLink connection to provided list of link names.createRecord
(String name, String desc, boolean value) Creates new application record with Byte data type, which can be used as boolean record.createRecord
(String name, String desc, boolean value, boolean fixed) Creates new application record with Byte data type, which can be used as boolean record.createRecord
(String name, String desc, byte[] value) createRecord.createRecord
(String name, String desc, long timeout) Creates record with command processor.createRecord
(String name, String desc, gov.aps.jca.dbr.DBRType type, Object... value) Creates new application record with Byte data type, which can be used as boolean record.createRecord
(String name, String desc, Double min, Double max, String units, short precision, double[] value) Creates new application record with double array data type.createRecord
(String name, String desc, Double min, Double max, String units, short precision, Double value) Creates new application record with double data type.Creates new application record with double data type.Creates new application record with double data type.createRecord
(String name, String desc, String... value) Creates new application record with String array data type.createRecord
(String name, String desc, String[] labels, short value) Creates new application record with Enum data type.Returns Database instance which holds this applications's active records.The server instance which hosts this application.static final EmbeddedApplicationServer
newInstance
(String name) newInstance.protected void
notifyRecordChange
(String name, boolean alarmOnly) This method is called whenever record value changed for any record, which belongs to this application (it was added to the applicationAbstractApplication.addRecord(String, Record)
).protected void
notifyRecordWrite
(String name) This method is called whenever record value has been written for any record, which belongs to this application (it was added to the applicationAbstractApplication.addRecord(String, Record)
).void
shutdown()
Closes the application and shuts down the embedded server.void
Collects all created records from this application and starts new server with them.void
startServer
(Properties properties) Collects all created records from this application and starts new server wth them.Methods inherited from class org.scictrl.csshell.epics.server.application.AbstractApplication
activate, addRecord, addRecordOfCommandProcessor, addRecordOfMemoryValueProcessor, addRecordOfMemoryValueProcessor, addRecordOfMemoryValueProcessor, addRecordOfMemoryValueProcessor, addRecordOfMemoryValueProcessor, addRecordOfMemoryValueProcessor, addRecordOfMemoryValueProcessor, addRecordOfMemoryValueProcessor, addRecordOfMemoryValueProcessor, addRecordOfOnDemandProcessor, addRecordOfOnLinkValueProcessor, configure, configure, createNewStore, fullRecordName, getLinks, getName, getNameDelimiter, getNotNull, getRecord, getRecordErrorSum, getRecordLinkError, getRecordNames, getRecords, getStore, getStore, getValue, initialize, isActivated, isDynamicRecordCreator, log4debug, log4error, log4error, log4info, notifyLinkChange, processLinkChange, pushDoneCommandProcessor, reconnectLinks, resetOnDemandProcessor, restore, store, toString, updateErrorSum, updateErrorSum, updateLinkError, updateLinkError
-
Method Details
-
newInstance
newInstance.
- Parameters:
name
- aString
object- Returns:
- a
EmbeddedApplicationServer
object
-
startServer
public void startServer() throws org.apache.commons.configuration.ConfigurationException, RemoteException, gov.aps.jca.CAExceptionCollects all created records from this application and starts new server with them.- Throws:
org.apache.commons.configuration.ConfigurationException
- server errorRemoteException
- server errorgov.aps.jca.CAException
- server error
-
startServer
public void startServer(Properties properties) throws org.apache.commons.configuration.ConfigurationException, RemoteException, gov.aps.jca.CAException Collects all created records from this application and starts new server wth them.- Parameters:
properties
- aProperties
object- Throws:
org.apache.commons.configuration.ConfigurationException
- server errorRemoteException
- server errorgov.aps.jca.CAException
- server error
-
getServer
The server instance which hosts this application. It is available only afterstartServer()
has been called.- Returns:
- server instance which hosts this application
-
getDatabase
Returns Database instance which holds this applications's active records.- Returns:
- Database instance which holds this applications's active records
-
addRecordChangeListener
addRecordChangeListener.
- Parameters:
l
- aPropertyChangeListener
object
-
addRecordWriteListener
addRecordWriteListener.
- Parameters:
l
- aPropertyChangeListener
object
-
notifyRecordChange
This method is called whenever record value changed for any record, which belongs to this application (it was added to the applicationAbstractApplication.addRecord(String, Record)
). Implementation class should override this method to intercept the update.- Overrides:
notifyRecordChange
in classAbstractApplication
- Parameters:
name
- the name of record, that triggered change.alarmOnly
- iftrue
then only alarm has been changed
-
notifyRecordWrite
This method is called whenever record value has been written for any record, which belongs to this application (it was added to the applicationAbstractApplication.addRecord(String, Record)
). Implementation class should override this method to intercept the update.- Overrides:
notifyRecordWrite
in classAbstractApplication
- Parameters:
name
- the name of record, that triggered change.
-
createRecord
public Record createRecord(String name, String desc, Double min, Double max, String units, short precision, Double value) Creates new application record with double data type.- Parameters:
name
- the record name, together with application name as prefix makes PV name of record.desc
- the record descriptionmin
- the record field value for minimummax
- the record field value for maximumunits
- the record field value for unitsprecision
- the record field value for precisionvalue
- the record initial value- Returns:
- newly created record
-
createRecord
public Record createRecord(String name, String desc, Integer min, Integer max, String units, Integer value) Creates new application record with double data type.- Parameters:
name
- the record name, together with application name as prefix makes PV name of record.desc
- the record descriptionmin
- the record field value for minimummax
- the record field value for maximumunits
- the record field value for unitsvalue
- the record initial value- Returns:
- newly created record
-
createRecord
public Record createRecord(String name, String desc, Integer min, Integer max, String units, int[] value) Creates new application record with double data type.- Parameters:
name
- the record name, together with application name as prefix makes PV name of record.desc
- the record descriptionmin
- the record field value for minimummax
- the record field value for maximumunits
- the record field value for unitsvalue
- the record initial value- Returns:
- newly created record
-
createRecord
public Record createRecord(String name, String desc, Double min, Double max, String units, short precision, double[] value) Creates new application record with double array data type.- Parameters:
name
- the record name, together with application name as prefix makes PV name of record.desc
- the record descriptionmin
- the record field value for minimummax
- the record field value for maximumunits
- the record field value for unitsprecision
- the record field value for precisionvalue
- the record initial value- Returns:
- newly created record
-
createRecord
Creates new application record with Byte data type, which can be used as boolean record.- Parameters:
name
- the record name, together with application name as prefix makes PV name of record.desc
- the record descriptiontype
- aDBRType
objectvalue
- the record initial value- Returns:
- newly created record
-
createRecord
Creates new application record with Byte data type, which can be used as boolean record.- Parameters:
name
- the record name, together with application name as prefix makes PV name of record.desc
- the record descriptionvalue
- the record initial value- Returns:
- newly created record
-
createRecord
Creates new application record with Byte data type, which can be used as boolean record. Record value is fixed.- Parameters:
name
- the record name, together with application name as prefix makes PV name of record.desc
- the record descriptionvalue
- the record initial valuefixed
- iftrue
then record value is fixed and can not be changed- Returns:
- newly created record
-
createRecord
Creates new application record with String array data type.- Parameters:
name
- the record name, together with application name as prefix makes PV name of record.desc
- the record descriptionvalue
- the record initial value- Returns:
- newly created record
-
createRecord
createRecord.
-
createRecord
Creates new application record with Enum data type.- Parameters:
name
- the record name, together with application name as prefix makes PV name of record.desc
- the record descriptionlabels
- the record field with enum labelsvalue
- the record initial value- Returns:
- newly created record
-
createRecord
Creates record with command processor.- Parameters:
name
- the record name, together with application name as prefix makes PV name of record.desc
- the record descriptiontimeout
- timeout for command to return value to 0;- Returns:
- a
Record
object
-
connectLinks
Starts ValueLink connection to provided list of link names.- Overrides:
connectLinks
in classAbstractApplication
- Parameters:
name
- the unique name of ValueLink connectionlinkNames
- list of link names to be managed by single ValueLinks connection- Returns:
- a
ValueLinks
object - See Also:
-
shutdown
public void shutdown()Closes the application and shuts down the embedded server.
-