Administration Guide : Universal Messaging Administration API : Management Information : nServiceNode
nServiceNode
Universal Messaging's admin API provides real time asynchronous information on all objects within a realm server. By creating an nRealmNode (see nRealmNode), and connecting to a realm, information is automatically delivered to the realm node from the realm.
This information is delivered as and when the state changes for one or all of the objects managed within a realm and it also delivers summary information periodically.
Before reading this section it may be useful to look at the management information available via the Universal Messaging enterprise manager. A full description of all Realm management screens is available in the enterprise manager guide. All functionality seen in the enterprise manager can be easily added to bespoke admin and monitoring processes as it is written entirely using the Universal Messaging Admin API.
This section discussed the information that can be obtained through the nAdmin API for the nServiceNode object which is associated with a Universal Messaging P2P service:
Status Events
The nServiceNode extends nNode which is a subclass of Observable, so when the status information is received for a service node, (this occurs only when things change on the service, i.e. acl, connections, events published / consumed etc) the nServiceNode will trigger the update callback on any known Observers who are interested in receiving information about the service.
For example, if you write a class that implements the Observer interface, then the nServiceNode callback can be added as follows:
Java, C#:
Enumeration children = realm.getNodes();
while (children.hasMoreElements();
nNode child = (nNode)children.nextElement();
if (child instanceof nServiceNode) {
child.addObserver(this);
}
}
C++:
fSortedList nodes = pNode->getNodes();
fSortedList::iterator iterator;

for (iterator = nodes.begin(); iterator != nodes.end(); iterator++)
{
nNode *pNde = (nRealmNode*)iterator->second;

if (pNde->getType() ==fBase::SERVICENODE)
{
pNde->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 service node has changed.
When events occur on a service 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 implementation of the update method of the Observer interface demonstrates how to detect that a service acl has been added or deleted:
Java, C#:
public void update(Observable obs, Object obj){
if (obs instanceof nServiceNode) {
if (obj instanceof nACLEntry) {
nServiceNode srvc = (nServicefNode)obs;
nACLEntry entry = (nACLEntry)obj;
// acl modified / added / deleted
System.out.println("Service"+srvc.getName()+"
acl event for "+entry.getSubject());
}
}
}
C++:
void ObservableMapping::update(Observable *pObs, void *pObj)
{
if (obs->getType() == fBase::SERVICENODE) {
if (obj->getType() == fBase::ACLENTRY) {
nServiceNode srvc = (nServiceNode*)obs;
nACLEntry entry = (nACLEntry*)obj;
// acl modified / added / deleted
printf("Service %s",entry.getSubject());
}
}
}
}
For more information on Universal Messaging Administration, please see the API documentation, and the Enterprise Manager Guide.
Copyright © 2013-2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback