Class Database

java.lang.Object
org.scictrl.csshell.epics.server.Database

public class Database extends Object
Database is controller type of object for handling Record and Application objects and managing their lifecycle.
Author:
igor@scictrl.com
  • Field Details

    • PROPERTY_RECORDS

      public static final String PROPERTY_RECORDS
      Constant PROPERTY_RECORDS="records"
      See Also:
    • PROPERTY_APPLICATIONS

      public static final String PROPERTY_APPLICATIONS
      Constant PROPERTY_APPLICATIONS="applications"
      See Also:
    • CONFIG_ACTIVATION_MIN

      public static final String CONFIG_ACTIVATION_MIN
      Constant CONFIG_ACTIVATION_MIN="Activation.min"
      See Also:
    • CONFIG_ACTIVATION_DELAY

      public static final String CONFIG_ACTIVATION_DELAY
      Constant CONFIG_ACTIVATION_DELAY="Activation.delay"
      See Also:
  • Constructor Details

  • Method Details

    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener l)
      Adds listener to PROPERTY_RECORDS and PROPERTY_APPLICATIONS events. They are fired when a record or application has been added.
      Parameters:
      l - a listener to PROPERTY_RECORDS or PROPERTY_APPLICATIONS events
    • getServer

      public Server getServer()

      Getter for the field server.

      Returns:
      a Server object
    • getPeristencyStore

      public PersistencyStore getPeristencyStore()

      Getter for the field peristencyStore.

      Returns:
      a PersistencyStore object
    • getExecutor

      public ThreadPoolExecutor getExecutor()

      Getter for the field executor.

      Returns:
      a ThreadPoolExecutor object
    • schedule

      public void schedule(Runnable r, long delay)
      Schedule execution of Runnable within thread pool.
      Parameters:
      r - the Runnable to be scheduled
      delay - a long
    • schedule

      public void schedule(Runnable r, long delay, long period)
      Schedule execution of Runnable within thread pool.
      Parameters:
      r - the Runnable to be scheduled
      delay - a long
      period - a long
    • addAll

      public void addAll(Record[] records)
      Adds and registers all Record instances in array to this database. If Record instance contains an Application reference, then also the Application is added and registered. If this database instance has been activated, then also added Record and Application is being activated.
      Parameters:
      records - array with Record instance to be added
    • addRecord

      public void addRecord(Record record)

      addRecord.

      Parameters:
      record - a Record object
    • getRecord

      public Record getRecord(String name)

      getRecord.

      Parameters:
      name - a String object
      Returns:
      a Record object
    • getApplication

      public Application getApplication(String name)
      Returns Application instance with provided name, if registered, otherwise null.
      Parameters:
      name - the name of the Application instance
      Returns:
      Application with matching name or null
    • hasApplication

      public boolean hasApplication(String name)
      Returns true if an Application with provided name is registered.
      Parameters:
      name - the name of the Application instance
      Returns:
      true if an Application with provided name is registered
    • hasRecord

      public boolean hasRecord(String name)
      Returns true if an Record with provided name is registered.
      Parameters:
      name - the name of the Record instance
      Returns:
      true if an Record with provided name is registered
    • count

      public int count()
      Return count of registered Record instances.
      Returns:
      count of registered Record instances
    • applicationCount

      public int applicationCount()
      Return count of registered Application instances.
      Returns:
      count of registered Application instances
    • activate

      public void activate()
      Calls activate on all registered Record and Application 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

      public void activateNow(Record r)

      activateNow.

      Parameters:
      r - a Record object
    • getNames

      public String[] getNames()

      getNames.

      Returns:
      an array of String objects
    • getApplicationNames

      public String[] getApplicationNames()

      getApplicationNames.

      Returns:
      an array of String objects
    • getConnector

      public EPICSConnector getConnector()

      Getter for the field connector.

      Returns:
      a EPICSConnector object
    • recordsIterator

      public Iterator<Record> recordsIterator()

      recordsIterator.

      Returns:
      a Iterator object
    • getValue

      public Object getValue(String pv)
      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.
      Parameters:
      pv - a String object
      Returns:
      a Object object
    • getValueAsString

      public String getValueAsString(String pv)
      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.
      Parameters:
      pv - a String object
      Returns:
      a String object
    • isActive

      public boolean isActive()

      isActive.

      Returns:
      a boolean