org.hibernate.testing.cache
Class CachingRegionFactory

java.lang.Object
  extended by org.hibernate.testing.cache.CachingRegionFactory
All Implemented Interfaces:
Serializable, RegionFactory, Service

public class CachingRegionFactory
extends Object
implements RegionFactory

See Also:
Serialized Form

Constructor Summary
CachingRegionFactory()
           
CachingRegionFactory(Properties properties)
           
 
Method Summary
 CollectionRegion buildCollectionRegion(String regionName, Properties properties, CacheDataDescription metadata)
          Build a cache region specialized for storing collection data.
 EntityRegion buildEntityRegion(String regionName, Properties properties, CacheDataDescription metadata)
          Build a cache region specialized for storing entity data.
 NaturalIdRegion buildNaturalIdRegion(String regionName, Properties properties, CacheDataDescription metadata)
          Build a cache region specialized for storing NaturalId to Primary Key mappings.
 QueryResultsRegion buildQueryResultsRegion(String regionName, Properties properties)
          Build a cache region specialized for storing query results
 TimestampsRegion buildTimestampsRegion(String regionName, Properties properties)
          Build a cache region specialized for storing update-timestamps data.
 AccessType getDefaultAccessType()
          Get the default access type for entity and collection regions.
 boolean isMinimalPutsEnabledByDefault()
          By default should we perform "minimal puts" when using this second level cache implementation?
 long nextTimestamp()
          Generate a timestamp.
 void start(Settings settings, Properties properties)
          Lifecycle callback to perform any necessary initialization of the underlying cache implementation(s).
 void stop()
          Lifecycle callback to perform any necessary cleanup of the underlying cache implementation(s).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingRegionFactory

public CachingRegionFactory()

CachingRegionFactory

public CachingRegionFactory(Properties properties)
Method Detail

start

public void start(Settings settings,
                  Properties properties)
           throws CacheException
Description copied from interface: RegionFactory
Lifecycle callback to perform any necessary initialization of the underlying cache implementation(s). Called exactly once during the construction of a SessionFactoryImpl.

Specified by:
start in interface RegionFactory
Parameters:
settings - The settings in effect.
properties - The defined cfg properties
Throws:
CacheException - Indicates problems starting the L2 cache impl; considered as a sign to stop SessionFactory building.

stop

public void stop()
Description copied from interface: RegionFactory
Lifecycle callback to perform any necessary cleanup of the underlying cache implementation(s). Called exactly once during SessionFactory.close().

Specified by:
stop in interface RegionFactory

isMinimalPutsEnabledByDefault

public boolean isMinimalPutsEnabledByDefault()
Description copied from interface: RegionFactory
By default should we perform "minimal puts" when using this second level cache implementation?

Specified by:
isMinimalPutsEnabledByDefault in interface RegionFactory
Returns:
True if "minimal puts" should be performed by default; false otherwise.

getDefaultAccessType

public AccessType getDefaultAccessType()
Description copied from interface: RegionFactory
Get the default access type for entity and collection regions.

Specified by:
getDefaultAccessType in interface RegionFactory
Returns:
This factory's default access type.

nextTimestamp

public long nextTimestamp()
Description copied from interface: RegionFactory
Generate a timestamp.

This is generally used for cache content locking/unlocking purposes depending upon the access-strategy being used.

Specified by:
nextTimestamp in interface RegionFactory
Returns:
The generated timestamp.

buildEntityRegion

public EntityRegion buildEntityRegion(String regionName,
                                      Properties properties,
                                      CacheDataDescription metadata)
                               throws CacheException
Description copied from interface: RegionFactory
Build a cache region specialized for storing entity data.

Specified by:
buildEntityRegion in interface RegionFactory
Parameters:
regionName - The name of the region.
properties - Configuration properties.
metadata - Information regarding the type of data to be cached
Returns:
The built region
Throws:
CacheException - Indicates problems building the region.

buildNaturalIdRegion

public NaturalIdRegion buildNaturalIdRegion(String regionName,
                                            Properties properties,
                                            CacheDataDescription metadata)
                                     throws CacheException
Description copied from interface: RegionFactory
Build a cache region specialized for storing NaturalId to Primary Key mappings.

Specified by:
buildNaturalIdRegion in interface RegionFactory
Parameters:
regionName - The name of the region.
properties - Configuration properties.
metadata - Information regarding the type of data to be cached
Returns:
The built region
Throws:
CacheException - Indicates problems building the region.

buildCollectionRegion

public CollectionRegion buildCollectionRegion(String regionName,
                                              Properties properties,
                                              CacheDataDescription metadata)
                                       throws CacheException
Description copied from interface: RegionFactory
Build a cache region specialized for storing collection data.

Specified by:
buildCollectionRegion in interface RegionFactory
Parameters:
regionName - The name of the region.
properties - Configuration properties.
metadata - Information regarding the type of data to be cached
Returns:
The built region
Throws:
CacheException - Indicates problems building the region.

buildQueryResultsRegion

public QueryResultsRegion buildQueryResultsRegion(String regionName,
                                                  Properties properties)
                                           throws CacheException
Description copied from interface: RegionFactory
Build a cache region specialized for storing query results

Specified by:
buildQueryResultsRegion in interface RegionFactory
Parameters:
regionName - The name of the region.
properties - Configuration properties.
Returns:
The built region
Throws:
CacheException - Indicates problems building the region.

buildTimestampsRegion

public TimestampsRegion buildTimestampsRegion(String regionName,
                                              Properties properties)
                                       throws CacheException
Description copied from interface: RegionFactory
Build a cache region specialized for storing update-timestamps data.

Specified by:
buildTimestampsRegion in interface RegionFactory
Parameters:
regionName - The name of the region.
properties - Configuration properties.
Returns:
The built region
Throws:
CacheException - Indicates problems building the region.


Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.