KickJava   Java API By Example, From Geeks To Geeks.

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


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 emits port 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 EmitsDeclImpl
39        extends EventsDeclImpl
40        implements EmitsDecl
41 {
42     // ==================================================================
43
//
44
// Internal state.
45
//
46
// ==================================================================
47

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

51     private org.omg.CORBA.ComponentIR.EmitsDef emits_def_;
52
53     /**
54      **
55      **/

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

61     private OperationDeclImpl[] local_context_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 declaration.
73      **/

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

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

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

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

114     public void
115     create()
116     {
117         emits_def_ = the_parent_.getComponentDef().create_emits(getId(),
118                                                                 getName(),
119                                                                 getVersion(),
120                                                                 event_.getEventDef());
121
122         super.create();
123    }
124
125     // ==================================================================
126
//
127
// Methods for the EventsDecl interface.
128
//
129
// ==================================================================
130

131     /**
132      **
133      **/

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

154     public OperationDecl[]
155     getLocalContextMapping()
156     {
157         if (local_context_mapping_!=null)
158             return local_context_mapping_;
159
160         // retrieve the context mapping local interface.
161
InterfaceDecl context = ((ComponentDecl)the_parent_).getLocalContextMapping();
162         context.getContents(true, DeclarationKind._dk_null);
163
164         local_context_mapping_ = new OperationDeclImpl[1];
165         local_context_mapping_[0] = (OperationDeclImpl)context.find("push_"+getName());
166
167         return local_context_mapping_;
168     }
169
170     // ==================================================================
171
//
172
// Methods for the inherited DeclarationImpl class.
173
//
174
// ==================================================================
175

176     /**
177      ** Obtain its CORBA 3.0 Contained reference.
178      **
179      ** @return The Contained object associated with the emits declaration.
180      **/

181     protected org.omg.CORBA.Contained JavaDoc
182     getContained()
183     {
184        return emits_def_;
185     }
186 }
187
Popular Tags