1 10 11 package org.mule.providers.vm; 12 13 import org.mule.providers.AbstractMessageAdapter; 14 import org.mule.umo.UMOMessage; 15 import org.mule.umo.provider.MessageTypeNotSupportedException; 16 17 26 public class VMMessageAdapter extends AbstractMessageAdapter 27 { 28 31 private static final long serialVersionUID = 4037066880189053665L; 32 33 36 private UMOMessage message = null; 37 38 public VMMessageAdapter(UMOMessage message) throws MessageTypeNotSupportedException 39 { 40 setMessage(message); 41 } 42 43 51 public String getPayloadAsString(String encoding) throws Exception 52 { 53 return message.getPayloadAsString(encoding); 54 } 55 56 62 public byte[] getPayloadAsBytes() throws Exception 63 { 64 return convertToBytes(message.getPayload()); 65 } 66 67 70 public Object getPayload() 71 { 72 return message; 73 } 74 75 78 private void setMessage(UMOMessage message) throws MessageTypeNotSupportedException 79 { 80 if (message == null) 81 { 82 throw new MessageTypeNotSupportedException(null, getClass()); 83 } 84 this.message = message; 85 } 86 87 public String getUniqueId() 88 { 89 return message.getUniqueId(); 90 } 91 92 } 93 | Popular Tags |