Matthias Wessendorf schrieb:
Hey Felix,
2009/7/9 Felix Röthenbacher <[email protected]>:
Hi
I recently made some modifications to MyFaces Core and MyFaces Trinidad
to get it running in an OSGi container (Equinox) together with Facelets.
I wonder if there is any interest in adding bundle metadata to MyFaces
Core and Trinidad to make them runnable in an OSGi environment? If so,
I could finalize my modifications and submit a patch with the necessary
changes.
Basically, the changes include:
- adding bundle information in MANIFEST.MF (uses Maven bundle plugin)
- assure that classes and resources are loaded with proper class loaders
The changes to MyFaces core are minor, e.g. adding a bundle activator
and small modifications to ClassUtil for class loading.
Modifications to Trinidad comprise a systematic use of ClassLoaderUtils to
load classes and resources. Currently, often
Thread.currentThread.getContextClassLoader() is used directly, which doesn't
work well in an OSGi environment.
you mean this this one, right ?
org.apache.myfaces.trinidad.util.ClassLoaderUtils
Right. To keep it clean, both bundles (api and impl) need class loader utils
to use their respective bundle class loader. The class loader utils decide
if the bundle is running in an OSGi environment and if so, uses the bundle
class loader. The implementation doesn't require a runtime dependency on
OSGi classes when not running in an OSGi container.
A special case is resource loading, especially the ones under META-INF as
this package is not exported and therefore not accessible from other
bundles. MyFaces Core and Trinidad need to access these resources from
different bundles in order to configure faces.
- Felix
-M
WDYT?
- Felix