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

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

public class PublishedGadgetSpecStore
extends Object
implements LocalGadgetSpecProvider, PluginGadgetSpecEventListener, PublishedGadgetSpecWriter

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


Constructor Summary
PublishedGadgetSpecStore(GadgetSpecUrlBuilder urlBuilder, GadgetSpecValidator validator, GadgetProcessor gadgetProcessor, PluginGadgetSpecProviderPermission permission, com.atlassian.sal.api.ApplicationProperties applicationProperties)
           
 
Method Summary
 boolean contains(URI gadgetSpecUri)
           
 Iterable<URI> entries()
           
 Date getLastModified(URI gadgetSpecUri)
           
 void pluginGadgetSpecDisabled(PluginGadgetSpec pluginGadgetSpec)
           
 void pluginGadgetSpecEnabled(PluginGadgetSpec pluginGadgetSpec)
           
 String toString()
           
 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.
 void writeGadgetSpecTo(URI gadgetSpecUri, OutputStream output)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PublishedGadgetSpecStore

public PublishedGadgetSpecStore(GadgetSpecUrlBuilder urlBuilder,
                                GadgetSpecValidator validator,
                                GadgetProcessor gadgetProcessor,
                                @Qualifier(value="aggregatePermissions")
                                PluginGadgetSpecProviderPermission permission,
                                com.atlassian.sal.api.ApplicationProperties applicationProperties)
Method Detail

contains

public boolean contains(URI gadgetSpecUri)
Specified by:
contains in interface GadgetSpecProvider

entries

public Iterable<URI> entries()
Specified by:
entries in interface GadgetSpecProvider

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

writeGadgetSpecTo

public void writeGadgetSpecTo(URI gadgetSpecUri,
                              OutputStream output)
                       throws IOException
Specified by:
writeGadgetSpecTo in interface LocalGadgetSpecProvider
Throws:
IOException

getLastModified

public Date getLastModified(URI gadgetSpecUri)
Specified by:
getLastModified in interface LocalGadgetSpecProvider

pluginGadgetSpecEnabled

public void pluginGadgetSpecEnabled(PluginGadgetSpec pluginGadgetSpec)
                             throws GadgetParsingException
Specified by:
pluginGadgetSpecEnabled in interface PluginGadgetSpecEventListener
Throws:
GadgetParsingException

pluginGadgetSpecDisabled

public void pluginGadgetSpecDisabled(PluginGadgetSpec pluginGadgetSpec)
Specified by:
pluginGadgetSpecDisabled in interface PluginGadgetSpecEventListener

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2010 Atlassian. All Rights Reserved.