From 7da027ad63195868ab3a278835c2b77ec3547483 Mon Sep 17 00:00:00 2001 From: Gary Russell Date: Wed, 27 Nov 2013 12:40:18 -0500 Subject: [PATCH] INT-3189 Fix JavaDocs Links to classes moved to `spring-messaging`. Also `MessageHeaders` was inadvertently added back in by the last merge. JIRA: https://jira.springsource.org/browse/INT-3189 __NOTE: Merge to 4.0.0-WIP, not master__ --- .../integration/MessageHeaders.java | 273 ------------------ ...essionEvaluatingMessageGroupProcessor.java | 2 +- .../integration/channel/PriorityChannel.java | 12 +- .../channel/PublishSubscribeChannel.java | 2 +- .../gateway/MethodArgsMessageMapper.java | 2 +- ...ressionEvaluatingRequestHandlerAdvice.java | 5 +- .../router/AbstractMappingMessageRouter.java | 2 +- .../router/MethodInvokingRouter.java | 2 +- .../channel/BeanFactoryChannelResolver.java | 6 +- .../converter/MapMessageConverter.java | 6 +- .../jmx/OperationInvokingMessageHandler.java | 2 +- .../ConfigurableMongoDbMessageStore.java | 2 +- 12 files changed, 22 insertions(+), 294 deletions(-) delete mode 100644 spring-integration-core/src/main/java/org/springframework/integration/MessageHeaders.java diff --git a/spring-integration-core/src/main/java/org/springframework/integration/MessageHeaders.java b/spring-integration-core/src/main/java/org/springframework/integration/MessageHeaders.java deleted file mode 100644 index 4f9b4789e7..0000000000 --- a/spring-integration-core/src/main/java/org/springframework/integration/MessageHeaders.java +++ /dev/null @@ -1,273 +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; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.springframework.util.AlternativeJdkIdGenerator; -import org.springframework.util.IdGenerator; - -/** - * The headers for a {@link Message}.
- * IMPORTANT: MessageHeaders are immutable. Any mutating operation (e.g., put(..), putAll(..) etc.) - * will result in {@link UnsupportedOperationException} - * To create MessageHeaders instance use fluent MessageBuilder API - *
- * MessageBuilder.withPayload("foo").setHeader("key1", "value1").setHeader("key2", "value2");
- * 
- * or create an instance of GenericMessage passing payload as {@link Object} and headers as a regular {@link Map} - *
- * Map headers = new HashMap();
- * headers.put("key1", "value1");
- * headers.put("key2", "value2");
- * new GenericMessage("foo", headers);
- * 
- * - * @author Arjen Poutsma - * @author Mark Fisher - * @author Oleg Zhurakousky - * @author Gary Russell - * @author Rossen Stoyanchev - */ -public final class MessageHeaders implements Map, Serializable { - - private static final long serialVersionUID = 6901029029524535147L; - - private static final Log logger = LogFactory.getLog(MessageHeaders.class); - - private static volatile IdGenerator idGenerator = null; - - private static final IdGenerator defaultIdGenerator = new AlternativeJdkIdGenerator(); - - /** - * The key for the Message ID. This is an automatically generated UUID and - * should never be explicitly set in the header map except in the - * case of Message deserialization where the serialized Message's generated - * UUID is being restored. - */ - public static final String ID = "id"; - - public static final String TIMESTAMP = "timestamp"; - - public static final String CORRELATION_ID = "correlationId"; - - public static final String REPLY_CHANNEL = "replyChannel"; - - public static final String ERROR_CHANNEL = "errorChannel"; - - public static final String EXPIRATION_DATE = "expirationDate"; - - public static final String PRIORITY = "priority"; - - public static final String SEQUENCE_NUMBER = "sequenceNumber"; - - public static final String SEQUENCE_SIZE = "sequenceSize"; - - public static final String SEQUENCE_DETAILS = "sequenceDetails"; - - public static final String CONTENT_TYPE = "content-type"; - - public static final String POSTPROCESS_RESULT = "postProcessResult"; - - - private final Map headers; - - - public MessageHeaders(Map headers) { - this.headers = (headers != null) ? new HashMap(headers) : new HashMap(); - IdGenerator generatorToUse = (idGenerator != null) ? idGenerator : defaultIdGenerator; - this.headers.put(ID, generatorToUse.generateId()); - - this.headers.put(TIMESTAMP, new Long(System.currentTimeMillis())); - } - - public UUID getId() { - return this.get(ID, UUID.class); - } - - public Long getTimestamp() { - return this.get(TIMESTAMP, Long.class); - } - - public Long getExpirationDate() { - return this.get(EXPIRATION_DATE, Long.class); - } - - public Object getCorrelationId() { - return this.get(CORRELATION_ID); - } - - public Object getReplyChannel() { - return this.get(REPLY_CHANNEL); - } - - public Object getErrorChannel() { - return this.get(ERROR_CHANNEL); - } - - public Integer getSequenceNumber() { - Integer sequenceNumber = this.get(SEQUENCE_NUMBER, Integer.class); - return (sequenceNumber != null ? sequenceNumber : 0); - } - - public Integer getSequenceSize() { - Integer sequenceSize = this.get(SEQUENCE_SIZE, Integer.class); - return (sequenceSize != null ? sequenceSize : 0); - } - - public Integer getPriority() { - return this.get(PRIORITY, Integer.class); - } - - @SuppressWarnings("unchecked") - public T get(Object key, Class type) { - Object value = this.headers.get(key); - if (value == null) { - return null; - } - if (!type.isAssignableFrom(value.getClass())) { - throw new IllegalArgumentException("Incorrect type specified for header '" + key + "'. Expected [" + type - + "] but actual type is [" + value.getClass() + "]"); - } - return (T) value; - } - - @Override - public int hashCode() { - return this.headers.hashCode(); - } - - @Override - public boolean equals(Object object) { - if (this == object) { - return true; - } - if (object != null && object instanceof MessageHeaders) { - MessageHeaders other = (MessageHeaders) object; - return this.headers.equals(other.headers); - } - return false; - } - - @Override - public String toString() { - return this.headers.toString(); - } - - /* - * Map implementation - */ - - public boolean containsKey(Object key) { - return this.headers.containsKey(key); - } - - public boolean containsValue(Object value) { - return this.headers.containsValue(value); - } - - public Set> entrySet() { - return Collections.unmodifiableSet(this.headers.entrySet()); - } - - public Object get(Object key) { - return this.headers.get(key); - } - - public boolean isEmpty() { - return this.headers.isEmpty(); - } - - public Set keySet() { - return Collections.unmodifiableSet(this.headers.keySet()); - } - - public int size() { - return this.headers.size(); - } - - public Collection values() { - return Collections.unmodifiableCollection(this.headers.values()); - } - - /* - * Unsupported operations - */ - /** - * Since MessageHeaders are immutable the call to this method will result in {@link UnsupportedOperationException} - */ - public Object put(String key, Object value) { - throw new UnsupportedOperationException("MessageHeaders is immutable."); - } - /** - * Since MessageHeaders are immutable the call to this method will result in {@link UnsupportedOperationException} - */ - public void putAll(Map t) { - throw new UnsupportedOperationException("MessageHeaders is immutable."); - } - /** - * Since MessageHeaders are immutable the call to this method will result in {@link UnsupportedOperationException} - */ - public Object remove(Object key) { - throw new UnsupportedOperationException("MessageHeaders is immutable."); - } - /** - * Since MessageHeaders are immutable the call to this method will result in {@link UnsupportedOperationException} - */ - public void clear() { - throw new UnsupportedOperationException("MessageHeaders is immutable."); - } - - /* - * Serialization methods - */ - - private void writeObject(ObjectOutputStream out) throws IOException { - List keysToRemove = new ArrayList(); - for (Map.Entry entry : this.headers.entrySet()) { - if (!(entry.getValue() instanceof Serializable)) { - keysToRemove.add(entry.getKey()); - } - } - for (String key : keysToRemove) { - if (logger.isInfoEnabled()) { - logger.info("removing non-serializable header: " + key); - } - this.headers.remove(key); - } - out.defaultWriteObject(); - } - - private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { - in.defaultReadObject(); - } - -} diff --git a/spring-integration-core/src/main/java/org/springframework/integration/aggregator/ExpressionEvaluatingMessageGroupProcessor.java b/spring-integration-core/src/main/java/org/springframework/integration/aggregator/ExpressionEvaluatingMessageGroupProcessor.java index 62c316d15c..6ef2f53c00 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/aggregator/ExpressionEvaluatingMessageGroupProcessor.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/aggregator/ExpressionEvaluatingMessageGroupProcessor.java @@ -54,7 +54,7 @@ public class ExpressionEvaluatingMessageGroupProcessor extends AbstractAggregati /** * Evaluate the expression provided on the messages (a collection) in the group, and delegate to the - * {@link MessagingTemplate} to send downstream. + * {@link org.springframework.integration.core.MessagingTemplate} to send downstream. */ @Override protected Object aggregatePayloads(MessageGroup group, Map headers) { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/PriorityChannel.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/PriorityChannel.java index 796a57f9b3..310936f5df 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/PriorityChannel.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/PriorityChannel.java @@ -20,10 +20,10 @@ import java.util.Comparator; import java.util.concurrent.PriorityBlockingQueue; import java.util.concurrent.atomic.AtomicLong; -import org.springframework.messaging.Message; -import org.springframework.messaging.MessageHeaders; import org.springframework.integration.EiMessageHeaderAccessor; import org.springframework.integration.util.UpperBound; +import org.springframework.messaging.Message; +import org.springframework.messaging.MessageHeaders; /** * A message channel that prioritizes messages based on a {@link Comparator}. @@ -43,7 +43,7 @@ public class PriorityChannel extends QueueChannel { * is a non-positive value, the queue will be unbounded. Message priority * will be determined by the provided {@link Comparator}. If the comparator * is null, the priority will be based upon the value of - * {@link MessageHeaders#getPriority()}. + * {@link EiMessageHeaderAccessor#getPriority()}. */ public PriorityChannel(int capacity, Comparator> comparator) { super(new PriorityBlockingQueue>(11, new SequenceFallbackComparator(comparator))); @@ -52,7 +52,7 @@ public class PriorityChannel extends QueueChannel { /** * Create a channel with the specified queue capacity. Message priority - * will be based upon the value of {@link MessageHeaders#getPriority()}. + * will be based upon the value of {@link EiMessageHeaderAccessor#getPriority()}. */ public PriorityChannel(int capacity) { this(capacity, null); @@ -62,7 +62,7 @@ public class PriorityChannel extends QueueChannel { * Create a channel with an unbounded queue. Message priority will be * determined by the provided {@link Comparator}. If the comparator * is null, the priority will be based upon the value of - * {@link MessageHeaders#getPriority()}. + * {@link EiMessageHeaderAccessor#getPriority()}. */ public PriorityChannel(Comparator> comparator) { this(0, comparator); @@ -70,7 +70,7 @@ public class PriorityChannel extends QueueChannel { /** * Create a channel with an unbounded queue. Message priority will be - * based on the value of {@link MessageHeaders#getPriority()}. + * based on the value of {@link EiMessageHeaderAccessor#getPriority()}. */ public PriorityChannel() { this(0, null); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/PublishSubscribeChannel.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/PublishSubscribeChannel.java index e80dbf70b8..514c032d35 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/PublishSubscribeChannel.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/PublishSubscribeChannel.java @@ -121,7 +121,7 @@ public class PublishSubscribeChannel extends AbstractSubscribableChannel { /** * If at least this number of subscribers receive the message, - * {@link #send(org.springframework.integration.Message)} + * {@link #send(org.springframework.messaging.Message)} * will return true. Default: 0. * @param minSubscribers The minimum number of subscribers. */ diff --git a/spring-integration-core/src/main/java/org/springframework/integration/gateway/MethodArgsMessageMapper.java b/spring-integration-core/src/main/java/org/springframework/integration/gateway/MethodArgsMessageMapper.java index 70df6db7c9..0d28fbe78a 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/gateway/MethodArgsMessageMapper.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/gateway/MethodArgsMessageMapper.java @@ -19,7 +19,7 @@ import org.springframework.integration.mapping.InboundMessageMapper; /** * Implementations of this interface are {@link InboundMessageMapper}s - * that map a {@link MethodArgsHolder} to a {@link org.springframework.integration.Message}. + * that map a {@link MethodArgsHolder} to a {@link org.springframework.messaging.Message}. * * @author Gary Russell * @since 3.0 diff --git a/spring-integration-core/src/main/java/org/springframework/integration/handler/advice/ExpressionEvaluatingRequestHandlerAdvice.java b/spring-integration-core/src/main/java/org/springframework/integration/handler/advice/ExpressionEvaluatingRequestHandlerAdvice.java index 1ff553cacb..5fe60bd69e 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/handler/advice/ExpressionEvaluatingRequestHandlerAdvice.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/handler/advice/ExpressionEvaluatingRequestHandlerAdvice.java @@ -19,14 +19,13 @@ import org.springframework.expression.EvaluationContext; import org.springframework.expression.Expression; import org.springframework.expression.spel.standard.SpelExpressionParser; import org.springframework.expression.spel.support.StandardEvaluationContext; +import org.springframework.integration.core.MessagingTemplate; import org.springframework.integration.expression.ExpressionUtils; import org.springframework.integration.message.AdviceMessage; import org.springframework.messaging.Message; import org.springframework.messaging.MessageChannel; import org.springframework.messaging.MessageHandler; -import org.springframework.messaging.MessageHeaders; import org.springframework.messaging.MessagingException; -import org.springframework.integration.core.MessagingTemplate; import org.springframework.messaging.support.ErrorMessage; import org.springframework.util.Assert; @@ -35,7 +34,7 @@ import org.springframework.util.Assert; * Two expressions 'onSuccessExpression' and 'onFailureExpression' are evaluated when * appropriate. If the evaluation returns a result, a message is sent to the onSuccessChannel * or onFailureChannel as appropriate; the message is the input message with a header - * {@link MessageHeaders#POSTPROCESS_RESULT} containing the evaluation result. + * {@link org.springframework.integration.EiMessageHeaderAccessor#POSTPROCESS_RESULT} containing the evaluation result. * The failure expression is NOT evaluated if the success expression throws an exception. * @author Gary Russell * @since 2.2 diff --git a/spring-integration-core/src/main/java/org/springframework/integration/router/AbstractMappingMessageRouter.java b/spring-integration-core/src/main/java/org/springframework/integration/router/AbstractMappingMessageRouter.java index 4aba086c06..b6c058b376 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/router/AbstractMappingMessageRouter.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/router/AbstractMappingMessageRouter.java @@ -60,7 +60,7 @@ public abstract class AbstractMappingMessageRouter extends AbstractMessageRouter /** * Provide mappings from channel keys to channel names. - * Channel names will be resolved by the {@link ChannelResolver}. + * Channel names will be resolved by the {@link DestinationResolver}. */ public void setChannelMappings(Map channelMappings) { Map oldChannelMappings = this.channelMappings; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/router/MethodInvokingRouter.java b/spring-integration-core/src/main/java/org/springframework/integration/router/MethodInvokingRouter.java index ea2c112192..bea364e292 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/router/MethodInvokingRouter.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/router/MethodInvokingRouter.java @@ -27,7 +27,7 @@ import org.springframework.integration.handler.MethodInvokingMessageProcessor; * method's return value may be a single MessageChannel instance, a single * String to be interpreted as a channel name, or a Collection (or Array) of * either type. If the method returns channel names, then a - * {@link ChannelResolver} is required. + * {@link org.springframework.messaging.core.DestinationResolver} is required. * * @author Mark Fisher * @author Artem Bilan diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/channel/BeanFactoryChannelResolver.java b/spring-integration-core/src/main/java/org/springframework/integration/support/channel/BeanFactoryChannelResolver.java index c2164b5da6..c47d93b85a 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/channel/BeanFactoryChannelResolver.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/support/channel/BeanFactoryChannelResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * 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. @@ -29,12 +29,14 @@ import org.springframework.messaging.core.DestinationResolver; import org.springframework.util.Assert; /** - * {@link ChannelResolver} implementation based on a Spring {@link BeanFactory}. + * {@link DestinationResolver} implementation based on a Spring {@link BeanFactory}. * *

Will lookup Spring managed beans identified by bean name, * expecting them to be of type {@link MessageChannel}. * * @author Mark Fisher + * @author Gary Russell + * * @see org.springframework.beans.factory.BeanFactory */ public class BeanFactoryChannelResolver implements DestinationResolver, BeanFactoryAware { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/converter/MapMessageConverter.java b/spring-integration-core/src/main/java/org/springframework/integration/support/converter/MapMessageConverter.java index 00883f9298..ccdd86b48d 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/converter/MapMessageConverter.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/support/converter/MapMessageConverter.java @@ -38,8 +38,8 @@ public class MapMessageConverter implements MessageConverter { private volatile boolean filterHeadersInToMessage; /** - * Headers to be converted in {@link #fromMessage(Message)}. - * {@link #toMessage(Object)} will populate all headers found in + * Headers to be converted in {@link #fromMessage(Message, Class)}. + * {@link #toMessage(Object, MessageHeaders)} will populate all headers found in * the map, unless {@link #filterHeadersInToMessage} is true. * @param headerNames */ @@ -48,7 +48,7 @@ public class MapMessageConverter implements MessageConverter { } /** - * By default all headers on Map passed to {@link #toMessage(Object)} + * By default all headers on Map passed to {@link #toMessage(Object, MessageHeaders)} * will be mapped. Set this property * to 'true' if you wish to limit the inbound headers to those in * the #headerNames. diff --git a/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/OperationInvokingMessageHandler.java b/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/OperationInvokingMessageHandler.java index d7e6af31ad..270d774e64 100644 --- a/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/OperationInvokingMessageHandler.java +++ b/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/OperationInvokingMessageHandler.java @@ -42,7 +42,7 @@ import org.springframework.util.Assert; import org.springframework.util.ObjectUtils; /** - * A {@link MessageHandler} implementation for invoking JMX operations based on + * A {@link org.springframework.messaging.MessageHandler} implementation for invoking JMX operations based on * the Message sent to its {@link #handleMessage(Message)} method. Message headers * will be checked first when resolving the 'objectName' and 'operationName' to be * invoked on an MBean. These values would be supplied with the Message headers diff --git a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/ConfigurableMongoDbMessageStore.java b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/ConfigurableMongoDbMessageStore.java index 6eb1049996..5d72cc3b53 100644 --- a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/ConfigurableMongoDbMessageStore.java +++ b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/ConfigurableMongoDbMessageStore.java @@ -46,7 +46,6 @@ import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Order; import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Update; -import org.springframework.integration.MessageHeaders; import org.springframework.integration.store.AbstractMessageGroupStore; import org.springframework.integration.store.MessageGroup; import org.springframework.integration.store.MessageGroupStore; @@ -54,6 +53,7 @@ import org.springframework.integration.store.MessageStore; import org.springframework.integration.store.SimpleMessageGroup; import org.springframework.integration.support.MessageBuilder; import org.springframework.messaging.Message; +import org.springframework.messaging.MessageHeaders; import org.springframework.util.Assert; /**