1 /* 2 * Copyright 2001-2005 The Apache Software Foundation 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.apache.commons.mail; 17 18 import java.net.URL; 19 20 /** 21 * This class models an email attachment. Used by MultiPartEmail. 22 * 23 * @since 1.0 24 * @author <a href="mailto:frank.kim@clearink.com">Frank Y. Kim</a> 25 * @version $Id: EmailAttachment.java 225600 2005-07-27 20:16:23Z rdonkin $ 26 */ 27 public class EmailAttachment 28 { 29 /** Definition of the part being an attachment */ 30 public static final String ATTACHMENT = javax.mail.Part.ATTACHMENT; 31 /** Definition of the part being inline */ 32 public static final String INLINE = javax.mail.Part.INLINE; 33 34 /** The name of this attachment. */ 35 private String name = ""; 36 37 /** The description of this attachment. */ 38 private String description = ""; 39 40 /** The path to this attachment (ie c:/path/to/file.jpg). */ 41 private String path = ""; 42 43 /** The HttpURI where the file can be got. */ 44 private URL url; 45 46 /** The disposition. */ 47 private String disposition = EmailAttachment.ATTACHMENT; 48 49 /** 50 * Get the description. 51 * 52 * @return A String. 53 * @since 1.0 54 */ 55 public String getDescription() 56 { 57 return description; 58 } 59 60 /** 61 * Get the name. 62 * 63 * @return A String. 64 * @since 1.0 65 */ 66 public String getName() 67 { 68 return name; 69 } 70 71 /** 72 * Get the path. 73 * 74 * @return A String. 75 * @since 1.0 76 */ 77 public String getPath() 78 { 79 return path; 80 } 81 82 /** 83 * Get the URL. 84 * 85 * @return A URL. 86 * @since 1.0 87 */ 88 public URL getURL() 89 { 90 return url; 91 } 92 93 /** 94 * Get the disposition. 95 * 96 * @return A String. 97 * @since 1.0 98 */ 99 public String getDisposition() 100 { 101 return disposition; 102 } 103 104 /** 105 * Set the description. 106 * 107 * @param desc A String. 108 * @since 1.0 109 */ 110 public void setDescription(String desc) 111 { 112 this.description = desc; 113 } 114 115 /** 116 * Set the name. 117 * 118 * @param aName A String. 119 * @since 1.0 120 */ 121 public void setName(String aName) 122 { 123 this.name = aName; 124 } 125 126 /** 127 * Set the path to the attachment. The path can be absolute or relative 128 * and should include the filename. 129 * <p> 130 * Example: /home/user/images/image.jpg<br> 131 * Example: images/image.jpg 132 * 133 * @param aPath A String. 134 * @since 1.0 135 */ 136 public void setPath(String aPath) 137 { 138 this.path = aPath; 139 } 140 141 /** 142 * Set the URL. 143 * 144 * @param aUrl A URL. 145 * @since 1.0 146 */ 147 public void setURL(URL aUrl) 148 { 149 this.url = aUrl; 150 } 151 152 /** 153 * Set the disposition. 154 * 155 * @param aDisposition A String. 156 * @since 1.0 157 */ 158 public void setDisposition(String aDisposition) 159 { 160 this.disposition = aDisposition; 161 } 162 }