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. --- lib/cosEventDomain/AUTHORS | 4 + lib/cosEventDomain/Makefile | 41 + lib/cosEventDomain/doc/html/.gitignore | 0 lib/cosEventDomain/doc/man3/.gitignore | 0 lib/cosEventDomain/doc/man6/.gitignore | 0 lib/cosEventDomain/doc/pdf/.gitignore | 0 lib/cosEventDomain/doc/src/CosEventDomainAdmin.xml | 92 ++ .../doc/src/CosEventDomainAdmin_EventDomain.xml | 627 +++++++++ .../src/CosEventDomainAdmin_EventDomainFactory.xml | 88 ++ lib/cosEventDomain/doc/src/Makefile | 227 ++++ lib/cosEventDomain/doc/src/book.gif | Bin 0 -> 1081 bytes lib/cosEventDomain/doc/src/book.xml | 48 + lib/cosEventDomain/doc/src/ch_QoS.xml | 117 ++ lib/cosEventDomain/doc/src/ch_contents.xml | 68 + .../doc/src/ch_event_domain_service.xml | 110 ++ lib/cosEventDomain/doc/src/ch_introduction.xml | 52 + lib/cosEventDomain/doc/src/cosEventDomainApp.xml | 149 +++ lib/cosEventDomain/doc/src/fascicules.xml | 18 + lib/cosEventDomain/doc/src/make.dep | 23 + lib/cosEventDomain/doc/src/notes.gif | Bin 0 -> 2005 bytes lib/cosEventDomain/doc/src/notes.xml | 168 +++ lib/cosEventDomain/doc/src/part.xml | 39 + lib/cosEventDomain/doc/src/part_notes.xml | 36 + lib/cosEventDomain/doc/src/ref_man.gif | Bin 0 -> 1530 bytes lib/cosEventDomain/doc/src/ref_man.xml | 39 + lib/cosEventDomain/doc/src/summary.html.src | 1 + lib/cosEventDomain/doc/src/user_guide.gif | Bin 0 -> 1581 bytes lib/cosEventDomain/ebin/.gitignore | 0 lib/cosEventDomain/example/.gitignore | 0 lib/cosEventDomain/include/.gitignore | 0 lib/cosEventDomain/info | 2 + lib/cosEventDomain/src/CosEventDomainAdmin.cfg | 4 + lib/cosEventDomain/src/CosEventDomainAdmin.idl | 280 ++++ ...CosEventDomainAdmin_EventDomainFactory_impl.erl | 182 +++ .../src/CosEventDomainAdmin_EventDomain_impl.erl | 1415 ++++++++++++++++++++ lib/cosEventDomain/src/Makefile | 179 +++ lib/cosEventDomain/src/cosEventDomain.app.src | 31 + lib/cosEventDomain/src/cosEventDomain.appup.src | 6 + lib/cosEventDomain/src/cosEventDomainApp.erl | 363 +++++ lib/cosEventDomain/src/cosEventDomainApp.hrl | 69 + lib/cosEventDomain/vsn.mk | 10 + 41 files changed, 4488 insertions(+) create mode 100644 lib/cosEventDomain/AUTHORS create mode 100644 lib/cosEventDomain/Makefile create mode 100644 lib/cosEventDomain/doc/html/.gitignore create mode 100644 lib/cosEventDomain/doc/man3/.gitignore create mode 100644 lib/cosEventDomain/doc/man6/.gitignore create mode 100644 lib/cosEventDomain/doc/pdf/.gitignore create mode 100644 lib/cosEventDomain/doc/src/CosEventDomainAdmin.xml create mode 100644 lib/cosEventDomain/doc/src/CosEventDomainAdmin_EventDomain.xml create mode 100644 lib/cosEventDomain/doc/src/CosEventDomainAdmin_EventDomainFactory.xml create mode 100644 lib/cosEventDomain/doc/src/Makefile create mode 100644 lib/cosEventDomain/doc/src/book.gif create mode 100644 lib/cosEventDomain/doc/src/book.xml create mode 100644 lib/cosEventDomain/doc/src/ch_QoS.xml create mode 100644 lib/cosEventDomain/doc/src/ch_contents.xml create mode 100644 lib/cosEventDomain/doc/src/ch_event_domain_service.xml create mode 100644 lib/cosEventDomain/doc/src/ch_introduction.xml create mode 100644 lib/cosEventDomain/doc/src/cosEventDomainApp.xml create mode 100644 lib/cosEventDomain/doc/src/fascicules.xml create mode 100644 lib/cosEventDomain/doc/src/make.dep create mode 100644 lib/cosEventDomain/doc/src/notes.gif create mode 100644 lib/cosEventDomain/doc/src/notes.xml create mode 100644 lib/cosEventDomain/doc/src/part.xml create mode 100644 lib/cosEventDomain/doc/src/part_notes.xml create mode 100644 lib/cosEventDomain/doc/src/ref_man.gif create mode 100644 lib/cosEventDomain/doc/src/ref_man.xml create mode 100644 lib/cosEventDomain/doc/src/summary.html.src create mode 100644 lib/cosEventDomain/doc/src/user_guide.gif create mode 100644 lib/cosEventDomain/ebin/.gitignore create mode 100644 lib/cosEventDomain/example/.gitignore create mode 100644 lib/cosEventDomain/include/.gitignore create mode 100644 lib/cosEventDomain/info create mode 100644 lib/cosEventDomain/src/CosEventDomainAdmin.cfg create mode 100644 lib/cosEventDomain/src/CosEventDomainAdmin.idl create mode 100644 lib/cosEventDomain/src/CosEventDomainAdmin_EventDomainFactory_impl.erl create mode 100644 lib/cosEventDomain/src/CosEventDomainAdmin_EventDomain_impl.erl create mode 100644 lib/cosEventDomain/src/Makefile create mode 100644 lib/cosEventDomain/src/cosEventDomain.app.src create mode 100644 lib/cosEventDomain/src/cosEventDomain.appup.src create mode 100644 lib/cosEventDomain/src/cosEventDomainApp.erl create mode 100644 lib/cosEventDomain/src/cosEventDomainApp.hrl create mode 100644 lib/cosEventDomain/vsn.mk (limited to 'lib/cosEventDomain') diff --git a/lib/cosEventDomain/AUTHORS b/lib/cosEventDomain/AUTHORS new file mode 100644 index 0000000000..6d03df4c5a --- /dev/null +++ b/lib/cosEventDomain/AUTHORS @@ -0,0 +1,4 @@ +Original Authors: +Niclas Eklund + +Contributors: diff --git a/lib/cosEventDomain/Makefile b/lib/cosEventDomain/Makefile new file mode 100644 index 0000000000..566141cefd --- /dev/null +++ b/lib/cosEventDomain/Makefile @@ -0,0 +1,41 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2001-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% +# +# +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Application version +# ---------------------------------------------------- +include vsn.mk +VSN=$(COSEVENTDOMAIN_VSN) + +# ---------------------------------------------------- +# Common Macros +# ---------------------------------------------------- + +SUB_DIRECTORIES = src doc/src + +SPECIAL_TARGETS = + +# ---------------------------------------------------- +# Default Subdir Targets +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_subdir.mk + diff --git a/lib/cosEventDomain/doc/html/.gitignore b/lib/cosEventDomain/doc/html/.gitignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lib/cosEventDomain/doc/man3/.gitignore b/lib/cosEventDomain/doc/man3/.gitignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lib/cosEventDomain/doc/man6/.gitignore b/lib/cosEventDomain/doc/man6/.gitignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lib/cosEventDomain/doc/pdf/.gitignore b/lib/cosEventDomain/doc/pdf/.gitignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lib/cosEventDomain/doc/src/CosEventDomainAdmin.xml b/lib/cosEventDomain/doc/src/CosEventDomainAdmin.xml new file mode 100644 index 0000000000..d0aac961d7 --- /dev/null +++ b/lib/cosEventDomain/doc/src/CosEventDomainAdmin.xml @@ -0,0 +1,92 @@ + + + + +
+ + 2002 + 2007 + Ericsson AB, 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. + + The Initial Developer of the Original Code is Ericsson AB. + + + CosEventDomainAdmin + Niclas Eklund + Niclas Eklund + + Niclas Eklund + + 2001-08-20 + PA1 +
+ CosEventDomainAdmin + This module export functions which return QoS and Admin Properties constants. + +

To get access to all definitions include necessary files by using:

+
+ + + 'CycleDetection'() -> string() + Return the CycleDetection identifier required when defining QoS Properties + +

This function returns the CycleDetection identifier; required when + defining QoS Properties.

+
+
+ + 'AuthorizeCycles'() -> short() + Return the AuthorizeCycles value; required when defining QoS Properties + +

This function returns the AuthorizeCycles value; required when + defining QoS Properties.

+
+
+ + 'ForbidCycles'() -> short() + Return the ForbidCycles value; required when defining QoS Properties + +

This function returns the ForbidCycles value; required when + defining QoS Properties.

+
+
+ + 'DiamondDetection'() -> string() + Return the DiamondDetection identifier required when defining QoS Properties + +

This function returns the DiamondDetection identifier; required when + defining QoS Properties.

+
+
+ + 'AuthorizeDiamonds'() -> short() + Return the AuthorizeDiamonds value; required when defining QoS Properties + +

This function returns the AuthorizeDiamonds value; required when + defining QoS Properties.

+
+
+ + 'ForbidDiamonds'() -> short() + Return the ForbidDiamonds value; required when defining QoS Properties + +

This function returns the ForbidDiamonds value; required when + defining QoS Properties.

+
+
+
+ +
+ diff --git a/lib/cosEventDomain/doc/src/CosEventDomainAdmin_EventDomain.xml b/lib/cosEventDomain/doc/src/CosEventDomainAdmin_EventDomain.xml new file mode 100644 index 0000000000..cf1cdab966 --- /dev/null +++ b/lib/cosEventDomain/doc/src/CosEventDomainAdmin_EventDomain.xml @@ -0,0 +1,627 @@ + + + + +
+ + 20012009 + Ericsson AB. 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. + + + + CosEventDomainAdmin_­EventDomain + ..._EventDomain + + + Niclas Eklund + + 2001-08-20 + PA1 +
+ CosEventDomainAdmin_EventDomain + This module implements the Event Domain interface. + +

To get access to all definitions include necessary files by using:

+

This module also exports the functions described in:

+ + CosNotification_QoSAdmin + CosNotification_AdminPropertiesAdmin + +
+ + + add_channel(EventDomain, Channel) -> MemberID + Add a new channel to the EventDomain + + EventDomain = Channel = #objref + MemberID = long() + + +

Adds the given channel to the target domain. The channel + must be a .

+
+
+ + get_all_channels(EventDomain) -> MemberIDSeq + Return all channel id's associated with target object + + EventDomain = #objref + MemberIDSeq = [long()] + + +

Returns a a sequence of all channels associated with + the target object.

+
+
+ + get_channel(EventDomain, MemberID) -> Reply + Return the channel associated with the given id + + EventDomain = #objref + MemberID = long() + Reply = Channel | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} + Channel = #objref + + +

If the target domain have a + represented by the given id this channel is returned. Otherwise, + an exception is raised.

+
+
+ + remove_channel(EventDomain, MemberID) -> Reply + Remove the channel associated with the given id and remove all connections of that channel + + EventDomain = #objref + MemberID = long() + Reply = ok | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} + + +

If a with the + exists it will removed and all its + terminated. Otherwise an exception is raised.

+
+
+ + add_connection(EventDomain, Connection) -> Reply + If possible, setup a connection described by the struct + + EventDomain = #objref + Connection = 'CosEventDomainAdmin_Connection'{supplier_id=MemberID, consumer_id=MemberID, ctype=Type, notification_style=Style} + MemberID = long() + Type = 'ANY_EVENT' | 'STRUCTURED_EVENT' | 'SEQUENCE_EVENT' + Style = 'Pull' | 'Push' + Reply = ConnectionID | {'EXCEPTION', Exc} + ConnectionID = long() + Exc = #'CosNotifyChannelAdmin_ChannelNotFound'{} | #'CosNotifyChannelAdmin_TypeError'{} | #'CosEventDomainAdmin_AlreadyExists'{} | #'CosEventDomainAdmin_DiamondCreationForbidden'{diam=RouteSeq} | #'CosEventDomainAdmin_CycleCreationForbidden'{cyc=MemberIDSeq} + RouteSeq = [MemberIDSeq] + MemberIDSeq = [long()] + + +

The Connection parameter must contain valid data to enable + the target domain to setup a connection between two channels. + The struct members and + determines which channel should produce and consume events. + which type of events and if the supplier should push or the + consumer pull events is determined by and + respectively.

+

If the target domain is not able to setup the connection + the appropriate exception is raised.

+
+
+ + get_all_connections(EventDomain) -> ConnectionIDSeq + Return a sequence of all connections within the target domain + + EventDomain = #objref + ConnectionIDSeq = [long()] + + +

This operation returns a sequence of all connections within + the target domain.

+
+
+ + get_connection(EventDomain, ConnectionID) -> Reply + Return a struct describing the connection associated with the given id within the target domain + + EventDomain = #objref + ConnectionID = long() + Reply = Connection | {'EXCEPTION', #'CosEventDomainAdmin_ConnectionNotFound'{}} + Connection = 'CosEventDomainAdmin_Connection'{supplier_id=MemberID, consumer_id=MemberID, ctype=Type, notification_style=Style} + MemberID = long() + Type = 'ANY_EVENT' | 'STRUCTURED_EVENT' | 'SEQUENCE_EVENT' + Style = 'Pull' | 'Push' + + +

If a connection identified by the given id exists within the + target domain, a which + describe the connection is returned. Otherwise, an exception + is raised.

+
+
+ + remove_connection(EventDomain, ConnectionID) -> Reply + Remove the connection identified by the given id from the target domain + + EventDomain = #objref + ConnectionID = long() + Reply = ok | {'EXCEPTION', #'CosEventDomainAdmin_ConnectionNotFound'{}} + + +

If the supplied connection id exists, the connection the + id represents is terminated. Otherwise, an exception is raised.

+
+
+ + get_offer_channels(EventDomain, MemberID) -> Reply + Return all id's of the channels which produce events received by the channel identified by the given id + + EventDomain = #objref + MemberID = long() + Reply = MemberIDSeq | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} + + +

This operation returns a sequence, containing the member id's + of all channels within the target domain which will supply events + to the channel identified by the given id. But, if no such + id exists in this domain, an exception is raised.

+
+
+ + get_subscription_channels(EventDomain, MemberID) -> Reply + Return all id's of the channels which consume events supplied by the channel identified by the given id + + EventDomain = #objref + Reply = MemberIDSeq | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} + + +

This operations behaves like ; + the difference is that the id's returned identifies channels + which will consume events supplied by the channel associated + with the given id.

+
+
+ + destroy(EventDomain) -> ok + Destroy the event domain and all connections within it + + EventDomain = #objref + + +

Calling this operation will terminate all connections + within the target domain. The domain will terminate but + all channels will not be affected.

+
+
+ + get_cycles(EventDomain) -> RouteSeq + Return a list of all cycles which exists within the target domain + + EventDomain = #objref + RouteSeq = [MemberIDSeq] + MemberIDSeq = [long()] + + +

Returns a list of all cycles within the target domain.

+
+
+ + get_diamonds(EventDomain) -> DiamondSeq + Return a list of all diamonds which exists within the target domain + + EventDomain = #objref + DiamondSeq = [RouteSeq] + RouteSeq = [MemberIDSeq] + MemberIDSeq = [long()] + + +

Returns a list of all diamonds within the target domain

+
+
+ + set_default_consumer_channel(EventDomain, MemberID) -> Reply + Set the channel represented by the given id as default for supplier clients + + EventDomain = #objref + Reply = MemberID | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} + MemberID = long() + + +

If the given id represents a channel within the target domain, + this channel will be used when connection a supplier client + without specifying a certain channel. If no such channel exists + an exceptions is raised.

+
+
+ + set_default_supplier_channel(EventDomain, MemberID) -> Reply + Set the channel represented by the given id as default for supplier clients + + EventDomain = #objref + Reply = MemberID | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} + MemberID = long() + + +

If the given id represents a channel within the target domain, + this channel will be used when connection a consumer client + without specifying a certain channel. If no such channel exists + an exceptions is raised.

+
+
+ + connect_push_consumer(EventDomain, Consumer) -> Reply + Connect the PushConsumer to the default Channel + + EventDomain = #objref + Consumer = CosEventComm::PushConsumer + Reply = CosNotifyChannelAdmin::ProxyPushSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} + + +

If a default Channel have been set, this operation connects the given + PushConsumer to it. Otherwise, the + exception is raised.

+
+
+ + connect_pull_consumer(EventDomain, Consumer) -> Reply + Connect the PullConsumer to the default Channel + + EventDomain = #objref + Consumer = CosEventComm::PullConsumer + Reply = CosNotifyChannelAdmin::ProxyPullSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} + + +

If a default Channel have been set, this operation connects the given + PullConsumer to it. Otherwise, the + exception is raised.

+
+
+ + connect_push_supplier(EventDomain, Supplier) -> Reply + Connect the PushSupplier to the default Channel + + EventDomain = #objref + Supplier = CosEventComm::PushSupplier + Reply = CosNotifyChannelAdmin::ProxyPushConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} + + +

If a default Channel have been set, this operation connects the given + PushSupplier to it. Otherwise, the + exception is raised.

+
+
+ + connect_pull_supplier(EventDomain, Supplier) -> Reply + Connect the PullSupplier to the default Channel + + EventDomain = #objref + Supplier = CosEventComm::PullSupplier + Reply = CosNotifyChannelAdmin::ProxyPushConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} + + +

If a default Channel have been set, this operation connects the given + PullSupplier to it. Otherwise, the + exception is raised.

+
+
+ + connect_structured_push_consumer(EventDomain, Consumer) -> Reply + Connect the StructuredPushConsumer to the default Channel + + EventDomain = #objref + Consumer = CosNotifyComm::StructuredPushConsumer + Reply = CosNotifyChannelAdmin::StructuredProxyPushSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} + + +

If a default Channel have been set, this operation connects the given + StructuredPushConsumer to it. Otherwise, the + exception is raised.

+
+
+ + connect_structured_pull_consumer(EventDomain, Consumer) -> Reply + Connect the StructuredPullConsumer to the default Channel + + EventDomain = #objref + Consumer = CosNotifyComm::StructuredPullConsumer + Reply = CosNotifyChannelAdmin::StructuredProxyPullSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} + + +

If a default Channel have been set, this operation connects the given + StructuredPullConsumer to it. Otherwise, the + exception is raised.

+
+
+ + connect_structured_push_supplier(EventDomain, Supplier) -> Reply + Connect the StructuredPushSupplier to the default Channel + + EventDomain = #objref + Supplier = CosNotifyComm::StructuredPushSupplier + Reply = CosNotifyChannelAdmin::StructuredProxyPushConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} + + +

If a default Channel have been set, this operation connects the given + StructuredPushSupplier to it. Otherwise, the + exception is raised.

+
+
+ + connect_structured_pull_supplier(EventDomain, Supplier) -> Reply + Connect the StructuredPullSupplier to the default Channel + + EventDomain = #objref + Supplier = CosNotifyComm::StructuredPullSupplier + Reply = CosNotifyChannelAdmin::StructuredProxyPullConsume | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} + + +

If a default Channel have been set, this operation connects the given + StructuredPullSupplier to it. Otherwise, the + exception is raised.

+
+
+ + connect_sequence_push_consumer(EventDomain, Consumer) -> Reply + Connect the SequencePushConsumer to the default Channel + + EventDomain = #objref + Consumer = CosNotifyComm::SequencePushConsumer + Reply = CosNotifyChannelAdmin::SequenceProxyPushSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} + + +

If a default Channel have been set, this operation connects the given + SequencePushConsumer to it. Otherwise, the + exception is raised.

+
+
+ + connect_sequence_pull_consumer(EventDomain, Consumer) -> Reply + Connect the SequencePullConsumer to the default Channel + + EventDomain = #objref + Consumer = CosNotifyComm::SequencePullConsumer + Reply = CosNotifyChannelAdmin::SequenceProxyPullSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} + + +

If a default Channel have been set, this operation connects the given + SequencePullConsumer to it. Otherwise, the + exception is raised.

+
+
+ + connect_sequence_push_supplier(EventDomain, Supplier) -> Reply + Connect the SequencePushSupplier to the default Channel + + EventDomain = #objref + Supplier = CosNotifyComm::SequencePushSupplier + Reply = CosNotifyChannelAdmin::SequenceProxyPushConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} + + +

If a default Channel have been set, this operation connects the given + SequencePushSupplier to it. Otherwise, the + exception is raised.

+
+
+ + connect_sequence_pull_supplier(EventDomain, Supplier) -> Reply + Connect the SequencePullSupplier to the default Channel + + EventDomain = #objref + Supplier = CosNotifyComm::SequencePullSupplier + Reply = CosNotifyChannelAdmin::SequenceProxyPullConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} + + +

If a default Channel have been set, this operation connects the given + SequencePullSupplier to it. Otherwise, the + exception is raised.

+
+
+ + connect_push_consumer_with_id(EventDomain, Consumer, MemberID) -> Reply + Connect the PushConsumer to the Channel with the given MemberID + + EventDomain = #objref + Consumer = CosEventComm::PushConsumer + MemberID = long() + Reply = CosNotifyChannelAdmin::ProxyPushSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} + + +

If a Channel associated with the given MemberID exists within the + target Domain, this operation connects the given PushConsumer + to it. Otherwise, the + exception is raised.

+
+
+ + connect_pull_consumer_with_id(EventDomain, Consumer, MemberID) -> Reply + Connect the PullConsumer to the Channel with the given MemberID + + EventDomain = #objref + Consumer = CosEventComm::PullConsumer + MemberID = long() + Reply = CosNotifyChannelAdmin::ProxyPullSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} + + +

If a Channel associated with the given MemberID exists within the + target Domain, this operation connects the given PullConsumer + to it. Otherwise, the + exception is raised.

+
+
+ + connect_push_supplier_with_id(EventDomain, Supplier, MemberID) -> Reply + Connect the PushSupplier to the Channel with the given MemberID + + EventDomain = #objref + Supplier = CosEventComm::PushSupplier + MemberID = long() + Reply = CosNotifyChannelAdmin::ProxyPushConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} + + +

If a Channel associated with the given MemberID exists within the + target Domain, this operation connects the given PushSupplier + to it. Otherwise, the + exception is raised.

+
+
+ + connect_pull_supplier_with_id(EventDomain, Supplier, MemberID) -> Reply + Connect the PullSupplier to the Channel with the given MemberID + + EventDomain = #objref + Supplier = CosEventComm::PullSupplier + MemberID = long() + Reply = CosNotifyChannelAdmin::ProxyPushConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} + + +

If a Channel associated with the given MemberID exists within the + target Domain, this operation connects the given PullSupplier + to it. Otherwise, the + exception is raised.

+
+
+ + connect_structured_push_consumer_with_id(EventDomain, Consumer, MemberID) -> Reply + Connect the StructuredPushConsumer to the Channel with the given MemberID + + EventDomain = #objref + Consumer = CosNotifyComm::StructuredPushConsumer + MemberID = long() + Reply = CosNotifyChannelAdmin::StructuredProxyPushSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} + + +

If a Channel associated with the given MemberID exists within the + target Domain, this operation connects the given StructuredPushConsumer + to it. Otherwise, the + exception is raised.

+
+
+ + connect_structured_pull_consumer_with_id(EventDomain, Consumer, MemberID) -> Reply + Connect the StructuredPullConsumer to the Channel with the given MemberID + + EventDomain = #objref + Consumer = CosNotifyComm::StructuredPullConsumer + MemberID = long() + Reply = CosNotifyChannelAdmin::StructuredProxyPullSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} + + +

If a Channel associated with the given MemberID exists within the + target Domain, this operation connects the given StructuredPullConsumer + to it. Otherwise, the + exception is raised.

+
+
+ + connect_structured_push_supplier_with_id(EventDomain, Supplier, MemberID) -> Reply + Connect the StructuredPushSupplier to the Channel with the given MemberID + + EventDomain = #objref + Supplier = CosNotifyComm::StructuredPushSupplier + MemberID = long() + Reply = CosNotifyChannelAdmin::StructuredProxyPushConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} + + +

If a Channel associated with the given MemberID exists within the + target Domain, this operation connects the given StructuredPushSupplier + to it. Otherwise, the + exception is raised.

+
+
+ + connect_structured_pull_supplier_with_id(EventDomain, Supplier, MemberID) -> Reply + Connect the StructuredPullSupplier to the Channel with the given MemberID + + EventDomain = #objref + Supplier = CosNotifyComm::StructuredPullSupplier + MemberID = long() + Reply = CosNotifyChannelAdmin::StructuredProxyPullConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} + + +

If a Channel associated with the given MemberID exists within the + target Domain, this operation connects the given StructuredPullSupplier + to it. Otherwise, the + exception is raised.

+
+
+ + connect_sequence_push_consumer_with_id(EventDomain, Consumer, MemberID) -> Reply + Connect the SequencePushConsumer to the Channel with the given MemberID + + EventDomain = #objref + Consumer = CosNotifyComm::SequencePushConsumer + MemberID = long() + Reply = CosNotifyChannelAdmin::SequenceProxyPushSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} + + +

If a Channel associated with the given MemberID exists within the + target Domain, this operation connects the given SequencePushConsumer + to it. Otherwise, the + exception is raised.

+
+
+ + connect_sequence_pull_consumer_with_id(EventDomain, Consumer, MemberID) -> Reply + Connect the SequencePullConsumer to the Channel with the given MemberID + + EventDomain = #objref + Consumer = CosNotifyComm::SequencePullConsumer + MemberID = long() + Reply = CosNotifyChannelAdmin::SequenceProxyPullSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} + + +

If a Channel associated with the given MemberID exists within the + target Domain, this operation connects the given SequencePullConsumer + to it. Otherwise, the + exception is raised.

+
+
+ + connect_sequence_push_supplier_with_id(EventDomain, Supplier, MemberID) -> Reply + Connect the SequencePushSupplier to the Channel with the given MemberID + + EventDomain = #objref + Supplier = CosNotifyComm::SequencePushSupplier + MemberID = long() + Reply = CosNotifyChannelAdmin::SequenceProxyPushConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} + + +

If a Channel associated with the given MemberID exists within the + target Domain, this operation connects the given SequencePushSupplier + to it. Otherwise, the + exception is raised.

+
+
+ + connect_sequence_pull_supplier_with_id(EventDomain, Supplier, MemberID) -> Reply + Connect the SequencePullSupplier to the Channel with the given MemberID + + EventDomain = #objref + Supplier = CosNotifyComm::SequencePullSupplier + MemberID = long() + Reply = CosNotifyChannelAdmin::SequenceProxyPullConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} + + +

If a Channel associated with the given MemberID exists within the + target Domain, this operation connects the given SequencePullSupplier + to it. Otherwise, the + exception is raised.

+
+
+
+ +
+ diff --git a/lib/cosEventDomain/doc/src/CosEventDomainAdmin_EventDomainFactory.xml b/lib/cosEventDomain/doc/src/CosEventDomainAdmin_EventDomainFactory.xml new file mode 100644 index 0000000000..0720a4b930 --- /dev/null +++ b/lib/cosEventDomain/doc/src/CosEventDomainAdmin_EventDomainFactory.xml @@ -0,0 +1,88 @@ + + + + +
+ + 2001 + 2007 + Ericsson AB, 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. + + The Initial Developer of the Original Code is Ericsson AB. + + + CosEventDomainAdmin_­EventDomainFactory + ..._EventChannel + Niclas Eklund + Niclas Eklund + + Niclas Eklund + + 2001-08-20 + PA1 +
+ CosEventDomainAdmin_EventDomainFactory + This module implements an Event Domain Factory interface, which is used to create new Event Domain instances. + +

To get access to all definitions include necessary files by using:

+
+ + + create_event_domain(Factory, QoS, Admin) -> Reply + Create a new ConsumerAdmin object + + Factory = #objref + QoS = CosNotification::QoSProperties + Admin = CosNotification::AdminProperties + Reply = {EventDomain, DomainID} | {'EXCEPTION', #'CosNotification_UnsupportedQoS'{}} | {'EXCEPTION', #'CosNotification_UnsupportedAdmin'{}} + EventDomain = #objref + + +

To create a new EventDomain this operation is used. If it is not + possible to support the given or + an exception is raised, which list the properties not supported. For more + information see the user's guide.

+
+
+ + get_all_domains(Factory) -> DomainIDSeq + Return a DomainID sequence of all domains associated with the target object + + Factory = #objref + DomainIDSeq = [long()] + + +

This function returns a DomainID sequence of all domains associated with the + target object.

+
+
+ + get_event_domain(Factory, DomainID) -> Reply + Return the domain associated with the given id + + Factory = #objref + DomainID = long() + Reply = EventDomain | {'EXCEPTION', #'CosEventDomainAdmin_DomainNotFound'{}} + EventDomain = #objref + + +

This operation returns the EventDomain object associated with the + given DomainID. If no such binding exists an exception is raised.

+
+
+
+ +
+ diff --git a/lib/cosEventDomain/doc/src/Makefile b/lib/cosEventDomain/doc/src/Makefile new file mode 100644 index 0000000000..465b726ad1 --- /dev/null +++ b/lib/cosEventDomain/doc/src/Makefile @@ -0,0 +1,227 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2001-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% +# +# +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Application version +# ---------------------------------------------------- +include ../../vsn.mk +VSN=$(COSEVENTDOMAIN_VSN) +APPLICATION=cosEventDomain + +# ---------------------------------------------------- +# Include dependency +# ---------------------------------------------------- + +ifndef DOCSUPPORT +include make.dep +endif + +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/lib/$(APPLICATION)-$(VSN) + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- +XML_APPLICATION_FILES = ref_man.xml +XML_REF3_FILES = \ + CosEventDomainAdmin_EventDomainFactory.xml \ + CosEventDomainAdmin_EventDomain.xml \ + CosEventDomainAdmin.xml \ + cosEventDomainApp.xml + +XML_PART_FILES = \ + part.xml \ + part_notes.xml +XML_CHAPTER_FILES = \ + ch_contents.xml \ + ch_introduction.xml \ + ch_QoS.xml \ + ch_event_domain_service.xml \ + notes.xml + +BOOK_FILES = book.xml + +TECHNICAL_DESCR_FILES = + +GIF_FILES = \ + book.gif \ + notes.gif \ + ref_man.gif \ + user_guide.gif + + +PS_FILES = + + +# ---------------------------------------------------- + +INTERNAL_HTML_FILES = $(TECHNICAL_DESCR_FILES:%.xml=$(HTMLDIR)/%.html) + +HTML_FILES = $(XML_APPLICATION_FILES:%.xml=$(HTMLDIR)/%.html) \ + $(XML_PART_FILES:%.xml=$(HTMLDIR)/%.html) + +INFO_FILE = ../../info +EXTRA_FILES = summary.html.src \ + $(DEFAULT_GIF_FILES) \ + $(DEFAULT_HTML_FILES) \ + $(XML_REF3_FILES:%.xml=$(HTMLDIR)/%.html) \ + $(XML_CHAPTER_FILES:%.xml=$(HTMLDIR)/%.html) + +MAN3_FILES = $(XML_REF3_FILES:%.xml=$(MAN3DIR)/%.3) + +ifdef DOCSUPPORT + +HTML_REF_MAN_FILE = $(HTMLDIR)/index.html + +TOP_PDF_FILE = $(PDFDIR)/$(APPLICATION)-$(VSN).pdf + +else + +TEX_FILES_BOOK = \ + $(BOOK_FILES:%.xml=%.tex) +TEX_FILES_REF_MAN = $(XML_REF3_FILES:%.xml=%.tex) \ + $(XML_APPLICATION_FILES:%.xml=%.tex) +TEX_FILES_USERS_GUIDE = \ + $(XML_CHAPTER_FILES:%.xml=%.tex) + +TOP_PDF_FILE = $(APPLICATION)-$(VSN).pdf + +TOP_PS_FILE = $(APPLICATION)-$(VSN).ps + +$(TOP_PDF_FILE): book.dvi ../../vsn.mk + $(DVI2PS) $(DVIPS_FLAGS) -f $< | $(DISTILL) $(DISTILL_FLAGS) > $@ + +$(TOP_PS_FILE): book.dvi ../../vsn.mk + $(DVI2PS) $(DVIPS_FLAGS) -f $< > $@ + +endif + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- +XML_FLAGS += +DVIPS_FLAGS += + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- +$(HTMLDIR)/%.gif: %.gif + $(INSTALL_DATA) $< $@ + +ifdef DOCSUPPORT + +docs: pdf html man + +$(TOP_PDF_FILE): $(XML_FILES) + +pdf: $(TOP_PDF_FILE) + +html: gifs $(HTML_REF_MAN_FILE) + +clean clean_docs: + rm -rf $(HTMLDIR)/* + rm -f $(MAN3DIR)/* + rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo) + rm -f errs core *~ + rm -f $(JD_HTML) $(JD_PACK) + +else + +ifeq ($(DOCTYPE),pdf) +docs: pdf +else +ifeq ($(DOCTYPE),ps) +docs: ps +else +docs: html gifs man +endif +endif + +pdf: $(TOP_PDF_FILE) + +ps: $(TOP_PS_FILE) + +html: $(HTML_FILES) $(INTERNAL_HTML_FILES) + +clean clean_docs clean_tex: + rm -f $(TEX_FILES_USERS_GUIDE) $(TEX_FILES_REF_MAN) $(TEX_FILES_BOOK) + rm -f $(HTML_FILES) $(MAN3_FILES) + rm -f $(TOP_PDF_FILE) $(TOP_PS_FILE) + rm -f errs core *~ *xmls_output *xmls_errs $(LATEX_CLEAN) + +endif + +man: $(MAN3_FILES) + +gifs: $(GIF_FILES:%=$(HTMLDIR)/%) + +$(INDEX_TARGET): $(INDEX_SRC) + sed -e 's;%VSN%;$(VSN);' $(INDEX_SRC) > $(INDEX_TARGET) + +debug opt: + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + + +ifdef DOCSUPPORT + +release_docs_spec: docs + $(INSTALL_DIR) $(RELSYSDIR)/doc/pdf + $(INSTALL_DATA) $(TOP_PDF_FILE) $(RELSYSDIR)/doc/pdf + $(INSTALL_DIR) $(RELSYSDIR)/doc/html + $(INSTALL_DATA) $(HTMLDIR)/* \ + $(RELSYSDIR)/doc/html + $(INSTALL_DATA) $(INFO_FILE) $(RELSYSDIR) + $(INSTALL_DIR) $(RELEASE_PATH)/man/man3 + $(INSTALL_DATA) $(MAN3DIR)/* $(RELEASE_PATH)/man/man3 +else + +ifeq ($(DOCTYPE),pdf) +release_docs_spec: pdf + $(INSTALL_DIR) $(RELEASE_PATH)/pdf + $(INSTALL_DATA) $(TOP_PDF_FILE) $(RELEASE_PATH)/pdf +else +ifeq ($(DOCTYPE),ps) +release_docs_spec: ps + $(INSTALL_DIR) $(RELEASE_PATH)/ps + $(INSTALL_DATA) $(TOP_PS_FILE) $(RELEASE_PATH)/ps +else +release_docs_spec: docs + $(INSTALL_DIR) $(RELSYSDIR)/doc/html + $(INSTALL_DATA) $(GIF_FILES) $(EXTRA_FILES) $(HTML_FILES) \ + $(RELSYSDIR)/doc/html + $(INSTALL_DATA) $(INFO_FILE) $(RELSYSDIR) + $(INSTALL_DIR) $(RELEASE_PATH)/man/man3 + $(INSTALL_DATA) $(MAN3_FILES) $(RELEASE_PATH)/man/man3 + +endif +endif + +endif + +release_spec: + diff --git a/lib/cosEventDomain/doc/src/book.gif b/lib/cosEventDomain/doc/src/book.gif new file mode 100644 index 0000000000..94b3868792 Binary files /dev/null and b/lib/cosEventDomain/doc/src/book.gif differ diff --git a/lib/cosEventDomain/doc/src/book.xml b/lib/cosEventDomain/doc/src/book.xml new file mode 100644 index 0000000000..3a36704355 --- /dev/null +++ b/lib/cosEventDomain/doc/src/book.xml @@ -0,0 +1,48 @@ + + + + +
+ + 20012009 + Ericsson AB. 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. + + + + cosEventDomain + Niclas Eklund + + 2001-08-20 + 1.0 +
+ + + cosEventDomain + + + + + + + + + + + + + + +
+ diff --git a/lib/cosEventDomain/doc/src/ch_QoS.xml b/lib/cosEventDomain/doc/src/ch_QoS.xml new file mode 100644 index 0000000000..232cc4021a --- /dev/null +++ b/lib/cosEventDomain/doc/src/ch_QoS.xml @@ -0,0 +1,117 @@ + + + + +
+ + 20022009 + Ericsson AB. 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. + + + + Quality Of Service and Admin Properties + + + 2000-05-29 + + ch_QoS.xml +
+ +
+ Quality Of Service and Admin Properties +

This chapter explains the allowed properties it is possible to set for this + application.

+ +
+ Quality Of Service +

The cosEventDomain application supports the following QoS settings:

+ + + QoS + Range + Default + + + CycleDetection + AuthorizeCycles/ForbidCycles + ForbidCycles + + + DiamondDetection + AuthorizeDiamonds/ForbidDiamonds + ForbidDiamonds + + Supported QoS settings +
+







Comments on the table 'Supported QoS Settings':

+ + CycleDetection + If a cycle is created, the user must be aware of the fact + that unless they set timeout on events, events that are not filtered + will loop endlessly through the topology. + DiamondDetection + A Diamond in this context, means that the same + event may reach a point in the graph by more than one route + (i.e. transitive). Hence, it is possible that multiple copies + are delivered. + +
+ +
+ Setting Quality Of Service +

Assume we have a Consumer Admin object which we want to change + the current Quality of Service. Typical usage:

+ +

If it is not possible to set the requested QoS the + exception is raised, which includes a sequence of 's + describing which QoS, possible range and why is not allowed. The error + codes are:

+ + UNSUPPORTED_PROPERTY - QoS not supported for this type of target object. + UNAVAILABLE_PROPERTY - due to current QoS settings the given property + is not allowed. + UNSUPPORTED_VALUE - property value out of range; valid range is returned. + UNAVAILABLE_VALUE - due to current QoS settings the given value is + not allowed; valid range is returned. + BAD_PROPERTY - unrecognized property. + BAD_TYPE - type of supplied property is incorrect. + BAD_VALUE - illegal value. + +

The CosEventDomainAdmin_EventDomain interface also supports an operation + called . The purpose of this operations is to check + if a QoS setting is supported by the target object and if so, the operation + returns additional properties which could be optionally added as well.

+
+ +
+ Admin Properties +

The OMG specification do not contain any definitions of Admin Properties. + Hence, the cosEventDomain application currently does not support any Admin + Properties.

+
+
+
+ diff --git a/lib/cosEventDomain/doc/src/ch_contents.xml b/lib/cosEventDomain/doc/src/ch_contents.xml new file mode 100644 index 0000000000..bdb951566f --- /dev/null +++ b/lib/cosEventDomain/doc/src/ch_contents.xml @@ -0,0 +1,68 @@ + + + + +
+ + 20012009 + Ericsson AB. 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. + + + + The cosEventDomain Application + Niclas Eklund + + 2001-08-20 + B + ch_contents.xml +
+ +
+ Content Overview +

The cosEventDomain documentation is divided into three sections: +

+ + +

PART ONE - The User's Guide +

Description of the cosEventDomain Application including + services and a small tutorial demonstrating + the development of a simple service.

+
+ +

PART TWO - Release Notes +

A concise history of cosEventDomain.

+
+ +

PART THREE - The Reference Manual +

A quick reference guide, including a + brief description, to all the functions available in cosEventDomain.

+
+
+
+ +
+ Brief Description of the User's Guide +

The User's Guide contains the following parts:

+ + +

CosEventDomain overview

+
+ +

CosEventDomain installation and examples

+
+
+
+
+ diff --git a/lib/cosEventDomain/doc/src/ch_event_domain_service.xml b/lib/cosEventDomain/doc/src/ch_event_domain_service.xml new file mode 100644 index 0000000000..62378cac91 --- /dev/null +++ b/lib/cosEventDomain/doc/src/ch_event_domain_service.xml @@ -0,0 +1,110 @@ + + + + +
+ + 20012009 + Ericsson AB. 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. + + + + Event Domain Service + Niclas Eklund + + 2001-08-20 + A + ch_event_domain_service.xml +
+ +
+ Overview of the CosEventDomain Service +

The Event Domain service allows programmers to manage a cluster + of information channels.

+ +
+ Event Domain Service Components +

There are two components in the OMG CosEventDomainAdmin service architecture:

+ + EventDomainFactory: a factory for creating EventDomains. + EventDomain: supplies a tool, which makes it easy to create + topologies of interconnected channels (i.e. a directed graph). + +
+ +
+ A Tutorial on How to Create a Simple Service +

To be able to use the cosEventDomain application, the cosNotification + and, possibly, the cosTime application must be installed.

+
+ +
+ How to Run Everything +

Below is a short transcript on how to run cosEventDomain.

+ +
+
+
+ diff --git a/lib/cosEventDomain/doc/src/ch_introduction.xml b/lib/cosEventDomain/doc/src/ch_introduction.xml new file mode 100644 index 0000000000..8a85fc052f --- /dev/null +++ b/lib/cosEventDomain/doc/src/ch_introduction.xml @@ -0,0 +1,52 @@ + + + + +
+ + 20012009 + Ericsson AB. 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. + + + + Introduction to cosEventDomain + Niclas Eklund + + 2001-08-20 + + ch_introduction.xml +
+ +
+ Overview +

The cosEventDomain application is a Event Domain Service compliant with the OMG + Service CosEventDomainAdmin. +

+ +
+ Purpose and Dependencies +

CosEventDomain is dependent on Orber, which provides CORBA functionality in an Erlang environment.

+
+ +
+ Prerequisites +

To fully understand the concepts presented in the + documentation, it is recommended that the user is familiar + with distributed programming and CORBA. +

+
+
+
+ diff --git a/lib/cosEventDomain/doc/src/cosEventDomainApp.xml b/lib/cosEventDomain/doc/src/cosEventDomainApp.xml new file mode 100644 index 0000000000..fe8df55929 --- /dev/null +++ b/lib/cosEventDomain/doc/src/cosEventDomainApp.xml @@ -0,0 +1,149 @@ + + + + +
+ + 2001 + 2007 + Ericsson AB, 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. + + The Initial Developer of the Original Code is Ericsson AB. + + + cosEventDomainApp + Niclas Eklund + Niclas Eklund + + Niclas Eklund + + 2001-08-20 + PA1 +
+ cosEventDomainApp + The main module of the cosEventDomain application. + +

To get access to the record definitions for the structures use:

+

This module contains the functions for starting and stopping the application.

+
+ + + install() -> Return + Install the cosEventDomain application + + Return = ok | {'EXCEPTION', E} | {'EXIT', R} + + +

This operation installs the cosEventDomain application.

+
+
+ + uninstall() -> Return + Uninstall the cosEventDomain application + + Return = ok | {'EXCEPTION', E} | {'EXIT', R} + + +

This operation uninstalls the cosEventDomain application.

+
+
+ + start() -> Return + Start the cosEventDomain application + + Return = ok | {error, Reason} + + +

This operation starts the cosEventDomain application.

+
+
+ + stop() -> Return + Stop the cosEventDomain application + + Return = ok | {error, Reason} + + +

This operation stops the cosEventDomain application.

+
+
+ + start_factory() -> Factory + Start a factory with default settings + + Factory = #objref + + +

This operation creates a new instance of a + Event Domain Factory + using the default settings.

+
+
+ + start_factory(Options) -> Factory + Start a factory with settings defined by the given options + + Options = [Option] + Option = currently no options defined. + Factory = #objref + + +

This operation creates a new instance of a + Event Domain Factory

+
+
+ + start_factory_link() -> Factory + Start a factory, which is linked to the invoking process, with default settings + + Factory = #objref + + +

This operation creates a new instance of a + Event Domain Factory, + which is linked to the invoking process, using the default settings.

+
+
+ + start_factory_link(Options) -> Factory + Start a factory, which is linked to the invoking process, with settings defined by the given options + + Options = [Option] + Option = currently no options defined. + Factory = #objref + + +

This operation creates a new instance of a + Event Domain Factory, + which is linked to the invoking process, with settings defined by the + given options. Allowed options are the same as for + .

+
+
+ + stop_factory(Factory) -> Reply + Terminate the target object + + Factory = #objref + Reply = ok | {'EXCEPTION', E} + + +

This operation stop the target factory.

+
+
+
+ +
+ diff --git a/lib/cosEventDomain/doc/src/fascicules.xml b/lib/cosEventDomain/doc/src/fascicules.xml new file mode 100644 index 0000000000..0678195e07 --- /dev/null +++ b/lib/cosEventDomain/doc/src/fascicules.xml @@ -0,0 +1,18 @@ + + + + + + User's Guide + + + Reference Manual + + + Release Notes + + + Off-Print + + + diff --git a/lib/cosEventDomain/doc/src/make.dep b/lib/cosEventDomain/doc/src/make.dep new file mode 100644 index 0000000000..2f3f1ae53d --- /dev/null +++ b/lib/cosEventDomain/doc/src/make.dep @@ -0,0 +1,23 @@ +# ---------------------------------------------------- +# >>>> Do not edit this file <<<< +# This file was automaticly generated by +# /home/otp/bin/docdepend +# ---------------------------------------------------- + + +# ---------------------------------------------------- +# TeX files that the DVI file depend on +# ---------------------------------------------------- + +book.dvi: CosEventDomainAdmin.tex CosEventDomainAdmin_EventDomain.tex \ + CosEventDomainAdmin_EventDomainFactory.tex \ + book.tex ch_QoS.tex ch_contents.tex ch_event_domain_service.tex \ + ch_introduction.tex cosEventDomainApp.tex \ + part.tex ref_man.tex + +# ---------------------------------------------------- +# Source inlined when transforming from source to LaTeX +# ---------------------------------------------------- + +book.tex: ref_man.xml + diff --git a/lib/cosEventDomain/doc/src/notes.gif b/lib/cosEventDomain/doc/src/notes.gif new file mode 100644 index 0000000000..e000cca26a Binary files /dev/null and b/lib/cosEventDomain/doc/src/notes.gif differ diff --git a/lib/cosEventDomain/doc/src/notes.xml b/lib/cosEventDomain/doc/src/notes.xml new file mode 100644 index 0000000000..fdfb21c046 --- /dev/null +++ b/lib/cosEventDomain/doc/src/notes.xml @@ -0,0 +1,168 @@ + + + + +
+ + 20012009 + Ericsson AB. 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. + + + + cosEventDomain Release Notes + Niclas Eklund + + + + 2001-08-20 + A + notes.xml +
+ +
+ cosEventDomain 1.1.7 + +
+ Improvements and New Features + + +

+ The documentation is now built with open source tools (xsltproc and fop) + that exists on most platforms. One visible change is that the frames are removed.

+

+ Own Id: OTP-8201 Aux Id:

+
+
+
+
+ +
+ cosEventDomain 1.1.6 + +
+ Improvements and New Features + + +

Obsolete guards, e.g. record vs is_record, has been changed + to avoid compiler warnings.

+

Own id: OTP-7987

+
+
+
+
+ +
+ cosEventDomain 1.1.5 + +
+ Improvements and New Features + + +

Updated file headers.

+

Own id: OTP-7837

+
+
+
+
+ +
+ cosEventDomain 1.1.4 + +
+ Improvements and New Features + + +

Documentation source included in open source releases.

+

Own id: OTP-7595

+
+
+
+
+ +
+ cosEventDomain 1.1.3 + +
+ Improvements and New Features + + +

Updated file headers.

+

Own id: OTP-7011

+
+
+
+
+ +
+ cosEventDomain 1.1.2 + +
+ Improvements and New Features + + +

The documentation source has been converted from SGML to XML.

+

Own id: OTP-6754

+
+
+
+
+ +
+ cosEventDomain 1.1.1 + +
+ Improvements and New Features + + +

Minor Makefile changes.

+

Own id: OTP-6701

+
+
+
+
+ +
+ cosEventDomain 1.1 + +
+ Improvements and New Features + + +

The stub/skeleton-files generated by IC have been improved, + i.e., depending on the IDL-files, reduced the size of the + erl- and beam-files and decreased dependencies off Orber's + Interface Repository. It is necessary to re-compile all IDL-files + and use COS-applications, including Orber, compiled with + IC-4.2.

+

Own id: OTP-4576

+
+
+
+
+ +
+ cosEventDomain 1.0 + +
+ Improvements and New Features + + +

First release of the cosEventDomain application.

+
+
+
+
+
+ diff --git a/lib/cosEventDomain/doc/src/part.xml b/lib/cosEventDomain/doc/src/part.xml new file mode 100644 index 0000000000..720a4d3feb --- /dev/null +++ b/lib/cosEventDomain/doc/src/part.xml @@ -0,0 +1,39 @@ + + + + +
+ + 20012009 + Ericsson AB. 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. + + + + cosEventDomain User's Guide + Niclas Eklund + + 2001-08-20 + 1.0 +
+ +

The cosEventDomain application is an Erlang implementation of a + CORBA Service CosEventDomainAdmin.

+
+ + + + +
+ diff --git a/lib/cosEventDomain/doc/src/part_notes.xml b/lib/cosEventDomain/doc/src/part_notes.xml new file mode 100644 index 0000000000..0979d6e491 --- /dev/null +++ b/lib/cosEventDomain/doc/src/part_notes.xml @@ -0,0 +1,36 @@ + + + + +
+ + 20012009 + Ericsson AB. 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. + + + + cosEventDomain Release Notes + Niclas Eklund + + 2001-08-20 + 1.0 +
+ +

The cosEventDomain Application is an Erlang implementation of a CORBA Service + CosEventDomainAdmin.

+
+ +
+ diff --git a/lib/cosEventDomain/doc/src/ref_man.gif b/lib/cosEventDomain/doc/src/ref_man.gif new file mode 100644 index 0000000000..b13c4efd53 Binary files /dev/null and b/lib/cosEventDomain/doc/src/ref_man.gif differ diff --git a/lib/cosEventDomain/doc/src/ref_man.xml b/lib/cosEventDomain/doc/src/ref_man.xml new file mode 100644 index 0000000000..ddb836e1d6 --- /dev/null +++ b/lib/cosEventDomain/doc/src/ref_man.xml @@ -0,0 +1,39 @@ + + + + +
+ + 20012009 + Ericsson AB. 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. + + + + cosEventDomain Reference Manual + Niclas Eklund + + 2001-08-20 + 1.0 +
+ +

The cosEventDomain application is an Erlang implementation of + a CORBA Service CosEventDomainAdmin.

+
+ + + + +
+ diff --git a/lib/cosEventDomain/doc/src/summary.html.src b/lib/cosEventDomain/doc/src/summary.html.src new file mode 100644 index 0000000000..922c956633 --- /dev/null +++ b/lib/cosEventDomain/doc/src/summary.html.src @@ -0,0 +1 @@ +Orber OMG Event Domain Service \ No newline at end of file diff --git a/lib/cosEventDomain/doc/src/user_guide.gif b/lib/cosEventDomain/doc/src/user_guide.gif new file mode 100644 index 0000000000..e6275a803d Binary files /dev/null and b/lib/cosEventDomain/doc/src/user_guide.gif differ diff --git a/lib/cosEventDomain/ebin/.gitignore b/lib/cosEventDomain/ebin/.gitignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lib/cosEventDomain/example/.gitignore b/lib/cosEventDomain/example/.gitignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lib/cosEventDomain/include/.gitignore b/lib/cosEventDomain/include/.gitignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lib/cosEventDomain/info b/lib/cosEventDomain/info new file mode 100644 index 0000000000..46ecf9504d --- /dev/null +++ b/lib/cosEventDomain/info @@ -0,0 +1,2 @@ +group: orb +short: Orber OMG Event Domain Service diff --git a/lib/cosEventDomain/src/CosEventDomainAdmin.cfg b/lib/cosEventDomain/src/CosEventDomainAdmin.cfg new file mode 100644 index 0000000000..75a2720088 --- /dev/null +++ b/lib/cosEventDomain/src/CosEventDomainAdmin.cfg @@ -0,0 +1,4 @@ +{this, "CosEventDomainAdmin::EventDomain"}. +{{handle_info, "CosEventDomainAdmin::EventDomain"}, true}. +{this, "CosEventDomainAdmin::EventDomainFactory"}. +{{handle_info, "CosEventDomainAdmin::EventDomainFactory"}, true}. diff --git a/lib/cosEventDomain/src/CosEventDomainAdmin.idl b/lib/cosEventDomain/src/CosEventDomainAdmin.idl new file mode 100644 index 0000000000..2ecd935c67 --- /dev/null +++ b/lib/cosEventDomain/src/CosEventDomainAdmin.idl @@ -0,0 +1,280 @@ +#ifndef _COS_EVENT_DOMAIN_ADMIN_IDL_ +#define _COS_EVENT_DOMAIN_ADMIN_IDL_ + +#pragma prefix "omg.org" + +// Event Domain Interface +#include "CosNotification.idl" +#include "CosEventComm.idl" +#include "CosNotifyComm.idl" +#include "CosNotifyChannelAdmin.idl" + + +module CosEventDomainAdmin { + + // The following constant declarations define the Event Domain + // QoS property names and the associated values each property can + // take on. The name/value pairs for each Event Domain property + // are grouped, beginning with a string constant defined for the + // property name, followed by the values the property can take on. + + const string CycleDetection = "CycleDetection"; + const short AuthorizeCycles = 0; // Default value + const short ForbidCycles = 1; + + const string DiamondDetection = "DiamondDetection"; + const short AuthorizeDiamonds = 0; // Default value + const short ForbidDiamonds = 1; + + + // The following enum declaration defines the types that a channel + // can be of. It is used to specify channel types while externalizing + // and instantiating topologies. + enum ChannelType + { + CHANNEL, + TYPED_CHANNEL, + LOG_CHANNEL, + TYPED_LOG_CHANNEL + }; + + enum NotificationStyle { + Push, + Pull + }; + + typedef long MemberID; + typedef sequence MemberIDSeq; + typedef long ConnectionID; + typedef sequence ConnectionIDSeq; + + struct Connection { + MemberID supplier_id; + MemberID consumer_id; + CosNotifyChannelAdmin::ClientType ctype; + NotificationStyle notification_style; + }; + + + typedef MemberIDSeq Route; + typedef sequence RouteSeq; + + typedef Route Cycle; + typedef sequence CycleSeq; + + typedef RouteSeq Diamond; + typedef sequence DiamondSeq; + + exception CycleCreationForbidden + { + Cycle cyc; + }; + + exception DiamondCreationForbidden + { + Diamond diam; + }; + + // Forward declarations + interface ConsumerAdmin; + interface SupplierAdmin; + + + typedef long DomainID; + typedef sequence DomainIDSeq; + typedef long ItemID; + + + // EventDomain administrates EventChannels that reside in the same + // administrative domain + exception ConnectionNotFound {}; + exception AlreadyExists {}; + + + interface EventDomain : + CosNotification::QoSAdmin , + CosNotification::AdminPropertiesAdmin { + + MemberID add_channel ( in CosNotifyChannelAdmin::EventChannel channel ); + + MemberIDSeq get_all_channels (); + + CosNotifyChannelAdmin::EventChannel get_channel ( in MemberID channel ) + raises ( CosNotifyChannelAdmin::ChannelNotFound ); + + void remove_channel ( in MemberID channel) + raises (CosNotifyChannelAdmin::ChannelNotFound); + + ConnectionID add_connection ( in Connection connection) + raises (CosNotifyChannelAdmin::ChannelNotFound, + CosEventChannelAdmin::TypeError, + AlreadyExists, + CycleCreationForbidden, + DiamondCreationForbidden); + + ConnectionIDSeq get_all_connections (); + + Connection get_connection ( in ConnectionID connection ) + raises ( ConnectionNotFound ); + + void remove_connection ( in ConnectionID connection ) + raises ( ConnectionNotFound ); + + CosNotifyChannelAdmin::ChannelIDSeq get_offer_channels ( in MemberID channel ) + raises ( CosNotifyChannelAdmin::ChannelNotFound ); + + CosNotifyChannelAdmin::ChannelIDSeq get_subscription_channels ( in MemberID channel ) + raises ( CosNotifyChannelAdmin::ChannelNotFound ); + + void destroy(); + + // Cycle and diamond configurations listing + CycleSeq get_cycles(); + + DiamondSeq get_diamonds(); + + + // Connection of clients to the domain + // - using no specific information + // - for any clients + void set_default_consumer_channel(in MemberID channel) + raises (CosNotifyChannelAdmin::ChannelNotFound); + + void set_default_supplier_channel(in MemberID channel) + raises (CosNotifyChannelAdmin::ChannelNotFound); + + CosNotifyChannelAdmin::ProxyPushSupplier + connect_push_consumer(in CosEventComm::PushConsumer client) + raises (CosNotifyChannelAdmin::ChannelNotFound); + + CosNotifyChannelAdmin::ProxyPullSupplier + connect_pull_consumer(in CosEventComm::PullConsumer client) + raises (CosNotifyChannelAdmin::ChannelNotFound); + + CosNotifyChannelAdmin::ProxyPushConsumer + connect_push_supplier(in CosEventComm::PushSupplier client) + raises (CosNotifyChannelAdmin::ChannelNotFound); + + CosNotifyChannelAdmin::ProxyPullConsumer + connect_pull_supplier(in CosEventComm::PullSupplier client) + raises (CosNotifyChannelAdmin::ChannelNotFound); + + // - for structured clients + CosNotifyChannelAdmin::StructuredProxyPushSupplier + connect_structured_push_consumer(in CosNotifyComm::StructuredPushConsumer client) + raises (CosNotifyChannelAdmin::ChannelNotFound); + + CosNotifyChannelAdmin::StructuredProxyPullSupplier + connect_structured_pull_consumer(in CosNotifyComm::StructuredPullConsumer client) + raises (CosNotifyChannelAdmin::ChannelNotFound); + + CosNotifyChannelAdmin::StructuredProxyPushConsumer + connect_structured_push_supplier(in CosNotifyComm::StructuredPushSupplier client) + raises (CosNotifyChannelAdmin::ChannelNotFound); + + CosNotifyChannelAdmin::StructuredProxyPullConsumer + connect_structured_pull_supplier(in CosNotifyComm::StructuredPullSupplier client) + raises (CosNotifyChannelAdmin::ChannelNotFound); + + // - for sequence clients + CosNotifyChannelAdmin::SequenceProxyPushSupplier + connect_sequence_push_consumer(in CosNotifyComm::SequencePushConsumer client) + raises (CosNotifyChannelAdmin::ChannelNotFound); + + CosNotifyChannelAdmin::SequenceProxyPullSupplier + connect_sequence_pull_consumer(in CosNotifyComm::SequencePullConsumer client) + raises (CosNotifyChannelAdmin::ChannelNotFound); + + CosNotifyChannelAdmin::SequenceProxyPushConsumer + connect_sequence_push_supplier(in CosNotifyComm::SequencePushSupplier client) + raises (CosNotifyChannelAdmin::ChannelNotFound); + + CosNotifyChannelAdmin::SequenceProxyPullConsumer + connect_sequence_pull_supplier(in CosNotifyComm::SequencePullSupplier client) + raises (CosNotifyChannelAdmin::ChannelNotFound); + + // - using a channel id + // - for any clients + CosNotifyChannelAdmin::ProxyPushSupplier + connect_push_consumer_with_id(in CosEventComm::PushConsumer client, + in MemberID channel) + raises (CosNotifyChannelAdmin::ChannelNotFound); + + CosNotifyChannelAdmin::ProxyPullSupplier + connect_pull_consumer_with_id(in CosEventComm::PullConsumer client, + in MemberID channel) + raises (CosNotifyChannelAdmin::ChannelNotFound); + + CosNotifyChannelAdmin::ProxyPushConsumer + connect_push_supplier_with_id(in CosEventComm::PushSupplier client, + in MemberID channel) + raises (CosNotifyChannelAdmin::ChannelNotFound); + + CosNotifyChannelAdmin::ProxyPullConsumer + connect_pull_supplier_with_id(in CosEventComm::PullSupplier client, + in MemberID channel) + raises (CosNotifyChannelAdmin::ChannelNotFound); + + // - for structured clients + CosNotifyChannelAdmin::StructuredProxyPushSupplier + connect_structured_push_consumer_with_id(in CosNotifyComm::StructuredPushConsumer client, + in MemberID channel) + raises (CosNotifyChannelAdmin::ChannelNotFound); + + CosNotifyChannelAdmin::StructuredProxyPullSupplier + connect_structured_pull_consumer_with_id(in CosNotifyComm::StructuredPullConsumer client, + in MemberID channel) + raises (CosNotifyChannelAdmin::ChannelNotFound); + + CosNotifyChannelAdmin::StructuredProxyPushConsumer + connect_structured_push_supplier_with_id(in CosNotifyComm::StructuredPushSupplier client, + in MemberID channel) + raises (CosNotifyChannelAdmin::ChannelNotFound); + + CosNotifyChannelAdmin::StructuredProxyPullConsumer + connect_structured_pull_supplier_with_id(in CosNotifyComm::StructuredPullSupplier client, + in MemberID channel) + raises (CosNotifyChannelAdmin::ChannelNotFound); + + // - for sequence clients + CosNotifyChannelAdmin::SequenceProxyPushSupplier + connect_sequence_push_consumer_with_id(in CosNotifyComm::SequencePushConsumer client, + in MemberID channel) + raises (CosNotifyChannelAdmin::ChannelNotFound); + + CosNotifyChannelAdmin::SequenceProxyPullSupplier + connect_sequence_pull_consumer_with_id(in CosNotifyComm::SequencePullConsumer client, + in MemberID channel) + raises (CosNotifyChannelAdmin::ChannelNotFound); + + CosNotifyChannelAdmin::SequenceProxyPushConsumer + connect_sequence_push_supplier_with_id(in CosNotifyComm::SequencePushSupplier client, + in MemberID channel) + raises (CosNotifyChannelAdmin::ChannelNotFound); + + CosNotifyChannelAdmin::SequenceProxyPullConsumer + connect_sequence_pull_supplier_with_id(in CosNotifyComm::SequencePullSupplier client, + in MemberID channel) + raises (CosNotifyChannelAdmin::ChannelNotFound); + }; + + exception DomainNotFound {}; + + interface EventDomainFactory { + + EventDomain create_event_domain( in CosNotification::QoSProperties initialQoS , + in CosNotification::AdminProperties initialAdmin, + out DomainID id ) + raises ( CosNotification::UnsupportedQoS, + CosNotification::UnsupportedAdmin ); + + DomainIDSeq get_all_domains (); + + EventDomain get_event_domain ( + in DomainID id ) + raises ( DomainNotFound ); + }; +}; + +#endif // _COS_EVENT_DOMAIN_ADMIN_IDL_ + diff --git a/lib/cosEventDomain/src/CosEventDomainAdmin_EventDomainFactory_impl.erl b/lib/cosEventDomain/src/CosEventDomainAdmin_EventDomainFactory_impl.erl new file mode 100644 index 0000000000..1729402026 --- /dev/null +++ b/lib/cosEventDomain/src/CosEventDomainAdmin_EventDomainFactory_impl.erl @@ -0,0 +1,182 @@ +%%-------------------------------------------------------------------- +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2001-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 : CosEventDomainAdmin_EventDomainFactory_impl.erl +%% Description : +%% +%%---------------------------------------------------------------------- +-module('CosEventDomainAdmin_EventDomainFactory_impl'). + +%%---------------------------------------------------------------------- +%% Include files +%%---------------------------------------------------------------------- +-include_lib("orber/include/corba.hrl"). +-include_lib("orber/include/ifr_types.hrl"). +-include_lib("cosNotification/include/CosNotification.hrl"). + +-include("CosEventDomainAdmin.hrl"). +-include("cosEventDomainApp.hrl"). + +%%---------------------------------------------------------------------- +%% External exports +%%---------------------------------------------------------------------- +-export([init/1, + terminate/2, + code_change/3, + handle_info/2]). + +-export([create_event_domain/4, + get_all_domains/2, + get_event_domain/3]). + +%%---------------------------------------------------------------------- +%% Internal exports +%%---------------------------------------------------------------------- +-export([]). + +%%---------------------------------------------------------------------- +%% Records +%%---------------------------------------------------------------------- +-record(state, {current_id = -1, domains = []}). + +%%---------------------------------------------------------------------- +%% Macros +%%---------------------------------------------------------------------- + +%%====================================================================== +%% External functions +%%====================================================================== +%%---------------------------------------------------------------------- +%% Function : init/1 +%% Returns : {ok, State} | +%% {ok, State, Timeout} | +%% ignore | +%% {stop, Reason} +%% Description: Initiates the server +%%---------------------------------------------------------------------- +init([]) -> + process_flag(trap_exit, true), + {ok, #state{}}. + +%%---------------------------------------------------------------------- +%% Function : terminate/2 +%% Returns : any (ignored by gen_server) +%% Description: Shutdown the server +%%---------------------------------------------------------------------- +terminate(_Reason, _State) -> + 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/2 +%% Returns : {noreply, State} | +%% {stop, Reason, State} +%% Description: Handle, for example, exit signals. +%%---------------------------------------------------------------------- +handle_info({'EXIT', Pid, _Reason}, State) -> + {noreply, State#state{domains=delete_domain(State#state.domains, Pid, [])}}; +handle_info(_Info, State) -> + {noreply, State}. + + +%%---------------------------------------------------------------------- +%% Function : create_event_domain +%% Arguments : InitialQoS - CosNotification::QoSProperties +%% InitialAdmin - CosNotification::AdminProperties +%% Returns : CosEventDomainAdmin::EventDomain | +%% {'EXCEPTION', #'CosNotification_UnsupportedQoS'{}} | +%% {'EXCEPTION', #'CosNotification_UnsupportedAdmin'{}} | +%% Description: +%%---------------------------------------------------------------------- +create_event_domain(_OE_This, State, InitialQoS, InitialAdmin) -> + Id = cosEventDomainApp:create_id(State#state.current_id), + Admin = cosEventDomainApp:get_admin(InitialAdmin), + QoS = cosEventDomainApp:get_qos(InitialQoS), + case catch 'CosEventDomainAdmin_EventDomain':oe_create_link([self(), Id, + QoS, Admin], + [{sup_child, true}]) of + {ok, Pid, ED} -> + {reply, {ED, Id}, State#state{current_id = Id, + domains = [{Id, ED, Pid}|State#state.domains]}}; + What -> + orber:dbg("[~p] CosEventDomainAdmin_EventDomainFactory:" + "create_event_domain();~n" + "Failed creatin a new EventDomain due to: ~p", + [?LINE, What], ?DEBUG_LEVEL), + corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) + end. + +%%---------------------------------------------------------------------- +%% Function : get_all_domains +%% Arguments : - +%% Returns : CosEventDomainAdmin::DomainIDSeq - [long()] +%% Description: +%%---------------------------------------------------------------------- +get_all_domains(_OE_This, State) -> + {reply, get_all_domains_helper(State#state.domains, []), State}. + +get_all_domains_helper([], Acc) -> + Acc; +get_all_domains_helper([{Id, _, _}|T], Acc) -> + get_all_domains_helper(T, [Id|Acc]). + + +%%---------------------------------------------------------------------- +%% Function : get_event_domain +%% Arguments : CosEventDomainAdmin::DomainID - long() +%% Returns : CosEventDomainAdmin::EventDomain | +%% {'EXCEPTION', #'CosEventDomainAdmin_DomainNotFound'{}} | +%% Description: +%%---------------------------------------------------------------------- +get_event_domain(_OE_This, State, DomainID) -> + {reply, get_event_domain_helper(State#state.domains, DomainID), State}. + +get_event_domain_helper([], _) -> + corba:raise(#'CosEventDomainAdmin_DomainNotFound'{}); +get_event_domain_helper([{Id, ED, _}|_], Id) -> + ED; +get_event_domain_helper([_|T], Id) -> + get_event_domain_helper(T, Id). + +%%====================================================================== +%% Internal functions +%%====================================================================== +delete_domain([], _, Acc) -> + %% The domain didn't exist. + Acc; +delete_domain([{_Id, _, Pid}], Pid, Acc) -> + Acc; +delete_domain([{_Id, _, Pid}|T], Pid, Acc) -> + T++Acc; +delete_domain([H|T], Pid, Acc) -> + delete_domain(T, Pid, [H|Acc]). + +%%====================================================================== +%% END OF MODULE +%%====================================================================== + diff --git a/lib/cosEventDomain/src/CosEventDomainAdmin_EventDomain_impl.erl b/lib/cosEventDomain/src/CosEventDomainAdmin_EventDomain_impl.erl new file mode 100644 index 0000000000..0b73100540 --- /dev/null +++ b/lib/cosEventDomain/src/CosEventDomainAdmin_EventDomain_impl.erl @@ -0,0 +1,1415 @@ +%%-------------------------------------------------------------------- +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2001-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 : CosEventDomainAdmin_EventDomain_impl.erl +%% Description : +%% +%%---------------------------------------------------------------------- +-module('CosEventDomainAdmin_EventDomain_impl'). + +%%---------------------------------------------------------------------- +%% Include files +%%---------------------------------------------------------------------- +-include_lib("orber/include/corba.hrl"). +-include_lib("orber/include/ifr_types.hrl"). +-include_lib("cosNotification/include/CosNotifyChannelAdmin.hrl"). +-include_lib("cosNotification/include/CosNotification.hrl"). + +-include("cosEventDomainApp.hrl"). +-include("CosEventDomainAdmin.hrl"). + +%%---------------------------------------------------------------------- +%% External exports +%%---------------------------------------------------------------------- +-export([init/1, + terminate/2, + code_change/3, + handle_info/2]). + +%%------------------ CosEventDomainAdmin::EventDomain ------------------ +-export([add_channel/3, + get_all_channels/2, + get_channel/3, + remove_channel/3, + add_connection/3, + get_all_connections/2, + get_connection/3, + remove_connection/3, + get_offer_channels/3, + get_subscription_channels/3, + destroy/2, + get_cycles/2, + get_diamonds/2, + set_default_consumer_channel/3, + set_default_supplier_channel/3, + connect_push_consumer/3, + connect_pull_consumer/3, + connect_push_supplier/3, + connect_pull_supplier/3, + connect_structured_push_consumer/3, + connect_structured_pull_consumer/3, + connect_structured_push_supplier/3, + connect_structured_pull_supplier/3, + connect_sequence_push_consumer/3, + connect_sequence_pull_consumer/3, + connect_sequence_push_supplier/3, + connect_sequence_pull_supplier/3, + connect_push_consumer_with_id/4, + connect_pull_consumer_with_id/4, + connect_push_supplier_with_id/4, + connect_pull_supplier_with_id/4, + connect_structured_push_consumer_with_id/4, + connect_structured_pull_consumer_with_id/4, + connect_structured_push_supplier_with_id/4, + connect_structured_pull_supplier_with_id/4, + connect_sequence_push_consumer_with_id/4, + connect_sequence_pull_consumer_with_id/4, + connect_sequence_push_supplier_with_id/4, + connect_sequence_pull_supplier_with_id/4]). + +%%------------------ CosNotification::QoSAdmin ------------------------- +-export([get_qos/2, + set_qos/3, + validate_qos/3]). + +%%------------------ CosNotification::AdminPropertiesAdmin ------------- +-export([get_admin/2, + set_admin/3]). + + + +%%---------------------------------------------------------------------- +%% Internal exports +%%---------------------------------------------------------------------- +-export([]). + +%%---------------------------------------------------------------------- +%% Records +%%---------------------------------------------------------------------- +-record(state, {parent_pid, id, graph, ch_counter=-1, + co_counter=-1, def_supplier, def_consumer, diamonds, cyclic}). + +-record(connection, {supplier, consumer, data}). + +%%---------------------------------------------------------------------- +%% Macros +%%---------------------------------------------------------------------- + +%%====================================================================== +%% External functions +%%====================================================================== +%%---------------------------------------------------------------------- +%% Function : init/1 +%% Returns : {ok, State} | +%% {ok, State, Timeout} | +%% ignore | +%% {stop, Reason} +%% Description: Initiates the server +%%---------------------------------------------------------------------- +init([ParentPid, MyId, QoS, _Admin]) -> + process_flag(trap_exit, true), + Diamonds = case lists:keysearch(?DiamondDetection, 1, QoS) of + false -> + ?ForbidDiamonds; + {value, {_, Value}} -> + Value + end, + case lists:keysearch(?CycleDetection, 1, QoS) of + {value, {_, ?AuthorizeCycles}} -> + {ok, #state{parent_pid = ParentPid, id = MyId, + graph = digraph:new([private]), + diamonds = Diamonds, cyclic = ?AuthorizeCycles}}; + _ -> + {ok, #state{parent_pid = ParentPid, id = MyId, + graph = digraph:new([acyclic, private]), + diamonds = Diamonds, cyclic = ?ForbidCycles}} + end. + +%%---------------------------------------------------------------------- +%% Function : terminate/2 +%% Returns : any (ignored by gen_server) +%% Description: Shutdown the server +%%---------------------------------------------------------------------- +terminate(_Reason, #state{graph = DG} = _State) -> + Connections = digraph:edges(DG), + close_connections(DG, Connections), + digraph:delete(DG), + 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/2 +%% Returns : {noreply, State} | +%% {stop, Reason, State} +%% Description: Handle, for example, exit signals. +%%---------------------------------------------------------------------- +handle_info({'EXIT', Pid, Reason}, #state{parent_pid = Pid} = State) -> + {stop, Reason, State}; +handle_info(_Info, State) -> + {noreply, State}. + +%%---------------------------------------------------------------------- +%%------------------ CosEventDomainAdmin::EventDomain ------------------ +%%---------------------------------------------------------------------% +%% Function : add_channel +%% Arguments : Channel - CosNotifyChannelAdmin::EventChannel +%% Returns : MemberId - long() +%% Description: +%%---------------------------------------------------------------------- +add_channel(_OE_This, #state{ch_counter=C, graph = DG} = State, Channel) -> + type_check(Channel, 'CosNotifyChannelAdmin_EventChannel'), + Id = cosEventDomainApp:create_id(C), + digraph:add_vertex(DG, Id, Channel), + {reply, Id, State#state{ch_counter=Id}}. + +%%---------------------------------------------------------------------% +%% Function : get_all_channels +%% Arguments : - +%% Returns : CosEventDomainAdmin::MemberIDSeq ([long()]) +%% Description: +%%---------------------------------------------------------------------- +get_all_channels(_OE_This, #state{graph = DG} = State) -> + {reply, digraph:vertices(DG), State}. + +%%---------------------------------------------------------------------% +%% Function : get_channel +%% Arguments : Id - CosEventDomainAdmin::MemberID (long()) +%% Returns : CosNotifyChannelAdmin::EventChannel | +%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} +%% Description: +%%---------------------------------------------------------------------- +get_channel(_OE_This, #state{graph = DG} = State, Id) -> + {reply, lookup_channel(DG, Id), State}. + +%%---------------------------------------------------------------------% +%% Function : remove_channel +%% Arguments : Id - CosEventDomainAdmin::MemberID (long()) +%% Returns : ok | +%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} +%% Description: +%%---------------------------------------------------------------------- +remove_channel(_OE_This, #state{graph = DG} = State, Id) -> + lookup_channel(DG, Id), + close_connections(DG, digraph:edges(DG, Id)), + digraph:del_vertex(DG, Id), + {reply, ok, State}. + +%%---------------------------------------------------------------------% +%% Function : add_connection +%% Arguments : Connection - CosEventDomainAdmin::Connection +%% Returns : ConnectionID | +%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | +%% {'EXCEPTION', #'CosNotifyChannelAdmin_TypeError'{}} | +%% {'EXCEPTION', #'CosEventDomainAdmin_AlreadyExists'{}} | +%% {'EXCEPTION', #'CosEventDomainAdmin_CycleCreationForbidden'{cyc}} | +%% {'EXCEPTION', #'CosEventDomainAdmin_DiamondCreationForbidden'{diam}} +%% Description: +%%---------------------------------------------------------------------- +add_connection(_OE_This, #state{graph = DG, co_counter = C} = State, + Connection) when is_record(Connection, + 'CosEventDomainAdmin_Connection') -> + SId = Connection#'CosEventDomainAdmin_Connection'.supplier_id, + SChannel = lookup_channel(DG, SId), + CId = Connection#'CosEventDomainAdmin_Connection'.consumer_id, + CChannel = lookup_channel(DG, CId), + case lists:member(CId, digraph:out_neighbours(DG, SId)) of + false -> + Id = cosEventDomainApp:create_id(C), + %% Try to insert the new connection before we actually setup a connection. + %% Note that #connection is NOT complete, hence, we must update it later. + case digraph:add_edge(DG, Id, SId, CId, #connection{data=Connection}) of + {error, {bad_edge, Path}} -> + corba:raise(#'CosEventDomainAdmin_CycleCreationForbidden'{cyc=Path}); + Id when State#state.diamonds == ?AuthorizeDiamonds -> + case catch setup_connection(Connection, SChannel, CChannel) of + {ok, SProxy, CProxy} -> + %% Now we can update the connection with complete data. + digraph:add_edge(DG, Id, SId, CId, #connection{supplier=SProxy, + consumer=CProxy, + data=Connection}), + {reply, Id, State#state{co_counter = Id}}; + {'EXCEPTION', E} -> + digraph:del_edge(DG, Id), + corba:raise(E); + What -> + digraph:del_edge(DG, Id), + orber:dbg("[~p] CosEventDomainAdmin_EventDomain:" + "add_connection(~p);~nFailed setting up" + " connection due to: ~p", + [?LINE, Connection, What], ?DEBUG_LEVEL), + corba:raise(#'INTERNAL'{completion_status=?COMPLETED_MAYBE}) + end; + Id -> + case get_diamonds_helper(State, false, SId) of + [] -> + case catch setup_connection(Connection, SChannel, CChannel) of + {ok, SProxy, CProxy} -> + %% Now we can update the connection with complete data. + digraph:add_edge(DG, Id, SId, CId, #connection{supplier=SProxy, + consumer=CProxy, + data=Connection}), + {reply, Id, State#state{co_counter = Id}}; + {'EXCEPTION', E} -> + digraph:del_edge(DG, Id), + corba:raise(E); + What -> + digraph:del_edge(DG, Id), + orber:dbg("[~p] CosEventDomainAdmin_EventDomain:" + "add_connection(~p);~nFailed setting" + " up connection due to: ~p", + [?LINE, Connection, What], + ?DEBUG_LEVEL), + corba:raise(#'INTERNAL'{completion_status=?COMPLETED_MAYBE}) + end; + Diamond -> + %% Since no diamonds should exist the returned list can + %% only describe the diamond we just created. + digraph:del_edge(DG, Id), + corba:raise(#'CosEventDomainAdmin_DiamondCreationForbidden' + {diam=Diamond}) + end + end; + true -> + corba:raise(#'CosEventDomainAdmin_AlreadyExists'{}) + end. + + +%%---------------------------------------------------------------------% +%% Function : get_all_connections +%% Arguments : - +%% Returns : CosEventDomainAdmin::ConnectionIDSeq - [long()] +%% Description: +%%---------------------------------------------------------------------- +get_all_connections(_OE_This, #state{graph = DG} = State) -> + {reply, digraph:edges(DG), State}. + +%%---------------------------------------------------------------------% +%% Function : get_connection +%% Arguments : Id - CosEventDomainAdmin::ConnectionID (long()) +%% Returns : CosEventDomainAdmin::Connection | +%% {'EXCEPTION', #'CosEventDomainAdmin_ConnectionNotFound'{}} | +%% Description: +%%---------------------------------------------------------------------- +get_connection(_OE_This, #state{graph = DG} = State, Id) -> + {reply, lookup_connection_data(DG, Id), State}. + +%%---------------------------------------------------------------------% +%% Function : remove_connection +%% Arguments : Id - CosEventDomainAdmin::ConnectionID (long()) +%% Returns : ok | +%% {'EXCEPTION', #'CosEventDomainAdmin_ConnectionNotFound'{}} | +%% Description: +%%---------------------------------------------------------------------- +remove_connection(_OE_This, #state{graph = DG} = State, Id) -> + #connection{supplier=S, consumer=C, data=Connection} = + lookup_connection(DG, Id), + close_connection(Connection, S, C), + digraph:del_edge(DG, Id), + {reply, ok, State}. + + +%%---------------------------------------------------------------------% +%% Function : get_offer_channels +%% Arguments : Id - CosEventDomainAdmin::MemberID (long()) +%% Returns : CosNotifyChannelAdmin::ChannelIDSeq | +%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | +%% Description: +%%---------------------------------------------------------------------- +get_offer_channels(_OE_This, #state{graph = DG, cyclic = Cyclic} = State, Id) -> + lookup_channel(DG, Id), + case digraph:vertex(DG, Id) of + {Id, _Channel} when Cyclic == ?ForbidCycles -> + {reply, digraph_utils:reaching_neighbours([Id], DG), State}; + {Id, _Channel} -> + %% If cyclic graphs is allowed 'Id' will appear in the returned list. + %% Hence, we must delete it. + {reply,lists:delete(Id, digraph_utils:reaching_neighbours([Id], DG)), + State}; + false -> + corba:raise(#'CosNotifyChannelAdmin_ChannelNotFound'{}) + end. + +%%---------------------------------------------------------------------% +%% Function : get_subscription_channels +%% Arguments : Id - CosEventDomainAdmin::MemberID (long()) +%% Returns : CosNotifyChannelAdmin::ChannelIDSeq | +%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | +%% Description: +%%---------------------------------------------------------------------- +get_subscription_channels(_OE_This, #state{graph = DG, cyclic = Cyclic} = State, Id) -> + lookup_channel(DG, Id), + case digraph:vertex(DG, Id) of + {Id, _Channel} when Cyclic == ?ForbidCycles -> + {reply, digraph_utils:reachable_neighbours([Id], DG), State}; + {Id, _Channel} -> + %% If cyclic graphs is allowed 'Id' will appear in the returned list. + %% Hence, we must delete it. + {reply, lists:delete(Id, digraph_utils:reachable_neighbours([Id], DG)), + State}; + false -> + corba:raise(#'CosNotifyChannelAdmin_ChannelNotFound'{}) + end. + +%%---------------------------------------------------------------------% +%% Function : destroy +%% Arguments : - +%% Returns : ok +%% Description: +%%---------------------------------------------------------------------- +destroy(_OE_This, #state{graph = _DG} = State) -> + {stop, normal, ok, State}. + +%%---------------------------------------------------------------------% +%% Function : get_cycles +%% Arguments : - +%% Returns : CosEventDomainAdmin::CycleSeq +%% Description: +%%---------------------------------------------------------------------- +get_cycles(_OE_This, #state{cyclic = ?ForbidCycles} = State) -> + {reply, [], State}; +get_cycles(_OE_This, #state{graph = DG} = State) -> + {reply, digraph_utils:cyclic_strong_components(DG), State}. + +%%---------------------------------------------------------------------- +%% Function : get_diamonds +%% Arguments : - +%% Returns : CosEventDomainAdmin::DiamondSeq +%% Description: +%%---------------------------------------------------------------------- +get_diamonds(_OE_This, #state{diamonds = ?ForbidDiamonds} = State) -> + {reply, [], State}; +get_diamonds(_OE_This, State) -> + {reply, get_diamonds_helper(State, true), State}. + +get_diamonds_helper(#state{graph = DG} = _State, FindAll) -> + case find_candidates(DG) of + {[], _, _} -> + []; + {_, [], _} -> + []; + {COut, CIn, Max} -> + %% In this case we cannot tell if a diamond exists. Got to + %% check the paths between the candidates. + evaluate_candidates(DG, COut, CIn, [], Max, FindAll) + end. + +get_diamonds_helper(#state{graph = DG} = _State, FindAll, Vertex) -> + case find_candidates(DG, Vertex) of + {[], _, _} -> + []; + {_, [], _} -> + []; + {COut, CIn, Max} -> + %% In this case we cannot tell if a diamond exists. Got to + %% check the paths between the candidates. + evaluate_candidates(DG, COut, CIn, [], Max, FindAll) + end. + +%%---------------------------------------------------------------------% +%% Function : set_default_consumer_channel +%% Arguments : Id - CosEventDomainAdmin::MemberID (long()) +%% Returns : ok | +%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | +%% Description: +%%---------------------------------------------------------------------- +set_default_consumer_channel(_OE_This, #state{graph = DG} = State, Id) -> + lookup_channel(DG, Id), + {reply, ok, State#state{def_consumer=Id}}. + +%%---------------------------------------------------------------------% +%% Function : set_default_supplier_channel +%% Arguments : Id - CosEventDomainAdmin::MemberID (long()) +%% Returns : ok | +%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | +%% Description: +%%---------------------------------------------------------------------- +set_default_supplier_channel(_OE_This, #state{graph = DG} = State, Id) -> + lookup_channel(DG, Id), + {reply, ok, State#state{def_supplier=Id}}. + +%%---------------------------------------------------------------------% +%% Function : connect_push_consumer +%% Arguments : PC - CosEventComm::PushConsumer +%% Returns : CosNotifyChannelAdmin::ProxyPushSupplier | +%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | +%% Description: +%%---------------------------------------------------------------------- +connect_push_consumer(_OE_This, #state{def_supplier = Ch} = State, PC) -> + type_check(PC, 'CosEventComm_PushConsumer'), + Proxy = connect_a_push_consumer(Ch, PC, 'ANY_EVENT'), + {reply, Proxy, State}. + +%%---------------------------------------------------------------------% +%% Function : connect_pull_consumer +%% Arguments : PC - CosEventComm::PullConsumer +%% Returns : CosNotifyChannelAdmin::ProxyPullSupplier | +%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | +%% Description: +%%---------------------------------------------------------------------- +connect_pull_consumer(_OE_This, #state{def_consumer = Ch} = State, PC) -> + Proxy = connect_a_pull_consumer(Ch, PC, 'ANY_EVENT'), + {reply, Proxy, State}. + +%%---------------------------------------------------------------------% +%% Function : connect_push_supplier +%% Arguments : PS - CosEventComm::PushSupplier +%% Returns : CosNotifyChannelAdmin::ProxyPushConsumer | +%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | +%% Description: +%%---------------------------------------------------------------------- +connect_push_supplier(_OE_This, #state{def_supplier = Ch} = State, PS) -> + Proxy = connect_a_push_supplier(Ch, PS, 'ANY_EVENT'), + {reply, Proxy, State}. + +%%---------------------------------------------------------------------% +%% Function : connect_pull_supplier +%% Arguments : PS - CosEventComm::PullSupplier +%% Returns : CosNotifyChannelAdmin::ProxyPullConsumer +%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | +%% Description: +%%---------------------------------------------------------------------- +connect_pull_supplier(_OE_This, #state{def_consumer = Ch} = State, PS) -> + type_check(PS, 'CosEventComm_PullSupplier'), + Proxy = connect_a_pull_supplier(Ch, PS, 'ANY_EVENT'), + {reply, Proxy, State}. + +%%---------------------------------------------------------------------% +%% Function : connect_structured_push_consumer +%% Arguments : PC - CosNotifyComm::StructuredPushConsumer +%% Returns : CosNotifyChannelAdmin::StructuredProxyPushSupplier | +%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | +%% Description: +%%---------------------------------------------------------------------- +connect_structured_push_consumer(_OE_This, #state{def_supplier = Ch} = State, PC) -> + type_check(PC, 'CosNotifyComm_StructuredPushConsumer'), + Proxy = connect_a_push_consumer(Ch, PC, 'STRUCTURED_EVENT'), + {reply, Proxy, State}. + +%%---------------------------------------------------------------------% +%% Function : connect_structured_pull_consumer +%% Arguments : PC - CosNotifyComm::StructuredPullConsumer +%% Returns : CosNotifyChannelAdmin::StructuredProxyPullSupplier | +%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | +%% Description: +%%---------------------------------------------------------------------- +connect_structured_pull_consumer(_OE_This, #state{def_supplier = Ch} = State, PC) -> + Proxy = connect_a_pull_consumer(Ch, PC, 'STRUCTURED_EVENT'), + {reply, Proxy, State}. + +%%---------------------------------------------------------------------% +%% Function : connect_structured_push_supplier +%% Arguments : PS - CosNotifyComm::StructuredPushSupplier +%% Returns : CosNotifyChannelAdmin::StructuredProxyPushConsumer | +%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | +%% Description: +%%---------------------------------------------------------------------- +connect_structured_push_supplier(_OE_This, #state{def_consumer = Ch} = State, PS) -> + Proxy = connect_a_push_supplier(Ch, PS, 'STRUCTURED_EVENT'), + {reply, Proxy, State}. + +%%---------------------------------------------------------------------% +%% Function : connect_structured_pull_supplier +%% Arguments : PS - CosNotifyComm::StructuredPullSupplier +%% Returns : CosNotifyChannelAdmin::StructuredProxyPullConsumer | +%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | +%% Description: +%%---------------------------------------------------------------------- +connect_structured_pull_supplier(_OE_This, #state{def_consumer = Ch} = State, PS) -> + type_check(PS, 'CosNotifyComm_StructuredPullSupplier'), + Proxy = connect_a_pull_supplier(Ch, PS, 'STRUCTURED_EVENT'), + {reply, Proxy, State}. + +%%---------------------------------------------------------------------% +%% Function : connect_sequence_push_consumer +%% Arguments : PC - CosNotifyComm::SequencePushConsumer +%% Returns : CosNotifyChannelAdmin::SequenceProxyPushSupplier | +%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | +%% Description: +%%---------------------------------------------------------------------- +connect_sequence_push_consumer(_OE_This, #state{def_supplier = Ch} = State, PC) -> + type_check(PC, 'CosNotifyComm_SequencePushConsumer'), + Proxy = connect_a_push_consumer(Ch, PC, 'SEQUENCE_EVENT'), + {reply, Proxy, State}. + +%%---------------------------------------------------------------------% +%% Function : connect_sequence_pull_consumer +%% Arguments : PC - CosNotifyComm::SequencePullConsumer +%% Returns : CosNotifyChannelAdmin::SequenceProxyPullSupplier | +%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | +%% Description: +%%---------------------------------------------------------------------- +connect_sequence_pull_consumer(_OE_This, #state{def_supplier = Ch} = State, PC) -> + Proxy = connect_a_pull_consumer(Ch, PC, 'SEQUENCE_EVENT'), + {reply, Proxy, State}. + +%%---------------------------------------------------------------------% +%% Function : connect_sequence_push_supplier +%% Arguments : PS - CosNotifyComm::SequencePushSupplier +%% Returns : CosNotifyChannelAdmin::SequenceProxyPushConsumer | +%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | +%% Description: +%%---------------------------------------------------------------------- +connect_sequence_push_supplier(_OE_This, #state{def_consumer = Ch} = State, PS) -> + Proxy = connect_a_push_supplier(Ch, PS, 'SEQUENCE_EVENT'), + {reply, Proxy, State}. + +%%---------------------------------------------------------------------% +%% Function : connect_sequence_pull_supplier +%% Arguments : PS - CosNotifyComm::SequencePullSupplier +%% Returns : CosNotifyChannelAdmin::SequenceProxyPullConsumer | +%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | +%% Description: +%%---------------------------------------------------------------------- +connect_sequence_pull_supplier(_OE_This, #state{def_consumer = Ch} = State, PS) -> + type_check(PS, 'CosNotifyComm_SequencePullSupplier'), + Proxy = connect_a_pull_supplier(Ch, PS, 'SEQUENCE_EVENT'), + {reply, Proxy, State}. + +%%---------------------------------------------------------------------% +%% Function : connect_push_consumer_with_id +%% Arguments : PC - CosEventComm::PushConsumer +%% Id - CosEventDomainAdmin::MemberID (long()) +%% Returns : CosNotifyChannelAdmin::ProxyPushSupplier | +%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | +%% Description: +%%---------------------------------------------------------------------- +connect_push_consumer_with_id(_OE_This, #state{graph = DG} = State, PC, Id) -> + type_check(PC, 'CosEventComm_PushConsumer'), + Channel = lookup_channel(DG, Id), + Proxy = connect_a_push_consumer(Channel, PC, 'ANY_EVENT'), + {reply, Proxy, State}. + +%%---------------------------------------------------------------------% +%% Function : connect_pull_consumer_with_id +%% Arguments : PC - CosEventComm::PullConsumer +%% Id - CosEventDomainAdmin::MemberID (long()) +%% Returns : CosNotifyChannelAdmin::ProxyPullSupplier | +%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | +%% Description: +%%---------------------------------------------------------------------- +connect_pull_consumer_with_id(_OE_This, #state{graph = DG} = State, PC, Id) -> + Channel = lookup_channel(DG, Id), + Proxy = connect_a_pull_consumer(Channel, PC, 'ANY_EVENT'), + {reply, Proxy, State}. + +%%---------------------------------------------------------------------% +%% Function : connect_push_supplier_with_id +%% Arguments : PS - CosEventComm::PushSupplier +%% Id - CosEventDomainAdmin::MemberID (long()) +%% Returns : CosNotifyChannelAdmin::ProxyPushConsumer | +%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | +%% Description: +%%---------------------------------------------------------------------- +connect_push_supplier_with_id(_OE_This, #state{graph = DG} = State, PS, Id) -> + Channel = lookup_channel(DG, Id), + Proxy = connect_a_push_supplier(Channel, PS, 'ANY_EVENT'), + {reply, Proxy, State}. + +%%---------------------------------------------------------------------% +%% Function : connect_pull_supplier_with_id +%% Arguments : PS - CosEventComm::PullSupplier +%% Id - CosEventDomainAdmin::MemberID (long()) +%% Returns : CosNotifyChannelAdmin::ProxyPullConsumer | +%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | +%% Description: +%%---------------------------------------------------------------------- +connect_pull_supplier_with_id(_OE_This, #state{graph = DG} = State, PS, Id) -> + type_check(PS, 'CosEventComm_PullSupplier'), + Channel = lookup_channel(DG, Id), + Proxy = connect_a_pull_supplier(Channel, PS, 'ANY_EVENT'), + {reply, Proxy, State}. + +%%---------------------------------------------------------------------% +%% Function : connect_structured_push_consumer_with_id +%% Arguments : PC - CosNotifyComm::StructuredPushConsumer +%% Id - CosEventDomainAdmin::MemberID (long()) +%% Returns : CosNotifyChannelAdmin::StructuredProxyPushSupplier | +%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | +%% Description: +%%---------------------------------------------------------------------- +connect_structured_push_consumer_with_id(_OE_This, #state{graph = DG} = State, PC, Id) -> + type_check(PC, 'CosNotifyComm_StructuredPushConsumer'), + Channel = lookup_channel(DG, Id), + Proxy = connect_a_push_consumer(Channel, PC, 'STRUCTURED_EVENT'), + {reply, Proxy, State}. + +%%---------------------------------------------------------------------% +%% Function : connect_structured_pull_consumer_with_id +%% Arguments : PC - CosNotifyComm::StructuredPullConsumer +%% Id - CosEventDomainAdmin::MemberID (long()) +%% Returns : CosNotifyChannelAdmin::StructuredProxyPullSupplier | +%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | +%% Description: +%%---------------------------------------------------------------------- +connect_structured_pull_consumer_with_id(_OE_This, #state{graph = DG} = State, PC, Id) -> + Channel = lookup_channel(DG, Id), + Proxy = connect_a_pull_consumer(Channel, PC, 'STRUCTURED_EVENT'), + {reply, Proxy, State}. + +%%---------------------------------------------------------------------% +%% Function : connect_structured_push_supplier_with_id +%% Arguments : PS - CosNotifyComm::StructuredPushSupplier +%% Id - CosEventDomainAdmin::MemberID (long()) +%% Returns : CosNotifyChannelAdmin::StructuredProxyPushConsumer | +%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | +%% Description: +%%---------------------------------------------------------------------- +connect_structured_push_supplier_with_id(_OE_This, #state{graph = DG} = State, PS, Id) -> + Channel = lookup_channel(DG, Id), + Proxy = connect_a_push_supplier(Channel, PS, 'STRUCTURED_EVENT'), + {reply, Proxy, State}. + +%%---------------------------------------------------------------------% +%% Function : connect_structured_pull_supplier_with_id +%% Arguments : PS - CosNotifyComm::StructuredPullSupplier +%% Id - CosEventDomainAdmin::MemberID (long()) +%% Returns : CosNotifyChannelAdmin::StructuredProxyPullConsumer | +%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | +%% Description: +%%---------------------------------------------------------------------- +connect_structured_pull_supplier_with_id(_OE_This, #state{graph = DG} = State, PS, Id) -> + type_check(PS, 'CosNotifyComm_StructuredPullSupplier'), + Channel = lookup_channel(DG, Id), + Proxy = connect_a_pull_supplier(Channel, PS, 'STRUCTURED_EVENT'), + {reply, Proxy, State}. + +%%---------------------------------------------------------------------% +%% Function : connect_sequence_push_consumer_with_id +%% Arguments : PC - CosNotifyComm::SequencePushConsumer +%% Id - CosEventDomainAdmin::MemberID (long()) +%% Returns : CosNotifyChannelAdmin::SequenceProxyPushSupplier | +%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | +%% Description: +%%---------------------------------------------------------------------- +connect_sequence_push_consumer_with_id(_OE_This, #state{graph = DG} = State, PC, Id) -> + type_check(PC, 'CosNotifyComm_SequencePushConsumer'), + Channel = lookup_channel(DG, Id), + Proxy = connect_a_push_consumer(Channel, PC, 'SEQUENCE_EVENT'), + {reply, Proxy, State}. + +%%---------------------------------------------------------------------% +%% Function : connect_sequence_pull_consumer_with_id +%% Arguments : PC - CosNotifyComm::SequencePullConsumer +%% Id - CosEventDomainAdmin::MemberID (long()) +%% Returns : CosNotifyChannelAdmin::SequenceProxyPullSupplier | +%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | +%% Description: +%%---------------------------------------------------------------------- +connect_sequence_pull_consumer_with_id(_OE_This, #state{graph = DG} = State, PC, Id) -> + Channel = lookup_channel(DG, Id), + Proxy = connect_a_pull_consumer(Channel, PC, 'SEQUENCE_EVENT'), + {reply, Proxy, State}. + +%%---------------------------------------------------------------------% +%% Function : connect_sequence_push_supplier_with_id +%% Arguments : PS - CosNotifyComm::SequencePushSupplier +%% Id - CosEventDomainAdmin::MemberID (long()) +%% Returns : CosNotifyChannelAdmin::SequenceProxyPushConsumer | +%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | +%% Description: +%%---------------------------------------------------------------------- +connect_sequence_push_supplier_with_id(_OE_This, #state{graph = DG} = State, PS, Id) -> + Channel = lookup_channel(DG, Id), + Proxy = connect_a_push_supplier(Channel, PS, 'SEQUENCE_EVENT'), + {reply, Proxy, State}. + +%%---------------------------------------------------------------------% +%% Function : connect_sequence_pull_supplier_with_id +%% Arguments : PS - CosNotifyComm::SequencePullSupplier +%% Id - CosEventDomainAdmin::MemberID (long()) +%% Returns : CosNotifyChannelAdmin::SequenceProxyPullConsumer | +%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | +%% Description: +%%---------------------------------------------------------------------- +connect_sequence_pull_supplier_with_id(_OE_This, #state{graph = DG} = State, PS, Id) -> + type_check(PS, 'CosNotifyComm_SequencePullSupplier'), + Channel = lookup_channel(DG, Id), + Proxy = connect_a_pull_supplier(Channel, PS, 'SEQUENCE_EVENT'), + {reply, Proxy, State}. + + +%%---------------------------------------------------------------------- +%%------------------ CosNotification::QoSAdmin ------------------------- +%%---------------------------------------------------------------------% +%% Function : get_qos +%% Arguments : - +%% Returns : CosNotification::QoSProperties +%% Description: +%%---------------------------------------------------------------------- +get_qos(_OE_This, #state{cyclic = Cyclic, diamonds = Diamonds} = State) -> + {reply, [#'CosNotification_Property' + {name = ?DiamondDetection, + value = any:create(orber_tc:short(), Diamonds)}, + #'CosNotification_Property' + {name = ?CycleDetection, + value = any:create(orber_tc:short(), Cyclic)}], State}. + +%%---------------------------------------------------------------------% +%% Function : set_qos +%% Arguments : NewQoS - CosNotification::QoSProperties +%% Returns : ok | +%% {'EXCEPTION', #'CosNotification_UnsupportedQoS{}} +%% Description: +%%---------------------------------------------------------------------- +set_qos(_OE_This, State, NewQoS) -> + QoS = cosEventDomainApp:get_qos(NewQoS), + set_qos_helper(QoS, State, []). + +set_qos_helper([], State, []) -> + {reply, ok, State}; +set_qos_helper([], _, Errors) -> + corba:raise(#'CosNotification_UnsupportedQoS'{qos_err = Errors}); +set_qos_helper([{?DiamondDetection, Diamonds}|T], #state{diamonds = Diamonds} = State, + Errors) -> + set_qos_helper(T, State, Errors); +set_qos_helper([{?CycleDetection, Cyclic}|T], #state{cyclic = Cyclic} = State, + Errors) -> + set_qos_helper(T, State, Errors); +set_qos_helper([{?DiamondDetection, ?AuthorizeDiamonds}|T], State, Errors) -> + %% Diamonds have not been allowed so far so it's safe to allow it. + set_qos_helper(T, State#state{diamonds = ?AuthorizeDiamonds}, Errors); +set_qos_helper([{?DiamondDetection, ?ForbidDiamonds}|T], State, Errors) -> + %% If any diamonds already exists we cannot allow this. Hence, now we must check + %% if we can update the QoS. + case get_diamonds_helper(State, false) of + [] -> + set_qos_helper(T, State#state{diamonds = ?ForbidDiamonds}, Errors); + _ -> + set_qos_helper(T, State, + [#'CosNotification_PropertyError' + {code = 'UNAVAILABLE_VALUE', + name = ?DiamondDetection, + available_range = #'CosNotification_PropertyRange' + {low_val=any:create(orber_tc:short(), ?AuthorizeDiamonds), + high_val=any:create(orber_tc:short(), ?AuthorizeDiamonds)}}|Errors]) + end; +set_qos_helper([{?CycleDetection, _}|T], #state{cyclic = Cyclic} = State, Errors) -> + %% Currently we do not support changing the Cycle schema. If we want to, + %% we must copy the graph to a new instance of the correct type. + set_qos_helper(T, State, + [#'CosNotification_PropertyError' + {code = 'UNAVAILABLE_VALUE', + name = ?CycleDetection, + available_range = #'CosNotification_PropertyRange' + {low_val=any:create(orber_tc:short(), Cyclic), + high_val=any:create(orber_tc:short(), Cyclic)}}|Errors]). + +%%---------------------------------------------------------------------% +%% Function : validate_qos +%% Arguments : WantedQoS - CosNotification::QoSProperties +%% Returns : {ok, CosNotification::NamedPropertyRangeSeq} | +%% {'EXCEPTION', #'CosNotification_UnsupportedQoS{}} +%% Description: NamedPropertyRangeSeq is of out-type +%%---------------------------------------------------------------------- +validate_qos(_OE_This, State, WantedQoS) -> + QoS = cosEventDomainApp:get_qos(WantedQoS), + {reply, {ok, validate_qos_helper(QoS, State, [], [])}, State}. + +validate_qos_helper([], _, Properties, []) -> + Properties; +validate_qos_helper([], _, _, Errors) -> + corba:raise(#'CosNotification_UnsupportedQoS'{qos_err = Errors}); +validate_qos_helper([{?DiamondDetection, ?ForbidDiamonds}|T], State, Properties, + Errors) -> + case get_diamonds_helper(State, false) of + [] -> + Property = + #'CosNotification_NamedPropertyRange' + {name = ?DiamondDetection, + range = #'CosNotification_PropertyRange' + {low_val=any:create(orber_tc:short(), ?AuthorizeDiamonds), + high_val=any:create(orber_tc:short(), ?ForbidDiamonds)}}, + validate_qos_helper(T, State, [Property|Properties], Errors); + _ -> + Error = + #'CosNotification_PropertyError' + {code = 'UNAVAILABLE_VALUE', + name = ?DiamondDetection, + available_range = #'CosNotification_PropertyRange' + {low_val=any:create(orber_tc:short(), ?AuthorizeDiamonds), + high_val=any:create(orber_tc:short(), ?AuthorizeDiamonds)}}, + validate_qos_helper(T, State, Properties, [Error|Errors]) + end; +validate_qos_helper([{?DiamondDetection, ?AuthorizeDiamonds}|T], State, Properties, + Errors) -> + Property = + #'CosNotification_NamedPropertyRange' + {name = ?DiamondDetection, + range = #'CosNotification_PropertyRange' + {low_val=any:create(orber_tc:short(), ?AuthorizeDiamonds), + high_val=any:create(orber_tc:short(), ?ForbidDiamonds)}}, + validate_qos_helper(T, State, [Property|Properties], Errors); +validate_qos_helper([{?CycleDetection, Cyclic}|T], #state{cyclic = Cyclic} = State, + Properties, Errors) -> + validate_qos_helper(T, State, Properties, Errors); +validate_qos_helper([{?CycleDetection, _}|T], #state{cyclic = Cyclic} = State, + Properties, Errors) -> + Error = + #'CosNotification_PropertyError' + {code = 'UNAVAILABLE_VALUE', + name = ?CycleDetection, + available_range = #'CosNotification_PropertyRange' + {low_val=any:create(orber_tc:short(), Cyclic), + high_val=any:create(orber_tc:short(), Cyclic)}}, + validate_qos_helper(T, State, Properties, [Error|Errors]). + + +%%---------------------------------------------------------------------- +%%------------------ CosNotification::AdminPropertiesAdmin ------------- +%%---------------------------------------------------------------------% +%% Function : get_admin +%% Arguments : - +%% Returns : CosNotification::AdminProperties +%% Description: No Admins currently supported +%%---------------------------------------------------------------------- +get_admin(_OE_This, State) -> + {reply, [], State}. + +%%---------------------------------------------------------------------% +%% Function : set_admin +%% Arguments : NewAdmins - CosNotification::AdminProperties +%% Returns : ok | +%% {'EXCEPTION', #'CosNotification_UnsupportedAdmin{}} +%% Description: No Admins currently supported +%%---------------------------------------------------------------------- +set_admin(_OE_This, State, NewAdmins) -> + cosEventDomainApp:get_admin(NewAdmins), + {reply, ok, State}. + + +%%====================================================================== +%% Internal functions +%%====================================================================== +%%---------------------------------------------------------------------% +%% Function : find_candidates +%% Arguments : Digraph reference +%% (Vertex - if we're interested in a specific vertex. +%% Returns : {[SourceVertices], [SinkVertices], Max} +%% SourceVertices - {Vertice, [ReachableVertices]} +%% SinkVertices - {Vertice, [ReachingVertices]} +%% Max - number of edges in the graph. +%% Description: To be a part of a diamond ("transitive" relation xRy, yRz => xRz; +%% in comparison with discrete mathematics we do not require that the +%% entire graph is transitive) a vertex must have more than one +%% outgoing and/or incoming. Hence, a digraph must contain at least +%% one vertex with more than one outgoing edges and at least +%% one with more than one incoming edges for a diamond to exist. +%% Hence, the purpose of this function is to find vertices that +%% look like: +%% +%% Vout->V1 V6->Vin +%% \ and ^ +%% +->V2 | +%% V8--+ +%%---------------------------------------------------------------------- +find_candidates(DG) -> + Edges = digraph:edges(DG), + {COut, CIn, Max} = find_candidates_helper(Edges, [], [], DG, 0), + {filter_candidates(COut), filter_candidates(CIn), Max}. + + +find_candidates(DG, _Vertex) -> + %% We should use the fact that we know one of the vertices. + Edges = digraph:edges(DG), + {COut, CIn, Max} = find_candidates_helper(Edges, [], [], DG, 0), + {filter_candidates(COut), filter_candidates(CIn), Max}. + +find_candidates_helper([], AccOut, AccIn, _, Counter) -> + {lists:sort(AccOut), lists:sort(AccIn), Counter}; +find_candidates_helper([H|T], AccOut, AccIn, DG, Counter) -> + {H, V1, V2, _Label} = digraph:edge(DG, H), + find_candidates_helper(T, [{V1, V2}|AccOut], [{V2,V1}|AccIn], DG, Counter+1). + +filter_candidates([]) -> + []; +filter_candidates([{V1, V2}|T]) -> + filter_candidates([{V1, V2}|T], V1, [], []). +filter_candidates([], _V, [_Acc1], Acc2) -> + %% Only one in/out connection. Hence, cannot be start- or end-point + %% of a diamond. + lists:reverse(Acc2); +filter_candidates([], V, Acc1, Acc2) -> + lists:reverse([{V, lists:reverse(Acc1)}|Acc2]); +filter_candidates([{V1, V2}|T], V1, Acc1, Acc2) -> + filter_candidates(T, V1, [V2|Acc1], Acc2); +filter_candidates([{V1, V2}|T], _V, [_Acc1], Acc2) -> + %% Only one in/out connection. Hence, cannot be start- or end-point + %% of a diamond. + filter_candidates(T, V1, [V2], Acc2); +filter_candidates([{V1, V2}|T], V, Acc1, Acc2) -> + filter_candidates(T, V1, [V2], [{V, lists:reverse(Acc1)}|Acc2]). + +%%---------------------------------------------------------------------% +%% Function : evaluate_candidates +%% Arguments : - +%% Returns : [Diamond] +%% Description: There are several scenarios but they can be categorized as: +%% (1) (2) (3) (4) +%% 2 2 2-..-56 +%% / \ / \ / \ +%% 1---4 1---4 1---4 1 4 +%% \ / \ / \ / +%% 3 3 3-..-11 +%% +%% The purpose of this function is to find these in the cheapest +%% way possible. For complex diamonds (may also include cycles) +%% duplicates may be generated. For example, #2/#3 is a sub-set of #1 +%% but they are as well diamonds. +%%---------------------------------------------------------------------- +evaluate_candidates(_DG, [], _, Acc, _Max, _) -> + Acc; +evaluate_candidates(DG, [{V, OutV}|T], CIn, Acc, Max, FindAll) -> + case evaluate_candidates_helper(DG, V, OutV, CIn, [], FindAll) of + [] -> + evaluate_candidates(DG, T, CIn, Acc, Max, FindAll); + Diamonds when FindAll == true -> + %% May be more than one diamond. + evaluate_candidates(DG, T, CIn, Diamonds ++ Acc, Max, FindAll); + Diamond -> + Diamond + end. + +evaluate_candidates_helper(_, _, _, _, [Diamond], false) -> + Diamond; +evaluate_candidates_helper(_, _, _, [], Diamonds, _) -> + Diamonds; +evaluate_candidates_helper(DG, V1, OutV, [{V1, _InV}|T], Diamonds, FindAll) -> + evaluate_candidates_helper(DG, V1, OutV, T, Diamonds, FindAll); +evaluate_candidates_helper(DG, V1, OutV, [{V2, InV}|T], Diamonds, FindAll) -> + case double_match(OutV, InV, [], V1, V2) of + [] -> + case is_member(InV, V1) of + true -> + %% At this point we know that we have: + %% x -> y + %% For this pair to be a part of a diamond we have two options: + %% (1) x - y (2) x ---- y + %% \ / or \ / or a additional path besides z1-zN, + %% z z1-zN + case double_match_exclude(OutV, InV, [], V1, V2) of + [] -> + %% Nope it's not #1. + case digraph_match(OutV, V2, V1, DG, 1) of + false -> + evaluate_candidates_helper(DG, V1, OutV, T, + Diamonds, FindAll); + Diamond -> + evaluate_candidates_helper(DG, V1, OutV, T, + [[[V1, V2]|Diamond]|Diamonds], + FindAll) + end; + Diamond -> + %% We've found a diamond looking like: + %% x - y xRy, yRz => xRz + %% \ / + %% z + evaluate_candidates_helper(DG, V1, OutV, T, + [[[V1, V2]|Diamond]|Diamonds], + FindAll) + end; + false -> + case digraph_match(OutV, V2, V1, DG) of + false -> + evaluate_candidates_helper(DG, V1, OutV, T, + Diamonds, FindAll); + Diamond -> + evaluate_candidates_helper(DG, V1, OutV, T, + [Diamond|Diamonds], FindAll) + end + end; + Diamond -> + %% We've found a diamond looking something like: + %% 2 + %% / \ + %% 1-5-4 V1 eq. 1, V2 eq 4. + %% \ / + %% 3 + evaluate_candidates_helper(DG, V1, OutV, T, [Diamond|Diamonds], + FindAll) + end. + +is_member([], _) -> + false; +is_member([H|_], H) -> + true; +is_member([H|_], H2) when H > H2 -> + %% Since it's a sorted list no need to look any further. + false; +is_member([_|T], H) -> + is_member(T, H). + +double_match([], _, [_Matched], _, _) -> + []; +double_match([], _, Matched, _, _) -> + Matched; +double_match(_, [], [_Matched], _, _) -> + []; +double_match(_, [], Matched, _, _) -> + Matched; +double_match([H|T1], [H|T2], Matched, V1, V2) -> + double_match(T1, T2, [[V1,H,V2] | Matched], V1, V2); +double_match([H1|T1], [H2|T2], Matched, V1, V2) when H1 > H2 -> + double_match([H1|T1], T2, Matched, V1, V2); +double_match([_H1|T1], [H2|T2], Matched, V1, V2) -> + double_match(T1, [H2|T2], Matched, V1, V2). + +double_match_exclude([], _, Matched, _, _) -> + Matched; +double_match_exclude(_, [], Matched, _, _) -> + Matched; +%% exclude it +double_match_exclude([V2|T1], CIn, Matched, V1, V2) -> + double_match_exclude(T1, CIn, Matched, V1, V2); +%% exclude it +double_match_exclude(COut, [V1|T2], Matched, V1, V2) -> + double_match_exclude(COut, T2, Matched, V1, V2); +%% Found match +double_match_exclude([H|T1], [H|T2], Matched, V1, V2) -> + double_match_exclude(T1, T2, [[V1,H,V2] | Matched], V1, V2); +double_match_exclude([H1|T1], [H2|T2], Matched, V1, V2) when H1 > H2 -> + double_match_exclude([H1|T1], T2, Matched, V1, V2); +double_match_exclude([_H1|T1], [H2|T2], Matched, V1, V2) -> + double_match_exclude(T1, [H2|T2], Matched, V1, V2). + + +digraph_match(OutV, V2, V1, DG) -> + digraph_match(OutV, V2, V1, DG, [], 0). + +digraph_match(OutV, V2, V1, DG, Counter) -> + digraph_match(OutV, V2, V1, DG, [], Counter). + +digraph_match([], _, _, _, _, Counter) when Counter < 2 -> + false; +digraph_match([], _, _, _, Acc, _) -> + Acc; +digraph_match([Vin|T], Vin, Vout, DG, Acc, Counter) -> + digraph_match(T, Vin, Vout, DG, Acc, Counter); +digraph_match([H|T], Vin, Vout, DG, Acc, Counter) -> + case get_path(DG, H, Vin, H, Vout) of + false -> + digraph_match(T, Vin, Vout, DG, Acc, Counter); + Path -> + %% Found one path; now me must se if there are one more. + digraph_match(T, Vin, Vout, DG, [[Vout|lists:reverse(Path)] | Acc], + Counter+1) + end. + +get_path(G, V1, V2, E1, E2) -> + one_path(digraph:out_neighbours(G, V1), V2, [], [V1], [V1], G, E1, E2). + +one_path([E1|_Vs], W, Cont, Xs, Ps, G, E1, E2) -> + one_path([], W, Cont, Xs, Ps, G, E1, E2); +one_path([E2|_Vs], W, Cont, Xs, Ps, G, E1, E2) -> + one_path([], W, Cont, Xs, Ps, G, E1, E2); +one_path([W|_Ws], W, _Cont, _Xs, Ps, _G, _E1, _E2) -> + [W|Ps]; +one_path([V|Vs], W, Cont, Xs, Ps, G, E1, E2) -> + case lists:member(V, Xs) of + true -> one_path(Vs, W, Cont, Xs, Ps, G, E1, E2); + false -> one_path(digraph:out_neighbours(G, V), W, + [{Vs,Ps} | Cont], [V|Xs], [V|Ps], G, E1, E2) + end; +one_path([], W, [{Vs,Ps}|Cont], Xs, _, G, E1, E2) -> + one_path(Vs, W, Cont, Xs, Ps, G, E1, E2); +one_path([], _, [], _, _, _, _, _) -> false. + +%%---------------------------------------------------------------------% +%% function : type_check +%% Arguments: Obj - objectrefernce to test. +%% Mod - Module which contains typeID/0. +%% Returns : 'ok' or raises exception. +%% Effect : +%%---------------------------------------------------------------------- +type_check(Obj, Mod) -> + case catch corba_object:is_a(Obj,Mod:typeID()) of + true -> + ok; + What -> + orber:dbg("[~p] CosEventDomainAdmin:type_check();~n" + "Object of incorrect type supplied; should be: ~p~n" + "Failed due to: ~p", [?LINE, Mod, What], ?DEBUG_LEVEL), + corba:raise(#'BAD_PARAM'{minor=507, completion_status=?COMPLETED_NO}) + end. + +%%---------------------------------------------------------------------% +%% function : lookup_channel +%% Arguments: DG - digraph reference +%% Id - CosEventDomainAdmin::MemberID (long()) +%% Returns : CosNotifyChannelAdmin::EventChannel | +%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} +%% Effect : +%%---------------------------------------------------------------------- +lookup_channel(DG, Id) -> + case digraph:vertex(DG, Id) of + {Id, Channel} -> + Channel; + false -> + corba:raise(#'CosNotifyChannelAdmin_ChannelNotFound'{}) + end. + + +%%---------------------------------------------------------------------% +%% function : lookup_connection +%% Arguments: DG - digraph reference +%% Id - CosEventDomainAdmin::ConnectionID (long()) +%% Returns : #connectio{} | +%% {'EXCEPTION', #'CosEventDomainAdmin_ConnectionNotFound'{}} +%% Effect : +%%---------------------------------------------------------------------- +lookup_connection(DG, Id) -> + case digraph:edge(DG, Id) of + {Id, _SId, _CId, Connection} -> + Connection; + false -> + corba:raise(#'CosEventDomainAdmin_ConnectionNotFound'{}) + end. + +%%---------------------------------------------------------------------% +%% function : lookup_connection_data +%% Arguments: DG - digraph reference +%% Id - CosEventDomainAdmin::ConnectionID (long()) +%% Returns : CosEventDomainAdmin::Connection | +%% {'EXCEPTION', #'CosEventDomainAdmin_ConnectionNotFound'{}} +%% Effect : +%%---------------------------------------------------------------------- +lookup_connection_data(DG, Id) -> + case digraph:edge(DG, Id) of + {Id, _SId, _CId, #connection{data = Connection}} -> + Connection; + false -> + corba:raise(#'CosEventDomainAdmin_ConnectionNotFound'{}) + end. + +%%---------------------------------------------------------------------% +%% function : close_connections +%% Arguments: DG -digraph reference +%% [CosEventDomainAdmin::ConnectionID] - [long()] +%% Returns : ok +%% Effect : +%%---------------------------------------------------------------------- +close_connections(_DG, []) -> + ok; +close_connections(DG, [H|T]) -> + #connection{supplier=S, consumer=C, data=Connection} = + lookup_connection(DG, H), + close_connection(Connection, S, C), + digraph:del_edge(DG, H), + close_connections(DG, T). + +%%---------------------------------------------------------------------% +%% function : close_connection +%% Arguments: CosEventDomainAdmin::Connection +%% S - SupplierProxy +%% C - ConsumerProxy +%% Returns : ok +%% Effect : +%%---------------------------------------------------------------------- +close_connection(#'CosEventDomainAdmin_Connection'{ctype=Type, + notification_style = Style}, + S, C) -> + case {Type, Style} of + {'ANY_EVENT', 'Push'} -> + catch 'CosNotifyChannelAdmin_ProxyPushSupplier':disconnect_push_supplier(S), + catch 'CosNotifyChannelAdmin_ProxyPushConsumer':disconnect_push_consumer(C); + {'ANY_EVENT', 'Pull'} -> + catch 'CosNotifyChannelAdmin_ProxyPullSupplier':disconnect_pull_supplier(S), + catch 'CosNotifyChannelAdmin_ProxyPullConsumer':disconnect_pull_consumer(C); + {'STRUCTURED_EVENT', 'Push'} -> + catch 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':disconnect_structured_push_supplier(S), + catch 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':disconnect_structured_push_consumer(C); + {'STRUCTURED_EVENT', 'Pull'} -> + catch 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':disconnect_structured_pull_supplier(S), + catch 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':disconnect_structured_pull_consumer(C); + {'SEQUENCE_EVENT', 'Push'} -> + catch 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':disconnect_sequence_push_supplier(S), + catch 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':disconnect_sequence_push_consumer(C); + {'SEQUENCE_EVENT', 'Pull'}-> + catch 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':disconnect_sequence_pull_supplier(S), + catch 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':disconnect_sequence_pull_consumer(C) + end, + ok. + +%%---------------------------------------------------------------------% +%% function : setup_connection +%% Arguments: CosEventDomainAdmin::Connection +%% S - SupplierProxy +%% C - ConsumerProxy +%% Returns : {ok, SupplierProxy, ConsumerProxy}; +%% Effect : +%%---------------------------------------------------------------------- +setup_connection(#'CosEventDomainAdmin_Connection'{ctype=Type, + notification_style = Style}, + S, C) -> + Admin = + 'CosNotifyChannelAdmin_EventChannel':'_get_default_consumer_admin'(S), + case Style of + 'Push' -> + {Proxy, _Id} = + 'CosNotifyChannelAdmin_ConsumerAdmin': + obtain_notification_push_supplier(Admin, Type), + CProxy = connect_a_push_supplier(C, Proxy, Type), + case Type of + 'ANY_EVENT' -> + 'CosNotifyChannelAdmin_ProxyPushSupplier': + connect_any_push_consumer(Proxy, CProxy); + 'STRUCTURED_EVENT' -> + 'CosNotifyChannelAdmin_StructuredProxyPushSupplier': + connect_structured_push_consumer(Proxy, CProxy); + 'SEQUENCE_EVENT' -> + 'CosNotifyChannelAdmin_SequenceProxyPushSupplier': + connect_sequence_push_consumer(Proxy, CProxy) + end, + {ok, Proxy, CProxy}; + 'Pull' -> + {Proxy, _Id} = + 'CosNotifyChannelAdmin_ConsumerAdmin': + obtain_notification_pull_supplier(Admin, Type), + CProxy = connect_a_pull_supplier(C, Proxy, Type), + case Type of + 'ANY_EVENT' -> + 'CosNotifyChannelAdmin_ProxyPullSupplier': + connect_any_pull_consumer(Proxy, CProxy); + 'STRUCTURED_EVENT' -> + 'CosNotifyChannelAdmin_StructuredProxyPullSupplier': + connect_structured_pull_consumer(Proxy, CProxy); + 'SEQUENCE_EVENT' -> + 'CosNotifyChannelAdmin_SequenceProxyPullSupplier': + connect_sequence_pull_consumer(Proxy, CProxy) + end, + {ok, Proxy, CProxy} + end. + +%%---------------------------------------------------------------------% +%% function : connect_a_pull_consumer +%% Arguments: Channel - CosNotifyChannelAdmin::EventChannel | undefined +%% PC - a PullConsumer +%% Type - 'ANY_EVENT' | 'STRUCTURED_EVENT' | 'SEQUENCE_EVENT' +%% Returns : +%% Effect : +%%---------------------------------------------------------------------- +connect_a_pull_consumer(undefined, _, _) -> + corba:raise(#'CosNotifyChannelAdmin_ChannelNotFound'{}); +connect_a_pull_consumer(Channel, PC, Type) -> + Admin = + 'CosNotifyChannelAdmin_EventChannel':'_get_default_consumer_admin'(Channel), + {Proxy, _Id} = + 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_notification_pull_supplier(Admin, + Type), + case Type of + 'ANY_EVENT' -> + 'CosNotifyChannelAdmin_ProxyPullSupplier':connect_any_pull_consumer(Proxy, PC); + 'STRUCTURED_EVENT' -> + 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':connect_structured_pull_consumer(Proxy, PC); + 'SEQUENCE_EVENT' -> + 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':connect_sequence_pull_consumer(Proxy, PC) + end, + Proxy. + +%%---------------------------------------------------------------------% +%% function : connect_a_push_consumer +%% Arguments: Channel - CosNotifyChannelAdmin::EventChannel | undefined +%% PC - a PushConsumer +%% Type - 'ANY_EVENT' | 'STRUCTURED_EVENT' | 'SEQUENCE_EVENT' +%% Returns : +%% Effect : +%%---------------------------------------------------------------------- +connect_a_push_consumer(undefined, _, _) -> + corba:raise(#'CosNotifyChannelAdmin_ChannelNotFound'{}); +connect_a_push_consumer(Channel, PC, Type) -> + Admin = + 'CosNotifyChannelAdmin_EventChannel':'_get_default_consumer_admin'(Channel), + {Proxy, _Id} = + 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_notification_push_supplier(Admin, + Type), + case Type of + 'ANY_EVENT' -> + 'CosNotifyChannelAdmin_ProxyPushSupplier':connect_any_push_consumer(Proxy, PC); + 'STRUCTURED_EVENT' -> + 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':connect_structured_push_consumer(Proxy, PC); + 'SEQUENCE_EVENT' -> + 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':connect_sequence_push_consumer(Proxy, PC) + end, + Proxy. + +%%---------------------------------------------------------------------% +%% function : connect_a_pull_supplier +%% Arguments: Channel - CosNotifyChannelAdmin::EventChannel | undefined +%% PC - a PullSupplier +%% Type - 'ANY_EVENT' | 'STRUCTURED_EVENT' | 'SEQUENCE_EVENT' +%% Returns : +%% Effect : +%%---------------------------------------------------------------------- +connect_a_pull_supplier(undefined, _, _) -> + corba:raise(#'CosNotifyChannelAdmin_ChannelNotFound'{}); +connect_a_pull_supplier(Channel, PS, Type) -> + Admin = + 'CosNotifyChannelAdmin_EventChannel':'_get_default_supplier_admin'(Channel), + {Proxy, _Id} = + 'CosNotifyChannelAdmin_SupplierAdmin':obtain_notification_pull_consumer(Admin, + Type), + case Type of + 'ANY_EVENT' -> + 'CosNotifyChannelAdmin_ProxyPullConsumer':connect_any_pull_supplier(Proxy, PS); + 'STRUCTURED_EVENT' -> + 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':connect_structured_pull_supplier(Proxy, PS); + 'SEQUENCE_EVENT' -> + 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':connect_sequence_pull_supplier(Proxy, PS) + end, + Proxy. + +%%---------------------------------------------------------------------% +%% function : connect_a_push_supplier +%% Arguments: Channel - CosNotifyChannelAdmin::EventChannel | undefined +%% PC - a PushSupplier +%% Type - 'ANY_EVENT' | 'STRUCTURED_EVENT' | 'SEQUENCE_EVENT' +%% Returns : +%% Effect : +%%---------------------------------------------------------------------- +connect_a_push_supplier(undefined, _, _) -> + corba:raise(#'CosNotifyChannelAdmin_ChannelNotFound'{}); +connect_a_push_supplier(Channel, PS, Type) -> + Admin = + 'CosNotifyChannelAdmin_EventChannel':'_get_default_supplier_admin'(Channel), + {Proxy, _Id} = + 'CosNotifyChannelAdmin_SupplierAdmin':obtain_notification_push_consumer(Admin, + Type), + case Type of + 'ANY_EVENT' -> + 'CosNotifyChannelAdmin_ProxyPushConsumer':connect_any_push_supplier(Proxy, PS); + 'STRUCTURED_EVENT' -> + 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':connect_structured_push_supplier(Proxy, PS); + 'SEQUENCE_EVENT' -> + 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':connect_sequence_push_supplier(Proxy, PS) + end, + Proxy. + + +%%====================================================================== +%% END OF MODULE +%%====================================================================== + diff --git a/lib/cosEventDomain/src/Makefile b/lib/cosEventDomain/src/Makefile new file mode 100644 index 0000000000..56a67cd225 --- /dev/null +++ b/lib/cosEventDomain/src/Makefile @@ -0,0 +1,179 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2001-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% +# +# +include $(ERL_TOP)/make/target.mk +ifeq ($(TYPE),debug) +ERL_COMPILE_FLAGS += -Ddebug -W +endif +EBIN=../ebin +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Application version +# ---------------------------------------------------- +include ../vsn.mk +VSN=$(COSEVENTDOMAIN_VSN) + +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/lib/cosEventDomain-$(VSN) +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- + +MODULES = \ + CosEventDomainAdmin_EventDomainFactory_impl \ + CosEventDomainAdmin_EventDomain_impl \ + cosEventDomainApp + +ERL_FILES = $(MODULES:%=%.erl) +HRL_FILES = cosEventDomainApp.hrl + +EXTERNAL_INC_PATH = ../include + +GEN_ERL_FILES = \ + oe_CosEventDomainAdmin.erl \ + CosEventDomainAdmin.erl \ + CosEventDomainAdmin_DiamondSeq.erl \ + CosEventDomainAdmin_AlreadyExists.erl \ + CosEventDomainAdmin_DomainIDSeq.erl \ + CosEventDomainAdmin_Connection.erl \ + CosEventDomainAdmin_ConnectionIDSeq.erl \ + CosEventDomainAdmin_ConnectionNotFound.erl \ + CosEventDomainAdmin_CycleCreationForbidden.erl \ + CosEventDomainAdmin_CycleSeq.erl \ + CosEventDomainAdmin_DiamondCreationForbidden.erl \ + CosEventDomainAdmin_DomainNotFound.erl \ + CosEventDomainAdmin_EventDomain.erl \ + CosEventDomainAdmin_EventDomainFactory.erl \ + CosEventDomainAdmin_MemberIDSeq.erl \ + CosEventDomainAdmin_RouteSeq.erl + + + +GEN_HRL_FILES = \ + oe_CosEventDomainAdmin.hrl \ + CosEventDomainAdmin.hrl \ + CosEventDomainAdmin_EventDomainFactory.hrl \ + CosEventDomainAdmin_EventDomain.hrl + +EXTERNAL_GEN_HRL_FILES = \ + $(GEN_HRL_FILES:%=$(EXTERNAL_INC_PATH)/%) + + +TARGET_FILES = \ + $(GEN_ERL_FILES:%.erl=$(EBIN)/%.$(EMULATOR)) \ + $(MODULES:%=$(EBIN)/%.$(EMULATOR)) + +GEN_FILES = $(GEN_HRL_FILES) $(GEN_ERL_FILES) + +IDL_FILES = \ + CosEventDomainAdmin.idl + +APPUP_FILE = cosEventDomain.appup +APPUP_SRC = $(APPUP_FILE).src +APPUP_TARGET = $(EBIN)/$(APPUP_FILE) + +APP_FILE = cosEventDomain.app +APP_SRC = $(APP_FILE).src +APP_TARGET = $(EBIN)/$(APP_FILE) + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- +ERL_IDL_FLAGS += \ + -pa $(ERL_TOP)/lib/cosEventDomain/ebin \ + -pa $(ERL_TOP)/lib/cosEventDomain/include \ + -pa $(ERL_TOP)/lib/cosNotification/include \ + -pa $(ERL_TOP)/lib/cosNotification/ebin \ + -pa $(ERL_TOP)/lib/ic/ebin \ + -I$(ERL_TOP)/lib/cosNotification/include \ + -I$(ERL_TOP)/lib/cosNotification/ebin \ + -I$(ERL_TOP)/lib/cosNotification/src \ + -I$(ERL_TOP)/lib/cosEvent/src \ + -I$(ERL_TOP)/lib/cosEventDomain/include +# The -pa option is just used temporary until erlc can handle +# includes from other directories than ../include . +ERL_COMPILE_FLAGS += \ + $(ERL_IDL_FLAGS) \ + -pa $(ERL_TOP)/lib/cosEventDomain/include \ + -pa $(ERL_TOP)/lib/cosNotification/ebin \ + -pa $(ERL_TOP)/lib/cosNotification/include \ + -pa $(ERL_TOP)/lib/cosNotification/src \ + -I$(ERL_TOP)/lib/cosEventDomain/include \ + -I$(ERL_TOP)/lib/cosNotification/ebin \ + -I$(ERL_TOP)/lib/cosNotification/include \ + -I$(ERL_TOP)/lib/cosNotification/src \ + -I$(ERL_TOP)/lib/cosEvent/src \ + -I$(ERL_TOP)/lib/cosEvent/include \ + +'{parse_transform,sys_pre_attributes}' \ + +'{attribute,insert,app_vsn,"cosEventDomain_$(COSEVENTDOMAIN_VSN)"}' + +YRL_FLAGS = + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- +opt: $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) + +debug: + @${MAKE} TYPE=debug opt + +clean: + rm -f $(TARGET_FILES) $(GEN_FILES) $(APP_TARGET) $(APPUP_TARGET) + rm -f errs core *~ + +$(APP_TARGET): $(APP_SRC) + sed -e 's;%VSN%;$(VSN);' $(APP_SRC) > $(APP_TARGET) +$(APPUP_TARGET): $(APPUP_SRC) + sed -e 's;%VSN%;$(VSN);' $(APPUP_SRC) > $(APPUP_TARGET) + +docs: + +# ---------------------------------------------------- +# Special Build Targets +# ---------------------------------------------------- +$(GEN_ERL_FILES) $(EXTERNAL_GEN_HRL_FILES): CosEventDomainAdmin.idl + erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosEventDomainAdmin.cfg"}' CosEventDomainAdmin.idl + mv $(GEN_HRL_FILES) $(EXTERNAL_INC_PATH) + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + + +release_spec: opt + $(INSTALL_DIR) $(RELSYSDIR) + $(INSTALL_DATA) ../info $(RELSYSDIR) + $(INSTALL_DIR) $(RELSYSDIR)/ebin + $(INSTALL_DATA) $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) $(RELSYSDIR)/ebin + $(INSTALL_DIR) $(RELSYSDIR)/src + $(INSTALL_DATA) $(ERL_FILES) $(HRL_FILES) $(GEN_ERL_FILES) $(IDL_FILES) $(RELSYSDIR)/src + $(INSTALL_DIR) $(RELSYSDIR)/include + $(INSTALL_DATA) $(EXTERNAL_GEN_HRL_FILES) $(RELSYSDIR)/include + + +release_docs_spec: + + + + + diff --git a/lib/cosEventDomain/src/cosEventDomain.app.src b/lib/cosEventDomain/src/cosEventDomain.app.src new file mode 100644 index 0000000000..e4307e1f99 --- /dev/null +++ b/lib/cosEventDomain/src/cosEventDomain.app.src @@ -0,0 +1,31 @@ +{application, cosEventDomain, + [{description, "The Erlang CosEventDomain application"}, + {vsn, "%VSN%"}, + {modules, + [ + 'CosEventDomainAdmin_EventDomainFactory_impl', + 'CosEventDomainAdmin_EventDomain_impl', + 'cosEventDomainApp', + 'oe_CosEventDomainAdmin', + 'CosEventDomainAdmin', + 'CosEventDomainAdmin_DiamondSeq', + 'CosEventDomainAdmin_AlreadyExists', + 'CosEventDomainAdmin_DomainIDSeq', + 'CosEventDomainAdmin_Connection', + 'CosEventDomainAdmin_ConnectionIDSeq', + 'CosEventDomainAdmin_ConnectionNotFound', + 'CosEventDomainAdmin_CycleCreationForbidden', + 'CosEventDomainAdmin_CycleSeq', + 'CosEventDomainAdmin_DiamondCreationForbidden', + 'CosEventDomainAdmin_DomainNotFound', + 'CosEventDomainAdmin_EventDomain', + 'CosEventDomainAdmin_EventDomainFactory', + 'CosEventDomainAdmin_MemberIDSeq', + 'CosEventDomainAdmin_RouteSeq' + ] + }, + {registered, []}, + {applications, [orber, stdlib, kernel]}, + {env, []}, + {mod, {cosEventDomainApp, []}} +]}. diff --git a/lib/cosEventDomain/src/cosEventDomain.appup.src b/lib/cosEventDomain/src/cosEventDomain.appup.src new file mode 100644 index 0000000000..d69b2ef20c --- /dev/null +++ b/lib/cosEventDomain/src/cosEventDomain.appup.src @@ -0,0 +1,6 @@ +{"%VSN%", + [ + ], + [ + ] +} diff --git a/lib/cosEventDomain/src/cosEventDomainApp.erl b/lib/cosEventDomain/src/cosEventDomainApp.erl new file mode 100644 index 0000000000..d57f51443c --- /dev/null +++ b/lib/cosEventDomain/src/cosEventDomainApp.erl @@ -0,0 +1,363 @@ +%%-------------------------------------------------------------------- +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2001-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 : cosEventDomainApp.erl +%% Purpose : +%%-------------------------------------------------------------------- + +-module(cosEventDomainApp). + +%%--------------- INCLUDES ----------------------------------- +-include_lib("orber/include/corba.hrl"). +-include_lib("orber/include/ifr_types.hrl"). +-include_lib("cosNotification/include/CosNotification.hrl"). +%% Application files +-include("cosEventDomainApp.hrl"). +-include("CosEventDomainAdmin.hrl"). + +%%--------------- EXPORTS ------------------------------------ +%% External MISC +-export([get_option/3, + create_name/2, + create_name/1, + create_id/0, + create_id/1, + is_debug_compiled/0, + install/0, + uninstall/0, + start_factory/0, + start_factory/1, + start_factory_link/0, + start_factory_link/1, + stop_factory/1, + start/0, + stop/0, + create_link/3, + get_qos/1, + get_admin/1]). + +%% Application callbacks +-export([start/2, init/1, stop/1]). + +%%--------------- DEFINES ------------------------------------ + +-define(SUPERVISOR_NAME, oe_cosEventDomainSup). +-define(SUP_FLAG, {simple_one_for_one,50,10}). + +-define(SUP_SPEC(Name, Args), + ['CosEventDomainAdmin_EventDomain',Args, + [{sup_child, true}, {regname, {global, Name}}]]). +-define(SUP_CHILD, + {"oe_EventDomainChild", + {cosEventDomainApp,create_link, []}, + transient,100000,worker, + ['CosEventDomainAdmin_EventDomain']}). + + +-define(DEFAULT_OPTIONS, []). + +%%--------------- DEFINITIONS OF CONSTANTS ------------------- +%%--------------- EXTERNAL MISC FUNCTIONS -------------------- +%%-----------------------------------------------------------% +%% function : install +%% Arguments: +%% Returns : +%% Exception: +%% Effect : +%%------------------------------------------------------------ +install() -> + oe_CosEventDomainAdmin:oe_register(). + +%%-----------------------------------------------------------% +%% function : uninstall +%% Arguments: +%% Returns : +%% Exception: +%% Effect : +%%------------------------------------------------------------ +uninstall() -> + oe_CosEventDomainAdmin:oe_unregister(). + +%%-----------------------------------------------------------% +%% function : start/stop +%% Arguments: +%% Returns : +%% Effect : Starts or stops the cosTime application. +%%------------------------------------------------------------ + +start() -> + application:start(cosEventDomain). +stop() -> + application:stop(cosEventDomain). + +%%-----------------------------------------------------------% +%% function : start +%% Arguments: Type - see module application +%% Arg - see module application +%% Returns : +%% Effect : Module callback for application +%%------------------------------------------------------------ + +start(_, _) -> + supervisor:start_link({local, ?SUPERVISOR_NAME}, cosEventDomainApp, app_init). + + +%%-----------------------------------------------------------% +%% function : stop +%% Arguments: Arg - see module application +%% Returns : +%% Effect : Module callback for application +%%------------------------------------------------------------ + +stop(_) -> + ok. + +%%-----------------------------------------------------------% +%% function : start_channel +%% Arguments: - +%% Returns : +%% Effect : +%%------------------------------------------------------------ +start_factory() -> + start_factory(?DEFAULT_OPTIONS). + +start_factory(Options) when is_list(Options) -> + 'CosEventDomainAdmin_EventDomainFactory':oe_create(Options); +start_factory(Options) -> + orber:dbg("[~p] cosEventDomainApp:start_factory(~p);~n" + "Options not correct.", + [?LINE, Options], ?DEBUG_LEVEL), + corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). + +%%-----------------------------------------------------------% +%% function : start_channel +%% Arguments: - +%% Returns : +%% Effect : +%%------------------------------------------------------------ +start_factory_link() -> + start_factory_link(?DEFAULT_OPTIONS). + +start_factory_link(Options) when is_list(Options) -> + 'CosEventDomainAdmin_EventDomainFactory':oe_create_link(Options); +start_factory_link(Options) -> + orber:dbg("[~p] cosEventDomainApp:start_factory_link(~p);~n" + "Options not correct.", + [?LINE, Options], ?DEBUG_LEVEL), + corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). + +%%-----------------------------------------------------------% +%% function : stop_factory +%% Arguments: ChannelObj +%% Returns : +%% Effect : +%%------------------------------------------------------------ +stop_factory(ChannelObj) -> + corba:dispose(ChannelObj). + +%%-----------------------------------------------------------% +%% function : init +%% Arguments: +%% Returns : +%% Effect : +%%------------------------------------------------------------ + +%% Starting using create_factory/X +init(own_init) -> + {ok,{?SUP_FLAG, [?SUP_CHILD]}}; +%% When starting as an application. +init(app_init) -> + {ok,{?SUP_FLAG, [?SUP_CHILD]}}. + + +%%------------------------------------------------------------ +%% function : create_link +%% Arguments: Module - which Module to call +%% Env/ArgList - ordinary oe_create arguments. +%% Returns : +%% Exception: +%% Effect : Necessary since we want the supervisor to be a +%% 'simple_one_for_one'. Otherwise, using for example, +%% 'one_for_one', we have to call supervisor:delete_child +%% to remove the childs startspecification from the +%% supervisors internal state. +%%------------------------------------------------------------ +create_link(Module, Env, ArgList) -> + Module:oe_create_link(Env, ArgList). + +%%-----------------------------------------------------------% +%% function : get_option +%% Arguments: +%% Returns : +%% Exception: +%% Effect : +%%------------------------------------------------------------ +get_option(Key, OptionList, DefaultList) -> + case lists:keysearch(Key, 1, OptionList) of + {value,{Key,Value}} -> + Value; + _ -> + case lists:keysearch(Key, 1, DefaultList) of + {value,{Key,Value}} -> + Value; + _-> + {error, "Invalid option"} + end + end. +%%-----------------------------------------------------------% +%% function : create_name/2 +%% Arguments: +%% Returns : +%% Exception: +%% Effect : +%%------------------------------------------------------------ +create_name(Name,Type) -> + {MSec, Sec, USec} = erlang:now(), + lists:concat(['oe_',node(),'_',Type,'_',Name,'_',MSec, '_', Sec, '_', USec]). + +%%-----------------------------------------------------------% +%% function : create_name/1 +%% Arguments: +%% Returns : +%% Exception: +%% Effect : +%%------------------------------------------------------------ +create_name(Type) -> + {MSec, Sec, USec} = erlang:now(), + lists:concat(['oe_',node(),'_',Type,'_',MSec, '_', Sec, '_', USec]). + +%%------------------------------------------------------------ +%% function : create_id/0 +%% Arguments: - +%% Returns : CosEventDomainAdmin::DomainID (long) +%% Exception: +%% Purpose : +%%------------------------------------------------------------ +create_id(2147483647) -> + -2147483648; +create_id(OldID) -> + OldID+1. + + +create_id() -> + {_A,_B,C}=now(), + C. +%%------------------------------------------------------------ +%% function : get_qos +%% Arguments: +%% Returns : +%% Exception: +%% Effect : +%%------------------------------------------------------------ +get_qos([]) -> + []; +get_qos(Properties) -> + get_qos(Properties, [], []). + +get_qos([], Supported, []) -> + Supported; +get_qos([], _, Unsupported) -> + corba:raise(#'CosNotification_UnsupportedQoS'{qos_err = Unsupported}); +get_qos([#'CosNotification_Property'{name = ?CycleDetection, + value= #any{value = ?AuthorizeCycles}}|T], + Supported, Unsupported) -> + get_qos(T, [{?CycleDetection, ?AuthorizeCycles}|Supported], Unsupported); +get_qos([#'CosNotification_Property'{name = ?CycleDetection, + value= #any{value = ?ForbidCycles}}|T], + Supported, Unsupported) -> + get_qos(T, [{?CycleDetection, ?ForbidCycles}|Supported], Unsupported); +get_qos([#'CosNotification_Property'{name = ?CycleDetection}|T], + Supported, Unsupported) -> + %% Illegal value supplied. + get_qos(T, Supported, + [#'CosNotification_PropertyError' + {code = 'UNSUPPORTED_VALUE', + name = ?CycleDetection, + available_range = #'CosNotification_PropertyRange' + {low_val=any:create(orber_tc:short(), ?AuthorizeCycles), + high_val=any:create(orber_tc:short(), ?ForbidCycles)}}|Unsupported]); +get_qos([#'CosNotification_Property'{name = ?DiamondDetection, + value= #any{value = ?AuthorizeDiamonds}}|T], + Supported, Unsupported) -> + get_qos(T, [{?DiamondDetection, ?AuthorizeDiamonds}|Supported], Unsupported); +get_qos([#'CosNotification_Property'{name = ?DiamondDetection, + value= #any{value = ?ForbidDiamonds}}|T], + Supported, Unsupported) -> + get_qos(T, [{?DiamondDetection, ?ForbidDiamonds}|Supported], Unsupported); +get_qos([#'CosNotification_Property'{name = ?DiamondDetection}|T], + Supported, Unsupported) -> + %% Illegal value supplied. + get_qos(T, Supported, + [#'CosNotification_PropertyError' + {code = 'UNSUPPORTED_VALUE', + name = ?DiamondDetection, + available_range = #'CosNotification_PropertyRange' + {low_val=any:create(orber_tc:short(), ?AuthorizeDiamonds), + high_val=any:create(orber_tc:short(), ?ForbidDiamonds) + }} | Unsupported]); +get_qos([#'CosNotification_Property'{name = Name}|T], Supported, Unsupported) -> + %% Unknown QoS supplied. + get_qos(T, Supported, + [#'CosNotification_PropertyError' + {code = 'BAD_PROPERTY', + name = Name, + available_range = #'CosNotification_PropertyRange' + {low_val=any:create(orber_tc:null(), null), + high_val=any:create(orber_tc:null(), null)}} | Unsupported]). + +%%------------------------------------------------------------ +%% function : get_admin +%% Arguments: +%% Returns : {"EXCEPTION', #'CosNotification_PropertyError'{}} +%% Exception: +%% Effect : No Admin supported. +%%------------------------------------------------------------ +get_admin([]) -> + []; +get_admin(Properties) -> + get_admin(Properties, []). + +get_admin([], Unsupported) -> + corba:raise(#'CosNotification_UnsupportedAdmin'{admin_err = Unsupported}); +get_admin([#'CosNotification_Property'{name = Name}|T], Unsupported) -> + %% Unknown QoS supplied. + get_admin(T, [#'CosNotification_PropertyError' + {code = 'BAD_PROPERTY', + name = Name, + available_range = #'CosNotification_PropertyRange' + {low_val=any:create(orber_tc:null(), null), + high_val=any:create(orber_tc:null(), null)}} | Unsupported]). + + +%%------------------------------------------------------------ +%% function : is_debug_compiled +%% Arguments: +%% Returns : +%% Exception: +%% Effect : +%%------------------------------------------------------------ +-ifdef(debug). + is_debug_compiled() -> true. +-else. + is_debug_compiled() -> false. +-endif. + +%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosEventDomain/src/cosEventDomainApp.hrl b/lib/cosEventDomain/src/cosEventDomainApp.hrl new file mode 100644 index 0000000000..340bbc52d2 --- /dev/null +++ b/lib/cosEventDomain/src/cosEventDomainApp.hrl @@ -0,0 +1,69 @@ +%%---------------------------------------------------------------------- +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2001-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 : cosEventDomainApp.hrl +%% Purpose : +%%---------------------------------------------------------------------- + + +%%--------------- INCLUDES ----------------------------------- +%% External + +%% Local + +-define(write_ErrorMsg(Txt, Arg), +error_logger:error_msg("============== CosEventDomain =============~n" + Txt + "===========================================~n", + Arg)). + +-define(DEBUG_LEVEL, 3). + +-ifdef(debug). +-define(DBG(F,A), + io:format("[LINE: ~p MODULE: ~p] "++F,[?LINE, ?MODULE]++A)). +-else. +-define(DBG(F,A), ok). +-endif. + +%%%%%% WARNING! These definitions are defined in the CosEventDomainAdmin.idl +%%%%%% file. If the specification is changed so must the definitions!! +%%%%%% We use this approach to be able to use them as guards. + +%%%% Constant: 'CycleDetection' +-define(CycleDetection, "CycleDetection"). + +%%%% Constant: 'AuthorizeCycles' +-define(AuthorizeCycles, 0). + +%%%% Constant: 'ForbidCycles' +-define(ForbidCycles, 1). + +%%%% Constant: 'DiamondDetection' +-define(DiamondDetection, "DiamondDetection"). + +%%%% Constant: 'AuthorizeDiamonds' +-define(AuthorizeDiamonds, 0). + +%%%% Constant: 'ForbidDiamonds' +-define(ForbidDiamonds, 1). + +%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosEventDomain/vsn.mk b/lib/cosEventDomain/vsn.mk new file mode 100644 index 0000000000..81c0b49143 --- /dev/null +++ b/lib/cosEventDomain/vsn.mk @@ -0,0 +1,10 @@ + +COSEVENTDOMAIN_VSN = 1.1.7 + +TICKETS = OTP-8201 + +TICKETS_1.1.6 = OTP-7987 + +TICKETS_1.1.5 = OTP-7837 + +TICKETS_1.1.4 = OTP-7595 -- cgit v1.2.3