@Component public class JsonCacheDataImporterExporter extends ResourceCapableCacheDataImporterExporter
JsonCacheDataImporterExporter class is a CacheDataImporter and CacheDataExporter
implementation that can export/import JSON data to/from a Resource given a target Region.Region,
PdxInstance,
Resource,
CacheDataExporter,
CacheDataImporter,
JsonToPdxArrayConverter,
ObjectArrayToJsonConverter,
JacksonJsonToPdxConverter,
ResourceCapableCacheDataImporterExporter,
ObjectPdxInstanceAdapter,
PdxInstanceWrapper,
ComponentResourceCapableCacheDataImporterExporter.AbstractCacheResourceResolver, ResourceCapableCacheDataImporterExporter.AbstractExportResourceResolver, ResourceCapableCacheDataImporterExporter.AbstractImportResourceResolver, ResourceCapableCacheDataImporterExporter.CacheResourceResolver, ResourceCapableCacheDataImporterExporter.ClassPathImportResourceResolver, ResourceCapableCacheDataImporterExporter.ExportResourceResolver, ResourceCapableCacheDataImporterExporter.FileSystemExportResourceResolver, ResourceCapableCacheDataImporterExporter.ImportResourceResolver| Modifier and Type | Field and Description |
|---|---|
protected static org.apache.geode.pdx.PdxInstance[] |
EMPTY_PDX_INSTANCE_ARRAY |
CACHE_DATA_EXPORT_RESOURCE_LOCATION_PROPERTY_NAME, CACHE_DATA_IMPORT_RESOURCE_LOCATION_PROPERTY_NAME, RESOURCE_NAME_PATTERNCACHE_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 and Description |
|---|
JsonCacheDataImporterExporter() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet()
Initializes the JSON to PDX (array) converter.
|
org.apache.geode.cache.Region |
doExportFrom(org.apache.geode.cache.Region region)
Exports data contained in the given
Region. |
org.apache.geode.cache.Region |
doImportInto(org.apache.geode.cache.Region region)
Imports data into the given
Region. |
protected JsonToPdxArrayConverter |
getJsonToPdxArrayConverter()
Returns a reference to the configured
JsonToPdxArrayConverter. |
protected org.apache.geode.pdx.PdxInstance |
postProcess(org.apache.geode.pdx.PdxInstance pdxInstance)
Post processes the given {
PdxInstance. |
protected java.lang.Object |
resolveKey(org.apache.geode.pdx.PdxInstance pdxInstance)
Resolves the
key used to map the given PdxInstance as the value
for the Region.Entry stored in the Region. |
protected java.lang.Object |
resolveValue(org.apache.geode.pdx.PdxInstance pdxInstance)
Resolves the
value to store in the Region from the given PdxInstance. |
protected java.lang.String |
toJson(org.apache.geode.cache.Region region)
Convert
values contained in the Region to JSON. |
protected org.apache.geode.pdx.PdxInstance[] |
toPdx(byte[] json)
Converts the array of
bytes containing multiple JSON objects
into an array of PdxInstances. |
getExportResourceResolver, getImportResourceResolver, getResourceLoader, getResourceReader, getResourceWriter, setExportResourceResolver, setImportResourceResolver, setResourceLoader, setResourceReader, setResourceWriterexportFrom, getApplicationContext, getEnvironment, getLogger, getRegionPredicate, importInto, isExportEnabled, isImportEnabled, isImportProfilesActive, requireApplicationContext, requireEnvironment, setApplicationContext, setEnvironmentclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpostProcessBeforeDestructionrequiresDestructionpostProcessAfterInitialization, postProcessBeforeInitializationpostProcessAfterInitializationprotected static final org.apache.geode.pdx.PdxInstance[] EMPTY_PDX_INSTANCE_ARRAY
public void afterPropertiesSet()
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanafterPropertiesSet in class ResourceCapableCacheDataImporterExporternewJsonToPdxArrayConverter()@NonNull protected JsonToPdxArrayConverter getJsonToPdxArrayConverter()
JsonToPdxArrayConverter.JsonToPdxArrayConverter.JsonToPdxArrayConverter@NonNull
public org.apache.geode.cache.Region doExportFrom(@NonNull
org.apache.geode.cache.Region region)
AbstractCacheDataImporterExporterRegion.doExportFrom in class AbstractCacheDataImporterExporterregion - Region to export data from.Region.Region,
AbstractCacheDataImporterExporter.exportFrom(Region)@NonNull
public org.apache.geode.cache.Region doImportInto(@NonNull
org.apache.geode.cache.Region region)
AbstractCacheDataImporterExporterRegion.doImportInto in class AbstractCacheDataImporterExporterregion - Region to import data into.Region.Region,
AbstractCacheDataImporterExporter.importInto(Region)protected org.apache.geode.pdx.PdxInstance postProcess(org.apache.geode.pdx.PdxInstance pdxInstance)
PdxInstance.pdxInstance - PdxInstance to process.PdxInstance.PdxInstance@NonNull
protected java.lang.Object resolveKey(@NonNull
org.apache.geode.pdx.PdxInstance pdxInstance)
key used to map the given PdxInstance as the value
for the Region.Entry stored in the Region.pdxInstance - PdxInstance used to resolve the key.key.PdxInstanceWrapper.getIdentifier(),
PdxInstance@Nullable
protected java.lang.Object resolveValue(@Nullable
org.apache.geode.pdx.PdxInstance pdxInstance)
value to store in the Region from the given PdxInstance.
If the given PdxInstance is an instance of PdxInstanceWrapper then this method will return
the underlying, delegate PdxInstance.
If the given PdxInstance is an instance of ObjectPdxInstanceAdapter then this method will return
the underlying, Object.
Otherwise, the given PdxInstance is returned.pdxInstance - PdxInstance to unwrap.value.ObjectPdxInstanceAdapter.unwrap(PdxInstance),
PdxInstanceWrapper.unwrap(PdxInstance),
PdxInstance,
postProcess(PdxInstance)@NonNull
protected java.lang.String toJson(@NonNull
org.apache.geode.cache.Region region)
values contained in the Region to JSON.region - Region to process; must not be null.JSON containing the values from the given Region.Region@NonNull
protected org.apache.geode.pdx.PdxInstance[] toPdx(@NonNull
byte[] json)
bytes containing multiple JSON objects
into an array of PdxInstances.json - array of bytes containing the JSON to convert to PDX.PdxInstances for each JSON object.PdxInstance,
getJsonToPdxArrayConverter()