public class

FelixOsgiContainerManager

extends Object
implements OsgiContainerManager
java.lang.Object
   ↳ com.atlassian.plugin.osgi.container.felix.FelixOsgiContainerManager

Class Overview

Felix implementation of the OSGi container manager

Summary

Constants
String OSGI_FRAMEWORK_BUNDLES_ZIP
int REFRESH_TIMEOUT
Public Constructors
@Deprecated FelixOsgiContainerManager(File frameworkBundlesDir, PackageScannerConfiguration packageScannerConfig, HostComponentProvider provider, PluginEventManager eventManager)
@Deprecated FelixOsgiContainerManager(URL frameworkBundlesZip, File frameworkBundlesDir, PackageScannerConfiguration packageScannerConfig, HostComponentProvider provider, PluginEventManager eventManager)
FelixOsgiContainerManager(OsgiPersistentCache persistentCache, PackageScannerConfiguration packageScannerConfig, HostComponentProvider provider, PluginEventManager eventManager)
Constructs the container manager using the framework bundles zip file located in this library
FelixOsgiContainerManager(URL frameworkBundlesZip, OsgiPersistentCache persistentCache, PackageScannerConfiguration packageScannerConfig, HostComponentProvider provider, PluginEventManager eventManager)
Constructs the container manager
Public Methods
void clearExportCache()
Clears export cache.
Bundle[] getBundles()
Gets a list of installed bundles
List<HostComponentRegistration> getHostComponentRegistrations()
Gets a list of host component registrations
ServiceReference[] getRegisteredServices()
Gets a list of service references
ServiceTracker getServiceTracker(String cls)
Gets a service tracker to follow a service registered under a certain interface.
Bundle installBundle(File file)
Installs a bundle into a running OSGI container
boolean isRunning()
void onPluginFrameworkWarmRestarting(PluginFrameworkWarmRestartingEvent event)
void onPluginUninstallation(PluginUninstalledEvent event)
void onPluginUpgrade(PluginUpgradedEvent event)
void onShutdown(PluginFrameworkShutdownEvent event)
void onStart(PluginFrameworkStartingEvent event)
void setDisableMultipleBundleVersions(boolean val)
void setFelixLogger(Logger logger)
void start()
Starts the OSGi container
void stop()
Stops the OSGi container
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.plugin.osgi.container.OsgiContainerManager

Constants

public static final String OSGI_FRAMEWORK_BUNDLES_ZIP

Constant Value: "osgi-framework-bundles.zip"

public static final int REFRESH_TIMEOUT

Constant Value: 10 (0x0000000a)

Public Constructors

@Deprecated public FelixOsgiContainerManager (File frameworkBundlesDir, PackageScannerConfiguration packageScannerConfig, HostComponentProvider provider, PluginEventManager eventManager)

This constructor is deprecated.
Since 2.2.0, use FelixOsgiContainerManager(OsgiPersistentCache, PackageScannerConfiguration, HostComponentProvider, PluginEventManager) instead

Constructs the container manager using the framework bundles zip file located in this library

Parameters
frameworkBundlesDir The directory to unzip the framework bundles into.
packageScannerConfig The configuration for package scanning
provider The host component provider. May be null.
eventManager The plugin event manager to register for init and shutdown events

@Deprecated public FelixOsgiContainerManager (URL frameworkBundlesZip, File frameworkBundlesDir, PackageScannerConfiguration packageScannerConfig, HostComponentProvider provider, PluginEventManager eventManager)

This constructor is deprecated.
Since 2.2.0, use FelixOsgiContainerManager(URL, OsgiPersistentCache, PackageScannerConfiguration, HostComponentProvider, PluginEventManager) instead

Constructs the container manager

Parameters
frameworkBundlesZip The location of the zip file containing framework bundles
frameworkBundlesDir The directory to unzip the framework bundles into.
packageScannerConfig The configuration for package scanning
provider The host component provider. May be null.
eventManager The plugin event manager to register for init and shutdown events

public FelixOsgiContainerManager (OsgiPersistentCache persistentCache, PackageScannerConfiguration packageScannerConfig, HostComponentProvider provider, PluginEventManager eventManager)

Constructs the container manager using the framework bundles zip file located in this library

Parameters
persistentCache The persistent cache configuration.
packageScannerConfig The configuration for package scanning
provider The host component provider. May be null.
eventManager The plugin event manager to register for init and shutdown events

public FelixOsgiContainerManager (URL frameworkBundlesZip, OsgiPersistentCache persistentCache, PackageScannerConfiguration packageScannerConfig, HostComponentProvider provider, PluginEventManager eventManager)

Constructs the container manager

Parameters
frameworkBundlesZip The location of the zip file containing framework bundles
persistentCache The persistent cache to use for the framework and framework bundles
packageScannerConfig The configuration for package scanning
provider The host component provider. May be null.
eventManager The plugin event manager to register for init and shutdown events
Throws
OsgiContainerException If the host version isn't supplied and the cache directory cannot be cleaned.

Public Methods

public void clearExportCache ()

Clears export cache.

public Bundle[] getBundles ()

Gets a list of installed bundles

Returns
  • An array of bundles

public List<HostComponentRegistration> getHostComponentRegistrations ()

Gets a list of host component registrations

Returns
  • A list of host component registrations

public ServiceReference[] getRegisteredServices ()

Gets a list of service references

Returns
  • An array of service references

public ServiceTracker getServiceTracker (String cls)

Gets a service tracker to follow a service registered under a certain interface. Will return a new ServiceTracker instance for every call, so don't call more than necessary. Any provided ServiceTracker instances will be opened before returning and automatically closed on shutdown.

Parameters
cls The interface class as a String
Returns
  • A service tracker to follow all instances of that interface

public Bundle installBundle (File file)

Installs a bundle into a running OSGI container

Parameters
file The bundle file to install
Returns
  • The created bundle

public boolean isRunning ()

public void onPluginFrameworkWarmRestarting (PluginFrameworkWarmRestartingEvent event)

public void onPluginUninstallation (PluginUninstalledEvent event)

public void onPluginUpgrade (PluginUpgradedEvent event)

public void onShutdown (PluginFrameworkShutdownEvent event)

public void onStart (PluginFrameworkStartingEvent event)

public void setDisableMultipleBundleVersions (boolean val)

public void setFelixLogger (Logger logger)

public void start ()

Starts the OSGi container

public void stop ()

Stops the OSGi container