dblevins    2004/04/12 04:31:41

  Modified:    modules/core/src/java/org/openejb/proxy EJBProxyFactory.java
  Log:

  Still quite a few failures, but minimal remote server functionality is working.
  
  Test results are:
  Tests run: 112,  Failures: 27,  Errors: 6
  
  Couple things causing problems:
   - DatabaseBean can't get a datasource, so no BMP tests run.
   - BeanPolicy$2.invoke throwing "Not yet implemented" is preventing
     nearly all the SFSB tests from running.
   - Still having classloader issues on outbound proxy replacements,
     so many RMI-IIOP tests are failing.
  
  All in all the test suite is doing it's job.
  
  Revision  Changes    Path
  1.4       +41 -4     
openejb/modules/core/src/java/org/openejb/proxy/EJBProxyFactory.java
  
  Index: EJBProxyFactory.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/proxy/EJBProxyFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- EJBProxyFactory.java      21 Mar 2004 21:26:35 -0000      1.3
  +++ EJBProxyFactory.java      12 Apr 2004 08:31:41 -0000      1.4
  @@ -45,6 +45,11 @@
   package org.openejb.proxy;

   

   import java.io.Serializable;

  +import java.lang.reflect.Method;

  +import java.util.Collections;

  +import java.util.HashMap;

  +import java.util.Map;

  +

   import javax.ejb.EJBHome;

   import javax.ejb.EJBLocalHome;

   import javax.ejb.EJBLocalObject;

  @@ -73,12 +78,14 @@
       private transient final int[] ejbObjectMap;

       private transient final int[] ejbHomeMap;

       

  +    private transient final Map legacyMethodMap;

  +

  +    private transient EJBContainer container;

  +    

       private final ProxyInfo proxyInfo;

   

       private final InterfaceMethodSignature[] signatures;

   

  -    private transient EJBContainer container;

  -

       public EJBProxyFactory(ProxyInfo proxyInfo, InterfaceMethodSignature[] 
signatures) {

           this.signatures = signatures;

           this.proxyInfo = proxyInfo;

  @@ -88,13 +95,28 @@
           this.ejbObjectFactory = getFactory(EJBInterfaceType.REMOTE.getOrdinal(), 
proxyInfo.getRemoteInterface());

           this.ejbHomeFactory = getFactory(EJBInterfaceType.HOME.getOrdinal(), 
proxyInfo.getHomeInterface());

       

  +        // build the legacy map

  +        Map map = new HashMap();

  +        addLegacyMethods(map, proxyInfo.getHomeInterface(), signatures);

  +        addLegacyMethods(map, proxyInfo.getRemoteInterface(), signatures);

  +        addLegacyMethods(map, proxyInfo.getLocalHomeInterface(), signatures);

  +        addLegacyMethods(map, proxyInfo.getLocalInterface(), signatures);

  +        legacyMethodMap = Collections.unmodifiableMap(map);

           

           ejbLocalObjectMap = getOperationsMap(ejbLocalObjectFactory);

           ejbLocalHomeMap = getOperationsMap(ejbLocalHomeFactory);

           ejbObjectMap = getOperationsMap(ejbObjectFactory);

           ejbHomeMap = getOperationsMap(ejbHomeFactory);

       }

  -

  +    

  +    public int getMethodIndex(Method method) {

  +        Integer index = (Integer) legacyMethodMap.get(method);

  +        if (index == null) {

  +            index = new Integer(-1);

  +        }

  +        return index.intValue();

  +    }

  +    

       public void setContainer(EJBContainer container) {

           this.container = container;

       }

  @@ -175,4 +197,19 @@
       private Object readResolve() {

           return new EJBProxyFactory(proxyInfo, signatures);

       }

  +    

  +    private static void addLegacyMethods(Map legacyMethodMap, Class clazz, 
InterfaceMethodSignature[] signatures) {

  +        if (clazz == null) {

  +            return;

  +        }

  +

  +        for (int i = 0; i < signatures.length; i++) {

  +            InterfaceMethodSignature signature = signatures[i];

  +            Method method = signature.getMethod(clazz);

  +            if (method != null) {

  +                legacyMethodMap.put(method, new Integer(i));

  +            }

  +        }

  +    }

  +    

   }

  
  
  

Reply via email to