@Configuration public abstract class AbstractCacheConfiguration extends AbstractAnnotationConfigSupport implements ImportAware
AbstractCacheConfiguration
is an abstract base class for configuring either a Pivotal GemFire/Apache Geode
client or peer-based cache instance using Spring's Java-based, Annotation Configuration
support.
This class encapsulates configuration settings common to both Pivotal GemFire/Apache Geode
peer caches
and client caches
.Annotation
,
Properties
,
Cache
,
GemFireCache
,
ClientCache
,
CacheServer
,
PdxSerializer
,
BeanFactory
,
BeanDefinition
,
BeanDefinitionBuilder
,
BeanDefinitionRegistry
,
Bean
,
Configuration
,
ImportAware
,
ConversionService
,
Resource
,
AnnotationMetadata
,
CacheFactoryBean
,
ClientCacheFactoryBean
,
AbstractAnnotationConfigSupport
,
CustomEditorBeanFactoryPostProcessor
,
DefinedIndexesApplicationListener
,
DiskStoreDirectoryBeanPostProcessor
,
PdxDiskStoreAwareBeanFactoryPostProcessor
,
GemfireMappingContext
,
MappingPdxSerializer
Modifier and Type | Field and Description |
---|---|
protected static boolean |
DEFAULT_CLOSE |
protected static boolean |
DEFAULT_COPY_ON_READ |
protected static String |
DEFAULT_LOCATORS |
protected static String |
DEFAULT_LOG_LEVEL |
protected static int |
DEFAULT_MCAST_PORT |
protected static String |
DEFAULT_NAME |
protected static boolean |
DEFAULT_USE_BEAN_FACTORY_LOCATOR |
Constructor and Description |
---|
AbstractCacheConfiguration() |
Modifier and Type | Method and Description |
---|---|
void |
add(Properties gemfireProperties) |
protected Resource |
cacheXml() |
protected boolean |
close() |
protected void |
configureCache(AnnotationMetadata importMetadata)
Configures Pivotal GemFire/Apache Geode cache specific settings.
|
protected <T extends CacheFactoryBean> |
configureCacheFactoryBean(T gemfireCache)
Configures the
CacheFactoryBean with common cache configuration settings. |
protected void |
configureInfrastructure(AnnotationMetadata importMetadata)
Configures Spring container infrastructure components and beans used by Spring Data GemFire
to enable Pivotal GemFire or Apache Geode to function properly inside a Spring context.
|
protected void |
configurePdx(AnnotationMetadata importMetadata)
Configures Pivotal GemFire/Apache Geode cache PDX Serialization.
|
protected void |
configureTheRest(AnnotationMetadata importMetadata)
Callback method allowing developers to configure other cache or application specific configuration settings.
|
protected <T extends CacheFactoryBean> |
constructCacheFactoryBean()
Constructs a new, initialized instance of
CacheFactoryBean based on the Spring application's
cache type preference (i.e. client or peer), which is expressed via the appropriate annotation. |
protected boolean |
copyOnRead() |
protected Float |
criticalHeapPercentage() |
protected CacheFactoryBean.DynamicRegionSupport |
dynamicRegionSupport() |
protected Float |
evictionHeapPercentage() |
protected org.apache.geode.cache.util.GatewayConflictResolver |
gatewayConflictResolver() |
protected Properties |
gemfireProperties()
Returns a
Properties object containing Pivotal GemFire/Apache Geode properties used to configure
the Pivotal GemFire/Apache Geode cache. |
protected abstract Class |
getAnnotationType()
Returns the cache application
Annotation type pertaining to this configuration. |
protected String |
getAnnotationTypeName()
Returns the fully-qualified
class name of the cache application
Annotation type. |
protected String |
getAnnotationTypeSimpleName()
Returns the simple
class name of the cache application
Annotation type. |
protected boolean |
isCacheServerApplication(AnnotationMetadata importMetadata)
Determines whether this is a GemFire
CacheServer application,
which is indicated by the presence of the CacheServerApplication annotation on a Spring application
@Configuration class. |
protected boolean |
isCacheServerOrPeerCacheApplication(AnnotationMetadata importMetadata)
Determines whether this is a GemFire
CacheServer or
peer cache application, which is indicated by the presence
of either the CacheServerApplication annotation or the PeerCacheApplication annotation
on a Spring application @Configuration class. |
protected boolean |
isClientCacheApplication(AnnotationMetadata importMetadata)
Determines whether this is a GemFire
ClientCache application,
which is indicated by the presence of the ClientCacheApplication annotation on a Spring application
@Configuration class. |
protected boolean |
isClientPeerOrServerCacheApplication(AnnotationMetadata importMetadata)
Determine whether this Spring application is a
CacheServer ,
ClientCache or a Cache application. |
protected boolean |
isPeerCacheApplication(AnnotationMetadata importMetadata)
Determines whether this is a GemFire peer
Cache application,
which is indicated by the presence of the PeerCacheApplication annotation on a Spring application
@Configuration class. |
protected boolean |
isTypedCacheApplication(Class<? extends Annotation> annotationType,
AnnotationMetadata importMetadata)
Determines whether this Spring application is annotated with the given GemFire cache type annotation.
|
protected List<CacheFactoryBean.JndiDataSource> |
jndiDataSources() |
protected String |
locators() |
protected String |
logLevel() |
protected GemfireMappingContext |
mappingContext() |
protected Integer |
mcastPort() |
protected String |
name() |
protected abstract <T extends CacheFactoryBean> |
newCacheFactoryBean()
Constructs a new, uninitialized instance of
CacheFactoryBean based on the Spring application's
cache type preference (i.e. client or peer), which is expressed via the appropriate annotation. |
protected <T extends org.apache.geode.pdx.PdxSerializer> |
newPdxSerializer()
Constructs a new instance of
PdxSerializer . |
protected <T extends org.apache.geode.pdx.PdxSerializer> |
newPdxSerializer(BeanFactory beanFactory)
Constructs a new instance of
MappingPdxSerializer . |
protected String |
pdxDiskStoreName() |
protected Boolean |
pdxIgnoreUnreadFields() |
protected Boolean |
pdxPersistent() |
protected Boolean |
pdxReadSerialized() |
protected org.apache.geode.pdx.PdxSerializer |
pdxSerializer() |
protected org.apache.geode.pdx.PdxSerializer |
resolvePdxSerializer(String pdxSerializerBeanName)
Resolves the
PdxSerializer used to configure the cache for PDX De/Serialization. |
void |
setImportMetadata(AnnotationMetadata importMetadata) |
protected String |
startLocator() |
String |
toString() |
protected List<org.apache.geode.cache.TransactionListener> |
transactionListeners() |
protected org.apache.geode.cache.TransactionWriter |
transactionWriter() |
protected boolean |
useBeanFactoryLocator() |
afterPropertiesSet, beanClassLoader, beanFactory, evaluationContext, hasValue, hasValue, hasValue, newEvaluationContext, register, register, setBeanClassLoader, setBeanFactory
protected static final boolean DEFAULT_CLOSE
protected static final boolean DEFAULT_COPY_ON_READ
protected static final boolean DEFAULT_USE_BEAN_FACTORY_LOCATOR
protected static final int DEFAULT_MCAST_PORT
protected static final String DEFAULT_LOCATORS
protected static final String DEFAULT_LOG_LEVEL
protected static final String DEFAULT_NAME
@Bean protected Properties gemfireProperties()
Properties
object containing Pivotal GemFire/Apache Geode properties used to configure
the Pivotal GemFire/Apache Geode cache.
The name of the Pivotal GemFire/Apache Geode member/node in the cluster is set to a default,
pre-defined and descriptive value depending on the type of configuration meta-data applied.
mcast-port is set to 0 and locators is set to an empty String
,
which is necessary for cache client
-based applications. These values can be changed
and set accoridingly for peer cache
and cache server
applications.
Finally, the log-level property defaults to config.Properties
object containing Pivotal GemFire/Apache Geode properties used to configure
the Pivotal GemFire/Apache Geode cache instance.Properties
,
locators()
,
logLevel()
,
mcastPort()
,
name()
public void setImportMetadata(AnnotationMetadata importMetadata)
setImportMetadata
in interface ImportAware
protected void configureInfrastructure(AnnotationMetadata importMetadata)
importMetadata
- AnnotationMetadata
containing annotation meta-data
for the Spring Data GemFire cache application class.AnnotationMetadata
protected void configureCache(AnnotationMetadata importMetadata)
importMetadata
- AnnotationMetadata
containing the cache meta-data used to configure the cache.AnnotationMetadata
protected void configurePdx(AnnotationMetadata importMetadata)
importMetadata
- AnnotationMetadata
containing PDX meta-data used to configure the cache
with PDX de/serialization capabilities.AnnotationMetadata
,
GemFire PDX Serializationprotected org.apache.geode.pdx.PdxSerializer resolvePdxSerializer(String pdxSerializerBeanName)
PdxSerializer
used to configure the cache for PDX De/Serialization.pdxSerializerBeanName
- String
containing the name of a Spring bean
implementing the PdxSerializer
interface.PdxSerializer
from configuration.PdxSerializer
,
newPdxSerializer(BeanFactory)
,
AbstractAnnotationConfigSupport.beanFactory()
protected <T extends org.apache.geode.pdx.PdxSerializer> T newPdxSerializer()
PdxSerializer
.T
- Class
type of the PdxSerializer
.PdxSerializer
.PdxSerializer
,
newPdxSerializer(BeanFactory)
protected <T extends org.apache.geode.pdx.PdxSerializer> T newPdxSerializer(BeanFactory beanFactory)
MappingPdxSerializer
.T
- Class
type of the PdxSerializer
; this method returns a MappingPdxSerializer
.beanFactory
- BeanFactory
used to get an instance of ConversionService
used by the MappingPdxSerializer
.MappingPdxSerializer
.MappingPdxSerializer
,
BeanFactory
,
PdxSerializer
protected void configureTheRest(AnnotationMetadata importMetadata)
importMetadata
- AnnotationMetadata
containing meta-data used to configure the cache or application.AnnotationMetadata
protected <T extends CacheFactoryBean> T constructCacheFactoryBean()
CacheFactoryBean
based on the Spring application's
cache type preference (i.e. client or peer), which is expressed via the appropriate annotation.
Use the ClientCacheApplication
Annotation to construct a cache client
application.
Use the PeerCacheApplication
Annotation to construct a peer cache
application.T
- Class
specific sub-type of the CacheFactoryBean
.CacheFactoryBean
given the Spring application's
cache type preference (i.e client or peer), (e.g. ClientCacheApplication
or PeerCacheApplication
).ClientCacheFactoryBean
,
CacheFactoryBean
,
configureCacheFactoryBean(CacheFactoryBean)
,
newCacheFactoryBean()
protected abstract <T extends CacheFactoryBean> T newCacheFactoryBean()
CacheFactoryBean
based on the Spring application's
cache type preference (i.e. client or peer), which is expressed via the appropriate annotation.
Use the ClientCacheApplication
Annotation to construct a cache client
application.
Use the PeerCacheApplication
Annotation to construct a peer cache
application.T
- Class
specific sub-type of the CacheFactoryBean
.CacheFactoryBean
given the Spring application's
cache type preference (i.e client or peer), (e.g. ClientCacheApplication
or PeerCacheApplication
).ClientCacheFactoryBean
,
CacheFactoryBean
protected <T extends CacheFactoryBean> T configureCacheFactoryBean(T gemfireCache)
CacheFactoryBean
with common cache configuration settings.T
- Class
specific sub-type of the CacheFactoryBean
.gemfireCache
- CacheFactoryBean
to configure.CacheFactoryBean
with common cache configuration settings applied.ClientCacheFactoryBean
,
CacheFactoryBean
protected abstract Class getAnnotationType()
Annotation
type pertaining to this configuration.getAnnotationType
in class AbstractAnnotationConfigSupport
Annotation
type used by this application.CacheServerApplication
,
ClientCacheApplication
,
PeerCacheApplication
protected String getAnnotationTypeName()
class name
of the cache application
Annotation
type.getAnnotationTypeName
in class AbstractAnnotationConfigSupport
class name
of the cache application
Annotation
type.Class.getName()
,
getAnnotationType()
protected String getAnnotationTypeSimpleName()
class name
of the cache application
Annotation
type.getAnnotationTypeSimpleName
in class AbstractAnnotationConfigSupport
class name
of the cache application
Annotation
type.Class.getSimpleName()
,
getAnnotationType()
protected boolean isCacheServerApplication(AnnotationMetadata importMetadata)
CacheServer
application,
which is indicated by the presence of the CacheServerApplication
annotation on a Spring application
@Configuration
class.importMetadata
- AnnotationMetadata
containing application configuration meta-data
from the annotations used to configure the Spring application.CacheServerApplication
,
isTypedCacheApplication(Class, AnnotationMetadata)
protected boolean isClientCacheApplication(AnnotationMetadata importMetadata)
ClientCache
application,
which is indicated by the presence of the ClientCacheApplication
annotation on a Spring application
@Configuration
class.importMetadata
- AnnotationMetadata
containing application configuration meta-data
from the annotations used to configure the Spring application.ClientCacheApplication
,
isTypedCacheApplication(Class, AnnotationMetadata)
protected boolean isPeerCacheApplication(AnnotationMetadata importMetadata)
Cache
application,
which is indicated by the presence of the PeerCacheApplication
annotation on a Spring application
@Configuration
class.importMetadata
- AnnotationMetadata
containing application configuration meta-data
from the annotations used to configure the Spring application.PeerCacheApplication
,
isTypedCacheApplication(Class, AnnotationMetadata)
protected boolean isTypedCacheApplication(Class<? extends Annotation> annotationType, AnnotationMetadata importMetadata)
annotationType
- Annotation
cache type.importMetadata
- AnnotationMetadata
containing application configuration meta-data
from the annotations used to configure the Spring application.AnnotationMetadata
,
Annotation
,
getAnnotationTypeName()
,
getAnnotationType()
protected boolean isCacheServerOrPeerCacheApplication(AnnotationMetadata importMetadata)
CacheServer
or
peer cache
application, which is indicated by the presence
of either the CacheServerApplication
annotation or the PeerCacheApplication
annotation
on a Spring application @Configuration
class.importMetadata
- AnnotationMetadata
containing application configuration meta-data
from the annotations used to configure the Spring application.AnnotationMetadata
,
CacheServerApplication
,
PeerCacheApplication
,
isCacheServerApplication(AnnotationMetadata)
,
isPeerCacheApplication(AnnotationMetadata)
protected boolean isClientPeerOrServerCacheApplication(AnnotationMetadata importMetadata)
CacheServer
,
ClientCache
or a Cache
application.importMetadata
- AnnotationMetadata
containing application configuration meta-data
from the class type-level annotations used to configure the Spring application.isCacheServerApplication(AnnotationMetadata)
,
isClientCacheApplication(AnnotationMetadata)
,
isPeerCacheApplication(AnnotationMetadata)
protected Resource cacheXml()
protected boolean close()
protected boolean copyOnRead()
protected Float criticalHeapPercentage()
protected CacheFactoryBean.DynamicRegionSupport dynamicRegionSupport()
protected Float evictionHeapPercentage()
protected org.apache.geode.cache.util.GatewayConflictResolver gatewayConflictResolver()
protected List<CacheFactoryBean.JndiDataSource> jndiDataSources()
protected String locators()
protected String logLevel()
protected GemfireMappingContext mappingContext()
protected Integer mcastPort()
protected String name()
protected String pdxDiskStoreName()
protected Boolean pdxIgnoreUnreadFields()
protected Boolean pdxPersistent()
protected Boolean pdxReadSerialized()
protected org.apache.geode.pdx.PdxSerializer pdxSerializer()
protected String startLocator()
protected List<org.apache.geode.cache.TransactionListener> transactionListeners()
protected org.apache.geode.cache.TransactionWriter transactionWriter()
protected boolean useBeanFactoryLocator()
public void add(Properties gemfireProperties)
Copyright © 2011–2017 Pivotal Software, Inc.. All rights reserved.