1 17 package org.apache.james.util.mail.handlers; 18 19 import java.io.IOException ; 20 import java.io.OutputStream ; 21 22 import javax.activation.ActivationDataFlavor ; 23 import javax.activation.DataSource ; 24 import javax.mail.MessagingException ; 25 26 import org.apache.james.util.mail.MimeMultipartReport; 27 28 35 public class multipart_report extends AbstractDataContentHandler 36 { 37 40 public multipart_report() 41 { 42 super(); 43 } 44 45 48 protected ActivationDataFlavor computeDataFlavor() 49 { 50 return new ActivationDataFlavor (MimeMultipartReport.class, 51 "multipart/report", "Multipart Report"); 52 } 53 54 58 public void writeTo(Object aPart, String aMimeType, OutputStream aStream) 59 throws IOException 60 { 61 if (!(aPart instanceof MimeMultipartReport)) 62 throw new IOException ("Type \"" + aPart.getClass().getName() 63 + "\" is not supported."); 64 try 65 { 66 ((MimeMultipartReport) aPart).writeTo(aStream); 67 } 68 catch (MessagingException e) 69 { 70 throw new IOException (e.getMessage()); 71 } 72 } 73 74 77 protected Object computeContent(DataSource aDataSource) 78 throws MessagingException 79 { 80 return new MimeMultipartReport(aDataSource); 81 } 82 } 83 | Popular Tags |