1 21 package ist.coach.itut_m3120Components; 22 23 import intt.itu.itut_x780.UIDType; 24 import intt.itu.itut_x780.CreateError; 25 import intt.itu.itut_x780.ApplicationError; 26 import intt.itu.itut_x780.ManagedObjectValueType; 27 import intt.itu.itut_x780.AttributeValueChangeType; 28 import intt.itu.itut_x780.AttributeValueType; 29 import intt.itu.itut_x780.SourceIndicatorType; 30 import intt.itu.itut_x780.OperationalStateTypeHelper; 31 32 import intt.itu.itut_m3120.NOuserLabelPackageException; 33 import intt.itu.itut_m3120.NOvendorNamePackageException; 34 import intt.itu.itut_m3120.NOversionPackageException; 35 import intt.itu.itut_m3120.NOlocationNamePackageException; 36 import intt.itu.itut_m3120.ManagedElementValueType; 37 38 import ist.coach.coachEmfCommon.Utils; 39 import ist.coach.coachEmfCommon.StateChangedEventImpl; 40 import ist.coach.coachEmfCommon.ObjectCreationImpl; 41 import ist.coach.coachEmfCommon.ObjectDeletionImpl; 42 import ist.coach.coachEmfCommon.ExceptionMessages; 43 import ist.coach.coachEmfCommon.CreateErrorInfoTypeImpl; 44 import ist.coach.coachEmfCommon.ApplicationErrorInfoTypeImpl; 45 import ist.coach.coachEmfCommon.ManagedElementValueTypeImpl; 46 import java.util.Hashtable ; 47 48 52 public class ManagedElementProviderMonolithicImpl 53 extends org.omg.CORBA.LocalObject 54 implements CCM_ManagedElementProvider, 55 ist.coach.itut_m3120Components.CCM_ManagedElementMgmt, 56 org.omg.Components.SessionComponent 57 { 58 66 private CCM_ManagedElementProvider_Context the_context_; 67 private String _facade_name; 68 private int notifId = 200; 69 private Hashtable elements; 70 78 public 79 ManagedElementProviderMonolithicImpl() 80 { 81 the_context_ = null; 82 } 83 99 public CCM_ManagedElementProvider_Context 100 getContext() 101 { 102 return the_context_; 103 } 104 118 public void 119 configuration_complete() 120 throws org.omg.Components.InvalidConfiguration 121 { 122 elements = new java.util.Hashtable (); 126 System.err.println(facade_name() + " configuration completed..."); 127 } 128 144 public void 145 set_session_context(org.omg.Components.SessionContext context) 146 throws org.omg.Components.CCMException 147 { 148 the_context_ = (CCM_ManagedElementProvider_Context)context; 149 } 150 160 public void 161 ccm_activate() 162 throws org.omg.Components.CCMException 163 { 164 } 168 178 public void 179 ccm_passivate() 180 throws org.omg.Components.CCMException 181 { 182 } 186 196 public void 197 ccm_remove() 198 throws org.omg.Components.CCMException 199 { 200 } 204 215 public ist.coach.itut_m3120Components.CCM_ManagedElementMgmt 216 get_mgmt() 217 { 218 return this; 219 } 220 226 public java.lang.String 227 facade_name() 228 { 229 return _facade_name; 233 } 234 235 238 public void 239 facade_name(java.lang.String val) 240 { 241 if (val != null) 245 _facade_name = new String (val); 246 } 247 253 public intt.itu.itut_x780.AdministrativeStateType 254 administrativeStateGet(org.omg.CosNaming.NameComponent [] name) 255 throws intt.itu.itut_x780.ApplicationError 256 { 257 String key = Utils.name2string(name); 261 if (this.elements.containsKey(key) == false) { 262 263 ApplicationErrorInfoTypeImpl error_code = 264 new ApplicationErrorInfoTypeImpl(); 265 266 error_code.error = new UIDType( 267 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 268 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 269 270 error_code.details = new String ("object with name" + 271 key + " does not exist."); 272 273 throw new ApplicationError(error_code); 274 } 275 ManagedElementValueType mo_value = 276 (ManagedElementValueType) elements.get(key); 277 278 return mo_value.administrativeState; 279 } 280 286 public void 287 administrativeStateSet(org.omg.CosNaming.NameComponent [] name, 288 intt.itu.itut_x780.AdministrativeStateType administrativeState) 289 throws intt.itu.itut_x780.ApplicationError 290 { 291 String key = Utils.name2string(name); 295 if (this.elements.containsKey(key) == false) { 296 297 ApplicationErrorInfoTypeImpl error_code = 298 new ApplicationErrorInfoTypeImpl(); 299 300 error_code.error = new UIDType( 301 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 302 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 303 304 error_code.details = new String ("object with name " + 305 key + " does not exist."); 306 307 throw new ApplicationError(error_code); 308 } 309 ManagedElementValueType mo_value = 310 (ManagedElementValueType) elements.remove(key); 311 mo_value.administrativeState = administrativeState; 312 elements.put(key, mo_value); 313 } 314 320 public intt.itu.itut_x780.OperationalStateType 321 operationalStateGet(org.omg.CosNaming.NameComponent [] name) 322 throws intt.itu.itut_x780.ApplicationError 323 { 324 String key = Utils.name2string(name); 328 if (this.elements.containsKey(key) == false) { 329 330 ApplicationErrorInfoTypeImpl error_code = 331 new ApplicationErrorInfoTypeImpl(); 332 333 error_code.error = new UIDType( 334 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 335 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 336 337 error_code.details = new String ("object with name" + 338 key + " does not exist."); 339 340 throw new ApplicationError(error_code); 341 } 342 ManagedElementValueType mo_value = 343 (ManagedElementValueType) elements.get(key); 344 345 return mo_value.operationalState; 346 347 } 348 349 355 public intt.itu.itut_x780.UsageStateType 356 usageStateGet(org.omg.CosNaming.NameComponent [] name) 357 throws intt.itu.itut_x780.ApplicationError 358 { 359 String key = Utils.name2string(name); 363 if (this.elements.containsKey(key) == false) { 364 365 ApplicationErrorInfoTypeImpl error_code = 366 new ApplicationErrorInfoTypeImpl(); 367 368 error_code.error = new UIDType( 369 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 370 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 371 372 error_code.details = new String ("object with name" + 373 key + " does not exist."); 374 375 throw new ApplicationError(error_code); 376 } 377 ManagedElementValueType mo_value = 378 (ManagedElementValueType) elements.get(key); 379 380 return mo_value.usageState; 381 382 } 383 389 public java.lang.String 390 userLabelGet(org.omg.CosNaming.NameComponent [] name) 391 throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_m3120.NOuserLabelPackageException 392 { 393 String key = Utils.name2string(name); 397 if (this.elements.containsKey(key) == false) { 398 399 ApplicationErrorInfoTypeImpl error_code = 400 new ApplicationErrorInfoTypeImpl(); 401 402 error_code.error = new UIDType( 403 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 404 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 405 406 error_code.details = new String ("object with name" + 407 key + " does not exist."); 408 409 throw new ApplicationError(error_code); 410 } 411 ManagedElementValueType mo_value = 412 (ManagedElementValueType) elements.get(key); 413 414 return mo_value.userLabel; 415 416 } 417 423 public void 424 userLabelSet(org.omg.CosNaming.NameComponent [] name, java.lang.String userLabel) 425 throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_m3120.NOuserLabelPackageException 426 { 427 String key = Utils.name2string(name); 431 if (this.elements.containsKey(key) == false) { 432 433 ApplicationErrorInfoTypeImpl error_code = 434 new ApplicationErrorInfoTypeImpl(); 435 436 error_code.error = new UIDType( 437 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 438 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 439 440 error_code.details = new String ("object with name " + 441 key + " does not exist."); 442 443 throw new ApplicationError(error_code); 444 } 445 ManagedElementValueType mo_value = 446 (ManagedElementValueType) elements.remove(key); 447 mo_value.userLabel = userLabel; 448 elements.put(key, mo_value); 449 } 450 456 public java.lang.String 457 vendorNameGet(org.omg.CosNaming.NameComponent [] name) 458 throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_m3120.NOvendorNamePackageException 459 { 460 String key = Utils.name2string(name); 464 if (this.elements.containsKey(key) == false) { 465 466 ApplicationErrorInfoTypeImpl error_code = 467 new ApplicationErrorInfoTypeImpl(); 468 469 error_code.error = new UIDType( 470 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 471 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 472 473 error_code.details = new String ("object with name" + 474 key + " does not exist."); 475 476 throw new ApplicationError(error_code); 477 } 478 ManagedElementValueType mo_value = 479 (ManagedElementValueType) elements.get(key); 480 481 return mo_value.vendorName; 482 483 } 484 490 public void 491 vendorNameSet(org.omg.CosNaming.NameComponent [] name, java.lang.String vendorName) 492 throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_m3120.NOvendorNamePackageException 493 { 494 String key = Utils.name2string(name); 498 if (this.elements.containsKey(key) == false) { 499 500 ApplicationErrorInfoTypeImpl error_code = 501 new ApplicationErrorInfoTypeImpl(); 502 503 error_code.error = new UIDType( 504 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 505 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 506 507 error_code.details = new String ("object with name " + 508 key + " does not exist."); 509 510 throw new ApplicationError(error_code); 511 } 512 ManagedElementValueType mo_value = 513 (ManagedElementValueType) elements.remove(key); 514 mo_value.vendorName = vendorName; 515 elements.put(key, mo_value); 516 } 517 523 public java.lang.String 524 versionGet(org.omg.CosNaming.NameComponent [] name) 525 throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_m3120.NOversionPackageException 526 { 527 String key = Utils.name2string(name); 531 if (this.elements.containsKey(key) == false) { 532 533 ApplicationErrorInfoTypeImpl error_code = 534 new ApplicationErrorInfoTypeImpl(); 535 536 error_code.error = new UIDType( 537 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 538 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 539 540 error_code.details = new String ("object with name" + 541 key + " does not exist."); 542 543 throw new ApplicationError(error_code); 544 } 545 ManagedElementValueType mo_value = 546 (ManagedElementValueType) elements.get(key); 547 548 return mo_value.version; 549 } 550 556 public void 557 versionSet(org.omg.CosNaming.NameComponent [] name, java.lang.String version) 558 throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_m3120.NOversionPackageException 559 { 560 String key = Utils.name2string(name); 564 if (this.elements.containsKey(key) == false) { 565 566 ApplicationErrorInfoTypeImpl error_code = 567 new ApplicationErrorInfoTypeImpl(); 568 569 error_code.error = new UIDType( 570 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 571 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 572 573 error_code.details = new String ("object with name " + 574 key + " does not exist."); 575 576 throw new ApplicationError(error_code); 577 } 578 ManagedElementValueType mo_value = 579 (ManagedElementValueType) elements.remove(key); 580 mo_value.version = version; 581 elements.put(key, mo_value); 582 583 } 584 590 public java.lang.String 591 locationNameGet(org.omg.CosNaming.NameComponent [] name) 592 throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_m3120.NOlocationNamePackageException 593 { 594 String key = Utils.name2string(name); 598 if (this.elements.containsKey(key) == false) { 599 600 ApplicationErrorInfoTypeImpl error_code = 601 new ApplicationErrorInfoTypeImpl(); 602 603 error_code.error = new UIDType( 604 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 605 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 606 607 error_code.details = new String ("object with name" + 608 key + " does not exist."); 609 610 throw new ApplicationError(error_code); 611 } 612 ManagedElementValueType mo_value = 613 (ManagedElementValueType) elements.get(key); 614 615 return mo_value.locationName; 616 617 } 618 624 public void 625 locationNameSet(org.omg.CosNaming.NameComponent [] name, java.lang.String locationName) 626 throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_m3120.NOlocationNamePackageException 627 { 628 String key = Utils.name2string(name); 632 if (this.elements.containsKey(key) == false) { 633 634 ApplicationErrorInfoTypeImpl error_code = 635 new ApplicationErrorInfoTypeImpl(); 636 637 error_code.error = new UIDType( 638 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 639 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 640 641 error_code.details = new String ("object with name " + 642 key + " does not exist."); 643 644 throw new ApplicationError(error_code); 645 } 646 ManagedElementValueType mo_value = 647 (ManagedElementValueType) elements.remove(key); 648 mo_value.locationName = locationName; 649 elements.put(key, mo_value); 650 } 651 657 public org.omg.CosNaming.NameComponent [] 658 nameGet() 659 { 660 return Utils.string2name(_facade_name); 664 } 665 671 public java.lang.String 672 objectClassGet(org.omg.CosNaming.NameComponent [] name) 673 throws intt.itu.itut_x780.ApplicationError 674 { 675 if ( ! elements.containsKey(Utils.name2string(name))) { 679 ApplicationErrorInfoTypeImpl error_code = 680 new ApplicationErrorInfoTypeImpl(); 681 error_code.error = new UIDType( 682 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 683 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 684 error_code.details = ExceptionMessages.not_exists_error; 685 686 throw new ApplicationError(error_code); 687 } 688 ManagedObjectValueType mo_value = 689 (ManagedObjectValueType) elements.get(Utils.name2string(name)); 690 return mo_value.objectClass; 691 } 692 698 public intt.itu.itut_x780.ManagedObjectValueType 699 attributesGet(org.omg.CosNaming.NameComponent [] name, intt.itu.itut_x780.StringSetTypeHolder attributeNames) 700 throws intt.itu.itut_x780.ApplicationError 701 { 702 if ( ! elements.containsKey(Utils.name2string(name))) { 706 ApplicationErrorInfoTypeImpl error_code = 707 new ApplicationErrorInfoTypeImpl(); 708 error_code.error = new UIDType( 709 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 710 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 711 error_code.details = ExceptionMessages.not_exists_error; 712 713 throw new ApplicationError(error_code); 714 } 715 ManagedElementValueType mo_value = 716 (ManagedElementValueType) elements.get(Utils.name2string(name)); 717 return mo_value; 718 } 719 725 public java.lang.String [] 726 packagesGet(org.omg.CosNaming.NameComponent [] name) 727 throws intt.itu.itut_x780.ApplicationError 728 { 729 if ( ! elements.containsKey(Utils.name2string(name))) { 733 ApplicationErrorInfoTypeImpl error_code = 734 new ApplicationErrorInfoTypeImpl(); 735 error_code.error = new UIDType( 736 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 737 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 738 error_code.details = ExceptionMessages.not_exists_error; 739 740 throw new ApplicationError(error_code); 741 } 742 ManagedObjectValueType mo_value = 743 (ManagedObjectValueType) elements.get(Utils.name2string(name)); 744 return mo_value.packages; 745 } 746 752 public intt.itu.itut_x780.SourceIndicatorType 753 creationSourceGet(org.omg.CosNaming.NameComponent [] name) 754 throws intt.itu.itut_x780.ApplicationError 755 { 756 if ( ! elements.containsKey(Utils.name2string(name))) { 760 ApplicationErrorInfoTypeImpl error_code = 761 new ApplicationErrorInfoTypeImpl(); 762 error_code.error = new UIDType( 763 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 764 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 765 error_code.details = ExceptionMessages.not_exists_error; 766 767 throw new ApplicationError(error_code); 768 } 769 ManagedObjectValueType mo_value = 770 (ManagedObjectValueType) elements.get(Utils.name2string(name)); 771 return mo_value.creationSource; 772 } 773 779 public short 780 deletePolicyGet(org.omg.CosNaming.NameComponent [] name) 781 throws intt.itu.itut_x780.ApplicationError 782 { 783 if ( ! elements.containsKey(Utils.name2string(name))) { 787 ApplicationErrorInfoTypeImpl error_code = 788 new ApplicationErrorInfoTypeImpl(); 789 error_code.error = new UIDType( 790 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 791 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 792 error_code.details = ExceptionMessages.not_exists_error; 793 794 throw new ApplicationError(error_code); 795 } 796 ManagedObjectValueType mo_value = 797 (ManagedObjectValueType) elements.get(Utils.name2string(name)); 798 return mo_value.deletePolicy; 799 800 } 801 807 public void 808 destroy(org.omg.CosNaming.NameComponent [] name) 809 throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_x780.DeleteError 810 { 811 if ( ! elements.containsKey(Utils.name2string(name))) { 815 ApplicationErrorInfoTypeImpl error_code = 816 new ApplicationErrorInfoTypeImpl(); 817 error_code.error = new UIDType( 818 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 819 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 820 error_code.details = ExceptionMessages.not_exists_error; 821 822 throw new ApplicationError(error_code); 823 824 } 825 ManagedElementValueType mo_value = 826 (ManagedElementValueType) elements.remove(Utils.name2string(name)); 827 org.omg.TimeBase.UtcT eventTime = new org.omg.TimeBase.UtcT(System.currentTimeMillis(), 828 0,(short) 0,(short) 0); 829 the_context_.push_objectDeletion_alarm(new ObjectDeletionImpl(eventTime, name, 830 mo_value.objectClass, 831 getUniqueNotificationIdentifier(), 832 mo_value.creationSource, 833 new AttributeValueType[0])); 834 } 835 846 public void 847 create(org.omg.CosNaming.NameComponent [] name, java.lang.String objectClass, 848 java.lang.String [] packages, short deletePolicy, 849 intt.itu.itut_x780.SourceIndicatorType sourceIndicator, 850 intt.itu.itut_x780.AdministrativeStateType administrativeState, 851 java.lang.String userLabel, java.lang.String vendorName, 852 java.lang.String version, java.lang.String locationName) 853 throws intt.itu.itut_x780.CreateError, intt.itu.itut_x780.ApplicationError 854 { 855 if (elements.containsKey(Utils.name2string(name))) { 859 System.err.println(Utils.name2string(name) + " already exists!"); 860 CreateErrorInfoTypeImpl error_code = new CreateErrorInfoTypeImpl(); 861 error_code.error = new UIDType( 862 intt.itu.itut_x780.CreateErrorConst.moduleName.value, 863 intt.itu.itut_x780.CreateErrorConst.duplicateName.value); 864 865 error_code.details = ExceptionMessages.already_exists_error; 866 throw new CreateError(error_code); 867 } 868 ManagedElementValueTypeImpl value_type = 869 new ManagedElementValueTypeImpl(name, objectClass, packages, 870 sourceIndicator, deletePolicy, administrativeState, 871 userLabel, vendorName, version, locationName); 872 873 elements.put(Utils.name2string(name), value_type); 874 875 org.omg.TimeBase.UtcT eventTime = new org.omg.TimeBase.UtcT(System.currentTimeMillis(), 876 0,(short) 0,(short) 0); 877 878 the_context_.push_objectCreation_alarm(new ObjectCreationImpl(eventTime, name, 880 objectClass, 881 getUniqueNotificationIdentifier(), 882 sourceIndicator, 883 new AttributeValueType[0])); 884 885 } 886 private int getUniqueNotificationIdentifier() { 887 888 notifId++; 889 890 return (notifId); 891 } 892 } 893 | Popular Tags |