KickJava   Java API By Example, From Geeks To Geeks.

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


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

26
27 package org.objectweb.openccm.ast.lib;
28
29 /** To access AST DeclarationKind. */
30 import org.objectweb.openccm.ast.api.DeclarationKind;
31
32 import org.objectweb.openccm.ast.api.AbstractStorageTypeDecl;
33
34 /**
35  * AbstractStorageHomeDeclImpl is a wrapper class for
36  * PSDL abstract storagehome declarations.
37  *
38  *
39  * Inherits from:
40  *
41  * - StorageHomeBaseImpl as abstract storagehomes are also IDL forward scopes.
42  *
43  *
44  * Provides:
45  *
46  * - The managed abstract storagetype,
47  * i.e. the setAbstractStorageType and getAbstractStorageType operations.
48  *
49  *
50  * @author <a HREF="mailto:Philippe.Merle@lifl.fr">Philippe Merle</a>
51  * <a HREF="mailto:Christophe.Demarey@lifl.fr">Christophe Demarey</a>
52  *
53  * @version 0.1
54  */

55
56 public class AbstractStorageHomeDeclImpl
57      extends StorageHomeBaseImpl
58   implements org.objectweb.openccm.ast.api.AbstractStorageHomeDecl
59 {
60     // ==================================================================
61
//
62
// Internal state.
63
//
64
// ==================================================================
65

66     /** The managed abstract storagetype. */
67     protected AbstractStorageTypeDeclImpl managedAbstractStorageType_;
68
69     /** The idl mapping. */
70     protected org.objectweb.openccm.ast.api.NativeDecl mapping_;
71
72     // ==================================================================
73
//
74
// Constructor.
75
//
76
// ==================================================================
77

78     /**
79      * The constructor with the parent scope.
80      *
81      * @param parent The parent scope of the declaration.
82      */

83     protected
84     AbstractStorageHomeDeclImpl(Repository rep,
85                                 ScopeImpl parent)
86     {
87         // Call the StorageHomeBaseImpl constructor.
88
super(rep, parent);
89
90         // Init internal state.
91
managedAbstractStorageType_ = null;
92         mapping_ = null;
93     }
94
95     // ==================================================================
96
//
97
// Internal methods.
98
//
99
// ==================================================================
100

101     // ==================================================================
102
//
103
// Methods for DeclarationImpl
104
//
105
// ==================================================================
106

107     /**
108      * Obtain its DeclarationKind.
109      *
110      * This method is implemented into DeclarationImpl subclasses.
111      *
112      * @return The DeclarationKind of the object.
113      */

114     public long
115     getDeclKind()
116     {
117         return DeclarationKind.dk_abstract_storage_home;
118     }
119
120     // ==================================================================
121
//
122
// Methods for ScopeImpl
123
//
124
// ==================================================================
125

126     // ==================================================================
127
//
128
// Methods for ForwardScopeImpl
129
//
130
// ==================================================================
131

132     // ==================================================================
133
//
134
// Methods for ForwardScopeIDLImpl
135
//
136
// ==================================================================
137

138     // ==================================================================
139
//
140
// Methods for StorageHomeBaseImpl
141
//
142
// ==================================================================
143

144     // ==================================================================
145
//
146
// Public methods.
147
//
148
// ==================================================================
149

150     // ==================================================================
151
//
152
// Methods for OMG IDL org.objectweb.openccm.ast.api.WithDependencies
153
//
154
// ==================================================================
155

156     // ==================================================================
157
//
158
// Methods for OMG IDL org.objectweb.openccm.ast.api.Declaration
159
//
160
// ==================================================================
161

162     /**
163      * Check if the declaration is valid.
164      */

165     public void
166     check()
167     {
168         // Call the StorageHomeBase "check" method
169
super.check(managedAbstractStorageType_);
170     }
171
172     // ==================================================================
173
//
174
// Methods for OMG IDL org.objectweb.openccm.ast.api.Scope
175
//
176
// ==================================================================
177

178     // ==================================================================
179
//
180
// Methods for OMG IDL org.objectweb.openccm.ast.api.ForwardScope
181
//
182
// ==================================================================
183

184     // ==================================================================
185
//
186
// Methods for OMG IDL org.objectweb.openccm.ast.api.StorageHomeBase
187
//
188
// ==================================================================
189

190     // ==================================================================
191
//
192
// Methods for OMG IDL org.objectweb.openccm.ast.api.AbstractStorageHomeDecl
193
//
194
// ==================================================================
195

196     /**
197      * Set the managed abstract storagetype.
198      *
199      * @param mast The managed abstract storagetype.
200      */

201     public void
202     setAbstractStorageType(AbstractStorageTypeDecl mast)
203     {
204         if(mast != null)
205         {
206             managedAbstractStorageType_ = (AbstractStorageTypeDeclImpl)mast;
207         }
208     }
209
210     /**
211      * Obtain the managed abstract storagetype.
212      *
213      * @return The managed abstract storagetype.
214      */

215     public AbstractStorageTypeDecl
216     getAbstractStorageType()
217     {
218         return managedAbstractStorageType_;
219     }
220
221     /**
222      * Obtain the idl2 mapping of this abstract storage home.
223      *
224      * @return The mapped native declaration.
225      */

226     public org.objectweb.openccm.ast.api.NativeDecl
227     getMapping()
228     {
229         if (mapping_ == null)
230         {
231             ScopeImpl module = (ScopeImpl)getParent();
232
233             mapping_ = module.startNative(getName());
234             // Create a NativeDef into the IFR.
235
((NativeDeclImpl)mapping_).setIDLType( module.getContainer().
236                        create_native(mapping_.getId(), mapping_.getName(), mapping_.getVersion()) );
237         }
238         return mapping_;
239     }
240 }
241
Popular Tags