public class FrameworkUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
arrayContains(Object[] array,
Object value) |
static List<String> |
extractHeaderDeclaration(String headerStatement) |
static long[] |
getBundleDependencies(org.osgi.framework.BundleContext localBundleContext,
org.osgi.framework.Bundle bundle,
org.osgi.service.packageadmin.PackageAdmin packageAdmin)
Returns an array of ids of bundles the given bundle depends on
|
static String[] |
getBundleExportedPackages(org.osgi.framework.Bundle bundle,
org.osgi.service.packageadmin.PackageAdmin packageAdmin)
Returns the packages exported by the specified bundle
|
static long[] |
getBundleIds(org.osgi.framework.Bundle[] bundles)
Returns an array of bundleIds
|
static long[] |
getBundleIds(List<org.osgi.framework.Bundle> bundles) |
static String[] |
getBundleImportedPackages(org.osgi.framework.BundleContext localBundleContext,
org.osgi.framework.Bundle bundle,
org.osgi.service.packageadmin.PackageAdmin packageAdmin)
Returns the resolved package imports for the given bundle
|
static String |
getBundleState(org.osgi.framework.Bundle bundle)
Returns a String representation of the bundles state
|
static long[] |
getDependentBundles(org.osgi.framework.Bundle bundle,
org.osgi.service.packageadmin.PackageAdmin packageAdmin)
Returns an array of ids of bundles that depend on the given bundle
|
static long[] |
getFragmentIds(org.osgi.framework.Bundle bundle,
org.osgi.service.packageadmin.PackageAdmin packageAdmin)
Returns the bundle ids of any resolved fragments
|
static long[] |
getHostIds(org.osgi.framework.Bundle fragment,
org.osgi.service.packageadmin.PackageAdmin packageAdmin)
Returns the bundle ids of any resolved hosts
|
static long[] |
getRegisteredServiceIds(org.osgi.framework.Bundle bundle)
Returns the service.id values for services registered by the given bundle
|
static long[] |
getServiceIds(org.osgi.framework.ServiceReference[] serviceReferences)
Returns an array of service.id values
|
static long[] |
getServicesInUseByBundle(org.osgi.framework.Bundle bundle)
Returns the service.id values of services being used by the given bundle
|
static boolean |
isBundlePendingRemoval(org.osgi.framework.Bundle bundle,
org.osgi.service.packageadmin.PackageAdmin packageAdmin)
Returns the status of pending removal
|
static boolean |
isBundleRequiredByOthers(org.osgi.framework.Bundle bundle,
org.osgi.service.packageadmin.PackageAdmin packageAdmin)
Checks if the given bundle is currently required by other bundles
|
static org.osgi.framework.Bundle |
resolveBundle(org.osgi.framework.BundleContext bundleContext,
long bundleId)
Returns the Bundle object for a given id
|
static org.osgi.framework.ServiceReference |
resolveService(org.osgi.framework.BundleContext bundleContext,
long serviceId)
Returns the ServiceReference object with matching service.id
|
public static org.osgi.framework.Bundle resolveBundle(org.osgi.framework.BundleContext bundleContext,
long bundleId)
throws IOException
bundleContext - bundleId - IllegalArgumentException - if no Bundle is found with matching bundleIdIOExceptionpublic static long[] getBundleIds(org.osgi.framework.Bundle[] bundles)
bundles - array of Bundle objectspublic static long[] getBundleIds(List<org.osgi.framework.Bundle> bundles)
public static org.osgi.framework.ServiceReference resolveService(org.osgi.framework.BundleContext bundleContext,
long serviceId)
throws IOException
bundleContext - serviceId - IllegalArgumentException - if bundleContext is nullIOException - if no service is found with the given idpublic static long[] getServiceIds(org.osgi.framework.ServiceReference[] serviceReferences)
serviceReferences - array of ServiceReference objectspublic static String[] getBundleExportedPackages(org.osgi.framework.Bundle bundle, org.osgi.service.packageadmin.PackageAdmin packageAdmin) throws IllegalArgumentException
bundle - packageAdmin - IllegalArgumentException - if bundle or packageAdmin are nullpublic static long[] getFragmentIds(org.osgi.framework.Bundle bundle,
org.osgi.service.packageadmin.PackageAdmin packageAdmin)
throws IllegalArgumentException
bundle - packageAdmin - IllegalArgumentException - if bundle or packageAdmin are nullpublic static long[] getHostIds(org.osgi.framework.Bundle fragment,
org.osgi.service.packageadmin.PackageAdmin packageAdmin)
throws IllegalArgumentException
fragment - packageAdmin - IllegalArgumentException - if fragment or packageAdmin are nullpublic static String[] getBundleImportedPackages(org.osgi.framework.BundleContext localBundleContext, org.osgi.framework.Bundle bundle, org.osgi.service.packageadmin.PackageAdmin packageAdmin) throws IllegalArgumentException
localBundleContext - BundleContext object of this bundle/callerbundle - target Bundle object to query imported packages forpackageAdmin - IllegalArgumentException - if fragment or packageAdmin are nullpublic static long[] getRegisteredServiceIds(org.osgi.framework.Bundle bundle)
throws IllegalArgumentException,
IllegalStateException
bundle - IllegalArgumentException - if bundle is nullIlleglStateException - if bundle has been uninstalledIllegalStateExceptionpublic static long[] getServicesInUseByBundle(org.osgi.framework.Bundle bundle)
throws IllegalArgumentException,
IllegalStateException
bundle - IllegalArgumentException - if bundle is nullIlleglStateException - if bundle has been uninstalledIllegalStateExceptionpublic static boolean isBundlePendingRemoval(org.osgi.framework.Bundle bundle,
org.osgi.service.packageadmin.PackageAdmin packageAdmin)
throws IllegalArgumentException
bundle - IllegalArgumentException - if bundle or packageAdmin are nullpublic static boolean isBundleRequiredByOthers(org.osgi.framework.Bundle bundle,
org.osgi.service.packageadmin.PackageAdmin packageAdmin)
throws IllegalArgumentException
bundle - packageAdmin - IllegalArgumentException - if bundle or packageAdmin are nullpublic static long[] getBundleDependencies(org.osgi.framework.BundleContext localBundleContext,
org.osgi.framework.Bundle bundle,
org.osgi.service.packageadmin.PackageAdmin packageAdmin)
throws IllegalArgumentException
localBundleContext - BundleContext object of this bundle/callerbundle - target Bundle object to query dependencies forpackageAdmin - IllegalArgumentException - if bundle or packageAdmin are nullpublic static long[] getDependentBundles(org.osgi.framework.Bundle bundle,
org.osgi.service.packageadmin.PackageAdmin packageAdmin)
throws IllegalArgumentException
bundle - packageAdmin - IllegalArgumentException - if bundle or packageAdmin are nullpublic static String getBundleState(org.osgi.framework.Bundle bundle)
bundle - Copyright © 2009-2015 The Apache Software Foundation. All Rights Reserved.