private void executeOnline(ServerConnection connection, boolean inPlace, List targets, ConsoleReader out, File module, File plan) throws DeploymentException, IOException {
final DeploymentManager mgr = connection.getDeploymentManager();
TargetModuleID[] results;
boolean multipleTargets;
ProgressObject po;
if(targets.size() > 0) {
Target[] tlist = identifyTargets(targets, mgr);
multipleTargets = tlist.length > 1;
po = runCommand(mgr, out, inPlace, tlist, module, plan);
waitForProgress(out, po);
} else {
Target[] tlist = mgr.getTargets();
if (null == tlist) {
throw new IllegalStateException("No target to distribute to");
}
tlist = new Target[] {tlist[0]};
multipleTargets = tlist.length > 1;
po = runCommand(mgr, out, inPlace, tlist, module, plan);
waitForProgress(out, po);
}
// print the results that succeeded
results = po.getResultTargetModuleIDs();
for (TargetModuleID result : results) {
out.printString(DeployUtils.reformat(
getAction() + " " + result.getModuleID() + (multipleTargets ? " to " + result.getTarget().getName() : "") + (result.getWebURL() == null || !getAction().equals("Deployed") ? "" : " @ " + result.getWebURL()), 4, 72));
if (result.getChildTargetModuleID() != null) {
for (int j = 0; j < result.getChildTargetModuleID().length; j++) {
TargetModuleID child = result.getChildTargetModuleID()[j];
out.printString(DeployUtils.reformat(" `-> " + child.getModuleID() + (child.getWebURL() == null || !getAction().equals("Deployed") ? "" : " @ " + child.getWebURL()), 4, 72));
}
}
}
// if any results failed then throw so that we'll return non-0
// to the operating system
if(po.getDeploymentStatus().isFailed()) {
throw new DeploymentException("Operation failed: "+po.getDeploymentStatus().getMessage());
}
}