dblevins    2005/08/15 22:03:54

  Modified:    modules/core/src/java/org/openejb/alt/config
                        AutoDeployer.java Deploy.java
  Log:

  Bug in local interface deployment support
  
  Revision  Changes    Path
  1.6       +2 -2      
openejb1/modules/core/src/java/org/openejb/alt/config/AutoDeployer.java
  
  Index: AutoDeployer.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb1/modules/core/src/java/org/openejb/alt/config/AutoDeployer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AutoDeployer.java 4 Aug 2005 01:20:06 -0000       1.5
  +++ AutoDeployer.java 16 Aug 2005 02:03:54 -0000      1.6
  @@ -145,7 +145,7 @@
                }
                }
                if (bean.getLocalHome() != null){
  -                Class tempBean = SafeToolkit.loadTempClass(bean.getHome(), 
jarLocation);
  +                Class tempBean = 
SafeToolkit.loadTempClass(bean.getLocalHome(), jarLocation);
                if (hasFinderMethods(tempBean)){
                       throw new OpenEJBException("CMP 1.1 Beans with finder 
methods cannot be autodeployed; finder methods require OQL Select statements 
which cannot be generated accurately.");
                }
  
  
  
  1.11      +28 -4     
openejb1/modules/core/src/java/org/openejb/alt/config/Deploy.java
  
  Index: Deploy.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb1/modules/core/src/java/org/openejb/alt/config/Deploy.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Deploy.java       4 Aug 2005 20:17:42 -0000       1.10
  +++ Deploy.java       16 Aug 2005 02:03:54 -0000      1.11
  @@ -315,7 +315,6 @@
   
       private EjbDeployment deployBean(Bean bean, String jarLocation) throws 
OpenEJBException {
           EjbDeployment deployment = new EjbDeployment();
  -        Class tempBean = SafeToolkit.loadTempClass(bean.getHome(), 
jarLocation);
   
           
out.println("\n-----------------------------------------------------------");
           out.println("Deploying bean: " + bean.getEjbName());
  @@ -357,11 +356,36 @@
           }
   
           //check for OQL statement
  -        if (bean.getType().equals("CMP_ENTITY")) {
  -            promptForOQLForEntityBeans(tempBean, deployment);
  +        if (bean.getType().equals("CMP_ENTITY")){
  +             if (bean.getHome() != null){
  +                Class tempBean = SafeToolkit.loadTempClass(bean.getHome(), 
jarLocation);
  +             if (hasFinderMethods(tempBean)){
  +                    promptForOQLForEntityBeans(tempBean, deployment);
  +             }
  +             }
  +             if (bean.getLocalHome() != null){
  +                Class tempBean = 
SafeToolkit.loadTempClass(bean.getLocalHome(), jarLocation);
  +             if (hasFinderMethods(tempBean)){
  +                    promptForOQLForEntityBeans(tempBean, deployment);
  +             }
  +             }
           }
   
           return deployment;
  +    }
  +
  +    private boolean hasFinderMethods(Class bean)
  +    throws OpenEJBException {
  +
  +        Method[] methods = bean.getMethods();
  +
  +        for (int i = 0; i < methods.length; i++) {
  +            if (methods[i].getName().startsWith("find")
  +                && !methods[i].getName().equals("findByPrimaryKey")) {
  +                return true;
  +            }
  +        }
  +        return false;
       }
   
       private void promptForOQLForEntityBeans(Class bean, EjbDeployment 
deployment)
  
  
  

Reply via email to