public class InfinispanRegionFactory extends java.lang.Object implements RegionFactory
RegionFactory
for Infinispan-backed cache
regions.Modifier and Type | Class and Description |
---|---|
static class |
InfinispanRegionFactory.DataType |
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,java.lang.String> |
baseConfigurations
Defines custom mapping for regionName -> cacheName and also DataType.key -> cacheName
(for the case that you want to change the cache configuration for whole type)
|
static java.lang.String |
COLLECTION_CACHE_RESOURCE_PROP
Name of the configuration that should be used for collection caches.
|
protected java.util.Map<java.lang.String,org.infinispan.configuration.cache.ConfigurationBuilder> |
configOverrides
Defines configuration properties applied on top of configuration set in any file, by regionName or DataType.key
|
static java.lang.String |
DEF_ENTITY_RESOURCE
Default value for
ENTITY_CACHE_RESOURCE_PROP . |
static java.lang.String |
DEF_INFINISPAN_CONFIG_RESOURCE
Default value for
INFINISPAN_CONFIG_RESOURCE_PROP . |
static java.lang.String |
DEF_PENDING_PUTS_RESOURCE
Default value for
PENDING_PUTS_CACHE_RESOURCE_PROP |
static java.lang.String |
DEF_QUERY_RESOURCE
Default value for
QUERY_CACHE_RESOURCE_PROP . |
static java.lang.String |
DEF_TIMESTAMPS_RESOURCE
Default value for
TIMESTAMPS_CACHE_RESOURCE_PROP . |
static boolean |
DEF_USE_SYNCHRONIZATION
Default value for
INFINISPAN_USE_SYNCHRONIZATION_PROP . |
static java.lang.String |
ENTITY_CACHE_RESOURCE_PROP
Name of the configuration that should be used for entity caches.
|
static java.lang.String |
IMMUTABLE_ENTITY_CACHE_RESOURCE_PROP
Name of the configuration that should be used for immutable entity caches.
|
static java.lang.String |
INFINISPAN_CONFIG_LOCAL_RESOURCE
Default configuration for cases where non-clustered cache manager is provided.
|
static java.lang.String |
INFINISPAN_CONFIG_RESOURCE_PROP
Classpath or filesystem resource containing Infinispan configurations the factory should use.
|
static java.lang.String |
INFINISPAN_GLOBAL_STATISTICS_PROP
Property name that controls whether Infinispan statistics are enabled.
|
static java.lang.String |
INFINISPAN_USE_SYNCHRONIZATION_PROP
Deprecated.
Infinispan Second Level Cache is designed to always register as synchronization
on transactional caches, or use non-transactional caches.
|
static java.lang.String |
NATURAL_ID_CACHE_RESOURCE_PROP
Name of the configuration that should be used for natural id caches.
|
static java.lang.String |
PENDING_PUTS_CACHE_NAME
Deprecated.
Use
DEF_PENDING_PUTS_RESOURCE instead. |
static java.lang.String |
PENDING_PUTS_CACHE_RESOURCE_PROP
Name of the configuration that should be used for pending-puts caches.
|
static java.lang.String |
QUERY_CACHE_RESOURCE_PROP
Name of the configuration that should be used for query caches.
|
static java.lang.String |
TIMESTAMPS_CACHE_RESOURCE_PROP
Name of the configuration that should be used for timestamp caches.
|
Constructor and Description |
---|
InfinispanRegionFactory()
Create a new instance using the default configuration.
|
InfinispanRegionFactory(java.util.Properties props)
Create a new instance using conifguration properties in
props . |
Modifier and Type | Method and Description |
---|---|
CollectionRegion |
buildCollectionRegion(java.lang.String regionName,
java.util.Map<java.lang.String,java.lang.Object> configValues,
CacheDataDescription metadata)
Build a cache region specialized for storing collection data.
|
CollectionRegion |
buildCollectionRegion(java.lang.String regionName,
java.util.Properties properties,
CacheDataDescription metadata)
Build a cache region specialized for storing collection data.
|
EntityRegion |
buildEntityRegion(java.lang.String regionName,
java.util.Map<java.lang.String,java.lang.Object> configValues,
CacheDataDescription metadata)
Build a cache region specialized for storing entity data.
|
EntityRegion |
buildEntityRegion(java.lang.String regionName,
java.util.Properties properties,
CacheDataDescription metadata)
Build a cache region specialized for storing entity data.
|
NaturalIdRegion |
buildNaturalIdRegion(java.lang.String regionName,
java.util.Map<java.lang.String,java.lang.Object> configValues,
CacheDataDescription metadata)
Build a cache region specialized for storing NaturalId to Primary Key mappings.
|
NaturalIdRegion |
buildNaturalIdRegion(java.lang.String regionName,
java.util.Properties properties,
CacheDataDescription metadata)
Build a cache region specialized for storing NaturalId to Primary Key mappings.
|
QueryResultsRegion |
buildQueryResultsRegion(java.lang.String regionName,
java.util.Map<java.lang.String,java.lang.Object> configValues)
Build a cache region specialized for storing query results.
|
QueryResultsRegion |
buildQueryResultsRegion(java.lang.String regionName,
java.util.Properties properties)
Build a cache region specialized for storing query results.
|
TimestampsRegion |
buildTimestampsRegion(java.lang.String regionName,
java.util.Map<java.lang.String,java.lang.Object> configValues)
Build a cache region specialized for storing update-timestamps data.
|
TimestampsRegion |
buildTimestampsRegion(java.lang.String regionName,
java.util.Properties properties)
Build a cache region specialized for storing update-timestamps data.
|
protected org.infinispan.manager.EmbeddedCacheManager |
createCacheManager(org.infinispan.configuration.parsing.ConfigurationBuilderHolder cfgHolder) |
protected org.infinispan.manager.EmbeddedCacheManager |
createCacheManager(java.util.Properties properties,
ServiceRegistry serviceRegistry) |
protected org.infinispan.AdvancedCache |
createCacheWrapper(org.infinispan.AdvancedCache cache) |
protected TimestampsRegionImpl |
createTimestampsRegion(org.infinispan.AdvancedCache cache,
java.lang.String regionName) |
protected org.infinispan.transaction.lookup.TransactionManagerLookup |
createTransactionManagerLookup(SessionFactoryOptions settings,
java.util.Properties properties) |
protected org.infinispan.AdvancedCache |
getCache(java.lang.String regionName,
InfinispanRegionFactory.DataType type,
CacheDataDescription metadata) |
org.infinispan.manager.EmbeddedCacheManager |
getCacheManager() |
AccessType |
getDefaultAccessType()
Get the default access type for
entity and
collection regions. |
org.infinispan.configuration.cache.Configuration |
getPendingPutsCacheConfiguration() |
boolean |
isMinimalPutsEnabledByDefault()
By default should we perform "minimal puts" when using this second
level cache implementation?
|
long |
nextTimestamp()
Generate a timestamp.
|
void |
setCacheManager(org.infinispan.manager.EmbeddedCacheManager manager) |
void |
start(SessionFactoryOptions settings,
java.util.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).
|
protected void |
stopCacheManager() |
protected void |
stopCacheRegions() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
start
public static final java.lang.String INFINISPAN_CONFIG_RESOURCE_PROP
public static final java.lang.String INFINISPAN_GLOBAL_STATISTICS_PROP
@Deprecated public static final java.lang.String INFINISPAN_USE_SYNCHRONIZATION_PROP
Synchronization
or as
an XA resource.DEF_USE_SYNCHRONIZATION
,
Constant Field Valuespublic static final java.lang.String NATURAL_ID_CACHE_RESOURCE_PROP
DEF_ENTITY_RESOURCE
public static final java.lang.String ENTITY_CACHE_RESOURCE_PROP
DEF_ENTITY_RESOURCE
public static final java.lang.String IMMUTABLE_ENTITY_CACHE_RESOURCE_PROP
ENTITY_CACHE_RESOURCE_PROP
- DEF_ENTITY_RESOURCE
public static final java.lang.String COLLECTION_CACHE_RESOURCE_PROP
ENTITY_CACHE_RESOURCE_PROP
,
DEF_ENTITY_RESOURCE
public static final java.lang.String TIMESTAMPS_CACHE_RESOURCE_PROP
DEF_TIMESTAMPS_RESOURCE
public static final java.lang.String QUERY_CACHE_RESOURCE_PROP
DEF_QUERY_RESOURCE
public static final java.lang.String PENDING_PUTS_CACHE_RESOURCE_PROP
DEF_PENDING_PUTS_RESOURCE
public static final java.lang.String DEF_INFINISPAN_CONFIG_RESOURCE
INFINISPAN_CONFIG_RESOURCE_PROP
. Specifies the "infinispan-configs.xml" file in this package.public static final java.lang.String INFINISPAN_CONFIG_LOCAL_RESOURCE
public static final java.lang.String DEF_ENTITY_RESOURCE
ENTITY_CACHE_RESOURCE_PROP
.public static final java.lang.String DEF_TIMESTAMPS_RESOURCE
TIMESTAMPS_CACHE_RESOURCE_PROP
.public static final java.lang.String DEF_QUERY_RESOURCE
QUERY_CACHE_RESOURCE_PROP
.public static final java.lang.String DEF_PENDING_PUTS_RESOURCE
PENDING_PUTS_CACHE_RESOURCE_PROP
@Deprecated public static final java.lang.String PENDING_PUTS_CACHE_NAME
DEF_PENDING_PUTS_RESOURCE
instead.public static final boolean DEF_USE_SYNCHRONIZATION
INFINISPAN_USE_SYNCHRONIZATION_PROP
.protected final java.util.Map<java.lang.String,java.lang.String> baseConfigurations
protected final java.util.Map<java.lang.String,org.infinispan.configuration.cache.ConfigurationBuilder> configOverrides
public InfinispanRegionFactory()
public InfinispanRegionFactory(java.util.Properties props)
props
.props
- Environmental properties; currently unused.public CollectionRegion buildCollectionRegion(java.lang.String regionName, java.util.Map<java.lang.String,java.lang.Object> configValues, CacheDataDescription metadata)
RegionFactory
buildCollectionRegion
in interface RegionFactory
regionName
- The name of the region.configValues
- Available config values.metadata
- Information regarding the type of data to be cachedpublic CollectionRegion buildCollectionRegion(java.lang.String regionName, java.util.Properties properties, CacheDataDescription metadata) throws CacheException
RegionFactory
buildCollectionRegion
in interface RegionFactory
regionName
- The name of the region.properties
- Configuration properties.metadata
- Information regarding the type of data to be cachedCacheException
- Indicates problems building the region.public EntityRegion buildEntityRegion(java.lang.String regionName, java.util.Map<java.lang.String,java.lang.Object> configValues, CacheDataDescription metadata)
RegionFactory
buildEntityRegion
in interface RegionFactory
regionName
- The name of the region.configValues
- Available config values.metadata
- Information regarding the type of data to be cachedpublic EntityRegion buildEntityRegion(java.lang.String regionName, java.util.Properties properties, CacheDataDescription metadata)
RegionFactory
buildEntityRegion
in interface RegionFactory
regionName
- The name of the region.properties
- Configuration properties.metadata
- Information regarding the type of data to be cachedpublic NaturalIdRegion buildNaturalIdRegion(java.lang.String regionName, java.util.Map<java.lang.String,java.lang.Object> configValues, CacheDataDescription metadata)
RegionFactory
buildNaturalIdRegion
in interface RegionFactory
regionName
- The name of the region.configValues
- Available config values.metadata
- Information regarding the type of data to be cachedpublic NaturalIdRegion buildNaturalIdRegion(java.lang.String regionName, java.util.Properties properties, CacheDataDescription metadata)
RegionFactory
buildNaturalIdRegion
in interface RegionFactory
regionName
- The name of the region.properties
- Configuration properties.metadata
- Information regarding the type of data to be cachedpublic QueryResultsRegion buildQueryResultsRegion(java.lang.String regionName, java.util.Map<java.lang.String,java.lang.Object> configValues)
RegionFactory
buildQueryResultsRegion
in interface RegionFactory
regionName
- The qualified name of the region.configValues
- Available config values.public QueryResultsRegion buildQueryResultsRegion(java.lang.String regionName, java.util.Properties properties)
RegionFactory
buildQueryResultsRegion
in interface RegionFactory
regionName
- The name of the region.properties
- Configuration properties.public TimestampsRegion buildTimestampsRegion(java.lang.String regionName, java.util.Map<java.lang.String,java.lang.Object> configValues)
RegionFactory
buildTimestampsRegion
in interface RegionFactory
regionName
- The name of the region.configValues
- The available config values.public TimestampsRegion buildTimestampsRegion(java.lang.String regionName, java.util.Properties properties)
RegionFactory
buildTimestampsRegion
in interface RegionFactory
regionName
- The name of the region.properties
- Configuration properties.protected TimestampsRegionImpl createTimestampsRegion(org.infinispan.AdvancedCache cache, java.lang.String regionName)
public org.infinispan.configuration.cache.Configuration getPendingPutsCacheConfiguration()
public boolean isMinimalPutsEnabledByDefault()
RegionFactory
isMinimalPutsEnabledByDefault
in interface RegionFactory
public AccessType getDefaultAccessType()
RegionFactory
entity
and
collection
regions.getDefaultAccessType
in interface RegionFactory
public long nextTimestamp()
RegionFactory
nextTimestamp
in interface RegionFactory
public void setCacheManager(org.infinispan.manager.EmbeddedCacheManager manager)
public org.infinispan.manager.EmbeddedCacheManager getCacheManager()
public void start(SessionFactoryOptions settings, java.util.Properties properties) throws CacheException
RegionFactory
SessionFactoryImpl
.start
in interface RegionFactory
settings
- The settings in effect.properties
- The defined cfg propertiesCacheException
- Indicates problems starting the L2 cache impl;
considered as a sign to stop SessionFactory
building.protected org.infinispan.manager.EmbeddedCacheManager createCacheManager(java.util.Properties properties, ServiceRegistry serviceRegistry)
protected org.infinispan.manager.EmbeddedCacheManager createCacheManager(org.infinispan.configuration.parsing.ConfigurationBuilderHolder cfgHolder)
protected org.infinispan.transaction.lookup.TransactionManagerLookup createTransactionManagerLookup(SessionFactoryOptions settings, java.util.Properties properties)
public void stop()
RegionFactory
SessionFactory.close()
.stop
in interface RegionFactory
protected void stopCacheRegions()
protected void stopCacheManager()
protected org.infinispan.AdvancedCache getCache(java.lang.String regionName, InfinispanRegionFactory.DataType type, CacheDataDescription metadata)
protected org.infinispan.AdvancedCache createCacheWrapper(org.infinispan.AdvancedCache cache)
Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.