Fix compiler warnings and move docbook build to a profile
This commit is contained in:
17
pom.xml
17
pom.xml
@@ -50,6 +50,17 @@
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>release</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>com.agilejava.docbkx</groupId>
|
||||
<artifactId>docbkx-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
<distributionManagement>
|
||||
<!-- see 'staging' profile for dry-run deployment settings -->
|
||||
@@ -77,7 +88,8 @@
|
||||
<version>3.0.0.RELEASE</version>
|
||||
</extension>
|
||||
</extensions>
|
||||
<plugins>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>com.agilejava.docbkx</groupId>
|
||||
<artifactId>docbkx-maven-plugin</artifactId>
|
||||
@@ -139,6 +151,9 @@
|
||||
</postProcess>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.5</version>
|
||||
|
||||
@@ -50,10 +50,7 @@ final class GlobalChannelInterceptorBeanPostProcessor implements BeanPostProcess
|
||||
|
||||
private final Set<GlobalChannelInterceptorWrapper> positiveOrderInterceptors = new LinkedHashSet<GlobalChannelInterceptorWrapper>();
|
||||
private final Set<GlobalChannelInterceptorWrapper> negativeOrderInterceptors = new LinkedHashSet<GlobalChannelInterceptorWrapper>();
|
||||
/**
|
||||
*
|
||||
* @param globalInterceptors
|
||||
*/
|
||||
|
||||
GlobalChannelInterceptorBeanPostProcessor(List<GlobalChannelInterceptorWrapper> channelInterceptors){
|
||||
this.channelInterceptors = channelInterceptors;
|
||||
}
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
package org.springframework.integration.config.xml;
|
||||
|
||||
import org.springframework.beans.factory.BeanDefinitionStoreException;
|
||||
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
|
||||
import org.springframework.beans.factory.parsing.Problem;
|
||||
import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
|
||||
import org.springframework.beans.factory.xml.AbstractSimpleBeanDefinitionParser;
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.springframework.integration.config.xml;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.util.xml.DomUtils;
|
||||
|
||||
@@ -22,9 +22,7 @@ import java.util.Iterator;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.integration.context.NamedComponent;
|
||||
import org.springframework.integration.core.Message;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.springframework.integration.message.MessageRejectedException;
|
||||
/**
|
||||
* Wrapper class to be used when a particular MessageHandler needs to be tracked in MessageHistory.
|
||||
* Note, any MessageHandler that is wrapped by this class will be tracked in MessageHistory
|
||||
* only when MessageHistoryWriter is present.<2E>
|
||||
* only when MessageHistoryWriter is present.<2E>
|
||||
*
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
@@ -40,7 +40,6 @@ public class MessageHistoryAwareMessageHandler implements NamedComponent, Messag
|
||||
*
|
||||
* @param historyWriter
|
||||
* @param endpointName
|
||||
* @param parentHandler
|
||||
*/
|
||||
public MessageHistoryAwareMessageHandler(MessageHistoryWriter historyWriter, String endpointName, MessageHandler targetHandler){
|
||||
this.historyWriter = historyWriter;
|
||||
|
||||
@@ -19,8 +19,6 @@ package org.springframework.integration.router;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.integration.core.Message;
|
||||
import org.springframework.integration.core.MessageChannel;
|
||||
@@ -38,9 +36,8 @@ import org.springframework.util.Assert;
|
||||
* A Message Router that sends Messages to a list of recipient channels. The
|
||||
* recipients can be provided as a static list of {@link MessageChannel}
|
||||
* instances via the {@link #setChannels(List)} method, or for dynamic
|
||||
* behavior, a map with {@link MessageSelector} instances as the keys and
|
||||
* collections of channels as the values can be provided via the
|
||||
* {@link #setChannelMap(Map)} method.
|
||||
* behavior, the values can be provided via the
|
||||
* {@link #setRecipients(List)} method.
|
||||
* <p/>
|
||||
* For more advanced, programmatic control
|
||||
* of dynamic recipient lists, consider using the @Router annotation or
|
||||
|
||||
@@ -52,7 +52,6 @@ class CycleDetector {
|
||||
*
|
||||
* @param target
|
||||
* @param ignorePakages
|
||||
* @return
|
||||
*/
|
||||
public void detectCycle(Object target, String... ignorePakages){
|
||||
Map<Object, Set<Object>> objectReferenceMap = new HashMap<Object, Set<Object>>();
|
||||
|
||||
@@ -23,7 +23,6 @@ import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.config.ConstructorArgumentValues;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.context.support.GenericApplicationContext;
|
||||
|
||||
@@ -72,6 +72,7 @@ public class ConverterParserWithExistingConversionServiceTests {
|
||||
|
||||
private String text;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public TestBean1(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
@@ -105,14 +106,13 @@ public class ConverterParserWithExistingConversionServiceTests {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class TestConverter implements Converter<TestBean1, TestBean2> {
|
||||
|
||||
public TestBean2 convert(TestBean1 source) {
|
||||
return new TestBean2(source.text.toUpperCase());
|
||||
}
|
||||
}
|
||||
@SuppressWarnings("unused")
|
||||
|
||||
private static class TestConverter3 implements Converter<TestBean1, TestBean3> {
|
||||
|
||||
public TestBean3 convert(TestBean1 source) {
|
||||
|
||||
@@ -20,7 +20,6 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.Executor;
|
||||
@@ -32,7 +31,6 @@ import org.mockito.Mockito;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.context.support.GenericApplicationContext;
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
import org.springframework.core.convert.support.ConversionServiceFactory;
|
||||
import org.springframework.core.convert.support.GenericConversionService;
|
||||
@@ -43,9 +41,6 @@ import org.springframework.integration.context.IntegrationContextUtils;
|
||||
import org.springframework.integration.core.Message;
|
||||
import org.springframework.integration.core.MessageChannel;
|
||||
import org.springframework.integration.endpoint.EventDrivenConsumer;
|
||||
import org.springframework.integration.handler.BridgeHandler;
|
||||
import org.springframework.integration.history.MessageHistoryEvent;
|
||||
import org.springframework.integration.history.MessageHistoryWriter;
|
||||
import org.springframework.integration.message.MessageHandler;
|
||||
import org.springframework.integration.message.StringMessage;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
@@ -65,7 +65,7 @@ public class MultipleEndpointGatewayTests {
|
||||
public Object echo(Object value){
|
||||
return "R:" + value;
|
||||
}
|
||||
public Message echoAsMessage(Object value){
|
||||
public Message<?> echoAsMessage(Object value){
|
||||
return MessageBuilder.withPayload("R:" + value).build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.springframework.integration.history;
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertFalse;
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
@@ -135,6 +136,7 @@ public class MessageHistoryIntegrationTests {
|
||||
endOfThePipeChannel.subscribe(handler);
|
||||
Message<?> result = gateway.echo("hello");
|
||||
Mockito.verify(handler, Mockito.times(1)).handleMessage(Mockito.any(Message.class));
|
||||
assertNotNull(result);
|
||||
//assertEquals("hello", result);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,11 +19,7 @@ import junit.framework.Assert;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.ArgumentMatcher;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
@@ -15,20 +15,13 @@
|
||||
*/
|
||||
package org.springframework.integration.event.config;
|
||||
|
||||
import java.util.concurrent.BrokenBarrierException;
|
||||
import java.util.concurrent.CyclicBarrier;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
|
||||
@@ -16,14 +16,14 @@
|
||||
|
||||
package org.springframework.integration.ip.config;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.core.Conventions;
|
||||
import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
|
||||
import org.springframework.integration.ip.tcp.MessageFormats;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Utility methods and constants for IP adapter parsers.
|
||||
|
||||
@@ -20,7 +20,6 @@ import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.core.Conventions;
|
||||
import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
|
||||
import org.springframework.integration.ip.tcp.connection.TcpNetClientConnectionFactory;
|
||||
import org.springframework.integration.ip.tcp.connection.TcpNetServerConnectionFactory;
|
||||
|
||||
@@ -172,8 +172,6 @@ public class TcpNioReceivingChannelAdapter extends
|
||||
* and calls its {@link NetSocketReader#assembledData}
|
||||
* method; if a message is fully assembled, calls {@link #sendMessage(Message)} with the
|
||||
* mapped message.
|
||||
*
|
||||
* @param channel
|
||||
*/
|
||||
private void doRead(SelectionKey key) {
|
||||
NioSocketReader reader = (NioSocketReader) key.attachment();
|
||||
|
||||
@@ -26,7 +26,6 @@ import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.commons.serializer.InputStreamingConverter;
|
||||
import org.springframework.commons.serializer.OutputStreamingConverter;
|
||||
import org.springframework.context.Lifecycle;
|
||||
import org.springframework.core.task.TaskExecutor;
|
||||
import org.springframework.integration.ip.tcp.converter.ByteArrayCrLfConverter;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
|
||||
@@ -36,10 +36,10 @@ public abstract class AbstractTcpConnection implements TcpConnection {
|
||||
|
||||
protected Log logger = LogFactory.getLog(this.getClass());
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@SuppressWarnings("unchecked")
|
||||
protected InputStreamingConverter inputConverter;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@SuppressWarnings("unchecked")
|
||||
protected OutputStreamingConverter outputConverter;
|
||||
|
||||
protected TcpMessageMapper mapper;
|
||||
|
||||
@@ -112,7 +112,6 @@ public class DatagramPacketMessageMapper implements InboundMessageMapper<Datagra
|
||||
/**
|
||||
* Prefix raw byte[] from message with 'acknowledge to' and 'message id' "headers".
|
||||
* @param message
|
||||
* @param ackTo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
|
||||
@@ -115,10 +115,6 @@ public class MultiClientTests {
|
||||
adapter.stop();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param i
|
||||
* @return
|
||||
*/
|
||||
private String largePayload(int n) {
|
||||
StringBuilder sb = new StringBuilder(n);
|
||||
for (int i = 0; i < n; i++) {
|
||||
|
||||
@@ -23,7 +23,6 @@ import static org.junit.Assert.fail;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.Socket;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -25,16 +25,11 @@ import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import javax.net.ServerSocketFactory;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.integration.core.Message;
|
||||
import org.springframework.integration.ip.util.SocketUtils;
|
||||
import org.springframework.integration.message.MessageBuilder;
|
||||
|
||||
|
||||
@@ -173,10 +173,6 @@ public class MultiClientTests {
|
||||
adapter.stop();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param i
|
||||
* @return
|
||||
*/
|
||||
private String largePayload(int n) {
|
||||
StringBuilder sb = new StringBuilder(n);
|
||||
for (int i = 0; i < n; i++) {
|
||||
|
||||
@@ -349,7 +349,7 @@ abstract class MessageListenerContainerConfigurationSupport implements Initializ
|
||||
* Blocks until the listener container has subscribed; if the container does not support
|
||||
* this test, or the caching mode is incompatible, true is returned. Otherwise blocks
|
||||
* until timeout milliseconds have passed, or the consumer has registered.
|
||||
* @see DefaultMessageListenerContainer.isRegisteredWithDestination()
|
||||
* @see DefaultMessageListenerContainer#isRegisteredWithDestination()
|
||||
* @param timeout Timeout in milliseconds.
|
||||
* @return True if a subscriber has connected or the container/attributes does not support
|
||||
* the test. False if a valid container does not have a registered consumer within
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.integration.jms.config;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import javax.jms.ConnectionFactory;
|
||||
import javax.jms.Destination;
|
||||
import javax.jms.JMSException;
|
||||
@@ -25,7 +23,6 @@ import javax.jms.Session;
|
||||
import javax.jms.TextMessage;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
@@ -48,7 +48,7 @@ import org.springframework.util.ObjectUtils;
|
||||
* defined as {@link JmxHeaders#OBJECT_NAME} and {@link JmxHeaders#OPERATION_NAME},
|
||||
* respectively. In either case, if no header is present, the value resolution
|
||||
* will fallback to the defaults, if any have been configured on this instance via
|
||||
* {@link #setDefaultObjectName(String)} and {@link #setDefaultOperationName(String)},
|
||||
* {@link #setObjectName(String)} and {@link #setOperationName(String)},
|
||||
* respectively.
|
||||
*
|
||||
* <p>The operation parameter(s), if any, must be available within the payload of the
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Creates the {@link ConfigAttributeDefinition}s for secured channel
|
||||
* Creates the {@link ConfigAttribute}s for secured channel
|
||||
* send and receive operations based on simple String values.
|
||||
*
|
||||
* @author Mark Fisher
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.springframework.security.access.SecurityMetadataSource;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* The {@link ObjectDefinitionSource} implementation for secured {@link MessageChannel}s.
|
||||
* The {@link SecurityMetadataSource} implementation for secured {@link MessageChannel}s.
|
||||
*
|
||||
* @author Mark Fisher
|
||||
* @author Oleg Zhurakousky
|
||||
|
||||
@@ -37,7 +37,7 @@ import org.springframework.util.Assert;
|
||||
* String, character array, and byte array payloads will be written directly,
|
||||
* but for other payload types, the result of the object's {@link #toString()}
|
||||
* method will be written. To append a new-line after each write, set the
|
||||
* {@link #shouldAppendNewLine} flag to 'true'. It is 'false' by default.
|
||||
* {@link #setShouldAppendNewLine(boolean) shouldAppendNewLine} flag to 'true'. It is 'false' by default.
|
||||
*
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.springframework.util.StringUtils;
|
||||
*
|
||||
* @author Josh Long
|
||||
* @author Mark Fisher
|
||||
* @see {@link org.jivesoftware.smack.XMPPConnection}
|
||||
* @see org.jivesoftware.smack.XMPPConnection
|
||||
* @since 2.0
|
||||
*/
|
||||
public class XmppConnectionFactory extends AbstractFactoryBean<XMPPConnection> {
|
||||
|
||||
@@ -18,27 +18,26 @@ package org.springframework.integration.xmpp.messages;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.jivesoftware.smack.Chat;
|
||||
import org.jivesoftware.smack.ChatManager;
|
||||
import org.jivesoftware.smack.PacketListener;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
|
||||
import org.springframework.context.Lifecycle;
|
||||
import org.springframework.integration.channel.MessageChannelTemplate;
|
||||
import org.springframework.integration.core.MessageChannel;
|
||||
import org.springframework.integration.endpoint.AbstractEndpoint;
|
||||
import org.springframework.integration.message.MessageBuilder;
|
||||
import org.springframework.integration.xmpp.XmppConnectionFactory;
|
||||
import org.springframework.integration.xmpp.XmppHeaders;
|
||||
|
||||
/**
|
||||
* This component logs in as a user and forwards any messages <em>to</em> that
|
||||
* user on to downstream components. The component is an endpoint that has its
|
||||
* own lifecycle and does not need any
|
||||
* {@link org.springframework.integration.endpoint.AbstractPollingEndpoint.Poller}
|
||||
* own lifecycle and does not need any poller
|
||||
* to work. It takes any message from a given XMPP session (as established by
|
||||
* the current {@link org.jivesoftware.smack.XMPPConnection}) and forwards the
|
||||
* the current {@link XMPPConnection}) and forwards the
|
||||
* {@link org.jivesoftware.smack.packet.Message} as the payload of the Spring
|
||||
* Integration {@link org.springframework.integration.core.Message}. The
|
||||
* {@link org.jivesoftware.smack.Chat} instance that's used is passed along as a
|
||||
@@ -60,14 +59,14 @@ import org.springframework.integration.xmpp.XmppHeaders;
|
||||
*
|
||||
* @author Josh Long
|
||||
* @author Mark Fisher
|
||||
* @see {@link org.jivesoftware.smack.ChatManager} the ChatManager class that
|
||||
*
|
||||
* @see ChatManager the ChatManager class that
|
||||
* keeps watch over all Chats between the client and any other
|
||||
* participants.
|
||||
* @see {@link org.springframework.integration.channel.MessageChannelTemplate}
|
||||
* @see MessageChannelTemplate
|
||||
* handles all interesing operations on any Spring Integration channels.
|
||||
* @see {@link org.jivesoftware.smack.XMPPConnection} the XMPPConnection (as
|
||||
* created by
|
||||
* {@link org.springframework.integration.xmpp.XmppConnectionFactory}
|
||||
* @see XMPPConnection the XMPPConnection (as
|
||||
* created by {@link XmppConnectionFactory}
|
||||
*/
|
||||
public class XmppMessageDrivenEndpoint extends AbstractEndpoint implements Lifecycle {
|
||||
|
||||
@@ -84,7 +83,7 @@ public class XmppMessageDrivenEndpoint extends AbstractEndpoint implements Lifec
|
||||
/**
|
||||
* This will be injected or configured via a <em>xmpp-connection-factory</em> element.
|
||||
*
|
||||
* @param xmppConnection
|
||||
* @param xmppConnection the connection
|
||||
*/
|
||||
public void setXmppConnection(final XMPPConnection xmppConnection) {
|
||||
this.xmppConnection = xmppConnection;
|
||||
|
||||
@@ -65,7 +65,7 @@ public class XmppPresenceMessageMapper implements OutboundMessageMapper<Presence
|
||||
*
|
||||
* @param message the Message whose headers and payload willl b
|
||||
* @return the presence object as constructed from the {@link org.springframework.integration.core.Message} object
|
||||
* @throws Exception
|
||||
* @throws Exception if there is a problem
|
||||
*/
|
||||
public Presence fromMessage(Message<?> message) throws Exception {
|
||||
MessageHeaders messageHeaders = message.getHeaders();
|
||||
|
||||
@@ -53,7 +53,7 @@ public class XmppRosterEventMessageDrivenEndpoint extends AbstractEndpoint imple
|
||||
/**
|
||||
* This will be injected or configured via a <em>xmpp-connection-factory</em> element.
|
||||
*
|
||||
* @param xmppConnection
|
||||
* @param xmppConnection the connection
|
||||
*/
|
||||
public void setXmppConnection(final XMPPConnection xmppConnection) {
|
||||
this.xmppConnection = xmppConnection;
|
||||
|
||||
@@ -2,73 +2,81 @@ package org.springframework.integration.xmpp.presence;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.packet.Presence;
|
||||
|
||||
import org.springframework.context.Lifecycle;
|
||||
|
||||
import org.springframework.integration.core.Message;
|
||||
import org.springframework.integration.message.*;
|
||||
|
||||
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.integration.message.OutboundMessageMapper;
|
||||
|
||||
/**
|
||||
* This class will facilitate publishing updated presence values for a given connection. This change happens on the {@link org.jivesoftware.smack.Roster#subscriptionMode} property.
|
||||
*
|
||||
* This class will facilitate publishing updated presence values for a given connection. This change happens on the
|
||||
* {@link org.jivesoftware.smack.Roster#setSubscriptionMode(org.jivesoftware.smack.Roster.SubscriptionMode)} property.
|
||||
*
|
||||
* @author Josh Long
|
||||
* @see {@link org.jivesoftware.smack.packet.Presence.Mode} the mode (i.e.: {@link org.jivesoftware.smack.packet.Presence.Mode#away})
|
||||
* @see {@link org.jivesoftware.smack.packet.Presence.Type} the type (i.e.: {@link org.jivesoftware.smack.packet.Presence.Type#available} )
|
||||
* @see org.jivesoftware.smack.packet.Presence.Mode the mode (i.e.:
|
||||
* {@link org.jivesoftware.smack.packet.Presence.Mode#away})
|
||||
* @see org.jivesoftware.smack.packet.Presence.Type the type (i.e.:
|
||||
* {@link org.jivesoftware.smack.packet.Presence.Type#available} )
|
||||
* @since 2.0
|
||||
*/
|
||||
public class XmppRosterEventMessageSendingHandler implements MessageHandler, Lifecycle {
|
||||
private static final Log logger = LogFactory.getLog(XmppRosterEventMessageDrivenEndpoint.class);
|
||||
private volatile boolean running;
|
||||
private OutboundMessageMapper<Presence> messageMapper;
|
||||
private volatile XMPPConnection xmppConnection;
|
||||
private static final Log logger = LogFactory.getLog(XmppRosterEventMessageDrivenEndpoint.class);
|
||||
|
||||
public void setXmppConnection(final XMPPConnection xmppConnection) {
|
||||
this.xmppConnection = xmppConnection;
|
||||
}
|
||||
private volatile boolean running;
|
||||
|
||||
public void handleMessage(final Message<?> message)
|
||||
throws MessageRejectedException, MessageHandlingException, MessageDeliveryException {
|
||||
try {
|
||||
Presence presence = this.messageMapper.fromMessage(message);
|
||||
this.xmppConnection.sendPacket(presence);
|
||||
} catch (Exception e) {
|
||||
logger.error("Failed to map packet to message ", e);
|
||||
}
|
||||
}
|
||||
private OutboundMessageMapper<Presence> messageMapper;
|
||||
|
||||
public boolean isRunning() {
|
||||
return this.running;
|
||||
}
|
||||
private volatile XMPPConnection xmppConnection;
|
||||
|
||||
public void start() {
|
||||
if (null == this.messageMapper) {
|
||||
this.messageMapper = new XmppPresenceMessageMapper();
|
||||
}
|
||||
public void setXmppConnection(final XMPPConnection xmppConnection) {
|
||||
this.xmppConnection = xmppConnection;
|
||||
}
|
||||
|
||||
this.running = true;
|
||||
}
|
||||
public void handleMessage(final Message<?> message) throws MessageRejectedException, MessageHandlingException,
|
||||
MessageDeliveryException {
|
||||
try {
|
||||
Presence presence = this.messageMapper.fromMessage(message);
|
||||
this.xmppConnection.sendPacket(presence);
|
||||
}
|
||||
catch (Exception e) {
|
||||
logger.error("Failed to map packet to message ", e);
|
||||
}
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
this.running = false;
|
||||
public boolean isRunning() {
|
||||
return this.running;
|
||||
}
|
||||
|
||||
if (xmppConnection.isConnected()) {
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("shutting down XMPP connection");
|
||||
}
|
||||
public void start() {
|
||||
if (null == this.messageMapper) {
|
||||
this.messageMapper = new XmppPresenceMessageMapper();
|
||||
}
|
||||
|
||||
xmppConnection.disconnect();
|
||||
}
|
||||
}
|
||||
this.running = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* the MessageMapper is responsible for converting outbound Messages into status updates of type {@link org.jivesoftware.smack.packet.Presence}
|
||||
* @param messageMapper
|
||||
*/
|
||||
public void setMessageMapper(OutboundMessageMapper<Presence> messageMapper) {
|
||||
this.messageMapper = messageMapper;
|
||||
}
|
||||
public void stop() {
|
||||
this.running = false;
|
||||
|
||||
if (xmppConnection.isConnected()) {
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("shutting down XMPP connection");
|
||||
}
|
||||
|
||||
xmppConnection.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* the MessageMapper is responsible for converting outbound Messages into status updates of type
|
||||
* {@link org.jivesoftware.smack.packet.Presence}
|
||||
* @param messageMapper mapper for the message into a {@link Presence} instance
|
||||
*/
|
||||
public void setMessageMapper(OutboundMessageMapper<Presence> messageMapper) {
|
||||
this.messageMapper = messageMapper;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ import org.springframework.integration.channel.MessageChannelTemplate;
|
||||
import org.springframework.integration.core.Message;
|
||||
import org.springframework.integration.message.*;
|
||||
|
||||
import org.springframework.integration.xmpp.messages.XmppMessageSendingMessageHandler;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user