Merge branch 'sgf268' of github.com:jxblum/spring-data-gemfire into jxblum-pr64
This commit is contained in:
@@ -23,7 +23,7 @@ import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
|
||||
/**
|
||||
* The ClientRegionShortcutConverter class is a Spring Converter implementation converting String value Client Region
|
||||
* Shortcut representations into actual GemFire ClientRegionShortcut enumerated values.
|
||||
* <p/>
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.springframework.core.convert.converter.Converter
|
||||
* @see com.gemstone.gemfire.cache.client.ClientRegionShortcut
|
||||
@@ -35,7 +35,7 @@ public class ClientRegionShortcutConverter implements Converter<String, ClientRe
|
||||
/**
|
||||
* Converts the String value to upper case, trimming all whitespace. This method guards against null values
|
||||
* and returns the "null" String if value is null.
|
||||
* <p/>
|
||||
*
|
||||
* @param value the String to convert to a trimmed, upper case value.
|
||||
* @return a trimmed, upper case value of the specified String, or "null" if the String value reference is null.
|
||||
* @see java.lang.String#toUpperCase()
|
||||
@@ -49,7 +49,7 @@ public class ClientRegionShortcutConverter implements Converter<String, ClientRe
|
||||
/**
|
||||
* Converts the source String representation of a Client Region Shortcut into a ClientRegionShortcut enumerated
|
||||
* value.
|
||||
* <p/>
|
||||
*
|
||||
* @param source the String representation of the Client Region Shortcut to convert.
|
||||
* @return a ClientRegionShortcut enumerated value for the String representation.
|
||||
* @throws IllegalArgumentException if the String source is not a valid ClientRegionShortcut enumerated value.
|
||||
|
||||
@@ -32,7 +32,7 @@ import com.gemstone.gemfire.cache.GemFireCache;
|
||||
|
||||
/**
|
||||
* FactoryBean for creating a GemFire DiskStore.
|
||||
* <p/>
|
||||
*
|
||||
* @author David Turanski
|
||||
* @author John Blum
|
||||
* @see org.springframework.beans.factory.BeanNameAware
|
||||
@@ -42,8 +42,6 @@ import com.gemstone.gemfire.cache.GemFireCache;
|
||||
@SuppressWarnings("unused")
|
||||
public class DiskStoreFactoryBean implements FactoryBean<DiskStore>, InitializingBean, BeanNameAware {
|
||||
|
||||
private DiskStoreFactory diskStoreFactory;
|
||||
|
||||
private Boolean allowForceCompaction;
|
||||
private Boolean autoCompact;
|
||||
|
||||
@@ -81,7 +79,7 @@ public class DiskStoreFactoryBean implements FactoryBean<DiskStore>, Initializin
|
||||
Assert.state(cache != null, String.format("A reference to the GemFire Cache must be set for Disk Store '%1$s'.",
|
||||
getName()));
|
||||
|
||||
diskStoreFactory = cache.createDiskStoreFactory();
|
||||
DiskStoreFactory diskStoreFactory = cache.createDiskStoreFactory();
|
||||
|
||||
if (allowForceCompaction != null) {
|
||||
diskStoreFactory.setAllowForceCompaction(allowForceCompaction);
|
||||
|
||||
@@ -27,7 +27,7 @@ import com.gemstone.gemfire.cache.Region;
|
||||
|
||||
/**
|
||||
* Base class for GemfireTemplate and GemfireInterceptor, defining common properties such as {@link Region}.
|
||||
* <p/>
|
||||
*
|
||||
* Not intended to be used directly.
|
||||
*
|
||||
* @author Costin Leau
|
||||
@@ -73,7 +73,6 @@ public class GemfireAccessor implements InitializingBean {
|
||||
* is called only for GemFire querying exception that do <b>NOT</b> extend from GemFire exception.
|
||||
* May be overridden in subclasses.
|
||||
*
|
||||
* @see com.gemstone.gemfire.cache.query.CqInvalidException
|
||||
* @param ex GemFireException that occurred
|
||||
* @return the corresponding DataAccessException instance
|
||||
*/
|
||||
@@ -98,4 +97,4 @@ public class GemfireAccessor implements InitializingBean {
|
||||
public void setRegion(Region<?, ?> region) {
|
||||
this.region = region;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ import org.springframework.util.StringUtils;
|
||||
* and aliases of the bean (so the same "registry" can be used for storing multiple BeanFactories).
|
||||
* If there is only one BeanFactory registered then a null value can be used with {@link #setBeanName(String)}.
|
||||
*
|
||||
* <p/> In most cases, one does not need to use this class directly as it is used internally
|
||||
* In most cases, one does not need to use this class directly as it is used internally
|
||||
* by {@link com.gemstone.gemfire.cache.CacheFactory}.
|
||||
*
|
||||
* @author Costin Leau
|
||||
@@ -161,4 +161,4 @@ public class GemfireBeanFactoryLocator implements BeanFactoryLocator, BeanFactor
|
||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
|
||||
this.beanFactory = beanFactory;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,9 +43,6 @@ import com.gemstone.gemfire.NoSystemException;
|
||||
import com.gemstone.gemfire.SystemConnectException;
|
||||
import com.gemstone.gemfire.SystemIsRunningException;
|
||||
import com.gemstone.gemfire.UnmodifiableException;
|
||||
import com.gemstone.gemfire.admin.AdminException;
|
||||
import com.gemstone.gemfire.admin.RegionNotFoundException;
|
||||
import com.gemstone.gemfire.admin.RuntimeAdminException;
|
||||
import com.gemstone.gemfire.cache.CacheException;
|
||||
import com.gemstone.gemfire.cache.CacheExistsException;
|
||||
import com.gemstone.gemfire.cache.CacheLoaderException;
|
||||
@@ -58,7 +55,6 @@ import com.gemstone.gemfire.cache.DiskAccessException;
|
||||
import com.gemstone.gemfire.cache.EntryDestroyedException;
|
||||
import com.gemstone.gemfire.cache.EntryExistsException;
|
||||
import com.gemstone.gemfire.cache.EntryNotFoundException;
|
||||
import com.gemstone.gemfire.cache.EntryNotFoundInRegion;
|
||||
import com.gemstone.gemfire.cache.FailedSynchronizationException;
|
||||
import com.gemstone.gemfire.cache.OperationAbortedException;
|
||||
import com.gemstone.gemfire.cache.PartitionedRegionDistributionException;
|
||||
@@ -90,18 +86,18 @@ public abstract class GemfireCacheUtils {
|
||||
|
||||
private static Class<?> CQ_EXCEPTION_CLASS;
|
||||
|
||||
{
|
||||
Class<?> clz = null;
|
||||
static {
|
||||
Class<?> type = null;
|
||||
|
||||
try {
|
||||
type = ClassUtils.resolveClassName("com.gemstone.gemfire.cache.query.CqInvalidException",
|
||||
GemfireCacheUtils.class.getClassLoader());
|
||||
|
||||
clz = ClassUtils.resolveClassName("com.gemstone.gemfire.cache.query.CqInvalidException",
|
||||
GemfireCacheUtils.class.getClassLoader());
|
||||
|
||||
} catch (IllegalArgumentException iae) {
|
||||
}
|
||||
catch (IllegalArgumentException ignore) {
|
||||
}
|
||||
|
||||
CQ_EXCEPTION_CLASS = clz;
|
||||
CQ_EXCEPTION_CLASS = type;
|
||||
}
|
||||
|
||||
|
||||
@@ -112,6 +108,7 @@ public abstract class GemfireCacheUtils {
|
||||
* @param ex Gemfire unchecked exception
|
||||
* @return new the corresponding DataAccessException instance
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public static DataAccessException convertGemfireAccessException(GemFireException ex) {
|
||||
if (ex instanceof CacheException) {
|
||||
if (ex instanceof CacheExistsException) {
|
||||
@@ -179,7 +176,7 @@ public abstract class GemfireCacheUtils {
|
||||
if (ex instanceof RegionDestroyedException) {
|
||||
return new InvalidDataAccessResourceUsageException(ex.getMessage(), ex);
|
||||
}
|
||||
if (ex instanceof RegionNotFoundException) {
|
||||
if (ex instanceof com.gemstone.gemfire.admin.RegionNotFoundException) {
|
||||
return new InvalidDataAccessResourceUsageException(ex.getMessage(), ex);
|
||||
}
|
||||
if (ex instanceof ResourceException) {
|
||||
@@ -198,7 +195,7 @@ public abstract class GemfireCacheUtils {
|
||||
if (ex instanceof CopyException) {
|
||||
return new GemfireSystemException(ex);
|
||||
}
|
||||
if (ex instanceof EntryNotFoundInRegion) {
|
||||
if (ex instanceof com.gemstone.gemfire.cache.EntryNotFoundInRegion) {
|
||||
return new DataRetrievalFailureException(ex.getMessage(), ex);
|
||||
}
|
||||
if (ex instanceof FunctionException) {
|
||||
@@ -234,7 +231,7 @@ public abstract class GemfireCacheUtils {
|
||||
if (ex instanceof NoSystemException) {
|
||||
return new GemfireSystemException(ex);
|
||||
}
|
||||
if (ex instanceof RuntimeAdminException) {
|
||||
if (ex instanceof com.gemstone.gemfire.admin.RuntimeAdminException) {
|
||||
return new GemfireSystemException(ex);
|
||||
}
|
||||
if (ex instanceof ServerConnectivityException) {
|
||||
@@ -263,9 +260,6 @@ public abstract class GemfireCacheUtils {
|
||||
* Dedicated method for converting exceptions changed in 6.5 that had their
|
||||
* parent changed. This method exists to 'fool' the compiler type checks
|
||||
* by loosening the type so the code compiles on both 6.5 (pre and current) branches.
|
||||
*
|
||||
* @param ex
|
||||
* @return
|
||||
*/
|
||||
static DataAccessException convertQueryExceptions(RuntimeException ex) {
|
||||
if (ex instanceof IndexInvalidException) {
|
||||
@@ -290,6 +284,7 @@ public abstract class GemfireCacheUtils {
|
||||
* @param ex Gemfire unchecked exception
|
||||
* @return new the corresponding DataAccessException instance
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public static DataAccessException convertGemfireAccessException(GemFireCheckedException ex) {
|
||||
// query exceptions
|
||||
if (ex instanceof QueryException) {
|
||||
@@ -304,7 +299,7 @@ public abstract class GemfireCacheUtils {
|
||||
return new DataAccessResourceFailureException(ex.getMessage(), ex);
|
||||
}
|
||||
// admin exception
|
||||
if (ex instanceof AdminException) {
|
||||
if (ex instanceof com.gemstone.gemfire.admin.AdminException) {
|
||||
return new GemfireSystemException(ex);
|
||||
}
|
||||
// fall back
|
||||
@@ -337,9 +332,6 @@ public abstract class GemfireCacheUtils {
|
||||
|
||||
/**
|
||||
* Package protected method for detecting CqInvalidException which has been removed in GemFire 6.5 GA.
|
||||
*
|
||||
* @param ex
|
||||
* @return
|
||||
*/
|
||||
static boolean isCqInvalidException(RuntimeException ex) {
|
||||
return (CQ_EXCEPTION_CLASS != null && CQ_EXCEPTION_CLASS.isAssignableFrom(ex.getClass()));
|
||||
@@ -356,4 +348,5 @@ public abstract class GemfireCacheUtils {
|
||||
static DataAccessException convertCqInvalidException(RuntimeException ex) {
|
||||
return new GemfireQueryException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public interface GemfireCallback<T> {
|
||||
/**
|
||||
* Gets called by {@link GemfireTemplate#execute(GemfireCallback)}. Does not need to care about handling transactions
|
||||
* or exceptions.
|
||||
* <p/>
|
||||
*
|
||||
* Allows for returning a result object created within the callback, i.e. a domain object or a collection of domain
|
||||
* objects. A thrown custom RuntimeException is treated as an application exception: It gets propagated to the caller
|
||||
* of the template.
|
||||
|
||||
@@ -71,10 +71,10 @@ public interface GemfireOperations {
|
||||
/**
|
||||
* Executes a GemFire query with the given (optional) parameters and returns the result. Note this method expects the query to return multiple results; for queries that return only one
|
||||
* element use {@link #findUnique(String, Object...)}.
|
||||
* <p/>
|
||||
*
|
||||
* As oppose, to the {@link #query(String)} method, this method allows for more generic queries (against multiple regions even) to be executed.
|
||||
*
|
||||
* <p/>Note that the local query service is used if the region is configured as a client without any pool configuration or server connectivity - otherwise the query service on the default pool
|
||||
* Note that the local query service is used if the region is configured as a client without any pool configuration or server connectivity - otherwise the query service on the default pool
|
||||
* is being used.
|
||||
*
|
||||
* @see QueryService#newQuery(String)
|
||||
@@ -90,10 +90,10 @@ public interface GemfireOperations {
|
||||
/**
|
||||
* Executes a GemFire query with the given (optional) parameters and returns the result. Note this method expects the query to return a single result; for queries that return multiple
|
||||
* elements use {@link #find(String, Object...)}.
|
||||
* <p/>
|
||||
*
|
||||
* As oppose, to the {@link #query(String)} method, this method allows for more generic queries (against multiple regions even) to be executed.
|
||||
*
|
||||
* <p/>Note that the local query service is used if the region is configured as a client without any pool configuration or server connectivity - otherwise the query service on the default pool
|
||||
* Note that the local query service is used if the region is configured as a client without any pool configuration or server connectivity - otherwise the query service on the default pool
|
||||
* is being used.
|
||||
*
|
||||
* @see QueryService#newQuery(String)
|
||||
@@ -118,4 +118,4 @@ public interface GemfireOperations {
|
||||
*/
|
||||
public abstract <T> T execute(GemfireCallback<T> action, boolean exposeNativeRegion) throws DataAccessException;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ import com.gemstone.gemfire.internal.cache.LocalRegion;
|
||||
* {@link GemFireException} into Spring {@link DataAccessException}, following the <tt>org.springframework.dao</tt>
|
||||
* exception hierarchy.
|
||||
*
|
||||
* <p/>
|
||||
*
|
||||
* The central method is <tt>execute</tt>, supporting GemFire access code implementing the GemfireCallback interface.
|
||||
* It provides dedicated handling such that neither the GemfireCallback implementation nor the calling code needs to
|
||||
* explicitly care about handling {@link Region} life-cycle exceptions.
|
||||
@@ -433,4 +433,4 @@ public class GemfireTemplate extends GemfireAccessor implements GemfireOperation
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ public class GemfireTransactionManager extends AbstractPlatformTransactionManage
|
||||
* objects (default) it manages. While copies imply additional work for
|
||||
* every fetch operation, direct references can cause dirty reads across
|
||||
* concurrent threads in the same VM, whether or not transactions are used.
|
||||
* <p/>
|
||||
*
|
||||
* One could explicitly deep copy objects before making changes (for example
|
||||
* by using {@link com.gemstone.gemfire.CopyHelper#copy(Object)} in which
|
||||
* case this setting can be set to <code>false</code>. However, unless there
|
||||
@@ -280,4 +280,4 @@ public class GemfireTransactionManager extends AbstractPlatformTransactionManage
|
||||
rollbackOnly = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import com.gemstone.gemfire.cache.Region;
|
||||
/**
|
||||
* The GemfireUtils class is a utility class encapsulating common functionality to access features and capabilities
|
||||
* of GemFire based on version and other configuration meta-data.
|
||||
* <p/>
|
||||
*
|
||||
* @author John Blum
|
||||
* @since 1.3.3
|
||||
*/
|
||||
|
||||
@@ -37,8 +37,9 @@ import com.gemstone.gemfire.cache.Declarable;
|
||||
/**
|
||||
* The LazyWiringDeclarableSupport class is an implementation of the GemFire Declarable interface that enables support
|
||||
* for wiring GemFire components with Spring bean dependencies defined in the Spring context.
|
||||
* <p/>
|
||||
*
|
||||
* @author John Blum
|
||||
* @see java.util.Properties
|
||||
* @see org.springframework.beans.factory.DisposableBean
|
||||
* @see org.springframework.context.ApplicationListener
|
||||
* @see org.springframework.context.event.ContextRefreshedEvent
|
||||
@@ -65,7 +66,7 @@ public abstract class LazyWiringDeclarableSupport implements ApplicationListener
|
||||
* SpringContextBootstrappingInitializer to receive notification when the Spring context is created and initialized
|
||||
* (refreshed) by GemFire in order for this Declarable component to be configured and properly initialized with any
|
||||
* required Spring bean dependencies.
|
||||
* <p/>
|
||||
*
|
||||
* @see org.springframework.data.gemfire.support.SpringContextBootstrappingInitializer
|
||||
* #register(org.springframework.context.ApplicationListener)
|
||||
*/
|
||||
@@ -78,7 +79,7 @@ public abstract class LazyWiringDeclarableSupport implements ApplicationListener
|
||||
* after GemFire has constructed this Declarable object during startup. It is recommended that this method
|
||||
* be called in any GemFire CacheCallback/Declarable object operational method (e.g. CacheLoader.load(..))
|
||||
* before use in order to ensure that this Declarable was properly constructed, configured and initialized.
|
||||
* <p/>
|
||||
*
|
||||
* @throws IllegalStateException if the Declarable object has not been properly configured or initialized
|
||||
* by the Spring container.
|
||||
* @see #init(java.util.Properties)
|
||||
@@ -94,7 +95,7 @@ public abstract class LazyWiringDeclarableSupport implements ApplicationListener
|
||||
* Performs the actual configuration and initialization of this Declarable object before use. This method
|
||||
* is triggered by an ApplicationEvent (specifically, the ContextRefreshedEvent) indicating that the Spring context
|
||||
* has been created and refreshed.
|
||||
* <p/>
|
||||
*
|
||||
* @param beanFactory the ConfigurableListableBeanFactory used to configure and initialize this Declarable GemFire
|
||||
* component.
|
||||
* @param parameters Properties instance containing the parameters from GemFire's configuration file
|
||||
@@ -139,7 +140,7 @@ public abstract class LazyWiringDeclarableSupport implements ApplicationListener
|
||||
/**
|
||||
* Default no operation method performed post initialization of this Declarable GemFire component to be overridden
|
||||
* by subclasses for application specific extension and behavior.
|
||||
* <p/>
|
||||
*
|
||||
* @param parameters Properties instance containing the parameters from GemFire's configuration file
|
||||
* (e.g. cache.xml) to configure and initialize this Declarable object.
|
||||
* @see #doInit(org.springframework.beans.factory.config.ConfigurableListableBeanFactory, java.util.Properties)
|
||||
@@ -150,7 +151,7 @@ public abstract class LazyWiringDeclarableSupport implements ApplicationListener
|
||||
/**
|
||||
* Initialization method called by GemFire with the configured parameters once this Declarable object has been
|
||||
* constructed during GemFire startup using an <initalizer> element in GemFire's configuration meta-data.
|
||||
* <p/>
|
||||
*
|
||||
* @param parameters the configured parameters passed from the GemFire configuration (e.g. cache.xml) to this
|
||||
* Declarable as a Properties instance.
|
||||
* @throws IllegalStateException if the Declarable object's init method has already been invoked.
|
||||
@@ -166,7 +167,7 @@ public abstract class LazyWiringDeclarableSupport implements ApplicationListener
|
||||
/**
|
||||
* Determines whether this Declarable object has been configured and initialized (i.e. the doInit method
|
||||
* has been called) by the Spring container.
|
||||
* <p/>
|
||||
*
|
||||
* @return a boolean value indicating whether this Declarable object has been configured and initialized by
|
||||
* the Spring container.
|
||||
* @see #assertInitialized()
|
||||
@@ -179,7 +180,7 @@ public abstract class LazyWiringDeclarableSupport implements ApplicationListener
|
||||
/**
|
||||
* Event handler method called when GemFire has created and initialized (refreshed) the Spring ApplicationContext
|
||||
* using the SpringContextBootstrappingInitializer Declarable class.
|
||||
* <p/>
|
||||
*
|
||||
* @param event the ContextRefreshedEvent published by the Spring ApplicationContext after it is successfully
|
||||
* created and initialized by GemFire.
|
||||
* @throws IllegalStateException if the parameters have not been passed to this Declarable (i.e. GemFire has not
|
||||
@@ -207,7 +208,7 @@ public abstract class LazyWiringDeclarableSupport implements ApplicationListener
|
||||
/**
|
||||
* When this bean gets destroyed by the Spring container, make sure this component gets unregistered from the
|
||||
* SpringContextBootstrappingInitializer.
|
||||
* <p/>
|
||||
*
|
||||
* @throws Exception if bean destruction is unsuccessful.
|
||||
* @see org.springframework.data.gemfire.support.SpringContextBootstrappingInitializer#unregister(
|
||||
* org.springframework.context.ApplicationListener)
|
||||
|
||||
@@ -65,7 +65,7 @@ public class LocalRegionFactoryBean<K, V> extends RegionFactoryBean<K, V> {
|
||||
* Resolves the Data Policy used by this "local" GemFire Region (i.e. locally Scoped; Scope.LOCAL) based on the
|
||||
* enumerated value from com.gemstone.gemfire.cache.RegionShortcuts (LOCAL, LOCAL_PERSISTENT, LOCAL_HEAP_LRU,
|
||||
* LOCAL_OVERFLOW, and LOCAL_PERSISTENT_OVERFLOW), but without consideration of the Eviction settings.
|
||||
* <p/>
|
||||
*
|
||||
* @param regionFactory the GemFire RegionFactory used to created the Local Region.
|
||||
* @param persistent a boolean value indicating whether the Local Region should persist it's data.
|
||||
* @param dataPolicy requested Data Policy as set by the user in the Spring GemFire configuration meta-data.
|
||||
|
||||
@@ -19,17 +19,22 @@ package org.springframework.data.gemfire;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
import com.gemstone.gemfire.cache.AttributesFactory;
|
||||
import com.gemstone.gemfire.cache.RegionAttributes;
|
||||
|
||||
/**
|
||||
* Spring-friendly bean for creating {@link RegionAttributes}. Eliminates the need of using
|
||||
* a XML 'factory-method' tag.
|
||||
* <p/>
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author John Blum
|
||||
* @see org.springframework.beans.factory.FactoryBean
|
||||
* @see org.springframework.beans.factory.InitializingBean
|
||||
* @see com.gemstone.gemfire.cache.AttributesFactory
|
||||
* @see com.gemstone.gemfire.cache.RegionAttributes
|
||||
*/
|
||||
public class RegionAttributesFactoryBean extends AttributesFactory implements FactoryBean<RegionAttributes>,
|
||||
InitializingBean {
|
||||
@SuppressWarnings("deprecation")
|
||||
public class RegionAttributesFactoryBean extends com.gemstone.gemfire.cache.AttributesFactory
|
||||
implements FactoryBean<RegionAttributes>, InitializingBean {
|
||||
|
||||
private RegionAttributes attributes;
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ 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;
|
||||
import com.gemstone.gemfire.cache.CacheLoader;
|
||||
@@ -66,7 +65,6 @@ public class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V> imple
|
||||
|
||||
protected final Log log = LogFactory.getLog(getClass());
|
||||
|
||||
private boolean autoStartup = true;
|
||||
private boolean close = true;
|
||||
private boolean destroy = false;
|
||||
private boolean running;
|
||||
@@ -195,9 +193,9 @@ public class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V> imple
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates that the settings for Data Policy and the 'persistent' attribute in <gfe:*-region/> elements
|
||||
* Validates that the settings for Data Policy and the 'persistent' attribute in <gfe:*-region> elements
|
||||
* are compatible.
|
||||
* <p/>
|
||||
*
|
||||
* @param resolvedDataPolicy the GemFire Data Policy resolved form the Spring GemFire XML namespace configuration
|
||||
* meta-data.
|
||||
* @see #isPersistent()
|
||||
@@ -218,7 +216,7 @@ public class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V> imple
|
||||
|
||||
/**
|
||||
* Determines whether the user explicitly set the 'persistent' attribute or not.
|
||||
* <p/>
|
||||
*
|
||||
* @return a boolean value indicating whether the user explicitly set the 'persistent' attribute to true or false.
|
||||
* @see #isPersistent()
|
||||
* @see #isNotPersistent()
|
||||
@@ -231,7 +229,7 @@ public class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V> imple
|
||||
* Returns true when the user explicitly specified a value for the persistent attribute and it is true. If the
|
||||
* persistent attribute was not explicitly specified, then the persistence setting is implicitly undefined
|
||||
* and will be determined by the Data Policy.
|
||||
* <p/>
|
||||
*
|
||||
* @return true when the user specified an explicit value for the persistent attribute and it is true;
|
||||
* false otherwise.
|
||||
* @see #isNotPersistent()
|
||||
@@ -245,7 +243,7 @@ public class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V> imple
|
||||
* Returns true when the user explicitly specified a value for the persistent attribute and it is false. If the
|
||||
* persistent attribute was not explicitly specified, then the persistence setting is implicitly undefined
|
||||
* and will be determined by the Data Policy.
|
||||
* <p/>
|
||||
*
|
||||
* @return true when the user specified an explicit value for the persistent attribute and it is false;
|
||||
* false otherwise.
|
||||
* @see #isPersistent()
|
||||
@@ -258,7 +256,7 @@ public class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V> imple
|
||||
/**
|
||||
* Creates an instance of RegionFactory using the given Cache instance used to configure and construct the Region
|
||||
* created by this FactoryBean.
|
||||
* <p/>
|
||||
*
|
||||
* @param cache the GemFire Cache instance.
|
||||
* @return a RegionFactory used to configure and construct the Region created by this FactoryBean.
|
||||
* @see com.gemstone.gemfire.cache.Cache#createRegionFactory()
|
||||
@@ -288,13 +286,13 @@ public class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V> imple
|
||||
* @see com.gemstone.gemfire.cache.RegionAttributes#getDataPolicy
|
||||
* @see com.gemstone.gemfire.cache.DataPolicy
|
||||
*/
|
||||
@SuppressWarnings({ "deprecation", "unchecked"})
|
||||
@SuppressWarnings({ "deprecation", "unchecked" })
|
||||
DataPolicy getDataPolicy(final RegionFactory regionFactory) {
|
||||
// NOTE cannot pass RegionAttributes.class as the "targetType" on the second invocation of getFieldValue(..)
|
||||
// since the "regionAttributes" field is naively of the implementation class type rather than the interface
|
||||
// type... so much for programming to interfaces.
|
||||
return ((RegionAttributes) getFieldValue(getFieldValue(regionFactory, "attrsFactory", AttributesFactory.class),
|
||||
"regionAttributes", null)).getDataPolicy();
|
||||
return ((RegionAttributes) getFieldValue(getFieldValue(regionFactory, "attrsFactory",
|
||||
com.gemstone.gemfire.cache.AttributesFactory.class), "regionAttributes", null)).getDataPolicy();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -313,7 +311,7 @@ public class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V> imple
|
||||
* user specified a RegionShortcut. This method gets called by the createRegionFactory method depending upon
|
||||
* the value passed to the Cache.createRegionFactory() method (i.e. whether there was a RegionShortcut specified
|
||||
* or not).
|
||||
* <p/>
|
||||
*
|
||||
* @param <K> the Class type fo the Region key.
|
||||
* @param <V> the Class type of the Region value.
|
||||
* @param regionFactory the GemFire RegionFactory used to configure and create the Region that is the product
|
||||
@@ -415,14 +413,14 @@ public class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V> imple
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
void validateRegionAttributes(final RegionAttributes regionAttributes) {
|
||||
AttributesFactory.validateAttributes(regionAttributes);
|
||||
com.gemstone.gemfire.cache.AttributesFactory.validateAttributes(regionAttributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Post-process the RegionFactory used to create the GemFire Region for this factory bean during the initialization
|
||||
* process. The RegionFactory is already configured and initialized by the factory bean before this method
|
||||
* is invoked.
|
||||
* <p/>
|
||||
*
|
||||
* @param regionFactory the GemFire RegionFactory used to create the Region for post-processing.
|
||||
* @see com.gemstone.gemfire.cache.RegionFactory
|
||||
*/
|
||||
@@ -432,7 +430,7 @@ public class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V> imple
|
||||
/**
|
||||
* Post-process the Region for this factory bean during the initialization process. The Region is
|
||||
* already configured and initialized by the factory bean before this method is invoked.
|
||||
* <p/>
|
||||
*
|
||||
* @param region the GemFire Region to post-process.
|
||||
* @see com.gemstone.gemfire.cache.Region
|
||||
*/
|
||||
@@ -442,7 +440,7 @@ public class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V> imple
|
||||
/**
|
||||
* Validates and sets the Data Policy on the RegionFactory used to create and configure the Region from this
|
||||
* FactoryBean.
|
||||
* <p/>
|
||||
*
|
||||
* @param regionFactory the RegionFactory used by this FactoryBean to create and configure the Region.
|
||||
* @param persistent a boolean value indicating whether the Region should be persistent and persist it's
|
||||
* data to disk.
|
||||
@@ -464,7 +462,7 @@ public class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V> imple
|
||||
/**
|
||||
* Validates the configured Data Policy and may override it, taking into account the 'persistent' attribute
|
||||
* and constraints for the Region type.
|
||||
* <p/>
|
||||
*
|
||||
* @param regionFactory the GemFire RegionFactory used to create the desired Region.
|
||||
* @param persistent a boolean value indicating whether the Region should persist it's data to disk.
|
||||
* @param dataPolicy requested Data Policy as set by the user in the Spring GemFire configuration meta-data.
|
||||
@@ -506,7 +504,7 @@ public class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V> imple
|
||||
|
||||
/**
|
||||
* The list of AsyncEventQueues to use with this Region.
|
||||
* <p/>
|
||||
*
|
||||
* @param asyncEventQueues defined as Object for backwards compatibility with Gemfire 6.
|
||||
*/
|
||||
public void setAsyncEventQueues(Object[] asyncEventQueues) {
|
||||
@@ -575,7 +573,7 @@ public class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V> imple
|
||||
|
||||
/**
|
||||
* Sets the DataPolicy of the Region.
|
||||
* <p/>
|
||||
*
|
||||
* @param dataPolicy the GemFire DataPolicy to use when configuring the Region.
|
||||
* @since 1.4.0
|
||||
*/
|
||||
@@ -585,7 +583,7 @@ public class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V> imple
|
||||
|
||||
/**
|
||||
* Sets the DataPolicy of the Region as a String.
|
||||
* <p/>
|
||||
*
|
||||
* @param dataPolicyName the name of the DataPolicy (e.g. REPLICATE, PARTITION)
|
||||
* @see #setDataPolicy(com.gemstone.gemfire.cache.DataPolicy)
|
||||
* @deprecated as of 1.4.0, use setDataPolicy(:DataPolicy) instead.
|
||||
@@ -596,7 +594,7 @@ public class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V> imple
|
||||
|
||||
/**
|
||||
* Sets the name of Disk Store used for either overflow or persistence, or both.
|
||||
* <p/>
|
||||
*
|
||||
* @param diskStoreName the name of the Disk Store bean in context used for overflow/persistence.
|
||||
*/
|
||||
public void setDiskStoreName(String diskStoreName) {
|
||||
@@ -644,7 +642,7 @@ public class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V> imple
|
||||
|
||||
/**
|
||||
* Configures the Region with a RegionShortcut.
|
||||
* <p/>
|
||||
*
|
||||
* @param shortcut the RegionShortcut used to configure pre-defined default for the Region created
|
||||
* by this FactoryBean.
|
||||
* @see com.gemstone.gemfire.cache.RegionShortcut
|
||||
@@ -725,7 +723,7 @@ public class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V> imple
|
||||
*/
|
||||
@Override
|
||||
public boolean isAutoStartup() {
|
||||
return this.autoStartup;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -31,7 +31,7 @@ import com.gemstone.gemfire.cache.Region;
|
||||
/**
|
||||
* Simple FactoryBean for retrieving generic GemFire {@link Region}s. If the Region does not exist,
|
||||
* an exception is thrown. For declaring and configuring new regions, see {@link RegionFactoryBean}.
|
||||
* <p/>
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author John Blum
|
||||
*/
|
||||
@@ -107,7 +107,7 @@ public class RegionLookupFactoryBean<K, V> implements FactoryBean<Region<K, V>>,
|
||||
/**
|
||||
* Sets the name of the Cache Region based on the bean 'id' attribute. If no Region is found for the given name,
|
||||
* a new one will be created.
|
||||
* <p/>
|
||||
*
|
||||
* @param name the name of this bean (Region) in the application context (bean factory).
|
||||
* @see org.springframework.beans.factory.BeanNameAware#setBeanName(String)
|
||||
*/
|
||||
@@ -117,7 +117,7 @@ public class RegionLookupFactoryBean<K, V> implements FactoryBean<Region<K, V>>,
|
||||
|
||||
/**
|
||||
* Sets a reference to the Cache used to create the Region.
|
||||
* <p/>
|
||||
*
|
||||
* @param cache a reference to the Cache.
|
||||
* @see org.springframework.data.gemfire.CacheFactoryBean
|
||||
* @see com.gemstone.gemfire.cache.GemFireCache
|
||||
@@ -129,7 +129,7 @@ public class RegionLookupFactoryBean<K, V> implements FactoryBean<Region<K, V>>,
|
||||
/**
|
||||
* Sets the name of the Cache Region based on the bean 'name' attribute. If no Region is found with the given name,
|
||||
* a new one will be created. If no name is given, the value of the 'beanName' property will be used.
|
||||
* <p/>
|
||||
*
|
||||
* @param name the region name
|
||||
* @see #setBeanName(String)
|
||||
* @see com.gemstone.gemfire.cache.Region#getFullPath()
|
||||
@@ -140,7 +140,7 @@ public class RegionLookupFactoryBean<K, V> implements FactoryBean<Region<K, V>>,
|
||||
|
||||
/**
|
||||
* Sets a reference to the parent Region if this FactoryBean represents a GemFire Cache Sub-Region.
|
||||
* <p/>
|
||||
*
|
||||
* @param parent a reference to the parent Region if this Region is a Sub-Region.
|
||||
* @see com.gemstone.gemfire.cache.Region
|
||||
*/
|
||||
@@ -150,7 +150,7 @@ public class RegionLookupFactoryBean<K, V> implements FactoryBean<Region<K, V>>,
|
||||
|
||||
/**
|
||||
* Gets a reference to the parent Region if this FactoryBean represents a GemFire Cache Sub-Region.
|
||||
* <p/>
|
||||
*
|
||||
* @return a reference to the parent Region or null if this Region is not a Sub-Region.
|
||||
* @see com.gemstone.gemfire.cache.Region
|
||||
*/
|
||||
@@ -161,7 +161,7 @@ public class RegionLookupFactoryBean<K, V> implements FactoryBean<Region<K, V>>,
|
||||
/**
|
||||
* Sets the name of the Cache Region as expected by GemFire. If no Region is found with the given name, a new one
|
||||
* will be created. If no name is given, the value of the 'name' property will be used.
|
||||
* <p/>
|
||||
*
|
||||
* @param regionName a String indicating the name of the Region in GemFire.
|
||||
* @see #setName(String)
|
||||
* @see com.gemstone.gemfire.cache.Region#getName()
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.gemstone.gemfire.cache.RegionShortcut;
|
||||
/**
|
||||
* The RegionShortcutConverter class is a Spring Converter implementation converting String value Region Shortcut
|
||||
* representations into actual GemFire RegionShortcut enumerated values.
|
||||
* <p/>
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.springframework.core.convert.converter.Converter
|
||||
* @see com.gemstone.gemfire.cache.RegionShortcut
|
||||
@@ -35,7 +35,7 @@ public class RegionShortcutConverter implements Converter<String, RegionShortcut
|
||||
/**
|
||||
* Converts the String value to upper case, trimming all whitespace. This method guards against null values
|
||||
* and returns the "null" String if value is null.
|
||||
* <p/>
|
||||
*
|
||||
* @param value the String to convert to a trimmed, upper case value.
|
||||
* @return a trimmed, upper case value of the specified String, or "null" if the String value reference is null.
|
||||
* @see java.lang.String#toUpperCase()
|
||||
@@ -48,7 +48,7 @@ public class RegionShortcutConverter implements Converter<String, RegionShortcut
|
||||
|
||||
/**
|
||||
* Converts the source String representation of a Region Shortcut into a RegionShortcut enumerated value.
|
||||
* <p/>
|
||||
*
|
||||
* @param source the String representation of the Region Shortcut to convert.
|
||||
* @return a RegionShortcut enumerated value for the String representation.
|
||||
* @throws IllegalArgumentException if the String source is not a valid RegionShortcut enumerated value.
|
||||
|
||||
@@ -23,7 +23,6 @@ import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import com.gemstone.gemfire.cache.AttributesFactory;
|
||||
import com.gemstone.gemfire.cache.CacheListener;
|
||||
import com.gemstone.gemfire.cache.Region;
|
||||
import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue;
|
||||
@@ -31,7 +30,7 @@ import com.gemstone.gemfire.cache.wan.GatewaySender;
|
||||
|
||||
/**
|
||||
* FactoryBean for creating a Gemfire sub-Regions.
|
||||
* <p/>
|
||||
*
|
||||
* @author David Turanski
|
||||
* @author John Blum
|
||||
* @param <K> Region Key Type
|
||||
@@ -40,9 +39,9 @@ import com.gemstone.gemfire.cache.wan.GatewaySender;
|
||||
* (e.g. ReplicatedRegionFactoryBean) instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("deprecation")
|
||||
public class SubRegionFactoryBean<K, V> extends AttributesFactory<K, V> implements FactoryBean<Region<K, V>>,
|
||||
InitializingBean {
|
||||
@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());
|
||||
|
||||
@@ -56,7 +55,6 @@ public class SubRegionFactoryBean<K, V> extends AttributesFactory<K, V> implemen
|
||||
private Region<?, ?> parentRegion;
|
||||
private Region<K, V> subRegion;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private String name;
|
||||
private String regionName;
|
||||
|
||||
@@ -125,8 +123,8 @@ public class SubRegionFactoryBean<K, V> extends AttributesFactory<K, V> implemen
|
||||
|
||||
/**
|
||||
* 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 {@link #setAttributes(com.gemstone.gemfire.cache.RegionAttributes)}.
|
||||
* 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
|
||||
*/
|
||||
@@ -134,10 +132,6 @@ public class SubRegionFactoryBean<K, V> extends AttributesFactory<K, V> implemen
|
||||
this.cacheListeners = cacheListeners;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param gatewaySenders
|
||||
*/
|
||||
public void setGatewaySenders(Object[] gatewaySenders) {
|
||||
this.gatewaySenders = gatewaySenders;
|
||||
}
|
||||
@@ -145,7 +139,6 @@ public class SubRegionFactoryBean<K, V> extends AttributesFactory<K, V> implemen
|
||||
/**
|
||||
* Set to true if the subregion should already exist, e.g., specified by
|
||||
* <lookup-region>
|
||||
* @param lookupOnly
|
||||
*/
|
||||
public void setLookupOnly(boolean lookupOnly) {
|
||||
this.lookupOnly = lookupOnly;
|
||||
@@ -153,7 +146,6 @@ public class SubRegionFactoryBean<K, V> extends AttributesFactory<K, V> implemen
|
||||
|
||||
/**
|
||||
* Set the bean name - the same as the subregion full path
|
||||
* @param name
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
@@ -161,7 +153,6 @@ public class SubRegionFactoryBean<K, V> extends AttributesFactory<K, V> implemen
|
||||
|
||||
/**
|
||||
* Set the simple name of the region
|
||||
* @param regionName
|
||||
*/
|
||||
public void setRegionName(String regionName) {
|
||||
this.regionName = regionName;
|
||||
@@ -169,7 +160,6 @@ public class SubRegionFactoryBean<K, V> extends AttributesFactory<K, V> implemen
|
||||
|
||||
/**
|
||||
* Set the parent Region
|
||||
* @param parent
|
||||
*/
|
||||
public void setParent(Region<?, ?> parent) {
|
||||
this.parentRegion = parent;
|
||||
|
||||
@@ -45,7 +45,7 @@ import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
|
||||
|
||||
/**
|
||||
* Client extension for GemFire Regions.
|
||||
* <p/>
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author David Turanski
|
||||
* @author John Blum
|
||||
@@ -202,9 +202,9 @@ public class ClientRegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V>
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates that the settings for ClientRegionShortcut and the 'persistent' attribute in <gfe:*-region/> elements
|
||||
* Validates that the settings for ClientRegionShortcut and the 'persistent' attribute in <gfe:*-region> elements
|
||||
* are compatible.
|
||||
* <p/>
|
||||
*
|
||||
* @param resolvedShortcut the GemFire ClientRegionShortcut resolved form the Spring GemFire XML namespace
|
||||
* configuration meta-data.
|
||||
* @see #isPersistent()
|
||||
@@ -226,9 +226,9 @@ public class ClientRegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V>
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates that the settings for Data Policy and the 'persistent' attribute in <gfe:*-region/> elements
|
||||
* Validates that the settings for Data Policy and the 'persistent' attribute in <gfe:*-region> elements
|
||||
* are compatible.
|
||||
* <p/>
|
||||
*
|
||||
* @param resolvedDataPolicy the GemFire Data Policy resolved form the Spring GemFire XML namespace configuration
|
||||
* meta-data.
|
||||
* @see #isPersistent()
|
||||
@@ -402,7 +402,7 @@ public class ClientRegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V>
|
||||
* Indicates whether the region referred by this factory bean, will be
|
||||
* closed on shutdown (default true). Note: destroy and close are mutually
|
||||
* exclusive. Enabling one will automatically disable the other.
|
||||
* <p/>
|
||||
*
|
||||
* @param close whether to close or not the region
|
||||
* @see #setDestroy(boolean)
|
||||
*/
|
||||
@@ -419,7 +419,7 @@ public class ClientRegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V>
|
||||
* Indicates whether the region referred by this factory bean will be
|
||||
* destroyed on shutdown (default false). Note: destroy and close are
|
||||
* mutually exclusive. Enabling one will automatically disable the other.
|
||||
* <p/>
|
||||
*
|
||||
* @param destroy whether or not to destroy the region
|
||||
* @see #setClose(boolean)
|
||||
*/
|
||||
@@ -441,7 +441,7 @@ public class ClientRegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V>
|
||||
|
||||
/**
|
||||
* Sets the CacheLoader used to load data local to the client's Region on cache misses.
|
||||
* <p/>
|
||||
*
|
||||
* @param cacheLoader a GemFire CacheLoader used to load data into the client Region.
|
||||
* @see com.gemstone.gemfire.cache.CacheLoader
|
||||
*/
|
||||
@@ -451,7 +451,7 @@ public class ClientRegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V>
|
||||
|
||||
/**
|
||||
* Sets the CacheWriter used to perform a synchronous write-behind when data is put into the client's Region.
|
||||
* <p/>
|
||||
*
|
||||
* @param cacheWriter the GemFire CacheWriter used to perform synchronous write-behinds on put ops.
|
||||
* @see com.gemstone.gemfire.cache.CacheWriter
|
||||
*/
|
||||
@@ -461,7 +461,7 @@ public class ClientRegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V>
|
||||
|
||||
/**
|
||||
* Sets the Data Policy. Used only when a new Region is created.
|
||||
* <p/>
|
||||
*
|
||||
* @param dataPolicy the client Region's Data Policy.
|
||||
* @see com.gemstone.gemfire.cache.DataPolicy
|
||||
*/
|
||||
@@ -471,7 +471,7 @@ public class ClientRegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V>
|
||||
|
||||
/**
|
||||
* Sets the name of disk store to use for overflow and persistence
|
||||
* <p/>
|
||||
*
|
||||
* @param diskStoreName a String specifying the 'name' of the client Region Disk Store.
|
||||
*/
|
||||
public void setDiskStoreName(String diskStoreName) {
|
||||
@@ -480,7 +480,7 @@ public class ClientRegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V>
|
||||
|
||||
/**
|
||||
* An alternate way to set the Data Policy, using the String name of the enumerated value.
|
||||
* <p/>
|
||||
*
|
||||
* @param dataPolicyName the enumerated value String name of the Data Policy.
|
||||
* @see com.gemstone.gemfire.cache.DataPolicy
|
||||
* @see #setDataPolicy(com.gemstone.gemfire.cache.DataPolicy)
|
||||
@@ -523,7 +523,7 @@ public class ClientRegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V>
|
||||
* Sets the snapshots used for loading a newly <i>created</i> region. That
|
||||
* is, the snapshot will be used <i>only</i> when a new region is created -
|
||||
* if the region already exists, no loading will be performed.
|
||||
* <p/>
|
||||
*
|
||||
* @param snapshot the snapshot to set
|
||||
* @see #setName(String)
|
||||
*/
|
||||
|
||||
@@ -52,6 +52,7 @@ import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
|
||||
*
|
||||
* @author Costin Leau
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class PoolFactoryBean implements FactoryBean<Pool>, InitializingBean,
|
||||
DisposableBean, BeanNameAware, BeanFactoryAware {
|
||||
|
||||
@@ -115,9 +116,10 @@ public class PoolFactoryBean implements FactoryBean<Pool>, InitializingBean,
|
||||
try {
|
||||
ClientCacheFactoryBean clientCacheFactoryBean = beanFactory.getBean(ClientCacheFactoryBean.class);
|
||||
properties = clientCacheFactoryBean.getProperties();
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
catch (Exception ignore) {
|
||||
}
|
||||
|
||||
connectToTemporaryDs(properties);
|
||||
|
||||
}
|
||||
@@ -393,10 +395,12 @@ public class PoolFactoryBean implements FactoryBean<Pool>, InitializingBean,
|
||||
* initialize a client-like Distributed System before initializing
|
||||
* the pool
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
static void connectToTemporaryDs(Properties properties) {
|
||||
Properties props = properties != null? (Properties) properties.clone() : new Properties();
|
||||
props.setProperty("mcast-port", "0");
|
||||
props.setProperty("locators", "");
|
||||
DistributedSystem.connect(props);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Abstract base class encapsulating functionality common to all Region Parsers.
|
||||
* <p/>
|
||||
*
|
||||
* @author David Turanski
|
||||
* @author John Blum
|
||||
*/
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Namespace parser for "cache-server" element.
|
||||
* <p/>
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author John Blum
|
||||
*/
|
||||
|
||||
@@ -31,9 +31,9 @@ import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Parser for <client-region;gt; bean definitions.
|
||||
* <p/>
|
||||
*
|
||||
* To avoid eager evaluations, the region interests are declared as nested definition.
|
||||
* <p/>
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author David Turanski
|
||||
* @author John Blum
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Parser for <disk-store> bean definitions.
|
||||
* <p/>
|
||||
*
|
||||
* @author David Turanski
|
||||
* @author John Blum
|
||||
*/
|
||||
|
||||
@@ -19,9 +19,6 @@ package org.springframework.data.gemfire.config;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
import com.gemstone.gemfire.cache.DiskWriteAttributes;
|
||||
import com.gemstone.gemfire.cache.DiskWriteAttributesFactory;
|
||||
|
||||
/**
|
||||
* Simple utility class used for defining nested factory-method like definitions
|
||||
* w/o polluting the container with useless beans.
|
||||
@@ -30,11 +27,12 @@ import com.gemstone.gemfire.cache.DiskWriteAttributesFactory;
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
class DiskWriteAttributesFactoryBean implements FactoryBean<DiskWriteAttributes>, InitializingBean {
|
||||
@SuppressWarnings({ "deprecation", "unused" })
|
||||
class DiskWriteAttributesFactoryBean implements FactoryBean<com.gemstone.gemfire.cache.DiskWriteAttributes>, InitializingBean {
|
||||
|
||||
private DiskWriteAttributes attributes;
|
||||
private com.gemstone.gemfire.cache.DiskWriteAttributes attributes;
|
||||
|
||||
private DiskWriteAttributesFactory attrFactory;
|
||||
private com.gemstone.gemfire.cache.DiskWriteAttributesFactory attrFactory;
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
@@ -42,13 +40,13 @@ class DiskWriteAttributesFactoryBean implements FactoryBean<DiskWriteAttributes>
|
||||
}
|
||||
|
||||
@Override
|
||||
public DiskWriteAttributes getObject() throws Exception {
|
||||
public com.gemstone.gemfire.cache.DiskWriteAttributes getObject() throws Exception {
|
||||
return attributes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getObjectType() {
|
||||
return (attributes != null ? attributes.getClass() : DiskWriteAttributes.class);
|
||||
return (attributes != null ? attributes.getClass() : com.gemstone.gemfire.cache.DiskWriteAttributes.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -56,7 +54,8 @@ class DiskWriteAttributesFactoryBean implements FactoryBean<DiskWriteAttributes>
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setDiskAttributesFactory(DiskWriteAttributesFactory dwaf) {
|
||||
public void setDiskAttributesFactory(com.gemstone.gemfire.cache.DiskWriteAttributesFactory dwaf) {
|
||||
this.attrFactory = dwaf;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import com.gemstone.gemfire.cache.util.ObjectSizer;
|
||||
|
||||
/**
|
||||
* Simple utility class used for defining nested factory-method like definitions w/o polluting the container with useless beans.
|
||||
* <p/>
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author John Blum
|
||||
* @see org.springframework.beans.factory.FactoryBean
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Parser for <local-region;gt; bean definitions.
|
||||
* <p/>
|
||||
*
|
||||
* @author David Turanski
|
||||
* @author John Blum
|
||||
*/
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Parser for <lookup-region;gt; definitions.
|
||||
* <p/>
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author David Turanski
|
||||
* @author John Blum
|
||||
|
||||
@@ -39,7 +39,7 @@ import com.gemstone.gemfire.cache.Scope;
|
||||
|
||||
/**
|
||||
* Utilities used by the Spring Data GemFire XML Namespace parsers.
|
||||
* <p/>
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author David Turanski
|
||||
* @author Lyndon Adams
|
||||
@@ -179,7 +179,7 @@ abstract class ParsingUtils {
|
||||
|
||||
/**
|
||||
* Parses the eviction sub-element. Populates the given attribute factory with the proper attributes.
|
||||
* <p/>
|
||||
*
|
||||
* @param parserContext the context used for parsing the XML document.
|
||||
* @param element the XML elements being parsed.
|
||||
* @param regionAttributesBuilder the Region Attributes builder.
|
||||
@@ -221,7 +221,7 @@ abstract class ParsingUtils {
|
||||
|
||||
/**
|
||||
* Parses the subscription sub-element. Populates the given attribute factory with the proper attributes.
|
||||
* <p/>
|
||||
*
|
||||
* @param parserContext the context used while parsing the XML document.
|
||||
* @param element the XML element being parsed.
|
||||
* @param regionAttributesBuilder the Region Attributes builder.
|
||||
@@ -267,7 +267,7 @@ abstract class ParsingUtils {
|
||||
|
||||
/**
|
||||
* Parses the expiration sub-elements. Populates the given attribute factory with proper attributes.
|
||||
* <p/>
|
||||
*
|
||||
* @param parserContext the context used while parsing the XML document.
|
||||
* @param element the XML element being parsed.
|
||||
* @param regionAttributesBuilder the Region Attributes builder.
|
||||
|
||||
@@ -31,10 +31,10 @@ import org.springframework.util.xml.DomUtils;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Parser for <partitioned-region;gt; bean definitions.
|
||||
* <p/>
|
||||
* Parser for <partitioned-region> bean definitions.
|
||||
*
|
||||
* To avoid eager evaluations, the region attributes are declared as a nested definition.
|
||||
* <p/>
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author David Turanski
|
||||
* @author John Blum
|
||||
|
||||
@@ -33,7 +33,7 @@ import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue;
|
||||
* Region and Disk Store beans in the Spring container to form a dependency on the Cache's PDX Disk Store bean.
|
||||
* A persistent Region may contain PDX typed data, in which case, the PDX type meta-data stored to disk needs to be
|
||||
* loaded before the Region having PDX data is loaded from disk.
|
||||
* <p/>
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.springframework.beans.factory.config.BeanFactoryPostProcessor
|
||||
* @see org.springframework.beans.factory.config.ConfigurableListableBeanFactory
|
||||
@@ -67,7 +67,7 @@ public class PdxDiskStoreAwareBeanFactoryPostProcessor implements BeanFactoryPos
|
||||
* or requirement on the PDX-based Disk Store being present before the bean itself can be processed and created.
|
||||
* For instance, Regions that might contained PDX-based Key types require the PDX type meta-data to be loaded
|
||||
* before the Region's data (Keys) are accessed.
|
||||
* <p/>
|
||||
*
|
||||
* @param beanFactory the BeanFactory used to evaluate beans in context for PDX Disk Store dependencies.
|
||||
* @param beanTypes an array of Class types indicating the type of beans to evaluate.
|
||||
* @see org.springframework.beans.factory.config.ConfigurableListableBeanFactory#getBeanNamesForType(Class)
|
||||
@@ -94,7 +94,7 @@ public class PdxDiskStoreAwareBeanFactoryPostProcessor implements BeanFactoryPos
|
||||
/**
|
||||
* Adds the PDX Disk Store bean name as a dependency at the beginning of the list of dependencies declared
|
||||
* by the Bean.
|
||||
* <p/>
|
||||
*
|
||||
* @param beanDefinition the BeanDefinition to add the PDX Disk Store dependency to.
|
||||
* @see #getDependsOn(org.springframework.beans.factory.config.BeanDefinition)
|
||||
* @see org.springframework.beans.factory.config.BeanDefinition#setDependsOn(String[])
|
||||
@@ -107,7 +107,7 @@ public class PdxDiskStoreAwareBeanFactoryPostProcessor implements BeanFactoryPos
|
||||
/**
|
||||
* Gets the current list of dependencies declared in the BeanDefinition for the Bean, returning an
|
||||
* empty String array if the dependsOn property is null.
|
||||
* <p/>
|
||||
*
|
||||
* @param beanDefinition the BeanDefinition of the Bean containing the dependencies.
|
||||
* @return an array of Bean names that this Bean depends on, or an empty String array if the dependencies
|
||||
* are undefined.
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Parser for <replicated-region;gt; definitions.
|
||||
* <p/>
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author David Turanski
|
||||
* @author John Blum
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.lang.annotation.Target;
|
||||
/**
|
||||
*
|
||||
* Used to inject a set of cache keys into a function execution, The annotated parameter must be of type
|
||||
* {@link Set}. This is used by the function invocation to specify a set of keys of interest and also to define
|
||||
* {@link java.util.Set}. This is used by the function invocation to specify a set of keys of interest and also to define
|
||||
* an additional parameter on the function implementation method containing the filter.
|
||||
* @author David Turanski
|
||||
*
|
||||
|
||||
@@ -20,12 +20,11 @@ import java.lang.annotation.Target;
|
||||
/**
|
||||
*
|
||||
* Used to inject Region data into a function execution. The annotated parameter must be of type
|
||||
* {@link Map}. The contents depends on the region configuration (for a partitioned region, this will
|
||||
* {@link java.util.Map}. The contents depends on the region configuration (for a partitioned region, this will
|
||||
* contain only entries for the local partition)
|
||||
* and any filters configured for the function context.
|
||||
*
|
||||
* @author David Turanski
|
||||
*
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.PARAMETER})
|
||||
|
||||
@@ -23,12 +23,11 @@ import org.springframework.context.annotation.Import;
|
||||
|
||||
/**
|
||||
*
|
||||
* Enables Gemfire annotated function implementations. Causes the container to
|
||||
* discover any beans that are annotated with {code} @GemfireFunction {code}, wrap them in
|
||||
* a {@link PojoFunctionWrapper}, and register them with the cache.
|
||||
* Enables Gemfire annotated function implementations. Causes the container to discover any beans that are annotated
|
||||
* with {code} @GemfireFunction {code}, wrap them in a
|
||||
* {@link org.springframework.data.gemfire.function.PojoFunctionWrapper}, and register them with the cache.
|
||||
*
|
||||
* @author David Turanski
|
||||
*
|
||||
*/
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
||||
@@ -20,8 +20,6 @@ import com.gemstone.gemfire.cache.execute.Function;
|
||||
* An interface for invoking Gemfire functions
|
||||
*
|
||||
* @author David Turanski
|
||||
*
|
||||
* @param <T> the preferred return type
|
||||
*/
|
||||
public interface GemfireFunctionOperations {
|
||||
|
||||
@@ -66,10 +64,10 @@ public interface GemfireFunctionOperations {
|
||||
|
||||
|
||||
/**
|
||||
* Execute a function using a native GemFire {@link Execution} instance
|
||||
* Execute a function using a native GemFire {@link com.gemstone.gemfire.cache.execute.Execution} instance
|
||||
* @param callback a callback providing the execution instance
|
||||
* @return the execution result
|
||||
*/
|
||||
public abstract <T> T execute(GemfireFunctionCallback<T> callback);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ import com.gemstone.gemfire.cache.execute.FunctionService;
|
||||
* A proxy Factory Bean for all non-region function execution interfaces
|
||||
*
|
||||
* @author David Turanski
|
||||
*
|
||||
*/
|
||||
public class GemfireFunctionProxyFactoryBean implements FactoryBean<Object>, MethodInterceptor, BeanClassLoaderAware {
|
||||
|
||||
@@ -53,11 +52,9 @@ public class GemfireFunctionProxyFactoryBean implements FactoryBean<Object>, Met
|
||||
|
||||
/**
|
||||
* @param serviceInterface the proxied interface
|
||||
* @param functionId the associated function id (must be a function registered by this id with the GemFire {@link FunctionService}
|
||||
* @param gemfireFunctionOperations an interface used to delegate the function invocation (typically a GemFire function template)
|
||||
*/
|
||||
public GemfireFunctionProxyFactoryBean(Class<?> serviceInterface,
|
||||
GemfireFunctionOperations gemfireFunctionOperations) {
|
||||
public GemfireFunctionProxyFactoryBean(Class<?> serviceInterface, GemfireFunctionOperations gemfireFunctionOperations) {
|
||||
Assert.notNull(serviceInterface, "'serviceInterface' must not be null");
|
||||
Assert.isTrue(serviceInterface.isInterface(), "'serviceInterface' must be an interface");
|
||||
this.serviceInterface = serviceInterface;
|
||||
|
||||
@@ -18,8 +18,6 @@ import com.gemstone.gemfire.cache.execute.Function;
|
||||
|
||||
/**
|
||||
* @author David Turanski
|
||||
*
|
||||
* @param <T>
|
||||
*/
|
||||
public interface GemfireOnRegionOperations extends GemfireFunctionOperations {
|
||||
|
||||
@@ -28,4 +26,4 @@ public interface GemfireOnRegionOperations extends GemfireFunctionOperations {
|
||||
public abstract void executeWithNoResult(String functionId, Set<?> keys, Object... args);
|
||||
public abstract <T> T executeAndextract(String functionId, Set<?> keys, Object... args);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,18 +43,18 @@ import com.gemstone.gemfire.cache.query.CqQuery;
|
||||
* Allows listener methods to operate on event content types, completely
|
||||
* independent from the GemFire API.
|
||||
*
|
||||
* <p/>Modeled as much as possible after the JMS MessageListenerAdapter in
|
||||
* Modeled as much as possible after the JMS MessageListenerAdapter in
|
||||
* Spring Framework.
|
||||
*
|
||||
* <p>By default, the content of incoming GemFire events gets extracted before
|
||||
* being passed into the target listener method, to let the target method
|
||||
* operate on event content types such as Object or Operation instead of
|
||||
* the raw {@link CqEvent}.
|
||||
* the raw {@link CqEvent}.</p>
|
||||
*
|
||||
* <p>Find below some examples of method signatures compliant with this
|
||||
* adapter class. This first example handles all <code>CqEvent</code> types
|
||||
* and gets passed the contents of each <code>event</code> type as an
|
||||
* argument.
|
||||
* argument.</p>
|
||||
*
|
||||
* <pre class="code">public interface PojoListener {
|
||||
* void handleEvent(CqEvent event);
|
||||
@@ -69,7 +69,6 @@ import com.gemstone.gemfire.cache.query.CqQuery;
|
||||
* @author Juergen Hoeller
|
||||
* @author Costin Leau
|
||||
* @author Oliver Gierke
|
||||
* @see org.springframework.jms.listener.adapter.MessageListenerAdapter
|
||||
*/
|
||||
public class ContinuousQueryListenerAdapter implements ContinuousQueryListener {
|
||||
|
||||
@@ -334,4 +333,4 @@ public class ContinuousQueryListenerAdapter implements ContinuousQueryListener {
|
||||
throw new GemfireListenerExecutionFailedException("Failed to invoke target method '" + methodName, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public @interface Region {
|
||||
/**
|
||||
* The name, or fully-qualified bean name of the {@link com.gemstone.gemfire.cache.Region} the entity
|
||||
* shall be stored in (e.g. "Users", or "/Local/Admin/Users").
|
||||
* <p/>
|
||||
*
|
||||
* @return the name or qualified path of the Region the entity shall be persisted in.
|
||||
*/
|
||||
String value() default "";
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.mapping;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -27,7 +28,7 @@ import com.gemstone.gemfire.cache.Region;
|
||||
|
||||
/**
|
||||
* Simple value object to abstract access to regions by name and mapped type.
|
||||
* <p/>
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author John Blum
|
||||
*/
|
||||
@@ -79,7 +80,7 @@ public class Regions implements Iterable<Region<?, ?>> {
|
||||
|
||||
/**
|
||||
* Returns the {@link Region} with the given name or path.
|
||||
* <p/>
|
||||
*
|
||||
* @param namePath must not be {@literal null}, and either identifies the Region by name or the fully-qualified path.
|
||||
* @return the {@link Region} with the given name or path.
|
||||
*/
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
|
||||
/**
|
||||
*
|
||||
* Package providing integration of
|
||||
* Package providing integration of
|
||||
* <a href="http://www.gemstone.com/products/gemfire">GemFire</a>
|
||||
* with Spring concepts.
|
||||
*
|
||||
* <p/>Contains helper classes, a template plus callback for GemFire
|
||||
* Contains helper classes, a template plus callback for GemFire
|
||||
* access and an implementation of Spring's transaction SPI for local
|
||||
* GemFire transactions.
|
||||
*
|
||||
*/
|
||||
package org.springframework.data.gemfire;
|
||||
|
||||
|
||||
@@ -17,14 +17,31 @@ package org.springframework.data.gemfire.repository;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
/**
|
||||
* Gemfire-specific extension of the {@link CrudRepository} interface.
|
||||
*
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author John Blum
|
||||
* @see java.io.Serializable
|
||||
* @see org.springframework.data.repository.CrudRepository
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public interface GemfireRepository<T, ID extends Serializable> extends CrudRepository<T, ID> {
|
||||
|
||||
/**
|
||||
* Returns all entities sorted by the given options.
|
||||
*
|
||||
* @param sort the Spring Data Commons Sort type defining the ordering criteria.
|
||||
* @return all entities sorted by the given options.
|
||||
* @see org.springframework.data.repository.PagingAndSortingRepository#findAll(org.springframework.data.domain.Sort)
|
||||
* @see org.springframework.data.domain.Sort
|
||||
* @see java.lang.Iterable
|
||||
*/
|
||||
Iterable<T> findAll(Sort sort);
|
||||
|
||||
T save(Wrapper<T, ID> wrapper);
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.springframework.data.repository.core.support.PersistentEntityInformat
|
||||
/**
|
||||
* Implementation of {@link GemfireEntityInformation} to return the region name stored in the backing
|
||||
* {@link PersistentEntity}.
|
||||
* <p/>
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author John Blum
|
||||
* @see org.springframework.data.gemfire.mapping.GemfirePersistentEntity
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.gemfire.GemfireCallback;
|
||||
import org.springframework.data.gemfire.GemfireTemplate;
|
||||
import org.springframework.data.gemfire.repository.GemfireRepository;
|
||||
@@ -101,12 +102,44 @@ public class SimpleGemfireRepository<T, ID extends Serializable> implements Gemf
|
||||
@Override
|
||||
public Collection<T> findAll() {
|
||||
SelectResults<T> results = template.find("select * from " + template.getRegion().getFullPath());
|
||||
return (Collection<T>)results.asList();
|
||||
return results.asList();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.springframework.data.gemfire.repository.GemfireRepository.sor(:org.springframework.data.domain.Sort)
|
||||
*/
|
||||
@Override
|
||||
public Iterable<T> findAll(final Sort sort) {
|
||||
SelectResults<T> selectResults = template.find(String.format("SELECT * FROM %1$s%2$s",
|
||||
template.getRegion().getFullPath(), toString(sort)));
|
||||
return selectResults.asList();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.springframework.data.domain.Sort
|
||||
*/
|
||||
private String toString(final Sort sort) {
|
||||
if (sort != null) {
|
||||
StringBuilder orderClause = new StringBuilder(" ORDER BY ");
|
||||
int count = 0;
|
||||
|
||||
for (Sort.Order order : sort) {
|
||||
orderClause.append(count++ > 0 ? ", " : "");
|
||||
orderClause.append(String.format("%1$s %2$s", order.getProperty(), order.getDirection()));
|
||||
}
|
||||
|
||||
return orderClause.toString();
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.springframework.data.repository.CrudRepository#findAll(java.lang.
|
||||
* Iterable)
|
||||
|
||||
@@ -33,12 +33,10 @@ import com.gemstone.gemfire.Instantiator;
|
||||
* either by relying on an existing bean definition (which acts as a template) or by providing an embedded
|
||||
* configuration through annotations.
|
||||
*
|
||||
* <p/>
|
||||
* Can reuse existing instantiators to optimize instance creation. If one is not provided, it will fallback
|
||||
* to reflection invocation.
|
||||
*
|
||||
* <p/>
|
||||
* By default, on initialization, the class will register itself as an {@link Instantiator} through
|
||||
* By default, on initialization, the class will register itself as an {@link Instantiator} through
|
||||
* {@link #register(Instantiator)}. This behaviour can be disabled through {@link #setAutoRegister(boolean)}.
|
||||
* Additionally, the instantiator registration is not distributed by default, to allow the application context
|
||||
* to be reused. This can be changed through {@link #setDistribute(boolean)}.
|
||||
@@ -47,8 +45,7 @@ import com.gemstone.gemfire.Instantiator;
|
||||
* @see org.springframework.beans.factory.wiring.BeanWiringInfoResolver
|
||||
* @see org.springframework.beans.factory.annotation.Autowired
|
||||
* @see javax.annotation.Resource
|
||||
* @see javax.inject.Inject
|
||||
*
|
||||
*
|
||||
* @author Costin Leau
|
||||
*/
|
||||
public class WiringInstantiator extends Instantiator implements BeanFactoryAware, InitializingBean, DisposableBean {
|
||||
@@ -140,4 +137,4 @@ public class WiringInstantiator extends Instantiator implements BeanFactoryAware
|
||||
public void setDistribute(boolean distribute) {
|
||||
this.distribute = distribute;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,12 +35,13 @@ import com.gemstone.gemfire.cache.server.ServerLoadProbe;
|
||||
|
||||
/**
|
||||
* FactoryBean for easy creation and configuration of GemFire {@link CacheServer} instances.
|
||||
* <p/>
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author John Blum
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class CacheServerFactoryBean implements FactoryBean<CacheServer>, InitializingBean, DisposableBean,
|
||||
SmartLifecycle {
|
||||
SmartLifecycle {
|
||||
|
||||
private boolean autoStartup = true;
|
||||
private boolean notifyBySubscription = CacheServer.DEFAULT_NOTIFY_BY_SUBSCRIPTION;
|
||||
@@ -68,7 +69,7 @@ public class CacheServerFactoryBean implements FactoryBean<CacheServer>, Initial
|
||||
private String hostNameForClients = CacheServer.DEFAULT_HOSTNAME_FOR_CLIENTS;
|
||||
private String subscriptionDiskStore;
|
||||
|
||||
private String[] serverGroups = CacheServer.DEFAULT_GROUPS;
|
||||
private String[] serverGroups = {};
|
||||
|
||||
private SubscriptionEvictionPolicy subscriptionEvictionPolicy = SubscriptionEvictionPolicy.valueOf(
|
||||
ClientSubscriptionConfig.DEFAULT_EVICTION_POLICY.toUpperCase());
|
||||
@@ -85,6 +86,7 @@ public class CacheServerFactoryBean implements FactoryBean<CacheServer>, Initial
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void afterPropertiesSet() throws IOException {
|
||||
Assert.notNull(cache, "A GemFire Cache is required.");
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
|
||||
/**
|
||||
* The ClientRegionShortcutWrapper enum is a Java enumerated type that wraps GemFire's ClientRegionShortcuts
|
||||
* with Spring Data GemFire ClientRegionShortcutWrapper enumerated values.
|
||||
* <p/>
|
||||
*
|
||||
* @author John Blum
|
||||
* @see com.gemstone.gemfire.cache.client.ClientRegionShortcut
|
||||
* @since 1.4.0
|
||||
|
||||
@@ -23,10 +23,13 @@ import com.gemstone.gemfire.cache.GemFireCache;
|
||||
import com.gemstone.gemfire.cache.Region;
|
||||
|
||||
/**
|
||||
* Spring Framework {@link Cache} implementation using a GemFire {@link Region} underneath.
|
||||
* Supports Gemfire 6.5 or higher.
|
||||
*
|
||||
* Spring Framework {@link Cache} implementation backed by a GemFire {@link Region}.
|
||||
*
|
||||
* Supports GemFire 6.5 or higher.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author John Blum
|
||||
*
|
||||
*/
|
||||
public class GemfireCache implements Cache {
|
||||
|
||||
@@ -64,7 +67,9 @@ public class GemfireCache implements Cache {
|
||||
return (value == null ? null : new SimpleValueWrapper(value));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void put(Object key, Object value) {
|
||||
region.put(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class JSONRegionAdvice {
|
||||
|
||||
/**
|
||||
* Sets names of regions to be included for JSON conversion. By default, all regions will be included
|
||||
* @param regions a List of region names to include
|
||||
* @param regionNames a List of region names to include
|
||||
*/
|
||||
public void setIncludedRegionNames(List<String> regionNames) {
|
||||
this.includedRegions = regionNames;
|
||||
|
||||
@@ -23,7 +23,6 @@ import com.gemstone.gemfire.cache.RegionShortcut;
|
||||
/**
|
||||
* The RegionShortcutWrapper enum is a Java enumerated type that wraps GemFire's RegionShortcuts
|
||||
* with Spring Data GemFire RegionShortcutWrapper enumerated values.
|
||||
* <p/>
|
||||
*
|
||||
* @author John Blum
|
||||
* @see com.gemstone.gemfire.cache.RegionShortcut
|
||||
|
||||
@@ -39,8 +39,9 @@ import com.gemstone.gemfire.cache.Declarable;
|
||||
* mostly configured with Spring Data GemFire's XML namespace. The Cache itself is the only resource that cannot be
|
||||
* configured and initialized in a Spring context since the initializer is not invoked until after GemFire creates
|
||||
* and initializes the Cache for use.
|
||||
* <p/>
|
||||
*
|
||||
* @author John Blum
|
||||
* @see java.util.Properties
|
||||
* @see org.springframework.context.ApplicationContext
|
||||
* @see org.springframework.context.ApplicationListener
|
||||
* @see org.springframework.context.ConfigurableApplicationContext
|
||||
@@ -50,9 +51,9 @@ import com.gemstone.gemfire.cache.Declarable;
|
||||
* @see org.springframework.context.event.SimpleApplicationEventMulticaster
|
||||
* @see org.springframework.context.support.ClassPathXmlApplicationContext
|
||||
* @see com.gemstone.gemfire.cache.Declarable
|
||||
* @since 1.3.4
|
||||
* @link http://pubs.vmware.com/vfabric53/topic/com.vmware.vfabric.gemfire.7.0/basic_config/the_cache/setting_cache_initializer.html
|
||||
* @link https://jira.springsource.org/browse/SGF-248
|
||||
* @since 1.4.0
|
||||
* @see <a href="http://pubs.vmware.com/vfabric53/topic/com.vmware.vfabric.gemfire.7.0/basic_config/the_cache/setting_cache_initializer.html">Setting Cache Initializer</a>
|
||||
* @see <a href="https://jira.springsource.org/browse/SGF-248">SGF-248</a>
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class SpringContextBootstrappingInitializer implements Declarable, ApplicationListener<ContextRefreshedEvent> {
|
||||
@@ -73,7 +74,7 @@ public class SpringContextBootstrappingInitializer implements Declarable, Applic
|
||||
/**
|
||||
* Gets a reference to the Spring ApplicationContext constructed, configured and initialized inside the GemFire
|
||||
* Server-based JVM process.
|
||||
* <p/>
|
||||
*
|
||||
* @return a reference to the Spring ApplicationContext bootstrapped by GemFire.
|
||||
* @see org.springframework.context.ConfigurableApplicationContext
|
||||
*/
|
||||
@@ -86,7 +87,7 @@ public class SpringContextBootstrappingInitializer implements Declarable, Applic
|
||||
* Registers a Spring ApplicationListener to be notified when the Spring ApplicationContext is created by GemFire
|
||||
* when instantiating and initializing declared Initializers from the GemFire native configuration file
|
||||
* (e.g. cache.xml).
|
||||
* <p/>
|
||||
*
|
||||
* @param <T> the Class type of the Spring ApplicationListener.
|
||||
* @param listener the ApplicationListener to register for ContextRefreshedEvents by this
|
||||
* SpringContextBootstrappingInitializer.
|
||||
@@ -111,7 +112,7 @@ public class SpringContextBootstrappingInitializer implements Declarable, Applic
|
||||
* ApplicationContext was previously created, initialized and refreshed before any ApplicationListeners interested
|
||||
* in ContextRefreshedEvents get registered so that application components (such as LazyWiringDeclarableSupport
|
||||
* objects) arriving late to the game that also require configuration (auto-wiring) get wired accordingly too.
|
||||
* <p/>
|
||||
*
|
||||
* @param listener a Spring ApplicationListener requiring notification of any ContextRefreshedEvents after the
|
||||
* ApplicationContext has already been created, initialized and/or refreshed.
|
||||
* @see org.springframework.context.ApplicationListener#onApplicationEvent(org.springframework.context.ApplicationEvent)
|
||||
@@ -131,7 +132,7 @@ public class SpringContextBootstrappingInitializer implements Declarable, Applic
|
||||
/**
|
||||
* Unregisters the Spring ApplicationListener from this SpringContextBootstrappingInitializer in order to stop
|
||||
* receiving ApplicationEvents on Spring context refreshes.
|
||||
* <p/>
|
||||
*
|
||||
* @param <T> the Class type of the Spring ApplicationListener.
|
||||
* @param listener the ApplicationListener to unregister from receiving ContextRefreshedEvents by this
|
||||
* SpringContextBootstrappingInitializer.
|
||||
@@ -154,7 +155,7 @@ public class SpringContextBootstrappingInitializer implements Declarable, Applic
|
||||
* Creates (constructs and configures) a ConfigurableApplicationContext instance based on the specified locations
|
||||
* of the context configuration meta-data files. The created ConfigurableApplicationContext is not automatically
|
||||
* "refreshed" and therefore must be "refreshed" by the caller manually.
|
||||
* <p/>
|
||||
*
|
||||
* @param configLocations a String array indicating the locations of the context configuration meta-data files
|
||||
* used to configure the ConfigurableApplicationContext instance.
|
||||
* @return a newly constructed and configured instance of the ConfigurableApplicationContext class. Note, the
|
||||
@@ -175,12 +176,12 @@ public class SpringContextBootstrappingInitializer implements Declarable, Applic
|
||||
* specified locations of context configuration meta-data files used to configure the context. The created
|
||||
* ConfigurableApplicationContext is not automatically "refreshed" and therefore must be "refreshed"
|
||||
* by the caller manually.
|
||||
* <p/>
|
||||
*
|
||||
* When basePackages are specified, an instance of AnnotationConfigApplicationContext is returned; otherwise
|
||||
* an instance of the ClassPathXmlApplicationContext is initialized with the configLocations and returned.
|
||||
* This method prefers the ClassPathXmlApplicationContext to the AnnotationConfigApplicationContext when both
|
||||
* basePackages and configLocations are specified.
|
||||
* <p/>
|
||||
*
|
||||
* @param basePackages the base application packages to scan for application @Components and @Configuration classes. *
|
||||
* @param configLocations a String array indicating the locations of the context configuration meta-data files
|
||||
* used to configure the ConfigurableApplicationContext instance.
|
||||
@@ -211,7 +212,7 @@ public class SpringContextBootstrappingInitializer implements Declarable, Applic
|
||||
/**
|
||||
* Initializes a Spring ApplicationContext with the given parameters from a GemFire Initializer in GemFire native
|
||||
* configuration meta-data (e.g. cache.xml).
|
||||
* <p/>
|
||||
*
|
||||
* @param parameters a Properties object containing the configuration parameters and settings defined in the
|
||||
* GemFire cache.xml >initializer/< element.
|
||||
* @see #createApplicationContext
|
||||
@@ -239,6 +240,7 @@ public class SpringContextBootstrappingInitializer implements Declarable, Applic
|
||||
|
||||
applicationContext = createApplicationContext(basePackagesArray, configLocations);
|
||||
Assert.notNull(applicationContext, "The 'created' ConfigurableApplicationContext cannot be null!");
|
||||
assert applicationContext != null;
|
||||
applicationContext.addApplicationListener(this);
|
||||
applicationContext.registerShutdownHook();
|
||||
applicationContext.refresh();
|
||||
@@ -252,7 +254,7 @@ public class SpringContextBootstrappingInitializer implements Declarable, Applic
|
||||
|
||||
/**
|
||||
* Gets the the ID of the Spring ApplicationContext in a null-safe manner.
|
||||
* <p/>
|
||||
*
|
||||
* @param applicationContext the Spring ApplicationContext to retrieve the ID for.
|
||||
* @return the ID of the given Spring ApplicationContext or null if the ApplicationContext reference is null.
|
||||
* @see org.springframework.context.ApplicationContext#getId()
|
||||
@@ -265,7 +267,7 @@ public class SpringContextBootstrappingInitializer implements Declarable, Applic
|
||||
* Gets notified when the Spring ApplicationContext gets created and refreshed by GemFire. The handler method
|
||||
* proceeds in notifying any other GemFire components that need to be aware that the Spring ApplicationContext
|
||||
* now exists and is ready for use, such as other Declarable GemFire objects requiring auto-wiring support, etc.
|
||||
* <p/>
|
||||
*
|
||||
* @param event the ContextRefreshedEvent signaling that the Spring ApplicationContext has been created
|
||||
* and refreshed by GemFire.
|
||||
* @see org.springframework.context.event.ContextRefreshedEvent
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
|
||||
/**
|
||||
*
|
||||
* Support package for Spring Gemfire integration.
|
||||
*
|
||||
* <p/>Provides Spring 3.1 caching support (Cache and CacheManager implementations on top of Gemfire APIs).
|
||||
*
|
||||
* Provides Spring 3.1 caching support (Cache and CacheManager implementations on top of Gemfire APIs).
|
||||
*/
|
||||
package org.springframework.data.gemfire.support;
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ import com.gemstone.gemfire.cache.Cache;
|
||||
|
||||
/**
|
||||
* Base class for GemFire WAN Gateway component factory beans.
|
||||
* <p/>
|
||||
*
|
||||
* @author David Turanski
|
||||
* @author John Blum
|
||||
*/
|
||||
|
||||
@@ -26,7 +26,7 @@ import com.gemstone.gemfire.cache.util.Gateway;
|
||||
|
||||
/**
|
||||
* FactoryBean for creating GemFire {@link AsyncEventQueue}s.
|
||||
* <p/>
|
||||
*
|
||||
* @author David Turanski
|
||||
* @author John Blum
|
||||
*/
|
||||
@@ -51,7 +51,7 @@ public class AsyncEventQueueFactoryBean extends AbstractWANComponentFactoryBean<
|
||||
|
||||
/**
|
||||
* Constructs an instance of the AsyncEventQueueFactoryBean for creating an GemFire AsyncEventQueue.
|
||||
* <p/>
|
||||
*
|
||||
* @param cache the GemFire Cache reference.
|
||||
* @see #AsyncEventQueueFactoryBean(com.gemstone.gemfire.cache.Cache, com.gemstone.gemfire.cache.asyncqueue.AsyncEventListener)
|
||||
*/
|
||||
@@ -61,7 +61,7 @@ public class AsyncEventQueueFactoryBean extends AbstractWANComponentFactoryBean<
|
||||
|
||||
/**
|
||||
* Constructs an instance of the AsyncEventQueueFactoryBean for creating an GemFire AsyncEventQueue.
|
||||
* <p/>
|
||||
*
|
||||
* @param cache the GemFire Cache reference.
|
||||
* @param asyncEventListener required {@link AsyncEventListener}
|
||||
*/
|
||||
|
||||
@@ -30,10 +30,11 @@ import com.gemstone.gemfire.cache.wan.GatewayTransportFilter;
|
||||
|
||||
/**
|
||||
* FactoryBean for creating a parallel or serial GemFire {@link GatewaySender}.
|
||||
* <p/>
|
||||
*
|
||||
* @author David Turanski
|
||||
* @author John Blum
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class GatewaySenderFactoryBean extends AbstractWANComponentFactoryBean<GatewaySender>
|
||||
implements SmartLifecycle {
|
||||
|
||||
@@ -65,7 +66,7 @@ public class GatewaySenderFactoryBean extends AbstractWANComponentFactoryBean<Ga
|
||||
|
||||
/**
|
||||
* Constructs an instance of the GatewaySenderFactoryBean class initialized with a reference to the GemFire cache.
|
||||
* <p/>
|
||||
*
|
||||
* @param cache the Gemfire cache reference.
|
||||
* @see com.gemstone.gemfire.cache.Cache
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user