You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ha...@apache.org on 2002/03/19 23:12:36 UTC

cvs commit: jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/generator ProxyGeneratorImpl.java

hammant     02/03/19 14:12:36

  Modified:    altrmi   tests.xml
               altrmi/src/java/org/apache/commons/altrmi/client
                        AltrmiProxy.java
               altrmi/src/java/org/apache/commons/altrmi/client/impl
                        BaseServedObject.java
                        DefaultInterfaceLookupFactory.java
               altrmi/src/java/org/apache/commons/altrmi/generator
                        ProxyGeneratorImpl.java
  Log:
  DefaultInerfaceLookup does Class.forName instantion of types now.
  
  Revision  Changes    Path
  1.11      +2 -2      jakarta-commons-sandbox/altrmi/tests.xml
  
  Index: tests.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/tests.xml,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- tests.xml	12 Mar 2002 17:05:19 -0000	1.10
  +++ tests.xml	19 Mar 2002 22:12:35 -0000	1.11
  @@ -3,7 +3,7 @@
   
   <!--
           "Alt (to) RMI" component of the Jakarta Commons Subproject
  -        $Id: tests.xml,v 1.10 2002/03/12 17:05:19 hammant Exp $
  +        $Id: tests.xml,v 1.11 2002/03/19 22:12:35 hammant Exp $
   -->
   
   
  @@ -96,7 +96,7 @@
     <target name="generate" depends="prepare">
        
       <altrmiinterfaces genname="Hello" srcgendir="${build.home}/genjava" 
  -        classgendir="${build.home}/classes2" 
  +        classgendir="${build.home}/classes2" verbose="true"
           classesorinterfaces="org.apache.commons.altrmi.test.TestInterface" 
           additionalfacades="org.apache.commons.altrmi.test.TestInterface2">
         <classpath>
  
  
  
  1.2       +5 -1      jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/AltrmiProxy.java
  
  Index: AltrmiProxy.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/AltrmiProxy.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AltrmiProxy.java	1 Feb 2002 00:16:37 -0000	1.1
  +++ AltrmiProxy.java	19 Mar 2002 22:12:35 -0000	1.2
  @@ -8,13 +8,17 @@
   
   package org.apache.commons.altrmi.client;
   
  +import org.apache.commons.altrmi.client.impl.BaseServedObject;
  +
   /**
    * Interface AltrmiProxy
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public interface AltrmiProxy {
  +
  +    //BaseServedObject altrmiGetBaseServedObject();
   
   }
  
  
  
  1.12      +20 -7     jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/BaseServedObject.java
  
  Index: BaseServedObject.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/BaseServedObject.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- BaseServedObject.java	6 Mar 2002 19:34:46 -0000	1.11
  +++ BaseServedObject.java	19 Mar 2002 22:12:36 -0000	1.12
  @@ -21,6 +21,7 @@
   import org.apache.commons.altrmi.common.MethodFacadeRequest;
   import org.apache.commons.altrmi.common.FacadeRefHolder;
   import org.apache.commons.altrmi.common.MethodFacadeArrayReply;
  +import org.apache.commons.altrmi.client.AltrmiProxy;
   
   import java.lang.reflect.Array;
   
  @@ -30,16 +31,16 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.11 $
  + * @version $Revision: 1.12 $
    */
   public final class BaseServedObject {
   
  -    private final AbstractAltrmiFactory mAltrmiFactory;
  -    private final AltrmiInvocationHandler mInvocationHandler;
  -    private final String mPublishedServiceName;
  -    private final String mObjectName;
  -    private final Long mReferenceID;
  -    private final Long mSession;
  +    private final transient AbstractAltrmiFactory mAltrmiFactory;
  +    private final transient AltrmiInvocationHandler mInvocationHandler;
  +    private final transient String mPublishedServiceName;
  +    private final transient String mObjectName;
  +    private final transient Long mReferenceID;
  +    private final transient Long mSession;
   
       /**
        * Constructor BaseServedObject
  @@ -240,6 +241,18 @@
               throw new AltrmiInvocationException("Internal Error : Unknown reply type :"
                                                   + reply.getClass().getName());
           }
  +    }
  +
  +    public void processVoidRequestWithRedirect(String methodSignature, Object[] args) throws Throwable {
  +        Object[] newArgs = new Object[args.length];
  +        for (int i = 0; i < args.length; i++) {
  +            if (args[i] instanceof AltrmiProxy) {
  +                //TODO somehow get the reference details and put a redirect place holder here
  +            } else {
  +                newArgs[i] = args[i];
  +            }
  +        }
  +        processVoidRequest(methodSignature, newArgs);
       }
   
       /**
  
  
  
  1.4       +20 -9     jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/DefaultInterfaceLookupFactory.java
  
  Index: DefaultInterfaceLookupFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/DefaultInterfaceLookupFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultInterfaceLookupFactory.java	10 Mar 2002 09:40:18 -0000	1.3
  +++ DefaultInterfaceLookupFactory.java	19 Mar 2002 22:12:36 -0000	1.4
  @@ -8,11 +8,7 @@
    */
   package org.apache.commons.altrmi.client.impl;
   
  -
  -
  -import org.apache.commons.altrmi.client.impl.socket.SocketObjectStreamFactoryHelper;
  -import org.apache.commons.altrmi.client.impl.socket.SocketCustomStreamFactoryHelper;
  -import org.apache.commons.altrmi.client.impl.rmi.RmiFactoryHelper;
  +import org.apache.commons.altrmi.client.AltrmiInterfaceLookupFactory;
   
   
   /**
  @@ -20,7 +16,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
    */
   public class DefaultInterfaceLookupFactory extends AbstractInterfaceLookupFactory {
   
  @@ -39,9 +35,24 @@
        */
       public DefaultInterfaceLookupFactory() {
   
  -        addFactory("SocketObjectStream:", new SocketObjectStreamFactoryHelper());
  -        addFactory("SocketCustomStream:", new SocketCustomStreamFactoryHelper());
  -        addFactory("RMI:", new RmiFactoryHelper());
  +        try {
  +            addFactory("SocketObjectStream:", (AltrmiInterfaceLookupFactory) Class.forName("org.apache.commons.altrmi.client.impl.socket.SocketObjectStreamFactoryHelper").newInstance());
  +        } catch (ClassNotFoundException cnfe) {
  +        } catch (InstantiationException ie) {
  +        } catch (IllegalAccessException iae) {
  +        }
  +        try {
  +            addFactory("SocketCustomStream:", (AltrmiInterfaceLookupFactory) Class.forName("org.apache.commons.altrmi.client.impl.socket.SocketCustomStreamFactoryHelper").newInstance());
  +        } catch (ClassNotFoundException cnfe) {
  +        } catch (InstantiationException ie) {
  +        } catch (IllegalAccessException iae) {
  +        }
  +        try {
  +            addFactory("RMI:", (AltrmiInterfaceLookupFactory) Class.forName("org.apache.commons.altrmi.client.impl.rmi.RmiFactoryHelper").newInstance());
  +        } catch (ClassNotFoundException cnfe) {
  +        } catch (InstantiationException ie) {
  +        } catch (IllegalAccessException iae) {
  +        }
   
           // TODO - add the rest.
       }
  
  
  
  1.8       +6 -1      jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/generator/ProxyGeneratorImpl.java
  
  Index: ProxyGeneratorImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/generator/ProxyGeneratorImpl.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ProxyGeneratorImpl.java	16 Mar 2002 04:54:34 -0000	1.7
  +++ ProxyGeneratorImpl.java	19 Mar 2002 22:12:36 -0000	1.8
  @@ -33,7 +33,7 @@
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
    * @author Mike Miller of www.gac.com
  - * @version $Revision: 1.7 $
  + * @version $Revision: 1.8 $
    */
   public class ProxyGeneratorImpl extends AbstractMethodHandler implements ProxyGenerator {
   
  @@ -222,11 +222,16 @@
           mClassSource.println(" implements org.apache.commons.altrmi.client.AltrmiProxy{ ");
           mClassSource.println(
               "  private transient org.apache.commons.altrmi.client.impl.BaseServedObject mBaseServedObject;");
  +
  +        // Generate Constructor
  +
           mClassSource.println(
               "  public AltrmiGenerated" + mGenName + "_" + name
               + " (org.apache.commons.altrmi.client.impl.BaseServedObject baseServedObject) {");
           mClassSource.println("      mBaseServedObject = baseServedObject;");
           mClassSource.println("  }");
  +
  +        // TODO BaseServedObject altrmiGetBaseServedObject();
   
           for (int x = 0; x < classOrInterfacesToExpose.length; x++) {
               Class clazz = classOrInterfacesToExpose[x];
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>