I needed to load the class first, because I only know its name, package and version. The RSA would load the class and it would ask my bundlecontext, to do it for him... Dynamic-ImportPackage did the trick here. I would prefere to establish a new bundle wiring on the fly, because I would know what package in what version I would need.

Am 12/11/2018 um 14:46 schrieb Thomas Watson:
Can you explain why you need to know the exporter in this case?  It sounds like you have to be using reflection to call the service, in which case I would not think the wiring mattered.  If you need to know exactly the exporting bundle of the API then one approach would be to get the service object and interrogate its class/interface hierarchy until you find the API class name you are looking for and then use FrameworkUtil.getBundle(Class) method.

Tom

    ----- Original message -----
    From: "Jürgen Albert via osgi-dev" <osgi-dev@mail.osgi.org>
    Sent by: osgi-dev-boun...@mail.osgi.org
    To: osgi-dev@mail.osgi.org
    Cc:
    Subject: [osgi-dev] Get Bundle for package and version
    Date: Mon, Nov 12, 2018 6:58 AM
    Hi,

    I have a whiteboard, that needs to consume a remote service.
    Neither the
    RSA that registers the service proxy nor my whiteboard that needs to
    work with the interface has a wiring to the API Bundle. What the RSA
    does tell me, is the packages and the versions of the API Interfaces.
    Now I'm looking for a way to ge the appropriate bundle wiring. I
    know, I
    can iterate over all available Bundles, and look if one exports the
    package in the given version, but AFAIK I can't be sure if this is the
    right package, in case it was offered by multiple bundles.

    What would be the right approach here?

    Thx,

    Jürgen.

    --
    Jürgen Albert
    Geschäftsführer

    Data In Motion Consulting GmbH

    Kahlaische Str. 4
    07745 Jena

    Mobil:  0157-72521634
    E-Mail: j.alb...@datainmotion.de
    Web: www.datainmotion.de

    XING: https://www.xing.com/profile/Juergen_Albert5

    Rechtliches

    Jena HBR 513025

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



--
Jürgen Albert
Geschäftsführer

Data In Motion Consulting GmbH

Kahlaische Str. 4
07745 Jena

Mobil:  0157-72521634
E-Mail: j.alb...@datainmotion.de
Web: www.datainmotion.de

XING:   https://www.xing.com/profile/Juergen_Albert5

Rechtliches

Jena HBR 513025

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

Reply via email to