Class FelixOsgiContainerManager
java.lang.Object
com.atlassian.plugin.osgi.container.felix.FelixOsgiContainerManager
- All Implemented Interfaces:
OsgiContainerManager
Felix implementation of the OSGi container manager
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFelixOsgiContainerManager(File frameworkBundlesDirectory, OsgiPersistentCache persistentCache, PackageScannerConfiguration packageScannerConfig, HostComponentProvider provider, com.atlassian.plugin.event.PluginEventManager eventManager) Constructs the container manager.FelixOsgiContainerManager(URL frameworkBundlesZip, OsgiPersistentCache persistentCache, PackageScannerConfiguration packageScannerConfig, HostComponentProvider provider, com.atlassian.plugin.event.PluginEventManager eventManager) Constructs the container manager. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBundleListener(org.osgi.framework.BundleListener listener) That is shortcut to access SystemBundle.voidClears export cache.org.osgi.framework.Bundle[]Gets a list of installed bundlesGets a list of host component registrationsorg.osgi.framework.ServiceReference[]Gets a list of service referencesorg.osgi.util.tracker.ServiceTrackergetServiceTracker(String interfaceClassName) Gets a service tracker to follow a service registered under a certain interface.org.osgi.util.tracker.ServiceTrackergetServiceTracker(String interfaceClassName, org.osgi.util.tracker.ServiceTrackerCustomizer serviceTrackerCustomizer) Gets a service tracker to follow a service registered under a certain interface with aServiceTrackerCustomizerattached for customizing tracked service objects.org.osgi.framework.BundleinstallBundle(File file, ReferenceMode referenceMode) Installs a bundle into a running OSGI container.booleanvoidonPluginFrameworkWarmRestarting(com.atlassian.plugin.event.events.PluginFrameworkWarmRestartingEvent event) voidonPluginUninstallation(com.atlassian.plugin.event.events.PluginUninstalledEvent event) voidonPluginUpgrade(com.atlassian.plugin.event.events.PluginUpgradedEvent event) voidonShutdown(com.atlassian.plugin.event.events.PluginFrameworkShutdownEvent event) voidonStart(com.atlassian.plugin.event.events.PluginFrameworkStartingEvent event) voidremoveBundleListener(org.osgi.framework.BundleListener listener) That is shortcut to access SystemBundle.voidsetDisableMultipleBundleVersions(boolean val) voidsetFelixLogger(org.apache.felix.framework.Logger logger) voidstart()Starts the OSGi containervoidstop()Stops the OSGi container
-
Field Details
-
REFRESH_TIMEOUT
public static final int REFRESH_TIMEOUT- See Also:
-
ATLASSIAN_BOOTDELEGATION
- See Also:
-
ATLASSIAN_BOOTDELEGATION_EXTRA
- See Also:
-
ATLASSIAN_DISABLE_REFERENCE_PROTOCOL
- See Also:
-
-
Constructor Details
-
FelixOsgiContainerManager
public FelixOsgiContainerManager(URL frameworkBundlesZip, OsgiPersistentCache persistentCache, PackageScannerConfiguration packageScannerConfig, HostComponentProvider provider, com.atlassian.plugin.event.PluginEventManager eventManager) Constructs the container manager.- Parameters:
frameworkBundlesZip- The location of the zip file containing framework bundlespersistentCache- The persistent cache to use for the framework and framework bundlespackageScannerConfig- The configuration for package scanningprovider- 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.- Since:
- 2.2.0
-
FelixOsgiContainerManager
public FelixOsgiContainerManager(File frameworkBundlesDirectory, OsgiPersistentCache persistentCache, PackageScannerConfiguration packageScannerConfig, HostComponentProvider provider, com.atlassian.plugin.event.PluginEventManager eventManager) Constructs the container manager.This constructor is used when frameworkBundlesDirectory has already been populated with the framework bundles. It ignores
OsgiPersistentCache.getFrameworkBundleCache().- Parameters:
frameworkBundlesDirectory- The directory containing framework bundlespersistentCache- The persistent cache to use for the frameworkpackageScannerConfig- The configuration for package scanningprovider- 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.- Since:
- 3.0.21
-
-
Method Details
-
setFelixLogger
public void setFelixLogger(org.apache.felix.framework.Logger logger) -
setDisableMultipleBundleVersions
public void setDisableMultipleBundleVersions(boolean val) -
clearExportCache
public void clearExportCache()Clears export cache.- Since:
- 2.9.0
-
onStart
public void onStart(com.atlassian.plugin.event.events.PluginFrameworkStartingEvent event) -
onShutdown
public void onShutdown(com.atlassian.plugin.event.events.PluginFrameworkShutdownEvent event) -
onPluginUpgrade
public void onPluginUpgrade(com.atlassian.plugin.event.events.PluginUpgradedEvent event) -
onPluginUninstallation
public void onPluginUninstallation(com.atlassian.plugin.event.events.PluginUninstalledEvent event) -
onPluginFrameworkWarmRestarting
public void onPluginFrameworkWarmRestarting(com.atlassian.plugin.event.events.PluginFrameworkWarmRestartingEvent event) -
start
public void start()Description copied from interface:OsgiContainerManagerStarts the OSGi container- Specified by:
startin interfaceOsgiContainerManager
-
stop
public void stop()Description copied from interface:OsgiContainerManagerStops the OSGi container- Specified by:
stopin interfaceOsgiContainerManager
-
getBundles
public org.osgi.framework.Bundle[] getBundles()Description copied from interface:OsgiContainerManagerGets a list of installed bundles- Specified by:
getBundlesin interfaceOsgiContainerManager- Returns:
- An array of bundles
-
getRegisteredServices
public org.osgi.framework.ServiceReference[] getRegisteredServices()Description copied from interface:OsgiContainerManagerGets a list of service references- Specified by:
getRegisteredServicesin interfaceOsgiContainerManager- Returns:
- An array of service references
-
getServiceTracker
Description copied from interface:OsgiContainerManagerGets a service tracker to follow a service registered under a certain interface. Will return a newServiceTrackerinstance for every call, so don't call more than necessary. Any providedServiceTrackerinstances will be opened before returning and automatically closed on shutdown.- Specified by:
getServiceTrackerin interfaceOsgiContainerManager- Parameters:
interfaceClassName- The interface class as a String- Returns:
- A service tracker to follow all instances of that interface
-
getServiceTracker
public org.osgi.util.tracker.ServiceTracker getServiceTracker(String interfaceClassName, org.osgi.util.tracker.ServiceTrackerCustomizer serviceTrackerCustomizer) Description copied from interface:OsgiContainerManagerGets a service tracker to follow a service registered under a certain interface with aServiceTrackerCustomizerattached for customizing tracked service objects. Will return a newServiceTrackerinstance for every call, so don't call more than necessary. Any providedServiceTrackerinstances will be opened before returning and automatically closed on shutdown.- Specified by:
getServiceTrackerin interfaceOsgiContainerManager- Parameters:
interfaceClassName- The interface class as a StringserviceTrackerCustomizer- service tracker customizer for the created service tracker- Returns:
- A service tracker to follow all instances of that interface
-
addBundleListener
public void addBundleListener(org.osgi.framework.BundleListener listener) Description copied from interface:OsgiContainerManagerThat is shortcut to access SystemBundle.- Specified by:
addBundleListenerin interfaceOsgiContainerManager
-
removeBundleListener
public void removeBundleListener(org.osgi.framework.BundleListener listener) Description copied from interface:OsgiContainerManagerThat is shortcut to access SystemBundle.- Specified by:
removeBundleListenerin interfaceOsgiContainerManager
-
installBundle
Description copied from interface:OsgiContainerManagerInstalls a bundle into a running OSGI container.- Specified by:
installBundlein interfaceOsgiContainerManager- Parameters:
file- The bundle file to install.referenceMode- specifies whether the container may install a reference to, rather than copy, the bundle file.- Returns:
- The installed bundle.
-
isRunning
public boolean isRunning()- Specified by:
isRunningin interfaceOsgiContainerManager- Returns:
- If the container is running or not
-
getHostComponentRegistrations
Description copied from interface:OsgiContainerManagerGets a list of host component registrations- Specified by:
getHostComponentRegistrationsin interfaceOsgiContainerManager- Returns:
- A list of host component registrations
-