public class SnapshotServiceFactoryBean<K,V> extends Object implements FactoryBean<SnapshotServiceFactoryBean.SnapshotServiceAdapter<K,V>>, InitializingBean, DisposableBean, ApplicationListener<SnapshotApplicationEvent<K,V>>
DisposableBean
,
FactoryBean
,
InitializingBean
,
ApplicationListener
,
SnapshotServiceFactoryBean.SnapshotServiceAdapter
,
CacheSnapshotService
,
RegionSnapshotService
Modifier and Type | Class and Description |
---|---|
protected static class |
SnapshotServiceFactoryBean.ArchiveFileFilter
The ArchiveFileFilter class is a Java FileFilter implementation accepting any File that is either
a JAR file or ZIP file.
|
protected static class |
SnapshotServiceFactoryBean.CacheSnapshotServiceAdapter
The CacheSnapshotServiceAdapter is a SnapshotServiceAdapter adapting GemFire's CacheSnapshotService.
|
protected static class |
SnapshotServiceFactoryBean.RegionSnapshotServiceAdapter<K,V>
The RegionSnapshotServiceAdapter is a SnapshotServiceAdapter adapting GemFire's RegionSnapshotService.
|
static class |
SnapshotServiceFactoryBean.SnapshotMetadata<K,V>
The SnapshotMetadata class encapsulates details of the GemFire Cache or Region data snapshot
on either import or export.
|
static interface |
SnapshotServiceFactoryBean.SnapshotServiceAdapter<K,V>
The SnapshotServiceAdapter interface is an Adapter adapting both GemFire CacheSnapshotService
and RegionSnapshotService to treat them uniformly.
|
protected static class |
SnapshotServiceFactoryBean.SnapshotServiceAdapterSupport<K,V>
SnapshotServiceAdapterSupport is an abstract base class for all SnapshotServiceAdapter implementations
encapsulating common reusable functionality.
|
Modifier and Type | Field and Description |
---|---|
protected static SnapshotServiceFactoryBean.SnapshotMetadata[] |
EMPTY_ARRAY |
Constructor and Description |
---|
SnapshotServiceFactoryBean() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Constructs and initializes the GemFire Snapshot Service used to take a snapshot of the configured Cache
or Region if initialized.
|
protected SnapshotServiceFactoryBean.SnapshotServiceAdapter |
create()
Constructs an appropriate instance of the SnapshotServiceAdapter based on the FactoryBean configuration.
|
void |
destroy()
Performs an export of the GemFire Cache or Region if configured.
|
protected org.apache.geode.cache.Cache |
getCache()
Gets a reference to the GemFire Cache for which the snapshot will be taken.
|
protected SnapshotServiceFactoryBean.SnapshotMetadata<K,V>[] |
getExports()
Sets the meta-data (location, filter and format) used to create a snapshot from the Cache or Region data.
|
protected SnapshotServiceFactoryBean.SnapshotMetadata<K,V>[] |
getImports()
Gets the meta-data (location, filter and format) used to read a data snapshot into an entire Cache
or individual Region.
|
SnapshotServiceFactoryBean.SnapshotServiceAdapter<K,V> |
getObject()
Gets the reference to the GemFire Snapshot Service created by this FactoryBean.
|
Class<?> |
getObjectType()
Gets the type of Snapshot Service created by this FactoryBean.
|
protected org.apache.geode.cache.Region<K,V> |
getRegion()
Gets a reference to the GemFire Region for which the snapshot will be taken.
|
protected boolean |
getSuppressImportOnInit()
Determines whether importing on initialization should be suppressed.
|
protected boolean |
isMatch(SnapshotApplicationEvent event)
Determines whether the details of the given SnapshotApplicationEvent match the criteria of this factory
to trigger a GemFire Cache or Region data export.
|
boolean |
isSingleton()
Determines this this FactoryBean creates single GemFire Snapshot Service instances.
|
void |
onApplicationEvent(SnapshotApplicationEvent<K,V> event)
Listens for SnapshotApplicationEvents triggering a GemFire Cache-wide or Region data snapshot import/export
when details of the event match the criteria of this factory's constructed GemFire SnapshotService.
|
protected SnapshotServiceFactoryBean.SnapshotMetadata<K,V>[] |
resolveSnapshotMetadata(SnapshotApplicationEvent<K,V> event)
Resolves the SnapshotMetadata used to perform the GemFire Cache or Region data snapshot import/export.
|
void |
setCache(org.apache.geode.cache.Cache cache)
Sets a reference to the GemFire Cache for which the snapshot will be taken.
|
void |
setExports(SnapshotServiceFactoryBean.SnapshotMetadata<K,V>[] exports)
Sets the meta-data (location, filter and format) used to create a snapshot from the Cache or Region data.
|
void |
setImports(SnapshotServiceFactoryBean.SnapshotMetadata<K,V>[] imports)
Sets the meta-data (location, filter and format) used to read a data snapshot into an entire Cache
or individual Region.
|
void |
setRegion(org.apache.geode.cache.Region<K,V> region)
Sets a reference to the GemFire Region for which the snapshot will be taken.
|
void |
setSuppressImportOnInit(Boolean suppressImportOnInit)
Sets a boolean condition to indicate whether importing on initialization should be suppressed.
|
protected SnapshotServiceFactoryBean.SnapshotServiceAdapter<Object,Object> |
wrap(org.apache.geode.cache.snapshot.CacheSnapshotService cacheSnapshotService)
Wraps the GemFire CacheSnapshotService into an appropriate Adapter to uniformly access snapshot operations
on the Cache and Regions alike.
|
protected SnapshotServiceFactoryBean.SnapshotServiceAdapter<K,V> |
wrap(org.apache.geode.cache.snapshot.RegionSnapshotService<K,V> regionSnapshotService)
Wraps GemFire's RegionSnapshotService into an appropriate Adapter to uniformly access snapshot operations
on the Cache and Regions alike.
|
protected static final SnapshotServiceFactoryBean.SnapshotMetadata[] EMPTY_ARRAY
public void setCache(org.apache.geode.cache.Cache cache)
cache
- the GemFire Cache used to create an instance of CacheSnapshotService.IllegalArgumentException
- if the Cache reference is null.Cache
,
getCache()
protected org.apache.geode.cache.Cache getCache()
IllegalStateException
- if the Cache argument is null.Cache
,
setCache(Cache)
public void setExports(SnapshotServiceFactoryBean.SnapshotMetadata<K,V>[] exports)
exports
- an array of snapshot meta-data used for each export.SnapshotServiceFactoryBean.SnapshotMetadata
protected SnapshotServiceFactoryBean.SnapshotMetadata<K,V>[] getExports()
SnapshotServiceFactoryBean.SnapshotMetadata
public void setImports(SnapshotServiceFactoryBean.SnapshotMetadata<K,V>[] imports)
imports
- an array of snapshot meta-data used for each import.SnapshotServiceFactoryBean.SnapshotMetadata
protected SnapshotServiceFactoryBean.SnapshotMetadata<K,V>[] getImports()
SnapshotServiceFactoryBean.SnapshotMetadata
public void setRegion(org.apache.geode.cache.Region<K,V> region)
region
- the GemFire Region used to create an instance of the RegionSnapshotService.Region
,
getRegion()
protected org.apache.geode.cache.Region<K,V> getRegion()
Region
,
getRegion()
public void setSuppressImportOnInit(Boolean suppressImportOnInit)
suppressImportOnInit
- a Boolean value to indicate whether importing on initialization should be suppressed.getSuppressImportOnInit()
protected boolean getSuppressImportOnInit()
setSuppressImportOnInit(Boolean)
,
afterPropertiesSet()
public SnapshotServiceFactoryBean.SnapshotServiceAdapter<K,V> getObject() throws Exception
getObject
in interface FactoryBean<SnapshotServiceFactoryBean.SnapshotServiceAdapter<K,V>>
Exception
- if the GemFire Snapshot Service failed to be created.SnapshotServiceFactoryBean.SnapshotServiceAdapter
public Class<?> getObjectType()
getObjectType
in interface FactoryBean<SnapshotServiceFactoryBean.SnapshotServiceAdapter<K,V>>
SnapshotServiceFactoryBean.SnapshotServiceAdapter
,
SnapshotServiceFactoryBean.CacheSnapshotServiceAdapter
,
SnapshotServiceFactoryBean.RegionSnapshotServiceAdapter
public boolean isSingleton()
isSingleton
in interface FactoryBean<SnapshotServiceFactoryBean.SnapshotServiceAdapter<K,V>>
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
Exception
- if the construction and initialization of the GemFire Snapshot Service fails.SnapshotServiceFactoryBean.SnapshotServiceAdapter
,
getSuppressImportOnInit()
,
getImports()
,
create()
protected SnapshotServiceFactoryBean.SnapshotServiceAdapter create()
wrap(CacheSnapshotService)
,
wrap(RegionSnapshotService)
,
getRegion()
protected SnapshotServiceFactoryBean.SnapshotServiceAdapter<Object,Object> wrap(org.apache.geode.cache.snapshot.CacheSnapshotService cacheSnapshotService)
cacheSnapshotService
- the GemFire CacheSnapshotService to wrap.SnapshotServiceFactoryBean.SnapshotServiceAdapter
,
SnapshotServiceFactoryBean.CacheSnapshotServiceAdapter
,
CacheSnapshotService
protected SnapshotServiceFactoryBean.SnapshotServiceAdapter<K,V> wrap(org.apache.geode.cache.snapshot.RegionSnapshotService<K,V> regionSnapshotService)
regionSnapshotService
- the GemFire RegionSnapshotService to wrap.SnapshotServiceFactoryBean.SnapshotServiceAdapter
,
SnapshotServiceFactoryBean.RegionSnapshotServiceAdapter
,
RegionSnapshotService
public void destroy() throws Exception
destroy
in interface DisposableBean
Exception
- if the Cache/Region data export operation fails.SnapshotServiceFactoryBean.SnapshotServiceAdapter
,
getExports()
,
getObject()
public void onApplicationEvent(SnapshotApplicationEvent<K,V> event)
onApplicationEvent
in interface ApplicationListener<SnapshotApplicationEvent<K,V>>
event
- the SnapshotApplicationEvent triggering a GemFire Cache or Region data import/export.SnapshotServiceFactoryBean.SnapshotServiceAdapter
,
ExportSnapshotApplicationEvent
,
ImportSnapshotApplicationEvent
,
SnapshotApplicationEvent
,
isMatch(SnapshotApplicationEvent)
,
resolveSnapshotMetadata(SnapshotApplicationEvent)
,
getObject()
protected boolean isMatch(SnapshotApplicationEvent event)
event
- the SnapshotApplicationEvent containing details of the application requested data export.SnapshotApplicationEvent
protected SnapshotServiceFactoryBean.SnapshotMetadata<K,V>[] resolveSnapshotMetadata(SnapshotApplicationEvent<K,V> event)
event
- the SnapshotApplicationEvent from which to resolve the SnapshotMetadata.SnapshotApplicationEvent.getSnapshotMetadata()
,
getExports()
,
getImports()
Copyright © 2011–2017 Pivotal Software, Inc.. All rights reserved.