Class CommandValueProcessor

All Implemented Interfaces:
PropertyChangeListener, EventListener, ValueProcessor

public class CommandValueProcessor extends MemoryValueProcessor implements PropertyChangeListener
The Command Value Processor is intended for commands or actions, which are triggered from client (e.g. CSS) by sending 1 or true to this processor. Implementor should watch for write notification or change notification where new value is 1. Record will stay 1 until action is finished or timeout is expired. Implementor should signal this or by calling pushDone() or by setting value to false (or 0). Setting timeout will automatically flip value to 0 after timeout time has expired
Author:
igor@scictrl.com
  • Field Details

    • timeout

      protected long timeout

      After timeout period command value is returned to 0.

  • Constructor Details

    • CommandValueProcessor

      public CommandValueProcessor()

      Constructor for CommandValueProcessor.

  • Method Details

    • newProcessor

      public static final CommandValueProcessor newProcessor(String name, String description, long timeout)

      newProcessor.

      Parameters:
      name - a String object
      description - a String object
      timeout - a long
      Returns:
      a CommandValueProcessor object
    • configure

      public void configure(Record record, org.apache.commons.configuration.HierarchicalConfiguration config)
      Configures the internals of value processor, provides reference to parent record and to configuration with root inside processor tag. Parent record is not yet initialized, so does not have reference to Database, the Database reference will be available during activate call.
      Specified by:
      configure in interface ValueProcessor
      Overrides:
      configure in class MemoryValueProcessor
      Parameters:
      record - the parent record.
      config - configuration with room inside processor tag.
    • activate

      public void activate()
      Record has now reference to Database. processor might want to connect to other records on this server or PVs on other servers. This can not be done until all records from configuration has been loaded. Call to this method signals to the processor that records has been loaded and linking to other values can be commenced.
      Specified by:
      activate in interface ValueProcessor
      Overrides:
      activate in class MemoryValueProcessor
    • getTimeout

      public long getTimeout()

      Getter for the field timeout. After timeout period command value is returned to 0.

      Returns:
      a long
    • setTimeout

      public void setTimeout(long timeout)

      Setter for the field timeout. After timeout period command value is returned to 0.

      Parameters:
      timeout - a long
    • pushDone

      public void pushDone()

      pushDone.

    • setValue

      public void setValue(Object value)
      Sets new value to the processor. If value is different from current processor value, then event is fired. Timestamp is updated regardless if value is changed, since timestamp indicates last value update or confirmation. This method is used by remote EPICS entity or other record within same Database. By definition calling setValue must always update value, because further processing must be triggered.
      Specified by:
      setValue in interface ValueProcessor
      Overrides:
      setValue in class MemoryValueProcessor
      Parameters:
      value - a Object object
    • propertyChange

      public void propertyChange(PropertyChangeEvent evt)
      Specified by:
      propertyChange in interface PropertyChangeListener