KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > kelp > forte > services > XMLCCleanCompiler


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  * Contributor(s):
20  * Lisa Reese
21  *
22  */

23
24 package org.enhydra.kelp.forte.services;
25
26 import org.openide.compiler.*;
27 import org.openide.compiler.Compiler;
28 import org.openide.filesystems.*;
29
30 /** Cleans up after an external compiler.
31  *
32  * @author rees0234
33  */

34 public class XMLCCleanCompiler extends Compiler JavaDoc {
35
36     private FileObject fo;
37
38     public XMLCCleanCompiler(FileObject fo)
39 {
40         this.fo = fo;
41     }
42
43     // This is important to write correctly!
44
public boolean equals (Object JavaDoc o) {
45         if (! (o instanceof XMLCCleanCompiler)) return false;
46         XMLCCleanCompiler other = (XMLCCleanCompiler) o;
47         // Add any other equality comparisons you may need,
48
// according to the instance variables:
49
try {
50         return fo.getFileSystem ().getSystemName ().equals (other.fo.getFileSystem ().getSystemName ()) &&
51         fo.getPackageNameExt ('/', '.').equals (other.fo.getPackageNameExt ('/', '.'));
52     } catch (FileStateInvalidException fsie) {
53         if (Boolean.getBoolean ("netbeans.debug.exceptions"))
54         fsie.printStackTrace ();
55         return false;
56     }
57     }
58
59     // Also, this must be the same for equal compilers!
60
public int hashCode () {
61         return 1234 ^ fo.getPackageNameExt ('/', '.').hashCode ();
62     }
63
64     /*
65     // Only needed if you wish to automatically break apart
66     // these compilers into different groups:
67     public Object compilerGroupKey () {
68     List l = new ArrayList (2);
69     l.add (super.compilerGroupKey ());
70     l.add (someThingUniqueToMe);
71     return l;
72     }
73     */

74
75     public Class JavaDoc compilerGroupClass () {
76         return XMLCCleanCompilerGroup.class;
77     }
78
79     public boolean isUpToDate () {
80         // Just check if there is anything to clean.
81
return FileUtil.findBrother (fo, "compiledExt") == null;
82     }
83
84     // For use by the compiler group:
85
public FileObject getFileObject () {
86         return fo;
87     }
88
89 }
90
Popular Tags