Class OsgiBundlePlugin

java.lang.Object
com.atlassian.plugin.impl.AbstractPlugin
com.atlassian.plugin.osgi.factory.OsgiBundlePlugin
All Implemented Interfaces:
com.atlassian.plugin.module.ContainerManagedPlugin, OsgiBackedPlugin, com.atlassian.plugin.Plugin, com.atlassian.plugin.PluginInternal, com.atlassian.plugin.Resourced, com.atlassian.plugin.ScopeAware, Comparable<com.atlassian.plugin.Plugin>, EventListener, org.osgi.framework.BundleListener, org.osgi.framework.SynchronousBundleListener

public class OsgiBundlePlugin extends com.atlassian.plugin.impl.AbstractPlugin implements OsgiBackedPlugin, com.atlassian.plugin.module.ContainerManagedPlugin, org.osgi.framework.SynchronousBundleListener
Plugin that wraps an OSGi bundle

That kind of plugins might have or do not have plugin descriptor and must manage internal IoC by themselves if it is present. Note that some modules require access to plugin IoC to work properly so it is plugin responsibility to provide a such access and manage internal container lifecycle.

To export any container to PluginsFramework bundle should export ContainerAccessor interface implementation as a service before move to ACTIVE state. Behavior is not defined if plugin provides more then one instances of ContainerAccessor Plugin of that type has lifecycle duplicates underlying OSGi Bundle natural states

  • Field Summary

    Fields inherited from class com.atlassian.plugin.impl.AbstractPlugin

    pluginArtifact

    Fields inherited from interface com.atlassian.plugin.Plugin

    VERSION_1, VERSION_2, VERSION_3
  • Constructor Summary

    Constructors
    Constructor
    Description
    OsgiBundlePlugin(OsgiContainerManager osgiContainerManager, String pluginKey, com.atlassian.plugin.PluginArtifact pluginArtifact)
    Create a plugin wrapper which installs the bundle when the plugin is installed.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    bundleChanged(org.osgi.framework.BundleEvent event)
     
    protected void
     
    protected com.atlassian.plugin.PluginState
     
    org.osgi.framework.Bundle
    Returns OSGi Bundle that corresponds to the current plugin
     
    com.atlassian.plugin.module.ContainerAccessor
     
     
     
    com.atlassian.plugin.PluginDependencies
     
     
     
    protected void
     
    boolean
     
    boolean
     
    boolean
     
    <T> Class<T>
    loadClass(String clazz, Class<?> callingClass)
     
    void
     
    protected void
     

    Methods inherited from class com.atlassian.plugin.impl.AbstractPlugin

    addDynamicModuleDescriptor, addModuleDescriptor, cleanVersionString, close, compareAndSetPluginState, compareTo, containsSystemModule, disable, enable, getActivePermissions, getDateEnabled, getDateEnabling, getDynamicModuleDescriptors, getI18nNameKey, getInstallationMode, getKey, getLog, getModuleDescriptor, getModuleDescriptors, getModuleDescriptorsByModuleClass, getName, getPluginArtifact, getPluginInformation, getPluginState, getPluginsVersion, getRequiredPlugins, getResourceDescriptor, getResourceDescriptors, getResourceLocation, getScopeKey, hasAllPermissions, install, isBundledPlugin, isEnabledByDefault, isSystemPlugin, removeDynamicModuleDescriptor, removeModuleDescriptor, setBundledPlugin, setEnabledByDefault, setI18nNameKey, setKey, setName, setPluginInformation, setPluginState, setPluginsVersion, setResources, setSystemPlugin, toString, uninstall

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface java.lang.Comparable

    compareTo

    Methods inherited from interface com.atlassian.plugin.Plugin

    addModuleDescriptor, containsSystemModule, disable, enable, getActivePermissions, getDateEnabled, getDateEnabling, getI18nNameKey, getInstallationMode, getKey, getModuleDescriptor, getModuleDescriptors, getModuleDescriptorsByModuleClass, getName, getPluginArtifact, getPluginInformation, getPluginState, getPluginsVersion, hasAllPermissions, install, isBundledPlugin, isEnabledByDefault, isSystemPlugin, setEnabledByDefault, setI18nNameKey, setKey, setName, setPluginInformation, setPluginsVersion, setResources, setSystemPlugin, uninstall

    Methods inherited from interface com.atlassian.plugin.Resourced

    getResourceDescriptor, getResourceDescriptors, getResourceLocation

    Methods inherited from interface com.atlassian.plugin.ScopeAware

    getScopeKey
  • Constructor Details

    • OsgiBundlePlugin

      public OsgiBundlePlugin(OsgiContainerManager osgiContainerManager, String pluginKey, com.atlassian.plugin.PluginArtifact pluginArtifact)
      Create a plugin wrapper which installs the bundle when the plugin is installed.
      Parameters:
      osgiContainerManager - the container to install into when the plugin is installed.
      pluginKey - The plugin key.
      pluginArtifact - The The plugin artifact to install.
  • Method Details

    • getBundle

      public org.osgi.framework.Bundle getBundle()
      Description copied from interface: OsgiBackedPlugin
      Returns OSGi Bundle that corresponds to the current plugin

      Note that Bundle could be not available on some of Plugin lifecycle stages. In that case method call results in IllegalPluginStateException

      Specified by:
      getBundle in interface OsgiBackedPlugin
      Returns:
      OSGi representation of the current plugin
    • getDateLoaded

      public Date getDateLoaded()
      Specified by:
      getDateLoaded in interface com.atlassian.plugin.Plugin
      Overrides:
      getDateLoaded in class com.atlassian.plugin.impl.AbstractPlugin
    • getDateInstalled

      public Date getDateInstalled()
      Specified by:
      getDateInstalled in interface com.atlassian.plugin.Plugin
      Overrides:
      getDateInstalled in class com.atlassian.plugin.impl.AbstractPlugin
    • isUninstallable

      public boolean isUninstallable()
      Specified by:
      isUninstallable in interface com.atlassian.plugin.Plugin
    • isDeleteable

      public boolean isDeleteable()
      Specified by:
      isDeleteable in interface com.atlassian.plugin.Plugin
    • isDynamicallyLoaded

      public boolean isDynamicallyLoaded()
      Specified by:
      isDynamicallyLoaded in interface com.atlassian.plugin.Plugin
    • loadClass

      public <T> Class<T> loadClass(String clazz, Class<?> callingClass) throws ClassNotFoundException
      Specified by:
      loadClass in interface com.atlassian.plugin.Plugin
      Throws:
      ClassNotFoundException
    • getResource

      public URL getResource(String name)
      Specified by:
      getResource in interface com.atlassian.plugin.Plugin
    • getResourceAsStream

      public InputStream getResourceAsStream(String name)
      Specified by:
      getResourceAsStream in interface com.atlassian.plugin.Plugin
    • resolve

      public void resolve()
      Specified by:
      resolve in interface com.atlassian.plugin.Plugin
      Overrides:
      resolve in class com.atlassian.plugin.impl.AbstractPlugin
    • getDependencies

      @Nonnull public com.atlassian.plugin.PluginDependencies getDependencies()
      Specified by:
      getDependencies in interface com.atlassian.plugin.Plugin
      Overrides:
      getDependencies in class com.atlassian.plugin.impl.AbstractPlugin
      See Also:
      • Plugin.getDependencies()
    • installInternal

      protected void installInternal() throws OsgiContainerException, com.atlassian.plugin.IllegalPluginStateException
      Overrides:
      installInternal in class com.atlassian.plugin.impl.AbstractPlugin
      Throws:
      OsgiContainerException
      com.atlassian.plugin.IllegalPluginStateException
    • uninstallInternal

      protected void uninstallInternal()
      Overrides:
      uninstallInternal in class com.atlassian.plugin.impl.AbstractPlugin
    • enableInternal

      protected com.atlassian.plugin.PluginState enableInternal()
      Overrides:
      enableInternal in class com.atlassian.plugin.impl.AbstractPlugin
    • disableInternal

      protected void disableInternal()
      Overrides:
      disableInternal in class com.atlassian.plugin.impl.AbstractPlugin
    • bundleChanged

      public void bundleChanged(org.osgi.framework.BundleEvent event)
      Specified by:
      bundleChanged in interface org.osgi.framework.BundleListener
    • getContainerAccessor

      public com.atlassian.plugin.module.ContainerAccessor getContainerAccessor()
      Specified by:
      getContainerAccessor in interface com.atlassian.plugin.module.ContainerManagedPlugin
    • getClassLoader

      public ClassLoader getClassLoader()
      Specified by:
      getClassLoader in interface com.atlassian.plugin.Plugin