Class OsgiPluginFactory

java.lang.Object
com.atlassian.plugin.factories.AbstractPluginFactory
com.atlassian.plugin.osgi.factory.OsgiPluginFactory
All Implemented Interfaces:
com.atlassian.plugin.factories.PluginFactory

public final class OsgiPluginFactory extends com.atlassian.plugin.factories.AbstractPluginFactory
Plugin loader that starts an OSGi container and loads plugins into it, wrapped as OSGi bundles. Supports
  • Dynamic loading of module descriptors via OSGi services
  • Delayed enabling until the plugin container is active
  • XML or Jar manifest configuration
  • Constructor Details

    • OsgiPluginFactory

      public OsgiPluginFactory(String pluginDescriptorFileName, Set<com.atlassian.plugin.Application> applications, OsgiPersistentCache persistentCache, OsgiContainerManager osgi, com.atlassian.plugin.event.PluginEventManager pluginEventManager)
      Default constructor
    • OsgiPluginFactory

      public OsgiPluginFactory(String pluginDescriptorFileName, Set<com.atlassian.plugin.Application> applications, OsgiPersistentCache persistentCache, OsgiContainerManager osgi, com.atlassian.plugin.event.PluginEventManager pluginEventManager, OsgiPluginFactory.PluginTransformerFactory pluginTransformerFactory)
      Constructor for implementations that want to override the DefaultPluginTransformer with a custom implementation
  • Method Details

    • canCreate

      public String canCreate(com.atlassian.plugin.PluginArtifact pluginArtifact)
      Specified by:
      canCreate in interface com.atlassian.plugin.factories.PluginFactory
      Overrides:
      canCreate in class com.atlassian.plugin.factories.AbstractPluginFactory
    • getDescriptorInputStream

      protected InputStream getDescriptorInputStream(com.atlassian.plugin.PluginArtifact pluginArtifact)
      Specified by:
      getDescriptorInputStream in class com.atlassian.plugin.factories.AbstractPluginFactory
    • isValidPluginsVersion

      protected Predicate<Integer> isValidPluginsVersion()
      Specified by:
      isValidPluginsVersion in class com.atlassian.plugin.factories.AbstractPluginFactory
    • create

      public com.atlassian.plugin.Plugin create(com.atlassian.plugin.PluginArtifact pluginArtifact, com.atlassian.plugin.ModuleDescriptorFactory moduleDescriptorFactory)
      Deploys the plugin artifact. The artifact will only undergo transformation if a plugin descriptor can be found and the "Atlassian-Plugin-Key" value is not already defined in the manifest.
      Parameters:
      pluginArtifact - the plugin artifact to deploy
      moduleDescriptorFactory - The factory for plugin modules
      Returns:
      The instantiated and populated plugin
      Throws:
      com.atlassian.plugin.PluginParseException - If the descriptor cannot be parsed
      IllegalArgumentException - If the plugin descriptor isn't found, and the plugin key and bundle version aren't specified in the manifest
      Since:
      2.2.0
    • createModule

      public com.atlassian.plugin.ModuleDescriptor<?> createModule(com.atlassian.plugin.Plugin plugin, com.atlassian.plugin.module.Element module, com.atlassian.plugin.ModuleDescriptorFactory moduleDescriptorFactory)