/**
   * entry method to the TypeCode reader logic
   *
   * @param logger used to log informational/debug information
   * @param in the InputStream from which should be read from
   * @param recursiveTCMap Map that should be used to store the buffer positions of not completely
   *     read in TypeCodes
   * @param repeatedTCMap Map that should be used to store the buffer positions of completely read
   *     in TypeCodes
   */
  public TypeCode readTypeCode(
      Logger logger, CDRInputStream in, Map recursiveTCMap, Map repeatedTCMap) {
    in.mark(0);

    final int kind = in.read_long();
    final int start_pos = in.get_pos() - 4;

    try {
      in.reset();
    } catch (IOException e) {
      assert false;
      throw new RuntimeException("should not happen");
    }

    if (logger.isDebugEnabled()) {
      logger.debug(
          in.getIndentString() + "read TypeCode kind " + kind + " at startposition " + start_pos);
    }

    final TypeCode result = doReadTypeCode(in, recursiveTCMap, repeatedTCMap, kind);

    if (logger.isDebugEnabled()) {
      logger.debug(
          in.getIndentString()
              + "return "
              + result
              + " ("
              + result.getClass().getName()
              + "@"
              + System.identityHashCode(result)
              + ")");
    }

    return result;
  }
Exemplo n.º 2
0
  private static void printOrbTypeComponent(TaggedComponent taggedComponent, PrintWriter out) {
    final CDRInputStream is = new CDRInputStream(taggedComponent.component_data);

    try {
      is.openEncapsulatedArray();
      int type = is.read_long();

      out.print("\t\tType: " + type);
      if (type == ORBConstants.JACORB_ORB_ID) {
        out.println(" (JacORB)");
      } else {
        out.println(" (Foreign)");
      }
    } finally {
      is.close();
    }
  }
Exemplo n.º 3
0
  protected TypeCode doReadTypeCodeInternal(
      CDRInputStream in,
      Map recursiveTCMap,
      Map repeatedTCMap,
      Integer startPosition,
      int kind,
      String repositoryID) {
    final String name = validateName(in.read_string());
    final int member_count = in.read_long();

    StructMember[] members = new StructMember[member_count];
    for (int i = 0; i < member_count; i++) {
      members[i] =
          new StructMember(in.read_string(), in.read_TypeCode(recursiveTCMap, repeatedTCMap), null);
    }
    return orb.create_exception_tc(repositoryID, name, members, false);
  }
Exemplo n.º 4
0
  private static void printPolicyComponent(TaggedComponent taggedComponent, PrintWriter out) {
    final CDRInputStream is = new CDRInputStream(taggedComponent.component_data);

    try {
      int val;
      int count = 0;

      is.openEncapsulatedArray();
      int len = is.read_long();

      while (len-- != 0) {
        val = is.read_long();
        out.print("\t\t#" + count++ + ": ");
        is.openEncapsulation();
        switch (val) {
          case PRIORITY_BANDED_CONNECTION_POLICY_TYPE.value:
            {
              long i;
              short low;
              short high;

              out.println("RTCORBA::PRIORITY_BANDED_CONNECTION");
              val = is.read_long();
              for (i = 0; i < val; i++) {
                low = is.read_short();
                high = is.read_short();
                out.println("\t\t\tBand " + i + ": " + low + "-" + high);
              }
              break;
            }
          case PRIORITY_MODEL_POLICY_TYPE.value:
            {
              out.print("RTCORBA::PRIORITY_MODEL");
              val = is.read_long();
              switch (val) {
                case PriorityModel._CLIENT_PROPAGATED:
                  {
                    out.print(" (CLIENT_PROPAGATED, ");
                    break;
                  }
                case PriorityModel._SERVER_DECLARED:
                  {
                    out.print(" (SERVER_DECLARED, ");
                    break;
                  }
                default:
                  {
                    out.print(" (Unknown, ");
                    break;
                  }
              }
              short prio = is.read_short();
              out.println(prio + ")");
              break;
            }
          default:
            {
              out.println("Unknown (" + val + ")");
              break;
            }
        }
        is.closeEncapsulation();
      }

    } finally {
      is.close();
    }
  }