1 10 11 package org.mule.providers.space; 12 13 import org.mule.providers.AbstractMessageAdapter; 14 import org.mule.umo.provider.MessageTypeNotSupportedException; 15 import org.mule.util.UUID; 16 17 20 public class SpaceMessageAdapter extends AbstractMessageAdapter 21 { 22 25 private static final long serialVersionUID = -2984429022763795361L; 26 27 private final String id; 28 private final Object message; 29 30 37 public SpaceMessageAdapter(Object message) throws MessageTypeNotSupportedException 38 { 39 if (message == null) 40 { 41 throw new MessageTypeNotSupportedException(null, getClass()); 42 } 43 else 44 { 45 this.id = UUID.getUUID(); 46 this.message = message; 47 } 48 } 49 50 public byte[] getPayloadAsBytes() throws Exception 51 { 52 return convertToBytes(getPayload()); 53 } 54 55 63 public String getPayloadAsString(String encoding) throws Exception 64 { 65 return message.toString(); 66 } 67 68 71 public Object getPayload() 72 { 73 return message; 74 } 75 76 public String getUniqueId() 77 { 78 return id; 79 } 80 81 } 82 | Popular Tags |