01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.cocoon.mail.command;
18:
19: import java.util.Iterator;
20: import java.util.List;
21: import javax.mail.MessagingException;
22:
23: /**
24: * Execute a list of commands.
25: *
26: * @author Bernhard Huber
27: * @since 23 October 2002
28: * @version $Id: MailCommands.java 468424 2006-10-27 15:44:53Z vgritsenko $
29: */
30: public class MailCommands extends AbstractMailCommand {
31:
32: /**
33: * the list of commands
34: */
35: private List commands;
36:
37: /**
38: * Constructor for the MailCommands object
39: *
40: *@param commands a list of AbstractMailCommand entries
41: */
42: public MailCommands(List commands) {
43: this .commands = commands;
44: }
45:
46: /**
47: * Execute the list of commands
48: * <p>
49: * Gather all results of all commands.
50: * </p>
51: *
52: *@exception MessagingException Description of the Exception
53: */
54: public void execute() throws MessagingException {
55: Iterator i = commands.iterator();
56: while (i.hasNext()) {
57: AbstractMailCommand command = (AbstractMailCommand) i
58: .next();
59: command.execute();
60: addResults(command.getResults());
61: }
62: }
63: }
|