KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > bull > eclipse > jonas > JonasProjectZipper


1 package com.bull.eclipse.jonas;
2
3 import java.io.File JavaDoc;
4 import java.io.IOException JavaDoc;
5 import java.util.StringTokenizer JavaDoc;
6
7 import com.bull.eclipse.jonas.utils.Zipper;
8
9 public class JonasProjectZipper extends Zipper {
10
11     private boolean acceptSource = false;
12     
13     /**
14      * Constructor for JonasProjectZipper.
15      * @param outputFile
16      * @param directory
17      * @throws IOException
18      */

19     public JonasProjectZipper(File JavaDoc outputFile, File JavaDoc directory, boolean acceptSource, ExtraResourcesEntries extraList)
20         throws IOException JavaDoc {
21             super(outputFile, directory, extraList);
22             this.acceptSource = acceptSource;
23     }
24
25     /*
26      * @see Zipper#acceptDir(File)
27      */

28     protected boolean acceptDir(File JavaDoc dir) {
29
30         if (dir.getName().equals("jsp")) {
31             if(dir.getParentFile().getName().equals("apache")) {
32                 if(dir.getParentFile().getParentFile().getName().equals("org")) {
33                     return false;
34                 }
35             }
36         }
37
38         
39         String JavaDoc excludeString = JonasPluginResources.PROJECT_WAREXPORT_EXCLUDE_DIRECTORIES;
40         StringTokenizer JavaDoc tokenizer = new StringTokenizer JavaDoc(excludeString, ";");
41         while (tokenizer.hasMoreTokens()) {
42             String JavaDoc eachDir = tokenizer.nextToken();
43             if (dir.getName().equals(eachDir)) {
44                 return false;
45             }
46         }
47             
48         return true;
49     }
50
51     /*
52      * @see Zipper#acceptFile(File)
53      */

54     protected boolean acceptFile(File JavaDoc file) {
55                 
56         if (file.getName().endsWith(".java")) {
57             return acceptSource;
58         }
59         
60         String JavaDoc excludeString = JonasPluginResources.PROJECT_WAREXPORT_EXCLUDE_FILES;
61         StringTokenizer JavaDoc tokenizer = new StringTokenizer JavaDoc(excludeString, ";");
62         while (tokenizer.hasMoreTokens()) {
63             if (file.getName().equals(tokenizer.nextToken())) {
64                 return false;
65             }
66         }
67                         
68         return true;
69     }
70
71 }
72
Popular Tags