FileDocCategorySizeDatePackage
ApplicationEnvironment.javaAPI DocGlassfish v2 API7573Fri May 04 22:34:58 BST 2007com.sun.enterprise.instance

ApplicationEnvironment

public class ApplicationEnvironment extends Object
A class that provides the environment for an Application deployed within a given Server Instance. Provides convenience methods for the entire application, modules within.
author
Kedar
version
1.0

Fields Summary
private String
mAppName
private String
mAppPath
private String
mAppGeneratedXMLPath
private String
mAppStubPath
private String
mAppBackupPath
private String
mAppJSPPath
private String
mJavaWebStartPath
private InstanceEnvironment
mInstance
private static Logger
_logger
Constructors Summary
public ApplicationEnvironment(InstanceEnvironment instance, String appName)
Creates new ApplicationEnvironment for given InstanceEnvironment and given application name.

param
instance InstanceEnvironment where the application is deployed.
param
appName String representing the name of the application.

		
	
	 		     		   		       		        	

          
		if (instance == null || appName == null) {
			throw new IllegalArgumentException();
		}
		mInstance	= instance;
		mAppName	= appName;
		createAppPath();
		createAppStubPath();
		createAppBackupPath();
		createAppJSPPath();
		createAppGeneratedXMLPath();
                createJavaWebStartPath();
    
Methods Summary
private voidcreateAppBackupPath()

		// This is used to keep a copy of directory-deployed app files
		String applicationBackupRepositoryDirPath = mInstance.getApplicationBackupRepositoryPath();
		String[] onlyFolderNames = new String[] {
			applicationBackupRepositoryDirPath,
			mAppName
			};
		mAppBackupPath = StringUtils.makeFilePath (onlyFolderNames, false);
	
public voidcreateAppGeneratedXMLPath()
Returns the absolute path for storing all the generated xml of this application. Note that it does not create/check file/directory with such a path.

                String[] onlyFolderNames = new String[] {
                        mInstance.getApplicationGeneratedXMLPath(),
                        mAppName
                };

                mAppGeneratedXMLPath = StringUtils.makeFilePath (onlyFolderNames, false);
        
public voidcreateAppJSPPath()
Creates the absolute path String for storing all the generated JSPs of this application. Note that it does not create/check file/directory with such a path.

		String[] onlyFolderNames = new String[] {
			mInstance.getApplicationCompileJspPath(),
			mAppName
		};
		
		mAppJSPPath = StringUtils.makeFilePath (onlyFolderNames, false);
	
private voidcreateAppPath()

		String applicationRepositoryDirPath = mInstance.getApplicationRepositoryPath();
		String[] onlyFolderNames = new String[] {
			applicationRepositoryDirPath,
			mAppName
			};
		mAppPath = StringUtils.makeFilePath (onlyFolderNames, false);
	
public voidcreateAppStubPath()
Returns the absolute path for storing all the stubs of this application. Note that it does not create/check file/directory with such a path.

		String[] onlyFolderNames = new String[] {
			mInstance.getApplicationStubPath(),
			mAppName
		};
		
		mAppStubPath = StringUtils.makeFilePath (onlyFolderNames, false);
	
private voidcreateJavaWebStartPath()
Creates the path to this application's java-web-start directory.

		String[] onlyFolderNames = new String[] {
			mInstance.getJavaWebStartPath(),
			mAppName
		};
		
		mJavaWebStartPath = StringUtils.makeFilePath (onlyFolderNames, false);
        
public java.lang.StringgetAppGeneratedXMLPath()
Returns the absolute path for the all the generated xml within this application. Note that it does not create/check file/directory with such a path.

                return mAppGeneratedXMLPath;
        
public java.lang.StringgetAppJSPPath()
Returns the absolute path for the all the stubs within this application. Note that it does not create/check file/directory with such a path.

		assert StringUtils.ok(mAppJSPPath);
		return mAppJSPPath;
	
public java.lang.StringgetAppPath()
Returns the absolute path for the all the elements within this application. Note that it does not create/check file/directory with such a path.

		return mAppPath;
	
public java.lang.StringgetAppStubPath()
Returns the absolute path for the all the stubs within this application. Note that it does not create/check file/directory with such a path.

		return mAppStubPath;
	
public java.lang.StringgetJavaWebStartPath()
Returns the absolute path to the Java Web Start directory for this application. Note that it does not create/check file/directory with such a path.

            return mJavaWebStartPath;
        
public static voidmain(java.lang.String[] args)

		//System.setProperty("com.sun.aas.instanceRoot", "/usr/appserv/instances");
		InstanceEnvironment env = new InstanceEnvironment("foo");
		ApplicationEnvironment ae = new ApplicationEnvironment(env, "myapp");

		_logger.log(Level.INFO,"core.appenv_dump");
		_logger.log(Level.INFO,ae.toString());
	
public java.lang.StringtoString()

		return ObjectAnalyzer.toString(this);