INT-1812 eliminated package cycles
This commit is contained in:
committed by
Gary Russell
parent
a5b13dba44
commit
985374ca69
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.integration.config;
|
||||
|
||||
import java.util.List;
|
||||
@@ -20,6 +21,7 @@ import java.util.List;
|
||||
import org.aopalliance.aop.Advice;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.aop.framework.Advised;
|
||||
import org.springframework.aop.framework.ProxyFactory;
|
||||
import org.springframework.aop.support.AopUtils;
|
||||
@@ -33,7 +35,6 @@ import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.SmartLifecycle;
|
||||
import org.springframework.integration.MessageChannel;
|
||||
import org.springframework.integration.context.IntegrationContextUtils;
|
||||
import org.springframework.integration.context.IntegrationObjectSupport;
|
||||
import org.springframework.integration.core.MessageHandler;
|
||||
import org.springframework.integration.core.PollableChannel;
|
||||
@@ -216,7 +217,7 @@ public class ConsumerEndpointFactoryBean
|
||||
else if (channel instanceof PollableChannel) {
|
||||
PollingConsumer pollingConsumer = new PollingConsumer((PollableChannel) channel, this.handler);
|
||||
if (this.pollerMetadata == null) {
|
||||
this.pollerMetadata = IntegrationContextUtils.getDefaultPollerMetadata(this.beanFactory);
|
||||
this.pollerMetadata = PollerMetadata.getDefaultPollerMetadata(this.beanFactory);
|
||||
Assert.notNull(this.pollerMetadata, "No poller has been defined for endpoint '" + this.beanName
|
||||
+ "', and no default poller is available within the context.");
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.SmartLifecycle;
|
||||
import org.springframework.integration.MessageChannel;
|
||||
import org.springframework.integration.context.IntegrationContextUtils;
|
||||
import org.springframework.integration.core.MessageSource;
|
||||
import org.springframework.integration.endpoint.SourcePollingChannelAdapter;
|
||||
import org.springframework.integration.scheduling.PollerMetadata;
|
||||
@@ -127,7 +126,7 @@ public class SourcePollingChannelAdapterFactoryBean implements FactoryBean<Sourc
|
||||
spca.setSource(this.source);
|
||||
spca.setOutputChannel(this.outputChannel);
|
||||
if (this.pollerMetadata == null) {
|
||||
this.pollerMetadata = IntegrationContextUtils.getDefaultPollerMetadata(this.beanFactory);
|
||||
this.pollerMetadata = PollerMetadata.getDefaultPollerMetadata(this.beanFactory);
|
||||
Assert.notNull(this.pollerMetadata, "No poller has been defined for channel-adapter '"
|
||||
+ this.beanName + "', and no default poller is available within the context.");
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
|
||||
import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.integration.channel.MessagePublishingErrorHandler;
|
||||
import org.springframework.integration.context.IntegrationContextUtils;
|
||||
import org.springframework.integration.scheduling.PollerMetadata;
|
||||
import org.springframework.scheduling.support.CronTrigger;
|
||||
import org.springframework.scheduling.support.PeriodicTrigger;
|
||||
@@ -54,15 +53,15 @@ public class PollerParser extends AbstractBeanDefinitionParser {
|
||||
protected String resolveId(Element element, AbstractBeanDefinition definition, ParserContext parserContext) throws BeanDefinitionStoreException {
|
||||
String id = super.resolveId(element, definition, parserContext);
|
||||
if (element.getAttribute("default").equals("true")) {
|
||||
if (parserContext.getRegistry().isBeanNameInUse(IntegrationContextUtils.DEFAULT_POLLER_METADATA_BEAN_NAME)) {
|
||||
if (parserContext.getRegistry().isBeanNameInUse(PollerMetadata.DEFAULT_POLLER_METADATA_BEAN_NAME)) {
|
||||
parserContext.getReaderContext().error(
|
||||
"Only one default <poller/> element is allowed per context.", element);
|
||||
}
|
||||
if (StringUtils.hasText(id)) {
|
||||
parserContext.getRegistry().registerAlias(id, IntegrationContextUtils.DEFAULT_POLLER_METADATA_BEAN_NAME);
|
||||
parserContext.getRegistry().registerAlias(id, PollerMetadata.DEFAULT_POLLER_METADATA_BEAN_NAME);
|
||||
}
|
||||
else {
|
||||
id = IntegrationContextUtils.DEFAULT_POLLER_METADATA_BEAN_NAME;
|
||||
id = PollerMetadata.DEFAULT_POLLER_METADATA_BEAN_NAME;
|
||||
}
|
||||
}
|
||||
else if (!StringUtils.hasText(id)) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-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.
|
||||
@@ -19,7 +19,6 @@ package org.springframework.integration.context;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.integration.MessageChannel;
|
||||
import org.springframework.integration.scheduling.PollerMetadata;
|
||||
import org.springframework.integration.store.MetadataStore;
|
||||
import org.springframework.scheduling.TaskScheduler;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -42,8 +41,6 @@ public abstract class IntegrationContextUtils {
|
||||
|
||||
public static final String INTEGRATION_CONVERSION_SERVICE_BEAN_NAME = "integrationConversionService";
|
||||
|
||||
public static final String DEFAULT_POLLER_METADATA_BEAN_NAME = "org.springframework.integration.context.defaultPollerMetadata";
|
||||
|
||||
|
||||
/**
|
||||
* Return the {@link MetadataStore} bean whose name is "metadataStore".
|
||||
@@ -80,14 +77,6 @@ public abstract class IntegrationContextUtils {
|
||||
return taskScheduler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the default {@link PollerMetadata} bean if available.
|
||||
* @param beanFactory BeanFactory for lookup, must not be null.
|
||||
*/
|
||||
public static PollerMetadata getDefaultPollerMetadata(BeanFactory beanFactory) {
|
||||
return getBeanOfType(beanFactory, DEFAULT_POLLER_METADATA_BEAN_NAME, PollerMetadata.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the {@link ConversionService} bean whose name is "integrationConversionService" if available.
|
||||
* @param beanFactory BeanFactory for lookup, must not be null.
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.util;
|
||||
|
||||
package org.springframework.integration.expression;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
@@ -32,9 +33,8 @@ import org.springframework.integration.context.IntegrationContextUtils;
|
||||
* @author Gary Russell
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.2
|
||||
*
|
||||
*/
|
||||
public class ExpressionUtils {
|
||||
public abstract class ExpressionUtils {
|
||||
|
||||
/**
|
||||
* Create a {@link StandardEvaluationContext} with a {@link MapAccessor} in its
|
||||
@@ -26,9 +26,9 @@ import org.springframework.integration.MessageHeaders;
|
||||
import org.springframework.integration.MessagingException;
|
||||
import org.springframework.integration.core.MessageHandler;
|
||||
import org.springframework.integration.core.MessagingTemplate;
|
||||
import org.springframework.integration.expression.ExpressionUtils;
|
||||
import org.springframework.integration.message.AdviceMessage;
|
||||
import org.springframework.integration.message.ErrorMessage;
|
||||
import org.springframework.integration.util.ExpressionUtils;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.springframework.expression.Expression;
|
||||
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||
import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.util.ExpressionUtils;
|
||||
import org.springframework.integration.expression.ExpressionUtils;
|
||||
import org.springframework.retry.RetryState;
|
||||
import org.springframework.retry.support.DefaultRetryState;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.util.List;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import org.aopalliance.aop.Advice;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.integration.transaction.TransactionSynchronizationFactory;
|
||||
import org.springframework.scheduling.Trigger;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -35,6 +35,9 @@ public class PollerMetadata {
|
||||
|
||||
public static final int MAX_MESSAGES_UNBOUNDED = Integer.MIN_VALUE;
|
||||
|
||||
public static final String DEFAULT_POLLER_METADATA_BEAN_NAME =
|
||||
"org.springframework.integration.context.defaultPollerMetadata";
|
||||
|
||||
private volatile Trigger trigger;
|
||||
|
||||
private volatile long maxMessagesPerPoll = MAX_MESSAGES_UNBOUNDED;
|
||||
@@ -51,6 +54,7 @@ public class PollerMetadata {
|
||||
|
||||
private volatile TransactionSynchronizationFactory transactionSynchronizationFactory;
|
||||
|
||||
|
||||
public void setTransactionSynchronizationFactory(
|
||||
TransactionSynchronizationFactory transactionSynchronizationFactory) {
|
||||
Assert.notNull(transactionSynchronizationFactory, "'transactionSynchronizationFactory' must not be null");
|
||||
@@ -126,4 +130,17 @@ public class PollerMetadata {
|
||||
this.sendTimeout = sendTimeout;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the default {@link PollerMetadata} bean if available.
|
||||
* @param beanFactory BeanFactory for lookup, must not be null.
|
||||
*/
|
||||
public static PollerMetadata getDefaultPollerMetadata(BeanFactory beanFactory) {
|
||||
Assert.notNull(beanFactory, "BeanFactory must not be null");
|
||||
if (!beanFactory.containsBean(DEFAULT_POLLER_METADATA_BEAN_NAME)) {
|
||||
return null;
|
||||
}
|
||||
return beanFactory.getBean(DEFAULT_POLLER_METADATA_BEAN_NAME, PollerMetadata.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@ import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessageChannel;
|
||||
import org.springframework.integration.context.IntegrationObjectSupport;
|
||||
import org.springframework.integration.expression.ExpressionUtils;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.integration.util.ExpressionUtils;
|
||||
import org.springframework.transaction.support.TransactionSynchronization;
|
||||
import org.springframework.util.Assert;
|
||||
/**
|
||||
|
||||
@@ -26,11 +26,11 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.aopalliance.aop.Advice;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.config.TestTrigger;
|
||||
import org.springframework.integration.context.IntegrationContextUtils;
|
||||
import org.springframework.integration.scheduling.PollerMetadata;
|
||||
import org.springframework.integration.test.util.TestUtils;
|
||||
import org.springframework.scheduling.support.PeriodicTrigger;
|
||||
@@ -51,7 +51,7 @@ public class PollerParserTests {
|
||||
"defaultPollerWithId.xml", PollerParserTests.class);
|
||||
Object poller = context.getBean("defaultPollerWithId");
|
||||
assertNotNull(poller);
|
||||
Object defaultPoller = context.getBean(IntegrationContextUtils.DEFAULT_POLLER_METADATA_BEAN_NAME);
|
||||
Object defaultPoller = context.getBean(PollerMetadata.DEFAULT_POLLER_METADATA_BEAN_NAME);
|
||||
assertNotNull(defaultPoller);
|
||||
assertEquals(defaultPoller, context.getBean("defaultPollerWithId"));
|
||||
}
|
||||
@@ -60,7 +60,7 @@ public class PollerParserTests {
|
||||
public void defaultPollerWithoutId() {
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"defaultPollerWithoutId.xml", PollerParserTests.class);
|
||||
Object defaultPoller = context.getBean(IntegrationContextUtils.DEFAULT_POLLER_METADATA_BEAN_NAME);
|
||||
Object defaultPoller = context.getBean(PollerMetadata.DEFAULT_POLLER_METADATA_BEAN_NAME);
|
||||
assertNotNull(defaultPoller);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessageHeaders;
|
||||
import org.springframework.integration.MessagingException;
|
||||
import org.springframework.integration.context.OrderlyShutdownCapable;
|
||||
import org.springframework.integration.expression.ExpressionUtils;
|
||||
import org.springframework.integration.gateway.MessagingGatewaySupport;
|
||||
import org.springframework.integration.http.converter.MultipartAwareFormHttpMessageConverter;
|
||||
import org.springframework.integration.http.converter.SerializingHttpMessageConverter;
|
||||
@@ -58,7 +59,6 @@ import org.springframework.integration.http.multipart.MultipartHttpInputMessage;
|
||||
import org.springframework.integration.http.support.DefaultHttpHeaderMapper;
|
||||
import org.springframework.integration.mapping.HeaderMapper;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.integration.util.ExpressionUtils;
|
||||
import org.springframework.util.AntPathMatcher;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
@@ -29,10 +29,10 @@ import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.context.IntegrationObjectSupport;
|
||||
import org.springframework.integration.core.MessageSource;
|
||||
import org.springframework.integration.expression.ExpressionUtils;
|
||||
import org.springframework.integration.mongodb.support.MongoHeaders;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.integration.transaction.IntegrationResourceHolder;
|
||||
import org.springframework.integration.util.ExpressionUtils;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
@@ -24,8 +24,8 @@ import org.springframework.expression.common.LiteralExpression;
|
||||
import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.core.MessageHandler;
|
||||
import org.springframework.integration.expression.ExpressionUtils;
|
||||
import org.springframework.integration.handler.AbstractMessageHandler;
|
||||
import org.springframework.integration.util.ExpressionUtils;
|
||||
import org.springframework.util.Assert;
|
||||
/**
|
||||
* Implementation of {@link MessageHandler} which writes Message payload into a MongoDb collection
|
||||
|
||||
@@ -31,9 +31,9 @@ import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.context.IntegrationObjectSupport;
|
||||
import org.springframework.integration.core.MessageSource;
|
||||
import org.springframework.integration.expression.ExpressionUtils;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.integration.transaction.IntegrationResourceHolder;
|
||||
import org.springframework.integration.util.ExpressionUtils;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
import org.springframework.util.Assert;
|
||||
/**
|
||||
|
||||
@@ -44,9 +44,9 @@ import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.integration.core.MessageHandler;
|
||||
import org.springframework.integration.expression.ExpressionUtils;
|
||||
import org.springframework.integration.handler.AbstractMessageHandler;
|
||||
import org.springframework.integration.redis.support.RedisHeaders;
|
||||
import org.springframework.integration.util.ExpressionUtils;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.NumberUtils;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user