private ProgressObject deploy(final Target[] targetList, final Properties properties) {
if (targetList == null) {
return new ProgressObjectImpl(CommandType.DISTRIBUTE, new NullPointerException("targetList is null"));
}
if (!containsDefaultTarget(targetList)) {
return new ProgressObjectImpl(CommandType.DISTRIBUTE, Collections.<TargetModuleID>emptySet());
}
try {
final AppInfo appInfo = getDeployer().deploy(properties);
final TargetModuleID targetModuleId = toTargetModuleId(appInfo, null);
return new ProgressObjectImpl(CommandType.DISTRIBUTE, Collections.singleton(targetModuleId));
} catch (ValidationFailedException e) {
final String s = JavaSecurityManagers.getSystemProperty(ReportValidationResults.VALIDATION_LEVEL, "3");
final int level = Integer.parseInt(s);
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final PrintStream out = new PrintStream(baos);
out.println(e.getMessage());
print(e.getErrors(), out, level);
print(e.getFailures(), out, level);
print(e.getWarnings(), out, level);
out.close();
e = new ValidationFailedException(new String(baos.toByteArray()), e);
return new ProgressObjectImpl(CommandType.DISTRIBUTE, e);
} catch (final OpenEJBException e) {
return new ProgressObjectImpl(CommandType.DISTRIBUTE, e);
}
}