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