if (earFile != null) {
ModuleType[] moduleTypes = application.getModuleArray();
//paths is used to check that all modules in the geronimo plan are in the application.xml.
Set paths = new HashSet();
for (int i = 0; i < moduleTypes.length; i++) {
ModuleType type = moduleTypes[i];
if (type.isSetEjb()) {
paths.add(type.getEjb().getStringValue());
} else if (type.isSetWeb()) {
paths.add(type.getWeb().getWebUri().getStringValue());
} else if (type.isSetConnector()) {
paths.add(type.getConnector().getStringValue());
} else if (type.isSetJava()) {
paths.add(type.getJava().getStringValue());
}
}
// build map from module path to alt vendor dd
GerModuleType gerModuleTypes[] = gerApplication.getModuleArray();
for (int i = 0; i < gerModuleTypes.length; i++) {
GerModuleType gerModule = gerModuleTypes[i];
String path = null;
if (gerModule.isSetEjb()) {
path = gerModule.getEjb().getStringValue();
} else if (gerModule.isSetWeb()) {
path = gerModule.getWeb().getStringValue();
} else if (gerModule.isSetConnector()) {
path = gerModule.getConnector().getStringValue();
} else if (gerModule.isSetJava()) {
path = gerModule.getJava().getStringValue();
}
if (!paths.contains(path)) {
throw new DeploymentException("Geronimo deployment plan refers to module '" + path + "' but that was not defined in the META-INF/application.xml");
}
if (gerModule.isSetAltDd()) {
// the the url of the alt dd
try {
altVendorDDs.put(path, DeploymentUtil.toTempFile(earFile, gerModule.getAltDd().getStringValue()));
} catch (IOException e) {
throw new DeploymentException("Invalid alt vendor dd url: " + gerModule.getAltDd().getStringValue(), e);
}
} else {
//dd is included explicitly
XmlObject[] anys = gerModule.selectChildren(GerModuleType.type.qnameSetForWildcardElements());
if (anys.length != 1) {
throw new DeploymentException("Unexpected count of xs:any elements in embedded vendor plan " + anys.length + " qnameset: " + GerModuleType.type.qnameSetForWildcardElements());
}
altVendorDDs.put(path, anys[0]);
}
}
// get a set containing all of the files in the ear that are actually modules
for (int i = 0; i < moduleTypes.length; i++) {
ModuleType moduleXml = moduleTypes[i];
String modulePath;
ModuleBuilder builder;
Object moduleContextInfo = null;
String moduleTypeName;
if (moduleXml.isSetEjb()) {
modulePath = moduleXml.getEjb().getStringValue();
builder = getEjbConfigBuilder();
if (builder == null) {
throw new DeploymentException("Cannot deploy ejb application; No ejb deployer defined: " + modulePath);
}
moduleTypeName = "an EJB";
} else if (moduleXml.isSetWeb()) {
modulePath = moduleXml.getWeb().getWebUri().getStringValue();
if (getWebConfigBuilder() == null) {
throw new DeploymentException("Cannot deploy web application; No war deployer defined: " + modulePath);
}
builder = getWebConfigBuilder();
moduleTypeName = "a war";
moduleContextInfo = moduleXml.getWeb().getContextRoot().getStringValue().trim();
} else if (moduleXml.isSetConnector()) {
modulePath = moduleXml.getConnector().getStringValue();
if (getConnectorConfigBuilder() == null) {
throw new DeploymentException("Cannot deploy resource adapter; No rar deployer defined: " + modulePath);
}
builder = getConnectorConfigBuilder();
moduleTypeName = "a connector";
} else if (moduleXml.isSetJava()) {
modulePath = moduleXml.getJava().getStringValue();
if (getAppClientConfigBuilder() == null) {
throw new DeploymentException("Cannot deploy app client; No app client deployer defined: " + modulePath);
}
builder = getAppClientConfigBuilder();
moduleTypeName = "an application client";
} else {
throw new DeploymentException("Could not find a module builder for module: " + moduleXml);
}
moduleLocations.add(modulePath);
URL altSpecDD = null;
if (moduleXml.isSetAltDd()) {
try {
altSpecDD = DeploymentUtil.createJarURL(earFile, moduleXml.getAltDd().getStringValue());
} catch (MalformedURLException e) {
throw new DeploymentException("Invalid alt sped dd url: " + moduleXml.getAltDd().getStringValue(), e);
}
}
NestedJarFile moduleFile;
try {