1 25 26 27 package org.objectweb.jonas_ejb.genic; 28 29 30 import java.lang.reflect.Method ; 31 import java.util.ArrayList ; 32 import java.util.Iterator ; 33 import java.util.List ; 34 import java.util.StringTokenizer ; 35 import java.util.Vector ; 36 37 import org.objectweb.jonas_ejb.deployment.api.BeanDesc; 38 import org.objectweb.jonas_ejb.deployment.api.EntityJdbcCmp1Desc; 39 import org.objectweb.jonas_ejb.deployment.api.EntityJdbcCmp2Desc; 40 import org.objectweb.jonas_ejb.deployment.api.FieldJdbcDesc; 41 import org.objectweb.jonas_ejb.deployment.api.MethodCmp2Desc; 42 import org.objectweb.jonas_ejb.deployment.api.MethodDesc; 43 import org.objectweb.jonas_ejb.deployment.api.MethodJdbcCmp1Desc; 44 import org.objectweb.jonas_ejb.lib.BeanNaming; 45 import org.objectweb.jonas_ejb.lib.JavaType; 46 import org.objectweb.jonas_lib.deployment.api.DeploymentDescException; 47 import org.objectweb.jorm.type.api.PType; 48 49 50 57 58 public class VcMethod { 59 60 63 static final byte METHOD_CREATE = 0; 64 67 static final byte METHOD_EJB_CREATE = 1; 68 71 static final byte METHOD_EJB_POST_CREATE = 2; 72 75 static final byte METHOD_REMOVE_THIS = 10; 76 79 static final byte METHOD_REMOVE_PK = 11; 80 83 static final byte METHOD_REMOVE_HANDLE = 12; 84 87 static final byte METHOD_EJB_REMOVE = 13; 88 91 static final byte METHOD_FINDER_BY_PK = 20; 92 95 static final byte METHOD_FINDER_ALL = 21; 96 99 static final byte METHOD_FINDER_SIMPLE = 22; 100 103 static final byte METHOD_FINDER_ENUM = 23; 104 107 static final byte METHOD_FINDER_COL = 24; 108 111 static final byte METHOD_EJB_SELECT_SIMPLE = 30; 112 115 static final byte METHOD_EJB_SELECT_COL = 31; 116 119 static final byte METHOD_EJB_SELECT_SET = 32; 120 123 static final byte METHOD_EJB_LOAD = 40; 124 127 static final byte METHOD_EJB_STORE = 41; 128 131 static final byte METHOD_EJB_SET_ENTITY_CONTEXT = 42; 132 135 static final byte METHOD_EJB_ACTIVATE = 43; 136 137 140 private byte mKind = -1; 141 142 145 private String mName = null; 146 147 150 private String mCapName = null; 151 152 155 private StringBuffer mFormalParameters = null; 156 157 160 private StringBuffer mActualParameters = null; 161 162 165 private StringBuffer mArrayObjectParameters = null; 166 167 170 private StringBuffer mExceptionList = null; 171 172 175 private String mSecuritySignature; 176 177 180 private int mTxAttribute = MethodDesc.TX_NULL; 181 182 185 private String mReturnType; 186 187 190 private Method mMethod = null; 191 192 195 private int methodIndex = -1; 196 197 200 private BeanDesc beanDesc = null; 201 202 205 206 209 private String mSqlStmt = null; 210 211 214 private ArrayList mParamWhereList = null; 215 216 219 220 224 225 private boolean isEjbqlReturnRemoteBean = false; 226 230 231 private boolean isEjbqlReturnLocalBean = false; 232 236 237 private org.objectweb.medor.api.Field resFieldOfEjbql = null; 238 242 private ArrayList mParamList = null; 243 244 247 private Class [] parameterTypes = null; 248 251 private boolean canThrowCreate = false; 252 253 259 VcMethod(Method method, MethodDesc methodDesc, BeanDesc dd) { 260 261 if (methodDesc != null) { 262 methodIndex = methodDesc.getIndex(); 263 } 264 beanDesc = dd; 265 278 279 Class declClass = method.getDeclaringClass(); 280 Class [] params = method.getParameterTypes(); 281 parameterTypes = params; 282 Class [] exceptions = method.getExceptionTypes(); 283 mMethod = method; 284 285 mName = method.getName(); 287 mCapName = BeanNaming.firstToUpperCase(mName); 288 289 mFormalParameters = new StringBuffer (); 291 mActualParameters = new StringBuffer (); 292 mArrayObjectParameters = new StringBuffer (); 293 String var = null; 294 for (int p = 1; p <= params.length; p++) { 295 var = "p" + p; 296 mFormalParameters.append(JavaType.getName(params[p - 1]) + " " + var); 297 mActualParameters.append(var); 298 mArrayObjectParameters.append(JavaType.toStringObject(var, params[p - 1])); 299 if (p < params.length) { 300 mFormalParameters.append(", "); 301 mActualParameters.append(", "); 302 mArrayObjectParameters.append(", "); 303 } 304 } 305 306 mExceptionList = new StringBuffer (); 308 for (int e = 0; e < exceptions.length; e++) { 309 Class ecl = exceptions[e]; 310 if (javax.ejb.CreateException .class.isAssignableFrom(ecl)) { 311 canThrowCreate = true; 312 } 313 mExceptionList.append(JavaType.getName(ecl)); 314 if (e < exceptions.length - 1) { 315 mExceptionList.append(", "); 316 } 317 } 318 319 if (methodDesc != null) { 322 mSecuritySignature = ""; 323 if (methodDesc.getRoleName().length > 0 || methodDesc.isExcluded()) { 324 mSecuritySignature = BeanNaming.getSignature(dd.getEjbName(), method); 325 } 326 } 327 328 if (methodDesc != null) { 331 mTxAttribute = methodDesc.getTxAttribute(); 332 } 333 334 mReturnType = JavaType.getName(method.getReturnType()); 336 337 boolean isFinder = false; 339 340 if (mName.startsWith("find") 341 && (javax.ejb.EJBHome .class.isAssignableFrom(declClass) 342 || javax.ejb.EJBLocalHome .class.isAssignableFrom(declClass)) 343 ) { 344 isFinder = true; 345 } 346 if (isFinder) { 347 if ("findByPrimaryKey".equals(mName)) { 348 mKind = METHOD_FINDER_BY_PK; 349 } else { 350 if (java.util.Enumeration .class.equals(method.getReturnType())) { 351 mKind = METHOD_FINDER_ENUM; 352 } else if (java.util.Collection .class.equals(method.getReturnType())) { 353 mKind = METHOD_FINDER_COL; 354 } else { 355 mKind = METHOD_FINDER_SIMPLE; 356 } 357 } 358 } 359 360 if (mName.startsWith("create") 362 && (javax.ejb.EJBHome .class.isAssignableFrom(declClass) 363 || javax.ejb.EJBLocalHome .class.isAssignableFrom(declClass)) 364 ) { 365 mKind = METHOD_CREATE; 366 } 367 368 if (mName.startsWith("ejbCreate") 370 && javax.ejb.EnterpriseBean .class.isAssignableFrom(declClass)) { 371 mKind = METHOD_EJB_CREATE; 372 } 373 374 if (mName.startsWith("ejbPostCreate") 376 && javax.ejb.EnterpriseBean .class.isAssignableFrom(declClass)) { 377 mKind = METHOD_EJB_POST_CREATE; 378 } 379 380 boolean isRemove = "remove".equals(mName); 382 if (isRemove) { 383 if (declClass.equals(javax.ejb.EJBObject .class) 384 || declClass.equals(javax.ejb.EJBLocalObject .class)) { 385 mKind = METHOD_REMOVE_THIS; 386 } else if (declClass.equals(javax.ejb.EJBHome .class) 387 || declClass.equals(javax.ejb.EJBLocalHome .class)) { 388 if (params[0].equals(javax.ejb.Handle .class)) { 389 mKind = METHOD_REMOVE_HANDLE; 390 } else { 391 mKind = METHOD_REMOVE_PK; 392 } 393 } 394 } 395 396 if (javax.ejb.EnterpriseBean .class.isAssignableFrom(declClass) 398 && (params.length == 0)) { 399 if ("ejbRemove".equals(mName)) { 400 mKind = METHOD_EJB_REMOVE; 401 } else if ("ejbLoad".equals(mName)) { 402 mKind = METHOD_EJB_LOAD; 403 } else if ("ejbStore".equals(mName)) { 404 mKind = METHOD_EJB_STORE; 405 } 406 } 407 408 if (javax.ejb.EnterpriseBean .class.isAssignableFrom(declClass)) { 410 if ("setEntityContext".equals(mName) 411 && (params.length == 1) 412 && javax.ejb.EntityContext .class.equals(params[0])) { 413 mKind = METHOD_EJB_SET_ENTITY_CONTEXT; 414 } 415 } 416 417 if (javax.ejb.EnterpriseBean .class.isAssignableFrom(declClass)) { 419 if ("ejbActivate".equals(mName) 420 && (params.length == 0)) { 421 mKind = METHOD_EJB_ACTIVATE; 422 } 423 } 424 425 if (dd instanceof EntityJdbcCmp1Desc) { 426 EntityJdbcCmp1Desc edd = (EntityJdbcCmp1Desc) dd; 429 StringBuffer lf = new StringBuffer (); 430 StringBuffer lv = new StringBuffer (); 431 boolean firstLf = true; 432 boolean firstLv = true; 433 if (mKind == METHOD_EJB_CREATE) { 434 for (Iterator i = edd.getCmpFieldDescIterator(); i.hasNext();) { 435 FieldJdbcDesc fd = (FieldJdbcDesc) i.next(); 436 if (firstLv) { 437 firstLv = false; 438 } else { 439 lf.append(", "); 440 lv.append(", "); 441 } 442 lf.append(fd.getJdbcFieldName()); 443 lv.append("?"); 444 } 445 mSqlStmt = 446 "insert into " + edd.getJdbcTableName() 447 + " (" + lf + ") values (" + lv + ")"; 448 } else if (mKind == METHOD_FINDER_BY_PK) { 449 for (Iterator i = edd.getCmpFieldDescIterator(); i.hasNext();) { 450 FieldJdbcDesc fd = (FieldJdbcDesc) i.next(); 451 if (fd.isPrimaryKey()) { 452 if (firstLv) { 453 firstLv = false; 454 } else { 455 lf.append(", "); 456 lv.append(" and "); 457 } 458 lf.append(fd.getJdbcFieldName()); 459 lv.append(fd.getJdbcFieldName() + "=?"); 460 } 461 } 462 463 mSqlStmt = 464 "select " + lf + " from " + edd.getJdbcTableName() 465 + " where " + lv; 466 } else if ((mKind == METHOD_FINDER_SIMPLE) 467 || (mKind == METHOD_FINDER_ENUM) 468 || (mKind == METHOD_FINDER_COL)) { 469 if (!((MethodJdbcCmp1Desc) methodDesc).hasWhereClause()) { 470 throw new Error ("No WHERE clause defined for the finder method '" 471 + method.toString() + "'"); 472 } 473 ArrayList posParams = new ArrayList (); 474 String clauseWhere = parseWhere (((MethodJdbcCmp1Desc) methodDesc).getWhereClause(), posParams); 475 for (Iterator i = edd.getCmpFieldDescIterator(); i.hasNext();) { 476 FieldJdbcDesc fd = (FieldJdbcDesc) i.next(); 477 if (fd.isPrimaryKey()) { 478 if (firstLf) { 479 firstLf = false; 480 } else { 481 lf.append(", "); 482 } 483 lf.append(fd.getJdbcFieldName()); 484 } 485 } 486 487 mSqlStmt = 488 "select " + lf + " from " + edd.getJdbcTableName() 489 + " " + clauseWhere; 490 mParamWhereList = new ArrayList (); 491 for (int i = 0; i < posParams.size(); i++) { 492 int pos = ((Integer ) posParams.get(i)).intValue(); 493 if (pos >= params.length) { 494 throw new Error ("Wrong parameters number between the method definition and the WHERE clause of the method '" + method + "'"); 495 } 496 VcParamWhere vpw = new VcParamWhere(params[pos], pos + 1); 497 mParamWhereList.add(vpw); 498 } 499 } else if (mKind == METHOD_EJB_REMOVE) { 500 for (Iterator i = edd.getCmpFieldDescIterator(); i.hasNext();) { 501 FieldJdbcDesc fd = (FieldJdbcDesc) i.next(); 502 if (fd.isPrimaryKey()) { 503 if (firstLv) { 504 firstLv = false; 505 } else { 506 lv.append(" and "); 507 } 508 lv.append(fd.getJdbcFieldName() + "=?"); 509 } 510 } 511 512 mSqlStmt = 513 "delete from " + edd.getJdbcTableName() 514 + " where " + lv; 515 } else if (mKind == METHOD_EJB_LOAD) { 516 for (Iterator i = edd.getCmpFieldDescIterator(); i.hasNext();) { 517 FieldJdbcDesc fd = (FieldJdbcDesc) i.next(); 518 if (firstLf) { 519 firstLf = false; 520 } else { 521 lf.append(", "); 522 } 523 lf.append(fd.getJdbcFieldName()); 524 if (fd.isPrimaryKey()) { 525 if (firstLv) { 526 firstLv = false; 527 } else { 528 lv.append(" and "); 529 } 530 lv.append(fd.getJdbcFieldName() + "=?"); 531 } 532 } 533 534 mSqlStmt = 535 "select " + lf + " from " + edd.getJdbcTableName() 536 + " where " + lv; 537 } else if (mKind == METHOD_EJB_STORE) { 538 for (Iterator i = edd.getCmpFieldDescIterator(); i.hasNext();) { 539 FieldJdbcDesc fd = (FieldJdbcDesc) i.next(); 540 if (fd.isPrimaryKey()) { 541 if (firstLv) { 542 firstLv = false; 543 } else { 544 lv.append(" and "); 545 } 546 lv.append(fd.getJdbcFieldName() + "=?"); 547 } else { 548 if (firstLf) { 549 firstLf = false; 550 } else { 551 lf.append(", "); 552 } 553 lf.append(fd.getJdbcFieldName() + "=?"); 554 } 555 } 556 mSqlStmt = 557 "update " + edd.getJdbcTableName() 558 + " set " + lf + " where " + lv; 559 } 560 } else if (dd instanceof EntityJdbcCmp2Desc) { 561 boolean isEjbSelect = false; 563 if (mName.startsWith("ejbSelect") 564 && javax.ejb.EntityBean .class.isAssignableFrom(declClass)) { 565 isEjbSelect = true; 566 } 567 if (isEjbSelect) { 568 if (java.util.Collection .class.equals(method.getReturnType())) { 569 mKind = METHOD_EJB_SELECT_COL; 570 } else if (java.util.Set .class.equals(method.getReturnType())) { 571 mKind = METHOD_EJB_SELECT_SET; 572 } else { 573 mKind = METHOD_EJB_SELECT_SIMPLE; 574 } 575 } 576 if (isFinder || isEjbSelect) { 577 mParamList = new ArrayList (); 578 for (int p = 0; p < params.length; p++) { 579 mParamList.add(new VcParam(params[p], dd)); 580 } 581 if (isEjbSelect) { 582 try { 583 resFieldOfEjbql = ((MethodCmp2Desc) methodDesc).getQueryTreeHolder(null).getResField(); 584 if (resFieldOfEjbql.getType().getTypeCode() == PType.TYPECODE_REFERENCE) { 585 if (((MethodCmp2Desc) methodDesc).isResultTypeMappingRemote()) { 586 isEjbqlReturnRemoteBean = true; 587 } else { 588 isEjbqlReturnLocalBean = true; 589 } 590 } 591 } catch (DeploymentDescException e) { 592 throw new Error ("Error while the EJB-QL parsing of '" + method.toString() 593 + "': " + e.getMessage()); 594 } 595 } else if (!isFinderByPk()) { 596 try { 598 ((MethodCmp2Desc) methodDesc).getQueryTreeHolder(null).getResField(); 599 } catch (DeploymentDescException ignore) { 600 GenIC.warning("Warning: Error while the EJB-QL parsing of '" + method.toString() 601 + "': " + ignore.getMessage()); 602 } 603 } 604 } 605 606 } 607 608 } 611 612 621 private String parseWhere(String fragment, List pos) { 622 StringTokenizer parseWhere = new StringTokenizer (fragment, "?\n", true); 623 int numpos = pos.size(); 624 String newWhere = ""; 625 String tok; 626 while (parseWhere.hasMoreTokens()) { 627 tok = parseWhere.nextToken(); 628 String numVar = ""; 629 if (Character.isDigit(tok.charAt(0))) { 630 for (int i = 0; tok.length() > i && Character.isDigit(tok.charAt(i)); i++) { 631 numVar += tok.charAt(i); 632 } 633 if (numVar.length() > 0) { 634 newWhere += tok.substring(numVar.length(), tok.length()); 635 pos.set(numpos - 1, (Object ) new Integer (Integer.parseInt(numVar) - 1)); 636 } 637 } else { 638 newWhere += tok; 639 if (tok.charAt(0) == '?') { 640 pos.add(new Integer (numpos++)); 641 } 642 } 643 } 644 return newWhere; 645 } 646 647 650 public String getName() { 651 return mName; 652 } 653 654 657 public String getCapName() { 658 return mCapName; 659 } 660 661 664 public String getFormalParameters() { 665 return mFormalParameters.toString(); 666 } 667 668 671 public String getActualParameters() { 672 return mActualParameters.toString(); 673 } 674 675 678 public String getExceptionList() { 679 return mExceptionList.toString(); 680 } 681 682 685 public boolean canThrowCreate() { 686 return canThrowCreate; 687 } 688 689 692 public String getSecuritySignature() { 693 if (mSecuritySignature == null) { 694 throw new Error ("VcMethod.getSecuritySignature() not available for the method '" 695 + mMethod.toString() + "'"); 696 } 697 return mSecuritySignature; 698 } 699 700 703 public int getTxAttribute() { 704 if (mTxAttribute == MethodDesc.TX_NULL) { 705 throw new Error ("VcMethod.getTxAttribute() not available for the method '" 706 + mMethod.toString() + "'"); 707 } 708 return mTxAttribute; 709 } 710 711 714 public String getReturnType() { 715 return mReturnType; 716 } 717 718 721 public boolean isFinderAll() { 722 return false; 724 } 725 726 729 public boolean isFinderByPk() { 730 return (mKind == METHOD_FINDER_BY_PK); 731 } 732 733 736 public boolean isFinderSimple() { 737 return (mKind == METHOD_FINDER_SIMPLE); 738 } 739 740 743 public boolean isFinderEnum() { 744 return (mKind == METHOD_FINDER_ENUM); 745 } 746 747 750 public boolean isFinderCol() { 751 return (mKind == METHOD_FINDER_COL); 752 } 753 754 757 public boolean isEjbSelectSimple() { 758 return (mKind == METHOD_EJB_SELECT_SIMPLE); 759 } 760 761 764 public boolean isEjbSelectSet() { 765 return (mKind == METHOD_EJB_SELECT_SET); 766 } 767 768 771 public boolean isEjbSelectCol() { 772 return (mKind == METHOD_EJB_SELECT_COL); 773 } 774 775 778 public boolean isEjbqlReturnRemoteBean() { 779 return isEjbqlReturnRemoteBean; 780 } 781 782 785 public boolean isEjbqlReturnLocalBean() { 786 return isEjbqlReturnLocalBean; 787 } 788 789 792 public boolean isCreate() { 793 return (mKind == METHOD_CREATE); 794 } 795 796 799 public boolean isEjbCreate() { 800 return (mKind == METHOD_EJB_CREATE); 801 } 802 803 806 public boolean isEjbPostCreate() { 807 return (mKind == METHOD_EJB_POST_CREATE); 808 } 809 810 813 public boolean isRemoveThis() { 814 return (mKind == METHOD_REMOVE_THIS); 815 } 816 817 820 public boolean isRemovePk() { 821 return (mKind == METHOD_REMOVE_PK); 822 } 823 824 827 public boolean isRemoveHandle() { 828 return (mKind == METHOD_REMOVE_HANDLE); 829 } 830 831 834 public boolean isEjbRemove() { 835 return (mKind == METHOD_EJB_REMOVE); 836 } 837 838 841 public boolean isEjbLoad() { 842 return (mKind == METHOD_EJB_LOAD); 843 } 844 845 848 public boolean isEjbStore() { 849 return (mKind == METHOD_EJB_STORE); 850 } 851 852 855 public boolean isEjbSetEntityContext() { 856 return (mKind == METHOD_EJB_SET_ENTITY_CONTEXT); 857 } 858 859 862 public boolean isEjbActivate() { 863 return (mKind == METHOD_EJB_ACTIVATE); 864 } 865 866 870 public String getSqlStmt() { 871 if (mSqlStmt == null) { 872 throw new Error ("VcMethod.getSqlStmt() not available for the method '" 873 + mMethod.toString() + "'"); 874 } 875 return mSqlStmt; 876 } 877 878 879 882 public Class [] getParameterTypes() { 883 return parameterTypes; 884 } 885 886 889 public int getParametersNumber() { 890 return parameterTypes.length; 891 } 892 893 894 898 public Vector getParamWhereList() { 899 if (mParamWhereList == null) { 900 throw new Error ("VcMethod.getParamWhereList() not available for the method '" 901 + mMethod.toString() + "'"); 902 } 903 return (new Vector (mParamWhereList)); 904 } 905 906 907 910 public Vector getParamList() { 911 if (mParamList == null) { 912 throw new Error ("VcMethod.getParamList() not available for the method '" 913 + mMethod.toString() + "'"); 914 } 915 return (new Vector (mParamList)); 916 } 917 918 919 922 public int getMethodIndex() { 923 return methodIndex; 924 } 925 926 930 public org.objectweb.medor.api.Field getResFieldOfEjbql() { 931 return resFieldOfEjbql; 932 } 933 934 938 public String getTupleGetter() { 939 PType type = resFieldOfEjbql.getType(); 940 switch(type.getTypeCode()) { 941 case PType.TYPECODE_BOOLEAN: 942 return "getBoolean"; 943 case PType.TYPECODE_BYTE: 944 return "getByte"; 945 case PType.TYPECODE_CHAR: 946 return "getChar"; 947 case PType.TYPECODE_DATE: 948 return "getDate"; 949 case PType.TYPECODE_DOUBLE: 950 return "getDouble"; 951 case PType.TYPECODE_FLOAT: 952 return "getFloat"; 953 case PType.TYPECODE_INT: 954 return "getInt"; 955 case PType.TYPECODE_LONG: 956 return "getLong"; 957 case PType.TYPECODE_SERIALIZED: 958 return "getObject"; 959 case PType.TYPECODE_SHORT: 960 return "getShort"; 961 case PType.TYPECODE_STRING: 962 return "getString"; 963 case PType.TYPECODE_BIGDECIMAL: 964 case PType.TYPECODE_REFERENCE: 965 case PType.TYPECODE_BYTEARRAY: 966 case PType.TYPECODE_CHARARRAY: 967 case PType.TYPECODE_OBJBOOLEAN: 968 case PType.TYPECODE_OBJBYTE: 969 case PType.TYPECODE_OBJCHAR: 970 case PType.TYPECODE_OBJDOUBLE: 971 case PType.TYPECODE_OBJFLOAT: 972 case PType.TYPECODE_OBJINT: 973 case PType.TYPECODE_OBJLONG: 974 case PType.TYPECODE_OBJSHORT: 975 default: 976 return "getObject"; 977 } 978 } 979 980 984 public boolean isTupleGetterPrimitive() { 985 PType type = resFieldOfEjbql.getType(); 986 switch(type.getTypeCode()) { 987 case PType.TYPECODE_BOOLEAN: 988 case PType.TYPECODE_BYTE: 989 case PType.TYPECODE_CHAR: 990 case PType.TYPECODE_DOUBLE: 991 case PType.TYPECODE_FLOAT: 992 case PType.TYPECODE_INT: 993 case PType.TYPECODE_LONG: 994 case PType.TYPECODE_SHORT: 995 return true; 996 default: 997 return false; 998 } 999 } 1000 1001 1005 public String getTupleGetterObjectClass() { 1006 PType type = resFieldOfEjbql.getType(); 1007 switch(type.getTypeCode()) { 1008 case PType.TYPECODE_BOOLEAN: 1009 return "Boolean"; 1010 case PType.TYPECODE_BYTE: 1011 return "Byte"; 1012 case PType.TYPECODE_CHAR: 1013 return "Char"; 1014 case PType.TYPECODE_DOUBLE: 1015 return "Double"; 1016 case PType.TYPECODE_FLOAT: 1017 return "Float"; 1018 case PType.TYPECODE_INT: 1019 return "Integer"; 1020 case PType.TYPECODE_LONG: 1021 return "Long"; 1022 case PType.TYPECODE_SHORT: 1023 return "Short"; 1024 default: 1025 return "Object"; 1026 } 1027 } 1028 1029 1034 String [] splitPath(String path) { 1035 StringTokenizer st = new StringTokenizer (path, "."); 1036 String [] ret = new String [st.countTokens()]; 1037 for (int i = 0; i < ret.length; i++) { 1038 ret[i] = st.nextToken(); 1039 } 1040 return ret; 1041 } 1042 1043 1047 public String getArrayObjectParameters() { 1048 if (mArrayObjectParameters.length() == 0) { 1049 return "new Object[0]"; 1050 } else { 1051 return "new Object[] {" + mArrayObjectParameters.toString() + "}"; 1052 } 1053 } 1054 1055 1056 1059 public String toString() { 1060 StringBuffer ret = new StringBuffer (); 1061 ret.append("\n Name = " + getName()); 1062 ret.append("\n CapName = " + getCapName()); 1063 ret.append("\n FormalParameters = " + getFormalParameters()); 1064 ret.append("\n ActualParameters = " + getActualParameters()); 1065 ret.append("\n ExceptionList = " + getExceptionList()); 1066 if (mSecuritySignature != null) { 1067 ret.append("\n SecuritySignature = " + getSecuritySignature()); 1068 } 1069 if (mTxAttribute != MethodDesc.TX_NULL) { 1070 ret.append("\n TxAttribute = " + getTxAttribute()); 1071 } 1072 ret.append("\n ReturnType = " + getReturnType()); 1073 ret.append("\n isFinderByPk = " + isFinderByPk()); 1074 ret.append("\n isFinderSimple = " + isFinderSimple()); 1075 ret.append("\n isFinderEnum = " + isFinderEnum()); 1076 ret.append("\n isFinderCol = " + isFinderCol()); 1077 ret.append("\n isCreate = " + isCreate()); 1078 ret.append("\n isEjbCreate = " + isEjbCreate()); 1079 ret.append("\n isRemoveThis = " + isRemoveThis()); 1080 ret.append("\n isRemovePk = " + isRemovePk()); 1081 ret.append("\n isRemoveHandle = " + isRemoveHandle()); 1082 ret.append("\n isEjbRemove = " + isEjbRemove()); 1083 ret.append("\n isEjbLoad = " + isEjbLoad()); 1084 ret.append("\n isEjbStore = " + isEjbStore()); 1085 ret.append("\n isEjbSetEntityContext = " + isEjbSetEntityContext()); 1086 ret.append("\n isEjbActivate = " + isEjbActivate()); 1087 ret.append("\n isEjbSelectSimple = " + isEjbSelectSimple()); 1088 ret.append("\n isEjbSelectSet = " + isEjbSelectSet()); 1089 ret.append("\n isEjbSelectCol = " + isEjbSelectCol()); 1090 if (mSqlStmt != null) { 1091 ret.append("\n SqlStmt = " + getSqlStmt()); 1092 } 1093 if (mParamWhereList != null) { 1094 ret.append("\n ParamWhereList = " + getParamWhereList()); 1095 } 1096 return (ret.toString()); 1097 } 1098 1099} 1100 | Popular Tags |