} catch (XmlException e) {
throw new DeploymentException("Could not parse application.xml", e);
}
}
GerApplicationType gerApplication = null;
try {
// load the geronimo-application.xml from either the supplied plan or from the earFile
XmlObject rawPlan;
try {
if (planFile != null) {
rawPlan = XmlBeansUtil.parse(planFile.toURL(), getClass().getClassLoader());
gerApplication = (GerApplicationType) SchemaConversionUtils.fixGeronimoSchema(rawPlan, APPLICATION_QNAME, GerApplicationType.type);
if (gerApplication == null) {
return null;
}
} else {
URL path = DeploymentUtil.createJarURL(earFile, "META-INF/geronimo-application.xml");
rawPlan = XmlBeansUtil.parse(path, getClass().getClassLoader());
gerApplication = (GerApplicationType) SchemaConversionUtils.fixGeronimoSchema(rawPlan, APPLICATION_QNAME, GerApplicationType.type);
}
} catch (IOException e) {
//TODO isn't this an error?
}
// if we got one extract the validate it otherwise create a default one
if (gerApplication == null) {
gerApplication = createDefaultPlan(application, earFile);
}
} catch (XmlException e) {
throw new DeploymentException(e);
}
EnvironmentType environmentType = gerApplication.getEnvironment();
Environment environment = EnvironmentBuilder.buildEnvironment(environmentType, defaultEnvironment);
idBuilder.resolve(environment, earFile == null ? planFile.getName() : new File(earFile.getName()).getName(), "ear");
// Make this EAR's settings the default for child modules
idBuilder.setDefaultGroup(environment.getConfigId().getGroupId());
idBuilder.setDefaultVersion(environment.getConfigId().getVersion());