com.atlassian.gadgets.refimpl
Class PluginSettingsExternalGadgetSpecStore

java.lang.Object
  extended by com.atlassian.gadgets.refimpl.PluginSettingsExternalGadgetSpecStore
All Implemented Interfaces:
ExternalGadgetSpecStore

public class PluginSettingsExternalGadgetSpecStore
extends Object
implements ExternalGadgetSpecStore

This implementation stores ExternalGadgetSpecs to the SAL PluginSettings API.


Constructor Summary
PluginSettingsExternalGadgetSpecStore(com.atlassian.sal.api.pluginsettings.PluginSettingsFactory pluginSettingsFactory, ExternalGadgetSpecIdGenerator gadgetSpecIdGenerator)
           
 
Method Summary
 ExternalGadgetSpec add(URI gadgetSpecUri)
          Adds a gadget spec URI to this store and returns an ExternalGadgetSpec wrapper for it.
 boolean contains(URI gadgetSpecUri)
          Returns true if the URI is in the store, false otherwise.
 Collection<ExternalGadgetSpec> entries()
          Retrieves all ExternalGadgetSpecs from the data store.
 void remove(ExternalGadgetSpecId externalGadgetSpecId)
          Removes the spec URI corresponding to the specified externalGadgetSpecId from the persistent data store.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PluginSettingsExternalGadgetSpecStore

public PluginSettingsExternalGadgetSpecStore(com.atlassian.sal.api.pluginsettings.PluginSettingsFactory pluginSettingsFactory,
                                             ExternalGadgetSpecIdGenerator gadgetSpecIdGenerator)
Method Detail

entries

public Collection<ExternalGadgetSpec> entries()
Description copied from interface: ExternalGadgetSpecStore
Retrieves all ExternalGadgetSpecs from the data store. There is no guarantee that these will be sequenced in any particular order. This method must not return null; if the store is empty, it must return an Iterable with no contents.

Specified by:
entries in interface ExternalGadgetSpecStore
Returns:
all of the ExternalGadgetSpecs in the store, returned in an unspecified order

add

public ExternalGadgetSpec add(URI gadgetSpecUri)
                       throws ExternalGadgetStoreException
Description copied from interface: ExternalGadgetSpecStore

Adds a gadget spec URI to this store and returns an ExternalGadgetSpec wrapper for it. The store must not allow duplicate entries to be stored; if the gadget spec URI is already contained in this store, this method should return the existing ExternalGadgetSpec for it.

The implementation must consider syntactically different but semantically equivalent URIs to be equal for the purposes of duplicate elimination; specifically, the implementation is responsible for calling URI.normalize() on gadgetSpecUri before storing it.

Specified by:
add in interface ExternalGadgetSpecStore
Parameters:
gadgetSpecUri - the gadget spec URI to store. Must not be null.
Returns:
an ExternalGadgetSpec object wrapping the specified gadget spec URI
Throws:
ExternalGadgetStoreException - if there is a problem when adding the gadget spec URI to the persistent data store

remove

public void remove(ExternalGadgetSpecId externalGadgetSpecId)
Description copied from interface: ExternalGadgetSpecStore
Removes the spec URI corresponding to the specified externalGadgetSpecId from the persistent data store. If externalGadgetSpecId does not correspond to any stored gadget spec URI, this method should do nothing but return.

Specified by:
remove in interface ExternalGadgetSpecStore
Parameters:
externalGadgetSpecId - the gadget spec ID to be removed from the persistent data store. Must not be null.

contains

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

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


Copyright © 2009 Atlassian. All Rights Reserved.