private void executeOnline(ServerConnection connection, List targets, PrintWriter out, File module, File plan) throws DeploymentException {
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, tlist, module, plan);
waitForProgress(out, po);
} else {
final Target[] tlist = mgr.getTargets();
multipleTargets = tlist.length > 1;
po = runCommand(mgr, out, tlist, module, plan);
waitForProgress(out, po);
}
// print the results that succeeded
results = po.getResultTargetModuleIDs();
for (int i = 0; i < results.length; i++) {
TargetModuleID result = results[i];
out.println(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.println(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());
}
}