com.atlassian.gadgets.plugins
Class PluginGadgetSpec

java.lang.Object
  extended by 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.


Nested Class Summary
static class PluginGadgetSpec.Key
          An immutable representation of a unique identifier for plugin gadget specs, composed of a plugin key and resource location path name.
 
Constructor Summary
PluginGadgetSpec(com.atlassian.plugin.Plugin plugin, String location)
          Constructs a new PluginGadgetSpec from the specified plugin and location.
 
Method Summary
 boolean equals(Object obj)
           
 InputStream getInputStream()
          Returns the spec resource as an input stream, for processing
 PluginGadgetSpec.Key getKey()
          Returns a unique identifier for this spec
 String getLocation()
          If isHostedExternally() returns true, this method returns the absolute URL of the gadget spec file, beginning with http or https.
 int hashCode()
           
 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
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PluginGadgetSpec

public PluginGadgetSpec(com.atlassian.plugin.Plugin plugin,
                        String location)
Constructs a new PluginGadgetSpec from the specified plugin and location.

Parameters:
plugin - the plugin that contains this gadget spec. Must not be null, or a NullPointerException will be thrown.
location - the location of the plugin. Must not be null, or a NullPointerException will be thrown.
Throws:
NullPointerException - if any argument is null
Method Detail

getKey

public PluginGadgetSpec.Key getKey()
Returns a unique identifier for this spec

Returns:
the unique identifier

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

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


Copyright © 2009 Atlassian. All Rights Reserved.