KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > ast > lib > NativeDeclImpl


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

26
27 package org.objectweb.openccm.ast.lib;
28
29 /** Used to access AST TypeKind. */
30 import org.objectweb.openccm.ast.api.TypeKind;
31
32 /** Used to access AST DeclarationKind. */
33 import org.objectweb.openccm.ast.api.DeclarationKind;
34
35 /** To use CORBA::NativeDef. */
36 import org.omg.CORBA.NativeDef JavaDoc;
37 import org.omg.CORBA.NativeDefHelper;
38
39 /**
40  * NativeDeclImpl is a wrapper class for IDL native declarations.
41  *
42  * Inherits from:
43  * - DeclarationImpl as natives are IDL declarations.
44  *
45  * @author <a HREF="mailto:Philippe.Merle@lifl.fr">Philippe Merle</a>
46  * <a HREF="mailto:Mathieu.Vadet@lifl.fr">Mathieu Vadet</a>
47  *
48  * @version 0.3
49  */

50
51 public class NativeDeclImpl
52        extends DeclarationImpl
53        implements org.objectweb.openccm.ast.api.NativeDecl,
54                   IDLTypeWrapper
55 {
56     // ==================================================================
57
//
58
// Internal state.
59
//
60
// ==================================================================
61

62     /** Reference to the CORBA 3.0 NativeDef. */
63     private NativeDef JavaDoc native_def_;
64
65     // ==================================================================
66
//
67
// Constructor.
68
//
69
// ==================================================================
70

71     /**
72      * The constructor with the parent scope.
73      *
74      * @param rep The repository of the declaration.
75      * @param parent The parent scope of the native declaration.
76      */

77     protected
78     NativeDeclImpl(Repository rep,
79                    ScopeImpl parent)
80     {
81         // Call the DeclarationImpl constructor.
82
super(rep, parent);
83
84         // Init internal state.
85
native_def_ = null;
86     }
87
88     // ==================================================================
89
//
90
// Internal methods.
91
//
92
// ==================================================================
93

94     // ==================================================================
95
//
96
// Internal methods for DeclarationImpl.
97
//
98
// ==================================================================
99

100     /**
101      * Loads infos of the CORBA 3.0 NativeDef.
102      *
103      * @param contained The NativeDef to load.
104      */

105     protected void
106     load(org.omg.CORBA.Contained JavaDoc contained)
107     {
108         native_def_ = NativeDefHelper.narrow(contained);
109         super.load(contained);
110     }
111
112     /**
113      * Loads infos of the CORBA 3.0 NativeDef.
114      *
115      * @param contained The NativeDef to load.
116      */

117     protected void
118     loadAsMapping(org.omg.CORBA.Contained JavaDoc contained)
119     {
120         native_def_ = NativeDefHelper.narrow(contained);
121         super.loadAsMapping(contained);
122     }
123
124     /**
125      * Obtain its CORBA 3.0 Contained reference.
126      *
127      * @return The Contained object associated with the native declaration.
128      */

129     protected org.omg.CORBA.Contained JavaDoc
130     getContained()
131     {
132        return native_def_;
133     }
134
135     // ==================================================================
136
//
137
// Public methods.
138
//
139
// ==================================================================
140

141     // ==================================================================
142
//
143
// Methods for OMG IDL org.objectweb.openccm.ast.api.WithDependencies
144
//
145
// ==================================================================
146

147     // ==================================================================
148
//
149
// Methods for OMG IDL org.objectweb.openccm.ast.api.Declaration
150
//
151
// ==================================================================
152

153     /**
154      * Obtain its DeclarationKind.
155      *
156      * @return The DeclarationKind of the object.
157      */

158     public long
159     getDeclKind()
160     {
161         return DeclarationKind.dk_native;
162     }
163
164     /**
165      * Create the native declaration into the IFR.
166      */

167     public void
168     create()
169     {
170         // Create a NativeDef into the IFR.
171
native_def_ = the_parent_.getContainer().
172                       create_native(getId(), getName(), getVersion());
173
174         super.create();
175     }
176
177     // ==================================================================
178
//
179
// Methods for OMG IDL org.objectweb.openccm.ast.api.TypeRef
180
//
181
// ==================================================================
182

183     /**
184      * Obtain its associated TypeKind.
185      *
186      * @return The associated TypeKind.
187      */

188     public TypeKind
189     getTypeKind()
190     {
191         return TypeKind.tk_native;
192     }
193
194     // ==================================================================
195
//
196
// Methods for OMG IDL org.objectweb.openccm.ast.api.NativeDecl
197
//
198
// ==================================================================
199

200     /**
201      * Set its IDLType reference.
202      *
203      * @param def - The IDLType associated with the type reference.
204      */

205     public void
206     setIDLType(NativeDef JavaDoc def)
207     {
208         native_def_ = def;
209     }
210
211     // ==================================================================
212
//
213
// Methods for interface IDLTypeWrapper
214
//
215
// ==================================================================
216

217     /**
218      * Obtain its IDLType reference.
219      *
220      * @return The IDLType associated with the type reference.
221      */

222     public org.omg.CORBA.IDLType JavaDoc
223     getIDLType()
224     {
225         return native_def_;
226     }
227 }
228
Popular Tags