Welcome, Guest! Log In | Create Account

Well Known Names and First Class Objects

Nodes which are directly under an index are First Class Objects. Indexes are also First Class Object and, except for the System Index, must always be directly under another index.

Every index has a Well Known Table, which is returned by the method PNode wellKnown() in the current context. The Well Known Table holds symbolic links to all the First Class Objects in that index which have been assigned a Well Known Name.

A Well Known Name can be assigned to a First Class Object by calling the method void setWellKnownName(String wellKnownName) on that node. However, once a Well Known Name has been assigned, the object's name can no longer be changed. Only the Well Known Name can be changed, by again calling the method void setWellKnownName(String wellKnownName) on the node. For this reason, a unique name is generally given to First Class Objects prior to assigning a Well Known Name. Note that unique names are given when creating a First Class Object by calling PNode addReference(String role) rather than PNode addReference(String role, String name) when creating the node.

The absolutePathname() method normally constructs a pathname using the object's name and all the names of the objects, up to the root branch index which it is under. But when a Well Known Name has been assigned, the Well Known Name is used in preference to the object's regular name. Conversely, the resolvePathname(String pathname) method uses both regular names and Well Known Names to resolve the pathname.

Here is a sample program which demonstrates the use of Well Known Names. And here is the output from that program.

UP: [CowDb]
PREVIOUS: [SymbolicLinks]
NEXT: [DeepCopies]