1 10 11 package org.mule.providers.oracle.jms; 12 13 import oracle.jms.AdtMessage; 14 import oracle.xdb.XMLType; 15 16 import org.mule.providers.jms.JmsMessageAdapter; 17 import org.mule.umo.MessagingException; 18 19 25 public class OracleJmsMessageAdapter extends JmsMessageAdapter 26 { 27 28 31 private static final long serialVersionUID = -5304537031626649816L; 32 33 public OracleJmsMessageAdapter(Object message) throws MessagingException 34 { 35 super(message); 36 } 37 38 46 public byte[] getPayloadAsBytes() throws Exception 47 { 48 Object jmsMessage = getPayload(); 49 if (jmsMessage instanceof AdtMessage) 50 { 51 Object adtMessage = ((AdtMessage)jmsMessage).getAdtPayload(); 52 if (adtMessage instanceof XMLType) 53 { 54 return ((XMLType)adtMessage).getBytesValue(); 55 } 56 else 57 { 58 return adtMessage.toString().getBytes(getEncoding()); 59 } 60 } 61 else 62 { 63 return super.getPayloadAsBytes(); 64 } 65 } 66 67 75 public String getPayloadAsString(String encoding) throws Exception 76 { 77 Object jmsMessage = getPayload(); 78 if (jmsMessage instanceof AdtMessage) 79 { 80 Object adtMessage = ((AdtMessage)jmsMessage).getAdtPayload(); 81 if (adtMessage instanceof XMLType) 82 { 83 return ((XMLType)adtMessage).getStringVal(); 84 } 85 else 86 { 87 return adtMessage.toString(); 88 } 89 } 90 else 91 { 92 return super.getPayloadAsString(encoding); 93 } 94 } 95 96 } 97 | Popular Tags |