KickJava   Java API By Example, From Geeks To Geeks.

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


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 IDL3 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 IR3toIDL3
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 IR Objects to import. */
58     private java.util.List JavaDoc imports_;
59
60     // ==================================================================
61
//
62
// Constructors.
63
//
64
// ==================================================================
65

66     /**
67      * The default constructor.
68      *
69      * @param project_properties - Properties of the Ant Project.
70      */

71     public IR3toIDL3(Map JavaDoc project_properties)
72     {
73         // Call CompilerBase constructor
74
super(project_properties);
75         
76         // Init internal state
77
dest_file_ = "generated.idl3";
78         scope_ = null;
79         imports_ = new java.util.ArrayList JavaDoc();
80     }
81     
82     // ==================================================================
83
//
84
// Internal methods.
85
//
86
// ==================================================================
87

88     // ==================================================================
89
//
90
// Public methods.
91
//
92
// ==================================================================
93

94     /**
95      * Configure the task.
96      */

97     public void
98     configure()
99     {
100         Iterator JavaDoc it = null;
101         
102         setXmlFile( project_properties_.getProperty("OpenCCM_HOMEDIR") + "/xml/launcher/IR3toIDL3.xml" );
103         addProperty( "OpenCCM_CONFIG_DIR",
104                      project_properties_.getProperty("OpenCCM_CONFIG_DIR") );
105         // Add destination file
106
addArgument("-o");
107         addArgument(dest_file_);
108         // Add import declarations
109
for (it = imports_.iterator(); it.hasNext(); )
110         {
111             addArgument("-i");
112             addArgument( (String JavaDoc) it.next() );
113         }
114         // Add target scope
115
addArgument(scope_);
116     }
117
118     /**
119      * Set Java mapping output directory.
120      *
121      * @param outputdir - The output directory name.
122      */

123     public void
124     setDestfile(String JavaDoc filename)
125     {
126         dest_file_ = filename;
127     }
128     
129     /**
130      * Set the scope to generate.
131      *
132      * @param scope - The scope to generate.
133      */

134     public void
135     setScope(String JavaDoc scope)
136     {
137         scope_ = scope;
138     }
139     
140     /**
141      * Add an import declaration in the generated file.
142      *
143      * @param str - The declaration name to import.
144      */

145     public void
146     addConfiguredImport(StringType str)
147     {
148         imports_.add(str.getName());
149     }
150     
151 }
152
Popular Tags