source: release-kits/lirk3/resources/gs3-release-maker/apache-ant-1.6.5/src/etc/testcases/core/containersrc/test/SpecialSeq.java@ 14982

Last change on this file since 14982 was 14982, checked in by oranfry, 16 years ago

initial import of LiRK3

File size: 2.0 KB
Line 
1/*
2 * Copyright 2003-2004 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 */
17package test;
18
19import org.apache.tools.ant.Task;
20import org.apache.tools.ant.TaskContainer;
21import org.apache.tools.ant.BuildException;
22import org.apache.tools.ant.types.FileSet;
23import org.apache.tools.ant.taskdefs.Echo;
24import java.util.*;
25
26public class SpecialSeq extends Task implements TaskContainer {
27 /** Optional Vector holding the nested tasks */
28 private Vector nestedTasks = new Vector();
29
30 private FileSet fileset;
31
32 private Echo nestedEcho;
33
34 /**
35 * Add a nested task.
36 * <p>
37 * @param nestedTask Nested task to execute
38 * <p>
39 */
40 public void addTask(Task nestedTask) {
41 nestedTasks.addElement(nestedTask);
42 }
43
44 /**
45 * Execute all nestedTasks.
46 */
47 public void execute() throws BuildException {
48 if (fileset == null || fileset.getDir(getProject()) == null) {
49 throw new BuildException("Fileset was not configured");
50 }
51 for (Enumeration e = nestedTasks.elements(); e.hasMoreElements();) {
52 Task nestedTask = (Task) e.nextElement();
53 nestedTask.perform();
54 }
55 nestedEcho.reconfigure();
56 nestedEcho.perform();
57 }
58
59 public void addFileset(FileSet fileset) {
60 this.fileset = fileset;
61 }
62
63 public void addNested(Echo nestedEcho) {
64 this.nestedEcho = nestedEcho;
65 }
66}
Note: See TracBrowser for help on using the repository browser.