In a multisite environment, an Oracle ATG Web Commerce component can be configured to substitute site configuration values for the values otherwise provided by the component’s own properties, by setting two Nucleus properties:

For example, you can configure a component so one of its properties is set from a site’s custom configuration property cssFile . The component is defined with the following methods:

package my;
import atg.service.GenericService;
public class PageConfiguration extends GenericService {
...
String mStyleSheet;
  public void setStyleSheet(String pStyleSheet) {
    mStyleSheet = pStyleSheet;
  }

  public String getStyleSheet() {
    return mStyleSheet;
  }
  ...
}

The PageConfiguration component is configured as follows:

$class=my.PageConfiguration
$instanceFactory=/atg/multisite/SiteSourcedPropertyGetterSubClasser
$overridePropertyToValuePropertyMap=styleSheet=cssFile

styleSheet=default.css

At startup, Nucleus sets the component’s styleSheet property to default.css. However, on processing each request for this property, Nucleus uses the current site context to look up the site configuration property cssFile. If a value is found, Nucleus overrides the component’s styleSheet property setting and returns the site-specific value in cssFile. If cssFile is null, Nucleus returns default.css.

You can also specify to return null values from the site configuration by setting the Nucleus property $nullAsOverridePropertyNames. This property specifies to return null if the designated site configuration settings are also null. It disregards any settings that are set within the properties file itself or derived from other configuration directories. For example, you might modify the previous configuration with this setting:

$nullAsOverridePropertyNames=styleSheet

So, if cssFile is null, Nucleus overrides all other settings for styleSheet and returns null.


Copyright © 1997, 2012 Oracle and/or its affiliates. All rights reserved.

Legal Notices