// assume it's a URL
try {
URL url = new URL(location);
String fileName = url.getFile();
if (fileName == null) {
throw new DeploymentException("Location: " + location + " is not an archive");
}
file = FileUtil.unpackArchive(url, tmpRoot);
} catch (MalformedURLException e) {
throw new DeploymentException(e);
}
}
if (FileUtil.archiveContainsEntry(file, DescriptorFactory.DESCRIPTOR_FILE)) {
tmpDir = FileUtil.createUniqueDirectory(tmpRoot, file.getName());
FileUtil.unpackArchive(file, tmpDir);
if (LOG.isDebugEnabled()) {
LOG.debug("Unpacked archive " + location + " to " + tmpDir);
}
}
} catch (IOException e) {
throw new DeploymentException(e);
}
return tmpDir;
}