KickJava   Java API By Example, From Geeks To Geeks.

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


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 native 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 NativeDeclImpl
39        extends DeclarationImpl
40        implements TypeRef, NativeDecl
41 {
42     // ==================================================================
43
//
44
// Internal state.
45
//
46
// ==================================================================
47

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

51     private org.omg.CORBA.NativeDef JavaDoc native_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 native declaration.
63      **/

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

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

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

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

111     /**
112      ** Create the native declaration into the IFR.
113      **/

114     public void
115     create()
116     {
117         // Create a NativeDef into the IFR.
118
native_def_ = the_parent_.getContainer().create_native(getId(), getName(), getVersion());
119
120         super.create();
121     }
122
123     // ==================================================================
124
//
125
// Methods for the TypeRef interface.
126
//
127
// ==================================================================
128

129     /**
130      ** Obtain its CORBA 3.0 Container reference.
131      **
132      ** @return The Container object associated with the native declaration.
133      **/

134     public org.omg.CORBA.IDLType JavaDoc
135     getIDLType()
136     {
137         return native_def_;
138     }
139
140     /**
141      **
142      **/

143     public int
144     getTypeKind()
145     {
146         return TypeKind._tk_native;
147     }
148
149     // ==================================================================
150
//
151
// Methods for the inherited DeclarationImpl class.
152
//
153
// ==================================================================
154

155     /**
156      ** Obtain its CORBA 3.0 Contained reference.
157      **
158      ** @return The Contained object associated with the native declaration.
159      **/

160     protected org.omg.CORBA.Contained JavaDoc
161     getContained()
162     {
163        return native_def_;
164     }
165 }
166
Popular Tags