FileDocCategorySizeDatePackage
DomainInfo.javaAPI DocGlassfish v2 API6645Fri May 04 22:35:04 BST 2007com.sun.enterprise.tools.upgrade.common

DomainInfo

public class DomainInfo extends Object
author
prakash

Fields Summary
private String
domainName
private String
domainPath
private String
profile
private List
instanceNames
private Hashtable
instancePathMapping
private String
domainAdminUser
private String
domainAdminPassword
Constructors Summary
public DomainInfo(String dName, String dPath, String profile)
Creates a new instance of DomainInfo

        this.domainName = dName;
        this.domainPath = dPath;
        this.profile = profile;	
    
public DomainInfo(String dName, String dPath)
Creates a new instance of DomainInfo

        this.domainName = dName;
        this.domainPath = dPath;
    
Methods Summary
public java.lang.StringgetDomainAdminPassword()

        return this.domainAdminPassword;
    
public java.lang.StringgetDomainAdminUser()

        return this.domainAdminUser;
    
public java.lang.StringgetDomainApplicationRoot(UpgradeUtils upgrUtils)
Gets the application root of the current domain

        String configFileName = domainPath + File.separator + "config" + 
                File.separator + "domain.xml";
	String applRoot = null;
        Document adminServerDoc = upgrUtils.getDomainDocumentElement(configFileName);
        try {
	    NodeList domainElements = adminServerDoc.getElementsByTagName("domain");
	    //There is only one domain element
	    Element domainElement = (Element)domainElements.item(0);
	    if(domainElement != null) {
		String attrValue = domainElement.getAttribute("application-root");
                StringTokenizer attrTokens = new StringTokenizer(attrValue, "/");
		attrTokens.nextToken();
		applRoot = attrTokens.nextToken();
	    }
        }catch (Exception ex){
        }
        return applRoot;
    
public java.lang.StringgetDomainName()
Getter for property domainName.

return
Value of property domainName.

        return domainName;
    
public java.lang.StringgetDomainPath()
Getter for property domainPath.

return
Value of property domainPath.

        return domainPath;
    
public java.util.ListgetInstanceNames()
Getter for property instanceNames.

return
Value of property instanceNames.

        if(this.instanceNames == null){
            instanceNames = new ArrayList();
            instancePathMapping = new Hashtable();
            File domainDir = new File(this.domainPath);
            String [] instanceDirs = domainDir.list();
            for (int i=0 ; i<instanceDirs.length ; i++) {
                instanceNames.add(instanceDirs[i]);
                String instancePath= this.domainPath + File.separator + instanceDirs[i];
                instancePathMapping.put(instanceDirs[i],instancePath);            
            }      
        }
        return instanceNames;
    
public java.lang.StringgetInstancePath(java.lang.String instanceName)

        if(this.instancePathMapping == null){
            this.getInstanceNames();
        }
        // if instance path is null or "" return the domain path itself.  In case of 8.x PE
        if(instanceName == null || "".equals(instanceName.trim())){
            return this.domainPath;
        }
        return (String)this.instancePathMapping.get(instanceName);
    
public java.lang.StringgetProfile()
Getter for property profile.

return
Value of property profile.

        return profile;
    
public voidsetDomainAdminPassword(java.lang.String dPassword)

        this.domainAdminPassword = dPassword;
    
public voidsetDomainAdminUser(java.lang.String dUser)

        this.domainAdminUser = dUser;
    
public voidsetDomainName(java.lang.String domainName)
Setter for property domainName.

param
domainName New value of property domainName.

        this.domainName = domainName;
    
public voidsetDomainPath(java.lang.String domainPath)
Setter for property domainPath.

param
domainPath New value of property domainPath.

        this.domainPath = domainPath;
    
public voidsetProfile(java.lang.String profile)
Setter for property profile.

param
profile New value of property profile.

        this.profile = profile;