com.atlassian.jira.portal.gadgets
Class CachingExternalGadgetStore

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

public class CachingExternalGadgetStore
extends Object
implements ExternalGadgetStore, Startable

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, com.atlassian.event.api.EventPublisher eventPublisher)
           
 
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.
 void start()
          This method wil be called after the plugin system is fully initialised and all components added to the dependency injection framework.
 
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,
                                  com.atlassian.event.api.EventPublisher eventPublisher)
Method Detail

start

public void start()
           throws Exception
Description copied from interface: Startable
This method wil be called after the plugin system is fully initialised and all components added to the dependency injection framework.

Specified by:
start in interface Startable
Throws:
Exception - Allows implementations to throw an Exception.

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-2012 Atlassian. All Rights Reserved.