Interface PackageAdmin
-
public interface PackageAdminDeprecated.This service has been replaced by theorg.osgi.framework.wiringpackage.Framework service which allows bundle programmers to inspect the package wiring state of bundles in the Framework as well as other functions related to the class loader network among bundles.If present, there will only be a single instance of this service registered with the Framework.
- See Also:
ExportedPackage,RequiredBundle
-
-
Field Summary
Fields Modifier and Type Field Description static intBUNDLE_TYPE_FRAGMENTDeprecated.Bundle type indicating the bundle is a fragment bundle.
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description BundlegetBundle(java.lang.Class<?> clazz)Deprecated.Returns the bundle from which the specified class is loaded.Bundle[]getBundles(java.lang.String symbolicName, java.lang.String versionRange)Deprecated.Returns the bundles with the specified symbolic name whose bundle version is within the specified version range.intgetBundleType(Bundle bundle)Deprecated.Returns the special type of the specified bundle.ExportedPackagegetExportedPackage(java.lang.String name)Deprecated.ExportedPackage[]getExportedPackages(java.lang.String name)Deprecated.ExportedPackage[]getExportedPackages(Bundle bundle)Deprecated.Bundle[]getFragments(Bundle bundle)Deprecated.Returns an array of attached fragment bundles for the specified bundle.Bundle[]getHosts(Bundle bundle)Deprecated.Returns the host bundles to which the specified fragment bundle is attached.RequiredBundle[]getRequiredBundles(java.lang.String symbolicName)Deprecated.voidrefreshPackages(Bundle[] bundles)Deprecated.Forces the update (replacement) or removal of packages exported by the specified bundles.booleanresolveBundles(Bundle[] bundles)Deprecated.Resolve the specified bundles.
-
-
-
Field Detail
-
BUNDLE_TYPE_FRAGMENT
static final int BUNDLE_TYPE_FRAGMENT
Deprecated.Bundle type indicating the bundle is a fragment bundle.The value of
BUNDLE_TYPE_FRAGMENTis 0x00000001.- Since:
- 1.2
- See Also:
- Constant Field Values
-
-
Method Detail
-
getExportedPackages
ExportedPackage[] getExportedPackages(Bundle bundle)
Deprecated.Gets the exported packages for the specified bundle.- Parameters:
bundle- The bundle whose exported packages are to be returned, ornullif all exported packages are to be returned. If the specified bundle is the system bundle (that is, the bundle with id zero), this method returns all the packages known to be exported by the system bundle. This will include the package specified by theorg.osgi.framework.system.packagessystem property as well as any other package exported by the framework implementation.- Returns:
- An array of exported packages, or
nullif the specified bundle has no exported packages. - Throws:
java.lang.IllegalArgumentException- If the specifiedBundlewas not created by the same framework instance that registered thisPackageAdminservice.
-
getExportedPackages
ExportedPackage[] getExportedPackages(java.lang.String name)
Deprecated.Gets the exported packages for the specified package name.- 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. - Since:
- 1.2
-
getExportedPackage
ExportedPackage getExportedPackage(java.lang.String name)
Deprecated.Gets the exported package for the specified package name.If there are multiple exported packages with specified name, the exported package with the highest version will be returned.
- Parameters:
name- The name of the exported package to be returned.- Returns:
- The exported package, or
nullif no exported package with the specified name exists. - See Also:
getExportedPackages(String)
-
refreshPackages
void refreshPackages(Bundle[] bundles)
Deprecated.Forces the update (replacement) or removal of packages exported by the specified bundles.If no bundles are specified, this method will update or remove any packages exported by any bundles that were previously updated or uninstalled since the last call to this method. The technique by which this is accomplished may vary among different Framework implementations. One permissible implementation is to stop and restart the Framework.
This method returns to the caller immediately and then performs the following steps on a separate thread:
- Compute a graph of bundles starting with the specified bundles. If no
bundles are specified, compute a graph of bundles starting with bundle
updated or uninstalled since the last call to this method. Add to the
graph any bundle that is wired to a package that is currently exported by
a bundle in the graph. The graph is fully constructed when there is no
bundle outside the graph that is wired to a bundle in the graph. The
graph may contain
UNINSTALLEDbundles that are currently still exporting packages. - Each bundle in the graph that is in the
ACTIVEstate will be stopped as described in theBundle.stopmethod. - Each bundle in the graph that is in the
RESOLVEDstate is unresolved and thus moved to theINSTALLEDstate. The effect of this step is that bundles in the graph are no longerRESOLVED. - Each bundle in the graph that is in the
UNINSTALLEDstate is removed from the graph and is now completely removed from the Framework. - Each bundle in the graph that was in the
ACTIVEstate prior to Step 2 is started as described in theBundle.startmethod, causing all bundles required for the restart to be resolved. It is possible that, as a result of the previous steps, packages that were previously exported no longer are. Therefore, some bundles may be unresolvable until another bundle offering a compatible package for export has been installed in the Framework. - A framework event of type
FrameworkEvent.PACKAGES_REFRESHEDis fired.
For any exceptions that are thrown during any of these steps, a
FrameworkEventof typeERRORis fired containing the exception. The source bundle for these events should be the specific bundle to which the exception is related. If no specific bundle can be associated with the exception then the System Bundle must be used as the source bundle for the event.- Parameters:
bundles- The bundles whose exported packages are to be updated or removed, ornullfor all bundles updated or uninstalled since the last call to this method.- Throws:
java.lang.SecurityException- If the caller does not haveAdminPermission[System Bundle,RESOLVE]and the Java runtime environment supports permissions.java.lang.IllegalArgumentException- If the specifiedBundles were not created by the same framework instance that registered thisPackageAdminservice.
- Compute a graph of bundles starting with the specified bundles. If no
bundles are specified, compute a graph of bundles starting with bundle
updated or uninstalled since the last call to this method. Add to the
graph any bundle that is wired to a package that is currently exported by
a bundle in the graph. The graph is fully constructed when there is no
bundle outside the graph that is wired to a bundle in the graph. The
graph may contain
-
resolveBundles
boolean resolveBundles(Bundle[] bundles)
Deprecated.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
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.- Parameters:
bundles- The bundles to resolve ornullto resolve all unresolved bundles installed in the Framework.- Returns:
trueif all specified bundles are resolved;- Throws:
java.lang.SecurityException- If the caller does not haveAdminPermission[System Bundle,RESOLVE]and the Java runtime environment supports permissions.java.lang.IllegalArgumentException- If the specifiedBundles were not created by the same framework instance that registered thisPackageAdminservice.- Since:
- 1.2
-
getRequiredBundles
RequiredBundle[] getRequiredBundles(java.lang.String symbolicName)
Deprecated.Returns an array of required bundles having the specified symbolic name.If
nullis specified, then all required bundles will be returned.- 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. - Since:
- 1.2
-
getBundles
Bundle[] getBundles(java.lang.String symbolicName, java.lang.String versionRange)
Deprecated.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, thennullis 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.- Parameters:
symbolicName- The symbolic name of the desired bundles.versionRange- The version range of the desired bundles, ornullif all versions are desired.- Returns:
- An array of bundles with the specified name belonging to the
specified version range ordered in descending version order, or
nullif no bundles are found. - Since:
- 1.2
- See Also:
Constants.BUNDLE_VERSION_ATTRIBUTE
-
getFragments
Bundle[] getFragments(Bundle bundle)
Deprecated.Returns 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.- 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. - Throws:
java.lang.IllegalArgumentException- If the specifiedBundlewas not created by the same framework instance that registered thisPackageAdminservice.- Since:
- 1.2
-
getHosts
Bundle[] getHosts(Bundle bundle)
Deprecated.Returns the host bundles to which the specified fragment bundle is attached.- 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. - Throws:
java.lang.IllegalArgumentException- If the specifiedBundlewas not created by the same framework instance that registered thisPackageAdminservice.- Since:
- 1.2
-
getBundle
Bundle getBundle(java.lang.Class<?> clazz)
Deprecated.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 thennullis returned.- Parameters:
clazz- The class object from which to locate the bundle.- Returns:
- The bundle from which the specified class is loaded or
nullif the class was not loaded by a bundle class loader created by the same framework instance that registered thisPackageAdminservice. - Since:
- 1.2
-
getBundleType
int getBundleType(Bundle bundle)
Deprecated.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.
- Parameters:
bundle- The bundle for which to return the special type.- Returns:
- The special type of the bundle.
- Throws:
java.lang.IllegalArgumentException- If the specifiedBundlewas not created by the same framework instance that registered thisPackageAdminservice.- Since:
- 1.2
-
-