You are viewing a plain text version of this content. The canonical link for it is here.
Posted to yoko-commits@incubator.apache.org by ri...@apache.org on 2007/01/30 00:19:18 UTC

svn commit: r501247 - /incubator/yoko/trunk/rmi-impl/src/main/java/org/apache/yoko/rmi/impl/IDLEntityDescriptor.java

Author: rickmcguire
Date: Mon Jan 29 16:19:15 2007
New Revision: 501247

URL: http://svn.apache.org/viewvc?view=rev&rev=501247
Log:
YOKO-280 RMI support not marshalling IDLEntity CORBA objects correctly.


Modified:
    incubator/yoko/trunk/rmi-impl/src/main/java/org/apache/yoko/rmi/impl/IDLEntityDescriptor.java

Modified: incubator/yoko/trunk/rmi-impl/src/main/java/org/apache/yoko/rmi/impl/IDLEntityDescriptor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/rmi-impl/src/main/java/org/apache/yoko/rmi/impl/IDLEntityDescriptor.java?view=diff&rev=501247&r1=501246&r2=501247
==============================================================================
--- incubator/yoko/trunk/rmi-impl/src/main/java/org/apache/yoko/rmi/impl/IDLEntityDescriptor.java (original)
+++ incubator/yoko/trunk/rmi-impl/src/main/java/org/apache/yoko/rmi/impl/IDLEntityDescriptor.java Mon Jan 29 16:19:15 2007
@@ -32,8 +32,14 @@
 
     boolean isAbstract = false;
 
+    boolean isCorba = false; 
+
     IDLEntityDescriptor(Class type, TypeRepository repository) {
         super(type, repository);
+
+        if (org.omg.CORBA.Object.class.isAssignableFrom(type)) {
+            isCorba = true; 
+        }
     }
 
     public String getIDLName() {
@@ -102,11 +108,20 @@
     /** Read an instance of this value from a CDR stream */
     public Object read(org.omg.CORBA.portable.InputStream in) {
         org.omg.CORBA_2_3.portable.InputStream _in = (org.omg.CORBA_2_3.portable.InputStream) in;
+        
+        // there are two ways we need to deal with IDLEntity classes.  Ones that also implement 
+        // the CORBA Object interface are actual corba objects, and must be handled that way. 
+        // Other IDLEntity classes are just transmitted by value. 
+        if (isCorba) {
+            return _in.read_Object(getJavaClass()); 
+        }
+        else {
 
-        // we directly call read_value() on the stream here, with the explicitly specified
-        // repository ID.  The input stream will handle validating the value tag for us, and eventually
-        // will call our readValue() method to deserialize the object.
-        return _in.read_value(getRepositoryID());
+            // we directly call read_value() on the stream here, with the explicitly specified
+            // repository ID.  The input stream will handle validating the value tag for us, and eventually
+            // will call our readValue() method to deserialize the object.
+            return _in.read_value(getRepositoryID());
+        }
     }
 
     public java.io.Serializable readValue(
@@ -138,10 +153,20 @@
     public void write(org.omg.CORBA.portable.OutputStream out, Object val) {
         org.omg.CORBA_2_3.portable.OutputStream _out = (org.omg.CORBA_2_3.portable.OutputStream) out;
 
-        // we directly call write_value() on the stream here, with the explicitly specified
-        // repository ID.  the output stream will handle writing the value tag for us, and eventually
-        // will call our writeValue() method to serialize the object.
-        _out.write_value((java.io.Serializable)val, getRepositoryID());
+        
+        // there are two ways we need to deal with IDLEntity classes.  Ones that also implement 
+        // the CORBA Object interface are actual corba objects, and must be handled that way. 
+        // Other IDLEntity classes are just transmitted by value. 
+        if (val instanceof org.omg.CORBA.portable.ObjectImpl) {
+            _out.write_Object((org.omg.CORBA.Object)val); 
+        }
+        else {
+            // we directly call write_value() on the stream here, with the explicitly specified
+            // repository ID.  the output stream will handle writing the value tag for us, and eventually
+            // will call our writeValue() method to serialize the object.
+            _out.write_value((java.io.Serializable)val, getRepositoryID());
+        }
+
     }
 
     public void writeValue(org.omg.CORBA.portable.OutputStream out, java.io.Serializable val) {