/*    */ public static void insert(Any paramAny, IORInterceptor_3_0 paramIORInterceptor_3_0)
       /*    */ {
   /* 17 */ OutputStream localOutputStream = paramAny.create_output_stream();
   /* 18 */ paramAny.type(type());
   /* 19 */ write(localOutputStream, paramIORInterceptor_3_0);
   /* 20 */ paramAny.read_value(localOutputStream.create_input_stream(), type());
   /*    */ }
Exemplo n.º 2
0
 // This method could very well be moved into TypeCodeImpl or a common utility class,
 // but is has to be in this package.
 public static Any extractAnyFromStream(TypeCode memberType, InputStream input, ORB orb) {
   Any returnValue = orb.create_any();
   OutputStream out = returnValue.create_output_stream();
   TypeCodeImpl.convertToNative(orb, memberType).copy(input, out);
   returnValue.read_value(out.create_input_stream(), memberType);
   return returnValue;
 }
 /*     */ public static void insert(Any paramAny, ValueMember[] paramArrayOfValueMember)
       /*     */ {
   /*  49 */ OutputStream localOutputStream = paramAny.create_output_stream();
   /*  50 */ paramAny.type(type());
   /*  51 */ write(localOutputStream, paramArrayOfValueMember);
   /*  52 */ paramAny.read_value(localOutputStream.create_input_stream(), type());
   /*     */ }
Exemplo n.º 4
0
 /*      */ public Any extractAny(TypeCode paramTypeCode, ORB paramORB) /*      */ {
   /* 1315 */ Any localAny = paramORB.create_any();
   /* 1316 */ org.omg.CORBA.portable.OutputStream localOutputStream =
       localAny.create_output_stream();
   /* 1317 */ TypeCodeImpl.convertToNative(paramORB, paramTypeCode)
       .copy(this.stream, localOutputStream);
   /* 1318 */ localAny.read_value(localOutputStream.create_input_stream(), paramTypeCode);
   /* 1319 */ return localAny;
   /*      */ }
 /**
  * Static method for writing a CORBA standard exception to an Any.
  *
  * @param any The Any to write the SystemException into.
  */
 public static void insertSystemException(SystemException ex, Any any) {
   OutputStream out = any.create_output_stream();
   ORB orb = (ORB) (out.orb());
   String name = ex.getClass().getName();
   String repID = ORBUtility.repositoryIdOf(name);
   out.write_string(repID);
   out.write_long(ex.minor);
   out.write_long(ex.completed.value());
   any.read_value(out.create_input_stream(), getSystemExceptionTypeCode(orb, repID, name));
 }
Exemplo n.º 6
0
 /*      */ public static Any extractAnyFromStream(
     TypeCode paramTypeCode, org.omg.CORBA.portable.InputStream paramInputStream, ORB paramORB)
       /*      */ {
   /* 1325 */ Any localAny = paramORB.create_any();
   /* 1326 */ org.omg.CORBA.portable.OutputStream localOutputStream =
       localAny.create_output_stream();
   /* 1327 */ TypeCodeImpl.convertToNative(paramORB, paramTypeCode)
       .copy(paramInputStream, localOutputStream);
   /* 1328 */ localAny.read_value(localOutputStream.create_input_stream(), paramTypeCode);
   /* 1329 */ return localAny;
   /*      */ }
Exemplo n.º 7
0
  public Any decode_value(byte[] data, TypeCode tc) throws FormatMismatch, TypeMismatch {
    final CDRInputStream in = new CDRInputStream(orb, data);

    try {
      in.setGIOPMinor(giopMinor);

      in.openEncapsulatedArray();
      Any result = orb.create_any();
      result.read_value(in, tc);

      // not necessary, since stream is never used again
      // in.closeEncasupaltion();

      return result;
    } finally {
      in.close();
    }
  }
Exemplo n.º 8
0
  // Needed for equal() in order to achieve linear performance for complex types.
  // Uses up (recursively) copies of the InputStream in both Anys that got created in equal().
  private boolean equalMember(TypeCode memberType, InputStream myStream, InputStream otherStream) {
    // Resolve aliases here
    TypeCode realType = realType(memberType);

    try {
      switch (realType.kind().value()) {
          // handle primitive types
        case TCKind._tk_null:
        case TCKind._tk_void:
          return true;
        case TCKind._tk_short:
          return (myStream.read_short() == otherStream.read_short());
        case TCKind._tk_long:
          return (myStream.read_long() == otherStream.read_long());
        case TCKind._tk_ushort:
          return (myStream.read_ushort() == otherStream.read_ushort());
        case TCKind._tk_ulong:
          return (myStream.read_ulong() == otherStream.read_ulong());
        case TCKind._tk_float:
          return (myStream.read_float() == otherStream.read_float());
        case TCKind._tk_double:
          return (myStream.read_double() == otherStream.read_double());
        case TCKind._tk_boolean:
          return (myStream.read_boolean() == otherStream.read_boolean());
        case TCKind._tk_char:
          return (myStream.read_char() == otherStream.read_char());
        case TCKind._tk_wchar:
          return (myStream.read_wchar() == otherStream.read_wchar());
        case TCKind._tk_octet:
          return (myStream.read_octet() == otherStream.read_octet());
        case TCKind._tk_any:
          return myStream.read_any().equal(otherStream.read_any());
        case TCKind._tk_TypeCode:
          return myStream.read_TypeCode().equal(otherStream.read_TypeCode());
        case TCKind._tk_string:
          return myStream.read_string().equals(otherStream.read_string());
        case TCKind._tk_wstring:
          return (myStream.read_wstring().equals(otherStream.read_wstring()));
        case TCKind._tk_longlong:
          return (myStream.read_longlong() == otherStream.read_longlong());
        case TCKind._tk_ulonglong:
          return (myStream.read_ulonglong() == otherStream.read_ulonglong());

        case TCKind._tk_objref:
          return (myStream.read_Object().equals(otherStream.read_Object()));
        case TCKind._tk_Principal:
          return (myStream.read_Principal().equals(otherStream.read_Principal()));

        case TCKind._tk_enum:
          return (myStream.read_long() == otherStream.read_long());
        case TCKind._tk_fixed:
          return (myStream.read_fixed().compareTo(otherStream.read_fixed()) == 0);
        case TCKind._tk_except:
        case TCKind._tk_struct:
          {
            int length = realType.member_count();
            for (int i = 0; i < length; i++) {
              if (!equalMember(realType.member_type(i), myStream, otherStream)) {
                return false;
              }
            }
            return true;
          }
        case TCKind._tk_union:
          {
            Any myDiscriminator = orb.create_any();
            Any otherDiscriminator = orb.create_any();
            myDiscriminator.read_value(myStream, realType.discriminator_type());
            otherDiscriminator.read_value(otherStream, realType.discriminator_type());

            if (!myDiscriminator.equal(otherDiscriminator)) {
              return false;
            }
            TypeCodeImpl realTypeCodeImpl = TypeCodeImpl.convertToNative(orb, realType);
            int memberIndex = realTypeCodeImpl.currentUnionMemberIndex(myDiscriminator);
            if (memberIndex == -1) throw wrapper.unionDiscriminatorError();

            if (!equalMember(realType.member_type(memberIndex), myStream, otherStream)) {
              return false;
            }
            return true;
          }
        case TCKind._tk_sequence:
          {
            int length = myStream.read_long();
            otherStream.read_long(); // just so that the two stream are in sync
            for (int i = 0; i < length; i++) {
              if (!equalMember(realType.content_type(), myStream, otherStream)) {
                return false;
              }
            }
            return true;
          }
        case TCKind._tk_array:
          {
            int length = realType.member_count();
            for (int i = 0; i < length; i++) {
              if (!equalMember(realType.content_type(), myStream, otherStream)) {
                return false;
              }
            }
            return true;
          }

          // Too complicated to handle value types the way we handle
          // other complex types above. Don't try to decompose it here
          // for faster comparison, just use Object.equals().
        case TCKind._tk_value:
        case TCKind._tk_value_box:
          org.omg.CORBA_2_3.portable.InputStream mine =
              (org.omg.CORBA_2_3.portable.InputStream) myStream;
          org.omg.CORBA_2_3.portable.InputStream other =
              (org.omg.CORBA_2_3.portable.InputStream) otherStream;
          return mine.read_value().equals(other.read_value());

        case TCKind._tk_alias:
          // error resolving alias above
          throw wrapper.errorResolvingAlias();

        case TCKind._tk_longdouble:
          throw wrapper.tkLongDoubleNotSupported();

        default:
          throw wrapper.typecodeNotSupported();
      }
    } catch (BadKind badKind) { // impossible
      throw wrapper.badkindCannotOccur();
    } catch (Bounds bounds) { // impossible
      throw wrapper.boundsCannotOccur();
    }
  }
Exemplo n.º 9
0
 /*      */ private boolean equalMember(
     TypeCode paramTypeCode,
     org.omg.CORBA.portable.InputStream paramInputStream1,
     org.omg.CORBA.portable.InputStream paramInputStream2)
       /*      */ {
   /*  369 */ TypeCode localTypeCode = realType(paramTypeCode);
   /*      */ try
   /*      */ {
     /*      */ int j;
     /*      */ int m;
     /*  372 */ switch (localTypeCode.kind().value())
     /*      */ {
         /*      */ case 0:
         /*      */ case 1:
         /*  376 */ return true;
         /*      */ case 2:
         /*  378 */ return paramInputStream1.read_short() == paramInputStream2.read_short();
         /*      */ case 3:
         /*  380 */ return paramInputStream1.read_long() == paramInputStream2.read_long();
         /*      */ case 4:
         /*  382 */ return paramInputStream1.read_ushort() == paramInputStream2.read_ushort();
         /*      */ case 5:
         /*  384 */ return paramInputStream1.read_ulong() == paramInputStream2.read_ulong();
         /*      */ case 6:
         /*  386 */ return paramInputStream1.read_float() == paramInputStream2.read_float();
         /*      */ case 7:
         /*  388 */ return paramInputStream1.read_double() == paramInputStream2.read_double();
         /*      */ case 8:
         /*  390 */ return paramInputStream1.read_boolean() == paramInputStream2.read_boolean();
         /*      */ case 9:
         /*  392 */ return paramInputStream1.read_char() == paramInputStream2.read_char();
         /*      */ case 26:
         /*  394 */ return paramInputStream1.read_wchar() == paramInputStream2.read_wchar();
         /*      */ case 10:
         /*  396 */ return paramInputStream1.read_octet() == paramInputStream2.read_octet();
         /*      */ case 11:
         /*  398 */ return paramInputStream1.read_any().equal(paramInputStream2.read_any());
         /*      */ case 12:
         /*  400 */ return paramInputStream1
             .read_TypeCode()
             .equal(paramInputStream2.read_TypeCode());
         /*      */ case 18:
         /*  402 */ return paramInputStream1.read_string().equals(paramInputStream2.read_string());
         /*      */ case 27:
         /*  404 */ return paramInputStream1
             .read_wstring()
             .equals(paramInputStream2.read_wstring());
         /*      */ case 23:
         /*  406 */ return paramInputStream1.read_longlong() == paramInputStream2.read_longlong();
         /*      */ case 24:
         /*  408 */ return paramInputStream1.read_ulonglong()
             == paramInputStream2.read_ulonglong();
         /*      */ case 14:
         /*  411 */ return paramInputStream1.read_Object().equals(paramInputStream2.read_Object());
         /*      */ case 13:
         /*  413 */ return paramInputStream1
             .read_Principal()
             .equals(paramInputStream2.read_Principal());
         /*      */ case 17:
         /*  416 */ return paramInputStream1.read_long() == paramInputStream2.read_long();
         /*      */ case 28:
         /*  418 */ return paramInputStream1.read_fixed().compareTo(paramInputStream2.read_fixed())
             == 0;
         /*      */ case 15:
         /*      */ case 22:
         /*  421 */ int i = localTypeCode.member_count();
         /*  422 */ for (int k = 0; k < i; k++) {
           /*  423 */ if (!equalMember(
               localTypeCode.member_type(k), paramInputStream1, paramInputStream2)) {
             /*  424 */ return false;
             /*      */ }
           /*      */ }
         /*  427 */ return true;
         /*      */ case 16:
         /*  430 */ Any localAny1 = this.orb.create_any();
         /*  431 */ Any localAny2 = this.orb.create_any();
         /*  432 */ localAny1.read_value(paramInputStream1, localTypeCode.discriminator_type());
         /*  433 */ localAny2.read_value(paramInputStream2, localTypeCode.discriminator_type());
         /*      */
         /*  435 */ if (!localAny1.equal(localAny2)) {
           /*  436 */ return false;
           /*      */ }
         /*  438 */ TypeCodeImpl localTypeCodeImpl =
             TypeCodeImpl.convertToNative(this.orb, localTypeCode);
         /*  439 */ int n = localTypeCodeImpl.currentUnionMemberIndex(localAny1);
         /*  440 */ if (n == -1) {
           /*  441 */ throw this.wrapper.unionDiscriminatorError();
           /*      */ }
         /*  443 */ if (!equalMember(
             localTypeCode.member_type(n), paramInputStream1, paramInputStream2)) {
           /*  444 */ return false;
           /*      */ }
         /*  446 */ return true;
         /*      */ case 19:
         /*  449 */ j = paramInputStream1.read_long();
         /*  450 */ paramInputStream2.read_long();
         /*  451 */ for (m = 0; m < j; m++) {
           /*  452 */ if (!equalMember(
               localTypeCode.content_type(), paramInputStream1, paramInputStream2)) {
             /*  453 */ return false;
             /*      */ }
           /*      */ }
         /*  456 */ return true;
         /*      */ case 20:
         /*  459 */ j = localTypeCode.member_count();
         /*  460 */ for (m = 0; m < j; m++) {
           /*  461 */ if (!equalMember(
               localTypeCode.content_type(), paramInputStream1, paramInputStream2)) {
             /*  462 */ return false;
             /*      */ }
           /*      */ }
         /*  465 */ return true;
         /*      */ case 29:
         /*      */ case 30:
         /*  473 */ org.omg.CORBA_2_3.portable.InputStream localInputStream1 =
             (org.omg.CORBA_2_3.portable.InputStream) paramInputStream1;
         /*      */
         /*  475 */ org.omg.CORBA_2_3.portable.InputStream localInputStream2 =
             (org.omg.CORBA_2_3.portable.InputStream) paramInputStream2;
         /*      */
         /*  477 */ return localInputStream1.read_value().equals(localInputStream2.read_value());
         /*      */ case 21:
         /*  481 */ throw this.wrapper.errorResolvingAlias();
         /*      */ case 25:
         /*  484 */ throw this.wrapper.tkLongDoubleNotSupported();
         /*      */ }
     /*      */
     /*  487 */ throw this.wrapper.typecodeNotSupported();
     /*      */ }
   /*      */ catch (BadKind localBadKind) {
     /*  490 */ throw this.wrapper.badkindCannotOccur();
   } catch (Bounds localBounds) {
     /*      */ }
   /*  492 */ throw this.wrapper.boundsCannotOccur();
   /*      */ }
 /*    */ public static void insert(Any paramAny, ServerManager paramServerManager) /*    */ {
   /* 17 */ OutputStream localOutputStream = paramAny.create_output_stream();
   /* 18 */ paramAny.type(type());
   /* 19 */ write(localOutputStream, paramServerManager);
   /* 20 */ paramAny.read_value(localOutputStream.create_input_stream(), type());
   /*    */ }
Exemplo n.º 11
0
 /*    */ public static void insert(Any paramAny, DuplicateName paramDuplicateName) /*    */ {
   /* 17 */ OutputStream localOutputStream = paramAny.create_output_stream();
   /* 18 */ paramAny.type(type());
   /* 19 */ write(localOutputStream, paramDuplicateName);
   /* 20 */ paramAny.read_value(localOutputStream.create_input_stream(), type());
   /*    */ }
 /*    */ public static void insert(Any paramAny, NotFoundReason paramNotFoundReason) /*    */ {
   /* 21 */ OutputStream localOutputStream = paramAny.create_output_stream();
   /* 22 */ paramAny.type(type());
   /* 23 */ write(localOutputStream, paramNotFoundReason);
   /* 24 */ paramAny.read_value(localOutputStream.create_input_stream(), type());
   /*    */ }