com.opencms.template
Class A_CmsCacheDirectives

java.lang.Object
  |
  +--com.opencms.template.A_CmsCacheDirectives
All Implemented Interfaces:
I_CmsLogChannels
Direct Known Subclasses:
CmsCacheDirectives, CmsMethodCacheDirectives

public abstract class A_CmsCacheDirectives
extends Object
implements I_CmsLogChannels

Abstact class for all CacheDirectives classes.

Version:
1.0
Author:
Hanjo Riege

Field Summary
static int C_CACHE_EXPORT
          Flag for exportable
static int C_CACHE_INTERNAL
          Flag for internal cacheable
static int C_CACHE_PROXY_PRIVATE
          Flag for cacheable in private proxies
static int C_CACHE_PROXY_PUBLIC
          Flag for cacheable in public proxies
static int C_CACHE_STREAM
          Flag for streamable
protected  int m_cd
          Bitfield for storing external cache properties
protected  boolean m_timecheck
           
protected  CmsTimeout m_timeout
           
protected  boolean m_userSetExport
           
protected  boolean m_userSetProxyPrivate
           
protected  boolean m_userSetProxyPublic
           
 
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
A_CmsCacheDirectives()
           
 
Method Summary
 String getCacheKey(CmsObject cms, Hashtable parameters)
          calculates the cacheKey for the element.
 CmsTimeout getTimeout()
          Get the timeout object(used if the element should be reloaded every x minutes.
 boolean isExportable()
          Get the state of the "exporting ability" property.
 boolean isInternalCacheable()
          Get the state of the "internal cacheable" property.
 boolean isParameterPartOfKey()
          get information about the cacheKey.
 boolean isProxyPrivateCacheable()
          Get the state of the "proxy private cacheable" property.
 boolean isProxyPublicCacheable()
          Get the state of the "proxy public cacheable" property.
 boolean isStreamable()
          Get the state of the "streaming ability" property.
 boolean isTimeCritical()
          Get information if the element is time critical.
 boolean isUserPartOfKey()
          get information about the cacheKey.
 void merge(A_CmsCacheDirectives cd)
          Merge the current CmsCacheDirective object with another cache directive.
 void noAutoRenewAfterPublish()
          Switches off the renewAfterPublish function.
 void renewAfterEveryPublish()
          sets the renewAfterEveryPublish value to true.
 void setCacheGroups(boolean groupCache)
          defines if the group is part of the cacheKey
 void setCacheGroups(Vector groupNames)
          if this Vector is set the groups are part of the cache key and the element will be cacheable only if the current group is in the Vector.
 void setCacheParameters(Vector parameterNames)
          if this Vector is set the values of each of the parameters in the Vector will appear in the cachekey.
 void setCacheUri(boolean uriCache)
          includes the uri in the cache key.
 void setCacheUser(boolean userCache)
          includes the user in the cache key.
protected  void setExternalCaching(boolean internal, boolean proxyPriv, boolean proxyPub, boolean export, boolean stream)
          Method for setting all caching properties given boolean values.
 void setNoCacheParameters(Vector parameterNames)
          If one of this parameters apear in the request the element is dynamic!
abstract  void setTimeout(CmsTimeout timeout)
          set the timeout object(used if the element should be reloaded every x minutes.
 boolean shouldRenew()
          returns true if this element has to be deleted from cache every time a project is published.
 boolean userSetExport()
          get the userSet information.
 boolean userSetProxyPrivate()
          get the userSet information.
 boolean userSetProxyPublic()
          get the userSet information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_cd

protected int m_cd
Bitfield for storing external cache properties


m_timeout

protected CmsTimeout m_timeout

m_timecheck

protected boolean m_timecheck

m_userSetProxyPrivate

protected boolean m_userSetProxyPrivate

m_userSetProxyPublic

protected boolean m_userSetProxyPublic

m_userSetExport

protected boolean m_userSetExport

C_CACHE_INTERNAL

public static final int C_CACHE_INTERNAL
Flag for internal cacheable

See Also:
Constant Field Values

C_CACHE_PROXY_PRIVATE

public static final int C_CACHE_PROXY_PRIVATE
Flag for cacheable in private proxies

See Also:
Constant Field Values

C_CACHE_PROXY_PUBLIC

public static final int C_CACHE_PROXY_PUBLIC
Flag for cacheable in public proxies

See Also:
Constant Field Values

C_CACHE_EXPORT

public static final int C_CACHE_EXPORT
Flag for exportable

See Also:
Constant Field Values

C_CACHE_STREAM

public static final int C_CACHE_STREAM
Flag for streamable

See Also:
Constant Field Values
Constructor Detail

A_CmsCacheDirectives

public A_CmsCacheDirectives()
Method Detail

isInternalCacheable

public boolean isInternalCacheable()
Get the state of the "internal cacheable" property.

Returns:
true if internal caching is possible, false otherwise.

isUserPartOfKey

public boolean isUserPartOfKey()
get information about the cacheKey.

Returns:
true if user or group is in the key, false otherwise.

isParameterPartOfKey

public boolean isParameterPartOfKey()
get information about the cacheKey.

Returns:
true if parameters are in the key, false otherwise.

getTimeout

public CmsTimeout getTimeout()
Get the timeout object(used if the element should be reloaded every x minutes.

Returns:
timeout object.

isTimeCritical

public boolean isTimeCritical()
Get information if the element is time critical.

Returns:
true if a timeout object was set, false otherwise.

setTimeout

public abstract void setTimeout(CmsTimeout timeout)
set the timeout object(used if the element should be reloaded every x minutes.

Parameters:
timeout - a CmsTimeout object.

renewAfterEveryPublish

public void renewAfterEveryPublish()
sets the renewAfterEveryPublish value to true. This means that this element is removed from cache every time a project is published even if its template or class was not changed in the project.


noAutoRenewAfterPublish

public void noAutoRenewAfterPublish()
Switches off the renewAfterPublish function. If someone needs the uri in the key but don't need the renew function he has to use this to get rid of it. To stay compatible to old versions we can't remove it from the setUri method.


shouldRenew

public boolean shouldRenew()
returns true if this element has to be deleted from cache every time a project is published. This is when the uri is part of the cacheKey or if the user says so.


getCacheKey

public String getCacheKey(CmsObject cms,
                          Hashtable parameters)
calculates the cacheKey for the element.

Returns:
The cache key or null if it is not cacheable

setCacheGroups

public void setCacheGroups(boolean groupCache)
defines if the group is part of the cacheKey

Parameters:
groupCache - if true the group will be part of the cache key.

setCacheGroups

public void setCacheGroups(Vector groupNames)
if this Vector is set the groups are part of the cache key and the element will be cacheable only if the current group is in the Vector. If not it is dynamic.

Parameters:
groupNames - A Vector with the names of the groups for which the element is cacheable.

setCacheUser

public void setCacheUser(boolean userCache)
includes the user in the cache key.

Parameters:
userCache - if true the user will be part of the cachekey.

setCacheUri

public void setCacheUri(boolean uriCache)
includes the uri in the cache key.

Parameters:
uriCache - if true the uri will be part of the cachekey.

setCacheParameters

public void setCacheParameters(Vector parameterNames)
if this Vector is set the values of each of the parameters in the Vector will appear in the cachekey.

Parameters:
parameterNames - the parameter that should take part in the cachkey generation.

setNoCacheParameters

public void setNoCacheParameters(Vector parameterNames)
If one of this parameters apear in the request the element is dynamic! (no cachkey).

Parameters:
parameterNames - the names of the parameter that make a element dynamic

setExternalCaching

protected void setExternalCaching(boolean internal,
                                  boolean proxyPriv,
                                  boolean proxyPub,
                                  boolean export,
                                  boolean stream)
Method for setting all caching properties given boolean values.

Parameters:
internal - Initial value for "internal cacheable" property.
proxyPriv - Initial value for "proxy private cacheable" property.
proxyPub - Initial value for "internal cacheable" property.
export - Initial value for "exportable" property.
stream - Initial value for "streamable" property.

merge

public void merge(A_CmsCacheDirectives cd)
Merge the current CmsCacheDirective object with another cache directive. Resulting properties will be build by a conjunction (logical AND) of the two source properties.

Parameters:
cd - CmsCacheDirectives to be merged.

isProxyPrivateCacheable

public boolean isProxyPrivateCacheable()
Get the state of the "proxy private cacheable" property.

Returns:
true if proxy private caching is possible, false otherwise.

isProxyPublicCacheable

public boolean isProxyPublicCacheable()
Get the state of the "proxy public cacheable" property.

Returns:
true if proxy public caching is possible, false otherwise.

isExportable

public boolean isExportable()
Get the state of the "exporting ability" property.

Returns:
true if exporting is possible, false otherwise.

isStreamable

public boolean isStreamable()
Get the state of the "streaming ability" property.

Returns:
true if streaming is possible, false otherwise.

userSetProxyPrivate

public boolean userSetProxyPrivate()
get the userSet information.

Returns:
true if the proxyPrivate flag was set, false otherwise.

userSetProxyPublic

public boolean userSetProxyPublic()
get the userSet information.

Returns:
true if the proxyPublic flag was set, false otherwise.

userSetExport

public boolean userSetExport()
get the userSet information.

Returns:
true if the export flag was set, false otherwise.