|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Plugin
Field Summary | |
---|---|
static java.util.Comparator<Plugin> |
NAME_COMPARATOR
Deprecated. since 2.2.0. This comparator only takes into account the plugin name and assumes it is not null, yet a) that constraint is not validated anywhere in plugin loading and b) the plugin could have used the i18n name, and only the application can resolve that to a name useful for comparisons. |
Method Summary | ||
---|---|---|
void |
addModuleDescriptor(ModuleDescriptor<?> moduleDescriptor)
|
|
void |
close()
Deprecated. Since 2.2.0, use uninstall() instead |
|
boolean |
containsSystemModule()
|
|
void |
disable()
Disables the plugin. |
|
void |
enable()
Enables the plugin. |
|
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()
Returns the i18nKey used to get an internationalised name for this plugin. |
|
java.lang.String |
getKey()
|
|
ModuleDescriptor<?> |
getModuleDescriptor(java.lang.String key)
Get the ModuleDescriptor for a particular key. |
|
java.util.Collection<ModuleDescriptor<?>> |
getModuleDescriptors()
Get the Collection of descriptors . |
|
|
getModuleDescriptorsByModuleClass(java.lang.Class<M> moduleClass)
Get the descriptors whose module class implements or is assignable from the supplied Class . |
|
java.lang.String |
getName()
Returns the non-localised name of this plugin if defined. |
|
PluginInformation |
getPluginInformation()
|
|
PluginState |
getPluginState()
Returns this plugin's current state. |
|
int |
getPluginsVersion()
Gets the version of the plugins system to handle this plugin |
|
java.util.Set<java.lang.String> |
getRequiredPlugins()
|
|
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. |
|
void |
install()
Installs the plugin into any internal, managing container. |
|
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()
Deprecated. since 2.2.0, use getPluginState() instead |
|
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'. |
|
|
loadClass(java.lang.String clazz,
java.lang.Class<?> callingClass)
Get the plugin to load a specific class. |
|
void |
setEnabled(boolean enabled)
Deprecated. Since 2.2.0, use enable() or disable() instead |
|
void |
setEnabledByDefault(boolean enabledByDefault)
|
|
void |
setI18nNameKey(java.lang.String i18nNameKey)
Sets the i18nKey used to get an internationalised name for this plugin. |
|
void |
setKey(java.lang.String aPackage)
|
|
void |
setName(java.lang.String name)
Sets the non-localised name of this plugin. |
|
void |
setPluginInformation(PluginInformation pluginInformation)
|
|
void |
setPluginsVersion(int version)
Sets the version of the plugins system |
|
void |
setResources(Resourced resources)
|
|
void |
setSystemPlugin(boolean system)
|
|
void |
uninstall()
Uninstalls the plugin from any internal container. |
Methods inherited from interface com.atlassian.plugin.Resourced |
---|
getResourceDescriptor, getResourceDescriptors, getResourceDescriptors, getResourceLocation |
Methods inherited from interface java.lang.Comparable |
---|
compareTo |
Field Detail |
---|
static final java.util.Comparator<Plugin> NAME_COMPARATOR
Method Detail |
---|
int getPluginsVersion()
void setPluginsVersion(int version)
version
- The versionjava.lang.String getName()
This corresponds to the value of the name
field in the plugin's XML configuration file.
You would expect a plugin developer to fill in one of either name
, or i18n-name-key
,
but the framework does no validation and makes no guarantees that this is the case.
getI18nNameKey()
void setName(java.lang.String name)
name
- the name.getName()
java.lang.String getI18nNameKey()
This corresponds to the value of the i18n-name-key
field in the plugin's XML configuration file.
You would expect a plugin developer to fill in one of either name
, or i18n-name-key
,
but the framework does no validation and makes no guarantees that this is the case.
getName()
void setI18nNameKey(java.lang.String i18nNameKey)
i18nNameKey
- the i18n Name Key.getI18nNameKey()
java.lang.String getKey()
void setKey(java.lang.String aPackage)
void addModuleDescriptor(ModuleDescriptor<?> moduleDescriptor)
java.util.Collection<ModuleDescriptor<?>> getModuleDescriptors()
Collection
of descriptors
.
The iteration order of the collection is the order that the modules will be enabled, and should be the same order that the modules appear in the plugin descriptor.
ModuleDescriptor<?> getModuleDescriptor(java.lang.String key)
ModuleDescriptor
for a particular key. Returns null if the plugin does not exist.
Note: The ModuleDescriptor.getModule()
may throw ClassCastException
if the expected type is incorrect.
key
- the String
complete key of the module, in the form "org.example.plugin:module-key".
ModuleDescriptor
of the expected type.<M> java.util.List<ModuleDescriptor<M>> getModuleDescriptorsByModuleClass(java.lang.Class<M> moduleClass)
descriptors
whose module class implements or is assignable from the supplied Class
.
Note: The ModuleDescriptor.getModule()
may throw ClassCastException
if the expected type is incorrect.
Normally this method would not be supplied with anything other than Object
or <?>, unless you are
confident in the super type of the module classes this Plugin
provides.
M
- The expected module type of the returned descriptors
.moduleClass
- the super class
the descriptors
return.
List
of descriptors
of the expected type.boolean isEnabledByDefault()
void setEnabledByDefault(boolean enabledByDefault)
PluginInformation getPluginInformation()
void setPluginInformation(PluginInformation pluginInformation)
void setResources(Resourced resources)
PluginState getPluginState()
boolean isEnabled()
getPluginState()
instead
true
if this plugin is enabled.boolean isSystemPlugin()
true
if this plugin is a "system" plugin.void setSystemPlugin(boolean system)
boolean containsSystemModule()
boolean isBundledPlugin()
true
if this plugin is a "bundled" plugin.java.util.Date getDateLoaded()
boolean isUninstallable()
true
if this plugin can be 'uninstalled'.boolean isDeleteable()
true
if this plugin file should be deleted on unistall.boolean isDynamicallyLoaded()
true
if this plugin is loaded dynamically at runtime.<T> java.lang.Class<T> loadClass(java.lang.String clazz, java.lang.Class<?> callingClass) throws java.lang.ClassNotFoundException
clazz
- The name of the class to be loadedcallingClass
- The class calling the loading (used to help find a classloader)
java.lang.ClassNotFoundException
- if the class cannot be located.java.lang.ClassLoader getClassLoader()
java.net.URL getResource(java.lang.String path)
path
- the name of the resource to be loaded
java.io.InputStream getResourceAsStream(java.lang.String name)
name
- The name of the resource to be loaded.
void setEnabled(boolean enabled)
enable()
or disable()
instead
enabled
- new enabled statevoid close()
uninstall()
instead
Plugin
.
void install() throws PluginException
PluginState.INSTALLED
state. If the plugin is already
in the PluginState.INSTALLED
state, nothing will happen.
PluginException
- If the plugin could not be installedvoid uninstall() throws PluginException
PluginState.UNINSTALLED
state. If the plugin is already
in the PluginState.UNINSTALLED
state, nothing will happen.
PluginException
- If the plugin could not be uninstalledvoid enable() throws PluginException
PluginState.ENABLING
or PluginState.ENABLED
state. If the plugin is already in the
PluginState.ENABLING
or PluginState.ENABLED
state, nothing will happen.
PluginException
- If the plugin could not be enabledvoid disable() throws PluginException
PluginState.DISABLED
state. If the plugin is already in the PluginState.DISABLED
state, nothing will happen.
PluginException
- If the plugin could not be disabledjava.util.Set<java.lang.String> getRequiredPlugins()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |