In a system that contains many components, it is common that multiple components are initialized with the same property values. In order to maintain consistent property settings among these components, you can specify common property settings in one place, which the various components can all reference. Nucleus lets you link the property of one component to the property in another component through the ^=
operator, as follows:
property-name
^=component-name
.property-name
Note: No white space should precede or follow the ^=
operator.
For example, you might want to initialize the currentWeather
property in the Sunny
component from the currentWeather
property in the RainyWeather
component. To do this, set the Sunny
component’s properties file as follows:
$class=Weather
currentWeather^=RainyWeather.currentWeather
When Nucleus starts, the Sunny.
currentWeather
property obtains its value from RainyWeather.currentWeather
.
Note: Property linkage only occurs when the related components are initialized. After initialization, the linked properties are completely independent. So, given the previous example, changes to RainyWeather.currentWeather
have no effect on Sunny.currentWeather
.
Typically, frequently modified configuration values are placed into properties of a single component, which only serves to hold the property values referenced by other component. All components in the application that need those values link their properties to this component.
Linking properties in the ATG Control Center
You can link properties using the Component Editor by selecting the value of a property in the Properties tab and clicking the @ button. The Component Editor presents a dialog that displays all the available components in your application. You can then select the component, or property of a component, to which you want to link. The Component Editor automatically edits the related properties file to set the new value with the ^
character.