public abstract class AbstractCacheDataImporterExporter extends java.lang.Object implements org.springframework.context.ApplicationContextAware, CacheDataImporterExporter, org.springframework.context.EnvironmentAware
CacheDataImporter
and CacheDataExporter
interfaces in order to
simplify import/export data access operation implementations in a consistent way.Predicate
,
Region
,
ApplicationContext
,
ApplicationContextAware
,
EnvironmentAware
,
Environment
,
CacheDataImporterExporter
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
CACHE_DATA_EXPORT_ENABLED_PROPERTY_NAME |
protected static java.lang.String |
CACHE_DATA_IMPORT_ACTIVE_PROFILES_PROPERTY_NAME |
protected static java.lang.String |
CACHE_DATA_IMPORT_ENABLED_PROPERTY_NAME |
protected static boolean |
DEFAULT_CACHE_DATA_EXPORT_ENABLED |
protected static java.lang.String |
DEFAULT_CACHE_DATA_IMPORT_ACTIVE_PROFILES |
protected static boolean |
DEFAULT_CACHE_DATA_IMPORT_ENABLED |
Constructor and Description |
---|
AbstractCacheDataImporterExporter() |
Modifier and Type | Method and Description |
---|---|
protected abstract org.apache.geode.cache.Region |
doExportFrom(org.apache.geode.cache.Region region)
Exports data contained in the given
Region . |
protected abstract org.apache.geode.cache.Region |
doImportInto(org.apache.geode.cache.Region region)
Imports data into the given
Region . |
org.apache.geode.cache.Region |
exportFrom(org.apache.geode.cache.Region region)
Exports data contained in the given
Region . |
protected java.util.Optional<org.springframework.context.ApplicationContext> |
getApplicationContext()
Return an
Optional reference to the configured ApplicationContext used by
this data importer/exporter to perform its function. |
protected java.util.Optional<org.springframework.core.env.Environment> |
getEnvironment()
Returns an
Optional reference to the configured Environment used by this data importer/exporter
to access Environment specific configuration. |
protected org.slf4j.Logger |
getLogger()
Return the configured
Logger to log messages. |
protected java.util.function.Predicate<org.apache.geode.cache.Region<?,?>> |
getRegionPredicate()
Returns the configured
Predicate used to filter Regions on data import/export. |
org.apache.geode.cache.Region |
importInto(org.apache.geode.cache.Region region)
Imports data into the given
Region . |
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 Spring
Environment . |
protected org.springframework.context.ApplicationContext |
requireApplicationContext()
Returns a required reference to the configured
ApplicationContext used by this data importer/exporter. |
protected org.springframework.core.env.Environment |
requireEnvironment()
Returns a required reference to the configured
Environment used by this data importer/exporter
to access Environment specific configuration. |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
Sets a reference to a
ApplicationContext used by this data importer/exporter to perform its function. |
void |
setEnvironment(org.springframework.core.env.Environment environment)
Sets a reference to the configured
Environment used by this data importer/exporter
to perform its function. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
postProcessBeforeDestruction
requiresDestruction
postProcessAfterInitialization, postProcessBeforeInitialization
postProcessAfterInitialization
protected static final boolean DEFAULT_CACHE_DATA_EXPORT_ENABLED
protected static final boolean DEFAULT_CACHE_DATA_IMPORT_ENABLED
protected static final java.lang.String CACHE_DATA_EXPORT_ENABLED_PROPERTY_NAME
protected static final java.lang.String CACHE_DATA_IMPORT_ACTIVE_PROFILES_PROPERTY_NAME
protected static final java.lang.String CACHE_DATA_IMPORT_ENABLED_PROPERTY_NAME
protected static final java.lang.String DEFAULT_CACHE_DATA_IMPORT_ACTIVE_PROFILES
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
ApplicationContext
used by this data importer/exporter to perform its function.setApplicationContext
in interface org.springframework.context.ApplicationContextAware
applicationContext
- ApplicationContext
used by this data importer/exporter.ApplicationContext
protected java.util.Optional<org.springframework.context.ApplicationContext> getApplicationContext()
Optional
reference to the configured ApplicationContext
used by
this data importer/exporter to perform its function.Optional
reference to the configured ApplicationContext
used by
this data importer/exporter.ApplicationContext
,
Optional
protected org.springframework.context.ApplicationContext requireApplicationContext()
ApplicationContext
used by this data importer/exporter.ApplicationContext
used by this data importer/exporter.java.lang.IllegalStateException
- if an ApplicationContext
was not configured
(setApplicationContext(ApplicationContext)
set).ApplicationContext
,
getApplicationContext()
public void setEnvironment(org.springframework.core.env.Environment environment)
Environment
used by this data importer/exporter
to perform its function.setEnvironment
in interface org.springframework.context.EnvironmentAware
environment
- reference to the configured Environment
.Environment
protected java.util.Optional<org.springframework.core.env.Environment> getEnvironment()
Optional
reference to the configured Environment
used by this data importer/exporter
to access Environment
specific configuration.Optional
reference to the configured Environment
used by this data importer/exporter
to access Environment
specific configuration.Environment
,
Optional
protected org.springframework.core.env.Environment requireEnvironment()
Environment
used by this data importer/exporter
to access Environment
specific configuration.Environment
.java.lang.IllegalStateException
- if the Environment
was not configured
(set
).Environment
,
getEnvironment()
protected org.slf4j.Logger getLogger()
Logger
to log messages.Logger
.Logger
@NonNull protected java.util.function.Predicate<org.apache.geode.cache.Region<?,?>> getRegionPredicate()
Predicate
used to filter Regions
on data import/export.Predicate
used to filter Regions
on data import/export.Region
,
Predicate
protected boolean isExportEnabled(@Nullable org.springframework.core.env.Environment environment)
environment
- Environment
used to assess the configuration of export.Environment
@NonNull public org.apache.geode.cache.Region exportFrom(@NonNull org.apache.geode.cache.Region region)
Region
.exportFrom
in interface CacheDataExporter
region
- Region
to export data from.Region
.Region
,
isExportEnabled(Environment)
,
getRegionPredicate()
,
doExportFrom(Region)
@NonNull protected abstract org.apache.geode.cache.Region doExportFrom(@NonNull org.apache.geode.cache.Region region)
Region
.region
- Region
to export data from.Region
.Region
,
exportFrom(Region)
protected boolean isImportEnabled(@Nullable org.springframework.core.env.Environment environment)
environment
- Environment
used to assess the configuration of the import.Environment
protected boolean isImportProfilesActive(@NonNull org.springframework.core.env.Environment environment)
Environment
.environment
- Environment
used to evaluate the configured, active Profiles;
must not be null.java.lang.IllegalArgumentException
- if Environment
is null.Environment
,
useDefaultProfilesIfEmpty(Environment, Set)
,
getActiveProfiles(Environment)
@NonNull public org.apache.geode.cache.Region importInto(@NonNull org.apache.geode.cache.Region region)
Region
.importInto
in interface CacheDataImporter
region
- Region
to import data into.Region
.Region
,
isImportEnabled(Environment)
,
isImportProfilesActive(Environment)
,
getRegionPredicate()
,
doImportInto(Region)
@NonNull protected abstract org.apache.geode.cache.Region doImportInto(@NonNull org.apache.geode.cache.Region region)
Region
.region
- Region
to import data into.Region
.Region
,
importInto(Region)