1 28 29 package ist.coach.itut_q816Components.ContainmentServiceProviderComposition; 30 31 import ist.coach.coachEmfCommon.Utils; 32 import ist.coach.coachEmfCommon.ExceptionMessages; 33 34 import ist.coach.coachEmfCommon.ApplicationErrorInfoTypeImpl; 35 36 import intt.itu.itut_x780.UIDType; 37 import intt.itu.itut_x780.ApplicationError; 38 44 public class querySegImpl 45 extends ist.coach.itut_q816Components.ContainmentServiceProviderComposition.querySeg 46 { 47 53 59 public querySegImpl() 60 { 61 } 62 63 69 72 public boolean 73 exists(org.omg.CosNaming.NameComponent [] name) 74 throws intt.itu.itut_x780.ApplicationError 75 { 76 80 if (ContainmentServiceProviderImpl.tree.containsKey(Utils.name2string(name))) 81 return true; 82 else 83 return false; 84 85 } 86 87 90 public org.omg.CosNaming.NameComponent [][] 91 getContained(org.omg.CosNaming.NameComponent [] name) 92 throws intt.itu.itut_x780.ApplicationError 93 { 94 org.omg.CosNaming.NameComponent [][] contained_objects = 98 new org.omg.CosNaming.NameComponent [0][0]; 99 100 String name_str = Utils.name2string(name); 101 102 if (ContainmentServiceProviderImpl.tree.containsKey(name_str)) { 103 java.util.Vector contained_vector = 104 (java.util.Vector ) ContainmentServiceProviderImpl.tree.get(name_str); 105 106 contained_objects = 107 new org.omg.CosNaming.NameComponent [contained_vector.size()][0]; 108 109 for(int i = 0; i < contained_vector.size(); i++) { 110 111 String child_name = (String ) contained_vector.elementAt(i); 112 113 if (child_name == null || child_name.length() == 0) 114 System.err.println("Note that a NULL child found!"); 115 else { 116 contained_objects[i] = Utils.string2name(child_name); 117 } 118 } 119 } 120 return contained_objects; 123 } 124 125 128 public org.omg.CosNaming.NameComponent [][] 129 getContainedByKind(org.omg.CosNaming.NameComponent [] name, String kind) 130 throws intt.itu.itut_x780.ApplicationError 131 { 132 org.omg.CosNaming.NameComponent [][] contained_objects = 136 new org.omg.CosNaming.NameComponent [0][0]; 137 String name_str = Utils.name2string(name); 138 139 if (! ContainmentServiceProviderImpl.tree.containsKey(name_str)) { 140 ApplicationErrorInfoTypeImpl error_code = 141 new ApplicationErrorInfoTypeImpl(); 142 error_code.error = new UIDType( 143 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 144 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 145 error_code.details = ExceptionMessages.root_delete_error; 146 147 throw new ApplicationError(error_code); 148 } 149 java.util.Vector contained_vector = 150 (java.util.Vector ) ContainmentServiceProviderImpl.tree.get(name_str); 151 152 java.util.Vector contained_by_kind_vector = new java.util.Vector (); 153 String child_str; 154 for (int i = 0; i < contained_vector.size(); i++) { 155 child_str = (String ) contained_vector.elementAt(i); 156 157 if (kind.equals(Utils.name2kind(child_str))) { 158 contained_by_kind_vector.add(child_str); 159 } 160 161 } 162 contained_objects = new org.omg.CosNaming.NameComponent [ 163 contained_by_kind_vector.size()][0]; 164 165 for(int j = 0; j < contained_by_kind_vector.size(); j++) { 166 167 child_str = (String ) contained_by_kind_vector.elementAt(j); 168 169 if (child_str == null || child_str.length() == 0) 170 System.err.println("NULL child found!"); 171 else 172 contained_objects[j] = Utils.string2name(child_str); 173 } 174 175 return contained_objects; 176 177 } 178 179 } 180 | Popular Tags |