avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hamm...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/piped PipedTest.java
Date Sun, 14 Jul 2002 23:12:44 GMT
hammant     2002/07/14 16:12:44

  Modified:    altrmi   build.xml piped.xml
               altrmi/src/java/org/apache/excalibur/altrmi/generator
                        BCELProxyGeneratorImpl.java ProxyGeneratorImpl.java
               altrmi/src/java/org/apache/excalibur/altrmi/server/impl/classretrievers
                        AbstractClassRetriever.java
                        PlainClassRetriever.java
               altrmi/src/test/org/apache/excalibur/altrmi/test/piped
                        PipedTest.java
  Added:       altrmi/src/java/org/apache/excalibur/altrmi/generator
                        AbstractProxyGenerator.java
               altrmi/src/java/org/apache/excalibur/altrmi/server/impl/classretrievers
                        AbstractDynamicGeneratorClassRetriever.java
                        BcelDynamicGeneratorClassRetriever.java
                        JavacDynamicGeneratorClassRetriever.java
  Removed:     altrmi/src/java/org/apache/excalibur/altrmi/server/impl/classretrievers
                        DynamicGeneratorClassRetriever.java
  Log:
  More standards conformance and slight refactor of BCEL / JAVAC duality.
  
  Revision  Changes    Path
  1.23      +2 -0      jakarta-avalon-excalibur/altrmi/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/build.xml,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- build.xml	23 May 2002 21:37:19 -0000	1.22
  +++ build.xml	14 Jul 2002 23:12:44 -0000	1.23
  @@ -266,6 +266,8 @@
               ignoreCastWhitespace="true">
               <fileset dir="${java.dir}">
                   <include name="org/apache/excalibur/altrmi/common/*.java"/>
  +                <include name="org/apache/excalibur/altrmi/generator/*.java"/>
  +                <include name="org/apache/excalibur/altrmi/server/impl/classretrievers/*.java"/>
               </fileset>
               <formatter type="plain"/>
               <formatter type="xml" toFile="${build.dir}/checkstyle-results.xml"/>
  
  
  
  1.5       +1 -0      jakarta-avalon-excalibur/altrmi/piped.xml
  
  Index: piped.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/piped.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- piped.xml	26 Apr 2002 05:41:44 -0000	1.4
  +++ piped.xml	14 Jul 2002 23:12:44 -0000	1.5
  @@ -24,6 +24,7 @@
       <pathelement location="${build.home}/testclasses"/>    
       <pathelement location="${build.home}/genclasses"/>
       <pathelement location="lib/JSX0.9.8.1.jar"/>
  +    <pathelement location="lib/bcel.jar"/>
       <pathelement location="${avalon-framework.jar}"/>
     </path>    
       
  
  
  
  1.4       +261 -254  jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/generator/BCELProxyGeneratorImpl.java
  
  Index: BCELProxyGeneratorImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/generator/BCELProxyGeneratorImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BCELProxyGeneratorImpl.java	23 May 2002 21:37:21 -0000	1.3
  +++ BCELProxyGeneratorImpl.java	14 Jul 2002 23:12:44 -0000	1.4
  @@ -22,7 +22,6 @@
   import org.apache.bcel.generic.BranchInstruction;
   import org.apache.bcel.generic.ClassGen;
   import org.apache.bcel.generic.ConstantPoolGen;
  -import org.apache.bcel.generic.DLOAD;
   import org.apache.bcel.generic.FieldGen;
   import org.apache.bcel.generic.INSTANCEOF;
   import org.apache.bcel.generic.Instruction;
  @@ -34,30 +33,27 @@
   import org.apache.bcel.generic.ObjectType;
   import org.apache.bcel.generic.PUSH;
   import org.apache.bcel.generic.Type;
  -import org.apache.excalibur.altrmi.common.ProxyGenerator;
   
   /**
    * Class BCElProxyGeneratorImpl
    *  This class generates Altrmi stubs using Jakarta BCEL library.
    * 
  - * @HOWTO: Use 'javap' to read the bytecodes of the stubs generated
  + * HOWTO: Use 'javap' to read the bytecodes of the stubs generated
    *      by using the original stub-generator(which generates pure java code).
    *
    * @author <a href="mailto:vinayc77@yahoo.com">Vinay Chandran</a>
    * @version $Revision$
    */
   public class BCELProxyGeneratorImpl
  -    extends ProxyGeneratorImpl
  -    implements ProxyGenerator
  +    extends AbstractProxyGenerator
   {
       
       //bcel 
  -    private static final String mStubPrefix = "AltrmiGenerated";
  -    private InstructionFactory mFactory;
  -    private ConstantPoolGen mConstantsPool;
  -    private ClassGen mClassGen;
  -    private ArrayList mInternalFieldRepresentingClasses;
  -    private int mArrayDepth_ = 0;
  +    private static final String STUB_PREFIX = "AltrmiGenerated";
  +    private InstructionFactory m_factory;
  +    private ConstantPoolGen m_constantsPool;
  +    private ClassGen m_classGen;
  +    private ArrayList m_internalFieldRepresentingClasses;
   
       /*
        * @see ProxyGenerator#generateClass(ClassLoader)
  @@ -66,25 +62,25 @@
       {
   
           //create the Main Stubs:
  -        generateAltrmiProxyClass(mStubPrefix + mGenName + "_Main", mInterfacesToExpose);
  +        generateAltrmiProxyClass(STUB_PREFIX + getGenName() + "_Main", getInterfacesToExpose());
           generateAltrmiProxyClass2(
  -            mStubPrefix + "2" + mGenName + "_Main",
  -            mStubPrefix + mGenName + "_Main",
  -            mInterfacesToExpose);
  +            STUB_PREFIX + "2" + getGenName() + "_Main",
  +            STUB_PREFIX + getGenName() + "_Main",
  +            getInterfacesToExpose());
   
           //Create the Additional Facades 
  -        if (mAdditionalFacades != null)
  +        if (getAdditionalFacades() != null)
           {
  -            for (int i = 0; i < mAdditionalFacades.length; i++)
  +            for (int i = 0; i < getAdditionalFacades().length; i++)
               {
  -                String encodedClassName = encodeClassName(mAdditionalFacades[i]);
  +                String encodedClassName = encodeClassName(getAdditionalFacades()[i]);
                   generateAltrmiProxyClass(
  -                    mStubPrefix + mGenName + "_" + encodedClassName,
  -                    new Class[] { mAdditionalFacades[i] });
  +                    STUB_PREFIX + getGenName() + "_" + encodedClassName,
  +                    new Class[] { getAdditionalFacades()[i] });
                   generateAltrmiProxyClass2(
  -                    mStubPrefix + "2" + mGenName + "_" + encodedClassName,
  -                    mStubPrefix + mGenName + "_" + encodedClassName,
  -                    new Class[] { mAdditionalFacades[i] });
  +                    STUB_PREFIX + "2" + getGenName() + "_" + encodedClassName,
  +                    STUB_PREFIX + getGenName() + "_" + encodedClassName,
  +                    new Class[] { getAdditionalFacades()[i] });
   
               }
           }
  @@ -95,10 +91,10 @@
        * Method generateAltrmiProxyClass.
        *         Create AltrmiProxy Implementation with all interface methods 
        *     Generating AltrmiGeneratedGENNAME_Main class
  -     * @param className
  +     * @param mGeneratedClassName
        * @param interfacesToStubify
        */
  -    private void generateAltrmiProxyClass(
  +    protected void generateAltrmiProxyClass(
           String mGeneratedClassName,
           Class[] interfacesToStubify)
       {
  @@ -119,8 +115,8 @@
           FileOutputStream fos = null;
           try
           {
  -            fos = new FileOutputStream(mClassGenDir + "/" + mGeneratedClassName + ".class");
  -            mClassGen.getJavaClass().dump(fos);
  +            fos = new FileOutputStream(getClassGenDir() + "/" + mGeneratedClassName + ".class");
  +            m_classGen.getJavaClass().dump(fos);
               fos.close();
           }
           catch (FileNotFoundException fnfe)
  @@ -138,25 +134,27 @@
        *      Create the Stub Class purely implementing the Interface  and
        *             inheriting the implementation from the helper class
        *     Generating AltrmiGenerated2GENNAME_Main class
  -     * @param className
  +     * @param generatedClassName2
  +     * @param generatedClassName
  +     * @param interfacesToStubify
        */
  -    private void generateAltrmiProxyClass2(
  -        String mGeneratedClassName2,
  -        String mGeneratedClassName,
  +    protected void generateAltrmiProxyClass2(
  +        String generatedClassName2,
  +        String generatedClassName,
           Class[] interfacesToStubify)
       {
           //start creating the class
           createNewClassDeclaration2(
  -            mGeneratedClassName2,
  -            mGeneratedClassName,
  +            generatedClassName2,
  +            generatedClassName,
               interfacesToStubify);
           //create the constructor 
  -        createConstructor2(mGeneratedClassName2, mGeneratedClassName);
  +        createConstructor2(generatedClassName2, generatedClassName);
           try
           {
               FileOutputStream fos =
  -                new FileOutputStream(mClassGenDir + "/" + mGeneratedClassName2 + ".class");
  -            mClassGen.getJavaClass().dump(fos);
  +                new FileOutputStream(getClassGenDir() + "/" + generatedClassName2 + ".class");
  +            m_classGen.getJavaClass().dump(fos);
               fos.close();
           }
           catch (FileNotFoundException fnfe)
  @@ -176,19 +174,19 @@
        * Method createAndInitializeClass.
        *     This method starts creating the class.
        */
  -    private void createNewClassDeclaration(String mGeneratedClassName)
  +    protected void createNewClassDeclaration(String mGeneratedClassName)
       {
   
  -        mClassGen =
  +        m_classGen =
               new ClassGen(
                   mGeneratedClassName,
                   "java.lang.Object",
                   mGeneratedClassName + ".java",
                   Constants.ACC_PUBLIC | Constants.ACC_SUPER,
                   new String[] { "org.apache.excalibur.altrmi.client.AltrmiProxy" });
  -        mConstantsPool = mClassGen.getConstantPool();
  -        mFactory = new InstructionFactory(mClassGen, mConstantsPool);
  -        mInternalFieldRepresentingClasses = new ArrayList();
  +        m_constantsPool = m_classGen.getConstantPool();
  +        m_factory = new InstructionFactory(m_classGen, m_constantsPool);
  +        m_internalFieldRepresentingClasses = new ArrayList();
   
       }
       /**
  @@ -196,7 +194,7 @@
        *     Create a class which extends a class contained the impl of the Interface and 
        *                     and  implements the interface
        */
  -    private void createNewClassDeclaration2(
  +    protected void createNewClassDeclaration2(
           String mGeneratedClassName2,
           String mGeneratedClassName,
           Class[] interfacesToStubify)
  @@ -204,21 +202,21 @@
           String[] mInterafacesToImplement = new String[interfacesToStubify.length];
           for (int i = 0; i < mInterafacesToImplement.length; i++)
               mInterafacesToImplement[i] = interfacesToStubify[i].getName();
  -        mClassGen =
  +        m_classGen =
               new ClassGen(
                   mGeneratedClassName2,
                   mGeneratedClassName,
                   mGeneratedClassName2 + ".java",
                   Constants.ACC_PUBLIC | Constants.ACC_FINAL | Constants.ACC_SUPER,
                   mInterafacesToImplement);
  -        mConstantsPool = mClassGen.getConstantPool();
  -        mFactory = new InstructionFactory(mClassGen, mConstantsPool);
  +        m_constantsPool = m_classGen.getConstantPool();
  +        m_factory = new InstructionFactory(m_classGen, m_constantsPool);
       }
       /**
        * Method createConstructor.
        *     This method adds a constructor that takes in a ProxyHelper Instance
        */
  -    private void createConstructor(String mGeneratedClassName)
  +    protected void createConstructor(String mGeneratedClassName)
       {
           InstructionList il = new InstructionList();
           MethodGen method =
  @@ -230,34 +228,34 @@
                   "<init>",
                   mGeneratedClassName,
                   il,
  -                mConstantsPool);
  -        InstructionHandle ih_0 = il.append(mFactory.createLoad(Type.OBJECT, 0));
  +                m_constantsPool);
  +        InstructionHandle ih0 = il.append(m_factory.createLoad(Type.OBJECT, 0));
           il.append(
  -            mFactory.createInvoke(
  +            m_factory.createInvoke(
                   "java.lang.Object",
                   "<init>",
                   Type.VOID,
                   Type.NO_ARGS,
                   Constants.INVOKESPECIAL));
  -        InstructionHandle ih_4 = il.append(mFactory.createLoad(Type.OBJECT, 0));
  -        il.append(mFactory.createLoad(Type.OBJECT, 1));
  +        InstructionHandle ih4 = il.append(m_factory.createLoad(Type.OBJECT, 0));
  +        il.append(m_factory.createLoad(Type.OBJECT, 1));
           il.append(
  -            mFactory.createFieldAccess(
  +            m_factory.createFieldAccess(
                   mGeneratedClassName,
                   "mProxyHelper",
                   new ObjectType("org.apache.excalibur.altrmi.client.ProxyHelper"),
                   Constants.PUTFIELD));
  -        InstructionHandle ih_9 = il.append(mFactory.createReturn(Type.VOID));
  +        InstructionHandle ih9 = il.append(m_factory.createReturn(Type.VOID));
           method.setMaxStack();
           method.setMaxLocals();
  -        mClassGen.addMethod(method.getMethod());
  +        m_classGen.addMethod(method.getMethod());
           il.dispose();
       }
   
       /**
        * Method createConstructor2.
        */
  -    private void createConstructor2(
  +    protected void createConstructor2(
           String mGeneratedClassName2,
           String mGeneratedClassName)
       {
  @@ -271,20 +269,20 @@
                   "<init>",
                   mGeneratedClassName2,
                   il,
  -                mConstantsPool);
  -        InstructionHandle ih_0 = il.append(mFactory.createLoad(Type.OBJECT, 0));
  -        il.append(mFactory.createLoad(Type.OBJECT, 1));
  +                m_constantsPool);
  +        InstructionHandle ih0 = il.append(m_factory.createLoad(Type.OBJECT, 0));
  +        il.append(m_factory.createLoad(Type.OBJECT, 1));
           il.append(
  -            mFactory.createInvoke(
  +            m_factory.createInvoke(
                   mGeneratedClassName,
                   "<init>",
                   Type.VOID,
                   new Type[] { new ObjectType("org.apache.excalibur.altrmi.client.ProxyHelper")},
                   Constants.INVOKESPECIAL));
  -        InstructionHandle ih_5 = il.append(mFactory.createReturn(Type.VOID));
  +        InstructionHandle ih5 = il.append(m_factory.createReturn(Type.VOID));
           method.setMaxStack();
           method.setMaxLocals();
  -        mClassGen.addMethod(method.getMethod());
  +        m_classGen.addMethod(method.getMethod());
           il.dispose();
       }
   
  @@ -295,7 +293,7 @@
        * =================adding===============
        *     Add 
        */
  -    private void createFields()
  +    protected void createFields()
       {
           FieldGen field;
           field =
  @@ -303,19 +301,22 @@
                   Constants.ACC_PRIVATE | Constants.ACC_TRANSIENT,
                   new ObjectType("org.apache.excalibur.altrmi.client.ProxyHelper"),
                   "mProxyHelper",
  -                mConstantsPool);
  -        mClassGen.addField(field.getField());
  +                m_constantsPool);
  +        m_classGen.addField(field.getField());
       }
   
       /**
        * Method createAltrmiGetReferenceIDMethod. 
        * =================adding=====================================
  -     *      public Long altrmiGetReferenceID(Object factoryThatIsAsking) {
  -     *   return mProxyHelper.getReferenceID(factoryThatIsAsking);
  -     *        }
  +     *   public Long altrmiGetReferenceID(Object factoryThatIsAsking) {
  +     *     return mProxyHelper.getReferenceID(factoryThatIsAsking);
  +     *   }
        * =================adding=====================================
  +     *
  +     * @param generatedClassName the generated class name
  +     *
        */
  -    private void createAltrmiGetReferenceIDMethod(String mGeneratedClassName)
  +    protected void createAltrmiGetReferenceIDMethod(String generatedClassName)
       {
           InstructionList il = new InstructionList();
           MethodGen method =
  @@ -325,28 +326,28 @@
                   new Type[] { Type.OBJECT },
                   new String[] { "arg0" },
                   "altrmiGetReferenceID",
  -                mGeneratedClassName,
  +                generatedClassName,
                   il,
  -                mConstantsPool);
  -        InstructionHandle ih_0 = il.append(mFactory.createLoad(Type.OBJECT, 0));
  +                m_constantsPool);
  +        InstructionHandle ih0 = il.append(m_factory.createLoad(Type.OBJECT, 0));
           il.append(
  -            mFactory.createFieldAccess(
  -                mGeneratedClassName,
  +            m_factory.createFieldAccess(
  +                generatedClassName,
                   "mProxyHelper",
                   new ObjectType("org.apache.excalibur.altrmi.client.ProxyHelper"),
                   Constants.GETFIELD));
  -        il.append(mFactory.createLoad(Type.OBJECT, 1));
  +        il.append(m_factory.createLoad(Type.OBJECT, 1));
           il.append(
  -            mFactory.createInvoke(
  +            m_factory.createInvoke(
                   "org.apache.excalibur.altrmi.client.ProxyHelper",
                   "getReferenceID",
                   new ObjectType("java.lang.Long"),
                   new Type[] { Type.OBJECT },
                   Constants.INVOKEINTERFACE));
  -        InstructionHandle ih_8 = il.append(mFactory.createReturn(Type.OBJECT));
  +        InstructionHandle ih8 = il.append(m_factory.createReturn(Type.OBJECT));
           method.setMaxStack();
           method.setMaxLocals();
  -        mClassGen.addMethod(method.getMethod());
  +        m_classGen.addMethod(method.getMethod());
           il.dispose();
       }
   
  @@ -356,7 +357,7 @@
        *     during SomeClass.class instruction
        * 
        */
  -    private void createHelperMethodForDotClassCalls(String mGeneratedClassName)
  +    protected void createHelperMethodForDotClassCalls(String mGeneratedClassName)
       {
           InstructionList il = new InstructionList();
           MethodGen method =
  @@ -368,43 +369,43 @@
                   "class$",
                   mGeneratedClassName,
                   il,
  -                mConstantsPool);
  -        InstructionHandle ih_0 = il.append(mFactory.createLoad(Type.OBJECT, 0));
  +                m_constantsPool);
  +        InstructionHandle ih0 = il.append(m_factory.createLoad(Type.OBJECT, 0));
           il.append(
  -            mFactory.createInvoke(
  +            m_factory.createInvoke(
                   "java.lang.Class",
                   "forName",
                   new ObjectType("java.lang.Class"),
                   new Type[] { Type.STRING },
                   Constants.INVOKESTATIC));
  -        InstructionHandle ih_4 = il.append(mFactory.createReturn(Type.OBJECT));
  -        InstructionHandle ih_5 = il.append(mFactory.createStore(Type.OBJECT, 1));
  -        il.append(mFactory.createNew("java.lang.NoClassDefFoundError"));
  +        InstructionHandle ih4 = il.append(m_factory.createReturn(Type.OBJECT));
  +        InstructionHandle ih5 = il.append(m_factory.createStore(Type.OBJECT, 1));
  +        il.append(m_factory.createNew("java.lang.NoClassDefFoundError"));
           il.append(InstructionConstants.DUP);
  -        il.append(mFactory.createLoad(Type.OBJECT, 1));
  +        il.append(m_factory.createLoad(Type.OBJECT, 1));
           il.append(
  -            mFactory.createInvoke(
  +            m_factory.createInvoke(
                   "java.lang.Throwable",
                   "getMessage",
                   Type.STRING,
                   Type.NO_ARGS,
                   Constants.INVOKEVIRTUAL));
           il.append(
  -            mFactory.createInvoke(
  +            m_factory.createInvoke(
                   "java.lang.NoClassDefFoundError",
                   "<init>",
                   Type.VOID,
                   new Type[] { Type.STRING },
                   Constants.INVOKESPECIAL));
  -        InstructionHandle ih_17 = il.append(InstructionConstants.ATHROW);
  +        InstructionHandle ih17 = il.append(InstructionConstants.ATHROW);
           method.addExceptionHandler(
  -            ih_0,
  -            ih_4,
  -            ih_5,
  +            ih0,
  +            ih4,
  +            ih5,
               new ObjectType("java.lang.ClassNotFoundException"));
           method.setMaxStack();
           method.setMaxLocals();
  -        mClassGen.addMethod(method.getMethod());
  +        m_classGen.addMethod(method.getMethod());
           il.dispose();
       }
   
  @@ -413,23 +414,26 @@
        *     This methods shall iterate through the set of methods
        *     of the interface creating equivalent methods for the
        *     stubs in the process.
  +     *
  +     * @param generatedClassName the generated class name
  +     * @param interfacesToStubify the interfaces to make stubs for.
        */
  -    private void createInterfaceMethods(
  -        String mGeneratedClassName,
  +    protected void createInterfaceMethods(
  +        String generatedClassName,
           Class[] interfacesToStubify)
       {
           for (int x = 0; x < interfacesToStubify.length; x++)
           {
               Class clazz = interfacesToStubify[x];
   
  -            if (mVerbose)
  +            if (isVerbose())
               {
                   System.out.println("ProxyGen: Processing interface: " + clazz.getName());
               }
               Method[] methods = clazz.getMethods();
               for (int i = 0; i < methods.length; i++)
               {
  -                createInterfaceMethod(mGeneratedClassName, methods[i]);
  +                createInterfaceMethod(generatedClassName, methods[i]);
               }
   
           }
  @@ -441,7 +445,7 @@
        *     Add the java.lang.reflect.Method wrapper into the stub
        * @param m
        */
  -    private void createInterfaceMethod(String mGeneratedClassName, Method m)
  +    protected void createInterfaceMethod(String mGeneratedClassName, Method m)
       {
           InstructionList il = new InstructionList();
           MethodGen method =
  @@ -453,7 +457,7 @@
                   m.getName(),
                   mGeneratedClassName,
                   il,
  -                mConstantsPool);
  +                m_constantsPool);
   
           //debug(getArguments(m));
   
  @@ -472,15 +476,15 @@
           Class[] paramTypes = m.getParameterTypes();
           numberOfArguments = paramTypes.length;
           variableIndex = getFreeIndexToStart(paramTypes);
  -        InstructionHandle ih_0 = il.append(new PUSH(mConstantsPool, numberOfArguments));
  -        il.append((Instruction) mFactory.createNewArray(Type.OBJECT, (short) 1));
  -        il.append(mFactory.createStore(Type.OBJECT, ++variableIndex));
  -        InstructionHandle ih_5 = il.append(new PUSH(mConstantsPool, numberOfArguments));
  +        InstructionHandle ih0 = il.append(new PUSH(m_constantsPool, numberOfArguments));
  +        il.append((Instruction) m_factory.createNewArray(Type.OBJECT, (short) 1));
  +        il.append(m_factory.createStore(Type.OBJECT, ++variableIndex));
  +        InstructionHandle ih5 = il.append(new PUSH(m_constantsPool, numberOfArguments));
           il.append(
  -            (Instruction) mFactory.createNewArray(
  +            (Instruction) m_factory.createNewArray(
                   new ObjectType("java.lang.Class"),
                   (short) 1));
  -        il.append(mFactory.createStore(Type.OBJECT, ++variableIndex));
  +        il.append(m_factory.createStore(Type.OBJECT, ++variableIndex));
   
           /*
            *  Assigning parameter into Object[] and Class[] Array
  @@ -489,25 +493,25 @@
            *   argClasses[0]=v0Class.class
            */
           //Used for adjustment of double/long datatype: 
  -        Type _previousType = null;
  -        int _loadIndex = 0;
  +        Type previousType = null;
  +        int loadIndex = 0;
           for (int i = 0; i < numberOfArguments; i++)
           {
               // assigning the obj ref's
  -            il.append(mFactory.createLoad(Type.OBJECT, variableIndex - 1));
  -            il.append(new PUSH(mConstantsPool, i));
  +            il.append(m_factory.createLoad(Type.OBJECT, variableIndex - 1));
  +            il.append(new PUSH(m_constantsPool, i));
               String className = paramTypes[i].getName();
               //adjust for any previous wider datatype (double/long)
  -            if (_previousType != null
  -                && (_previousType == Type.DOUBLE || _previousType == Type.LONG))
  -                ++_loadIndex;
  +            if (previousType != null
  +                && (previousType == Type.DOUBLE || previousType == Type.LONG))
  +                ++loadIndex;
               if (paramTypes[i].isPrimitive())
               {
  -                il.append(mFactory.createNew(getJavaWrapperClass(className)));
  +                il.append(m_factory.createNew(getJavaWrapperClass(className)));
                   il.append(InstructionConstants.DUP);
  -                il.append(mFactory.createLoad(getBCELPrimitiveType(className), ++_loadIndex));
  +                il.append(m_factory.createLoad(getBCELPrimitiveType(className), ++loadIndex));
                   il.append(
  -                    mFactory.createInvoke(
  +                    m_factory.createInvoke(
                           getJavaWrapperClass(className),
                           "<init>",
                           Type.VOID,
  @@ -519,56 +523,56 @@
               {
   
                   //create the static fields for enabling .class calls
  -                String _encodedFieldName;
  +                String encodedFieldName;
                   if (paramTypes[i].isArray())
                   {
  -                    int _index = className.lastIndexOf('[');
  -                    if (className.charAt(_index + 1) == 'L')
  -                        _encodedFieldName =
  +                    int index = className.lastIndexOf('[');
  +                    if (className.charAt(index + 1) == 'L')
  +                        encodedFieldName =
                               "array$"
  -                                + className.substring(1 + _index, className.length() - 1).replace('.', '$');
  +                                + className.substring(1 + index, className.length() - 1).replace('.', '$');
                       else
  -                        _encodedFieldName =
  -                            "array$" + className.substring(1 + _index, className.length());
  +                        encodedFieldName =
  +                            "array$" + className.substring(1 + index, className.length());
                   }
                   else
  -                    _encodedFieldName = "class$" + className.replace('.', '$');
  +                    encodedFieldName = "class$" + className.replace('.', '$');
                   
  -                addField(_encodedFieldName);
  +                addField(encodedFieldName);
                   // ******** TODO assign the obj reference 
  -                il.append(mFactory.createLoad(Type.OBJECT, variableIndex - 1));
  -                il.append(new PUSH(mConstantsPool, i));
  -                il.append(mFactory.createLoad(Type.OBJECT, ++_loadIndex));
  +                il.append(m_factory.createLoad(Type.OBJECT, variableIndex - 1));
  +                il.append(new PUSH(m_constantsPool, i));
  +                il.append(m_factory.createLoad(Type.OBJECT, ++loadIndex));
                   il.append(InstructionConstants.AASTORE);
   
                   // *********TODO assign the class ref's
  -                il.append(mFactory.createLoad(Type.OBJECT, variableIndex));
  -                il.append(new PUSH(mConstantsPool, i));
  +                il.append(m_factory.createLoad(Type.OBJECT, variableIndex));
  +                il.append(new PUSH(m_constantsPool, i));
                   il.append(
  -                    mFactory.createFieldAccess(
  +                    m_factory.createFieldAccess(
                           mGeneratedClassName,
  -                        _encodedFieldName,
  +                        encodedFieldName,
                           new ObjectType("java.lang.Class"),
                           Constants.GETSTATIC));
                   BranchInstruction ifnull =
  -                    mFactory.createBranchInstruction(Constants.IFNULL, null);
  +                    m_factory.createBranchInstruction(Constants.IFNULL, null);
                   il.append(ifnull);
                   il.append(
  -                    mFactory.createFieldAccess(
  +                    m_factory.createFieldAccess(
                           mGeneratedClassName,
  -                        _encodedFieldName,
  +                        encodedFieldName,
                           new ObjectType("java.lang.Class"),
                           Constants.GETSTATIC));
                   BranchInstruction goHeadToStoreRef =
  -                    mFactory.createBranchInstruction(Constants.GOTO, null);
  +                    m_factory.createBranchInstruction(Constants.GOTO, null);
                   il.append(goHeadToStoreRef);
                   InstructionHandle ifnullStartHere =
  -                    il.append(new PUSH(mConstantsPool, className));
  +                    il.append(new PUSH(m_constantsPool, className));
   
                   ifnull.setTarget(ifnullStartHere);
   
                   il.append(
  -                    mFactory.createInvoke(
  +                    m_factory.createInvoke(
                           mGeneratedClassName,
                           "class$",
                           new ObjectType("java.lang.Class"),
  @@ -576,16 +580,16 @@
                           Constants.INVOKESTATIC));
                   il.append(InstructionConstants.DUP);
                   il.append(
  -                    mFactory.createFieldAccess(
  +                    m_factory.createFieldAccess(
                           mGeneratedClassName,
  -                        _encodedFieldName,
  +                        encodedFieldName,
                           new ObjectType("java.lang.Class"),
                           Constants.PUTSTATIC));
                   InstructionHandle storeClassRef = il.append(InstructionConstants.AASTORE);
                   goHeadToStoreRef.setTarget(storeClassRef);
   
               }
  -            _previousType = getBCELPrimitiveType(className);
  +            previousType = getBCELPrimitiveType(className);
           }
   
           /* Within the stub put the 
  @@ -614,46 +618,46 @@
                *     }
            * ================================================
            */
  -        InstructionHandle ihe1 = il.append(mFactory.createLoad(Type.OBJECT, 0));
  +        InstructionHandle ihe1 = il.append(m_factory.createLoad(Type.OBJECT, 0));
           il.append(
  -            mFactory.createFieldAccess(
  +            m_factory.createFieldAccess(
                   mGeneratedClassName,
                   "mProxyHelper",
                   new ObjectType("org.apache.excalibur.altrmi.client.ProxyHelper"),
                   Constants.GETFIELD));
           // **** Check if the return type is facade ***
  -        Class _returnClass=m.getReturnType();
  -        if(_returnClass.isArray())
  -                _returnClass=_returnClass.getComponentType();
  +        Class returnClass=m.getReturnType();
  +        if(returnClass.isArray())
  +                returnClass=returnClass.getComponentType();
           
           if (isAdditionalFacade(m.getReturnType()))
           {
  -            String _encodedReturnClassName="class$" + encodeClassName(_returnClass);
  -            addField(_encodedReturnClassName);
  +            String encodedReturnClassName="class$" + encodeClassName(returnClass);
  +            addField(encodedReturnClassName);
               il.append(
  -                mFactory.createFieldAccess(
  +                m_factory.createFieldAccess(
                       mGeneratedClassName,
  -                    _encodedReturnClassName,
  +                    encodedReturnClassName,
                       new ObjectType("java.lang.Class"),
                       Constants.GETSTATIC));
               BranchInstruction ifnullReturnClass =
  -                mFactory.createBranchInstruction(Constants.IFNULL, null);
  +                m_factory.createBranchInstruction(Constants.IFNULL, null);
               il.append(ifnullReturnClass);
               il.append(
  -                mFactory.createFieldAccess(
  +                m_factory.createFieldAccess(
                       mGeneratedClassName,
  -                    _encodedReturnClassName,
  +                    encodedReturnClassName,
                       new ObjectType("java.lang.Class"),
                       Constants.GETSTATIC));
               BranchInstruction gotoReturnClass =
  -                mFactory.createBranchInstruction(Constants.GOTO, null);
  +                m_factory.createBranchInstruction(Constants.GOTO, null);
               il.append(gotoReturnClass);
               
               InstructionHandle ihPushMethodName =
  -                il.append(new PUSH(mConstantsPool, _returnClass.getName()));
  +                il.append(new PUSH(m_constantsPool, returnClass.getName()));
               ifnullReturnClass.setTarget(ihPushMethodName);
               il.append(
  -                mFactory.createInvoke(
  +                m_factory.createInvoke(
                       mGeneratedClassName,
                       "class$",
                       new ObjectType("java.lang.Class"),
  @@ -661,18 +665,18 @@
                       Constants.INVOKESTATIC));
               il.append(InstructionConstants.DUP);
               il.append(
  -                mFactory.createFieldAccess(
  +                m_factory.createFieldAccess(
                       mGeneratedClassName,
  -                    _encodedReturnClassName,
  +                    encodedReturnClassName,
                       new ObjectType("java.lang.Class"),
                       Constants.PUTSTATIC));
               InstructionHandle ihPushSignature =
  -                il.append(new PUSH(mConstantsPool, getMethodSignature(m)));
  +                il.append(new PUSH(m_constantsPool, getMethodSignature(m)));
               gotoReturnClass.setTarget(ihPushSignature);
  -            il.append(mFactory.createLoad(Type.OBJECT, variableIndex-1));
  -            il.append(new PUSH(mConstantsPool, encodeClassName( getClassType( _returnClass ) )));
  +            il.append(m_factory.createLoad(Type.OBJECT, variableIndex-1));
  +            il.append(new PUSH(m_constantsPool, encodeClassName( getClassType( returnClass ) )));
               il.append(
  -                mFactory.createInvoke(
  +                m_factory.createInvoke(
                       "org.apache.excalibur.altrmi.client.ProxyHelper",
                       "processObjectRequestGettingFacade",
                       Type.OBJECT,
  @@ -686,12 +690,12 @@
           else
           {
               //method signature = METHODNAME(arguments....)   
  -            il.append(new PUSH(mConstantsPool, getMethodSignature(m)));
  +            il.append(new PUSH(m_constantsPool, getMethodSignature(m)));
               variableIndex -= 2;
  -            il.append(mFactory.createLoad(Type.OBJECT, ++variableIndex));
  -            il.append(mFactory.createLoad(Type.OBJECT, ++variableIndex));
  +            il.append(m_factory.createLoad(Type.OBJECT, ++variableIndex));
  +            il.append(m_factory.createLoad(Type.OBJECT, ++variableIndex));
               il.append(
  -                mFactory.createInvoke(
  +                m_factory.createInvoke(
                       "org.apache.excalibur.altrmi.client.ProxyHelper",
                       "processObjectRequest",
                       Type.OBJECT,
  @@ -701,23 +705,23 @@
                           new ArrayType(new ObjectType("java.lang.Class"), 1)},
                       Constants.INVOKEINTERFACE));
           }
  -        il.append(mFactory.createStore(Type.OBJECT, ++variableIndex));
  -        il.append(mFactory.createLoad(Type.OBJECT, variableIndex));
  +        il.append(m_factory.createStore(Type.OBJECT, ++variableIndex));
  +        il.append(m_factory.createLoad(Type.OBJECT, variableIndex));
   
           InstructionHandle ihe2;
           if (m.getReturnType().isPrimitive())
           {
               if (getBCELPrimitiveType(m.getReturnType().getName()) == Type.VOID)
               {
  -                ihe2 = il.append(mFactory.createReturn(Type.VOID));
  +                ihe2 = il.append(m_factory.createReturn(Type.VOID));
               }
               else
               {
                   il.append(
  -                    mFactory.createCheckCast(
  +                    m_factory.createCheckCast(
                           new ObjectType(getJavaWrapperClass(m.getReturnType().getName()))));
                   il.append(
  -                    mFactory.createInvoke(
  +                    m_factory.createInvoke(
                           getJavaWrapperClass(m.getReturnType().getName()),
                           m.getReturnType().getName() + "Value",
                           getBCELPrimitiveType(m.getReturnType().getName()),
  @@ -725,111 +729,111 @@
                           Constants.INVOKEVIRTUAL));
                   ihe2 =
                       il.append(
  -                        mFactory.createReturn(getBCELPrimitiveType(m.getReturnType().getName())));
  +                        m_factory.createReturn(getBCELPrimitiveType(m.getReturnType().getName())));
               }
           }
           else
           {
               il.append(
  -                mFactory.createCheckCast(new ObjectType(m.getReturnType().getName())));
  -            ihe2 = il.append(mFactory.createReturn(Type.OBJECT));
  +                m_factory.createCheckCast(new ObjectType(m.getReturnType().getName())));
  +            ihe2 = il.append(m_factory.createReturn(Type.OBJECT));
           }
   
           InstructionHandle ihe3 =
  -            il.append(mFactory.createStore(Type.OBJECT, variableIndex));
  +            il.append(m_factory.createStore(Type.OBJECT, variableIndex));
   
           //add custom exceptionHandling here 
  -        Class[] _exceptionClasses = m.getExceptionTypes();
  -        InstructionHandle _customHandler = null;
  -        BranchInstruction _ifCustomExceptionBranch = null;
  -        for (int i = 0; i < _exceptionClasses.length; i++)
  +        Class[] exceptionClasses = m.getExceptionTypes();
  +        InstructionHandle customHandler = null;
  +        BranchInstruction ifCustomExceptionBranch = null;
  +        for (int i = 0; i < exceptionClasses.length; i++)
           {
   
  -            _customHandler = il.append(mFactory.createLoad(Type.OBJECT, variableIndex));
  +            customHandler = il.append(m_factory.createLoad(Type.OBJECT, variableIndex));
               //create the series of custom exception handlers for the classes
  -            if (_ifCustomExceptionBranch != null)
  -                _ifCustomExceptionBranch.setTarget(_customHandler);
  +            if (ifCustomExceptionBranch != null)
  +                ifCustomExceptionBranch.setTarget(customHandler);
               il.append(
                   new INSTANCEOF(
  -                    mConstantsPool.addClass(new ObjectType(_exceptionClasses[i].getName()))));
  -            _ifCustomExceptionBranch =
  -                mFactory.createBranchInstruction(Constants.IFEQ, null);
  -            il.append(_ifCustomExceptionBranch);
  -            il.append(mFactory.createLoad(Type.OBJECT, variableIndex));
  +                    m_constantsPool.addClass(new ObjectType(exceptionClasses[i].getName()))));
  +            ifCustomExceptionBranch =
  +                m_factory.createBranchInstruction(Constants.IFEQ, null);
  +            il.append(ifCustomExceptionBranch);
  +            il.append(m_factory.createLoad(Type.OBJECT, variableIndex));
               il.append(
  -                mFactory.createCheckCast(new ObjectType(_exceptionClasses[i].getName())));
  +                m_factory.createCheckCast(new ObjectType(exceptionClasses[i].getName())));
               il.append(InstructionConstants.ATHROW);
           }
   
  -        InstructionHandle _defaultExceptionHandler =
  -            il.append(mFactory.createLoad(Type.OBJECT, variableIndex));
  -        if (_customHandler != null)
  -            _ifCustomExceptionBranch.setTarget(_defaultExceptionHandler);
  +        InstructionHandle defaultExceptionHandler =
  +            il.append(m_factory.createLoad(Type.OBJECT, variableIndex));
  +        if (customHandler != null)
  +            ifCustomExceptionBranch.setTarget(defaultExceptionHandler);
           il.append(
               new INSTANCEOF(
  -                mConstantsPool.addClass(new ObjectType("java.lang.RuntimeException"))));
  -        BranchInstruction b1 = mFactory.createBranchInstruction(Constants.IFEQ, null);
  +                m_constantsPool.addClass(new ObjectType("java.lang.RuntimeException"))));
  +        BranchInstruction b1 = m_factory.createBranchInstruction(Constants.IFEQ, null);
           il.append(b1);
  -        il.append(mFactory.createLoad(Type.OBJECT, variableIndex));
  +        il.append(m_factory.createLoad(Type.OBJECT, variableIndex));
           il.append(
  -            mFactory.createCheckCast(new ObjectType("java.lang.RuntimeException")));
  +            m_factory.createCheckCast(new ObjectType("java.lang.RuntimeException")));
           il.append(InstructionConstants.ATHROW);
           InstructionHandle ih1 =
  -            il.append(mFactory.createLoad(Type.OBJECT, variableIndex));
  +            il.append(m_factory.createLoad(Type.OBJECT, variableIndex));
           il.append(
  -            new INSTANCEOF(mConstantsPool.addClass(new ObjectType("java.lang.Error"))));
  -        BranchInstruction b2 = mFactory.createBranchInstruction(Constants.IFEQ, null);
  +            new INSTANCEOF(m_constantsPool.addClass(new ObjectType("java.lang.Error"))));
  +        BranchInstruction b2 = m_factory.createBranchInstruction(Constants.IFEQ, null);
           il.append(b2);
  -        il.append(mFactory.createLoad(Type.OBJECT, variableIndex));
  -        il.append(mFactory.createCheckCast(new ObjectType("java.lang.Error")));
  +        il.append(m_factory.createLoad(Type.OBJECT, variableIndex));
  +        il.append(m_factory.createCheckCast(new ObjectType("java.lang.Error")));
           il.append(InstructionConstants.ATHROW);
           InstructionHandle ih2 =
  -            il.append(mFactory.createLoad(Type.OBJECT, variableIndex));
  +            il.append(m_factory.createLoad(Type.OBJECT, variableIndex));
           il.append(
  -            mFactory.createInvoke(
  +            m_factory.createInvoke(
                   "java.lang.Throwable",
                   "printStackTrace",
                   Type.VOID,
                   Type.NO_ARGS,
                   Constants.INVOKEVIRTUAL));
           il.append(
  -            mFactory.createNew(
  +            m_factory.createNew(
                   "org.apache.excalibur.altrmi.common.AltrmiInvocationException"));
           il.append(InstructionConstants.DUP);
  -        il.append(mFactory.createNew("java.lang.StringBuffer"));
  +        il.append(m_factory.createNew("java.lang.StringBuffer"));
           il.append(InstructionConstants.DUP);
  -        il.append(new PUSH(mConstantsPool, "Should never get here: "));
  +        il.append(new PUSH(m_constantsPool, "Should never get here: "));
           il.append(
  -            mFactory.createInvoke(
  +            m_factory.createInvoke(
                   "java.lang.StringBuffer",
                   "<init>",
                   Type.VOID,
                   new Type[] { Type.STRING },
                   Constants.INVOKESPECIAL));
  -        il.append(mFactory.createLoad(Type.OBJECT, variableIndex));
  +        il.append(m_factory.createLoad(Type.OBJECT, variableIndex));
           il.append(
  -            mFactory.createInvoke(
  +            m_factory.createInvoke(
                   "java.lang.Throwable",
                   "getMessage",
                   Type.STRING,
                   Type.NO_ARGS,
                   Constants.INVOKEVIRTUAL));
           il.append(
  -            mFactory.createInvoke(
  +            m_factory.createInvoke(
                   "java.lang.StringBuffer",
                   "append",
                   Type.STRINGBUFFER,
                   new Type[] { Type.STRING },
                   Constants.INVOKEVIRTUAL));
           il.append(
  -            mFactory.createInvoke(
  +            m_factory.createInvoke(
                   "java.lang.StringBuffer",
                   "toString",
                   Type.STRING,
                   Type.NO_ARGS,
                   Constants.INVOKEVIRTUAL));
           il.append(
  -            mFactory.createInvoke(
  +            m_factory.createInvoke(
                   "org.apache.excalibur.altrmi.common.AltrmiInvocationException",
                   "<init>",
                   Type.VOID,
  @@ -846,7 +850,7 @@
               new ObjectType("java.lang.Throwable"));
           method.setMaxStack();
           method.setMaxLocals();
  -        mClassGen.addMethod(method.getMethod());
  +        m_classGen.addMethod(method.getMethod());
           il.dispose();
       }
   
  @@ -856,19 +860,19 @@
        * @param ca
        * @return int
        */
  -    private int getFreeIndexToStart(Class[] ca)
  +    protected int getFreeIndexToStart(Class[] ca)
       {
  -        int _index = 0;
  +        int index = 0;
           for (int i = 0; i < ca.length; i++)
           {
               if (getBCELType(ca[i]) == Type.DOUBLE) //|| getBCELType(ca[i])==Type.LONG)
               {
  -                _index += 2;
  +                index += 2;
               }
  -            _index += 1;
  +            index += 1;
           }
   
  -        return _index;
  +        return index;
       }
       /**
        * Method getArguments.
  @@ -877,16 +881,16 @@
        * @param m
        * @return Type[]
        */
  -    private Type[] getArguments(Method m)
  +    protected Type[] getArguments(Method m)
       {
  -        Class[] _classes = m.getParameterTypes();
  -        if (_classes.length == 0)
  +        Class[] classes = m.getParameterTypes();
  +        if (classes.length == 0)
               return Type.NO_ARGS;
   
  -        Type[] types = new Type[_classes.length];
  -        for (int i = 0; i < _classes.length; i++)
  +        Type[] types = new Type[classes.length];
  +        for (int i = 0; i < classes.length; i++)
           {
  -            types[i] = getBCELType(_classes[i]);
  +            types[i] = getBCELType(classes[i]);
           }
           return types;
       }
  @@ -897,7 +901,7 @@
        * @param m
        * @return Type
        */
  -    private Type getReturnType(Method m)
  +    protected Type getReturnType(Method m)
       {
           return getBCELType(m.getReturnType());
       }
  @@ -908,15 +912,15 @@
        * @param m
        * @return String[]
        */
  -    private String[] getArgumentNames(Method m)
  +    protected String[] getArgumentNames(Method m)
       {
  -        Class[] _classes = m.getParameterTypes();
  -        String[] _args = new String[_classes.length];
  -        for (int i = 0; i < _classes.length; i++)
  +        Class[] classes = m.getParameterTypes();
  +        String[] args = new String[classes.length];
  +        for (int i = 0; i < classes.length; i++)
           {
  -            _args[i] = "arg" + i;
  +            args[i] = "arg" + i;
           }
  -        return _args;
  +        return args;
       }
   
       /**
  @@ -925,7 +929,7 @@
        * @param c
        * @return Type
        */
  -    private Type getBCELType(Class c)
  +    protected Type getBCELType(Class c)
       {
   
           if (c.isPrimitive())
  @@ -939,16 +943,16 @@
           else
           {
               String className = c.getName();
  -            int _index = className.lastIndexOf('[');
  -            int _arrayDepth = className.indexOf('[') - className.lastIndexOf('[') + 1;
  -            if (className.charAt(_index + 1) == 'L')
  +            int index = className.lastIndexOf('[');
  +            int arrayDepth = className.indexOf('[') - className.lastIndexOf('[') + 1;
  +            if (className.charAt(index + 1) == 'L')
               {
  -                return new ArrayType(new ObjectType(c.getComponentType().getName()), _arrayDepth);
  +                return new ArrayType(new ObjectType(c.getComponentType().getName()), arrayDepth);
               }
   
               return new ArrayType(
  -                getBCELPrimitiveType(className.substring(_arrayDepth)),
  -                _arrayDepth);
  +                getBCELPrimitiveType(className.substring(arrayDepth)),
  +                arrayDepth);
           }
   
       }
  @@ -959,16 +963,20 @@
        * @param javaDataType
        * @return Type
        */
  -    private Type getBCELPrimitiveType(String javaDataType)
  +    protected Type getBCELPrimitiveType(String javaDataType)
       {
           switch (javaDataType.charAt(0))
           {
   
               case 'b' :
                   if (javaDataType.toString().charAt(1) == 'o')
  +                {
                       return Type.BOOLEAN;
  +                }
                   else
  +                {
                       return Type.BYTE;
  +                }
               case 'c' :
               case 'C' :
                   return Type.CHAR;
  @@ -1006,7 +1014,7 @@
        * @param javaDataType
        * @return String
        */
  -    private String getJavaWrapperClass(String javaDataType)
  +    protected String getJavaWrapperClass(String javaDataType)
       {
           switch (javaDataType.charAt(0))
           {
  @@ -1042,42 +1050,41 @@
               case 'V' :
                   return "java.lang.Void";
               case '[' :
  -                mArrayDepth_++;
                   return getJavaWrapperClass(javaDataType.substring(1));
   
           }
           return null; //never occurs;
       }
   
  -    private void addField(String _encodedFieldName)
  +    protected void addField(String encodedFieldName)
       {
  -        if (!mInternalFieldRepresentingClasses.contains(_encodedFieldName))
  +        if (!m_internalFieldRepresentingClasses.contains(encodedFieldName))
           {
               //System.out.println("method."+method.getName()+".addingfield[" + _encodedFieldName + "]");
               FieldGen field =
                   new FieldGen(
                       Constants.ACC_STATIC,
                       new ObjectType("java.lang.Class"),
  -                    _encodedFieldName,
  -                    mConstantsPool);
  -            mClassGen.addField(field.getField());
  -            mInternalFieldRepresentingClasses.add(_encodedFieldName);
  +                    encodedFieldName,
  +                    m_constantsPool);
  +            m_classGen.addField(field.getField());
  +            m_internalFieldRepresentingClasses.add(encodedFieldName);
           }
   
       }
       
       //++++++++++++++++++testing
  -    private void createTestMethod(InstructionList il, String msg)
  +    protected void createTestMethod(InstructionList il, String msg)
       {
           il.append(
  -            mFactory.createFieldAccess(
  +            m_factory.createFieldAccess(
                   "java.lang.System",
                   "out",
                   new ObjectType("java.io.PrintStream"),
                   Constants.GETSTATIC));
  -        il.append(new PUSH(mConstantsPool, msg));
  +        il.append(new PUSH(m_constantsPool, msg));
           il.append(
  -            mFactory.createInvoke(
  +            m_factory.createInvoke(
                   "java.io.PrintStream",
                   "println",
                   Type.VOID,
  @@ -1085,7 +1092,7 @@
                   Constants.INVOKEVIRTUAL));
       }
   
  -    private void debug(String prefix, Object[] a)
  +    protected void debug(String prefix, Object[] a)
       {
           System.out.print(prefix);
           for (int i = 0; i < a.length; i++)
  @@ -1103,14 +1110,14 @@
        *     This get the Class definition from the bytes
        * @return Class
        */
  -    private Class getAltrmiClass(String className)
  +    protected Class getAltrmiClass(String className)
       {
   
           /*
           FromJavaClassClassLoader fromJavaClassClassLoader =
               new FromJavaClassClassLoader();
           Class clazz =
  -            fromJavaClassClassLoader.getClassFromJavaClass(mClassGen.getJavaClass());
  +            fromJavaClassClassLoader.getClassFromJavaClass(m_classGen.getJavaClass());
           */
           Class clazz = null;
   
  @@ -1119,7 +1126,7 @@
               URLClassLoader urlCL =
                   new URLClassLoader(
                       new URL[] {
  -                         new URL("file:/" + new File(mClassGenDir).getCanonicalPath() + "/")},
  +                         new URL("file:/" + new File(getClassGenDir()).getCanonicalPath() + "/")},
               //
               this.getClass().getClassLoader());
               clazz = urlCL.loadClass(className);
  
  
  
  1.10      +33 -162   jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/generator/ProxyGeneratorImpl.java
  
  Index: ProxyGeneratorImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/generator/ProxyGeneratorImpl.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ProxyGeneratorImpl.java	23 May 2002 21:37:21 -0000	1.9
  +++ ProxyGeneratorImpl.java	14 Jul 2002 23:12:44 -0000	1.10
  @@ -14,9 +14,7 @@
   import java.io.Serializable;
   import java.lang.reflect.Method;
   import java.util.Vector;
  -import org.apache.excalibur.altrmi.common.AbstractMethodHandler;
   import org.apache.excalibur.altrmi.common.ProxyGenerationException;
  -import org.apache.excalibur.altrmi.common.ProxyGenerator;
   import org.apache.excalibur.altrmi.javacompiler.JavaCompiler;
   
   /**
  @@ -28,102 +26,12 @@
    * @author <a href="mailto:proyal@apache.org">Peter Royal</a>
    * @version $Revision$
    */
  -public class ProxyGeneratorImpl extends AbstractMethodHandler implements ProxyGenerator
  +public class ProxyGeneratorImpl extends AbstractProxyGenerator
   {
   
  -    protected Class[] mInterfacesToExpose;
  -    protected Class[] mAdditionalFacades;
  -    protected String mSrcGenDir;
  -    protected String mClassGenDir;
  -    protected String mClasspath;
  -    protected String mGenName;
  -    protected boolean mVerbose;
  -    protected PrintWriter mClassSource;
  -
  -    /**
  -     * Method setInterfacesToExpose
  -     *
  -     *
  -     * @param interfacesToExpose
  -     *
  -     */
  -    public void setInterfacesToExpose( Class[] interfacesToExpose )
  -    {
  -        mInterfacesToExpose = interfacesToExpose;
  -    }
  -
  -    /**
  -     * Method setInterfacesToExpose
  -     *
  -     *
  -     *
  -     * @param additionalFacades
  -     *
  -     */
  -    public void setAdditionalFacades( Class[] additionalFacades )
  -    {
  -        mAdditionalFacades = additionalFacades;
  -    }
  -
  -    /**
  -     * Method setSrcGenDir
  -     *
  -     *
  -     * @param srcGenDir
  -     *
  -     */
  -    public void setSrcGenDir( String srcGenDir )
  -    {
  -        mSrcGenDir = srcGenDir;
  -    }
   
  -    /**
  -     * Method setClasspath
  -     *
  -     *
  -     * @param classpath
  -     *
  -     */
  -    public void setClasspath( String classpath )
  -    {
  -        mClasspath = classpath;
  -    }
  -
  -    /**
  -     * Method setClassGenDir
  -     *
  -     *
  -     * @param classGenDir
  -     *
  -     */
  -    public void setClassGenDir( String classGenDir )
  -    {
  -        mClassGenDir = classGenDir;
  -    }
  +    protected PrintWriter mClassSource;
   
  -    /**
  -     * Method setGenName
  -     *
  -     *
  -     * @param genName
  -     *
  -     */
  -    public void setGenName( String genName )
  -    {
  -        this.mGenName = genName;
  -    }
  -
  -    /**
  -     * Method verbose
  -     *
  -     *
  -     * @param trueFalse
  -     *
  -     */
  -    public void verbose( boolean trueFalse )
  -    {
  -        mVerbose = trueFalse;
  -    }
   
       /**
        * Method generate
  @@ -136,14 +44,14 @@
       {
   
           // The lookupable service class source.
  -        makeSource( cL, "Main", mInterfacesToExpose );
  -        makeSource2( cL, "Main", mInterfacesToExpose );
  +        makeSource( cL, "Main", getInterfacesToExpose() );
  +        makeSource2( cL, "Main", getInterfacesToExpose() );
   
  -        if( mAdditionalFacades != null )
  +        if( getAdditionalFacades() != null )
           {
  -            for( int i = 0; i < mAdditionalFacades.length; i++ )
  +            for( int i = 0; i < getAdditionalFacades().length; i++ )
               {
  -                Class facade = mAdditionalFacades[ i ];
  +                Class facade = getAdditionalFacades()[ i ];
   
                   makeSource( cL, encodeClassName( facade ), new Class[]{facade} );
                   makeSource2( cL, encodeClassName( facade ), new Class[]{facade} );
  @@ -155,33 +63,33 @@
        * Method generateClass
        *
        *
  -     * @param cL
  +     * @param classLoader
        *
        */
  -    public void generateClass( ClassLoader cL )
  +    public void generateClass( ClassLoader classLoader )
       {
   
           JavaCompiler jc = JavaCompiler.getDefaultCompiler();
   
  -        jc.setOutputDir( mClassGenDir );
  +        jc.setOutputDir( getClassGenDir() );
   
           //jc.setCompilerPath();
  -        jc.addClassPath( mClassGenDir );
  -        jc.addClassPath( mClasspath );
  +        jc.addClassPath( getClassGenDir() );
  +        jc.addClassPath( getClasspath() );
           jc.addDefaultClassPath();
  -        jc.doCompile( mSrcGenDir + File.separator + "AltrmiGenerated" + mGenName + "_Main.java" );
  -        jc.doCompile( mSrcGenDir + File.separator + "AltrmiGenerated2" + mGenName + "_Main.java" );
  +        jc.doCompile( getSrcGenDir() + File.separator + "AltrmiGenerated" + getGenName() + "_Main.java" );
  +        jc.doCompile( getSrcGenDir() + File.separator + "AltrmiGenerated2" + getGenName() + "_Main.java" );
           System.out.println( jc.getCompilerMessage() );
   
  -        if( mAdditionalFacades != null )
  +        if( getAdditionalFacades() != null )
           {
  -            for( int i = 0; i < mAdditionalFacades.length; i++ )
  +            for( int i = 0; i < getAdditionalFacades().length; i++ )
               {
  -                String classname = encodeClassName( mAdditionalFacades[ i ] );
  +                String classname = encodeClassName( getAdditionalFacades()[ i ] );
   
  -                jc.doCompile( mSrcGenDir + File.separator + "AltrmiGenerated" + mGenName + "_"
  +                jc.doCompile( getSrcGenDir() + File.separator + "AltrmiGenerated" + getGenName() + "_"
                                 + classname + ".java" );
  -                jc.doCompile( mSrcGenDir + File.separator + "AltrmiGenerated2" + mGenName + "_"
  +                jc.doCompile( getSrcGenDir() + File.separator + "AltrmiGenerated2" + getGenName() + "_"
                                 + classname + ".java" );
               }
           }
  @@ -197,10 +105,10 @@
   
           JavaCompiler jc = JavaCompiler.getDefaultCompiler();
   
  -        jc.setOutputDir( mClassGenDir );
  -        jc.setCompilerPath( mSrcGenDir );
  -        jc.addClassPath( mClassGenDir );
  -        jc.addClassPath( mClasspath );
  +        jc.setOutputDir( getClassGenDir() );
  +        jc.setCompilerPath( getSrcGenDir() );
  +        jc.addClassPath( getClassGenDir() );
  +        jc.addClassPath( getClasspath() );
           jc.addDefaultClassPath();
           jc.doCompile( "*.java" );
           System.out.println( jc.getCompilerMessage() );
  @@ -223,7 +131,7 @@
   
           // methdos could be in more than one interface.
           Vector methodsDone = new Vector();
  -        String filename = mSrcGenDir + File.separator + "AltrmiGenerated" + mGenName + "_" + name
  +        String filename = getSrcGenDir() + File.separator + "AltrmiGenerated" + getGenName() + "_" + name
               + ".java";
   
           try
  @@ -236,14 +144,14 @@
                                                   + "'" );
           }
   
  -        mClassSource.print( "public class AltrmiGenerated" + mGenName + "_" + name );
  +        mClassSource.print( "public class AltrmiGenerated" + getGenName() + "_" + name );
           mClassSource.println( " implements org.apache.excalibur.altrmi.client.AltrmiProxy{ " );
           mClassSource.println(
               "  private transient org.apache.excalibur.altrmi.client.ProxyHelper mProxyHelper;" );
   
           // Generate Constructor
           mClassSource.println(
  -            "  public AltrmiGenerated" + mGenName + "_" + name
  +            "  public AltrmiGenerated" + getGenName() + "_" + name
               + " (org.apache.excalibur.altrmi.client.ProxyHelper proxyHelper) {" );
           mClassSource.println( "      mProxyHelper = proxyHelper;" );
           mClassSource.println( "  }" );
  @@ -261,7 +169,7 @@
           {
               Class clazz = interfacesToExpose[ x ];
   
  -            if( mVerbose )
  +            if( isVerbose() )
               {
                   System.out.println( "ProxyGen: Processing interface: " + clazz.getName() );
               }
  @@ -273,7 +181,7 @@
                   Method method = methods[ y ];
                   String methodSignature = getMethodSignature( method );
   
  -                if( mVerbose )
  +                if( isVerbose() )
                   {
                       System.out.println( "ProxyGen:   Processing method: " + methodSignature );
                   }
  @@ -346,11 +254,9 @@
                           if( isFacadeRetVal )
                           {
                               Class retClassType = rClass;
  -                            boolean isArray = false;
                               if( rClass.isArray() )
                               {
                                   retClassType = rClass.getComponentType();
  -                                isArray = true;
                               }
   
                               mClassSource.println(
  @@ -413,20 +319,20 @@
           throws ProxyGenerationException
       {
   
  -        String filename = mSrcGenDir + File.separator + "AltrmiGenerated2" + mGenName + "_"
  +        String filename = getSrcGenDir() + File.separator + "AltrmiGenerated2" + getGenName() + "_"
               + name + ".java";
   
           try
           {
               PrintWriter class2Source = new PrintWriter( new FileOutputStream( filename ) );
   
  -            class2Source.print( "public final class AltrmiGenerated2" + mGenName + "_" + name );
  -            class2Source.print( " extends AltrmiGenerated" + mGenName + "_" + name );
  +            class2Source.print( "public final class AltrmiGenerated2" + getGenName() + "_" + name );
  +            class2Source.print( " extends AltrmiGenerated" + getGenName() + "_" + name );
               class2Source.print( " implements " );
               generateInterfaceList( class2Source, interfacesToExpose );
               class2Source.println( " { " );
               class2Source.println(
  -                "  public AltrmiGenerated2" + mGenName + "_" + name
  +                "  public AltrmiGenerated2" + getGenName() + "_" + name
                   + " (org.apache.excalibur.altrmi.client.ProxyHelper proxyHelper) {" );
               class2Source.println( "      super(proxyHelper);" );
               class2Source.println( "  }" );
  @@ -639,20 +545,7 @@
           }
       }
   
  -    protected String getClassType( Class rClass )
  -    {
   
  -        String cn = rClass.getName();
  -
  -        if( rClass.getName().startsWith( "[L" ) )
  -        {
  -            return cn.substring( 2, cn.length() - 1 ) + "[]";
  -        }
  -        else
  -        {
  -            return cn;
  -        }
  -    }
   
       private String generateReturnValue( Class rClass )
       {
  @@ -701,26 +594,4 @@
           }
       }
   
  -    protected boolean isAdditionalFacade( Class clazz )
  -    {
  -
  -        if( mAdditionalFacades == null )
  -        {
  -            return false;
  -        }
  -
  -        for( int p = 0; p < mAdditionalFacades.length; p++ )
  -        {
  -            if( clazz.getName().equals( mAdditionalFacades[ p ].getName() ) )
  -            {
  -                return true;
  -            }
  -            else if( clazz.getName().equals( "[L" + mAdditionalFacades[ p ].getName() + ";" ) )
  -            {
  -                return true;
  -            }
  -        }
  -
  -        return false;
  -    }
   }
  
  
  
  1.1                  jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/generator/AbstractProxyGenerator.java
  
  Index: AbstractProxyGenerator.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.excalibur.altrmi.generator;
  
  import org.apache.excalibur.altrmi.common.AbstractMethodHandler;
  import org.apache.excalibur.altrmi.common.ProxyGenerator;
  import org.apache.excalibur.altrmi.common.ProxyGenerationException;
  
  
  /**
   * Abstract parent for Proxy Generators
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $*
   *
   */
  
  public abstract class AbstractProxyGenerator extends AbstractMethodHandler
    implements ProxyGenerator
  {
  
      private String m_classGenDir;
      private String m_genName;
      private String m_srcGenDir;
      private String m_classpath;
      private boolean m_verbose;
      private Class[] m_additionalFacades;
      private Class[] m_interfacesToExpose;
  
      /**
       * Get the directory name of the class generation directory.
       *
       * @return the dir name.
       */
      public String getClassGenDir()
      {
          return m_classGenDir;
      }
  
      /**
       * Get the generation name of the class
       *
       * @return the name.
       */
  
      public String getGenName()
      {
          return m_genName;
      }
  
      /**
       * Get the source directory name
       *
       * @return the dir name.
       */
  
      public String getSrcGenDir()
      {
          return m_srcGenDir;
      }
  
  
      /**
       * Get the classpath used during creation
       *
       * @return classpath
       */
  
      public String getClasspath()
      {
          return m_classpath;
      }
  
      /**
       * Is verbose debugging level
       *
       * @return verbose or not
       */
      public boolean isVerbose()
      {
          return m_verbose;
      }
  
      /**
       * Get the additional facades
       *
       * @return the additional facades
       */
      public Class[] getAdditionalFacades()
      {
          return m_additionalFacades;
      }
  
      /**
       * Get the interfaces to expose.
       *
       * @return the interfaces
       */
      public Class[] getInterfacesToExpose()
      {
          return m_interfacesToExpose;
      }
  
      /**
       * Set the verbose logging level for class generation.
       *
       *
       * @param trueFalse set the verbose level
       *
       */
      public void verbose( boolean trueFalse )
      {
          m_verbose = trueFalse;
      }
  
  
      /**
        * Set the interfaces to expose.
        *
        *
        * @param interfacesToExpose the interfaces.
        *
        */
       public void setInterfacesToExpose( Class[] interfacesToExpose )
       {
           m_interfacesToExpose = interfacesToExpose;
       }
  
  
      /**
       * Set the additional facades
       *
       *
       *
       * @param additionalFacades the facades.
       *
       */
      public void setAdditionalFacades( Class[] additionalFacades )
      {
          m_additionalFacades = additionalFacades;
      }
  
      /**
       * Set the clas generation dorectory
       *
       *
       * @param classGenDir the dir.
       *
       */
      public void setClassGenDir( String classGenDir )
      {
          m_classGenDir = classGenDir;
      }
  
      /**
       * Set the generation name
       *
       *
       * @param genName the name
       *
       */
      public void setGenName( String genName )
      {
          this.m_genName = genName;
      }
  
      /**
       * Set the source generation directory.
       *
       *
       * @param srcGenDir the dir name.
       *
       */
      public void setSrcGenDir( String srcGenDir )
      {
          m_srcGenDir = srcGenDir;
      }
  
      /**
       * Set the classpath to generate with
       *
       *
       * @param classpath the classpath.
       *
       */
      public void setClasspath( String classpath )
      {
          m_classpath = classpath;
      }
  
      /**
       * Is the param one of the additional facades?
       *
       *
       * @param clazz the class
       *
       */
      protected boolean isAdditionalFacade( Class clazz )
      {
  
          if( m_additionalFacades == null )
          {
              return false;
          }
  
          for( int p = 0; p < m_additionalFacades.length; p++ )
          {
              if( clazz.getName().equals( m_additionalFacades[ p ].getName() ) )
              {
                  return true;
              }
              else if( clazz.getName().equals( "[L" + m_additionalFacades[ p ].getName() + ";" ) )
              {
                  return true;
              }
          }
  
          return false;
      }
  
      protected String getClassType( Class rClass )
      {
  
          String cn = rClass.getName();
  
          if( rClass.getName().startsWith( "[L" ) )
          {
              return cn.substring( 2, cn.length() - 1 ) + "[]";
          }
          else
          {
              return cn;
          }
      }
  
      /**
       * Method generateSrc
       *
       *
       * @param classLoader
       *
       */
      public void generateSrc( ClassLoader classLoader ) throws ProxyGenerationException
      {
          // default impl
      }
  
      /**
       * Method generateDeferredClasses
       *
       *
       */
      public void generateDeferredClasses()
      {
          // default impl
      }
  
  }
  
  
  
  1.3       +4 -4      jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/classretrievers/AbstractClassRetriever.java
  
  Index: AbstractClassRetriever.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/classretrievers/AbstractClassRetriever.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractClassRetriever.java	24 Apr 2002 12:43:02 -0000	1.2
  +++ AbstractClassRetriever.java	14 Jul 2002 23:12:44 -0000	1.3
  @@ -23,11 +23,11 @@
   public abstract class AbstractClassRetriever implements ClassRetriever
   {
   
  -    private ClassLoader mClassLoader;
  +    private ClassLoader m_classLoader;
   
       protected void setClassLoader( ClassLoader classLoader )
       {
  -        mClassLoader = classLoader;
  +        m_classLoader = classLoader;
       }
   
       /**
  @@ -72,7 +72,7 @@
   
           try
           {
  -            is = mClassLoader.getResourceAsStream( thingName );
  +            is = m_classLoader.getResourceAsStream( thingName );
           }
           catch( Exception e )
           {
  
  
  
  1.4       +18 -9     jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/classretrievers/PlainClassRetriever.java
  
  Index: PlainClassRetriever.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/classretrievers/PlainClassRetriever.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PlainClassRetriever.java	24 Apr 2002 12:43:02 -0000	1.3
  +++ PlainClassRetriever.java	14 Jul 2002 23:12:44 -0000	1.4
  @@ -17,13 +17,14 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @author Vinay Chandrasekharan <a href="mailto:vinay_chandran@users.sourceforge.net">vinay_chandran@users.sourceforge.net</a>
  + * @author Vinay Chandrasekharan <a href="mailto:vinay_chandran@users.sourceforge.net">
  + * vinay_chandran@users.sourceforge.net</a>
    * @version $Revision$
    */
   public class PlainClassRetriever extends AbstractClassRetriever
   {
   
  -    private ClassLoader mClassLoader;
  +    private ClassLoader m_classLoader;
   
       /**
        * Constructor PlainClassRetriever
  @@ -32,27 +33,35 @@
        */
       public PlainClassRetriever()
       {
  -        mClassLoader = this.getClass().getClassLoader();
  +        m_classLoader = this.getClass().getClassLoader();
       }
   
       /**
  -     * Constructor PlainClassRetriever
  +     * Create a plain clasretriever from a classloader.
        *
        *
  -     * @param cl
  +     * @param classLoader the classloader.
        *
        */
  -    public PlainClassRetriever( ClassLoader cl )
  +    public PlainClassRetriever( ClassLoader classLoader )
       {
  -        mClassLoader = cl;
  +        m_classLoader = classLoader;
       }
   
  +    /**
  +     *
  +     * Get the classfile byte array for the thing name
  +     *
  +     * @param thingName the things name
  +     * @return the byte array of the thing.
  +     * @throws ClassRetrievalException if the bytes are not available.
  +     */
       protected byte[] getThingBytes( String thingName ) throws ClassRetrievalException
       {
   
           InputStream is = null;
   
  -        is = mClassLoader.getResourceAsStream( thingName + ".class" );
  +        is = m_classLoader.getResourceAsStream( thingName + ".class" );
   
           if( is == null )
           {
  
  
  
  1.1                  jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/classretrievers/AbstractDynamicGeneratorClassRetriever.java
  
  Index: AbstractDynamicGeneratorClassRetriever.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.excalibur.altrmi.server.impl.classretrievers;
  
  import java.io.ByteArrayOutputStream;
  import java.io.File;
  import java.io.FileInputStream;
  import java.io.IOException;
  import java.net.URL;
  import org.apache.excalibur.altrmi.common.ProxyGenerator;
  import org.apache.excalibur.altrmi.server.AltrmiProxyGenerator;
  import org.apache.excalibur.altrmi.server.ClassRetrievalException;
  import org.apache.excalibur.altrmi.server.ClassRetriever;
  import org.apache.excalibur.altrmi.server.ProxyGenerationEnvironmentException;
  import org.apache.excalibur.altrmi.server.PublicationDescription;
  import org.apache.excalibur.altrmi.server.PublicationException;
  
  /**
   * Class JarFileClassRetriever
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class AbstractDynamicGeneratorClassRetriever implements AltrmiProxyGenerator, ClassRetriever
  {
  
      private String m_altrmiClasspath;
      private String m_classGenDir;
      private String m_srcGenDir;
      private URL m_genJarURL;
      private Class m_generatorClass ;
  
      /**
       * Constructor AbstractDynamicGeneratorClassRetriever
       *
       *
       */
      public AbstractDynamicGeneratorClassRetriever( URL genJarURL, Class generatorClass)
      {
          m_genJarURL = genJarURL;
          m_generatorClass = generatorClass;
      }
  
      /**
       * Method generate
       *
       *
       * @param asName
       * @param interfaceToExpose
       * @param classLoader
       *
       */
      public void generate( String asName, Class interfaceToExpose, ClassLoader classLoader )
          throws PublicationException
      {
          generateProxy( asName, new PublicationDescription( interfaceToExpose ), classLoader, false );
      }
  
      /**
       * Method generate
       *
       *
       * @param asName
       * @param publicationDescription
       * @param classLoader
       *
       * @throws PublicationException
       *
       */
      public void generate(
          String asName, PublicationDescription publicationDescription, ClassLoader classLoader )
          throws PublicationException
      {
          generateProxy( asName, publicationDescription, classLoader, false );
      }
  
      /**
       * Method deferredGenerate
       *
       *
       * @param asName
       * @param publicationDescription
       * @param classLoader
       *
       * @throws PublicationException
       *
       */
      public void deferredGenerate(
          String asName, PublicationDescription publicationDescription, ClassLoader classLoader )
          throws PublicationException
      {
          generateProxy( asName, publicationDescription, classLoader, true );
      }
  
      /**
       * Method setAltrmiClasspath
       *
       *
       * @param altrmiClasspath
       *
       */
      public void setAltrmiClasspath( String altrmiClasspath )
      {
          m_altrmiClasspath = altrmiClasspath;
      }
  
      /**
       * Method addToAltrmiClasspath
       *
       *
       * @param classpathElement
       *
       */
      public void addToAltrmiClasspath( String classpathElement )
      {
          m_altrmiClasspath = m_altrmiClasspath + File.pathSeparator + classpathElement;
      }
  
      /**
       * Method setClassGenDir
       *
       *
       * @param classGenDir
       *
       */
      public void setClassGenDir( String classGenDir )
      {
          m_classGenDir = classGenDir;
      }
  
      /**
       * Method getBeanBytes
       *
       *
       * @param publishedName
       *
       * @return
       *
       * @throws ClassRetrievalException
       *
       */
      public final byte[] getBeanBytes( String publishedName ) throws ClassRetrievalException
      {
          return getThingBytes( "AltrmiGenerated" + publishedName );
      }
  
      /**
       * Method getInterfaceImplementationBytes
       *
       *
       * @param publishedName
       *
       * @return
       *
       * @throws ClassRetrievalException
       *
       */
      public final byte[] getInterfaceImplementationBytes( String publishedName )
          throws ClassRetrievalException
      {
          return getThingBytes( "AltrmiGenerated2" + publishedName );
      }
  
      protected byte[] getThingBytes( String thingName ) throws ClassRetrievalException
      {
  
          thingName = thingName.replace( '.', '\\' ) + ".class";
  
          FileInputStream fis;
  
          try
          {
              fis = new FileInputStream( new File( m_classGenDir, thingName ) );
          }
          catch( Exception e )
          {
              e.printStackTrace();
  
              throw new ClassRetrievalException(
                  "Generated class not found in classloader specified : " + e.getMessage() );
          }
  
          if( fis == null )
          {
              throw new ClassRetrievalException(
                  "Generated class not found in classloader specified." );
          }
  
          ByteArrayOutputStream baos = new ByteArrayOutputStream();
          int i = 0;
  
          try
          {
              while( -1 != ( i = fis.read() ) )
              {
                  baos.write( i );
              }
  
              fis.close();
          }
          catch( IOException e )
          {
              e.printStackTrace();
  
              throw new ClassRetrievalException( "Error retrieving generated class bytes : "
                                                 + e.getMessage() );
          }
  
          byte[] bytes = baos.toByteArray();
  
          return bytes;
      }
  
      /**
       * Method setSrcGenDir
       *
       *
       * @param srcGenDir
       *
       */
      public void setSrcGenDir( String srcGenDir )
      {
          m_srcGenDir = srcGenDir;
      }
  
      private void generateProxy(
          String asName, PublicationDescription publicationDescription, ClassLoader classLoader, boolean deferred )
          throws PublicationException
      {
  
          if( classLoader == null )
          {
              classLoader = this.getClass().getClassLoader();
          }
  
          Class[] interfacesToExpose = new Class[ 0 ];
          Class[] addInfs = new Class[ 0 ];
  
          interfacesToExpose = publicationDescription.getInterfacesToExpose();
          addInfs = publicationDescription.getAdditionalFacades();
  
          ProxyGenerator proxyGenerator;
  
          try
          {
              proxyGenerator = (ProxyGenerator) m_generatorClass.newInstance();
          }
          catch (InstantiationException e)
          {
              throw new RuntimeException( "ProxyGenerator cannot be instantiated." );
          }
          catch (IllegalAccessException e)
          {
              throw new RuntimeException( "ProxyGenerator was illegally accessed" );
          }
  
          proxyGenerator.setSrcGenDir( m_srcGenDir );
          proxyGenerator.setClassGenDir( m_classGenDir );
          proxyGenerator.setGenName( asName );
          proxyGenerator.setClasspath( m_altrmiClasspath );
          proxyGenerator.setInterfacesToExpose( interfacesToExpose );
          proxyGenerator.setAdditionalFacades( addInfs );
  
          //ClassLoader cL = this.getClass().getClassLoader();
          try
          {
              proxyGenerator.generateSrc( classLoader );
          }
          catch( Throwable t )
          {
              System.out.println( "******" );
              System.out.println( "** Exception while making source : " );
              System.out.flush();
              t.printStackTrace();
              System.out.println( "** Name=" + asName );
              System.out.println( "** Classes/Interfaces to Expose.." );
  
              for( int i = 0; i < interfacesToExpose.length; i++ )
              {
                  String aString = interfacesToExpose[ i ].getName();
  
                  System.out.println( "** .." + aString );
              }
  
              System.out.println( "******" );
              System.out.flush();
          }
  
          if( !deferred )
          {
              try
              {
                  proxyGenerator.generateClass( classLoader );
              }
              catch( Throwable t )
              {
                  if( ( t instanceof NoClassDefFoundError )
                      && t.getMessage().equals( "sun/tools/javac/Main" ) )
                  {
                      System.out.println( "***************************************" );
                      System.out.println( "*                                     *" );
                      System.out.println( "* AltRMI problem......                *" );
                      System.out.println( "* Please copy JAVA_HOME/lib/tools.jar *" );
                      System.out.println( "* to your applications classpath so   *" );
                      System.out.println( "* that proxys can be compiled.        *" );
                      System.out.println( "*                                     *" );
                      System.out.println( "***************************************" );
  
                      throw new ProxyGenerationEnvironmentException(
                          "tools.jar not found in classpath." );
                  }
  
                  System.out.println( "******" );
                  System.out.println( "** Exception while making String : " );
                  System.out.flush();
                  t.printStackTrace();
                  System.out.println( "** SrcDir=" + m_srcGenDir );
                  System.out.println( "** ClassDir=" + m_classGenDir );
                  System.out.println( "** Name=" + asName );
                  System.out.println( "** CLasspath=" + m_altrmiClasspath );
                  System.out.println( "** Classes/Interfaces to Expose.." );
  
                  for( int i = 0; i < interfacesToExpose.length; i++ )
                  {
                      String aString = interfacesToExpose[ i ].getName();
  
                      System.out.println( "** .." + aString );
                  }
  
                  System.out.println( "******" );
                  System.out.flush();
              }
          }
      }
  
      /**
       * Method generateDeferred
       *
       *
       * @param classLoader
       *
       */
      public void generateDeferred( ClassLoader classLoader )
      {
  
          ProxyGenerator proxyGenerator;
  
          try
          {
              proxyGenerator = (ProxyGenerator) m_generatorClass.newInstance();
          }
          catch (InstantiationException e)
          {
              throw new RuntimeException( "ProxyGenerator cannot be instantiated." );
          }
          catch (IllegalAccessException e)
          {
              throw new RuntimeException( "ProxyGenerator was illegally accessed" );
          }
          proxyGenerator.generateDeferredClasses();
      }
  }
  
  
  
  1.1                  jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/classretrievers/BcelDynamicGeneratorClassRetriever.java
  
  Index: BcelDynamicGeneratorClassRetriever.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.excalibur.altrmi.server.impl.classretrievers;
  
  import org.apache.excalibur.altrmi.generator.BCELProxyGeneratorImpl;
  
  import java.net.URL;
  
  
  /**
   * Class BcelDynamicGeneratorClassRetriever
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class BcelDynamicGeneratorClassRetriever extends AbstractDynamicGeneratorClassRetriever
  {
      public BcelDynamicGeneratorClassRetriever(URL genJarURL)
      {
          super(genJarURL, BCELProxyGeneratorImpl.class);
      }
  }
  
  
  
  1.1                  jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/classretrievers/JavacDynamicGeneratorClassRetriever.java
  
  Index: JavacDynamicGeneratorClassRetriever.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.excalibur.altrmi.server.impl.classretrievers;
  
  import org.apache.excalibur.altrmi.generator.ProxyGeneratorImpl;
  
  import java.net.URL;
  
  
  /**
   * Class JavacDynamicGeneratorClassRetriever
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class JavacDynamicGeneratorClassRetriever extends AbstractDynamicGeneratorClassRetriever
  {
      public JavacDynamicGeneratorClassRetriever(URL genJarURL)
      {
          super(genJarURL, ProxyGeneratorImpl.class);
      }
  }
  
  
  
  1.4       +4 -6      jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/piped/PipedTest.java
  
  Index: PipedTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/piped/PipedTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PipedTest.java	14 Jul 2002 20:59:47 -0000	1.3
  +++ PipedTest.java	14 Jul 2002 23:12:44 -0000	1.4
  @@ -11,9 +11,7 @@
   import java.net.MalformedURLException;
   
   import org.apache.excalibur.altrmi.server.*;
  -import org.apache.excalibur.altrmi.server.impl.classretrievers.DynamicGeneratorClassRetriever;
  -import org.apache.excalibur.altrmi.server.impl.classretrievers.JarFileClassRetriever;
  -import org.apache.excalibur.altrmi.server.impl.classretrievers.NoClassRetriever;
  +import org.apache.excalibur.altrmi.server.impl.classretrievers.*;
   import org.apache.excalibur.altrmi.server.impl.piped.AbstractPipedServer;
   import org.apache.excalibur.altrmi.server.impl.piped.PipedObjectStreamServer;
   import org.apache.excalibur.altrmi.test.TestInterface;
  @@ -43,8 +41,8 @@
           }
           else if( serverOrClientFactory.equals( "D" ) )
           {
  -            DynamicGeneratorClassRetriever dr =
  -                new DynamicGeneratorClassRetriever( new File( "build" + File.separator
  +            AbstractDynamicGeneratorClassRetriever dr =
  +                new BcelDynamicGeneratorClassRetriever( new File( "build" + File.separator
                                                                 + "classes" ).toURL() );
               File source = new File( "testSource" );
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message