AdventNet Web NMS 4 API Specification

com.adventnet.nms.fe.common
Class NmsTreeAPIImpl

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

public class NmsTreeAPIImpl
extends java.rmi.server.UnicastRemoteObject
implements NmsTreeAPI

A Class which implements NmsTreeAPI and to get the handle to access the DBXmlutility methods

Since:
Web NMS 2.3
See Also:
NmsTreeAPI, Serialized Form

Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
NmsTreeAPIImpl()
           
NmsTreeAPIImpl(java.sql.Connection con)
           
 
Method Summary
 boolean addNode(PanelTreeNode panelNode)
          This method adds a node as the last child of the specified parent in the user defined tree.
 boolean deleteAllNodes(java.lang.String userName)
          This method removes all tree nodes from the user defined tree (for the specified user).
 void deRegister(java.lang.String userName, DBXMLNodeListener listener)
          Removes the listener from the listeners list so that the listener will no longer get any update for the tree node operation.
 int getChildCount(java.lang.String userName, java.lang.String parent)
          Returns the child count of the given parent for the given userName.
 java.util.Vector getChildList(java.lang.String userName, java.lang.String moduleName)
          This method returns nodeId belonging to the specified module
 int getNodeCount(java.lang.String userName)
          This method returns number of tree node that exist for a given user.
 PanelTreeNode getPanelTreeNode(java.lang.String userName, java.lang.String nodeId)
          Returns PanelTreeNode for the given nodeId and userName.
 java.lang.String getParent(java.lang.String userName, java.lang.String nodeId)
          This method returns parent NodeID for the given NodeID
 XMLNode getTree(java.lang.String userName, java.lang.String id)
          This method returns hierarchy of the given node (whose id is passed as an argument).
 boolean insertNode(PanelTreeNode panelNode)
          This method inserts a node in the specified index, under the specified parent in the user defined tree.
 boolean modifyNode(PanelTreeNode panelNode)
          This method is used to modify a tree node for a particular user or for all the users.
 boolean moveNode(java.lang.String nodeId, java.lang.String userName, java.lang.String newParent)
          This method moves the specified tree node (whose nodeId is passed as argument) under the given new parent in the user defined tree.
 boolean moveNode(java.lang.String nodeId, java.lang.String userName, java.lang.String newParent, int nodeIndex)
          This method moves the specified tree node (whose nodeId is passed as argument) to the specific position (specified by the argument index) under the given new parent in the user defined tree.
 boolean nodeExist(java.lang.String userName, java.lang.String nodeId)
          This method returns true if the tree node is present in user defined tree.
 void register(java.lang.String userName, DBXMLNodeListener listener)
          All the DBXMLNodeListeners will register with the corresponding userName for getting updates on any Node operation viz.,add,delete,modify,insert etc.,
 boolean removeNode(java.lang.String nodeId, java.lang.String userName, boolean deleteAllChild)
          This method removes a node from the user defined tree.If deleteAllChild argument is set to true,then the entire hierarchy that means all the child nodes of the specified tree node will be removed from the user defined tree.
 boolean removeNode(java.lang.String nodeId, java.lang.String userName, java.lang.String moduleName, boolean deleteAllChild)
          This method removes a node from the user defined tree.If deleteAllChild argument is set to true,then the entire hierarchy that means all the child nodes of the specified tree node will be removed from the user defined tree.
 void updateUserDetail(java.lang.String userName)
          This method creates/updates the tree in the database for a given user.
 
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
 

Constructor Detail

NmsTreeAPIImpl

public NmsTreeAPIImpl()
               throws java.rmi.RemoteException,
                      UserTransactionException

NmsTreeAPIImpl

public NmsTreeAPIImpl(java.sql.Connection con)
               throws java.rmi.RemoteException
Method Detail

register

public void register(java.lang.String userName,
                     DBXMLNodeListener listener)
              throws java.rmi.RemoteException
Description copied from interface: NmsTreeAPI
All the DBXMLNodeListeners will register with the corresponding userName for getting updates on any Node operation viz.,add,delete,modify,insert etc.,
Specified by:
register in interface NmsTreeAPI
Following copied from interface: com.adventnet.nms.fe.common.NmsTreeAPI
Parameters:
userName - the userName for which the updates are to be received.
listener - the listener registering for the updates.

deRegister

public void deRegister(java.lang.String userName,
                       DBXMLNodeListener listener)
                throws java.rmi.RemoteException
Description copied from interface: NmsTreeAPI
Removes the listener from the listeners list so that the listener will no longer get any update for the tree node operation.
Specified by:
deRegister in interface NmsTreeAPI
Following copied from interface: com.adventnet.nms.fe.common.NmsTreeAPI
Parameters:
userName - the userName for which the updates were received.
listener - the listener which has to be deregistered for the updates.

addNode

public boolean addNode(PanelTreeNode panelNode)
                throws java.rmi.RemoteException,
                       NmsStorageException,
                       UserTransactionException
Description copied from interface: NmsTreeAPI
This method adds a node as the last child of the specified parent in the user defined tree.
Specified by:
addNode in interface NmsTreeAPI
Following copied from interface: com.adventnet.nms.fe.common.NmsTreeAPI
Parameters:
panelNode - a PanelTreeNode which contains data for the nodeid to be added
Throws:
NmsStorageException - if any problem occurs when adding the node.
UserTransactionException - If any error occurs inside the User Transaction block. This is applicable only when this API is executed within the context of a User Transaction.
See Also:
UserTransactionException

insertNode

public boolean insertNode(PanelTreeNode panelNode)
                   throws java.rmi.RemoteException,
                          NmsStorageException,
                          UserTransactionException
Description copied from interface: NmsTreeAPI
This method inserts a node in the specified index, under the specified parent in the user defined tree.
Specified by:
insertNode in interface NmsTreeAPI
Following copied from interface: com.adventnet.nms.fe.common.NmsTreeAPI
Parameters:
panelNode - a PanelTreeNode which contains data for the nodeid to be added
Throws:
NmsStorageException - if any problem occurs when inserting the node
UserTransactionException - If any error occurs inside the User Transaction block. This is applicable only when this API is executed within the context of a User Transaction.
See Also:
UserTransactionException

removeNode

public boolean removeNode(java.lang.String nodeId,
                          java.lang.String userName,
                          boolean deleteAllChild)
                   throws java.rmi.RemoteException,
                          NmsStorageException,
                          UserTransactionException
Description copied from interface: NmsTreeAPI
This method removes a node from the user defined tree.If deleteAllChild argument is set to true,then the entire hierarchy that means all the child nodes of the specified tree node will be removed from the user defined tree. If deleteAllChild argument is set to false then it moves the children of deleted node as children to the parent of deleted node.
Specified by:
removeNode in interface NmsTreeAPI
Following copied from interface: com.adventnet.nms.fe.common.NmsTreeAPI
Parameters:
nodeId - the unique identification for the node being removed.
userName - the name of the user.
deleteAllChild - if true delete all the children's of the deleted node else it moves the children as children to the parent of deleted node
Throws:
com.adventnet.nms.util.NmsStorageException - if any problem occurs when removing the node.
UserTransactionException - If any error occurs inside the User Transaction block. This is applicable only when this API is executed within the context of a User Transaction.
See Also:
UserTransactionException

removeNode

public boolean removeNode(java.lang.String nodeId,
                          java.lang.String userName,
                          java.lang.String moduleName,
                          boolean deleteAllChild)
                   throws java.rmi.RemoteException,
                          NmsStorageException,
                          UserTransactionException
Description copied from interface: NmsTreeAPI
This method removes a node from the user defined tree.If deleteAllChild argument is set to true,then the entire hierarchy that means all the child nodes of the specified tree node will be removed from the user defined tree. If deleteAllChild argument is set to false then it moves the children of deleted node as children to the parent of deleted node.
Specified by:
removeNode in interface NmsTreeAPI
Following copied from interface: com.adventnet.nms.fe.common.NmsTreeAPI
Parameters:
nodeId - the unique identification for the node being removed.
userName - the name of the user.
moduleName - the name of the table, from which the node is to be removed in addition to PanelTree and PanelProps tables.
deleteAllChild - if true delete all the children's of the deleted node else it moves the children as children to the parent of deleted node
Throws:
java.rmi.RemoteException - if an error occurs when removing the node
NmsStorageException - if an error occurs when removing the node
UserTransactionException - If any error occurs inside the User Transaction block. This is applicable only when this API is executed within the context of a User Transaction.
See Also:
UserTransactionException

modifyNode

public boolean modifyNode(PanelTreeNode panelNode)
                   throws java.rmi.RemoteException,
                          NmsStorageException,
                          UserTransactionException
Description copied from interface: NmsTreeAPI
This method is used to modify a tree node for a particular user or for all the users. This is to modify the tree node in the server side and send the updates to the client.
Specified by:
modifyNode in interface NmsTreeAPI
Following copied from interface: com.adventnet.nms.fe.common.NmsTreeAPI
Parameters:
panelNode - a PanelTreeNode which contains data for the tree node to be modified. A PanelTreeNode object is used to define how and which tree node is to be modified.
 Example PanelTreeNode Object :

      // To set the panel properties

      PanelTreeNode panelNode = new PanelTreeNode("Events"); // to 
      modify "Network Events" tree node

      panelNode.setUserName("root"); // to modify "Network Events" 
      tree node of user "root" 

      Properties panelProperties = new Properties(); 
      panelProperties.put("TREE-NAME","My Network Events"); 
      panelProperties.put("ICON-FILE","images/pc.png"); 
      panelProperties.put("MENU-FILE-NAME","alertsmenu.xml"); 
      panelProperties.put("<UPDATE_ONLY>","true"); // This attribute is 
      very important to specify whether the given properites are to be updated 
      or overwritten

      panelNode.setPanelProperties(panelProperties); 

 After constructing the PanelTreeNode object, invoke NmsTreeAPI.modifyNode() 
 API to modify the tree node.

 Sample Code Snippet :

 NmsTreeAPI.modifyNode(panelNode);

 
Throws:
NmsStorageException - if any problem occurs when modifying the node
UserTransactionException - If any error occurs inside the User Transaction block. This is applicable only when this API is executed within the context of a User Transaction.
See Also:
UserTransactionException, PanelTreeNode

updateUserDetail

public void updateUserDetail(java.lang.String userName)
                      throws java.rmi.RemoteException,
                             com.adventnet.nms.fe.common.CustomViewException,
                             UserTransactionException
Description copied from interface: NmsTreeAPI
This method creates/updates the tree in the database for a given user. Data for constructing / Modifying the user defined tree will be taken from the Tree.xml which will be present under WebNMS_HOME/users/USER NAME/ directory.
Specified by:
updateUserDetail in interface NmsTreeAPI
Following copied from interface: com.adventnet.nms.fe.common.NmsTreeAPI
Parameters:
userName -  
Throws:
UserTransactionException - If any error occurs inside the User Transaction block. This is applicable only when this API is executed within the context of a User Transaction.
See Also:
UserTransactionException

moveNode

public boolean moveNode(java.lang.String nodeId,
                        java.lang.String userName,
                        java.lang.String newParent)
                 throws java.rmi.RemoteException,
                        NmsStorageException,
                        UserTransactionException
Description copied from interface: NmsTreeAPI
This method moves the specified tree node (whose nodeId is passed as argument) under the given new parent in the user defined tree.
Specified by:
moveNode in interface NmsTreeAPI
Following copied from interface: com.adventnet.nms.fe.common.NmsTreeAPI
Parameters:
nodeId - the unique identification for the node being modified.
userName - the name of the user.
newParent - the parent under which the node is to be moved.
Throws:
NmsStorageException - if any problem
UserTransactionException - If any error occurs inside the User Transaction block. This is applicable only when this API is executed within the context of a User Transaction.
See Also:
UserTransactionException

moveNode

public boolean moveNode(java.lang.String nodeId,
                        java.lang.String userName,
                        java.lang.String newParent,
                        int nodeIndex)
                 throws java.rmi.RemoteException,
                        NmsStorageException,
                        UserTransactionException
Description copied from interface: NmsTreeAPI
This method moves the specified tree node (whose nodeId is passed as argument) to the specific position (specified by the argument index) under the given new parent in the user defined tree.
Specified by:
moveNode in interface NmsTreeAPI
Following copied from interface: com.adventnet.nms.fe.common.NmsTreeAPI
Parameters:
nodeId - the unique identification for the node being modified.
userName - the name of the user.
newNodeIndex - the node index to which node is to be moved.
newParent - the parent under which the node is to be moved.
Throws:
NmsStorageException - if any problem
UserTransactionException - If any error occurs inside the User Transaction block. This is applicable only when this API is executed within the context of a User Transaction.
See Also:
UserTransactionException

getChildCount

public int getChildCount(java.lang.String userName,
                         java.lang.String parent)
                  throws java.rmi.RemoteException,
                         NmsStorageException,
                         UserTransactionException
Description copied from interface: NmsTreeAPI
Returns the child count of the given parent for the given userName.
Specified by:
getChildCount in interface NmsTreeAPI
Following copied from interface: com.adventnet.nms.fe.common.NmsTreeAPI
Parameters:
userName - the name of the user
parent - the parent for you need the child count
Throws:
UserTransactionException - If any error occurs inside the User Transaction block. This is applicable only when this API is executed within the context of a User Transaction.
See Also:
UserTransactionException

getChildList

public java.util.Vector getChildList(java.lang.String userName,
                                     java.lang.String moduleName)
                              throws java.rmi.RemoteException,
                                     NmsStorageException,
                                     UserTransactionException
Description copied from interface: NmsTreeAPI
This method returns nodeId belonging to the specified module
Specified by:
getChildList in interface NmsTreeAPI
Following copied from interface: com.adventnet.nms.fe.common.NmsTreeAPI
Parameters:
userName -  
moduleName - for which nodeId list is required
Returns:
Vector of nodeIds.
Throws:
NmsStorageException - for any database error
UserTransactionException - If any error occurs inside the User Transaction block. This is applicable only when this API is executed within the context of a User Transaction.
See Also:
UserTransactionException

getParent

public java.lang.String getParent(java.lang.String userName,
                                  java.lang.String nodeId)
                           throws java.rmi.RemoteException,
                                  NmsStorageException,
                                  UserTransactionException
Description copied from interface: NmsTreeAPI
This method returns parent NodeID for the given NodeID
Specified by:
getParent in interface NmsTreeAPI
Following copied from interface: com.adventnet.nms.fe.common.NmsTreeAPI
Parameters:
NODEID: - ID
userName -  
Returns:
String it returns the parent NodeID of the given NodeID.
Throws:
NmsStorageException - for any database error
UserTransactionException - If any error occurs inside the User Transaction block. This is applicable only when this API is executed within the context of a User Transaction.
See Also:
UserTransactionException

getPanelTreeNode

public PanelTreeNode getPanelTreeNode(java.lang.String userName,
                                      java.lang.String nodeId)
                               throws java.rmi.RemoteException,
                                      NmsStorageException,
                                      UserTransactionException
Description copied from interface: NmsTreeAPI
Returns PanelTreeNode for the given nodeId and userName.
Specified by:
getPanelTreeNode in interface NmsTreeAPI
Following copied from interface: com.adventnet.nms.fe.common.NmsTreeAPI
Parameters:
NODEID: - ID
userName -  
Returns:
PanelTreeNode which contains details regarding the node
Throws:
NmsStorageException - for any database error
UserTransactionException - If any error occurs inside the User Transaction block. This is applicable only when this API is executed within the context of a User Transaction.
See Also:
UserTransactionException

deleteAllNodes

public boolean deleteAllNodes(java.lang.String userName)
                       throws java.rmi.RemoteException,
                              NmsStorageException,
                              UserTransactionException
Description copied from interface: NmsTreeAPI
This method removes all tree nodes from the user defined tree (for the specified user).
Specified by:
deleteAllNodes in interface NmsTreeAPI
Following copied from interface: com.adventnet.nms.fe.common.NmsTreeAPI
Parameters:
userName - represents the name of the user
Returns:
boolean true if operation is successful else false
Throws:
NmsStorageException - for any database error
UserTransactionException - If any error occurs inside the User Transaction block. This is applicable only when this API is executed within the context of a User Transaction.
See Also:
UserTransactionException

getNodeCount

public int getNodeCount(java.lang.String userName)
                 throws java.rmi.RemoteException,
                        NmsStorageException,
                        UserTransactionException
Description copied from interface: NmsTreeAPI
This method returns number of tree node that exist for a given user.
Specified by:
getNodeCount in interface NmsTreeAPI
Following copied from interface: com.adventnet.nms.fe.common.NmsTreeAPI
Parameters:
userName -  
Returns:
count as integer
Throws:
NmsStorageException - for any database error
UserTransactionException - If any error occurs inside the User Transaction block. This is applicable only when this API is executed within the context of a User Transaction.
See Also:
UserTransactionException

nodeExist

public boolean nodeExist(java.lang.String userName,
                         java.lang.String nodeId)
                  throws java.rmi.RemoteException,
                         NmsStorageException,
                         UserTransactionException
Description copied from interface: NmsTreeAPI
This method returns true if the tree node is present in user defined tree.
Specified by:
nodeExist in interface NmsTreeAPI
Following copied from interface: com.adventnet.nms.fe.common.NmsTreeAPI
Parameters:
NODEID: - ID
userName -  
Returns:
booleam true: if NodeID exist and false: if NodeID doesn't exist
Throws:
NmsStorageException - for any database error
UserTransactionException - If any error occurs inside the User Transaction block. This is applicable only when this API is executed within the context of a User Transaction.
See Also:
UserTransactionException

getTree

public XMLNode getTree(java.lang.String userName,
                       java.lang.String id)
                throws java.rmi.RemoteException,
                       NmsStorageException,
                       UserTransactionException
Description copied from interface: NmsTreeAPI
This method returns hierarchy of the given node (whose id is passed as an argument).
Specified by:
getTree in interface NmsTreeAPI
Following copied from interface: com.adventnet.nms.fe.common.NmsTreeAPI
Parameters:
userName -  
NODEID: - ID
Returns:
XMLNode: root node that gives the full hierachy of its child nodes
Throws:
NmsStorageException - for any database error
UserTransactionException - If any error occurs inside the User Transaction block. This is applicable only when this API is executed within the context of a User Transaction.
See Also:
UserTransactionException

AdventNet Web NMS 4 API Specification