%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.commons.jelly.tags.ant.FileScanner |
|
|
1 | /* |
|
2 | * Copyright 2002,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.commons.jelly.tags.ant; |
|
17 | ||
18 | import java.util.ArrayList; |
|
19 | import java.util.Iterator; |
|
20 | import java.util.List; |
|
21 | ||
22 | import org.apache.tools.ant.Project; |
|
23 | import org.apache.tools.ant.types.FileSet; |
|
24 | ||
25 | /** |
|
26 | * <p><code>FileScanner</code> is a bean which allows the iteration |
|
27 | * over a number of files from a colleciton of FileSet instances. |
|
28 | * |
|
29 | * @author <a href="mailto:jstrachan@apache.org">James Strachan</a> |
|
30 | * @version $Revision: 1.4 $ |
|
31 | */ |
|
32 | 0 | public class FileScanner { |
33 | ||
34 | /** FileSets */ |
|
35 | 0 | private List filesets = new ArrayList(); |
36 | ||
37 | /** The Ant project */ |
|
38 | private Project project; |
|
39 | ||
40 | public void setProject(Project project) |
|
41 | { |
|
42 | 0 | this.project = project; |
43 | 0 | } |
44 | ||
45 | public Iterator iterator() { |
|
46 | 0 | return new FileIterator(project, filesets.iterator()); |
47 | } |
|
48 | ||
49 | public Iterator directories() { |
|
50 | 0 | return new FileIterator(project, filesets.iterator(), true); |
51 | } |
|
52 | ||
53 | public boolean hasFiles() { |
|
54 | 0 | return filesets.size() > 0; |
55 | } |
|
56 | ||
57 | /** |
|
58 | * Clears any file sets that have been added to this scanner |
|
59 | */ |
|
60 | public void clear() { |
|
61 | 0 | filesets.clear(); |
62 | 0 | } |
63 | ||
64 | // Properties |
|
65 | //------------------------------------------------------------------------- |
|
66 | ||
67 | /** |
|
68 | * Adds a set of files (nested fileset attribute). |
|
69 | */ |
|
70 | public void addFileset(FileSet set) { |
|
71 | 0 | filesets.add(set); |
72 | 0 | } |
73 | ||
74 | } |
|
75 | ||
76 |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |