KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > ccm > IDL3 > LocalInterfaceDeclImpl


1 /*====================================================================
2
3 OpenCCM: The Open CORBA Component Model Platform
4 Copyright (C) 2000-2002 USTL - LIFL - GOAL
5 Contact: openccm-team@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): ______________________________________.
24
25 ====================================================================*/

26
27 package org.objectweb.ccm.IDL3;
28
29 /**
30  * This class manages IDL local interface declarations.
31  *
32  * @author <a=href="Philippe.Merle@lifl.fr">Philippe Merle</a>
33  * <a=href="Mathieu.Vadet@lifl.fr">Mathieu Vadet</a>
34  *
35  * @version 0.3
36  */

37
38 public class LocalInterfaceDeclImpl
39        extends InterfaceDeclImpl
40        implements LocalInterfaceRef, LocalInterfaceDecl
41 {
42     // ==================================================================
43
//
44
// Internal state.
45
//
46
// ==================================================================
47

48     /**
49      ** Reference to the CORBA 3.0 LocalInterfaceDef.
50      **/

51     private org.omg.CORBA.ExtLocalInterfaceDef ext_local_interface_def_;
52
53     // ==================================================================
54
//
55
// Constructor.
56
//
57
// ==================================================================
58

59     /**
60      ** The constructor with the parent scope.
61      **
62      ** @param parent The parent scope of the local interface declaration.
63      **/

64     protected
65     LocalInterfaceDeclImpl(Repository rep, ScopeImpl parent)
66     {
67         // Call the InterfaceDefImpl constructor.
68
super(rep, parent);
69
70         // Init internal state.
71
ext_local_interface_def_ = null;
72         the_declaration_kind_ = DeclarationKind._dk_local_interface;
73     }
74
75     // ==================================================================
76
//
77
// Internal methods.
78
//
79
// ==================================================================
80

81     /**
82      ** Loads infos of the CORBA 3.0 InterfaceDef.
83      **
84      ** @param interfaceDef The InterfaceDef to load.
85      **/

86     protected void
87     load(org.omg.CORBA.Contained JavaDoc contained)
88     {
89         ext_local_interface_def_ = org.omg.CORBA.ExtLocalInterfaceDefHelper.narrow(contained);
90         super.load(contained);
91     }
92
93     /**
94      ** Loads infos of the CORBA 3.0 InterfaceDef.
95      **
96      ** @param interfaceDef The InterfaceDef to load.
97      **/

98     protected void
99     loadAsMapping(org.omg.CORBA.Contained JavaDoc contained)
100     {
101         ext_local_interface_def_ = org.omg.CORBA.ExtLocalInterfaceDefHelper.narrow(contained);
102         super.loadAsMapping(contained);
103     }
104
105     // ==================================================================
106
//
107
// Methods for the TypeRef interface.
108
//
109
// ==================================================================
110

111     /**
112      ** Obtain its IDLType reference.
113      **
114      ** @return The IDLType associated with the local interface declaration.
115      **/

116     public org.omg.CORBA.IDLType JavaDoc
117     getIDLType()
118     {
119         return ext_local_interface_def_;
120     }
121
122     /**
123      **
124      **/

125     public int
126     getTypeKind()
127     {
128         return TypeKind._tk_local_interface;
129     }
130
131     // ==================================================================
132
//
133
// Methods for the InterfaceRef interface.
134
//
135
// ==================================================================
136

137     /**
138      ** Obtain its InterfaceDef reference.
139      **
140      ** @return The InterfaceDef associated with
141      ** the local interface declaration.
142      **/

143     public org.omg.CORBA.ExtInterfaceDef
144     getExtInterfaceDef()
145     {
146         return ext_local_interface_def_;
147     }
148
149     /**
150      ** Obtain its InterfaceDef reference.
151      **
152      ** @return The InterfaceDef associated with
153      ** the local interface declaration.
154      **/

155     public org.omg.CORBA.InterfaceDef JavaDoc
156     getInterfaceDef()
157     {
158         return ext_local_interface_def_;
159     }
160
161     // ==================================================================
162
//
163
// Methods for the InterfaceDecl interface.
164
//
165
// ==================================================================
166

167     /**
168      ** Add an interface.
169      **
170      ** @param itf The base interface to add.
171      **/

172 /*
173  * same pb as with abstract interface
174  *
175     public void
176     addInterface(InterfaceRef itf)
177     {
178         if(itf != null)
179         {
180             inherited_interfaces_.addElement(
181                  ((LocalInterfaceRef)itf)
182             );
183     }
184  */

185
186     // ==================================================================
187
//
188
// Methods for the LocalInterfaceRef interface.
189
//
190
// ==================================================================
191

192     /**
193      ** Obtain its LocalInterfaceDef reference.
194      **
195      ** @return The LocalInterfaceDef associated with the local
196      ** interface declaration.
197      **/

198     public org.omg.CORBA.ExtLocalInterfaceDef
199     getExtLocalInterfaceDef()
200     {
201         return ext_local_interface_def_;
202     }
203
204     /**
205      ** Obtain its LocalInterfaceDef reference.
206      **
207      ** @return The LocalInterfaceDef associated with the local
208      ** interface declaration.
209      **/

210     public org.omg.CORBA.LocalInterfaceDef
211     getLocalInterfaceDef()
212     {
213         return ext_local_interface_def_;
214     }
215
216     // ==================================================================
217
//
218
// Methods for the inherited DeclarationImpl class.
219
//
220
// ==================================================================
221

222     /**
223      ** Obtain its CORBA 3.0 Contained reference.
224      **
225      ** @return The Contained object associated with the local
226      ** interface declaration.
227      **/

228     protected org.omg.CORBA.Contained JavaDoc
229     getContained()
230     {
231        return ext_local_interface_def_;
232     }
233
234     // ==================================================================
235
//
236
// Methods for the inherited ScopeImpl class.
237
//
238
// ==================================================================
239

240     /**
241      ** Obtain its CORBA 3.0 Container reference.
242      **
243      ** @return The Container object associated with the local
244      ** interface declaration.
245      **/

246     protected org.omg.CORBA.Container JavaDoc
247     getContainer()
248     {
249        return ext_local_interface_def_;
250     }
251
252     // ==================================================================
253
//
254
// Methods for the inherited ForwardScopeImpl class.
255
//
256
// ==================================================================
257

258     /**
259      ** Create the container object.
260      **/

261     protected void
262     createContainer()
263     {
264         org.omg.CORBA.InterfaceDef JavaDoc[] itfs =
265             new org.omg.CORBA.InterfaceDef JavaDoc[inherited_interfaces_.size()];
266
267         for(int i=0; i<itfs.length; i++)
268             itfs[i] = ((InterfaceDeclImpl)(inherited_interfaces_.get(i))).getExtInterfaceDef();
269
270         ext_local_interface_def_ = the_parent_.getContainer().create_ext_local_interface(getId(), getName(),
271                                                                                          getVersion(), itfs);
272     }
273 }
274
Popular Tags