Class JsonCacheDataImporterExporter
java.lang.Object
org.springframework.geode.data.AbstractCacheDataImporterExporter
org.springframework.geode.data.support.ResourceCapableCacheDataImporterExporter
org.springframework.geode.data.json.JsonCacheDataImporterExporter
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.config.BeanPostProcessor,org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor,org.springframework.beans.factory.InitializingBean,org.springframework.context.ApplicationContextAware,org.springframework.context.EnvironmentAware,org.springframework.context.ResourceLoaderAware,CacheDataExporter,CacheDataImporter,CacheDataImporterExporter
@Component
public class JsonCacheDataImporterExporter
extends ResourceCapableCacheDataImporterExporter
The
JsonCacheDataImporterExporter class is a CacheDataImporter and CacheDataExporter
implementation that can export/import JSON data to/from a Resource given a target Region.- Since:
- 1.3.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.geode.data.support.ResourceCapableCacheDataImporterExporter
ResourceCapableCacheDataImporterExporter.AbstractCacheResourceResolver, ResourceCapableCacheDataImporterExporter.AbstractExportResourceResolver, ResourceCapableCacheDataImporterExporter.AbstractImportResourceResolver, ResourceCapableCacheDataImporterExporter.CacheResourceResolver, ResourceCapableCacheDataImporterExporter.ClassPathImportResourceResolver, ResourceCapableCacheDataImporterExporter.ExportResourceResolver, ResourceCapableCacheDataImporterExporter.FileSystemExportResourceResolver, ResourceCapableCacheDataImporterExporter.ImportResourceResolver -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final org.apache.geode.pdx.PdxInstance[]Fields inherited from class org.springframework.geode.data.support.ResourceCapableCacheDataImporterExporter
CACHE_DATA_EXPORT_RESOURCE_LOCATION_PROPERTY_NAME, CACHE_DATA_IMPORT_RESOURCE_LOCATION_PROPERTY_NAME, RESOURCE_NAME_PATTERNFields inherited from class org.springframework.geode.data.AbstractCacheDataImporterExporter
CACHE_DATA_EXPORT_ENABLED_PROPERTY_NAME, CACHE_DATA_IMPORT_ACTIVE_PROFILES_PROPERTY_NAME, CACHE_DATA_IMPORT_ENABLED_PROPERTY_NAME, DEFAULT_CACHE_DATA_EXPORT_ENABLED, DEFAULT_CACHE_DATA_IMPORT_ACTIVE_PROFILES, DEFAULT_CACHE_DATA_IMPORT_ENABLED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidInitializes the JSON to PDX (array) converter.org.apache.geode.cache.RegiondoExportFrom(org.apache.geode.cache.Region region) Exports data contained in the givenRegion.org.apache.geode.cache.RegiondoImportInto(org.apache.geode.cache.Region region) Imports data into the givenRegion.protected JsonToPdxArrayConverterReturns a reference to the configuredJsonToPdxArrayConverter.protected org.apache.geode.pdx.PdxInstancepostProcess(org.apache.geode.pdx.PdxInstance pdxInstance) Post processes the given {PdxInstance.protected ObjectresolveKey(org.apache.geode.pdx.PdxInstance pdxInstance) protected ObjectresolveValue(org.apache.geode.pdx.PdxInstance pdxInstance) protected StringtoJson(org.apache.geode.cache.Region region) protected org.apache.geode.pdx.PdxInstance[]toPdx(byte[] json) Methods inherited from class org.springframework.geode.data.support.ResourceCapableCacheDataImporterExporter
getExportResourceResolver, getImportResourceResolver, getResourceLoader, getResourceReader, getResourceWriter, setExportResourceResolver, setImportResourceResolver, setResourceLoader, setResourceReader, setResourceWriterMethods inherited from class org.springframework.geode.data.AbstractCacheDataImporterExporter
exportFrom, getApplicationContext, getEnvironment, getLogger, getRegionPredicate, importInto, isExportEnabled, isImportEnabled, isImportProfilesActive, requireApplicationContext, requireEnvironment, setApplicationContext, setEnvironmentMethods 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
-
EMPTY_PDX_INSTANCE_ARRAY
protected static final org.apache.geode.pdx.PdxInstance[] EMPTY_PDX_INSTANCE_ARRAY
-
-
Constructor Details
-
JsonCacheDataImporterExporter
public JsonCacheDataImporterExporter()
-
-
Method Details
-
afterPropertiesSet
public void afterPropertiesSet()Initializes the JSON to PDX (array) converter.- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Overrides:
afterPropertiesSetin classResourceCapableCacheDataImporterExporter- See Also:
-
newJsonToPdxArrayConverter()
-
getJsonToPdxArrayConverter
Returns a reference to the configuredJsonToPdxArrayConverter.- Returns:
- a reference to the configured
JsonToPdxArrayConverter. - See Also:
-
doExportFrom
@NonNull public org.apache.geode.cache.Region doExportFrom(@NonNull org.apache.geode.cache.Region region) Description copied from class:AbstractCacheDataImporterExporterExports data contained in the givenRegion.- Specified by:
doExportFromin classAbstractCacheDataImporterExporter- Parameters:
region-Regionto export data from.- Returns:
- the given
Region. - See Also:
-
doImportInto
@NonNull public org.apache.geode.cache.Region doImportInto(@NonNull org.apache.geode.cache.Region region) Description copied from class:AbstractCacheDataImporterExporterImports data into the givenRegion.- Specified by:
doImportIntoin classAbstractCacheDataImporterExporter- Parameters:
region-Regionto import data into.- Returns:
- the given
Region. - See Also:
-
postProcess
protected org.apache.geode.pdx.PdxInstance postProcess(org.apache.geode.pdx.PdxInstance pdxInstance) Post processes the given {PdxInstance.- Parameters:
pdxInstance-PdxInstanceto process.- Returns:
- the
PdxInstance. - See Also:
-
PdxInstance
-
resolveKey
Resolves thekeyused to map the givenPdxInstanceas thevaluefor theRegion.Entrystored in theRegion.- Parameters:
pdxInstance-PdxInstanceused to resolve thekey.- Returns:
- the resolved
key. - See Also:
-
PdxInstanceWrapper.getIdentifier()PdxInstance
-
resolveValue
Resolves thevalueto store in theRegionfrom the givenPdxInstance. If the givenPdxInstanceis an instance ofPdxInstanceWrapperthen this method will return the underlying,delegatePdxInstance. If the givenPdxInstanceis an instance ofObjectPdxInstanceAdapterthen this method will return the underlying,Object. Otherwise, the givenPdxInstanceis returned.- Parameters:
pdxInstance-PdxInstanceto unwrap.- Returns:
- the resolved
value. - See Also:
-
toJson
-
toPdx
@NonNull protected org.apache.geode.pdx.PdxInstance[] toPdx(@NonNull byte[] json) - Parameters:
json- array ofbytescontaining theJSONto convert to PDX.- Returns:
- an array of
PdxInstancesfor eachJSONobject. - See Also:
-
PdxInstancegetJsonToPdxArrayConverter()
-