Search in sources :

Example 1 with DFDeploymentStatus

use of org.glassfish.deployment.client.DFDeploymentStatus in project Payara by payara.

the class ProgressObjectSink method reviseStatusAndMessage.

private void reviseStatusAndMessage(DeploymentStatus ds, DFDeploymentStatus newStageStatus) {
    String msgKey = null;
    Status stageStatus;
    if (ds.isCompleted()) {
        /*
             *The deployment status for this source was successful. 
             */
        msgKey = "enterprise.deployment.client.action_completed";
        stageStatus = Status.SUCCESS;
    } else {
        /*
             *The deployment status for this source failed.
             */
        msgKey = "enterprise.deployment.client.action_failed";
        stageStatus = Status.FAILURE;
    }
    String i18msg = localStrings.getLocalString(msgKey, ds.getMessage());
    newStageStatus.setStageStatus(stageStatus);
    newStageStatus.setStageStatusMessage(i18msg);
}
Also used : DFDeploymentStatus(org.glassfish.deployment.client.DFDeploymentStatus) DeploymentStatus(javax.enterprise.deploy.spi.status.DeploymentStatus) Status(org.glassfish.deployment.client.DFDeploymentStatus.Status)

Example 2 with DFDeploymentStatus

use of org.glassfish.deployment.client.DFDeploymentStatus in project Payara by payara.

the class ProgressObjectSink method aggregateStages.

private Status aggregateStages(Status worstStatusSoFar, StringBuffer msgs, DFDeploymentStatus stage) {
    /*
         *Starting with the stage passed in, see if its severity is more urgent than that seen so far.
         *If so, then discard the messages accumulated so far for the less urgent severity and save
         *this stage's message and severity as the worst seen so far.
         */
    Status stageStatus = stage.getStageStatus();
    if (stageStatus.isWorseThan(worstStatusSoFar)) {
        worstStatusSoFar = stageStatus;
        msgs.delete(0, msgs.length());
    }
    /*
         *If the stage's severity is the same as the currently worst seen, then add this stage's message
         *to the aggregate message.
         */
    if (stageStatus == worstStatusSoFar) {
        msgs.append(stage.getStageStatusMessage()).append(LINE_SEPARATOR);
    }
    /*
         *Now, do the same for each substage.
         */
    for (Iterator it = stage.getSubStages(); it.hasNext(); ) {
        DFDeploymentStatus substage = (DFDeploymentStatus) it.next();
        worstStatusSoFar = aggregateStages(worstStatusSoFar, msgs, substage);
    }
    return worstStatusSoFar;
}
Also used : DFDeploymentStatus(org.glassfish.deployment.client.DFDeploymentStatus) DeploymentStatus(javax.enterprise.deploy.spi.status.DeploymentStatus) Status(org.glassfish.deployment.client.DFDeploymentStatus.Status) DFDeploymentStatus(org.glassfish.deployment.client.DFDeploymentStatus) Iterator(java.util.Iterator)

Example 3 with DFDeploymentStatus

use of org.glassfish.deployment.client.DFDeploymentStatus in project Payara by payara.

the class ProgressObjectSink method updateCompletedStatus.

private void updateCompletedStatus(DeploymentStatus ds) {
    /*
         *If the status passed in is already a backend.DeploymentStatus then add it as a new stage to the 
         *completed status.  Otherwise, create a new backend.DeploymentStatus, fill it in as much as 
         *possible, and add it as the next stage.
         */
    DFDeploymentStatus newStageStatus = null;
    if (ds instanceof DeploymentStatusImpl) {
        DeploymentStatusImpl dsi = (DeploymentStatusImpl) ds;
        newStageStatus = dsi.progressObject.getCompletedStatus();
    } else {
        /*
             *Create a new status stage and add it to the completed status.
             */
        newStageStatus = new DFDeploymentStatus(completedStatus);
        /*
             *The new state status depends on the DeploymentStatus outcome.
             */
        int stageStatus = -1;
        Throwable exc;
        reviseStatusAndMessage(ds, newStageStatus);
    }
    if (newStageStatus != null) {
        /*
             *Update the final status state if this new stage's state is worse than the final status's
             *current state.
             */
        completedStatus.addSubStage(newStageStatus);
    /*
             *The status being reported may say it is successful but there could be warnings in substages 
             *(or substages of substages...).  So the truly final state and message for the completed 
             *status is determined once, after the last source of events is removed.
             */
    } else {
        System.err.println("A newStageStatus was null");
    }
}
Also used : DFDeploymentStatus(org.glassfish.deployment.client.DFDeploymentStatus)

Aggregations

DFDeploymentStatus (org.glassfish.deployment.client.DFDeploymentStatus)3 DeploymentStatus (javax.enterprise.deploy.spi.status.DeploymentStatus)2 Status (org.glassfish.deployment.client.DFDeploymentStatus.Status)2 Iterator (java.util.Iterator)1