1 10 11 package org.mule.providers.gs; 12 13 import net.jini.core.entry.Entry; 14 15 import org.mule.providers.AbstractMessageAdapter; 16 import org.mule.umo.provider.MessageTypeNotSupportedException; 17 import org.mule.umo.provider.UMOMessageAdapter; 18 19 import com.j_spaces.core.client.ExternalEntry; 20 21 public class GigaSpacesMessageAdapter extends AbstractMessageAdapter 22 { 23 26 private static final long serialVersionUID = 2895659875976934721L; 27 28 private static final GigaSpacesEntryConverter converter = new GigaSpacesEntryConverter(); 29 30 private final Object message; 31 32 39 public GigaSpacesMessageAdapter(Object message) throws MessageTypeNotSupportedException 40 { 41 if (message == null) 42 { 43 throw new MessageTypeNotSupportedException(null, getClass()); 45 } 46 else 47 { 48 this.message = message; 49 } 50 } 51 52 55 public byte[] getPayloadAsBytes() throws Exception 56 { 57 return convertToBytes(getPayload()); 58 } 59 60 63 public String getPayloadAsString(String encoding) throws Exception 64 { 65 return message.toString(); 66 } 67 68 71 public Object getPayload() 72 { 73 if (message instanceof ExternalEntry) 74 { 75 return converter.toPojo((Entry)message); 76 } 77 return message; 78 } 79 80 } 81 | Popular Tags |