1 29 30 package com.caucho.ejb.cfg; 31 32 import com.caucho.bytecode.JClass; 33 import com.caucho.bytecode.JMethod; 34 import com.caucho.config.Config; 35 import com.caucho.config.ConfigException; 36 import com.caucho.config.LineConfigException; 37 import com.caucho.config.types.FileSetType; 38 import com.caucho.ejb.AbstractServer; 39 import com.caucho.ejb.EjbServerManager; 40 import com.caucho.ejb.amber.AmberConfig; 41 import com.caucho.ejb.ql.FunExpr; 42 import com.caucho.java.WorkDir; 43 import com.caucho.java.gen.JavaClassGenerator; 44 import com.caucho.loader.Environment; 45 import com.caucho.loader.EnvironmentClassLoader; 46 import com.caucho.log.Log; 47 import com.caucho.util.L10N; 48 import com.caucho.vfs.Path; 49 import com.caucho.vfs.Vfs; 50 51 import java.util.ArrayList ; 52 import java.util.Collection ; 53 import java.util.Collections ; 54 import java.util.Comparator ; 55 import java.util.HashMap ; 56 import java.util.Map ; 57 import java.util.logging.Logger ; 58 59 62 public class EjbConfig { 63 private static final L10N L = new L10N(EjbConfig.class); 64 private static final Logger log = Log.open(EjbConfig.class); 65 66 private EjbServerManager _ejbManager; 67 68 private ArrayList <FileSetType> _fileSetList = new ArrayList <FileSetType>(); 69 private ArrayList <Path> _pathList = new ArrayList <Path>(); 70 71 private HashMap <String ,EjbBean> _cfgBeans = new HashMap <String ,EjbBean>(); 72 private ArrayList <CmpRelation> _relations = new ArrayList <CmpRelation>(); 73 74 private ArrayList <EjbBean> _pendingBeans = new ArrayList <EjbBean>(); 75 private ArrayList <EjbBean> _deployingBeans = new ArrayList <EjbBean>(); 76 77 private ArrayList <FunctionSignature> _functions = 78 new ArrayList <FunctionSignature>(); 79 80 private String _booleanTrue = "1"; 81 private String _booleanFalse = "0"; 82 83 private boolean _isAllowPOJO; 84 85 public EjbConfig(EjbServerManager ejbManager) 86 { 87 _ejbManager = ejbManager; 88 89 _functions.addAll(FunExpr.getStandardFunctions()); 90 } 91 92 public String getRemoteJndiName() 93 { 94 return _ejbManager.getRemoteJndiPrefix(); 95 } 96 97 public String getLocalJndiName() 98 { 99 return _ejbManager.getLocalJndiPrefix(); 100 } 101 102 105 public void addFileSet(FileSetType fileSet) 106 { 107 if (_fileSetList.contains(fileSet)) 108 return; 109 110 _fileSetList.add(fileSet); 111 } 112 113 116 public void addEJBPath(Path ejbModulePath, Path path) 117 throws ConfigException 118 { 119 if (_pathList.contains(path)) 120 return; 121 122 _pathList.add(path); 123 124 if (path.getScheme().equals("jar")) 125 path.setUserPath(path.getURL()); 126 127 Environment.addDependency(path); 128 129 String ejbModuleName = ejbModulePath.getPath(); 130 String pwd = Vfs.getPwd().getPath(); 131 132 if (ejbModuleName.startsWith(pwd)) 133 ejbModuleName = ejbModuleName.substring(pwd.length()); 134 135 if (_ejbManager != null) 136 _ejbManager.addEJBModule(ejbModuleName); 137 138 EjbJar ejbJar = new EjbJar(this, ejbModuleName); 140 141 try { 142 new Config().configure(ejbJar, path, getSchema()); 143 } catch (ConfigException e) { 144 throw e; 145 } catch (Exception e) { 146 throw new ConfigException(e); 147 } 148 } 149 150 153 public String getSchema() 154 { 155 return "com/caucho/ejb/cfg/resin-ejb.rnc"; 156 } 157 158 159 162 public EjbServerManager getEJBManager() 163 { 164 return _ejbManager; 165 } 166 167 170 public void setBooleanTrue(String trueLiteral) 171 { 172 _booleanTrue = trueLiteral; 173 } 174 175 178 public String getBooleanTrue() 179 { 180 return _booleanTrue; 181 } 182 183 186 public void setBooleanFalse(String falseLiteral) 187 { 188 _booleanFalse = falseLiteral; 189 } 190 191 194 public String getBooleanFalse() 195 { 196 return _booleanFalse; 197 } 198 199 202 public EjbBean getBeanConfig(String name) 203 { 204 return _cfgBeans.get(name); 205 } 206 207 210 public void setBeanConfig(String name, EjbBean bean) 211 { 212 if (name == null || bean == null) 213 throw new NullPointerException (); 214 215 if (_cfgBeans.get(name) == null) 216 _pendingBeans.add(bean); 217 218 _cfgBeans.put(name, bean); 219 } 220 221 224 public void setAllowPOJO(boolean allowPOJO) 225 { 226 _isAllowPOJO = allowPOJO; 227 } 228 229 232 public boolean isAllowPOJO() 233 { 234 return _isAllowPOJO; 235 } 236 237 240 public EjbEntityBean findEntityBySchema(String schemaName) 241 { 242 for (EjbBean bean : _cfgBeans.values()) { 243 if (bean instanceof EjbEntityBean) { 244 EjbEntityBean entity = (EjbEntityBean) bean; 245 246 if (schemaName.equals(entity.getAbstractSchemaName())) 247 return entity; 248 } 249 } 250 251 return null; 252 } 253 254 257 public EjbEntityBean findEntityByLocal(JClass cl) 258 { 259 for (EjbBean bean : _cfgBeans.values()) { 260 if (bean instanceof EjbEntityBean) { 261 EjbEntityBean entity = (EjbEntityBean) bean; 262 263 if (cl.equals(entity.getLocal())) 264 return entity; 265 } 266 } 267 268 return null; 269 } 270 271 274 public CmpRelation addRelation(String relationName, 275 String sourceEJB, String sourceField) 276 { 277 CmpRelation relation = findRelation(relationName, sourceEJB, sourceField); 278 279 if (relation != null) 280 return relation; 281 282 relation = new CmpRelation(); 283 relation.setName(relationName); 284 relation.setSourceEJB(sourceEJB); 285 relation.setSourceField(sourceField); 286 287 _relations.add(relation); 288 289 return relation; 290 } 291 292 295 public CmpRelation findRelation(String relationName, 296 String sourceEJB, String sourceField) 297 { 298 for (int i = 0; i < _relations.size(); i++) { 299 CmpRelation relation = _relations.get(i); 300 301 if (relationName != null && 302 relationName.equals(relation.getName())) 303 return relation; 304 305 if (relation.getSourceEJB().equals(sourceEJB) && 306 relation.getSourceField().equals(sourceField)) 307 return relation; 308 } 309 310 return null; 311 } 312 313 public void addRelation(CmpRelation rel) 314 throws ConfigException 315 { 316 CmpRelation oldRel = findRelation(rel.getName(), 317 rel.getSourceEJB(), 318 rel.getSourceField()); 319 320 if (oldRel == null) { 321 _relations.add(rel); 322 323 return; 324 } 325 326 if (! rel.getTargetEJB().equals(oldRel.getTargetEJB())) { 327 throw new ConfigException(L.l("relationship '{0}.{1}' target EJB '{2}' does not match old target EJB '{3}' from {4}", 328 rel.getSourceEJB(), 329 rel.getSourceField(), 330 rel.getTargetEJB(), 331 oldRel.getTargetEJB(), 332 oldRel.getLocation())); 333 } 334 else if (rel.getTargetField() != oldRel.getTargetField() && 335 (rel.getTargetField() == null || 336 ! rel.getTargetField().equals(oldRel.getTargetField()))) { 337 throw new ConfigException(L.l("relationship '{0}.{1}' target field '{2}' does not match old target field '{3}' from {4}", 338 rel.getSourceEJB(), 339 rel.getSourceField(), 340 rel.getTargetEJB(), 341 oldRel.getTargetEJB(), 342 oldRel.getLocation())); 343 } 344 345 oldRel.merge(rel); 346 } 347 348 public CmpRelation []getRelations() 349 { 350 return _relations.toArray(new CmpRelation[_relations.size()]); 351 } 352 353 356 public void addFunction(FunctionSignature sig, String sql) 357 { 358 _functions.add(sig); 359 } 360 361 364 public ArrayList <FunctionSignature> getFunctions() 365 { 366 return _functions; 367 } 368 369 372 public void configure() 373 throws ConfigException 374 { 375 findConfigurationFiles(); 376 377 try { 378 ArrayList <EjbBean> beanConfig = new ArrayList <EjbBean>(_pendingBeans); 379 _pendingBeans.clear(); 380 381 _deployingBeans.addAll(beanConfig); 382 383 EnvironmentClassLoader parentLoader = _ejbManager.getClassLoader(); 384 385 Path workPath = _ejbManager.getWorkPath(); 386 387 JavaClassGenerator javaGen = new JavaClassGenerator(); 388 javaGen.setWorkDir(workPath); 390 javaGen.setParentLoader(parentLoader); 391 392 configureRelations(); 393 394 for (EjbBean bean : beanConfig) { 395 bean.init(); 396 } 397 398 Collections.sort(beanConfig, new BeanComparator()); 399 400 AmberConfig amberConfig = new AmberConfig(this); 401 402 for (EjbBean bean : beanConfig) { 403 bean.configureAmber(amberConfig); 404 } 405 406 amberConfig.configureRelations(); 407 408 if (_ejbManager.isAutoCompile()) 409 amberConfig.generate(javaGen); 410 411 for (EjbBean bean : beanConfig) { 412 bean.generate(javaGen, _ejbManager.isAutoCompile()); 413 } 414 415 javaGen.compilePendingJava(); 416 } catch (RuntimeException e) { 417 throw e; 418 } catch (Exception e) { 419 throw new ConfigException(e); 420 } 421 } 422 423 424 427 private void findConfigurationFiles() 428 throws ConfigException 429 { 430 for (FileSetType fileSet : _fileSetList) { 431 for (Path path : fileSet.getPaths()) { 432 addEJBPath(fileSet.getDir(), path); 433 } 434 } 435 } 436 437 440 public void deploy() 441 throws ConfigException 442 { 443 try { 444 ClassLoader parentLoader = _ejbManager.getClassLoader(); 445 446 Path workPath = _ejbManager.getWorkPath(); 447 448 if (workPath == null) 449 workPath = WorkDir.getLocalWorkDir(); 450 451 JavaClassGenerator javaGen = new JavaClassGenerator(); 452 javaGen.setWorkDir(workPath); 453 javaGen.setParentLoader(parentLoader); 454 455 deployBeans(_deployingBeans, javaGen); 456 } catch (RuntimeException e) { 457 throw e; 458 } catch (Throwable e) { 459 throw new ConfigException(e); 460 } 461 } 462 463 466 public void deployBeans(ArrayList <EjbBean> beanConfig, 467 JavaClassGenerator javaGen) 468 throws Throwable 469 { 470 Thread thread = Thread.currentThread(); 471 ClassLoader oldLoader = thread.getContextClassLoader(); 472 473 try { 474 thread.setContextClassLoader(_ejbManager.getClassLoader()); 475 476 _ejbManager.getAmberManager().initEntityHomes(); 477 478 for (EjbBean bean : beanConfig) { 479 AbstractServer server = bean.deployServer(_ejbManager, javaGen); 480 481 thread.setContextClassLoader(server.getClassLoader()); 482 483 487 488 server.init(); 489 490 _ejbManager.addServer(server); 491 496 } 497 } finally { 498 thread.setContextClassLoader(oldLoader); 499 } 500 } 501 502 505 protected void configureRelations() 506 throws ConfigException 507 { 508 for (CmpRelation relation : _relations) { 509 try { 510 CmpRelationRole sourceRole = relation.getSourceRole(); 511 CmpRelationRole targetRole = relation.getTargetRole(); 512 513 String sourceEJB = sourceRole.getEJBName(); 514 EjbEntityBean sourceEntity = (EjbEntityBean) _cfgBeans.get(sourceEJB); 515 516 if (sourceEntity == null) 517 throw new ConfigException(L.l("'{0}' is an unknown EJB bean.", 518 sourceEJB)); 519 520 String sourceField = sourceRole.getFieldName(); 521 JMethod sourceMethod = sourceEntity.getFieldGetter(sourceField); 522 523 JMethod sourceMapMethod = null; 524 525 if (sourceField != null) 526 sourceMapMethod = getMapMethod(sourceEntity, sourceField); 527 528 if (sourceField != null && 529 sourceMethod == null && sourceMapMethod == null) 530 throw new ConfigException(L.l("{0}: relation field '{1}' does not have a corresponding getter method. cmr-relations must define abstract getter methods returning a local interface.", 531 sourceEntity.getEJBClass().getName(), 532 sourceField)); 533 534 String targetEJB = targetRole.getEJBName(); 535 EjbEntityBean targetEntity = (EjbEntityBean) _cfgBeans.get(targetEJB); 536 537 if (targetEntity == null) 538 throw new ConfigException(L.l("'{0}' is an unknown EJB bean.", 539 targetEJB)); 540 541 String targetField = targetRole.getFieldName(); 542 JMethod targetMethod = targetEntity.getFieldGetter(targetField); 543 544 JMethod targetMapMethod = null; 545 546 if (targetField != null) 547 targetMapMethod = getMapMethod(targetEntity, targetField); 548 549 if (targetField != null && 550 targetMethod == null && targetMapMethod == null) 551 throw new ConfigException(L.l("{0}: relation field '{1}' does not have a corresponding getter method. cmr-relations must define abstract getter methods returning a local interface.", 552 targetEntity.getEJBClass().getName(), 553 targetField)); 554 555 boolean sourceOneToMany = false; 556 boolean sourceManyToOne = false; 557 boolean sourceMap = false; 558 559 if (sourceMethod == null) { 560 } 561 else if (sourceMethod.getReturnType().isAssignableTo(Collection .class)) 562 sourceOneToMany = true; 563 else if (sourceMethod.getReturnType().isAssignableTo(Map .class)) 564 sourceMap = true; 565 else 566 sourceManyToOne = true; 567 568 boolean targetOneToMany = false; 569 boolean targetManyToOne = false; 570 boolean targetMap = false; 571 572 if (targetMapMethod != null) 573 targetMap = true; 574 575 if (targetMethod == null) { 576 } 577 else if (targetMethod.getReturnType().isAssignableTo(Collection .class)) 578 targetOneToMany = true; 579 else if (targetMethod.getReturnType().isAssignableTo(Map .class)) 580 targetMap = true; 581 else 582 targetManyToOne = true; 583 584 if (sourceMap) { 585 createMap(targetEntity, targetField, targetRole, 586 sourceEntity, sourceField, sourceRole, sourceMapMethod); 587 } 588 else if (targetMap) { 589 createMap(sourceEntity, sourceField, sourceRole, 590 targetEntity, targetField, targetRole, targetMapMethod); 591 } 592 else if (sourceOneToMany && targetManyToOne) { 593 CmrOneToMany srcRel = new CmrOneToMany(sourceEntity, 594 sourceField, 595 targetEntity, 596 targetField); 597 598 srcRel.setSQLColumns(sourceRole.getSQLColumns()); 599 srcRel.setOrderBy(sourceRole.getOrderBy()); 600 602 sourceEntity.addRelation(srcRel); 603 604 CmrManyToOne dstRel = new CmrManyToOne(targetEntity, 605 targetField, 606 sourceEntity); 607 608 dstRel.setSQLColumns(targetRole.getSQLColumns()); 609 dstRel.setSourceCascadeDelete(targetRole.getCascadeDelete()); 610 dstRel.setTargetCascadeDelete(sourceRole.getCascadeDelete()); 611 612 targetEntity.addRelation(dstRel); 613 614 srcRel.setTargetRelation(dstRel); 615 dstRel.setTargetRelation(srcRel); 616 } 617 else if (sourceOneToMany && targetOneToMany) { 618 CmrManyToMany srcRel = new CmrManyToMany(sourceEntity, 619 sourceField, 620 targetEntity, 621 targetField); 622 623 srcRel.setLocation(relation.getLocation()); 624 625 srcRel.setRelationName(relation.getName()); 626 srcRel.setSQLTable(relation.getSQLTable()); 627 srcRel.setOrderBy(sourceRole.getOrderBy()); 628 629 srcRel.setKeySQLColumns(sourceRole.getSQLColumns()); 630 srcRel.setDstSQLColumns(targetRole.getSQLColumns()); 631 632 sourceEntity.addRelation(srcRel); 633 634 CmrManyToMany dstRel = new CmrManyToMany(targetEntity, 635 targetField, 636 sourceEntity, 637 sourceField); 638 639 dstRel.setLocation(relation.getLocation()); 640 641 dstRel.setRelationName(relation.getName()); 642 dstRel.setSQLTable(relation.getSQLTable()); 643 dstRel.setOrderBy(targetRole.getOrderBy()); 644 645 dstRel.setKeySQLColumns(targetRole.getSQLColumns()); 646 dstRel.setDstSQLColumns(sourceRole.getSQLColumns()); 647 648 targetEntity.addRelation(dstRel); 649 674 } 675 else if (sourceOneToMany) { 676 CmrManyToMany srcRel = new CmrManyToMany(sourceEntity, 677 sourceField, 678 targetEntity, 679 targetField); 680 681 srcRel.setLocation(relation.getLocation()); 682 683 if (relation.getName() != null) 684 srcRel.setRelationName(relation.getName()); 685 else if (relation.getSQLTable() != null) 686 srcRel.setRelationName(relation.getSQLTable()); 687 else 688 srcRel.setRelationName(sourceField); 689 690 if (relation.getSQLTable() != null || relation.getName() != null) 691 srcRel.setSQLTable(relation.getSQLTable()); 692 else 693 srcRel.setSQLTable(sourceField); 694 695 srcRel.setOrderBy(sourceRole.getOrderBy()); 696 697 srcRel.setKeySQLColumns(sourceRole.getSQLColumns()); 698 srcRel.setDstSQLColumns(targetRole.getSQLColumns()); 699 700 srcRel.setTargetUnique("One".equals(sourceRole.getMultiplicity())); 701 702 sourceEntity.addRelation(srcRel); 703 } 704 else if (sourceManyToOne && targetManyToOne) { 705 if (relation.getSQLTable() != null) 706 throw new ConfigException(L.l("cmr-field '{0}' may not have a sql-table '{1}'. one-to-one relations do not have association tables.", 707 sourceField, 708 relation.getSQLTable())); 709 710 CmrManyToOne srcRel = new CmrManyToOne(sourceEntity, 711 sourceField, 712 targetEntity); 713 714 srcRel.setLocation(relation.getLocation()); 715 716 srcRel.setSQLColumns(sourceRole.getSQLColumns()); 717 718 725 726 727 srcRel.setSourceCascadeDelete(sourceRole.getCascadeDelete()); 728 srcRel.setTargetCascadeDelete(targetRole.getCascadeDelete()); 729 730 sourceEntity.addRelation(srcRel); 731 732 CmrManyToOne dstRel = new CmrManyToOne(targetEntity, 733 targetField, 734 sourceEntity); 735 736 dstRel.setLocation(relation.getLocation()); 737 738 dstRel.setSQLColumns(targetRole.getSQLColumns()); 739 740 targetEntity.addRelation(dstRel); 741 742 if ((sourceRole.getSQLColumns() == null || 743 sourceRole.getSQLColumns().length == 0) && 744 targetRole.getSQLColumns() != null && 745 targetRole.getSQLColumns().length > 0) { 746 srcRel.setDependent(true); 747 748 dstRel.setSourceCascadeDelete(targetRole.getCascadeDelete()); 749 dstRel.setTargetCascadeDelete(sourceRole.getCascadeDelete()); 750 } 751 752 if ((targetRole.getSQLColumns() == null || 753 targetRole.getSQLColumns().length == 0)) { 754 dstRel.setDependent(true); 757 758 srcRel.setSourceCascadeDelete(sourceRole.getCascadeDelete()); 759 srcRel.setTargetCascadeDelete(targetRole.getCascadeDelete()); 760 } 761 762 srcRel.setTargetRelation(dstRel); 763 dstRel.setTargetRelation(srcRel); 764 } 765 else if (sourceManyToOne && targetOneToMany) { 766 CmrManyToOne srcRel = new CmrManyToOne(sourceEntity, 767 sourceField, 768 targetEntity); 769 770 srcRel.setLocation(relation.getLocation()); 771 772 srcRel.setSQLColumns(sourceRole.getSQLColumns()); 773 774 sourceEntity.addRelation(srcRel); 775 776 CmrOneToMany dstRel = new CmrOneToMany(targetEntity, 777 targetField, 778 sourceEntity, 779 sourceField); 780 781 dstRel.setLocation(relation.getLocation()); 782 dstRel.setSQLColumns(sourceRole.getSQLColumns()); 783 dstRel.setOrderBy(targetRole.getOrderBy()); 784 785 targetEntity.addRelation(dstRel); 786 787 srcRel.setTargetRelation(dstRel); 788 dstRel.setTargetRelation(srcRel); 789 790 if (targetRole.getCascadeDelete() && 791 "Many".equals(sourceRole.getMultiplicity())) 792 throw new ConfigException(L.l("'{0}' may not set cascade-delete because '{1}' has multiplicity 'Many'", 793 targetField, 794 sourceField)); 795 } 796 else if (sourceManyToOne) { 797 CmrManyToOne srcRel = new CmrManyToOne(sourceEntity, 798 sourceField, 799 targetEntity); 800 801 srcRel.setSQLColumns(sourceRole.getSQLColumns()); 802 803 srcRel.setSourceCascadeDelete(sourceRole.getCascadeDelete()); 804 srcRel.setTargetCascadeDelete(targetRole.getCascadeDelete()); 805 806 sourceEntity.addRelation(srcRel); 807 } 808 else if (targetManyToOne) { 809 CmrManyToOne dstRel = new CmrManyToOne(targetEntity, 810 targetField, 811 sourceEntity); 812 813 dstRel.setSQLColumns(targetRole.getSQLColumns()); 814 815 dstRel.setSourceCascadeDelete(targetRole.getCascadeDelete()); 816 dstRel.setTargetCascadeDelete(sourceRole.getCascadeDelete()); 817 818 targetEntity.addRelation(dstRel); 819 } 820 else if (targetOneToMany) { 821 CmrOneToMany dstRel = new CmrOneToMany(targetEntity, 822 targetField, 823 sourceEntity, 824 sourceField); 825 826 dstRel.setSQLColumns(targetRole.getSQLColumns()); 827 dstRel.setOrderBy(targetRole.getOrderBy()); 828 829 targetEntity.addRelation(dstRel); 830 } 831 else { 832 throw new ConfigException(L.l("unsupported relation")); 833 } 834 } catch (LineConfigException e) { 835 throw e; 836 } catch (ConfigException e) { 837 throw new LineConfigException(relation.getLocation() + e.getMessage(), e); 838 } 839 } 840 } 841 842 private void createMap(EjbEntityBean sourceEntity, 843 String idField, 844 CmpRelationRole sourceRole, 845 EjbEntityBean targetEntity, 846 String targetField, 847 CmpRelationRole targetRole, 848 JMethod targetMapMethod) 849 throws ConfigException 850 { 851 CmrManyToOne srcRel = new CmrManyToOne(sourceEntity, 852 idField, 853 targetEntity); 854 855 srcRel.setSQLColumns(sourceRole.getSQLColumns()); 856 860 861 sourceEntity.addRelation(srcRel); 862 863 CmrMap map = new CmrMap(targetEntity, targetField, 864 sourceEntity, srcRel); 865 866 map.setMapMethod(targetMapMethod); 867 868 targetEntity.addRelation(map); 869 } 870 871 874 public JMethod getMapMethod(EjbEntityBean entityBean, String field) 875 { 876 String methodName = ("get" + 877 Character.toUpperCase(field.charAt(0)) + 878 field.substring(1)); 879 880 JMethod []methods = entityBean.getMethods(entityBean.getEJBClassWrapper()); 881 882 for (int i = 0; i < methods.length; i++) { 883 JMethod method = methods[i]; 884 885 if (! method.getName().equals(methodName)) 886 continue; 887 else if (method.getParameterTypes().length != 1) 888 continue; 889 else if ("void".equals(method.getReturnType().getName())) 890 continue; 891 else if (! method.isAbstract()) 892 continue; 893 else 894 return method; 895 } 896 897 return null; 898 } 899 900 static class BeanComparator implements Comparator { 901 public int compare(Object a, Object b) 902 { 903 if (a == b) 904 return 0; 905 906 EjbBean beanA = (EjbBean) a; 907 EjbBean beanB = (EjbBean) b; 908 909 if (! (a instanceof EjbEntityBean) && ! (b instanceof EjbEntityBean)) 910 return beanA.getEJBName().compareTo(beanB.getEJBName()); 911 else if (! (a instanceof EjbEntityBean)) 912 return 1; 913 else if (! (b instanceof EjbEntityBean)) 914 return -1; 915 916 EjbEntityBean entityA = (EjbEntityBean) a; 917 EjbEntityBean entityB = (EjbEntityBean) b; 918 919 if (entityB.dependsOn(entityA)) 920 return -1; 921 else if (entityA.dependsOn(entityB)) 922 return 1; 923 else 924 return entityA.getEJBName().compareTo(entityB.getEJBName()); 925 } 926 } 927 } 928 929 | Popular Tags |