com.atlassian.confluence.plugins.gadgets.metadata
Class CachingGadgetsMacroMetadataProvider

java.lang.Object
  extended by com.atlassian.confluence.plugins.gadgets.metadata.CachingGadgetsMacroMetadataProvider
All Implemented Interfaces:
MacroMetadataProvider

public class CachingGadgetsMacroMetadataProvider
extends Object
implements MacroMetadataProvider

An extension of GadgetsMacroMetadataProvider which caches the results of the getData() method. Once the macro metadata is built and cached, this class will request that the low-level caches in the Gadgets-OpenSocial plugin are flushed. These caches use fearsome amounts of memory and should be flushed if not providing useful information. This class makes the assumption that all of the other methods in GadgetsMacroMetadataProvider work by invoking getData first. The cache contains a single entry, which is the collection of MacroMetadata objects. The class listens for any GadgetInstalledEvent or GadgetUninstalledEvent, and clears the metadata cache.

Since:
5.5

Constructor Summary
CachingGadgetsMacroMetadataProvider(com.atlassian.cache.CacheManager cacheManager, CacheStatisticsManager cacheStatisticsManager, com.atlassian.gadgets.GadgetSpecProvider gadgetSpecProvider, com.atlassian.gadgets.directory.spi.ExternalGadgetSpecStore gadgetStore, com.atlassian.gadgets.directory.spi.SubscribedGadgetFeedStore feedStore, com.atlassian.gadgets.feed.GadgetFeedReaderFactory gadgetFeedReaderFactory, com.atlassian.gadgets.spec.GadgetSpecFactory gadgetSpecFactory, RequestContextBuilder requestContextBuilder, com.atlassian.sal.api.message.I18nResolver resolver, com.atlassian.event.api.EventPublisher eventPublisher, GadgetUsageTracker gadgetUsageTracker)
          Public constructor as used by the module descriptor
 
Method Summary
 void gadgetInstalled(GadgetInstalledEvent event)
           
 void gadgetUninstalled(GadgetUninstalledEvent event)
           
 MacroMetadata getByMacroName(String macroName)
          Returns the metadata for the named macro if it is known to this provider.
 MacroMetadata getByMacroNameAndId(String macroName, String alternateId)
          Returns the metadata for the named macro if it is known to this provider.
 Collection<MacroMetadata> getData()
          Returns a collection of MacroMetadata for use in the Macro Browser.
 Collection<MacroSummary> getSummaries()
          Returns a collection of MacroMetadata for use in the Macro Browser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingGadgetsMacroMetadataProvider

public CachingGadgetsMacroMetadataProvider(com.atlassian.cache.CacheManager cacheManager,
                                           CacheStatisticsManager cacheStatisticsManager,
                                           com.atlassian.gadgets.GadgetSpecProvider gadgetSpecProvider,
                                           com.atlassian.gadgets.directory.spi.ExternalGadgetSpecStore gadgetStore,
                                           com.atlassian.gadgets.directory.spi.SubscribedGadgetFeedStore feedStore,
                                           com.atlassian.gadgets.feed.GadgetFeedReaderFactory gadgetFeedReaderFactory,
                                           com.atlassian.gadgets.spec.GadgetSpecFactory gadgetSpecFactory,
                                           RequestContextBuilder requestContextBuilder,
                                           com.atlassian.sal.api.message.I18nResolver resolver,
                                           com.atlassian.event.api.EventPublisher eventPublisher,
                                           GadgetUsageTracker gadgetUsageTracker)
Public constructor as used by the module descriptor

Method Detail

getData

public Collection<MacroMetadata> getData()
Description copied from interface: MacroMetadataProvider
Returns a collection of MacroMetadata for use in the Macro Browser. This collection need not necessarily be unique.

Specified by:
getData in interface MacroMetadataProvider

getSummaries

public Collection<MacroSummary> getSummaries()
Description copied from interface: MacroMetadataProvider
Returns a collection of MacroMetadata for use in the Macro Browser. This collection need not necessarily be unique. It's just the summaries.

Specified by:
getSummaries in interface MacroMetadataProvider

getByMacroName

public MacroMetadata getByMacroName(String macroName)
Description copied from interface: MacroMetadataProvider
Returns the metadata for the named macro if it is known to this provider. Otherwise returns null.

Specified by:
getByMacroName in interface MacroMetadataProvider
Parameters:
macroName - the (simple, unfriendly) name of the macro.
Returns:
the macro's metadata or null if it is not known to this provider.

getByMacroNameAndId

public MacroMetadata getByMacroNameAndId(String macroName,
                                         String alternateId)
Description copied from interface: MacroMetadataProvider
Returns the metadata for the named macro if it is known to this provider. Otherwise returns null.

Specified by:
getByMacroNameAndId in interface MacroMetadataProvider
Parameters:
macroName - the (simple, unfriendly) name of the macro.
alternateId - additional identification for macros where the macroName is not sufficient. If alternateId is null, then it should be ignored.
Returns:
the macro's metadata or null if it is not known to this provider.

gadgetInstalled

@EventListener
public void gadgetInstalled(GadgetInstalledEvent event)

gadgetUninstalled

@EventListener
public void gadgetUninstalled(GadgetUninstalledEvent event)


Copyright © 2003–2015 Atlassian. All rights reserved.