com.atlassian.gadgets.directory.internal.impl
Class ConfigurableExternalGadgetSpecDirectoryEntryProvider

java.lang.Object
  extended by com.atlassian.gadgets.directory.internal.impl.AbstractDirectoryEntryProvider<ExternalGadgetSpec>
      extended by com.atlassian.gadgets.directory.internal.impl.ConfigurableExternalGadgetSpecDirectoryEntryProvider
All Implemented Interfaces:
ConfigurableExternalGadgetSpecStore, DirectoryEntryProvider

public class ConfigurableExternalGadgetSpecDirectoryEntryProvider
extends AbstractDirectoryEntryProvider<ExternalGadgetSpec>
implements ConfigurableExternalGadgetSpecStore

This implementation delegates spec storage to ExternalGadgetSpecStore to enforce the contract of that interface (normalizing URIs on add, preventing duplicate storage, etc.) and so that user-added gadgets may be persisted in between application sessions.


Constructor Summary
ConfigurableExternalGadgetSpecDirectoryEntryProvider(GadgetSpecFactory gadgetSpecFactory, ExternalGadgetSpecStore externalGadgetSpecStore, DirectoryUrlBuilder directoryUrlBuilder, com.atlassian.sal.api.transaction.TransactionTemplate txTemplate)
           
 
Method Summary
 void add(URI gadgetSpecUri)
          Adds the specified gadget spec URI to the store.
 boolean contains(URI gadgetSpecUri)
           
protected  com.google.common.base.Function<ExternalGadgetSpec,Directory.Entry> convertToLocalizedDirectoryEntry(GadgetRequestContext gadgetRequestContext)
           
protected  Iterable<ExternalGadgetSpec> internalEntries()
           
 void remove(ExternalGadgetSpecId gadgetSpecId)
          Removes the gadget spec with the specified ID from the store
 String toString()
           
 
Methods inherited from class com.atlassian.gadgets.directory.internal.impl.AbstractDirectoryEntryProvider
entries, getGadgetSpec, stripNulls
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConfigurableExternalGadgetSpecDirectoryEntryProvider

public ConfigurableExternalGadgetSpecDirectoryEntryProvider(GadgetSpecFactory gadgetSpecFactory,
                                                            ExternalGadgetSpecStore externalGadgetSpecStore,
                                                            DirectoryUrlBuilder directoryUrlBuilder,
                                                            com.atlassian.sal.api.transaction.TransactionTemplate txTemplate)
Method Detail

contains

public boolean contains(URI gadgetSpecUri)
Specified by:
contains in interface DirectoryEntryProvider
Parameters:
gadgetSpecUri - uri of the gadget spec to check if it's in the directory
Returns:
true if the gadget spec at the location specificied by the uri is in the directory, false otherwise

internalEntries

protected Iterable<ExternalGadgetSpec> internalEntries()
Specified by:
internalEntries in class AbstractDirectoryEntryProvider<ExternalGadgetSpec>

add

public void add(URI gadgetSpecUri)
         throws GadgetParsingException
Description copied from interface: ConfigurableExternalGadgetSpecStore
Adds the specified gadget spec URI to the store. If the URI is not contained in the store, this method is a noop.

Specified by:
add in interface ConfigurableExternalGadgetSpecStore
Parameters:
gadgetSpecUri - the URI to add to the store
Throws:
GadgetParsingException

remove

public void remove(ExternalGadgetSpecId gadgetSpecId)
Description copied from interface: ConfigurableExternalGadgetSpecStore
Removes the gadget spec with the specified ID from the store

Specified by:
remove in interface ConfigurableExternalGadgetSpecStore
Parameters:
gadgetSpecId - the id of the gadget to remove

convertToLocalizedDirectoryEntry

protected com.google.common.base.Function<ExternalGadgetSpec,Directory.Entry> convertToLocalizedDirectoryEntry(GadgetRequestContext gadgetRequestContext)
Specified by:
convertToLocalizedDirectoryEntry in class AbstractDirectoryEntryProvider<ExternalGadgetSpec>

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009 Atlassian. All Rights Reserved.