Fix compiler warnings and move docbook build to a profile

This commit is contained in:
David Syer
2010-07-27 12:54:18 +00:00
parent c4fe3b2076
commit 829d6efc08
37 changed files with 105 additions and 134 deletions

View File

@@ -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> {

View File

@@ -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;

View File

@@ -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();

View File

@@ -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;

View File

@@ -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;
}
}

View File

@@ -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;