Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Reverse bundle resolving
Reverse bundle resolving [message #92142] Tue, 17 July 2007 11:23 Go to next message
Eclipse UserFriend
Originally posted by: krzysztofHMMMMdaniel.gmail.com

Hello

I have a class name. How can I determine in which bundle it is declared?

TIA

Chris
Re: Reverse bundle resolving [message #92174 is a reply to message #92142] Tue, 17 July 2007 13:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: skaegi.sympatico.ca

Hi Chris,

PackageAdmin does this.

http://www2.osgi.org/javadoc/r4/org/osgi/service/packageadmi n/PackageAdmin.html#getBundle(java.lang.Class)

HTH
-Simon

"Krzysztof Daniel" <krzysztofHMMMMdaniel@gmail.com> wrote in message
news:f7i8rc$uau$1@build.eclipse.org...
> Hello
>
> I have a class name. How can I determine in which bundle it is declared?
>
> TIA
>
> Chris
Re: Reverse bundle resolving [message #92186 is a reply to message #92174] Tue, 17 July 2007 13:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: krzysztofHMMMMdaniel.gmail.com

Hi Simon,

Thanks for interest.

I think I have not made it clear enough - I have class *name*, which is
String type. And PackageAdmin takes Class as a paremeter...


--
Chris
Re: Reverse bundle resolving [message #92199 is a reply to message #92186] Tue, 17 July 2007 14:39 Go to previous messageGo to next message
Simon Kaegi is currently offline Simon KaegiFriend
Messages: 381
Registered: July 2009
Senior Member
Yep -- misunderstood what you were looking for.
You can work backwards from the classes package name to find the set of
bundles that export them.
Try PackageAdmin's --
public ExportedPackage[] getExportedPackages(Bundle bundle)

-Simon

"Krzysztof Daniel" <krzysztofHMMMMdaniel@gmail.com> wrote in message
news:f7ihc9$uau$2@build.eclipse.org...
> Hi Simon,
>
> Thanks for interest.
>
> I think I have not made it clear enough - I have class *name*, which is
> String type. And PackageAdmin takes Class as a paremeter...
>
>
> --
> Chris
Re: Reverse bundle resolving [message #92214 is a reply to message #92199] Tue, 17 July 2007 14:41 Go to previous messageGo to next message
Simon Kaegi is currently offline Simon KaegiFriend
Messages: 381
Registered: July 2009
Senior Member
I meant...
public ExportedPackage[] getExportedPackages(java.lang.String name)Gets the
exported packages for the specified package name.
"Simon Kaegi" <simon_kaegi@ca.ibm.com> wrote in message
news:f7ikaj$1li$1@build.eclipse.org...
> Yep -- misunderstood what you were looking for.
> You can work backwards from the classes package name to find the set of
> bundles that export them.
> Try PackageAdmin's --
> public ExportedPackage[] getExportedPackages(Bundle bundle)
>
> -Simon
>
> "Krzysztof Daniel" <krzysztofHMMMMdaniel@gmail.com> wrote in message
> news:f7ihc9$uau$2@build.eclipse.org...
>> Hi Simon,
>>
>> Thanks for interest.
>>
>> I think I have not made it clear enough - I have class *name*, which is
>> String type. And PackageAdmin takes Class as a paremeter...
>>
>>
>> --
>> Chris
>
>
Re: Reverse bundle resolving [message #92231 is a reply to message #92214] Tue, 17 July 2007 14:46 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: krzysztofHMMMMdaniel.gmail.com

Simon,

exported packages are packages contained by bundle, or defined as exported?

--
Chris
Re: Reverse bundle resolving [message #92244 is a reply to message #92231] Tue, 17 July 2007 14:54 Go to previous messageGo to next message
Simon Kaegi is currently offline Simon KaegiFriend
Messages: 381
Registered: July 2009
Senior Member
Just those defined as exported. ;)
I think you'll have a hard time getting at the other packages -- no metadata
to be had.

"Krzysztof Daniel" <krzysztofHMMMMdaniel@gmail.com> wrote in message
news:f7ikp6$uau$3@build.eclipse.org...
> Simon,
>
> exported packages are packages contained by bundle, or defined as
> exported?
>
> --
> Chris
Re: Reverse bundle resolving [message #92259 is a reply to message #92186] Tue, 17 July 2007 15:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alex_blewitt.yahoo.com

You can't. You get a .class, and then it figures it out. If you can't get a class, you don't have a dependency on that bundle.

Alex.
Re: Reverse bundle resolving [message #92274 is a reply to message #92244] Tue, 17 July 2007 15:54 Go to previous message
Danail Nachev is currently offline Danail NachevFriend
Messages: 36
Registered: July 2009
Member
There is always the brute force way:

You get all installed bundles and use Bundle.loadClass() to find the
class. Then use PackageAdmin.getBundle(Class) to find the bundle.

So, Daniel, what exactly are you trying to accomplish?

Simon Kaegi wrote:
> Just those defined as exported. ;)
> I think you'll have a hard time getting at the other packages -- no metadata
> to be had.
>
> "Krzysztof Daniel" <krzysztofHMMMMdaniel@gmail.com> wrote in message
> news:f7ikp6$uau$3@build.eclipse.org...
>> Simon,
>>
>> exported packages are packages contained by bundle, or defined as
>> exported?
>>
>> --
>> Chris
>
>
Previous Topic:Re: Dynamic extensions in 3.2 with custom class loader
Next Topic:jetty 6 osgi support
Goto Forum:
  


Current Time: Thu Apr 25 15:35:57 GMT 2024

Powered by FUDForum. Page generated in 0.03509 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top