com.atlassian.plugin.osgi.factory
Class OsgiPluginFactory

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

public final class OsgiPluginFactory
extends AbstractPluginFactory

Plugin loader that starts an OSGi container and loads plugins into it, wrapped as OSGi bundles. Supports


Nested Class Summary
static class OsgiPluginFactory.DefaultPluginTransformerFactory
           
static interface OsgiPluginFactory.PluginTransformerFactory
           
 
Field Summary
 
Fields inherited from class com.atlassian.plugin.factories.AbstractPluginFactory
descriptorParserFactory
 
Constructor Summary
OsgiPluginFactory(String pluginDescriptorFileName, Set<Application> applications, OsgiPersistentCache persistentCache, OsgiContainerManager osgi, PluginEventManager pluginEventManager)
          Default constructor
OsgiPluginFactory(String pluginDescriptorFileName, Set<Application> applications, OsgiPersistentCache persistentCache, OsgiContainerManager osgi, PluginEventManager pluginEventManager, OsgiPluginFactory.PluginTransformerFactory pluginTransformerFactory)
          Constructor for implementations that want to override the DefaultPluginTransformer with a custom implementation
 
Method Summary
 String canCreate(PluginArtifact pluginArtifact)
          Determines if this deployer can handle this artifact by looking for the plugin descriptor
 Plugin create(PluginArtifact pluginArtifact, ModuleDescriptorFactory moduleDescriptorFactory)
          Deploys the plugin artifact.
protected  InputStream getDescriptorInputStream(PluginArtifact pluginArtifact)
           
protected  com.google.common.base.Predicate<Integer> isValidPluginsVersion()
           
 
Methods inherited from class com.atlassian.plugin.factories.AbstractPluginFactory
create, getPluginKeyFromDescriptor, hasDescriptor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OsgiPluginFactory

public OsgiPluginFactory(String pluginDescriptorFileName,
                         Set<Application> applications,
                         OsgiPersistentCache persistentCache,
                         OsgiContainerManager osgi,
                         PluginEventManager pluginEventManager)
Default constructor


OsgiPluginFactory

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

Method Detail

canCreate

public String canCreate(PluginArtifact pluginArtifact)
                 throws PluginParseException
Description copied from class: AbstractPluginFactory
Determines if this deployer can handle this artifact by looking for the plugin descriptor

Specified by:
canCreate in interface PluginFactory
Overrides:
canCreate in class AbstractPluginFactory
Parameters:
pluginArtifact - The artifact to test
Returns:
The plugin key, null if it cannot load the plugin
Throws:
PluginParseException - If there are exceptions parsing the plugin configuration when the deployer should have been able to deploy the plugin

getDescriptorInputStream

protected InputStream getDescriptorInputStream(PluginArtifact pluginArtifact)
Specified by:
getDescriptorInputStream in class AbstractPluginFactory

isValidPluginsVersion

protected com.google.common.base.Predicate<Integer> isValidPluginsVersion()
Specified by:
isValidPluginsVersion in class AbstractPluginFactory

create

public Plugin create(PluginArtifact pluginArtifact,
                     ModuleDescriptorFactory moduleDescriptorFactory)
              throws PluginParseException
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:
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


Copyright © 2015 Atlassian. All rights reserved.