If I understand it correctly, the HostBundleActiveService contains the
bundle ID as the service name, like this:
jbosgi.bundle.3."osgi.enterprise"."4.2.0.201003190513".ACTIVE
I can get the symbolic name and version from the BundleInfo attachment,
but the bundle ID is not yet available as the bundle doesn't exist yet.
So I guess I can't simply use MSC dependencies to depend on this service?
Should I create an MSC service listener and match the name instead?
Cheers,
David
On 18/07/2012 13:26, Thomas Diesler wrote:
Your WebContextFactory would become a service that your DUP
installs.
On 07/18/2012 02:24 PM, Thomas Diesler wrote:
> Yes, this could work. However it's probably better to use a
> dependency on the HostBundleActiveService.
> Generally, services that have a dependency on a particular bundle
> state should do this via ordinary service dependencies rather via
> async listeners on bundle events. So you would have a
> BundleContextInjection service with an injected bundle dependency on
> the HostBundleActiveService.
>
> cheers
> -thomas
>
>
> On 07/18/2012 01:56 PM, David Bosschaert wrote:
>> Hi all,
>>
>> I began completing the OSGi WAB support that Thomas started some time
>> ago. The first piece I looked at is AS7-5203 which gives Servlets
>> access
>> to the OSGi BundleContext via the ServletContext.
>>
>> Before filing a pull I'm looking for some feedback on how I implemented
>> this. Maybe people have thoughts re how it can be improved or
>> simplified. It currently works like this:
>> * I added a DeploymentUnitProcessor in the REGISTER phase that adds a
>> WebContextFactory.ATTACHMENT to the deployment unit.
>> * This attachment is picked up by JBoss Web (it already provided
>> this hook).
>> * When the Bundle representing the WAB is started it calls back into
>> the
>> WebContextFactory to set the BundleContext in the ServletContext. It
>> does this via a MSC Service that in turn uses an OSGi BundleListener.
>>
>> The changes are here:
>>
https://github.com/bosschaert/jboss-as/commit/9ab72ce08a3357a3e6fdb1a68c2...
>>
>>
>> Thanks,
>>
>> David
>>
>> _______________________________________________
>> jboss-osgi-dev mailing list
>> jboss-osgi-dev(a)lists.jboss.org
>>
https://lists.jboss.org/mailman/listinfo/jboss-osgi-dev
>