Examples of DeploymentRequest


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

        String appName = entry.getId();
        boolean status = false;

        try {
            DeploymentRequest req = new DeploymentRequest(
                            this.configManager.getInstanceEnvironment(),
                            DeployableObjectType.APP,
                            DeploymentCommand.DEPLOY);

            // monitored file points to $APP_ROOT/.reload
            req.setFileSource(entry.getMonitoredFile().getParentFile());

            // application registration name
            req.setName(appName);

            // we are always trying a redeployment
            req.setForced(true);
     
      AutoDirReDeployer deployer = new AutoDirReDeployer(req);
      status = deployer.redeploy();

        }
View Full Code Here

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

     * @param phaseCtx the DeploymentPhaseContext object    
     */
    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) {
View Full Code Here

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

     */
    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 =
                    PluggableDeploymentInfo.getExtensionModuleDeployer(
                        moduleType);
                extDeployer.undeployFromDomain(req);
            } else {
                deployer.cleanup();
            }

            DeploymentServiceUtils.removeFromConfig(req.getName(),
                req.getType());
         
            // remove the application from deployment context
            deploymentCtx.removeApplication(req.getName());

            status.setStageStatus(DeploymentStatus.SUCCESS);           

            postPhaseNotify(getPostPhaseEvent(req));
           
        }catch(Throwable t){
            status.setStageStatus(DeploymentStatus.FAILURE);
            status.setStageException(t);
            status.setStageStatusMessage(t.getMessage());

            // Clean up domain.xml so that the system config is clean after the undeploy
            try {
                if (deployer != null) {
                    deployer.removePolicy();
                }
                DeploymentServiceUtils.removeFromConfig(req.getName(), req.getType());
            } catch (Exception eee){}
        }
    }
View Full Code Here

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

                DeploymentServiceUtils.getAndValidateDeploymentTarget(
                    targetName, referenceName, false);
           
            InstanceEnvironment env =
                ApplicationServer.getServerContext().getInstanceEnvironment();
            DeploymentRequest req = new DeploymentRequest(
                                    env,
                                    type,
                                    DeploymentCommand.DEPLOY);

            /*
             * Force enabled to true for app client modules to address temporarily
             * issue 3248.
             */
            enabled = enabled || type.isCAR();
               
            req.setName(referenceName);
            req.setStartOnDeploy(enabled);
            req.setTarget(target);

            Properties optionalAttributes = new Properties();
            if(virtualServers!=null) {
                optionalAttributes.put(ServerTags.VIRTUAL_SERVERS,
                    virtualServers);
            }
            req.setOptionalAttributes(optionalAttributes);
            return associate(req, createAuditInfoIfOn(req, AuditInfo.Operation.associate, startTime));
        } catch(Exception e) {
            if (e instanceof IASDeploymentException) {
                throw (IASDeploymentException)e;
            }
View Full Code Here

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

                    targetName, referenceName, false) :
                DeploymentServiceUtils.getDeploymentTarget(targetName);

            InstanceEnvironment env =
                ApplicationServer.getServerContext().getInstanceEnvironment();
            DeploymentRequest req = new DeploymentRequest(
                                    env,
                                    type,
                                    DeploymentCommand.DEPLOY);

            String virtualServers = dProps.getVirtualServers();
            boolean enabled = dProps.getEnable();

            req.setName(referenceName);
            req.setStartOnDeploy(enabled);
            req.setTarget(target);
            req.setIsRedeployInProgress(dProps.getRedeploy());
            DeploymentServiceUtils.setResourceOptionsInRequest(req, dProps);

            Properties optionalAttributes = new Properties();
            if(virtualServers!=null) {
                optionalAttributes.put(ServerTags.VIRTUAL_SERVERS,
                    virtualServers);
            }
            req.setOptionalAttributes(optionalAttributes);

            return associate(req, createAuditInfoIfOn(req, AuditInfo.Operation.associate, startTime));

        } catch(Exception e) {
            if (e instanceof IASDeploymentException) {
View Full Code Here

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

                DeploymentServiceUtils.getAndValidateDeploymentTarget(
                targetName, referenceName, true);
               
            InstanceEnvironment env =
                ApplicationServer.getServerContext().getInstanceEnvironment();
            DeploymentRequest req = new DeploymentRequest(
                                    env,
                                    type,
                                    DeploymentCommand.UNDEPLOY);

            req.setName(referenceName);
            req.setTarget(target);
       
            return disassociate(req, createAuditInfoIfOn(req, AuditInfo.Operation.disassociate, startTime));
        } catch(Exception e) {
            if (e instanceof IASDeploymentException) {
                throw (IASDeploymentException)e;
View Full Code Here

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

                DeploymentServiceUtils.getAndValidateDeploymentTarget(
                targetName, referenceName, true);

            InstanceEnvironment env =
                ApplicationServer.getServerContext().getInstanceEnvironment();
            DeploymentRequest req = new DeploymentRequest(
                                    env,
                                    type,
                                    DeploymentCommand.UNDEPLOY);

            req.setName(referenceName);
            req.setTarget(target);

            DeploymentProperties dProps = new DeploymentProperties(options);
            req.setCascade(dProps.getCascade());
            req.setForced(dProps.getForce());
            req.setExternallyManagedPath(dProps.getExternallyManaged());
            req.setIsRedeployInProgress(dProps.getRedeploy());

            // if it is redeploy, retreive these values so we can decide
            // whether we could do performance optimization
            if (req.isRedeployInProgress()) {
                req.setStartOnDeploy(dProps.getEnable());
                String virtualServers = dProps.getVirtualServers();
                Properties optionalAttributes = new Properties();
                if(virtualServers!=null) {
                    optionalAttributes.put(ServerTags.VIRTUAL_SERVERS,
                        virtualServers);
                }
                req.setOptionalAttributes(optionalAttributes);
            }

            DeploymentServiceUtils.setResourceOptionsInRequest(req, dProps);

            return disassociate(req, createAuditInfoIfOn(req, AuditInfo.Operation.disassociate, startTime));
View Full Code Here

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

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

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

        if (!DeploymentServiceUtils.containsResourceAdapter(req)) {
            status.setStageStatus(DeploymentStatus.SUCCESS);
            return;
        }

        if(!req.isApplication())
        {        
            type = DeploymentServiceUtils.getModuleTypeString(req.getType());
        }
       
        try {
            if (req.getCascade() && !req.isForced()){
                deleteConnectorDependentResources(req.getName(),
                    target.getName());
                deploymentCtx.getConfigContext().flush();
                AdminContext adminContext =
                        AdminService.getAdminService().getAdminContext();
                new AdminNotificationHelper(adminContext).sendNotification();
            }
        } catch(Throwable t){
            status.setStageStatus(DeploymentStatus.WARNING);
            status.setStageException(t);
            status.setStageStatusMessage(t.getMessage());
            return;
        }

        prePhaseNotify(getPrePhaseEvent(req));
       
        boolean success;
        try {
            success = target.sendStopEvent(req.getActionCode(), req.getName(), type, req.getCascade(), req.isForced(), Constants.UNLOAD_RAR);
        } catch(DeploymentTargetException dte) {
            status.setStageStatus(DeploymentStatus.WARNING);
            if (dte.getCause()!=null) {
                status.setStageException(dte.getCause());
                status.setStageStatusMessage(dte.getMessage());
View Full Code Here

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

        int actionCode = BaseDeployEvent.APPLICATION_DEPLOYED;
        try {


            InstanceEnvironment env = new InstanceEnvironment(getInstanceName());
            DeploymentRequest req = new DeploymentRequest(
                                        env,
                                        DeployableObjectType.APP,
                                        DeploymentCommand.DEPLOY);
           
           
            String appName = dProps.getName(archiveName);
            /* If app exists & forceDeploy is false it's an error.
             * It should be detected by the deployment backend.
             */
            boolean isAppExists = isRegistered(appName, DeployableObjectType.APP);
            actionCode = (isAppExists && dProps.getForce()) ?
                             BaseDeployEvent.APPLICATION_REDEPLOYED : BaseDeployEvent.APPLICATION_DEPLOYED;
            req.setFileSource(deployFile);
            req.setName(appName);
            req.setForced(dProps.getForce());
            req.setVerifying(dProps.getVerify());
            req.setPrecompileJSP(dProps.getPrecompileJSP());
            req.setStartOnDeploy(dProps.getEnable());
            req.setActionCode(actionCode);
            final DeploymentTarget target = getAndValidateDeploymentTarget(dProps.getTarget(),
                appName, isAppExists);
            req.setTarget(target);
           
            Properties optionalAttributes = new Properties();
            //optionalAttributes.put(ServerTags.ENABLED, String.valueOf(bEnabled));
            String virtualServers = dProps.getVirtualServers();
            if(virtualServers!=null)
                optionalAttributes.put(ServerTags.VIRTUAL_SERVERS, dProps.getVirtualServers());
            req.setOptionalAttributes(optionalAttributes);
            if(props == null)
                props = new Properties();
            else
                props = dProps.prune();
            req.addOptionalArguments(props);
           
            setHostAndPort(req);
           
            getDeploymentService().deploy(req);
        }
View Full Code Here

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

        try {

           
            InstanceEnvironment env = new InstanceEnvironment(getInstanceName());
            //Prepare Request
            DeploymentRequest req = new DeploymentRequest(
                                        env,
                                        DeployableObjectType.EJB,
                                        DeploymentCommand.DEPLOY);

            String moduleName = dProps.getName(filePath);
            boolean isModuleExists = isRegistered(moduleName,
                                         DeployableObjectType.EJB);
            actionCode = (isModuleExists && dProps.getForce()) ?
                BaseDeployEvent.MODULE_REDEPLOYED : BaseDeployEvent.MODULE_DEPLOYED;
            req.setFileSource(deployFile);
            req.setName(moduleName);           
            //req.setShared(isShared);
            req.setForced(dProps.getForce());
            req.setVerifying(dProps.getVerify());
            req.setStartOnDeploy(dProps.getEnable());
            req.setActionCode(actionCode);
            final DeploymentTarget target = getAndValidateDeploymentTarget(dProps.getTarget(),
                moduleName, isModuleExists);
            req.setTarget(target);
            if(props == null)
                props = new Properties();
            else
                props = dProps.prune();
            req.addOptionalArguments(props);           
            //Request Ready
           
            getDeploymentService().deploy(req);
        }
        catch(Exception e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.