KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > Containers > MetaInformation > ComponentInstanceImpl


1 /*====================================================================
2
3 created on 4 mars 2003
4
5 OpenCCM: The Open CORBA Component Model Platform
6 Copyright (C) 2001-2002 USTL - LIFL - GOAL
7 Contact: openccm-team@objectweb.org
8
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Lesser General Public
11 License as published by the Free Software Foundation; either
12 version 2.1 of the License, or any later version.
13
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public
20 License along with this library; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 USA
23
24 Initial developer(s): Hameau Fabien.
25 Contributor(s): ______________________________________.
26
27 */

28
29 package org.objectweb.openccm.Containers.MetaInformation;
30
31 import org.omg.Components.InvalidName;
32
33 /**
34  * @author hameau
35  */

36 public class ComponentInstanceImpl
37 extends InstanceImpl
38 implements ComponentInstance {
39   
40   private InterfaceInstance _equivalent_interface;
41   private InterfaceInstanceList _supported_interfaces;
42   
43   private AttributeInstanceList _attributes;
44   private FacetPortInstanceList _facets;
45   private ReceptaclePortInstanceList _receptacles;
46   private ConsumerPortInstanceList _consumers;
47   private EmitterPortInstanceList _emitters;
48   private PublisherPortInstanceList _publishers;
49   
50   public ComponentInstanceImpl()
51   {
52     _attributes = new AttributeInstanceListImpl();
53     _facets = new FacetPortInstanceListImpl();
54     _receptacles = new ReceptaclePortInstanceListImpl();
55     _consumers = new ConsumerPortInstanceListImpl();
56     _emitters = new EmitterPortInstanceListImpl();
57     _publishers = new PublisherPortInstanceListImpl();
58     
59     _equivalent_interface = null;
60     _supported_interfaces = new InterfaceInstanceListImpl();
61   }
62
63
64   /* (non-Javadoc)
65    * @see org.objectweb.openccm.Containers.MetaInformation.ComponentInstanceOperations#equivalent_interface()
66    */

67   public InterfaceInstance equivalent_interface()
68   {
69     return _equivalent_interface;
70   }
71
72   /* (non-Javadoc)
73    * @see org.objectweb.openccm.Containers.MetaInformation.ComponentInstanceOperations#equivalent_interface(org.objectweb.openccm.Containers.MetaInformation.InterfaceInstance)
74    */

75   public void equivalent_interface(InterfaceInstance value)
76   {
77     _equivalent_interface = value;
78   }
79
80   /* (non-Javadoc)
81    * @see org.objectweb.openccm.Containers.MetaInformation.ComponentInstanceOperations#supported_interface()
82    */

83   public InterfaceInstanceList supported_interface()
84   {
85     return _supported_interfaces;
86   }
87
88   /* (non-Javadoc)
89    * @see org.objectweb.openccm.Containers.MetaInformation.ComponentInstanceOperations#supported_interface(org.objectweb.openccm.Containers.MetaInformation.InterfaceInstanceList)
90    */

91   public void supported_interface(InterfaceInstanceList value)
92   {
93     _supported_interfaces = value;
94   }
95
96   /* (non-Javadoc)
97    * @see org.objectweb.openccm.Containers.MetaInformation.ComponentInstanceOperations#attribute_instance_list()
98    */

99   public AttributeInstanceList attribute_instance_list()
100   {
101     return _attributes;
102   }
103
104   /* (non-Javadoc)
105    * @see org.objectweb.openccm.Containers.MetaInformation.ComponentInstanceOperations#attribute_instance_list(org.objectweb.openccm.Containers.MetaInformation.AttributeInstanceList)
106    */

107   public void attribute_instance_list(AttributeInstanceList value)
108   {
109     _attributes = value;
110   }
111
112   /* (non-Javadoc)
113    * @see org.objectweb.openccm.Containers.MetaInformation.ComponentInstanceOperations#facet_port_instance_list()
114    */

115   public FacetPortInstanceList facet_port_instance_list()
116   {
117     return _facets;
118   }
119
120   /* (non-Javadoc)
121    * @see org.objectweb.openccm.Containers.MetaInformation.ComponentInstanceOperations#facet_port_instance_list(org.objectweb.openccm.Containers.MetaInformation.FacetPortInstanceList)
122    */

123   public void facet_port_instance_list(FacetPortInstanceList value)
124   {
125     _facets = value;
126   }
127
128   /* (non-Javadoc)
129    * @see org.objectweb.openccm.Containers.MetaInformation.ComponentInstanceOperations#receptacle_port_instance_list()
130    */

131   public ReceptaclePortInstanceList receptacle_port_instance_list()
132   {
133     return _receptacles;
134   }
135
136   /* (non-Javadoc)
137    * @see org.objectweb.openccm.Containers.MetaInformation.ComponentInstanceOperations#receptacle_port_instance_list(org.objectweb.openccm.Containers.MetaInformation.ReceptaclePortInstanceList)
138    */

139   public void receptacle_port_instance_list(ReceptaclePortInstanceList value)
140   {
141     _receptacles = value;
142   }
143
144   /* (non-Javadoc)
145    * @see org.objectweb.openccm.Containers.MetaInformation.ComponentInstanceOperations#consumer_port_instance_list()
146    */

147   public ConsumerPortInstanceList consumer_port_instance_list()
148   {
149     return _consumers;
150   }
151
152   /* (non-Javadoc)
153    * @see org.objectweb.openccm.Containers.MetaInformation.ComponentInstanceOperations#consumer_port_instance_list(org.objectweb.openccm.Containers.MetaInformation.ConsumerPortInstanceList)
154    */

155   public void consumer_port_instance_list(ConsumerPortInstanceList value)
156   {
157     _consumers = value;
158   }
159
160   /* (non-Javadoc)
161    * @see org.objectweb.openccm.Containers.MetaInformation.ComponentInstanceOperations#emitter_port_instance_list()
162    */

163   public EmitterPortInstanceList emitter_port_instance_list()
164   {
165     return _emitters;
166   }
167
168   /* (non-Javadoc)
169    * @see org.objectweb.openccm.Containers.MetaInformation.ComponentInstanceOperations#emitter_port_instance_list(org.objectweb.openccm.Containers.MetaInformation.EmitterPortInstanceList)
170    */

171   public void emitter_port_instance_list(EmitterPortInstanceList value)
172   {
173     _emitters = value;
174   }
175
176   /* (non-Javadoc)
177    * @see org.objectweb.openccm.Containers.MetaInformation.ComponentInstanceOperations#publisher_port_instance_list()
178    */

179   public PublisherPortInstanceList publisher_port_instance_list()
180   {
181     return _publishers;
182   }
183
184   /* (non-Javadoc)
185    * @see org.objectweb.openccm.Containers.MetaInformation.ComponentInstanceOperations#publisher_port_instance_list(org.objectweb.openccm.Containers.MetaInformation.PublisherPortInstanceList)
186    */

187   public void publisher_port_instance_list(PublisherPortInstanceList value)
188   {
189     _publishers = value;
190   }
191
192   ////////////////////////////////////////
193
// adding info for recoding of CCMObject
194
////////////////////////////////////////
195

196   // for facet
197

198   public FacetPortInstance create_facet_port_instance(String JavaDoc name)
199   {
200     ComponentType _ctype = (ComponentType) this.type_reference();
201     FacetPortType _fpt = null;
202     try
203     {
204       _fpt = _ctype.facet_port_type_list().get_facet_port_type(name);
205     }
206     catch (InvalidName e)
207     {
208       System.err.println("Error : unbale to find facet '" +name+ "' for component");
209       return null;
210     }
211     FacetPortInstance _fpi = new FacetPortInstanceImpl();
212     _fpi.type_reference(_fpt);
213     _fpi.related_instance_kind(instance_kind.COMPONENT_INSTANCE);
214     _fpi.instance_reference(this);
215     _fpi.object_ref(null);
216
217     return _fpi;
218   }
219   
220   // for receptacle
221

222   public ReceptaclePortInstance create_receptacle_port_instance(String JavaDoc name)
223   {
224     ComponentType _ctype = (ComponentType) this.type_reference();
225     ReceptaclePortType _rpt = null;
226     try
227     {
228       _rpt = _ctype.receptacle_port_type_list().get_receptacle_port_type(name);
229     }
230     catch (InvalidName e)
231     {
232       System.err.println("Error : unbale to find receptacle '" +name+ "' for component");
233       return null;
234     }
235     ReceptaclePortInstance _rpi = new ReceptaclePortInstanceImpl();
236     _rpi.type_reference(_rpt);
237     _rpi.related_instance_kind(instance_kind.COMPONENT_INSTANCE);
238     _rpi.instance_reference(this);
239     _rpi.object_ref(null);
240    
241     return _rpi;
242   }
243
244   // for consumer
245

246   public ConsumerPortInstance create_consumer_port_instance(String JavaDoc name)
247   {
248     ComponentType _ctype = (ComponentType) this.type_reference();
249     ConsumerPortType _cpt;
250     try
251     {
252       _cpt = _ctype.consumer_port_type_list().get_consumer_port_type(name);
253     }
254     catch (InvalidName e)
255     {
256       System.err.println("Error : unbale to find consumer '" +name+ "' for component");
257       return null;
258     }
259     ConsumerPortInstance _cpi = new ConsumerPortInstanceImpl();
260     _cpi.type_reference(_cpt);
261     _cpi.related_instance_kind(instance_kind.COMPONENT_INSTANCE);
262     _cpi.instance_reference(this);
263     _cpi.object_ref(null);
264
265     
266     return _cpi;
267   }
268   
269   // for emitter
270

271   public EmitterPortInstance create_emitter_port_instance(String JavaDoc name)
272   {
273     ComponentType _ctype = (ComponentType) this.type_reference();
274     EmitterPortType _ept;
275     try
276     {
277       _ept = _ctype.emitter_port_type_list().get_emitter_port_type(name);
278     }
279     catch (InvalidName e)
280     {
281       System.err.println("Error : unbale to find emitter '" +name+ "' for component");
282       return null;
283     }
284     EmitterPortInstance _epi = new EmitterPortInstanceImpl();
285     _epi.type_reference(_ept);
286     _epi.related_instance_kind(instance_kind.COMPONENT_INSTANCE);
287     _epi.instance_reference(this);
288     _epi.object_ref(null);
289    
290     return _epi;
291   }
292   
293   // for publisher
294

295   public PublisherPortInstance create_publisher_port_instance(String JavaDoc name)
296   {
297     ComponentType _ctype = (ComponentType) this.type_reference();
298     PublisherPortType _ppt;
299     try
300     {
301       _ppt = _ctype.publisher_port_type_list().get_publisher_port_type(name);
302     }
303     catch (InvalidName e)
304     {
305       System.err.println("Error : unbale to find publisher '" +name+ "' for component");
306       return null;
307     }
308     PublisherPortInstance _ppi = new PublisherPortInstanceImpl();
309     _ppi.type_reference(_ppt);
310     _ppi.related_instance_kind(instance_kind.COMPONENT_INSTANCE);
311     _ppi.instance_reference(this);
312     _ppi.object_ref(null);
313    
314     return _ppi;
315   }
316   
317 }
318
Popular Tags