Package org.apache.felix.framework
Class PackageAdminImpl
java.lang.Object
org.apache.felix.framework.PackageAdminImpl
- All Implemented Interfaces:
 PackageAdmin
- 
Field Summary
Fields inherited from interface org.osgi.service.packageadmin.PackageAdmin
BUNDLE_TYPE_FRAGMENT - 
Method Summary
Modifier and TypeMethodDescriptionReturns the bundle associated with this class if the class was loaded from a bundle, otherwise returns null.Bundle[]getBundles(String symbolicName, String versionRange) Returns all bundles that have a specified symbolic name and whose version is in the specified version range.intgetBundleType(Bundle bundle) Returns the special type of the specified bundle.getExportedPackage(String name) Returns the exported package associated with the specified package name.getExportedPackages(String name) Gets the exported packages for the specified package name.getExportedPackages(Bundle bundle) Returns the packages exported by the specified bundle.Bundle[]getFragments(Bundle bundle) Returns an array of attached fragment bundles for the specified bundle.Bundle[]Returns the host bundles to which the specified fragment bundle is attached.getRequiredBundles(String symbolicName) Returns an array of required bundles having the specified symbolic name.voidrefreshPackages(Bundle[] bundles) The OSGi specification states that refreshing packages is asynchronous; this method simply notifies the package admin thread to do a refresh.booleanresolveBundles(Bundle[] bundles) Resolve the specified bundles. 
- 
Method Details
- 
getBundle
Returns the bundle associated with this class if the class was loaded from a bundle, otherwise returns null.- Specified by:
 getBundlein interfacePackageAdmin- Parameters:
 clazz- the class for which to determine its associated bundle.- Returns:
 - the bundle associated with the specified class, otherwise null.
 
 - 
getBundles
Returns all bundles that have a specified symbolic name and whose version is in the specified version range. If no version range is specified, then all bundles with the specified symbolic name are returned. The array is sorted in descending version order.- Specified by:
 getBundlesin interfacePackageAdmin- Parameters:
 symbolicName- the target symbolic name.versionRange- the target version range.- Returns:
 - an array of matching bundles sorted in descending version order.
 - See Also:
 
 - 
getBundleType
Description copied from interface:PackageAdminReturns the special type of the specified bundle. The bundle type values are: A bundle may be more than one type at a time. A type code is used to identify the bundle type for future extendability.If a bundle is not one or more of the defined types then 0x00000000 is returned.
- Specified by:
 getBundleTypein interfacePackageAdmin- Parameters:
 bundle- The bundle for which to return the special type.- Returns:
 - The special type of the bundle.
 
 - 
getExportedPackage
Returns the exported package associated with the specified package name. If there are more than one version of the package being exported, then the highest version is returned.- Specified by:
 getExportedPackagein interfacePackageAdmin- Parameters:
 name- the name of the exported package to find.- Returns:
 - the exported package or null if no matching package was found.
 - See Also:
 
 - 
getExportedPackages
Description copied from interface:PackageAdminGets the exported packages for the specified package name.- Specified by:
 getExportedPackagesin interfacePackageAdmin- Parameters:
 name- The name of the exported packages to be returned.- Returns:
 - An array of the exported packages, or 
nullif no exported packages with the specified name exists. 
 - 
getExportedPackages
Returns the packages exported by the specified bundle.- Specified by:
 getExportedPackagesin interfacePackageAdmin- Parameters:
 bundle- the bundle whose exported packages are to be returned.- Returns:
 - an array of packages exported by the bundle or null if the bundle does not export any packages.
 
 - 
getFragments
Description copied from interface:PackageAdminReturns an array of attached fragment bundles for the specified bundle. If the specified bundle is a fragment thennullis returned. If no fragments are attached to the specified bundle thennullis returned.This method does not attempt to resolve the specified bundle. If the specified bundle is not resolved then
nullis returned.- Specified by:
 getFragmentsin interfacePackageAdmin- Parameters:
 bundle- The bundle whose attached fragment bundles are to be returned.- Returns:
 - An array of fragment bundles or 
nullif the bundle does not have any attached fragment bundles or the bundle is not resolved. 
 - 
getHosts
Description copied from interface:PackageAdminReturns the host bundles to which the specified fragment bundle is attached.- Specified by:
 getHostsin interfacePackageAdmin- Parameters:
 bundle- The fragment bundle whose host bundles are to be returned.- Returns:
 - An array containing the host bundles to which the specified
         fragment is attached or 
nullif the specified bundle is not a fragment or is not attached to any host bundles. 
 - 
getRequiredBundles
Description copied from interface:PackageAdminReturns an array of required bundles having the specified symbolic name.If
nullis specified, then all required bundles will be returned.- Specified by:
 getRequiredBundlesin interfacePackageAdmin- Parameters:
 symbolicName- The bundle symbolic name ornullfor all required bundles.- Returns:
 - An array of required bundles or 
nullif no required bundles exist for the specified symbolic name. 
 - 
refreshPackages
The OSGi specification states that refreshing packages is asynchronous; this method simply notifies the package admin thread to do a refresh.- Specified by:
 refreshPackagesin interfacePackageAdmin- Parameters:
 bundles- array of bundles to refresh or null to refresh any bundles in need of refreshing.- Throws:
 SecurityException- If the caller does not haveAdminPermission[System Bundle,RESOLVE]and the Java runtime environment supports permissions.
 - 
resolveBundles
Description copied from interface:PackageAdminResolve the specified bundles. The Framework must attempt to resolve the specified bundles that are unresolved. Additional bundles that are not included in the specified bundles may be resolved as a result of calling this method. A permissible implementation of this method is to attempt to resolve all unresolved bundles installed in the framework.If
nullis specified then the Framework will attempt to resolve all unresolved bundles. This method must not cause any bundle to be refreshed, stopped, or started. This method will not return until the operation has completed.- Specified by:
 resolveBundlesin interfacePackageAdmin- Parameters:
 bundles- The bundles to resolve ornullto resolve all unresolved bundles installed in the Framework.- Returns:
 trueif all specified bundles are resolved;
 
 -