if (backupProperty != null && backupProperty.getBooleanValue() != null && backupProperty.getBooleanValue())
createBackup = true;
// Perform the deployment
File deployDir = new File(getConfigurationPath(), deployDirectory);
FileContentDelegate deployer = new FileContentDelegate(deployDir, "", details.getPackageTypeName());
File path = deployer.getPath(details);
if (!createBackup && path.exists()) {
setErrorOnCreateResourceReport(report, "A " + resourceTypeName + " file named " + path.getName()
+ " is already deployed with path " + path + ".");
return;
}
PropertySimple zipProperty = deployTimeConfiguration.getSimple("deployZipped");
if (zipProperty == null || zipProperty.getBooleanValue() == null) {
setErrorOnCreateResourceReport(report, "Zipped property is required.");
return;
}
boolean zip = zipProperty.getBooleanValue();
File tempDir = resourceContext.getTemporaryDirectory();
File tempFile = new File(tempDir.getAbsolutePath(), "ear_war.bin");
OutputStream osForTempDir = new BufferedOutputStream(new FileOutputStream(tempFile));
ContentServices contentServices = contentContext.getContentServices();
contentServices.downloadPackageBitsForChildResource(contentContext, resourceTypeName, key, osForTempDir);
osForTempDir.close();
// check for content
boolean valid = isOfType(tempFile, resourceTypeName);
if (!valid) {
setErrorOnCreateResourceReport(report, "Expected a " + resourceTypeName
+ " file, but its format/content did not match");
return;
}
deployer.createContent(details, tempFile, !zip, createBackup);
String vhost = null;
if (resourceTypeName.equals(RESOURCE_TYPE_WAR)) {
vhost = getVhostFromWarFile(tempFile);
}