|
"WEBNMS_5 API Docs" | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface TopoBulkListener
This is the interface that needs to be implemented for getting notifications
about the bulk add and bulk delete operations done in topology database. The
deleteObject(XMLNode) method would be called when a bulk delete operation is being
done using TopoAPI.deleteObjectAndSubElements(String) method or using
TopoAPI.deleteObjects(String, Properties) method.
The method addObjects() would be called when a bulk add operation is being done.
To receive for notifications, users should implement this interface and register
with the TopoDB using the TopoAPI.addTopoBulkListener(TopoBulkListener) method. All the listeners that have
been registered with TopoAPI as TopoBulkListeners would be notified (in the order in which
they were registered) before deleting the ManagedObjects from the Topology database
using bulk-delete operation.
The class that implements this interface can listen for notifications through RMI too. To use RMI, get the TopoAPI reference through RMI and register as a listener with the TopoDB using addTopoBulkListener().
Since Web NMS 5
TopoAPI.addTopoBulkListener(TopoBulkListener),
TopoAPI.deleteObjectAndSubElements(String),
TopoAPI.deleteObjects(String,Properties)| Method Summary | |
|---|---|
boolean |
addObjects(java.util.Vector managedObjects)
This method would be invoked whenever bulk add operation is done using the API TopoAPI.addObjects(String,Vector).The Listeners will be notified with the Vector of
ManagedObjects which are added to the Topology database. |
boolean |
deleteObject(XMLNode data)
This method would be called whenever a bulk delete operation is done using TopoAPI.deleteObjectAndSubElements() method or using TopoAPI.deleteObjects() or when a 'deleteNetwork' operation is performed from the client-UI. |
| Method Detail |
|---|
boolean deleteObject(XMLNode data)
throws java.rmi.RemoteException,
NmsException
This method would be called whenever a bulk delete operation is done using TopoAPI.deleteObjectAndSubElements() method or using TopoAPI.deleteObjects() or when a 'deleteNetwork' operation is performed from the client-UI. A bulk delete operation results when TopoAPI.deleteObjectAndSubElements() is used for deleting a network object or an object that is a parent of a Container relationship or group relationship. or the bulk delete operation results when TopoAPI.deleteObjects() method is called to delete a bulk of objects which matches the property criteria. For deleteObjectAndSubElements() method,the parameter that is passed as an XMLNode would contain the key of the object to be deleted (), keys of all the objects to be deleted and a SQL Query, which when executed, gives the keys of the child objects to be deleted. The child node KEYS has a Vector as attribute. Each element has keys of objects to be deleted surrounded by quotes and comma seperated.
The pattern of the XMLNode would be like the one given below for the notification about the deletion of a Container parent.
< BULK_DELETE_INFO >
< DATA
sqlQuery="select NAME from ManagedObject where ManagedObject.PARENTKEY = '192.168.4.0'"
parentObjectKey="192.168.4.0" />
< PROPS
parentKey="192.168.4.0" />
< KEYS
KEYS=['192.168.4.1','192.168.4.2','192.168.4.3'] />
</BULK_DELETE_INFO>
For deleteObjects() method,the parameter that is passed as an XMLNode would contain the SQL Query, which when executed, gives the criteria matched objects to be deleted and keys of all the objects to be deleted. If the property for match criteria is given as tester="max" then the pattern of the XMLNode would be like the one given below for the notification about the deletion of the objects with the property tester as "max". The child node KEYS has a Vector as attribute. Each element has keys of objects to be deleted surrounded by quotes and comma seperated.
< BULK_DELETE_INFO >
< DATA
sqlQuery="select NAME from ManagedObject where ManagedObject.TESTER like 'max'" />
< KEYS
KEYS=['192.168.4.1','192.168.4.2','192.168.4.3'] />
</BULK_DELETE_INFO>
For Cascade delete operations invoked by deleteObjectAndSubElements(String,int) method the parameter that is passed as an XMLNode would contain the SQL Query, which when executed, gives the Container Object and its Subelements of all the levels
The pattern of the XMLNode would be like the one given below for the notification about the deletion of a Container parent with level 3
< BULK_DELETE_INFO >
< DATA
sqlQuery="select name from ManagedObject where parentKey in
(select NAME from ManagedObject where ManagedObject.PARENTKEY = '192.168.4.0'") or name in
( select NAME from ManagedObject where ManagedObject.PARENTKEY = '192.168.4.0') or name ='192.168.4.0'
/>
< PROPS
parentKey="192.168.4.0" />
< LEVEL
level=3 />
< KEYS
KEYS=['192.168.4.1','192.168.4.2','192.168.4.3'] />
</BULK_DELETE_INFO>
When the API deleteObjects(String,int) is called ,
The pattern of the XMLNode would be like the one given below for the notification
about the deletion of a Container parent with level of objects deleted.
< BULK_DELETE_INFO >
< DATA
sqlQuery="select name from ManagedObject where parentKey in ( select name from ManagedObject where parentKey in
(select NAME from ManagedObject where ManagedObject.name like '192.168.4.0') ) or parentKey in
( select NAME from ManagedObject where ManagedObject.name like '192.168.4.0') ) or name in
(select NAME from ManagedObject where ManagedObject.name like '192.168.4.0')
< PROPS
name="192.168.4.0" />
/>
< LEVEL
level=3 />
< KEYS
KEYS=['192.168.4.1','192.168.4.2','192.168.4.3'] />
</BULK_DELETE_INFO>
Applications implementing this interface can execute this SQL query to the database to get the keys of the MO's to be deleted. If the database access is not available to the application, the application can get the keys of the objects to be deleted using the method TopoAPI.getObjectNamesWithProps() by passing to it, the properties provided under the < PROPS> tag of the XML notification.
After getting the keys of the ManagedObjects to be deleted, this method can handle the deletion of the other objects associated with the objects that are to be deleted. For example, if a Network is tried to be deleted using TopoAPI.deleteObjectAndSubElements() method, the SQL query (that is passed to this method in the < DATA > tag of the XMLNode) when executed, would return the list of the Nodes and interfaces belonging to the Network. Now suppose if one of the nodes in the Network has been modeled as a Container parent and has child objects associated with it, then this method can handle the deletion of the child objects suitably (This condition can be easily handled in this method, by calling TopoAPI.deleteObjectAndSubElements() for the container parent object).Please refer WebNMS<:home>/default_impl/applications/SwitchMap/SwitchTopoListener.java for an example implementation to delete the port objects under a switch, when the netwok deletion is performed.
data - In case of deleteObjectAndSubElements(),it is XMLNode containing the name
of the parent-Object (for which TopoAPI.deleteObjectAndSubElemnts() was called) and
an SQL query that gets the sub-elements of the parent object .
In case of deleteObjects(),it is XMLNode containing an SQL query that gets the
criteria based objects to get deleted.
NmsException - Thrown if the listener is not successful in deleting the associated objects.
If the listener wants to rollback the whole bulk-delete operation then the listener can throw NmsException by setting its actionType to
NmsException.ROLLBACK. Otherwise, it can set the actionType of the
NmsException that is thrown, to NmsException.COMMIT.
java.rmi.RemoteException - Thrown by the listener if an exception occurs due to RMI.
boolean addObjects(java.util.Vector managedObjects)
throws java.rmi.RemoteException,
NmsException
TopoAPI.addObjects(String,Vector).The Listeners will be notified with the Vector of
ManagedObjects which are added to the Topology database.
Applications implementing this interface can carry out necessary operations, based on the notification obtained, with the vector of ManagedObjects.
managedObjects - Vector of ManagedObjects which are added to the database.
NmsException - Thrown if the listener is not successful in adding the associated objects.
If the listener wants to rollback the whole bulk-add operation , then this listener can throw NmsException by setting its actionType to
NmsException.ROLLBACK. Otherwise, it can set the actionType of the
NmsException that is thrown, to NmsException.COMMIT.
java.rmi.RemoteException - Thrown by the listener if an exception occurs due to RMI.
|
"WEBNMS_5 API Docs" | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||