KickJava   Java API By Example, From Geeks To Geeks.

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


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.Iterator JavaDoc;
19 import java.util.List JavaDoc;
20 import javax.mail.MessagingException JavaDoc;
21
22 /**
23  * Execute a list of commands.
24  *
25  * @author Bernhard Huber
26  * @since 23. Oktober 2002
27  * @version CVS $Id: MailCommands.java 30932 2004-07-29 17:35:38Z vgritsenko $
28  */

29 public class MailCommands extends AbstractMailCommand {
30
31     /**
32      * the list of commands
33      */

34     private List JavaDoc commands;
35
36
37     /**
38      * Constructor for the MailCommands object
39      *
40      *@param commands a list of AbstractMailCommand entries
41      */

42     public MailCommands(List JavaDoc commands) {
43         this.commands = commands;
44     }
45
46
47     /**
48      * Execute the list of commands
49      * <p>
50      * Gather all results of all commands.
51      * </p>
52      *
53      *@exception MessagingException Description of the Exception
54      */

55     public void execute() throws MessagingException JavaDoc {
56         Iterator JavaDoc i = commands.iterator();
57         while (i.hasNext()) {
58             AbstractMailCommand command = (AbstractMailCommand) i.next();
59             command.execute();
60             addResults(command.getResults());
61         }
62     }
63 }
64
65
66
Popular Tags