//TODO consider passing in location?
private Set<String> findBeansXml(Bundle mainBundle, PackageAdmin packageAdmin, String location)
throws Exception
{
final Set<String> beanArchiveJarNames = new HashSet<String>();
BundleResourceFinder brfXmlJar = new BundleResourceFinder(packageAdmin, mainBundle, "", META_INF_BEANS_XML);
BundleResourceFinder.ResourceFinderCallback rfCallback = new BundleResourceFinder.ResourceFinderCallback()
{
public boolean foundInDirectory(Bundle bundle, String basePath, URL url) throws Exception
{
// logger.info("adding the following beans.xml URL: " + url);
beanArchiveJarNames.add(basePath);
return true;
}
public boolean foundInJar(Bundle bundle, String jarName, ZipEntry entry, InputStream in) throws Exception
{
URL jarURL = bundle.getEntry(jarName);
// URL beansUrl = new URL("jar:" + jarURL.toString() + "!/" + entry.getName());
// logger.info("adding the following beans.xml URL: " + beansUrl);
beanArchiveJarNames.add(jarName);
return true;
}
};
brfXmlJar.find(rfCallback);
// TODO I found no other way to find WEB-INF/beanx.xml directly
Enumeration<URL> urls = mainBundle.findEntries(location + "/WEB-INF", "beans.xml", true);
boolean webBeansXmlFound = false;
while (urls != null && urls.hasMoreElements()) {