KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > mail > command > AbstractMailCommand


1 /*
2  * Copyright 1999-2004 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.cocoon.mail.command;
17
18 import java.util.ArrayList JavaDoc;
19 import java.util.Iterator JavaDoc;
20 import java.util.List JavaDoc;
21 import javax.mail.MessagingException JavaDoc;
22 import org.apache.avalon.framework.logger.AbstractLogEnabled;
23
24 /**
25  * An abstract MailCommand template
26  *
27  * @author Bernhard Huber
28  * @since 23. Oktober 2002
29  * @version CVS $Id: AbstractMailCommand.java 30932 2004-07-29 17:35:38Z vgritsenko $
30  */

31 public abstract class AbstractMailCommand extends AbstractLogEnabled
32          implements MailCommand {
33
34     /**
35      * List of result objects
36      */

37     private List JavaDoc result;
38
39
40     /**
41      * Constructor for the AbstractMailCommand object
42      */

43     public AbstractMailCommand() {
44         result = new ArrayList JavaDoc();
45     }
46
47
48     /**
49      * Gets the results attribute of the AbstractMailCommand object
50      *
51      *@return The results value
52      */

53     public List JavaDoc getResults() {
54         return result;
55     }
56
57
58     /**
59      * Adds a result to the Result attribute of the AbstractMailCommand object
60      *
61      *@param o The result to be added to the Result attribute
62      */

63     public void addResult(Object JavaDoc o) {
64         result.add(o);
65     }
66
67
68     /**
69      * Adds a list of results to the Results attribute of the AbstractMailCommand object
70      *
71      *@param list The list of results to be added to the Results attribute
72      */

73     public void addResults(List JavaDoc list) {
74         result.addAll(list);
75     }
76
77
78     /**
79      * Return an iterator over the results
80      *
81      *@return result iterator
82      */

83     public Iterator JavaDoc iterator() {
84         return result.iterator();
85     }
86
87
88     /**
89      * Execute this command
90      *
91      *@exception MessagingException thrown if executing of this MailCommand fails
92      */

93     public abstract void execute() throws MessagingException JavaDoc;
94 }
95
96
97
Popular Tags