2
* $Header: /home/cvs/jakarta-struts/contrib/tag-doc/src/java/org/apache/struts/taskdefs/EnhMatchingTask.java,v 1.4 2004/03/14 07:15:06 sraeburn Exp $
4
* $Date: 2004/03/14 07:15:06 $
6
* Copyright 1999-2004 The Apache Software Foundation.
8
* Licensed under the Apache License, Version 2.0 (the "License");
9
* you may not use this file except in compliance with the License.
10
* You may obtain a copy of the License at
12
* http://www.apache.org/licenses/LICENSE-2.0
14
* Unless required by applicable law or agreed to in writing, software
15
* distributed under the License is distributed on an "AS IS" BASIS,
16
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
* See the License for the specific language governing permissions and
18
* limitations under the License.
21
package org.apache.struts.taskdefs;
24
import java.util.ArrayList;
25
import java.util.Iterator;
26
import java.util.List;
28
import org.apache.tools.ant.DirectoryScanner;
29
import org.apache.tools.ant.taskdefs.MatchingTask;
30
import org.apache.tools.ant.types.FileSet;
33
0
* ENHanced-MatchingTask - enhances the MatchingTask by allowing
34
1
* the subclasses to act as a FileSet container as well as allowing
35
2
* the implicit FileSet.
37
4
* @version $Revision: 1.4 $ $Date: 2004/03/14 07:15:06 $
40
public abstract class EnhMatchingTask extends MatchingTask {
41
/** Base directory for implicit FileSet */
43
/** List of embeded filesets */
44
protected List filesets = new ArrayList();
47
* Set the base directory for the implicit FileSet
48
* @param base directory for implicit FileSet
50
public void setDir(File dir) {
54
* Adds an embeded FileSet for this task.
55
* @param the FileSet to add
57
public void addFileset(FileSet fileset) {
58
filesets.add(fileset);
62
* Returns the combined list of Files, from both the
63
* implicit and embeded FileSets.
64
* @return list of File objects
66
protected List getFiles() {
67
List files = new ArrayList();
70
files.addAll(getFiles(fileset));
72
Iterator iter = filesets.iterator();
73
while (iter.hasNext()) {
74
files.addAll(getFiles((FileSet) iter.next()));
78
private List getFiles(FileSet fs) {
79
List files = new ArrayList();
80
DirectoryScanner ds = fs.getDirectoryScanner(fs.getProject());
81
File dir = ds.getBasedir();
82
String[] filenames = ds.getIncludedFiles();
83
for (int i = 0; i < filenames.length; i++) {
84
File file = new File(dir, filenames[i]);
b'\\ No newline at end of file'