When a name is resolved in a properties file, it is resolved one element at a time. In the previous example, a component was specified as Weather. The name resolution begins at the context in which the name was found. You can think of this as the directory containing the properties file, which in this case was /services. The name is then resolved one element at a time. Because this name consists of only one element, the result is /services/Weather.

The name Weather is a relative name, meaning that its resolution starts with the directory in which it was found. Any name that does not begin with a / is considered a relative name. For example, Weather, ../service1, logger/FileLogger, and .. are all relative names.

On the other hand, any name that begins with a / is considered an absolute name. For example, /services/Weather, /services/somedir/../Weather, and / are all treated as absolute names. Absolute names are resolved by starting from the root and resolving each element of the name in order.

In both absolute and relative names, there are “dot names” that have special meanings. These dot names can be used anywhere in a name, both relative or absolute:

. (single dot)

A single dot refers to the current component, and usually has no effect on the name resolution process. For example, Person and ./Person are equivalent, as are /services/log/FileLogger and /services/log/./FileLogger.

.. (double dot)

A double dot refers to the parent of the current component. For example, /services/log/../tests/BigTest is equivalent to /services/tests/BigTest.

... (triple dot)

A triple dot initiates a search up the component hierarchy for the name specified after the triple dot. For example, the name .../Adder will search the current context for a component called Adder, then will search the current component’s parent, then its parent, etc. until the component is found, or the root is reached (i.e., there are no more parents to search). The triple dot can also be used in more complex names. For example, /services/logs/.../files/TestFile, will look for the following names in order:

/services/logs/files/TestFile
/services/files/TestFile
/files/TestFile

In summary, Nucleus searches for everything after the triple dot by walking up the hierarchy defined by everything before the triple dot. If Nucleus is unable to find the component and must therefore attempt to create it, Nucleus uses the same searching algorithm to find the property configuration file for the component.

 
loading table of contents...