ParameterNoticeBoard
Class NoticeBoardMultipleListener

java.lang.Object
  extended by ParameterNoticeBoard.NoticeBoardMultipleListener
All Implemented Interfaces:
iParameterNoticeBoard.ParameterNoticeBoardListenerOperations
Direct Known Subclasses:
ACAMHeaderMaintainer, ACAMModeMaintainer

public abstract class NoticeBoardMultipleListener
extends java.lang.Object
implements iParameterNoticeBoard.ParameterNoticeBoardListenerOperations

This is an abstract class which can be used by a subclass to register potentially multiple listeners on the noticeboard and be informed whenever there is an event on one of them items in the noticeboard. When there is an event on one of the monitored parameters, all of the parameters which were registered as to be monitored will be read back from the noticeboard and sent to be processed by the subclass.

The reason that I needed something like this is that in the case of the A&G box, we have four mirrors which can be placed in and out of the optical path. However, I need a single status value which will report which of mirrors is currently in place. As each of the mirror mechanisms are completely separate, I need something that will bring the status for all of these values together so that I may set this global mirror status value.

Note that this is not part of the parameter noticeboard application but it uses the noticeboard so it was sensible to put it in the parameter noticeboard package.

Version:
$Id: NoticeBoardMultipleListener.java,v 1.10 2008/12/09 10:21:17 cb Exp $
Author:
Craige Bevil

Nested Class Summary
(package private)  class NoticeBoardMultipleListener.ConnectToPNBItemsTimerTask
          This class will be used to connect a multiple listener to the parameter noticeboard so that it will be informed of when there is a change of one of the monitored parameters.
 
Field Summary
private  java.util.Timer connectToNBItemsTimer
          This is the timer which is associated with connecting to the noticeboard items in the parameter noticeboard.
 NoticeBoardMultipleListener.ConnectToPNBItemsTimerTask connectToPNBTimerTask
          This is a timertask which will be used to connect to the parameter noticeboard in order to set up the multiple listener.
protected  org.omg.CORBA.ORB orb
           
protected  iParameterNoticeBoard.ParameterNoticeBoardSupplier ParameterNoticeBoard
          This is reference to the remote proxy CORBA object which will be used to access the parameter noticeboard
 java.lang.String[] ParametersBeingMonitored
          Parameters which are currently being monitored by the class
private  iParameterNoticeBoard.ParameterNoticeBoardListener PNBListener
          This is a listener to the parameter noticeboard and will be informed by the parameter noticeboard when any of the monitored items change.
private  boolean RegisteredWithNoticeboardFlag
          Whether or not the class has been configured to recieve updates from the noticeboard.
 MessageHandler SyslogMessageHandler
          This is a syslog object which will be used to report errors etc
 
Constructor Summary
NoticeBoardMultipleListener(MessageHandler SyslogMessageHandler, org.omg.CORBA.ORB orb)
          Constructor
 
Method Summary
 void parameterChanged(java.lang.String ParameterName, org.omg.CORBA.Any ParameterValue)
          Implements the parameter changed callback which is part of the ParameterNoticeBoardListenerOperations interface and will be called when there is an event on a monitored parameter.
abstract  void parameterMonitorTerminated(java.lang.String Reason, java.lang.String ParameterName)
          Called by the parameter noticeboard when a susbcribed parameter has it's monitor cancelled.
protected abstract  void processEventData(NoticeBoardParameter[] ParameterEventData)
          This is an abstract method which is to be implemented by the subclass and will result in the semantics of the parameter event being executed.
 boolean startMonitoringParameters(java.lang.String[] ParametersToMonitor, org.omg.PortableServer.POA poa, iParameterNoticeBoard.ParameterNoticeBoardSupplier ParameterNoticeBoard)
          Register with the parameter noticeboard to be called back when one of the parameters which have been specified changes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PNBListener

private iParameterNoticeBoard.ParameterNoticeBoardListener PNBListener
This is a listener to the parameter noticeboard and will be informed by the parameter noticeboard when any of the monitored items change.


connectToNBItemsTimer

private java.util.Timer connectToNBItemsTimer
This is the timer which is associated with connecting to the noticeboard items in the parameter noticeboard.


connectToPNBTimerTask

public NoticeBoardMultipleListener.ConnectToPNBItemsTimerTask connectToPNBTimerTask
This is a timertask which will be used to connect to the parameter noticeboard in order to set up the multiple listener.


ParametersBeingMonitored

public java.lang.String[] ParametersBeingMonitored
Parameters which are currently being monitored by the class


SyslogMessageHandler

public MessageHandler SyslogMessageHandler
This is a syslog object which will be used to report errors etc


ParameterNoticeBoard

protected iParameterNoticeBoard.ParameterNoticeBoardSupplier ParameterNoticeBoard
This is reference to the remote proxy CORBA object which will be used to access the parameter noticeboard


orb

protected org.omg.CORBA.ORB orb

RegisteredWithNoticeboardFlag

private boolean RegisteredWithNoticeboardFlag
Whether or not the class has been configured to recieve updates from the noticeboard.

Constructor Detail

NoticeBoardMultipleListener

public NoticeBoardMultipleListener(MessageHandler SyslogMessageHandler,
                                   org.omg.CORBA.ORB orb)
                            throws java.lang.Exception
Constructor

Throws:
java.lang.Exception
Method Detail

parameterChanged

public void parameterChanged(java.lang.String ParameterName,
                             org.omg.CORBA.Any ParameterValue)
Implements the parameter changed callback which is part of the ParameterNoticeBoardListenerOperations interface and will be called when there is an event on a monitored parameter.

Specified by:
parameterChanged in interface iParameterNoticeBoard.ParameterNoticeBoardListenerOperations
Parameters:
ParameterName - The name of the parameter that the event occured upon.
ParameterValue - The new value of the parameter.

processEventData

protected abstract void processEventData(NoticeBoardParameter[] ParameterEventData)
This is an abstract method which is to be implemented by the subclass and will result in the semantics of the parameter event being executed.


parameterMonitorTerminated

public abstract void parameterMonitorTerminated(java.lang.String Reason,
                                                java.lang.String ParameterName)
Called by the parameter noticeboard when a susbcribed parameter has it's monitor cancelled. This method is abstract and it is expected that the subclass implements this method

Specified by:
parameterMonitorTerminated in interface iParameterNoticeBoard.ParameterNoticeBoardListenerOperations
Parameters:
Reason - This is the reason that the monitor was stopped
ParameterName - This is the name of the parameter

startMonitoringParameters

public boolean startMonitoringParameters(java.lang.String[] ParametersToMonitor,
                                         org.omg.PortableServer.POA poa,
                                         iParameterNoticeBoard.ParameterNoticeBoardSupplier ParameterNoticeBoard)
                                  throws UnableToMonitorNoticeBoard
Register with the parameter noticeboard to be called back when one of the parameters which have been specified changes

Parameters:
ParametersToMonitor - These are the parameters in the noticeboard which are to be monitored for changes.

poa - POA so that we can register this object as a CORBA object so that we can be informed when the monitored value changes.

ParameterNoticeBoard - This is a reference to the parameter noticeboard CORBA object
Throws:
UnableToMonitorNoticeBoard