Class PageElementCache

java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.web.cache.pageelement.PageElementCache
All Implemented Interfaces:
LogEnabled, PluginAware, Disposable, Initializable, Component, Configurable, Contextualizable, Serviceable

Cache the page elements renderings.
This class handles several caches, one per site and per JCR workspace.
  • Field Details

  • Constructor Details

  • Method Details

    • service

      public void service(ServiceManager manager) throws ServiceException
      Specified by:
      service in interface Serviceable
      Throws:
      ServiceException
    • configure

      public void configure(Configuration configuration) throws ConfigurationException
      Specified by:
      configure in interface Configurable
      Throws:
      ConfigurationException
    • contextualize

      public void contextualize(Context context) throws ContextException
      Specified by:
      contextualize in interface Contextualizable
      Throws:
      ContextException
    • setPluginInfo

      public void setPluginInfo(String pluginName, String featureName, String id)
      Description copied from interface: PluginAware
      Sets the plugin info relative to the current component.
      Note : The feature name may be null if the targeted component in declared at plugin level.
      Specified by:
      setPluginInfo in interface PluginAware
      Parameters:
      pluginName - Unique identifier for the plugin hosting the extension
      featureName - Unique feature identifier (unique for a given pluginName)
      id - Unique identifier of this component
    • initialize

      public void initialize() throws Exception
      Specified by:
      initialize in interface Initializable
      Throws:
      Exception
    • storePageElement

      public void storePageElement(String workspace, String site, String pageElementType, String elementId, RenderingContext renderingContext, SaxBuffer content)
      Add a content in the cache.
      Parameters:
      workspace - the current JCR workspace.
      site - the current site.
      pageElementType - the page element type.
      elementId - the element id (page id or zoneItem id).
      renderingContext - the current rendering context.
      content - the actual content.
    • storePageElement

      public void storePageElement(String workspace, String site, String pageElementType, String elementId, String subElementId, RenderingContext renderingContext, SaxBuffer content)
      Add a content in the cache.
      Parameters:
      workspace - the current JCR workspace.
      site - the current site.
      pageElementType - the page element type.
      elementId - the element id (page id or zoneItem id).
      subElementId - the sub-element id (page id, in case the element id is a zoneItem id).
      renderingContext - the current rendering context.
      content - the actual content.
    • getPageElement

      public SaxBuffer getPageElement(String workspace, String site, String pageElementType, String elementId, RenderingContext renderingContext)
      Returns the data in the cache, or null if none.
      Parameters:
      workspace - the current JCR workspace.
      site - the current site.
      pageElementType - the element type.
      elementId - the element id (page id or zoneItem id).
      renderingContext - the current rendering context.
      Returns:
      the stored content.
    • getPageElement

      public SaxBuffer getPageElement(String workspace, String site, String pageElementType, String elementId, String subElementId, RenderingContext renderingContext)
      Returns the data in the cache, or null if none.
      Parameters:
      workspace - the current JCR workspace.
      site - the current site.
      pageElementType - the element type.
      elementId - the element id (page id or zoneItem id).
      subElementId - the sub-element id (page id, in case the element id is a zoneItem id).
      renderingContext - the current rendering context.
      Returns:
      the stored content.
    • getPageElementTypes

      public Set<String> getPageElementTypes(String workspace, String site)
      Returns all stored element types, or null if none.
      Parameters:
      workspace - the current JCR workspace.
      site - the current site.
      Returns:
      all stored element types.
    • getElementCache

      public Collection<String> getElementCache(String workspace, String site, String pageElementType)
      Returns all cached data for a given InputData, or null if none.
      Parameters:
      workspace - the current JCR workspace.
      site - the current site.
      pageElementType - the element type.
      Returns:
      the stored content.
    • removeItem

      public void removeItem(String workspace, String site, String pageElementType, String elementId)
      Removes a single item from the cache.
      Parameters:
      workspace - the target JCR workspace or null to remove from all workspaces.
      site - the target site.
      pageElementType - the element type.
      elementId - the element id.
    • clear

      public void clear()
      Removes all stored data.
    • clear

      public void clear(String workspace, String site)
      Removes all data associated with a JCR workspace and a site.
      Parameters:
      workspace - the current JCR workspace. If null, means all workspaces.
      site - the current site.
    • clear

      public void clear(String workspace, String site, String pageElementType)
      Removes all data associated with a JCR workspace, a site and a given element type.
      Parameters:
      workspace - the current JCR workspace.
      site - the current site.
      pageElementType - the element type.
    • dispose

      public void dispose()
      Specified by:
      dispose in interface Disposable
    • isEnabled

      protected boolean isEnabled()
      Test if the cache is enabled.
      Returns:
      true if the cache is enabled, false otherwise.