hammant     02/01/11 06:24:07

  Modified:    altrmi   PROPOSAL
               altrmi/src/java/org/apache/commons/altrmi/generator
                        PrimarySourceGenerator.java
               altrmi/src/java/org/apache/commons/altrmi/generator/ant
                        AltrmiInterfaceTask.java
  Log:
  classpath elem for ant task
  
  Revision  Changes    Path
  1.2       +22 -12    jakarta-commons-sandbox/altrmi/PROPOSAL
  
  Index: PROPOSAL
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/PROPOSAL,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PROPOSAL  9 Jan 2002 19:25:53 -0000       1.1
  +++ PROPOSAL  11 Jan 2002 14:24:07 -0000      1.2
  @@ -1,10 +1,10 @@
   --------------------------------------------------------------------------
  -  JAKARTA COMMONS  -  ALTERNATE (TO) REMOTE METHOD INVOCATION - "ARMI"
  + JAKARTA COMMONS  -  ALTERNATIVE (TO) REMOTE METHOD INVOCATION - "AltRMI"
   --------------------------------------------------------------------------
   
   Abstract:
   
  -The ARMI package provides an alternative to Java's RMI.  Apart from simply 
  +The AltRMI package provides an alternative to Java's RMI.  Apart from simply 
   being an alternative it provides the following features:
   
   1) Any interface publishing
  @@ -32,7 +32,7 @@
     
   3) Speed  
   
  -  - Using the ARMI over RMI transport as a baseline.  Measuring 100,000 
  +  - Using the AltRMI over RMI transport as a baseline.  Measuring 100,000 
       method invocations after discarding the first for the purposes of 
       timing, ObjStream over sockets is three times faster, ObjStream over 
       Pipe is eleven times faster, Direct is a thousand times faster. Granted
  @@ -41,7 +41,7 @@
   
   4) Interface/Impl separated design.
   
  -  - ARMI can be build easily into any application or application framework.  
  +  - AltRMI can be build easily into any application or application framework.  
       Individual aspects can be reimplemented (or overridden) as the need 
       arises.
   
  @@ -68,7 +68,7 @@
   
   8) Recovering transport
   
  -  - ARMI tries to recover its transports should they fail.  The recovery 
  +  - AltRMI tries to recover its transports should they fail.  The recovery 
       is pluggable in that the developer can choose when/how/if the connection
       handler tries to recover the connection.  Any inprogress, but
       disconnected method invocation will attempt to be recoved and just return
  @@ -93,13 +93,13 @@
   
   12) No just pass by value.
   
  -  - ARMI started life as 'pass by value' only.  In now supports return 
  -    types and parameters wrapped in another ARMI Facade.
  +  - AltRMI started life as 'pass by value' only.  In now supports return 
  +    types and parameters wrapped in another AltRMI Facade.
       
   13) No duplicate instances.
   
  -  - If you call Person p = getPerson("Fred") twice you will get the same instance 
  -    on the client side is it is the same instance on the server side.
  +  - If you call Person p = getPerson("Fred") twice you will get the same
  +    instance on the client side is it is the same instance on the server side.
   
   Limitations:
    
  @@ -112,15 +112,25 @@
   
   Todo:
   
  -1) BCEL for generated proxy class.
  +1) Other transports
  +  
  +  - SOAP, CORBA (with WDSL & IDL generation steps)
  +  - Other RMI (over IIOP, over HTTP)
  +  - Custom, socket protocol
  +  - JMS
  +
  +2) BCEL for generated proxy class.
   
     - The current impl writes java source then compiles it.  We could do this
       inline with BCEL.  This as an heavier, but more design perfect 
       alternative to the current server side impl.
  +    
  +  - BCEL is really difficult to use if you are not skilled in it!!
  +
        
  -2) Client and Server code for secure conversations.
  +3) Client and Server code for secure conversations.
   
  -3) Authentication and Authorisation on lookup(..).
  +4) Authentication and Authorisation on lookup(..).
   
   Initial committers:
   
  
  
  
  1.3       +6 -6      
jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/generator/PrimarySourceGenerator.java
  
  Index: PrimarySourceGenerator.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/generator/PrimarySourceGenerator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PrimarySourceGenerator.java       10 Jan 2002 11:17:03 -0000      1.2
  +++ PrimarySourceGenerator.java       11 Jan 2002 14:24:07 -0000      1.3
  @@ -28,7 +28,7 @@
    *
    *
    * @author Paul Hammant <a 
href="mailto:[EMAIL PROTECTED]";>[EMAIL PROTECTED]</a>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
   public class PrimarySourceGenerator extends AbstractMethodHandler {
   
  @@ -89,22 +89,22 @@
        * bean should be castable to the prescribed interfaces or not.
        *
        */
  -    public void generate(boolean beanOnly) throws SourceGenerationException {
  +    public void generate(ClassLoader cL, boolean beanOnly) throws 
SourceGenerationException {
   
           // The lookupable service class source.
  -        makeSource(beanOnly, "Main", mClassesOrInterfacesToExpose);
  +        makeSource(cL, beanOnly, "Main", mClassesOrInterfacesToExpose);
   
           if ( mAdditionalFacades != null) {
               for (int i = 0; i < mAdditionalFacades.length; i++) {
                   String facade = mAdditionalFacades[i];
  -                makeSource(beanOnly, encodeClassName(facade), new String[] { facade 
} );
  +                makeSource(cL, beanOnly, encodeClassName(facade), new String[] { 
facade } );
               }
           }
   
       }
   
   
  -    public void makeSource(boolean beanOnly, String name, String[] 
classOrInterfacesToExpose) throws SourceGenerationException {
  +    public void makeSource(ClassLoader cL, boolean beanOnly, String name, String[] 
classOrInterfacesToExpose) throws SourceGenerationException {
   
           // methdos could be in more than one interface.
           Vector methodsDone = new Vector();
  @@ -132,7 +132,7 @@
               Class clazz = null;
   
               try {
  -                clazz = Class.forName(classOrInterfacesToExpose[x]);
  +                clazz = cL.loadClass(classOrInterfacesToExpose[x]);
               } catch (ClassNotFoundException e) {
                   e.printStackTrace();
               }
  
  
  
  1.2       +35 -6     
jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/generator/ant/AltrmiInterfaceTask.java
  
  Index: AltrmiInterfaceTask.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/generator/ant/AltrmiInterfaceTask.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AltrmiInterfaceTask.java  9 Jan 2002 19:25:55 -0000       1.1
  +++ AltrmiInterfaceTask.java  11 Jan 2002 14:24:07 -0000      1.2
  @@ -9,6 +9,9 @@
   
   import org.apache.tools.ant.Task;
   import org.apache.tools.ant.BuildException;
  +import org.apache.tools.ant.AntClassLoader;
  +import org.apache.tools.ant.types.Path;
  +import org.apache.tools.ant.types.Reference;
   import org.apache.tools.ant.util.FileUtils;
   import org.apache.commons.altrmi.generator.PrimarySourceGenerator;
   import org.apache.commons.altrmi.generator.SourceGenerationException;
  @@ -18,11 +21,12 @@
   
   public class AltrmiInterfaceTask extends Task {
   
  -    private String[] mClassOrInterfacesToExpose;
  -    private String[] mAdditionalFacades;
  -    private String mGenDir;
  -    private String mGenName;
  -    private boolean mBeanOnly;
  +    protected String[] mClassOrInterfacesToExpose;
  +    protected String[] mAdditionalFacades;
  +    protected String mGenDir;
  +    protected String mGenName;
  +    protected boolean mBeanOnly;
  +    protected Path classpath;
   
       public AltrmiInterfaceTask() {
       }
  @@ -59,6 +63,24 @@
           this.mGenName = genName;
       }
   
  +    public void setClasspath(Path classpath) {
  +        if (this.classpath == null) {
  +            this.classpath = classpath;
  +        } else {
  +            this.classpath.append(classpath);
  +        }
  +    }
  +
  +    public Path createClasspath() {
  +        if (this.classpath == null) {
  +            this.classpath = new Path(project);
  +        }
  +        return this.classpath.createPath();
  +    }
  +
  +    public void setClasspathRef(Reference r) {
  +        createClasspath().setRefid(r);
  +    }
   
       public void execute() throws BuildException {
           if (mClassOrInterfacesToExpose == null) {
  @@ -76,7 +98,14 @@
           sg.setClassOrInterfacesToExpose(mClassOrInterfacesToExpose);
           sg.setAdditionalfacades(mAdditionalFacades);
           try {
  -            sg.generate(mBeanOnly);
  +            ClassLoader cL = null;
  +            if (classpath != null) {
  +                cL = new AntClassLoader(project, classpath);
  +            } else {
  +                cL = this.getClass().getClassLoader();
  +            }
  +
  +            sg.generate(cL, mBeanOnly);
           } catch (SourceGenerationException sge) {
               throw new BuildException(sge.getMessage());
           }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to