Class PluginGadgetSpec

java.lang.Object
com.atlassian.gadgets.plugins.PluginGadgetSpec

public final class PluginGadgetSpec extends Object
A gadget spec provided by a plugin.
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 of published gadgets returned from getLocation() is 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 of external gadgets returned from getLocation() is the absolute URL of the gadget spec file, beginning with http or https. External gadgets served through protocols other than HTTP are not supported.
  • Constructor Details

    • PluginGadgetSpec

      public PluginGadgetSpec(com.atlassian.plugin.Plugin plugin, String moduleKey, String location, Map<String,String> params)
      Deprecated.
      Use builder() instead.
  • Method Details

    • builder

      public static PluginGadgetSpecBuilder builder()
    • getEnabledCondition

      public com.atlassian.plugin.web.Condition getEnabledCondition()
      Returns:
      the condition on whether this gadget should be made available in gadget feed resource and gadget spec xml resource.
    • getLocalCondition

      public com.atlassian.plugin.web.Condition getLocalCondition()
      Returns:
      the condition on whether this gadget should be made available in gadget directory dialog and product specific page if implemented, such as dashboard in JIRA.
    • getKey

      public PluginGadgetSpec.Key getKey()
      Returns a unique identifier for this spec.
      Returns:
      the unique identifier
    • getModuleKey

      public String getModuleKey()
      Returns the module key for this spec.
      Returns:
      the module key
    • getPluginKey

      public String getPluginKey()
      Returns the plugin key for this spec.
      Returns:
      the plugin key
    • getPublishLocation

      public String getPublishLocation()
      Returns:
      the customised spec publish location for this gadget.
    • getLocation

      public String getLocation()
      If isHostedExternally() returns true, this method returns the absolute URL of the gadget spec file, beginning with http or https. If isHostedExternally() returns false, this method returns a relative location -- the path of the spec file within its plugin.
      Returns:
      the location string
    • getInputStream

      public InputStream getInputStream()
      Returns the spec resource as an input stream, for processing.
      Returns:
      the input stream
    • isHostedExternally

      public boolean isHostedExternally()
      Returns true if this spec is hosted externally (meaning it is not part of a plugin served by the Gadgets Publisher plugin), false otherwise.
      Returns:
      true if the spec is hosted externally, false otherwise
    • hasParameter

      public boolean hasParameter(String name)
    • getParameter

      public String getParameter(String name)
    • getDateLoaded

      public Date getDateLoaded()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object