geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r158814 [4/9] - in geronimo/trunk/modules: assembly/ 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 Wed, 23 Mar 2005 17:56:59 GMT
Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/Any.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/Any.java?view=diff&r1=158813&r2=158814
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/Any.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/Any.java Wed Mar 23 09:56:34 2005
@@ -19,51 +19,85 @@
 
 import org.omg.CORBA.TCKind;
 
-
 /**
- * * An implementation of CORBA 'any' for the Sybase ORB.
+ * * An implementation of CORBA 'any'.
  */
-public class Any extends org.omg.CORBA.Any {
+public class Any
+    extends org.omg.CORBA.Any
+{
     private org.omg.CORBA.TypeCode _type;
 
     private byte[] _data;
 
-    private void extract_type(TCKind tk, String what) {
-        if (_type.kind().value() != tk.value()) {
+    /**
+     * @param tk
+     * @param what
+     */
+    private void extract_type(TCKind tk, String what)
+    {
+        if (_type.kind().value() != tk.value())
+        {
             throw new org.omg.CORBA.BAD_TYPECODE("com.sybase.CORBA.Any.extract_"
-                                                 + what + ": type = " + _type);
+                + what + ": type = " + _type);
         }
     }
 
-    public Any() {
+    /**
+     *
+     */
+    public Any()
+    {
         _type = TypeCode.NULL;
     }
 
-    public boolean equal(org.omg.CORBA.Any a) {
-        if (!_type.equal(a.type())) {
+    /**
+     * @param a
+     * @return
+     */
+    public boolean equal(org.omg.CORBA.Any a)
+    {
+        if (!_type.equal(a.type()))
+        {
             return false;
         }
-        if (a instanceof org.apache.geronimo.interop.rmi.iiop.Any) {
+        if (a instanceof org.apache.geronimo.interop.rmi.iiop.Any)
+        {
             org.apache.geronimo.interop.rmi.iiop.Any _that = (org.apache.geronimo.interop.rmi.iiop.Any) a;
             String x = org.apache.geronimo.interop.util.Base16Binary.toString(this._data);
             String y = org.apache.geronimo.interop.util.Base16Binary.toString(_that._data);
             return x.equals(y);
-        } else {
+        }
+        else
+        {
             // TODO: implement equality testing with other ORB's 'any' values
             throw new org.omg.CORBA.NO_IMPLEMENT("org.apache.geronimo.interop.rmi.iiop.Any.equal("
-                                                 + a.getClass().getName() + ")");
+                + a.getClass().getName() + ")");
         }
     }
 
-    public org.omg.CORBA.TypeCode type() {
+    /**
+     * @return
+     */
+    public org.omg.CORBA.TypeCode type()
+    {
         return _type;
     }
 
-    public void type(org.omg.CORBA.TypeCode type) {
+    /**
+     * @param type
+     */
+    public void type(org.omg.CORBA.TypeCode type)
+    {
         _type = type;
     }
 
-    public void read_value(org.omg.CORBA.portable.InputStream input, org.omg.CORBA.TypeCode type) {
+    /**
+     * @param input
+     * @param type
+     */
+    public void read_value(org.omg.CORBA.portable.InputStream input,
+                           org.omg.CORBA.TypeCode type)
+    {
         byte[] buffer = ((CdrInputStream) input)._buffer;
         int length = ((CdrInputStream) input)._length;
         _type = type;
@@ -71,247 +105,431 @@
         System.arraycopy(buffer, 0, _data, 0, length);
     }
 
-    public void write_value(org.omg.CORBA.portable.OutputStream output) {
+    /**
+     * @param output
+     */
+    public void write_value(org.omg.CORBA.portable.OutputStream output)
+    {
         // A no-op in this implementation.
     }
 
-    public org.omg.CORBA.portable.OutputStream create_output_stream() {
+    /**
+     * @return
+     */
+    public org.omg.CORBA.portable.OutputStream create_output_stream()
+    {
         _data = null;
         return CdrOutputStream.getInstance();
     }
 
-    public org.omg.CORBA.portable.InputStream create_input_stream() {
-        if (_data == null) {
-            throw new org.omg.CORBA.BAD_OPERATION("com.sybase.CORBA.Any.create_input_stream");
+    /**
+     * @return
+     */
+    public org.omg.CORBA.portable.InputStream create_input_stream()
+    {
+        if (_data == null)
+        {
+            throw new org.omg.CORBA.BAD_OPERATION(
+                "com.sybase.CORBA.Any.create_input_stream");
         }
         return CdrInputStream.getInstance();
     }
 
-    public short extract_short() {
+    /**
+     * @return
+     */
+    public short extract_short()
+    {
         extract_type(TCKind.tk_short, "short");
         return create_input_stream().read_short();
     }
 
-    public void insert_short(short value) {
+    /**
+     * @param value
+     */
+    public void insert_short(short value)
+    {
         org.omg.CORBA.portable.OutputStream output = create_output_stream();
         output.write_short(value);
         read_value(null, TypeCode.SHORT);
     }
 
-    public int extract_long() {
+    /**
+     * @return
+     */
+    public int extract_long()
+    {
         extract_type(TCKind.tk_long, "long");
         return create_input_stream().read_long();
     }
 
-    public void insert_long(int value) {
+    /**
+     * @param value
+     */
+    public void insert_long(int value)
+    {
         org.omg.CORBA.portable.OutputStream output = create_output_stream();
         output.write_long(value);
         read_value(null, TypeCode.LONG);
     }
 
-    public long extract_longlong() {
+    /**
+     * @return
+     */
+    public long extract_longlong()
+    {
         extract_type(TCKind.tk_longlong, "longlong");
         return create_input_stream().read_longlong();
     }
 
-    public void insert_longlong(long value) {
+    /**
+     * @param value
+     */
+    public void insert_longlong(long value)
+    {
         org.omg.CORBA.portable.OutputStream output = create_output_stream();
         output.write_longlong(value);
         read_value(null, TypeCode.LONGLONG);
     }
 
-    public short extract_ushort() {
+    /**
+     * @return
+     */
+    public short extract_ushort()
+    {
         extract_type(TCKind.tk_ushort, "ushort");
         return create_input_stream().read_ushort();
     }
 
-    public void insert_ushort(short value) {
+    /**
+     * @param value
+     */
+    public void insert_ushort(short value)
+    {
         org.omg.CORBA.portable.OutputStream output = create_output_stream();
         output.write_ushort(value);
         read_value(null, TypeCode.USHORT);
     }
 
-    public int extract_ulong() {
+    /**
+     * @return
+     */
+    public int extract_ulong()
+    {
         extract_type(TCKind.tk_ulong, "ulong");
         return create_input_stream().read_ulong();
     }
 
-    public void insert_ulong(int value) {
+    /**
+     * @param value
+     */
+    public void insert_ulong(int value)
+    {
         org.omg.CORBA.portable.OutputStream output = create_output_stream();
         output.write_ulong(value);
         read_value(null, TypeCode.ULONG);
     }
 
-    public long extract_ulonglong() {
+    /**
+     * @return
+     */
+    public long extract_ulonglong()
+    {
         extract_type(TCKind.tk_ulonglong, "ulonglong");
         return create_input_stream().read_ulonglong();
     }
 
-    public void insert_ulonglong(long value) {
+    /**
+     * @param value
+     */
+    public void insert_ulonglong(long value)
+    {
         org.omg.CORBA.portable.OutputStream output = create_output_stream();
         output.write_ulonglong(value);
         read_value(null, TypeCode.ULONGLONG);
     }
 
-    public float extract_float() {
+    /**
+     * @return
+     */
+    public float extract_float()
+    {
         extract_type(TCKind.tk_float, "float");
         return create_input_stream().read_float();
     }
 
-    public void insert_float(float value) {
+    /**
+     * @param value
+     */
+    public void insert_float(float value)
+    {
         org.omg.CORBA.portable.OutputStream output = create_output_stream();
         output.write_float(value);
         read_value(null, TypeCode.FLOAT);
     }
 
-    public double extract_double() {
+    /**
+     * @return
+     */
+    public double extract_double()
+    {
         extract_type(TCKind.tk_double, "double");
         return create_input_stream().read_double();
     }
 
-    public void insert_double(double value) {
+    /**
+     * @param value
+     */
+    public void insert_double(double value)
+    {
         org.omg.CORBA.portable.OutputStream output = create_output_stream();
         output.write_double(value);
         read_value(null, TypeCode.DOUBLE);
     }
 
-    public boolean extract_boolean() {
+    /**
+     * @return
+     */
+    public boolean extract_boolean()
+    {
         extract_type(TCKind.tk_boolean, "boolean");
         return create_input_stream().read_boolean();
     }
 
-    public void insert_boolean(boolean value) {
+    /**
+     * @param value
+     */
+    public void insert_boolean(boolean value)
+    {
         org.omg.CORBA.portable.OutputStream output = create_output_stream();
         output.write_boolean(value);
         read_value(null, TypeCode.BOOLEAN);
     }
 
-    public char extract_char() {
+    /**
+     * @return
+     */
+    public char extract_char()
+    {
         extract_type(TCKind.tk_char, "char");
         return create_input_stream().read_char();
     }
 
-    public void insert_char(char value) {
+    /**
+     * @param value
+     */
+    public void insert_char(char value)
+    {
         org.omg.CORBA.portable.OutputStream output = create_output_stream();
         output.write_char(value);
         read_value(null, TypeCode.CHAR);
     }
 
-    public char extract_wchar() {
+    /**
+     * @return
+     */
+    public char extract_wchar()
+    {
         extract_type(TCKind.tk_wchar, "wchar");
         return create_input_stream().read_wchar();
     }
 
-    public void insert_wchar(char value) {
+    /**
+     * @param value
+     */
+    public void insert_wchar(char value)
+    {
         org.omg.CORBA.portable.OutputStream output = create_output_stream();
         output.write_wchar(value);
         read_value(null, TypeCode.WCHAR);
     }
 
-    public byte extract_octet() {
+    /**
+     * @return
+     */
+    public byte extract_octet()
+    {
         extract_type(TCKind.tk_octet, "octet");
         return create_input_stream().read_octet();
     }
 
-    public void insert_octet(byte value) {
+    /**
+     * @param value
+     */
+    public void insert_octet(byte value)
+    {
         org.omg.CORBA.portable.OutputStream output = create_output_stream();
         output.write_octet(value);
         read_value(null, TypeCode.OCTET);
     }
 
-    public org.omg.CORBA.Any extract_any() {
+    /**
+     * @return
+     */
+    public org.omg.CORBA.Any extract_any()
+    {
         extract_type(TCKind.tk_any, "any");
         return create_input_stream().read_any();
     }
 
-    public void insert_any(org.omg.CORBA.Any value) {
+    /**
+     * @param value
+     */
+    public void insert_any(org.omg.CORBA.Any value)
+    {
         org.omg.CORBA.portable.OutputStream output = create_output_stream();
         output.write_any(value);
         read_value(null, TypeCode.ANY);
     }
 
-    public org.omg.CORBA.Object extract_Object() {
+    /**
+     * @return
+     */
+    public org.omg.CORBA.Object extract_Object()
+    {
         extract_type(TCKind.tk_objref, "Object");
         org.omg.CORBA.Object obj = create_input_stream().read_Object();
         return obj;
     }
 
-    public void insert_Object(org.omg.CORBA.Object value) {
+    /**
+     * @param value
+     */
+    public void insert_Object(org.omg.CORBA.Object value)
+    {
         org.omg.CORBA.portable.OutputStream output = create_output_stream();
         output.write_Object(value);
         read_value(null, TypeCode.OBJREF);
     }
 
-    public void insert_Object(org.omg.CORBA.Object value, org.omg.CORBA.TypeCode type) {
+    /**
+     * @param value
+     * @param type
+     */
+    public void insert_Object(org.omg.CORBA.Object value,
+                              org.omg.CORBA.TypeCode type)
+    {
         org.omg.CORBA.portable.OutputStream output = create_output_stream();
         output.write_Object(value);
         read_value(null, type);
     }
 
-    public java.io.Serializable extract_Value() {
+    /**
+     * @return
+     */
+    public java.io.Serializable extract_Value()
+    {
         throw new org.omg.CORBA.NO_IMPLEMENT();
     }
 
-    public void insert_Value(java.io.Serializable v) {
+    /**
+     * @param v
+     */
+    public void insert_Value(java.io.Serializable v)
+    {
         throw new org.omg.CORBA.NO_IMPLEMENT();
     }
 
-    public void insert_Value(java.io.Serializable v, org.omg.CORBA.TypeCode t) {
+    /**
+     * @param v
+     * @param t
+     */
+    public void insert_Value(java.io.Serializable v, org.omg.CORBA.TypeCode t)
+    {
         throw new org.omg.CORBA.NO_IMPLEMENT();
     }
 
-    public String extract_string() {
+    /**
+     * @return
+     */
+    public String extract_string()
+    {
         extract_type(TCKind.tk_string, "string");
         return create_input_stream().read_string();
     }
 
-    public void insert_string(String value) {
+    /**
+     * @param value
+     */
+    public void insert_string(String value)
+    {
         org.omg.CORBA.portable.OutputStream output = create_output_stream();
         output.write_string(value);
         read_value(null, TypeCode.STRING);
     }
 
-    public String extract_wstring() {
+    /**
+     * @return
+     */
+    public String extract_wstring()
+    {
         extract_type(TCKind.tk_wstring, "wstring");
         return create_input_stream().read_wstring();
     }
 
-    public void insert_wstring(String value) {
+    /**
+     * @param value
+     */
+    public void insert_wstring(String value)
+    {
         org.omg.CORBA.portable.OutputStream output = create_output_stream();
         output.write_wstring(value);
         read_value(null, TypeCode.WSTRING);
     }
 
-    public org.omg.CORBA.TypeCode extract_TypeCode() {
+    /**
+     * @return
+     */
+    public org.omg.CORBA.TypeCode extract_TypeCode()
+    {
         extract_type(TCKind.tk_TypeCode, "TypeCode");
         return create_input_stream().read_TypeCode();
     }
 
-    public void insert_TypeCode(org.omg.CORBA.TypeCode value) {
+    /**
+     * @param value
+     */
+    public void insert_TypeCode(org.omg.CORBA.TypeCode value)
+    {
         org.omg.CORBA.portable.OutputStream output = create_output_stream();
         output.write_TypeCode(value);
         read_value(null, TypeCode.TYPECODE);
     }
 
-    public org.omg.CORBA.Principal extract_Principal() {
-        throw new org.omg.CORBA.NO_IMPLEMENT("org.apache.geronimo.interop.rmi.iiop.Any.extract_Principal");
+    /**
+     * @return
+     */
+    public org.omg.CORBA.Principal extract_Principal()
+    {
+        throw new org.omg.CORBA.NO_IMPLEMENT(
+            "org.apache.geronimo.interop.rmi.iiop.Any.extract_Principal");
     }
 
-    public void insert_Principal(org.omg.CORBA.Principal value) {
-        throw new org.omg.CORBA.NO_IMPLEMENT("org.apache.geronimo.interop.rmi.iiop.Any.insert_Principal");
+    public void insert_Principal(org.omg.CORBA.Principal value)
+    {
+        throw new org.omg.CORBA.NO_IMPLEMENT(
+            "org.apache.geronimo.interop.rmi.iiop.Any.insert_Principal");
     }
 
     // Don't implement insert_Streamable and extract_Streamable since from
     // a TypeCode it appears to be impossible to determine the holder class
     // name (in the general case) in order to construct a Streamable object
     // for return from extract_Streamable.
-
+    /**
+     * @return
+     * @throws org.omg.CORBA.BAD_INV_ORDER
+     */
     public org.omg.CORBA.portable.Streamable extract_Streamable()
-            throws org.omg.CORBA.BAD_INV_ORDER {
+        throws org.omg.CORBA.BAD_INV_ORDER
+    {
         throw new org.omg.CORBA.NO_IMPLEMENT();
     }
 
-    public void insert_Streamable(org.omg.CORBA.portable.Streamable s) {
+    /**
+     * @param s
+     */
+    public void insert_Streamable(org.omg.CORBA.portable.Streamable s)
+    {
         throw new org.omg.CORBA.NO_IMPLEMENT();
     }
 
@@ -323,16 +541,28 @@
      * * Construct an Any from a TypeCode and a String value
      * * (supported for boolean and numeric primitive IDL types only).
      */
-    public Any(org.omg.CORBA.TypeCode type, String value) {
-        try {
+    /**
+     * @param type
+     * @param value
+     */
+    public Any(org.omg.CORBA.TypeCode type, String value)
+    {
+        try
+        {
             _type = type;
-            switch (_type.kind().value()) {
+            switch (_type.kind().value())
+            {
                 case TCKind._tk_boolean:
-                    if (value.equals("0")) {
+                    if (value.equals("0"))
+                    {
                         insert_boolean(false);
-                    } else if (value.equals("1")) {
+                    }
+                    else if (value.equals("1"))
+                    {
                         insert_boolean(true);
-                    } else {
+                    }
+                    else
+                    {
                         insert_boolean(Boolean.valueOf(value).booleanValue());
                     }
                     break;
@@ -371,22 +601,40 @@
                 default:
                     throw new org.omg.CORBA.BAD_PARAM(value);
             }
-        } catch (NumberFormatException nfe) {
+        }
+        catch (NumberFormatException nfe)
+        {
             throw new org.omg.CORBA.BAD_PARAM(value + " - " + nfe.toString());
         }
     }
 
-    private long parse(String value, long min, long max) throws NumberFormatException {
+    /**
+     * @param value
+     * @param min
+     * @param max
+     * @return
+     * @throws NumberFormatException
+     */
+    private long parse(String value, long min, long max)
+        throws NumberFormatException
+    {
         long n = Long.parseLong(value);
-        if (n < min || n > max) {
-            throw new NumberFormatException(value + " is not in range ["
-                                            + min + ".." + max + "]");
+        if (n < min || n > max)
+        {
+            throw new NumberFormatException(value +
+                " is not in range ["
+                + min + ".." + max + "]");
         }
         return n;
     }
 
-    public String toString() {
-        switch (_type.kind().value()) {
+    /**
+     * @return
+     */
+    public String toString()
+    {
+        switch (_type.kind().value())
+        {
             case TCKind._tk_any:
             case TCKind._tk_boolean:
             case TCKind._tk_char:
@@ -410,8 +658,13 @@
         }
     }
 
-    private String value() {
-        switch (_type.kind().value()) {
+    /**
+     * @return
+     */
+    private String value()
+    {
+        switch (_type.kind().value())
+        {
             case TCKind._tk_any:
                 return "" + extract_any();
             case TCKind._tk_boolean:

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/ArrayHelper.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/ArrayHelper.java?view=diff&r1=158813&r2=158814
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/ArrayHelper.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/ArrayHelper.java Wed Mar 23 09:56:34 2005
@@ -17,42 +17,61 @@
  */
 package org.apache.geronimo.interop.rmi.iiop;
 
-import java.lang.reflect.Array;
-
-import org.apache.geronimo.interop.SystemException;
 import org.apache.geronimo.interop.util.ArrayUtil;
 
+import java.lang.reflect.*;
 
-public class ArrayHelper implements ObjectHelper {
+public class ArrayHelper implements ObjectHelper
+{
     private ValueType _element;
 
-    public ArrayHelper(Class elementClass) {
-        if (elementClass.isPrimitive()) {
-            throw new SystemException("TODO");
-        } else {
+    private ObjectHelper _primitive;
+
+    public ArrayHelper(Class elementClass)
+    {
+        if (elementClass.isPrimitive())
+        {
+            _primitive = PrimitiveType.getArrayHelper(elementClass);
+        }
+        else
+        {
             _element = ValueType.getInstance(elementClass);
         }
     }
 
-    public Object read(ObjectInputStream input) {
+    public Object read(ObjectInputStream input)
+    {
+        if (_primitive != null)
+        {
+            return _primitive.read(input);
+        }
         CdrInputStream cdrInput = input._cdrInput;
         int n = cdrInput.read_long();
-        Object[] array = (Object[]) Array.newInstance(_element._class, n);
-        for (int i = 0; i < n; i++) {
+        Object[] array = (Object[])Array.newInstance(_element._class, n);
+        for (int i = 0; i < n; i++)
+        {
             array[i] = input.readObject(_element);
         }
         return array;
     }
 
-    public void write(ObjectOutputStream output, Object value) {
+    public void write(ObjectOutputStream output, Object value)
+    {
+        if (_primitive != null)
+        {
+            _primitive.write(output, value);
+            return;
+        }
         CdrOutputStream cdrOutput = output._cdrOutput;
-        Object[] array = (Object[]) value;
-        if (array == null) {
+        Object[] array = (Object[])value;
+        if (array == null)
+        {
             array = ArrayUtil.EMPTY_OBJECT_ARRAY;
         }
         int n = array.length;
         cdrOutput.write_long(n);
-        for (int i = 0; i < n; i++) {
+        for (int i = 0; i < n; i++)
+        {
             output.writeObject(_element, array[i]);
         }
     }

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/BadMagicException.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/BadMagicException.java?view=diff&r1=158813&r2=158814
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/BadMagicException.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/BadMagicException.java Wed Mar 23 09:56:34 2005
@@ -17,8 +17,10 @@
  */
 package org.apache.geronimo.interop.rmi.iiop;
 
-public class BadMagicException extends RuntimeException {
-    public BadMagicException(String magic) {
+public class BadMagicException extends RuntimeException
+{
+    public BadMagicException(String magic)
+    {
         super(magic);
     }
 }

Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/CdrInputStream.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/CdrInputStream.java?view=diff&r1=158813&r2=158814
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/CdrInputStream.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/CdrInputStream.java Wed Mar 23 09:56:34 2005
@@ -17,48 +17,52 @@
  */
 package org.apache.geronimo.interop.rmi.iiop;
 
-import org.omg.CORBA.TCKind;
-
-import org.apache.geronimo.interop.GIOP.*;
+import org.apache.geronimo.interop.rmi.*;
+import org.apache.geronimo.interop.rmi.iiop.client.*;
+import org.apache.geronimo.interop.rmi.iiop.compiler.StubFactory;
+import org.apache.geronimo.interop.util.*;
 import org.apache.geronimo.interop.IOP.*;
-import org.apache.geronimo.interop.rmi.RmiTrace;
-import org.apache.geronimo.interop.rmi.iiop.client.ClientNamingContext;
-import org.apache.geronimo.interop.util.ArrayUtil;
-import org.apache.geronimo.interop.util.BigEndian;
-import org.apache.geronimo.interop.util.LittleEndian;
-import org.apache.geronimo.interop.util.UTF8;
-import org.apache.geronimo.interop.util.UnsignedShort;
-
+import org.apache.geronimo.interop.GIOP.*;
+import org.omg.CORBA.TCKind;
 
 /**
- * * CORBA 2.3 / GIOP 1.2 CDR InputStream.
- */
-public class CdrInputStream extends org.omg.CORBA_2_3.portable.InputStream {
-    public static CdrInputStream getInstance() {
-        CdrInputStream input = new CdrInputStream();
+ ** CORBA 2.3 / GIOP 1.2 CDR InputStream.
+ **/
+public class CdrInputStream extends org.omg.CORBA_2_3.portable.InputStream
+{
+    //public static final Component component = new Component(CdrInputStream.class);
+
+    public static CdrInputStream getInstance()
+    {
+        CdrInputStream input = new CdrInputStream(); //(CdrInputStream)component.getInstance();
         input.init(new byte[64], 0, DEFAULT_BUFFER_LENGTH, false);
         return input;
     }
 
-    public static CdrInputStream getInstance(byte[] buffer) {
-        CdrInputStream input = new CdrInputStream();
+    public static CdrInputStream getInstance(byte[] buffer)
+    {
+        CdrInputStream input = new CdrInputStream(); //(CdrInputStream)component.getInstance();
         input.init(buffer, 0, buffer.length, false);
         return input;
     }
 
-    public static CdrInputStream getInstance(byte[] buffer, int offset, int length, boolean little) {
-        CdrInputStream input = new CdrInputStream();
+    public static CdrInputStream getInstance(byte[] buffer, int offset, int length, boolean little)
+    {
+        CdrInputStream input = new CdrInputStream(); //(CdrInputStream)component.getInstance();
         input.init(buffer, offset, length, little);
         return input;
     }
 
-    public static CdrInputStream getInstanceForEncapsulation() {
+    public static CdrInputStream getInstanceForEncapsulation()
+    {
         return getInstance();
     }
 
-    public static CdrInputStream getPooledInstance() {
-        CdrInputStream input = null; //(CdrInputStream)_pool.get();
-        if (input == null) {
+    public static CdrInputStream getPooledInstance()
+    {
+        CdrInputStream input = null; // (CdrInputStream)_pool.get();
+        if (input == null)
+        {
             input = getInstance();
         }
         return input;
@@ -102,24 +106,29 @@
     // public methods
     // -----------------------------------------------------------------------
 
-    public void init(byte[] buffer, int offset, int length, boolean little) {
+    public void init(byte[] buffer, int offset, int length, boolean little)
+    {
         _buffer = buffer;
         _offset = offset;
         _length = length;
         _little = little;
     }
 
-    public void recycle() {
+    public void recycle()
+    {
         reset();
         //_pool.put(this);
     }
 
-    public void reset() {
+    public void reset()
+    {
         _offset = 0;
-        if (_buffer.length > MAXIMUM_POOLED_BUFFER_LENGTH) {
+        if (_buffer.length > MAXIMUM_POOLED_BUFFER_LENGTH)
+        {
             _buffer = _pooledBuffer;
             _pooledBuffer = null;
-            if (_buffer == null) {
+            if (_buffer == null)
+            {
                 _buffer = new byte[DEFAULT_BUFFER_LENGTH];
             }
         }
@@ -128,32 +137,40 @@
         _namingContext = null;
     }
 
-    public void setUnaligned() {
+    public void setUnaligned()
+    {
         _unaligned = true;
     }
 
-    public byte[] getBytes() {
+    public byte[] getBytes()
+    {
         return ArrayUtil.getBytes(_buffer, 0, _length);
     }
 
-    public byte[] getBuffer() {
+    public byte[] getBuffer()
+    {
         return _buffer;
     }
 
-    public int getOffset() {
+    public int getOffset()
+    {
         return _offset;
     }
 
-    public int getGiopVersion() {
+    public int getGiopVersion()
+    {
         GiopMessage message = _giopMessage;
-        if (message == null) {
+        if (message == null)
+        {
             throw new IllegalStateException();
         }
         return message.giopVersion;
     }
 
-    public void setLength(int length) {
-        if (_buffer.length < length) {
+    public void setLength(int length)
+    {
+        if (_buffer.length < length)
+        {
             byte[] newBuffer = new byte[length];
             System.arraycopy(_buffer, 0, newBuffer, 0, 12);
             pool(_buffer);
@@ -162,49 +179,64 @@
         _length = length;
     }
 
-    public void setNamingContext(ClientNamingContext namingContext) {
+    public ClientNamingContext getNamingContext()
+    {
+        return _namingContext;
+    }
+
+    public void setNamingContext(ClientNamingContext namingContext)
+    {
         _namingContext = namingContext;
     }
 
-    public void setEncapsulation(byte[] data) {
+    public void setEncapsulation(byte[] data)
+    {
         _buffer = data;
         _offset = 0;
         _length = data.length;
         _little = read_boolean();
     }
 
-    public boolean hasMoreData() {
+    public boolean hasMoreData()
+    {
         return _offset < _length;
     }
 
     /**
-     * * Align the buffer offset so the next item is read from at an offset
-     * * aligned according to <code>alignment</code>, which must be a
-     * * power of 2 (and at least = 1).
-     * * <p>Then we check if there is enough space left in the buffer for
-     * * an item of <code>size</code> bytes; if not, we throw an
-     * * exception.
-     */
-    public final void read_align(int alignment, int size) {
-        if (_unaligned) {
+     ** Align the buffer offset so the next item is read from at an offset
+     ** aligned according to <code>alignment</code>, which must be a
+     ** power of 2 (and at least = 1).
+     ** <p>Then we check if there is enough space left in the buffer for
+     ** an item of <code>size</code> bytes; if not, we throw an
+     ** exception.
+     **/
+    public final void read_align(int alignment, int size)
+    {
+        if (_unaligned)
+        {
             alignment = 1;
         }
         int mask = alignment - 1;
         _offset += (alignment - (_offset & mask)) & mask;
-        if (_offset + size <= _length) {
+        if (_offset + size <= _length)
+        {
             return;
-        } else {
+        }
+        else
+        {
             throw new org.omg.CORBA.MARSHAL("offset (" + _offset + ") + size ("
-                                            + size + ") > buffer length (" + _length + ")");
+                + size + ") > buffer length (" + _length + ")");
         }
     }
 
     /**
-     * * Convenience method needed in many places.
-     */
-    public byte[] read_octet_sequence() {
+     ** Convenience method needed in many places.
+     **/
+    public byte[] read_octet_sequence()
+    {
         int n = read_long();
-        if (n == 0) {
+        if (n == 0)
+        {
             return EMPTY_BYTE_ARRAY;
         }
         byte[] bytes = new byte[n];
@@ -212,23 +244,28 @@
         return bytes;
     }
 
-    public GiopMessage read_message() {
+    public GiopMessage read_message()
+    {
         return receive_message(null, null);
     }
 
-    public GiopMessage receive_message(java.io.InputStream input, String host) {
+    public GiopMessage receive_message(java.io.InputStream input, String url)
+    {
         GiopMessage message = _giopMessage;
-        if (message == null) {
+        if (message == null)
+        {
             message = _giopMessage = new GiopMessage();
         }
-        if (input != null) {
+        if (input != null)
+        {
             read(input, _buffer, 0, 12);
         }
         int m1 = read_octet();
         int m2 = read_octet();
         int m3 = read_octet();
         int m4 = read_octet();
-        if (m1 != 'G' || m2 != 'I' || m3 != 'O' || m4 != 'P') {
+        if (m1 != 'G' || m2 != 'I' || m3 != 'O' || m4 != 'P')
+        {
             throw new BadMagicException(m1 + "," + m2 + "," + m3 + "," + m4);
         }
         int v1 = read_octet();
@@ -244,12 +281,15 @@
         boolean fragmented = (flags & 2) != 0;
         int messageType = message.type = read_octet();
         int messageSize = message.size = read_ulong();
-        if (fragmented && messageSize % 8 != 0) {
+        if (fragmented && messageSize % 8 != 0)
+        {
             throw new org.omg.CORBA.MARSHAL("GIOP Fragment: bad message size (not divisible by 8) = " + messageSize);
         }
         _length = 12 + messageSize;
-        if (messageSize > 0 && input != null) {
-            if (_buffer.length < _length) {
+        if (messageSize > 0 && input != null)
+        {
+            if (_buffer.length < _length)
+            {
                 byte[] newBuffer = new byte[_length];
                 System.arraycopy(_buffer, 0, newBuffer, 0, 12);
                 pool(_buffer);
@@ -257,76 +297,83 @@
             }
             read(input, _buffer, 12, _length);
         }
-        if (RMI_TRACE && host != null) {
+        if (RMI_TRACE && url != null)
+        {
             byte[] data = new byte[_length];
             System.arraycopy(_buffer, 0, data, 0, _length);
-            RmiTrace.receive(host, data);
+            RmiTrace.receive(url, data);
         }
-        switch (messageType) {
-            case MsgType_1_1._Request:
-                switch (giopVersion) {
-                    case GiopVersion.VERSION_1_0:
-                        {
-                            RequestHeader_1_0 req10 = RequestHeader_1_0Helper.read(this);
-                            RequestHeader_1_2 req12 = new RequestHeader_1_2();
-                            req12.service_context = req10.service_context;
-                            req12.request_id = req10.request_id;
-                            req12.response_flags = (byte) (req10.response_expected ? 3 : 0);
-                            req12.operation = req10.operation;
-                            (req12.target = new TargetAddress()).object_key(req10.object_key);
-                            message.request = req12;
-                        }
-                        break;
-                    case GiopVersion.VERSION_1_1:
-                        {
-                            RequestHeader_1_1 req11 = RequestHeader_1_1Helper.read(this);
-                            RequestHeader_1_2 req12 = new RequestHeader_1_2();
-                            req12.service_context = req11.service_context;
-                            req12.request_id = req11.request_id;
-                            req12.response_flags = (byte) (req11.response_expected ? 3 : 0);
-                            req12.operation = req11.operation;
-                            (req12.target = new TargetAddress()).object_key(req11.object_key);
-                            message.request = req12;
-                        }
-                        break;
-                    case GiopVersion.VERSION_1_2:
-                        message.request = RequestHeader_1_2Helper.read(this);
-                        if (_length > _offset) {
-                            read_align(8, 0); // parameters are 8-byte aligned (if present)
-                        }
-                        break;
+        switch (messageType)
+        {
+          case MsgType_1_1._Request:
+            switch (giopVersion)
+            {
+              case GiopVersion.VERSION_1_0:
+                {
+                    RequestHeader_1_0 req10 = RequestHeader_1_0Helper.read(this);
+                    RequestHeader_1_2 req12 = new RequestHeader_1_2();
+                    req12.service_context = req10.service_context;
+                    req12.request_id = req10.request_id;
+                    req12.response_flags = (byte)(req10.response_expected ? 3 : 0);
+                    req12.operation = req10.operation;
+                    (req12.target = new TargetAddress()).object_key(req10.object_key);
+                    message.request = req12;
                 }
                 break;
-            case MsgType_1_1._Reply:
-                message.reply = ReplyHeader_1_2Helper.read(this);
-                if (giopVersion >= GiopVersion.VERSION_1_2) {
-                    if (_length > _offset) {
-                        read_align(8, 0); // results are 8-byte aligned (if present)
-                    }
+              case GiopVersion.VERSION_1_1:
+                {
+                    RequestHeader_1_1 req11 = RequestHeader_1_1Helper.read(this);
+                    RequestHeader_1_2 req12 = new RequestHeader_1_2();
+                    req12.service_context = req11.service_context;
+                    req12.request_id = req11.request_id;
+                    req12.response_flags = (byte)(req11.response_expected ? 3 : 0);
+                    req12.operation = req11.operation;
+                    (req12.target = new TargetAddress()).object_key(req11.object_key);
+                    message.request = req12;
                 }
                 break;
-            case MsgType_1_1._LocateRequest:
-                switch (giopVersion) {
-                    case GiopVersion.VERSION_1_0:
-                    case GiopVersion.VERSION_1_1:
-                        {
-                            LocateRequestHeader_1_0 req10 = LocateRequestHeader_1_0Helper.read(this);
-                            LocateRequestHeader_1_2 req12 = new LocateRequestHeader_1_2();
-                            req12.request_id = req10.request_id;
-                            (req12.target = new TargetAddress()).object_key(req10.object_key);
-                            message.locateRequest = req12;
-                        }
-                        break;
-                    default:
-                        message.locateRequest = LocateRequestHeader_1_2Helper.read(this);
+              case GiopVersion.VERSION_1_2:
+                message.request = RequestHeader_1_2Helper.read(this);
+                if (_length > _offset)
+                {
+                    read_align(8, 0); // parameters are 8-byte aligned (if present)
                 }
                 break;
-            case MsgType_1_1._LocateReply:
-                // We never send LocateRequest, so this is unexpected.
-                throw new org.omg.CORBA.MARSHAL("GIOP LocateReply: unexpected");
-                // TODO: CloseConnection messages etc...
-            default:
-                throw new org.omg.CORBA.NO_IMPLEMENT("TODO: message type = " + messageType);
+            }
+            break;
+          case MsgType_1_1._Reply:
+            message.reply = ReplyHeader_1_2Helper.read(this);
+            if (giopVersion >= GiopVersion.VERSION_1_2)
+            {
+                if (_length > _offset)
+                {
+                    read_align(8, 0); // results are 8-byte aligned (if present)
+                }
+            }
+            break;
+          case MsgType_1_1._LocateRequest:
+            switch (giopVersion)
+            {
+              case GiopVersion.VERSION_1_0:
+              case GiopVersion.VERSION_1_1:
+                {
+                    LocateRequestHeader_1_0 req10 = LocateRequestHeader_1_0Helper.read(this);
+                    LocateRequestHeader_1_2 req12 = new LocateRequestHeader_1_2();
+                    req12.request_id = req10.request_id;
+                    (req12.target = new TargetAddress()).object_key(req10.object_key);
+                    message.locateRequest = req12;
+                }
+                break;
+              default:
+                message.locateRequest = LocateRequestHeader_1_2Helper.read(this);
+            }
+            break;
+          case MsgType_1_1._LocateReply:
+            // We never send LocateRequest, so this is unexpected.
+            throw new org.omg.CORBA.MARSHAL("GIOP LocateReply: unexpected");
+          // TODO: CloseConnection messages etc...
+          default:
+            throw new org.omg.CORBA.NO_IMPLEMENT("TODO: message type = " + messageType);
         }
         return message;
     }
@@ -335,105 +382,138 @@
     // public methods from org.omg.CORBA.portable.InputStream
     // -----------------------------------------------------------------------
 
-    public boolean read_boolean() {
+    public boolean read_boolean()
+    {
         read_align(1, 1);
         int b = _buffer[_offset++];
-        if (b == 0) {
+        if (b == 0)
+        {
             return false;
-        } else if (b == 1) {
+        }
+        else if (b == 1)
+        {
             return true;
-        } else {
+        }
+        else
+        {
             throw new org.omg.CORBA.MARSHAL("read_boolean: value = " + b);
         }
     }
 
-    public char read_char() {
+    public char read_char()
+    {
         read_align(1, 1);
-        return (char) _buffer[_offset++];
+        return (char)_buffer[_offset++];
     }
 
-    public char read_wchar() {
+    public char read_wchar()
+    {
         read_align(1, 3);
-        int size = (int) read_wchar_size();
-        int value = (char) read_ushort_no_align_big_endian();
+        int size = (int)read_wchar_size();
+        int value = (char)read_ushort_no_align_big_endian();
         boolean littleEndian = ((value & 0xffff) == 0xFFFE);
         boolean bigEndian = ((value & 0xffff) == 0xFEFF);
         boolean bomPresent = (littleEndian || bigEndian);
-        if ((bomPresent && size != 4) || (!bomPresent && size != 2)) {
+        if ((bomPresent && size != 4) || (! bomPresent && size != 2))
+        {
             throw new org.omg.CORBA.MARSHAL("wchar size = " + size
-                                            + (bomPresent ? " (BOM present)" : " (BOM absent)"));
+                + (bomPresent ? " (BOM present)" : " (BOM absent)"));
         }
-        if (littleEndian) {
+        if (littleEndian)
+        {
             read_align(1, 2);
-            return (char) read_ushort_no_align_little_endian();
-        } else if (bigEndian) {
+            return (char)read_ushort_no_align_little_endian();
+        }
+        else if (bigEndian)
+        {
             read_align(1, 2);
-            return (char) read_ushort_no_align_big_endian();
-        } else {
+            return (char)read_ushort_no_align_big_endian();
+        }
+        else
+        {
             // no BOM, big endian
-            return (char) value;
+            return (char)value;
         }
     }
 
-    public byte read_octet() {
+    public byte read_octet()
+    {
         read_align(1, 1);
         return _buffer[_offset++];
     }
 
-    public short read_short() {
+    public short read_short()
+    {
         read_align(2, 2);
         int oldOffset = _offset;
         _offset += 2;
-        if (_little) {
+        if (_little)
+        {
             return LittleEndian.getShort(_buffer, oldOffset);
-        } else {
+        }
+        else
+        {
             return BigEndian.getShort(_buffer, oldOffset);
         }
     }
 
-    public short read_ushort() {
+    public short read_ushort()
+    {
         return read_short();
     }
 
-    public int read_long() {
+    public int read_long()
+    {
         read_align(4, 4);
         int oldOffset = _offset;
         _offset += 4;
-        if (_little) {
+        if (_little)
+        {
             return LittleEndian.getInt(_buffer, oldOffset);
-        } else {
+        }
+        else
+        {
             return BigEndian.getInt(_buffer, oldOffset);
         }
     }
 
-    public int read_ulong() {
+    public int read_ulong()
+    {
         return read_long();
     }
 
-    public long read_longlong() {
+    public long read_longlong()
+    {
         read_align(8, 8);
         int oldOffset = _offset;
         _offset += 8;
-        if (_little) {
+        if (_little)
+        {
             return LittleEndian.getLong(_buffer, oldOffset);
-        } else {
+        }
+        else
+        {
             return BigEndian.getLong(_buffer, oldOffset);
         }
     }
 
-    public long read_ulonglong() {
+    public long read_ulonglong()
+    {
         return read_longlong();
     }
 
-    public float read_float() {
+    public float read_float()
+    {
         return Float.intBitsToFloat(read_ulong());
     }
 
-    public double read_double() {
+    public double read_double()
+    {
         return Double.longBitsToDouble(read_ulonglong());
     }
 
-    public java.lang.String read_string() {
+    public java.lang.String read_string()
+    {
         int size = read_ulong();
         if (size < 1) // Zero or negative due to unsigned value > 2Gb
         {
@@ -441,177 +521,229 @@
         }
         read_align(1, size);
         size--;
-        if (_buffer[_offset + size] != 0) {
+        if (_buffer[_offset + size] != 0)
+        {
             throw new org.omg.CORBA.MARSHAL("read_string: missing NUL");
         }
         // Assume transmission code set is UTF-8
-        String value = UTF8.toString(_buffer, _offset, size);
+        String value = size == 0 ? "" : UTF8.toString(_buffer, _offset, size);
         _offset += size + 1; // 1 for NUL
         return value;
     }
 
-    public java.lang.String read_wstring() {
+    public java.lang.String read_wstring()
+    {
         int size = read_long();
-        if (size == 0) {
+        if (size == 0)
+        {
             return "";
         }
         read_align(2, size);
         int numChars = size / 2;
         boolean littleEndian = false;
         read_align(1, 2);
-        int firstChar = (char) read_ushort_no_align_big_endian();
-        _offset += 2;
+        int firstChar = (char)read_ushort_no_align_big_endian();
+        _offset+=2;
         char[] result;
         int index = 0;
-        if (firstChar == 0xFEFF) {
+        if (firstChar == 0xFEFF)
+        {
             // big endian
             result = new char[--numChars];
-        } else if (firstChar == 0xFFFE) {
+        }
+        else if (firstChar == 0xFFFE)
+        {
             // little endian
             result = new char[--numChars];
             littleEndian = true;
-        } else {
+        }
+        else
+        {
             // no BOM, big endian
             result = new char[numChars--];
-            result[index++] = (char) firstChar;
+            result[index++] = (char)firstChar;
         }
         read_align(1, 2 * numChars);
-        if (littleEndian) {
-            for (int i = 0; i < numChars; i++) {
-                result[index++] = (char) read_ushort_no_align_little_endian();
-                _offset += 2;
-            }
-        } else {
-            for (int i = 0; i < numChars; i++) {
-                result[index++] = (char) read_ushort_no_align_big_endian();
-                _offset += 2;
+        if (littleEndian)
+        {
+            for (int i = 0; i < numChars; i++)
+            {
+                result[index++] = (char)read_ushort_no_align_little_endian();
+                _offset+=2;
+            }
+        }
+        else
+        {
+            for (int i = 0; i < numChars; i++)
+            {
+                result[index++] = (char)read_ushort_no_align_big_endian();
+                _offset+=2;
             }
         }
         return new String(result);
     }
 
-    public void read_boolean_array(boolean[] value, int offset, int length) {
-        for (int i = 0; i < length; i++) {
+    public void read_boolean_array(boolean[] value, int offset, int length)
+    {
+        for (int i = 0; i < length; i++)
+        {
             value[offset + i] = read_boolean();
         }
     }
 
-    public void read_char_array(char[] value, int offset, int length) {
-        for (int i = 0; i < length; i++) {
+    public void read_char_array(char[] value, int offset, int length)
+    {
+        for (int i = 0; i < length; i++)
+        {
             value[i] = read_char();
         }
     }
 
-    public void read_wchar_array(char[] value, int offset, int length) {
-        for (int i = 0; i < length; i++) {
+    public void read_wchar_array(char[] value, int offset, int length)
+    {
+        for (int i = 0; i < length; i++)
+        {
             value[offset + i] = read_wchar();
         }
     }
 
-    public void read_octet_array(byte[] value, int offset, int length) {
+    public void read_octet_array(byte[] value, int offset, int length)
+    {
         read_align(1, length);
         System.arraycopy(_buffer, _offset, value, offset, length);
         _offset += length;
     }
 
-    public void read_short_array(short[] value, int offset, int length) {
-        for (int i = 0; i < length; i++) {
+    public void read_short_array(short[] value, int offset, int length)
+    {
+        for (int i = 0; i < length; i++)
+        {
             value[offset + i] = read_short();
         }
     }
 
-    public void read_ushort_array(short[] value, int offset, int length) {
-        for (int i = 0; i < length; i++) {
+    public void read_ushort_array(short[] value, int offset, int length)
+    {
+        for (int i = 0; i < length; i++)
+        {
             value[offset + i] = read_ushort();
         }
     }
 
-    public void read_long_array(int[] value, int offset, int length) {
-        for (int i = 0; i < length; i++) {
+    public void read_long_array(int[] value, int offset, int length)
+    {
+        for (int i = 0; i < length; i++)
+        {
             value[offset + i] = read_long();
         }
     }
 
-    public void read_ulong_array(int[] value, int offset, int length) {
-        for (int i = 0; i < length; i++) {
+    public void read_ulong_array(int[] value, int offset, int length)
+    {
+        for (int i = 0; i < length; i++)
+        {
             value[offset + i] = read_ulong();
         }
     }
 
-    public void read_longlong_array(long[] value, int offset, int length) {
-        for (int i = 0; i < length; i++) {
+    public void read_longlong_array(long[] value, int offset, int length)
+    {
+        for (int i = 0; i < length; i++)
+        {
             value[offset + i] = read_longlong();
         }
     }
 
-    public void read_ulonglong_array(long[] value, int offset, int length) {
-        for (int i = 0; i < length; i++) {
+    public void read_ulonglong_array(long[] value, int offset, int length)
+    {
+        for (int i = 0; i < length; i++)
+        {
             value[offset + i] = read_ulonglong();
         }
     }
 
-    public void read_float_array(float[] value, int offset, int length) {
-        for (int i = 0; i < length; i++) {
+    public void read_float_array(float[] value, int offset, int length)
+    {
+        for (int i = 0; i < length; i++)
+        {
             value[offset + i] = read_float();
         }
     }
 
-    public void read_double_array(double[] value, int offset, int length) {
-        for (int i = 0; i < length; i++) {
+    public void read_double_array(double[] value, int offset, int length)
+    {
+        for (int i = 0; i < length; i++)
+        {
             value[offset + i] = read_double();
         }
     }
 
-    public org.omg.CORBA.Object read_Object() {
+    public org.omg.CORBA.Object read_Object()
+    {
         IOR ior = IORHelper.read(this);
-        if (ior.profiles.length == 0) {
+        if (ior.profiles.length == 0)
+        {
             return null;
         }
         ObjectRef stub = null;
-        if (ior.type_id.length() != 0) {
-            // Return instance of appropriate stub class
-            if (ior.type_id.startsWith("RMI:") && ior.type_id.endsWith(":0000000000000000")) {
-                String interfaceName = ior.type_id.substring(4, ior.type_id.length() - 17);
-
-                System.out.println("TODO: CdrInputStream.read_Object(): NYI: interfaceName = " + interfaceName + ", ior = " + ior.type_id);
-                stub = null;
-
-                //Class remoteInterface = ThreadContext.loadClass(interfaceName);
-                //stub = StubFactory.getInstance().getStub(remoteInterface);
+        if (ior.type_id.length() != 0)
+        {
+            String interfaceName = "";
+            if (ior.type_id.startsWith("RMI:") && ior.type_id.endsWith(":0000000000000000"))
+            {
+                interfaceName = ior.type_id.substring(4, ior.type_id.length() - 17);
+            }
+            else if (ior.type_id.startsWith("IDL:") && ior.type_id.endsWith(":1.0"))
+            {
+                interfaceName = ior.type_id.substring(4, ior.type_id.length() - 4).replace('/', '.');
             }
-            if (ior.type_id.startsWith("IDL:") && ior.type_id.endsWith(":1.0")) {
-                String interfaceName = ior.type_id.substring(4, ior.type_id.length() - 4).replace('/', '.');
-
-                System.out.println("TODO: CdrInputStream.read_Object(): NYI: interfaceName = " + interfaceName + ", ior = " + ior.type_id);
-                stub = null;
 
-                //Class remoteInterface = ThreadContext.loadClass(interfaceName);
-                //stub = StubFactory.getInstance().getStub(remoteInterface);
+            // Return instance of appropriate stub class
+            if(interfaceName.startsWith("omg.org", 0))
+            {
+                interfaceName = "org.apache.geronimo.interop" + interfaceName.substring(7);
             }
+            //if(interfaceName.equals("SessionManager.Factory"))
+            //{
+            //    ObjectRef homeRef =
+            //        StubFactory.getInstance().getStub(org.apache.geronimo.interop.rmi.iiop.J40Home.class);
+            //    homeRef.$setIOR(ior);
+            //    homeRef.$setNamingContext(_namingContext);
+            //    org.apache.geronimo.interop.rmi.iiop.J40Home home = (org.apache.geronimo.interop.rmi.iiop.J40Home)homeRef;
+            //    org.apache.geronimo.interop.rmi.iiop.J40MetaData md = home.getJ40MetaData();
+            //    interfaceName = md.ejbHomeInterfaceClass;
+            //}
+            Class remoteInterface = ThreadContext.loadClass(interfaceName);
+            stub = StubFactory.getInstance().getStub(remoteInterface);
         }
-        if (stub == null) {
-            stub = new ObjectRef();
+        if (stub == null)
+        {
+            stub = ObjectRef._getInstance();
         }
         stub.$setIOR(ior);
         stub.$setNamingContext(_namingContext);
         return stub;
     }
 
-    public org.omg.CORBA.TypeCode read_TypeCode() {
+    public org.omg.CORBA.TypeCode read_TypeCode()
+    {
         return read_TypeCode(new java.util.HashMap());
     }
 
-    private org.omg.CORBA.TypeCode read_TypeCode(java.util.HashMap table) {
+    private org.omg.CORBA.TypeCode read_TypeCode(java.util.HashMap table)
+    {
         int beforeKindOffset = _offset;
         int tk = read_ulong();
         int afterKindOffset = _offset;
         org.apache.geronimo.interop.rmi.iiop.TypeCode tc;
-        if (tk == 0xffffffff) {
+        if (tk == 0xffffffff)
+        {
             // an indirection to another TypeCode we have seen.
             int offset = read_long();
             Integer key = new Integer(afterKindOffset + offset);
-            org.omg.CORBA.TypeCode ref = (org.omg.CORBA.TypeCode) table.get(key);
-            if (ref == null) {
+            org.omg.CORBA.TypeCode ref = (org.omg.CORBA.TypeCode)table.get(key);
+            if (ref == null)
+            {
                 throw new org.omg.CORBA.MARSHAL("read_TypeCode: bad indirection: offset = " + offset);
             }
             tc = new org.apache.geronimo.interop.rmi.iiop.TypeCode(TCKind.tk_null);
@@ -620,7 +752,8 @@
         }
         tc = new org.apache.geronimo.interop.rmi.iiop.TypeCode(TCKind.from_int(tk));
         table.put(new Integer(beforeKindOffset), tc);
-        switch (tk) {
+        switch (tk)
+        {
             case TCKind._tk_null:
             case TCKind._tk_void:
             case TCKind._tk_TypeCode:
@@ -686,7 +819,8 @@
                     tc.name(read_string());
                     int count = read_ulong();
                     tc.member_count(count);
-                    for (int i = 0; i < count; i++) {
+                    for (int i = 0; i < count; i++)
+                    {
                         tc.member_name(i, read_string());
                     }
                     end(saveLittle);
@@ -700,7 +834,8 @@
                     tc.name(read_string());
                     int count = read_ulong();
                     tc.member_count(count);
-                    for (int i = 0; i < count; i++) {
+                    for (int i = 0; i < count; i++)
+                    {
                         tc.member_name(i, read_string());
                         tc.member_type(i, read_TypeCode(table));
                     }
@@ -717,7 +852,8 @@
                     int di = read_ulong();
                     int count = read_ulong();
                     tc.member_count(count);
-                    for (int i = 0; i < count; i++) {
+                    for (int i = 0; i < count; i++)
+                    {
                         org.omg.CORBA.Any label = new org.apache.geronimo.interop.rmi.iiop.Any();
                         read_Any(label.create_output_stream(), dt);
                         label.read_value(null, dt);
@@ -738,7 +874,8 @@
                     tc.concrete_base_type(read_TypeCode(table));
                     int count = read_ulong();
                     tc.member_count(count);
-                    for (int i = 0; i < count; i++) {
+                    for (int i = 0; i < count; i++)
+                    {
                         tc.member_name(i, read_string());
                         tc.member_type(i, read_TypeCode(table));
                         tc.member_visibility(i, read_short());
@@ -752,7 +889,8 @@
         return tc;
     }
 
-    public org.omg.CORBA.Any read_Any() {
+    public org.omg.CORBA.Any read_Any()
+    {
         org.omg.CORBA.TypeCode tc = read_TypeCode();
         org.omg.CORBA.Any value = new org.apache.geronimo.interop.rmi.iiop.Any();
         org.omg.CORBA.portable.OutputStream os = value.create_output_stream();
@@ -762,10 +900,13 @@
     }
 
     // Sybase-internal
-    public void read_Any(org.omg.CORBA.portable.OutputStream os, org.omg.CORBA.TypeCode tc) {
-        try {
+    public void read_Any(org.omg.CORBA.portable.OutputStream os, org.omg.CORBA.TypeCode tc)
+    {
+        try
+        {
             int tk = tc.kind().value();
-            switch (tk) {
+            switch (tk)
+            {
                 case TCKind._tk_null:
                 case TCKind._tk_void:
                     break;
@@ -828,7 +969,8 @@
                     {
                         int n = tc.length();
                         org.omg.CORBA.TypeCode c = tc.content_type();
-                        for (int i = 0; i < n; i++) {
+                        for (int i = 0; i < n; i++)
+                        {
                             read_Any(os, c);
                         }
                     }
@@ -838,7 +980,8 @@
                         int n = read_ulong();
                         os.write_ulong(n);
                         org.omg.CORBA.TypeCode c = tc.content_type();
-                        for (int i = 0; i < n; i++) {
+                        for (int i = 0; i < n; i++)
+                        {
                             read_Any(os, c);
                         }
                     }
@@ -847,7 +990,8 @@
                 case TCKind._tk_except:
                     {
                         int n = tc.member_count();
-                        for (int i = 0; i < n; i++) {
+                        for (int i = 0; i < n; i++)
+                        {
                             read_Any(os, tc.member_type(i));
                         }
                     }
@@ -861,14 +1005,17 @@
                         write_disc(disc, os, dt);
                         int di = tc.default_index();
                         int i, n = tc.member_count();
-                        for (i = 0; i < n; i++) {
+                        for (i = 0; i < n; i++)
+                        {
                             org.omg.CORBA.Any label = tc.member_label(i);
-                            if (label.equal(disc)) {
+                            if (label.equal(disc))
+                            {
                                 read_Any(os, tc.member_type(i));
                                 break;
                             }
                         }
-                        if (i == n && di >= 0) {
+                        if (i == n && di >= 0)
+                        {
                             read_Any(os, tc.member_type(di));
                         }
                     }
@@ -878,9 +1025,13 @@
                 default:
                     throw new org.omg.CORBA.MARSHAL("read_Any: type = " + tc);
             }
-        } catch (org.omg.CORBA.TypeCodePackage.BadKind ex) {
+        }
+        catch (org.omg.CORBA.TypeCodePackage.BadKind ex)
+        {
             throw new org.omg.CORBA.MARSHAL("read_Any: " + ex.toString());
-        } catch (org.omg.CORBA.TypeCodePackage.Bounds ex) {
+        }
+        catch (org.omg.CORBA.TypeCodePackage.Bounds ex)
+        {
             throw new org.omg.CORBA.MARSHAL("read_Any: " + ex.toString());
         }
     }
@@ -951,65 +1102,85 @@
     // protected methods
     // -----------------------------------------------------------------------
 
-    protected void pool(byte[] oldBuffer) {
-        if (oldBuffer.length <= MAXIMUM_POOLED_BUFFER_LENGTH) {
+    protected void pool(byte[] oldBuffer)
+    {
+        if (oldBuffer.length <= MAXIMUM_POOLED_BUFFER_LENGTH)
+        {
             _pooledBuffer = oldBuffer;
         }
     }
 
-    protected int read_ushort_no_align_big_endian() {
+    protected int read_ushort_no_align_big_endian()
+    {
         return UnsignedShort.intValue(BigEndian.getShort(_buffer, _offset));
     }
 
-    protected int read_ushort_no_align_little_endian() {
+    protected int read_ushort_no_align_little_endian()
+    {
         return UnsignedShort.intValue(LittleEndian.getShort(_buffer, _offset));
     }
 
-    protected int read_wchar_size() {
+    protected int read_wchar_size()
+    {
         read_align(1, 1);
-        int size = _buffer[_offset++];
-        if (size < 2) {
+        int size =  _buffer[_offset++];
+        if (size < 2)
+        {
             throw new org.omg.CORBA.MARSHAL("wchar size = " + size);
         }
         return size;
     }
 
-    protected void read(java.io.InputStream input, byte[] buffer, int offset, int length) {
-        try {
-            while (offset < length) {
+    protected void read(java.io.InputStream input, byte[] buffer, int offset, int length)
+    {
+        try
+        {
+            while (offset < length)
+            {
                 int needLength = length - offset;
                 int readLength = input.read(buffer, offset, needLength);
-                if (readLength == -1) {
+                if (readLength == -1)
+                {
                     throw new org.omg.CORBA.MARSHAL("read: EOF");
                 }
                 offset += readLength;
             }
-        } catch (java.io.IOException ex) {
+        }
+        catch (java.io.IOException ex)
+        {
             throw new org.omg.CORBA.COMM_FAILURE(ex.toString());
         }
     }
 
-    public boolean begin() {
+    public boolean begin()
+    {
         int length = read_ulong(); // encapsulation length
         boolean saveLittle = _little;
         _little = read_boolean();
         return saveLittle;
     }
 
-    public void end(boolean saveLittle) {
+    public void end(boolean saveLittle)
+    {
         _little = saveLittle;
     }
 
-    private void write_disc(org.omg.CORBA.Any disc, org.omg.CORBA.portable.OutputStream os, org.omg.CORBA.TypeCode dt) {
+    private void write_disc(org.omg.CORBA.Any disc, org.omg.CORBA.portable.OutputStream os, org.omg.CORBA.TypeCode dt)
+    {
         int tk = dt.kind().value();
-        if (tk == TCKind._tk_alias) {
-            try {
+        if (tk == TCKind._tk_alias)
+        {
+            try
+            {
                 write_disc(disc, os, dt.content_type());
-            } catch (org.omg.CORBA.TypeCodePackage.BadKind ex) {
+            }
+            catch (org.omg.CORBA.TypeCodePackage.BadKind ex)
+            {
                 throw new org.omg.CORBA.MARSHAL("write_disc: " + ex.toString());
             }
         }
-        switch (tk) {
+        switch (tk)
+        {
             case TCKind._tk_boolean:
                 os.write_boolean(disc.extract_boolean());
                 break;



Mime
View raw message