EarArchive earArchive = new DefaultEarArchive(
new FileInputStream(theDeployableFile));
String webUri = getUriOfCactifiedWebModule(earArchive);
if (webUri == null)
{
throw new CactusRuntimeException("Could not find cactified web "
+ "module in the [" + theDeployableFile + "] EAR.");
}
WarArchive warArchive = earArchive.getWebModule(webUri);
if (warArchive == null)
{
throw new CactusRuntimeException("Could not find the WAR [" + webUri
+ "] in the [" + theDeployableFile + "] EAR.");
}
deployable.setWarArchive(warArchive);
deployable.setTestContext(parseTestContext(earArchive, webUri));
deployable.setServletRedirectorMapping(
WarParser.parseServletRedirectorMapping(
deployable.getWarArchive()));
deployable.setFilterRedirectorMapping(
WarParser.parseFilterRedirectorMapping(
deployable.getWarArchive()));
deployable.setJspRedirectorMapping(
WarParser.parseJspRedirectorMapping(
deployable.getWarArchive()));
}
catch (IOException e)
{
throw new CactusRuntimeException("Failed to parse deployment descriptor "
+ "for EAR file [" + theDeployableFile + "].", e);
}
catch (ParserConfigurationException e)
{
throw new CactusRuntimeException("Failed to parse deployment descriptor "
+ "for EAR file [" + theDeployableFile + "].", e);
}
catch (SAXException e)
{
throw new CactusRuntimeException("Failed to parse deployment descriptor "
+ "for EAR file [" + theDeployableFile + "].", e);
}
catch (JDOMException e)
{
throw new CactusRuntimeException("Failed to parse deployment descriptor "
+ "for EAR file [" + theDeployableFile + "].", e);
}
return deployable;
}