123
123
%% {stop, Reason}
124
124
%% Description: Initiates the server
125
125
%%----------------------------------------------------------------------
126
init([ParentPid, MyId, QoS, Admin]) ->
126
init([ParentPid, MyId, QoS, _Admin]) ->
127
127
process_flag(trap_exit, true),
128
128
Diamonds = case lists:keysearch(?DiamondDetection, 1, QoS) of
147
147
%% Returns : any (ignored by gen_server)
148
148
%% Description: Shutdown the server
149
149
%%----------------------------------------------------------------------
150
terminate(Reason, #state{graph = DG} = State) ->
150
terminate(_Reason, #state{graph = DG} = _State) ->
151
151
Connections = digraph:edges(DG),
152
152
close_connections(DG, Connections),
153
153
digraph:delete(DG),
158
158
%% Returns : {ok, NewState}
159
159
%% Description: Convert process state when code is changed
160
160
%%----------------------------------------------------------------------
161
code_change(OldVsn, State, Extra) ->
161
code_change(_OldVsn, State, _Extra) ->
164
164
%%----------------------------------------------------------------------
169
169
%%----------------------------------------------------------------------
170
170
handle_info({'EXIT', Pid, Reason}, #state{parent_pid = Pid} = State) ->
171
171
{stop, Reason, State};
172
handle_info(Info, State) ->
172
handle_info(_Info, State) ->
173
173
{noreply, State}.
175
175
%%----------------------------------------------------------------------
180
180
%% Returns : MemberId - long()
182
182
%%----------------------------------------------------------------------
183
add_channel(OE_This, #state{ch_counter=C, graph = DG} = State, Channel) ->
183
add_channel(_OE_This, #state{ch_counter=C, graph = DG} = State, Channel) ->
184
184
type_check(Channel, 'CosNotifyChannelAdmin_EventChannel'),
185
185
Id = cosEventDomainApp:create_id(C),
186
186
digraph:add_vertex(DG, Id, Channel),
192
192
%% Returns : CosEventDomainAdmin::MemberIDSeq ([long()])
194
194
%%----------------------------------------------------------------------
195
get_all_channels(OE_This, #state{graph = DG} = State) ->
195
get_all_channels(_OE_This, #state{graph = DG} = State) ->
196
196
{reply, digraph:vertices(DG), State}.
198
198
%%---------------------------------------------------------------------%
202
202
%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}
204
204
%%----------------------------------------------------------------------
205
get_channel(OE_This, #state{graph = DG} = State, Id) ->
205
get_channel(_OE_This, #state{graph = DG} = State, Id) ->
206
206
{reply, lookup_channel(DG, Id), State}.
208
208
%%---------------------------------------------------------------------%
212
212
%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}
214
214
%%----------------------------------------------------------------------
215
remove_channel(OE_This, #state{graph = DG} = State, Id) ->
215
remove_channel(_OE_This, #state{graph = DG} = State, Id) ->
216
216
lookup_channel(DG, Id),
217
217
close_connections(DG, digraph:edges(DG, Id)),
218
218
digraph:del_vertex(DG, Id),
229
229
%% {'EXCEPTION', #'CosEventDomainAdmin_DiamondCreationForbidden'{diam}}
231
231
%%----------------------------------------------------------------------
232
add_connection(OE_This, #state{graph = DG, co_counter = C} = State,
232
add_connection(_OE_This, #state{graph = DG, co_counter = C} = State,
233
233
Connection) when record(Connection,
234
234
'CosEventDomainAdmin_Connection') ->
235
235
SId = Connection#'CosEventDomainAdmin_Connection'.supplier_id,
259
259
digraph:del_edge(DG, Id),
260
orber:debug_level_print("[~p] CosEventDomainAdmin_EventDomain:add_connection(~p);
261
Failed setting up connection due to: ~p", [?LINE, Connection, What], ?DEBUG_LEVEL),
260
orber:dbg("[~p] CosEventDomainAdmin_EventDomain:"
261
"add_connection(~p);~nFailed setting up"
262
" connection due to: ~p",
263
[?LINE, Connection, What], ?DEBUG_LEVEL),
262
264
corba:raise(#'INTERNAL'{completion_status=?COMPLETED_MAYBE})
278
280
digraph:del_edge(DG, Id),
279
orber:debug_level_print("[~p] CosEventDomainAdmin_EventDomain:add_connection(~p);
280
Failed setting up connection due to: ~p", [?LINE, Connection, What], ?DEBUG_LEVEL),
281
orber:dbg("[~p] CosEventDomainAdmin_EventDomain:"
282
"add_connection(~p);~nFailed setting"
283
" up connection due to: ~p",
284
[?LINE, Connection, What],
281
286
corba:raise(#'INTERNAL'{completion_status=?COMPLETED_MAYBE})
299
304
%% Returns : CosEventDomainAdmin::ConnectionIDSeq - [long()]
301
306
%%----------------------------------------------------------------------
302
get_all_connections(OE_This, #state{graph = DG} = State) ->
307
get_all_connections(_OE_This, #state{graph = DG} = State) ->
303
308
{reply, digraph:edges(DG), State}.
305
310
%%---------------------------------------------------------------------%
309
314
%% {'EXCEPTION', #'CosEventDomainAdmin_ConnectionNotFound'{}} |
311
316
%%----------------------------------------------------------------------
312
get_connection(OE_This, #state{graph = DG} = State, Id) ->
317
get_connection(_OE_This, #state{graph = DG} = State, Id) ->
313
318
{reply, lookup_connection_data(DG, Id), State}.
315
320
%%---------------------------------------------------------------------%
319
324
%% {'EXCEPTION', #'CosEventDomainAdmin_ConnectionNotFound'{}} |
321
326
%%----------------------------------------------------------------------
322
remove_connection(OE_This, #state{graph = DG} = State, Id) ->
327
remove_connection(_OE_This, #state{graph = DG} = State, Id) ->
323
328
#connection{supplier=S, consumer=C, data=Connection} =
324
329
lookup_connection(DG, Id),
325
330
close_connection(Connection, S, C),
334
339
%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} |
336
341
%%----------------------------------------------------------------------
337
get_offer_channels(OE_This, #state{graph = DG, cyclic = Cyclic} = State, Id) ->
342
get_offer_channels(_OE_This, #state{graph = DG, cyclic = Cyclic} = State, Id) ->
338
343
lookup_channel(DG, Id),
339
344
case digraph:vertex(DG, Id) of
340
{Id, Channel} when Cyclic == ?ForbidCycles ->
345
{Id, _Channel} when Cyclic == ?ForbidCycles ->
341
346
{reply, digraph_utils:reaching_neighbours([Id], DG), State};
343
348
%% If cyclic graphs is allowed 'Id' will appear in the returned list.
344
349
%% Hence, we must delete it.
345
350
{reply,lists:delete(Id, digraph_utils:reaching_neighbours([Id], DG)),
355
360
%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} |
357
362
%%----------------------------------------------------------------------
358
get_subscription_channels(OE_This, #state{graph = DG, cyclic = Cyclic} = State, Id) ->
363
get_subscription_channels(_OE_This, #state{graph = DG, cyclic = Cyclic} = State, Id) ->
359
364
lookup_channel(DG, Id),
360
365
case digraph:vertex(DG, Id) of
361
{Id, Channel} when Cyclic == ?ForbidCycles ->
366
{Id, _Channel} when Cyclic == ?ForbidCycles ->
362
367
{reply, digraph_utils:reachable_neighbours([Id], DG), State};
364
369
%% If cyclic graphs is allowed 'Id' will appear in the returned list.
365
370
%% Hence, we must delete it.
366
371
{reply, lists:delete(Id, digraph_utils:reachable_neighbours([Id], DG)),
377
382
%%----------------------------------------------------------------------
378
destroy(OE_This, #state{graph = DG} = State) ->
383
destroy(_OE_This, #state{graph = _DG} = State) ->
379
384
{stop, normal, ok, State}.
381
386
%%---------------------------------------------------------------------%
384
389
%% Returns : CosEventDomainAdmin::CycleSeq
386
391
%%----------------------------------------------------------------------
387
get_cycles(OE_This, #state{cyclic = ?ForbidCycles} = State) ->
392
get_cycles(_OE_This, #state{cyclic = ?ForbidCycles} = State) ->
388
393
{reply, [], State};
389
get_cycles(OE_This, #state{graph = DG} = State) ->
394
get_cycles(_OE_This, #state{graph = DG} = State) ->
390
395
{reply, digraph_utils:cyclic_strong_components(DG), State}.
392
397
%%----------------------------------------------------------------------
395
400
%% Returns : CosEventDomainAdmin::DiamondSeq
397
402
%%----------------------------------------------------------------------
398
get_diamonds(OE_This, #state{diamonds = ?ForbidDiamonds} = State) ->
403
get_diamonds(_OE_This, #state{diamonds = ?ForbidDiamonds} = State) ->
399
404
{reply, [], State};
400
get_diamonds(OE_This, State) ->
405
get_diamonds(_OE_This, State) ->
401
406
{reply, get_diamonds_helper(State, true), State}.
403
get_diamonds_helper(#state{graph = DG} = State, FindAll) ->
408
get_diamonds_helper(#state{graph = DG} = _State, FindAll) ->
404
409
case find_candidates(DG) of
412
417
evaluate_candidates(DG, COut, CIn, [], Max, FindAll)
415
get_diamonds_helper(#state{graph = DG} = State, FindAll, Vertex) ->
420
get_diamonds_helper(#state{graph = DG} = _State, FindAll, Vertex) ->
416
421
case find_candidates(DG, Vertex) of
431
436
%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} |
433
438
%%----------------------------------------------------------------------
434
set_default_consumer_channel(OE_This, #state{graph = DG} = State, Id) ->
439
set_default_consumer_channel(_OE_This, #state{graph = DG} = State, Id) ->
435
440
lookup_channel(DG, Id),
436
441
{reply, ok, State#state{def_consumer=Id}}.
442
447
%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} |
444
449
%%----------------------------------------------------------------------
445
set_default_supplier_channel(OE_This, #state{graph = DG} = State, Id) ->
450
set_default_supplier_channel(_OE_This, #state{graph = DG} = State, Id) ->
446
451
lookup_channel(DG, Id),
447
452
{reply, ok, State#state{def_supplier=Id}}.
453
458
%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} |
455
460
%%----------------------------------------------------------------------
456
connect_push_consumer(OE_This, #state{def_supplier = Ch} = State, PC) ->
461
connect_push_consumer(_OE_This, #state{def_supplier = Ch} = State, PC) ->
457
462
type_check(PC, 'CosEventComm_PushConsumer'),
458
463
Proxy = connect_a_push_consumer(Ch, PC, 'ANY_EVENT'),
459
464
{reply, Proxy, State}.
465
470
%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} |
467
472
%%----------------------------------------------------------------------
468
connect_pull_consumer(OE_This, #state{def_consumer = Ch} = State, PC) ->
473
connect_pull_consumer(_OE_This, #state{def_consumer = Ch} = State, PC) ->
469
474
Proxy = connect_a_pull_consumer(Ch, PC, 'ANY_EVENT'),
470
475
{reply, Proxy, State}.
476
481
%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} |
478
483
%%----------------------------------------------------------------------
479
connect_push_supplier(OE_This, #state{def_supplier = Ch} = State, PS) ->
484
connect_push_supplier(_OE_This, #state{def_supplier = Ch} = State, PS) ->
480
485
Proxy = connect_a_push_supplier(Ch, PS, 'ANY_EVENT'),
481
486
{reply, Proxy, State}.
487
492
%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} |
489
494
%%----------------------------------------------------------------------
490
connect_pull_supplier(OE_This, #state{def_consumer = Ch} = State, PS) ->
495
connect_pull_supplier(_OE_This, #state{def_consumer = Ch} = State, PS) ->
491
496
type_check(PS, 'CosEventComm_PullSupplier'),
492
497
Proxy = connect_a_pull_supplier(Ch, PS, 'ANY_EVENT'),
493
498
{reply, Proxy, State}.
499
504
%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} |
501
506
%%----------------------------------------------------------------------
502
connect_structured_push_consumer(OE_This, #state{def_supplier = Ch} = State, PC) ->
507
connect_structured_push_consumer(_OE_This, #state{def_supplier = Ch} = State, PC) ->
503
508
type_check(PC, 'CosNotifyComm_StructuredPushConsumer'),
504
509
Proxy = connect_a_push_consumer(Ch, PC, 'STRUCTURED_EVENT'),
505
510
{reply, Proxy, State}.
511
516
%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} |
513
518
%%----------------------------------------------------------------------
514
connect_structured_pull_consumer(OE_This, #state{def_supplier = Ch} = State, PC) ->
519
connect_structured_pull_consumer(_OE_This, #state{def_supplier = Ch} = State, PC) ->
515
520
Proxy = connect_a_pull_consumer(Ch, PC, 'STRUCTURED_EVENT'),
516
521
{reply, Proxy, State}.
522
527
%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} |
524
529
%%----------------------------------------------------------------------
525
connect_structured_push_supplier(OE_This, #state{def_consumer = Ch} = State, PS) ->
530
connect_structured_push_supplier(_OE_This, #state{def_consumer = Ch} = State, PS) ->
526
531
Proxy = connect_a_push_supplier(Ch, PS, 'STRUCTURED_EVENT'),
527
532
{reply, Proxy, State}.
533
538
%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} |
535
540
%%----------------------------------------------------------------------
536
connect_structured_pull_supplier(OE_This, #state{def_consumer = Ch} = State, PS) ->
541
connect_structured_pull_supplier(_OE_This, #state{def_consumer = Ch} = State, PS) ->
537
542
type_check(PS, 'CosNotifyComm_StructuredPullSupplier'),
538
543
Proxy = connect_a_pull_supplier(Ch, PS, 'STRUCTURED_EVENT'),
539
544
{reply, Proxy, State}.
545
550
%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} |
547
552
%%----------------------------------------------------------------------
548
connect_sequence_push_consumer(OE_This, #state{def_supplier = Ch} = State, PC) ->
553
connect_sequence_push_consumer(_OE_This, #state{def_supplier = Ch} = State, PC) ->
549
554
type_check(PC, 'CosNotifyComm_SequencePushConsumer'),
550
555
Proxy = connect_a_push_consumer(Ch, PC, 'SEQUENCE_EVENT'),
551
556
{reply, Proxy, State}.
557
562
%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} |
559
564
%%----------------------------------------------------------------------
560
connect_sequence_pull_consumer(OE_This, #state{def_supplier = Ch} = State, PC) ->
565
connect_sequence_pull_consumer(_OE_This, #state{def_supplier = Ch} = State, PC) ->
561
566
Proxy = connect_a_pull_consumer(Ch, PC, 'SEQUENCE_EVENT'),
562
567
{reply, Proxy, State}.
568
573
%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} |
570
575
%%----------------------------------------------------------------------
571
connect_sequence_push_supplier(OE_This, #state{def_consumer = Ch} = State, PS) ->
576
connect_sequence_push_supplier(_OE_This, #state{def_consumer = Ch} = State, PS) ->
572
577
Proxy = connect_a_push_supplier(Ch, PS, 'SEQUENCE_EVENT'),
573
578
{reply, Proxy, State}.
579
584
%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} |
581
586
%%----------------------------------------------------------------------
582
connect_sequence_pull_supplier(OE_This, #state{def_consumer = Ch} = State, PS) ->
587
connect_sequence_pull_supplier(_OE_This, #state{def_consumer = Ch} = State, PS) ->
583
588
type_check(PS, 'CosNotifyComm_SequencePullSupplier'),
584
589
Proxy = connect_a_pull_supplier(Ch, PS, 'SEQUENCE_EVENT'),
585
590
{reply, Proxy, State}.
592
597
%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} |
594
599
%%----------------------------------------------------------------------
595
connect_push_consumer_with_id(OE_This, #state{graph = DG} = State, PC, Id) ->
600
connect_push_consumer_with_id(_OE_This, #state{graph = DG} = State, PC, Id) ->
596
601
type_check(PC, 'CosEventComm_PushConsumer'),
597
602
Channel = lookup_channel(DG, Id),
598
603
Proxy = connect_a_push_consumer(Channel, PC, 'ANY_EVENT'),
606
611
%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} |
608
613
%%----------------------------------------------------------------------
609
connect_pull_consumer_with_id(OE_This, #state{graph = DG} = State, PC, Id) ->
614
connect_pull_consumer_with_id(_OE_This, #state{graph = DG} = State, PC, Id) ->
610
615
Channel = lookup_channel(DG, Id),
611
616
Proxy = connect_a_pull_consumer(Channel, PC, 'ANY_EVENT'),
612
617
{reply, Proxy, State}.
619
624
%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} |
621
626
%%----------------------------------------------------------------------
622
connect_push_supplier_with_id(OE_This, #state{graph = DG} = State, PS, Id) ->
627
connect_push_supplier_with_id(_OE_This, #state{graph = DG} = State, PS, Id) ->
623
628
Channel = lookup_channel(DG, Id),
624
629
Proxy = connect_a_push_supplier(Channel, PS, 'ANY_EVENT'),
625
630
{reply, Proxy, State}.
632
637
%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} |
634
639
%%----------------------------------------------------------------------
635
connect_pull_supplier_with_id(OE_This, #state{graph = DG} = State, PS, Id) ->
640
connect_pull_supplier_with_id(_OE_This, #state{graph = DG} = State, PS, Id) ->
636
641
type_check(PS, 'CosEventComm_PullSupplier'),
637
642
Channel = lookup_channel(DG, Id),
638
643
Proxy = connect_a_pull_supplier(Channel, PS, 'ANY_EVENT'),
646
651
%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} |
648
653
%%----------------------------------------------------------------------
649
connect_structured_push_consumer_with_id(OE_This, #state{graph = DG} = State, PC, Id) ->
654
connect_structured_push_consumer_with_id(_OE_This, #state{graph = DG} = State, PC, Id) ->
650
655
type_check(PC, 'CosNotifyComm_StructuredPushConsumer'),
651
656
Channel = lookup_channel(DG, Id),
652
657
Proxy = connect_a_push_consumer(Channel, PC, 'STRUCTURED_EVENT'),
660
665
%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} |
662
667
%%----------------------------------------------------------------------
663
connect_structured_pull_consumer_with_id(OE_This, #state{graph = DG} = State, PC, Id) ->
668
connect_structured_pull_consumer_with_id(_OE_This, #state{graph = DG} = State, PC, Id) ->
664
669
Channel = lookup_channel(DG, Id),
665
670
Proxy = connect_a_pull_consumer(Channel, PC, 'STRUCTURED_EVENT'),
666
671
{reply, Proxy, State}.
673
678
%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} |
675
680
%%----------------------------------------------------------------------
676
connect_structured_push_supplier_with_id(OE_This, #state{graph = DG} = State, PS, Id) ->
681
connect_structured_push_supplier_with_id(_OE_This, #state{graph = DG} = State, PS, Id) ->
677
682
Channel = lookup_channel(DG, Id),
678
683
Proxy = connect_a_push_supplier(Channel, PS, 'STRUCTURED_EVENT'),
679
684
{reply, Proxy, State}.
686
691
%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} |
688
693
%%----------------------------------------------------------------------
689
connect_structured_pull_supplier_with_id(OE_This, #state{graph = DG} = State, PS, Id) ->
694
connect_structured_pull_supplier_with_id(_OE_This, #state{graph = DG} = State, PS, Id) ->
690
695
type_check(PS, 'CosNotifyComm_StructuredPullSupplier'),
691
696
Channel = lookup_channel(DG, Id),
692
697
Proxy = connect_a_pull_supplier(Channel, PS, 'STRUCTURED_EVENT'),
700
705
%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} |
702
707
%%----------------------------------------------------------------------
703
connect_sequence_push_consumer_with_id(OE_This, #state{graph = DG} = State, PC, Id) ->
708
connect_sequence_push_consumer_with_id(_OE_This, #state{graph = DG} = State, PC, Id) ->
704
709
type_check(PC, 'CosNotifyComm_SequencePushConsumer'),
705
710
Channel = lookup_channel(DG, Id),
706
711
Proxy = connect_a_push_consumer(Channel, PC, 'SEQUENCE_EVENT'),
714
719
%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} |
716
721
%%----------------------------------------------------------------------
717
connect_sequence_pull_consumer_with_id(OE_This, #state{graph = DG} = State, PC, Id) ->
722
connect_sequence_pull_consumer_with_id(_OE_This, #state{graph = DG} = State, PC, Id) ->
718
723
Channel = lookup_channel(DG, Id),
719
724
Proxy = connect_a_pull_consumer(Channel, PC, 'SEQUENCE_EVENT'),
720
725
{reply, Proxy, State}.
727
732
%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} |
729
734
%%----------------------------------------------------------------------
730
connect_sequence_push_supplier_with_id(OE_This, #state{graph = DG} = State, PS, Id) ->
735
connect_sequence_push_supplier_with_id(_OE_This, #state{graph = DG} = State, PS, Id) ->
731
736
Channel = lookup_channel(DG, Id),
732
737
Proxy = connect_a_push_supplier(Channel, PS, 'SEQUENCE_EVENT'),
733
738
{reply, Proxy, State}.
740
745
%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} |
742
747
%%----------------------------------------------------------------------
743
connect_sequence_pull_supplier_with_id(OE_This, #state{graph = DG} = State, PS, Id) ->
748
connect_sequence_pull_supplier_with_id(_OE_This, #state{graph = DG} = State, PS, Id) ->
744
749
type_check(PS, 'CosNotifyComm_SequencePullSupplier'),
745
750
Channel = lookup_channel(DG, Id),
746
751
Proxy = connect_a_pull_supplier(Channel, PS, 'SEQUENCE_EVENT'),
755
760
%% Returns : CosNotification::QoSProperties
757
762
%%----------------------------------------------------------------------
758
get_qos(OE_This, #state{cyclic = Cyclic, diamonds = Diamonds} = State) ->
763
get_qos(_OE_This, #state{cyclic = Cyclic, diamonds = Diamonds} = State) ->
759
764
{reply, [#'CosNotification_Property'
760
765
{name = ?DiamondDetection,
761
766
value = any:create(orber_tc:short(), Diamonds)},
770
775
%% {'EXCEPTION', #'CosNotification_UnsupportedQoS{}}
772
777
%%----------------------------------------------------------------------
773
set_qos(OE_This, State, NewQoS) ->
778
set_qos(_OE_This, State, NewQoS) ->
774
779
QoS = cosEventDomainApp:get_qos(NewQoS),
775
780
set_qos_helper(QoS, State, []).
820
825
%% {'EXCEPTION', #'CosNotification_UnsupportedQoS{}}
821
826
%% Description: NamedPropertyRangeSeq is of out-type
822
827
%%----------------------------------------------------------------------
823
validate_qos(OE_This, State, WantedQoS) ->
828
validate_qos(_OE_This, State, WantedQoS) ->
824
829
QoS = cosEventDomainApp:get_qos(WantedQoS),
825
830
{reply, {ok, validate_qos_helper(QoS, State, [], [])}, State}.
881
886
%% Returns : CosNotification::AdminProperties
882
887
%% Description: No Admins currently supported
883
888
%%----------------------------------------------------------------------
884
get_admin(OE_This, State) ->
889
get_admin(_OE_This, State) ->
885
890
{reply, [], State}.
887
892
%%---------------------------------------------------------------------%
891
896
%% {'EXCEPTION', #'CosNotification_UnsupportedAdmin{}}
892
897
%% Description: No Admins currently supported
893
898
%%----------------------------------------------------------------------
894
set_admin(OE_This, State, NewAdmins) ->
899
set_admin(_OE_This, State, NewAdmins) ->
895
900
cosEventDomainApp:get_admin(NewAdmins),
896
901
{reply, ok, State}.
927
932
{filter_candidates(COut), filter_candidates(CIn), Max}.
930
find_candidates(DG, Vertex) ->
935
find_candidates(DG, _Vertex) ->
931
936
%% We should use the fact that we know one of the vertices.
932
937
Edges = digraph:edges(DG),
933
938
{COut, CIn, Max} = find_candidates_helper(Edges, [], [], DG, 0),
936
941
find_candidates_helper([], AccOut, AccIn, _, Counter) ->
937
942
{lists:sort(AccOut), lists:sort(AccIn), Counter};
938
943
find_candidates_helper([H|T], AccOut, AccIn, DG, Counter) ->
939
{H, V1, V2, Label} = digraph:edge(DG, H),
944
{H, V1, V2, _Label} = digraph:edge(DG, H),
940
945
find_candidates_helper(T, [{V1, V2}|AccOut], [{V2,V1}|AccIn], DG, Counter+1).
942
947
filter_candidates([]) ->
944
949
filter_candidates([{V1, V2}|T]) ->
945
950
filter_candidates([{V1, V2}|T], V1, [], []).
946
filter_candidates([], V, [Acc1], Acc2) ->
951
filter_candidates([], _V, [_Acc1], Acc2) ->
947
952
%% Only one in/out connection. Hence, cannot be start- or end-point
949
954
lists:reverse(Acc2);
951
956
lists:reverse([{V, lists:reverse(Acc1)}|Acc2]);
952
957
filter_candidates([{V1, V2}|T], V1, Acc1, Acc2) ->
953
958
filter_candidates(T, V1, [V2|Acc1], Acc2);
954
filter_candidates([{V1, V2}|T], V, [Acc1], Acc2) ->
959
filter_candidates([{V1, V2}|T], _V, [_Acc1], Acc2) ->
955
960
%% Only one in/out connection. Hence, cannot be start- or end-point
957
962
filter_candidates(T, V1, [V2], Acc2);
975
980
%% duplicates may be generated. For example, #2/#3 is a sub-set of #1
976
981
%% but they are as well diamonds.
977
982
%%----------------------------------------------------------------------
978
evaluate_candidates(DG, [], _, Acc, Max, _) ->
983
evaluate_candidates(_DG, [], _, Acc, _Max, _) ->
980
985
evaluate_candidates(DG, [{V, OutV}|T], CIn, Acc, Max, FindAll) ->
981
986
case evaluate_candidates_helper(DG, V, OutV, CIn, [], FindAll) of
993
998
evaluate_candidates_helper(_, _, _, [], Diamonds, _) ->
995
evaluate_candidates_helper(DG, V1, OutV, [{V1, InV}|T], Diamonds, FindAll) ->
1000
evaluate_candidates_helper(DG, V1, OutV, [{V1, _InV}|T], Diamonds, FindAll) ->
996
1001
evaluate_candidates_helper(DG, V1, OutV, T, Diamonds, FindAll);
997
1002
evaluate_candidates_helper(DG, V1, OutV, [{V2, InV}|T], Diamonds, FindAll) ->
998
1003
case double_match(OutV, InV, [], V1, V2) of
1057
1062
is_member([_|T], H) ->
1058
1063
is_member(T, H).
1060
double_match([], _, [Matched], _, _) ->
1065
double_match([], _, [_Matched], _, _) ->
1062
1067
double_match([], _, Matched, _, _) ->
1064
double_match(_, [], [Matched], _, _) ->
1069
double_match(_, [], [_Matched], _, _) ->
1066
1071
double_match(_, [], Matched, _, _) ->
1069
1074
double_match(T1, T2, [[V1,H,V2] | Matched], V1, V2);
1070
1075
double_match([H1|T1], [H2|T2], Matched, V1, V2) when H1 > H2 ->
1071
1076
double_match([H1|T1], T2, Matched, V1, V2);
1072
double_match([H1|T1], [H2|T2], Matched, V1, V2) ->
1077
double_match([_H1|T1], [H2|T2], Matched, V1, V2) ->
1073
1078
double_match(T1, [H2|T2], Matched, V1, V2).
1075
1080
double_match_exclude([], _, Matched, _, _) ->
1087
1092
double_match_exclude(T1, T2, [[V1,H,V2] | Matched], V1, V2);
1088
1093
double_match_exclude([H1|T1], [H2|T2], Matched, V1, V2) when H1 > H2 ->
1089
1094
double_match_exclude([H1|T1], T2, Matched, V1, V2);
1090
double_match_exclude([H1|T1], [H2|T2], Matched, V1, V2) ->
1095
double_match_exclude([_H1|T1], [H2|T2], Matched, V1, V2) ->
1091
1096
double_match_exclude(T1, [H2|T2], Matched, V1, V2).
1116
1121
get_path(G, V1, V2, E1, E2) ->
1117
1122
one_path(digraph:out_neighbours(G, V1), V2, [], [V1], [V1], G, E1, E2).
1119
one_path([E1|Vs], W, Cont, Xs, Ps, G, E1, E2) ->
1120
one_path([], W, Cont, Xs, Ps, G, E1, E2);
1121
one_path([E2|Vs], W, Cont, Xs, Ps, G, E1, E2) ->
1122
one_path([], W, Cont, Xs, Ps, G, E1, E2);
1123
one_path([W|Ws], W, Cont, Xs, Ps, G, E1, E2) ->
1124
one_path([E1|_Vs], W, Cont, Xs, Ps, G, E1, E2) ->
1125
one_path([], W, Cont, Xs, Ps, G, E1, E2);
1126
one_path([E2|_Vs], W, Cont, Xs, Ps, G, E1, E2) ->
1127
one_path([], W, Cont, Xs, Ps, G, E1, E2);
1128
one_path([W|_Ws], W, _Cont, _Xs, Ps, _G, _E1, _E2) ->
1125
1130
one_path([V|Vs], W, Cont, Xs, Ps, G, E1, E2) ->
1126
1131
case lists:member(V, Xs) of
1147
orber:debug_level_print("[~p] CosEventDomainAdmin:type_check();
1148
Object of incorrect type supplied; should be: ~p
1149
Failed due to: ~p", [?LINE, Mod, What], ?DEBUG_LEVEL),
1152
orber:dbg("[~p] CosEventDomainAdmin:type_check();~n"
1153
"Object of incorrect type supplied; should be: ~p~n"
1154
"Failed due to: ~p", [?LINE, Mod, What], ?DEBUG_LEVEL),
1150
1155
corba:raise(#'BAD_PARAM'{minor=507, completion_status=?COMPLETED_NO})
1177
1182
%%----------------------------------------------------------------------
1178
1183
lookup_connection(DG, Id) ->
1179
1184
case digraph:edge(DG, Id) of
1180
{Id, SId, CId, Connection} ->
1185
{Id, _SId, _CId, Connection} ->
1183
1188
corba:raise(#'CosEventDomainAdmin_ConnectionNotFound'{})
1193
1198
%%----------------------------------------------------------------------
1194
1199
lookup_connection_data(DG, Id) ->
1195
1200
case digraph:edge(DG, Id) of
1196
{Id, SId, CId, #connection{data = Connection}} ->
1201
{Id, _SId, _CId, #connection{data = Connection}} ->
1199
1204
corba:raise(#'CosEventDomainAdmin_ConnectionNotFound'{})
1206
1211
%% Returns : ok
1208
1213
%%----------------------------------------------------------------------
1209
close_connections(DG, []) ->
1214
close_connections(_DG, []) ->
1211
1216
close_connections(DG, [H|T]) ->
1212
1217
#connection{supplier=S, consumer=C, data=Connection} =