1 28 29 package ist.coach.itut_m3120Components.ManagedElementProviderComposition; 30 31 import intt.itu.itut_x780.UIDType; 32 33 import intt.itu.itut_x780.ApplicationError; 34 import intt.itu.itut_x780.ManagedObjectValueType; 35 import intt.itu.itut_x780.AttributeValueChangeType; 36 import intt.itu.itut_x780.AttributeValueType; 37 import intt.itu.itut_x780.SourceIndicatorType; 38 import intt.itu.itut_x780.OperationalStateTypeHelper; 39 40 import intt.itu.itut_m3120.NOuserLabelPackageException; 41 import intt.itu.itut_m3120.NOvendorNamePackageException; 42 import intt.itu.itut_m3120.NOversionPackageException; 43 import intt.itu.itut_m3120.NOlocationNamePackageException; 44 import intt.itu.itut_m3120.ManagedElementValueType; 45 46 import ist.coach.coachEmfCommon.Utils; 47 import ist.coach.coachEmfCommon.ExceptionMessages; 48 import ist.coach.coachEmfCommon.StateChangedEventImpl; 49 import ist.coach.coachEmfCommon.ObjectDeletionImpl; 50 51 import ist.coach.coachEmfCommon.ApplicationErrorInfoTypeImpl; 52 53 import java.util.Hashtable ; 54 import ist.coach.coachEmfServices.EmfBasicLog.*; 55 61 public class ManagedElementProviderImpl 62 extends ist.coach.itut_m3120Components.ManagedElementProviderComposition.ManagedElementProvider_impl 63 { 64 private String _facade_name; 70 private static int notifId = 200; 71 protected static Hashtable elements; 72 private BasicLog logSupport; 73 79 public ManagedElementProviderImpl() 80 { 81 elements = new java.util.Hashtable (); 82 } 83 97 public void 98 configuration_complete() 99 throws org.omg.Components.InvalidConfiguration 100 { 101 if ((logSupport = get_context().get_connection_basic_log()) == null) 105 throw new org.omg.Components.InvalidConfiguration(); 106 107 System.err.println(facade_name() + " configuration completed..."); 108 } 109 protected static synchronized int getUniqueNotificationIdentifier() { 115 116 notifId++; 117 118 return (notifId); 119 } 120 126 129 public String 130 facade_name() 131 { 132 return _facade_name; 136 } 137 138 141 public void 142 facade_name(String facade_name) 143 { 144 if (facade_name != null) 148 _facade_name = new String (facade_name); 149 } 150 151 154 public intt.itu.itut_x780.AdministrativeStateType 155 administrativeStateGet(org.omg.CosNaming.NameComponent [] name) 156 throws intt.itu.itut_x780.ApplicationError 157 { 158 String key = Utils.name2string(name); 162 if (this.elements.containsKey(key) == false) { 163 164 ApplicationErrorInfoTypeImpl error_code = 165 new ApplicationErrorInfoTypeImpl(); 166 167 error_code.error = new UIDType( 168 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 169 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 170 171 error_code.details = new String ("object with name" + 172 key + " does not exist."); 173 174 throw new ApplicationError(error_code); 175 } 176 ManagedElementValueType mo_value = 177 (ManagedElementValueType) elements.get(key); 178 179 return mo_value.administrativeState; 180 } 181 182 185 public void 186 administrativeStateSet(org.omg.CosNaming.NameComponent [] name, intt.itu.itut_x780.AdministrativeStateType administrativeState) 187 throws intt.itu.itut_x780.ApplicationError 188 { 189 String key = Utils.name2string(name); 193 if (this.elements.containsKey(key) == false) { 194 195 ApplicationErrorInfoTypeImpl error_code = 196 new ApplicationErrorInfoTypeImpl(); 197 198 error_code.error = new UIDType( 199 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 200 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 201 202 error_code.details = new String ("object with name " + 203 key + " does not exist."); 204 205 throw new ApplicationError(error_code); 206 } 207 synchronized(elements) { 208 ManagedElementValueType mo_value = 209 (ManagedElementValueType) elements.remove(key); 210 mo_value.administrativeState = administrativeState; 211 212 elements.put(key, mo_value); 213 } 214 Utils.pretty_log(logSupport, Utils.name2string(name), objectClassGet(name), 215 (short) LogSeverity._Info, 216 "AdministrativeState set to " + administrativeState); 217 } 218 219 222 public intt.itu.itut_x780.OperationalStateType 223 operationalStateGet(org.omg.CosNaming.NameComponent [] name) 224 throws intt.itu.itut_x780.ApplicationError 225 { 226 String key = Utils.name2string(name); 230 if (this.elements.containsKey(key) == false) { 231 232 ApplicationErrorInfoTypeImpl error_code = 233 new ApplicationErrorInfoTypeImpl(); 234 235 error_code.error = new UIDType( 236 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 237 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 238 239 error_code.details = new String ("object with name" + 240 key + " does not exist."); 241 242 throw new ApplicationError(error_code); 243 } 244 ManagedElementValueType mo_value = 245 (ManagedElementValueType) elements.get(key); 246 247 return mo_value.operationalState; 248 249 } 250 251 254 public intt.itu.itut_x780.UsageStateType 255 usageStateGet(org.omg.CosNaming.NameComponent [] name) 256 throws intt.itu.itut_x780.ApplicationError 257 { 258 String key = Utils.name2string(name); 262 if (this.elements.containsKey(key) == false) { 263 264 ApplicationErrorInfoTypeImpl error_code = 265 new ApplicationErrorInfoTypeImpl(); 266 267 error_code.error = new UIDType( 268 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 269 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 270 271 error_code.details = new String ("object with name" + 272 key + " does not exist."); 273 274 throw new ApplicationError(error_code); 275 } 276 ManagedElementValueType mo_value = 277 (ManagedElementValueType) elements.get(key); 278 279 return mo_value.usageState; 280 281 } 282 283 286 public String 287 userLabelGet(org.omg.CosNaming.NameComponent [] name) 288 throws intt.itu.itut_x780.ApplicationError, 289 290 intt.itu.itut_m3120.NOuserLabelPackageException 291 { 292 String key = Utils.name2string(name); 296 if (this.elements.containsKey(key) == false) { 297 298 ApplicationErrorInfoTypeImpl error_code = 299 new ApplicationErrorInfoTypeImpl(); 300 301 error_code.error = new UIDType( 302 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 303 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 304 305 error_code.details = new String ("object with name" + 306 key + " does not exist."); 307 308 throw new ApplicationError(error_code); 309 } 310 ManagedElementValueType mo_value = 311 (ManagedElementValueType) elements.get(key); 312 313 return mo_value.userLabel; 314 } 315 316 319 public void 320 userLabelSet(org.omg.CosNaming.NameComponent [] name, String userLabel) 321 throws intt.itu.itut_x780.ApplicationError, 322 323 intt.itu.itut_m3120.NOuserLabelPackageException 324 { 325 String key = Utils.name2string(name); 329 if (this.elements.containsKey(key) == false) { 330 331 ApplicationErrorInfoTypeImpl error_code = 332 new ApplicationErrorInfoTypeImpl(); 333 334 error_code.error = new UIDType( 335 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 336 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 337 338 error_code.details = new String ("object with name " + 339 key + " does not exist."); 340 341 throw new ApplicationError(error_code); 342 } 343 synchronized(elements) { 344 ManagedElementValueType mo_value = 345 (ManagedElementValueType) elements.remove(key); 346 mo_value.userLabel = userLabel; 347 348 elements.put(key, mo_value); 349 } 350 Utils.pretty_log(logSupport, Utils.name2string(name), objectClassGet(name), 351 (short) LogSeverity._Info, 352 "User Label set to " + userLabel); 353 } 354 355 358 public String 359 vendorNameGet(org.omg.CosNaming.NameComponent [] name) 360 throws intt.itu.itut_x780.ApplicationError, 361 362 intt.itu.itut_m3120.NOvendorNamePackageException 363 { 364 String key = Utils.name2string(name); 368 if (this.elements.containsKey(key) == false) { 369 370 ApplicationErrorInfoTypeImpl error_code = 371 new ApplicationErrorInfoTypeImpl(); 372 373 error_code.error = new UIDType( 374 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 375 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 376 377 error_code.details = new String ("object with name" + 378 key + " does not exist."); 379 380 throw new ApplicationError(error_code); 381 } 382 ManagedElementValueType mo_value = 383 (ManagedElementValueType) elements.get(key); 384 385 return mo_value.vendorName; 386 } 387 388 391 public void 392 vendorNameSet(org.omg.CosNaming.NameComponent [] name, String vendorName) 393 throws intt.itu.itut_x780.ApplicationError, 394 395 intt.itu.itut_m3120.NOvendorNamePackageException 396 { 397 String key = Utils.name2string(name); 401 if (this.elements.containsKey(key) == false) { 402 403 ApplicationErrorInfoTypeImpl error_code = 404 new ApplicationErrorInfoTypeImpl(); 405 406 error_code.error = new UIDType( 407 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 408 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 409 410 error_code.details = new String ("object with name " + 411 key + " does not exist."); 412 413 throw new ApplicationError(error_code); 414 } 415 416 synchronized(elements) { 417 ManagedElementValueType mo_value = 418 (ManagedElementValueType) elements.remove(key); 419 mo_value.vendorName = vendorName; 420 421 elements.put(key, mo_value); 422 } 423 Utils.pretty_log(logSupport, Utils.name2string(name), objectClassGet(name), 424 (short) LogSeverity._Info, 425 "Vendor Name set to " + vendorName); 426 } 427 428 431 public String 432 versionGet(org.omg.CosNaming.NameComponent [] name) 433 throws intt.itu.itut_x780.ApplicationError, 434 435 intt.itu.itut_m3120.NOversionPackageException 436 { 437 String key = Utils.name2string(name); 441 if (this.elements.containsKey(key) == false) { 442 443 ApplicationErrorInfoTypeImpl error_code = 444 new ApplicationErrorInfoTypeImpl(); 445 446 error_code.error = new UIDType( 447 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 448 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 449 450 error_code.details = new String ("object with name" + 451 key + " does not exist."); 452 453 throw new ApplicationError(error_code); 454 } 455 ManagedElementValueType mo_value = 456 (ManagedElementValueType) elements.get(key); 457 458 return mo_value.version; 459 } 460 461 464 public void 465 versionSet(org.omg.CosNaming.NameComponent [] name, String version) 466 throws intt.itu.itut_x780.ApplicationError, 467 468 intt.itu.itut_m3120.NOversionPackageException 469 { 470 String key = Utils.name2string(name); 474 if (this.elements.containsKey(key) == false) { 475 476 ApplicationErrorInfoTypeImpl error_code = 477 new ApplicationErrorInfoTypeImpl(); 478 479 error_code.error = new UIDType( 480 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 481 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 482 483 error_code.details = new String ("object with name " + 484 key + " does not exist."); 485 486 throw new ApplicationError(error_code); 487 } 488 synchronized(elements) { 489 ManagedElementValueType mo_value = 490 (ManagedElementValueType) elements.remove(key); 491 mo_value.version = version; 492 493 elements.put(key, mo_value); 494 } 495 Utils.pretty_log(logSupport, Utils.name2string(name), objectClassGet(name), 496 (short) LogSeverity._Info, 497 "Version set to " + version); 498 } 499 500 503 public String 504 locationNameGet(org.omg.CosNaming.NameComponent [] name) 505 throws intt.itu.itut_x780.ApplicationError, 506 507 intt.itu.itut_m3120.NOlocationNamePackageException 508 { 509 String key = Utils.name2string(name); 513 if (this.elements.containsKey(key) == false) { 514 515 ApplicationErrorInfoTypeImpl error_code = 516 new ApplicationErrorInfoTypeImpl(); 517 518 error_code.error = new UIDType( 519 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 520 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 521 522 error_code.details = new String ("object with name" + 523 key + " does not exist."); 524 525 throw new ApplicationError(error_code); 526 } 527 ManagedElementValueType mo_value = 528 (ManagedElementValueType) elements.get(key); 529 530 return mo_value.locationName; 531 532 } 533 534 537 public void 538 locationNameSet(org.omg.CosNaming.NameComponent [] name, String locationName) 539 throws intt.itu.itut_x780.ApplicationError, 540 541 intt.itu.itut_m3120.NOlocationNamePackageException 542 { 543 String key = Utils.name2string(name); 547 if (this.elements.containsKey(key) == false) { 548 549 ApplicationErrorInfoTypeImpl error_code = 550 new ApplicationErrorInfoTypeImpl(); 551 552 error_code.error = new UIDType( 553 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 554 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 555 556 error_code.details = new String ("object with name " + 557 key + " does not exist."); 558 559 throw new ApplicationError(error_code); 560 } 561 synchronized(elements) { 562 ManagedElementValueType mo_value = 563 (ManagedElementValueType) elements.remove(key); 564 mo_value.locationName = locationName; 565 566 elements.put(key, mo_value); 567 } 568 Utils.pretty_log(logSupport, Utils.name2string(name), objectClassGet(name), 569 (short) LogSeverity._Info, 570 "Location Name set to " + locationName); 571 } 572 573 576 public org.omg.CosNaming.NameComponent [] 577 nameGet() 578 { 579 return Utils.string2name(_facade_name); 583 } 584 585 588 public String 589 objectClassGet(org.omg.CosNaming.NameComponent [] name) 590 throws intt.itu.itut_x780.ApplicationError 591 { 592 if ( ! elements.containsKey(Utils.name2string(name))) { 596 ApplicationErrorInfoTypeImpl error_code = 597 new ApplicationErrorInfoTypeImpl(); 598 error_code.error = new UIDType( 599 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 600 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 601 error_code.details = ExceptionMessages.not_exists_error; 602 603 throw new ApplicationError(error_code); 604 } 605 ManagedObjectValueType mo_value = 606 (ManagedObjectValueType) elements.get(Utils.name2string(name)); 607 return mo_value.objectClass; 608 } 609 610 613 public intt.itu.itut_x780.ManagedObjectValueType 614 attributesGet(org.omg.CosNaming.NameComponent [] name, intt.itu.itut_x780.StringSetTypeHolder attributeNames) 615 throws intt.itu.itut_x780.ApplicationError 616 { 617 if ( ! elements.containsKey(Utils.name2string(name))) { 621 ApplicationErrorInfoTypeImpl error_code = 622 new ApplicationErrorInfoTypeImpl(); 623 error_code.error = new UIDType( 624 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 625 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 626 error_code.details = ExceptionMessages.not_exists_error; 627 628 throw new ApplicationError(error_code); 629 } 630 ManagedElementValueType mo_value = 631 (ManagedElementValueType) elements.get(Utils.name2string(name)); 632 Utils.pretty_log(logSupport, Utils.name2string(name), objectClassGet(name), 633 (short) LogSeverity._Info, 634 "attributesGet finished successfully"); 635 return mo_value; 636 } 637 638 641 public String [] 642 packagesGet(org.omg.CosNaming.NameComponent [] name) 643 throws intt.itu.itut_x780.ApplicationError 644 { 645 if ( ! elements.containsKey(Utils.name2string(name))) { 649 ApplicationErrorInfoTypeImpl error_code = 650 new ApplicationErrorInfoTypeImpl(); 651 error_code.error = new UIDType( 652 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 653 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 654 error_code.details = ExceptionMessages.not_exists_error; 655 656 throw new ApplicationError(error_code); 657 } 658 ManagedObjectValueType mo_value = 659 (ManagedObjectValueType) elements.get(Utils.name2string(name)); 660 return mo_value.packages; 661 } 662 663 666 public intt.itu.itut_x780.SourceIndicatorType 667 creationSourceGet(org.omg.CosNaming.NameComponent [] name) 668 throws intt.itu.itut_x780.ApplicationError 669 { 670 if ( ! elements.containsKey(Utils.name2string(name))) { 674 ApplicationErrorInfoTypeImpl error_code = 675 new ApplicationErrorInfoTypeImpl(); 676 error_code.error = new UIDType( 677 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 678 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 679 error_code.details = ExceptionMessages.not_exists_error; 680 681 throw new ApplicationError(error_code); 682 } 683 ManagedObjectValueType mo_value = 684 (ManagedObjectValueType) elements.get(Utils.name2string(name)); 685 return mo_value.creationSource; 686 } 687 688 691 public short 692 deletePolicyGet(org.omg.CosNaming.NameComponent [] name) 693 throws intt.itu.itut_x780.ApplicationError 694 { 695 if ( ! elements.containsKey(Utils.name2string(name))) { 699 ApplicationErrorInfoTypeImpl error_code = 700 new ApplicationErrorInfoTypeImpl(); 701 error_code.error = new UIDType( 702 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 703 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 704 error_code.details = ExceptionMessages.not_exists_error; 705 706 throw new ApplicationError(error_code); 707 } 708 ManagedObjectValueType mo_value = 709 (ManagedObjectValueType) elements.get(Utils.name2string(name)); 710 return mo_value.deletePolicy; 711 712 } 713 714 717 public void 718 destroy(org.omg.CosNaming.NameComponent [] name) 719 throws intt.itu.itut_x780.ApplicationError, 720 721 intt.itu.itut_x780.DeleteError 722 { 723 if ( ! elements.containsKey(Utils.name2string(name))) { 727 ApplicationErrorInfoTypeImpl error_code = 728 new ApplicationErrorInfoTypeImpl(); 729 error_code.error = new UIDType( 730 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 731 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 732 error_code.details = ExceptionMessages.not_exists_error; 733 734 throw new ApplicationError(error_code); 735 736 } 737 ManagedElementValueType mo_value =null; 738 synchronized(elements) { 739 mo_value = (ManagedElementValueType) elements.remove(Utils.name2string(name)); 740 } 741 org.omg.TimeBase.UtcT eventTime = new org.omg.TimeBase.UtcT(System.currentTimeMillis(), 742 0,(short) 0,(short) 0); 743 get_context().push_objectDeletion_alarm(new ObjectDeletionImpl(eventTime, name, 744 mo_value.objectClass, 745 getUniqueNotificationIdentifier(), 746 mo_value.creationSource, 747 new AttributeValueType[0])); 748 } 749 750 } 751 | Popular Tags |