Examples of JaxbDeploymentJobResult


Examples of org.kie.services.client.serialization.jaxb.impl.deploy.JaxbDeploymentJobResult

                return jaxbDepUnit;
            }
        }
       
        // Most recent job?
        JaxbDeploymentJobResult jobResult = jobResultMgr.getMostRecentJob(deploymentId);
        if( jobResult != null ) {
            jaxbDepUnit = jobResult.getDeploymentUnit();
            return jaxbDepUnit;
        }
       
        // Nonexistent?
        String [] gavKK = deploymentId.split(":");
View Full Code Here

Examples of org.kie.services.client.serialization.jaxb.impl.deploy.JaxbDeploymentJobResult

        jaxbDepUnit.setStatus(JaxbDeploymentStatus.NONEXISTENT);
        return jaxbDepUnit;
    }

    public JaxbDeploymentJobResult submitDeployJob(String deploymentId, String strategy, String mergeMode, JaxbDeploymentDescriptor deployDescriptor ) {
        JaxbDeploymentJobResult jobResult;
        DeployedUnit deployedUnit = deploymentService.getDeployedUnit(deploymentId);
        if( deployedUnit != null ) {
            // If the deployment unit already exists, request can not be completed..
            KModuleDeploymentUnit kDepUnit = (KModuleDeploymentUnit) deployedUnit.getDeploymentUnit();
            JaxbDeploymentUnit jaxbDepUnit = convertKModuleDepUnitToJaxbDepUnit(kDepUnit);
            jobResult = new JaxbDeploymentJobResult(
                    null,
                    "The deployment already exists and must be first undeployed!",
                   jaxbDepUnit,
                   JobType.DEPLOY.toString());
            jobResult.setSuccess(false);
        } else {

            KModuleDeploymentUnit deploymentUnit = createDeploymentUnit(deploymentId, deployDescriptor);

            if( strategy != null ) {
View Full Code Here

Examples of org.kie.services.client.serialization.jaxb.impl.deploy.JaxbDeploymentJobResult

      
        String jobTypeLower = jobType.toString().toLowerCase();
      
        String jobId = "" + System.currentTimeMillis() + "-" + jobIdGen.incrementAndGet();
        ctx.setData(JOB_ID, jobId);
        JaxbDeploymentJobResult jobResult = new JaxbDeploymentJobResult(
                jobId,
                jobTypeLower + " job accepted.",
                convertKModuleDepUnitToJaxbDepUnit(deploymentUnit), jobType.toString());
        jobResult.getDeploymentUnit().setStatus(JaxbDeploymentStatus.ACCEPTED);

        logger.debug( "{} job [{}] for deployment '{}' created.", jobType.toString(), jobId, deploymentUnit.getIdentifier());
        jobResultMgr.putJob(jobResult.getJobId(), jobResult, jobType);
        Long executorJobId;
        try {
            executorJobId = jobExecutor.scheduleRequest(DeploymentCmd.class.getName(), ctx);
            jobResult.setIdentifier(executorJobId);
            jobResult.setSuccess(true);
        } catch( Exception e ) {
            String msg = "Unable to " + jobType.toString().toLowerCase()
                    + " deployment '" + deploymentId + "': "
                    + e.getClass().getSimpleName() + " thrown [" + e.getMessage() + "]";
            logger.error( msg, e );
            jobResult.setExplanation(msg);
            jobResult.setSuccess(false);
        }
               
        return jobResult;
    }
View Full Code Here

Examples of org.kie.services.client.serialization.jaxb.impl.deploy.JaxbDeploymentJobResult

        return jobResult;
    }
  
    public JaxbDeploymentJobResult submitUndeployJob(String deploymentId) {
        DeployedUnit deployedUnit = deploymentService.getDeployedUnit(deploymentId);
        JaxbDeploymentJobResult jobResult;
        if( deployedUnit != null ) {
            KModuleDeploymentUnit deploymentUnit = (KModuleDeploymentUnit) deployedUnit.getDeploymentUnit();
            jobResult = scheduleDeploymentJobRequest(deploymentId, JobType.UNDEPLOY, deploymentUnit);
        } else {
            JaxbDeploymentUnit depUnit = determineStatus(deploymentId, false);
          
            String explanation;
            switch( depUnit.getStatus()) {
            case ACCEPTED: // deployment service (above) has not found it, so it must be still deploying
            case DEPLOYED: // minor race condition between the deployment service and this code
            case DEPLOYING: // obvious..
                explanation = "The deployment can not be undeployed because the initial deployment has not yet fully completed.";
                break;
            case DEPLOY_FAILED:
                explanation = "The deployment can not be undeployed because the initial deployment failed.";
                break;
            case NONEXISTENT:
            case UNDEPLOYED:
            case UNDEPLOYING:
                explanation = "The deployment can not be undeployed because it has already been undeployed (or is currently being undeployed)";
                break;
            case UNDEPLOY_FAILED: // from the last request
                explanation = "The last undeployment failed, but the deployment unit is no longer present (and can not be undeployed, thus). "
                        + "There is probably a very high load on this server. Turning on debugging may provide insight.";
                       logger.debug("Stack trace:", new Throwable());
                break;
            default:
                throw new IllegalStateException("Unknown deployment unit status: " + depUnit.getStatus());
            }
            jobResult = new JaxbDeploymentJobResult(null, explanation, depUnit, JobType.UNDEPLOY.toString() );
            jobResult.setSuccess(false);
        }
        return jobResult;
    }
View Full Code Here

Examples of org.kie.services.client.serialization.jaxb.impl.deploy.JaxbDeploymentJobResult

      
        String deploymentId = job.getDeploymentUnit().getIdentifier();
        logger.debug( "Adding job id [{}] to \"most recent job\" cache");
        String oldJobId = deploymentIdMostRecentJobIdMap.put(deploymentId, jobId);
        if( oldJobId != null ) {
            JaxbDeploymentJobResult oldJobResult = jobs.get(oldJobId);
            if( ! JaxbDeploymentStatus.DEPLOYED.equals(oldJobResult.getDeploymentUnit().getStatus())
                    && ! JaxbDeploymentStatus.UNDEPLOYED.equals(oldJobResult.getDeploymentUnit().getStatus()) )
            logger.info( "New {} job [{}] for '{}' requested while old job [{}] has status {}",
                    jobType.toString().toLowerCase(),
                    jobId,
                    oldJobResult.getDeploymentUnit().getIdentifier(),
                    oldJobId,
                    oldJobResult.getDeploymentUnit().getStatus());
        }
    }
View Full Code Here

Examples of org.kie.services.client.serialization.jaxb.impl.deploy.JaxbDeploymentJobResult

        JobType jobType = (JobType) ctx.getData(JOB_TYPE);
        String deploymentId = deploymentUnit.getIdentifier();

        JobResultManager jobResultMgr = getJobManager(ctx);
        String jobId = (String) ctx.getData(JOB_ID);
        JaxbDeploymentJobResult jobResult = jobResultMgr.getJob(jobId);
        boolean success = false;
        switch (jobType) {
            case DEPLOY:
                try {
                    jobResult.getDeploymentUnit().setStatus(JaxbDeploymentStatus.DEPLOYING);
                    deploymentService.deploy(deploymentUnit);
                    jobResult.getDeploymentUnit().setStatus(JaxbDeploymentStatus.DEPLOYED);
                    jobResult.setSuccess(true);
                    logger.debug("Deployment unit [{}] deployed", deploymentId);
                    success = true;
                } catch (Exception e) {
                    jobResult.getDeploymentUnit().setStatus(JaxbDeploymentStatus.DEPLOY_FAILED);
                    jobResult.setSuccess(false);
                    logger.error("Unable to deploy [{}]", deploymentId, e);
                }
                break;
            case UNDEPLOY:
                try {
                    jobResult.getDeploymentUnit().setStatus(JaxbDeploymentStatus.UNDEPLOYING);
                    deploymentService.undeploy(deploymentUnit);
                    jobResult.getDeploymentUnit().setStatus(JaxbDeploymentStatus.UNDEPLOYED);
                    logger.debug("Deployment unit [{}] undeployed", deploymentId);
                    jobResult.setSuccess(false);
                    success = true;
                } catch (Exception e) {
                    jobResult.getDeploymentUnit().setStatus(JaxbDeploymentStatus.UNDEPLOY_FAILED);
                    jobResult.setSuccess(false);
                    logger.error("Unable to undeploy [{}]", deploymentId, e);
                }
                break;
            default:
                logger.error("Unknown " + JobType.class.getSimpleName() + " type (" + jobType.toString() + "), not taking any action");
View Full Code Here

Examples of org.kie.services.client.serialization.jaxb.impl.deploy.JaxbDeploymentJobResult

        String oper = getRelativePath();
        String strategy = getStringParam("strategy", false, params, oper);
        String mergeMode = getStringParam("mergemode", false, params, oper);
       
        // schedule deployment
        JaxbDeploymentJobResult jobResult = deployBase.submitDeployJob(deploymentId, strategy, mergeMode, deployDescriptor);
        return createCorrectVariant(jobResult, headers, Status.ACCEPTED);
    }
View Full Code Here

Examples of org.kie.services.client.serialization.jaxb.impl.deploy.JaxbDeploymentJobResult

        return createCorrectVariant(jobResult, headers, Status.ACCEPTED);
    }
  
    @Override
    public Response undeploy() {
        JaxbDeploymentJobResult jobResult = deployBase.submitUndeployJob(deploymentId);
        return createCorrectVariant(jobResult, headers, Status.ACCEPTED);
    }
View Full Code Here

Examples of org.kie.services.client.serialization.jaxb.impl.deploy.JaxbDeploymentJobResult

    @Override
    public DeploymentInfoResponse manage( DeploymentIdRequest request ) throws DeploymentWebServiceException {
        String strategy = request.getStrategy() == null ? null : request.getStrategy().toString();
        String mergeMode = request.getMergeMode() == null ? null : request.getMergeMode().toString();
       
        JaxbDeploymentJobResult jobResult= null;
        JaxbDeploymentUnit jaxbDepUnit;
        switch( request.getOperation() ) {
        case DEPLOY:
            jobResult = deployBase.submitDeployJob(request.getDeploymentId(), strategy, mergeMode, request.getDescriptor());
            jaxbDepUnit = jobResult.getDeploymentUnit();
            break;
        case UNDEPLOY:
            jobResult = deployBase.submitUndeployJob(request.getDeploymentId());
            jaxbDepUnit = jobResult.getDeploymentUnit();
            break;
        case GET_INFO:
            jaxbDepUnit = deployBase.determineStatus(request.getDeploymentId(), true);
            break;
        default:
View Full Code Here

Examples of org.kie.services.client.serialization.jaxb.impl.deploy.JaxbDeploymentJobResult

       
        // for test at end, fill during test
        JaxbDeploymentUnitList depUnitList = new JaxbDeploymentUnitList();
      
        // dep jobs
        JaxbDeploymentJobResult jaxbJob = new JaxbDeploymentJobResult();
        testRoundTrip(jaxbJob);

        // complex dep jobs
        KModuleDeploymentUnit kDepUnit = new KModuleDeploymentUnit("org", "jar", "1.0", "kbase", "ksession" );
        kDepUnit.setStrategy(RuntimeStrategy.PER_PROCESS_INSTANCE);
       
        JaxbDeploymentUnit depUnit = new JaxbDeploymentUnit(kDepUnit.getGroupId(), kDepUnit.getArtifactId(), kDepUnit.getArtifactId());
        depUnit.setKbaseName(kDepUnit.getKbaseName());
        depUnit.setKsessionName(kDepUnit.getKsessionName());
        depUnit.setStrategy(kDepUnit.getStrategy());
        depUnit.setStatus(JaxbDeploymentStatus.NONEXISTENT);
        depUnitList.getDeploymentUnitList().add(depUnit);

        jaxbJob = new JaxbDeploymentJobResult(null, "test", depUnit, "deploy");
        jaxbJob.setIdentifier(23L);
        jaxbJob.setSuccess(false);
        JaxbDeploymentJobResult copyJaxbJob = testRoundTrip(jaxbJob);
        ComparePair.compareObjectsViaFields(jaxbJob, copyJaxbJob, "jobId", "identifier");
       
        depUnit = new JaxbDeploymentUnit("g", "a", "v");
        depUnit.setKbaseName("kbase");
        depUnit.setKsessionName("ksession");
        depUnit.setStatus(JaxbDeploymentStatus.DEPLOY_FAILED);
        depUnit.setStrategy(RuntimeStrategy.PER_PROCESS_INSTANCE);
        depUnitList.getDeploymentUnitList().add(depUnit);
       
        JaxbDeploymentUnit copyDepUnit = testRoundTrip(depUnit);
       
        ComparePair.compareObjectsViaFields(depUnit, copyDepUnit, "identifier");

        JaxbDeploymentJobResult depJob = new JaxbDeploymentJobResult(null, "testing stuff", copyDepUnit, "test");
        depJob.setSuccess(true);
        JaxbDeploymentJobResult copyDepJob = testRoundTrip(depJob);
       
        ComparePair.compareObjectsViaFields(copyDepJob, depJob, "jobId", "identifier");
       
        JaxbDeploymentUnitList roundTripUnitList = testRoundTrip(depUnitList);
        ComparePair.compareObjectsViaFields(depUnitList.getDeploymentUnitList().get(0), roundTripUnitList.getDeploymentUnitList().get(0), "jobId", "identifier");
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.