Just to be clear, you are proposing a new launcher for the Felix
framework to support web applications?
-> richard
On 10/7/09 0:27, Edelson, Justin wrote:
As mentioned in the HttpService release thread, I'd like to see a default
ServletContextListener provided by Felix. I'm happy to provide a patch to do
this, based on code I've already written (which is, in turn, based on Sling
code). Before doing this, I'd like to get some feedback on what I believe the
default behavior to be.
Here's what I'd like to propose as a starting point for the default Felix
webapp configuration:
Felix will provide a ServletContextListener in the proxy module named
DefaultFelixListener. This class will create a configuration map and then
instantiate Felix using this map.
The map is populated with:
-- System properties
-- the contents of /WEB-INF/framework.properties
-- servlet context init params
If this configuration map does not contain either
org.osgi.framework.system.packages org.osgi.framework.system.packages.extra
keys, the value of the org.osgi.framework.system.packages.extra property will
be created by combining the following:
* the list of compendium packages
* the value of felix.webapp.system.packages.extra (if defined in the
configuration map)
* javax.servlet and javax.servlet.http with a version corresponding to the result of
ServletContext.getMajorVersion()+"."+ServletContext.getMinorVersion()
The configuration map will also contain an instance of a class called
BootstrapInstaller (see below), wrapped inside a list, under the
felix.systembundles.activators key. Potentially, this this should be extensible
using a protected hook method which subclasses can implement).
(in the example code, #1 and #2 are handled by a separate class, but I'm not
sure this is a good idea as it makes it harder for downstream users to override
the default behavior)
The BootstrapInstaller class, which implements BundleActivator, does the
following:
* Save the BundleContext in a servlet context attribute named
org.osgi.framework.BundleContext.
* Create a list of subdirectories under /WEB-INF/resources/bundles. Each
subdirectory name must be parseable as a number. This number will be taken as
the start level for the bundles contained within that directory.
* For each bundle (defined as files ending in .jar or .war) within each
subdirectory of /WEB-INF/resources/bundles, read the manifest and ensure it has
a symbolic name.
* Install or update each bundle:
-- if no bundle with the symbolic name is already installed
-- if a bundle with the same symbolic name is installed, but has an earlier
version
-- if a bundle with the same symbolic name and version is installed, but the version ends
in "-SNAPSHOT".
* Start all the installed bundles
This behavior is basically a subset of what Sling currently does (except that Sling
doesn't deal with war files or have the SNAPSHOT behavior, both of which I happen to
need). Sling also does the "saving the bundle context as a servlet context
attribute in a separate BundleActivator, which is reasonable enough).
Thoughts?
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]