SeamFramework.orgCommunity Documentation
The extension API defines all the features provided to OSGi environment using CDI specification. It exposes all the new utilities and defines the behavior of the extension bundle.
It exposes all the interfaces, events and annotations usable by a developers in order to develop its client bean bundles. It defines the programming model of bean bundle. Mostly it is about publishing and consuming injectable services in a CDI way.
It also describes the object the extension bundle needs to orchestrate bean bundles.
So this is where to search for new usages of OSGi.
The extension bundle is the orchestrator of Weld-OSGi. It may be used by any application that requires Weld-OSGi. It may be just started at the beginning of a Weld-OSGi application. It requires the extension API bundle as a dependency.
The extension bundle is the heart of Weld-OSGi applications. Once it is started, provided that it finds a started integration bundle, it manages all the bean bundles. It is in charge of service automatic publishing, service injections, CDI event notifications and bundle communications.
It runs in background, it just need to be started with the OSGi environment, then everything is transparent to the user. Client bean bundles do not have to do anything in order to use Weld-OSGi functionality.
In order to perform injections, the extension bundle searches for a CDI compliant container service provider once it is started. Thus it can only work coupled with a bundle providing such a service: the integration bundle.
The extension bundle provides an extension to OSGi as an extender pattern. The extension bundle (the extender) tracks for bean bundles (the extensions) to be started. Then CDI utilities are enabled for these bean bundles over OSGi environment.
The extension bundle works that way:
BEGIN
start
WHILE ! integration_bundle.isStarted
wait
END_WHILE
obtain_container_factory
FOR bean_bundle : started_bundles
manage_bean_bundle
provide_container
END_FOR
WHILE integration_bundle.isStarted
wait_event
OnBeanBundleStart
manage_bean_bundle
provide_container
OnBeanBundleStop
unmanage_bean_bundle
END_WHILE
stop
FOR bean_bundle : managed_bundles
unmanage_bean_bundle
stop_bean_bundle
END_FOR
ENDSo this is where the magic happens and where OSGi applications become much more simple.