Package com.sun.enterprise.deployment.backend

Examples of com.sun.enterprise.deployment.backend.DeploymentStatus


        }
    }

    private DeploymentStatus start(DeploymentRequest req, AuditInfo auditInfo)
    {
        DeploymentStatus result = executePhases(req, startPhaseList);
        if (auditInfo != null) {
            auditInfo.reportEnd(result.getStatus());
        }
        return result;
   
View Full Code Here


        throws IASDeploymentException {
        String moduleID = req.getName();
        DeployableObjectType type = req.getType();
        DeploymentServiceUtils.validate(moduleID,type,STOP_ACTION, req);

        DeploymentStatus result = executePhases(req, stopPhaseList);
        if (auditInfo != null) {
            auditInfo.reportEnd(result.getStatus());
        }
        return result;
    }
View Full Code Here

    {
        try {
            Descriptor.setBoundsChecking(true);

            // first we create our deployment status to return feedback to the user
            DeploymentStatus ds = new DeploymentStatus();
            ds.setStageDescription("Deployment");
            req.setCurrentDeploymentStatus(ds);

            DeploymentPhaseContext phaseCtx[] = new DeploymentPhaseContext[phases.size()];
            for(int i=0 ; i < phases.size() ; i++)
            {
                try{           
                    // create a new status for this phase
                    DeploymentStatus phaseDs = new DeploymentStatus(ds);

                    // execute the phase
                    phaseCtx[i] = ((DeploymentPhase)phases.get(i)).executePhase(req, phaseDs);

                    // if the previous phase did not excecute successfully.
                    // we need to allow previous phases to rollback.
                    if (phaseDs.getStageStatus()<DeploymentStatus.WARNING) {
                        rollbackPhases(phases, phaseCtx, i-1);
                        // return main deployment status
                        return ds;
                    }
View Full Code Here

        boolean  isRedeploy  = false;
        int    actionCode  = -1;
        String  targetName  = null;
        DeploymentTarget target = null;
        DeploymentRequest req = phaseCtx.getDeploymentRequest();
        DeploymentStatus status = phaseCtx.getDeploymentStatus();

        Deployer deployer = null;
        ExtensionModuleDeployer extDeployer = null;

        try {
            DeploymentCallback callback = req.getDeploymentCallback();
            if (callback != null) {
                int percent = 0;
                DeploymentProgress progress = new DeploymentProgressImpl(
                    (byte)percent, "deployment started", null);
                callback.deploymentProgress(progress);
            }
       
            // set the current deployment status in deployment request
            // to J2EECPhase deployment status
            req.setCurrentDeploymentStatus(status);

            req.setDescriptor(deploymentCtx.getApplication(req.getName()));

            if (DeploymentServiceUtils.isRegistered(req.getName(),
                req.getType()) && req.isForced()) {

                isRedeploy = true;

                //Re-record instrospect/instrument/verifier data if
                //any of the application is re-deployed
                if (AppVerification.doInstrument()) {
                    AppVerification.getInstrumentLogger().handleChangeInDeployment();
                }
            }

            if(req.isApplication())
                isApp = true;
           
            if (!req.isExtensionModule()) {
                deployer = DeployerFactory.getDeployer(req);
                deployer.doRequestPrepare();
            }

            if(isRedeploy) {
                // clear the deploymentCtx cache now
                deploymentCtx.removeApplication(req.getName());              
                req.setDescriptor(null);

                target = (DeploymentTarget)req.getTarget();
               
                // In the case of redeploy to domain,
                // no stop event will be sent.
                if(target != null && ! target.getName().equals("domain")) {
                    targetName = target.getName();
               
                    if(isApp) {
                        type = null;
                        actionCode  = BaseDeployEvent.APPLICATION_UNDEPLOYED;
                    }
                    else {
                        type = DeploymentServiceUtils.getModuleTypeString(req.getType());
                        actionCode  = BaseDeployEvent.MODULE_UNDEPLOYED;
                    }
                    DeploymentServiceUtils.multicastEvent(actionCode, req.getName(), type, req.getCascade(), req.isForced(),  targetName);
                    wasUnRegistered = true;
                }
            }
           
            if (req.isExtensionModule()) {
                ModuleType moduleType = req.getType().getModuleType();
                extDeployer =
                    PluggableDeploymentInfo.getExtensionModuleDeployer(
                        moduleType);  
                if (isRedeploy) {
                    extDeployer.redeployToDomain(req);
                } else {
                    extDeployer.deployToDomain(req);
                }
            } else {
                deployer.doRequestFinish();
                // cache the updated application object in deployment context
                deploymentCtx.addApplication(req.getName(), req.getDescriptor());
                parseAndValidateSunResourcesXMLFiles(req);
                deployer.cleanup();
            }
           
            // check if an abort operation has been issued
            // throw exception if true
            DeploymentServiceUtils.checkAbort(req.getName());

            // do all the config update at the end for easy rollback
            if(isRedeploy) {
                DeploymentServiceUtils.updateConfig(req);
            } else {
                DeploymentServiceUtils.addToConfig(req);
            }
            // set context roots on config bean
            ApplicationConfigHelper.resetAppContextRoots(
                DeploymentServiceUtils.getConfigContext(), req.getName(),
                true);

            wasUnRegistered = false// addToConfig re-registered it...

            // everything went fine
            status.setStageStatus(DeploymentStatus.SUCCESS);           
           
            // some useful information for clients...
            sLogger.log(Level.INFO, "deployed with " + DeploymentProperties.MODULE_ID + " = " + req.getName());
            populateStatusProperties(status, req);
            if (callback != null) {
                int percent = 100;
                DeploymentProgress progress2 = new DeploymentProgressImpl(
                    (byte)percent, "deployment finished", null);
                callback.deploymentProgress(progress2);
            }
        
        } catch(Throwable t) {
            String msg =
            localStrings.getString("enterprise.deployment.phasing.j2eec.error" );
            if (t.getCause()!= null)
                msg += t.getCause().toString();

            // For any failure during the J2EEC phase (during fresh deploy or redeploy), cleanup the domain.xml
            // so that the config is left in a clean state without any hanging j2ee-app/module elements without
            // any app-refs;
            // the target==null check ensures that this code is done for 8.1 only thereby preserving same
            // behavior for 8.0 apps
            try {
                if (target == null) {
                    if (deployer != null) {
                        deployer.removePolicy();
                    }
                    DeploymentServiceUtils.removeFromConfig(req.getName(),
                        req.getType());
                }
            } catch (Exception eee){}

            if(isRedeploy && wasUnRegistered && t instanceof IASDeploymentException && req.getReRegisterOnFailure()) {
                // DBE rollback re-registered.  We need to notify to get it reloaded now.
                if(isApp)
                    actionCode = BaseDeployEvent.APPLICATION_DEPLOYED;
                else
                    actionCode = BaseDeployEvent.MODULE_DEPLOYED;
               
                try {
                    DeploymentServiceUtils.multicastEvent(actionCode, req.getName(), type, req.getCascade(), req.isForced(), targetName);
                }
                catch(Throwable t2) {
                    msg += t2;
                }
            }
            // log
            sLogger.log(Level.SEVERE, msg, t);
           
            // we now update our status
            status.setStageStatus(DeploymentStatus.FAILURE);
            if (t instanceof java.io.Serializable) {
                status.setStageException(t);
            } else {
                sLogger.severe(localStrings.getString("enterprise.deployment.phasing.exception_notserializable", t.getClass()));
                sLogger.severe(localStrings.getString("enterprise.deployment.phasing.exception_notforwarded", t.getMessage()));
            }
            status.setStageStatusMessage(t.getMessage());
        }
    }
View Full Code Here

     * the client, including moduleID and list of wsdl files.
     */
    private void populateStatusProperties(
                    DeploymentStatus status, DeploymentRequest request)
        throws IOException, IASDeploymentException {
        DeploymentStatus mainStatus = status.getMainStatus();
        populateModuleIDs(mainStatus, request);
        if (request.getDescriptor() != null) {
            populateWsdlFilesForPublish(mainStatus, request);
        }
    }
View Full Code Here

     * @param req Deployment request object
     * @param phaseCtx the DeploymentPhaseContext object
     */
    public void runPhase(DeploymentPhaseContext phaseCtx)
    {
        DeploymentStatus status = phaseCtx.getDeploymentStatus();

        try {
            DeploymentRequest req = phaseCtx.getDeploymentRequest();
                                                                     
            prePhaseNotify(getPrePhaseEvent(req));
            doResourceOperation(req);
            postPhaseNotify(getPostPhaseEvent(req));
                                                                     
            phaseCtx.getDeploymentStatus().setStageStatus(DeploymentStatus.SUCCESS);
        } catch(Exception e) {
            status.setStageStatus(DeploymentStatus.WARNING);
            status.setStageException(e);
            status.setStageStatusMessage(e.getMessage());
        }
    }
View Full Code Here

    public void runPhase(DeploymentPhaseContext phaseCtx) {
        String type = null;
       
        DeploymentRequest req = phaseCtx.getDeploymentRequest();

        DeploymentStatus status = phaseCtx.getDeploymentStatus();
       
        DeploymentTarget target = (DeploymentTarget)req.getTarget();
        if(target == null) {
            String msg = localStrings.getString("enterprise.deployment.phasing.start.targetnotspecified");
            sLogger.log(Level.FINEST, msg);
            status.setStageStatus(DeploymentStatus.SUCCESS);           
            return;
        }
       
        if (!DeploymentServiceUtils.containsResourceAdapter(req)) {
            status.setStageStatus(DeploymentStatus.SUCCESS);
            return;
        }

        if (!req.isApplication()) {
            type = DeploymentServiceUtils.getModuleTypeString(req.getType());
        }

        prePhaseNotify(getPrePhaseEvent(req));
        int actionCode = req.getActionCode();
       
        boolean success;
        try {
           // send this event to load standalone rar
           // or the rar part of the embedded rar
           success = target.sendStartEvent(actionCode, req.getName(), type,
                                           req.isForced(), Constants.LOAD_RAR);
        } catch(DeploymentTargetException dte) {
            status.setStageStatus(DeploymentStatus.WARNING);
            if (dte.getCause()!=null) {
                status.setStageStatusMessage(dte.getMessage());
            }
            return;
        }
        if (success) {
            status.setStageStatus(DeploymentStatus.SUCCESS);
        } else {
            status.setStageStatus(DeploymentStatus.WARNING);
            status.setStageStatusMessage("Application failed to load");
        }
        postPhaseNotify(getPostPhaseEvent(req));
       
        // if any exception arrise, we let it unroll this stack, it will
        // be processed by DeploymentService
View Full Code Here

        String type = null;
       
        DeploymentRequest req = phaseCtx.getDeploymentRequest();

        DeploymentTarget target = (DeploymentTarget)req.getTarget();
        DeploymentStatus status = phaseCtx.getDeploymentStatus();

        int loadUnloadAction = Constants.UNLOAD_ALL;

        Application app = DeploymentServiceUtils.getInstanceManager(
               req.getType()).getRegisteredDescriptor(req.getName());

        // store the application object in DeploymentContext before it's
        // removed from instance manager cache
        deploymentCtx.addApplication(req.getName(), app);
       
        if(!req.isApplication())
        {        
            type = DeploymentServiceUtils.getModuleTypeString(req.getType());
        } else {
            if ( (app != null) && (app.getRarComponentCount() != 0) ) {
                loadUnloadAction = Constants.UNLOAD_REST;
            }
        }
       
        prePhaseNotify(getPrePhaseEvent(req));
 
        boolean success;
        try {
            // send this event to unload non-rar standalone module
            // or to unload the non-rar submodules of embedded rar
            if (! req.isConnectorModule()) {
                success = target.sendStopEvent(req.getActionCode(), req.getName(), type, req.getCascade(), req.isForced(), loadUnloadAction);
            } else {
                status.setStageStatus(DeploymentStatus.SUCCESS);
                return;
            }
        } catch(DeploymentTargetException dte) {
            status.setStageStatus(DeploymentStatus.FAILURE);
            if (dte.getCause()!=null) {
                status.setStageException(dte.getCause());
                status.setStageStatusMessage(dte.getMessage());
            }
            return;
        }
        if (success) {
            status.setStageStatus(DeploymentStatus.SUCCESS);
        } else {
            status.setStageStatus(DeploymentStatus.WARNING);
            status.setStageStatusMessage("Application failed to stop");
        }           
       
        postPhaseNotify(getPostPhaseEvent(req));
       
        // if any exception is thrown. we let the stack unroll, it
View Full Code Here

    public void runPhase(DeploymentPhaseContext phaseCtx) {
        String type = null;
       
        DeploymentRequest req = phaseCtx.getDeploymentRequest();

        DeploymentStatus status = phaseCtx.getDeploymentStatus();
       
        DeploymentTarget target = (DeploymentTarget)req.getTarget();
        if(target == null) {
            String msg = localStrings.getString("enterprise.deployment.phasing.start.targetnotspecified");
            sLogger.log(Level.FINEST, msg);
            status.setStageStatus(DeploymentStatus.SUCCESS);           
            return;
        }
       
        prePhaseNotify(getPrePhaseEvent(req));
        int actionCode = req.getActionCode();

        int loadUnloadAction = Constants.LOAD_ALL;
       
        if(req.isApplication()) {
            type = null;
            Application app = DeploymentServiceUtils.getInstanceManager(
               DeployableObjectType.APP).getRegisteredDescriptor(req.getName());

            if ( (app != null) && (app.getRarComponentCount() != 0) ) {
                loadUnloadAction = Constants.LOAD_REST;
            }
        }
        else {
            type = DeploymentServiceUtils.getModuleTypeString(req.getType());
        }
       
        boolean success;
        try {
           // send this event to load non-rar standalone module or application
           // or to load the non-rar submodules of embedded rar
           if (! req.isConnectorModule()) {
               success = target.sendStartEvent(actionCode, req.getName(), type,
                                           req.isForced(), loadUnloadAction);
           } else {
               status.setStageStatus(DeploymentStatus.SUCCESS);
               return;
           }
        } catch(DeploymentTargetException dte) {
            status.setStageStatus(DeploymentStatus.WARNING);
            if (dte.getCause()!=null) {
                status.setStageStatusMessage(dte.getMessage());
            }
            return;
        }
        if (success) {
            status.setStageStatus(DeploymentStatus.SUCCESS);
        } else {
            status.setStageStatus(DeploymentStatus.WARNING);
            status.setStageStatusMessage("Application failed to load");
        }
        postPhaseNotify(getPostPhaseEvent(req));
       
        // if any exception arrise, we let it unroll this stack, it will
        // be processed by DeploymentService
View Full Code Here

     * @param phaseCtx the DeploymentPhaseCtx object
     * @throws DeploymentPhaseException
     */
    public void runPhase(DeploymentPhaseContext phaseCtx)
    {
        DeploymentStatus status = phaseCtx.getDeploymentStatus();
       
        DeploymentRequest req = phaseCtx.getDeploymentRequest();
        DeploymentTarget target = (DeploymentTarget)req.getTarget();

        // set the descriptor on request so we can get it in Deployers code
        ExtensionModuleDeployer extDeployer = null;
        Application app = deploymentCtx.getApplication(req.getName());
        req.setDescriptor(app);
       
        // Clear out the reference to the class loader
        if (app != null) {
            app.setClassLoader(null);
        }

        Deployer deployer = null;
        try{           
            if (!req.isExtensionModule()) {
                deployer = DeployerFactory.getDeployer(req);
                deployer.doRequest();
            }
           
            // create a DeploymentStatus for cleanup stage, it is a
            // substatus of current (UndeployFromDomainPhase) deployment status
            DeploymentStatus cleanupStatus =
                new DeploymentStatus(status);
            req.setCurrentDeploymentStatus(cleanupStatus);

            if (req.isExtensionModule()) {
                ModuleType moduleType = req.getType().getModuleType();
                extDeployer =
View Full Code Here

TOP

Related Classes of com.sun.enterprise.deployment.backend.DeploymentStatus

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.