eliminated all javadoc warnings; no API changes, with the exception of adding generics metadata to GatewayProxyFactoryBean (now 'implements FactoryBean<Object>').

This commit is contained in:
Chris Beams
2010-05-20 17:50:32 +00:00
parent cf6027e3b7
commit 233994116c
38 changed files with 453 additions and 499 deletions

View File

@@ -16,7 +16,9 @@
package org.springframework.integration.ip;
import java.net.DatagramSocket;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketAddress;
import java.util.concurrent.ExecutorService;
@@ -27,7 +29,7 @@ import org.springframework.util.Assert;
/**
* Base class for all TCP/UDP MessageHandlers.
*
*
* @author Gary Russell
* @since 2.0
*/
@@ -36,9 +38,9 @@ public abstract class AbstractInternetProtocolSendingMessageHandler implements M
protected final Log logger = LogFactory.getLog(getClass());
protected final SocketAddress destinationAddress;
protected final String host;
protected final int port;
protected volatile int soSendBufferSize = -1;
@@ -57,7 +59,8 @@ public abstract class AbstractInternetProtocolSendingMessageHandler implements M
/**
* @see {@link Socket#setSoTimeout(int)} and {@link DatagramSocket#setSoTimeout(int)}
* @see Socket#setSoTimeout(int)
* @see DatagramSocket#setSoTimeout(int)
* @param timeout
*/
public void setSoTimeout(int timeout) {
@@ -65,21 +68,22 @@ public abstract class AbstractInternetProtocolSendingMessageHandler implements M
}
/**
* @see {@link Socket#setReceiveBufferSize(int)} and {@link DatagramSocket#setReceiveBufferSize(int)}
* @see Socket#setReceiveBufferSize(int)
* @see DatagramSocket#setReceiveBufferSize(int)
* @param size
*/
public void setSoReceiveBufferSize(int size) {
}
/**
* @see {@link Socket#setSendBufferSize(int)} and {@link DatagramSocket#setSendBufferSize(int)}
* @see Socket#setSendBufferSize(int)
* @see DatagramSocket#setSendBufferSize(int)
* @param size
*/
public void setSoSendBufferSize(int size) {
this.soSendBufferSize = size;
}
/**
* @return the port
*/

View File

@@ -89,11 +89,11 @@ public abstract class IpAdapterParserUtils {
/**
* Adds a constructor-arg to the bean definition with the value
* of the attribute whose name is provided if that attribute is
* defined in the given element.
* Adds a constructor-arg to the provided bean definition builder
* with the value of the attribute whose name is provided if that
* attribute is defined in the given element.
*
* @param beanDefinition the bean definition to be configured
* @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
* used to populate the property

View File

@@ -100,7 +100,7 @@ public abstract class AbstractTcpReceivingChannelAdapter extends
}
/**
* @see {@link Socket#setKeepAlive(boolean)}.
* @see Socket#setKeepAlive(boolean)
* @param soKeepAlive the soKeepAlive to set
*/
public void setSoKeepAlive(boolean soKeepAlive) {
@@ -108,7 +108,7 @@ public abstract class AbstractTcpReceivingChannelAdapter extends
}
/**
* @See {@link MessageFormats}
* @see MessageFormats
* @param messageFormat the messageFormat to set
*/
public void setMessageFormat(int messageFormat) {

View File

@@ -25,13 +25,14 @@ import java.nio.ByteBuffer;
* data is wrapped in a wire protocol based on the messageFormat property.
*
* @author Gary Russell
*
*/
public class NetSocketWriter extends AbstractSocketWriter {
protected Socket socket;
/**
* Constructs a NetSocketWriter for the Socket.
*
* @param socket The socket.
*/
public NetSocketWriter(Socket socket) {

View File

@@ -255,7 +255,7 @@ public class NioSocketReader extends AbstractSocketReader {
/**
* Reads data into the rawBuffer for non-deterministic algorithms.
* @return true If data is available.
* @return true if data is available.
* @throws IOException
*/
protected boolean readChannelNonDeterministic() throws IOException {
@@ -287,8 +287,6 @@ public class NioSocketReader extends AbstractSocketReader {
/**
* Allocates a ByteBuffer of the requested length using normal or
* direct buffers, depending on the usingDirectBuffers field.
* @param length
* @return
*/
protected ByteBuffer allocate(int length) {
ByteBuffer buffer;
@@ -319,9 +317,6 @@ public class NioSocketReader extends AbstractSocketReader {
return this.channel.socket().getInetAddress();
}
/**
* @return the usingeDirectBuffers
*/
public boolean isUsingDirectBuffers() {
return usingDirectBuffers;
}

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.ip.tcp;
import java.io.IOException;
@@ -22,46 +23,45 @@ import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
/**
* A {@link SocketWriter} that writes to a {@link java.nio.channels.SocketChannel}. The
* A {@link SocketWriter} that writes to a {@link SocketChannel}. The
* data is wrapped in a wire protocol based on the messageFormat property.
*
* @author Gary Russell
*
*/
public class NioSocketWriter extends AbstractSocketWriter {
protected SocketChannel channel;
/**
* If true, direct buffers are used.
* @see {@link ByteBuffer} for more information.
* If true, direct buffers are used.
* @see ByteBuffer for more information
*/
protected boolean usingDirectBuffers;
/**
* A buffer containing the length part when the messageFormat is
* A buffer containing the length part when the messageFormat is
* {@link MessageFormats#FORMAT_LENGTH_HEADER}.
*/
protected ByteBuffer lengthPart;
/**
* A buffer containing the STX for when the messageFormat is
* A buffer containing the STX for when the messageFormat is
* {@link MessageFormats#FORMAT_STX_ETX}.
*/
protected ByteBuffer stxPart;
/**
* A buffer containing the ETX for when the messageFormat is
* A buffer containing the ETX for when the messageFormat is
* {@link MessageFormats#FORMAT_STX_ETX}.
*/
protected ByteBuffer etxPart;
/**
* A buffer containing the CRLF for when the messageFormat is
* A buffer containing the CRLF for when the messageFormat is
* {@link MessageFormats#FORMAT_CRLF}.
*/
protected ByteBuffer crLfPart;
/**
* If we are using direct buffers, we don't want to churn them using
* normal heap management. But,
@@ -70,19 +70,16 @@ public class NioSocketWriter extends AbstractSocketWriter {
* We handle this with a blocking queue.
*/
protected BlockingQueue<ByteBuffer> buffers;
protected int maxBuffers = 2;
protected int bufferCount = 0;
private int sendBufferSize;
/**
* @param socket
*/
public NioSocketWriter(SocketChannel channel,
int maxBuffers,
int sendBufferSize) {
public NioSocketWriter(SocketChannel channel,
int maxBuffers,
int sendBufferSize) {
this.channel = channel;
this.maxBuffers = maxBuffers;
if (sendBufferSize <= 0) {
@@ -91,9 +88,9 @@ public class NioSocketWriter extends AbstractSocketWriter {
this.sendBufferSize = sendBufferSize;
buffers = new LinkedBlockingQueue<ByteBuffer>(maxBuffers);
}
/**
* @param usingDirectBuffers the usingDirectBuffers to set
* @param usingDirectBuffers whether direct buffers are to be used
*/
public void setUsingDirectBuffers(boolean usingDirectBuffers) {
this.usingDirectBuffers = usingDirectBuffers;
@@ -115,13 +112,13 @@ public class NioSocketWriter extends AbstractSocketWriter {
buffer.clear();
return buffer;
}
protected void returnBuffer(ByteBuffer buffer) {
if (buffer != null) {
buffers.offer(buffer);
}
}
/* (non-Javadoc)
* @see org.springframework.integration.ip.tcp.AbstractSocketWriter#writeCrLfFormat(byte[])
*/
@@ -218,7 +215,6 @@ public class NioSocketWriter extends AbstractSocketWriter {
} finally {
returnBuffer(buffer);
}
}
synchronized (channel) {
if (stxPart == null) {
@@ -257,5 +253,4 @@ public class NioSocketWriter extends AbstractSocketWriter {
} catch (IOException e) {}
}
}

View File

@@ -84,25 +84,24 @@ public class SimpleTcpNetOutboundGateway extends
}
/**
* @param obj
* @return
* @see java.lang.Object#equals(java.lang.Object)
* @see java.lang.Object#equals(Object)
* @return whether the MessageHandler delegate for this Gateway is equal to the provided object
*/
public boolean equals(Object obj) {
return handler.equals(obj);
}
/**
* @return
* @see org.springframework.integration.ip.AbstractInternetProtocolSendingMessageHandler#getPort()
* @return the port number of the MessageHandler delegate for this Gateway
*/
public int getPort() {
return handler.getPort();
}
/**
* @return
* @see java.lang.Object#hashCode()
* @return hashcode value of the MessageHandler delegate for this Gateway
*/
public int hashCode() {
return handler.hashCode();
@@ -184,7 +183,7 @@ public class SimpleTcpNetOutboundGateway extends
}
/**
* @param customSocketReaderClass the customSocketReader to set
* @param customSocketReaderClassName the {@link NetSocketReader} class to use
* @throws ClassNotFoundException
*/
@SuppressWarnings("unchecked")

View File

@@ -25,7 +25,7 @@ import org.springframework.integration.core.Message;
import org.springframework.integration.ip.util.SocketIoUtils;
/**
* Tcp Receiving Channel adapter that uses a {@link java.net.Socket}. Each
* Tcp Receiving Channel adapter that uses a {@link Socket}. Each
* connected socket uses a dedicated thread so the pool size must be set
* accordingly.
*
@@ -38,8 +38,8 @@ public class TcpNetReceivingChannelAdapter extends
protected ServerSocket serverSocket;
protected Class<NetSocketReader> customSocketReaderClass;
/**
* Constructs a TcpNetReceivingChannelAdapter that listens on the port.
* @param port The port.
* Constructs a TcpNetReceivingChannelAdapter that listens on the provided port.
* @param port the port on which to listen
*/
public TcpNetReceivingChannelAdapter(int port) {
super(port);
@@ -87,8 +87,6 @@ public class TcpNetReceivingChannelAdapter extends
* Constructs a {@link NetSocketReader} and calls its {@link NetSocketReader#assembledData}
* method repeatedly; for each assembled message, calls {@link #sendMessage(Message)} with
* the mapped message.
*
* @param socket
*/
protected void handleSocket(Socket socket) {
NetSocketReader reader = SocketIoUtils.createNetReader(messageFormat,
@@ -106,11 +104,6 @@ public class TcpNetReceivingChannelAdapter extends
}
}
/**
* @param reader
* @return
* @throws Exception
*/
protected void processMessage(NetSocketReader reader)
throws Exception {
Message<byte[]> message = mapper.toMessage(reader);
@@ -131,8 +124,8 @@ public class TcpNetReceivingChannelAdapter extends
}
/**
* @param customSocketReaderClass the customSocketReader to set
* @throws ClassNotFoundException
* @param customSocketReaderClassName the {@link NetSocketReader} class to use
* @throws ClassNotFoundException if the named class cannot be loaded
*/
@SuppressWarnings("unchecked")
public void setCustomSocketReaderClassName(

View File

@@ -104,7 +104,7 @@ public class MulticastSendingMessageHandler extends UnicastSendingMessageHandler
/**
* Set the underlying {@link MulticastSocket} time to live property.
* @param timeToLive {@see MulticastSocket#setTimeToLive(int)}
* @param timeToLive {@link MulticastSocket#setTimeToLive(int)}
*/
public void setTimeToLive(int timeToLive) {
this.timeToLive = timeToLive;

View File

@@ -1,308 +1,309 @@
/*
* 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.ip.udp;
import java.io.IOException;
import java.net.BindException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.SocketException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.springframework.integration.core.Message;
import org.springframework.integration.core.MessagingException;
import org.springframework.integration.ip.AbstractInternetProtocolSendingMessageHandler;
import org.springframework.integration.message.MessageDeliveryException;
import org.springframework.integration.message.MessageHandler;
import org.springframework.integration.message.MessageHandlingException;
import org.springframework.integration.message.MessageRejectedException;
import org.springframework.util.Assert;
/**
* A {@link MessageHandler} implementation that maps a Message into
* a UDP datagram packet and sends that to the specified host and port.
*
* Messages can be basic, with no support for reliability, can be prefixed
* by a length so the receiving end can detect truncation, and can require
* a UDP acknowledgment to confirm delivery.
*
* @author Gary Russell
* @since 2.0
*/
public class UnicastSendingMessageHandler extends
AbstractInternetProtocolSendingMessageHandler implements Runnable {
protected final DatagramPacketMessageMapper mapper = new DatagramPacketMessageMapper();
protected volatile DatagramSocket socket;
/**
* If true adds headers to instruct receiving adapter to return an ack.
*/
protected volatile boolean waitForAck = false;
protected volatile int ackPort;
protected volatile int ackTimeout = 5000;
protected volatile int ackCounter = 1;
protected volatile Map<String, CountDownLatch> ackControl = Collections
.synchronizedMap(new HashMap<String, CountDownLatch>());
protected volatile DatagramSocket ackSocket;
protected volatile Exception fatalException;
protected int soReceiveBufferSize = -1;
/**
* Basic constructor; no reliability; no acknowledgment.
* @param host Destination host.
* @param port Destination port.
*/
public UnicastSendingMessageHandler(String host, int port) {
super(host, port);
this.mapper.setLengthCheck(false);
this.mapper.setAcknowledge(false);
}
/**
* Can used to add a length to each packet which can be checked at the destination.
* @param host Destination Host.
* @param port Destination Port.
* @param lengthCheck If true, packets will contain a length.
*/
public UnicastSendingMessageHandler(String host, int port, boolean lengthCheck) {
super(host, port);
this.mapper.setLengthCheck(lengthCheck);
this.mapper.setAcknowledge(false);
}
/**
* Add an acknowledgment request to packets.
* @param host Destination Host.
* @param port Destination Port.
* @param acknowledge If true, packets will request acknowledgment.
* @param ackHost The host to which acks should be sent. Required if ack true.
* @param ackPort The port to which acks should be sent.
* @param ackTimeout How long we will wait (milliseconds) for the ack.
*/
public UnicastSendingMessageHandler(String host,
int port,
boolean acknowledge,
String ackHost,
int ackPort,
int ackTimeout) {
super(host, port);
setReliabilityAttributes(false, acknowledge, ackHost, ackPort,
ackTimeout);
}
/**
* Add a length and/or acknowledgment request to packets.
* @param host Destination Host.
* @param port Destination Port.
* @param lengthCheck If true, packets will contain a length.
* @param acknowledge If true, packets will request acknowledgment.
* @param ackHost The host to which acks should be sent. Required if ack true.
* @param ackPort The port to which acks should be sent.
* @param ackTimeout How long we will wait (milliseconds) for the ack.
*/
public UnicastSendingMessageHandler(String host,
int port,
boolean lengthCheck,
boolean acknowledge,
String ackHost,
int ackPort,
int ackTimeout) {
super(host, port);
setReliabilityAttributes(lengthCheck, acknowledge, ackHost, ackPort,
ackTimeout);
}
protected void setReliabilityAttributes(boolean lengthCheck,
boolean acknowledge, String ackHost, int ackPort, int ackTimeout) {
this.mapper.setLengthCheck(lengthCheck);
this.waitForAck = acknowledge;
this.mapper.setAcknowledge(acknowledge);
this.mapper.setAckAddress(ackHost + ":" + ackPort);
this.ackPort = ackPort;
if (ackTimeout > 0) {
this.ackTimeout = ackTimeout;
}
if (acknowledge) {
Assert.hasLength(ackHost);
this.executorService = Executors
.newSingleThreadExecutor(new ThreadFactory() {
private AtomicInteger n = new AtomicInteger();
public Thread newThread(Runnable runner) {
Thread thread = new Thread(runner);
thread.setName("UDP-Ack-Handler-" + n.getAndIncrement());
thread.setDaemon(true);
return thread;
}
});
this.executorService.execute(this);
}
}
public void handleMessage(Message<?> message)
throws MessageRejectedException, MessageHandlingException,
MessageDeliveryException {
CountDownLatch countdownLatch = null;
String messageId = message.getHeaders().getId().toString();
try {
DatagramPacket packet;
if (this.waitForAck) {
if (this.fatalException != null) {
throw new MessagingException(message, "Acknowledgment failure", fatalException);
}
countdownLatch = new CountDownLatch(ackCounter);
this.ackControl.put(messageId, countdownLatch);
}
packet = this.mapper.fromMessage(message);
this.send(packet);
logger.debug("Sent packet for message id " + message.getHeaders().getId());
if (this.waitForAck) {
if (!countdownLatch.await(this.ackTimeout, TimeUnit.MILLISECONDS)) {
throw new MessagingException(message, "Failed to receive UDP Ack in " + ackTimeout + " millis");
}
}
}
catch (MessagingException e) {
throw e;
}
catch (Exception e) {
try{
socket.close();
}
catch (Exception e1) { }
socket = null;
throw new MessageHandlingException(message, "failed to send UDP packet", e);
}
finally {
if (countdownLatch != null)
this.ackControl.remove(messageId);
}
}
protected void send(DatagramPacket packet) throws Exception {
DatagramSocket socket = this.getSocket();
packet.setSocketAddress(this.destinationAddress);
socket.send(packet);
}
protected synchronized DatagramSocket getSocket() throws IOException {
if (this.socket == null) {
this.socket = new DatagramSocket();
setSocketAttributes(this.socket);
}
return this.socket;
}
protected void setSocketAttributes(DatagramSocket socket) throws SocketException {
if (this.soTimeout >= 0) {
socket.setSoTimeout(this.soTimeout);
}
if (this.soSendBufferSize > 0) {
socket.setSendBufferSize(this.soSendBufferSize);
}
}
/**
* Process acknowledgments, if requested.
*/
public void run() {
Exception fatalException = null;
try {
if (logger.isDebugEnabled()) {
logger.debug("Listening for acks on port: " + ackPort);
}
this.ackSocket = new DatagramSocket(this.ackPort);
if (this.soReceiveBufferSize > 0) {
ackSocket.setReceiveBufferSize(this.soReceiveBufferSize);
}
DatagramPacket ackPack = new DatagramPacket(new byte[100], 100);
while(true) {
this.ackSocket.receive(ackPack);
String id = new String(ackPack.getData(), ackPack.getOffset(), ackPack.getLength());
if (logger.isDebugEnabled()) {
logger.debug("Received ack for " + id + " from " + ackPack.getAddress().getHostAddress());
}
CountDownLatch latch = this.ackControl.get(id);
if (latch != null) {
latch.countDown();
}
}
}
catch (IOException e) {
logger.error("Error on UDP Acknowledge thread" + e.getMessage());
fatalException = e;
}
finally {
if (this.ackSocket != null) {
this.ackSocket.close();
}
if (fatalException instanceof BindException) {
logger.fatal("Failed to bind to acknowledge port: " + ackPort);
this.fatalException = fatalException;
}
else {
this.executorService.execute(this);
}
}
}
/**
* If exposed as an MBean, can be used to restart the ack thread if a fatal
* (bind) error occurred, without bouncing the JVM.
*/
public void restartAckThread() {
if (fatalException == null) {
return;
}
this.fatalException = null;
this.executorService.execute(this);
}
public void shutDown() {
DatagramSocket socket = this.ackSocket;
this.ackSocket = null;
if (socket != null) {
socket.close();
}
}
/**
* @see {@link Socket#setReceiveBufferSize(int)} and {@link DatagramSocket#setReceiveBufferSize(int)}
* @param size
*/
public void setSoReceiveBufferSize(int size) {
this.soReceiveBufferSize = size;
}
}
/*
* 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.ip.udp;
import java.io.IOException;
import java.net.BindException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.Socket;
import java.net.SocketException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.springframework.integration.core.Message;
import org.springframework.integration.core.MessagingException;
import org.springframework.integration.ip.AbstractInternetProtocolSendingMessageHandler;
import org.springframework.integration.message.MessageDeliveryException;
import org.springframework.integration.message.MessageHandler;
import org.springframework.integration.message.MessageHandlingException;
import org.springframework.integration.message.MessageRejectedException;
import org.springframework.util.Assert;
/**
* A {@link MessageHandler} implementation that maps a Message into
* a UDP datagram packet and sends that to the specified host and port.
*
* Messages can be basic, with no support for reliability, can be prefixed
* by a length so the receiving end can detect truncation, and can require
* a UDP acknowledgment to confirm delivery.
*
* @author Gary Russell
* @since 2.0
*/
public class UnicastSendingMessageHandler extends
AbstractInternetProtocolSendingMessageHandler implements Runnable {
protected final DatagramPacketMessageMapper mapper = new DatagramPacketMessageMapper();
protected volatile DatagramSocket socket;
/**
* If true adds headers to instruct receiving adapter to return an ack.
*/
protected volatile boolean waitForAck = false;
protected volatile int ackPort;
protected volatile int ackTimeout = 5000;
protected volatile int ackCounter = 1;
protected volatile Map<String, CountDownLatch> ackControl = Collections
.synchronizedMap(new HashMap<String, CountDownLatch>());
protected volatile DatagramSocket ackSocket;
protected volatile Exception fatalException;
protected int soReceiveBufferSize = -1;
/**
* Basic constructor; no reliability; no acknowledgment.
* @param host Destination host.
* @param port Destination port.
*/
public UnicastSendingMessageHandler(String host, int port) {
super(host, port);
this.mapper.setLengthCheck(false);
this.mapper.setAcknowledge(false);
}
/**
* Can used to add a length to each packet which can be checked at the destination.
* @param host Destination Host.
* @param port Destination Port.
* @param lengthCheck If true, packets will contain a length.
*/
public UnicastSendingMessageHandler(String host, int port, boolean lengthCheck) {
super(host, port);
this.mapper.setLengthCheck(lengthCheck);
this.mapper.setAcknowledge(false);
}
/**
* Add an acknowledgment request to packets.
* @param host Destination Host.
* @param port Destination Port.
* @param acknowledge If true, packets will request acknowledgment.
* @param ackHost The host to which acks should be sent. Required if ack true.
* @param ackPort The port to which acks should be sent.
* @param ackTimeout How long we will wait (milliseconds) for the ack.
*/
public UnicastSendingMessageHandler(String host,
int port,
boolean acknowledge,
String ackHost,
int ackPort,
int ackTimeout) {
super(host, port);
setReliabilityAttributes(false, acknowledge, ackHost, ackPort,
ackTimeout);
}
/**
* Add a length and/or acknowledgment request to packets.
* @param host Destination Host.
* @param port Destination Port.
* @param lengthCheck If true, packets will contain a length.
* @param acknowledge If true, packets will request acknowledgment.
* @param ackHost The host to which acks should be sent. Required if ack true.
* @param ackPort The port to which acks should be sent.
* @param ackTimeout How long we will wait (milliseconds) for the ack.
*/
public UnicastSendingMessageHandler(String host,
int port,
boolean lengthCheck,
boolean acknowledge,
String ackHost,
int ackPort,
int ackTimeout) {
super(host, port);
setReliabilityAttributes(lengthCheck, acknowledge, ackHost, ackPort,
ackTimeout);
}
protected void setReliabilityAttributes(boolean lengthCheck,
boolean acknowledge, String ackHost, int ackPort, int ackTimeout) {
this.mapper.setLengthCheck(lengthCheck);
this.waitForAck = acknowledge;
this.mapper.setAcknowledge(acknowledge);
this.mapper.setAckAddress(ackHost + ":" + ackPort);
this.ackPort = ackPort;
if (ackTimeout > 0) {
this.ackTimeout = ackTimeout;
}
if (acknowledge) {
Assert.hasLength(ackHost);
this.executorService = Executors
.newSingleThreadExecutor(new ThreadFactory() {
private AtomicInteger n = new AtomicInteger();
public Thread newThread(Runnable runner) {
Thread thread = new Thread(runner);
thread.setName("UDP-Ack-Handler-" + n.getAndIncrement());
thread.setDaemon(true);
return thread;
}
});
this.executorService.execute(this);
}
}
public void handleMessage(Message<?> message)
throws MessageRejectedException, MessageHandlingException,
MessageDeliveryException {
CountDownLatch countdownLatch = null;
String messageId = message.getHeaders().getId().toString();
try {
DatagramPacket packet;
if (this.waitForAck) {
if (this.fatalException != null) {
throw new MessagingException(message, "Acknowledgment failure", fatalException);
}
countdownLatch = new CountDownLatch(ackCounter);
this.ackControl.put(messageId, countdownLatch);
}
packet = this.mapper.fromMessage(message);
this.send(packet);
logger.debug("Sent packet for message id " + message.getHeaders().getId());
if (this.waitForAck) {
if (!countdownLatch.await(this.ackTimeout, TimeUnit.MILLISECONDS)) {
throw new MessagingException(message, "Failed to receive UDP Ack in " + ackTimeout + " millis");
}
}
}
catch (MessagingException e) {
throw e;
}
catch (Exception e) {
try{
socket.close();
}
catch (Exception e1) { }
socket = null;
throw new MessageHandlingException(message, "failed to send UDP packet", e);
}
finally {
if (countdownLatch != null)
this.ackControl.remove(messageId);
}
}
protected void send(DatagramPacket packet) throws Exception {
DatagramSocket socket = this.getSocket();
packet.setSocketAddress(this.destinationAddress);
socket.send(packet);
}
protected synchronized DatagramSocket getSocket() throws IOException {
if (this.socket == null) {
this.socket = new DatagramSocket();
setSocketAttributes(this.socket);
}
return this.socket;
}
protected void setSocketAttributes(DatagramSocket socket) throws SocketException {
if (this.soTimeout >= 0) {
socket.setSoTimeout(this.soTimeout);
}
if (this.soSendBufferSize > 0) {
socket.setSendBufferSize(this.soSendBufferSize);
}
}
/**
* Process acknowledgments, if requested.
*/
public void run() {
Exception fatalException = null;
try {
if (logger.isDebugEnabled()) {
logger.debug("Listening for acks on port: " + ackPort);
}
this.ackSocket = new DatagramSocket(this.ackPort);
if (this.soReceiveBufferSize > 0) {
ackSocket.setReceiveBufferSize(this.soReceiveBufferSize);
}
DatagramPacket ackPack = new DatagramPacket(new byte[100], 100);
while(true) {
this.ackSocket.receive(ackPack);
String id = new String(ackPack.getData(), ackPack.getOffset(), ackPack.getLength());
if (logger.isDebugEnabled()) {
logger.debug("Received ack for " + id + " from " + ackPack.getAddress().getHostAddress());
}
CountDownLatch latch = this.ackControl.get(id);
if (latch != null) {
latch.countDown();
}
}
}
catch (IOException e) {
logger.error("Error on UDP Acknowledge thread" + e.getMessage());
fatalException = e;
}
finally {
if (this.ackSocket != null) {
this.ackSocket.close();
}
if (fatalException instanceof BindException) {
logger.fatal("Failed to bind to acknowledge port: " + ackPort);
this.fatalException = fatalException;
}
else {
this.executorService.execute(this);
}
}
}
/**
* If exposed as an MBean, can be used to restart the ack thread if a fatal
* (bind) error occurred, without bouncing the JVM.
*/
public void restartAckThread() {
if (fatalException == null) {
return;
}
this.fatalException = null;
this.executorService.execute(this);
}
public void shutDown() {
DatagramSocket socket = this.ackSocket;
this.ackSocket = null;
if (socket != null) {
socket.close();
}
}
/**
* @see Socket#setReceiveBufferSize(int)
* @see DatagramSocket#setReceiveBufferSize(int)
*/
public void setSoReceiveBufferSize(int size) {
this.soReceiveBufferSize = size;
}
}

View File

@@ -33,14 +33,6 @@ import org.springframework.integration.message.MessageMappingException;
*/
public class SocketIoUtils {
/**
* @param messageFormat
* @param customSocketReaderClass
* @param socket
* @param receiveBufferSize
* @param soReceiveBufferSize
* @return
*/
public static NetSocketReader createNetReader(int messageFormat,
Class<NetSocketReader> customSocketReaderClass,
Socket socket,
@@ -67,12 +59,6 @@ public class SocketIoUtils {
return reader;
}
/**
* @param messageFormat
* @param socket
* @param customSocketWriterClass
* @return
*/
public static NetSocketWriter createNetWriter(int messageFormat,
Class<NetSocketWriter> customSocketWriterClass, Socket socket) {
NetSocketWriter writer;
@@ -90,15 +76,6 @@ public class SocketIoUtils {
return writer;
}
/**
* @param messageFormat
* @param customSocketReaderClass
* @param socket
* @param receiveBufferSize
* @param usingDirectBuffers
* @param soReceiveBufferSize
* @return
*/
public static NioSocketReader createNioReader(int messageFormat,
Class<NioSocketReader> customSocketReaderClass,
SocketChannel channel,
@@ -127,15 +104,6 @@ public class SocketIoUtils {
return reader;
}
/**
* @param messageFormat
* @param socket
* @param customSocketWriter
* @param maxBuffers
* @param sendBufferSize
* @param usingDirectBuffers
* @return
*/
public static NioSocketWriter createNioWriter(int messageFormat,
Class<NioSocketWriter> customSocketWriterClass,
SocketChannel channel,

View File

@@ -165,7 +165,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
* The {@link JdbcOperations} to use when interacting with the database. Either this property can be set or the
* {@link #setDataSource(DataSource) dataSource}.
*
* @param dataSource a {@link DataSource}
* @param jdbcTemplate a {@link JdbcOperations}
*/
public void setJdbcTemplate(JdbcOperations jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;

View File

@@ -30,7 +30,7 @@ public interface SqlParameterSourceFactory {
/**
* Return a new {@link SqlParameterSource}.
* @param pollResult the result of the preceding poll operation
* @param resultOfSelect the result of the preceding poll operation
*/
public SqlParameterSource createParameterSource(Object resultOfSelect);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* 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.
@@ -184,7 +184,7 @@ public abstract class AbstractMailReceiver implements MailReceiver, DisposableBe
* every {@link javax.mail.FetchProfile.Item}.
*
* @param messages the messages to fetch
* @throws MessagingException in case of JavMail errors
* @throws MessagingException in case of JavaMail errors
*/
protected void fetchMessages(Message[] messages) throws MessagingException {
FetchProfile contentsProfile = new FetchProfile();
@@ -195,8 +195,7 @@ public abstract class AbstractMailReceiver implements MailReceiver, DisposableBe
}
/**
* Deletes the given messages from this receiver's folder. Only invoked when
* {@link #setDeleteMessages(boolean)} is <code>true</code>.
* Deletes the given messages from this receiver's folder.
*
* @param messages the messages to delete
* @throws MessagingException in case of JavaMail errors

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* 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.
@@ -42,28 +42,28 @@ public class XPathMultiChannelRouter extends AbstractXPathRouter {
/**
* @see AbstractXPathRouter#AbstractXPathChannelNameResolver(String, Map)
* @see AbstractXPathRouter#AbstractXPathRouter(String, Map)
*/
public XPathMultiChannelRouter(String expression, Map<String, String> namespaces) {
super(expression, namespaces);
}
/**
* @see AbstractXPathRouter#AbstractXPathChannelNameResolver(String, String, String)
* @see AbstractXPathRouter#AbstractXPathRouter(String, String, String)
*/
public XPathMultiChannelRouter(String expression, String prefix, String namespace) {
super(expression, prefix, namespace);
}
/**
* @see AbstractXPathRouter#AbstractXPathChannelNameResolver(String)
* @see AbstractXPathRouter#AbstractXPathRouter(String)
*/
public XPathMultiChannelRouter(String expression) {
super(expression);
}
/**
* @see AbstractXPathRouter#AbstractXPathChannelNameResolver(XPathExpression)
* @see AbstractXPathRouter#AbstractXPathRouter(XPathExpression)
*/
public XPathMultiChannelRouter(XPathExpression expression) {
super(expression);

View File

@@ -40,28 +40,28 @@ import org.w3c.dom.Node;
public class XPathSingleChannelRouter extends AbstractXPathRouter {
/**
* @see AbstractXPathRouter#AbstractXPathChannelNameResolver(String, Map)
* @see AbstractXPathRouter#AbstractXPathRouter(String, Map)
*/
public XPathSingleChannelRouter(String expression, Map<String, String> namespaces) {
super(expression, namespaces);
}
/**
* @see AbstractXPathRouter#AbstractXPathChannelNameResolver(String, String, String)
* @see AbstractXPathRouter#AbstractXPathRouter(String, String, String)
*/
public XPathSingleChannelRouter(String expression, String prefix, String namespace) {
super(expression, prefix, namespace);
}
/**
* @see AbstractXPathRouter#AbstractXPathChannelNameResolver(String)
* @see AbstractXPathRouter#AbstractXPathRouter(String)
*/
public XPathSingleChannelRouter(String expression) {
super(expression);
}
/**
* @see AbstractXPathRouter#AbstractXPathChannelNameResolver(XPathExpression)
* @see AbstractXPathRouter#AbstractXPathRouter(XPathExpression)
*/
public XPathSingleChannelRouter(XPathExpression expression) {
super(expression);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* 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.
@@ -27,9 +27,7 @@ import javax.xml.transform.Source;
public interface SourceFactory {
/**
* Create appropriate {@link Source} instance for payload
* @param payload
* @return
* Create appropriate {@link Source} instance for {@code payload}
*/
Source createSource(Object payload);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009 the original author or authors.
* 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.
@@ -27,6 +27,7 @@ import org.w3c.dom.Document;
import org.springframework.integration.core.MessagingException;
import org.springframework.integration.transformer.AbstractPayloadTransformer;
import org.springframework.integration.transformer.Transformer;
import org.springframework.integration.xml.source.DomSourceFactory;
import org.springframework.integration.xml.source.SourceFactory;
import org.springframework.oxm.Unmarshaller;
@@ -34,7 +35,7 @@ import org.springframework.util.Assert;
import org.springframework.xml.transform.StringSource;
/**
* An implementation of {@link PayloadTransformer} that delegates to an OXM
* An implementation of {@link Transformer} that delegates to an OXM
* {@link Unmarshaller}. Expects the payload to be of type {@link Document},
* {@link String}, {@link File}, {@link Source} or to have an instance of
* {@link SourceFactory} that can convert to a {@link Source}. If

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* 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.
@@ -22,7 +22,7 @@ import org.springframework.integration.core.Message;
* Strategy for determining how messages shall be correlated. Implementations
* shall return the correlation key value associated with a particular message.
*
* @author: Marius Bogoevici
* @author Marius Bogoevici
*/
public interface CorrelationStrategy {

View File

@@ -25,7 +25,7 @@ import org.springframework.util.Assert;
/**
* {@link CorrelationStrategy} implementation that works as an adapter to another bean.
*
* @author: Marius Bogoevici
* @author Marius Bogoevici
*/
public class CorrelationStrategyAdapter implements CorrelationStrategy {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* 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.
@@ -22,7 +22,7 @@ import org.springframework.integration.core.Message;
* Default implementation of {@link CorrelationStrategy}. Uses a header
* attribute to determine the correlation key value.
*
* @author: Marius Bogoevici
* @author Marius Bogoevici
*/
public class HeaderAttributeCorrelationStrategy implements CorrelationStrategy {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009 the original author or authors.
* 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.
@@ -26,7 +26,7 @@ import java.lang.annotation.Target;
* Indicates that a given method is capable of determining the correlation key
* of a message sent as parameter.
*
* @author: Marius Bogoevici
* @author Marius Bogoevici
*/
@Retention (RetentionPolicy.RUNTIME)
@Target (ElementType.METHOD)

View File

@@ -63,7 +63,7 @@ interface ExpressionSource {
/**
* Returns the variable name to use in the evaluation context for the Map
* of arguments. The keys in this map will be determined by the result of
* the {@link #getArgumentNames(Method)} method.
* the {@link #getArgumentVariableNames(Method)} method.
*/
String getArgumentMapVariableName(Method method);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* 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.
@@ -20,6 +20,7 @@ import java.util.Comparator;
import java.util.concurrent.PriorityBlockingQueue;
import org.springframework.integration.core.Message;
import org.springframework.integration.core.MessageHeaders;
import org.springframework.integration.core.MessagePriority;
import org.springframework.integration.util.UpperBound;
@@ -39,7 +40,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 MessageHeader#getPriority()}.
* {@link MessageHeaders#getPriority()}.
*/
public PriorityChannel(int capacity, Comparator<Message<?>> comparator) {
super(new PriorityBlockingQueue<Message<?>>(11,
@@ -49,7 +50,7 @@ public class PriorityChannel extends QueueChannel {
/**
* Create a channel with the specified queue capacity. Message priority
* will be based upon the value of {@link MessageHeader#getPriority()}.
* will be based upon the value of {@link MessageHeaders#getPriority()}.
*/
public PriorityChannel(int capacity) {
this(capacity, null);
@@ -59,7 +60,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 MessageHeader#getPriority()}.
* {@link MessageHeaders#getPriority()}.
*/
public PriorityChannel(Comparator<Message<?>> comparator) {
this(0, comparator);
@@ -67,7 +68,7 @@ public class PriorityChannel extends QueueChannel {
/**
* Create a channel with an unbounded queue. Message priority will be
* based on the value of {@link MessageHeader#getPriority()}.
* based on the value of {@link MessageHeaders#getPriority()}.
*/
public PriorityChannel() {
this(0, null);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* 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.
@@ -69,9 +69,7 @@ public class WireTap extends ChannelInterceptorAdapter implements Lifecycle {
/**
* Specify the timeout value for sending to the intercepting target. Note
* that this value will only apply if the target is a {@link BlockingTarget}.
* The default value is 0.
* Specify the timeout value for sending to the intercepting target.
*
* @param timeout the timeout in milliseconds
*/

View File

@@ -18,12 +18,9 @@ package org.springframework.integration.config.xml;
import java.util.List;
import org.w3c.dom.Element;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanDefinitionHolder;
import org.springframework.beans.factory.parsing.BeanComponentDefinition;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate;
@@ -33,6 +30,8 @@ import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.springframework.util.xml.DomUtils;
import org.w3c.dom.Element;
/**
* Shared utility methods for integration namespace parsers.
*
@@ -51,11 +50,11 @@ public abstract class IntegrationNamespaceUtils {
/**
* Populates the specified bean definition property with the value
* of the attribute whose name is provided if that attribute is
* defined in the given element.
* Configures the provided bean definition builder with a property
* value corresponding to the attribute whose name is provided if
* that attribute is defined in the given element.
*
* @param beanDefinition the bean definition to be configured
* @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
* used to populate the property
@@ -70,9 +69,9 @@ public abstract class IntegrationNamespaceUtils {
}
/**
* Populates the bean definition property corresponding to the specified
* attributeName with the value of that attribute if it is defined in the
* given element.
* Configures the provided bean definition builder with a property
* value corresponding to the attribute whose name is provided if
* that attribute is defined in the given element.
*
* <p>The property name will be the camel-case equivalent of the lower
* case hyphen separated attribute (e.g. the "foo-bar" attribute would
@@ -80,7 +79,7 @@ public abstract class IntegrationNamespaceUtils {
*
* @see Conventions#attributeNameToPropertyName(String)
*
* @param beanDefinition - the bean definition to be configured
* @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 set
* on the property
@@ -92,12 +91,12 @@ public abstract class IntegrationNamespaceUtils {
}
/**
* Populates the specified bean definition property with the reference
* to a bean. The bean reference is identified by the value from the
* attribute whose name is provided if that attribute is defined in
* the given element.
* Configures the provided bean definition builder with a property
* reference to a bean. The bean reference is identified by the value
* from the attribute whose name is provided if that attribute is
* defined in the given element.
*
* @param beanDefinition the bean definition to be configured
* @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
* used as a bean reference to populate the property
@@ -112,9 +111,10 @@ public abstract class IntegrationNamespaceUtils {
}
/**
* Populates the bean definition property corresponding to the specified
* attributeName with the reference to a bean identified by the value of
* that attribute if the attribute is defined in the given element.
* Configures the provided bean definition builder with a property
* reference to a bean. The bean reference is identified by the value
* from the attribute whose name is provided if that attribute is
* defined in the given element.
*
* <p>The property name will be the camel-case equivalent of the lower
* case hyphen separated attribute (e.g. the "foo-bar" attribute would
@@ -122,7 +122,7 @@ public abstract class IntegrationNamespaceUtils {
*
* @see Conventions#attributeNameToPropertyName(String)
*
* @param beanDefinition - the bean definition to be configured
* @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
* used as a bean reference to populate the property

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* 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.
@@ -16,12 +16,14 @@
package org.springframework.integration.core;
import org.springframework.integration.message.MessageBuilder;
/**
* An enumeration of the possible values for a message's priority.
*
* @author Mark Fisher
* @see MessageHeader#getPriority()
* @see MessageHeader#setPriority(MessagePriority)
* @see MessageHeaders#getPriority()
* @see MessageBuilder#setPriority(MessagePriority)
*/
public enum MessagePriority {

View File

@@ -47,7 +47,7 @@ import org.springframework.util.StringUtils;
* @author Mark Fisher
* @author Oleg Zhurakousky
*/
public class GatewayProxyFactoryBean extends AbstractEndpoint implements FactoryBean, MethodInterceptor, BeanClassLoaderAware {
public class GatewayProxyFactoryBean extends AbstractEndpoint implements FactoryBean<Object>, MethodInterceptor, BeanClassLoaderAware {
private volatile Class<?> serviceInterface;
@@ -102,7 +102,7 @@ public class GatewayProxyFactoryBean extends AbstractEndpoint implements Factory
/**
* Set the default request channel.
*
* @param defaulRequestChannel the channel to which request messages will
* @param defaultRequestChannel the channel to which request messages will
* be sent if no request channel has been configured with an annotation
*/
public void setDefaultRequestChannel(MessageChannel defaultRequestChannel) {
@@ -114,7 +114,7 @@ public class GatewayProxyFactoryBean extends AbstractEndpoint implements Factory
* and no reply channel is configured with annotations, an anonymous,
* temporary channel will be used for handling replies.
*
* @param replyChannel the channel from which reply messages will be
* @param defaultReplyChannel the channel from which reply messages will be
* received if no reply channel has been configured with an annotation
*/
public void setDefaultReplyChannel(MessageChannel defaultReplyChannel) {

View File

@@ -62,8 +62,8 @@ import org.springframework.util.StringUtils;
* will be passed. These parameters can be labeled explicitly with the
* {@link Headers @Headers} annotation, or matched implicitly by using a non-
* ambiguous method signature. There can be as many parameters annotated with
* @Header as necessary, but typically there should be only one parameter
* expecting multiple headers (with or without the @Headers annotation).
* {@code @Header} as necessary, but typically there should be only one parameter
* expecting multiple headers (with or without the {@code @Headers} annotation).
* <p/>
* If a Map or Properties object is expected, and the payload is not itself
* assignable to that type or capable of being converted to that type, then
@@ -73,7 +73,7 @@ import org.springframework.util.StringUtils;
* parameters are legal. If, however, the actual payload type is a Map or
* Properties instance, then this ambiguity cannot be resolved. For that
* reason, it is highly recommended to use the explicit
* {@link Headers @Headers} annotation whenever possible.
* {@code Headers @Headers} annotation whenever possible.
* <p/>
* Some examples of legal method signatures:<br/>
* <tt>public void dealWith(Object payload);</tt><br/>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009 the original author or authors.
* 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.
@@ -38,8 +38,7 @@ public class GenericMessage<T> implements Message<T>, Serializable {
/**
* Create a new message with the given payload. The id will be generated by
* the default {@link IdGenerator} strategy.
* Create a new message with the given payload.
*
* @param payload the message payload
*/
@@ -48,12 +47,12 @@ public class GenericMessage<T> implements Message<T>, Serializable {
}
/**
* Create a new message with the given payload. The id will be generated by
* the default {@link IdGenerator} strategy. The headers will be populated
* with the provided header values.
* Create a new message with the given payload. The provided map
* will be used to populate the message headers
*
* @param payload the message payload
* @param headers message headers
* @see MessageHeaders
*/
public GenericMessage(T payload, Map<String, Object> headers) {
Assert.notNull(payload, "payload must not be null");
@@ -88,7 +87,7 @@ public class GenericMessage<T> implements Message<T>, Serializable {
if (this == obj) {
return true;
}
if (obj != null && obj instanceof GenericMessage) {
if (obj != null && obj instanceof GenericMessage<?>) {
GenericMessage<?> other = (GenericMessage<?>) obj;
if (!this.headers.getId().equals(other.headers.getId())) {
return false;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009 the original author or authors.
* 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.
@@ -62,7 +62,7 @@ public final class MessageBuilder<T> {
* all of the headers copied from the provided message. The payload of the
* provided Message will also be used as the payload for the new message.
*
* @param messageToCopy the Message from which the payload and all headers
* @param message the Message from which the payload and all headers
* will be copied
*/
public static <T> MessageBuilder<T> fromMessage(Message<T> message) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009 the original author or authors.
* 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.
@@ -28,7 +28,7 @@ import org.springframework.util.StringUtils;
*
* @author Oleg Zhurakousky
* @author Mark Fisher
* @Since 1.0.3
* @since 1.0.3
*/
public class HeaderValueRouter extends AbstractChannelNameResolvingMessageRouter {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* 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
@@ -12,8 +12,6 @@
*/
package org.springframework.integration.store;
import java.util.Collection;
import org.springframework.integration.core.Message;
/**
@@ -28,7 +26,7 @@ public interface MessageGroupStore {
/**
* Return all Messages currently in the MessageStore that were stored using
* {@link #addMessageToGroup(Object, Collection)} with this correlation id.
* {@link #addMessageToGroup(Object, Message)} with this correlation id.
*
* @return a group of messages, empty if none exists for this key
*/

View File

@@ -17,8 +17,10 @@
package org.springframework.integration.transformer;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.integration.core.Message;
import org.springframework.integration.handler.AbstractReplyProducingMessageHandler;
import org.springframework.integration.message.MessageHandler;
import org.springframework.util.Assert;
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* 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.
@@ -24,7 +24,7 @@ import org.springframework.integration.message.MessageBuilder;
import org.junit.Test;
/**
* @author: Marius Bogoevici
* @author Marius Bogoevici
*/
public class HeaderAttributeCorrelationStrategyTests {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009 the original author or authors.
* 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.
@@ -22,7 +22,7 @@ import org.springframework.beans.factory.BeanCreationException;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* @author: Marius Bogoevici
* @author Marius Bogoevici
*/
public class CorrelationStrategyInvalidConfigurationTests {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009 the original author or authors.
* 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.
@@ -20,12 +20,12 @@ import org.springframework.integration.aggregator.CorrelationStrategy;
import org.springframework.integration.core.Message;
/**
* @author: Marius Bogoevici
* @author Marius Bogoevici
*/
public class TestCorrelationStrategy implements CorrelationStrategy {
public Object getCorrelationKey(Message<?> message) {
throw new UnsupportedOperationException("for configuration test only");
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* 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.
@@ -24,7 +24,7 @@ import org.springframework.integration.annotation.ReleaseStrategy;
import org.springframework.integration.annotation.CorrelationStrategy;
/**
* @author: Marius Bogoevici
* @author Marius Bogoevici
*/
@MessageEndpoint("endpointWithCorrelationStrategy")
public class TestAnnotatedEndpointWithCorrelationStrategy {