1 21 package ist.coach.itut_x780Components; 22 23 import ist.coach.coachEmfCommon.Utils; 24 import ist.coach.coachEmfCommon.ExceptionMessages; 25 import intt.itu.itut_x780.UIDType; 26 import intt.itu.itut_x780.CreateError; 27 import intt.itu.itut_x780.ApplicationError; 28 import intt.itu.itut_x780.AttributeValueType; 29 30 import ist.coach.coachEmfCommon.CreateErrorInfoTypeImpl; 31 import ist.coach.coachEmfCommon.ApplicationErrorInfoTypeImpl; 32 import ist.coach.coachEmfCommon.ManagedObjectValueTypeImpl; 33 import ist.coach.coachEmfCommon.ObjectCreationImpl; 34 import ist.coach.coachEmfCommon.ObjectDeletionImpl; 35 36 import intt.itu.itut_x780.ManagedObjectValueType; 37 import org.omg.CosNaming.NameComponent ; 38 39 import ist.coach.itut_x780Components.CCM_ManagedObjectProvider_Context; 40 43 public class ManagedObjectProviderMonolithicImpl 44 extends org.omg.CORBA.LocalObject 45 implements CCM_ManagedObjectProvider, 46 ist.coach.itut_x780Components.CCM_ManagedObjectMgmt, 47 org.omg.Components.SessionComponent 48 { 49 private String _facade_name; 55 56 java.util.Hashtable elements; 57 private int notifId = 100; 58 61 private CCM_ManagedObjectProvider_Context the_context_; 62 70 public 71 ManagedObjectProviderMonolithicImpl() 72 { 73 the_context_ = null; 74 } 75 91 public CCM_ManagedObjectProvider_Context 92 getContext() 93 { 94 return the_context_; 95 } 96 110 public void 111 configuration_complete() 112 throws org.omg.Components.InvalidConfiguration 113 { 114 118 elements = new java.util.Hashtable (); 119 System.err.println(facade_name() + " configuration completed..."); 120 } 121 137 public void 138 set_session_context(org.omg.Components.SessionContext context) 139 throws org.omg.Components.CCMException 140 { 141 the_context_ = (CCM_ManagedObjectProvider_Context)context; 142 } 143 153 public void 154 ccm_activate() 155 throws org.omg.Components.CCMException 156 { 157 } 161 171 public void 172 ccm_passivate() 173 throws org.omg.Components.CCMException 174 { 175 } 179 189 public void 190 ccm_remove() 191 throws org.omg.Components.CCMException 192 { 193 } 197 208 public ist.coach.itut_x780Components.CCM_ManagedObjectMgmt 209 get_mgmt() 210 { 211 return this; 212 } 213 219 public java.lang.String 220 facade_name() 221 { 222 return _facade_name; 226 } 227 228 231 public void 232 facade_name(java.lang.String val) 233 { 234 if (val != null) 238 _facade_name = new String (val); 239 } 240 246 public NameComponent [] nameGet() { 247 return Utils.string2name(_facade_name); 248 } 249 255 public java.lang.String 256 objectClassGet(org.omg.CosNaming.NameComponent [] name) 257 throws intt.itu.itut_x780.ApplicationError 258 { 259 if ( ! elements.containsKey(Utils.name2string(name))) { 263 ApplicationErrorInfoTypeImpl error_code = 264 new ApplicationErrorInfoTypeImpl(); 265 error_code.error = new UIDType( 266 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 267 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 268 error_code.details = ExceptionMessages.not_exists_error; 269 270 throw new ApplicationError(error_code); 271 } 272 ManagedObjectValueType mo_value = 273 (ManagedObjectValueType) elements.get(Utils.name2string(name)); 274 return mo_value.objectClass; 275 } 276 282 public intt.itu.itut_x780.ManagedObjectValueType 283 attributesGet(org.omg.CosNaming.NameComponent [] name, 284 intt.itu.itut_x780.StringSetTypeHolder attributeNames) 285 throws intt.itu.itut_x780.ApplicationError 286 { 287 if ( ! elements.containsKey(Utils.name2string(name))) { 291 ApplicationErrorInfoTypeImpl error_code = 292 new ApplicationErrorInfoTypeImpl(); 293 error_code.error = new UIDType( 294 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 295 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 296 error_code.details = ExceptionMessages.not_exists_error; 297 298 throw new ApplicationError(error_code); 299 } 300 ManagedObjectValueType mo_value = 301 (ManagedObjectValueType) elements.get(Utils.name2string(name)); 302 return mo_value; 303 } 304 310 public java.lang.String [] 311 packagesGet(org.omg.CosNaming.NameComponent [] name) 312 throws intt.itu.itut_x780.ApplicationError 313 { 314 if ( ! elements.containsKey(Utils.name2string(name))) { 318 ApplicationErrorInfoTypeImpl error_code = 319 new ApplicationErrorInfoTypeImpl(); 320 error_code.error = new UIDType( 321 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 322 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 323 error_code.details = ExceptionMessages.not_exists_error; 324 325 throw new ApplicationError(error_code); 326 } 327 ManagedObjectValueType mo_value = 328 (ManagedObjectValueType) elements.get(Utils.name2string(name)); 329 return mo_value.packages; 330 } 331 338 public intt.itu.itut_x780.SourceIndicatorType 339 creationSourceGet(org.omg.CosNaming.NameComponent [] name) 340 throws intt.itu.itut_x780.ApplicationError 341 { 342 if ( ! elements.containsKey(Utils.name2string(name))) { 346 ApplicationErrorInfoTypeImpl error_code = 347 new ApplicationErrorInfoTypeImpl(); 348 error_code.error = new UIDType( 349 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 350 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 351 error_code.details = ExceptionMessages.not_exists_error; 352 353 throw new ApplicationError(error_code); 354 } 355 ManagedObjectValueType mo_value = 356 (ManagedObjectValueType) elements.get(Utils.name2string(name)); 357 return mo_value.creationSource; 358 } 359 365 public short 366 deletePolicyGet(org.omg.CosNaming.NameComponent [] name) 367 throws intt.itu.itut_x780.ApplicationError 368 { 369 373 if ( ! elements.containsKey(Utils.name2string(name))) { 374 ApplicationErrorInfoTypeImpl error_code = 375 new ApplicationErrorInfoTypeImpl(); 376 error_code.error = new UIDType( 377 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 378 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 379 error_code.details = ExceptionMessages.not_exists_error; 380 381 throw new ApplicationError(error_code); 382 } 383 ManagedObjectValueType mo_value = 384 (ManagedObjectValueType) elements.get(Utils.name2string(name)); 385 return mo_value.deletePolicy; 386 } 387 393 public void 394 destroy(org.omg.CosNaming.NameComponent [] name) 395 throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_x780.DeleteError 396 { 397 if ( ! elements.containsKey(Utils.name2string(name))) { 401 ApplicationErrorInfoTypeImpl error_code = 402 new ApplicationErrorInfoTypeImpl(); 403 error_code.error = new UIDType( 404 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 405 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 406 error_code.details = ExceptionMessages.not_exists_error; 407 408 throw new ApplicationError(error_code); 409 410 } 411 ManagedObjectValueType mo_value = 412 (ManagedObjectValueType) elements.remove(Utils.name2string(name)); 413 org.omg.TimeBase.UtcT eventTime = new org.omg.TimeBase.UtcT(System.currentTimeMillis(), 414 0,(short) 0,(short) 0); 415 the_context_.push_objectDeletion_alarm(new ObjectDeletionImpl(eventTime, name, 416 mo_value.objectClass, 417 getUniqueNotificationIdentifier(), 418 mo_value.creationSource, 419 new AttributeValueType[0])); 420 } 421 432 public void 433 create(org.omg.CosNaming.NameComponent [] name, 434 String objectClass, 435 String [] packages, 436 short deletePolicy, 437 intt.itu.itut_x780.SourceIndicatorType sourceIndicator) 438 throws intt.itu.itut_x780.CreateError, intt.itu.itut_x780.ApplicationError 439 { 440 if (elements.containsKey(Utils.name2string(name))) { 444 System.err.println(Utils.name2string(name) + " already exists!"); 445 CreateErrorInfoTypeImpl error_code = new CreateErrorInfoTypeImpl(); 446 error_code.error = new UIDType( 447 intt.itu.itut_x780.CreateErrorConst.moduleName.value, 448 intt.itu.itut_x780.CreateErrorConst.duplicateName.value); 449 450 error_code.details = ExceptionMessages.already_exists_error; 451 throw new CreateError(error_code); 452 } 453 ManagedObjectValueTypeImpl value_type = 454 new ManagedObjectValueTypeImpl(name, objectClass, packages, 455 sourceIndicator, deletePolicy); 456 457 elements.put(Utils.name2string(name), value_type); 458 459 org.omg.TimeBase.UtcT eventTime = new org.omg.TimeBase.UtcT(System.currentTimeMillis(), 460 0,(short) 0,(short) 0); 461 462 the_context_.push_objectCreation_alarm(new ObjectCreationImpl(eventTime, name, 464 objectClass, 465 getUniqueNotificationIdentifier(), 466 sourceIndicator, 467 new AttributeValueType[0])); 468 469 } 470 471 472 private int getUniqueNotificationIdentifier() { 473 474 notifId++; 475 476 return (notifId); 477 } 478 479 } 480 | Popular Tags |