KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > generator > java > core > api > JavaTranslator


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): Mathieu Vadet, Christophe Demarey.
23 Contributor(s): _________________________________.
24
25 ====================================================================*/

26
27 package org.objectweb.openccm.generator.java.core.api;
28
29 /** To access all the AST Declaration. */
30 import org.objectweb.openccm.ast.api.Declaration;
31
32 /** To use GenerationException. */
33 import org.objectweb.openccm.generator.common.lib.GenerationException;
34
35
36
37 /**
38  * Utility interface for Java mapping.
39  *
40  * @author <a HREF="mailto:Mathieu.Vadet@lifl.fr">Mathieu Vadet</a>
41  * @author <a HREF="mailto:Christophe.Demarey@lifl.fr">Christophe Demarey</a>
42  *
43  * @version 0.4
44  */

45
46 public interface JavaTranslator
47 {
48     /**
49      * Translate a TypeRef into its java mapping.
50      *
51      * @param typeref - The TypeRef to translate.
52      *
53      * @return The resulting mapping.
54      **/

55     public java.lang.String JavaDoc
56     toJava(org.objectweb.openccm.ast.api.TypeRef typeref);
57
58     /**
59      * Translate a PsdlTypeRef into its java mapping.
60      *
61      * @param type - The PsdlTypeRef to translate.
62      *
63      * @return The resulting mapping.
64      **/

65     public java.lang.String JavaDoc
66     toJava(org.objectweb.openccm.ast.api.PsdlTypeRef type);
67
68     /**
69      * Translate a parameter into its java mapping.
70      *
71      * @param typeref - The TypeRef to translate.
72      * @param mode - The parameter mode (in, out or inout).
73      *
74      * @return The resulting mapping.
75      **/

76     public java.lang.String JavaDoc
77     toJava(org.objectweb.openccm.ast.api.TypeRef type,
78            int mode);
79
80     /**
81      * Translate a psdl parameter into its java mapping.
82      *
83      * @param type - The PsdlTypeRef to translate.
84      * @param mode - The parameter mode (in, out or inout).
85      *
86      * @return The resulting mapping.
87      **/

88     public java.lang.String JavaDoc
89     toJava(org.objectweb.openccm.ast.api.PsdlTypeRef type,
90            int mode);
91
92     /**
93      * Translate a psdl reference into its java mapping,
94      * i.e. ref<A> => A.
95      *
96      * @param type - The PsdlTypeRef to translate.
97      *
98      * @return The resulting mapping.
99      **/

100     public java.lang.String JavaDoc
101     RefToJava(org.objectweb.openccm.ast.api.PsdlTypeRef type);
102     
103     /**
104      * Check if id is a java keyword.
105      *
106      * @param id - The string to check
107      *
108      * @return A valid string.
109      **/

110     public java.lang.String JavaDoc
111     checkKeywords(java.lang.String JavaDoc id);
112
113     /**
114      * Get the java absolute name of a declaration
115      * ( i.e. package.decl_name ).
116      *
117      * @param decl - The declaration to translate
118      *
119      * @return The java absolute name.
120      **/

121     public java.lang.String JavaDoc
122     getAbsoluteName(Declaration decl);
123
124     /**
125      * Get the package of a declaration.
126      *
127      * @param decl - The declaration to translate
128      *
129      * @return The java package name.
130      **/

131     public java.lang.String JavaDoc
132     getPackage(Declaration decl);
133
134     /**
135      * Get the java path of a declaration.
136      * This don't include the declaration's java name.
137      * The package name is translated to a path.
138      *
139      * @param decl - The declaration to translate
140      *
141      * @return The java package name.
142      **/

143     public String JavaDoc
144     getAsDirectory(String JavaDoc package_name);
145
146     /**
147      * Get the java path of a declaration.
148      * This don't include the declaration's java name.
149      * The package name is translated to a path.
150      *
151      * @param decl - The declaration to translate
152      *
153      * @return The java package name.
154      **/

155     public java.lang.String JavaDoc
156     getAsDirectory(Declaration decl);
157
158     /**
159      * Get the null value for an IDL3 TypeRef
160      *
161      * @param typeref - The TypeRef to translate.
162      *
163      * @return The null value for this typeref.
164      **/

165     public java.lang.String JavaDoc
166     nullValue(org.objectweb.openccm.ast.api.TypeRef typeref);
167
168     /**
169      * Create directories for a given path,
170      * including any necessary but nonexistent parent directories.
171      *
172      * @param dir - A directory.
173      **/

174     public void
175     mkdir(java.io.File JavaDoc dir)
176     throws GenerationException;
177
178     /**
179      * Create directories for a given path,
180      * including any necessary but nonexistent parent directories.
181      *
182      * @param dir_name - A pathname string.
183      *
184      * @return The corresponding File.
185      **/

186     public java.io.File JavaDoc
187     mkdir(String JavaDoc dir_name)
188     throws GenerationException;
189 }
190
Popular Tags