User: reverbel
  Date: 01/12/05 15:01:48

  Added:       iiop     patch_on_JacORB1_4_beta2.diff
  Log:
  This set of patches on JacORB 1.4 beta2 generates the modified JacORB
  version I am currently using to run JBoss/IIOP. It was submitted to
  JacORB and hopefully will be merged into a future release.
  
  Revision  Changes    Path
  1.1                  contrib/iiop/patch_on_JacORB1_4_beta2.diff
  
  Index: patch_on_JacORB1_4_beta2.diff
  ===================================================================
  Index: idl/omg/IOP.idl
  ===================================================================
  RCS file: /home/bwana/brose/cvs_jacorb/JacORB/idl/omg/IOP.idl,v
  retrieving revision 1.2
  diff -u -r1.2 IOP.idl
  --- IOP.idl   2001/11/19 09:40:07     1.2
  +++ IOP.idl   2001/12/05 20:11:36
  @@ -57,6 +57,7 @@
       const ComponentId TAG_POLICIES= 2;
       const ComponentId TAG_ALTERNATIVE_IIOP_ADDRESS = 3;
       const ComponentId TAG_ASSOCIATION_OPTIONS = 13;
  +    const ComponentId TAG_JAVA_CODEBASE = 25;
       // ... others
   
       struct TaggedComponent {
  Index: src/omg-99-10-27/org/omg/CORBA/SetOverrideType.java
  ===================================================================
  RCS file: 
/home/bwana/brose/cvs_jacorb/JacORB/src/omg-99-10-27/org/omg/CORBA/SetOverrideType.java,v
  retrieving revision 1.1.1.1
  diff -u -r1.1.1.1 SetOverrideType.java
  --- SetOverrideType.java      2001/03/17 18:09:36     1.1.1.1
  +++ SetOverrideType.java      2001/12/05 20:11:36
  @@ -27,12 +27,12 @@
       public static final SetOverrideType SET_OVERRIDE = 
           new SetOverrideType(_SET_OVERRIDE);
   
  -    public static final int _ADD = 1;
  -    public static final SetOverrideType ADD = 
  -        new SetOverrideType(_ADD);
  +    public static final int _ADD_OVERRIDE = 1;
  +    public static final SetOverrideType ADD_OVERRIDE = 
  +        new SetOverrideType(_ADD_OVERRIDE);
   
       public int value() {
  -        throw new org.omg.CORBA.NO_IMPLEMENT();
  +        return _value;
       }
   
       public static SetOverrideType from_int(int val) 
  @@ -40,15 +40,17 @@
           switch (val) {
           case _SET_OVERRIDE:
               return SET_OVERRIDE;
  -        case _ADD:
  -            return ADD;
  +        case _ADD_OVERRIDE:
  +            return ADD_OVERRIDE;
           default:
               throw new org.omg.CORBA.BAD_PARAM();
           }
       }
   
       protected SetOverrideType(int _value) {
  -        throw new org.omg.CORBA.NO_IMPLEMENT();
  +        this._value = _value;
       }
  +
  +    private int _value;
   
   }
  Index: src/omg-99-10-27/org/omg/CORBA/portable/InputStream.java
  ===================================================================
  RCS file: 
/home/bwana/brose/cvs_jacorb/JacORB/src/omg-99-10-27/org/omg/CORBA/portable/InputStream.java,v
  retrieving revision 1.1.1.1
  diff -u -r1.1.1.1 InputStream.java
  --- InputStream.java  2001/03/17 18:09:41     1.1.1.1
  +++ InputStream.java  2001/12/05 20:11:36
  @@ -54,6 +54,9 @@
   
       public abstract org.omg.CORBA.Object read_Object();
       public org.omg.CORBA.Object read_Object(java.lang.Class clz) {
  +        if (clz.isInterface() && java.rmi.Remote.class.isAssignableFrom(clz))
  +            return (org.omg.CORBA.Object)
  +                    javax.rmi.PortableRemoteObject.narrow(read_Object(), clz);
           throw new org.omg.CORBA.NO_IMPLEMENT();
       }
   
  Index: src/org/jacorb/ir/TypeCodeUtil.java
  ===================================================================
  RCS file: /home/bwana/brose/cvs_jacorb/JacORB/src/org/jacorb/ir/TypeCodeUtil.java,v
  retrieving revision 1.4
  diff -u -r1.4 TypeCodeUtil.java
  --- TypeCodeUtil.java 2001/04/09 12:03:38     1.4
  +++ TypeCodeUtil.java 2001/12/05 20:11:36
  @@ -50,7 +50,8 @@
               cache.put( "org.omg.CORBA.TypeCode",new TypeCode( TCKind._tk_TypeCode));
               cache.put( "org.omg.CORBA.Principal",new TypeCode( 
TCKind._tk_Principal));
               cache.put( "org.omg.CORBA.Object", 
  -                       new TypeCode( "IDL:omg.org/CORBA/Object:1.0", 
  +                       new TypeCode( TCKind._tk_objref,
  +                                     "IDL:omg.org/CORBA/Object:1.0", 
                                        "IDL:omg.org/CORBA/Object:1.0" ));
    
       }
  Index: src/org/jacorb/orb/Any.java
  ===================================================================
  RCS file: /home/bwana/brose/cvs_jacorb/JacORB/src/org/jacorb/orb/Any.java,v
  retrieving revision 1.15
  diff -u -r1.15 Any.java
  --- Any.java  2001/11/14 12:41:08     1.15
  +++ Any.java  2001/12/05 20:11:36
  @@ -713,6 +713,14 @@
               insert_Value 
                   (((org.omg.CORBA_2_3.portable.InputStream)input).read_value());
               break;
  +        case TCKind._tk_abstract_interface:
  +         java.lang.Object obj = 
  +             
((org.omg.CORBA_2_3.portable.InputStream)input).read_abstract_interface();
  +         if (obj instanceof org.omg.CORBA.Object)
  +             insert_Object((org.omg.CORBA.Object)obj);
  +         else
  +             insert_Value((java.io.Serializable)obj);
  +            break;
           default:
               throw new RuntimeException("Cannot handle TypeCode with kind " + kind);
           }
  @@ -837,6 +845,10 @@
           case TCKind._tk_value:
               ((org.omg.CORBA_2_3.portable.OutputStream)output)
                   .write_value ((java.io.Serializable)value);
  +            break;
  +        case TCKind._tk_abstract_interface:
  +            ((org.omg.CORBA_2_3.portable.OutputStream)output)
  +                .write_abstract_interface (value);
               break;
           default:
               throw new RuntimeException("Cannot handle TypeCode with kind " + kind);
  Index: src/org/jacorb/orb/CDRInputStream.java
  ===================================================================
  RCS file: 
/home/bwana/brose/cvs_jacorb/JacORB/src/org/jacorb/orb/CDRInputStream.java,v
  retrieving revision 1.27
  diff -u -r1.27 CDRInputStream.java
  --- CDRInputStream.java       2001/11/20 10:20:26     1.27
  +++ CDRInputStream.java       2001/12/05 20:11:37
  @@ -84,6 +84,12 @@
        */
       private Hashtable repIdMap = new Hashtable();
   
  +    /**
  +     * Maps indices within the buffer (java.lang.Integer) to codebase strings
  +     * that appear at these indices.
  +     */
  +    private Hashtable codebaseMap = new Hashtable();
  +
       public boolean littleEndian = false;
   
       /** indices into the actual buffer */
  @@ -821,6 +827,12 @@
            content_type = read_TypeCode( tcMap );
            closeEncapsulation();
               return orb.create_value_box_tc( id, name, content_type );
  +     case TCKind._tk_abstract_interface: 
  +         openEncapsulation();
  +         id = read_string();
  +         name = read_string();
  +         closeEncapsulation();
  +            return orb.create_abstract_interface_tc( id, name );
        case 0xffffffff:
            /* recursive TC */
            int negative_offset = read_long();
  @@ -1446,47 +1458,101 @@
   
       public java.io.Serializable read_value() 
       {
  +     int start_offset = pos;
           int tag = read_long();
  +
  +        if (tag == 0xffffffff)
  +            // indirection
  +            return read_indirect_value();
  +        else if (tag == 0x00000000) 
  +            // null tag
  +            return null;
  +   
  +        String codebase = ((tag & 1) != 0) ? read_codebase() : null;
  +
  +        tag = tag & 0xfffffffe;
  +
           if (tag == 0x7fffff00)
               throw new org.omg.CORBA.MARSHAL ("missing value type information");
           else if (tag == 0x7fffff02)
  -            return read_typed_value();
  +            return read_typed_value(start_offset, codebase);
           else
  -            return read_special_value (tag);
  +            throw new org.omg.CORBA.MARSHAL ("unknown value tag: " 
  +                                             + Integer.toHexString(tag));
       }
   
       public java.io.Serializable read_value (String rep_id) 
       {
  +     int start_offset = pos;
           int tag = read_long();
  +
  +        if (tag == 0xffffffff)
  +            // indirection
  +            return read_indirect_value();
  +        else if (tag == 0x00000000) 
  +            // null tag
  +            return null;
  +   
  +        String codebase = ((tag & 1) != 0) ? read_codebase() : null;
  +
  +        tag = tag & 0xfffffffe;
  +
           if (tag == 0x7fffff00)
  -            return read_untyped_value (rep_id, pos - 4);
  +            return read_untyped_value (rep_id, start_offset, codebase);
           else if (tag == 0x7fffff02)
  -            return read_typed_value();
  +            return read_typed_value(start_offset, codebase);
           else
  -            return read_special_value (tag);
  +            throw new org.omg.CORBA.MARSHAL ("unknown value tag: " 
  +                                             + Integer.toHexString(tag));
       }
   
       public java.io.Serializable read_value (java.lang.Class clz) 
       {
  +     int start_offset = pos;
           int tag = read_long();
  +
  +        if (tag == 0xffffffff)
  +            // indirection
  +            return read_indirect_value();
  +        else if (tag == 0x00000000) 
  +            // null tag
  +            return null;
  +   
  +        String codebase = ((tag & 1) != 0) ? read_codebase() : null;
  +
  +        tag = tag & 0xfffffffe;
  +
           if (tag == 0x7fffff00)
               return read_untyped_value (org.jacorb.ir.RepositoryID.repId (clz),
  -                                       pos - 4);
  +                                       start_offset, codebase);
           else if (tag == 0x7fffff02)
  -            return read_typed_value();
  +            return read_typed_value(start_offset, codebase);
           else
  -            return read_special_value (tag);
  +            throw new org.omg.CORBA.MARSHAL ("unknown value tag: " 
  +                                             + Integer.toHexString(tag));
       }
   
       public java.io.Serializable read_value (
         org.omg.CORBA.portable.BoxedValueHelper factory) 
       {
  +     int start_offset = pos;
           int tag = read_long();
  +
  +        if (tag == 0xffffffff)
  +            // indirection
  +            return read_indirect_value();
  +        else if (tag == 0x00000000) 
  +            // null tag
  +            return null;
  +   
  +        String codebase = ((tag & 1) != 0) ? read_codebase() : null;
  +
  +        tag = tag & 0xfffffffe;
  +
           if (tag == 0x7fffff00) 
           {
  -            int index = pos - 4;
               java.io.Serializable result = factory.read_value (this);
  -            valueMap.put (new Integer(index), result);
  +            valueMap.put (new Integer(start_offset), result);
               return result;
           } 
           else if (tag == 0x7fffff02)
  @@ -1494,9 +1560,10 @@
               // Possible optimization: ignore type info and use factory for
               // reading the value anyway, since the type information is 
               // most likely redundant.
  -            return read_typed_value(); 
  +            return read_typed_value(start_offset, codebase); 
           else 
  -            return read_special_value (tag);
  +            throw new org.omg.CORBA.MARSHAL ("unknown value tag: " 
  +                                             + Integer.toHexString(tag));
       }
   
       /**
  @@ -1506,7 +1573,8 @@
        * `index'.
        */
       private java.io.Serializable read_untyped_value (String repository_id,
  -                                                     int index)
  +                                                     int index, 
  +                                                  String codebase)
       {
           java.io.Serializable result;
        if (repository_id.equals("IDL:omg.org/CORBA/WStringValue:1.0"))
  @@ -1535,17 +1603,16 @@
               String className = 
                   org.jacorb.ir.RepositoryID.className (repository_id);
               Class c = null;
  -            try {
  -             c = Thread.currentThread().getContextClassLoader().loadClass
  -                                                                (className);
  -            } catch (ClassNotFoundException e) {
  +            try 
  +         {
  +                c = javax.rmi.CORBA.Util.loadClass(className, codebase, null);
  +            } 
  +            catch (ClassNotFoundException e) 
  +            {
                   throw new RuntimeException ("class not found: " + className);
               }
  -            result = ValueHandler.readValue(this, index, 
  -                                            c,
  -                                            repository_id, 
  -                                            // use our own code base for now
  -                                            ValueHandler.getRunTimeCodeBase());
  +            result = ValueHandler.readValue(this, index, c, 
  +                                         repository_id, null);
           }
           
           valueMap.put (new Integer (index), result);
  @@ -1554,13 +1621,12 @@
   
       /**
        * Reads a value with type information, i.e. one that is preceded 
  -     * by a RepositoryID.  It is assumed that the tag of the value
  -     * has already been read.
  +     * by a RepositoryID.  It is assumed that the tag and the codebase 
  +     * of the value have already been read.
        */
  -    private java.io.Serializable read_typed_value() 
  +    private java.io.Serializable read_typed_value(int index, String codebase) 
       {
  -        int index = pos - 4;
  -        return read_untyped_value (read_repository_id(), index);
  +        return read_untyped_value (read_repository_id(), index, codebase);
       }
   
       /**
  @@ -1593,25 +1659,73 @@
           }
       }
   
  -    private java.io.Serializable read_special_value (int tag) {
  -        if (tag == 0x00000000) 
  -            // null tag
  -            return null;
  -        else if (tag == 0xffffffff) 
  +    /**
  +     * Reads a codebase from the buffer, either directly or via
  +     * indirection.
  +     */
  +    private String read_codebase() 
  +    {
  +        int tag = read_long();
  +        if (tag == 0xffffffff)  
           {
               // indirection
               int index = read_long();
               index = index + pos - 4;
  -            java.lang.Object value = valueMap.get (new Integer(index));
  -            if (value == null)
  -                throw new org.omg.CORBA.MARSHAL ("stale value indirection");
  +            String codebase = (String)codebaseMap.get (new Integer(index));
  +            if (codebase == null)
  +                throw 
  +                 new org.omg.CORBA.MARSHAL ("stale codebase indirection");
               else
  -                return (java.io.Serializable)value;
  -        } 
  +                return codebase;
  +        }
           else
  -            throw new org.omg.CORBA.MARSHAL ("unknown value tag: " 
  -                                          + Integer.toHexString(tag));
  +        {
  +            // a new codebase string
  +            pos -= 4;
  +            int index = pos;
  +            String codebase = read_string();
  +            codebaseMap.put (new Integer(index), codebase);
  +            return codebase;
  +        }
  +    }
  +
  +    /**
  +     * Reads an indirect value from this stream. It is assumed that the
  +     * value tag (0xffffffff) has already been read.
  +     */
  +    private java.io.Serializable read_indirect_value () 
  +    {
  +        // indirection
  +        int index = read_long();
  +        index = index + pos - 4;
  +        java.lang.Object value = valueMap.get (new Integer(index));
  +        if (value == null)
  +            throw new org.omg.CORBA.MARSHAL ("stale value indirection");
  +        else
  +            return (java.io.Serializable)value;
       } 
  +
  +    /**
  +     * Reads an abstract interface from this stream. The abstract interface 
  +     * appears as a union with a boolean discriminator, which is true if the
  +     * union contains a CORBA object reference, or false if the union contains
  +     * a value. 
  +     */
  +    public java.lang.Object read_abstract_interface() {
  +     return read_boolean() ? (java.lang.Object)read_Object() 
  +                           : (java.lang.Object)read_value();
  +    }
  +
  +    /**
  +     * Reads an abstract interface from this stream. The abstract interface 
  +     * appears as a union with a boolean discriminator, which is true if the
  +     * union contains a CORBA object reference, or false if the union contains
  +     * a value. 
  +     */
  +    public java.lang.Object read_abstract_interface(java.lang.Class clz) {
  +     return read_boolean() ? (java.lang.Object)read_Object(clz) 
  +                           : (java.lang.Object)read_value(clz);
  +    }
   
       //      public byte[]  get_buffer(){
       //       return buffer;
  Index: src/org/jacorb/orb/CDROutputStream.java
  ===================================================================
  RCS file: 
/home/bwana/brose/cvs_jacorb/JacORB/src/org/jacorb/orb/CDROutputStream.java,v
  retrieving revision 1.25
  diff -u -r1.25 CDROutputStream.java
  --- CDROutputStream.java      2001/11/20 12:45:12     1.25
  +++ CDROutputStream.java      2001/12/05 20:11:37
  @@ -81,6 +81,13 @@
        */
       private Map repIdMap = new HashMap();
   
  +    /**
  +     * Maps all codebase strings that have already been written to this
  +     * stream to their position within the buffer.  The position is
  +     * stored as a java.lang.Integer.  
  +     */
  +    private Map codebaseMap = new HashMap();
  +
       private final static String null_ior_str = 
           "IOR:00000000000000010000000000000000";
       private final static org.omg.IOP.IOR null_ior = 
  @@ -949,12 +956,16 @@
           */
   
           int start_pos = pos+1;
  -        int _kind = ((TypeCode)value)._kind();
  +     // The line below gives a ClassCastException with IBM's jdk 
  +        //int _kind = ((TypeCode)value)._kind(); 
  +        int _kind = ((value instanceof TypeCode) ?
  +                     ((TypeCode)value)._kind() : value.kind().value());
           int _mc; // member count
   
           try
           {
  -            if( ((TypeCode)value).is_recursive() &&
  +            if( (value instanceof TypeCode) &&
  +                ((TypeCode)value).is_recursive() &&
                   tcMap.containsKey( value.id()) )
               {
                   writeRecursiveTypeCode( value, tcMap );
  @@ -1153,6 +1164,20 @@
                       write_TypeCode( value.content_type(), tcMap);
                       endEncapsulation();
                       break;
  +                case TCKind._tk_abstract_interface: 
  +                    if( tcMap.containsKey( value.id()) )
  +                    {
  +                        writeRecursiveTypeCode( value, tcMap );
  +                    }
  +                    else
  +                    {
  +                        write_long( _kind  );
  +                        beginEncapsulation();
  +                        write_string(value.id());
  +                        write_string(value.name());
  +                        endEncapsulation();
  +                    }
  +                    break;
                   default: 
                       throw new RuntimeException("Cannot handle TypeCode, kind: " + 
_kind);
                   }
  @@ -1252,7 +1277,6 @@
           Debug.myAssert( tc != null, "Illegal null pointer for TypeCode");
           int kind = ((TypeCode)tc)._kind();
    
  -        //int kind = tc.kind().value();
           switch (kind)
           {
               case TCKind._tk_null: 
  @@ -1704,6 +1728,65 @@
       }
   
       /**
  +     * Writes `codebase' to this stream, perhaps via indirection.
  +     */
  +    private void write_codebase (String codebase)
  +    {
  +        Integer index = (Integer)codebaseMap.get (codebase);
  +        if (index == null)
  +        {
  +            // a new codebase -- write it
  +            codebaseMap.put (codebase, new Integer(pos));
  +            write_string (codebase);
  +        }
  +        else
  +        {
  +            // a previously written codebase -- make an indirection
  +            write_long (0xffffffff);
  +            write_long (index.intValue() - pos);
  +        }
  +    }
  +
  +    /**
  +     * Writes to this stream a value header with the specified `repository_id'
  +     * and no codebase string.
  +     */
  +    private void write_value_header (String repository_id)
  +    {
  +        if (repository_id != null) 
  +        {
  +            write_long (0x7fffff02);
  +            write_repository_id (repository_id);
  +        }
  +        else
  +            write_long (0x7fffff00);
  +    }
  +
  +    /**
  +     * Writes to this stream a value header with the specified `repository_id'.
  +     * and `codebase' string.
  +     */
  +    private void write_value_header (String repository_id, String codebase)
  +    { 
  +     if (codebase != null) 
  +     {
  +         if (repository_id != null) 
  +         {
  +             write_long (0x7fffff03);
  +             write_codebase(codebase);
  +             write_repository_id (repository_id);
  +         }
  +         else 
  +         {
  +             write_long (0x7fffff01);
  +             write_codebase(codebase);
  +         }
  +     }
  +     else
  +         write_value_header (repository_id);
  +    }
  +
  +    /**
        * This method does the actual work of writing `value' to this 
        * stream.  If `repository_id' is non-null, then it is used as
        * the type information for `value' (possibly via indirection).
  @@ -1716,24 +1799,45 @@
                                          String repository_id) 
       {
           valueMap.put (value, new Integer(pos));
  -        if (repository_id != null) 
  -        {
  -            write_long (0x7fffff02);
  -            write_repository_id (repository_id);
  -        }
  -        else
  -            write_long (0x7fffff00);
   
           if (value.getClass() == String.class) 
  +     {
               // special handling for strings required according to spec
  +         write_value_header(repository_id);
            write_wstring((String)value);
  +     }
           else if (value instanceof org.omg.CORBA.portable.StreamableValue)
  +     {
  +         write_value_header(repository_id);
               ((org.omg.CORBA.portable.StreamableValue)value)._write (this);
  -        else
  +     }
  +        else 
  +        {
  +         String codebase = 
  +             javax.rmi.CORBA.Util.getCodebase(value.getClass());
  +         write_value_header(repository_id, codebase);
               ValueHandler.writeValue (this, value);
  -
  +     }
       }
  -}
  -
   
  +    /**
  +     * Writes an abstract interface to this stream. The abstract interface is
  +     * written as a union with a boolean discriminator, which is true if the
  +     * union contains a CORBA object reference, or false if the union contains
  +     * a value. 
  +     */
  +    public void write_abstract_interface(java.lang.Object object) 
  +    {
  +     if (object instanceof org.omg.CORBA.Object) 
  +     {
  +         write_boolean(true);
  +         write_Object((org.omg.CORBA.Object)object);
  +     }
  +     else
  +     {
  +         write_boolean(false);
  +         write_value((java.io.Serializable)object);
  +     }
  +    }
   
  +}
  Index: src/org/jacorb/orb/Delegate.java
  ===================================================================
  RCS file: /home/bwana/brose/cvs_jacorb/JacORB/src/org/jacorb/orb/Delegate.java,v
  retrieving revision 1.30
  diff -u -r1.30 Delegate.java
  --- Delegate.java     2001/11/13 12:13:21     1.30
  +++ Delegate.java     2001/12/05 20:11:37
  @@ -36,6 +36,7 @@
   import org.omg.IOP.ServiceContext;
   import org.omg.GIOP.*;
   import org.omg.CORBA.SystemException;
  +import org.omg.PortableServer.POAPackage.ObjectNotActive;
   
   /**
    * JacORB implementation of CORBA object reference
  @@ -46,7 +47,7 @@
    */
   
   public final class Delegate
  -    extends org.omg.CORBA.portable.Delegate
  +    extends org.omg.CORBA_2_3.portable.Delegate
   {
       // WARNING: DO NOT USE _pior DIRECTLY, BECAUSE THAT IS NOT MT
       // SAFE. USE getParsedIOR() INSTEAD, AND KEEP A METHOD-LOCAL COPY
  @@ -81,6 +82,9 @@
       private boolean locate_on_bind_performed = false;
   
       private ConnectionManager conn_mg = null;
  +
  +    private Hashtable policy_overrides = new Hashtable();
  +
       /**
        * A general note on the synchronization concept
        *
  @@ -1270,7 +1274,8 @@
               try 
               {
                   ServantObject so = new ServantObject();
  -                if( poa.isRetain() || poa.useDefaultServant() )
  +                if( ( poa.isRetain() && !poa.isUseServantManager() ) 
  +                 || poa.useDefaultServant() )
                   {
                       so.servant = poa.reference_to_servant(self);
                   }
  @@ -1377,6 +1382,40 @@
       public void initInterceptors()
       {
           use_interceptors = ((org.jacorb.orb.ORB) 
orb).hasClientRequestInterceptors();
  +    }
  +
  +    public org.omg.CORBA.Object set_policy_override(org.omg.CORBA.Object self,
  +                org.omg.CORBA.Policy[] policies,
  +                org.omg.CORBA.SetOverrideType set_add) 
  +    {
  +     if ( set_add == org.omg.CORBA.SetOverrideType.SET_OVERRIDE )
  +     {
  +         policy_overrides.clear();
  +     }
  +     for (int i = 0; i < policies.length; i++)
  +     {
  +         if ( ((org.jacorb.orb.ORB)orb).hasPolicyFactoryForType( 
policies[i].policy_type() ) )
  +         {
  +             policy_overrides.put(new Integer(policies[i].policy_type()), 
policies[i]);
  +         }
  +     }
  +     ParsedIOR pior = getParsedIOR();
  +     org.omg.IOP.IOR ior = ((org.jacorb.orb.ORB)orb).createIOR( 
pior.getIOR().type_id, 
  +                                                                
pior.get_object_key(), 
  +                                                                
!poa.isPersistent(), 
  +                                                                poa,
  +                                                                policy_overrides);
  +        synchronized( bind_sync )
  +        {
  +         _pior = new ParsedIOR( ior );
  +         getParsedIOR().init();
  +     }
  +     return self;
  +    }
  +
  +    public String get_codebase(org.omg.CORBA.Object self)
  +    {
  +     return getParsedIOR().getCodebaseComponent();
       }
   
       private class Barrier
  Index: src/org/jacorb/orb/ORBSingleton.java
  ===================================================================
  RCS file: /home/bwana/brose/cvs_jacorb/JacORB/src/org/jacorb/orb/ORBSingleton.java,v
  retrieving revision 1.8
  diff -u -r1.8 ORBSingleton.java
  --- ORBSingleton.java 2001/10/02 08:08:38     1.8
  +++ ORBSingleton.java 2001/12/05 20:11:38
  @@ -75,7 +75,8 @@
   
       public TypeCode create_interface_tc( String id, String name)
       {
  -        return new org.jacorb.orb.TypeCode( id, name);
  +        return new org.jacorb.orb.TypeCode( org.omg.CORBA.TCKind._tk_objref, 
  +                                        id, name);
       }
   
       public org.omg.CORBA.TypeCode create_fixed_tc( short digits, 
  @@ -163,6 +164,12 @@
                                       TypeCode boxed_type) {
           return new org.jacorb.orb.TypeCode (org.omg.CORBA.TCKind._tk_value_box,
                                               id, name, boxed_type);
  +    }
  +
  +    public org.omg.CORBA.TypeCode create_abstract_interface_tc(String id,
  +                                    String name) {
  +        return new org.jacorb.orb.TypeCode 
(org.omg.CORBA.TCKind._tk_abstract_interface,
  +                                         id, name);
       }
   
       /* DII helper methods */
  Index: src/org/jacorb/orb/ParsedIOR.java
  ===================================================================
  RCS file: /home/bwana/brose/cvs_jacorb/JacORB/src/org/jacorb/orb/ParsedIOR.java,v
  retrieving revision 1.15
  diff -u -r1.15 ParsedIOR.java
  --- ParsedIOR.java    2001/11/14 12:40:22     1.15
  +++ ParsedIOR.java    2001/12/05 20:11:38
  @@ -266,6 +266,24 @@
           }
       }
   
  +    public String getCodebaseComponent()
  +    {
  +        for ( int i = 0; i < taggedComponents.length; i++ )
  +        {
  +         if( taggedComponents[i].tag != TAG_JAVA_CODEBASE.value ) 
  +             continue;
  +
  +         Debug.output(4,"TAG_JAVA_CODEBASE found");                  
  +
  +         // get codebase cs from IOR 
  +         CDRInputStream is =
  +             new CDRInputStream( orb, 
  +                                   taggedComponents[i].component_data);
  +         return is.read_string();
  +     }
  +        return null;
  +    }
  +
       /* instance part */
   
       public ParsedIOR( String object_reference )
  Index: src/org/jacorb/orb/TypeCode.java
  ===================================================================
  RCS file: /home/bwana/brose/cvs_jacorb/JacORB/src/org/jacorb/orb/TypeCode.java,v
  retrieving revision 1.13
  diff -u -r1.13 TypeCode.java
  --- TypeCode.java     2001/11/16 16:13:11     1.13
  +++ TypeCode.java     2001/12/05 20:11:38
  @@ -83,7 +83,9 @@
           // not actually primitive, but as a courtesy to Sun's JDK, which
           // insists on calling get_primitive_tc with an argument kind of
           // tk_object
  -        primitive_tcs[14] = new TypeCode( "IDL:omg.org/CORBA/Object:1.0", "Object" 
);
  +        primitive_tcs[14] = new TypeCode( TCKind._tk_objref, 
  +                                          "IDL:omg.org/CORBA/Object:1.0", 
  +                                          "Object" );
   
           primitive_tcs[18] = new TypeCode( 18, 0 );
   
  @@ -91,6 +93,14 @@
           {
               primitive_tcs[i] = new TypeCode(i);
           }
  +
  +        primitive_tcs[29] = 
  +            new TypeCode (RepositoryID.repId (java.io.Serializable.class),
  +                          "java.io.Serializable",
  +                          org.omg.CORBA.VM_NONE.value,
  +                          null,
  +                          new org.omg.CORBA.ValueMember[0]);
  +
           put_primitive_tcs (Boolean.TYPE,   TCKind._tk_boolean);
           put_primitive_tcs (Character.TYPE, TCKind._tk_wchar);
           put_primitive_tcs (Byte.TYPE,      TCKind._tk_octet);
  @@ -248,13 +258,14 @@
       }
   
       /**
  -     * Constructor for tk_objref
  +     * Constructor for tk_objref, tk_abstract_interface
        */  
   
  -    public TypeCode (java.lang.String _id, 
  +    public TypeCode (int _kind, 
  +              java.lang.String _id, 
                 java.lang.String _name)
       { 
  -        kind = TCKind._tk_objref;
  +        kind = _kind;
           id   = _id;
           name = _name.replace('.','_'); // for orbixWeb Interop
       }
  @@ -896,7 +907,7 @@
                                    0, create_tc (clz.getComponentType(),
                                                  knownClasses));
           else if (java.rmi.Remote.class.isAssignableFrom (clz))
  -            return new TypeCode (RepositoryID.repId (clz),
  +            return new TypeCode (TCKind._tk_objref, RepositoryID.repId (clz),
                                    clz.getName());
           else if (java.io.Serializable.class.isAssignableFrom (clz))
           {
  @@ -911,6 +922,10 @@
                                    org.omg.CORBA.VM_NONE.value,
                                    superTypeCode,
                                    getValueMembers (clz, knownClasses));
  +        }
  +        else if (clz == java.lang.Object.class)
  +        {
  +            return get_primitive_tc(TCKind._tk_any);
           }
           else
               throw new RuntimeException 
  Index: src/org/jacorb/orb/portableInterceptor/IORInfoImpl.java
  ===================================================================
  RCS file: 
/home/bwana/brose/cvs_jacorb/JacORB/src/org/jacorb/orb/portableInterceptor/IORInfoImpl.java,v
  retrieving revision 1.3
  diff -u -r1.3 IORInfoImpl.java
  --- IORInfoImpl.java  2001/03/19 11:08:54     1.3
  +++ IORInfoImpl.java  2001/12/05 20:11:38
  @@ -6,6 +6,7 @@
   import org.jacorb.orb.ORB;
   import org.jacorb.poa.POA;
   import java.util.Vector;
  +import java.util.Hashtable;
   /**
    * This class represents the type of info object
    * that will be passed to the IORInterceptors. <br>
  @@ -21,15 +22,18 @@
     Vector components_iiop_profile = null;
     Vector components_multi_profile = null;
   
  +  private Hashtable policy_overrides = null;
     private ORB orb = null;
     private POA poa = null;
     
     public IORInfoImpl(ORB orb, POA poa,
                     Vector components_iiop_profile,
  -                  Vector components_multi_profile) {
  +                  Vector components_multi_profile,
  +                     Hashtable policy_overrides) {
   
       this.components_iiop_profile = components_iiop_profile;
       this.components_multi_profile = components_multi_profile;
  +    this.policy_overrides = policy_overrides;
   
       this.orb = orb;
       this.poa = poa;
  @@ -58,8 +62,10 @@
         throw new INV_POLICY("No PolicyFactory for type " + type + 
                           " has been registered!", 2,
                           CompletionStatus.COMPLETED_MAYBE);
  -    
  -    return poa.getPolicy(type);
  +    Policy policy = null;
  +    if (policy_overrides != null)
  +     policy = (Policy)policy_overrides.get(new Integer(type));
  +    return (policy != null) ? policy : poa.getPolicy(type);
     }
   } // IORInfoImpl
   
  Index: src/org/jacorb/orb/util/PrintIOR.java
  ===================================================================
  RCS file: /home/bwana/brose/cvs_jacorb/JacORB/src/org/jacorb/orb/util/PrintIOR.java,v
  retrieving revision 1.7
  diff -u -r1.7 PrintIOR.java
  --- PrintIOR.java     2001/11/02 16:05:54     1.7
  +++ PrintIOR.java     2001/12/05 20:11:38
  @@ -167,6 +167,11 @@
                       } 
                   }
               }
  +         String codebase = pior.getCodebaseComponent();
  +         if( codebase != null )
  +            {
  +             System.out.println("\tJava Codebase Component:\n\t\t" + codebase);     
         
  +         }
               System.out.print("\n");
           }
            orb.shutdown(true);
  Index: src/org/jacorb/poa/POA.java
  ===================================================================
  RCS file: /home/bwana/brose/cvs_jacorb/JacORB/src/org/jacorb/poa/POA.java,v
  retrieving revision 1.13
  diff -u -r1.13 POA.java
  --- POA.java  2001/11/16 16:13:15     1.13
  +++ POA.java  2001/12/05 20:11:39
  @@ -1237,7 +1237,7 @@
               threadPolicy.value() == ThreadPolicyValue.SINGLE_THREAD_MODEL;
       }
   
  -    protected boolean isSystemId() 
  +    public boolean isSystemId() 
       {
           return idAssignmentPolicy == null || 
               idAssignmentPolicy.value() == IdAssignmentPolicyValue.SYSTEM_ID;
  Index: src/org/jacorb/util/Environment.java
  ===================================================================
  RCS file: /home/bwana/brose/cvs_jacorb/JacORB/src/org/jacorb/util/Environment.java,v
  retrieving revision 1.31
  diff -u -r1.31 Environment.java
  --- Environment.java  2001/11/19 13:50:48     1.31
  +++ Environment.java  2001/12/05 20:11:39
  @@ -660,7 +660,11 @@
   
                   try
                   {
  -                    orb_initializers.addElement(Class.forName(name).newInstance());
  +                 ClassLoader cl = 
  +                     Thread.currentThread().getContextClassLoader();
  +                 if (cl == null)
  +                     cl = ClassLoader.getSystemClassLoader();
  +                    orb_initializers.addElement(cl.loadClass(name).newInstance());
                       Debug.output(Debug.INTERCEPTOR | Debug.DEBUG1, 
                                    "Build: " + name);
                   }
  Index: src/org/jacorb/orb/ORB.java
  ===================================================================
  diff -u ORB.java.original ORB.java
  --- ORB.java.original Tue Nov 20 11:37:42 2001
  +++ ORB.java          Wed Dec  5 20:17:27 2001
  @@ -293,7 +293,8 @@
               byte[] objectId = 
                   org.jacorb.poa.util.POAUtil.extractOID( ref );
   
  -            if( ! tmp_poa.previouslyGeneratedObjectId( objectId ))
  +            if( tmp_poa.isSystemId() 
  +             && ! tmp_poa.previouslyGeneratedObjectId( objectId ))
               {
                   Debug.output(3, "ORB.findPOA: not a previously generated object 
key.");
                   return null;
  @@ -384,17 +385,19 @@
       }
   
       /**
  -     * Called from within getReference above. 
  +     * Called from within getReference (below) and set_policy_override
  +     * (in org.jacorb.orb.Delegate). 
        *
        * Generates IOR 1.0 and 1.1, 1.1 contains also 1.0 profile. Only 1.1 and 
        * greater profiles contain codeset information about this server. <br>
        * If present, IORInterceptors will be invoked.
        */
   
  -    protected org.omg.IOP.IOR createIOR( String repId, 
  -                                         byte[] key, 
  -                                         boolean _transient, 
  -                                         org.jacorb.poa.POA poa )
  +    org.omg.IOP.IOR createIOR( String repId, 
  +                            byte[] key, 
  +                            boolean _transient, 
  +                            org.jacorb.poa.POA poa,
  +                            Hashtable policy_overrides)
       {
           String address = Environment.getProperty( "jacorb.ior_proxy_host" );
           if( address == null )
  @@ -480,7 +483,8 @@
                   new IORInfoImpl(this, 
                                   poa, 
                                   components_iiop_profile,
  -                                components_multi_profile);
  +                                components_multi_profile,
  +                                policy_overrides);
               try
               {
                   interceptor_manager.getIORIterator().iterate(info);
  @@ -664,7 +668,7 @@
                   rep_id = "IDL:org.omg/CORBA/Object:1.0";
   
               org.omg.IOP.IOR ior = 
  -                createIOR( rep_id, object_key, _transient, poa );
  +                createIOR( rep_id, object_key, _transient, poa, null );
   
               Delegate d = new Delegate( this, ior );
               return d.getReference( poa );
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to