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__
This commit is contained in:
@@ -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}.<br>
|
||||
* 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
|
||||
* <pre class="code">
|
||||
* MessageBuilder.withPayload("foo").setHeader("key1", "value1").setHeader("key2", "value2");
|
||||
* </pre>
|
||||
* or create an instance of GenericMessage passing payload as {@link Object} and headers as a regular {@link Map}
|
||||
* <pre class="code">
|
||||
* Map headers = new HashMap();
|
||||
* headers.put("key1", "value1");
|
||||
* headers.put("key2", "value2");
|
||||
* new GenericMessage("foo", headers);
|
||||
* </pre>
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @author Mark Fisher
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Gary Russell
|
||||
* @author Rossen Stoyanchev
|
||||
*/
|
||||
public final class MessageHeaders implements Map<String, Object>, 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 <b>except</b> 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<String, Object> headers;
|
||||
|
||||
|
||||
public MessageHeaders(Map<String, Object> headers) {
|
||||
this.headers = (headers != null) ? new HashMap<String, Object>(headers) : new HashMap<String, Object>();
|
||||
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> T get(Object key, Class<T> 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<Map.Entry<String, Object>> 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<String> keySet() {
|
||||
return Collections.unmodifiableSet(this.headers.keySet());
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return this.headers.size();
|
||||
}
|
||||
|
||||
public Collection<Object> 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<? extends String, ? extends Object> 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<String> keysToRemove = new ArrayList<String>();
|
||||
for (Map.Entry<String, Object> 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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<String, Object> headers) {
|
||||
|
||||
@@ -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 <code>null</code>, the priority will be based upon the value of
|
||||
* {@link MessageHeaders#getPriority()}.
|
||||
* {@link EiMessageHeaderAccessor#getPriority()}.
|
||||
*/
|
||||
public PriorityChannel(int capacity, Comparator<Message<?>> comparator) {
|
||||
super(new PriorityBlockingQueue<Message<?>>(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 <code>null</code>, the priority will be based upon the value of
|
||||
* {@link MessageHeaders#getPriority()}.
|
||||
* {@link EiMessageHeaderAccessor#getPriority()}.
|
||||
*/
|
||||
public PriorityChannel(Comparator<Message<?>> 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);
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<String, String> channelMappings) {
|
||||
Map<String, String> oldChannelMappings = this.channelMappings;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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}.
|
||||
*
|
||||
* <p>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<MessageChannel>, BeanFactoryAware {
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user