Hi

I would like to know how a library "should" implement classpath
scanning using OSGi means only. I know that the "classpath scanning"
issue has been raised on this list before. I particulary came by the
following post:

http://www.mail-archive.com/[email protected]/msg11838.html

Putting container specific solutions aside, the only solution I came
up with is the following algorithm:

// Get the current bundle
Bundle bundle = FrameworkUtil.getBundle(...);

// Scan the current bundle. Works for the following case:
// - Fragment is attached to the library
// - Library is wrapped inside a bundle
Enumeration<URL> entries = bundle.findEntries("migration/db", "*", true);

// No results found: Search in all bundles
BundleContext context = currentBundle.getBundleContext();
Bundle[] bundles = context.getBundles();

for (Bundle bundle : bundles) {
     ... = bundle.findEntries("migration/db", "*", true);
}

Questions:
- Is the approach described above a perfectly legitimate approache or
more like a hack?
- Are there other possibilties to implement classpath scanning with OSGi?
- Do you know of (simple) libraries that use classpath scanning and
work in OSGi? (best practice example)

I'm aware that the question is not Felix specific but I'm non the less
very interested in your thoughts.

Cheers
michael

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to