1 25 26 package org.objectweb.jonas.jmx; 27 28 import java.util.ArrayList ; 29 import java.util.Collections ; 30 import java.util.Iterator ; 31 import java.util.List ; 32 33 import javax.management.MBeanServer ; 34 import javax.management.MBeanServerConnection ; 35 import javax.management.ObjectName ; 36 37 43 public class J2eeObjectName { 44 45 private static MBeanServerConnection localManagementRepr = null; 46 47 50 private J2eeObjectName() { 51 } 52 53 57 public static final String ALL = "*"; 58 59 62 public static final String NONE = "none"; 63 64 69 public static ObjectName getObjectName(String pObjectName) { 70 try { 71 return ObjectName.getInstance(pObjectName); 72 } catch (javax.management.MalformedObjectNameException e) { 73 return null; 75 } 76 } 77 78 85 public static List queryObjectNames(ObjectName pOn) throws ManagementException { 86 ArrayList al = new ArrayList (); 87 if (localManagementRepr == null) { 88 localManagementRepr = ManagementReprFactory.getLocalManagementRepr(); 89 if (localManagementRepr == null) { 90 return al; 91 } 92 } 93 Iterator itNames = ((MBeanServer ) localManagementRepr).queryNames(pOn, null).iterator(); 94 while (itNames.hasNext()) { 95 al.add(itNames.next()); 96 } 97 return al; 98 } 99 100 107 public static List queryStrings(ObjectName pOn) throws ManagementException { 108 ArrayList al = new ArrayList (); 109 if (localManagementRepr == null) { 110 localManagementRepr = ManagementReprFactory.getLocalManagementRepr(); 111 if (localManagementRepr == null) { 112 return al; 113 } 114 } 115 Iterator itNames = ((MBeanServer ) localManagementRepr).queryNames(pOn, null).iterator(); 116 while (itNames.hasNext()) { 117 ObjectName item = (ObjectName ) itNames.next(); 118 al.add(item.toString()); 119 } 120 Collections.sort(al); 121 return al; 122 } 123 124 public static ObjectName J2EEDomain(String pDomain) { 125 try { 126 StringBuffer sb = new StringBuffer (pDomain); 127 sb.append(":j2eeType=J2EEDomain"); 128 sb.append(",name="); 129 sb.append(pDomain); 130 return new ObjectName (sb.toString()); 131 } catch (javax.management.MalformedObjectNameException e) { 132 return null; 134 } 135 } 136 137 public static ObjectName J2EEDomains() { 138 try { 139 StringBuffer sb = new StringBuffer (ALL); 140 sb.append(":j2eeType=J2EEDomain"); 141 sb.append(","); 142 sb.append(ALL); 143 return new ObjectName (sb.toString()); 144 } catch (javax.management.MalformedObjectNameException e) { 145 return null; 147 } 148 } 149 150 public static ObjectName J2EEServers() { 151 try { 152 StringBuffer sb = new StringBuffer (ALL); 153 sb.append(":j2eeType=J2EEServer"); 154 sb.append(","); 155 sb.append(ALL); 156 return new ObjectName (sb.toString()); 157 } catch (javax.management.MalformedObjectNameException e) { 158 return null; 160 } 161 } 162 163 public static ObjectName J2EEServers(String pDomain) { 164 try { 165 StringBuffer sb = new StringBuffer (pDomain); 166 sb.append(":j2eeType=J2EEServer"); 167 sb.append(","); 168 sb.append(ALL); 169 return new ObjectName (sb.toString()); 170 } catch (javax.management.MalformedObjectNameException e) { 171 return null; 173 } 174 } 175 176 public static ObjectName J2EEServer(String pDomain, String pServer) { 177 try { 178 StringBuffer sb = new StringBuffer (pDomain); 179 sb.append(":j2eeType=J2EEServer"); 180 sb.append(",name="); 181 sb.append(pServer); 182 return new ObjectName (sb.toString()); 183 } catch (javax.management.MalformedObjectNameException e) { 184 return null; 186 } 187 } 188 189 public static ObjectName JVM(String pDomain, String pServer, String pName) { 190 try { 191 StringBuffer sb = new StringBuffer (pDomain); 192 sb.append(":j2eeType=JVM"); 193 sb.append(",name="); 194 sb.append(pName); 195 sb.append(",J2EEServer="); 196 sb.append(pServer); 197 return new ObjectName (sb.toString()); 198 } catch (javax.management.MalformedObjectNameException e) { 199 return null; 201 } 202 } 203 204 public static ObjectName JVMs(String pDomain, String pServer) { 205 try { 206 StringBuffer sb = new StringBuffer (pDomain); 207 sb.append(":j2eeType=JVM"); 208 sb.append(",J2EEServer="); 209 sb.append(pServer); 210 sb.append(","); 211 sb.append(ALL); 212 return new ObjectName (sb.toString()); 213 } catch (javax.management.MalformedObjectNameException e) { 214 return null; 216 } 217 } 218 219 public static ObjectName J2EEApplications() { 220 try { 221 StringBuffer sb = new StringBuffer (ALL); 222 sb.append(":j2eeType=J2EEApplication"); 223 sb.append(","); 224 sb.append(ALL); 225 return new ObjectName (sb.toString()); 226 } catch (javax.management.MalformedObjectNameException e) { 227 return null; 229 } 230 } 231 232 public static ObjectName J2EEApplications(String pDomain) { 233 try { 234 StringBuffer sb = new StringBuffer (pDomain); 235 sb.append(":j2eeType=J2EEApplication"); 236 sb.append(","); 237 sb.append(ALL); 238 return new ObjectName (sb.toString()); 239 } catch (javax.management.MalformedObjectNameException e) { 240 return null; 242 } 243 } 244 245 public static ObjectName J2EEApplications(String pDomain, String pServer) { 246 try { 247 StringBuffer sb = new StringBuffer (pDomain); 248 sb.append(":j2eeType=J2EEApplication"); 249 sb.append(",J2EEServer="); 250 sb.append(pServer); 251 sb.append(","); 252 sb.append(ALL); 253 return new ObjectName (sb.toString()); 254 } catch (javax.management.MalformedObjectNameException e) { 255 return null; 257 } 258 } 259 260 public static ObjectName J2EEApplication(String pDomain, String pServer, String pName) { 261 try { 262 StringBuffer sb = new StringBuffer (pDomain); 263 sb.append(":j2eeType=J2EEApplication"); 264 sb.append(",name="); 265 sb.append(pName); 266 sb.append(",J2EEServer="); 267 sb.append(pServer); 268 return new ObjectName (sb.toString()); 269 } catch (javax.management.MalformedObjectNameException e) { 270 return null; 272 } 273 } 274 282 public static ObjectName getAppClientModules(String pDomain, String pServer, String pApplication) { 283 try { 284 StringBuffer sb = new StringBuffer (pDomain); 285 sb.append(":j2eeType=AppClientModule"); 286 sb.append(",J2EEApplication="); 287 if ((pApplication != null) && (pApplication.length() > 0)) { 288 sb.append(pApplication); 289 } else { 290 sb.append(NONE); 291 } 292 sb.append(",J2EEServer="); 293 sb.append(pServer); 294 sb.append(","); 295 sb.append(ALL); 296 return new ObjectName (sb.toString()); 297 } catch (javax.management.MalformedObjectNameException e) { 298 return null; 300 } 301 } 302 310 public static ObjectName getAppClientModule(String pDomain, String pServer, String pApplication, String pName) { 311 try { 312 StringBuffer sb = new StringBuffer (pDomain); 313 sb.append(":j2eeType=AppClientModule"); 314 sb.append(",name="); 315 sb.append(pName); 316 sb.append(",J2EEApplication="); 317 if ((pApplication != null) && (pApplication.length() > 0)) { 318 sb.append(pApplication); 319 } else { 320 sb.append(NONE); 321 } 322 sb.append(",J2EEServer="); 323 sb.append(pServer); 324 return new ObjectName (sb.toString()); 325 } catch (javax.management.MalformedObjectNameException e) { 326 return null; 328 } 329 } 330 public static ObjectName getEJBModules() { 331 try { 332 StringBuffer sb = new StringBuffer (ALL); 333 sb.append(":j2eeType=EJBModule"); 334 sb.append(","); 335 sb.append(ALL); 336 return new ObjectName (sb.toString()); 337 } catch (javax.management.MalformedObjectNameException e) { 338 return null; 340 } 341 } 342 343 public static ObjectName getEJBModules(String pDomain) { 344 try { 345 StringBuffer sb = new StringBuffer (pDomain); 346 sb.append(":j2eeType=EJBModule"); 347 sb.append(","); 348 sb.append(ALL); 349 return new ObjectName (sb.toString()); 350 } catch (javax.management.MalformedObjectNameException e) { 351 return null; 353 } 354 } 355 356 public static ObjectName getEJBModules(String pDomain, String pServer) { 357 try { 358 StringBuffer sb = new StringBuffer (pDomain); 359 sb.append(":j2eeType=EJBModule"); 360 sb.append(",J2EEServer="); 361 sb.append(pServer); 362 sb.append(","); 363 sb.append(ALL); 364 return new ObjectName (sb.toString()); 365 } catch (javax.management.MalformedObjectNameException e) { 366 return null; 368 } 369 } 370 371 public static ObjectName getEJBModules(String pDomain, String pServer, String pApplication) { 372 try { 373 StringBuffer sb = new StringBuffer (pDomain); 374 sb.append(":j2eeType=EJBModule"); 375 sb.append(",J2EEApplication="); 376 if ((pApplication != null) && (pApplication.length() > 0)) { 377 sb.append(pApplication); 378 } else { 379 sb.append(NONE); 380 } 381 sb.append(",J2EEServer="); 382 sb.append(pServer); 383 sb.append(","); 384 sb.append(ALL); 385 return new ObjectName (sb.toString()); 386 } catch (javax.management.MalformedObjectNameException e) { 387 return null; 389 } 390 } 391 392 public static ObjectName getEJBModule(String pDomain, String pServer, String pApplication, String pName) { 393 try { 394 StringBuffer sb = new StringBuffer (pDomain); 395 sb.append(":j2eeType=EJBModule"); 396 sb.append(",name="); 397 sb.append(pName); 398 sb.append(",J2EEApplication="); 399 if ((pApplication != null) && (pApplication.length() > 0)) { 400 sb.append(pApplication); 401 } else { 402 sb.append(NONE); 403 } 404 sb.append(",J2EEServer="); 405 sb.append(pServer); 406 return new ObjectName (sb.toString()); 407 } catch (javax.management.MalformedObjectNameException e) { 408 return null; 410 } 411 } 412 413 public static ObjectName getEntityBean(String pDomain, String pModule, String pServer, String pApplication, 414 String pName) { 415 try { 416 StringBuffer sb = new StringBuffer (pDomain); 417 sb.append(":j2eeType=EntityBean"); 418 sb.append(",name="); 419 sb.append(pName); 420 sb.append(",EJBModule="); 421 sb.append(pModule); 422 sb.append(",J2EEApplication="); 423 if ((pApplication != null) && (pApplication.length() > 0)) { 424 sb.append(pApplication); 425 } else { 426 sb.append(NONE); 427 } 428 sb.append(",J2EEServer="); 429 sb.append(pServer); 430 return new ObjectName (sb.toString()); 431 } catch (javax.management.MalformedObjectNameException e) { 432 return null; 434 } 435 } 436 437 public static ObjectName getEntityBeans(String pDomain, String pModule) { 438 try { 439 StringBuffer sb = new StringBuffer (pDomain); 440 sb.append(":j2eeType=EntityBean"); 441 sb.append(",EJBModule="); 442 sb.append(pModule); 443 sb.append(","); 444 sb.append(ALL); 445 return new ObjectName (sb.toString()); 446 } catch (javax.management.MalformedObjectNameException e) { 447 return null; 449 } 450 } 451 452 public static ObjectName getEntityBeans(String pDomain, String pModule, String pServer) { 453 try { 454 StringBuffer sb = new StringBuffer (pDomain); 455 sb.append(":j2eeType=EntityBean"); 456 sb.append(",EJBModule="); 457 sb.append(pModule); 458 sb.append(",J2EEServer="); 459 sb.append(pServer); 460 sb.append(","); 461 sb.append(ALL); 462 return new ObjectName (sb.toString()); 463 } catch (javax.management.MalformedObjectNameException e) { 464 return null; 466 } 467 } 468 469 public static ObjectName getStatefulSessionBean(String pDomain, String pModule, String pServer, 470 String pApplication, String pName) { 471 try { 472 StringBuffer sb = new StringBuffer (pDomain); 473 sb.append(":j2eeType=StatefulSessionBean"); 474 sb.append(",name="); 475 sb.append(pName); 476 sb.append(",EJBModule="); 477 sb.append(pModule); 478 sb.append(",J2EEApplication="); 479 if ((pApplication != null) && (pApplication.length() > 0)) { 480 sb.append(pApplication); 481 } else { 482 sb.append(NONE); 483 } 484 sb.append(",J2EEServer="); 485 sb.append(pServer); 486 return new ObjectName (sb.toString()); 487 } catch (javax.management.MalformedObjectNameException e) { 488 return null; 490 } 491 } 492 493 public static ObjectName getStatefulSessionBeans(String pDomain, String pModule) { 494 try { 495 StringBuffer sb = new StringBuffer (pDomain); 496 sb.append(":j2eeType=StatefulSessionBean"); 497 sb.append(",EJBModule="); 498 sb.append(pModule); 499 sb.append(","); 500 sb.append(ALL); 501 return new ObjectName (sb.toString()); 502 } catch (javax.management.MalformedObjectNameException e) { 503 return null; 505 } 506 } 507 508 public static ObjectName getStatefulSessionBeans(String pDomain, String pModule, String pServer) { 509 try { 510 StringBuffer sb = new StringBuffer (pDomain); 511 sb.append(":j2eeType=StatefulSessionBean"); 512 sb.append(",EJBModule="); 513 sb.append(pModule); 514 sb.append(",J2EEServer="); 515 sb.append(pServer); 516 sb.append(","); 517 sb.append(ALL); 518 return new ObjectName (sb.toString()); 519 } catch (javax.management.MalformedObjectNameException e) { 520 return null; 522 } 523 } 524 525 public static ObjectName getStatelessSessionBean(String pDomain, String pModule, String pServer, 526 String pApplication, String pName) { 527 try { 528 StringBuffer sb = new StringBuffer (pDomain); 529 sb.append(":j2eeType=StatelessSessionBean"); 530 sb.append(",name="); 531 sb.append(pName); 532 sb.append(",EJBModule="); 533 sb.append(pModule); 534 sb.append(",J2EEApplication="); 535 if ((pApplication != null) && (pApplication.length() > 0)) { 536 sb.append(pApplication); 537 } else { 538 sb.append(NONE); 539 } 540 sb.append(",J2EEServer="); 541 sb.append(pServer); 542 return new ObjectName (sb.toString()); 543 } catch (javax.management.MalformedObjectNameException e) { 544 return null; 546 } 547 } 548 549 public static ObjectName getStatelessSessionBeans(String pDomain, String pModule) { 550 try { 551 StringBuffer sb = new StringBuffer (pDomain); 552 sb.append(":j2eeType=StatelessSessionBean"); 553 sb.append(",EJBModule="); 554 sb.append(pModule); 555 sb.append(","); 556 sb.append(ALL); 557 return new ObjectName (sb.toString()); 558 } catch (javax.management.MalformedObjectNameException e) { 559 return null; 561 } 562 } 563 564 public static ObjectName getStatelessSessionBeans(String pDomain) { 565 try { 566 StringBuffer sb = new StringBuffer (pDomain); 567 sb.append(":j2eeType=StatelessSessionBean"); 568 sb.append(","); 569 sb.append(ALL); 570 return new ObjectName (sb.toString()); 571 } catch (javax.management.MalformedObjectNameException e) { 572 return null; 574 } 575 } 576 577 578 public static ObjectName getStatelessSessionBeans(String pDomain, String pModule, String pServer) { 579 try { 580 StringBuffer sb = new StringBuffer (pDomain); 581 sb.append(":j2eeType=StatelessSessionBean"); 582 sb.append(",EJBModule="); 583 sb.append(pModule); 584 sb.append(",J2EEServer="); 585 sb.append(pServer); 586 sb.append(","); 587 sb.append(ALL); 588 return new ObjectName (sb.toString()); 589 } catch (javax.management.MalformedObjectNameException e) { 590 return null; 592 } 593 } 594 595 public static ObjectName getMessageDrivenBean(String pDomain, String pModule, String pServer, 596 String pApplication, String pName) { 597 try { 598 StringBuffer sb = new StringBuffer (pDomain); 599 sb.append(":j2eeType=MessageDrivenBean"); 600 sb.append(",name="); 601 sb.append(pName); 602 sb.append(",EJBModule="); 603 sb.append(pModule); 604 sb.append(",J2EEApplication="); 605 if ((pApplication != null) && (pApplication.length() > 0)) { 606 sb.append(pApplication); 607 } else { 608 sb.append(NONE); 609 } 610 sb.append(",J2EEServer="); 611 sb.append(pServer); 612 return new ObjectName (sb.toString()); 613 } catch (javax.management.MalformedObjectNameException e) { 614 return null; 616 } 617 } 618 619 public static ObjectName getMessageDrivenBeans(String pDomain, String pModule, String pServer) { 620 try { 621 StringBuffer sb = new StringBuffer (pDomain); 622 sb.append(":j2eeType=MessageDrivenBean"); 623 sb.append(",EJBModule="); 624 sb.append(pModule); 625 sb.append(",J2EEServer="); 626 sb.append(pServer); 627 sb.append(","); 628 sb.append(ALL); 629 return new ObjectName (sb.toString()); 630 } catch (javax.management.MalformedObjectNameException e) { 631 return null; 633 } 634 } 635 636 public static ObjectName getMessageDrivenBeans(String pDomain, String pModule) { 637 try { 638 StringBuffer sb = new StringBuffer (pDomain); 639 sb.append(":j2eeType=MessageDrivenBean"); 640 sb.append(",EJBModule="); 641 sb.append(pModule); 642 sb.append(","); 643 sb.append(ALL); 644 return new ObjectName (sb.toString()); 645 } catch (javax.management.MalformedObjectNameException e) { 646 return null; 648 } 649 } 650 651 public static ObjectName getWebServices(String pDomain, String pServer) { 652 try { 654 StringBuffer sb = new StringBuffer (pDomain); 655 sb.append(":type=WebService"); 656 sb.append(","); 657 sb.append(ALL); 658 sb.append(",J2EEServer="); 659 sb.append(pServer); 660 sb.append(","); 661 sb.append(ALL); 662 return new ObjectName (sb.toString()); 663 } catch (javax.management.MalformedObjectNameException e) { 664 return null; 666 } 667 } 668 669 public static ObjectName getWebServices() { 670 try { 671 StringBuffer sb = new StringBuffer (ALL); 672 sb.append(":type=WebService"); 673 sb.append(","); 674 sb.append(ALL); 675 return new ObjectName (sb.toString()); 676 } catch (javax.management.MalformedObjectNameException e) { 677 return null; 679 } 680 } 681 682 683 public static ObjectName JavaMailResource(String pDomain, String pName, String pServer, String p_Type) { 684 try { 685 StringBuffer sb = new StringBuffer (pDomain); 686 sb.append(":j2eeType=JavaMailResource"); 687 sb.append(",name="); 688 sb.append(pName); 689 sb.append(",J2EEServer="); 690 sb.append(pServer); 691 sb.append(",type="); 692 sb.append(p_Type); 693 return new ObjectName (sb.toString()); 694 } catch (javax.management.MalformedObjectNameException e) { 695 return null; 697 } 698 } 699 700 public static ObjectName JavaMailResources(String pDomain, String pServer, String p_Type) { 701 try { 702 StringBuffer sb = new StringBuffer (pDomain); 703 sb.append(":j2eeType=JavaMailResource"); 704 sb.append(","); 705 sb.append(ALL); 706 sb.append(",J2EEServer="); 707 sb.append(pServer); 708 sb.append(",type="); 709 sb.append(p_Type); 710 return new ObjectName (sb.toString()); 711 } catch (javax.management.MalformedObjectNameException e) { 712 return null; 714 } 715 } 716 717 public static ObjectName JNDIResources(String pDomain, String pServer) { 718 try { 719 StringBuffer sb = new StringBuffer (pDomain); 720 sb.append(":j2eeType=JNDIResource"); 721 sb.append(",J2EEServer="); 722 sb.append(pServer); 723 sb.append(","); 724 sb.append(ALL); 725 return new ObjectName (sb.toString()); 726 } catch (javax.management.MalformedObjectNameException e) { 727 return null; 729 } 730 } 731 732 public static ObjectName getWebModules() { 733 try { 734 return new ObjectName ("*:j2eeType=WebModule,*"); 735 } catch (javax.management.MalformedObjectNameException e) { 736 return null; 738 } 739 } 740 741 public static ObjectName getWebModules(String pDomain) { 742 try { 743 return new ObjectName (pDomain + ":j2eeType=WebModule,*"); 744 } catch (javax.management.MalformedObjectNameException e) { 745 return null; 747 } 748 } 749 750 public static ObjectName getWebModules(String pDomain, String pServer) { 751 try { 752 StringBuffer sb = new StringBuffer (pDomain); 753 sb.append(":j2eeType=WebModule"); 754 if ((pServer != null) && (pServer.length() > 0)) { 755 sb.append(",J2EEServer="); 756 sb.append(pServer); 757 } 758 sb.append(",*"); 759 return new ObjectName (sb.toString()); 760 } catch (javax.management.MalformedObjectNameException e) { 761 return null; 763 } 764 } 765 766 public static ObjectName getWebModules(String pDomain, String pServer, String pApplication) { 767 try { 768 StringBuffer sb = new StringBuffer (pDomain); 769 sb.append(":j2eeType=WebModule"); 770 if ((pServer != null) && (pServer.length() > 0)) { 771 sb.append(",J2EEServer="); 772 sb.append(pServer); 773 } 774 if ((pApplication != null) && (pApplication.length() > 0)) { 775 sb.append(",J2EEApplication="); 776 sb.append(pApplication); 777 } 778 sb.append(",*"); 779 return new ObjectName (sb.toString()); 780 } catch (javax.management.MalformedObjectNameException e) { 781 return null; 783 } 784 } 785 786 public static ObjectName getWebModule(String pDomain, String pServer, String pApplication, String pName) { 787 try { 788 StringBuffer sb = new StringBuffer (pDomain); 789 sb.append(":j2eeType=WebModule"); 790 sb.append(",name="); 791 sb.append(pName); 792 sb.append(",J2EEServer="); 793 sb.append(pServer); 794 sb.append(",J2EEApplication="); 795 if ((pApplication != null) && (pApplication.length() > 0)) { 796 sb.append(pApplication); 797 } else { 798 sb.append(NONE); 799 } 800 801 return new ObjectName (sb.toString()); 802 } catch (javax.management.MalformedObjectNameException e) { 803 return null; 805 } 806 } 807 808 public static ObjectName getResourceAdapterModule(String pDomain, String pServer, String pApplication, 809 String pName) { 810 try { 811 StringBuffer sb = new StringBuffer (pDomain); 812 sb.append(":j2eeType=ResourceAdapterModule"); 813 sb.append(",name="); 814 sb.append(pName); 815 sb.append(",J2EEServer="); 816 sb.append(pServer); 817 sb.append(",J2EEApplication="); 818 if ((pApplication == null) || (pApplication.length() == 0)) { 819 sb.append(NONE); 820 } else { 821 sb.append(pApplication); 822 } 823 return new ObjectName (sb.toString()); 824 } catch (javax.management.MalformedObjectNameException e) { 825 return null; 827 } 828 } 829 830 public static ObjectName getResourceAdapterModules(String pDomain, String pServer) { 831 try { 832 StringBuffer sb = new StringBuffer (pDomain); 833 sb.append(":j2eeType=ResourceAdapterModule"); 834 if ((pServer != null) && (pServer.length() > 0)) { 835 sb.append(",J2EEServer="); 836 sb.append(pServer); 837 } 838 sb.append(","); 839 sb.append(ALL); 840 return new ObjectName (sb.toString()); 841 } catch (javax.management.MalformedObjectNameException e) { 842 return null; 844 } 845 } 846 847 public static ObjectName getResourceAdapterModules(String pDomain, String pServer, String pApplication) { 848 try { 849 StringBuffer sb = new StringBuffer (pDomain); 850 sb.append(":j2eeType=ResourceAdapterModule"); 851 if ((pServer != null) && (pServer.length() > 0)) { 852 sb.append(",J2EEServer="); 853 sb.append(pServer); 854 } 855 if ((pApplication != null) && (pApplication.length() > 0)) { 856 sb.append(",J2EEApplication="); 857 sb.append(pApplication); 858 } 859 sb.append(","); 860 sb.append(ALL); 861 return new ObjectName (sb.toString()); 862 } catch (javax.management.MalformedObjectNameException e) { 863 return null; 865 } 866 } 867 868 public static ObjectName getResourceAdapter(String pDomain, String pResourceAdapterModule, String pApplication, 869 String pServer, String pName) { 870 try { 871 StringBuffer sb = new StringBuffer (pDomain); 872 sb.append(":j2eeType=ResourceAdapter"); 873 sb.append(",name="); 874 sb.append(pName); 875 sb.append(",ResourceAdapterModule="); 876 sb.append(pResourceAdapterModule); 877 sb.append(",J2EEApplication="); 878 if ((pApplication == null) || (pApplication.length() == 0)) { 879 sb.append(NONE); 880 } else { 881 sb.append(pApplication); 882 } 883 sb.append(",J2EEServer="); 884 sb.append(pServer); 885 return new ObjectName (sb.toString()); 886 } catch (javax.management.MalformedObjectNameException e) { 887 return null; 889 } 890 } 891 892 public static ObjectName getResourceAdapters(String pDomain, String pServer) { 893 try { 894 StringBuffer sb = new StringBuffer (pDomain); 895 sb.append(":j2eeType=ResourceAdapter"); 896 if ((pServer != null) && (pServer.length() > 0)) { 897 sb.append(",J2EEServer="); 898 sb.append(pServer); 899 } 900 sb.append(","); 901 sb.append(ALL); 902 return new ObjectName (sb.toString()); 903 } catch (javax.management.MalformedObjectNameException e) { 904 return null; 906 } 907 } 908 909 public static ObjectName getResourceAdapters(String pDomain, String pApplication, String pServer) { 910 try { 911 StringBuffer sb = new StringBuffer (pDomain); 912 sb.append(":j2eeType=ResourceAdapter"); 913 sb.append(",J2EEApplication="); 914 if ((pApplication == null) || (pApplication.length() == 0)) { 915 sb.append(NONE); 916 } else { 917 sb.append(pApplication); 918 } 919 if ((pServer != null) && (pServer.length() > 0)) { 920 sb.append(",J2EEServer="); 921 sb.append(pServer); 922 } 923 sb.append(","); 924 sb.append(ALL); 925 return new ObjectName (sb.toString()); 926 } catch (javax.management.MalformedObjectNameException e) { 927 return null; 929 } 930 } 931 public static ObjectName getJCAResource(String pDomain, String pServer, String pResourceAdapter, String pName) { 932 try { 933 StringBuffer sb = new StringBuffer (pDomain); 934 sb.append(":j2eeType=JCAResource"); 935 sb.append(",name="); 936 sb.append(pName); 937 sb.append(",J2EEServer="); 938 sb.append(pServer); 939 sb.append(",ResourceAdapter="); 940 sb.append(pResourceAdapter); 941 return new ObjectName (sb.toString()); 942 } catch (javax.management.MalformedObjectNameException e) { 943 return null; 945 } 946 } 947 948 public static ObjectName getJCAActivationSpec(String pDomain, String pJCAResource, String pServer, String pName) { 949 try { 950 StringBuffer sb = new StringBuffer (pDomain); 951 sb.append(":j2eeType=JCAActivationSpec"); 952 sb.append(",name="); 953 sb.append(pName); 954 sb.append(",JCAResource="); 955 sb.append(pJCAResource); 956 sb.append(",J2EEServer="); 957 sb.append(pServer); 958 return new ObjectName (sb.toString()); 959 } catch (javax.management.MalformedObjectNameException e) { 960 return null; 962 } 963 } 964 965 public static ObjectName getJCAAdminObject(String pDomain, String pJCAResource, String pServer, String pName) { 966 try { 967 StringBuffer sb = new StringBuffer (pDomain); 968 sb.append(":j2eeType=JCAAdminObject"); 969 sb.append(",name="); 970 sb.append(pName); 971 sb.append(",JCAResource="); 972 sb.append(pJCAResource); 973 sb.append(",J2EEServer="); 974 sb.append(pServer); 975 return new ObjectName (sb.toString()); 976 } catch (javax.management.MalformedObjectNameException e) { 977 return null; 979 } 980 } 981 982 public static ObjectName getJCAConnectionFactory(String pDomain, String pJCAResource, String pServer, 983 String pName) { 984 try { 985 StringBuffer sb = new StringBuffer (pDomain); 986 sb.append(":j2eeType=JCAConnectionFactory"); 987 sb.append(",name="); 988 sb.append(pName); 989 sb.append(",JCAResource="); 990 sb.append(pJCAResource); 991 sb.append(",J2EEServer="); 992 sb.append(pServer); 993 return new ObjectName (sb.toString()); 994 } catch (javax.management.MalformedObjectNameException e) { 995 return null; 997 } 998 } 999 1000 public static ObjectName getJCAManagedConnectionFactory(String pDomain, String pServer, String pName) { 1001 try { 1002 StringBuffer sb = new StringBuffer (pDomain); 1003 sb.append(":j2eeType=JCAManagedConnectionFactory"); 1004 sb.append(",name="); 1005 sb.append(pName); 1006 sb.append(",J2EEServer="); 1007 sb.append(pServer); 1008 return new ObjectName (sb.toString()); 1009 } catch (javax.management.MalformedObjectNameException e) { 1010 return null; 1012 } 1013 } 1014 1015 public static ObjectName ManagementListener(String pDomain, String pServer) { 1016 try { 1017 StringBuffer sb = new StringBuffer (pDomain); 1018 sb.append(":type=management,name=managementListener"); 1019 sb.append(",J2EEServer="); 1020 sb.append(pServer); 1021 return new ObjectName (sb.toString()); 1022 } catch (javax.management.MalformedObjectNameException e) { 1023 return null; 1025 } 1026 } 1027 1028 public static ObjectName JTAResource(String pDomain, String pServer, String pName) { 1029 try { 1030 StringBuffer sb = new StringBuffer (pDomain); 1031 sb.append(":j2eeType=JTAResource"); 1032 sb.append(",name="); 1033 sb.append(pName); 1034 sb.append(",J2EEServer="); 1035 sb.append(pServer); 1036 return new ObjectName (sb.toString()); 1037 } catch (javax.management.MalformedObjectNameException e) { 1038 return null; 1040 } 1041 } 1042 1043 1050 public static ObjectName JDBCResource(String pDomain, String pServer, String pName) { 1051 try { 1052 StringBuffer sb = new StringBuffer (pDomain); 1053 sb.append(":j2eeType=JDBCResource"); 1054 sb.append(",name="); 1055 sb.append(pName); 1056 sb.append(",J2EEServer="); 1057 sb.append(pServer); 1058 return new ObjectName (sb.toString()); 1059 } catch (javax.management.MalformedObjectNameException e) { 1060 return null; 1062 } 1063 } 1064 1065 1071 public static ObjectName JDBCResource(String pDomain, String pServer) { 1072 try { 1073 StringBuffer sb = new StringBuffer (pDomain); 1074 sb.append(":j2eeType=JDBCResource"); 1075 sb.append(",name="); 1076 sb.append("JDBCResource"); 1077 sb.append(",J2EEServer="); 1078 sb.append(pServer); 1079 return new ObjectName (sb.toString()); 1080 } catch (javax.management.MalformedObjectNameException e) { 1081 return null; 1083 } 1084 } 1085 1086 1093 public static ObjectName getJDBCDataSource(String pDomain, String pServer, String pName) { 1094 try { 1095 StringBuffer sb = new StringBuffer (pDomain); 1096 sb.append(":j2eeType=JDBCDataSource"); 1097 sb.append(",name="); 1098 sb.append(pName); 1099 sb.append(",JDBCResource="); 1100 sb.append("JDBCResource"); 1101 sb.append(",J2EEServer="); 1102 sb.append(pServer); 1103 return new ObjectName (sb.toString()); 1104 } catch (javax.management.MalformedObjectNameException e) { 1105 return null; 1107 } 1108 } 1109 1110 1115 public static ObjectName getJDBCDataSources(String pDomain, String pServer) { 1116 try { 1117 StringBuffer sb = new StringBuffer (pDomain); 1118 sb.append(":j2eeType=JDBCDataSource"); 1119 sb.append(",JDBCResource="); 1120 sb.append("JDBCResource"); 1121 sb.append(",J2EEServer="); 1122 sb.append(pServer); 1123 sb.append(","); 1124 sb.append(ALL); 1125 return new ObjectName (sb.toString()); 1126 } catch (javax.management.MalformedObjectNameException e) { 1127 return null; 1129 } 1130 } 1131 1132 1139 public static ObjectName JDBCDataSources(String pDomain, String pServer) { 1140 try { 1141 StringBuffer sb = new StringBuffer (pDomain); 1142 sb.append(":j2eeType=JDBCDataSource"); 1143 sb.append(",J2EEServer="); 1144 sb.append(pServer); 1145 sb.append(","); 1146 sb.append(ALL); 1147 return new ObjectName (sb.toString()); 1148 } catch (javax.management.MalformedObjectNameException e) { 1149 return null; 1151 } 1152 } 1153 1154 public static ObjectName JDBCDataSources(String pDomain, String pJDBCResource, String pServer) { 1155 try { 1156 StringBuffer sb = new StringBuffer (pDomain); 1157 sb.append(":j2eeType=JDBCDataSource"); 1158 sb.append(",JDBCResource="); 1159 sb.append(pJDBCResource); 1160 sb.append(",J2EEServer="); 1161 sb.append(pServer); 1162 sb.append(","); 1163 sb.append(ALL); 1164 return new ObjectName (sb.toString()); 1165 } catch (javax.management.MalformedObjectNameException e) { 1166 return null; 1168 } 1169 } 1170 1171 public static ObjectName getJDBCDriver(String pDomain, String pServer, String pName) { 1172 try { 1173 StringBuffer sb = new StringBuffer (pDomain); 1174 sb.append(":j2eeType=JDBCDriver"); 1175 sb.append(",name="); 1176 sb.append(pName); 1177 sb.append(",J2EEServer="); 1178 sb.append(pServer); 1179 return new ObjectName (sb.toString()); 1180 } catch (javax.management.MalformedObjectNameException e) { 1181 return null; 1183 } 1184 } 1185 1186} | Popular Tags |