|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.knopflerfish.framework.PackageAdminImpl
public class PackageAdminImpl
Framework service which allows bundle programmers to inspect the packages exported in the framework and eagerly update or uninstall bundles. 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(org.osgi.framework.Bundle[])
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.
PackageAdmin
Field Summary |
---|
Fields inherited from interface org.osgi.service.packageadmin.PackageAdmin |
---|
BUNDLE_TYPE_FRAGMENT |
Method Summary | |
---|---|
Bundle |
getBundle(java.lang.Class clazz)
Returns the bundle from which the specified class is loaded. |
Bundle[] |
getBundles(java.lang.String symbolicName,
java.lang.String versionRange)
Returns the bundles with the specified symbolic name whose bundle version is within the specified version range. |
int |
getBundleType(Bundle bundle)
Returns the special type of the specified bundle. |
ExportedPackage |
getExportedPackage(java.lang.String name)
Gets the ExportedPackage with the specified package name. |
ExportedPackage[] |
getExportedPackages(Bundle bundle)
Gets the packages exported by the specified bundle. |
ExportedPackage[] |
getExportedPackages(java.lang.String name)
Gets the exported packages for the specified package name. |
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. |
RequiredBundle[] |
getRequiredBundles(java.lang.String symbolicName)
Returns an array of required bundles having the specified symbolic name. |
void |
refreshPackages(Bundle[] bundles)
Forces the update (replacement) or removal of packages exported by the specified bundles. |
boolean |
resolveBundles(Bundle[] bundles)
Resolve the specified bundles. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public ExportedPackage[] getExportedPackages(Bundle bundle)
getExportedPackages
in interface PackageAdmin
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.
public ExportedPackage[] getExportedPackages(java.lang.String name)
getExportedPackages
in interface PackageAdmin
name
- The name of the exported packages to be returned.
null
if no
exported packages with the specified name exists.public ExportedPackage getExportedPackage(java.lang.String name)
getExportedPackage
in interface PackageAdmin
name
- The name of the exported package to be returned.
PackageAdmin.getExportedPackages(String)
public void refreshPackages(Bundle[] bundles)
refreshPackages
in interface PackageAdmin
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.PackageAdmin.refreshPackages(org.osgi.framework.Bundle[])
public boolean resolveBundles(Bundle[] bundles)
PackageAdmin
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.
resolveBundles
in interface PackageAdmin
bundles
- The bundles to resolve or null
to resolve
all unresolved bundles installed in the Framework.
true
if all specified bundles are resolved;public RequiredBundle[] getRequiredBundles(java.lang.String symbolicName)
PackageAdmin
If null
is specified, then all required bundles will be
returned.
getRequiredBundles
in interface PackageAdmin
symbolicName
- The bundle symbolic name or null
for
all required bundles.
null
if no
required bundles exist for the specified symbolic name.public Bundle[] getBundles(java.lang.String symbolicName, java.lang.String versionRange)
PackageAdmin
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.
getBundles
in interface PackageAdmin
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
public Bundle[] getFragments(Bundle bundle)
PackageAdmin
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.
getFragments
in interface PackageAdmin
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.public Bundle[] getHosts(Bundle bundle)
PackageAdmin
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.
getHosts
in interface PackageAdmin
bundle
- The bundle whose host bundle is to be returned.
null
if the
bundle does not have a host bundle.public Bundle getBundle(java.lang.Class clazz)
PackageAdmin
null
is returned.
getBundle
in interface PackageAdmin
clazz
- The class object from which to locate the bundle.
null
if the class was not loaded by a bundle class
loader.public int getBundleType(Bundle bundle)
PackageAdmin
If a bundle is not one or more of the defined types then 0x00000000 is returned.
getBundleType
in interface PackageAdmin
bundle
- The bundle for which to return the special type.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |