KickJava   Java API By Example, From Geeks To Geeks.

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


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 an abstract interface declaration.
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 AbstractInterfaceDeclImpl
39        extends InterfaceDeclImpl
40        implements AbstractInterfaceRef, AbstractInterfaceDecl
41 {
42     // ==================================================================
43
//
44
// Internal state.
45
//
46
// ==================================================================
47

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

51     private org.omg.CORBA.ExtAbstractInterfaceDef ext_abstract_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 declaration.
63      **/

64     protected
65     AbstractInterfaceDeclImpl(Repository rep, ScopeImpl parent)
66     {
67         // Call the InterfaceDefImpl constructor.
68
super(rep, parent);
69
70         // Init internal state.
71
ext_abstract_interface_def_ = null;
72         the_declaration_kind_ = DeclarationKind._dk_abstract_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_abstract_interface_def_ = org.omg.CORBA.ExtAbstractInterfaceDefHelper.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_abstract_interface_def_ = org.omg.CORBA.ExtAbstractInterfaceDefHelper.narrow(contained);
102         super.load(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 abstract interface
115      ** declaration.
116      **/

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

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

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

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

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

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

173 /*
174  * the cast implies a NullPointerException when an abstract interface
175  * inherits from a interface
176  *
177     public void
178     addInterface(InterfaceRef itf)
179     {
180         if(itf != null)
181         {
182             inherited_interfaces_.get(
183                  ((AbstractInterfaceDeclImpl)itf));
184         }
185     }
186  */

187
188     // ==================================================================
189
//
190
// Methods for the AbstractInterfaceRef interface.
191
//
192
// ==================================================================
193

194     /**
195      ** Obtain its AbstractInterfaceDef reference.
196      **
197      ** @return The AbstractInterfaceDef object associated with
198      ** the abstract interface declaration.
199      **/

200     public org.omg.CORBA.ExtAbstractInterfaceDef
201     getExtAbstractInterfaceDef()
202     {
203         return ext_abstract_interface_def_;
204     }
205
206     /**
207      ** Obtain its AbstractInterfaceDef reference.
208      **
209      ** @return The AbstractInterfaceDef object associated with
210      ** the abstract interface declaration.
211      **/

212     public org.omg.CORBA.AbstractInterfaceDef
213     getAbstractInterfaceDef()
214     {
215         return ext_abstract_interface_def_;
216     }
217
218     // ==================================================================
219
//
220
// Methods for the inherited DeclarationImpl class.
221
//
222
// ==================================================================
223

224     /**
225      ** Obtain its CORBA 3.0 Contained reference.
226      **
227      ** @return The Contained object associated with the abstract
228      ** interface declaration.
229      **/

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

242     /**
243      ** Obtain its CORBA 3.0 Container reference.
244      **
245      ** @return The Container object associated with the abstract
246      ** interface declaration.
247      **/

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

260     /**
261      ** Create the container object.
262      **/

263     protected void
264     createContainer()
265     {
266         org.omg.CORBA.AbstractInterfaceDef[] itfs =
267          new org.omg.CORBA.AbstractInterfaceDef[inherited_interfaces_.size()];
268
269         for(int i=0; i<itfs.length; i++)
270             itfs[i] = ((AbstractInterfaceDeclImpl)(inherited_interfaces_.get(i))).getExtAbstractInterfaceDef();
271
272         ext_abstract_interface_def_ = the_parent_.getContainer().create_ext_abstract_interface(getId(), getName(),
273                                                                                                getVersion(), itfs);
274     }
275 }
276
Popular Tags