KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > diagnostics > util > DDFilter


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23 package com.sun.enterprise.diagnostics.util;
24
25 import java.io.File JavaDoc;
26
27 import java.io.FilenameFilter JavaDoc;
28 import java.io.File JavaDoc;
29 import java.io.FileReader JavaDoc;
30 import java.io.BufferedReader JavaDoc;
31 import java.io.FileNotFoundException JavaDoc;
32 import java.io.IOException JavaDoc;
33
34 import com.sun.enterprise.diagnostics.Constants;
35 import com.sun.enterprise.diagnostics.DiagnosticException;
36 /**
37  * Accepted file names are ejb-jar.xml, sun-ejb-jar.xml, web.xml, sun-web.xml,
38  * application.xml, sun-application.xml .
39  * @author Manisha Umbarje
40  */

41 public class DDFilter implements FilenameFilter JavaDoc {
42
43     private static final String JavaDoc ejb_jar = "ejb-jar.xml";
44     private static final String JavaDoc sun_ejb_jar = "sun-ejb-jar.xml";
45     private static final String JavaDoc web = "web.xml";
46     private static final String JavaDoc sun_web = "sun-web.xml";
47     private static final String JavaDoc application = "application.xml";
48     private static final String JavaDoc sun_application = "sun-application.xml";
49     private static final String JavaDoc META_INF = "META-INF";
50     private static final String JavaDoc WEB_INF = "WEB-INF";
51
52     public boolean accept (File JavaDoc aDir, String JavaDoc fileName) {
53             
54             if (fileName.matches(ejb_jar) ||
55                     fileName.matches(sun_ejb_jar) ||
56                     fileName.matches(web) ||
57                     fileName.matches(sun_web)||
58                     fileName.matches(application) ||
59                     fileName.matches(sun_application)) {
60                 return true;
61             }
62             else
63                 return false;
64     }
65 }
Popular Tags