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 34 40 public class OperationInstanceListImpl 41 extends LocalObject 42 implements OperationInstanceList 43 { 44 private Table _operations; 45 46 public OperationInstanceListImpl() 47 { 48 _operations = new Table(); 49 } 50 51 54 public OperationInstance 55 get_operation_instance(String name) 56 throws InvalidName 57 { 58 OperationInstance result = (OperationInstance) _operations.get(name); 59 if(result == null) 60 throw new InvalidName(); 61 return result; 62 } 63 64 67 public OperationInstance[] 68 get_named_operation_instances(String [] names) 69 throws InvalidName 70 { 71 OperationInstance[] result = new OperationInstance[names.length]; 72 73 75 int i = 0; 76 for(i=0;i<names.length;i++) 77 { 78 result[i] = (OperationInstance)_operations.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 OperationInstance[] 93 get_all_operation_instances() 94 { 95 OperationInstance[] result = new OperationInstance[_operations.size()]; 96 97 int idx = 0; 99 for(java.util.Enumeration elements = _operations.elements(); elements.hasMoreElements(); ) 100 { 101 OperationInstance info = (OperationInstance)elements.nextElement(); 102 result[idx++] = info; 103 } 104 return result; 105 } 106 107 110 public void add_operation_instance(OperationInstance cpi) 111 { 112 String key = cpi.type_reference().name() + cpi.toString().substring(cpi.toString().lastIndexOf("@")); 113 _operations.put(key,cpi); 114 115 } 116 117 120 public void remove_operation_instance(String name) 121 throws InvalidName 122 { 123 Object result = _operations.remove(name); 124 125 if (result == null) throw new InvalidName(); 126 } 127 } 128 | Popular Tags |