SGF-408 - Provide support in the SDG XML namespace to load a pre-defined data set using GemFire Snapshot Service for development and testing purposes.

Repackaged all GemFire Snapshot Service support classes in Spring Data GemFire under org.springframework.data.gemfire.snapshot.
Moved snapshot application events to ..snapshot.event.
Moved the ComposableSnapshotFilter class to ..snapshot.filter.
(cherry picked from commit 5bf3e8e8132c9cff0c3da33b271bfa4e049968c0)

Signed-off-by: John Blum <jblum@pivotal.io>
This commit is contained in:
John Blum
2015-08-28 00:56:12 -07:00
parent 3a360a37b4
commit ea37fbacbe
17 changed files with 102 additions and 84 deletions

View File

@@ -21,7 +21,7 @@ import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.ManagedList;
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.data.gemfire.SnapshotServiceFactoryBean;
import org.springframework.data.gemfire.snapshot.SnapshotServiceFactoryBean;
import org.springframework.util.xml.DomUtils;
import org.w3c.dom.Element;
@@ -33,7 +33,7 @@ import org.w3c.dom.Element;
* @see org.springframework.beans.factory.support.BeanDefinitionBuilder
* @see org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser
* @see org.springframework.beans.factory.xml.ParserContext
* @see org.springframework.data.gemfire.SnapshotServiceFactoryBean
* @see org.springframework.data.gemfire.snapshot.SnapshotServiceFactoryBean
* @since 1.7.0
*/
class SnapshotServiceParser extends AbstractSingleBeanDefinitionParser {

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.data.gemfire;
package org.springframework.data.gemfire.snapshot;
/**
* The ExportSnapshotException class is a RuntimeException indicating an error occurred while saving a snapshhot

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.data.gemfire;
package org.springframework.data.gemfire.snapshot;
/**
* The ImportSnapshotException class is a RuntimeException indicating an error occurred while loading GemFire Snapshots

View File

@@ -14,10 +14,10 @@
* limitations under the License.
*/
package org.springframework.data.gemfire;
package org.springframework.data.gemfire.snapshot;
import static com.gemstone.gemfire.cache.snapshot.SnapshotOptions.SnapshotFormat;
import static org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotServiceAdapter;
import static org.springframework.data.gemfire.snapshot.SnapshotServiceFactoryBean.SnapshotServiceAdapter;
import java.io.Closeable;
import java.io.DataInputStream;
@@ -38,6 +38,9 @@ import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationListener;
import org.springframework.data.gemfire.snapshot.event.ExportSnapshotApplicationEvent;
import org.springframework.data.gemfire.snapshot.event.ImportSnapshotApplicationEvent;
import org.springframework.data.gemfire.snapshot.event.SnapshotApplicationEvent;
import org.springframework.data.gemfire.util.CollectionUtils;
import org.springframework.util.Assert;
import org.springframework.util.FileCopyUtils;
@@ -61,7 +64,7 @@ import com.gemstone.gemfire.cache.snapshot.SnapshotOptions;
* @see org.springframework.beans.factory.FactoryBean
* @see org.springframework.beans.factory.InitializingBean
* @see org.springframework.context.ApplicationListener
* @see org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotServiceAdapter
* @see SnapshotServiceFactoryBean.SnapshotServiceAdapter
* @see com.gemstone.gemfire.cache.snapshot.CacheSnapshotService
* @see com.gemstone.gemfire.cache.snapshot.RegionSnapshotService
* @since 1.7.0
@@ -129,7 +132,7 @@ public class SnapshotServiceFactoryBean<K, V> implements FactoryBean<SnapshotSer
* Sets the meta-data (location, filter and format) used to create a snapshot from the Cache or Region data.
*
* @param exports an array of snapshot meta-data used for each export.
* @see org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotMetadata
* @see SnapshotServiceFactoryBean.SnapshotMetadata
*/
public void setExports(SnapshotMetadata<K, V>[] exports) {
this.exports = exports;
@@ -139,7 +142,7 @@ public class SnapshotServiceFactoryBean<K, V> implements FactoryBean<SnapshotSer
* Sets the meta-data (location, filter and format) used to create a snapshot from the Cache or Region data.
*
* @return an array of snapshot meta-data used for each export.
* @see org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotMetadata
* @see SnapshotServiceFactoryBean.SnapshotMetadata
*/
protected SnapshotMetadata<K, V>[] getExports() {
return nullSafeArray(exports);
@@ -150,7 +153,7 @@ public class SnapshotServiceFactoryBean<K, V> implements FactoryBean<SnapshotSer
* or individual Region.
*
* @param imports an array of snapshot meta-data used for each import.
* @see org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotMetadata
* @see SnapshotServiceFactoryBean.SnapshotMetadata
*/
public void setImports(SnapshotMetadata<K, V>[] imports) {
this.imports = imports;
@@ -161,7 +164,7 @@ public class SnapshotServiceFactoryBean<K, V> implements FactoryBean<SnapshotSer
* or individual Region.
*
* @return an array of snapshot meta-data used for each import.
* @see org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotMetadata
* @see SnapshotServiceFactoryBean.SnapshotMetadata
*/
protected SnapshotMetadata<K, V>[] getImports() {
return nullSafeArray(imports);
@@ -215,7 +218,7 @@ public class SnapshotServiceFactoryBean<K, V> implements FactoryBean<SnapshotSer
*
* @return the GemFire Snapshot Service created by this FactoryBean.
* @throws Exception if the GemFire Snapshot Service failed to be created.
* @see org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotServiceAdapter
* @see SnapshotServiceFactoryBean.SnapshotServiceAdapter
*/
@Override
public SnapshotServiceAdapter<K, V> getObject() throws Exception {
@@ -226,9 +229,9 @@ public class SnapshotServiceFactoryBean<K, V> implements FactoryBean<SnapshotSer
* Gets the type of Snapshot Service created by this FactoryBean.
*
* @return a Class object representing the type of Snapshot Service created by this FactoryBean.
* @see org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotServiceAdapter
* @see org.springframework.data.gemfire.SnapshotServiceFactoryBean.CacheSnapshotServiceAdapter
* @see org.springframework.data.gemfire.SnapshotServiceFactoryBean.RegionSnapshotServiceAdapter
* @see SnapshotServiceFactoryBean.SnapshotServiceAdapter
* @see SnapshotServiceFactoryBean.CacheSnapshotServiceAdapter
* @see SnapshotServiceFactoryBean.RegionSnapshotServiceAdapter
*/
@Override
public Class<?> getObjectType() {
@@ -250,7 +253,7 @@ public class SnapshotServiceFactoryBean<K, V> implements FactoryBean<SnapshotSer
* or Region if initialized. In addition, this initialization method will perform the actual import.
*
* @throws Exception if the construction and initialization of the GemFire Snapshot Service fails.
* @see org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotServiceAdapter#doImport(SnapshotMetadata[])
* @see SnapshotServiceFactoryBean.SnapshotServiceAdapter#doImport(SnapshotMetadata[])
* @see #getImports()
* @see #create()
*/
@@ -286,8 +289,8 @@ public class SnapshotServiceFactoryBean<K, V> implements FactoryBean<SnapshotSer
*
* @param cacheSnapshotService the GemFire CacheSnapshotService to wrap.
* @return a SnapshotServiceAdapter wrapping the GemFire CacheSnapshotService.
* @see org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotServiceAdapter
* @see org.springframework.data.gemfire.SnapshotServiceFactoryBean.CacheSnapshotServiceAdapter
* @see SnapshotServiceFactoryBean.SnapshotServiceAdapter
* @see SnapshotServiceFactoryBean.CacheSnapshotServiceAdapter
* @see com.gemstone.gemfire.cache.snapshot.CacheSnapshotService
*/
protected SnapshotServiceAdapter<Object, Object> wrap(CacheSnapshotService cacheSnapshotService) {
@@ -300,8 +303,8 @@ public class SnapshotServiceFactoryBean<K, V> implements FactoryBean<SnapshotSer
*
* @param regionSnapshotService the GemFire RegionSnapshotService to wrap.
* @return a SnapshotServiceAdapter wrapping the GemFire RegionSnapshotService.
* @see org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotServiceAdapter
* @see org.springframework.data.gemfire.SnapshotServiceFactoryBean.RegionSnapshotServiceAdapter
* @see SnapshotServiceFactoryBean.SnapshotServiceAdapter
* @see SnapshotServiceFactoryBean.RegionSnapshotServiceAdapter
* @see com.gemstone.gemfire.cache.snapshot.RegionSnapshotService
*/
protected SnapshotServiceAdapter<K, V> wrap(RegionSnapshotService<K, V> regionSnapshotService) {
@@ -312,7 +315,7 @@ public class SnapshotServiceFactoryBean<K, V> implements FactoryBean<SnapshotSer
* Performs an export of the GemFire Cache or Region if configured.
*
* @throws Exception if the Cache/Region data export operation fails.
* @see org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotServiceAdapter#doExport(SnapshotMetadata[])
* @see SnapshotServiceFactoryBean.SnapshotServiceAdapter#doExport(SnapshotMetadata[])
* @see #getExports()
* @see #getObject()
*/
@@ -326,14 +329,14 @@ public class SnapshotServiceFactoryBean<K, V> implements FactoryBean<SnapshotSer
* when details of the event match the criteria of this factory's constructed GemFire SnapshotService.
*
* @param event the SnapshotApplicationEvent triggering a GemFire Cache or Region data import/export.
* @see org.springframework.data.gemfire.SnapshotApplicationEvent
* @see org.springframework.data.gemfire.ExportSnapshotApplicationEvent
* @see org.springframework.data.gemfire.ImportSnapshotApplicationEvent
* @see SnapshotApplicationEvent
* @see ExportSnapshotApplicationEvent
* @see ImportSnapshotApplicationEvent
* @see #isMatch(SnapshotApplicationEvent)
* @see #resolveSnapshotMetadata(SnapshotApplicationEvent)
* @see #getObject()
* @see org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotServiceAdapter#doExport(SnapshotMetadata[])
* @see org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotServiceAdapter#doImport(SnapshotMetadata[])
* @see SnapshotServiceFactoryBean.SnapshotServiceAdapter#doExport(SnapshotMetadata[])
* @see SnapshotServiceFactoryBean.SnapshotServiceAdapter#doImport(SnapshotMetadata[])
*/
@Override
public void onApplicationEvent(SnapshotApplicationEvent<K, V> event) {
@@ -358,7 +361,7 @@ public class SnapshotServiceFactoryBean<K, V> implements FactoryBean<SnapshotSer
* @param event the SnapshotApplicationEvent containing details of the application requested data export.
* @return a boolean value indicating whether the application requested snapshot event details match
* the criteria required by this factory to trigger a GemFire Cache or Region data export.
* @see org.springframework.data.gemfire.SnapshotApplicationEvent
* @see SnapshotApplicationEvent
*/
protected boolean isMatch(SnapshotApplicationEvent event) {
return (event.isCacheSnapshotEvent() || event.matches(getRegion()));
@@ -371,7 +374,7 @@ public class SnapshotServiceFactoryBean<K, V> implements FactoryBean<SnapshotSer
*
* @param event the SnapshotApplicationEvent from which to resolve the SnapshotMetadata.
* @return the resolved SnapshotMetadata, either from the event or this factory's configured imports/exports.
* @see org.springframework.data.gemfire.SnapshotApplicationEvent#getSnapshotMetadata()
* @see SnapshotApplicationEvent#getSnapshotMetadata()
* @see #getExports()
* @see #getImports()
*/
@@ -413,7 +416,7 @@ public class SnapshotServiceFactoryBean<K, V> implements FactoryBean<SnapshotSer
*
* @param <K> the class type of the Cache Region key.
* @param <V> the class type of the Cache Region value.
* @see org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotServiceAdapter
* @see SnapshotServiceFactoryBean.SnapshotServiceAdapter
*/
protected static abstract class SnapshotServiceAdapterSupport<K, V> implements SnapshotServiceAdapter<K, V> {
@@ -546,7 +549,7 @@ public class SnapshotServiceFactoryBean<K, V> implements FactoryBean<SnapshotSer
/**
* The CacheSnapshotServiceAdapter is a SnapshotServiceAdapter adapting GemFire's CacheSnapshotService.
*
* @see org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotServiceAdapterSupport
* @see SnapshotServiceFactoryBean.SnapshotServiceAdapterSupport
*/
protected static class CacheSnapshotServiceAdapter extends SnapshotServiceAdapterSupport<Object, Object> {
@@ -624,7 +627,7 @@ public class SnapshotServiceFactoryBean<K, V> implements FactoryBean<SnapshotSer
/**
* The RegionSnapshotServiceAdapter is a SnapshotServiceAdapter adapting GemFire's RegionSnapshotService.
*
* @see org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotServiceAdapterSupport
* @see SnapshotServiceFactoryBean.SnapshotServiceAdapterSupport
*/
protected static class RegionSnapshotServiceAdapter<K, V> extends SnapshotServiceAdapterSupport<K, V> {

View File

@@ -14,16 +14,16 @@
* limitations under the License.
*/
package org.springframework.data.gemfire;
package org.springframework.data.gemfire.snapshot.event;
import static org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotMetadata;
import static org.springframework.data.gemfire.snapshot.SnapshotServiceFactoryBean.SnapshotMetadata;
/**
* The ExportSnapshotApplicationEvent class is a Spring ApplicationEvent signaling a GemFire Cache or Region 'import'
* snapshot event.
*
* @author John Blum
* @see org.springframework.data.gemfire.SnapshotApplicationEvent
* @see org.springframework.data.gemfire.snapshot.event.SnapshotApplicationEvent
* @since 1.7.0
*/
@SuppressWarnings("unused")
@@ -35,7 +35,7 @@ public class ExportSnapshotApplicationEvent<K, V> extends SnapshotApplicationEve
*
* @param source the source of the ApplicationEvent.
* @param snapshotMetadata an array of SnapshotMetadata containing details for each export.
* @see org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotMetadata
* @see org.springframework.data.gemfire.snapshot.SnapshotServiceFactoryBean.SnapshotMetadata
* @see #ExportSnapshotApplicationEvent(Object, String, SnapshotMetadata[])
*/
public ExportSnapshotApplicationEvent(Object source, SnapshotMetadata<K, V>... snapshotMetadata) {
@@ -49,7 +49,7 @@ public class ExportSnapshotApplicationEvent<K, V> extends SnapshotApplicationEve
* @param source the source of the ApplicationEvent.
* @param regionPath absolute pathname of the Region.
* @param snapshotMetadata an array of SnapshotMetadata containing details for each export.
* @see org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotMetadata
* @see org.springframework.data.gemfire.snapshot.SnapshotServiceFactoryBean.SnapshotMetadata
*/
public ExportSnapshotApplicationEvent(Object source, String regionPath, SnapshotMetadata<K, V>... snapshotMetadata) {
super(source, regionPath, snapshotMetadata);

View File

@@ -14,16 +14,16 @@
* limitations under the License.
*/
package org.springframework.data.gemfire;
package org.springframework.data.gemfire.snapshot.event;
import static org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotMetadata;
import static org.springframework.data.gemfire.snapshot.SnapshotServiceFactoryBean.SnapshotMetadata;
/**
* The ImportSnapshotApplicationEvent class is a Spring ApplicationEvent signaling a GemFire Cache or Region 'export'
* snapshot event.
*
* @author John Blum
* @see org.springframework.data.gemfire.SnapshotApplicationEvent
* @see org.springframework.data.gemfire.snapshot.event.SnapshotApplicationEvent
* @since 1.7.0
*/
@SuppressWarnings("unused")
@@ -35,7 +35,7 @@ public class ImportSnapshotApplicationEvent<K, V> extends SnapshotApplicationEve
*
* @param source the source of the ApplicationEvent.
* @param snapshotMetadata an array of SnapshotMetadata containing details for each import.
* @see org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotMetadata
* @see org.springframework.data.gemfire.snapshot.SnapshotServiceFactoryBean.SnapshotMetadata
* @see #ImportSnapshotApplicationEvent(Object, String, SnapshotMetadata[])
*/
public ImportSnapshotApplicationEvent(Object source, SnapshotMetadata<K, V>... snapshotMetadata) {
@@ -49,7 +49,7 @@ public class ImportSnapshotApplicationEvent<K, V> extends SnapshotApplicationEve
* @param source the source of the ApplicationEvent.
* @param regionPath absolute pathname of the Region.
* @param snapshotMetadata an array of SnapshotMetadata containing details for each import/export.
* @see org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotMetadata
* @see org.springframework.data.gemfire.snapshot.SnapshotServiceFactoryBean.SnapshotMetadata
*/
public ImportSnapshotApplicationEvent(Object source, String regionPath, SnapshotMetadata<K, V>... snapshotMetadata) {
super(source, regionPath, snapshotMetadata);

View File

@@ -14,11 +14,12 @@
* limitations under the License.
*/
package org.springframework.data.gemfire;
package org.springframework.data.gemfire.snapshot.event;
import static org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotMetadata;
import static org.springframework.data.gemfire.snapshot.SnapshotServiceFactoryBean.SnapshotMetadata;
import org.springframework.context.ApplicationEvent;
import org.springframework.data.gemfire.snapshot.SnapshotServiceFactoryBean;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.management.internal.cli.util.spring.StringUtils;
@@ -45,7 +46,7 @@ public abstract class SnapshotApplicationEvent<K, V> extends ApplicationEvent {
*
* @param source the source of the ApplicationEvent.
* @param snapshotMetadata an array of SnapshotMetadata containing details for each import/export.
* @see org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotMetadata
* @see SnapshotServiceFactoryBean.SnapshotMetadata
* @see #SnapshotApplicationEvent(Object, String, SnapshotMetadata[])
*/
public SnapshotApplicationEvent(Object source, SnapshotMetadata<K, V>... snapshotMetadata) {
@@ -59,7 +60,7 @@ public abstract class SnapshotApplicationEvent<K, V> extends ApplicationEvent {
* @param source the source of the ApplicationEvent.
* @param regionPath absolute pathname of the Region.
* @param snapshotMetadata an array of SnapshotMetadata containing details for each import/export.
* @see org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotMetadata
* @see SnapshotServiceFactoryBean.SnapshotMetadata
*/
public SnapshotApplicationEvent(Object source, String regionPath, SnapshotMetadata<K, V>... snapshotMetadata) {
super(source);
@@ -81,7 +82,7 @@ public abstract class SnapshotApplicationEvent<K, V> extends ApplicationEvent {
* Gets the meta-data used to perform the GemFire Cache Region data snapshots.
*
* @return an array of SnapshotMetadata containing information necessary to perform the data export.
* @see org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotMetadata
* @see SnapshotServiceFactoryBean.SnapshotMetadata
*/
public SnapshotMetadata<K, V>[] getSnapshotMetadata() {
return snapshotMetadata;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.data.gemfire;
package org.springframework.data.gemfire.snapshot.filter;
import java.util.Map;
@@ -65,7 +65,7 @@ public class ComposableSnapshotFilter<K, V> implements SnapshotFilter<K, V> {
* @param operator the right operand in the boolean-based expression.
* @param rightOperand the operator used to combine the resulting boolean expressions
* from the evaluation of the operands.
* @see org.springframework.data.gemfire.ComposableSnapshotFilter.Operator
* @see ComposableSnapshotFilter.Operator
* @see com.gemstone.gemfire.cache.snapshot.SnapshotFilter
*/
private ComposableSnapshotFilter(SnapshotFilter<K, V> leftOperand, Operator operator, SnapshotFilter<K, V> rightOperand) {
@@ -89,7 +89,7 @@ public class ComposableSnapshotFilter<K, V> implements SnapshotFilter<K, V> {
* @param snapshotFilters the array of SnapshotFilters to compose into a logical boolean expression
* using the Operator.
* @return a SnapshotFilter implementation composed of the SnapshotFilters using the specified Operator.
* @see org.springframework.data.gemfire.ComposableSnapshotFilter.Operator
* @see ComposableSnapshotFilter.Operator
* @see com.gemstone.gemfire.cache.snapshot.SnapshotFilter
*/
protected static <K, V> SnapshotFilter<K, V> compose(Operator operator, SnapshotFilter<K, V>... snapshotFilters) {
@@ -111,7 +111,7 @@ public class ComposableSnapshotFilter<K, V> implements SnapshotFilter<K, V> {
* @param snapshotFilters the array of SnapshotFilters to compose into a logical boolean expression
* using the AND Operator.
* @return a SnapshotFilter implementation composed of the SnapshotFilters using the AND Operator.
* @see org.springframework.data.gemfire.ComposableSnapshotFilter.Operator#AND
* @see ComposableSnapshotFilter.Operator#AND
* @see com.gemstone.gemfire.cache.snapshot.SnapshotFilter
*/
public static <K, V> SnapshotFilter<K, V> and(SnapshotFilter<K, V>... snapshotFilters) {
@@ -126,7 +126,7 @@ public class ComposableSnapshotFilter<K, V> implements SnapshotFilter<K, V> {
* @param snapshotFilters the array of SnapshotFilters to compose into a logical boolean expression
* using the OR Operator.
* @return a SnapshotFilter implementation composed of the SnapshotFilters using the OR Operator.
* @see org.springframework.data.gemfire.ComposableSnapshotFilter.Operator#OR
* @see ComposableSnapshotFilter.Operator#OR
* @see com.gemstone.gemfire.cache.snapshot.SnapshotFilter
*/
public static <K, V> SnapshotFilter<K, V> or(SnapshotFilter<K, V>... snapshotFilters) {
@@ -138,7 +138,7 @@ public class ComposableSnapshotFilter<K, V> implements SnapshotFilter<K, V> {
*
* @param entry the Map.Entry to evaluate.
* @return a boolean value indicating whether this composed SnapshotFilter accepts the Map Entry.
* @see org.springframework.data.gemfire.ComposableSnapshotFilter.Operator
* @see ComposableSnapshotFilter.Operator
* @see com.gemstone.gemfire.cache.snapshot.SnapshotFilter#accept(Map.Entry)
* @see java.util.Map.Entry
*/

View File

@@ -219,7 +219,13 @@ ID of the GemFire [Cache|Region] SnapshotService bean in the Spring context.
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="suppress-init-import" type="xsd:string" default="false"/>
<xsd:attribute name="suppress-init-import" type="xsd:string" default="false">
<xsd:annotation>
<xsd:documentation>
Determines whether imports are suppressed on initialization of the GemFire Snapshot Service.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="snapshotMetadataType">

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.data.gemfire;
package org.springframework.data.gemfire.snapshot;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
@@ -35,6 +35,9 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.data.gemfire.repository.sample.Person;
import org.springframework.data.gemfire.snapshot.event.ExportSnapshotApplicationEvent;
import org.springframework.data.gemfire.snapshot.event.ImportSnapshotApplicationEvent;
import org.springframework.data.gemfire.snapshot.event.SnapshotApplicationEvent;
import org.springframework.data.gemfire.test.support.FileSystemUtils;
import org.springframework.data.gemfire.test.support.ThreadUtils;
import org.springframework.scheduling.annotation.Scheduled;
@@ -56,9 +59,10 @@ import com.gemstone.gemfire.management.internal.cli.util.spring.StringUtils;
* @see org.junit.runner.RunWith
* @see org.springframework.test.context.ContextConfiguration
* @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner
* @see org.springframework.data.gemfire.ExportSnapshotApplicationEvent
* @see org.springframework.data.gemfire.ImportSnapshotApplicationEvent
* @see org.springframework.data.gemfire.SnapshotServiceFactoryBean
* @see org.springframework.data.gemfire.snapshot.event.ExportSnapshotApplicationEvent
* @see org.springframework.data.gemfire.snapshot.event.ImportSnapshotApplicationEvent
* @see org.springframework.data.gemfire.snapshot.event.SnapshotApplicationEvent
* @see org.springframework.data.gemfire.snapshot.SnapshotServiceFactoryBean
* @see org.springframework.data.gemfire.repository.sample.Person
* @see com.gemstone.gemfire.cache.Region
* @since 1.7.0
@@ -103,7 +107,6 @@ public class SnapshotApplicationEventTriggeredImportsExportsIntegrationTest {
@AfterClass
public static void tearDownAfterClass() {
FileSystemUtils.deleteRecursive(snapshotsDirectory.getParentFile());
snapshotsDirectory = null;
}
protected void assertPeople(Region<Long, Person> targetRegion, Person... people) {

View File

@@ -14,13 +14,13 @@
* limitations under the License.
*/
package org.springframework.data.gemfire;
package org.springframework.data.gemfire.snapshot;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertThat;
import static org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotServiceAdapterSupport;
import static org.springframework.data.gemfire.snapshot.SnapshotServiceFactoryBean.SnapshotServiceAdapterSupport;
import java.io.File;
import java.util.ArrayList;
@@ -37,7 +37,7 @@ import org.springframework.data.gemfire.test.support.FileSystemUtils;
*
* @author John Blum
* @see org.junit.Test
* @see org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotServiceAdapterSupport
* @see org.springframework.data.gemfire.snapshot.SnapshotServiceFactoryBean.SnapshotServiceAdapterSupport
* @since 1.7.0
*/
public class SnapshotServiceFactoryBeanIntegrationTest {

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.data.gemfire;
package org.springframework.data.gemfire.snapshot;
import static com.gemstone.gemfire.cache.snapshot.SnapshotOptions.SnapshotFormat;
import static org.hamcrest.CoreMatchers.equalTo;
@@ -36,12 +36,12 @@ import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.springframework.data.gemfire.SnapshotServiceFactoryBean.ArchiveFileFilter;
import static org.springframework.data.gemfire.SnapshotServiceFactoryBean.CacheSnapshotServiceAdapter;
import static org.springframework.data.gemfire.SnapshotServiceFactoryBean.RegionSnapshotServiceAdapter;
import static org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotMetadata;
import static org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotServiceAdapter;
import static org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotServiceAdapterSupport;
import static org.springframework.data.gemfire.snapshot.SnapshotServiceFactoryBean.ArchiveFileFilter;
import static org.springframework.data.gemfire.snapshot.SnapshotServiceFactoryBean.CacheSnapshotServiceAdapter;
import static org.springframework.data.gemfire.snapshot.SnapshotServiceFactoryBean.RegionSnapshotServiceAdapter;
import static org.springframework.data.gemfire.snapshot.SnapshotServiceFactoryBean.SnapshotMetadata;
import static org.springframework.data.gemfire.snapshot.SnapshotServiceFactoryBean.SnapshotServiceAdapter;
import static org.springframework.data.gemfire.snapshot.SnapshotServiceFactoryBean.SnapshotServiceAdapterSupport;
import java.io.Closeable;
import java.io.File;
@@ -56,6 +56,9 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.mockito.Matchers;
import org.springframework.core.io.ClassPathResource;
import org.springframework.data.gemfire.snapshot.event.ExportSnapshotApplicationEvent;
import org.springframework.data.gemfire.snapshot.event.ImportSnapshotApplicationEvent;
import org.springframework.data.gemfire.snapshot.event.SnapshotApplicationEvent;
import org.springframework.data.gemfire.test.support.FileSystemUtils;
import com.gemstone.gemfire.cache.Cache;
@@ -73,7 +76,7 @@ import com.gemstone.gemfire.cache.snapshot.SnapshotOptions;
* @see org.junit.Rule
* @see org.junit.Test
* @see org.mockito.Mockito
* @see org.springframework.data.gemfire.SnapshotServiceFactoryBean
* @see org.springframework.data.gemfire.snapshot.SnapshotServiceFactoryBean
* @see com.gemstone.gemfire.cache.snapshot.CacheSnapshotService
* @see com.gemstone.gemfire.cache.snapshot.RegionSnapshotService
* @since 1.7.0

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.data.gemfire;
package org.springframework.data.gemfire.snapshot;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
@@ -47,7 +47,7 @@ import com.gemstone.gemfire.cache.Region;
* @see org.junit.Test
* @see org.springframework.context.ConfigurableApplicationContext
* @see org.springframework.context.support.ClassPathXmlApplicationContext
* @see org.springframework.data.gemfire.SnapshotServiceFactoryBean
* @see org.springframework.data.gemfire.snapshot.SnapshotServiceFactoryBean
* @see org.springframework.data.gemfire.repository.sample.Person
* @see com.gemstone.gemfire.cache.Region
* @since 1.7.0

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.data.gemfire;
package org.springframework.data.gemfire.snapshot.event;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
@@ -26,7 +26,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.springframework.data.gemfire.SnapshotServiceFactoryBean.SnapshotMetadata;
import static org.springframework.data.gemfire.snapshot.SnapshotServiceFactoryBean.SnapshotMetadata;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -47,7 +47,7 @@ import com.gemstone.gemfire.cache.snapshot.SnapshotOptions;
* @see org.mockito.Mock
* @see org.mockito.Mockito
* @see org.mockito.runners.MockitoJUnitRunner
* @see org.springframework.data.gemfire.SnapshotApplicationEvent
* @see org.springframework.data.gemfire.snapshot.event.SnapshotApplicationEvent
* @since 1.7.0
*/
@RunWith(MockitoJUnitRunner.class)

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.data.gemfire;
package org.springframework.data.gemfire.snapshot.filter;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
@@ -26,12 +26,13 @@ import static org.junit.Assert.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import static org.springframework.data.gemfire.ComposableSnapshotFilter.Operator;
import static org.springframework.data.gemfire.snapshot.filter.ComposableSnapshotFilter.Operator;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import org.junit.Test;
import org.springframework.data.gemfire.TestUtils;
import com.gemstone.gemfire.cache.snapshot.SnapshotFilter;
@@ -41,8 +42,9 @@ import com.gemstone.gemfire.cache.snapshot.SnapshotFilter;
*
* @author John Blum
* @see org.junit.Test
* @see org.springframework.data.gemfire.ComposableSnapshotFilter
* @see org.springframework.data.gemfire.ComposableSnapshotFilter.Operator
* @see org.mockito.Mockito
* @see org.springframework.data.gemfire.snapshot.filter.ComposableSnapshotFilter
* @see org.springframework.data.gemfire.snapshot.filter.ComposableSnapshotFilter.Operator
* @see com.gemstone.gemfire.cache.snapshot.SnapshotFilter
* @since 1.7.0
*/

View File

@@ -29,18 +29,18 @@
<gfe:partitioned-region id="Handy" persistent="false"/>
<gfe:partitioned-region id="People" persistent="false"/>
<bean id="nonHandyNonDoeSnapshotFilter" class="org.springframework.data.gemfire.ComposableSnapshotFilter" factory-method="and">
<bean id="nonHandyNonDoeSnapshotFilter" class="org.springframework.data.gemfire.snapshot.filter.ComposableSnapshotFilter" factory-method="and">
<constructor-arg index="0">
<list>
<bean class="org.springframework.data.gemfire.SnapshotApplicationEventTriggeredImportsExportsIntegrationTest.NotLastNameSnapshotFilter" c:lastName="Doe"/>
<bean class="org.springframework.data.gemfire.SnapshotApplicationEventTriggeredImportsExportsIntegrationTest.NotLastNameSnapshotFilter" c:lastName="Handy"/>
<bean class="org.springframework.data.gemfire.snapshot.SnapshotApplicationEventTriggeredImportsExportsIntegrationTest.NotLastNameSnapshotFilter" c:lastName="Doe"/>
<bean class="org.springframework.data.gemfire.snapshot.SnapshotApplicationEventTriggeredImportsExportsIntegrationTest.NotLastNameSnapshotFilter" c:lastName="Handy"/>
</list>
</constructor-arg>
</bean>
<context:annotation-config/>
<bean class="org.springframework.data.gemfire.SnapshotApplicationEventTriggeredImportsExportsIntegrationTest.SnapshotImportsMonitor"/>
<bean class="org.springframework.data.gemfire.snapshot.SnapshotApplicationEventTriggeredImportsExportsIntegrationTest.SnapshotImportsMonitor"/>
<task:scheduler id="snapshotImportsMonitorScheduler" pool-size="1"/>
@@ -53,7 +53,7 @@
<gfe-data:snapshot-service id="doeSnapshotService" region-ref="Doe" suppress-init-import="true">
<gfe-data:import-snapshot location="gemfire/snapshots/people.snapshot">
<bean class="org.springframework.data.gemfire.SnapshotApplicationEventTriggeredImportsExportsIntegrationTest.LastNameSnapshotFilter" c:lastName="Doe"/>
<bean class="org.springframework.data.gemfire.snapshot.SnapshotApplicationEventTriggeredImportsExportsIntegrationTest.LastNameSnapshotFilter" c:lastName="Doe"/>
</gfe-data:import-snapshot>
</gfe-data:snapshot-service>
@@ -63,7 +63,7 @@
<gfe-data:snapshot-service id="handySnapshotService" region-ref="Handy" suppress-init-import="true">
<gfe-data:import-snapshot location="gemfire/snapshots/people.snapshot">
<bean class="org.springframework.data.gemfire.SnapshotApplicationEventTriggeredImportsExportsIntegrationTest.LastNameSnapshotFilter" c:lastName="Handy"/>
<bean class="org.springframework.data.gemfire.snapshot.SnapshotApplicationEventTriggeredImportsExportsIntegrationTest.LastNameSnapshotFilter" c:lastName="Handy"/>
</gfe-data:import-snapshot>
</gfe-data:snapshot-service>