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 where 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 where 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, the following are all treated as absolute names:
/services/Weather
/services/somedir/../Weather
/
Absolute names are resolved by starting from the root and resolving each element of the name in order.
Dot Names
In both absolute and relative names, dot names have special meanings. These dot names can be used anywhere in a name, relative and absolute:
Notation | Description |
---|---|
| Refers to the current component, and usually has no effect on the name resolution process. For example, |
| Refers to the parent of the current component. For example, |
| Initiates a search up the component hierarchy for the name specified after the triple dot. For example, the name The triple dot can also be used in more complex names. For example, given this name:
these names are searched in the following order:
In summary, Nucleus searches for everything after the triple dot by walking up the hierarchy defined by everything before the triple dot. If Nucleus cannot find the component and must try to create it, Nucleus uses the same search algorithm to find the component’s property configuration file. |