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:
-
Predicate
Region
ApplicationContext
ApplicationContextAware
EnvironmentAware
Environment
CacheDataImporterExporter
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract org.apache.geode.cache.Region
doExportFrom
(org.apache.geode.cache.Region region) Exports data contained in the givenRegion
.protected abstract org.apache.geode.cache.Region
doImportInto
(org.apache.geode.cache.Region region) Imports data into the givenRegion
.org.apache.geode.cache.Region
exportFrom
(org.apache.geode.cache.Region region) Exports data contained in the givenRegion
.protected Optional<org.springframework.context.ApplicationContext>
Return anOptional
reference to the configuredApplicationContext
used by this data importer/exporter to perform its function.protected Optional<org.springframework.core.env.Environment>
Returns anOptional
reference to the configuredEnvironment
used by this data importer/exporter to accessEnvironment
specific configuration.protected org.slf4j.Logger
Return the configuredLogger
to log messages.protected Predicate<org.apache.geode.cache.Region<?,
?>> Returns the configuredPredicate
used to filterRegions
on data import/export.org.apache.geode.cache.Region
importInto
(org.apache.geode.cache.Region region) Imports data into the givenRegion
.protected boolean
isExportEnabled
(org.springframework.core.env.Environment environment) Null-safe method to determine whether export has been explicitly configured and enabled or disabled.protected boolean
isImportEnabled
(org.springframework.core.env.Environment environment) Null-safe method to determine whether import has been explicitly configured and enabled or disabled.protected boolean
isImportProfilesActive
(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.ApplicationContext
Returns a required reference to the configuredApplicationContext
used by this data importer/exporter.protected org.springframework.core.env.Environment
Returns a required reference to the configuredEnvironment
used by this data importer/exporter to accessEnvironment
specific configuration.void
setApplicationContext
(org.springframework.context.ApplicationContext applicationContext) Sets a reference to aApplicationContext
used by this data importer/exporter to perform its function.void
setEnvironment
(org.springframework.core.env.Environment environment) Sets a reference to the configuredEnvironment
used 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, wait
Methods inherited from interface org.springframework.beans.factory.config.BeanPostProcessor
postProcessBeforeInitialization
Methods inherited from interface org.springframework.geode.data.CacheDataExporter
postProcessBeforeDestruction
Methods inherited from interface org.springframework.geode.data.CacheDataImporter
postProcessAfterInitialization
Methods 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 aApplicationContext
used by this data importer/exporter to perform its function.- Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
- Parameters:
applicationContext
-ApplicationContext
used by this data importer/exporter.- See Also:
-
ApplicationContext
-
getApplicationContext
Return anOptional
reference to the configuredApplicationContext
used by this data importer/exporter to perform its function. -
requireApplicationContext
protected org.springframework.context.ApplicationContext requireApplicationContext()Returns a required reference to the configuredApplicationContext
used by this data importer/exporter.- Returns:
- a required reference to the configured
ApplicationContext
used by this data importer/exporter. - Throws:
IllegalStateException
- if anApplicationContext
was not configured (setApplicationContext(ApplicationContext)
set).- See Also:
-
ApplicationContext
getApplicationContext()
-
setEnvironment
public void setEnvironment(org.springframework.core.env.Environment environment) Sets a reference to the configuredEnvironment
used by this data importer/exporter to perform its function.- Specified by:
setEnvironment
in interfaceorg.springframework.context.EnvironmentAware
- Parameters:
environment
- reference to the configuredEnvironment
.- See Also:
-
Environment
-
getEnvironment
Returns anOptional
reference to the configuredEnvironment
used by this data importer/exporter to accessEnvironment
specific configuration. -
requireEnvironment
protected org.springframework.core.env.Environment requireEnvironment()Returns a required reference to the configuredEnvironment
used by this data importer/exporter to accessEnvironment
specific configuration.- Returns:
- a required reference to the configured
Environment
. - Throws:
IllegalStateException
- if theEnvironment
was not configured (set
).- See Also:
-
Environment
getEnvironment()
-
getLogger
protected org.slf4j.Logger getLogger()Return the configuredLogger
to log messages.- Returns:
- the configured
Logger
. - See Also:
-
Logger
-
getRegionPredicate
Returns the configuredPredicate
used to filterRegions
on 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
-Environment
used 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:
exportFrom
in interfaceCacheDataExporter
- Parameters:
region
-Region
to 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
-Region
to export data from.- Returns:
- the given
Region
. - See Also:
-
Region
exportFrom(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
-Environment
used 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
-Environment
used 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
- ifEnvironment
is null.- See Also:
-
Environment
useDefaultProfilesIfEmpty(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:
importInto
in interfaceCacheDataImporter
- Parameters:
region
-Region
to 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
-Region
to import data into.- Returns:
- the given
Region
. - See Also:
-
Region
importInto(Region)
-