|
Status Events
The nLeafNode extends nNode which is a subclass of
Observable, so when the status information is received
for a leaf node, (this occurs only when things change
on the channel or queue, i.e. acl, connections, events
published / consumed etc) the nLeafNode will trigger
the update callback on any known Observers. For example,
if you write a class that implements the Observer interface,
then we can do the following:
Enumeration children = realm.getNodes();
while (children.hasMoreElements();
nNode child = (nNode)children.nextElement();
if (child instanceof nLeafNode) {
child.addObserver(this);
}
}
Assuming 'this' is the instance of the class implementing
Observer, then the implementation of the update(Observable
obs, Object obj) will be notified that the leaf
node has changed.
When events occur on a leaf node that you have added
an observer to, the Observable/Observer mechanism will
notify you of the details of that event. For example,
the following implentation of the update method of the
Observer interface demonstrates how to detect that a
channel or queue acl has been added or deleted:
public void update(Observable obs, Object obj){
if (obs instanceof nLeafNode) {
if (obj instanceof nACLEntry) {
nLeafNode leaf = (nLeafNode)obs;
nACLEntry entry = (nACLEntry)obj;
if (leaf.isChannel()) {
// acl modified / added / deleted
System.out.println("Channel "+leaf.getName()+"
acl event for "+entry.getSubject());
} else {
// acl modified / added / deleted
System.out.println("Queue "+leaf.getName()+"
acl event for "+entry.getSubject());
}
}
}
}
For more information on how to obtain management
data from queues and channels using the enterprise manager
please see the enterprise manater.
For more information on the Nirvana Administration,
please see the API
documentation, and the enterprise
manager guide. |