1 23 24 package com.sun.jdo.api.persistence.enhancer.generator; 25 26 import java.lang.reflect.Modifier ; 27 28 import java.util.Iterator ; 29 import java.util.Collection ; 30 import java.util.List ; 31 import java.util.ArrayList ; 32 import java.util.HashMap ; 33 import java.util.Properties ; 34 35 import java.io.Serializable ; 36 import java.io.File ; 37 import java.io.Writer ; 38 import java.io.PrintWriter ; 39 import java.io.FileWriter ; 40 import java.io.BufferedWriter ; 41 import java.io.InputStream ; 42 import java.io.BufferedInputStream ; 43 import java.io.FileInputStream ; 44 import java.io.ObjectOutputStream ; 45 import java.io.IOException ; 46 import java.io.FileNotFoundException ; 47 48 import com.sun.jdo.api.persistence.enhancer.util.Assertion; 49 50 import com.sun.jdo.api.persistence.enhancer.meta.ExtendedJDOMetaData; 51 import com.sun.jdo.api.persistence.enhancer.meta.JDOMetaDataPropertyImpl; 52 53 import com.sun.jdo.spi.persistence.utility.generator.JavaFileWriter; 54 import com.sun.jdo.spi.persistence.utility.generator.JavaClassWriter; 55 import com.sun.jdo.spi.persistence.utility.generator.JavaClassWriterHelper; 56 import com.sun.jdo.spi.persistence.utility.generator.io.IOJavaFileWriter; 57 import com.sun.jdo.spi.persistence.utility.generator.io.IOJavaClassWriter; 58 import com.sun.jdo.spi.persistence.utility.logging.Logger; 59 import com.sun.jdo.api.persistence.enhancer.LogHelperEnhancer; 60 import java.util.ResourceBundle ; 61 import com.sun.jdo.spi.persistence.utility.I18NHelper; 62 63 64 67 public final class Main 68 extends Assertion 69 { 70 81 82 private static final Logger logger = LogHelperEnhancer.getLogger(); 83 private static final String dotLine = 84 "----------------------------------------------------------------------"; 85 88 private final PrintWriter out = new PrintWriter (System.out, true); 89 90 93 private final PrintWriter err = new PrintWriter (System.err, true); 94 95 98 private final CmdLineOptions opts = new CmdLineOptions(); 99 100 103 private JavaFileWriter fWriter = null; 104 private JavaClassWriter writer = null; 105 106 109 private ExtendedJDOMetaData meta = null; 110 111 private File destinationDir = null; 112 113 114 117 private final static ResourceBundle messages = I18NHelper.loadBundle("com.sun.jdo.api.persistence.enhancer.Bundle"); public Main() 119 {} 120 121 public Main(ExtendedJDOMetaData meta, File destinationDir) 122 throws IOException { 123 this.meta = meta; 124 this.destinationDir = destinationDir; 125 createDestinationDir(); 126 } 127 128 131 public static final void main(String [] argv) 132 { 133 final Main gen = new Main(); 134 try { 135 gen.opts.processArgs(argv); 136 gen.init(); 137 gen.generate(); 138 } catch(Exception ex) { 139 gen.printError(null, ex); 140 } 141 } 142 143 146 private class CmdLineOptions 147 { 148 String destinationDirectory = null; 150 String jdoXMLModelFileName = null; 151 String jdoPropertiesFileName = null; 152 boolean verbose = false; 153 154 157 public void usage() { 158 err.println("Usage: Main <options> <arguments>..."); 159 err.println("Options:"); 160 err.println(" -v, --verbose print verbose output"); 161 err.println(" -d, --dest <dir> destination directory for output files"); 162 err.println(" -p, --properties <file> use property file for meta data"); 163 err.println(); 164 err.println("Arguments:"); 165 err.println(); 166 err.println("Returns a non-zero value in case of errors."); 167 System.exit(1); 168 } 169 170 173 protected int processArgs(String [] argv) 174 { 175 for (int i = 0; i < argv.length; i++) { 176 final String arg = argv[i]; 177 if (arg.equals("-v") 178 || arg.equals("--verbose")) { 179 verbose = true; 180 continue; 181 } 182 if (arg.equals("-d") 183 || arg.equals("--dest")) { 184 if (argv.length - i < 2) { 185 printError("Missing argument to the -d/-dest option", null); 186 usage(); 187 } 188 destinationDirectory = argv[++i]; 189 continue; 190 } 191 if (arg.equals("-p") || 192 arg.equals("--properties")) { 193 if (argv.length - i < 2) { 194 printError("Missing argument to the -p/--properties option", null); 195 usage(); 196 } 197 jdoPropertiesFileName = argv[++i]; 198 continue; 199 } 200 if (arg.length() > 0 && arg.charAt(0) == '-') { 201 printError("Unrecognized option:" + arg, null); 202 usage(); 203 } 204 if (arg.length() == 0) { 205 printMessage("Ignoring empty command line argument."); 206 continue; 207 } 208 209 } 211 212 if (jdoPropertiesFileName == null) { 214 printError("No destination directory specified", null); 215 usage(); 216 } 217 218 if (destinationDirectory == null) { 220 printError("No destination directory specified", null); 221 usage(); 222 } 223 224 return 0; 225 } 226 } 227 228 private void init() 229 throws FileNotFoundException , IOException 230 { 231 affirm(opts.jdoPropertiesFileName != null); 233 FileInputStream finput = null; 234 try { 235 final File f = new File (opts.jdoPropertiesFileName); 236 finput = new FileInputStream (f); 237 final Properties props = new Properties (); 238 props.load(finput); 239 meta = new JDOMetaDataPropertyImpl(props, out); 240 } finally { 241 if (finput != null) { 242 try { 243 finput.close(); 244 } catch(Exception ex) { 245 printError(ex.getMessage(), ex); 246 } 247 } 248 } 249 250 affirm(opts.destinationDirectory != null); 251 destinationDir = new File (opts.destinationDirectory); 252 createDestinationDir(); 253 } 254 255 private void createDestinationDir() 256 throws IOException 257 { 258 if (!destinationDir.exists() && !destinationDir.mkdirs()) { 260 throw new IOException (I18NHelper.getMessage(messages,"EXC_DestDirCreateFailure",destinationDir)); } 262 } 263 264 private void generate() 265 throws IOException 266 { 267 final String [] classes = meta.getKnownClasses(); 268 for (int i = 0; i < classes.length; i++) { 269 final String className = classes[i]; 270 generate(className); 271 } 272 } 273 274 public File generate(final String className) 279 throws IOException 280 { 281 affirm(className != null); 282 printMessage("generating '" + className + "'..."); 283 284 final String filePath = className.replace('/', File.separatorChar); 286 final String classFileName 287 = filePath + JavaClassWriterHelper.javaExtension_; 288 final File file = new File (destinationDir, classFileName); 289 290 298 fWriter = new IOJavaFileWriter(file); 299 writer = new IOJavaClassWriter(); 300 generateClass(className); 301 fWriter.addClass(writer); 302 printMessage("DONE generating '" + className + "'..."); 303 304 fWriter.save(); 307 return file; 308 } 309 310 private void generateClass(final String className) 311 throws IOException 312 { 313 affirm(className != null); 314 315 final String packageName = ImplHelper.getPackageName(className); 316 fWriter.setPackage(packageName, null); 317 318 final String oidClassName = meta.getKeyClass(className); 320 if (oidClassName == null) { 321 writeClassHeader(className); 322 } else { 323 final String oidPackageName 324 = ImplHelper.getPackageName(oidClassName); 325 affirm(packageName.equals(oidPackageName), 326 "PC class and key class must be in same package."); 327 328 final boolean enclosedOid 329 = oidClassName.startsWith(className + "$"); 330 if (enclosedOid) { 331 writeClassHeader(className); 332 writeOidClass(className, ImplHelper.getClassName(oidClassName), 333 enclosedOid); 334 } else { 335 writeOidClass(className, ImplHelper.getClassName(oidClassName), 336 enclosedOid); 337 writeClassHeader(className); 338 } 339 } 340 341 writeClassMembers(className); 342 343 final boolean isPC = meta.isPersistenceCapableClass(className); 345 if (isPC) { 346 final boolean isPCRoot 347 = meta.isPersistenceCapableRootClass(className); 348 if (isPCRoot) { 349 writePCRootMembers(className); 350 } 351 writePCMembers(className); 352 } 353 } 354 355 private void writeClassHeader(final String className) 356 throws IOException 357 { 358 final boolean isPCRoot = meta.isPersistenceCapableRootClass(className); 359 final String superclass = 360 ImplHelper.normalizeClassName(meta.getSuperClass(className)); 361 362 final String [] comments = null; 363 final String [] interfaces 364 = (isPCRoot 365 ? new String []{ ImplHelper.CLASSNAME_JDO_PERSISTENCE_CAPABLE, "Cloneable" } 366 : null); 367 writer.setClassDeclaration(meta.getClassModifiers(className), 368 ImplHelper.getClassName(className), comments); 369 writer.setSuperclass(superclass); 370 if (interfaces != null) { 371 for (int i = 0; i < interfaces.length; i++) { 372 writer.addInterface(interfaces[i]); 373 } 374 } 375 } 376 377 private void writeClassMembers(final String className) 378 throws IOException 379 { 380 final String [] comments = new String []{ 381 dotLine, 382 "Class Members:", 383 dotLine 384 }; 385 386 writer.addConstructor(ImplHelper.getClassName(className), 388 Modifier.PUBLIC, null, null, null, 389 ImplHelper.getDefaultConstructorImpl(), 390 comments); 391 392 final String [] fieldNames = meta.getKnownFields(className); 393 final int n = (fieldNames != null ? fieldNames.length : 0); 394 395 final ArrayList list = new ArrayList (); 397 for (int i = 0; i < n; i++) { 398 final String fieldName = (String )fieldNames[i]; 399 final int access = meta.getFieldModifiers(className, fieldName); 400 if ((access & Modifier.STATIC) == 0) { 401 list.add(fieldName); 402 } 403 } 404 405 writer.addMethod( 406 "clone", 407 Modifier.PUBLIC, 408 JavaClassWriterHelper.Object_, 409 null, 410 null, 411 new String []{ "java.lang.CloneNotSupportedException" }, 412 ImplHelper.getCloneImpl(className), 413 ImplHelper.COMMENT_NOT_ENHANCER_ADDED); 414 415 for (int i = 0; i < n; i++) { 417 final String fieldName = (String )fieldNames[i]; 418 writeFieldMember(className, fieldName); 419 } 420 } 421 422 private void writeFieldMember(final String className, 423 final String fieldName) 424 throws IOException 425 { 426 final String fieldType = meta.getFieldType(className, fieldName); 427 final String normalizedFieldType = 428 ImplHelper.normalizeClassName(fieldType); 429 final int fieldNumber = meta.getFieldNo(className, fieldName); 430 final int flags = meta.getFieldFlags(className, fieldName); 431 432 final int access = meta.getFieldModifiers(className, fieldName); 433 434 writer.addField( 436 fieldName, 437 access, 438 normalizedFieldType, 439 null, null); 440 441 if ((access & Modifier.STATIC) != 0) { 443 return; 444 } 445 446 { 448 affirm(((flags & meta.CHECK_READ) == 0) 449 | (flags & meta.MEDIATE_READ) == 0); 450 final String [] impl; 451 if ((flags & meta.CHECK_READ) != 0) { 452 impl = ImplHelper.getFieldCheckReadImpl(fieldName, 453 fieldType, 454 fieldNumber); 455 } else if ((flags & meta.MEDIATE_READ) != 0) { 456 impl = ImplHelper.getFieldMediateReadImpl(fieldName, 457 fieldType, 458 fieldNumber); 459 } else { 460 impl = ImplHelper.getFieldDirectReadImpl(fieldName, 461 fieldType, 462 fieldNumber); 463 } 464 writer.addMethod( 465 createMethodName(JavaClassWriterHelper.get_, fieldName), 466 Modifier.PUBLIC, 467 normalizedFieldType, 468 null, null, null, 469 impl, 470 ImplHelper.COMMENT_ENHANCER_ADDED); 471 } 472 473 { 475 affirm(((flags & meta.CHECK_WRITE) == 0) 476 | (flags & meta.MEDIATE_WRITE) == 0); 477 final String [] impl; 478 if ((flags & meta.CHECK_WRITE) != 0) { 479 impl = ImplHelper.getFieldCheckWriteImpl(fieldName, 480 fieldType, 481 fieldNumber, 482 fieldName); 483 } else if ((flags & meta.MEDIATE_WRITE) != 0 484 && !meta.isKnownNonManagedField(className, fieldName, 485 null)) { 486 impl = ImplHelper.getFieldMediateWriteImpl(fieldName, 487 fieldType, 488 fieldNumber, 489 fieldName); 490 } else { 491 impl = ImplHelper.getFieldDirectWriteImpl(fieldName, 492 fieldType, 493 fieldNumber, 494 fieldName); 495 } 496 writer.addMethod( 497 createMethodName(JavaClassWriterHelper.set_, fieldName), 498 Modifier.PUBLIC, 499 JavaClassWriterHelper.void_, 500 new String []{ fieldName }, 501 new String []{ normalizedFieldType }, 502 null, 503 impl, 504 ImplHelper.COMMENT_ENHANCER_ADDED); 505 } 506 507 } 508 509 private void writePCRootMembers(final String className) 510 throws IOException 511 { 512 final String [] comments = new String []{ 513 dotLine, 514 "Augmentation for Persistence-Capable Root Classes (added by enhancer):", 515 dotLine 516 }; 517 518 writer.addConstructor( 520 ImplHelper.getClassName(className), 521 Modifier.PUBLIC, 522 new String []{ ImplHelper.FIELDNAME_JDO_STATE_MANAGER }, 523 new String []{ ImplHelper.CLASSNAME_JDO_STATE_MANAGER }, 524 null, 525 ImplHelper.getJDOConstructorSMImpl(ImplHelper.FIELDNAME_JDO_STATE_MANAGER), 526 comments); 527 528 writer.addField( 530 ImplHelper.FIELDNAME_JDO_STATE_MANAGER, 531 Modifier.PUBLIC | Modifier.TRANSIENT, 532 ImplHelper.CLASSNAME_JDO_STATE_MANAGER, 533 JavaClassWriterHelper.null_, 534 ImplHelper.COMMENT_ENHANCER_ADDED); 535 536 writer.addField( 538 ImplHelper.FIELDNAME_JDO_FLAGS, 539 Modifier.PUBLIC | Modifier.TRANSIENT, 540 "byte", 541 "0", 542 ImplHelper.COMMENT_ENHANCER_ADDED); 543 544 545 writer.addMethod( 547 ImplHelper.METHODNAME_JDO_GET_STATE_MANAGER, 548 Modifier.PUBLIC | Modifier.FINAL, 549 ImplHelper.CLASSNAME_JDO_STATE_MANAGER, null, null, null, 550 new String [] { "return " + ImplHelper.FIELDNAME_JDO_STATE_MANAGER + JavaClassWriterHelper.delim_ }, 551 ImplHelper.COMMENT_ENHANCER_ADDED); 552 553 writer.addMethod( 555 ImplHelper.METHODNAME_JDO_SET_STATE_MANAGER, 556 Modifier.PUBLIC | Modifier.FINAL, 557 JavaClassWriterHelper.void_, 558 new String [] { ImplHelper.FIELDNAME_JDO_STATE_MANAGER }, 559 new String [] { ImplHelper.CLASSNAME_JDO_STATE_MANAGER }, null, 560 new String [] { "this." + ImplHelper.FIELDNAME_JDO_STATE_MANAGER + " = " + ImplHelper.FIELDNAME_JDO_STATE_MANAGER + JavaClassWriterHelper.delim_ }, 561 ImplHelper.COMMENT_ENHANCER_ADDED); 562 563 writer.addMethod( 565 ImplHelper.METHODNAME_JDO_GET_FLAGS, 566 Modifier.PUBLIC | Modifier.FINAL, 567 "byte", null, null, null, 568 new String [] { "return " + ImplHelper.FIELDNAME_JDO_FLAGS + 569 JavaClassWriterHelper.delim_ }, 570 ImplHelper.COMMENT_ENHANCER_ADDED); 571 572 writer.addMethod( 574 ImplHelper.METHODNAME_JDO_SET_FLAGS, 575 Modifier.PUBLIC | Modifier.FINAL, 576 JavaClassWriterHelper.void_, 577 new String [] { ImplHelper.FIELDNAME_JDO_FLAGS }, 578 new String [] { "byte" }, null, 579 new String [] { "this." + ImplHelper.FIELDNAME_JDO_FLAGS + " = " + ImplHelper.FIELDNAME_JDO_FLAGS + JavaClassWriterHelper.delim_ }, 580 ImplHelper.COMMENT_ENHANCER_ADDED); 581 582 writer.addMethod( 584 ImplHelper.METHODNAME_JDO_GET_PERSISTENCE_MANAGER, 585 Modifier.PUBLIC | Modifier.FINAL, 586 ImplHelper.CLASSNAME_JDO_PERSISTENCE_MANAGER, null, null, null, 587 ImplHelper.getJDOStateManagerObjectDelegationImpl("getPersistenceManager()"), 588 ImplHelper.COMMENT_ENHANCER_ADDED); 589 590 writer.addMethod( 592 ImplHelper.METHODNAME_JDO_GET_OBJECT_ID, 593 Modifier.PUBLIC | Modifier.FINAL, 594 Object .class.getName(), null, null, null, 595 ImplHelper.getJDOStateManagerObjectDelegationImpl("getObjectId()"), 596 ImplHelper.COMMENT_ENHANCER_ADDED); 597 598 writer.addMethod( 600 ImplHelper.METHODNAME_JDO_IS_PERSISTENT, 601 Modifier.PUBLIC | Modifier.FINAL, 602 JavaClassWriterHelper.boolean_, null, null, null, 603 ImplHelper.getJDOStateManagerBooleanDelegationImpl("isPersistent()"), 604 ImplHelper.COMMENT_ENHANCER_ADDED); 605 606 writer.addMethod( 607 ImplHelper.METHODNAME_JDO_IS_TRANSACTIONAL, 608 Modifier.PUBLIC | Modifier.FINAL, 609 JavaClassWriterHelper.boolean_, null, null, null, 610 ImplHelper.getJDOStateManagerBooleanDelegationImpl("isTransactional()"), 611 ImplHelper.COMMENT_ENHANCER_ADDED); 612 613 writer.addMethod( 614 ImplHelper.METHODNAME_JDO_IS_NEW, 615 Modifier.PUBLIC | Modifier.FINAL, 616 JavaClassWriterHelper.boolean_, null, null, null, 617 ImplHelper.getJDOStateManagerBooleanDelegationImpl("isNew()"), 618 ImplHelper.COMMENT_ENHANCER_ADDED); 619 620 writer.addMethod( 621 ImplHelper.METHODNAME_JDO_IS_DELETED, 622 Modifier.PUBLIC | Modifier.FINAL, 623 JavaClassWriterHelper.boolean_, null, null, null, 624 ImplHelper.getJDOStateManagerBooleanDelegationImpl("isDeleted()"), 625 ImplHelper.COMMENT_ENHANCER_ADDED); 626 627 writer.addMethod( 628 ImplHelper.METHODNAME_JDO_IS_DIRTY, 629 Modifier.PUBLIC | Modifier.FINAL, 630 JavaClassWriterHelper.boolean_, null, null, null, 631 ImplHelper.getJDOStateManagerBooleanDelegationImpl("isDirty()"), 632 ImplHelper.COMMENT_ENHANCER_ADDED); 633 634 writer.addMethod( 636 ImplHelper.METHODNAME_JDO_MAKE_DIRTY, 637 Modifier.PUBLIC | Modifier.FINAL, 638 JavaClassWriterHelper.void_, 639 new String []{ "fieldName" }, 640 new String []{ String .class.getName() }, 641 null, 642 ImplHelper.getJDOStateManagerVoidDelegationImpl("makeDirty(fieldName)"), 643 ImplHelper.COMMENT_ENHANCER_ADDED); 644 645 } 646 647 private void writePCMembers(final String className) 648 throws IOException 649 { 650 final String [] comments = new String []{ 651 dotLine, 652 "Augmentation for Persistence-Capable Classes (added by enhancer):", 653 dotLine 654 }; 655 656 final String [] managedFieldNames 657 = meta.getManagedFields(className); 658 final String [] managedFieldTypes 659 = meta.getFieldType(className, managedFieldNames); 660 final boolean isPCRoot 661 = meta.isPersistenceCapableRootClass(className); 662 663 writer.addMethod( 665 ImplHelper.METHODNAME_JDO_GET_FIELD, 666 Modifier.PUBLIC, 667 JavaClassWriterHelper.Object_, 668 new String []{ "fieldNumber" }, 669 new String []{ "int" }, 670 null, 671 ImplHelper.getJDOGetFieldImpl("fieldNumber", 672 managedFieldNames, 673 managedFieldTypes), 674 comments); 675 676 writer.addMethod( 678 ImplHelper.METHODNAME_JDO_SET_FIELD, 679 Modifier.PUBLIC, 680 JavaClassWriterHelper.void_, 681 new String []{ "fieldNumber", "obj" }, 682 new String []{ "int", JavaClassWriterHelper.Object_ }, 683 null, 684 ImplHelper.getJDOSetFieldImpl("fieldNumber", "obj", 685 managedFieldNames, 686 managedFieldTypes), 687 ImplHelper.COMMENT_ENHANCER_ADDED); 688 689 writer.addMethod( 691 ImplHelper.METHODNAME_JDO_CLEAR, 692 Modifier.PUBLIC, 693 JavaClassWriterHelper.void_, null, null, null, 694 ImplHelper.getJDOClearImpl(className, meta, managedFieldNames, 695 managedFieldTypes), 696 ImplHelper.COMMENT_ENHANCER_ADDED); 697 698 writer.addMethod( 700 ImplHelper.METHODNAME_JDO_NEW_INSTANCE, 701 Modifier.PUBLIC, 702 JavaClassWriterHelper.Object_, 703 new String []{ "sm" }, 704 new String []{ ImplHelper.CLASSNAME_JDO_STATE_MANAGER }, 705 null, 706 ImplHelper.getJDONewInstanceImpl(className, "sm"), 707 ImplHelper.COMMENT_ENHANCER_ADDED); 708 709 } 710 711 private void writeOidClass(final String className, 712 final String oidClassName, 713 final boolean enclosedOid) 714 throws IOException 715 { 716 final String [] comments = new String []{ 717 dotLine, 718 "Key Class:", 719 dotLine 720 }; 721 722 final String superOidClassName 723 = ImplHelper.normalizeClassName(meta.getSuperKeyClass(className)); 724 725 JavaClassWriter oidWriter = new IOJavaClassWriter(); 726 727 oidWriter.setClassDeclaration( 728 (enclosedOid ? Modifier.PUBLIC | Modifier.STATIC : 0), 729 oidClassName, 730 ImplHelper.COMMENT_NOT_ENHANCER_ADDED); 731 oidWriter.setSuperclass(superOidClassName); 732 oidWriter.addInterface(Serializable .class.getName()); 733 734 final boolean isPCRoot 735 = meta.isPersistenceCapableRootClass(className); 736 737 final String [] pknames = meta.getKeyFields(className); 738 final String [] pktypes = meta.getFieldType(className, pknames); 739 740 for (int i = 0; i < pknames.length; i++) { 742 oidWriter.addField( 743 pknames[i], 744 Modifier.PUBLIC, 745 ImplHelper.normalizeClassName(pktypes[i]), 746 null, 747 null); 748 } 749 750 oidWriter.addConstructor( 752 oidClassName, 753 Modifier.PUBLIC, 754 null, null, null, 755 ImplHelper.getDefaultConstructorImpl(), 756 ImplHelper.COMMENT_NOT_ENHANCER_ADDED); 757 758 oidWriter.addMethod( 760 "hashCode", 761 Modifier.PUBLIC, 762 "int", 763 null, 764 null, 765 null, 766 ImplHelper.getOidHashCodeImpl(pknames, 767 pktypes, 768 isPCRoot), 769 ImplHelper.COMMENT_NOT_ENHANCER_ADDED); 770 771 oidWriter.addMethod( 773 "equals", Modifier.PUBLIC, JavaClassWriterHelper.boolean_, 774 new String []{ "pk" }, 775 new String []{ Object .class.getName() }, 776 null, 777 ImplHelper.getOidEqualsImpl(oidClassName, 778 pknames, 779 pktypes, 780 "pk", 781 isPCRoot), 782 ImplHelper.COMMENT_NOT_ENHANCER_ADDED); 783 784 if (enclosedOid) { 785 writer.addClass(oidWriter); 786 } else { 787 fWriter.addClass(oidWriter); 788 } 789 } 790 791 static private String createMethodName(final String prefix, 792 final String fieldName) 793 { 794 return (prefix + Character.toUpperCase(fieldName.charAt(0)) 795 + fieldName.substring(1)); 796 } 797 798 private void printMessage(String msg) 800 { 801 logger.finest("TP PCClassGen: " + msg); } 803 804 private void printError(String msg, Throwable ex) 805 { 806 if (msg != null) { 807 String errmsg=msg + (ex != null ? ": " + ex.getMessage() : ""); logger.log(Logger.SEVERE,"CME.generic_exception",errmsg); } 810 if (ex != null) { 811 logger.log(Logger.SEVERE,"CME.generic_exception_stack",ex); } 813 } 814 } 815 | Popular Tags |