public class PackageAdminImpl extends Object implements PackageAdmin
BUNDLE_TYPE_FRAGMENT
Modifier and Type | Method and Description |
---|---|
Bundle |
getBundle(Class clazz)
Returns 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.
|
int |
getBundleType(Bundle bundle)
Returns the special type of the specified bundle.
|
ExportedPackage |
getExportedPackage(String name)
Returns the exported package associated with the specified
package name.
|
ExportedPackage[] |
getExportedPackages(Bundle bundle)
Returns the packages exported by the specified bundle.
|
ExportedPackage[] |
getExportedPackages(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 the host bundles to which the specified fragment bundle is
attached.
|
RequiredBundle[] |
getRequiredBundles(String symbolicName)
Returns an array of required bundles having the specified symbolic name.
|
void |
refreshPackages(Bundle[] bundles)
The OSGi specification states that refreshing packages is
asynchronous; this method simply notifies the package admin
thread to do a refresh.
|
boolean |
resolveBundles(Bundle[] bundles)
Resolve the specified bundles.
|
public Bundle getBundle(Class clazz)
getBundle
in interface PackageAdmin
clazz
- the class for which to determine its associated bundle.public Bundle[] getBundles(String symbolicName, String versionRange)
getBundles
in interface PackageAdmin
symbolicName
- the target symbolic name.versionRange
- the target version range.Constants.BUNDLE_VERSION_ATTRIBUTE
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.public ExportedPackage getExportedPackage(String name)
getExportedPackage
in interface PackageAdmin
name
- the name of the exported package to find.PackageAdmin.getExportedPackages(String)
public ExportedPackage[] getExportedPackages(String name)
PackageAdmin
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[] getExportedPackages(Bundle bundle)
getExportedPackages
in interface PackageAdmin
bundle
- the bundle whose exported packages are to be returned.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
getHosts
in interface PackageAdmin
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.public RequiredBundle[] getRequiredBundles(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 void refreshPackages(Bundle[] bundles) throws SecurityException
refreshPackages
in interface PackageAdmin
bundles
- array of bundles to refresh or null to refresh
any bundles in need of refreshing.SecurityException
- If the caller does not have
AdminPermission[System Bundle,RESOLVE]
and the Java
runtime environment supports permissions.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;Copyright © 2006-2015 The Apache Software Foundation. All Rights Reserved.