Remove deprecations from previous versions (#8628)

This commit is contained in:
Artem Bilan
2023-05-22 11:19:13 -04:00
committed by GitHub
parent edbaf6d590
commit ba417de680
37 changed files with 22 additions and 1929 deletions

View File

@@ -306,18 +306,6 @@ public abstract class IntegrationObjectSupport implements BeanNameAware, NamedCo
this.messageBuilderFactory = messageBuilderFactory;
}
/**
* @param key Integration property.
* @param tClass the class to convert a value of Integration property.
* @param <T> The expected type of the property.
* @return the value of the Integration property converted to the provide type.
* @deprecated in favor of {@link #getIntegrationProperties()}
*/
@Deprecated(since = "6.0")
protected <T> T getIntegrationProperty(String key, Class<T> tClass) {
return this.defaultConversionService.convert(this.integrationProperties.toProperties().getProperty(key), tClass);
}
@Override
public String toString() {
return (this.beanName != null) ? getBeanDescription() : super.toString();

View File

@@ -2401,292 +2401,6 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
return wireTap(loggerChannel);
}
/**
* Populate a {@link WireTap} for the {@link #currentMessageChannel}
* with the {@link LoggingHandler} subscriber for the {@code INFO}
* logging level and {@code org.springframework.integration.handler.LoggingHandler}
* as a default logging category.
* <p> The full request {@link Message} will be logged.
* <p> A {@link #bridge()} is added after this operator to make the flow reply-producing
* if the {@code replyChannel} header is present.
* <p> This operator can be used only in the end of flow.
* @return an {@link IntegrationFlow} instance based on this builder.
* @deprecated since 6.0 in favor of {@link #log} in the end of flow.
* @see #log()
* @see #bridge()
*/
@Deprecated
public IntegrationFlow logAndReply() {
return logAndReply(LoggingHandler.Level.INFO);
}
/**
* Populate a {@link WireTap} for the {@link #currentMessageChannel}
* with the {@link LoggingHandler} subscriber for provided {@link LoggingHandler.Level}
* logging level and {@code org.springframework.integration.handler.LoggingHandler}
* as a default logging category.
* <p> The full request {@link Message} will be logged.
* <p> A {@link #bridge()} is added after this operator to make the flow reply-producing
* if the {@code replyChannel} header is present.
* <p> This operator can be used only in the end of flow.
* @param level the {@link LoggingHandler.Level}.
* @return an {@link IntegrationFlow} instance based on this builder.
* @deprecated since 6.0 in favor of {@link #log} in the end of flow.
* @see #log()
* @see #bridge()
*/
@Deprecated
public IntegrationFlow logAndReply(LoggingHandler.Level level) {
return logAndReply(level, (String) null);
}
/**
* Populate a {@link WireTap} for the {@link #currentMessageChannel}
* with the {@link LoggingHandler} subscriber for the provided logging category
* and {@code INFO} logging level.
* <p> The full request {@link Message} will be logged.
* <p> A {@link #bridge()} is added after this operator to make the flow reply-producing
* if the {@code replyChannel} header is present.
* <p> This operator can be used only in the end of flow.
* @param category the logging category to use.
* @return an {@link IntegrationFlow} instance based on this builder.
* @deprecated since 6.0 in favor of {@link #log} in the end of flow.
* @see #log()
* @see #bridge()
*/
@Deprecated
public IntegrationFlow logAndReply(String category) {
return logAndReply(LoggingHandler.Level.INFO, category);
}
/**
* Populate a {@link WireTap} for the {@link #currentMessageChannel}
* with the {@link LoggingHandler} subscriber for the provided
* {@link LoggingHandler.Level} logging level and logging category.
* <p> The full request {@link Message} will be logged.
* <p> A {@link #bridge()} is added after this operator to make the flow reply-producing
* if the {@code replyChannel} header is present.
* <p> This operator can be used only in the end of flow.
* @param level the {@link LoggingHandler.Level}.
* @param category the logging category to use.
* @return an {@link IntegrationFlow} instance based on this builder.
* @deprecated since 6.0 in favor of {@link #log} in the end of flow.
* @see #log()
* @see #bridge()
*/
@Deprecated
public IntegrationFlow logAndReply(LoggingHandler.Level level, @Nullable String category) {
return logAndReply(level, category, (Expression) null);
}
/**
* Populate a {@link WireTap} for the {@link #currentMessageChannel}
* with the {@link LoggingHandler} subscriber for the provided
* {@link LoggingHandler.Level} logging level, logging category
* and SpEL expression for the log message.
* <p> A {@link #bridge()} is added after this operator to make the flow reply-producing
* if the {@code replyChannel} header is present.
* <p> This operator can be used only in the end of flow.
* @param level the {@link LoggingHandler.Level}.
* @param category the logging category.
* @param logExpression the SpEL expression to evaluate logger message at runtime
* against the request {@link Message}.
* @return an {@link IntegrationFlow} instance based on this builder.
* @deprecated since 6.0 in favor of {@link #log} in the end of flow.
* @see #log()
* @see #bridge()
*/
@Deprecated
public IntegrationFlow logAndReply(LoggingHandler.Level level, String category, String logExpression) {
Assert.hasText(logExpression, "'logExpression' must not be empty");
return logAndReply(level, category, PARSER.parseExpression(logExpression));
}
/**
* Populate a {@link WireTap} for the {@link #currentMessageChannel}
* with the {@link LoggingHandler} subscriber for the {@code INFO} logging level,
* the {@code org.springframework.integration.handler.LoggingHandler}
* as a default logging category and {@link Function} for the log message.
* <p> A {@link #bridge()} is added after this operator to make the flow reply-producing
* if the {@code replyChannel} header is present.
* <p> This operator can be used only in the end of flow.
* @param function the function to evaluate logger message at runtime
* @param <P> the expected payload type.
* against the request {@link Message}.
* @return an {@link IntegrationFlow} instance based on this builder.
* @deprecated since 6.0 in favor of {@link #log} in the end of flow.
* @see #log()
* @see #bridge()
*/
@Deprecated
public <P> IntegrationFlow logAndReply(Function<Message<P>, Object> function) {
Assert.notNull(function, FUNCTION_MUST_NOT_BE_NULL);
return logAndReply(new FunctionExpression<>(function));
}
/**
* Populate a {@link WireTap} for the {@link #currentMessageChannel}
* with the {@link LoggingHandler} subscriber for the {@code INFO} logging level,
* the {@code org.springframework.integration.handler.LoggingHandler}
* as a default logging category and SpEL expression to evaluate
* logger message at runtime against the request {@link Message}.
* <p> A {@link #bridge()} is added after this operator to make the flow reply-producing
* if the {@code replyChannel} header is present.
* <p> This operator can be used only in the end of flow.
* @param logExpression the {@link Expression} to evaluate logger message at runtime
* against the request {@link Message}.
* @return an {@link IntegrationFlow} instance based on this builder.
* @deprecated since 6.0 in favor of {@link #log} in the end of flow.
* @see #log()
* @see #bridge()
*/
@Deprecated
public IntegrationFlow logAndReply(Expression logExpression) {
return logAndReply(LoggingHandler.Level.INFO, logExpression);
}
/**
* Populate a {@link WireTap} for the {@link #currentMessageChannel}
* with the {@link LoggingHandler} subscriber for the provided
* {@link LoggingHandler.Level} logging level,
* the {@code org.springframework.integration.handler.LoggingHandler}
* as a default logging category and SpEL expression to evaluate
* logger message at runtime against the request {@link Message}.
* <p> A {@link #bridge()} is added after this operator to make the flow reply-producing
* if the {@code replyChannel} header is present.
* <p> This operator can be used only in the end of flow.
* @param level the {@link LoggingHandler.Level}.
* @param logExpression the {@link Expression} to evaluate logger message at runtime
* against the request {@link Message}.
* @return an {@link IntegrationFlow} instance based on this builder.
* @deprecated since 6.0 in favor of {@link #log} in the end of flow.
* @see #log()
* @see #bridge()
*/
@Deprecated
public IntegrationFlow logAndReply(LoggingHandler.Level level, Expression logExpression) {
return logAndReply(level, null, logExpression);
}
/**
* Populate a {@link WireTap} for the {@link #currentMessageChannel}
* with the {@link LoggingHandler} subscriber for the {@code INFO}
* {@link LoggingHandler.Level} logging level,
* the provided logging category and SpEL expression to evaluate
* logger message at runtime against the request {@link Message}.
* <p> A {@link #bridge()} is added after this operator to make the flow reply-producing
* if the {@code replyChannel} header is present.
* <p> This operator can be used only in the end of flow.
* @param category the logging category.
* @param logExpression the {@link Expression} to evaluate logger message at runtime
* against the request {@link Message}.
* @return an {@link IntegrationFlow} instance based on this builder.
* @deprecated since 6.0 in favor of {@link #log} in the end of flow.
* @see #log()
* @see #bridge()
*/
@Deprecated
public IntegrationFlow logAndReply(String category, Expression logExpression) {
return logAndReply(LoggingHandler.Level.INFO, category, logExpression);
}
/**
* Populate a {@link WireTap} for the {@link #currentMessageChannel}
* with the {@link LoggingHandler} subscriber for the provided
* {@link LoggingHandler.Level} logging level,
* the {@code org.springframework.integration.handler.LoggingHandler}
* as a default logging category and {@link Function} for the log message.
* <p> A {@link #bridge()} is added after this operator to make the flow reply-producing
* if the {@code replyChannel} header is present.
* <p> This operator can be used only in the end of flow.
* @param level the {@link LoggingHandler.Level}.
* @param function the function to evaluate logger message at runtime
* @param <P> the expected payload type.
* against the request {@link Message}.
* @return an {@link IntegrationFlow} instance based on this builder.
* @deprecated since 6.0 in favor of {@link #log} in the end of flow.
* @see #log()
* @see #bridge()
*/
@Deprecated
public <P> IntegrationFlow logAndReply(LoggingHandler.Level level, Function<Message<P>, Object> function) {
return logAndReply(level, null, function);
}
/**
* Populate a {@link WireTap} for the {@link #currentMessageChannel}
* with the {@link LoggingHandler} subscriber for the provided
* {@link LoggingHandler.Level} logging level,
* the provided logging category and {@link Function} for the log message.
* <p> A {@link #bridge()} is added after this operator to make the flow reply-producing
* if the {@code replyChannel} header is present.
* <p> This operator can be used only in the end of flow.
* @param category the logging category.
* @param function the function to evaluate logger message at runtime
* @param <P> the expected payload type.
* against the request {@link Message}.
* @return an {@link IntegrationFlow} instance based on this builder.
* @deprecated since 6.0 in favor of {@link #log} in the end of flow.
* @see #log()
* @see #bridge()
*/
@Deprecated
public <P> IntegrationFlow logAndReply(String category, Function<Message<P>, Object> function) {
return logAndReply(LoggingHandler.Level.INFO, category, function);
}
/**
* Populate a {@link WireTap} for the {@link #currentMessageChannel}
* with the {@link LoggingHandler} subscriber for the provided
* {@link LoggingHandler.Level} logging level, logging category
* and {@link Function} for the log message.
* <p> A {@link #bridge()} is added after this operator to make the flow reply-producing
* if the {@code replyChannel} header is present.
* <p> This operator can be used only in the end of flow.
* @param level the {@link LoggingHandler.Level}.
* @param category the logging category.
* @param function the function to evaluate logger message at runtime
* @param <P> the expected payload type.
* against the request {@link Message}.
* @return an {@link IntegrationFlow} instance based on this builder.
* @deprecated since 6.0 in favor of {@link #log} in the end of flow.
* @see #log()
* @see #bridge()
*/
@Deprecated
public <P> IntegrationFlow logAndReply(LoggingHandler.Level level, @Nullable String category,
Function<Message<P>, Object> function) {
Assert.notNull(function, FUNCTION_MUST_NOT_BE_NULL);
return logAndReply(level, category, new FunctionExpression<>(function));
}
/**
* Populate a {@link WireTap} for the {@link #currentMessageChannel}
* with the {@link LoggingHandler} subscriber for the provided
* {@link LoggingHandler.Level} logging level, logging category
* and SpEL expression for the log message.
* <p> A {@link #bridge()} is added after this operator to make the flow reply-producing
* if the {@code replyChannel} header is present.
* <p> This operator can be used only in the end of flow.
* @param level the {@link LoggingHandler.Level}.
* @param category the logging category.
* @param logExpression the {@link Expression} to evaluate logger message at runtime
* against the request {@link Message}.
* @return an {@link IntegrationFlow} instance based on this builder.
* @deprecated since 6.0 in favor of {@link #log} in the end of flow.
* @see #log()
* @see #bridge()
*/
@Deprecated
public IntegrationFlow logAndReply(LoggingHandler.Level level, @Nullable String category,
@Nullable Expression logExpression) {
return log(level, category, logExpression)
.bridge()
.get();
}
/**
* Populate a {@link ScatterGatherHandler} to the current integration flow position
* based on the provided {@link MessageChannel} for scattering function

View File

@@ -69,16 +69,6 @@ public abstract class IntegrationComponentSpec<S extends IntegrationComponentSpe
return this.id;
}
/**
* @return the configured component.
* @deprecated since 6.1 with no-op for end-user:
* the {@link #getObject()} is called by the framework at the appropriate phase.
*/
@Deprecated(since = "6.1", forRemoval = true)
public T get() {
return getObject();
}
@Override
public Class<?> getObjectType() {
return getObject().getClass();

View File

@@ -1,289 +0,0 @@
/*
* Copyright 2016-2022 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
*
* https://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;
import java.util.function.Consumer;
import java.util.function.Supplier;
import org.reactivestreams.Publisher;
import org.springframework.integration.channel.DirectChannel;
import org.springframework.integration.channel.FluxMessageChannel;
import org.springframework.integration.core.MessageSource;
import org.springframework.integration.endpoint.MessageProducerSupport;
import org.springframework.integration.gateway.MessagingGatewaySupport;
import org.springframework.lang.Nullable;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
/**
* The central factory for fluent {@link IntegrationFlowBuilder} API.
*
* @author Artem Bilan
* @author Gary Russell
* @author Oleg Zhurakousky
*
* @since 5.0
*
* @see org.springframework.integration.dsl.context.IntegrationFlowBeanPostProcessor
*
* @deprecated since version 6.0 in favor of fluent API methods straight from {@link IntegrationFlow} interface.
*/
@Deprecated(since = "6.0", forRemoval = true)
public final class IntegrationFlows {
/**
* Populate the {@link MessageChannel} name to the new {@link IntegrationFlowBuilder} chain.
* The {@link org.springframework.integration.dsl.IntegrationFlow} {@code inputChannel}.
* @param messageChannelName the name of existing {@link MessageChannel} bean.
* The new {@link DirectChannel} bean will be created on context startup
* if there is no bean with this name.
* @return new {@link IntegrationFlowBuilder}.
*/
public static IntegrationFlowBuilder from(String messageChannelName) {
return IntegrationFlow.from(messageChannelName);
}
/**
* Populate the {@link MessageChannel} name to the new {@link IntegrationFlowBuilder} chain.
* Typically for the {@link org.springframework.integration.channel.FixedSubscriberChannel} together
* with {@code fixedSubscriber = true}.
* The {@link org.springframework.integration.dsl.IntegrationFlow} {@code inputChannel}.
* @param messageChannelName the name for {@link DirectChannel} or
* {@link org.springframework.integration.channel.FixedSubscriberChannel}
* to be created on context startup, not reference.
* The {@link MessageChannel} depends on the {@code fixedSubscriber} boolean argument.
* @param fixedSubscriber the boolean flag to determine if result {@link MessageChannel} should
* be {@link DirectChannel}, if {@code false} or
* {@link org.springframework.integration.channel.FixedSubscriberChannel}, if {@code true}.
* @return new {@link IntegrationFlowBuilder}.
* @see DirectChannel
* @see org.springframework.integration.channel.FixedSubscriberChannel
*/
public static IntegrationFlowBuilder from(String messageChannelName, boolean fixedSubscriber) {
return IntegrationFlow.from(messageChannelName, fixedSubscriber);
}
/**
* Populate the {@link MessageChannel} object to the
* {@link IntegrationFlowBuilder} chain using the fluent API from {@link MessageChannelSpec}.
* The {@link org.springframework.integration.dsl.IntegrationFlow} {@code inputChannel}.
* @param messageChannelSpec the MessageChannelSpec to populate {@link MessageChannel} instance.
* @return new {@link IntegrationFlowBuilder}.
* @see org.springframework.integration.dsl.MessageChannels
*/
public static IntegrationFlowBuilder from(MessageChannelSpec<?, ?> messageChannelSpec) {
return IntegrationFlow.from(messageChannelSpec);
}
/**
* Populate the provided {@link MessageChannel} object to the {@link IntegrationFlowBuilder} chain.
* The {@link org.springframework.integration.dsl.IntegrationFlow} {@code inputChannel}.
* @param messageChannel the {@link MessageChannel} to populate.
* @return new {@link IntegrationFlowBuilder}.
*/
public static IntegrationFlowBuilder from(MessageChannel messageChannel) {
return IntegrationFlow.from(messageChannel);
}
/**
* Populate the {@link MessageSource} object to the {@link IntegrationFlowBuilder} chain
* using the fluent API from the provided {@link MessageSourceSpec}.
* The {@link org.springframework.integration.dsl.IntegrationFlow} {@code startMessageSource}.
* @param messageSourceSpec the {@link MessageSourceSpec} to use.
* @return new {@link IntegrationFlowBuilder}.
* @see MessageSourceSpec and its implementations.
*/
public static IntegrationFlowBuilder from(MessageSourceSpec<?, ? extends MessageSource<?>> messageSourceSpec) {
return IntegrationFlow.from(messageSourceSpec);
}
/**
* Populate the {@link MessageSource} object to the {@link IntegrationFlowBuilder} chain
* using the fluent API from the provided {@link MessageSourceSpec}.
* The {@link org.springframework.integration.dsl.IntegrationFlow} {@code startMessageSource}.
* @param messageSourceSpec the {@link MessageSourceSpec} to use.
* @param endpointConfigurer the {@link Consumer} to provide more options for the
* {@link org.springframework.integration.config.SourcePollingChannelAdapterFactoryBean}.
* @return new {@link IntegrationFlowBuilder}.
* @see MessageSourceSpec
* @see SourcePollingChannelAdapterSpec
*/
public static IntegrationFlowBuilder from(MessageSourceSpec<?, ? extends MessageSource<?>> messageSourceSpec,
Consumer<SourcePollingChannelAdapterSpec> endpointConfigurer) {
return IntegrationFlow.from(messageSourceSpec, endpointConfigurer);
}
/**
* Provides {@link Supplier} as source of messages to the integration flow which will
* be triggered by the application context's default poller (which must be declared).
* @param messageSource the {@link Supplier} to populate.
* @param <T> the supplier type.
* @return new {@link IntegrationFlowBuilder}.
* @see Supplier
*/
public static <T> IntegrationFlowBuilder fromSupplier(Supplier<T> messageSource) {
return IntegrationFlow.fromSupplier(messageSource);
}
/**
* Provides {@link Supplier} as source of messages to the integration flow.
* which will be triggered by a <b>provided</b>
* {@link org.springframework.integration.endpoint.SourcePollingChannelAdapter}.
* @param messageSource the {@link Supplier} to populate.
* @param endpointConfigurer the {@link Consumer} to provide more options for the
* {@link org.springframework.integration.config.SourcePollingChannelAdapterFactoryBean}.
* @param <T> the supplier type.
* @return new {@link IntegrationFlowBuilder}.
* @see Supplier
*/
public static <T> IntegrationFlowBuilder fromSupplier(Supplier<T> messageSource,
Consumer<SourcePollingChannelAdapterSpec> endpointConfigurer) {
return IntegrationFlow.fromSupplier(messageSource, endpointConfigurer);
}
/**
* Populate the provided {@link MessageSource} object to the {@link IntegrationFlowBuilder} chain.
* The {@link org.springframework.integration.dsl.IntegrationFlow} {@code startMessageSource}.
* @param messageSource the {@link MessageSource} to populate.
* @return new {@link IntegrationFlowBuilder}.
* @see MessageSource
*/
public static IntegrationFlowBuilder from(MessageSource<?> messageSource) {
return IntegrationFlow.from(messageSource);
}
/**
* Populate the provided {@link MessageSource} object to the {@link IntegrationFlowBuilder} chain.
* The {@link org.springframework.integration.dsl.IntegrationFlow} {@code startMessageSource}.
* In addition use {@link SourcePollingChannelAdapterSpec} to provide options for the underlying
* {@link org.springframework.integration.endpoint.SourcePollingChannelAdapter} endpoint.
* @param messageSource the {@link MessageSource} to populate.
* @param endpointConfigurer the {@link Consumer} to provide more options for the
* {@link org.springframework.integration.config.SourcePollingChannelAdapterFactoryBean}.
* @return new {@link IntegrationFlowBuilder}.
* @see MessageSource
* @see SourcePollingChannelAdapterSpec
*/
public static IntegrationFlowBuilder from(MessageSource<?> messageSource,
@Nullable Consumer<SourcePollingChannelAdapterSpec> endpointConfigurer) {
return IntegrationFlow.from(messageSource, endpointConfigurer);
}
/**
* Populate the {@link MessageProducerSupport} object to the {@link IntegrationFlowBuilder} chain
* using the fluent API from the {@link MessageProducerSpec}.
* The {@link org.springframework.integration.dsl.IntegrationFlow} {@code startMessageProducer}.
* @param messageProducerSpec the {@link MessageProducerSpec} to use.
* @return new {@link IntegrationFlowBuilder}.
* @see MessageProducerSpec
*/
public static IntegrationFlowBuilder from(MessageProducerSpec<?, ?> messageProducerSpec) {
return IntegrationFlow.from(messageProducerSpec);
}
/**
* Populate the provided {@link MessageProducerSupport} object to the {@link IntegrationFlowBuilder} chain.
* The {@link org.springframework.integration.dsl.IntegrationFlow} {@code startMessageProducer}.
* @param messageProducer the {@link MessageProducerSupport} to populate.
* @return new {@link IntegrationFlowBuilder}.
*/
public static IntegrationFlowBuilder from(MessageProducerSupport messageProducer) {
return IntegrationFlow.from(messageProducer);
}
/**
* Populate the {@link MessagingGatewaySupport} object to the {@link IntegrationFlowBuilder} chain
* using the fluent API from the {@link MessagingGatewaySpec}.
* The {@link org.springframework.integration.dsl.IntegrationFlow} {@code startMessagingGateway}.
* @param inboundGatewaySpec the {@link MessagingGatewaySpec} to use.
* @return new {@link IntegrationFlowBuilder}.
*/
public static IntegrationFlowBuilder from(MessagingGatewaySpec<?, ?> inboundGatewaySpec) {
return IntegrationFlow.from(inboundGatewaySpec);
}
/**
* Populate the provided {@link MessagingGatewaySupport} object to the {@link IntegrationFlowBuilder} chain.
* The {@link org.springframework.integration.dsl.IntegrationFlow} {@code startMessageProducer}.
* @param inboundGateway the {@link MessagingGatewaySupport} to populate.
* @return new {@link IntegrationFlowBuilder}.
*/
public static IntegrationFlowBuilder from(MessagingGatewaySupport inboundGateway) {
return IntegrationFlow.from(inboundGateway);
}
/**
* Populate the {@link MessageChannel} to the new {@link IntegrationFlowBuilder}
* chain, which becomes as a {@code requestChannel} for the Messaging Gateway(s) built
* on the provided service interface.
* <p>A gateway proxy bean for provided service interface is registered under a name
* from the
* {@link org.springframework.integration.annotation.MessagingGateway#name()} if present
* or from the {@link IntegrationFlow} bean name plus {@code .gateway} suffix.
* @param serviceInterface the service interface class with an optional
* {@link org.springframework.integration.annotation.MessagingGateway} annotation.
* @return new {@link IntegrationFlowBuilder}.
*/
public static IntegrationFlowBuilder from(Class<?> serviceInterface) {
return IntegrationFlow.from(serviceInterface);
}
/**
* Populate the {@link MessageChannel} to the new {@link IntegrationFlowBuilder}
* chain, which becomes as a {@code requestChannel} for the Messaging Gateway(s) built
* on the provided service interface.
* <p>A gateway proxy bean for provided service interface is based on the options
* configured via provided {@link Consumer}.
* @param serviceInterface the service interface class with an optional
* {@link org.springframework.integration.annotation.MessagingGateway} annotation.
* @param endpointConfigurer the {@link Consumer} to configure proxy bean for gateway.
* @return new {@link IntegrationFlowBuilder}.
* @since 5.2
*/
public static IntegrationFlowBuilder from(Class<?> serviceInterface,
@Nullable Consumer<GatewayProxySpec> endpointConfigurer) {
return IntegrationFlow.from(serviceInterface, endpointConfigurer);
}
/**
* Populate a {@link FluxMessageChannel} to the {@link IntegrationFlowBuilder} chain
* and subscribe it to the provided {@link Publisher}.
* @param publisher the {@link Publisher} to subscribe to.
* @return new {@link IntegrationFlowBuilder}.
*/
@SuppressWarnings("overloads")
public static IntegrationFlowBuilder from(Publisher<? extends Message<?>> publisher) {
return IntegrationFlow.from(publisher);
}
/**
* Start the flow with a composition from the {@link IntegrationFlow}.
* @param other the {@link IntegrationFlow} from which to compose.
* @return new {@link IntegrationFlowBuilder}.
* @since 5.5.4
*/
@SuppressWarnings("overloads")
public static IntegrationFlowBuilder from(IntegrationFlow other) {
return IntegrationFlow.from(other);
}
private IntegrationFlows() {
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2022 the original author or authors.
* Copyright 2016-2023 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,9 +17,7 @@
package org.springframework.integration.dsl;
import java.time.Duration;
import java.time.temporal.ChronoUnit;
import java.util.TimeZone;
import java.util.concurrent.TimeUnit;
import org.springframework.scheduling.Trigger;
@@ -79,19 +77,6 @@ public final class PollerFactory {
return Pollers.fixedRate(period);
}
/**
* Create a {@link PollerSpec} based on the provided fixed rate period and {@link TimeUnit}.
* @param period the fixed rate period to use.
* @param timeUnit the {@link TimeUnit} to use.
* @return the {@link PollerSpec}
* @deprecated since 6.1 in favor of {@link #fixedRate(Duration)}
* @see Pollers#fixedRate(Duration)
*/
@Deprecated(forRemoval = true)
public PollerSpec fixedRate(long period, TimeUnit timeUnit) {
return Pollers.fixedRate(Duration.of(period, timeUnit.toChronoUnit()));
}
/**
* Create a {@link PollerSpec} based on the provided fixed rate period.
* @param period the fixed rate period to use.
@@ -126,51 +111,6 @@ public final class PollerFactory {
return Pollers.fixedRate(period, initialDelay);
}
/**
* Create a {@link PollerSpec} based on the provided fixed rate period and {@link TimeUnit}
* with an initial delay.
* @param period the fixed rate period to use.
* @param timeUnit the {@link TimeUnit} to use.
* @param initialDelay the initial delay to use.
* @return the {@link PollerSpec}
* @deprecated since 6.1 in favor of {@link #fixedRate(Duration, Duration)}
* @see Pollers#fixedRate(Duration, Duration)
*/
@Deprecated(forRemoval = true)
public PollerSpec fixedRate(long period, TimeUnit timeUnit, long initialDelay) {
ChronoUnit chronoUnit = timeUnit.toChronoUnit();
return Pollers.fixedRate(Duration.of(period, chronoUnit), Duration.of(initialDelay, chronoUnit));
}
/**
* Create a {@link PollerSpec} based on the provided fixed delay period and {@link TimeUnit}
* with an initial delay.
* @param period the fixed delay period to use.
* @param timeUnit the {@link TimeUnit} to use.
* @param initialDelay the initial delay to use.
* @return the {@link PollerSpec}
* @deprecated since 6.1 in favor of {@link #fixedDelay(Duration, Duration)}
* @see Pollers#fixedDelay(Duration, Duration)
*/
@Deprecated(forRemoval = true)
public PollerSpec fixedDelay(long period, TimeUnit timeUnit, long initialDelay) {
ChronoUnit chronoUnit = timeUnit.toChronoUnit();
return Pollers.fixedDelay(Duration.of(period, chronoUnit), Duration.of(initialDelay, chronoUnit));
}
/**
* Create a {@link PollerSpec} based on the provided fixed delay period and {@link TimeUnit}.
* @param period the fixed delay period to use.
* @param timeUnit the {@link TimeUnit} to use.
* @return the {@link PollerSpec}
* @deprecated since 6.1 in favor of {@link #fixedDelay(Duration)}
* @see Pollers#fixedDelay(Duration)
*/
@Deprecated(forRemoval = true)
public PollerSpec fixedDelay(long period, TimeUnit timeUnit) {
return Pollers.fixedDelay(Duration.of(period, timeUnit.toChronoUnit()));
}
/**
* Create a {@link PollerSpec} based on the provided fixed delay period and initial delay.
* @param period the fixed delay period (in milliseconds) to use.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2022 the original author or authors.
* Copyright 2016-2023 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,9 +17,7 @@
package org.springframework.integration.dsl;
import java.time.Duration;
import java.time.temporal.ChronoUnit;
import java.util.TimeZone;
import java.util.concurrent.TimeUnit;
import org.springframework.lang.Nullable;
import org.springframework.scheduling.Trigger;
@@ -62,21 +60,6 @@ public final class Pollers {
return periodicTrigger(period, true, null);
}
/**
* Create a {@link PollerSpec} based on the provided fixed rate period.
* The "fixed rate" means that periodic interval should be measured between the
* scheduled start times rather than between actual completion times.
* @param period the fixed rate period to use.
* @param timeUnit the {@link TimeUnit} to use.
* @return the {@link PollerSpec}
* @deprecated since 6.0 in favor of {@link #fixedRate(Duration)}
* @see PeriodicTrigger
*/
@Deprecated(forRemoval = true)
public static PollerSpec fixedRate(long period, TimeUnit timeUnit) {
return fixedRate(Duration.of(period, timeUnit.toChronoUnit()));
}
/**
* Create a {@link PollerSpec} based on the provided fixed rate period
* and initial delay.
@@ -105,24 +88,6 @@ public final class Pollers {
return fixedRate(Duration.ofMillis(period), Duration.ofMillis(initialDelay));
}
/**
* Create a {@link PollerSpec} based on the provided fixed rate period
* and initial delay.
* The "fixed rate" means that periodic interval should be measured between the
* scheduled start times rather than between actual completion times.
* @param period the fixed rate period to use.
* @param timeUnit the {@link TimeUnit} to use.
* @param initialDelay the initial delay to use.
* @return the {@link PollerSpec}
* @deprecated since 6.0 in favor of {@link #fixedRate(Duration, Duration)}
* @see PeriodicTrigger
*/
@Deprecated(forRemoval = true)
public static PollerSpec fixedRate(long period, TimeUnit timeUnit, long initialDelay) {
ChronoUnit chronoUnit = timeUnit.toChronoUnit();
return fixedRate(Duration.of(period, chronoUnit), Duration.of(initialDelay, chronoUnit));
}
/**
* Create a {@link PollerSpec} based on the provided fixed delay period.
* The "fixed delay" means that periodic interval should be measured between the
@@ -160,21 +125,6 @@ public final class Pollers {
return periodicTrigger(period, false, initialDelay);
}
/**
* Create a {@link PollerSpec} based on the provided fixed delay period.
* The "fixed delay" means that periodic interval should be measured between the
* scheduled tasks actual completion times.
* @param period the fixed delay period to use.
* @param timeUnit the {@link TimeUnit} to use.
* @return the {@link PollerSpec}
* @deprecated since 6.0 in favor of {@link #fixedDelay(Duration)}
* @see PeriodicTrigger
*/
@Deprecated(forRemoval = true)
public static PollerSpec fixedDelay(long period, TimeUnit timeUnit) {
return fixedDelay(Duration.of(period, timeUnit.toChronoUnit()));
}
/**
* Create a {@link PollerSpec} based on the provided fixed delay period and initial delay.
* The "fixed delay" means that periodic interval should be measured between the
@@ -188,24 +138,6 @@ public final class Pollers {
return fixedDelay(Duration.ofMillis(period), Duration.ofMillis(initialDelay));
}
/**
* Create a {@link PollerSpec} based on the provided fixed delay period
* and initial delay.
* The "fixed delay" means that periodic interval should be measured between the
* scheduled tasks actual completion times.
* @param period the fixed delay period to use.
* @param timeUnit the {@link TimeUnit} to use.
* @param initialDelay the initial delay to use.
* @return the {@link PollerSpec}
* @deprecated since 6.0 in favor of {@link #fixedDelay(Duration, Duration)}
* @see PeriodicTrigger
*/
@Deprecated(forRemoval = true)
public static PollerSpec fixedDelay(long period, TimeUnit timeUnit, long initialDelay) {
ChronoUnit chronoUnit = timeUnit.toChronoUnit();
return fixedDelay(Duration.of(period, chronoUnit), Duration.of(initialDelay, chronoUnit));
}
private static PollerSpec periodicTrigger(Duration period, boolean fixedRate, @Nullable Duration initialDelay) {
PeriodicTrigger periodicTrigger = new PeriodicTrigger(period);
periodicTrigger.setFixedRate(fixedRate);

View File

@@ -109,22 +109,6 @@ public class RouterSpec<K, R extends AbstractMappingMessageRouter> extends Abstr
return _this();
}
/**
* By default, if a resolved channel key does not exist in the channel map, the key
* itself is used as the channel name, which we will attempt to resolve to a channel.
* Invoke this method to disable this feature. This could be useful to prevent
* malicious actors from generating a message that could cause the message to be
* routed to an unexpected channel, such as one upstream of the router, which would
* cause a stack overflow.
* @return the router spec.
* @since 5.2
* @deprecated since 6.0 in favor of {@link #channelKeyFallback(boolean)}
*/
@Deprecated(since = "6.0", forRemoval = true)
public RouterSpec<K, R> noChannelKeyFallback() {
return channelKeyFallback(false);
}
/**
* When true (default), if a resolved channel key does not exist in the channel map,
* the key itself is used as the channel name, which we will attempt to resolve to a

View File

@@ -55,9 +55,9 @@ public class AvroTestClass1 extends org.apache.avro.specific.SpecificRecordBase
return DECODER.decode(b);
}
@Deprecated public java.lang.String bar;
public java.lang.String bar;
@Deprecated public java.lang.String qux;
public java.lang.String qux;
/**
* Default constructor. Note that this does not initialize fields

View File

@@ -55,9 +55,9 @@ public class AvroTestClass2 extends org.apache.avro.specific.SpecificRecordBase
return DECODER.decode(b);
}
@Deprecated public java.lang.String bar;
public java.lang.String bar;
@Deprecated public java.lang.String qux;
public java.lang.String qux;
/**
* Default constructor. Note that this does not initialize fields

View File

@@ -642,7 +642,7 @@ private static final long serialVersionUID = 0L;
return DEFAULT_INSTANCE;
}
@java.lang.Deprecated public static final com.google.protobuf.Parser<TestClass1>
public static final com.google.protobuf.Parser<TestClass1>
PARSER = new com.google.protobuf.AbstractParser<TestClass1>() {
@java.lang.Override
public TestClass1 parsePartialFrom(
@@ -668,4 +668,3 @@ private static final long serialVersionUID = 0L;
}
}

View File

@@ -642,7 +642,7 @@ private static final long serialVersionUID = 0L;
return DEFAULT_INSTANCE;
}
@java.lang.Deprecated public static final com.google.protobuf.Parser<TestClass2>
public static final com.google.protobuf.Parser<TestClass2>
PARSER = new com.google.protobuf.AbstractParser<TestClass2>() {
@java.lang.Override
public TestClass2 parsePartialFrom(
@@ -668,4 +668,3 @@ private static final long serialVersionUID = 0L;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2022 the original author or authors.
* Copyright 2016-2023 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.
@@ -212,17 +212,6 @@ public abstract class AbstractConnectionFactorySpec
return _this();
}
/**
* @param tcpSocketSupport the {@link TcpSocketSupport}.
* @return the spec.
* @deprecated in favor of {@link #socketSupport(TcpSocketSupport)}.
* @see AbstractConnectionFactory#setTcpSocketSupport(TcpSocketSupport)
*/
@Deprecated
public S tcpSocketSupport(TcpSocketSupport tcpSocketSupport) {
return socketSupport(tcpSocketSupport);
}
/**
* @param tcpSocketSupport the {@link TcpSocketSupport}.
* @return the spec.

View File

@@ -18,8 +18,6 @@ package org.springframework.integration.ip.dsl;
import org.springframework.integration.ip.tcp.connection.AbstractClientConnectionFactory;
import org.springframework.integration.ip.tcp.connection.AbstractServerConnectionFactory;
import org.springframework.integration.ip.tcp.connection.TcpNetClientConnectionFactory;
import org.springframework.integration.ip.tcp.connection.TcpNioClientConnectionFactory;
/**
* An {@link AbstractConnectionFactorySpec} for {@link AbstractClientConnectionFactory}s.
@@ -34,7 +32,7 @@ import org.springframework.integration.ip.tcp.connection.TcpNioClientConnectionF
*
*/
public abstract class TcpClientConnectionFactorySpec
<S extends TcpClientConnectionFactorySpec<S, C>, C extends AbstractClientConnectionFactory>
<S extends TcpClientConnectionFactorySpec<S, C>, C extends AbstractClientConnectionFactory>
extends AbstractConnectionFactorySpec<S, C> {
/**
@@ -46,30 +44,6 @@ public abstract class TcpClientConnectionFactorySpec
super(cf);
}
/**
* Create an instance.
* @param host the host.
* @param port the port.
* @deprecated since 6.0.3; use a subclass.
*/
@Deprecated
protected TcpClientConnectionFactorySpec(String host, int port) {
this(host, port, false);
}
/**
* Create an instance.
* @param host the host.
* @param port the port.
* @param nio true for NIO.
* @deprecated since 6.0.3; use a subclass.
*/
@SuppressWarnings("unchecked")
@Deprecated
protected TcpClientConnectionFactorySpec(String host, int port, boolean nio) {
super(nio ? (C) new TcpNioClientConnectionFactory(host, port) : (C) new TcpNetClientConnectionFactory(host, port));
}
/**
* Set the connection timeout in seconds. Defaults to 60.
* @param connectTimeout the timeout.

View File

@@ -115,19 +115,6 @@ public class TcpOutboundGatewaySpec extends MessageHandlerSpec<TcpOutboundGatewa
return this;
}
/**
* Set the unsolicited message channel name.
* @param channelName the name.
* @return the spec.
* @since 5.4
* @deprecated in favor of {@link #unsolicitedMessageChannelName(String)}
* due to the typo in method name.
*/
@Deprecated(since = "6.1", forRemoval = true)
public TcpOutboundGatewaySpec unsolictedMessageChannelName(String channelName) {
return unsolicitedMessageChannelName(channelName);
}
/**
* Set the unsolicited message channel name.
* @param channelName the name.
@@ -139,19 +126,6 @@ public class TcpOutboundGatewaySpec extends MessageHandlerSpec<TcpOutboundGatewa
return this;
}
/**
* Set the unsolicited message channel.
* @param channel the channel.
* @return the spec.
* @since 5.4
* @deprecated in favor of {@link #unsolicitedMessageChannel(MessageChannel)}
* due to the typo in method name.
*/
@Deprecated(since = "6.1", forRemoval = true)
public TcpOutboundGatewaySpec unsolictedMessageChannelName(MessageChannel channel) {
return unsolicitedMessageChannel(channel);
}
/**
* Set the unsolicited message channel.
* @param channel the channel.

View File

@@ -17,8 +17,6 @@
package org.springframework.integration.ip.dsl;
import org.springframework.integration.ip.tcp.connection.AbstractServerConnectionFactory;
import org.springframework.integration.ip.tcp.connection.TcpNetServerConnectionFactory;
import org.springframework.integration.ip.tcp.connection.TcpNioServerConnectionFactory;
/**
* An {@link AbstractConnectionFactorySpec} for {@link AbstractServerConnectionFactory}s.
@@ -33,7 +31,7 @@ import org.springframework.integration.ip.tcp.connection.TcpNioServerConnectionF
*
*/
public abstract class TcpServerConnectionFactorySpec
<S extends TcpServerConnectionFactorySpec<S, C>, C extends AbstractServerConnectionFactory>
<S extends TcpServerConnectionFactorySpec<S, C>, C extends AbstractServerConnectionFactory>
extends AbstractConnectionFactorySpec<S, C> {
/**
@@ -45,28 +43,6 @@ public abstract class TcpServerConnectionFactorySpec
super(cf);
}
/**
* Create an instance.
* @param port the port.
* @deprecated since 6.0.3; use a subclass.
*/
@Deprecated
protected TcpServerConnectionFactorySpec(int port) {
this(port, false);
}
/**
* Create an instance.
* @param port the port.
* @param nio true for NIO.
* @deprecated since 6.0.3; use a subclass.
*/
@Deprecated
@SuppressWarnings("unchecked")
protected TcpServerConnectionFactorySpec(int port, boolean nio) {
super(nio ? (C) new TcpNioServerConnectionFactory(port) : (C) new TcpNetServerConnectionFactory(port));
}
/**
* @param localAddress the local address.
* @return the spec.

View File

@@ -173,20 +173,11 @@
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="max-rows-per-poll" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
[DEPRECATED] Limits the number of rows extracted per query (otherwise all rows
are extracted into the outgoing message).
Deprecated since 5.1 in favor of 'max-rows'.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="max-rows" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
Limits the number of rows extracted per query.
Otherwise all rows are extracted into the outgoing message.
Otherwise, all rows are extracted into the outgoing message.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
@@ -321,7 +312,7 @@
supplied here, or (if keys-generated="true") can be the
primary keys generated from an auto-increment, or else just a
count of the number of rows affected by the update. The response
is in general a case insensitive Map (or list of maps if multi-valued), unless
is in general a case-insensitive Map (or list of maps if multivalued), unless
a select query and a row-mapper is provided. If the update count is
returned then the map key is "UPDATE".
</xsd:documentation>
@@ -381,7 +372,7 @@
<xsd:documentation>
When using a select query, you can set a
custom limit regarding the number of rows
extracted. Otherwise by default only the first
extracted. Otherwise, by default only the first
row will be extracted into the outgoing message.
If set to '0' all rows are extracted.
</xsd:documentation>
@@ -898,8 +889,7 @@
expect-single-result is true, then a MessagingException
is thrown.
Otherwise the complete result map is returned as the
payload.
Otherwise, the complete result map is returned as the payload.
Important Note: Several databases such as H2 are not
fully supported for Stored Procedure and/oir Function calls.
@@ -1054,7 +1044,7 @@
<xsd:annotation>
<xsd:documentation>
<![CDATA[
Storeed procedured may return multiple resultsets.
Stored procedure may return multiple resultsets.
]]>
</xsd:documentation>
</xsd:annotation>
@@ -1107,8 +1097,7 @@
expect-single-result is true, then a MessagingException
is thrown.
Otherwise the complete result map is returned as the
payload.
Otherwise, the complete result map is returned as the payload.
Important Note: Several databases such as H2 are not
fully supported for Stored Procedure and/oir Function calls.
@@ -1140,7 +1129,7 @@
<xsd:attribute name="channel" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
Channel to which polled messages will be send. If the stored
Channel to which polled messages will be sent. If the stored
procedure or function does not return any data, the payload
of the Message will be Null.
</xsd:documentation>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2019 the original author or authors.
* Copyright 2019-2023 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.
@@ -46,10 +46,7 @@ public class KafkaInboundChannelAdapterParser extends AbstractPollingInboundChan
protected BeanMetadataElement parseSource(Element element, ParserContext parserContext) {
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(KafkaMessageSource.class);
builder.addConstructorArgReference(element.getAttribute("consumer-factory"));
boolean hasConsumerProperties = StringUtils.hasText(element.getAttribute("consumer-properties"));
if (hasConsumerProperties) {
builder.addConstructorArgReference(element.getAttribute("consumer-properties"));
}
builder.addConstructorArgReference(element.getAttribute("consumer-properties"));
String attribute = element.getAttribute("ack-factory");
if (StringUtils.hasText(attribute)) {
builder.addConstructorArgReference(attribute);
@@ -58,12 +55,7 @@ public class KafkaInboundChannelAdapterParser extends AbstractPollingInboundChan
if (StringUtils.hasText(attribute)) {
builder.addConstructorArgValue(attribute);
}
if (!hasConsumerProperties) {
builder.addConstructorArgValue(element.getAttribute("topics"));
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "client-id");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "group-id");
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "rebalance-listener");
}
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "message-converter");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "payload-type");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "raw-header", "rawMessageHeader");

View File

@@ -237,45 +237,6 @@
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="topics" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
[DEPRECATED]
Comma-delimited list of topic names.
Deprecated in favor of 'consumer-properties'.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="group-id" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
[DEPRECATED]
The 'group.id' KafkaConsumer property; overrides the value in the consumer factory.
Deprecated in favor of 'consumer-properties'.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="client-id" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
[DEPRECATED]
The 'client.id' KafkaConsumer property; overrides the value in the consumer factory.
Deprecated in favor of 'consumer-properties'.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="poll-timeout">
<xsd:annotation>
<xsd:documentation>
[DEPRECATED]
The time to block in poll() in milliseconds; default 5000ms.
Deprecated in favor of 'consumer-properties'.
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:union memberTypes="xsd:int xsd:string"/>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="message-converter" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
@@ -298,21 +259,6 @@
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="rebalance-listener" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
[DEPRECATED]
A reference to a 'ConsumerRebalanceListener'.
Deprecated in favor of 'consumer-properties'.
</xsd:documentation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type
type="org.apache.kafka.clients.consumer.ConsumerRebalanceListener"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="raw-header">
<xsd:annotation>
<xsd:documentation>

View File

@@ -58,18 +58,6 @@ import org.springframework.util.Assert;
public abstract class AbstractMqttMessageDrivenChannelAdapter<T, C> extends MessageProducerSupport
implements ApplicationEventPublisherAware, ClientManager.ConnectCallback {
/**
* The default completion timeout in milliseconds.
*/
@Deprecated(since = "6.0.3", forRemoval = true)
public static final long DEFAULT_COMPLETION_TIMEOUT = ClientManager.DEFAULT_COMPLETION_TIMEOUT;
/**
* The default disconnect completion timeout in milliseconds.
*/
@Deprecated(since = "6.0.3", forRemoval = true)
public static final long DISCONNECT_COMPLETION_TIMEOUT = ClientManager.DISCONNECT_COMPLETION_TIMEOUT;
protected final Lock topicLock = new ReentrantLock(); // NOSONAR
private final String url;

View File

@@ -1,40 +0,0 @@
/*
* Copyright 2002-2022 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
*
* https://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.security.channel;
import java.util.Collection;
import org.springframework.security.access.ConfigAttribute;
/**
* Interface to encapsulate {@link ConfigAttribute}s for secured channel
* send and receive operations.
*
* @author Oleg Zhurakousky
* @since 2.0
*
* @deprecated since 6.0 in favor of literally
* {@code new AuthorizationChannelInterceptor(AuthorityAuthorizationManager.hasAnyRole())}
*/
@Deprecated(since = "6.0")
public interface ChannelAccessPolicy {
Collection<ConfigAttribute> getConfigAttributesForSend();
Collection<ConfigAttribute> getConfigAttributesForReceive();
}

View File

@@ -1,87 +0,0 @@
/*
* Copyright 2002-2022 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
*
* https://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.security.channel;
import org.aopalliance.intercept.MethodInvocation;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.util.Assert;
/**
* Secured object for {@link ChannelSecurityInterceptor}. Maintains a reference
* to the original {@link MethodInvocation} instance and provides convenient
* access to the secured {@link MessageChannel}. If the intercepted invocation
* is a <em>send</em> operation, the {@link Message} is also available.
*
* @author Mark Fisher
*
* @deprecated since 6.0 in favor of literally
* {@code new AuthorizationChannelInterceptor(AuthorityAuthorizationManager.hasAnyRole())}
*/
@Deprecated(since = "6.0")
public class ChannelInvocation {
private final MessageChannel channel;
private final Message<?> message;
private final MethodInvocation methodInvocation;
/**
* @param methodInvocation the intercepted MethodInvocation instance
*/
public ChannelInvocation(MethodInvocation methodInvocation) {
Assert.notNull(methodInvocation, "MethodInvocation must not be null");
Assert.isAssignable(MessageChannel.class, methodInvocation.getThis().getClass(),
"MethodInvocation must be on a MessageChannel");
this.channel = (MessageChannel) methodInvocation.getThis();
if (methodInvocation.getMethod().getName().equals("send")) {
if (methodInvocation.getArguments().length < 1 || !(methodInvocation.getArguments()[0] instanceof Message<?>)) {
throw new IllegalStateException("expected a Message as the first parameter of the channel's send method");
}
this.message = (Message<?>) methodInvocation.getArguments()[0];
}
else {
this.message = null;
}
this.methodInvocation = methodInvocation;
}
public MessageChannel getChannel() {
return this.channel;
}
public Message<?> getMessage() {
return this.message;
}
public MethodInvocation getMethodInvocation() {
return this.methodInvocation;
}
public boolean isSend() {
return "send".equals(this.methodInvocation.getMethod().getName());
}
public boolean isReceive() {
return "receive".equals(this.methodInvocation.getMethod().getName());
}
}

View File

@@ -1,89 +0,0 @@
/*
* Copyright 2002-2022 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
*
* https://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.security.channel;
import java.lang.reflect.Method;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.springframework.security.access.SecurityMetadataSource;
import org.springframework.security.access.intercept.AbstractSecurityInterceptor;
import org.springframework.security.access.intercept.InterceptorStatusToken;
import org.springframework.util.Assert;
/**
* An AOP interceptor that enforces authorization for MessageChannel send and/or receive calls.
*
* @author Mark Fisher
* @author Oleg Zhurakousky
*
* @see SecuredChannel
*
* @deprecated since 6.0 in favor of literally
* {@code new AuthorizationChannelInterceptor(AuthorityAuthorizationManager.hasAnyRole())}.
* However, the {@link org.springframework.security.messaging.access.intercept.AuthorizationChannelInterceptor}
* can be configured with any {@link org.springframework.security.authorization.AuthorizationManager} implementation.
*/
@Deprecated(since = "6.0")
public final class ChannelSecurityInterceptor extends AbstractSecurityInterceptor implements MethodInterceptor {
private final ChannelSecurityMetadataSource securityMetadataSource;
public ChannelSecurityInterceptor() {
this(new ChannelSecurityMetadataSource());
}
public ChannelSecurityInterceptor(ChannelSecurityMetadataSource securityMetadataSource) {
Assert.notNull(securityMetadataSource, "securityMetadataSource must not be null");
this.securityMetadataSource = securityMetadataSource;
}
@Override
public Class<?> getSecureObjectClass() {
return ChannelInvocation.class;
}
@Override
public Object invoke(MethodInvocation invocation) throws Throwable { // NOSONAR
Method method = invocation.getMethod();
if (method.getName().equals("send") || method.getName().equals("receive")) {
return this.invokeWithAuthorizationCheck(invocation);
}
return invocation.proceed();
}
private Object invokeWithAuthorizationCheck(MethodInvocation methodInvocation) throws Throwable { // NOSONAR
Object returnValue = null;
InterceptorStatusToken token = super.beforeInvocation(new ChannelInvocation(methodInvocation));
try {
returnValue = methodInvocation.proceed();
}
finally {
returnValue = super.afterInvocation(token, returnValue);
}
return returnValue;
}
@Override
public SecurityMetadataSource obtainSecurityMetadataSource() {
return this.securityMetadataSource;
}
}

View File

@@ -1,110 +0,0 @@
/*
* Copyright 2002-2022 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
*
* https://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.security.channel;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
import org.springframework.integration.support.context.NamedComponent;
import org.springframework.messaging.MessageChannel;
import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.access.SecurityMetadataSource;
import org.springframework.util.Assert;
/**
* The {@link SecurityMetadataSource} implementation for secured {@link MessageChannel}s.
*
* @author Mark Fisher
* @author Oleg Zhurakousky
*
* @deprecated since 6.0 in favor of literally
* {@code new AuthorizationChannelInterceptor(AuthorityAuthorizationManager.hasAnyRole())}
*/
@Deprecated(since = "6.0")
public class ChannelSecurityMetadataSource implements SecurityMetadataSource {
private final Map<Pattern, ChannelAccessPolicy> patternMappings;
public ChannelSecurityMetadataSource() {
this(null);
}
public ChannelSecurityMetadataSource(Map<Pattern, ChannelAccessPolicy> patternMappings) {
this.patternMappings = (patternMappings != null) ? patternMappings
: new LinkedHashMap<Pattern, ChannelAccessPolicy>();
}
public void addPatternMapping(Pattern pattern, ChannelAccessPolicy accessPolicy) {
this.patternMappings.put(pattern, accessPolicy);
}
public Set<Pattern> getPatterns() {
return this.patternMappings.keySet();
}
public Collection<ConfigAttribute> getAttributes(Object object) throws IllegalArgumentException {
Assert.isAssignable(ChannelInvocation.class, object.getClass());
ChannelInvocation invocation = (ChannelInvocation) object;
MessageChannel channel = invocation.getChannel();
Assert.isAssignable(NamedComponent.class, channel.getClass());
String channelName = ((NamedComponent) channel).getComponentName();
List<ConfigAttribute> attributes = new ArrayList<ConfigAttribute>();
for (Map.Entry<Pattern, ChannelAccessPolicy> mapping : this.patternMappings.entrySet()) {
Pattern pattern = mapping.getKey();
ChannelAccessPolicy accessPolicy = mapping.getValue();
if (pattern.matcher(channelName).matches()) {
if (invocation.isSend()) {
Collection<ConfigAttribute> definition = accessPolicy.getConfigAttributesForSend();
if (definition != null) {
attributes.addAll(definition);
}
}
else if (invocation.isReceive()) {
Collection<ConfigAttribute> definition = accessPolicy.getConfigAttributesForReceive();
if (definition != null) {
attributes.addAll(definition);
}
}
}
}
return attributes;
}
public Collection<ConfigAttribute> getAllConfigAttributes() {
Set<ConfigAttribute> allAttributes = new HashSet<ConfigAttribute>();
for (ChannelAccessPolicy policy : this.patternMappings.values()) {
Collection<ConfigAttribute> receiveAttributes = policy.getConfigAttributesForReceive();
allAttributes.addAll(receiveAttributes);
Collection<ConfigAttribute> sendAttributes = policy.getConfigAttributesForSend();
allAttributes.addAll(sendAttributes);
}
return allAttributes;
}
public boolean supports(Class<?> clazz) {
return ChannelInvocation.class.isAssignableFrom(clazz);
}
}

View File

@@ -1,127 +0,0 @@
/*
* Copyright 2002-2022 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
*
* https://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.security.channel;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.access.SecurityConfig;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
/**
* Creates the {@link ConfigAttribute}s for secured channel
* send and receive operations based on simple String values.
*
* @author Mark Fisher
* @author Oleg Zhurakousky
* @author Artem Bilan
*
* @deprecated since 6.0 in favor of literally
* {@code new AuthorizationChannelInterceptor(AuthorityAuthorizationManager.hasAnyRole())}
*/
@Deprecated(since = "6.0")
public class DefaultChannelAccessPolicy implements ChannelAccessPolicy {
private final Collection<ConfigAttribute> configAttributeDefinitionForSend;
private final Collection<ConfigAttribute> configAttributeDefinitionForReceive;
/**
* Create an access policy instance. The provided 'sendAccess' and 'receiveAccess'
* values may be a single String or a comma-delimited list of values. All whitespace
* will be trimmed. A <code>null</code> value indicates that the policy does not
* apply for either send or receive access type. At most one of the values may be null.
* @param sendAccess The send access value(s).
* @param receiveAccess The receive access value(s).
*/
public DefaultChannelAccessPolicy(String sendAccess, String receiveAccess) {
boolean sendAccessDefined = StringUtils.hasText(sendAccess);
boolean receiveAccessDefined = StringUtils.hasText(receiveAccess);
Assert.isTrue(sendAccessDefined || receiveAccessDefined,
"At least one of 'sendAccess' and 'receiveAccess' must not be null and have at least one entry.");
if (sendAccessDefined) {
String[] sendAccessValues = StringUtils.commaDelimitedListToStringArray(sendAccess);
this.configAttributeDefinitionForSend = new HashSet<ConfigAttribute>();
for (String sendAccessValue : sendAccessValues) {
this.configAttributeDefinitionForSend.add(new SecurityConfig(StringUtils.trimAllWhitespace(sendAccessValue)));
}
}
else {
this.configAttributeDefinitionForSend = Collections.emptySet();
}
if (receiveAccessDefined) {
String[] receiveAccessValues = StringUtils.commaDelimitedListToStringArray(receiveAccess);
this.configAttributeDefinitionForReceive = new HashSet<ConfigAttribute>();
for (String receiveAccessValue : receiveAccessValues) {
this.configAttributeDefinitionForReceive.add(new SecurityConfig(StringUtils.trimAllWhitespace(receiveAccessValue)));
}
}
else {
this.configAttributeDefinitionForReceive = Collections.emptySet();
}
}
/**
* Create an access policy instance. A <code>null</code> value indicates that the policy does not
* apply for either send or receive access type. At most one of the values may be null.
* Typically is used for the values from the {@link SecuredChannel}
* @param sendAccess The send access values.
* @param receiveAccess The receive access values.
* @since 4.2
*/
public DefaultChannelAccessPolicy(String[] sendAccess, String[] receiveAccess) {
boolean sendAccessDefined = !ObjectUtils.isEmpty(sendAccess);
boolean receiveAccessDefined = !ObjectUtils.isEmpty(receiveAccess);
Assert.isTrue(sendAccessDefined || receiveAccessDefined,
"At least one of 'sendAccess' and 'receiveAccess' must not be null.");
if (sendAccessDefined) {
this.configAttributeDefinitionForSend = new HashSet<ConfigAttribute>();
for (String sendAccessValue : sendAccess) {
this.configAttributeDefinitionForSend.add(new SecurityConfig(sendAccessValue));
}
}
else {
this.configAttributeDefinitionForSend = Collections.emptySet();
}
if (receiveAccessDefined) {
this.configAttributeDefinitionForReceive = new HashSet<ConfigAttribute>();
for (String receiveAccessValue : receiveAccess) {
this.configAttributeDefinitionForReceive.add(new SecurityConfig(receiveAccessValue));
}
}
else {
this.configAttributeDefinitionForReceive = Collections.emptySet();
}
}
@Override
public Collection<ConfigAttribute> getConfigAttributesForSend() {
return this.configAttributeDefinitionForSend;
}
@Override
public Collection<ConfigAttribute> getConfigAttributesForReceive() {
return this.configAttributeDefinitionForReceive;
}
}

View File

@@ -1,52 +0,0 @@
/*
* Copyright 2015-2022 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
*
* https://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.security.channel;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* An annotation to be applied for the {@link org.springframework.messaging.MessageChannel} bean definition
* from JavaConfig - on {@code @Bean} method level.
* <p>
* Applies the {@link ChannelSecurityInterceptor}(s) using provided {@link #interceptor()} bean name(s).
* <p>
* The {@link #sendAccess()} and {@link #receiveAccess()} policies are populated to the
* {@link ChannelSecurityInterceptor}(s) from the {@code ChannelSecurityInterceptorBeanPostProcessor}.
*
* @author Artem Bilan
* @since 4.2
*
* @deprecated since 6.0 in favor of literally
* {@code new AuthorizationChannelInterceptor(AuthorityAuthorizationManager.hasAnyRole())}
*/
@Deprecated(since = "6.0")
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface SecuredChannel {
String[] interceptor();
String[] sendAccess() default {};
String[] receiveAccess() default {};
}

View File

@@ -1,119 +0,0 @@
/*
* Copyright 2002-2022 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
*
* https://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.security.config;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
import org.springframework.aop.Advisor;
import org.springframework.aop.TargetSource;
import org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator;
import org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.integration.security.channel.ChannelAccessPolicy;
import org.springframework.integration.security.channel.ChannelSecurityInterceptor;
import org.springframework.integration.security.channel.ChannelSecurityMetadataSource;
import org.springframework.lang.Nullable;
import org.springframework.messaging.MessageChannel;
/**
* A {@link org.springframework.beans.factory.config.BeanPostProcessor} that proxies
* {@link MessageChannel}s to apply a {@link ChannelSecurityInterceptor}.
*
* @author Mark Fisher
* @author Oleg Zhurakousky
* @author Artem Bilan
* @author Gary Russell
* @deprecated since 6.0 in favor of literally
* {@code new AuthorizationChannelInterceptor(AuthorityAuthorizationManager.hasAnyRole())}
*/
@Deprecated(since = "6.0")
@SuppressWarnings("serial")
public class ChannelSecurityInterceptorBeanPostProcessor extends AbstractAutoProxyCreator {
private final Map<String, Set<Pattern>> securityInterceptorMappings;
private final Map<String, Map<Pattern, ChannelAccessPolicy>> accessPolicyMapping;
public ChannelSecurityInterceptorBeanPostProcessor(Map<String, Set<Pattern>> securityInterceptorMappings) {
this(securityInterceptorMappings, null);
}
public ChannelSecurityInterceptorBeanPostProcessor(Map<String, Set<Pattern>> securityInterceptorMappings,
Map<String, Map<Pattern, ChannelAccessPolicy>> accessPolicyMapping) {
this.securityInterceptorMappings = securityInterceptorMappings; //NOSONAR (inconsistent sync)
this.accessPolicyMapping = accessPolicyMapping; //NOSONAR (inconsistent sync)
}
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) {
if (this.accessPolicyMapping != null
&& bean instanceof ChannelSecurityInterceptor
&& this.accessPolicyMapping.containsKey(beanName)) {
Map<Pattern, ChannelAccessPolicy> accessPolicies = this.accessPolicyMapping.get(beanName);
ChannelSecurityMetadataSource securityMetadataSource =
(ChannelSecurityMetadataSource) ((ChannelSecurityInterceptor) bean).obtainSecurityMetadataSource();
for (Map.Entry<Pattern, ChannelAccessPolicy> entry : accessPolicies.entrySet()) {
securityMetadataSource.addPatternMapping(entry.getKey(), entry.getValue());
}
}
return bean;
}
@Override
@Nullable
protected Object[] getAdvicesAndAdvisorsForBean(Class<?> beanClass, String beanName,
@Nullable TargetSource customTargetSource) throws BeansException {
if (MessageChannel.class.isAssignableFrom(beanClass)) {
List<Advisor> interceptors = new ArrayList<>();
for (Map.Entry<String, Set<Pattern>> entry : this.securityInterceptorMappings.entrySet()) {
if (isMatch(beanName, entry.getValue())) {
DefaultBeanFactoryPointcutAdvisor channelSecurityInterceptor =
new DefaultBeanFactoryPointcutAdvisor();
channelSecurityInterceptor.setAdviceBeanName(entry.getKey());
BeanFactory beanFactory = getBeanFactory();
if (beanFactory != null) {
channelSecurityInterceptor.setBeanFactory(beanFactory);
}
interceptors.add(channelSecurityInterceptor);
}
}
if (!interceptors.isEmpty()) {
return interceptors.toArray();
}
}
return DO_NOT_PROXY;
}
private boolean isMatch(String beanName, Set<Pattern> patterns) {
for (Pattern pattern : patterns) {
if (pattern.matcher(beanName).matches()) {
return true;
}
}
return false;
}
}

View File

@@ -1,36 +0,0 @@
/*
* Copyright 2002-2022 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
*
* https://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.security.config;
import org.springframework.integration.config.xml.AbstractIntegrationNamespaceHandler;
/**
* Namespace handler for the security namespace.
*
* @author Jonas Partner
*
* @deprecated since 6.0 in favor of literally
* {@code new AuthorizationChannelInterceptor(AuthorityAuthorizationManager.hasAnyRole())}
*/
@Deprecated(since = "6.0", forRemoval = true)
public class IntegrationSecurityNamespaceHandler extends AbstractIntegrationNamespaceHandler {
public void init() {
registerBeanDefinitionParser("secured-channels", new SecuredChannelsParser());
}
}

View File

@@ -1,90 +0,0 @@
/*
* Copyright 2002-2022 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
*
* https://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.security.config;
import java.util.List;
import org.w3c.dom.Element;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.ManagedMap;
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
import org.springframework.integration.security.channel.ChannelSecurityInterceptor;
import org.springframework.integration.security.channel.ChannelSecurityMetadataSource;
import org.springframework.integration.security.channel.DefaultChannelAccessPolicy;
import org.springframework.util.StringUtils;
import org.springframework.util.xml.DomUtils;
/**
* Creates a {@link org.springframework.integration.security.channel.ChannelSecurityInterceptor}
* to control send and receive access, and creates a bean post-processor to apply the
* interceptor to {@link org.springframework.messaging.MessageChannel}s
* whose names match the specified patterns.
*
* @author Jonas Partner
* @author Mark Fisher
* @author Artem Bilan
*
* @deprecated since 6.0 in favor of literally
* {@code new AuthorizationChannelInterceptor(AuthorityAuthorizationManager.hasAnyRole())}
*/
@Deprecated(since = "6.0")
public class SecuredChannelsParser extends AbstractSingleBeanDefinitionParser {
@Override
protected Class<?> getBeanClass(Element element) {
return ChannelSecurityInterceptor.class;
}
@Override
protected boolean shouldGenerateId() {
return true;
}
@Override
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
builder.addConstructorArgValue(this.parseSecurityMetadataSource(element, parserContext));
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "authentication-manager");
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "access-decision-manager");
}
private BeanDefinition parseSecurityMetadataSource(Element element, ParserContext parserContext) {
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(ChannelSecurityMetadataSource.class);
List<Element> accessPolicyElements = DomUtils.getChildElementsByTagName(element, "access-policy");
ManagedMap<String, BeanDefinition> patternMappings = new ManagedMap<String, BeanDefinition>();
for (Element accessPolicyElement : accessPolicyElements) {
String sendAccess = accessPolicyElement.getAttribute("send-access");
String receiveAccess = accessPolicyElement.getAttribute("receive-access");
if (!StringUtils.hasText(sendAccess) && !StringUtils.hasText(receiveAccess)) {
parserContext.getReaderContext().error(
"At least one of 'send-access' or 'receive-access' must be provided.", accessPolicyElement);
}
BeanDefinitionBuilder accessPolicyBuilder = BeanDefinitionBuilder.genericBeanDefinition(DefaultChannelAccessPolicy.class);
accessPolicyBuilder.addConstructorArgValue(sendAccess);
accessPolicyBuilder.addConstructorArgValue(receiveAccess);
accessPolicyBuilder.getBeanDefinition().setRole(BeanDefinition.ROLE_SUPPORT);
patternMappings.put(accessPolicyElement.getAttribute("pattern"), accessPolicyBuilder.getBeanDefinition());
}
builder.addConstructorArgValue(patternMappings);
return builder.getBeanDefinition();
}
}

View File

@@ -1,151 +0,0 @@
/*
* Copyright 2014-2022 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
*
* https://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.security.config;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.config.ConstructorArgumentValues;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.ManagedMap;
import org.springframework.beans.factory.support.ManagedSet;
import org.springframework.core.type.MethodMetadata;
import org.springframework.integration.config.IntegrationConfigurationInitializer;
import org.springframework.integration.security.channel.ChannelAccessPolicy;
import org.springframework.integration.security.channel.ChannelSecurityInterceptor;
import org.springframework.integration.security.channel.DefaultChannelAccessPolicy;
import org.springframework.integration.security.channel.SecuredChannel;
/**
* The Integration Security infrastructure {@code beanFactory} initializer.
*
* @author Artem Bilan
*
* @since 4.0
*
* @deprecated since 6.0 in favor of literally
* {@code new AuthorizationChannelInterceptor(AuthorityAuthorizationManager.hasAnyRole())}
*/
@Deprecated(since = "6.0", forRemoval = true)
public class SecurityIntegrationConfigurationInitializer implements IntegrationConfigurationInitializer {
private static final String CHANNEL_SECURITY_INTERCEPTOR_BPP_BEAN_NAME =
ChannelSecurityInterceptorBeanPostProcessor.class.getName();
@Override
public void initialize(ConfigurableListableBeanFactory beanFactory) throws BeansException {
BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory;
Map<String, Set<String>> securityInterceptors = new ManagedMap<>();
Map<String, Map<Pattern, ChannelAccessPolicy>> policies = new HashMap<>();
for (String beanName : registry.getBeanDefinitionNames()) {
BeanDefinition beanDefinition = registry.getBeanDefinition(beanName);
if (ChannelSecurityInterceptor.class.getName().equals(beanDefinition.getBeanClassName())) {
collectPatternsFromInterceptor(securityInterceptors, beanName, beanDefinition);
}
else if (beanDefinition instanceof AnnotatedBeanDefinition) {
Object beanSource = beanDefinition.getSource();
if (beanSource instanceof MethodMetadata) {
collectInterceptorsAndPoliciesBySecuredChannel(securityInterceptors, policies, beanName,
(MethodMetadata) beanSource);
}
}
}
if (!securityInterceptors.isEmpty()) {
BeanDefinitionBuilder builder =
BeanDefinitionBuilder.rootBeanDefinition(ChannelSecurityInterceptorBeanPostProcessor.class)
.addConstructorArgValue(securityInterceptors);
if (!policies.isEmpty()) {
builder.addConstructorArgValue(policies);
}
registry.registerBeanDefinition(CHANNEL_SECURITY_INTERCEPTOR_BPP_BEAN_NAME, builder.getBeanDefinition());
}
}
@SuppressWarnings("unchecked")
private void collectPatternsFromInterceptor(Map<String, Set<String>> securityInterceptors, String beanName,
BeanDefinition beanDefinition) {
ConstructorArgumentValues.ValueHolder metadataSourceValueHolder =
beanDefinition
.getConstructorArgumentValues()
.getIndexedArgumentValue(0, BeanDefinition.class);
if (metadataSourceValueHolder != null) {
BeanDefinition metadataSource = (BeanDefinition) metadataSourceValueHolder.getValue();
if (metadataSource != null) {
ConstructorArgumentValues.ValueHolder patternMappingsValueHolder =
metadataSource
.getConstructorArgumentValues()
.getIndexedArgumentValue(0, Map.class);
if (patternMappingsValueHolder != null) {
Map<String, ?> patternsToAdd = (Map<String, ?>) patternMappingsValueHolder.getValue();
Set<String> patterns = new ManagedSet<>();
if (!securityInterceptors.containsKey(beanName)) {
securityInterceptors.put(beanName, patterns);
}
else {
patterns = securityInterceptors.get(beanName);
}
if (patternsToAdd != null) {
patterns.addAll(patternsToAdd.keySet());
}
}
}
}
}
private void collectInterceptorsAndPoliciesBySecuredChannel(Map<String, Set<String>> securityInterceptors,
Map<String, Map<Pattern, ChannelAccessPolicy>> policies, String beanName, MethodMetadata beanMethod) {
Map<String, Object> securedAttributes = beanMethod.getAnnotationAttributes(SecuredChannel.class.getName());
if (securedAttributes != null) {
String[] interceptors = (String[]) securedAttributes.get("interceptor");
String[] sendAccess = (String[]) securedAttributes.get("sendAccess");
String[] receiveAccess = (String[]) securedAttributes.get("receiveAccess");
ChannelAccessPolicy accessPolicy = new DefaultChannelAccessPolicy(sendAccess, receiveAccess);
for (String interceptor : interceptors) {
Set<String> patterns = new ManagedSet<>();
if (!securityInterceptors.containsKey(interceptor)) {
securityInterceptors.put(interceptor, patterns);
}
else {
patterns = securityInterceptors.get(interceptor);
}
patterns.add(beanName);
Map<Pattern, ChannelAccessPolicy> mapping = new HashMap<>();
if (!policies.containsKey(interceptor)) {
policies.put(interceptor, mapping);
}
else {
mapping = policies.get(interceptor);
}
mapping.put(Pattern.compile(beanName), accessPolicy);
}
}
}
}

View File

@@ -1,4 +0,0 @@
/**
* Provides classes for configuration - parsers, namespace handlers, bean post processors.
*/
package org.springframework.integration.security.config;

View File

@@ -1,2 +0,0 @@
org.springframework.integration.config.IntegrationConfigurationInitializer=\
org.springframework.integration.security.config.SecurityIntegrationConfigurationInitializer

View File

@@ -1 +0,0 @@
http\://www.springframework.org/schema/integration/security=org.springframework.integration.security.config.IntegrationSecurityNamespaceHandler

View File

@@ -1,24 +0,0 @@
http\://www.springframework.org/schema/integration/security/spring-integration-security-2.0.xsd=org/springframework/integration/security/config/spring-integration-security.xsd
http\://www.springframework.org/schema/integration/security/spring-integration-security-2.1.xsd=org/springframework/integration/security/config/spring-integration-security.xsd
http\://www.springframework.org/schema/integration/security/spring-integration-security-2.2.xsd=org/springframework/integration/security/config/spring-integration-security.xsd
http\://www.springframework.org/schema/integration/security/spring-integration-security-3.0.xsd=org/springframework/integration/security/config/spring-integration-security.xsd
http\://www.springframework.org/schema/integration/security/spring-integration-security-4.0.xsd=org/springframework/integration/security/config/spring-integration-security.xsd
http\://www.springframework.org/schema/integration/security/spring-integration-security-4.1.xsd=org/springframework/integration/security/config/spring-integration-security.xsd
http\://www.springframework.org/schema/integration/security/spring-integration-security-4.2.xsd=org/springframework/integration/security/config/spring-integration-security.xsd
http\://www.springframework.org/schema/integration/security/spring-integration-security-4.3.xsd=org/springframework/integration/security/config/spring-integration-security.xsd
http\://www.springframework.org/schema/integration/security/spring-integration-security-5.0.xsd=org/springframework/integration/security/config/spring-integration-security.xsd
http\://www.springframework.org/schema/integration/security/spring-integration-security-5.1.xsd=org/springframework/integration/security/config/spring-integration-security.xsd
http\://www.springframework.org/schema/integration/security/spring-integration-security-5.2.xsd=org/springframework/integration/security/config/spring-integration-security.xsd
http\://www.springframework.org/schema/integration/security/spring-integration-security.xsd=org/springframework/integration/security/config/spring-integration-security.xsd
https\://www.springframework.org/schema/integration/security/spring-integration-security-2.0.xsd=org/springframework/integration/security/config/spring-integration-security.xsd
https\://www.springframework.org/schema/integration/security/spring-integration-security-2.1.xsd=org/springframework/integration/security/config/spring-integration-security.xsd
https\://www.springframework.org/schema/integration/security/spring-integration-security-2.2.xsd=org/springframework/integration/security/config/spring-integration-security.xsd
https\://www.springframework.org/schema/integration/security/spring-integration-security-3.0.xsd=org/springframework/integration/security/config/spring-integration-security.xsd
https\://www.springframework.org/schema/integration/security/spring-integration-security-4.0.xsd=org/springframework/integration/security/config/spring-integration-security.xsd
https\://www.springframework.org/schema/integration/security/spring-integration-security-4.1.xsd=org/springframework/integration/security/config/spring-integration-security.xsd
https\://www.springframework.org/schema/integration/security/spring-integration-security-4.2.xsd=org/springframework/integration/security/config/spring-integration-security.xsd
https\://www.springframework.org/schema/integration/security/spring-integration-security-4.3.xsd=org/springframework/integration/security/config/spring-integration-security.xsd
https\://www.springframework.org/schema/integration/security/spring-integration-security-5.0.xsd=org/springframework/integration/security/config/spring-integration-security.xsd
https\://www.springframework.org/schema/integration/security/spring-integration-security-5.1.xsd=org/springframework/integration/security/config/spring-integration-security.xsd
https\://www.springframework.org/schema/integration/security/spring-integration-security-5.2.xsd=org/springframework/integration/security/config/spring-integration-security.xsd
https\://www.springframework.org/schema/integration/security/spring-integration-security.xsd=org/springframework/integration/security/config/spring-integration-security.xsd

View File

@@ -1,4 +0,0 @@
# Tooling related information for the integration security namespace
http\://www.springframework.org/schema/integration/security@name=integration security Namespace
http\://www.springframework.org/schema/integration/security@prefix=int-security
http\://www.springframework.org/schema/integration/security@icon=org/springframework/integration/security/config/spring-integration-security.gif

View File

@@ -1,56 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns="http://www.springframework.org/schema/integration/security"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tool="http://www.springframework.org/schema/tool"
targetNamespace="http://www.springframework.org/schema/integration/security"
elementFormDefault="qualified">
<xsd:import namespace="http://www.springframework.org/schema/beans"/>
<xsd:import namespace="http://www.springframework.org/schema/tool"/>
<xsd:element name="secured-channels">
<xsd:complexType>
<xsd:annotation>
<xsd:documentation>
Defines a 'org.springframework.integration.security.channel.ChannelSecurityInterceptor' security
requirements for one or more Message Channels.
</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="access-policy" type="accessPolicyType" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="authentication-manager" type="xsd:string" default="authenticationManager">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type
type="org.springframework.security.authentication.AuthenticationManager"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="access-decision-manager" type="xsd:string" default="accessDecisionManager">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.security.access.AccessDecisionManager"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="accessPolicyType">
<xsd:annotation>
<xsd:documentation>
Defines the security access policy for send and/or receive invocations based on a Message Channel name
pattern.
</xsd:documentation>
</xsd:annotation>
<xsd:attribute name="pattern" type="xsd:string" use="required"/>
<xsd:attribute name="send-access" type="xsd:string"/>
<xsd:attribute name="receive-access" type="xsd:string"/>
</xsd:complexType>
</xsd:schema>

View File

@@ -62,7 +62,7 @@ flowFromSupplier() {
====
But unfortunately not all `from()` methods are compatible with Groovy structures.
To solve this, Spring Integration provides a Groovy DSL factory around the `IntegrationFlows` factory.
To solve this, Spring Integration provides a Groovy DSL factory around the `IntegrationFlow` factory.
It is implemented as a set of overloaded `integrationFlow()` functions.
With a consumer for a `GroovyIntegrationFlowDefinition` to declare the remainder of the flow as an `IntegrationFlow` closure to reuse the mentioned above experience and also avoid the need for a `get()` call in the end.
For example: