KickJava   Java API By Example, From Geeks To Geeks.

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


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 finder operation 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 FinderDeclImpl
39        extends OperationDeclImpl
40        implements FinderDecl
41 {
42     // ==================================================================
43
//
44
// Internal state.
45
//
46
// ==================================================================
47

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

51     private org.omg.CORBA.ComponentIR.FinderDef finder_def_;
52
53     /**
54      **
55      **/

56     private OperationDeclImpl[] client_mapping_;
57
58     /**
59      **
60      **/

61     private OperationDeclImpl[] local_mapping_;
62
63     // ==================================================================
64
//
65
// Constructor.
66
//
67
// ==================================================================
68

69     /**
70      ** The constructor with the parent scope.
71      **
72      ** @param parent The parent scope of the finder declaration.
73      **/

74     protected
75     FinderDeclImpl(Repository rep, ScopeImpl parent)
76     {
77         // Call the OperationDeclImpl constructor.
78
super(rep, parent);
79
80         // Init internal state.
81
finder_def_ = null;
82         client_mapping_ = null;
83         local_mapping_ = null;
84         the_declaration_kind_ = DeclarationKind._dk_finder;
85     }
86
87     // ==================================================================
88
//
89
// Internal methods.
90
//
91
// ==================================================================
92

93     /**
94      ** Loads infos of the CORBA 3.0 FinderDef.
95      **
96      ** @param finder_def The FinderDef to load.
97      **/

98     protected void
99     load(org.omg.CORBA.Contained JavaDoc contained)
100     {
101         finder_def_ = org.omg.CORBA.ComponentIR.FinderDefHelper.narrow(contained);
102         super.load(contained);
103     }
104
105     // ==================================================================
106
//
107
// For Declaration interface.
108
//
109
// ==================================================================
110

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

114     public void
115     create()
116     {
117         finder_def_ = the_parent_.getHomeDef().create_finder(getId(),
118                                                              getName(),
119                                                              getVersion(),
120                                                              parameters_.getParameterDescs(),
121                                                              exceptions_.getExceptionDefs());
122     }
123
124     // ==================================================================
125
//
126
// Methods for the FinderDecl interface.
127
//
128
// ==================================================================
129

130     /**
131      **
132      **/

133     public OperationDecl[]
134     getClientMapping()
135     {
136         if (client_mapping_!=null)
137             return client_mapping_;
138
139         // retrieve the client mapping interface.
140
InterfaceDecl client = ((HomeDecl)the_parent_).getClientExplicitMapping();
141         client.getContents(true, DeclarationKind._dk_null);
142
143         client_mapping_ = new OperationDeclImpl[1];
144         client_mapping_[0] = (OperationDeclImpl)client.find(getName());
145
146         return client_mapping_;
147     }
148
149     /**
150      **
151      **/

152     public OperationDecl[]
153     getLocalMapping()
154     {
155         if (local_mapping_!=null)
156             return local_mapping_;
157
158         // retrieve the local mapping interface.
159
InterfaceDecl local = ((HomeDecl)the_parent_).getLocalMapping();
160         local.getContents(true, DeclarationKind._dk_null);
161
162         local_mapping_ = new OperationDeclImpl[1];
163         local_mapping_[0] = (OperationDeclImpl)local.find(getName());
164
165         return local_mapping_;
166     }
167
168     // ==================================================================
169
//
170
// For DeclarationImpl class.
171
//
172
// ==================================================================
173

174     /**
175      ** Obtain its CORBA 3.0 Contained reference.
176      **
177      ** @return The Contained object associated with the finder declaration.
178      **/

179     protected org.omg.CORBA.Contained JavaDoc
180     getContained()
181     {
182        return finder_def_;
183     }
184 }
185
Popular Tags