diff options
author | Erlang/OTP <otp@erlang.org> | 2009-11-20 14:54:40 +0000 |
---|---|---|
committer | Erlang/OTP <otp@erlang.org> | 2009-11-20 14:54:40 +0000 |
commit | 84adefa331c4159d432d22840663c38f155cd4c1 (patch) | |
tree | bff9a9c66adda4df2106dfd0e5c053ab182a12bd /lib/cosEventDomain | |
download | otp-84adefa331c4159d432d22840663c38f155cd4c1.tar.gz otp-84adefa331c4159d432d22840663c38f155cd4c1.tar.bz2 otp-84adefa331c4159d432d22840663c38f155cd4c1.zip |
The R13B03 release.OTP_R13B03
Diffstat (limited to 'lib/cosEventDomain')
41 files changed, 4488 insertions, 0 deletions
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 --- /dev/null +++ b/lib/cosEventDomain/doc/html/.gitignore diff --git a/lib/cosEventDomain/doc/man3/.gitignore b/lib/cosEventDomain/doc/man3/.gitignore new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/lib/cosEventDomain/doc/man3/.gitignore diff --git a/lib/cosEventDomain/doc/man6/.gitignore b/lib/cosEventDomain/doc/man6/.gitignore new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/lib/cosEventDomain/doc/man6/.gitignore diff --git a/lib/cosEventDomain/doc/pdf/.gitignore b/lib/cosEventDomain/doc/pdf/.gitignore new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/lib/cosEventDomain/doc/pdf/.gitignore 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 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE erlref SYSTEM "erlref.dtd"> + +<erlref> + <header> + <copyright> + <year>2002</year> + <year>2007</year> + <holder>Ericsson AB, All Rights Reserved</holder> + </copyright> + <legalnotice> + 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. + </legalnotice> + + <title>CosEventDomainAdmin</title> + <prepared>Niclas Eklund</prepared> + <responsible>Niclas Eklund</responsible> + <docno></docno> + <approved>Niclas Eklund</approved> + <checked></checked> + <date>2001-08-20</date> + <rev>PA1</rev> + </header> + <module>CosEventDomainAdmin</module> + <modulesummary>This module export functions which return QoS and Admin Properties constants.</modulesummary> + <description> + <p>To get access to all definitions include necessary <c><![CDATA[hrl]]></c> files by using:<br></br><c><![CDATA[-include_lib("cosEventDomain/include/*.hrl").]]></c></p> + </description> + <funcs> + <func> + <name>'CycleDetection'() -> string()</name> + <fsummary>Return the CycleDetection identifier required when defining QoS Properties</fsummary> + <desc> + <p>This function returns the CycleDetection identifier; required when + defining QoS Properties.</p> + </desc> + </func> + <func> + <name>'AuthorizeCycles'() -> short()</name> + <fsummary>Return the AuthorizeCycles value; required when defining QoS Properties</fsummary> + <desc> + <p>This function returns the AuthorizeCycles value; required when + defining QoS Properties.</p> + </desc> + </func> + <func> + <name>'ForbidCycles'() -> short()</name> + <fsummary>Return the ForbidCycles value; required when defining QoS Properties</fsummary> + <desc> + <p>This function returns the ForbidCycles value; required when + defining QoS Properties.</p> + </desc> + </func> + <func> + <name>'DiamondDetection'() -> string()</name> + <fsummary>Return the DiamondDetection identifier required when defining QoS Properties</fsummary> + <desc> + <p>This function returns the DiamondDetection identifier; required when + defining QoS Properties.</p> + </desc> + </func> + <func> + <name>'AuthorizeDiamonds'() -> short()</name> + <fsummary>Return the AuthorizeDiamonds value; required when defining QoS Properties</fsummary> + <desc> + <p>This function returns the AuthorizeDiamonds value; required when + defining QoS Properties.</p> + </desc> + </func> + <func> + <name>'ForbidDiamonds'() -> short()</name> + <fsummary>Return the ForbidDiamonds value; required when defining QoS Properties</fsummary> + <desc> + <p>This function returns the ForbidDiamonds value; required when + defining QoS Properties.</p> + </desc> + </func> + </funcs> + +</erlref> + 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 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE erlref SYSTEM "erlref.dtd"> + +<erlref> + <header> + <copyright> + <year>2001</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + 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. + + </legalnotice> + + <title>CosEventDomainAdmin_­EventDomain</title> + <shorttitle>..._EventDomain</shorttitle> + <prepared></prepared> + <docno></docno> + <approved>Niclas Eklund</approved> + <checked></checked> + <date>2001-08-20</date> + <rev>PA1</rev> + </header> + <module>CosEventDomainAdmin_EventDomain</module> + <modulesummary>This module implements the Event Domain interface.</modulesummary> + <description> + <p>To get access to all definitions include necessary <c><![CDATA[hrl]]></c> files by using:<br></br><c><![CDATA[-include_lib("cosEventDomain/include/*.hrl").]]></c></p> + <p>This module also exports the functions described in:</p> + <list type="bulleted"> + <item><em>CosNotification_QoSAdmin</em></item> + <item><em>CosNotification_AdminPropertiesAdmin</em></item> + </list> + </description> + <funcs> + <func> + <name>add_channel(EventDomain, Channel) -> MemberID</name> + <fsummary>Add a new channel to the EventDomain</fsummary> + <type> + <v>EventDomain = Channel = #objref</v> + <v>MemberID = long()</v> + </type> + <desc> + <p>Adds the given channel to the target domain. The channel + must be a <c><![CDATA[CosNotifyChannelAdmin::EventChannel]]></c>.</p> + </desc> + </func> + <func> + <name>get_all_channels(EventDomain) -> MemberIDSeq</name> + <fsummary>Return all channel id's associated with target object</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>MemberIDSeq = [long()]</v> + </type> + <desc> + <p>Returns a a sequence of all channels associated with + the target object.</p> + </desc> + </func> + <func> + <name>get_channel(EventDomain, MemberID) -> Reply</name> + <fsummary>Return the channel associated with the given id</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>MemberID = long()</v> + <v>Reply = Channel | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}</v> + <v>Channel = #objref</v> + </type> + <desc> + <p>If the target domain have a <c><![CDATA[CosNotifyChannelAdmin::EventChannel]]></c> + represented by the given id this channel is returned. Otherwise, + an exception is raised.</p> + </desc> + </func> + <func> + <name>remove_channel(EventDomain, MemberID) -> Reply</name> + <fsummary>Remove the channel associated with the given id and remove all connections of that channel</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>MemberID = long()</v> + <v>Reply = ok | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}</v> + </type> + <desc> + <p>If a <c><![CDATA[CosNotifyChannelAdmin::EventChannel]]></c> with the + <c><![CDATA[MemberID]]></c> exists it will removed and all its <c><![CDATA[Connections]]></c> + terminated. Otherwise an exception is raised.</p> + </desc> + </func> + <func> + <name>add_connection(EventDomain, Connection) -> Reply</name> + <fsummary>If possible, setup a connection described by the <c><![CDATA[#'CosEventDomainAdmin_Connection'{}]]></c>struct</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>Connection = 'CosEventDomainAdmin_Connection'{supplier_id=MemberID, consumer_id=MemberID, ctype=Type, notification_style=Style}</v> + <v>MemberID = long()</v> + <v>Type = 'ANY_EVENT' | 'STRUCTURED_EVENT' | 'SEQUENCE_EVENT'</v> + <v>Style = 'Pull' | 'Push'</v> + <v>Reply = ConnectionID | {'EXCEPTION', Exc}</v> + <v>ConnectionID = long()</v> + <v>Exc = #'CosNotifyChannelAdmin_ChannelNotFound'{} | #'CosNotifyChannelAdmin_TypeError'{} | #'CosEventDomainAdmin_AlreadyExists'{} | #'CosEventDomainAdmin_DiamondCreationForbidden'{diam=RouteSeq} | #'CosEventDomainAdmin_CycleCreationForbidden'{cyc=MemberIDSeq}</v> + <v>RouteSeq = [MemberIDSeq]</v> + <v>MemberIDSeq = [long()]</v> + </type> + <desc> + <p>The Connection parameter must contain valid data to enable + the target domain to setup a connection between two channels. + The struct members <c><![CDATA[supplier_id]]></c> and <c><![CDATA[consumer_id]]></c> + 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 <c><![CDATA[ctype]]></c> and + <c><![CDATA[notification_style]]></c> respectively.</p> + <p>If the target domain is not able to setup the connection + the appropriate exception is raised.</p> + </desc> + </func> + <func> + <name>get_all_connections(EventDomain) -> ConnectionIDSeq</name> + <fsummary>Return a sequence of all connections within the target domain</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>ConnectionIDSeq = [long()]</v> + </type> + <desc> + <p>This operation returns a sequence of all connections within + the target domain.</p> + </desc> + </func> + <func> + <name>get_connection(EventDomain, ConnectionID) -> Reply</name> + <fsummary>Return a <c><![CDATA[#'CosEventDomainAdmin_Connection'{}]]></c>struct describing the connection associated with the given id within the target domain</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>ConnectionID = long()</v> + <v>Reply = Connection | {'EXCEPTION', #'CosEventDomainAdmin_ConnectionNotFound'{}}</v> + <v>Connection = 'CosEventDomainAdmin_Connection'{supplier_id=MemberID, consumer_id=MemberID, ctype=Type, notification_style=Style}</v> + <v>MemberID = long()</v> + <v>Type = 'ANY_EVENT' | 'STRUCTURED_EVENT' | 'SEQUENCE_EVENT'</v> + <v>Style = 'Pull' | 'Push'</v> + </type> + <desc> + <p>If a connection identified by the given id exists within the + target domain, a <c><![CDATA[#'CosEventDomainAdmin_Connection'{}]]></c> which + describe the connection is returned. Otherwise, an exception + is raised.</p> + </desc> + </func> + <func> + <name>remove_connection(EventDomain, ConnectionID) -> Reply</name> + <fsummary>Remove the connection identified by the given id from the target domain</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>ConnectionID = long()</v> + <v>Reply = ok | {'EXCEPTION', #'CosEventDomainAdmin_ConnectionNotFound'{}}</v> + </type> + <desc> + <p>If the supplied connection id exists, the connection the + id represents is terminated. Otherwise, an exception is raised.</p> + </desc> + </func> + <func> + <name>get_offer_channels(EventDomain, MemberID) -> Reply</name> + <fsummary>Return all id's of the channels which produce events received by the channel identified by the given id</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>MemberID = long()</v> + <v>Reply = MemberIDSeq | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}</v> + </type> + <desc> + <p>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.</p> + </desc> + </func> + <func> + <name>get_subscription_channels(EventDomain, MemberID) -> Reply</name> + <fsummary>Return all id's of the channels which consume events supplied by the channel identified by the given id</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>Reply = MemberIDSeq | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}</v> + </type> + <desc> + <p>This operations behaves like <c><![CDATA[get_subscription_channels]]></c>; + the difference is that the id's returned identifies channels + which will consume events supplied by the channel associated + with the given id.</p> + </desc> + </func> + <func> + <name>destroy(EventDomain) -> ok</name> + <fsummary>Destroy the event domain and all connections within it</fsummary> + <type> + <v>EventDomain = #objref</v> + </type> + <desc> + <p>Calling this operation will terminate all connections + within the target domain. The domain will terminate but + all channels will not be affected.</p> + </desc> + </func> + <func> + <name>get_cycles(EventDomain) -> RouteSeq</name> + <fsummary>Return a list of all cycles which exists within the target domain</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>RouteSeq = [MemberIDSeq]</v> + <v>MemberIDSeq = [long()]</v> + </type> + <desc> + <p>Returns a list of all cycles within the target domain.</p> + </desc> + </func> + <func> + <name>get_diamonds(EventDomain) -> DiamondSeq</name> + <fsummary>Return a list of all diamonds which exists within the target domain</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>DiamondSeq = [RouteSeq]</v> + <v>RouteSeq = [MemberIDSeq]</v> + <v>MemberIDSeq = [long()]</v> + </type> + <desc> + <p>Returns a list of all diamonds within the target domain</p> + </desc> + </func> + <func> + <name>set_default_consumer_channel(EventDomain, MemberID) -> Reply</name> + <fsummary>Set the channel represented by the given id as default for supplier clients</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>Reply = MemberID | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}</v> + <v>MemberID = long()</v> + </type> + <desc> + <p>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.</p> + </desc> + </func> + <func> + <name>set_default_supplier_channel(EventDomain, MemberID) -> Reply</name> + <fsummary>Set the channel represented by the given id as default for supplier clients</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>Reply = MemberID | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}</v> + <v>MemberID = long()</v> + </type> + <desc> + <p>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.</p> + </desc> + </func> + <func> + <name>connect_push_consumer(EventDomain, Consumer) -> Reply</name> + <fsummary>Connect the PushConsumer to the default Channel</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>Consumer = CosEventComm::PushConsumer</v> + <v>Reply = CosNotifyChannelAdmin::ProxyPushSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}</v> + </type> + <desc> + <p>If a default Channel have been set, this operation connects the given + PushConsumer to it. Otherwise, the + <c><![CDATA[#'CosNotifyChannelAdmin_ChannelNotFound'{}]]></c> exception is raised.</p> + </desc> + </func> + <func> + <name>connect_pull_consumer(EventDomain, Consumer) -> Reply</name> + <fsummary>Connect the PullConsumer to the default Channel</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>Consumer = CosEventComm::PullConsumer</v> + <v>Reply = CosNotifyChannelAdmin::ProxyPullSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}</v> + </type> + <desc> + <p>If a default Channel have been set, this operation connects the given + PullConsumer to it. Otherwise, the + <c><![CDATA[#'CosNotifyChannelAdmin_ChannelNotFound'{}]]></c> exception is raised.</p> + </desc> + </func> + <func> + <name>connect_push_supplier(EventDomain, Supplier) -> Reply</name> + <fsummary>Connect the PushSupplier to the default Channel</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>Supplier = CosEventComm::PushSupplier</v> + <v>Reply = CosNotifyChannelAdmin::ProxyPushConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}</v> + </type> + <desc> + <p>If a default Channel have been set, this operation connects the given + PushSupplier to it. Otherwise, the + <c><![CDATA[#'CosNotifyChannelAdmin_ChannelNotFound'{}]]></c> exception is raised.</p> + </desc> + </func> + <func> + <name>connect_pull_supplier(EventDomain, Supplier) -> Reply</name> + <fsummary>Connect the PullSupplier to the default Channel</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>Supplier = CosEventComm::PullSupplier</v> + <v>Reply = CosNotifyChannelAdmin::ProxyPushConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}</v> + </type> + <desc> + <p>If a default Channel have been set, this operation connects the given + PullSupplier to it. Otherwise, the + <c><![CDATA[#'CosNotifyChannelAdmin_ChannelNotFound'{}]]></c> exception is raised.</p> + </desc> + </func> + <func> + <name>connect_structured_push_consumer(EventDomain, Consumer) -> Reply</name> + <fsummary>Connect the StructuredPushConsumer to the default Channel</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>Consumer = CosNotifyComm::StructuredPushConsumer</v> + <v>Reply = CosNotifyChannelAdmin::StructuredProxyPushSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}</v> + </type> + <desc> + <p>If a default Channel have been set, this operation connects the given + StructuredPushConsumer to it. Otherwise, the + <c><![CDATA[#'CosNotifyChannelAdmin_ChannelNotFound'{}]]></c> exception is raised.</p> + </desc> + </func> + <func> + <name>connect_structured_pull_consumer(EventDomain, Consumer) -> Reply</name> + <fsummary>Connect the StructuredPullConsumer to the default Channel</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>Consumer = CosNotifyComm::StructuredPullConsumer</v> + <v>Reply = CosNotifyChannelAdmin::StructuredProxyPullSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}</v> + </type> + <desc> + <p>If a default Channel have been set, this operation connects the given + StructuredPullConsumer to it. Otherwise, the + <c><![CDATA[#'CosNotifyChannelAdmin_ChannelNotFound'{}]]></c> exception is raised.</p> + </desc> + </func> + <func> + <name>connect_structured_push_supplier(EventDomain, Supplier) -> Reply</name> + <fsummary>Connect the StructuredPushSupplier to the default Channel</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>Supplier = CosNotifyComm::StructuredPushSupplier</v> + <v>Reply = CosNotifyChannelAdmin::StructuredProxyPushConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}</v> + </type> + <desc> + <p>If a default Channel have been set, this operation connects the given + StructuredPushSupplier to it. Otherwise, the + <c><![CDATA[#'CosNotifyChannelAdmin_ChannelNotFound'{}]]></c> exception is raised.</p> + </desc> + </func> + <func> + <name>connect_structured_pull_supplier(EventDomain, Supplier) -> Reply</name> + <fsummary>Connect the StructuredPullSupplier to the default Channel</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>Supplier = CosNotifyComm::StructuredPullSupplier</v> + <v>Reply = CosNotifyChannelAdmin::StructuredProxyPullConsume | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}</v> + </type> + <desc> + <p>If a default Channel have been set, this operation connects the given + StructuredPullSupplier to it. Otherwise, the + <c><![CDATA[#'CosNotifyChannelAdmin_ChannelNotFound'{}]]></c> exception is raised.</p> + </desc> + </func> + <func> + <name>connect_sequence_push_consumer(EventDomain, Consumer) -> Reply</name> + <fsummary>Connect the SequencePushConsumer to the default Channel</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>Consumer = CosNotifyComm::SequencePushConsumer</v> + <v>Reply = CosNotifyChannelAdmin::SequenceProxyPushSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}</v> + </type> + <desc> + <p>If a default Channel have been set, this operation connects the given + SequencePushConsumer to it. Otherwise, the + <c><![CDATA[#'CosNotifyChannelAdmin_ChannelNotFound'{}]]></c> exception is raised.</p> + </desc> + </func> + <func> + <name>connect_sequence_pull_consumer(EventDomain, Consumer) -> Reply</name> + <fsummary>Connect the SequencePullConsumer to the default Channel</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>Consumer = CosNotifyComm::SequencePullConsumer</v> + <v>Reply = CosNotifyChannelAdmin::SequenceProxyPullSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}</v> + </type> + <desc> + <p>If a default Channel have been set, this operation connects the given + SequencePullConsumer to it. Otherwise, the + <c><![CDATA[#'CosNotifyChannelAdmin_ChannelNotFound'{}]]></c> exception is raised.</p> + </desc> + </func> + <func> + <name>connect_sequence_push_supplier(EventDomain, Supplier) -> Reply</name> + <fsummary>Connect the SequencePushSupplier to the default Channel</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>Supplier = CosNotifyComm::SequencePushSupplier</v> + <v>Reply = CosNotifyChannelAdmin::SequenceProxyPushConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}</v> + </type> + <desc> + <p>If a default Channel have been set, this operation connects the given + SequencePushSupplier to it. Otherwise, the + <c><![CDATA[#'CosNotifyChannelAdmin_ChannelNotFound'{}]]></c> exception is raised.</p> + </desc> + </func> + <func> + <name>connect_sequence_pull_supplier(EventDomain, Supplier) -> Reply</name> + <fsummary>Connect the SequencePullSupplier to the default Channel</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>Supplier = CosNotifyComm::SequencePullSupplier</v> + <v>Reply = CosNotifyChannelAdmin::SequenceProxyPullConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}</v> + </type> + <desc> + <p>If a default Channel have been set, this operation connects the given + SequencePullSupplier to it. Otherwise, the + <c><![CDATA[#'CosNotifyChannelAdmin_ChannelNotFound'{}]]></c> exception is raised.</p> + </desc> + </func> + <func> + <name>connect_push_consumer_with_id(EventDomain, Consumer, MemberID) -> Reply</name> + <fsummary>Connect the PushConsumer to the Channel with the given MemberID</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>Consumer = CosEventComm::PushConsumer</v> + <v>MemberID = long()</v> + <v>Reply = CosNotifyChannelAdmin::ProxyPushSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}</v> + </type> + <desc> + <p>If a Channel associated with the given MemberID exists within the + target Domain, this operation connects the given PushConsumer + to it. Otherwise, the <c><![CDATA[#'CosNotifyChannelAdmin_ChannelNotFound'{}]]></c> + exception is raised.</p> + </desc> + </func> + <func> + <name>connect_pull_consumer_with_id(EventDomain, Consumer, MemberID) -> Reply</name> + <fsummary>Connect the PullConsumer to the Channel with the given MemberID</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>Consumer = CosEventComm::PullConsumer</v> + <v>MemberID = long()</v> + <v>Reply = CosNotifyChannelAdmin::ProxyPullSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}</v> + </type> + <desc> + <p>If a Channel associated with the given MemberID exists within the + target Domain, this operation connects the given PullConsumer + to it. Otherwise, the <c><![CDATA[#'CosNotifyChannelAdmin_ChannelNotFound'{}]]></c> + exception is raised.</p> + </desc> + </func> + <func> + <name>connect_push_supplier_with_id(EventDomain, Supplier, MemberID) -> Reply</name> + <fsummary>Connect the PushSupplier to the Channel with the given MemberID</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>Supplier = CosEventComm::PushSupplier</v> + <v>MemberID = long()</v> + <v>Reply = CosNotifyChannelAdmin::ProxyPushConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}</v> + </type> + <desc> + <p>If a Channel associated with the given MemberID exists within the + target Domain, this operation connects the given PushSupplier + to it. Otherwise, the <c><![CDATA[#'CosNotifyChannelAdmin_ChannelNotFound'{}]]></c> + exception is raised.</p> + </desc> + </func> + <func> + <name>connect_pull_supplier_with_id(EventDomain, Supplier, MemberID) -> Reply</name> + <fsummary>Connect the PullSupplier to the Channel with the given MemberID</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>Supplier = CosEventComm::PullSupplier</v> + <v>MemberID = long()</v> + <v>Reply = CosNotifyChannelAdmin::ProxyPushConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}</v> + </type> + <desc> + <p>If a Channel associated with the given MemberID exists within the + target Domain, this operation connects the given PullSupplier + to it. Otherwise, the <c><![CDATA[#'CosNotifyChannelAdmin_ChannelNotFound'{}]]></c> + exception is raised.</p> + </desc> + </func> + <func> + <name>connect_structured_push_consumer_with_id(EventDomain, Consumer, MemberID) -> Reply</name> + <fsummary>Connect the StructuredPushConsumer to the Channel with the given MemberID</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>Consumer = CosNotifyComm::StructuredPushConsumer</v> + <v>MemberID = long()</v> + <v>Reply = CosNotifyChannelAdmin::StructuredProxyPushSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}</v> + </type> + <desc> + <p>If a Channel associated with the given MemberID exists within the + target Domain, this operation connects the given StructuredPushConsumer + to it. Otherwise, the <c><![CDATA[#'CosNotifyChannelAdmin_ChannelNotFound'{}]]></c> + exception is raised.</p> + </desc> + </func> + <func> + <name>connect_structured_pull_consumer_with_id(EventDomain, Consumer, MemberID) -> Reply</name> + <fsummary>Connect the StructuredPullConsumer to the Channel with the given MemberID</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>Consumer = CosNotifyComm::StructuredPullConsumer</v> + <v>MemberID = long()</v> + <v>Reply = CosNotifyChannelAdmin::StructuredProxyPullSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}</v> + </type> + <desc> + <p>If a Channel associated with the given MemberID exists within the + target Domain, this operation connects the given StructuredPullConsumer + to it. Otherwise, the <c><![CDATA[#'CosNotifyChannelAdmin_ChannelNotFound'{}]]></c> + exception is raised.</p> + </desc> + </func> + <func> + <name>connect_structured_push_supplier_with_id(EventDomain, Supplier, MemberID) -> Reply</name> + <fsummary>Connect the StructuredPushSupplier to the Channel with the given MemberID</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>Supplier = CosNotifyComm::StructuredPushSupplier</v> + <v>MemberID = long()</v> + <v>Reply = CosNotifyChannelAdmin::StructuredProxyPushConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}</v> + </type> + <desc> + <p>If a Channel associated with the given MemberID exists within the + target Domain, this operation connects the given StructuredPushSupplier + to it. Otherwise, the <c><![CDATA[#'CosNotifyChannelAdmin_ChannelNotFound'{}]]></c> + exception is raised.</p> + </desc> + </func> + <func> + <name>connect_structured_pull_supplier_with_id(EventDomain, Supplier, MemberID) -> Reply</name> + <fsummary>Connect the StructuredPullSupplier to the Channel with the given MemberID</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>Supplier = CosNotifyComm::StructuredPullSupplier</v> + <v>MemberID = long()</v> + <v>Reply = CosNotifyChannelAdmin::StructuredProxyPullConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}</v> + </type> + <desc> + <p>If a Channel associated with the given MemberID exists within the + target Domain, this operation connects the given StructuredPullSupplier + to it. Otherwise, the <c><![CDATA[#'CosNotifyChannelAdmin_ChannelNotFound'{}]]></c> + exception is raised.</p> + </desc> + </func> + <func> + <name>connect_sequence_push_consumer_with_id(EventDomain, Consumer, MemberID) -> Reply</name> + <fsummary>Connect the SequencePushConsumer to the Channel with the given MemberID</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>Consumer = CosNotifyComm::SequencePushConsumer</v> + <v>MemberID = long()</v> + <v>Reply = CosNotifyChannelAdmin::SequenceProxyPushSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}</v> + </type> + <desc> + <p>If a Channel associated with the given MemberID exists within the + target Domain, this operation connects the given SequencePushConsumer + to it. Otherwise, the <c><![CDATA[#'CosNotifyChannelAdmin_ChannelNotFound'{}]]></c> + exception is raised.</p> + </desc> + </func> + <func> + <name>connect_sequence_pull_consumer_with_id(EventDomain, Consumer, MemberID) -> Reply</name> + <fsummary>Connect the SequencePullConsumer to the Channel with the given MemberID</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>Consumer = CosNotifyComm::SequencePullConsumer</v> + <v>MemberID = long()</v> + <v>Reply = CosNotifyChannelAdmin::SequenceProxyPullSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}</v> + </type> + <desc> + <p>If a Channel associated with the given MemberID exists within the + target Domain, this operation connects the given SequencePullConsumer + to it. Otherwise, the <c><![CDATA[#'CosNotifyChannelAdmin_ChannelNotFound'{}]]></c> + exception is raised.</p> + </desc> + </func> + <func> + <name>connect_sequence_push_supplier_with_id(EventDomain, Supplier, MemberID) -> Reply</name> + <fsummary>Connect the SequencePushSupplier to the Channel with the given MemberID</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>Supplier = CosNotifyComm::SequencePushSupplier</v> + <v>MemberID = long()</v> + <v>Reply = CosNotifyChannelAdmin::SequenceProxyPushConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}</v> + </type> + <desc> + <p>If a Channel associated with the given MemberID exists within the + target Domain, this operation connects the given SequencePushSupplier + to it. Otherwise, the <c><![CDATA[#'CosNotifyChannelAdmin_ChannelNotFound'{}]]></c> + exception is raised.</p> + </desc> + </func> + <func> + <name>connect_sequence_pull_supplier_with_id(EventDomain, Supplier, MemberID) -> Reply</name> + <fsummary>Connect the SequencePullSupplier to the Channel with the given MemberID</fsummary> + <type> + <v>EventDomain = #objref</v> + <v>Supplier = CosNotifyComm::SequencePullSupplier</v> + <v>MemberID = long()</v> + <v>Reply = CosNotifyChannelAdmin::SequenceProxyPullConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}</v> + </type> + <desc> + <p>If a Channel associated with the given MemberID exists within the + target Domain, this operation connects the given SequencePullSupplier + to it. Otherwise, the <c><![CDATA[#'CosNotifyChannelAdmin_ChannelNotFound'{}]]></c> + exception is raised.</p> + </desc> + </func> + </funcs> + +</erlref> + 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 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE erlref SYSTEM "erlref.dtd"> + +<erlref> + <header> + <copyright> + <year>2001</year> + <year>2007</year> + <holder>Ericsson AB, All Rights Reserved</holder> + </copyright> + <legalnotice> + 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. + </legalnotice> + + <title>CosEventDomainAdmin_­EventDomainFactory</title> + <shorttitle>..._EventChannel</shorttitle> + <prepared>Niclas Eklund</prepared> + <responsible>Niclas Eklund</responsible> + <docno></docno> + <approved>Niclas Eklund</approved> + <checked></checked> + <date>2001-08-20</date> + <rev>PA1</rev> + </header> + <module>CosEventDomainAdmin_EventDomainFactory</module> + <modulesummary>This module implements an Event Domain Factory interface, which is used to create new Event Domain instances.</modulesummary> + <description> + <p>To get access to all definitions include necessary <c><![CDATA[hrl]]></c> files by using:<br></br><c><![CDATA[-include_lib("cosEventDomain/include/*.hrl").]]></c></p> + </description> + <funcs> + <func> + <name>create_event_domain(Factory, QoS, Admin) -> Reply</name> + <fsummary>Create a new ConsumerAdmin object</fsummary> + <type> + <v>Factory = #objref</v> + <v>QoS = CosNotification::QoSProperties</v> + <v>Admin = CosNotification::AdminProperties</v> + <v>Reply = {EventDomain, DomainID} | {'EXCEPTION', #'CosNotification_UnsupportedQoS'{}} | {'EXCEPTION', #'CosNotification_UnsupportedAdmin'{}}</v> + <v>EventDomain = #objref</v> + </type> + <desc> + <p>To create a new EventDomain this operation is used. If it is not + possible to support the given <c><![CDATA[QoSProperties]]></c> or <c><![CDATA[AdminProperties]]></c> + an exception is raised, which list the properties not supported. For more + information see the <c><![CDATA[cosNotification]]></c> user's guide.</p> + </desc> + </func> + <func> + <name>get_all_domains(Factory) -> DomainIDSeq</name> + <fsummary>Return a DomainID sequence of all domains associated with the target object</fsummary> + <type> + <v>Factory = #objref</v> + <v>DomainIDSeq = [long()]</v> + </type> + <desc> + <p>This function returns a DomainID sequence of all domains associated with the + target object.</p> + </desc> + </func> + <func> + <name>get_event_domain(Factory, DomainID) -> Reply</name> + <fsummary>Return the domain associated with the given id</fsummary> + <type> + <v>Factory = #objref</v> + <v>DomainID = long()</v> + <v>Reply = EventDomain | {'EXCEPTION', #'CosEventDomainAdmin_DomainNotFound'{}}</v> + <v>EventDomain = #objref</v> + </type> + <desc> + <p>This operation returns the EventDomain object associated with the + given DomainID. If no such binding exists an exception is raised.</p> + </desc> + </func> + </funcs> + +</erlref> + 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 Binary files differnew file mode 100644 index 0000000000..94b3868792 --- /dev/null +++ b/lib/cosEventDomain/doc/src/book.gif 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 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE book SYSTEM "book.dtd"> + +<book xmlns:xi="http://www.w3.org/2001/XInclude"> + <header titlestyle="normal"> + <copyright> + <year>2001</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + 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. + + </legalnotice> + + <title>cosEventDomain</title> + <prepared>Niclas Eklund</prepared> + <docno></docno> + <date>2001-08-20</date> + <rev>1.0</rev> + </header> + <insidecover> + </insidecover> + <pagetext>cosEventDomain</pagetext> + <preamble> + <contents level="2"></contents> + </preamble> + <parts lift="no"> + <xi:include href="part.xml"/> + </parts> + <applications> + <xi:include href="ref_man.xml"/> + </applications> + <releasenotes> + <xi:include href="notes.xml"/> + </releasenotes> + <listofterms></listofterms> + <index></index> +</book> + 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 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE chapter SYSTEM "chapter.dtd"> + +<chapter> + <header> + <copyright> + <year>2002</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + 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. + + </legalnotice> + + <title>Quality Of Service and Admin Properties</title> + <prepared></prepared> + <docno></docno> + <date>2000-05-29</date> + <rev></rev> + <file>ch_QoS.xml</file> + </header> + + <section> + <title>Quality Of Service and Admin Properties</title> + <p>This chapter explains the allowed properties it is possible to set for this + application. </p> + + <section> + <title>Quality Of Service</title> + <p>The cosEventDomain application supports the following QoS settings:</p> + <table> + <row> + <cell align="center" valign="middle"><em>QoS</em></cell> + <cell align="center" valign="middle"><em>Range</em></cell> + <cell align="center" valign="middle"><em>Default</em></cell> + </row> + <row> + <cell align="left" valign="middle">CycleDetection</cell> + <cell align="left" valign="middle">AuthorizeCycles/ForbidCycles</cell> + <cell align="left" valign="middle">ForbidCycles</cell> + </row> + <row> + <cell align="left" valign="middle">DiamondDetection</cell> + <cell align="left" valign="middle">AuthorizeDiamonds/ForbidDiamonds</cell> + <cell align="left" valign="middle">ForbidDiamonds</cell> + </row> + <tcaption>Supported QoS settings</tcaption> + </table> +<br></br><br></br><br></br><br></br> <p><em>Comments on the table 'Supported QoS Settings':</em></p> + <taglist> + <tag><em>CycleDetection</em></tag> + <item>If a cycle is created, the user <em>must</em> be aware of the fact + that unless they set timeout on events, events that are not filtered + will loop endlessly through the topology.</item> + <tag><em>DiamondDetection</em></tag> + <item>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.</item> + </taglist> + </section> + + <section> + <title>Setting Quality Of Service</title> + <p>Assume we have a Consumer Admin object which we want to change + the current Quality of Service. Typical usage:</p> + <code type="none"><![CDATA[ +QoS = + [#'CosNotification_Property' + {name='CosEventDomainAdmin':'DiamondDetection'(), + value=any:create(orber_tc:short(), + 'CosEventDomainAdmin':'AuthorizeDiamonds'())}, + #'CosNotification_Property' + {name='CosEventDomainAdmin':'CycleDetection'(), + value=any:create(orber_tc:short(), + 'CosEventDomainAdmin':'ForbidCycles'())}], +'CosEventDomainAdmin_EventDomain':set_qos(ED, QoS), + ]]></code> + <p>If it is not possible to set the requested QoS the <c><![CDATA[UnsupportedQoS]]></c> + exception is raised, which includes a sequence of <c><![CDATA[PropertyError]]></c>'s + describing which QoS, possible range and why is not allowed. The error + codes are:</p> + <list type="bulleted"> + <item>UNSUPPORTED_PROPERTY - QoS not supported for this type of target object.</item> + <item>UNAVAILABLE_PROPERTY - due to current QoS settings the given property + is not allowed.</item> + <item>UNSUPPORTED_VALUE - property value out of range; valid range is returned.</item> + <item>UNAVAILABLE_VALUE - due to current QoS settings the given value is + not allowed; valid range is returned.</item> + <item>BAD_PROPERTY - unrecognized property.</item> + <item>BAD_TYPE - type of supplied property is incorrect.</item> + <item>BAD_VALUE - illegal value.</item> + </list> + <p>The CosEventDomainAdmin_EventDomain interface also supports an operation + called <c><![CDATA[validate_qos/2]]></c>. 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.</p> + </section> + + <section> + <title>Admin Properties</title> + <p>The OMG specification do not contain any definitions of Admin Properties. + Hence, the cosEventDomain application currently does not support any Admin + Properties.</p> + </section> + </section> +</chapter> + 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 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE chapter SYSTEM "chapter.dtd"> + +<chapter> + <header> + <copyright> + <year>2001</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + 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. + + </legalnotice> + + <title>The cosEventDomain Application</title> + <prepared>Niclas Eklund</prepared> + <docno></docno> + <date>2001-08-20</date> + <rev>B</rev> + <file>ch_contents.xml</file> + </header> + + <section> + <title>Content Overview</title> + <p>The cosEventDomain documentation is divided into three sections: + </p> + <list type="bulleted"> + <item> + <p>PART ONE - The User's Guide + <br></br>Description of the cosEventDomain Application including + services and a small tutorial demonstrating + the development of a simple service.</p> + </item> + <item> + <p>PART TWO - Release Notes + <br></br>A concise history of cosEventDomain.</p> + </item> + <item> + <p>PART THREE - The Reference Manual + <br></br> A quick reference guide, including a + brief description, to all the functions available in cosEventDomain.</p> + </item> + </list> + </section> + + <section> + <title>Brief Description of the User's Guide</title> + <p>The User's Guide contains the following parts:</p> + <list type="bulleted"> + <item> + <p>CosEventDomain overview</p> + </item> + <item> + <p>CosEventDomain installation and examples</p> + </item> + </list> + </section> +</chapter> + 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 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE chapter SYSTEM "chapter.dtd"> + +<chapter> + <header> + <copyright> + <year>2001</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + 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. + + </legalnotice> + + <title>Event Domain Service</title> + <prepared>Niclas Eklund</prepared> + <docno></docno> + <date>2001-08-20</date> + <rev>A</rev> + <file>ch_event_domain_service.xml</file> + </header> + + <section> + <title>Overview of the CosEventDomain Service</title> + <p>The Event Domain service allows programmers to manage a cluster + of information channels.</p> + + <section> + <title>Event Domain Service Components</title> + <p>There are two components in the OMG CosEventDomainAdmin service architecture:</p> + <list type="bulleted"> + <item><em>EventDomainFactory:</em> a factory for creating EventDomains.</item> + <item><em>EventDomain:</em> supplies a tool, which makes it easy to create + topologies of interconnected channels (i.e. a directed graph).</item> + </list> + </section> + + <section> + <title>A Tutorial on How to Create a Simple Service</title> + <p>To be able to use the cosEventDomain application, the cosNotification + and, possibly, the cosTime application must be installed.</p> + </section> + + <section> + <title>How to Run Everything</title> + <p>Below is a short transcript on how to run cosEventDomain. </p> + <code type="none"><![CDATA[ + +%% Start Mnesia and Orber +mnesia:delete_schema([node()]), +mnesia:create_schema([node()]), +orber:install([node()]), +mnesia:start(), +orber:start(), + +%% Install and start cosNotification. +cosNotificationApp:install(), +cosNotificationApp:start(), + +%% Install and start cosEventDomain. +cosEventDomainApp:install(), +cosEventDomainApp:start(), + +%% Start a CosEventDomainAdmin factory. +AdminFac = cosEventDomainApp:start_factory(), + +%% Define the desired QoS settings: +QoS = + [#'CosNotification_Property' + {name='CosEventDomainAdmin':'DiamondDetection'(), + value=any:create(orber_tc:short(), + 'CosEventDomainAdmin':'AuthorizeDiamonds'())}, + #'CosNotification_Property' + {name='CosEventDomainAdmin':'CycleDetection'(), + value=any:create(orber_tc:short(), + 'CosEventDomainAdmin':'ForbidCycles'())}], + +%% Create a new EventDomain: +{ED, EDId} = 'CosEventDomainAdmin_EventDomainFactory': + create_event_domain(Fac, QoS, []), + +%% Now we can add Notification Channels to the Domain. How this +%% is done, see the cosNotification documentation. Let us assume +%% that we have gained access to two Channel Objects; add them to the +%% domain: +ID1 = 'CosEventDomainAdmin_EventDomain':add_channel(ED, Ch1), +ID2 = 'CosEventDomainAdmin_EventDomain':add_channel(ED, Ch2), + +%% To connect them, we must first define a connection struct: +C1 = #'CosEventDomainAdmin_Connection'{supplier_id=ID1, +\011\011\011\011 consumer_id=ID2, +\011\011\011\011 ctype='STRUCTURED_EVENT', +\011\011\011\011 notification_style='Pull'}, + +%% Connect them: +'CosEventDomainAdmin_EventDomain':add_connection(ED, C1), + ]]></code> + </section> + </section> +</chapter> + 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 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE chapter SYSTEM "chapter.dtd"> + +<chapter> + <header> + <copyright> + <year>2001</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + 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. + + </legalnotice> + + <title>Introduction to cosEventDomain</title> + <prepared>Niclas Eklund</prepared> + <docno></docno> + <date>2001-08-20</date> + <rev></rev> + <file>ch_introduction.xml</file> + </header> + + <section> + <title>Overview</title> + <p>The cosEventDomain application is a Event Domain Service compliant with the <url href="http://www.omg.org">OMG</url> + Service CosEventDomainAdmin. + </p> + + <section> + <title>Purpose and Dependencies</title> + <p>CosEventDomain is dependent on <em>Orber</em>, which provides CORBA functionality in an Erlang environment.</p> + </section> + + <section> + <title>Prerequisites</title> + <p>To fully understand the concepts presented in the + documentation, it is recommended that the user is familiar + with distributed programming and CORBA. + </p> + </section> + </section> +</chapter> + 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 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE erlref SYSTEM "erlref.dtd"> + +<erlref> + <header> + <copyright> + <year>2001</year> + <year>2007</year> + <holder>Ericsson AB, All Rights Reserved</holder> + </copyright> + <legalnotice> + 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. + </legalnotice> + + <title>cosEventDomainApp</title> + <prepared>Niclas Eklund</prepared> + <responsible>Niclas Eklund</responsible> + <docno></docno> + <approved>Niclas Eklund</approved> + <checked></checked> + <date>2001-08-20</date> + <rev>PA1</rev> + </header> + <module>cosEventDomainApp</module> + <modulesummary>The main module of the cosEventDomain application.</modulesummary> + <description> + <p>To get access to the record definitions for the structures use:<br></br><c><![CDATA[-include_lib("cosEventDomain/include/*.hrl").]]></c></p> + <p>This module contains the functions for starting and stopping the application.</p> + </description> + <funcs> + <func> + <name>install() -> Return</name> + <fsummary>Install the cosEventDomain application</fsummary> + <type> + <v>Return = ok | {'EXCEPTION', E} | {'EXIT', R}</v> + </type> + <desc> + <p>This operation installs the cosEventDomain application.</p> + </desc> + </func> + <func> + <name>uninstall() -> Return</name> + <fsummary>Uninstall the cosEventDomain application</fsummary> + <type> + <v>Return = ok | {'EXCEPTION', E} | {'EXIT', R}</v> + </type> + <desc> + <p>This operation uninstalls the cosEventDomain application.</p> + </desc> + </func> + <func> + <name>start() -> Return</name> + <fsummary>Start the cosEventDomain application</fsummary> + <type> + <v>Return = ok | {error, Reason}</v> + </type> + <desc> + <p>This operation starts the cosEventDomain application.</p> + </desc> + </func> + <func> + <name>stop() -> Return</name> + <fsummary>Stop the cosEventDomain application</fsummary> + <type> + <v>Return = ok | {error, Reason}</v> + </type> + <desc> + <p>This operation stops the cosEventDomain application.</p> + </desc> + </func> + <func> + <name>start_factory() -> Factory</name> + <fsummary>Start a factory with default settings</fsummary> + <type> + <v>Factory = #objref</v> + </type> + <desc> + <p>This operation creates a new instance of a + <seealso marker="CosEventDomainAdmin_EventDomainFactory">Event Domain Factory</seealso> + using the default settings.</p> + </desc> + </func> + <func> + <name>start_factory(Options) -> Factory</name> + <fsummary>Start a factory with settings defined by the given options</fsummary> + <type> + <v>Options = [Option]</v> + <v>Option = currently no options defined.</v> + <v>Factory = #objref</v> + </type> + <desc> + <p>This operation creates a new instance of a + <seealso marker="CosEventDomainAdmin_EventDomainFactory">Event Domain Factory</seealso></p> + </desc> + </func> + <func> + <name>start_factory_link() -> Factory</name> + <fsummary>Start a factory, which is linked to the invoking process, with default settings</fsummary> + <type> + <v>Factory = #objref</v> + </type> + <desc> + <p>This operation creates a new instance of a + <seealso marker="CosEventDomainAdmin_EventDomainFactory">Event Domain Factory</seealso>, + which is linked to the invoking process, using the default settings.</p> + </desc> + </func> + <func> + <name>start_factory_link(Options) -> Factory</name> + <fsummary>Start a factory, which is linked to the invoking process, with settings defined by the given options</fsummary> + <type> + <v>Options = [Option]</v> + <v>Option = currently no options defined.</v> + <v>Factory = #objref</v> + </type> + <desc> + <p>This operation creates a new instance of a + <seealso marker="CosEventDomainAdmin_EventDomainFactory">Event Domain Factory</seealso>, + which is linked to the invoking process, with settings defined by the + given options. Allowed options are the same as for + <c><![CDATA[cosEventDomainApp:start_factory/1]]></c>.</p> + </desc> + </func> + <func> + <name>stop_factory(Factory) -> Reply</name> + <fsummary>Terminate the target object</fsummary> + <type> + <v>Factory = #objref</v> + <v>Reply = ok | {'EXCEPTION', E}</v> + </type> + <desc> + <p>This operation stop the target factory.</p> + </desc> + </func> + </funcs> + +</erlref> + 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 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE fascicules SYSTEM "fascicules.dtd"> + +<fascicules> + <fascicule file="part" href="part_frame.html" entry="no"> + User's Guide + </fascicule> + <fascicule file="ref_man" href="ref_man_frame.html" entry="yes"> + Reference Manual + </fascicule> + <fascicule file="part_notes" href="part_notes_frame.html" entry="no"> + Release Notes + </fascicule> + <fascicule file="" href="../../../../doc/print.html" entry="no"> + Off-Print + </fascicule> +</fascicules> + 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 Binary files differnew file mode 100644 index 0000000000..e000cca26a --- /dev/null +++ b/lib/cosEventDomain/doc/src/notes.gif 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 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE chapter SYSTEM "chapter.dtd"> + +<chapter> + <header> + <copyright> + <year>2001</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + 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. + + </legalnotice> + + <title>cosEventDomain Release Notes</title> + <prepared>Niclas Eklund</prepared> + <docno></docno> + <approved></approved> + <checked></checked> + <date>2001-08-20</date> + <rev>A</rev> + <file>notes.xml</file> + </header> + + <section> + <title>cosEventDomain 1.1.7</title> + + <section> + <title>Improvements and New Features</title> + <list type="bulleted"> + <item> + <p> + 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.</p> + <p> + Own Id: OTP-8201 Aux Id:</p> + </item> + </list> + </section> + </section> + + <section> + <title>cosEventDomain 1.1.6</title> + + <section> + <title>Improvements and New Features</title> + <list type="bulleted"> + <item> + <p>Obsolete guards, e.g. record vs is_record, has been changed + to avoid compiler warnings.</p> + <p>Own id: OTP-7987</p> + </item> + </list> + </section> + </section> + + <section> + <title>cosEventDomain 1.1.5</title> + + <section> + <title>Improvements and New Features</title> + <list type="bulleted"> + <item> + <p>Updated file headers.</p> + <p>Own id: OTP-7837</p> + </item> + </list> + </section> + </section> + + <section> + <title>cosEventDomain 1.1.4</title> + + <section> + <title>Improvements and New Features</title> + <list type="bulleted"> + <item> + <p>Documentation source included in open source releases.</p> + <p>Own id: OTP-7595</p> + </item> + </list> + </section> + </section> + + <section> + <title>cosEventDomain 1.1.3</title> + + <section> + <title>Improvements and New Features</title> + <list type="bulleted"> + <item> + <p>Updated file headers.</p> + <p>Own id: OTP-7011</p> + </item> + </list> + </section> + </section> + + <section> + <title>cosEventDomain 1.1.2</title> + + <section> + <title>Improvements and New Features</title> + <list type="bulleted"> + <item> + <p>The documentation source has been converted from SGML to XML.</p> + <p>Own id: OTP-6754</p> + </item> + </list> + </section> + </section> + + <section> + <title>cosEventDomain 1.1.1</title> + + <section> + <title>Improvements and New Features</title> + <list type="bulleted"> + <item> + <p>Minor Makefile changes.</p> + <p>Own id: OTP-6701</p> + </item> + </list> + </section> + </section> + + <section> + <title>cosEventDomain 1.1</title> + + <section> + <title>Improvements and New Features</title> + <list type="bulleted"> + <item> + <p>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.</p> + <p>Own id: OTP-4576</p> + </item> + </list> + </section> + </section> + + <section> + <title>cosEventDomain 1.0</title> + + <section> + <title>Improvements and New Features</title> + <list type="bulleted"> + <item> + <p>First release of the cosEventDomain application.</p> + </item> + </list> + </section> + </section> +</chapter> + 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 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE part SYSTEM "part.dtd"> + +<part xmlns:xi="http://www.w3.org/2001/XInclude"> + <header> + <copyright> + <year>2001</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + 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. + + </legalnotice> + + <title>cosEventDomain User's Guide</title> + <prepared>Niclas Eklund</prepared> + <docno></docno> + <date>2001-08-20</date> + <rev>1.0</rev> + </header> + <description> + <p>The <em>cosEventDomain</em> application is an Erlang implementation of a + CORBA Service CosEventDomainAdmin.</p> + </description> + <xi:include href="ch_contents.xml"/> + <xi:include href="ch_introduction.xml"/> + <xi:include href="ch_QoS.xml"/> + <xi:include href="ch_event_domain_service.xml"/> +</part> + 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 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE part SYSTEM "part.dtd"> + +<part xmlns:xi="http://www.w3.org/2001/XInclude"> + <header> + <copyright> + <year>2001</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + 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. + + </legalnotice> + + <title>cosEventDomain Release Notes</title> + <prepared>Niclas Eklund</prepared> + <docno></docno> + <date>2001-08-20</date> + <rev>1.0</rev> + </header> + <description> + <p>The cosEventDomain Application is an Erlang implementation of a CORBA Service + CosEventDomainAdmin.</p> + </description> + <xi:include href="notes.xml"/> +</part> + diff --git a/lib/cosEventDomain/doc/src/ref_man.gif b/lib/cosEventDomain/doc/src/ref_man.gif Binary files differnew file mode 100644 index 0000000000..b13c4efd53 --- /dev/null +++ b/lib/cosEventDomain/doc/src/ref_man.gif 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 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE application SYSTEM "application.dtd"> + +<application xmlns:xi="http://www.w3.org/2001/XInclude"> + <header> + <copyright> + <year>2001</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + 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. + + </legalnotice> + + <title>cosEventDomain Reference Manual</title> + <prepared>Niclas Eklund</prepared> + <docno></docno> + <date>2001-08-20</date> + <rev>1.0</rev> + </header> + <description> + <p>The <em>cosEventDomain</em> application is an Erlang implementation of + a CORBA Service CosEventDomainAdmin.</p> + </description> + <xi:include href="cosEventDomainApp.xml"/> + <xi:include href="CosEventDomainAdmin.xml"/> + <xi:include href="CosEventDomainAdmin_EventDomainFactory.xml"/> + <xi:include href="CosEventDomainAdmin_EventDomain.xml"/> +</application> + 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 Binary files differnew file mode 100644 index 0000000000..e6275a803d --- /dev/null +++ b/lib/cosEventDomain/doc/src/user_guide.gif diff --git a/lib/cosEventDomain/ebin/.gitignore b/lib/cosEventDomain/ebin/.gitignore new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/lib/cosEventDomain/ebin/.gitignore diff --git a/lib/cosEventDomain/example/.gitignore b/lib/cosEventDomain/example/.gitignore new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/lib/cosEventDomain/example/.gitignore diff --git a/lib/cosEventDomain/include/.gitignore b/lib/cosEventDomain/include/.gitignore new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/lib/cosEventDomain/include/.gitignore 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 <MemberID> MemberIDSeq; + typedef long ConnectionID; + typedef sequence <ConnectionID> ConnectionIDSeq; + + struct Connection { + MemberID supplier_id; + MemberID consumer_id; + CosNotifyChannelAdmin::ClientType ctype; + NotificationStyle notification_style; + }; + + + typedef MemberIDSeq Route; + typedef sequence<Route> RouteSeq; + + typedef Route Cycle; + typedef sequence<Cycle> CycleSeq; + + typedef RouteSeq Diamond; + typedef sequence<Diamond> DiamondSeq; + + exception CycleCreationForbidden + { + Cycle cyc; + }; + + exception DiamondCreationForbidden + { + Diamond diam; + }; + + // Forward declarations + interface ConsumerAdmin; + interface SupplierAdmin; + + + typedef long DomainID; + typedef sequence <DomainID> 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 |