[springframework-ws] add Smack 4 support

gil gil at fedoraproject.org
Tue Dec 30 09:38:59 UTC 2014


commit 5bdcd1f8813cd61f320505949f2dafc2c80873b4
Author: gil <puntogil at libero.it>
Date:   Tue Dec 30 10:38:53 2014 +0100

    add Smack 4 support

 springframework-ws-2.1.1-smack4.patch |  223 +++++++++++++++++++++++++++++++++
 springframework-ws.spec               |   17 ++-
 2 files changed, 235 insertions(+), 5 deletions(-)
---
diff --git a/springframework-ws-2.1.1-smack4.patch b/springframework-ws-2.1.1-smack4.patch
new file mode 100644
index 0000000..4e6816f
--- /dev/null
+++ b/springframework-ws-2.1.1-smack4.patch
@@ -0,0 +1,223 @@
+diff -Nru spring-ws-spring-ws-2.1.1.RELEASE/parent/pom.xml spring-ws-spring-ws-2.1.1.RELEASE-gil/parent/pom.xml
+--- spring-ws-spring-ws-2.1.1.RELEASE/parent/pom.xml	2012-09-18 12:22:28.000000000 +0200
++++ spring-ws-spring-ws-2.1.1.RELEASE-gil/parent/pom.xml	2014-12-28 20:40:31.606788545 +0100
+@@ -661,9 +661,19 @@
+                 </exclusions>
+             </dependency>
+             <dependency>
+-                <groupId>jivesoftware</groupId>
+-                <artifactId>smack</artifactId>
+-                <version>3.1.0</version>
++                <groupId>org.igniterealtime.smack</groupId>
++                <artifactId>smack-core</artifactId>
++                <version>4.0.6</version>
++            </dependency>
++            <dependency>
++                <groupId>org.igniterealtime.smack</groupId>
++                <artifactId>smack-extensions</artifactId>
++                <version>4.0.6</version>
++            </dependency>
++            <dependency>
++                <groupId>org.igniterealtime.smack</groupId>
++                <artifactId>smack-tcp</artifactId>
++                <version>4.0.6</version>
+             </dependency>
+             <!-- Logging dependencies -->
+             <dependency>
+diff -Nru spring-ws-spring-ws-2.1.1.RELEASE/support/pom.xml spring-ws-spring-ws-2.1.1.RELEASE-gil/support/pom.xml
+--- spring-ws-spring-ws-2.1.1.RELEASE/support/pom.xml	2012-09-18 12:22:28.000000000 +0200
++++ spring-ws-spring-ws-2.1.1.RELEASE-gil/support/pom.xml	2014-12-28 18:45:44.915366485 +0100
+@@ -90,8 +90,18 @@
+             <optional>true</optional>
+         </dependency>
+         <dependency>
+-            <groupId>jivesoftware</groupId>
+-            <artifactId>smack</artifactId>
++            <groupId>org.igniterealtime.smack</groupId>
++            <artifactId>smack-core</artifactId>
++            <optional>true</optional>
++        </dependency>
++        <dependency>
++            <groupId>org.igniterealtime.smack</groupId>
++            <artifactId>smack-extensions</artifactId>
++            <optional>true</optional>
++        </dependency>
++        <dependency>
++            <groupId>org.igniterealtime.smack</groupId>
++            <artifactId>smack-tcp</artifactId>
+             <optional>true</optional>
+         </dependency>
+         <!-- Other dependencies -->
+diff -Nru spring-ws-spring-ws-2.1.1.RELEASE/support/src/main/java/org/springframework/ws/transport/xmpp/support/XmppConnectionFactoryBean.java spring-ws-spring-ws-2.1.1.RELEASE-gil/support/src/main/java/org/springframework/ws/transport/xmpp/support/XmppConnectionFactoryBean.java
+--- spring-ws-spring-ws-2.1.1.RELEASE/support/src/main/java/org/springframework/ws/transport/xmpp/support/XmppConnectionFactoryBean.java	2012-09-18 12:22:28.000000000 +0200
++++ spring-ws-spring-ws-2.1.1.RELEASE-gil/support/src/main/java/org/springframework/ws/transport/xmpp/support/XmppConnectionFactoryBean.java	2014-12-28 20:37:39.984400354 +0100
+@@ -16,6 +16,9 @@
+ 
+ package org.springframework.ws.transport.xmpp.support;
+ 
++import java.io.IOException;
++import javax.security.sasl.SaslException;
++
+ import org.springframework.beans.factory.DisposableBean;
+ import org.springframework.beans.factory.FactoryBean;
+ import org.springframework.beans.factory.InitializingBean;
+@@ -23,8 +26,11 @@
+ import org.springframework.util.StringUtils;
+ 
+ import org.jivesoftware.smack.ConnectionConfiguration;
++import org.jivesoftware.smack.SmackException;
++import org.jivesoftware.smack.SmackException.NotConnectedException;
+ import org.jivesoftware.smack.XMPPConnection;
+ import org.jivesoftware.smack.XMPPException;
++import org.jivesoftware.smack.tcp.XMPPTCPConnection;
+ 
+ /**
+  * Factory to make {@link org.jivesoftware.smack.XMPPConnection} and perform connection and login on the XMPP server
+@@ -83,13 +89,13 @@
+         this.resource = resource;
+     }
+ 
+-    public void afterPropertiesSet() throws XMPPException {
++    public void afterPropertiesSet() throws XMPPException, SmackException, IOException, SaslException {
+         ConnectionConfiguration configuration = createConnectionConfiguration(host, port, serviceName);
+         Assert.notNull(configuration, "'configuration' must not be null");
+         Assert.hasText(username, "'username' must not be empty");
+         Assert.hasText(password, "'password' must not be empty");
+ 
+-        connection = new XMPPConnection(configuration);
++        connection = new XMPPTCPConnection(configuration);
+         connection.connect();
+         if (StringUtils.hasText(resource)) {
+             connection.login(username, password, resource);
+@@ -100,7 +106,12 @@
+     }
+ 
+     public void destroy() {
+-        connection.disconnect();
++        try {
++            connection.disconnect();
++        }
++        catch (NotConnectedException e) {
++            // Ignore
++        }
+     }
+ 
+     public XMPPConnection getObject() {
+diff -Nru spring-ws-spring-ws-2.1.1.RELEASE/support/src/main/java/org/springframework/ws/transport/xmpp/support/XmppTransportUtils.java spring-ws-spring-ws-2.1.1.RELEASE-gil/support/src/main/java/org/springframework/ws/transport/xmpp/support/XmppTransportUtils.java
+--- spring-ws-spring-ws-2.1.1.RELEASE/support/src/main/java/org/springframework/ws/transport/xmpp/support/XmppTransportUtils.java	2012-09-18 12:22:28.000000000 +0200
++++ spring-ws-spring-ws-2.1.1.RELEASE-gil/support/src/main/java/org/springframework/ws/transport/xmpp/support/XmppTransportUtils.java	2014-12-28 20:45:59.524333890 +0100
+@@ -25,6 +25,7 @@
+ import org.springframework.ws.transport.xmpp.XmppTransportConstants;
+ 
+ import org.jivesoftware.smack.packet.Message;
++import org.jivesoftware.smackx.jiveproperties.JivePropertiesManager;
+ 
+ /**
+  * Collection of utility methods to work with Mail transports.
+@@ -62,17 +63,17 @@
+     }
+ 
+     public static void addHeader(Message message, String name, String value) {
+-        message.setProperty(name, value);        
++        JivePropertiesManager.addProperty(message, name, value);
+     }
+ 
+     public static Iterator<String> getHeaderNames(Message message) {
+         Assert.notNull(message, "'message' must not be null");
+-        return message.getPropertyNames().iterator();
++        return JivePropertiesManager.getPropertiesNames(message).iterator();
+     }
+ 
+     public static Iterator<String> getHeaders(Message message, String name) {
+         Assert.notNull(message, "'message' must not be null");
+-        String value = message.getProperty(name).toString();
++        String value = JivePropertiesManager.getProperty(message, name).toString();
+         if (value != null) {
+             return Collections.singletonList(value).iterator();
+         }
+diff -Nru spring-ws-spring-ws-2.1.1.RELEASE/support/src/main/java/org/springframework/ws/transport/xmpp/XmppMessageReceiver.java spring-ws-spring-ws-2.1.1.RELEASE-gil/support/src/main/java/org/springframework/ws/transport/xmpp/XmppMessageReceiver.java
+--- spring-ws-spring-ws-2.1.1.RELEASE/support/src/main/java/org/springframework/ws/transport/xmpp/XmppMessageReceiver.java	2012-09-18 12:22:28.000000000 +0200
++++ spring-ws-spring-ws-2.1.1.RELEASE-gil/support/src/main/java/org/springframework/ws/transport/xmpp/XmppMessageReceiver.java	2014-12-28 20:39:06.787044706 +0100
+@@ -16,9 +16,13 @@
+ 
+ package org.springframework.ws.transport.xmpp;
+ 
++import java.io.IOException;
++
+ import org.springframework.ws.transport.support.AbstractStandaloneMessageReceiver;
+ 
+ import org.jivesoftware.smack.PacketListener;
++import org.jivesoftware.smack.SmackException;
++import org.jivesoftware.smack.SmackException.NotConnectedException;
+ import org.jivesoftware.smack.XMPPConnection;
+ import org.jivesoftware.smack.XMPPException;
+ import org.jivesoftware.smack.filter.PacketFilter;
+@@ -57,7 +61,7 @@
+     }
+ 
+     @Override
+-    protected void onActivate() throws XMPPException {
++    protected void onActivate() throws XMPPException, SmackException, IOException {
+         if (!connection.isConnected()) {
+             connection.connect();
+         }
+@@ -88,7 +92,11 @@
+             logger.info("Shutting down XMPP receiver [" + connection.getUser() + "]");
+         }
+         if (connection.isConnected()) {
+-            connection.disconnect();
++            try {
++                connection.disconnect();
++            } catch (NotConnectedException e) {
++                // Ignore
++            }
+         }
+     }
+ 
+diff -Nru spring-ws-spring-ws-2.1.1.RELEASE/support/src/main/java/org/springframework/ws/transport/xmpp/XmppReceiverConnection.java spring-ws-spring-ws-2.1.1.RELEASE-gil/support/src/main/java/org/springframework/ws/transport/xmpp/XmppReceiverConnection.java
+--- spring-ws-spring-ws-2.1.1.RELEASE/support/src/main/java/org/springframework/ws/transport/xmpp/XmppReceiverConnection.java	2012-09-18 12:22:28.000000000 +0200
++++ spring-ws-spring-ws-2.1.1.RELEASE-gil/support/src/main/java/org/springframework/ws/transport/xmpp/XmppReceiverConnection.java	2014-12-28 20:32:25.096201720 +0100
+@@ -28,6 +28,7 @@
+ import org.springframework.ws.transport.AbstractReceiverConnection;
+ import org.springframework.ws.transport.xmpp.support.XmppTransportUtils;
+ 
++import org.jivesoftware.smack.SmackException.NotConnectedException;
+ import org.jivesoftware.smack.XMPPConnection;
+ import org.jivesoftware.smack.packet.Message;
+ 
+@@ -136,6 +137,10 @@
+ 
+     @Override
+     protected void onSendAfterWrite(WebServiceMessage message) throws IOException {
+-        connection.sendPacket(responseMessage);
++        try {
++            connection.sendPacket(responseMessage);
++        } catch (NotConnectedException e) {
++            throw new IOException(e);
++        }
+     }
+ }
+diff -Nru spring-ws-spring-ws-2.1.1.RELEASE/support/src/main/java/org/springframework/ws/transport/xmpp/XmppSenderConnection.java spring-ws-spring-ws-2.1.1.RELEASE-gil/support/src/main/java/org/springframework/ws/transport/xmpp/XmppSenderConnection.java
+--- spring-ws-spring-ws-2.1.1.RELEASE/support/src/main/java/org/springframework/ws/transport/xmpp/XmppSenderConnection.java	2012-09-18 12:22:28.000000000 +0200
++++ spring-ws-spring-ws-2.1.1.RELEASE-gil/support/src/main/java/org/springframework/ws/transport/xmpp/XmppSenderConnection.java	2014-12-28 20:32:56.286636447 +0100
+@@ -29,6 +29,7 @@
+ import org.springframework.ws.transport.xmpp.support.XmppTransportUtils;
+ 
+ import org.jivesoftware.smack.PacketCollector;
++import org.jivesoftware.smack.SmackException.NotConnectedException;
+ import org.jivesoftware.smack.XMPPConnection;
+ import org.jivesoftware.smack.filter.AndFilter;
+ import org.jivesoftware.smack.filter.PacketFilter;
+@@ -125,7 +126,11 @@
+     @Override
+     protected void onSendAfterWrite(WebServiceMessage message) throws IOException {
+         requestMessage.setFrom(connection.getUser());
+-        connection.sendPacket(requestMessage);
++        try {
++            connection.sendPacket(requestMessage);
++        } catch (NotConnectedException e) {
++            throw new IOException(e);
++        }
+     }
+ 
+     /*
diff --git a/springframework-ws.spec b/springframework-ws.spec
index c77b8ec..55f760e 100644
--- a/springframework-ws.spec
+++ b/springframework-ws.spec
@@ -3,14 +3,14 @@
 %global oname spring-ws
 Name:          springframework-ws
 Version:       2.1.1
-Release:       3%{?dist}
+Release:       4%{?dist}
 Summary:       Spring Web Services
 License:       ASL 2.0
 URL:           http://projects.spring.io/spring-ws/
-# latest release depend on springframework >= 3.2.2.RELEASE
+# latest release depend on springframework >= 3.2.9.RELEASE
 Source0:       https://github.com/spring-projects/%{oname}/archive/%{oname}-%{namedversion}.tar.gz
-
-BuildRequires: java-devel
+# Thanks to Florian Schmaus flo at geekplace.eu
+Patch0:        springframework-ws-2.1.1-smack4.patch
 
 BuildRequires: mvn(com.sun.xml.messaging.saaj:saaj-impl)
 BuildRequires: mvn(commons-httpclient:commons-httpclient)
@@ -22,7 +22,9 @@ BuildRequires: mvn(javax.xml.soap:saaj-api)
 BuildRequires: mvn(javax.xml.stream:stax-api)
 BuildRequires: mvn(javax.mail:mail)
 BuildRequires: mvn(jaxen:jaxen)
-BuildRequires: mvn(jivesoftware:smack)
+BuildRequires: mvn(org.igniterealtime.smack:smack-core) >= 4.0.6
+BuildRequires: mvn(org.igniterealtime.smack:smack-extensions)
+BuildRequires: mvn(org.igniterealtime.smack:smack-tcp)
 BuildRequires: mvn(org.apache.httpcomponents:httpclient)
 BuildRequires: mvn(org.apache.ws.commons.axiom:axiom-api)
 BuildRequires: mvn(org.apache.ws.commons.axiom:axiom-impl)
@@ -214,6 +216,8 @@ jboss-servlet-api_3.0_spec" core
   </execution>
 </executions>'
 
+%patch0 -p1
+
 sed -i 's/\r//' notice.txt
 
 %build
@@ -232,6 +236,9 @@ sed -i 's/\r//' notice.txt
 %doc license.txt notice.txt
 
 %changelog
+* Tue Dec 30 2014 gil cattaneo <puntogil at libero.it> 2.1.1-4
+- add Smack 4 support
+
 * Sun Jun 08 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.1.1-3
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
 


More information about the scm-commits mailing list