dev@glassfish.java.net

WebSniffer and OSGi

From: Roberto Chinnici <Roberto.Chinnici_at_Sun.COM>
Date: Thu, 24 Apr 2008 09:49:27 -0700

While implementing the Phobos container for V3, I saw this comment in
the code for the WebSniffer (in the org.glassfish.web:gf-web-connector
module):

// Commented out by Sahoo, as in OSGi environment, we can't support
// Module.addImport. So, temporarily we add webtier to the dependency
// list of gf-web-sniffer.
// public Module[] setup(String containerHome, Logger logger) throws
IOException {
// Module[] modules = new Module[1];
// modules[0] =
modulesRegistry.makeModuleFor("org.glassfish.web:webtier", null);
// if (modules[0]==null) {
// throw new IOException("Webtier module not found, web
container is not installed or found");
// }
// return modules;
// }

This means that the sniffer module depends on the main web tier module,
which defeats the purpose of sniffers. Also, this is an obstacle to
providing a small distribution, because inclusion of the sniffer will
trigger inclusion of the whole web container.

I understand that this is a temporary measure, but going forward what's
going to be the mechanism to enable sniffers to dynamically load the
container they sniff for? Will the HK2 module registry APIs call into
the OSGi layer to install and start the dependent bundle? Or is there
going to be a new API?

Thanks,
Roberto