简体   繁体   中英

How to get a system bundle fragment version at runtime

I've created a system bundle fragment for a host bundle using this:

Fragment-Host: system.bundle;extension:=framework

I would like to know the version of the fragment inside the system bundle activator method. there is way to get that ?

If I use the context parameter of the activator method I can get the system bundle but couldn't find how to get its fragments...

thanks in advance.

Check OSGi Core Spec 5.0 (7.2.x chapter)

  BundleWiring wA = systemBundleContext.getBundle().adapt( BundleWiring.class );
  for ( BundleWire wire : wA.getProvidedWires(HOST_NAMESPACE)) {
    // fragment bundle version
    wire.getRequirerWiring().getResource().getVersion();
  }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM