OperationResult result = new OperationResult();
result.setErrorMessage("Did not find deployment with key [" + deploymentKey + "]");
return result;
}
DeploymentManager deploymentManager = connection.getDeploymentManager();
DeploymentProgress progress;
if (name.equals("start")) {
//FIXME: This is a workaround until JOPR-309 will be fixed.
if (getAvailability() != AvailabilityType.UP) {
progress = deploymentManager.start(deploymentName);
} else {
LOG.warn("Operation '" + name + "' on " + getResourceDescription()
+ " failed because the Resource is already started.");
OperationResult result = new OperationResult();
result.setErrorMessage(deploymentFile.getName() + " is already started.");
return result;
}
} else if (name.equals("stop")) {
progress = deploymentManager.stop(deploymentName);
} else if (name.equals("restart")) {
progress = deploymentManager.stop(deploymentName);
DeploymentUtils.run(progress);
// Still try to start, even if stop fails (maybe the app wasn't running to begin with).
progress = deploymentManager.start(deploymentName);
} else {
throw new UnsupportedOperationException(name);
}
DeploymentStatus status = DeploymentUtils.run(progress);
if (LOG.isDebugEnabled()) {