|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.atlassian.plugin.DefaultPluginManager
public class DefaultPluginManager
This implementation delegates the initiation and classloading of plugins to a
list of PluginLoaders and records the state of plugins in a PluginStateStore.
installPlugin(PluginJar) explicitly stores
the plugin via a PluginInstaller, whereas uninstall(Plugin) relies on the
underlying PluginLoader to remove the plugin if necessary.
| Field Summary |
|---|
| Fields inherited from interface com.atlassian.plugin.PluginManager |
|---|
PLUGIN_DESCRIPTOR_FILENAME |
| Constructor Summary | |
|---|---|
DefaultPluginManager(PluginStateStore store,
java.util.List pluginLoaders,
ModuleDescriptorFactory moduleDescriptorFactory)
|
|
| Method Summary | |
|---|---|
protected void |
addPlugin(PluginLoader loader,
Plugin plugin)
Update the local plugin state and enable state aware modules |
void |
disablePlugin(java.lang.String key)
Disable a plugin by key. |
void |
disablePluginModule(java.lang.String completeKey)
Disable a plugin module by key. |
protected void |
disablePluginModuleState(ModuleDescriptor module,
PluginStateStore stateStore)
|
protected void |
disablePluginState(Plugin plugin,
PluginStateStore stateStore)
|
void |
enablePlugin(java.lang.String key)
Enable a plugin by key. |
void |
enablePluginModule(java.lang.String completeKey)
Enable a plugin module by key. |
protected void |
enablePluginModuleState(ModuleDescriptor module,
PluginStateStore stateStore)
|
protected void |
enablePluginState(Plugin plugin,
PluginStateStore stateStore)
|
java.io.InputStream |
getDynamicResourceAsStream(java.lang.String name)
Retrieve a resource from a currently loaded (and active) dynamically loaded plugin. |
java.util.List |
getEnabledModuleDescriptorsByClass(java.lang.Class moduleDescriptorClass)
Deprecated. since 0.17, use getModuleDescriptors(com.atlassian.plugin.predicate.ModuleDescriptorPredicate) with an appropriate predicate instead. |
java.util.List |
getEnabledModuleDescriptorsByType(java.lang.String type)
Deprecated. since 0.17, use getModuleDescriptors(com.atlassian.plugin.predicate.ModuleDescriptorPredicate) with an appropriate predicate instead. |
java.util.List |
getEnabledModulesByClass(java.lang.Class moduleClass)
Deprecated. since 0.17, use getModules(com.atlassian.plugin.predicate.ModuleDescriptorPredicate) with an appropriate predicate instead. |
java.util.List |
getEnabledModulesByClassAndDescriptor(java.lang.Class[] descriptorClasses,
java.lang.Class moduleClass)
Deprecated. since 0.17, use getModules(com.atlassian.plugin.predicate.ModuleDescriptorPredicate) with an appropriate predicate instead. |
java.util.List |
getEnabledModulesByClassAndDescriptor(java.lang.Class descriptorClass,
java.lang.Class moduleClass)
Deprecated. since 0.17, use getModules(com.atlassian.plugin.predicate.ModuleDescriptorPredicate) with an appropriate predicate instead. |
Plugin |
getEnabledPlugin(java.lang.String pluginKey)
Retrieve a given plugin if it is enabled. |
ModuleDescriptor |
getEnabledPluginModule(java.lang.String completeKey)
Retrieve an enabled plugin module by complete module key. |
java.util.Collection |
getEnabledPlugins()
Get all of the currently enabled plugins. |
protected java.util.List |
getEnabledStateAwareModuleKeys(Plugin plugin)
|
java.util.Collection |
getModuleDescriptors(ModuleDescriptorPredicate moduleDescriptorPredicate)
Gets all module descriptors of installed modules that match the given predicate. |
java.util.Collection |
getModules(ModuleDescriptorPredicate moduleDescriptorPredicate)
Gets all installed modules that match the given predicate. |
Plugin |
getPlugin(java.lang.String key)
Retrieve a given plugin (whether enabled or not). |
ModuleDescriptor |
getPluginModule(java.lang.String completeKey)
Retrieve any plugin module by complete module key. |
java.io.InputStream |
getPluginResourceAsStream(java.lang.String pluginKey,
java.lang.String resourcePath)
Retrieve a resource from a currently loaded (and active) plugin. |
java.util.Collection |
getPlugins()
Gets all of the currently installed plugins. |
java.util.Collection |
getPlugins(PluginPredicate pluginPredicate)
Gets all installed plugins that match the given predicate. |
protected PluginManagerState |
getState()
|
protected PluginStateStore |
getStore()
|
void |
init()
Initialize all plugins in all loaders |
java.lang.String |
installPlugin(PluginJar pluginJar)
Installs a plugin and returns the plugin key |
boolean |
isPluginEnabled(java.lang.String key)
Whether or not a given plugin is currently enabled. |
boolean |
isPluginModuleEnabled(java.lang.String completeKey)
Whether or not a given plugin module is currently enabled. |
boolean |
isSystemPlugin(java.lang.String key)
|
protected void |
notifyModuleDisabled(ModuleDescriptor module)
|
protected void |
notifyModuleEnabled(ModuleDescriptor module)
|
protected void |
notifyPluginDisabled(Plugin plugin)
|
protected void |
notifyPluginEnabled(Plugin plugin)
Called on all clustered application nodes, rather than enablePlugin(String)
to just update the local state, state aware modules and loaders, but not affect the
global plugin state. |
protected void |
notifyUninstallPlugin(Plugin plugin)
|
protected void |
removeStateFromStore(PluginStateStore stateStore,
Plugin plugin)
|
int |
scanForNewPlugins()
Search all loaders and add any new plugins you find. |
void |
setDescriptorParserFactory(DescriptorParserFactory descriptorParserFactory)
|
void |
setPluginInstaller(PluginInstaller pluginInstaller)
Set the plugin installation strategy for this manager |
void |
uninstall(Plugin plugin)
Uninstall (delete) a plugin if possible. |
protected void |
unloadPlugin(Plugin plugin)
Unload a plugin. |
protected void |
updatePlugin(Plugin oldPlugin,
Plugin newPlugin)
Replace an already loaded plugin with another version. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultPluginManager(PluginStateStore store,
java.util.List pluginLoaders,
ModuleDescriptorFactory moduleDescriptorFactory)
| Method Detail |
|---|
public void init()
throws PluginParseException
init in interface PluginManagerPluginParseExceptionpublic void setPluginInstaller(PluginInstaller pluginInstaller)
pluginInstaller - PluginInstallerprotected final PluginStateStore getStore()
public java.lang.String installPlugin(PluginJar pluginJar)
throws PluginParseException
PluginController
installPlugin in interface PluginControllerPluginParseException - if the plugin is not a valid plugin
public int scanForNewPlugins()
throws PluginParseException
PluginController
scanForNewPlugins in interface PluginControllerPluginParseException
public void uninstall(Plugin plugin)
throws PluginException
uninstall in interface PluginControllerPluginException - if there was some problem uninstalling the plugin.
protected void removeStateFromStore(PluginStateStore stateStore,
Plugin plugin)
protected void unloadPlugin(Plugin plugin)
throws PluginException
PluginExceptionprotected void notifyUninstallPlugin(Plugin plugin)
protected PluginManagerState getState()
protected void addPlugin(PluginLoader loader,
Plugin plugin)
throws PluginParseException
loader - plugin -
PluginParseException
protected void updatePlugin(Plugin oldPlugin,
Plugin newPlugin)
throws PluginException
oldPlugin - Plugin to replacenewPlugin - New plugin to install
PluginExceptionpublic java.util.Collection getPlugins()
PluginAccessor
getPlugins in interface PluginAccessorPlugins.public java.util.Collection getPlugins(PluginPredicate pluginPredicate)
PluginAccessor
getPlugins in interface PluginAccessorpluginPredicate - the PluginPredicate to match.
Plugins that match the given predicate.PluginAccessor.getPlugins(PluginPredicate)public java.util.Collection getEnabledPlugins()
PluginAccessor
getEnabledPlugins in interface PluginAccessorPlugins.PluginAccessor.getEnabledPlugins()public java.util.Collection getModules(ModuleDescriptorPredicate moduleDescriptorPredicate)
PluginAccessor
getModules in interface PluginAccessormoduleDescriptorPredicate - the ModuleDescriptorPredicate to match.
ModuleDescriptor.getModule() that match the given predicate.PluginAccessor.getModules(com.atlassian.plugin.predicate.ModuleDescriptorPredicate)public java.util.Collection getModuleDescriptors(ModuleDescriptorPredicate moduleDescriptorPredicate)
PluginAccessor
getModuleDescriptors in interface PluginAccessormoduleDescriptorPredicate - the ModuleDescriptorPredicate to match.
ModuleDescriptors that match the given predicate.PluginAccessor.getModuleDescriptors(com.atlassian.plugin.predicate.ModuleDescriptorPredicate)public Plugin getPlugin(java.lang.String key)
PluginAccessor
getPlugin in interface PluginAccessorpublic Plugin getEnabledPlugin(java.lang.String pluginKey)
PluginAccessor
getEnabledPlugin in interface PluginAccessorpublic ModuleDescriptor getPluginModule(java.lang.String completeKey)
PluginAccessorNote: the module may or may not be disabled.
getPluginModule in interface PluginAccessorpublic ModuleDescriptor getEnabledPluginModule(java.lang.String completeKey)
PluginAccessor
getEnabledPluginModule in interface PluginAccessorpublic java.util.List getEnabledModulesByClass(java.lang.Class moduleClass)
getModules(com.atlassian.plugin.predicate.ModuleDescriptorPredicate) with an appropriate predicate instead.
PluginAccessor
getEnabledModulesByClass in interface PluginAccessorPluginAccessor.getEnabledModulesByClass(Class)
public java.util.List getEnabledModulesByClassAndDescriptor(java.lang.Class[] descriptorClasses,
java.lang.Class moduleClass)
getModules(com.atlassian.plugin.predicate.ModuleDescriptorPredicate) with an appropriate predicate instead.
PluginAccessor
getEnabledModulesByClassAndDescriptor in interface PluginAccessordescriptorClasses - @NotNullmoduleClass - @NotNull
PluginAccessor.getEnabledModulesByClassAndDescriptor(Class[], Class)
public java.util.List getEnabledModulesByClassAndDescriptor(java.lang.Class descriptorClass,
java.lang.Class moduleClass)
getModules(com.atlassian.plugin.predicate.ModuleDescriptorPredicate) with an appropriate predicate instead.
PluginAccessor
getEnabledModulesByClassAndDescriptor in interface PluginAccessordescriptorClass - @NotNullmoduleClass - @NotNull
PluginAccessor.getEnabledModulesByClassAndDescriptor(Class, Class)public java.util.List getEnabledModuleDescriptorsByClass(java.lang.Class moduleDescriptorClass)
getModuleDescriptors(com.atlassian.plugin.predicate.ModuleDescriptorPredicate) with an appropriate predicate instead.
PluginAccessor
getEnabledModuleDescriptorsByClass in interface PluginAccessorModuleDescriptors that implement or extend the given class.PluginAccessor.getEnabledModuleDescriptorsByClass(Class)
public java.util.List getEnabledModuleDescriptorsByType(java.lang.String type)
throws PluginParseException,
java.lang.IllegalArgumentException
getModuleDescriptors(com.atlassian.plugin.predicate.ModuleDescriptorPredicate) with an appropriate predicate instead.
PluginAccessor
getEnabledModuleDescriptorsByType in interface PluginAccessorModuleDescriptors that are of a given type.
PluginParseException
java.lang.IllegalArgumentExceptionPluginAccessor.getEnabledModuleDescriptorsByType(String)public void enablePlugin(java.lang.String key)
PluginController
enablePlugin in interface PluginController
protected void enablePluginState(Plugin plugin,
PluginStateStore stateStore)
protected void notifyPluginEnabled(Plugin plugin)
enablePlugin(String)
to just update the local state, state aware modules and loaders, but not affect the
global plugin state.
public void disablePlugin(java.lang.String key)
PluginController
disablePlugin in interface PluginController
protected void disablePluginState(Plugin plugin,
PluginStateStore stateStore)
protected java.util.List getEnabledStateAwareModuleKeys(Plugin plugin)
protected void notifyPluginDisabled(Plugin plugin)
public void disablePluginModule(java.lang.String completeKey)
PluginController
disablePluginModule in interface PluginController
protected void disablePluginModuleState(ModuleDescriptor module,
PluginStateStore stateStore)
protected void notifyModuleDisabled(ModuleDescriptor module)
public void enablePluginModule(java.lang.String completeKey)
PluginController
enablePluginModule in interface PluginController
protected void enablePluginModuleState(ModuleDescriptor module,
PluginStateStore stateStore)
protected void notifyModuleEnabled(ModuleDescriptor module)
public boolean isPluginModuleEnabled(java.lang.String completeKey)
PluginAccessor
isPluginModuleEnabled in interface PluginAccessorPluginAccessor.isPluginEnabled(String)public boolean isPluginEnabled(java.lang.String key)
PluginAccessor
isPluginEnabled in interface PluginAccessorpublic java.io.InputStream getDynamicResourceAsStream(java.lang.String name)
PluginAccessor
getDynamicResourceAsStream in interface PluginAccessorname - the path to the resource to retrieve
public java.io.InputStream getPluginResourceAsStream(java.lang.String pluginKey,
java.lang.String resourcePath)
PluginAccessor
getPluginResourceAsStream in interface PluginAccessorpublic boolean isSystemPlugin(java.lang.String key)
isSystemPlugin in interface PluginAccessorpublic void setDescriptorParserFactory(DescriptorParserFactory descriptorParserFactory)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||