diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-05-15 20:44:49 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-05-15 20:44:49 +0000 |
commit | 08e6d577358362d8da1172a47da4ace6916e6d2e (patch) | |
tree | 952bfda2ecf48191f94531e975e99035f0f8d88a /branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache | |
parent | 73ffdb3c639f918474bc0df9dac57af8b121f3ab (diff) |
TUSCANY-2967 Fix up just jmsBytes wire format to return exceptions as bytes to see if this is what we want
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@775324 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache')
-rw-r--r-- | branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/BytesMessageProcessor.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/BytesMessageProcessor.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/BytesMessageProcessor.java index 057b58ca11..b2f5102bb7 100644 --- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/BytesMessageProcessor.java +++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/BytesMessageProcessor.java @@ -18,16 +18,20 @@ */ package org.apache.tuscany.sca.binding.jms.provider; +import java.lang.reflect.InvocationTargetException; import java.util.logging.Logger; import javax.jms.BytesMessage; import javax.jms.JMSException; import javax.jms.Message; +import javax.jms.ObjectMessage; import javax.jms.Session; import javax.jms.TextMessage; import org.apache.tuscany.sca.binding.jms.impl.JMSBinding; +import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants; import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException; +import org.osoa.sca.ServiceRuntimeException; /** * MessageProcessor for sending/receiving javax.jms.BytesMessage with the JMSBinding. @@ -42,6 +46,21 @@ public class BytesMessageProcessor extends AbstractMessageProcessor { } @Override + public Object extractPayloadFromJMSMessage(Message msg) { + byte [] bytes = (byte [])extractPayload(msg); + + try { + if (msg.getBooleanProperty(JMSBindingConstants.FAULT_PROPERTY)) { + return new InvocationTargetException(new ServiceRuntimeException(bytes.toString())); + } else { + return bytes; + } + } catch (JMSException e) { + throw new JMSBindingException(e); + } + } + + @Override protected Object extractPayload(Message msg) { try { @@ -58,6 +77,17 @@ public class BytesMessageProcessor extends AbstractMessageProcessor { throw new JMSBindingException(e); } } + + @Override + public Message createFaultMessage(Session session, Throwable o) { + try { + Message message = createJMSMessage(session, o.toString().getBytes()); + message.setBooleanProperty(JMSBindingConstants.FAULT_PROPERTY, true); + return message; + } catch (JMSException e) { + throw new JMSBindingException(e); + } + } @Override protected Message createJMSMessage(Session session, Object o) { |