com.ibm.commerce.pagelayout.cache

Class PageDesignMetaDataGenerator

  • java.lang.Object
    • com.ibm.commerce.pagelayout.cache.PageDesignMetaDataGenerator
  • All Implemented Interfaces:
    com.ibm.websphere.servlet.cache.MetaDataGenerator


    public class PageDesignMetaDataGenerator
    extends java.lang.Object
    implements com.ibm.websphere.servlet.cache.MetaDataGenerator
    This class helps determine if the store pages can be cached based on the page layout associations made for it. A store page is associated with multiple layout associations through layout web activities created for the layout marketing spot associated with it. If the layout marketing spot behavior is evaluated to be dynamic, the class sets the store page to be not-cacheable. If the layout marketing spot behavior is evaluated to be static, the class sets the time out for the store page in the cache. The meta-data generator is used in the cachespec definition for the ECActionServlet.class as follows. Here is an example:
            <cache-entry>
                    <class>servlet</class>
                    <name>com.ibm.commerce.struts.ECActionServlet.class</name>
                    
            <cache-id>
                            <component id="" type="pathinfo">
                                    <required>true</required>
                                    <value>/TopCategoriesDisplay</value>
                            </component>
                            <component id="DC_storeId" type="attribute">
                                            <required>true</required>
                            </component>
                            <component id="DC_lang" type="attribute">
                                    <required>true</required>
                            </component>
                            <component id="DC_curr" type="attribute">
                                    <required>true</required>
                            </component>
                            <component id="catalogId" type="parameter">
                                            <required>true</required>
                            </component>
                            <component id="DC_mg" type="attribute">
                                    <required>true</required>
                            </component>
                            <metadatagenerator>com.ibm.commerce.pagelayout.cache.PageDesignMetaDataGenerator</metadatagenerator>
            </cache-id>
     </cache-entry>
     
    The class identifies performs the following steps:
    • Determines the store page from the request. It looks for the pageGroup request parameter to identify the store page. If the pageGroup is not passed as a request parameter, the pageGroup for the request is retrieved from the LayoutpageGroups.properties file.
    • Once the store page is determined, it invokes the PageDesignEMarketingSpotListTaskCmd to construct the layout e-marketing spots associated with the store page.
    • Using the layout e-marketing spot names, the GetMarketingSpotBehaviorCmd is invoked to identify the marketing spot behavior.
    • If the marketing spot behavior is dynamic, the class sets the cache-entry as uncacheable.
    • If the marketing spot behavior is static, the class sets the time out value for the cache entry and sets the cache-entry as cacheable.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void initialize(com.ibm.websphere.servlet.cache.CacheConfig cc)
      This method performs no actions.
      void setMetaData(com.ibm.websphere.servlet.cache.ServletCacheRequest req, javax.servlet.http.HttpServletResponse resp)
      This method sets the meta-data on the cache for the store page request.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PageDesignMetaDataGenerator

        public PageDesignMetaDataGenerator()
    • Method Detail

      • setMetaData

        public void setMetaData(com.ibm.websphere.servlet.cache.ServletCacheRequest req,
                                javax.servlet.http.HttpServletResponse resp)
        This method sets the meta-data on the cache for the store page request. It performs the following:
        • Determines the store page from the request. It looks for the pageGroup request parameter to identify the store page. If the pageGroup is not passed as a request parameter, the pageGroup for the request is retrieved from the LayoutPageNames.properties file.
        • Once the store page is determined, it invokes the PageDesignEMarketingSpotListTaskCmd to construct the layout e-marketing spots associated with the store page.
        • Using the layout e-marketing spot names, the GetMarketingSpotBehaviorCmd is invoked to identify the marketing spot behavior.
        • If the marketing spot behavior is dynamic, the class sets the cache-entry as uncacheable.
        • If the marketing spot behavior is static, the class sets the time out value for the cache entry and sets the cache-entry as cacheable.
        • The class also appends the emsIds of the store pages that help in invalidation.
        Specified by:
        setMetaData in interface com.ibm.websphere.servlet.cache.MetaDataGenerator
        Parameters:
        req - The servlet request
        resp - The servlet response
      • initialize

        public void initialize(com.ibm.websphere.servlet.cache.CacheConfig cc)
        This method performs no actions.
        Specified by:
        initialize in interface com.ibm.websphere.servlet.cache.MetaDataGenerator
        Parameters:
        cc - The cache configuration object.