IBM Support

How to programmatically retrieve your plug-ins' version number

Question & Answer


Question

How can you programmatically retrieve the version number of your plug-ins from the Help > About IBM Rational Software Architect for WebSphere... > Installation Details > Installed Software list in IBM Rational Software Architect?

Cause

You would like to be able to use Java code to get the plug-in information.

Answer

ANSWERS

There are a couple of possible answers to this question:

  • Use org.osgi.framework.BundleContext.getBundles(), for example, from your activator class inside your plugin in order to retrieve all the plug-ins

    OR
  • Use the following code in order to retrieve the plugins by features:
    IBundleGroupProvider[] providers = Platform.getBundleGroupProviders();
  • if (providers != null) {

     for (int i = 0; i < providers.length; ++i) {

      IBundleGroup[] bundleGroups = providers[i].getBundleGroups(); //bundle //group is the same as feature

      for (int j = 0; j < bundleGroups.length; ++j) {


   Bundle[] bundles = bundleGroups[j].getBundles();

       for (int k = 0; k < bundles.length; ++k) {

    System.out.println(bundles[k]);

       }

      }

     }

    }

    NOTE: Each of these two solutions might give different set of plugins, as not all plugins need to be grouped in features.

[{"Product":{"code":"SSYK2S","label":"Rational Software Architect Designer"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Eclipse","Platform":[{"code":"PF033","label":"Windows"}],"Version":"8.5.1;8.5","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}},{"Product":{"code":"SS4JCV","label":"Rational Software Architect for WebSphere Software"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Eclipse","Platform":[{"code":"PF033","label":"Windows"}],"Version":"8.5;8.5.1","Edition":"","Line of Business":{"code":"LOB15","label":"Integration"}}]

Document Information

Modified date:
10 September 2020

UID

swg21625777