org.alfresco.repo.cache
Class InternalEhCacheManagerFactoryBean

java.lang.Object
  extended by org.alfresco.repo.cache.InternalEhCacheManagerFactoryBean
All Implemented Interfaces:
org.hibernate.cache.CacheProvider, org.springframework.beans.factory.FactoryBean

public class InternalEhCacheManagerFactoryBean
extends java.lang.Object
implements org.springframework.beans.factory.FactoryBean, org.hibernate.cache.CacheProvider

Alfresco-specific cache manager factory.

The purpose of this bean is to provide a common point from which the system-wide EHCache CacheManager singleton is created. Hibernate and Spring will all pick up the same CacheManager instance. It then becomes possible to initialise this instance in whichever way we require, provided it is done in a well-known (non-configurable) way.

For Alfresco purposes, there are two files that are looked for:

The EHCache static singleton instance is used but ensuring that all access to the instance goes through the required initialization code first.

TODO: Provide mixing of config so that cache definitions in the custom file override those in the default file

See Also:
InternalEhCacheManagerFactoryBean.getInstance()

Field Summary
static java.lang.String CUSTOM_CONFIGURATION_FILE
           
static java.lang.String DEFAULT_CONFIGURATION_FILE
           
 
Constructor Summary
InternalEhCacheManagerFactoryBean()
          Default constructor required by Hibernate.
 
Method Summary
 org.hibernate.cache.Cache buildCache(java.lang.String regionName, java.util.Properties properties)
           
static net.sf.ehcache.CacheManager getInstance()
           
 net.sf.ehcache.CacheManager getObject()
           
 java.lang.Class getObjectType()
           
 boolean isMinimalPutsEnabledByDefault()
           
 boolean isSingleton()
           
 long nextTimestamp()
           
 void start(java.util.Properties properties)
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CUSTOM_CONFIGURATION_FILE

public static final java.lang.String CUSTOM_CONFIGURATION_FILE
See Also:
Constant Field Values

DEFAULT_CONFIGURATION_FILE

public static final java.lang.String DEFAULT_CONFIGURATION_FILE
See Also:
Constant Field Values
Constructor Detail

InternalEhCacheManagerFactoryBean

public InternalEhCacheManagerFactoryBean()
Default constructor required by Hibernate. In fact, we anticipate several instances of this class to be created.

Method Detail

getInstance

public static net.sf.ehcache.CacheManager getInstance()
Returns:
Returns the properly initialized instance for Alfresco internal use
See Also:
InternalEhCacheManagerFactoryBean.initCacheManager()

buildCache

public org.hibernate.cache.Cache buildCache(java.lang.String regionName,
                                            java.util.Properties properties)
                                     throws org.hibernate.cache.CacheException
Specified by:
buildCache in interface org.hibernate.cache.CacheProvider
Throws:
org.hibernate.cache.CacheException

isMinimalPutsEnabledByDefault

public boolean isMinimalPutsEnabledByDefault()
Specified by:
isMinimalPutsEnabledByDefault in interface org.hibernate.cache.CacheProvider
See Also:
InternalEhCacheManagerFactoryBean.hibernateEhCacheProvider

nextTimestamp

public long nextTimestamp()
Specified by:
nextTimestamp in interface org.hibernate.cache.CacheProvider
See Also:
InternalEhCacheManagerFactoryBean.hibernateEhCacheProvider

start

public void start(java.util.Properties properties)
           throws org.hibernate.cache.CacheException
Specified by:
start in interface org.hibernate.cache.CacheProvider
Throws:
org.hibernate.cache.CacheException
See Also:
InternalEhCacheManagerFactoryBean.initCacheManager()

stop

public void stop()
Specified by:
stop in interface org.hibernate.cache.CacheProvider
See Also:
InternalEhCacheManagerFactoryBean.initCacheManager()

getObject

public net.sf.ehcache.CacheManager getObject()
                                      throws java.lang.Exception
Specified by:
getObject in interface org.springframework.beans.factory.FactoryBean
Returns:
Returns the singleton cache manager
Throws:
java.lang.Exception
See Also:
InternalEhCacheManagerFactoryBean.initCacheManager()

getObjectType

public java.lang.Class getObjectType()
Specified by:
getObjectType in interface org.springframework.beans.factory.FactoryBean
Returns:
Returns the singleton cache manager type

isSingleton

public boolean isSingleton()
Specified by:
isSingleton in interface org.springframework.beans.factory.FactoryBean
Returns:
Returns true always


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.