/** The object which the client called to perform the operation. */
 public org.omg.CORBA.Object target() {
   // access is currently valid for all states:
   // checkAccess( MID_TARGET );
   if (cachedTargetObject == null) {
     CorbaContactInfo corbaContactInfo = (CorbaContactInfo) messageMediator.getContactInfo();
     cachedTargetObject = iorToObject(corbaContactInfo.getTargetIOR());
   }
   return cachedTargetObject;
 }
  /**
   * The profile that will be used to send the request. If a location forward has occurred for this
   * operation's object and that object's profile change accordingly, then this profile will be that
   * located profile.
   */
  public TaggedProfile effective_profile() {
    // access is currently valid for all states:
    // checkAccess( MID_EFFECTIVE_PROFILE );

    if (cachedEffectiveProfile == null) {
      CorbaContactInfo corbaContactInfo = (CorbaContactInfo) messageMediator.getContactInfo();
      cachedEffectiveProfile = corbaContactInfo.getEffectiveProfile().getIOPProfile();
    }

    // Good citizen: In the interest of efficiency, we assume interceptors
    // will not modify the returned TaggedProfile in any way so we need
    // not make a deep copy of it.

    return cachedEffectiveProfile;
  }
  /**
   * The actual object on which the operation will be invoked. If the reply_status is
   * LOCATION_FORWARD, then on subsequent requests, effective_target will contain the forwarded IOR
   * while target will remain unchanged.
   */
  public org.omg.CORBA.Object effective_target() {
    // access is currently valid for all states:
    // checkAccess( MID_EFFECTIVE_TARGET );

    // Note: This is not necessarily the same as locatedIOR.
    // Reason: See the way we handle COMM_FAILURES in
    // ClientRequestDispatcher.createRequest, v1.32

    if (cachedEffectiveTargetObject == null) {
      CorbaContactInfo corbaContactInfo = (CorbaContactInfo) messageMediator.getContactInfo();
      // REVISIT - get through chain like getLocatedIOR helper below.
      cachedEffectiveTargetObject = iorToObject(corbaContactInfo.getEffectiveTargetIOR());
    }
    return cachedEffectiveTargetObject;
  }
  /**
   * Returns all the tagged components with the given ID from the profile selected for this request.
   */
  public TaggedComponent[] get_effective_components(int id) {
    checkAccess(MID_GET_EFFECTIVE_COMPONENTS);
    Integer integerId = new Integer(id);
    TaggedComponent[] result = null;
    boolean justCreatedCache = false;

    if (cachedEffectiveComponents == null) {
      cachedEffectiveComponents = new HashMap();
      justCreatedCache = true;
    } else {
      // Look in cache:
      result = (TaggedComponent[]) cachedEffectiveComponents.get(integerId);
    }

    // null could mean we cached null or not in cache.
    if ((result == null)
        && (justCreatedCache || !cachedEffectiveComponents.containsKey(integerId))) {
      // Not in cache.  Get it from the profile:
      CorbaContactInfo corbaContactInfo = (CorbaContactInfo) messageMediator.getContactInfo();
      IIOPProfileTemplate ptemp =
          (IIOPProfileTemplate) corbaContactInfo.getEffectiveProfile().getTaggedProfileTemplate();
      result = ptemp.getIOPComponents(myORB, id);
      cachedEffectiveComponents.put(integerId, result);
    }

    // As per ptc/00-08-06, section 21.3.13.6., If not found, raise
    // BAD_PARAM with minor code INVALID_COMPONENT_ID.
    if ((result == null) || (result.length == 0)) {
      throw stdWrapper.invalidComponentId(integerId);
    }

    // Good citizen: In the interest of efficiency, we will assume
    // interceptors will not modify the returned TaggedCompoent[], or
    // the TaggedComponents inside of it.  Otherwise, we would need to
    // clone the array and make a deep copy of its contents.

    return result;
  }