Finding a realm descriptor and key by name
The finding a realm descriptor and key by name example shows how to find a realm.
Each realm has a unique realm path, much like a folder
or directory in an operating system. For example, the NCM/realmOne path
indicates that NCM
is a realm and realmOne
is
a subrealm (subfolder) of NCM
. This path can be used
to find a realm (also known as a container). For various methods,
you may need either a descriptor or a key. Should you find a need
to have a RealmKey
object, rather than a ResourceContainerKey
,
use the getKeyAsRealmKey
method on the descriptor.
Also, you can use the getRootContainer
convenience
method in ResourceManager to retrieve the root realm descriptor.
ResourceContainerDescriptor realmRCD = null;
ResourceContainerKey realmKey = null;
try {
realmRCD = rMgr.getContainer(realmPath);
} catch (IcosException ie) {
System.out.println("Caught IcosException getting realm");
ie.printStackTrace();
System.err.println(ie.getNestedExceptionStackTrace());
} catch (Exception e) {
System.out.println("Caught Exception getting realm");
e.printStackTrace();
}
if (realmRCD == null) {
//handle condition
} else {
realmKey = realmRCD.getKey();
}