com.atlassian.plugin
Interface PluginAccessor

All Known Subinterfaces:
PluginManager
All Known Implementing Classes:
DefaultPluginManager

public interface PluginAccessor

Allows access to the current plugin system state


Method Summary
 java.lang.ClassLoader getClassLoader()
          Retrieve the class loader responsible for loading classes and resources from plugins.
 java.lang.Class getDynamicPluginClass(java.lang.String className)
          Deprecated. since 0.21 this method is not used, use getPlugin(String).getClassLoader().loadClass(String)
 java.io.InputStream getDynamicResourceAsStream(java.lang.String resourcePath)
          Retrieve a resource from a currently loaded (and active) dynamically loaded plugin.
 java.util.List getEnabledModuleDescriptorsByClass(java.lang.Class descriptorClazz)
          Get all enabled module descriptors that have a specific descriptor class.
 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)
          Retrieve all plugin modules that implement or extend a specific class.
 java.util.List getEnabledModulesByClassAndDescriptor(java.lang.Class[] descriptorClazz, 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 descriptorClazz, 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.
 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)
          Deprecated. since 0.21 this method is not used, use getPlugin(String).getClassLoader().getResourceAsStream(String)
 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.
 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)
           
 

Method Detail

getPlugins

java.util.Collection getPlugins()
Gets all of the currently installed plugins.

Returns:
a collection of installed Plugins.

getPlugins

java.util.Collection getPlugins(PluginPredicate pluginPredicate)
Gets all installed plugins that match the given predicate.

Parameters:
pluginPredicate - the PluginPredicate to match.
Returns:
a collection of Plugins that match the given predicate.
Since:
0.17

getEnabledPlugins

java.util.Collection getEnabledPlugins()
Get all of the currently enabled plugins.

Returns:
a collection of installed and enabled Plugins.

getModules

java.util.Collection getModules(ModuleDescriptorPredicate moduleDescriptorPredicate)
Gets all installed modules that match the given predicate.

Parameters:
moduleDescriptorPredicate - the ModuleDescriptorPredicate to match.
Returns:
a collection of modules as per ModuleDescriptor.getModule() that match the given predicate.
Since:
0.17

getModuleDescriptors

java.util.Collection getModuleDescriptors(ModuleDescriptorPredicate moduleDescriptorPredicate)
Gets all module descriptors of installed modules that match the given predicate.

Parameters:
moduleDescriptorPredicate - the ModuleDescriptorPredicate to match.
Returns:
a collection of ModuleDescriptors that match the given predicate.
Since:
0.17

getPlugin

Plugin getPlugin(java.lang.String key)
Retrieve a given plugin (whether enabled or not).

Returns:
The enabled plugin, or null if that plugin does not exist.

getEnabledPlugin

Plugin getEnabledPlugin(java.lang.String pluginKey)
Retrieve a given plugin if it is enabled.

Returns:
The enabled plugin, or null if that plugin does not exist or is disabled.

getPluginModule

ModuleDescriptor getPluginModule(java.lang.String completeKey)
Retrieve any plugin module by complete module key.

Note: the module may or may not be disabled.


getEnabledPluginModule

ModuleDescriptor getEnabledPluginModule(java.lang.String completeKey)
Retrieve an enabled plugin module by complete module key.


isPluginEnabled

boolean isPluginEnabled(java.lang.String key)
Whether or not a given plugin is currently enabled.


isPluginModuleEnabled

boolean isPluginModuleEnabled(java.lang.String completeKey)
Whether or not a given plugin module is currently enabled. This also checks if the plugin it is contained within is enabled also

See Also:
isPluginEnabled(String)

getEnabledModulesByClass

java.util.List getEnabledModulesByClass(java.lang.Class moduleClass)
Retrieve all plugin modules that implement or extend a specific class.

Returns:
List of modules that implement or extend the given class.

getEnabledModulesByClassAndDescriptor

java.util.List getEnabledModulesByClassAndDescriptor(java.lang.Class[] descriptorClazz,
                                                     java.lang.Class moduleClass)
Deprecated. since 0.17, use getModules(com.atlassian.plugin.predicate.ModuleDescriptorPredicate) with an appropriate predicate instead.

Retrieve all plugin modules that implement or extend a specific class, and has a descriptor class as one of descriptorClazz

Parameters:
descriptorClazz - @NotNull
moduleClass - @NotNull
Returns:
List of modules that implement or extend the given class. Empty list if none found

getEnabledModulesByClassAndDescriptor

java.util.List getEnabledModulesByClassAndDescriptor(java.lang.Class descriptorClazz,
                                                     java.lang.Class moduleClass)
Deprecated. since 0.17, use getModules(com.atlassian.plugin.predicate.ModuleDescriptorPredicate) with an appropriate predicate instead.

Retrieve all plugin modules that implement or extend a specific class, and has a descriptor class as the descriptorClazz

Parameters:
descriptorClazz - @NotNull
moduleClass - @NotNull
Returns:
List of modules that implement or extend the given class. Empty list if none found

getEnabledModuleDescriptorsByClass

java.util.List getEnabledModuleDescriptorsByClass(java.lang.Class descriptorClazz)
Get all enabled module descriptors that have a specific descriptor class.

Returns:
List of ModuleDescriptors that implement or extend the given class.

getEnabledModuleDescriptorsByType

java.util.List getEnabledModuleDescriptorsByType(java.lang.String type)
                                                 throws PluginParseException
Deprecated. since 0.17, use getModuleDescriptors(com.atlassian.plugin.predicate.ModuleDescriptorPredicate) with an appropriate predicate instead.

Get all enabled module descriptors that have a specific descriptor type.

Returns:
List of ModuleDescriptors that are of a given type.
Throws:
PluginParseException

getDynamicResourceAsStream

java.io.InputStream getDynamicResourceAsStream(java.lang.String resourcePath)
Retrieve a resource from a currently loaded (and active) dynamically loaded plugin. Will return the first resource found, so plugins with overlapping resource names will behave eratically.

Parameters:
resourcePath - the path to the resource to retrieve
Returns:
the dynamically loaded resource that matches that path, or null if no such resource is found

getPluginResourceAsStream

java.io.InputStream getPluginResourceAsStream(java.lang.String pluginKey,
                                              java.lang.String resourcePath)
Deprecated. since 0.21 this method is not used, use getPlugin(String).getClassLoader().getResourceAsStream(String)

Retrieve a resource from a currently loaded (and active) plugin. For statically loaded plugins, this just means pulling the resource from the PluginManager's classloader. For dynamically loaded plugins, this means retrieving the resource from the plugin's private classloader.


getDynamicPluginClass

java.lang.Class getDynamicPluginClass(java.lang.String className)
                                      throws java.lang.ClassNotFoundException
Deprecated. since 0.21 this method is not used, use getPlugin(String).getClassLoader().loadClass(String)

Retrieve a class from a currently loaded (and active) dynamically loaded plugin. Will return the first class found, so plugins with overlapping class names will behave eratically.

Parameters:
className - the name of the class to retrieve
Returns:
the dynamically loaded class that matches that name
Throws:
java.lang.ClassNotFoundException - thrown if no classes by that name could be found in any of the enabled dynamic plugins

getClassLoader

java.lang.ClassLoader getClassLoader()
Retrieve the class loader responsible for loading classes and resources from plugins.

Returns:
the class loader
Since:
0.21

isSystemPlugin

boolean isSystemPlugin(java.lang.String key)
Returns:
true if the plugin is a system plugin.


Copyright © 2008 Atlassian Pty Ltd. All Rights Reserved.