ParameterNoticeBoard
Class ParameterNoticeBoard

java.lang.Object
  extended by java.util.TimerTask
      extended by ParameterNoticeBoard.ParameterNoticeBoard
All Implemented Interfaces:
iInstrumentController.InstrumentControllerOperations, iParameterNoticeBoard.ParameterNoticeBoardSupplierOperations, java.lang.Runnable, ParameterNoticeBoardMBean

 class ParameterNoticeBoard
extends java.util.TimerTask
implements iParameterNoticeBoard.ParameterNoticeBoardSupplierOperations, iInstrumentController.InstrumentControllerOperations, ParameterNoticeBoardMBean

This class forms the Parameter NoticeBoard which is a CORBA object that forms the central noticeboard for CORBA based instrument controllers in the WHT OCS. It allows suppliers and consumers to connect to the noticeboard and will permit the values of named status items to be stored on the noticeboard by suppliers and subsequently retrieved by consumers.

The parameter noticeboard provides a subscription service which will allow consumers to subscribe to a named parameter in the noticeboard and the parameter noticeboard will in turn inform the listener object when the value of that parameter is modified. The supply of events to consumers is buffered. The first event received on a named parameter is immediately sent on to the listeners but subsequent events on the same parameter up for a specific time window are buffered. Further events which arrive on that parameter replace the previous event in the queue and after the delay time is reached, the last object put into the event queue is then broadcast to the listeners. Currently the delay window is about 1 second. The listener is always guaranteed to get the first and the last event of a stream of events.

Each item in the notice board will be a CORBA Any object and it will be up to the consumer to extract the values which are held within a status value which is provided by the notice board.

Once the notice board starts up, it will write a reference to the parameter noticeboard CORBA servant into the naming service on the local machine which can then be used by consumers and suppliers to locate the parameter noticeboard. Note that the reference that is written to the naming service is a persistent reference and as such can be reused after the parameter noticeboard has been restarted. The name of the reference in the naming service will be ParameterNoticeBoard and will be found in the root naming context.

The parameter noticeboard offers the concept of a persistent parameter which is saved across restarts of the system providing the ParameterNoticeBoard is closed down in the appropriate manner using the closeDown() method which can be invoked from the controllerCmd(1) application which is part of the observing system.

This file will be stored in the file /wht/var/parameterNoticeBoard-< hostname>.dat

This persistent CORBA server will run on TCP port 35675.

Version:
$Id: ParameterNoticeBoard.java,v 1.16 2005/02/10 1
Author:
Craige Bevil

Field Summary
private  java.util.concurrent.ConcurrentHashMap<java.lang.String,NoticeboardEvent> EventQueue
          This hash will be used to buffer events before they are broadcast to the subscribed event observers.
private  java.util.List<ListenerUpdate> ListenersToUpdate
          When a client attaches a listener to a NB item, we are unable to immediately send an update to that listener from that thread to avoid deadlock.
private  java.util.concurrent.ConcurrentHashMap<java.lang.String,java.util.concurrent.Future> ListenerUpdateThreads
          This is a hash map of the listener update threads which have instantiated.
private  java.util.concurrent.ExecutorService ListenerUpdateThreadService
          This is used for starting threads which will be used to update listeners when there are events on the parameters which they are subscribed to
private  java.util.Timer ListenerUpdateTimer
          This is a timer object which will be used for scheduling the update of the parameter noticeboard.
private  java.util.concurrent.ConcurrentHashMap<java.lang.String,NonResponsiveClient> NonResponsiveClientHash
          This is used to hold a list of all of the clients which are not reponsive so we can save ourselves the bother of attempting to communicate with them.
private  int NoOfUpdates
          This is the number of updates that have been recieved in the reporting period.
(package private)  org.omg.CORBA.ORB Orb
          This is a reference to the orb
private  java.util.concurrent.ConcurrentHashMap<java.lang.String,java.util.concurrent.ConcurrentHashMap<iParameterNoticeBoard.ParameterNoticeBoardListener,ParameterSubscriber>> ParameterCallbacks
          This is hash of CORBA objects provided by consumers of the noticeboard which will be informed when there is an event on the parameter for which it is subscribed.
private  java.lang.String PersistenceObjectFile
          The name of the file to write the persistence parameter data into (that is to say, parameters which are to be save across restarts of the system)
private  java.util.concurrent.ConcurrentHashMap PersistentParameters
          This hash will be used to store the persistent parameters which are to be stored across the restarts of this parameter noticeboard
private  java.util.concurrent.ConcurrentHashMap<java.lang.String,org.omg.CORBA.Any> RegisteredParameters
          This hash will be used to hold the values of the parameters which are currently registered in the parameter noticeboard.
private  MessageHandler SyslogMessageHandler
          This will be used to report errors and informational messages to the syslog by the noticeboard
private  int TimeToReportStatisticsCounter
          Whether it is time to report the usage statistics of the application
private static int TIMETOREPORTSTATISTICSPERIOD
          This is the period after which we should report the usage statistics in seconds
 
Constructor Summary
ParameterNoticeBoard(MessageHandler SyslogMessageHandler, org.omg.CORBA.ORB Orb, java.lang.String PersistanceDirectory)
          Constructor for the class.
 
Method Summary
private  boolean broadcastEvent(java.lang.String ParameterName, org.omg.CORBA.Any ParameterValue)
          Broadcast the specified event to all of the listeners which are registered to receive events on this parameter.
 void cancelAllEventSuscriptionForConsumer(java.lang.String ClientID)
          Allows a consumer to unsubscribe to all parameters for which it is subscribed.
 void cancelParameterSuscriptionForConsumer(java.lang.String ClientID, java.lang.String ParameterName)
          Allows a consumer to cancel it's subscription to updates which are associated with a parameter in the parameter noticeboard by specifying the client identifier that it registered itself with initially.
 void closeDown(java.lang.String CloseDownMessage)
          This is an obligation to the CORBA instrument controller interface which permits the application to be closed down in a controlled manner.
 boolean deleteParameter(java.lang.String ParameterName)
          This method is part of the ParameterNoticeBoardSupplierOperations CORBA servant interface which is to be implemented as part of this class.
 iParameterNoticeBoard.ParameterStruct[] fetchAllNoticeboardParameters()
          Returns all of the values which are currently in the noticeboard.
 java.lang.String[] fetchFullParameterList()
          This returns as a CORBA sequence, a list of the names of all of the parameters which are currently in the parameter noticeboard
 org.omg.CORBA.Any fetchParameter(java.lang.String ParameterName)
          Returns the value in the noticeboard which is associated with the requested parameter.
 iParameterNoticeBoard.ParameterStruct[] fetchParameterArray(java.lang.String[] ParametersToRetrieve)
          Returns the values in the noticeboard which are associated with the requested parameters.
 int getNoOfUpdates()
          This is part of the JMX interface to the application and returns the details of the no of updates which have been performed.
 int getNoOfUpdateThreads()
          This is part of the JMX interface to the application and returns the details of the number of update threads which are in existence.
 boolean handshake()
          This is an obligation to the CORBA instrument controller interface which permits a third party to ascertain if the instrument controller is responding.
static void main(java.lang.String[] args)
          This is the main method for this class, it will result in the parameter notice board being set up.
 int noOfActiveListeners(java.lang.String PNBItem)
          This is part of the JMX interface to the application and returns the details of the number of active listeners for a specific parameter noticeboard item.
private  boolean ReadNoticeboardItemPersistenceFile()
          Read in the object persistence file so restablish the items in the noticeboard.
 boolean registerEventListener(iParameterNoticeBoard.ParameterNoticeBoardListener EventListener, java.lang.String ParameterName)
          This method is part of the ParameterNoticeBoardSupplierOperations CORBA servant interface which is to be implemented as part of this class.
 boolean registerEventListenerWithID(iParameterNoticeBoard.ParameterNoticeBoardListener EventListener, java.lang.String ParameterName, java.lang.String ClientID)
          Allows a client to register a listener on a parameter using a identifier.
 boolean registerParameter(java.lang.String ParameterName)
          This method is part of the ParameterNoticeBoardSupplierOperations CORBA servant interface which is to be implemented as part of this class.
 boolean registerParameterWithExpiryTime(java.lang.String ParameterName, int ExpiryTime)
          This method is part of the ParameterNoticeBoardSupplierOperations CORBA servant interface which is to be implemented as part of this class.
 void run()
          This is the classes obligation for the TimerTask interface and will be called each time that the timer expires.
 void setDebugState(boolean DebugState)
          This is an obligation to the CORBA instrument controller interface which permits the debug of the application to be enabled or disabled.
 void setTraceLevel(double TraceLevel)
          This is an obligation to the CORBA instrument controller interface which permits the trace level of the application to be set, in this application there is no different trace levels enabled.
 void syncUpdateParameter(java.lang.String ParameterName, org.omg.CORBA.Any ParameterValue)
          Although I did not want to do this, I need to create a method which is not a oneway so that we can update the NB from TCL as the oneways do not seem to work from COMBAT
 void updateParameter(java.lang.String ParameterName, org.omg.CORBA.Any ParameterValue)
          This method is part of the ParameterNoticeBoardSupplierOperations CORBA servant interface which is to be implemented as part of this class.
 void updatePersistentParameter(java.lang.String ParameterName, org.omg.CORBA.Any ParameterValue)
          This method is part of the ParameterNoticeBoardSupplierOperations CORBA servant interface which is to be implemented as part of this class.
 void updatePersistentParameterArray(java.lang.String[] ParameterName, org.omg.CORBA.Any[] ParameterValue)
          This method is part of the ParameterNoticeBoardSupplierOperations CORBA servant interface which is to be implemented as part of this class.
 
Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NoOfUpdates

private int NoOfUpdates
This is the number of updates that have been recieved in the reporting period.


TIMETOREPORTSTATISTICSPERIOD

private static final int TIMETOREPORTSTATISTICSPERIOD
This is the period after which we should report the usage statistics in seconds

See Also:
Constant Field Values

NonResponsiveClientHash

private java.util.concurrent.ConcurrentHashMap<java.lang.String,NonResponsiveClient> NonResponsiveClientHash
This is used to hold a list of all of the clients which are not reponsive so we can save ourselves the bother of attempting to communicate with them.


TimeToReportStatisticsCounter

private int TimeToReportStatisticsCounter
Whether it is time to report the usage statistics of the application


ListenerUpdateThreads

private java.util.concurrent.ConcurrentHashMap<java.lang.String,java.util.concurrent.Future> ListenerUpdateThreads
This is a hash map of the listener update threads which have instantiated.


ListenerUpdateThreadService

private java.util.concurrent.ExecutorService ListenerUpdateThreadService
This is used for starting threads which will be used to update listeners when there are events on the parameters which they are subscribed to


ListenersToUpdate

private java.util.List<ListenerUpdate> ListenersToUpdate
When a client attaches a listener to a NB item, we are unable to immediately send an update to that listener from that thread to avoid deadlock. Instead we must do it from another thread (a timer thread). This data structure is used to store the details of the listeners which have registered so that they will be updated.


ListenerUpdateTimer

private final java.util.Timer ListenerUpdateTimer
This is a timer object which will be used for scheduling the update of the parameter noticeboard.


PersistenceObjectFile

private java.lang.String PersistenceObjectFile
The name of the file to write the persistence parameter data into (that is to say, parameters which are to be save across restarts of the system)


RegisteredParameters

private java.util.concurrent.ConcurrentHashMap<java.lang.String,org.omg.CORBA.Any> RegisteredParameters
This hash will be used to hold the values of the parameters which are currently registered in the parameter noticeboard. The hash uses the name of the parameter in order to index the value associated with it.


EventQueue

private java.util.concurrent.ConcurrentHashMap<java.lang.String,NoticeboardEvent> EventQueue
This hash will be used to buffer events before they are broadcast to the subscribed event observers. Events coming into the noticeboard are immediately broadcast to the listeners but if there is subsequently another event received on the same parameter within a defined time window, this subsequent event is held in a event buffer for that period of time. Once that period of time expires, the event in the buffer is then broadcast. This allows us to throttle back the rate of events which are distributed to a listener but at the same time ensure that he gets the first and the last event.


PersistentParameters

private java.util.concurrent.ConcurrentHashMap PersistentParameters
This hash will be used to store the persistent parameters which are to be stored across the restarts of this parameter noticeboard


ParameterCallbacks

private java.util.concurrent.ConcurrentHashMap<java.lang.String,java.util.concurrent.ConcurrentHashMap<iParameterNoticeBoard.ParameterNoticeBoardListener,ParameterSubscriber>> ParameterCallbacks
This is hash of CORBA objects provided by consumers of the noticeboard which will be informed when there is an event on the parameter for which it is subscribed.


SyslogMessageHandler

private MessageHandler SyslogMessageHandler
This will be used to report errors and informational messages to the syslog by the noticeboard


Orb

org.omg.CORBA.ORB Orb
This is a reference to the orb

Constructor Detail

ParameterNoticeBoard

ParameterNoticeBoard(MessageHandler SyslogMessageHandler,
                     org.omg.CORBA.ORB Orb,
                     java.lang.String PersistanceDirectory)
Constructor for the class. This retrieves the persistent parameter data which is stored in a file on the local file system thus preserving parameter data across restarts of the system.

Parameters:
SyslogMessageHandler - Used for reporting errors to syslog
Orb -
PersistanceDirectory - Dicretory into which to write the persistance data
Method Detail

ReadNoticeboardItemPersistenceFile

private boolean ReadNoticeboardItemPersistenceFile()
Read in the object persistence file so restablish the items in the noticeboard.

Returns:
boolean True if the file was read in without problem

fetchFullParameterList

public java.lang.String[] fetchFullParameterList()
                                          throws iParameterNoticeBoard.NoticeBoardEmptyException
This returns as a CORBA sequence, a list of the names of all of the parameters which are currently in the parameter noticeboard

Specified by:
fetchFullParameterList in interface iParameterNoticeBoard.ParameterNoticeBoardSupplierOperations
Returns:
java.lang.String[]
Throws:
iParameterNoticeBoard.NoticeBoardEmptyException - This is thrown when the notice board is empty when the call is made.
iParameterNoticeBoard.NoticeBoardEmptyException

fetchParameter

public org.omg.CORBA.Any fetchParameter(java.lang.String ParameterName)
                                 throws iParameterNoticeBoard.ParameterNotRegisteredException,
                                        iParameterNoticeBoard.ParameterNotSetException
Returns the value in the noticeboard which is associated with the requested parameter. If the parameter that is specified does not exist in the parameter noticeboard a ParameterNotRegisteredException exception will be raised. This method forms part of the CORBA interface to the parameter noticeboard and will be used by a CORBA clients in order to access the noticeboard.

Specified by:
fetchParameter in interface iParameterNoticeBoard.ParameterNoticeBoardSupplierOperations
Parameters:
ParameterName - This is the name of the parameter that the caller is requesting the value for.
Returns:
org.omg.CORBA.Any
Throws:
iParameterNoticeBoard.ParameterNotRegisteredException - If the specified parameter does not exist in the noticeboard.
iParameterNoticeBoard.ParameterNotSetException - This is raised when a client attempts to access a parameter which has been created but has not been set.
iParameterNoticeBoard.ParameterNotRegisteredException
iParameterNoticeBoard.ParameterNotSetException

fetchParameterArray

public iParameterNoticeBoard.ParameterStruct[] fetchParameterArray(java.lang.String[] ParametersToRetrieve)
                                                            throws iParameterNoticeBoard.ParameterNotRegisteredException,
                                                                   iParameterNoticeBoard.ParameterNotSetException
Returns the values in the noticeboard which are associated with the requested parameters. If any of the parameters that are specified doe not exist in the parameter noticeboard a ParameterNotRegisteredException exception will be raised.

This method forms part of the CORBA interface to the parameter noticeboard and will be used by CORBA clients in order to access the noticeboard.

Specified by:
fetchParameterArray in interface iParameterNoticeBoard.ParameterNoticeBoardSupplierOperations
Parameters:
ParametersToRetrieve - The names of the parameters that the caller is requesting the values for.
Returns:
ParameterStruct[] An array which contains the names and values of the values of the parameters which were requested.
Throws:
iParameterNoticeBoard.ParameterNotRegisteredException - If the specified parameters do not exist in the noticeboard.
iParameterNoticeBoard.ParameterNotSetException - This is raised when a client attempts to access a parameter which has been created but has not been set.
iParameterNoticeBoard.ParameterNotRegisteredException
iParameterNoticeBoard.ParameterNotSetException

registerEventListener

public boolean registerEventListener(iParameterNoticeBoard.ParameterNoticeBoardListener EventListener,
                                     java.lang.String ParameterName)
                              throws iParameterNoticeBoard.ParameterNotRegisteredException
This method is part of the ParameterNoticeBoardSupplierOperations CORBA servant interface which is to be implemented as part of this class. When called, it results in the CORBA object specified being added to the subscription list of objects that will be informed when the monitored value specified changes. Note that the event listener is sent a new update for the parameter that is monitored on the listener so that it may syncronise with the noticeboard. Note that for threading reasons this is done outside of the this thread by a timer task which is running in the background so the client may have to wait up to a second for the update to come through.

Specified by:
registerEventListener in interface iParameterNoticeBoard.ParameterNoticeBoardSupplierOperations
Parameters:
ParameterName - The name of the parameter for which the consumer would like to be informed of updates for.
EventListener - This is a EventListener CORBA object which will have methods on it called when there is an event on the parameter for which it is associated.
Returns:
boolean Returns true if the operation completes successfully
Throws:
iParameterNoticeBoard.ParameterNotRegisteredException - Thrown if the parameter that is specified is not registered.
iParameterNoticeBoard.ParameterNotRegisteredException

registerEventListenerWithID

public boolean registerEventListenerWithID(iParameterNoticeBoard.ParameterNoticeBoardListener EventListener,
                                           java.lang.String ParameterName,
                                           java.lang.String ClientID)
                                    throws iParameterNoticeBoard.ParameterNotRegisteredException
Allows a client to register a listener on a parameter using a identifier. This identifier is used throughout the parameter noticeboard in order to optimise event updates. For example, in the case of a client going away, the parameter noticeboard will ensure that it does not send pointless updates to a listener application which has gone away.

Specified by:
registerEventListenerWithID in interface iParameterNoticeBoard.ParameterNoticeBoardSupplierOperations
Parameters:
ParameterName - The name of the parameter for which the consumer would like to be informed of updates for.
EventListener - This is a EventListener CORBA object which will have methods on it called when there is an event on the parameter for which it is associated.
ClientID - This is the tag which will be used to identify the parameter noticeboard consumer.
Returns:
boolean Returns true if the operation completes successfully
Throws:
iParameterNoticeBoard.ParameterNotRegisteredException - Thrown if the parameter that is specified is not registered.

registerParameterWithExpiryTime

public boolean registerParameterWithExpiryTime(java.lang.String ParameterName,
                                               int ExpiryTime)
                                        throws iParameterNoticeBoard.ParameterAlreadyRegisteredException
This method is part of the ParameterNoticeBoardSupplierOperations CORBA servant interface which is to be implemented as part of this class. Calling the method results in the named parameter being added to the notice board and it's associated value being set to null.

The expiry time is how long the status value is considered value after being updated. This time is expressed in milliseconds

Specified by:
registerParameterWithExpiryTime in interface iParameterNoticeBoard.ParameterNoticeBoardSupplierOperations
Parameters:
ParameterName - The name of the new parameter which is to be added to the noticeboard.
ExpiryTime - Delay in milliseconds after status value has been updated before the status value is considered out of date.
Throws:
iParameterNoticeBoard.ParameterAlreadyRegisteredException - Thrown if the parameter is already registered.
iParameterNoticeBoard.ParameterAlreadyRegisteredException

registerParameter

public boolean registerParameter(java.lang.String ParameterName)
                          throws iParameterNoticeBoard.ParameterAlreadyRegisteredException
This method is part of the ParameterNoticeBoardSupplierOperations CORBA servant interface which is to be implemented as part of this class. Calling the method results in the named parameter being added to the notice board and it's associated value being set to null

Specified by:
registerParameter in interface iParameterNoticeBoard.ParameterNoticeBoardSupplierOperations
Parameters:
ParameterName - The name of the new parameter which is to be added to the noticeboard
Returns:
boolean
Throws:
iParameterNoticeBoard.ParameterAlreadyRegisteredException - Thrown if the parameter is already registered.
iParameterNoticeBoard.ParameterAlreadyRegisteredException

deleteParameter

public boolean deleteParameter(java.lang.String ParameterName)
                        throws iParameterNoticeBoard.ParameterNotRegisteredException
This method is part of the ParameterNoticeBoardSupplierOperations CORBA servant interface which is to be implemented as part of this class. This will remove the named parameter from the noticeboard.

Note that any event listeners which are subscribed to this parameter will be removed as well. On removing an event listener, the method calls the parameterMonitorTerminated on the listener object so that the listener is aware that the subscription to the parameter has been cancelled by the noticeboard.

Specified by:
deleteParameter in interface iParameterNoticeBoard.ParameterNoticeBoardSupplierOperations
Parameters:
ParameterName - The name of the parameter which is to be removed from the noticeboard
Returns:
boolean
Throws:
iParameterNoticeBoard.ParameterNotRegisteredException - Thrown if the parameter is not registered.
iParameterNoticeBoard.ParameterNotRegisteredException

syncUpdateParameter

public void syncUpdateParameter(java.lang.String ParameterName,
                                org.omg.CORBA.Any ParameterValue)
Although I did not want to do this, I need to create a method which is not a oneway so that we can update the NB from TCL as the oneways do not seem to work from COMBAT

Specified by:
syncUpdateParameter in interface iParameterNoticeBoard.ParameterNoticeBoardSupplierOperations
Parameters:
ParameterName - The name of the parameter which is to have it's parameter updated
ParameterValue - This is the new value of the parameter.

updatePersistentParameter

public void updatePersistentParameter(java.lang.String ParameterName,
                                      org.omg.CORBA.Any ParameterValue)
This method is part of the ParameterNoticeBoardSupplierOperations CORBA servant interface which is to be implemented as part of this class. This method will be used to update the value associated with a parameter in the noticeboard. Note that any CORBA consumers which are subscribed to the parameter will be informed through a call to their parameterChanged methods. Note that if the parameter that is specified does not exist, it will be automatically registered with the noticeboard ahead of updating it's value.

Additionally the parameter specified will be considered persistent and as such will be stored across restarts of the parameter noticeboard.

Specified by:
updatePersistentParameter in interface iParameterNoticeBoard.ParameterNoticeBoardSupplierOperations
Parameters:
ParameterName - The name of the parameter which is to have it's parameter updated
ParameterValue - This is the new value of the parameter.

updatePersistentParameterArray

public void updatePersistentParameterArray(java.lang.String[] ParameterName,
                                           org.omg.CORBA.Any[] ParameterValue)
This method is part of the ParameterNoticeBoardSupplierOperations CORBA servant interface which is to be implemented as part of this class. This method will be used to update the values associated with the parameters specified in the array in the noticeboard. Note that any CORBA consumers which are subscribed to the parameter will be informed through a call to their parameterChanged methods. Note that if the parameter that is specified does not exist, it will be automatically registered with the noticeboard ahead of updating it's value.

Additionally the parameter specified will be considered persistent and as such will be stored across restarts of the parameter noticeboard.

Specified by:
updatePersistentParameterArray in interface iParameterNoticeBoard.ParameterNoticeBoardSupplierOperations
Parameters:
ParameterName - The name of the parameter which is to have it's parameter updated
ParameterValue - This is the new value of the parameter.

updateParameter

public void updateParameter(java.lang.String ParameterName,
                            org.omg.CORBA.Any ParameterValue)
This method is part of the ParameterNoticeBoardSupplierOperations CORBA servant interface which is to be implemented as part of this class. This method will be used to update the value associated with a parameter in the noticeboard. Note that any CORBA consumers which are subscribed to the parameter will be informed through a call to their parameterChanged methods. Note that if the parameter that is specified does not exist, it will be automatically registered with the noticeboard ahead of updating it's value.

Specified by:
updateParameter in interface iParameterNoticeBoard.ParameterNoticeBoardSupplierOperations
Parameters:
ParameterName - The name of the parameter which is to have it's parameter updated
ParameterValue - This is the new value of the parameter.

setDebugState

public void setDebugState(boolean DebugState)
This is an obligation to the CORBA instrument controller interface which permits the debug of the application to be enabled or disabled.

Specified by:
setDebugState in interface iInstrumentController.InstrumentControllerOperations
Specified by:
setDebugState in interface ParameterNoticeBoardMBean
Parameters:
DebugState - Whether or not debug should be enabled or disabled.

setTraceLevel

public void setTraceLevel(double TraceLevel)
This is an obligation to the CORBA instrument controller interface which permits the trace level of the application to be set, in this application there is no different trace levels enabled.

Specified by:
setTraceLevel in interface iInstrumentController.InstrumentControllerOperations
Parameters:
TraceLevel - The expected trace level of the application when debug is enabled.

closeDown

public void closeDown(java.lang.String CloseDownMessage)
This is an obligation to the CORBA instrument controller interface which permits the application to be closed down in a controlled manner. Before closing down the method saves the persistent parameter data to a file so that it can be restored when the application is restarted at a later point.

Specified by:
closeDown in interface iInstrumentController.InstrumentControllerOperations
Parameters:
CloseDownMessage - The text of a message which is to be put into the syslog when the application closes down

handshake

public boolean handshake()
This is an obligation to the CORBA instrument controller interface which permits a third party to ascertain if the instrument controller is responding. The application should return true in the case that the application is working fine

Specified by:
handshake in interface iInstrumentController.InstrumentControllerOperations
Returns:
boolean true if the application is responding

run

public void run()
This is the classes obligation for the TimerTask interface and will be called each time that the timer expires. The reason that we have this is that when a listener attaches to a monitor, it needs to be called back with the value of the parameter which was monitored immediately. We cannot unfortunately do this from the thread which registers the listener as there will be deadlock between the two parties

Specified by:
run in interface java.lang.Runnable
Specified by:
run in class java.util.TimerTask

cancelParameterSuscriptionForConsumer

public void cancelParameterSuscriptionForConsumer(java.lang.String ClientID,
                                                  java.lang.String ParameterName)
Allows a consumer to cancel it's subscription to updates which are associated with a parameter in the parameter noticeboard by specifying the client identifier that it registered itself with initially.

Specified by:
cancelParameterSuscriptionForConsumer in interface iParameterNoticeBoard.ParameterNoticeBoardSupplierOperations
Parameters:
ClientID - This is the ID with which the consumer initially registered for updates from the parameter with.

ParameterName - This is the name of the parameter which the client no longer wants to be subscribed to.

cancelAllEventSuscriptionForConsumer

public void cancelAllEventSuscriptionForConsumer(java.lang.String ClientID)
Allows a consumer to unsubscribe to all parameters for which it is subscribed.

Specified by:
cancelAllEventSuscriptionForConsumer in interface iParameterNoticeBoard.ParameterNoticeBoardSupplierOperations
Parameters:
ClientID - This is the identifier which the client used when initially subscribing to the noticeboard.

broadcastEvent

private boolean broadcastEvent(java.lang.String ParameterName,
                               org.omg.CORBA.Any ParameterValue)
Broadcast the specified event to all of the listeners which are registered to receive events on this parameter.

Parameters:
ParameterName - This is the name of the parameter which is to be broadcast to the listeners
ParameterValue - This is the value of parameter which is to be broadcast.
Returns:
boolean True if the update was broadcast, false otherwise

fetchAllNoticeboardParameters

public iParameterNoticeBoard.ParameterStruct[] fetchAllNoticeboardParameters()
                                                                      throws iParameterNoticeBoard.ParameterNotRegisteredException,
                                                                             iParameterNoticeBoard.ParameterNotSetException
Returns all of the values which are currently in the noticeboard.

This method forms part of the CORBA interface to the parameter noticeboard and will be used by CORBA clients in order to access the noticeboard.

Specified by:
fetchAllNoticeboardParameters in interface iParameterNoticeBoard.ParameterNoticeBoardSupplierOperations
Returns:
ParameterStruct[] An array which contains the names and values of the values of the parameters which were requested.
Throws:
iParameterNoticeBoard.ParameterNotRegisteredException - If the specified parameters do not exist in the noticeboard. which has been created but has not been set.
iParameterNoticeBoard.ParameterNotRegisteredException
iParameterNoticeBoard.ParameterNotSetException

main

public static void main(java.lang.String[] args)
This is the main method for this class, it will result in the parameter notice board being set up. This will result in a CORBA servant reference called ParameterNoticeBoard being put into the root context of the CORBA naming service on the local machine so that other clients on the network can find the notice board.

One should note that the parameter noticboard uses jacorb and has it's own peculiar jacorb configuration file which is stored in ParameterNoticeboard.properties. Configuring the name of the file which is to be used is performed by setting the system property ORBid which will be used to name the ORB but also instruct jacorb to look for the properties file for that particular ORBid. This is all outlined in the jacorb documentation.

Parameters:
args -

getNoOfUpdates

public int getNoOfUpdates()
This is part of the JMX interface to the application and returns the details of the no of updates which have been performed.

Specified by:
getNoOfUpdates in interface ParameterNoticeBoardMBean

noOfActiveListeners

public int noOfActiveListeners(java.lang.String PNBItem)
This is part of the JMX interface to the application and returns the details of the number of active listeners for a specific parameter noticeboard item.

Specified by:
noOfActiveListeners in interface ParameterNoticeBoardMBean
Parameters:
PNBItem - The name of the parameter noticeboard item.

getNoOfUpdateThreads

public int getNoOfUpdateThreads()
This is part of the JMX interface to the application and returns the details of the number of update threads which are in existence.

Specified by:
getNoOfUpdateThreads in interface ParameterNoticeBoardMBean