use of alien4cloud.paas.exception.PaaSNotYetDeployedException in project alien4cloud by alien4cloud.
the class AbstractPaaSProvider method undeploy.
@Override
public void undeploy(PaaSDeploymentContext deploymentContext, IPaaSCallback<?> callback) {
String deploymentId = deploymentContext.getDeploymentPaaSId();
try {
providerLock.writeLock().lock();
DeploymentStatus deploymentStatus = getStatus(deploymentId, true);
switch(deploymentStatus) {
case UNDEPLOYMENT_IN_PROGRESS:
case UNDEPLOYED:
throw new PaaSNotYetDeployedException("Application [" + deploymentId + "] is in status [" + deploymentStatus + "] and cannot be undeployed");
case UNKNOWN:
throw new IllegalDeploymentStateException("Application [" + deploymentId + "] is in status [" + deploymentStatus + "] and cannot be undeployed");
case DEPLOYMENT_IN_PROGRESS:
case FAILURE:
case DEPLOYED:
case WARNING:
doUndeploy(deploymentContext);
callback.onSuccess(null);
break;
default:
throw new IllegalDeploymentStateException("Application [" + deploymentId + "] is in illegal status [" + deploymentStatus + "] and cannot be undeployed");
}
} finally {
providerLock.writeLock().unlock();
}
}
Aggregations