Class LinkedValueProcessor

All Implemented Interfaces:
PropertyChangeListener, EventListener, ValueProcessor
Direct Known Subclasses:
ANDValueProcessor, EnumToBitsProcessor, ORValueProcessor

public class LinkedValueProcessor extends MemoryValueProcessor implements PropertyChangeListener

Value processor, which connects to provided remote names and captures their value. By default first value from array of linked values is used. Implementation can extend this behavior. To implement own processing of linked values, then override the processInput(ValueHolder[]) method.

Link works in both ways, setting this processor forwards value to remote link as well. Polynomial transformation can be used to convert value in both directions.

Author:
igor@scictrl.com
  • Field Details

    • input

      protected ValueLinks input
      Input value remote link.
  • Constructor Details

    • LinkedValueProcessor

      public LinkedValueProcessor()

      Constructor for LinkedValueProcessor.

  • Method Details

    • newProcessor

      public static final LinkedValueProcessor newProcessor(String name, gov.aps.jca.dbr.DBRType type, String description, String link)
      Creates processor, configures it and returns it embedded within the returned record.
      Parameters:
      name - name of the returned record
      type - type of the returned record
      description - the description of the record
      link - the link of the returned processor
      Returns:
      new record with embedded and configured processor
    • 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.
    • reconnect

      public void reconnect()

      reconnect.

    • reconnect

      public void reconnect(String name, String type)

      reconnect.

      Parameters:
      name - a String object
      type - a String object
    • reconnect

      public void reconnect(String[] names, String type)

      reconnect.

      Parameters:
      names - an array of String objects
      type - a String object
    • 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
    • setValue

      public void setValue(Object val)
      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:
      val - a Object object
    • propertyChange

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

      protected Object processInput(ValueLinks.ValueHolder[] inputValues)
      Override this method to provide own conversion from input values to new processor value.
      Parameters:
      inputValues - array wit input values
      Returns:
      new value which is set to this processor
    • isInvalid

      public boolean isInvalid()
      Returns true if links are connected and ready to be used.
      Returns:
      a boolean
    • printLinkDebug

      public void printLinkDebug(Appendable ap) throws IOException

      printLinkDebug.

      Parameters:
      ap - a Appendable object
      Throws:
      IOException - if any.