Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.opencms.template.cache
Class CmsElementLocator  view CmsElementLocator download CmsElementLocator.java

java.lang.Object
  extended bycom.opencms.template.cache.CmsElementLocator
All Implemented Interfaces:
com.opencms.boot.I_CmsLogChannels

public class CmsElementLocator
extends java.lang.Object
implements com.opencms.boot.I_CmsLogChannels

The ElementLocator is used to receive CmsElement-Objects. It is the Cache for these CmsElement-Objects. The CmsElement-Objects are stored in memory or - if they are notc used a long time - written to an external database. The locator manages all the reading, writing and management of the CmsElement's.


Field Summary
private  java.util.Hashtable m_dependenciesExtern
          link to the extern dependencies vector
private  CmsLruCache m_elements
          A hashtable to store the elements.
 
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
(package private) CmsElementLocator(int cacheSize)
          The default constructor for this locator.
 
Method Summary
 void cleanupDependencies(java.util.Vector invalidResources)
          Clears the cache from unvalid variants.
 void cleanupElementCache(java.util.Vector invalidTemplates)
          deletes all elements in the cache that depend on one of the invalid Templates.
private  void cleanupExternDependencies(java.util.Vector elements)
          Removes the elements from the extern Dependencies table.
 void clearCache()
          Clears the cache compleatly.
 A_CmsElement get(com.opencms.file.CmsObject cms, CmsElementDescriptor desc, java.util.Hashtable parameters)
          Gets a Elements from this locator.
 java.util.Vector getCacheInfo()
          Gets the Information of max size and size for the cache.
 java.util.Hashtable getExternDependencies()
          TODO: there should be only one way to get this vector.
 void printCacheInfo(int selector)
          for debbuging only.
private  void put(CmsElementDescriptor desc, A_CmsElement element)
          Adds a new Element to this locator.
 void removeElementFromDependencies(CmsElementDescriptor desc, A_CmsElement element)
          Deletes all variantdependenciesEntries of an Element from the extern dependencies table.
 void removeVariantFromDependencies(java.lang.String key, CmsElementVariant variant)
          Deletes all variantdependenciesEntries of an Variant from the extern dependencies table.
 void setExternDependencies(java.util.Hashtable externDeps)
          sets the extern dependencies vector used to keep the dep information syncron.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_elements

private CmsLruCache m_elements
A hashtable to store the elements.


m_dependenciesExtern

private java.util.Hashtable m_dependenciesExtern
link to the extern dependencies vector

Constructor Detail

CmsElementLocator

CmsElementLocator(int cacheSize)
The default constructor for this locator.

Method Detail

put

private void put(CmsElementDescriptor desc,
                 A_CmsElement element)
Adds a new Element to this locator. This method is kept private and must not be used from outside. New elements automatically are generated and stored by the Locator, so no one really needs to use this method.


removeElementFromDependencies

public void removeElementFromDependencies(CmsElementDescriptor desc,
                                          A_CmsElement element)
Deletes all variantdependenciesEntries of an Element from the extern dependencies table.


removeVariantFromDependencies

public void removeVariantFromDependencies(java.lang.String key,
                                          CmsElementVariant variant)
Deletes all variantdependenciesEntries of an Variant from the extern dependencies table.


get

public A_CmsElement get(com.opencms.file.CmsObject cms,
                        CmsElementDescriptor desc,
                        java.util.Hashtable parameters)
                 throws com.opencms.core.CmsException
Gets a Elements from this locator.


getCacheInfo

public java.util.Vector getCacheInfo()
Gets the Information of max size and size for the cache.


printCacheInfo

public void printCacheInfo(int selector)
for debbuging only. Prints information about the cache system.


cleanupElementCache

public void cleanupElementCache(java.util.Vector invalidTemplates)
deletes all elements in the cache that depend on one of the invalid Templates.


cleanupDependencies

public void cleanupDependencies(java.util.Vector invalidResources)
Clears the cache from unvalid variants. It looks for each entry in the invalidResources if there are variants that depend on it. If so this variant has to be deleted and the extern dependencies table is updated.


cleanupExternDependencies

private void cleanupExternDependencies(java.util.Vector elements)
Removes the elements from the extern Dependencies table.


clearCache

public void clearCache()
Clears the cache compleatly.


getExternDependencies

public java.util.Hashtable getExternDependencies()
TODO: there should be only one way to get this vector. remove the way through the cms Object?


setExternDependencies

public void setExternDependencies(java.util.Hashtable externDeps)
sets the extern dependencies vector used to keep the dep information syncron.