FileDocCategorySizeDatePackage
ServerConfigLookup.javaAPI DocGlassfish v2 API73143Wed Sep 05 19:14:00 BST 2007com.sun.enterprise.web

ServerConfigLookup

public class ServerConfigLookup extends Object

Fields Summary
protected static final String
HADB_CONNECTION_URL_PREFIX
The prefix for the HADB connection url
protected static final String
CLUSTER_ID_PROPERTY_NAME
The property name into domain.xml to obtain the cluster-id string Note: all instances in a cluster must have the same cluster-id defined at this location in server.xml 7.0 xpath was "/server/availability-service/persistence-store/property[@name='cluster-id']";
protected static final String
STALE_SESSION_CHECKING_ENABLED_PROPERTY_NAME
The property name into domain.xml to obtain the stale-session-checking-enabled string
protected static final String
DEFAULT_CLUSTER_ID
The default cluster-id if none is defined in domain.xml Note: the default is ok if only one cluster is being serviced by an instance of HADB; if not then each cluster needs its own unique cluster-id and each instance must have it correctly defined in its server.xml
protected static final String
HADB_STORE_POOL_JNDI_NAME_PROPERTY_NAME
The xpath expression into domain.xml to obtain the hadb-store-pool-jndi-name string 7.0 xpath was "/server/availability-service/persistence-store/property[@name='store-pool-jndi-name']";
protected static final String
DEFAULT_STORE_POOL_JNDI_NAME
The default store-pool-jndi-name (used by Web Container for HTTP Persistence to HADB
protected static final String
HADB_MGMT_ENV_PATH_PROPERTY_NAME
The xpath expression into server.xml to obtain the hadb-mgmt-env-path string 7.0 xpath was "/server/availability-service/persistence-store/property[@name='hadb-mgmt-env-path']"
protected static final String
HADB_DATABASE_NAME_PROPERTY_NAME
The property name in domain.xml to obtain the hadb-database-name string 7.0 xpath was "/server/availability-service/persistence-store/property[@name='hadb-database-name']";
protected static final String
UUID_GENERATOR_CLASS_PROPERTY_NAME
The property name into domain.xml to obtain the UuidGenerator impl class name
protected static final String
DEFAULT_UUID_GENERATOR_CLASS
The default UuidGenerator class (fully qualified name)
protected static final String
EE_BUILDER_PATH_PROPERTY_NAME
The property name in domain.xml to obtain the EE builder path - this property is not expected now to change and if it ever did, then the directory and package structure for the builder classes would have to change also 7.0 xpath was "/server/availability-service/persistence-store/property[@name='ee-builder-path']"
protected static final String
DEFAULT_EE_BUILDER_PATH
The default path to the EE persistence strategy builders
protected static final String
HADB_HEALTH_CHECK_ENABLED_PROPERTY_NAME
The property name in domain.xml to obtain the hadb-health-check string 7.0 xpath was "/server/availability-service/persistence-store/property[@name='hadb-health-check-enabled']";
protected static final int
DEFAULT_HA_STORE_HEALTHCHECK_INTERVAL_IN_SECONDS
The default value of hadb-healthcheck-interval-in-seconds
protected static final String
USER_NAME
The property name in domain.xml to obtain the user name string in hadb jdbc-connection pool (for http session persistence)
protected static final String
PASSWORD
The property name in domain.xml to obtain the password string in hadb jdbc-connection pool (for http session persistence)
protected static final String
HADB_AGENT_PASSWORD
The property name in domain.xml to obtain the HADB agent password (used for connecting to HADB agent)
private static final String
NATIVE_REPLICATION_ENABLED
private static final String
CLUSTER_MEMBERS
private static final String
NUMBER_OF_PIPES
private static final String
LATENCY_COUNT
private static final String
MAX_SESSION_UNLOAD_TIME_IN_SECONDS
private static final String
REPLICATION_MEASUREMENT_ENABLED
private static final String
REPLICATION_MEASUREMENT_INTERVAL
private static final String
WAIT_FOR_ACK_PROPERTY
private static final String
WAIT_FOR_FAST_ACK_PROPERTY
protected static final int
DEFAULT_REQUEST_PROCESSING_THREAD_COUNT
The default value of thread-count
protected com.sun.enterprise.config.ConfigContext
_configContext
The config context passed in via constructor used when a dynamic config context is needed rather than usual run-time config context e.g. deployment
private static final Logger
_logger
The logger to use for logging ALL web container related messages.
Constructors Summary
public ServerConfigLookup()
Creates a new instance of ServerConfigLookup

    
    
           
      
    
public ServerConfigLookup(com.sun.enterprise.config.ConfigContext configContext)
Creates a new instance of ServerConfigLookup

param
configContext

        this();        
        _configContext = configContext;        
    
Methods Summary
public booleancalculateWebAvailabilityEnabledFromConfig(java.lang.String contextRoot, java.lang.String j2eeAppName)
Get the availability-enabled from domain.xml. This takes into account: global web-container-availability web-module (if stand-alone) return false if not found

 
        if(_logger.isLoggable(Level.FINEST)) {
            _logger.finest("in ServerConfigLookup>>calculateWebAvailabilityEnabledFromConfig");
        }
        //global availability from <availability-service> element
        boolean globalAvailability = 
            this.getAvailabilityEnabledFromConfig();
        if(_logger.isLoggable(Level.FINEST)) {
            _logger.finest("globalAvailability = " + globalAvailability);
        }
        //System.out.println("globalAvailability = " + globalAvailability);
        //web container availability from <web-container-availability> sub-element
        boolean webContainerAvailability = 
            this.getWebContainerAvailabilityEnabledFromConfig(globalAvailability);
        if(_logger.isLoggable(Level.FINEST)) {
            _logger.finest("webContainerAvailability = " + webContainerAvailability);
        }        
        //System.out.println("webContainerAvailability = " + webContainerAvailability);
        //System.out.println("j2eeAppName=" + j2eeAppName);
        if(j2eeAppName == null || "null".equals(j2eeAppName)) {
            //the stand-alone web module case
            boolean webModuleAvailability =
                this.getWebModuleAvailability(contextRoot, webContainerAvailability);
            if(_logger.isLoggable(Level.FINEST)) {
                _logger.finest("webModuleAvailability = " + webModuleAvailability);
            }
            //System.out.println("webModuleAvailability = " + webModuleAvailability);            
            return globalAvailability 
                    && webContainerAvailability 
                    && webModuleAvailability;
        } else {
            //the j2ee application case
            boolean j2eeApplicationAvailability =
                this.getJ2eeApplicationAvailability(j2eeAppName, webContainerAvailability);
            if(_logger.isLoggable(Level.FINEST)) {
                _logger.finest("j2eeApplicationAvailability = " + j2eeApplicationAvailability);            
            }
            //System.out.println("j2eeApplicationAvailability = " + j2eeApplicationAvailability);            
            return globalAvailability 
                    && webContainerAvailability 
                    && j2eeApplicationAvailability;
        }
    
private voiddisplayArrayList(java.util.ArrayList list)

        System.out.println("DISPLAY CLUSTER MEMBERS");
        for(int i=0; i<list.size(); i++) {
            System.out.println("clusterMember[" + i + "] = " + list.get(i));
        }
    
private com.sun.enterprise.config.serverbeans.ApplicationsgetApplicationsBean()
Get the applications element from domain.xml. return null if not found

        Applications applicationsBean = null;
        Domain domainBean = null;
        /*
        ServerContext serverCtx = ApplicationServer.getServerContext();
        ConfigContext configCtx = serverCtx.getConfigContext();
         */
        ConfigContext configCtx = this.getConfigContext();
        try {
            domainBean = ServerBeansFactory.getDomainBean(configCtx);
            if(domainBean != null) {
                applicationsBean = domainBean.getApplications();
            }
        } catch (ConfigException ex) {}

        return applicationsBean;
    
private com.sun.enterprise.config.serverbeans.ApplicationsgetApplicationsBeanDynamic()
Get the applications element from domain.xml. return null if not found

        Applications applicationsBean = null;
        Domain domainBean = null;
        /*
        ServerContext serverCtx = ApplicationServer.getServerContext();
        ConfigContext configCtx = serverCtx.getConfigContext();
         */
        ConfigContext configCtx = this.getConfigContextDynamic();
        try {
            domainBean = ServerBeansFactory.getDomainBean(configCtx);
            if(domainBean != null) {
                applicationsBean = domainBean.getApplications();
            }
        } catch (ConfigException ex) {}
        return applicationsBean;
    
public booleangetAvailabilityEnabledFromConfig()
Get the availability-enabled from domain.xml. return false if not found

        if(_logger.isLoggable(Level.FINEST)) {
            _logger.finest("in ServerConfigLookup>>getAvailabilityEnabledFromConfig");
        }
        AvailabilityService as = this.getAvailabilityService();
        if(as == null) {
            if(_logger.isLoggable(Level.FINEST)) {
                _logger.finest("AvailabilityService was not defined - check domain.xml");
            }
            return false;
        }        
        return as.isAvailabilityEnabled();
    
protected com.sun.enterprise.config.serverbeans.AvailabilityServicegetAvailabilityService()
Get the availability-service element from domain.xml. return null if not found

        Config configBean = this.getConfigBean();
        if(configBean == null) {
            return null;
        }
        return configBean.getAvailabilityService();
    
protected com.sun.enterprise.config.serverbeans.AvailabilityServicegetAvailabilityServiceDynamic()
Get the availability-service element from domain.xml. return null if not found

        Config configBean = this.getConfigBeanDynamic();
        if(configBean == null) {
            return null;
        }
        return configBean.getAvailabilityService();
    
public java.lang.StringgetAvailabilityServicePropertyString(java.lang.String propName)
Get the String value of the property under availability-service element from domain.xml whose name matches propName return null if not found

param
propName

        String result = null;
        AvailabilityService availabilityServiceBean = this.getAvailabilityService();
        if( (availabilityServiceBean != null) && (availabilityServiceBean.sizeElementProperty() > 0) ) {
            ElementProperty[] props = availabilityServiceBean.getElementProperty();
            for (int i = 0; i < props.length; i++) {
                String name = props[i].getAttributeValue("name");
                String value = props[i].getAttributeValue("value");
                if (name.equalsIgnoreCase(propName)) {
                    result = value;
                }
            }
        }
        return result;
    
public com.sun.enterprise.config.serverbeans.ClustergetCluster()
Get the cluster if the server is in a cluster return null if not

        ConfigContext configCtx = this.getConfigContext();
        String serverName = this.getServerName();
        boolean isClustered = false;
        try {
            isClustered = ServerHelper.isServerClustered(configCtx, serverName);
        } catch (ConfigException ex) {}
        if(!isClustered) {
            return null;
        }
        Cluster cluster = null;
        try {
            cluster = ClusterHelper.getClusterForInstance(configCtx, serverName);
        } catch (ConfigException ex) {}
        return cluster;        
    
public java.lang.StringgetClusterIdFromConfig()
Get the cluster-id from domain.xml. return "cluster1" if not found

        if(_logger.isLoggable(Level.FINEST)) {
            _logger.finest("in ServerConfigLookup>>getClusterIdFromConfig");
        }
        return this.getWebContainerAvailabilityPropertyString(CLUSTER_ID_PROPERTY_NAME, DEFAULT_CLUSTER_ID);
        //return this.getAvailServicePersistenceStorePropertyString(CLUSTER_ID_PROPERTY_NAME, DEFAULT_CLUSTER_ID);
    
java.util.ArrayListgetClusterInstanceNamesList()

        ArrayList instanceNames = new ArrayList();
        ServerConfigLookup lookup = new ServerConfigLookup();
        String instanceNamesString = 
            lookup.getAvailabilityServicePropertyString(CLUSTER_MEMBERS);
        if(instanceNamesString == null) {
            return instanceNames;
        }
        String[] instancesArray = instanceNamesString.split(",");
        List instancesList = Arrays.asList(instancesArray);
        for(int i=0; i<instancesList.size(); i++) {
            //System.out.println("getClusterInstanceNamesList:elem" + i + " = " + ((String)instancesList.get(i)).trim() );
            instanceNames.add( ((String)instancesList.get(i)).trim() );
        }
        return instanceNames;
    
public java.lang.StringgetClusterName()
Get the cluster name from domain.xml for this server. return null if not found

        String result = null;
        /*
        ServerContext serverCtx = ApplicationServer.getServerContext();
        ConfigContext configCtx = serverCtx.getConfigContext();
         */
        ConfigContext configCtx = this.getConfigContext();
        
        String serverName = this.getServerName();
        if(serverName == null) {
            return result;
        }
        boolean isClustered = false;
        try {
            isClustered = ServerHelper.isServerClustered(configCtx, serverName);
        } catch (ConfigException ex) {}
        if(!isClustered) {
            result = serverName + "_nc";    //non-clustered example: server1_nc            
            return result;
        }
        Cluster cluster = null;
        try {
            cluster = ClusterHelper.getClusterForInstance(configCtx, serverName);
        } catch (ConfigException ex) {}
        if(cluster != null) {
            result = cluster.getName();
        }
        return result;
    
private com.sun.enterprise.config.serverbeans.ConfiggetConfigBean()
Get the config element from domain.xml. return null if not found

        Config configBean = null;
        /*
        ServerContext serverCtx = ApplicationServer.getServerContext();
        ConfigContext configCtx = serverCtx.getConfigContext(); 
         */
        ConfigContext configCtx = this.getConfigContext();
        try {
            configBean = ServerBeansFactory.getConfigBean(configCtx);
        } catch (ConfigException ex) {}

        return configBean;
    
private com.sun.enterprise.config.serverbeans.ConfiggetConfigBeanDynamic()
Get the config element from domain.xml. return null if not found

        Config configBean = null;
        ConfigContext configCtx = this.getConfigContextDynamic();
        try {
            configBean = ServerBeansFactory.getConfigBean(configCtx);
        } catch (ConfigException ex) {}

        return configBean;
    
protected com.sun.enterprise.config.ConfigContextgetConfigContext()
Get the ConfigContext for this server return null if not found

        ServerContext serverCtx = this.getServerContext();
        if(serverCtx == null) {
            return null;
        }
        return serverCtx.getConfigContext();
    
protected com.sun.enterprise.config.ConfigContextgetConfigContextDynamic()
Get the ConfigContext for this server return null if not found

        if (_configContext != null) {
            return _configContext;
        } else {
            return getConfigContext();
        }
    
public java.lang.StringgetConnectionPasswordFromConfig()
Get the connectionPassword from domain.xml.


        String password = null;
        JdbcConnectionPool pool = this.getHadbJdbcConnectionPoolFromConfig();
        if(pool == null)
            return null;
        if (pool.sizeElementProperty() > 0) {
            ElementProperty[] props = pool.getElementProperty();
            for (int i = 0; i < props.length; i++) {
                String name = props[i].getAttributeValue("name");
                String value = props[i].getAttributeValue("value");
                if (name.equalsIgnoreCase(PASSWORD)) {
                //if (name.equalsIgnoreCase("password")) {
                        password = value; 
                }
            }
        }
        if(_logger.isLoggable(Level.FINEST)) {
            _logger.finest("IN NEW getConnectionPasswordFromConfig: password=" + password);        
        }
        return password;
    
public java.lang.StringgetConnectionURLFromConfig()
Get the connectionURL from domain.xml.

        String url = null;
        StringBuffer sb = new StringBuffer();
        JdbcConnectionPool pool = this.getHadbJdbcConnectionPoolFromConfig();
        if(pool == null)
            return null;
        if (pool.sizeElementProperty() > 0) {
            ElementProperty[] props = pool.getElementProperty();
            for (int i = 0; i < props.length; i++) {
                String name = props[i].getAttributeValue("name");
                String value = props[i].getAttributeValue("value");
                if (name.equalsIgnoreCase("serverList")) {
                    sb.append(HADB_CONNECTION_URL_PREFIX);
                    sb.append(value);
                    url = sb.toString(); 
                }
            }
        }
        if(_logger.isLoggable(Level.FINEST)) {
            _logger.finest("IN NEW getConnectionURLFromConfig: url=" + url); 
        }
        return url;
    
public java.lang.StringgetConnectionUserFromConfig()
Get the connectionUser from domain.xml.


        String user = null;
        JdbcConnectionPool pool = this.getHadbJdbcConnectionPoolFromConfig();
        if(pool == null) {
            return null;
        }
        if (pool.sizeElementProperty() > 0) {
            ElementProperty[] props = pool.getElementProperty();
            for (int i = 0; i < props.length; i++) {
                String name = props[i].getAttributeValue("name");
                String value = props[i].getAttributeValue("value");
                if (name.equalsIgnoreCase(USER_NAME)) {
                //if (name.equalsIgnoreCase("username")) {
                        user = value; 
                }
            }
        }
        if(_logger.isLoggable(Level.FINEST)) {
            _logger.finest("IN NEW getConnectionUserFromConfig: user=" + user);
        }
        return user;
    
public java.lang.StringgetEEBuilderPathFromConfig()
Get the EE_BUILDER_PATH from server.xml. this defaults to EE_BUILDER_PATH but can be modified this is the fully qualified path to the EE builders 7.0 xpath was "/server/availability-service/persistence-store/property[@name='ee-builder-path']"

        return this.getWebContainerAvailabilityPropertyString(EE_BUILDER_PATH_PROPERTY_NAME, DEFAULT_EE_BUILDER_PATH);
        //return this.getAvailServicePersistenceStorePropertyString(EE_BUILDER_PATH_PROPERTY_NAME, DEFAULT_EE_BUILDER_PATH);         
    
public intgetHaStoreHealthcheckIntervalInSecondsFromConfig()
Get the ha-store-healthcheck-interval-in-seconds from domain.xml. returns the attribute ha-store-healthcheck-interval-in-seconds in if missing (or error) default to DEFAULT_HA_STORE_HEALTHCHECK_INTERVAL_IN_SECONDS

        int candidateReturnValue = -1;
        int returnValue 
            = DEFAULT_HA_STORE_HEALTHCHECK_INTERVAL_IN_SECONDS;        
        String returnValueString = 
            this.getHaStoreHealthcheckIntervalInSecondsStringFromConfig();
        if(returnValueString != null) {
            try
            {
                candidateReturnValue = (Integer.valueOf(returnValueString)).intValue();
            } catch (NumberFormatException ex) {
                if(_logger.isLoggable(Level.FINEST)) {
                    _logger.finest("Using Default Value = " + DEFAULT_HA_STORE_HEALTHCHECK_INTERVAL_IN_SECONDS);
                }
            }
        }
        //avoid returning negative or zero values
        if(candidateReturnValue > 0) {
            returnValue = candidateReturnValue;
        }
        return returnValue;        
    
public intgetHaStoreHealthcheckIntervalInSecondsFromConfigDynamic()
Get the ha-store-healthcheck-interval-in-seconds from domain.xml. returns the attribute ha-store-healthcheck-interval-in-seconds in if missing (or error) default to DEFAULT_HA_STORE_HEALTHCHECK_INTERVAL_IN_SECONDS

        int candidateReturnValue = -1;
        int returnValue 
            = DEFAULT_HA_STORE_HEALTHCHECK_INTERVAL_IN_SECONDS;        
        String returnValueString = 
            this.getHaStoreHealthcheckIntervalInSecondsStringFromConfigDynamic();
        if(returnValueString != null) {
            try
            {
                candidateReturnValue = (Integer.valueOf(returnValueString)).intValue();
            } catch (NumberFormatException ex) {
                if(_logger.isLoggable(Level.FINEST)) {
                    _logger.finest("Using Default Value = " + DEFAULT_HA_STORE_HEALTHCHECK_INTERVAL_IN_SECONDS);
                }
            }
        }
        //avoid returning negative or zero values
        if(candidateReturnValue > 0) {
            returnValue = candidateReturnValue;
        }
        return returnValue;        
    
public java.lang.StringgetHaStoreHealthcheckIntervalInSecondsStringFromConfig()
Get the String value of the ha-store-healthcheck-interval-in-seconds attribute under availability-service element from domain.xml return null if not found

 
        AvailabilityService as = this.getAvailabilityService();
        if(as == null) {
            return null;
        }
        return as.getHaStoreHealthcheckIntervalInSeconds();        
    
public java.lang.StringgetHaStoreHealthcheckIntervalInSecondsStringFromConfigDynamic()
Get the String value of the ha-store-healthcheck-interval-in-seconds attribute under availability-service element from domain.xml return null if not found

 
        AvailabilityService as = this.getAvailabilityServiceDynamic();
        if(as == null) {
            return null;
        }
        return as.getHaStoreHealthcheckIntervalInSeconds();        
    
public java.lang.StringgetHaStorePoolJndiNameFromConfig()
Get the store-pool-jndi-name from domain.xml. return value returned from getStorePoolJndiNameFromConfig if not found

        if(_logger.isLoggable(Level.FINEST)) {
            _logger.finest("in ServerConfigLookup>>getHaStorePoolJndiNameFromConfig");
        }
        //String result = DEFAULT_STORE_POOL_JNDI_NAME;
        String result = this.getStorePoolJndiNameFromConfig();
        WebContainerAvailability webContainerAvailabilityBean =
            this.getWebContainerAvailability();
        if(webContainerAvailabilityBean == null) {
            return result;
        }
        String result2 = webContainerAvailabilityBean.getHttpSessionStorePoolName();
        if(result2 != null) {
            result = result2;
        }
        return result; 
    
public java.lang.StringgetHadbAgentConnectionURLFromConfig()
Get the connectionURL for hadb agent(s) from domain.xml.

        String url = null;
        StringBuffer sb = new StringBuffer();
        String hostsString = this.getHadbAgentHostsFromConfig();
        String portString = this.getHadbAgentPortFromConfig();
        if(hostsString != null && portString != null) { 
            sb.append(hostsString);
            sb.append(":");
            sb.append(portString);
            url = sb.toString();
        } else {
            url = null;
        }
        return url;
    
public java.lang.StringgetHadbAgentConnectionURLFromConfigDynamic()
Get the connectionURL for hadb agent(s) from domain.xml.

        String url = null;
        StringBuffer sb = new StringBuffer();
        String hostsString = this.getHadbAgentHostsFromConfigDynamic();
        String portString = this.getHadbAgentPortFromConfigDynamic();
        if(hostsString != null && portString != null) { 
            sb.append(hostsString);
            sb.append(":");
            sb.append(portString);
            url = sb.toString();
        } else {
            url = null;
        }
        return url;
    
public java.lang.StringgetHadbAgentHostsFromConfig()
Get the String value of the ha-agent-hosts attribute under availability-service element from domain.xml return null if not found

        AvailabilityService as = this.getAvailabilityService();
        if(as == null) {
            return null;
        }
        return as.getHaAgentHosts();
    
public java.lang.StringgetHadbAgentHostsFromConfigDynamic()
Get the String value of the ha-agent-hosts attribute under availability-service element from domain.xml return null if not found

        AvailabilityService as = this.getAvailabilityServiceDynamic();
        if(as == null) {
            return null;
        }
        return as.getHaAgentHosts();
    
public java.lang.StringgetHadbAgentPasswordFromConfig()
Get the String value of the ha-agent-password attribute under availability-service element from domain.xml return null if not found

        AvailabilityService as = this.getAvailabilityService();
        if(as == null) {
            return null;
        }
        return as.getHaAgentPassword();
    
public java.lang.StringgetHadbAgentPortFromConfig()
Get the String value of the ha-agent-port attribute under availability-service element from domain.xml return null if not found

        AvailabilityService as = this.getAvailabilityService();
        if(as == null) {
            return null;
        }
        return as.getHaAgentPort();
    
public java.lang.StringgetHadbAgentPortFromConfigDynamic()
Get the String value of the ha-agent-port attribute under availability-service element from domain.xml return null if not found

        AvailabilityService as = this.getAvailabilityServiceDynamic();
        if(as == null) {
            return null;
        }
        return as.getHaAgentPort();
    
public java.lang.StringgetHadbDatabaseNameFromConfig()
Get the String value of the ha-store-name attribute under availability-service element from domain.xml return null if not found

        AvailabilityService as = this.getAvailabilityService();
        if(as == null) {
            return null;
        }
        return as.getHaStoreName();
    
public java.lang.StringgetHadbDatabaseNameFromConfigDynamic()
Get the String value of the ha-store-name attribute under availability-service element from domain.xml return null if not found

        AvailabilityService as = this.getAvailabilityServiceDynamic();
        if(as == null) {
            return null;
        }
        return as.getHaStoreName();
    
public booleangetHadbHealthCheckFromConfig()
Get the hadb health check string from domain.xml. 7.0 xpath was "/server/availability-service/persistence-store/property[@name='hadb-health-check-enabled']" returns the attribute ha-store-healthcheck-enabled in

        AvailabilityService as = this.getAvailabilityService();
        if(as == null) {
            return false;
        }
        return as.isHaStoreHealthcheckEnabled();
    
public booleangetHadbHealthCheckFromConfigDynamic()
Get the hadb health check string from domain.xml. 7.0 xpath was "/server/availability-service/persistence-store/property[@name='hadb-health-check-enabled']" returns the attribute ha-store-healthcheck-enabled in

        AvailabilityService as = this.getAvailabilityServiceDynamic();
        if(as == null) {
            return false;
        }
        return as.isHaStoreHealthcheckEnabled();
    
public com.sun.enterprise.config.serverbeans.JdbcConnectionPoolgetHadbJdbcConnectionPoolFromConfig()
Get the JdbcConnectionPool for HADB from domain.xml. return null if not found

        String storePoolJndiName = this.getHaStorePoolJndiNameFromConfig();
        if(storePoolJndiName == null)
            return null;

        Resources resources = this.getResourcesBean();
        JdbcResource jdbcResource = 
            resources.getJdbcResourceByJndiName(storePoolJndiName);
        if(jdbcResource == null) {
            return null;
        }
                
        String poolName = jdbcResource.getPoolName();
        JdbcConnectionPool pool = 
            resources.getJdbcConnectionPoolByName(poolName);
        return pool;
    
public java.lang.StringgetHadbJdbcConnectionPoolNameFromConfig()
Get the JdbcConnectionPool name for HADB from domain.xml.


        String storePoolJndiName = this.getHaStorePoolJndiNameFromConfig();
        if(storePoolJndiName == null)
            return null;

        Resources resources = this.getResourcesBean();
        JdbcResource jdbcResource = 
            resources.getJdbcResourceByJndiName(storePoolJndiName);
        if(jdbcResource == null)
            return null;
        String poolName = jdbcResource.getPoolName();
        return poolName;
    
public java.lang.StringgetHadbMgmtEnvPathFromConfig()
Get the hadb management environment path from domain.xml. this is the location of cladm 7.0 xpath was "/server/availability-service/persistence-store/property[@name='hadb-mgmt-env-path']"

        return this.getWebContainerAvailabilityPropertyString(HADB_MGMT_ENV_PATH_PROPERTY_NAME, null);
        //return this.getAvailServicePersistenceStorePropertyString(HADB_MGMT_ENV_PATH_PROPERTY_NAME, null); 
    
protected com.sun.enterprise.config.serverbeans.HttpServicegetHttpService()
Get the http-service element from domain.xml. return null if not found

        Config configBean = this.getConfigBean();
        if(configBean == null) {
            return null;
        }
        return configBean.getHttpService();
    
public com.sun.enterprise.config.serverbeans.SessionManagergetInstanceSessionManager()
Get the session manager bean from domain.xml return null if not defined or other problem 7.0 xpath was "/server/web-container/session-config/session-manager";

 
        Config configBean = this.getConfigBean();
        if(configBean == null) {
            return null;
        }
        
        com.sun.enterprise.config.serverbeans.WebContainer webContainerBean 
            = configBean.getWebContainer();
        if(webContainerBean == null) {
            return null;
        }
        
        SessionConfig sessionConfigBean = webContainerBean.getSessionConfig();
        if(sessionConfigBean == null) {
            return null;
        }
        
        com.sun.enterprise.config.serverbeans.SessionManager smBean =
            sessionConfigBean.getSessionManager();
        return smBean;
    
public com.sun.enterprise.config.serverbeans.ManagerPropertiesgetInstanceSessionManagerManagerProperties()
Get the manager properties bean from domain.xml return null if not defined or other problem 7.0 xpath was "/server/web-container/session-config/session-manager/manager-properties";

        
        SessionManager smBean = this.getInstanceSessionManager();
        if(smBean == null) {
            return null;
        }
        return smBean.getManagerProperties();
    
public com.sun.enterprise.config.serverbeans.StorePropertiesgetInstanceSessionManagerStoreProperties()
Get the store properties bean from domain.xml return null if not defined or other problem 7.0 xpath was "/server/web-container/session-config/session-manager/store-properties";

        
        SessionManager smBean = this.getInstanceSessionManager();
        if(smBean == null) {
            return null;
        }
        return smBean.getStoreProperties();
    
public com.sun.enterprise.config.serverbeans.SessionPropertiesgetInstanceSessionProperties()
Get the session properties bean from server.xml return null if not defined or other problem 7.0 xpath was "/server/web-container/session-config/session-properties";

 
        Config configBean = this.getConfigBean();
        if(configBean == null) {
            return null;
        }
        
        com.sun.enterprise.config.serverbeans.WebContainer webContainerBean 
            = configBean.getWebContainer();
        if(webContainerBean == null) {
            return null;
        }
        
        SessionConfig sessionConfigBean = webContainerBean.getSessionConfig();
        if(sessionConfigBean == null) {
            return null;
        }
        
        com.sun.enterprise.config.serverbeans.SessionProperties spBean =
            sessionConfigBean.getSessionProperties();
        return spBean;
    
private booleangetJ2eeApplicationAvailability(java.lang.String appName, boolean inheritedValue)

        J2eeApplication j2eeApp =
            this.getJ2eeApplicationByName(appName);
        if(_logger.isLoggable(Level.FINEST)) {
            _logger.finest("ServerConfigLookup>>getJ2eeApplicationAvailability j2eeApp = " + j2eeApp);
        }
        //System.out.println("ServerConfigLookup>>getJ2eeApplicationAvailability j2eeApp = " + j2eeApp);        
        if(j2eeApp == null) {
            //FIXME remove after testing - protection if called in web module case
            //return inheritedValue;
            return false;
        }
        /*
        String appString = j2eeApp.getAvailabilityEnabled();
        Boolean bool = this.toBoolean(appString);
        if(bool == null) {
            return inheritedValue;
        } else {
            return bool.booleanValue();
        } 
         */
        return j2eeApp.isAvailabilityEnabled();
    
private com.sun.enterprise.config.serverbeans.J2eeApplicationgetJ2eeApplicationByName(java.lang.String appName)

        J2eeApplication result = null;
        Applications applicationsBean = this.getApplicationsBeanDynamic();
        if(applicationsBean == null) {
            return null;
        }
        return applicationsBean.getJ2eeApplicationByName(appName);
    
public intgetLatencyCountPropertyFromConfig()
returns the latency count value in if missing (or error) default to 0

        int candidateReturnValue = 0;
        int returnValue = 0;
        String returnValueString = 
            this.getAvailabilityServicePropertyString(LATENCY_COUNT);        
        if(returnValueString != null) {
            try
            {
                candidateReturnValue = (Integer.valueOf(returnValueString)).intValue();
            } catch (NumberFormatException ex) {
                if(_logger.isLoggable(Level.FINEST)) {
                    _logger.finest("Using Default Value = 0");
                }
            }
        }
        //for now only allow 1 or 0
        if(candidateReturnValue == 1) {
            returnValue = candidateReturnValue;
        }
        return returnValue;        
    
public intgetMaxSessionUnloadTimeInSecondsPropertyFromConfig()
returns the max_session_unload_time_in_seconds value in if missing (or error) default to 7 minutes (7*60 seconds)

        int candidateReturnValue = 7 * 60;
        int returnValue = 7 * 60;
        String returnValueString = 
            this.getAvailabilityServicePropertyString(MAX_SESSION_UNLOAD_TIME_IN_SECONDS);        
        if(returnValueString != null) {
            try
            {
                candidateReturnValue = (Integer.valueOf(returnValueString)).intValue();
            } catch (NumberFormatException ex) {
                if(_logger.isLoggable(Level.FINEST)) {
                    _logger.finest("Using Default Value = 7 * 60");
                }
            }
        }
        //only allow positive integers
        if(candidateReturnValue >= 0) {
            returnValue = candidateReturnValue;
        }
        return returnValue;        
    
public intgetNumberOfReplicationPipesFromConfig()
returns the number of steady-state pipes in pool will set equal to number of request processing threads plus one in the http-service or if the NUMBER_OF_PIPES property is set that will take precedence

        //if NUMBER_OF_PIPES property is set it will over-ride
        //else it will track the number of request processing threads
        //up to 40 - must be greater than 1
        int numPipes = getNumberOfReplicationPipesPropertyFromConfig();
        if(numPipes == -1) {
            numPipes = this.getRequestProcessingThreadCountFromConfig();
        }
        numPipes++;
        if(numPipes > 40) {
            numPipes = 41;
        }
        if(numPipes < 2) {
            numPipes = 2;
        }
        return numPipes;
    
public intgetNumberOfReplicationPipesPropertyFromConfig()
returns the number of steady-state pipes in pool in if missing (or error) default to -1

        int candidateReturnValue = -1;
        int returnValue 
            = -1;
        String returnValueString = 
            this.getAvailabilityServicePropertyString(NUMBER_OF_PIPES);        
        if(returnValueString != null) {
            try
            {
                candidateReturnValue = (Integer.valueOf(returnValueString)).intValue();
            } catch (NumberFormatException ex) {
                if(_logger.isLoggable(Level.FINEST)) {
                    _logger.finest("Using Default Value = 5");
                }
            }
        }
        //may return negative or zero value
        if(candidateReturnValue > 0) {
            returnValue = candidateReturnValue;
        }
        return returnValue;        
    
public java.lang.StringgetPersistenceFrequencyFromConfig()
Get the persistenceFrequency from domain.xml. return null if not found 7.0 xpath was "/server/web-container/session-config/session-manager/manager-properties/property[@name='persistenceFrequency']";

 
        if(_logger.isLoggable(Level.FINEST)) {
            _logger.finest("in ServerConfigLookup>>getPersistenceFrequencyFromConfig");
        }
      
        WebContainerAvailability webContainerAvailabilityBean =
        this.getWebContainerAvailability();
        if(webContainerAvailabilityBean == null) {
            return null;
        }
        return webContainerAvailabilityBean.getPersistenceFrequency();      
    
public java.lang.StringgetPersistenceScopeFromConfig()
Get the persistenceScope from domain.xml. return null if not found 7.0 xpath was "/server/web-container/session-config/session-manager/store-properties/property[@name='persistenceScope']";

        if(_logger.isLoggable(Level.FINEST)) {
            _logger.finest("in ServerConfigLookup>>getPersistenceScopeFromConfig");
        }
        WebContainerAvailability webContainerAvailabilityBean =
            this.getWebContainerAvailability();
        if(webContainerAvailabilityBean == null) {
            return null;
        }
        return webContainerAvailabilityBean.getPersistenceScope(); 
    
public com.sun.enterprise.web.session.PersistenceTypegetPersistenceTypeFromConfig()
Get the persistenceType from domain.xml. return null if not found

        if(_logger.isLoggable(Level.FINEST)) {
            _logger.finest("in ServerConfigLookup>>getPersistenceTypeFromConfig");
        }
        String persistenceTypeString = null;      
        PersistenceType persistenceType = null;

        WebContainerAvailability webContainerAvailabilityBean =
        this.getWebContainerAvailability();
        if(webContainerAvailabilityBean == null) {
            return null;
        }
        persistenceTypeString = webContainerAvailabilityBean.getPersistenceType();

        //System.out.println("ServerConfigLookup>>getPersistenceTypeFromConfig:persistenceTypeString=" + persistenceTypeString);  
        if(persistenceTypeString != null) {
            persistenceType = PersistenceType.parseType(persistenceTypeString);
        }
        if(persistenceType != null) {
            if(_logger.isLoggable(Level.FINEST)) {
                _logger.finest("SERVER.XML persistenceType= " + persistenceType.getType());
            }
        } else {
            if(_logger.isLoggable(Level.FINEST)) {
                _logger.finest("SERVER.XML persistenceType missing");
            }
        }
        return persistenceType;
    
public booleangetReplicationMeasurementEnabledFromConfig()
returns the replication_measurement_enabled property in if missing (or error) default to false

        boolean returnValue = false;
        String returnValueString = 
            this.getAvailabilityServicePropertyString(REPLICATION_MEASUREMENT_ENABLED);        
        if(returnValueString != null) {
            returnValue = (Boolean.valueOf(returnValueString));
        }
        return returnValue;        
    
public intgetReplicationMeasurementIntervalFromConfig()
returns the replication_measurement_interval property used to control frequency of measurement output in if missing (or error) default to 1000

        int candidateReturnValue = 1000;
        int returnValue = 1000;
        String returnValueString = 
            this.getAvailabilityServicePropertyString(REPLICATION_MEASUREMENT_INTERVAL);        
        if(returnValueString != null) {
            try
            {
                candidateReturnValue = (Integer.valueOf(returnValueString)).intValue();
            } catch (NumberFormatException ex) {
                if(_logger.isLoggable(Level.FINEST)) {
                    _logger.finest("Using Default Value = 1000");
                }
            }
        }
        //may return negative value
        if(candidateReturnValue > 0) {
            returnValue = candidateReturnValue;
        }
        return returnValue;        
    
private com.sun.enterprise.config.serverbeans.RequestProcessinggetRequestProcessing()
Get the request-processing element from domain.xml. return null if not found

        HttpService httpServiceBean = this.getHttpService();
        if(httpServiceBean == null) {
            return null;
        }
        return httpServiceBean.getRequestProcessing();
    
public intgetRequestProcessingThreadCountFromConfig()
Get the thread-count attribute in request-processing element from domain.xml. returns the attribute thread-count in if missing (or error) default to DEFAULT_REQUEST_PROCESSING_THREAD_COUNT

        int candidateReturnValue = -1;
        int returnValue 
            = DEFAULT_REQUEST_PROCESSING_THREAD_COUNT;        
        String returnValueString = 
            this.getRequestProcessingThreadCountStringFromConfig();
        if(returnValueString != null) {
            try
            {
                candidateReturnValue = (Integer.valueOf(returnValueString)).intValue();
            } catch (NumberFormatException ex) {
                if(_logger.isLoggable(Level.FINEST)) {
                    _logger.finest("Using Default Value = " + DEFAULT_REQUEST_PROCESSING_THREAD_COUNT);
                }
            }
        }
        //insure we have at least 5 pipes
        if(candidateReturnValue > 4) {
            returnValue = candidateReturnValue;
        }
        return returnValue;        
    
private java.lang.StringgetRequestProcessingThreadCountStringFromConfig()
Get the request-processing thread-count attribute from domain.xml. return null if not found

        RequestProcessing requestProcessingBean = this.getRequestProcessing();
        if(requestProcessingBean == null) {
            return null;
        }
        return requestProcessingBean.getThreadCount();
    
private com.sun.enterprise.config.serverbeans.ResourcesgetResourcesBean()
Get the resources element from domain.xml. return null if not found

        Resources resourcesBean = null;
        Domain domainBean = null;
        /*
        ServerContext serverCtx = ApplicationServer.getServerContext();
        ConfigContext configCtx = serverCtx.getConfigContext();
         */
        ConfigContext configCtx = this.getConfigContext();
        try {
            domainBean = ServerBeansFactory.getDomainBean(configCtx);
            if(domainBean != null) {
                resourcesBean = domainBean.getResources();
            }
        } catch (ConfigException ex) {}

        return resourcesBean;
    
private com.sun.enterprise.config.serverbeans.ServergetServerBean()
Get the server element from domain.xml. return null if not found

        Server serverBean = null;
        /*
        ServerContext serverCtx = ApplicationServer.getServerContext();
        ConfigContext configCtx = serverCtx.getConfigContext();
         */
        ConfigContext configCtx = this.getConfigContext();
        try {
            serverBean = ServerBeansFactory.getServerBean(configCtx);
        } catch (ConfigException ex) {}

        return serverBean;
    
public java.lang.StringgetServerConfigValue(java.lang.String xpath, java.lang.String defaultValue)
Get the value from server.xml for xpath return defaultValue if not defined or other problem

        if(_logger.isLoggable(Level.FINEST)) {
            _logger.finest("in ServerConfigLookup>>getServerConfigValue:xpath=" + xpath
                + " defaultValue= " + defaultValue);
        }

      ServerContext serverCtx = ApplicationServer.getServerContext();
      //this condition occurs during some unit tests
      if(serverCtx == null)
          return defaultValue;
      ConfigContext configCtx = serverCtx.getConfigContext();    
      ConfigBean configBean = null;
      String returnValueString = null;

      String returnValue = defaultValue;
      try {
          configBean =
              configCtx.exactLookup(xpath);
      } catch (ConfigException ex) {
      }      
      if(configBean != null) {
          returnValueString = configBean.getAttributeValue("value");
      }
      if(returnValueString != null) {
          returnValue = returnValueString;
      }
      if(_logger.isLoggable(Level.FINEST)) {
          _logger.finest("RETURNED CONFIG VALUE FOR XPATH:" + xpath +
            " = " + returnValue);
      }

      return returnValue;
    
public intgetServerConfigValue(java.lang.String xpath, int defaultValue)
Get the value from server.xml for xpath return defaultValue if not defined or other problem

        if(_logger.isLoggable(Level.FINEST)) {
            _logger.finest("in getServerConfigValue:xpath=" + xpath
                + " defaultValue= " + defaultValue);
        }
        /*
        ServerContext serverCtx = ApplicationServer.getServerContext();
        ConfigContext configCtx = serverCtx.getConfigContext();
        */
        ConfigContext configCtx = this.getConfigContext();
        ConfigBean configBean = null;
        String returnValueString = null;

        int returnValue = defaultValue;
        try {
            configBean =
                configCtx.exactLookup(xpath);
        } catch (ConfigException ex) {
        }      
        if(configBean != null) {
            returnValueString = configBean.getAttributeValue("value");
        }
        if(returnValueString != null) {
            try {
                returnValue = (Integer.valueOf(returnValueString)).intValue();
            } catch (NumberFormatException ex) {
                _logger.finest("Using Default Value = "
                    + defaultValue);
            }
        }
        if(_logger.isLoggable(Level.FINEST)) {
            _logger.finest("RETURNED CONFIG VALUE FOR XPATH:" + xpath +
                " = " + returnValue);
        }

        return returnValue;
    
protected com.sun.enterprise.server.ServerContextgetServerContext()
Get the ServerContext for this server return null if not found

        return ApplicationServer.getServerContext();
    
public java.lang.StringgetServerName()
Get the server name from domain.xml. return null if not found

        String result = null;
        Server serverBean = this.getServerBean();
        if(serverBean != null) {
            result = serverBean.getName();
        }
        return result;
    
public java.util.ArrayListgetServerNamesInCluster()

        ArrayList result = new ArrayList();
        ConfigContext configCtx = this.getConfigContext();        
        String serverName = this.getServerName();
        //this should not happen
        if(serverName == null) {
            //displayArrayList(result);
            return result;
        }
        boolean isClustered = false;
        try {
            isClustered = ServerHelper.isServerClustered(configCtx, serverName);
        } catch (ConfigException ex) {}
        //if not clustered try to find the property else just return
        //our own name alone
        if(!isClustered) {
            //from property under availability-service for stand-alones
            ArrayList instanceNamesArray = this.getClusterInstanceNamesList();
            if(!instanceNamesArray.isEmpty()) {
                result = instanceNamesArray;
            } else {
                result.add(serverName);
            }
            //displayArrayList(result);
            return result;
        }        
        // if clustered instance then get list of cluster members names
        String clusterName = this.getClusterName();
        Server[] serversArray = null;
        try {            
            serversArray = ServerHelper.getServersInCluster(configCtx, clusterName);
        } catch (ConfigException ex) {}
        for(int i=0; i<serversArray.length; i++) {
            Server nextServer = serversArray[i];
            /* FIXME this appears wrong
            if(i > 0) {
                result.add(nextServer.getName());
            }
             */
            result.add(nextServer.getName().trim());
        }
        //displayArrayList(result);
        return result;
    
public booleangetSsoFailoverEnabledFromConfig()
Get the sso-failover-enabled boolean from domain.xml.

        WebContainerAvailability webContainerAvailabilityBean =
        this.getWebContainerAvailability();
        if(webContainerAvailabilityBean == null) {
            return false;
        }
        return webContainerAvailabilityBean.isSsoFailoverEnabled(); 
    
public booleangetStaleSessionCheckingFromConfig()
Get the stale-session-checking-enabled from domain.xml. return false if not found

        if(_logger.isLoggable(Level.FINEST)) {
            _logger.finest("in ServerConfigLookup>>getStaleSessionCheckingFromConfig");
        }
        String staleSessionCheckingEnabledString =
            this.getWebContainerAvailabilityPropertyString(STALE_SESSION_CHECKING_ENABLED_PROPERTY_NAME, "false");
        Boolean bool = this.toBoolean(staleSessionCheckingEnabledString);
        if(bool == null) {
            return false;
        } else {
            return bool.booleanValue();
        }        
    
public java.lang.StringgetStorePoolJndiNameFromConfig()
Get the store-pool-jndi-name from domain.xml. This is the store-pool-name in element it represents the default for both web & ejb container return DEFAULT_STORE_POOL_JNDI_NAME if not found

        if(_logger.isLoggable(Level.FINEST)) {
            _logger.finest("in ServerConfigLookup>>getStorePoolJndiNameFromConfig");
        }
        String result = DEFAULT_STORE_POOL_JNDI_NAME;
        AvailabilityService as = this.getAvailabilityService();
        if(as == null) {
            return result;
        }
        String storePoolJndiName = as.getStorePoolName();
        if(storePoolJndiName != null) {
            result = storePoolJndiName;
        }
        return result;
    
public com.sun.enterprise.util.uuid.UuidGeneratorgetUuidGeneratorFromConfig()
Get the UuidGenerator implementation class from server.xml. 7.0 xpath was "/server/availability-service/persistence-store/property[@name='uuid-impl-class']";

      UuidGenerator generator = new UuidGeneratorImpl();
      String generatorImplClassName = 
        this.getUuidGeneratorImplClassFromConfig();  
      try {
          generator = 
                (UuidGenerator) (Class.forName(generatorImplClassName)).newInstance();
      } catch (Exception ex) {            
      } 
      return generator;
    
public java.lang.StringgetUuidGeneratorImplClassFromConfig()
Get the UuidGenerator implementation class name from domain.xml. 7.0 xpath was "/server/availability-service/persistence-store/property[@name='uuid-impl-class']", if specified. Use value of session-id-generator-classname attribute of "/server/web-container/session-config/session-manager/manager-properties" as fallback, or DEFAULT_UUID_GENERATOR_CLASS if no fallback specified.

        if(_logger.isLoggable(Level.FINEST)) {
            _logger.finest(
                "in ServerConfigLookup>>getUuidGeneratorImplClassFromConfig");
        }
        String defaultUuidGeneratorClass = DEFAULT_UUID_GENERATOR_CLASS;
        ManagerProperties mp = getInstanceSessionManagerManagerProperties();
        if (mp != null) {
            String cls = mp.getSessionIdGeneratorClassname();
            if (cls != null) {
                defaultUuidGeneratorClass = cls;
            }
        }
        return this.getWebContainerAvailabilityPropertyString(UUID_GENERATOR_CLASS_PROPERTY_NAME, defaultUuidGeneratorClass);
    
public booleangetWaitForAckPropertyFromConfig()
returns the wait_for_ack_property in if missing (or error) default to false

        boolean returnValue = false;
        String returnValueString = 
            this.getAvailabilityServicePropertyString(WAIT_FOR_ACK_PROPERTY);        
        if(returnValueString != null) {
            returnValue = (Boolean.valueOf(returnValueString));
        }
        return returnValue;        
    
public booleangetWaitForFastAckPropertyFromConfig()
returns the wait_for_fast_ack_property in if missing (or error) default to true

        boolean returnValue = true;
        String returnValueString = 
            this.getAvailabilityServicePropertyString(WAIT_FOR_FAST_ACK_PROPERTY);        
        if(returnValueString != null) {
            returnValue = (Boolean.valueOf(returnValueString));
        }
        return returnValue;        
    
private com.sun.enterprise.config.serverbeans.WebContainerAvailabilitygetWebContainerAvailability()
Get the web-container-availability element from domain.xml. return null if not found

        AvailabilityService availabilityServiceBean = this.getAvailabilityService();
        if(availabilityServiceBean == null) {
            return null;
        }
        return availabilityServiceBean.getWebContainerAvailability();
    
public booleangetWebContainerAvailabilityEnabledFromConfig()
Get the availability-enabled for the web container from domain.xml. return inherited global availability-enabled if not found

        boolean globalAvailabilityEnabled = this.getAvailabilityEnabledFromConfig();
        if(_logger.isLoggable(Level.FINEST)) {
            _logger.finest("in ServerConfigLookup>>getWebContainerAvailabilityEnabledFromConfig");
        }
        WebContainerAvailability was = this.getWebContainerAvailability();
        if(was == null) {
            if(_logger.isLoggable(Level.FINEST)) {
                _logger.finest("WebContainerAvailability was not defined - check domain.xml");
            }
            return globalAvailabilityEnabled;
        }
        
        String wasString = was.getAvailabilityEnabled();
        Boolean bool = this.toBoolean(wasString);
        if(bool == null) {
            return globalAvailabilityEnabled;
        } else {
            return bool.booleanValue();
        }       
    
public booleangetWebContainerAvailabilityEnabledFromConfig(boolean inheritedValue)
Get the availability-enabled for the web container from domain.xml. return inherited global availability-enabled if not found

        //boolean globalAvailabilityEnabled = this.getAvailabilityEnabledFromConfig();
        if(_logger.isLoggable(Level.FINEST)) {
            _logger.finest("in ServerConfigLookup>>getWebContainerAvailabilityEnabledFromConfig");
        }
        WebContainerAvailability was = this.getWebContainerAvailability();
        if(was == null) {
            if(_logger.isLoggable(Level.FINEST)) {
                _logger.finest("WebContainerAvailability was not defined - check domain.xml");
            }
            return inheritedValue;
        }
        
        String wasString = was.getAvailabilityEnabled();
        Boolean bool = this.toBoolean(wasString);
        if(bool == null) {
            return inheritedValue;
        } else {
            return bool.booleanValue();
        }       
    
private com.sun.enterprise.config.serverbeans.ElementProperty[]getWebContainerAvailabilityProperties()
Get the properties under the web-container-availability element from domain.xml. return array of single empty ElementProperty if not found

        WebContainerAvailability webContainerAvailabilityBean = 
            this.getWebContainerAvailability();
        if(webContainerAvailabilityBean == null) {
            return new ElementProperty[0];
        }
        return webContainerAvailabilityBean.getElementProperty();
    
protected intgetWebContainerAvailabilityPropertyInt(java.lang.String propName, int defaultValue)
Get the int value of the property under web-container-availability element from domain.xml whose name matches propName return defaultValue if not found

param
propName

        int returnValue = defaultValue;
        String returnValueString = null;
        WebContainerAvailability wcAvailabilityBean = this.getWebContainerAvailability();
        if( (wcAvailabilityBean != null) && (wcAvailabilityBean.sizeElementProperty() > 0) ) {
            ElementProperty[] props = wcAvailabilityBean.getElementProperty();
            for (int i = 0; i < props.length; i++) {
                String name = props[i].getAttributeValue("name");
                String value = props[i].getAttributeValue("value");
                if (name.equalsIgnoreCase(propName)) {
                    returnValueString = value;
                }
            }
        }
        if(returnValueString != null) {
            try
            {
                returnValue = (Integer.valueOf(returnValueString)).intValue();
            } catch (NumberFormatException ex) {
                if(_logger.isLoggable(Level.FINEST)) {
                    _logger.finest("Using Default Value = "
                        + defaultValue);
                }
            }
        }
        return returnValue;
    
protected java.lang.StringgetWebContainerAvailabilityPropertyString(java.lang.String propName)
Get the String value of the property under web-container-availability element from domain.xml whose name matches propName return null if not found

param
propName

        String result = null;
        WebContainerAvailability wcAvailabilityBean = this.getWebContainerAvailability();
        if( (wcAvailabilityBean != null) && (wcAvailabilityBean.sizeElementProperty() > 0) ) {
            ElementProperty[] props = wcAvailabilityBean.getElementProperty();
            for (int i = 0; i < props.length; i++) {
                String name = props[i].getAttributeValue("name");
                String value = props[i].getAttributeValue("value");
                if (name.equalsIgnoreCase(propName)) {
                    result = value;
                }
            }
        }
        return result;
    
protected java.lang.StringgetWebContainerAvailabilityPropertyString(java.lang.String propName, java.lang.String defaultValue)
Get the String value of the property under web-container-availability element from domain.xml whose name matches propName return defaultValue if not found

param
propName

        String result = null;
        WebContainerAvailability wcAvailabilityBean = this.getWebContainerAvailability();
        if( (wcAvailabilityBean != null) && (wcAvailabilityBean.sizeElementProperty() > 0) ) {
            ElementProperty[] props = wcAvailabilityBean.getElementProperty();
            for (int i = 0; i < props.length; i++) {
                String name = props[i].getAttributeValue("name");
                String value = props[i].getAttributeValue("value");
                if (name.equalsIgnoreCase(propName)) {
                    result = value;
                }
            }
        }
        if(result == null) {
            result = defaultValue;
        }
        return result;
    
private booleangetWebModuleAvailability(java.lang.String contextRoot, boolean inheritedValue)

        com.sun.enterprise.config.serverbeans.WebModule webModule =
            this.getWebModuleByContextRoot(contextRoot);
        if(webModule == null) {
            //FIXME remove after testing
            return false;
            //return inheritedValue;
        }
        /*
        String wmsString = webModule.getAvailabilityEnabled();
        Boolean bool = this.toBoolean(wmsString);
        
        if(bool == null) {
            return inheritedValue;
        } else {
            return bool.booleanValue();
        } 
         */
        return webModule.isAvailabilityEnabled();
    
private com.sun.enterprise.config.serverbeans.WebModulegetWebModuleByContextRoot(java.lang.String contextRoot)

        com.sun.enterprise.config.serverbeans.WebModule result = null;
        Applications applicationsBean = this.getApplicationsBeanDynamic();
        if(applicationsBean == null) {
            return null;
        }
        com.sun.enterprise.config.serverbeans.WebModule[] webModules =
            applicationsBean.getWebModule();
        for(int i=0; i<webModules.length; i++) {
            com.sun.enterprise.config.serverbeans.WebModule nextWebModule =
                webModules[i];
            String nextContextRoot = nextWebModule.getContextRoot();
            if(nextContextRoot != null && nextContextRoot.equalsIgnoreCase(contextRoot)) {
                result = nextWebModule;
            }
        }
        return result;
    
public booleanisDAS()
determine if this instance is the DAS

        boolean result = true;
        Server serverBean = this.getServerBean();
        ConfigContext configCtx = this.getConfigContext();
        if(serverBean != null && configCtx != null) {
            try {
                result = ServerHelper.isDAS(configCtx, serverBean);
            } catch (ConfigException ex) {}
        }
        return result;
    
public booleanisGMSEnabled()
If the clusterName is null; return false else return heartbeat enabled for the cluster

        if(getClusterName() == null) {
            return false;
        }
        Cluster cluster = getCluster();
        if(cluster == null) {
            return false;
        }
        return cluster.isHeartbeatEnabled();      
    
public static booleanisHADBInstalled()
determine if HADB is installed check if the value of the system property HADB_ROOT_PROPERTY is a directory

        String hadbRootDirString = System.getProperty(SystemPropertyConstants.HADB_ROOT_PROPERTY);
        if(hadbRootDirString == null) {
            return false;
        }
       // System.out.println("hadbRootDirString=" + hadbRootDirString);
        File hadbRootDir = new File(hadbRootDirString);
        return (hadbRootDir.exists() 
            && (hadbRootDir.isDirectory()) );
    
public booleanisNativeReplicationEnabledFromConfig()
Get the native_replication_enabled from domain.xml. return true if not found

        if(_logger.isLoggable(Level.FINEST)) {
            _logger.finest("in ServerConfigLookup>>getNativeReplicationEnabledFromConfig");
        }
        String nativeReplicationEnabledString =
            this.getAvailabilityServicePropertyString(NATIVE_REPLICATION_ENABLED);
        Boolean bool = this.toBoolean(nativeReplicationEnabledString);
        if(bool == null) {
            return true;
        } else {
            return bool.booleanValue();
        }        
    
protected java.lang.BooleantoBoolean(java.lang.String value)
convert the input value to the appropriate Boolean value if input value is null, return null

        if(value == null) return null;
        
        if (value.equalsIgnoreCase("true"))
            return Boolean.TRUE;
        if (value.equalsIgnoreCase("yes"))
            return Boolean.TRUE;
        if (value.equalsIgnoreCase("on") )
            return Boolean.TRUE;
        if (value.equalsIgnoreCase("1"))
            return Boolean.TRUE;
    
        return Boolean.FALSE;