public class

OsgiPluginFactory

extends Object
implements PluginFactory
java.lang.Object
   ↳ com.atlassian.plugin.osgi.factory.OsgiPluginFactory

Class Overview

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 Spring container is active
  • XML or Jar manifest configuration

Summary

Nested Classes
class OsgiPluginFactory.DefaultPluginTransformerFactory  
interface OsgiPluginFactory.PluginTransformerFactory  
Public Constructors
OsgiPluginFactory(String pluginDescriptorFileName, String applicationKey, OsgiPersistentCache persistentCache, OsgiContainerManager osgi, PluginEventManager pluginEventManager)
This constructor is deprecated. No replacement.
OsgiPluginFactory(String pluginDescriptorFileName, Set<String> applicationKeys, OsgiPersistentCache persistentCache, OsgiContainerManager osgi, PluginEventManager pluginEventManager)
Default constructor
OsgiPluginFactory(String pluginDescriptorFileName, Set<String> applicationKeys, OsgiPersistentCache persistentCache, OsgiContainerManager osgi, PluginEventManager pluginEventManager, OsgiPluginFactory.PluginTransformerFactory pluginTransformerFactory)
Constructor for implementations that want to override the DefaultPluginTransformer with a custom implementation
Public Methods
String canCreate(PluginArtifact pluginArtifact)
Determines if this factory can handle this artifact.
Plugin create(PluginArtifact pluginArtifact, ModuleDescriptorFactory moduleDescriptorFactory)
Deploys the plugin artifact
Plugin create(DeploymentUnit deploymentUnit, ModuleDescriptorFactory moduleDescriptorFactory)
This method is deprecated. Since 2.2.0, use create(PluginArtifact, ModuleDescriptorFactory) instead
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.plugin.factories.PluginFactory

Public Constructors

public OsgiPluginFactory (String pluginDescriptorFileName, String applicationKey, OsgiPersistentCache persistentCache, OsgiContainerManager osgi, PluginEventManager pluginEventManager)

This constructor is deprecated.
No replacement.

Old constructor retained for backwards compatibility

public OsgiPluginFactory (String pluginDescriptorFileName, Set<String> applicationKeys, OsgiPersistentCache persistentCache, OsgiContainerManager osgi, PluginEventManager pluginEventManager)

Default constructor

public OsgiPluginFactory (String pluginDescriptorFileName, Set<String> applicationKeys, OsgiPersistentCache persistentCache, OsgiContainerManager osgi, PluginEventManager pluginEventManager, OsgiPluginFactory.PluginTransformerFactory pluginTransformerFactory)

Constructor for implementations that want to override the DefaultPluginTransformer with a custom implementation

Public Methods

public String canCreate (PluginArtifact pluginArtifact)

Determines if this factory can handle this artifact.

Parameters
pluginArtifact The artifact to test
Returns
  • The plugin key, null if it cannot load the plugin

public Plugin create (PluginArtifact pluginArtifact, ModuleDescriptorFactory moduleDescriptorFactory)

Deploys the plugin artifact

Parameters
pluginArtifact the plugin artifact to deploy
moduleDescriptorFactory The factory for plugin modules
Returns
  • The instantiated and populated plugin
Throws
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

public Plugin create (DeploymentUnit deploymentUnit, ModuleDescriptorFactory moduleDescriptorFactory)

This method is deprecated.
Since 2.2.0, use create(PluginArtifact, ModuleDescriptorFactory) instead

Deploys the deployment unit by instantiating the plugin and configuring it. Should only be called if the respective canCreate(PluginArtifact) call returned the plugin key

Parameters
deploymentUnit the unit to deploy
moduleDescriptorFactory the factory for the module descriptors
Returns
  • the plugin loaded from the deployment unit, or an UnloadablePlugin instance if loading fails.