code sample icon Sample Code

Replace the generated code with the following code:

package oracle.model.mycompany;


import java.util.Properties;

import oracle.mds.core.MetadataObject;
import oracle.mds.core.RestrictedSession;
import oracle.mds.cust.CacheHint;
import oracle.mds.cust.CustomizationClass;

public class SiteCC extends CustomizationClass {
    private static final String DEFAULT_LAYER_NAME = "site";
    private String mLayerName = DEFAULT_LAYER_NAME;

    public SiteCC() {

    public SiteCC(String layerName) {
        mLayerName = layerName;

    public CacheHint getCacheHint() {
        return CacheHint.ALL_USERS;

    public String getName() {
        return mLayerName;

    public String[] getValue(RestrictedSession sess, MetadataObject mo) {

      // This needs to return the site value at runtime. 
      // For now, it's always null.
      Properties properties = new Properties();
        String configuredValue = null;
              Class clazz = SiteCC.class;
              InputStream is = clazz.getResourceAsStream("/");
              if (is != null){
                  try {
                      String propValue = properties.getProperty(mLayerName);
                      if (propValue != null){
                          configuredValue = propValue;
                  } catch (IOException e) {
      return new String[] {configuredValue};

Instead of typing the sample code, you can copy the code in this window and then paste it into the source editor.

Copyright © 1997, 2009, Oracle. All rights reserved.

false ,,,,,,,,,,,,,,,