org.osgi.framework.wiring
package.public interface PackageAdmin
If present, there will only be a single instance of this service registered with the Framework.
ExportedPackage
,
RequiredBundle
Modifier and Type | Field and Description |
---|---|
static int |
BUNDLE_TYPE_FRAGMENT
Deprecated.
Bundle type indicating the bundle is a fragment bundle.
|
Modifier and Type | Method and Description |
---|---|
Bundle |
getBundle(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.
|
int |
getBundleType(Bundle bundle)
Deprecated.
Returns the special type of the specified bundle.
|
ExportedPackage |
getExportedPackage(java.lang.String name)
Deprecated.
|
ExportedPackage[] |
getExportedPackages(Bundle bundle)
Deprecated.
|
ExportedPackage[] |
getExportedPackages(java.lang.String name)
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.
|
void |
refreshPackages(Bundle[] bundles)
Deprecated.
Forces the update (replacement) or removal of packages exported by the
specified bundles.
|
boolean |
resolveBundles(Bundle[] bundles)
Deprecated.
Resolve the specified bundles.
|
static final int BUNDLE_TYPE_FRAGMENT
The value of BUNDLE_TYPE_FRAGMENT
is 0x00000001.
ExportedPackage[] getExportedPackages(Bundle bundle)
bundle
- The bundle whose exported packages are to be returned, or
null
if 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 the org.osgi.framework.system.packages
system property as well as any other package exported by the
framework implementation.null
if the
specified bundle has no exported packages.java.lang.IllegalArgumentException
- If the specified Bundle
was
not created by the same framework instance that registered this
PackageAdmin
service.ExportedPackage[] getExportedPackages(java.lang.String name)
name
- The name of the exported packages to be returned.null
if no
exported packages with the specified name exists.ExportedPackage getExportedPackage(java.lang.String name)
If there are multiple exported packages with specified name, the exported package with the highest version will be returned.
name
- The name of the exported package to be returned.null
if no exported
package with the specified name exists.getExportedPackages(String)
void refreshPackages(Bundle[] 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:
UNINSTALLED
bundles that are currently still
exporting packages.ACTIVE
state will be
stopped as described in the Bundle.stop
method.RESOLVED
state is
unresolved and thus moved to the INSTALLED
state. The effect of
this step is that bundles in the graph are no longer RESOLVED
.UNINSTALLED
state is
removed from the graph and is now completely removed from the Framework.ACTIVE
state prior
to Step 2 is started as described in the Bundle.start
method,
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.FrameworkEvent.PACKAGES_REFRESHED
is fired.
For any exceptions that are thrown during any of these steps, a
FrameworkEvent
of type ERROR
is 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.
bundles
- The bundles whose exported packages are to be updated or
removed, or null
for all bundles updated or
uninstalled since the last call to this method.java.lang.SecurityException
- If the caller does not have
AdminPermission[System Bundle,RESOLVE]
and the Java
runtime environment supports permissions.java.lang.IllegalArgumentException
- If the specified Bundle
s
were not created by the same framework instance that registered
this PackageAdmin
service.boolean resolveBundles(Bundle[] bundles)
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;java.lang.SecurityException
- If the caller does not have
AdminPermission[System Bundle,RESOLVE]
and the Java
runtime environment supports permissions.java.lang.IllegalArgumentException
- If the specified Bundle
s
were not created by the same framework instance that registered
this PackageAdmin
service.RequiredBundle[] getRequiredBundles(java.lang.String symbolicName)
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.Bundle[] getBundles(java.lang.String symbolicName, java.lang.String versionRange)
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.Constants.BUNDLE_VERSION_ATTRIBUTE
Bundle[] getFragments(Bundle bundle)
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.java.lang.IllegalArgumentException
- If the specified Bundle
was
not created by the same framework instance that registered this
PackageAdmin
service.Bundle[] getHosts(Bundle bundle)
bundle
- The fragment bundle whose host bundles are to be returned.null
if the specified bundle
is not a fragment or is not attached to any host bundles.java.lang.IllegalArgumentException
- If the specified Bundle
was
not created by the same framework instance that registered this
PackageAdmin
service.Bundle getBundle(java.lang.Class<?> clazz)
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 created by the same framework instance that registered
this PackageAdmin
service.int getBundleType(Bundle bundle)
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.java.lang.IllegalArgumentException
- If the specified Bundle
was
not created by the same framework instance that registered this
PackageAdmin
service.Copyright © OSGi Alliance (2000, 2020). All Rights Reserved. Licensed under the OSGi Specification License, Version 2.0