SGF-567 - Remove old GemFire GatewayHub functionality.
Remove other deprecated and no longer existing GemFire classes in GemFire 9.
This commit is contained in:
@@ -52,20 +52,21 @@ import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.context.Phased;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor;
|
||||
import org.springframework.dao.support.PersistenceExceptionTranslator;
|
||||
import org.springframework.data.gemfire.util.CollectionUtils;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
* FactoryBean used to configure a GemFire peer Cache node. Allows either retrieval of an existing, opened Cache
|
||||
* or the creation of a new Cache instance.
|
||||
* <p>
|
||||
* This class implements the {@link org.springframework.dao.support.PersistenceExceptionTranslator}
|
||||
* interface, as auto-detected by Spring's
|
||||
* {@link org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor}, for AOP-based translation
|
||||
* of native Exceptions to Spring DataAccessExceptions. Hence, the presence of this class automatically enables
|
||||
* a PersistenceExceptionTranslationPostProcessor to translate GemFire Exceptions appropriately.
|
||||
* Spring {@link FactoryBean} used to configure a GemFire peer Cache. This class either looks up an existing, open
|
||||
* {@link Cache} instance already or creates a new {@link Cache} instance.
|
||||
*
|
||||
* This class implements the {@link org.springframework.dao.support.PersistenceExceptionTranslator} interface,
|
||||
* as auto-detected by Spring's {@link PersistenceExceptionTranslationPostProcessor}, for AOP-based translation
|
||||
* of native GemFire Exceptions to Spring {@link DataAccessException}. Hence, the presence of this class
|
||||
* automatically enables a {@link PersistenceExceptionTranslationPostProcessor} to translate GemFire Exceptions
|
||||
* appropriately.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author David Turanski
|
||||
@@ -86,7 +87,7 @@ import org.springframework.util.ObjectUtils;
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class CacheFactoryBean implements BeanClassLoaderAware, BeanFactoryAware, BeanNameAware, FactoryBean<Cache>,
|
||||
Phased, InitializingBean, DisposableBean, PersistenceExceptionTranslator {
|
||||
InitializingBean, DisposableBean, PersistenceExceptionTranslator, Phased {
|
||||
|
||||
private boolean close = true;
|
||||
private boolean useBeanFactoryLocator = false;
|
||||
@@ -1090,5 +1091,4 @@ public class CacheFactoryBean implements BeanClassLoaderAware, BeanFactoryAware,
|
||||
this.props = props;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -293,10 +293,6 @@ public abstract class GemfireCacheUtils {
|
||||
if (ex instanceof VersionException) {
|
||||
return new DataAccessResourceFailureException(ex.getMessage(), ex);
|
||||
}
|
||||
// util.version exception (seems quite similar to the exception above)
|
||||
if (ex instanceof org.apache.geode.cache.util.VersionException) {
|
||||
return new DataAccessResourceFailureException(ex.getMessage(), ex);
|
||||
}
|
||||
// admin exception
|
||||
if (ex instanceof org.apache.geode.admin.AdminException) {
|
||||
return new GemfireSystemException(ex);
|
||||
@@ -347,5 +343,4 @@ public abstract class GemfireCacheUtils {
|
||||
static DataAccessException convertCqInvalidException(RuntimeException ex) {
|
||||
return new GemfireQueryException(ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,29 +39,27 @@ import org.apache.geode.cache.asyncqueue.AsyncEventQueue;
|
||||
import org.apache.geode.cache.wan.GatewaySender;
|
||||
import org.apache.geode.internal.cache.UserSpecifiedRegionAttributes;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.context.SmartLifecycle;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.data.gemfire.client.ClientRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.util.ArrayUtils;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
/**
|
||||
* Base class for FactoryBeans used to create GemFire {@link Region}s. Will try
|
||||
* to first locate the region (by name) and, in case none if found, proceed to
|
||||
* creating one using the given settings.
|
||||
*
|
||||
* Note that this factory bean allows for very flexible creation of GemFire
|
||||
* {@link Region}. For "client" regions however, see
|
||||
* {@link ClientRegionFactoryBean} which offers easier configuration and
|
||||
* defaults.
|
||||
* Abstract base class and Spring {@link FactoryBean} for constructing and initializing a GemFire {@link Region}.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author David Turanski
|
||||
* @author John Blum
|
||||
* @see org.springframework.beans.factory.DisposableBean
|
||||
* @see org.springframework.context.SmartLifecycle
|
||||
* @see org.springframework.data.gemfire.RegionLookupFactoryBean
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public abstract class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V> implements DisposableBean, SmartLifecycle {
|
||||
public abstract class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V>
|
||||
implements DisposableBean, SmartLifecycle {
|
||||
|
||||
protected final Log log = LogFactory.getLog(getClass());
|
||||
|
||||
@@ -69,9 +67,10 @@ public abstract class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K,
|
||||
private boolean destroy = false;
|
||||
private boolean running;
|
||||
|
||||
private Boolean enableGateway;
|
||||
private Boolean persistent;
|
||||
|
||||
private AsyncEventQueue[] asyncEventQueues;
|
||||
|
||||
private CacheListener<K, V>[] cacheListeners;
|
||||
|
||||
private CacheLoader<K, V> cacheLoader;
|
||||
@@ -80,8 +79,7 @@ public abstract class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K,
|
||||
|
||||
private DataPolicy dataPolicy;
|
||||
|
||||
private Object[] asyncEventQueues;
|
||||
private Object[] gatewaySenders;
|
||||
private GatewaySender[] gatewaySenders;
|
||||
|
||||
private RegionAttributes<K, V> attributes;
|
||||
|
||||
@@ -92,7 +90,6 @@ public abstract class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K,
|
||||
private Scope scope;
|
||||
|
||||
private String diskStoreName;
|
||||
private String hubId;
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
@@ -101,7 +98,7 @@ public abstract class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K,
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings("all")
|
||||
protected Region<K, V> lookupFallback(GemFireCache gemfireCache, String regionName) throws Exception {
|
||||
Assert.isTrue(gemfireCache instanceof Cache, String.format("Unable to create Regions from '%1$s'.",
|
||||
gemfireCache));
|
||||
@@ -110,38 +107,12 @@ public abstract class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K,
|
||||
|
||||
RegionFactory<K, V> regionFactory = createRegionFactory(cache);
|
||||
|
||||
if (hubId != null) {
|
||||
enableGateway = (enableGateway == null || enableGateway);
|
||||
Assert.isTrue(enableGateway, "The 'hubId' requires the 'enableGateway' property to be true.");
|
||||
regionFactory.setGatewayHubId(hubId);
|
||||
for (AsyncEventQueue asyncEventQueue : ArrayUtils.nullSafeArray(asyncEventQueues, AsyncEventQueue.class)) {
|
||||
regionFactory.addAsyncEventQueueId(asyncEventQueue.getId());
|
||||
}
|
||||
|
||||
if (enableGateway != null) {
|
||||
if (enableGateway) {
|
||||
Assert.notNull(hubId, "The 'enableGateway' property requires the 'hubId' property to be set.");
|
||||
}
|
||||
regionFactory.setEnableGateway(enableGateway);
|
||||
}
|
||||
|
||||
if (!ObjectUtils.isEmpty(gatewaySenders)) {
|
||||
Assert.isTrue(hubId == null, "It is invalid to configure a region with both a hubId and gatewaySenders."
|
||||
+ " Note that the enableGateway and hubId properties are deprecated since Gemfire 7.0");
|
||||
|
||||
for (Object gatewaySender : gatewaySenders) {
|
||||
regionFactory.addGatewaySenderId(((GatewaySender) gatewaySender).getId());
|
||||
}
|
||||
}
|
||||
|
||||
if (!ObjectUtils.isEmpty(asyncEventQueues)) {
|
||||
for (Object asyncEventQueue : asyncEventQueues) {
|
||||
regionFactory.addAsyncEventQueueId(((AsyncEventQueue) asyncEventQueue).getId());
|
||||
}
|
||||
}
|
||||
|
||||
if (!ObjectUtils.isEmpty(cacheListeners)) {
|
||||
for (CacheListener<K, V> listener : cacheListeners) {
|
||||
regionFactory.addCacheListener(listener);
|
||||
}
|
||||
for (CacheListener<K, V> listener : ArrayUtils.nullSafeArray(cacheListeners, CacheListener.class)) {
|
||||
regionFactory.addCacheListener(listener);
|
||||
}
|
||||
|
||||
if (cacheLoader != null) {
|
||||
@@ -152,6 +123,10 @@ public abstract class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K,
|
||||
regionFactory.setCacheWriter(cacheWriter);
|
||||
}
|
||||
|
||||
for (GatewaySender gatewaySender : ArrayUtils.nullSafeArray(gatewaySenders, GatewaySender.class)) {
|
||||
regionFactory.addGatewaySenderId(gatewaySender.getId());
|
||||
}
|
||||
|
||||
resolveDataPolicy(regionFactory, persistent, dataPolicy);
|
||||
|
||||
if (isDiskStoreConfigurationAllowed()) {
|
||||
@@ -206,8 +181,7 @@ public abstract class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K,
|
||||
*/
|
||||
protected RegionFactory<K, V> createRegionFactory(final Cache cache) {
|
||||
if (shortcut != null) {
|
||||
RegionFactory<K, V> regionFactory = mergeRegionAttributes(
|
||||
cache.<K, V>createRegionFactory(shortcut), attributes);
|
||||
RegionFactory<K, V> regionFactory = mergeRegionAttributes(cache.createRegionFactory(shortcut), attributes);
|
||||
setDataPolicy(getDataPolicy(regionFactory));
|
||||
return regionFactory;
|
||||
}
|
||||
@@ -266,7 +240,7 @@ public abstract class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K,
|
||||
* @see org.apache.geode.cache.RegionAttributes
|
||||
* @see org.apache.geode.cache.RegionFactory
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "deprecation", "unchecked" })
|
||||
protected <K, V> RegionFactory<K, V> mergeRegionAttributes(final RegionFactory<K, V> regionFactory,
|
||||
final RegionAttributes<K, V> regionAttributes) {
|
||||
|
||||
@@ -313,7 +287,7 @@ public abstract class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K,
|
||||
}
|
||||
|
||||
protected <K, V> void mergePartitionAttributes(final RegionFactory<K, V> regionFactory,
|
||||
final RegionAttributes<K, V> regionAttributes) {
|
||||
RegionAttributes<K, V> regionAttributes) {
|
||||
|
||||
// NOTE PartitionAttributes are created by certain RegionShortcuts; need the null check since RegionAttributes
|
||||
// can technically return null!
|
||||
@@ -545,7 +519,7 @@ public abstract class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K,
|
||||
*
|
||||
* @param asyncEventQueues defined as Object for backwards compatibility with Gemfire 6.
|
||||
*/
|
||||
public void setAsyncEventQueues(Object[] asyncEventQueues) {
|
||||
public void setAsyncEventQueues(AsyncEventQueue[] asyncEventQueues) {
|
||||
this.asyncEventQueues = asyncEventQueues;
|
||||
}
|
||||
|
||||
@@ -668,23 +642,15 @@ public abstract class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K,
|
||||
this.diskStoreName = diskStoreName;
|
||||
}
|
||||
|
||||
public void setEnableGateway(boolean enableGateway) {
|
||||
this.enableGateway = enableGateway;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param gatewaySenders defined as Object for backward compatibility with
|
||||
* Gemfire 6
|
||||
*/
|
||||
public void setGatewaySenders(Object[] gatewaySenders) {
|
||||
public void setGatewaySenders(GatewaySender[] gatewaySenders) {
|
||||
this.gatewaySenders = gatewaySenders;
|
||||
}
|
||||
|
||||
public void setHubId(String hubId) {
|
||||
this.hubId = hubId;
|
||||
}
|
||||
|
||||
public void setPersistent(Boolean persistent) {
|
||||
this.persistent = persistent;
|
||||
}
|
||||
@@ -728,16 +694,39 @@ public abstract class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K,
|
||||
this.snapshot = snapshot;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.context.Lifecycle#start()
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
@Override
|
||||
public boolean isAutoStartup() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
@Override
|
||||
public boolean isRunning() {
|
||||
return this.running;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
@Override
|
||||
public int getPhase() {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
@Override
|
||||
public void start() {
|
||||
if (!ObjectUtils.isEmpty(gatewaySenders)) {
|
||||
synchronized (gatewaySenders) {
|
||||
for (Object obj : gatewaySenders) {
|
||||
GatewaySender gatewaySender = (GatewaySender) obj;
|
||||
for (GatewaySender gatewaySender: gatewaySenders) {
|
||||
if (!(gatewaySender.isManualStart() || gatewaySender.isRunning())) {
|
||||
gatewaySender.start();
|
||||
}
|
||||
@@ -748,16 +737,15 @@ public abstract class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K,
|
||||
this.running = true;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.context.Lifecycle#stop()
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
@Override
|
||||
public void stop() {
|
||||
if (!ObjectUtils.isEmpty(gatewaySenders)) {
|
||||
synchronized (gatewaySenders) {
|
||||
for (Object gatewaySender : gatewaySenders) {
|
||||
((GatewaySender) gatewaySender).stop();
|
||||
for (GatewaySender gatewaySender : gatewaySenders) {
|
||||
gatewaySender.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -765,41 +753,12 @@ public abstract class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K,
|
||||
this.running = false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.context.Lifecycle#isRunning()
|
||||
*/
|
||||
@Override
|
||||
public boolean isRunning() {
|
||||
return this.running;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.context.Phased#getPhase()
|
||||
*/
|
||||
@Override
|
||||
public int getPhase() {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.context.SmartLifecycle#isAutoStartup()
|
||||
*/
|
||||
@Override
|
||||
public boolean isAutoStartup() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.context.SmartLifecycle#stop(java.lang.Runnable)
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
@Override
|
||||
public void stop(Runnable callback) {
|
||||
stop();
|
||||
callback.run();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Simple FactoryBean for retrieving generic GemFire {@link Region}s. If lookups are not enabled or the Region
|
||||
* does not exist, an exception is thrown. For declaring and configuring new Regions, see {@link RegionFactoryBean}.
|
||||
* Spring {@link FactoryBean} for looking up generic GemFire {@link Region Regions}. If lookups are not enabled
|
||||
* or the {@link Region} does not exist, an Exception is thrown.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author John Blum
|
||||
@@ -39,7 +39,8 @@ import org.springframework.util.StringUtils;
|
||||
* @see org.apache.geode.cache.Region
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public abstract class RegionLookupFactoryBean<K, V> implements FactoryBean<Region<K, V>>, InitializingBean, BeanNameAware {
|
||||
public abstract class RegionLookupFactoryBean<K, V>
|
||||
implements FactoryBean<Region<K, V>>, InitializingBean, BeanNameAware {
|
||||
|
||||
protected final Log log = LogFactory.getLog(getClass());
|
||||
|
||||
@@ -54,6 +55,7 @@ public abstract class RegionLookupFactoryBean<K, V> implements FactoryBean<Regio
|
||||
private String name;
|
||||
private String regionName;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(cache, "the 'cache' reference property must be set");
|
||||
|
||||
@@ -198,5 +200,4 @@ public abstract class RegionLookupFactoryBean<K, V> implements FactoryBean<Regio
|
||||
public Boolean getLookupEnabled() {
|
||||
return lookupEnabled;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -347,22 +347,24 @@ public class ClientCacheFactoryBean extends CacheFactoryBean implements Applicat
|
||||
try {
|
||||
((ClientCache) fetchCache()).readyForEvents();
|
||||
}
|
||||
catch (IllegalStateException ignore) {
|
||||
// thrown if clientCache.readyForEvents() is called on a non-durable client
|
||||
}
|
||||
catch (CacheClosedException ignore) {
|
||||
// cache is closed or was shutdown so ready-for-events is moot
|
||||
catch (IllegalStateException | CacheClosedException ignore) {
|
||||
// IllegalStateException thrown if clientCache.readyForEvents() is called on a non-durable client
|
||||
// CacheClosedException is throw when cache is closed or was shutdown so ready-for-events is moot
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
@Override
|
||||
protected void close(GemFireCache cache) {
|
||||
((ClientCache) cache).close(isKeepAlive());
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
@Override
|
||||
public Class<? extends GemFireCache> getObjectType() {
|
||||
ClientCache cache = getCache();
|
||||
@@ -430,13 +432,17 @@ public class ClientCacheFactoryBean extends CacheFactoryBean implements Applicat
|
||||
return durableClientTimeout;
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
@Override
|
||||
public final void setEnableAutoReconnect(final Boolean enableAutoReconnect) {
|
||||
throw new UnsupportedOperationException("Auto-reconnect does not apply to clients.");
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
@Override
|
||||
public final Boolean getEnableAutoReconnect() {
|
||||
return Boolean.FALSE;
|
||||
@@ -769,13 +775,17 @@ public class ClientCacheFactoryBean extends CacheFactoryBean implements Applicat
|
||||
return threadLocalConnections;
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
@Override
|
||||
public final void setUseClusterConfiguration(Boolean useClusterConfiguration) {
|
||||
throw new UnsupportedOperationException("Shared, cluster-based configuration is not applicable for clients.");
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
@Override
|
||||
public final Boolean getUseClusterConfiguration() {
|
||||
return Boolean.FALSE;
|
||||
|
||||
@@ -82,9 +82,9 @@ public @interface CacheServerApplication {
|
||||
/**
|
||||
* Configures the percentage of heap at or above which the cache is considered in danger of becoming inoperable.
|
||||
*
|
||||
* @see org.apache.geode.cache.control.ResourceManager#DEFAULT_CRITICAL_HEAP_PERCENTAGE
|
||||
* @see org.apache.geode.cache.control.ResourceManager#DEFAULT_CRITICAL_PERCENTAGE
|
||||
*/
|
||||
float criticalHeapPercentage() default ResourceManager.DEFAULT_CRITICAL_HEAP_PERCENTAGE;
|
||||
float criticalHeapPercentage() default ResourceManager.DEFAULT_CRITICAL_PERCENTAGE;
|
||||
|
||||
/**
|
||||
* By default, a GemFire member (both locators and servers) will attempt to reconnect and reinitialize the cache
|
||||
@@ -99,9 +99,9 @@ public @interface CacheServerApplication {
|
||||
* Configures the percentage of heap at or above which the eviction should begin on Regions configured
|
||||
* for HeapLRU eviction.
|
||||
*
|
||||
* @see org.apache.geode.cache.control.ResourceManager#DEFAULT_EVICTION_HEAP_PERCENTAGE
|
||||
* @see org.apache.geode.cache.control.ResourceManager#DEFAULT_EVICTION_PERCENTAGE
|
||||
*/
|
||||
float evictionHeapPercentage() default ResourceManager.DEFAULT_EVICTION_HEAP_PERCENTAGE;
|
||||
float evictionHeapPercentage() default ResourceManager.DEFAULT_EVICTION_PERCENTAGE;
|
||||
|
||||
/**
|
||||
* Configures the ip address or host name that server locators will tell clients that this cache server
|
||||
|
||||
@@ -63,9 +63,9 @@ public @interface ClientCacheApplication {
|
||||
/**
|
||||
* Configures the percentage of heap at or above which the cache is considered in danger of becoming inoperable.
|
||||
*
|
||||
* @see org.apache.geode.cache.control.ResourceManager#DEFAULT_CRITICAL_HEAP_PERCENTAGE
|
||||
* @see org.apache.geode.cache.control.ResourceManager#DEFAULT_CRITICAL_PERCENTAGE
|
||||
*/
|
||||
float criticalHeapPercentage() default ResourceManager.DEFAULT_CRITICAL_HEAP_PERCENTAGE;
|
||||
float criticalHeapPercentage() default ResourceManager.DEFAULT_CRITICAL_PERCENTAGE;
|
||||
|
||||
/**
|
||||
* Used only for clients in a client/server installation. If set, this indicates that the client is durable
|
||||
@@ -84,9 +84,9 @@ public @interface ClientCacheApplication {
|
||||
* Configures the percentage of heap at or above which the eviction should begin on Regions configured
|
||||
* for HeapLRU eviction.
|
||||
*
|
||||
* @see org.apache.geode.cache.control.ResourceManager#DEFAULT_EVICTION_HEAP_PERCENTAGE
|
||||
* @see org.apache.geode.cache.control.ResourceManager#DEFAULT_EVICTION_PERCENTAGE
|
||||
*/
|
||||
float evictionHeapPercentage() default ResourceManager.DEFAULT_EVICTION_HEAP_PERCENTAGE;
|
||||
float evictionHeapPercentage() default ResourceManager.DEFAULT_EVICTION_PERCENTAGE;
|
||||
|
||||
/**
|
||||
* Configures the free connection timeout for this pool.
|
||||
|
||||
@@ -60,9 +60,9 @@ public @interface PeerCacheApplication {
|
||||
/**
|
||||
* Configures the percentage of heap at or above which the cache is considered in danger of becoming inoperable.
|
||||
*
|
||||
* @see org.apache.geode.cache.control.ResourceManager#DEFAULT_CRITICAL_HEAP_PERCENTAGE
|
||||
* @see org.apache.geode.cache.control.ResourceManager#DEFAULT_CRITICAL_PERCENTAGE
|
||||
*/
|
||||
float criticalHeapPercentage() default ResourceManager.DEFAULT_CRITICAL_HEAP_PERCENTAGE;
|
||||
float criticalHeapPercentage() default ResourceManager.DEFAULT_CRITICAL_PERCENTAGE;
|
||||
|
||||
/**
|
||||
* By default, a GemFire member (both locators and servers) will attempt to reconnect and reinitialize the cache
|
||||
@@ -77,9 +77,9 @@ public @interface PeerCacheApplication {
|
||||
* Configures the percentage of heap at or above which the eviction should begin on Regions configured
|
||||
* for HeapLRU eviction.
|
||||
*
|
||||
* @see org.apache.geode.cache.control.ResourceManager#DEFAULT_EVICTION_HEAP_PERCENTAGE
|
||||
* @see org.apache.geode.cache.control.ResourceManager#DEFAULT_EVICTION_PERCENTAGE
|
||||
*/
|
||||
float evictionHeapPercentage() default ResourceManager.DEFAULT_EVICTION_HEAP_PERCENTAGE;
|
||||
float evictionHeapPercentage() default ResourceManager.DEFAULT_EVICTION_PERCENTAGE;
|
||||
|
||||
/**
|
||||
* Configures the list of GemFire Locators defining the cluster to which this GemFire cache data node
|
||||
|
||||
@@ -45,8 +45,6 @@ import org.springframework.data.gemfire.support.AbstractPropertyEditorConverterS
|
||||
import org.springframework.data.gemfire.support.ConnectionEndpoint;
|
||||
import org.springframework.data.gemfire.support.ConnectionEndpointList;
|
||||
import org.springframework.data.gemfire.wan.OrderPolicyConverter;
|
||||
import org.springframework.data.gemfire.wan.StartupPolicyConverter;
|
||||
import org.springframework.data.gemfire.wan.StartupPolicyType;
|
||||
|
||||
/**
|
||||
* {@link CustomEditorBeanFactoryPostProcessor} is a Spring {@link BeanFactoryPostProcessor} implementation
|
||||
@@ -78,7 +76,6 @@ public class CustomEditorBeanFactoryPostProcessor implements BeanFactoryPostProc
|
||||
beanFactory.registerCustomEditor(InterestResultPolicy.class, InterestResultPolicyConverter.class);
|
||||
beanFactory.registerCustomEditor(Gateway.OrderPolicy.class, OrderPolicyConverter.class);
|
||||
beanFactory.registerCustomEditor(Scope.class, ScopeConverter.class);
|
||||
beanFactory.registerCustomEditor(StartupPolicyType.class, StartupPolicyConverter.class);
|
||||
beanFactory.registerCustomEditor(SubscriptionEvictionPolicy.class, SubscriptionEvictionPolicyConverter.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,156 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2013 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.xml;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.ManagedList;
|
||||
import org.springframework.beans.factory.xml.AbstractSimpleBeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.data.gemfire.wan.GatewayHubFactoryBean;
|
||||
import org.springframework.data.gemfire.wan.GatewayProxy;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.xml.DomUtils;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Bean definition parser for the <gfe:gateway-hub> SDG XML namespace (XSD) element.
|
||||
*
|
||||
* @author David Turanski
|
||||
* @author John Blum
|
||||
* @see org.springframework.beans.factory.xml.AbstractSimpleBeanDefinitionParser
|
||||
* @see org.springframework.data.gemfire.wan.GatewayHubFactoryBean
|
||||
* @see org.springframework.data.gemfire.wan.GatewayProxy
|
||||
*/
|
||||
class GatewayHubParser extends AbstractSimpleBeanDefinitionParser {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected Class<?> getBeanClass(Element element) {
|
||||
return GatewayHubFactoryBean.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
|
||||
builder.addConstructorArgReference(ParsingUtils.resolveCacheReference(element.getAttribute("cache-ref")));
|
||||
builder.setLazyInit(false);
|
||||
|
||||
ParsingUtils.setPropertyValue(element, builder, "bind-address");
|
||||
ParsingUtils.setPropertyValue(element, builder, "manual-start");
|
||||
ParsingUtils.setPropertyValue(element, builder, "max-connections");
|
||||
ParsingUtils.setPropertyValue(element, builder, "max-time-between-pings", "maximumTimeBetweenPings");
|
||||
ParsingUtils.setPropertyValue(element, builder, "port");
|
||||
ParsingUtils.setPropertyValue(element, builder, "socket-buffer-size");
|
||||
ParsingUtils.setPropertyValue(element, builder, "startup-policy");
|
||||
|
||||
parseGateways(element, parserContext, builder);
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
private void parseGateways(Element element, ParserContext parserContext, BeanDefinitionBuilder gatewayHubBuilder) {
|
||||
List<Element> gatewayElements = DomUtils.getChildElementsByTagName(element, "gateway");
|
||||
|
||||
if (!CollectionUtils.isEmpty(gatewayElements)) {
|
||||
ManagedList<BeanDefinition> gateways = new ManagedList<BeanDefinition>();
|
||||
|
||||
for (Element gatewayElement : gatewayElements) {
|
||||
BeanDefinitionBuilder gatewayBuilder = BeanDefinitionBuilder.genericBeanDefinition(GatewayProxy.class);
|
||||
|
||||
ParsingUtils.setPropertyValue(gatewayElement, gatewayBuilder, "gateway-id", "id");
|
||||
ParsingUtils.setPropertyValue(gatewayElement, gatewayBuilder, "concurrency-level");
|
||||
ParsingUtils.setPropertyValue(gatewayElement, gatewayBuilder, "order-policy");
|
||||
ParsingUtils.setPropertyValue(gatewayElement, gatewayBuilder, "socket-buffer-size");
|
||||
ParsingUtils.setPropertyValue(gatewayElement, gatewayBuilder, "socket-read-timeout");
|
||||
|
||||
parseGatewayEndpoints(gatewayElement, gatewayBuilder);
|
||||
parseGatewayListeners(gatewayElement, parserContext, gatewayBuilder);
|
||||
parseGatewayQueue(gatewayElement, gatewayBuilder);
|
||||
|
||||
gateways.add(gatewayBuilder.getBeanDefinition());
|
||||
}
|
||||
|
||||
gatewayHubBuilder.addPropertyValue("gateways", gateways);
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
private void parseGatewayEndpoints(Element gatewayElement, BeanDefinitionBuilder gatewayBuilder) {
|
||||
List<Element> endpointElements = DomUtils.getChildElementsByTagName(gatewayElement, "gateway-endpoint");
|
||||
|
||||
if (!CollectionUtils.isEmpty(endpointElements)) {
|
||||
ManagedList<BeanDefinition> endpoints = new ManagedList<BeanDefinition>();
|
||||
|
||||
for (Element endpointElement : endpointElements) {
|
||||
BeanDefinitionBuilder endpointBuilder = BeanDefinitionBuilder.genericBeanDefinition(
|
||||
GatewayProxy.GatewayEndpoint.class);
|
||||
|
||||
ParsingUtils.setPropertyValue(endpointElement, endpointBuilder, "endpoint-id", "id");
|
||||
ParsingUtils.setPropertyValue(endpointElement, endpointBuilder, "host");
|
||||
ParsingUtils.setPropertyValue(endpointElement, endpointBuilder, "port");
|
||||
|
||||
endpoints.add(endpointBuilder.getBeanDefinition());
|
||||
}
|
||||
|
||||
gatewayBuilder.addPropertyValue("endpoints", endpoints);
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
private void parseGatewayListeners(Element gatewayElement, ParserContext parserContext,
|
||||
BeanDefinitionBuilder gatewayBuilder) {
|
||||
|
||||
Element gatewayListenerElement = DomUtils.getChildElementByTagName(gatewayElement, "gateway-listener");
|
||||
|
||||
if (gatewayListenerElement != null) {
|
||||
gatewayBuilder.addPropertyValue("listeners", ParsingUtils.parseRefOrNestedBeanDeclaration(
|
||||
parserContext, gatewayListenerElement, gatewayBuilder));
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
private void parseGatewayQueue(Element gatewayElement, BeanDefinitionBuilder gatewayBuilder) {
|
||||
Element gatewayQueueElement = DomUtils.getChildElementByTagName(gatewayElement, "gateway-queue");
|
||||
|
||||
if (gatewayQueueElement != null) {
|
||||
BeanDefinitionBuilder queueBuilder = BeanDefinitionBuilder.genericBeanDefinition(
|
||||
GatewayProxy.GatewayQueue.class);
|
||||
|
||||
ParsingUtils.setPropertyValue(gatewayQueueElement, queueBuilder, "alert-threshold");
|
||||
ParsingUtils.setPropertyValue(gatewayQueueElement, queueBuilder, "batch-size");
|
||||
ParsingUtils.setPropertyValue(gatewayQueueElement, queueBuilder, "batch-time-interval");
|
||||
ParsingUtils.setPropertyValue(gatewayQueueElement, queueBuilder, "disk-store-ref");
|
||||
ParsingUtils.setPropertyValue(gatewayQueueElement, queueBuilder, "enable-batch-conflation");
|
||||
ParsingUtils.setPropertyValue(gatewayQueueElement, queueBuilder, "maximum-queue-memory");
|
||||
ParsingUtils.setPropertyValue(gatewayQueueElement, queueBuilder, "persistent");
|
||||
|
||||
/* Make sure any disk store is created first */
|
||||
if (gatewayQueueElement.hasAttribute("disk-store-ref")) {
|
||||
gatewayBuilder.addDependsOn(gatewayQueueElement.getAttribute("disk-store-ref"));
|
||||
}
|
||||
|
||||
gatewayBuilder.addPropertyValue("queue", queueBuilder.getBeanDefinition());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,6 @@ class GemfireNamespaceHandler extends NamespaceHandlerSupport {
|
||||
registerBeanDefinitionParser("cq-listener-container", new GemfireListenerContainerParser());
|
||||
registerBeanDefinitionParser("disk-store", new DiskStoreParser());
|
||||
registerBeanDefinitionParser("function-service", new FunctionServiceParser());
|
||||
registerBeanDefinitionParser("gateway-hub", new GatewayHubParser());
|
||||
registerBeanDefinitionParser("gateway-receiver", new GatewayReceiverParser());
|
||||
registerBeanDefinitionParser("gateway-sender", new GatewaySenderParser());
|
||||
registerBeanDefinitionParser("index", new IndexParser());
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.apache.geode.cache.CacheClosedException;
|
||||
import org.apache.geode.cache.asyncqueue.AsyncEventListener;
|
||||
import org.apache.geode.cache.asyncqueue.AsyncEventQueue;
|
||||
import org.apache.geode.cache.asyncqueue.AsyncEventQueueFactory;
|
||||
import org.apache.geode.cache.util.Gateway;
|
||||
import org.apache.geode.cache.wan.GatewaySender;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -123,7 +123,7 @@ public class AsyncEventQueueFactoryBean extends AbstractWANComponentFactoryBean<
|
||||
Assert.isTrue(VALID_ORDER_POLICIES.contains(orderPolicy.toUpperCase()), String.format(
|
||||
"The value of Order Policy '$1%s' is invalid.", orderPolicy));
|
||||
|
||||
asyncEventQueueFactory.setOrderPolicy(Gateway.OrderPolicy.valueOf(orderPolicy.toUpperCase()));
|
||||
asyncEventQueueFactory.setOrderPolicy(GatewaySender.OrderPolicy.valueOf(orderPolicy.toUpperCase()));
|
||||
}
|
||||
|
||||
if (persistent != null) {
|
||||
|
||||
@@ -1,221 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2013 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.wan;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.geode.cache.Cache;
|
||||
import org.apache.geode.cache.util.Gateway;
|
||||
import org.apache.geode.cache.util.GatewayEventListener;
|
||||
import org.apache.geode.cache.util.GatewayHub;
|
||||
import org.apache.geode.cache.util.GatewayQueueAttributes;
|
||||
import org.springframework.data.gemfire.wan.GatewayProxy.GatewayQueue;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* FactoryBean for creating a GemFire {@link GatewayHub} (deprecated in Gemfire 7).
|
||||
*
|
||||
* @author David Turanski
|
||||
* @author John Blum
|
||||
* @see org.springframework.data.gemfire.wan.AbstractWANComponentFactoryBean
|
||||
* @see org.apache.geode.cache.Cache
|
||||
* @see org.apache.geode.cache.util.Gateway
|
||||
* @see org.apache.geode.cache.util.GatewayHub
|
||||
* @see org.apache.geode.cache.util.GatewayEventListener
|
||||
* @see org.apache.geode.cache.util.GatewayQueueAttributes
|
||||
*/
|
||||
@SuppressWarnings({"deprecation", "unused" })
|
||||
public class GatewayHubFactoryBean extends AbstractWANComponentFactoryBean<GatewayHub> {
|
||||
|
||||
private Boolean manualStart;
|
||||
|
||||
private GatewayHub gatewayHub;
|
||||
|
||||
private Integer maxConnections;
|
||||
private Integer maximumTimeBetweenPings;
|
||||
private Integer port;
|
||||
private Integer socketBufferSize;
|
||||
|
||||
private List<GatewayProxy> gateways;
|
||||
|
||||
private StartupPolicyType startupPolicy;
|
||||
|
||||
private String bindAddress;
|
||||
|
||||
/**
|
||||
* Constructs an instance of the GatewayHubFactoryBean class used to create GemFire WAN GatewayHubs initialized
|
||||
* with the specified GemFire Cache.
|
||||
*
|
||||
* @param cache a reference to the Gemfire Cache.
|
||||
* @see org.apache.geode.cache.Cache
|
||||
*/
|
||||
public GatewayHubFactoryBean(final Cache cache) {
|
||||
super(cache);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GatewayHub getObject() throws Exception {
|
||||
return gatewayHub;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getObjectType() {
|
||||
return (gatewayHub != null ? gatewayHub.getClass() : GatewayHub.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doInit() {
|
||||
gatewayHub = cache.addGatewayHub(getName(), getPort());
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(String.format("Adding GemFire GatewayHub (%1$s)", getName()));
|
||||
}
|
||||
|
||||
Assert.notNull(cache.getGatewayHub(getName()));
|
||||
|
||||
gatewayHub.setBindAddress(getBindAddress());
|
||||
gatewayHub.setManualStart(isManualStart(GatewayHub.DEFAULT_MANUAL_START));
|
||||
gatewayHub.setMaxConnections(getMaxConnections());
|
||||
gatewayHub.setMaximumTimeBetweenPings(getMaximumTimeBetweenPings());
|
||||
gatewayHub.setSocketBufferSize(getSocketBufferSize());
|
||||
gatewayHub.setStartupPolicy(getStartupPolicy().getName());
|
||||
|
||||
configureGateways();
|
||||
autoStart();
|
||||
}
|
||||
|
||||
private void configureGateways() {
|
||||
for (GatewayProxy gatewayProxy : getGateways()) {
|
||||
Gateway gateway = gatewayHub.addGateway(gatewayProxy.getId(), gatewayProxy.getConcurrencyLevel());
|
||||
|
||||
for (GatewayProxy.GatewayEndpoint endpoint : gatewayProxy.getEndpoints()) {
|
||||
gateway.addEndpoint(endpoint.getId(), endpoint.getHost(), endpoint.getPort());
|
||||
}
|
||||
|
||||
for (GatewayEventListener listener : gatewayProxy.getListeners()) {
|
||||
gateway.addListener(listener);
|
||||
}
|
||||
|
||||
gateway.setOrderPolicy(gatewayProxy.getOrderPolicy());
|
||||
gateway.setSocketBufferSize(gatewayProxy.getSocketBufferSize());
|
||||
gateway.setSocketReadTimeout(gatewayProxy.getSocketReadTimeout());
|
||||
|
||||
if (gatewayProxy.getQueue() != null) {
|
||||
GatewayQueue queue = gatewayProxy.getQueue();
|
||||
GatewayQueueAttributes queueAttributes = gateway.getQueueAttributes();
|
||||
|
||||
queueAttributes.setAlertThreshold(queue.getAlertThreshold());
|
||||
queueAttributes.setBatchConflation(queue.getEnableBatchConflation());
|
||||
queueAttributes.setBatchSize(queue.getBatchSize());
|
||||
queueAttributes.setBatchTimeInterval(queue.getBatchTimeInterval());
|
||||
queueAttributes.setMaximumQueueMemory(queue.getMaximumQueueMemory());
|
||||
queueAttributes.setEnablePersistence(queue.getPersistent());
|
||||
|
||||
if (queue.getDiskStoreRef() != null) {
|
||||
queueAttributes.setDiskStoreName(queue.getDiskStoreRef());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void autoStart() {
|
||||
if (!gatewayHub.getManualStart()) {
|
||||
try {
|
||||
gatewayHub.start();
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setBindAddress(String bindAddress) {
|
||||
this.bindAddress = bindAddress;
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
String getBindAddress() {
|
||||
return (StringUtils.hasText(bindAddress) ? bindAddress : GatewayHub.DEFAULT_BIND_ADDRESS);
|
||||
}
|
||||
|
||||
public void setGateways(List<GatewayProxy> gateways) {
|
||||
this.gateways = gateways;
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
List<GatewayProxy> getGateways() {
|
||||
return (gateways != null ? gateways : Collections.<GatewayProxy>emptyList());
|
||||
}
|
||||
|
||||
public void setManualStart(Boolean manualStart) {
|
||||
this.manualStart = manualStart;
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
boolean isManualStart(final boolean defaultManualStart) {
|
||||
return (manualStart != null ? manualStart : defaultManualStart);
|
||||
}
|
||||
|
||||
public void setMaxConnections(Integer maxConnections) {
|
||||
this.maxConnections = maxConnections;
|
||||
}
|
||||
|
||||
// (non-Javadoc)
|
||||
Integer getMaxConnections() {
|
||||
return (maxConnections != null ? maxConnections : GatewayHub.DEFAULT_MAX_CONNECTIONS);
|
||||
}
|
||||
|
||||
public void setMaximumTimeBetweenPings(Integer maximumTimeBetweenPings) {
|
||||
this.maximumTimeBetweenPings = maximumTimeBetweenPings;
|
||||
}
|
||||
|
||||
// (non-Javadoc)
|
||||
Integer getMaximumTimeBetweenPings() {
|
||||
return (maximumTimeBetweenPings != null ? maximumTimeBetweenPings
|
||||
: GatewayHub.DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS);
|
||||
}
|
||||
|
||||
public void setPort(Integer port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
Integer getPort() {
|
||||
return (port != null ? port : GatewayHub.DEFAULT_PORT);
|
||||
}
|
||||
|
||||
public void setSocketBufferSize(Integer socketBufferSize) {
|
||||
this.socketBufferSize = socketBufferSize;
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
Integer getSocketBufferSize() {
|
||||
return (socketBufferSize != null ? socketBufferSize : GatewayHub.DEFAULT_SOCKET_BUFFER_SIZE);
|
||||
}
|
||||
|
||||
public void setStartupPolicy(StartupPolicyType startupPolicy) {
|
||||
this.startupPolicy = startupPolicy;
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
StartupPolicyType getStartupPolicy() {
|
||||
return (startupPolicy != null ? startupPolicy : StartupPolicyType.DEFAULT);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,215 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2013 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.wan;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.geode.cache.util.Gateway;
|
||||
import org.apache.geode.cache.util.GatewayEventListener;
|
||||
import org.apache.geode.cache.util.GatewayQueueAttributes;
|
||||
|
||||
/**
|
||||
* The GatewayProxy class used to allow decoupling of 'gateway' parsing from 'gateway-hub' parsing.
|
||||
*
|
||||
* @author David Turanski
|
||||
* @author John Blum
|
||||
* @since org.apache.geode.cache.util.Gateway
|
||||
*/
|
||||
@SuppressWarnings({ "deprecation", "unused" })
|
||||
public class GatewayProxy {
|
||||
|
||||
private Gateway.OrderPolicy orderPolicy;
|
||||
|
||||
private GatewayQueue queue;
|
||||
|
||||
private Integer concurrencyLevel = Gateway.DEFAULT_CONCURRENCY_LEVEL;
|
||||
private Integer socketBufferSize = Gateway.DEFAULT_SOCKET_BUFFER_SIZE;
|
||||
private Integer socketReadTimeout = Gateway.DEFAULT_SOCKET_READ_TIMEOUT;
|
||||
|
||||
private List<GatewayEndpoint> endpoints;
|
||||
private List<GatewayEventListener> listeners;
|
||||
|
||||
private String id;
|
||||
|
||||
public void setConcurrencyLevel(Integer concurrencyLevel) {
|
||||
this.concurrencyLevel = concurrencyLevel;
|
||||
}
|
||||
|
||||
public Integer getConcurrencyLevel() {
|
||||
return (concurrencyLevel != null ? concurrencyLevel : Gateway.DEFAULT_CONCURRENCY_LEVEL);
|
||||
}
|
||||
|
||||
public void setEndpoints(List<GatewayEndpoint> endpoints) {
|
||||
this.endpoints = endpoints;
|
||||
}
|
||||
|
||||
public List<GatewayEndpoint> getEndpoints() {
|
||||
return (endpoints != null ? endpoints : Collections.<GatewayEndpoint>emptyList());
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setListeners(List<GatewayEventListener> listeners) {
|
||||
this.listeners = listeners;
|
||||
}
|
||||
|
||||
public List<GatewayEventListener> getListeners() {
|
||||
return (listeners != null ? listeners : Collections.<GatewayEventListener>emptyList());
|
||||
}
|
||||
|
||||
public void setOrderPolicy(Gateway.OrderPolicy orderPolicy) {
|
||||
this.orderPolicy = orderPolicy;
|
||||
}
|
||||
|
||||
public Gateway.OrderPolicy getOrderPolicy() {
|
||||
return this.orderPolicy;
|
||||
}
|
||||
|
||||
public void setQueue(GatewayQueue queue) {
|
||||
this.queue = queue;
|
||||
}
|
||||
|
||||
public GatewayQueue getQueue() {
|
||||
return this.queue;
|
||||
}
|
||||
|
||||
public void setSocketBufferSize(int socketBufferSize) {
|
||||
this.socketBufferSize = socketBufferSize;
|
||||
}
|
||||
|
||||
public Integer getSocketBufferSize() {
|
||||
return (socketBufferSize != null ? socketBufferSize : Gateway.DEFAULT_SOCKET_BUFFER_SIZE);
|
||||
}
|
||||
|
||||
public void setSocketReadTimeout(final Integer socketReadTimeout) {
|
||||
this.socketReadTimeout = socketReadTimeout;
|
||||
}
|
||||
|
||||
public Integer getSocketReadTimeout() {
|
||||
return (socketReadTimeout != null ? socketReadTimeout : Gateway.DEFAULT_SOCKET_READ_TIMEOUT);
|
||||
}
|
||||
|
||||
public static class GatewayEndpoint {
|
||||
|
||||
private int port;
|
||||
|
||||
private String host;
|
||||
private String id;
|
||||
|
||||
public String getHost() {
|
||||
return host;
|
||||
}
|
||||
|
||||
public void setHost(String host) {
|
||||
this.host = host;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public void setPort(int port) {
|
||||
this.port = port;
|
||||
}
|
||||
}
|
||||
|
||||
public static class GatewayQueue {
|
||||
|
||||
private Boolean enableBatchConflation;
|
||||
private Boolean persistent;
|
||||
|
||||
private Integer alertThreshold;
|
||||
private Integer batchSize;
|
||||
private Integer batchTimeInterval;
|
||||
private Integer maximumQueueMemory;
|
||||
|
||||
private String diskStoreRef;
|
||||
|
||||
public void setAlertThreshold(Integer alertThreshold) {
|
||||
this.alertThreshold = alertThreshold;
|
||||
}
|
||||
|
||||
public Integer getAlertThreshold() {
|
||||
return (alertThreshold != null ? alertThreshold : GatewayQueueAttributes.DEFAULT_ALERT_THRESHOLD);
|
||||
}
|
||||
|
||||
public void setBatchSize(Integer batchSize) {
|
||||
this.batchSize = batchSize;
|
||||
}
|
||||
|
||||
public Integer getBatchSize() {
|
||||
return (batchSize != null ? batchSize : GatewayQueueAttributes.DEFAULT_BATCH_SIZE);
|
||||
}
|
||||
|
||||
public void setBatchTimeInterval(Integer batchTimeInterval) {
|
||||
this.batchTimeInterval = batchTimeInterval;
|
||||
}
|
||||
|
||||
public Integer getBatchTimeInterval() {
|
||||
return (batchTimeInterval != null ? batchTimeInterval : GatewayQueueAttributes.DEFAULT_BATCH_TIME_INTERVAL);
|
||||
}
|
||||
|
||||
public void setDiskStoreRef(String diskStoreRef) {
|
||||
this.diskStoreRef = diskStoreRef;
|
||||
}
|
||||
|
||||
public String getDiskStoreRef() {
|
||||
return diskStoreRef;
|
||||
}
|
||||
|
||||
public void setEnableBatchConflation(Boolean enableBatchConflation) {
|
||||
this.enableBatchConflation = enableBatchConflation;
|
||||
}
|
||||
|
||||
public Boolean getEnableBatchConflation() {
|
||||
return (enableBatchConflation != null ? enableBatchConflation
|
||||
: GatewayQueueAttributes.DEFAULT_BATCH_CONFLATION);
|
||||
}
|
||||
|
||||
public void setMaximumQueueMemory(Integer maximumQueueMemory) {
|
||||
this.maximumQueueMemory = maximumQueueMemory;
|
||||
}
|
||||
|
||||
public Integer getMaximumQueueMemory() {
|
||||
return (maximumQueueMemory != null ? maximumQueueMemory
|
||||
: GatewayQueueAttributes.DEFAULT_MAXIMUM_QUEUE_MEMORY);
|
||||
}
|
||||
|
||||
public void setPersistent(Boolean persistent) {
|
||||
this.persistent = persistent;
|
||||
}
|
||||
|
||||
public Boolean getPersistent() {
|
||||
return (persistent != null ? persistent : GatewayQueueAttributes.DEFAULT_ENABLE_PERSISTENCE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,7 +18,6 @@ package org.springframework.data.gemfire.wan;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.geode.cache.Cache;
|
||||
import org.apache.geode.cache.util.Gateway;
|
||||
import org.apache.geode.cache.wan.GatewayEventFilter;
|
||||
import org.apache.geode.cache.wan.GatewayEventSubstitutionFilter;
|
||||
import org.apache.geode.cache.wan.GatewaySender;
|
||||
@@ -148,7 +147,7 @@ public class GatewaySenderFactoryBean extends AbstractWANComponentFactoryBean<Ga
|
||||
Assert.isTrue(VALID_ORDER_POLICIES.contains(orderPolicy.toUpperCase()),
|
||||
String.format("The value for Order Policy '%1$s' is invalid.", orderPolicy));
|
||||
|
||||
gatewaySenderFactory.setOrderPolicy(Gateway.OrderPolicy.valueOf(orderPolicy.toUpperCase()));
|
||||
gatewaySenderFactory.setOrderPolicy(GatewaySender.OrderPolicy.valueOf(orderPolicy.toUpperCase()));
|
||||
}
|
||||
|
||||
gatewaySenderFactory.setParallel(isParallelGatewaySender());
|
||||
@@ -327,5 +326,4 @@ public class GatewaySenderFactoryBean extends AbstractWANComponentFactoryBean<Ga
|
||||
stop();
|
||||
callback.run();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ package org.springframework.data.gemfire.wan;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.geode.cache.util.Gateway;
|
||||
import org.apache.geode.cache.wan.GatewayEventFilter;
|
||||
import org.apache.geode.cache.wan.GatewayEventSubstitutionFilter;
|
||||
import org.apache.geode.cache.wan.GatewaySender;
|
||||
@@ -175,7 +174,7 @@ public class GatewaySenderWrapper implements GatewaySender {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public Gateway.OrderPolicy getOrderPolicy() {
|
||||
public GatewaySender.OrderPolicy getOrderPolicy() {
|
||||
return delegate.getOrderPolicy();
|
||||
}
|
||||
|
||||
@@ -192,5 +191,4 @@ public class GatewaySenderWrapper implements GatewaySender {
|
||||
public String toString() {
|
||||
return this.delegate.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2013 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.wan;
|
||||
|
||||
import org.springframework.data.gemfire.support.AbstractPropertyEditorConverterSupport;
|
||||
|
||||
/**
|
||||
* The StartupPolicyConverter class is a Spring Converter and JavaBeans PropertyEditor responsible for
|
||||
* converting String values into appropriate StartupPolicyType enumerated values.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.springframework.data.gemfire.support.AbstractPropertyEditorConverterSupport
|
||||
* @see org.springframework.data.gemfire.wan.StartupPolicyType
|
||||
* @since 1.7.0
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class StartupPolicyConverter extends AbstractPropertyEditorConverterSupport<StartupPolicyType> {
|
||||
|
||||
/**
|
||||
* Converts the given String value into an appropriate StartupPolicyType enumerated value.
|
||||
*
|
||||
* @param source the String to convert.
|
||||
* @return a StartupPolicyType enumerated value for the given String.
|
||||
* @throws java.lang.IllegalArgumentException if the String is not a valid GatewayHub Startup Policy.
|
||||
* @see StartupPolicyType#valueOfIgnoreCase(String)
|
||||
* @see #assertConverted(String, Object, Class)
|
||||
*/
|
||||
@Override
|
||||
public StartupPolicyType convert(final String source) {
|
||||
return assertConverted(source, StartupPolicyType.valueOfIgnoreCase(source),
|
||||
StartupPolicyType.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2013 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.wan;
|
||||
|
||||
import org.apache.geode.cache.util.GatewayHub;
|
||||
|
||||
/**
|
||||
* The StartupPolicyType class is an enumeration of GemFire GatewayHub Startup Policies.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.apache.geode.cache.util.GatewayHub
|
||||
* @since 1.7.0
|
||||
*/
|
||||
@SuppressWarnings({"deprecation", "unused" })
|
||||
public enum StartupPolicyType {
|
||||
NONE(GatewayHub.STARTUP_POLICY_NONE),
|
||||
PRIMARY(GatewayHub.STARTUP_POLICY_PRIMARY),
|
||||
SECONDARY(GatewayHub.STARTUP_POLICY_SECONDARY);
|
||||
|
||||
public static final StartupPolicyType DEFAULT = StartupPolicyType.valueOfIgnoreCase(
|
||||
GatewayHub.DEFAULT_STARTUP_POLICY);
|
||||
|
||||
private final String name;
|
||||
|
||||
/**
|
||||
* Constructs an instance of the StartupPolicyType enum initialized with the given GemFire "named",
|
||||
* GatewayHub Startup Policy.
|
||||
*
|
||||
* @param name a String specifying the name used by GemFire for the GatewayHub Startup Policy.
|
||||
*/
|
||||
StartupPolicyType(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a StartupPolicyType enumerated value matching the given official, case-insensitve "name"
|
||||
* for the GatewayHub Startup Policy used by GemFire.
|
||||
*
|
||||
* @param name a String specifying the name used by GemFire for the GatewayHub Startup Policy.
|
||||
* @return a StartupPolicyType enumerated value matching the given name used by GemFire to specify
|
||||
* the GatewayHub Startup Policy.
|
||||
* @see java.lang.String#equalsIgnoreCase(String)
|
||||
* @see #getName()
|
||||
*/
|
||||
public static StartupPolicyType valueOfIgnoreCase(final String name) {
|
||||
for (StartupPolicyType startupPolicyType : values()) {
|
||||
if (startupPolicyType.getName().equalsIgnoreCase(name)) {
|
||||
return startupPolicyType;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the official name used by GemFire to specify the GatewayHub Startup Policy.
|
||||
*
|
||||
* @return the official GatewayHub Startup Policy name used by GemFire.
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user