nServiceNode (P2P Services)
Once you are familiar with the concept of the Universal Messaging Namespace, as discussed in the nRealmNode guide, you can then begin to use the other objects associated with a realm's Namespace.
This section discusses the nServiceNode which is used to administrate Nirvna P2P services. A general description of Universal Messaging P2P services is also available in the developer guide.
nServiceNode
The nServiceNode represents a Universal Messaging P2P service. The nServiceNode objects are generally stored under the root realm node. They can be obtained by a number of methods Firstly, by an enumeration of all child nodes from a realm node.
Java:
public void searchNodes(nContainer container) {
Enumeration children = container.getNodes();
while (children.hasMoreElements()) {
nNode child = (nNode)children.nextElement();
if (child instanceof nServiceNode) {
nServiceNode service = (nServiceNode)child;
System.out.println("Found Service : "+service.getName());
}
}
}
C#:
public void searchNodes(nContainer container) {
System.Collections.IEnumerator children = realm.getNodes();
while (children.MoveNext()){
nNode child = (nNode)children.Current;
if (child is nServiceNode) {
nServiceNode service = (nServiceNode)child;
Console.WriteLine("Found Service : "+service.getName());
}
}
}
C++:
void searchNodes(fSortedList nodes)
for (fSortedList::iterator iterator = nodes.begin(); iterator != nodes.end(); iterator++)
{
nNode *pNode = iterator->second;
int type = pNode->getType ();
if (type == fBase::CONTAINER)
{
searchNodes(((nContainer*)pNode)->getNodes());
}
else if (type == fBase::SERVICENODE)
{
nServiceNode *pSNode = (nServiceNode*)pNode;
printf("Found Service : "+service->getName());
}
}
}
Or, directly from the realm node by calling :
Java:
Vector services = realm.getServicesList();
C#:
List services = realm.getServicesList();
C++:
services = realm->getServicesList();
Each nServiceNode will have a parent which is an instance of nContainer, however this is also an instance of an nRealmNode (i.e. the namespace root), since services do not contain any folder information in its name.
As services are created, they are added to the nRealmNode's tree structure as nServiceNodes. This is all managed for you and does not require you to modify the structure. However it is possible to be notified when changes to the namespace occur so that your application can handle it as you see fit. This is discussed in more detail in the Management Information section of this guide.
Associated with each service node, is an nServiceInfo object that describes the details of each service node.
Each service node also has an associated nACL object that can be modified to change security permissions for users. This is discussed in more detail in the security section of this guide.
For more information on Universal Messaging Administration, please see the API documentation, and the Enterprise Manager Guide.