Package org.scictrl.csshell.epics.server
Class Database
java.lang.Object
org.scictrl.csshell.epics.server.Database
Database is controller type of object for handling Record and Application objects and managing their lifecycle.
- Author:
- igor@scictrl.com
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate()Calls activate on all registeredRecordandApplicationinstances.voidactivateNow.voidactivationDelay.voidAdds and registers allRecordinstances in array to this database.voidAdds listener toPROPERTY_RECORDSandPROPERTY_APPLICATIONSevents.voidaddRecord.intReturn count of registeredApplicationinstances.intcount()Return count of registeredRecordinstances.voidCalled by the server during shutdown, deactivates the database.getApplication(String name) ReturnsApplicationinstance with provided name, if registered, otherwisenull.String[]getApplicationNames.Getter for the fieldconnector.Getter for the fieldexecutor.String[]getNames()getNames.Getter for the fieldperistencyStore.getRecord.Getter for the fieldserver.Tries to get value for the PV name.Tries to get value for the PV name.booleanhasApplication(String name) Returnstrueif anApplicationwith provided name is registered.booleanReturnstrueif anRecordwith provided name is registered.booleanisActive()isActive.recordsIterator.voidSchedule execution of Runnable within thread pool.voidSchedule execution of Runnable within thread pool.
-
Field Details
-
PROPERTY_RECORDS
ConstantPROPERTY_RECORDS="records"- See Also:
-
PROPERTY_APPLICATIONS
ConstantPROPERTY_APPLICATIONS="applications"- See Also:
-
CONFIG_ACTIVATION_MIN
ConstantCONFIG_ACTIVATION_MIN="Activation.min"- See Also:
-
CONFIG_ACTIVATION_DELAY
ConstantCONFIG_ACTIVATION_DELAY="Activation.delay"- See Also:
-
-
Constructor Details
-
Database
public Database(Server server) throws RemoteException, org.apache.commons.configuration.ConfigurationException Crate new instance with reference to aServer.- Parameters:
server- theServerreference, can not benull- Throws:
RemoteException- if creation ofEPICSConnectorfailsorg.apache.commons.configuration.ConfigurationException- if creation ofPersistencyStorefailsNullPointerException- if parameter 'server' is null
-
-
Method Details
-
addPropertyChangeListener
Adds listener toPROPERTY_RECORDSandPROPERTY_APPLICATIONSevents. They are fired when a record or application has been added.- Parameters:
l- a listener toPROPERTY_RECORDSorPROPERTY_APPLICATIONSevents
-
getServer
Getter for the field
server.- Returns:
- a
Serverobject
-
getPeristencyStore
Getter for the field
peristencyStore.- Returns:
- a
PersistencyStoreobject
-
getExecutor
Getter for the field
executor.- Returns:
- a
ThreadPoolExecutorobject
-
schedule
Schedule execution of Runnable within thread pool.- Parameters:
r- the Runnable to be scheduleddelay- a long
-
schedule
Schedule execution of Runnable within thread pool.- Parameters:
r- the Runnable to be scheduleddelay- a longperiod- a long
-
addAll
Adds and registers allRecordinstances in array to this database. IfRecordinstance contains anApplicationreference, then also theApplicationis added and registered. If this database instance has been activated, then also addedRecordandApplicationis being activated.- Parameters:
records- array withRecordinstance to be added
-
addRecord
addRecord.
- Parameters:
record- aRecordobject
-
getRecord
getRecord.
-
getApplication
ReturnsApplicationinstance with provided name, if registered, otherwisenull.- Parameters:
name- the name of theApplicationinstance- Returns:
Applicationwith matching name ornull
-
hasApplication
Returnstrueif anApplicationwith provided name is registered.- Parameters:
name- the name of theApplicationinstance- Returns:
trueif anApplicationwith provided name is registered
-
hasRecord
Returnstrueif anRecordwith provided name is registered. -
count
public int count()Return count of registeredRecordinstances.- Returns:
- count of registered
Recordinstances
-
applicationCount
public int applicationCount()Return count of registeredApplicationinstances.- Returns:
- count of registered
Applicationinstances
-
activate
public void activate()Calls activate on all registeredRecordandApplicationinstances. Called by the server during initialization. -
activationDelay
public void activationDelay()activationDelay.
-
deactivate
public void deactivate()Called by the server during shutdown, deactivates the database. -
activateNow
activateNow.
- Parameters:
r- aRecordobject
-
getNames
getNames.
- Returns:
- an array of
Stringobjects
-
getApplicationNames
getApplicationNames.
- Returns:
- an array of
Stringobjects
-
getConnector
Getter for the field
connector.- Returns:
- a
EPICSConnectorobject
-
recordsIterator
recordsIterator.
- Returns:
- a
Iteratorobject
-
getValue
Tries to get value for the PV name. It first try to locate local record in Database, if that fails, then makes remote EPICS get. -
getValueAsString
Tries to get value for the PV name. It first try to locate local record in Database, if that fails, then makes remote EPICS get. -
isActive
public boolean isActive()isActive.
- Returns:
- a boolean
-