com.genesyslab.ail
Class PsdkConfigBridge

java.lang.Object
  extended by com.genesyslab.ail.PsdkConfigBridge

public class PsdkConfigBridge
extends java.lang.Object

Retrieves the ConfServerProtocol instance that the AIL uses to access the Configuration Server.

To track config server connections and disconnections, create and add a ServiceListener to the AilFactory to get events for status changes on ServiceStatus objects of type Config. You can get the Switch instance through the corresponding ServiceStatus instance, as shown here:

public class SimpleServiceListener implements ServiceListener {
    AilFactory myFactory;
    public void SimpleServiceListener(AilFactory _myFactory) {
        myFactory = _myFactory ;
        myFactory.addServiceListener(ServiceStatus.Type.CONFIG,this);
    }
    public void serviceStatusChanged(ServiceStatus.Type service_type, java.lang.String service_name, ServiceStatus.Status service_status) {
        // handle Service.Status on disconnections
        if(service_status == ServiceStatus.Status.OFF) {
            //...
            ServiceStatus srv_status = myFactory.getServiceStatus(service_name);
            //...
        }
    }
}


Nested Class Summary
static interface PsdkConfigBridge.Listener
          This listener interface allows you to receive the messages that AIL gets through its ConfServerProtocol instance.
 
Method Summary
static void addConfigServerListener(PsdkConfigBridge.Listener handler)
          Adds a listener for the ConfServerProtocol instance.
static com.genesyslab.platform.configuration.protocol.ConfServerProtocol getConfigServerProtocol()
          Returns the ConfServerProtocol instance that the AIL uses.
static void removeConfigServerListener(PsdkConfigBridge.Listener handler)
          Removes a listener previously added.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getConfigServerProtocol

public static com.genesyslab.platform.configuration.protocol.ConfServerProtocol getConfigServerProtocol()

Returns the ConfServerProtocol instance that the AIL uses.
Note: According to the ConfServerProtocol status, requests sent to the Configuration Server may not be processed. In addition, Genesys recommends that you do not issue actions that could interfere with the AIL.

Returns:
A ConfServerProtocol instance.

addConfigServerListener

public static void addConfigServerListener(PsdkConfigBridge.Listener handler)

Adds a listener for the ConfServerProtocol instance.

If the Configuration Server disconnects, the listener reference set for the corresponding ConfServerProtocol instance is lost and you must register for this listener again. To get notified of disconnections, implement a ServiceListener class.

As the AIL calls the listener from its internal thread that reads the events from the ConfServerProtocol instance, you should not implement the events' processing in the handle() method. When you implement a Listener instance, Genesys recommends using threads to process events, as shown in the following code snippet:

For example, create a handler to dispatch the Message in a queue:

QueuedExecutor mQueue = new QueuedExecutor();

PsdkConfigBridge.Listener mListener = new PsdkConfigBridge.Listener() {
        public void handle( final Message message ) {
            mQueue.execute( new Runnable() {
                public void run() {
                    myHandler( message );
                }
            } );
        }
    };

PsdkConfigBridge.addListener( mListener );

//...

public void myHandler( Message message ) {
...
}


removeConfigServerListener

public static void removeConfigServerListener(PsdkConfigBridge.Listener handler)

Removes a listener previously added. Note that if the Configuration Server disconnects from the application, the listener reference is lost and you do not need to remove your listener.