1 10 11 package org.mule.providers.file; 12 13 import java.io.File ; 14 15 import org.mule.MuleRuntimeException; 16 import org.mule.config.i18n.Message; 17 import org.mule.config.i18n.Messages; 18 import org.mule.umo.MessagingException; 19 20 26 public class FileContentsMessageAdapter extends FileMessageAdapter 27 { 28 31 private static final long serialVersionUID = 7368719494535568721L; 32 33 public FileContentsMessageAdapter(Object message) throws MessagingException 34 { 35 super(message); 36 } 37 38 protected void setMessage(File message) throws MessagingException 39 { 40 super.setMessage(message); 41 this.getPayload(); 43 } 44 45 50 public Object getPayload() 51 { 52 synchronized (this) 53 { 54 try 55 { 56 return this.getPayloadAsBytes(); 57 } 58 catch (Exception noPayloadException) 59 { 60 throw new MuleRuntimeException(new Message(Messages.FAILED_TO_READ_PAYLOAD), 61 noPayloadException); 62 } 63 } 64 } 65 66 } 67 | Popular Tags |