Merge branch 'master' into client-cache
Conflicts: src/main/java/org/springframework/data/gemfire/CacheFactoryBean.java
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.data.gemfire</groupId>
|
||||
<artifactId>spring-gemfire</artifactId>
|
||||
<version>1.0.1.BUILD-SNAPSHOT</version>
|
||||
<version>1.1.0.BUILD-SNAPSHOT</version>
|
||||
<name>Spring GemFire Documentation</name>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -2,15 +2,42 @@ SPRING GEMFIRE INTEGRATION CHANGELOG
|
||||
====================================
|
||||
http://www.springsource.org/spring-gemfire
|
||||
|
||||
Changes in version 1.0.1 (2011-mm-dd)
|
||||
|
||||
Changes in version 1.0.1 (2011-07-dd)
|
||||
-------------------------------------
|
||||
|
||||
General
|
||||
* Added support for GemFire 6.6
|
||||
* Dropped support for GemFire 6.0, GemFire 6.5 or higher required
|
||||
* Introduced support for CacheServer
|
||||
|
||||
Package org.springframework.data.gemfire
|
||||
* Introduced cache option for disabling bean factory locator; useful for multi cache definitions, in the same VM
|
||||
|
||||
|
||||
Changes in version 1.0.1 (2011-04-26)
|
||||
-------------------------------------
|
||||
General
|
||||
* Upgraded to GemFire 6.5.1.2
|
||||
* Upgraded to GemFire 6.5.1.4
|
||||
* Fix networking issue with the sample on some Linux distributions (Ubuntu)
|
||||
* Loosen type constraints in the schema to allow placeholders
|
||||
* Added 'statistics' attribute to all write regions
|
||||
|
||||
Package org.springframework.data.gemfire
|
||||
* Introduced auto-close (configurable) on RegionFactoryBean
|
||||
|
||||
Package org.springframework.data.gemfire.config
|
||||
* Fixed bug causing region names to be used as aliases for region beans
|
||||
|
||||
Package org.springframework.data.gemfire.client
|
||||
* Improved dependency initialization between cache and pools
|
||||
|
||||
Package org.springframework.data.gemfire.serialization
|
||||
* Improved cache-wide registration of custom instantiators
|
||||
|
||||
Package org.springframework.data.gemfire.support
|
||||
* Introduced GemfireDaoSupport
|
||||
|
||||
|
||||
Changes in version 1.0.0 (2011-02-02)
|
||||
-------------------------------------
|
||||
|
||||
8
pom.xml
8
pom.xml
@@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.data.gemfire</groupId>
|
||||
<artifactId>spring-gemfire</artifactId>
|
||||
<version>1.0.1.BUILD-SNAPSHOT</version>
|
||||
<version>1.1.0.BUILD-SNAPSHOT</version>
|
||||
<name>Spring GemFire Project</name>
|
||||
|
||||
<description>Spring GemFire Integration for Java</description>
|
||||
@@ -115,7 +115,7 @@ limitations under the License.
|
||||
<dependency>
|
||||
<groupId>com.gemstone.gemfire</groupId>
|
||||
<artifactId>gemfire</artifactId>
|
||||
<version>6.5.1.2</version>
|
||||
<version>6.6.RC</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -162,7 +162,7 @@ limitations under the License.
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.4.3</version>
|
||||
<version>2.7.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
@@ -280,7 +280,7 @@ limitations under the License.
|
||||
<show>protected</show>
|
||||
<source>1.5</source>
|
||||
<links>
|
||||
<link>http://java.sun.com/j2se/1.6.0/docs/api/</link>
|
||||
<link>http://download.oracle.com/javase/6/docs/api/</link>
|
||||
<link>
|
||||
http://static.springsource.org/spring/docs/3.0.x/javadoc-api/
|
||||
</link>
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
<parent>
|
||||
<artifactId>samples</artifactId>
|
||||
<groupId>org.springframework.data.gemfire.samples</groupId>
|
||||
<version>1.0.1.BUILD-SNAPSHOT</version>
|
||||
<version>1.1.0.BUILD-SNAPSHOT</version>
|
||||
<relativePath>../</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.data.gemfire.samples</groupId>
|
||||
<artifactId>hello-world</artifactId>
|
||||
<version>1.0.1.BUILD-SNAPSHOT</version>
|
||||
<version>1.1.0.BUILD-SNAPSHOT</version>
|
||||
<name>Spring GemFire - Hello World Sample</name>
|
||||
|
||||
<description>A simple Hello World example illustrating the basic steps in configuring GemFire with Spring</description>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.data.gemfire.samples</groupId>
|
||||
<artifactId>samples</artifactId>
|
||||
<version>1.0.1.BUILD-SNAPSHOT</version>
|
||||
<version>1.1.0.BUILD-SNAPSHOT</version>
|
||||
<name>Spring GemFire Samples</name>
|
||||
<packaging>pom</packaging>
|
||||
<url>http://www.springframework.org/spring-gemfire</url>
|
||||
@@ -63,7 +63,14 @@
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>com.gemstone.gemfire</groupId>
|
||||
<artifactId>gemfire</artifactId>
|
||||
<version>6.5.1.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
-->
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -31,6 +31,8 @@ import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.dao.support.PersistenceExceptionTranslator;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
import com.gemstone.gemfire.GemFireException;
|
||||
import com.gemstone.gemfire.cache.Cache;
|
||||
@@ -38,6 +40,8 @@ import com.gemstone.gemfire.cache.CacheClosedException;
|
||||
import com.gemstone.gemfire.cache.CacheFactory;
|
||||
import com.gemstone.gemfire.distributed.DistributedMember;
|
||||
import com.gemstone.gemfire.distributed.DistributedSystem;
|
||||
import com.gemstone.gemfire.pdx.PdxSerializable;
|
||||
import com.gemstone.gemfire.pdx.PdxSerializer;
|
||||
|
||||
/**
|
||||
* Factory used for configuring a Gemfire Cache manager. Allows either retrieval of an existing, opened cache
|
||||
@@ -55,30 +59,52 @@ import com.gemstone.gemfire.distributed.DistributedSystem;
|
||||
public class CacheFactoryBean implements BeanNameAware, BeanFactoryAware, BeanClassLoaderAware, DisposableBean,
|
||||
InitializingBean, FactoryBean<Cache>, PersistenceExceptionTranslator {
|
||||
|
||||
protected final Log log = LogFactory.getLog(getClass());
|
||||
private class PdxOptions implements Runnable {
|
||||
|
||||
private CacheFactory factory;
|
||||
|
||||
PdxOptions(CacheFactory factory) {
|
||||
this.factory = factory;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
Assert.isAssignable(PdxSerializer.class, pdxSerializer.getClass(), "Invalid pdx serializer used");
|
||||
factory.setPdxSerializer((PdxSerializer) pdxSerializer);
|
||||
factory.setPdxDiskStore(pdxDiskStoreName);
|
||||
factory.setPdxIgnoreUnreadFields(pdxIgnoreUnreadFields);
|
||||
factory.setPdxPersistent(pdxPersistent);
|
||||
factory.setPdxReadSerialized(pdxReadSerialized);
|
||||
}
|
||||
}
|
||||
|
||||
private static final Log log = LogFactory.getLog(CacheFactoryBean.class);
|
||||
|
||||
private Cache cache;
|
||||
private Resource cacheXml;
|
||||
private Properties properties;
|
||||
private DistributedSystem system;
|
||||
private ClassLoader beanClassLoader;
|
||||
private GemfireBeanFactoryLocator factoryLocator = new GemfireBeanFactoryLocator();
|
||||
private GemfireBeanFactoryLocator factoryLocator;
|
||||
|
||||
private BeanFactory beanFactory;
|
||||
private String beanName;
|
||||
private boolean useBeanFactoryLocator = true;
|
||||
// PDX options
|
||||
private Object pdxSerializer;
|
||||
private Boolean pdxPersistent;
|
||||
private Boolean pdxReadSerialized;
|
||||
private Boolean pdxIgnoreUnreadFields;
|
||||
private String pdxDiskStoreName;
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
// initialize locator
|
||||
factoryLocator.setBeanFactory(beanFactory);
|
||||
factoryLocator.setBeanName(beanName);
|
||||
factoryLocator.afterPropertiesSet();
|
||||
|
||||
if (useBeanFactoryLocator) {
|
||||
factoryLocator = new GemfireBeanFactoryLocator();
|
||||
factoryLocator.setBeanFactory(beanFactory);
|
||||
factoryLocator.setBeanName(beanName);
|
||||
factoryLocator.afterPropertiesSet();
|
||||
}
|
||||
Properties cfgProps = mergeProperties();
|
||||
system = DistributedSystem.connect(cfgProps);
|
||||
|
||||
DistributedMember member = system.getDistributedMember();
|
||||
log.info("Connected to Distributed System [" + system.getName() + "=" + member.getId() + "@" + member.getHost()
|
||||
+ "]");
|
||||
CacheFactory factory = new CacheFactory(cfgProps);
|
||||
|
||||
// use the bean class loader to load Declarable classes
|
||||
Thread th = Thread.currentThread();
|
||||
@@ -88,14 +114,28 @@ public class CacheFactoryBean implements BeanNameAware, BeanFactoryAware, BeanCl
|
||||
th.setContextClassLoader(beanClassLoader);
|
||||
// first look for open caches
|
||||
String msg = null;
|
||||
cache = fetchExistingCache(system);
|
||||
if (cache == null) {
|
||||
cache = createCache(system);
|
||||
try {
|
||||
cache = CacheFactory.getAnyInstance();
|
||||
msg = "Retrieved existing";
|
||||
} catch (CacheClosedException ex) {
|
||||
// GemFire 6.6 specific options
|
||||
if (pdxSerializer != null || pdxPersistent != null || pdxReadSerialized != null
|
||||
|| pdxIgnoreUnreadFields != null || pdxDiskStoreName != null) {
|
||||
Assert.isTrue(ClassUtils.isPresent("com.gemstone.gemfire.pdx.PdxSerializer", beanClassLoader),
|
||||
"Cannot set PDX options since GemFire 6.6 not detected");
|
||||
new PdxOptions(factory).run();
|
||||
}
|
||||
|
||||
// fall back to cache creation
|
||||
cache = factory.create();
|
||||
msg = "Created";
|
||||
}
|
||||
else {
|
||||
msg = "Retrieved existing";
|
||||
}
|
||||
|
||||
DistributedSystem system = cache.getDistributedSystem();
|
||||
DistributedMember member = system.getDistributedMember();
|
||||
log.info("Connected to Distributed System [" + system.getName() + "=" + member.getId() + "@"
|
||||
+ member.getHost() + "]");
|
||||
|
||||
|
||||
log.info(msg + " GemFire v." + CacheFactory.getVersion() + " Cache [" + cache.getName() + "]");
|
||||
|
||||
@@ -111,18 +151,6 @@ public class CacheFactoryBean implements BeanNameAware, BeanFactoryAware, BeanCl
|
||||
}
|
||||
}
|
||||
|
||||
protected Cache fetchExistingCache(DistributedSystem system) {
|
||||
try {
|
||||
return CacheFactory.getInstance(system);
|
||||
} catch (CacheClosedException ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected Cache createCache(DistributedSystem system) throws Exception {
|
||||
return CacheFactory.create(system);
|
||||
}
|
||||
|
||||
private Properties mergeProperties() {
|
||||
Properties cfgProps = (properties != null ? (Properties) properties.clone() : new Properties());
|
||||
return cfgProps;
|
||||
@@ -132,15 +160,13 @@ public class CacheFactoryBean implements BeanNameAware, BeanFactoryAware, BeanCl
|
||||
if (cache != null && !cache.isClosed()) {
|
||||
cache.close();
|
||||
}
|
||||
|
||||
cache = null;
|
||||
|
||||
if (system != null && system.isConnected()) {
|
||||
DistributedSystem.releaseThreadsSockets();
|
||||
system.disconnect();
|
||||
if (factoryLocator != null) {
|
||||
factoryLocator.destroy();
|
||||
factoryLocator = null;
|
||||
}
|
||||
system = null;
|
||||
|
||||
factoryLocator.destroy();
|
||||
}
|
||||
|
||||
public DataAccessException translateExceptionIfPossible(RuntimeException ex) {
|
||||
@@ -170,18 +196,10 @@ public class CacheFactoryBean implements BeanNameAware, BeanFactoryAware, BeanCl
|
||||
return true;
|
||||
}
|
||||
|
||||
protected ClassLoader getBeanClassLoader() {
|
||||
return beanClassLoader;
|
||||
}
|
||||
|
||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||
this.beanClassLoader = classLoader;
|
||||
}
|
||||
|
||||
protected BeanFactory getBeanFactory() {
|
||||
return beanFactory;
|
||||
}
|
||||
|
||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
|
||||
this.beanFactory = beanFactory;
|
||||
}
|
||||
@@ -207,4 +225,61 @@ public class CacheFactoryBean implements BeanNameAware, BeanFactoryAware, BeanCl
|
||||
public void setCacheXml(Resource cacheXml) {
|
||||
this.cacheXml = cacheXml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether a bean factory locator is enabled (default) for this cache definition or not. The locator stores
|
||||
* the enclosing bean factory reference to allow auto-wiring of Spring beans into GemFire managed classes. Usually disabled
|
||||
* when the same cache is used in multiple application context/bean factories inside the same VM.
|
||||
*
|
||||
* @param usage true if the bean factory locator is used underneath or not
|
||||
*/
|
||||
public void setUseBeanFactoryLocator(boolean usage) {
|
||||
this.useBeanFactoryLocator = usage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@link PdxSerializable} for this cache. Applicable on GemFire 6.6 or higher.
|
||||
* The argument is of type object for compatibility with GemFire 6.5.
|
||||
*
|
||||
* @param serializer pdx serializer configured for this cache.
|
||||
*/
|
||||
public void setPdxSerializer(Object serializer) {
|
||||
this.pdxSerializer = serializer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the object preference to PdxInstance type. Applicable on GemFire 6.6 or higher.
|
||||
*
|
||||
* @param pdxPersistent the pdxPersistent to set
|
||||
*/
|
||||
public void setPdxPersistent(Boolean pdxPersistent) {
|
||||
this.pdxPersistent = pdxPersistent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Controls whether the type metadata for PDX objects is persisted to disk. Applicable on GemFire 6.6 or higher.
|
||||
*
|
||||
* @param pdxReadSerialized the pdxReadSerialized to set
|
||||
*/
|
||||
public void setPdxReadSerialized(Boolean pdxReadSerialized) {
|
||||
this.pdxReadSerialized = pdxReadSerialized;
|
||||
}
|
||||
|
||||
/**
|
||||
* Controls whether pdx ignores fields that were unread during deserialization. Applicable on GemFire 6.6 or higher.
|
||||
*
|
||||
* @param pdxIgnoreUnreadFields the pdxIgnoreUnreadFields to set
|
||||
*/
|
||||
public void setPdxIgnoreUnreadFields(Boolean pdxIgnoreUnreadFields) {
|
||||
this.pdxIgnoreUnreadFields = pdxIgnoreUnreadFields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the disk store that is used for PDX meta data. Applicable on GemFire 6.6 or higher.
|
||||
*
|
||||
* @param pdxDiskStoreName the pdxDiskStoreName to set
|
||||
*/
|
||||
public void setPdxDiskStoreName(String pdxDiskStoreName) {
|
||||
this.pdxDiskStoreName = pdxDiskStoreName;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -112,7 +112,8 @@ public class GemfireBeanFactoryLocator implements BeanFactoryLocator, BeanFactor
|
||||
if (log.isDebugEnabled())
|
||||
log.debug("adding key=" + name + " w/ reference=" + beanFactory);
|
||||
|
||||
if (beanFactories.containsKey(name) || beanFactories.putIfAbsent(name, beanFactory) != null) {
|
||||
if (beanFactories.containsKey(name) && !beanFactory.equals(beanFactories.get(name))
|
||||
|| beanFactories.putIfAbsent(name, beanFactory) != null) {
|
||||
throw new IllegalArgumentException("a beanFactoryReference already exists for key " + factoryName);
|
||||
}
|
||||
}
|
||||
@@ -120,10 +121,11 @@ public class GemfireBeanFactoryLocator implements BeanFactoryLocator, BeanFactor
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
for (String name : names) {
|
||||
beanFactories.remove(name);
|
||||
if (names != null) {
|
||||
for (String name : names) {
|
||||
beanFactories.remove(name);
|
||||
}
|
||||
}
|
||||
|
||||
if (beanFactory == defaultFactory) {
|
||||
synchronized (GemfireBeanFactoryLocator.class) {
|
||||
defaultFactory = null;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright 2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire;
|
||||
|
||||
import com.gemstone.gemfire.cache.TransactionException;
|
||||
|
||||
/**
|
||||
* Gemfire-specific subclass of {@link org.springframework.transaction.TransactionException}, indicating a transaction failure at commit time.
|
||||
*
|
||||
* @author Costin Leau
|
||||
*/
|
||||
public class GemfireTransactionCommitException extends TransactionException {
|
||||
|
||||
public GemfireTransactionCommitException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public GemfireTransactionCommitException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public GemfireTransactionCommitException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public GemfireTransactionCommitException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,7 +22,6 @@ import org.springframework.transaction.NoTransactionException;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.TransactionDefinition;
|
||||
import org.springframework.transaction.TransactionException;
|
||||
import org.springframework.transaction.TransactionSystemException;
|
||||
import org.springframework.transaction.support.AbstractPlatformTransactionManager;
|
||||
import org.springframework.transaction.support.DefaultTransactionStatus;
|
||||
import org.springframework.transaction.support.ResourceTransactionManager;
|
||||
@@ -138,8 +137,7 @@ public class GemfireTransactionManager extends AbstractPlatformTransactionManage
|
||||
throw new NoTransactionException(
|
||||
"No transaction associated with the current thread; are there multiple transaction managers ?", ex);
|
||||
} catch (CommitConflictException ex) {
|
||||
// TODO: can this be replaced with HeuristicCompletionException ?
|
||||
throw new TransactionSystemException("Unexpected failure on commit of Cache local transaction", ex);
|
||||
throw new GemfireTransactionCommitException("Unexpected failure on commit of Cache local transaction", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -32,6 +32,7 @@ import org.w3c.dom.Element;
|
||||
*/
|
||||
class CacheParser extends AbstractSingleBeanDefinitionParser {
|
||||
|
||||
@Override
|
||||
protected Class<?> getBeanClass(Element element) {
|
||||
return CacheFactoryBean.class;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright 2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.config;
|
||||
|
||||
import org.springframework.beans.factory.BeanDefinitionStoreException;
|
||||
import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.xml.AbstractSimpleBeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.data.gemfire.server.CacheServerFactoryBean;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.util.xml.DomUtils;
|
||||
import org.w3c.dom.Attr;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Namespace parser for "cache-server" element.
|
||||
*
|
||||
* @author Costin Leau
|
||||
*/
|
||||
class CacheServerParser extends AbstractSimpleBeanDefinitionParser {
|
||||
|
||||
@Override
|
||||
protected Class<?> getBeanClass(Element element) {
|
||||
return CacheServerFactoryBean.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String resolveId(Element element, AbstractBeanDefinition definition, ParserContext parserContext)
|
||||
throws BeanDefinitionStoreException {
|
||||
String name = super.resolveId(element, definition, parserContext);
|
||||
if (!StringUtils.hasText(name)) {
|
||||
name = "gemfire-server";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isEligibleAttribute(Attr attribute, ParserContext parserContext) {
|
||||
return super.isEligibleAttribute(attribute, parserContext) && !"groups".equals(attribute.getName())
|
||||
&& !"cache-ref".equals(attribute.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void postProcess(BeanDefinitionBuilder builder, Element element) {
|
||||
|
||||
String attr = element.getAttribute("cache-ref");
|
||||
// add cache reference (fallback to default if nothing is specified)
|
||||
builder.addPropertyReference("cache", (StringUtils.hasText(attr) ? attr : "gemfire-cache"));
|
||||
|
||||
attr = element.getAttribute("groups");
|
||||
if (StringUtils.hasText(attr)) {
|
||||
builder.addPropertyValue("serverGroups", StringUtils.commaDelimitedListToStringArray(attr));
|
||||
}
|
||||
|
||||
parseSubscription(builder, element);
|
||||
}
|
||||
|
||||
private void parseSubscription(BeanDefinitionBuilder builder, Element element) {
|
||||
Element subConfig = DomUtils.getChildElementByTagName(element, "subscription-config");
|
||||
if (subConfig == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
ParsingUtils.setPropertyValue(subConfig, builder, "capacity", "subscriptionCapacity");
|
||||
ParsingUtils.setPropertyValue(subConfig, builder, "disk-store", "subscriptionDiskStore");
|
||||
String attr = element.getAttribute("eviction-type");
|
||||
if (StringUtils.hasText(attr)) {
|
||||
builder.addPropertyValue("subscriptionEvictionPolicy", attr.toUpperCase());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -89,6 +89,8 @@ class ClientRegionParser extends AliasReplacingBeanDefinitionParser {
|
||||
// client attributes
|
||||
BeanDefinitionBuilder attrBuilder = BeanDefinitionBuilder.genericBeanDefinition(RegionAttributesFactoryBean.class);
|
||||
|
||||
ParsingUtils.parseStatistics(element, attrBuilder);
|
||||
|
||||
boolean overwriteDataPolicy = false;
|
||||
|
||||
overwriteDataPolicy |= ParsingUtils.parseEviction(parserContext, element, attrBuilder);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -32,6 +32,7 @@ class GemfireNamespaceHandler extends NamespaceHandlerSupport {
|
||||
registerBeanDefinitionParser("partitioned-region", new PartitionedRegionParser());
|
||||
registerBeanDefinitionParser("client-region", new ClientRegionParser());
|
||||
registerBeanDefinitionParser("pool", new PoolParser());
|
||||
registerBeanDefinitionParser("cache-server", new CacheServerParser());
|
||||
|
||||
registerBeanDefinitionParser("transaction-manager", new TransactionManagerParser());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -217,4 +217,9 @@ abstract class ParsingUtils {
|
||||
attrBuilder.addPropertyValue("evictionAttributes", evictionDefBuilder.getBeanDefinition());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static void parseStatistics(Element element, BeanDefinitionBuilder attrBuilder) {
|
||||
setPropertyValue(element, attrBuilder, "statistics", "statisticsEnabled");
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -78,6 +78,7 @@ class PartitionedRegionParser extends AliasReplacingBeanDefinitionParser {
|
||||
|
||||
ParsingUtils.parseEviction(parserContext, element, attrBuilder);
|
||||
ParsingUtils.parseDiskStorage(element, attrBuilder);
|
||||
ParsingUtils.parseStatistics(element, attrBuilder);
|
||||
|
||||
// partition attributes
|
||||
BeanDefinitionBuilder parAttrBuilder = BeanDefinitionBuilder.genericBeanDefinition(PartitionAttributesFactoryBean.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -64,6 +64,8 @@ class ReplicatedRegionParser extends AliasReplacingBeanDefinitionParser {
|
||||
// add attributes
|
||||
BeanDefinitionBuilder attrBuilder = BeanDefinitionBuilder.genericBeanDefinition(RegionAttributesFactoryBean.class);
|
||||
|
||||
ParsingUtils.parseStatistics(element, attrBuilder);
|
||||
|
||||
attr = element.getAttribute("publisher");
|
||||
if (StringUtils.hasText(attr)) {
|
||||
attrBuilder.addPropertyValue("publisher", Boolean.valueOf(attr));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -123,7 +123,7 @@ public class InstantiatorFactoryBean implements BeanClassLoaderAware, FactoryBea
|
||||
* Sets the distribution of the region of this {@link Instantiator} during the container startup.
|
||||
* Default is false, meaning the registration will not be distributed to other clients.
|
||||
*
|
||||
* @see #register(Instantiator, boolean)
|
||||
* @see Instantiator#register(Instantiator, boolean)
|
||||
* @param distribute whether the registration is distributable or not
|
||||
*/
|
||||
public void setDistribute(boolean distribute) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -0,0 +1,230 @@
|
||||
/*
|
||||
* Copyright 2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.gemfire.server;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.beans.factory.BeanInitializationException;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.context.SmartLifecycle;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.gemstone.gemfire.cache.Cache;
|
||||
import com.gemstone.gemfire.cache.InterestRegistrationListener;
|
||||
import com.gemstone.gemfire.cache.server.CacheServer;
|
||||
import com.gemstone.gemfire.cache.server.ClientSubscriptionConfig;
|
||||
import com.gemstone.gemfire.cache.server.ServerLoadProbe;
|
||||
|
||||
/**
|
||||
* FactoryBean for easy creation and configuration of GemFire {@link CacheServer} instances.
|
||||
*
|
||||
* @author Costin Leau
|
||||
*/
|
||||
public class CacheServerFactoryBean implements FactoryBean<CacheServer>, InitializingBean, DisposableBean,
|
||||
SmartLifecycle {
|
||||
|
||||
private boolean autoStartup = true;
|
||||
|
||||
private int port = CacheServer.DEFAULT_PORT;
|
||||
private int maxConnections = CacheServer.DEFAULT_MAX_CONNECTIONS;
|
||||
private int maxThreads = CacheServer.DEFAULT_MAX_THREADS;
|
||||
private boolean notifyBySubscription = CacheServer.DEFAULT_NOTIFY_BY_SUBSCRIPTION;
|
||||
private int socketBufferSize = CacheServer.DEFAULT_SOCKET_BUFFER_SIZE;
|
||||
private int maxTimeBetweenPings = CacheServer.DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS;
|
||||
private int maxMessageCount = CacheServer.DEFAULT_MAXIMUM_MESSAGE_COUNT;
|
||||
private int messageTimeToLive = CacheServer.DEFAULT_MESSAGE_TIME_TO_LIVE;
|
||||
private String[] serverGroups = CacheServer.DEFAULT_GROUPS;
|
||||
private ServerLoadProbe serverLoadProbe = CacheServer.DEFAULT_LOAD_PROBE;
|
||||
private long loadPollInterval = CacheServer.DEFAULT_LOAD_POLL_INTERVAL;
|
||||
private String bindAddress = CacheServer.DEFAULT_BIND_ADDRESS;
|
||||
private String hostNameForClients = CacheServer.DEFAULT_HOSTNAME_FOR_CLIENTS;
|
||||
private Set<InterestRegistrationListener> listeners = Collections.emptySet();
|
||||
|
||||
private SubscriptionEvictionPolicy evictionPolicy = SubscriptionEvictionPolicy.valueOf(ClientSubscriptionConfig.DEFAULT_EVICTION_POLICY.toUpperCase());
|
||||
private int subscriptionCapacity = ClientSubscriptionConfig.DEFAULT_CAPACITY;
|
||||
private Resource subscriptionDiskStore;
|
||||
|
||||
private Cache cache;
|
||||
private CacheServer cacheServer;
|
||||
|
||||
|
||||
public CacheServer getObject() {
|
||||
return cacheServer;
|
||||
}
|
||||
|
||||
public Class<?> getObjectType() {
|
||||
return ((this.cacheServer != null) ? cacheServer.getClass() : CacheServer.class);
|
||||
}
|
||||
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void afterPropertiesSet() throws IOException {
|
||||
Assert.notNull(cache, "cache is required");
|
||||
|
||||
cacheServer = cache.addCacheServer();
|
||||
cacheServer.setBindAddress(bindAddress);
|
||||
cacheServer.setGroups(serverGroups);
|
||||
cacheServer.setHostnameForClients(hostNameForClients);
|
||||
cacheServer.setLoadPollInterval(loadPollInterval);
|
||||
cacheServer.setLoadProbe(serverLoadProbe);
|
||||
cacheServer.setMaxConnections(maxConnections);
|
||||
cacheServer.setMaximumMessageCount(maxMessageCount);
|
||||
cacheServer.setMaximumTimeBetweenPings(maxTimeBetweenPings);
|
||||
cacheServer.setMaxThreads(maxThreads);
|
||||
cacheServer.setMessageTimeToLive(messageTimeToLive);
|
||||
cacheServer.setNotifyBySubscription(notifyBySubscription);
|
||||
cacheServer.setPort(port);
|
||||
cacheServer.setSocketBufferSize(socketBufferSize);
|
||||
|
||||
for (InterestRegistrationListener listener : listeners) {
|
||||
cacheServer.registerInterestRegistrationListener(listener);
|
||||
}
|
||||
|
||||
// client config
|
||||
ClientSubscriptionConfig config = cacheServer.getClientSubscriptionConfig();
|
||||
config.setCapacity(subscriptionCapacity);
|
||||
config.setEvictionPolicy(evictionPolicy.name().toLowerCase());
|
||||
config.setDiskStoreName(subscriptionDiskStore.getFile().getCanonicalPath());
|
||||
|
||||
start();
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
stop();
|
||||
cacheServer = null;
|
||||
}
|
||||
|
||||
public boolean isAutoStartup() {
|
||||
return autoStartup;
|
||||
}
|
||||
|
||||
public void stop(Runnable callback) {
|
||||
stop();
|
||||
callback.run();
|
||||
}
|
||||
|
||||
public int getPhase() {
|
||||
// start the latest
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
public boolean isRunning() {
|
||||
return (cacheServer != null ? cacheServer.isRunning() : false);
|
||||
}
|
||||
|
||||
public void start() {
|
||||
try {
|
||||
cacheServer.start();
|
||||
} catch (IOException ex) {
|
||||
throw new BeanInitializationException("Cannot start cache server", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
if (cacheServer != null) {
|
||||
cacheServer.stop();
|
||||
}
|
||||
}
|
||||
|
||||
public void setAutoStartup(boolean autoStartup) {
|
||||
this.autoStartup = autoStartup;
|
||||
}
|
||||
|
||||
public void setPort(int port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public void setMaxConnections(int maxConnections) {
|
||||
this.maxConnections = maxConnections;
|
||||
}
|
||||
|
||||
public void setMaxThreads(int maxThreads) {
|
||||
this.maxThreads = maxThreads;
|
||||
}
|
||||
|
||||
public void setNotifyBySubscription(boolean notifyBySubscription) {
|
||||
this.notifyBySubscription = notifyBySubscription;
|
||||
}
|
||||
|
||||
public void setSocketBufferSize(int socketBufferSize) {
|
||||
this.socketBufferSize = socketBufferSize;
|
||||
}
|
||||
|
||||
public void setMaxTimeBetweenPings(int maxTimeBetweenPings) {
|
||||
this.maxTimeBetweenPings = maxTimeBetweenPings;
|
||||
}
|
||||
|
||||
public void setMaxMessageCount(int maxMessageCount) {
|
||||
this.maxMessageCount = maxMessageCount;
|
||||
}
|
||||
|
||||
public void setMessageTimeToLive(int messageTimeToLive) {
|
||||
this.messageTimeToLive = messageTimeToLive;
|
||||
}
|
||||
|
||||
public void setServerGroups(String[] serverGroups) {
|
||||
this.serverGroups = serverGroups;
|
||||
}
|
||||
|
||||
public void setServerLoadProbe(ServerLoadProbe serverLoadProbe) {
|
||||
this.serverLoadProbe = serverLoadProbe;
|
||||
}
|
||||
|
||||
public void setLoadPollInterval(long loadPollInterval) {
|
||||
this.loadPollInterval = loadPollInterval;
|
||||
}
|
||||
|
||||
public void setBindAddress(String bindAddress) {
|
||||
this.bindAddress = bindAddress;
|
||||
}
|
||||
|
||||
public void setHostNameForClients(String hostNameForClients) {
|
||||
this.hostNameForClients = hostNameForClients;
|
||||
}
|
||||
|
||||
public void setListeners(Set<InterestRegistrationListener> listeners) {
|
||||
this.listeners = listeners;
|
||||
}
|
||||
|
||||
public void setCache(Cache cache) {
|
||||
this.cache = cache;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param evictionPolicy the evictionPolicy to set
|
||||
*/
|
||||
public void setSubscriptionEvictionPolicy(SubscriptionEvictionPolicy evictionPolicy) {
|
||||
this.evictionPolicy = evictionPolicy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param subscriptionCapacity the subscriptionCapacity to set
|
||||
*/
|
||||
public void setSubscriptionCapacity(int subscriptionCapacity) {
|
||||
this.subscriptionCapacity = subscriptionCapacity;
|
||||
}
|
||||
|
||||
public void setSubscriptionDiskStore(Resource resource) {
|
||||
this.subscriptionDiskStore = resource;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright 2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.server;
|
||||
|
||||
import com.gemstone.gemfire.cache.server.CacheServer;
|
||||
|
||||
/**
|
||||
* Enumeration of the various client subscription policies for {@link CacheServer}.
|
||||
*
|
||||
* @author Costin Leau
|
||||
*/
|
||||
public enum SubscriptionEvictionPolicy {
|
||||
NONE, MEM, ENTRY
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
/**
|
||||
* Support package for GemFire {@link com.gemstone.gemfire.cache.server.CacheServer}.
|
||||
*
|
||||
*/
|
||||
package org.springframework.data.gemfire.server;
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright 2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.support;
|
||||
|
||||
import org.springframework.dao.support.DaoSupport;
|
||||
import org.springframework.data.gemfire.GemfireTemplate;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.gemstone.gemfire.cache.Region;
|
||||
|
||||
/**
|
||||
* Convenient super class for GemFire data access objects. Intended for
|
||||
* GemfireTemplate usage.
|
||||
*
|
||||
* <p>Requires a Region to be set, providing a GemfireTemplate based on it to subclasses.
|
||||
* Can alternatively be initialized directly via a GemfireTemplate, to reuse the latter's
|
||||
* settings.
|
||||
*
|
||||
* <p>This class will create its own GemfireTemplate if an Region reference is passed in.
|
||||
* A custom GemfireTemplate instance can be used through overriding <code>createGemfireTemplate</code>.
|
||||
*
|
||||
* @author Costin Leau
|
||||
*/
|
||||
public class GemfireDaoSupport extends DaoSupport {
|
||||
|
||||
private GemfireTemplate gemfireTemplate;
|
||||
|
||||
/**
|
||||
* Sets the GemFire Region to be used by this DAO.
|
||||
* Will automatically create a GemfireTemplate for the given Region.
|
||||
*
|
||||
* @param region
|
||||
*/
|
||||
public void setRegion(Region<?, ?> region) {
|
||||
this.gemfireTemplate = createGemfireTemplate(region);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a GemfireTemplate for the given Region.
|
||||
* <p>Can be overridden in subclasses to provide a GemfireTemplate instance
|
||||
* with different configuration, or a custom GemfireTemplate subclass.
|
||||
* @param region the GemFire Region to create a GemfireTemplate for
|
||||
* @return the new GemfireTemplate instance
|
||||
* @see #setRegion
|
||||
*/
|
||||
protected GemfireTemplate createGemfireTemplate(Region<?, ?> region) {
|
||||
return new GemfireTemplate(region);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the GemfireTemplate for this DAO explicitly,
|
||||
* as an alternative to specifying a GemFire {@link Region}.
|
||||
* @see #setRegion
|
||||
*/
|
||||
public final void setGemfireTemplate(GemfireTemplate gemfireTemplate) {
|
||||
this.gemfireTemplate = gemfireTemplate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the GemfireTemplate for this DAO, pre-initialized
|
||||
* with the Region or set explicitly.
|
||||
*/
|
||||
public final GemfireTemplate getGemfireTemplate() {
|
||||
return gemfireTemplate;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void checkDaoConfig() {
|
||||
Assert.notNull(gemfireTemplate, "region or gemfireTemplate is required");
|
||||
}
|
||||
}
|
||||
@@ -1,2 +1,3 @@
|
||||
http\://www.springframework.org/schema/gemfire/spring-gemfire-1.0.xsd=org/springframework/data/gemfire/config/spring-gemfire-1.0.xsd
|
||||
http\://www.springframework.org/schema/gemfire/spring-gemfire.xsd=org/springframework/data/gemfire/config/spring-gemfire-1.0.xsd
|
||||
http\://www.springframework.org/schema/gemfire/spring-gemfire-1.1.xsd=org/springframework/data/gemfire/config/spring-gemfire-1.1.xsd
|
||||
http\://www.springframework.org/schema/gemfire/spring-gemfire.xsd=org/springframework/data/gemfire/config/spring-gemfire-1.1.xsd
|
||||
@@ -6,7 +6,7 @@
|
||||
targetNamespace="http://www.springframework.org/schema/gemfire"
|
||||
elementFormDefault="qualified"
|
||||
attributeFormDefault="unqualified"
|
||||
version="1.0">
|
||||
version="1.0.1">
|
||||
|
||||
<xsd:import namespace="http://www.springframework.org/schema/beans"/>
|
||||
<xsd:import namespace="http://www.springframework.org/schema/tool"/>
|
||||
@@ -74,7 +74,7 @@ The name of the bean defining the GemFire cache (by default 'gemfire-cache').
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="copy-on-read" type="xsd:boolean" default="true" use="optional">
|
||||
<xsd:attribute name="copy-on-read" type="xsd:string" default="true" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Indicates whether the cache returns direct references or copies of the objects (default) it manages.
|
||||
@@ -188,7 +188,7 @@ Disk storage configuration for the defined region.
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="persistent" type="xsd:boolean" default="false">
|
||||
<xsd:attribute name="persistent" type="xsd:string" default="false">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Indicates whether the defined region is persistent or not. GemFire ensures that all the data you put into a region that
|
||||
@@ -202,7 +202,7 @@ Note: Persistence for partitioned regions is supported only from GemFire 6.5 onw
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="destroy" type="xsd:boolean" default="false">
|
||||
<xsd:attribute name="destroy" type="xsd:string" default="false">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Indicates whether the defined region should be destroyed or not at shutdown. Destroy cascades to all entries and subregions.
|
||||
@@ -215,7 +215,7 @@ Note: destroy and close are mutually exclusive. Enabling one will automatically
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="close" type="xsd:boolean" default="true">
|
||||
<xsd:attribute name="close" type="xsd:string" default="true">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Indicates whether the defined region should be closed or not at shutdown. Close performs a local destroy but leaves behind the region
|
||||
@@ -228,6 +228,14 @@ Note: destroy and close are mutually exclusive. Enabling one will automatically
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="statistics" type="xsd:string" default="false">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Indicates whether statistics are enabled or disabled for this region and its entries.
|
||||
Default is false, meaning statistics are disabled.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
@@ -396,7 +404,7 @@ The name of the partitioned region with which this newly created partitioned reg
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="local-max-memory" type="xsd:positiveInteger" use="optional">
|
||||
<xsd:attribute name="local-max-memory" type="xsd:string" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The maximum amount of memory, in megabytes, to be used by the region in this process. If not set, a default of 90%
|
||||
@@ -404,7 +412,7 @@ of available heap is used.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="total-max-memory" type="xsd:positiveInteger" use="optional">
|
||||
<xsd:attribute name="total-max-memory" type="xsd:string" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The maximum amount of memory, in megabytes, to be used by the region in all process.
|
||||
@@ -413,7 +421,7 @@ Note: This setting must be the same in all processes using the region.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="total-buckets" type="xsd:positiveInteger" use="optional">
|
||||
<xsd:attribute name="total-buckets" type="xsd:string" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The total number of hash buckets to be used by the region in all processes.
|
||||
@@ -428,7 +436,7 @@ Note: This setting must be the same in all processes using the region.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="recovery-delay" type="xsd:long" default="-1" use="optional">
|
||||
<xsd:attribute name="recovery-delay" type="xsd:string" default="-1" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The delay in milliseconds that existing members will wait before satisfying redundancy after another member crashes.
|
||||
@@ -436,7 +444,7 @@ The delay in milliseconds that existing members will wait before satisfying redu
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="startup-recovery-delay" type="xsd:long" default="-1" use="optional">
|
||||
<xsd:attribute name="startup-recovery-delay" type="xsd:string" default="-1" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The delay in milliseconds that new members will wait before satisfying redundancy. -1 indicates that adding new members
|
||||
@@ -491,7 +499,7 @@ Considers the amount of heap used (through the GemFire resource manager) before
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="threshold" type="xsd:long" use="required">
|
||||
<xsd:attribute name="threshold" type="xsd:string" use="required">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The threshold (or limit) against which the eviction algorithm runs. Once the threashold is reached, eviction is
|
||||
@@ -536,7 +544,7 @@ Note: the directory must already exist.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="max-size" type="xsd:int" default="10240">
|
||||
<xsd:attribute name="max-size" type="xsd:string" default="10240">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The maximum size (in megabytes) of data stored in each directory. Default is 10240 MB (10 gigabytes).
|
||||
@@ -546,7 +554,7 @@ The maximum size (in megabytes) of data stored in each directory. Default is 102
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="synchronous-write" type="xsd:boolean" default="false">
|
||||
<xsd:attribute name="synchronous-write" type="xsd:string" default="false">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Indicates whether the writing to the disk si synchronous or not. Default is false, meaning asynchronous writing.
|
||||
@@ -554,7 +562,7 @@ Indicates whether the writing to the disk si synchronous or not. Default is fals
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="auto-compact" type="xsd:boolean" default="true">
|
||||
<xsd:attribute name="auto-compact" type="xsd:string" default="true">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Indicates whether or not the operation logs are automatically compacted or not. Default is true.
|
||||
@@ -581,7 +589,7 @@ by entry destroys, entry updates, and region destroys.
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
-->
|
||||
<xsd:attribute name="max-oplog-size" type="xsd:long" default="1024">
|
||||
<xsd:attribute name="max-oplog-size" type="xsd:string" default="1024">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Sets the maximum size in megabytes a single oplog (operation log) is allowed to be. When an oplog is created this
|
||||
@@ -590,7 +598,7 @@ amount of file space will be immediately reserved.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="time-interval" type="xsd:long" default="1">
|
||||
<xsd:attribute name="time-interval" type="xsd:string" default="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Sets the number of milliseconds that can elapse before unwritten data is written to disk.
|
||||
@@ -599,7 +607,7 @@ It is considered only for asynchronous writing.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="queue-size" type="xsd:long" default="0">
|
||||
<xsd:attribute name="queue-size" type="xsd:string" default="0">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The maximum number of operations that can be asynchronously queued. Once this many pending async operations have been
|
||||
@@ -749,7 +757,7 @@ The port number of the connection (between 1 and 65535 inclusive).
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="interestType" abstract="true">
|
||||
<xsd:attribute name="durable" type="xsd:boolean" default="false" use="optional">
|
||||
<xsd:attribute name="durable" type="xsd:string" default="false" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Indicates whether or not the registered interest is durable or not. Default is false.
|
||||
@@ -800,22 +808,22 @@ Note that in order to instantiate a pool, a GemFire cache needs to be already st
|
||||
The name of the pool definition (by default "gemfire-pool").]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="free-connection-timeout" use="optional" type="xsd:int"/>
|
||||
<xsd:attribute name="idle-timeout" use="optional" type="xsd:long"/>
|
||||
<xsd:attribute name="load-conditioning-interval" use="optional" type="xsd:int"/>
|
||||
<xsd:attribute name="max-connections" use="optional" type="xsd:int"/>
|
||||
<xsd:attribute name="min-connections" use="optional" type="xsd:int"/>
|
||||
<xsd:attribute name="ping-interval" use="optional" type="xsd:long"/>
|
||||
<xsd:attribute name="read-timeout" use="optional" type="xsd:int"/>
|
||||
<xsd:attribute name="retry-attempts" use="optional" type="xsd:int"/>
|
||||
<xsd:attribute name="free-connection-timeout" use="optional" type="xsd:string"/>
|
||||
<xsd:attribute name="idle-timeout" use="optional" type="xsd:string"/>
|
||||
<xsd:attribute name="load-conditioning-interval" use="optional" type="xsd:string"/>
|
||||
<xsd:attribute name="max-connections" use="optional" type="xsd:string"/>
|
||||
<xsd:attribute name="min-connections" use="optional" type="xsd:string"/>
|
||||
<xsd:attribute name="ping-interval" use="optional" type="xsd:string"/>
|
||||
<xsd:attribute name="read-timeout" use="optional" type="xsd:string"/>
|
||||
<xsd:attribute name="retry-attempts" use="optional" type="xsd:string"/>
|
||||
<xsd:attribute name="server-group" use="optional" type="xsd:string"/>
|
||||
<xsd:attribute name="socket-buffer-size" use="optional" type="xsd:int"/>
|
||||
<xsd:attribute name="statistic-interval" use="optional" type="xsd:int"/>
|
||||
<xsd:attribute name="subscription-ack-interval" use="optional" type="xsd:int"/>
|
||||
<xsd:attribute name="subscription-enabled" use="optional" type="xsd:boolean"/>
|
||||
<xsd:attribute name="subscription-message-tracking-timeout" use="optional" type="xsd:int"/>
|
||||
<xsd:attribute name="subscription-redundancy" use="optional" type="xsd:int"/>
|
||||
<xsd:attribute name="thread-local-connections" use="optional" type="xsd:boolean"/>
|
||||
<xsd:attribute name="socket-buffer-size" use="optional" type="xsd:string"/>
|
||||
<xsd:attribute name="statistic-interval" use="optional" type="xsd:string"/>
|
||||
<xsd:attribute name="subscription-ack-interval" use="optional" type="xsd:string"/>
|
||||
<xsd:attribute name="subscription-enabled" use="optional" type="xsd:string"/>
|
||||
<xsd:attribute name="subscription-message-tracking-timeout" use="optional" type="xsd:string"/>
|
||||
<xsd:attribute name="subscription-redundancy" use="optional" type="xsd:string"/>
|
||||
<xsd:attribute name="thread-local-connections" use="optional" type="xsd:string"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
|
||||
@@ -0,0 +1,915 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<xsd:schema xmlns="http://www.springframework.org/schema/gemfire"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xmlns:tool="http://www.springframework.org/schema/tool"
|
||||
targetNamespace="http://www.springframework.org/schema/gemfire"
|
||||
elementFormDefault="qualified"
|
||||
attributeFormDefault="unqualified"
|
||||
version="1.1">
|
||||
|
||||
<xsd:import namespace="http://www.springframework.org/schema/beans"/>
|
||||
<xsd:import namespace="http://www.springframework.org/schema/tool"/>
|
||||
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Namespace support for the Spring GemFire project.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:element name="cache">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation source="org.springframework.data.gemfire.CacheFactoryBean"><![CDATA[
|
||||
Defines a GemFire Cache instance used for creating or retrieving 'regions'.
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation>
|
||||
<tool:exports type="com.gemstone.gemfire.cache.Cache" />
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="id" type="xsd:ID" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The name of the cache definition (by default "gemfire-cache").]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="cache-xml-location" type="xsd:string" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation source="org.springframework.core.io.Resource"><![CDATA[
|
||||
The location of the GemFire cache xml file, as a Spring resource location: a URL, a "classpath:" pseudo URL,
|
||||
or a relative file path.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="properties-ref" type="xsd:string" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation source="java.util.Properties"><![CDATA[
|
||||
The bean name of a Java Properties object that will be used for property substitution. For loading properties
|
||||
consider using a dedicated utility such as the <util:*/> namespace and its 'properties' element.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="use-bean-factory-locator" type="xsd:string" default="true" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Indicates whether a bean factory locator is enabled (default) for this cache definition or not. The locator stores
|
||||
the enclosing bean factory reference to allow auto-wiring of Spring beans into GemFire managed classes. Usually disabled
|
||||
when the same cache is used in multiple application context/bean factories inside the same VM.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="transaction-manager">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation source="org.springframework.data.gemfire.GemfireTransactionManager"><![CDATA[
|
||||
Defines a GemFire Transaction Manager instance for a single GemFire cache.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="id" type="xsd:ID" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The name of the transaction manager definition (by default "gemfire-transaction-manager").]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="cache-ref" type="xsd:string" default="gemfire-cache" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The name of the bean defining the GemFire cache (by default 'gemfire-cache').
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="copy-on-read" type="xsd:string" default="true" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Indicates whether the cache returns direct references or copies of the objects (default) it manages.
|
||||
While copies imply additional work for every fetch operation, direct references can cause dirty reads
|
||||
across concurrent threads in the same VM, whether or not transactions are used.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<!-- nested bean definition -->
|
||||
<xsd:complexType name="beanDeclarationType">
|
||||
<xsd:sequence>
|
||||
<xsd:any namespace="##other" minOccurs="0" maxOccurs="1" processContents="skip">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Inner bean definition. The nested declaration serves as an alternative to bean references (using
|
||||
both in the same definition) is illegal.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:any>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="ref" type="xsd:string" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The name of the bean referred by this declaration. If no reference exists, use an inner bean declaration.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="basicRegionType">
|
||||
<xsd:annotation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation>
|
||||
<tool:exports type="com.gemstone.gemfire.cache.Region" />
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
<xsd:attribute name="id" type="xsd:string" use="required">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The id of the region bean definition.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="name" type="xsd:string" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The name of the region definition. If no specified, it will have the value of the id attribute (that is, the bean name).
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="cache-ref" type="xsd:string" default="gemfire-cache" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The name of the bean defining the GemFire cache (by default 'gemfire-cache').
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
|
||||
|
||||
<xsd:complexType name="readOnlyRegionType" abstract="true">
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="basicRegionType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="cache-listener" minOccurs="0" maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation source="com.gemstone.gemfire.cache.CacheListener"><![CDATA[
|
||||
A cache listener definition for this region. A cache listener handles region or entry related events (that occur after
|
||||
various operations on the region). Multiple listeners can be declared in a nested manner.
|
||||
|
||||
Note: Avoid the risk of deadlock. Since the listener is invoked while holding a lock on the entry generating the event,
|
||||
it is easy to generate a deadlock by interacting with the region. For this reason, it is highly recommended to use some
|
||||
other thread for accessing the region and not waiting for it to complete its task.
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation>
|
||||
<tool:exports type="com.gemstone.gemfire.cache.CacheListener"/>
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="skip">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Inner bean definition of the cache listener.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:any>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="ref" type="xsd:string" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The name of the cache listener bean referred by this declaration. Used as a convenience method. If no reference exists,
|
||||
use inner bean declarations.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="disk-store" type="diskStoreType" minOccurs="0" maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Disk storage configuration for the defined region.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="persistent" type="xsd:string" default="false">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Indicates whether the defined region is persistent or not. GemFire ensures that all the data you put into a region that
|
||||
is configured for persistence will be written to disk in a way that it can be recovered the next time you create the
|
||||
region. This allows data to be recovered after a machine or process failure or after an orderly shutdown and restart
|
||||
of GemFire.
|
||||
|
||||
Default is false, meaning the regions are not persisted.
|
||||
|
||||
Note: Persistence for partitioned regions is supported only from GemFire 6.5 onwards.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="destroy" type="xsd:string" default="false">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Indicates whether the defined region should be destroyed or not at shutdown. Destroy cascades to all entries and subregions.
|
||||
After the destroy, this region object can not be used any more and any attempt to use this region object will get
|
||||
RegionDestroyedException.
|
||||
|
||||
Default is false, meaning that regions are not destroyed.
|
||||
|
||||
Note: destroy and close are mutually exclusive. Enabling one will automatically disable the other.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="close" type="xsd:string" default="true">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Indicates whether the defined region should be closed or not at shutdown. Close performs a local destroy but leaves behind the region
|
||||
disk files. Additionally it notifies the listeners and callbacks.
|
||||
|
||||
Default is true, meaning the regions are closed.
|
||||
|
||||
Note: Regions are automatically closed when cache closes.
|
||||
Note: destroy and close are mutually exclusive. Enabling one will automatically disable the other.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="statistics" type="xsd:string" default="false">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Indicates whether statistics are enabled or disabled for this region and its entries.
|
||||
Default is false, meaning statistics are disabled.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="regionType">
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="readOnlyRegionType">
|
||||
<xsd:sequence minOccurs="0" maxOccurs="1">
|
||||
<xsd:element name="cache-loader" minOccurs="0" maxOccurs="1" type="beanDeclarationType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation source="com.gemstone.gemfire.cache.CacheLoader"><![CDATA[
|
||||
The cache loader definition for this region. A cache loader allows data to be placed into a region.
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation>
|
||||
<tool:exports type="com.gemstone.gemfire.cache.CacheLoader"/>
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="cache-writer" minOccurs="0" maxOccurs="1" type="beanDeclarationType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation source="com.gemstone.gemfire.cache.CacheWriter"><![CDATA[
|
||||
The cache writer definition for this region. A cache writer acts as a dedicated synchronous listener that is notified
|
||||
before a region or an entry is modified. A typical example would be a writer that updates the database.
|
||||
|
||||
Note: Only one CacheWriter is invoked. GemFire will always prefer the local one (if it exists) otherwise it will
|
||||
arbitrarily pick one.
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation>
|
||||
<tool:exports type="com.gemstone.gemfire.cache.CacheWriter"/>
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:element name="lookup-region" type="basicRegionType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[[
|
||||
Looks up an existing, working, GemFire region. Typically regions are defined through GemFire own configuration, the
|
||||
cache.xml. If the region does not exist, an exception will be thrown.
|
||||
|
||||
For defining regions, consider the region elements.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="replicated-region">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation source="org.springframework.data.gemfire.RegionFactoryBean"><![CDATA[
|
||||
Defines a GemFire replicated region instance. Each replicated region contains a complete copy of the data.
|
||||
As well as high availability, replication provides excellent performance as each region contains a complete,
|
||||
up to date copy of the data.
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation>
|
||||
<tool:exports type="com.gemstone.gemfire.cache.Region" />
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="regionType">
|
||||
<xsd:sequence minOccurs="1" maxOccurs="1">
|
||||
<xsd:element name="eviction" minOccurs="0" maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Eviction policy for the partitioned region.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="evictionType">
|
||||
<xsd:attribute name="action" type="evictionActionType" fixed="OVERFLOW_TO_DISK">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The action to take when performing eviction.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="partitioned-region">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation source="org.springframework.data.gemfire.RegionFactoryBean"><![CDATA[
|
||||
Defines a GemFire partitioned region instance. Through partitioning, the data is split across regions.
|
||||
Partitioning is useful when the amount of data to store is too large for one member to hold and work
|
||||
with as if it were a single entity. One can configure the partitioned region to store redundant copies
|
||||
in different members, for high availability in case of an application failure.
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation>
|
||||
<tool:exports type="com.gemstone.gemfire.cache.Region" />
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="regionType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="partition-resolver" minOccurs="0" maxOccurs="1" type="beanDeclarationType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation source="com.gemstone.gemfire.cache.PartitionResolver"><![CDATA[
|
||||
The partition resolver definition for this region, allowing for custom partitioning. GemFire uses the resolver to
|
||||
colocate data based on custom criterias (such as colocating trades by month and year).
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation>
|
||||
<tool:exports type="com.gemstone.gemfire.cache.PartitionResolver"/>
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="eviction" minOccurs="0" maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Eviction policy for the partitioned region.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="evictionType">
|
||||
<xsd:attribute name="action" type="evictionActionType" default="LOCAL_DESTROY">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The action to take when performing eviction.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="copies" default="0" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The number of copies for each partition for high-availability. By default, no copies are created meaning there is no
|
||||
redundancy. Each copy provides extra backup at the expense of extra storages.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:byte">
|
||||
<xsd:minInclusive value="0"/>
|
||||
<xsd:maxInclusive value="3"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="colocated-with" type="xsd:string" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The name of the partitioned region with which this newly created partitioned region is colocated.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="local-max-memory" type="xsd:string" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The maximum amount of memory, in megabytes, to be used by the region in this process. If not set, a default of 90%
|
||||
of available heap is used.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="total-max-memory" type="xsd:string" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The maximum amount of memory, in megabytes, to be used by the region in all process.
|
||||
|
||||
Note: This setting must be the same in all processes using the region.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="total-buckets" type="xsd:string" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The total number of hash buckets to be used by the region in all processes.
|
||||
|
||||
A bucket is the smallest unit of data management in a partitioned region. Entries are stored in buckets and buckets may
|
||||
move from one VM to another. Buckets may also have copies, depending on redundancy to provide high availability in the
|
||||
face of VM failure.
|
||||
The number of buckets should be prime and as a rough guide at the least four times the number of partition VMs. However
|
||||
, there is significant overhead to managing a bucket, particularly for higher values of redundancy.
|
||||
|
||||
Note: This setting must be the same in all processes using the region.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="recovery-delay" type="xsd:string" default="-1" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The delay in milliseconds that existing members will wait before satisfying redundancy after another member crashes.
|
||||
-1 (the default) indicates that redundancy will not be recovered after a failure.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="startup-recovery-delay" type="xsd:string" default="-1" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The delay in milliseconds that new members will wait before satisfying redundancy. -1 indicates that adding new members
|
||||
will not trigger redundancy recovery. The default is to recover redundancy immediately when a new member is added.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:complexType name="evictionType">
|
||||
<xsd:sequence minOccurs="0" maxOccurs="1">
|
||||
<xsd:element name="object-sizer" type="beanDeclarationType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Entity computing sizes for objects stored into the grid.
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation>
|
||||
<tool:exports type="com.gemstone.gemfire.cache.util.ObjectSizer" />
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="type" default="ENTRY_COUNT">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="ENTRY_COUNT">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Considers the number of entries in the region before performing an eviction.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:enumeration>
|
||||
<xsd:enumeration value="MEMORY_SIZE">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Considers the amount of memory consumed by the region before performing an eviction.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:enumeration>
|
||||
<xsd:enumeration value="HEAP_PERCENTAGE">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Considers the amount of heap used (through the GemFire resource manager) before performing an eviction.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:enumeration>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="threshold" type="xsd:string" use="required">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The threshold (or limit) against which the eviction algorithm runs. Once the threashold is reached, eviction is
|
||||
performed.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:simpleType name="evictionActionType">
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="LOCAL_DESTROY">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The LRU (least-recently-used) region entries is locally destroyed.
|
||||
|
||||
Note: this option is not compatible with replicated regions (as it render the replica region incomplete).
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:enumeration>
|
||||
<xsd:enumeration value="OVERFLOW_TO_DISK">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The LRU (least-recently-used) region entry values are written to disk and nulled-out in the member to
|
||||
reclaim memory.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:enumeration>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
|
||||
<xsd:complexType name="diskStoreType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="disk-dir" minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="location" type="xsd:string" use="required">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Directory on the file system for storing data.
|
||||
|
||||
Note: the directory must already exist.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="max-size" type="xsd:string" default="10240">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The maximum size (in megabytes) of data stored in each directory. Default is 10240 MB (10 gigabytes).
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="synchronous-write" type="xsd:string" default="false">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Indicates whether the writing to the disk si synchronous or not. Default is false, meaning asynchronous writing.
|
||||
]]>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="auto-compact" type="xsd:string" default="true">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Indicates whether or not the operation logs are automatically compacted or not. Default is true.
|
||||
]]>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<!--
|
||||
<xsd:attribute name="compaction-threshold" default="50">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Sets the threshold at which an oplog will become compactable. Until it reaches this threshold the oplog will not be
|
||||
compacted. The threshold is a percentage in the range 0..100. When the amount of garbage in an oplog exceeds this
|
||||
percentage then when a compaction is done this garbage will be cleaned up freeing up disk space. Garbage is created
|
||||
by entry destroys, entry updates, and region destroys.
|
||||
]]>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:short">
|
||||
<xsd:minExclusive value="0"/>
|
||||
<xsd:maxExclusive value="100"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
-->
|
||||
<xsd:attribute name="max-oplog-size" type="xsd:string" default="1024">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Sets the maximum size in megabytes a single oplog (operation log) is allowed to be. When an oplog is created this
|
||||
amount of file space will be immediately reserved.
|
||||
]]>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="time-interval" type="xsd:string" default="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Sets the number of milliseconds that can elapse before unwritten data is written to disk.
|
||||
It is considered only for asynchronous writing.
|
||||
]]>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="queue-size" type="xsd:string" default="0">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The maximum number of operations that can be asynchronously queued. Once this many pending async operations have been
|
||||
queued async ops will begin blocking until some of the queued ops have been flushed to disk.
|
||||
Considered only for asynchronous writing.
|
||||
]]>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:element name="client-region">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation source="org.springframework.data.gemfire.client.ClientRegionFactoryBean"><![CDATA[
|
||||
Defines a GemFire client region instance. A client region is connected to a (long-lived) farm of GemFire servers from
|
||||
which it receives its data. The client can hold some data locally or forward all requests to the server.
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation>
|
||||
<tool:exports type="com.gemstone.gemfire.cache.Region" />
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="readOnlyRegionType">
|
||||
<xsd:sequence>
|
||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:element name="key-interest">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Key based interest. If the key is a List, then all the keys in the List will be registered. The key can also be the
|
||||
special token 'ALL_KEYS', which will register interest in all keys in the region. In effect, this will cause an update
|
||||
to any key in this region in the CacheServer to be pushed to the client.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="interestType">
|
||||
<xsd:sequence minOccurs="0" maxOccurs="1">
|
||||
<xsd:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="skip">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Inner bean definition of the client key interest.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:any>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="key-ref" type="xsd:string" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The name of the client key interest bean referred by this declaration. Used as a convenience method. If no reference exists,
|
||||
use the inner bean declaration.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="regex-interest">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Regular expression based interest. If the pattern is '.*' then all keys of any type will be pushed to the client.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="interestType">
|
||||
<xsd:attribute name="pattern" type="xsd:string"/>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
<xsd:element name="eviction" minOccurs="0" maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Eviction policy for the partitioned region.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="evictionType">
|
||||
<xsd:attribute name="action" type="evictionActionType" default="LOCAL_DESTROY">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The action to take when performing eviction.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="data-policy" use="optional" default="NORMAL">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The data policy for this client. Can be either 'EMPTY' or 'NORMAL' (the default). In case persistence or overflow are
|
||||
configured for this region, this parameter will be ignored.
|
||||
|
||||
EMPTY - causes data to never be stored in local memory. The region will always appear empty. It can be used to for zero
|
||||
footprint producers that only want to distribute their data to others and for zero footprint consumers that only want
|
||||
to see events.
|
||||
NORMAL - causes data that this region is interested in to be stored in local memory. It allows the contents in this
|
||||
cache to differ from other caches.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="EMPTY"/>
|
||||
<xsd:enumeration value="NORMAL"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="pool-name" use="required" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The name of the pool used by this client.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:complexType name="connectionType">
|
||||
<xsd:attribute name="host" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The host name or ip address of the connection.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="port">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The port number of the connection (between 1 and 65535 inclusive).
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string"/>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="interestType" abstract="true">
|
||||
<xsd:attribute name="durable" type="xsd:string" default="false" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Indicates whether or not the registered interest is durable or not. Default is false.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="result-policy" default="KEYS_VALUES" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The result policy for this interest. Can be one of 'KEYS' or 'KEYS_VALUES' (the default) or 'NONE'.
|
||||
|
||||
KEYS - Initializes the local cache with the keys satisfying the request.
|
||||
KEYS-VALUES - initializes the local cache with the keys and current values satisfying the request.
|
||||
NONE - Does not initialize the local cache.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="KEYS"/>
|
||||
<xsd:enumeration value="KEYS_VALUES"/>
|
||||
<xsd:enumeration value="NONE"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:element name="pool">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation source="org.springframework.data.gemfire.client.PoolFactoryBean"><![CDATA[
|
||||
Defines a pool for connections from a client to a set of GemFire Cache Servers.
|
||||
|
||||
Note that in order to instantiate a pool, a GemFire cache needs to be already started.
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation>
|
||||
<tool:exports type="com.gemstone.gemfire.cache.client.Pool" />
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:choice minOccurs="1" maxOccurs="1">
|
||||
<xsd:element name="locator" type="connectionType" minOccurs="1" maxOccurs="unbounded"/>
|
||||
<xsd:element name="server" type="connectionType" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</xsd:choice>
|
||||
<xsd:attribute name="id" type="xsd:ID" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The name of the pool definition (by default "gemfire-pool").]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="free-connection-timeout" use="optional" type="xsd:string"/>
|
||||
<xsd:attribute name="idle-timeout" use="optional" type="xsd:string"/>
|
||||
<xsd:attribute name="load-conditioning-interval" use="optional" type="xsd:string"/>
|
||||
<xsd:attribute name="max-connections" use="optional" type="xsd:string"/>
|
||||
<xsd:attribute name="min-connections" use="optional" type="xsd:string"/>
|
||||
<xsd:attribute name="ping-interval" use="optional" type="xsd:string"/>
|
||||
<xsd:attribute name="read-timeout" use="optional" type="xsd:string"/>
|
||||
<xsd:attribute name="retry-attempts" use="optional" type="xsd:string"/>
|
||||
<xsd:attribute name="server-group" use="optional" type="xsd:string"/>
|
||||
<xsd:attribute name="socket-buffer-size" use="optional" type="xsd:string"/>
|
||||
<xsd:attribute name="statistic-interval" use="optional" type="xsd:string"/>
|
||||
<xsd:attribute name="subscription-ack-interval" use="optional" type="xsd:string"/>
|
||||
<xsd:attribute name="subscription-enabled" use="optional" type="xsd:string"/>
|
||||
<xsd:attribute name="subscription-message-tracking-timeout" use="optional" type="xsd:string"/>
|
||||
<xsd:attribute name="subscription-redundancy" use="optional" type="xsd:string"/>
|
||||
<xsd:attribute name="thread-local-connections" use="optional" type="xsd:string"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="cache-server">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation
|
||||
source="org.springframework.data.gemfire.server.CacheServerFactoryBean"><![CDATA[
|
||||
Defines a Cache Server for feeding data to remote gemfire clients to a server GemFire Cache Servers.
|
||||
Note: In order to instantiate a cacheserver, a GemFire cache needs to be avaialble in the VM.
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation>
|
||||
<tool:exports type="com.gemstone.gemfire.cache.server.CacheServer" />
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:sequence minOccurs="0" maxOccurs="1">
|
||||
<xsd:element name="subscription-config" minOccurs="0" maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The client subscription configuration that is used to control a clients use of server resources towards notification queues.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="eviction-type" use="optional" default="NONE">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="NONE"/>
|
||||
<xsd:enumeration value="MEM"/>
|
||||
<xsd:enumeration value="ENTRY"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="capacity" use="optional" default="1" type="xsd:string"/>
|
||||
<xsd:attribute name="disk-store" use="optional" default="." type="xsd:string"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="id" type="xsd:ID" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[The name of the cache server definition (by default "gemfire-server").]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="auto-startup" use="optional" type="xsd:string" default="true" />
|
||||
<xsd:attribute name="bind-address" use="optional" type="xsd:string" />
|
||||
<xsd:attribute name="port" use="optional" type="xsd:string" default="40404">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[The port number of the server.]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="host-name-for-clients" use="optional" type="xsd:string" />
|
||||
<xsd:attribute name="load-poll-interval" use="optional" type="xsd:string" default="5000" />
|
||||
<xsd:attribute name="max-connections" use="optional" type="xsd:string" default="800" />
|
||||
<xsd:attribute name="max-threads" use="optional" type="xsd:string" default="0" />
|
||||
<xsd:attribute name="max-message-count" use="optional" type="xsd:string" default="230000" />
|
||||
<xsd:attribute name="max-time-between-pings" use="optional" type="xsd:string" default="60000" />
|
||||
<xsd:attribute name="message-time-to-live" use="optional" type="xsd:string" default="180" />
|
||||
<xsd:attribute name="socket-buffer-size" use="optional" type="xsd:string" default="32768" />
|
||||
<xsd:attribute name="notify-by-subscription" use="optional" type="xsd:boolean" default="true" />
|
||||
<xsd:attribute name="groups" use="optional" type="xsd:string" default="">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The server groups that this server will be a member of given as a comma separated values list.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="load-probe-ref" use="optional" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[The name of the bean defining the CacheServer Load Probe.]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="cache-ref" type="xsd:string" default="gemfire-cache" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[The name of the bean defining the GemFire cache (by default 'gemfire-cache').]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -61,4 +61,5 @@ public class CacheIntegrationTest extends RecreatingContextTest{
|
||||
public void testCacheWithXml() throws Exception {
|
||||
Cache cache = ctx.getBean("cache-with-xml", Cache.class);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,12 +17,14 @@
|
||||
package org.springframework.data.gemfire.config;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.data.gemfire.CacheFactoryBean;
|
||||
import org.springframework.data.gemfire.GemfireBeanFactoryLocator;
|
||||
import org.springframework.data.gemfire.RecreatingContextTest;
|
||||
import org.springframework.data.gemfire.TestUtils;
|
||||
|
||||
@@ -61,4 +63,17 @@ public class CacheNamespaceTest extends RecreatingContextTest {
|
||||
assertEquals(ctx.getBean("props"), TestUtils.readField("properties", cfb));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testNoBeanFactory() throws Exception {
|
||||
assertTrue(ctx.containsBean("no-bl"));
|
||||
CacheFactoryBean cfb = (CacheFactoryBean) ctx.getBean("&no-bl");
|
||||
GemfireBeanFactoryLocator locator = new GemfireBeanFactoryLocator();
|
||||
try {
|
||||
assertNotNull(locator.useBeanFactory("cache-with-name"));
|
||||
locator.useBeanFactory("no-bl");
|
||||
} finally {
|
||||
locator.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright 2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.config;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.gemfire.RecreatingContextTest;
|
||||
|
||||
import com.gemstone.gemfire.cache.server.CacheServer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Costin Leau
|
||||
*/
|
||||
public class CacheServerNamespaceTest extends RecreatingContextTest {
|
||||
|
||||
@Override
|
||||
protected String location() {
|
||||
return "org/springframework/data/gemfire/config/server-ns.xml";
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBasicCacheServer() throws Exception {
|
||||
CacheServer cacheServer = ctx.getBean("advanced-config", CacheServer.class);
|
||||
assertTrue(cacheServer.isRunning());
|
||||
assertEquals(1, cacheServer.getGroups().length);
|
||||
assertEquals("test-server", cacheServer.getGroups()[0]);
|
||||
assertEquals(22, cacheServer.getMaxConnections());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -61,6 +61,8 @@ public class PartitionedRegionNamespaceTest {
|
||||
assertEquals("redundant", TestUtils.readField("name", fb));
|
||||
|
||||
RegionAttributes attrs = TestUtils.readField("attributes", fb);
|
||||
assertTrue(attrs.getStatisticsEnabled());
|
||||
|
||||
PartitionAttributes pAttr = attrs.getPartitionAttributes();
|
||||
|
||||
assertEquals(1, pAttr.getRedundantCopies());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright 2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.gemfire.support;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.data.gemfire.GemfireTemplate;
|
||||
|
||||
/**
|
||||
* @author Costin Leau
|
||||
*
|
||||
*/
|
||||
public class GemfireDaoSupportTests extends TestCase {
|
||||
|
||||
public void testGemfireDaoSupportWithTemplate() throws Exception {
|
||||
GemfireTemplate template = new GemfireTemplate();
|
||||
final List test = new ArrayList();
|
||||
GemfireDaoSupport dao = new GemfireDaoSupport() {
|
||||
protected void initDao() {
|
||||
test.add("test");
|
||||
}
|
||||
};
|
||||
dao.setGemfireTemplate(template);
|
||||
dao.afterPropertiesSet();
|
||||
assertNotNull("template not created", dao.getGemfireTemplate());
|
||||
assertEquals("incorrect template", template, dao.getGemfireTemplate());
|
||||
assertEquals("initDao not called", test.size(), 1);
|
||||
}
|
||||
|
||||
public void testInvalidDaoTemplate() throws Exception {
|
||||
GemfireDaoSupport dao = new GemfireDaoSupport() {
|
||||
};
|
||||
try {
|
||||
dao.afterPropertiesSet();
|
||||
fail("expected exception");
|
||||
} catch (IllegalArgumentException iae) {
|
||||
// okay
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,5 +35,8 @@
|
||||
<bean id="cache-with-xml" class="org.springframework.data.gemfire.CacheFactoryBean">
|
||||
<property name="cacheXml" value="classpath:cache.xml"/>
|
||||
</bean>
|
||||
|
||||
<bean id="pdx-cache" class="org.springframework.data.gemfire.CacheFactoryBean">
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -21,4 +21,6 @@
|
||||
<util:properties id="props">
|
||||
<prop key="disable-tcp">false</prop>
|
||||
</util:properties>
|
||||
|
||||
<gfe:cache id="no-bl" use-bean-factory-locator="false" />
|
||||
</beans>
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
<gfe:partitioned-region id="simple" />
|
||||
|
||||
<gfe:partitioned-region id="options" copies="1" total-buckets="4" name="redundant" close="true" destroy="false">
|
||||
<gfe:partitioned-region id="options" copies="1" total-buckets="4" name="redundant" close="true" destroy="false" statistics="true">
|
||||
<gfe:partition-resolver>
|
||||
<bean class="org.springframework.data.gemfire.SimplePartitionResolver"/>
|
||||
</gfe:partition-resolver>
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:gfe="http://www.springframework.org/schema/gemfire"
|
||||
xmlns:p="http://www.springframework.org/schema/p"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
default-lazy-init="true"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
|
||||
|
||||
<gfe:cache />
|
||||
|
||||
<!-- Advanced example depicting various cache server configuration options -->
|
||||
<gfe:cache-server id="advanced-config" auto-startup="true"
|
||||
bind-address="localhost" port="${gfe.port.6}" host-name-for-clients="localhost"
|
||||
load-poll-interval="2000" max-connections="22" max-threads="16"
|
||||
max-message-count="1000" max-time-between-pings="30000"
|
||||
groups="test-server">
|
||||
|
||||
<gfe:subscription-config eviction-type="ENTRY" capacity="1000" disk-store="file://${java.io.tmpdir}"/>
|
||||
</gfe:cache-server>
|
||||
|
||||
<context:property-placeholder location="classpath:port.properties" />
|
||||
|
||||
|
||||
</beans>
|
||||
@@ -1,2 +1,3 @@
|
||||
gfe.port=40403
|
||||
gfe.port.4=40404
|
||||
gfe.port.4=40404
|
||||
gfe.port.6=40406
|
||||
Reference in New Issue
Block a user