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
Modifier 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_PATTERN
Fields 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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Initializes the JSON to PDX (array) converter.org.apache.geode.cache.Region
doExportFrom
(org.apache.geode.cache.Region region) Exports data contained in the givenRegion
.org.apache.geode.cache.Region
doImportInto
(org.apache.geode.cache.Region region) Imports data into the givenRegion
.protected JsonToPdxArrayConverter
Returns a reference to the configuredJsonToPdxArrayConverter
.protected org.apache.geode.pdx.PdxInstance
postProcess
(org.apache.geode.pdx.PdxInstance pdxInstance) Post processes the given {PdxInstance
.protected Object
resolveKey
(org.apache.geode.pdx.PdxInstance pdxInstance) protected Object
resolveValue
(org.apache.geode.pdx.PdxInstance pdxInstance) protected String
toJson
(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, setResourceWriter
Methods inherited from class org.springframework.geode.data.AbstractCacheDataImporterExporter
exportFrom, getApplicationContext, getEnvironment, getLogger, getRegionPredicate, importInto, isExportEnabled, isImportEnabled, isImportProfilesActive, requireApplicationContext, requireEnvironment, setApplicationContext, setEnvironment
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
-
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:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Overrides:
afterPropertiesSet
in 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) Exports data contained in the givenRegion
.- Specified by:
doExportFrom
in classAbstractCacheDataImporterExporter
- Parameters:
region
-Region
to 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) Imports data into the givenRegion
.- Specified by:
doImportInto
in classAbstractCacheDataImporterExporter
- Parameters:
region
-Region
to 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
-PdxInstance
to process.- Returns:
- the
PdxInstance
. - See Also:
-
PdxInstance
-
resolveKey
Resolves thekey
used to map the givenPdxInstance
as thevalue
for theRegion.Entry
stored in theRegion
.- Parameters:
pdxInstance
-PdxInstance
used to resolve thekey
.- Returns:
- the resolved
key
. - See Also:
-
PdxInstanceWrapper.getIdentifier()
PdxInstance
-
resolveValue
Resolves thevalue
to store in theRegion
from the givenPdxInstance
. If the givenPdxInstance
is an instance ofPdxInstanceWrapper
then this method will return the underlying,delegate
PdxInstance
. If the givenPdxInstance
is an instance ofObjectPdxInstanceAdapter
then this method will return the underlying,Object
. Otherwise, the givenPdxInstance
is returned.- Parameters:
pdxInstance
-PdxInstance
to unwrap.- Returns:
- the resolved
value
. - See Also:
-
toJson
-
toPdx
@NonNull protected org.apache.geode.pdx.PdxInstance[] toPdx(@NonNull byte[] json) - Parameters:
json
- array ofbytes
containing theJSON
to convert to PDX.- Returns:
- an array of
PdxInstances
for eachJSON
object. - See Also:
-
PdxInstance
getJsonToPdxArrayConverter()
-