⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gnurequest.java

📁 gcc的组建
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
    // The stream must be aligned sinve v1.2, but only once.    boolean align = response.header.version.since_inclusive(1, 2);    switch (m_rph.reply_status)      {        case ReplyHeader.NO_EXCEPTION:          NamedValue arg;          // Read return value, if set.          if (m_result != null)            {              if (align)                {                  input.align(8);                  align = false;                }              m_result.value().read_value(input, m_result.value().type());            }          // Read returned parameters, if set.          if (m_args != null)            for (int i = 0; i < m_args.count(); i++)              {                try                  {                    arg = m_args.item(i);                    // Both ARG_INOUT and ARG_OUT have this binary flag set.                    if ((arg.flags() & ARG_OUT.value) != 0)                      {                        if (align)                          {                            input.align(8);                            align = false;                          }                        arg.value().read_value(input, arg.value().type());                      }                  }                catch (Bounds ex)                  {                    Unexpected.error(ex);                  }              }          if (m_interceptor != null)            m_interceptor.receive_reply(m_info);          break;        case ReplyHeader.SYSTEM_EXCEPTION:          if (align)            {              input.align(8);              align = false;            }          readExceptionId(input);          m_sys_ex = ObjectCreator.readSystemException(input,            m_rph.service_context);          m_environment.exception(m_sys_ex);          if (m_interceptor != null)            m_interceptor.receive_exception(m_info);          throw m_sys_ex;        case ReplyHeader.USER_EXCEPTION:          if (align)            {              input.align(8);              align = false;            }          readExceptionId(input);          // Prepare an Any that will hold the exception.          gnuAny exc = new gnuAny();          exc.setOrb(orb);          exc.insert_Streamable(new StreamHolder(input));          UnknownUserException unuex = new UnknownUserException(exc);          m_environment.exception(unuex);          if (m_interceptor != null)            m_interceptor.receive_exception(m_info);          break;        case ReplyHeader.LOCATION_FORWARD_PERM:        case ReplyHeader.LOCATION_FORWARD:          if (response.header.version.since_inclusive(1, 2))            input.align(8);          IOR forwarded = new IOR();          try            {              forwarded._read_no_endian(input);            }          catch (IOException ex)            {              new MARSHAL("Cant read forwarding info", 5103,                CompletionStatus.COMPLETED_NO);            }          setIor(forwarded);          m_forward_ior = forwarded;          if (m_interceptor != null)            m_interceptor.receive_other(m_info);          // Repeat with the forwarded information.          p_invoke();          return;        default:          throw new MARSHAL("Unknow reply status", 8100 + m_rph.reply_status,            CompletionStatus.COMPLETED_NO);      }  }  /**   * Read exception id without changing the stream pointer position.   */  void readExceptionId(BufferredCdrInput input)  {    input.mark(2048);    m_exception_id = input.read_string();    input.reset();  }  /**   * Write the operation parameters.   *   * @param header the message header   * @param request_part the stream to write parameters into   *   * @throws MARSHAL if the attempt to write the parameters has failde.   */  protected void write_parameter_buffer(MessageHeader header,    BufferedCdrOutput request_part  ) throws MARSHAL  {    try      {        if (header.version.since_inclusive(1, 2))          {            request_part.align(8);          }        m_parameter_buffer.buffer.writeTo(request_part);      }    catch (IOException ex)      {        MARSHAL m = new MARSHAL("Unable to write method arguments to CDR output.");        m.minor = Minor.CDR;        throw m;      }  }  /**   * Write the operation parameters.   *   * @param header the message header   * @param request_part the stream to write parameters into   *   * @throws MARSHAL if the attempt to write the parameters has failde.   */  protected void write_parameters(MessageHeader header,    BufferedCdrOutput request_part  ) throws MARSHAL  {    // Align after 1.2, but only once.    boolean align = header.version.since_inclusive(1, 2);    NamedValue para;    try      {        // Write parameters now.        for (int i = 0; i < m_args.count(); i++)          {            para = m_args.item(i);            // This bit is set both for ARG_IN and ARG_INOUT            if ((para.flags() & ARG_IN.value) != 0)              {                if (align)                  {                    request_part.align(8);                    align = false;                  }                para.value().write_value(request_part);              }          }      }    catch (Bounds ex)      {        InternalError ierr = new InternalError();        ierr.initCause(ex);        throw ierr;      }  }  /* **************Implementation of the request info operations. ***** */  /**   * Add context to request.   */  public void add_request_service_context(ServiceContext service_context,    boolean replace  )  {    m_rqh.addContext(service_context, replace);  }  /**   * Get the Internet profile as an effective profile.   */  public TaggedProfile effective_profile()  {    BufferedCdrOutput buf = new BufferedCdrOutput(512);    buf.setOrb(orb);    ior.Internet.write(buf);    TaggedProfile p = new TaggedProfile();    p.tag = TAG_INTERNET_IOP.value;    p.profile_data = buf.buffer.toByteArray();    return p;  }  /**   * Return either target or forwarded targed.   */  public org.omg.CORBA.Object effective_target()  {    return new IorObject(orb, ior);  }  /**   * Get effective component with the give id from the Internet profile.   */  public TaggedComponent get_effective_component(int id)    throws BAD_PARAM  {    if (id == TAG_CODE_SETS.value)      {        // Codesets are encoded separately.        BufferedCdrOutput buf = new BufferedCdrOutput(512);        buf.setOrb(orb);        ior.Internet.CodeSets.write(buf);        TaggedComponent t = new TaggedComponent();        t.tag = TAG_CODE_SETS.value;        t.component_data = buf.buffer.toByteArray();        return t;      }    else      {        for (int i = 0; i < ior.Internet.components.size(); i++)          {            TaggedComponent c =              (TaggedComponent) ior.Internet.components.get(i);            if (c.tag == id)              return c;          }      }    throw new BAD_PARAM("No component " + id + " in the Internet profile", 28,      CompletionStatus.COMPLETED_MAYBE    );  }  /**   * Get all components with the given id from the internet profile.   */  public TaggedComponent[] get_effective_components(int id)    throws BAD_PARAM  {    if (id == TAG_CODE_SETS.value)      return new TaggedComponent[] { get_effective_component(TAG_CODE_SETS.value) };    else      {        ArrayList components = new ArrayList(ior.Internet.components.size());        for (int i = 0; i < ior.Internet.components.size(); i++)          {            TaggedComponent c =              (TaggedComponent) ior.Internet.components.get(i);            if (c.tag == id)              components.add(c);          }        if (components.size() == 0)          throw new BAD_PARAM("No component " + id +            " in the Internet profile", 28, CompletionStatus.COMPLETED_MAYBE          );        else          {            TaggedComponent[] t = new TaggedComponent[ components.size() ];            for (int i = 0; i < t.length; i++)              t [ i ] = (TaggedComponent) components.get(i);            return t;          }      }  }  /**   * This should be not implemented up till jdk 1.5 inclusive.   */  public Policy get_request_policy(int type) throws INV_POLICY  {    throw new NO_IMPLEMENT();  }  /** @inheritDoc */  public String received_exception_id()  {    return m_exception_id;  }  /** @inheritDoc */  public Any received_exception()  {    if (m_exception_id == null)      return null;    if (m_sys_ex != null)      {        Any a = orb.create_any();        ObjectCreator.insertSysException(a, m_sys_ex);        return a;      }    Exception mex = m_environment.exception();    UnknownUserException ex = (UnknownUserException) mex;    if (ex == null)      return null;    else      return ex.except;  }  /**   * Return the forwarded reference, null if none.   */  public org.omg.CORBA.Object forward_reference()  {    if (m_forwarding_target != null)      return m_forwarding_target;    if (m_forward_ior != null)      return new IorObject(orb, m_forward_ior);    else      return null;  }  /**   * Get the slot from the slot array inside this request.   */  public Any get_slot(int id) throws InvalidSlot  {    try      {        return m_slots [ id ];      }    catch (Exception e)      {        throw new InvalidSlot("slot id " + id + ":" + e);      }  }  /**   * Get the reply status.   */  public short reply_status()  {    if (m_rph == null)      throw new BAD_INV_ORDER("Request not yet sent", 14,        CompletionStatus.COMPLETED_NO      );    return (short) m_rph.reply_status;  }  /**   * Get the request id.   */  public int request_id()  {    return m_rqh.request_id;  }  /**   * Return true if the response is expected.   */  public boolean response_expected()  {    return !oneWay;  }  /**   * Determines how far the request shall progress before control is returned to   * the client. However up till JDK 1.5 inclusive this method always returns   * SYNC_WITH_TRANSPORT.   *   * @return {@link org.omg.Messaging.SYNC_WITH_TRANSPORT.value (1), always.   *   * @specnote as defined in the Suns 1.5 JDK API.   */  public short sync_scope()  {    return org.omg.Messaging.SYNC_WITH_TRANSPORT.value;  }  /** @inheritDoc */  public ServiceContext get_request_service_context(int ctx_name)    throws BAD_PARAM  {    return gnu.CORBA.GIOP.ServiceContext.findContext(ctx_name,      m_rqh.service_context    );  }  /** @inheritDoc */  public ServiceContext get_reply_service_context(int ctx_name)    throws BAD_PARAM  {    if (m_rph == null)      throw new BAD_INV_ORDER("Reply context not yet available");    return gnu.CORBA.GIOP.ServiceContext.findContext(ctx_name,      m_rph.service_context    );  }  /** @inheritDoc */  public String[] operation_context()  {    return ice_contexts();  }  /**   * Get contexts as required by interceptor.   */  public String[] ice_contexts()  {    if (m_context_list == null)      return new String[ 0 ];    else      {        try          {            String[] cn = new String[ m_context_list.count() ];            for (int i = 0; i < cn.length; i++)              cn [ i ] = m_context_list.item(i);            return cn;          }        catch (Bounds e)          {            throw new Unexpected(e);          }      }  }  /**   * Check if the call is done via DII.   */  public void checkDii()  {    if (m_parameter_buffer != null)      throw new NO_RESOURCES("The invocation method provides " +        "no access to this resource. DII call required.", 1,        CompletionStatus.COMPLETED_MAYBE      );  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -