By constructing an nRealmNode, and connecting to
a realm, the realm node will automatically begin receving
status information from the realm periodically, as well
as when things occur.
nRealmNode
The nRealmNode is the root of a Nirvana Realm's
namespace, which is a tree like structure that contains
child nodes. The tree nodes are all subclasses of a
base class nNode. Each node corresponds to
one of the following node subclasses:
nRealmNode - other realm
nodes that have been added to this realm's namespace
nContainer - folders, if
there was a channel called /eur/uk/rates, there would
be a child nContainer node called, 'eur' which would
have a child called 'uk' etc.
nLeafNode - these correspond
to channels and queues
nServiceNode - these correspond
to p2p services.
The nRealmNode itself is a subclass of the
nContainer class. To obtain an enumeration of all child
nodes within a realm node, simply call the following:
Enumeration children = realm.getNodes();
Once you have this enumeration of nodes, you can then
perform the various operations on those nodes available
through the nAdminAPI.
If you know the name of the child node you wish to
obtain a reference to, you can use the following method:
nNode found = realm.findNode("/eur/uk/rates";
Which should return you an nLeafNode that corresponds
to the channel called '/eur/uk/rates'.
As well as obtaining references to existing nodes,
it is also possible to create and delete channels and
queues using the nRealmNode. For example, to
create a channel called '/eur/fr/rates', we would write
the following code:
nChannelAttributes cattrib = new nChannelAttributes();
cattrib.setMaxEvents(0);
cattrib.setTTL(0);
cattrib.setType(nChannelAttributes.SIMPLE_TYPE);
cattrib.setName(“/eur/fr/rates”);
nLeafNode channel = realm.createChannel(cattrib);
To remove channel or a queue, you can simply call the
following method on your relam node (using the channel
created above):
realm.delLeafNode(channel);
For more information on the Nirvana Administration,
please see the API
documentation, and the administrator
guide.
|