1 27 package org.objectweb.openccm.Containers.MetaInformation; 28 29 import org.objectweb.ccm.util.Table; 30 import org.omg.CORBA.LocalObject ; 31 import org.omg.Components.InvalidName; 32 33 39 public class ConsumerPortInstanceListImpl 40 extends LocalObject 41 implements ConsumerPortInstanceList 42 { 43 private Table _consumers; 44 45 public ConsumerPortInstanceListImpl() 46 { 47 _consumers = new Table(); 48 } 49 50 53 public ConsumerPortInstance 54 get_consumer_port_instance(String name) 55 throws InvalidName 56 { 57 ConsumerPortInstance result = (ConsumerPortInstance) _consumers.get(name); 58 if(result == null) 59 throw new InvalidName(); 60 return result; 61 } 62 63 66 public ConsumerPortInstance[] 67 get_named_consumer_port_instances(String [] names) 68 throws InvalidName 69 { 70 ConsumerPortInstance[] result = new ConsumerPortInstance[names.length]; 71 72 74 int i = 0; 75 for(i=0;i<names.length;i++) 76 { 77 result[i] = (ConsumerPortInstance)_consumers.get(names[i]); 78 79 if(result[i] == null) 80 { 81 throw new InvalidName(); 82 } 83 } 84 85 return result; 86 } 87 88 91 public ConsumerPortInstance[] 92 get_all_consumer_port_instances() 93 { 94 ConsumerPortInstance[] result = new ConsumerPortInstance[_consumers.size()]; 95 96 int idx = 0; 98 for(java.util.Enumeration elements = _consumers.elements(); elements.hasMoreElements(); ) 99 { 100 ConsumerPortInstance info = (ConsumerPortInstance)elements.nextElement(); 101 result[idx++] = info; 102 } 103 return result; 104 } 105 106 109 public void add_consumer_port_instance(ConsumerPortInstance cpi) 110 { 111 String key = cpi.type_reference().name(); _consumers.put(key,cpi); 113 114 } 115 116 119 public void remove_consumer_port_instance(String name) 120 throws InvalidName 121 { 122 Object result = _consumers.remove(name); 123 124 if (result == null) throw new InvalidName(); 125 } 126 } 127 | Popular Tags |