Ejemplo n.º 1
0
 /*    */ public static DuplicateName read(InputStream paramInputStream) /*    */ {
   /* 65 */ DuplicateName localDuplicateName = new DuplicateName();
   /*    */
   /* 67 */ paramInputStream.read_string();
   /* 68 */ localDuplicateName.name = paramInputStream.read_string();
   /* 69 */ return localDuplicateName;
   /*    */ }
Ejemplo n.º 2
0
  // Initializes components and anys representation
  // from the Any representation
  protected boolean initializeComponentsFromAny() {
    // This typeCode is of kind tk_sequence.
    TypeCode typeCode = any.type();
    int length;
    TypeCode contentType = getContentType();
    InputStream input;

    try {
      input = any.create_input_stream();
    } catch (BAD_OPERATION e) {
      return false;
    }

    length = input.read_long();
    components = new DynAny[length];
    anys = new Any[length];

    for (int i = 0; i < length; i++) {
      // _REVISIT_ Could use read_xxx_array() methods on InputStream for efficiency
      // but only for primitive types
      anys[i] = DynAnyUtil.extractAnyFromStream(contentType, input, orb);
      try {
        // Creates the appropriate subtype without copying the Any
        components[i] = DynAnyUtil.createMostDerivedDynAny(anys[i], orb, false);
      } catch (InconsistentTypeCode itc) { // impossible
      }
    }
    return true;
  }
Ejemplo n.º 3
0
 /** Unmarshal the value into an InputStream */
 public void _read(InputStream is) {
   tag = is.read_string();
   required = is.read_boolean();
   implied = is.read_boolean();
   type = org.omg.CollaborationFramework.TypeCodeHelper.read(is);
   criteria = org.omg.CommunityFramework.CriteriaHelper.read(is);
 }
Ejemplo n.º 4
0
 public static SystemException extractSystemException(Any any) {
   InputStream in = any.create_input_stream();
   ORB orb = (ORB) (in.orb());
   if (!isSystemExceptionTypeCode(any.type(), orb)) {
     throw wrapper.unknownDsiSysex(CompletionStatus.COMPLETED_MAYBE);
   }
   return ORBUtility.readSystemException(in);
 }
Ejemplo n.º 5
0
  /**
   * Read the exception from the CDR intput stream.
   *
   * @param input a org.omg.CORBA.portable stream to read from.
   */
  public static UnknownUserException read(InputStream input) {
    // Read the exception repository id.
    input.read_string();
    UnknownUserException value = new UnknownUserException();

    value.except = input.read_any();
    return value;
  }
Ejemplo n.º 6
0
 /**
  * Static method for reading a CORBA standard exception from a stream.
  *
  * @param strm The InputStream to use for unmarshaling.
  */
 public static SystemException readSystemException(InputStream strm) {
   try {
     String name = classNameOf(strm.read_string());
     SystemException ex = (SystemException) ORBClassLoader.loadClass(name).newInstance();
     ex.minor = strm.read_long();
     ex.completed = CompletionStatus.from_int(strm.read_long());
     return ex;
   } catch (Exception ex) {
     throw wrapper.unknownSysex(CompletionStatus.COMPLETED_MAYBE, ex);
   }
 }
 /**
  * Read the structure from the CDR intput stream. Expects the integer identifier of the tag, then
  * the size of the tag data and then the specified number of bytes, representing the data of the
  * tag.
  *
  * @param input a org.omg.CORBA.portable stream to read from.
  */
 public static TaggedComponent read(InputStream input) {
   TaggedComponent value = new TaggedComponent();
   value.tag = input.read_long();
   value.component_data = new byte[input.read_long()];
   try {
     input.read(value.component_data);
   } catch (IOException e) {
     MARSHAL m = new MARSHAL();
     m.minor = Minor.Encapsulation;
     m.initCause(e);
     throw m;
   }
   return value;
 }
  /** Read the exception from the given CDR stream. */
  public static InvalidName read(InputStream istream) {
    InvalidName value = new InvalidName();

    // Read and discard the repository ID.
    istream.read_string();
    return value;
  }
Ejemplo n.º 9
0
  /**
   * Read the exception from the CDR intput stream.
   *
   * @param input a org.omg.CORBA.portable stream to read from.
   */
  public static InvalidSlot read(InputStream input) {
    // Read the exception repository id.
    String id = input.read_string();
    InvalidSlot value = new InvalidSlot(id);

    return value;
  }
  /**
   * Read the exception from the CDR intput stream.
   *
   * @param input a org.omg.CORBA.portable stream to read from.
   */
  public static ObjectNotActive read(InputStream input) {
    // Read the exception repository id.
    String id = input.read_string();
    ObjectNotActive value = new ObjectNotActive(id);

    return value;
  }
 /*     */ public static ValueMember[] read(InputStream paramInputStream) /*     */ {
   /*  85 */ ValueMember[] arrayOfValueMember = null;
   /*  86 */ int i = paramInputStream.read_long();
   /*     */
   /*  89 */ arrayOfValueMember = new ValueMember[i];
   /*  90 */ for (int j = 0; j < arrayOfValueMember.length; j++)
     /*  91 */ arrayOfValueMember[j] = ValueMemberHelper.read(paramInputStream);
   /*  92 */ return arrayOfValueMember;
   /*     */ }
Ejemplo n.º 12
0
 public EJBHome getEJBHome() throws RemoteException {
   while (true) {
     if (!Util.isLocal(this)) {
       InputStream in = null;
       try {
         try {
           OutputStream out = _request("_get_EJBHome", true);
           in = _invoke(out);
           return (EJBHome) in.read_Object(EJBHome.class);
         } catch (ApplicationException ex) {
           in = ex.getInputStream();
           String id = in.read_string();
           throw new UnexpectedException(id);
         } catch (RemarshalException ex) {
           continue;
         }
       } catch (SystemException ex) {
         throw Util.mapSystemException(ex);
       } finally {
         _releaseReply(in);
       }
     } else {
       ServantObject so = _servant_preinvoke("_get_EJBHome", javax.ejb.HomeHandle.class);
       if (so == null) {
         continue;
       }
       try {
         EJBHome result = ((javax.ejb.HomeHandle) so.servant).getEJBHome();
         return (EJBHome) Util.copyObject(result, _orb());
       } catch (Throwable ex) {
         Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
         throw Util.wrapException(exCopy);
       } finally {
         _servant_postinvoke(so);
       }
     }
   }
 }
Ejemplo n.º 13
0
  /**
   * Dumps the description of a the marshaled value of a given TypeCode.
   *
   * @param type the <code>TypeCode</code>
   * @param input the input stream where the value is marshaled
   * @param output the output stream where the value will be dumped
   * @pre the typecode must be a wstring type
   * @return <code>true</code> if if has been possible dump the value.
   */
  public static boolean dumpValue(TypeCode type, InputStream input, java.io.PrintWriter output)
      throws java.io.IOException {
    output.print("[VALUE]{wstring");

    try {
      if (type.length() != 0) {
        output.print('<');
        output.print(type.length());
        output.print('>');
      }
    } catch (BadKind bk) {
      throw new BAD_TYPECODE("Fault in length() operation:" + bk.toString());
    }
    output.print(": \"");
    output.print(input.read_wstring());
    output.print("\"}");
    return true;
  }
 /**
  * Fill in the {@link value } field by reading the required data from the given stream. This
  * method first reads the array size (as CORBA <code>long</code>) and then calls the {@link
  * org.omg.CORBA.portable.InputStream#read_ushort_array }.
  *
  * @param input the input stream to read from.
  */
 public void _read(InputStream input) {
   value = new short[input.read_long()];
   input.read_ushort_array(value, 0, value.length);
   typecode.setLength(value.length);
 }
 /*    */ public static SetOverrideType read(InputStream paramInputStream) /*    */ {
   /* 71 */ return SetOverrideType.from_int(paramInputStream.read_long());
   /*    */ }
 /*    */ public static ServerManager read(InputStream paramInputStream) /*    */ {
   /* 45 */ return narrow(paramInputStream.read_Object(_ServerManagerStub.class));
   /*    */ }
Ejemplo n.º 17
0
 /**
  * Reads a java.lang.Object as a CORBA any.
  *
  * @param in the stream from which to read the any.
  * @return the object read from the stream.
  */
 public Object readAny(InputStream in) {
   Any any = in.read_any();
   if (any.type().kind().value() == TCKind._tk_objref) return any.extract_Object();
   else return any.extract_Value();
 }
Ejemplo n.º 18
0
 /**
  * Reads the unmarshalled data from <code>input</code> and assigns it to the <code>value</code>
  * field of this <code>StringHolder</code> object.
  *
  * @param input the InputStream containing CDR formatted data from the wire.
  */
 public void _read(InputStream input) {
   value = input.read_string();
 }
 /**
  * Calls {@link InputStream#read_string()}.
  *
  * @param instream the stream to read from.
  */
 public static String read(InputStream istream) {
   return istream.read_string();
 }
Ejemplo n.º 20
0
 /**
  * Copies and remarshals the given typecode value marshaled in an InputStream to a <code>
  * es.tid.TIDorbj.core.CDRInputStream</code>. This method will alwais be invoked by this stream.
  *
  * @param type the value <code>TypeCode</code>
  * @param input the <code>InputStream</code> where the value is marshaled
  * @param output the <code>es.tid.TIDorbj.core.CDRInputStream</code>
  * @pre the <code>TypeCode</code> must be an wstring type
  */
 public static void remarshalValue(TypeCode type, InputStream input, OutputStream output) {
   output.write_wstring(input.read_wstring());
 }
 /** Read the extended naming context from the given CDR input stream. */
 public static NamingContextExt read(InputStream istream) {
   return narrow(istream.read_Object(_NamingContextExtStub.class));
 }
Ejemplo n.º 22
0
 /**
  * Read the visibility value (as short) from the CDR intput stream.
  *
  * <p>Uses {@link InputStream#read_short()}.
  *
  * @param istream a stream to read from.
  */
 public static short read(InputStream istream) {
   return istream.read_short();
 }
Ejemplo n.º 23
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();
    }
  }
Ejemplo n.º 24
0
 /**
  * Compares two InputStream marshaled values of a given TypeCode to a <code>
  * es.tid.TIDorbj.core.CDRInputStream</code>. This method will alwais be invoked by this stream.
  *
  * @param type the value <code>TypeCode</code>
  * @param input_a the <code>InputStream</code> where one value is marshaled
  * @param input_b the <code>InputStream</code> where the value value is marshaled
  * @pre <code>type</code> must be a wstring type.
  */
 public static boolean valuesEqual(
     org.omg.CORBA.TypeCode type, InputStream input_a, InputStream input_b) {
   return (input_a.read_wstring()).equals(input_a.read_wstring());
 }
Ejemplo n.º 25
0
 /**
  * Reads from <code>input</code> and initalizes the value in the Holder with the unmarshalled
  * data.
  *
  * @param input the InputStream containing CDR formatted data from the wire
  */
 public void _read(InputStream input) {
   value = input.read_longlong();
 }
 /*    */ public static NotFoundReason read(InputStream paramInputStream) /*    */ {
   /* 49 */ return NotFoundReason.from_int(paramInputStream.read_long());
   /*    */ }