1 16 package org.jboss.axis.attachments; 17 18 import org.jboss.axis.AxisFault; 19 import org.jboss.axis.Part; 20 import org.jboss.axis.utils.Messages; 21 22 import javax.activation.DataHandler ; 23 24 29 public class AttachmentUtils 30 { 31 32 private AttachmentUtils() 33 { 34 } 35 37 44 public static DataHandler getActivationDataHandler(Part part) 45 throws AxisFault 46 { 47 48 if (null == part) 49 { 50 throw new AxisFault(Messages.getMessage("gotNullPart")); 51 } 52 53 if (!(part instanceof AttachmentPartImpl)) 54 { 55 throw new AxisFault(Messages.getMessage("unsupportedAttach", part.getClass().getName(), 56 AttachmentPartImpl.class.getName())); 57 } 58 59 return ((AttachmentPartImpl)part).getActivationDataHandler(); 60 } 61 62 69 public static boolean isAttachment(Object value) 70 { 71 72 if (null == value) 73 { 74 return false; 75 } 76 77 return value instanceof javax.activation.DataHandler ; 78 } 79 } | Popular Tags |