Author: adietish
Date: 2011-04-11 05:54:41 -0400 (Mon, 11 Apr 2011)
New Revision: 30466
Modified:
workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/DeploymentBuilder.java
Log:
now returning builder that was returned by operation
Modified:
workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/DeploymentBuilder.java
===================================================================
---
workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/DeploymentBuilder.java 2011-04-11
09:50:06 UTC (rev 30465)
+++
workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/DeploymentBuilder.java 2011-04-11
09:54:41 UTC (rev 30466)
@@ -26,7 +26,6 @@
import org.jboss.as.controller.client.helpers.standalone.DeploymentAction;
import org.jboss.as.controller.client.helpers.standalone.DeploymentPlan;
import org.jboss.as.controller.client.helpers.standalone.DeploymentPlanBuilder;
-import org.jboss.as.controller.client.helpers.standalone.InitialDeploymentPlanBuilder;
import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentActionResult;
import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager;
import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentPlanResult;
@@ -43,12 +42,10 @@
private ServerDeploymentManager manager;
private final List<Deployable> deployables = new ArrayList<Deployable>();
private long timeout = DEFAULT_TIMEOUT;
- private InitialDeploymentPlanBuilder builder;
public DeploymentBuilder(String host, int port) throws UnknownHostException {
this.client = ModelControllerClient.Factory.create(InetAddress.getByName(host), port);
this.manager = ServerDeploymentManager.Factory.create(client);
- this.builder = manager.newDeploymentPlan();
}
public DeploymentBuilder add(String name, File file) {
@@ -71,7 +68,7 @@
}
try {
- addWarFiles(builder, deployables);
+ DeploymentPlanBuilder builder = addToBuilder(deployables,
manager.newDeploymentPlan().withoutRollback());
DeploymentPlan plan = builder.build();
Future<ServerDeploymentPlanResult> planResult = manager.execute(plan);
setResult(planResult, deployables);
@@ -89,12 +86,14 @@
}
}
- private void addWarFiles(DeploymentPlanBuilder builder, List<Deployable>
deployables) throws IOException {
+ private DeploymentPlanBuilder addToBuilder(List<Deployable> deployables,
DeploymentPlanBuilder builder)
+ throws IOException {
for (int i = 0; i < deployables.size(); i++) {
Deployable deployable = deployables.get(i);
- DeploymentPlanBuilder addBuilder = builder.add(deployable.getName(),
deployable.getFile()).andDeploy();
- deployable.setDeploymentAction(addBuilder.getLastAction());
+ builder = builder.add(deployable.getName(), deployable.getFile()).andDeploy();
+ deployable.setDeploymentAction(builder.getLastAction());
}
+ return builder;
}
private void cleanup() {
@@ -146,6 +145,10 @@
}
private IStatus createStatus(DeploymentAction action, ServerDeploymentActionResult
actionResult) {
+ if (actionResult == null) {
+ return null;
+ }
+
IStatus status = null;
switch (actionResult.getResult()) {
case NOT_EXECUTED:
@@ -178,8 +181,4 @@
messagePattern, messageArguments));
}
}
-
- public static class Deployment {
-
- }
}