10. Environment-Specific PropertiesΒΆ
Any property used by DPBuddy can be prefixed with the name of an environment. For example, you can prefix all properties for the “test” environment with the “test.” prefix. Internally, DPBuddy creates a custom Ant property provider/property helper that deals with environment prefixes.
When a property (e.g., dp.url
) is requested by Ant, the property provider will check if test.dp.url
is defined and if it is, it will return the value of this property. The property provider prepends each known prefix to the requested name of the property and checks if a property with this prefixed name exists. Once the existing property is found, its value is returned to the requesting task/command.
You can concatenate multiple prefixes together. For example, you could have a prefix for an environment and then a sub-prefix for a DataPower domain in that environment, such as “test.domain1.”. DPBuddy’s property provider will first check if a property with the prefix “test.domain1.” is defined. Then it will check if a property with the prefix “test. ” is defined. In other words, prefixes create a hierarchy of namespaces. You can define properties specific to a domain using the “test.domain1.” prefix and properties specific to the “test” environment using the “test.” prefix.
DPBuddy’s property provider uses ”.” as the prefix separator, which is consistent with the Ant’s property naming style.
The prefix-based property management mechanism is completely generic and can be used to manage any set of properties, not just those related to DPBuddy and DataPower.
Properties containing prefixes are regular Ant properties; they can be defined in one or multiple properties files, or inline using Ant “property” task. They can also be specified in the configuration files used by DPBuddy CLI.
Run DPBuddy in verbose mode (using -v
) to see to see how the property provider resolves properties. Look for “Resolved property ...” lines in the log.