com.atlassian.gadgets.publisher.internal
Class GadgetModuleDescriptor

java.lang.Object
  extended by com.atlassian.plugin.descriptors.AbstractModuleDescriptor<PluginGadgetSpec>
      extended by com.atlassian.gadgets.publisher.internal.GadgetModuleDescriptor
All Implemented Interfaces:
com.atlassian.plugin.ModuleDescriptor<PluginGadgetSpec>, com.atlassian.plugin.Resourced, com.atlassian.plugin.StateAware

public final class GadgetModuleDescriptor
extends com.atlassian.plugin.descriptors.AbstractModuleDescriptor<PluginGadgetSpec>

Custom plugin module type for gadget plugin modules. Gadget plugin modules allow plugins to make gadget XML spec files available to the Atlassian Gadgets system.

Use the gadget plugin module type within a plugin by declaring a <gadget> element inside its atlassian-plugin.xml. There are two required attributes, key, an identifier for the module that must be unique across all modules (of any type) within the plugin, and location, which indicates the location of the gadget spec file. Other standard module attributes and child elements are also supported with the typical behavior, including name, i18n-name-key, disabled, description, and param.

There are two major categories of plugin gadgets, published gadgets and external gadgets.

Published gadgets are gadget specs that are packaged as resources within the plugin. They are served by the Atlassian Gadgets Publisher plugin at a URL of the form http://<hostname>[:<port>]/[<context>/]<path/to/gadget/location.xml. The location attribute of published gadgets should be a relative path to the gadget spec file within the plugin.

External gadgets are gadget specs that are hosted on an external web site. Declaring external gadgets within a plugin makes the application aware of these gadgets, so they can be displayed in a directory of available gadgets, for example. The location attribute of external gadgets should be the absolute URL of the gadget spec file, beginning with http or https. External gadgets served through protocols other than HTTP are not supported.

Examples:

 <gadget key="my-published-gadget" location="gadgets/my-published-gadget.xml"/>
 <gadget key="my-external-gadget" location="http://gadgets.example.org/my-external-gadget.xml"/>
 
 
This class is used by the plugin system and should not generally be directly instantiated by the application.


Field Summary
 
Fields inherited from class com.atlassian.plugin.descriptors.AbstractModuleDescriptor
plugin, resources, singleton
 
Constructor Summary
GadgetModuleDescriptor()
           
 
Method Summary
 PluginGadgetSpec getModule()
          Returns the PluginGadgetSpec created for this module descriptor.
 void init(com.atlassian.plugin.Plugin plugin, org.dom4j.Element element)
          Initializes this module descriptor from the specified XML element, parsed from atlassian-plugins.xml.
protected  void provideValidationRules(com.atlassian.plugin.util.validation.ValidationPattern pattern)
           
 
Methods inherited from class com.atlassian.plugin.descriptors.AbstractModuleDescriptor
assertModuleClassImplements, destroy, disabled, enabled, getCompleteKey, getDescription, getDescriptionKey, getI18nNameKey, getKey, getMinJavaVersion, getModuleClass, getName, getParams, getPlugin, getPluginKey, getResourceDescriptor, getResourceDescriptors, getResourceDescriptors, getResourceLocation, isEnabledByDefault, isSingleton, isSingletonByDefault, isSystemModule, loadClass, loadClass, satisfiesMinJavaVersion, setPlugin, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GadgetModuleDescriptor

public GadgetModuleDescriptor()
Method Detail

init

public void init(com.atlassian.plugin.Plugin plugin,
                 org.dom4j.Element element)
          throws com.atlassian.plugin.PluginParseException
Initializes this module descriptor from the specified XML element, parsed from atlassian-plugins.xml.

Specified by:
init in interface com.atlassian.plugin.ModuleDescriptor<PluginGadgetSpec>
Overrides:
init in class com.atlassian.plugin.descriptors.AbstractModuleDescriptor<PluginGadgetSpec>
Parameters:
plugin - the plugin that this module descriptor belongs to. Must not be null or a NullPointerException will be thrown.
element - the XML element specifying this gadget module. Must contain key and location attributes, or a ValidationException will be thrown. Must not be null, or a NullPointerException will be thrown.
Throws:
NullPointerException - if any argument is null.
com.atlassian.plugin.PluginParseException - if an error occurs while trying to parse the specified element
com.atlassian.plugin.util.validation.ValidationException - if a required attribute is missing from the specified element

getModule

public PluginGadgetSpec getModule()
Returns the PluginGadgetSpec created for this module descriptor. This method must not be called before the init(com.atlassian.plugin.Plugin, org.dom4j.Element) method completes, or an IllegalStateException will be thrown.

Specified by:
getModule in interface com.atlassian.plugin.ModuleDescriptor<PluginGadgetSpec>
Specified by:
getModule in class com.atlassian.plugin.descriptors.AbstractModuleDescriptor<PluginGadgetSpec>
Returns:
the PluginGadgetSpec created for this module descriptor.

provideValidationRules

protected void provideValidationRules(com.atlassian.plugin.util.validation.ValidationPattern pattern)
Overrides:
provideValidationRules in class com.atlassian.plugin.descriptors.AbstractModuleDescriptor<PluginGadgetSpec>


Copyright © 2009 Atlassian. All Rights Reserved.