FileDocCategorySizeDatePackage
ServiceConfigFactory.javaAPI DocGlassfish v2 API5152Fri May 04 22:34:40 BST 2007com.sun.enterprise.diagnostics

ServiceConfigFactory

public class ServiceConfigFactory extends Object
Responsible for creating ServiceConfig object per configuration in domain.xml
author
mu125243

Fields Summary
private static Map
diagnosticServiceConfigs
Map between a config and it's diagnostic service configuration. Multiple instances may be using same configuration in which case there is only one ServiceConfig object for those instances.
private static Map
instanceConfigMap
instance name to config name map
private static ServiceConfig
defaultConfig
Config with default values
private static ServiceConfigFactory
configFactory
Constructors Summary
private ServiceConfigFactory()
Creates a new instance of ServiceConfigFactory

        diagnosticServiceConfigs = new HashMap(5);
        instanceConfigMap = new HashMap(5);
    
Methods Summary
public static ServiceConfiggetDefaultServiceConfig()

return
ServiceConfig with default values

            if( defaultConfig == null) {
                defaultConfig = new ServiceConfig(true,true, true, 
                    true,true, true, Defaults.MIN_LOG_LEVEL, 
                    Defaults.MAX_NO_OF_ENTRIES, Defaults.LOG_FILE, null, null);
                return defaultConfig;
            }
        return null;
    
public static synchronized com.sun.enterprise.diagnostics.ServiceConfigFactorygetInstance()
Returns a ServiceConfgiFactory object

return
ServiceConfigFactory

        if (configFactory == null)
            configFactory = new ServiceConfigFactory();
        
        return configFactory;
    
public ServiceConfiggetServiceConfig(java.lang.String instanceName)
Gets service config for a instance.

param
instanceName instance name
return
diagnostic-service configuration

        if (instanceName != null) {
            String configName = (String)instanceConfigMap.get(instanceName);
            return (ServiceConfig)diagnosticServiceConfigs.get(configName);
        }
        return null;
    
public ServiceConfiggetServiceConfig(boolean local, java.lang.String repositoryRoot, java.lang.String instanceName)
Gets diagnostic-service configuration

param
local flag which indicates whether command is run in local or remote
param
repositoryRoot local/central repository root
param
instanceName name of the instance
return
diagnostic-service configuration for a instance

        if (repositoryRoot != null && instanceName != null) {
            try {
                
                ServiceConfig config = new ServiceConfig(local, 
                        repositoryRoot, instanceName);
                return config;
            }catch(Exception de) {
                // If for some reason diagnostic-service element in domain.xml
                // is not readable, return diagnostic information with 
                // default values. 
                return getDefaultServiceConfig();
            }
        }
        return null;