From 84adefa331c4159d432d22840663c38f155cd4c1 Mon Sep 17 00:00:00 2001 From: Erlang/OTP Date: Fri, 20 Nov 2009 14:54:40 +0000 Subject: The R13B03 release. --- .../CosEventChannelAdmin_SupplierAdmin_impl.erl | 159 +++++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 lib/cosEvent/src/CosEventChannelAdmin_SupplierAdmin_impl.erl (limited to 'lib/cosEvent/src/CosEventChannelAdmin_SupplierAdmin_impl.erl') diff --git a/lib/cosEvent/src/CosEventChannelAdmin_SupplierAdmin_impl.erl b/lib/cosEvent/src/CosEventChannelAdmin_SupplierAdmin_impl.erl new file mode 100644 index 0000000000..c7cf0bd869 --- /dev/null +++ b/lib/cosEvent/src/CosEventChannelAdmin_SupplierAdmin_impl.erl @@ -0,0 +1,159 @@ +%%-------------------------------------------------------------------- +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +%% +%%---------------------------------------------------------------------- +%% File : CosEventChannelAdmin_SupplierAdmin_impl.erl +%% Created : 21 Mar 2001 +%% Description : +%% +%%---------------------------------------------------------------------- +-module('CosEventChannelAdmin_SupplierAdmin_impl'). + + +%%---------------------------------------------------------------------- +%% Include files +%%---------------------------------------------------------------------- +-include("cosEventApp.hrl"). + + +%%---------------------------------------------------------------------- +%% External exports +%%---------------------------------------------------------------------- +%% Mandatory +-export([init/1, + terminate/2, + code_change/3, + handle_info/2]). + +%% Exports from "CosEventChannelAdmin::SupplierAdmin" +-export([obtain_push_consumer/2, + obtain_pull_consumer/2]). + +%%---------------------------------------------------------------------- +%% Internal exports +%%---------------------------------------------------------------------- + +%%---------------------------------------------------------------------- +%% Records +%%---------------------------------------------------------------------- +-record(state, {channel, channel_pid, typecheck, pull_interval, server_options}). + +%%---------------------------------------------------------------------- +%% Macros +%%---------------------------------------------------------------------- + +%%====================================================================== +%% External functions +%%====================================================================== +%%---------------------------------------------------------------------- +%% Function : init/1 +%% Returns : {ok, State} | +%% {ok, State, Timeout} | +%% ignore | +%% {stop, Reason} +%% Description: Initiates the server +%%---------------------------------------------------------------------- +init([Channel, ChannelPid, TypeCheck, PullInterval, ServerOpts]) -> + process_flag(trap_exit, true), + {ok, #state{channel = Channel, channel_pid = ChannelPid, typecheck = TypeCheck, + pull_interval = PullInterval, server_options = ServerOpts}}. + +%%---------------------------------------------------------------------- +%% Function : terminate/2 +%% Returns : any (ignored by gen_server) +%% Description: Shutdown the server +%%---------------------------------------------------------------------- +terminate(_Reason, _State) -> + ?DBG("Terminating ~p~n", [_Reason]), + ok. + +%%---------------------------------------------------------------------- +%% Function : code_change/3 +%% Returns : {ok, NewState} +%% Description: Convert process state when code is changed +%%---------------------------------------------------------------------- +code_change(_OldVsn, State, _Extra) -> + {ok, State}. + +%%---------------------------------------------------------------------% +%% function : handle_info +%% Arguments: +%% Returns : {noreply, State} | +%% {stop, Reason, State} +%% Effect : Functions demanded by the gen_server module. +%%---------------------------------------------------------------------- +handle_info({'EXIT', Pid, Reason}, #state{channel_pid = Pid} = State) -> + ?DBG("Parent Channel terminated ~p~n", [Reason]), + orber:dbg("[~p] CosEventChannelAdmin_SupplierAdmin:handle_info(~p);~n" + "My Channel terminated and so will I.", + [?LINE, Reason], ?DEBUG_LEVEL), + {stop, Reason, State}; +handle_info(_Info, State) -> + ?DBG("Unknown Info ~p~n", [_Info]), + {noreply, State}. + + +%%---------------------------------------------------------------------- +%% Function : obtain_push_consumer +%% Arguments : +%% Returns : +%% Description: +%%---------------------------------------------------------------------- +obtain_push_consumer(OE_This, #state{channel = Channel, + channel_pid = _ChannelPid, + typecheck = TypeCheck, + server_options = ServerOpts} = State) -> + ?DBG("Starting a new CosEventChannelAdmin_ProxyPushConsumer.~n", []), + {reply, + 'CosEventChannelAdmin_ProxyPushConsumer':oe_create_link([OE_This, + self(), + Channel, + TypeCheck], + ServerOpts), + State}. + +%%---------------------------------------------------------------------- +%% Function : obtain_pull_consumer +%% Arguments : +%% Returns : +%% Description: +%%---------------------------------------------------------------------- +obtain_pull_consumer(OE_This, #state{channel = Channel, + channel_pid = _ChannelPid, + typecheck = TypeCheck, + pull_interval= PullInterval, + server_options = ServerOpts} = State) -> + ?DBG("Starting a new CosEventChannelAdmin_ProxyPullConsumer.~n", []), + {reply, + 'CosEventChannelAdmin_ProxyPullConsumer':oe_create_link([OE_This, + self(), + Channel, + TypeCheck, + PullInterval], + ServerOpts), + State}. + +%%====================================================================== +%% Internal functions +%%====================================================================== + +%%====================================================================== +%% END OF MODULE +%%====================================================================== -- cgit v1.2.3