INT-3913 Remove/resolve deprecation from the past
JIRA: https://jira.spring.io/browse/INT-3913 * Remove deprecated classes and methods/constructors, deprecated XML attributes * Remove `TcpConnectionEventListeningMessageProducer` and rework tests logic to the `ApplicationEventListeningMessageProducer` * Fix several typos * Remove/rework deprecated entities mentioning
This commit is contained in:
committed by
Gary Russell
parent
ea4763faa9
commit
eaed954458
@@ -389,6 +389,7 @@ project('spring-integration-ip') {
|
||||
dependencies {
|
||||
compile project(":spring-integration-core")
|
||||
testCompile project(":spring-integration-stream")
|
||||
testCompile project(":spring-integration-event")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ import org.springframework.amqp.rabbit.core.RabbitTemplate.ReturnCallback;
|
||||
import org.springframework.amqp.rabbit.support.CorrelationData;
|
||||
import org.springframework.amqp.support.converter.MessageConverter;
|
||||
import org.springframework.context.Lifecycle;
|
||||
import org.springframework.expression.Expression;
|
||||
import org.springframework.integration.amqp.support.MappingUtils;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -53,36 +52,10 @@ public class AmqpOutboundEndpoint extends AbstractAmqpOutboundEndpoint
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param exchangeNameExpression the expression to set.
|
||||
* @deprecated in favor of {@link #setExchangeNameExpression}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setExpressionExchangeName(Expression exchangeNameExpression) {
|
||||
setExchangeNameExpression(exchangeNameExpression);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param routingKeyExpression the expression to set.
|
||||
* @deprecated in favor of {@link #setRoutingKeyExpression}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setExpressionRoutingKey(Expression routingKeyExpression) {
|
||||
setRoutingKeyExpression(routingKeyExpression);
|
||||
}
|
||||
|
||||
public void setExpectReply(boolean expectReply) {
|
||||
this.expectReply = expectReply;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param confirmCorrelationExpression the expression to set.
|
||||
* @deprecated in favor of {@link #setConfirmCorrelationExpression}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setExpressionConfirmCorrelation(Expression confirmCorrelationExpression) {
|
||||
setConfirmCorrelationExpression(confirmCorrelationExpression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComponentType() {
|
||||
|
||||
@@ -113,15 +113,6 @@ public class DefaultAmqpHeaderMapper extends AbstractHeaderMapper<MessagePropert
|
||||
CONSUMER_METADATA_PRESENT = consumerTagHeader.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated - use {@link #inboundMapper()} and {@link #outboundMapper()} depending
|
||||
* on the context in which the mapper is to be used.
|
||||
*/
|
||||
@Deprecated
|
||||
public DefaultAmqpHeaderMapper() {
|
||||
this(null, null);
|
||||
}
|
||||
|
||||
private DefaultAmqpHeaderMapper(String[] requestHeaderNames, String[] replyHeaderNames) {
|
||||
super(AmqpHeaders.PREFIX, STANDARD_HEADER_NAMES, STANDARD_HEADER_NAMES);
|
||||
if (requestHeaderNames != null) {
|
||||
|
||||
@@ -819,7 +819,7 @@ standard headers to also be mapped. To map all non-standard headers the 'NON_STA
|
||||
Attributes for a SimpleMessageListenerContainer's properties other than queues, queueNames, messageListener, and
|
||||
autoStartup which may or may not be exposed for configuration depending on what type of component uses this attribute group.
|
||||
This group also does not include any of the properties that are shared with RabbitTemplate, such as channelTransacted,
|
||||
connectionFactory, and messsagePropertiesConverter.
|
||||
connectionFactory, and messagePropertiesConverter.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:attribute name="channel-transacted" type="xsd:string">
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2016 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.aggregator;
|
||||
|
||||
import org.springframework.integration.store.MessageGroup;
|
||||
|
||||
/**
|
||||
* This implementation of MessageGroupProcessor will return all messages inside the group.
|
||||
* This is useful if there is no requirement to process the messages, but they should just be
|
||||
* blocked as a group until their ReleaseStrategy lets them pass through.
|
||||
*
|
||||
* @deprecated since 4.2; use {@link SimpleMessageGroupProcessor}
|
||||
*
|
||||
* @author Iwein Fuld
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@Deprecated
|
||||
public class PassThroughMessageGroupProcessor implements MessageGroupProcessor {
|
||||
|
||||
@Override
|
||||
public Object processMessageGroup(MessageGroup group) {
|
||||
return group.getMessages();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2010 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.annotation;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Annotation indicating that a method parameter's value should be
|
||||
* retrieved from the message headers. The value of the annotation
|
||||
* can either be a header name (e.g., 'foo') or SpEL expression
|
||||
* (e.g., 'payload.getCustomerId()') which is quite useful when
|
||||
* the name of the header has to be dynamically computed. It also
|
||||
* provides an optional 'required' property which
|
||||
* specifies whether the attribute value must be available within
|
||||
* the header. The default value for 'required' is <code>true</code>.
|
||||
*
|
||||
* @author Mark Fisher
|
||||
*
|
||||
* @deprecated since 4.1 in favor of {@link org.springframework.messaging.handler.annotation.Header}.
|
||||
* Will be removed in a future release.
|
||||
*/
|
||||
@Target(ElementType.PARAMETER)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Deprecated
|
||||
public @interface Header {
|
||||
|
||||
String value() default "";
|
||||
|
||||
boolean required() default true;
|
||||
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2010 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.annotation;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Annotation indicating that a method parameter's value should be mapped to or
|
||||
* from the message headers. The annotated parameter must be assignable to
|
||||
* {@link java.util.Map}, and all of the Map's keys must be Strings.
|
||||
*
|
||||
* @author Mark Fisher
|
||||
*
|
||||
* @deprecated since 4.1 in favor of {@link org.springframework.messaging.handler.annotation.Headers}.
|
||||
* Will be removed in a future release.
|
||||
*/
|
||||
@Target(ElementType.PARAMETER)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Deprecated
|
||||
public @interface Headers {
|
||||
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2014 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.annotation;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* This annotation allows you to specify a SpEL expression indicating that a method
|
||||
* parameter's value should be mapped from the payload of a Message. The expression
|
||||
* will be evaluated against the payload object as the root context. The annotated
|
||||
* parameter type must match or be convertible from the evaluation result.
|
||||
* <p>
|
||||
* Example: void foo(@Payload("city.name") String cityName) - will map the value of
|
||||
* the 'name' property of the 'city' property of the payload object.
|
||||
*
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*
|
||||
* @deprecated since 4.1 in favor of {@link org.springframework.messaging.handler.annotation.Payload}.
|
||||
* Will be removed in a future release.
|
||||
*/
|
||||
@Target({ElementType.PARAMETER, ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Deprecated
|
||||
public @interface Payload {
|
||||
|
||||
/**
|
||||
* @return The expression for matching against nested properties of the payload.
|
||||
*/
|
||||
String value() default "";
|
||||
|
||||
}
|
||||
@@ -74,14 +74,9 @@ public class MethodAnnotationPublisherMetadataSource implements PublisherMetadat
|
||||
return (StringUtils.hasText(channelName) ? channelName : null);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public String getPayloadExpression(Method method) {
|
||||
String payloadExpression = null;
|
||||
Annotation methodPayloadAnnotation =
|
||||
AnnotationUtils.findAnnotation(method, org.springframework.integration.annotation.Payload.class);
|
||||
if (methodPayloadAnnotation == null) {
|
||||
methodPayloadAnnotation = AnnotationUtils.findAnnotation(method, Payload.class);
|
||||
}
|
||||
Annotation methodPayloadAnnotation = AnnotationUtils.findAnnotation(method, Payload.class);
|
||||
|
||||
if (methodPayloadAnnotation != null) {
|
||||
payloadExpression = getAnnotationValue(methodPayloadAnnotation, null, String.class);
|
||||
@@ -94,8 +89,7 @@ public class MethodAnnotationPublisherMetadataSource implements PublisherMetadat
|
||||
for (int i = 0; i < annotationArray.length; i++) {
|
||||
Annotation[] parameterAnnotations = annotationArray[i];
|
||||
for (Annotation currentAnnotation : parameterAnnotations) {
|
||||
if (org.springframework.integration.annotation.Payload.class.equals(currentAnnotation.annotationType())
|
||||
|| Payload.class.equals(currentAnnotation.annotationType())) {
|
||||
if (Payload.class.equals(currentAnnotation.annotationType())) {
|
||||
Assert.state(payloadExpression == null,
|
||||
"@Payload can be used at most once on a @Publisher method, " +
|
||||
"either at method-level or on a single parameter");
|
||||
@@ -114,7 +108,6 @@ public class MethodAnnotationPublisherMetadataSource implements PublisherMetadat
|
||||
return payloadExpression;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public Map<String, String> getHeaderExpressions(Method method) {
|
||||
Map<String, String> headerExpressions = new HashMap<String, String>();
|
||||
String[] parameterNames = this.parameterNameDiscoverer.getParameterNames(method);
|
||||
@@ -122,8 +115,7 @@ public class MethodAnnotationPublisherMetadataSource implements PublisherMetadat
|
||||
for (int i = 0; i < annotationArray.length; i++) {
|
||||
Annotation[] parameterAnnotations = annotationArray[i];
|
||||
for (Annotation currentAnnotation : parameterAnnotations) {
|
||||
if (org.springframework.integration.annotation.Header.class.equals(currentAnnotation.annotationType())
|
||||
|| Header.class.equals(currentAnnotation.annotationType())) {
|
||||
if (Header.class.equals(currentAnnotation.annotationType())) {
|
||||
String name = getAnnotationValue(currentAnnotation, null, String.class);
|
||||
if (!StringUtils.hasText(name)) {
|
||||
name = parameterNames[i];
|
||||
|
||||
@@ -25,7 +25,7 @@ package org.springframework.integration.codec.kryo;
|
||||
public class MessageCodec extends PojoCodec {
|
||||
|
||||
/**
|
||||
* Construct an instance using the default registration ids for messsage
|
||||
* Construct an instance using the default registration ids for message
|
||||
* headers.
|
||||
*/
|
||||
public MessageCodec() {
|
||||
|
||||
@@ -47,32 +47,6 @@ public class CorrelationStrategyFactoryBean implements FactoryBean<CorrelationSt
|
||||
public CorrelationStrategyFactoryBean() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a factory and set up the strategy which clients of the factory will see as its product.
|
||||
* @param target the target object (null if default strategy is acceptable)
|
||||
* @deprecated since {@literal 4.2.5} in favor of appropriate setters
|
||||
* to avoid {@code BeanCurrentlyInCreationException}
|
||||
* during {@code AbstractAutowireCapableBeanFactory.getSingletonFactoryBeanForTypeCheck()}
|
||||
*/
|
||||
@Deprecated
|
||||
public CorrelationStrategyFactoryBean(Object target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a factory and set up the strategy which clients of the factory will see as its product.
|
||||
* @param target the target object (null if default strategy is acceptable)
|
||||
* @param methodName the method name to invoke in the target (null if it can be inferred)
|
||||
* @deprecated since {@literal 4.2.5} in favor of appropriate setters
|
||||
* to avoid {@code BeanCurrentlyInCreationException}
|
||||
* during {@code AbstractAutowireCapableBeanFactory.getSingletonFactoryBeanForTypeCheck()}
|
||||
*/
|
||||
@Deprecated
|
||||
public CorrelationStrategyFactoryBean(Object target, String methodName) {
|
||||
this.target = target;
|
||||
this.methodName = methodName;
|
||||
}
|
||||
|
||||
public void setTarget(Object target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@ import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.beans.factory.support.ManagedSet;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
@@ -187,12 +186,6 @@ public class IntegrationRegistrar implements ImportBeanDefinitionRegistrar, Bean
|
||||
IntegrationContextUtils.INTEGRATION_EVALUATION_CONTEXT_BEAN_NAME);
|
||||
|
||||
BeanDefinitionReaderUtils.registerBeanDefinition(integrationEvaluationContextHolder, registry);
|
||||
|
||||
//TODO Remove this registration in 5.0
|
||||
RootBeanDefinition integrationEvalContextBPP =
|
||||
new RootBeanDefinition(IntegrationConfigUtils.BASE_PACKAGE +
|
||||
".expression.IntegrationEvaluationContextAwareBeanPostProcessor");
|
||||
BeanDefinitionReaderUtils.registerWithGeneratedName(integrationEvalContextBPP, registry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,32 +51,6 @@ public class ReleaseStrategyFactoryBean implements FactoryBean<ReleaseStrategy>,
|
||||
public ReleaseStrategyFactoryBean() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a factory and set up the strategy which clients of the factory will see as its product.
|
||||
* @param target the target object (null if default strategy is acceptable)
|
||||
* @deprecated since {@literal 4.2.5} in favor of appropriate setters
|
||||
* to avoid {@code BeanCurrentlyInCreationException}
|
||||
* during {@code AbstractAutowireCapableBeanFactory.getSingletonFactoryBeanForTypeCheck()}
|
||||
*/
|
||||
@Deprecated
|
||||
public ReleaseStrategyFactoryBean(Object target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a factory and set up the strategy which clients of the factory will see as its product.
|
||||
* @param target the target object (null if default strategy is acceptable)
|
||||
* @param methodName the method name to invoke in the target (null if it can be inferred)
|
||||
* @deprecated since {@literal 4.2.5} in favor of appropriate setters
|
||||
* to avoid {@code BeanCurrentlyInCreationException}
|
||||
* during {@code AbstractAutowireCapableBeanFactory.getSingletonFactoryBeanForTypeCheck()}
|
||||
*/
|
||||
@Deprecated
|
||||
public ReleaseStrategyFactoryBean(Object target, String methodName) {
|
||||
this.target = target;
|
||||
this.methodName = methodName;
|
||||
}
|
||||
|
||||
public void setTarget(Object target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
@@ -63,15 +63,6 @@ public class RouterFactoryBean extends AbstractStandardMessageHandlerFactoryBean
|
||||
this.defaultOutputChannelName = defaultOutputChannelName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param timeout the timeout.
|
||||
* @deprecated in favor of {@link #setSendTimeout(Long)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setTimeout(Long timeout) {
|
||||
this.sendTimeout = timeout;
|
||||
}
|
||||
|
||||
public void setSendTimeout(Long timeout) {
|
||||
this.sendTimeout = timeout;
|
||||
}
|
||||
|
||||
@@ -54,15 +54,6 @@ public abstract class ExpressionMessageProducerSupport extends MessageProducerSu
|
||||
this.payloadExpression = EXPRESSION_PARSER.parseExpression(payloadExpression);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param payloadExpression the expression to set.
|
||||
* @deprecated in favor of {@link #setPayloadExpression}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setExpressionPayload(Expression payloadExpression) {
|
||||
setPayloadExpression(payloadExpression);
|
||||
}
|
||||
|
||||
public void setIntegrationEvaluationContext(EvaluationContext evaluationContext) {
|
||||
this.evaluationContext = evaluationContext;
|
||||
}
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013 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.expression;
|
||||
|
||||
import org.springframework.expression.EvaluationContext;
|
||||
import org.springframework.integration.context.IntegrationContextUtils;
|
||||
|
||||
/**
|
||||
* Interface to be implemented by beans that wish to be aware of their
|
||||
* owning integration {@link EvaluationContext}, which is the result of
|
||||
* {@link org.springframework.integration.config.IntegrationEvaluationContextFactoryBean}
|
||||
* <p>
|
||||
* The {@link #setIntegrationEvaluationContext} is invoked from
|
||||
* the {@code IntegrationEvaluationContextAwareBeanPostProcessor#afterSingletonsInstantiated()},
|
||||
* not during standard {@code postProcessBefore(After)Initialization} to avoid any
|
||||
* {@code BeanFactory} early access during integration {@link EvaluationContext} retrieval.
|
||||
* Therefore, if it is necessary to use {@link EvaluationContext} in the {@code afterPropertiesSet()},
|
||||
* the {@code IntegrationContextUtils.getEvaluationContext(this.beanFactory)} should be used instead
|
||||
* of this interface implementation.
|
||||
*
|
||||
* @author Artem Bilan
|
||||
* @since 3.0
|
||||
* @deprecated since 4.2 in favor of {@link IntegrationContextUtils#getEvaluationContext}
|
||||
* direct usage from the {@code afterPropertiesSet} implementation.
|
||||
* Will be removed in the next release.
|
||||
*/
|
||||
@Deprecated
|
||||
public interface IntegrationEvaluationContextAware {
|
||||
|
||||
void setIntegrationEvaluationContext(EvaluationContext evaluationContext);
|
||||
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013-2015 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.expression;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
import org.springframework.beans.factory.SmartInitializingSingleton;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||
import org.springframework.integration.context.IntegrationContextUtils;
|
||||
|
||||
/**
|
||||
* @author Artem Bilan
|
||||
* @author Gary Russell
|
||||
* @since 3.0
|
||||
* @deprecated since 4.2 in favor of {@link IntegrationContextUtils#getEvaluationContext}
|
||||
* direct usage from the {@code afterPropertiesSet} implementation.
|
||||
* Will be removed in the next release.
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("deprecation")
|
||||
public class IntegrationEvaluationContextAwareBeanPostProcessor
|
||||
implements BeanPostProcessor, Ordered, BeanFactoryAware, SmartInitializingSingleton {
|
||||
|
||||
private final List<IntegrationEvaluationContextAware> evaluationContextAwares =
|
||||
new ArrayList<IntegrationEvaluationContextAware>();
|
||||
|
||||
private volatile BeanFactory beanFactory;
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
|
||||
this.beanFactory = beanFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
|
||||
if (bean instanceof IntegrationEvaluationContextAware) {
|
||||
this.evaluationContextAwares.add((IntegrationEvaluationContextAware) bean);
|
||||
}
|
||||
return bean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
|
||||
return bean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterSingletonsInstantiated() {
|
||||
StandardEvaluationContext evaluationContext = IntegrationContextUtils.getEvaluationContext(this.beanFactory);
|
||||
for (IntegrationEvaluationContextAware evaluationContextAware : this.evaluationContextAwares) {
|
||||
evaluationContextAware.setIntegrationEvaluationContext(evaluationContext);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return LOWEST_PRECEDENCE;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -254,13 +254,9 @@ class GatewayMethodInboundMessageMapper implements InboundMessageMapper<Object[]
|
||||
return parameterList;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private static Expression parsePayloadExpression(Method method) {
|
||||
Expression expression = null;
|
||||
Annotation payload = method.getAnnotation(org.springframework.integration.annotation.Payload.class);
|
||||
if (payload == null) {
|
||||
payload = method.getAnnotation(Payload.class);
|
||||
}
|
||||
Annotation payload = method.getAnnotation(Payload.class);
|
||||
if (payload != null) {
|
||||
String expressionString = (String) AnnotationUtils.getValue(payload);
|
||||
Assert.hasText(expressionString,
|
||||
@@ -273,7 +269,6 @@ class GatewayMethodInboundMessageMapper implements InboundMessageMapper<Object[]
|
||||
public class DefaultMethodArgsMessageMapper implements MethodArgsMessageMapper {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public Message<?> toMessage(MethodArgsHolder holder) throws Exception {
|
||||
Object messageOrPayload = null;
|
||||
boolean foundPayloadAnnotation = false;
|
||||
@@ -290,23 +285,20 @@ class GatewayMethodInboundMessageMapper implements InboundMessageMapper<Object[]
|
||||
Annotation annotation =
|
||||
MessagingAnnotationUtils.findMessagePartAnnotation(methodParameter.getParameterAnnotations(), false);
|
||||
if (annotation != null) {
|
||||
if (annotation.annotationType().equals(org.springframework.integration.annotation.Payload.class)
|
||||
|| annotation.annotationType().equals(Payload.class)) {
|
||||
if (annotation.annotationType().equals(Payload.class)) {
|
||||
if (messageOrPayload != null) {
|
||||
GatewayMethodInboundMessageMapper.this.throwExceptionForMultipleMessageOrPayloadParameters(methodParameter);
|
||||
throwExceptionForMultipleMessageOrPayloadParameters(methodParameter);
|
||||
}
|
||||
String expression = (String) AnnotationUtils.getValue(annotation);
|
||||
if (!StringUtils.hasText(expression)) {
|
||||
messageOrPayload = argumentValue;
|
||||
}
|
||||
else {
|
||||
messageOrPayload =
|
||||
GatewayMethodInboundMessageMapper.this.evaluatePayloadExpression(expression, argumentValue);
|
||||
messageOrPayload = evaluatePayloadExpression(expression, argumentValue);
|
||||
}
|
||||
foundPayloadAnnotation = true;
|
||||
}
|
||||
else if (annotation.annotationType().equals(org.springframework.integration.annotation.Header.class)
|
||||
|| annotation.annotationType().equals(Header.class)) {
|
||||
else if (annotation.annotationType().equals(Header.class)) {
|
||||
String headerName =
|
||||
GatewayMethodInboundMessageMapper.this.determineHeaderName(annotation, methodParameter);
|
||||
if ((Boolean) AnnotationUtils.getValue(annotation, "required") && argumentValue == null) {
|
||||
@@ -315,8 +307,7 @@ class GatewayMethodInboundMessageMapper implements InboundMessageMapper<Object[]
|
||||
}
|
||||
headers.put(headerName, argumentValue);
|
||||
}
|
||||
else if (annotation.annotationType().equals(org.springframework.integration.annotation.Headers.class)
|
||||
|| annotation.annotationType().equals(Headers.class)) {
|
||||
else if (annotation.annotationType().equals(Headers.class)) {
|
||||
if (argumentValue != null) {
|
||||
if (!(argumentValue instanceof Map)) {
|
||||
throw new IllegalArgumentException("@Headers annotation is only valid for Map-typed parameters");
|
||||
|
||||
@@ -376,7 +376,6 @@ public class GatewayProxyFactoryBean extends AbstractEndpoint
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public Object invoke(final MethodInvocation invocation) throws Throwable {
|
||||
final Class<?> returnType = invocation.getMethod().getReturnType();
|
||||
if (this.asyncExecutor != null && !Object.class.equals(returnType)) {
|
||||
@@ -426,10 +425,7 @@ public class GatewayProxyFactoryBean extends AbstractEndpoint
|
||||
boolean shouldReply = returnType != void.class;
|
||||
int paramCount = method.getParameterTypes().length;
|
||||
Object response = null;
|
||||
@SuppressWarnings("deprecation")
|
||||
boolean hasPayloadExpression =
|
||||
method.isAnnotationPresent(org.springframework.integration.annotation.Payload.class)
|
||||
|| method.isAnnotationPresent(Payload.class);
|
||||
boolean hasPayloadExpression = method.isAnnotationPresent(Payload.class);
|
||||
if (!hasPayloadExpression && this.methodMetadataMap != null) {
|
||||
// check for the method metadata next
|
||||
GatewayMethodMetadata metadata = this.methodMetadataMap.get(method.getName());
|
||||
@@ -702,7 +698,7 @@ public class GatewayProxyFactoryBean extends AbstractEndpoint
|
||||
if (t instanceof RuntimeException) {
|
||||
throw (RuntimeException) t;
|
||||
}
|
||||
throw new MessagingException("asynchronous gateway invocation failed", t);
|
||||
throw new MessagingException("Asynchronous gateway invocation failed", t);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -89,16 +89,6 @@ public class LoggingHandler extends AbstractMessageHandler {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a SpEL expression string to use.
|
||||
* @param expressionString the SpEL expression string to use.
|
||||
* @deprecated in favor of {@link #setLogExpressionString(String)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void setExpression(String expressionString) {
|
||||
setLogExpressionString(expressionString);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a SpEL expression string to use.
|
||||
* @param expressionString the SpEL expression string to use.
|
||||
|
||||
@@ -92,17 +92,6 @@ public abstract class AbstractMessageRouter extends AbstractMessageHandler imple
|
||||
this.defaultOutputChannelName = defaultOutputChannelName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the timeout for sending a message to the resolved channel. By default, there is no timeout, meaning the send
|
||||
* will block indefinitely.
|
||||
* @param timeout The timeout.
|
||||
* @deprecated in favor of {@link #setSendTimeout(long)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setTimeout(long timeout) {
|
||||
this.messagingTemplate.setSendTimeout(timeout);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the timeout for sending a message to the resolved channel.
|
||||
* By default, there is no timeout, meaning the send will block indefinitely.
|
||||
|
||||
@@ -156,29 +156,6 @@ public abstract class AbstractKeyValueMessageStore extends AbstractMessageGroupS
|
||||
doStore(MESSAGE_GROUP_KEY_PREFIX + groupId, metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a Message from the group with the provided group ID.
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public MessageGroup removeMessageFromGroup(Object groupId, Message<?> messageToRemove) {
|
||||
Assert.notNull(groupId, "'groupId' must not be null");
|
||||
Assert.notNull(messageToRemove, "'messageToRemove' must not be null");
|
||||
|
||||
UUID id = messageToRemove.getHeaders().getId();
|
||||
removeMessage(id);
|
||||
|
||||
MessageGroupMetadata metadata = getGroupMetadata(groupId);
|
||||
if (metadata != null) {
|
||||
metadata.remove(id);
|
||||
metadata.setLastModified(System.currentTimeMillis());
|
||||
doStore(MESSAGE_GROUP_KEY_PREFIX + groupId, metadata);
|
||||
}
|
||||
|
||||
return getMessageGroup(groupId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void removeMessagesFromGroup(Object groupId, Collection<Message<?>> messages) {
|
||||
Assert.notNull(groupId, "'groupId' must not be null");
|
||||
|
||||
@@ -54,17 +54,6 @@ public interface MessageGroupStore extends BasicMessageGroupStore {
|
||||
@ManagedAttribute
|
||||
int getMessageGroupCount();
|
||||
|
||||
/**
|
||||
* Persist the deletion of a single message from the group.
|
||||
* The group is modified to reflect that 'messageToRemove' is no longer present in the group.
|
||||
* @param key The groupId for the group containing the message.
|
||||
* @param messageToRemove The message to be removed.
|
||||
* @return The message Group.
|
||||
* @deprecated in favor of {@link #removeMessagesFromGroup}
|
||||
*/
|
||||
@Deprecated
|
||||
MessageGroup removeMessageFromGroup(Object key, Message<?> messageToRemove);
|
||||
|
||||
/**
|
||||
* Persist the deletion of messages from the group.
|
||||
* @param key The groupId for the group containing the message(s).
|
||||
|
||||
@@ -324,34 +324,6 @@ public class SimpleMessageStore extends AbstractMessageGroupStore
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public MessageGroup removeMessageFromGroup(Object groupId, Message<?> messageToRemove) {
|
||||
Lock lock = this.lockRegistry.obtain(groupId);
|
||||
try {
|
||||
lock.lockInterruptibly();
|
||||
try {
|
||||
MessageGroup group = this.groupIdToMessageGroup.get(groupId);
|
||||
Assert.notNull(group, "MessageGroup for groupId '" + groupId + "' " +
|
||||
"can not be located while attempting to remove Message from the MessageGroup");
|
||||
if (group.remove(messageToRemove)) {
|
||||
UpperBound upperBound = this.groupToUpperBound.get(groupId);
|
||||
Assert.state(upperBound != null, "'upperBound' must not be null.");
|
||||
upperBound.release();
|
||||
group.setLastModified(System.currentTimeMillis());
|
||||
}
|
||||
return group;
|
||||
}
|
||||
finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new MessagingException("Interrupted while obtaining lock", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeMessagesFromGroup(Object groupId, Collection<Message<?>> messages) {
|
||||
Lock lock = this.lockRegistry.obtain(groupId);
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2013 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.transformer;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.support.ChannelInterceptor;
|
||||
import org.springframework.messaging.support.ChannelInterceptorAdapter;
|
||||
|
||||
/**
|
||||
* A {@link ChannelInterceptor} which invokes a {@link Transformer}
|
||||
* when either sending-to or receiving-from a channel.
|
||||
*
|
||||
* @deprecated It is not generally recommended to perform functions
|
||||
* such as transformation in a channel interceptor.
|
||||
*
|
||||
* @author Jonas Partner
|
||||
*/
|
||||
@Deprecated
|
||||
public class MessageTransformingChannelInterceptor extends ChannelInterceptorAdapter {
|
||||
|
||||
private final Transformer transformer;
|
||||
|
||||
private volatile boolean transformOnSend = true;
|
||||
|
||||
|
||||
public MessageTransformingChannelInterceptor(Transformer transformer) {
|
||||
this.transformer = transformer;
|
||||
}
|
||||
|
||||
|
||||
public boolean getTransformOnSend() {
|
||||
return this.transformOnSend;
|
||||
}
|
||||
|
||||
public void setTransformOnSend(boolean transformOnSend) {
|
||||
this.transformOnSend = transformOnSend;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Message<?> preSend(Message<?> message, MessageChannel channel) {
|
||||
if (this.transformOnSend) {
|
||||
message = this.transformer.transform(message);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Message<?> postReceive(Message<?> message, MessageChannel channel) {
|
||||
if (!this.transformOnSend) {
|
||||
message = this.transformer.transform(message);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -105,7 +105,6 @@ public final class MessagingAnnotationUtils {
|
||||
* @throws MessagingException if more than one of {@link Payload}, {@link Header}
|
||||
* or {@link Headers} annotations are presented.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public static Annotation findMessagePartAnnotation(Annotation[] annotations, boolean payloads) {
|
||||
if (annotations == null || annotations.length == 0) {
|
||||
return null;
|
||||
@@ -113,11 +112,8 @@ public final class MessagingAnnotationUtils {
|
||||
Annotation match = null;
|
||||
for (Annotation annotation : annotations) {
|
||||
Class<? extends Annotation> type = annotation.annotationType();
|
||||
if (type.equals(org.springframework.integration.annotation.Payload.class)
|
||||
|| type.equals(Payload.class)
|
||||
|| type.equals(org.springframework.integration.annotation.Header.class)
|
||||
if (type.equals(Payload.class)
|
||||
|| type.equals(Header.class)
|
||||
|| type.equals(org.springframework.integration.annotation.Headers.class)
|
||||
|| type.equals(Headers.class)
|
||||
|| (payloads && type.equals(Payloads.class))) {
|
||||
if (match != null) {
|
||||
|
||||
@@ -697,7 +697,6 @@ public class MessagingMethodInvokerHelper<T> extends AbstractExpressionEvaluator
|
||||
return this.method.toString();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private Expression generateExpression(Method method) {
|
||||
StringBuilder sb = new StringBuilder("#target." + method.getName() + "(");
|
||||
Class<?>[] parameterTypes = method.getParameterTypes();
|
||||
@@ -714,8 +713,7 @@ public class MessagingMethodInvokerHelper<T> extends AbstractExpressionEvaluator
|
||||
MessagingAnnotationUtils.findMessagePartAnnotation(parameterAnnotations[i], true);
|
||||
if (mappingAnnotation != null) {
|
||||
Class<? extends Annotation> annotationType = mappingAnnotation.annotationType();
|
||||
if (annotationType.equals(org.springframework.integration.annotation.Payload.class)
|
||||
|| annotationType.equals(Payload.class)) {
|
||||
if (annotationType.equals(Payload.class)) {
|
||||
sb.append("payload");
|
||||
String qualifierExpression = (String) AnnotationUtils.getValue(mappingAnnotation);
|
||||
if (StringUtils.hasText(qualifierExpression)) {
|
||||
@@ -736,14 +734,12 @@ public class MessagingMethodInvokerHelper<T> extends AbstractExpressionEvaluator
|
||||
this.setExclusiveTargetParameterType(parameterTypeDescriptor, methodParameter);
|
||||
}
|
||||
}
|
||||
else if (annotationType.equals(org.springframework.integration.annotation.Headers.class)
|
||||
|| annotationType.equals(Headers.class)) {
|
||||
else if (annotationType.equals(Headers.class)) {
|
||||
Assert.isTrue(Map.class.isAssignableFrom(parameterType),
|
||||
"The @Headers annotation can only be applied to a Map-typed parameter.");
|
||||
sb.append("headers");
|
||||
}
|
||||
else if (annotationType.equals(org.springframework.integration.annotation.Header.class)
|
||||
|| annotationType.equals(Header.class)) {
|
||||
else if (annotationType.equals(Header.class)) {
|
||||
sb.append(this.determineHeaderExpression(mappingAnnotation, methodParameter));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -785,19 +785,6 @@
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="reactor-environment" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
DEPRECATED with no-op in favor of global JVM-wide Reactor configuration.
|
||||
Provide a reference to 'reactor.core.Environment'
|
||||
to use for any of the interface methods that have a 'reactor.core.composable.Promise' return type.
|
||||
The Reactor's Environment will only be used for those async methods; the sync methods
|
||||
will be invoked in the caller's thread.
|
||||
This attribute is required if any 'service-interface' methods
|
||||
have a 'reactor.core.composable.Promise' return type.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
@@ -3488,17 +3475,6 @@
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="timeout" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Specify the maximum amount of time in milliseconds to wait
|
||||
when sending Messages to the target MessageChannels if blocking
|
||||
is possible (e.g. a bounded queue channel that is currently full).
|
||||
By default the send will block indefinitely.
|
||||
DEPRECATED in favor of 'send-timeout' for consistency with other elements.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="send-timeout" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
<service-activator id="serviceActivator" input-channel="input" ref="mock" method="test" send-timeout="123"/>
|
||||
|
||||
<router id="router" input-channel="routerInput" expression="'someChannel'" timeout="123"/>
|
||||
<router id="router" input-channel="routerInput" expression="'someChannel'" send-timeout="123"/>
|
||||
|
||||
<filter id="filter" input-channel="filterInput" expression="'true'" send-timeout="123"/>
|
||||
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
<recipient channel="channel1"/>
|
||||
<recipient channel="channel2"/>
|
||||
</recipient-list-router>
|
||||
|
||||
|
||||
<recipient-list-router id="customRouter" input-channel="routingChannelB"
|
||||
timeout="1234"
|
||||
send-timeout="1234"
|
||||
ignore-send-failures="true"
|
||||
apply-sequence="true">
|
||||
<recipient channel="channel1"/>
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
|
||||
<channel id="timeoutRouterChannel"/>
|
||||
|
||||
<router id="routerWithTimeout" ref="payloadAsChannelNameRouter" timeout="1234" input-channel="timeoutRouterChannel"/>
|
||||
<router id="routerWithTimeout" ref="payloadAsChannelNameRouter" send-timeout="1234" input-channel="timeoutRouterChannel"/>
|
||||
|
||||
<router input-channel="routerNestedBeanChannel" method="route">
|
||||
<beans:bean class="org.springframework.integration.router.config.TestRouter"/>
|
||||
|
||||
@@ -105,12 +105,6 @@ public class MessageStoreTests {
|
||||
return removed ? new SimpleMessageGroup(correlationKey) : testMessages;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public MessageGroup removeMessageFromGroup(Object key, Message<?> messageToRemove) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeMessagesFromGroup(Object key, Collection<Message<?>> messages) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
@@ -35,12 +35,6 @@ public abstract class FileHeaders {
|
||||
|
||||
public static final String REMOTE_FILE = PREFIX + "remoteFile";
|
||||
|
||||
/**
|
||||
* @deprecated - use {@code IntegrationMessageHeaderAccessor#CLOSEABLE_RESOURCE}.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String REMOTE_SESSION = PREFIX + "remoteSession";
|
||||
|
||||
public static final String RENAME_TO = PREFIX + "renameTo";
|
||||
|
||||
public static final String SET_MODIFIED = PREFIX + "setModified";
|
||||
|
||||
@@ -392,18 +392,6 @@ public class FileReadingMessageSource extends IntegrationObjectSupport implement
|
||||
this.toBeReceived.offer(failedMessage.getPayload());
|
||||
}
|
||||
|
||||
/**
|
||||
* The message is just logged. It was already removed from the queue during
|
||||
* the call to <code>receive()</code>
|
||||
* @param sentMessage the message that was successfully delivered
|
||||
* @deprecated with no replacement. Redundant method.
|
||||
*/
|
||||
@Deprecated
|
||||
public void onSend(Message<File> sentMessage) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Sent: " + sentMessage);
|
||||
}
|
||||
}
|
||||
|
||||
public enum WatchEventType {
|
||||
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2015 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;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* DirectoryScanner that lists all files inside a directory and subdirectories,
|
||||
* without limit. This scanner should not be used with directories that contain
|
||||
* a vast number of files or on deep trees, as all the file names will be read
|
||||
* into memory and the scanning will be done recursively.
|
||||
*
|
||||
* @author Iwein Fuld
|
||||
* @author Gary Russell
|
||||
*
|
||||
* @deprecated in favor of {@link FileReadingMessageSource#setUseWatchService(boolean)} (when using Java 7 or later)
|
||||
*/
|
||||
@Deprecated
|
||||
public class RecursiveLeafOnlyDirectoryScanner extends DefaultDirectoryScanner {
|
||||
|
||||
@Override
|
||||
protected File[] listEligibleFiles(File directory) throws IllegalArgumentException {
|
||||
File[] rootFiles = directory.listFiles();
|
||||
if (rootFiles == null) {
|
||||
return new File[0];
|
||||
}
|
||||
List<File> files = new ArrayList<File>(rootFiles.length);
|
||||
for (File rootFile : rootFiles) {
|
||||
if (rootFile.isDirectory()) {
|
||||
files.addAll(Arrays.asList(listEligibleFiles(rootFile)));
|
||||
}
|
||||
else {
|
||||
files.add(rootFile);
|
||||
}
|
||||
}
|
||||
return files.toArray(new File[files.size()]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,254 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015-2016 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;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.FileVisitResult;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.SimpleFileVisitor;
|
||||
import java.nio.file.StandardWatchEventKinds;
|
||||
import java.nio.file.WatchEvent;
|
||||
import java.nio.file.WatchKey;
|
||||
import java.nio.file.WatchService;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.context.SmartLifecycle;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Directory scanner that uses Java 7 {@link WatchService}.
|
||||
*
|
||||
* The initial state of the directory is collected during {@link #start()}. Subsequent
|
||||
* polls return new files as reported by {@code ENTRY_CREATE} events.
|
||||
* <p>
|
||||
* While initially walking the directory, any subdirectories encountered are registered
|
||||
* to watch for creation events.
|
||||
* <p>
|
||||
* If subdirectories are subsequently added, they are walked and registered for
|
||||
* new creation events, too.
|
||||
* <p>
|
||||
* When a {@link StandardWatchEventKinds#OVERFLOW} {@link WatchKey} event is occurred,
|
||||
* the {@link #directory} is rescanned to avoid the loss for any new entries according
|
||||
* to the "missed events" logic around {@link StandardWatchEventKinds#OVERFLOW}.
|
||||
*
|
||||
* @author Hezi Schrager
|
||||
* @author Gary Russell
|
||||
* @author Artem Bilan
|
||||
* @since 4.2
|
||||
* @deprecated since 4.3 in favor of internal {@link WatchService} logic in the {@link FileReadingMessageSource}.
|
||||
* Will be removed in Spring Integration 5.0.
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("deprecation")
|
||||
public class WatchServiceDirectoryScanner extends DefaultDirectoryScanner implements SmartLifecycle {
|
||||
|
||||
private final static Log logger = LogFactory.getLog(WatchServiceDirectoryScanner.class);
|
||||
|
||||
private final Path directory;
|
||||
|
||||
private volatile WatchService watcher;
|
||||
|
||||
private volatile int phase;
|
||||
|
||||
private volatile boolean running;
|
||||
|
||||
private volatile boolean autoStartup;
|
||||
|
||||
private volatile Collection<File> initialFiles;
|
||||
|
||||
/**
|
||||
* Construct an instance for the given directory.
|
||||
* @param directory the directory.
|
||||
*/
|
||||
public WatchServiceDirectoryScanner(String directory) {
|
||||
this.directory = Paths.get(directory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPhase() {
|
||||
return this.phase;
|
||||
}
|
||||
|
||||
/**
|
||||
* see {@link #getPhase()}
|
||||
* @param phase the phase.
|
||||
*/
|
||||
public void setPhase(int phase) {
|
||||
this.phase = phase;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRunning() {
|
||||
return this.running;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #isRunning()
|
||||
* @param running true if running.
|
||||
*/
|
||||
public void setRunning(boolean running) {
|
||||
this.running = running;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAutoStartup() {
|
||||
return this.autoStartup;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #isAutoStartup()
|
||||
* @param autoStartup true to auto start.
|
||||
*/
|
||||
public void setAutoStartup(boolean autoStartup) {
|
||||
this.autoStartup = autoStartup;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void start() {
|
||||
if (!this.running) {
|
||||
try {
|
||||
this.watcher = FileSystems.getDefault().newWatchService();
|
||||
}
|
||||
catch (IOException e) {
|
||||
logger.error("Failed to create watcher for " + this.directory.toString(), e);
|
||||
}
|
||||
final Set<File> initialFiles = walkDirectory(this.directory);
|
||||
initialFiles.addAll(filesFromEvents());
|
||||
this.initialFiles = initialFiles;
|
||||
this.running = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void stop() {
|
||||
if (this.running) {
|
||||
try {
|
||||
this.watcher.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
logger.error("Failed to close watcher for " + this.directory.toString(), e);
|
||||
}
|
||||
this.running = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(Runnable callback) {
|
||||
stop();
|
||||
callback.run();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected File[] listEligibleFiles(File directory) {
|
||||
Assert.state(this.watcher != null, "Scanner needs to be started");
|
||||
if (this.initialFiles != null) {
|
||||
File[] initial = this.initialFiles.toArray(new File[this.initialFiles.size()]);
|
||||
this.initialFiles = null;
|
||||
return initial;
|
||||
}
|
||||
Collection<File> files = filesFromEvents();
|
||||
return files.toArray(new File[files.size()]);
|
||||
}
|
||||
|
||||
private Set<File> filesFromEvents() {
|
||||
WatchKey key = this.watcher.poll();
|
||||
Set<File> files = new LinkedHashSet<File>();
|
||||
while (key != null) {
|
||||
for (WatchEvent<?> event : key.pollEvents()) {
|
||||
if (event.kind() == StandardWatchEventKinds.ENTRY_CREATE) {
|
||||
Path item = (Path) event.context();
|
||||
File file = new File(((Path) key.watchable()).toAbsolutePath() + File.separator + item.getFileName());
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Watch Event: " + event.kind() + ": " + file);
|
||||
}
|
||||
if (file.isDirectory()) {
|
||||
files.addAll(walkDirectory(file.toPath()));
|
||||
}
|
||||
else {
|
||||
files.add(file);
|
||||
}
|
||||
}
|
||||
else if (event.kind() == StandardWatchEventKinds.OVERFLOW) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Watch Event: " + event.kind() + ": context: " + event.context());
|
||||
}
|
||||
if (event.context() != null && event.context() instanceof Path) {
|
||||
files.addAll(walkDirectory((Path) event.context()));
|
||||
}
|
||||
else {
|
||||
files.addAll(walkDirectory(this.directory));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Watch Event: " + event.kind() + ": context: " + event.context());
|
||||
}
|
||||
}
|
||||
}
|
||||
key.reset();
|
||||
key = this.watcher.poll();
|
||||
}
|
||||
return files;
|
||||
}
|
||||
|
||||
private Set<File> walkDirectory(Path directory) {
|
||||
final Set<File> walkedFiles = new LinkedHashSet<File>();
|
||||
try {
|
||||
registerWatch(directory);
|
||||
Files.walkFileTree(directory, new SimpleFileVisitor<Path>() {
|
||||
|
||||
@Override
|
||||
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
|
||||
FileVisitResult fileVisitResult = super.preVisitDirectory(dir, attrs);
|
||||
registerWatch(dir);
|
||||
return fileVisitResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
|
||||
FileVisitResult fileVisitResult = super.visitFile(file, attrs);
|
||||
walkedFiles.add(file.toFile());
|
||||
return fileVisitResult;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
catch (IOException e) {
|
||||
logger.error("Failed to walk directory: " + directory.toString(), e);
|
||||
}
|
||||
return walkedFiles;
|
||||
}
|
||||
|
||||
private void registerWatch(Path dir) throws IOException {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("registering: " + dir + " for file creation events");
|
||||
}
|
||||
dir.register(this.watcher, StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_MODIFY);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -394,15 +394,6 @@ public abstract class AbstractRemoteFileOutboundGateway<F> extends AbstractReply
|
||||
setRenameExpression(EXPRESSION_PARSER.parseExpression(renameExpression));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param expression the expression to set.
|
||||
* @deprecated in favor of {@link #setRenameExpression}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setExpressionRename(Expression expression) {
|
||||
setRenameExpression(expression);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param localFilenameGeneratorExpression the expression to use.
|
||||
* @since 3.0
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2015 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;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.hasItem;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
|
||||
/**
|
||||
* @author Iwein Fuld
|
||||
* @author Gunnar Hillert
|
||||
* @author Gary Russell
|
||||
*/
|
||||
public class RecursiveLeafOnlyDirectoryScannerTests {
|
||||
|
||||
private File folderThatShouldBeIgnored;
|
||||
|
||||
private File subFolderThatShouldBeIgnored;
|
||||
|
||||
private File topLevelFile;
|
||||
|
||||
private File subLevelFile;
|
||||
|
||||
private File subSubLevelFile;
|
||||
|
||||
|
||||
@Rule
|
||||
public TemporaryFolder recursivePath = new TemporaryFolder() {
|
||||
|
||||
@Override
|
||||
public void create() throws IOException {
|
||||
super.create();
|
||||
folderThatShouldBeIgnored = this.newFolder("shouldBeIgnored");
|
||||
subFolderThatShouldBeIgnored = new File(folderThatShouldBeIgnored, "shouldBeIgnored");
|
||||
subFolderThatShouldBeIgnored.mkdir();
|
||||
topLevelFile = this.newFile("file1");
|
||||
subLevelFile = new File(folderThatShouldBeIgnored, "file2");
|
||||
subLevelFile.createNewFile();
|
||||
subSubLevelFile = new File(subFolderThatShouldBeIgnored, "file2");
|
||||
subSubLevelFile.createNewFile();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@Test
|
||||
public void shouldReturnAllFiles() {
|
||||
@SuppressWarnings("deprecation")
|
||||
List<File> files = new RecursiveLeafOnlyDirectoryScanner().listFiles(recursivePath.getRoot());
|
||||
assertEquals(Integer.valueOf(files.size()), Integer.valueOf(3));
|
||||
assertThat(files, hasItem(topLevelFile));
|
||||
assertThat(files, hasItem(subLevelFile));
|
||||
assertThat(files, hasItem(subSubLevelFile));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans:beans xmlns="http://www.springframework.org/schema/integration/file"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xmlns:integration="http://www.springframework.org/schema/integration"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/file
|
||||
http://www.springframework.org/schema/integration/file/spring-integration-file.xsd">
|
||||
|
||||
<inbound-channel-adapter id="fileSource"
|
||||
directory="#{directory.root}"
|
||||
auto-startup="true"
|
||||
scanner="recursiveScanner"
|
||||
channel="files">
|
||||
<integration:poller fixed-rate="1000"/>
|
||||
</inbound-channel-adapter>
|
||||
|
||||
<integration:channel id="files">
|
||||
<integration:queue capacity="10"/>
|
||||
</integration:channel>
|
||||
|
||||
<beans:bean id="recursiveScanner" class="org.springframework.integration.file.RecursiveLeafOnlyDirectoryScanner"/>
|
||||
|
||||
<beans:bean id="directory" class="org.junit.rules.TemporaryFolder" init-method="create" destroy-method="delete"/>
|
||||
</beans:beans>
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2016 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.recursive;
|
||||
|
||||
import static org.hamcrest.Matchers.containsInAnyOrder;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.springframework.integration.test.matcher.PayloadMatcher.hasPayload;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.PollableChannel;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.annotation.DirtiesContext.ClassMode;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* @author Iwein Fuld
|
||||
* @author Gunnar Hillert
|
||||
*/
|
||||
@ContextConfiguration
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
|
||||
public class FileInboundChannelAdapterWithRecursiveDirectoryTests {
|
||||
|
||||
@Autowired
|
||||
private TemporaryFolder directory;
|
||||
|
||||
@Autowired
|
||||
private PollableChannel files;
|
||||
|
||||
@Test(timeout = 10000)
|
||||
public void shouldScanDirectoriesRecursively() throws IOException {
|
||||
|
||||
//when
|
||||
File folder = directory.newFolder("foo");
|
||||
File file = new File(folder, "bar");
|
||||
assertTrue(file.createNewFile());
|
||||
|
||||
//verify
|
||||
assertThat(files.receive(), hasPayload(file));
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Test(timeout = 10000)
|
||||
public void shouldReturnFilesMultipleLevels() throws IOException {
|
||||
File folder = directory.newFolder("foo");
|
||||
File siblingFile = directory.newFile("bar");
|
||||
File childFile = new File(folder, "baz");
|
||||
assertTrue(childFile.createNewFile());
|
||||
|
||||
List<Message> received = Arrays.asList((Message) files.receive(), files.receive());
|
||||
assertThat(received, containsInAnyOrder(hasPayload(siblingFile), hasPayload(childFile)));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -62,25 +62,12 @@ public class GemfireMessageStore extends AbstractKeyValueMessageStore implements
|
||||
this.messageStoreRegion = messageStoreRegion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a cache reference used to create a message store region named
|
||||
* 'messageStoreRegion'
|
||||
* @param cache The cache.
|
||||
*
|
||||
* @deprecated - use the other constructor and provide a region directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public GemfireMessageStore(Cache cache) {
|
||||
Assert.notNull(cache, "'cache' must not be null");
|
||||
this.cache = cache;
|
||||
}
|
||||
|
||||
public void setIgnoreJta(boolean ignoreJta) {
|
||||
this.ignoreJta = ignoreJta;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "unchecked", "deprecation" })
|
||||
@SuppressWarnings("unchecked")
|
||||
public void afterPropertiesSet() {
|
||||
if (this.messageStoreRegion != null) {
|
||||
return;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<beans:bean id="messageStore" class="org.springframework.integration.gemfire.store.GemfireMessageStore">
|
||||
<beans:constructor-arg
|
||||
value="#{T (org.springframework.integration.gemfire.store.DelayerHandlerRescheduleIntegrationTests).cacheFactoryBean.object}"/>
|
||||
value="#{T (org.springframework.integration.gemfire.store.DelayerHandlerRescheduleIntegrationTests).region}"/>
|
||||
</beans:bean>
|
||||
|
||||
<channel id="output">
|
||||
|
||||
@@ -43,6 +43,10 @@ import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.PollableChannel;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
||||
|
||||
import com.gemstone.gemfire.cache.Cache;
|
||||
import com.gemstone.gemfire.cache.Region;
|
||||
import com.gemstone.gemfire.cache.Scope;
|
||||
|
||||
|
||||
/**
|
||||
* @author Artem Bilan
|
||||
@@ -53,7 +57,9 @@ public class DelayerHandlerRescheduleIntegrationTests {
|
||||
|
||||
public static final String DELAYER_ID = "delayerWithGemfireMS";
|
||||
|
||||
public static CacheFactoryBean cacheFactoryBean;
|
||||
public static Region<Object, Object> region;
|
||||
|
||||
private static CacheFactoryBean cacheFactoryBean;
|
||||
|
||||
@ClassRule
|
||||
public static LongRunningIntegrationTest longTests = new LongRunningIntegrationTest();
|
||||
@@ -62,10 +68,15 @@ public class DelayerHandlerRescheduleIntegrationTests {
|
||||
public static void startUp() throws Exception {
|
||||
cacheFactoryBean = new CacheFactoryBean();
|
||||
cacheFactoryBean.afterPropertiesSet();
|
||||
Cache cache = cacheFactoryBean.getObject();
|
||||
region = cache.createRegionFactory().setScope(Scope.LOCAL).create("sig-tests");
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void cleanUp() throws Exception {
|
||||
if (region != null) {
|
||||
region.close();
|
||||
}
|
||||
if (cacheFactoryBean != null) {
|
||||
cacheFactoryBean.destroy();
|
||||
}
|
||||
|
||||
@@ -62,9 +62,9 @@ import junit.framework.AssertionFailedError;
|
||||
*/
|
||||
public class GemfireGroupStoreTests {
|
||||
|
||||
public static CacheFactoryBean cacheFactoryBean;
|
||||
private static CacheFactoryBean cacheFactoryBean;
|
||||
|
||||
private static Region<Object, Object> region;
|
||||
public static Region<Object, Object> region;
|
||||
|
||||
@Test
|
||||
public void testNonExistingEmptyMessageGroup() throws Exception {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
<bean id="gemfireStore" class="org.springframework.integration.gemfire.store.GemfireMessageStore">
|
||||
<constructor-arg
|
||||
value="#{T (org.springframework.integration.gemfire.store.GemfireGroupStoreTests).cacheFactoryBean.object}"/>
|
||||
value="#{T (org.springframework.integration.gemfire.store.GemfireGroupStoreTests).region}"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
<bean id="gemfireStore" class="org.springframework.integration.gemfire.store.GemfireMessageStore">
|
||||
<constructor-arg
|
||||
value="#{T (org.springframework.integration.gemfire.store.GemfireGroupStoreTests).cacheFactoryBean.object}"/>
|
||||
value="#{T (org.springframework.integration.gemfire.store.GemfireGroupStoreTests).region}"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
<bean id="gemfireStore" class="org.springframework.integration.gemfire.store.GemfireMessageStore">
|
||||
<constructor-arg
|
||||
value="#{T (org.springframework.integration.gemfire.store.GemfireGroupStoreTests).cacheFactoryBean.object}"/>
|
||||
value="#{T (org.springframework.integration.gemfire.store.GemfireGroupStoreTests).region}"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -134,16 +134,7 @@ public abstract class IpAdapterParserUtils {
|
||||
* @param builder the bean definition builder to be configured
|
||||
* @param element the XML element where the attribute should be defined
|
||||
* @param attributeName the name of the attribute whose value will be
|
||||
* @param trueFalse not used
|
||||
* used to populate the property
|
||||
* @deprecated in favor of {@link #addConstructorValueIfAttributeDefined}.
|
||||
*/
|
||||
@Deprecated
|
||||
public static void addConstuctorValueIfAttributeDefined(BeanDefinitionBuilder builder,
|
||||
Element element, String attributeName, boolean trueFalse) {
|
||||
addConstructorValueIfAttributeDefined(builder, element, attributeName);
|
||||
}
|
||||
|
||||
public static void addConstructorValueIfAttributeDefined(BeanDefinitionBuilder builder,
|
||||
Element element, String attributeName) {
|
||||
String attributeValue = element.getAttribute(attributeName);
|
||||
|
||||
@@ -26,7 +26,6 @@ import org.springframework.integration.config.xml.AbstractIntegrationNamespaceHa
|
||||
*/
|
||||
public class IpNamespaceHandler extends AbstractIntegrationNamespaceHandler {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void init() {
|
||||
this.registerBeanDefinitionParser("udp-inbound-channel-adapter", new UdpInboundChannelAdapterParser());
|
||||
this.registerBeanDefinitionParser("udp-outbound-channel-adapter", new UdpOutboundChannelAdapterParser());
|
||||
@@ -35,7 +34,6 @@ public class IpNamespaceHandler extends AbstractIntegrationNamespaceHandler {
|
||||
this.registerBeanDefinitionParser("tcp-connection-factory", new TcpConnectionFactoryParser());
|
||||
this.registerBeanDefinitionParser("tcp-inbound-channel-adapter", new TcpInboundChannelAdapterParser());
|
||||
this.registerBeanDefinitionParser("tcp-outbound-channel-adapter", new TcpOutboundChannelAdapterParser());
|
||||
this.registerBeanDefinitionParser("tcp-connection-event-inbound-channel-adapter", new TcpConnectionEventInboundChannelAdapterParser());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2015 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.ip.config;
|
||||
|
||||
import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.integration.config.xml.AbstractChannelAdapterParser;
|
||||
import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* @author Gary Russell
|
||||
* @since 3.0
|
||||
*
|
||||
* @deprecated in favor of the generic event adapter.
|
||||
*/
|
||||
@Deprecated
|
||||
public class TcpConnectionEventInboundChannelAdapterParser extends AbstractChannelAdapterParser {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
protected AbstractBeanDefinition doParse(Element element, ParserContext parserContext, String channelName) {
|
||||
BeanDefinitionBuilder adapterBuilder = BeanDefinitionBuilder
|
||||
.rootBeanDefinition(org.springframework.integration.ip.tcp.connection.TcpConnectionEventListeningMessageProducer.class);
|
||||
adapterBuilder.addPropertyReference("outputChannel", channelName);
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(adapterBuilder, element, "error-channel", "errorChannel");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(adapterBuilder, element, "event-types");
|
||||
return adapterBuilder.getBeanDefinition();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2016 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.ip.tcp.connection;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.integration.core.MessageProducer;
|
||||
import org.springframework.integration.endpoint.MessageProducerSupport;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
* {@link MessageProducer} that produces Messages with @link {@link TcpConnectionEvent}
|
||||
* payloads.
|
||||
* @author Gary Russell
|
||||
* @since 3.0
|
||||
*
|
||||
* @deprecated in favor of using the generic {@code ApplicationEventListeningMessageProducer} which
|
||||
* can now more efficiently filter required events. Configure the adapter to handle
|
||||
* {@link TcpConnectionEvent}.
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public class TcpConnectionEventListeningMessageProducer extends MessageProducerSupport
|
||||
implements ApplicationListener<TcpConnectionEvent> {
|
||||
|
||||
private volatile Set<Class<? extends TcpConnectionEvent>> eventTypes =
|
||||
new HashSet<Class<? extends TcpConnectionEvent>>();
|
||||
|
||||
/**
|
||||
* Set the list of event types (classes that extend TcpConnectionEvent) that
|
||||
* this adapter should send to the message channel. By default, all event
|
||||
* types will be sent.
|
||||
*
|
||||
* @param eventTypes The event types.
|
||||
*/
|
||||
public void setEventTypes(Class<? extends TcpConnectionEvent>[] eventTypes) {
|
||||
Assert.notEmpty(eventTypes, "at least one event type is required");
|
||||
Set<Class<? extends TcpConnectionEvent>> eventTypeSet = new HashSet<Class<? extends TcpConnectionEvent>>();
|
||||
eventTypeSet.addAll(Arrays.asList(eventTypes));
|
||||
this.eventTypes = eventTypeSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComponentType() {
|
||||
return "ip:tcp-connection-event-inbound-channel-adapter";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(TcpConnectionEvent event) {
|
||||
if (this.isRunning()) {
|
||||
if (CollectionUtils.isEmpty(this.eventTypes)) {
|
||||
this.sendMessage(messageFromEvent(event));
|
||||
}
|
||||
else {
|
||||
for (Class<? extends TcpConnectionEvent> eventType : this.eventTypes) {
|
||||
if (eventType.isAssignableFrom(event.getClass())) {
|
||||
this.sendMessage(messageFromEvent(event));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected Message<TcpConnectionEvent> messageFromEvent(TcpConnectionEvent event) {
|
||||
return this.getMessageBuilderFactory().withPayload(event).build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -755,71 +755,6 @@
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="tcp-connection-event-inbound-channel-adapter">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
[DEPRECATED: Use an event inbound channel adapter instead]
|
||||
Configures an inbound Channel Adapter which
|
||||
listens for TCP Connection
|
||||
events, converts them to Messages and
|
||||
sends them to a Message Channel.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="id" type="xsd:string" use="optional" />
|
||||
<xsd:attribute name="event-types" type="xsd:string"
|
||||
use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Comma delimited list of event types (classes that extend
|
||||
TcpConnectionEvent) that this adapter
|
||||
should send to the message channel. By default, all event types will be
|
||||
sent [OPTIONAL].
|
||||
Note, it is NOT possible to filter by subtype, just class - for
|
||||
example, the standard TcpConnectionEvent
|
||||
class has 3 subtypes (OPEN, CLOSE, EXCEPTION). This feature is intended
|
||||
to allow the adapter to
|
||||
be used, say, to obtain just subclasses of TcpConnectionEvent
|
||||
(perhaps generated by a
|
||||
TcpConnectionInterceptor, perhaps to signal handshaking of some kind).
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="channel" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type
|
||||
type="org.springframework.messaging.MessageChannel" />
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
<xsd:documentation>
|
||||
The channel to which Messages generated from Application Context
|
||||
events will be sent.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="error-channel" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type
|
||||
type="org.springframework.messaging.MessageChannel" />
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
<xsd:documentation>
|
||||
If a (synchronous) downstream exception is thrown and an
|
||||
error-channel is specified,
|
||||
a MessagingException will be sent to this channel. Otherwise, any
|
||||
such exception
|
||||
will be propagated to the caller.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attributeGroup ref="integration:smartLifeCycleAttributeGroup" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:complexType name="udpInboundAdapterType">
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="udpAdapterType">
|
||||
|
||||
@@ -4,14 +4,12 @@
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:ip="http://www.springframework.org/schema/integration/ip"
|
||||
xmlns:task="http://www.springframework.org/schema/task"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/integration/ip http://www.springframework.org/schema/integration/ip/spring-integration-ip.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
|
||||
|
||||
<bean id="tcpIpUtils" class="org.springframework.integration.test.util.SocketUtils" />
|
||||
|
||||
@@ -432,13 +430,4 @@
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<ip:tcp-connection-event-inbound-channel-adapter id="eventAdapter" channel="eventChannel"
|
||||
auto-startup="false" phase="23" error-channel="eventErrors"
|
||||
event-types="org.springframework.integration.ip.config.ParserUnitTests$EventSubclass1, org.springframework.integration.ip.config.ParserUnitTests$EventSubclass2"/>
|
||||
|
||||
<int:channel id="eventChannel">
|
||||
<int:queue />
|
||||
</int:channel>
|
||||
|
||||
<int:channel id="eventErrors" />
|
||||
</beans>
|
||||
|
||||
@@ -272,13 +272,6 @@ public class ParserUnitTests {
|
||||
@Autowired
|
||||
TcpMessageMapper mapper;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Autowired
|
||||
org.springframework.integration.ip.tcp.connection.TcpConnectionEventListeningMessageProducer eventAdapter;
|
||||
|
||||
@Autowired
|
||||
QueueChannel eventChannel;
|
||||
|
||||
private static CountDownLatch adviceCalled = new CountDownLatch(1);
|
||||
|
||||
@Test
|
||||
@@ -669,31 +662,6 @@ public class ParserUnitTests {
|
||||
assertSame(socketSupport, dfa.getPropertyValue("tcpSocketSupport"));
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "deprecation" })
|
||||
@Test
|
||||
public void testEventAdapter() {
|
||||
Set<?> eventTypes = TestUtils.getPropertyValue(this.eventAdapter, "eventTypes", Set.class);
|
||||
assertEquals(2, eventTypes.size());
|
||||
assertTrue(eventTypes.contains(EventSubclass1.class));
|
||||
assertTrue(eventTypes.contains(EventSubclass2.class));
|
||||
assertFalse(TestUtils.getPropertyValue(this.eventAdapter, "autoStartup", Boolean.class));
|
||||
assertEquals(23, TestUtils.getPropertyValue(this.eventAdapter, "phase"));
|
||||
assertEquals("eventErrors", TestUtils.getPropertyValue(this.eventAdapter, "errorChannel",
|
||||
DirectChannel.class).getComponentName());
|
||||
|
||||
TcpConnectionSupport connection = mock(TcpConnectionSupport.class);
|
||||
TcpConnectionEvent event = new TcpConnectionOpenEvent(connection, "foo");
|
||||
Class<TcpConnectionEvent>[] types = (Class<TcpConnectionEvent>[]) new Class<?>[]{TcpConnectionEvent.class};
|
||||
this.eventAdapter.setEventTypes(types);
|
||||
this.eventAdapter.onApplicationEvent(event);
|
||||
assertNull(this.eventChannel.receive(0));
|
||||
this.eventAdapter.start();
|
||||
this.eventAdapter.onApplicationEvent(event);
|
||||
Message<?> eventMessage = this.eventChannel.receive(0);
|
||||
assertNotNull(eventMessage);
|
||||
assertSame(event, eventMessage.getPayload());
|
||||
}
|
||||
|
||||
public static class FooAdvice extends AbstractRequestHandlerAdvice {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,11 +3,13 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-ip="http://www.springframework.org/schema/integration/ip"
|
||||
xmlns:int-event="http://www.springframework.org/schema/integration/event"
|
||||
xmlns:task="http://www.springframework.org/schema/task"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/integration/ip http://www.springframework.org/schema/integration/ip/spring-integration-ip.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration/event http://www.springframework.org/schema/integration/event/spring-integration-event.xsd">
|
||||
|
||||
<int:message-history/>
|
||||
|
||||
@@ -70,7 +72,8 @@
|
||||
|
||||
<task:executor id="exec" pool-size="10"/>
|
||||
|
||||
<int-ip:tcp-connection-event-inbound-channel-adapter channel="events" />
|
||||
<int-event:inbound-channel-adapter channel="events"
|
||||
event-types="org.springframework.integration.ip.tcp.connection.TcpConnectionEvent"/>
|
||||
|
||||
<int:channel id="events">
|
||||
<int:queue />
|
||||
|
||||
@@ -16,41 +16,60 @@
|
||||
|
||||
package org.springframework.integration.ip.tcp.connection;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.context.event.ApplicationEventMulticaster;
|
||||
import org.springframework.context.support.AbstractApplicationContext;
|
||||
import org.springframework.core.ResolvableType;
|
||||
import org.springframework.integration.channel.QueueChannel;
|
||||
import org.springframework.integration.event.inbound.ApplicationEventListeningMessageProducer;
|
||||
import org.springframework.messaging.Message;
|
||||
|
||||
/**
|
||||
* @author Gary Russell
|
||||
* @author Artem Bilan
|
||||
* @since 3.0
|
||||
*
|
||||
*/
|
||||
public class TcpConnectionEventListenerTests {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Test
|
||||
public void testNoFilter() {
|
||||
TcpConnectionEventListeningMessageProducer eventProducer = new TcpConnectionEventListeningMessageProducer();
|
||||
ApplicationEventListeningMessageProducer eventProducer = new ApplicationEventListeningMessageProducer();
|
||||
QueueChannel outputChannel = new QueueChannel();
|
||||
eventProducer.setOutputChannel(outputChannel);
|
||||
eventProducer.setBeanFactory(mock(BeanFactory.class));
|
||||
eventProducer.setEventTypes(TcpConnectionEvent.class);
|
||||
BeanFactory mock = mock(BeanFactory.class);
|
||||
given(mock.getBean(AbstractApplicationContext.APPLICATION_EVENT_MULTICASTER_BEAN_NAME,
|
||||
ApplicationEventMulticaster.class))
|
||||
.willReturn(mock(ApplicationEventMulticaster.class));
|
||||
eventProducer.setBeanFactory(mock);
|
||||
eventProducer.afterPropertiesSet();
|
||||
eventProducer.start();
|
||||
TcpConnectionSupport connection = Mockito.mock(TcpConnectionSupport.class);
|
||||
|
||||
assertTrue(eventProducer.supportsEventType(ResolvableType.forClass(TcpConnectionOpenEvent.class)));
|
||||
TcpConnectionEvent event1 = new TcpConnectionOpenEvent(connection, "foo");
|
||||
eventProducer.onApplicationEvent(event1);
|
||||
|
||||
assertTrue(eventProducer.supportsEventType(ResolvableType.forClass(FooEvent.class)));
|
||||
FooEvent event2 = new FooEvent(connection, "foo");
|
||||
eventProducer.onApplicationEvent(event2);
|
||||
|
||||
assertTrue(eventProducer.supportsEventType(ResolvableType.forClass(BarEvent.class)));
|
||||
BarEvent event3 = new BarEvent(connection, "foo");
|
||||
eventProducer.onApplicationEvent(event3);
|
||||
|
||||
Message<?> message = outputChannel.receive(0);
|
||||
assertNotNull(message);
|
||||
assertSame(event1, message.getPayload());
|
||||
@@ -64,24 +83,31 @@ public class TcpConnectionEventListenerTests {
|
||||
assertNull(message);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "deprecation" })
|
||||
@Test
|
||||
public void testFilter() {
|
||||
TcpConnectionEventListeningMessageProducer eventProducer = new TcpConnectionEventListeningMessageProducer();
|
||||
ApplicationEventListeningMessageProducer eventProducer = new ApplicationEventListeningMessageProducer();
|
||||
QueueChannel outputChannel = new QueueChannel();
|
||||
eventProducer.setOutputChannel(outputChannel);
|
||||
Class<?>[] eventTypes = new Class<?>[]{FooEvent.class, BarEvent.class};
|
||||
eventProducer.setEventTypes((Class<? extends TcpConnectionEvent>[]) eventTypes);
|
||||
eventProducer.setBeanFactory(mock(BeanFactory.class));
|
||||
eventProducer.setEventTypes(FooEvent.class, BarEvent.class);
|
||||
BeanFactory mock = mock(BeanFactory.class);
|
||||
given(mock.getBean(AbstractApplicationContext.APPLICATION_EVENT_MULTICASTER_BEAN_NAME,
|
||||
ApplicationEventMulticaster.class))
|
||||
.willReturn(mock(ApplicationEventMulticaster.class));
|
||||
eventProducer.setBeanFactory(mock);
|
||||
eventProducer.afterPropertiesSet();
|
||||
eventProducer.start();
|
||||
TcpConnectionSupport connection = Mockito.mock(TcpConnectionSupport.class);
|
||||
TcpConnectionEvent event1 = new TcpConnectionOpenEvent(connection, "foo");
|
||||
eventProducer.onApplicationEvent(event1);
|
||||
|
||||
assertFalse(eventProducer.supportsEventType(ResolvableType.forClass(TcpConnectionOpenEvent.class)));
|
||||
|
||||
assertTrue(eventProducer.supportsEventType(ResolvableType.forClass(FooEvent.class)));
|
||||
FooEvent event2 = new FooEvent(connection, "foo");
|
||||
eventProducer.onApplicationEvent(event2);
|
||||
|
||||
assertTrue(eventProducer.supportsEventType(ResolvableType.forClass(BarEvent.class)));
|
||||
BarEvent event3 = new BarEvent(connection, "foo");
|
||||
eventProducer.onApplicationEvent(event3);
|
||||
|
||||
Message<?> message = outputChannel.receive(0);
|
||||
assertNotNull(message);
|
||||
assertSame(event2, message.getPayload());
|
||||
|
||||
@@ -468,29 +468,6 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
return messageGroup;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public MessageGroup removeMessageFromGroup(Object groupId, Message<?> messageToRemove) {
|
||||
final String groupKey = getKey(groupId);
|
||||
final String messageId = getKey(messageToRemove.getHeaders().getId());
|
||||
|
||||
this.jdbcTemplate.update(getQuery(Query.REMOVE_MESSAGE_FROM_GROUP), new PreparedStatementSetter() {
|
||||
|
||||
@Override
|
||||
public void setValues(PreparedStatement ps) throws SQLException {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Removing message from group with group key=" + groupKey);
|
||||
}
|
||||
ps.setString(1, groupKey);
|
||||
ps.setString(2, messageId);
|
||||
ps.setString(3, JdbcMessageStore.this.region);
|
||||
}
|
||||
});
|
||||
removeMessage(messageToRemove.getHeaders().getId());
|
||||
updateMessageGroup(groupKey);
|
||||
return getMessageGroup(groupId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeMessagesFromGroup(Object groupId, Collection<Message<?>> messages) {
|
||||
Assert.notNull(groupId, "'groupId' must not be null");
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2016 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.jms;
|
||||
|
||||
/**
|
||||
* Pre-defined names and prefixes to be used for setting and/or retrieving JMS
|
||||
* attributes from/to integration Message Headers.
|
||||
*
|
||||
* @deprecated - use {@link org.springframework.jms.support.JmsHeaders}.
|
||||
* Will be removed in the Spring Integration 5.0.
|
||||
*
|
||||
* @author Mark Fisher
|
||||
* @author Gary Russell
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract class JmsHeaders {
|
||||
|
||||
/**
|
||||
* Prefix used for JMS API related headers in order to distinguish from
|
||||
* user-defined headers and other internal headers (e.g. correlationId).
|
||||
* @see DefaultJmsHeaderMapper
|
||||
*/
|
||||
public static final String PREFIX = org.springframework.jms.support.JmsHeaders.PREFIX;
|
||||
|
||||
public static final String MESSAGE_ID = org.springframework.jms.support.JmsHeaders.MESSAGE_ID;
|
||||
|
||||
public static final String CORRELATION_ID = org.springframework.jms.support.JmsHeaders.CORRELATION_ID;
|
||||
|
||||
public static final String REPLY_TO = org.springframework.jms.support.JmsHeaders.REPLY_TO;
|
||||
|
||||
public static final String REDELIVERED = org.springframework.jms.support.JmsHeaders.REDELIVERED;
|
||||
|
||||
public static final String TYPE = org.springframework.jms.support.JmsHeaders.TYPE;
|
||||
|
||||
public static final String TIMESTAMP = org.springframework.jms.support.JmsHeaders.TIMESTAMP;
|
||||
|
||||
}
|
||||
@@ -209,7 +209,7 @@
|
||||
<xsd:attribute name="receive-timeout" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Timeout for the container's consumers if messsage-driven is TRUE, or
|
||||
Timeout for the container's consumers if message-driven is TRUE, or
|
||||
timeout for receive calls on the template if message-driven is FALSE.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
@@ -408,17 +408,6 @@
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="durable-subscription-name" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
[DEPRECATED: Use 'subscription-durable="true"' together with 'subscription-name'].
|
||||
The name of a durable subscription to create. To be applied in case of a topic (pub-sub domain) with subscription durability
|
||||
activated. The durable subscription name needs to be unique within this client's JMS client id. Default is the class name of the
|
||||
specified message listener. Note: Only 1 concurrent consumer (which is the default of the message listener container) is allowed
|
||||
for each durable subscription.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="subscription-shared" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
@@ -728,17 +717,6 @@
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="durable-subscription-name" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
[DEPRECATED: Use 'subscription-durable="true"' together with 'subscription-name'].
|
||||
The name of a durable subscription to create. To be applied in case of a topic (pub-sub domain) with subscription durability
|
||||
activated. The durable subscription name needs to be unique within this client's JMS client id. Default is the class name of the
|
||||
specified message listener. Note: Only 1 concurrent consumer (which is the default of the message listener container) is allowed
|
||||
for each durable subscription.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="subscription-shared" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
destination-name="testDestination"
|
||||
pub-sub-domain="true"
|
||||
subscription-durable="false"
|
||||
durable-subscription-name="foo"
|
||||
subscription-name="foo"
|
||||
channel="output"/>
|
||||
<!-- adding a sub name should not make it durable INT-3680 -->
|
||||
|
||||
|
||||
@@ -77,18 +77,6 @@ public class JpaOutboundGatewayFactoryBean extends AbstractFactoryBean<MessageHa
|
||||
public JpaOutboundGatewayFactoryBean() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor taking an {@link JpaExecutor} that wraps all JPA Operations.
|
||||
* @param jpaExecutor Must not be null
|
||||
* @deprecated since {@literal 4.2.5} in favor of {@link #setJpaExecutor(JpaExecutor)}
|
||||
* to avoid {@code BeanCurrentlyInCreationException}
|
||||
* during {@code AbstractAutowireCapableBeanFactory.getSingletonFactoryBeanForTypeCheck()}
|
||||
*/
|
||||
@Deprecated
|
||||
public JpaOutboundGatewayFactoryBean(JpaExecutor jpaExecutor) {
|
||||
this.jpaExecutor = jpaExecutor;
|
||||
}
|
||||
|
||||
public void setJpaExecutor(JpaExecutor jpaExecutor) {
|
||||
this.jpaExecutor = jpaExecutor;
|
||||
}
|
||||
|
||||
@@ -423,7 +423,7 @@
|
||||
<xsd:attribute name="persist-mode" use="optional" default="MERGE">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Defines the persistence mode which is used when soley using
|
||||
Defines the persistence mode which is used when solely using
|
||||
the entity-class. This attribute instructs to either Merge
|
||||
entities, to Persist them. Furthermore and entity can also
|
||||
be deleted. By Default 'MERGE' is used.
|
||||
@@ -571,7 +571,7 @@
|
||||
<![CDATA[
|
||||
The reference to the JPA Entity Manager Factory
|
||||
that will be used by the adapter to create the EntityManager.
|
||||
Either this attribute or the 'enity-manager' attribute or the
|
||||
Either this attribute or the 'entity-manager' attribute or the
|
||||
'jpa-operations' attribute must be provided.
|
||||
]]>
|
||||
</xsd:documentation>
|
||||
@@ -587,7 +587,7 @@
|
||||
<xsd:documentation>
|
||||
<![CDATA[
|
||||
The reference to the JPA Entity Manager that will be used by
|
||||
the adapter. Either this attribute or the 'enity-manager-factory'
|
||||
the adapter. Either this attribute or the 'entity-manager-factory'
|
||||
attribute or the 'jpa-operations' attribute must be provided.
|
||||
]]>
|
||||
</xsd:documentation>
|
||||
@@ -606,7 +606,7 @@
|
||||
|
||||
In rare cases it might be advisable to provide your own implementation
|
||||
of the JpaOperations interface, instead of relying on the
|
||||
default implementation. As JpaOperations wraps the necessay
|
||||
default implementation. As JpaOperations wraps the necessary
|
||||
datasource; the JPA Entity Manager or JPA Entity Manager Factory
|
||||
must not be provided if the 'jpa-operations' attribute is used.
|
||||
]]>
|
||||
@@ -624,11 +624,11 @@
|
||||
<![CDATA[
|
||||
The reference to the JPA Persistence Entity. If not specified the
|
||||
entity class will be retrieved from the Message's payload (for
|
||||
operation that involve an enityClass).
|
||||
operation that involve an entityClass).
|
||||
]]>
|
||||
</xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="value">
|
||||
<tool:annotation>
|
||||
<tool:expected-type type="java.lang.Class" />
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
|
||||
@@ -213,12 +213,6 @@ public abstract class AbstractConfigurableMongoDbMessageStore extends AbstractMe
|
||||
return Query.query(Criteria.where(MessageDocumentFields.GROUP_ID).is(groupId));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public MessageGroup removeMessageFromGroup(Object key, Message<?> messageToRemove) {
|
||||
throw new UnsupportedOperationException("The operation isn't implemented for this class.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeMessagesFromGroup(Object key, Collection<Message<?>> messages) {
|
||||
throw new UnsupportedOperationException("The operation isn't implemented for this class.");
|
||||
|
||||
@@ -199,19 +199,6 @@ public class ConfigurableMongoDbMessageStore extends AbstractConfigurableMongoDb
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public MessageGroup removeMessageFromGroup(final Object groupId, final Message<?> messageToRemove) {
|
||||
Assert.notNull(groupId, "'groupId' must not be null");
|
||||
Assert.notNull(messageToRemove, "'messageToRemove' must not be null");
|
||||
|
||||
Query query = groupIdQuery(groupId)
|
||||
.addCriteria(Criteria.where(MessageDocumentFields.MESSAGE_ID).is(messageToRemove.getHeaders().getId()));
|
||||
this.mongoTemplate.remove(query, this.collectionName);
|
||||
updateGroup(groupId, lastModifiedUpdate());
|
||||
return getMessageGroup(groupId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeMessagesFromGroup(Object groupId, Collection<Message<?>> messages) {
|
||||
Assert.notNull(groupId, "'groupId' must not be null");
|
||||
|
||||
@@ -292,18 +292,6 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public MessageGroup removeMessageFromGroup(final Object groupId, final Message<?> messageToRemove) {
|
||||
Assert.notNull(groupId, "'groupId' must not be null");
|
||||
Assert.notNull(messageToRemove, "'messageToRemove' must not be null");
|
||||
|
||||
this.template.findAndRemove(whereMessageIdIsAndGroupIdIs(messageToRemove.getHeaders().getId(), groupId),
|
||||
MessageWrapper.class, this.collectionName);
|
||||
updateGroup(groupId, lastModifiedUpdate());
|
||||
return getMessageGroup(groupId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeMessagesFromGroup(Object groupId, Collection<Message<?>> messages) {
|
||||
Assert.notNull(groupId, "'groupId' must not be null");
|
||||
|
||||
@@ -133,9 +133,7 @@ public abstract class AbstractMqttMessageHandler extends AbstractMessageHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void handleMessageInternal(Message<?> message) throws Exception {
|
||||
connectIfNeeded();
|
||||
String topic = (String) message.getHeaders().get(MqttHeaders.TOPIC);
|
||||
Object mqttMessage = this.converter.fromMessage(message, Object.class);
|
||||
if (topic == null && this.defaultTopic == null) {
|
||||
@@ -145,15 +143,6 @@ public abstract class AbstractMqttMessageHandler extends AbstractMessageHandler
|
||||
this.publish(topic == null ? this.defaultTopic : topic, mqttMessage, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked before {@link #publish(String, Object, Message)}.
|
||||
* @deprecated subclasses should check the connection in
|
||||
* {@link #publish(String, Object, Message)}.
|
||||
*/
|
||||
@Deprecated
|
||||
protected void connectIfNeeded() {
|
||||
}
|
||||
|
||||
protected abstract void publish(String topic, Object mqttMessage, Message<?> message) throws Exception;
|
||||
|
||||
}
|
||||
|
||||
@@ -130,16 +130,6 @@ public class RedisQueueInboundGateway extends MessagingGatewaySupport implements
|
||||
this.receiveTimeout = receiveTimeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param stopTimeout the timeout to block {@link #doStop()} until the last message
|
||||
* will be processed or this timeout is reached. Should be less than or equal to {@link #receiveTimeout}
|
||||
* @deprecated since {@literal 4.3} with no-op in favor of delayer call {@code callback.run()}
|
||||
* in the {@link #stop(Runnable)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setStopTimeout(long stopTimeout) {
|
||||
}
|
||||
|
||||
public void setTaskExecutor(Executor taskExecutor) {
|
||||
this.taskExecutor = taskExecutor;
|
||||
}
|
||||
|
||||
@@ -136,17 +136,6 @@ public class RedisQueueMessageDrivenEndpoint extends MessageProducerSupport impl
|
||||
this.receiveTimeout = receiveTimeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param stopTimeout the timeout to block {@link #doStop()} until the last message will be processed
|
||||
* or this timeout is reached. Should be less than or equal to {@link #receiveTimeout}
|
||||
* @since 4.0.3
|
||||
* @deprecated since {@literal 4.3} with no-op in favor of delayer call {@code callback.run()}
|
||||
* in the {@link #stop(Runnable)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setStopTimeout(long stopTimeout) {
|
||||
}
|
||||
|
||||
public void setTaskExecutor(Executor taskExecutor) {
|
||||
this.taskExecutor = taskExecutor;
|
||||
}
|
||||
|
||||
@@ -88,15 +88,6 @@ public class RedisOutboundGateway extends AbstractReplyProducingMessageHandler {
|
||||
this.commandExpression = EXPRESSION_PARSER.parseExpression(commandExpression);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param commandExpression the expression to set.
|
||||
* @deprecated in favor of {@link #setCommandExpression}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setExpressionCommand(Expression commandExpression) {
|
||||
setCommandExpression(commandExpression);
|
||||
}
|
||||
|
||||
public void setArgumentsStrategy(ArgumentsStrategy argumentsStrategy) {
|
||||
this.argumentsStrategy = argumentsStrategy;
|
||||
}
|
||||
|
||||
@@ -80,8 +80,7 @@ public class SftpSession implements Session<LsEntry> {
|
||||
return true;
|
||||
}
|
||||
catch (SftpException e) {
|
||||
// TODO: in 5.0 remove e.toString() INT-3913
|
||||
throw new NestedIOException("Failed to remove file: " + e.toString(), e);
|
||||
throw new NestedIOException("Failed to remove file.", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,11 +40,6 @@ public class ChatMessageInboundChannelAdapterParser extends AbstractXmppInboundC
|
||||
|
||||
@Override
|
||||
protected void postProcess(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
|
||||
if (element.hasAttribute("extract-payload")) {
|
||||
parserContext.getReaderContext()
|
||||
.warning("The 'extract-payload' is deprecated. Use 'payload-expression' instead.", element);
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "extract-payload");
|
||||
}
|
||||
BeanDefinition expression =
|
||||
IntegrationNamespaceUtils.createExpressionDefIfAttributeDefined("payload-expression", element);
|
||||
if (expression != null) {
|
||||
|
||||
@@ -73,17 +73,6 @@ public class XmppConnectionFactoryBean extends AbstractFactoryBean<XMPPConnectio
|
||||
public XmppConnectionFactoryBean() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param connectionConfiguration the {@link XMPPTCPConnectionConfiguration} to use.
|
||||
* @deprecated since {@literal 4.2.5} in favor of {@link #setConnectionConfiguration(XMPPTCPConnectionConfiguration)}
|
||||
* to avoid {@code BeanCurrentlyInCreationException}
|
||||
* during {@code AbstractAutowireCapableBeanFactory.getSingletonFactoryBeanForTypeCheck()}
|
||||
*/
|
||||
@Deprecated
|
||||
public XmppConnectionFactoryBean(XMPPTCPConnectionConfiguration connectionConfiguration) {
|
||||
this.connectionConfiguration = connectionConfiguration;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param connectionConfiguration the {@link XMPPTCPConnectionConfiguration} to use.
|
||||
* @since 4.2.5
|
||||
|
||||
@@ -67,21 +67,6 @@ public class ChatMessageListeningEndpoint extends AbstractXmppConnectionAwareEnd
|
||||
this.headerMapper = headerMapper;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Specify whether the text message body should be extracted when mapping to a
|
||||
* Spring Integration Message payload. Otherwise, the full XMPP Message will be
|
||||
* passed within the payload. This value is <em>true</em> by default.
|
||||
* @param extractPayload true if the payload should be extracted.
|
||||
* @deprecated since version 4.3 in favor of {@link #setPayloadExpression(Expression)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void setExtractPayload(boolean extractPayload) {
|
||||
if (this.payloadExpression == null) {
|
||||
setPayloadExpression(extractPayload ? null : EXPRESSION_PARSER.parseExpression("#this"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify a {@link StanzaFilter} to use for the incoming packets.
|
||||
* @param stanzaFilter the {@link StanzaFilter} to use
|
||||
|
||||
@@ -108,17 +108,6 @@
|
||||
<xsd:complexType>
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="xmppInboundAdapterType">
|
||||
<xsd:attribute name="extract-payload" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
[DEPRECATED]
|
||||
Specifies if generated Message payload should consist of only
|
||||
the text of the XMPP message or the entire XMPP (Smack API specific) message.
|
||||
Default is true.
|
||||
Deprecated since 4.3 in favor of 'payload-expression'.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="payload-expression">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
stanza-filter="stanzaFilter"/>
|
||||
|
||||
<xmpp:inbound-channel-adapter id="autoChannel"
|
||||
xmpp-connection="testConnection" extract-payload="false"
|
||||
xmpp-connection="testConnection" payload-expression="#root"
|
||||
auto-startup="false" error-channel="errorChannel"
|
||||
mapped-request-headers="foo*, xmpp*"/>
|
||||
|
||||
|
||||
@@ -3,20 +3,13 @@
|
||||
xmlns="http://www.springframework.org/schema/integration"
|
||||
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:p="http://www.springframework.org/schema/p"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xmlns:xmpp="http://www.springframework.org/schema/integration/xmpp"
|
||||
xmlns:tool="http://www.springframework.org/schema/tool"
|
||||
xmlns:lang="http://www.springframework.org/schema/lang"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/integration/xmpp
|
||||
http://www.springframework.org/schema/integration/xmpp/spring-integration-xmpp.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
|
||||
http://www.springframework.org/schema/tool http://www.springframework.org/schema/tool/spring-tool.xsd
|
||||
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd">
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
<context:property-placeholder location="classpath:test.properties"/>
|
||||
|
||||
@@ -27,7 +20,8 @@
|
||||
host="${user.1.host}"
|
||||
service-name="${user.1.service}"/>
|
||||
|
||||
<xmpp:inbound-channel-adapter channel="inboundChatChannel" xmpp-connection="testConnection" extract-payload="false"/>
|
||||
<xmpp:inbound-channel-adapter channel="inboundChatChannel" xmpp-connection="testConnection"
|
||||
payload-expression="#root"/>
|
||||
|
||||
<channel id="inboundChatChannel"/>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -73,7 +73,7 @@ public class ChatMessageListeningEndpointTests {
|
||||
|
||||
|
||||
@Test
|
||||
/**
|
||||
/*
|
||||
* Should add/remove StanzaListener when endpoint started/stopped
|
||||
*/
|
||||
public void testLifecycle() {
|
||||
@@ -172,14 +172,14 @@ public class ChatMessageListeningEndpointTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testExpression() throws Exception {
|
||||
TestXMPPConnection testXMPPConnection = new TestXMPPConnection();
|
||||
|
||||
QueueChannel inputChannel = new QueueChannel();
|
||||
|
||||
ChatMessageListeningEndpoint endpoint = new ChatMessageListeningEndpoint(testXMPPConnection);
|
||||
endpoint.setExtractPayload(false);
|
||||
SpelExpressionParser parser = new SpelExpressionParser();
|
||||
endpoint.setPayloadExpression(parser.parseExpression("#root"));
|
||||
endpoint.setOutputChannel(inputChannel);
|
||||
endpoint.setBeanFactory(mock(BeanFactory.class));
|
||||
endpoint.afterPropertiesSet();
|
||||
@@ -223,7 +223,7 @@ public class ChatMessageListeningEndpointTests {
|
||||
xmlPullParser.next();
|
||||
testXMPPConnection.parseAndProcessStanza(xmlPullParser);
|
||||
|
||||
ArgumentCaptor<String> argumentCaptor = new ArgumentCaptor<String>();
|
||||
ArgumentCaptor<String> argumentCaptor = ArgumentCaptor.forClass(String.class);
|
||||
|
||||
assertTrue(logLatch.await(10, TimeUnit.SECONDS));
|
||||
|
||||
|
||||
@@ -60,22 +60,6 @@ public class LeaderInitiatorFactoryBean
|
||||
public LeaderInitiatorFactoryBean() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct the instance.
|
||||
* @param client the {@link CuratorFramework}.
|
||||
* @param path the path in zookeeper.
|
||||
* @param role the role of the leader.
|
||||
* @deprecated since {@literal 4.2.5} in favor of appropriate setters
|
||||
* to avoid {@code BeanCurrentlyInCreationException}
|
||||
* during {@code AbstractAutowireCapableBeanFactory.getSingletonFactoryBeanForTypeCheck()}
|
||||
*/
|
||||
@Deprecated
|
||||
public LeaderInitiatorFactoryBean(CuratorFramework client, String path, String role) {
|
||||
this.client = client;
|
||||
this.path = path;
|
||||
this.candidate = new DefaultCandidate(UUID.randomUUID().toString(), role);
|
||||
}
|
||||
|
||||
public LeaderInitiatorFactoryBean setClient(CuratorFramework client) {
|
||||
this.client = client;
|
||||
return this;
|
||||
|
||||
@@ -234,11 +234,7 @@ To prevent their use, you should configure your own filter (e.g. `AcceptAllFileL
|
||||
[[watch-service-directory-scanner]]
|
||||
==== WatchServiceDirectoryScanner
|
||||
|
||||
This scanner was added in _version 4.2_. It replaces the existing `RecursiveLeafOnlyDirectoryScanner` which is
|
||||
inefficient for large directory trees.
|
||||
The `FileReadingMessageSource.WatchServiceDirectoryScanner` requires Java 7 or above.
|
||||
|
||||
This scanner relies on file system events when new files are added to the directory.
|
||||
The `FileReadingMessageSource.WatchServiceDirectoryScanner` relies on file system events when new files are added to the directory.
|
||||
During initialization, the directory is registered to generate events; the initial file list is also built.
|
||||
While walking the directory tree, any subdirectories encountered are also registered to generate events.
|
||||
On the first poll, the initial file list from walking the directory is returned.
|
||||
@@ -254,9 +250,7 @@ In this case, the root directory is re-scanned completely.
|
||||
To avoid duplicates consider using an appropriate `FileListFilter` such as the `AcceptOnceFileListFilter` and/or
|
||||
remove files when processing is completed.
|
||||
|
||||
Since _version 4.3_, the top level `WatchServiceDirectoryScanner` has been deprecated in favor of
|
||||
`FileReadingMessageSource` internal logic for the `WatchService`.
|
||||
Now this can be enable via `use-watch-service` option, which is mutually exclusive with the `scanner` option.
|
||||
The `WatchServiceDirectoryScanner` can be enable via `FileReadingMessageSource.use-watch-service` option, which is mutually exclusive with the `scanner` option.
|
||||
An internal `FileReadingMessageSource.WatchServiceDirectoryScanner` instance is populated for the provided `directory`.
|
||||
|
||||
In addition, now the `WatchService` polling logic can track the `StandardWatchEventKinds.ENTRY_MODIFY` and
|
||||
|
||||
@@ -720,9 +720,6 @@ if (closeable != null) {
|
||||
}
|
||||
----
|
||||
|
||||
Note: In previous releases the session was in the `file_remoteSession` header, but this is deprecated - use
|
||||
`closeableResource` instead.
|
||||
|
||||
Framework components such as the <<file-splitter,File Splitter>> and <<stream-transformer,Stream Transformer>> will
|
||||
automatically close the session after the data is transferred.
|
||||
|
||||
|
||||
@@ -145,9 +145,6 @@ For example, if you wish to route on the simple method name, you might add a hea
|
||||
NOTE: The `java.reflect.Method` is not serializable; a header with expression `#gatewayMethod` will be lost if you later serialize the message.
|
||||
So, you may wish to use `#gatewayMethod.name` or `#gatewayMethod.toString()` in those cases; the `toString()` method provides a String representation of the method, including parameter and return types.
|
||||
|
||||
NOTE: Prior to 3.0, the `#method` variable was available, representing the method name only.
|
||||
This is still available, but deprecated; use `#gatewayMethod.name` instead.
|
||||
|
||||
Since 3.0, `<default-header/>` s can be defined to add headers to all messages produced by the gateway, regardless of the method invoked.
|
||||
Specific headers defined for a method take precedence over default headers.
|
||||
Specific headers defined for a method here will override any `@Header` annotations in the service interface.
|
||||
|
||||
@@ -632,8 +632,6 @@ http://static.springsource.org/spring/docs/current/javadoc-api/org/springframewo
|
||||
|
||||
http://static.springsource.org/spring/docs/current/javadoc-api/org/springframework/http/client/HttpComponentsClientHttpRequestFactory.html[HttpComponentsClientHttpRequestFactory] - Uses http://hc.apache.org/httpcomponents-client-ga/[Apache HttpComponents HttpClient] (Since Spring 3.1)
|
||||
|
||||
http://static.springsource.org/spring/docs/current/javadoc-api/org/springframework/http/client/CommonsClientHttpRequestFactory.html[ClientHttpRequestFactory] - Uses http://hc.apache.org/httpclient-3.x/[Jakarta Commons HttpClient] (Deprecated as of Spring 3.1)
|
||||
|
||||
If you don't explicitly configure the _request-factory_ or _rest-template_ attribute respectively, then a default RestTemplate which uses a `SimpleClientHttpRequestFactory` will be instantiated.
|
||||
|
||||
[NOTE]
|
||||
|
||||
@@ -420,21 +420,7 @@ Configuring a connection interceptor factory chain.
|
||||
=== TCP Connection Events
|
||||
|
||||
Beginning with version 3.0, changes to `TcpConnection` s are reported by `TcpConnectionEvent` s.
|
||||
`TcpConnectionEvent` is a subclass of `ApplicationEvent` and thus can be received by any `ApplicationListener` defined in the `ApplicationContext`.
|
||||
|
||||
[NOTE]
|
||||
=====
|
||||
The following is deprecated as of _version 4.2_; use the generic Event Inbound Channel Adapter instead.
|
||||
See <<appevent-inbound>>.
|
||||
|
||||
For convenience, a `<int-ip:tcp-connection-event-inbound-channel-adapter/>` is provided.
|
||||
This adapter will receive all `TcpConnectionEvent` s (by default), and send them to its `channel`.
|
||||
The adapter accepts an `event-type` attribute, which is a list of class names for events that should be sent.
|
||||
This can be used if an application subclasses `TcpConnectionEvent` for some reason, and wishes to only receive those events.
|
||||
Omitting this attribute will mean that all `TcpConnectionEvent` s will be sent.
|
||||
You can also use this to limit which `TcpConnectionEvent` s you are interested in ( `TcpConnectionOpenEvent`, `TcpConnectionCloseEvent`, or `TcpConnectionExceptionEvent`).
|
||||
=====
|
||||
|
||||
`TcpConnectionEvent` is a subclass of `ApplicationEvent` and thus can be received by any `ApplicationListener` defined in the `ApplicationContext`, for example <<appevent-inbound,Event Inbound Channel Adapter>>.
|
||||
|
||||
`TcpConnectionEvents` have the following properties:
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ Either this attribute or the _entity-manager_ attribute or the _jpa-operations_
|
||||
*entity-manager*
|
||||
|
||||
The reference to the JPA Entity Manager that will be used by the component.
|
||||
Either this attribute or the _enity-manager-factory_ attribute or the _jpa-operations_ attribute must be provided.
|
||||
Either this attribute or the _entity-manager-factory_ attribute or the _jpa-operations_ attribute must be provided.
|
||||
|
||||
NOTE: Usually your Spring Application Context only defines a JPA Entity Manager Factory and the EntityManager is injected using the @PersistenceContext annotation.
|
||||
This, however, is not applicable for the Spring Integration JPA components.
|
||||
|
||||
@@ -809,9 +809,6 @@ if (closeable != null) {
|
||||
}
|
||||
----
|
||||
|
||||
Note: In previous releases the session was in the `file_remoteSession` header, but this is deprecated - use
|
||||
`closeableResource` instead.
|
||||
|
||||
Framework components such as the <<file-splitter,File Splitter>> and <<stream-transformer,Stream Transformer>> will
|
||||
automatically close the session after the data is transferred.
|
||||
|
||||
|
||||
@@ -814,7 +814,7 @@ If you need to extend beyond the capabilities of that default implementation, th
|
||||
[[xml-xpath-header-enricher]]
|
||||
=== XPath Header Enricher
|
||||
|
||||
The XPath Header Enricher defines a Header Enricher Message Transformer that evaluates XPath expressions against the message payload and inserts the result of the evaluation into a messsage header.
|
||||
The XPath Header Enricher defines a Header Enricher Message Transformer that evaluates XPath expressions against the message payload and inserts the result of the evaluation into a message header.
|
||||
|
||||
Please see below for an overview of all available configuration parameters:
|
||||
|
||||
|
||||
@@ -120,9 +120,6 @@ The samples above with the `namespace` manipulations can be simplified to someth
|
||||
payload-expression="#extension.bodies[0]"
|
||||
----
|
||||
|
||||
|
||||
NOTE: The `extract-payload` option has been deprecated in favor of the new `payload-expression` one.
|
||||
|
||||
[[xmpp-message-outbound-channel-adapter]]
|
||||
==== Outbound Message Channel Adapter
|
||||
|
||||
|
||||
Reference in New Issue
Block a user