com.buglabs.osgi.shell.pub
Class BundleUtils

java.lang.Object
  extended by com.buglabs.osgi.shell.pub.BundleUtils

public class BundleUtils
extends java.lang.Object

A set of utility methods for common functionality.


Constructor Summary
BundleUtils()
           
 
Method Summary
static Bundle findBundle(BundleContext context, long bundleId)
          Search (n) for a bundle with given bundleId
static Bundle findBundle(BundleContext context, java.lang.Object key)
           
static Bundle findBundle(BundleContext context, java.lang.String bundleName)
          Search for Bundle with header "Bundle-Name" as passed bundleName parameter.
static Bundle findBundle(BundleContext context, java.lang.String headerName, java.lang.String headerValue)
          Find bundle with given name/value pair in header.
static java.lang.String getBestName(Bundle bundle)
          Get the best available name for a bundle given it's metadata.
static java.lang.String getHeader(Bundle bundle, java.lang.String headerName)
           
static java.lang.String getStateName(int state)
          Return state label as defined in OSGi spec.
static boolean hasHeader(Bundle bundle, java.lang.String headerName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BundleUtils

public BundleUtils()
Method Detail

findBundle

public static Bundle findBundle(BundleContext context,
                                long bundleId)
Search (n) for a bundle with given bundleId

Parameters:
context -
bundleId -
Returns:
Bundle or null if not found.

findBundle

public static Bundle findBundle(BundleContext context,
                                java.lang.String bundleName)
Search for Bundle with header "Bundle-Name" as passed bundleName parameter.

Parameters:
context -
bundleName -
Returns:
Bundle or null if not found.

findBundle

public static Bundle findBundle(BundleContext context,
                                java.lang.Object key)

findBundle

public static Bundle findBundle(BundleContext context,
                                java.lang.String headerName,
                                java.lang.String headerValue)
Find bundle with given name/value pair in header.

Parameters:
context -
headerName -
headerValue -
Returns:
Bundle or null if not found.

getBestName

public static java.lang.String getBestName(Bundle bundle)
Get the best available name for a bundle given it's metadata.

Parameters:
bundle -
Returns:

hasHeader

public static boolean hasHeader(Bundle bundle,
                                java.lang.String headerName)

getHeader

public static java.lang.String getHeader(Bundle bundle,
                                         java.lang.String headerName)

getStateName

public static java.lang.String getStateName(int state)
Return state label as defined in OSGi spec.

Parameters:
state -
Returns: