com.atlassian.plugin.web.descriptors
Class DefaultAbstractWebFragmentModuleDescriptor<T>

java.lang.Object
  extended by com.atlassian.plugin.web.descriptors.DefaultAbstractWebFragmentModuleDescriptor<T>
All Implemented Interfaces:
ModuleDescriptor<T>, Resourced, StateAware, ConditionalDescriptor, ContextAware, WebFragmentModuleDescriptor<T>, WeightedDescriptor

public class DefaultAbstractWebFragmentModuleDescriptor<T>
extends Object
implements StateAware, WebFragmentModuleDescriptor<T>

Wrapper for WebFragmentModuleDescriptor, so that it could be extended by application specific wrappers to provide additional methods.


Field Summary
 
Fields inherited from interface com.atlassian.plugin.web.descriptors.WebFragmentModuleDescriptor
COMPOSITE_TYPE_AND, COMPOSITE_TYPE_OR
 
Constructor Summary
DefaultAbstractWebFragmentModuleDescriptor(WebFragmentModuleDescriptor<T> abstractDescriptor)
           
 
Method Summary
 void destroy(Plugin plugin)
          Override this if your plugin needs to clean up when it's been removed.
 void disabled()
          Called by the plugin manager when the plugin or module is deactivated.
 void enabled()
          Called by the plugin manager when a plugin or module is activated.
 String getCompleteKey()
          The complete key for this module, including the plugin key.
 Condition getCondition()
           
 ContextProvider getContextProvider()
          Returns the ContextProvider that augments the context used to render a web module.
protected  WebFragmentModuleDescriptor getDecoratedDescriptor()
           
 String getDescription()
          A simple description of this descriptor.
 String getDescriptionKey()
          Key used to override ModuleDescriptor.getDescription() when using internationalisation.
 String getI18nNameKey()
          Key used to override ModuleDescriptor.getName() when using internationalisation.
 String getKey()
          The key for this module, unique within the plugin.
 Float getMinJavaVersion()
           
 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<String,String> 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)
          Deprecated. since 2.5.0 use getResourceDescriptors() and filter as required
 ResourceLocation getResourceLocation(String type, String name)
          Get a ResourceLocation of a particular type and name.
 WebLabel getTooltip()
           
 WebLabel getWebLabel()
           
 WebParam getWebParams()
           
 int getWeight()
           
 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" 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 setWebInterfaceManager(WebInterfaceManager webInterfaceManager)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.atlassian.plugin.ModuleDescriptor
equals, hashCode
 

Constructor Detail

DefaultAbstractWebFragmentModuleDescriptor

public DefaultAbstractWebFragmentModuleDescriptor(WebFragmentModuleDescriptor<T> abstractDescriptor)
Method Detail

enabled

public void enabled()
Description copied from interface: StateAware
Called by the plugin manager when a plugin or module is activated. Any exceptions thrown should be interpreted as the plugin is unloadable.

Specified by:
enabled in interface StateAware

disabled

public void disabled()
Description copied from interface: StateAware
Called by the plugin manager when the plugin or module is deactivated. This method will only be called if the plugin is deactivated while the application is running: stopping the server will not cause this method to be called on any plugins.

Specified by:
disabled in interface StateAware

getDecoratedDescriptor

protected WebFragmentModuleDescriptor getDecoratedDescriptor()

getWeight

public int getWeight()
Specified by:
getWeight in interface WebFragmentModuleDescriptor<T>
Specified by:
getWeight in interface WeightedDescriptor

getKey

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

Specified by:
getKey in interface ModuleDescriptor<T>
Returns:
The key for this module.
See Also:
ModuleDescriptor.getCompleteKey(), ModuleDescriptor.getPluginKey()

getModule

public T getModule()
Description copied from interface: ModuleDescriptor
The particular module object created by this plugin.

Specified by:
getModule in interface ModuleDescriptor<T>
Returns:
The module object created by this plugin.
See Also:
ModuleDescriptor.getModuleClass()

getI18nNameKey

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

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

getDescriptionKey

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

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

getPlugin

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

getWebLabel

public WebLabel getWebLabel()
Specified by:
getWebLabel in interface WebFragmentModuleDescriptor<T>

getTooltip

public WebLabel getTooltip()
Specified by:
getTooltip in interface WebFragmentModuleDescriptor<T>

setWebInterfaceManager

public void setWebInterfaceManager(WebInterfaceManager webInterfaceManager)

getCondition

public Condition getCondition()
Specified by:
getCondition in interface ConditionalDescriptor
Specified by:
getCondition in interface WebFragmentModuleDescriptor<T>

getContextProvider

public ContextProvider getContextProvider()
Description copied from interface: ContextAware
Returns the ContextProvider that augments the context used to render a web module.

Specified by:
getContextProvider in interface ContextAware

getWebParams

public WebParam getWebParams()
Specified by:
getWebParams in interface WebFragmentModuleDescriptor<T>

getCompleteKey

public 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<T>
Returns:
The complete key for this module.
See Also:
ModuleDescriptor.getKey(), ModuleDescriptor.getPluginKey()

getPluginKey

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

Specified by:
getPluginKey in interface ModuleDescriptor<T>
Returns:
The plugin key for this module.
See Also:
ModuleDescriptor.getKey(), ModuleDescriptor.getCompleteKey()

getName

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

Specified by:
getName in interface ModuleDescriptor<T>
Returns:
The name for this ModuleDescriptor.

getDescription

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

Specified by:
getDescription in interface ModuleDescriptor<T>
Returns:
The description for this ModuleDescriptor.

getModuleClass

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

Specified by:
getModuleClass in interface ModuleDescriptor<T>
Returns:
The class of the module this descriptor creates.
See Also:
ModuleDescriptor.getModule()

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.

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.

Specified by:
init in interface ModuleDescriptor<T>
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

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

Specified by:
isEnabledByDefault in interface ModuleDescriptor<T>
Returns:
true if this plugin module is enabled by default.

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<T>
Returns:
true if this plugin module is a "system" plugin that shouldn't be made visible/disableable to the user.

destroy

public void destroy(Plugin plugin)
Description copied from interface: ModuleDescriptor
Override this if your plugin needs to clean up when it's been removed.

Specified by:
destroy in interface ModuleDescriptor<T>
Parameters:
plugin - TODO: The plugin parameter is redundant. The ModuleDescriptor must know its parent plugin in order to implement getPlugin()

getMinJavaVersion

public Float getMinJavaVersion()
Specified by:
getMinJavaVersion in interface ModuleDescriptor<T>

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<T>
Returns:
true if satisfied, false otherwise.

getParams

public Map<String,String> getParams()
Specified by:
getParams in interface ModuleDescriptor<T>

getResourceDescriptors

public List<ResourceDescriptor> getResourceDescriptors()
Description copied from interface: Resourced
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.

Specified by:
getResourceDescriptors in interface Resourced
Returns:
all resource descriptors this object supports.

getResourceDescriptors

@Deprecated
public List<ResourceDescriptor> getResourceDescriptors(String type)
Deprecated. since 2.5.0 use getResourceDescriptors() and filter as required

Description copied from interface: Resourced
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.

Specified by:
getResourceDescriptors in interface Resourced
Returns:
all resource descriptors this object supports.

getResourceLocation

public ResourceLocation getResourceLocation(String type,
                                            String name)
Description copied from interface: Resourced
Get a ResourceLocation of a particular type and name.

Specified by:
getResourceLocation in interface Resourced
Returns:
the specified resource location if found, null otherwise.

getResourceDescriptor

public ResourceDescriptor getResourceDescriptor(String type,
                                                String name)
Description copied from interface: Resourced
Get a ResourceDescriptor of a particular type and name.

Specified by:
getResourceDescriptor in interface Resourced
Returns:
the specified resource descriptor if found, null otherwise.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013 Atlassian. All Rights Reserved.