com.atlassian.plugin
Interface Plugin

All Superinterfaces:
java.lang.Comparable<Plugin>, Resourced
All Known Subinterfaces:
DynamicPlugin
All Known Implementing Classes:
AbstractPlugin, DefaultDynamicPlugin, StaticPlugin, UnloadablePlugin, XmlDynamicPlugin

public interface Plugin
extends Resourced, java.lang.Comparable<Plugin>


Field Summary
static java.util.Comparator NAME_COMPARATOR
           
 
Method Summary
 void addModuleDescriptor(ModuleDescriptor<?> moduleDescriptor)
           
 void close()
          Free any resources held by this plugin.
 boolean containsSystemModule()
           
 java.lang.ClassLoader getClassLoader()
          Get the classloader for the plugin.
 java.util.Date getDateLoaded()
          The date this plugin was loaded into the system.
 java.lang.String getI18nNameKey()
           
 java.lang.String getKey()
           
 ModuleDescriptor<?> getModuleDescriptor(java.lang.String key)
           
 java.util.Collection<ModuleDescriptor<?>> getModuleDescriptors()
           
<T> java.util.List<ModuleDescriptor<T>>
getModuleDescriptorsByModuleClass(java.lang.Class<T> aClass)
           
 java.lang.String getName()
           
 PluginInformation getPluginInformation()
           
 int getPluginsVersion()
          Gets the version of the plugins system to handle this plugin
 java.net.URL getResource(java.lang.String path)
          Retrieve the URL of the resource from the plugin.
 java.io.InputStream getResourceAsStream(java.lang.String name)
          Load a given resource from the plugin.
 boolean isBundledPlugin()
          Whether the plugin is a "bundled" plugin that can't be removed.
 boolean isDeleteable()
          Should the plugin file be deleted on unistall?
 boolean isDynamicallyLoaded()
          Whether or not this plugin is loaded dynamically at runtime
 boolean isEnabled()
           
 boolean isEnabledByDefault()
           
 boolean isSystemPlugin()
          Whether the plugin is a "system" plugin that shouldn't be made visible to the user
 boolean isUninstallable()
          Whether or not this plugin can be 'uninstalled'.
 java.lang.Class<?> loadClass(java.lang.String clazz, java.lang.Class<?> callingClass)
          Get the plugin to load a specific class.
 void setEnabled(boolean enabled)
           
 void setEnabledByDefault(boolean enabledByDefault)
           
 void setI18nNameKey(java.lang.String i18nNameKey)
           
 void setKey(java.lang.String aPackage)
           
 void setName(java.lang.String name)
           
 void setPluginInformation(PluginInformation pluginInformation)
           
 void setPluginsVersion(int version)
          Sets the version of the plugins system
 void setResources(Resourced resources)
           
 void setSystemPlugin(boolean system)
           
 
Methods inherited from interface com.atlassian.plugin.Resourced
getResourceDescriptor, getResourceDescriptors, getResourceDescriptors, getResourceLocation
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

NAME_COMPARATOR

static final java.util.Comparator NAME_COMPARATOR
Method Detail

getPluginsVersion

int getPluginsVersion()
Gets the version of the plugins system to handle this plugin

Returns:
The plugins version. If undefined, assumed to be 1.

setPluginsVersion

void setPluginsVersion(int version)
Sets the version of the plugins system

Parameters:
version - The version

getName

java.lang.String getName()

setName

void setName(java.lang.String name)

getI18nNameKey

java.lang.String getI18nNameKey()

setI18nNameKey

void setI18nNameKey(java.lang.String i18nNameKey)

getKey

java.lang.String getKey()

setKey

void setKey(java.lang.String aPackage)

addModuleDescriptor

void addModuleDescriptor(ModuleDescriptor<?> moduleDescriptor)

getModuleDescriptors

java.util.Collection<ModuleDescriptor<?>> getModuleDescriptors()

getModuleDescriptor

ModuleDescriptor<?> getModuleDescriptor(java.lang.String key)

getModuleDescriptorsByModuleClass

<T> java.util.List<ModuleDescriptor<T>> getModuleDescriptorsByModuleClass(java.lang.Class<T> aClass)

isEnabledByDefault

boolean isEnabledByDefault()

setEnabledByDefault

void setEnabledByDefault(boolean enabledByDefault)

getPluginInformation

PluginInformation getPluginInformation()

setPluginInformation

void setPluginInformation(PluginInformation pluginInformation)

setResources

void setResources(Resourced resources)

isEnabled

boolean isEnabled()

setEnabled

void setEnabled(boolean enabled)

isSystemPlugin

boolean isSystemPlugin()
Whether the plugin is a "system" plugin that shouldn't be made visible to the user


containsSystemModule

boolean containsSystemModule()

setSystemPlugin

void setSystemPlugin(boolean system)

isBundledPlugin

boolean isBundledPlugin()
Whether the plugin is a "bundled" plugin that can't be removed.


getDateLoaded

java.util.Date getDateLoaded()
The date this plugin was loaded into the system.


isUninstallable

boolean isUninstallable()
Whether or not this plugin can be 'uninstalled'.


isDeleteable

boolean isDeleteable()
Should the plugin file be deleted on unistall?


isDynamicallyLoaded

boolean isDynamicallyLoaded()
Whether or not this plugin is loaded dynamically at runtime


loadClass

java.lang.Class<?> loadClass(java.lang.String clazz,
                             java.lang.Class<?> callingClass)
                             throws java.lang.ClassNotFoundException
Get the plugin to load a specific class.

Parameters:
clazz - The name of the class to be loaded
callingClass - The class calling the loading (used to help find a classloader)
Returns:
The loaded class.
Throws:
java.lang.ClassNotFoundException

getClassLoader

java.lang.ClassLoader getClassLoader()
Get the classloader for the plugin.

Returns:
The classloader used to load classes for this plugin

getResource

java.net.URL getResource(java.lang.String path)
Retrieve the URL of the resource from the plugin.

Parameters:
path - the name of the resource to be loaded
Returns:
The URL to the resource, or null if the resource is not found

getResourceAsStream

java.io.InputStream getResourceAsStream(java.lang.String name)
Load a given resource from the plugin. Plugins that are loaded dynamically will need to implement this in a way that loads the resource from the same context as the plugin. Static plugins can just pull them from their own classloader.

Parameters:
name - The name of the resource to be loaded.
Returns:
An InputStream for the resource, or null if the resource is not found.

close

void close()
Free any resources held by this plugin. To be called during uninstallation of the Plugin.



Copyright © 2008 Atlassian Pty Ltd. All Rights Reserved.