com.atlassian.plugin
Interface ModuleDescriptor<T>

All Superinterfaces:
Resourced
All Known Implementing Classes:
AbstractModuleDescriptor, BaseServletModuleDescriptor, ComponentImportModuleDescriptor, ComponentModuleDescriptor, DescribedModuleTypeModuleDescriptor, DownloadStrategyModuleDescriptor, EventListenerModuleDescriptor, ModuleTypeModuleDescriptor, ResourcedModuleDescriptor, ServletContextListenerModuleDescriptor, ServletContextParamModuleDescriptor, ServletFilterModuleDescriptor, ServletModuleDescriptor, UnloadableModuleDescriptor, UnrecognisedModuleDescriptor, UnrecognisedModuleDescriptorRequiringRestart

public interface ModuleDescriptor<T>
extends Resourced


Method Summary
 void destroy(Plugin plugin)
          Override this if your plugin needs to clean up when it's been removed.
 boolean equals(java.lang.Object obj)
          Compares the specified object with this module descriptor for equality.
 java.lang.String getCompleteKey()
          The complete key for this module, including the plugin key.
 java.lang.String getDescription()
          A simple description of this descriptor.
 java.lang.String getDescriptionKey()
          Key used to override getDescription() when using internationalisation.
 java.lang.String getI18nNameKey()
          Key used to override getName() when using internationalisation.
 java.lang.String getKey()
          The key for this module, unique within the plugin.
 java.lang.Float getMinJavaVersion()
           
 T getModule()
          The particular module object created by this plugin.
 java.lang.Class<T> getModuleClass()
          The class of the module this descriptor creates.
 java.lang.String getName()
          A simple string name for this descriptor.
 java.util.Map<java.lang.String,java.lang.String> getParams()
           
 Plugin getPlugin()
           
 java.lang.String getPluginKey()
          The plugin key for this module, derived from the complete key.
 int hashCode()
          Returns the hash code value for this module descriptor.
 void init(Plugin plugin, org.dom4j.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 isSystemModule()
          Whether or not this plugin module is a "system" module that shouldn't be made visible/disable-able 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.
 
Methods inherited from interface com.atlassian.plugin.Resourced
getResourceDescriptor, getResourceDescriptors, getResourceDescriptors, getResourceLocation
 

Method Detail

getCompleteKey

java.lang.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.
See Also:
getKey(), getPluginKey()

getPluginKey

java.lang.String getPluginKey()
The plugin key for this module, derived from the complete key.

Returns:
The plugin key for this module.
See Also:
getKey(), getCompleteKey()

getKey

java.lang.String getKey()
The key for this module, unique within the plugin.

Returns:
The key for this module.
See Also:
getCompleteKey(), getPluginKey()

getName

java.lang.String getName()
A simple string name for this descriptor.

Returns:
The name for this ModuleDescriptor.

getDescription

java.lang.String getDescription()
A simple description of this descriptor.

Returns:
The description for this ModuleDescriptor.

getModuleClass

java.lang.Class<T> getModuleClass()
The class of the module this descriptor creates.

Returns:
The class of the module this descriptor creates.
See Also:
getModule()

getModule

T getModule()
The particular module object created by this plugin.

Returns:
The module object created by this plugin.
See Also:
getModuleClass()

init

void init(@NotNull
          Plugin plugin,
          @NotNull
          org.dom4j.Element element)
          throws PluginParseException
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 AbstractModuleDescriptor.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.
Throws:
PluginParseException - Can be thrown if an error occurs while parsing the XML element.

isEnabledByDefault

boolean isEnabledByDefault()
Whether or not this plugin module is enabled by default.

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

isSystemModule

boolean isSystemModule()
Whether or not this plugin module is a "system" module that shouldn't be made visible/disable-able to the user. System plugin modules also don't have their permissions checked, as they may be created dynamically in response to another, more safe module

Returns:
true if this plugin module is a "system" plugin that shouldn't be made visible/disable-able to the user.

destroy

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()

getMinJavaVersion

java.lang.Float getMinJavaVersion()

satisfiesMinJavaVersion

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.

getParams

java.util.Map<java.lang.String,java.lang.String> getParams()

getI18nNameKey

java.lang.String getI18nNameKey()
Key used to override getName() when using internationalisation.

Returns:
the i18n key. May be null.

getDescriptionKey

java.lang.String getDescriptionKey()
Key used to override getDescription() when using internationalisation.

Returns:
the i18n key. May be null.

getPlugin

Plugin getPlugin()
Returns:
The plugin this module descriptor is associated with

equals

boolean equals(java.lang.Object obj)

Compares the specified object with this module descriptor for equality.

Returns true if the given object is also a module descriptor and the two descriptors have the same "complete key" as determined by getCompleteKey().

This ensures that the equals method works properly across different implementations of the ModuleDescriptor interface.

Overrides:
equals in class java.lang.Object
Parameters:
obj - object to be compared for equality with this module descriptor.
Returns:
true if the specified object is equal to this module descriptor.
Since:
2.8.0

hashCode

int hashCode()
Returns the hash code value for this module descriptor. The hash code of a module descriptor d is defined to be:
     getCompleteKey() == null ? 0 : getCompleteKey().hashCode()
 
This ensures that d1.equals(d2) implies that d1.hashCode()==d2.hashCode() for any two Module Descriptors d1 and d2, as required by the general contract of Object.hashCode.

Overrides:
hashCode in class java.lang.Object
Returns:
the hash code value for this module descriptor.
Since:
2.8.0
See Also:
Object.hashCode(), Object.equals(Object), equals(Object)


Copyright © 2013 Atlassian. All Rights Reserved.