KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > lenya > cms > ant > SCMFilenameFilter


1 /*
2  * Copyright 1999-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  */

17
18 /* $Id: SCMFilenameFilter.java 43065 2004-06-01 15:47:05Z andreas $ */
19
20 package org.apache.lenya.cms.ant;
21
22 import java.io.File JavaDoc;
23 import java.io.FilenameFilter JavaDoc;
24 import java.util.Arrays JavaDoc;
25 import java.util.List JavaDoc;
26
27 /**
28  * Filter to exclude SCM files, such as CVS and .svn.
29  * A set of filenames (provided as comma-separated list) is excluded.
30  */

31 public class SCMFilenameFilter implements FilenameFilter JavaDoc {
32     
33     private List JavaDoc excludes;
34
35     /**
36      * Ctor.
37      * @param excludes A comma-separated list of file names, e.g. CVS,.svn
38      */

39     public SCMFilenameFilter(String JavaDoc excludes) {
40         this.excludes = Arrays.asList(excludes.split(","));
41     }
42
43     /**
44      * (non-Javadoc)
45      * @see java.io.FilenameFilter#accept(java.io.File, java.lang.String)
46      */

47     public boolean accept(File JavaDoc dir, String JavaDoc name) {
48         return !this.excludes.contains(name);
49     }
50 }
51
Popular Tags