}
if (application == null) {
return null;
}
GerApplicationType gerApplication = null;
try {
// load the geronimo-application.xml from either the supplied plan or from the earFile
GerApplicationDocument gerApplicationDoc = null;
try {
if (planFile != null) {
gerApplicationDoc = GerApplicationDocument.Factory.parse(planFile);
} else {
URL path = DeploymentUtil.createJarURL(earFile, "META-INF/geronimo-application.xml");
gerApplicationDoc = GerApplicationDocument.Factory.parse(path);
}
} catch (IOException e) {
}
// if we got one extract the validate it otherwise create a default one
if (gerApplicationDoc != null) {
SchemaConversionUtils.validateDD(gerApplicationDoc);
gerApplication = gerApplicationDoc.getApplication();
} else {
gerApplication = createDefaultPlan(application, earFile);
}
} catch (XmlException e) {
throw new DeploymentException(e);
}
// get the ids from either the application plan or for a stand alone module from the specific deployer
URI configId = null;
try {
configId = new URI(gerApplication.getConfigId());
} catch (URISyntaxException e) {
throw new DeploymentException("Invalid configId " + gerApplication.getConfigId(), e);
}
URI parentId = null;
if (gerApplication.isSetParentId()) {
try {
parentId = new URI(gerApplication.getParentId());
} catch (URISyntaxException e) {
throw new DeploymentException("Invalid parentId " + gerApplication.getParentId(), e);
}
} else {
parentId = defaultParentId;
}
// get the modules either the application plan or for a stand alone module from the specific deployer
// todo change module so you can extract the real module path back out.. then we can eliminate
// the moduleLocations and have addModules return the modules
Set moduleLocations = new HashSet();
Set modules = new LinkedHashSet();
try {
addModules(earFile, application, gerApplication, moduleLocations, modules);
} catch (Throwable e) {
// close al the modules
for (Iterator iterator = modules.iterator(); iterator.hasNext();) {
Module module = (Module) iterator.next();
module.close();
}
if (e instanceof DeploymentException) {
throw (DeploymentException)e;
} else if (e instanceof RuntimeException) {
throw (RuntimeException)e;
} else if (e instanceof Error) {
throw (Error)e;
}
throw new DeploymentException(e);
}
String applicationName = gerApplication.isSetApplicationName()? gerApplication.getApplicationName(): configId.toString();
return new ApplicationInfo(ConfigurationModuleType.EAR,
configId,
parentId,
applicationName,