Application application = (Application) rootDD.read(null, in);
// all web modules in the J2EE application
for (Iterator modules = application.getModules();
modules.hasNext();) {
ModuleDescriptor aModule = (ModuleDescriptor) modules.next();
if (!((aModule.getModuleType()).equals(ModuleType.EJB))) {
_logger.fine(
"Skipping non ejb jar module descriptor: " +
aModule.getModuleType());
continue;
}
// alt dd
if (aModule.getAlternateDescriptor() != null) {
File f = new File(aModule.getAlternateDescriptor());
// Get the path of the parent of alt dd file.
// add this path to total path, if this is not
// null.
String parent = f.getParent();
if (parent == null) {
parent = "";
}
// path to the sun-xxx.xml file
String instanceRoot = System.getProperty(SystemPropertyConstants.INSTANCE_ROOT_PROPERTY);
File generated = new File(instanceRoot,
PEFileLayout.GENERATED_DIR);
File xml = new File(generated, PEFileLayout.XML_DIR);
File j2eeApps = new File(xml,
PEFileLayout.J2EE_APPS_DIR);
File generatedAppRoot = new File(j2eeApps,
applicationName);
String generatedAppPath = generatedAppRoot.getAbsolutePath();
File altWebapp = new File(generatedAppPath,
parent + File.separator + SUN_PREFIX +
f.getName());
if (altWebapp.exists()) {
_logger.fine("Adding alt-web-app path " +
altWebapp.getAbsolutePath());
// adding to the list
list.add(altWebapp.getAbsolutePath());
} else {
_logger.fine("Invalid path: " +
altWebapp.getAbsolutePath());
}
} else { // no alt dd
String aUri = aModule.getArchiveUri();
if (aUri != null) {
String instanceRoot = System.getProperty(SystemPropertyConstants.INSTANCE_ROOT_PROPERTY);
File generated = new File(instanceRoot,
PEFileLayout.GENERATED_DIR);