DOLUtils.getDefaultLogger().fine("Opening sub-module " + aModule);
}
Descriptor descriptor = null;
ArchiveDescriptor archiveDesc = null;
Archivist newArchivist = null;
AbstractArchive embeddedArchive =
appArchive.getEmbeddedArchive(aModule.getArchiveUri());
if(ModuleType.WAR.equals(aModule.getModuleType())){
// Check if this is an extension module.If there is an IOException
// thrown then this means that we cannot determine the archivist
// using the archive, and also that this is not an extension
// module.
try {
newArchivist =
getPluggableArchivists().getArchivistForArchive(
embeddedArchive);
} catch (IOException ioe) {
// This has to be a Web Module now.
newArchivist = getPluggableArchivists().getArchivistForType(
aModule.getModuleType());
}
} else {
newArchivist = getPluggableArchivists().getArchivistForType(
aModule.getModuleType());
}
newArchivist.initializeContext(this);
newArchivist.setRuntimeXMLValidation(this.getRuntimeXMLValidation());
newArchivist.setRuntimeXMLValidationLevel(
this.getRuntimeXMLValidationLevel());
//AbstractArchive embeddedArchive = appArchive.getEmbeddedArchive(aModule.getArchiveUri());
if (aModule.getAlternateDescriptor()!=null) {
// the module use alternate deployement descriptor, ignore the
// DDs in the archive.
InputStream is = appArchive.getEntry(aModule.getAlternateDescriptor());
DeploymentDescriptorFile ddFile = newArchivist.getStandardDDFile();
ddFile.setXMLValidation(newArchivist.getXMLValidation());
ddFile.setXMLValidationLevel(newArchivist.getXMLValidationLevel());
if (appArchive.getArchiveUri()!=null) {
ddFile.setErrorReportingString(appArchive.getArchiveUri());
}
descriptor = ddFile.read(is);
is.close();
newArchivist.readWebServicesDescriptor(embeddedArchive, descriptor);
newArchivist.readPersistenceDeploymentDescriptors(embeddedArchive, descriptor);
newArchivist.postStandardDDsRead((RootDeploymentDescriptor) descriptor, embeddedArchive);
newArchivist.readAnnotations(embeddedArchive, (BundleDescriptor)descriptor);
newArchivist.postAnnotationProcess((BundleDescriptor)descriptor, embeddedArchive);
newArchivist.postOpen((RootDeploymentDescriptor) descriptor, embeddedArchive);
// now reads the runtime deployment descriptor...
if (isHandlingRuntimeInfo()) {
is = appArchive.getEntry("sun-" + aModule.getAlternateDescriptor());
if (is!=null) {
DeploymentDescriptorFile confDD =
newArchivist.getConfigurationDDFile();
confDD.setXMLValidation(
newArchivist.getRuntimeXMLValidation());
confDD.setXMLValidationLevel(
newArchivist.getRuntimeXMLValidationLevel());
if (appArchive.getArchiveUri()!=null) {
confDD.setErrorReportingString(
appArchive.getArchiveUri());
}
confDD.read(descriptor, is);
is.close();
newArchivist.postRuntimeDDsRead((RootDeploymentDescriptor)descriptor, embeddedArchive);
} else {
if (embeddedArchive!=null) {
newArchivist.readRuntimeDeploymentDescriptor(embeddedArchive,descriptor);
}
}
}
} else {
// open the subarchive to get the deployment descriptor...
if (embeddedArchive!=null) {
if(newArchivist instanceof ExtensionModuleArchivist) {
try{
((ExtensionModuleArchivist)newArchivist).
setJ2eeApplication(true);
archiveDesc =
((ExtensionModuleArchivist)newArchivist).openArchive(
embeddedArchive.getArchiveUri(),
null,
this.classLoader,
false);
} catch (Exception ex) {
//log this message
DOLUtils.getDefaultLogger().severe(
"Exception thrown while processing module "
+ aModule.getDescriptor().getModuleID()
+ ex.getMessage());
ex.printStackTrace();
}
} else {
descriptor = newArchivist.open(embeddedArchive);
}
} else {
DOLUtils.getDefaultLogger().info(localStrings.getLocalString(
"enterprise.deployment.cannotfindmodule",
"Cannot find module {0} in application bundle",
new Object[] {aModule.getArchiveUri()}));
return false;
}
}
if (embeddedArchive!=null) {
embeddedArchive.close();
}
if (descriptor != null && descriptor instanceof BundleDescriptor) {
aModule.setDescriptor((BundleDescriptor) descriptor);
((BundleDescriptor) descriptor).setApplication(app);
aModule.setManifest(newArchivist.getManifest());