com.atlassian.gadgets.publisher.internal.impl
Class PublishedGadgetSpecStoreImpl

java.lang.Object
  extended by com.atlassian.gadgets.publisher.internal.impl.PublishedGadgetSpecStoreImpl
All Implemented Interfaces:
GadgetSpecProvider, PluginGadgetSpecEventListener, PublishedGadgetSpecWriter

public class PublishedGadgetSpecStoreImpl
extends Object
implements GadgetSpecProvider, PluginGadgetSpecEventListener, PublishedGadgetSpecWriter

A fairly naive implementation that processes gadget spec file and substitutes values into it on the fly.


Constructor Summary
PublishedGadgetSpecStoreImpl(GadgetSpecUrlBuilder urlBuilder, GadgetSpecValidator validator, GadgetProcessor gadgetProcessor, PluginGadgetSpecProviderPermission permission)
           
 
Method Summary
 boolean contains(URI gadgetSpecUri)
          Returns true if the URI is in the store, false otherwise.
 Iterable<URI> entries()
          Returns all the gadget URIs contained by this store.
 void pluginGadgetSpecDisabled(PluginGadgetSpec pluginGadgetSpec)
          Called when a gadget spec is disabled from a plugin.
 void pluginGadgetSpecEnabled(PluginGadgetSpec pluginGadgetSpec)
          Called when a gadget spec is enabled from a plugin.
 String toString()
           
 void write(PluginGadgetSpec pluginGadgetSpec, OutputStream output)
           
 void writeGadgetSpecTo(String pluginKey, String location, OutputStream output)
          Writes the gadget spec from the specified plugin, with the specified resource location within the plugin, to the specified OutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PublishedGadgetSpecStoreImpl

public PublishedGadgetSpecStoreImpl(GadgetSpecUrlBuilder urlBuilder,
                                    GadgetSpecValidator validator,
                                    GadgetProcessor gadgetProcessor,
                                    PluginGadgetSpecProviderPermission permission)
Method Detail

contains

public boolean contains(URI gadgetSpecUri)
Description copied from interface: GadgetSpecProvider
Returns true if the URI is in the store, false otherwise.

Specified by:
contains in interface GadgetSpecProvider
Parameters:
gadgetSpecUri - URI to check is in the store
Returns:
true if the URI is in the store, false otherwise

entries

public Iterable<URI> entries()
Description copied from interface: GadgetSpecProvider
Returns all the gadget URIs contained by this store.

Specified by:
entries in interface GadgetSpecProvider
Returns:
all the gadget URIs contained by this store.

writeGadgetSpecTo

public void writeGadgetSpecTo(String pluginKey,
                              String location,
                              OutputStream output)
                       throws IOException
Description copied from interface: PublishedGadgetSpecWriter
Writes the gadget spec from the specified plugin, with the specified resource location within the plugin, to the specified OutputStream. Output will be buffered internally, so there is no need for the calling code to wrap the OutputStream with a BufferedOutputStream.

Specified by:
writeGadgetSpecTo in interface PublishedGadgetSpecWriter
Parameters:
pluginKey - the plugin key of the Plugin that contains the gadget spec to store. Must not be null, or a NullPointerException will be thrown.
location - the location of the gadget spec XML file resource within the plugin. Must not be null, or a NullPointerException will be thrown.
output - the OutputStream to write the gadget spec XML to. Must not be null, or a NullPointerException will be thrown.
Throws:
IOException - if an error occurs in I/O processing

write

public void write(PluginGadgetSpec pluginGadgetSpec,
                  OutputStream output)
           throws IOException
Throws:
IOException

pluginGadgetSpecEnabled

public void pluginGadgetSpecEnabled(PluginGadgetSpec pluginGadgetSpec)
                             throws GadgetParsingException
Description copied from interface: PluginGadgetSpecEventListener
Called when a gadget spec is enabled from a plugin.

Specified by:
pluginGadgetSpecEnabled in interface PluginGadgetSpecEventListener
Parameters:
pluginGadgetSpec - the gadget spec that was enabled. Must not be null, or a NullPointerException will be thrown.
Throws:
GadgetParsingException

pluginGadgetSpecDisabled

public void pluginGadgetSpecDisabled(PluginGadgetSpec pluginGadgetSpec)
Description copied from interface: PluginGadgetSpecEventListener
Called when a gadget spec is disabled from a plugin.

Specified by:
pluginGadgetSpecDisabled in interface PluginGadgetSpecEventListener
Parameters:
pluginGadgetSpec - the gadget spec that was enabled. Must not be null, or a NullPointerException will be thrown.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009 Atlassian. All Rights Reserved.