📄 orber_pi.erl
字号:
%% receive_exception(..); May raise system exc => receive_other(..);%% No EXC, Normal Reply -> %% receive_reply(..) May raise system exc => receive_exception(..);%% Non-normal reply (e.g. LOCATION_FORWARD) -> %% receive_other(..) May raise system exc => receive_exception(..);%% end.%%------------------------------------------------------------%% function : client_send%% Arguments: CRI - ClientRequestInfo%% PIs - a list of Interceptors (see 'Comments' in the module header)%% Returns : %% Exception: %% Effect : %%------------------------------------------------------------client_send(CRI, PIs) -> client_send(send_request, CRI, PIs, [], PIs).client_send(send_request, CRI, [], _, _) -> CRI;client_send(send_request, CRI, [H|T], Acc, PIs) -> case catch send_request(CRI, H) of {'EXCEPTION', #'PortableInterceptor_ForwardRequest'{forward=_Obj, permanent=_Bool}} -> client_receive(receive_other, CRI, T, [], PIs); {'EXCEPTION', _E} -> client_receive(receive_exception, CRI, Acc, [], PIs); _ -> client_send(send_request, CRI, T, Acc, PIs) end. %%------------------------------------------------------------%% function : client_receive%% Arguments: CRI - ClientRequestInfo%% PIs - a list of Interceptors (see 'Comments' in the module header)%% Returns : %% Exception: %% Effect : %%------------------------------------------------------------client_receive(CRI, PIs) -> case CRI#'ClientRequestInfo'.reply_status of 'PortableInterceptor_SUCCESSFUL' -> client_receive(receive_reply, CRI, PIs, [], PIs); 'PortableInterceptor_SYSTEM_EXCEPTION' -> client_receive(receive_exception, CRI, PIs, [], PIs); 'PortableInterceptor_USER_EXCEPTION' -> client_receive(receive_exception, CRI, PIs, [], PIs); _ -> client_receive(receive_other, CRI, PIs, [], PIs) end.client_receive(_, CRI, [], _, _) -> %% Done CRI;client_receive(receive_reply, CRI, [H|T], Acc, PIs) -> case catch receive_reply(CRI, H) of {'EXCEPTION', _E} -> client_receive(receive_exception, CRI, T, [H|Acc], PIs); _ -> client_receive(receive_reply, CRI, T, [H|Acc], PIs) end;client_receive(receive_exception, CRI, [H|T], Acc, PIs) -> case catch receive_exception(CRI, H) of {'EXCEPTION', #'PortableInterceptor_ForwardRequest'{forward=_Obj, permanent=_Bool}} -> client_receive(receive_other, CRI, T, [], PIs); {'EXCEPTION', _E} -> client_receive(receive_exception, CRI, T, [H|Acc], PIs); _ -> client_receive(receive_exception, CRI, T, [H|Acc], PIs) end;client_receive(receive_other, CRI, [H|T], Acc, PIs) -> case catch receive_other(CRI, H) of {'EXCEPTION', #'PortableInterceptor_ForwardRequest'{forward=_Obj, permanent=_Bool}} -> client_receive(receive_other, CRI, T, [], PIs); {'EXCEPTION', _E} -> client_receive(receive_exception, CRI, T, [H|Acc], PIs); _ -> client_receive(receive_other, CRI, T, [H|Acc], PIs) end.send_request(CRI, Mod) -> apply(Mod, send_request, [CRI]).receive_reply(CRI, Mod) -> apply(Mod, receive_reply, [CRI]).receive_other(CRI, Mod) -> apply(Mod, receive_other, [CRI]).receive_exception(CRI, Mod) -> apply(Mod, receive_exception, [CRI]).%%------------------------------------------------------------%% Functions for retrieving info from RequestInfo%% ServerRequestInfo and ClientRequestInfo. The ones matching%% both ServerRequestInfo and ClientRequestInfo eq. RequestInfo.%% Note, RequestInfo is inherrited by the others.%%------------------------------------------------------------%%-----------------------------------------------------------%%% function : _get_request_id%% Arguments: ClientRequestInfo or ServerRequestInfo%% Returns : ulong()%%------------------------------------------------------------'_get_request_id'(#'ClientRequestInfo'{request_id = ID}) -> ID;'_get_request_id'(#'ServerRequestInfo'{request_id = ID}) -> ID.%%-----------------------------------------------------------%%% function : _get_operation%% Arguments: ClientRequestInfo or ServerRequestInfo%% Returns : string()%%------------------------------------------------------------'_get_operation'(#'ClientRequestInfo'{operation = Op}) -> Op;'_get_operation'(#'ServerRequestInfo'{operation = Op}) -> Op.%%-----------------------------------------------------------%%% function : _get_arguments%% Arguments: ClientRequestInfo or ServerRequestInfo%% Returns : A list of #'Dynamic_Parameter'{}%%------------------------------------------------------------'_get_arguments'(#'ClientRequestInfo'{arguments = Args}) -> Args;'_get_arguments'(#'ServerRequestInfo'{arguments = Args}) -> Args.%%-----------------------------------------------------------%%% function : _get_exceptions%% Arguments: ClientRequestInfo or ServerRequestInfo%% Returns : A list of CORBA::TypeCode%%------------------------------------------------------------'_get_exceptions'(#'ClientRequestInfo'{exceptions = Exc}) -> Exc;'_get_exceptions'(#'ServerRequestInfo'{exceptions = Exc}) -> Exc.%%-----------------------------------------------------------%%% function : _get_contexts%% Arguments: ClientRequestInfo or ServerRequestInfo%% Returns : A list of CORBA::StringSeq%%------------------------------------------------------------'_get_contexts'(#'ClientRequestInfo'{contexts = Ctx}) -> Ctx;'_get_contexts'(#'ServerRequestInfo'{contexts = Ctx}) -> Ctx.%%-----------------------------------------------------------%%% function : _get_operation_context%% Arguments: ClientRequestInfo or ServerRequestInfo%% Returns : A list of CORBA::StringSeq%%------------------------------------------------------------'_get_operation_context'(#'ClientRequestInfo'{operation_context = OpCtx}) -> OpCtx;'_get_operation_context'(#'ServerRequestInfo'{operation_context = OpCtx}) -> OpCtx.%%-----------------------------------------------------------%%% function : _get_result%% Arguments: ClientRequestInfo or ServerRequestInfo%% Returns : #any{}%%------------------------------------------------------------'_get_result'(#'ClientRequestInfo'{result = Res}) -> Res;'_get_result'(#'ServerRequestInfo'{result = Res}) -> Res.%%-----------------------------------------------------------%%% function : _get_response_expected%% Arguments: ClientRequestInfo or ServerRequestInfo%% Returns : boolean()%%------------------------------------------------------------'_get_response_expected'(#'ClientRequestInfo'{response_expected = Bool}) -> Bool;'_get_response_expected'(#'ServerRequestInfo'{response_expected = Bool}) -> Bool.%%-----------------------------------------------------------%%% function : _get_sync_scope%% Arguments: ClientRequestInfo or ServerRequestInfo%% Returns : Messaging::SyncScoope ('SYNC_NONE', 'SYNC_WITH_TRANSPORT', %% 'SYNC_WITH_SERVER', 'SYNC_WITH_TARGET')%%------------------------------------------------------------'_get_sync_scope'(#'ClientRequestInfo'{sync_scope = SS}) -> SS;'_get_sync_scope'(#'ServerRequestInfo'{sync_scope = SS}) -> SS.%%-----------------------------------------------------------%%% function : _get_reply_status%% Arguments: ClientRequestInfo or ServerRequestInfo%% Returns : ReplyStatus (short), defined in orber_pi.hrl%%------------------------------------------------------------'_get_reply_status'(#'ClientRequestInfo'{reply_status = RS}) -> RS;'_get_reply_status'(#'ServerRequestInfo'{reply_status = RS}) -> RS.%%-----------------------------------------------------------%%% function : _get_forward_reference%% Arguments: ClientRequestInfo or ServerRequestInfo%% Returns : Object%%------------------------------------------------------------'_get_forward_reference'(#'ClientRequestInfo'{forward_reference = FR}) -> FR;'_get_forward_reference'(#'ServerRequestInfo'{forward_reference = FR}) -> FR.%%------------------------------------------------------------%% function : get_slot%% Arguments: ClientRequestInfo or ServerRequestInfo%% SlotId - ulong()%% Returns : {'EXCEPTION', #'PortableInterceptor_InvalidSlot'{}}%%------------------------------------------------------------get_slot(_XRI, _SlotId) -> corba:raise(#'PortableInterceptor_InvalidSlot'{}).%%------------------------------------------------------------%% function : get_request_service_context%% Arguments: ClientRequestInfo or ServerRequestInfo%% ServiceId - IOP::ServiceId (defined in orber_iiop.hrl)%% Returns : IOP::ServiceContext%%------------------------------------------------------------get_request_service_context(#'ClientRequestInfo'{contexts = Ctx}, _ServiceId) -> Ctx;get_request_service_context(#'ServerRequestInfo'{contexts = Ctx}, _ServiceId) -> Ctx.%%------------------------------------------------------------%% function : get_reply_service_context%% Arguments: ClientRequestInfo or ServerRequestInfo%% ServiceId - IOP::ServiceId (defined in orber_iiop.hrl)%% Returns : IOP::ServiceContext%%------------------------------------------------------------get_reply_service_context(#'ClientRequestInfo'{contexts = Ctx}, _ServiceId) -> Ctx;get_reply_service_context(#'ServerRequestInfo'{contexts = Ctx}, _ServiceId) -> Ctx. %%------------------------------------------------------------%%-------------- ClientRequestInfo only ----------------------%%-----------------------------------------------------------%%% function : _get_target%% Arguments: ClientRequestInfo%% Returns : Object%%------------------------------------------------------------'_get_target'(#'ClientRequestInfo'{target = Target}) -> Target.%%-----------------------------------------------------------%%% function : _get_effective_target%% Arguments: ClientRequestInfo%% Returns : Object%%------------------------------------------------------------'_get_effective_target'(#'ClientRequestInfo'{effective_target = ET}) -> ET.%%-----------------------------------------------------------%%% function : _get_effective_profile%% Arguments: ClientRequestInfo%% Returns : IOP:TaggedProfile%%------------------------------------------------------------'_get_effective_profile'(#'ClientRequestInfo'{effective_profile = EP}) -> EP.%%-----------------------------------------------------------%%% function : _get_received_exception%% Arguments: ClientRequestInfo%% Returns : #any{}%%------------------------------------------------------------'_get_received_exception'(#'ClientRequestInfo'{received_exception = RE}) -> RE.%%-----------------------------------------------------------%%% function : _get_received_exception%% Arguments: ClientRequestInfo%% Returns : CORBA::RepositoryId%%------------------------------------------------------------'_get_received_exception_id'(#'ClientRequestInfo'{received_exception_id = REId}) -> REId.%%------------------------------------------------------------%% function : get_effective_component%% Arguments: ClientRequestInfo%% Returns : IOR::TaggedComponent%%------------------------------------------------------------get_effective_component(#'ClientRequestInfo'{target = Target}, _Id) -> Target.%%------------------------------------------------------------%% function : get_effective_components%% Arguments: ClientRequestInfo%% Id -IOP::ComponentId (ulong())%% Returns : IOP_N::TaggedComponentSeq%%------------------------------------------------------------get_effective_components(#'ClientRequestInfo'{target = Target}, _Id) -> Target.%%------------------------------------------------------------%% function : get_request_policy%% Arguments: ClientRequestInfo%% Type - CORBA::PolicyType%% Returns : IOP_N::TaggedComponentSeq%%------------------------------------------------------------get_request_policy(#'ClientRequestInfo'{target = Target}, _Type) -> Target.%%------------------------------------------------------------%% function : add_request_service_context%% Arguments: ClientRequestInfo%% Ctx - IOP::ServiceContext%% Replace - boolean()%% Returns : -%%------------------------------------------------------------add_request_service_policy(#'ClientRequestInfo'{target = _Target}, _Ctx, _Replace) -> ok.%%------------------------------------------------------------%%-------------- ServerRequestInfo only ----------------------%%-----------------------------------------------------------%%% function : _get_sending_exception%% Arguments: ServerRequestInfo%% Returns : #any{}%%------------------------------------------------------------'_get_sending_exception'(#'ServerRequestInfo'{sending_exception = Exc}) -> Exc.%%-----------------------------------------------------------%%% function : _get_object_id%% Arguments: ServerRequestInfo%% Returns : CORBA::OctetSeq%%------------------------------------------------------------'_get_object_id'(#'ServerRequestInfo'{object_id = OI}) -> OI.%%-----------------------------------------------------------%%% function : _get_adapter_id%% Arguments: ServerRequestInfo%% Returns : CORBA::OctetSeq%%------------------------------------------------------------'_get_adapter_id'(#'ServerRequestInfo'{adapter_id = AI}) -> AI.%%-----------------------------------------------------------%%% function : _get_target_most_derived_interface%% Arguments: ServerRequestInfo%% Returns : CORBA::RepositoryId%%------------------------------------------------------------'_get_target_most_derived_interface'(#'ServerRequestInfo' {target_most_derived_interface = TMDI}) -> TMDI.%%------------------------------------------------------------%% function : get_server_policy%% Arguments: ServerRequestInfo%% PolicyType - CORBA::PolicyType%% Returns : CORBA::Policy%%------------------------------------------------------------get_server_policy(#'ServerRequestInfo'{contexts = Ctxs}, _PolicyType) -> Ctxs.%%------------------------------------------------------------%% function : set_slot%% Arguments: ServerRequestInfo%% SlotId - ulong()%% Data - #any{}%% Returns : {'EXCEPTION', #'PortableInterceptor_InvalidSlot'{}}%%------------------------------------------------------------set_slot(_SRI, _SlotId, _Data) -> corba:raise(#'PortableInterceptor_InvalidSlot'{}).%%-----------------------------------------------------------%%% function : target_is_a%% Arguments: ServerRequestInfo%% IFRId - CORBA::RepositoryId%% Returns : boolean()%%------------------------------------------------------------target_is_a(#'ServerRequestInfo'{object_id = ObjId}, IFRId) -> corba_object:is_a(ObjId, IFRId).%%------------------------------------------------------------%% function : add_reply_service_context%% Arguments: ServerRequestInfo%% Ctx - IOP::ServiceContext%% Replace - boolean()%% Returns : -%%------------------------------------------------------------add_reply_service_context(#'ServerRequestInfo'{contexts = Ctxs}, _Ctx, _Replace) -> Ctxs.%%--------------- END OF MODULE ------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -