5.20.4 Talking with Configuration Server

 

Any client application needs to send its request to the Configuration Server using the ConfigClient.  The ConfigClient communicates with the ConfigServer through RMI or TCP and sends the XML. The result of the operation is received by registering for the responses using ConfigResultListener

 

Hence, in order for the client to perform any operation that involves the role of ConfigServer like the operations on task, device list or datasource, the instance of ConfigClient has to be got.  The user application needs to register itself with the ConfigClient for getting the result of the operation.  When the application registers itself, the ConfigClient returns a unique ID to the application. This unique ID can be made use of to differentiate between different clients and to get the result of the operation.  

 

The ConfigClient class allows an applet or user application to communicate with the ConfigServer.  For getting the instance of the ConfigClient, the method getInstance() of ConfigClient class is used.  

 

The NmsConfigClient that extends ConfigClient uses the NMS session (i.e., the BE-FE-Client architecture.  Hence, this implementation class need to be used for getting the ConfigClient instance as follows:

 

configclient = ConfigClient.getInstance("com.adventnet.nms.config.NmsConfigClient", null,null,NmsClientUtil.getUserName());

String uniqueID = configclient.registerResultListener(<class that implements ConfigResultListener>);

ConfigClientAPI configclientAPI = new ConfigClientAPI(configclient, uniqueID);

 

In this case, the server name and the port are specified as "null" and the user name is got using the method NmsClientUtil.getUserName().  This is because, the BE-FE-Client session knows the host and the port at which the ConfigServer is running. 

 

In case, the authentication is enabled, the method getInstance("ImplClass","hostName","portNo","userName","passWord") should be used.  Here.

Note: The default security implementation of Configuration Management allows only the user with "Admin" privilege to perform any task based operations, viz., creation or execution.If a new user wants to have permission, then he should be associated with the Admin group

 

For getting the responses from the server, the name of the class that implement ConfigResultListener has to be passed to the method registerResultListener() of ConfigClient.  This will enable the ConfigClient to notify the result of the operation requested by the application.



Copyright © 2011, ZOHO Corp. All Rights Reserved.