KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > ant > jonasbase > Tasks


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 2004 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * Initial developer: Florent BENOIT
22  * --------------------------------------------------------------------------
23  * $Id: Tasks.java,v 1.2 2005/06/07 08:21:27 pelletib Exp $
24  * --------------------------------------------------------------------------
25  */

26
27 package org.objectweb.jonas.ant.jonasbase;
28
29 import java.util.ArrayList JavaDoc;
30 import java.util.Iterator JavaDoc;
31 import java.util.List JavaDoc;
32
33 import org.apache.tools.ant.Task;
34
35 /**
36  * @author Florent Benoit
37  */

38 public class Tasks {
39
40     /**
41      * List of tasks
42      */

43     private List JavaDoc tasks = null;
44
45     /**
46      * Default constructor
47      */

48     public Tasks() {
49         tasks = new ArrayList JavaDoc();
50     }
51
52     /**
53      * Add a task to the list of defined tasks
54      * @param task to add
55      */

56     public void addTask(Task task) {
57         tasks.add(task);
58     }
59
60     /**
61      * @return a list of all tasks to do
62      */

63     public List JavaDoc getTasks() {
64         return tasks;
65     }
66
67     /**
68      * Add several tasks
69      * @param subTasks some tasks to do
70      */

71     public void addTasks(Tasks subTasks) {
72         if (subTasks != null) {
73             for (Iterator JavaDoc it = subTasks.getTasks().iterator(); it.hasNext();) {
74                 addTask((Task) it.next());
75             }
76         }
77     }
78
79     /**
80      * Add several tasks
81      * @param tasks some tasks to do
82      */

83     public void addTasks(List JavaDoc tasks) {
84         if (tasks != null) {
85             for (Iterator JavaDoc it = tasks.iterator(); it.hasNext();) {
86                 addTask((Task) it.next());
87             }
88         }
89     }
90  }
Popular Tags