public static StandaloneDeployment create(final ModelControllerClient client, final File content, final String name, final Type type) {
return new StandaloneDeployment(client, content, name, type);
}
private DeploymentPlan createPlan(final DeploymentPlanBuilder builder) throws IOException {
DeploymentPlanBuilder planBuilder = builder;
switch (type) {
case DEPLOY: {
planBuilder = builder.add(name, content).andDeploy();
break;
}
case REDEPLOY: {
planBuilder = builder.replace(name, content).redeploy(name);
break;
}
case UNDEPLOY: {
planBuilder = builder.undeploy(name).remove(name);
break;
}
case FORCE_DEPLOY: {
if (exists()) {
planBuilder = builder.replace(name, content).redeploy(name);
} else {
planBuilder = builder.add(name, content).andDeploy();
}
break;
}
case UNDEPLOY_IGNORE_MISSING: {
if (exists()) {
planBuilder = builder.undeploy(name).remove(name);
} else {
return null;
}
break;
}
}
return planBuilder.build();
}