Ejemplo n.º 1
0
  public Profile demarshal_profile(
      TaggedProfileHolder tagged_profile, TaggedComponentSeqHolder components) {
    if (tagged_profile.value.tag != this.tag) {
      throw new org.omg.CORBA.BAD_PARAM(
          "wrong profile for WIOP transport, tag: " + tagged_profile.value.tag);
    } else {
      IIOPProfile result = new IIOPProfile(tagged_profile.value.profile_data);

      try {
        result.configure(configuration);
      } catch (ConfigurationException e) {
        throw new org.omg.CORBA.INTERNAL("ConfigurationException: " + e.toString());
      }

      try {
        result.configure(configuration);
      } catch (ConfigurationException e) {
        throw new org.omg.CORBA.INTERNAL("ConfigurationException: " + e.toString());
      }

      components.value = result.getComponents().asArray();

      return new WIOPProfile(result, this.tag);
    }
  }
Ejemplo n.º 2
0
  public Profile demarshal_profile(
      TaggedProfileHolder tagged_profile, TaggedComponentSeqHolder components) {
    if (tagged_profile.value.tag != TAG_DIOP_UDP) {
      throw new org.omg.CORBA.BAD_PARAM(
          "wrong profile for DIOP transport, tag: " + tagged_profile.value.tag);
    }

    IIOPProfile result = new IIOPProfile(tagged_profile.value.profile_data);
    components.value = result.getComponents().asArray();
    return result;
  }
  /** Select IOP profile that matches protocol */
  public Profile selectProfile(List profiles, ClientConnectionManager ccm) {
    final Iterator iter = profiles.iterator();

    while (iter.hasNext()) {
      final Profile profile = (Profile) iter.next();
      final int profileTag = profile.tag();

      for (int i = 0; i < protocols.length; i++) {
        final int tagToMatch = protocols[i].protocol_type;

        if (profileTag == tagToMatch) {
          return profile;
        }

        if (profileTag == TAG_INTERNET_IOP.value && profile instanceof IIOPProfile) {
          // Special case check for IIOP profile supporting SSL
          IIOPProfile iiopProfile = (IIOPProfile) profile;
          if ((tagToMatch == ORBConstants.JAC_SSL_PROFILE_ID) && (iiopProfile.getSSL() != null)) {
            return profile;
          }

          // Special case check for IIOP profile not supporting SSL
          if ((tagToMatch == ORBConstants.JAC_NOSSL_PROFILE_ID)
              && ((iiopProfile.getSSL() == null)
                  ||
                  // SSL port contains a valid value but further check is required
                  // see if protection is enabled.
                  (((iiopProfile.getSSL()).target_requires & org.omg.Security.NoProtection.value)
                      != 0))) {
            return profile;
          }
        }
      }
    }

    return null;
  }
Ejemplo n.º 4
0
  /** 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);
      }
    }
  }