KickJava   Java API By Example, From Geeks To Geeks.

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


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 consumes 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 ConsumesDeclImpl
39        extends EventsDeclImpl
40        implements ConsumesDecl
41 {
42     // ==================================================================
43
//
44
// Internal state.
45
//
46
// ==================================================================
47

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

51     private org.omg.CORBA.ComponentIR.ConsumesDef consumes_def_;
52
53     /**
54      **
55      **/

56     private OperationDeclImpl[] client_mapping_;
57
58     // ==================================================================
59
//
60
// Constructor.
61
//
62
// ==================================================================
63

64     /**
65      ** The constructor with the parent scope.
66      **
67      ** @param parent The parent scope of the declaration.
68      **/

69     protected
70     ConsumesDeclImpl(Repository rep, ScopeImpl parent)
71     {
72         // Call the EventsDeclImpl constructor.
73
super(rep, parent);
74
75         // Init internal state.
76
consumes_def_ = null;
77         client_mapping_ = null;
78         the_declaration_kind_ = DeclarationKind._dk_consumes;
79     }
80
81     // ==================================================================
82
//
83
// Internal methods.
84
//
85
// ==================================================================
86

87     /**
88      ** Loads infos of the CORBA 3.0 ConsumesDef.
89      **
90      ** @param consumes_def The ConsumesDef to load.
91      **/

92     protected void
93     load(org.omg.CORBA.Contained JavaDoc contained)
94     {
95         consumes_def_ = org.omg.CORBA.ComponentIR.ConsumesDefHelper.narrow(contained);
96         super.load(contained);
97     }
98
99     // ==================================================================
100
//
101
// Methods for the Declaration interface.
102
//
103
// ==================================================================
104

105     /**
106      ** Create the consumes declaration into the IFR.
107      **/

108     public void
109     create()
110     {
111         consumes_def_ = the_parent_.getComponentDef().create_consumes(getId(),
112                                                                       getName(),
113                                                                       getVersion(),
114                                                                       event_.getEventDef());
115
116         super.create();
117     }
118
119     // ==================================================================
120
//
121
// Methods for the EventsDecl interface.
122
//
123
// ==================================================================
124

125     /**
126      **
127      **/

128     public OperationDecl[]
129     getClientMapping()
130     {
131         if (client_mapping_!=null)
132             return client_mapping_;
133
134         // retrieve the client mapping interface.
135
InterfaceDecl client = ((ComponentDecl)the_parent_).getClientMapping();
136         client.getContents(true, DeclarationKind._dk_null);
137
138         client_mapping_ = new OperationDeclImpl[1];
139         client_mapping_[0] = (OperationDeclImpl)client.find("get_consumer_"+getName());
140
141         return client_mapping_;
142     }
143
144     // ==================================================================
145
//
146
// Methods for the inherited DeclarationImpl class.
147
//
148
// ==================================================================
149

150     /**
151      ** Obtain its CORBA 3.0 Contained reference.
152      **
153      ** @return The Contained object associated with the consumes declaration.
154      **/

155     protected org.omg.CORBA.Contained JavaDoc
156     getContained()
157     {
158        return consumes_def_;
159     }
160 }
161
Popular Tags