nLeafNode (Channels and Queues)
Before you use the administration objects associated with the namespace of a realm, you should understand:
The concept of the Universal Messaging Namespace, as discussed in the nRealmNode guide (see
nRealmNode).
The publish/subscribe and message queue functions of Universal Messaging.
The concept of the nRealmNode and how to create it.
nLeafNode
The nLeafNode is either a channel or a queue, and is, as its name suggests, an end point of a branch of the namespace tree. The parent of an nLeafNode is always an instance of nContainer. Since nRealmNode is a subclass of nContainer, sometimes the parent of an nLeafNode is also an instance of an nRealmNode. For example, consider the following 2 channels within the namespace:
/eur/uk/rates
/rates
The nLeafNode that corresponds to the channel '/eur/uk/rates' will have a parent which is an instance of nContainer, and is called 'uk', whereas the nLeafNode that corresponds to the channel '/rates' has a parent which is also an instance of nContainer, however is is also an instance of an nRealmNode (i.e. the namespace root), since it does not contain any folder information in its name.
When channels and queues are created, they are added to the tree structure of the nRealmNode as nLeafNodes. Universal Messaging adds the nLeafNode automatically, but will send notifications to indicate that the namespace structure has changed so that the application handles the changes. For more details about managing the structure, see the "Management Information" section in this guide.
To determine if an nLeafNode is a channel or a queue, you can use one of the methods in the following code snippets to search the namespace and print out whether each leaf node it finds is a channel or a queue.
Example: Find channels and queues in the namespace
public void searchNodes(nContainer container)
Enumeration children = container.getNodes();
while (children.hasMoreElements()) {
nNode child = (nNode)children.nextElement();
if (child instanceof nContainer) {
searchNodes((nContainer)child);
} else if (child instanceof nLeafNode) {
nLeafNode leaf = (nLeafNode)child;
if (leaf.isChannel) {
System.out.println("Leaf Node "+leaf.getName()+" is a channel");
} else if (leaf.isQueue()) {
System.out.println("Leaf Node "+leaf.getName()+" is a queue");
}
}
}
}
In the above code example, by the searchNodes(realm) method searches the namespace from the realm node, and this isChannel() and isQueue() methods are used to determine whether each leaf node is a queue or a channel.
Associated with each leaf node, is the nChannelAttributes for the queue or channel, this is obtained by using the getAttributes() method, so it is possible to determine the characteristics of each leaf node.
Each leaf 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.