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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
activate()
Calls activate on all registeredRecord
andApplication
instances.void
activateNow.void
activationDelay.void
Adds and registers allRecord
instances in array to this database.void
Adds listener toPROPERTY_RECORDS
andPROPERTY_APPLICATIONS
events.void
addRecord.int
Return count of registeredApplication
instances.int
count()
Return count of registeredRecord
instances.void
Called by the server during shutdown, deactivates the database.getApplication
(String name) ReturnsApplication
instance 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.boolean
hasApplication
(String name) Returnstrue
if anApplication
with provided name is registered.boolean
Returnstrue
if anRecord
with provided name is registered.boolean
isActive()
isActive.recordsIterator.void
Schedule execution of Runnable within thread pool.void
Schedule 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
- theServer
reference, can not benull
- Throws:
RemoteException
- if creation ofEPICSConnector
failsorg.apache.commons.configuration.ConfigurationException
- if creation ofPersistencyStore
failsNullPointerException
- if parameter 'server' is null
-
-
Method Details
-
addPropertyChangeListener
Adds listener toPROPERTY_RECORDS
andPROPERTY_APPLICATIONS
events. They are fired when a record or application has been added.- Parameters:
l
- a listener toPROPERTY_RECORDS
orPROPERTY_APPLICATIONS
events
-
getServer
Getter for the field
server
.- Returns:
- a
Server
object
-
getPeristencyStore
Getter for the field
peristencyStore
.- Returns:
- a
PersistencyStore
object
-
getExecutor
Getter for the field
executor
.- Returns:
- a
ThreadPoolExecutor
object
-
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 allRecord
instances in array to this database. IfRecord
instance contains anApplication
reference, then also theApplication
is added and registered. If this database instance has been activated, then also addedRecord
andApplication
is being activated.- Parameters:
records
- array withRecord
instance to be added
-
addRecord
addRecord.
- Parameters:
record
- aRecord
object
-
getRecord
getRecord.
-
getApplication
ReturnsApplication
instance with provided name, if registered, otherwisenull
.- Parameters:
name
- the name of theApplication
instance- Returns:
Application
with matching name ornull
-
hasApplication
Returnstrue
if anApplication
with provided name is registered.- Parameters:
name
- the name of theApplication
instance- Returns:
true
if anApplication
with provided name is registered
-
hasRecord
Returnstrue
if anRecord
with provided name is registered. -
count
public int count()Return count of registeredRecord
instances.- Returns:
- count of registered
Record
instances
-
applicationCount
public int applicationCount()Return count of registeredApplication
instances.- Returns:
- count of registered
Application
instances
-
activate
public void activate()Calls activate on all registeredRecord
andApplication
instances. 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
- aRecord
object
-
getNames
getNames.
- Returns:
- an array of
String
objects
-
getApplicationNames
getApplicationNames.
- Returns:
- an array of
String
objects
-
getConnector
Getter for the field
connector
.- Returns:
- a
EPICSConnector
object
-
recordsIterator
recordsIterator.
- Returns:
- a
Iterator
object
-
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
-