List<BundleRequirement> bundleRequirements =
bundleWiring.getRequirements("osgi.wiring.package");
for (BundleRequirement bundleRequirement : bundleRequirements) {
String resolution = bundleRequirement.getDirectives().get("resolution");
// Check the value of resolution
}
Please note that I wrote it without an IDE from mind so it might not work
as is. However, the solution should be very similar.
*Zsoldos Balázs*
Rendszertervező | Software architect
+36 70 594 9234 | [email protected]
*EverIT Kft.*
1137 Budapest, Katona József utca 17. III. em. 2.
http://www.everit.biz I [email protected]
Ezen üzenet és annak bármely csatolt anyaga bizalmas, jogi védelem alatt
áll, a nyilvános közléstől védett. Az üzenetet kizárólag a címzett, illetve
az általa meghatalmazottak használhatják fel. Ha Ön nem az üzenet
címzettje, úgy kérjük, hogy telefonon, vagy e-mail-ben értesítse erről az
üzenet küldőjét és törölje az üzenetet, valamint annak összes csatolt
mellékletét a rendszeréből. Ha Ön nem az üzenet címzettje, abban az esetben
tilos az üzenetet vagy annak bármely csatolt mellékletét lemásolnia,
elmentenie, az üzenet tartalmát bárkivel közölnie vagy azzal visszaélnie.
This message and any attachment are confidential and are legally
privileged. It is intended solely for the use of the individual or entity
to whom it is addressed and others authorised to receive it. If you are not
the intended recipient, please telephone or email the sender and delete
this message and any attachment from your system. Please note that any
dissemination, distribution, copying or use of or reliance upon the
information contained in and transmitted with this e-mail by or to anyone
other than the recipient designated above by the sender is unauthorised and
strictly prohibited.
On Wed, Nov 5, 2014 at 3:54 PM, Gilles, Romain <[email protected]>
wrote:
> Hi all,
>
> I have a look to the Bundle Wiring API Specification of osgi 5 and I found
> easily how to get the bundle imported by a bundle A. But for me it is not
> obvious how I can get the resolution attribute of an import package
> requirement.
>
> More formally I want to know if my import package is optional or not.
>
>
>
>
>
> Here is the code from the spec how to Finding the Imported Packages:
>
> void printImports( Bundle A ) {
>
> BundleWiring wA = A.adapt( BundleWiring.class );
>
> for ( BundleWire wire : wA.getRequiredWires(PACKAGE_NAMESPACE)) {
>
> String pack = (String)
> wire.getCapability().getAttributes().get(PACKAGE_NAMESPACE);
>
> Bundle bundle = wire.getProviderWiring().getBundle());
>
> System.out.println(pack + " - " + bundle.getLocation());
>
> }
>
> }
>
> It just work perfectly for the first part but I don’t know how to get the
> resolution attribute?
>
>
>
> Could you help me?
>
>
>
> Thanks in advance,
>
>
>
> Romain.
> "Misys" is the trade name of the Misys group of companies. This email and
> any attachments have been scanned for known viruses using multiple
> scanners. This email message is intended for the named recipient only. It
> may be privileged and/or confidential. If you are not the named recipient
> of this email please notify us immediately and do not copy it or use it for
> any purpose, nor disclose its contents to any other person. This email does
> not constitute the commencement of legal relations between you and Misys.
> Please refer to the executed contract between you and the relevant member
> of the Misys group for the identity of the contracting party with which you
> are dealing.
>
> _______________________________________________
> OSGi Developer Mail List
> [email protected]
> https://mail.osgi.org/mailman/listinfo/osgi-dev
>
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev