geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r158862 [2/9] - in geronimo/trunk/modules/interop: ./ src/idl/ src/java/org/apache/geronimo/interop/ src/java/org/apache/geronimo/interop/CosNaming/iiop_stubs/ src/java/org/apache/geronimo/interop/adapter/ src/java/org/apache/geronimo/interop/client/ src/java/org/apache/geronimo/interop/generator/ src/java/org/apache/geronimo/interop/naming/ src/java/org/apache/geronimo/interop/properties/ src/java/org/apache/geronimo/interop/repository/ src/java/org/apache/geronimo/interop/rmi/iiop/ src/java/org/apache/geronimo/interop/rmi/iiop/client/ src/java/org/apache/geronimo/interop/rmi/iiop/compiler/ src/java/org/apache/geronimo/interop/rmi/iiop/server/ src/java/org/apache/geronimo/interop/server/ src/java/org/apache/geronimo/interop/util/
Date Thu, 24 Mar 2005 02:30:53 GMT
Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/InteropGBean.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/InteropGBean.java?view=diff&r1=158861&r2=158862
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/InteropGBean.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/InteropGBean.java Wed Mar 23 18:30:30 2005
@@ -39,17 +39,17 @@
 
     private IOR ior;
 
-    private Properties  properties;
-    private String      strprop;
-    private String      name;
+    private Properties properties;
+    private String strprop;
+    private String objectName;
 
     /**
      * Construct an instance of InteropGBean
      *
      * @param strprop some strprop
      */
-    public InteropGBean(String name, String strprop, Properties properties) {
-        this.name = name;
+    public InteropGBean(String objectName, String strprop, Properties properties) {
+        this.objectName = objectName;
         this.strprop = strprop;
         this.properties = (properties == null ? new Properties() : properties);
     }
@@ -89,15 +89,15 @@
     /**
      * Returns the object name of this protocol GBean
      */
-    public String getName() {
-        return name;
+    public String getObjectName() {
+        return objectName;
     }
 
     /**
      * Add the overrides from the member variables to the properties file.
      */
     public void echo(String msg) {
-        log.info(getName() + ": Echo " + msg);
+        log.info(getObjectName() + ": Echo " + msg);
     }    
 
     /* 
@@ -105,15 +105,15 @@
      */
 
     public void doStart() throws Exception {
-        log.info("Started " + getName());
+        log.info("Started " + getObjectName());
     }
 
     public void doStop() throws Exception {
-        log.info("Stopped " + getName());
+        log.info("Stopped " + getObjectName());
     }
 
     public void doFail() {
-        log.info("Failed " + getName());
+        log.info("Failed " + getObjectName());
     }
 
     /* 
@@ -125,13 +125,13 @@
     static {
         GBeanInfoBuilder infoFactory = new GBeanInfoBuilder(InteropGBean.class);
 
-        infoFactory.addAttribute("name", String.class, true);
+        infoFactory.addAttribute("objectName", String.class, false);
         infoFactory.addAttribute("strprop", String.class, true);
         infoFactory.addAttribute("properties", Properties.class, true);
 
         infoFactory.addOperation("echo", new Class[]{String.class});
 
-        infoFactory.setConstructor(new String[]{"name", "strprop", "properties"});
+        infoFactory.setConstructor(new String[]{"objectName", "strprop", "properties"});
 
         GBEAN_INFO = infoFactory.getBeanInfo();
     }

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/SystemException.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/SystemException.java?view=diff&r1=158861&r2=158862
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/SystemException.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/SystemException.java Wed Mar 23 18:30:30 2005
@@ -17,24 +17,6 @@
  */
 package org.apache.geronimo.interop;
 
-/*
- * This class is used to help marshall server side exceptions back to the client.
- * A server exception is caught and then set as a cause of the system exception.
- *
- * Originally there were two different implementations of the this cause, one for 
- * JDK 1.3 (which didn't have the cause object on an Exception) and this one for JDK 1.4
- * The JDK 1.3 class has been removed.
- *
- * In the stubs/skeletons, they check to see if the marshalled exception is an instance of
- * SystemException and then it take appropriate actions.
- *
- * Its possible that this could change to use the JDK 1.4 RuntimeException.  This may 
- * cause some troubles with identification of specific server side exceptions vs. a
- * general runtime exception.
- *
- * For now, I am going to leave this class in place.  A future TODO would be to investigate
- * this situation more carefully.
- */
 
 public class SystemException extends RuntimeException {
     public SystemException(String message) {
@@ -52,4 +34,17 @@
                        && cause.getMessage() == null
                        ? cause.getCause() : cause);
     }
+
+    /*
+Constructor Summary 
+RuntimeException() 
+          Constructs a new runtime exception with null as its detail message. 
+RuntimeException(String message) 
+          Constructs a new runtime exception with the specified detail message. 
+RuntimeException(String message, Throwable cause) 
+          Constructs a new runtime exception with the specified detail message and cause. 
+RuntimeException(Throwable cause) 
+          Constructs a new runtime exception with the specified cause and a detail message of (cause==null ? null : cause.toString()) (which typically contains the class and detail message of cause). 
+          */
+
 }

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/adapter/Adapter.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/adapter/Adapter.java?view=diff&r1=158861&r2=158862
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/adapter/Adapter.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/adapter/Adapter.java Wed Mar 23 18:30:30 2005
@@ -17,39 +17,236 @@
  */
 package org.apache.geronimo.interop.adapter;
 
-import org.apache.geronimo.interop.rmi.iiop.ObjectRef;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Vector;
+
 import org.apache.geronimo.interop.rmi.iiop.RemoteInterface;
-import org.openejb.EJBContainer;
 
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
 
-public abstract class Adapter
-{
-    public abstract Object getAdapterID();
-    public abstract String[] getBindNames();
+public class Adapter {
+    //
+    // Public Accessible Properties
+    //
+    protected String _bindName;
+    protected String _remoteClassName;
+    protected String _remoteInterfaceName;
+    protected Vector _idVector;
+    protected boolean _shared;
+    protected ClassLoader _cl;
+    protected RemoteInterface _ri;
+
+    //
+    // Internal Properrties
+    //
+
+    protected Object _sharedObject;
+    protected HashMap _objects;
+    protected Class _remoteClassClass;
+    protected Class _remoteInterfaceClass;
+
+    public Adapter() {
+        _objects = new HashMap();
+        _idVector = new Vector();
+    }
 
-    public abstract void start();
-    public abstract void stop();
+    /*
+     * BindName is the name that will be registered with the INS (Inter-operable Name Service)
+     */
+    public String getBindName() {
+        return _bindName;
+    }
 
-    public abstract ObjectRef getObjectRef();
+    public void setBindName(String bindName) {
+        _bindName = bindName;
+    }
 
-    public abstract Object getServant();
-    public abstract EJBContainer getEJBContainer();
-    public abstract Object getEJBHome();
+    /*
+     * Is this a shared component?  If so this will invoke the getInstance method on
+     * the component ...
+     */
+    public boolean isShared() {
+        return _shared;
+    }
 
-    public abstract void invoke(java.lang.String methodName, byte[] objectKey, org.apache.geronimo.interop.rmi.iiop.ObjectInputStream input, org.apache.geronimo.interop.rmi.iiop.ObjectOutputStream output);
+    public void setShared(boolean shared) {
+        _shared = shared;
+    }
 
+    /*
+     * 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;
+    }
 
-    protected Class loadClass( String className, ClassLoader cl )
-    {
-        Class rc = null;
-        try {
-            rc = cl.loadClass(className);
-        } catch (ClassNotFoundException e) {
-            e.printStackTrace();  
+    public void setClassLoader(ClassLoader cl) {
+        _cl = 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 String getRemoteClassName() {
+        return _remoteClassName;
+    }
+
+    public void setRemoteClassName(String rcName) {
+        _remoteClassName = rcName;
+    }
+
+    /*
+     * 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 String getRemoteInterfaceName() {
+        return _remoteInterfaceName;
+    }
+
+    public void setRemoteInterfaceName(String riName) {
+        _remoteInterfaceName = riName;
+    }
+
+    /*
+     * A list of public IDs that the remote object implements:
+     *
+     * IDL:....:1.0
+     * RMI:....:X:Y
+     */
+    public Vector getIds() {
+        return _idVector;
+    }
+
+    public void addId(String id) {
+        _idVector.add(id);
+    }
+
+    public void removeId(String id) {
+        _idVector.remove(id);
+    }
+
+    /*
+     * Return the skeleton implemention for the remote interface.  This interface has the
+     * invoke method to handle the rmi/iiop messages.
+     */
+    public RemoteInterface getRemoteInterface() {
+        if (_ri == null) {
+            synchronized (this) {
+                String riName = _remoteInterfaceName + "_Skeleton";
+                _remoteInterfaceClass = loadClass(riName);
+
+                try {
+                    _ri = (RemoteInterface) _remoteInterfaceClass.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;
+
+        if (_remoteClassClass == null) {
+            synchronized (this) {
+                _remoteClassClass = loadClass(_remoteClassName);
+            }
+
+            try {
+                if (_shared) {
+                    synchronized (this) {
+                        Method m = _remoteClassClass.getMethod("getInstance", (Class[]) null);
+                        o = m.invoke(_remoteClassClass, (Object[]) null);
+
+                        if (o != null) {
+                            _objects.put(key, o);
+                        }
+                    }
+                } else {
+                    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.
+            } catch (NoSuchMethodException e) {
+                e.printStackTrace();
+            } catch (InvocationTargetException e) {
+                e.printStackTrace();
+            }
+        }
+
+        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 Adapter, 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));
         }
-        return rc;
     }
 
+    /*
+     * Helper function to load a class.  This uses classloader for the adapter.
+     */
+    protected Class loadClass(String name) {
+        Class c = null;
+
+        try {
+            c = _cl.loadClass(name);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return c;
+    }
 }

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/adapter/AdapterManager.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/adapter/AdapterManager.java?view=diff&r1=158861&r2=158862
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/adapter/AdapterManager.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/adapter/AdapterManager.java Wed Mar 23 18:30:30 2005
@@ -17,176 +17,27 @@
  */
 package org.apache.geronimo.interop.adapter;
 
-import org.openejb.EJBContainer;
-import org.openejb.EJBComponentType;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.geronimo.gbean.*;
-import org.apache.geronimo.interop.naming.NameService;
-
-import java.util.HashMap;
-import java.util.Collection;
-import java.util.Collections;
-
-public class AdapterManager implements ReferenceCollectionListener {
-
-    private final Log       log = LogFactory.getLog(AdapterManager.class);
-    private HashMap         homeAdapters;
-    private HashMap         remoteAdapters;
-    private Collection      containers = Collections.EMPTY_SET;
-    private ClassLoader     classLoader;
-
-    private NameService     nameService = NameService.getInstance();
-
-    /*
-     * This is a singleton GBean.  Do not reference it directly, but use a
-     * GBean reference to get it.
-     */
-    public AdapterManager()
-    {
-        this.homeAdapters = null;
-        this.remoteAdapters = null;
-        this.containers = null;
-        this.classLoader = null;
-    }
-
-    public AdapterManager( ClassLoader classLoader, Collection containers ) {
-        log.debug( "AdapterManager(): containers = " + containers );
-
-        this.classLoader = classLoader;
-
-        ReferenceCollection ref = (ReferenceCollection) containers;
-        ref.addReferenceCollectionListener(this);
-
-        this.containers = containers;
-
-        int len = ( containers != null ? containers.size() : 20 );
-        homeAdapters = new HashMap( len );
-        remoteAdapters = new HashMap( len );
-
-        // Todo: Add the containers .. invoke memberAdded for each element in containers.
-
-        registerNameServer();
-    }
-
-    protected void registerNameServer()
-    {
-        //
-        // NameService
-        //
-
-        String bindNames[] = new String[] { "NameService" };
-        String remoteClassName = "org.apache.geronimo.interop.rmi.iiop.server.ServerNamingContext";
-        //String remoteInterfaceName = "org.apache.geronimo.interop.rmi.iiop.NameService";
-        String remoteInterfaceName = "org.apache.geronimo.interop.CosNaming.NamingContext";
-        String ids[] = new String[] { "IDL:omg.org/CosNaming/NamingContext:1.0",
-                                      "IDL:omg.org/CosNaming/NamingContextExt:1.0" };                                      
-        ClassLoader cl = this.getClass().getClassLoader();
-
-        CorbaAdapter a = new CorbaAdapter( bindNames, ids, remoteClassName, remoteInterfaceName, cl );
-        a.start();
-        registerRemoteAdapter(a);
-    }
-
-    protected Adapter getAdapter( Object adapterID ) {
-        // more likely to be using the remoteadapter...
-        Adapter rc = getRemoteAdapter( adapterID );
-        if (rc == null)
-        {
-            rc = getHomeAdapter( adapterID );
-        }
-        return rc;
-    }
-
-    protected Adapter getHomeAdapter( Object adapterID )
-    {
-        return (Adapter)homeAdapters.get( adapterID );
-    }
+import java.util.Hashtable;
 
-    protected Adapter getRemoteAdapter( Object adapterID )
-    {
-        return (Adapter)remoteAdapters.get( adapterID );
-    }
-
-    protected void registerHomeAdapter( Adapter adapter )
-    {
-        homeAdapters.put( adapter.getAdapterID(), adapter );
-    }
-
-    protected void registerRemoteAdapter( Adapter adapter )
-    {
-        remoteAdapters.put( adapter.getAdapterID(), adapter );
-    }
 
-    protected void unregisterHomeAdapter( Adapter adapter )
-    {
-        homeAdapters.remove( adapter.getAdapterID() );
-    }
+public class AdapterManager {
+    protected Hashtable _adapters;
+    protected static AdapterManager _me = new AdapterManager();
 
-    protected void unregisterRemoteAdapter( Adapter adapter )
-    {
-        remoteAdapters.remove( adapter.getAdapterID() );
+    protected AdapterManager() {
+        _adapters = new Hashtable();
     }
 
-    public void memberAdded(ReferenceCollectionEvent event) {
-        EJBContainer container = (EJBContainer) event.getMember();
-
-        log.debug( "AdapterManager.memberAdded(): container = " + container );
-        log.debug( "AdapterManager.memberAdded(): containerID = " + container.getContainerID() );
-
-        switch (container.getProxyInfo().getComponentType()) {
-            case EJBComponentType.STATELESS:
-                //generator = new AdapterStateless(container, orb, poa, tieLoader);
-                break;
-            case EJBComponentType.STATEFUL:
-                //generator = new AdapterStateful(container, orb, poa, tieLoader);
-                break;
-            case EJBComponentType.BMP_ENTITY:
-            case EJBComponentType.CMP_ENTITY:
-                //generator = new AdapterEntity(container, orb, poa, tieLoader);
-                break;
-            default:
-                // throw new CORBAException("CORBA HomeAdapter does not handle MDB containers");
-        }
-
-        Adapter adapter = new HomeAdapter( container );
-        adapter.start();
-        registerHomeAdapter( adapter );
-
-        adapter = new RemoteAdapter( container );
-        adapter.start();
-        registerRemoteAdapter( adapter );
+    public static AdapterManager getInstance() {
+        return _me;
     }
 
-    public void memberRemoved(ReferenceCollectionEvent event) {
-        EJBContainer container = (EJBContainer) event.getMember();
-
-        log.debug( "AdapterManager.memberRemoved(): container = " + container );
-        log.debug( "AdapterManager.memberRemoved(): containerID = " + container.getContainerID() );
-
-        Adapter adapter = getHomeAdapter( container.getContainerID() );
-        adapter.stop();
-        unregisterHomeAdapter( adapter );
-
-        adapter = getRemoteAdapter( container.getContainerID() );
-        adapter.stop();
-        unregisterRemoteAdapter( adapter );
-    }
-
-    public static final GBeanInfo GBEAN_INFO;
-
-    static {
-        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder(AdapterManager.class);
-
-        infoFactory.addAttribute("classLoader", ClassLoader.class, false);
-        infoFactory.addReference("containers", EJBContainer.class);
-
-        infoFactory.setConstructor(new String[]{"classLoader", "containers"});
+    public void registerAdapter(Adapter a) {
 
-        GBEAN_INFO = infoFactory.getBeanInfo();
+        _adapters.put(a.getBindName(), a);
     }
 
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
+    public Adapter getAdapter(String objectName) {
+        return (Adapter) _adapters.get(objectName);
     }
 }

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=158861&r2=158862
==============================================================================
--- 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 Wed Mar 23 18:30:30 2005
@@ -21,9 +21,10 @@
 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=158861&r2=158862
==============================================================================
--- 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 Wed Mar 23 18:30:30 2005
@@ -19,41 +19,43 @@
 
 import java.io.File;
 
+
 public abstract class CodeWriter {
-    private GenOptions  genOptions;    
-    private String      fileName;
-    private String      fileExt = ".java";
+    protected GenOptions _genOptions;
+
+    protected File _file;
 
-    protected File        file;
+    protected String _fileName;
+    protected String _fileExt = ".java";
 
     public CodeWriter(GenOptions genOptions, String fileName, String ext) {
-        this.genOptions = genOptions;
-        this.fileName = fileName;
-        fileExt = ext;
+        _genOptions = genOptions;
+        _fileName = fileName;
+        _fileExt = ext;
     }
 
     public GenOptions getGenOptions() {
-        return genOptions;
+        return _genOptions;
     }
 
     public void setGenOptions(GenOptions genOptions) {
-        this.genOptions = genOptions;
+        _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=158861&r2=158862
==============================================================================
--- 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 Wed Mar 23 18:30:30 2005
@@ -17,6 +17,12 @@
  */
 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=158861&r2=158862
==============================================================================
--- 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 Wed Mar 23 18:30:30 2005
@@ -17,134 +17,42 @@
  */
 package org.apache.geronimo.interop.generator;
 
-import org.apache.geronimo.interop.rmi.iiop.compiler.StubCompiler;
+public class GenOptions {
+    protected String _genDir = "./";
+    protected boolean _overwrite = false;
+    protected boolean _verbose = false;
 
-import java.util.List;
-import java.util.LinkedList;
-import java.util.Iterator;
+    public GenOptions() {
+    }
 
-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 GenOptions(String genDir, boolean overwrite, boolean verbose) {
+        _genDir = genDir;
+        _overwrite = overwrite;
+        _verbose = verbose;
     }
 
-    public String getGenSrcDir() {
-        return genSrcDir;
+    public String getGenDir() {
+        return _genDir;
     }
 
-    public String getGenClassDir() {
-        return genClassDir;
+    public void setGenDir(String genDir) {
+        _genDir = genDir;
     }
 
     public boolean isOverwrite() {
-        return overwrite;
+        return _overwrite;
     }
 
-    public boolean isVerbose() {
-        return verbose;
+    public void setOverwrite(boolean overwrite) {
+        _overwrite = overwrite;
     }
 
-    public boolean isSimpleIdl() {
-        return simpleidl;
+    public boolean isVerbose() {
+        return _verbose;
     }
 
-    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]);
-            }
-        }
+    public void setVerbose(boolean verbose) {
+        _verbose = verbose;
     }
+
 }

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=158861&r2=158862
==============================================================================
--- 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 Wed Mar 23 18:30:30 2005
@@ -19,21 +19,22 @@
 
 import java.util.Vector;
 
+
 public class JBlockStatement extends JStatement {
-    private Vector    localVars;
-    private Vector    statements;
+    protected Vector _localVars;
+    protected 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) {
@@ -45,26 +46,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=158861&r2=158862
==============================================================================
--- 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 Wed Mar 23 18:30:30 2005
@@ -17,30 +17,33 @@
  */
 package org.apache.geronimo.interop.generator;
 
+
+
+
 public class JCaseStatement extends JStatement {
-    private JExpression       expr;
-    private JBlockStatement   statements;
+    protected JExpression _expr;
+    protected 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=158861&r2=158862
==============================================================================
--- 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 Wed Mar 23 18:30:30 2005
@@ -18,19 +18,19 @@
 package org.apache.geronimo.interop.generator;
 
 public class JCatchStatement extends JBlockStatement {
-    private JVariable     var;
+    protected 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,3 +56,69 @@
         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=158861&r2=158862
==============================================================================
--- 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 Wed Mar 23 18:30:30 2005
@@ -20,27 +20,31 @@
 import java.lang.reflect.Modifier;
 import java.util.Vector;
 
+
 public class JClass extends JEntity {
-    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 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;
 
     protected JClass(String name) {
         super(name, Modifier.PUBLIC);
 
-        imports = new Vector();
-        impls = new Vector();
-        baseClassName = "";
-
-        constructors = new Vector();
-        methods = new Vector();
-        fields = new Vector();
+        _imports = new Vector();
+        _implements = new Vector();
+        _baseClassName = "";
+
+        _constructors = new Vector();
+        _methods = new Vector();
+        _fields = new Vector();
     }
 
     protected JClass(String name, JPackage pkg) {
@@ -50,43 +54,63 @@
             pkg = new JPackage("");
         }
 
-        this.pkg = pkg;
+        _pkg = pkg;
     }
 
     protected JClass(String name, JClass parent) {
         this(name);
 
-        this.parent = parent;
+        _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);
+        _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 );
         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) {
@@ -119,36 +143,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();
         }
@@ -163,23 +187,23 @@
     }
 
     public void setBaseClassName(String bcl) {
-        baseClassName = bcl;
+        _baseClassName = bcl;
     }
 
     public String getBaseClassName() {
-        return baseClassName;
+        return _baseClassName;
     }
 
     public void addImplements(String className) {
-        impls.add(className);
+        _implements.add(className);
     }
 
     public void removeImplements(String className) {
-        impls.remove(className);
+        _implements.remove(className);
     }
 
     public Vector getImplements() {
-        return impls;
+        return _implements;
     }
 
     /*
@@ -202,7 +226,7 @@
     }
 
     public void addImport(String fqName) {
-        imports.add(fqName);
+        _imports.add(fqName);
     }
 
     public void removeImport(Package pkg, String itemName) {
@@ -222,10 +246,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=158861&r2=158862
==============================================================================
--- 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 Wed Mar 23 18:30:30 2005
@@ -17,14 +17,17 @@
  */
 package org.apache.geronimo.interop.generator;
 
+
+
+
 public class JCodeStatement extends JStatement {
-    private String    code;
+    protected String _code;
 
     public JCodeStatement(String code) {
-        this.code = code;
+        _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=158861&r2=158862
==============================================================================
--- 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 Wed Mar 23 18:30:30 2005
@@ -17,6 +17,9 @@
  */
 package org.apache.geronimo.interop.generator;
 
+
+
+
 public class JConstructor extends JMethod {
     protected JConstructor(String name) {
         super(name);
@@ -25,4 +28,11 @@
     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=158861&r2=158862
==============================================================================
--- 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 Wed Mar 23 18:30:30 2005
@@ -18,31 +18,31 @@
 package org.apache.geronimo.interop.generator;
 
 public class JDeclareStatement extends JStatement {
-    private JVariable         v;
-    private JExpression       initExpr;
+    protected JVariable _v;
+    protected JExpression _initExpr;
 
     public JDeclareStatement(JVariable v) {
         this(v, null);
     }
 
     public JDeclareStatement(JVariable v, JExpression initExpr) {
-        this.v = v;
-        this.initExpr = initExpr;
+        _v = v;
+        _initExpr = initExpr;
     }
 
     public void setVariable(JVariable s) {
-        v = s;
+        _v = s;
     }
 
     public JVariable getVariable() {
-        return v;
+        return _v;
     }
 
     public void setInitExpression(JExpression initExpr) {
-        this.initExpr = initExpr;
+        _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=158861&r2=158862
==============================================================================
--- 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 Wed Mar 23 18:30:30 2005
@@ -17,72 +17,55 @@
  */
 package org.apache.geronimo.interop.generator;
 
-import java.lang.reflect.Modifier;
-
 public class JEntity {
-    private String    name;
-    private int       modifiers;
-    private JEntity   parent;
+    protected String _name;
+    protected int _modifiers;
+    protected JEntity _parent;
 
     public JEntity(String name) {
-        this(name, Modifier.PUBLIC);
+        this(name, 0);
     }
 
     public JEntity(String name, int modifiers) {
-        this.name = name;
-        this.modifiers = modifiers;
+        _name = name;
+        _modifiers = modifiers;
     }
 
     public JEntity getParent() {
-        return parent;
+        return _parent;
     }
 
     public void setParent(JEntity parent) {
-        this.parent = parent;
+        _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.
      */
-    protected void adjustModifier(int modifier, boolean value) {
+    public void setModifier(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) {
-        this.modifiers = modifiers;
+        _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=158861&r2=158862
==============================================================================
--- 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 Wed Mar 23 18:30:30 2005
@@ -18,17 +18,17 @@
 package org.apache.geronimo.interop.generator;
 
 public class JExpression extends JStatement {
-    private JStatement    statement;
+    protected 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=158861&r2=158862
==============================================================================
--- 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 Wed Mar 23 18:30:30 2005
@@ -17,24 +17,27 @@
  */
 package org.apache.geronimo.interop.generator;
 
+
+
+
 public class JFinallyStatement extends JStatement {
-    private JBlockStatement   finallyStatements;
-    private boolean           hasStatements = false;
+    protected JBlockStatement _finallyStatements;
+    protected 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=158861&r2=158862
==============================================================================
--- 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 Wed Mar 23 18:30:30 2005
@@ -17,27 +17,30 @@
  */
 package org.apache.geronimo.interop.generator;
 
+
+
+
 public class JForStatement extends JBlockStatement {
-    private JStatement    initStmt;
-    private JExpression   loopExpr;
-    private JStatement    iterStmt;
+    protected JStatement _initStmt;
+    protected JExpression _loopExpr;
+    protected 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=158861&r2=158862
==============================================================================
--- 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 Wed Mar 23 18:30:30 2005
@@ -19,47 +19,48 @@
 
 import java.util.Vector;
 
+
 public class JIfElseIfElseStatement extends JStatement {
-    private JIfStatement      ifStatement;
-    private Vector            elseifStatements;
-    private JElseStatement    elseStatement;
+    protected JIfStatement _ifStatement;
+    protected Vector _elseifStatements;
+    protected 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;
@@ -70,7 +71,7 @@
 
         if (rc == null) {
             rc = new JElseIfStatement(e);
-            elseifStatements.add(rc);
+            _elseifStatements.add(rc);
         }
 
         return rc;
@@ -87,6 +88,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=158861&r2=158862
==============================================================================
--- 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 Wed Mar 23 18:30:30 2005
@@ -18,19 +18,19 @@
 package org.apache.geronimo.interop.generator;
 
 public class JIfStatement extends JBlockStatement {
-    private JExpression   expr;
+    protected 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=158861&r2=158862
==============================================================================
--- 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 Wed Mar 23 18:30:30 2005
@@ -20,19 +20,22 @@
 import java.lang.reflect.Modifier;
 import java.util.Vector;
 
+
 public class JMethod extends JEntity {
-    private JReturnType       rt;
-    private JParameter        parms[];
-    private Class             thrown[];
-    private Vector            statements;
-    private JBlockStatement   bodyBlockStatement;
-    private String            body;  // Yuck
+    protected JReturnType _rt;
+    protected JParameter _parms[];
+    protected Class _thrown[];
+
+    protected Vector _statements;
+    protected JBlockStatement _bodyBlockStatement;
+
+    protected 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[]) {
@@ -44,58 +47,87 @@
     }
 
     public void setRT(JReturnType jt) {
-        rt = jt;
+        _rt = jt;
     }
 
     public JReturnType getRT() {
-        return rt;
+        return _rt;
     }
 
     public void setParms(JParameter parms[]) {
-        this.parms = parms;
+        _parms = parms;
     }
 
     public JParameter[] getParms() {
-        return parms;
+        return _parms;
     }
 
     public void setThrown(Class thrown[]) {
-        this.thrown = 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;
+        }
+        */
     }
 
     public Class[] getThrown() {
-        return thrown;
+        return _thrown;
+    }
+
+    /*
+    public void setThrownType( String thrownType[] )
+    {
+        _thrownType = thrownType;
+        _thrown = null;
+    }
+
+    public String[] getThrownType()
+    {
+        return _thrownType;
     }
+    */
 
     public void setBody(String body) {
-        this.body = body;
+        _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=158861&r2=158862
==============================================================================
--- 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 Wed Mar 23 18:30:30 2005
@@ -19,8 +19,9 @@
 
 import java.util.Vector;
 
+
 public class JPackage extends JEntity {
-    private Vector    classes = new Vector();
+    protected Vector _classes = new Vector();
 
     public JPackage(String name) {
         super(name);
@@ -28,15 +29,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=158861&r2=158862
==============================================================================
--- 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 Wed Mar 23 18:30:30 2005
@@ -17,9 +17,73 @@
  */
 package org.apache.geronimo.interop.generator;
 
-public class JReturnType extends JType {
+public class JReturnType {
+    protected Class _type;
+    protected String _typeName;
+    protected boolean _isArray;
 
     public JReturnType(Class type) {
-        super(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;
     }
 }

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=158861&r2=158862
==============================================================================
--- 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 Wed Mar 23 18:30:30 2005
@@ -19,29 +19,30 @@
 
 import java.util.Vector;
 
+
 public class JSwitchStatement extends JStatement {
-    private JExpression       switchExpr;
-    private Vector            caseStatements;
+    protected JExpression _switchExpr;
+    protected 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;
@@ -52,7 +53,7 @@
 
         if (rc == null) {
             rc = new JCaseStatement(e);
-            caseStatements.add(rc);
+            _caseStatements.add(rc);
         }
 
         return rc;
@@ -69,6 +70,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=158861&r2=158862
==============================================================================
--- 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 Wed Mar 23 18:30:30 2005
@@ -19,31 +19,32 @@
 
 import java.util.Vector;
 
+
 public class JTryCatchFinallyStatement extends JStatement {
-    private JTryStatement         tryStatement;
-    private Vector                catchStatements;
-    private JFinallyStatement     finallyStatement;
+    protected JTryStatement _TryStatement;
+    protected Vector _catchStatements;
+    protected 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;
@@ -54,7 +55,7 @@
 
         if (rc == null) {
             rc = new JCatchStatement(v);
-            catchStatements.add(rc);
+            _catchStatements.add(rc);
         }
 
         return rc;
@@ -71,14 +72,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=158861&r2=158862
==============================================================================
--- 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 Wed Mar 23 18:30:30 2005
@@ -22,3 +22,33 @@
         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

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=158861&r2=158862
==============================================================================
--- 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 Wed Mar 23 18:30:30 2005
@@ -19,30 +19,43 @@
 
 import java.util.HashMap;
 
-public class JVariable extends JType {
-    private String            name;
-    private JExpression       initExpr;
+
+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 JVariable(Class type, String name) {
-        super(type);
-        this.name = name;
+        super(name);
+        setType(type);
+    }
+
+    public void setType(Class type) {
+        _type = type;
+        calculateTypeDecl();
+    }
+
+    public Class getType() {
+        return _type;
     }
 
-    public String getName()
-    {
-        return name;
+    public String getTypeDecl() {
+        return _typeDecl;
     }
 
     public void setInitExpression(JExpression initExpr) {
-        this.initExpr = initExpr;
+        _initExpr = initExpr;
     }
 
     public JExpression getInitExpression() {
-        return initExpr;
+        return _initExpr;
     }
 
     public int hashCode() {
-        return super.hashCode() + name.hashCode();
+        return _type.hashCode() + _name.hashCode();
     }
 
     public boolean equals(Object other) {
@@ -53,10 +66,66 @@
         } else if (other instanceof JVariable) {
             JVariable v = (JVariable) other;
 
-            rc = super.equals(other);
-            if (rc)
-            {
-                v.getName().equals(name);
+            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);
+                }
             }
         }
 
@@ -64,8 +133,37 @@
     }
 
     protected void showTypeInfo() {
-        System.out.println("getName() = " + name);
-        super.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 + "'");
+        }
     }
 
+    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=158861&r2=158862
==============================================================================
--- 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 Wed Mar 23 18:30:30 2005
@@ -21,19 +21,20 @@
 import java.lang.reflect.Modifier;
 import java.util.Vector;
 
+
 public class JavaGenerator implements Generator {
-    private GenOptions      genOptions;
+    protected GenOptions _genOptions;
 
     public JavaGenerator(GenOptions genOptions) {
-        this.genOptions = genOptions;
+        _genOptions = genOptions;
     }
 
     public GenOptions getGenOptions() {
-        return genOptions;
+        return _genOptions;
     }
 
     public void setGenOptions(GenOptions genOptions) {
-        this.genOptions = genOptions;
+        _genOptions = genOptions;
     }
 
     public void generate(JEntity e) {
@@ -69,7 +70,7 @@
 
         String fullName = pkgName + "/" + className;
 
-        JavaWriter jw = new JavaWriter(genOptions, fullName, ".java");
+        JavaWriter jw = new JavaWriter(_genOptions, fullName, ".java");
 
         jw.openFile();
         writeClass(jw, c);
@@ -212,7 +213,13 @@
         if (m instanceof JConstructor) {
             jw.print(c.getName());
         } else {
-            jw.print(m.getRT().getTypeDecl());
+            //jw.print( m.getRCType() + " " + m.getName() );
+            jw.print(m.getRT().getTypeName());
+
+            if (m.getRT().isArray()) {
+                jw.print("[]");
+            }
+
             jw.print(" " + m.getName());
         }
         jw.print("(");

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JavaWriter.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JavaWriter.java?view=diff&r1=158861&r2=158862
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JavaWriter.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/generator/JavaWriter.java Wed Mar 23 18:30:30 2005
@@ -23,13 +23,16 @@
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 
+
 public class JavaWriter extends CodeWriter {
-    private GenOptions      genOptions;
-    private PrintWriter     pw;
-    private boolean         needIndent = true;
-    private int             indentPos = 0;
-    private String          indentStr = "";
-    private String          spaces = "                                                        ";
+    protected GenOptions _genOptions;
+
+    protected PrintWriter _pw;
+
+    protected boolean _needIndent = true;
+    protected int _indentPos = 0;
+    protected String _indentStr = "";
+    protected String _spaces = "                                                        ";
 
     public JavaWriter(GenOptions genOptions, String fileName, String ext) {
         super(genOptions, fileName, ext);
@@ -42,15 +45,15 @@
         String fileName = getFileName() + getFileExt();
 
         try {
-            file = new File(go.getGenSrcDir(), fileName);
+            file = new File(go.getGenDir(), fileName);
 
             if (file.exists() && !go.isOverwrite()) {
                 fileName = fileName + ".new";
 
-                file = new File(go.getGenSrcDir(), fileName);
+                file = new File(go.getGenDir(), fileName);
             }
         } catch (Exception ex) {
-            throw new GenException("Error: Unable to open output dir: " + go.getGenSrcDir() + ", file: " + fileName, ex);
+            throw new GenException("Error: Unable to open output dir: " + go.getGenDir() + ", file: " + fileName, ex);
         }
 
         return file;
@@ -60,96 +63,96 @@
             throws GenException {
         OutputStream os = null;
 
-        if (file != null) {
+        if (_file != null) {
             //System.out.println( "Output file already opened" );
             return;
         }
 
-        file = getFile();
+        _file = getFile();
 
-        if (file == null) {
+        if (_file == null) {
             throw new GenException("Error: Unable to obtain output file.");
         }
 
         if (getGenOptions().isVerbose()) {
-            System.out.println("Generating: " + file);
+            System.out.println("Generating: " + _file);
         }
 
         os = null;
 
         //if (_file.isFile())
         //{
-        file.getParentFile().mkdirs();
+        _file.getParentFile().mkdirs();
         //}
 
-        if (file.exists() && !file.canWrite()) {
-            throw new GenException("Error: Unable to write to file: " + file);
+        if (_file.exists() && !_file.canWrite()) {
+            throw new GenException("Error: Unable to write to file: " + _file);
         }
 
-        if (!file.exists() && !file.getParentFile().canWrite()) {
-            throw new GenException("Error: Unable to write to directory: " + file.getParentFile());
+        if (!_file.exists() && !_file.getParentFile().canWrite()) {
+            throw new GenException("Error: Unable to write to directory: " + _file.getParentFile());
         }
 
         try {
-            os = new FileOutputStream(file);
+            os = new FileOutputStream(_file);
         } catch (Exception ex) {
-            throw new GenException("Error: Unable to init output file: " + file, ex);
+            throw new GenException("Error: Unable to init output file: " + _file, ex);
         }
 
         try {
-            pw = new PrintWriter(new OutputStreamWriter(os));
+            _pw = new PrintWriter(new OutputStreamWriter(os));
         } catch (Exception ex) {
-            throw new GenException("Error: Unable to init output file: " + file, ex);
+            throw new GenException("Error: Unable to init output file: " + _file, ex);
         }
     }
 
     public void closeFile()
             throws GenException {
-        if (pw != null) {
+        if (_pw != null) {
             try {
-                pw.flush();
-                pw.close();
+                _pw.flush();
+                _pw.close();
             } catch (Exception e) {
-                throw new GenException("Error: Unable to close output file: " + file, e);
+                throw new GenException("Error: Unable to close output file: " + _file, e);
             }
 
-            pw = null;
+            _pw = null;
         }
 
-        file = null;
+        _file = null;
     }
 
     public void indent() {
-        indentPos += 4;
-        if (indentPos > spaces.length()) {
-            indentPos -= 4;
+        _indentPos += 4;
+        if (_indentPos > _spaces.length()) {
+            _indentPos -= 4;
         }
-        indentStr = spaces.substring(0, indentPos);
+        _indentStr = _spaces.substring(0, _indentPos);
     }
 
     public void outdent() {
-        indentPos -= 4;
-        if (indentPos < 0) {
-            indentPos = 0;
+        _indentPos -= 4;
+        if (_indentPos < 0) {
+            _indentPos = 0;
         }
-        indentStr = spaces.substring(0, indentPos);
+        _indentStr = _spaces.substring(0, _indentPos);
     }
 
     public void begin() {
-        needIndent = true;
+        _needIndent = true;
         println("{");
         indent();
     }
 
     public void end() {
         outdent();
-        needIndent = true;
+        _needIndent = true;
         println("}");
     }
 
     public void newln() {
         println("");
-        needIndent = true;
+        _needIndent = true;
     }
 
     public void comment(String msg) {
@@ -157,21 +160,21 @@
     }
 
     public void println(String line) {
-        if (needIndent) {
-            needIndent = false;
-            pw.print(indentStr);
+        if (_needIndent) {
+            _needIndent = false;
+            _pw.print(_indentStr);
         }
 
-        pw.println(line);
-        needIndent = true;
+        _pw.println(line);
+        _needIndent = true;
     }
 
     public void print(String line) {
-        if (needIndent) {
-            needIndent = false;
-            pw.print(indentStr);
+        if (_needIndent) {
+            _needIndent = false;
+            _pw.print(_indentStr);
         }
 
-        pw.print(line);
+        _pw.print(line);
     }
 }

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/naming/InitialContext.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/naming/InitialContext.java?view=diff&r1=158861&r2=158862
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/naming/InitialContext.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/naming/InitialContext.java Wed Mar 23 18:30:30 2005
@@ -29,10 +29,10 @@
 
 public class InitialContext implements Context, java.io.Serializable {
     private static HashMap EMPTY_MAP = new HashMap();
-    private String prefix;
+    private String _prefix;
 
     InitialContext(String prefix) {
-        this.prefix = prefix;
+        _prefix = prefix;
     }
 
     public HashMap getMap() {
@@ -53,7 +53,7 @@
         if (namingContext == null) {
             namingContext = NamingContext.getInstance(NameService.class);
         }
-        return namingContext.lookup(name, prefix);
+        return namingContext.lookup(name, _prefix);
     }
 
     public Object lookupReturnNullIfNotFound(String name) {
@@ -61,7 +61,7 @@
         if (namingContext == null) {
             return null;
         } else {
-            return namingContext.lookupReturnNullIfNotFound(name, prefix);
+            return namingContext.lookupReturnNullIfNotFound(name, _prefix);
         }
     }
 



Mime
View raw message