Package org.springframework.geode.data
Class AbstractCacheDataImporterExporter
java.lang.Object
org.springframework.geode.data.AbstractCacheDataImporterExporter
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.config.BeanPostProcessor,org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor,org.springframework.context.ApplicationContextAware,org.springframework.context.EnvironmentAware,CacheDataExporter,CacheDataImporter,CacheDataImporterExporter
- Direct Known Subclasses:
ResourceCapableCacheDataImporterExporter
public abstract class AbstractCacheDataImporterExporter
extends Object
implements org.springframework.context.ApplicationContextAware, CacheDataImporterExporter, org.springframework.context.EnvironmentAware
Abstract base class implementing the
CacheDataImporter and CacheDataExporter interfaces in order to
simplify import/export data access operation implementations in a consistent way.- Since:
- 1.3.0
- See Also:
-
PredicateRegionApplicationContextApplicationContextAwareEnvironmentAwareEnvironmentCacheDataImporterExporter
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract org.apache.geode.cache.RegiondoExportFrom(org.apache.geode.cache.Region region) Exports data contained in the givenRegion.protected abstract org.apache.geode.cache.RegiondoImportInto(org.apache.geode.cache.Region region) Imports data into the givenRegion.org.apache.geode.cache.RegionexportFrom(org.apache.geode.cache.Region region) Exports data contained in the givenRegion.protected Optional<org.springframework.context.ApplicationContext>Return anOptionalreference to the configuredApplicationContextused by this data importer/exporter to perform its function.protected Optional<org.springframework.core.env.Environment>Returns anOptionalreference to the configuredEnvironmentused by this data importer/exporter to accessEnvironmentspecific configuration.protected org.slf4j.LoggerReturn the configuredLoggerto log messages.protected Predicate<org.apache.geode.cache.Region<?,?>> Returns the configuredPredicateused to filterRegionson data import/export.org.apache.geode.cache.RegionimportInto(org.apache.geode.cache.Region region) Imports data into the givenRegion.protected booleanisExportEnabled(org.springframework.core.env.Environment environment) Null-safe method to determine whether export has been explicitly configured and enabled or disabled.protected booleanisImportEnabled(org.springframework.core.env.Environment environment) Null-safe method to determine whether import has been explicitly configured and enabled or disabled.protected booleanisImportProfilesActive(org.springframework.core.env.Environment environment) Determines whether the Cache Data Import data access operation is enabled based on the configured, active/default Profiles as declared in the SpringEnvironment.protected org.springframework.context.ApplicationContextReturns a required reference to the configuredApplicationContextused by this data importer/exporter.protected org.springframework.core.env.EnvironmentReturns a required reference to the configuredEnvironmentused by this data importer/exporter to accessEnvironmentspecific configuration.voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) Sets a reference to aApplicationContextused by this data importer/exporter to perform its function.voidsetEnvironment(org.springframework.core.env.Environment environment) Sets a reference to the configuredEnvironmentused by this data importer/exporter to perform its function.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.beans.factory.config.BeanPostProcessor
postProcessBeforeInitializationMethods inherited from interface org.springframework.geode.data.CacheDataExporter
postProcessBeforeDestructionMethods inherited from interface org.springframework.geode.data.CacheDataImporter
postProcessAfterInitializationMethods inherited from interface org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor
requiresDestruction
-
Field Details
-
DEFAULT_CACHE_DATA_EXPORT_ENABLED
protected static final boolean DEFAULT_CACHE_DATA_EXPORT_ENABLED- See Also:
-
DEFAULT_CACHE_DATA_IMPORT_ENABLED
protected static final boolean DEFAULT_CACHE_DATA_IMPORT_ENABLED- See Also:
-
CACHE_DATA_EXPORT_ENABLED_PROPERTY_NAME
- See Also:
-
CACHE_DATA_IMPORT_ACTIVE_PROFILES_PROPERTY_NAME
- See Also:
-
CACHE_DATA_IMPORT_ENABLED_PROPERTY_NAME
- See Also:
-
DEFAULT_CACHE_DATA_IMPORT_ACTIVE_PROFILES
- See Also:
-
-
Constructor Details
-
AbstractCacheDataImporterExporter
public AbstractCacheDataImporterExporter()
-
-
Method Details
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) Sets a reference to aApplicationContextused by this data importer/exporter to perform its function.- Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Parameters:
applicationContext-ApplicationContextused by this data importer/exporter.- See Also:
-
ApplicationContext
-
getApplicationContext
Return anOptionalreference to the configuredApplicationContextused by this data importer/exporter to perform its function. -
requireApplicationContext
protected org.springframework.context.ApplicationContext requireApplicationContext()Returns a required reference to the configuredApplicationContextused by this data importer/exporter.- Returns:
- a required reference to the configured
ApplicationContextused by this data importer/exporter. - Throws:
IllegalStateException- if anApplicationContextwas not configured (setApplicationContext(ApplicationContext)set).- See Also:
-
ApplicationContextgetApplicationContext()
-
setEnvironment
public void setEnvironment(org.springframework.core.env.Environment environment) Sets a reference to the configuredEnvironmentused by this data importer/exporter to perform its function.- Specified by:
setEnvironmentin interfaceorg.springframework.context.EnvironmentAware- Parameters:
environment- reference to the configuredEnvironment.- See Also:
-
Environment
-
getEnvironment
Returns anOptionalreference to the configuredEnvironmentused by this data importer/exporter to accessEnvironmentspecific configuration. -
requireEnvironment
protected org.springframework.core.env.Environment requireEnvironment()Returns a required reference to the configuredEnvironmentused by this data importer/exporter to accessEnvironmentspecific configuration.- Returns:
- a required reference to the configured
Environment. - Throws:
IllegalStateException- if theEnvironmentwas not configured (set).- See Also:
-
EnvironmentgetEnvironment()
-
getLogger
protected org.slf4j.Logger getLogger()Return the configuredLoggerto log messages.- Returns:
- the configured
Logger. - See Also:
-
Logger
-
getRegionPredicate
Returns the configuredPredicateused to filterRegionson data import/export. -
isExportEnabled
protected boolean isExportEnabled(@Nullable org.springframework.core.env.Environment environment) Null-safe method to determine whether export has been explicitly configured and enabled or disabled.- Parameters:
environment-Environmentused to assess the configuration of export.- Returns:
- a boolean value indicating whether the export is enabled (true) or disabled (false); false by default.
- See Also:
-
Environment
-
exportFrom
@NonNull public org.apache.geode.cache.Region exportFrom(@NonNull org.apache.geode.cache.Region region) Exports data contained in the givenRegion.- Specified by:
exportFromin interfaceCacheDataExporter- Parameters:
region-Regionto export data from.- Returns:
- the given
Region. - See Also:
-
doExportFrom
@NonNull protected abstract org.apache.geode.cache.Region doExportFrom(@NonNull org.apache.geode.cache.Region region) Exports data contained in the givenRegion.- Parameters:
region-Regionto export data from.- Returns:
- the given
Region. - See Also:
-
RegionexportFrom(Region)
-
isImportEnabled
protected boolean isImportEnabled(@Nullable org.springframework.core.env.Environment environment) Null-safe method to determine whether import has been explicitly configured and enabled or disabled.- Parameters:
environment-Environmentused to assess the configuration of the import.- Returns:
- a boolean value indicating whether the import is enabled (true) or disabled (false).
- See Also:
-
Environment
-
isImportProfilesActive
protected boolean isImportProfilesActive(@NonNull org.springframework.core.env.Environment environment) Determines whether the Cache Data Import data access operation is enabled based on the configured, active/default Profiles as declared in the SpringEnvironment.- Parameters:
environment-Environmentused to evaluate the configured, active Profiles; must not be null.- Returns:
- a boolean value indicating whether the the Cache Data Import data access operation is enabled based on the configured, active/default Profiles.
- Throws:
IllegalArgumentException- ifEnvironmentis null.- See Also:
-
EnvironmentuseDefaultProfilesIfEmpty(Environment, Set)getActiveProfiles(Environment)
-
importInto
@NonNull public org.apache.geode.cache.Region importInto(@NonNull org.apache.geode.cache.Region region) Imports data into the givenRegion.- Specified by:
importIntoin interfaceCacheDataImporter- Parameters:
region-Regionto import data into.- Returns:
- the given
Region. - See Also:
-
doImportInto
@NonNull protected abstract org.apache.geode.cache.Region doImportInto(@NonNull org.apache.geode.cache.Region region) Imports data into the givenRegion.- Parameters:
region-Regionto import data into.- Returns:
- the given
Region. - See Also:
-
RegionimportInto(Region)
-