INT-4392: Fix tangles

JIRA: https://jira.spring.io/browse/INT-4392
JIRA: https://jira.spring.io/browse/INT-4391
JIRA: https://jira.spring.io/browse/INT-4393

Resolve class and leaf package tangles in:

- core (except DSL)
- file
- http

- move `StaticMessageHeaderAccessor` to root `integration` package
- move acknowledgment related classes to a new `acks` package
- move `MMIH` to `handler.support`, alongside argument resolvers, also `HandlerMethodArgumentResolversHolder`
- move `ErrorMessagePublisher` to `core`
- move `PatternMatchUtils` to `support.utils`
- move `MessageSourceManagement` to `support.management`
- remove direct reference to `MicrometerMetricsCapter` from `IntegrationManagementSupport`
- add new class `MetricsCaptorLoader`

- move `OperationsCallback` to inner interface in `RemoteFileOperations`

- move `HttpContextUtils` to `config`

* Simplify MetricsCaptor loading.

* Polishing
This commit is contained in:
Gary Russell
2018-03-13 11:22:56 -04:00
committed by Artem Bilan
parent 525eb004ec
commit 4552a80095
52 changed files with 111 additions and 115 deletions

View File

@@ -29,6 +29,7 @@ import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.amqp.support.converter.SimpleMessageConverter;
import org.springframework.core.AttributeAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.StaticMessageHeaderAccessor;
import org.springframework.integration.amqp.support.AmqpHeaderMapper;
import org.springframework.integration.amqp.support.AmqpMessageHeaderErrorMessageStrategy;
import org.springframework.integration.amqp.support.DefaultAmqpHeaderMapper;
@@ -36,7 +37,6 @@ import org.springframework.integration.context.OrderlyShutdownCapable;
import org.springframework.integration.endpoint.MessageProducerSupport;
import org.springframework.integration.support.ErrorMessageStrategy;
import org.springframework.integration.support.ErrorMessageUtils;
import org.springframework.integration.support.StaticMessageHeaderAccessor;
import org.springframework.retry.RecoveryCallback;
import org.springframework.retry.RetryCallback;
import org.springframework.retry.RetryContext;

View File

@@ -34,13 +34,13 @@ import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.amqp.support.converter.SimpleMessageConverter;
import org.springframework.core.AttributeAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.StaticMessageHeaderAccessor;
import org.springframework.integration.amqp.support.AmqpHeaderMapper;
import org.springframework.integration.amqp.support.AmqpMessageHeaderErrorMessageStrategy;
import org.springframework.integration.amqp.support.DefaultAmqpHeaderMapper;
import org.springframework.integration.gateway.MessagingGatewaySupport;
import org.springframework.integration.support.ErrorMessageStrategy;
import org.springframework.integration.support.ErrorMessageUtils;
import org.springframework.integration.support.StaticMessageHeaderAccessor;
import org.springframework.retry.RecoveryCallback;
import org.springframework.retry.RetryCallback;
import org.springframework.retry.RetryContext;

View File

@@ -31,13 +31,13 @@ import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.amqp.support.converter.SimpleMessageConverter;
import org.springframework.context.MessageSource;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.acks.AcknowledgmentCallback;
import org.springframework.integration.acks.AcknowledgmentCallbackFactory;
import org.springframework.integration.amqp.support.AmqpHeaderMapper;
import org.springframework.integration.amqp.support.AmqpMessageHeaderErrorMessageStrategy;
import org.springframework.integration.amqp.support.DefaultAmqpHeaderMapper;
import org.springframework.integration.endpoint.AbstractMessageSource;
import org.springframework.integration.support.AbstractIntegrationMessageBuilder;
import org.springframework.integration.support.AcknowledgmentCallback;
import org.springframework.integration.support.AcknowledgmentCallbackFactory;
import org.springframework.util.Assert;
import com.rabbitmq.client.Channel;

View File

@@ -49,6 +49,8 @@ import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.acks.AcknowledgmentCallback;
import org.springframework.integration.acks.AcknowledgmentCallback.Status;
import org.springframework.integration.amqp.dsl.Amqp;
import org.springframework.integration.annotation.InboundChannelAdapter;
import org.springframework.integration.annotation.Poller;
@@ -58,8 +60,6 @@ import org.springframework.integration.core.MessageSource;
import org.springframework.integration.dsl.IntegrationFlow;
import org.springframework.integration.dsl.IntegrationFlows;
import org.springframework.integration.dsl.Pollers;
import org.springframework.integration.support.AcknowledgmentCallback;
import org.springframework.integration.support.AcknowledgmentCallback.Status;
import org.springframework.messaging.handler.annotation.Header;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.test.annotation.DirtiesContext;

View File

@@ -34,9 +34,9 @@ import org.junit.Test;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
import org.springframework.amqp.support.AmqpHeaders;
import org.springframework.integration.StaticMessageHeaderAccessor;
import org.springframework.integration.acks.AcknowledgmentCallback.Status;
import org.springframework.integration.amqp.support.AmqpMessageHeaderErrorMessageStrategy;
import org.springframework.integration.support.AcknowledgmentCallback.Status;
import org.springframework.integration.support.StaticMessageHeaderAccessor;
import org.springframework.messaging.Message;
import com.rabbitmq.client.AMQP.BasicProperties;

View File

@@ -58,6 +58,7 @@ import org.springframework.amqp.support.converter.MessageConversionException;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.amqp.support.converter.SimpleMessageConverter;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.integration.StaticMessageHeaderAccessor;
import org.springframework.integration.amqp.support.AmqpMessageHeaderErrorMessageStrategy;
import org.springframework.integration.amqp.support.DefaultAmqpHeaderMapper;
import org.springframework.integration.channel.DirectChannel;
@@ -67,7 +68,6 @@ import org.springframework.integration.json.JsonToObjectTransformer;
import org.springframework.integration.json.ObjectToJsonTransformer;
import org.springframework.integration.mapping.support.JsonHeaders;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.integration.support.StaticMessageHeaderAccessor;
import org.springframework.integration.transformer.MessageTransformingHandler;
import org.springframework.integration.transformer.Transformer;
import org.springframework.messaging.Message;

View File

@@ -24,7 +24,7 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import org.springframework.integration.support.AcknowledgmentCallback;
import org.springframework.integration.acks.AcknowledgmentCallback;
import org.springframework.lang.Nullable;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHeaders;

View File

@@ -14,13 +14,13 @@
* limitations under the License.
*/
package org.springframework.integration.support;
package org.springframework.integration;
import java.io.Closeable;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.acks.AcknowledgmentCallback;
import org.springframework.lang.Nullable;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHeaders;

View File

@@ -14,9 +14,9 @@
* limitations under the License.
*/
package org.springframework.integration.support;
package org.springframework.integration.acks;
import org.springframework.integration.support.AcknowledgmentCallback.Status;
import org.springframework.integration.acks.AcknowledgmentCallback.Status;
import org.springframework.lang.Nullable;
import org.springframework.messaging.Message;
@@ -37,10 +37,12 @@ public final class AckUtils {
* Return the {@link AcknowledgmentCallback} header (if present).
* @param message the message.
* @return the callback, or null.
* @deprecated use StaticMessageHeaderAccessor.getAcknowledgmentCallback(message).
*/
@Deprecated
@Nullable
public static AcknowledgmentCallback getAckCallback(Message<?> message) {
return StaticMessageHeaderAccessor.getAcknowledgmentCallback(message);
throw new UnsupportedOperationException("Use StaticMessageHeaderAccessor.getAcknowledgmentCallback(message)");
}
/**

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.support;
package org.springframework.integration.acks;
/**
* A general abstraction over acknowledgments.

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.support;
package org.springframework.integration.acks;
/**
* A factory for creating {@link AcknowledgmentCallback}s.

View File

@@ -0,0 +1,4 @@
/**
* Provides classes related to message acknowledgment.
*/
package org.springframework.integration.acks;

View File

@@ -23,8 +23,8 @@ import java.util.Map;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.Lifecycle;
import org.springframework.integration.handler.support.MessagingMethodInvokerHelper;
import org.springframework.integration.util.AbstractExpressionEvaluator;
import org.springframework.integration.util.MessagingMethodInvokerHelper;
import org.springframework.messaging.Message;
/**

View File

@@ -17,7 +17,7 @@
package org.springframework.integration.channel;
import org.springframework.integration.context.IntegrationContextUtils;
import org.springframework.integration.support.ErrorMessagePublisher;
import org.springframework.integration.core.ErrorMessagePublisher;
import org.springframework.integration.support.ErrorMessageStrategy;
import org.springframework.integration.support.MessagingExceptionWrapper;
import org.springframework.messaging.Message;

View File

@@ -49,7 +49,7 @@ public @interface GlobalChannelInterceptor {
* A leading '!' negates the pattern match.
* Default is "*" (all channels).
* @return The pattern.
* @see org.springframework.integration.util.PatternMatchUtils#smartMatch(String, String...)
* @see org.springframework.integration.support.utils.PatternMatchUtils#smartMatch(String, String...)
*/
String[] patterns() default "*";

View File

@@ -41,7 +41,7 @@ import org.springframework.integration.channel.interceptor.GlobalChannelIntercep
import org.springframework.integration.channel.interceptor.VetoCapableInterceptor;
import org.springframework.integration.context.IntegrationContextUtils;
import org.springframework.integration.context.IntegrationProperties;
import org.springframework.integration.util.PatternMatchUtils;
import org.springframework.integration.support.utils.PatternMatchUtils;
import org.springframework.messaging.support.ChannelInterceptor;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;

View File

@@ -49,6 +49,7 @@ import org.springframework.integration.config.annotation.MessagingAnnotationPost
import org.springframework.integration.context.IntegrationContextUtils;
import org.springframework.integration.context.IntegrationProperties;
import org.springframework.integration.handler.support.CollectionArgumentResolver;
import org.springframework.integration.handler.support.HandlerMethodArgumentResolversHolder;
import org.springframework.integration.handler.support.MapArgumentResolver;
import org.springframework.integration.handler.support.PayloadExpressionArgumentResolver;
import org.springframework.integration.handler.support.PayloadsArgumentResolver;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.support;
package org.springframework.integration.core;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -23,7 +23,9 @@ import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.core.AttributeAccessor;
import org.springframework.integration.context.IntegrationContextUtils;
import org.springframework.integration.core.MessagingTemplate;
import org.springframework.integration.support.DefaultErrorMessageStrategy;
import org.springframework.integration.support.ErrorMessageStrategy;
import org.springframework.integration.support.ErrorMessageUtils;
import org.springframework.integration.support.channel.BeanFactoryChannelResolver;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;

View File

@@ -16,6 +16,8 @@
package org.springframework.integration.endpoint;
import org.springframework.integration.support.management.MessageSourceManagement;
/**
* A message source that can limit the number of remote objects it fetches.
*

View File

@@ -16,9 +16,10 @@
package org.springframework.integration.endpoint;
import org.springframework.integration.StaticMessageHeaderAccessor;
import org.springframework.integration.acks.AckUtils;
import org.springframework.integration.acks.AcknowledgmentCallback;
import org.springframework.integration.core.MessageSource;
import org.springframework.integration.support.AckUtils;
import org.springframework.integration.support.AcknowledgmentCallback;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.MessageHandlingException;
@@ -48,7 +49,7 @@ public class MessageSourcePollingTemplate implements PollingOperations {
Assert.notNull(handler, "'handler' cannot be null");
Message<?> message = this.source.receive();
if (message != null) {
AcknowledgmentCallback ackCallback = AckUtils.getAckCallback(message);
AcknowledgmentCallback ackCallback = StaticMessageHeaderAccessor.getAcknowledgmentCallback(message);
try {
handler.handleMessage(message);
AckUtils.autoAck(ackCallback);

View File

@@ -27,14 +27,14 @@ import org.springframework.aop.support.AopUtils;
import org.springframework.aop.support.NameMatchMethodPointcutAdvisor;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.context.Lifecycle;
import org.springframework.integration.StaticMessageHeaderAccessor;
import org.springframework.integration.acks.AckUtils;
import org.springframework.integration.acks.AcknowledgmentCallback;
import org.springframework.integration.aop.AbstractMessageSourceAdvice;
import org.springframework.integration.context.ExpressionCapable;
import org.springframework.integration.core.MessageSource;
import org.springframework.integration.core.MessagingTemplate;
import org.springframework.integration.history.MessageHistory;
import org.springframework.integration.support.AckUtils;
import org.springframework.integration.support.AcknowledgmentCallback;
import org.springframework.integration.support.StaticMessageHeaderAccessor;
import org.springframework.integration.support.context.NamedComponent;
import org.springframework.integration.support.management.TrackableComponent;
import org.springframework.integration.transaction.IntegrationResourceHolder;

View File

@@ -22,7 +22,7 @@ import java.lang.reflect.Method;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.Lifecycle;
import org.springframework.core.convert.ConversionService;
import org.springframework.integration.util.MessagingMethodInvokerHelper;
import org.springframework.integration.handler.support.MessagingMethodInvokerHelper;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHandlingException;

View File

@@ -17,8 +17,8 @@
package org.springframework.integration.handler.advice;
import org.springframework.core.AttributeAccessor;
import org.springframework.integration.core.ErrorMessagePublisher;
import org.springframework.integration.support.DefaultErrorMessageStrategy;
import org.springframework.integration.support.ErrorMessagePublisher;
import org.springframework.integration.support.ErrorMessageStrategy;
import org.springframework.integration.support.ErrorMessageUtils;
import org.springframework.messaging.Message;

View File

@@ -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.config;
package org.springframework.integration.handler.support;
import java.util.ArrayList;
import java.util.Collections;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.util;
package org.springframework.integration.handler.support;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
@@ -70,15 +70,16 @@ import org.springframework.integration.annotation.Default;
import org.springframework.integration.annotation.Payloads;
import org.springframework.integration.annotation.ServiceActivator;
import org.springframework.integration.annotation.UseSpelInvoker;
import org.springframework.integration.config.HandlerMethodArgumentResolversHolder;
import org.springframework.integration.context.IntegrationContextUtils;
import org.springframework.integration.handler.support.CollectionArgumentResolver;
import org.springframework.integration.handler.support.MapArgumentResolver;
import org.springframework.integration.handler.support.PayloadExpressionArgumentResolver;
import org.springframework.integration.handler.support.PayloadsArgumentResolver;
import org.springframework.integration.support.MutableMessage;
import org.springframework.integration.support.json.JsonObjectMapper;
import org.springframework.integration.support.json.JsonObjectMapperProvider;
import org.springframework.integration.util.AbstractExpressionEvaluator;
import org.springframework.integration.util.AnnotatedMethodFilter;
import org.springframework.integration.util.ClassUtils;
import org.springframework.integration.util.FixedMethodFilter;
import org.springframework.integration.util.MessagingAnnotationUtils;
import org.springframework.integration.util.UniqueMethodFilter;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHandlingException;
import org.springframework.messaging.MessageHeaders;

View File

@@ -16,6 +16,7 @@
package org.springframework.integration.support.management;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
@@ -32,8 +33,7 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.integration.core.MessageSource;
import org.springframework.integration.support.management.IntegrationManagement.ManagementOverrides;
import org.springframework.integration.support.management.micrometer.MicrometerMetricsCaptor;
import org.springframework.integration.util.PatternMatchUtils;
import org.springframework.integration.support.utils.PatternMatchUtils;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.MessageHandler;
import org.springframework.util.Assert;
@@ -212,9 +212,20 @@ public class IntegrationManagementConfigurer implements SmartInitializingSinglet
Assert.state(this.applicationContext != null, "'applicationContext' must not be null");
Assert.state(MANAGEMENT_CONFIGURER_NAME.equals(this.beanName), getClass().getSimpleName()
+ " bean name must be " + MANAGEMENT_CONFIGURER_NAME);
ClassLoader classLoader = IntegrationManagementConfigurer.class.getClassLoader();
if (ClassUtils.isPresent("io.micrometer.core.instrument.MeterRegistry",
IntegrationManagementConfigurer.class.getClassLoader())) {
this.metricsCaptor = MicrometerMetricsCaptor.loadCaptor(this.applicationContext);
classLoader)) {
try {
// Use reflection to avoid a package tangle with ...management.micrometer
Class<?> captor = ClassUtils.forName(
"org.springframework.integration.support.management.micrometer.MicrometerMetricsCaptor",
classLoader);
Method method = captor.getDeclaredMethod("loadCaptor", ApplicationContext.class);
this.metricsCaptor = (MetricsCaptor) method.invoke(null, this.applicationContext);
}
catch (Exception e) {
// no op
}
}
if (this.metricsCaptor != null) {
injectCaptor();

View File

@@ -17,7 +17,6 @@
package org.springframework.integration.support.management;
import org.springframework.context.Lifecycle;
import org.springframework.integration.endpoint.MessageSourceManagement;
/**
* An extension to {@link LifecycleMessageSourceMetrics} for sources that implement {@link MessageSourceManagement}.

View File

@@ -17,7 +17,6 @@
package org.springframework.integration.support.management;
import org.springframework.context.Lifecycle;
import org.springframework.integration.endpoint.MessageSourceManagement;
/**
* An extension to {@link LifecycleTrackableMessageSourceMetrics} for sources

View File

@@ -14,10 +14,8 @@
* limitations under the License.
*/
package org.springframework.integration.endpoint;
package org.springframework.integration.support.management;
import org.springframework.integration.support.management.IntegrationManagedResource;
import org.springframework.integration.support.management.MessageSourceMetrics;
import org.springframework.jmx.export.annotation.ManagedAttribute;
/**

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.util;
package org.springframework.integration.support.utils;
/**
* Utility methods for pattern matching.

View File

@@ -20,7 +20,7 @@ import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.InputStream;
import org.springframework.integration.support.StaticMessageHeaderAccessor;
import org.springframework.integration.StaticMessageHeaderAccessor;
import org.springframework.messaging.Message;
import org.springframework.util.Assert;
import org.springframework.util.FileCopyUtils;

View File

@@ -55,11 +55,11 @@ import org.springframework.integration.aggregator.ReleaseStrategy;
import org.springframework.integration.aggregator.SimpleMessageGroupProcessor;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.endpoint.EventDrivenConsumer;
import org.springframework.integration.handler.support.MessagingMethodInvokerHelper;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.integration.support.locks.LockRegistry;
import org.springframework.integration.support.utils.IntegrationUtils;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.integration.util.MessagingMethodInvokerHelper;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.PollableChannel;

View File

@@ -29,9 +29,9 @@ import java.util.Collections;
import org.junit.Test;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.acks.AcknowledgmentCallback;
import org.springframework.integration.acks.AcknowledgmentCallback.Status;
import org.springframework.integration.core.MessageSource;
import org.springframework.integration.support.AcknowledgmentCallback;
import org.springframework.integration.support.AcknowledgmentCallback.Status;
import org.springframework.messaging.MessageHandlingException;
import org.springframework.messaging.support.GenericMessage;

View File

@@ -73,9 +73,9 @@ import org.springframework.integration.annotation.UseSpelInvoker;
import org.springframework.integration.config.EnableIntegration;
import org.springframework.integration.gateway.GatewayProxyFactoryBean;
import org.springframework.integration.gateway.RequestReplyExchanger;
import org.springframework.integration.handler.support.MessagingMethodInvokerHelper;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.integration.util.MessagingMethodInvokerHelper;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.MessageHandlingException;

View File

@@ -238,7 +238,7 @@ public abstract class RemoteFileInboundChannelAdapterSpec<F, S extends RemoteFil
* running, to avoid one instance from "grabbing" all the files.
* @param maxFetchSize the max fetch size.
* @return the spec.
* @see org.springframework.integration.endpoint.MessageSourceManagement#setMaxFetchSize(int)
* @see org.springframework.integration.support.management.MessageSourceManagement#setMaxFetchSize(int)
*/
public S maxFetchSize(int maxFetchSize) {
this.target.setMaxFetchSize(maxFetchSize);

View File

@@ -132,7 +132,7 @@ public abstract class RemoteFileStreamingInboundChannelAdapterSpec<F,
* running, to avoid one instance from "grabbing" all the files.
* @param maxFetchSize the max fetch size.
* @return the spec.
* @see org.springframework.integration.endpoint.MessageSourceManagement#setMaxFetchSize(int)
* @see org.springframework.integration.support.management.MessageSourceManagement#setMaxFetchSize(int)
*/
public S maxFetchSize(int maxFetchSize) {
this.target.setMaxFetchSize(maxFetchSize);

View File

@@ -1,44 +0,0 @@
/*
* Copyright 2017 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.file.remote;
/**
* Callback for using the same session for multiple
* RemoteFileTemplate operations.
* @param <F> the type the operations accepts.
* @param <T> the type the callback returns.
*
* @author Artem Bilan
*
* @since 5.0
*/
@FunctionalInterface
public interface OperationsCallback<F, T> {
/**
* Execute any number of operations using a dedicated remote
* session as long as those operations are performed
* on the template argument and on the calling thread.
* The session will be closed when the callback exits.
*
* @param operations the RemoteFileOperations.
* @return the result of operations.
*/
T doInOperations(RemoteFileOperations<F> operations);
}

View File

@@ -167,4 +167,29 @@ public interface RemoteFileOperations<F> {
*/
Session<F> getSession();
/**
* Callback for using the same session for multiple
* RemoteFileTemplate operations.
* @param <F> the type the operations accepts.
* @param <T> the type the callback returns.
*
* @since 5.1
*/
@FunctionalInterface
public interface OperationsCallback<F, T> {
/**
* Execute any number of operations using a dedicated remote
* session as long as those operations are performed
* on the template argument and on the calling thread.
* The session will be closed when the callback exits.
*
* @param operations the RemoteFileOperations.
* @return the result of operations.
*/
T doInOperations(RemoteFileOperations<F> operations);
}
}

View File

@@ -34,11 +34,11 @@ import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import org.springframework.integration.StaticMessageHeaderAccessor;
import org.springframework.integration.file.FileHeaders;
import org.springframework.integration.file.splitter.FileSplitter.FileMarker.Mark;
import org.springframework.integration.splitter.AbstractMessageSplitter;
import org.springframework.integration.support.AbstractIntegrationMessageBuilder;
import org.springframework.integration.support.StaticMessageHeaderAccessor;
import org.springframework.integration.support.json.JsonObjectMapper;
import org.springframework.integration.support.json.JsonObjectMapperProvider;
import org.springframework.messaging.Message;

View File

@@ -41,13 +41,13 @@ import org.junit.rules.ExpectedException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.StaticMessageHeaderAccessor;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.file.FileHeaders;
import org.springframework.integration.file.filters.AcceptOnceFileListFilter;
import org.springframework.integration.file.remote.session.Session;
import org.springframework.integration.file.remote.session.SessionFactory;
import org.springframework.integration.file.splitter.FileSplitter;
import org.springframework.integration.support.StaticMessageHeaderAccessor;
import org.springframework.integration.transformer.StreamTransformer;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessagingException;

View File

@@ -25,7 +25,6 @@ import java.lang.annotation.Target;
import org.springframework.context.annotation.Import;
import org.springframework.core.annotation.AliasFor;
import org.springframework.integration.http.management.IntegrationGraphController;
import org.springframework.integration.http.support.HttpContextUtils;
/**
* Enables the {@link IntegrationGraphController} if

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.http.support;
package org.springframework.integration.http.config;
import java.util.HashMap;
import java.util.Map;

View File

@@ -27,7 +27,6 @@ import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.integration.config.IntegrationConfigurationInitializer;
import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
import org.springframework.integration.http.inbound.IntegrationRequestMappingHandlerMapping;
import org.springframework.integration.http.support.HttpContextUtils;
/**
* The HTTP Integration infrastructure {@code beanFactory} initializer.

View File

@@ -25,7 +25,6 @@ import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.xml.BeanDefinitionParser;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.core.type.StandardAnnotationMetadata;
import org.springframework.integration.http.support.HttpContextUtils;
/**
* The {@link BeanDefinitionParser} for the {@code <int-http:graph-controller>} component.

View File

@@ -37,7 +37,6 @@ import org.springframework.core.env.MapPropertySource;
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.integration.context.IntegrationContextUtils;
import org.springframework.integration.http.management.IntegrationGraphController;
import org.springframework.integration.http.support.HttpContextUtils;
import org.springframework.integration.support.management.graph.IntegrationGraphServer;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

View File

@@ -21,7 +21,6 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.context.annotation.ImportSelector;
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.integration.http.support.HttpContextUtils;
/**
* @author Artem Bilan

View File

@@ -50,7 +50,7 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl
* elements, if there is none registered, yet. However it can be configured as a regular
* bean with appropriate configuration for {@link RequestMappingHandlerMapping}.
* It is recommended to have only one similar bean in the application context using the 'id'
* {@link org.springframework.integration.http.support.HttpContextUtils#HANDLER_MAPPING_BEAN_NAME}.
* {@link org.springframework.integration.http.config.HttpContextUtils#HANDLER_MAPPING_BEAN_NAME}.
* <p>
* In most cases, Spring MVC offers to configure Request Mapping via
* {@code org.springframework.stereotype.Controller} and

View File

@@ -16,7 +16,7 @@
package org.springframework.integration.http.management;
import org.springframework.integration.http.support.HttpContextUtils;
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;

View File

@@ -48,7 +48,6 @@ import org.springframework.integration.context.IntegrationContextUtils;
import org.springframework.integration.context.OrderlyShutdownCapable;
import org.springframework.integration.core.MessageProducer;
import org.springframework.integration.endpoint.AbstractEndpoint;
import org.springframework.integration.endpoint.MessageSourceManagement;
import org.springframework.integration.gateway.MessagingGatewaySupport;
import org.springframework.integration.handler.AbstractMessageProducingHandler;
import org.springframework.integration.history.MessageHistoryConfigurer;
@@ -63,13 +62,14 @@ import org.springframework.integration.support.management.LifecycleTrackableMess
import org.springframework.integration.support.management.MappingMessageRouterManagement;
import org.springframework.integration.support.management.MessageChannelMetrics;
import org.springframework.integration.support.management.MessageHandlerMetrics;
import org.springframework.integration.support.management.MessageSourceManagement;
import org.springframework.integration.support.management.MessageSourceMetrics;
import org.springframework.integration.support.management.PollableChannelManagement;
import org.springframework.integration.support.management.RouterMetrics;
import org.springframework.integration.support.management.Statistics;
import org.springframework.integration.support.management.TrackableComponent;
import org.springframework.integration.support.management.TrackableRouterMetrics;
import org.springframework.integration.util.PatternMatchUtils;
import org.springframework.integration.support.utils.PatternMatchUtils;
import org.springframework.jmx.export.MBeanExporter;
import org.springframework.jmx.export.UnableToRegisterMBeanException;
import org.springframework.jmx.export.annotation.ManagedAttribute;

View File

@@ -28,7 +28,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.config.xml.IntegrationNamespaceUtils;
import org.springframework.integration.http.support.HttpContextUtils;
import org.springframework.integration.http.config.HttpContextUtils;
import org.springframework.integration.webflux.inbound.IntegrationHandlerResultHandler;
import org.springframework.integration.webflux.inbound.WebFluxIntegrationRequestMappingHandlerMapping;
import org.springframework.integration.webflux.support.WebFluxContextUtils;

View File

@@ -21,10 +21,10 @@ import java.util.concurrent.atomic.AtomicBoolean;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.integration.http.config.HttpContextUtils;
import org.springframework.integration.http.inbound.BaseHttpInboundEndpoint;
import org.springframework.integration.http.inbound.CrossOrigin;
import org.springframework.integration.http.inbound.RequestMapping;
import org.springframework.integration.http.support.HttpContextUtils;
import org.springframework.integration.webflux.support.WebFluxContextUtils;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ReflectionUtils;

View File

@@ -16,7 +16,7 @@
package org.springframework.integration.webflux.support;
import org.springframework.integration.http.support.HttpContextUtils;
import org.springframework.integration.http.config.HttpContextUtils;
/**
* Utility class for accessing WebFlux integration components