Global properties in Oracle ATG Commerce
Think of a scenario where we want to set the same property in multiple components in Oracle ATG Commerce? How can we achieve it?
Global properties in Oracle ATG Commerce is the solution for it. Any property set in the GLOBAL.properties will apply the same value to the property present in the files configuration directory and sub directories.
For example, consider the file /localconfig/stxscervices/GLOBAL.properties might have the following setting:
defaultTemperature= firty degree
The above property setting will apply the values ‘fifty degree’ to all the occurrence of the property ‘defaultTemperature’ in all the components in /stxservices and its sub directories.
Precedence of Global properties in Oracle ATG Commerce
In case of a global property setting and components own property setting, always the components own property setting has the highest precedence.
For example, if the component /services/NewyorkWeather sets the defaultTemperature property to ‘forty degree’, this value overrides the global setting of ‘fifty degree’.
If the NewyorkWeather component does not define the defaultTemperature property, then it uses the global setting value ‘fifty degree’
Multiple Global properties in Oracle ATG Commerce
Multiple global properties files ca set a property value in a component, but the immediate global property to the component takes the precedence compared to other global properties.
Example: In the following example, the component /services/ NewyorkWeather is configured by two global properties files and its own properties file, listed in ascending order of precedence:
Combining global properties and component property settings
We can always append the Property values of the component to those defined by a global properties file.
For example, a global properties file might declare the property extremeClimateCities:
To append single value to the above extremeClimateCities property can be achieved as below:
This yields the following composite of settings for the component:
extremeClimateCities = Philadephia,California,Columbus,Buffalo
Enable/disable the Logging in multiple components using Global properties in Oracle ATG Commerce
Another widely used scenario for GLOBAL.properties is to enable/disable the loggingDebug
If you want to enable/disable logging for all the components, or want to set a different logging levels, we can achieve the same using GLOBAL.properties file. For example:
Note: loggingDebug will generate tons of logs which can lead to a performance issue, hence should not be enabled in the live site. In case of debugging only those component that need to be debugged should be enabled and debugged.
TechnoStixs.com is a dedicated weblog for Java/J2EE and web developers. We take pride in our work. Every publication is carefully analyzed, written and tested to ease the understanding of the topic or subject.
We cover Java Core Technologies, eCommerce, J2EE Frameworks, Web Service, Build Tools, Unit Test Frameworks and Others.
2,444 total views, 1 views today