public abstract class

AbstractModuleDescriptor

extends Object
implements ModuleDescriptor<T> StateAware
java.lang.Object
   ↳ com.atlassian.plugin.descriptors.AbstractModuleDescriptor<T>
Known Direct Subclasses
Known Indirect Subclasses

Summary

Fields
protected String moduleClassName
protected final ModuleFactory moduleFactory
protected Plugin plugin
protected Resources resources
protected boolean singleton This field is deprecated. since 2.2.0
Public Constructors
AbstractModuleDescriptor(ModuleFactory moduleFactory)
AbstractModuleDescriptor()
Public Methods
void destroy(Plugin plugin)
Override this if your plugin needs to clean up when it's been removed.
void disabled()
Disables the module descriptor.
void enabled()
Enables the descriptor by loading the module class.
String getCompleteKey()
The complete key for this module, including the plugin key.
String getDescription()
A simple description of this descriptor.
String getDescriptionKey()
Key used to override getDescription() when using internationalisation.
String getI18nNameKey()
Key used to override getName() when using internationalisation.
String getKey()
The key for this module, unique within the plugin.
Float getMinJavaVersion()
abstract T getModule()
The particular module object created by this plugin.
Class<T> getModuleClass()
The class of the module this descriptor creates.
String getName()
A simple string name for this descriptor.
Map<StringString> getParams()
Plugin getPlugin()
String getPluginKey()
The plugin key for this module, derived from the complete key.
ResourceDescriptor getResourceDescriptor(String type, String name)
Get a ResourceDescriptor of a particular type and name.
List<ResourceDescriptor> getResourceDescriptors()
Get a List of all the descriptors .
List<ResourceDescriptor> getResourceDescriptors(String type)
Get a list of all descriptors of a particular type.
ResourceLocation getResourceLocation(String type, String name)
Get a ResourceLocation of a particular type and name.
void init(Plugin plugin, Element element)
Initialise a module given it's parent plugin and the XML element representing the module.
boolean isEnabledByDefault()
Whether or not this plugin module is enabled by default.
boolean isSingleton()
This method is deprecated. Since 2.2.0
boolean isSystemModule()
Whether or not this plugin module is a "system" plugin that shouldn't be made visible/disableable to the user.
boolean satisfiesMinJavaVersion()
If a min java version has been specified this will return true if the running jvm is >= to the specified version.
void setPlugin(Plugin plugin)
Sets the plugin for the ModuleDescriptor
String toString()
Protected Methods
final void assertModuleClassImplements(Class<T> requiredModuleClazz)
Check that the module class of this descriptor implements a given interface, or extends a given class.
boolean isSingletonByDefault()
This method is deprecated. Since 2.2.0
void loadClass(Plugin plugin, String clazz)
Loads the module class that this descriptor provides, and will not necessarily be the implementation class.
void loadClass(Plugin plugin, Element element)
This method is deprecated. Since 2.1.0, use loadClass(Plugin, String) instead
void provideValidationRules(ValidationPattern pattern)
Provides validation rules for the pattern
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.plugin.ModuleDescriptor
From interface com.atlassian.plugin.Resourced
From interface com.atlassian.plugin.StateAware

Fields

protected String moduleClassName

protected final ModuleFactory moduleFactory

protected Plugin plugin

protected Resources resources

protected boolean singleton

This field is deprecated.
since 2.2.0

Public Constructors

public AbstractModuleDescriptor (ModuleFactory moduleFactory)

public AbstractModuleDescriptor ()

Public Methods

public void destroy (Plugin plugin)

Override this if your plugin needs to clean up when it's been removed.

Parameters
plugin TODO: The plugin parameter is redundant. The ModuleDescriptor must know its parent plugin in order to implement getPlugin()

public void disabled ()

Disables the module descriptor. Classes overriding this method MUST call super.disabled() after their own disabling code.

public void enabled ()

Enables the descriptor by loading the module class. Classes overriding this method MUST call super.enabled() before their own enabling code.

public String getCompleteKey ()

The complete key for this module, including the plugin key.

Format is plugin.key:module.key

Returns
  • The complete key for this module.

public String getDescription ()

A simple description of this descriptor.

Returns
  • The description for this ModuleDescriptor.

public String getDescriptionKey ()

Key used to override getDescription() when using internationalisation.

Returns
  • the i18n key. May be null.

public String getI18nNameKey ()

Key used to override getName() when using internationalisation.

Returns
  • the i18n key. May be null.

public String getKey ()

The key for this module, unique within the plugin.

Returns
  • The key for this module.

public Float getMinJavaVersion ()

public abstract T getModule ()

The particular module object created by this plugin.

Returns
  • The module object created by this plugin.

public Class<T> getModuleClass ()

The class of the module this descriptor creates.

Returns
  • The class of the module this descriptor creates.

public String getName ()

A simple string name for this descriptor.

Returns
  • The name for this ModuleDescriptor.

public Map<StringString> getParams ()

public Plugin getPlugin ()

Returns
  • The plugin this module descriptor is associated with

public String getPluginKey ()

The plugin key for this module, derived from the complete key.

Returns
  • The plugin key for this module.

public ResourceDescriptor getResourceDescriptor (String type, String name)

Get a ResourceDescriptor of a particular type and name.

Returns
  • the specified resource descriptor if found, null otherwise.

public List<ResourceDescriptor> getResourceDescriptors ()

Get a List of all the descriptors .

Note: since 2.2 this list must be immutable, previously modifying this list could modify the underlying list.

Returns
  • all resource descriptors this object supports.

public List<ResourceDescriptor> getResourceDescriptors (String type)

Get a list of all descriptors of a particular type.

Note: since 2.2 this list must be immutable, previously this list was modifiable but modifications would not be reflected in the underlying list.

Returns
  • all resource descriptors this object supports.

public ResourceLocation getResourceLocation (String type, String name)

Get a ResourceLocation of a particular type and name.

Returns
  • the specified resource location if found, null otherwise.

public void init (Plugin plugin, Element element)

Initialise a module given it's parent plugin and the XML element representing the module.

Since atlassian-plugins v2.2, you can no longer load classes from the plugin in this method, because the OSGi bundle that they will live in is not built yet. Load classes in the enabled() method instead.

Parameters
plugin The plugin that the module belongs to. Must not be null.
element XML element representing the module. Must not be null.

public boolean isEnabledByDefault ()

Whether or not this plugin module is enabled by default.

Returns
  • true if this plugin module is enabled by default.

public boolean isSingleton ()

This method is deprecated.
Since 2.2.0

public boolean isSystemModule ()

Whether or not this plugin module is a "system" plugin that shouldn't be made visible/disableable to the user.

Returns
  • true if this plugin module is a "system" plugin that shouldn't be made visible/disableable to the user.

public boolean satisfiesMinJavaVersion ()

If a min java version has been specified this will return true if the running jvm is >= to the specified version. If this is not set then it is treated as not having a preference.

Returns
  • true if satisfied, false otherwise.

public void setPlugin (Plugin plugin)

Sets the plugin for the ModuleDescriptor

public String toString ()

Protected Methods

protected final void assertModuleClassImplements (Class<T> requiredModuleClazz)

Check that the module class of this descriptor implements a given interface, or extends a given class.

Parameters
requiredModuleClazz The class this module's class must implement or extend.
Throws
PluginParseException If the module class does not implement or extend the given class.

protected boolean isSingletonByDefault ()

This method is deprecated.
Since 2.2.0

protected void loadClass (Plugin plugin, String clazz)

Loads the module class that this descriptor provides, and will not necessarily be the implementation class. Override this for module descriptors whose type cannot be determined via generics.

Parameters
clazz The module class name to load
Throws
IllegalStateException If the module class cannot be determined and the descriptor doesn't define a module type via generics
PluginParseException

protected void loadClass (Plugin plugin, Element element)

This method is deprecated.
Since 2.1.0, use loadClass(Plugin, String) instead

Override this for module descriptors which don't expect to be able to load a class successfully

protected void provideValidationRules (ValidationPattern pattern)

Provides validation rules for the pattern

Parameters
pattern The validation pattern