If present, there will only be a single instance of this service registered in the framework.
The term exported package (and the corresponding interface ExportedPackage) refers to a package that has actually been exported (as opposed to one that is available for export).
Note that the information about exported packages returned by this service is valid only until the next time refreshPackages is called. If an ExportedPackage becomes stale, (that is, the package it references has been updated or removed as a result of calling PackageAdmin.refreshPackages()), its getName() and getSpecificationVersion() continue to return their old values, isRemovalPending() returns true, and getExportingBundle() and getImportingBundles() return null.
Definition at line 70 of file PackageAdminImpl.java.
Public Member Functions | |
ExportedPackage[] | getExportedPackages (Bundle bundle) |
Gets the packages exported by the specified bundle. | |
ExportedPackage[] | getExportedPackages (String name) |
Gets the exported packages for the specified package name. | |
ExportedPackage | getExportedPackage (String name) |
Gets the ExportedPackage with the specified package name. | |
void | refreshPackages (final Bundle[] bundles) |
Forces the update (replacement) or removal of packages exported by the specified bundles. | |
boolean | resolveBundles (Bundle[] bundles) |
Resolve the specified bundles. | |
RequiredBundle[] | getRequiredBundles (String symbolicName) |
Returns an array of required bundles having the specified symbolic name. | |
Bundle[] | getBundles (String symbolicName, String versionRange) |
Returns the bundles with the specified symbolic name whose bundle version is within the specified version range. | |
Bundle[] | getFragments (Bundle bundle) |
Returns an array of attached fragment bundles for the specified bundle. | |
Bundle[] | getHosts (Bundle bundle) |
Returns an array containing the host bundle to which the specified fragment bundle is attached or null if the specified bundle is not attached to a host or is not a fragment bundle. | |
Bundle | getBundle (Class clazz) |
Returns the bundle from which the specified class is loaded. | |
int | getBundleType (Bundle bundle) |
Returns the special type of the specified bundle. |
ExportedPackage [] org.knopflerfish.framework.PackageAdminImpl.getExportedPackages | ( | Bundle | bundle | ) |
Gets the packages exported by the specified bundle.
bundle | The bundle whose exported packages are to be returned, or null if all the packages currently exported in the framework are to be returned. If the specified bundle is the system bundle (that is, the bundle with id 0), this method returns all the packages on the system classpath whose name does not start with "java.". In an environment where the exhaustive list of packages on the system classpath is not known in advance, this method will return all currently known packages on the system classpath, that is, all packages on the system classpath that contains one or more classes that have been loaded. |
null
if the specified bundle has not exported any packages. Implements org.osgi.service.packageadmin.PackageAdmin.
Definition at line 101 of file PackageAdminImpl.java.
References org.knopflerfish.framework.Framework.bundles, and org.knopflerfish.framework.Bundles.getBundles().
ExportedPackage [] org.knopflerfish.framework.PackageAdminImpl.getExportedPackages | ( | String | name | ) |
Gets the exported packages for the specified package name.
name | The name of the exported packages to be returned. |
null
if no exported packages with the specified name exists. Implements org.osgi.service.packageadmin.PackageAdmin.
Definition at line 131 of file PackageAdminImpl.java.
References org.knopflerfish.framework.Pkg.exporters, org.knopflerfish.framework.Packages.getPkg(), and org.knopflerfish.framework.Framework.packages.
ExportedPackage org.knopflerfish.framework.PackageAdminImpl.getExportedPackage | ( | String | name | ) |
Gets the ExportedPackage with the specified package name.
All exported packages will be checked for the specified name. In an environment where the exhaustive list of packages on the system classpath is not known in advance, this method attempts to see if the named package is on the system classpath. This means that this method may discover an ExportedPackage that was not present in the list returned by getExportedPackages()
.
name | The name of the exported package to be returned. |
null
if no expored package with that name exists. Implements org.osgi.service.packageadmin.PackageAdmin.
Definition at line 166 of file PackageAdminImpl.java.
References org.knopflerfish.framework.Pkg.getBestProvider(), org.knopflerfish.framework.Packages.getPkg(), and org.knopflerfish.framework.Framework.packages.
void org.knopflerfish.framework.PackageAdminImpl.refreshPackages | ( | final Bundle[] | bundles | ) |
Forces the update (replacement) or removal of packages exported by the specified bundles.
Definition at line 184 of file PackageAdminImpl.java.
References org.knopflerfish.framework.Framework.bundles, org.knopflerfish.framework.PermissionOps.callRefreshPackages0(), org.knopflerfish.framework.PermissionOps.checkResolveAdminPerm(), org.knopflerfish.framework.Bundles.getBundles(), org.knopflerfish.framework.Framework.perm, org.knopflerfish.framework.SystemBundle.stop(), and org.knopflerfish.framework.Framework.systemBundle.
boolean org.knopflerfish.framework.PackageAdminImpl.resolveBundles | ( | Bundle[] | bundles | ) |
Resolve 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 null
is 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.
bundles | The bundles to resolve or null to resolve all unresolved bundles installed in the Framework. |
true
if all specified bundles are resolved; SecurityException | If the caller does not have AdminPermission[System Bundle,RESOLVE] and the Java runtime environment supports permissions. |
Implements org.osgi.service.packageadmin.PackageAdmin.
Definition at line 292 of file PackageAdminImpl.java.
References org.knopflerfish.framework.Framework.bundles, org.knopflerfish.framework.PermissionOps.checkResolveAdminPerm(), org.knopflerfish.framework.Bundles.getBundles(), org.knopflerfish.framework.BundleImpl.getUpdatedState(), and org.knopflerfish.framework.Framework.perm.
RequiredBundle [] org.knopflerfish.framework.PackageAdminImpl.getRequiredBundles | ( | String | symbolicName | ) |
Returns an array of required bundles having the specified symbolic name.
If null
is specified, then all required bundles will be returned.
symbolicName | The bundle symbolic name or null for all required bundles. |
null
if no required bundles exist for the specified symbolic name. Implements org.osgi.service.packageadmin.PackageAdmin.
Definition at line 314 of file PackageAdminImpl.java.
References org.knopflerfish.framework.BundleImpl.bpkgs, org.knopflerfish.framework.Framework.bundles, org.knopflerfish.framework.Bundles.getBundles(), org.knopflerfish.framework.BundleImpl.isFragment(), and org.knopflerfish.framework.BundleImpl.state.
Bundle [] org.knopflerfish.framework.PackageAdminImpl.getBundles | ( | String | symbolicName, | |
String | versionRange | |||
) |
Returns the bundles with the specified symbolic name whose bundle version is within the specified version range.
If no bundles are installed that have the specified symbolic name, then null
is returned. If a version range is specified, then only the bundles that have the specified symbolic name and whose bundle versions belong to the specified version range are returned. The returned bundles are ordered by version in descending version order so that the first element of the array contains the bundle with the highest version.
symbolicName | The symbolic name of the desired bundles. | |
versionRange | The version range of the desired bundles, or null if all versions are desired. |
null
if no bundles are found. Implements org.osgi.service.packageadmin.PackageAdmin.
Definition at line 337 of file PackageAdminImpl.java.
References org.knopflerfish.framework.Framework.bundles, and org.knopflerfish.framework.Bundles.getBundles().
Returns an array of attached fragment bundles for the specified bundle.
If the specified bundle is a fragment then null
is returned. If no fragments are attached to the specified bundle then null
is returned.
This method does not attempt to resolve the specified bundle. If the specified bundle is not resolved then null
is returned.
bundle | The bundle whose attached fragment bundles are to be returned. |
null
if the bundle does not have any attached fragment bundles or the bundle is not resolved. Implements org.osgi.service.packageadmin.PackageAdmin.
Definition at line 355 of file PackageAdminImpl.java.
References org.knopflerfish.framework.BundleImpl.fragments, org.knopflerfish.framework.BundleImpl.isFragment(), and org.knopflerfish.framework.BundleImpl.isFragmentHost().
Returns an array containing the host bundle to which the specified fragment bundle is attached or null
if the specified bundle is not attached to a host or is not a fragment bundle.
A fragment may only be attached to a single host bundle.
bundle | The bundle whose host bundle is to be returned. |
null
if the bundle does not have a host bundle. Implements org.osgi.service.packageadmin.PackageAdmin.
Definition at line 374 of file PackageAdminImpl.java.
References org.knopflerfish.framework.BundleImpl.getFragmentHost(), org.knopflerfish.framework.BundleImpl.isAttached(), and org.knopflerfish.framework.BundleImpl.isFragment().
Bundle org.knopflerfish.framework.PackageAdminImpl.getBundle | ( | Class | clazz | ) |
Returns the bundle from which the specified class is loaded.
The class loader of the returned bundle must have been used to load the specified class. If the class was not loaded by a bundle class loader then null
is returned.
clazz | The class object from which to locate the bundle. |
null
if the class was not loaded by a bundle class loader. Implements org.osgi.service.packageadmin.PackageAdmin.
Definition at line 389 of file PackageAdminImpl.java.
int org.knopflerfish.framework.PackageAdminImpl.getBundleType | ( | Bundle | bundle | ) |
Returns 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.
bundle | The bundle for which to return the special type. |
Implements org.osgi.service.packageadmin.PackageAdmin.
Definition at line 399 of file PackageAdminImpl.java.
References org.osgi.service.packageadmin.PackageAdmin.BUNDLE_TYPE_FRAGMENT, org.knopflerfish.framework.BundleImpl.isExtension(), and org.knopflerfish.framework.BundleImpl.isFragment().