From 82f252dd00d2f352340107aab7011e8d1d72b2de Mon Sep 17 00:00:00 2001 From: Gary Russell Date: Wed, 14 Mar 2018 12:10:33 -0400 Subject: [PATCH] INT-4390: Fix tangles JIRA: https://jira.spring.io/browse/INT-4390 Phase I: flow context/registration cycle - extract interfaces - rename implementations to `Standard...` Phase II - dsl<->dsl.channel tangles Move the channel specs to dsl. Fix missing refactorings (Not related to DSL) - rename core `event` package to `events` - avoid collision with event module package - fix tangle caused by `MessageGroupExpiredEvent`. Phase III - dsl<->config.dsl - move classes from config.dsl to dsl (Not related to DSL) - fix many tangles caused by graph being a sub-package of support.management - make `graph` a top-level package (Not related to DSL) - move `IntegrationManagementConfigurer` from `management` to `config` - tangle between core and management * Polishing Copyrights, diamonds, some JavaDocs and What's New --- .../dsl/AmqpPollableMessageChannelSpec.java | 5 +- .../aggregator/MessageGroupExpiredEvent.java | 5 +- .../config/EnableIntegrationManagement.java | 4 +- .../IntegrationManagementConfiguration.java | 4 +- .../IntegrationManagementConfigurer.java | 13 +- .../integration/config/dsl/package-info.java | 4 - .../xml/IntegrationManagementParser.java | 5 +- .../integration/dsl/Channels.java | 10 +- .../dsl/{channel => }/DirectChannelSpec.java | 4 +- .../{channel => }/ExecutorChannelSpec.java | 4 +- .../{channel => }/FluxMessageChannelSpec.java | 4 +- .../dsl/IntegrationFlowAdapter.java | 3 +- .../dsl/IntegrationFlowBeanPostProcessor.java | 12 +- .../dsl/IntegrationFlowDefinition.java | 8 +- .../integration/dsl/IntegrationFlows.java | 7 +- .../LoadBalancingChannelSpec.java | 4 +- .../dsl/{channel => }/MessageChannelSpec.java | 6 +- .../dsl/{channel => }/MessageChannels.java | 4 +- .../{channel => }/PriorityChannelSpec.java | 4 +- .../PublishSubscribeChannelSpec.java | 4 +- .../integration/dsl/PublishSubscribeSpec.java | 4 +- .../dsl/{channel => }/QueueChannelSpec.java | 4 +- .../{channel => }/RendezvousChannelSpec.java | 4 +- .../dsl/StandardIntegrationFlow.java | 2 +- .../dsl/{channel => }/WireTapSpec.java | 6 +- .../integration/dsl/channel/package-info.java | 4 - ...slIntegrationConfigurationInitializer.java | 9 +- .../dsl/context/IntegrationFlowContext.java | 228 +++++-------- .../StandardIntegrationFlowContext.java | 275 +++++++++++++++ ... StandardIntegrationFlowRegistration.java} | 34 +- .../FixedSubscriberChannelPrototype.java | 4 +- .../dsl/support/MessageChannelReference.java | 4 +- .../{event => events}/IntegrationEvent.java | 4 +- .../{event => events}/package-info.java | 2 +- .../graph/CompositeMessageHandlerNode.java | 8 +- .../graph/DiscardingMessageHandlerNode.java | 6 +- .../management => }/graph/EndpointNode.java | 5 +- ...rorCapableCompositeMessageHandlerNode.java | 6 +- ...orCapableDiscardingMessageHandlerNode.java | 6 +- .../graph/ErrorCapableEndpointNode.java | 6 +- .../graph/ErrorCapableMessageHandlerNode.java | 5 +- .../graph/ErrorCapableNode.java | 5 +- .../graph/ErrorCapableRoutingNode.java | 6 +- .../{support/management => }/graph/Graph.java | 5 +- .../graph/IntegrationGraphServer.java | 25 +- .../graph/IntegrationNode.java | 4 +- .../management => }/graph/LinkNode.java | 4 +- .../graph/MessageChannelNode.java | 5 +- .../graph/MessageGatewayNode.java | 5 +- .../graph/MessageHandlerNode.java | 6 +- .../graph/MessageProducerNode.java | 5 +- .../graph/MessageSourceNode.java | 5 +- .../graph/RoutingMessageHandlerNode.java | 6 +- .../integration/graph/package-info.java | 4 + .../management/graph/package-info.java | 4 - .../main/resources/META-INF/spring.factories | 2 +- .../correlation/CorrelationHandlerTests.java | 2 +- .../dsl/flows/IntegrationFlowTests.java | 2 +- .../dsl/flowservices/FlowServiceTests.java | 4 +- .../dsl/manualflow/ManualFlowTests.java | 4 +- .../reactivestreams/ReactiveStreamsTests.java | 2 +- .../integration/dsl/routers/RouterTests.java | 4 +- .../dsl/transformers/TransformerTests.java | 2 +- .../json/ContentTypeConversionTests.java | 4 +- .../IntegrationManagementConfigurerTests.java | 4 +- .../graph/IntegrationGraphServerTests.java | 5 +- .../event/dsl/IntegrationFlowEventsTests.java | 4 +- .../file/event/FileIntegrationEvent.java | 5 +- .../integration/file/dsl/FileTests.java | 4 +- .../integration/ftp/dsl/FtpTests.java | 4 +- .../IntegrationGraphControllerRegistrar.java | 4 +- .../IntegrationGraphController.java | 6 +- .../ip/event/IpIntegrationEvent.java | 5 +- .../ip/dsl/IpIntegrationTests.java | 3 +- .../dsl/JmsPollableMessageChannelSpec.java | 5 +- .../integration/jms/dsl/JmsTests.java | 4 +- .../IntegrationMBeanExportConfiguration.java | 10 +- .../monitor/IntegrationMBeanExporter.java | 33 +- .../jmx/config/MBeanExporterParserTests.java | 7 +- .../configuration/EnableMBeanExportTests.java | 2 +- .../mail/event/MailIntegrationEvent.java | 5 +- .../integration/mail/dsl/MailTests.java | 4 +- .../integration/mongodb/dsl/MongoDbTests.java | 5 +- .../mqtt/event/MqttIntegrationEvent.java | 4 +- .../redis/event/RedisIntegrationEvent.java | 5 +- .../RedisQueueMessageDrivenEndpointTests.java | 27 +- .../integration/sftp/dsl/SftpTests.java | 5 +- .../stomp/event/StompIntegrationEvent.java | 6 +- .../integration/stream/StreamClosedEvent.java | 5 +- .../test/mock/MockMessageSourceTests.java | 4 +- src/reference/asciidoc/changes-4.3-5.0.adoc | 312 +++++++++++++++++ src/reference/asciidoc/history.adoc | 2 + src/reference/asciidoc/whats-new.adoc | 318 +----------------- 93 files changed, 968 insertions(+), 694 deletions(-) rename spring-integration-core/src/main/java/org/springframework/integration/{support/management => config}/IntegrationManagementConfigurer.java (94%) delete mode 100644 spring-integration-core/src/main/java/org/springframework/integration/config/dsl/package-info.java rename spring-integration-core/src/main/java/org/springframework/integration/dsl/{channel => }/DirectChannelSpec.java (91%) rename spring-integration-core/src/main/java/org/springframework/integration/dsl/{channel => }/ExecutorChannelSpec.java (92%) rename spring-integration-core/src/main/java/org/springframework/integration/dsl/{channel => }/FluxMessageChannelSpec.java (89%) rename spring-integration-core/src/main/java/org/springframework/integration/{config => }/dsl/IntegrationFlowBeanPostProcessor.java (95%) rename spring-integration-core/src/main/java/org/springframework/integration/dsl/{channel => }/LoadBalancingChannelSpec.java (94%) rename spring-integration-core/src/main/java/org/springframework/integration/dsl/{channel => }/MessageChannelSpec.java (94%) rename spring-integration-core/src/main/java/org/springframework/integration/dsl/{channel => }/MessageChannels.java (97%) rename spring-integration-core/src/main/java/org/springframework/integration/dsl/{channel => }/PriorityChannelSpec.java (95%) rename spring-integration-core/src/main/java/org/springframework/integration/dsl/{channel => }/PublishSubscribeChannelSpec.java (94%) rename spring-integration-core/src/main/java/org/springframework/integration/dsl/{channel => }/QueueChannelSpec.java (96%) rename spring-integration-core/src/main/java/org/springframework/integration/dsl/{channel => }/RendezvousChannelSpec.java (89%) rename spring-integration-core/src/main/java/org/springframework/integration/dsl/{channel => }/WireTapSpec.java (92%) delete mode 100644 spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/package-info.java rename spring-integration-core/src/main/java/org/springframework/integration/{config/dsl => dsl/context}/DslIntegrationConfigurationInitializer.java (90%) create mode 100644 spring-integration-core/src/main/java/org/springframework/integration/dsl/context/StandardIntegrationFlowContext.java rename spring-integration-core/src/main/java/org/springframework/integration/dsl/context/{IntegrationFlowRegistration.java => StandardIntegrationFlowRegistration.java} (84%) rename spring-integration-core/src/main/java/org/springframework/integration/{event => events}/IntegrationEvent.java (93%) rename spring-integration-core/src/main/java/org/springframework/integration/{event => events}/package-info.java (61%) rename spring-integration-core/src/main/java/org/springframework/integration/{support/management => }/graph/CompositeMessageHandlerNode.java (88%) rename spring-integration-core/src/main/java/org/springframework/integration/{support/management => }/graph/DiscardingMessageHandlerNode.java (90%) rename spring-integration-core/src/main/java/org/springframework/integration/{support/management => }/graph/EndpointNode.java (89%) rename spring-integration-core/src/main/java/org/springframework/integration/{support/management => }/graph/ErrorCapableCompositeMessageHandlerNode.java (91%) rename spring-integration-core/src/main/java/org/springframework/integration/{support/management => }/graph/ErrorCapableDiscardingMessageHandlerNode.java (91%) rename spring-integration-core/src/main/java/org/springframework/integration/{support/management => }/graph/ErrorCapableEndpointNode.java (90%) rename spring-integration-core/src/main/java/org/springframework/integration/{support/management => }/graph/ErrorCapableMessageHandlerNode.java (90%) rename spring-integration-core/src/main/java/org/springframework/integration/{support/management => }/graph/ErrorCapableNode.java (86%) rename spring-integration-core/src/main/java/org/springframework/integration/{support/management => }/graph/ErrorCapableRoutingNode.java (91%) rename spring-integration-core/src/main/java/org/springframework/integration/{support/management => }/graph/Graph.java (92%) rename spring-integration-core/src/main/java/org/springframework/integration/{support/management => }/graph/IntegrationGraphServer.java (97%) rename spring-integration-core/src/main/java/org/springframework/integration/{support/management => }/graph/IntegrationNode.java (94%) rename spring-integration-core/src/main/java/org/springframework/integration/{support/management => }/graph/LinkNode.java (90%) rename spring-integration-core/src/main/java/org/springframework/integration/{support/management => }/graph/MessageChannelNode.java (96%) rename spring-integration-core/src/main/java/org/springframework/integration/{support/management => }/graph/MessageGatewayNode.java (92%) rename spring-integration-core/src/main/java/org/springframework/integration/{support/management => }/graph/MessageHandlerNode.java (95%) rename spring-integration-core/src/main/java/org/springframework/integration/{support/management => }/graph/MessageProducerNode.java (89%) rename spring-integration-core/src/main/java/org/springframework/integration/{support/management => }/graph/MessageSourceNode.java (92%) rename spring-integration-core/src/main/java/org/springframework/integration/{support/management => }/graph/RoutingMessageHandlerNode.java (90%) create mode 100644 spring-integration-core/src/main/java/org/springframework/integration/graph/package-info.java delete mode 100644 spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/package-info.java create mode 100644 src/reference/asciidoc/changes-4.3-5.0.adoc diff --git a/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/dsl/AmqpPollableMessageChannelSpec.java b/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/dsl/AmqpPollableMessageChannelSpec.java index 034abbd0e8..ce33c2ed06 100644 --- a/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/dsl/AmqpPollableMessageChannelSpec.java +++ b/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/dsl/AmqpPollableMessageChannelSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2016 the original author or authors. + * Copyright 2014-2018 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. @@ -26,7 +26,7 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.integration.amqp.channel.AbstractAmqpChannel; import org.springframework.integration.amqp.config.AmqpChannelFactoryBean; import org.springframework.integration.amqp.support.AmqpHeaderMapper; -import org.springframework.integration.dsl.channel.MessageChannelSpec; +import org.springframework.integration.dsl.MessageChannelSpec; import org.springframework.util.Assert; /** @@ -36,6 +36,7 @@ import org.springframework.util.Assert; * * @author Artem Bilan * @author Gary Russell + * * @since 5.0 */ public class AmqpPollableMessageChannelSpec> diff --git a/spring-integration-core/src/main/java/org/springframework/integration/aggregator/MessageGroupExpiredEvent.java b/spring-integration-core/src/main/java/org/springframework/integration/aggregator/MessageGroupExpiredEvent.java index 23d2f4802b..65c43cef80 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/aggregator/MessageGroupExpiredEvent.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/aggregator/MessageGroupExpiredEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2016 the original author or authors. + * Copyright 2014-2018 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. @@ -18,13 +18,14 @@ package org.springframework.integration.aggregator; import java.util.Date; -import org.springframework.integration.event.IntegrationEvent; +import org.springframework.integration.events.IntegrationEvent; import org.springframework.integration.support.context.NamedComponent; /** * Event representing the expiration of a message group. * * @author Gary Russell + * * @since 4.0.1 */ public class MessageGroupExpiredEvent extends IntegrationEvent { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/EnableIntegrationManagement.java b/spring-integration-core/src/main/java/org/springframework/integration/config/EnableIntegrationManagement.java index 3c18ab99b9..e98b01799b 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/EnableIntegrationManagement.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/EnableIntegrationManagement.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2015 the original author or authors. + * Copyright 2014-2018 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. @@ -24,7 +24,6 @@ import java.lang.annotation.Target; import org.springframework.context.annotation.Import; import org.springframework.integration.support.management.IntegrationManagement; -import org.springframework.integration.support.management.IntegrationManagementConfigurer; /** * Enables default configuring of management in Spring Integration components in an existing application. @@ -33,6 +32,7 @@ import org.springframework.integration.support.management.IntegrationManagementC * bean is defined under the name {@code integrationManagementConfigurer}. * * @author Gary Russell + * * @since 4.2 */ @Target(ElementType.TYPE) diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/IntegrationManagementConfiguration.java b/spring-integration-core/src/main/java/org/springframework/integration/config/IntegrationManagementConfiguration.java index ca1de73db9..7d9dd5d532 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/IntegrationManagementConfiguration.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/IntegrationManagementConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 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. @@ -30,7 +30,6 @@ import org.springframework.context.annotation.Role; import org.springframework.core.annotation.AnnotationAttributes; import org.springframework.core.env.Environment; import org.springframework.core.type.AnnotationMetadata; -import org.springframework.integration.support.management.IntegrationManagementConfigurer; import org.springframework.util.Assert; import org.springframework.util.StringUtils; @@ -42,6 +41,7 @@ import org.springframework.util.StringUtils; * * @author Artem Bilan * @author Gary Russell + * * @since 4.2 */ @Configuration diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/management/IntegrationManagementConfigurer.java b/spring-integration-core/src/main/java/org/springframework/integration/config/IntegrationManagementConfigurer.java similarity index 94% rename from spring-integration-core/src/main/java/org/springframework/integration/support/management/IntegrationManagementConfigurer.java rename to spring-integration-core/src/main/java/org/springframework/integration/config/IntegrationManagementConfigurer.java index 0ef65d2f9d..eede88513c 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/management/IntegrationManagementConfigurer.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/IntegrationManagementConfigurer.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.support.management; +package org.springframework.integration.config; import java.util.Arrays; import java.util.HashMap; @@ -31,7 +31,18 @@ import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.integration.core.MessageSource; +import org.springframework.integration.support.management.AbstractMessageChannelMetrics; +import org.springframework.integration.support.management.AbstractMessageHandlerMetrics; +import org.springframework.integration.support.management.ConfigurableMetricsAware; +import org.springframework.integration.support.management.DefaultMetricsFactory; +import org.springframework.integration.support.management.IntegrationManagement; import org.springframework.integration.support.management.IntegrationManagement.ManagementOverrides; +import org.springframework.integration.support.management.MessageChannelMetrics; +import org.springframework.integration.support.management.MessageHandlerMetrics; +import org.springframework.integration.support.management.MessageSourceMetrics; +import org.springframework.integration.support.management.MessageSourceMetricsConfigurer; +import org.springframework.integration.support.management.MetricsFactory; +import org.springframework.integration.support.management.PollableChannelManagement; import org.springframework.integration.support.management.metrics.MetricsCaptor; import org.springframework.integration.support.management.micrometer.MicrometerMetricsCaptor; import org.springframework.integration.support.utils.PatternMatchUtils; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/dsl/package-info.java b/spring-integration-core/src/main/java/org/springframework/integration/config/dsl/package-info.java deleted file mode 100644 index 0f141ca242..0000000000 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/dsl/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Provides config classes of the Spring Integration Java DSL. - */ -package org.springframework.integration.config.dsl; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/IntegrationManagementParser.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/IntegrationManagementParser.java index 7f31c686ec..16a37403df 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/IntegrationManagementParser.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/IntegrationManagementParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2017 the original author or authors. + * Copyright 2015-2018 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. @@ -23,7 +23,7 @@ import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser; import org.springframework.beans.factory.xml.ParserContext; -import org.springframework.integration.support.management.IntegrationManagementConfigurer; +import org.springframework.integration.config.IntegrationManagementConfigurer; /** * Parser for the <management/> element. @@ -37,6 +37,7 @@ public class IntegrationManagementParser extends AbstractBeanDefinitionParser { @Override protected String resolveId(Element element, AbstractBeanDefinition definition, ParserContext parserContext) throws BeanDefinitionStoreException { + return IntegrationManagementConfigurer.MANAGEMENT_CONFIGURER_NAME; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/Channels.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/Channels.java index 0e932ae4fb..08d114cdd2 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/Channels.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/Channels.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017 the original author or authors. + * Copyright 2016-2018 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,14 +19,6 @@ package org.springframework.integration.dsl; import java.util.Queue; import java.util.concurrent.Executor; -import org.springframework.integration.dsl.channel.DirectChannelSpec; -import org.springframework.integration.dsl.channel.ExecutorChannelSpec; -import org.springframework.integration.dsl.channel.FluxMessageChannelSpec; -import org.springframework.integration.dsl.channel.MessageChannels; -import org.springframework.integration.dsl.channel.PriorityChannelSpec; -import org.springframework.integration.dsl.channel.PublishSubscribeChannelSpec; -import org.springframework.integration.dsl.channel.QueueChannelSpec; -import org.springframework.integration.dsl.channel.RendezvousChannelSpec; import org.springframework.integration.store.ChannelMessageStore; import org.springframework.integration.store.PriorityCapableChannelMessageStore; import org.springframework.messaging.Message; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/DirectChannelSpec.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/DirectChannelSpec.java similarity index 91% rename from spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/DirectChannelSpec.java rename to spring-integration-core/src/main/java/org/springframework/integration/dsl/DirectChannelSpec.java index 31ba66d923..385d58a1fe 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/DirectChannelSpec.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/DirectChannelSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.dsl.channel; +package org.springframework.integration.dsl; import org.springframework.integration.channel.DirectChannel; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/ExecutorChannelSpec.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/ExecutorChannelSpec.java similarity index 92% rename from spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/ExecutorChannelSpec.java rename to spring-integration-core/src/main/java/org/springframework/integration/dsl/ExecutorChannelSpec.java index 8cf58d308b..7c6cc4e392 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/ExecutorChannelSpec.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/ExecutorChannelSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.dsl.channel; +package org.springframework.integration.dsl; import java.util.concurrent.Executor; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/FluxMessageChannelSpec.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/FluxMessageChannelSpec.java similarity index 89% rename from spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/FluxMessageChannelSpec.java rename to spring-integration-core/src/main/java/org/springframework/integration/dsl/FluxMessageChannelSpec.java index b03f3841aa..55773fa179 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/FluxMessageChannelSpec.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/FluxMessageChannelSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 the original author or authors. + * Copyright 2017-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.dsl.channel; +package org.springframework.integration.dsl; import org.springframework.integration.channel.FluxMessageChannel; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowAdapter.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowAdapter.java index f879bbe960..3cdda50bcc 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowAdapter.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017 the original author or authors. + * Copyright 2016-2018 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. @@ -21,7 +21,6 @@ import java.util.function.Consumer; import org.springframework.context.SmartLifecycle; import org.springframework.integration.core.MessageSource; -import org.springframework.integration.dsl.channel.MessageChannelSpec; import org.springframework.integration.endpoint.MessageProducerSupport; import org.springframework.integration.gateway.MessagingGatewaySupport; import org.springframework.messaging.MessageChannel; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/dsl/IntegrationFlowBeanPostProcessor.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowBeanPostProcessor.java similarity index 95% rename from spring-integration-core/src/main/java/org/springframework/integration/config/dsl/IntegrationFlowBeanPostProcessor.java rename to spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowBeanPostProcessor.java index a141737ef2..24759a605b 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/dsl/IntegrationFlowBeanPostProcessor.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowBeanPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017 the original author or authors. + * Copyright 2016-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.config.dsl; +package org.springframework.integration.dsl; import java.util.Collection; import java.util.LinkedHashMap; @@ -41,14 +41,6 @@ import org.springframework.integration.config.ConsumerEndpointFactoryBean; import org.springframework.integration.config.IntegrationConfigUtils; import org.springframework.integration.config.SourcePollingChannelAdapterFactoryBean; import org.springframework.integration.core.MessageSource; -import org.springframework.integration.dsl.ComponentsRegistration; -import org.springframework.integration.dsl.ConsumerEndpointSpec; -import org.springframework.integration.dsl.IntegrationComponentSpec; -import org.springframework.integration.dsl.IntegrationFlow; -import org.springframework.integration.dsl.IntegrationFlowBuilder; -import org.springframework.integration.dsl.IntegrationFlows; -import org.springframework.integration.dsl.SourcePollingChannelAdapterSpec; -import org.springframework.integration.dsl.StandardIntegrationFlow; import org.springframework.integration.dsl.support.MessageChannelReference; import org.springframework.integration.gateway.AnnotationGatewayProxyFactoryBean; import org.springframework.integration.support.context.NamedComponent; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowDefinition.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowDefinition.java index 29b8043412..fef1ae3186 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowDefinition.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowDefinition.java @@ -46,8 +46,6 @@ import org.springframework.integration.context.IntegrationContextUtils; import org.springframework.integration.core.GenericSelector; import org.springframework.integration.core.MessageProducer; import org.springframework.integration.core.MessageSelector; -import org.springframework.integration.dsl.channel.MessageChannelSpec; -import org.springframework.integration.dsl.channel.WireTapSpec; import org.springframework.integration.dsl.support.FixedSubscriberChannelPrototype; import org.springframework.integration.dsl.support.MessageChannelReference; import org.springframework.integration.expression.ControlBusMethodFilter; @@ -111,7 +109,7 @@ import reactor.util.function.Tuple2; * * @since 5.0 * - * @see org.springframework.integration.config.dsl.IntegrationFlowBeanPostProcessor + * @see org.springframework.integration.dsl.IntegrationFlowBeanPostProcessor */ public abstract class IntegrationFlowDefinition> { @@ -190,7 +188,7 @@ public abstract class IntegrationFlowDefinition messageChannelSpec) { Assert.notNull(messageChannelSpec, "'messageChannelSpec' must not be null"); @@ -201,7 +199,7 @@ public abstract class IntegrationFlowDefinition messageChannelSpec) { Assert.notNull(messageChannelSpec, "'messageChannelSpec' must not be null"); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/LoadBalancingChannelSpec.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/LoadBalancingChannelSpec.java similarity index 94% rename from spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/LoadBalancingChannelSpec.java rename to spring-integration-core/src/main/java/org/springframework/integration/dsl/LoadBalancingChannelSpec.java index a9106f1f4f..d72363dcbc 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/LoadBalancingChannelSpec.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/LoadBalancingChannelSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.dsl.channel; +package org.springframework.integration.dsl; import org.springframework.integration.channel.AbstractMessageChannel; import org.springframework.integration.dispatcher.LoadBalancingStrategy; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/MessageChannelSpec.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/MessageChannelSpec.java similarity index 94% rename from spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/MessageChannelSpec.java rename to spring-integration-core/src/main/java/org/springframework/integration/dsl/MessageChannelSpec.java index c904046ec7..47a542b4d8 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/MessageChannelSpec.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/MessageChannelSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017 the original author or authors. + * Copyright 2016-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.dsl.channel; +package org.springframework.integration.dsl; import java.util.ArrayList; import java.util.Arrays; @@ -25,8 +25,6 @@ import java.util.Map; import org.springframework.integration.channel.AbstractMessageChannel; import org.springframework.integration.channel.interceptor.WireTap; -import org.springframework.integration.dsl.ComponentsRegistration; -import org.springframework.integration.dsl.IntegrationComponentSpec; import org.springframework.messaging.MessageChannel; import org.springframework.messaging.converter.MessageConverter; import org.springframework.messaging.support.ChannelInterceptor; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/MessageChannels.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/MessageChannels.java similarity index 97% rename from spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/MessageChannels.java rename to spring-integration-core/src/main/java/org/springframework/integration/dsl/MessageChannels.java index 0c4900b3f0..bacd3fd32a 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/MessageChannels.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/MessageChannels.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017 the original author or authors. + * Copyright 2016-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.dsl.channel; +package org.springframework.integration.dsl; import java.util.Queue; import java.util.concurrent.Executor; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/PriorityChannelSpec.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/PriorityChannelSpec.java similarity index 95% rename from spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/PriorityChannelSpec.java rename to spring-integration-core/src/main/java/org/springframework/integration/dsl/PriorityChannelSpec.java index 8977069145..3b87c5142f 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/PriorityChannelSpec.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/PriorityChannelSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017 the original author or authors. + * Copyright 2016-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.dsl.channel; +package org.springframework.integration.dsl; import java.util.Comparator; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/PublishSubscribeChannelSpec.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/PublishSubscribeChannelSpec.java similarity index 94% rename from spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/PublishSubscribeChannelSpec.java rename to spring-integration-core/src/main/java/org/springframework/integration/dsl/PublishSubscribeChannelSpec.java index 54ed8acc52..c81d877cf1 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/PublishSubscribeChannelSpec.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/PublishSubscribeChannelSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.dsl.channel; +package org.springframework.integration.dsl; import java.util.concurrent.Executor; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/PublishSubscribeSpec.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/PublishSubscribeSpec.java index da516a6686..c3dafb984e 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/PublishSubscribeSpec.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/PublishSubscribeSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017 the original author or authors. + * Copyright 2016-2018 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. @@ -20,8 +20,6 @@ import java.util.LinkedHashMap; import java.util.Map; import java.util.concurrent.Executor; -import org.springframework.integration.dsl.channel.PublishSubscribeChannelSpec; - /** * @author Artem Bilan * diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/QueueChannelSpec.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/QueueChannelSpec.java similarity index 96% rename from spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/QueueChannelSpec.java rename to spring-integration-core/src/main/java/org/springframework/integration/dsl/QueueChannelSpec.java index e5308703fc..db62553372 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/QueueChannelSpec.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/QueueChannelSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017 the original author or authors. + * Copyright 2016-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.dsl.channel; +package org.springframework.integration.dsl; import java.util.Queue; import java.util.concurrent.locks.Lock; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/RendezvousChannelSpec.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/RendezvousChannelSpec.java similarity index 89% rename from spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/RendezvousChannelSpec.java rename to spring-integration-core/src/main/java/org/springframework/integration/dsl/RendezvousChannelSpec.java index da15764465..193b6f8de1 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/RendezvousChannelSpec.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/RendezvousChannelSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.dsl.channel; +package org.springframework.integration.dsl; import org.springframework.integration.channel.RendezvousChannel; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/StandardIntegrationFlow.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/StandardIntegrationFlow.java index 945168a99a..6927d0c44e 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/StandardIntegrationFlow.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/StandardIntegrationFlow.java @@ -60,7 +60,7 @@ import org.springframework.context.SmartLifecycle; * @since 5.0 * * @see IntegrationFlows - * @see org.springframework.integration.config.dsl.IntegrationFlowBeanPostProcessor + * @see org.springframework.integration.dsl.IntegrationFlowBeanPostProcessor * @see org.springframework.integration.dsl.context.IntegrationFlowContext */ public class StandardIntegrationFlow implements IntegrationFlow, SmartLifecycle { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/WireTapSpec.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/WireTapSpec.java similarity index 92% rename from spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/WireTapSpec.java rename to spring-integration-core/src/main/java/org/springframework/integration/dsl/WireTapSpec.java index 53ef6bf291..7e4153f744 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/WireTapSpec.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/WireTapSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017 the original author or authors. + * Copyright 2016-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.dsl.channel; +package org.springframework.integration.dsl; import java.util.Collections; import java.util.Map; @@ -22,8 +22,6 @@ import java.util.Map; import org.springframework.expression.Expression; import org.springframework.integration.channel.interceptor.WireTap; import org.springframework.integration.core.MessageSelector; -import org.springframework.integration.dsl.ComponentsRegistration; -import org.springframework.integration.dsl.IntegrationComponentSpec; import org.springframework.integration.filter.ExpressionEvaluatingSelector; import org.springframework.messaging.MessageChannel; import org.springframework.util.Assert; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/package-info.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/package-info.java deleted file mode 100644 index 4ed59bd904..0000000000 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/channel/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Contains MessageChannel Builders DSL. - */ -package org.springframework.integration.dsl.channel; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/dsl/DslIntegrationConfigurationInitializer.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/DslIntegrationConfigurationInitializer.java similarity index 90% rename from spring-integration-core/src/main/java/org/springframework/integration/config/dsl/DslIntegrationConfigurationInitializer.java rename to spring-integration-core/src/main/java/org/springframework/integration/dsl/context/DslIntegrationConfigurationInitializer.java index 2f572a2c6d..160e58702c 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/dsl/DslIntegrationConfigurationInitializer.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/DslIntegrationConfigurationInitializer.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.config.dsl; +package org.springframework.integration.dsl.context; import java.beans.Introspector; @@ -24,7 +24,7 @@ import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.integration.config.IntegrationConfigurationInitializer; import org.springframework.integration.dsl.IntegrationComponentSpec; -import org.springframework.integration.dsl.context.IntegrationFlowContext; +import org.springframework.integration.dsl.IntegrationFlowBeanPostProcessor; import org.springframework.util.Assert; /** @@ -34,6 +34,7 @@ import org.springframework.util.Assert; * {@link IntegrationComponentSpec#get()}. * * @author Artem Bilan + * @author Gary Russell * @since 5.0 * * @see org.springframework.integration.config.IntegrationConfigurationBeanFactoryPostProcessor @@ -58,7 +59,7 @@ public class DslIntegrationConfigurationInitializer implements IntegrationConfig registry.registerBeanDefinition(INTEGRATION_FLOW_BPP_BEAN_NAME, new RootBeanDefinition(IntegrationFlowBeanPostProcessor.class)); registry.registerBeanDefinition(INTEGRATION_FLOW_CONTEXT_BEAN_NAME, - new RootBeanDefinition(IntegrationFlowContext.class)); + new RootBeanDefinition(StandardIntegrationFlowContext.class)); } } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/IntegrationFlowContext.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/IntegrationFlowContext.java index 4cba85a25f..04ab20d9af 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/IntegrationFlowContext.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/IntegrationFlowContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2018 the original author or authors. + * Copyright 2018 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. @@ -16,24 +16,12 @@ package org.springframework.integration.dsl.context; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; import java.util.Map; -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactoryAware; -import org.springframework.beans.factory.BeanFactoryUtils; -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; -import org.springframework.beans.factory.support.BeanDefinitionBuilder; -import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.integration.core.MessagingTemplate; import org.springframework.integration.dsl.IntegrationFlow; -import org.springframework.integration.support.context.NamedComponent; import org.springframework.messaging.MessageChannel; -import org.springframework.util.Assert; /** * A public API for dynamic (manual) registration of {@link IntegrationFlow}s, @@ -58,28 +46,13 @@ import org.springframework.util.Assert; * It can be used for access to the target {@link IntegrationFlow} or for manipulation with its lifecycle. * * @author Artem Bilan + * @author Gary Russell * * @since 5.0 * * @see IntegrationFlowRegistration */ -public final class IntegrationFlowContext implements BeanFactoryAware { - - private final Map registry = new HashMap<>(); - - private ConfigurableListableBeanFactory beanFactory; - - private IntegrationFlowContext() { - } - - @Override - public void setBeanFactory(BeanFactory beanFactory) throws BeansException { - Assert.isInstanceOf(ConfigurableListableBeanFactory.class, beanFactory, - "To use Spring Integration Java DSL the 'beanFactory' has to be an instance of " + - "'ConfigurableListableBeanFactory'. " + - "Consider using 'GenericApplicationContext' implementation."); - this.beanFactory = (ConfigurableListableBeanFactory) beanFactory; - } +public interface IntegrationFlowContext { /** * Associate provided {@link IntegrationFlow} with an {@link IntegrationFlowRegistrationBuilder} @@ -87,52 +60,7 @@ public final class IntegrationFlowContext implements BeanFactoryAware { * @param integrationFlow the {@link IntegrationFlow} to register * @return the IntegrationFlowRegistrationBuilder associated with the provided {@link IntegrationFlow} */ - public IntegrationFlowRegistrationBuilder registration(IntegrationFlow integrationFlow) { - return new IntegrationFlowRegistrationBuilder(integrationFlow); - } - - private void register(IntegrationFlowRegistrationBuilder builder) { - IntegrationFlow integrationFlow = builder.integrationFlowRegistration.getIntegrationFlow(); - String flowId = builder.integrationFlowRegistration.getId(); - if (flowId == null) { - flowId = generateBeanName(integrationFlow, null); - builder.id(flowId); - } - else if (this.registry.containsKey(flowId)) { - throw new IllegalArgumentException("An IntegrationFlow '" + this.registry.get(flowId) + - "' with flowId '" + flowId + "' is already registered.\n" + - "An existing IntegrationFlowRegistration must be destroyed before overriding."); - } - IntegrationFlow theFlow = (IntegrationFlow) registerBean(integrationFlow, flowId, null); - builder.integrationFlowRegistration.setIntegrationFlow(theFlow); - - final String theFlowId = flowId; - builder.additionalBeans.forEach((key, value) -> registerBean(key, value, theFlowId)); - - if (builder.autoStartup) { - builder.integrationFlowRegistration.start(); - } - this.registry.put(flowId, builder.integrationFlowRegistration); - } - - @SuppressWarnings("unchecked") - private Object registerBean(Object bean, String beanName, String parentName) { - if (beanName == null) { - beanName = generateBeanName(bean, parentName); - } - - BeanDefinition beanDefinition = - BeanDefinitionBuilder.genericBeanDefinition((Class) bean.getClass(), () -> bean) - .getRawBeanDefinition(); - - ((BeanDefinitionRegistry) this.beanFactory).registerBeanDefinition(beanName, beanDefinition); - - if (parentName != null) { - this.beanFactory.registerDependentBean(parentName, beanName); - } - - return this.beanFactory.getBean(beanName); - } + IntegrationFlowRegistrationBuilder registration(IntegrationFlow integrationFlow); /** * Obtain an {@link IntegrationFlowRegistration} for the {@link IntegrationFlow} @@ -140,30 +68,14 @@ public final class IntegrationFlowContext implements BeanFactoryAware { * @param flowId the bean name to obtain * @return the IntegrationFlowRegistration for provided {@code id} or {@code null} */ - public IntegrationFlowRegistration getRegistrationById(String flowId) { - return this.registry.get(flowId); - } + IntegrationFlowRegistration getRegistrationById(String flowId); /** * Destroy an {@link IntegrationFlow} bean (as well as all its dependant beans) * for provided {@code flowId} and clean up all the local cache for it. * @param flowId the bean name to destroy from */ - public synchronized void remove(String flowId) { - if (this.registry.containsKey(flowId)) { - IntegrationFlowRegistration flowRegistration = this.registry.remove(flowId); - flowRegistration.stop(); - - Arrays.stream(this.beanFactory.getDependentBeans(flowId)) - .forEach(((BeanDefinitionRegistry) this.beanFactory)::removeBeanDefinition); - - ((BeanDefinitionRegistry) this.beanFactory).removeBeanDefinition(flowId); - } - else { - throw new IllegalStateException("Only manually registered IntegrationFlows can be removed. " - + "But [" + flowId + "] ins't one of them."); - } - } + void remove(String flowId); /** * Obtain a {@link MessagingTemplate} with its default destination set to the input channel @@ -174,51 +86,91 @@ public final class IntegrationFlowContext implements BeanFactoryAware { * @param flowId the bean name to obtain the input channel from * @return the {@link MessagingTemplate} instance */ - public MessagingTemplate messagingTemplateFor(String flowId) { - return this.registry.get(flowId) - .getMessagingTemplate(); - } + MessagingTemplate messagingTemplateFor(String flowId); /** * Provide the state of the mapping of integration flow names to their * {@link IntegrationFlowRegistration} instances. * @return the registry of flow ids and their registration. */ - public Map getRegistry() { - return Collections.unmodifiableMap(this.registry); - } + Map getRegistry(); + + /** + * @author Gary Russell + * @since 5.1 + * + */ + interface IntegrationFlowRegistration extends BeanFactoryAware { + + /** + * Return the flow id. + * @return the id. + */ + String getId(); + + /** + * Set the flow id. + * @param id the id. + */ + void setId(String id); + + /** + * Return the flow. + * @return the flow. + */ + IntegrationFlow getIntegrationFlow(); + + /** + * Set the integration flow. + * @param integrationFlow the flow. + */ + void setIntegrationFlow(IntegrationFlow integrationFlow); + + /** + * Return the flow input channel. + * @return the channel. + */ + MessageChannel getInputChannel(); + + /** + * Set the flow context. + * @param integrationFlowContext the context. + */ + void setIntegrationFlowContext(IntegrationFlowContext integrationFlowContext); + + /** + * Obtain a {@link MessagingTemplate} with its default destination set to the input channel + * of the {@link IntegrationFlow}. + *

Any {@link IntegrationFlow} bean (not only manually registered) can be used for this method. + *

If {@link IntegrationFlow} doesn't start with the {@link MessageChannel}, the + * {@link IllegalStateException} is thrown. + * @return the {@link MessagingTemplate} instance + */ + MessagingTemplate getMessagingTemplate(); + + /** + * Start the registration. + */ + void start(); + + /** + * Stop the registration. + */ + void stop(); + + /** + * Destroy the {@link IntegrationFlow} bean (as well as all its dependent beans) + * and clean up all the local cache for it. + */ + void destroy(); - private String generateBeanName(Object instance, String parentName) { - if (instance instanceof NamedComponent && ((NamedComponent) instance).getComponentName() != null) { - return ((NamedComponent) instance).getComponentName(); - } - String generatedBeanName = (parentName != null ? parentName : "") + instance.getClass().getName(); - String id = generatedBeanName; - int counter = -1; - while (counter == -1 || this.beanFactory.containsBean(id)) { - counter++; - id = generatedBeanName + BeanFactoryUtils.GENERATED_BEAN_NAME_SEPARATOR + counter; - } - return id; } /** * A Builder pattern implementation for the options to register {@link IntegrationFlow} * in the application context. */ - public final class IntegrationFlowRegistrationBuilder { - - private Map additionalBeans = new HashMap<>(); - - private final IntegrationFlowRegistration integrationFlowRegistration; - - private boolean autoStartup = true; - - IntegrationFlowRegistrationBuilder(IntegrationFlow integrationFlow) { - this.integrationFlowRegistration = new IntegrationFlowRegistration(integrationFlow); - this.integrationFlowRegistration.setBeanFactory(IntegrationFlowContext.this.beanFactory); - this.integrationFlowRegistration.setIntegrationFlowContext(IntegrationFlowContext.this); - } + interface IntegrationFlowRegistrationBuilder { /** * Specify an {@code id} for the {@link IntegrationFlow} to register. @@ -228,10 +180,7 @@ public final class IntegrationFlowContext implements BeanFactoryAware { * @param id the id for the {@link IntegrationFlow} to register * @return the current builder instance */ - public IntegrationFlowRegistrationBuilder id(String id) { - this.integrationFlowRegistration.setId(id); - return this; - } + IntegrationFlowRegistrationBuilder id(String id); /** * The {@code boolean} flag to indication if an {@link IntegrationFlow} must be started @@ -239,10 +188,7 @@ public final class IntegrationFlowContext implements BeanFactoryAware { * @param autoStartup start or not the {@link IntegrationFlow} automatically after registration. * @return the current builder instance */ - public IntegrationFlowRegistrationBuilder autoStartup(boolean autoStartup) { - this.autoStartup = autoStartup; - return this; - } + IntegrationFlowRegistrationBuilder autoStartup(boolean autoStartup); /** * Add an object which will be registered as an {@link IntegrationFlow} dependant bean in the @@ -251,9 +197,7 @@ public final class IntegrationFlowContext implements BeanFactoryAware { * @param bean an additional arbitrary bean to register into the application context. * @return the current builder instance */ - public IntegrationFlowRegistrationBuilder addBean(Object bean) { - return addBean(null, bean); - } + IntegrationFlowRegistrationBuilder addBean(Object bean); /** * Add an object which will be registered as an {@link IntegrationFlow} dependant bean in the @@ -263,10 +207,7 @@ public final class IntegrationFlowContext implements BeanFactoryAware { * @param bean an additional arbitrary bean to register into the application context. * @return the current builder instance */ - public IntegrationFlowRegistrationBuilder addBean(String name, Object bean) { - this.additionalBeans.put(bean, name); - return this; - } + IntegrationFlowRegistrationBuilder addBean(String name, Object bean); /** * Register an {@link IntegrationFlow} and all the dependant and support components @@ -274,10 +215,7 @@ public final class IntegrationFlowContext implements BeanFactoryAware { * control object. * @return the {@link IntegrationFlowRegistration} instance. */ - public IntegrationFlowRegistration register() { - IntegrationFlowContext.this.register(this); - return this.integrationFlowRegistration; - } + IntegrationFlowRegistration register(); } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/StandardIntegrationFlowContext.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/StandardIntegrationFlowContext.java new file mode 100644 index 0000000000..5f9162a68a --- /dev/null +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/StandardIntegrationFlowContext.java @@ -0,0 +1,275 @@ +/* + * Copyright 2016-2018 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.integration.dsl.context; + +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.beans.factory.BeanFactoryAware; +import org.springframework.beans.factory.BeanFactoryUtils; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; +import org.springframework.beans.factory.support.BeanDefinitionBuilder; +import org.springframework.beans.factory.support.BeanDefinitionRegistry; +import org.springframework.integration.core.MessagingTemplate; +import org.springframework.integration.dsl.IntegrationFlow; +import org.springframework.integration.support.context.NamedComponent; +import org.springframework.messaging.MessageChannel; +import org.springframework.util.Assert; + +/** + * Standard implementation of {@link IntegrationFlowContext}. + * + * @author Artem Bilan + * @author Gary Russell + * + * @since 5.1 + * + */ +public final class StandardIntegrationFlowContext implements IntegrationFlowContext, BeanFactoryAware { + + private final Map registry = new HashMap<>(); + + private ConfigurableListableBeanFactory beanFactory; + + private StandardIntegrationFlowContext() { + } + + @Override + public void setBeanFactory(BeanFactory beanFactory) throws BeansException { + Assert.isInstanceOf(ConfigurableListableBeanFactory.class, beanFactory, + "To use Spring Integration Java DSL the 'beanFactory' has to be an instance of " + + "'ConfigurableListableBeanFactory'. " + + "Consider using 'GenericApplicationContext' implementation."); + this.beanFactory = (ConfigurableListableBeanFactory) beanFactory; + } + + /** + * Associate provided {@link IntegrationFlow} with an {@link StandardIntegrationFlowRegistrationBuilder} + * for additional options and farther registration in the application context. + * @param integrationFlow the {@link IntegrationFlow} to register + * @return the IntegrationFlowRegistrationBuilder associated with the provided {@link IntegrationFlow} + */ + @Override + public StandardIntegrationFlowRegistrationBuilder registration(IntegrationFlow integrationFlow) { + return new StandardIntegrationFlowRegistrationBuilder(integrationFlow); + } + + private void register(StandardIntegrationFlowRegistrationBuilder builder) { + IntegrationFlow integrationFlow = builder.integrationFlowRegistration.getIntegrationFlow(); + String flowId = builder.integrationFlowRegistration.getId(); + if (flowId == null) { + flowId = generateBeanName(integrationFlow, null); + builder.id(flowId); + } + else if (this.registry.containsKey(flowId)) { + throw new IllegalArgumentException("An IntegrationFlow '" + this.registry.get(flowId) + + "' with flowId '" + flowId + "' is already registered.\n" + + "An existing IntegrationFlowRegistration must be destroyed before overriding."); + } + IntegrationFlow theFlow = (IntegrationFlow) registerBean(integrationFlow, flowId, null); + builder.integrationFlowRegistration.setIntegrationFlow(theFlow); + + final String theFlowId = flowId; + builder.additionalBeans.forEach((key, value) -> registerBean(key, value, theFlowId)); + + if (builder.autoStartup) { + builder.integrationFlowRegistration.start(); + } + this.registry.put(flowId, builder.integrationFlowRegistration); + } + + @SuppressWarnings("unchecked") + private Object registerBean(Object bean, String beanName, String parentName) { + if (beanName == null) { + beanName = generateBeanName(bean, parentName); + } + + BeanDefinition beanDefinition = + BeanDefinitionBuilder.genericBeanDefinition((Class) bean.getClass(), () -> bean) + .getRawBeanDefinition(); + + ((BeanDefinitionRegistry) this.beanFactory).registerBeanDefinition(beanName, beanDefinition); + + if (parentName != null) { + this.beanFactory.registerDependentBean(parentName, beanName); + } + + return this.beanFactory.getBean(beanName); + } + + /** + * Obtain an {@link IntegrationFlowRegistration} for the {@link IntegrationFlow} + * associated with the provided {@code flowId}. + * @param flowId the bean name to obtain + * @return the IntegrationFlowRegistration for provided {@code id} or {@code null} + */ + @Override + public IntegrationFlowRegistration getRegistrationById(String flowId) { + return this.registry.get(flowId); + } + + /** + * Destroy an {@link IntegrationFlow} bean (as well as all its dependant beans) + * for provided {@code flowId} and clean up all the local cache for it. + * @param flowId the bean name to destroy from + */ + @Override + public synchronized void remove(String flowId) { + if (this.registry.containsKey(flowId)) { + IntegrationFlowRegistration flowRegistration = this.registry.remove(flowId); + flowRegistration.stop(); + + Arrays.stream(this.beanFactory.getDependentBeans(flowId)) + .forEach(((BeanDefinitionRegistry) this.beanFactory)::removeBeanDefinition); + + ((BeanDefinitionRegistry) this.beanFactory).removeBeanDefinition(flowId); + } + else { + throw new IllegalStateException("Only manually registered IntegrationFlows can be removed. " + + "But [" + flowId + "] ins't one of them."); + } + } + + /** + * Obtain a {@link MessagingTemplate} with its default destination set to the input channel + * of the {@link IntegrationFlow} for provided {@code flowId}. + *

Any {@link IntegrationFlow} bean (not only manually registered) can be used for this method. + *

If {@link IntegrationFlow} doesn't start with the {@link MessageChannel}, the + * {@link IllegalStateException} is thrown. + * @param flowId the bean name to obtain the input channel from + * @return the {@link MessagingTemplate} instance + */ + @Override + public MessagingTemplate messagingTemplateFor(String flowId) { + return this.registry.get(flowId) + .getMessagingTemplate(); + } + + /** + * Provide the state of the mapping of integration flow names to their + * {@link IntegrationFlowRegistration} instances. + * @return the registry of flow ids and their registration. + */ + @Override + public Map getRegistry() { + return Collections.unmodifiableMap(this.registry); + } + + private String generateBeanName(Object instance, String parentName) { + if (instance instanceof NamedComponent && ((NamedComponent) instance).getComponentName() != null) { + return ((NamedComponent) instance).getComponentName(); + } + String generatedBeanName = (parentName != null ? parentName : "") + instance.getClass().getName(); + String id = generatedBeanName; + int counter = -1; + while (counter == -1 || this.beanFactory.containsBean(id)) { + counter++; + id = generatedBeanName + BeanFactoryUtils.GENERATED_BEAN_NAME_SEPARATOR + counter; + } + return id; + } + + /** + * A Builder pattern implementation for the options to register {@link IntegrationFlow} + * in the application context. + */ + public final class StandardIntegrationFlowRegistrationBuilder implements IntegrationFlowRegistrationBuilder { + + private final Map additionalBeans = new HashMap<>(); + + private final IntegrationFlowRegistration integrationFlowRegistration; + + private boolean autoStartup = true; + + StandardIntegrationFlowRegistrationBuilder(IntegrationFlow integrationFlow) { + this.integrationFlowRegistration = new StandardIntegrationFlowRegistration(integrationFlow); + this.integrationFlowRegistration.setBeanFactory(StandardIntegrationFlowContext.this.beanFactory); + this.integrationFlowRegistration.setIntegrationFlowContext(StandardIntegrationFlowContext.this); + } + + /** + * Specify an {@code id} for the {@link IntegrationFlow} to register. + * Must be unique per context. + * The registration with this {@code id} must be destroyed before reusing for + * a new {@link IntegrationFlow} instance. + * @param id the id for the {@link IntegrationFlow} to register + * @return the current builder instance + */ + @Override + public StandardIntegrationFlowRegistrationBuilder id(String id) { + this.integrationFlowRegistration.setId(id); + return this; + } + + /** + * The {@code boolean} flag to indication if an {@link IntegrationFlow} must be started + * automatically after registration. Defaults to {@code true}. + * @param autoStartup start or not the {@link IntegrationFlow} automatically after registration. + * @return the current builder instance + */ + @Override + public StandardIntegrationFlowRegistrationBuilder autoStartup(boolean autoStartup) { + this.autoStartup = autoStartup; + return this; + } + + /** + * Add an object which will be registered as an {@link IntegrationFlow} dependant bean in the + * application context. Usually it is some support component, which needs an application context. + * For example dynamically created connection factories or header mappers for AMQP, JMS, TCP etc. + * @param bean an additional arbitrary bean to register into the application context. + * @return the current builder instance + */ + @Override + public StandardIntegrationFlowRegistrationBuilder addBean(Object bean) { + return addBean(null, bean); + } + + /** + * Add an object which will be registered as an {@link IntegrationFlow} dependant bean in the + * application context. Usually it is some support component, which needs an application context. + * For example dynamically created connection factories or header mappers for AMQP, JMS, TCP etc. + * @param name the name for the bean to register. + * @param bean an additional arbitrary bean to register into the application context. + * @return the current builder instance + */ + @Override + public StandardIntegrationFlowRegistrationBuilder addBean(String name, Object bean) { + this.additionalBeans.put(bean, name); + return this; + } + + /** + * Register an {@link IntegrationFlow} and all the dependant and support components + * in the application context and return an associated {@link IntegrationFlowRegistration} + * control object. + * @return the {@link IntegrationFlowRegistration} instance. + */ + @Override + public IntegrationFlowRegistration register() { + StandardIntegrationFlowContext.this.register(this); + return this.integrationFlowRegistration; + } + + } + +} diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/IntegrationFlowRegistration.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/StandardIntegrationFlowRegistration.java similarity index 84% rename from spring-integration-core/src/main/java/org/springframework/integration/dsl/context/IntegrationFlowRegistration.java rename to spring-integration-core/src/main/java/org/springframework/integration/dsl/context/StandardIntegrationFlowRegistration.java index 8156052144..bda2a214d4 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/IntegrationFlowRegistration.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/StandardIntegrationFlowRegistration.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2018 the original author or authors. + * Copyright 2018 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. @@ -16,26 +16,29 @@ package org.springframework.integration.dsl.context; +import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.context.Lifecycle; import org.springframework.integration.core.MessagingTemplate; import org.springframework.integration.dsl.IntegrationFlow; import org.springframework.integration.dsl.StandardIntegrationFlow; +import org.springframework.integration.dsl.context.IntegrationFlowContext.IntegrationFlowRegistration; import org.springframework.messaging.Message; import org.springframework.messaging.MessageChannel; /** * Instances of this classes are returned as a result of - * {@link IntegrationFlowContext#registration(IntegrationFlow)} invocation + * {@link StandardIntegrationFlowContext#registration(IntegrationFlow)} invocation * and provide an API for some useful {@link IntegrationFlow} options and its lifecycle. * * @author Artem Bilan + * @author Gary Russell * - * @since 5.0 + * @since 5.1 * * @see IntegrationFlowContext */ -public class IntegrationFlowRegistration { +class StandardIntegrationFlowRegistration implements IntegrationFlowRegistration { private IntegrationFlow integrationFlow; @@ -49,34 +52,41 @@ public class IntegrationFlowRegistration { private ConfigurableListableBeanFactory beanFactory; - IntegrationFlowRegistration(IntegrationFlow integrationFlow) { + StandardIntegrationFlowRegistration(IntegrationFlow integrationFlow) { this.integrationFlow = integrationFlow; } - void setBeanFactory(ConfigurableListableBeanFactory beanFactory) { - this.beanFactory = beanFactory; // NOSONAR (synchronization) + @Override + public void setBeanFactory(BeanFactory beanFactory) { + this.beanFactory = (ConfigurableListableBeanFactory) beanFactory; } - void setIntegrationFlowContext(IntegrationFlowContext integrationFlowContext) { + @Override + public void setIntegrationFlowContext(IntegrationFlowContext integrationFlowContext) { this.integrationFlowContext = integrationFlowContext; } - void setId(String id) { + @Override + public void setId(String id) { this.id = id; } - void setIntegrationFlow(IntegrationFlow integrationFlow) { + @Override + public void setIntegrationFlow(IntegrationFlow integrationFlow) { this.integrationFlow = integrationFlow; } + @Override public String getId() { return this.id; } + @Override public IntegrationFlow getIntegrationFlow() { return this.integrationFlow; } + @Override public MessageChannel getInputChannel() { if (this.inputChannel == null) { if (this.integrationFlow instanceof StandardIntegrationFlow) { @@ -110,6 +120,7 @@ public class IntegrationFlowRegistration { * {@link IllegalStateException} is thrown. * @return the {@link MessagingTemplate} instance */ + @Override public MessagingTemplate getMessagingTemplate() { if (this.messagingTemplate == null) { this.messagingTemplate = new MessagingTemplate(getInputChannel()) { @@ -131,6 +142,7 @@ public class IntegrationFlowRegistration { return this.messagingTemplate; } + @Override public void start() { if (this.integrationFlow instanceof Lifecycle) { ((Lifecycle) this.integrationFlow).start(); @@ -143,6 +155,7 @@ public class IntegrationFlowRegistration { } } + @Override public void stop() { if (this.integrationFlow instanceof Lifecycle) { ((Lifecycle) this.integrationFlow).stop(); @@ -153,6 +166,7 @@ public class IntegrationFlowRegistration { * Destroy the {@link IntegrationFlow} bean (as well as all its dependant beans) * and clean up all the local cache for it. */ + @Override public void destroy() { this.integrationFlowContext.remove(this.id); } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/support/FixedSubscriberChannelPrototype.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/support/FixedSubscriberChannelPrototype.java index 7551ae9ecf..617cba4f79 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/support/FixedSubscriberChannelPrototype.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/support/FixedSubscriberChannelPrototype.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2018 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. @@ -28,7 +28,7 @@ import org.springframework.messaging.MessageChannel; * @author Artem Bilan * @since 5.0 * - * @see org.springframework.integration.config.dsl.IntegrationFlowBeanPostProcessor + * @see org.springframework.integration.dsl.IntegrationFlowBeanPostProcessor */ public class FixedSubscriberChannelPrototype implements MessageChannel { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/support/MessageChannelReference.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/support/MessageChannelReference.java index d357a2824e..5c45a9fac1 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/support/MessageChannelReference.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/support/MessageChannelReference.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017 the original author or authors. + * Copyright 2016-2018 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. @@ -29,7 +29,7 @@ import org.springframework.util.Assert; * * @since 5.0 * - * @see org.springframework.integration.config.dsl.IntegrationFlowBeanPostProcessor + * @see org.springframework.integration.dsl.IntegrationFlowBeanPostProcessor */ public class MessageChannelReference implements MessageChannel { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/event/IntegrationEvent.java b/spring-integration-core/src/main/java/org/springframework/integration/events/IntegrationEvent.java similarity index 93% rename from spring-integration-core/src/main/java/org/springframework/integration/event/IntegrationEvent.java rename to spring-integration-core/src/main/java/org/springframework/integration/events/IntegrationEvent.java index cbf40c12fd..b47bfd2733 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/event/IntegrationEvent.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/events/IntegrationEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2016 the original author or authors. + * Copyright 2013-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.event; +package org.springframework.integration.events; import org.springframework.context.ApplicationEvent; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/event/package-info.java b/spring-integration-core/src/main/java/org/springframework/integration/events/package-info.java similarity index 61% rename from spring-integration-core/src/main/java/org/springframework/integration/event/package-info.java rename to spring-integration-core/src/main/java/org/springframework/integration/events/package-info.java index 060dec76be..dfc2f28e46 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/event/package-info.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/events/package-info.java @@ -1,4 +1,4 @@ /** * ApplicationEvents generated by the Spring Integration framework. */ -package org.springframework.integration.event; +package org.springframework.integration.events; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/CompositeMessageHandlerNode.java b/spring-integration-core/src/main/java/org/springframework/integration/graph/CompositeMessageHandlerNode.java similarity index 88% rename from spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/CompositeMessageHandlerNode.java rename to spring-integration-core/src/main/java/org/springframework/integration/graph/CompositeMessageHandlerNode.java index 1ff334aacf..85ecfc67bc 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/CompositeMessageHandlerNode.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/graph/CompositeMessageHandlerNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.support.management.graph; +package org.springframework.integration.graph; import java.util.ArrayList; import java.util.List; @@ -25,15 +25,17 @@ import org.springframework.messaging.MessageHandler; * Represents a composite message handler. * * @author Gary Russell + * * @since 4.3 * */ public class CompositeMessageHandlerNode extends MessageHandlerNode { - private final List handlers = new ArrayList(); + private final List handlers = new ArrayList<>(); public CompositeMessageHandlerNode(int nodeId, String name, MessageHandler handler, String input, String output, List handlers) { + super(nodeId, name, handler, input, output); this.handlers.addAll(handlers); } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/DiscardingMessageHandlerNode.java b/spring-integration-core/src/main/java/org/springframework/integration/graph/DiscardingMessageHandlerNode.java similarity index 90% rename from spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/DiscardingMessageHandlerNode.java rename to spring-integration-core/src/main/java/org/springframework/integration/graph/DiscardingMessageHandlerNode.java index da57ee3092..2118c37778 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/DiscardingMessageHandlerNode.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/graph/DiscardingMessageHandlerNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.support.management.graph; +package org.springframework.integration.graph; import org.springframework.messaging.MessageHandler; @@ -22,6 +22,7 @@ import org.springframework.messaging.MessageHandler; * Represents an endpoint that has a discard channel. * * @author Gary Russell + * * @since 4.3 * */ @@ -31,6 +32,7 @@ public class DiscardingMessageHandlerNode extends MessageHandlerNode { public DiscardingMessageHandlerNode(int nodeId, String name, MessageHandler handler, String input, String output, String discards) { + super(nodeId, name, handler, input, output); this.discards = discards; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/EndpointNode.java b/spring-integration-core/src/main/java/org/springframework/integration/graph/EndpointNode.java similarity index 89% rename from spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/EndpointNode.java rename to spring-integration-core/src/main/java/org/springframework/integration/graph/EndpointNode.java index fc9dab4234..a56f587207 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/EndpointNode.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/graph/EndpointNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2018 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. @@ -14,12 +14,13 @@ * limitations under the License. */ -package org.springframework.integration.support.management.graph; +package org.springframework.integration.graph; /** * Base class for all endpoints. * * @author Gary Russell + * * @since 4.3 * */ diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/ErrorCapableCompositeMessageHandlerNode.java b/spring-integration-core/src/main/java/org/springframework/integration/graph/ErrorCapableCompositeMessageHandlerNode.java similarity index 91% rename from spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/ErrorCapableCompositeMessageHandlerNode.java rename to spring-integration-core/src/main/java/org/springframework/integration/graph/ErrorCapableCompositeMessageHandlerNode.java index db9fd307f2..39c44ec569 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/ErrorCapableCompositeMessageHandlerNode.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/graph/ErrorCapableCompositeMessageHandlerNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.support.management.graph; +package org.springframework.integration.graph; import java.util.List; @@ -25,6 +25,7 @@ import org.springframework.integration.handler.CompositeMessageHandler; * (pollable endpoint). * * @author Gary Russell + * * @since 4.3 * */ @@ -34,6 +35,7 @@ public class ErrorCapableCompositeMessageHandlerNode extends CompositeMessageHan public ErrorCapableCompositeMessageHandlerNode(int nodeId, String name, CompositeMessageHandler handler, String input, String output, String errors, List handlers) { + super(nodeId, name, handler, input, output, handlers); this.errors = errors; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/ErrorCapableDiscardingMessageHandlerNode.java b/spring-integration-core/src/main/java/org/springframework/integration/graph/ErrorCapableDiscardingMessageHandlerNode.java similarity index 91% rename from spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/ErrorCapableDiscardingMessageHandlerNode.java rename to spring-integration-core/src/main/java/org/springframework/integration/graph/ErrorCapableDiscardingMessageHandlerNode.java index 705c924311..65f499779d 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/ErrorCapableDiscardingMessageHandlerNode.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/graph/ErrorCapableDiscardingMessageHandlerNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.support.management.graph; +package org.springframework.integration.graph; import org.springframework.messaging.MessageHandler; @@ -23,6 +23,7 @@ import org.springframework.messaging.MessageHandler; * (pollable endpoint). * * @author Gary Russell + * * @since 4.3 * */ @@ -32,6 +33,7 @@ public class ErrorCapableDiscardingMessageHandlerNode extends DiscardingMessageH public ErrorCapableDiscardingMessageHandlerNode(int nodeId, String name, MessageHandler handler, String input, String output, String discards, String errors) { + super(nodeId, name, handler, input, output, discards); this.errors = errors; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/ErrorCapableEndpointNode.java b/spring-integration-core/src/main/java/org/springframework/integration/graph/ErrorCapableEndpointNode.java similarity index 90% rename from spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/ErrorCapableEndpointNode.java rename to spring-integration-core/src/main/java/org/springframework/integration/graph/ErrorCapableEndpointNode.java index 8bd4a9b965..3bafd51dac 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/ErrorCapableEndpointNode.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/graph/ErrorCapableEndpointNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2018 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. @@ -14,12 +14,13 @@ * limitations under the License. */ -package org.springframework.integration.support.management.graph; +package org.springframework.integration.graph; /** * Represents nodes that can natively handle errors. * * @author Gary Russell + * * @since 4.3 * */ @@ -29,6 +30,7 @@ public class ErrorCapableEndpointNode extends EndpointNode implements ErrorCapab protected ErrorCapableEndpointNode(int nodeId, String name, Object nodeObject, String output, String errors, Stats stats) { + super(nodeId, name, nodeObject, output, stats); this.errors = errors; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/ErrorCapableMessageHandlerNode.java b/spring-integration-core/src/main/java/org/springframework/integration/graph/ErrorCapableMessageHandlerNode.java similarity index 90% rename from spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/ErrorCapableMessageHandlerNode.java rename to spring-integration-core/src/main/java/org/springframework/integration/graph/ErrorCapableMessageHandlerNode.java index f179c2687f..1e5002902b 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/ErrorCapableMessageHandlerNode.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/graph/ErrorCapableMessageHandlerNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.support.management.graph; +package org.springframework.integration.graph; import org.springframework.messaging.MessageHandler; @@ -31,6 +31,7 @@ public class ErrorCapableMessageHandlerNode extends MessageHandlerNode implement public ErrorCapableMessageHandlerNode(int nodeId, String name, MessageHandler handler, String input, String output, String errors) { + super(nodeId, name, handler, input, output); this.errors = errors; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/ErrorCapableNode.java b/spring-integration-core/src/main/java/org/springframework/integration/graph/ErrorCapableNode.java similarity index 86% rename from spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/ErrorCapableNode.java rename to spring-integration-core/src/main/java/org/springframework/integration/graph/ErrorCapableNode.java index 977d947e56..889c1e1c44 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/ErrorCapableNode.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/graph/ErrorCapableNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2018 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. @@ -14,12 +14,13 @@ * limitations under the License. */ -package org.springframework.integration.support.management.graph; +package org.springframework.integration.graph; /** * Nodes implementing this interface are capable of emitting errors. * * @author Gary Russell + * * @since 4.3 * */ diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/ErrorCapableRoutingNode.java b/spring-integration-core/src/main/java/org/springframework/integration/graph/ErrorCapableRoutingNode.java similarity index 91% rename from spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/ErrorCapableRoutingNode.java rename to spring-integration-core/src/main/java/org/springframework/integration/graph/ErrorCapableRoutingNode.java index 4a69431f89..4a30750355 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/ErrorCapableRoutingNode.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/graph/ErrorCapableRoutingNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.support.management.graph; +package org.springframework.integration.graph; import java.util.Collection; @@ -25,6 +25,7 @@ import org.springframework.messaging.MessageHandler; * (pollable endpoint). * * @author Gary Russell + * * @since 4.3 * */ @@ -34,6 +35,7 @@ public class ErrorCapableRoutingNode extends RoutingMessageHandlerNode implement public ErrorCapableRoutingNode(int nodeId, String name, MessageHandler handler, String input, String output, String errors, Collection routes) { + super(nodeId, name, handler, input, output, routes); this.errors = errors; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/Graph.java b/spring-integration-core/src/main/java/org/springframework/integration/graph/Graph.java similarity index 92% rename from spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/Graph.java rename to spring-integration-core/src/main/java/org/springframework/integration/graph/Graph.java index 1045ecc389..d9eabf0928 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/Graph.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/graph/Graph.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.support.management.graph; +package org.springframework.integration.graph; import java.util.Collection; import java.util.Map; @@ -25,6 +25,7 @@ import java.util.Map; * * @author Andy Clement * @author Gary Russell + * * @since 4.3 * */ diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/IntegrationGraphServer.java b/spring-integration-core/src/main/java/org/springframework/integration/graph/IntegrationGraphServer.java similarity index 97% rename from spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/IntegrationGraphServer.java rename to spring-integration-core/src/main/java/org/springframework/integration/graph/IntegrationGraphServer.java index 91f899aec0..e0a5f91b34 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/IntegrationGraphServer.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/graph/IntegrationGraphServer.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.support.management.graph; +package org.springframework.integration.graph; import java.lang.reflect.Method; import java.util.ArrayList; @@ -51,6 +51,7 @@ import org.springframework.util.StringUtils; * * @author Gary Russell * @author Artem Bilan + * * @since 4.3 * */ @@ -122,8 +123,8 @@ public class IntegrationGraphServer implements ApplicationContextAware, Applicat descriptor.put("name", name); } this.nodeFactory.reset(); - Collection nodes = new ArrayList(); - Collection links = new ArrayList(); + Collection nodes = new ArrayList<>(); + Collection links = new ArrayList<>(); Map channelNodes = channels(nodes); pollingAdapters(nodes, links, channelNodes); gateways(nodes, links, channelNodes); @@ -136,7 +137,7 @@ public class IntegrationGraphServer implements ApplicationContextAware, Applicat private Map channels(Collection nodes) { Map channels = this.applicationContext .getBeansOfType(MessageChannel.class); - Map channelNodes = new HashMap(); + Map channelNodes = new HashMap<>(); for (Entry entry : channels.entrySet()) { MessageChannel channel = entry.getValue(); MessageChannelNode channelNode = this.nodeFactory.channelNode(entry.getKey(), channel); @@ -149,6 +150,7 @@ public class IntegrationGraphServer implements ApplicationContextAware, Applicat private void pollingAdapters(Collection nodes, Collection links, Map channelNodes) { + Map spcas = this.applicationContext .getBeansOfType(SourcePollingChannelAdapter.class); for (Entry entry : spcas.entrySet()) { @@ -161,6 +163,7 @@ public class IntegrationGraphServer implements ApplicationContextAware, Applicat private void gateways(Collection nodes, Collection links, Map channelNodes) { + Map gateways = this.applicationContext .getBeansOfType(MessagingGatewaySupport.class); for (Entry entry : gateways.entrySet()) { @@ -194,6 +197,7 @@ public class IntegrationGraphServer implements ApplicationContextAware, Applicat private void producers(Collection nodes, Collection links, Map channelNodes) { + Map producers = this.applicationContext .getBeansOfType(MessageProducerSupport.class); for (Entry entry : producers.entrySet()) { @@ -206,6 +210,7 @@ public class IntegrationGraphServer implements ApplicationContextAware, Applicat private void consumers(Collection nodes, Collection links, Map channelNodes) { + Map consumers = this.applicationContext.getBeansOfType(IntegrationConsumer.class); for (Entry entry : consumers.entrySet()) { IntegrationConsumer consumer = entry.getValue(); @@ -223,6 +228,7 @@ public class IntegrationGraphServer implements ApplicationContextAware, Applicat private void producerLink(Collection links, Map channelNodes, EndpointNode endpointNode) { + MessageChannelNode channelNode; if (endpointNode.getOutput() != null) { channelNode = channelNodes.get(endpointNode.getOutput()); @@ -355,9 +361,9 @@ public class IntegrationGraphServer implements ApplicationContextAware, Applicat private MessageHandlerNode compositeHandler(String name, IntegrationConsumer consumer, CompositeMessageHandler handler, String output, String errors, boolean polled) { + List handlers = handler.getHandlers(); - List innerHandlers = - new ArrayList(); + List innerHandlers = new ArrayList<>(); for (MessageHandler innerHandler : handlers) { if (innerHandler instanceof NamedComponent) { NamedComponent named = (NamedComponent) innerHandler; @@ -375,6 +381,7 @@ public class IntegrationGraphServer implements ApplicationContextAware, Applicat private MessageHandlerNode discardingHandler(String name, IntegrationConsumer consumer, DiscardingMessageHandler handler, String output, String errors, boolean polled) { + String discards = handler.getDiscardChannel() != null ? handler.getDiscardChannel().toString() : null; String inputChannel = consumer.getInputChannel() != null ? consumer.getInputChannel().toString() : null; return polled @@ -386,6 +393,7 @@ public class IntegrationGraphServer implements ApplicationContextAware, Applicat private MessageHandlerNode routingHandler(String name, IntegrationConsumer consumer, MessageHandler handler, MappingMessageRouterManagement router, String output, String errors, boolean polled) { + Collection routes = router.getChannelMappings().values(); Collection dynamicChannelNames = router.getDynamicChannelNames(); if (dynamicChannelNames.size() > 0) { @@ -403,8 +411,9 @@ public class IntegrationGraphServer implements ApplicationContextAware, Applicat private MessageHandlerNode recipientListRoutingHandler(String name, IntegrationConsumer consumer, MessageHandler handler, RecipientListRouterManagement router, String output, String errors, boolean polled) { + Collection recipients = router.getRecipients(); - List routes = new ArrayList(recipients.size()); + List routes = new ArrayList<>(recipients.size()); for (Object recipient : recipients) { routes.add(((Recipient) recipient).getChannel().toString()); } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/IntegrationNode.java b/spring-integration-core/src/main/java/org/springframework/integration/graph/IntegrationNode.java similarity index 94% rename from spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/IntegrationNode.java rename to spring-integration-core/src/main/java/org/springframework/integration/graph/IntegrationNode.java index 8673407b92..d4c23424c9 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/IntegrationNode.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/graph/IntegrationNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.support.management.graph; +package org.springframework.integration.graph; import java.util.HashMap; import java.util.Map; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/LinkNode.java b/spring-integration-core/src/main/java/org/springframework/integration/graph/LinkNode.java similarity index 90% rename from spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/LinkNode.java rename to spring-integration-core/src/main/java/org/springframework/integration/graph/LinkNode.java index 6f421bb6c4..7b298aefb7 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/LinkNode.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/graph/LinkNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.support.management.graph; +package org.springframework.integration.graph; /** * Represents a link between nodes. diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/MessageChannelNode.java b/spring-integration-core/src/main/java/org/springframework/integration/graph/MessageChannelNode.java similarity index 96% rename from spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/MessageChannelNode.java rename to spring-integration-core/src/main/java/org/springframework/integration/graph/MessageChannelNode.java index 55e4918ceb..25c04e94b1 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/MessageChannelNode.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/graph/MessageChannelNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.support.management.graph; +package org.springframework.integration.graph; import org.springframework.integration.support.management.MessageChannelMetrics; import org.springframework.integration.support.management.Statistics; @@ -24,6 +24,7 @@ import org.springframework.messaging.MessageChannel; * Represents a message channel. * * @author Gary Russell + * * @since 4.3 * */ diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/MessageGatewayNode.java b/spring-integration-core/src/main/java/org/springframework/integration/graph/MessageGatewayNode.java similarity index 92% rename from spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/MessageGatewayNode.java rename to spring-integration-core/src/main/java/org/springframework/integration/graph/MessageGatewayNode.java index a53bf7d126..099cae1f30 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/MessageGatewayNode.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/graph/MessageGatewayNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.support.management.graph; +package org.springframework.integration.graph; import org.springframework.integration.gateway.MessagingGatewaySupport; @@ -22,6 +22,7 @@ import org.springframework.integration.gateway.MessagingGatewaySupport; * Represents an inbound gateway. * * @author Gary Russell + * * @since 4.3 * */ diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/MessageHandlerNode.java b/spring-integration-core/src/main/java/org/springframework/integration/graph/MessageHandlerNode.java similarity index 95% rename from spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/MessageHandlerNode.java rename to spring-integration-core/src/main/java/org/springframework/integration/graph/MessageHandlerNode.java index 80c6302f1f..e668181c01 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/MessageHandlerNode.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/graph/MessageHandlerNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.support.management.graph; +package org.springframework.integration.graph; import org.springframework.integration.support.management.MessageHandlerMetrics; import org.springframework.integration.support.management.Statistics; @@ -24,6 +24,7 @@ import org.springframework.messaging.MessageHandler; * Represents a message handler. * * @author Gary Russell + * * @since 4.3 * */ @@ -97,6 +98,7 @@ public class MessageHandlerNode extends EndpointNode { public boolean isCountsEnabled() { return this.handler.isCountsEnabled(); } + } } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/MessageProducerNode.java b/spring-integration-core/src/main/java/org/springframework/integration/graph/MessageProducerNode.java similarity index 89% rename from spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/MessageProducerNode.java rename to spring-integration-core/src/main/java/org/springframework/integration/graph/MessageProducerNode.java index b88a473265..202448db72 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/MessageProducerNode.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/graph/MessageProducerNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.support.management.graph; +package org.springframework.integration.graph; import org.springframework.integration.endpoint.MessageProducerSupport; @@ -22,6 +22,7 @@ import org.springframework.integration.endpoint.MessageProducerSupport; * Represents an inbound message producer. * * @author Gary Russell + * * @since 4.3 * */ diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/MessageSourceNode.java b/spring-integration-core/src/main/java/org/springframework/integration/graph/MessageSourceNode.java similarity index 92% rename from spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/MessageSourceNode.java rename to spring-integration-core/src/main/java/org/springframework/integration/graph/MessageSourceNode.java index b06339c091..ccd3d4c9e6 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/MessageSourceNode.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/graph/MessageSourceNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.support.management.graph; +package org.springframework.integration.graph; import org.springframework.integration.core.MessageSource; import org.springframework.integration.support.management.MessageSourceMetrics; @@ -23,6 +23,7 @@ import org.springframework.integration.support.management.MessageSourceMetrics; * Represents a message source. * * @author Gary Russell + * * @since 4.3 * */ diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/RoutingMessageHandlerNode.java b/spring-integration-core/src/main/java/org/springframework/integration/graph/RoutingMessageHandlerNode.java similarity index 90% rename from spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/RoutingMessageHandlerNode.java rename to spring-integration-core/src/main/java/org/springframework/integration/graph/RoutingMessageHandlerNode.java index edce7a26a8..8e894b8da9 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/RoutingMessageHandlerNode.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/graph/RoutingMessageHandlerNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.support.management.graph; +package org.springframework.integration.graph; import java.util.Collection; @@ -24,6 +24,7 @@ import org.springframework.messaging.MessageHandler; * Represents an endpoint that can route to multiple channels. * * @author Gary Russell + * * @since 4.3 * */ @@ -33,6 +34,7 @@ public class RoutingMessageHandlerNode extends MessageHandlerNode { public RoutingMessageHandlerNode(int nodeId, String name, MessageHandler handler, String input, String output, Collection routes) { + super(nodeId, name, handler, input, output); this.routes = routes; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/graph/package-info.java b/spring-integration-core/src/main/java/org/springframework/integration/graph/package-info.java new file mode 100644 index 0000000000..4c10d36455 --- /dev/null +++ b/spring-integration-core/src/main/java/org/springframework/integration/graph/package-info.java @@ -0,0 +1,4 @@ +/** + * Provides classes related to the runtime object graph. + */ +package org.springframework.integration.graph; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/package-info.java b/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/package-info.java deleted file mode 100644 index a2e0dc31be..0000000000 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Provides classes related to the runtime object graph. - */ -package org.springframework.integration.support.management.graph; diff --git a/spring-integration-core/src/main/resources/META-INF/spring.factories b/spring-integration-core/src/main/resources/META-INF/spring.factories index fb4b8927fd..9f695e630a 100644 --- a/spring-integration-core/src/main/resources/META-INF/spring.factories +++ b/spring-integration-core/src/main/resources/META-INF/spring.factories @@ -2,4 +2,4 @@ org.springframework.integration.config.IntegrationConfigurationInitializer=\ org.springframework.integration.config.GlobalChannelInterceptorInitializer,\ org.springframework.integration.config.IntegrationConverterInitializer,\ org.springframework.integration.config.IdempotentReceiverAutoProxyCreatorInitializer,\ -org.springframework.integration.config.dsl.DslIntegrationConfigurationInitializer +org.springframework.integration.dsl.context.DslIntegrationConfigurationInitializer diff --git a/spring-integration-core/src/test/java/org/springframework/integration/dsl/correlation/CorrelationHandlerTests.java b/spring-integration-core/src/test/java/org/springframework/integration/dsl/correlation/CorrelationHandlerTests.java index d54f376eb6..e1cecd45cf 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/dsl/correlation/CorrelationHandlerTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/dsl/correlation/CorrelationHandlerTests.java @@ -43,7 +43,7 @@ import org.springframework.integration.channel.QueueChannel; import org.springframework.integration.config.EnableIntegration; import org.springframework.integration.dsl.IntegrationFlow; import org.springframework.integration.dsl.IntegrationFlows; -import org.springframework.integration.dsl.channel.MessageChannels; +import org.springframework.integration.dsl.MessageChannels; import org.springframework.integration.handler.MessageTriggerAction; import org.springframework.integration.support.MessageBuilder; import org.springframework.messaging.Message; diff --git a/spring-integration-core/src/test/java/org/springframework/integration/dsl/flows/IntegrationFlowTests.java b/spring-integration-core/src/test/java/org/springframework/integration/dsl/flows/IntegrationFlowTests.java index 9d8cf43fa9..195cd54573 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/dsl/flows/IntegrationFlowTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/dsl/flows/IntegrationFlowTests.java @@ -61,9 +61,9 @@ import org.springframework.integration.config.EnableIntegration; import org.springframework.integration.context.IntegrationContextUtils; import org.springframework.integration.dsl.IntegrationFlow; import org.springframework.integration.dsl.IntegrationFlows; +import org.springframework.integration.dsl.MessageChannels; import org.springframework.integration.dsl.Pollers; import org.springframework.integration.dsl.Transformers; -import org.springframework.integration.dsl.channel.MessageChannels; import org.springframework.integration.handler.AbstractReplyProducingMessageHandler; import org.springframework.integration.handler.GenericHandler; import org.springframework.integration.handler.advice.ErrorMessageSendingRecoverer; diff --git a/spring-integration-core/src/test/java/org/springframework/integration/dsl/flowservices/FlowServiceTests.java b/spring-integration-core/src/test/java/org/springframework/integration/dsl/flowservices/FlowServiceTests.java index d5621d39a7..95d3661609 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/dsl/flowservices/FlowServiceTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/dsl/flowservices/FlowServiceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017 the original author or authors. + * Copyright 2016-2018 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. @@ -48,7 +48,7 @@ import org.springframework.integration.dsl.IntegrationFlow; import org.springframework.integration.dsl.IntegrationFlowAdapter; import org.springframework.integration.dsl.IntegrationFlowDefinition; import org.springframework.integration.dsl.IntegrationFlows; -import org.springframework.integration.dsl.channel.MessageChannels; +import org.springframework.integration.dsl.MessageChannels; import org.springframework.integration.handler.LoggingHandler; import org.springframework.integration.support.MessageBuilder; import org.springframework.messaging.Message; diff --git a/spring-integration-core/src/test/java/org/springframework/integration/dsl/manualflow/ManualFlowTests.java b/spring-integration-core/src/test/java/org/springframework/integration/dsl/manualflow/ManualFlowTests.java index 6adea417d9..ebaf260f9d 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/dsl/manualflow/ManualFlowTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/dsl/manualflow/ManualFlowTests.java @@ -54,11 +54,11 @@ import org.springframework.integration.dsl.IntegrationFlow; import org.springframework.integration.dsl.IntegrationFlowAdapter; import org.springframework.integration.dsl.IntegrationFlowDefinition; import org.springframework.integration.dsl.IntegrationFlows; +import org.springframework.integration.dsl.MessageChannels; import org.springframework.integration.dsl.MessageProducerSpec; import org.springframework.integration.dsl.StandardIntegrationFlow; -import org.springframework.integration.dsl.channel.MessageChannels; import org.springframework.integration.dsl.context.IntegrationFlowContext; -import org.springframework.integration.dsl.context.IntegrationFlowRegistration; +import org.springframework.integration.dsl.context.IntegrationFlowContext.IntegrationFlowRegistration; import org.springframework.integration.endpoint.MessageProducerSupport; import org.springframework.integration.handler.AbstractReplyProducingMessageHandler; import org.springframework.integration.support.SmartLifecycleRoleController; diff --git a/spring-integration-core/src/test/java/org/springframework/integration/dsl/reactivestreams/ReactiveStreamsTests.java b/spring-integration-core/src/test/java/org/springframework/integration/dsl/reactivestreams/ReactiveStreamsTests.java index df02a3ab00..05f8431e54 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/dsl/reactivestreams/ReactiveStreamsTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/dsl/reactivestreams/ReactiveStreamsTests.java @@ -48,7 +48,7 @@ import org.springframework.integration.channel.QueueChannel; import org.springframework.integration.config.EnableIntegration; import org.springframework.integration.dsl.IntegrationFlow; import org.springframework.integration.dsl.IntegrationFlows; -import org.springframework.integration.dsl.channel.MessageChannels; +import org.springframework.integration.dsl.MessageChannels; import org.springframework.integration.dsl.context.IntegrationFlowContext; import org.springframework.messaging.Message; import org.springframework.messaging.MessageChannel; diff --git a/spring-integration-core/src/test/java/org/springframework/integration/dsl/routers/RouterTests.java b/spring-integration-core/src/test/java/org/springframework/integration/dsl/routers/RouterTests.java index 27d60926ac..ef7da94433 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/dsl/routers/RouterTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/dsl/routers/RouterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017 the original author or authors. + * Copyright 2016-2018 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. @@ -44,7 +44,7 @@ import org.springframework.integration.config.EnableIntegration; import org.springframework.integration.config.EnableMessageHistory; import org.springframework.integration.dsl.IntegrationFlow; import org.springframework.integration.dsl.IntegrationFlows; -import org.springframework.integration.dsl.channel.MessageChannels; +import org.springframework.integration.dsl.MessageChannels; import org.springframework.integration.expression.FunctionExpression; import org.springframework.integration.support.MessageBuilder; import org.springframework.messaging.Message; diff --git a/spring-integration-core/src/test/java/org/springframework/integration/dsl/transformers/TransformerTests.java b/spring-integration-core/src/test/java/org/springframework/integration/dsl/transformers/TransformerTests.java index 0207dbc195..5f41b287f4 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/dsl/transformers/TransformerTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/dsl/transformers/TransformerTests.java @@ -49,8 +49,8 @@ import org.springframework.integration.codec.Codec; import org.springframework.integration.config.EnableIntegration; import org.springframework.integration.dsl.IntegrationFlow; import org.springframework.integration.dsl.IntegrationFlows; +import org.springframework.integration.dsl.MessageChannels; import org.springframework.integration.dsl.Transformers; -import org.springframework.integration.dsl.channel.MessageChannels; import org.springframework.integration.handler.advice.AbstractRequestHandlerAdvice; import org.springframework.integration.handler.advice.IdempotentReceiverInterceptor; import org.springframework.integration.selector.MetadataStoreSelector; diff --git a/spring-integration-core/src/test/java/org/springframework/integration/json/ContentTypeConversionTests.java b/spring-integration-core/src/test/java/org/springframework/integration/json/ContentTypeConversionTests.java index e87725f054..a04502c7d9 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/json/ContentTypeConversionTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/json/ContentTypeConversionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 the original author or authors. + * Copyright 2017-2018 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. @@ -36,7 +36,7 @@ import org.springframework.integration.annotation.ServiceActivator; import org.springframework.integration.config.EnableIntegration; import org.springframework.integration.dsl.IntegrationFlow; import org.springframework.integration.dsl.IntegrationFlows; -import org.springframework.integration.dsl.channel.MessageChannels; +import org.springframework.integration.dsl.MessageChannels; import org.springframework.messaging.Message; import org.springframework.messaging.MessageChannel; import org.springframework.messaging.MessageHeaders; diff --git a/spring-integration-core/src/test/java/org/springframework/integration/support/management/IntegrationManagementConfigurerTests.java b/spring-integration-core/src/test/java/org/springframework/integration/support/management/IntegrationManagementConfigurerTests.java index 620e6317b1..d01772cbb6 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/support/management/IntegrationManagementConfigurerTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/support/management/IntegrationManagementConfigurerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2017 the original author or authors. + * Copyright 2015-2018 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. @@ -36,6 +36,7 @@ import org.springframework.integration.channel.AbstractMessageChannel; import org.springframework.integration.channel.DirectChannel; import org.springframework.integration.config.EnableIntegration; import org.springframework.integration.config.EnableIntegrationManagement; +import org.springframework.integration.config.IntegrationManagementConfigurer; import org.springframework.integration.endpoint.AbstractMessageSource; import org.springframework.integration.handler.AbstractMessageHandler; import org.springframework.integration.router.RecipientListRouter; @@ -44,6 +45,7 @@ import org.springframework.messaging.MessageChannel; /** * @author Gary Russell + * * @since 4.2 * */ diff --git a/spring-integration-core/src/test/java/org/springframework/integration/support/management/graph/IntegrationGraphServerTests.java b/spring-integration-core/src/test/java/org/springframework/integration/support/management/graph/IntegrationGraphServerTests.java index adfc9a8f2d..92906e7730 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/support/management/graph/IntegrationGraphServerTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/support/management/graph/IntegrationGraphServerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2018 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. @@ -48,6 +48,8 @@ import org.springframework.integration.core.MessageProducer; import org.springframework.integration.endpoint.EventDrivenConsumer; import org.springframework.integration.endpoint.MessageProducerSupport; import org.springframework.integration.endpoint.PollingConsumer; +import org.springframework.integration.graph.Graph; +import org.springframework.integration.graph.IntegrationGraphServer; import org.springframework.integration.router.ExpressionEvaluatingRouter; import org.springframework.integration.router.HeaderValueRouter; import org.springframework.integration.router.RecipientListRouter; @@ -69,6 +71,7 @@ import com.fasterxml.jackson.databind.SerializationFeature; /** * @author Gary Russell * @author Artem Bilan + * * @since 4.3 * */ diff --git a/spring-integration-event/src/test/java/org/springframework/integration/event/dsl/IntegrationFlowEventsTests.java b/spring-integration-event/src/test/java/org/springframework/integration/event/dsl/IntegrationFlowEventsTests.java index c70a681953..2330c0869c 100644 --- a/spring-integration-event/src/test/java/org/springframework/integration/event/dsl/IntegrationFlowEventsTests.java +++ b/spring-integration-event/src/test/java/org/springframework/integration/event/dsl/IntegrationFlowEventsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2018 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. @@ -40,7 +40,7 @@ import org.springframework.integration.channel.QueueChannel; import org.springframework.integration.config.EnableIntegration; import org.springframework.integration.dsl.IntegrationFlow; import org.springframework.integration.dsl.IntegrationFlows; -import org.springframework.integration.dsl.channel.MessageChannels; +import org.springframework.integration.dsl.MessageChannels; import org.springframework.integration.event.core.MessagingEvent; import org.springframework.integration.event.inbound.ApplicationEventListeningMessageProducer; import org.springframework.integration.event.outbound.ApplicationEventPublishingMessageHandler; diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/event/FileIntegrationEvent.java b/spring-integration-file/src/main/java/org/springframework/integration/file/event/FileIntegrationEvent.java index a63ea90d6c..45712ce077 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/event/FileIntegrationEvent.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/event/FileIntegrationEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2016 the original author or authors. + * Copyright 2013-2018 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. @@ -16,10 +16,11 @@ package org.springframework.integration.file.event; -import org.springframework.integration.event.IntegrationEvent; +import org.springframework.integration.events.IntegrationEvent; /** * @author Gary Russell + * * @since 3.0 * */ diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/dsl/FileTests.java b/spring-integration-file/src/test/java/org/springframework/integration/file/dsl/FileTests.java index b9a254f93d..de3bbd900e 100644 --- a/spring-integration-file/src/test/java/org/springframework/integration/file/dsl/FileTests.java +++ b/spring-integration-file/src/test/java/org/springframework/integration/file/dsl/FileTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017 the original author or authors. + * Copyright 2016-2018 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. @@ -64,9 +64,9 @@ import org.springframework.integration.config.EnableIntegration; import org.springframework.integration.dsl.IntegrationFlow; import org.springframework.integration.dsl.IntegrationFlowDefinition; import org.springframework.integration.dsl.IntegrationFlows; +import org.springframework.integration.dsl.MessageChannels; import org.springframework.integration.dsl.Pollers; import org.springframework.integration.dsl.StandardIntegrationFlow; -import org.springframework.integration.dsl.channel.MessageChannels; import org.springframework.integration.expression.FunctionExpression; import org.springframework.integration.file.DefaultDirectoryScanner; import org.springframework.integration.file.DefaultFileNameGenerator; diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/dsl/FtpTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/dsl/FtpTests.java index 71be2c4292..63357b3a0f 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/dsl/FtpTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/dsl/FtpTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2017 the original author or authors. + * Copyright 2014-2018 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. @@ -52,7 +52,7 @@ import org.springframework.integration.dsl.IntegrationFlows; import org.springframework.integration.dsl.Pollers; import org.springframework.integration.dsl.StandardIntegrationFlow; import org.springframework.integration.dsl.context.IntegrationFlowContext; -import org.springframework.integration.dsl.context.IntegrationFlowRegistration; +import org.springframework.integration.dsl.context.IntegrationFlowContext.IntegrationFlowRegistration; import org.springframework.integration.file.FileHeaders; import org.springframework.integration.file.remote.RemoteFileTemplate; import org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway; diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/config/IntegrationGraphControllerRegistrar.java b/spring-integration-http/src/main/java/org/springframework/integration/http/config/IntegrationGraphControllerRegistrar.java index 3706867b2b..f15604e32e 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/config/IntegrationGraphControllerRegistrar.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/config/IntegrationGraphControllerRegistrar.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017 the original author or authors. + * Copyright 2016-2018 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. @@ -36,8 +36,8 @@ import org.springframework.core.env.Environment; import org.springframework.core.env.MapPropertySource; import org.springframework.core.type.AnnotationMetadata; import org.springframework.integration.context.IntegrationContextUtils; +import org.springframework.integration.graph.IntegrationGraphServer; import org.springframework.integration.http.management.IntegrationGraphController; -import org.springframework.integration.support.management.graph.IntegrationGraphServer; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/management/IntegrationGraphController.java b/spring-integration-http/src/main/java/org/springframework/integration/http/management/IntegrationGraphController.java index 6ce0ba55a3..a958d3273e 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/management/IntegrationGraphController.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/management/IntegrationGraphController.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2018 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. @@ -16,9 +16,9 @@ package org.springframework.integration.http.management; +import org.springframework.integration.graph.Graph; +import org.springframework.integration.graph.IntegrationGraphServer; import org.springframework.integration.http.config.HttpContextUtils; -import org.springframework.integration.support.management.graph.Graph; -import org.springframework.integration.support.management.graph.IntegrationGraphServer; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/event/IpIntegrationEvent.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/event/IpIntegrationEvent.java index 787d433241..302105e45d 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/event/IpIntegrationEvent.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/event/IpIntegrationEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2016 the original author or authors. + * Copyright 2013-2018 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. @@ -16,10 +16,11 @@ package org.springframework.integration.ip.event; -import org.springframework.integration.event.IntegrationEvent; +import org.springframework.integration.events.IntegrationEvent; /** * @author Gary Russell + * * @since 3.0 * */ diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/dsl/IpIntegrationTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/dsl/IpIntegrationTests.java index e6c9bc01d0..dafbb2ac06 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/dsl/IpIntegrationTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/dsl/IpIntegrationTests.java @@ -41,7 +41,7 @@ import org.springframework.integration.dsl.IntegrationFlow; import org.springframework.integration.dsl.IntegrationFlows; import org.springframework.integration.dsl.Transformers; import org.springframework.integration.dsl.context.IntegrationFlowContext; -import org.springframework.integration.dsl.context.IntegrationFlowRegistration; +import org.springframework.integration.dsl.context.IntegrationFlowContext.IntegrationFlowRegistration; import org.springframework.integration.ip.tcp.TcpReceivingChannelAdapter; import org.springframework.integration.ip.tcp.TcpSendingMessageHandler; import org.springframework.integration.ip.tcp.connection.AbstractClientConnectionFactory; @@ -60,6 +60,7 @@ import org.springframework.test.context.junit4.SpringRunner; /** * @author Gary Russell + * * @since 5.0 * */ diff --git a/spring-integration-jms/src/main/java/org/springframework/integration/jms/dsl/JmsPollableMessageChannelSpec.java b/spring-integration-jms/src/main/java/org/springframework/integration/jms/dsl/JmsPollableMessageChannelSpec.java index fd167c55e9..46fa09c63f 100644 --- a/spring-integration-jms/src/main/java/org/springframework/integration/jms/dsl/JmsPollableMessageChannelSpec.java +++ b/spring-integration-jms/src/main/java/org/springframework/integration/jms/dsl/JmsPollableMessageChannelSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2018 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. @@ -21,7 +21,7 @@ import javax.jms.Destination; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.support.DefaultListableBeanFactory; -import org.springframework.integration.dsl.channel.MessageChannelSpec; +import org.springframework.integration.dsl.MessageChannelSpec; import org.springframework.integration.jms.AbstractJmsChannel; import org.springframework.integration.jms.config.JmsChannelFactoryBean; import org.springframework.jms.support.converter.MessageConverter; @@ -33,6 +33,7 @@ import org.springframework.jms.support.destination.DestinationResolver; * @param the target {@link JmsPollableMessageChannelSpec} implementation type. * * @author Artem Bilan + * * @since 5.0 */ public class JmsPollableMessageChannelSpec> diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/dsl/JmsTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/dsl/JmsTests.java index e8faa884f6..f5359a7fa3 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/dsl/JmsTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/dsl/JmsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017 the original author or authors. + * Copyright 2016-2018 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. @@ -57,8 +57,8 @@ import org.springframework.integration.core.MessageSource; import org.springframework.integration.dsl.IntegrationFlow; import org.springframework.integration.dsl.IntegrationFlowDefinition; import org.springframework.integration.dsl.IntegrationFlows; +import org.springframework.integration.dsl.MessageChannels; import org.springframework.integration.dsl.Pollers; -import org.springframework.integration.dsl.channel.MessageChannels; import org.springframework.integration.endpoint.MethodInvokingMessageSource; import org.springframework.integration.scheduling.PollerMetadata; import org.springframework.integration.support.MessageBuilder; diff --git a/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/config/IntegrationMBeanExportConfiguration.java b/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/config/IntegrationMBeanExportConfiguration.java index 660657d0d9..5e91d43cb2 100644 --- a/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/config/IntegrationMBeanExportConfiguration.java +++ b/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/config/IntegrationMBeanExportConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2016 the original author or authors. + * Copyright 2014-2018 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. @@ -42,9 +42,8 @@ import org.springframework.context.expression.StandardBeanExpressionResolver; import org.springframework.core.annotation.AnnotationAttributes; import org.springframework.core.env.Environment; import org.springframework.core.type.AnnotationMetadata; +import org.springframework.integration.config.IntegrationManagementConfigurer; import org.springframework.integration.monitor.IntegrationMBeanExporter; -import org.springframework.integration.support.management.IntegrationManagementConfigurer; -import org.springframework.jmx.support.RegistrationPolicy; import org.springframework.util.Assert; import org.springframework.util.StringUtils; @@ -56,6 +55,7 @@ import org.springframework.util.StringUtils; * * @author Artem Bilan * @author Gary Russell + * * @since 4.0 */ @Configuration @@ -103,7 +103,7 @@ public class IntegrationMBeanExportConfiguration implements ImportAware, Environ @Role(BeanDefinition.ROLE_INFRASTRUCTURE) public IntegrationMBeanExporter mbeanExporter() { IntegrationMBeanExporter exporter = new IntegrationMBeanExporter(); - exporter.setRegistrationPolicy(this.attributes.getEnum("registration")); + exporter.setRegistrationPolicy(this.attributes.getEnum("registration")); setupDomain(exporter); setupServer(exporter); setupComponentNamePatterns(exporter); @@ -152,7 +152,7 @@ public class IntegrationMBeanExportConfiguration implements ImportAware, Environ } private void setupComponentNamePatterns(IntegrationMBeanExporter exporter) { - List patterns = new ArrayList(); + List patterns = new ArrayList<>(); String[] managedComponents = this.attributes.getStringArray("managedComponents"); for (String managedComponent : managedComponents) { String pattern = this.environment.resolvePlaceholders(managedComponent); diff --git a/spring-integration-jmx/src/main/java/org/springframework/integration/monitor/IntegrationMBeanExporter.java b/spring-integration-jmx/src/main/java/org/springframework/integration/monitor/IntegrationMBeanExporter.java index 6e86223e78..d12420ad35 100644 --- a/spring-integration-jmx/src/main/java/org/springframework/integration/monitor/IntegrationMBeanExporter.java +++ b/spring-integration-jmx/src/main/java/org/springframework/integration/monitor/IntegrationMBeanExporter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -44,6 +44,7 @@ import org.springframework.context.ApplicationContextAware; import org.springframework.context.EmbeddedValueResolverAware; import org.springframework.context.Lifecycle; import org.springframework.integration.channel.QueueChannel; +import org.springframework.integration.config.IntegrationManagementConfigurer; import org.springframework.integration.context.IntegrationContextUtils; import org.springframework.integration.context.OrderlyShutdownCapable; import org.springframework.integration.core.MessageProducer; @@ -52,7 +53,6 @@ import org.springframework.integration.gateway.MessagingGatewaySupport; import org.springframework.integration.handler.AbstractMessageProducingHandler; import org.springframework.integration.history.MessageHistoryConfigurer; import org.springframework.integration.support.context.NamedComponent; -import org.springframework.integration.support.management.IntegrationManagementConfigurer; import org.springframework.integration.support.management.LifecycleMessageHandlerMetrics; import org.springframework.integration.support.management.LifecycleMessageSourceManagement; import org.springframework.integration.support.management.LifecycleMessageSourceMetrics; @@ -123,31 +123,32 @@ public class IntegrationMBeanExporter extends MBeanExporter implements Applicati private ApplicationContext applicationContext; - private final Map anonymousHandlerCounters = new HashMap(); + private final Map anonymousHandlerCounters = new HashMap<>(); - private final Map anonymousSourceCounters = new HashMap(); + private final Map anonymousSourceCounters = new HashMap<>(); - private final Set handlers = new HashSet(); + private final Set handlers = new HashSet<>(); - private final Set sources = new HashSet(); + private final Set sources = new HashSet<>(); - private final Set inboundLifecycleMessageProducers = new HashSet(); + private final Set inboundLifecycleMessageProducers = new HashSet<>(); - private final Set channels = new HashSet(); + private final Set channels = new HashSet<>(); - private final Map allChannelsByName = new HashMap(); + private final Map allChannelsByName = new HashMap<>(); - private final Map allHandlersByName = new HashMap(); + private final Map allHandlersByName = new HashMap<>(); - private final Map allSourcesByName = new HashMap(); + private final Map allSourcesByName = new HashMap<>(); - private final Map beansByEndpointName = new HashMap(); + private final Map beansByEndpointName = new HashMap<>(); private String domain = DEFAULT_DOMAIN; private final Properties objectNameStaticProperties = new Properties(); - private final MetadataNamingStrategy defaultNamingStrategy = new IntegrationMetadataNamingStrategy(this.attributeSource); + private final MetadataNamingStrategy defaultNamingStrategy = + new IntegrationMetadataNamingStrategy(this.attributeSource); private String[] componentNamePatterns = { "*" }; @@ -300,7 +301,7 @@ public class IntegrationMBeanExporter extends MBeanExporter implements Applicati private MessageHandler handlerInAnonymousWrapper(final Object bean) { if (bean != null && bean.getClass().isAnonymousClass()) { - final AtomicReference wrapped = new AtomicReference(); + final AtomicReference wrapped = new AtomicReference<>(); ReflectionUtils.doWithFields(bean.getClass(), field -> { field.setAccessible(true); Object handler = field.get(bean); @@ -320,7 +321,7 @@ public class IntegrationMBeanExporter extends MBeanExporter implements Applicati * and risk it being a proxy (which it almost certainly is by now). * * @param bean the bean instance to register - * @param beanKey the bean name or human readable version if autogenerated + * @param beanKey the bean name or human readable version if auto-generated * @return the JMX object name of the MBean that was registered */ private ObjectName registerBeanInstance(Object bean, String beanKey) { @@ -678,7 +679,7 @@ public class IntegrationMBeanExporter extends MBeanExporter implements Applicati private void registerEndpoints() { String[] names = this.applicationContext.getBeanNamesForType(AbstractEndpoint.class); - Set endpointNames = new HashSet(); + Set endpointNames = new HashSet<>(); for (String name : names) { if (!this.beansByEndpointName.values().contains(name)) { AbstractEndpoint endpoint = this.applicationContext.getBean(name, AbstractEndpoint.class); diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/MBeanExporterParserTests.java b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/MBeanExporterParserTests.java index 9c6cdf44fe..a819ce55ea 100644 --- a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/MBeanExporterParserTests.java +++ b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/MBeanExporterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2018 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. @@ -31,6 +31,7 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; +import org.springframework.integration.config.IntegrationManagementConfigurer; import org.springframework.integration.monitor.IntegrationMBeanExporter; import org.springframework.integration.support.management.AbstractMessageChannelMetrics; import org.springframework.integration.support.management.AbstractMessageHandlerMetrics; @@ -39,7 +40,6 @@ import org.springframework.integration.support.management.DefaultMessageHandlerM import org.springframework.integration.support.management.ExponentialMovingAverage; import org.springframework.integration.support.management.ExponentialMovingAverageRate; import org.springframework.integration.support.management.ExponentialMovingAverageRatio; -import org.springframework.integration.support.management.IntegrationManagementConfigurer; import org.springframework.integration.support.management.MessageChannelMetrics; import org.springframework.integration.support.management.MessageHandlerMetrics; import org.springframework.integration.support.management.MetricsFactory; @@ -53,6 +53,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; * @author Oleg Zhurakousky * @author Gunnar Hillert * @author Gary Russell + * * @since 2.0 */ @ContextConfiguration @@ -64,7 +65,7 @@ public class MBeanExporterParserTests { private ApplicationContext context; @Test - public void testMBeanExporterExists() throws InterruptedException { + public void testMBeanExporterExists() { IntegrationMBeanExporter exporter = this.context.getBean(IntegrationMBeanExporter.class); MBeanServer server = this.context.getBean("mbs", MBeanServer.class); Properties properties = TestUtils.getPropertyValue(exporter, "objectNameStaticProperties", Properties.class); diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/configuration/EnableMBeanExportTests.java b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/configuration/EnableMBeanExportTests.java index 0710f37d5a..eaa5d8cbc5 100644 --- a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/configuration/EnableMBeanExportTests.java +++ b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/configuration/EnableMBeanExportTests.java @@ -43,10 +43,10 @@ import org.springframework.context.support.GenericApplicationContext; import org.springframework.integration.channel.QueueChannel; import org.springframework.integration.config.EnableIntegration; import org.springframework.integration.config.EnableIntegrationManagement; +import org.springframework.integration.config.IntegrationManagementConfigurer; import org.springframework.integration.jmx.config.EnableIntegrationMBeanExport; import org.springframework.integration.monitor.IntegrationMBeanExporter; import org.springframework.integration.support.management.DefaultMetricsFactory; -import org.springframework.integration.support.management.IntegrationManagementConfigurer; import org.springframework.integration.support.management.MetricsFactory; import org.springframework.integration.test.util.TestUtils; import org.springframework.jmx.support.MBeanServerFactoryBean; diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/event/MailIntegrationEvent.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/event/MailIntegrationEvent.java index eb41980962..8afa623acf 100644 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/event/MailIntegrationEvent.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/event/MailIntegrationEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2016 the original author or authors. + * Copyright 2013-2018 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. @@ -16,10 +16,11 @@ package org.springframework.integration.mail.event; -import org.springframework.integration.event.IntegrationEvent; +import org.springframework.integration.events.IntegrationEvent; /** * @author Gary Russell + * * @since 3.0 * */ diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/dsl/MailTests.java b/spring-integration-mail/src/test/java/org/springframework/integration/mail/dsl/MailTests.java index c2ca984513..fc9691494f 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/dsl/MailTests.java +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/dsl/MailTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2016 the original author or authors. + * Copyright 2014-2018 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. @@ -50,7 +50,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.integration.config.EnableIntegration; import org.springframework.integration.dsl.IntegrationFlow; import org.springframework.integration.dsl.IntegrationFlows; -import org.springframework.integration.dsl.channel.MessageChannels; +import org.springframework.integration.dsl.MessageChannels; import org.springframework.integration.mail.ImapIdleChannelAdapter; import org.springframework.integration.mail.MailHeaders; import org.springframework.integration.mail.support.DefaultMailHeaderMapper; diff --git a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/dsl/MongoDbTests.java b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/dsl/MongoDbTests.java index 0d0a512b11..cc6888b8c6 100644 --- a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/dsl/MongoDbTests.java +++ b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/dsl/MongoDbTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017 the original author or authors. + * Copyright 2016-2018 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. @@ -43,7 +43,7 @@ import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; import org.springframework.integration.config.EnableIntegration; import org.springframework.integration.dsl.IntegrationFlow; -import org.springframework.integration.dsl.channel.MessageChannels; +import org.springframework.integration.dsl.MessageChannels; import org.springframework.integration.handler.ReplyRequiredException; import org.springframework.integration.mongodb.rules.MongoDbAvailable; import org.springframework.integration.mongodb.rules.MongoDbAvailableTests; @@ -59,6 +59,7 @@ import com.mongodb.client.MongoCollection; /** * @author Xavier PadrĂ³ + * * @since 5.0 */ @RunWith(SpringRunner.class) diff --git a/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/event/MqttIntegrationEvent.java b/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/event/MqttIntegrationEvent.java index ed251120a9..09c85e7def 100644 --- a/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/event/MqttIntegrationEvent.java +++ b/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/event/MqttIntegrationEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2016 the original author or authors. + * Copyright 2014-2018 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. @@ -16,7 +16,7 @@ package org.springframework.integration.mqtt.event; -import org.springframework.integration.event.IntegrationEvent; +import org.springframework.integration.events.IntegrationEvent; /** * Base class for Mqtt Events. diff --git a/spring-integration-redis/src/main/java/org/springframework/integration/redis/event/RedisIntegrationEvent.java b/spring-integration-redis/src/main/java/org/springframework/integration/redis/event/RedisIntegrationEvent.java index e2a91068d1..f92969db71 100644 --- a/spring-integration-redis/src/main/java/org/springframework/integration/redis/event/RedisIntegrationEvent.java +++ b/spring-integration-redis/src/main/java/org/springframework/integration/redis/event/RedisIntegrationEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 the original author or authors. + * Copyright 2013-2018 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. @@ -16,10 +16,11 @@ package org.springframework.integration.redis.event; -import org.springframework.integration.event.IntegrationEvent; +import org.springframework.integration.events.IntegrationEvent; /** * @author Artem Bilan + * * @since 3.0 * */ diff --git a/spring-integration-redis/src/test/java/org/springframework/integration/redis/inbound/RedisQueueMessageDrivenEndpointTests.java b/spring-integration-redis/src/test/java/org/springframework/integration/redis/inbound/RedisQueueMessageDrivenEndpointTests.java index e1fcf2e8b7..05cc42effa 100644 --- a/spring-integration-redis/src/test/java/org/springframework/integration/redis/inbound/RedisQueueMessageDrivenEndpointTests.java +++ b/spring-integration-redis/src/test/java/org/springframework/integration/redis/inbound/RedisQueueMessageDrivenEndpointTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2017 the original author or authors. + * Copyright 2013-2018 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. @@ -57,7 +57,7 @@ import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer import org.springframework.data.redis.serializer.StringRedisSerializer; import org.springframework.integration.channel.DirectChannel; import org.springframework.integration.channel.QueueChannel; -import org.springframework.integration.event.IntegrationEvent; +import org.springframework.integration.events.IntegrationEvent; import org.springframework.integration.redis.event.RedisExceptionEvent; import org.springframework.integration.redis.rules.RedisAvailable; import org.springframework.integration.redis.rules.RedisAvailableTests; @@ -77,6 +77,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; * @author Artem Bilan * @author Gary Russell * @author Rainer Frey + * * @since 3.0 */ @ContextConfiguration @@ -99,11 +100,11 @@ public class RedisQueueMessageDrivenEndpointTests extends RedisAvailableTests { @Test @RedisAvailable @SuppressWarnings("unchecked") - public void testInt3014Default() throws Exception { + public void testInt3014Default() { String queueName = "si.test.redisQueueInboundChannelAdapterTests"; - RedisTemplate redisTemplate = new RedisTemplate(); + RedisTemplate redisTemplate = new RedisTemplate<>(); redisTemplate.setConnectionFactory(this.connectionFactory); redisTemplate.setEnableDefaultSerializer(false); redisTemplate.setKeySerializer(new StringRedisSerializer()); @@ -142,11 +143,11 @@ public class RedisQueueMessageDrivenEndpointTests extends RedisAvailableTests { @Test @RedisAvailable @SuppressWarnings("unchecked") - public void testInt3014ExpectMessageTrue() throws Exception { + public void testInt3014ExpectMessageTrue() { final String queueName = "si.test.redisQueueInboundChannelAdapterTests2"; - RedisTemplate redisTemplate = new RedisTemplate(); + RedisTemplate redisTemplate = new RedisTemplate<>(); redisTemplate.setConnectionFactory(this.connectionFactory); redisTemplate.setEnableDefaultSerializer(false); redisTemplate.setKeySerializer(new StringRedisSerializer()); @@ -193,7 +194,7 @@ public class RedisQueueMessageDrivenEndpointTests extends RedisAvailableTests { @Test @RedisAvailable - public void testInt3017IntegrationInbound() throws Exception { + public void testInt3017IntegrationInbound() { String payload = new Date().toString(); @@ -211,7 +212,7 @@ public class RedisQueueMessageDrivenEndpointTests extends RedisAvailableTests { @Test @RedisAvailable - public void testInt3017IntegrationSymmetrical() throws Exception { + public void testInt3017IntegrationSymmetrical() { UUID payload = UUID.randomUUID(); Message message = MessageBuilder.withPayload(payload) .setHeader("redis_queue", "si.test.Int3017IntegrationSymmetrical") @@ -230,7 +231,7 @@ public class RedisQueueMessageDrivenEndpointTests extends RedisAvailableTests { public void testInt3442ProperlyStop() throws Exception { final String queueName = "si.test.testInt3442ProperlyStopTest"; - final RedisTemplate redisTemplate = new RedisTemplate(); + final RedisTemplate redisTemplate = new RedisTemplate<>(); redisTemplate.setConnectionFactory(this.connectionFactory); redisTemplate.setEnableDefaultSerializer(false); redisTemplate.setKeySerializer(new StringRedisSerializer()); @@ -283,7 +284,7 @@ public class RedisQueueMessageDrivenEndpointTests extends RedisAvailableTests { String queueName = "test.si.Int3196Recovery"; QueueChannel channel = new QueueChannel(); - final List exceptionEvents = new ArrayList(); + final List exceptionEvents = new ArrayList<>(); final CountDownLatch exceptionsLatch = new CountDownLatch(2); @@ -309,7 +310,7 @@ public class RedisQueueMessageDrivenEndpointTests extends RedisAvailableTests { assertThat(exceptionEvent, Matchers.instanceOf(RedisExceptionEvent.class)); assertSame(endpoint, exceptionEvent.getSource()); assertThat(((IntegrationEvent) exceptionEvent).getCause().getClass(), - Matchers.isIn(Arrays.>asList(RedisSystemException.class, RedisConnectionFailureException.class))); + Matchers.isIn(Arrays.asList(RedisSystemException.class, RedisConnectionFailureException.class))); } ((InitializingBean) this.connectionFactory).afterPropertiesSet(); @@ -335,11 +336,11 @@ public class RedisQueueMessageDrivenEndpointTests extends RedisAvailableTests { @Test @RedisAvailable @SuppressWarnings("unchecked") - public void testInt3932ReadFromLeft() throws Exception { + public void testInt3932ReadFromLeft() { String queueName = "si.test.redisQueueInboundChannelAdapterTests3932"; - RedisTemplate redisTemplate = new RedisTemplate(); + RedisTemplate redisTemplate = new RedisTemplate<>(); redisTemplate.setConnectionFactory(this.connectionFactory); redisTemplate.setEnableDefaultSerializer(false); redisTemplate.setKeySerializer(new StringRedisSerializer()); diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/dsl/SftpTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/dsl/SftpTests.java index 2478c98d5c..b96434453e 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/dsl/SftpTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/dsl/SftpTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2017 the original author or authors. + * Copyright 2014-2018 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. @@ -43,7 +43,7 @@ import org.springframework.integration.dsl.IntegrationFlows; import org.springframework.integration.dsl.Pollers; import org.springframework.integration.dsl.StandardIntegrationFlow; import org.springframework.integration.dsl.context.IntegrationFlowContext; -import org.springframework.integration.dsl.context.IntegrationFlowRegistration; +import org.springframework.integration.dsl.context.IntegrationFlowContext.IntegrationFlowRegistration; import org.springframework.integration.file.FileHeaders; import org.springframework.integration.file.remote.RemoteFileTemplate; import org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway; @@ -61,6 +61,7 @@ import com.jcraft.jsch.ChannelSftp; /** * @author Artem Bilan * @author Gary Russell + * * @since 5.0 * */ diff --git a/spring-integration-stomp/src/main/java/org/springframework/integration/stomp/event/StompIntegrationEvent.java b/spring-integration-stomp/src/main/java/org/springframework/integration/stomp/event/StompIntegrationEvent.java index 9c98932743..97c92f7577 100644 --- a/spring-integration-stomp/src/main/java/org/springframework/integration/stomp/event/StompIntegrationEvent.java +++ b/spring-integration-stomp/src/main/java/org/springframework/integration/stomp/event/StompIntegrationEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2016 the original author or authors. + * Copyright 2015-2018 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. @@ -17,12 +17,13 @@ package org.springframework.integration.stomp.event; import org.springframework.context.ApplicationEvent; -import org.springframework.integration.event.IntegrationEvent; +import org.springframework.integration.events.IntegrationEvent; /** * Base class for all {@link ApplicationEvent}s generated by the STOMP Adapters. * * @author Artem Bilan + * * @since 4.2 */ @SuppressWarnings("serial") @@ -35,4 +36,5 @@ public abstract class StompIntegrationEvent extends IntegrationEvent { public StompIntegrationEvent(Object source, Throwable cause) { super(source, cause); } + } diff --git a/spring-integration-stream/src/main/java/org/springframework/integration/stream/StreamClosedEvent.java b/spring-integration-stream/src/main/java/org/springframework/integration/stream/StreamClosedEvent.java index 20c885b8ea..691b48b3a8 100644 --- a/spring-integration-stream/src/main/java/org/springframework/integration/stream/StreamClosedEvent.java +++ b/spring-integration-stream/src/main/java/org/springframework/integration/stream/StreamClosedEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2018 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. @@ -16,12 +16,13 @@ package org.springframework.integration.stream; -import org.springframework.integration.event.IntegrationEvent; +import org.springframework.integration.events.IntegrationEvent; /** * Application event published when EOF is detected on a stream. * * @author Gary Russell + * * @since 5.0 * */ diff --git a/spring-integration-test/src/test/java/org/springframework/integration/test/mock/MockMessageSourceTests.java b/spring-integration-test/src/test/java/org/springframework/integration/test/mock/MockMessageSourceTests.java index 9cbc772f64..395ae99b0b 100644 --- a/spring-integration-test/src/test/java/org/springframework/integration/test/mock/MockMessageSourceTests.java +++ b/spring-integration-test/src/test/java/org/springframework/integration/test/mock/MockMessageSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 the original author or authors. + * Copyright 2017-2018 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. @@ -44,7 +44,7 @@ import org.springframework.integration.dsl.PollerSpec; import org.springframework.integration.dsl.Pollers; import org.springframework.integration.dsl.StandardIntegrationFlow; import org.springframework.integration.dsl.context.IntegrationFlowContext; -import org.springframework.integration.dsl.context.IntegrationFlowRegistration; +import org.springframework.integration.dsl.context.IntegrationFlowContext.IntegrationFlowRegistration; import org.springframework.integration.scheduling.PollerMetadata; import org.springframework.integration.test.context.MockIntegrationContext; import org.springframework.integration.test.context.SpringIntegrationTest; diff --git a/src/reference/asciidoc/changes-4.3-5.0.adoc b/src/reference/asciidoc/changes-4.3-5.0.adoc new file mode 100644 index 0000000000..166be5361f --- /dev/null +++ b/src/reference/asciidoc/changes-4.3-5.0.adoc @@ -0,0 +1,312 @@ +[[migration-4.3-5.0]] +=== Changes between 4.3 and 5.0 + +[[x5.0-new-components]] +=== New Components + +==== Java DSL + +The separate https://github.com/spring-projects/spring-integration-java-dsl[Spring Integration Java DSL] project has now been merged into the core Spring Integration project. +The `IntegrationComponentSpec` implementations for channel adapters and gateways are distributed to their specific modules. +See <> for more information about Java DSL support. +Also see the https://github.com/spring-projects/spring-integration/wiki/Spring-Integration-4.3-to-5.0-Migration-Guide#java-dsl[4.3 to 5.0 Migration Guide] for the required steps to move to Spring Integration 5.0. + +==== Testing Support + +A new Spring Integration Test Framework has been created to assist with testing Spring Integration applications. +Now, with the `@SpringIntegrationTest` annotation on test class and `MockIntegration` factory you can make your JUnit tests for integration flows somewhat easier. + +See <> for more information. + +==== MongoDB Outbound Gateway + +The new `MongoDbOutboundGateway` allows you to make queries to the database on demand by sending a message to its request channel. + +See <> for more information. + +==== WebFlux Gateways and Channel Adapters + +The new WebFlux support module has been introduced for Spring WebFlux Framework gateways and channel adapters. + +See <> for more information. + +==== Content Type Conversion + +Now that we use the new `InvocableHandlerMethod` -based infrastructure for service method invocations, we can perform `contentType` conversion from payload to target method argument. + +See <> for more information. + +==== ErrorMessagePublisher and ErrorMessageStrategy + +The `ErrorMessagePublisher` and the `ErrorMessageStrategy` are provided for creating `ErrorMessage` instances. + +See <> for more information. + +==== JDBC Metadata Store + +A JDBC implementation of `MetadataStore` implementation is now provided. +This is useful when it is necessary to ensure transactional boundaries for metadata. + +See <> for more information. + +[[x5.0-general]] +=== General Changes + +Spring Integration is now fully based on Spring Framework `5.0` and Project Reactor `3.1`. +Previous Project Reactor versions are no longer supported. + +==== Core Changes + +The `@Poller` annotation now has the `errorChannel` attribute for easier configuration of the underlying `MessagePublishingErrorHandler`. + +See <> for more information. + +All the request-reply endpoints (based on `AbstractReplyProducingMessageHandler`) can now start transaction and, therefore, make the whole downstream flow transactional. + +See <> for more information. + +The `SmartLifecycleRoleController` now provides methods to obtain status of endpoints in roles. + +See <> for more information. + +POJO methods are now invoked using an `InvocableHandlerMethod` by default, but can be configured to use SpEL as before. + +See <> for more information. + +When targeting POJO methods as message handlers, one of the service methods can now be marked with the `@Default` annotation to provide a fallback mechanism for non-matched conditions. + +See <> for more information. + +A simple `PassThroughTransactionSynchronizationFactory` is provided to always store a polled message in the current transaction context. +That message is used as a `failedMessage` property of the `MessagingException` which wraps a raw exception thrown during transaction completion. + +See <> for more information. + +The aggregator expression-based `ReleaseStrategy` now evaluates the expression against the `MessageGroup` instead of just the collection of `Message`. + +See <> for more information. + +The `ObjectToMapTransformer` can now be supplied with a customised `JsonObjectMapper`. + +See <> for more information. + +The `@GlobalChannelInterceptor` annotation and `` now support negative patterns (via `!` prepending) for component names matching. + +See <> for more information. + +A new `OnFailedToAcquireMutexEvent` is emitted now via `DefaultLeaderEventPublisher` by the `LockRegistryLeaderInitiator`, when candidate is failed to acquire the lock. + +See <> for more information. + +==== Gateway Changes + +The gateway now correctly sets the `errorChannel` header when the gateway method has a `void` return type and an error channel is provided. +Previously, the header was not populated. +This had the effect that synchronous downstream flows (running on the calling thread) would send the exception to the configured channel but an exception on an async downstream flow would be sent to the default `errorChannel` instead. + +The `RequestReplyExchanger` interface now has a `throws MessagingException` clause to meet all the proposed messages exchange contract. + +The request and reply timeouts can now be specified as SpEL expressions. + +See <> for more information. + +==== Aggregator Performance Changes + +Aggregators now use a `SimpleSequenceSizeReleaseStrategy` by default, which is more efficient, especially with large groups. +Empty groups are now scheduled for removal after `empty-group-min-timeout`. + +See <> for more information. + +==== Splitter Changes + +The Splitter component now can handle and split Java `Stream` and Reactive Streams `Publisher` objects. +If the output channel is a `ReactiveStreamsSubscribableChannel`, the `AbstractMessageSplitter` builds a `Flux` for subsequent iteration instead of a regular `Iterator` independent of object being split. +In addition, `AbstractMessageSplitter` provides `protected obtainSizeIfPossible()` methods to allow the determination of the size of the `Iterable` and `Iterator` objects if that is possible. + +See <> for more information. + +==== JMS Changes + +Previously, Spring Integration JMS XML configuration used a default bean name `connectionFactory` for the JMS Connection Factory, allowing the property to be omitted from component definitions. +It has now been renamed to `jmsConnectionFactory`, which is the bean name used by Spring Boot to auto-configure the JMS Connection Factory bean. + +If your application is relying on the previous behavior, rename your `connectionFactory` bean to `jmsConnectionFactory`, or specifically configure your components to use your bean using its current name. + +See <> for more information. + +==== Mail Changes + +Some inconsistencies with rendering IMAP mail content have been resolved. + +See <> for more information. + +==== Feed Changes + +Instead of the `com.rometools.fetcher.FeedFetcher`, which is deprecated in ROME, a new `Resource` property has been introduced to the `FeedEntryMessageSource`. + +See <> for more information. + + +==== File Changes + +The new `FileHeaders.RELATIVE_PATH` Message header has been introduced to represent relative path in the `FileReadingMessageSource`. + +The tail adapter now supports `idleEventInterval` to emit events when there is no data in the file during that period. + +The flush predicates for the `FileWritingMessageHandler` now have an additional parameter. + +The file outbound channel adapter and gateway (`FileWritingMessageHandler`) now support the `REPLACE_IF_MODIFIED` `FileExistsMode`. + +They also now support setting file permissions on the newly written file. + +A new `FileSystemMarkerFilePresentFileListFilter` is now available; see <> for more information. + +The `FileSplitter` now provides a `firstLineAsHeader` option to carry the first line of content as a header in the messages emitted for the remaining lines. + +See <> for more information. + +==== (S)FTP Changes + +The Inbound Channel Adapters now have a property `max-fetch-size` which is used to limit the number of files fetched during a poll when there are no files currently in the local directory. +They also are configured with a `FileSystemPersistentAcceptOnceFileListFilter` in the `local-filter` by default. + +You can also provide a custom `DirectoryScanner` implementation to Inbound Channel Adapters via the newly introduced `scanner` attribute. + +The regex and pattern filters can now be configured to always pass directories. +This can be useful when using recursion in the outbound gateways. + +All the Inbound Channel Adapters (streaming and synchronization-based) now use an appropriate `AbstractPersistentAcceptOnceFileListFilter` implementation by default to prevent remote files duplicate downloads. + +The FTP and SFTP outbound gateways now support the `REPLACE_IF_MODIFIED` `FileExistsMode` when fetching remote files. + +The (S)FTP streaming inbound channel adapters now add remote file information in a message header. + +The FTP and SFTP outbound channel adapters, as well as `PUT` command of the outbound gateways, now support `InputStream` as `payload`, too. + +The inbound channel adapters now can build file tree locally using a newly introduced `RecursiveDirectoryScanner`. +See `scanner` option for injection. +Also these adapters can now be switched to the `WatchService` instead. + +The `NLST` command has been added to the `AbstractRemoteFileOutboundGateway` to perform only list files names remote command. + +The `FtpOutboundGateway` can now be supplied with `workingDirExpression` to change the FTP client working directory for the current request message. + +The `RemoteFileTemplate` is supplied now with the `invoke(OperationsCallback action)` to perform several `RemoteFileOperations` calls in the scope of the same, thread-bounded, `Session`. + +New filters for detecting incomplete remote files are now provided. + +The `FtpOutboundGateway` and `SftpOutboundGateway` now support an option to remove the remote file after a successful transfer using the `GET` or `MGET` commands. + +See <> and <> for more information. + +==== Integration Properties + +Since _version 4.3.2_ a new `spring.integration.readOnly.headers` global property has been added to customize the list of headers which should not be copied to a newly created `Message` by the `MessageBuilder`. + +See <> for more information. + +==== Stream Changes + +There is a new option on the `CharacterStreamReadingMessageSource` to allow it to be used to "pipe" stdin and publish an application event when the pipe is closed. + +See <> for more information. + +==== Barrier Changes + +The `BarrierMessageHandler` now supports a discard channel to which late-arriving trigger messages are sent. + +See <> for more information. + +==== AMQP Changes + +The AMQP outbound endpoints now support setting a delay expression for when using the RabbitMQ Delayed Message Exchange plugin. + +The inbound endpoints now support the Spring AMQP `DirectMessageListenerContainer`. + +Pollable AMQP-backed channels now block the poller thread for the poller's configured `receiveTimeout` (default 1 second). + +Headers, such as `contentType` that are added to message properties by the message converter are now used in the final message; previously, it depended on the converter type as to which headers/message properties appeared in the final message. +To override headers set by the converter, set the `headersMappedLast` property to `true`. + +See <> for more information. + +==== HTTP Changes + +The `DefaultHttpHeaderMapper.userDefinedHeaderPrefix` property is now an empty string by default instead of `X-`. + +See <> for more information. + +==== MQTT Changes + +Inbound messages are now mapped with headers `RECEIVED_TOPIC`, `RECEIVED_QOS` and `RECEIVED_RETAINED` to avoid inadvertent propagation to outbound messages when an application is relaying messages. + +The outbound channel adapter now supports expressions for the topic, qos and retained properties; the defaults remain the same. + +See <> for more information. + +==== STOMP Changes + +The STOMP module has been changed to use `ReactorNettyTcpStompClient`, based on the Project Reactor `3.1` and `reactor-netty` extension. +The `Reactor2TcpStompSessionManager` has been renamed to the `ReactorNettyTcpStompSessionManager` according to the `ReactorNettyTcpStompClient` foundation. + +See <> for more information. + +==== Web Services Changes + +- The `WebServiceOutboundGateway` s can now be supplied with an externally configured `WebServiceTemplate` instances. + +- The `DefaultSoapHeaderMapper` can now map a `javax.xml.transform.Source` user-defined header to a SOAP header element. + +- Simple WebService Inbound and Outbound gateways can now deal with the complete `WebServiceMessage` as a `payload`, allowing the manipulation of MTOM attachments. + +See <> for more information. + +==== Redis Changes + +The `RedisStoreWritingMessageHandler` is supplied now with additional String-based setters for SpEL expressions - for convenience with Java configuration. +The `zsetIncrementExpression` can now be configured on the `RedisStoreWritingMessageHandler`, as well. +In addition this property has been changed from `true` to `false` since `INCR` option on `ZADD` Redis command is optional. + +The `RedisInboundChannelAdapter` can now be supplied with an `Executor` for executing Redis listener invokers. +In addition the received messages now contains a `RedisHeaders.MESSAGE_SOURCE` header to indicate the source of the message - topic or pattern. + +See <> for more information. + +==== TCP Changes + +A new `ThreadAffinityClientConnectionFactory` is provided that binds TCP connections to threads. + +You can now configure the TCP connection factories to support `PushbackInputStream` s, allowing deserializers to "unread" (push back) bytes after "reading ahead". + +A `ByteArrayElasticRawDeserializer` has been added without `maxMessageSize` control and buffer incoming data as needed. + +See <> for more information. + +==== Gemfire Changes + +The `GemfireMetadataStore` now implements `ListenableMetadataStore`, allowing users to listen to cache events by providing `MetadataStoreListener` instances to the store. + +See <> for more information. + +==== Jdbc Changes + +The `JdbcMessageChannelStore` now provides setter for the `ChannelMessageStorePreparedStatementSetter` allowing users to customize a message insertion in the store. + +The `ExpressionEvaluatingSqlParameterSourceFactory` now provides setter for the sqlParameterTypes allowing users to customize sql types of the parameters. + +See <> for more information. + + +==== Metrics Changes + +http://micrometer.io/[Micrometer] application monitoring is now supported (since _version 5.0.2_). +See <> for more information. + +IMPORTANT: Changes were made to the Micrometer `Meters` in _version 5.0.3_ to make them more suitable for use in dimensional systems. +Further changes were made in 5.0.4; if using Micrometer, a minimum of version 5.0.4 is recommended. + + +==== @EndpointId Annotations + +Introduced in _version 5.0.4_, this annotation provides control over bean naming when using Java configuration. +See <> for more information. diff --git a/src/reference/asciidoc/history.adoc b/src/reference/asciidoc/history.adoc index 8459fe488a..6b3c06d80f 100644 --- a/src/reference/asciidoc/history.adoc +++ b/src/reference/asciidoc/history.adoc @@ -2,6 +2,8 @@ == Change History // BE SURE TO PRECEDE ALL include:: with a blank line - see https://github.com/asciidoctor/asciidoctor/issues/1297 +include::./changes-4.3-5.0.adoc[] + include::./changes-4.2-4.3.adoc[] include::./changes-4.1-4.2.adoc[] diff --git a/src/reference/asciidoc/whats-new.adoc b/src/reference/asciidoc/whats-new.adoc index 43ec92b21f..48deb09868 100644 --- a/src/reference/asciidoc/whats-new.adoc +++ b/src/reference/asciidoc/whats-new.adoc @@ -1,317 +1,17 @@ [[whats-new]] -== What's new in Spring Integration 5.0? + +== What's new in Spring Integration 5.1? This chapter provides an overview of the new features and improvements that have been introduced with Spring -Integration 5.0. -If you are interested in more details, please see the Issue Tracker tickets that were resolved as part of the 5.0 -development process. +Integration `5.1`. +If you are interested in more details, please see the Issue Tracker tickets that were resolved as part of the 5.1 development process. -[[x5.0-new-components]] +[[x5.1-new-components]] === New Components +[[x5.1-general]] +=== General Changes + ==== Java DSL -The separate https://github.com/spring-projects/spring-integration-java-dsl[Spring Integration Java DSL] project has now been merged into the core Spring Integration project. -The `IntegrationComponentSpec` implementations for channel adapters and gateways are distributed to their specific modules. -See <> for more information about Java DSL support. -Also see the https://github.com/spring-projects/spring-integration/wiki/Spring-Integration-4.3-to-5.0-Migration-Guide#java-dsl[4.3 to 5.0 Migration Guide] for the required steps to move to Spring Integration 5.0. - -==== Testing Support - -A new Spring Integration Test Framework has been created to assist with testing Spring Integration applications. -Now, with the `@SpringIntegrationTest` annotation on test class and `MockIntegration` factory you can make your JUnit tests for integration flows somewhat easier. - -See <> for more information. - -==== MongoDB Outbound Gateway - -The new `MongoDbOutboundGateway` allows you to make queries to the database on demand by sending a message to its request channel. - -See <> for more information. - -==== WebFlux Gateways and Channel Adapters - -The new WebFlux support module has been introduced for Spring WebFlux Framework gateways and channel adapters. - -See <> for more information. - -==== Content Type Conversion - -Now that we use the new `InvocableHandlerMethod` -based infrastructure for service method invocations, we can perform `contentType` conversion from payload to target method argument. - -See <> for more information. - -==== ErrorMessagePublisher and ErrorMessageStrategy - -The `ErrorMessagePublisher` and the `ErrorMessageStrategy` are provided for creating `ErrorMessage` instances. - -See <> for more information. - -==== JDBC Metadata Store - -A JDBC implementation of `MetadataStore` implementation is now provided. -This is useful when it is necessary to ensure transactional boundaries for metadata. - -See <> for more information. - -[[x5.0-general]] -=== General Changes - -Spring Integration is now fully based on Spring Framework `5.0` and Project Reactor `3.1`. -Previous Project Reactor versions are no longer supported. - -==== Core Changes - -The `@Poller` annotation now has the `errorChannel` attribute for easier configuration of the underlying `MessagePublishingErrorHandler`. - -See <> for more information. - -All the request-reply endpoints (based on `AbstractReplyProducingMessageHandler`) can now start transaction and, therefore, make the whole downstream flow transactional. - -See <> for more information. - -The `SmartLifecycleRoleController` now provides methods to obtain status of endpoints in roles. - -See <> for more information. - -POJO methods are now invoked using an `InvocableHandlerMethod` by default, but can be configured to use SpEL as before. - -See <> for more information. - -When targeting POJO methods as message handlers, one of the service methods can now be marked with the `@Default` annotation to provide a fallback mechanism for non-matched conditions. - -See <> for more information. - -A simple `PassThroughTransactionSynchronizationFactory` is provided to always store a polled message in the current transaction context. -That message is used as a `failedMessage` property of the `MessagingException` which wraps a raw exception thrown during transaction completion. - -See <> for more information. - -The aggregator expression-based `ReleaseStrategy` now evaluates the expression against the `MessageGroup` instead of just the collection of `Message`. - -See <> for more information. - -The `ObjectToMapTransformer` can now be supplied with a customised `JsonObjectMapper`. - -See <> for more information. - -The `@GlobalChannelInterceptor` annotation and `` now support negative patterns (via `!` prepending) for component names matching. - -See <> for more information. - -A new `OnFailedToAcquireMutexEvent` is emitted now via `DefaultLeaderEventPublisher` by the `LockRegistryLeaderInitiator`, when candidate is failed to acquire the lock. - -See <> for more information. - -==== Gateway Changes - -The gateway now correctly sets the `errorChannel` header when the gateway method has a `void` return type and an error channel is provided. -Previously, the header was not populated. -This had the effect that synchronous downstream flows (running on the calling thread) would send the exception to the configured channel but an exception on an async downstream flow would be sent to the default `errorChannel` instead. - -The `RequestReplyExchanger` interface now has a `throws MessagingException` clause to meet all the proposed messages exchange contract. - -The request and reply timeouts can now be specified as SpEL expressions. - -See <> for more information. - -==== Aggregator Performance Changes - -Aggregators now use a `SimpleSequenceSizeReleaseStrategy` by default, which is more efficient, especially with large groups. -Empty groups are now scheduled for removal after `empty-group-min-timeout`. - -See <> for more information. - -==== Splitter Changes - -The Splitter component now can handle and split Java `Stream` and Reactive Streams `Publisher` objects. -If the output channel is a `ReactiveStreamsSubscribableChannel`, the `AbstractMessageSplitter` builds a `Flux` for subsequent iteration instead of a regular `Iterator` independent of object being split. -In addition, `AbstractMessageSplitter` provides `protected obtainSizeIfPossible()` methods to allow the determination of the size of the `Iterable` and `Iterator` objects if that is possible. - -See <> for more information. - -==== JMS Changes - -Previously, Spring Integration JMS XML configuration used a default bean name `connectionFactory` for the JMS Connection Factory, allowing the property to be omitted from component definitions. -It has now been renamed to `jmsConnectionFactory`, which is the bean name used by Spring Boot to auto-configure the JMS Connection Factory bean. - -If your application is relying on the previous behavior, rename your `connectionFactory` bean to `jmsConnectionFactory`, or specifically configure your components to use your bean using its current name. - -See <> for more information. - -==== Mail Changes - -Some inconsistencies with rendering IMAP mail content have been resolved. - -See <> for more information. - -==== Feed Changes - -Instead of the `com.rometools.fetcher.FeedFetcher`, which is deprecated in ROME, a new `Resource` property has been introduced to the `FeedEntryMessageSource`. - -See <> for more information. - - -==== File Changes - -The new `FileHeaders.RELATIVE_PATH` Message header has been introduced to represent relative path in the `FileReadingMessageSource`. - -The tail adapter now supports `idleEventInterval` to emit events when there is no data in the file during that period. - -The flush predicates for the `FileWritingMessageHandler` now have an additional parameter. - -The file outbound channel adapter and gateway (`FileWritingMessageHandler`) now support the `REPLACE_IF_MODIFIED` `FileExistsMode`. - -They also now support setting file permissions on the newly written file. - -A new `FileSystemMarkerFilePresentFileListFilter` is now available; see <> for more information. - -The `FileSplitter` now provides a `firstLineAsHeader` option to carry the first line of content as a header in the messages emitted for the remaining lines. - -See <> for more information. - -==== (S)FTP Changes - -The Inbound Channel Adapters now have a property `max-fetch-size` which is used to limit the number of files fetched during a poll when there are no files currently in the local directory. -They also are configured with a `FileSystemPersistentAcceptOnceFileListFilter` in the `local-filter` by default. - -You can also provide a custom `DirectoryScanner` implementation to Inbound Channel Adapters via the newly introduced `scanner` attribute. - -The regex and pattern filters can now be configured to always pass directories. -This can be useful when using recursion in the outbound gateways. - -All the Inbound Channel Adapters (streaming and synchronization-based) now use an appropriate `AbstractPersistentAcceptOnceFileListFilter` implementation by default to prevent remote files duplicate downloads. - -The FTP and SFTP outbound gateways now support the `REPLACE_IF_MODIFIED` `FileExistsMode` when fetching remote files. - -The (S)FTP streaming inbound channel adapters now add remote file information in a message header. - -The FTP and SFTP outbound channel adapters, as well as `PUT` command of the outbound gateways, now support `InputStream` as `payload`, too. - -The inbound channel adapters now can build file tree locally using a newly introduced `RecursiveDirectoryScanner`. -See `scanner` option for injection. -Also these adapters can now be switched to the `WatchService` instead. - -The `NLST` command has been added to the `AbstractRemoteFileOutboundGateway` to perform only list files names remote command. - -The `FtpOutboundGateway` can now be supplied with `workingDirExpression` to change the FTP client working directory for the current request message. - -The `RemoteFileTemplate` is supplied now with the `invoke(OperationsCallback action)` to perform several `RemoteFileOperations` calls in the scope of the same, thread-bounded, `Session`. - -New filters for detecting incomplete remote files are now provided. - -The `FtpOutboundGateway` and `SftpOutboundGateway` now support an option to remove the remote file after a successful transfer using the `GET` or `MGET` commands. - -See <> and <> for more information. - -==== Integration Properties - -Since _version 4.3.2_ a new `spring.integration.readOnly.headers` global property has been added to customize the list of headers which should not be copied to a newly created `Message` by the `MessageBuilder`. - -See <> for more information. - -==== Stream Changes - -There is a new option on the `CharacterStreamReadingMessageSource` to allow it to be used to "pipe" stdin and publish an application event when the pipe is closed. - -See <> for more information. - -==== Barrier Changes - -The `BarrierMessageHandler` now supports a discard channel to which late-arriving trigger messages are sent. - -See <> for more information. - -==== AMQP Changes - -The AMQP outbound endpoints now support setting a delay expression for when using the RabbitMQ Delayed Message Exchange plugin. - -The inbound endpoints now support the Spring AMQP `DirectMessageListenerContainer`. - -Pollable AMQP-backed channels now block the poller thread for the poller's configured `receiveTimeout` (default 1 second). - -Headers, such as `contentType` that are added to message properties by the message converter are now used in the final message; previously, it depended on the converter type as to which headers/message properties appeared in the final message. -To override headers set by the converter, set the `headersMappedLast` property to `true`. - -See <> for more information. - -==== HTTP Changes - -The `DefaultHttpHeaderMapper.userDefinedHeaderPrefix` property is now an empty string by default instead of `X-`. - -See <> for more information. - -==== MQTT Changes - -Inbound messages are now mapped with headers `RECEIVED_TOPIC`, `RECEIVED_QOS` and `RECEIVED_RETAINED` to avoid inadvertent propagation to outbound messages when an application is relaying messages. - -The outbound channel adapter now supports expressions for the topic, qos and retained properties; the defaults remain the same. - -See <> for more information. - -==== STOMP Changes - -The STOMP module has been changed to use `ReactorNettyTcpStompClient`, based on the Project Reactor `3.1` and `reactor-netty` extension. -The `Reactor2TcpStompSessionManager` has been renamed to the `ReactorNettyTcpStompSessionManager` according to the `ReactorNettyTcpStompClient` foundation. - -See <> for more information. - -==== Web Services Changes - -- The `WebServiceOutboundGateway` s can now be supplied with an externally configured `WebServiceTemplate` instances. - -- The `DefaultSoapHeaderMapper` can now map a `javax.xml.transform.Source` user-defined header to a SOAP header element. - -- Simple WebService Inbound and Outbound gateways can now deal with the complete `WebServiceMessage` as a `payload`, allowing the manipulation of MTOM attachments. - -See <> for more information. - -==== Redis Changes - -The `RedisStoreWritingMessageHandler` is supplied now with additional String-based setters for SpEL expressions - for convenience with Java configuration. -The `zsetIncrementExpression` can now be configured on the `RedisStoreWritingMessageHandler`, as well. -In addition this property has been changed from `true` to `false` since `INCR` option on `ZADD` Redis command is optional. - -The `RedisInboundChannelAdapter` can now be supplied with an `Executor` for executing Redis listener invokers. -In addition the received messages now contains a `RedisHeaders.MESSAGE_SOURCE` header to indicate the source of the message - topic or pattern. - -See <> for more information. - -==== TCP Changes - -A new `ThreadAffinityClientConnectionFactory` is provided that binds TCP connections to threads. - -You can now configure the TCP connection factories to support `PushbackInputStream` s, allowing deserializers to "unread" (push back) bytes after "reading ahead". - -A `ByteArrayElasticRawDeserializer` has been added without `maxMessageSize` control and buffer incoming data as needed. - -See <> for more information. - -==== Gemfire Changes - -The `GemfireMetadataStore` now implements `ListenableMetadataStore`, allowing users to listen to cache events by providing `MetadataStoreListener` instances to the store. - -See <> for more information. - -==== Jdbc Changes - -The `JdbcMessageChannelStore` now provides setter for the `ChannelMessageStorePreparedStatementSetter` allowing users to customize a message insertion in the store. - -The `ExpressionEvaluatingSqlParameterSourceFactory` now provides setter for the sqlParameterTypes allowing users to customize sql types of the parameters. - -See <> for more information. - - -==== Metrics Changes - -http://micrometer.io/[Micrometer] application monitoring is now supported (since _version 5.0.2_). -See <> for more information. - -IMPORTANT: Changes were made to the Micrometer `Meters` in _version 5.0.3_ to make them more suitable for use in dimensional systems. -Further changes were made in 5.0.4; if using Micrometer, a minimum of version 5.0.4 is recommended. - - -==== @EndpointId Annotations - -Introduced in _version 5.0.4_, this annotation provides control over bean naming when using Java configuration. -See <> for more information. +The `IntegrationFlowContext` is now an interface and `IntegrationFlowRegistration` is an inner interface of the `IntegrationFlowContext`.