1 28 29 package com.opencms.template.cache; 30 31 import org.opencms.file.CmsObject; 32 import org.opencms.main.CmsException; 33 34 import com.opencms.template.A_CmsCacheDirectives; 35 import com.opencms.template.CmsCacheDirectives; 36 import com.opencms.template.I_CmsTemplate; 37 38 import java.util.Hashtable ; 39 40 53 public class CmsElementDump extends A_CmsElement { 54 55 58 public CmsElementDump(String className, String templateName, CmsCacheDirectives cd, int variantCachesize) { 59 init(className, templateName, cd, variantCachesize); 60 } 61 62 71 public CmsElementDump(String className, String templateName, CmsCacheDirectives cd, CmsElementDefinitionCollection defs, int variantCachesize) { 72 init(className, templateName, cd, defs, variantCachesize); 73 } 74 75 85 public byte[] getContent(CmsElementCache elementCache, CmsObject cms, CmsElementDefinitionCollection elDefs, String elementName, Hashtable parameters, String methodParameter) throws CmsException { 86 byte[] result = null; 87 88 I_CmsTemplate templateClass = getTemplateClass(cms, m_className); 90 91 A_CmsCacheDirectives cd = getCacheDirectives(); 93 94 CmsElementVariant variant = null; 95 96 Object cacheKey = cd.getCacheKey(cms, parameters); 97 98 102 if(cd.isInternalCacheable()) { 103 checkReadAccess(cms); 104 variant = getVariant(cacheKey); 105 } 106 107 if(variant != null) { 108 result = resolveVariant(cms, variant, elementCache, elDefs, parameters); 109 } else { 110 try { 113 result = templateClass.getContent(cms, m_templateName, elementName, parameters); 114 if(cd.isInternalCacheable()) { 115 variant = new CmsElementVariant(); 116 variant.add(result); 117 addVariant(cacheKey, variant); 118 } 119 120 } 121 catch(CmsException e) { 122 throw e; 124 } 125 } 126 return result; 127 } 128 } | Popular Tags |