ehcache

net.sf.ehcache.hibernate
Class SingletonEhCacheRegionFactory

java.lang.Object
  extended by net.sf.ehcache.hibernate.SingletonEhCacheRegionFactory

public class SingletonEhCacheRegionFactory
extends java.lang.Object

A singleton EhCacheRegionFactory implementation.

Author:
Chris Dennis, Greg Luck, Emmanuel Bernard

Field Summary
protected  CacheManager manager
          Ehcache CacheManager that supplied Ehcache instances for this Hibernate RegionFactory.
protected  ProviderMBeanRegistrationHelper mbeanRegistrationHelper
          MBean registration helper class instance for Ehcache Hibernate MBeans.
static java.lang.String NET_SF_EHCACHE_CONFIGURATION_RESOURCE_NAME
          The Hibernate system property specifying the location of the ehcache configuration file name.
protected  Settings settings
          Settings object for the Hibernate persistence unit.
 
Constructor Summary
SingletonEhCacheRegionFactory(java.util.Properties prop)
          Returns a representation of the singleton EhCacheRegionFactory
 
Method Summary
 CollectionRegion buildCollectionRegion(java.lang.String regionName, java.util.Properties properties, CacheDataDescription metadata)
          
 EntityRegion buildEntityRegion(java.lang.String regionName, java.util.Properties properties, CacheDataDescription metadata)
          
 QueryResultsRegion buildQueryResultsRegion(java.lang.String regionName, java.util.Properties properties)
          
 TimestampsRegion buildTimestampsRegion(java.lang.String regionName, java.util.Properties properties)
          
 AccessType getDefaultAccessType()
          Default access-type used when the configured using JPA 2.0 config.
 boolean isMinimalPutsEnabledByDefault()
          
protected static java.net.URL loadResource(java.lang.String configurationResourceName)
          Load a resource from the classpath.
 long nextTimestamp()
          
 void start(Settings settings, 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

NET_SF_EHCACHE_CONFIGURATION_RESOURCE_NAME

public static final java.lang.String NET_SF_EHCACHE_CONFIGURATION_RESOURCE_NAME
The Hibernate system property specifying the location of the ehcache configuration file name.

If not set, ehcache.xml will be looked for in the root of the classpath.

If set to say ehcache-1.xml, ehcache-1.xml will be looked for in the root of the classpath.

See Also:
Constant Field Values

mbeanRegistrationHelper

protected final ProviderMBeanRegistrationHelper mbeanRegistrationHelper
MBean registration helper class instance for Ehcache Hibernate MBeans.


manager

protected volatile CacheManager manager
Ehcache CacheManager that supplied Ehcache instances for this Hibernate RegionFactory.


settings

protected Settings settings
Settings object for the Hibernate persistence unit.

Constructor Detail

SingletonEhCacheRegionFactory

public SingletonEhCacheRegionFactory(java.util.Properties prop)
Returns a representation of the singleton EhCacheRegionFactory

Method Detail

start

public void start(Settings settings,
                  java.util.Properties properties)
           throws CacheException

Throws:
CacheException

stop

public void stop()


isMinimalPutsEnabledByDefault

public boolean isMinimalPutsEnabledByDefault()


nextTimestamp

public long nextTimestamp()


buildEntityRegion

public EntityRegion buildEntityRegion(java.lang.String regionName,
                                      java.util.Properties properties,
                                      CacheDataDescription metadata)
                               throws CacheException

Throws:
CacheException

buildCollectionRegion

public CollectionRegion buildCollectionRegion(java.lang.String regionName,
                                              java.util.Properties properties,
                                              CacheDataDescription metadata)
                                       throws CacheException

Throws:
CacheException

buildQueryResultsRegion

public QueryResultsRegion buildQueryResultsRegion(java.lang.String regionName,
                                                  java.util.Properties properties)
                                           throws CacheException

Throws:
CacheException

buildTimestampsRegion

public TimestampsRegion buildTimestampsRegion(java.lang.String regionName,
                                              java.util.Properties properties)
                                       throws CacheException

Throws:
CacheException

loadResource

protected static java.net.URL loadResource(java.lang.String configurationResourceName)
Load a resource from the classpath.


getDefaultAccessType

public AccessType getDefaultAccessType()
Default access-type used when the configured using JPA 2.0 config. JPA 2.0 allows @Cacheable(true) to be attached to an entity without any access type or usage qualification.

We are conservative here in specifying AccessType#READ_WRITE so as to follow the mantra of "do no harm".

This is a Hibernate 3.5 method.


ehcache

true