Class CacheMediator

  • All Implemented Interfaces:
    org.wso2.carbon.mediator.service.ui.ListMediator, org.wso2.carbon.mediator.service.ui.Mediator

    public class CacheMediator
    extends org.wso2.carbon.mediator.service.ui.AbstractListMediator
    Object of this class is used to store mediator information in UI side.
    • Field Summary

      • Fields inherited from class org.wso2.carbon.mediator.service.ui.AbstractListMediator

        mediators
      • Fields inherited from class org.wso2.carbon.mediator.service.ui.AbstractMediator

        ATT_EXPRN, ATT_KEY, ATT_NAME, ATT_ONERROR, ATT_REGEX, ATT_SOURCE, ATT_STATS, ATT_TARGET, ATT_VALUE, ATT_XPATH, fac, FEATURE_Q, nullNS, PROP_Q, synNS, TARGET_Q
    • Constructor Summary

      Constructors 
      Constructor Description
      CacheMediator()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void build​(org.apache.axiom.om.OMElement elem)
      Creates the cache mediator with given configuration XML as OMElement.
      String getDigestGenerator()
      This method gives the DigestGenerator to evaluate the hash values of incoming messages.
      String getHeadersToExcludeInHash()
      This method gives array of headers that would be excluded when hashing.
      String getHeadersToIncludeInHash()
      This method gives array of headers that would be included when hashing.
      String getHTTPMethodsToCache()
      This method gives the HTTP method that needs to be cached.
      int getInMemoryCacheSize()
      This method gives the size of the messages to be cached in memory.
      int getMaxMessageSize()
      This method gives the maximum size of the messages to be cached in bytes.
      String getOnCacheHitRef()
      This method gives reference to the onCacheHit sequence to be executed.
      String getProtocolType()
      Returns the protocolType of the message.
      String getResponseCodes()
      Returns the response codes (regex expression).
      String getTagLocalName()
      This method gives the local name of the mediator.
      long getTimeout()
      This method gives the timeout period in milliseconds.
      boolean isAddAgeHeaderEnabled()
      This method returns whether an Age header need to be included in the cached response.
      boolean isCacheControlEnabled()
      This method returns whether cache-control headers need to be honored when caching.
      boolean isCollector()
      This method gives whether the mediator should be in the incoming path or in the outgoing path as a boolean.
      org.apache.axiom.om.OMElement serialize​(org.apache.axiom.om.OMElement parent)
      void setAddAgeHeaderEnabled​(boolean addAgeHeaderEnabled)
      This method sets whether an Age header need to be included in the cached response.
      void setCacheControlEnabled​(boolean cacheControlEnabled)
      This method sets whether cache-control headers need to be honored when caching.
      void setCollector​(boolean collector)
      This method sets whether the mediator should be in the incoming path or in the outgoing path as a boolean.
      void setDigestGenerator​(String digestGenerator)
      This method sets the DigestGenerator to evaluate the hash values of incoming messages.
      void setHeadersToExcludeInHash​(String headersToExcludeInHash)
      This method sets the array of headers that would be excluded when hashing.
      void setHeadersToIncludeInHash​(String headersToIncludeInHash)
      This method sets the array of headers that would be included when hashing.
      void setHTTPMethodsToCache​(String hTTPMethodToCache)
      This sets the HTTP method that needs to be cached.
      void setInMemoryCacheSize​(int inMemoryCacheSize)
      This method sets the size of the messages to be cached in memory.
      void setMaxMessageSize​(int maxMessageSize)
      This method sets the maximum size of the messages to be cached in bytes.
      void setOnCacheHitRef​(String onCacheHitRef)
      This method sets reference to the onCacheHit sequence to be executed.
      void setProtocolType​(String protocolType)
      This method sets protocolType of the messages.
      void setResponseCodes​(String responseCodes)
      This method sets the response codes that needs to be cached.
      void setTimeout​(long timeout)
      This method sets the timeout period as milliseconds.
      • Methods inherited from class org.wso2.carbon.mediator.service.ui.AbstractListMediator

        addChild, addChildren, getChild, getList, removeChild, removeChild, serializeChildren
      • Methods inherited from class org.wso2.carbon.mediator.service.ui.AbstractMediator

        collectNameValuePairs, disableStatistics, enableStatistics, getMediatorProperties, getMediatorProperties, getTraceState, isAuditConfigurable, isStatisticsEnable, processAuditStatus, saveTracingState, serializeMediatorProperties, serializeNamespaces, setAuditConfigurable, setTraceState
      • Methods inherited from interface org.wso2.carbon.mediator.service.ui.Mediator

        disableStatistics, enableStatistics, getTraceState, isAuditConfigurable, isStatisticsEnable, setTraceState
    • Constructor Detail

      • CacheMediator

        public CacheMediator()
    • Method Detail

      • isCollector

        public boolean isCollector()
        This method gives whether the mediator should be in the incoming path or in the outgoing path as a boolean.
        Returns:
        boolean true if incoming path false if outgoing path.
      • setCollector

        public void setCollector​(boolean collector)
        This method sets whether the mediator should be in the incoming path or in the outgoing path as a boolean.
        Parameters:
        collector - boolean value to be set as collector.
      • getDigestGenerator

        public String getDigestGenerator()
        This method gives the DigestGenerator to evaluate the hash values of incoming messages.
        Returns:
        Name of the digestGenerator used evaluate hash values.
      • setDigestGenerator

        public void setDigestGenerator​(String digestGenerator)
        This method sets the DigestGenerator to evaluate the hash values of incoming messages.
        Parameters:
        digestGenerator - Name of the digestGenerator to be set to evaluate hash values.
      • getInMemoryCacheSize

        public int getInMemoryCacheSize()
        This method gives the size of the messages to be cached in memory.
        Returns:
        memory cache size in bytes.
      • setInMemoryCacheSize

        public void setInMemoryCacheSize​(int inMemoryCacheSize)
        This method sets the size of the messages to be cached in memory.
        Parameters:
        inMemoryCacheSize - value(number of bytes) to be set as memory cache size.
      • getTimeout

        public long getTimeout()
        This method gives the timeout period in milliseconds.
        Returns:
        timeout in milliseconds
      • setTimeout

        public void setTimeout​(long timeout)
        This method sets the timeout period as milliseconds.
        Parameters:
        timeout - millisecond timeout period to be set.
      • getOnCacheHitRef

        public String getOnCacheHitRef()
        This method gives reference to the onCacheHit sequence to be executed.
        Returns:
        reference to the onCacheHit sequence.
      • setOnCacheHitRef

        public void setOnCacheHitRef​(String onCacheHitRef)
        This method sets reference to the onCacheHit sequence to be executed.
        Parameters:
        onCacheHitRef - reference to the onCacheHit sequence to be set.
      • getMaxMessageSize

        public int getMaxMessageSize()
        This method gives the maximum size of the messages to be cached in bytes.
        Returns:
        maximum size of the messages to be cached in bytes.
      • setMaxMessageSize

        public void setMaxMessageSize​(int maxMessageSize)
        This method sets the maximum size of the messages to be cached in bytes.
        Parameters:
        maxMessageSize - maximum size of the messages to be set in bytes.
      • getTagLocalName

        public String getTagLocalName()
        This method gives the local name of the mediator.
        Returns:
        local name of mediator.
      • getHTTPMethodsToCache

        public String getHTTPMethodsToCache()
        This method gives the HTTP method that needs to be cached.
        Returns:
        the HTTP method to be cached
      • setHTTPMethodsToCache

        public void setHTTPMethodsToCache​(String hTTPMethodToCache)
        This sets the HTTP method that needs to be cached.
        Parameters:
        hTTPMethodToCache - the HTTP method to be cached
      • getProtocolType

        public String getProtocolType()
        Returns the protocolType of the message.
        Returns:
        the protocol type of the messages
      • setProtocolType

        public void setProtocolType​(String protocolType)
        This method sets protocolType of the messages.
        Parameters:
        protocolType - protocol type of the messages.
      • getResponseCodes

        public String getResponseCodes()
        Returns the response codes (regex expression).
        Returns:
        The regex expression of the HTTP response code of the messages to be cached
      • setResponseCodes

        public void setResponseCodes​(String responseCodes)
        This method sets the response codes that needs to be cached.
        Parameters:
        responseCodes - the response codes to be cached in regex form.
      • getHeadersToExcludeInHash

        public String getHeadersToExcludeInHash()
        This method gives array of headers that would be excluded when hashing.
        Returns:
        array of headers to exclude from hashing
      • setHeadersToExcludeInHash

        public void setHeadersToExcludeInHash​(String headersToExcludeInHash)
        This method sets the array of headers that would be excluded when hashing.
        Parameters:
        headersToExcludeInHash - array of headers to exclude from hashing.
      • getHeadersToIncludeInHash

        public String getHeadersToIncludeInHash()
        This method gives array of headers that would be included when hashing.
        Returns:
        array of headers to include in hashing
      • setHeadersToIncludeInHash

        public void setHeadersToIncludeInHash​(String headersToIncludeInHash)
        This method sets the array of headers that would be included when hashing.
        Parameters:
        headersToIncludeInHash - array of headers to include in hashing.
      • isCacheControlEnabled

        public boolean isCacheControlEnabled()
        This method returns whether cache-control headers need to be honored when caching.
        Returns:
        cacheControlEnabled whether enable cache control or not.
      • setCacheControlEnabled

        public void setCacheControlEnabled​(boolean cacheControlEnabled)
        This method sets whether cache-control headers need to be honored when caching.
        Parameters:
        cacheControlEnabled - specifies whether cache-control headers need to be honored.
      • isAddAgeHeaderEnabled

        public boolean isAddAgeHeaderEnabled()
        This method returns whether an Age header need to be included in the cached response.
        Returns:
        addAgeHeaderEnabled whether include an Age header or not.
      • setAddAgeHeaderEnabled

        public void setAddAgeHeaderEnabled​(boolean addAgeHeaderEnabled)
        This method sets whether an Age header need to be included in the cached response.
        Parameters:
        addAgeHeaderEnabled - specifies whether include an Age header or not.
      • serialize

        public org.apache.axiom.om.OMElement serialize​(org.apache.axiom.om.OMElement parent)
      • build

        public void build​(org.apache.axiom.om.OMElement elem)
        Creates the cache mediator with given configuration XML as OMElement.
        Parameters:
        elem - OMElement to be converted to cache mediator Object.