KickJava   Java API By Example, From Geeks To Geeks.

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


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.Iterator JavaDoc;
31 import java.util.Map JavaDoc;
32
33
34 /**
35  * This task generates OMG IDL 2.4 from the OpenCCM Interface Repository.
36  *
37  * @author <a HREF="mailto:Christophe.Demarey@lifl.fr">Christophe Demarey</a>
38  *
39  * @version 0.1
40  */

41 public class IR3toIDL2
42      extends LauncherApplication
43   implements Runnable JavaDoc
44 {
45     // ==================================================================
46
//
47
// Internal states.
48
//
49
// ==================================================================
50

51     /** The output file name. */
52     private String JavaDoc dest_file_;
53
54     /** The scope to generate. */
55     private String JavaDoc scope_;
56
57     /** List of files to include. */
58     private java.util.List JavaDoc includes_;
59
60     /** List of user files to include. */
61     private java.util.List JavaDoc user_includes_;
62
63     // ==================================================================
64
//
65
// Constructors.
66
//
67
// ==================================================================
68

69     /**
70      * The default constructor.
71      *
72      * @param project_properties - Properties of the Ant Project.
73      */

74     public IR3toIDL2(Map JavaDoc project_properties)
75     {
76         // Call CompilerBase constructor
77
super(project_properties);
78         
79         // Init internal states
80
dest_file_ = "generated.idl";
81         scope_ = null;
82         includes_ = new java.util.ArrayList JavaDoc();
83         user_includes_ = new java.util.ArrayList JavaDoc();
84     }
85     
86     // ==================================================================
87
//
88
// Internal methods.
89
//
90
// ==================================================================
91

92     // ==================================================================
93
//
94
// Public methods.
95
//
96
// ==================================================================
97

98     /**
99      * Configure the task.
100      */

101     public void
102     configure()
103     {
104         Iterator JavaDoc it = null;
105         
106         setXmlFile( project_properties_.getProperty("OpenCCM_HOMEDIR") + "/xml/launcher/IR3toIDL2.xml" );
107         addProperty( "OpenCCM_CONFIG_DIR",
108                      project_properties_.getProperty("OpenCCM_CONFIG_DIR") );
109         // Add destination file
110
addArgument("-o");
111         addArgument(dest_file_);
112         // Add include declarations
113
for (it = includes_.iterator(); it.hasNext(); )
114         {
115             addArgument("-i");
116             addArgument( (String JavaDoc) it.next() );
117         }
118         // Add user include declarations
119
for (it = user_includes_.iterator(); it.hasNext(); )
120         {
121             addArgument("-ipath");
122             addArgument( (String JavaDoc) it.next() );
123         }
124         // Add target scope
125
addArgument(scope_);
126     }
127
128     /**
129      * Set Java mapping output directory.
130      *
131      * @param outputdir - The output directory name.
132      */

133     public void
134     setDestfile(String JavaDoc filename)
135     {
136         dest_file_ = filename;
137     }
138     
139     /**
140      * Set the scope to generate.
141      *
142      * @param scope - The scope to generate.
143      */

144     public void
145     setScope(String JavaDoc scope)
146     {
147         scope_ = scope;
148     }
149     
150     /**
151      * Add an include declaration in the generated file.
152      *
153      * @param str - The declaration name to include.
154      */

155     public void
156     addConfiguredInclude(StringType str)
157     {
158         includes_.add(str.getName());
159     }
160     
161     /**
162      * Add a user include declaration in the generated file.
163      *
164      * @param str - The declaration name to include.
165      */

166     public void
167     addConfiguredUserinclude(StringType str)
168     {
169         user_includes_.add(str.getName());
170     }
171     
172 }
173
Popular Tags