KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > task > CompilerBase


1 /*====================================================================
2
3 OpenCCM: The Open CORBA Component Model Platform
4 Copyright (C) 2000-2004 INRIA & USTL - LIFL - GOAL
5 Contact: openccm@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): Christophe Demarey.
23 Contributor(s): ________________________________________.
24
25 ====================================================================*/

26
27 package org.objectweb.openccm.task;
28
29 //Package dependencies
30
import java.util.Map JavaDoc;
31
32 /**
33  * This is a base class for Compiler applications.
34  *
35  * @author <a HREF="mailto:Christophe.Demarey@lifl.fr">Christophe Demarey</a>
36  *
37  * @version 0.1
38  */

39 public class CompilerBase
40      extends LauncherApplication
41 {
42     // ==================================================================
43
//
44
// Internal states.
45
//
46
// ==================================================================
47

48     /** The file to feed. */
49     protected String JavaDoc file_;
50
51     /** Flag to include OMG IDL3 macro or not. */
52     private boolean idl3_macro_;
53     
54     /** To manage CPP options. */
55     private CPPoptions cpp_options_;
56
57     // ==================================================================
58
//
59
// Constructors.
60
//
61
// ==================================================================
62

63     /**
64      * The default constructor.
65      *
66      * @param project_properties - Properties of the Ant Project.
67      */

68     public CompilerBase(Map JavaDoc project_properties)
69     {
70         // Call Launcher constructor
71
super(project_properties);
72         
73         // Init internal states
74
file_ = null;
75         idl3_macro_ = true;
76         cpp_options_ = null;
77     }
78     
79     // ==================================================================
80
//
81
// Internal methods.
82
//
83
// ==================================================================
84

85     // ==================================================================
86
//
87
// Public methods.
88
//
89
// ==================================================================
90

91     /**
92      * Disable the -D__OMG_IDL_3__ macro.
93      */

94     public void
95     disableIDL3macro()
96     {
97         idl3_macro_ = false;
98     }
99     
100     /**
101      * Configure the task with compiler options.
102      */

103     public void
104     compiler_configure()
105     {
106         if (idl3_macro_)
107         {
108             addProperty("__OMG_IDL_3__", "");
109         }
110         if (cpp_options_ != null)
111         {
112             addArgument( cpp_options_.getCPParguments() );
113         }
114     }
115     
116     /**
117      * Configure the task.
118      */

119     public void
120     configure()
121     {
122         compiler_configure();
123         addArgument(file_);
124         addProperty( "OpenCCM_CONFIG_DIR",
125                      project_properties_.getProperty("OpenCCM_CONFIG_DIR") );
126     }
127     
128     /**
129      * Set the name of the file to feed.
130      *
131      * @param file - The file to feed.
132      */

133     public void
134     setFile(String JavaDoc file)
135     {
136         this.file_ = file;
137     }
138
139     /**
140      * Create an inner element for PreProcessor Options.
141      */

142     public CPPoptions
143     createCpp()
144     {
145         cpp_options_ = new CPPoptions();
146         return cpp_options_;
147     }
148
149 }
150
Popular Tags