FileDocCategorySizeDatePackage
DeploymentContext.javaAPI DocGlassfish v2 API10688Fri May 04 22:34:36 BST 2007com.sun.enterprise.deployment.phasing

DeploymentContext

public class DeploymentContext extends Object
This class is used to pass the common context needed by all deployment phases
author
Sandhya E

Fields Summary
private com.sun.enterprise.config.ConfigContext
configContext
config context
private Hashtable
cachedApps
private HashMap
savedAppRefsByApp
during redeployment saves non-defaulted values of pre-existing app refs
Constructors Summary
public DeploymentContext()
Creates a new instance of DeploymentContext

    
Methods Summary
public voidaddApplication(java.lang.String appID, com.sun.enterprise.deployment.Application app)

        if (app != null) {
            cachedApps.put(appID, app);    
        }
    
public com.sun.enterprise.deployment.ApplicationgetApplication(java.lang.String appID)

        return cachedApps.get(appID);
    
public com.sun.enterprise.config.ConfigContextgetConfigContext()
returns the stored configContext

return
configContext

        return configContext;
    
public com.sun.enterprise.deployment.phasing.DeploymentContext$SavedApplicationRefInfogetSavedAppRef(java.lang.String appID, java.lang.String targetName)
Retrieves a saved app ref, if one was saved, for the specified target.

param
appID the name of the application to be checked for a reference to the specified target
param
target the name of the target of interest
return
a SavedApplicationRefInfo object if one was saved for this target; null otherwise

         SavedApplicationRefInfo result = getSavedApplicationRefInfo(appID, targetName);
         return result;
     
private com.sun.enterprise.deployment.phasing.DeploymentContext$SavedApplicationRefInfogetSavedApplicationRefInfo(java.lang.String appID, java.lang.String targetName)

         SavedApplicationRefInfo result = null;
         synchronized(savedAppRefsByApp) {
             /*
              *Try to find saved references for this application.
              */
             HashMap<String,SavedApplicationRefInfo> refMapForApp = savedAppRefsByApp.get(appID);
             if (refMapForApp != null) {
                result = refMapForApp.get(targetName);
             }
         }
         return result;         
     
public com.sun.enterprise.deployment.ApplicationremoveApplication(java.lang.String appID)

        return cachedApps.remove(appID);
    
public com.sun.enterprise.deployment.phasing.DeploymentContext$SavedApplicationRefInforemoveSavedAppRef(java.lang.String appID, java.lang.String targetName)
Removes the saved ApplicationRef for a given app and target.

As a side effect, if the application's map to targets becomes empty, remove that map from the map of app IDs to saved result maps.

param
appID the name of the app
param
target the name of the target
return
ApplicationRef the corresponding saved app ref, if any; null otherwise

         SavedApplicationRefInfo result = null;
         synchronized(savedAppRefsByApp) {
             result = getSavedApplicationRefInfo(appID, targetName);
             if (result != null) {
                 HashMap<String,SavedApplicationRefInfo> refMapForApp= savedAppRefsByApp.get(appID);
                 refMapForApp.remove(targetName);
                 if (refMapForApp.isEmpty()) {
                     savedAppRefsByApp.remove(appID);
                 }
             }
         }
         return result;
     
public com.sun.enterprise.deployment.phasing.DeploymentContext$SavedApplicationRefInfosaveAppRef(java.lang.String appID, java.lang.String targetName, com.sun.enterprise.config.serverbeans.ApplicationRef ref, com.sun.enterprise.deployment.backend.DeploymentRequest req)
Saves an app ref for retrieval during a later phase of the deployment.

param
appID the name of the application the reference refers to
param
ref the ApplicationRef to be saved

         
         SavedApplicationRefInfo result = null;
         synchronized(savedAppRefsByApp) {
             /*
              *Try to locate this app's HashMap of targets to refs.
              */
             HashMap<String,SavedApplicationRefInfo> refMapForApp = savedAppRefsByApp.get(appID);
             if (refMapForApp == null) {
                 refMapForApp = new HashMap<String,SavedApplicationRefInfo>();
                 savedAppRefsByApp.put(appID, refMapForApp);
             }
             result = new SavedApplicationRefInfo(ref, req);
             refMapForApp.put(targetName, result);
         }
         return result;
     
public voidsetConfigContext(com.sun.enterprise.config.ConfigContext configContext)
Set the config context as specified

param
configContext config context object

        this.configContext = configContext;