AdventNet Web NMS 4 API Specification

This class is for internal purpose only and is subjected to change. Developers are recommended not to use this API


com.adventnet.nms.client
Class ClientCVAPIImpl

java.lang.Object
  |
  +--com.adventnet.nms.client.ClientCVAPIImpl
All Implemented Interfaces:
CommonClientAPI
Direct Known Subclasses:
ClientAuditAPIImpl, ClientPollAPIImpl

public abstract class ClientCVAPIImpl
extends java.lang.Object
implements CommonClientAPI

ClientCVAPIImpl is the implementation of the CommonClientAPI which the API users would user to manipulate with Custom Views. An abstract class which will be extended by the respective clientapi modules viz Alert, Event, Topo and Poll.

Since:
Web NMS 2.3
See Also:
CommonClientAPI

Field Summary
protected  java.util.Hashtable customViewsHT
          customViewsHT acts as a cache for the custom views got from FE.
protected  java.lang.String lookupName
          lookupName holds the value got via the getLookupName()
protected  ServerCustomViewAPI serverCVApi
          serverCVApi holds the ServerCustomViewAPI implementation got by RMI lookup.
protected static java.lang.String sessionId
          sessionId holds the unique id as got from FE-Server for this client session.
protected  java.util.Vector temporaryCustomViews
          temporaryCustomViews holds the list of the temporary custom-views.
protected  java.lang.String user
          user holds the name of the user for whom this instance was created.
 
Constructor Summary
ClientCVAPIImpl(java.lang.String hostName, int rmiRegPort, java.lang.String userName)
          Constructor with params of host name and rmi registry port of the server and user name with which the client logs in.
ClientCVAPIImpl(java.lang.String hostName, int rmiRegPort, java.lang.String userName, java.lang.String password)
           
ClientCVAPIImpl(java.lang.String hostName, int rmiRegPort, java.lang.String userName, java.lang.String password, java.lang.String cryptoClass)
           
ClientCVAPIImpl(java.lang.String hostName, java.lang.String userName)
           
 
Method Summary
 NmsClientTableModel createCustomView(java.lang.String name)
          To create a custom view of the given name without any criteria and increment.
 NmsClientTableModel createCustomView(java.lang.String name, int increment)
          To create a custom view of the given name without any criteria and a preset increment value.
 NmsClientTableModel createCustomView(java.lang.String name, java.util.Properties criteria)
          To create a custom view of the given name with a preset criteria and no preset increment value.
 NmsClientTableModel createCustomView(java.lang.String name, java.util.Properties criteria, int increment)
          To create a custom view of the given name with a preset criteria and a preset increment value.
 NmsClientTableModel createCustomView(java.lang.String viewId, java.util.Properties criteria, int increment, java.lang.String[] displayFields, java.lang.String[] displayLabels, java.util.Properties panelProps)
          createCustomView method takes in the displayFields and their corresponding displayLabels when creating a Custom View.
 java.rmi.Remote getAPI(java.lang.String lookupName)
          getAPI returns the required Remote API either by direct RMI lookup on FE Server in the default mode or via the RMIAccessAPI's getAPI method in case password is available.
 NmsClientTableModel getCustomView(java.lang.String viewId)
          Returns the reference to the NmsClientTableModel instance of the given viewId if any.
 java.lang.String[] getCustomViewNames()
          Returns the names of all custom views for the specified user in the module.
abstract  java.lang.String[] getDefaultDisplayFields()
          getDefaultDisplayFields method returns an array of default field names to be used as display fields for new Custom Views.
abstract  java.lang.String[] getDefaultDisplayLabels()
          getDefaultDisplayLabels method returns an array of default labels (display names) for the fields in the Custom View.
protected abstract  java.lang.String getKeyFieldName()
          getKeyFieldName returns the name of the property by which the Object is uniquely identified.
protected abstract  java.lang.String getLookupName()
          getLookupName returns the name to be used for RMI lookup.
 ServerCustomViewAPI getServerAPI()
          Deprecated. since direct usage of serverside API is not recommended. Any communication with the server should be made via the CommonClientAPI
 java.lang.String getSessionId()
          getSessionId method returns the sessionId with which the client communicates with the FE-Server for Custom View related operations like registering/unregistering for updates, getting data for the custom view, etc.,.
 java.lang.String getUserName()
          getUserName returns the user name for whom this instance was created.
protected abstract  boolean isShowLatest()
          isShowLatest specifies whether or not a module shows the latest objects (objects created/updated lately) always.
 boolean removeCustomView(java.lang.String viewId)
          Cleans up the custom view given the viewId.
 NmsClientTableModel retrieveCustomView(java.lang.String viewId)
          Can be used to retrieve an already saved custom view.
 boolean saveCustomView(java.lang.String viewId)
          Saves the Custom View of the given name for the current user for persistence.
 boolean saveCustomViewForAll(java.lang.String viewId)
          Saves the Custom View of the given name for all users.
 void showDialog()
          showDialog this synchronized method is called whenever any connectionException is thrown Brings up the connection lost popup message only during the first call
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lookupName

protected java.lang.String lookupName
lookupName holds the value got via the getLookupName()

customViewsHT

protected java.util.Hashtable customViewsHT
customViewsHT acts as a cache for the custom views got from FE.

temporaryCustomViews

protected java.util.Vector temporaryCustomViews
temporaryCustomViews holds the list of the temporary custom-views.

user

protected java.lang.String user
user holds the name of the user for whom this instance was created.

serverCVApi

protected ServerCustomViewAPI serverCVApi
serverCVApi holds the ServerCustomViewAPI implementation got by RMI lookup.

sessionId

protected static java.lang.String sessionId
sessionId holds the unique id as got from FE-Server for this client session.
Constructor Detail

ClientCVAPIImpl

public ClientCVAPIImpl(java.lang.String hostName,
                       java.lang.String userName)

ClientCVAPIImpl

public ClientCVAPIImpl(java.lang.String hostName,
                       int rmiRegPort,
                       java.lang.String userName)
Constructor with params of host name and rmi registry port of the server and user name with which the client logs in.

ClientCVAPIImpl

public ClientCVAPIImpl(java.lang.String hostName,
                       int rmiRegPort,
                       java.lang.String userName,
                       java.lang.String password)
                throws java.lang.Exception

ClientCVAPIImpl

public ClientCVAPIImpl(java.lang.String hostName,
                       int rmiRegPort,
                       java.lang.String userName,
                       java.lang.String password,
                       java.lang.String cryptoClass)
                throws java.lang.Exception
Method Detail

getAPI

public java.rmi.Remote getAPI(java.lang.String lookupName)
                       throws java.rmi.RemoteException,
                              java.rmi.NotBoundException,
                              java.net.MalformedURLException,
                              com.adventnet.nms.client.RMIAccessException,
                              AuthenticationException
getAPI returns the required Remote API either by direct RMI lookup on FE Server in the default mode or via the RMIAccessAPI's getAPI method in case password is available. The second mode is the only way of getting an API in case the WebNMS is started in the "Secure RMI Mode". The password should have been made available when creating an instance of this class (via the constructor).
Parameters:
lookupName - the API name to lookup
Returns:
the handle to the specified API in the NMS.

getCustomViewNames

public java.lang.String[] getCustomViewNames()
Returns the names of all custom views for the specified user in the module. Returns null when no custom views are there.
Specified by:
getCustomViewNames in interface CommonClientAPI
Following copied from interface: com.adventnet.nms.client.CommonClientAPI
Returns:
the array of custom view names or null if there are none.

saveCustomView

public boolean saveCustomView(java.lang.String viewId)
Description copied from interface: CommonClientAPI
Saves the Custom View of the given name for the current user for persistence.

As from Web NMS 2.3, creating a custom view saves the same by default. If you want to just add the custom view and not save, then you will have to set a property "temporaryCustomView" with value as "true" in the panelProps when adding a custom view.

Such a temporary custom view can be saved by using this method.

Specified by:
saveCustomView in interface CommonClientAPI
Following copied from interface: com.adventnet.nms.client.CommonClientAPI
Parameters:
name - The name of the Custom View to be saved.
Returns:
true on success

saveCustomViewForAll

public boolean saveCustomViewForAll(java.lang.String viewId)
Description copied from interface: CommonClientAPI
Saves the Custom View of the given name for all users.

As from Web NMS 2.3, creating a custom view saves the same by default. If you want to just add the custom view and not save, then you will have to set a property "temporaryCustomView" with value as "true" in the panelProps when adding a custom view.

Such a temporary custom view can be saved by using this method.

Specified by:
saveCustomViewForAll in interface CommonClientAPI
Following copied from interface: com.adventnet.nms.client.CommonClientAPI
Returns:
true on success

removeCustomView

public boolean removeCustomView(java.lang.String viewId)
Cleans up the custom view given the viewId. The method will return 'false' if 'null' is given for the viewId of the CustomView.
Specified by:
removeCustomView in interface CommonClientAPI
Following copied from interface: com.adventnet.nms.client.CommonClientAPI
Parameters:
name - The name of the Custom View to be removed.
Returns:
true on success

createCustomView

public NmsClientTableModel createCustomView(java.lang.String name)
To create a custom view of the given name without any criteria and increment. Presently when no increment value is specified a default of 10 is assumed. Using the returned NmsClientTableModel instance you could set the other options (like criteria properties, increment value, etc) even later.

Note that when no criteria is set for the Custom View model, all the objects are retrieved (It will be a catch all view). And when you set some criteria, only those objects matching the criteria are retrieved by the model.

The method will return 'null' if 'null' value is given for the CustomView name.

Specified by:
createCustomView in interface CommonClientAPI
Returns:
An instance of NmsClientTableModel implemention which could be made use of thereafter to iterate through the resulting set of objects.

createCustomView

public NmsClientTableModel createCustomView(java.lang.String name,
                                            int increment)
To create a custom view of the given name without any criteria and a preset increment value.

Using the returned NmsClientTableModel instance you could set the other options (like criteria properties, etc) even later.

Note that when no criteria is set for the Custom View model, all the objects are retrieved (It will be a catch all view). And when you set some criteria, only those objects matching the criteria are retrieved by the model.

Specified by:
createCustomView in interface CommonClientAPI
Parameters:
name - The name with which the Custom View is to be created.
increment - The value by which the Custom Views should get incremented. If a negative value or zero is given for this parameter, Custom View will get created with default increment value as 10. The method will return 'null' if 'null' value is given for the CustomView name.
Returns:
An instance of NmsClientTableModel implemention which could be made use of thereafter to iterate through the resulting set of objects.

createCustomView

public NmsClientTableModel createCustomView(java.lang.String name,
                                            java.util.Properties criteria)
To create a custom view of the given name with a preset criteria and no preset increment value. Presently when no increment value is specified a default of 10 is assumed.

Note that when no criteria is set for the Custom View model, all the objects are retrieved (It will be a catch all view). And when you set some criteria, only those objects matching the criteria are retrieved by the model.

The criteria Properties you give could be something like the following. For example when you want to retrieve all critical and major alerts of categories starting with "LXE" between the time frame of say time1 //No Internationalisation and time2 (where time1 and time2 are the strings containing the long representation of the dates) then it would be

 Properties criteria = new Properties();
 criteria.put("stringseverity", "critical, major");//No Internationalisation
 criteria.put("category", "LXE*");//No Internationalisation
 criteria.put("time", " "+time1+" and "+time2);//No Internationalisation
 
 To be more clear about how you could use the time in the criteria the
 above example criteria should result in something like  

 " 167868778 and 87536743" for the "time" key.//No Internationalisation
 
Wildcards like astrick (*), not (!) and comma (,) can be used in the criteria. The method will return 'null' if 'null' value is given for the CustomView name.
Specified by:
createCustomView in interface CommonClientAPI
Returns:
An instance of NmsClientTableModel implemention which could be made use of thereafter to iterate through the resulting set of objects.

createCustomView

public NmsClientTableModel createCustomView(java.lang.String name,
                                            java.util.Properties criteria,
                                            int increment)
To create a custom view of the given name with a preset criteria and a preset increment value.

Note that when no criteria is set for the Custom View model, all the objects are retrieved (It will be a catch all view). And when you set some criteria, only those objects matching the criteria are retrieved by the model.

Specified by:
createCustomView in interface CommonClientAPI
Parameters:
name - The name with which the Custom View is to be created.
increment - The value by which the Custom Views should get incremented. If a negative value or zero is given for this parameter, Custom View will get created with default increment value as 10. The method will return 'null' if 'null' value is given for the CustomView name.
Returns:
An instance of NmsClientTableModel implemention which could be made use of thereafter to iterate through the resulting set of objects.

createCustomView

public NmsClientTableModel createCustomView(java.lang.String viewId,
                                            java.util.Properties criteria,
                                            int increment,
                                            java.lang.String[] displayFields,
                                            java.lang.String[] displayLabels,
                                            java.util.Properties panelProps)
Description copied from interface: CommonClientAPI
createCustomView method takes in the displayFields and their corresponding displayLabels when creating a Custom View. The additional properties related to the custom view may be specified in the panelProps. If the parent node for this custom view needs to be specified, it can be done so by setting the by setting the value in the panelProps with key as "parent"

As from Web NMS 2.3, creating a custom view saves the same by default. If you want to just add the custom view and not save, then you will have to set a property "temporaryCustomView" with value as "true" in the panelProps. You may later save this view using the CommonClientAPI.saveCustomView(String) method.

Specified by:
createCustomView in interface CommonClientAPI
Following copied from interface: com.adventnet.nms.client.CommonClientAPI
Parameters:
viewId - a String value to represent the Custom View
criteria - a Properties value specifying the criteria for the Custom View
increment - an int value by which the view is to be incremented. If invalid value is given( negative or 0) , default value 10 is taken.
displayFields - a String[] value specifying the display fields for the view. This should not be null.
displayLabels - a String[] value specifying the display labels for the view. This should be equal in length to the displayFields.
panelProps - a Properties value of the additional properties of that view. This should contain a property with the key as parent and value as the Node ID of the parent node in the tree.
Returns:
a NmsClientTableModel implemention which could be made use of thereafter to iterate through the resulting set of objects.

retrieveCustomView

public NmsClientTableModel retrieveCustomView(java.lang.String viewId)
Can be used to retrieve an already saved custom view. The method will return 'null' if 'null' value is given for the CustomView name.
Specified by:
retrieveCustomView in interface CommonClientAPI
Following copied from interface: com.adventnet.nms.client.CommonClientAPI
Parameters:
name - The name of the Custom View, already created, for which the NmsClientTableModel is required.
Returns:
An instance of NmsClientTableModel implemention which could be made use of thereafter to iterate through the resulting set of objects. Returns null if the name is null or an empty String.

getCustomView

public NmsClientTableModel getCustomView(java.lang.String viewId)
Returns the reference to the NmsClientTableModel instance of the given viewId if any. The method will return 'null' if 'null' value is given for the CustomView name.
Specified by:
getCustomView in interface CommonClientAPI
Following copied from interface: com.adventnet.nms.client.CommonClientAPI
Parameters:
name - The name of the Custom View, already created, for which the NmsClientTableModel is required.
Returns:
An instance of NmsClientTableModel implemention which could be made use of thereafter to iterate through the resulting set of objects. Returns null if the name is null or an empty String.

getLookupName

protected abstract java.lang.String getLookupName()
getLookupName returns the name to be used for RMI lookup. The RMI lookup with this name should return a reference to a class which implements ServerCustomViewAPI.
Returns:
a String value of the name to used for lookup

getKeyFieldName

protected abstract java.lang.String getKeyFieldName()
getKeyFieldName returns the name of the property by which the Object is uniquely identified.
Returns:
the unique property name for the specific module.

getDefaultDisplayFields

public abstract java.lang.String[] getDefaultDisplayFields()
getDefaultDisplayFields method returns an array of default field names to be used as display fields for new Custom Views. These are a subset of the property names for an Object in that module. The labels that are displayed for these fields are available in getDefaultDisplayLabels()
Specified by:
getDefaultDisplayFields in interface CommonClientAPI
Returns:
a String[] of display fields for the new Custom View.

getDefaultDisplayLabels

public abstract java.lang.String[] getDefaultDisplayLabels()
getDefaultDisplayLabels method returns an array of default labels (display names) for the fields in the Custom View.

The size of the array returned by this method should match with those returned by getDefaultDisplayFields()

Specified by:
getDefaultDisplayLabels in interface CommonClientAPI
Returns:
a String[] value

isShowLatest

protected abstract boolean isShowLatest()
isShowLatest specifies whether or not a module shows the latest objects (objects created/updated lately) always.

If this returns true and if the objects in the Custom View show the latest, then the view will get updated such that it will always contain the latest.

For example, if the custom view contains 95 objects and and what is being currently viewed is from 86 to 95 (latest) with the view length of 10. The view can be specified as [86 to 95 of 95].

Say a new object gets added increasing the total to 96 for this custom view.

Now if this method were to return true, then the row gets added in the view, with the range changing to [87 to 96 of 96] example : Event module custom views.

If this method returns false, then the rows stay unaffected, with the total alone changing .Hence the view will be [86 to 95 of 96]. You may see the 96th row by doing a query for next set of rows. example : Topo module custom views.

Returns:
a boolean value whether to showlatest or not.

getServerAPI

public ServerCustomViewAPI getServerAPI()
Deprecated. since direct usage of serverside API is not recommended. Any communication with the server should be made via the CommonClientAPI

getServerAPI method returns the reference to the module specific implementation of ServerCustomViewAPI, the same which was got by RMI lookup.
Returns:
the ServerCustomViewAPI of that module.

getUserName

public java.lang.String getUserName()
getUserName returns the user name for whom this instance was created. The same can be used for interacting with FE.
Returns:
a String value of the userName.

getSessionId

public java.lang.String getSessionId()
getSessionId method returns the sessionId with which the client communicates with the FE-Server for Custom View related operations like registering/unregistering for updates, getting data for the custom view, etc.,.
Returns:
a String value of the session's id as got from FE-Server.

showDialog

public void showDialog()
showDialog this synchronized method is called whenever any connectionException is thrown Brings up the connection lost popup message only during the first call

AdventNet Web NMS 4 API Specification