FileDocCategorySizeDatePackage
PropertyResolver.javaAPI DocGlassfish v2 API4654Sat Dec 24 18:48:20 GMT 2005com.sun.enterprise.config.serverbeans

PropertyResolver

public class PropertyResolver extends com.sun.enterprise.util.RelativePathResolver
author
kebbs

Fields Summary
private com.sun.enterprise.config.serverbeans.Domain
_domain
private com.sun.enterprise.config.serverbeans.Cluster
_cluster
private com.sun.enterprise.config.serverbeans.Server
_server
private com.sun.enterprise.config.serverbeans.Config
_config
Constructors Summary
public PropertyResolver(com.sun.enterprise.config.ConfigContext configContext, String instanceName)
Creates a new instance of Class

    
                  
         
         
    
        _domain = ServerHelper.getDomainConfigBean(configContext);
        _config = ServerHelper.getConfigForServer(configContext, instanceName);        
        _server = ServerHelper.getServerByName(configContext, instanceName);
        if (ServerHelper.isServerClustered(configContext, _server)) {
            _cluster = ClusterHelper.getClusterForInstance(configContext, instanceName);
        }
    
Methods Summary
private java.lang.StringgetPropertyValue(java.lang.String propName, SystemProperty[] props)
Given a propery name, return its corresponding value in the specified SystemProperty array. Return null if the property is not found.

        String propVal = null;
        for (int i = 0; i < props.length; i++) {
            if (props[i].getName().equals(propName)) {
                return props[i].getValue();
            }
        }
        return propVal;
    
public java.lang.StringgetPropertyValue(java.lang.String propName, boolean bIncludingEnvironmentVariables)
Given a propery name, return its corresponding value as defined in the domain, configuration, cluster, or server element. Return null if the property is not found. Property values at the server override those at the configuration which override those at the domain level.

        String propVal = null;
        //First look for a server instance property matching the propName
        if (_server != null) {
            propVal = getPropertyValue(propName, _server.getSystemProperty());
        }
        if (propVal == null) {
            if (_cluster != null) {
                //If not found in the server instance, look for the propName in the 
                //cluster
                propVal = getPropertyValue(propName, _cluster.getSystemProperty());
            }            
            if (propVal == null) {
                if (_config != null) {             
                    //If not found in the server instance or cluster, look for the 
                    //propName in the config
                    propVal = getPropertyValue(propName, _config.getSystemProperty());
                    if (propVal == null) {
                        if (_domain != null) {
                            //Finally if the property is not found in the server, cluster,
                            //or configuration, look for the propName in the domain
                            propVal = getPropertyValue(propName, _domain.getSystemProperty());
                        }
                    }
                }
            }
        }
        if (propVal == null) {
            propVal = super.getPropertyValue(propName, bIncludingEnvironmentVariables);
        }
        return propVal;
    
public java.lang.StringgetPropertyValue(java.lang.String propName)

        return getPropertyValue(propName, true);