1 28 29 package ist.coach.itut_q816Components.ContainmentServiceProviderComposition; 30 31 import ist.coach.coachEmfCommon.Utils; 32 import ist.coach.coachEmfCommon.ExceptionMessages; 33 import ist.coach.coachEmfCommon.DeleteErrorInfoTypeImpl; 34 import ist.coach.coachEmfCommon.CreateErrorInfoTypeImpl; 35 import ist.coach.coachEmfCommon.ApplicationErrorInfoTypeImpl; 36 37 import intt.itu.itut_x780.UIDType; 38 import intt.itu.itut_x780.ApplicationError; 39 import intt.itu.itut_x780.CreateError; 40 import intt.itu.itut_x780.DeleteError; 41 47 public class adminSegImpl 48 extends ist.coach.itut_q816Components.ContainmentServiceProviderComposition.adminSeg 49 { 50 56 62 public adminSegImpl() 63 { 64 } 65 66 72 75 public void 76 registerLocalRoot(org.omg.CosNaming.NameComponent [] name, org.omg.CosNaming.NamingContext localRoot) 77 throws intt.itu.itut_x780.ApplicationError 78 { 79 ContainmentServiceProviderImpl._local_root = Utils.name2string(name); 83 if (! ContainmentServiceProviderImpl.tree.contains( 84 ContainmentServiceProviderImpl._local_root)) 85 synchronized(ContainmentServiceProviderImpl.tree) { 86 ContainmentServiceProviderImpl.tree.put( 87 ContainmentServiceProviderImpl._local_root, new java.util.Vector ()); 88 } 89 } 90 91 94 public void 95 unregisterLocalRoot(org.omg.CosNaming.NameComponent [] name) 96 throws intt.itu.itut_x780.ApplicationError 97 { 98 } 102 103 106 public void 107 addName(org.omg.CosNaming.NameComponent [] name, org.omg.CosNaming.NameComponent [] superior) 108 throws intt.itu.itut_x780.ApplicationError, 109 110 intt.itu.itut_x780.CreateError 111 { 112 java.util.Vector children = new java.util.Vector (); 116 117 String name_str = Utils.name2string(name); 118 120 String superior_str = Utils.name2string(superior); 121 122 if (ContainmentServiceProviderImpl.tree.containsKey(superior_str)) { 123 children = (java.util.Vector ) ContainmentServiceProviderImpl.tree.get(superior_str); 124 } 125 else { 126 CreateErrorInfoTypeImpl error_code = new CreateErrorInfoTypeImpl(); 127 error_code.error = new UIDType( 128 intt.itu.itut_x780.CreateErrorConst.moduleName.value, 129 intt.itu.itut_x780.CreateErrorConst.badName.value); 130 error_code.details = ExceptionMessages.parent_object_error; 131 throw new ApplicationError(error_code); 132 } 133 134 if (ContainmentServiceProviderImpl.tree.containsKey(name_str)) { 135 CreateErrorInfoTypeImpl error_code = new CreateErrorInfoTypeImpl(); 136 error_code.error = new UIDType( 137 intt.itu.itut_x780.CreateErrorConst.moduleName.value, 138 intt.itu.itut_x780.CreateErrorConst.duplicateName.value); 139 140 error_code.details = name_str + ExceptionMessages.not_exists_error; 141 throw new CreateError(error_code); 142 143 } 144 else { 145 synchronized(ContainmentServiceProviderImpl.tree) { 146 ContainmentServiceProviderImpl.tree.put(name_str, new java.util.Vector ()); 147 } 149 } 150 151 if (! children.contains(name_str)) { 152 children.add(name_str); 153 synchronized(ContainmentServiceProviderImpl.tree) { 154 ContainmentServiceProviderImpl.tree.put(superior_str, children); 155 } 156 synchronized(ContainmentServiceProviderImpl.reverse_tree) { 157 ContainmentServiceProviderImpl.reverse_tree.put(name_str, superior_str); 158 } 159 } 160 } 161 162 165 public void 166 removeName(org.omg.CosNaming.NameComponent [] name) 167 throws intt.itu.itut_x780.ApplicationError, 168 169 intt.itu.itut_x780.DeleteError 170 { 171 if (name.length <= 1) { 175 ApplicationErrorInfoTypeImpl error_code = 176 new ApplicationErrorInfoTypeImpl(); 177 error_code.error = new UIDType( 178 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 179 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 180 error_code.details = ExceptionMessages.root_delete_error; 181 182 throw new ApplicationError(error_code); 183 } 184 185 String name_str = Utils.name2string(name); 186 187 if (!ContainmentServiceProviderImpl.tree.containsKey(name_str)) { 188 189 192 ApplicationErrorInfoTypeImpl error_code = 193 new ApplicationErrorInfoTypeImpl(); 194 error_code.error = new UIDType( 195 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 196 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 197 error_code.details = name_str + ExceptionMessages.not_exists_error; 198 199 throw new ApplicationError(error_code); 200 } 201 202 java.util.Vector children = 203 (java.util.Vector ) ContainmentServiceProviderImpl.tree.get(name_str); 204 205 208 if (children != null && children.size() > 0) { 209 DeleteErrorInfoTypeImpl error_code = 210 new DeleteErrorInfoTypeImpl(); 211 error_code.error = new UIDType( 212 intt.itu.itut_x780.DeleteErrorConst.moduleName.value, 213 intt.itu.itut_x780.DeleteErrorConst.containsObjects.value); 214 error_code.details = name_str + ExceptionMessages.contains_object_error; 215 216 throw new DeleteError(error_code); 217 } 218 219 synchronized(ContainmentServiceProviderImpl.tree) { 220 ContainmentServiceProviderImpl.tree.remove(name_str); 221 } 223 String superior = null; 224 synchronized(ContainmentServiceProviderImpl.reverse_tree) { 225 superior = (String ) ContainmentServiceProviderImpl.reverse_tree.remove(name_str); 226 } 227 if (superior == null) 228 return; 229 230 java.util.Vector superior_children = 231 (java.util.Vector ) ContainmentServiceProviderImpl.tree.get(superior); 232 if (superior_children.contains(name_str)) { 233 superior_children.remove(name_str); 234 synchronized(ContainmentServiceProviderImpl.tree) { 235 ContainmentServiceProviderImpl.tree.put(superior, superior_children); 236 } 237 } 240 241 } 242 243 } 244 | Popular Tags |