1 57 58 package org.apache.wsif.logging; 59 60 import java.io.PrintWriter ; 61 import java.io.StringWriter ; 62 import java.util.Collection ; 63 import java.util.HashMap ; 64 import java.util.Iterator ; 65 import java.util.Map ; 66 import java.util.StringTokenizer ; 67 68 import javax.wsdl.Binding; 69 import javax.wsdl.BindingInput; 70 import javax.wsdl.BindingOperation; 71 import javax.wsdl.BindingOutput; 72 import javax.wsdl.Definition; 73 import javax.wsdl.Operation; 74 import javax.wsdl.Port; 75 import javax.wsdl.PortType; 76 import javax.wsdl.Service; 77 78 import org.apache.commons.logging.Log; 79 import org.apache.commons.logging.LogFactory; 80 81 96 public class Trc { 97 private static final String wsifPackageName = "org.apache.wsif"; 98 private static Log log = LogFactory.getLog(wsifPackageName+".*"); 99 public static boolean ON = log.isDebugEnabled(); 100 101 private static Log traceLog = LogFactory.getLog(wsifPackageName+".logging.*"); 102 105 private static boolean traceTrace = false; 106 108 private final static String ENTRY = "ENTRY"; 109 private final static String EXIT = "EXIT "; 110 private final static String EXCEPTION = "EXCEPTION"; 111 private final static String EVENT = "EVENT"; 112 113 116 private Trc() { 117 super(); 118 } 119 120 public static boolean isTraceEnabled() { 121 return log.isTraceEnabled(); 122 } 123 124 public static boolean isDebugEnabled() { 125 return log.isDebugEnabled(); 126 } 127 128 131 public static void entry(Object that) { 132 try { 133 if (!ON) 134 return; 135 traceIt(that, ENTRY, false, null); 136 } catch (Exception e) { 137 exceptionInTrace(e); 138 } 139 } 140 141 144 public static void entry(Object that, Object p1) { 145 try { 146 if (!ON) 147 return; 148 traceIt(that, ENTRY, false, new Object [] { p1 }); 149 } catch (Exception e) { 150 exceptionInTrace(e); 151 } 152 } 153 154 157 public static void entry(Object that, Object p1, Object p2) { 158 try { 159 if (!ON) 160 return; 161 traceIt(that, ENTRY, false, new Object [] { p1, p2 }); 162 } catch (Exception e) { 163 exceptionInTrace(e); 164 } 165 } 166 167 public static void entry(Object that, Object p1, Object p2, Object p3) { 168 try { 169 if (!ON) 170 return; 171 traceIt(that, ENTRY, false, new Object [] { p1, p2, p3 }); 172 } catch (Exception e) { 173 exceptionInTrace(e); 174 } 175 } 176 177 public static void entry( 178 Object that, 179 Object p1, 180 Object p2, 181 Object p3, 182 Object p4) { 183 try { 184 if (!ON) 185 return; 186 traceIt(that, ENTRY, false, new Object [] { p1, p2, p3, p4 }); 187 } catch (Exception e) { 188 exceptionInTrace(e); 189 } 190 } 191 192 public static void entry( 193 Object that, 194 Object p1, 195 Object p2, 196 Object p3, 197 Object p4, 198 Object p5) { 199 try { 200 if (!ON) 201 return; 202 traceIt(that, ENTRY, false, new Object [] { p1, p2, p3, p4, p5 }); 203 } catch (Exception e) { 204 exceptionInTrace(e); 205 } 206 } 207 208 public static void entry( 209 Object that, 210 Object p1, 211 Object p2, 212 Object p3, 213 Object p4, 214 Object p5, 215 Object p6) { 216 try { 217 if (!ON) 218 return; 219 traceIt(that, ENTRY, false, new Object [] { p1, p2, p3, p4, p5, p6 }); 220 } catch (Exception e) { 221 exceptionInTrace(e); 222 } 223 } 224 225 public static void entry( 226 Object that, 227 Object p1, 228 Object p2, 229 Object p3, 230 Object p4, 231 Object p5, 232 Object p6, 233 Object p7) { 234 try { 235 if (!ON) 236 return; 237 traceIt(that, ENTRY, false, new Object [] { p1, p2, p3, p4, p5, p6, p7 }); 238 } catch (Exception e) { 239 exceptionInTrace(e); 240 } 241 } 242 243 public static void entry( 244 Object that, 245 Object p1, 246 Object p2, 247 Object p3, 248 Object p4, 249 Object p5, 250 Object p6, 251 Object p7, 252 Object p8) { 253 try { 254 if (!ON) 255 return; 256 traceIt(that, ENTRY, false, new Object [] { p1, p2, p3, p4, p5, p6, p7, p8 }); 257 } catch (Exception e) { 258 exceptionInTrace(e); 259 } 260 } 261 262 public static void entry( 263 Object that, 264 Object p1, 265 Object p2, 266 Object p3, 267 Object p4, 268 Object p5, 269 Object p6, 270 Object p7, 271 Object p8, 272 Object p9) { 273 try { 274 if (!ON) 275 return; 276 traceIt( 277 that, 278 ENTRY, 279 false, 280 new Object [] { 281 p1, 282 p2, 283 p3, 284 p4, 285 p5, 286 p6, 287 p7, 288 p8, 289 p9 }); 290 } catch (Exception e) { 291 exceptionInTrace(e); 292 } 293 } 294 295 public static void entry( 296 Object that, 297 Object p1, 298 Object p2, 299 Object p3, 300 Object p4, 301 Object p5, 302 Object p6, 303 Object p7, 304 Object p8, 305 Object p9, 306 Object p10) { 307 try { 308 if (!ON) 309 return; 310 traceIt( 311 that, 312 ENTRY, 313 false, 314 new Object [] { 315 p1, 316 p2, 317 p3, 318 p4, 319 p5, 320 p6, 321 p7, 322 p8, 323 p9, 324 p10 }); 325 } catch (Exception e) { 326 exceptionInTrace(e); 327 } 328 } 329 330 public static void entry( 331 Object that, 332 Object p1, 333 Object p2, 334 Object p3, 335 Object p4, 336 Object p5, 337 Object p6, 338 Object p7, 339 Object p8, 340 Object p9, 341 Object p10, 342 Object p11) { 343 try { 344 if (!ON) 345 return; 346 traceIt( 347 that, 348 ENTRY, 349 false, 350 new Object [] { 351 p1, 352 p2, 353 p3, 354 p4, 355 p5, 356 p6, 357 p7, 358 p8, 359 p9, 360 p10, 361 p11 }); 362 } catch (Exception e) { 363 exceptionInTrace(e); 364 } 365 } 366 367 public static void entry( 368 Object that, 369 Object p1, 370 Object p2, 371 Object p3, 372 Object p4, 373 Object p5, 374 Object p6, 375 Object p7, 376 Object p8, 377 Object p9, 378 Object p10, 379 Object p11, 380 Object p12) { 381 try { 382 if (!ON) 383 return; 384 traceIt( 385 that, 386 ENTRY, 387 false, 388 new Object [] { 389 p1, 390 p2, 391 p3, 392 p4, 393 p5, 394 p6, 395 p7, 396 p8, 397 p9, 398 p10, 399 p11, 400 p12 }); 401 } catch (Exception e) { 402 exceptionInTrace(e); 403 } 404 } 405 406 public static void entry( 407 Object that, 408 Object p1, 409 Object p2, 410 Object p3, 411 Object p4, 412 Object p5, 413 Object p6, 414 Object p7, 415 Object p8, 416 Object p9, 417 Object p10, 418 Object p11, 419 Object p12, 420 Object p13) { 421 try { 422 if (!ON) 423 return; 424 traceIt( 425 that, 426 ENTRY, 427 false, 428 new Object [] { 429 p1, 430 p2, 431 p3, 432 p4, 433 p5, 434 p6, 435 p7, 436 p8, 437 p9, 438 p10, 439 p11, 440 p12, 441 p13 }); 442 } catch (Exception e) { 443 exceptionInTrace(e); 444 } 445 } 446 447 public static void entry( 448 Object that, 449 Object p1, 450 Object p2, 451 Object p3, 452 Object p4, 453 Object p5, 454 Object p6, 455 Object p7, 456 Object p8, 457 Object p9, 458 Object p10, 459 Object p11, 460 Object p12, 461 Object p13, 462 Object p14) { 463 try { 464 if (!ON) 465 return; 466 traceIt( 467 that, 468 ENTRY, 469 false, 470 new Object [] { 471 p1, 472 p2, 473 p3, 474 p4, 475 p5, 476 p6, 477 p7, 478 p8, 479 p9, 480 p10, 481 p11, 482 p12, 483 p13, 484 p14 }); 485 } catch (Exception e) { 486 exceptionInTrace(e); 487 } 488 } 489 490 public static void entry( 491 Object that, 492 Object p1, 493 Object p2, 494 Object p3, 495 Object p4, 496 Object p5, 497 Object p6, 498 Object p7, 499 Object p8, 500 Object p9, 501 Object p10, 502 Object p11, 503 Object p12, 504 Object p13, 505 Object p14, 506 Object p15) { 507 try { 508 if (!ON) 509 return; 510 traceIt( 511 that, 512 ENTRY, 513 false, 514 new Object [] { 515 p1, 516 p2, 517 p3, 518 p4, 519 p5, 520 p6, 521 p7, 522 p8, 523 p9, 524 p10, 525 p11, 526 p12, 527 p13, 528 p14, 529 p15 }); 530 } catch (Exception e) { 531 exceptionInTrace(e); 532 } 533 } 534 535 public static void entryExpandWsdl(Object that, Object [] parms) { 536 try { 537 if (!ON) 538 return; 539 traceIt(that,ENTRY,true,parms); 540 } catch (Exception e) { 541 exceptionInTrace(e); 542 } 543 } 544 545 public static void entry(Object that, boolean b) { 546 if (ON) 547 entry(that, new Boolean (b)); 548 } 549 public static void entry(Object that, int i) { 550 if (ON) 551 entry(that, new Integer (i)); 552 } 553 554 557 public static void exit() { 558 try { 559 if (!ON) 560 return; 561 traceIt(null,EXIT,false,null); 562 } catch (Exception e) { 563 exceptionInTrace(e); 564 } 565 } 566 567 570 public static void exit(Object returnValue) { 571 try { 572 if (!ON) 573 return; 574 traceIt(null, EXIT, false, new Object [] { returnValue }); 575 } catch (Exception e) { 576 exceptionInTrace(e); 577 } 578 } 579 580 583 public static void exit(boolean b) { 584 if (ON) 585 exit(new Boolean (b)); 586 } 587 public static void exit(int i) { 588 if (ON) 589 exit(new Integer (i)); 590 } 591 592 595 public static void exitExpandWsdl(Object returnValue) { 596 try { 597 if (!ON) 598 return; 599 traceIt(null, EXIT, true, new Object [] { returnValue }); 600 } catch (Exception e) { 601 exceptionInTrace(e); 602 } 603 } 604 605 public static void exception(Throwable exception) { 606 try { 607 if (!ON) 608 return; 609 log.debug(EXCEPTION, exception); 610 } catch (Exception e) { 611 exceptionInTrace(e); 612 } 613 } 614 615 public static void ignoredException(Throwable exception) { 616 try { 617 if (!ON) 618 return; 619 traceIt( 620 null, 621 "Ignoring expected exception", 622 false, 623 new Object [] { exception.toString()}); 624 } catch (Exception e) { 625 exceptionInTrace(e); 626 } 627 } 628 629 public static void exceptionInTrace(Exception exception) { 630 try { 631 log.debug("****** Exception in WSIF trace statement ******",exception); 632 } catch (Exception ignored) { 633 } 637 } 638 639 public static void event(Object that, Object p1) { 640 try { 641 if (!ON) 642 return; 643 traceIt(that, EVENT, false, new Object [] { p1 }); 644 } catch (Exception e) { 645 exceptionInTrace(e); 646 } 647 } 648 649 public static void event(Object that, Object p1, Object p2) { 650 try { 651 if (!ON) 652 return; 653 traceIt(that, EVENT, false, new Object [] { p1, p2 }); 654 } catch (Exception e) { 655 exceptionInTrace(e); 656 } 657 } 658 659 public static void event(Object that, Object p1, Object p2, Object p3) { 660 try { 661 if (!ON) 662 return; 663 traceIt(that, EVENT, false, new Object [] { p1, p2, p3 }); 664 } catch (Exception e) { 665 exceptionInTrace(e); 666 } 667 } 668 669 public static void event( 670 Object that, 671 Object p1, 672 Object p2, 673 Object p3, 674 Object p4) { 675 try { 676 if (!ON) 677 return; 678 traceIt(that, EVENT, false, new Object [] { p1, p2, p3, p4 }); 679 } catch (Exception e) { 680 exceptionInTrace(e); 681 } 682 } 683 684 public static void event( 685 Object that, 686 Object p1, 687 Object p2, 688 Object p3, 689 Object p4, 690 Object p5) { 691 try { 692 if (!ON) 693 return; 694 traceIt(that, EVENT, false, new Object [] { p1, p2, p3, p4, p5 }); 695 } catch (Exception e) { 696 exceptionInTrace(e); 697 } 698 } 699 700 public static void event( 701 Object that, 702 Object p1, 703 Object p2, 704 Object p3, 705 Object p4, 706 Object p5, 707 Object p6) { 708 try { 709 if (!ON) 710 return; 711 traceIt( 712 that, 713 EVENT, 714 false, 715 new Object [] { p1, p2, p3, p4, p5, p6 }); 716 } catch (Exception e) { 717 exceptionInTrace(e); 718 } 719 } 720 721 public static void event( 722 Object that, 723 Object p1, 724 Object p2, 725 Object p3, 726 Object p4, 727 Object p5, 728 Object p6, 729 Object p7) { 730 try { 731 if (!ON) 732 return; 733 traceIt( 734 that, 735 EVENT, 736 false, 737 new Object [] { p1, p2, p3, p4, p5, p6, p7 }); 738 } catch (Exception e) { 739 exceptionInTrace(e); 740 } 741 } 742 743 public static void event( 744 Object that, 745 Object p1, 746 Object p2, 747 Object p3, 748 Object p4, 749 Object p5, 750 Object p6, 751 Object p7, 752 Object p8) { 753 try { 754 if (!ON) 755 return; 756 traceIt( 757 that, 758 EVENT, 759 false, 760 new Object [] { p1, p2, p3, p4, p5, p6, p7, p8 }); 761 } catch (Exception e) { 762 exceptionInTrace(e); 763 } 764 } 765 766 public static void event( 767 Object that, 768 Object p1, 769 Object p2, 770 Object p3, 771 Object p4, 772 Object p5, 773 Object p6, 774 Object p7, 775 Object p8, 776 Object p9) { 777 try { 778 if (!ON) 779 return; 780 traceIt( 781 that, 782 EVENT, 783 false, 784 new Object [] { p1, p2, p3, p4, p5, p6, p7, p8, p9 }); 785 } catch (Exception e) { 786 exceptionInTrace(e); 787 } 788 } 789 790 public static void event( 791 Object that, 792 Object p1, 793 Object p2, 794 Object p3, 795 Object p4, 796 Object p5, 797 Object p6, 798 Object p7, 799 Object p8, 800 Object p9, 801 Object p10) { 802 try { 803 if (!ON) 804 return; 805 traceIt( 806 that, 807 EVENT, 808 false, 809 new Object [] { p1, p2, p3, p4, p5, p6, p7, p8, p9, p10 }); 810 } catch (Exception e) { 811 exceptionInTrace(e); 812 } 813 } 814 815 public static String brief(Definition d) { 816 try { 817 if (!ON) 818 return ""; 819 if (d == null) 820 return "null"; 821 if (d.getQName() == null) 822 return "UNNAMED," + Integer.toHexString(d.hashCode()); 823 return d.getQName() + "," + Integer.toHexString(d.hashCode()); 824 } catch (Exception e) { 825 exceptionInTrace(e); 826 } 827 return ""; 828 } 829 830 public static String brief(PortType pt) { 831 try { 832 if (!ON) 833 return ""; 834 if (pt == null) 835 return "null"; 836 if (pt.getQName() == null) 837 return "UNNAMED," + Integer.toHexString(pt.hashCode()); 838 return pt.getQName() + "," + Integer.toHexString(pt.hashCode()); 839 } catch (Exception e) { 840 exceptionInTrace(e); 841 } 842 return ""; 843 } 844 845 public static String brief(Service s) { 846 try { 847 if (!ON) 848 return ""; 849 if (s == null) 850 return "null"; 851 if (s.getQName() == null) 852 return "UNNAMED," + Integer.toHexString(s.hashCode()); 853 return s.getQName() + "," + Integer.toHexString(s.hashCode()); 854 } catch (Exception e) { 855 exceptionInTrace(e); 856 } 857 return ""; 858 } 859 860 public static String brief(Port p) { 861 try { 862 if (!ON) 863 return ""; 864 if (p == null) 865 return "null"; 866 if (p.getName() == null) 867 return "UNNAMED," + Integer.toHexString(p.hashCode()); 868 return p.getName() + "," + Integer.toHexString(p.hashCode()); 869 } catch (Exception e) { 870 exceptionInTrace(e); 871 } 872 return ""; 873 } 874 875 public static String brief(BindingOperation bo) { 876 try { 877 if (!ON) 878 return ""; 879 if (bo == null) 880 return "null"; 881 if (bo.getName() == null) 882 return "UNNAMED," + Integer.toHexString(bo.hashCode()); 883 return bo.getName() + "," + Integer.toHexString(bo.hashCode()); 884 } catch (Exception e) { 885 exceptionInTrace(e); 886 } 887 return ""; 888 } 889 890 public static String brief(Operation o) { 891 try { 892 if (!ON) 893 return ""; 894 if (o == null) 895 return "null"; 896 if (o.getName() == null) 897 return "UNNAMED," + Integer.toHexString(o.hashCode()); 898 return o.getName() + "," + Integer.toHexString(o.hashCode()); 899 } catch (Exception e) { 900 exceptionInTrace(e); 901 } 902 return ""; 903 } 904 905 public static String brief(String name, Collection coll) { 906 try { 907 if (!ON) 908 return ""; 909 if (coll == null) 910 return name + ":null"; 911 if (coll.size() == 0) 912 return name + ":size(0)"; 913 return brief(name,coll.toArray()); 914 } catch (Exception e) { 915 exceptionInTrace(e); 916 } 917 return ""; 918 } 919 920 public static String brief(String name, Object [] objs) { 921 try { 922 if (!ON) 923 return ""; 924 if (objs == null) 925 return name + ":null"; 926 if (objs.length == 0) 927 return name + ":size(0)"; 928 int i; 929 StringBuffer buff = new StringBuffer (""); 930 for (i = 0; i < objs.length; i++) { 931 String s = (objs[i] == null) ? "null" : objs[i].toString(); 932 buff.append(" "); 933 buff.append(name); 934 buff.append("["); 935 buff.append(i); 936 buff.append("]:"); 937 buff.append(s); 938 } 939 return buff.toString(); 940 } catch (Exception e) { 941 exceptionInTrace(e); 942 } 943 return ""; 944 } 945 946 950 public static String brief(Map map) { 951 try { 952 if (!ON) 953 return ""; 954 if (map == null) 955 return "<null>"; 956 if (map.isEmpty()) 957 return "size(0)"; 958 959 StringBuffer result = new StringBuffer ("{"); 960 boolean first = true; 961 Iterator it = map.keySet().iterator(); 962 963 while (it.hasNext()) { 964 String n = (String ) it.next(); 965 Object value = map.get(n); 966 if (value == null) 967 value = "<null>"; 968 Object v2 = checkWsdl(value); 969 970 if (!first) 971 result.append(", "); 972 first = false; 973 result.append(n); 974 result.append("="); 975 result.append(v2.toString()); 976 } 977 978 result.append("}"); 979 return result.toString(); 980 } catch (Exception e) { 981 exceptionInTrace(e); 982 } 983 return ""; 984 } 985 986 private static void checkWsdl(Object [] parms) { 987 if (parms == null) 988 return; 989 for (int i = 0; i < parms.length; i++) 990 parms[i] = checkWsdl(parms[i]); 991 } 992 993 private static Object checkWsdl(Object o) { 994 String str = null; 995 boolean found = false; 996 997 if (o instanceof Definition) { 998 found = true; 999 Definition d = (Definition) o; 1000 if (d == null) 1001 str = "definition(NULL)"; 1002 else if (d.getQName() == null) 1003 str = "definition(UNNAMED"; 1004 else 1005 str = "definition(" + d.getQName(); 1006 } else if (o instanceof Service) { 1007 found = true; 1008 Service s = (Service) o; 1009 if (s == null) 1010 str = "service(NULL)"; 1011 else if (s.getQName() == null) 1012 str = "service(UNNAMED"; 1013 else 1014 str = "service(" + s.getQName(); 1015 } else if (o instanceof Port) { 1016 found = true; 1017 Port p = (Port) o; 1018 if (p == null) 1019 str = "port(NULL)"; 1020 else if (p.getName() == null) 1021 str = "port(UNNAMED"; 1022 else 1023 str = "port(" + p.getName(); 1024 } else if (o instanceof PortType) { 1025 found = true; 1026 PortType pt = (PortType) o; 1027 if (pt == null) 1028 str = "portType(NULL)"; 1029 else if (pt.getQName() == null) 1030 str = "portType(UNNAMED"; 1031 else 1032 str = "portType(" + pt.getQName(); 1033 } else if (o instanceof Operation) { 1034 found = true; 1035 Operation op = (Operation) o; 1036 if (op == null) 1037 str = "operation(NULL)"; 1038 else if (op.getName() == null) 1039 str = "operation(UNNAMED"; 1040 else 1041 str = "operation(" + op.getName(); 1042 } else if (o instanceof Binding) { 1043 found = true; 1044 Binding b = (Binding) o; 1045 if (b == null) 1046 str = "binding(NULL)"; 1047 else if (b.getQName() == null) 1048 str = "binding(UNNAMED"; 1049 else 1050 str = "binding(" + b.getQName(); 1051 } else if (o instanceof BindingOperation) { 1052 found = true; 1053 BindingOperation bo = (BindingOperation) o; 1054 if (bo == null) 1055 str = "bindingOperation(NULL)"; 1056 else if (bo.getName() == null) 1057 str = "bindingOperation(UNNAMED"; 1058 else 1059 str = "bindingOperation(" + bo.getName(); 1060 } else if (o instanceof BindingInput) { 1061 found = true; 1062 BindingInput bi = (BindingInput) o; 1063 if (bi == null) 1064 str = "bindingInput(NULL)"; 1065 else if (bi.getName() == null) 1066 str = "bindingInput(UNNAMED"; 1067 else 1068 str = "bindingInput(" + bi.getName(); 1069 } else if (o instanceof BindingOutput) { 1070 found = true; 1071 BindingOutput bo = (BindingOutput) o; 1072 if (bo == null) 1073 str = "bindingOutput(NULL)"; 1074 else if (bo.getName() == null) 1075 str = "bindingOutput(UNNAMED"; 1076 else 1077 str = "bindingOutput(" + bo.getName(); 1078 } else if (o instanceof Map ) { 1079 Map map = (Map ) o; 1080 HashMap newMap = null; 1081 Iterator it = map.keySet().iterator(); 1082 while (it.hasNext()) { 1083 Object key = it.next(); 1084 if (key == null) 1085 continue; 1086 Object value = map.get(key); 1087 if (value == null) 1088 continue; 1089 Object alt = checkWsdl(value); 1090 if (!value.equals(alt)) { 1091 if (newMap == null) 1092 newMap = new HashMap (map); 1093 newMap.put(key, alt); 1094 } 1095 } 1096 if (newMap != null) 1097 return newMap; 1098 return map; 1099 } 1100 1101 if (!found) 1102 return o; 1103 if (o != null) 1104 str = str + "," + Integer.toHexString(o.hashCode()) + ")"; 1105 return str; 1106 } 1107 1108 1118 private static void appendMethodName(StringBuffer buff) { 1119 Exception e = new Exception (); 1120 StringWriter sw = new StringWriter (); 1121 PrintWriter pw = new PrintWriter (sw); 1122 e.printStackTrace(pw); 1123 String stack = sw.getBuffer().toString(); 1124 1125 if (traceTrace) 1126 traceLog.debug("TRACE stack=" + stack); 1127 1128 StringTokenizer st1 = 1132 new StringTokenizer ( 1133 stack, 1134 System.getProperty("line.separator", "\n")); 1135 boolean foundWsifLogging = false; 1136 String tok1 = null; 1137 while (st1.hasMoreTokens()) { 1138 tok1 = st1.nextToken(); 1139 1140 if (tok1.indexOf(wsifPackageName + ".logging") != -1) { 1141 foundWsifLogging = true; 1142 continue; 1143 } 1144 1145 if (foundWsifLogging) 1146 break; 1147 } 1148 if (traceTrace) 1149 traceLog.debug("TRACE token=" + tok1); 1150 1151 StringTokenizer st2 = new StringTokenizer (tok1); 1155 String tok2 = null; 1156 while (st2.hasMoreTokens()) { 1157 tok2 = st2.nextToken(); 1158 if (tok2.indexOf("(") != -1) 1159 break; 1160 } 1161 if (tok2.indexOf("(") == -1) 1162 tok2 = tok1; 1163 1164 buff.append(" "); 1169 while (st1.hasMoreTokens()) { 1170 if (st1.nextToken().indexOf(wsifPackageName) != -1) 1171 buff.append(" "); 1172 } 1173 1174 int idx = tok2.indexOf("("); 1178 if (idx != -1) 1179 tok2 = tok2.substring(0, idx); 1180 if (traceTrace) 1181 traceLog.debug("TRACE token=" + tok2); 1182 1183 String result = null; 1190 if (tok2.startsWith(wsifPackageName)) { 1191 StringTokenizer st3 = new StringTokenizer (tok2, "."); 1192 String previous = null; 1193 while (st3.hasMoreTokens()) { 1194 previous = result; 1195 result = st3.nextToken(); 1196 } 1197 if (previous != null) 1198 result = previous + "." + result; 1199 } else 1200 result = tok2; 1201 1202 if (traceTrace) 1203 traceLog.debug("TRACE appending result=" + result); 1204 buff.append(result); 1205 } 1206 1207 private static void traceIt( 1208 Object that, 1209 String type, 1210 boolean expandWsdl, 1211 Object [] parms) { 1212 1213 boolean isEvent = false; 1214 if (EVENT.equals(type)) 1215 isEvent = true; 1216 1217 if (!expandWsdl) 1218 checkWsdl(parms); 1219 1220 StringBuffer sb = new StringBuffer (type); 1221 if (isEvent) sb.append(" "); 1222 appendMethodName(sb); 1223 1224 if (that != null) { 1225 sb.append("<"); 1226 sb.append(Integer.toHexString(that.hashCode())); 1227 sb.append(">"); 1228 } 1229 1230 if (isEvent) 1231 sb.append(" "); 1232 else 1233 sb.append("("); 1234 1235 if (parms != null) 1236 for (int i = 0; i < parms.length; i++) { 1237 if (i != 0 && !isEvent) 1238 sb.append(", "); 1239 sb.append(parms[i] == null ? "<null>" : parms[i].toString()); 1240 } 1241 if (!isEvent) 1242 sb.append(")"); 1243 1244 log.debug(sb); 1245 } 1246} | Popular Tags |