예제 #1
0
파일: PrintIOR.java 프로젝트: 2pirad/jacorb
  /** top-level */
  public static void printIOR(ORB orb, ParsedIOR pior, PrintWriter out) {
    org.omg.IOP.IOR ior = pior.getIOR();

    out.println("------IOR components-----");
    out.println("TypeId\t:\t" + ior.type_id);

    List profiles = pior.getProfiles();

    out.println("TAG_INTERNET_IOP Profiles:");
    for (int i = 0; i < profiles.size(); i++) {
      out.println("\tProfile Id:\t\t" + i);

      ProfileBase profile = (ProfileBase) profiles.get(i);
      out.println(
          "\tIIOP Version:\t\t"
              + (int) profile.version().major
              + "."
              + (int) profile.version().minor);
      if (profile instanceof IIOPProfile) {
        out.println(
            "\tHost:\t\t\t"
                + ((IIOPAddress) ((IIOPProfile) profile).getAddress()).getOriginalHost());
        int port = ((IIOPAddress) ((IIOPProfile) profile).getAddress()).getPort();
        if (port < 0) {
          port += 65536;
        }

        out.println("\tPort:\t\t\t" + port);
      } else if (profile instanceof MIOPProfile) {
        out.println("MIOPProfile:\t" + ((MIOPProfile) profile).toString());
      }
      out.println("\tObject key (URL):\t" + CorbaLoc.parseKey(profile.get_object_key()));
      out.print("\tObject key (hex):\t0x");
      dumpHex(profile.get_object_key(), out);
      out.println();

      if (profile.version().minor >= (char) 1) {
        if (profile.getComponents().size() > 0) {
          out.println("\t-- Found " + profile.getComponents().size() + " Tagged Components--");
        }

        printTaggedComponents(orb, profile.getComponents().asArray(), out);
      }
      out.print("\n");
    }

    TaggedComponentList multiple_components = pior.getMultipleComponents();

    if (multiple_components.size() > 0) {
      out.println("Components in MULTIPLE_COMPONENTS profile: " + multiple_components.size());

      printTaggedComponents(orb, multiple_components.asArray(), out);
    }

    // Print any unknown tags. This block is a simplified version of the private
    // ParsedIOR::decode function.
    for (int i = 0; i < ior.profiles.length; i++) {
      int tag = ior.profiles[i].tag;
      boolean found = false;

      // See if JacORB managed to parse this tag before into the ParsedIOR
      for (int j = 0; j < profiles.size(); j++) {
        final IIOPProfile profile = (IIOPProfile) profiles.get(j);

        if (profile.tag() == tag) {
          found = true;
        }

        if (tag == TAG_MULTIPLE_COMPONENTS.value) {
          found = true;
        }
      }
      // This is an unknown tag that wasn't dealt with before.
      if (!found) {
        out.println("Unknown profile found with tag " + tag);
      }
    }
  }
예제 #2
0
 /** extracts the type id and the object key from an IOR string. */
 public static String toID(String iorString) {
   ParsedIOR pior = new ParsedIOR(iorString);
   org.omg.IOP.IOR ior = pior.getIOR();
   return ior.type_id; //	dumpHex( pior.get_object_key() );
 }