com.opencms.template.cache
Class CmsMethodElement

java.lang.Object
  |
  +--com.opencms.template.cache.A_CmsElement
        |
        +--com.opencms.template.cache.CmsMethodElement
All Implemented Interfaces:
I_CmsLogChannels

public class CmsMethodElement
extends A_CmsElement
implements I_CmsLogChannels

An instance of CmsMethodElement represents an special method Element in the OpenCms element cache area. It contains all informations to generate the output of this method. It also stores the variants of once generated content to speed up performance.

Version:
1.0
Author:
Hanjo Riege

Field Summary
 
Fields inherited from class com.opencms.template.cache.A_CmsElement
m_cacheDirectives, m_className, m_elementDefinitions, m_hasDepVariants, m_readAccessGroup, m_templateName, m_timestamp
 
Fields inherited from interface com.opencms.boot.I_CmsLogChannels
C_FLEX_CACHE, C_FLEX_LOADER, C_LOGGING, C_MODULE_CRITICAL, C_MODULE_DEBUG, C_MODULE_INFO, C_OPENCMS_CACHE, C_OPENCMS_CRITICAL, C_OPENCMS_CRONSCHEDULER, C_OPENCMS_DEBUG, C_OPENCMS_ELEMENTCACHE, C_OPENCMS_INFO, C_OPENCMS_INIT, C_OPENCMS_POOL, C_OPENCMS_STATICEXPORT, C_OPENCMS_STREAMING, C_PREPROCESSOR_IS_LOGGING
 
Constructor Summary
CmsMethodElement(String className, String methodName, CmsMethodCacheDirectives mcd, int variantCachesize)
          Constructor for an element with the given class and template name.
 
Method Summary
 void checkProxySettings(CmsObject cms, CmsCacheDirectives proxySettings, Hashtable parameters)
          checks the proxy public and the proxy private cache settings of this element and all subelements.
 void checkReadAccess(CmsObject cms)
          checks the read access.
 byte[] getContent(CmsElementCache elementCache, CmsObject cms, CmsElementDefinitionCollection elDefs, String elementName, Hashtable parameters, String methodParameter)
          Get the content of this element.
protected  void throwException(String errorMessage, int type)
          Help method that handles any occuring exception by writing an error message to the OpenCms logfile and throwing a CmsException of the given type.
 
Methods inherited from class com.opencms.template.cache.A_CmsElement
addDefinition, addVariant, clearVariantCache, getAllDefinitions, getAllVariantKeys, getCacheDirectives, getElementDefinition, getTemplateClass, getVariant, hasDependenciesVariants, init, init, removeVariant, resolveVariant, thisElementHasDepVariants, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CmsMethodElement

public CmsMethodElement(String className,
                        String methodName,
                        CmsMethodCacheDirectives mcd,
                        int variantCachesize)
Constructor for an element with the given class and template name.

Method Detail

checkProxySettings

public void checkProxySettings(CmsObject cms,
                               CmsCacheDirectives proxySettings,
                               Hashtable parameters)
checks the proxy public and the proxy private cache settings of this element and all subelements. This is a Methodelement so there are no subelements.

Overrides:
checkProxySettings in class A_CmsElement
Parameters:
cms - the cms object.
proxySettings - The CacheDirectives to merge the own CacheDriectives with.
parameters - A Hashtable with the parameters.

getContent

public byte[] getContent(CmsElementCache elementCache,
                         CmsObject cms,
                         CmsElementDefinitionCollection elDefs,
                         String elementName,
                         Hashtable parameters,
                         String methodParameter)
                  throws CmsException
Get the content of this element.

Specified by:
getContent in class A_CmsElement
Parameters:
elementCache - Entry point for the element cache
cms - CmsObject for accessing system resources
elDefs - Definitions of this element's subelements
parameters - All parameters of this request
methodParameter - contains the parameter for the methode (the tagcontent in the xmlfile).
Returns:
Byte array with the processed content of this element.
Throws:
CmsException

checkReadAccess

public void checkReadAccess(CmsObject cms)
                     throws CmsException
checks the read access. The methode elements can be read by everyone. So we don't have to check something here.

Overrides:
checkReadAccess in class A_CmsElement
Parameters:
cms - The cms Object for reading groups.
Throws:
CmsException - if no read access.

throwException

protected void throwException(String errorMessage,
                              int type)
                       throws CmsException
Help method that handles any occuring exception by writing an error message to the OpenCms logfile and throwing a CmsException of the given type.

Parameters:
errorMessage - String with the error message to be printed.
type - Type of the exception to be thrown.
Throws:
CmsException