com.atlassian.plugin.descriptors
Class AbstractModuleDescriptor

java.lang.Object
  extended by com.atlassian.plugin.descriptors.AbstractModuleDescriptor
All Implemented Interfaces:
ModuleDescriptor, Resourced
Direct Known Subclasses:
AbstractWebFragmentModuleDescriptor, ResourcedModuleDescriptor, ServletModuleDescriptor, UnloadableModuleDescriptor, UnrecognisedModuleDescriptor, WebResourceModuleDescriptor

public abstract class AbstractModuleDescriptor
extends java.lang.Object
implements ModuleDescriptor


Field Summary
protected  Plugin plugin
           
protected  Resources resources
           
protected  boolean singleton
           
 
Constructor Summary
AbstractModuleDescriptor()
           
 
Method Summary
protected  void assertModuleClassImplements(java.lang.Class requiredModuleClazz)
          Check that the module class of this descriptor implements a given interface, or extends a given class.
 void destroy(Plugin plugin)
          Override this if your plugin needs to clean up when it's been removed.
 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 ModuleDescriptor.getDescription() when using internationalisation.
 java.lang.String getI18nNameKey()
          Key used to override ModuleDescriptor.getName() when using internationalisation.
 java.lang.String getKey()
          The key for this module, unique within the plugin.
 java.lang.Float getMinJavaVersion()
           
abstract  java.lang.Object getModule()
          The particular module object created by this plugin.
 java.lang.Class getModuleClass()
          The class of the module this descriptor creates.
 java.lang.String getName()
          A simple string name for this descriptor.
 java.util.Map getParams()
           
 Plugin getPlugin()
           
 java.lang.String getPluginKey()
          The plugin key for this module, derived from the complete key
 ResourceDescriptor getResourceDescriptor(java.lang.String type, java.lang.String name)
          Deprecated.  
 java.util.List getResourceDescriptors()
           
 java.util.List getResourceDescriptors(java.lang.String type)
           
 ResourceLocation getResourceLocation(java.lang.String type, java.lang.String name)
           
 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 isSingleton()
           
protected  boolean isSingletonByDefault()
          Override this method if you want your module descriptor to be or not be a singleton by default.
 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
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

plugin

protected Plugin plugin

singleton

protected boolean singleton

resources

protected Resources resources
Constructor Detail

AbstractModuleDescriptor

public AbstractModuleDescriptor()
Method Detail

init

public void init(Plugin plugin,
                 org.dom4j.Element element)
          throws PluginParseException
Description copied from interface: ModuleDescriptor
Initialise a module given it's parent plugin and the XML element representing the module.

Specified by:
init in interface ModuleDescriptor
Throws:
PluginParseException

destroy

public void destroy(Plugin plugin)
Override this if your plugin needs to clean up when it's been removed.

Specified by:
destroy in interface ModuleDescriptor

isEnabledByDefault

public boolean isEnabledByDefault()
Description copied from interface: ModuleDescriptor
Whether or not this plugin module is enabled by default.

Specified by:
isEnabledByDefault in interface ModuleDescriptor
Returns:

isSystemModule

public boolean isSystemModule()
Description copied from interface: ModuleDescriptor
Whether or not this plugin module is a "system" plugin that shouldn't be made visible/disableable to the user

Specified by:
isSystemModule in interface ModuleDescriptor
Returns:

isSingleton

public boolean isSingleton()

isSingletonByDefault

protected boolean isSingletonByDefault()
Override this method if you want your module descriptor to be or not be a singleton by default.

Default is "true" - ie all plugin modules are singletons by default.


assertModuleClassImplements

protected final void assertModuleClassImplements(java.lang.Class requiredModuleClazz)
                                          throws PluginParseException
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.

getCompleteKey

public java.lang.String getCompleteKey()
Description copied from interface: ModuleDescriptor
The complete key for this module, including the plugin key.

Format is plugin.key:module.key

Specified by:
getCompleteKey in interface ModuleDescriptor

getPluginKey

public java.lang.String getPluginKey()
Description copied from interface: ModuleDescriptor
The plugin key for this module, derived from the complete key

Specified by:
getPluginKey in interface ModuleDescriptor

getKey

public java.lang.String getKey()
Description copied from interface: ModuleDescriptor
The key for this module, unique within the plugin.

Specified by:
getKey in interface ModuleDescriptor

getName

public java.lang.String getName()
Description copied from interface: ModuleDescriptor
A simple string name for this descriptor.

Specified by:
getName in interface ModuleDescriptor

getModuleClass

public java.lang.Class getModuleClass()
Description copied from interface: ModuleDescriptor
The class of the module this descriptor creates.

Specified by:
getModuleClass in interface ModuleDescriptor

getModule

public abstract java.lang.Object getModule()
Description copied from interface: ModuleDescriptor
The particular module object created by this plugin.

Specified by:
getModule in interface ModuleDescriptor

getDescription

public java.lang.String getDescription()
Description copied from interface: ModuleDescriptor
A simple description of this descriptor.

Specified by:
getDescription in interface ModuleDescriptor

getParams

public java.util.Map getParams()
Specified by:
getParams in interface ModuleDescriptor

getI18nNameKey

public java.lang.String getI18nNameKey()
Description copied from interface: ModuleDescriptor
Key used to override ModuleDescriptor.getName() when using internationalisation.

Specified by:
getI18nNameKey in interface ModuleDescriptor
Returns:
the i18n key. May be null.

getDescriptionKey

public java.lang.String getDescriptionKey()
Description copied from interface: ModuleDescriptor
Key used to override ModuleDescriptor.getDescription() when using internationalisation.

Specified by:
getDescriptionKey in interface ModuleDescriptor
Returns:
the i18n key. May be null.

getResourceDescriptors

public java.util.List getResourceDescriptors()
Specified by:
getResourceDescriptors in interface Resourced

getResourceDescriptors

public java.util.List getResourceDescriptors(java.lang.String type)
Specified by:
getResourceDescriptors in interface Resourced

getResourceLocation

public ResourceLocation getResourceLocation(java.lang.String type,
                                            java.lang.String name)
Specified by:
getResourceLocation in interface Resourced

getResourceDescriptor

public ResourceDescriptor getResourceDescriptor(java.lang.String type,
                                                java.lang.String name)
Deprecated. 

Specified by:
getResourceDescriptor in interface Resourced

getMinJavaVersion

public java.lang.Float getMinJavaVersion()
Specified by:
getMinJavaVersion in interface ModuleDescriptor

satisfiesMinJavaVersion

public boolean satisfiesMinJavaVersion()
Description copied from interface: ModuleDescriptor
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.

Specified by:
satisfiesMinJavaVersion in interface ModuleDescriptor
Returns:
true if satisfied, false otherwise.

setPlugin

public void setPlugin(Plugin plugin)
Sets the plugin for the ModuleDescriptor


getPlugin

public Plugin getPlugin()
Specified by:
getPlugin in interface ModuleDescriptor
Returns:
The plugin this module descriptor is associated with

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2008 Atlassian Pty Ltd. All Rights Reserved.