DATAGEODE-302 - Fix compilation warnings.

Remove deprecations.

Edit Javadoc.
This commit is contained in:
John Blum
2020-03-25 13:10:12 -07:00
parent c1c998f7b0
commit 42ab3534e6
13 changed files with 141 additions and 142 deletions

View File

@@ -70,10 +70,9 @@ import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
/**
* Spring {@link FactoryBean} used to construct, configure and initialize a Pivotal GemFire/Apache Geode
* {@link Cache peer cache).
* Spring {@link FactoryBean} used to construct, configure and initialize a {@literal peer} {@link Cache).
*
* Allows either retrieval of an existing, open {@link Cache} or creation of a new {@link Cache}.
* Allows either the retrieval of an existing, open {@link Cache} or the creation of a new {@link Cache}.
*
* This class implements the {@link PersistenceExceptionTranslator} interface and is auto-detected by Spring's
* {@link org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor} for AOP-based translation
@@ -782,9 +781,11 @@ public class CacheFactoryBean extends AbstractFactoryBeanSupport<GemFireCache>
* @see org.springframework.beans.factory.FactoryBean#getObjectType()
*/
@Override
@SuppressWarnings("unchecked")
public Class<? extends GemFireCache> getObjectType() {
return Optional.ofNullable(this.<Cache>getCache()).<Class>map(Object::getClass).orElse(Cache.class);
Cache cache = getCache();
return cache != null ? cache.getClass() : Cache.class;
}
/**
@@ -794,6 +795,7 @@ public class CacheFactoryBean extends AbstractFactoryBeanSupport<GemFireCache>
* @param cacheFactoryInitializer {@link CacheFactoryInitializer} configured to initialize the cache factory.
* @see org.springframework.data.gemfire.CacheFactoryBean.CacheFactoryInitializer
*/
@SuppressWarnings("rawtypes")
public void setCacheFactoryInitializer(CacheFactoryInitializer cacheFactoryInitializer) {
this.cacheFactoryInitializer = cacheFactoryInitializer;
}
@@ -805,6 +807,7 @@ public class CacheFactoryBean extends AbstractFactoryBeanSupport<GemFireCache>
* @return the {@link CacheFactoryInitializer} configured to initialize the cache factory.
* @see org.springframework.data.gemfire.CacheFactoryBean.CacheFactoryInitializer
*/
@SuppressWarnings("rawtypes")
public CacheFactoryInitializer getCacheFactoryInitializer() {
return this.cacheFactoryInitializer;
}

View File

@@ -40,10 +40,11 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
/**
* Spring {@link FactoryBean} used to create {@link DiskStore}.
* Spring {@link FactoryBean} used to create a {@link DiskStore}.
*
* @author David Turanski
* @author John Blum
* @see java.io.File
* @see org.apache.geode.cache.DiskStore
* @see org.apache.geode.cache.DiskStoreFactory
* @see org.apache.geode.cache.GemFireCache
@@ -247,9 +248,8 @@ public class DiskStoreFactoryBean extends AbstractFactoryBeanSupport<DiskStore>
}
@Override
@SuppressWarnings("unchecked")
public Class<?> getObjectType() {
return Optional.ofNullable(this.diskStore).map(DiskStore::getClass).orElse((Class) DiskStore.class);
return this.diskStore != null ? this.diskStore.getClass() : DiskStore.class;
}
public void setCache(GemFireCache cache) {

View File

@@ -27,6 +27,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Supplier;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.RegionService;
@@ -48,8 +49,7 @@ import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
/**
* Spring {@link FactoryBean} used to construct, configure and initialize {@link Index Indexes}
* using a declarative approach.
* Spring {@link FactoryBean} used to construct, configure and initialize an {@link Index}.
*
* @author Costin Leau
* @author David Turanski
@@ -57,6 +57,7 @@ import org.springframework.util.StringUtils;
* @see org.apache.geode.cache.Region
* @see org.apache.geode.cache.RegionService
* @see org.apache.geode.cache.query.Index
* @see org.apache.geode.cache.query.IndexStatistics
* @see org.apache.geode.cache.query.QueryService
* @see org.springframework.beans.factory.FactoryBean
* @see org.springframework.beans.factory.InitializingBean
@@ -119,9 +120,8 @@ public class IndexFactoryBean extends AbstractFactoryBeanSupport<Index> implemen
registerAlias(getBeanName(), this.indexName);
}
/* (non-Javadoc) */
private void applyIndexConfigurers(String indexName) {
applyIndexConfigurers(indexName, getCompositeRegionConfigurer());
applyIndexConfigurers(indexName, getCompositeIndexConfigurer());
}
/**
@@ -152,7 +152,6 @@ public class IndexFactoryBean extends AbstractFactoryBeanSupport<Index> implemen
.forEach(indexConfigurer -> indexConfigurer.configure(indexName, this));
}
/* (non-Javadoc) */
private void assertIndexDefinitionConfiguration() {
Assert.hasText(this.expression, "Index expression is required");
@@ -163,31 +162,31 @@ public class IndexFactoryBean extends AbstractFactoryBeanSupport<Index> implemen
}
}
/* (non-Javadoc) */
RegionService resolveCache() {
return Optional.ofNullable(this.cache)
.orElseGet(() -> Optional.ofNullable(GemfireUtils.resolveGemFireCache())
.orElseThrow(() -> newIllegalStateException("Cache is required")));
RegionService resolvedCache = this.cache != null ? this.cache : GemfireUtils.resolveGemFireCache();
return Optional.ofNullable(resolvedCache)
.orElseThrow(() -> newIllegalStateException("Cache is required"));
}
/* (non-Javadoc) */
String resolveIndexName() {
return Optional.ofNullable(this.name).filter(StringUtils::hasText)
.orElseGet(() -> Optional.ofNullable(getBeanName()).filter(StringUtils::hasText)
.orElseThrow(() -> newIllegalArgumentException("Index name is required")));
String resolvedIndexName = StringUtils.hasText(this.name) ? this.name : getBeanName();
return Optional.ofNullable(resolvedIndexName)
.filter(StringUtils::hasText)
.orElseThrow(() -> newIllegalArgumentException("Index name is required"));
}
/* (non-Javadoc) */
QueryService resolveQueryService() {
return Optional.ofNullable(this.queryService)
.orElseGet(() -> Optional.ofNullable(lookupQueryService())
.orElseThrow(() -> newIllegalStateException("QueryService is required to create an Index")));
QueryService resolvedQueryService = this.queryService != null ? this.queryService : lookupQueryService();
return Optional.ofNullable(resolvedQueryService)
.orElseThrow(() -> newIllegalStateException("QueryService is required to create an Index"));
}
/* (non-Javadoc) */
QueryService lookupQueryService() {
String queryServiceBeanName = GemfireConstants.DEFAULT_GEMFIRE_INDEX_DEFINITION_QUERY_SERVICE;
@@ -198,17 +197,16 @@ public class IndexFactoryBean extends AbstractFactoryBeanSupport<Index> implemen
.orElseGet(() -> registerQueryServiceBean(queryServiceBeanName, doLookupQueryService()));
}
/* (non-Javadoc) */
QueryService doLookupQueryService() {
return Optional.ofNullable(this.queryService).orElseGet(() ->
(this.cache instanceof ClientCache ? ((ClientCache) this.cache).getLocalQueryService()
: this.cache.getQueryService()));
Supplier<QueryService> queryServiceSupplier = () -> this.cache instanceof ClientCache
? ((ClientCache) this.cache).getLocalQueryService()
: this.cache.getQueryService();
return Optional.ofNullable(this.queryService)
.orElseGet(queryServiceSupplier);
}
/* (non-Javadoc) */
QueryService registerQueryServiceBean(String beanName, QueryService queryService) {
if (isDefine()) {
@@ -218,21 +216,20 @@ public class IndexFactoryBean extends AbstractFactoryBeanSupport<Index> implemen
return queryService;
}
/* (non-Javadoc) */
void registerAlias(String beanName, String indexName) {
Optional.ofNullable(getBeanFactory()).filter(it -> it instanceof ConfigurableBeanFactory)
.filter(it -> (beanName != null && !beanName.equals(indexName)))
.ifPresent(it -> ((ConfigurableBeanFactory) it).registerAlias(beanName, indexName));
Optional.ofNullable(getBeanFactory())
.filter(ConfigurableBeanFactory.class::isInstance)
.filter(it -> beanName != null && !beanName.equals(indexName))
.map(ConfigurableBeanFactory.class::cast)
.ifPresent(it -> it.registerAlias(beanName, indexName));
}
/* (non-Javadoc) */
Index createIndex(QueryService queryService, String indexName) throws Exception {
Index createIndex(QueryService queryService, String indexName) {
return createIndex(queryService, indexName, false);
}
/* (non-Javadoc) */
private Index createIndex(QueryService queryService, String indexName, boolean retryAttempted) throws Exception {
private Index createIndex(QueryService queryService, String indexName, boolean retryAttempted) {
IndexType indexType = this.indexType;
@@ -253,12 +250,13 @@ public class IndexFactoryBean extends AbstractFactoryBeanSupport<Index> implemen
}
catch (IndexExistsException cause) {
// Same definition, different name
// Same definition, Different name
Optional<Index> existingIndexByDefinition =
tryToFindExistingIndexByDefinition(queryService, expression, from, indexType);
return existingIndexByDefinition.filter(existingIndex -> isIgnoreIfExists())
return existingIndexByDefinition
.filter(existingIndex -> isIgnoreIfExists())
.map(existingIndex -> {
logWarning("WARNING! You are choosing to ignore this Index [%1$s] and return the existing"
@@ -270,7 +268,8 @@ public class IndexFactoryBean extends AbstractFactoryBeanSupport<Index> implemen
}).orElseGet(() ->
existingIndexByDefinition.filter(it -> !retryAttempted && isOverride())
existingIndexByDefinition
.filter(it -> !retryAttempted && isOverride())
.map(existingIndex -> {
// Log an informational warning to caution the user about using the override
@@ -286,7 +285,8 @@ public class IndexFactoryBean extends AbstractFactoryBeanSupport<Index> implemen
}).orElseThrow(() -> {
String existingIndexName = existingIndexByDefinition.map(Index::getName)
String existingIndexName = existingIndexByDefinition
.map(Index::getName)
.orElse("unknown");
return new GemfireIndexException(String.format(
@@ -300,11 +300,12 @@ public class IndexFactoryBean extends AbstractFactoryBeanSupport<Index> implemen
}
catch (IndexNameConflictException cause) {
// Same name; possibly different definition
// Same name; Possibly different definition
Optional<Index> existingIndexByName = tryToFindExistingIndexByName(queryService, indexName);
return existingIndexByName.filter(existingIndex -> isIgnoreIfExists())
return existingIndexByName
.filter(existingIndex -> isIgnoreIfExists())
.map(existingIndex ->
handleIgnore(warnOnIndexDefinitionMismatch(existingIndex, indexName, "Returning"))
@@ -334,12 +335,13 @@ public class IndexFactoryBean extends AbstractFactoryBeanSupport<Index> implemen
);
}
catch (Exception cause) {
throw new GemfireIndexException(String.format("Failed to create Index [%s]",
toDetailedIndexDefinition()), cause);
String message = String.format("Failed to create Index [%s]", toDetailedIndexDefinition());
throw new GemfireIndexException(message , cause);
}
}
/* (non-Javadoc) */
@SuppressWarnings("all")
private boolean isIndexDefinitionMatch(Index index) {
@@ -357,12 +359,10 @@ public class IndexFactoryBean extends AbstractFactoryBeanSupport<Index> implemen
.orElse(false);
}
/* (non-Javadoc) */
private boolean isNotIndexDefinitionMatch(Index index) {
return !isIndexDefinitionMatch(index);
}
/* (non-Javadoc) */
private Index warnOnIndexDefinitionMismatch(Index existingIndex, String indexName, String action) {
if (isNotIndexDefinitionMatch(existingIndex)) {
@@ -378,7 +378,6 @@ public class IndexFactoryBean extends AbstractFactoryBeanSupport<Index> implemen
return existingIndex;
}
/* (non-Javadoc) */
private Index handleIgnore(Index existingIndex) {
registerAlias(getBeanName(), existingIndex.getName());
@@ -386,7 +385,6 @@ public class IndexFactoryBean extends AbstractFactoryBeanSupport<Index> implemen
return existingIndex;
}
/* (non-Javadoc) */
private Index handleOverride(Index existingIndex, QueryService queryService, String indexName) {
try {
// No way to tell whether the QueryService.remove(:Index) was successful or not! o.O
@@ -404,7 +402,6 @@ public class IndexFactoryBean extends AbstractFactoryBeanSupport<Index> implemen
}
}
/* (non-Javadoc) */
private Index handleSmartOverride(Index existingIndex, QueryService queryService, String indexName) {
return Optional.of(existingIndex)
@@ -413,18 +410,15 @@ public class IndexFactoryBean extends AbstractFactoryBeanSupport<Index> implemen
.orElseGet(() -> handleOverride(existingIndex, queryService, indexName));
}
/* (non-Javadoc) */
String toBasicIndexDefinition() {
return String.format(BASIC_INDEX_DEFINITION, this.expression, this.from, this.indexType);
}
/* (non-Javadoc) */
String toDetailedIndexDefinition() {
return String.format(DETAILED_INDEX_DEFINITION,
this.name, this.expression, this.from, this.imports, this.indexType);
}
/* (non-Javadoc) */
Index createKeyIndex(QueryService queryService, String indexName, String expression, String from) throws Exception {
if (isDefine()) {
@@ -436,7 +430,6 @@ public class IndexFactoryBean extends AbstractFactoryBeanSupport<Index> implemen
}
}
/* (non-Javadoc) */
Index createHashIndex(QueryService queryService, String indexName, String expression, String from, String imports)
throws Exception {
@@ -462,7 +455,6 @@ public class IndexFactoryBean extends AbstractFactoryBeanSupport<Index> implemen
}
}
/* (non-Javadoc) */
Index createFunctionalIndex(QueryService queryService, String indexName, String expression, String from,
String imports) throws Exception {
@@ -488,7 +480,6 @@ public class IndexFactoryBean extends AbstractFactoryBeanSupport<Index> implemen
}
}
/* (non-Javadoc) */
Optional<Index> tryToFindExistingIndexByDefinition(QueryService queryService,
String expression, String fromClause, IndexType indexType) {
@@ -504,7 +495,6 @@ public class IndexFactoryBean extends AbstractFactoryBeanSupport<Index> implemen
return Optional.empty();
}
/* (non-Javadoc) */
Optional<Index> tryToFindExistingIndexByName(QueryService queryService, String indexName) {
for (Index index : nullSafeCollection(queryService.getIndexes())) {
@@ -523,7 +513,7 @@ public class IndexFactoryBean extends AbstractFactoryBeanSupport<Index> implemen
* @return the Composite {@link IndexConfigurer}.
* @see org.springframework.data.gemfire.config.annotation.IndexConfigurer
*/
protected IndexConfigurer getCompositeRegionConfigurer() {
protected IndexConfigurer getCompositeIndexConfigurer() {
return this.compositeIndexConfigurer;
}
@@ -542,17 +532,20 @@ public class IndexFactoryBean extends AbstractFactoryBeanSupport<Index> implemen
*/
@Override
public Index getObject() {
return Optional.ofNullable(getIndex()).orElseGet(() ->
this.index = tryToFindExistingIndexByName(resolveQueryService(), resolveIndexName()).orElse(null));
return Optional.ofNullable(getIndex())
.orElseGet(() -> this.index =
tryToFindExistingIndexByName(resolveQueryService(), resolveIndexName()).orElse(null));
}
/**
* @inheritDoc
*/
@Override
@SuppressWarnings("unchecked")
public Class<?> getObjectType() {
return Optional.ofNullable(getIndex()).map(Index::getClass).orElse((Class) Index.class);
Index index = getIndex();
return index != null ? index.getClass() : Index.class;
}
/**
@@ -706,6 +699,7 @@ public class IndexFactoryBean extends AbstractFactoryBeanSupport<Index> implemen
* @see org.springframework.data.gemfire.config.annotation.IndexConfigurer
* @see #setIndexConfigurers(List)
*/
@SuppressWarnings("unused")
public void setIndexConfigurers(IndexConfigurer... indexConfigurers) {
setIndexConfigurers(Arrays.asList(nullSafeArray(indexConfigurers, IndexConfigurer.class)));
}
@@ -923,7 +917,7 @@ public class IndexFactoryBean extends AbstractFactoryBeanSupport<Index> implemen
return true;
}
if (!(obj instanceof IndexWrapper || obj instanceof Index)) {
if (!(obj instanceof Index)) {
return false;
}
@@ -940,7 +934,7 @@ public class IndexFactoryBean extends AbstractFactoryBeanSupport<Index> implemen
int hashValue = 37;
hashValue = 37 * hashValue + ObjectUtils.nullSafeHashCode(getIndexName());
hashValue = 37 * hashValue + ObjectUtils.nullSafeHashCode(index);
hashValue = 37 * hashValue + ObjectUtils.nullSafeHashCode(this.index);
return hashValue;
}
@@ -948,7 +942,8 @@ public class IndexFactoryBean extends AbstractFactoryBeanSupport<Index> implemen
@Override
public String toString() {
return Optional.ofNullable(getIndex()).map(String::valueOf)
return Optional.ofNullable(getIndex())
.map(String::valueOf)
.orElseGet(this::getIndexName);
}
}

View File

@@ -65,11 +65,11 @@ import org.springframework.util.ReflectionUtils;
import org.springframework.util.StringUtils;
/**
* Abstract Spring {@link FactoryBean} base class extended by other SDG {@link FactoryBean FactoryBeans} used to
* construct, configure and initialize peer {@link Region Regions}.
* Spring {@link FactoryBean} and abstract base class extended by other SDG {@link FactoryBean FactoryBeans}
* used to construct, configure and initialize {@literal peer} {@link Region Regions}.
*
* This {@link FactoryBean} allows for very easy and flexible creation of peer {@link Region}.
* For client {@link Region Regions}, however, see the {@link ClientRegionFactoryBean}.
* This {@link FactoryBean} allows for very easy and flexible creation of {@literal peer} {@link Region Regions}.
* For {@literal client} {@link Region Regions}, see the {@link ClientRegionFactoryBean}.
*
* @author Costin Leau
* @author David Turanski
@@ -78,8 +78,11 @@ import org.springframework.util.StringUtils;
* @see org.apache.geode.cache.CacheListener
* @see org.apache.geode.cache.CacheLoader
* @see org.apache.geode.cache.CacheWriter
* @see org.apache.geode.cache.CustomExpiry
* @see org.apache.geode.cache.DataPolicy
* @see org.apache.geode.cache.DiskStore
* @see org.apache.geode.cache.EvictionAttributes
* @see org.apache.geode.cache.ExpirationAttributes
* @see org.apache.geode.cache.GemFireCache
* @see org.apache.geode.cache.PartitionAttributes
* @see org.apache.geode.cache.Region
@@ -88,10 +91,14 @@ import org.springframework.util.StringUtils;
* @see org.apache.geode.cache.RegionShortcut
* @see org.apache.geode.cache.Scope
* @see org.apache.geode.cache.asyncqueue.AsyncEventQueue
* @see org.apache.geode.cache.wan.GatewaySender
* @see org.apache.geode.compression.Compressor
* @see org.springframework.beans.factory.DisposableBean
* @see org.springframework.context.SmartLifecycle
* @see org.springframework.data.gemfire.ResolvableRegionFactoryBean
* @see org.springframework.data.gemfire.client.ClientRegionFactoryBean
* @see org.springframework.data.gemfire.eviction.EvictingRegionFactoryBean
* @see org.springframework.data.gemfire.expiration.ExpiringRegionFactoryBean
* @see org.springframework.data.gemfire.config.annotation.RegionConfigurer
*/
@SuppressWarnings("unused")

View File

@@ -26,18 +26,20 @@ import org.springframework.data.gemfire.util.ArrayUtils;
import org.springframework.util.StringUtils;
/**
* Spring-friendly bean for creating {@link RegionAttributes}. Eliminates the need of using a XML 'factory-method' tag.
* Spring {@link FactoryBean} used to create {@link RegionAttributes}.
*
* Eliminates the need of using a XML bean 'factory-method' tag.
*
* @author Costin Leau
* @author John Blum
* @see org.springframework.beans.factory.FactoryBean
* @see org.springframework.beans.factory.InitializingBean
* @see org.apache.geode.cache.AttributesFactory
* @see org.apache.geode.cache.RegionAttributes
* @see org.springframework.beans.factory.FactoryBean
* @see org.springframework.beans.factory.InitializingBean
*/
@SuppressWarnings({ "unused" })
public class RegionAttributesFactoryBean<K, V> extends AttributesFactory<K, V>
implements FactoryBean<RegionAttributes>, InitializingBean {
implements FactoryBean<RegionAttributes<K, V>>, InitializingBean {
private RegionAttributes<K, V> regionAttributes;

View File

@@ -35,6 +35,7 @@ import org.apache.geode.cache.client.ClientCacheFactory;
import org.apache.geode.cache.client.Pool;
import org.apache.geode.distributed.DistributedSystem;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ApplicationContextEvent;
@@ -49,34 +50,32 @@ import org.springframework.data.gemfire.config.xml.GemfireConstants;
import org.springframework.data.gemfire.support.ConnectionEndpoint;
import org.springframework.data.gemfire.support.ConnectionEndpointList;
import org.springframework.data.gemfire.util.SpringUtils;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;
import org.springframework.util.StringUtils;
import lombok.NonNull;
/**
* Spring {@link org.springframework.beans.factory.FactoryBean} used to create a Pivotal GemFire/Apache Geode
* {@link ClientCache}.
* Spring {@link FactoryBean} used to construct, configure and initialize a {@link ClientCache}.
*
* @author Costin Leau
* @author Lyndon Adams
* @author John Blum
* @see java.net.InetSocketAddress
* @see java.util.Properties
* @see org.apache.geode.cache.GemFireCache
* @see org.apache.geode.cache.client.ClientCache
* @see org.apache.geode.cache.client.ClientCacheFactory
* @see org.apache.geode.cache.client.Pool
* @see org.apache.geode.cache.client.PoolManager
* @see org.apache.geode.distributed.DistributedSystem
* @see org.apache.geode.pdx.PdxSerializer
* @see org.springframework.beans.factory.BeanFactory
* @see org.springframework.beans.factory.FactoryBean
* @see org.springframework.context.ApplicationContext
* @see org.springframework.context.ApplicationListener
* @see org.springframework.context.event.ContextRefreshedEvent
* @see org.springframework.data.gemfire.CacheFactoryBean
* @see org.springframework.data.gemfire.config.annotation.ClientCacheConfigurer
* @see org.springframework.data.gemfire.support.ConnectionEndpoint
* @see org.springframework.data.gemfire.support.ConnectionEndpointList
* @since 1.0.0
*/
@SuppressWarnings("unused")
public class ClientCacheFactoryBean extends CacheFactoryBean implements ApplicationListener<ContextRefreshedEvent> {
@@ -121,7 +120,7 @@ public class ClientCacheFactoryBean extends CacheFactoryBean implements Applicat
private String serverGroup;
private final ClientCacheConfigurer compositeClientCacheConfigurer = (beanName, bean) ->
nullSafeCollection(clientCacheConfigurers).forEach(clientCacheConfigurer ->
nullSafeCollection(this.clientCacheConfigurers).forEach(clientCacheConfigurer ->
clientCacheConfigurer.configure(beanName, bean));
/**

View File

@@ -49,18 +49,21 @@ import org.springframework.data.gemfire.expiration.ExpiringRegionFactoryBean;
import org.springframework.data.gemfire.support.SmartLifecycleSupport;
import org.springframework.data.gemfire.util.RegionUtils;
import org.springframework.data.gemfire.util.SpringUtils;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import lombok.NonNull;
/**
* Spring {@link FactoryBean} used to construct, configure and initialize a client {@link Region}.
* Spring {@link FactoryBean} used to construct, configure and initialize a {@literal client} {@link Region}.
*
* @author Costin Leau
* @author David Turanski
* @author John Blum
* @see org.apache.geode.cache.CacheListener
* @see org.apache.geode.cache.CacheLoader
* @see org.apache.geode.cache.CacheWriter
* @see org.apache.geode.cache.CustomExpiry
* @see org.apache.geode.cache.DataPolicy
* @see org.apache.geode.cache.EvictionAttributes
* @see org.apache.geode.cache.ExpirationAttributes

View File

@@ -48,7 +48,7 @@ import org.springframework.data.gemfire.util.DistributedSystemUtils;
import org.springframework.util.StringUtils;
/**
* Spring {@link FactoryBean} to construct, configure and initialize a {@link Pool}.
* Spring {@link FactoryBean} used to construct, configure and initialize a {@link Pool}.
*
* If a new {@link Pool} is created, its lifecycle is bound to that of this declaring {@link FactoryBean}
* and indirectly, the Spring container.
@@ -214,7 +214,7 @@ public class PoolFactoryBean extends AbstractFactoryBeanSupport<Pool> implements
* @see org.springframework.beans.factory.DisposableBean#destroy()
*/
@Override
public void destroy() throws Exception {
public void destroy() {
Optional.ofNullable(this.pool)
.filter(this::isSpringManagedPool)
@@ -791,17 +791,16 @@ public class PoolFactoryBean extends AbstractFactoryBeanSupport<Pool> implements
this.subscriptionTimeoutMultiplier = subscriptionTimeoutMultiplier;
}
@Deprecated
public void setThreadLocalConnections(boolean threadLocalConnections) {
this.threadLocalConnections = threadLocalConnections;
}
// Internal framework use only.
public final void setLocatorsConfiguration(Object locatorsConfiguration) {
}
public final void setLocatorsConfiguration(Object locatorsConfiguration) { }
// Internal framework use only.
public final void setServersConfiguration(Object serversConfiguration) {
}
public final void setServersConfiguration(Object serversConfiguration) { }
/**
* Callback interface to initialize the {@link PoolFactory} used by this {@link PoolFactoryBean}

View File

@@ -95,7 +95,7 @@ public class LuceneIndexFactoryBean extends AbstractFactoryBeanSupport<LuceneInd
private LuceneIndex luceneIndex;
private LuceneSerializer luceneSerializer;
private LuceneSerializer<?> luceneSerializer;
private LuceneService luceneService;
@@ -127,10 +127,10 @@ public class LuceneIndexFactoryBean extends AbstractFactoryBeanSupport<LuceneInd
* @param indexName {@link String} containing the name of the {@link LuceneIndex}.
* @see org.springframework.data.gemfire.config.annotation.IndexConfigurer
* @see #applyIndexConfigurers(String, IndexConfigurer...)
* @see #getCompositeRegionConfigurer()
* @see #getCompositeIndexConfigurer()
*/
private void applyIndexConfigurers(String indexName) {
applyIndexConfigurers(indexName, getCompositeRegionConfigurer());
applyIndexConfigurers(indexName, getCompositeIndexConfigurer());
}
/**
@@ -208,7 +208,7 @@ public class LuceneIndexFactoryBean extends AbstractFactoryBeanSupport<LuceneInd
* @see java.util.List#toArray(Object[])
*/
private String[] asArray(List<String> list) {
return list.toArray(new String[list.size()]);
return list.toArray(new String[0]);
}
/**
@@ -460,7 +460,7 @@ public class LuceneIndexFactoryBean extends AbstractFactoryBeanSupport<LuceneInd
* @return the Composite {@link IndexConfigurer}.
* @see org.springframework.data.gemfire.config.annotation.IndexConfigurer
*/
protected IndexConfigurer getCompositeRegionConfigurer() {
protected IndexConfigurer getCompositeIndexConfigurer() {
return this.compositeIndexConfigurer;
}
@@ -622,7 +622,7 @@ public class LuceneIndexFactoryBean extends AbstractFactoryBeanSupport<LuceneInd
* to Lucene documents for the {@link LuceneIndex}.
* @see org.apache.geode.cache.lucene.LuceneSerializer
*/
public void setLuceneSerializer(LuceneSerializer luceneSerializer) {
public void setLuceneSerializer(LuceneSerializer<?> luceneSerializer) {
this.luceneSerializer = luceneSerializer;
}
@@ -634,7 +634,7 @@ public class LuceneIndexFactoryBean extends AbstractFactoryBeanSupport<LuceneInd
* to Lucene documents for the {@link LuceneIndex}.
* @see org.apache.geode.cache.lucene.LuceneSerializer
*/
protected LuceneSerializer getLuceneSerializer() {
protected LuceneSerializer<?> getLuceneSerializer() {
return this.luceneSerializer;
}

View File

@@ -53,6 +53,7 @@ import org.springframework.util.StringUtils;
* @see org.apache.geode.cache.client.ClientCache
* @see org.apache.geode.cache.server.CacheServer
* @see org.apache.geode.cache.server.ClientSubscriptionConfig
* @see org.apache.geode.cache.server.ServerLoadProbe
* @see org.springframework.beans.factory.DisposableBean
* @see org.springframework.beans.factory.FactoryBean
* @see org.springframework.beans.factory.InitializingBean
@@ -234,21 +235,18 @@ public class CacheServerFactoryBean extends AbstractFactoryBeanSupport<CacheServ
* {@inheritDoc}
*/
@Override
@SuppressWarnings("unchecked")
public Class<?> getObjectType() {
return Optional.ofNullable(this.cacheServer).map(CacheServer::getClass).orElse((Class) CacheServer.class);
return this.cacheServer != null ? this.cacheServer.getClass() : CacheServer.class;
}
/* (non-Javadoc) */
public boolean isRunning() {
return Optional.ofNullable(this.cacheServer).map(CacheServer::isRunning).orElse(false);
}
/* (non-Javadoc) */
public boolean isAutoStartup() {
return this.autoStartup;
}
public boolean isRunning() {
return this.cacheServer != null && this.cacheServer.isRunning();
}
/**
* Start at the latest possible moment.
*/
@@ -256,15 +254,14 @@ public class CacheServerFactoryBean extends AbstractFactoryBeanSupport<CacheServ
return Integer.MAX_VALUE;
}
/* (non-Javadoc) */
public void destroy() {
stop();
this.cacheServer = null;
}
/* (non-Javadoc) */
@Override
public void start() {
try {
cacheServer.start();
}
@@ -273,29 +270,24 @@ public class CacheServerFactoryBean extends AbstractFactoryBeanSupport<CacheServ
}
}
/* (non-Javadoc) */
public void stop() {
Optional.ofNullable(this.cacheServer).ifPresent(CacheServer::stop);
}
@Override
public void stop(Runnable callback) {
stop();
callback.run();
}
/* (non-Javadoc) */
public void stop() {
Optional.ofNullable(this.cacheServer).ifPresent(CacheServer::stop);
}
/* (non-Javadoc) */
public void setAutoStartup(boolean autoStartup) {
this.autoStartup = autoStartup;
}
/* (non-Javadoc) */
public void setBindAddress(String bindAddress) {
this.bindAddress = bindAddress;
}
/* (non-Javadoc) */
public void setCache(Cache cache) {
this.cache = cache;
}
@@ -334,92 +326,74 @@ public class CacheServerFactoryBean extends AbstractFactoryBeanSupport<CacheServ
this.cacheServerConfigurers = Optional.ofNullable(cacheServerConfigurers).orElseGet(Collections::emptyList);
}
/* (non-Javadoc) */
public void setHostNameForClients(String hostNameForClients) {
this.hostNameForClients = hostNameForClients;
}
/* (non-Javadoc) */
public void setListeners(Set<InterestRegistrationListener> listeners) {
this.listeners = listeners;
}
/* (non-Javadoc) */
public void setLoadPollInterval(long loadPollInterval) {
this.loadPollInterval = loadPollInterval;
}
/* (non-Javadoc) */
public void setMaxConnections(int maxConnections) {
this.maxConnections = maxConnections;
}
/* (non-Javadoc) */
public void setMaxMessageCount(int maxMessageCount) {
this.maxMessageCount = maxMessageCount;
}
/* (non-Javadoc) */
public void setMaxThreads(int maxThreads) {
this.maxThreads = maxThreads;
}
/* (non-Javadoc) */
public void setMaxTimeBetweenPings(int maxTimeBetweenPings) {
this.maxTimeBetweenPings = maxTimeBetweenPings;
}
/* (non-Javadoc) */
public void setMessageTimeToLive(int messageTimeToLive) {
this.messageTimeToLive = messageTimeToLive;
}
/* (non-Javadoc) */
public void setNotifyBySubscription(boolean notifyBySubscription) {
this.notifyBySubscription = notifyBySubscription;
}
/* (non-Javadoc) */
public void setPort(int port) {
this.port = port;
}
/* (non-Javadoc) */
public void setServerGroups(String[] serverGroups) {
this.serverGroups = serverGroups;
}
/* (non-Javadoc) */
public void setServerLoadProbe(ServerLoadProbe serverLoadProbe) {
this.serverLoadProbe = serverLoadProbe;
}
/* (non-Javadoc) */
public void setSocketBufferSize(int socketBufferSize) {
this.socketBufferSize = socketBufferSize;
}
/* (non-Javadoc) */
public void setSubscriptionCapacity(int subscriptionCapacity) {
this.subscriptionCapacity = subscriptionCapacity;
}
/* (non-Javadoc) */
public void setSubscriptionDiskStore(String diskStoreName) {
this.subscriptionDiskStore = diskStoreName;
}
/* (non-Javadoc) */
SubscriptionEvictionPolicy getSubscriptionEvictionPolicy() {
return Optional.ofNullable(this.subscriptionEvictionPolicy).orElse(SubscriptionEvictionPolicy.DEFAULT);
}
/* (non-Javadoc) */
public void setSubscriptionEvictionPolicy(SubscriptionEvictionPolicy evictionPolicy) {
this.subscriptionEvictionPolicy = evictionPolicy;
}
/* (non-Javadoc) */
public void setTcpNoDelay(boolean tcpNoDelay) {
this.tcpNoDelay = tcpNoDelay;
}

View File

@@ -34,14 +34,17 @@ import org.springframework.data.gemfire.util.SpringUtils;
import org.springframework.util.Assert;
/**
* Spring {@link FactoryBean} for creating Apache Geode/Pivotal GemFire {@link AsyncEventQueue AsyncEventQueues}.
* Spring {@link FactoryBean} for constructing, configuring and initializing {@link AsyncEventQueue AsyncEventQueues}.
*
* @author David Turanski
* @author John Blum
* @see org.apache.geode.cache.Cache
* @see org.apache.geode.cache.Region
* @see org.apache.geode.cache.asyncqueue.AsyncEvent
* @see org.apache.geode.cache.asyncqueue.AsyncEventListener
* @see org.apache.geode.cache.asyncqueue.AsyncEventQueue
* @see org.apache.geode.cache.asyncqueue.AsyncEventQueueFactory
* @see org.springframework.beans.factory.FactoryBean
* @see org.springframework.data.gemfire.wan.AbstractWANComponentFactoryBean
*/
@SuppressWarnings("unused")
@@ -63,6 +66,7 @@ public class AsyncEventQueueFactoryBean extends AbstractWANComponentFactoryBean<
private Integer dispatcherThreads;
private Integer maximumQueueMemory;
@SuppressWarnings("rawtypes")
private GatewayEventSubstitutionFilter gatewayEventSubstitutionFilter;
private GatewaySender.OrderPolicy orderPolicy;

View File

@@ -34,7 +34,7 @@ import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
/**
* Spring {@link FactoryBean} for creating a GemFire {@link GatewayReceiver}.
* Spring {@link FactoryBean} used to construct, configure and initialize a {@link GatewayReceiver}.
*
* @author David Turanski
* @author John Blum
@@ -43,7 +43,9 @@ import org.springframework.util.StringUtils;
* @see org.apache.geode.cache.wan.GatewayReceiver
* @see org.apache.geode.cache.wan.GatewayReceiverFactory
* @see org.apache.geode.cache.wan.GatewayTransportFilter
* @see org.springframework.beans.factory.FactoryBean
* @see org.springframework.context.SmartLifecycle
* @see org.springframework.data.gemfire.config.annotation.GatewayReceiverConfigurer
* @see org.springframework.data.gemfire.wan.AbstractWANComponentFactoryBean
* @since 1.2.2
*/

View File

@@ -39,15 +39,21 @@ import org.springframework.data.gemfire.util.CollectionUtils;
import org.springframework.util.StringUtils;
/**
* Spring {@link FactoryBean} for creating a parallel or serial GemFire {@link GatewaySender}.
* Spring {@link FactoryBean} used to construct, configure and initialize parallel and serial
* {@link GatewaySender GatewaySenders}.
*
* @author David Turanski
* @author John Blum
* @author Udo Kohlmeyer
* @see org.apache.geode.cache.Cache
* @see org.apache.geode.cache.GemFireCache
* @see org.apache.geode.cache.wan.GatewayEventFilter
* @see org.apache.geode.cache.wan.GatewayEventSubstitutionFilter
* @see org.apache.geode.cache.wan.GatewaySender
* @see org.apache.geode.cache.wan.GatewaySenderFactory
* @see org.apache.geode.cache.wan.GatewayTransportFilter
* @see org.springframework.beans.factory.FactoryBean
* @see org.springframework.data.gemfire.config.annotation.GatewaySenderConfigurer
* @see org.springframework.data.gemfire.wan.AbstractWANComponentFactoryBean
* @since 1.2.2
*/
@@ -71,6 +77,7 @@ public class GatewaySenderFactoryBean extends AbstractWANComponentFactoryBean<Ga
private GatewaySender.OrderPolicy orderPolicy;
@SuppressWarnings("rawtypes")
private GatewayEventSubstitutionFilter eventSubstitutionFilter;
private Integer alertThreshold;
@@ -255,18 +262,22 @@ public class GatewaySenderFactoryBean extends AbstractWANComponentFactoryBean<Ga
return this.eventFilters;
}
@SuppressWarnings("rawtypes")
public void setEventSubstitutionFilter(GatewayEventSubstitutionFilter eventSubstitutionFilter) {
this.eventSubstitutionFilter = eventSubstitutionFilter;
}
@SuppressWarnings("rawtypes")
public GatewayEventSubstitutionFilter getEventSubstitutionFilter() {
return this.eventSubstitutionFilter;
}
@Deprecated
public void setManualStart(boolean manualStart) {
this.manualStart = manualStart;
}
@Deprecated
public void setManualStart(Boolean manualStart) {
setManualStart(Boolean.TRUE.equals(manualStart));
}