KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > omg > lifl > eclipse > plugin > project > OpenCCM > utils > BuildPropertySet


1 /*====================================================================
2
3 OpenCCM: The Open CORBA Component Model Platform
4 Copyright (C) 2000-2003 USTL - LIFL - GOAL
5 Contact: openccm-team@objectweb.org
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 USA
21
22 Initial developer(s): offroy ________________________.
23 Contributor(s): ______________________________________.
24
25 ====================================================================*/

26
27 package org.omg.lifl.eclipse.plugin.project.OpenCCM.utils;
28
29 import java.util.Iterator JavaDoc;
30
31 import org.apache.tools.ant.types.FilterSet;
32 import org.omg.lifl.eclipse.plugin.project.OpenCCM.ProjectCreationWizardPage;
33
34 /**
35  * This class ...
36  *
37  * @author offroy@lifl.fr
38  *
39  * @version 0.1
40  */

41 public class BuildPropertySet {
42     private String JavaDoc ORBName;
43     private String JavaDoc importPath;
44     private String JavaDoc orbPath;
45     private String JavaDoc installOpenCCM;
46     private String JavaDoc transactionPath;
47     private String JavaDoc transactionJar;
48     private String JavaDoc nsPath;
49     private String JavaDoc cppPath;
50     private String JavaDoc javaccPath;
51     // TODO make a Class for CompilOption
52
private String JavaDoc compilOptionDebug;
53     private String JavaDoc compilOptionDeprecated;
54     private String JavaDoc compilOptionOptimize;
55
56     private static final String JavaDoc undefined = "unused";
57
58     public BuildPropertySet(ProjectCreationWizardPage page) {
59         // get all needed properties for creating build.properties OpenCCM config file
60
if (page.getCvsFSchooser().getCheckGroup().isSubGroupVisible())
61             importPath = page.getCvsFSchooser().get_CVSsrcFSPathValue();
62         if (page.getOpenccmConfigChooser().get_ORBpreference().isEnable())
63             orbPath =
64                 page.getOpenccmConfigChooser().get_ORBpreference().get_Name();
65         ORBName = page.getOpenccmConfigChooser().get_ORBName();
66         if (page.getOpenccmConfigChooser().get_InstallOpenCCM().isEnable())
67             installOpenCCM =
68                 page.getOpenccmConfigChooser().get_InstallOpenCCM().get_Name();
69         if (page
70             .getOpenccmConfigChooser()
71             .get_TransactionpreferenceHome()
72             .isEnable())
73             transactionPath =
74                 page
75                     .getOpenccmConfigChooser()
76                     .get_TransactionpreferenceHome()
77                     .get_Name();
78         if (page
79             .getOpenccmConfigChooser()
80             .get_TransactionpreferenceJar()
81             .isEnable())
82             transactionJar =
83                 page
84                     .getOpenccmConfigChooser()
85                     .get_TransactionpreferenceJar()
86                     .get_Name();
87         if (page.getOpenccmConfigChooser().get_NSDirPreference().isEnable())
88             nsPath =
89                 page.getOpenccmConfigChooser().get_NSDirPreference().get_Name();
90         if (page
91             .getOpenccmConfigChooser()
92             .get_PreprocessorPreference()
93             .isEnable())
94             cppPath =
95                 page
96                     .getOpenccmConfigChooser()
97                     .get_PreprocessorPreference()
98                     .get_Name();
99         if (page.getOpenccmConfigChooser().get_JavaccPreference().isEnable())
100             javaccPath =
101                 page
102                     .getOpenccmConfigChooser()
103                     .get_JavaccPreference()
104                     .get_Name();
105         if (page
106             .getOpenccmConfigChooser()
107             .get_CompilationOptionDebugPreference()
108             .isEnable())
109             compilOptionDebug =
110                 page
111                     .getOpenccmConfigChooser()
112                     .get_CompilationOptionDebugPreference()
113                     .get_Name();
114         if (page
115             .getOpenccmConfigChooser()
116             .get_CompilationOptionDeprecationPreference()
117             .isEnable())
118             compilOptionDeprecated =
119                 page
120                     .getOpenccmConfigChooser()
121                     .get_CompilationOptionDeprecationPreference()
122                     .get_Name();
123         if (page
124             .getOpenccmConfigChooser()
125             .get_CompilationOptionOptimizePreference()
126             .isEnable())
127             compilOptionOptimize =
128                 page
129                     .getOpenccmConfigChooser()
130                     .get_CompilationOptionOptimizePreference()
131                     .get_Name();
132     }
133
134     public void createFilter(
135         FilterSet fs,
136         String JavaDoc tagTab[],
137         String JavaDoc value[]) {
138         TagGroup tag = new TagGroup(tagTab, value);
139         Iterator JavaDoc it = tag.getTheTags().keySet().iterator();
140         while (it.hasNext()) {
141             String JavaDoc key = (String JavaDoc) it.next();
142             fs.addFilter(key, (String JavaDoc) tag.getTheTags().get(key));
143         }
144     }
145
146     
147
148     /**
149      * @param fs
150      */

151     public void createOpenCCMFilter(FilterSet fs) {
152         // set the structure of build.properties file for Ant copy replacement
153
String JavaDoc tagTab[] =
154             {
155                 "ORB.NAME",
156                 "INSTALL.OPENCCM.DIR",
157                 "ORB.HOME.DIR",
158                 "NS.HOME.DIR",
159                 "OTS.HOME.DIR",
160                 "OTS.JAR",
161                 "CPP.COMPILER",
162                 "JAVACC.DIR",
163                 "BUILD.DEBUG",
164                 "BUILD.DEPRECATION",
165                 "BUILD.OPTIMIZE" };
166         String JavaDoc value[] =
167             {
168                 getValue(this.getORBName()),
169                 getValue(this.getInstallOpenCCM()),
170                 getValue(this.getOrbPAth()),
171                 getValue(this.getNsPath()),
172                 getValue(this.getTransactionPath()),
173                 getValue(this.getTransactionJar()),
174                 getValue(this.getCppPath()),
175                 getValue(this.getJavaccPath()),
176                 getValue(this.getCompilOptionDebug()),
177                 getValue(this.getCompilOptionDeprecated()),
178                 getValue(this.getCompilOptionOptimize())};
179
180         createFilter(fs,tagTab,value);
181     }
182
183     /**
184      * @param fs
185      */

186     public void createClasspathFilter(FilterSet fs) {
187         // set the structure of classpath file for Ant copy replacement
188
String JavaDoc tagTab[] =
189             {
190                 "ORB.HOME.DIR",
191                 "NS.HOME.DIR",
192                 "OTS.HOME.DIR",
193                 "OTS.JAR",
194                 "JAVACC.DIR"};
195         String JavaDoc value[] =
196             {
197                 getValue(this.getOrbPAth()),
198                 getValue(this.getNsPath()),
199                 getValue(this.getTransactionPath()),
200                 getValue(this.getTransactionJar()),
201                 getValue(this.getJavaccPath())};
202
203         createFilter(fs,tagTab,value);
204     }
205
206     /**
207      * @param show
208      * @return a string representing the BuildPropertySet state
209      */

210     public String JavaDoc showDebug(boolean show) {
211         if (show) {
212             return "generate build.properties with this parameter :\n"
213                 + "import :"
214                 + getValue(this.getImportPath())
215                 + "\n"
216                 + "ORB directory :"
217                 + getValue(this.getOrbPAth())
218                 + "\n"
219                 + "OpenCCM install dir :"
220                 + getValue(this.getInstallOpenCCM())
221                 + "\n"
222                 + "Transaction directory :"
223                 + getValue(this.getTransactionPath())
224                 + "\n"
225                 + "Transaction Jar dir :"
226                 + getValue(this.getTransactionJar())
227                 + "\n"
228                 + "NS home directory :"
229                 + getValue(this.getNsPath())
230                 + "\n"
231                 + "CPP directory :"
232                 + getValue(this.getCppPath())
233                 + "\n"
234                 + "JavaCC home dir :"
235                 + getValue(this.getJavaccPath())
236                 + "\n"
237                 + "Compil Opt Debug :"
238                 + getValue(this.getCompilOptionDebug())
239                 + "\n"
240                 + "Compil Opt Deprecated :"
241                 + getValue(this.getCompilOptionDeprecated())
242                 + "\n"
243                 + "Compil Opt Optimize :"
244                 + getValue(this.getCompilOptionOptimize());
245         } else
246             return "don't generate build.properties";
247     }
248
249     /**
250      * @param value
251      */

252     private String JavaDoc getValue(String JavaDoc value) {
253         return ((value != null && value.compareTo("") != 0) ? value : "unused");
254     }
255
256     /**
257      * @return
258      */

259     public String JavaDoc getCompilOptionDebug() {
260         return compilOptionDebug;
261     }
262
263     /**
264      * @return
265      */

266     public String JavaDoc getCompilOptionDeprecated() {
267         return compilOptionDeprecated;
268     }
269
270     /**
271      * @return
272      */

273     public String JavaDoc getCompilOptionOptimize() {
274         return compilOptionOptimize;
275     }
276
277     /**
278      * @return
279      */

280     public String JavaDoc getCppPath() {
281         return cppPath;
282     }
283
284     /**
285      * @return
286      */

287     public String JavaDoc getImportPath() {
288         return importPath;
289     }
290
291     /**
292      * @return
293      */

294     public String JavaDoc getJavaccPath() {
295         return javaccPath;
296     }
297
298     /**
299      * @return
300      */

301     public String JavaDoc getNsPath() {
302         return nsPath;
303     }
304
305     /**
306      * @return
307      */

308     public String JavaDoc getOrbPAth() {
309         return orbPath;
310     }
311
312     /**
313      * @return
314      */

315     public String JavaDoc getTransactionJar() {
316         return transactionJar;
317     }
318
319     /**
320      * @return
321      */

322     public String JavaDoc getTransactionPath() {
323         return transactionPath;
324     }
325
326     /**
327      * @param string
328      */

329     public void setCompilOptionDebug(String JavaDoc string) {
330         compilOptionDebug = string;
331     }
332
333     /**
334      * @param string
335      */

336     public void setCompilOptionDeprecated(String JavaDoc string) {
337         compilOptionDeprecated = string;
338     }
339
340     /**
341      * @param string
342      */

343     public void setCompilOptionOptimize(String JavaDoc string) {
344         compilOptionOptimize = string;
345     }
346
347     /**
348      * @param string
349      */

350     public void setCppPath(String JavaDoc string) {
351         cppPath = string;
352     }
353
354     /**
355      * @param string
356      */

357     public void setImportPath(String JavaDoc string) {
358         importPath = string;
359     }
360
361     /**
362      * @param string
363      */

364     public void setJavaccPath(String JavaDoc string) {
365         javaccPath = string;
366     }
367
368     /**
369      * @param string
370      */

371     public void setNsPath(String JavaDoc string) {
372         nsPath = string;
373     }
374
375     /**
376      * @param string
377      */

378     public void setOrbPAth(String JavaDoc string) {
379         orbPath = string;
380     }
381
382     /**
383      * @param string
384      */

385     public void setTransactionJar(String JavaDoc string) {
386         transactionJar = string;
387     }
388
389     /**
390      * @param string
391      */

392     public void setTransactionPath(String JavaDoc string) {
393         transactionPath = string;
394     }
395
396     /**
397      * @return
398      */

399     public String JavaDoc getInstallOpenCCM() {
400         return installOpenCCM;
401     }
402
403     /**
404      * @param string
405      */

406     public void setInstallOpenCCM(String JavaDoc string) {
407         installOpenCCM = string;
408     }
409
410     /**
411      * @return
412      */

413     public String JavaDoc getORBName() {
414         return ORBName;
415     }
416
417     /**
418      * @param string
419      */

420     public void setORBName(String JavaDoc string) {
421         ORBName = string;
422     }
423
424 }
425
Popular Tags