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:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final String
     
    protected static final String
     
    protected static final String
     
    protected static final boolean
     
    protected static final String
     
    protected static final boolean
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    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 Optional<org.springframework.context.ApplicationContext>
    Return an Optional reference to the configured ApplicationContext used by this data importer/exporter to perform its function.
    protected Optional<org.springframework.core.env.Environment>
    Returns an Optional reference to the configured Environment used by this data importer/exporter to access Environment specific configuration.
    protected org.slf4j.Logger
    Return the configured Logger to log messages.
    protected Predicate<org.apache.geode.cache.Region<?,?>>
    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
    Returns a required reference to the configured ApplicationContext used by this data importer/exporter.
    protected org.springframework.core.env.Environment
    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.

    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

      protected static final String CACHE_DATA_EXPORT_ENABLED_PROPERTY_NAME
      See Also:
    • CACHE_DATA_IMPORT_ACTIVE_PROFILES_PROPERTY_NAME

      protected static final String CACHE_DATA_IMPORT_ACTIVE_PROFILES_PROPERTY_NAME
      See Also:
    • CACHE_DATA_IMPORT_ENABLED_PROPERTY_NAME

      protected static final String CACHE_DATA_IMPORT_ENABLED_PROPERTY_NAME
      See Also:
    • DEFAULT_CACHE_DATA_IMPORT_ACTIVE_PROFILES

      protected static final String 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 a ApplicationContext used by this data importer/exporter to perform its function.
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Parameters:
      applicationContext - ApplicationContext used by this data importer/exporter.
      See Also:
      • ApplicationContext
    • getApplicationContext

      protected Optional<org.springframework.context.ApplicationContext> getApplicationContext()
      Return an Optional reference to the configured ApplicationContext used by this data importer/exporter to perform its function.
      Returns:
      an Optional reference to the configured ApplicationContext used by this data importer/exporter.
      See Also:
    • requireApplicationContext

      protected org.springframework.context.ApplicationContext requireApplicationContext()
      Returns a required reference to the configured ApplicationContext used by this data importer/exporter.
      Returns:
      a required reference to the configured ApplicationContext used by this data importer/exporter.
      Throws:
      IllegalStateException - if an ApplicationContext was not configured (setApplicationContext(ApplicationContext) set).
      See Also:
    • setEnvironment

      public 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.
      Specified by:
      setEnvironment in interface org.springframework.context.EnvironmentAware
      Parameters:
      environment - reference to the configured Environment.
      See Also:
      • Environment
    • getEnvironment

      protected 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.
      Returns:
      an Optional reference to the configured Environment used by this data importer/exporter to access Environment specific configuration.
      See Also:
    • requireEnvironment

      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.
      Returns:
      a required reference to the configured Environment.
      Throws:
      IllegalStateException - if the Environment was not configured (set).
      See Also:
    • getLogger

      protected org.slf4j.Logger getLogger()
      Return the configured Logger to log messages.
      Returns:
      the configured Logger.
      See Also:
      • Logger
    • getRegionPredicate

      @NonNull protected Predicate<org.apache.geode.cache.Region<?,?>> getRegionPredicate()
      Returns the configured Predicate used to filter Regions on data import/export.
      Returns:
      the configured Predicate used to filter Regions on data import/export.
      See Also:
    • 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 given Region.
      Specified by:
      exportFrom in interface CacheDataExporter
      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 given Region.
      Parameters:
      region - Region to export data from.
      Returns:
      the given Region.
      See Also:
    • 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 Spring Environment.
      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 - if Environment 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 given Region.
      Specified by:
      importInto in interface CacheDataImporter
      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 given Region.
      Parameters:
      region - Region to import data into.
      Returns:
      the given Region.
      See Also: