com.atlassian.plugin.webresource
Class WebResourceModuleDescriptor

java.lang.Object
  extended by com.atlassian.plugin.descriptors.AbstractModuleDescriptor<Void>
      extended by com.atlassian.plugin.webresource.WebResourceModuleDescriptor
All Implemented Interfaces:
ModuleDescriptor<Void>, Resourced, StateAware, ConditionalDescriptor

public class WebResourceModuleDescriptor
extends AbstractModuleDescriptor<Void>
implements ConditionalDescriptor

A way of linking to web 'resources', such as javascript or css. This allows us to include resources once on any given page, as well as ensuring that plugins can declare resources, even if they are included at the bottom of a page.


Field Summary
 
Fields inherited from class com.atlassian.plugin.descriptors.AbstractModuleDescriptor
moduleClass, moduleClassName, moduleFactory, plugin, resources, singleton
 
Constructor Summary
WebResourceModuleDescriptor(HostContainer hostContainer)
           
 
Method Summary
 void disabled()
          Disables the module descriptor.
 void enabled()
          Enables the descriptor by loading the module class.
 Condition getCondition()
           
 Set<String> getContexts()
          Returns the web resource contexts this resource is associated with.
 List<String> getDependencies()
          Returns a list of dependencies on other web resources.
 Void getModule()
          As this descriptor just handles resources, you should never call this
 List<WebResourceTransformation> getTransformations()
           
 void init(Plugin plugin, org.dom4j.Element element)
          Initialise a module given it's parent plugin and the XML element representing the module.
 boolean isDisableMinification()
           
 boolean shouldDisplay()
           
 
Methods inherited from class com.atlassian.plugin.descriptors.AbstractModuleDescriptor
assertModuleClassImplements, destroy, equals, getCompleteKey, getDescription, getDescriptionKey, getI18nNameKey, getKey, getMinJavaVersion, getModuleClass, getName, getParams, getPlugin, getPluginKey, getResourceDescriptor, getResourceDescriptors, getResourceDescriptors, getResourceLocation, hashCode, isEnabledByDefault, isSingleton, isSingletonByDefault, isSystemModule, loadClass, loadClass, provideValidationRules, satisfiesMinJavaVersion, setPlugin, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WebResourceModuleDescriptor

public WebResourceModuleDescriptor(HostContainer hostContainer)
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.

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<Void>
Overrides:
init in class AbstractModuleDescriptor<Void>
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.

getModule

public Void getModule()
As this descriptor just handles resources, you should never call this

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

enabled

public void enabled()
Description copied from class: AbstractModuleDescriptor
Enables the descriptor by loading the module class. Classes overriding this method MUST call super.enabled() before their own enabling code.

Specified by:
enabled in interface StateAware
Overrides:
enabled in class AbstractModuleDescriptor<Void>

disabled

public void disabled()
Description copied from class: AbstractModuleDescriptor
Disables the module descriptor. Classes overriding this method MUST call super.disabled() after their own disabling code.

Specified by:
disabled in interface StateAware
Overrides:
disabled in class AbstractModuleDescriptor<Void>

getContexts

public Set<String> getContexts()
Returns the web resource contexts this resource is associated with.

Returns:
the web resource contexts this resource is associated with.
Since:
2.5.0

getDependencies

public List<String> getDependencies()
Returns a list of dependencies on other web resources.

Returns:
a list of module complete keys

getTransformations

public List<WebResourceTransformation> getTransformations()

isDisableMinification

public boolean isDisableMinification()
Returns:
true if resource minification should be skipped, false otherwise.

getCondition

public Condition getCondition()
Specified by:
getCondition in interface ConditionalDescriptor
Returns:
The condition to determine if it should be displayed or not
Since:
2.7.0

shouldDisplay

public boolean shouldDisplay()
Returns:
True if this web resource should be displayed based on the optional condition
Since:
2.7.0


Copyright © 2013 Atlassian. All Rights Reserved.