Earlier sections of this chapter focus on the various interfaces used by naming and Nucleus services. Very little is said about Nucleus itself, because Nucleus itself has little functionality. It exists solely to find components in the hierarchy and create them if they do not exist. This function is offered in the following method:

public Object resolveName (String name,
                           NameContext nameContext,
                           boolean create)

The name is the name of the component to find. If the name is a relative name, the specified nameContext is the NameContext that is used as a starting point of the name resolution. The create flag determines if Nucleus should attempt to create the component if it cannot be found.

Nucleus also determines the policies for describing the namespace. For example, the fact that forward slash (/) is used to separate the elements of a name is a policy issue implemented by Nucleus, not a general characteristic of NameContext. These policies are exposed in the following methods:

public String getAbsoluteName (NameContextElement element);

This returns the absolute name of a component in the Nucleus namespace. The component must implement NameContextElement in order to be examined by this method.

public String getAbsoluteElementName (NameContextElement element,
                                      String name)

This returns the absolute name of a hypothetical child of the specified element. For example, if the element is /services/servers, and the name is HttpServer, this returns /services/servers/HttpServer.

In order for a component to use these functions, the component must have a pointer to Nucleus. If the component implements ServiceListener, the component is passed a pointer to Nucleus when the component is initialized. Nucleus also acts as the root of the name hierarchy.

For more information, see the description of the atg.nucleus.Nucleus class in the ATG Platform API Reference.