You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Juan <ju...@iavante.es> on 2009/06/25 17:58:50 UTC

Get a List of installed Bundles

Hello everyone.

I'm trying to get a list of installed bundles in sling.  I saw something 
like the

class BootstrapInstaller implementing the BundleActivator class.

I think that could be something like the treak with the

final File dataFile = context.getDataFile("bootstrapinstaller.ser");



I saw too something pseudocode like the installing bundle:

String startLevelList = bundleContext.getProperty( "sling.install.bundles" );

for ( String startLevel: startLevelList ) {

    String bundleList = bundleContext.getProperty( "sling.install." + startLevel );

    for ( Bundle bundle: bundleList )  {

        if ( ! isInstalled( bundle ) ) {

        }

    }

}

Any Ideas or clew about the right way to start?


Thankyou.

Re: Get a List of installed Bundles

Posted by Juan José Vázquez Delgado <ju...@gmail.com>.
Hi,

> I'm trying to get a list of installed bundles in sling.

Bundles are installed in the OSGi container, really.

You can get the list of bundles with something like this:

for(Bundle b : bundleContext.getBundles() ) {
            logger.info( "Bundle " + b.getBundleId() + " : " +
b.getSymbolicName() );
}

where bundleContext is obviously the Bundle Context.

Regards,

Juanjo.