geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r159005 [2/9] - in geronimo/trunk/modules: assembly/src/plan/ interop/ interop/src/idl/ interop/src/java/org/apache/geronimo/interop/ interop/src/java/org/apache/geronimo/interop/CosNaming/iiop_stubs/ interop/src/java/org/apache/geronimo/interop/adapter/ interop/src/java/org/apache/geronimo/interop/client/ interop/src/java/org/apache/geronimo/interop/generator/ interop/src/java/org/apache/geronimo/interop/naming/ interop/src/java/org/apache/geronimo/interop/properties/ interop/src/java/org/apache/geronimo/interop/repository/ interop/src/java/org/apache/geronimo/interop/rmi/iiop/ interop/src/java/org/apache/geronimo/interop/rmi/iiop/client/ interop/src/java/org/apache/geronimo/interop/rmi/iiop/compiler/ interop/src/java/org/apache/geronimo/interop/rmi/iiop/server/ interop/src/java/org/apache/geronimo/interop/server/ interop/src/java/org/apache/geronimo/interop/util/
Date Fri, 25 Mar 2005 11:54:52 GMT
Added: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/adapter/HomeAdapter.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/adapter/HomeAdapter.java?view=auto&rev=159005
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/adapter/HomeAdapter.java (added)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/adapter/HomeAdapter.java Fri Mar 25 03:54:30 2005
@@ -0,0 +1,355 @@
+/**
+ *
+ *  Copyright 2004-2005 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.interop.adapter;
+
+import java.util.HashMap;
+import java.util.Vector;
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Constructor;
+
+import org.apache.geronimo.interop.rmi.iiop.RemoteInterface;
+import org.apache.geronimo.interop.rmi.iiop.ObjectRef;
+import org.apache.geronimo.interop.naming.NameService;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.openejb.EJBContainer;
+import org.openejb.proxy.ProxyInfo;
+
+public class HomeAdapter extends Adapter {
+
+    private final Log log = LogFactory.getLog(HomeAdapter.class);
+    private NameService     nameService = NameService.getInstance();
+
+    private RemoteInterface homeRemoteInterface = null;
+    private String[]        bindNames;
+    private ObjectRef       objectRef;
+
+    private EJBContainer    ejbContainer;
+    private ProxyInfo       proxyInfo;
+
+    public HomeAdapter( EJBContainer container ) {
+        this.ejbContainer = container;
+        //proxyInfo = ejbContainer.getProxyInfo();
+
+        //homeClass = proxyInfo.getHomeInterface();
+        //remoteClass = proxyInfo.getRemoteInterface();
+
+        //classLoader = ejbContainer.getClassLoader();
+
+        //objects = new HashMap();
+        //idVector = new Vector();
+
+        proxyInfo = ejbContainer.getProxyInfo();
+        Class homeInterfaceClass = proxyInfo.getHomeInterface();
+        String homeInterfaceClassName = homeInterfaceClass.getName();
+
+        /*
+         * BindNames contains all the jndi names from the ejbcontainer as well
+         * as the name of the class name for the interface.  This classname is used
+         * as part of the object key so that the server can determine which interface
+         * the client is invoking...
+         */
+        String containerBindNames[] = ejbContainer.getJndiNames();
+        bindNames = new String[ containerBindNames.length + 1 ];
+        bindNames[0] = homeInterfaceClassName;
+        System.arraycopy( containerBindNames, 0, bindNames, 1, containerBindNames.length );
+
+        /*
+         * HomeInterface objectrefs aren't going to change over the course of the
+         * ejb deployment...
+         */
+        objectRef = new ObjectRef();
+        objectRef.$setID( "RMI:" + homeInterfaceClassName + ":0000000000000000" );
+        objectRef.$setObjectKey( homeInterfaceClassName );
+
+        loadHomeRemoteInterface();
+
+        showContainer();
+    }
+
+    /*
+     * Used by the AdapterManager to keep track of all adapters....
+     */
+    public Object getAdapterID()
+    {
+        return ejbContainer.getContainerID();
+    }
+
+    public ObjectRef getObjectRef( )
+    {
+        return objectRef;
+    }
+
+    public Object getServant() {
+        return ejbContainer.getEJBHome();
+    }
+
+    public Object getEJBHome()
+    {
+        return ejbContainer.getEJBHome();
+    }
+
+    public EJBContainer getEJBContainer()
+    {
+        return ejbContainer;
+    }
+
+    /*
+     * BindName is the name that will be registered with the INS (Inter-operable Name Service)
+     * These are the names from the EJBContainer.
+     */
+    public String[] getBindNames() {
+        return bindNames;
+    }
+
+    /*
+     * The classloader that will load any dependancies of the adapter or corba skel interfaces.
+     * Its should be set by the ejb container
+     */
+//    public ClassLoader getClassLoader() {
+//        return _cl;
+//    }
+
+    /*
+     * This is the name of the remote class that implements the remote interface.
+     *
+     * This is only used if this adapter is going to directly invoke an object.  For the
+     * EJB Container, the adapter will pass through the method invocations.
+     */
+//    public Class getRemoteClass() {
+//        return remoteClass;
+//    }
+
+    /*
+     * The remote interface name for the remote object.  This will most likely be the name
+     * of the EJB's RemoteInterface and RemoteHomeInterface
+     *
+     * The stub/skel generator will use this interface name.
+     */
+//    public Class getHomeClass() {
+//        return homeClass;
+//    }
+
+    /*
+     * Return the skeleton implemention for the remote interface.  This interface has the
+     * invoke method to handle the rmi/iiop messages.
+     */
+    public RemoteInterface getRemoteInterface()
+    {
+        return homeRemoteInterface;
+    }
+
+//    public synchronized RemoteInterface getRemoteInterface() {
+//        if (ri == null) {
+//            String riName = remoteClass.getName() + "_Skeleton";
+//            remoteSkeletonClass = loadClass(riName);
+//
+//            try {
+//                ri = (RemoteInterface) remoteSkeletonClass.newInstance();
+//            } catch (InstantiationException e) {
+//                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+//            } catch (IllegalAccessException e) {
+//                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+//            }
+//        }
+//
+//        return ri;
+//    }
+
+    /*
+     * Get an object instance to invoke based on the object key.
+     *
+     * The objectKey could probably be passed to the EJB container so that the
+     * container can directly invoke the ejb object as required.
+     */
+//    public Object getInstance(byte[] objectKey) {
+//        String key = new String(objectKey);
+//        return getInstance(key);
+//    }
+//
+//    public Object getInstance(String key) {
+//        Object o = objects.get(key);
+//
+//        if (o == null) {
+//            o = newInstance(key);
+//        }
+//
+//        return o;
+//    }
+//
+//    public Object newInstance(byte[] objectKey) {
+//        String key = new String(objectKey);
+//        return newInstance(key);
+//    }
+//
+//    public Object newInstance(String key) {
+//        Object o = null;
+//
+//        try {
+//            o = remoteClassClass.newInstance();
+//            objects.put(key, o);
+//        } catch (InstantiationException e) {
+//            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+//        } catch (IllegalAccessException e) {
+//            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+//        }
+//
+//        return o;
+//    }
+
+    /*
+     * Invoke method from the IIOP Message Handler.  The adapter is bound to the INS name service.
+     * When an RMI/IIOP message is processed by the server, the message handler will perform a lookup
+     * on the name service to get the HomeAdapter, then the invocation will be passed to the adapter
+     * The adapter will obtain the object key and then determine which object instance to pass the
+     * invocation to.
+     */
+//    public void invoke(java.lang.String methodName, byte[] objectKey, org.apache.geronimo.interop.rmi.iiop.ObjectInputStream input, org.apache.geronimo.interop.rmi.iiop.ObjectOutputStream output) {
+//        RemoteInterface skeleton = getRemoteInterface();
+//        Object instance = getInstance(objectKey);
+//
+//        if (instance != null) {
+//            skeleton.$invoke(methodName, objectKey, instance, input, output);
+//        } else {
+//            throw new org.omg.CORBA.OBJECT_NOT_EXIST(new String(objectKey));
+//        }
+//    }
+
+    /*
+     * Helper function to load a class.  This uses classloader for the adapter.
+     */
+//    protected Class loadClass(String name) {
+//        Class c = null;
+//
+//        try {
+//            c = getClassLoader().loadClass(name);
+//        } catch (Exception e) {
+//            // TODO: Determine the appropriate way to propagate this error back to the caller/client.
+//            e.printStackTrace();
+//        }
+//
+//        return c;
+//    }
+
+    public void start()
+    {
+        log.info( "Starting HomeAdapter: " + ejbContainer.getEJBName() + " - " + getAdapterID() );
+        nameService.bindAdapter( this );
+    }
+
+    public void stop()
+    {
+        log.info( "Stopping HomeAdapter: " + ejbContainer.getEJBName() + " - " + getAdapterID() );
+        nameService.unbindAdapter( this );
+    }
+
+    /*
+     * Invoke method from the IIOP Message Handler.  The adapter is bound to the INS name service.
+     * When an RMI/IIOP message is processed by the server, the message handler will perform a lookup
+     * on the name service to get the HomeAdapter, then the invocation will be passed to the adapter
+     * The adapter will obtain the object key and then determine which object instance to pass the
+     * invocation to.
+     */
+    public void invoke(java.lang.String methodName, byte[] objectKey, org.apache.geronimo.interop.rmi.iiop.ObjectInputStream input, org.apache.geronimo.interop.rmi.iiop.ObjectOutputStream output) {
+        //RemoteInterface skeleton = getRemoteInterface();
+        //Object instance = getInstance(objectKey);
+
+        if (homeRemoteInterface != null) {
+            homeRemoteInterface.invoke(methodName, objectKey, this, input, output);
+        } else {
+            throw new org.omg.CORBA.OBJECT_NOT_EXIST(new String(objectKey));
+        }
+    }
+
+    protected void loadHomeRemoteInterface()
+    {
+        try
+        {
+            String name = ejbContainer.getProxyInfo().getHomeInterface().getName();
+            name += "_Skeleton";
+
+            Class hrmiClass = ejbContainer.getClassLoader().loadClass(name);
+            Constructor c = hrmiClass.getConstructor( new Class[] { EJBContainer.class } );
+
+            homeRemoteInterface = (RemoteInterface)c.newInstance( new Object[] { this } );
+        }
+        catch (ClassNotFoundException e)
+        {
+            e.printStackTrace();
+        }
+        catch (NoSuchMethodException e)
+        {
+            e.printStackTrace();
+        }
+        catch (IllegalAccessException e)
+        {
+            e.printStackTrace();
+        }
+        catch (InvocationTargetException e)
+        {
+            e.printStackTrace();
+        }
+        catch (InstantiationException e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+    protected void showContainer()
+    {
+        log.debug( "container.id = " + ejbContainer.getContainerID() );
+        log.debug( "container.ejbname = " + ejbContainer.getEJBName() );
+        log.debug( "container.ejbhome = " + ejbContainer.getEJBHome() );
+        //log.debug( "container.ejbprimarykey = " + ejbContainer.getEJBPrimaryKeyClass() );
+        //log.debug( "container.ejbobject = " + ejbContainer.getEJBObject(Object primaryKey) );
+        log.debug( "container.ejblocalhome = " + ejbContainer.getEJBLocalHome() );
+        //log.debug( "container.ejblocalobject = " + ejbContainer.getEJBLocalObject(Object primaryKey) );
+
+        int i;
+        for( i=0; i<ejbContainer.getJndiNames().length; i++ )
+        {
+            log.debug( "container.jndiName[" + i + "] = " + ejbContainer.getJndiNames()[i] );
+        }
+
+        for( i=0; i<ejbContainer.getLocalJndiNames().length; i++ )
+        {
+            log.debug( "container.localJndiName[" + i + "] = " + ejbContainer.getLocalJndiNames()[i] );
+        }
+
+        //log.debug( "container.proxyFactory = " + ejbContainer.getProxyFactory() );
+        log.debug( "container.classLoader = " + ejbContainer.getClassLoader() );
+        log.debug( "container.unmanagedReference = " + ejbContainer.getUnmanagedReference() );
+
+        for( i=0; i<ejbContainer.getSignatures().length; i++ )
+        {
+            log.debug( "container.interfaceMethodSignature[" + i + "] = " + ejbContainer.getSignatures()[i] );
+        }
+
+        ProxyInfo pi = ejbContainer.getProxyInfo();
+        log.debug( "container.proxyInfo.containerID = " + pi.getContainerID() );
+        log.debug( "container.proxyInfo.componentType = " + pi.getComponentType() );
+        log.debug( "container.proxyInfo.homeInterface = " + pi.getHomeInterface() );
+        log.debug( "container.proxyInfo.primaryKey = " + pi.getPrimaryKey() );
+        log.debug( "container.proxyInfo.primaryKeyClass = " + pi.getPrimaryKeyClass() );
+        log.debug( "container.proxyInfo.remoteInterface = " + pi.getRemoteInterface() );
+
+        log.debug( "container.subject = " + ejbContainer.getDefaultSubject() );
+    }
+
+}

Added: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/adapter/RemoteAdapter.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/adapter/RemoteAdapter.java?view=auto&rev=159005
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/adapter/RemoteAdapter.java (added)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/adapter/RemoteAdapter.java Fri Mar 25 03:54:30 2005
@@ -0,0 +1,87 @@
+/**
+ *
+ *  Copyright 2004-2005 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.interop.adapter;
+
+import org.apache.geronimo.interop.rmi.iiop.ObjectInputStream;
+import org.apache.geronimo.interop.rmi.iiop.ObjectOutputStream;
+import org.apache.geronimo.interop.rmi.iiop.ObjectRef;
+import org.openejb.EJBContainer;
+import org.openejb.client.ProxyFactory;
+import org.openejb.proxy.ProxyInfo;
+import org.openejb.proxy.EJBProxyFactory;
+
+import java.util.HashMap;
+import java.util.Vector;
+
+public class RemoteAdapter extends Adapter
+{
+    private EJBContainer        ejbContainer;
+    private ProxyInfo           proxyInfo;
+    private EJBProxyFactory     proxyFactory;
+
+    public RemoteAdapter( EJBContainer container ) {
+        this.ejbContainer = container;
+        proxyInfo = ejbContainer.getProxyInfo();
+        //proxyFactory = ejbContainer.getProxyFactory();
+    }
+
+    public Object getAdapterID()
+    {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public String[] getBindNames()
+    {
+        return new String[0];  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void start()
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void stop()
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public ObjectRef getObjectRef()
+    {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public Object getServant() {
+        // Stateless
+        return ejbContainer.getEJBObject( null );
+    }
+
+    public EJBContainer getEJBContainer()
+    {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public Object getEJBHome()
+    {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void invoke(String methodName, byte[] objectKey, ObjectInputStream input, ObjectOutputStream output)
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+}

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/client/InitialContextFactory.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/client/InitialContextFactory.java?view=diff&r1=159004&r2=159005
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/client/InitialContextFactory.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/client/InitialContextFactory.java Fri Mar 25 03:54:30 2005
@@ -21,10 +21,9 @@
 import javax.naming.Context;
 import javax.naming.NamingException;
 
-
 public class InitialContextFactory
         implements javax.naming.spi.InitialContextFactory {
-    private HashMap _startMap = new HashMap();
+    private HashMap     startMap = new HashMap();
 
     public Context getInitialContext(java.util.Hashtable env) throws NamingException {
         return org.apache.geronimo.interop.rmi.iiop.client.ClientNamingContext.getInstance(env);

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/CodeWriter.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/CodeWriter.java?view=diff&r1=159004&r2=159005
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/CodeWriter.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/CodeWriter.java Fri Mar 25 03:54:30 2005
@@ -19,43 +19,41 @@
 
 import java.io.File;
 
-
 public abstract class CodeWriter {
-    protected GenOptions _genOptions;
-
-    protected File _file;
+    private GenOptions  genOptions;    
+    private String      fileName;
+    private String      fileExt = ".java";
 
-    protected String _fileName;
-    protected String _fileExt = ".java";
+    protected File        file;
 
     public CodeWriter(GenOptions genOptions, String fileName, String ext) {
-        _genOptions = genOptions;
-        _fileName = fileName;
-        _fileExt = ext;
+        this.genOptions = genOptions;
+        this.fileName = fileName;
+        fileExt = ext;
     }
 
     public GenOptions getGenOptions() {
-        return _genOptions;
+        return genOptions;
     }
 
     public void setGenOptions(GenOptions genOptions) {
-        _genOptions = genOptions;
+        this.genOptions = genOptions;
     }
 
     public void setFileName(String val) {
-        _fileName = val;
+        fileName = val;
     }
 
     public String getFileName() {
-        return _fileName;
+        return fileName;
     }
 
     public void setFileExt(String val) {
-        _fileExt = val;
+        fileExt = val;
     }
 
     public String getFileExt() {
-        return _fileExt;
+        return fileExt;
     }
 
     public abstract void openFile() throws GenException;

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/GenException.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/GenException.java?view=diff&r1=159004&r2=159005
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/GenException.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/GenException.java Fri Mar 25 03:54:30 2005
@@ -17,12 +17,6 @@
  */
 package org.apache.geronimo.interop.generator;
 
-/**
- * User: Mark
- * Date: Dec 21, 2004
- * Time: 3:49:45 PM
- */
-
 public class GenException
         extends Exception {
     public GenException() {

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/GenOptions.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/GenOptions.java?view=diff&r1=159004&r2=159005
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/GenOptions.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/GenOptions.java Fri Mar 25 03:54:30 2005
@@ -17,42 +17,134 @@
  */
 package org.apache.geronimo.interop.generator;
 
-public class GenOptions {
-    protected String _genDir = "./";
-    protected boolean _overwrite = false;
-    protected boolean _verbose = false;
+import org.apache.geronimo.interop.rmi.iiop.compiler.StubCompiler;
 
-    public GenOptions() {
-    }
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Iterator;
 
-    public GenOptions(String genDir, boolean overwrite, boolean verbose) {
-        _genDir = genDir;
-        _overwrite = overwrite;
-        _verbose = verbose;
+public class GenOptions {
+    // -gs  genSrcDir
+    // -gc  genClassDir
+    // -o   overwrite
+    // -v   verbose
+    // -s   simpleidl
+    // -cp  classpath
+    // -g   generate
+    // -c   compile
+    // -cd  compiledebug
+    // -lc  loadclass
+
+    private String      genSrcDir = "./src";
+    private String      genClassDir = "./classes";
+    private boolean     overwrite = false;
+    private boolean     verbose = false;
+    private boolean     simpleidl = false;
+    private String      classpath = "";
+    private boolean     generate = true;
+    private boolean     compile = false;
+    private boolean     compileDebug = false;
+    private boolean     loadclass = false;
+
+    private List        interfaces = new LinkedList();
+
+    public GenOptions( String defaultSrcDir, String args[] )
+        throws GenWarning, GenException {
+        genSrcDir = defaultSrcDir;
+        parseOptions( args );
     }
 
-    public String getGenDir() {
-        return _genDir;
+    public String getGenSrcDir() {
+        return genSrcDir;
     }
 
-    public void setGenDir(String genDir) {
-        _genDir = genDir;
+    public String getGenClassDir() {
+        return genClassDir;
     }
 
     public boolean isOverwrite() {
-        return _overwrite;
-    }
-
-    public void setOverwrite(boolean overwrite) {
-        _overwrite = overwrite;
+        return overwrite;
     }
 
     public boolean isVerbose() {
-        return _verbose;
+        return verbose;
     }
 
-    public void setVerbose(boolean verbose) {
-        _verbose = verbose;
+    public boolean isSimpleIdl() {
+        return simpleidl;
     }
 
+    public String getClasspath() {
+        return classpath;
+    }
+
+    public boolean isGenerate() {
+        return generate;
+    }
+
+    public boolean isCompile() {
+        return compile;
+    }
+
+    public boolean isCompileDebug() {
+        return compileDebug;
+    }
+
+    public boolean isLoadclass() {
+        return loadclass;
+    }
+
+    public List getInterfaces() {
+        return interfaces;
+    }
+
+    protected void parseOptions(String args[]) throws GenException, GenWarning {
+        GenWarning genWarning = null;
+
+        for (int i = 0; i < args.length; i++) {
+            if (args[i].equals("-g")) {
+                generate = true;
+            } else if (args[i].equals("-c")) {
+                compile = true;
+            } else if (args[i].equals("-cd")) {
+                compileDebug = true;
+            } else if (args[i].equals("-l")) {
+                loadclass = true;
+            } else if (args[i].equals("-s")) {
+                simpleidl = true;
+            } else if (args[i].equals("-gs")) {
+                if ((i + 1) < args.length) {
+                    genSrcDir = args[++i];
+                } else {
+                    throw new GenException( "-gs requires an source output diretory." );
+                }
+            } else if (args[i].equals("-cp")) {
+                if ((i + 1) < args.length) {
+                    classpath = args[++i];
+                } else {
+                    throw new GenException( "-cp requires a classpath directory." );
+                }
+            } else if (args[i].equals("-gc")) {
+                if ((i + 1) < args.length) {
+                    genClassDir = args[++i];
+                } else {
+                    throw new GenException( "-gc requires an class output diretory." );
+                }
+            } else if (args[i].equals("-v")) {
+                verbose = true;
+            } else if (args[i].equals("-o")) {
+                overwrite = true;
+            } else if (args[i].startsWith("-")) {
+                String msg = "Ignoring unrecognized options: '" + args[i] + "'";
+                if (genWarning != null) {
+                    // just a cheap way of chaining the warnings...
+                    genWarning = new GenWarning( msg, genWarning);
+                } else {
+                    genWarning = new GenWarning( msg );
+                }
+            } else {
+                interfaces.add(args[i]);
+            }
+        }
+    }
 }

Added: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/GenWarning.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/GenWarning.java?view=auto&rev=159005
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/GenWarning.java (added)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/GenWarning.java Fri Mar 25 03:54:30 2005
@@ -0,0 +1,37 @@
+/**
+ *
+ *  Copyright 2004-2005 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.interop.generator;
+
+public class GenWarning
+        extends Exception {
+    public GenWarning() {
+        super();
+    }
+
+    public GenWarning(String message) {
+        super(message);
+    }
+
+    public GenWarning(Throwable cause) {
+        super(cause);
+    }
+
+    public GenWarning(String message, Throwable cause) {
+        super(message, cause);
+    }
+}

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JBlockStatement.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JBlockStatement.java?view=diff&r1=159004&r2=159005
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JBlockStatement.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JBlockStatement.java Fri Mar 25 03:54:30 2005
@@ -19,22 +19,21 @@
 
 import java.util.Vector;
 
-
 public class JBlockStatement extends JStatement {
-    protected Vector _localVars;
-    protected Vector _statements;
+    private Vector    localVars;
+    private Vector    statements;
 
     public JBlockStatement() {
-        _localVars = new Vector();
-        _statements = new Vector();
+        localVars = new Vector();
+        statements = new Vector();
     }
 
     public boolean hasVariables() {
-        return _localVars.size() > 0;
+        return localVars.size() > 0;
     }
 
     public boolean hasStatements() {
-        return _statements.size() > 0;
+        return statements.size() > 0;
     }
 
     public JLocalVariable newLocalVariable(Class type, String name) {
@@ -46,26 +45,26 @@
 
         v.setInitExpression(initExpr);
 
-        _localVars.add(v);
+        localVars.add(v);
 
         return v;
     }
 
     public void deleteLocalVariable(JLocalVariable f) {
-        _localVars.remove(f);
+        localVars.remove(f);
     }
 
     public Vector getLocalVariables() {
-        return _localVars;
+        return localVars;
     }
 
     public void addStatement(JStatement s) {
         if (s != this) {
-            _statements.add(s);
+            statements.add(s);
         }
     }
 
     public Vector getStatements() {
-        return _statements;
+        return statements;
     }
 }

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JCaseStatement.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JCaseStatement.java?view=diff&r1=159004&r2=159005
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JCaseStatement.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JCaseStatement.java Fri Mar 25 03:54:30 2005
@@ -17,33 +17,30 @@
  */
 package org.apache.geronimo.interop.generator;
 
-
-
-
 public class JCaseStatement extends JStatement {
-    protected JExpression _expr;
-    protected JBlockStatement _statements;
+    private JExpression       expr;
+    private JBlockStatement   statements;
 
     public JCaseStatement(JExpression e) {
         super();
 
-        _expr = e;
-        _statements = new JBlockStatement();
+        expr = e;
+        statements = new JBlockStatement();
     }
 
     public void setExpression(JExpression e) {
-        _expr = e;
+        expr = e;
     }
 
     public JExpression getExpression() {
-        return _expr;
+        return expr;
     }
 
     public void addStatement(JStatement s) {
-        _statements.addStatement(s);
+        statements.addStatement(s);
     }
 
     public JBlockStatement getStatement() {
-        return _statements;
+        return statements;
     }
 }

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JCatchStatement.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JCatchStatement.java?view=diff&r1=159004&r2=159005
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JCatchStatement.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JCatchStatement.java Fri Mar 25 03:54:30 2005
@@ -18,19 +18,19 @@
 package org.apache.geronimo.interop.generator;
 
 public class JCatchStatement extends JBlockStatement {
-    protected JVariable _var;
+    private JVariable     var;
 
     public JCatchStatement(JVariable v) {
         super();
-        _var = v;
+        var = v;
     }
 
     public JVariable getVariable() {
-        return _var;
+        return var;
     }
 
     public int hashCode() {
-        return _var.hashCode();
+        return var.hashCode();
     }
 
     public boolean equals(Object other) {
@@ -41,13 +41,13 @@
         } else if (other instanceof JCatchStatement) {
             JCatchStatement cs = (JCatchStatement) other;
 
-            if (cs._var.getType().equals(_var.getType())) {
+            if (cs.var.getType().equals(var.getType())) {
                 rc = true;
             }
         } else if (other instanceof JVariable) {
             JVariable v = (JVariable) other;
 
-            if (v.getType().equals(_var.getType())) {
+            if (v.getType().equals(var.getType())) {
                 rc = true;
             }
         }
@@ -56,69 +56,3 @@
         return rc;
     }
 }
-
-/*
-public class JCatchStatement extends JStatement
-{
-    protected JVariable          _var;
-    protected JBlockStatement    _statements;
-
-    public JCatchStatement( JVariable v )
-    {
-        _var = v;
-        _statements = new JBlockStatement();
-    }
-
-    public void addStatement( JStatement s )
-    {
-        _statements.addStatement( s );
-    }
-
-    public JBlockStatement getStatement()
-    {
-        return _statements;
-    }
-
-    public JVariable getVariable()
-    {
-        return _var;
-    }
-
-    public int hashCode()
-    {
-        return _var.hashCode();
-    }
-
-    public boolean equals( Object other )
-    {
-        boolean rc = false;
-
-        if (this == other)
-        {
-            rc = true;
-        }
-        else if (other instanceof JCatchStatement)
-        {
-            JCatchStatement cs = (JCatchStatement)other;
-
-            if (cs._var.getType().equals(_var.getType()))
-            {
-                rc = true;
-            }
-        }
-        else if (other instanceof JVariable)
-        {
-            JVariable v = (JVariable)other;
-
-            if (v.getType().equals( _var.getType() ))
-            {
-                rc = true;
-            }
-        }
-
-
-        return rc;
-    }
-}
-
-*/
\ No newline at end of file

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JClass.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JClass.java?view=diff&r1=159004&r2=159005
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JClass.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JClass.java Fri Mar 25 03:54:30 2005
@@ -20,31 +20,27 @@
 import java.lang.reflect.Modifier;
 import java.util.Vector;
 
-
 public class JClass extends JEntity {
-    protected JPackage _pkg;
-
-    protected Vector _imports;
-    protected Vector _implements;
-    protected String _baseClassName;
-
-    protected Vector _constructors;
-    protected Vector _methods;
-    protected Vector _fields;
-
-    protected Vector _classes = new Vector();
-    protected JClass _parent;
+    private JPackage      pkg;
+    private Vector        imports;
+    private Vector        impls;
+    private String        baseClassName;
+    private Vector        constructors;
+    private Vector        methods;
+    private Vector        fields;
+    private Vector        classes = new Vector();
+    private JClass        parent;
 
     protected JClass(String name) {
         super(name, Modifier.PUBLIC);
 
-        _imports = new Vector();
-        _implements = new Vector();
-        _baseClassName = "";
-
-        _constructors = new Vector();
-        _methods = new Vector();
-        _fields = new Vector();
+        imports = new Vector();
+        impls = new Vector();
+        baseClassName = "";
+
+        constructors = new Vector();
+        methods = new Vector();
+        fields = new Vector();
     }
 
     protected JClass(String name, JPackage pkg) {
@@ -54,63 +50,43 @@
             pkg = new JPackage("");
         }
 
-        _pkg = pkg;
+        this.pkg = pkg;
     }
 
     protected JClass(String name, JClass parent) {
         this(name);
 
-        _parent = parent;
+        this.parent = parent;
     }
 
     public JConstructor newConstructor(JParameter parms[], Class thrown[]) {
         JConstructor c = new JConstructor(parms, thrown);
         c.setParent(this);
-        _constructors.add(c);
+        constructors.add(c);
         return c;
     }
 
-    /*
-    public JConstructor newConstructor( JParameter parms[], String thrown[] )
-    {
-        JConstructor c = new JConstructor( parms, thrown );
-        c.setParent( this );
-        _constructors.add( c );
-        return c;
-    }
-    */
-
     public void deleteConstructor(JConstructor m) {
-        _constructors.removeElement(m);
+        constructors.removeElement(m);
     }
 
     public Vector getConstructors() {
-        return _constructors;
+        return constructors;
     }
 
     public JMethod newMethod(JReturnType rt, String name, JParameter parms[], Class thrown[]) {
         JMethod m = new JMethod(rt, name, parms, thrown);
         m.setParent(this);
-        _methods.add(m);
-        return m;
-    }
-
-    /*
-    public JMethod newMethod( JReturnType rt, String name, JParameter parms[], String thrown[] )
-    {
-        JMethod m = new JMethod( rt, name, parms, thrown );
-        m.setParent( this );
-        _methods.add( m );
+        methods.add(m);
         return m;
     }
-    */
 
     public void deleteMethod(JMethod m) {
-        _methods.removeElement(m);
+        methods.removeElement(m);
     }
 
     public Vector getMethods() {
-        return _methods;
+        return methods;
     }
 
     protected void setFieldParentAndModifier(JField f) {
@@ -143,36 +119,36 @@
         setFieldParentAndModifier(f);
         f.setInitExpression(initExpr);
 
-        _fields.add(f);
+        fields.add(f);
 
         return f;
     }
 
     public void deleteField(JField f) {
-        _fields.remove(f);
+        fields.remove(f);
     }
 
     public Vector getFields() {
-        return _fields;
+        return fields;
     }
 
     public JClass newClass(String name) {
         JClass c = new JClass(name, this);
-        _classes.add(c);
+        classes.add(c);
         return c;
     }
 
     public JPackage getPackage() {
-        if (_parent != null) {
-            return _parent.getPackage();
+        if (parent != null) {
+            return parent.getPackage();
         } else {
-            return _pkg;
+            return pkg;
         }
     }
 
     public String getName() {
-        if (_parent != null) {
-            return _parent.getName() + "$" + super.getName();
+        if (parent != null) {
+            return parent.getName() + "$" + super.getName();
         } else {
             return super.getName();
         }
@@ -187,23 +163,23 @@
     }
 
     public void setBaseClassName(String bcl) {
-        _baseClassName = bcl;
+        baseClassName = bcl;
     }
 
     public String getBaseClassName() {
-        return _baseClassName;
+        return baseClassName;
     }
 
     public void addImplements(String className) {
-        _implements.add(className);
+        impls.add(className);
     }
 
     public void removeImplements(String className) {
-        _implements.remove(className);
+        impls.remove(className);
     }
 
     public Vector getImplements() {
-        return _implements;
+        return impls;
     }
 
     /*
@@ -226,7 +202,7 @@
     }
 
     public void addImport(String fqName) {
-        _imports.add(fqName);
+        imports.add(fqName);
     }
 
     public void removeImport(Package pkg, String itemName) {
@@ -246,10 +222,10 @@
     }
 
     public void removeImport(String name) {
-        _imports.remove(name);
+        imports.remove(name);
     }
 
     public Vector getImports() {
-        return _imports;
+        return imports;
     }
 }

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JCodeStatement.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JCodeStatement.java?view=diff&r1=159004&r2=159005
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JCodeStatement.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JCodeStatement.java Fri Mar 25 03:54:30 2005
@@ -17,17 +17,14 @@
  */
 package org.apache.geronimo.interop.generator;
 
-
-
-
 public class JCodeStatement extends JStatement {
-    protected String _code;
+    private String    code;
 
     public JCodeStatement(String code) {
-        _code = code;
+        this.code = code;
     }
 
     public String getCode() {
-        return _code;
+        return code;
     }
 }

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JConstructor.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JConstructor.java?view=diff&r1=159004&r2=159005
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JConstructor.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JConstructor.java Fri Mar 25 03:54:30 2005
@@ -17,9 +17,6 @@
  */
 package org.apache.geronimo.interop.generator;
 
-
-
-
 public class JConstructor extends JMethod {
     protected JConstructor(String name) {
         super(name);
@@ -28,11 +25,4 @@
     protected JConstructor(JParameter parms[], Class thrown[]) {
         super((JReturnType) null, (String) null, parms, thrown);
     }
-
-    /*
-    protected JConstructor( JParameter parms[], String thrownType[] )
-    {
-        super( (JReturnType)null, (String)null, parms, thrownType );
-    }
-    */
 }

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JDeclareStatement.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JDeclareStatement.java?view=diff&r1=159004&r2=159005
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JDeclareStatement.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JDeclareStatement.java Fri Mar 25 03:54:30 2005
@@ -18,31 +18,31 @@
 package org.apache.geronimo.interop.generator;
 
 public class JDeclareStatement extends JStatement {
-    protected JVariable _v;
-    protected JExpression _initExpr;
+    private JVariable         v;
+    private JExpression       initExpr;
 
     public JDeclareStatement(JVariable v) {
         this(v, null);
     }
 
     public JDeclareStatement(JVariable v, JExpression initExpr) {
-        _v = v;
-        _initExpr = initExpr;
+        this.v = v;
+        this.initExpr = initExpr;
     }
 
     public void setVariable(JVariable s) {
-        _v = s;
+        v = s;
     }
 
     public JVariable getVariable() {
-        return _v;
+        return v;
     }
 
     public void setInitExpression(JExpression initExpr) {
-        _initExpr = initExpr;
+        this.initExpr = initExpr;
     }
 
     public JExpression getInitExpression() {
-        return _initExpr;
+        return initExpr;
     }
 }

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JEntity.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JEntity.java?view=diff&r1=159004&r2=159005
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JEntity.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JEntity.java Fri Mar 25 03:54:30 2005
@@ -17,55 +17,72 @@
  */
 package org.apache.geronimo.interop.generator;
 
+import java.lang.reflect.Modifier;
+
 public class JEntity {
-    protected String _name;
-    protected int _modifiers;
-    protected JEntity _parent;
+    private String    name;
+    private int       modifiers;
+    private JEntity   parent;
 
     public JEntity(String name) {
-        this(name, 0);
+        this(name, Modifier.PUBLIC);
     }
 
     public JEntity(String name, int modifiers) {
-        _name = name;
-        _modifiers = modifiers;
+        this.name = name;
+        this.modifiers = modifiers;
     }
 
     public JEntity getParent() {
-        return _parent;
+        return parent;
     }
 
     public void setParent(JEntity parent) {
-        _parent = parent;
+        this.parent = parent;
     }
 
     public String getName() {
-        return _name;
+        return name;
     }
 
     public void setName(String val) {
-        _name = val;
+        name = val;
     }
 
     /*
      * if value is true, then the modifier will be set,
      * if value is false, then the modifier will be unset.
      */
-    public void setModifier(int modifier, boolean value) {
+    protected void adjustModifier(int modifier, boolean value) {
         if (value) {
-            _modifiers = (_modifiers | modifier);
+            modifiers = (modifiers | modifier);
         } else {
-            if ((_modifiers & modifier) == modifier) {
-                _modifiers = (_modifiers ^ modifier);
+            if ((modifiers & modifier) == modifier) {
+                modifiers = (modifiers ^ modifier);
             }
         }
     }
 
+    public void setModifier( int modifier )
+    {
+        adjustModifier( modifier, true );
+    }
+
+    public void unsetModifier( int modifier )
+    {
+        adjustModifier( modifier, false );
+    }
+
+    /*
+     * Sets all the modifiers in one set
+     *
+     * Example: setModifiers(Modifier.PRIVATE | Modifier.STATIC | Modifier.FINAL);
+     */
     public void setModifiers(int modifiers) {
-        _modifiers = modifiers;
+        this.modifiers = modifiers;
     }
 
     public int getModifiers() {
-        return _modifiers;
+        return modifiers;
     }
 }

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JExpression.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JExpression.java?view=diff&r1=159004&r2=159005
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JExpression.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JExpression.java Fri Mar 25 03:54:30 2005
@@ -18,17 +18,17 @@
 package org.apache.geronimo.interop.generator;
 
 public class JExpression extends JStatement {
-    protected JStatement _statement;
+    private JStatement    statement;
 
     public JExpression(JStatement s) {
-        _statement = s;
+        statement = s;
     }
 
     public void setStatement(JStatement s) {
-        _statement = s;
+        statement = s;
     }
 
     public JStatement getStatement() {
-        return _statement;
+        return statement;
     }
 }

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JFinallyStatement.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JFinallyStatement.java?view=diff&r1=159004&r2=159005
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JFinallyStatement.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JFinallyStatement.java Fri Mar 25 03:54:30 2005
@@ -17,27 +17,24 @@
  */
 package org.apache.geronimo.interop.generator;
 
-
-
-
 public class JFinallyStatement extends JStatement {
-    protected JBlockStatement _finallyStatements;
-    protected boolean _hasStatements = false;
+    private JBlockStatement   finallyStatements;
+    private boolean           hasStatements = false;
 
     public JFinallyStatement() {
-        _finallyStatements = new JBlockStatement();
+        finallyStatements = new JBlockStatement();
     }
 
     public void addStatement(JStatement s) {
-        _finallyStatements.addStatement(s);
-        _hasStatements = true;
+        finallyStatements.addStatement(s);
+        hasStatements = true;
     }
 
     public JBlockStatement getStatement() {
-        return _finallyStatements;
+        return finallyStatements;
     }
 
     public boolean hasStatements() {
-        return _hasStatements;
+        return hasStatements;
     }
 }

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JForStatement.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JForStatement.java?view=diff&r1=159004&r2=159005
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JForStatement.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JForStatement.java Fri Mar 25 03:54:30 2005
@@ -17,30 +17,27 @@
  */
 package org.apache.geronimo.interop.generator;
 
-
-
-
 public class JForStatement extends JBlockStatement {
-    protected JStatement _initStmt;
-    protected JExpression _loopExpr;
-    protected JStatement _iterStmt;
+    private JStatement    initStmt;
+    private JExpression   loopExpr;
+    private JStatement    iterStmt;
 
     public JForStatement(JStatement init, JExpression loop, JStatement iter) {
         super();
-        _initStmt = init;
-        _loopExpr = loop;
-        _iterStmt = iter;
+        initStmt = init;
+        loopExpr = loop;
+        iterStmt = iter;
     }
 
     public JStatement getInitStatement() {
-        return _initStmt;
+        return initStmt;
     }
 
     public JExpression getLoopExpression() {
-        return _loopExpr;
+        return loopExpr;
     }
 
     public JStatement getIterStatement() {
-        return _iterStmt;
+        return iterStmt;
     }
 }

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JIfElseIfElseStatement.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JIfElseIfElseStatement.java?view=diff&r1=159004&r2=159005
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JIfElseIfElseStatement.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JIfElseIfElseStatement.java Fri Mar 25 03:54:30 2005
@@ -19,48 +19,47 @@
 
 import java.util.Vector;
 
-
 public class JIfElseIfElseStatement extends JStatement {
-    protected JIfStatement _ifStatement;
-    protected Vector _elseifStatements;
-    protected JElseStatement _elseStatement;
+    private JIfStatement      ifStatement;
+    private Vector            elseifStatements;
+    private JElseStatement    elseStatement;
 
     public JIfElseIfElseStatement(JExpression if_expr) {
-        _ifStatement = new JIfStatement(if_expr);
-        _elseifStatements = new Vector();
-        _elseStatement = new JElseStatement();
+        ifStatement = new JIfStatement(if_expr);
+        elseifStatements = new Vector();
+        elseStatement = new JElseStatement();
     }
 
     public void addIfStatement(JStatement s) {
-        _ifStatement.addStatement(s);
+        ifStatement.addStatement(s);
     }
 
     public JIfStatement getIfStatement() {
-        return _ifStatement;
+        return ifStatement;
     }
 
     public Vector getIfStatements() {
-        return _ifStatement.getStatements();
+        return ifStatement.getStatements();
     }
 
     public void addElseStatement(JStatement s) {
-        _elseStatement.addStatement(s);
+        elseStatement.addStatement(s);
     }
 
     public JElseStatement getElseStatement() {
-        return _elseStatement;
+        return elseStatement;
     }
 
     public Vector getElseStatements() {
-        return _elseStatement.getStatements();
+        return elseStatement.getStatements();
     }
 
     public JElseIfStatement getElseIf(JExpression e) {
         JElseIfStatement rc = null;
-        int index = _elseifStatements.indexOf(e);
+        int index = elseifStatements.indexOf(e);
 
         if (index >= 0) {
-            rc = (JElseIfStatement) _elseifStatements.get(index);
+            rc = (JElseIfStatement) elseifStatements.get(index);
         }
 
         return rc;
@@ -71,7 +70,7 @@
 
         if (rc == null) {
             rc = new JElseIfStatement(e);
-            _elseifStatements.add(rc);
+            elseifStatements.add(rc);
         }
 
         return rc;
@@ -88,6 +87,6 @@
     }
 
     public Vector getElseIfs() {
-        return _elseifStatements;
+        return elseifStatements;
     }
 }

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JIfStatement.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JIfStatement.java?view=diff&r1=159004&r2=159005
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JIfStatement.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JIfStatement.java Fri Mar 25 03:54:30 2005
@@ -18,19 +18,19 @@
 package org.apache.geronimo.interop.generator;
 
 public class JIfStatement extends JBlockStatement {
-    protected JExpression _expr;
+    private JExpression   expr;
 
     public JIfStatement(JExpression e) {
         super();
-        _expr = e;
+        expr = e;
     }
 
     public JExpression getExpression() {
-        return _expr;
+        return expr;
     }
 
     public int hashCode() {
-        return _expr.hashCode();
+        return expr.hashCode();
     }
 
     public boolean equals(Object other) {
@@ -41,7 +41,7 @@
         } else if (other instanceof JIfStatement) {
             JIfStatement is = (JIfStatement) other;
 
-            if (is._expr == _expr) {
+            if (is.expr == expr) {
                 // Todo: Need equals()
                 rc = true;
             }
@@ -49,4 +49,4 @@
 
         return rc;
     }
-}
\ No newline at end of file
+}

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JMethod.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JMethod.java?view=diff&r1=159004&r2=159005
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JMethod.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JMethod.java Fri Mar 25 03:54:30 2005
@@ -20,22 +20,19 @@
 import java.lang.reflect.Modifier;
 import java.util.Vector;
 
-
 public class JMethod extends JEntity {
-    protected JReturnType _rt;
-    protected JParameter _parms[];
-    protected Class _thrown[];
-
-    protected Vector _statements;
-    protected JBlockStatement _bodyBlockStatement;
-
-    protected String _body;  // Yuck
+    private JReturnType       rt;
+    private JParameter        parms[];
+    private Class             thrown[];
+    private Vector            statements;
+    private JBlockStatement   bodyBlockStatement;
+    private String            body;  // Yuck
 
     protected JMethod(String name) {
         super(name, Modifier.PUBLIC);
 
-        _statements = new Vector();
-        _bodyBlockStatement = new JBlockStatement();
+        statements = new Vector();
+        bodyBlockStatement = new JBlockStatement();
     }
 
     protected JMethod(JReturnType rt, String name, JParameter parms[], Class thrown[]) {
@@ -47,87 +44,58 @@
     }
 
     public void setRT(JReturnType jt) {
-        _rt = jt;
+        rt = jt;
     }
 
     public JReturnType getRT() {
-        return _rt;
+        return rt;
     }
 
     public void setParms(JParameter parms[]) {
-        _parms = parms;
+        this.parms = parms;
     }
 
     public JParameter[] getParms() {
-        return _parms;
+        return parms;
     }
 
     public void setThrown(Class thrown[]) {
-        _thrown = thrown;
-
-        /*
-        if (_thrown != null)
-        {
-            _thrownType = new String[_thrown.length];
-            int i;
-            for( i=0; i<_thrown.length; i++ )
-            {
-                _thrownType[i] = _thrown[i].getName();
-            }
-        }
-        else
-        {
-            _thrownType = null;
-        }
-        */
+        this.thrown = thrown;
     }
 
     public Class[] getThrown() {
-        return _thrown;
-    }
-
-    /*
-    public void setThrownType( String thrownType[] )
-    {
-        _thrownType = thrownType;
-        _thrown = null;
-    }
-
-    public String[] getThrownType()
-    {
-        return _thrownType;
+        return thrown;
     }
-    */
 
     public void setBody(String body) {
-        _body = body;
+        this.body = body;
     }
 
     public String getBody() {
-        return _body;
+        return body;
     }
 
     public JLocalVariable newLocalVariable(Class type, String name) {
-        return _bodyBlockStatement.newLocalVariable(type, name);
+        return bodyBlockStatement.newLocalVariable(type, name);
     }
 
     public JLocalVariable newLocalVariable(Class type, String name, JExpression initExpr) {
-        return _bodyBlockStatement.newLocalVariable(type, name, initExpr);
+        return bodyBlockStatement.newLocalVariable(type, name, initExpr);
     }
 
     public void deleteLocalVariable(JLocalVariable f) {
-        _bodyBlockStatement.deleteLocalVariable(f);
+        bodyBlockStatement.deleteLocalVariable(f);
     }
 
     public Vector getLocalVariables() {
-        return _bodyBlockStatement.getLocalVariables();
+        return bodyBlockStatement.getLocalVariables();
     }
 
     public void addStatement(JStatement s) {
-        _statements.add(s);
+        statements.add(s);
     }
 
     public Vector getStatements() {
-        return _statements;
+        return statements;
     }
 }

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JPackage.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JPackage.java?view=diff&r1=159004&r2=159005
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JPackage.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JPackage.java Fri Mar 25 03:54:30 2005
@@ -19,9 +19,8 @@
 
 import java.util.Vector;
 
-
 public class JPackage extends JEntity {
-    protected Vector _classes = new Vector();
+    private Vector    classes = new Vector();
 
     public JPackage(String name) {
         super(name);
@@ -29,15 +28,15 @@
 
     public JClass newClass(String name) {
         JClass c = new JClass(name, this);
-        _classes.add(c);
+        classes.add(c);
         return c;
     }
 
     public void deleteClass(JClass c) {
-        _classes.removeElement(c);
+        classes.removeElement(c);
     }
 
     public Vector getClasses() {
-        return _classes;
+        return classes;
     }
 }

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JReturnType.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JReturnType.java?view=diff&r1=159004&r2=159005
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JReturnType.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JReturnType.java Fri Mar 25 03:54:30 2005
@@ -17,73 +17,9 @@
  */
 package org.apache.geronimo.interop.generator;
 
-public class JReturnType {
-    protected Class _type;
-    protected String _typeName;
-    protected boolean _isArray;
+public class JReturnType extends JType {
 
     public JReturnType(Class type) {
-        this(type, false);
-    }
-
-    public JReturnType(Class type, boolean isArray) {
-        _type = type;
-        _typeName = type.getName();
-        _isArray = isArray;
-    }
-
-    public JReturnType(String typeName) {
-        this(typeName, false);
-    }
-
-    public JReturnType(String typeName, boolean isArray) {
-        _typeName = typeName;
-        _isArray = isArray;
-
-        try {
-            _type = Class.forName(_typeName);
-        } catch (Exception e) {
-            // Ignore;
-        }
-    }
-
-    public void setType(Class type) {
-        _type = type;
-        _typeName = type.getName();
-    }
-
-    public Class getType() {
-        return _type;
-    }
-
-    public void setTypeName(String typeName) {
-        _type = null;
-        _typeName = typeName;
-    }
-
-    public String getTypeName() {
-        return _typeName;
-    }
-
-    public boolean isArray() {
-        return _isArray;
-    }
-
-    public int hashCode() {
-        return _type.hashCode();
-    }
-
-    public boolean equals(Object other) {
-        boolean rc = false;
-
-        if (other == this) {
-            rc = true;
-        } else if (other instanceof org.apache.geronimo.interop.generator.JReturnType) {
-            org.apache.geronimo.interop.generator.JReturnType jr = (org.apache.geronimo.interop.generator.JReturnType) other;
-
-            rc = jr._typeName.equals(_typeName);
-        }
-
-        return rc;
+        super(type);
     }
 }

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JSwitchStatement.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JSwitchStatement.java?view=diff&r1=159004&r2=159005
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JSwitchStatement.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JSwitchStatement.java Fri Mar 25 03:54:30 2005
@@ -19,30 +19,29 @@
 
 import java.util.Vector;
 
-
 public class JSwitchStatement extends JStatement {
-    protected JExpression _switchExpr;
-    protected Vector _caseStatements;
+    private JExpression       switchExpr;
+    private Vector            caseStatements;
 
     public JSwitchStatement(JExpression e) {
-        _switchExpr = e;
-        _caseStatements = new Vector();
+        switchExpr = e;
+        caseStatements = new Vector();
     }
 
     public void setVariable(JExpression e) {
-        _switchExpr = e;
+        switchExpr = e;
     }
 
     public JExpression getExpression() {
-        return _switchExpr;
+        return switchExpr;
     }
 
     public JCaseStatement getCase(JExpression e) {
         JCaseStatement rc = null;
-        int index = _caseStatements.indexOf(e);
+        int index = caseStatements.indexOf(e);
 
         if (index >= 0) {
-            rc = (JCaseStatement) _caseStatements.get(index);
+            rc = (JCaseStatement) caseStatements.get(index);
         }
 
         return rc;
@@ -53,7 +52,7 @@
 
         if (rc == null) {
             rc = new JCaseStatement(e);
-            _caseStatements.add(rc);
+            caseStatements.add(rc);
         }
 
         return rc;
@@ -70,6 +69,6 @@
     }
 
     public Vector getCases() {
-        return _caseStatements;
+        return caseStatements;
     }
 }

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JTryCatchFinallyStatement.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JTryCatchFinallyStatement.java?view=diff&r1=159004&r2=159005
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JTryCatchFinallyStatement.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JTryCatchFinallyStatement.java Fri Mar 25 03:54:30 2005
@@ -19,32 +19,31 @@
 
 import java.util.Vector;
 
-
 public class JTryCatchFinallyStatement extends JStatement {
-    protected JTryStatement _TryStatement;
-    protected Vector _catchStatements;
-    protected JFinallyStatement _FinallyStatement;
+    private JTryStatement         tryStatement;
+    private Vector                catchStatements;
+    private JFinallyStatement     finallyStatement;
 
     public JTryCatchFinallyStatement() {
-        _TryStatement = new JTryStatement();
-        _catchStatements = new Vector();
-        _FinallyStatement = new JFinallyStatement();
+        tryStatement = new JTryStatement();
+        catchStatements = new Vector();
+        finallyStatement = new JFinallyStatement();
     }
 
     public void addTryStatement(JStatement s) {
-        _TryStatement.addStatement(s);
+        tryStatement.addStatement(s);
     }
 
     public JTryStatement getTryStatement() {
-        return _TryStatement;
+        return tryStatement;
     }
 
     public JCatchStatement getCatch(JVariable v) {
         JCatchStatement rc = null;
-        int index = _catchStatements.indexOf(v);
+        int index = catchStatements.indexOf(v);
 
         if (index >= 0) {
-            rc = (JCatchStatement) _catchStatements.get(index);
+            rc = (JCatchStatement) catchStatements.get(index);
         }
 
         return rc;
@@ -55,7 +54,7 @@
 
         if (rc == null) {
             rc = new JCatchStatement(v);
-            _catchStatements.add(rc);
+            catchStatements.add(rc);
         }
 
         return rc;
@@ -72,14 +71,14 @@
     }
 
     public Vector getCatches() {
-        return _catchStatements;
+        return catchStatements;
     }
 
     public void addFinallyStatement(JStatement s) {
-        _FinallyStatement.addStatement(s);
+        finallyStatement.addStatement(s);
     }
 
     public JFinallyStatement getFinallyStatement() {
-        return _FinallyStatement;
+        return finallyStatement;
     }
 }

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JTryStatement.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JTryStatement.java?view=diff&r1=159004&r2=159005
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JTryStatement.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JTryStatement.java Fri Mar 25 03:54:30 2005
@@ -22,33 +22,3 @@
         super();
     }
 }
-
-/*
-public class JTryStatement extends JStatement
-{
-    protected JBlockStatement    _tryStatements;
-
-    public JTryStatement( )
-    {
-        _tryStatements = new JBlockStatement();
-    }
-
-    public void addStatement( JStatement s )
-    {
-        if (s == _tryStatements ||
-            s.equals( _tryStatements ))
-        {
-            // Don't add it.
-            // Todo: Throw an exception?
-            return;
-        }
-
-        _tryStatements.addStatement( s );
-    }
-
-    public JBlockStatement getStatement()
-    {
-        return _tryStatements;
-    }
-}
-*/
\ No newline at end of file

Added: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JType.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JType.java?view=auto&rev=159005
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JType.java (added)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JType.java Fri Mar 25 03:54:30 2005
@@ -0,0 +1,157 @@
+/**
+ *
+ *  Copyright 2004-2005 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.interop.generator;
+
+import java.util.HashMap;
+
+public class JType extends JEntity {
+
+    private static HashMap    typeMap = new HashMap(60);
+    private Class             type;
+    private String            typeDecl;
+
+    public JType(Class type) {
+        super(null);
+        setType(type);
+    }
+
+    public void setType(Class type) {
+        this.type = type;
+        calculateTypeDecl();
+    }
+
+    public Class getType() {
+        return type;
+    }
+
+    public String getTypeDecl() {
+        return typeDecl;
+    }
+
+    public int hashCode() {
+        return type.hashCode();
+    }
+
+    public boolean equals(Object other) {
+        boolean rc = false;
+
+        if (other == this) {
+            rc = true;
+        } else if (other instanceof JType) {
+            JType t = (JType) other;
+
+            rc = t.type.equals(type);
+        }
+
+        return rc;
+    }
+
+    protected void calculateTypeDecl() {
+        if (type == null) {
+            return;
+        }
+
+        typeDecl = (String) typeMap.get(type);
+
+        if (typeDecl == null) {
+            synchronized (typeMap) {
+                typeDecl = type.getName();
+
+                if (type.isArray()) {
+                    typeDecl = convertToTypeDecl(typeDecl);
+                }
+
+                typeMap.put(type, typeDecl);
+            }
+        }
+    }
+
+    protected String convertToTypeDecl(String typeName) {
+        String rc = "";
+        char charAt = 0;
+        int i;
+
+        if (typeName != null && typeName.length() > 0) {
+            for (i = 0; i < typeName.length(); i++) {
+                charAt = typeName.charAt(i);
+
+                if (charAt == '[') {
+                    rc = rc + "[]";
+                } else if (charAt == 'Z') {
+                    rc = "boolean" + rc;
+                } else if (charAt == 'B') {
+                    rc = "byte" + rc;
+                } else if (charAt == 'C') {
+                    rc = "char" + rc;
+                } else if (charAt == 'L') {
+                    int semiIndex = typeName.indexOf(";");
+                    rc = typeName.substring(i + 1, semiIndex) + rc;
+                    i = semiIndex;
+                } else if (charAt == 'D') {
+                    rc = "double" + rc;
+                } else if (charAt == 'F') {
+                    rc = "float" + rc;
+                } else if (charAt == 'I') {
+                    rc = "int" + rc;
+                } else if (charAt == 'J') {
+                    rc = "long" + rc;
+                } else if (charAt == 'S') {
+                    rc = "short" + rc;
+                } else {
+                    System.out.println("Error: Invalid signature. typeName = " + typeName + ", charAt = " + charAt + ", i = " + i);
+                }
+            }
+        }
+
+        return rc;
+    }
+
+    protected void showTypeInfo() {
+        System.out.println("\tisArray()     = " + type.isArray());
+        System.out.println("\tisPrimitive() = " + type.isPrimitive());
+        System.out.println("\ttoString()    = " + type.toString());
+        System.out.println("\ttypeDecl      = " + getTypeDecl());
+        System.out.println("");
+    }
+
+    protected void validateDeclType(String t) {
+        String ct = getTypeDecl();
+        if (!t.equals(ct)) {
+            System.out.println("Class Decl Type: '" + ct + "' does not match expected type: '" + t + "'");
+        }
+    }
+
+    public static void main(String args[])
+            throws Exception {
+        (new JType(java.lang.String.class)).showTypeInfo();
+        (new JType(java.lang.String[].class)).showTypeInfo();
+        (new JType(java.lang.String[][].class)).showTypeInfo();
+
+        (new JType(int.class)).showTypeInfo();
+        (new JType(int[].class)).showTypeInfo();
+        (new JType(int[][].class)).showTypeInfo();
+
+        (new JType(java.lang.String.class)).validateDeclType("java.lang.String");
+        (new JType(java.lang.String[].class)).validateDeclType("java.lang.String[]");
+        (new JType(java.lang.String[][].class)).validateDeclType("java.lang.String[][]");
+
+        (new JType(int.class)).validateDeclType("int");
+        (new JType(int[].class)).validateDeclType("int[]");
+        (new JType(int[][].class)).validateDeclType("int[][]");
+    }
+}

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JVariable.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JVariable.java?view=diff&r1=159004&r2=159005
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JVariable.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JVariable.java Fri Mar 25 03:54:30 2005
@@ -19,43 +19,30 @@
 
 import java.util.HashMap;
 
-
-public class JVariable extends JEntity {
-    protected static HashMap _typeMap = new HashMap(60);
-
-    protected Class _type;
-    protected String _typeDecl;
-    protected JExpression _initExpr;
-    protected boolean _isArray;
+public class JVariable extends JType {
+    private String            name;
+    private JExpression       initExpr;
 
     public JVariable(Class type, String name) {
-        super(name);
-        setType(type);
-    }
-
-    public void setType(Class type) {
-        _type = type;
-        calculateTypeDecl();
-    }
-
-    public Class getType() {
-        return _type;
+        super(type);
+        this.name = name;
     }
 
-    public String getTypeDecl() {
-        return _typeDecl;
+    public String getName()
+    {
+        return name;
     }
 
     public void setInitExpression(JExpression initExpr) {
-        _initExpr = initExpr;
+        this.initExpr = initExpr;
     }
 
     public JExpression getInitExpression() {
-        return _initExpr;
+        return initExpr;
     }
 
     public int hashCode() {
-        return _type.hashCode() + _name.hashCode();
+        return super.hashCode() + name.hashCode();
     }
 
     public boolean equals(Object other) {
@@ -66,66 +53,10 @@
         } else if (other instanceof JVariable) {
             JVariable v = (JVariable) other;
 
-            rc = v._type.equals(_type);
-        }
-
-        return rc;
-    }
-
-    protected void calculateTypeDecl() {
-        if (_type == null) {
-            return;
-        }
-
-        _typeDecl = (String) _typeMap.get(_type);
-
-        if (_typeDecl == null) {
-            synchronized (_typeMap) {
-                _typeDecl = _type.getName();
-
-                if (_type.isArray()) {
-                    _typeDecl = convertToTypeDecl(_typeDecl);
-                }
-
-                _typeMap.put(_type, _typeDecl);
-            }
-        }
-    }
-
-    protected String convertToTypeDecl(String typeName) {
-        String rc = "";
-        char charAt = 0;
-        int i;
-
-        if (typeName != null && typeName.length() > 0) {
-            for (i = 0; i < typeName.length(); i++) {
-                charAt = typeName.charAt(i);
-
-                if (charAt == '[') {
-                    rc = rc + "[]";
-                } else if (charAt == 'Z') {
-                    rc = "boolean" + rc;
-                } else if (charAt == 'B') {
-                    rc = "byte" + rc;
-                } else if (charAt == 'C') {
-                    rc = "char" + rc;
-                } else if (charAt == 'L') {
-                    int semiIndex = typeName.indexOf(";");
-                    rc = typeName.substring(i + 1, semiIndex) + rc;
-                    i = semiIndex;
-                } else if (charAt == 'D') {
-                    rc = "double" + rc;
-                } else if (charAt == 'F') {
-                    rc = "float" + rc;
-                } else if (charAt == 'I') {
-                    rc = "int" + rc;
-                } else if (charAt == 'J') {
-                    rc = "long" + rc;
-                } else if (charAt == 'S') {
-                    rc = "short" + rc;
-                } else {
-                    System.out.println("Error: Invalid signature. typeName = " + typeName + ", charAt = " + charAt + ", i = " + i);
-                }
+            rc = super.equals(other);
+            if (rc)
+            {
+                v.getName().equals(name);
             }
         }
 
@@ -133,37 +64,8 @@
     }
 
     protected void showTypeInfo() {
-        System.out.println("getName() = " + _type.getName());
-        System.out.println("\tisArray()     = " + _type.isArray());
-        System.out.println("\tisPrimitive() = " + _type.isPrimitive());
-        System.out.println("\ttoString()    = " + _type.toString());
-        System.out.println("\ttypeDecl      = " + getTypeDecl());
-        System.out.println("");
-    }
-
-    protected void validateDeclType(String t) {
-        String ct = getTypeDecl();
-        if (!t.equals(ct)) {
-            System.out.println("Class Decl Type: '" + ct + "' does not match expected type: '" + t + "'");
-        }
+        System.out.println("getName() = " + name);
+        super.showTypeInfo();
     }
 
-    public static void main(String args[])
-            throws Exception {
-        (new JVariable(java.lang.String.class, "v")).showTypeInfo();
-        (new JVariable(java.lang.String[].class, "v")).showTypeInfo();
-        (new JVariable(java.lang.String[][].class, "v")).showTypeInfo();
-
-        (new JVariable(int.class, "v")).showTypeInfo();
-        (new JVariable(int[].class, "v")).showTypeInfo();
-        (new JVariable(int[][].class, "v")).showTypeInfo();
-
-        (new JVariable(java.lang.String.class, "v")).validateDeclType("java.lang.String");
-        (new JVariable(java.lang.String[].class, "v")).validateDeclType("java.lang.String[]");
-        (new JVariable(java.lang.String[][].class, "v")).validateDeclType("java.lang.String[][]");
-
-        (new JVariable(int.class, "v")).validateDeclType("int");
-        (new JVariable(int[].class, "v")).validateDeclType("int[]");
-        (new JVariable(int[][].class, "v")).validateDeclType("int[][]");
-    }
 }

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JavaGenerator.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JavaGenerator.java?view=diff&r1=159004&r2=159005
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JavaGenerator.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JavaGenerator.java Fri Mar 25 03:54:30 2005
@@ -21,20 +21,19 @@
 import java.lang.reflect.Modifier;
 import java.util.Vector;
 
-
 public class JavaGenerator implements Generator {
-    protected GenOptions _genOptions;
+    private GenOptions      genOptions;
 
     public JavaGenerator(GenOptions genOptions) {
-        _genOptions = genOptions;
+        this.genOptions = genOptions;
     }
 
     public GenOptions getGenOptions() {
-        return _genOptions;
+        return genOptions;
     }
 
     public void setGenOptions(GenOptions genOptions) {
-        _genOptions = genOptions;
+        this.genOptions = genOptions;
     }
 
     public void generate(JEntity e) {
@@ -70,7 +69,7 @@
 
         String fullName = pkgName + "/" + className;
 
-        JavaWriter jw = new JavaWriter(_genOptions, fullName, ".java");
+        JavaWriter jw = new JavaWriter(genOptions, fullName, ".java");
 
         jw.openFile();
         writeClass(jw, c);
@@ -213,13 +212,7 @@
         if (m instanceof JConstructor) {
             jw.print(c.getName());
         } else {
-            //jw.print( m.getRCType() + " " + m.getName() );
-            jw.print(m.getRT().getTypeName());
-
-            if (m.getRT().isArray()) {
-                jw.print("[]");
-            }
-
+            jw.print(m.getRT().getTypeDecl());
             jw.print(" " + m.getName());
         }
         jw.print("(");



Mime
View raw message