> On 15 Jun 2016, at 11:19, Paul F Fraser <pa...@a2zliving.com> wrote:
> 
> Hi,
> 
> The bundle usage counting is required for a simple feature start and stop 
> functionality.

Okay but we still haven’t got to the bottom of what you mean by “usage”.

> If a bundle is used by multiple features I need a count to know when to 
> install and start a bundle …

This sounds like you want to know whether a bundle *would* be used before you 
install/start it. OSGi cannot tell you that. You might be able to use the 
resolver tooling in bnd to predict what the runtime wiring might look like, but 
it’s not guaranteed to match what the framework will actually do.

> … and when features are stopped to detect when to stop and or uninstall a 
> bundle.

So, if a bundle has no provided wires and no consumed services then it’s 
probably pretty safe to uninstall.

Neil

> 
> Paul
> 
> On 15/06/2016 8:00 PM, Neil Bartlett wrote:
>> Depends what you mean by "bundle usage".
>> 
>> If you’re talking about services, then you can get the ServiceReferences 
>> registered by a bundle and count the using bundles with getUsingBundles. If 
>> you’re talking about package wiring and Require-Bundle then you can adapt 
>> the bundle to a BundleWiring object and call getProvidedWires. Bear in mind 
>> that there will be duplicates and the bundle could also wire to itself (or 
>> reference its own services).
>> 
>> Neil
>> 
>>> On 15 Jun 2016, at 10:53, Paul F Fraser <pa...@a2zliving.com> wrote:
>>> 
>>> Hi,
>>> 
>>> Is there an existing ability in the OSGi environment to keep a bundle usage 
>>> count?
>>> 
>>> It is not difficult to create my own method and storage, but if something 
>>> already exists!
>>> 
>>> I did think I could use the Bundle data area but it seems that different 
>>> frameworks lay it out differently.
>>> 
>>> Aries subsystems has bundle counting but it is a bit heavy for my use case.
>>> 
>>> Any suggestions?
>>> 
>>> Regards
>>> 
>>> Paul Fraser
>>> 
>>> 
>>> _______________________________________________
>>> OSGi Developer Mail List
>>> osgi-dev@mail.osgi.org
>>> https://mail.osgi.org/mailman/listinfo/osgi-dev
>> _______________________________________________
>> OSGi Developer Mail List
>> osgi-dev@mail.osgi.org
>> https://mail.osgi.org/mailman/listinfo/osgi-dev
> 
> 
> _______________________________________________
> OSGi Developer Mail List
> osgi-dev@mail.osgi.org
> https://mail.osgi.org/mailman/listinfo/osgi-dev

_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to