com.atlassian.jira.portal.gadgets
Class CachingExternalGadgetStore

java.lang.Object
  extended by com.atlassian.jira.portal.gadgets.CachingExternalGadgetStore
All Implemented Interfaces:
ExternalGadgetStore

public class CachingExternalGadgetStore
extends Object
implements ExternalGadgetStore

Eagerly caching implementation on the external Gadget store. The contains() method needs to be especially performant, since every gadget will be checked when displaying a dashboard.

Since:
v4.0

Field Summary
 Map<com.atlassian.gadgets.directory.spi.ExternalGadgetSpecId,com.atlassian.gadgets.directory.spi.ExternalGadgetSpec> specCache
           
 Set<URI> uriCache
           
 
Constructor Summary
CachingExternalGadgetStore(ExternalGadgetStore delegateStore)
           
 
Method Summary
 com.atlassian.gadgets.directory.spi.ExternalGadgetSpec addGadgetSpecUri(URI uri)
          Adds the URI specified to the whitelist.
 boolean containsSpecUri(URI uri)
          Checks if the specified URI is already contained in the store
 Set<com.atlassian.gadgets.directory.spi.ExternalGadgetSpec> getAllGadgetSpecUris()
          Retrieves a set of all external gadgets whitelisted in the directory.
 void onClearCache(ClearCacheEvent event)
           
 void removeGadgetSpecUri(com.atlassian.gadgets.directory.spi.ExternalGadgetSpecId id)
          Removes the URI specified from the whitelist.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

specCache

public final Map<com.atlassian.gadgets.directory.spi.ExternalGadgetSpecId,com.atlassian.gadgets.directory.spi.ExternalGadgetSpec> specCache

uriCache

public final Set<URI> uriCache
Constructor Detail

CachingExternalGadgetStore

public CachingExternalGadgetStore(ExternalGadgetStore delegateStore)
Method Detail

onClearCache

@EventListener
public void onClearCache(ClearCacheEvent event)

getAllGadgetSpecUris

public Set<com.atlassian.gadgets.directory.spi.ExternalGadgetSpec> getAllGadgetSpecUris()
Description copied from interface: ExternalGadgetStore
Retrieves a set of all external gadgets whitelisted in the directory.

Specified by:
getAllGadgetSpecUris in interface ExternalGadgetStore
Returns:
a set of all external gadgets whitelisted in the directory.

addGadgetSpecUri

public com.atlassian.gadgets.directory.spi.ExternalGadgetSpec addGadgetSpecUri(URI uri)
Description copied from interface: ExternalGadgetStore
Adds the URI specified to the whitelist.

Specified by:
addGadgetSpecUri in interface ExternalGadgetStore
Parameters:
uri - The gadget URI to add
Returns:
The newly created ExternalGAdgetSpec

removeGadgetSpecUri

public void removeGadgetSpecUri(com.atlassian.gadgets.directory.spi.ExternalGadgetSpecId id)
Description copied from interface: ExternalGadgetStore
Removes the URI specified from the whitelist.

Specified by:
removeGadgetSpecUri in interface ExternalGadgetStore
Parameters:
id - The id to remove

containsSpecUri

public boolean containsSpecUri(URI uri)
Description copied from interface: ExternalGadgetStore
Checks if the specified URI is already contained in the store

Specified by:
containsSpecUri in interface ExternalGadgetStore
Parameters:
uri - the URI to check for
Returns:
true if the URI already exists in the store


Copyright © 2002-2013 Atlassian. All Rights Reserved.