dain        2005/06/25 03:00:29

  Modified:    modules/core/src/java/org/openejb/corba/util Util.java
  Log:

  EJB handles can now be passed over iiop
  Fixed a few more marshalling bugs
  
  Revision  Changes    Path
  1.14      +26 -12    
openejb/modules/core/src/java/org/openejb/corba/util/Util.java
  
  Index: Util.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/corba/util/Util.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Util.java 24 Jun 2005 20:21:37 -0000      1.13
  +++ Util.java 25 Jun 2005 07:00:29 -0000      1.14
  @@ -80,6 +80,9 @@
   import org.omg.CORBA_2_3.portable.InputStream;
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  +import org.openejb.corba.CorbaApplicationServer;
  +import org.openejb.server.ServerFederation;
  +import org.openejb.spi.ApplicationServer;
   
   /**
    * Various utility functions.
  @@ -98,6 +101,7 @@
       private static ORB orb;
       private static Codec codec;
       private static HandleDelegate handleDelegate;
  +    private static CorbaApplicationServer corbaApplicationServer = new 
CorbaApplicationServer();
   
       public static ORB getORB() {
           assert orb != null;
  @@ -432,14 +436,24 @@
               out.write_longlong(((Long) object).longValue());
           } else if (type == short.class) {
               out.write_short(((Short) object).shortValue());
  -        } else if (type == Object.class || type == Serializable.class) {
  -            javax.rmi.CORBA.Util.writeAny(out, object);
  -        } else if (Remote.class.isAssignableFrom(type)) {
  -            javax.rmi.CORBA.Util.writeRemoteObject(out, object);
  -        } else if (org.omg.CORBA.Object.class.isAssignableFrom(type)) {
  -            out.write_Object((org.omg.CORBA.Object) object);
  -        } else {
  -            out.write_value((Serializable) object, type);
  +        }
  +
  +        ApplicationServer oldApplicationServer = 
ServerFederation.getApplicationServer();
  +        try {
  +            ServerFederation.setApplicationServer(corbaApplicationServer);
  +            if (type == Object.class || type == Serializable.class) {
  +                javax.rmi.CORBA.Util.writeAny(out, object);
  +            } else if (org.omg.CORBA.Object.class.isAssignableFrom(type)) {
  +                out.write_Object((org.omg.CORBA.Object) object);
  +            } else if (Remote.class.isAssignableFrom(type)) {
  +                javax.rmi.CORBA.Util.writeRemoteObject(out, object);
  +            } else if (type.isInterface() && 
Serializable.class.isAssignableFrom(type)) {
  +                javax.rmi.CORBA.Util.writeAbstractObject(out, object);
  +            } else {
  +                out.write_value((Serializable) object, type);
  +            }
  +        } finally {
  +            ServerFederation.setApplicationServer(oldApplicationServer);
           }
       }
   
  @@ -464,11 +478,11 @@
               return new Short(in.read_short());
           } else if (type == Object.class || type == Serializable.class) {
               return javax.rmi.CORBA.Util.readAny(in);
  +        } else if (org.omg.CORBA.Object.class.isAssignableFrom(type)) {
  +            return in.read_Object(type);
           } else if (Remote.class.isAssignableFrom(type)) {
               return PortableRemoteObject.narrow(in.read_Object(), type);
  -        } else if (org.omg.CORBA.Object.class.isAssignableFrom(type)) {
  -            return in.read_Object();
  -        } else if (Serializable.class.isAssignableFrom(type)) {
  +        } else if (type.isInterface() && 
Serializable.class.isAssignableFrom(type)) {
               return in.read_abstract_interface();
           } else {
               return in.read_value(type);
  
  
  

Reply via email to