public class OsgiManager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static ConfigKey<java.lang.Boolean> |
REUSE_OSGI |
static ConfigKey<java.lang.Boolean> |
USE_OSGI |
Constructor and Description |
---|
OsgiManager(ManagementContext mgmt) |
Modifier and Type | Method and Description |
---|---|
void |
addInstalledWrapperBundle(ManagedBundle mb) |
void |
clearManagedBundles()
Clears all record of the managed bundles (use with care!).
|
Maybe<org.osgi.framework.Bundle> |
findBundle(OsgiBundleWithUrl catalogBundle) |
java.io.File |
getBundleFile(ManagedBundle mb) |
org.osgi.framework.launch.Framework |
getFramework() |
java.util.Collection<ManagedBundle> |
getInstalledWrapperBundles() |
ManagedBundle |
getManagedBundle(VersionedName vn) |
ManagedBundle |
getManagedBundleFromUrl(java.lang.String url)
For bundles which are installed by a URL, see whether a bundle has been installed from that URL
|
java.lang.String |
getManagedBundleId(VersionedName vn)
Gets UID given a name, or null
|
java.util.Map<java.lang.String,ManagedBundle> |
getManagedBundles()
Map of bundles by UID
|
java.net.URL |
getResource(java.lang.String name,
java.lang.Iterable<? extends OsgiBundleWithUrl> osgiBundles)
Iterates through catalogBundles until one contains a resource with the given name.
|
java.lang.Iterable<java.net.URL> |
getResources(java.lang.String name,
java.lang.Iterable<? extends OsgiBundleWithUrl> osgiBundles) |
java.lang.Iterable<RegisteredType> |
getTypesFromBundle(VersionedName vn) |
ReferenceWithError<OsgiBundleInstallationResult> |
install(java.io.InputStream zipIn)
See
OsgiArchiveInstaller.install() , using default values |
ReferenceWithError<OsgiBundleInstallationResult> |
install(ManagedBundle knownBundleMetadata,
java.io.InputStream zipIn,
boolean start,
boolean loadCatalogBom,
boolean forceUpdateOfNonSnapshots)
See
OsgiArchiveInstaller.install() - this exposes custom options |
ReferenceWithError<OsgiBundleInstallationResult> |
installDeferredStart(ManagedBundle knownBundleMetadata,
java.io.InputStream zipIn,
boolean validateTypes)
See
OsgiArchiveInstaller.install() , but deferring the start and catalog load |
static boolean |
isBundleNameEqualOrAbsent(OsgiBundleWithUrl bundle,
org.osgi.framework.Bundle b) |
void |
loadCatalogBom(org.osgi.framework.Bundle bundle,
boolean force,
boolean validate,
java.util.Map<RegisteredType,RegisteredType> result)
installs RegisteredTypes in the BOM of this bundle into the type registry,
non-persisted but done on rebind for each persisted bundle
|
static java.util.List<org.osgi.framework.launch.Framework> |
peekFrameworksForReuse() |
org.osgi.framework.Bundle |
registerBundle(CatalogItem.CatalogBundle bundleMetadata)
Deprecated.
since 0.12.0 use
install(ManagedBundle, InputStream, boolean, boolean, boolean) |
void |
start() |
void |
stop() |
static Maybe<org.osgi.framework.launch.Framework> |
tryPeekFrameworkForReuse() |
<T> Maybe<java.lang.Class<T>> |
tryResolveClass(java.lang.String type,
java.lang.Iterable<? extends OsgiBundleWithUrl> osgiBundles) |
<T> Maybe<java.lang.Class<T>> |
tryResolveClass(java.lang.String type,
OsgiBundleWithUrl... osgiBundles) |
java.lang.Iterable<RegisteredType> |
uninstallCatalogItemsFromBundle(VersionedName bundle) |
OsgiBundleInstallationResult |
uninstallUploadedBundle(ManagedBundle bundleMetadata)
Convenience for
uninstallUploadedBundle(ManagedBundle, boolean) without forcing, and throwing on error |
ReferenceWithError<OsgiBundleInstallationResult> |
uninstallUploadedBundle(ManagedBundle bundleMetadata,
boolean force)
Removes this bundle from Brooklyn management,
removes all catalog items it defined,
and then uninstalls the bundle from OSGi.
|
ReferenceWithError<OsgiBundleInstallationResult> |
uninstallUploadedBundle(ManagedBundle bundleMetadata,
boolean force,
boolean leaveInOsgi) |
public static final ConfigKey<java.lang.Boolean> USE_OSGI
public static final ConfigKey<java.lang.Boolean> REUSE_OSGI
public OsgiManager(ManagementContext mgmt)
public void start()
public void stop()
public static Maybe<org.osgi.framework.launch.Framework> tryPeekFrameworkForReuse()
public static java.util.List<org.osgi.framework.launch.Framework> peekFrameworksForReuse()
public void clearManagedBundles()
public java.util.Map<java.lang.String,ManagedBundle> getManagedBundles()
public java.lang.String getManagedBundleId(VersionedName vn)
public ManagedBundle getManagedBundle(VersionedName vn)
public ManagedBundle getManagedBundleFromUrl(java.lang.String url)
public ReferenceWithError<OsgiBundleInstallationResult> install(java.io.InputStream zipIn)
OsgiArchiveInstaller.install()
, using default valuespublic ReferenceWithError<OsgiBundleInstallationResult> installDeferredStart(@Nullable ManagedBundle knownBundleMetadata, @Nullable java.io.InputStream zipIn, boolean validateTypes)
OsgiArchiveInstaller.install()
, but deferring the start and catalog loadpublic ReferenceWithError<OsgiBundleInstallationResult> install(@Nullable ManagedBundle knownBundleMetadata, @Nullable java.io.InputStream zipIn, boolean start, boolean loadCatalogBom, boolean forceUpdateOfNonSnapshots)
OsgiArchiveInstaller.install()
- this exposes custom optionspublic OsgiBundleInstallationResult uninstallUploadedBundle(ManagedBundle bundleMetadata)
uninstallUploadedBundle(ManagedBundle, boolean)
without forcing, and throwing on errorpublic ReferenceWithError<OsgiBundleInstallationResult> uninstallUploadedBundle(ManagedBundle bundleMetadata, boolean force)
No checking is done whether anything is using the bundle; behaviour of such things is not guaranteed. They will work for many things but attempts to load new classes may fail.
Callers should typically fail prior to invoking if anything from this bundle is in use.
This does not throw but returns a reference containing errors and result for caller to inspect and handle.
public ReferenceWithError<OsgiBundleInstallationResult> uninstallUploadedBundle(ManagedBundle bundleMetadata, boolean force, boolean leaveInOsgi)
public java.lang.Iterable<RegisteredType> uninstallCatalogItemsFromBundle(VersionedName bundle)
public java.lang.Iterable<RegisteredType> getTypesFromBundle(VersionedName vn)
@Deprecated public org.osgi.framework.Bundle registerBundle(CatalogItem.CatalogBundle bundleMetadata)
install(ManagedBundle, InputStream, boolean, boolean, boolean)
public void loadCatalogBom(org.osgi.framework.Bundle bundle, boolean force, boolean validate, java.util.Map<RegisteredType,RegisteredType> result)
bundle
- force
- validate
- result
- optional parameter collecting all results, with new type as key, and any type it replaces as valuepublic static boolean isBundleNameEqualOrAbsent(OsgiBundleWithUrl bundle, org.osgi.framework.Bundle b)
public <T> Maybe<java.lang.Class<T>> tryResolveClass(java.lang.String type, OsgiBundleWithUrl... osgiBundles)
public <T> Maybe<java.lang.Class<T>> tryResolveClass(java.lang.String type, java.lang.Iterable<? extends OsgiBundleWithUrl> osgiBundles)
public Maybe<org.osgi.framework.Bundle> findBundle(OsgiBundleWithUrl catalogBundle)
public java.net.URL getResource(java.lang.String name, java.lang.Iterable<? extends OsgiBundleWithUrl> osgiBundles)
public java.lang.Iterable<java.net.URL> getResources(java.lang.String name, java.lang.Iterable<? extends OsgiBundleWithUrl> osgiBundles)
Bundle.getResources(String)
in the referenced osgi bundles.public org.osgi.framework.launch.Framework getFramework()
public void addInstalledWrapperBundle(ManagedBundle mb)
public java.util.Collection<ManagedBundle> getInstalledWrapperBundles()
public java.io.File getBundleFile(ManagedBundle mb)