Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.gemini.blueprint.util
Class OsgiBundleUtils

    java.lang.Object
      org.eclipse.gemini.blueprint.util.OsgiBundleUtils

    public abstract class OsgiBundleUtils

extends Object

Utility class for OSGi `Bundle`s. Provides convenience methods for interacting with a Bundle object.

Author:
  Adrian Colyer, Costin Leau
See Also:
  `OsgiStringUtils`

Constructor Summary
`OsgiBundleUtils()`

Method Summary
`static org.osgi.framework.Bundle` | `findBundleBySymbolicName(org.osgi.framework.BundleContext bundleContext, String symbolicName)` Finds an install bundle based by its symbolic name.
`static org.osgi.framework.BundleContext` | `getBundleContext(org.osgi.framework.Bundle bundle)` Returns the underlying BundleContext for the given Bundle.
`static org.osgi.framework.Version` | `getBundleVersion(org.osgi.framework.Bundle bundle)` Returns the given bundle version.
`static org.osgi.framework.Version` | `getHeaderAsVersion(org.osgi.framework.Bundle bundle, String header)` Returns the version for a given bundle manifest header.
`static boolean` | `isBundleActive(org.osgi.framework.Bundle bundle)` Indicates if the given bundle is active or not.
`static boolean` | `isBundleLazyActivated(org.osgi.framework.Bundle bundle)` Indicates if the given bundle is lazily activated or not.
`static boolean` | `isBundleResolved(org.osgi.framework.Bundle bundle)` Indicates if the given bundle is resolved or not.
`static boolean` | `isFragment(org.osgi.framework.Bundle bundle)` Indicates if the given bundle is a fragment or not.
`static boolean` | `isSystemBundle(org.osgi.framework.Bundle bundle)` Indicates if the given bundle is the system bundle or not.

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 org.osgi.framework.BundleContext getBundleContext(org.osgi.framework.Bundle bundle)

  Returns the underlying BundleContext for the given Bundle. This uses reflection and highly dependent of the OSGi implementation. Should not be used if OSGi 4.1 is being used.

  Parameters:
    `bundle` - OSGi bundle
  Returns:
    the bundle context for this bundle

### isBundleActive

    public static boolean isBundleActive(org.osgi.framework.Bundle bundle)

  Indicates if the given bundle is active or not.

  Parameters:
    `bundle` - OSGi bundle
  Returns:
    true if the given bundle is active, false otherwise
  See Also:
    `Bundle.ACTIVE`

### isBundleResolved

    public static boolean isBundleResolved(org.osgi.framework.Bundle bundle)

  Indicates if the given bundle is resolved or not.

  Parameters:
    `bundle` - OSGi bundle
  Returns:
    true if the given bundle is resolved, false otherwise
  See Also:
    `Bundle.RESOLVED`

### isBundleLazyActivated

    public static boolean isBundleLazyActivated(org.osgi.framework.Bundle bundle)

  Indicates if the given bundle is lazily activated or not. That is, the bundle has a lazy activation policy and a STARTING state. Bundles that have been lazily started but have been activated will return false.

  On OSGi R4.0 platforms, this method will always return false.

  Parameters:
    `bundle` - OSGi bundle
  Returns:
    true if the bundle is lazily activated, false otherwise.

### isFragment

    public static boolean isFragment(org.osgi.framework.Bundle bundle)

  Indicates if the given bundle is a fragment or not.

  Parameters:
    `bundle` - OSGi bundle
  Returns:
    true if the given bundle is a fragment, false otherwise
  See Also:
    `Constants.FRAGMENT_HOST`

### isSystemBundle

    public static boolean isSystemBundle(org.osgi.framework.Bundle bundle)

  Indicates if the given bundle is the system bundle or not.

  Parameters:
    `bundle` - OSGi bundle
  Returns:
    true if the given bundle is a fragment, false otherwise

### getBundleVersion

    public static org.osgi.framework.Version getBundleVersion(org.osgi.framework.Bundle bundle)

  Returns the given bundle version.

  Parameters:
    `bundle` - OSGi bundle
  Returns:
    bundle version
  See Also:
    `Constants.BUNDLE_VERSION`

### findBundleBySymbolicName

    public static org.osgi.framework.Bundle findBundleBySymbolicName(org.osgi.framework.BundleContext bundleContext,
                                                                     String symbolicName)

  Finds an install bundle based by its symbolic name.

  Parameters:
    `bundleContext` - OSGi bundle context
    `symbolicName` - bundle symbolic name
  Returns:
    bundle matching the symbolic name (`null` if none is found)

### getHeaderAsVersion

    public static org.osgi.framework.Version getHeaderAsVersion(org.osgi.framework.Bundle bundle,
                                                                String header)

  Returns the version for a given bundle manifest header.

  Parameters:
    `bundle` - OSGi bundle
    `header` - bundle manifest header
  Returns:
    the header value

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006-2012. All Rights Reserved.