I've looking into the implementation of Felix Web Console and it seems that
they are getting the unsatisfied package imports "by hand".
The algorithm is like this:
Foreach import of the installed (not resolved) bundle:
Check if an export from any resolved bundle matches //using
PackageAdmin.getExportedPackages(null)
If none matches and is not exported by the bundle itself ==> there is a
missing dependency
Though I don't like very much the idea of implementing my own dependency
checker, it seems as a valid alternative.
However, I find some regarding this approach:
1. They are using PackageAdminwhich is deprecated now. Analyzing the
current alternative (org.osgi.framework.wiring package) it seems that the list
of exported packages could be retrieved by issuing a getDependencyClosure on
the framework's bundle (to get all resolved bundles) and querying each one for
its BundleCapabilitys (calling getDeclaredCapabilities). I don't know for sure,
but it seems that all this may be very costly to do for each bundle that can't
be resolved. Also, I may guess that this kind of operation doesn't scale very
well when there is a great number of bundles installed in the framework.
2. They are using some Felix's specific functionality to parse the
bundle's import header. I would need to implement the same funcionality myself
or extract those classes as an utility package for my solution.
If the framework necessarily needs to check which dependencies are satisfied in
order to resolve a bundle, I wonder why there isn't a way (maybe an event) to
know which requirement fail?
Anyone can think of another solution to the issue of getting a bundle's
unsatisfied package imports?
Many thanks in advance!
>________________________________
> De: Matias SM <elmismocorreo-o...@yahoo.com.ar>
>Para: Justin Edelson <jus...@justinedelson.com>; OSGi Developer Mail List
><osgi-dev@mail.osgi.org>
>Enviado: sábado, 10 de diciembre de 2011 12:44
>Asunto: Re: [osgi-dev] Re: Retrieve bundle's missing dependencies
>
>
>I understand and I'm really grateful for your suggestion. What I was
wondering is if there is a standard way of doing what I need (since I
can't find anything in the spec). If there isn't a standard way of
accomplishing my goal, I would need to add the dependency to a tool that let me
do it (e.g. Felix framework). That's what I meant.
>I will pay a look at Felix Web Console and let you all know what I find.
>
>
>If somebody else knows and want to share a way to get a bundle's unsatisfied
>package imports, I would be greatly thankful. The more alternatives, the
>better ;)
>
>
>
>Thanks!
>Regards
>
>
>
>
>>________________________________
>> De: Justin Edelson <jus...@justinedelson.com>
>>Para: Matias SM <elmismocorreo-o...@yahoo.com.ar>; OSGi Developer Mail List
>><osgi-dev@mail.osgi.org>
>>Enviado: sábado, 10 de diciembre de 2011 12:29
>>Asunto: Re: [osgi-dev] Re: Retrieve bundle's missing dependencies
>>
>>I'm not suggesting that you *use* the Felix Web Console (unless you
>>want to). I'm suggesting that you look at its source code instead
of
>>waiting for someone to answer your question as this particular piece
>>covers similar ground. Just seems like a more productive use of your
>>time.
>>
>>Justin
>>
>>
>>On Sat, Dec 10, 2011 at 10:19 AM, Matias SM
>><elmismocorreo-o...@yahoo.com.ar> wrote:
>>> Thanks for the tip Justin. I haven't looked at it yet, I'm just starting
>>> with OSGi and I'm currently investigating mainly the theory (so to speak).
>>> I will follow your advice and look into Felix's Web Console. However, if the
>>> spec doesn't mention a way to do what I'm looking for, I wonder if there
>>> will be a standard way to do it (I really would prefer not to add a new
>>> dependency to the framework I'm working on).
>>>
>>> Again, many thanks for taking the time to answer
>>> Regards
>>>
>>>
________________________________
>>> De: Justin Edelson <jus...@justinedelson.com>
>>> Para: Matias SM <elmismocorreo-o...@yahoo.com.ar>; OSGi Developer Mail List
>>> <osgi-dev@mail.osgi.org>
>>> Enviado: sábado, 10 de diciembre de 2011 12:00
>>> Asunto: Re: [osgi-dev] Re: Retrieve bundle's missing dependencies
>>>
>>> Matias-
>>> Have you looked at the Felix Web Console? The Bundle tab contains this
>>> exact information. Perhaps you could look at the source code and get
>>> some inspiration.
>>>
>>> BR,
>>> Justin
>>>
>>> On Fri, Dec 9, 2011 at 6:51 PM, Matias SM
>>> <elmismocorreo-o...@yahoo.com.ar> wrote:
>>>> I've reading the OSGi Service Platform Core Specification (Release 4,
>>>> Version 4.3) and I can't find anything about how to get a bundle's
>>>> unsatisfied package imports. The only thing I found about retrieving a
>>>> bundle's related package information is the wiring API, but (as stated in
>>>> the spec) it is only for resolved bundles.
>>>> Maybe I'm reading the wrong part of the spec (also couldn't find anything
>>>> by
>>>> googling it). I would like to know more about how to get the unsatisfied
>>>> package imports (given an installed bundle) because in the framework I'm
>>>> working on, I have some information that may be useful to find the missing
>>>> dependencies (so avoiding the need to depend on something as powerful
as
>>>> OBR
>>>> that would be an overkill).
>>>>
>>>> I will be very grateful for any guidance related to this issue.
>>>> Regards
>>>>
>>>> ________________________________
>>>> De: Matias SM <elmismocorreo-o...@yahoo.com.ar>
>>>> Para: Neil Bartlett <njbartl...@gmail.com>; OSGi Developer Mail List
>>>> <osgi-dev@mail.osgi.org>
>>>> Enviado: jueves, 1 de diciembre de 2011 13:56
>>>> Asunto: Re: [osgi-dev] Re: Retrieve bundle's missing dependencies
>>>>
>>>> Many thanks Neil for your answer!
>>>>
>>>> I will pay a look at OBR as you recommend. Also, you told me
that "the
>>>> core
>>>> can tell you about unsatisfied package imports", may I ask how can I
>>>> accomplish that?
>>>>
>>>> ________________________________
>>>> De: Neil Bartlett <njbartl...@gmail.com>
>>>> Para: Matias SM <elmismocorreo-o...@yahoo.com.ar>; OSGi Developer Mail
>>>> List
>>>> <osgi-dev@mail.osgi.org>
>>>> Enviado: miércoles, 30 de noviembre de 2011 22:03
>>>> Asunto: Re: [osgi-dev] Re: Retrieve bundle's missing dependencies
>>>>
>>>> Hello Matias,
>>>>
>>>> My apologies, somebody should have tried to answer this question much
>>>>
earlier.
>>>>
>>>> Blueprint does not do anything like this. You may want to use it for
>>>> other things, but it's irrelevant for the problem you describe. Nor is
>>>> there really anything in core OSGi... the core can tell you about
>>>> unsatisfied package imports, but you would need a mapping that tells
>>>> you which bundles are available that export those packages and where
>>>> they are.
>>>>
>>>> What you really need is a resolver technology that you can query for a
>>>> complete set of bundles that fulfil your requirement. The technology
>>>> you should be looking at is OBR; there is an implementation in Apache
>>>> Felix (it runs on all the other frameworks also). See the following
>>>> document:
>>>>
>>>> http://felix.apache.org/site/apache-felix-osgi-bundle-repository.html
>>>>
>>>> Note that OBR is currently being standardised by the OSGi Alliance,
>>>> and there is a public preview available of the new OBR specification
>>>> (RFC 112). However until that specification is released, the OBR
>>>> implementation in Felix is IMHO the best available solution for what
>>>> you want.
>>>>
>>>> For completeness I should mention that p2 from Equinox/Eclipse can
>>>> also help with the same kind of problem. However you appear to be
>>>> quite concerned about being lightweight and minimising dependencies --
>>>> a commendable attitude!-- and unfortunately p2 is a much heavier
>>>> dependency than OBR.
>>>>
>>>> Regards,
>>>> Neil
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Thu, Dec 1, 2011 at 12:45 AM, Matias
SM
>>>> <elmismocorreo-o...@yahoo.com.ar> wrote:
>>>>> Anybody has some insight to share about this? Even a RTFM is greatly
>>>>> welcome
>>>>> if I'm told which F. Manual should I read.
>>>>>
>>>>> Maybe there is a better way to do what I need. What I need to do is to
>>>>> "download" the necessaries bundles (dependencies) to resolve a given
>>>>> bundle.
>>>>> My use case is as follows:
>>>>> - I receive a bundle from a stream (network connection)
>>>>> - I need to activate the bundle in the current framework
>>>>> - The received bundle may have some missing dependencies, so I need to
>>>>> find
>>>>> them (here is where my question rise, if I had the name of the "missing"
>>>>> bundles, I might be
able to find them).
>>>>>
>>>>> I'm trying to keep the framework that uses this mechanism as light as
>>>>> possible, that is why I would prefer not to add blueprint as a new
>>>>> requirement.
>>>>>
>>>>> Many thanks in advance for any help you can give me.
>>>>> Regards
>>>>>
>>>>> ________________________________
>>>>> De: "elmismocorreo-o...@yahoo.com.ar" <elmismocorreo-o...@yahoo.com.ar>
>>>>> Para: "osgi-dev@mail.osgi.org" <osgi-dev@mail.osgi.org>
>>>>>
Enviado: miércoles, 9 de noviembre de 2011 18:52
>>>>> Asunto: Retrieve bundle's missing dependencies
>>>>>
>>>>> Hi everybody, I'm _really new_ with OSGi so forgive me if my question is
>>>>> basic or vague.
>>>>> I was looking for a way of getting a bundle's missing dependencies (that
>>>>> keep it installed and not resolved). I did some googling and found that
>>>>> (apparently) it can be done using blueprint [1]. However, I was wondering
>>>>> if
>>>>> it can be done using only OSGi's core.
>>>>> Any piece of advice is very welcome.
>>>>> Regards
>>>>>
>>>>> [1]
>>>>>
>>>>>
>>>>> http://www.osgi.org/javadoc/r4v42/org/osgi/service/blueprint/container/BlueprintEvent.html
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> 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
>>
>>
>>
>_______________________________________________
>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