AMQ-4060: Upgraded Spring OXM to Spring 3 version.

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1386583 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Claus Ibsen 2012-09-17 12:38:51 +00:00
parent 83a9c62b7c
commit b358c05696
6 changed files with 32 additions and 21 deletions

View File

@ -64,6 +64,7 @@
<feature name="activemq-optional" version="${activemq-version}" resolver="(obr)">
<feature version="${activemq-version}">activemq-blueprint</feature>
<feature version="${activemq-version}">activemq-spring</feature>
<feature version="[7.5,8.0)">jetty</feature>
<bundle>mvn:org.apache.activemq/activemq-optional/${activemq-version}</bundle>
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.josql/${josql-version}</bundle>
@ -73,6 +74,7 @@
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xmlbeans/${xmlbeans-bundle-version}</bundle>
<bundle>mvn:org.apache.httpcomponents/httpcore-osgi/${httpclient-version}</bundle>
<bundle>mvn:org.apache.httpcomponents/httpclient-osgi/${httpclient-version}</bundle>
<bundle>mvn:org.springframework/spring-oxm/${spring-version}</bundle>
</feature>
<feature name="activemq-camel" version="${activemq-version}" resolver="(obr)">

View File

@ -162,9 +162,9 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-oxm-tiger</artifactId>
<optional>true</optional>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.xbean</groupId>

View File

@ -17,17 +17,22 @@
package org.apache.activemq.util.oxm;
import java.io.StringReader;
import java.io.StringWriter;
import javax.jms.JMSException;
import javax.jms.ObjectMessage;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.springframework.oxm.support.AbstractMarshaller;
import org.springframework.oxm.AbstractMarshaller;
import org.springframework.xml.transform.StringResult;
import org.springframework.xml.transform.StringSource;
/**
* Transforms object messages to text messages and vice versa using {@link Spring OXM}
* Transforms object messages to text messages and vice versa using Spring OXM.
*
*/
public class OXMMessageTransformer extends AbstractXMLMessageTransformer {
@ -51,10 +56,12 @@ public class OXMMessageTransformer extends AbstractXMLMessageTransformer {
*/
protected String marshall(Session session, ObjectMessage objectMessage)
throws JMSException {
StringResult result = new StringResult();
try {
marshaller.marshal(objectMessage.getObject(), result);
return result.toString();
StringWriter writer = new StringWriter();
Result result = new StreamResult(writer);
marshaller.marshal(objectMessage.getObject(), result);
writer.flush();
return writer.toString();
} catch (Exception e) {
throw new JMSException(e.getMessage());
}
@ -67,7 +74,9 @@ public class OXMMessageTransformer extends AbstractXMLMessageTransformer {
protected Object unmarshall(Session session, TextMessage textMessage)
throws JMSException {
try {
return marshaller.unmarshal(new StringSource(textMessage.getText()));
String text = textMessage.getText();
Source source = new StreamSource(new StringReader(text));
return marshaller.unmarshal(source);
} catch (Exception e) {
throw new JMSException(e.getMessage());
}

View File

@ -230,8 +230,8 @@
<optional>false</optional>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-oxm-tiger</artifactId>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.jettison</groupId>

View File

@ -152,18 +152,18 @@
<include>org.apache.geronimo.specs:geronimo-j2ee-connector_1.5_spec</include>
<include>org.apache.xbean:xbean-spring</include>
<include>org.springframework:spring-aop</include>
<include>org.springframework:spring-core</include>
<include>org.springframework:spring-asm</include>
<include>org.springframework:spring-beans</include>
<include>org.springframework:spring-context</include>
<include>org.springframework:spring-tx</include>
<include>org.springframework:spring-jms</include>
<include>org.springframework:spring-asm</include>
<include>org.springframework:spring-core</include>
<include>org.springframework:spring-expression</include>
<include>org.springframework:spring-jms</include>
<include>org.springframework:spring-oxm</include>
<include>org.springframework:spring-tx</include>
<include>com.thoughtworks.xstream:xstream</include>
<include>xpp3:xpp3</include>
<include>org.codehaus.woodstox:woodstox-core-asl</include>
<include>org.codehaus.woodstox:stax2-api</include>
<include>org.springframework.ws:spring-oxm-tiger</include>
<include>org.codehaus.jettison:jettison</include>
<include>org.apache.velocity:velocity</include>
<include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.josql</include>

View File

@ -641,9 +641,9 @@
<version>${spring-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-oxm-tiger</artifactId>
<version>${spring-oxm-version}</version>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${spring-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.osgi</groupId>