001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.apache.commons.mail;
018
019 import java.net.URL;
020
021 /**
022 * This class models an email attachment. Used by MultiPartEmail.
023 *
024 * @since 1.0
025 * @author <a href="mailto:frank.kim@clearink.com">Frank Y. Kim</a>
026 * @version $Id: EmailAttachment.java 480401 2006-11-29 04:40:04Z bayard $
027 */
028 public class EmailAttachment
029 {
030 /** Definition of the part being an attachment */
031 public static final String ATTACHMENT = javax.mail.Part.ATTACHMENT;
032 /** Definition of the part being inline */
033 public static final String INLINE = javax.mail.Part.INLINE;
034
035 /** The name of this attachment. */
036 private String name = "";
037
038 /** The description of this attachment. */
039 private String description = "";
040
041 /** The path to this attachment (ie c:/path/to/file.jpg). */
042 private String path = "";
043
044 /** The HttpURI where the file can be got. */
045 private URL url;
046
047 /** The disposition. */
048 private String disposition = EmailAttachment.ATTACHMENT;
049
050 /**
051 * Get the description.
052 *
053 * @return A String.
054 * @since 1.0
055 */
056 public String getDescription()
057 {
058 return description;
059 }
060
061 /**
062 * Get the name.
063 *
064 * @return A String.
065 * @since 1.0
066 */
067 public String getName()
068 {
069 return name;
070 }
071
072 /**
073 * Get the path.
074 *
075 * @return A String.
076 * @since 1.0
077 */
078 public String getPath()
079 {
080 return path;
081 }
082
083 /**
084 * Get the URL.
085 *
086 * @return A URL.
087 * @since 1.0
088 */
089 public URL getURL()
090 {
091 return url;
092 }
093
094 /**
095 * Get the disposition.
096 *
097 * @return A String.
098 * @since 1.0
099 */
100 public String getDisposition()
101 {
102 return disposition;
103 }
104
105 /**
106 * Set the description.
107 *
108 * @param desc A String.
109 * @since 1.0
110 */
111 public void setDescription(String desc)
112 {
113 this.description = desc;
114 }
115
116 /**
117 * Set the name.
118 *
119 * @param aName A String.
120 * @since 1.0
121 */
122 public void setName(String aName)
123 {
124 this.name = aName;
125 }
126
127 /**
128 * Set the path to the attachment. The path can be absolute or relative
129 * and should include the filename.
130 * <p>
131 * Example: /home/user/images/image.jpg<br>
132 * Example: images/image.jpg
133 *
134 * @param aPath A String.
135 * @since 1.0
136 */
137 public void setPath(String aPath)
138 {
139 this.path = aPath;
140 }
141
142 /**
143 * Set the URL.
144 *
145 * @param aUrl A URL.
146 * @since 1.0
147 */
148 public void setURL(URL aUrl)
149 {
150 this.url = aUrl;
151 }
152
153 /**
154 * Set the disposition.
155 *
156 * @param aDisposition A String.
157 * @since 1.0
158 */
159 public void setDisposition(String aDisposition)
160 {
161 this.disposition = aDisposition;
162 }
163 }