org.springframework.osgi.util
Class OsgiBundleUtils

java.lang.Object
  extended by org.springframework.osgi.util.OsgiBundleUtils

public abstract class OsgiBundleUtils
extends Object

Utility class for OSGi Bundles.

Author:
Adrian Colyer, Costin Leau

Constructor Summary
OsgiBundleUtils()
           
 
Method Summary
static Bundle findBundleBySymbolicName(BundleContext bundleContext, String symbolicName)
           
static BundleContext getBundleContext(Bundle bundle)
          Return the underlying BundleContext for the given Bundle.
static Version getBundleVersion(Bundle bundle)
           
static Version getHeaderAsVersion(Bundle bundle, String header)
          Return the version for a given bundle manifest header.
static boolean isBundleActive(Bundle bundle)
          Return true if the given bundle is active or not.
static boolean isBundleResolved(Bundle bundle)
           
static boolean isFragment(Bundle bundle)
           
static boolean isSystemBundle(Bundle bundle)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OsgiBundleUtils

public OsgiBundleUtils()
Method Detail

getBundleContext

public static BundleContext getBundleContext(Bundle bundle)
Return the underlying BundleContext for the given Bundle. This uses reflection and highly dependent of the OSGi implementation. Should be removed if OSGi 4.1 is being used.

Parameters:
bundle -
Returns:

isBundleActive

public static boolean isBundleActive(Bundle bundle)
Return true if the given bundle is active or not.

Parameters:
bundle -
Returns:

isBundleResolved

public static boolean isBundleResolved(Bundle bundle)

isFragment

public static boolean isFragment(Bundle bundle)

isSystemBundle

public static boolean isSystemBundle(Bundle bundle)

getBundleVersion

public static Version getBundleVersion(Bundle bundle)

findBundleBySymbolicName

public static Bundle findBundleBySymbolicName(BundleContext bundleContext,
                                              String symbolicName)

getHeaderAsVersion

public static Version getHeaderAsVersion(Bundle bundle,
                                         String header)
Return the version for a given bundle manifest header.

Parameters:
bundle - OSGi bundle
header - bundle manifest header
Returns:
the header value as a Version.
Throws:
IllegalArgumentException - if an illegal String/number if used for constructing the version.


Copyright © 2006-2007 Spring Framework. All Rights Reserved.