AdventNet Web NMS 4 API Specification

com.adventnet.nms.fe.common
Class ServerCVAPIImpl

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--com.adventnet.nms.fe.common.ServerCVAPIImpl
All Implemented Interfaces:
CommonModuleAPI, java.rmi.Remote, java.io.Serializable, ServerCustomViewAPI

public abstract class ServerCVAPIImpl
extends java.rmi.server.UnicastRemoteObject
implements ServerCustomViewAPI

Class for custom view creation logic and bind in rmi. This holds the reference of session beans internally for its operations.

Since:
Web NMS 2.3
See Also:
UnicastRemoteObject, ServerCustomViewAPI, Serialized Form

Field Summary
protected  CustomSessionBean csb
           
protected  java.lang.String moduleId
           
protected  com.adventnet.nms.fe.common.SessionUpdateClient updateClient
           
protected  java.lang.String updateId
           
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
ServerCVAPIImpl()
           
 
Method Summary
 boolean cleanUpUser(java.util.Vector userName, java.lang.String type)
          cleanUpUser is called to close user session for those users who have been disabled,removed or user time has expired
 java.lang.String createCustomView(java.lang.String userName, java.lang.String viewName, java.util.Properties criteria)
           
 java.lang.String createCustomView(java.lang.String userName, java.lang.String viewName, java.util.Properties criteria, TableColumn[] tableCols)
          Adds CustomView given the required parameters.
 boolean createCustomView(java.lang.String userName, java.lang.String viewId, java.lang.String viewName, java.lang.String nodeType, TableColumn[] tableCols, java.util.Properties panelProps, java.util.Properties criteria)
          Creates a new Custom View for the user.
 void endSession(java.lang.String sessionId)
          Ends the session for the client identified by the sessionId.
 java.lang.String[] getAllCustomViewNames(java.lang.String userName)
          Returns the names of all custom views available for this user.
 ViewData getData(java.lang.String sessionId, NmsTableModelListener listener, ViewCriteria criteria)
          Gets the ViewData object for the given criteria.
protected abstract  UpdateHandlerImpl getHandler(java.lang.String userName, com.adventnet.nms.fe.common.CustomViewUser cvUser)
           
 java.util.Properties getPropertiesOfObject(java.lang.String userName, java.lang.String entity)
          Fetches the Properties for the object identified by the key.
 java.lang.String getSessionId(com.adventnet.nms.fe.common.ClientSession clientSession, java.lang.String userName)
          Returns an Unique Id for the Client which will be used by the Client for further interactions.
protected  java.lang.String getUpdateModuleId()
           
 CustomViewProperties getViewProperties(java.lang.String userName, java.lang.String viewId)
          Fetches the CustomViewProperties of the user for the customView identified by the viewId.
 void initForUser(java.lang.String userName)
          Performs initialization operations for the user identified by the name.
protected abstract  void initModule()
           
 boolean modifyCustomView(java.lang.String userName, java.lang.String viewId, TableColumn[] columnNames, java.util.Properties panelProps, java.util.Properties criteria)
          Modifies the CustomView given the required parameters.
 void registerForUpdates(java.lang.String sessionId, java.lang.String userName, java.lang.String viewId, NmsTableModelListener listener)
          Registers the custom view for updates enabling it receive asynchronous notification of changes in the view.
 boolean removeCustomView(java.lang.String userName, java.lang.String viewId)
          Removes and cleans up the Custom view of the given name on the client and its counterpart on the server.
 boolean renameCustomView(java.lang.String userName, java.lang.String viewId, java.lang.String newName)
          Renames the customview identified by the viewId
 boolean unRegisterForUpdates(java.lang.String sessionId, NmsTableModelListener listener)
          UnRegisters the custom view if already registered for updates.
 boolean updateClientStatus(java.lang.String sessionId)
          This method is invoked by the RMI client to check the validity of the connection between itself and the server.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

csb

protected transient CustomSessionBean csb

updateClient

protected com.adventnet.nms.fe.common.SessionUpdateClient updateClient

moduleId

protected java.lang.String moduleId

updateId

protected java.lang.String updateId
Constructor Detail

ServerCVAPIImpl

public ServerCVAPIImpl()
                throws java.rmi.RemoteException
Method Detail

cleanUpUser

public boolean cleanUpUser(java.util.Vector userName,
                           java.lang.String type)
                    throws java.rmi.RemoteException
cleanUpUser is called to close user session for those users who have been disabled,removed or user time has expired
Parameters:
userName -  
type - can be disabled,removed or userexpired
Returns:
true if successful else false

getSessionId

public java.lang.String getSessionId(com.adventnet.nms.fe.common.ClientSession clientSession,
                                     java.lang.String userName)
                              throws java.rmi.RemoteException
Description copied from interface: ServerCustomViewAPI
Returns an Unique Id for the Client which will be used by the Client for further interactions.
Specified by:
getSessionId in interface ServerCustomViewAPI
Following copied from interface: com.adventnet.nms.fe.common.ServerCustomViewAPI
Parameters:
session - The client session that can be used by the server to send notifications to the client.
userName - The user who gets the who requests the sessionId
Returns:
String The unique Id

endSession

public void endSession(java.lang.String sessionId)
                throws java.rmi.RemoteException
Description copied from interface: ServerCustomViewAPI
Ends the session for the client identified by the sessionId.
Specified by:
endSession in interface ServerCustomViewAPI
Following copied from interface: com.adventnet.nms.fe.common.ServerCustomViewAPI
Parameters:
sessionId - the unique Id got via getSessionId() method;

initForUser

public void initForUser(java.lang.String userName)
                 throws java.rmi.RemoteException,
                        com.adventnet.nms.fe.common.CustomViewException
Description copied from interface: ServerCustomViewAPI
Performs initialization operations for the user identified by the name.
Specified by:
initForUser in interface ServerCustomViewAPI

initModule

protected abstract void initModule()

registerForUpdates

public void registerForUpdates(java.lang.String sessionId,
                               java.lang.String userName,
                               java.lang.String viewId,
                               NmsTableModelListener listener)
                        throws java.rmi.RemoteException
Description copied from interface: ServerCustomViewAPI
Registers the custom view for updates enabling it receive asynchronous notification of changes in the view.
Specified by:
registerForUpdates in interface ServerCustomViewAPI
Following copied from interface: com.adventnet.nms.fe.common.ServerCustomViewAPI
Parameters:
sessionId - The uniqueId as assigned to the Client Session as got via the getSessionId method.
userName - The user who owns the Custom View.
viewId - The id given for that view during creation.
listener - The NmsTableModelListener which requires the updates for the CustomView.

unRegisterForUpdates

public boolean unRegisterForUpdates(java.lang.String sessionId,
                                    NmsTableModelListener listener)
                             throws java.rmi.RemoteException
Description copied from interface: ServerCustomViewAPI
UnRegisters the custom view if already registered for updates.
Specified by:
unRegisterForUpdates in interface ServerCustomViewAPI
Following copied from interface: com.adventnet.nms.fe.common.ServerCustomViewAPI
Parameters:
sessionId - The uniqueId as assigned to the Client Session as got via the getSessionId method.
listener - The NmsTableModelListener which was used during registering for updates.
Returns:
the boolean value specifying the result of the operation.

createCustomView

public java.lang.String createCustomView(java.lang.String userName,
                                         java.lang.String viewName,
                                         java.util.Properties criteria)
                                  throws java.rmi.RemoteException,
                                         com.adventnet.nms.fe.common.CustomViewException
Specified by:
createCustomView in interface ServerCustomViewAPI
Following copied from interface: com.adventnet.nms.fe.common.ServerCustomViewAPI
Parameters:
userName - The user who creates the Custom View.
viewName - The name to be given for the new Custom View.
criteria - The criteria Properties for the new Custom View.
Returns:
The View Id for the CustomView.

createCustomView

public java.lang.String createCustomView(java.lang.String userName,
                                         java.lang.String viewName,
                                         java.util.Properties criteria,
                                         TableColumn[] tableCols)
                                  throws java.rmi.RemoteException,
                                         com.adventnet.nms.fe.common.CustomViewException
Description copied from interface: ServerCustomViewAPI
Adds CustomView given the required parameters.
Specified by:
createCustomView in interface ServerCustomViewAPI
Following copied from interface: com.adventnet.nms.fe.common.ServerCustomViewAPI
Parameters:
userName - The user who creates the Custom View.
viewName - The name to be given for the new Custom View.
criteria - The criteria Properties for the new Custom View.
tableCols - The array of TableColumn objects for the view
Returns:
The viewId for this customView

createCustomView

public boolean createCustomView(java.lang.String userName,
                                java.lang.String viewId,
                                java.lang.String viewName,
                                java.lang.String nodeType,
                                TableColumn[] tableCols,
                                java.util.Properties panelProps,
                                java.util.Properties criteria)
                         throws java.rmi.RemoteException,
                                com.adventnet.nms.fe.common.CustomViewException
Description copied from interface: ServerCustomViewAPI
Creates a new Custom View for the user. It basically provides a way of accessing the createCustomView method of the same signature in CustomSessionBean via RMI.
Specified by:
createCustomView in interface ServerCustomViewAPI
Following copied from interface: com.adventnet.nms.fe.common.ServerCustomViewAPI
Parameters:
userName - a String value of the user who creates the Custom View.
viewId - a String value of the viewId to be given for the new Custom View.
viewName - a String value of the display-name to be given for the new Custom View.
nodeType - a String value of the node to be represented in the tree like DEVICE-DATA, DEVICE-GROUP, DEVICE, LEVEL-1, LEVEL-2, etc.
tableCols - a TableColumn[] value of the columns that are to be displayed in the client
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.
criteria - a Properties value of the view-criteria. The objects matching these criteria will alone be returned.
Returns:
a boolean value of whether the request was successfull.
Throws:
java.rmi.RemoteException - if an error occurs
com.adventnet.nms.fe.common.CustomViewException - in any of the following cases, (i) if Database related error occurs (ii) any of userName, viewId, viewName, or panelProps is null or invalid.
See Also:
CustomSessionBean.createCustomView(String, String, String, String, TableColumn[], Properties, Properties)

getAllCustomViewNames

public java.lang.String[] getAllCustomViewNames(java.lang.String userName)
                                         throws java.rmi.RemoteException,
                                                com.adventnet.nms.fe.common.CustomViewException
Returns the names of all custom views available for this user. Returns null when no custom views are there.
Specified by:
getAllCustomViewNames in interface ServerCustomViewAPI

removeCustomView

public boolean removeCustomView(java.lang.String userName,
                                java.lang.String viewId)
                         throws java.rmi.RemoteException,
                                com.adventnet.nms.fe.common.CustomViewException
Removes and cleans up the Custom view of the given name on the client and its counterpart on the server.
Specified by:
removeCustomView in interface ServerCustomViewAPI
Returns:
true on success

getData

public ViewData getData(java.lang.String sessionId,
                        NmsTableModelListener listener,
                        ViewCriteria criteria)
                 throws java.rmi.RemoteException,
                        com.adventnet.nms.fe.common.CustomViewException
Description copied from interface: ServerCustomViewAPI
Gets the ViewData object for the given criteria.
Specified by:
getData in interface ServerCustomViewAPI
Following copied from interface: com.adventnet.nms.fe.common.ServerCustomViewAPI
Parameters:
sessionId - The uniqueId of the clients session as got from getSessionId method.
listener - The NmsTableModelListener which requires the data.
criteria - The viewcriteria for the customview.
Returns:
The ViewData object containing the details required for the view.

getViewProperties

public CustomViewProperties getViewProperties(java.lang.String userName,
                                              java.lang.String viewId)
                                       throws java.rmi.RemoteException,
                                              com.adventnet.nms.fe.common.CustomViewException
Description copied from interface: ServerCustomViewAPI
Fetches the CustomViewProperties of the user for the customView identified by the viewId.
Specified by:
getViewProperties in interface ServerCustomViewAPI
Following copied from interface: com.adventnet.nms.fe.common.ServerCustomViewAPI
Parameters:
userName - The name of the user who has the customview of the given id.
viewId - The id for the CustomView.
Returns:
The CustomViewProperties object for the specified CustomView

getPropertiesOfObject

public java.util.Properties getPropertiesOfObject(java.lang.String userName,
                                                  java.lang.String entity)
                                           throws java.rmi.RemoteException
Description copied from interface: ServerCustomViewAPI
Fetches the Properties for the object identified by the key.
Specified by:
getPropertiesOfObject in interface ServerCustomViewAPI
Following copied from interface: com.adventnet.nms.fe.common.ServerCustomViewAPI
Parameters:
userName - The userName for authorization purposes.
key - The key which is used to identify the object.
Returns:
The Properties of the object identified by the key.

modifyCustomView

public boolean modifyCustomView(java.lang.String userName,
                                java.lang.String viewId,
                                TableColumn[] columnNames,
                                java.util.Properties panelProps,
                                java.util.Properties criteria)
                         throws java.rmi.RemoteException,
                                com.adventnet.nms.fe.common.CustomViewException
Description copied from interface: ServerCustomViewAPI
Modifies the CustomView given the required parameters.
Specified by:
modifyCustomView in interface ServerCustomViewAPI
Following copied from interface: com.adventnet.nms.fe.common.ServerCustomViewAPI
Parameters:
userName - The user who owns the Custom View.
viewId - The id given for that view during creation.
tableCols - The array of TableColumn objects for the view
panelProps - The properties for the customview panel.
criteria - The criteria Properties to be in the modified Custom View.
Returns:
The viewId for this customView

renameCustomView

public boolean renameCustomView(java.lang.String userName,
                                java.lang.String viewId,
                                java.lang.String newName)
                         throws java.rmi.RemoteException,
                                com.adventnet.nms.fe.common.CustomViewException
Description copied from interface: ServerCustomViewAPI
Renames the customview identified by the viewId
Specified by:
renameCustomView in interface ServerCustomViewAPI
Following copied from interface: com.adventnet.nms.fe.common.ServerCustomViewAPI
Parameters:
userName - The user who owns the Custom View.
viewId - The id given for that view during creation.
newName - The name to be set for the Custmom View.
Returns:
the boolean value specifying the success or failure of operation.

getHandler

protected abstract UpdateHandlerImpl getHandler(java.lang.String userName,
                                                com.adventnet.nms.fe.common.CustomViewUser cvUser)

getUpdateModuleId

protected java.lang.String getUpdateModuleId()

updateClientStatus

public boolean updateClientStatus(java.lang.String sessionId)
                           throws java.rmi.RemoteException
This method is invoked by the RMI client to check the validity of the connection between itself and the server.
Specified by:
updateClientStatus in interface ServerCustomViewAPI
Parameters:
sessionId - The uniqueId as assigned to the Client Session as got via the getSessionId method.
Throws:
java.rmi.RemoteException - if the connection between the RMI client and the server is lost

AdventNet Web NMS 4 API Specification