FileDocCategorySizeDatePackage
RepositoryConfig.javaAPI DocGlassfish v2 API8661Fri May 04 22:24:30 BST 2007com.sun.enterprise.admin.servermgmt

RepositoryConfig

public class RepositoryConfig extends HashMap
This class represents a repository configuration. A repository can be either a domain, a node agent, or a server instance. Configuration specific to each (DomainConfig, AgentConfig, InstanceConfig) is derived from this class. A repository config consists of the following attributes: 1)repositoryName -- domain or node agent name (e.g. domain1 or agent1) 2)repositoryRoot -- the parent directory of the repository (e.g. $installDir/domains or $installDir/agents) 3)instanceName -- the optional server instance name (e.g. server1) 4)configurationName -- the optional configuration name of the server instance (e.g. default-config). Using (repositoryName, repositoryRoot, instanceName, configurationName) syntax. Here are the following permutations: 1)For a domain: (domainRootDirectory, domainName, null, null) e.g. ("/sun/appserver/domains", "domain1", null, null) 2)For a node agent: (agentRootDirectory, agentName, "agent", null) e.g ("/sun/appserver/agents", "agent1", "agent", null). Note that the instance name of a node agent is always the literal string "agent". 3)For a server instance (agentRootDirectory, agentName, instanceName, configName) e.g. ("/sun/appserver/agents", "agent1", "server1", "default-config") The RepositoryConfig class is an extensible HashMap that can contain any attributes, but also relies on two system properties being set: 1)com.sun.aas.installRoot -- installation root directory stored under the K_INSTALL_ROOT key. 2)com.sun.aas.configRoot -- configuration root (for locating asenv.conf) stored under the K_CONFIG_ROOT key.
author
kebbs

Fields Summary
public static final String
K_INSTALL_ROOT
public static final String
K_CONFIG_ROOT
public static final String
K_REFRESH_CONFIG_CONTEXT
private String
_repositoryName
private String
_repositoryRoot
private String
_instanceName
private String
_configurationName
Constructors Summary
public RepositoryConfig(String repositoryName, String repositoryRoot, String instanceName, String configName)
Creates a new instance of RepositoryConfig The K_INSTALL_ROOT and K_CONFIG_ROOT attributes are implicitly set

    
                              
           
          
        _instanceName = instanceName;
        _repositoryName = repositoryName;        
        _repositoryRoot = repositoryRoot;
        _configurationName = configName;
        put(K_INSTALL_ROOT, getFilePath(SystemPropertyConstants.INSTALL_ROOT_PROPERTY));        
        put(K_CONFIG_ROOT, getFilePath(SystemPropertyConstants.CONFIG_ROOT_PROPERTY));   
        put(K_REFRESH_CONFIG_CONTEXT, true);
        /* Since the changes for the startup, we have the problem of refreshing
         * config context. So, by default, I am making a change to refresh the
         * config context. If some processes (e.g. start-domain) have already
         * created a config context, then they should explicitly say so.
         */
    
public RepositoryConfig(String repositoryName, String repositoryRoot, String instanceName)

        this(repositoryName, repositoryRoot, instanceName, null);
    
public RepositoryConfig(String repositoryName, String repositoryRoot)

        this(repositoryName, repositoryRoot, null);
    
public RepositoryConfig()

        this(System.getProperty(SystemPropertyConstants.INSTANCE_ROOT_PROPERTY));        
    
public RepositoryConfig(String instanceRootString)
Creates a new instance of RepositoryConfig defined using the system property com.sun.aas.instanceRoot. It is assumed that this system property is a directory of the form: //

        final File instanceRoot = new File(instanceRootString);        
        final File repositoryDir = instanceRoot.getParentFile();               
        _instanceName = instanceRoot.getName();
        _repositoryName = repositoryDir.getName();
        _repositoryRoot = FileUtils.makeForwardSlashes(repositoryDir.getParentFile().getAbsolutePath());
        _configurationName = null;
        put(K_INSTALL_ROOT, getFilePath(SystemPropertyConstants.INSTALL_ROOT_PROPERTY));        
        put(K_CONFIG_ROOT, getFilePath(SystemPropertyConstants.CONFIG_ROOT_PROPERTY));  
    
Methods Summary
public java.lang.StringgetConfigRoot()

        return (String)get(K_CONFIG_ROOT);
    
public java.lang.StringgetConfigurationName()

        return _configurationName;
    
public java.lang.StringgetDisplayName()

        return getRepositoryName();
    
protected java.lang.StringgetFilePath(java.lang.String propertyName)

        File f = new File(System.getProperty(propertyName));
        return FileUtils.makeForwardSlashes(f.getAbsolutePath());
    
public java.lang.StringgetInstallRoot()

        return (String)get(K_INSTALL_ROOT);
    
public java.lang.StringgetInstanceName()

        return _instanceName;
    
public java.lang.BooleangetRefreshConfigContext()

        return ( (Boolean) get(K_REFRESH_CONFIG_CONTEXT ) );
        //this will never be null, because constructor initializes it to false
    
public java.lang.StringgetRepositoryName()

        return _repositoryName;
    
public java.lang.StringgetRepositoryRoot()

        return _repositoryRoot;
    
public voidsetConfigurationName(java.lang.String configurationName)

        _configurationName = configurationName;
    
public voidsetInstanceName(java.lang.String instanceName)

        _instanceName = instanceName;
    
public voidsetRefreshConfingContext(boolean refresh)

        this.put(K_REFRESH_CONFIG_CONTEXT, refresh);
    
protected voidsetRepositoryRoot(java.lang.String repositoryRoot)

        _repositoryRoot = repositoryRoot;
    
public java.lang.StringtoString()

        return ("repositoryRoot " + _repositoryRoot + " repositoryName " + _repositoryName +
            " instanceName " + _instanceName + " configurationName " + _configurationName);