Nucleus performs one basic operation: resolving component names. Given the name of a component, Nucleus does its best to find or create that component and return it.

Within Nucleus, certain components can contain other components, forming a component hierarchy. For example, given the name /services/logs/FileLogger, Nucleus resolves it by looking for components in the following locations:

Nucleus recognizes any component that implements atg.naming.NameContext as a container of other components, thereby allowing that component to participate in the naming hierarchy.

Nucleus can also resolve names relative to some NameContext. For example, Nucleus can resolve the name ../db/Connections relative to the logs NameContext, which in the end translates to /services/db/Connections.

Name resolution is not a difficult task. Nucleus shows its real power by creating components and hooking them up to other components automatically. This function is invoked when Nucleus is asked to resolve a name of a component that does not yet exist. In this case, Nucleus looks for the appropriate configuration file that describes how to create that component and any other components that it requires.

On startup, Nucleus is given a configuration path—a list of configuration directories that contain the configuration files of various components. Within the configuration directories, Nucleus expects to find a configuration file that uses the component name.

For example, to create the component /services/logs/FileLogger, where the configuration root directory is <ATG10dir>/DAS/config, Nucleus looks for FileLogger’s configuration in:

<ATG10dir>/DAS/config/services/logs/FileLogger.properties

Configuration File Format

The configuration file is a properties file that follows the key=value format expected by the class java.util.Properties. For example:

$class=somepackage.FileLogger
fileName=/work/logs/log1
maximumFileSize=20000

The properties file lists the property values used to initialize the new component. For example, when this component is created, its fileName property is set to /work/logs/log1, and its maximumFileSize property is set to 20000.

The properties file also includes special properties that are read only by Nucleus. These special properties begin with a $ character. In the previous example, the $class property is required by Nucleus to determine what class of object to create for the component. So when Nucleus is asked to resolve the name /services/logs/FileLogger, it creates an object of class somepackage.FileLogger, binds that object into the naming hierarchy, and sets its fileName and maximumFileSize properties. The new component remains in the namespace, so the next time Nucleus resolves that same name it retrieves the same component without having to create it again.

The previous example shows how Nucleus sets simple property values such as Strings and integers. Nucleus can also set properties to other Nucleus components. For example, the FileLogger component might require a pointer to a Scheduler component; in this case, it sets a scheduler property to a Scheduler component, as follows:

$class=somepackage.FileLogger
fileName=/work/logs/log1
maximumFileSize=20000
scheduler=/services/Scheduler

In order to initialize this FileLogger, Nucleus must resolve the component name /services/Scheduler. This might require Nucleus to create a Scheduler component, which might further require initialization of other components. After all components are resolved and created, the scheduler property is set and the initialization of the FileLogger component is complete.

For more information about how Nucleus sets component properties, see Managing Properties Files.


Copyright © 1997, 2012 Oracle and/or its affiliates. All rights reserved.

Legal Notices