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 FacetPortInstanceListImpl 40 extends LocalObject 41 implements FacetPortInstanceList 42 { 43 44 private Table _facets; 45 46 public FacetPortInstanceListImpl() 47 { 48 _facets = new Table(); 49 } 50 51 54 public FacetPortInstance 55 get_facet_port_instance(String name) 56 throws InvalidName 57 { 58 FacetPortInstance result = (FacetPortInstance) _facets.get(name); 59 if(result == null) 60 throw new InvalidName(); 61 return result; 62 } 63 64 67 public FacetPortInstance[] 68 get_named_facet_port_instances(String [] names) 69 throws InvalidName 70 { 71 FacetPortInstance[] result = new FacetPortInstance[names.length]; 72 73 75 int i = 0; 76 for(i=0;i<names.length;i++) 77 { 78 result[i] = (FacetPortInstance)_facets.get(names[i]); 79 80 if(result[i] == null) 81 { 82 throw new InvalidName(); 83 } 84 } 85 86 return result; 87 } 88 89 92 public FacetPortInstance[] 93 get_all_facet_port_instances() 94 { 95 FacetPortInstance[] result = new FacetPortInstance[_facets.size()]; 96 97 int idx = 0; 99 for(java.util.Enumeration elements = _facets.elements(); elements.hasMoreElements(); ) 100 { 101 FacetPortInstance info = (FacetPortInstance)elements.nextElement(); 102 result[idx++] = info; 103 } 104 return result; 105 } 106 107 110 public void add_facet_port_instance(FacetPortInstance fpi) 111 { 112 String key = fpi.type_reference().name() ; 114 _facets.put(key,fpi); 115 } 116 117 120 public void remove_facet_port_instance(String name) 121 throws InvalidName 122 { 123 Object result = _facets.remove(name); 124 125 if (result == null) throw new InvalidName(); 126 } 127 } 128 | Popular Tags |