KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*====================================================================
2
3 created on 10 avr. 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.objectweb.ccm.util.Table;
32 import org.omg.CORBA.LocalObject JavaDoc;
33 import org.omg.Components.InvalidName;
34
35 /**
36  * @author hameau
37  */

38 public class ConsumerPortTypeListImpl
39 extends LocalObject JavaDoc
40 implements ConsumerPortTypeList
41 {
42     private Table _consumers;
43     
44     public ConsumerPortTypeListImpl()
45     {
46         _consumers = new Table();
47     }
48
49     public ConsumerPortType[] get_all_consumer_port_types()
50     {
51         ConsumerPortType[] result = new ConsumerPortType[_consumers.size()];
52
53         // Iterate on all the connections.
54
int idx = 0;
55         for(java.util.Enumeration JavaDoc elements = _consumers.elements(); elements.hasMoreElements(); )
56         {
57                 ConsumerPortType info = (ConsumerPortType)elements.nextElement();
58                 result[idx++] = info;
59         }
60         return result;
61     }
62
63     public ConsumerPortType[] get_named_consumer_port_types(String JavaDoc[] names)
64     {
65     ConsumerPortType[] result = new ConsumerPortType[names.length];
66
67     // Iterate on all the connections.
68
int i = 0;
69         for(i=0;i<names.length;i++)
70         {
71                 result[i] = (ConsumerPortType)_consumers.get(names[i]);
72         }
73         return result;
74     }
75
76     public ConsumerPortType get_consumer_port_type(String JavaDoc name)
77     {
78             return (ConsumerPortType) _consumers.get(name);
79     }
80
81     public void add_consumer_port_type(ConsumerPortType _opt)
82     {
83         _consumers.put(_opt.name(),_opt);
84     }
85
86     public void remove_consumer_port_type(String JavaDoc name)
87     {
88         _consumers.remove(name);
89     }
90
91  
92 }
93
Popular Tags