queued.sdk.java.examples
Class SimpleMonitorQueue

java.lang.Object
  extended byqueued.sdk.java.examples.SimpleService
      extended byqueued.sdk.java.examples.SimpleMonitorQueue
Direct Known Subclasses:
SimpleMonitorInteraction

public class SimpleMonitorQueue
extends SimpleService

Monitors queues. This example uses a GUI application to show how to monitor queues (QILQueue objects):

PLEASE NOTE: This code example will not work unless you edit the configuration data in OpenMediaSdk.properties so that it matches objects that already exist in your local Configuration Layer.

There are several steps needed to prepare an application to use the services of the Queued Interaction Java Library. This example uses the services of other classes to carry out these functions.



This code example uses the folowing application blocks:


Nested Class Summary
 class SimpleMonitorQueue.SelectedQueueListener
          Monitors the user selection in the Queues table.
 
Constructor Summary
SimpleMonitorQueue(java.lang.String windowTitle)
          Creates an instance of SimpleMonitorQueue.
 
Method Summary
 QILQueue getQueue(java.lang.String queueID)
          Retrieves a QILQueue instance.
 void handleQueueEvent(QILQueueEvent event)
          Receives QILQueueEvent events, which report changes in a queue.
 void handleQueueSelectionAt(int selectedRow)
          Gets the queue object associated with the row selected in the Queues table.
 void linkWidgetsToGui()
          Links QIL information to GUI components.
static void main(java.lang.String[] args)
           
 void setExampleType()
          Indicates which example is running.
 void setQueueWidgets(java.lang.String queueName)
          Updates the widgets associated with the selected queue (if needed).
 void startMonitoring(java.lang.String queueName)
          Starts monitoring a queue.
 void stopMonitoring(java.lang.String queueName)
          Stops monitoring a queue.
 
Methods inherited from class queued.sdk.java.examples.SimpleService
handleServiceEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleMonitorQueue

public SimpleMonitorQueue(java.lang.String windowTitle)
Creates an instance of SimpleMonitorQueue.

Parameters:
windowTitle - The title of the GUI window for this example.
Method Detail

main

public static void main(java.lang.String[] args)

setExampleType

public void setExampleType()
Indicates which example is running. This method tells the OpenMediaSdkGui class which example has called the GUI, so that OpenMediaSdkGui can determine which widgets will be enabled when the GUI is created.

Overrides:
setExampleType in class SimpleService

linkWidgetsToGui

public void linkWidgetsToGui()
Links QIL information to GUI components. The OpenMediaSdkGui class creates a single graphical user interface that is used by each of the Queued SDK Java Library code examples. This GUI contains all of the widgets used by the examples, but they are only placeholders. That is, they have no functionality when they are created in the GUI class.

When an example is run, the linkWidgetsToGui() method is used to associate these widgets with the appropriate fields in the example class, as shown here:

startButton = sdkGui.startButton;

In many cases, particularly for buttons and radio buttons, these fields are then linked to actions that correspond to the functions they are designed to carry out.

Overrides:
linkWidgetsToGui in class SimpleService

getQueue

public QILQueue getQueue(java.lang.String queueID)
Retrieves a QILQueue instance.
This method manages exception thrown by displaying an error message in the log window.
This method uses the GetQueue Application Block's guidelines.

Parameters:
queueID - ID of the queue.
Returns:
instance of a queue or if not found or the connection is loss then a null is returned.

startMonitoring

public void startMonitoring(java.lang.String queueName)
Starts monitoring a queue.
This method uses the StartMonitoringQueue Application Block's guidelines.


stopMonitoring

public void stopMonitoring(java.lang.String queueName)
Stops monitoring a queue.
This method uses the StartMonitoringQueue Application Block's guidelines.


handleQueueEvent

public void handleQueueEvent(QILQueueEvent event)
Receives QILQueueEvent events, which report changes in a queue. If you implement the QILQueueListener interface, you must implement this method.

This method uses a QueueEventThread to update the Queues table that lists available queues, and to log these QILQueueEvents as they occur.

This method's design conforms to the MyQueueListener Application Block.


handleQueueSelectionAt

public void handleQueueSelectionAt(int selectedRow)
Gets the queue object associated with the row selected in the Queues table. Updates the associated panels with queue information. This method is called by the SelectedQueueListener when the user selects a queue.


setQueueWidgets

public void setQueueWidgets(java.lang.String queueName)
Updates the widgets associated with the selected queue (if needed).