"WEBNMS_5 API Docs"

com.adventnet.nms.util
Interface ClientConnectionObserver

All Superinterfaces:
java.rmi.Remote

public interface ClientConnectionObserver
extends java.rmi.Remote

This is the interface that needs to be implemented for getting notification when a user tries to Login, Logout and Login Failure using Application,Applet, Webstart and WebClient. To Listen for notification , users should implement this interface and register with the GenericBEAPI using GenericBEAPI#registerClientConnectionObserver(ClientConnectionObserver co) method. When the user performs tries to login or logout, the handleClientConnection method of each of the observer will be called, in the order they registered with the information about the change. If you no longer want to receive notification then you can do so by unregistering the ClientConnectionObserver using GenericBEAPI#deregisterClientConnectionObserver(ClientConnectionObserver co) method

The class implementing this interface can listen for notifications through RMI too. To use RMI, get the GenericBEAPI reference through RMI and register. The Object registering also has to export itself by invoking the java.rmi.server.UnicastRemoteObject.exportObject();, if it is not an instance of a class that extends UnicastRemoteObject.


    code snippet for registering as a ClientConnectionObserver:
    try{
                GenericBEAPI genericApi = (GenericBEAPI)Naming.lookup("//localhost:1099/GenericBEAPI");
                System.out.println("successfully got the handle");
                
                //creating an instance of class that implements TopoObserver
                SampleClientConnectionObserver toReg= new SampleClientConnectionObserver();

                // export the object before registering
                java.rmi.server.UnicastRemoteObject.exportObject(toReg);
                boolean result=genericApi.register(toReg);
                System.out.println("registed as TopoObserver"+result);
                
        }
        catch( Exception e)
        {
                System.out.println("Exception occured "+e);
      }
    

See Also:
GenericBEAPI.registerClientConnectionObserver(ClientConnectionObserver), GenericBEAPI.deregisterClientConnectionObserver(ClientConnectionObserver)

Method Summary
 void handleClientConnection(java.lang.String typeOfNotification, java.util.Properties clientProperties)
          * This method is invoked when a client login or logout is to be notified to the Observer.
 

Method Detail

handleClientConnection

void handleClientConnection(java.lang.String typeOfNotification,
                            java.util.Properties clientProperties)
                            throws java.rmi.RemoteException
* This method is invoked when a client login or logout is to be notified to the Observer. The first argument defines the operation performed by the user.The operation can be
 type            Details
 

"Login_Success" Implies that a user has performed a login to the client and the user login successfully

"Login_Failure" Implies that a user has performed a login to the client and the user was not able to Login.

"Logout" Implies either the user has logout from the client or the client has been terminated by other sources.

 

The second argument is the Properties that would be sent along with the TypeOfNotification. The properties shall be PropertyKey PropertyValue

"CLIENT_IPADDRESS" The IP address of the client that is trying to connect or that is connected with the server.

"FE_SERVER_PORT" The port in which the server is listening for the Client

"FE_SERVER_NAMES" The hostname of the server.

"CLIENT_TYPE" The type of client

"SERVER_TYPE" The type of Server, whether BE or FE

"USER_NAME" The name of the user who is trying to connect or who has been connected.

"REQUEST_TIME" The time in which the Request was generated by the Client.The time would correspond to the BE Server.

"OPERATION_INFO" INFORMATION related to LoginFailure or Logout.

Parameters:
typeOfNotification - String, identifying the client login, logout or loginFailure.
clientProperties - Properties related to the client connection
Throws:
java.rmi.RemoteException - in case of any error

"WEBNMS_5 API Docs"

Copyright © 2013 ZOHO Corp., All Rights Reserved.