KickJava   Java API By Example, From Geeks To Geeks.

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


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 java.io.File JavaDoc;
27 import java.io.IOException JavaDoc;
28 import java.util.Map JavaDoc;
29
30 import org.openide.compiler.*;
31 import org.openide.compiler.Compiler;
32 import org.openide.execution.NbProcessDescriptor;
33
34 public class XMLCCompilerGroup extends ExternalCompilerGroup {
35
36     private String JavaDoc myOpt = null; // will be set after compilers are added
37

38     public void add (Compiler JavaDoc c) throws IllegalArgumentException JavaDoc {
39         // Calling super is necessary: that picks up the file list, etc.
40
super.add (c);
41         if (! (c instanceof XMLCCompiler)) throw new IllegalArgumentException JavaDoc ();
42         XMLCCompiler comp = (XMLCCompiler) c;
43         // This will be the same value for all added compilers (if more than one),
44
// because of the correct implementation of compilerGroupKey:
45
myOpt = comp.getMyOpt ();
46     }
47
48     protected Process JavaDoc createProcess (NbProcessDescriptor desc, String JavaDoc[] files) throws IOException JavaDoc {
49         return desc.exec (new Format (files, myOpt));
50     }
51
52     public static class Format extends ExternalCompilerGroup.Format {
53
54         public static final String JavaDoc TAG_MYOPTIONVAL = "myOpt";
55
56         public Format (String JavaDoc[] files, String JavaDoc myOpt) {
57             super (files);
58             Map JavaDoc map = getMap ();
59             map.put (TAG_MYOPTIONVAL, myOpt);
60         }
61
62     }
63
64 }
65
Popular Tags