KickJava   Java API By Example, From Geeks To Geeks.

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


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

26
27 package org.objectweb.openccm.ast.lib;
28
29 // Package dependencies.
30
import org.objectweb.openccm.ast.api.DeclarationKind;
31 import org.objectweb.openccm.ast.api.Declaration;
32 import org.objectweb.openccm.ast.api.DelegationList;
33 import org.objectweb.openccm.ast.api.SegmentDecl;
34 import org.objectweb.openccm.ast.api.CategoryKind;
35
36 /**
37  * ExecutorDeclImpl is a wrapper class for CIDL executor declarations.
38  *
39  *
40  * Inherits from:
41  * - CidlScopeImpl as executors are also IDL scopes.
42  * - ExecutorDecl as OMG IDL for CIDL executor declarations.
43  *
44  *
45  * @author <a HREF="mailto:Philippe.Merle@lifl.fr">Philippe Merle</a>
46  * <a HREF="mailto:Christophe.Demarey@lifl.fr">Christophe Demarey</a>
47  *
48  * @version 0.2
49  */

50
51 public class ExecutorDeclImpl
52      extends CidlScopeImpl
53   implements org.objectweb.openccm.ast.api.ExecutorDecl
54 {
55     // ==================================================================
56
//
57
// Internal state.
58
//
59
// ==================================================================
60

61     /** List of feature delegations. */
62     private DelegationListImpl feature_delegation_;
63
64     // ==================================================================
65
//
66
// Constructor.
67
//
68
// ==================================================================
69

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

76     public
77     ExecutorDeclImpl(Repository rep,
78                      ScopeImpl parent)
79     {
80         // Call the ScopeImpl constructor.
81
super(rep, parent);
82
83         // Init internal state.
84
feature_delegation_ = new DelegationListImpl();
85     }
86
87     // ==================================================================
88
//
89
// Internal methods.
90
//
91
// ==================================================================
92

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

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

104     protected void
105     load(org.omg.CORBA.Contained JavaDoc contained)
106     {
107       // TODO
108
}
109
110     /**
111      * Loads infos of the CORBA 3.0 ExceptionDef.
112      *
113      * @param contained The ExceptionDef to load.
114      */

115     protected void
116     loadAsMapping(org.omg.CORBA.Contained JavaDoc contained)
117     {
118       // TODO
119
}
120
121     /**
122      * Obtain its CORBA 3.0 Contained reference.
123      *
124      * @return The Contained object associated with the exception
125      * declaration.
126      */

127     protected org.omg.CORBA.Contained JavaDoc
128     getContained()
129     {
130        return null;
131     }
132
133     // ==================================================================
134
//
135
// Internal methods for ScopeImpl.
136
//
137
// ==================================================================
138

139     /**
140      * Obtain its CORBA 3.0 Container reference.
141      *
142      * @return The Container object associated with the exception
143      * declaration.
144      */

145     protected org.omg.CORBA.Container JavaDoc
146     getContainer()
147     {
148         return null;
149     }
150
151     // ==================================================================
152
//
153
// Public methods.
154
//
155
// ==================================================================
156

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

163     /**
164      * Obtain the declaration external dependencies.
165      *
166      * Note: for scopes, contained objects are not considered
167      * as dependencies.
168      *
169      * @return The list of dependencies as an array of Declaration.
170      */

171     public Declaration[]
172     getDependencies()
173     {
174         if (dependencies_!=null)
175             return dependencies_;
176
177         java.util.List JavaDoc exec_depend = new java.util.ArrayList JavaDoc();
178         Declaration[] depend = null;
179
180         // Feature delegation
181
// Nothing to do for the moment
182

183         // Contents
184
Declaration[] decls = getContents(true, DeclarationKind.dk_all);
185         for (int i=0; i<decls.length; i++)
186         {
187             depend = decls[i].getDependencies();
188             for (int j=0; j<depend.length; j++)
189             {
190                 if ( (!containsDecl(depend[j])) &&
191                      (depend[j] != this) &&
192                      (exec_depend.indexOf(depend[j]) == -1) )
193                     exec_depend.add(depend[j]);
194             }
195         }
196
197         dependencies_ = (Declaration[])exec_depend.toArray(new Declaration[0]);
198         return dependencies_;
199     }
200
201     // ==================================================================
202
//
203
// Methods for OMG IDL org.objectweb.openccm.ast.api.Declaration
204
//
205
// ==================================================================
206

207     /**
208      * Obtain its DeclarationKind.
209      *
210      * @return The DeclarationKind of the object.
211      */

212     public long
213     getDeclKind()
214     {
215         return DeclarationKind.dk_executor;
216     }
217
218     /**
219      * Close the exception scope.
220      */

221     public void
222     create()
223     {
224         // Call the Cidl scope method
225
super.create();
226
227       // TODO check if the executor declaration is correct
228
}
229
230     // ==================================================================
231
//
232
// Methods for OMG IDL org.objectweb.openccm.ast.api.Scope
233
//
234
// ==================================================================
235

236     // ==================================================================
237
//
238
// Methods for OMG IDL org.objectweb.openccm.ast.api.ExecutorDecl
239
//
240
// ==================================================================
241

242     /**
243      * Obtain the associated composition category.
244      *
245      * @return The associated composition category.
246      */

247     public CategoryKind
248     getCompositionKind()
249     {
250         return ((org.objectweb.openccm.ast.api.CompositionDecl)getParent().getParent()).getCategoryKind();
251     }
252
253     /**
254      * Obtain the feature delegation list.
255      *
256      * @return The feature delegation list.
257      */

258     public DelegationList
259     getFeatureDelegationList()
260     {
261         return feature_delegation_;
262     }
263
264     /**
265      * Start a new CIDL segment declaration.
266      *
267      * @param name The name of the CIDL segment declaration.
268      *
269      * @return The new created SegmentDecl.
270      */

271     public SegmentDecl
272     startSegment(String JavaDoc name)
273     {
274         SegmentDecl decl = new SegmentDeclImpl(getRepository(), this);
275         decl.setName(name);
276         return decl;
277     }
278 }
279
Popular Tags