FileDocCategorySizeDatePackage
AppReDeployer.javaAPI DocGlassfish v2 API7588Fri May 04 22:34:30 BST 2007com.sun.enterprise.deployment.backend

AppReDeployer

public class AppReDeployer extends AppDeployer

Fields Summary
private String
failureMessage
private String
successMessage
private File
originalAppDir
private boolean
appWasUnregistered
private com.sun.enterprise.deployment.Application
app
private static com.sun.enterprise.util.i18n.StringManager
localStrings
Constructors Summary
AppReDeployer(DeploymentRequest r)

		super(r);
	
Methods Summary
protected voidbegin()

		// this is here because by the time we get to predeploy() -- the app will no
		// longer be registered.  So we need to save the app-dir right NOW!
		
		super.begin();
		
		try
		{
                    // first let's try to get the application from the 
                    // instance manager cache
                    // if it's not there, get it from the request which 
                    // is set through deployment context cache
                    app = getManager().getDescriptor(getAppName()); 
                    if (app == null) {
                        app = request.getDescriptor(); 
                    }

                        originalAppDir = new File(DeploymentServiceUtils.getLocation(getAppName(), request.getType()));
                        getManager().unregisterDescriptor(getAppName());
                        removePolicy();
		}
		catch(Exception e)
		{
			String msg = localStrings.getString(
					"enterprise.deployment.backend.error_getting_app_location",
					getAppName() );
			throw new IASDeploymentException( msg, e);
		}
	
protected final voidpredeploy()

		appWasUnregistered = true;
		super.predeploy();

                // send PRE_DEPLOY event so the deployment event listener
                // can do the necessary work
                DeploymentEventInfo info = new DeploymentEventInfo(
                    getAppDir(), getStubsDir(), app,
                    getRequest());
                DeploymentEvent ev = new DeploymentEvent(
                    DeploymentEventType.PRE_DEPLOY, info);
                DeploymentEventManager.notifyDeploymentEvent(ev);

		liquidate();

		getAppDir().mkdirs();
	
protected final java.io.FilesetAppDir()

		File newAppDir = null;
		
		if(isArchive())
		{
			newAppDir = setAppDirArchive();
		}
		else if(isDirectory())
		{
			newAppDir = setAppDirDirectory();
		}
		else
		{
			String msg = localStrings.getString(
					"enterprise.deployment.backend.redeployment_not_dir_or_archive" );
			throw new IASDeploymentException( msg );
		}
		
		return newAppDir;
	
private final java.io.FilesetAppDirArchive()

		assert originalAppDir != null;
                return originalAppDir;
        
private final java.io.FilesetAppDirDirectory()

		FileSource fileSource = request.getFileSource(); 

		if(!fileSource.exists()) 
		{
			String msg = localStrings.getString("enterprise.deployment.backend.file_source_does_not_exist", fileSource );
			throw new IASDeploymentException( msg );
		}

		assert fileSource.isDirectory();
		File appDirectory = fileSource.getFile();

		return appDirectory;
	
protected java.lang.StringwhatAreYou()

		return "Redeployment";