SGF-416 - Remove deprecated code associated with syncing GemFire properties between the ClientCache and Pool.

This commit is contained in:
John Blum
2016-03-23 16:52:47 -07:00
parent e611c520c7
commit a0c5ecad62
8 changed files with 111 additions and 261 deletions

View File

@@ -117,7 +117,7 @@ class CacheParser extends AbstractSingleBeanDefinitionParser {
/* (non-Javadoc) */
void registerGemFireBeanFactoryPostProcessors(BeanDefinitionRegistry registry) {
BeanDefinitionReaderUtils.registerWithGeneratedName(BeanDefinitionBuilder.genericBeanDefinition(
CustomEditorRegistrationBeanFactoryPostProcessor.class).getBeanDefinition(), registry);
CustomEditorRegisteringBeanFactoryPostProcessor.class).getBeanDefinition(), registry);
}
private void parsePdxDiskStore(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {

View File

@@ -1,82 +0,0 @@
/*
* Copyright 2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.springframework.data.gemfire.config;
import org.springframework.beans.BeansException;
import org.springframework.beans.PropertyValue;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.config.RuntimeBeanReference;
import org.springframework.data.gemfire.client.ClientCacheFactoryBean;
import org.springframework.data.gemfire.client.PoolFactoryBean;
import org.springframework.util.StringUtils;
/**
* The ClientCachePoolGemfirePropertiesSyncingBeanFactoryPostProcessor class is a Spring {@link BeanFactoryPostProcessor}
* implementation responsible for making sure the GemFire {@link java.util.Properties} between the GemFire ClientCache
* and GemFire Pool are identical.
*
* @author John Blum
* @see org.springframework.beans.factory.config.BeanDefinition
* @see org.springframework.beans.factory.config.BeanFactoryPostProcessor
* @see org.springframework.beans.factory.config.ConfigurableListableBeanFactory
* @see org.springframework.data.gemfire.client.ClientCacheFactoryBean
* @see org.springframework.data.gemfire.client.PoolFactoryBean
* @since 1.8.0
*/
@Deprecated
class ClientCachePoolGemfirePropertiesSyncingBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
protected static final String PROPERTIES_PROPERTY_NAME = "properties";
/**
* Post processes the given {@link ConfigurableListableBeanFactory} by syncing the gemfire.properties used
* to configure the GemFire Distributed System constructed by the {@link PoolFactoryBean} during Pool creation
* and resolved by the {@link ClientCacheFactoryBean} during ClientCache creation.
*
* @param beanFactory the {@link ConfigurableListableBeanFactory} to post process.
* @throws BeansException if errors occur during post processing.
* @see org.springframework.beans.factory.config.ConfigurableListableBeanFactory
*/
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
BeanDefinition poolFactoryBeanDefinition = null;
String gemfirePropertiesBeanName = null;
for (String beanName : beanFactory.getBeanDefinitionNames()) {
BeanDefinition beanDefinition = beanFactory.getBeanDefinition(beanName);
if (ClientCacheFactoryBean.class.getName().equals(beanDefinition.getBeanClassName())) {
PropertyValue gemfirePropertiesPropertyValue = beanDefinition.getPropertyValues()
.getPropertyValue(PROPERTIES_PROPERTY_NAME);
gemfirePropertiesBeanName = (gemfirePropertiesPropertyValue != null
? ((RuntimeBeanReference) gemfirePropertiesPropertyValue.getValue()).getBeanName() : null);
}
else if (PoolFactoryBean.class.getName().equals(beanDefinition.getBeanClassName())) {
poolFactoryBeanDefinition = beanDefinition;
}
}
if (poolFactoryBeanDefinition != null && StringUtils.hasText(gemfirePropertiesBeanName)) {
poolFactoryBeanDefinition.getPropertyValues().add(PROPERTIES_PROPERTY_NAME,
new RuntimeBeanReference(gemfirePropertiesBeanName));
}
}
}

View File

@@ -49,20 +49,23 @@ import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.cache.util.Gateway;
/**
* The CustomEditorRegistrationBeanFactoryPostProcessor class is a Spring BeanFactoryPostProcessor used to register
* custom GemFire JavaBeans PropertyEditors and Spring Converters that are used to perform type conversions between
* String-based configuration meta-data and actual GemFire or SDG defined enumerated types.
* The CustomEditorRegisteringBeanFactoryPostProcessor class is a Spring {@link BeanFactoryPostProcessor} used
* to register custom GemFire-specific JavaBeans {@link java.beans.PropertyEditor}s and Spring {@link Converter}s
* that are used to perform type conversions between String-based configuration meta-data and actual GemFire
* or Spring Data GemFire defined enumerated types.
*
* @author John Blum
* @see org.springframework.beans.factory.config.BeanFactoryPostProcessor
* @see org.springframework.beans.factory.config.ConfigurableListableBeanFactory
* @since 1.6.0
*/
@SuppressWarnings({ "deprecation", "unused" })
public class CustomEditorRegistrationBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
class CustomEditorRegisteringBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
/* (non-Javadoc) */
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
beanFactory.registerCustomEditor(ConnectionEndpoint[].class, ConnectionEndpointArrayToIterableConverter.class);
//beanFactory.registerCustomEditor(ConnectionEndpoint[].class, ConnectionEndpointArrayToIterableConverter.class);
beanFactory.registerCustomEditor(EvictionAction.class, EvictionActionConverter.class);
beanFactory.registerCustomEditor(EvictionPolicyType.class, EvictionPolicyConverter.class);
beanFactory.registerCustomEditor(ExpirationAction.class, ExpirationActionConverter.class);
@@ -76,7 +79,8 @@ public class CustomEditorRegistrationBeanFactoryPostProcessor implements BeanFac
beanFactory.registerCustomEditor(SubscriptionEvictionPolicy.class, SubscriptionEvictionPolicyConverter.class);
}
static final class ConnectionEndpointArrayToIterableConverter extends PropertyEditorSupport
/* (non-Javadoc) */
public static class ConnectionEndpointArrayToIterableConverter extends PropertyEditorSupport
implements Converter<ConnectionEndpoint[], Iterable> {
@Override

View File

@@ -35,6 +35,8 @@ import org.springframework.core.task.SimpleAsyncTaskExecutor;
import org.springframework.core.task.TaskExecutor;
import org.springframework.data.gemfire.GemfireQueryException;
import org.springframework.data.gemfire.GemfireUtils;
import org.springframework.data.gemfire.client.support.DefaultableDelegatingPoolAdapter;
import org.springframework.data.gemfire.client.support.DelegatingPoolAdapter;
import org.springframework.data.gemfire.config.GemfireConstants;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
@@ -108,6 +110,9 @@ public class ContinuousQueryListenerContainer implements BeanFactoryAware, BeanN
initQueryService(eagerlyInitializePool(resolvePoolName()));
initExecutor();
initContinuousQueries(continuousQueryDefinitions);
Assert.state(queryService != null, "QueryService was not properly initialized");
initialized = true;
if (isAutoStartup()) {
@@ -145,8 +150,9 @@ public class ContinuousQueryListenerContainer implements BeanFactoryAware, BeanN
/* (non-Javadoc) */
QueryService initQueryService(String poolName) {
if (queryService == null) {
queryService = PoolManager.find(poolName).getQueryService();
if (queryService == null || StringUtils.hasText(poolName)) {
queryService = DefaultableDelegatingPoolAdapter.from(DelegatingPoolAdapter.from(
PoolManager.find(poolName))).preferPool().getQueryService(queryService);
}
return queryService;