Class EpicsChannelManager

java.lang.Object
gda.epics.connection.EpicsChannelManager
All Implemented Interfaces:
gov.aps.jca.event.ConnectionListener, gov.aps.jca.event.PutListener, EventListener

public class EpicsChannelManager extends Object implements gov.aps.jca.event.ConnectionListener, gov.aps.jca.event.PutListener
EPICS channel (connection, monitor) manager.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected Map<String,gov.aps.jca.Channel>
    Map of all handled channels.
    protected Set<gov.aps.jca.Channel>
     
    protected EpicsController
    EPICS controller.
    protected boolean
    Creation phase completed flag.
    protected boolean
    Destruction status.
    protected boolean
    Initialization status.
    protected Map<String,Object>
    Map of initial values of the channels.
    protected Map<gov.aps.jca.Channel,gov.aps.jca.event.MonitorListener>
    Monitors to be installed.
    protected Map<gov.aps.jca.event.MonitorListener,EpicsController.MonitorType>
    Type of monitors.
    protected Set<String>
    Map of all critical (non-optional) channels to be connected.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor.
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    connectionChanged(gov.aps.jca.event.ConnectionEvent event)
     
    gov.aps.jca.Channel
    Creates (optional) channel without monitor listener.
    gov.aps.jca.Channel
    createChannel(String pvName, boolean optional)
    Creates channel without monitor listener.
    gov.aps.jca.Channel
    createChannel(String pvName, gov.aps.jca.event.MonitorListener listener)
    Creates (optional) channel with monitor.
    gov.aps.jca.Channel
    createChannel(String pvName, gov.aps.jca.event.MonitorListener monitorListener, boolean optional)
    Create channel.
    gov.aps.jca.Channel
    createChannel(String pvName, gov.aps.jca.event.MonitorListener monitorListener, boolean optional, double initialValue)
    Create channel.
    gov.aps.jca.Channel
    createChannel(String pvName, gov.aps.jca.event.MonitorListener monitorListener, boolean optional, double[] initialValue)
    Create channel.
    gov.aps.jca.Channel
    createChannel(String pvName, gov.aps.jca.event.MonitorListener monitorListener, boolean optional, float initialValue)
    Create channel.
    gov.aps.jca.Channel
    createChannel(String pvName, gov.aps.jca.event.MonitorListener monitorListener, boolean optional, int initialValue)
    Create channel.
    gov.aps.jca.Channel
    createChannel(String pvName, gov.aps.jca.event.MonitorListener monitorListener, boolean optional, int[] initialValue)
    Create channel.
    gov.aps.jca.Channel
    createChannel(String pvName, gov.aps.jca.event.MonitorListener monitorListener, boolean optional, short initialValue)
    Create channel.
    gov.aps.jca.Channel
    createChannel(String pvName, gov.aps.jca.event.MonitorListener monitorListener, boolean optional, String initialValue)
    Create channel.
    gov.aps.jca.Channel
    createChannel(String pvName, gov.aps.jca.event.MonitorListener monitorListener, EpicsController.MonitorType monitorType, boolean optional)
    Create channel with Monitor type.
    void
    Notify channel manager that creation phase has completed, so that it can issue a initializatonCompleted callback.
    void
    Destroy all channels.
    gov.aps.jca.Channel
    Get channel (if created by this instance).
    Map<String,gov.aps.jca.Channel>
    Map of all handled channels
    void
    putCompleted(gov.aps.jca.event.PutEvent pev)
    Default (convenience) put listener - only prints out a message.
    boolean
    tryInitialize(long timeoutInMs)
    Checks if initialized (all critical channels are connected), if not waits until done or for timeoutInMs ms.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • controller

      protected EpicsController controller
      EPICS controller.
    • channels

      protected Map<String,gov.aps.jca.Channel> channels
      Map of all handled channels.
    • monitoredChannels

      protected Map<gov.aps.jca.Channel,gov.aps.jca.event.MonitorListener> monitoredChannels
      Monitors to be installed.
    • initialValues

      protected Map<String,Object> initialValues
      Map of initial values of the channels.
    • monitorTypes

      protected Map<gov.aps.jca.event.MonitorListener,EpicsController.MonitorType> monitorTypes
      Type of monitors.
    • unconnectedCriticalChannels

      protected Set<String> unconnectedCriticalChannels
      Map of all critical (non-optional) channels to be connected.
    • connectedCriticalChannels

      protected Set<gov.aps.jca.Channel> connectedCriticalChannels
    • initialized

      protected boolean initialized
      Initialization status. (sync on unconnectedCriticalChannels)
    • destroyed

      protected boolean destroyed
      Destruction status. (sync on channels)
    • creationPhaseCompleted

      protected boolean creationPhaseCompleted
      Creation phase completed flag. (sync on unconnectedCriticalChannels)
  • Constructor Details

    • EpicsChannelManager

      public EpicsChannelManager()
      Default constructor.
    • EpicsChannelManager

      public EpicsChannelManager(InitializationListener listener)
      Constructor.
      Parameters:
      listener - initialization listener.
  • Method Details

    • createChannel

      public gov.aps.jca.Channel createChannel(String pvName, gov.aps.jca.event.MonitorListener monitorListener, boolean optional) throws gov.aps.jca.CAException
      Create channel.
      Parameters:
      pvName -
      monitorListener -
      optional -
      Returns:
      JCA channel instance.
      Throws:
      gov.aps.jca.CAException
    • createChannel

      public gov.aps.jca.Channel createChannel(String pvName, gov.aps.jca.event.MonitorListener monitorListener, EpicsController.MonitorType monitorType, boolean optional) throws gov.aps.jca.CAException
      Create channel with Monitor type.
      Parameters:
      pvName -
      monitorListener -
      monitorType -
      optional -
      Returns:
      JCA channel instance.
      Throws:
      gov.aps.jca.CAException
    • createChannel

      public gov.aps.jca.Channel createChannel(String pvName, gov.aps.jca.event.MonitorListener monitorListener, boolean optional, double initialValue) throws gov.aps.jca.CAException
      Create channel.
      Parameters:
      pvName -
      monitorListener -
      optional -
      initialValue -
      Returns:
      JCA channel instance.
      Throws:
      gov.aps.jca.CAException
    • createChannel

      public gov.aps.jca.Channel createChannel(String pvName, gov.aps.jca.event.MonitorListener monitorListener, boolean optional, float initialValue) throws gov.aps.jca.CAException
      Create channel.
      Parameters:
      pvName -
      monitorListener -
      optional -
      initialValue -
      Returns:
      JCA channel instance.
      Throws:
      gov.aps.jca.CAException
    • createChannel

      public gov.aps.jca.Channel createChannel(String pvName, gov.aps.jca.event.MonitorListener monitorListener, boolean optional, int initialValue) throws gov.aps.jca.CAException
      Create channel.
      Parameters:
      pvName -
      monitorListener -
      optional -
      initialValue -
      Returns:
      JCA channel instance.
      Throws:
      gov.aps.jca.CAException
    • createChannel

      public gov.aps.jca.Channel createChannel(String pvName, gov.aps.jca.event.MonitorListener monitorListener, boolean optional, short initialValue) throws gov.aps.jca.CAException
      Create channel.
      Parameters:
      pvName -
      monitorListener -
      optional -
      initialValue -
      Returns:
      JCA channel instance.
      Throws:
      gov.aps.jca.CAException
    • createChannel

      public gov.aps.jca.Channel createChannel(String pvName, gov.aps.jca.event.MonitorListener monitorListener, boolean optional, String initialValue) throws gov.aps.jca.CAException
      Create channel.
      Parameters:
      pvName -
      monitorListener -
      optional -
      initialValue -
      Returns:
      JCA channel instance.
      Throws:
      gov.aps.jca.CAException
    • createChannel

      public gov.aps.jca.Channel createChannel(String pvName, gov.aps.jca.event.MonitorListener monitorListener, boolean optional, double[] initialValue) throws gov.aps.jca.CAException
      Create channel.
      Parameters:
      pvName -
      monitorListener -
      optional -
      initialValue -
      Returns:
      JCA channel instance.
      Throws:
      gov.aps.jca.CAException
    • createChannel

      public gov.aps.jca.Channel createChannel(String pvName, gov.aps.jca.event.MonitorListener monitorListener, boolean optional, int[] initialValue) throws gov.aps.jca.CAException
      Create channel.
      Parameters:
      pvName -
      monitorListener -
      optional -
      initialValue -
      Returns:
      JCA channel instance.
      Throws:
      gov.aps.jca.CAException
    • createChannel

      public gov.aps.jca.Channel createChannel(String pvName, boolean optional) throws gov.aps.jca.CAException
      Creates channel without monitor listener.
      Parameters:
      pvName -
      optional -
      Returns:
      JCA channel instance.
      Throws:
      gov.aps.jca.CAException
    • createChannel

      public gov.aps.jca.Channel createChannel(String pvName) throws gov.aps.jca.CAException
      Creates (optional) channel without monitor listener.
      Parameters:
      pvName -
      Returns:
      JCA channel instance.
      Throws:
      gov.aps.jca.CAException
    • createChannel

      public gov.aps.jca.Channel createChannel(String pvName, gov.aps.jca.event.MonitorListener listener) throws gov.aps.jca.CAException
      Creates (optional) channel with monitor.
      Parameters:
      pvName -
      listener -
      Returns:
      JCA channel instance.
      Throws:
      gov.aps.jca.CAException
    • connectionChanged

      public void connectionChanged(gov.aps.jca.event.ConnectionEvent event)
      Specified by:
      connectionChanged in interface gov.aps.jca.event.ConnectionListener
    • tryInitialize

      public boolean tryInitialize(long timeoutInMs)
      Checks if initialized (all critical channels are connected), if not waits until done or for timeoutInMs ms.
      Parameters:
      timeoutInMs -
      Returns:
      initialization status
    • putCompleted

      public void putCompleted(gov.aps.jca.event.PutEvent pev)
      Default (convenience) put listener - only prints out a message.
      Specified by:
      putCompleted in interface gov.aps.jca.event.PutListener
      See Also:
      • PutListener.putCompleted(gov.aps.jca.event.PutEvent)
    • getChannel

      public gov.aps.jca.Channel getChannel(String pvName)
      Get channel (if created by this instance).
      Parameters:
      pvName -
      Returns:
      channel instance or null
    • getChannels

      public Map<String,gov.aps.jca.Channel> getChannels()
      Map of all handled channels
      Returns:
      map of all handled channels.
    • destroy

      public void destroy()
      Destroy all channels.
    • creationPhaseCompleted

      public void creationPhaseCompleted()
      Notify channel manager that creation phase has completed, so that it can issue a initializatonCompleted callback. NOTE: this is needed not to issue the notification before all channels of a particular device are registered to the channel manager.