private TargetModuleInfo createDeployment(InputStream moduleArchive, String moduleName) throws IOException
{
File tmpFile = File.createTempFile("jboss_deployment_", ".zip");
log.debug("temporary deployment file: " + tmpFile);
JarInputStream jis = new JarInputStream(moduleArchive);
// make sure we don't loose the manifest when creating a new JarOutputStream
JarOutputStream jos = null;
FileOutputStream fos = new FileOutputStream(tmpFile);
Manifest manifest = jis.getManifest();
if (manifest != null)
jos = new JarOutputStream(fos, manifest);
else jos = new JarOutputStream(fos);
// process all modules
TargetModuleInfo moduleInfo = new TargetModuleInfo();
ModuleType moduleType = null;
JarEntry entry = jis.getNextJarEntry();
while (entry != null)
{
String entryName = entry.getName();
// only process file entries
if (entryName.endsWith("/") == false)
{
moduleType = ifNotNull(determineModuleType(entryName), moduleType);
// process a sub module
if (entryName.endsWith(".jar") || entryName.endsWith(".war"))
{
File tmpSubModule = processSubModule(entryName, jis);
FileInputStream fis = new FileInputStream(tmpSubModule);
JarUtils.addJarEntry(jos, entryName, fis);
fis.close();
}
else
{
if (mapDeploymentPlan.get("!/" + entryName) == null)
JarUtils.addJarEntry(jos, entryName, jis);
else log.debug("Skip entry found in deployment plan: " + entryName);
}
}
entry = jis.getNextJarEntry();
}
// JBAS-8059: the regular jar didn't show us enough information, lets analyze the deployment plan
for (String entryName : mapDeploymentPlan.keySet())
{