SGF-564 - Reorganize the SDG API into logical packages based on functional concern.

This commit is contained in:
John Blum
2016-11-10 23:51:10 -08:00
parent d3041d05a4
commit 623282faef
84 changed files with 372 additions and 667 deletions

View File

@@ -15,13 +15,12 @@
*/
package org.springframework.data.gemfire;
import org.springframework.data.gemfire.support.RegionShortcutWrapper;
import org.springframework.util.Assert;
import com.gemstone.gemfire.cache.DataPolicy;
import com.gemstone.gemfire.cache.RegionFactory;
import com.gemstone.gemfire.cache.Scope;
import org.springframework.util.Assert;
/**
* @author David Turanski
* @author John Blum

View File

@@ -18,17 +18,6 @@ package org.springframework.data.gemfire;
import java.lang.reflect.Field;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.context.SmartLifecycle;
import org.springframework.core.io.Resource;
import org.springframework.data.gemfire.client.ClientRegionFactoryBean;
import org.springframework.data.gemfire.support.RegionShortcutWrapper;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import org.springframework.util.ReflectionUtils;
import com.gemstone.gemfire.cache.AttributesFactory;
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CacheListener;
@@ -48,6 +37,16 @@ import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue;
import com.gemstone.gemfire.cache.wan.GatewaySender;
import com.gemstone.gemfire.internal.cache.UserSpecifiedRegionAttributes;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.context.SmartLifecycle;
import org.springframework.core.io.Resource;
import org.springframework.data.gemfire.client.ClientRegionFactoryBean;
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

View File

@@ -14,12 +14,12 @@
* limitations under the License.
*/
package org.springframework.data.gemfire.support;
import org.springframework.util.ObjectUtils;
package org.springframework.data.gemfire;
import com.gemstone.gemfire.cache.RegionShortcut;
import org.springframework.util.ObjectUtils;
/**
* The RegionShortcutWrapper enum is a Java enumerated type that wraps GemFire's RegionShortcuts
* with Spring Data GemFire RegionShortcutWrapper enumerated values.

View File

@@ -1,176 +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;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.BeanInitializationException;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import com.gemstone.gemfire.cache.CacheListener;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue;
import com.gemstone.gemfire.cache.wan.GatewaySender;
/**
* FactoryBean for creating a Gemfire sub-Regions.
*
* @author David Turanski
* @author John Blum
* @param <K> Region Key Type
* @param <V> Region Value Type
* @deprecated as Spring Data GemFire 1.4.0. Use Region type specific FactoryBeans
* (e.g. ReplicatedRegionFactoryBean) instead.
*/
@Deprecated
@SuppressWarnings({"deprecation", "unused"})
public class SubRegionFactoryBean<K, V> extends com.gemstone.gemfire.cache.AttributesFactory<K, V>
implements FactoryBean<Region<K, V>>, InitializingBean {
protected final Log log = LogFactory.getLog(getClass());
private boolean lookupOnly;
private CacheListener<K, V>[] cacheListeners;
private Object[] asyncEventQueues;
private Object[] gatewaySenders;
private Region<?, ?> parentRegion;
private Region<K, V> subRegion;
private String name;
private String regionName;
@Override
public Region<K, V> getObject() throws Exception {
return this.subRegion;
}
@Override
public Class<?> getObjectType() {
// TODO perhaps this should be 'return (subRegion != null ? subRegion.getClass() : Region.class);' for consistency.
return Region.class;
}
@Override
public boolean isSingleton() {
return true;
}
@Override
public void afterPropertiesSet() throws Exception {
Assert.notNull(parentRegion, "The parent Region cannot be null.");
this.subRegion = parentRegion.getSubregion(regionName);
if (this.subRegion == null) {
if (lookupOnly) {
throw new BeanInitializationException(String.format("Cannot find Region [%1$s] in Cache %2$s",
regionName, parentRegion.getRegionService()));
}
else {
log.debug(String.format("Creating sub-Region of [%1$s] with name [%2$s]...",
(parentRegion.getFullPath() != null ? parentRegion.getFullPath() : parentRegion.getName()),
regionName));
if (!ObjectUtils.isEmpty(asyncEventQueues)) {
for (Object asyncEventQueue : asyncEventQueues) {
addAsyncEventQueueId(((AsyncEventQueue) asyncEventQueue).getId());
}
}
if (!ObjectUtils.isEmpty(cacheListeners)) {
for (CacheListener<K, V> listener : cacheListeners) {
addCacheListener(listener);
}
}
if (!ObjectUtils.isEmpty(gatewaySenders)) {
for (Object gatewaySender : gatewaySenders) {
addGatewaySenderId(((GatewaySender) gatewaySender).getId());
}
}
this.subRegion = this.parentRegion.createSubregion(regionName, create());
}
}
}
/**
*
* @param asyncEventQueues defined as Object for backward compatibility with Gemfire 6.
*/
public void setAsyncEventQueues(Object[] asyncEventQueues) {
this.asyncEventQueues = asyncEventQueues;
}
/**
* Sets the cache listeners used for the region used by this factory. Used
* only when a new region is created. Overrides the settings specified
* through setAttributes(com.gemstone.gemfire.cache.RegionAttributes).
*
* @param cacheListeners the cacheListeners to set on a newly created region
*/
public void setCacheListeners(CacheListener<K, V>[] cacheListeners) {
this.cacheListeners = cacheListeners;
}
public void setGatewaySenders(Object[] gatewaySenders) {
this.gatewaySenders = gatewaySenders;
}
/**
* Set to true if the subregion should already exist, e.g., specified by
* &lt;lookup-region&gt;
*
* @param lookupOnly a boolean value indicating whether this Subregion should be looked up instead of created.
*/
public void setLookupOnly(boolean lookupOnly) {
this.lookupOnly = lookupOnly;
}
/**
* Set the bean name - the same as the Subregion full path.
*
* @param name the name of this Subregion bean in the Spring context.
*/
public void setName(String name) {
this.name = name;
}
/**
* Set the simple name of this Subregion.
*
* @param regionName the simple name of this Subregion.
*/
public void setRegionName(String regionName) {
this.regionName = regionName;
}
/**
* Set the parent Region.
*
* @param parent a reference to the parent Region.
*/
public void setParent(Region<?, ?> parent) {
this.parentRegion = parent;
}
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.data.gemfire.support;
package org.springframework.data.gemfire.cache;
import java.util.concurrent.Callable;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.data.gemfire.support;
package org.springframework.data.gemfire.cache;
import java.util.Collection;
import java.util.HashSet;
@@ -141,7 +141,7 @@ public class GemfireCacheManager extends AbstractCacheManager {
*
* @param region GemFire {@link Region} to wrap (adapt).
* @return an instance of {@link GemfireCache} initialized with the given GemFire {@link Region}.
* @see org.springframework.data.gemfire.support.GemfireCache
* @see GemfireCache
* @see com.gemstone.gemfire.cache.Region
*/
protected GemfireCache newGemfireCache(Region<?, ?> region) {

View File

@@ -16,6 +16,18 @@
package org.springframework.data.gemfire.client;
import com.gemstone.gemfire.cache.CacheListener;
import com.gemstone.gemfire.cache.CacheLoader;
import com.gemstone.gemfire.cache.CacheWriter;
import com.gemstone.gemfire.cache.DataPolicy;
import com.gemstone.gemfire.cache.GemFireCache;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.RegionAttributes;
import com.gemstone.gemfire.cache.client.ClientCache;
import com.gemstone.gemfire.cache.client.ClientRegionFactory;
import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
import com.gemstone.gemfire.cache.client.Pool;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.BeansException;
@@ -31,18 +43,6 @@ import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import com.gemstone.gemfire.cache.CacheListener;
import com.gemstone.gemfire.cache.CacheLoader;
import com.gemstone.gemfire.cache.CacheWriter;
import com.gemstone.gemfire.cache.DataPolicy;
import com.gemstone.gemfire.cache.GemFireCache;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.RegionAttributes;
import com.gemstone.gemfire.cache.client.ClientCache;
import com.gemstone.gemfire.cache.client.ClientRegionFactory;
import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
import com.gemstone.gemfire.cache.client.Pool;
/**
* Client extension for GemFire Regions.
*

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.data.gemfire;
package org.springframework.data.gemfire.client;
import org.springframework.core.convert.converter.Converter;

View File

@@ -14,12 +14,12 @@
* limitations under the License.
*/
package org.springframework.data.gemfire.support;
import org.springframework.util.ObjectUtils;
package org.springframework.data.gemfire.client;
import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
import org.springframework.util.ObjectUtils;
/**
* The ClientRegionShortcutWrapper enum is a Java enumerated type that wraps GemFire's ClientRegionShortcuts
* with Spring Data GemFire ClientRegionShortcutWrapper enumerated values.

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2002-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.
@@ -16,6 +16,14 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.client.ClientCache;
import com.gemstone.gemfire.cache.client.ClientRegionFactory;
import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
import com.gemstone.gemfire.cache.execute.Function;
import com.gemstone.gemfire.management.internal.cli.domain.RegionInformation;
import com.gemstone.gemfire.management.internal.cli.functions.GetRegionsFunction;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.BeansException;
@@ -26,14 +34,6 @@ import org.springframework.data.gemfire.support.ListRegionsOnServerFunction;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.client.ClientCache;
import com.gemstone.gemfire.cache.client.ClientRegionFactory;
import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
import com.gemstone.gemfire.cache.execute.Function;
import com.gemstone.gemfire.management.internal.cli.domain.RegionInformation;
import com.gemstone.gemfire.management.internal.cli.functions.GetRegionsFunction;
/**
* A Spring {@link BeanFactoryPostProcessor} used to register a Client Region Proxy bean for each Region
* accessible to a GemFire DataSource. If the Region is already defined, the bean definition will not be overridden.

View File

@@ -16,15 +16,15 @@
package org.springframework.data.gemfire.client;
import com.gemstone.gemfire.cache.InterestResultPolicy;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.Constants;
import org.springframework.util.Assert;
import com.gemstone.gemfire.cache.InterestResultPolicy;
/**
* The Interest class holds details for registering a client interest.
*
*
* @author Costin Leau
* @author John Blum
* @see org.springframework.beans.factory.InitializingBean
@@ -85,7 +85,7 @@ public class Interest<K> implements InitializingBean {
/**
* Returns the key of interest.
*
*
* @return the key
*/
public K getKey() {
@@ -94,7 +94,7 @@ public class Interest<K> implements InitializingBean {
/**
* Sets the key of interest.
*
*
* @param key the key to set
*/
public void setKey(K key) {
@@ -103,7 +103,7 @@ public class Interest<K> implements InitializingBean {
/**
* Returns the interest policy.
*
*
* @return the policy
*/
public InterestResultPolicy getPolicy() {
@@ -114,7 +114,7 @@ public class Interest<K> implements InitializingBean {
* Sets the interest policy. The argument is set as an Object
* to be able to accept both InterestResultType instances but also
* Strings (for XML configurations).
*
*
* @param policy the policy to set
*/
public void setPolicy(Object policy) {
@@ -132,7 +132,7 @@ public class Interest<K> implements InitializingBean {
/**
* Returns the interest durability.
*
*
* @return the durable
*/
public boolean isDurable() {
@@ -141,7 +141,7 @@ public class Interest<K> implements InitializingBean {
/**
* Sets the interest durability.
*
*
* @param durable the durable to set
*/
public void setDurable(boolean durable) {
@@ -150,7 +150,7 @@ public class Interest<K> implements InitializingBean {
/**
* Returns the type of values received by the listener.
*
*
* @return the receiveValues
*/
public boolean isReceiveValues() {
@@ -159,7 +159,7 @@ public class Interest<K> implements InitializingBean {
/**
* Switches between the different entities received by the listener.
*
*
* @param receiveValues the receiveValues to set
*/
public void setReceiveValues(boolean receiveValues) {

View File

@@ -16,10 +16,10 @@
package org.springframework.data.gemfire.client;
import org.springframework.data.gemfire.support.AbstractPropertyEditorConverterSupport;
import com.gemstone.gemfire.cache.InterestResultPolicy;
import org.springframework.data.gemfire.support.AbstractPropertyEditorConverterSupport;
/**
* The InterestResultPolicyConverter class is a Spring Converter and JavaBeans PropertyEditor capable of converting
* a String into a GemFire InterestResultPolicyConverter.

View File

@@ -21,12 +21,12 @@ import java.net.InetSocketAddress;
import java.util.Collection;
import java.util.List;
import org.springframework.data.gemfire.util.SpringUtils;
import org.springframework.util.Assert;
import com.gemstone.gemfire.cache.client.Pool;
import com.gemstone.gemfire.cache.query.QueryService;
import org.springframework.data.gemfire.util.SpringUtils;
import org.springframework.util.Assert;
/**
* The DefaultableDelegatingPoolAdapter class is a wrapper class around Pool allowing default configuration property
* values to be providing in the case that the Pool's setting were null.

View File

@@ -21,12 +21,12 @@ import java.net.InetSocketAddress;
import java.util.Collections;
import java.util.List;
import org.springframework.data.gemfire.GemfireUtils;
import org.springframework.data.gemfire.client.PoolAdapter;
import com.gemstone.gemfire.cache.client.PoolFactory;
import com.gemstone.gemfire.cache.query.QueryService;
import org.springframework.data.gemfire.GemfireUtils;
import org.springframework.data.gemfire.client.PoolAdapter;
/**
* FactoryDefaultsPoolAdapter is an abstract implementation of GemFire's {@link com.gemstone.gemfire.cache.client.Pool}
* interface and extension of {@link PoolAdapter} providing default factory values for all configuration properties

View File

@@ -29,10 +29,10 @@ import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.gemfire.EvictionActionConverter;
import org.springframework.data.gemfire.EvictionPolicyConverter;
import org.springframework.data.gemfire.EvictionPolicyType;
import org.springframework.data.gemfire.ExpirationActionConverter;
import org.springframework.data.gemfire.eviction.EvictionActionConverter;
import org.springframework.data.gemfire.eviction.EvictionPolicyConverter;
import org.springframework.data.gemfire.eviction.EvictionPolicyType;
import org.springframework.data.gemfire.expiration.ExpirationActionConverter;
import org.springframework.data.gemfire.IndexMaintenancePolicyConverter;
import org.springframework.data.gemfire.IndexMaintenancePolicyType;
import org.springframework.data.gemfire.IndexType;

View File

@@ -21,7 +21,7 @@ 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.FunctionServiceFactoryBean;
import org.springframework.data.gemfire.function.FunctionServiceFactoryBean;
import org.springframework.data.gemfire.util.SpringUtils;
import org.springframework.util.xml.DomUtils;
import org.w3c.dom.Element;
@@ -32,7 +32,7 @@ import org.w3c.dom.Element;
* @author David Turanski
* @author John Blum
* @see org.springframework.beans.factory.xml.AbstractSimpleBeanDefinitionParser
* @see org.springframework.data.gemfire.FunctionServiceFactoryBean
* @see FunctionServiceFactoryBean
*/
class FunctionServiceParser extends AbstractSimpleBeanDefinitionParser {

View File

@@ -16,15 +16,15 @@
package org.springframework.data.gemfire.config.xml;
import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue;
import com.gemstone.gemfire.cache.wan.GatewaySender;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.data.gemfire.LookupRegionFactoryBean;
import org.springframework.util.xml.DomUtils;
import org.w3c.dom.Element;
import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue;
import com.gemstone.gemfire.cache.wan.GatewaySender;
/**
* Bean definition parser for the &lt;gfe:lookup-region&gt; SDG XML namespace (XSD) element.
*

View File

@@ -31,10 +31,10 @@ import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.ManagedList;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.core.Conventions;
import org.springframework.data.gemfire.EvictionAttributesFactoryBean;
import org.springframework.data.gemfire.ExpirationAttributesFactoryBean;
import org.springframework.data.gemfire.GemfireUtils;
import org.springframework.data.gemfire.SubscriptionAttributesFactoryBean;
import org.springframework.data.gemfire.eviction.EvictionAttributesFactoryBean;
import org.springframework.data.gemfire.expiration.ExpirationAttributesFactoryBean;
import org.springframework.data.gemfire.util.SpringUtils;
import org.springframework.util.StringUtils;
import org.springframework.util.xml.DomUtils;

View File

@@ -14,18 +14,18 @@
* limitations under the License.
*/
package org.springframework.data.gemfire;
import org.springframework.data.gemfire.support.AbstractPropertyEditorConverterSupport;
package org.springframework.data.gemfire.eviction;
import com.gemstone.gemfire.cache.EvictionAction;
import org.springframework.data.gemfire.support.AbstractPropertyEditorConverterSupport;
/**
* The EvictionActionConverter class is a Spring Converter and JavaBeans PropertyEditor that converts
* an Object value into an instance of GemFire EvictionAction.
*
* @author John Blum
* @see org.springframework.data.gemfire.EvictionActionType
* @see EvictionActionType
* @see org.springframework.data.gemfire.support.AbstractPropertyEditorConverterSupport
* @see com.gemstone.gemfire.cache.EvictionAction
* @since 1.6.0

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.data.gemfire;
package org.springframework.data.gemfire.eviction;
import com.gemstone.gemfire.cache.EvictionAction;

View File

@@ -14,10 +14,7 @@
* limitations under the License.
*/
package org.springframework.data.gemfire;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
package org.springframework.data.gemfire.eviction;
import com.gemstone.gemfire.cache.EvictionAction;
import com.gemstone.gemfire.cache.EvictionAttributes;
@@ -25,6 +22,9 @@ import com.gemstone.gemfire.cache.util.ObjectSizer;
import com.gemstone.gemfire.internal.cache.lru.LRUCapacityController;
import com.gemstone.gemfire.internal.cache.lru.MemLRUCapacityController;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
/**
* Simple utility class used for defining nested factory-method like definitions w/o polluting the container with useless beans.
*

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.data.gemfire;
package org.springframework.data.gemfire.eviction;
import org.springframework.data.gemfire.support.AbstractPropertyEditorConverterSupport;

View File

@@ -14,14 +14,14 @@
* limitations under the License.
*/
package org.springframework.data.gemfire;
package org.springframework.data.gemfire.eviction;
import com.gemstone.gemfire.cache.EvictionAlgorithm;
/**
* The EvictionPolicyType enum is an enumeration of all GemFire Eviction policies, where the Eviction 'policy'
* is a combination of the Eviction algorithm mixed with the monitored resource (e.g. such as JVM HEAP memory).
*
*
* @author Costin Leau
* @author John Blum
* @see com.gemstone.gemfire.cache.EvictionAlgorithm

View File

@@ -14,11 +14,16 @@
* limitations under the License.
*/
package org.springframework.data.gemfire.support;
package org.springframework.data.gemfire.expiration;
import java.lang.annotation.Annotation;
import java.util.concurrent.atomic.AtomicReference;
import com.gemstone.gemfire.cache.CustomExpiry;
import com.gemstone.gemfire.cache.ExpirationAction;
import com.gemstone.gemfire.cache.ExpirationAttributes;
import com.gemstone.gemfire.cache.Region;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
@@ -29,8 +34,6 @@ import org.springframework.context.expression.EnvironmentAccessor;
import org.springframework.context.expression.MapAccessor;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.core.convert.ConversionService;
import org.springframework.data.gemfire.ExpirationActionConverter;
import org.springframework.data.gemfire.ExpirationActionType;
import org.springframework.expression.EvaluationContext;
import org.springframework.expression.EvaluationException;
import org.springframework.expression.Expression;
@@ -42,11 +45,6 @@ import org.springframework.expression.spel.support.StandardTypeLocator;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import com.gemstone.gemfire.cache.CustomExpiry;
import com.gemstone.gemfire.cache.ExpirationAction;
import com.gemstone.gemfire.cache.ExpirationAttributes;
import com.gemstone.gemfire.cache.Region;
/**
* The AnnotationBasedExpiration class is an implementation of GemFire's CustomExpiry interface that determines
* the Time-To-Live (TTL) or Idle-Timeout (TTI) expiration policy of a Region entry by introspecting the Region
@@ -57,10 +55,10 @@ import com.gemstone.gemfire.cache.Region;
* @see java.lang.annotation.Annotation
* @see org.springframework.beans.factory.BeanFactory
* @see org.springframework.beans.factory.BeanFactoryAware
* @see org.springframework.data.gemfire.ExpirationActionType
* @see org.springframework.data.gemfire.support.Expiration
* @see org.springframework.data.gemfire.support.IdleTimeoutExpiration
* @see org.springframework.data.gemfire.support.TimeToLiveExpiration
* @see ExpirationActionType
* @see Expiration
* @see IdleTimeoutExpiration
* @see TimeToLiveExpiration
* @see com.gemstone.gemfire.cache.CustomExpiry
* @see com.gemstone.gemfire.cache.ExpirationAction
* @see com.gemstone.gemfire.cache.ExpirationAttributes
@@ -103,8 +101,8 @@ public class AnnotationBasedExpiration<K, V> implements BeanFactoryAware, Custom
* @param <K> the class type of the Region Entry Key.
* @param <V> the class type of the Region Entry Value.
* @return an AnnotationBasedExpiration instance to process Idle Timeout Expiration annotated Region Entries.
* @see org.springframework.data.gemfire.support.AnnotationBasedExpiration
* @see org.springframework.data.gemfire.support.IdleTimeoutExpiration
* @see AnnotationBasedExpiration
* @see IdleTimeoutExpiration
* @see #forIdleTimeout(com.gemstone.gemfire.cache.ExpirationAttributes)
*/
public static <K, V> AnnotationBasedExpiration<K, V> forIdleTimeout() {
@@ -120,8 +118,8 @@ public class AnnotationBasedExpiration<K, V> implements BeanFactoryAware, Custom
* @param defaultExpirationAttributes ExpirationAttributes used by default if no Expiration policy was specified
* on the Region Entry.
* @return an AnnotationBasedExpiration instance to process Idle Timeout Expiration annotated Region Entries.
* @see org.springframework.data.gemfire.support.AnnotationBasedExpiration
* @see org.springframework.data.gemfire.support.IdleTimeoutExpiration
* @see AnnotationBasedExpiration
* @see IdleTimeoutExpiration
*/
public static <K, V> AnnotationBasedExpiration<K, V> forIdleTimeout(ExpirationAttributes defaultExpirationAttributes) {
return new AnnotationBasedExpiration<K, V>(defaultExpirationAttributes) {
@@ -139,8 +137,8 @@ public class AnnotationBasedExpiration<K, V> implements BeanFactoryAware, Custom
* @param <K> the class type of the Region Entry Key.
* @param <V> the class type of the Region Entry Value.
* @return an AnnotationBasedExpiration instance to process Time-To-Live Expiration annotated Region Entries.
* @see org.springframework.data.gemfire.support.AnnotationBasedExpiration
* @see org.springframework.data.gemfire.support.TimeToLiveExpiration
* @see AnnotationBasedExpiration
* @see TimeToLiveExpiration
* @see #forTimeToLive(com.gemstone.gemfire.cache.ExpirationAttributes)
*/
public static <K, V> AnnotationBasedExpiration<K, V> forTimeToLive() {
@@ -156,8 +154,8 @@ public class AnnotationBasedExpiration<K, V> implements BeanFactoryAware, Custom
* @param defaultExpirationAttributes ExpirationAttributes used by default if no Expiration policy was specified
* on the Region Entry.
* @return an AnnotationBasedExpiration instance to process Time-To-Live Expiration annotated Region Entries.
* @see org.springframework.data.gemfire.support.AnnotationBasedExpiration
* @see org.springframework.data.gemfire.support.TimeToLiveExpiration
* @see AnnotationBasedExpiration
* @see TimeToLiveExpiration
*/
public static <K, V> AnnotationBasedExpiration<K, V> forTimeToLive(ExpirationAttributes defaultExpirationAttributes) {
return new AnnotationBasedExpiration<K, V>(defaultExpirationAttributes) {
@@ -268,7 +266,7 @@ public class AnnotationBasedExpiration<K, V> implements BeanFactoryAware, Custom
* @param entry the Region entry used as the source of the expiration meta-data.
* @return ExpirationMetaData extracted from the Region entry.
* @throws NullPointerException if the Region.Entry, Region or the Region's attributes are null.
* @see org.springframework.data.gemfire.support.AnnotationBasedExpiration.ExpirationMetaData
* @see AnnotationBasedExpiration.ExpirationMetaData
*/
protected ExpirationMetaData getExpirationMetaData(Region.Entry<K, V> entry) {
return (isExpirationConfigured(entry) ? ExpirationMetaData.from(getExpiration(entry)) : null);
@@ -284,7 +282,7 @@ public class AnnotationBasedExpiration<K, V> implements BeanFactoryAware, Custom
* @return a custom ExpirationAttributes configured with the application domain object specific expiration policy
* or the default expiration settings if the application domain object has not been annotated with custom
* expiration meta-data.
* @see org.springframework.data.gemfire.support.AnnotationBasedExpiration.ExpirationMetaData
* @see AnnotationBasedExpiration.ExpirationMetaData
* @see com.gemstone.gemfire.cache.ExpirationAttributes
* @see #getDefaultExpirationAttributes()
*/
@@ -298,7 +296,7 @@ public class AnnotationBasedExpiration<K, V> implements BeanFactoryAware, Custom
*
* @param entry the Region.Entry to evaluate for the presence of the Expiration Annotation.
* @return a boolean value indicating whether the Region Entry has been annotated with @Expiration.
* @see org.springframework.data.gemfire.support.Expiration
* @see Expiration
* @see #isAnnotationPresent(Object, Class)
*/
protected boolean isExpirationConfigured(Region.Entry<K, V> entry) {
@@ -311,7 +309,7 @@ public class AnnotationBasedExpiration<K, V> implements BeanFactoryAware, Custom
* @param entry the Region.Entry from which to extract the Expiration Annotation meta-data.
* @return the Expiration Annotation meta-data for the given Region Entry or {@code null}
* if the Region Entry has not been annotated with @Expiration.
* @see org.springframework.data.gemfire.support.Expiration
* @see Expiration
* @see #getAnnotation(Object, Class)
*/
protected Expiration getExpiration(Region.Entry<K, V> entry) {
@@ -323,7 +321,7 @@ public class AnnotationBasedExpiration<K, V> implements BeanFactoryAware, Custom
*
* @param entry the Region.Entry to evaluate for the presence of the IdleTimeoutExpiration Annotation.
* @return a boolean value indicating whether the Region Entry has been annotated with @IdleTimeoutExpiration.
* @see org.springframework.data.gemfire.support.IdleTimeoutExpiration
* @see IdleTimeoutExpiration
* @see #isAnnotationPresent(Object, Class)
*/
protected boolean isIdleTimeoutConfigured(Region.Entry<K, V> entry) {
@@ -336,7 +334,7 @@ public class AnnotationBasedExpiration<K, V> implements BeanFactoryAware, Custom
* @param entry the Region.Entry from which to extract the IdleTimeoutExpiration Annotation meta-data.
* @return the IdleTimeoutExpiration Annotation meta-data for the given Region Entry or {@code null}
* if the Region Entry has not been annotated with @IdleTimeoutExpiration.
* @see org.springframework.data.gemfire.support.IdleTimeoutExpiration
* @see IdleTimeoutExpiration
* @see #getAnnotation(Object, Class)
*/
protected IdleTimeoutExpiration getIdleTimeout(Region.Entry<K, V> entry) {
@@ -348,7 +346,7 @@ public class AnnotationBasedExpiration<K, V> implements BeanFactoryAware, Custom
*
* @param entry the Region.Entry to evaluate for the presence of the TimeToLiveExpiration Annotation.
* @return a boolean value indicating whether the Region Entry has been annotated with @TimeToLiveExpiration.
* @see org.springframework.data.gemfire.support.TimeToLiveExpiration
* @see TimeToLiveExpiration
* @see #isAnnotationPresent(Object, Class)
*/
protected boolean isTimeToLiveConfigured(Region.Entry<K, V> entry) {
@@ -361,7 +359,7 @@ public class AnnotationBasedExpiration<K, V> implements BeanFactoryAware, Custom
* @param entry the Region.Entry from which to extract the TimeToLiveExpiration Annotation meta-data.
* @return the TimeToLiveExpiration Annotation meta-data for the given Region Entry or {@code null}
* if the Region Entry has not been annotated with @TimeToLiveExpiration.
* @see org.springframework.data.gemfire.support.TimeToLiveExpiration
* @see TimeToLiveExpiration
* @see #getAnnotation(Object, Class)
*/
protected TimeToLiveExpiration getTimeToLive(Region.Entry<K, V> entry) {

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.data.gemfire.support;
package org.springframework.data.gemfire.expiration;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
@@ -28,7 +28,7 @@ import java.lang.annotation.Target;
* to express their general expiration policy.
*
* @author John Blum
* @see org.springframework.data.gemfire.ExpirationActionType
* @see ExpirationActionType
* @since 1.7.0
*/
@Documented

View File

@@ -14,12 +14,12 @@
* limitations under the License.
*/
package org.springframework.data.gemfire;
import org.springframework.data.gemfire.support.AbstractPropertyEditorConverterSupport;
package org.springframework.data.gemfire.expiration;
import com.gemstone.gemfire.cache.ExpirationAction;
import org.springframework.data.gemfire.support.AbstractPropertyEditorConverterSupport;
/**
* The ExpirationActionTypeConverter class is a Spring Converter used to convert a String value into
* a corresponding ExpirationActionType enumerated value.
@@ -27,7 +27,7 @@ import com.gemstone.gemfire.cache.ExpirationAction;
* @author John Blum
* @see java.beans.PropertyEditorSupport
* @see org.springframework.core.convert.converter.Converter
* @see org.springframework.data.gemfire.ExpirationActionType
* @see ExpirationActionType
* @since 1.6.0
*/
public class ExpirationActionConverter extends AbstractPropertyEditorConverterSupport<ExpirationAction> {
@@ -38,7 +38,7 @@ public class ExpirationActionConverter extends AbstractPropertyEditorConverterSu
* @param source the String to convert into an GemFire ExpirationAction.
* @return an GemFire ExpirationAction value for the given String.
* @throws java.lang.IllegalArgumentException if the String is not a valid GemFire ExpirationAction.
* @see org.springframework.data.gemfire.ExpirationActionType#valueOfIgnoreCase(String)
* @see ExpirationActionType#valueOfIgnoreCase(String)
* @see com.gemstone.gemfire.cache.ExpirationAction
*/
@Override

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.data.gemfire;
package org.springframework.data.gemfire.expiration;
import com.gemstone.gemfire.cache.ExpirationAction;

View File

@@ -14,14 +14,14 @@
* limitations under the License.
*/
package org.springframework.data.gemfire;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
package org.springframework.data.gemfire.expiration;
import com.gemstone.gemfire.cache.ExpirationAction;
import com.gemstone.gemfire.cache.ExpirationAttributes;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
/**
* The ExpirationAttributesFactoryBean class is a Spring FactoryBean used to create GemFire ExpirationAttributes
* to specify Expiration policies for Region Time-to-Live (TTL) and Idle-Timeouts (TTI) as well as
@@ -79,7 +79,7 @@ public class ExpirationAttributesFactoryBean implements FactoryBean<ExpirationAt
* Gets the action to perform when a Region or an Entry expires.
*
* @return the type of action to perform on expiration.
* @see org.springframework.data.gemfire.ExpirationActionType
* @see ExpirationActionType
* @see com.gemstone.gemfire.cache.ExpirationAttributes#getAction()
*/
public ExpirationAction getAction() {
@@ -111,7 +111,7 @@ public class ExpirationAttributesFactoryBean implements FactoryBean<ExpirationAt
* @throws Exception if the construction of the ExpirationAttributes was not successful.
* @see #getAction()
* @see #getTimeout()
* @see org.springframework.data.gemfire.ExpirationActionType#getExpirationAction()
* @see ExpirationActionType#getExpirationAction()
* @see com.gemstone.gemfire.cache.ExpirationAttributes
*/
@Override

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.data.gemfire.support;
package org.springframework.data.gemfire.expiration;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
@@ -28,8 +28,8 @@ import java.lang.annotation.Target;
* to express their idle-timeout (TTI) expiration policy.
*
* @author John Blum
* @see org.springframework.data.gemfire.ExpirationActionType
* @see org.springframework.data.gemfire.support.Expiration
* @see ExpirationActionType
* @see Expiration
* @since 1.7.0
*/
@Documented

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.data.gemfire.support;
package org.springframework.data.gemfire.expiration;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
@@ -28,8 +28,8 @@ import java.lang.annotation.Target;
* to express their time-to-live (TTL) expiration policy.
*
* @author John Blum
* @see org.springframework.data.gemfire.ExpirationActionType
* @see org.springframework.data.gemfire.support.Expiration
* @see ExpirationActionType
* @see Expiration
* @since 1.7.0
*/
@Documented

View File

@@ -13,19 +13,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.gemfire;
package org.springframework.data.gemfire.function;
import java.util.List;
import com.gemstone.gemfire.cache.execute.Function;
import com.gemstone.gemfire.cache.execute.FunctionService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.CollectionUtils;
import com.gemstone.gemfire.cache.execute.Function;
import com.gemstone.gemfire.cache.execute.FunctionService;
/**
* Spring FactoryBean for registering instance of GemFire Function with the GemFire FunctionService.
*

View File

@@ -32,6 +32,7 @@ public abstract class ArrayUtils {
* @param elements variable list of arguments to return as an array.
* @return an arry for the given varargs {@code elements}.
*/
@SafeVarargs
public static <T> T[] asArray(T... elements) {
return elements;
}
@@ -45,7 +46,7 @@ public abstract class ArrayUtils {
* @return the first element in the array or {@literal null} if the array is null or empty.
* @see #getFirst(Object[], Object)
*/
public static <T> T getFirst(T... array) {
public static <T> T getFirst(T[] array) {
return getFirst(array, null);
}