From 6bcdad20c24457393c0d9eeb385d0ff5aa872cd0 Mon Sep 17 00:00:00 2001 From: Lars Thorsen Date: Wed, 25 Apr 2018 15:09:14 +0200 Subject: Move the corba applcations to separate repository All corba applications are moved to a separate repository. E.g. orber, ic, cosEvent, cosEventDomain, cosNotifications cosTime, cosTransactions, cosProperty and cosFileTransfer. --- lib/cosNotification/AUTHORS | 4 - lib/cosNotification/Makefile | 42 - lib/cosNotification/doc/html/.gitignore | 0 lib/cosNotification/doc/man3/.gitignore | 0 lib/cosNotification/doc/man6/.gitignore | 0 lib/cosNotification/doc/pdf/.gitignore | 0 lib/cosNotification/doc/src/CosNotification.xml | 235 --- .../src/CosNotification_AdminPropertiesAdmin.xml | 79 - .../doc/src/CosNotification_QoSAdmin.xml | 107 - .../src/CosNotifyChannelAdmin_ConsumerAdmin.xml | 242 --- .../doc/src/CosNotifyChannelAdmin_EventChannel.xml | 226 -- .../CosNotifyChannelAdmin_EventChannelFactory.xml | 89 - .../src/CosNotifyChannelAdmin_ProxyConsumer.xml | 128 -- .../CosNotifyChannelAdmin_ProxyPullConsumer.xml | 113 - .../CosNotifyChannelAdmin_ProxyPullSupplier.xml | 112 - .../CosNotifyChannelAdmin_ProxyPushConsumer.xml | 98 - .../CosNotifyChannelAdmin_ProxyPushSupplier.xml | 110 - .../src/CosNotifyChannelAdmin_ProxySupplier.xml | 175 -- ...otifyChannelAdmin_SequenceProxyPullConsumer.xml | 112 - ...otifyChannelAdmin_SequenceProxyPullSupplier.xml | 146 -- ...otifyChannelAdmin_SequenceProxyPushConsumer.xml | 109 - ...otifyChannelAdmin_SequenceProxyPushSupplier.xml | 111 - ...ifyChannelAdmin_StructuredProxyPullConsumer.xml | 110 - ...ifyChannelAdmin_StructuredProxyPullSupplier.xml | 140 -- ...ifyChannelAdmin_StructuredProxyPushConsumer.xml | 110 - ...ifyChannelAdmin_StructuredProxyPushSupplier.xml | 110 - .../src/CosNotifyChannelAdmin_SupplierAdmin.xml | 195 -- .../doc/src/CosNotifyComm_NotifyPublish.xml | 66 - .../doc/src/CosNotifyComm_NotifySubscribe.xml | 64 - .../doc/src/CosNotifyFilter_Filter.xml | 223 -- .../doc/src/CosNotifyFilter_FilterAdmin.xml | 112 - .../doc/src/CosNotifyFilter_FilterFactory.xml | 74 - .../doc/src/CosNotifyFilter_MappingFilter.xml | 228 --- lib/cosNotification/doc/src/Makefile | 167 -- lib/cosNotification/doc/src/book.xml | 49 - lib/cosNotification/doc/src/ch_BNF.xml | 457 ----- lib/cosNotification/doc/src/ch_QoS.xml | 252 --- lib/cosNotification/doc/src/ch_contents.xml | 75 - lib/cosNotification/doc/src/ch_example.xml | 170 -- lib/cosNotification/doc/src/ch_install.xml | 147 -- lib/cosNotification/doc/src/ch_introduction.xml | 58 - lib/cosNotification/doc/src/ch_system.xml | 84 - lib/cosNotification/doc/src/cosNotificationApp.xml | 309 --- lib/cosNotification/doc/src/eventstructure.gif | Bin 89760 -> 0 bytes lib/cosNotification/doc/src/notes.xml | 632 ------ lib/cosNotification/doc/src/notificationFlow.gif | Bin 167734 -> 0 bytes lib/cosNotification/doc/src/part.xml | 43 - lib/cosNotification/doc/src/ref_man.xml | 64 - lib/cosNotification/ebin/.gitignore | 0 lib/cosNotification/examples/.gitignore | 0 lib/cosNotification/include/.gitignore | 0 lib/cosNotification/info | 3 - lib/cosNotification/priv/.gitignore | 0 lib/cosNotification/src/CosEvent.cfg | 20 - lib/cosNotification/src/CosNotification.cfg | 0 lib/cosNotification/src/CosNotification.idl | 146 -- lib/cosNotification/src/CosNotification_Common.erl | 1240 ----------- .../src/CosNotification_Definitions.hrl | 343 ---- lib/cosNotification/src/CosNotifyChannelAdmin.cfg | 60 - lib/cosNotification/src/CosNotifyChannelAdmin.idl | 275 --- .../CosNotifyChannelAdmin_ConsumerAdmin_impl.erl | 671 ------ ...NotifyChannelAdmin_EventChannelFactory_impl.erl | 143 -- .../CosNotifyChannelAdmin_EventChannel_impl.erl | 722 ------- .../CosNotifyChannelAdmin_SupplierAdmin_impl.erl | 580 ------ lib/cosNotification/src/CosNotifyComm.cfg | 0 lib/cosNotification/src/CosNotifyComm.idl | 83 - lib/cosNotification/src/CosNotifyFilter.cfg | 6 - lib/cosNotification/src/CosNotifyFilter.idl | 140 -- .../src/CosNotifyFilter_FilterFactory_impl.erl | 126 -- .../src/CosNotifyFilter_Filter_impl.erl | 672 ------ .../src/CosNotifyFilter_MappingFilter_impl.erl | 580 ------ lib/cosNotification/src/CosTypedEvent.idl | 57 - lib/cosNotification/src/CosTypedNotification.idl | 109 - lib/cosNotification/src/Makefile | 379 ---- lib/cosNotification/src/PullerConsumer_impl.erl | 774 ------- lib/cosNotification/src/PullerSupplier_impl.erl | 915 --------- lib/cosNotification/src/PusherConsumer_impl.erl | 730 ------- lib/cosNotification/src/PusherSupplier_impl.erl | 1053 ---------- lib/cosNotification/src/cosNotification.app.src | 122 -- lib/cosNotification/src/cosNotification.appup.src | 7 - lib/cosNotification/src/cosNotificationApp.erl | 436 ---- lib/cosNotification/src/cosNotificationAppComm.idl | 17 - lib/cosNotification/src/cosNotificationComm.cfg | 3 - lib/cosNotification/src/cosNotification_Filter.erl | 965 --------- .../src/cosNotification_Grammar.yrl | 168 -- .../src/cosNotification_Scanner.erl | 269 --- .../src/cosNotification_eventDB.erl | 1351 ------------ lib/cosNotification/test/Makefile | 192 -- lib/cosNotification/test/cosNotification.cover | 2 - lib/cosNotification/test/cosNotification.spec | 1 - lib/cosNotification/test/eventDB_SUITE.erl | 896 -------- lib/cosNotification/test/generated_SUITE.erl | 1928 ----------------- lib/cosNotification/test/grammar_SUITE.erl | 1091 ---------- lib/cosNotification/test/notification_SUITE.erl | 2163 -------------------- lib/cosNotification/test/notify_test_impl.erl | 300 --- lib/cosNotification/test/notify_test_server.cfg | 55 - lib/cosNotification/test/notify_test_server.idl | 114 -- lib/cosNotification/vsn.mk | 2 - 98 files changed, 26086 deletions(-) delete mode 100644 lib/cosNotification/AUTHORS delete mode 100644 lib/cosNotification/Makefile delete mode 100644 lib/cosNotification/doc/html/.gitignore delete mode 100644 lib/cosNotification/doc/man3/.gitignore delete mode 100644 lib/cosNotification/doc/man6/.gitignore delete mode 100644 lib/cosNotification/doc/pdf/.gitignore delete mode 100644 lib/cosNotification/doc/src/CosNotification.xml delete mode 100644 lib/cosNotification/doc/src/CosNotification_AdminPropertiesAdmin.xml delete mode 100644 lib/cosNotification/doc/src/CosNotification_QoSAdmin.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_ConsumerAdmin.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_EventChannel.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_EventChannelFactory.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyConsumer.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyPullConsumer.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyPullSupplier.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyPushConsumer.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyPushSupplier.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxySupplier.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_SequenceProxyPullConsumer.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_SequenceProxyPullSupplier.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_SequenceProxyPushConsumer.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_SequenceProxyPushSupplier.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_StructuredProxyPullConsumer.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_StructuredProxyPullSupplier.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_StructuredProxyPushConsumer.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_StructuredProxyPushSupplier.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_SupplierAdmin.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyComm_NotifyPublish.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyComm_NotifySubscribe.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyFilter_Filter.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyFilter_FilterAdmin.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyFilter_FilterFactory.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyFilter_MappingFilter.xml delete mode 100644 lib/cosNotification/doc/src/Makefile delete mode 100644 lib/cosNotification/doc/src/book.xml delete mode 100644 lib/cosNotification/doc/src/ch_BNF.xml delete mode 100644 lib/cosNotification/doc/src/ch_QoS.xml delete mode 100644 lib/cosNotification/doc/src/ch_contents.xml delete mode 100644 lib/cosNotification/doc/src/ch_example.xml delete mode 100644 lib/cosNotification/doc/src/ch_install.xml delete mode 100644 lib/cosNotification/doc/src/ch_introduction.xml delete mode 100644 lib/cosNotification/doc/src/ch_system.xml delete mode 100644 lib/cosNotification/doc/src/cosNotificationApp.xml delete mode 100644 lib/cosNotification/doc/src/eventstructure.gif delete mode 100644 lib/cosNotification/doc/src/notes.xml delete mode 100644 lib/cosNotification/doc/src/notificationFlow.gif delete mode 100644 lib/cosNotification/doc/src/part.xml delete mode 100644 lib/cosNotification/doc/src/ref_man.xml delete mode 100644 lib/cosNotification/ebin/.gitignore delete mode 100644 lib/cosNotification/examples/.gitignore delete mode 100644 lib/cosNotification/include/.gitignore delete mode 100644 lib/cosNotification/info delete mode 100644 lib/cosNotification/priv/.gitignore delete mode 100644 lib/cosNotification/src/CosEvent.cfg delete mode 100644 lib/cosNotification/src/CosNotification.cfg delete mode 100644 lib/cosNotification/src/CosNotification.idl delete mode 100644 lib/cosNotification/src/CosNotification_Common.erl delete mode 100644 lib/cosNotification/src/CosNotification_Definitions.hrl delete mode 100644 lib/cosNotification/src/CosNotifyChannelAdmin.cfg delete mode 100644 lib/cosNotification/src/CosNotifyChannelAdmin.idl delete mode 100644 lib/cosNotification/src/CosNotifyChannelAdmin_ConsumerAdmin_impl.erl delete mode 100644 lib/cosNotification/src/CosNotifyChannelAdmin_EventChannelFactory_impl.erl delete mode 100644 lib/cosNotification/src/CosNotifyChannelAdmin_EventChannel_impl.erl delete mode 100644 lib/cosNotification/src/CosNotifyChannelAdmin_SupplierAdmin_impl.erl delete mode 100644 lib/cosNotification/src/CosNotifyComm.cfg delete mode 100644 lib/cosNotification/src/CosNotifyComm.idl delete mode 100644 lib/cosNotification/src/CosNotifyFilter.cfg delete mode 100644 lib/cosNotification/src/CosNotifyFilter.idl delete mode 100644 lib/cosNotification/src/CosNotifyFilter_FilterFactory_impl.erl delete mode 100644 lib/cosNotification/src/CosNotifyFilter_Filter_impl.erl delete mode 100644 lib/cosNotification/src/CosNotifyFilter_MappingFilter_impl.erl delete mode 100644 lib/cosNotification/src/CosTypedEvent.idl delete mode 100644 lib/cosNotification/src/CosTypedNotification.idl delete mode 100644 lib/cosNotification/src/Makefile delete mode 100644 lib/cosNotification/src/PullerConsumer_impl.erl delete mode 100644 lib/cosNotification/src/PullerSupplier_impl.erl delete mode 100644 lib/cosNotification/src/PusherConsumer_impl.erl delete mode 100644 lib/cosNotification/src/PusherSupplier_impl.erl delete mode 100644 lib/cosNotification/src/cosNotification.app.src delete mode 100644 lib/cosNotification/src/cosNotification.appup.src delete mode 100644 lib/cosNotification/src/cosNotificationApp.erl delete mode 100644 lib/cosNotification/src/cosNotificationAppComm.idl delete mode 100644 lib/cosNotification/src/cosNotificationComm.cfg delete mode 100644 lib/cosNotification/src/cosNotification_Filter.erl delete mode 100644 lib/cosNotification/src/cosNotification_Grammar.yrl delete mode 100644 lib/cosNotification/src/cosNotification_Scanner.erl delete mode 100644 lib/cosNotification/src/cosNotification_eventDB.erl delete mode 100644 lib/cosNotification/test/Makefile delete mode 100644 lib/cosNotification/test/cosNotification.cover delete mode 100644 lib/cosNotification/test/cosNotification.spec delete mode 100644 lib/cosNotification/test/eventDB_SUITE.erl delete mode 100644 lib/cosNotification/test/generated_SUITE.erl delete mode 100644 lib/cosNotification/test/grammar_SUITE.erl delete mode 100644 lib/cosNotification/test/notification_SUITE.erl delete mode 100644 lib/cosNotification/test/notify_test_impl.erl delete mode 100644 lib/cosNotification/test/notify_test_server.cfg delete mode 100644 lib/cosNotification/test/notify_test_server.idl delete mode 100644 lib/cosNotification/vsn.mk (limited to 'lib/cosNotification') diff --git a/lib/cosNotification/AUTHORS b/lib/cosNotification/AUTHORS deleted file mode 100644 index 55d8059989..0000000000 --- a/lib/cosNotification/AUTHORS +++ /dev/null @@ -1,4 +0,0 @@ -Original Authors: -Niclas Eklund - -Contributors: diff --git a/lib/cosNotification/Makefile b/lib/cosNotification/Makefile deleted file mode 100644 index 0408417a3b..0000000000 --- a/lib/cosNotification/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1999-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions 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=$(COSNOTIFICATION_VSN) - -# ---------------------------------------------------- -# Common Macros -# ---------------------------------------------------- -# SUB_DIRECTORIES = src test examples doc/src -# At the moment we don't have any example programs. -SUB_DIRECTORIES = src doc/src - -SPECIAL_TARGETS = - -# ---------------------------------------------------- -# Default Subdir Targets -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_subdir.mk diff --git a/lib/cosNotification/doc/html/.gitignore b/lib/cosNotification/doc/html/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosNotification/doc/man3/.gitignore b/lib/cosNotification/doc/man3/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosNotification/doc/man6/.gitignore b/lib/cosNotification/doc/man6/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosNotification/doc/pdf/.gitignore b/lib/cosNotification/doc/pdf/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosNotification/doc/src/CosNotification.xml b/lib/cosNotification/doc/src/CosNotification.xml deleted file mode 100644 index 6aac312d5e..0000000000 --- a/lib/cosNotification/doc/src/CosNotification.xml +++ /dev/null @@ -1,235 +0,0 @@ - - - - -
- - 2002 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotification - Niclas Eklund - Niclas Eklund - - Niclas Eklund - - 2002-02-05 - PA1 -
- CosNotification - This module export functions which return QoS and Admin Properties constants. - -

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

--include_lib("cosNotification/include/*.hrl").

-
- - - 'EventReliability'() -> string() - Return the EventReliability QoS identifier - -

This function returns the EventReliability QoS identifier

-
-
- - 'BestEffort'() -> short() - Return the BestEffort QoS value - -

This function returns the BestEffort QoS value.

-
-
- - 'Persistent'() -> short() - Return the Persistent QoS value - -

This function returns the Persistent QoS value.

-
-
- - 'ConnectionReliability'() -> string() - Return the ConnectionReliability QoS identifier - -

This function returns the ConnectionReliability QoS identifier.

-
-
- - 'Priority'() -> string() - Return the Priority QoS identifier - -

This function returns the Priority QoS identifier.

-
-
- - 'LowestPriority'() -> short() - Return the LowestPriority QoS value - -

This function returns the LowestPriority QoS value.

-
-
- - 'HighestPriority'() -> short() - Return the HighestPriority QoS value - -

This function returns the HighestPriority QoS value.

-
-
- - 'DefaultPriority'() -> short() - Return the DefaultPriority QoS value - -

This function returns the DefaultPriority QoS value.

-
-
- - 'StartTime'() -> string() - Return the StartTime QoS identifier - -

This function returns the StartTime QoS identifier.

-
-
- - 'StopTime'() -> string() - Return the StopTime QoS identifier - -

This function returns the StopTime QoS identifier.

-
-
- - 'Timeout'() -> string() - Return the Timeout QoS identifier - -

This function returns the Timeout QoS identifier.

-
-
- - 'OrderPolicy'() -> string() - Return the OrderPolicy QoS identifier - -

This function returns the OrderPolicy QoS identifier.

-
-
- - 'AnyOrder'() -> short() - Return the AnyOrder QoS value - -

This function returns the AnyOrder QoS value.

-
-
- - 'FifoOrder'() -> short() - Return the FifoOrder QoS value - -

This function returns the FifoOrder QoS value.

-
-
- - 'PriorityOrder'() -> short() - Return the PriorityOrder QoS value - -

This function returns the PriorityOrder QoS value.

-
-
- - 'DeadlineOrder'() -> short() - Return the DeadlineOrder QoS value - -

This function returns the DeadlineOrder QoS value.

-
-
- - 'DiscardPolicy'() -> string() - Return the DiscardPolicy QoS identifier - -

This function returns the DiscardPolicy QoS identifier.

-
-
- - 'LifoOrder'() -> short() - Return the LifoOrder QoS value - -

This function returns the LifoOrder QoS value.

-
-
- - 'RejectNewEvents'() -> short() - Return the RejectNewEvents QoS value - -

This function returns the RejectNewEvents QoS value.

-
-
- - 'MaximumBatchSize'() -> string() - Return the MaximumBatchSize QoS identifier - -

This function returns the MaximumBatchSize QoS identifier.

-
-
- - 'PacingInterval'() -> string() - Return the PacingInterval QoS identifier - -

This function returns the PacingInterval QoS identifier.

-
-
- - 'StartTimeSupported'() -> string() - Return the StartTimeSupported QoS identifier - -

This function returns the StartTimeSupported QoS identifier.

-
-
- - 'StopTimeSupported'() -> string() - Return the StopTimeSupported QoS identifier - -

This function returns the StopTimeSupported QoS identifier.

-
-
- - 'MaxEventsPerConsumer'() -> string() - Return the MaxEventsPerConsumer QoS identifier - -

This function returns the MaxEventsPerConsumer QoS identifier.

-
-
- - 'MaxQueueLength'() -> string() - Return the MaxQueueLength Admin identifier - -

This function returns the MaxQueueLength Admin identifier.

-
-
- - 'MaxConsumers'() -> string() - Return the MaxConsumers Admin identifier - -

This function returns the MaxConsumers Admin identifier.

-
-
- - 'MaxSuppliers'() -> string() - Return the MaxSuppliers Admin identifier - -

This function returns the MaxSuppliers Admin identifier.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotification_AdminPropertiesAdmin.xml b/lib/cosNotification/doc/src/CosNotification_AdminPropertiesAdmin.xml deleted file mode 100644 index 6086402f1a..0000000000 --- a/lib/cosNotification/doc/src/CosNotification_AdminPropertiesAdmin.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotification_AdminPropertiesAdmin - - - - Niclas Eklund - - 2000-02-01 - 1.0 -
- CosNotification_AdminPropertiesAdmin - This module implements the OMG CosNotification::AdminPropertiesAdmin interface. - -

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

--include_lib("cosNotification/include/*.hrl").

-

All objects, which inherit this interface, export functions described in this module.

-
- - - get_admin(Object) -> AdminProperties - Return a list of AdminPropertiesassociated with the target object - - Object = #objref - AdminProperties = [AdminProperty] - AdminProperty = #'CosNotification_Property'{name, value} - name = string() - value = #any - - -

This operation returns sequence of name-value pairs which encapsulates the - current administrative properties of the target object.

-
-
- - set_admin(Object, AdminProperties) -> Reply - Update the AdminPropertiesfor the target object - - Object = #objref - AdminProperties = [AdminProperty] - AdminProperty = #'CosNotification_Property'{name, value} - name = string() - value = #any - Reply = ok | {'EXCEPTION', CosNotification_UnsupportedAdmin} - - -

As input, this operation accepts a sequence of name-value pairs encapsulating the - desired administrative settings for the target object. If it is not possible to - set the given properties the exception UnsupportedAdmin will be raised.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotification_QoSAdmin.xml b/lib/cosNotification/doc/src/CosNotification_QoSAdmin.xml deleted file mode 100644 index 7774652e60..0000000000 --- a/lib/cosNotification/doc/src/CosNotification_QoSAdmin.xml +++ /dev/null @@ -1,107 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - CosNotification_QoSAdmin - - - - 2000-02-01 - 1.0 -
- CosNotification_QoSAdmin - This module implements the OMG CosNotification::QoSAdmin interface. - -

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

--include_lib("cosNotification/include/*.hrl").

-

All objects, which inherit this interface, export functions described in this module.

-
- - - get_qos(Object) -> Reply - Return a list of name-value pairs which encapsulates the current QoS settings for the target object - - Object = #objref - Reply = [QoSProperty] - QoSProperty = #'CosNotification_Property'{name, value} - name = string() - value = #any - - -

This operation returns a list of name-value pairs which encapsulates the current QoS settings - for the target object.

-
-
- - set_qos(Object, QoS) -> Reply - Change the QoS settings for the target object - - Object = #objref - QoS = [QoSProperty] - QoSProperty = #'CosNotification_Property'{name, value} - name = string() - value = #any - Reply = ok | {'EXCEPTION', #'CosNotification_UnsupportedQoS'{qos_err}} - qos_err = PropertyErrorSeq - PropertyErrorSeq = [PropertyError] - PropertyError = #'CosNotification_PropertyError'{code, name, available_range} - code = 'UNSUPPORTED_PROPERTY' | 'UNAVAILABLE_PROPERTY' | 'UNSUPPORTED_VALUE' | 'UNAVAILABLE_VALUE' | 'BAD_PROPERTY' | 'BAD_TYPE' | 'BAD_VALUE' - name = string() - available_range = PropertyRange - PropertyRange = #CosNotification_PropertyRange{low_val, high_val} - low_val = high_val = #any - - -

To alter the current QoS settings for the target object this function must be used. - If it is not possible to set the requested QoS the UnsupportedQoS - exception is raised, which includes a sequence of PropertyError's - describing which QoS, possible range and why is not allowed.

-
-
- - validate_qos(Object, QoS) -> Reply - Validate if the supplied QoS properties is valid for the target object - - Object = #objref - QoS = [QoSProperty] - QoSProperty = #'Property'{name, value} - name = string() - value = #any - Reply = {ok, NamedPropertyRangeSeq} | {'EXCEPTION', CosNotification_UnsupportedQoS{}} - NamedPropertyRangeSeq = [NamedPropertyRange] - NamedPropertyRange = #CosNotification_NamedPropertyRange{name, range} - name = string() - range = #CosNotification_PropertyRange{low_val, high_val} - low_val = #any - high_val = #any - - -

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.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ConsumerAdmin.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ConsumerAdmin.xml deleted file mode 100644 index cbe22ce7cd..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ConsumerAdmin.xml +++ /dev/null @@ -1,242 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyChannelAdmin_ConsumerAdmin - - - - - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_ConsumerAdmin - This module implements the OMG CosNotifyChannelAdmin::ConsumerAdmin interface. - -

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

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotification_QoSAdmin

-
- -

CosNotifyComm_NotifySubscribe

-
- -

CosNotifyFilter_FilterAdmin

-
-
-
- - - _get_MyID(ConsumerAdmin) -> AdminID - Return the target object's Id - - ConsumerAdmin = #objref - AdminID = long() - - -

The ID returned by the creating channel is equal to the value encapsulated by - this readonly attribute.

-
-
- - _get_MyChannel(ConsumerAdmin) -> Channel - Return the ancestor channel - - ConsumerAdmin = #objref - Channel = #objref - - -

The creating channel's reference is maintained by this readonly attribute.

-
-
- - _get_MyOperator(ConsumerAdmin) -> OpType - Return the filtering schema used by the target object - - ConsumerAdmin = #objref - OpType = 'AND_OP' | 'OR_OP' - - -

When ConsumerAdmin's are created an operation type, - i.e., 'AND_OP' or 'OR_OP', is supplied, which determines - the semantics used by the target object concerning evaluation against - any associated Filter objects.

-
-
- - _get_priority_filter(ConsumerAdmin) -> MappingFilter - Return the associated priority MappingFilter - - ConsumerAdmin = MappingFilter = #objref - - -

If set, this operation returns the associated priority MappingFilter, otherwise - a NIL object reference is returned.

-
-
- - _set_priority_filter(ConsumerAdmin, MappingFilter) -> ok - Set the priority MappingFilter - - ConsumerAdmin = MappingFilter = #objref - - -

To associate a priority MappingFilter with the target object this operation - must be used.

-
-
- - _get_lifetime_filter(ConsumerAdmin) -> MappingFilter - Return the associated lifetime MappingFilter - - ConsumerAdmin = MappingFilter = #objref - - -

Unless a lifetime MappingFilter have been associated with the target object - a NIL object reference is returned by this operation.

-
-
- - _set_lifetime_filter(ConsumerAdmin, MappingFilter) -> ok - Set the lifetime MappingFilter - - ConsumerAdmin = MappingFilter = #objref - - -

This operation associate a lifetime MappingFilter with the target object.

-
-
- - _get_pull_suppliers(ConsumerAdmin) -> ProxyIDSeq - Return a list of all associated pull supplier Id:s - - ConsumerAdmin = #objref - ProxyIDSeq = [ProxyID] - ProxyID = long() - - -

This readonly attribute maintains the Id's for all PullProxies created - by the target object and still alive.

-
-
- - _get_push_suppliers(ConsumerAdmin) -> ProxyIDSeq - Return a list of all associated push supplier Id:s - - ConsumerAdmin = #objref - ProxyIDSeq = [ProxyID] - ProxyID = long() - - -

This attribute is similar to the _get_pull_suppliers attribute but maintains - the Id's for all PushProxies created by the target object and still alive.

-
-
- - get_proxy_supplier(ConsumerAdmin, ProxyID) -> Reply - Return the proxy supplier with matching Id - - ConsumerAdmin = #objref - ProxyID = long() - Reply = Proxy | {'EXCEPTION', #'CosNotifyChannelAdmin_ProxyNotFound'{}} - Proxy = #objref - - -

If a proxy with the given Id exists the reference to the object is returned, but if - the object have terminated, or an incorrect Id is supplied, an exception is raised.

-
-
- - obtain_notification_pull_supplier(ConsumerAdmin, ConsumerType) -> Reply - Create a supplier proxy - - ConsumerAdmin = #objref - ConsumerType = 'ANY_EVENT' | 'STRUCTURED_EVENT' | 'SEQUENCE_EVENT' - Reply = {Proxy, ProxyID} - Proxy = #objref - ProxyID = long() - - -

Determined by the parameter ConsumerType, a proxy which will - accept events of the defined type is created. Along with the object reference an - Id is returned.

-
-
- - obtain_pull_supplier(ConsumerAdmin) -> Proxy - Create a supplier proxy - - ConsumerAdmin = #objref - Proxy = #objref - - -

This operation creates a new proxy which accepts #any{} events.

-
-
- - obtain_notification_push_supplier(ConsumerAdmin, ConsumerType) -> Reply - Create a supplier proxy - - ConsumerAdmin = #objref - ConsumerType = 'ANY_EVENT' | 'STRUCTURED_EVENT' | 'SEQUENCE_EVENT' - Reply = {Proxy, ProxyID} - Proxy = #objref - ProxyID = long() - - -

A proxy which accepts events of the type described by the parameter ConsumerType - is created by this operation. A unique Id is returned as an out parameter.

-
-
- - obtain_push_supplier(ConsumerAdmin) -> Proxy - Create a supplier proxy - - ConsumerAdmin = #objref - Proxy = #objref - - -

The object created by this function is a proxy which accepts #any{} events.

-
-
- - destroy(ConsumerAdmin) -> ok - Terminate the target object and all its children - - ConsumerAdmin = #objref - - -

To terminate the target object this operation should be used. The associated - Channel will be notified.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_EventChannel.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_EventChannel.xml deleted file mode 100644 index 7696e6a26c..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_EventChannel.xml +++ /dev/null @@ -1,226 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - CosNotifyChannelAdmin_EventChannel - - - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_EventChannel - This module implements the OMG CosNotifyChannelAdmin::EventChannel interface. - -

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

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotification_QoSAdmin

-
- -

CosNotification_AdminPropertiesAdmin

-
-
-
- - - _get_MyFactory(Channel) -> ChannelFactory - Return the factory object which created the target object - - Channel = #objref - ChannelFactory = #objref - - -

This readonly attribute maintains the reference of the event channel - factory that created the target channel.

-
-
- - _get_default_consumer_admin(Channel) -> ConsumerAdmin - Return the default consumer admin associated with the target object - - Channel = #objref - ConsumerAdmin = #objref - - -

This is a readonly attribute which maintains a reference to a default - ConsumerAdmin object associated with the target object.

-
-
- - _get_default_supplier_admin(Channel) -> SupplierAdmin - Return the default supplier admin associated with the target object - - Channel = #objref - SupplierAdmin = #objref - - -

This is a readonly attribute which maintains a reference to a default - SupplierAdmin object associated with the target object.

-
-
- - _get_default_filter_factory(Channel) -> FilterFactory - Return the default filter factory associated with the target object - - Channel = #objref - FilterFactory = #objref - - -

The default FilterFactory associated with the target channel - is maintained by this readonly attribute.

-
-
- - new_for_consumers(Channel, OpType) -> Return - Create a new ConsumerAdminobject - - Channel = #objref - OpType = 'AND_OP' | 'OR_OP' - Return = {ConsumerAdmin, AdminID} - ConsumerAdmin = #objref - AdminID = long() - - -

This operation creates a new instance of a ConsumerAdmin and supplies - an Id which may be used when invoking other operations exported by this module. - The returned object will inherit the Quality of Service properties of the - target channel.

-
-
- - for_consumers(Channel) -> ConsumerAdmin - Create a new ConsumerAdminobject - - Channel = #objref - ConsumerAdmin = #objref - - -

A new new instance of a ConsumerAdmin object is created but no - Id is returned. The returned object's operation type, i.e., 'AND_OP' or 'OR_OP', - will be set to the value of the configuration parameter filterOp. - The target object's Quality of Service properties will be inherited by the - returned ConsumerAdmin.

-
-
- - new_for_suppliers(Channel, OpType) -> Return - Create a new SupplierAdminobject - - Channel = #objref - OpType = 'AND_OP' | 'OR_OP' - Return = {SupplierAdmin, AdminID} - SupplierAdmin = #objref - AdminID = long() - - -

Enables us to create a new instance of a SupplierAdmin. An Id, which - may be used when invoking other operations exported by this module, is also - returned. The current Quality of Service settings associated with the target - object will be inherited by the SupplierAdmin.

-
-
- - for_suppliers(Channel) -> SupplierAdmin - Create a new SupplierAdminobject - - Channel = #objref - SupplierAdmin = #objref - - -

To create a new SupplierAdmin with the target object's current - Quality of Service settings we can use this function. The returned object's - operation type ('AND_OP' or 'OR_OP') will be determined by the - configuration variable filterOp.

-
-
- - get_consumeradmin(Channel, AdminID) -> ConsumerAdmin - Return the ConsumerAdminmatching AdminID - - Channel = #objref - AdminID = long() - ConsumerAdmin = #objref | {'EXCEPTION', #'CosNotifyChannelAdmin_AdminNotFound'{}} - - -

If the given Id is associated with a ConsumerAdmin the object reference - is returned. If such association never existed or the ConsumerAdmin - have terminated an exception is raised.

-
-
- - get_supplieradmin(Channel, AdminID) -> SupplierAdmin - Return the SupplierAdminmatching AdminID - - Channel = #objref - AdminID = long() - SupplierAdmin = #objref | {'EXCEPTION', #'CosNotifyChannelAdmin_AdminNotFound'{}} - - -

Equal to the operation get_consumeradmin/2 but a reference to - a SupplierAdmin is returned.

-
-
- - get_all_consumeradmins(Channel) -> Reply - Return a list of all ConsumerAdmins, currently active, Id:s - - Channel = #objref - Reply = [AdminID] - AdminID = long() - - -

To get access to all ConsumerAdmin Id's created by the target object, and still - alive, this operation could be invoked.

-
-
- - get_all_supplieradmins(Channel) -> Reply - Return a list of all SupplierAdmins, currently active, Id:s - - Channel = #objref - Reply = [AdminID] - AdminID = long() - - -

Equal to the operation get_all_consumeradmins/1 but returns - a list of all SupplierAdmin object ID's.

-
-
- - destroy(Channel) -> ok - Terminate the channel and all its children - - Channel = #objref - - -

The destroy operation will terminate the target channel and - all associated Admin objects.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_EventChannelFactory.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_EventChannelFactory.xml deleted file mode 100644 index 552ea182c0..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_EventChannelFactory.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - CosNotifyChannelAdmin_EventChannelFactory - - - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_EventChannelFactory - This module implements the OMG CosNotifyChannelAdmin::EventChannelFactory interface. - -

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

--include_lib("cosNotification/include/*.hrl").

-
- - - create_channel(ChannelFactory, InitialQoS, InitialAdmin) -> Return - Create a new channel - - ChannelFactory = #objref - InitialQoS = CosNotification::QoSProperties - InitialAdmin = CosNotification::AdminProperties - Return = {EventChannel, ChannelID} - EventChannel = #objref - ChannelID = long() - - -

This operation creates a new event channel. Along with the channel - reference an id is returned which can be used when invoking other - operations exported by this module. The Quality of Service argument - supplied will be inherited by objects created by the channel. For more - information about QoS settings see the User's Guide.

-

If no QoS- and/or Admin-properties are supplied (i.e. empty list), - the default settings will be used. For more information, see the - User's Guide.

-
-
- - get_all_channels(ChannelFactory) -> ChannelIDSeq - Return all Id:s for channels, currently alive, created by the target object - - ChannelFactory = #objref - ChannelIDSeq = [long()] - - -

This operation returns a id sequence of all channel's created by this ChannelFactory.

-
-
- - get_event_channel(ChannelFactory, ChannelID) -> Return - Return the channel object associated with the given Id - - ChannelFactory = #objref - ChannelID = long() - Retrurn = EventChannel | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} - EventChannel = #objref - - -

This operation returns the EventChannel associated with the given id. If no channel is - associated with the id, i.e., never existed or have been terminated, an exception is raised.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyConsumer.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyConsumer.xml deleted file mode 100644 index 3d61893162..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyConsumer.xml +++ /dev/null @@ -1,128 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyChannelAdmin_ProxyConsumer - - - - - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_ProxyConsumer - This module implements the OMG CosNotifyChannelAdmin::ProxyConsumer interface. - -

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

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotification_QoSAdmin

-
- -

CosNotifyFilter_FilterAdmin

-
-
-
- - - _get_MyType(ProxyConsumer) -> ProxyType - Return the proxy type - - ProxyConsumer = #objref - ProxyType = 'PUSH_ANY' | 'PULL_ANY' | 'PUSH_STRUCTURED' | 'PULL_STRUCTURED' | 'PUSH_SEQUENCE' | 'PULL_SEQUENCE' - - -

This readonly attribute maintains the enumerant describing the which type the target object - is.

-
-
- - _get_MyAdmin(ProxyConsumer) -> AdminObject - return the associated Adminobject - - ProxyConsumer = AdminObject = #objref - - -

This readonly attribute maintains the admin's reference which created the target object.

-
-
- - obtain_subscription_types(ProxyConsumer, ObtainInfoMode) -> EventTypeSeq - Administer subscription types - - ProxyConsumer = #objref - ObtainInfoMode = 'ALL_NOW_UPDATES_OFF' | 'ALL_NOW_UPDATES_ON' | 'NONE_NOW_UPDATES_OFF' | 'NONE_NOW_UPDATES_ON' - EventTypeSeq = [EventType] - EventType = #'CosNotification_EventType'{domain_name, type_name} - domain_name = type_name = string() - - -

Depending on the input parameter ObtainInfoMode, this operation may return a - sequence of the EventTypes the target object is interested in receiving. - If 'ALL_NOW_UPDATES_OFF' or 'ALL_NOW_UPDATES_ON' is given a sequence will - be returned, otherwise not. If 'ALL_NOW_UPDATES_OFF' or 'NONE_NOW_UPDATES_OFF' - are issued the target object will not inform the associated NotifySubscribe object - when an update occurs. 'ALL_NOW_UPDATES_ON' or 'NONE_NOW_UPDATES_ON' will - result in that update information will be sent.

-
-
- - validate_event_qos(ProxyConsumer, QoSProperties) -> Reply - Check if certain Quality of Service properties can be added to events in the current context of the target object - - ProxyConsumer = #objref - QoSProperties = [QoSProperty] - QoSProperty = #'CosNotification_Property'{name, value} - name = string() - value = #any - Reply = {ok, NamedPropertyRangeSeq} | {'EXCEPTION', CosNotification_UnsupportedQoS{qos_err}} - NamedPropertyRangeSeq = [NamedPropertyRange] - NamedPropertyRange = #CosNotification_NamedPropertyRange{name, range} - name = string() - range = #CosNotification_PropertyRange{low_val, high_val} - low_val = #any - high_val = #any - qos_err = PropertyErrorSeq - PropertyErrorSeq = [PropertyError] - PropertyError = #'CosNotification_PropertyError'{code, name, available_range} - code = 'UNSUPPORTED_PROPERTY' | 'UNAVAILABLE_PROPERTY' | 'UNSUPPORTED_VALUE' | 'UNAVAILABLE_VALUE' | 'BAD_PROPERTY' | 'BAD_TYPE' | 'BAD_VALUE' - name = string() - available_range = PropertyRange - PropertyRange = #CosNotification_PropertyRange{low_val, high_val} - low_val = high_val = #any - - -

To check if certain Quality of Service properties can be added to events in - the current context of the target object this operation should be used. If we - cannot support the required settings an exception describing why will be raised.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyPullConsumer.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyPullConsumer.xml deleted file mode 100644 index caf572dee8..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyPullConsumer.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyChannelAdmin_ProxyPullConsumer - - - - - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_ProxyPullConsumer - This module implements the OMG CosNotifyChannelAdmin::ProxyPullConsumer interface. - -

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

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotifyComm_NotifyPublish

-
- -

CosNotification_QoSAdmin

-
- -

CosNotifyFilter_FilterAdmin

-
- -

CosNotifyChannelAdmin_ProxyConsumer

-
-
-
- - - connect_any_pull_supplier(ProxyPullConsumer, PullSupplier) -> Reply - Connect a supplier to the proxy - - ProxyPullConsumer = #objref - PullSupplier = #objref - Reply = ok | {'EXCEPTION', #'CosEventChannelAdmin_AlreadyConnected'{}} | {'EXCEPTION', #'CosEventChannelAdmin_TypeError'{}} - - -

This operation connects the given PullSupplier to the target object. - If a client is already connected the AlreadyConnected exception - will be raised. The client must support the operations pull and - try_pull, otherwise the TypeError exception is raised.

-
-
- - suspend_connection(ProxyPullConsumer) -> Reply - Suspend the connection between the client and the proxy - - ProxyPullConsumer = #objref - Reply = ok | {'EXCEPTION', #'CosNotifyChannelAdmin_ConnectionAlreadyInactive'{}} | {'EXCEPTION', #'CosNotifyChannelAdmin_NotConnected'{}} - - -

If we want to temporarily suspend the connection with the target object this - operation must be sued. If the connection already have been suspended or - no client have been connected an exception is raised.

-
-
- - resume_connection(ProxyPullConsumer) -> Reply - Resume a previously suspended connection with the proxy - - ProxyPullConsumer = #objref - Reply = ok | {'EXCEPTION', #'CosNotifyChannelAdmin_ConnectionAlreadyActive'{}} | {'EXCEPTION', #'CosNotifyChannelAdmin_NotConnected'{}} - - -

If The connection have been suspended earlier we can invoke this operation to - reinstate the connection. If the connection already is active or no client - have been connected to the target object an exception is raised.

-
-
- - disconnect_pull_consumer(ProxyPullConsumer) -> ok - Close the connection and terminate the proxy - - ProxyPullConsumer = #objref - - -

Invoking this operation disconnects the client from the target object which - then terminates and inform its administrative parent.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyPullSupplier.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyPullSupplier.xml deleted file mode 100644 index 42aaaec319..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyPullSupplier.xml +++ /dev/null @@ -1,112 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyChannelAdmin_ProxyPullSupplier - - - - - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_ProxyPullSupplier - This module implements the OMG CosNotifyChannelAdmin::ProxyPullSupplier interface. - -

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

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotifyComm_NotifySubscribe

-
- -

CosNotification_QoSAdmin

-
- -

CosNotifyFilter_FilterAdmin

-
- -

CosNotifyChannelAdmin_ProxySupplier

-
-
-
- - - connect_any_pull_consumer(ProxyPullSupplier, PullConsumer) -> Reply - Connect a consumer to the proxy - - ProxyPullSupplier = #objref - PullConsumer = #objref - Reply = ok | {'EXCEPTION', #'CosEventChannelAdmin_AlreadyConnected'{}} - - -

This operation connects the given PullConsumer to the target object. - If a connection already exists the AlreadyConnected exception is - raised.

-
-
- - pull(ProxyPullSupplier) -> Reply - Pull an Any event from the proxy - - ProxyPullSupplier = #objref - Reply = #any | {'EXCEPTION', #'CosEventChannelAdmin_Disconnected'{}} - - -

This operation pulls next #any{} event, and blocks, if the target object - have no events to forward, until an event can be delivered. If no client have - been connected the Disconnected exception is raised.

-
-
- - try_pull(ProxyPullSupplier) -> Reply - Try and pull an Any event from the proxy - - ProxyPullSupplier = #objref - Reply = {#any, HasEvent} | {'EXCEPTION', #'CosEventChannelAdmin_Disconnected'{}} - HasEvent = boolean() - - -

This operation pulls next event, but do not block if the target object - have no event to forward. If no client have - been connected the Disconnected exception is raised.

-
-
- - disconnect_pull_supplier(ProxyPullSupplier) -> ok - Close the connection and terminate the proxy - - ProxyPullSupplier = #objref - - -

Invoking this operation will cause the target object to close the connection and terminate.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyPushConsumer.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyPushConsumer.xml deleted file mode 100644 index 9808b460c7..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyPushConsumer.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyChannelAdmin_ProxyPushConsumer - - - - Niclas Eklund - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_ProxyPushConsumer - This module implements the OMG CosNotifyChannelAdmin::ProxyPushConsumer interface. - -

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

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotifyComm_NotifyPublish

-
- -

CosNotification_QoSAdmin

-
- -

CosNotifyFilter_FilterAdmin

-
- -

CosNotifyChannelAdmin_ProxyConsumer

-
-
-
- - - connect_any_push_supplier(ProxyPushConsumer, PushSupplier) -> Reply - Connect a supplier to the proxy - - ProxyPushConsumer = #objref - PushSupplier = #objref - Reply = ok | {'EXCEPTION', #'CosEventChannelAdmin_AlreadyConnected'{}} - - -

This operation connects a PushSupplier to the target object. If - a connection already exists the AlreadyConnected exception is raised.

-
-
- - push(ProxyPushConsumer, Event) -> Reply - Push an Any event to the proxy - - ProxyPushConsumer = #objref - Event = #any - Reply = ok | {'EXCEPTION', #'CosEventChannelAdmin_Disconnected'{}} - - -

This operation pushes an #any{} event to the target object. If no client - have been connected the Disconnected exception is raised.

-
-
- - disconnect_push_consumer(ProxyPushConsumer) -> ok - Close the connection and terminate the proxy - - ProxyPushConsumer = #objref - - -

Invoking this operation will cause the target object to close the connection and - terminate.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyPushSupplier.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyPushSupplier.xml deleted file mode 100644 index 6f85de114a..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyPushSupplier.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyChannelAdmin_ProxyPushSupplier - - - - - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_ProxyPushSupplier - This module implements the OMG CosNotifyChannelAdmin::ProxyPushSupplier interface. - -

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

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotifyComm_NotifySubscribe

-
- -

CosNotification_QoSAdmin

-
- -

CosNotifyFilter_FilterAdmi

-
- -

CosNotifyChannelAdmin_ProxySupplier

-
-
-
- - - connect_any_push_consumer(ProxyPushSupplier, PushConsumer) -> Reply - Connect a consumer to the proxy - - ProxyPushSupplier = #objref - PushConsumer = #objref - Reply = ok | {'EXCEPTION', #'CosEventChannelAdmin_AlreadyConnected'{}} | {'EXCEPTION', #'CosEventChannelAdmin_TypeError'{}} - - -

This operation connects a PushConsumer to the target object. If - a connection already exists or the given client does not support - the operation push an exception, AlreadyConnected and - TypeError respectively, is raised.

-
-
- - suspend_connection(ProxyPushSupplier) -> Reply - Suspend the connection between the proxy and the client - - ProxyPushSupplier = #objref - Reply = ok | {'EXCEPTION', #'CosNotifyChannelAdmin_ConnectionAlreadyInactive'{}} | {'EXCEPTION', #'CosNotifyChannelAdmin_NotConnected'{}} - - -

This operation suspends the connection with the client object. If the connection - already is suspended or no client have been associated an exception is raised.

-
-
- - resume_connection(ProxyPushSupplier) -> Reply - Resume a previously suspended connection with the proxy - - ProxyPullConsumer = #objref - Reply = ok | {'EXCEPTION', #'CosNotifyChannelAdmin_ConnectionAlreadyInactive'{}} | {'EXCEPTION', #'CosNotifyChannelAdmin_NotConnected'{}} - - -

If a connection have been suspended earlier, calling this operation will resume the connection. - If the connection already is active or no client have been connected an exception is raised.

-
-
- - disconnect_push_supplier(ProxyPushSupplier) -> ok - Close the connection and terminate the proxy - - ProxyPushSupplier = #objref - - -

This operation cause the target object to close the connection and terminate.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxySupplier.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxySupplier.xml deleted file mode 100644 index 69013fdb1e..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxySupplier.xml +++ /dev/null @@ -1,175 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyChannelAdmin_ProxySupplier - - - - - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_ProxySupplier - This module implements the OMG CosNotifyChannelAdmin::ProxySupplier interface. - -

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

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotification_QoSAdmin

-
- -

CosNotifyFilter_FilterAdmin

-
-
-
- - - _get_MyType(ProxySupplier) -> ProxyType - Return the proxy type - - ProxySupplier = #objref - ProxyType = 'PUSH_ANY' | 'PULL_ANY' | 'PUSH_STRUCTURED' | 'PULL_STRUCTURED' | 'PUSH_SEQUENCE' | 'PULL_SEQUENCE' - - -

This readonly attribute maintains the enumerant describing the which type the target object - is.

-
-
- - _get_MyAdmin(ProxySupplier) -> AdminObject - Return the target object's associated Adminobject - - ProxySupplier = #objref - AdminObject = #objref - - -

This readonly attribute maintains the admin's reference which created the target object.

-
-
- - _get_priority_filter(ProxySupplier) -> MappingFilter - Return the target object's associated priority MappingFilter - - ProxySupplier = #objref - MappingFilter = #objref - - -

This operation returns the associated priority MappingFilter. - If no such object exist a NIL reference is returned.

-
-
- - _set_priority_filter(ProxySupplier, MappingFilter) -> ok - Set the target object's associated priority MappingFilter - - ProxySupplier = #objref - MappingFilter = #objref - - -

This operation associate a new priority MappingFilter with the target object.

-
-
- - _get_lifetime_filter(ProxySupplier) -> MappingFilter - Return the target object's associated lifetime MappingFilter - - ProxySupplier = #objref - MappingFilter = #objref - - -

This operation returns the associated lifetime MappingFilter. - If no such object exist a NIL reference is returned.

-
-
- - _set_lifetime_filter(ProxySupplier, MappingFilter) -> ok - Set the target object's associated lifetime MappingFilter - - ProxySupplier = #objref - MappingFilter = #objref - - -

This operation associate a new lifetime MappingFilter with the target object.

-
-
- - obtain_offered_types(ProxySupplier, ObtainInfoMode) -> EventTypeSeq - Administer the type of events the proxy supplies - - ProxySupplier = #objref - ObtainInfoMode = 'ALL_NOW_UPDATES_OFF' | 'ALL_NOW_UPDATES_ON' | 'NONE_NOW_UPDATES_OFF' | 'NONE_NOW_UPDATES_ON' - EventTypeSeq = [EventType] - EventType = #'CosNotification_EventType'{domain_name, type_name} - domain_name = type_name = string() - - -

Depending on the input parameter ObtainInfoMode, this operation may return a - sequence of the EventTypes the target object is interested in receiving. - If 'ALL_NOW_UPDATES_OFF' or 'ALL_NOW_UPDATES_ON' is given a sequence will - be returned, otherwise not. If 'ALL_NOW_UPDATES_OFF' or 'NONE_NOW_UPDATES_OFF' - are issued the target object will not inform the associated NotifySubscribe object - when an update occurs. 'ALL_NOW_UPDATES_ON' or 'NONE_NOW_UPDATES_ON' will - result in that update information will be sent.

-
-
- - validate_event_qos(ProxySupplier, QoSProperties) -> Reply - Check if the QoS properties can be set - - ProxySupplier = #objref - QoSProperties = [QoSProperty] - QoSProperty = #'CosNotification_Property'{name, value} - name = string() - value = #any - Reply = {ok, NamedPropertyRangeSeq} | {'EXCEPTION', CosNotification_UnsupportedQoS{qos_err}} - NamedPropertyRangeSeq = [NamedPropertyRange] - NamedPropertyRange = #CosNotification_NamedPropertyRange{name, range} - name = string() - range = #CosNotification_PropertyRange{low_val, high_val} - low_val = #any - high_val = #any - qos_err = PropertyErrorSeq - PropertyErrorSeq = [PropertyError] - PropertyError = #'CosNotification_PropertyError'{code, name, available_range} - code = 'UNSUPPORTED_PROPERTY' | 'UNAVAILABLE_PROPERTY' | 'UNSUPPORTED_VALUE' | 'UNAVAILABLE_VALUE' | 'BAD_PROPERTY' | 'BAD_TYPE' | 'BAD_VALUE' - name = string() - available_range = PropertyRange - PropertyRange = #CosNotification_PropertyRange{low_val, high_val} - low_val = high_val = #any - - -

To check if certain Quality of Service properties can be added to events in - the current context of the target object this operation should be used. If we - cannot support the required settings an exception describing why will be raised.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_SequenceProxyPullConsumer.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_SequenceProxyPullConsumer.xml deleted file mode 100644 index 043472df55..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_SequenceProxyPullConsumer.xml +++ /dev/null @@ -1,112 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyChannelAdmin_SequenceProxyPullConsumer - - - - - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_SequenceProxyPullConsumer - This module implements the OMG CosNotifyChannelAdmin::SequenceProxyPullConsumer interface. - -

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

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotifyComm_NotifyPublish

-
- -

CosNotification_QoSAdmin

-
- -

CosNotifyFilter_FilterAdmin

-
- -

CosNotifyChannelAdmin_ProxyConsumer

-
-
-
- - - connect_sequence_pull_supplier(SequenceProxyPullConsumer, PullSupplier) -> Reply - Connect a supplier to the proxy - - SequenceProxyPullConsumer = #objref - PullSupplier = #objref - Reply = ok | {'EXCEPTION', #'CosEventChannelAdmin_AlreadyConnected'{}} | {'EXCEPTION', #'CosEventChannelAdmin_TypeError'{}} - - -

This operation connects a PullSupplier to the target object. If a - connection already exists or the supplied client does not support the functions - pull_structured_events and try_pull_structured_events an exception - is raised.

-
-
- - suspend_connection(SequenceProxyPullConsumer) -> Reply - Suspend the connection with the proxy - - SequenceProxyPullConsumer = #objref - Reply = ok | {'EXCEPTION', #'CosNotifyChannelAdmin_ConnectionAlreadyInactive'{}} | {'EXCEPTION', #'CosNotifyChannelAdmin_NotConnected'{}} - - -

If a connection exist, invoking this operation will suspend the connection - until instructed otherwise. Otherwise, no client have been connected or this operation - already have been invoked an exception is raised.

-
-
- - resume_connection(SequenceProxyPullConsumer) -> Reply - Resume a previously suspended connection with the proxy - - SequenceProxyPullConsumer = #objref - Reply = ok | {'EXCEPTION', #'CosNotifyChannelAdmin_ConnectionAlreadyInactive'{}} | {'EXCEPTION', #'CosNotifyChannelAdmin_NotConnected'{}} - - -

If an connection have been suspended this operation must be used to resume the - connection. If the connection already is active or no client have been connected an - exception is raised.

-
-
- - disconnect_sequence_pull_consumer(SequenceProxyPullConsumer) -> ok - Close connection and terminate the proxy - - SequenceProxyPullConsumer = #objref - - -

This operation close the connection to the client and terminates the target object.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_SequenceProxyPullSupplier.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_SequenceProxyPullSupplier.xml deleted file mode 100644 index a0040a50d7..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_SequenceProxyPullSupplier.xml +++ /dev/null @@ -1,146 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyChannelAdmin_SequenceProxyPullSupplier - - - - - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_SequenceProxyPullSupplier - This module implements the OMG CosNotifyChannelAdmin::SequenceProxyPullSupplier interface. - -

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

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotifyComm_NotifySubscribe

-
- -

CosNotification_QoSAdmin

-
- -

CosNotifyFilter_FilterAdmin

-
- -

CosNotifyChannelAdmin_ProxySupplier

-
-
-
- - - connect_sequence_pull_consumer(SequenceProxyPullSupplier, PullConsumer) -> Reply - Connect a consumer to the proxy - - SequenceProxyPullSupplier = #objref - PullConsumer = #objref - Reply = ok | {'EXCEPTION', #'CosEventChannelAdmin_AlreadyConnected'{}} - - -

This operation connects a PullConsumer to the target object. If a connection - already exists an exception is raised.

-
-
- - pull_structured_events(SequenceProxyPullSupplier, MaxEvents) -> Reply - Pull structured events from the proxy - - SequenceProxyPullSupplier = #objref - MaxEvents = long() - Reply = EventBatch | {'EXCEPTION', #'CosEventChannelAdmin_Disconnected'{}} - EventBatch = [StructuredEvent] - StructuredEvent = #'CosNotification_StructuredEvent'{header, filterable_data, remainder_of_body} - header = EventHeader - filterable_data = [#'CosNotification_Property'{name, value}] - name = string() - value = #any - remainder_of_body = #any - EventHeader = #'CosNotification_EventHeader'{fixed_header, variable_header} - fixed_header = FixedEventHeader - variable_header = OptionalHeaderFields - FixedEventHeader = #'CosNotification_FixedEventHeader'{event_type, event_name} - event_type = EventType - event_name = string() - EventType = #'CosNotification_EventType'{domain_name, type_name} - domain_name = type_name = string() - OptionalHeaderFields = [#'CosNotification_Property'{name, value}] - - -

A client use this operation to pull next event sequence of maximum length - MaxEvents. This operation is blocking and will not reply until the - requested amount of events can be delivered or the QoS property PacingInterval - is reached. For more information see the User's Guide.

-
-
- - try_pull_structured_events(SequenceProxyPullSupplier, MaxEvents) -> Reply - Try to pull structured events from the proxy - - SequenceProxyPullSupplier = #objref - MaxEvents = long() - Reply = {EventBatch, HasEvent} | {'EXCEPTION', #'CosEventChannelAdmin_Disconnected'{}} - HasEvent = boolean() - EventBatch = [StructuredEvent] - StructuredEvent = #'CosNotification_StructuredEvent'{header, filterable_data, remainder_of_body} - header = EventHeader - filterable_data = [#'CosNotification_Property'{name, value}] - name = string() - value = #any - remainder_of_body = #any - EventHeader = #'CosNotification_EventHeader'{fixed_header, variable_header} - fixed_header = FixedEventHeader - variable_header = OptionalHeaderFields - FixedEventHeader = #'CosNotification_FixedEventHeader'{event_type, event_name} - event_type = EventType - event_name = string() - EventType = #'CosNotification_EventType'{domain_name, type_name} - domain_name = type_name = string() - OptionalHeaderFields = [#'CosNotification_Property'{name, value}] - - -

This operation pulls an event sequence of the maximum length MaxEvents, - but do not block if the target object have no events to forward. The outparameter, - HasEvent is true if the sequence contain any events.

-
-
- - disconnect_sequence_pull_supplier(SequenceProxyPullSupplier) -> ok - Close the connection and terminate the proxy - - SequenceProxyPullSupplier = #objref - - -

This operation cause the target object to close the connection and terminate.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_SequenceProxyPushConsumer.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_SequenceProxyPushConsumer.xml deleted file mode 100644 index efec1f99cc..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_SequenceProxyPushConsumer.xml +++ /dev/null @@ -1,109 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - CosNotifyChannelAdmin_SequenceProxyPushConsumer - - - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_SequenceProxyPushConsumer - This module implements the OMG CosNotifyChannelAdmin::SequenceProxyPushConsumer interface. - -

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

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotifyComm_NotifyPublish

-
- -

CosNotification_QoSAdmin

-
- -

CosNotifyFilter_FilterAdmin

-
- -

CosNotifyChannelAdmin_ProxyConsumer

-
-
-
- - - connect_sequence_push_supplier(SequenceProxyPushConsumer, PushSupplier) -> Reply - Connect a supplier to the proxy - - SequenceProxyPushConsumer = #objref - PushSupplier = #objref - Reply = ok | {'EXCEPTION', #'CosEventChannelAdmin_AlreadyConnected'{}} - - -

This operation connects a PushSupplier to the target object. If a - connection already exists the AlreadyConnected exception is raised.

-
-
- - push_structured_events(SequenceProxyPushConsumer, EventBatch) -> Reply - Push a structured event to the proxy - - SequenceProxyPushConsumer = #objref - EventBatch = [StructuredEvent] - StructuredEvent = #'CosNotification_StructuredEvent'{header, filterable_data, remainder_of_body} - header = EventHeader - filterable_data = [#'CosNotification_Property'{name, value}] - name = string() - value = #any - remainder_of_body = #any - EventHeader = #'CosNotification_EventHeader'{fixed_header, variable_header} - fixed_header = FixedEventHeader - variable_header = OptionalHeaderFields - FixedEventHeader = #'CosNotification_FixedEventHeader'{event_type, event_name} - event_type = EventType - event_name = string() - EventType = #'CosNotification_EventType'{domain_name, type_name} - domain_name = type_name = string() - OptionalHeaderFields = [#'CosNotification_Property'{name, value}] - Reply = ok | {'EXCEPTION', #'CosEventChannelAdmin_Disconnected'{}} - - -

A client must use this operation when it wishes to push a new sequence of events - to the target object. If no connection exists the Disconnected exception - is raised.

-
-
- - disconnect_sequence_push_consumer(SequenceProxyPushConsumer) -> ok - Close connection and terminate the proxy - - SequenceProxyPushConsumer = #objref - - -

This operation cause the target object to close the connection and terminate.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_SequenceProxyPushSupplier.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_SequenceProxyPushSupplier.xml deleted file mode 100644 index 229d3667c5..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_SequenceProxyPushSupplier.xml +++ /dev/null @@ -1,111 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyChannelAdmin_SequenceProxyPushSupplier - - - - - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_SequenceProxyPushSupplier - This module implements the OMG CosNotifyChannelAdmin::SequenceProxyPushSupplier interface. - -

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

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotifyComm_NotifySubscribe

-
- -

CosNotification_QoSAdmin

-
- -

CosNotifyFilter_FilterAdmin

-
- -

CosNotifyChannelAdmin_ProxySupplier

-
-
-
- - - connect_sequence_push_consumer(SequenceProxyPushSupplier, PushConsumer) -> Reply - Connect a consumer to the proxy - - SequenceProxyPushSupplier = #objref - PushConsumer = #objref - Reply = ok | {'EXCEPTION', #'CosEventChannelAdmin_AlreadyConnected'{}} | {'EXCEPTION', #'CosEventChannelAdmin_TypeError'{}} - - -

This operation connects a PushConsumer to the target object. If a - connection already exists or the function psuh_structured_events - is not supported the exceptions AlreadyConnected or - TypeError will be raised respectively.

-
-
- - suspend_connection(SequenceProxyPushSupplier) -> Reply - Suspend the connection between the client and the target object - - SequenceProxyPushSupplier = #objref - Reply = ok | {'EXCEPTION', #'CosNotifyChannelAdmin_ConnectionAlreadyInactive'{}} | {'EXCEPTION', #'CosNotifyChannelAdmin_NotConnected'{}} - - -

This operation suspends the connection between the client and the target object. - If no connection exists or the connection is already suspended an exception is raised.

-
-
- - resume_connection(SequenceProxyPushSupplier) -> Reply - Resume a previously suspended connection with the proxy - - SequenceProxyPullConsumer = #objref - Reply = ok | {'EXCEPTION', #'CosNotifyChannelAdmin_ConnectionAlreadyInactive'{}} | {'EXCEPTION', #'CosNotifyChannelAdmin_NotConnected'{}} - - -

If the connection have previously been suspended this operation must used - if we want to resume the connection. If no object have been connected or the connection - already is active an exception is raised.

-
-
- - disconnect_sequence_push_supplier(SequenceProxyPushSupplier) -> ok - Close the connection and terminate the proxy - - SequenceProxyPushSupplier = #objref - - -

This operation cause the target object to close the connection and terminate.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_StructuredProxyPullConsumer.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_StructuredProxyPullConsumer.xml deleted file mode 100644 index 5a86cb84da..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_StructuredProxyPullConsumer.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyChannelAdmin_StructuredProxyPullConsumer - - - - - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_StructuredProxyPullConsumer - This module implements the OMG CosNotifyChannelAdmin::StructuredProxyPullConsumer interface. - -

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

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotifyComm_NotifyPublish

-
- -

CosNotification_QoSAdmin

-
- -

CosNotifyFilter_FilterAdmin

-
- -

CosNotifyChannelAdmin_ProxyConsumer

-
-
-
- - - connect_structured_pull_supplier(StructuredProxyPullConsumer, PullSupplier) -> Reply - Connect a supplier to the proxy - - StructuredProxyPullConsumer = #objref - PullSupplier = #objref - Reply = ok | {'EXCEPTION', #'CosEventChannelAdmin_AlreadyConnected'{}} | {'EXCEPTION', #'CosEventChannelAdmin_TypeError'{}} - - -

This operation connects a PullSupplier to the target object. If a connection - already exists or the given client object does not support the functions - pull_structured_event and try_pull_structured_event an exception is raised.

-
-
- - suspend_connection(StructuredProxyPullConsumer) -> Reply - Suspend the connection between the target object and its client - - StructuredProxyPullConsumer = #objref - Reply = ok | {'EXCEPTION', #'CosNotifyChannelAdmin_ConnectionAlreadyInactive'{}} | {'EXCEPTION', #'CosNotifyChannelAdmin_NotConnected'{}} - - -

This operation suspends the connection between the target object and its client. - If no connection exists or already suspended an exception is raised.

-
-
- - resume_connection(StructuredProxyPullConsumer) -> Reply - Resume a previously suspended connection with the proxy - - StructuredProxyPullConsumer = #objref - Reply = ok | {'EXCEPTION', #'CosNotifyChannelAdmin_ConnectionAlreadyInactive'{}} | {'EXCEPTION', #'CosNotifyChannelAdmin_NotConnected'{}} - - -

If the connection have been suspended this operation must be used if we want - to resume the connection. If the connection already are active or no connection - have been created an exception is raised.

-
-
- - disconnect_structured_pull_consumer(StructuredProxyPullConsumer) -> ok - Close the connection and terminate the proxy - - StructuredProxyPullConsumer = #objref - - -

This operation cause the target object to close the connection and terminate.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_StructuredProxyPullSupplier.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_StructuredProxyPullSupplier.xml deleted file mode 100644 index 1ca7c2d7df..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_StructuredProxyPullSupplier.xml +++ /dev/null @@ -1,140 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyChannelAdmin_StructuredProxyPullSupplier - - - - - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_StructuredProxyPullSupplier - This module implements the OMG CosNotifyChannelAdmin::StructuredProxyPullSupplier interface. - -

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

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotifyComm_NotifySubscribe

-
- -

CosNotification_QoSAdmin

-
- -

CosNotifyFilter_FilterAdmin

-
- -

CosNotifyChannelAdmin_ProxySupplier

-
-
-
- - - connect_structured_pull_consumer(StructuredProxyPullSupplier, PullConsumer) -> Reply - Connect a consumer to the proxy - - StructuredProxyPullSupplier = #objref - PullConsumer = #objref - Reply = ok | {'EXCEPTION', #'CosEventChannelAdmin_AlreadyConnected'{}} - - -

This operation connects a PullConsumer to the target object. If a connection - already exists the AlreadyConnected exception is raised.

-
-
- - pull_structured_event(StructuredProxyPullSupplier) -> Reply - Pull a structured event from the proxy - - StructuredProxyPullSupplier = #objref - Reply = StructuredEvent | {'EXCEPTION', #'CosEventChannelAdmin_Disconnected'{}} - StructuredEvent = #'CosNotification_StructuredEvent'{header, filterable_data, remainder_of_body} - header = EventHeader - filterable_data = [#'CosNotification_Property'{name, value}] - name = string() - value = #any - remainder_of_body = #any - EventHeader = #'CosNotification_EventHeader'{fixed_header, variable_header} - fixed_header = FixedEventHeader - variable_header = OptionalHeaderFields - FixedEventHeader = #'CosNotification_FixedEventHeader'{event_type, event_name} - event_type = EventType - event_name = string() - EventType = #'CosNotification_EventType'{domain_name, type_name} - domain_name = type_name = string() - OptionalHeaderFields = [#'CosNotification_Property'{name, value}] - - -

This operation pulls next event from the target object; if an event cannot - be delivered this function blocks until an event arrives.

-
-
- - try_pull_structured_event(StructuredProxyPullSupplier) -> Reply - Try to pull a structured event from the proxy - - StructuredProxyPullSupplier = #objref - Reply = {StructuredEvent, HasEvent} | {'EXCEPTION', #'CosEventChannelAdmin_Disconnected'{}} - HasEvent = boolean() - StructuredEvent = #'CosNotification_StructuredEvent'{header, filterable_data, remainder_of_body} - header = EventHeader - filterable_data = [#'CosNotification_Property'{name, value}] - name = string() - value = #any - remainder_of_body = #any - EventHeader = #'CosNotification_EventHeader'{fixed_header, variable_header} - fixed_header = FixedEventHeader - variable_header = OptionalHeaderFields - FixedEventHeader = #'CosNotification_FixedEventHeader'{event_type, event_name} - event_type = EventType - event_name = string() - EventType = #'CosNotification_EventType'{domain_name, type_name} - domain_name = type_name = string() - OptionalHeaderFields = [#'CosNotification_Property'{name, value}] - - -

This operation try to pull next event from the target object. If no event have arrived - an empty event is returned and the out parameter HasEvent is set to false. Otherwise, - the boolean flag is set to true and an valid event is returned.

-
-
- - disconnect_structured_pull_supplier(StructuredProxyPullSupplier) -> ok - Close connection and terminate the proxy - - StructuredProxyPullSupplier = #objref - - -

This operation cause the target object to close the connection and terminate.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_StructuredProxyPushConsumer.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_StructuredProxyPushConsumer.xml deleted file mode 100644 index 63bcdf120c..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_StructuredProxyPushConsumer.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyChannelAdmin_StructuredProxyPushConsumer - - - - - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_StructuredProxyPushConsumer - This module implements the OMG CosNotifyChannelAdmin::StructuredProxyPushConsumer interface. - -

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

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotifyComm_NotifyPublish

-
- -

CosNotification_QoSAdmin

-
- -

CosNotifyFilter_FilterAdmin

-
- -

CosNotifyChannelAdmin_ProxyConsumer

-
-
-
- - - connect_structured_push_supplier(StructuredProxyPushConsumer, PushSupplier) -> Reply - Connect a supplier to the proxy - - StructuredProxyPushConsumer = #objref - PushSupplier = #objref - Reply = ok | {'EXCEPTION', #'CosEventChannelAdmin_AlreadyConnected'{}} - - -

This operation connects a PushSupplier to the target object. If a connection - already exists an exception is raised.

-
-
- - push_structured_event(StructuredProxyPushConsumer, StructuredEvent) -> Reply - Push a structured event to the proxy - - StructuredProxyPushConsumer = #objref - StructuredEvent = #'CosNotification_StructuredEvent'{header, filterable_data, remainder_of_body} - header = EventHeader - filterable_data = [#'CosNotification_Property'{name, value}] - name = string() - value = #any - remainder_of_body = #any - EventHeader = #'CosNotification_EventHeader'{fixed_header, variable_header} - fixed_header = FixedEventHeader - variable_header = OptionalHeaderFields - FixedEventHeader = #'CosNotification_FixedEventHeader'{event_type, event_name} - event_type = EventType - event_name = string() - EventType = #'CosNotification_EventType'{domain_name, type_name} - domain_name = type_name = string() - OptionalHeaderFields = [#'CosNotification_Property'{name, value}] - Reply = ok | {'EXCEPTION', #'CosEventChannelAdmin_Disconnected'{}} - - -

When a client want to push a new event to the target object this operation must be used.

-
-
- - disconnect_structured_push_consumer(StructuredProxyPushConsumer) -> ok - Close the connection and terminate the proxy - - StructuredProxyPushConsumer = #objref - - -

This operation cause the target object to close the connection and terminate.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_StructuredProxyPushSupplier.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_StructuredProxyPushSupplier.xml deleted file mode 100644 index 9ba5497fd8..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_StructuredProxyPushSupplier.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyChannelAdmin_StructuredProxyPushSupplier - - - - - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_StructuredProxyPushSupplier - This module implements the OMG CosNotifyChannelAdmin::StructuredProxyPushSupplier interface. - -

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

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotifyComm_NotifySubscribe

-
- -

CosNotification_QoSAdmin

-
- -

CosNotifyFilter_FilterAdmin

-
- -

CosNotifyChannelAdmin_ProxySupplier

-
-
-
- - - connect_structured_push_consumer(StructuredProxyPushSupplier, PushConsumer) -> Reply - Connect a consumer to the proxy - - StructuredProxyPushSupplier = #objref - PushConsumer = #objref - Reply = ok | {'EXCEPTION', #'CosEventChannelAdmin_AlreadyConnected'{}} | {'EXCEPTION', #'CosEventChannelAdmin_TypeError'{}} - - -

This operation connects a PushConsumer to the target object. If - a connection already exists or the function push_structured_event - is not supported by the client object an exception is raised.

-
-
- - suspend_connection(StructuredProxyPushSupplier) -> Reply - Suspend the connection with the target object - - StructuredProxyPushSupplier = #objref - Reply = ok | {'EXCEPTION', #'CosNotifyChannelAdmin_ConnectionAlreadyInactive'{}} | {'EXCEPTION', #'CosNotifyChannelAdmin_NotConnected'{}} - - -

This operation suspends the connection with the target object. If no connection - exists or the connection already is suspended an exception is raised.

-
-
- - resume_connection(StructuredProxyPushSupplier) -> Reply - Resume a previously suspended connection - - StructuredProxyPullConsumer = #objref - Reply = ok | {'EXCEPTION', #'CosNotifyChannelAdmin_ConnectionAlreadyInactive'{}} | {'EXCEPTION', #'CosNotifyChannelAdmin_NotConnected'{}} - - -

If the connection with the target object have been suspended this function - must be used to resume the connection. If no client have been connected or - the connection is active an exception is raised.

-
-
- - disconnect_structured_push_supplier(StructuredProxyPushSupplier) -> ok - Close the connection and terminate the target object - - StructuredProxyPushSupplier = #objref - - -

This operation cause the target object to close the connection and terminate.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_SupplierAdmin.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_SupplierAdmin.xml deleted file mode 100644 index 540edaff3f..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_SupplierAdmin.xml +++ /dev/null @@ -1,195 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyChannelAdmin_SupplierAdmin - - - - Niclas Eklund - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_SupplierAdmin - This module implements the OMG CosNotifyChannelAdmin::SupplierAdmin interface. - -

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

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotification_QoSAdmin

-
- -

CosNotifyComm_NotifyPublish

-
- -

CosNotifyFilter_FilterAdmin

-
-
-
- - - _get_MyID(SupplierAdmin) -> AdminID - Return the objects Id - - SupplierAdmin = #objref - AdminID = long() - - -

When a SupplierAdmin object is created it is given a unique Id - by the creating channel. This readonly attribute maintains this Id.

-
-
- - _get_MyChannel(SupplierAdmin) -> Channel - Return the objects associated channel - - SupplierAdmin = #objref - Channel = #objref - - -

The creating channel's reference is maintained by this readonly attribute.

-
-
- - _get_MyOperator(SupplierAdmin) -> OpType - Return the filter scheme - - SupplierAdmin = #objref - OpType = 'AND_OP' | 'OR_OP' - - -

The Operation Type, which determines the semantics the target object will - use for any associated Filters, is maintained by this readonly attribute.

-
-
- - _get_pull_consumers(SupplierAdmin) -> ProxyIDSeq - Return all associated pull consumers Id:s - - SupplierAdmin = #objref - ProxyIDSeq = [ProxyID] - ProxyID = long() - - -

A sequence of all associated PullProxy Id's is maintained by this - readonly attribute.

-
-
- - _get_push_consumers(SupplierAdmin) -> ProxyIDSeq - Return all associated push consumers Id:s - - SupplierAdmin = #objref - ProxyIDSeq = [ProxyID] - ProxyID = long() - - -

This operation returns all PushProxy Id's created by the target - object.

-
-
- - get_proxy_consumer(SupplierAdmin, ProxyID) -> Reply - Return the Proxy which corresponds to the given Id - - SupplierAdmin = #objref - ProxyID = long() - Reply = Proxy | {'EXCEPTION', #'CosNotifyChannelAdmin_ProxyNotFound'{}} - Proxy = #objref - - -

The Proxy which corresponds to the given Id is returned by this operation.

-
-
- - obtain_notification_pull_consumer(SupplierAdmin, SupplierType) -> Reply - Create a new proxy - - SupplierAdmin = #objref - SupplierType = 'ANY_EVENT' | 'STRUCTURED_EVENT' | 'SEQUENCE_EVENT' - Reply = {Proxy, ProxyID} - Proxy = #objref - ProxyID = long() - - -

This operation creates a new proxy and returns its object reference along with its ID. - The SupplierType parameter determines the event type accepted by the proxy.

-
-
- - obtain_pull_consumer(SupplierAdmin) -> Proxy - Create a new proxy - - SupplierAdmin = #objref - Proxy = #objref - - -

A proxy which accepts #any{} events is created by this operation.

-
-
- - obtain_notification_push_consumer(SupplierAdmin, SupplierType) -> Reply - Create a new proxy - - SupplierAdmin = #objref - SupplierType = 'ANY_EVENT' | 'STRUCTURED_EVENT' | 'SEQUENCE_EVENT' - Reply = {Proxy, ProxyID} - Proxy = #objref - ProxyID = long() - - -

Determined by the SupplierType parameter a compliant proxy is created and - its object reference along with its Id is returned by this operation.

-
-
- - obtain_push_consumer(SupplierAdmin) -> Proxy - Create a new proxy - - SupplierAdmin = #objref - Proxy = #objref - - -

A proxy which accepts #any{} events is created by this operation.

-
-
- - destroy(SupplierAdmin) -> ok - Terminate the target object - - SupplierAdmin = #objref - - -

This operation terminates the SupplierAdmin object and notifies the creating channel - that the target object no longer is active.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyComm_NotifyPublish.xml b/lib/cosNotification/doc/src/CosNotifyComm_NotifyPublish.xml deleted file mode 100644 index a41319cb5c..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyComm_NotifyPublish.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyComm_NotifyPublish - Niclas Eklund - Niclas Eklund - - Niclas Eklund - - 2000-02-01 - 1.0 -
- CosNotifyComm_NotifyPublish - This module implements the OMG CosNotifyComm::NotifyPublish interface. - -

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

--include_lib("cosNotification/include/*.hrl").

-

All objects, which inherit this interface, export functions described in this module.

-
- - - offer_change(Object, Added, Removed) -> Reply - Inform the target object which type of events the supplier will deliver - - Object = #objref - Added = Removed = EventTypeSeq - EventTypeSeq = [type] - Reply = ok | {'EXCEPTION', CosNotifyComm_InvalidEventType{type}} - type = #'CosNotification_EventType'{domain_name, type_name} - domain_name = type_name = string() - - -

Objects supporting this interface can be informed by supplier objects about - which type of events that will be delivered in the future. This operation - accepts two parameters describing new and old event types respectively. - If any of the supplied event type names is syntactically incorrect an exception - is raised.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyComm_NotifySubscribe.xml b/lib/cosNotification/doc/src/CosNotifyComm_NotifySubscribe.xml deleted file mode 100644 index 277c666459..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyComm_NotifySubscribe.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyComm_NotifySubscribe - - - - - - 2000-02-01 - 1.0 -
- CosNotifyComm_NotifySubscribe - This module implements the OMG CosNotifyComm::NotifySubscribe interface. - -

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

--include_lib("cosNotification/include/*.hrl").

-

All objects, which inherit this interface, export functions described in this module.

-
- - - subscription_change(Object, Added, Removed) -> Reply - Inform the target object which event types the client will and will not accept in the future - - Object = #objref - Added = Removed = EventTypeSeq - EventTypeSeq = [type] - Reply = ok | {'EXCEPTION', CosNotifyComm_InvalidEventType{type}} - type = #'CosNotification_EventType'{domain_name, type_name} - domain_name = type_name = string() - - -

This operation takes as input two sequences of event type names - specifying events the client will and will not accept in the future - respectively.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyFilter_Filter.xml b/lib/cosNotification/doc/src/CosNotifyFilter_Filter.xml deleted file mode 100644 index a953540849..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyFilter_Filter.xml +++ /dev/null @@ -1,223 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - CosNotifyFilter_Filter - - - - 2000-02-01 - 1.0 -
- CosNotifyFilter_Filter - This module implements the OMG CosNotifyFilter::Filter interface. - -

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

--include_lib("cosNotification/include/*.hrl").

-
- - - _get_constraint_grammar(Filter) -> Grammar - Return which type of Grammar the Filter uses - - Filter = #objref - Grammar = string() - - -

This operation returns which type of Grammar the Filter uses. Currently, only "EXTENDED_TCL" is supported.

-
-
- - add_constraints(Filter, ConstraintExpSeq) -> Reply - Add new constraints to the filter - - Filter = #objref - ConstraintExpSeq = [Constraint] - ConstraintExp = #'CosNotifyFilter_ConstraintExp'{event_types, constraint_expr} - event_types = #'CosNotification_EventTypeSeq'{} - constraint_expr = string() - Reply = ConstraintInfoSeq | {'EXCEPTION', #'CosNotifyFilter_InvalidConstraint'{constr}} - constr = ConstraintExp - ConstraintInfoSeq = [ConstraintInfo] - ConstraintInfo = #'CosNotifyFilter_ConstraintInfo'{constraint_expression, constraint_id} - constraint_expression = ConstraintExp - constraint_id = long() - - -

Initially, Filters do not contain any constraints, hence, all events will be forwarded. - The add_constraints/2 operation allow us to add constraints to the target object.

-
-
- - modify_constraints(Filter, ConstraintIDSeq, ConstraintInfoSeq) -> Reply - Modify existing constraints - - Filter = #objref - ConstraintIDSeq = [ConstraintID] - ConstraintID = long() - ConstraintInfoSeq = [ConstraintInfo] - ConstraintInfo = #'CosNotifyFilter_ConstraintInfo'{constraint_expression, constraint_id} - constraint_expression = ConstraintExp - constraint_id = long() - Reply = ok | {'EXCEPTION', #'CosNotifyFilter_InvalidConstraint'{constr}} | {'EXCEPTION', #'CosNotifyFilter_ConstraintNotFound'{id}} - constr = ConstraintExp - id = long() - ConstraintExp = #'CosNotifyFilter_ConstraintExp'{event_types, constraint_expr} - event_types = #'CosNotification_EventTypeSeq'{} - constraint_expr = string() - - -

This operation is invoked by a client in order to modify the constraints associated - with the target object. The constraints related to the Id's in the parameter sequence - ConstraintIDSeq will, if all values are valid, be deleted. The ConstraintInfoSeq - parameter contains of Id-Expression pairs and a constraint matching one of the unique - Id's will, if all input values are correct, be updated. If the parameters contain incorrect - data en exception will be raised.

-
-
- - get_constraints(Filter, ConstraintIDSeq) -> Reply - Return all constraints which match the supplied Ids - - Filter = #objref - ConstraintIDSeq = [ConstraintID] - ConstraintID = long() - Reply = ConstraintInfoSeq | {'EXCEPTION', #'CosNotifyFilter_ConstraintNotFound'{id}} - ConstraintInfoSeq = [ConstraintInfo] - ConstraintInfo = #'CosNotifyFilter_ConstraintInfo'{constraint_expression, constraint_id} - constraint_expression = ConstraintExp - constraint_id = id = long() - - -

This operation return a sequence of ConstraintInfo's, related to the given ConstraintID's, - associated with the target object.

-
-
- - get_all_constraints(Filter) -> ConstraintInfoSeq - Return all constraints associated with the target object - - Filter = #objref - ConstraintInfoSeq = [ConstraintInfo] - ConstraintInfo = #'CosNotifyFilter_ConstraintInfo'{constraint_expression, constraint_id} - constraint_expression = ConstraintExp - constraint_id = long() - - -

All constraints, and their unique Id, associated with the target object will be returned by this operation.

-
-
- - remove_all_constraints(Filter) -> ok - Remove all constraints associated with the target object - - Filter = #objref - - -

All constraints associated with the target object are removed by this operation and, since - the the target object no longer contain any constraints, true will always be the result of - any match operation.

-
-
- - destroy(Filter) -> ok - Terminate the target object - - Filter = #objref - - -

This operation terminates the target object.

-
-
- - match(Filter, Event) -> Reply - Match the Any event if it satisfies at least one constraint - - Filter = #objref - Event = #any - Reply = boolean() | {'EXCEPTION', #'CosNotifyFilter_UnsupportedFilterableData'{}} - - -

This operation accepts an #any{} event and returns true if it satisfies - at least one constraint. If the event contains data of the wrong type, e.g., should be - a string() but in fact i a short(), an exception is raised.

-
-
- - match_structured(Filter, Event) -> Reply - Match the structured event if it satisfies at least one constraint - - Filter = #objref - Event = #'CosNotification_StructuredEvent'{} - Reply = boolean() | {'EXCEPTION', #'CosNotifyFilter_UnsupportedFilterableData'{}} - - -

This operation is similar to the match operation but accepts structured - events instead.

-
-
- - attach_callback(Filter, NotifySubscribe) -> CallbackID - Connect NotifySubscribe object, which should be informed when the target object's constraints are updated - - Filter = #objref - NotifySubscribe = #objref - CallbackID = long() - - -

This operation connects a NotifySubscribe object, which should be informed - when the target object's constraints are updated. A unique Id is returned - which must be stored if we ever want to detach the callback object in the future.

-
-
- - detach_callback(Filter, CallbackID) -> Reply - Disconnect the NotifySubscribe object with the given Id - - Filter = #objref - CallbackID = long() - Reply = ok | {'EXCEPTION', #'CosNotifyFilter_CallbackNotFound'{}} - - -

If the target object has an associated callback that matches the supplied - Id it will be removed and longer informed of any updates. If no object - with a matching Id is found an exception is raised.

-
-
- - get_callbacks(Filter) -> CallbackIDSeq - Return all NotifySubscribe Id's associated with the target object - - Filter = #objref - CallbackIDSeq = [CallbackID] - CallbackID = long() - - -

This operation returns a sequence of all connected NotifySubscribe object Id's. - If no callbacks are associated with the target object the list will be empty.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyFilter_FilterAdmin.xml b/lib/cosNotification/doc/src/CosNotifyFilter_FilterAdmin.xml deleted file mode 100644 index 5cb56963f1..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyFilter_FilterAdmin.xml +++ /dev/null @@ -1,112 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyFilter_FilterAdmin - Niclas Eklund - Niclas Eklund - - Niclas Eklund - - 2000-02-01 - 1.0 -
- CosNotifyFilter_FilterAdmin - This module implements the OMG CosNotifyFilter::FilterAdmin interface. - -

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

--include_lib("cosNotification/include/*.hrl").

-

All objects, which inherit this interface, export functions described in this module.

-
- - - add_filter(Object, Filter) -> FilterID - Add a new filter to the target object - - Object = #objref - Filter = #objref - FilterID = long() - - -

This operation connects a new Filter to the target object. This Filter will, together - with other associated Filters, be used to select events to forward. A unique Id is - returned and should be used if we no longer want to consult the given Filter.

-
-
- - remove_filter(Object, FilterID) -> ok - Remove a filter associated with the target object - - Object = #objref - FilterID = long() - - -

If a certain Filter no longer should be associated with the target object - this operation must be used. Events will no longer be tested against the Filter - associated with the given Id.

-
-
- - get_filter(Object, FilterID) -> Reply - Return the filter with the given Id - - Object = #objref - FilterID = long() - Reply = Filter | {'EXCEPTION', #'CosNotifyFilter_FilterNotFound'{}} - Filter = #objref - - -

If the target object is associated with a Filter matching the given Id the - reference will be returned. If no such Filter is known by the target object - an exception is raised.

-
-
- - get_all_filters(Object) -> FilterIDSeq - Return a list of all filter Id:s associated with the target object - - Object = #objref - FilterIDSeq = [FilterID] - FilterID = long() - - -

Id's for all Filter objects associated with the target object is - returned by this operation.

-
-
- - remove_all_filters(Object) -> ok - Remove all filters from the target object - - Object = #objref - - -

If we want to remove all Filters associated with the target object we can use this function.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyFilter_FilterFactory.xml b/lib/cosNotification/doc/src/CosNotifyFilter_FilterFactory.xml deleted file mode 100644 index adacbc3281..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyFilter_FilterFactory.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyFilter_FilterFactory - Niclas Eklund - Niclas Eklund - - Niclas Eklund - - 2000-02-01 - 1.0 -
- CosNotifyFilter_FilterFactory - This module implements the OMG CosNotifyFilter::FilterFactory interface. - -

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

--include_lib("cosNotification/include/*.hrl").

-
- - - create_filter(FilterFactory, Grammar) -> Reply - Create a Filterobject - - FilterFactory = #objref - Grammar = string() - Reply = Filter | {'EXCEPTION', #'CosNotifyFilter_InvalidGrammar'{}} - Filter = #objref - - -

This operation creates a new Filter object, under the condition - that Grammar given is supported. Currently, only "EXTENDED_TCL" is supported.

-
-
- - create_mapping_filter(FilterFactory, Grammar) -> Reply - Create a MappingFilterobject - - FilterFactory = #objref - Grammar = string() - Reply = MappingFilter | {'EXCEPTION', #'CosNotifyFilter_InvalidGrammar'{}} - Filter = #objref - - -

This operation creates a new MappingFilter object, under the condition - that Grammar given is supported. Currently, only "EXTENDED_TCL" is supported.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyFilter_MappingFilter.xml b/lib/cosNotification/doc/src/CosNotifyFilter_MappingFilter.xml deleted file mode 100644 index c0db8c1ae0..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyFilter_MappingFilter.xml +++ /dev/null @@ -1,228 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - CosNotifyFilter_MappingFilter - - - - 2000-02-01 - 1.0 -
- CosNotifyFilter_MappingFilter - This module implements the OMG CosNotifyFilter::MappingFilter interface. - -

The main purpose of this module is to match events against associated - constraints and return the value for the first constraint that returns - true for the given event. If all constraints return false the default value - will be returned.

-

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

--include_lib("cosNotification/include/*.hrl").

-
- - - _get_constraint_grammar(MappingFilter) -> Grammar - Return which type of Grammar the MappingFilter uses - - MappingFilter = #objref - Grammar = string() - - -

This operation returns which type of Grammar the MappingFilter uses. - Currently, only "EXTENDED_TCL" is supported.

-
-
- - _get_value_type(MappingFilter) -> CORBA::TypeCode - Return the CORBA::TypeCodeof the default value associated with the target object - - MappingFilter = #objref - - -

This readonly attribute maintains the CORBA::TypeCode of the default value - associated with the target object.

-
-
- - _get_default_value(MappingFilter) -> #any - Return the #any{} default value associated with the target object - - MappingFilter = #objref - - -

This readonly attribute maintains the #any{} default value associated with - the target object.

-
-
- - add_mapping_constraints(MappingFilter, MappingConstraintPairSeq) -> Reply - Add new mapping constraints - - MappingFilter = #objref - MappingConstraintPairSeq = [MappingConstraintPair] - MappingConstraintPair = #'CosNotifyFilter_MappingConstraintPair'{constraint_expression, result_to_set} - constraint_expression = #'CosNotifyFilter_ConstraintExp'{event_types, constraint_expr} - event_types = #'CosNotification_EventTypeSeq'{} - constraint_expr = string() - result_to_set = #any - Reply = MappingConstraintInfoSeq | {'EXCEPTION', #'CosNotifyFilter_InvalidConstraint'{constr}} | {'EXCEPTION', #'CosNotifyFilter_InvalidValue'{constr, value}} - constr = ConstraintExp - ConstraintExp = #'CosNotifyFilter_ConstraintExp'{event_types, constraint_expr} - event_types = #'CosNotification_EventTypeSeq'{} - constraint_expr = string() - MappingConstraintInfoSeq = [MappingConstraintInfo] - MappingConstraintInfo = #'CosNotifyFilter_MappingConstraintInfo'{constraint_expression, constraint_id, value} - constraint_expression = ConstraintExp - constraint_id = long() - value = #any - - -

This operation add new mapping constraints, which will be used when trying to override - Quality of Service settings defined in the given event. If a constraint return true the - associated value will be returned, otherwise the default value.

-
-
- - modify_constraints(MappingFilter, ConstraintIDSeq, MappingConstraintInfoSeq) -> Reply - Modify the constraints associated with the target object - - MappingFilter = #objref - ConstraintIDSeq = [ConstraintID] - ConstraintID = long() - MappingConstraintInfoSeq = [MappingConstraintInfo] - MappingConstraintInfo = #'CosNotifyFilter_MappingConstraintInfo'{constraint_expression, constraint_id, value} - constraint_expression = ConstraintExp - constraint_id = long() - value = #any - ConstraintInfoSeq = [ConstraintInfo] - ConstraintInfo = #'CosNotifyFilter_ConstraintInfo'{constraint_expression, constraint_id} - constraint_expression = ConstraintExp - constraint_id = long() - Reply = ok | {'EXCEPTION', #'CosNotifyFilter_InvalidConstraint'{constr}} | {'EXCEPTION', #'CosNotifyFilter_ConstraintNotFound'{id}} | {'EXCEPTION', #'CosNotifyFilter_InvalidValue'{constr, value}} - constr = ConstraintExp - id = long() - value = #any - ConstraintExp = #'CosNotifyFilter_ConstraintExp'{event_types, constraint_expr} - event_types = #'CosNotification_EventTypeSeq'{} - constraint_expr = string() - - -

The ConstraintIDSeq supplied should relate to constraints the caller wishes to - remove. If any of the supplied Id's are not found an exception will be raised. This - operation also accepts a sequence of MappingConstraintInfo which will be added. - If the target object cannot modify the constraints as requested an exception is raised - describing which constraint, and why, could not be updated.

-
-
- - get_mapping_constraints(MappingFilter, ConstraintIDSeq) -> Reply - Return the target object's associated constraints with given ID:s - - MappingFilter = #objref - ConstraintIDSeq = [ConstraintID] - ConstraintID = long() - Reply = MappingConstraintInfoSeq | {'EXCEPTION', #'CosNotifyFilter_ConstraintNotFound'{id}} - MappingConstraintInfoSeq = [MappingConstraintInfo] - MappingConstraintInfo = #'CosNotifyFilter_MappingConstraintInfo'{constraint_expression, constraint_id, value} - constraint_expression = ConstraintExp - ConstraintExp = #'CosNotifyFilter_ConstraintExp'{event_types, constraint_expr} - event_types = #'CosNotification_EventTypeSeq'{} - constraint_expr = string() - constraint_id = id = long() - value = #any - - -

When adding a new constraint a unique Id is returned, which is accepted as input for this - operation. The associated constraint is returned, but if no such Id exists an exception is raised.

-
-
- - get_all_mapping_constraints(MappingFilter) -> MappingConstraintInfoSeq - Return the target object's all associated constraints - - MappingFilter = #objref - MappingConstraintInfoSeq = [MappingConstraintInfo] - MappingConstraintInfo = #'CosNotifyFilter_MappingConstraintInfo'{constraint_expression, constraint_id, value} - constraint_expression = ConstraintExp - ConstraintExp = #'CosNotifyFilter_ConstraintExp'{event_types, constraint_expr} - event_types = #'CosNotification_EventTypeSeq'{} - constraint_expr = string() - constraint_id = long() - value = #any - - -

This operation returns a sequence of all unique Id's associated with the target object. - If no constraint have been added the sequence will be empty.

-
-
- - remove_all_mapping_constraints(MappingFilter) -> ok - Remove all constraints associated with the target object - - MappingFilter = #objref - - -

This operation removes all constraints associated with the target object.

-
-
- - destroy(MappingFilter) -> ok - Terminate the target object - - MappingFilter = #objref - - -

This operation terminates the target object. Remember to remove - this Filter from the objects it have been associated with.

-
-
- - match(MappingFilter, Event) -> Reply - Evaluate the given Any event with the Filter's constraints - - MappingFilter = #objref - Event = #any - Reply = {boolean(), #any} | {'EXCEPTION', #'CosNotifyFilter_UnsupportedFilterableData'{}} - - -

This operation evaluates Any events with the Filter's constraints, - and returns the value to use. The value is the default value if all constraints - returns false and the value associated with the first constraint returning true.

-
-
- - match_structured(MappingFilter, Event) -> Reply - Evaluate the given structured event with the Filter's constraints - - MappingFilter = #objref - Event = #'CosNotification_StructuredEvent'{} - Reply = {boolean(), #any} | {'EXCEPTION', #'CosNotifyFilter_UnsupportedFilterableData'{}} - - -

Similar to match/2 but accepts a structured event as input.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/Makefile b/lib/cosNotification/doc/src/Makefile deleted file mode 100644 index 43ed8294c4..0000000000 --- a/lib/cosNotification/doc/src/Makefile +++ /dev/null @@ -1,167 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2000-2017. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions 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=$(COSNOTIFICATION_VSN) -APPLICATION=cosNotification - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/$(APPLICATION)-$(VSN) - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- -XML_APPLICATION_FILES = ref_man.xml -XML_REF3_FILES = \ - cosNotificationApp.xml \ - CosNotifyChannelAdmin_EventChannelFactory.xml \ - CosNotifyChannelAdmin_EventChannel.xml \ - CosNotification.xml \ - CosNotification_QoSAdmin.xml \ - CosNotification_AdminPropertiesAdmin.xml \ - CosNotifyChannelAdmin_ConsumerAdmin.xml \ - CosNotifyChannelAdmin_SupplierAdmin.xml \ - CosNotifyComm_NotifyPublish.xml \ - CosNotifyComm_NotifySubscribe.xml \ - CosNotifyFilter_FilterAdmin.xml \ - CosNotifyFilter_FilterFactory.xml \ - CosNotifyFilter_Filter.xml \ - CosNotifyFilter_MappingFilter.xml \ - CosNotifyChannelAdmin_ProxyConsumer.xml \ - CosNotifyChannelAdmin_ProxySupplier.xml \ - CosNotifyChannelAdmin_ProxyPullConsumer.xml \ - CosNotifyChannelAdmin_ProxyPullSupplier.xml \ - CosNotifyChannelAdmin_ProxyPushConsumer.xml \ - CosNotifyChannelAdmin_ProxyPushSupplier.xml \ - CosNotifyChannelAdmin_SequenceProxyPullConsumer.xml \ - CosNotifyChannelAdmin_SequenceProxyPullSupplier.xml \ - CosNotifyChannelAdmin_SequenceProxyPushConsumer.xml \ - CosNotifyChannelAdmin_SequenceProxyPushSupplier.xml \ - CosNotifyChannelAdmin_StructuredProxyPullConsumer.xml \ - CosNotifyChannelAdmin_StructuredProxyPullSupplier.xml \ - CosNotifyChannelAdmin_StructuredProxyPushConsumer.xml \ - CosNotifyChannelAdmin_StructuredProxyPushSupplier.xml \ - - - -XML_PART_FILES = \ - part.xml -XML_CHAPTER_FILES = \ - ch_contents.xml \ - ch_introduction.xml \ - ch_install.xml \ - ch_system.xml \ - ch_BNF.xml \ - ch_QoS.xml \ - ch_example.xml \ - notes.xml - -BOOK_FILES = book.xml - -XML_FILES = $(BOOK_FILES) $(XML_APPLICATION_FILES) $(XML_REF3_FILES) \ - $(XML_PART_FILES) $(XML_CHAPTER_FILES) - -TECHNICAL_DESCR_FILES = - -GIF_FILES = \ - eventstructure.gif \ - notificationFlow.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 = \ - $(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) - -HTML_REF_MAN_FILE = $(HTMLDIR)/index.html - -TOP_PDF_FILE = $(PDFDIR)/$(APPLICATION)-$(VSN).pdf - -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -XML_FLAGS += -DVIPS_FLAGS += - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -$(HTMLDIR)/%.gif: %.gif - $(INSTALL_DATA) $< $@ - -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 *~ - -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 - -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" - -release_spec: diff --git a/lib/cosNotification/doc/src/book.xml b/lib/cosNotification/doc/src/book.xml deleted file mode 100644 index 3151abceaa..0000000000 --- a/lib/cosNotification/doc/src/book.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosNotification - Niclas Eklund - - 2000-01-31 - 1.0 -
- - - cosNotification - - - - - - - - - - - - - - -
- diff --git a/lib/cosNotification/doc/src/ch_BNF.xml b/lib/cosNotification/doc/src/ch_BNF.xml deleted file mode 100644 index 9763c0c4ca..0000000000 --- a/lib/cosNotification/doc/src/ch_BNF.xml +++ /dev/null @@ -1,457 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Filters and the Constraint Language BNF - - - 2000-04-13 - - ch_BNF.xml -
- -
- Filters and the Constraint Language BNF -

This chapter describes, the grammar supported by - CosNotifyFilter_Filter and - CosNotifyFilter_MappingFilter, - and how to create and use filter objects. -

- -
- How to create filter objects -

To be able to filter events we must create a filter and associate - it with one, or more, of the administrative or proxy objects. In the example - below, we choose to associate the filter with a ConsumerAdmin object.

- -FilterFactory = cosNotificationApp:start_filter_factory(), -Filter = 'CosNotifyFilter_FilterFactory': - create_filter(FilterFactory,"EXTENDED_TCL"), -ConstraintInfoSeq = 'CosNotifyFilter_Filter': - add_constraints(Filter, ConstraintExpSeq), -FilterID = 'CosNotifyChannelAdmin_ConsumerAdmin': - add_filter(AdminConsumer, Filter), - -

"EXTENDED_TCL" is the only grammar supported by Orber Notification - Service.

-

Depending on which operation type the Admin object uses, i.e., - 'AND_OP' or 'OR_OP', events will be tested using the - associated filter. The operation properties are:

-

- - -

'AND_OP' - must be approved by the proxy's and its parent admin's - filters. If all filters associated with an object (Admin or Proxy) - return false the event will be discarded. In this situation it is pointless - to try and verify with the other object's associated filters since the outcome - still would be the same.

-
- -

'OR_OP' - if one of the object's (Admin or Proxy) filters return true, the event - will not be checked against any other filter associated with a proxy or its - parent admin. If a object's associated filters all return false, - the event will be forwarded to related proxies/admins, and - tested against any associated filters.

-
-
-

Initially, filters are empty and will always return true. Hence, we must - add constraints by using 'CosNotifyFilter_Filter':add_constraints/2. - As input, the second argument must be a sequence of:

- -#'CosNotifyFilter_ConstraintExp'{ - event_types = [#'CosNotification_EventType'{ - domain_name = string(), - type_name = string()}], - constraint_expr = string()} - -

The event_types describes which types of events that should be matched using - the associated constraint_expr.

-

If a constraint expression is supposed to apply for all events, then the type_name can - be set to the special event type %ALL in a constraint's event type sequence. The - domain_name should be "" or "*".

-

In the following sections we will take a closer look on how to write - constraint expressions.

-
- -
- The CosNotification Constraint Language -

The constraint language supported by the Notification Service is:

- := /* empty */ - | - - := - - := or - | - - := and - | - - := == - | != - | < - | <= - | > - | >= - | - - := in /* sequence only */ - | - | in $ /* sequence only */ - - := ~ /* string data types only */ - | - - := + - | - - | - - := * - | / - | - - := not - | - - := ( ) - | exist - | - | - | - - | - | TRUE - | FALSE - | + - | exist $ - | $ - | default $ /* discriminated unions only */ - - := /* empty */ - | . - | - | - | /* run-time variable */ - - := /* empty */ - | . - | - | - - := - | - | - | _length /* only valid for arrays or sequences */ - | _d /* discriminated unions only */ - | _type_id /* only valid if possible to obtain */ - | _repos_id /* only valid if possible to obtain */ - - := [ ] - - := ( ) - - := - - := ( ) - - := /* empty */ - | - | - - | + - | - -/* Character set issues */ - := - | \ < Leader> - - := /* */ - | - - := - | - - := - | . - | . - | . - - := - - := + - | - - - := E - | e - - := - | - - := ' ' - - := /* */ - | - - := - | - | - | - - := \\ - | \' - - := - - := - | - | _ - - is the set of alphabetic characters [A-Za-z] - is the set of digits [0-9] - is the set of ASCII characters that are not , , or - ]]> -

In the absence of parentheses, the following precedence relations hold :

- - (), exist, default, unary-sign - not - *, / - +, - - ~ - in - ==, !=, , , >, >= - and - or - -
- -
- The Constraint Language Data Types -

The Notification Service Constraint Language, defines how to write - constraint expressions, which can be used to filter events. The - representation does, however, differ slightly from ordinary Erlang terms.

-

When creating a ConstraintExp, the field constraint_expr must be - set to contain a string, e.g., . The Notification Service Constraint - Language, is designed to be able to filter structured and unstructured events - using the same constraint expression. The Constraint Language Types and Operations - can be divided into two sub-groups:

- - -

Basic - arithmetics, strings, constants, numbers etc.

-
- -

Complex - accessing members of complex data types, such as unions.

-
-
-

Some of the basic types, e.g., integer, are self explanatory. Hence, they are not described further.

- - - Type/Operation - Examples - Description - - - string - "'MyString'" - Strings are represented as a sequence of zero or more ]]>s enclosed in single quotes, e.g., 'string'. - - - ~ - "'Sring1' ~ 'String2'" - The operator ~is called the substring operator and mean "String1 is contained within String2". - - - boolean - "TRUE == (('lang' ~ 'Erlang' + 'fun' ~ 'functional') >= 2)" - Booleans may only be TRUE or FALSE, i.e., only capital letters. Expressions which evaluate to TRUE or FALSE can be summed up and matched, where TRUE equals 1 and FALSE 0. - - - sequence - "myIntegerSequence[2]" - The BNF use C/C++ notation, i.e., the example will return the thirdelement. - - - _length - "myIntegerSequence._length" - Returns the length of an sequence or array. - - - in - "'Erlang' in $.FunctionalLanguagesStringSeq" - Returns TRUEif a given element is found in the given sequence. The element must be of a simple type and the same as the sequence is defined to contain. - - - $ - "$ == 40" - Denote the current event as well as any run-time variables. If the event is unstructured and its contained value 40, the example will return TRUE. - - - . - "$.MyStructMember == 40" - The structure member operator .may be used to reference its members when the data refers to a named structure, discriminated union, or CORBA::Any data structure. - - - _type_id - "$._type_id == 'MyStruct'" - Returns the unscoped IDL type name of the component. This operation is only valid if said information can be obtained. - - - _repos_id - "$._repos_id == 'IDL:MyModule/MyStruct:1.0'" - Returns the RepositoryId of the component. This operation is only valid if said information can be obtained. - - - _d - "$.eventUnion._d" - May only be used when accessing discriminated unions and refers to the discriminator. - - - exist - "exist $.eventUnion._d and $.eventUnion._d == 10" - To avoid that a filtering of an event fails due to that, for example, we try to compare a union discriminator which does not exist, we can use this operator. - - - default - "default $.eventUnion._d" - If the _doperation is in conjunction with the defaultoperation, TRUE will be returned if the union has a default member that is active. - - - union - "$.(0) == 5"eq. "$.('zero') == 5" - When the component refers to a union, with one of the cases defined as case 0: short zero;, we use 0or 'zero'. The result of the example is TRUEif the union has a discriminator set to 0and the value 5. If more than one case is defined to be'zero', $.('zero')accepts both; $.(0)only returns TRUEif the discriminator is set to 0. Leaving out the identifier, i.e., $.(), refers to the default value. - - - name-value pairs - "$.NameValueSeq('myID') == 5"eq."$.NameValueSeq[1].name == 'myID' and $.NameValueSeq[1].value == 5" - The Notification service makes extensive use of name-value pairssequences within structured events, which allow us to via the identifier nameaccess its value, as shown in the example. - - Table 1: Type and Operator Examples -
-

In the next section we will take a closer look at how it is possible to write constraints using - different types of notation etc.

-
- -
- Accessing Data In Events -

To filter events, the supplied constraints must describe the contents of - the events and desired values. We can, for example, state that we are only - interested in receiving events which are of type CommunicationsAlarm. - To be able to achieve this, the constraint must contain information - that points out which fields to compare with. Figure one illustrates a conceptual overview of a - structured event. The exact definition is found in the CosNotification.idl file.

- - - -Figure 1: The structure of a structured event. - -

The Notification Service supports different constraint expressions - notation:

- - -

Fully scoped, e.g., "$.header.fixed_header.event_type.type_name == 'CommunicationsAlarm'"

-
- -

Short hand, e.g., "$type_name == 'CommunicationsAlarm'"

-
- -

Positional Notation, e.g., "$.0.0.0.1 == 'CommunicationsAlarm'"

-
-
- -

Which notation to use is up to the user, however, the fully scoped may - be easier to understand, but in some cases, if received from an ORB that do not populate ID:s of - named parts, the positional notation is the only option.

-
- -

If a constraint, which access fields in a structured event structure, - is supposed to handle unstructured events as well, the CORBA::Any must contain - the same type of members.

-
-

How to filter against the fixed header fields, is described in the - table below.

- - - Field - Fully Scoped Constraint - Short Hand Constraint - - - type_name - "$.header.fixed_header.event_type.type_name == 'Type'" - "$type_name == 'Type'" - - - domain_name - "$.header.fixed_header.event_type.domain_name == 'Domain'" - "$domain_name == 'Domain'" - - - event_name - "$.header.fixed_header.event_name == 'Event'" - "$event_name == 'Event'" - - Table 2: Fixed Header Constraint Examples -
-

If we are only interested in receiving events regarding 'Domain', 'Event' - and 'Type', the constraint can look like - "$domain_name == 'Domain' and $event_name == 'Event' and $type_name == 'Type'".

-

The variable event header consists of a sequence of name-value pairs. One way to filter on these are to use a constraint that looks - like "($.header.variable_header[1].name == 'priority' and $.header.variable_header[1].value > 0)". An easier way to - accomplish the same result is to use a constraint that treats the name-value - pair as an associative array, i.e., when given a name the corresponding - value is returned. Hence, instead we can use - "$.header.variable_header(priority) > 0".

-

Accessing the event body is done in the same way as for the event header - fields. The user must, however, be aware of, that if a run-time variable - ($variable) is used data in the event header may take precedence. - The order of precedence is:

- - Reserved, e.g., $curtime - A simple-typed member of $.header.fixed_header. - Properties in $.header.variable_header. - Properties in $.filterable_data. - If no match is found it is translated to $.variable. - -
- -
- Mapping Filters -

Mapping Filters may only be associated with Consumer Administrators or Proxy - Suppliers. The purpose of a Mapping Filter is to override Quality of Service - settings.

-

Initially, Mapping Filters are empty and will always return true. Hence, we must - add constraints by using 'CosNotifyFilter_MappingFilter':add_mapping_constraints/2. - If a constraint matches, the associated value will be used instead of the - related Quality of Service system settings.

-

As input, the second argument must be a sequence of:

- -#'CosNotifyFilter_MappingConstraintPair'{ - constraint_expression = #'CosNotifyFilter_ConstraintExp'{ - event_types = [#'CosNotification_EventType'{ - domain_name = string(), - type_name = string()}], - constraint_expr = string()}, - result_to_set = any()} - -
-
-
- diff --git a/lib/cosNotification/doc/src/ch_QoS.xml b/lib/cosNotification/doc/src/ch_QoS.xml deleted file mode 100644 index 7f7a26f69a..0000000000 --- a/lib/cosNotification/doc/src/ch_QoS.xml +++ /dev/null @@ -1,252 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Quality Of Service and Admin Properties - - - 2000-05-29 - - ch_QoS.xml -
- -
- Quality Of Service and Admin Properties -

This chapter explains the allowed properties for - CosNotification_QoSAdmin and - CosNotification_AdminPropertiesAdmin. -

- -
- Quality Of Service -

The cosNotification application supports the following QoS settings:

- - - QoS - Range - Default - - - EventReliability - BestEffort/Persistent - BestEffort - - - ConnectionReliability - BestEffort/Persistent - BestEffort - - - Priority - +/-32767 - 0 - - - OrderPolicy - Any-, Fifo-, Priority- and Deadline-Order - PriorityOrder - - - DiscardPolicy - RejectNewEvents, Any-, Fifo-, Lifo-, Priority- and Deadline-Order - RejectNewEvents - - - MaximumBatchSize - long() > 0 - 1 - - - PacingInterval - TimeBase::TimeT (see cosTime) - 0 - - - StartTimeSupported - boolean - false - - - StopTimeSupported - boolean - false - - - MaxEventsPerConsumer - long() > 0 - 100 - - - Timeout - TimeBase::TimeT (see cosTime) - No timeout - - Table 1: Supported QoS Settings -
-

-

-

-

-

Comments on the table 'Supported QoS Settings':

- - EventReliability - To allow full Persistent EventReliability, every event must - be stored in a stable storage which would create a relatively - huge overhead. Hence, only lightweight version of the Persistent - QoS is supported. The configuration parameters max_events, - interval_events and timeout_events determine - the behavior of this setting. - ConnectionReliability - If this QoS is set to BestEffort and a client object returns anything - other than ok to its associated Proxy, the Proxy will discard - all events and terminate. Using Persistent and anything other than ok - is returned, events will be dropped but the proxy will retry later when - next delivery is due. A child may not have Persistent while its parent - has BestEffort QoS set, e.g., Proxy vs. Admin. If OBJECT_NOT_EXIST, - NO_PERMISSION or CosEventComm_Disconnected is thrown, - the associated object will terminate even if this parameter is - set to Persistent. - Priority - This QoS will treat all events as if they have the Priority equal to - current value, unless the event itself contains a Priority setting, - this event will be treated accordingly. Note: for this property to - have any effect, the DiscardPolicy and/or OrderPolicy must be set - to PriorityOrder. - OrderPolicy - If set to PriorityOrder, events with the highest Priority will be - delivered first. Deadline order will forward events with shortest - expiry time first. If two events have the same priority, they will be - delivered in FIFO-order. - DiscardPolicy - If set to PriorityOrder and MaxEventsPerConsumer limit is - reached, events - with the lowest Priority will be discarded first. Deadline order will - discard events with shortest expiry time first. - MaximumBatchSize - Only valid if the object is supposed to handle a sequence of structured - events and determines the largest amount of events that may be passed - each time. - PacingInterval - Determines how long an object will wait before forwarding a structured - event sequence of length equal to, or less than MaximumBatchSize. - If set to 0, which is the default behavior, no timeout is used and - the events are forwarded when the MaximumBatchSize is reached. - StartTimeSupported - If set to true events which contains the QoS Property StartTime - (TimeBase::UtcT - absolute time) will not be delivered until the - StartTime value have been exceeded. See also the cosTime application. - StopTimeSupported - If set to true, events which contain the QoS Properties StopTime - (TimeBase::UtcT - absolute time) or Timeout (TimeBase::TimeT - - relative time) will be discarded if the object has not been able to - deliver the event in time. See also the cosTime application. - MaxEventsPerConsumer - The maximum number of events the associated object may store before discarding - events in the way described by the DiscardPolicy. - Timeout - If this QoS property is not included in the event, and the Property - StopTimeSupported equals true, this setting will be applied - if events cannot be delivered within its time limit. - - -

Several of the above QoS Properties can be changed during run-time but we strongly advice - not to since, if a relatively large amount of events are waiting for delivery, some of the - QoS settings would require a total reorder of the events. The QoS property ConnectioReliability - may never be updated during run-time since it may cause deadlock. Run-time, in this case, - means activating the Channel by sending the first event.

-
-
- -
- Setting Quality Of Service -

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

- -QoSPersistent = - [#'CosNotification_Property' - {name='CosNotification':'ConnectionReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'Persistent'())}], -'CosNotification_QoSAdmin':set_qos(Ch, QoSPersistent), - -

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

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

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

-
- -
- Admin Properties -

The cosNotification application supports the following Admin Properties:

- - - Property - Range - Default - - - MaxQueueLength - 0 - 0 - - - MaxConsumers - long() >= 0 - 0 - - - MaxSuppliers - long() >= 0 - 0 - - Table 2: Supported Admin Properties -
-

According to the OMG specification the default values for Admin Properties - is supposed to be 0, which means that no limit applies to these - properties.

- -

Admin Properties can only be set on a Channel Object level, i.e., - they will not have an impact on any Admin or Proxy Objects. Currently, - setting the Admin Property MaxQueueLength have no effect since - we cannot discard events accordingly to the Quality of Service Property - DiscardPolicy.

-
-
-
-
- diff --git a/lib/cosNotification/doc/src/ch_contents.xml b/lib/cosNotification/doc/src/ch_contents.xml deleted file mode 100644 index 11014f693b..0000000000 --- a/lib/cosNotification/doc/src/ch_contents.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - The cosNotification Application - Niclas Eklund - - 2000-01-31 - 1.0 - ch-contents.xml -
- -
- Content Overview -

The cosNotification documentation is divided into three sections: -

- - -

PART ONE - The User's Guide -

-Description of the cosNotification Application including - services and a small tutorial demonstrating - the development of a simple service.

-
- -

PART TWO - Release Notes -

-A concise history of cosNotification.

-
- -

PART THREE - The Reference Manual -

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

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

The User's Guide contains the following parts:

- - -

cosNotification overview

-
- -

cosNotification installation

-
- -

A tutorial example

-
-
-
-
- diff --git a/lib/cosNotification/doc/src/ch_example.xml b/lib/cosNotification/doc/src/ch_example.xml deleted file mode 100644 index a86aaccc82..0000000000 --- a/lib/cosNotification/doc/src/ch_example.xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosNotification Examples - Niclas Eklund - - 2000-01-31 - A - ch_example.xml -
- -
- A Tutorial on How to Create a Simple Service - -
- Interface Design -

To use the cosNotification application clients must be implemented. - There are twelve types of clients:

- - Structured Push Consumer - Sequence Push Consumer - Any Push Consumer - Structured Pull Consumer - Sequence Pull Consumer - Any Pull Consumer - Structured Push Supplier - Sequence Push Supplier - Any Push Supplier - Structured Pull Supplier - Sequence Pull Supplier - Any Pull Supplier - -

The interfaces for these participants are defined in CosNotification.idl - and CosNotifyComm.idl.

-
- -
- Generating a Client Interface -

We start by creating an interface which inherits from the correct interface, e.g., CosNotifyComm::SequencePushConsumer. Hence, - we must also implement all operations defined in the SequencePushConsumer interface. The IDL-file could look like:

- -#include - -module myClientImpl { - - interface ownInterface:CosNotifyComm::SequencePushConsumer { - - void ownFunctions(in any NeededArguments) - raises(Systemexceptions,OwnExceptions); - - }; -}; - -#endif - ]]> -

Run the IDL compiler on this file by calling the ic:gen/1 function. - This will produce the API named myClientImpl_ownInterface.erl. - After generating the API stubs and the server skeletons it is time to - implement the servers and if no special options are sent - to the IDl compiler the file name is myClientImpl_ownInterface_impl.erl.

-

The callback module must contain the necessary functions inherited from - CosNotification.idl and CosNotifyComm.idl.

-
- -
- How to Run Everything -

Below is a short transcript on how to run cosNotification.

- - -%% Start Mnesia and Orber -mnesia:delete_schema([node()]), -mnesia:create_schema([node()]), -orber:install([node()]), -mnesia:start(), -orber:start(), - -%% If cosEvent not installed before it is necessary to do it now. -cosEventApp:install(), - -%% Install cosNotification in the IFR. -cosNotificationApp:install(30), - -%% Register the application specific Client implementations -%% in the IFR. -'oe_myClientImpl':'oe_register'(), - -%% Start the cosNotification application. -cosNotificationApp:start(), - -%% Start a factory using the default configuration -ChFac = cosNotificationApp:start_factory(), -%% ... or use configuration parameters. -ChFac = cosNotificationApp:start_factory([]), - -%% Create a new event channel. Note, if no QoS- anr/or Admin-properties -%% are supplied (i.e. empty list) the default settings are used. -{Ch, ChID} = 'CosNotifyChannelAdmin_EventChannelFactory': - create_channel(ChFac, DefaultQoS, DefaultAdmin), - -%% Retrieve a SupplierAdmin and a Consumer Admin. -{AdminSupplier, ASID}= - 'CosNotifyChannelAdmin_EventChannel':new_for_suppliers(Ch, 'OR_OP'), -{AdminConsumer, ACID}= - 'CosNotifyChannelAdmin_EventChannel':new_for_consumers(Ch,'OR_OP'), - -%% Use the corresponding Admin object to get access to wanted Proxies - -%% Create a Push Consumer Proxie, i.e., the Client Push Supplier will -%% push events to this Proxy. -{StructuredProxyPushConsumer,ID11}= 'CosNotifyChannelAdmin_SupplierAdmin': - obtain_notification_push_consumer(AdminSupplier, 'STRUCTURED_EVENT')), - -%% Create Push Suppliers Proxies, i.e., the Proxy will push events to the -%% registered Push Consumers. -{ProxyPushSupplier,I4D}='CosNotifyChannelAdmin_ConsumerAdmin': - obtain_notification_push_supplier(AdminConsumer, 'ANY_EVENT'), -{StructuredProxyPushSupplier,ID5}='CosNotifyChannelAdmin_ConsumerAdmin': - obtain_notification_push_supplier(AdminConsumer, 'STRUCTURED_EVENT'), -{SequenceProxyPushSupplier,ID6}='CosNotifyChannelAdmin_ConsumerAdmin': - obtain_notification_push_supplier(AdminConsumer, 'SEQUENCE_EVENT'), - -%% Create application Clients. We can, for example, start the Clients -%% our selves or look them up in the naming service. This is application -%% specific. -SupplierClient = ... -ConsumerClient1 = ... -ConsumerClient2 = ... -ConsumerClient3 = ... - -%% Connect each Client to corresponding Proxy. -'CosNotifyChannelAdmin_StructuredProxyPushConsumer': - connect_structured_push_supplier(StructuredProxyPushConsumer, SupplierClient), -'CosNotifyChannelAdmin_ProxyPushSupplier': - connect_any_push_consumer(ProxyPushSupplier, ConsumerClient1), -'CosNotifyChannelAdmin_StructuredProxyPushSupplier': - connect_structured_push_consumer(StructuredProxyPushSupplier, ConsumerClient2), -'CosNotifyChannelAdmin_SequenceProxyPushSupplier': - connect_sequence_push_consumer(SequenceProxyPushSupplier, ConsumerClient3), - -

The example above, exemplifies a notification system where the SupplierClient - in some way generates event and pushes them to the proxy. The push supplier - proxies will eventually push the events to each ConsumerClient.

-
-
-
- diff --git a/lib/cosNotification/doc/src/ch_install.xml b/lib/cosNotification/doc/src/ch_install.xml deleted file mode 100644 index c76c68cb42..0000000000 --- a/lib/cosNotification/doc/src/ch_install.xml +++ /dev/null @@ -1,147 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Installing cosNotification - Niclas Eklund - - 2000-01-31 - - ch-install.xml -
- -
- Installation Process -

This chapter describes how to install cosNotificationApp - in an Erlang Environment. -

- -
- Preparation -

Before starting the installation process for cosNotification, - the application Orber must be running.

-
- -
- Configuration -

When using the Notification Service the cosNotification application - first must be installed using cosNotificationApp:install() or - cosNotificationApp:install(Seconds), followed by cosNotificationApp:start().

-

Then the Event Channel Factory - must be started:

- - cosNotificationApp:start_global_factory() - starts and returns a reference to a factory using default configuration parameters. - This operation should be used for a multi-node Orber. - cosNotificationApp:start_global_factory(Options) - starts and returns a reference to a factory using given configuration parameters. - This operation should be used for a multi-node Orber. - cosNotificationApp:start_factory() - starts and returns a reference to a factory using default configuration parameters. - cosNotificationApp:start_factory(Options) - starts and returns a reference to a factory using given configuration parameters. - -

The following options exist:

- - {pullInterval, Seconds} - determine how often Proxy Pull - Consumers will check for new events with the client application. The - default value is 20 seconds. - {filterOp, OperationType} - determine which type of Administrator - objects should be started, i.e., 'OR_OP' or 'AND_OP'. - The default value is 'OR_OP'. - {timeService, TimeServiceObj | 'undefined'} - to be able to use - Start and/or Stop QoS this option must be used. See the function start_time_service/2 - in the cosTime application. The default value is 'undefined'. - {filterOp, OperationType} - determine which type of Administrator - objects should be started, i.e., 'OR_OP' or 'AND_OP'. - The default value is 'OR_OP'. - {gcTime, Seconds} - this option determines how often, for example, proxies - will garbage collect expired events. The default value is 60. - {gcLimit, Amount} - determines how many events will be stored before, for - example, proxies will garbage collect expired events. The default value is 50. This - option is tightly coupled with the QoS property MaxEventsPerConsumer, i.e., - the gcLimit should be less than MaxEventsPerConsumer and greater than 0. - -

It is possible to define a set of global configuration parameters:

- - - Key - Range - Default - - - type_check - true | false - true - - - notify - atom() | false - false - - - max_events - integer() > 0 - 50 - - - interval_events - integer() > 0 - 10000 milliseconds - - - timeout_events - integer() > interval_events - 3000000 milliseconds - - Global Configuration Parameters -
-

Comments on the table 'Global Configuration Parameters':

- - type_check - Determine if supplied IOR:s shall be type checked, i.e. invoking - corba_object:is_a/2, or not. - notify - The given value shall point to an existing module exporting - a function (arity 1) called terminated. This operation - is invoked when a proxy terminates and the argument is a list - containing {proxy, IOR}, {client, IOR} and - {reason, term()}. The return value is ignored. - max_events - If a supplier proxy has not been able to push events to a - consumer and the queue exceeds this limit, then the proxy will - terminate. For this option to have any effect, the - EventReliability and ConnectionReliability QoS - parameters must be set to Persistent. For more information, - see also the QoS chapter. - interval_events - The same requirements as for max_events. When a supplier - proxy detects problems when trying to push events, this parameter - determines how often it should try to call the consumer. - timeout_events - The same requirements as for max_events. If the - proxy has not been able to contact the consumer and this - time-limit is reached, then the proxy will terminate. - -

The Factory is now ready to use. For a more detailed description see - Examples.

-
-
-
- diff --git a/lib/cosNotification/doc/src/ch_introduction.xml b/lib/cosNotification/doc/src/ch_introduction.xml deleted file mode 100644 index 39cd12f1e6..0000000000 --- a/lib/cosNotification/doc/src/ch_introduction.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Introduction to cosNotification - Niclas Eklund - - 2000-01-31 - - ch_introduction.xml -
- -
- Overview -

The cosNotification application is a Notification Service compliant with the OMG - Notification Service CosNotification. -

- -
- Purpose and Dependencies -

cosNotification is dependent on Orber-3.1.7 or later, - which provides CORBA functionality in an Erlang environment, - cosTime-1.0.1 or later and IDL-files to be compiled using IC-4.0.4 or later.

-
- -
- Prerequisites -

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

-

Recommended reading includes books recommended by the OMG - and Open Telecom Platform Documentation Set. It is also - helpful to have read Concurrent Programming in Erlang.

-
-
-
- diff --git a/lib/cosNotification/doc/src/ch_system.xml b/lib/cosNotification/doc/src/ch_system.xml deleted file mode 100644 index 91375088a0..0000000000 --- a/lib/cosNotification/doc/src/ch_system.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - The Notification Service Components - Niclas Eklund - - 2000-04-13 - - ch_system.xml -
- -
- The Notification Service Components -

This chapter describes the Notification Service Components and how they - interact.

- -
- Components -

There are seven components in the OMG Notification Service architecture. - These are described below:

- - - -Figure 1: The Notification Service Components. - - - Event Channel: acts as a factory for Administrator objects. - Allows clients to set Administrative Properties. - Supplier Administrators: acts as a factory for Proxy Consumers. - Administrators are started as 'AND_OP'- or 'OR_OP'-type, - which determines if events must be validated using both the Administrators - associated Filter and/or its Proxy children Filters. - Consumer Administrators: acts in the same way as Supplier Administrators - but handle Proxy Suppliers. - Consumer Proxy: is connected to a client application. Can be - started as Pull or Push object. If the proxy is Push style - the client application must push events to the Proxy, otherwise the Proxy is - supposed to Pull events. The CosNotification::AdminProperties is - used to set the pacing interval. - Supplier Proxy: Acts in a similar way as the Consumer Proxy, but - if started as a Push proxy it will push events to the client - application. - Filters: used to filter events. May be associated with Proxies - and Administrators. - Mapping Filters: used to override events Quality of Service - settings. Can only be associated with Consumer Administrators and - Proxy Suppliers. - -

When a Proxy is started it is set to accept CORBA::Any, - CosNotification::StructuredEvent or CosNotification::EventBatch - (a sequence of structured events).

-

If a Proxy is supposed to deliver structured events to a client application - and receives an CORBA::Any event, the event is converted to a - structured event with type_name set to "%ANY" and the - event is stored in remainder_of_body.

-

If a Proxy is supposed to deliver CORBA::Any events to a client application - and receives a structured event, the event is stored in an Any type. The - Any Type Code will be equal to the CosNotification::StructuredEvent - Type Code.

-
-
-
- diff --git a/lib/cosNotification/doc/src/cosNotificationApp.xml b/lib/cosNotification/doc/src/cosNotificationApp.xml deleted file mode 100644 index 4f662a5dc4..0000000000 --- a/lib/cosNotification/doc/src/cosNotificationApp.xml +++ /dev/null @@ -1,309 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosNotificationApp - Niclas Eklund - Niclas Eklund - - Niclas Eklund - - 2000-01-31 - PA1 -
- cosNotificationApp - The main module of the cosNotification application. - -

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

--include_lib("cosNotification/include/*.hrl").

-

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

-
- - - install() -> Return - Install the cosNotification application - - Return = ok | {'EXCEPTION', E} - - -

This operation installs the cosNotification application.

-
-
- - install(Seconds) -> Return - Install the cosNotification application - - Return = ok | {'EXCEPTION', E} - - -

This operation installs the cosNotification application using Seconds - delay between each block, currently 6, of IFR-registrations. This approach - spreads the IFR database access over a period of time to allow other - applications to run smother.

-
-
- - install_event() -> Return - Install the necessary cosEvent interfaces - - Return = ok | {'EXCEPTION', E} - - -

This operation, which may only be used if it is impossible to - upgrade to cosEvent-2.0 or later, installs the necessary - cosEvent interfaces. If cosEvent-2.0 is available, use - cosEventApp:install() instead.

-
-
- - install_event(Seconds) -> Return - Install the necessary cosEvent interfaces - - Return = ok | {'EXCEPTION', E} - - -

This operation, which may only be used if it is impossible to - upgrade to cosEvent-2.0 or later, installs the necessary cosEvent - interfaces using Seconds delay between each block of - IFR-registrations. If cosEvent-2.0 is available, use - cosEventApp:install() instead.

-
-
- - uninstall() -> Return - Uninstall the cosNotification application - - Return = ok | {'EXCEPTION', E} - - -

This operation uninstalls the cosNotification application.

-
-
- - uninstall(Seconds) -> Return - Uninstall the cosNotification application - - Return = ok | {'EXCEPTION', E} - - -

This operation uninstalls the cosNotification application using Seconds - delay between each block, currently 6, of IFR-unregistrations. This approach - spreads the IFR database access over a period of time to allow other - applications to run smother.

-
-
- - uninstall_event() -> Return - Uninstall the inherited cosEvent interfaces - - Return = ok | {'EXCEPTION', E} - - -

This operation uninstalls the inherited cosEvent interfaces. If cosEvent - is in use this function may not be used. This function may only be used if - cosNotificationApp:install_event/1/2 was used. If not, use - cosEventApp:uninstall() instead.

-
-
- - uninstall_event(Seconds) -> Return - Uninstall the inherited cosEvent interfaces - - Return = ok | {'EXCEPTION', E} - - -

This operation uninstalls the inherited cosEvent interfaces, using Seconds - delay between each block of IFR-unregistrations. If cosEvent - is in use this function may not be used. This function may only be used if - cosNotificationApp:install_event/1/2 was used. If not, use - cosEventApp:uninstall() instead.

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

This operation starts the cosNotification application.

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

This operation stops the cosNotification application.

-
-
- - start_global_factory() -> ChannelFactory - Start a global channel factory as default - - ChannelFactory = #objref - - -

This operation creates a - Event Channel Factory - should be used for a multi-node Orber. - The Factory is used to create a new - channel.

-
-
- - start_global_factory(Options) -> ChannelFactory - Start a global channel factory with options - - Options = [Option] - Option = {pullInterval, Seconds} | {filterOp, Op} | {gcTime, Seconds} | {gcLimit, Anount} | {timeService, #objref} - ChannelFactory = #objref - - -

This operation creates a - Event Channel Factory and - should be used for a multi-node Orber. - The Factory is used to create a new - channel.

-

- - {pullInterval, Seconds} - determine how often Proxy Pull - Consumers will check for new events with the client application. The - default value is 20 seconds. - {filterOp, OperationType} - determine which type of Administrator - objects should be started, i.e., 'OR_OP' or 'AND_OP'. - The default value is 'OR_OP'. - {timeService, TimeServiceObj | 'undefined'} - to be able to use - Start and/or Stop QoS this option must be used. See the function start_time_service/2 - in the cosTime application. The default value is 'undefined'. - {filterOp, OperationType} - determine which type of Administrator - objects should be started, i.e., 'OR_OP' or 'AND_OP'. - The default value is 'OR_OP'. - {gcTime, Seconds} - this option determines how often, for example, proxies - will garbage collect expired events. The default value is 60. - {gcLimit, Amount} - determines how many events will be stored before, for - example, proxies will garbage collect expired events. The default value is 50. This - option is tightly coupled with the QoS property MaxEventsPerConsumer, i.e., - the gcLimit should be less than MaxEventsPerConsumer and greater than 0. - -
-
- - start_factory() -> ChannelFactory - Start a channel factory as default - - ChannelFactory = #objref - - -

This operation creates a - Event Channel Factory. - The Factory is used to create a new - channel.

-
-
- - start_factory(Options) -> ChannelFactory - Start a channel factory with options - - Options = [Option] - Option = {pullInterval, Seconds} | {filterOp, Op} | {gcTime, Seconds} | {gcLimit, Amount} | {timeService, #objref} - ChannelFactory = #objref - - -

This operation creates a - Event Channel Factory. - The Factory is used to create a new - channel.

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

This operation stop the target channel factory.

-
-
- - start_filter_factory() -> FilterFactory - Start a filter factory - - FilterFactory = #objref - - -

This operation creates a - Filter Factory. - The Factory is used to create a new - Filter's and - MappingFilter's.

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

This operation stop the target filter factory.

-
-
- - create_structured_event(Domain, Type, Event, VariableHeader, FilterableBody, BodyRemainder) -> Reply - Create a structured event - - Domain = string() - Type = string() - Event = string() - VariableHeader = [CosNotification::Property] - FilterableBody = [CosNotification::Property] - BodyRemainder = #any data-type - Reply = CosNotification::StructuredEvent | {'EXCEPTION', E} - - -

An easy way to create a structured event is to use this function. - Simple typechecks are performed and if one of the arguments is not - correct a 'BAD_PARAM' exception is thrown.

-
-
- - type_check() -> Reply - Return the value of the configuration parameter type_check - - Reply = true | false - - -

This operation returns the value of the configuration parameter - type_check.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/eventstructure.gif b/lib/cosNotification/doc/src/eventstructure.gif deleted file mode 100644 index 879c96f980..0000000000 Binary files a/lib/cosNotification/doc/src/eventstructure.gif and /dev/null differ diff --git a/lib/cosNotification/doc/src/notes.xml b/lib/cosNotification/doc/src/notes.xml deleted file mode 100644 index bf0fc73548..0000000000 --- a/lib/cosNotification/doc/src/notes.xml +++ /dev/null @@ -1,632 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosNotification Release Notes - - - - - 2000-01-31 - A - notes.xml -
- -
cosNotification 1.2.3 - -
Fixed Bugs and Malfunctions - - -

Removed all old unused files in the documentation. -

-

- Own Id: OTP-14475 Aux Id: ERL-409, PR-1493

-
-
-
- -
- -
cosNotification 1.2.2 - -
Improvements and New Features - - -

- Internal changes

-

- Own Id: OTP-13551

-
-
-
- -
- -
cosNotification 1.2.1 - -
Improvements and New Features - - -

Suppress Dialyzer warnings.

-

- Own Id: OTP-12862

-
-
-
- -
- -
cosNotification 1.2 - -
Improvements and New Features - - -

Remove the usage of erlang:now() from all Corba - applications and use the new rand module instead of - random.

-

- Own Id: OTP-12687

-
-
-
- -
- -
cosNotification 1.1.21 - -
Improvements and New Features - - -

The default encoding of Erlang files has been changed - from ISO-8859-1 to UTF-8.

The encoding of XML - files has also been changed to UTF-8.

-

- Own Id: OTP-10907

-
-
-
- -
- -
cosNotification 1.1.20 - -
Improvements and New Features - - -

Postscript files no longer needed for the generation - of PDF files have been removed.

-

- Own Id: OTP-11016

-
-
-
- -
- -
cosNotification 1.1.19 - -
Improvements and New Features - - -

- Misc build updates

-

- Own Id: OTP-10784

-
-
-
- -
- -
cosNotification 1.1.18 - -
Improvements and New Features - - -

Erlang/OTP can now be built using parallel make if you - limit the number of jobs, for instance using 'make - -j6' or 'make -j10'. 'make -j' does not - work at the moment because of some missing - dependencies.

-

- Own Id: OTP-9451

-
-
-
- -
- -
cosNotification 1.1.17 - -
Improvements and New Features - - -

- Removed superfluous usage of shy in the documentation since it can cause problem if - a buggy tool is used.

-

- Own Id: OTP-9319 Aux Id:

-
-
-
-
- -
cosNotification 1.1.16 - -
Improvements and New Features - - -

- Eliminated Dialyzer warnings when using exit or throw.

-

- Own Id: OTP-9050

-
-
-
-
- -
cosNotification 1.1.15 - -
Improvements and New Features - - -

- Switched from using the deprecated regexp to re instead.

-

- Own Id: OTP-8846

-
-
-
- -
- -
- cosNotification 1.1.14 -
- Improvements and New Features - - -

- Test suites published.

-

- Own Id: OTP-8543 Aux Id:

-
-
-
- -
- Fixed Bugs and Malfunctions - - -

Added missing trailing bracket to define in hrl-file.

-

Own Id: OTP-8489 Aux Id:

-
-
-
-
- -
- cosNotification 1.1.14 -
- Improvements and New Features - - -

- Test suites published.

-

- Own Id: OTP-8543 Aux Id:

-
-
-
- -
- Fixed Bugs and Malfunctions - - -

Added missing trailing bracket to define in hrl-file.

-

Own id: OTP-8489 Aux Id:

-
-
-
-
- -
- cosNotification 1.1.13 - -
- Fixed Bugs and Malfunctions - - -

Removed superfluous VT in the documentation.

-

Own Id: OTP-8353 Aux Id:

-
- -

Removed superfluous backslash in the documentation.

-

Own Id: OTP-8354 Aux Id:

-
- -

The documentation EIX file was not generated.

-

Own Id: OTP-8355 Aux Id:

-
-
-
-
- -
- cosNotification 1.1.12 - -
- Improvements and New Features - - -

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

-

- Own Id: OTP-8201 Aux Id:

-
-
-
-
- -
- cosNotification 1.1.11 - -
- Improvements and New Features - - -

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

-

Own Id: OTP-7987

-
-
-
-
- -
- cosNotification 1.1.10 - -
- Fixed Bugs and Malfunctions - - -

Updated file headers.

-

Own Id: OTP-7837 Aux Id:

-
-
-
-
- -
- cosNotification 1.1.9 - -
- Fixed Bugs and Malfunctions - - -

Documentation source included in open source releases.

-

Own Id: OTP-7595 Aux Id:

-
-
-
-
- -
- cosNotification 1.1.8 - -
- Fixed Bugs and Malfunctions - - -

The CosNotification proxy objects ignored the gcLimit option, instead - the gcTime value was used.

-

Own Id: OTP-7553 Aux Id:

-
-
-
-
- -
- cosNotification 1.1.7 - -
- Improvements and New Features - - -

Updated file headers.

-

Own Id: OTP-7011

-
-
-
-
- -
- cosNotification 1.1.6 - -
- Improvements and New Features - - -

The documentation source has been converted from SGML to XML.

-

Own Id: OTP-6754

-
-
-
-
- -
- cosNotification 1.1.5 - -
- Improvements and New Features - - -

Minor Makefile changes.

-

Own Id: OTP-6701

-
-
-
-
- -
- cosNotification 1.1.4 - -
- Improvements and New Features - - -

Removed some unused code.

-

Own Id: OTP-6527

-
-
-
-
- -
- cosNotification 1.1.3 - -
- Improvements and New Features - - -

A user can now define the QoS EventReliability to be - Persistent. Note, this is only a lightweight version - and events will be lost if a proxy is terminated.

-

Own Id: OTP-5923

-
-
-
-
- -
- cosNotification 1.1.2 - -
- Improvements and New Features - - -

Possible to configure cosNotification not to type check, - by invoking corba_object:is_a/2, supplied IOR:s. When - a type check fails, the feedback has been improved.

-

Own Id: OTP-5823 Aux Id: seq10143

-
-
-
-
- -
- cosNotification 1.1.1 - -
- Fixed Bugs and Malfunctions - - -

The app-file contained duplicated modules.

-

Own Id: OTP-4976

-
-
-
-
- -
- cosNotification 1.1 - -
- Improvements and New Features - - -

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

-

Own Id: OTP-4576

-
-
-
-
- -
- cosNotification 1.0.6 - -
- Fixed Bugs and Malfunctions - - -

The exception CosNotifyFilter::InvalidValue, raised by the operation - CosNotifyFilter::MappingFilter::add_mapping_constraints, did not contain - correct data in the body. Hence, it was not possible to pass this - exception to another ORB.

-

Own Id: OTP-4412

-
- -

It was not possible to set the QoS property PacingInterval to zero and - the default value was not compliant with the OMG specification. The - default value for MaximumBatchSize have also been changed du to the - same reason.

-

Own Id: OTP-4413, OTP-4414

-
-
-
- -
- Incompatibilities - - -

The default value, for the QoS properties PacingInterval and MaximumBatchSize, - have been changed to zero (i.e. no timeout) and 1 respectively, which is - compliant with the OMG specification.

-

Own Id: OTP-4413, OTP-4414

-
-
-
-
- -
- cosNotification 1.0.5 - -
- Fixed Bugs and Malfunctions - - -

If one tries to set an unavailable/incorrect property or property value, an - exception is thrown. In some cases the exception was not correct, which - would cause problems if communicating via IIOP.

-

Own Id: OTP-4340

-
- -

When using Filter's, with the QoS OrderPolicy set to FifoOrder, - and passing a sequence of structured events, they could be - delivered in the wrong order.

-

Own Id: OTP-4272

-
- -

If Filter's where attached to Supplier proxies it could cause - the Proxy to terminate.

-

Own Id: OTP-4272

-
-
-
-
- -
- cosNotification 1.0.4 - -
- Fixed Bugs and Malfunctions - - -

When passing event sequences, the PushSuppliers and PullSuppliers - could crash if the objects had Filter objects associated and - only a subset of the sequences where approved.

-

Own Id: OTP-4099

-
- -

SupplierAdmin's did not filter any events, even though Filter objects - had been attached to the SupplierAdmin.

-

Own Id: OTP-4098

-
- -

If one used the '_get_default_supplier_admin'/1, exported by the - CosNotifyChannelAdmin_EventChannel-module, it resulted in a loop - which overloaded the channel. This is no longer the case.

-

Own Id: OTP-4086

-
- -

If one used the '_get_default_filter_factory'/1, exported by the - CosNotifyChannelAdmin_EventChannel-module, a new instance was created - each time. Now fixed.

-

Own Id: OTP-4092

-
-
-
- -
- Incompatibilities - - -

The include paths for CosNotification.idl have been changed. - Hence, if you include this file in your own IDL-files you must - update your paths to also point to where the cosEvent IDL-files are - stored.

-

Own Id: OTP-4093

-
-
-
-
- -
- cosNotification 1.0.3 - -
- Improvements and New Features - - -

It is now possible to start global channel factories.

-

Own Id: OTP-4078

-
- -

The Orber, version 3.2.5 or later, configuration parameter - orber_debug_level can now be used to generate reports when abnormal - situations occurs. For more information consult the Orber User's Guide. - Note, it is not recommended to use this option for delivered systems - since some of the reports is not to be considered as errors. - The value of orber_debug_level must be 3, or higher, for reports to - be generated.

-

Own Id: OTP-4077, OTP-3962

-
-
-
- -
- Fixed Bugs and Malfunctions - - -

When using the cosEvent API accessing a cosNotification admins - the objects returned by the functions obtain_push_supplier, - obtain_pull_supplier, obtain_push_consumer and obtain_pull_consumer - was not of the correct type. Due to the interface change - it is not possible to upgrade during runtime.

-

Own Id: OTP-4079

-
-
-
-
- -
- cosNotification 1.0.2 - -
- Improvements and New Features - - -

First release of the cosNotification application.

-

Own Id: -

-
-
-
-
-
- diff --git a/lib/cosNotification/doc/src/notificationFlow.gif b/lib/cosNotification/doc/src/notificationFlow.gif deleted file mode 100644 index 31d6ee97fb..0000000000 Binary files a/lib/cosNotification/doc/src/notificationFlow.gif and /dev/null differ diff --git a/lib/cosNotification/doc/src/part.xml b/lib/cosNotification/doc/src/part.xml deleted file mode 100644 index 9cc5a8a95a..0000000000 --- a/lib/cosNotification/doc/src/part.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosNotification User's Guide - Niclas Eklund - - 2000-01-31 - 1.0 -
- -

The cosNotification application is an Erlang implementation - of the OMG CORBA Notification Service.

-
- - - - - - - -
- diff --git a/lib/cosNotification/doc/src/ref_man.xml b/lib/cosNotification/doc/src/ref_man.xml deleted file mode 100644 index 58fb4febd2..0000000000 --- a/lib/cosNotification/doc/src/ref_man.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosNotification Reference Manual - Niclas Eklund - - 2000-01-31 - 1.0 -
- -

The cosNotification application is an Erlang implementation - of the OMG CORBA Notification Service.

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- diff --git a/lib/cosNotification/ebin/.gitignore b/lib/cosNotification/ebin/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosNotification/examples/.gitignore b/lib/cosNotification/examples/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosNotification/include/.gitignore b/lib/cosNotification/include/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosNotification/info b/lib/cosNotification/info deleted file mode 100644 index 1b634eb124..0000000000 --- a/lib/cosNotification/info +++ /dev/null @@ -1,3 +0,0 @@ -group: orb -short: Orber OMG Notification Service - diff --git a/lib/cosNotification/priv/.gitignore b/lib/cosNotification/priv/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosNotification/src/CosEvent.cfg b/lib/cosNotification/src/CosEvent.cfg deleted file mode 100644 index e3399139a4..0000000000 --- a/lib/cosNotification/src/CosEvent.cfg +++ /dev/null @@ -1,20 +0,0 @@ -{this, "CosEventChannelAdmin::EventChannel"}. -{{handle_info, "CosEventChannelAdmin::EventChannel"}, true}. -{this, "CosEventChannelAdmin::EventChannelFactory"}. -{{handle_info, "CosEventChannelAdmin::EventChannelFactory"}, true}. -{this, "CosEventChannelAdmin::SupplierAdmin"}. -{{handle_info, "CosEventChannelAdmin::SupplierAdmin"}, true}. -{this, "CosEventChannelAdmin::ConsumerAdmin"}. -{{handle_info, "CosEventChannelAdmin::ConsumerAdmin"}, true}. -{this, "CosEventChannelAdmin::ProxyPushSupplier"}. -{{handle_info, "CosEventChannelAdmin::ProxyPushSupplier"}, true}. -{{impl, "CosEventChannelAdmin::ProxyPushSupplier"}, "PusherSupplier_impl"}. -{this, "CosEventChannelAdmin::ProxyPullSupplier"}. -{{handle_info, "CosEventChannelAdmin::ProxyPullSupplier"}, true}. -{{impl, "CosEventChannelAdmin::ProxyPullSupplier"}, "PullerSupplier_impl"}. -{this, "CosEventChannelAdmin::ProxyPushConsumer"}. -{{handle_info, "CosEventChannelAdmin::ProxyPushConsumer"}, true}. -{{impl, "CosEventChannelAdmin::ProxyPushConsumer"}, "PusherConsumer_impl"}. -{this, "CosEventChannelAdmin::ProxyPullConsumer"}. -{{handle_info, "CosEventChannelAdmin::ProxyPullConsumer"}, true}. -{{impl, "CosEventChannelAdmin::ProxyPullConsumer"}, "PullerConsumer_impl"}. diff --git a/lib/cosNotification/src/CosNotification.cfg b/lib/cosNotification/src/CosNotification.cfg deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosNotification/src/CosNotification.idl b/lib/cosNotification/src/CosNotification.idl deleted file mode 100644 index e080b44b0c..0000000000 --- a/lib/cosNotification/src/CosNotification.idl +++ /dev/null @@ -1,146 +0,0 @@ -#ifndef _COS_NOTIFICATION_IDL_ -#define _COS_NOTIFICATION_IDL_ - -#pragma prefix "omg.org" - -#include"CosEventChannelAdmin.idl" -#include"CosEventComm.idl" - -module CosNotification { - typedef string Istring; - typedef Istring PropertyName; - typedef any PropertyValue; - struct Property { - PropertyName name; - PropertyValue value; - }; - typedef sequence PropertySeq; - // The following are the same, but serve different purposes. - typedef PropertySeq OptionalHeaderFields; - typedef PropertySeq FilterableEventBody; - typedef PropertySeq QoSProperties; - typedef PropertySeq AdminProperties; - struct EventType { - string domain_name; - string type_name; - }; - typedef sequence EventTypeSeq; - struct PropertyRange { - PropertyValue low_val; - PropertyValue high_val; - }; - struct NamedPropertyRange { - PropertyName name; - PropertyRange range; - }; - - typedef sequence NamedPropertyRangeSeq; - - enum QoSError_code { - UNSUPPORTED_PROPERTY, - UNAVAILABLE_PROPERTY, - UNSUPPORTED_VALUE, - UNAVAILABLE_VALUE, - BAD_PROPERTY, - BAD_TYPE, - BAD_VALUE - }; - - struct PropertyError { - QoSError_code code; - PropertyName name; - PropertyRange available_range; - }; - - typedef sequence PropertyErrorSeq; - exception UnsupportedQoS { PropertyErrorSeq qos_err; }; - exception UnsupportedAdmin { PropertyErrorSeq admin_err; }; - - // Define the Structured Event structure - struct FixedEventHeader { - EventType event_type; - string event_name; - }; - struct EventHeader { - FixedEventHeader fixed_header; - OptionalHeaderFields variable_header; - }; - - struct StructuredEvent { - EventHeader header; - FilterableEventBody filterable_data; - any remainder_of_body; - }; // StructuredEvent - - typedef sequence EventBatch; - - // The following constant declarations define the standard - // QoS property names and the associated values each property - // can take on. The name/value pairs for each standard property - // are grouped, beginning with a string constant defined for the - // property name, followed by the values the property can take on. - const string EventReliability = "EventReliability"; - const short BestEffort = 0; - const short Persistent = 1; - const string ConnectionReliability = "ConnectionReliability"; - - // Can take on the same values as EventReliability - const string Priority = "Priority"; - const short LowestPriority = -32767; - const short HighestPriority = 32767; - const short DefaultPriority = 0; - const string StartTime = "StartTime"; - - // StartTime takes a value of type TimeBase::UtcT. - const string StopTime = "StopTime"; - // StopTime takes a value of type TimeBase::UtcT. - const string Timeout = "Timeout"; - // Timeout takes on a value of type TimeBase::TimeT - const string OrderPolicy = "OrderPolicy"; - const short AnyOrder = 0; - const short FifoOrder = 1; - const short PriorityOrder = 2; - const short DeadlineOrder = 3; - const string DiscardPolicy = "DiscardPolicy"; - // DiscardPolicy takes on the same values as OrderPolicy, plus - const short LifoOrder = 4; - const short RejectNewEvents = 5; - const string MaximumBatchSize = "MaximumBatchSize"; - // MaximumBatchSize takes on a value of type long - const string PacingInterval = "PacingInterval"; - // PacingInterval takes on a value of type TimeBase::TimeT - const string StartTimeSupported = "StartTimeSupported"; - // StartTimeSupported takes on a boolean value - const string StopTimeSupported = "StopTimeSupported"; - // StopTimeSupported takes on a boolean value - const string MaxEventsPerConsumer = "MaxEventsPerConsumer"; - // MaxEventsPerConsumer takes on a value of type long - - interface QoSAdmin { - QoSProperties get_qos(); - void set_qos ( in QoSProperties qos) - raises ( UnsupportedQoS ); - void validate_qos (in QoSProperties required_qos, - out NamedPropertyRangeSeq available_qos ) - raises ( UnsupportedQoS ); - }; // QosAdmin - - // Admin properties are defined in similar manner as QoS - // properties. The only difference is that these properties - // are related to channel administration policies, as opposed - // message quality of service - const string MaxQueueLength = "MaxQueueLength"; - // MaxQueueLength takes on a value of type long - const string MaxConsumers = "MaxConsumers"; - // MaxConsumers takes on a value of type long - const string MaxSuppliers = "MaxSuppliers"; - // MaxSuppliers takes on a value of type long - interface AdminPropertiesAdmin { - AdminProperties get_admin(); - void set_admin (in AdminProperties admin) - raises ( UnsupportedAdmin); - };// AdminPropertiesAdmin -}; // CosNotification - -#endif /* ifndef _COS_NOTIFICATION_IDL_ */ - diff --git a/lib/cosNotification/src/CosNotification_Common.erl b/lib/cosNotification/src/CosNotification_Common.erl deleted file mode 100644 index 530641b7a5..0000000000 --- a/lib/cosNotification/src/CosNotification_Common.erl +++ /dev/null @@ -1,1240 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%-------------------------------------------------------------------- -%% File : CosNotification_Common.erl -%% Purpose : -%%-------------------------------------------------------------------- - --module('CosNotification_Common'). - - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). -%% Application files --include("CosNotification.hrl"). --include("CosNotifyChannelAdmin.hrl"). --include("CosNotifyComm.hrl"). --include("CosNotifyFilter.hrl"). - --include("CosNotification_Definitions.hrl"). - -%%--------------- EXPORTS ------------------------------------ -%% External MISC --export([get_option/3, - create_name/0, - create_name/1, - create_name/2, - create_id/0, - create_id/1, - is_debug_compiled/0, - type_check/2, - send_stubborn/5, - create_link/3, - disconnect/3, - do_disconnect/3, - notify/1]). - -%% Internal AdminProperties --export([init_adm/1, - set_adm/2, - 'MaxQueueLength'/6, - 'MaxConsumers'/6, - 'MaxSuppliers'/6]). -%% Internal QoS --export([init_qos/1, - set_qos/5, - validate_qos/5, - validate_event_qos/2, - 'EventReliability'/6, - 'ConnectionReliability'/6, - 'Priority'/6, - 'StartTimeSupported'/6, - 'StopTimeSupported'/6, - 'Timeout'/6, - 'OrderPolicy'/6, - 'DiscardPolicy'/6, - 'MaximumBatchSize'/6, - 'PacingInterval'/6, - 'MaxEventsPerConsumer'/6]). - -%%--------------- DEFINITIONS OF CONSTANTS ------------------- -%%--------------- EXTERNAL MISC FUNCTIONS -------------------- -%%------------------------------------------------------------ -%% 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 -%% Arguments: -%% Returns : -%% Effect : Create a unique name to use when, for eaxmple, starting -%% a new server. -%%------------------------------------------------------------ -create_name() -> - Time = erlang:system_time(), - Unique = erlang:unique_integer([positive]), - lists:concat(['oe_',node(),'_',Time,'_',Unique]). - - -%%-----------------------------------------------------------% -%% function : create_name/1 -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -create_name(Type) -> - Time = erlang:system_time(), - Unique = erlang:unique_integer([positive]), - lists:concat(['oe_',node(),'_',Type,'_',Time,'_',Unique]). - -%%-----------------------------------------------------------% -%% function : create_name/2 -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -create_name(Name,Type) -> - Time = erlang:system_time(), - Unique = erlang:unique_integer([positive]), - lists:concat(['oe_',node(),'_',Type,'_',Name,'_',Time,'_',Unique]). - -%%------------------------------------------------------------ -%% function : create_id/0 -%% Arguments: - -%% Returns : id (long) =/= 0 -%% Both default Admin:s have the unique id 0 (OMG spec, 98-11-01, -%% Notification p 148), hence, we may not return 0. -%% Exception: -%% Purpose : Throughout the CosNotification service we use, -%% according to the OMG specification, id:s (long), -%% which must be "unique", to retrieve object references. -%% For example: CosNotifyChannelAdmin::ChannelId/AdminID. -%%------------------------------------------------------------ -create_id(-1) -> - 1; -create_id(2147483647) -> - -2147483648; -create_id(OldID) -> - OldID+1. - -create_id() -> - {_A,_B,C}=erlang:timestamp(), - C. - -%%------------------------------------------------------------ -%% 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 cosNotificationApp:type_check() of - false -> - ok; - _ -> - case catch corba_object:is_a(Obj,Mod:typeID()) of - true -> - ok; - false -> - orber:dbg("[~p] CosNotification_Common:type_check(~p);~n" - "The supplied Object is not or does not inherrit from: ~p", - [?LINE, Obj, Mod], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}); - {'EXCEPTION', E} -> - orber:dbg("[~p] CosNotification_Common:type_check(~p, ~p);~n" - "Failed due to: ~p", - [?LINE, Obj, Mod, E], ?DEBUG_LEVEL), - corba:raise(E); - What -> - orber:dbg("[~p] CosNotification_Common:type_check(~p, ~p);~n" - "Failed due to: ~p", - [?LINE, Obj, Mod, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end - end. - - -%%-----------------------------------------------------------% -%% function : notify -%% Arguments: Items - [Item] -%% Item - {proxy, IOR} | {client, IOR} | {reason, term()} -%% Returns : 'ok' or raises exception. -%% Effect : -%%------------------------------------------------------------ -notify(Items) -> - case cosNotificationApp:notify() of - false -> - ok; - Module -> - catch Module:terminated(Items), - ok - end. - - -%%------------------------------------------------------------ -%% function : send_stubborn -%% Arguments: M - module -%% F - function -%% A - arguments -%% MaxR - Maximum no retries -%% Wait - sleep Wait seconds before next try. -%% Returns : see effect -%% Exception: -%% Effect : Retries repeatidly untill anything else besides -%% 'EXIT', 'COMM_FAILURE' or 'OBJECT_NOT_EXIST' -%%------------------------------------------------------------ - -send_stubborn(M, F, A, MaxR, Wait) when is_list(A) -> - send_stubborn(M, F, A, MaxR, Wait, 0); -send_stubborn(M, F, A, MaxR, Wait) -> - send_stubborn(M, F, [A], MaxR, Wait, 0). -send_stubborn(M, F, A, MaxR, _Wait, MaxR) -> - orber:dbg("[~p] CosNotification_Common:send_stubborn( ~p ~p ~p ~p).~n" - "Failed to deliver the event.~n", [?LINE, M,F,A,MaxR], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}); -send_stubborn(M, F, A, MaxR, Wait, Times) -> - ?debug_print("~p:~p(~p) # of retries: ~p~n", [M,F,A, Times]), - case catch apply(M,F,A) of - {'EXCEPTION', E} when is_record(E, 'COMM_FAILURE')-> - NewTimes = Times +1, - timer:sleep(Wait), - send_stubborn(M, F, A, MaxR, Wait, NewTimes); - {'EXIT', _} -> - NewTimes = Times +1, - timer:sleep(Wait), - send_stubborn(M, F, A, MaxR, Wait, NewTimes); - Other -> - Other - end. - - -%%-----------------------------------------------------------% -%% function : disconnect -%% Arguments: Module - one of the interfaces defined in CosEventComm. -%% Function - the appropriate disconnect function. -%% Object - the client object reference. -%% Returns : ok -%% Exception: -%% Effect : If the process would try to diconnect itself it could -%% result in a deadlock. Hence, we spawn a new process to do it. -%%------------------------------------------------------------ -disconnect(Module, Function, Object) -> - spawn(?MODULE, do_disconnect, [Module, Function, Object]), - ok. - -do_disconnect(Module, Function, Object) -> - catch Module:Function(Object), - ?DBG("Disconnect ~p:~p(..).~n", [Module, Function]), - ok. - - - -%%------------------------------------------------------------ -%% function : is_debug_compiled -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ - --ifdef(debug). - is_debug_compiled() -> true. --else. - is_debug_compiled() -> false. --endif. - - -%%------------------------------------------------------------ -%%--------------- AdminPropertiesAdmin ----------------------- -%%------------------------------------------------------------ -%%------------------------------------------------------------ -%% function : init_adm -%% Arguments: Wanted - requested Admins to be set. -%% Returns : #'CosNotification_UnsupportedAdmin'{} | -%% {NewAdmProperties, [MaxQ, MaxC, MaxS]} -%% Effect : may only be used when creating a channel!!!!!!!! -%%------------------------------------------------------------ -init_adm(Wanted) -> - {NewA,_} = set_properties(Wanted, ?not_DEFAULT_ADMINPROPERTIES, channelAdm, - ?not_SUPPORTED_ADMINPROPERTIES, [], [], - false, false, false), - {NewA, [extract_value(NewA, ?not_MaxQueueLength), - extract_value(NewA, ?not_MaxConsumers), - extract_value(NewA, ?not_MaxSuppliers)]}. - -set_adm(Wanted, Current) -> - {NewA,_} = set_properties(Wanted, Current, channelAdm, - ?not_SUPPORTED_ADMINPROPERTIES, - [], [], false, false, false), - {NewA, [extract_value(NewA, ?not_MaxQueueLength), - extract_value(NewA, ?not_MaxConsumers), - extract_value(NewA, ?not_MaxSuppliers)]}. - -'MaxQueueLength'(Req,channelAdm,_, _, _, _) -> admin_ok(Req). -'MaxConsumers'(Req,channelAdm,_, _, _, _)-> admin_ok(Req). -'MaxSuppliers'(Req,channelAdm,_, _, _, _)-> admin_ok(Req). - -admin_ok(Req) -> - case any:get_value(Req#'CosNotification_Property'.value) of - Val when is_integer(Val) andalso Val >= 0 -> - {ok, Req}; - _ -> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_TYPE', - name = Req#'CosNotification_Property'.name, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - } - } - } - end. - - -%%------------------------------------------------------------ -%%--------------- QOS FUNCTIONS ------------------------------ -%%------------------------------------------------------------ -%%------------------------------------------------------------ -%% function : init_qos -%% Arguments: Wanted - requested QoS to be set. -%% Returns : see set_properties/9 -%% Effect : may only be used when creating a channel!!!!!!!! -%%------------------------------------------------------------ -init_qos(Wanted) -> - LQS = set_local_qos(?not_DEFAULT_QOS, ?not_CreateInitQoS()), - set_properties(Wanted, ?not_DEFAULT_QOS, channel, ?not_SUPPORTED_QOS, - [], [], false, [], LQS). - -%%------------------------------------------------------------ -%% function : set_qos/5 -%% Arguments: Wanted - requested QoS to be set. -%% Current - current QoS OMG style -%% LQS - local representation of QoS. -%% Type - channel | admin | proxy -%% Parent - Factory if Channel, Channel if Admin etc -%% Childs - Admins if Channel etc -%% Returns : see set_properties/9 -%%------------------------------------------------------------ -set_qos(Wanted, {Current, LQS}, proxy, Parent, _) -> - set_properties(Wanted, Current, proxy, ?not_SUPPORTED_QOS, [], [], Parent, false,LQS); -set_qos(Wanted, {Current, LQS}, admin, Parent, Childs) -> - set_properties(Wanted, Current, admin, ?not_SUPPORTED_QOS, [], [], Parent, Childs,LQS); -set_qos(Wanted, {Current, LQS}, channel, _, Childs) -> - set_properties(Wanted, Current, channel, ?not_SUPPORTED_QOS, [], [], false, Childs,LQS). - -%%------------------------------------------------------------ -%% function : -%% Arguments: Req - Requested QoS, #'CosNotification_Property'{} -%% Type - Requestee, channel | admin | proxy -%% Curr - Current QoS, #'CosNotification_Property'{} -%% Parent - false | ObjRef -%% Childs - false | [ObjRef1, .., ObjRefN] -%% LQS - #qos{} defined in CosNotification_Definitions.hrl -%% Returns : ok - if requested equal to current value. -%% {ok, Req, LQS} - if new and allowed QoS -%% {unsupported,#'CosNotification_PropertyError'{}} otherwise. -%% Effect : -%%------------------------------------------------------------ -'EventReliability'(Req,channel, _Curr, _Parent, _Childs, LQS) -> - case {any:get_value(Req#'CosNotification_Property'.value), - ?not_GetConnectionReliability(LQS), ?not_BestEffort, ?not_Persistent} of - {Val, Val, _, _} -> - %% Is the value requested. - ok; - {Val, _, Val, _} -> - {ok, Req, LQS}; - {Val, _, _, Val} -> - {ok, Req, LQS}; - _-> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_TYPE', - name = Req#'CosNotification_Property'.name, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - } - } - } - end; -'EventReliability'(Req,_,_,_,_,_) -> - %% only valid to set this QoS for channels (or per-event). - {unsupported, - #'CosNotification_PropertyError'{ - code = 'UNAVAILABLE_PROPERTY', - name = Req#'CosNotification_Property'.name, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - } - } - }. - -%%------------------------------------------------------------ -%% function : 'ConnectionReliability'/6 -%% Arguments: Req - Requested QoS, #'CosNotification_Property'{} -%% Type - Requestee, channel | admin | proxy -%% Curr - Current QoS, #'CosNotification_Property'{} -%% Parent - false | ObjRef -%% Childs - false | [ObjRef1, .., ObjRefN] -%% LQS - #qos{} defined in CosNotification_Definitions.hrl -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -%% The most complex QoS to set is ConnectionReliability, and the reason for this -%% is that we cannot set the Channel to offer best effort while its children -%% offer persistent. A child may only offer Persistent if its parent do, which -%% is why we must check the following: -%% -%% # Persistent Change to Best Effort -%% _____ -%% | | (1) -> Check if children BE -%% |Chann| (2) ok <- -%% ----- -%% | -%% _____ -%% | | (3) -> Check if children BE -%% |Admin| (4) Check if parent Pers. <- -%% ----- -%% | -%% _____ -%% | | (5) -> ok -%% |Proxy| (6) Check if parent Pers. <- -%% ----- -%% NOTE: a parent always exists but we may change the QoS before creating any -%% childrens. The cases (2) and (5) is always ok, i.e., no need to confirm -%% with parent or children. -%%------------------------------------------------------------ -'ConnectionReliability'(Req, channel, _Curr, _Parent, Childs, LQS) -> - case {any:get_value(Req#'CosNotification_Property'.value), - ?not_GetConnectionReliability(LQS), ?not_BestEffort, ?not_Persistent} of - {Val, Val, _, _} -> - %% Is the value requested. - ok; - {Val, P, Val, P} -> - %% Requested is BestEffort, Current Persistent => (1) - check_with_relatives(Childs, Req, LQS); - {Val, B, B, Val} -> - %% Requested is Persistent, Current BestEffort => (2) - {ok, Req, LQS}; - _-> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_TYPE', - name = Req#'CosNotification_Property'.name, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - } - } - } - end; -'ConnectionReliability'(Req, admin, _Curr, Parent, Childs, LQS) -> - case {any:get_value(Req#'CosNotification_Property'.value), - ?not_GetConnectionReliability(LQS), ?not_BestEffort, ?not_Persistent} of - {Val, Val, _, _} -> - %% Is the value requested. - ok; - {Val, P, Val, P} -> - %% Requested is BestEffort, Current Persistent => (3) - check_with_relatives(Childs, Req, LQS); - {Val, B, B, Val} -> - %% Requested is Persistent, Current BestEffort => (4) - check_with_relatives([Parent], Req, LQS); - _-> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_TYPE', - name = Req#'CosNotification_Property'.name, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - } - } - } - end; -'ConnectionReliability'(Req, proxy, _Curr, Parent, _Childs, LQS) -> - case {any:get_value(Req#'CosNotification_Property'.value), - ?not_GetConnectionReliability(LQS), ?not_BestEffort, ?not_Persistent} of - {Val, Val, _, _} -> - %% Is the value requested. - ok; - {Val, P, Val, P} -> - %% Requested is BestEffort, Current Persistent => (5) - {ok, Req, LQS}; - {Val, B, B, Val} -> - %% Requested is Persistent, Current BestEffort => (6) - check_with_relatives([Parent], Req, LQS); - _-> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_TYPE', - name = Req#'CosNotification_Property'.name, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - } - } - } - end. - -%%------------------------------------------------------------ -%% function : 'Priority'/6 -%% Arguments: Req - Requested QoS, #'CosNotification_Property'{} -%% Type - Requestee, channel | admin | proxy -%% Curr - Current QoS, #'CosNotification_Property'{} -%% Parent - false | ObjRef -%% Childs - false | [ObjRef1, .., ObjRefN] -%% LQS - #qos{} defined in CosNotification_Definitions.hrl -%% Returns : -%% Effect : -%%------------------------------------------------------------ -'Priority'(Req, _Type, _Curr, _Parent, _Childs, LQS) -> - case {any:get_value(Req#'CosNotification_Property'.value), - ?not_GetPriority(LQS), ?not_HighestPriority, ?not_LowestPriority} of - {Val, Val, _, _} -> - ok; - {Val, _, H, L} when Val =< H, Val >= L -> - {ok, Req, LQS}; - {_, _, H, L} -> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_VALUE', - name = Req#'CosNotification_Property'.name, - available_range = - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:short(), L), - high_val=any:create(orber_tc:short(), H) - } - } - } - end. - -%%------------------------------------------------------------ -%% function : 'StartTimeSupported'/6 -%% Arguments: Req - Requested QoS, #'CosNotification_Property'{} -%% Type - Requestee, channel | admin | proxy -%% Curr - Current QoS, #'CosNotification_Property'{} -%% Parent - false | ObjRef -%% Childs - false | [ObjRef1, .., ObjRefN] -%% LQS - #qos{} defined in CosNotification_Definitions.hrl -%% Returns : -%% Effect : -%%------------------------------------------------------------ -'StartTimeSupported'(Req, _Type, _Curr, _, _, LQS) -> - case {any:get_value(Req#'CosNotification_Property'.value), - ?not_GetStartTimeSupported(LQS)} of - {Val, Val} -> - ok; - {Val, _} when Val =/= true, Val =/= false -> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_VALUE', - name = Req#'CosNotification_Property'.name, - available_range = - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:boolean(), false), - high_val=any:create(orber_tc:boolean(), true) - } - } - }; - _-> - {ok, Req, LQS} - end. - -%%------------------------------------------------------------ -%% function : 'StopTimeSupported'/6 -%% Arguments: Req - Requested QoS, #'CosNotification_Property'{} -%% Type - Requestee, channel | admin | proxy -%% Curr - Current QoS, #'CosNotification_Property'{} -%% Parent - false | ObjRef -%% Childs - false | [ObjRef1, .., ObjRefN] -%% LQS - #qos{} defined in CosNotification_Definitions.hrl -%% Returns : -%% Effect : -%%------------------------------------------------------------ -'StopTimeSupported'(Req, _Type, _Curr, _, _, LQS) -> - case {any:get_value(Req#'CosNotification_Property'.value), - ?not_GetStopTimeSupported(LQS)} of - {Val, Val} -> - ok; - {Val, _} when Val =/= true, Val =/= false -> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_VALUE', - name = Req#'CosNotification_Property'.name, - available_range = - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:boolean(), false), - high_val=any:create(orber_tc:boolean(), true) - } - } - }; - _-> - {ok, Req, LQS} - end. - -%%------------------------------------------------------------ -%% function : 'Timeout'/6 -%% Arguments: Req - Requested QoS, #'CosNotification_Property'{} -%% Type - Requestee, channel | admin | proxy -%% Curr - Current QoS, #'CosNotification_Property'{} -%% Parent - false | ObjRef -%% Childs - false | [ObjRef1, .., ObjRefN] -%% LQS - #qos{} defined in CosNotification_Definitions.hrl -%% Returns : -%% Effect : -%%------------------------------------------------------------ -'Timeout'(Req, _Type, _Curr, _Parent, _Childs, LQS) -> - case {any:get_value(Req#'CosNotification_Property'.value), - ?not_GetTimeout(LQS)} of - {Val, Val} -> - ok; - {Val, _} when Val >= ?not_MinTimeout, Val =< ?not_MaxTimeout -> - {ok, Req, LQS}; - {Val, _} when is_integer(Val) -> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_VALUE', - name = Req#'CosNotification_Property'.name, - available_range = - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:unsigned_long_long(), ?not_MinTimeout), - high_val=any:create(orber_tc:unsigned_long_long(), ?not_MaxTimeout) - } - } - }; - _-> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_TYPE', - name = Req#'CosNotification_Property'.name, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - } - } - } - end. - -%%------------------------------------------------------------ -%% function : 'OrderPolicy'/6 -%% Arguments: Req - Requested QoS, #'CosNotification_Property'{} -%% Type - Requestee, channel | admin | proxy -%% Curr - Current QoS, #'CosNotification_Property'{} -%% Parent - false | ObjRef -%% Childs - false | [ObjRef1, .., ObjRefN] -%% LQS - #qos{} defined in CosNotification_Definitions.hrl -%% Returns : -%% Effect : -%%------------------------------------------------------------ -'OrderPolicy'(Req, _Type, _Curr, _Parent, _Childs, LQS) -> - case {any:get_value(Req#'CosNotification_Property'.value), - ?not_GetOrderPolicy(LQS), 'CosNotification':'AnyOrder'(), - 'CosNotification':'PriorityOrder'()} of - {Val, Val,_,_} -> - ok; - {Val, _, L, H} when Val >= L, Val =< H -> - {ok, Req, LQS}; - {Val, _, L, H} when is_integer(Val) -> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_VALUE', - name = Req#'CosNotification_Property'.name, - available_range = - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:short(), L), - high_val=any:create(orber_tc:short(), H) - } - } - }; - _-> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_TYPE', - name = Req#'CosNotification_Property'.name, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - } - } - } - end. - - -%%------------------------------------------------------------ -%% function : 'DiscardPolicy'/6 -%% Arguments: Req - Requested QoS, #'CosNotification_Property'{} -%% Type - Requestee, channel | admin | proxy -%% Curr - Current QoS, #'CosNotification_Property'{} -%% Parent - false | ObjRef -%% Childs - false | [ObjRef1, .., ObjRefN] -%% LQS - #qos{} defined in CosNotification_Definitions.hrl -%% Returns : -%% Effect : -%%------------------------------------------------------------ -'DiscardPolicy'(Req, _Type, _Curr, _Parent, _Childs, LQS) -> - case {any:get_value(Req#'CosNotification_Property'.value), - ?not_GetDiscardPolicy(LQS), ?not_AnyOrder, ?not_PriorityOrder} of - {Val, Val,_,_} -> - ok; - {Val, _, L, H} when Val >= L, Val =< H -> - {ok, Req, LQS}; - {Val, _, L, H} when is_integer(Val) -> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_VALUE', - name = Req#'CosNotification_Property'.name, - available_range = - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:short(), L), - high_val=any:create(orber_tc:short(), H) - } - } - }; - _-> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_TYPE', - name = Req#'CosNotification_Property'.name, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - } - } - } - end. - -%%------------------------------------------------------------ -%% function : 'DiscardPolicy'/6 -%% Arguments: Req - Requested QoS, #'CosNotification_Property'{} -%% Type - Requestee, channel | admin | proxy -%% Curr - Current QoS, #'CosNotification_Property'{} -%% Parent - false | ObjRef -%% Childs - false | [ObjRef1, .., ObjRefN] -%% LQS - #qos{} defined in CosNotification_Definitions.hrl -%% Returns : -%% Effect : -%%------------------------------------------------------------ -'MaximumBatchSize'(Req, _Type, _Curr, _Parent, _Childs, LQS) -> - case {any:get_value(Req#'CosNotification_Property'.value), - ?not_GetMaximumBatchSize(LQS)} of - {Val, Val} -> - ok; - {Val, _} when Val >= ?not_MinBatchSize, Val =< ?not_MaxBatchSize -> - {ok, Req, LQS}; - {Val, _} when is_integer(Val) -> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_VALUE', - name = Req#'CosNotification_Property'.name, - available_range = - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:unsigned_long_long(), ?not_MinBatchSize), - high_val=any:create(orber_tc:unsigned_long_long(), ?not_MaxBatchSize) - } - } - }; - _-> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'UNSUPPORTED_VALUE', - name = Req#'CosNotification_Property'.name, - available_range = - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:long(), ?not_MinBatchSize), - high_val=any:create(orber_tc:long(), ?not_MaxBatchSize) - } - } - } - end. - -%%------------------------------------------------------------ -%% function : 'PacingInterval'/6 -%% Arguments: Req - Requested QoS, #'CosNotification_Property'{} -%% Type - Requestee, channel | admin | proxy -%% Curr - Current QoS, #'CosNotification_Property'{} -%% Parent - false | ObjRef -%% Childs - false | [ObjRef1, .., ObjRefN] -%% LQS - #qos{} defined in CosNotification_Definitions.hrl -%% Returns : -%% Comment : PacingInterval is defined to be: -%% * TimeBase::UtcT (p 57, 2.5.5, OMG TC Document telecom/98-11-01) -%% * TimeBase::TimeT (p 189, appendix B, OMG TC Document telecom/98-11-01) -%% This implementation use TimeBase::TimeT, especially since -%% TimeBase::UtcT contains information which are of no importance. -%% When writing this, the OMG homepage contained no information -%% regarding this. -%%------------------------------------------------------------ -'PacingInterval'(Req, _Type, _Curr, _Parent, _Childs, LQS) -> - case {any:get_value(Req#'CosNotification_Property'.value), - ?not_GetPacingInterval(LQS)} of - {Val, Val} -> - ok; - {Val, _} when Val >= ?not_MinPacing, Val =< ?not_MaxPacing -> - {ok, Req, LQS}; - {Val, _} when is_integer(Val) -> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_VALUE', - name = Req#'CosNotification_Property'.name, - available_range = - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:unsigned_long_long(), ?not_MinPacing), - high_val=any:create(orber_tc:unsigned_long_long(), ?not_MaxPacing) - } - } - }; - _-> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_TYPE', - name = Req#'CosNotification_Property'.name, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - } - } - } - end. - -%%------------------------------------------------------------ -%% function : 'MaxEventsPerConsumer'/6 -%% Arguments: Req - Requested QoS, #'CosNotification_Property'{} -%% Type - Requestee, channel | admin | proxy -%% Curr - Current QoS, #'CosNotification_Property'{} -%% Parent - false | ObjRef -%% Childs - false | [ObjRef1, .., ObjRefN] -%% LQS - #qos{} defined in CosNotification_Definitions.hrl -%% Returns : -%% Effect : -%%------------------------------------------------------------ -'MaxEventsPerConsumer'(Req, _Type, _Curr, _Parent, _Childs, LQS) -> - case {any:get_value(Req#'CosNotification_Property'.value), - ?not_GetMaxEventsPerConsumer(LQS)} of - {Val, Val} -> - ok; - {Val, _} when is_integer(Val) andalso - Val >= ?not_MinConsumerEvents andalso - Val =< ?not_MaxConsumerEvents -> - {ok, Req, LQS}; - {Val, _} when is_integer(Val) -> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_VALUE', - name = Req#'CosNotification_Property'.name, - available_range = - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:unsigned_long_long(), ?not_MinConsumerEvents), - high_val=any:create(orber_tc:unsigned_long_long(), ?not_MaxConsumerEvents) - } - } - }; - _-> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'UNSUPPORTED_VALUE', - name = Req#'CosNotification_Property'.name, - available_range = - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:long(), ?not_MinConsumerEvents), - high_val=any:create(orber_tc:long(), ?not_MaxConsumerEvents) - } - } - } - end. - -%%------------------------------------------------------------ -%% function : validate_qos/5 -%% Arguments: Wanted - requested QoS to be set. -%% Curr - current QoS OMG style and LQS, local -%% representation of QoS, grouped as {OMGQ, LQS} -%% Type - channel | admin | proxy -%% Parent - Factory if Channel, Channel if Admin etc -%% Childs - Admins if Channel etc -%% Returns : NamedPropertySeq | #'CosNotification_UnsupportedQoS'{} -%% case 1 if all supported, case 2 if at least 1 QoS not -%% supported. -%% See also p59, 2.5.6.4, OMG TC Document telecom/98-11-01. Quote: -%% "If the supplied QoS is supported, it returns additional QoS -%% properties which could be optionally added as well." -%%------------------------------------------------------------ -validate_qos(Wanted, Curr, Type, Parent, Childs) -> - %% If not supported this function will raise an exception, which we should - %% not catch, but all we need to is to raise the exception as it is. - {_, LQS}=set_qos(Wanted, Curr, Type, Parent, Childs), - NewNPR = check_limits(LQS, ?not_QOS_LIMITS), - remove_qos(Wanted, LQS, NewNPR). - -remove_qos([], _, NPR) -> - NPR; -remove_qos([H|T], LQS, NPR) -> - NewNPR=remove(NPR, H#'CosNotification_Property'.name), - remove_qos(T, LQS, NewNPR). - -check_limits(LQS, NPR) -> - case {?not_GetEventReliability(LQS), ?not_GetConnectionReliability(LQS), - ?not_Persistent, ?not_BestEffort} of - {P,P,P,_B} -> - New = #'CosNotification_NamedPropertyRange' - {name=?not_EventReliability, - range= - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:short(), ?not_BestEffort), - high_val=any:create(orber_tc:short(), ?not_BestEffort) - }}, - NewNPR=change(NPR, ?not_EventReliability, New), - remove(NewNPR, ?not_ConnectionReliability); - {_,B,_P,B} -> - remove(NPR, ?not_EventReliability); - {B,P,P,B} -> - New = #'CosNotification_NamedPropertyRange' - {name=?not_ConnectionReliability, - range= - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:short(), ?not_BestEffort), - high_val=any:create(orber_tc:short(), ?not_BestEffort) - }}, - change(NPR, ?not_ConnectionReliability, New) - end. - -%%------------------------------------------------------------ -%% function : validate_event_qos/2 -%% Arguments: Wanted - requested QoS to be set. -%% Curr - LQS, local representation of QoS -%% Returns : NamedPropertySeq | #'CosNotification_UnsupportedQoS'{} -%% case 1 if all supported, case 2 if at least 1 QoS not -%% supported. -%%------------------------------------------------------------ -validate_event_qos(Wanted, Curr) -> - case v_e_q_helper(Wanted, Curr, []) of - ok -> - []; - {error, Unsupp} -> - corba:raise(#'CosNotification_UnsupportedQoS'{qos_err = Unsupp}) - end. - -v_e_q_helper([], _Curr, []) -> - %% Parsed all and found no conflicts. - ok; -v_e_q_helper([], _Curr, Unsupp) -> - %% Not possible to use these requested QoS. - {error, Unsupp}; - -%%--- EventReliability ---%% -v_e_q_helper([#'CosNotification_Property'{name=?not_EventReliability, - value=#any{value=?not_BestEffort}}|T], Curr, Unsupp) -> - %% Always ok. - v_e_q_helper(T, Curr, Unsupp); -v_e_q_helper([#'CosNotification_Property'{name=?not_EventReliability, - value=#any{value=?not_Persistent}}|T], Curr, Unsupp) - when ?not_GetConnectionReliability(Curr) =/= ?not_BestEffort, - ?not_GetEventReliability(Curr) =/= ?not_BestEffort, - ?not_GetStopTimeSupported(Curr) =/= true -> - v_e_q_helper(T, Curr, Unsupp); -v_e_q_helper([#'CosNotification_Property'{name=?not_EventReliability}|T], - Curr, Unsupp) -> - %% Impossible to set to Persistent if the connection reliability is best effort. - v_e_q_helper(T, Curr, [#'CosNotification_PropertyError' - {code = 'UNAVAILABLE_VALUE', name = ?not_EventReliability, - available_range = - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null)}}|Unsupp]); - -%%--- Priority ---%% -v_e_q_helper([#'CosNotification_Property'{name=?not_Priority, value=#any{value=V}}|T], Curr, - Unsupp) -> - if - ?not_GetOrderPolicy(Curr) =/= ?not_AnyOrder, - ?not_GetOrderPolicy(Curr) =/= ?not_Priority, - ?not_GetDiscardPolicy(Curr) =/= ?not_Priority -> - %% No use setting Priority since it's not currently used. - v_e_q_helper(T, Curr, [#'CosNotification_PropertyError' - {code = 'UNAVAILABLE_VALUE', name = ?not_Priority, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - }}|Unsupp]); - V =< ?not_HighestPriority, V >= ?not_LowestPriority -> - v_e_q_helper(T, Curr, Unsupp); - true -> - v_e_q_helper(T, Curr, [#'CosNotification_PropertyError' - {code = 'BAD_VALUE', name = ?not_Priority, - available_range = - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:short(), - ?not_LowestPriority), - high_val=any:create(orber_tc:short(), - ?not_HighestPriority)}}|Unsupp]) - end; - -%%--- StartTime ---%% -v_e_q_helper([#'CosNotification_Property'{name=?not_StartTime}|T], Curr, Unsupp) - when ?not_GetStartTimeSupported(Curr) =/= false, - ?not_GetEventReliability(Curr) =/= ?not_Persistent -> - v_e_q_helper(T, Curr, Unsupp); -v_e_q_helper([#'CosNotification_Property'{name=?not_StartTime}|T], Curr, Unsupp) -> - v_e_q_helper(T, Curr, [#'CosNotification_PropertyError' - {code = 'UNAVAILABLE_VALUE', name = ?not_StartTime, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - }}|Unsupp]); - -%%--- StopTime ---%% -v_e_q_helper([#'CosNotification_Property'{name=?not_StopTime}|T], Curr, Unsupp) - when ?not_GetStopTimeSupported(Curr) =/= false, - ?not_GetEventReliability(Curr) =/= ?not_Persistent -> - v_e_q_helper(T, Curr, Unsupp); -v_e_q_helper([#'CosNotification_Property'{name=?not_StopTime}|T], Curr, Unsupp) -> - v_e_q_helper(T, Curr, [#'CosNotification_PropertyError' - {code = 'UNAVAILABLE_VALUE', name = ?not_StopTime, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - }}|Unsupp]); - -%%--- Timeout ---%% -v_e_q_helper([#'CosNotification_Property'{name=?not_Timeout}|T], Curr, Unsupp) - when ?not_GetStopTimeSupported(Curr) =/= false, - ?not_GetEventReliability(Curr) =/= ?not_Persistent -> - v_e_q_helper(T, Curr, Unsupp); -v_e_q_helper([#'CosNotification_Property'{name=?not_Timeout}|T], Curr, Unsupp) -> - v_e_q_helper(T, Curr, [#'CosNotification_PropertyError' - {code = 'UNAVAILABLE_VALUE', name = ?not_Timeout, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - }}|Unsupp]); - -%%--- Unknown Event QoS ---%% -v_e_q_helper([#'CosNotification_Property'{name=Name}|T], Curr, Unsupp) -> - %% Unsupported property. - v_e_q_helper(T, Curr, [#'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) - }}|Unsupp]); -v_e_q_helper(What, _, _) -> - %% Not a Property struct. - orber:dbg("[~p] CosNotification_Common:v_e_q_helper(~p);~n" - "Not a CosNotification_Property struct.", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%-------------- QOS HELP FUNCTIONS -------------------------- -%%------------------------------------------------------------ -%% function : set_properties/9 -%% Arguments: Wanted - requested QoS to be set. -%% Current - current QoS OMG style -%% Type - channel | admin | proxy -%% Supported - List of supported QoS -%% Unsupp - acc -%% NewQoS - acc -%% Parent - Factory if Channel, Channel if Admin etc -%% Childs - Admins if Channel etc -%% LQS - local representation of QoS. -%% Returns : {NewOMGStyleQoS, NewLocalQoS} | #'CosNotification_UnsupportedQoS'{} -%%------------------------------------------------------------ -set_properties(Wanted, Current, Type, Supported, Unsupp, NewQoS, Parent, Childs, LQS) -> - case do_set_properties(Wanted, Current, Type, Supported, Unsupp, NewQoS, Parent, Childs, LQS) of - {error, Exc} -> - corba:raise(Exc); - Result -> - Result - end. - -do_set_properties([], Curr, channelAdm, _, [], NewQoS,_,_,LAS) -> - merge_properties(NewQoS, Curr, LAS); -do_set_properties([], Curr, _, _, [], NewQoS,_,_,LQS) -> - %% set_local_qos and merge_properties are help functions found at the end of QoS - %% functions. - NewLQS = set_local_qos(NewQoS, LQS), - merge_properties(NewQoS, Curr, NewLQS); -do_set_properties([], _, channelAdm, _, Unsupp, _,_,_,_) -> - {error, #'CosNotification_UnsupportedAdmin'{admin_err = Unsupp}}; -do_set_properties([], _, _, _, Unsupp, _,_,_,_) -> - {error, #'CosNotification_UnsupportedQoS'{qos_err = Unsupp}}; - -do_set_properties([Req|Tail], Curr, Type, Supported, Unsupp, NewQoS, Parent, Childs,LQS) -> - %% set_values and is_supported are help functions found at the end of QoS - %% functions. - case set_values(is_supported(Supported, Req), Req, Type, Curr, Parent, Childs,LQS) of - {unsupported, U} -> - do_set_properties(Tail, Curr, Type, Supported, [U|Unsupp], NewQoS, Parent, Childs,LQS); - {ok, S, NewLQS} -> - do_set_properties(Tail, Curr, Type, Supported, Unsupp, [S|NewQoS], Parent, Childs,NewLQS); - {ok, S} -> - do_set_properties(Tail, Curr, Type, Supported, Unsupp, [S|NewQoS], Parent, Childs,LQS); - ok -> - do_set_properties(Tail, Curr, Type, Supported, Unsupp, NewQoS, Parent, Childs,LQS) - end. - - -set_values(unsupported,Req,_,_,_,_,_) -> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_PROPERTY', - name = Req#'CosNotification_Property'.name, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - } - } - }; -set_values({ok, Func}, Req, Type, Curr, Parent, Childs, LQS) -> - ?MODULE:Func(Req, Type, Curr, Parent, Childs, LQS). - -%% Update OMG style QoS list with new values. -merge_properties([], NewCurrQoS, LQS) -> - {NewCurrQoS, LQS}; -merge_properties([H|T], Curr, LQS) -> - merge_properties(T, lists:keyreplace(H#'CosNotification_Property'.name, %% get key. - #'CosNotification_Property'.name, %% get index. - Curr, H), LQS). - -%% Is the Property S among our supported QoS? -is_supported([], _) -> - unsupported; -is_supported([{Name, Func}|_], #'CosNotification_Property'{name=Name}) -> - {ok, Func}; -is_supported([_|T], S) -> - is_supported(T, S). - -%% Find matching S-Property from a list of OMG style QoS -extract([], _) -> unsupported; -extract([H|_T], S) when H#'CosNotification_Property'.name== - S#'CosNotification_Property'.name -> - {ok, H}; -extract([_|T], S) -> extract(T,S). - -%% Find matching Property name from a list of OMG style QoS -extract_value([], _) -> unsupported; -extract_value([H|_T], Key) when H#'CosNotification_Property'.name== Key -> - {ok, any:get_value(H#'CosNotification_Property'.value)}; -extract_value([_|T], Key) -> extract(T,Key). - -%% Remove matching S-QoS from a list of OMG style QoS -remove(List, Key) -> - lists:keydelete(Key, - #'CosNotification_NamedPropertyRange'.name, %% get index. - List). - -change(List, Key, New) -> - lists:keyreplace(Key, - #'CosNotification_NamedPropertyRange'.name, %% get index. - List, New). -%% Get QoS from supplied objects and check if it's the same as S. -check_with_relatives([], S, LQS) -> - {ok, S, LQS}; -check_with_relatives([undefined|T], S, LQS) -> - check_with_relatives(T, S, LQS); -check_with_relatives([H|T], S, LQS) -> - case catch extract('CosNotification_QoSAdmin':get_qos(H), S) of - {ok, S} -> - check_with_relatives(T, S, LQS); - _-> - %% Varioues reasons for this case (Object not responding, not supported) - {unsupported, - #'CosNotification_PropertyError'{ - code = 'UNAVAILABLE_PROPERTY', - name = S#'CosNotification_Property'.name, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - } - } - } - end. - -%% Set new values to locally defined representation of QoS. Using this approach is -%% necessary since we must state the record-field at compile-time. -set_local_qos([], LQS) -> LQS; -set_local_qos([#'CosNotification_Property'{name=N,value=V}|T], LQS) -> - NewLQS = - case N of - "EventReliability" -> - ?not_SetEventReliability(LQS, any:get_value(V)); - "ConnectionReliability" -> - ?not_SetConnectionReliability(LQS, any:get_value(V)); - "Priority" -> - ?not_SetPriority(LQS, any:get_value(V)); - "Timeout" -> - ?not_SetTimeout(LQS, any:get_value(V)); - "OrderPolicy" -> - ?not_SetOrderPolicy(LQS, any:get_value(V)); - "DiscardPolicy" -> - ?not_SetDiscardPolicy(LQS, any:get_value(V)); - "MaximumBatchSize" -> - ?not_SetMaximumBatchSize(LQS, any:get_value(V)); - "PacingInterval" -> - ?not_SetPacingInterval(LQS, any:get_value(V)); - "StartTimeSupported" -> - ?not_SetStartTimeSupported(LQS, any:get_value(V)); - "StopTimeSupported" -> - ?not_SetStopTimeSupported(LQS, any:get_value(V)); - "MaxEventsPerConsumer" -> - ?not_SetMaxEventsPerConsumer(LQS, any:get_value(V)) - end, - set_local_qos(T, NewLQS). - -%%%%%%%%%%%%%%%%% END QOS FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%% - -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosNotification/src/CosNotification_Definitions.hrl b/lib/cosNotification/src/CosNotification_Definitions.hrl deleted file mode 100644 index 5d85c77a22..0000000000 --- a/lib/cosNotification/src/CosNotification_Definitions.hrl +++ /dev/null @@ -1,343 +0,0 @@ -%%---------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosNotification_Definitions.hrl -%% Purpose : -%%---------------------------------------------------------------------- - --ifndef(COSNOTIFICATION_DEFINITIONS_HRL). --define(COSNOTIFICATION_DEFINITIONS_HRL, true). - -%% ---------------- General comment ------------------------------------ -%% ******* README ******** -%% The prefix 'not' is short for notification, and is used to separate locally -%% defined macros from the global ones, i.e., do NOT confuse this with a negation!! -%% -%% In this file you find globally used data structures, constants etc. -%% - -%%--------------- INCLUDES --------------------------------------------- - -%%-------- Constants ------------------------------------------------- --define(not_SupportedGrammars, ["EXTENDED_TCL"]). - -%% !!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!!!!!!! -%% -%% If OMG redefines the values for the constants the definitions -%% below must be redefined!! -%% -%% !!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!!!!!!! --define(not_BestEffort, 0). --define(not_Persistent, 1). --define(not_EventReliability, "EventReliability"). --define(not_ConnectionReliability, "ConnectionReliability"). --define(not_Priority, "Priority"). --define(not_LowestPriority, -32767). --define(not_HighestPriority, 32767). --define(not_DefaultPriority, 0). --define(not_StartTime, "StartTime"). --define(not_StopTime, "StopTime"). --define(not_Timeout, "Timeout"). --define(not_OrderPolicy, "OrderPolicy"). --define(not_AnyOrder, 0). --define(not_FifoOrder, 1). --define(not_PriorityOrder, 2). --define(not_DeadlineOrder, 3). --define(not_DiscardPolicy, "DiscardPolicy"). --define(not_LifoOrder, 4). --define(not_RejectNewEvents, 5). --define(not_MaximumBatchSize, "MaximumBatchSize"). --define(not_PacingInterval, "PacingInterval"). --define(not_StartTimeSupported, "StartTimeSupported"). --define(not_StopTimeSupported, "StopTimeSupported"). --define(not_MaxEventsPerConsumer, "MaxEventsPerConsumer"). --define(not_MaxQueueLength, "MaxQueueLength"). --define(not_MaxConsumers, "MaxConsumers"). --define(not_MaxSuppliers, "MaxSuppliers"). - -%%--------------- QOS DEFINITIONS ---------------------------- -%% Limits for QoS. These are our own limits. --define(not_MaxBatchSize, 10000). --define(not_MinBatchSize, 1). --define(not_MinTimeout, 0). --define(not_MaxTimeout, 100000000000). --define(not_MinPacing, 0). --define(not_MaxPacing, 100000000000). --define(not_MinConsumerEvents, 1). --define(not_MaxConsumerEvents, 10000). - --define(not_QOS_LIMITS, -[#'CosNotification_NamedPropertyRange' - {name=?not_EventReliability, - range= - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:short(), ?not_BestEffort), - high_val=any:create(orber_tc:short(), ?not_Persistent) - }}, - #'CosNotification_NamedPropertyRange' - {name=?not_ConnectionReliability, - range= - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:short(), ?not_BestEffort), - high_val=any:create(orber_tc:short(), ?not_Persistent) - }}, - #'CosNotification_NamedPropertyRange' - {name=?not_Priority, - range= - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:short(), ?not_LowestPriority), - high_val=any:create(orber_tc:short(), ?not_HighestPriority) - }}, - #'CosNotification_NamedPropertyRange' - {name=?not_StartTimeSupported, - range= - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:boolean(), false), - high_val=any:create(orber_tc:boolean(), true) - }}, - #'CosNotification_NamedPropertyRange' - {name=?not_StopTimeSupported, - range= - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:boolean(), false), - high_val=any:create(orber_tc:boolean(), true) - }}, - #'CosNotification_NamedPropertyRange' - {name=?not_Timeout, - range= - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:unsigned_long_long(), ?not_MinTimeout), - high_val=any:create(orber_tc:unsigned_long_long(), ?not_MaxTimeout) - }}, - #'CosNotification_NamedPropertyRange' - {name=?not_OrderPolicy, - range= - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:short(), ?not_AnyOrder), - high_val=any:create(orber_tc:short(), ?not_PriorityOrder) - }}, - #'CosNotification_NamedPropertyRange' - {name=?not_DiscardPolicy, - range= - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:short(), ?not_AnyOrder), - high_val=any:create(orber_tc:short(), ?not_PriorityOrder) - }}, - #'CosNotification_NamedPropertyRange' - {name=?not_MaximumBatchSize, - range= - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:long(), ?not_MinBatchSize), - high_val=any:create(orber_tc:long(), ?not_MaxBatchSize) - }}, - #'CosNotification_NamedPropertyRange' - {name=?not_PacingInterval, - range= - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:unsigned_long_long(), ?not_MinPacing), - high_val=any:create(orber_tc:unsigned_long_long(), ?not_MaxPacing) - }}, - #'CosNotification_NamedPropertyRange' - {name=?not_MaxEventsPerConsumer, - range= - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:long(), ?not_MinConsumerEvents), - high_val=any:create(orber_tc:long(), ?not_MaxConsumerEvents) - }} -]). - - - -%% Local record used internally, and the reason for this is we get faster -%% access to QoS settings. --record(qos, {'EventReliability', - 'ConnectionReliability', - 'Priority', - 'StartTimeSupported', - 'StopTimeSupported', - 'Timeout', - 'OrderPolicy', - 'DiscardPolicy', - 'MaximumBatchSize', - 'PacingInterval', - 'MaxEventsPerConsumer'}). - -%% Global (OMG) representation of QoS. --define(not_DEFAULT_QOS, -[#'CosNotification_Property'{name=?not_MaximumBatchSize, - value=any:create(orber_tc:long(), 1)}, - #'CosNotification_Property'{name=?not_PacingInterval, - value=any:create(orber_tc:unsigned_long_long(), 0)}, - #'CosNotification_Property'{name=?not_Timeout, - value=any:create(orber_tc:unsigned_long_long(), 0)}, - #'CosNotification_Property'{name=?not_MaxEventsPerConsumer, - value=any:create(orber_tc:long(), 100)}, - #'CosNotification_Property'{name=?not_OrderPolicy, - value=any:create(orber_tc:short(), - ?not_PriorityOrder)}, - #'CosNotification_Property'{name=?not_EventReliability, - value=any:create(orber_tc:short(), - ?not_BestEffort)}, - #'CosNotification_Property'{name=?not_ConnectionReliability, - value=any:create(orber_tc:short(), - ?not_BestEffort)}, - #'CosNotification_Property'{name=?not_DiscardPolicy, - value=any:create(orber_tc:short(), - ?not_RejectNewEvents)}, - #'CosNotification_Property'{name=?not_StartTimeSupported, - value=any:create(orber_tc:boolean(), false)}, - #'CosNotification_Property'{name=?not_StopTimeSupported, - value=any:create(orber_tc:boolean(), false)}, - #'CosNotification_Property'{name=?not_Priority, - value=any:create(orber_tc:short(), ?not_DefaultPriority)}]). - -%%--------------- QOS CREATORS ------------------------------- --define(not_CreateInitQoS(), #qos{}). - -%%--------------- QOS DESTRUCTORS ---------------------------- --define(not_DestroyQoS(Q), ok). - -%%--------------- QOS SELECTORS ------------------------------ --define(not_GetEventReliability(Q), Q#qos.'EventReliability'). --define(not_GetConnectionReliability(Q), Q#qos.'ConnectionReliability'). --define(not_GetPriority(Q), Q#qos.'Priority'). --define(not_GetStartTimeSupported(Q), Q#qos.'StartTimeSupported'). --define(not_GetStopTimeSupported(Q), Q#qos.'StopTimeSupported'). --define(not_GetTimeout(Q), Q#qos.'Timeout'). --define(not_GetOrderPolicy(Q), Q#qos.'OrderPolicy'). --define(not_GetDiscardPolicy(Q), Q#qos.'DiscardPolicy'). --define(not_GetMaximumBatchSize(Q), Q#qos.'MaximumBatchSize'). --define(not_GetPacingInterval(Q), Q#qos.'PacingInterval'). --define(not_GetMaxEventsPerConsumer(Q), Q#qos.'MaxEventsPerConsumer'). - -%%--------------- QOS MODIFIERS ------------------------------ --define(not_SetEventReliability(Q,D), Q#qos{'EventReliability'=D}). --define(not_SetConnectionReliability(Q,D), Q#qos{'ConnectionReliability'=D}). --define(not_SetPriority(Q,D), Q#qos{'Priority'=D}). --define(not_SetStartTimeSupported(Q,D), Q#qos{'StartTimeSupported'=D}). --define(not_SetStopTimeSupported(Q,D), Q#qos{'StopTimeSupported'=D}). --define(not_SetTimeout(Q,D), Q#qos{'Timeout'=D}). --define(not_SetOrderPolicy(Q,D), Q#qos{'OrderPolicy'=D}). --define(not_SetDiscardPolicy(Q,D), Q#qos{'DiscardPolicy'=D}). --define(not_SetMaximumBatchSize(Q,D), Q#qos{'MaximumBatchSize'=D}). --define(not_SetPacingInterval(Q,D), Q#qos{'PacingInterval'=D}). --define(not_SetMaxEventsPerConsumer(Q,D), Q#qos{'MaxEventsPerConsumer'=D}). - -%%--------------- StructuredEvent CREATORS ------------------- --define(not_CreateSE(StrD,StrT,StrE,PSeqV,PSeqF,AnyR), -#'CosNotification_StructuredEvent'{header = - #'CosNotification_EventHeader'{fixed_header = - #'CosNotification_FixedEventHeader'{event_type = - #'CosNotification_EventType'{domain_name=StrD, - type_name=StrT}, - event_name = StrE}, - variable_header = PSeqV}, - filterable_data = PSeqF, - remainder_of_body = AnyR}). -%% Can be used in guards. --define(not_isConvertedAny(E), - (((E#'CosNotification_StructuredEvent'.header) - #'CosNotification_EventHeader'.fixed_header) - #'CosNotification_FixedEventHeader'.event_type) - #'CosNotification_EventType'.type_name == "%ANY"). -%% Can NOT be used in guards!!!!! --define(not_isConvertedStructured(E), - any:get_typecode(E) == 'CosNotification_StructuredEvent':tc()). - -%%--------------- StructuredEvent DESTRUCTORS ---------------- --define(not_DestroySE(E), ok). - -%%--------------- StructuredEvent SELECTORS ------------------ --define(not_GetSEHeader(E), E#'StructuredEvent'.header). --define(not_GetSEFixedHeader(E), E#'StructuredEvent'.header). - -%%--------------- StructuredEvent MODIFIERS ------------------ - -%%-------- QoS support ----------------------------------------------- --define(not_SUPPORTED_QOS, -[{?not_EventReliability, 'EventReliability'}, - {?not_ConnectionReliability, 'ConnectionReliability'}, - {?not_Priority, 'Priority'}, - {?not_StartTimeSupported, 'StartTimeSupported'}, - {?not_StopTimeSupported, 'StopTimeSupported'}, - {?not_Timeout, 'Timeout'}, - {?not_OrderPolicy, 'OrderPolicy'}, - {?not_DiscardPolicy, 'DiscardPolicy'}, - {?not_MaximumBatchSize, 'MaximumBatchSize'}, - {?not_PacingInterval, 'PacingInterval'}, - {?not_MaxEventsPerConsumer, 'MaxEventsPerConsumer'}]). - -%%-------- ADMINPROPERTIESADMIN -------------------------------------- - -%% According to the OMG TC Document telecom/98-11-01, p 63 (section 2.5.7), the -%% default-value for these 3 admin properties is zero, which means that no limit -%% applies to that property. --define(not_DEFAULT_ADMINPROPERTIES, -[#'CosNotification_Property'{name=?not_MaxQueueLength, - value=any:create(orber_tc:long(), 0)}, - #'CosNotification_Property'{name=?not_MaxConsumers, - value=any:create(orber_tc:long(), 0)}, - #'CosNotification_Property'{name=?not_MaxSuppliers, - value=any:create(orber_tc:long(), 0)}]). - --define(not_SUPPORTED_ADMINPROPERTIES, -[{?not_MaxQueueLength, 'MaxQueueLength'}, - {?not_MaxConsumers, 'MaxConsumers'}, - {?not_MaxSuppliers, 'MaxSuppliers'}]). - - -%%-------- MISC -------------------------------------------------------- - --define(not_DEFAULT_SETTINGS, [{pullInterval, 20}, - {filterOp, 'OR_OP'}, - {gcTime, 60}, - {gcLimit, 50}, - {timeService, undefined}, - {typecheck, true}, - {tty, false}, - {logfile, false}, - {server_options, []}]). --define(not_CreateDBKey, term_to_binary({{erlang:system_time(), - erlang:unique_integer()}, - node()})). - --define(DEBUG_LEVEL, 3). - --ifdef(debug). - --define(debug_print(F,A), io:format("[~p(~p)] "++F,[?MODULE, ?LINE]++A)). --define(DBG(F,A), io:format("[~p(~p)] "++F,[?MODULE, ?LINE]++A)). --define(not_TypeCheck(O,I), ok). -%-define(not_TypeCheck(O,M), 'CosNotification_Common':type_check(O,M)). - --else. - --define(debug_print(F,A), ok). --define(DBG(F,A), ok). --define(not_TypeCheck(O,I), ok). - --endif. - - - --endif. -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosNotification/src/CosNotifyChannelAdmin.cfg b/lib/cosNotification/src/CosNotifyChannelAdmin.cfg deleted file mode 100644 index 8647b281a2..0000000000 --- a/lib/cosNotification/src/CosNotifyChannelAdmin.cfg +++ /dev/null @@ -1,60 +0,0 @@ -{this, "CosNotifyChannelAdmin::EventChannel"}. -{from, "CosNotifyChannelAdmin::EventChannel"}. -{{handle_info, "CosNotifyChannelAdmin::EventChannel"}, true}. -{this, "CosNotifyChannelAdmin::EventChannelFactory"}. -{from, "CosNotifyChannelAdmin::EventChannelFactory"}. -{{handle_info, "CosNotifyChannelAdmin::EventChannelFactory"}, true}. -{this, "CosNotifyChannelAdmin::SupplierAdmin"}. -{from, "CosNotifyChannelAdmin::SupplierAdmin"}. -{{handle_info, "CosNotifyChannelAdmin::SupplierAdmin"}, true}. -{this, "CosNotifyChannelAdmin::ConsumerAdmin"}. -{from, "CosNotifyChannelAdmin::ConsumerAdmin"}. -{{handle_info, "CosNotifyChannelAdmin::ConsumerAdmin"}, true}. -{this, "CosNotifyChannelAdmin::StructuredProxyPushSupplier"}. -{from, "CosNotifyChannelAdmin::StructuredProxyPushSupplier"}. -{{handle_info, "CosNotifyChannelAdmin::StructuredProxyPushSupplier"}, true}. -{{impl, "CosNotifyChannelAdmin::StructuredProxyPushSupplier"}, "PusherSupplier_impl"}. -{this, "CosNotifyChannelAdmin::StructuredProxyPullSupplier"}. -{from, "CosNotifyChannelAdmin::StructuredProxyPullSupplier"}. -{{handle_info, "CosNotifyChannelAdmin::StructuredProxyPullSupplier"}, true}. -{{impl, "CosNotifyChannelAdmin::StructuredProxyPullSupplier"}, "PullerSupplier_impl"}. -{this, "CosNotifyChannelAdmin::ProxyPushSupplier"}. -{from, "CosNotifyChannelAdmin::ProxyPushSupplier"}. -{{handle_info, "CosNotifyChannelAdmin::ProxyPushSupplier"}, true}. -{{impl, "CosNotifyChannelAdmin::ProxyPushSupplier"}, "PusherSupplier_impl"}. -{this, "CosNotifyChannelAdmin::ProxyPullSupplier"}. -{from, "CosNotifyChannelAdmin::ProxyPullSupplier"}. -{{handle_info, "CosNotifyChannelAdmin::ProxyPullSupplier"}, true}. -{{impl, "CosNotifyChannelAdmin::ProxyPullSupplier"}, "PullerSupplier_impl"}. -{this, "CosNotifyChannelAdmin::SequenceProxyPushSupplier"}. -{from, "CosNotifyChannelAdmin::SequenceProxyPushSupplier"}. -{{handle_info, "CosNotifyChannelAdmin::SequenceProxyPushSupplier"}, true}. -{{impl, "CosNotifyChannelAdmin::SequenceProxyPushSupplier"}, "PusherSupplier_impl"}. -{this, "CosNotifyChannelAdmin::SequenceProxyPullSupplier"}. -{from, "CosNotifyChannelAdmin::SequenceProxyPullSupplier"}. -{{handle_info, "CosNotifyChannelAdmin::SequenceProxyPullSupplier"}, true}. -{{impl, "CosNotifyChannelAdmin::SequenceProxyPullSupplier"}, "PullerSupplier_impl"}. -{this, "CosNotifyChannelAdmin::StructuredProxyPushConsumer"}. -{from, "CosNotifyChannelAdmin::StructuredProxyPushConsumer"}. -{{handle_info, "CosNotifyChannelAdmin::StructuredProxyPushConsumer"}, true}. -{{impl, "CosNotifyChannelAdmin::StructuredProxyPushConsumer"}, "PusherConsumer_impl"}. -{this, "CosNotifyChannelAdmin::StructuredProxyPullConsumer"}. -{from, "CosNotifyChannelAdmin::StructuredProxyPullConsumer"}. -{{handle_info, "CosNotifyChannelAdmin::StructuredProxyPullConsumer"}, true}. -{{impl, "CosNotifyChannelAdmin::StructuredProxyPullConsumer"}, "PullerConsumer_impl"}. -{this, "CosNotifyChannelAdmin::ProxyPushConsumer"}. -{from, "CosNotifyChannelAdmin::ProxyPushConsumer"}. -{{handle_info, "CosNotifyChannelAdmin::ProxyPushConsumer"}, true}. -{{impl, "CosNotifyChannelAdmin::ProxyPushConsumer"}, "PusherConsumer_impl"}. -{this, "CosNotifyChannelAdmin::ProxyPullConsumer"}. -{from, "CosNotifyChannelAdmin::ProxyPullConsumer"}. -{{handle_info, "CosNotifyChannelAdmin::ProxyPullConsumer"}, true}. -{{impl, "CosNotifyChannelAdmin::ProxyPullConsumer"}, "PullerConsumer_impl"}. -{this, "CosNotifyChannelAdmin::SequenceProxyPushConsumer"}. -{from, "CosNotifyChannelAdmin::SequenceProxyPushConsumer"}. -{{handle_info, "CosNotifyChannelAdmin::SequenceProxyPushConsumer"}, true}. -{{impl, "CosNotifyChannelAdmin::SequenceProxyPushConsumer"}, "PusherConsumer_impl"}. -{this, "CosNotifyChannelAdmin::SequenceProxyPullConsumer"}. -{from, "CosNotifyChannelAdmin::SequenceProxyPullConsumer"}. -{{handle_info, "CosNotifyChannelAdmin::SequenceProxyPullConsumer"}, true}. -{{impl, "CosNotifyChannelAdmin::SequenceProxyPullConsumer"}, "PullerConsumer_impl"}. diff --git a/lib/cosNotification/src/CosNotifyChannelAdmin.idl b/lib/cosNotification/src/CosNotifyChannelAdmin.idl deleted file mode 100644 index b345ff5423..0000000000 --- a/lib/cosNotification/src/CosNotifyChannelAdmin.idl +++ /dev/null @@ -1,275 +0,0 @@ -#ifndef _COS_NOTIFYCHANNELADMIN_IDL_ -#define _COS_NOTIFYCHANNELADMIN_IDL_ - -#pragma prefix "omg.org" - -#include -#include -#include -#include - -module CosNotifyChannelAdmin { - exception ConnectionAlreadyActive {}; - exception ConnectionAlreadyInactive {}; - exception NotConnected {}; - // Forward declarations - interface ConsumerAdmin; - interface SupplierAdmin; - interface EventChannel; - interface EventChannelFactory; - - enum ProxyType { - PUSH_ANY, - PULL_ANY, - PUSH_STRUCTURED, - PULL_STRUCTURED, - PUSH_SEQUENCE, - PULL_SEQUENCE}; - - enum ObtainInfoMode { - ALL_NOW_UPDATES_OFF, - ALL_NOW_UPDATES_ON, - NONE_NOW_UPDATES_OFF, - NONE_NOW_UPDATES_ON}; - - interface ProxyConsumer : CosNotification::QoSAdmin, CosNotifyFilter::FilterAdmin { - readonly attribute ProxyType MyType; - readonly attribute SupplierAdmin MyAdmin; - - CosNotification::EventTypeSeq obtain_subscription_types(in ObtainInfoMode mode); - - void validate_event_qos (in CosNotification::QoSProperties required_qos, - out CosNotification::NamedPropertyRangeSeq available_qos) - raises (CosNotification::UnsupportedQoS); - }; // ProxyConsumer - - interface ProxySupplier : CosNotification::QoSAdmin, CosNotifyFilter::FilterAdmin { - readonly attribute ProxyType MyType; - readonly attribute ConsumerAdmin MyAdmin; - attribute CosNotifyFilter::MappingFilter priority_filter; - attribute CosNotifyFilter::MappingFilter lifetime_filter; - - CosNotification::EventTypeSeq obtain_offered_types(in ObtainInfoMode mode); - - void validate_event_qos (in CosNotification::QoSProperties required_qos, - out CosNotification::NamedPropertyRangeSeq available_qos) - raises (CosNotification::UnsupportedQoS); - }; // ProxySupplier - - interface ProxyPushConsumer : ProxyConsumer, CosNotifyComm::PushConsumer, - CosEventChannelAdmin::ProxyPushConsumer { - void connect_any_push_supplier (in CosEventComm::PushSupplier push_supplier) - raises(CosEventChannelAdmin::AlreadyConnected); - }; // ProxyPushConsumer - - interface StructuredProxyPushConsumer : ProxyConsumer, CosNotifyComm::StructuredPushConsumer { - void connect_structured_push_supplier (in CosNotifyComm::StructuredPushSupplier push_supplier) - raises(CosEventChannelAdmin::AlreadyConnected); - }; // StructuredProxyPushConsumer - - interface SequenceProxyPushConsumer : ProxyConsumer, CosNotifyComm::SequencePushConsumer { - void connect_sequence_push_supplier (in CosNotifyComm::SequencePushSupplier push_supplier) - raises(CosEventChannelAdmin::AlreadyConnected); - }; // SequenceProxyPushConsumer - - interface ProxyPullSupplier : ProxySupplier, CosNotifyComm::PullSupplier, - CosEventChannelAdmin::ProxyPullSupplier, oe_CosNotificationComm::Event { - void connect_any_pull_consumer (in CosEventComm::PullConsumer pull_consumer) - raises(CosEventChannelAdmin::AlreadyConnected); - }; // ProxyPullSupplier - - interface StructuredProxyPullSupplier : ProxySupplier, CosNotifyComm::StructuredPullSupplier, - oe_CosNotificationComm::Event { - void connect_structured_pull_consumer (in CosNotifyComm::StructuredPullConsumer pull_consumer) - raises(CosEventChannelAdmin::AlreadyConnected); - }; // StructuredProxyPullSupplier - - interface SequenceProxyPullSupplier : ProxySupplier, CosNotifyComm::SequencePullSupplier, - oe_CosNotificationComm::Event { - void connect_sequence_pull_consumer (in CosNotifyComm::SequencePullConsumer pull_consumer) - raises(CosEventChannelAdmin::AlreadyConnected); - }; // SequenceProxyPullSupplier - - interface ProxyPullConsumer : ProxyConsumer, CosNotifyComm::PullConsumer, - CosEventChannelAdmin::ProxyPullConsumer { - void connect_any_pull_supplier (in CosEventComm::PullSupplier pull_supplier) - raises(CosEventChannelAdmin::AlreadyConnected, CosEventChannelAdmin::TypeError); - - void suspend_connection() - raises(ConnectionAlreadyInactive, NotConnected); - - void resume_connection() - raises(ConnectionAlreadyActive, NotConnected); - }; // ProxyPullConsumer - - interface StructuredProxyPullConsumer : ProxyConsumer, CosNotifyComm::StructuredPullConsumer { - void connect_structured_pull_supplier (in CosNotifyComm::StructuredPullSupplier pull_supplier) - raises(CosEventChannelAdmin::AlreadyConnected, CosEventChannelAdmin::TypeError); - - void suspend_connection() - raises(ConnectionAlreadyInactive, NotConnected); - - void resume_connection() - raises(ConnectionAlreadyActive, NotConnected); - }; // StructuredProxyPullConsumer - - interface SequenceProxyPullConsumer : ProxyConsumer, CosNotifyComm::SequencePullConsumer { - void connect_sequence_pull_supplier (in CosNotifyComm::SequencePullSupplier pull_supplier) - raises(CosEventChannelAdmin::AlreadyConnected, CosEventChannelAdmin::TypeError); - - void suspend_connection() - raises(ConnectionAlreadyInactive, NotConnected); - - void resume_connection() - raises(ConnectionAlreadyActive, NotConnected); - }; // SequenceProxyPullConsumer - - interface ProxyPushSupplier : ProxySupplier, CosNotifyComm::PushSupplier, - CosEventChannelAdmin::ProxyPushSupplier, oe_CosNotificationComm::Event { - void connect_any_push_consumer (in CosEventComm::PushConsumer push_consumer) - raises(CosEventChannelAdmin::AlreadyConnected, CosEventChannelAdmin::TypeError); - - void suspend_connection() - raises(ConnectionAlreadyInactive, NotConnected); - - void resume_connection() - raises(ConnectionAlreadyActive, NotConnected); - }; // ProxyPushSupplier - - interface StructuredProxyPushSupplier : ProxySupplier, CosNotifyComm::StructuredPushSupplier, - oe_CosNotificationComm::Event { - void connect_structured_push_consumer (in CosNotifyComm::StructuredPushConsumer push_consumer) - raises(CosEventChannelAdmin::AlreadyConnected, CosEventChannelAdmin::TypeError); - - void suspend_connection() - raises(ConnectionAlreadyInactive, NotConnected); - - void resume_connection() - raises(ConnectionAlreadyActive, NotConnected); - }; // StructuredProxyPushSupplier - - interface SequenceProxyPushSupplier : ProxySupplier, CosNotifyComm::SequencePushSupplier, - oe_CosNotificationComm::Event { - void connect_sequence_push_consumer (in CosNotifyComm::SequencePushConsumer push_consumer) - raises(CosEventChannelAdmin::AlreadyConnected, CosEventChannelAdmin::TypeError); - - void suspend_connection() - raises(ConnectionAlreadyInactive, NotConnected); - - void resume_connection() - raises(ConnectionAlreadyActive, NotConnected); - }; // SequenceProxyPushSupplier - - - typedef long ProxyID; - typedef sequence ProxyIDSeq; - - enum ClientType { - ANY_EVENT, - STRUCTURED_EVENT, - SEQUENCE_EVENT}; - - enum InterFilterGroupOperator { - AND_OP, - OR_OP }; - - typedef long AdminID; - typedef sequence AdminIDSeq; - - exception AdminNotFound {}; - exception ProxyNotFound {}; - - struct AdminLimit { - CosNotification::PropertyName name; - CosNotification::PropertyValue value; - }; - - exception AdminLimitExceeded { AdminLimit admin_property_err; }; - - interface ConsumerAdmin : CosNotification::QoSAdmin, CosNotifyComm::NotifySubscribe, - CosNotifyFilter::FilterAdmin, CosEventChannelAdmin::ConsumerAdmin, - oe_CosNotificationComm::Event { - readonly attribute AdminID MyID; - readonly attribute EventChannel MyChannel; - readonly attribute InterFilterGroupOperator MyOperator; - attribute CosNotifyFilter::MappingFilter priority_filter; - attribute CosNotifyFilter::MappingFilter lifetime_filter; - readonly attribute ProxyIDSeq pull_suppliers; - readonly attribute ProxyIDSeq push_suppliers; - - ProxySupplier get_proxy_supplier (in ProxyID proxy_id) - raises (ProxyNotFound); - - ProxySupplier obtain_notification_pull_supplier (in ClientType ctype, out ProxyID proxy_id) - raises (AdminLimitExceeded); - - ProxySupplier obtain_notification_push_supplier (in ClientType ctype, out ProxyID proxy_id) - raises (AdminLimitExceeded); - - void destroy(); - }; // ConsumerAdmin - - interface SupplierAdmin : CosNotification::QoSAdmin, CosNotifyComm::NotifyPublish, - CosNotifyFilter::FilterAdmin, CosEventChannelAdmin::SupplierAdmin , - oe_CosNotificationComm::Event { - readonly attribute AdminID MyID; - readonly attribute EventChannel MyChannel; - readonly attribute InterFilterGroupOperator MyOperator; - readonly attribute ProxyIDSeq pull_consumers; - readonly attribute ProxyIDSeq push_consumers; - - ProxyConsumer get_proxy_consumer (in ProxyID proxy_id) - raises (ProxyNotFound); - - ProxyConsumer obtain_notification_pull_consumer (in ClientType ctype, out ProxyID proxy_id) - raises (AdminLimitExceeded); - - ProxyConsumer obtain_notification_push_consumer (in ClientType ctype, out ProxyID proxy_id) - raises (AdminLimitExceeded); - - void destroy(); - }; // SupplierAdmin - - interface EventChannel : CosNotification::QoSAdmin, CosNotification::AdminPropertiesAdmin, - CosEventChannelAdmin::EventChannel, - oe_CosNotificationComm::Event { - readonly attribute EventChannelFactory MyFactory; - readonly attribute ConsumerAdmin default_consumer_admin; - readonly attribute SupplierAdmin default_supplier_admin; - readonly attribute CosNotifyFilter::FilterFactory default_filter_factory; - - ConsumerAdmin new_for_consumers(in InterFilterGroupOperator op, out AdminID id); - - SupplierAdmin new_for_suppliers(in InterFilterGroupOperator op, out AdminID id); - - ConsumerAdmin get_consumeradmin (in AdminID id) - raises (AdminNotFound); - - SupplierAdmin get_supplieradmin (in AdminID id) - raises (AdminNotFound); - - AdminIDSeq get_all_consumeradmins(); - - AdminIDSeq get_all_supplieradmins(); - }; // EventChannel - - typedef long ChannelID; - typedef sequence ChannelIDSeq; - exception ChannelNotFound {}; - - interface EventChannelFactory { - EventChannel create_channel (in CosNotification::QoSProperties initial_qos, - in CosNotification::AdminProperties initial_admin, - out ChannelID id) - raises(CosNotification::UnsupportedQoS, CosNotification::UnsupportedAdmin); - - ChannelIDSeq get_all_channels(); - - EventChannel get_event_channel (in ChannelID id) - raises (ChannelNotFound); - }; // EventChannelFactory -}; // CosNotifyChannelAdmin - - -#endif /* ifndef _COS_NOTIFYCHANNELADMIN_IDL_ */ - diff --git a/lib/cosNotification/src/CosNotifyChannelAdmin_ConsumerAdmin_impl.erl b/lib/cosNotification/src/CosNotifyChannelAdmin_ConsumerAdmin_impl.erl deleted file mode 100644 index e7a6a35ea7..0000000000 --- a/lib/cosNotification/src/CosNotifyChannelAdmin_ConsumerAdmin_impl.erl +++ /dev/null @@ -1,671 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%------------------------------------------------------------------- -%% File : CosNotifyChannelAdmin_ConsumerAdmin_impl.erl -%% Purpose : -%%------------------------------------------------------------------- - --module('CosNotifyChannelAdmin_ConsumerAdmin_impl'). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% Application files --include("CosNotification.hrl"). --include("CosNotifyChannelAdmin.hrl"). --include("CosNotifyComm.hrl"). --include("CosNotifyFilter.hrl"). --include("CosNotification_Definitions.hrl"). - -%%--------------- EXPORTS ------------------------------------ -%%--------------- External ----------------------------------- -%%----- CosNotifyChannelAdmin::ConsumerAdmin ----------------- --export([get_proxy_supplier/4, - obtain_notification_pull_supplier/4, - obtain_notification_push_supplier/4, - destroy/3]). - -%%----- Inherit from CosNotification::QoSAdmin --------------- --export([get_qos/3, - set_qos/4, - validate_qos/4]). - -%%----- Inherit from CosNotifyComm::NotifySubscribe ---------- --export([subscription_change/5]). - -%%----- Inherit from CosNotifyFilter::FilterAdmin ------------ --export([add_filter/4, - remove_filter/4, - get_filter/4, - get_all_filters/3, - remove_all_filters/3]). - -%%----- Inherit from CosEventChannelAdmin::ConsumerAdmin ----- --export([obtain_push_supplier/3, - obtain_pull_supplier/3]). - -%% Attributes (external) --export(['_get_MyID'/3, - '_get_MyChannel'/3, - '_get_MyOperator'/3, - '_get_priority_filter'/3, - '_set_priority_filter'/4, - '_get_lifetime_filter'/3, - '_set_lifetime_filter'/4, - '_get_pull_suppliers'/3, - '_get_push_suppliers'/3]). - -%%--------------- Internal ----------------------------------- -%%----- Inherit from cosNotificationComm --------------------- --export([callAny/5, - callSeq/5]). - -%%--------------- gen_server specific exports ---------------- --export([handle_info/2, code_change/3]). --export([init/1, terminate/2]). - -%%--------------- LOCAL DEFINITIONS -------------------------- -%% Data structures --record(state, {myId, - myChannel, - myChannelPid, - myOperator, - myFilters = [], - mySuppliers = [], - idCounter = 0, - priorityFilter, - lifetimeFilter, - etsR, - qosGlobal, - qosLocal, - options}). - -%% Data structures constructors --define(get_InitState(_MyID, _MyCh, _MyChP, _MyOp, _PFil, _LFil, _QoS, _LQS, _O), - #state{myId = _MyID, - myChannel = _MyCh, - myChannelPid = _MyChP, - myOperator = _MyOp, - priorityFilter = _PFil, - lifetimeFilter = _LFil, - qosGlobal = _QoS, - qosLocal = _LQS, - options = _O, - etsR = ets:new(oe_ets, [set, protected])}). - -%% Data structures selectors --define(get_PushSupplierIDs(S), find_ids(S#state.mySuppliers, pusher)). --define(get_PullSupplierIDs(S), find_ids(S#state.mySuppliers, puller)). --define(get_AllSuppliers(S), S#state.mySuppliers). --define(get_AllSupplierRefs(S), find_refs(S#state.mySuppliers)). --define(get_Supplier(S, I), find_obj(lists:keysearch(I,1,S#state.mySuppliers), - supplier)). - --define(get_MyID(S), S#state.myId). --define(get_MyChannel(S), S#state.myChannel). --define(get_MyChannelPid(S), S#state.myChannelPid). --define(get_MyOperator(S), S#state.myOperator). --define(get_PrioFilter(S), S#state.priorityFilter). --define(get_LifeFilter(S), S#state.lifetimeFilter). --define(get_GlobalQoS(S), S#state.qosGlobal). --define(get_LocalQoS(S), S#state.qosLocal). --define(get_BothQoS(S), {S#state.qosGlobal, S#state.qosLocal}). --define(get_Filter(S, I), find_obj(lists:keysearch(I, 1, S#state.myFilters), - filter)). --define(get_AllFilter(S), S#state.myFilters). --define(get_AllFilterID(S), find_ids(S#state.myFilters)). --define(get_Options(S), S#state.options). --define(get_IdCounter(S), S#state.idCounter). - -%% Data structures modifiers --define(set_PrioFilter(S,D), S#state{priorityFilter=D}). --define(set_LifeFilter(S,D), S#state{lifetimeFilter=D}). --define(set_LocalQoS(S,D), S#state{qosLocal=D}). --define(set_GlobalQoS(S,D), S#state{qosGlobal=D}). --define(set_BothQoS(S,GD,LD), S#state{qosGlobal=GD, qosLocal=LD}). --define(add_PushSupplier(S,I,R,P),S#state{mySuppliers=[{I,R,P,pusher}|S#state.mySuppliers]}). --define(add_PullSupplier(S,I,R,P),S#state{mySuppliers=[{I,R,P,puller}|S#state.mySuppliers]}). --define(del_Supplier(S,I), S#state{mySuppliers= - lists:keydelete(I, 1, - S#state.mySuppliers)}). --define(del_SupplierRef(S,O), S#state{mySuppliers= - lists:keydelete(O, 2, - S#state.mySuppliers)}). --define(del_SupplierPid(S,P), S#state{mySuppliers= - lists:keydelete(P, 3, - S#state.mySuppliers)}). --define(add_Filter(S,I,O), S#state{myFilters=[{I,O}|S#state.myFilters]}). --define(del_Filter(S,I), S#state{myFilters= - delete_filter(lists:keydelete(I, 1, - S#state.myFilters), - S#state.myFilters)}). --define(del_AllFilter(S), S#state{myFilters=[]}). --define(set_IdCounter(S,V), S#state{idCounter=V}). --define(new_Id(S), 'CosNotification_Common':create_id( - S#state.idCounter)). - -%% MISC --define(is_PersistentConnection(S), - ?not_GetConnectionReliability((S#state.qosLocal)) == ?not_Persistent). --define(is_PersistentEvent(S), - ?not_GetEventReliability((S#state.qosLocal)) == ?not_Persistent). --define(is_ANDOP(S), S#state.myOperator == 'AND_OP'). - -%%----------------------------------------------------------% -%% function : handle_info, code_change -%% Arguments: -%% Returns : -%% Effect : Functions demanded by the gen_server module. -%%----------------------------------------------------------- - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -handle_info(Info, State) -> - case Info of - {'EXIT', Pid, Reason} when ?get_MyChannelPid(State) == Pid -> - ?DBG("PARENT CHANNEL: ~p TERMINATED.~n",[Reason]), - {stop, Reason, State}; - {'EXIT', Pid, normal} -> - {noreply, ?del_SupplierPid(State, Pid)}; - _Other -> - {noreply, State} - end. - -%%----------------------------------------------------------% -%% function : init, terminate -%% Arguments: -%%----------------------------------------------------------- - -init([MyId, MyChannel, MyChannelPid, MyOperator, InitQoS, LQS, Options]) -> - process_flag(trap_exit, true), - PriorityFilter = corba:create_nil_objref(), - LifeTimeFilter = corba:create_nil_objref(), - {ok, ?get_InitState(MyId, MyChannel, MyChannelPid, MyOperator, - PriorityFilter, LifeTimeFilter, InitQoS, LQS, Options)}. - -terminate(_Reason, _State) -> - ok. - -%%----------------------------------------------------------- -%%----- CosNotifyChannelAdmin_ConsumerAdmin attributes ------ -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% Attribute: '_get_MyID' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_MyID'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_MyID(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_MyChannel' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_MyChannel'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_MyChannel(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_MyOperator' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_MyOperator'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_MyOperator(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_priority_filter' -%% Type : read and write -%% Returns : -%%----------------------------------------------------------- -'_get_priority_filter'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_PrioFilter(State), State}. - -'_set_priority_filter'(_OE_THIS, _OE_FROM, State, PrioFilter) -> - {reply, ok, ?set_PrioFilter(State, PrioFilter)}. - -%%----------------------------------------------------------% -%% Attribute: '_get_lifetime_filter' -%% Type : read and write -%% Returns : -%%----------------------------------------------------------- -'_get_lifetime_filter'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_LifeFilter(State), State}. -'_set_lifetime_filter'(_OE_THIS, _OE_FROM, State, LifeFilter) -> - {reply, ok, ?set_LifeFilter(State, LifeFilter)}. - -%%----------------------------------------------------------% -%% Attribute: '_get_pull_suppliers' -%% Type : readonly -%% Returns : ProxyIDSeq -%%----------------------------------------------------------- -'_get_pull_suppliers'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_PullSupplierIDs(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_push_suppliers' -%% Type : readonly -%% Returns : ProxyIDSeq -%%----------------------------------------------------------- -'_get_push_suppliers'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_PushSupplierIDs(State), State}. - -%%----------------------------------------------------------- -%%------- Exported external functions ----------------------- -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% function : get_proxy_supplier -%% Arguments: ProxyID - unique identifier (long) -%% Returns : ObjRef | {'EXCEPTION', #'ProxyNotFound'{}} -%%----------------------------------------------------------- -get_proxy_supplier(_OE_THIS, _OE_FROM, State, Proxy_id) -> - {reply, ?get_Supplier(State, Proxy_id), State}. - -%%----------------------------------------------------------% -%% function : obtain_notification_pull_supplier -%% Arguments: Ctype - 'ANY_EVENT' | 'STRUCTURED_EVENT' | 'SEQUENCE_EVENT' -%% Returns : A Proxy of the requested type. -%%----------------------------------------------------------- -obtain_notification_pull_supplier(OE_THIS, _OE_FROM, State, Ctype) -> - %% Choose which module to use. - {Mod, Type} = - case Ctype of - 'ANY_EVENT' -> - {'CosNotifyChannelAdmin_ProxyPullSupplier', 'PULL_ANY'}; - 'STRUCTURED_EVENT' -> - {'CosNotifyChannelAdmin_StructuredProxyPullSupplier', 'PULL_STRUCTURED'}; - 'SEQUENCE_EVENT' -> - {'CosNotifyChannelAdmin_SequenceProxyPullSupplier', 'PULL_SEQUENCE'}; - _ -> - orber:dbg("[~p] CosNotifyChannelAdmin_ConsumerAdmin:" - "obtain_notification_pull_supplier(~p);~n" - "Incorrect enumerant", - [?LINE, Ctype], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end, - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case Mod:oe_create_link([Type, OE_THIS, self(), ?get_GlobalQoS(State), - ?get_LocalQoS(State), ?get_MyChannel(State), - ?get_Options(State), ?get_MyOperator(State)], - [{sup_child, true}|SO]) of - {ok, Pid, PrRef} -> - ProxyID = ?new_Id(State), - NewState = ?add_PullSupplier(State, ProxyID, PrRef, Pid), - {reply, {PrRef, ProxyID}, ?set_IdCounter(NewState, ProxyID)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_ConsumerAdmin:" - "obtain_notification_pull_supplier();~n" - "Unable to create: ~p/~p~n" - "Reason: ~p", [?LINE, Mod, Type, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%----------------------------------------------------------% -%% function : obtain_notification_push_supplier -%% Arguments: Ctype - 'ANY_EVENT' | 'STRUCTURED_EVENT' | 'SEQUENCE_EVENT' -%% Returns : A Proxy of the requested type. -%%----------------------------------------------------------- -obtain_notification_push_supplier(OE_THIS, _OE_FROM, State, Ctype) -> - %% Choose which module to use. - {Mod, Type} = - case Ctype of - 'ANY_EVENT' -> - {'CosNotifyChannelAdmin_ProxyPushSupplier', 'PUSH_ANY'}; - 'STRUCTURED_EVENT' -> - {'CosNotifyChannelAdmin_StructuredProxyPushSupplier', 'PUSH_STRUCTURED'}; - 'SEQUENCE_EVENT' -> - {'CosNotifyChannelAdmin_SequenceProxyPushSupplier', 'PUSH_SEQUENCE'}; - _ -> - orber:dbg("[~p] CosNotifyChannelAdmin_ConsumerAdmin:" - "obtain_notification_push_supplier(~p);~n" - "Incorrect enumerant", [?LINE, Ctype], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end, - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case Mod:oe_create_link([Type, OE_THIS, self(), ?get_GlobalQoS(State), - ?get_LocalQoS(State), ?get_MyChannel(State), - ?get_Options(State), ?get_MyOperator(State)], - [{sup_child, true}|SO]) of - {ok, Pid, PrRef} -> - ProxyID = ?new_Id(State), - NewState = ?add_PushSupplier(State, ProxyID, PrRef, Pid), - {reply, {PrRef, ProxyID}, ?set_IdCounter(NewState, ProxyID)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_ConsumerAdmin:obtain_notification_push_supplier();~n" - "Unable to create: ~p/~p~n" - "Reason: ~p", - [?LINE, Mod, Type, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - - -%%----------------------------------------------------------% -%% function : destroy -%% Arguments: - -%% Returns : ok -%%------------------------------------------------------------ -destroy(_OE_THIS, _OE_FROM, State) -> - {stop, normal, ok, State}. - -%%----- Inherit from CosNotification::QoSAdmin -------------- -%%----------------------------------------------------------% -%% function : get_qos -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -get_qos(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_GlobalQoS(State), State}. - -%%----------------------------------------------------------% -%% function : set_qos -%% Arguments: QoS - CosNotification::QoSProperties, i.e., -%% [#'Property'{name, value}, ...] where name eq. string() -%% and value eq. any(). -%% Returns : ok | {'EXCEPTION', CosNotification::UnsupportedQoS} -%%----------------------------------------------------------- -set_qos(_OE_THIS, _OE_FROM, State, QoS) -> - {NewQoS, LQS} = 'CosNotification_Common':set_qos(QoS, ?get_BothQoS(State), - admin, ?get_MyChannel(State), - ?get_AllSupplierRefs(State)), - {reply, ok, ?set_BothQoS(State, NewQoS, LQS)}. - -%%----------------------------------------------------------% -%% function : validate_qos -%% Arguments: Required_qos - CosNotification::QoSProperties -%% [#'Property'{name, value}, ...] where name eq. string() -%% and value eq. any(). -%% Returns : {'EXCEPTION', CosNotification::UnsupportedQoS} -%%----------------------------------------------------------- -validate_qos(_OE_THIS, _OE_FROM, State, Required_qos) -> - QoS = 'CosNotification_Common':validate_qos(Required_qos, ?get_BothQoS(State), - admin, ?get_MyChannel(State), - ?get_AllSupplierRefs(State)), - {reply, {ok, QoS}, State}. - -%%----- Inherit from CosNotifyComm::NotifySubscribe --------- -%%----------------------------------------------------------* -%% function : subscription_change -%% Arguments: -%% Returns : ok | -%% {'EXCEPTION', #'CosNotifyComm_InvalidEventType'{type}} -%%----------------------------------------------------------- -subscription_change(_OE_THIS, _OE_FROM, State, _Added, _Removed) -> - ?DBG("CALLBACK INFORMED: ~p ~p~n",[_Added, _Removed]), - {reply, ok, State}. - -%%----- Inherit from CosNotifyFilter::FilterAdmin ----------- -%%----------------------------------------------------------% -%% function : add_filter -%% Arguments: Filter - CosNotifyFilter::Filter -%% Returns : FilterID - long -%%----------------------------------------------------------- -add_filter(_OE_THIS, _OE_FROM, State, Filter) -> - 'CosNotification_Common':type_check(Filter, 'CosNotifyFilter_Filter'), - FilterID = ?new_Id(State), - NewState = ?set_IdCounter(State, FilterID), - {reply, FilterID, ?add_Filter(NewState, FilterID, Filter)}. - -%%----------------------------------------------------------% -%% function : remove_filter -%% Arguments: FilterID - long -%% Returns : ok -%%----------------------------------------------------------- -remove_filter(_OE_THIS, _OE_FROM, State, FilterID) when is_integer(FilterID) -> - {reply, ok, ?del_Filter(State, FilterID)}; -remove_filter(_,_,_,_) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : get_filter -%% Arguments: FilterID - long -%% Returns : Filter - CosNotifyFilter::Filter | -%% {'EXCEPTION', #'CosNotifyFilter_FilterNotFound'{}} -%%----------------------------------------------------------- -get_filter(_OE_THIS, _OE_FROM, State, FilterID) when is_integer(FilterID) -> - {reply, ?get_Filter(State, FilterID), State}; -get_filter(_,_,_,_) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : get_all_filters -%% Arguments: - -%% Returns : Filter - CosNotifyFilter::FilterIDSeq -%%----------------------------------------------------------- -get_all_filters(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_AllFilterID(State), State}. - -%%----------------------------------------------------------% -%% function : remove_all_filters -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -remove_all_filters(_OE_THIS, _OE_FROM, State) -> - {reply, ok, ?del_AllFilter(State)}. - -%%----- Inherit from CosEventChannelAdmin::ConsumerAdmin ---- -%%----------------------------------------------------------% -%% function : obtain_push_supplier -%% Arguments: - -%% Returns : ProxyPushSupplier -%%----------------------------------------------------------- -obtain_push_supplier(OE_THIS, _OE_FROM, State) -> - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_create_link(['PUSH_ANY', OE_THIS, - self(), - ?get_GlobalQoS(State), - ?get_LocalQoS(State), - ?get_MyChannel(State), - ?get_Options(State), - ?get_MyOperator(State)], - [{sup_child, true}|SO]) of - {ok, Pid, PrRef} -> - ProxyID = ?new_Id(State), - NewState = ?add_PushSupplier(State, ProxyID, PrRef, Pid), - {reply, PrRef, ?set_IdCounter(NewState, ProxyID)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_ConsumerAdmin:obtain_push_supplier();~n" - "Unable to create: CosNotifyChannelAdmin_ProxyPushSupplier~n" - "Reason: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%----------------------------------------------------------% -%% function : obtain_pull_supplier -%% Arguments: - -%% Returns : ProxyPullSupplier -%%----------------------------------------------------------- -obtain_pull_supplier(OE_THIS, _OE_FROM, State) -> - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_create_link(['PULL_ANY', OE_THIS, - self(), - ?get_GlobalQoS(State), - ?get_LocalQoS(State), - ?get_MyChannel(State), - ?get_Options(State), - ?get_MyOperator(State)], - [{sup_child, true}|SO]) of - {ok, Pid, PrRef} -> - ProxyID = ?new_Id(State), - NewState = ?add_PullSupplier(State, ProxyID, PrRef, Pid), - {reply, PrRef, ?set_IdCounter(NewState, ProxyID)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_ConsumerAdmin:obtain_pull_supplier();~n" - "Unable to create: CosNotifyChannelAdmin_ProxyPullSupplier~n" - "Reason: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%--------------- LOCAL FUNCTIONS ---------------------------- -%% To match suppliers -find_obj({value, {_,Obj,_,_}},_) -> Obj; -%% To match filters -find_obj({value, {_,Obj}},_) -> Obj; -find_obj(_, supplier) -> {'EXCEPTION', #'CosNotifyChannelAdmin_ProxyNotFound'{}}; -find_obj(_, filter) -> {'EXCEPTION', #'CosNotifyFilter_FilterNotFound'{}}. - -find_ids(List) -> - find_ids(List, [], false). -find_ids(List, Type) -> - find_ids(List, [], Type). - -find_ids([], Acc, _) -> - Acc; -find_ids([{I,_}|T], Acc, Type) -> - find_ids(T, [I|Acc], Type); -find_ids([{I,_,_,Type}|T], Acc, Type) -> - find_ids(T, [I|Acc], Type); -find_ids([{_I,_,_,_}|T], Acc, Type) -> - find_ids(T, Acc, Type); -find_ids(What, _, _) -> - orber:dbg("[~p] CosNotifyChannelAdmin_ConsumerAdmin:find_ids();~n" - "Id corrupt: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}). - -find_refs(List) -> - find_refs(List, []). - -find_refs([], Acc) -> - Acc; -find_refs([{_,R,_,_}|T], Acc) -> - find_refs(T, [R|Acc]); -find_refs(What, _) -> - orber:dbg("[~p] CosNotifyChannelAdmin_ConsumerAdmin:find_refs();~n" - "Reference corrupt: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}). - -%% Delete a single filter. -%% The list do not differ, i.e., no filter removed, raise exception. -delete_filter(List,List) -> corba:raise(#'CosNotifyFilter_FilterNotFound'{}); -delete_filter(List, _) -> List. - - -%%----------------------------------------------------------- -%% function : callSeq -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -callSeq(_OE_THIS, OE_FROM, State, Events, _Status) -> - corba:reply(OE_FROM, ok), - case cosNotification_eventDB:filter_events(Events, ?get_AllFilter(State)) of - {[], _} when ?is_ANDOP(State) -> - %% Since AND it doesn't matter what the proxies 'think'. Done. - {noreply, State}; - {[], Failed} -> - %% Is OR but the Proxy may allow the events; pass on. - forward(seq, State, Failed, 'MATCH'); - {Passed, _} when ?is_ANDOP(State) -> - %% Since AND we only forward those who passed this objects filters. - forward(seq, State, Passed, 'MATCH'); - {Passed, []} -> - %% Since OR we forward and tell the proxy to do no filtering. - forward(seq, State, Passed, 'MATCHED'); - {Passed, Failed} -> - %% Since OR we forward both and instruct the proxy to check only - %% the ones that failed. - forward(seq, State, Passed, 'MATCHED'), - forward(seq, State, Failed, 'MATCH') - end. - - -%%----------------------------------------------------------- -%% function : callAny -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -callAny(_OE_THIS, OE_FROM, State, Event, _Status) -> - corba:reply(OE_FROM, ok), - case cosNotification_eventDB:filter_events([Event], ?get_AllFilter(State)) of - {[], _} when ?is_ANDOP(State) -> - %% Since AND it doesn't matter what the proxies 'think'. Done. - {noreply, State}; - {[], [Failed]} -> - %% Is OR but the Proxy may allow the event; pass on. - forward(any, State, Failed, 'MATCH'); - {[Passed], _} when ?is_ANDOP(State) -> - %% Since AND we only forward those who passed this objects filters. - forward(any, State, Passed, 'MATCH'); - {[Passed], _} -> - %% Since OR we forward and instruct the proxy to do no checks. - forward(any, State, Passed, 'MATCHED') - end. - - - -%% Forward events -forward(Type, State, Event, Status) -> - forward(Type, ?get_AllSuppliers(State), State, Event, Status). -forward(_, [], State, _, _) -> - {noreply, State}; -forward(any, [{_,H,_,_}|T], State, Event, Status) -> - case catch oe_CosNotificationComm_Event:callAny(H, Event, Status) of - ok -> - ?DBG("CONSUMERADM FORWARD ANY: ~p~n",[Event]), - forward(any, T, State, Event, Status); - {'EXCEPTION', E} when is_record(E, 'OBJECT_NOT_EXIST') -> - orber:dbg("[~p] CosNotifyChannelAdmin_ConsumerAdmin:forward();~n" - "Proxy no longer exists; dropping it: ~p", - [?LINE, H], ?DEBUG_LEVEL), - NewState = ?del_SupplierRef(State,H), - forward(any, T, NewState, Event, Status); - R when ?is_PersistentConnection(State) -> - orber:dbg("[~p] CosNotifyChannelAdmin_ConsumerAdmin:forward();~n" - "Proxy behaves badly: ~p/~p", - [?LINE, R, H], ?DEBUG_LEVEL), - forward(any, T, State, Event, Status); - R -> - orber:dbg("[~p] CosNotifyChannelAdmin_ConsumerAdmin:forward();~n" - "Proxy behaves badly: ~p~n" - "Dropping it: ~p", [?LINE, R, H], ?DEBUG_LEVEL), - NewState = ?del_SupplierRef(State, H), - forward(any, T, NewState, Event, Status) - end; -forward(seq, [{_,H,_,_}|T], State, Event, Status) -> - case catch oe_CosNotificationComm_Event:callSeq(H, Event, Status) of - ok -> - ?DBG("CONSUMERADM FORWARD SEQUENCE: ~p~n",[Event]), - forward(seq, T, State, Event, Status); - {'EXCEPTION', E} when is_record(E, 'OBJECT_NOT_EXIST') -> - orber:dbg("[~p] CosNotifyChannelAdmin_ConsumerAdmin:forward();~n" - "Proxy no longer exists; dropping it: ~p", - [?LINE, H], ?DEBUG_LEVEL), - NewState = ?del_SupplierRef(State,H), - forward(seq, T, NewState, Event, Status); - R when ?is_PersistentConnection(State) -> - orber:dbg("[~p] CosNotifyChannelAdmin_ConsumerAdmin:forward();~n" - "Proxy behaves badly: ~p/~p", [?LINE, R, H], ?DEBUG_LEVEL), - forward(seq, T, State, Event, Status); - R -> - orber:dbg("[~p] CosNotifyChannelAdmin_ConsumerAdmin:forward();~n" - "Proxy behaves badly: ~p~n" - "Dropping it: ~p", [?LINE, R, H], ?DEBUG_LEVEL), - NewState = ?del_SupplierRef(State, H), - forward(seq, T, NewState, Event, Status) - end. - - -%%--------------- MISC FUNCTIONS, E.G. DEBUGGING ------------- -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosNotification/src/CosNotifyChannelAdmin_EventChannelFactory_impl.erl b/lib/cosNotification/src/CosNotifyChannelAdmin_EventChannelFactory_impl.erl deleted file mode 100644 index eb3fb4a6a3..0000000000 --- a/lib/cosNotification/src/CosNotifyChannelAdmin_EventChannelFactory_impl.erl +++ /dev/null @@ -1,143 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%------------------------------------------------------------------- -%% File : CosNotifyChannelAdmin_EventChannelFactory_impl.erl -%% Purpose : -%%------------------------------------------------------------------- - --module('CosNotifyChannelAdmin_EventChannelFactory_impl'). - -%%--------------- INCLUDES ----------------------------------- -%% Application files --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% Application files --include("CosNotification.hrl"). --include("CosNotifyChannelAdmin.hrl"). --include("CosNotifyComm.hrl"). --include("CosNotifyFilter.hrl"). --include("CosNotification_Definitions.hrl"). - -%%--------------- IMPORTS ------------------------------------ - -%%--------------- EXPORTS ------------------------------------ -%% External --export([create_channel/5, - get_all_channels/3, - get_event_channel/4]). - -%%--------------- gen_server specific exports ---------------- --export([handle_info/2, code_change/3]). --export([init/1, terminate/2]). - -%%--------------- LOCAL DEFINITIONS -------------------------- -%% Data structures --record(state, {adminProp, - idCounter = 0, - options, - etsR, - server_options}). - -%%-----------------------------------------------------------% -%% function : handle_info, code_change -%% Arguments: See gen_server documentation. -%% Effect : Functions demanded by the gen_server module. -%%------------------------------------------------------------ - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -handle_info(Info, State) -> - ?debug_print("INFO: ~p~n", [Info]), - case Info of - {'EXIT', Pid, normal} -> - ets:match_delete(State#state.etsR, {'_','_',Pid}), - {noreply, State}; - _Other -> - ?debug_print("TERMINATED: ~p~n",[_Other]), - {noreply, State} - end. - -%%----------------------------------------------------------% -%% function : init, terminate -%% Arguments: -%%----------------------------------------------------------- - -init(Options) -> - process_flag(trap_exit, true), - SO = 'CosNotification_Common':get_option(server_options, Options, ?not_DEFAULT_SETTINGS), - {ok, #state{options = Options, - etsR = ets:new(oe_ets, [set, protected]), - server_options = SO}}. - -terminate(_Reason, _State) -> - ok. - -%%----------------------------------------------------------- -%%------- Exported external functions ----------------------- -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% function : create_channel -%% Arguments: InitQoS -%% InitAdmin -%% Returns : Ch - Channel obj ref -%% Id - Channel Id (out-type) -%%----------------------------------------------------------- -create_channel(OE_THIS, _OE_FROM, State, InitQoS, InitAdmin) -> - {QoS, LQoS} = 'CosNotification_Common':init_qos(InitQoS), - {IAdm, LAdm} = 'CosNotification_Common':init_adm(InitAdmin), - Id = 'CosNotification_Common':create_id(State#state.idCounter), - case 'CosNotifyChannelAdmin_EventChannel':oe_create_link([OE_THIS, QoS, IAdm, - LQoS, LAdm, - State#state.options], - [{sup_child, true}|State#state.server_options]) of - {ok, Pid, Ch} -> - ets:insert(State#state.etsR, {Id,Ch,Pid}), - {reply, {Ch, Id}, State#state{idCounter=Id}}; - _ -> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%----------------------------------------------------------% -%% function : get_all_channels -%% Arguments: - -%% Returns : ChannelIDSeq - List of alive channels created -%% by this factory. -%%----------------------------------------------------------- -get_all_channels(_OE_THIS, _OE_FROM, State) -> - {reply, lists:flatten(ets:match(State#state.etsR, {'$1','_','_'})), State}. - -%%----------------------------------------------------------% -%% function : get_event_channel -%% Arguments: ChannelId -%% Returns : ChannelRef | 'CosNotifyChannelAdmin_ChannelNotFound' -%%----------------------------------------------------------- -get_event_channel(_OE_THIS, _OE_FROM, State, Id) -> - {reply, find_obj(ets:lookup(State#state.etsR, Id)), State}. - -%%--------------- LOCAL FUNCTIONS ---------------------------- -find_obj([]) -> {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}; -find_obj([{_, Obj,_}]) -> Obj; -find_obj(_) -> {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}. - -%%--------------- MISC FUNCTIONS, E.G. DEBUGGING ------------- -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosNotification/src/CosNotifyChannelAdmin_EventChannel_impl.erl b/lib/cosNotification/src/CosNotifyChannelAdmin_EventChannel_impl.erl deleted file mode 100644 index 485c9aeef4..0000000000 --- a/lib/cosNotification/src/CosNotifyChannelAdmin_EventChannel_impl.erl +++ /dev/null @@ -1,722 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%------------------------------------------------------------------- -%% File : CosNotifyChannelAdmin_EventChannel_impl.erl -%% Purpose : -%% Created : 28 Sep 1999 -%%------------------------------------------------------------------- - --module('CosNotifyChannelAdmin_EventChannel_impl'). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% Application files --include("CosNotification.hrl"). --include("CosNotifyChannelAdmin.hrl"). --include("CosNotifyComm.hrl"). --include("CosNotifyFilter.hrl"). --include("CosNotification_Definitions.hrl"). - -%%--------------- EXPORTS ------------------------------------ -%%--------------- External ----------------------------------- -%%----- CosNotifyChannelAdmin::EventChannel ------------------ --export([new_for_consumers/4, - new_for_suppliers/4, - get_consumeradmin/4, - get_supplieradmin/4, - get_all_consumeradmins/3, - get_all_supplieradmins/3]). - -%% Attributes (external) --export(['_get_MyFactory'/3, - '_get_default_consumer_admin'/3, - '_get_default_supplier_admin'/3, - '_get_default_filter_factory'/3]). - -%%----- Inherit from CosNotification::QoSAdmin --------------- --export([get_qos/3, - set_qos/4, - validate_qos/4]). - -%%----- Inherit from CosNotification::AdminPropertiesAdmin --- --export([get_admin/3, - set_admin/4]). - -%%----- Inherit from CosEventChannelAdmin::EventChannel ------ --export([for_consumers/3, - for_suppliers/3, - destroy/3]). -%%--------------- Internal ----------------------------------- -%%----- Inherit from cosNotificationComm --------------------- --export([callAny/5, - callSeq/5]). - -%%--------------- gen_server specific exports ---------------- --export([handle_info/2, code_change/3]). --export([init/1, terminate/2]). - -%% Data structures --record(state, {myFac, - myConsumers = [], - defConsumerAdmin, - defSupplierAdmin, - defConsumerAdminPid, - defSupplierAdminPid, - defFilterFac, - defFilterFacPid, - etsR, - qosLocal, - qosGlobal, - admGlobal, - options, - idCounter = 0, - 'MaxQueueLength', - 'MaxConsumers', - 'MaxSuppliers'}). -%% Data structures constructors --define(get_InitState(My, Fil, FilPid, QoS, LQoS, GA, MQ, MC, MS, O), - #state{myFac = My, - defFilterFac = Fil, - defFilterFacPid = FilPid, - etsR = ets:new(oe_ets, [set, protected]), - qosLocal = LQoS, - qosGlobal = QoS, - admGlobal = GA, - options = O, - 'MaxQueueLength' = MQ, - 'MaxConsumers' = MC, - 'MaxSuppliers' = MS}). - -%% NOTE!!! -%% When forwarding events, the objects we will contact is ONLY ConsumerAdmins!! -%% Hence, we will store SupplierAdmins and ConsumerAdmins differently. SupplierAdmins -%% we store in our ets-table while the ConsumerAdmins will be stored on the local -%% State. - -%% Data structures selectors --define(get_supplierAdmins(S), [S#state.defSupplierAdmin| - lists:flatten(ets:match(S#state.etsR, - {'_','$1','_'}))]). --define(get_consumerAdmins(S), [{0, S#state.defConsumerAdmin,S#state.defConsumerAdminPid} - |S#state.myConsumers]). --define(get_allAdmins(S), [S#state.defSupplierAdmin, - S#state.defConsumerAdmin| - lists:flatten(ets:match(S#state.etsR, - {'_','$1','_'}))++ - find_field(S#state.myConsumers, 2)]). --define(get_consumerAdmIDs(S), [0|find_field(S#state.myConsumers, 1)]). --define(get_supplierAdmIDs(S), [0|lists:flatten(ets:match(S#state.etsR, - {'$1','_','_'}))]). - --define(get_supplierAdmin(S, I), find_obj(ets:lookup(S#state.etsR, I))). --define(get_consumerAdmin(S, I), find_obj(lists:keysearch(I,1,S#state.myConsumers))). --define(get_supplierAmount(S), ets:info(S#state.etsR, size)). --define(get_consumerAmount(S), length(S#state.myConsumers)). - --define(get_MyFactory(S), S#state.myFac). --define(get_defConsumerAdm(S), S#state.defConsumerAdmin). --define(get_defSupplierAdm(S), S#state.defSupplierAdmin). --define(get_defConsumerAdmPid(S), S#state.defConsumerAdminPid). --define(get_defSupplierAdmPid(S), S#state.defSupplierAdminPid). --define(get_defFilterFac(S), S#state.defFilterFac). --define(get_defFilterFacPid(S), S#state.defFilterFacPid). --define(get_GlobalQoS(S), S#state.qosGlobal). --define(get_LocalQoS(S), S#state.qosLocal). --define(get_BothQoS(S), {S#state.qosGlobal, S#state.qosLocal}). --define(get_GlobalAdm(S), S#state.admGlobal). --define(get_Options(S), S#state.options). --define(get_MaxQueueLength(S), S#state.'MaxQueueLength'). --define(get_MaxConsumers(S), S#state.'MaxConsumers'). --define(get_MaxSuppliers(S), S#state.'MaxSuppliers'). --define(get_IdCounter(S), S#state.idCounter). - -%% Data structures modifiers --define(set_GlobalQoS(S,D), S#state{qosGlobal=D}). --define(set_BothQoS(S,GD,LD), S#state{qosGlobal=GD, qosLocal=LD}). --define(set_GlobalAdm(S,D), S#state{admGlobal=D}). --define(set_AllAdminP(S,GD, MQ, MC, MS), - S#state{admGlobal=GD,'MaxQueueLength'=MQ, - 'MaxConsumers'=MC, 'MaxSuppliers'=MS}). --define(set_MaxQueueLength(S,D), S#state{'MaxQueueLength'=D}). --define(set_MaxConsumers(S,D), S#state{'MaxConsumers'=D}). --define(set_MaxSuppliers(S,D), S#state{'MaxSuppliers'=D}). --define(set_defConsumerAdm(S,D,P), S#state{defConsumerAdmin=D, defConsumerAdminPid=P}). --define(set_defSupplierAdm(S,D,P), S#state{defSupplierAdmin=D, defSupplierAdminPid=P}). --define(set_defFilterFac(S,D,P), S#state{defFilterFac=D, defFilterFacPid=P}). --define(add_supplierAdmin(S,I,O,P), ets:insert(S#state.etsR, {I,O,P})). --define(add_consumerAdmin(S,I,O,P), S#state{myConsumers= [{I,O,P}|S#state.myConsumers]}). --define(del_supplierAdmin(S,I), ets:delete(S#state.etsR, I)). --define(del_consumerAdmin(S,I), S#state{myConsumers= - lists:keydelete(I, 1, - S#state.myConsumers)}). --define(del_consumerAdminRef(S,O), S#state{myConsumers= - lists:keydelete(O, 2, - S#state.myConsumers)}). --define(del_AdminPid(S,P), delete_obj(S, P)). --define(set_IdCounter(S,V), S#state{idCounter=V}). --define(new_Id(S), 'CosNotification_Common':create_id(S#state.idCounter)). -%% MISC --define(is_UndefDefConsAdm(S), S#state.defConsumerAdmin == undefined). --define(is_UndefDefSuppAdm(S), S#state.defSupplierAdmin == undefined). --define(is_UndefDefFilterFac(S), S#state.defFilterFac == undefined). --define(is_PersistentConnection(S), - ?not_GetConnectionReliability((S#state.qosLocal)) == ?not_Persistent). --define(is_PersistentEvent(S), - ?not_GetEventReliability((S#state.qosLocal)) == ?not_Persistent). - -%%-----------------------------------------------------------% -%% function : handle_info, code_change -%% Arguments: -%% Returns : -%% Effect : Functions demanded by the gen_server module. -%%------------------------------------------------------------ - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -handle_info(Info, State) -> - ?DBG("INFO: ~p~n", [Info]), - case Info of - {'EXIT', Pid, _Reason} when ?get_defConsumerAdmPid(State) == Pid -> - {noreply, ?set_defConsumerAdm(State, undefined, undefined)}; - {'EXIT', Pid, _Reason} when ?get_defSupplierAdmPid(State) == Pid -> - {noreply, ?set_defSupplierAdm(State, undefined, undefined)}; - {'EXIT', Pid, _Reason} when ?get_defFilterFacPid(State) == Pid -> - {noreply, ?set_defFilterFac(State, undefined, undefined)}; - {'EXIT', Pid, normal} -> - {noreply, ?del_AdminPid(State, Pid)}; - _Other -> - ?DBG("TERMINATED: ~p~n",[_Other]), - {noreply, State} - end. - -%%----------------------------------------------------------% -%% function : init, terminate -%% Arguments: -%%----------------------------------------------------------- - -init([MyFac, InitQoS, InitAdmin, LocalQoS, [MaxQ, MaxC, MaxS|_], Options]) -> - process_flag(trap_exit, true), - SO = 'CosNotification_Common':get_option(server_options, Options, - ?not_DEFAULT_SETTINGS), - - ?DBG("CHANNEL INIT STATE:~n~p~n~p~n~p ~p ~p ~p~n~p~n", - [InitQoS, InitAdmin, LocalQoS,MaxQ, MaxC, MaxS, Options]), - - %% Both default Admin:s have the unique id 0 (OMG spec, 98-11-01, - %% Notification p 148), hence, no need to create a unique id. - %% We don't have acces to OE_THIS in this stage so we cannot create the objects - %% now, even though the specification states that. - %% DefConAdm = 'CosNotifyChannelAdmin_ConsumerAdmin':oe_create_link([0],[]), - %% DefSupAdm = 'CosNotifyChannelAdmin_SupplierAdmin':oe_create_link([0],[]), - - case 'CosNotifyFilter_FilterFactory':oe_create_link([], [{sup_child, true}|SO]) of - {ok, Pid, DefFiFac} -> - {ok, ?get_InitState(MyFac, DefFiFac, Pid, InitQoS, LocalQoS, - InitAdmin, MaxQ, MaxC, MaxS, Options)}; - Reason -> - {stop, Reason} - end. - -terminate(_Reason, _State) -> - ok. - -%%----------------------------------------------------------- -%%----- CosNotifyChannelAdmin_EventChannel attributes ------- -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% Attribute: '_get_MyFactory' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_MyFactory'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_MyFactory(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_default_consumer_admin' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_default_consumer_admin'(OE_THIS, _OE_FROM, State) - when ?is_UndefDefConsAdm(State) -> - Op = 'CosNotification_Common':get_option(filterOp, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case catch 'CosNotifyChannelAdmin_ConsumerAdmin':oe_create_link([0, OE_THIS, - self(), Op, - ?get_GlobalQoS(State), - ?get_LocalQoS(State), - ?get_Options(State)], - [{sup_child, true}|SO]) of - {ok, Pid, DefConAdm} -> - {reply, DefConAdm, ?set_defConsumerAdm(State, DefConAdm, Pid)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:_get_default_consumer_admin();~n" - "Unable to create: CosNotifyChannelAdmin_ConsumerAdmin.~n" - "Reason: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end; -'_get_default_consumer_admin'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_defConsumerAdm(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_default_supplier_admin' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_default_supplier_admin'(OE_THIS, _OE_FROM, State) - when ?is_UndefDefSuppAdm(State) -> - Op = 'CosNotification_Common':get_option(filterOp, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case catch 'CosNotifyChannelAdmin_SupplierAdmin':oe_create_link([0, OE_THIS, - self(), Op, - ?get_GlobalQoS(State), - ?get_LocalQoS(State), - ?get_Options(State)], - [{sup_child, true}|SO]) of - {ok, Pid, DefSupAdm} -> - {reply, DefSupAdm, ?set_defSupplierAdm(State, DefSupAdm, Pid)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:_get_default_supplier_admin();~n" - "Unable to create: CosNotifyChannelAdmin_SupplierAdmin.~n" - "Reason: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end; -'_get_default_supplier_admin'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_defSupplierAdm(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_default_filter_factory' -%% Type : readonly -%% Returns : -%%---------------------------------------------------------- -'_get_default_filter_factory'(_OE_THIS, _OE_FROM, State) - when ?is_UndefDefFilterFac(State) -> - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case catch 'CosNotifyFilter_FilterFactory':oe_create_link([], [{sup_child, true}|SO]) of - {ok, Pid, DefFiFac} -> - {reply, DefFiFac, ?set_defFilterFac(State, DefFiFac, Pid)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:_get_default_filter_factory();~n" - "Unable to create: CosNotifyChannelAdmin_FilterFactory.~n" - "Reason: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end; -'_get_default_filter_factory'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_defFilterFac(State), State}. - -%%----------------------------------------------------------- -%%------- Exported external functions ----------------------- -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% function : new_for_consumers -%% Arguments: Op - InterFilterGroupOperator: 'AND_OP' | 'OR_OP' -%% Determines if the Admin:s proxy-children will -%% use AND or OR when checking Filters. -%% Returns : ConsAdm -%% AdminId (out) -%%----------------------------------------------------------- -new_for_consumers(OE_THIS, _OE_FROM, State, Op) -> - is_admin_limit_reached(?get_MaxConsumers(State), ?get_consumerAmount(State)), - AdminId = ?new_Id(State), - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case catch 'CosNotifyChannelAdmin_ConsumerAdmin':oe_create_link([AdminId, OE_THIS, - self(), Op, - ?get_GlobalQoS(State), - ?get_LocalQoS(State), - ?get_Options(State)], - [{sup_child, true}|SO]) of - {ok, Pid, AdminCo} -> - %% Due to different storage, adding a new consumer is NOT done in the - %% same way as for suppliers. - NewState = ?add_consumerAdmin(State, AdminId, AdminCo, Pid), - {reply, {AdminCo, AdminId}, ?set_IdCounter(NewState, AdminId)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:nef_for_consumers();~n" - "Unable to create: CosNotifyChannelAdmin_ConsumerAdmin.~n" - "Reason: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%----------------------------------------------------------% -%% function : new_for_suppliers -%% Arguments: Op - InterFilterGroupOperator: 'AND_OP' | 'OR_OP' -%% Determines if the Admin:s proxy-children will -%% use AND or OR when checking Filters. -%% Returns : SuppAdm -%% AdminId (out) -%%----------------------------------------------------------- -new_for_suppliers(OE_THIS, _OE_FROM, State, Op) -> - is_admin_limit_reached(?get_MaxSuppliers(State), ?get_supplierAmount(State)), - AdminId = ?new_Id(State), - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case catch 'CosNotifyChannelAdmin_SupplierAdmin':oe_create_link([AdminId, OE_THIS, - self(), Op, - ?get_GlobalQoS(State), - ?get_LocalQoS(State), - ?get_Options(State)], - [{sup_child, true}|SO]) of - {ok, Pid, AdminSu} -> - %% Due to different storage, adding a new supplier is NOT done in the - %% same way as for consumers. - ?add_supplierAdmin(State, AdminId, AdminSu, Pid), - {reply, {AdminSu, AdminId}, ?set_IdCounter(State, AdminId)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:new_for_suppliers();~n" - "Unable to create: CosNotifyChannelAdmin_SupplierAdmin.~n" - "Reason: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%----------------------------------------------------------% -%% function : get_consumeradmin -%% Arguments: AdminId -%% Returns : ConsAdmin -%%----------------------------------------------------------- -get_consumeradmin(OE_THIS, _OE_FROM, State, 0) when ?is_UndefDefConsAdm(State) -> - Op = 'CosNotification_Common':get_option(filterOp, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case catch 'CosNotifyChannelAdmin_ConsumerAdmin':oe_create_link([0, OE_THIS, - self(), Op, - ?get_GlobalQoS(State), - ?get_LocalQoS(State), - ?get_Options(State)], - [{sup_child, true}|SO]) of - {ok, Pid, DefConAdm} -> - {reply, DefConAdm, ?set_defConsumerAdm(State, DefConAdm, Pid)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:get_consumer_admin();~n" - "Unable to create: CosNotifyChannelAdmin_ConsumerAdmin.~n" - "Reason: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end; -get_consumeradmin(_OE_THIS, _OE_FROM, State, 0) -> - {reply, ?get_defConsumerAdm(State), State}; -get_consumeradmin(_OE_THIS, _OE_FROM, State, AdminId) when is_integer(AdminId) -> - {reply, ?get_consumerAdmin(State, AdminId), State}; -get_consumeradmin(_, _, _, What) -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:get_consumeradmin(~p);~n" - "Not an integer", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : get_supplieradmin -%% Arguments: AdminId -%% Returns : -%%----------------------------------------------------------- -get_supplieradmin(OE_THIS, _OE_FROM, State, 0) when ?is_UndefDefSuppAdm(State) -> - Op = 'CosNotification_Common':get_option(filterOp, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case catch 'CosNotifyChannelAdmin_SupplierAdmin':oe_create_link([0, OE_THIS, - self(), Op, - ?get_GlobalQoS(State), - ?get_LocalQoS(State), - ?get_Options(State)], - [{sup_child, true}|SO]) of - {ok, Pid, DefSupAdm} -> - {reply, DefSupAdm, ?set_defSupplierAdm(State, DefSupAdm, Pid)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:get_supplieradmin();~n" - "Unable to create: CosNotifyChannelAdmin_SupplierAdmin.~n" - "Reason: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end; -get_supplieradmin(_OE_THIS, _OE_FROM, State, 0) -> - {reply, ?get_defSupplierAdm(State), State}; -get_supplieradmin(_OE_THIS, _OE_FROM, State, AdminId) when is_integer(AdminId) -> - {reply, ?get_supplierAdmin(State, AdminId), State}; -get_supplieradmin(_, _, _, What) -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:get_supplieradmin(~p);~n" - "Not an integer", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : get_all_consumeradmins -%% Arguments: - -%% Returns : AdminIDSeq - a list of all unique ID:s. -%%----------------------------------------------------------- -get_all_consumeradmins(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_consumerAdmIDs(State), State}. - -%%----------------------------------------------------------% -%% function : get_all_supplieradmins -%% Arguments: - -%% Returns : AdminIDSeq - a list of all unique ID:s. -%%----------------------------------------------------------- -get_all_supplieradmins(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_supplierAdmIDs(State), State}. - - -%%----- Inherit from CosNotification::QoSAdmin -------------- -%%----------------------------------------------------------% -%% function : get_qos -%% Arguments: - -%% Returns : CosNotification::QoSProperties -%% [#'Property'{name, value}, ...] where name eq. string() -%% and value eq. any(). -%%----------------------------------------------------------- -get_qos(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_GlobalQoS(State), State}. - -%%----------------------------------------------------------% -%% function : set_qos -%% Arguments: QoS - CosNotification::QoSProperties, i.e., -%% [#'Property'{name, value}, ...] where name eq. string() -%% and value eq. any(). -%% Returns : ok | {'EXCEPTION', CosNotification::UnsupportedQoS} -%%----------------------------------------------------------- -set_qos(_OE_THIS, _OE_FROM, State, QoS) -> - {GQoS,LQoS} = 'CosNotification_Common':set_qos(QoS, ?get_BothQoS(State), - channel, false, - ?get_allAdmins(State)), - {reply, ok, ?set_BothQoS(State, GQoS,LQoS)}. - -%%----------------------------------------------------------% -%% function : validate_qos -%% Arguments: Required_qos - CosNotification::QoSProperties -%% [#'Property'{name, value}, ...] where name eq. string() -%% and value eq. any(). -%% Returns : {'EXCEPTION', CosNotification::UnsupportedQoS} | -%% {ok, CosNotification::NamedPropertyRangeSeq} -%%----------------------------------------------------------- -validate_qos(_OE_THIS, _OE_FROM, State, Required_qos) -> - QoS = 'CosNotification_Common':validate_qos(Required_qos, ?get_BothQoS(State), - channel, false, - ?get_allAdmins(State)), - {reply, {ok, QoS}, State}. - -%%----- Inherit from CosNotification::AdminPropertiesAdmin -- -%%-----------------------------------------------------------% -%% function : get_admin -%% Arguments: - -%% Returns : AdminProperties -%%----------------------------------------------------------- -get_admin(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_GlobalAdm(State), State}. - -%%----------------------------------------------------------% -%% function : set_admin -%% Arguments: Admin -%% Returns : -%%----------------------------------------------------------- -set_admin(_OE_THIS, _OE_FROM, State, Admin) -> - {GAdm,[MaxQ, MaxC, MaxS|_]} = - 'CosNotification_Common':set_adm(Admin, ?get_GlobalAdm(State)), - {reply, ok, ?set_AllAdminP(State, GAdm, MaxQ, MaxC, MaxS)}. - -%%----- Inherit from CosEventChannelAdmin::EventChannel ----- -%%----------------------------------------------------------% -%% function : for_consumers -%% Arguments: - -%% Returns : ConsAdm -%%----------------------------------------------------------- -for_consumers(OE_THIS, _OE_FROM, State) -> - is_admin_limit_reached(?get_MaxConsumers(State), ?get_consumerAmount(State)), - AdminId = ?new_Id(State), - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case catch 'CosNotifyChannelAdmin_ConsumerAdmin':oe_create_link([AdminId, OE_THIS, - self(), 'AND_OP', - ?get_GlobalQoS(State), - ?get_LocalQoS(State), - ?get_Options(State)], - [{sup_child, true}|SO]) of - {ok, Pid, AdminCo} -> - %% Due to different storage, adding a new consumer is NOT done in the - %% same way as for suppliers. - NewState = ?add_consumerAdmin(State, AdminId, AdminCo, Pid), - {reply, AdminCo, ?set_IdCounter(NewState, AdminId)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:for_consumers();~n" - "Unable to create: CosNotifyChannelAdmin_ConsumerAdmin.~n" - "Reason: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%----------------------------------------------------------% -%% function : for_suppliers -%% Arguments: - -%% Returns : SuppAdm -%%----------------------------------------------------------- -for_suppliers(OE_THIS, _OE_FROM, State) -> - is_admin_limit_reached(?get_MaxSuppliers(State), ?get_supplierAmount(State)), - AdminId = ?new_Id(State), - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case catch 'CosNotifyChannelAdmin_SupplierAdmin':oe_create_link([AdminId, OE_THIS, - self(), 'AND_OP', - ?get_GlobalQoS(State), - ?get_LocalQoS(State), - ?get_Options(State)], - [{sup_child, true}|SO]) of - {ok, Pid, AdminSu} -> - %% Due to different storage, adding a new supplier is NOT done in the - %% same way as for consumers. - ?add_supplierAdmin(State, AdminId, AdminSu, Pid), - {reply, AdminSu, ?set_IdCounter(State, AdminId)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:for_suppliers();~n" - "Unable to create: CosNotifyChannelAdmin_SupplierAdmin.~n" - "Reason: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%-----------------------------------------------------------% -%% function : destroy -%% Arguments: - -%% Returns : ok -%%------------------------------------------------------------ -destroy(_OE_THIS, _OE_FROM, State) -> - {stop, normal, ok, State}. - -%%--------------- LOCAL FUNCTIONS ---------------------------- -find_obj([]) -> {'EXCEPTION', #'CosNotifyChannelAdmin_AdminNotFound'{}}; -find_obj([{_, Obj,_}]) -> Obj; -find_obj({value, {_, Obj,_}}) -> Obj; -find_obj(_) -> {'EXCEPTION', #'CosNotifyChannelAdmin_AdminNotFound'{}}. - - -find_field(List, Field) -> - find_field(List, Field, []). - -find_field([], _, Acc) -> - Acc; -find_field([{I,_,_}|T], 1, Acc) -> - find_field(T, 1, [I|Acc]); -find_field([{_,O,_}|T], 2, Acc) -> - find_field(T, 2, [O|Acc]); -% Left out for now to avoid dialyzer warning. -%find_field([{_,_,P}|T], 3, Acc) -> -% find_field(T, 3, [P|Acc]); -find_field(What, _, _) -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:find_field();~n" - "Data corrupt: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}). - -delete_obj(State, Pid) -> - case ets:match_object(State#state.etsR, {'_', '_', Pid}) of - [] -> - State#state{myConsumers=lists:keydelete(Pid, 3, State#state.myConsumers)}; - [{Id,_Obj,Pid}] -> - ets:delete(State#state.etsR, Id), - State - end. - -%% Test if we have reached limit for Admin objects. -is_admin_limit_reached(0, _) -> - %% When set to zero it means that there is no limit. - ok; -is_admin_limit_reached(Max, Current) when Current >= Max -> - %% The Current value do not include the default Admin objects, hence - %% we use >= instead of >. - corba:raise(#'IMP_LIMIT'{completion_status=?COMPLETED_NO}); -is_admin_limit_reached(_, _) -> - ok. - -%%----------------------------------------------------------- -%% function : callSeq -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -callSeq(_OE_THIS, OE_FROM, State, Event, Status) -> - corba:reply(OE_FROM, ok), - forward(seq, State, Event, Status). - -%%----------------------------------------------------------- -%% function : callAny -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -callAny(_OE_THIS, OE_FROM, State, Event, Status) -> - corba:reply(OE_FROM, ok), - forward(any, State, Event, Status). - -%% Forward events -forward(Type, State, Event, Status) -> - forward(Type, ?get_consumerAdmins(State), State, Event, Status). - -forward(_, [], State, _, _) -> - {noreply, State}; -forward(Type, [{_,undefined,_}|T], State, Event, Status) -> - %% Match if no default objects associated. - forward(Type, T, State, Event, Status); -forward(any, [{_,H,_}|T], State, Event, Status) -> - case catch oe_CosNotificationComm_Event:callAny(H, Event, Status) of - ok -> - ?DBG("CHANNEL FORWARD ANY: ~p~n",[Event]), - forward(any, T, State, Event, Status); - {'EXCEPTION', E} when is_record(E, 'OBJECT_NOT_EXIST') -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:forward();~n" - "Admin no longer exists; dropping it: ~p", - [?LINE, H], ?DEBUG_LEVEL), - NewState = ?del_consumerAdminRef(State,H), - forward(any, T, NewState, Event, Status); - R when ?is_PersistentConnection(State) -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:forward();~n" - "Admin behaves badly: ~p/~p", - [?LINE, R, H], ?DEBUG_LEVEL), - forward(any, T, State, Event, Status); - R -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:forward();~n" - "Admin behaves badly: ~p~n" - "Dropping it: ~p", [?LINE, R, H], ?DEBUG_LEVEL), - NewState = ?del_consumerAdminRef(State, H), - forward(any, T, NewState, Event, Status) - end; -forward(seq, [{_,H,_}|T], State, Event, Status) -> - case catch oe_CosNotificationComm_Event:callSeq(H, Event, Status) of - ok -> - ?DBG("CHANNEL FORWARD SEQUENCE: ~p~n",[Event]), - forward(seq, T, State, Event, Status); - {'EXCEPTION', E} when is_record(E, 'OBJECT_NOT_EXIST') -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:forward();~n" - "Admin no longer exists; dropping it: ~p", - [?LINE, H], ?DEBUG_LEVEL), - NewState = ?del_consumerAdminRef(State,H), - forward(seq, T, NewState, Event, Status); - R when ?is_PersistentConnection(State) -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:forward();~n" - "Admin behaves badly: ~p/~p", - [?LINE, R, H], ?DEBUG_LEVEL), - forward(seq, T, State, Event, Status); - R -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:forward();~n" - "Admin behaves badly: ~p~n" - "Dropping it: ~p", [?LINE, R, H], ?DEBUG_LEVEL), - NewState = ?del_consumerAdminRef(State,H), - forward(seq, T, NewState, Event, Status) - end. - - -%%--------------- MISC FUNCTIONS, E.G. DEBUGGING ------------- -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosNotification/src/CosNotifyChannelAdmin_SupplierAdmin_impl.erl b/lib/cosNotification/src/CosNotifyChannelAdmin_SupplierAdmin_impl.erl deleted file mode 100644 index 2810bef93d..0000000000 --- a/lib/cosNotification/src/CosNotifyChannelAdmin_SupplierAdmin_impl.erl +++ /dev/null @@ -1,580 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%------------------------------------------------------------------- -%% File : CosNotifyChannelAdmin_SupplierAdmin_impl.erl -%% Purpose : -%%------------------------------------------------------------------- - --module('CosNotifyChannelAdmin_SupplierAdmin_impl'). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% Application files --include("CosNotification.hrl"). --include("CosNotifyChannelAdmin.hrl"). --include("CosNotifyComm.hrl"). --include("CosNotifyFilter.hrl"). --include("CosNotification_Definitions.hrl"). - -%%--------------- EXPORTS ------------------------------------ -%%--------------- External ----------------------------------- -%%----- CosNotifyChannelAdmin::SupplierAdmin ----------------- --export([get_proxy_consumer/4, - obtain_notification_pull_consumer/4, - obtain_notification_push_consumer/4, - destroy/3]). - -%%----- Inherit from CosNotification::QoSAdmin --------------- --export([get_qos/3, - set_qos/4, - validate_qos/4]). - -%%----- Inherit from CosNotifyComm::NotifyPublish ------------ --export([offer_change/5]). - -%%----- Inherit from CosNotifyFilter::FilterAdmin ------------ --export([add_filter/4, - remove_filter/4, - get_filter/4, - get_all_filters/3, - remove_all_filters/3]). - -%%----- Inherit from CosEventChannelAdmin::SupplierAdmin ----- --export([obtain_push_consumer/3, - obtain_pull_consumer/3]). - -%% Attributes (external) --export(['_get_MyID'/3, - '_get_MyChannel'/3, - '_get_MyOperator'/3, - '_get_pull_consumers'/3, - '_get_push_consumers'/3]). - -%%--------------- Internal ----------------------------------- -%%----- Inherit from cosNotificationComm --------------------- --export([callAny/5, - callSeq/5]). - -%%--------------- gen_server specific exports ---------------- --export([handle_info/2, code_change/3]). --export([init/1, terminate/2]). - -%%--------------- LOCAL DEFINITIONS -------------------------- -%% Data structures --record(state, {myId, - myChannel, - myChannelPid, - myOperator, - myFilters = [], - idCounter = 0, - etsR, - qosGlobal, - qosLocal, - options}). - -%% Data structures constructors --define(get_InitState(_MyID, _MyCh, _MyChP, _MyOp, _QoS, _LQS, _O), - #state{myId = _MyID, - myChannel = _MyCh, - myChannelPid = _MyChP, - myOperator = _MyOp, - qosGlobal = _QoS, - qosLocal = _LQS, - options = _O, - etsR = ets:new(oe_ets, [set, protected])}). - -%% Data structures selectors --define(get_PushConsumers(S), lists:flatten(ets:match(S#state.etsR, - {'_','$1','_',pusher}))). --define(get_PullConsumers(S), lists:flatten(ets:match(S#state.etsR, - {'_','$1','_',puller}))). --define(get_AllConsumers(S), lists:flatten(ets:match(S#state.etsR, - {'_','$1','_','_'}))). --define(get_PushConsumerIDs(S), lists:flatten(ets:match(S#state.etsR, - {'$1','_','_',pusher}))). --define(get_PullConsumerIDs(S), lists:flatten(ets:match(S#state.etsR, - {'$1','_','_',puller}))). - --define(get_Consumer(S, I), find_obj(ets:lookup(S#state.etsR, I), consumer)). - --define(get_MyID(S), S#state.myId). --define(get_MyChannel(S), S#state.myChannel). --define(get_MyChannelPid(S), S#state.myChannelPid). --define(get_MyOperator(S), S#state.myOperator). --define(get_GlobalQoS(S), S#state.qosGlobal). --define(get_LocalQoS(S), S#state.qosLocal). --define(get_BothQoS(S), {S#state.qosGlobal, S#state.qosLocal}). --define(get_Filter(S, I), find_obj(lists:keysearch(I, 1, S#state.myFilters), - filter)). --define(get_AllFilter(S), S#state.myFilters). --define(get_AllFilterID(S), find_ids(S#state.myFilters)). --define(get_Options(S), S#state.options). --define(get_IdCounter(S), S#state.idCounter). - -%% Data structures modifiers --define(set_LocalQoS(S,D), S#state{qosLocal=D}). --define(set_GlobalQoS(S,D), S#state{qosGlobal=D}). --define(set_BothQoS(S,GD,LD), S#state{qosGlobal=GD, qosLocal=LD}). --define(add_PushConsumer(S,I,R,P),ets:insert(State#state.etsR, {I,R,P,pusher})). --define(add_PullConsumer(S,I,R,P),ets:insert(State#state.etsR, {I,R,P,puller})). --define(del_Consumer(S,I), ets:delete(S#state.etsR, I)). --define(del_ConsumerPid(S,P), ets:match_delete(S#state.etsR, {'_','_',P,'_'})). --define(add_Filter(S,I,O), S#state{myFilters=[{I,O}|S#state.myFilters]}). --define(del_Filter(S,I), S#state{myFilters= - delete_filter(lists:keydelete(I, 1, - S#state.myFilters), - S#state.myFilters)}). --define(del_AllFilter(S), S#state{myFilters=[]}). --define(set_IdCounter(S,V), S#state{idCounter=V}). --define(new_Id(S), 'CosNotification_Common':create_id(S#state.idCounter)). - -%% MISC --define(is_PersistentEvent(S), - ?not_GetEventReliability((S#state.qosLocal)) == ?not_Persistent). --define(is_PersistentConnection(S), - ?not_GetConnectionReliability((S#state.qosLocal)) == ?not_Persistent). - -%%----------------------------------------------------------% -%% function : handle_info, code_change -%% Arguments: -%% Returns : -%% Effect : Functions demanded by the gen_server module. -%%----------------------------------------------------------- - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -handle_info(Info, State) -> - case Info of - {'EXIT', Pid, Reason} when ?get_MyChannelPid(State) == Pid -> - ?DBG("PARENT CHANNEL: ~p TERMINATED.~n",[Reason]), - {stop, Reason, State}; - {'EXIT', Pid, normal} -> - ?del_ConsumerPid(State, Pid), - {noreply, State}; - _Other -> - {noreply, State} - end. - -%%----------------------------------------------------------% -%% function : init, terminate -%% Arguments: -%%----------------------------------------------------------- - -init([MyId, MyChannel, MyChannelPid, MyOperator, InitQoS, LQS, Options]) -> - process_flag(trap_exit, true), - {ok, ?get_InitState(MyId, MyChannel, MyChannelPid, MyOperator, InitQoS, LQS, Options)}. - -terminate(_Reason, _State) -> - ok. - -%%----------------------------------------------------------- -%%----- CosNotifyChannelAdmin_ConsumerAdmin attributes ------ -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% Attribute: '_get_MyID' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_MyID'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_MyID(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_MyChannel' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_MyChannel'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_MyChannel(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_MyOperator' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_MyOperator'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_MyOperator(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_pull_consumers' -%% Type : readonly -%% Returns : ProxyIDSeq -%%----------------------------------------------------------- -'_get_pull_consumers'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_PullConsumerIDs(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_push_consumers' -%% Type : readonly -%% Returns : ProxyIDSeq -%%----------------------------------------------------------- -'_get_push_consumers'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_PushConsumerIDs(State), State}. - -%%----------------------------------------------------------- -%%------- Exported external functions ----------------------- -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% function : get_proxy_consumer -%% Arguments: ProxyId - unique identifier (long) -%% Returns : ObjRef | {'EXCEPTION', #'ProxyNotFound'{}} -%%----------------------------------------------------------- -get_proxy_consumer(_OE_THIS, _OE_FROM, State, ProxyId) -> - {reply, ?get_Consumer(State, ProxyId), State}. - -%%----------------------------------------------------------% -%% function : obtain_notification_pull_consumer -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -obtain_notification_pull_consumer(OE_THIS, _OE_FROM, State, Ctype) -> - %% Choose which module to use. - {Mod, Type} = - case Ctype of - 'ANY_EVENT' -> - {'CosNotifyChannelAdmin_ProxyPullConsumer', 'PULL_ANY'}; - 'STRUCTURED_EVENT' -> - {'CosNotifyChannelAdmin_StructuredProxyPullConsumer', 'PULL_STRUCTURED'}; - 'SEQUENCE_EVENT' -> - {'CosNotifyChannelAdmin_SequenceProxyPullConsumer', 'PULL_SEQUENCE'}; - _ -> - orber:dbg("[~p] CosNotifyChannelAdmin_SupplierAdmin:" - "obtain_notification_pull_consumer(~p);~n" - "Incorrect enumerant", - [?LINE, Ctype], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end, - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case catch Mod:oe_create_link([Type, OE_THIS, self(), ?get_GlobalQoS(State), - ?get_LocalQoS(State), ?get_MyChannel(State), - ?get_Options(State), ?get_MyOperator(State)], - [{sup_child, true}|SO]) of - {ok, Pid, Proxy} -> - ProxyID = ?new_Id(State), - ?add_PullConsumer(State, ProxyID, Proxy, Pid), - {reply, {Proxy, ProxyID}, ?set_IdCounter(State, ProxyID)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_SupplierAdmin:" - "obtain_notification_pull_consumer();~n" - "Unable to create: ~p/~p~n" - "Reason: ~p", [?LINE, Mod, Type, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%----------------------------------------------------------% -%% function : obtain_notification_push_supplier -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -obtain_notification_push_consumer(OE_THIS, _OE_FROM, State, Ctype) -> - %% Choose which module to use. - {Mod, Type} = - case Ctype of - 'ANY_EVENT' -> - {'CosNotifyChannelAdmin_ProxyPushConsumer', 'PUSH_ANY'}; - 'STRUCTURED_EVENT' -> - {'CosNotifyChannelAdmin_StructuredProxyPushConsumer', 'PUSH_STRUCTURED'}; - 'SEQUENCE_EVENT' -> - {'CosNotifyChannelAdmin_SequenceProxyPushConsumer', 'PUSH_SEQUENCE'}; - _ -> - orber:dbg("[~p] CosNotifyChannelAdmin_SupplierAdmin:" - "obtain_notification_push_consumer(~p);~n" - "Incorrect enumerant", [?LINE, Ctype], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end, - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case catch Mod:oe_create_link([Type, OE_THIS, self(), ?get_GlobalQoS(State), - ?get_LocalQoS(State), ?get_MyChannel(State), - ?get_Options(State), ?get_MyOperator(State)], - [{sup_child, true}|SO]) of - {ok, Pid, Proxy} -> - ProxyID = ?new_Id(State), - ?add_PushConsumer(State, ProxyID, Proxy, Pid), - {reply, {Proxy, ProxyID}, ?set_IdCounter(State, ProxyID)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_SupplierAdmin:" - "obtain_notification_push_consumer();~n" - "Unable to create: ~p/~p~n" - "Reason: ~p", [?LINE, Mod, Type, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%----------------------------------------------------------% -%% function : destroy -%% Arguments: - -%% Returns : ok -%%------------------------------------------------------------ -destroy(_OE_THIS, _OE_FROM, State) -> - {stop, normal, ok, State}. - -%%----- Inherit from CosNotification::QoSAdmin -------------- -%%----------------------------------------------------------% -%% function : get_qos -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -get_qos(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_GlobalQoS(State), State}. - -%%----------------------------------------------------------% -%% function : set_qos -%% Arguments: QoS - CosNotification::QoSProperties, i.e., -%% [#'Property'{name, value}, ...] where name eq. string() -%% and value eq. any(). -%% Returns : ok | {'EXCEPTION', CosNotification::UnsupportedQoS} -%%----------------------------------------------------------- -set_qos(_OE_THIS, _OE_FROM, State, QoS) -> - {NewQoS, LQS} = 'CosNotification_Common':set_qos(QoS, ?get_BothQoS(State), - admin, ?get_MyChannel(State), - ?get_AllConsumers(State)), - {reply, ok, ?set_BothQoS(State, NewQoS, LQS)}. - -%%----------------------------------------------------------% -%% function : validate_qos -%% Arguments: Required_qos - CosNotification::QoSProperties -%% [#'Property'{name, value}, ...] where name eq. string() -%% and value eq. any(). -%% Returns : {'EXCEPTION', CosNotification::UnsupportedQoS} -%% {ok, CosNotification::NamedPropertyRangeSeq} -%%----------------------------------------------------------- -validate_qos(_OE_THIS, _OE_FROM, State, Required_qos) -> - QoS = 'CosNotification_Common':validate_qos(Required_qos, ?get_BothQoS(State), - admin, ?get_MyChannel(State), - ?get_AllConsumers(State)), - {reply, {ok, QoS}, State}. - -%%----- Inherit from CosNotifyComm::NotifyPublish ----------- -%%----------------------------------------------------------* -%% function : offer_change -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -offer_change(_OE_THIS, _OE_FROM, State, _Added, _Removed) -> - {reply, ok, State}. - -%%----- Inherit from CosNotifyFilter::FilterAdmin ----------- -%%----------------------------------------------------------% -%% function : add_filter -%% Arguments: Filter - CosNotifyFilter::Filter -%% Returns : FilterID - long -%%----------------------------------------------------------- -add_filter(_OE_THIS, _OE_FROM, State, Filter) -> - 'CosNotification_Common':type_check(Filter, 'CosNotifyFilter_Filter'), - FilterID = ?new_Id(State), - NewState = ?set_IdCounter(State, FilterID), - {reply, FilterID, ?add_Filter(NewState, FilterID, Filter)}. - -%%----------------------------------------------------------% -%% function : remove_filter -%% Arguments: FilterID - long -%% Returns : ok -%%----------------------------------------------------------- -remove_filter(_OE_THIS, _OE_FROM, State, FilterID) when is_integer(FilterID) -> - {reply, ok, ?del_Filter(State, FilterID)}; -remove_filter(_,_,_,What) -> - orber:dbg("[~p] CosNotifyChannelAdmin_SupplierAdmin:remove_filter(~p);~n" - "Not an integer", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : get_filter -%% Arguments: FilterID - long -%% Returns : Filter - CosNotifyFilter::Filter | -%% {'EXCEPTION', #'CosNotifyFilter_FilterNotFound'{}} -%%----------------------------------------------------------- -get_filter(_OE_THIS, _OE_FROM, State, FilterID) when is_integer(FilterID) -> - {reply, ?get_Filter(State, FilterID), State}; -get_filter(_,_,_,What) -> - orber:dbg("[~p] CosNotifyChannelAdmin_SupplierAdmin:get_filter(~p);~n" - "Not an integer", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : get_all_filters -%% Arguments: - -%% Returns : Filter - CosNotifyFilter::FilterIDSeq -%%----------------------------------------------------------- -get_all_filters(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_AllFilterID(State), State}. - -%%----------------------------------------------------------% -%% function : remove_all_filters -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -remove_all_filters(_OE_THIS, _OE_FROM, State) -> - {reply, ok, ?del_AllFilter(State)}. - -%%----- Inherit from CosEventChannelAdmin::SupplierAdmin ---- -%%----------------------------------------------------------% -%% function : obtain_push_consumer -%% Arguments: - -%% Returns : ProxyPushConsumer -%%----------------------------------------------------------- -obtain_push_consumer(OE_THIS, _OE_FROM, State) -> - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case catch 'CosNotifyChannelAdmin_ProxyPushConsumer': - oe_create_link(['PUSH_ANY', OE_THIS, self(), ?get_GlobalQoS(State), - ?get_LocalQoS(State), ?get_MyChannel(State), - ?get_Options(State), ?get_MyOperator(State)], - [{sup_child, true}|SO]) of - {ok, Pid, Proxy} -> - ProxyID = ?new_Id(State), - ?add_PushConsumer(State, ProxyID, Proxy, Pid), - {reply, Proxy, ?set_IdCounter(State, ProxyID)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_SupplierAdmin:obtain_push_consumer();~n" - "Unable to create: CosNotifyChannelAdmin_ProxyPushConsumer~n" - "Reason: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%----------------------------------------------------------% -%% function : obtain_pull_consumer -%% Arguments: - -%% Returns : ProxyPullConsumer -%%----------------------------------------------------------- -obtain_pull_consumer(OE_THIS, _OE_FROM, State) -> - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case catch 'CosNotifyChannelAdmin_ProxyPullConsumer': - oe_create_link(['PULL_ANY', OE_THIS, self(), ?get_GlobalQoS(State), - ?get_LocalQoS(State), ?get_MyChannel(State), - ?get_Options(State), ?get_MyOperator(State)], - [{sup_child, true}|SO]) of - {ok, Pid, Proxy} -> - ProxyID = ?new_Id(State), - ?add_PullConsumer(State, ProxyID, Proxy, Pid), - {reply, Proxy, ?set_IdCounter(State, ProxyID)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_SupplierAdmin:obtain_push_consumer();~n" - "Unable to create: CosNotifyChannelAdmin_ProxyPullConsumer~n" - "Reason: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%--------------- LOCAL FUNCTIONS ---------------------------- -find_obj([], consumer) -> {'EXCEPTION', #'CosNotifyChannelAdmin_ProxyNotFound'{}}; -find_obj([], filter) -> {'EXCEPTION', #'CosNotifyFilter_FilterNotFound'{}}; -%% To match consumers -find_obj([{_,Obj,_,_}],_) -> Obj; -%% To match filters -find_obj({value, {_,Obj}},_) -> Obj; -find_obj(_,consumer) -> {'EXCEPTION', #'CosNotifyChannelAdmin_ProxyNotFound'{}}; -find_obj(_,filter) -> {'EXCEPTION', #'CosNotifyFilter_FilterNotFound'{}}. - -find_ids(List) -> find_ids(List, []). -find_ids([], Acc) -> Acc; -find_ids([{I,_}|T], Acc) -> find_ids(T, [I|Acc]); -find_ids(What, _) -> - orber:dbg("[~p] CosNotifyChannelAdmin_SupplierAdmin:find_ids();~n" - "Id corrupt: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}). - -%% Delete a single filter. -%% The list do not differ, i.e., no filter removed, raise exception. -delete_filter(List,List) -> corba:raise(#'CosNotifyFilter_FilterNotFound'{}); -delete_filter(List, _) -> List. - -%%----------------------------------------------------------- -%% function : callSeq -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -callSeq(_OE_THIS, OE_FROM, State, Events, _Status) -> - corba:reply(OE_FROM, ok), - case cosNotification_eventDB:filter_events(Events, ?get_AllFilter(State)) of - {[], _} -> - {noreply, State}; - {Passed, _} -> - forward(seq, State, Passed, 'MATCHED') - end. - -%%----------------------------------------------------------- -%% function : callAny -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -callAny(_OE_THIS, OE_FROM, State, Event, _Status) -> - corba:reply(OE_FROM, ok), - case cosNotification_eventDB:filter_events([Event], ?get_AllFilter(State)) of - {[], _} -> - {noreply, State}; - {[Passed], _} -> - forward(any, State, Passed, 'MATCHED') - end. - -%% Forward events -forward(any, State, Event, Status) -> - case catch oe_CosNotificationComm_Event:callAny(?get_MyChannel(State), - Event, Status) of - ok -> - ?DBG("SUPPLIERADM FORWARD ANY: ~p~n",[Event]), - {noreply, State}; - {'EXCEPTION', E} when is_record(E, 'OBJECT_NOT_EXIST') -> - orber:dbg("[~p] CosNotifyChannelAdmin_SupplierAdmin:forward();~n" - "Channel no longer exists; terminating and dropping: ~p", - [?LINE, Event], ?DEBUG_LEVEL), - {stop, normal, State}; - R when ?is_PersistentConnection(State) -> - orber:dbg("[~p] CosNotifyChannelAdmin_SupplierAdmin:forward();~n" - "Channel respond incorrect: ~p~n" - "Dropping: ~p", [?LINE, R, Event], ?DEBUG_LEVEL), - {noreply, State}; - R -> - orber:dbg("[~p] CosNotifyChannelAdmin_SupplierAdmin:forward();~n" - "Channel respond incorrect: ~p~n" - "Terminating and dropping: ~p", - [?LINE, R, Event], ?DEBUG_LEVEL), - {stop, normal, State} - end; -forward(seq, State, Event, Status) -> - case catch oe_CosNotificationComm_Event:callSeq(?get_MyChannel(State), - Event, Status) of - ok -> - ?DBG("SUPPLIERADM FORWARD SEQUENCE: ~p~n",[Event]), - {noreply, State}; - {'EXCEPTION', E} when is_record(E, 'OBJECT_NOT_EXIST') -> - orber:dbg("[~p] CosNotifyChannelAdmin_SupplierAdmin:forward();~n" - "Channel no longer exists; terminating and dropping: ~p", - [?LINE, Event], ?DEBUG_LEVEL), - {stop, normal, State}; - R when ?is_PersistentConnection(State) -> - orber:dbg("[~p] CosNotifyChannelAdmin_SupplierAdmin:forward();~n" - "Channel respond incorrect: ~p~n" - "Dropping: ~p", [?LINE, R, Event], ?DEBUG_LEVEL), - {noreply, State}; - R -> - orber:dbg("[~p] CosNotifyChannelAdmin_SupplierAdmin:forward();~n" - "Channel respond incorrect: ~p~n" - "Terminating and dropping: ~p", - [?LINE, R, Event], ?DEBUG_LEVEL), - {stop, normal, State} - end. - - -%%--------------- MISC FUNCTIONS, E.G. DEBUGGING ------------- -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosNotification/src/CosNotifyComm.cfg b/lib/cosNotification/src/CosNotifyComm.cfg deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosNotification/src/CosNotifyComm.idl b/lib/cosNotification/src/CosNotifyComm.idl deleted file mode 100644 index f0386f0982..0000000000 --- a/lib/cosNotification/src/CosNotifyComm.idl +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef _COS_NOTIFYCOMM_IDL_ -#define _COS_NOTIFYCOMM_IDL_ - -#pragma prefix "omg.org" - - -#include - -module CosNotifyComm { - exception InvalidEventType { CosNotification::EventType type; }; - - interface NotifyPublish { - void offer_change (in CosNotification::EventTypeSeq added, - in CosNotification::EventTypeSeq removed) - raises (InvalidEventType); - }; // NotifyPublish - - interface NotifySubscribe { - void subscription_change(in CosNotification::EventTypeSeq added, - in CosNotification::EventTypeSeq removed) - raises (InvalidEventType); - }; // NotifySubscribe - - interface PushConsumer : NotifyPublish, CosEventComm::PushConsumer { }; // PushConsumer - - interface PullConsumer : NotifyPublish, CosEventComm::PullConsumer { }; // PullConsumer - - interface PullSupplier : NotifySubscribe, CosEventComm::PullSupplier { }; // PullSupplier - - interface PushSupplier : NotifySubscribe, CosEventComm::PushSupplier { }; - - interface StructuredPushConsumer : NotifyPublish { - void push_structured_event(in CosNotification::StructuredEvent notification) - raises(CosEventComm::Disconnected); - - void disconnect_structured_push_consumer(); - }; // StructuredPushConsumer - - interface StructuredPullConsumer : NotifyPublish { - void disconnect_structured_pull_consumer(); - }; // StructuredPullConsumer - - interface StructuredPullSupplier : NotifySubscribe { - CosNotification::StructuredEvent pull_structured_event() - raises(CosEventComm::Disconnected); - - CosNotification::StructuredEvent try_pull_structured_event(out boolean has_event) - raises(CosEventComm::Disconnected); - - void disconnect_structured_pull_supplier(); - }; // StructuredPullSupplier - - interface StructuredPushSupplier : NotifySubscribe { - void disconnect_structured_push_supplier(); - }; // StructuredPushSupplier - - interface SequencePushConsumer : NotifyPublish { - void push_structured_events(in CosNotification::EventBatch notifications) - raises(CosEventComm::Disconnected); - - void disconnect_sequence_push_consumer(); - }; // SequencePushConsumer - - interface SequencePullConsumer : NotifyPublish { - void disconnect_sequence_pull_consumer(); - }; // SequencePullConsumer - - interface SequencePullSupplier : NotifySubscribe { - CosNotification::EventBatch pull_structured_events(in long max_number) - raises(CosEventComm::Disconnected); - CosNotification::EventBatch try_pull_structured_events(in long max_number, out boolean has_event) - raises(CosEventComm::Disconnected); - - void disconnect_sequence_pull_supplier(); - }; // SequencePullSupplier - - interface SequencePushSupplier : NotifySubscribe { - void disconnect_sequence_push_supplier(); - }; // SequencePushSupplier -}; // CosNotifyComm - -#endif /* ifndef _COS_NOTIFYCOMM_IDL_ */ - diff --git a/lib/cosNotification/src/CosNotifyFilter.cfg b/lib/cosNotification/src/CosNotifyFilter.cfg deleted file mode 100644 index 167550e0f5..0000000000 --- a/lib/cosNotification/src/CosNotifyFilter.cfg +++ /dev/null @@ -1,6 +0,0 @@ -{this, "CosNotifyFilter::Filter"}. -{{handle_info, "CosNotifyFilter::Filter"}, true}. -{this, "CosNotifyFilter::MappingFilter"}. -{{handle_info, "CosNotifyFilter::MappingFilter"}, true}. -{this, "CosNotifyFilter::FilterFactory"}. -{{handle_info, "CosNotifyFilter::FilterFactory"}, true}. diff --git a/lib/cosNotification/src/CosNotifyFilter.idl b/lib/cosNotification/src/CosNotifyFilter.idl deleted file mode 100644 index c6498ddcd0..0000000000 --- a/lib/cosNotification/src/CosNotifyFilter.idl +++ /dev/null @@ -1,140 +0,0 @@ -#ifndef _COS_NOTIFYFILTER_IDL_ -#define _COS_NOTIFYFILTER_IDL_ - -#pragma prefix "omg.org" - -#include -#include - -module CosNotifyFilter { - typedef long ConstraintID; - struct ConstraintExp { - CosNotification::EventTypeSeq event_types; - string constraint_expr; - }; - - typedef sequence ConstraintIDSeq; - typedef sequence ConstraintExpSeq; - struct ConstraintInfo { - ConstraintExp constraint_expression; - ConstraintID constraint_id; - }; - typedef sequence ConstraintInfoSeq; - struct MappingConstraintPair { - ConstraintExp constraint_expression; - any result_to_set; - }; - typedef sequence MappingConstraintPairSeq; - struct MappingConstraintInfo { - ConstraintExp constraint_expression; - ConstraintID constraint_id; - any value; - }; - typedef sequence MappingConstraintInfoSeq; - typedef long CallbackID; - typedef sequence CallbackIDSeq; - exception UnsupportedFilterableData {}; - exception InvalidGrammar {}; - exception InvalidConstraint {ConstraintExp constr;}; - exception DuplicateConstraintID {ConstraintID id;}; - exception ConstraintNotFound {ConstraintID id;}; - exception CallbackNotFound {}; - exception InvalidValue {ConstraintExp constr; any value;}; - interface Filter { - readonly attribute string constraint_grammar; - ConstraintInfoSeq add_constraints (in ConstraintExpSeq constraint_list) - raises (InvalidConstraint); - - void modify_constraints (in ConstraintIDSeq del_list, - in ConstraintInfoSeq modify_list) - raises (InvalidConstraint, ConstraintNotFound); - - ConstraintInfoSeq get_constraints(in ConstraintIDSeq id_list) - raises (ConstraintNotFound); - - ConstraintInfoSeq get_all_constraints(); - - void remove_all_constraints(); - void destroy(); - boolean match (in any filterable_data) - raises (UnsupportedFilterableData); - - boolean match_structured (in CosNotification::StructuredEvent filterable_data) - raises (UnsupportedFilterableData); - - boolean match_typed (in CosNotification::PropertySeq filterable_data) - raises (UnsupportedFilterableData); - - CallbackID attach_callback (in CosNotifyComm::NotifySubscribe callback); - - void detach_callback (in CallbackID callback) - raises ( CallbackNotFound ); - - CallbackIDSeq get_callbacks(); - }; // Filter - - interface MappingFilter { - readonly attribute string constraint_grammar; - - readonly attribute CORBA::TypeCode value_type; - - readonly attribute any default_value; - - MappingConstraintInfoSeq add_mapping_constraints (in MappingConstraintPairSeq pair_list) - raises (InvalidConstraint, InvalidValue); - - void modify_mapping_constraints (in ConstraintIDSeq del_list, - in MappingConstraintInfoSeq modify_list) - raises (InvalidConstraint, InvalidValue, ConstraintNotFound); - - MappingConstraintInfoSeq get_mapping_constraints (in ConstraintIDSeq id_list) - raises (ConstraintNotFound); - - MappingConstraintInfoSeq get_all_mapping_constraints(); - - void remove_all_mapping_constraints(); - - void destroy(); - - boolean match (in any filterable_data, out any result_to_set) - raises (UnsupportedFilterableData); - - boolean match_structured (in CosNotification::StructuredEvent filterable_data, out any result_to_set) - raises (UnsupportedFilterableData); - - boolean match_typed (in CosNotification::PropertySeq filterable_data, out any result_to_set) - raises (UnsupportedFilterableData); - }; // MappingFilter - - - interface FilterFactory { - - Filter create_filter (in string constraint_grammar) - raises (InvalidGrammar); - - MappingFilter create_mapping_filter (in string constraint_grammar, in any default_value) - raises(InvalidGrammar); - }; // FilterFactory - - typedef long FilterID; - typedef sequence FilterIDSeq; - exception FilterNotFound {}; - - interface FilterAdmin { - FilterID add_filter (in Filter new_filter); - - void remove_filter (in FilterID filter) - raises (FilterNotFound); - - Filter get_filter (in FilterID filter) - raises (FilterNotFound); - - FilterIDSeq get_all_filters(); - - void remove_all_filters(); - }; // FilterAdmin -}; // CosNotifyFilter - - -#endif /* ifndef _COS_NOTIFYFILTER_IDL_ */ - diff --git a/lib/cosNotification/src/CosNotifyFilter_FilterFactory_impl.erl b/lib/cosNotification/src/CosNotifyFilter_FilterFactory_impl.erl deleted file mode 100644 index 760dcf40b8..0000000000 --- a/lib/cosNotification/src/CosNotifyFilter_FilterFactory_impl.erl +++ /dev/null @@ -1,126 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosNotifyFilter_FilterFactory_impl.erl -%% Purpose : -%%---------------------------------------------------------------------- - --module('CosNotifyFilter_FilterFactory_impl'). - - -%%--------------- INCLUDES ----------------------------------- -%% Application files --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% Application files --include("CosNotification.hrl"). --include("CosNotifyChannelAdmin.hrl"). --include("CosNotifyComm.hrl"). --include("CosNotifyFilter.hrl"). --include("CosNotification_Definitions.hrl"). - -%%--------------- IMPORTS ------------------------------------ - -%%--------------- EXPORTS ------------------------------------ -%% External --export([create_filter/3, - create_mapping_filter/4]). - -%%--------------- gen_server specific exports ---------------- --export([handle_info/2, code_change/3]). --export([init/1, terminate/2]). - -%%--------------- LOCAL DEFINITIONS -------------------------- -%% Data structures --record(state, {adminProp, - etsR, - options}). - -%%-----------------------------------------------------------% -%% function : handle_info, code_change -%% Arguments: See gen_server documentation. -%% Effect : Functions demanded by the gen_server module. -%%------------------------------------------------------------ - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -handle_info(_Info, State) -> - ?debug_print("INFO: ~p DATA: ~p~n", [State, _Info]), - {noreply, State}. - -%%----------------------------------------------------------% -%% function : init, terminate -%% Arguments: -%%----------------------------------------------------------- - -init(Options) -> - process_flag(trap_exit, true), - {ok, #state{options = Options}}. - -terminate(_Reason, _State) -> - ok. - -%%----------------------------------------------------------- -%%------- Exported external functions ----------------------- -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% function : create_filter -%% Arguments: InitGrammar - string() -%% Returns : CosNotifyFilter::Filter | -%% {'EXCEPTION', InvalidGrammar} -%%----------------------------------------------------------- -create_filter(OE_THIS, State, InitGrammar) -> - case lists:member(InitGrammar, ?not_SupportedGrammars) of - true -> - SO = 'CosNotification_Common':get_option(server_options, State#state.options, - ?not_DEFAULT_SETTINGS), - Fi='CosNotifyFilter_Filter':oe_create_link([OE_THIS, self(), - InitGrammar], - SO), - {reply, Fi, State}; - _ -> - corba:raise(#'CosNotifyFilter_InvalidGrammar'{}) - end. - -%%----------------------------------------------------------% -%% function : create_mapping_filter -%% Arguments: InitGrammar - string() -%% Returns : CosNotifyFilter::Filter | -%% {'EXCEPTION', InvalidGrammar} -%%----------------------------------------------------------- -create_mapping_filter(OE_THIS, State, InitGrammar, DefVal) -> - case lists:member(InitGrammar, ?not_SupportedGrammars) of - true -> - SO = 'CosNotification_Common':get_option(server_options, State#state.options, - ?not_DEFAULT_SETTINGS), - Fi='CosNotifyFilter_MappingFilter':oe_create_link([OE_THIS, self(), - InitGrammar, DefVal], - SO), - {reply, Fi, State}; - _ -> - corba:raise(#'CosNotifyFilter_InvalidGrammar'{}) - end. - -%%--------------- LOCAL FUNCTIONS ---------------------------- -%%--------------- MISC FUNCTIONS, E.G. DEBUGGING ------------- -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosNotification/src/CosNotifyFilter_Filter_impl.erl b/lib/cosNotification/src/CosNotifyFilter_Filter_impl.erl deleted file mode 100644 index 0f997049e0..0000000000 --- a/lib/cosNotification/src/CosNotifyFilter_Filter_impl.erl +++ /dev/null @@ -1,672 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosNotifyFilter_Filter_impl.erl -%% Purpose : -%% Note : For an event to be forwarded it's sufficient that at least -%% one of the constraints return 'true'. -%% ALL functions in this module are internal. May NOT be used -%% externally in ANY WAY; only CosNotification system modules. -%%---------------------------------------------------------------------- - --module('CosNotifyFilter_Filter_impl'). - -%%--------------- INCLUDES ----------------------------------- -%% Application files --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% Application files --include("CosNotification.hrl"). --include("CosNotifyChannelAdmin.hrl"). --include("CosNotifyComm.hrl"). --include("CosNotifyFilter.hrl"). --include("CosNotification_Definitions.hrl"). - -%%--------------- IMPORTS ------------------------------------ - -%%--------------- EXPORTS ------------------------------------ -%% External Attributes --export(['_get_constraint_grammar'/2]). -%% External Functions --export([add_constraints/3, - modify_constraints/4, - get_constraints/3, - get_all_constraints/2, - remove_all_constraints/2, - destroy/2, - match/3, - match_structured/3, - match_typed/3, - attach_callback/3, - detach_callback/3, - get_callbacks/2]). - -%%--------------- gen_server specific exports ---------------- --export([handle_info/2, code_change/3]). --export([init/1, terminate/2]). - -%%--------------- LOCAL DEFINITIONS -------------------------- -%%######### MISC ########## --define(create_ConstraintInfo(_Types, _Con, _ID), - #'CosNotifyFilter_ConstraintInfo'{ - constraint_expression = - #'CosNotifyFilter_ConstraintExp'{ - event_types = _Types, - constraint_expr = _Con}, - constraint_id = _ID - }). - -%%#### Data structures #### --record(state, {constraint_grammar, - constraints = [], - filters = [], - callbacks = [], - idCounter = 0, - filterFactory, - factoryPid, - etsR}). - -%% Data structures constructors --define(get_InitState(Fac, Pid, Gr), - #state{constraint_grammar=Gr, - filterFactory=Fac, - factoryPid=Pid, - etsR = ets:new(oe_ets, [bag, protected])}). - -%%------------------- Data structures selectors ------------------- -%% Grammar --define(get_Grammar(S), S#state.constraint_grammar). -%% Callbacks -% Left out for now to avoid dialyzer warning. -%-define(get_Callback(S,I), find_obj(lists:keysearch(I, 1, S#state.callbacks), -% callback)). --define(get_AllCallback(S), lists:map(fun({_V, C}) -> C end, - S#state.callbacks)). --define(get_AllCallbackID(S), lists:map(fun({V, _C}) -> V end, - S#state.callbacks)). -%% ID:s --define(get_IdCounter(S), S#state.idCounter). - -%% Constraints --define(get_Constraint(S,I), find_obj(lists:keysearch(I, 1, S#state.constraints), - constraint)). --define(get_AllConstraints(S), lists:map(fun({I, C, _W, _WC, _K, T}) -> - ?create_ConstraintInfo(T, C, I) - end, - S#state.constraints)). --define(get_ConstraintAllData(S), S#state.constraints). --define(get_ConstraintData(S,I), lists:keysearch(I, 1, S#state.constraints)). --define(match_Type(S,I,ET), ets:lookup(S#state.etsR, {I, ET})). -%% Parse Tree --define(get_ParseTree(S,K), find_obj(ets:lookup(S#state.etsR, K), tree)). - -%%------------------- Data structures modifiers ------------------- -%% Callbacks --define(del_Callback(S,I), S#state{callbacks = - delete_obj(lists:keydelete(I,1, - S#state.callbacks), - S#state.callbacks, callback)}). --define(del_AllCallbacks(S), S#state{callbacks=[]}). --define(add_Callback(S,V,C), S#state{idCounter=V, - callbacks = [{V,C}|S#state.callbacks]}). -%% ID:s --define(set_IdCounter(S,V), S#state{idCounter=V}). --define(new_Id(S), 'CosNotification_Common':create_id(S#state.idCounter)). - -%% Constraints --define(del_Constraint(S, I), match_delete(S, S#state.constraints, I)). --define(del_AllConstraints(S), clear_DB(S)). --define(add_Constraint(S,I,C,W,_WC,K,T), S#state{constraints = - [{I, C, W, _WC, K, T}|S#state.constraints]}). --define(set_Constraints(S,C), S#state{constraints = C}). - --define(del_AllTypes(S), ets:match_delete(S#state.etsR, {'_','_',types})). --define(del_Type(S,I), ets:match_delete(S#state.etsR, {{I, '_'}, '_', types})). --define(add_Type(S,I,ET,K), ets:insert(S#state.etsR, {{I, ET}, K, types})). - -%% Parse Tree --define(add_ParseTree(S,K,T), ets:insert(S#state.etsR, {K, T, tree})). --define(del_ParseTree(S,K), ets:delete(S#state.etsR, K)). --define(del_AllParseTress(S), ets:match_delete(S#state.etsR, {'_','_',tree})). - -%%------------------- MISC ---------------------------------------- --define(is_EmptyFilter(S), S#state.constraints==[]). - --define(InfoSeq2EventTypeSeq(L), lists:flatten( - lists:map(fun(#'CosNotifyFilter_ConstraintInfo' - {constraint_expression= - #'CosNotifyFilter_ConstraintExp' - {event_types = ET}}) -> - ET - end, - L))). - -%%-----------------------------------------------------------% -%% Function : handle_info, code_change -%% Arguments: See gen_server documentation. -%% Effect : Functions demanded by the gen_server module. -%%------------------------------------------------------------ - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -handle_info(Info, State) -> - ?debug_print("INFO: ~p DATA: ~p~n", [State, Info]), - case Info of - {'EXIT', _Pid, _Reason} -> - {noreply, State}; - _ -> - {noreply, State} - end. - -%%----------------------------------------------------------% -%% Function : init, terminate -%% Arguments: -%%----------------------------------------------------------- - -init([FiFac, FacPid, ConstraintGr]) -> - process_flag(trap_exit, true), - {ok, ?get_InitState(FiFac, FacPid, ConstraintGr)}. - -terminate(_Reason, _State) -> - ok. - -%%----------------------------------------------------------- -%%------- Exported external attributes ---------------------- -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% Function : '_get_constraint_grammar'/2 -%% Type : readonly -%% Returns : Grammar - string() -%%----------------------------------------------------------- -'_get_constraint_grammar'(_OE_THIS, State) -> - {reply, ?get_Grammar(State), State}. - -%%----------------------------------------------------------- -%%------- Exported external functions ----------------------- -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% Function : add_constraints/3 -%% Arguments: CL - CosNotifyFilter::ConstraintExpSeq -%% Returns : CosNotifyFilter::ConstraintInfoSeq | -%% {'EXCEPTION', CosNotifyFilter::InvalidConstraint} -%%----------------------------------------------------------- -add_constraints(_OE_THIS, State, CL) -> - {NewState, Filters, Info, EventTSeq} = try_create_filters(State, CL), - NewState2=store_filters(NewState, Filters), - inform_callbacks(?get_AllCallback(NewState2), EventTSeq, []), - {reply, Info, NewState2}. - -%%----------------------------------------------------------% -%% Function : modify_constraints/4 -%% Arguments: IDs - CosNotifyFilter::ConstraintIDSeq -%% AddConstraintInfoSeq - CosNotifyFilter::ConstraintInfoSeq -%% Returns : ok | -%% {'EXCEPTION', CosNotifyFilter::InvalidConstraint} | -%% {'EXCEPTION', CosNotifyFilter::ConstraintNotFound} -%%----------------------------------------------------------- -%% The OMG specification (TC Document telecom/98-11-01, chapter -%% 3.2.1.3) states (concerning IDs): -%% -%% "If all input values supplied within a particular invocation -%% of this operation are valid, then the specific constraints -%% identified by the values contained in the first input parameter -%% will be deleted from the list of those encapsulated by the target -%% filter object." -%% -%% Hence, first we must check if all ID's exists before deleting. -modify_constraints(_OE_THIS, State, IDs, AddConstraintInfoSeq) -> - %% The following functions are 'safe', i.e., they do not alter any data. - RemoveConstraintInfoSeq = lookup_constraints(IDs, State), - lookup_constraints(AddConstraintInfoSeq, State), - {NewState, Filters, _Info, AddedEventTSeq} = - try_create_filters(State, AddConstraintInfoSeq), - RemovedEventTSeq = ?InfoSeq2EventTypeSeq(RemoveConstraintInfoSeq), - - %% We cannot change anything before our checks (see above). Hence, - %% do NOT move the following lines above this point. - NewState2 = delete_constraints(IDs, NewState), - -%% The OMG specification (TC Document telecom/98-11-01, chapter -%% 3.2.1.3) states (concerning AddConstraintInfoSeq): -%% -%% "If all input values supplied within a particular invocation of this -%% operation are valid, then the constraint expression associated with the -%% already encapsulated constraint identified by the numeric value contained -%% within each element of the input sequence will be modified to the new -%% constraint expression that is contained within the same sequence element." -%% -%% This, our interpretation, implies that ALL previous data related -%% to each unique ID should be removed and replaced by the new data. - - NewState3 = delete_constraints(AddConstraintInfoSeq, NewState2), - NewState4 = store_filters(NewState3, Filters), - inform_callbacks(?get_AllCallback(NewState4), - AddedEventTSeq, RemovedEventTSeq), - {reply, ok, NewState4}. - -%%----------------------------------------------------------% -%% Function : get_constraints/3 -%% Arguments: IDs - CosNotifyFilter::ConstraintIDSeq -%% Returns : CosNotifyFilter::ConstraintInfoSeq | -%% {'EXCEPTION', CosNotifyFilter::ConstraintNotFound} -%%----------------------------------------------------------- -get_constraints(_OE_THIS, State, IDs) -> - {reply, lookup_constraints(IDs, State), State}. - -%%----------------------------------------------------------% -%% Function : get_all_constraints/2 -%% Arguments: - -%% Returns : CosNotifyFilter::ConstraintInfoSeq -%%----------------------------------------------------------- -get_all_constraints(_OE_THIS, State) -> - {reply, ?get_AllConstraints(State), State}. - -%%----------------------------------------------------------% -%% Function : remove_all_constraints/2 -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -remove_all_constraints(_OE_THIS, State) -> - {reply, ok, ?del_AllConstraints(State)}. - -%%----------------------------------------------------------% -%% Function : destroy/2 -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -destroy(_OE_THIS, State) -> - {stop, normal, ok, State}. - -%%----------------------------------------------------------% -%% Function : match/3 -%% Arguments: Event - #any{} -%% Returns : boolean() | -%% {'EXCEPTION', CosNotifyFilter::UnsupportedFilterableData} -%%----------------------------------------------------------- - -match(_OE_THIS, State, Event) when is_record(Event,'any'), ?is_EmptyFilter(State) -> - {reply, true, State}; -match(_OE_THIS, State, Event) when is_record(Event,'any') -> - match_any_event(State, Event, ?get_ConstraintAllData(State)); -match(_,_,What) -> - orber:dbg("[~p] CosNotifyFilter_Filter:match(~p);~n" - "Not an CORBA::Any", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% Function : match_structured/3 -%% Arguments: Event - CosNotification::StructuredEvent -%% Returns : boolean() | -%% {'EXCEPTION', CosNotifyFilter::UnsupportedFilterableData} -%%----------------------------------------------------------- -match_structured(_OE_THIS, State, Event) when - is_record(Event,'CosNotification_StructuredEvent') andalso ?is_EmptyFilter(State) -> - {reply, true, State}; -match_structured(_OE_THIS, State, Event) when - is_record(Event,'CosNotification_StructuredEvent') -> - match_str_event(State, Event, ?get_ConstraintAllData(State)); -match_structured(_,_,What) -> - orber:dbg("[~p] CosNotifyFilter_Filter:match_structured(~p);~n" - "Not a StructuredEvent", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------* -%% Function : match_typed/3 -%% Arguments: Data - CosNotification::PropertySeq -%% Returns : boolean() | -%% {'EXCEPTION', CosNotifyFilter::UnsupportedFilterableData} -%%----------------------------------------------------------- --spec match_typed(_, _, _) -> no_return(). -match_typed(_OE_THIS, _State, _Data) -> - corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% Function : attach_callback/3 -%% Arguments: CB - CosNotifyComm::NotifySubscribe -%% Returns : ID - CosNotifyFilter::CallbackID -%%----------------------------------------------------------- -attach_callback(_OE_THIS, State, CB) -> - 'CosNotification_Common':type_check(CB, 'CosNotifyComm_NotifySubscribe'), - CBID = ?new_Id(State), - {reply, CBID, ?add_Callback(State, CBID, CB)}. - -%%----------------------------------------------------------% -%% Function : detach_callback/3 -%% Arguments: ID - CosNotifyFilter::CallbackID -%% Returns : ok | {'EXCEPTION', CosNotifyFilter::CallbackNotFound} -%%----------------------------------------------------------- -detach_callback(_OE_THIS, State, ID) when is_integer(ID) -> - {reply, ok, ?del_Callback(State, ID)}; -detach_callback(_,_,What) -> - orber:dbg("[~p] CosNotifyFilter_Filter:detach_callback(~p);~n" - "Not an integer", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% Function : get_callbacks/2 -%% Arguments: - -%% Returns : CosNotifyFilter::CallbackIDSeq -%%----------------------------------------------------------- -get_callbacks(_OE_THIS, State) -> - {reply, ?get_AllCallbackID(State), State}. - -%%--------------- LOCAL FUNCTIONS ---------------------------- -%% To match callbacks -find_obj({value, {_, Obj}},_) -> Obj; -%% To match constraints -find_obj({value, {Id, Con, _, _, _, Types}}, _) -> - ?create_ConstraintInfo(Types, Con, Id); -find_obj([{_, Tree, tree}|_], tree) -> Tree; -% Left out for now to avoid dialyzer warning. -%find_obj(_,callback) -> {'EXCEPTION', #'CosNotifyFilter_CallbackNotFound'{}}; -find_obj(_,tree) -> undefined; -find_obj(_,constraint) -> error. - -%% Delete a single object. -delete_obj(List,List,callback) -> corba:raise(#'CosNotifyFilter_CallbackNotFound'{}); -delete_obj(List,_,_) -> List. - -%% Delete given object from list and all related objects in DB (parse tree and types). -match_delete(State, Constraints, ID) -> - match_delete(State, Constraints, ID, []). -match_delete(_, [], _, _) -> - error; -match_delete(State, [{ID, _Con, _Which, _WC, Key, _Types}|T], ID, Acc) -> - ?del_Type(State, ID), - ?del_ParseTree(State, Key), - {ok, ?set_Constraints(State, Acc++T)}; -match_delete(State, [H|T], ID, Acc) -> - match_delete(State, T, ID, [H|Acc]). - -%% Remove all data related with constraints; for now, since no other data -%% stored in DB, we do in a rather brutal way. -clear_DB(State) -> - catch ets:delete(State#state.etsR), - State#state{etsR = ets:new(oe_ets, [bag, protected]), constraints=[]}. - -%% Given a list of Constrain IDs we want to find the related constraints. -%% !!!!!! This function may not alter any data in DB in any way !!!!!!!!!! -lookup_constraints(IDs, State) -> - lookup_constraints(IDs, State, []). -lookup_constraints([], _State, Accum) -> - Accum; -lookup_constraints([H|T], State, Accum) - when is_record(H, 'CosNotifyFilter_ConstraintInfo') -> - case ?get_Constraint(State, H#'CosNotifyFilter_ConstraintInfo'.constraint_id) of - error -> - corba:raise(#'CosNotifyFilter_ConstraintNotFound' - {id = H#'CosNotifyFilter_ConstraintInfo'.constraint_id}); - _Con -> - %% We don't need to collect the result since the input already is of - %% the correct type, i.e., ConstraintInfoSeq - lookup_constraints(T, State, Accum) - end; -lookup_constraints([H|T], State, Accum) when is_integer(H) -> - case ?get_Constraint(State,H) of - error -> - corba:raise(#'CosNotifyFilter_ConstraintNotFound'{id=H}); - Con -> - lookup_constraints(T, State, [Con|Accum]) - end; -lookup_constraints(_, _, _) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%% Given a list of Constrain IDs we want to delet the related constraints. -%% We need also to return the ConstraintInfoSeq described related to the -%% given ID's. -delete_constraints([], State) -> - State; -delete_constraints([H|T], State) - when is_record(H, 'CosNotifyFilter_ConstraintInfo') -> - case catch ?del_Constraint(State, - H#'CosNotifyFilter_ConstraintInfo'.constraint_id) of - {ok, NewState} -> - delete_constraints(T, NewState); - Reason -> - orber:dbg("[~p] 'CosNotifyFilter_Filter':modify_constraints().~n" - "Unable to remove: ~p~n" - "Reason: ~p~n", - [?LINE, H, Reason], ?DEBUG_LEVEL), - delete_constraints(T, State) - end; -delete_constraints([H|T], State) -> - case catch ?del_Constraint(State,H) of - {ok, NewState} -> - delete_constraints(T, NewState); - Reason -> - orber:dbg("[~p] 'CosNotifyFilter_Filter':modify_constraints().~n" - "Unable to remove: ~p~n" - "Reason: ~p~n", - [?LINE, H, Reason], ?DEBUG_LEVEL), - delete_constraints(T, State) - end. - -%% Inform all registered callbacks that the constraints have changed. -%% Added and Removed must be a CosNotification::EventTypeSeq -inform_callbacks([],_,_) -> - ok; -inform_callbacks([H|T], Added, Removed) -> - case catch 'CosNotifyComm_NotifySubscribe':subscription_change(H, Added, Removed) of - ok -> - ?debug_print("INFORMED CALLBACK: ~p ADDED: ~p REMOVED: ~p", - [H, Added, Removed]), - inform_callbacks(T, Added, Removed); - Other -> - orber:dbg("[~p] 'CosNotifyComm_NotifySubscribe':subscription_change().~n" - "Unable to inform callback: ~p~n" - "Reason: ~p~n", - [?LINE, H, Other], ?DEBUG_LEVEL), - inform_callbacks(T, Added, Removed) - end. - -%%----------------------------------------------------------- -%% Function : try_create_filters/2 -%% Arguments: CL - #'CosNotifyFilter_ConstraintExp'{ -%% event_types = [#'CosNotification_EventType'{ -%% domain_name = Str, type_name = Str}] -%% constraint_expr = Str} -%% Returns : {State, AccumList} -%%----------------------------------------------------------- -%% !!!!!! This function may not alter any data in DB in any way !!!!!!!!!! -try_create_filters(State, CL) -> - try_create_filters(State, CL, [], [], []). -try_create_filters(State, [], Accum, InfoSeq, EventTSeq) -> - {State, Accum, InfoSeq, EventTSeq}; -try_create_filters(State, [#'CosNotifyFilter_ConstraintExp'{event_types = Types, - constraint_expr = Con}|T], - Accum, InfoSeq, EventTSeq) -> - case catch cosNotification_Filter:create_filter(Con) of - {ok, Tree} -> - case catch cosNotification_Filter:check_types(Types) of - true -> - ID = ?new_Id(State), - Key = ?not_CreateDBKey, - NewETSeq = Types ++ EventTSeq, - try_create_filters(?set_IdCounter(State, ID), T, - [{ID, true, [], Key, Types, Con, Tree}|Accum], - [?create_ConstraintInfo(Types, Con, ID)|InfoSeq], - NewETSeq); - {ok, Which, WC} -> - ID = ?new_Id(State), - Key = ?not_CreateDBKey, - NewETSeq = Types ++ EventTSeq, - try_create_filters(?set_IdCounter(State, ID), T, - [{ID, Which, WC, Key, Types, Con, Tree}|Accum], - [?create_ConstraintInfo(Types, Con, ID)|InfoSeq], - NewETSeq); - _ -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end; - _ -> - corba:raise(#'CosNotifyFilter_InvalidConstraint' - {constr = #'CosNotifyFilter_ConstraintExp' - {event_types = Types, constraint_expr = Con}}) - end; -try_create_filters(State, [#'CosNotifyFilter_ConstraintInfo' - {constraint_expression = #'CosNotifyFilter_ConstraintExp' - {event_types = Types, constraint_expr = Con}, - constraint_id=ID}|T], Accum, InfoSeq, EventTSeq) -> - case catch cosNotification_Filter:create_filter(Con) of - {ok, Tree} -> - case catch cosNotification_Filter:check_types(Types) of - true -> - Key = ?not_CreateDBKey, - NewETSeq = Types ++ EventTSeq, - try_create_filters(State, T, - [{ID, true, [], Key, Types, Con, Tree}|Accum], - [?create_ConstraintInfo(Types, Con, ID)|InfoSeq], - NewETSeq); - {ok, Which, WC} -> - Key = ?not_CreateDBKey, - NewETSeq = Types ++ EventTSeq, - try_create_filters(State, T, - [{ID, Which, WC, Key, Types, Con, Tree}|Accum], - [?create_ConstraintInfo(Types, Con, ID)|InfoSeq], - NewETSeq); - _ -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end; - _ -> - corba:raise(#'CosNotifyFilter_InvalidConstraint' - {constr = #'CosNotifyFilter_ConstraintExp' - {event_types = Types, constraint_expr = Con}}) - end; -try_create_filters(_,_,_,_,_) -> - %% The list contained something else but ConstraintExp. - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------- -%% Function : store_filters/4 -%% Arguments: Filters - a list of filters. -%% Returns : -%%----------------------------------------------------------- - -store_filters(State, []) -> - State; -store_filters(State, [{ID, Which, WC, Key, Types, Con, Tree}|T]) -> - ?add_ParseTree(State, Key, Tree), - write_types(State, Types, ID, Key), - store_filters(?add_Constraint(State, ID, Con, Which, WC, Key, Types), T). - - -write_types(_State, [],_, _) -> - ok; -write_types(State, [EventType|T], ID, Key) -> - ?add_Type(State, ID, EventType, Key), - ?debug_print("FILTER: ~p ~p ~p~n", [ID, Key, EventType]), - write_types(State, T, ID, Key). - -%%----------------------------------------------------------- -%% Function : match_any_event -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -match_any_event(State, _Event, []) -> - ?debug_print("FILTER REJECTED: ~p~n", [_Event]), - {reply, false, State}; -match_any_event(State, Event, [{_, _, _, _, Key, _}|T]) -> - case catch cosNotification_Filter:eval(?get_ParseTree(State,Key), Event) of - true -> - ?debug_print("FILTER APPROVED (WC): ~p~n", [Event]), - {reply, true, State}; - _ -> - match_any_event(State, Event, T) - end. - - -%%----------------------------------------------------------- -%% Function : match_str_event -%% Arguments: -%% Returns : -%%----------------------------------------------------------- - -match_str_event(State, _Event, []) -> - ?debug_print("FILTER REJECTED: ~p~n", [_Event]), - {reply, false, State}; -match_str_event(State, Event, [{ID, _Con, Which, WC, Key, _Types}|T]) -> - ET = ((Event#'CosNotification_StructuredEvent'.header) - #'CosNotification_EventHeader'.fixed_header) - #'CosNotification_FixedEventHeader'.event_type, - CheckList = - case Which of - both -> - [ET]; - domain -> - [ET, - ET#'CosNotification_EventType'{type_name=""}, - ET#'CosNotification_EventType'{type_name="*"}]; - type -> - [ET, - ET#'CosNotification_EventType'{domain_name=""}, - ET#'CosNotification_EventType'{domain_name="*"}]; - _ -> - [ET, - ET#'CosNotification_EventType'{type_name=""}, - ET#'CosNotification_EventType'{type_name="*"}, - ET#'CosNotification_EventType'{domain_name=""}, - ET#'CosNotification_EventType'{domain_name="*"}] - end, - case check_DB(State, ID, CheckList) of - false -> - %% No match, may have used wildcards, e.g., "dom*". - case catch cosNotification_Filter:match_types( - ET#'CosNotification_EventType'.domain_name, - ET#'CosNotification_EventType'.type_name, - WC) of - true -> - case catch cosNotification_Filter:eval(?get_ParseTree(State,Key), - Event) of - true -> - ?debug_print("FILTER APPROVED (WC): ~p~n", [Event]), - {reply, true, State}; - _ -> - match_str_event(State, Event, T) - end; - _-> - match_str_event(State, Event, T) - end; - Key -> - case catch cosNotification_Filter:eval(?get_ParseTree(State,Key), - Event) of - true -> - ?debug_print("FILTER APPROVED: ~p~n", [Event]), - {reply, true, State}; - _ -> - match_str_event(State, Event, T) - end - end. - -check_DB(_, _, []) -> - false; -check_DB(State, ID, [H|T]) -> - case ?match_Type(State, ID, H) of - [] -> - check_DB(State, ID, T); - [{_, K, types}|_] -> - K - end. - - -%%--------------- MISC FUNCTIONS, E.G. DEBUGGING ------------- -%%--------------- END OF MODULE ------------------------------ - diff --git a/lib/cosNotification/src/CosNotifyFilter_MappingFilter_impl.erl b/lib/cosNotification/src/CosNotifyFilter_MappingFilter_impl.erl deleted file mode 100644 index 03c0e03be6..0000000000 --- a/lib/cosNotification/src/CosNotifyFilter_MappingFilter_impl.erl +++ /dev/null @@ -1,580 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosNotifyFilter_MappingFilter_impl.erl -%% Purpose : -%%---------------------------------------------------------------------- - --module('CosNotifyFilter_MappingFilter_impl'). - -%%--------------- INCLUDES ----------------------------------- -%% Application files --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% Application files --include("CosNotification.hrl"). --include("CosNotifyChannelAdmin.hrl"). --include("CosNotifyComm.hrl"). --include("CosNotifyFilter.hrl"). --include("CosNotification_Definitions.hrl"). - -%%--------------- IMPORTS ------------------------------------ - -%%--------------- EXPORTS ------------------------------------ -%% External Attributes --export(['_get_constraint_grammar'/2, - '_get_value_type'/2, - '_get_default_value'/2]). -%% External Functions --export([add_mapping_constraints/3, - modify_mapping_constraints/4, - get_mapping_constraints/3, - get_all_mapping_constraints/2, - remove_all_mapping_constraints/2, - destroy/2, - match/3, - match_structured/3, - match_typed/3]). - -%%--------------- gen_server specific exports ---------------- --export([handle_info/2, code_change/3]). --export([init/1, terminate/2]). - -%%--------------- LOCAL DEFINITIONS -------------------------- -%%######### MISC ########## --define(create_MappingInfo(_Types, _Con, _ID, _A), - #'CosNotifyFilter_MappingConstraintInfo'{ - constraint_expression = - #'CosNotifyFilter_ConstraintExp'{ - event_types = _Types, - constraint_expr = _Con}, - constraint_id = _ID, - value = _A - }). -%%#### Data structures #### --record(state, {constraint_grammar, - value, - typeC, - constraints = [], - filters = [], - idCounter = 0, - filterFactory, - factoryPid, - etsR}). - -%% Data structures constructors --define(get_InitState(Gr, DVal, FF, FP), - #state{constraint_grammar=Gr, - value = DVal, - typeC = any:get_typecode(DVal), - filterFactory = FF, - factoryPid = FP, - etsR = ets:new(oe_ets, [bag, protected])}). - -%%------------------- Data structures selectors ------------------- -%% Attributes --define(get_Grammar(S), S#state.constraint_grammar). --define(get_DefVal(S), S#state.value). --define(get_DefTC(S), S#state.typeC). --define(get_DefAny(S), S#state.value). - -%% ID:s --define(get_IdCounter(S), S#state.idCounter). - -%% Constraints --define(get_Constraint(S,I), find_obj(lists:keysearch(I, 1, S#state.constraints), - constraint)). --define(get_AllConstraints(S), lists:map(fun({I, C, _W, _WC, _K, T, A}) -> - ?create_MappingInfo(T, C, I, A) - end, - S#state.constraints)). --define(get_ConstraintAllData(S), S#state.constraints). --define(get_ConstraintData(S,I), lists:keysearch(I, 1, S#state.constraints)). --define(match_Type(S,I,ET), ets:lookup(S#state.etsR, {I, ET})). -%% Parse Tree --define(get_ParseTree(S,K), find_obj(ets:lookup(S#state.etsR, K), tree)). - -%%------------------- Data structures modifiers ------------------- -%% ID:s --define(set_IdCounter(S,V), S#state{idCounter=V}). --define(new_Id(S), 'CosNotification_Common':create_id(S#state.idCounter)). - -%% Constraints --define(del_Constraint(S, I), match_delete(S, S#state.constraints, I)). --define(del_AllConstraints(S), clear_DB(S)). --define(add_Constraint(S,I,C,W,_WC,K,T,A), S#state{constraints = - [{I, C, W, _WC, K, T, A}|S#state.constraints]}). --define(set_Constraints(S,C), S#state{constraints = C}). - --define(del_AllTypes(S), ets:match_delete(S#state.etsR, {'_','_',types})). --define(del_Type(S,I), ets:match_delete(S#state.etsR, {{I, '_'}, '_', types})). --define(add_Type(S,I,ET,K), ets:insert(S#state.etsR, {{I, ET}, K, types})). - -%% Parse Tree --define(add_ParseTree(S,K,T), ets:insert(S#state.etsR, {K, T, tree})). --define(del_ParseTree(S,K), ets:delete(S#state.etsR, K)). --define(del_AllParseTress(S), ets:match_delete(S#state.etsR, {'_','_',tree})). - -%%------------------- MISC ---------------------------------------- --define(is_EmptyFilter(S), S#state.constraints==[]). --define(is_EqualType(S,T), S#state.typeC==any:get_typecode(T)). - -%%-----------------------------------------------------------% -%% function : handle_info, code_change -%% Arguments: See gen_server documentation. -%% Effect : Functions demanded by the gen_server module. -%%------------------------------------------------------------ - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -handle_info(Info, State) -> - ?debug_print("INFO: ~p DATA: ~p~n", [State, Info]), - case Info of - {'EXIT', _Pid, _Reason} -> - {noreply, State}; - _ -> - {noreply, State} - end. - -%%----------------------------------------------------------% -%% function : init, terminate -%% Arguments: -%%----------------------------------------------------------- - -init([FiFac, FacPid, InitGr, DefVal]) -> - process_flag(trap_exit, true), - {ok, ?get_InitState(InitGr, DefVal, FiFac, FacPid)}. - -terminate(_Reason, _State) -> - ok. - -%%----------------------------------------------------------- -%%------- Exported external attributes ---------------------- -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% Function : '_get_constraint_grammar'/2 -%% Type : readonly -%% Returns : string() -%%----------------------------------------------------------- -'_get_constraint_grammar'(_OE_THIS, State) -> - {reply, ?get_Grammar(State), State}. -%%----------------------------------------------------------% -%% Function : '_get_value_type'/2 -%% Type : readonly -%% Returns : CORBA::TypeCode -%%----------------------------------------------------------- -'_get_value_type'(_OE_THIS, State) -> - {reply, ?get_DefTC(State), State}. -%%----------------------------------------------------------% -%% Function : '_get_default_value'/2 -%% Type : readonly -%% Returns : #any{} -%%----------------------------------------------------------- -'_get_default_value'(_OE_THIS, State) -> - {reply, ?get_DefVal(State), State}. - -%%----------------------------------------------------------- -%%------- Exported external functions ----------------------- -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% Function : add_mapping_constraints/3 -%% Arguments: Pairs - CosNotifyFilter::MappingConstraintPairSeq -%% Returns : CosNotifyFilter::MappingConstraintInfoSeq | -%% {'EXCEPTION', CosNotifyFilter::InvalidConstraint} | -%% {'EXCEPTION', CosNotifyFilter::InvalidValue} -%%----------------------------------------------------------- -add_mapping_constraints(_OE_THIS, State, Pairs) -> - {NewState, Filters, Info} = try_create_filters(State, Pairs), - NewState2=store_filters(NewState, Filters), - {reply, Info, NewState2}. - -%%----------------------------------------------------------% -%% Function : modify_mapping_constraints/4 -%% Arguments: IDs - CosNotifyFilter::ConstraintIDSeq -%% Info - CosNotifyFilter::MappingConstraintInfoSeq -%% Returns : ok | -%% {'EXCEPTION', CosNotifyFilter::InvalidConstraint} | -%% {'EXCEPTION', CosNotifyFilter::InvalidValue} | -%% {'EXCEPTION', CosNotifyFilter::ConstraintNotFound} -%%----------------------------------------------------------- -modify_mapping_constraints(_OE_THIS, State, IDs, InfoSeq) -> - lookup_constraints(IDs, State), - lookup_constraints(InfoSeq, State), - {NewState, Filters, _Info} = try_create_filters(State, InfoSeq), - - %% We cannot change anything before our checks (see above). Hence, - %% do NOT move the following lines above this point. - - NewState2 = delete_constraints(IDs, NewState), - NewState3 = delete_constraints(InfoSeq, NewState2), - NewState4 = store_filters(NewState3, Filters), - {reply, ok, NewState4}. - -%%----------------------------------------------------------% -%% Function : get_mapping_constraints/3 -%% Arguments: IDs - CosNotifyFilter::ConstraintIDSeq -%% Returns : CosNotifyFilter::MappingConstraintInfoSeq | -%% {'EXCEPTION', CosNotifyFilter::ConstraintNotFound} -%%----------------------------------------------------------- -get_mapping_constraints(_OE_THIS, State, IDs) -> - {reply, lookup_constraints(IDs, State), State}. - -%%----------------------------------------------------------% -%% Function : get_all_mapping_constraints/2 -%% Arguments: - -%% Returns : CosNotifyFilter::MappingConstraintInfoSeq -%%----------------------------------------------------------- -get_all_mapping_constraints(_OE_THIS, State) -> - {reply, ?get_AllConstraints(State), State}. - -%%----------------------------------------------------------% -%% Function : remove_all_mapping_constraints/2 -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -remove_all_mapping_constraints(_OE_THIS, State) -> - {reply, ok, ?del_AllConstraints(State)}. - -%%----------------------------------------------------------% -%% Function : destroy/2 -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -destroy(_OE_THIS, State) -> - {stop, normal, ok, State}. - -%%----------------------------------------------------------% -%% Function : match/3 -%% Arguments: Event - #any{} -%% Returns : boolean(), #any{} (out-type) | -%% {'EXCEPTION', CosNotifyFilter::UnsupportedFilterableData} -%%----------------------------------------------------------- -match(_OE_THIS, State, Event) when is_record(Event,'any') andalso ?is_EmptyFilter(State) -> - {reply, {false, ?get_DefAny(State)}, State}; -match(_OE_THIS, State, Event) when is_record(Event,'any') -> - match_any_event(State, Event, ?get_ConstraintAllData(State)); -match(_,_,_) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - - -%%----------------------------------------------------------% -%% Function : match_structured/3 -%% Arguments: Event - CosNotification::StructuredEvent -%% Returns : boolean(), #any{} (out-type) | -%% {'EXCEPTION', CosNotifyFilter::UnsupportedFilterableData} -%%----------------------------------------------------------- -match_structured(_OE_THIS, State, Event) when - is_record(Event,'CosNotification_StructuredEvent') andalso ?is_EmptyFilter(State) -> - {reply, {false, ?get_DefAny(State)}, State}; -match_structured(_OE_THIS, State, Event) when - is_record(Event,'CosNotification_StructuredEvent') -> - match_str_event(State, Event, ?get_ConstraintAllData(State)); -match_structured(_,_,_) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------* -%% Function : match_typed/3 -%% Arguments: Data - CosNotification::PropertySeq -%% Returns : boolean() , #any{} (out-type) | -%% {'EXCEPTION', CosNotifyFilter::UnsupportedFilterableData} -%%----------------------------------------------------------- --spec match_typed(_, _, _) -> no_return(). -match_typed(_OE_THIS, _State, _Data) -> - corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_NO}). - -%%--------------- LOCAL FUNCTIONS ---------------------------- -%% To match constraints -find_obj({value, {Id, Con, _, _, _, Types, Any}}, _) -> - ?create_MappingInfo(Types, Con, Id, Any); -find_obj([{_, Tree, tree}|_], tree) -> Tree; -find_obj(_,tree) -> undefined; -find_obj(_,constraint) -> error. - -%% Delete given object from list and all related objects in DB (parse tree and types). -match_delete(State, Constraints, ID) -> - match_delete(State, Constraints, ID, []). -match_delete(_, [], _, _) -> - error; -match_delete(State, [{ID, _Con, _Which, _WC, Key, _Types, _Any}|T], ID, Acc) -> - ?del_Type(State, ID), - ?del_ParseTree(State, Key), - {ok, ?set_Constraints(State, Acc++T)}; -match_delete(State, [H|T], ID, Acc) -> - match_delete(State, T, ID, [H|Acc]). - -%% Remove all data related with constraints; for now, since no other data -%% stored in DB, we do in a rather brutal way. -clear_DB(State) -> - catch ets:delete(State#state.etsR), - State#state{etsR = ets:new(oe_ets, [bag, protected]), constraints=[]}. - -%% Given a list of Constrain IDs we want to find the related constraints. -%% !!!!!! This function may not alter any data in DB in any way !!!!!!!!!! -lookup_constraints(IDs, State) -> - lookup_constraints(IDs, State, []). -lookup_constraints([], _State, Accum) -> - Accum; -lookup_constraints([H|T], State, Accum) - when is_record(H, 'CosNotifyFilter_MappingConstraintInfo') -> - case ?get_Constraint(State, H#'CosNotifyFilter_MappingConstraintInfo'.constraint_id) of - error -> - corba:raise(#'CosNotifyFilter_ConstraintNotFound' - {id = H#'CosNotifyFilter_MappingConstraintInfo'.constraint_id}); - _Con -> - %% We don't need to collect the result since the input already is of - %% the correct type, i.e., ConstraintInfoSeq - lookup_constraints(T, State, Accum) - end; -lookup_constraints([H|T], State, Accum) when is_integer(H) -> - case ?get_Constraint(State,H) of - error -> - corba:raise(#'CosNotifyFilter_ConstraintNotFound'{id=H}); - Con -> - lookup_constraints(T, State, [Con|Accum]) - end; -lookup_constraints(_, _, _) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%% Given a list of Constrain IDs we want to delet the related constraints. -%% We need also to return the ConstraintInfoSeq described related to the -%% given ID's. -delete_constraints([], State) -> - State; -delete_constraints([H|T], State) - when is_record(H, 'CosNotifyFilter_MappingConstraintInfo') -> - case catch ?del_Constraint(State, - H#'CosNotifyFilter_MappingConstraintInfo'.constraint_id) of - {ok, NewState} -> - delete_constraints(T, NewState); - Reason -> - orber:dbg("[~p] 'CosNotifyFilter_MappingFilter':modify_mapping_constraints().~n" - "Unable to remove: ~p~n" - "Reason: ~p~n", - [?LINE, H, Reason], ?DEBUG_LEVEL), - delete_constraints(T, State) - end; -delete_constraints([H|T], State) -> - case catch ?del_Constraint(State,H) of - {ok, NewState} -> - delete_constraints(T, NewState); - Reason -> - orber:dbg("[~p] 'CosNotifyFilter_MappingFilter':modify_mapping_constraints().~n" - "Unable to remove: ~p~n" - "Reason: ~p~n", - [?LINE, H, Reason], ?DEBUG_LEVEL), - delete_constraints(T, State) - end. - -%%----------------------------------------------------------- -%% Function : try_create_filters/2 -%% Arguments: CL - #'CosNotifyFilter_MappingConstraintPair{ -%% constraint_expression = -%% #'CosNotifyFilter_ConstraintExp'{ -%% event_types = -%% [#'CosNotification_EventType'{ -%% domain_name = Str, type_name = Str}] -%% constraint_expr = Str}, -%% result_to_set = Any} -%% Returns : {State, AccumList} -%%----------------------------------------------------------- -%% !!!!!! This function may not alter any data in DB in any way !!!!!!!!!! -try_create_filters(State, CL) -> - try_create_filters(State, CL, [], []). -try_create_filters(State, [], Accum, InfoSeq) -> - {State, Accum, InfoSeq}; -try_create_filters(State, [#'CosNotifyFilter_MappingConstraintPair' - {constraint_expression = - #'CosNotifyFilter_ConstraintExp'{event_types = Types, - constraint_expr = Con}, - result_to_set=Any}|T], Accum, InfoSeq) -> - case catch {?is_EqualType(State,Any), cosNotification_Filter:create_filter(Con)} of - {false, _} -> - corba:raise(#'CosNotifyFilter_InvalidValue' - {constr = #'CosNotifyFilter_ConstraintExp' - {event_types = Types, constraint_expr = Con}, - value=Any}); - {_, {ok, Tree}} -> - case catch cosNotification_Filter:check_types(Types) of - true -> - ID = ?new_Id(State), - Key = ?not_CreateDBKey, - try_create_filters(?set_IdCounter(State, ID), T, - [{ID, true, [], Key, Types, Con, Tree, Any}|Accum], - [?create_MappingInfo(Types, Con, ID, Any)|InfoSeq]); - {ok, Which, WC} -> - ID = ?new_Id(State), - Key = ?not_CreateDBKey, - try_create_filters(?set_IdCounter(State, ID), T, - [{ID, Which, WC, Key, Types, Con, Tree, Any}|Accum], - [?create_MappingInfo(Types, Con, ID, Any)|InfoSeq]); - _ -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end; - _ -> - corba:raise(#'CosNotifyFilter_InvalidConstraint' - {constr = #'CosNotifyFilter_ConstraintExp' - {event_types = Types, constraint_expr = Con}}) - end; -try_create_filters(State, [#'CosNotifyFilter_MappingConstraintInfo' - {constraint_expression = #'CosNotifyFilter_ConstraintExp' - {event_types = Types, constraint_expr = Con}, - constraint_id=ID, - value=Any}|T], Accum, InfoSeq) -> - case catch cosNotification_Filter:create_filter(Con) of - {ok, Tree} -> - case catch cosNotification_Filter:check_types(Types) of - true -> - Key = ?not_CreateDBKey, - try_create_filters(State, T, - [{ID, true, [], Key, Types, Con, Tree, Any}|Accum], - [?create_MappingInfo(Types, Con, ID, Any)|InfoSeq]); - {ok, Which, WC} -> - Key = ?not_CreateDBKey, - try_create_filters(State, T, - [{ID, Which, WC, Key, Types, Con, Tree, Any}|Accum], - [?create_MappingInfo(Types, Con, ID, Any)|InfoSeq]); - _ -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end; - _ -> - corba:raise(#'CosNotifyFilter_InvalidConstraint' - {constr = #'CosNotifyFilter_ConstraintExp' - {event_types = Types, constraint_expr = Con}}) - end; -try_create_filters(_,_,_,_) -> - %% The list contained something else but ConstraintExp. - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------- -%% Function : store_filters/4 -%% Arguments: Filters - a list of filters. -%% Returns : -%%----------------------------------------------------------- - -store_filters(State, []) -> - State; -store_filters(State, [{ID, Which, WC, Key, Types, Con, Tree, Any}|T]) -> - ?add_ParseTree(State, Key, Tree), - write_types(State, Types, ID, Key), - store_filters(?add_Constraint(State, ID, Con, Which, WC, Key, Types, Any), T). - - -write_types(_State, [],_, _) -> - ok; -write_types(State, [EventType|T], ID, Key) -> - ?add_Type(State, ID, EventType, Key), - ?debug_print("FILTER: ~p ~p ~p~n", [ID, Key, EventType]), - write_types(State, T, ID, Key). - -%%----------------------------------------------------------- -%% Function : match_any_event -%% Arguments: Event - #any{} -%% Returns : -%%----------------------------------------------------------- -match_any_event(State, _Event, []) -> - ?debug_print("FILTER REJECTED: ~p~n", [_Event]), - {reply, {false, ?get_DefAny(State)}, State}; -match_any_event(State, Event, [{_, _, _, _, Key, Any}|T]) -> - case catch cosNotification_Filter:eval(?get_ParseTree(State,Key), Event) of - true -> - ?debug_print("FILTER APPROVED (WC): ~p~n", [Event]), - {reply, {true, Any}, State}; - _ -> - match_any_event(State, Event, T) - end. - - -%%----------------------------------------------------------- -%% Function : match_str_event -%% Arguments: -%% Returns : -%%----------------------------------------------------------- - -match_str_event(State, _Event, []) -> - ?debug_print("FILTER REJECTED: ~p~n", [_Event]), - {reply, {false, ?get_DefAny(State)}, State}; -match_str_event(State, Event, [{ID, _Con, Which, WC, Key, _Types, Any}|T]) -> - ET = ((Event#'CosNotification_StructuredEvent'.header) - #'CosNotification_EventHeader'.fixed_header) - #'CosNotification_FixedEventHeader'.event_type, - CheckList = - case Which of - both -> - [ET]; - domain -> - [ET, - ET#'CosNotification_EventType'{type_name=""}, - ET#'CosNotification_EventType'{type_name="*"}]; - type -> - [ET, - ET#'CosNotification_EventType'{domain_name=""}, - ET#'CosNotification_EventType'{domain_name="*"}]; - _ -> - [ET, - ET#'CosNotification_EventType'{type_name=""}, - ET#'CosNotification_EventType'{type_name="*"}, - ET#'CosNotification_EventType'{domain_name=""}, - ET#'CosNotification_EventType'{domain_name="*"}] - end, - case check_DB(State, ID, CheckList) of - false -> - %% No match, may have used wildcards, e.g., "dom*". - case catch cosNotification_Filter:match_types( - ET#'CosNotification_EventType'.domain_name, - ET#'CosNotification_EventType'.type_name, - WC) of - true -> - case catch cosNotification_Filter:eval(?get_ParseTree(State,Key), - Event) of - true -> - ?debug_print("FILTER APPROVED (WC): ~p~n", [Event]), - {reply, {true, Any}, State}; - _ -> - match_str_event(State, Event, T) - end; - _-> - match_str_event(State, Event, T) - end; - Key -> - case catch cosNotification_Filter:eval(?get_ParseTree(State,Key), - Event) of - true -> - ?debug_print("FILTER APPROVED: ~p~n", [Event]), - {reply, {true, Any}, State}; - _ -> - match_str_event(State, Event, T) - end - end. - -check_DB(_, _, []) -> - false; -check_DB(State, ID, [H|T]) -> - case ?match_Type(State, ID, H) of - [] -> - check_DB(State, ID, T); - [{_, K, types}|_] -> - K - end. -%%--------------- MISC FUNCTIONS, E.G. DEBUGGING ------------- -%%--------------- END OF MODULE ------------------------------ - diff --git a/lib/cosNotification/src/CosTypedEvent.idl b/lib/cosNotification/src/CosTypedEvent.idl deleted file mode 100644 index d77c37731a..0000000000 --- a/lib/cosNotification/src/CosTypedEvent.idl +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef _COS_TYPED_EVENT_IDL_ -#define _COS_TYPED_EVENT_IDL_ - -#pragma prefix "omg.org" - -#include - -module CosTypedEventComm { - - interface TypedPushConsumer : CosEventComm::PushConsumer { - Object get_typed_consumer(); - }; - - interface TypedPullSupplier : CosEventComm::PullSupplier { - Object get_typed_supplier(); - }; -}; - -module CosTypedEventChannelAdmin { - - exception InterfaceNotSupported {}; - exception NoSuchImplementation {}; - typedef string Key; - - - interface TypedProxyPushConsumer : - CosEventChannelAdmin::ProxyPushConsumer, - CosTypedEventComm::TypedPushConsumer { }; - - interface TypedProxyPullSupplier : - CosEventChannelAdmin::ProxyPullSupplier, - CosTypedEventComm::TypedPullSupplier { }; - - interface TypedSupplierAdmin : - CosEventChannelAdmin::SupplierAdmin { - TypedProxyPushConsumer obtain_typed_push_consumer(in Key supported_interface) - raises(InterfaceNotSupported); - CosEventChannelAdmin::ProxyPullConsumer obtain_typed_pull_consumer (in Key uses_interface) - raises(NoSuchImplementation); - }; - - interface TypedConsumerAdmin : - CosEventChannelAdmin::ConsumerAdmin { - TypedProxyPullSupplier obtain_typed_pull_supplier(in Key supported_interface) - raises (InterfaceNotSupported); - CosEventChannelAdmin::ProxyPushSupplier obtain_typed_push_supplier(in Key uses_interface) - raises(NoSuchImplementation); - }; - - interface TypedEventChannel { - TypedConsumerAdmin for_consumers(); - TypedSupplierAdmin for_suppliers(); - void destroy (); - }; -}; - -#endif /* ifndef _COS_TYPED_EVENT_IDL_ */ diff --git a/lib/cosNotification/src/CosTypedNotification.idl b/lib/cosNotification/src/CosTypedNotification.idl deleted file mode 100644 index 882cde16e0..0000000000 --- a/lib/cosNotification/src/CosTypedNotification.idl +++ /dev/null @@ -1,109 +0,0 @@ -#ifndef _COS_TYPED_NOTIFICATION_IDL_ -#define _COS_TYPED_NOTIFICATION_IDL_ - -#pragma prefix "omg.org" - -#include -#include -#include - -module CosTypedNotifyComm { - interface TypedPushConsumer : CosTypedEventComm::TypedPushConsumer, CosNotifyComm::NotifyPublish { }; // TypedPushConsumer - - interface TypedPullSupplier : CosTypedEventComm::TypedPullSupplier, CosNotifyComm::NotifySubscribe { }; // TypedPullSupplier -}; // CosTypedNotifyComm - - -module CosTypedNotifyChannelAdmin { - // Forward declaration - interface TypedEventChannelFactory; - typedef string Key; - interface TypedProxyPushConsumer : CosNotifyChannelAdmin::ProxyConsumer, CosTypedNotifyComm::TypedPushConsumer { - void connect_typed_push_supplier (in CosEventComm::PushSupplier push_supplier) - raises (CosEventChannelAdmin::AlreadyConnected); - }; // TypedProxyPushConsumer - - interface TypedProxyPullSupplier : CosNotifyChannelAdmin::ProxySupplier, CosTypedNotifyComm::TypedPullSupplier { - void connect_typed_pull_consumer (in CosEventComm::PullConsumer pull_consumer) - raises (CosEventChannelAdmin::AlreadyConnected); - }; // TypedProxyPullSupplier - - interface TypedProxyPullConsumer : CosNotifyChannelAdmin::ProxyConsumer, CosNotifyComm::PullConsumer { - void connect_typed_pull_supplier (in CosTypedEventComm::TypedPullSupplier pull_supplier) - raises (CosEventChannelAdmin::AlreadyConnected, CosEventChannelAdmin::TypeError); - - void suspend_connection() - raises (CosNotifyChannelAdmin::ConnectionAlreadyInactive, CosNotifyChannelAdmin::NotConnected); - - void resume_connection() - raises (CosNotifyChannelAdmin::ConnectionAlreadyActive, CosNotifyChannelAdmin::NotConnected); - }; // TypedProxyPullConsumer - - interface TypedProxyPushSupplier : CosNotifyChannelAdmin::ProxySupplier, CosNotifyComm::PushSupplier { - void connect_typed_push_consumer (in CosTypedEventComm::TypedPushConsumer push_consumer) - raises (CosEventChannelAdmin::AlreadyConnected, CosEventChannelAdmin::TypeError); - - void suspend_connection() - raises (CosNotifyChannelAdmin::ConnectionAlreadyInactive, CosNotifyChannelAdmin::NotConnected); - - void resume_connection() - raises (CosNotifyChannelAdmin::ConnectionAlreadyActive, CosNotifyChannelAdmin::NotConnected); - }; // TypedProxyPushSupplier - - interface TypedConsumerAdmin : CosNotifyChannelAdmin::ConsumerAdmin, CosTypedEventChannelAdmin::TypedConsumerAdmin { - TypedProxyPullSupplier obtain_typed_notification_pull_supplier(in Key supported_interface, - out CosNotifyChannelAdmin::ProxyID proxy_id) - raises( CosTypedEventChannelAdmin::InterfaceNotSupported, CosNotifyChannelAdmin::AdminLimitExceeded ); - - TypedProxyPushSupplier obtain_typed_notification_push_supplier(in Key uses_interface, - out CosNotifyChannelAdmin::ProxyID proxy_id) - raises(CosTypedEventChannelAdmin::NoSuchImplementation, CosNotifyChannelAdmin::AdminLimitExceeded); - }; // TypedConsumerAdmin - - interface TypedSupplierAdmin : CosNotifyChannelAdmin::SupplierAdmin, CosTypedEventChannelAdmin::TypedSupplierAdmin { - TypedProxyPushConsumer obtain_typed_notification_push_consumer(in Key supported_interface, - out CosNotifyChannelAdmin::ProxyID proxy_id) - raises( CosTypedEventChannelAdmin::InterfaceNotSupported, CosNotifyChannelAdmin::AdminLimitExceeded); - TypedProxyPullConsumer obtain_typed_notification_pull_consumer(in Key uses_interface, - out CosNotifyChannelAdmin::ProxyID proxy_id ) - raises(CosTypedEventChannelAdmin::NoSuchImplementation, CosNotifyChannelAdmin::AdminLimitExceeded); - }; // TypedSupplierAdmin - - interface TypedEventChannel : CosNotification::QoSAdmin, CosNotification::AdminPropertiesAdmin, - CosTypedEventChannelAdmin::TypedEventChannel { - readonly attribute TypedEventChannelFactory MyFactory; - readonly attribute TypedConsumerAdmin default_consumer_admin; - readonly attribute TypedSupplierAdmin default_supplier_admin; - readonly attribute CosNotifyFilter::FilterFactory default_filter_factory; - - TypedConsumerAdmin new_for_typed_notification_consumers(in CosNotifyChannelAdmin::InterFilterGroupOperator op, - out CosNotifyChannelAdmin::AdminID id); - - TypedSupplierAdmin new_for_typed_notification_suppliers(in CosNotifyChannelAdmin::InterFilterGroupOperator op, - out CosNotifyChannelAdmin::AdminID id); - - TypedConsumerAdmin get_consumeradmin (in CosNotifyChannelAdmin::AdminID id ) - raises (CosNotifyChannelAdmin::AdminNotFound); - - TypedSupplierAdmin get_supplieradmin (in CosNotifyChannelAdmin::AdminID id) - raises (CosNotifyChannelAdmin::AdminNotFound); - - CosNotifyChannelAdmin::AdminIDSeq get_all_consumeradmins(); - - CosNotifyChannelAdmin::AdminIDSeq get_all_supplieradmins(); - }; // TypedEventChannel - - interface TypedEventChannelFactory { - TypedEventChannel create_typed_channel (in CosNotification::QoSProperties initial_QoS, - in CosNotification::AdminProperties initial_admin, - out CosNotifyChannelAdmin::ChannelID id) - raises( CosNotification::UnsupportedQoS, CosNotification::UnsupportedAdmin); - - CosNotifyChannelAdmin::ChannelIDSeq get_all_typed_channels(); - - TypedEventChannel get_typed_event_channel (in CosNotifyChannelAdmin::ChannelID id) - raises (CosNotifyChannelAdmin::ChannelNotFound); - }; // TypedEventChannelFactory -}; // CosTypedNotifyChannelAdmin - -#endif /* ifndef _COS_TYPED_NOTIFICATION_IDL_ */ diff --git a/lib/cosNotification/src/Makefile b/lib/cosNotification/src/Makefile deleted file mode 100644 index 009c6be4a5..0000000000 --- a/lib/cosNotification/src/Makefile +++ /dev/null @@ -1,379 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1999-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk - -ifeq ($(TYPE),debug) -ERL_COMPILE_FLAGS += -Ddebug -W -endif - -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../vsn.mk -VSN=$(COSNOTIFICATION_VSN) - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/cosNotification-$(VSN) - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- - -MODULES = \ - CosNotification_Common \ - CosNotifyChannelAdmin_ConsumerAdmin_impl \ - CosNotifyChannelAdmin_EventChannelFactory_impl \ - CosNotifyChannelAdmin_EventChannel_impl \ - CosNotifyChannelAdmin_SupplierAdmin_impl \ - CosNotifyFilter_Filter_impl \ - CosNotifyFilter_MappingFilter_impl \ - CosNotifyFilter_FilterFactory_impl \ - PullerConsumer_impl \ - PullerSupplier_impl \ - PusherConsumer_impl \ - PusherSupplier_impl \ - cosNotificationApp \ - cosNotification_Scanner \ - cosNotification_Filter \ - cosNotification_eventDB - -ERL_FILES = $(MODULES:%=%.erl) -HRL_FILES = \ - CosNotification_Definitions.hrl - -YECC_FILES = cosNotification_Grammar.yrl - -GEN_YECC_ERL_FILES = cosNotification_Grammar.erl - -GEN_YECC_HRL_FILES = - -GEN_NOTIFICATION_ERL_FILES = \ - oe_CosNotification.erl \ - CosNotification.erl \ - CosNotification_AdminPropertiesAdmin.erl \ - CosNotification_EventHeader.erl \ - CosNotification_EventType.erl \ - CosNotification_FixedEventHeader.erl \ - CosNotification_NamedPropertyRange.erl \ - CosNotification_Property.erl \ - CosNotification_PropertyError.erl \ - CosNotification_PropertyRange.erl \ - CosNotification_QoSAdmin.erl \ - CosNotification_StructuredEvent.erl \ - CosNotification_UnsupportedAdmin.erl \ - CosNotification_UnsupportedQoS.erl \ - CosNotification_EventBatch.erl \ - CosNotification_EventTypeSeq.erl \ - CosNotification_NamedPropertyRangeSeq.erl \ - CosNotification_PropertyErrorSeq.erl \ - CosNotification_PropertySeq.erl - -GEN_CHANNELADMIN_ERL_FILES = \ - oe_CosNotifyChannelAdmin.erl \ - CosNotifyChannelAdmin_AdminLimit.erl \ - CosNotifyChannelAdmin_AdminLimitExceeded.erl \ - CosNotifyChannelAdmin_AdminNotFound.erl \ - CosNotifyChannelAdmin_ChannelNotFound.erl \ - CosNotifyChannelAdmin_ConnectionAlreadyActive.erl \ - CosNotifyChannelAdmin_ConnectionAlreadyInactive.erl \ - CosNotifyChannelAdmin_ConsumerAdmin.erl \ - CosNotifyChannelAdmin_EventChannel.erl \ - CosNotifyChannelAdmin_EventChannelFactory.erl \ - CosNotifyChannelAdmin_NotConnected.erl \ - CosNotifyChannelAdmin_ProxyConsumer.erl \ - CosNotifyChannelAdmin_ProxyNotFound.erl \ - CosNotifyChannelAdmin_ProxyPullConsumer.erl \ - CosNotifyChannelAdmin_ProxyPullSupplier.erl \ - CosNotifyChannelAdmin_ProxyPushConsumer.erl \ - CosNotifyChannelAdmin_ProxyPushSupplier.erl \ - CosNotifyChannelAdmin_ProxySupplier.erl \ - CosNotifyChannelAdmin_SequenceProxyPullConsumer.erl \ - CosNotifyChannelAdmin_SequenceProxyPullSupplier.erl \ - CosNotifyChannelAdmin_SequenceProxyPushConsumer.erl \ - CosNotifyChannelAdmin_SequenceProxyPushSupplier.erl \ - CosNotifyChannelAdmin_StructuredProxyPullConsumer.erl \ - CosNotifyChannelAdmin_StructuredProxyPullSupplier.erl \ - CosNotifyChannelAdmin_StructuredProxyPushConsumer.erl \ - CosNotifyChannelAdmin_StructuredProxyPushSupplier.erl \ - CosNotifyChannelAdmin_SupplierAdmin.erl \ - CosNotifyChannelAdmin_AdminIDSeq.erl \ - CosNotifyChannelAdmin_ChannelIDSeq.erl \ - CosNotifyChannelAdmin_ProxyIDSeq.erl - -GEN_NOTIFYFILTER_ERL_FILES = \ - oe_CosNotifyFilter.erl \ - CosNotifyFilter_CallbackNotFound.erl \ - CosNotifyFilter_ConstraintExp.erl \ - CosNotifyFilter_ConstraintInfo.erl \ - CosNotifyFilter_ConstraintNotFound.erl \ - CosNotifyFilter_DuplicateConstraintID.erl \ - CosNotifyFilter_Filter.erl \ - CosNotifyFilter_FilterAdmin.erl \ - CosNotifyFilter_FilterFactory.erl \ - CosNotifyFilter_FilterNotFound.erl \ - CosNotifyFilter_InvalidConstraint.erl \ - CosNotifyFilter_InvalidGrammar.erl \ - CosNotifyFilter_InvalidValue.erl \ - CosNotifyFilter_MappingConstraintInfo.erl \ - CosNotifyFilter_MappingConstraintPair.erl \ - CosNotifyFilter_MappingFilter.erl \ - CosNotifyFilter_UnsupportedFilterableData.erl \ - CosNotifyFilter_CallbackIDSeq.erl \ - CosNotifyFilter_ConstraintExpSeq.erl \ - CosNotifyFilter_ConstraintIDSeq.erl \ - CosNotifyFilter_ConstraintInfoSeq.erl \ - CosNotifyFilter_FilterIDSeq.erl \ - CosNotifyFilter_MappingConstraintInfoSeq.erl \ - CosNotifyFilter_MappingConstraintPairSeq.erl - -GEN_NOTIFYCOMM_ERL_FILES = \ - oe_CosNotifyComm.erl \ - CosNotifyComm_InvalidEventType.erl \ - CosNotifyComm_NotifyPublish.erl \ - CosNotifyComm_NotifySubscribe.erl \ - CosNotifyComm_PullConsumer.erl \ - CosNotifyComm_PullSupplier.erl \ - CosNotifyComm_PushConsumer.erl \ - CosNotifyComm_PushSupplier.erl \ - CosNotifyComm_SequencePullConsumer.erl \ - CosNotifyComm_SequencePullSupplier.erl \ - CosNotifyComm_SequencePushConsumer.erl \ - CosNotifyComm_SequencePushSupplier.erl \ - CosNotifyComm_StructuredPullConsumer.erl \ - CosNotifyComm_StructuredPullSupplier.erl \ - CosNotifyComm_StructuredPushConsumer.erl \ - CosNotifyComm_StructuredPushSupplier.erl \ - -GEN_OE_EVENTCOMM_ERL_FILES = \ - oe_cosNotificationAppComm.erl \ - oe_CosNotificationComm_Event.erl - -EXTERNAL_INC_PATH = ../include - -GEN_NOTIFICATION_HRL_FILES = \ - oe_CosNotification.hrl \ - CosNotification.hrl \ - CosNotification_AdminPropertiesAdmin.hrl \ - CosNotification_QoSAdmin.hrl \ - -EXTERNAL_GEN_NOTIFICATION_HRL_FILES = \ - $(GEN_NOTIFICATION_HRL_FILES:%=$(EXTERNAL_INC_PATH)/%) - -GEN_CHANNELADMIN_HRL_FILES = \ - oe_CosNotifyChannelAdmin.hrl \ - CosNotifyChannelAdmin.hrl \ - CosNotifyChannelAdmin_ConsumerAdmin.hrl \ - CosNotifyChannelAdmin_EventChannel.hrl \ - CosNotifyChannelAdmin_EventChannelFactory.hrl \ - CosNotifyChannelAdmin_ProxyConsumer.hrl \ - CosNotifyChannelAdmin_ProxyPullConsumer.hrl \ - CosNotifyChannelAdmin_ProxyPullSupplier.hrl \ - CosNotifyChannelAdmin_ProxyPushConsumer.hrl \ - CosNotifyChannelAdmin_ProxyPushSupplier.hrl \ - CosNotifyChannelAdmin_ProxySupplier.hrl \ - CosNotifyChannelAdmin_SequenceProxyPullConsumer.hrl \ - CosNotifyChannelAdmin_SequenceProxyPullSupplier.hrl \ - CosNotifyChannelAdmin_SequenceProxyPushConsumer.hrl \ - CosNotifyChannelAdmin_SequenceProxyPushSupplier.hrl \ - CosNotifyChannelAdmin_StructuredProxyPullConsumer.hrl \ - CosNotifyChannelAdmin_StructuredProxyPullSupplier.hrl \ - CosNotifyChannelAdmin_StructuredProxyPushConsumer.hrl \ - CosNotifyChannelAdmin_StructuredProxyPushSupplier.hrl \ - CosNotifyChannelAdmin_SupplierAdmin.hrl \ - -EXTERNAL_GEN_CHANNELADMIN_HRL_FILES = \ - $(GEN_CHANNELADMIN_HRL_FILES:%=$(EXTERNAL_INC_PATH)/%) - -GEN_NOTIFYFILTER_HRL_FILES = \ - oe_CosNotifyFilter.hrl \ - CosNotifyFilter.hrl \ - CosNotifyFilter_Filter.hrl \ - CosNotifyFilter_FilterAdmin.hrl \ - CosNotifyFilter_FilterFactory.hrl \ - CosNotifyFilter_MappingFilter.hrl - -EXTERNAL_GEN_NOTIFYFILTER_HRL_FILES = \ - $(GEN_NOTIFYFILTER_HRL_FILES:%=$(EXTERNAL_INC_PATH)/%) - -GEN_NOTIFYCOMM_HRL_FILES = \ - oe_CosNotifyComm.hrl \ - CosNotifyComm.hrl \ - CosNotifyComm_NotifyPublish.hrl \ - CosNotifyComm_NotifySubscribe.hrl \ - CosNotifyComm_PullConsumer.hrl \ - CosNotifyComm_PullSupplier.hrl \ - CosNotifyComm_PushConsumer.hrl \ - CosNotifyComm_PushSupplier.hrl \ - CosNotifyComm_SequencePullConsumer.hrl \ - CosNotifyComm_SequencePullSupplier.hrl \ - CosNotifyComm_SequencePushConsumer.hrl \ - CosNotifyComm_SequencePushSupplier.hrl \ - CosNotifyComm_StructuredPullConsumer.hrl \ - CosNotifyComm_StructuredPullSupplier.hrl \ - CosNotifyComm_StructuredPushConsumer.hrl \ - CosNotifyComm_StructuredPushSupplier.hrl \ - -EXTERNAL_GEN_NOTIFYCOMM_HRL_FILES = \ - $(GEN_NOTIFYCOMM_HRL_FILES:%=$(EXTERNAL_INC_PATH)/%) - -GEN_OE_EVENTCOMM_HRL_FILES = \ - oe_cosNotificationAppComm.hrl \ - oe_CosNotificationComm.hrl \ - oe_CosNotificationComm_Event.hrl - -IDL_GEN_ERL_FILES = \ - $(GEN_NOTIFICATION_ERL_FILES) \ - $(GEN_OE_EVENTCOMM_ERL_FILES) \ - $(GEN_NOTIFYCOMM_ERL_FILES) \ - $(GEN_NOTIFYFILTER_ERL_FILES) \ - $(GEN_CHANNELADMIN_ERL_FILES) - -IDL_GEN_HRL_FILES = \ - $(EXTERNAL_GEN_NOTIFICATION_HRL_FILES) \ - $(GEN_OE_EVENTCOMM_HRL_FILES) \ - $(EXTERNAL_GEN_NOTIFYCOMM_HRL_FILES) \ - $(EXTERNAL_GEN_NOTIFYFILTER_HRL_FILES) \ - $(EXTERNAL_GEN_CHANNELADMIN_HRL_FILES) - -GEN_ERL_FILES = \ - $(IDL_GEN_ERL_FILES) \ - $(GEN_YECC_ERL_FILES) - -GEN_HRL_FILES = \ - $(IDL_GEN_HRL_FILES) \ - $(GEN_YECC_HRL_FILES) - - -GEN_FILES = \ - $(GEN_HRL_FILES) \ - $(GEN_ERL_FILES) - -TARGET_FILES = \ - $(GEN_ERL_FILES:%.erl=$(EBIN)/%.$(EMULATOR)) \ - $(MODULES:%=$(EBIN)/%.$(EMULATOR)) - -IDL_FILES = \ - CosNotification.idl \ - CosNotifyChannelAdmin.idl \ - CosNotifyFilter.idl \ - CosNotifyComm.idl \ - cosNotificationAppComm.idl - -APPUP_FILE = cosNotification.appup -APPUP_SRC = $(APPUP_FILE).src -APPUP_TARGET = $(EBIN)/$(APPUP_FILE) - -APP_FILE = cosNotification.app -APP_SRC = $(APP_FILE).src -APP_TARGET = $(EBIN)/$(APP_FILE) - -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -ERL_IDL_FLAGS += -pa $(ERL_TOP)/lib/cosNotification/ebin \ - -pa $(ERL_TOP)/lib/ic/ebin\ - -pa $(ERL_TOP)/lib/orber/ebin \ - -pa $(ERL_TOP)/lib/cosEvent/ebin \ - -pa $(ERL_TOP)/lib/cosTime/ebin \ - -I$(ERL_TOP)/lib/cosEvent/src - -# 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/orber/include \ - -pa $(ERL_TOP)/lib/cosNotification/include \ - -pa $(ERL_TOP)/lib/cosEvent/include \ - -pa $(ERL_TOP)/lib/cosTime/include \ - -I$(ERL_TOP)/lib/orber/include \ - -I$(ERL_TOP)/lib/cosNotification/include \ - -I$(ERL_TOP)/lib/cosEvent/include \ - -I$(ERL_TOP)/lib/cosTime/include \ - +'{parse_transform,sys_pre_attributes}' \ - +'{attribute,insert,app_vsn,"cosNotification_$(COSNOTIFICATION_VSN)"}' - -YECC_COMPILE_FLAGS = - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -opt: $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) - -debug: - @${MAKE} TYPE=debug - -cleanb: - rm -f $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) - rm -f errs core *~ - -clean: - rm -f $(TARGET_FILES) $(GEN_FILES) $(APP_TARGET) $(APPUP_TARGET) IDL-GENERATED - rm -f errs core *~ - -$(APP_TARGET): $(APP_SRC) - $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ - -$(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ - -docs: - -# ---------------------------------------------------- -# Special Build Targets -# ---------------------------------------------------- -IDL-GENERATED: CosNotification.idl CosNotifyChannelAdmin.idl \ - CosNotifyFilter.idl cosNotificationAppComm.idl CosNotifyComm.idl - $(gen_verbose)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosNotification.cfg"}' CosNotification.idl - $(V_at)mv $(GEN_NOTIFICATION_HRL_FILES) $(EXTERNAL_INC_PATH) - $(V_at)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosNotifyChannelAdmin.cfg"}' CosNotifyChannelAdmin.idl - $(V_at)mv $(GEN_CHANNELADMIN_HRL_FILES) $(EXTERNAL_INC_PATH) - $(V_at)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosNotifyFilter.cfg"}' CosNotifyFilter.idl - $(V_at)mv $(GEN_NOTIFYFILTER_HRL_FILES) $(EXTERNAL_INC_PATH) - $(V_at)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"cosNotificationComm.cfg"}' cosNotificationAppComm.idl - $(V_at)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosNotifyComm.cfg"}' CosNotifyComm.idl - $(V_at)mv $(GEN_NOTIFYCOMM_HRL_FILES) $(EXTERNAL_INC_PATH) - $(V_at)>IDL-GENERATED - -$(IDL_GEN_ERL_FILES) $(IDL_GEN_HRL_FILES): IDL-GENERATED - -$(TARGET_FILES): IDL-GENERATED - -$(GEN_YECC_ERL_FILES) $(GEN_YECC_HRL_FILES): cosNotification_Grammar.yrl - -# ---------------------------------------------------- -# Release Target -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - -release_spec: opt - $(INSTALL_DIR) "$(RELSYSDIR)/ebin" - $(INSTALL_DATA) $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) "$(RELSYSDIR)/ebin" - $(INSTALL_DIR) "$(RELSYSDIR)/src" - $(INSTALL_DATA) $(GEN_FILES) $(IDL_FILES) $(YECC_FILES) "$(RELSYSDIR)/src" - $(INSTALL_DATA) $(ERL_FILES) $(HRL_FILES) $(IDL_FILES) $(YECC_FILES) "$(RELSYSDIR)/src" - $(INSTALL_DIR) "$(RELSYSDIR)/include" - $(INSTALL_DATA) $(GEN_HRL_FILES) "$(RELSYSDIR)/include" - -release_docs_spec: diff --git a/lib/cosNotification/src/PullerConsumer_impl.erl b/lib/cosNotification/src/PullerConsumer_impl.erl deleted file mode 100644 index 52bd13918f..0000000000 --- a/lib/cosNotification/src/PullerConsumer_impl.erl +++ /dev/null @@ -1,774 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : PullerConsumer_impl.erl -%% Purpose : -%%---------------------------------------------------------------------- - --module('PullerConsumer_impl'). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% cosEvent files. --include_lib("cosEvent/include/CosEventChannelAdmin.hrl"). --include_lib("cosEvent/include/CosEventComm.hrl"). -%% Application files --include("CosNotification.hrl"). --include("CosNotifyChannelAdmin.hrl"). --include("CosNotifyComm.hrl"). --include("CosNotifyFilter.hrl"). --include("CosNotification_Definitions.hrl"). - -%%--------------- EXPORTS ------------------------------------ -%%--------------- External ----------------------------------- -%%----- CosNotifyChannelAdmin::ProxyPullConsumer ------------- --export([connect_any_pull_supplier/4]). - -%%----- CosNotifyChannelAdmin::SequenceProxyPullConsumer ----- --export([connect_sequence_pull_supplier/4]). - -%%----- CosNotifyChannelAdmin::StructuredProxyPullConsumer --- --export([connect_structured_pull_supplier/4]). - -%%----- CosNotifyChannelAdmin::*ProxyPullConsumer ------------ --export([suspend_connection/3, - resume_connection/3]). - -%%----- Inherit from CosNotifyChannelAdmin::ProxyConsumer ---- --export([obtain_subscription_types/4, - validate_event_qos/4]). - -%%----- Inherit from CosNotification::QoSAdmin --------------- --export([get_qos/3, - set_qos/4, - validate_qos/4]). - -%%----- Inherit from CosNotifyComm::NotifyPublish ------------ --export([offer_change/5]). - -%%----- Inherit from CosNotifyFilter::FilterAdmin ------------ --export([add_filter/4, - remove_filter/4, - get_filter/4, - get_all_filters/3, - remove_all_filters/3]). - -%%----- Inherit from CosEventComm::PullConsumer ------------- --export([disconnect_pull_consumer/3]). - -%%----- Inherit from CosNotifyComm::SequencePullConsumer ---- --export([disconnect_sequence_pull_consumer/3]). - -%%----- Inherit from CosNotifyComm::StructuredPullConsumer -- --export([disconnect_structured_pull_consumer/3]). - -%%----- Inherit from CosEventChannelAdmin::ProxyPullConsumer --export([connect_pull_supplier/4]). - - -%% Attributes (external) CosNotifyChannelAdmin::ProxySupplier --export(['_get_MyType'/3, - '_get_MyAdmin'/3]). - -%%--------------- gen_server specific exports ---------------- --export([handle_info/2, code_change/3]). --export([init/1, terminate/2]). - -%%--------------- LOCAL DEFINITIONS -------------------------- -%% Data structures --record(state, {myType, - myAdmin, - myAdminPid, - myChannel, - myFilters = [], - myOperator, - idCounter = 0, - client, - qosGlobal, - qosLocal, - suspended = false, - pullTimer, - pullInterval, - publishType = false, - etsR, - eventCounter = 0, - eventDB, - this}). - -%% Data structures constructors --define(get_InitState(_MyT, _MyA, _MyAP, _QS, _LQS, _Ch, _PI, _MyOP, _GT, _GL, _TR), - #state{myType = _MyT, - myAdmin = _MyA, - myAdminPid = _MyAP, - myChannel = _Ch, - myOperator = _MyOP, - qosGlobal = _QS, - qosLocal = _LQS, - pullInterval = _PI, - etsR = ets:new(oe_ets, [set, protected]), - eventDB = cosNotification_eventDB:create_db(_LQS, _GT, _GL, _TR)}). - -%%-------------- Data structures selectors ----------------- -%% Attributes --define(get_MyType(S), S#state.myType). --define(get_MyAdmin(S), S#state.myAdmin). --define(get_MyAdminPid(S), S#state.myAdminPid). --define(get_MyChannel(S), S#state.myChannel). --define(get_MyOperator(S), S#state.myOperator). -%% Client Object --define(get_Client(S), S#state.client). -%% QoS --define(get_GlobalQoS(S), S#state.qosGlobal). --define(get_LocalQoS(S), S#state.qosLocal). --define(get_BothQoS(S), {S#state.qosGlobal, S#state.qosLocal}). -%% Filters --define(get_Filter(S, I), find_obj(lists:keysearch(I, 1, S#state.myFilters))). --define(get_AllFilter(S), S#state.myFilters). --define(get_AllFilterID(S), find_ids(S#state.myFilters)). -%% Admin --define(get_PullInterval(S), S#state.pullInterval). --define(get_PullTimer(S), S#state.pullTimer). --define(get_PacingInterval(S), round(?not_GetPacingInterval((S#state.qosLocal))/10000000)). --define(get_BatchLimit(S), ?not_GetMaximumBatchSize((S#state.qosLocal))). -%% Publish --define(get_AllPublish(S), lists:flatten(ets:match(S#state.etsR, - {'$1',publish}))). --define(get_PublishType(S), S#state.publishType). -%% ID --define(get_IdCounter(S), S#state.idCounter). -%% Event --define(get_Event(S), cosNotification_eventDB:get_event(S#state.eventDB)). --define(get_Events(S,M), cosNotification_eventDB:get_events(S#state.eventDB, M)). --define(get_EventCounter(S), S#state.eventCounter). - -%%-------------- Data structures modifiers ----------------- -%% Client Object --define(set_Client(S,D), S#state{client=D}). --define(del_Client(S), S#state{client=undefined}). --define(set_Suspended(S), S#state{client=true}). --define(set_NotSuspended(S), S#state{client=false}). --define(set_Unconnected(S), S#state{client=undefined}). -%% QoS --define(set_LocalQoS(S,D), S#state{qosLocal=D}). --define(set_GlobalQoS(S,D), S#state{qosGlobal=D}). --define(set_BothQoS(S,GD,LD), S#state{qosGlobal=GD, qosLocal=LD}). -%% Filters --define(add_Filter(S,I,O), S#state{myFilters=[{I,O}|S#state.myFilters]}). --define(del_Filter(S,I), S#state{myFilters= - delete_obj(lists:keydelete(I, 1, S#state.myFilters), - S#state.myFilters)}). --define(del_AllFilter(S), S#state{myFilters=[]}). -%% Admin --define(set_PullInterval(S,V), S#state{pullInterval=V}). --define(set_PullTimer(S,T), S#state{pullTimer=T}). -%% Publish --define(add_Publish(S,E), ets:insert(S#state.etsR, {E, publish})). --define(del_Publish(S,E), ets:delete(S#state.etsR, E)). --define(set_PublishType(S,T), S#state{publishType=T}). -%% ID --define(set_IdCounter(S,V), S#state{idCounter=V}). --define(new_Id(S), 'CosNotification_Common':create_id(S#state.idCounter)). -%% Event --define(add_Event(S,E), cosNotification_eventDB:add_event(S#state.eventDB, E)). --define(update_EventDB(S,Q), S#state{eventDB= - cosNotification_eventDB:update(S#state.eventDB, Q)}). - --define(set_EventCounter(S,V), S#state{eventCounter=V}). --define(add_to_EventCounter(S,V),S#state{eventCounter=S#state.eventCounter+V}). --define(reset_EventCounter(S), S#state{eventCounter=0}). --define(increase_EventCounter(S),S#state{eventCounter=(S#state.eventCounter+1)}). --define(decrease_EventCounter(S),S#state{eventCounter=S#state.eventCounter-1}). --define(add_ToEventCounter(S,A), S#state{eventCounter=(S#state.eventCounter+A)}). --define(sub_FromEventCounter(S,_A), S#state{eventCounter=(S#state.eventCounter-_A)}). --define(set_EventCounterTo(S,V), S#state{eventCounter=V}). - -%%-------------- MISC ---------------------------------------- --define(is_ANY(S), S#state.myType == 'PULL_ANY'). --define(is_STRUCTURED(S), S#state.myType == 'PULL_STRUCTURED'). --define(is_SEQUENCE(S), S#state.myType == 'PULL_SEQUENCE'). --define(is_ANDOP(S), S#state.myOperator == 'AND_OP'). --define(is_UnConnected(S), S#state.client == undefined). --define(is_Connected(S), S#state.client =/= undefined). --define(is_Suspended(S), S#state.suspended == true). --define(is_NotSuspended(S), S#state.suspended == false). --define(is_PersistentConnection(S), - ?not_GetConnectionReliability((S#state.qosLocal)) == ?not_Persistent). --define(is_PersistentEvent(S), - ?not_GetEventReliability((S#state.qosLocal)) == ?not_Persistent). - -%%-----------------------------------------------------------% -%% function : handle_info, code_change -%% Arguments: -%% Returns : -%% Effect : Functions demanded by the gen_server module. -%%------------------------------------------------------------ - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -handle_info(Info, State) -> - ?DBG("INFO: ~p~n", [Info]), - case Info of - {'EXIT', Pid, Reason} when ?get_MyAdminPid(State) == Pid-> - ?DBG("PARENT ADMIN: ~p TERMINATED.~n",[Reason]), - {stop, Reason, State}; - {'EXIT', _Pid, _Reason} -> - ?DBG("PROXYPUSHSUPPLIER: ~p TERMINATED.~n",[_Reason]), - {noreply, State}; - pull -> - try_pull_events(State); - _ -> - {noreply, State} - end. - -%%----------------------------------------------------------% -%% function : init, terminate -%% Arguments: -%%----------------------------------------------------------- - -init([MyType, MyAdmin, MyAdminPid, InitQoS, LQS, MyChannel, Options, Operator]) -> - process_flag(trap_exit, true), - Secs = timer:seconds('CosNotification_Common':get_option(pullInterval, - Options, - ?not_DEFAULT_SETTINGS)), - GCTime = 'CosNotification_Common':get_option(gcTime, Options, - ?not_DEFAULT_SETTINGS), - GCLimit = 'CosNotification_Common':get_option(gcLimit, Options, - ?not_DEFAULT_SETTINGS), - TimeRef = 'CosNotification_Common':get_option(timeService, Options, - ?not_DEFAULT_SETTINGS), - timer:start(), - {ok, ?get_InitState(MyType, MyAdmin, MyAdminPid, InitQoS, - LQS, MyChannel, Secs, Operator, GCTime, - GCLimit, TimeRef)}. - -terminate(_Reason, State) when ?is_UnConnected(State) -> - %% We are currently not connected to a client. Hence, no need for sending - %% a disconnect request. - stop_timer(State), - ok; -terminate(_Reason, State) when ?is_ANY(State) -> - stop_timer(State), - 'CosNotification_Common':disconnect('CosEventComm_PullSupplier', - disconnect_pull_supplier, - ?get_Client(State)); -terminate(_Reason, State) when ?is_SEQUENCE(State) -> - stop_timer(State), - 'CosNotification_Common':disconnect('CosNotifyComm_SequencePullSupplier', - disconnect_sequence_pull_supplier, - ?get_Client(State)); -terminate(_Reason, State) when ?is_STRUCTURED(State) -> - stop_timer(State), - 'CosNotification_Common':disconnect('CosNotifyComm_StructuredPullSupplier', - disconnect_structured_pull_supplier, - ?get_Client(State)). - -%%----------------------------------------------------------- -%%----- CosNotifyChannelAdmin_ProxyConsumer attributes ------ -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% Attribute: '_get_MyType' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_MyType'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_MyType(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_MyAdmin' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_MyAdmin'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_MyAdmin(State), State}. - -%%----------------------------------------------------------- -%%------- Exported external functions ----------------------- -%%----------------------------------------------------------- -%%----- CosEventChannelAdmin::ProxyPullConsumer ------------- -%%----------------------------------------------------------% -%% function : connect_pull_supplier -%% Arguments: Client - CosEventComm::PullSupplier -%% Returns : ok | {'EXCEPTION', #'AlreadyConnected'{}} | -%% {'EXCEPTION', #'TypeError'{}} | -%% {'EXCEPTION', #'BAD_OPERATION'{}} -%% Both exceptions from CosEventChannelAdmin!!! -%%----------------------------------------------------------- -connect_pull_supplier(OE_THIS, OE_FROM, State, Client) -> - connect_any_pull_supplier(OE_THIS, OE_FROM, State, Client). - -%%----- CosNotifyChannelAdmin::ProxyPullConsumer ------------ -%%----------------------------------------------------------% -%% function : connect_any_pull_supplier -%% Arguments: Client - CosEventComm::PullSupplier -%% Returns : ok | {'EXCEPTION', #'AlreadyConnected'{}} | -%% {'EXCEPTION', #'TypeError'{}} | -%% {'EXCEPTION', #'BAD_OPERATION'{}} -%% Both exceptions from CosEventChannelAdmin!!! -%%----------------------------------------------------------- -connect_any_pull_supplier(OE_THIS, _OE_FROM, State, Client) when ?is_ANY(State) -> - 'CosNotification_Common':type_check(Client, 'CosEventComm_PullSupplier'), - if - ?is_Connected(State) -> - corba:raise(#'CosEventChannelAdmin_AlreadyConnected'{}); - true -> - NewState = start_timer(State), - {reply, ok, NewState#state{client = Client, this = OE_THIS}} - end; -connect_any_pull_supplier(_, _, _,_) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----- CosNotifyChannelAdmin::SequenceProxyPullConsumer ---- -%%----------------------------------------------------------% -%% function : connect_sequence_pull_supplier -%% Arguments: Client - CosNotifyComm::SequencePullSupplier -%% Returns : ok | {'EXCEPTION', #'AlreadyConnected'{}} | -%% {'EXCEPTION', #'TypeError'{}} | -%% {'EXCEPTION', #'BAD_OPERATION'{}} -%%----------------------------------------------------------- -connect_sequence_pull_supplier(OE_THIS, _OE_FROM, State, Client) when ?is_SEQUENCE(State) -> - 'CosNotification_Common':type_check(Client, 'CosNotifyComm_SequencePullSupplier'), - if - ?is_Connected(State) -> - corba:raise(#'CosEventChannelAdmin_AlreadyConnected'{}); - true -> - NewState = start_timer(State), - {reply, ok, NewState#state{client = Client, this = OE_THIS}} - end; -connect_sequence_pull_supplier(_, _, _, _) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----- CosNotifyChannelAdmin::StructuredProxyPullConsumer -- -%%----------------------------------------------------------% -%% function : connect_structured_pull_supplier -%% Arguments: Client - CosNotifyComm::StructuredPullSupplier -%% Returns : ok | {'EXCEPTION', #'AlreadyConnected'{}} | -%% {'EXCEPTION', #'TypeError'{}} | -%% {'EXCEPTION', #'BAD_OPERATION'{}} -%%----------------------------------------------------------- -connect_structured_pull_supplier(OE_THIS, _OE_FROM, State, Client) when ?is_STRUCTURED(State) -> - 'CosNotification_Common':type_check(Client, 'CosNotifyComm_StructuredPullSupplier'), - if - ?is_Connected(State) -> - corba:raise(#'CosEventChannelAdmin_AlreadyConnected'{}); - true -> - NewState = start_timer(State), - {reply, ok, NewState#state{client = Client, this = OE_THIS}} - end; -connect_structured_pull_supplier(_, _, _, _) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----- CosNotifyChannelAdmin::*ProxyPullConsumer ----------- -%%----------------------------------------------------------% -%% function : suspend_connection -%% Arguments: -%% Returns : ok | {'EXCEPTION', #'ConnectionAlreadyInactive'{}} | -%% {'EXCEPTION', #'NotConneced'{}} -%%----------------------------------------------------------- -suspend_connection(_OE_THIS, _OE_FROM, State) when ?is_Connected(State) -> - if - ?is_Suspended(State) -> - corba:raise(#'CosNotifyChannelAdmin_ConnectionAlreadyInactive'{}); - true -> - stop_timer(State), - {reply, ok, ?set_Suspended(State)} - end; -suspend_connection(_, _, _) -> - corba:raise(#'CosNotifyChannelAdmin_NotConnected'{}). - -%%----------------------------------------------------------% -%% function : resume_connection -%% Arguments: -%% Returns : ok | {'EXCEPTION', #'ConnectionAlreadyActive'{}} | -%% {'EXCEPTION', #'NotConneced'{}} -%%----------------------------------------------------------- -resume_connection(_OE_THIS, _OE_FROM, State) when ?is_Connected(State) -> - if - ?is_NotSuspended(State) -> - corba:raise(#'CosNotifyChannelAdmin_ConnectionAlreadyActive'{}); - true -> - NewState = start_timer(State), - {reply, ok, ?set_NotSuspended(NewState)} - end; -resume_connection(_, _, _) -> - corba:raise(#'CosNotifyChannelAdmin_NotConnected'{}). - -%%----- Inherit from CosNotifyChannelAdmin::ProxyConsumer --- -%%----------------------------------------------------------% -%% function : obtain_subscription_types -%% Arguments: Mode - enum 'ObtainInfoMode' (CosNotifyChannelAdmin) -%% Returns : CosNotification::EventTypeSeq -%%----------------------------------------------------------- -obtain_subscription_types(_OE_THIS, _OE_FROM, State, 'ALL_NOW_UPDATES_OFF') -> - {reply, ?get_AllPublish(State), ?set_PublishType(State, false)}; -obtain_subscription_types(_OE_THIS, _OE_FROM, State, 'ALL_NOW_UPDATES_ON') -> - {reply, ?get_AllPublish(State), ?set_PublishType(State, true)}; -obtain_subscription_types(_OE_THIS, _OE_FROM, State, 'NONE_NOW_UPDATES_OFF') -> - {reply, [], ?set_PublishType(State, false)}; -obtain_subscription_types(_OE_THIS, _OE_FROM, State, 'NONE_NOW_UPDATES_ON') -> - {reply, [], ?set_PublishType(State, true)}; -obtain_subscription_types(_,_,_,What) -> - orber:dbg("[~p] PullerConsumer:obtain_subscription_types(~p);~n" - "Incorrect enumerant", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : validate_event_qos -%% Arguments: RequiredQoS - CosNotification::QoSProperties -%% Returns : ok | {'EXCEPTION', #'UnsupportedQoS'{}} -%% AvilableQoS - CosNotification::NamedPropertyRangeSeq (out) -%%----------------------------------------------------------- -validate_event_qos(_OE_THIS, _OE_FROM, State, RequiredQoS) -> - AvilableQoS = 'CosNotification_Common':validate_event_qos(RequiredQoS, - ?get_LocalQoS(State)), - {reply, {ok, AvilableQoS}, State}. - -%%----- Inherit from CosNotification::QoSAdmin -------------- -%%----------------------------------------------------------% -%% function : get_qos -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -get_qos(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_GlobalQoS(State), State}. - -%%----------------------------------------------------------% -%% function : set_qos -%% Arguments: QoS - CosNotification::QoSProperties, i.e., -%% [#'Property'{name, value}, ...] where name eq. string() -%% and value eq. any(). -%% Returns : ok | {'EXCEPTION', CosNotification::UnsupportedQoS} -%%----------------------------------------------------------- -set_qos(_OE_THIS, _OE_FROM, State, QoS) -> - {NewQoS, LQS} = 'CosNotification_Common':set_qos(QoS, ?get_BothQoS(State), - proxy, ?get_MyAdmin(State), - false), - NewState = ?update_EventDB(State, LQS), - {reply, ok, ?set_BothQoS(NewState, NewQoS, LQS)}. - -%%----------------------------------------------------------% -%% function : validate_qos -%% Arguments: Required_qos - CosNotification::QoSProperties -%% [#'Property'{name, value}, ...] where name eq. string() -%% and value eq. any(). -%% Returns : {'EXCEPTION', CosNotification::UnsupportedQoS} -%% {ok, CosNotification::NamedPropertyRangeSeq} -%%----------------------------------------------------------- -validate_qos(_OE_THIS, _OE_FROM, State, Required_qos) -> - QoS = 'CosNotification_Common':validate_qos(Required_qos, ?get_BothQoS(State), - proxy, ?get_MyAdmin(State), - false), - {reply, {ok, QoS}, State}. - -%%----- Inherit from CosNotifyComm::NotifyPublish ----------- -%%----------------------------------------------------------% -%% function : offer_change -%% Arguments: Added - #'CosNotification_EventType'{} -%% Removed - #'CosNotification_EventType'{} -%% Returns : ok | -%% {'EXCEPTION', #'CosNotifyComm_InvalidEventType'{}} -%%----------------------------------------------------------- -offer_change(_OE_THIS, _OE_FROM, State, Added, Removed) -> - cosNotification_Filter:validate_types(Added), - cosNotification_Filter:validate_types(Removed), - %% On this "side" we don't really care about which - %% type of events the client will supply. - %% Perhaps, later on, if we want to check this against Filters - %% associated with this object we may change this approach, i.e., if - %% the filter will not allow passing certain event types. But the - %% user should see to that that situation never occurs. It would add - %% extra overhead. Also see PusherSupplier- and PullerSuppler- - %% 'subscription_change'. - update_publish(add, State, Added), - update_publish(remove, State, Removed), - case ?get_PublishType(State) of - true -> - %% Perhaps we should handle exception here?! - %% Probably not. Better to stay "on-line". - catch 'CosNotifyComm_NotifySubscribe': - subscription_change(?get_Client(State), Added, Removed), - ok; - _-> - ok - end, - {reply, ok, State}. - -update_publish(_, _, [])-> - ok; -update_publish(add, State, [H|T]) -> - ?add_Publish(State, H), - update_publish(add, State, T); -update_publish(remove, State, [H|T]) -> - ?del_Publish(State, H), - update_publish(remove, State, T). - -%%----- Inherit from CosNotifyFilter::FilterAdmin ----------- -%%----------------------------------------------------------% -%% function : add_filter -%% Arguments: Filter - CosNotifyFilter::Filter -%% Returns : FilterID - long -%%----------------------------------------------------------- -add_filter(_OE_THIS, _OE_FROM, State, Filter) -> - 'CosNotification_Common':type_check(Filter, 'CosNotifyFilter_Filter'), - FilterID = ?new_Id(State), - NewState = ?set_IdCounter(State, FilterID), - {reply, FilterID, ?add_Filter(NewState, FilterID, Filter)}. - -%%----------------------------------------------------------% -%% function : remove_filter -%% Arguments: FilterID - long -%% Returns : ok -%%----------------------------------------------------------- -remove_filter(_OE_THIS, _OE_FROM, State, FilterID) when is_integer(FilterID) -> - {reply, ok, ?del_Filter(State, FilterID)}; -remove_filter(_,_,_,What) -> - orber:dbg("[~p] PullerConsumer:remove_filter(~p); Not an integer", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : get_filter -%% Arguments: FilterID - long -%% Returns : Filter - CosNotifyFilter::Filter | -%% {'EXCEPTION', #'CosNotifyFilter_FilterNotFound'{}} -%%----------------------------------------------------------- -get_filter(_OE_THIS, _OE_FROM, State, FilterID) when is_integer(FilterID) -> - {reply, ?get_Filter(State, FilterID), State}; -get_filter(_,_,_,What) -> - orber:dbg("[~p] PullerConsumer:get_filter(~p); Not an integer", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : get_all_filters -%% Arguments: - -%% Returns : Filter - CosNotifyFilter::FilterIDSeq -%%----------------------------------------------------------- -get_all_filters(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_AllFilterID(State), State}. - -%%----------------------------------------------------------% -%% function : remove_all_filters -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -remove_all_filters(_OE_THIS, _OE_FROM, State) -> - {reply, ok, ?del_AllFilter(State)}. - -%%----- Inherit from CosEventComm::PullConsumer ------------- -%%----------------------------------------------------------% -%% function : disconnect_pull_consumer -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -disconnect_pull_consumer(_OE_THIS, _OE_FROM, State) -> - {stop, normal, ok, ?set_Unconnected(State)}. - -%%----- Inherit from CosNotifyComm::SequencePullConsumer ---- -%%----------------------------------------------------------% -%% function : disconnect_sequence_pull_consumer -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -disconnect_sequence_pull_consumer(_OE_THIS, _OE_FROM, State) -> - {stop, normal, ok, ?set_Unconnected(State)}. - -%%----- Inherit from CosNotifyComm::StructuredPullConsumer ---- -%%----------------------------------------------------------% -%% function : disconnect_structured_pull_consumer -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -disconnect_structured_pull_consumer(_OE_THIS, _OE_FROM, State) -> - {stop, normal, ok, ?set_Unconnected(State)}. - -%%--------------- LOCAL FUNCTIONS ---------------------------- -find_obj({value, {_, Obj}}) -> Obj; -find_obj(_) -> {'EXCEPTION', #'CosNotifyFilter_FilterNotFound'{}}. - -find_ids(List) -> find_ids(List, []). -find_ids([], Acc) -> Acc; -find_ids([{I,_}|T], Acc) -> find_ids(T, [I|Acc]); -find_ids(What, _) -> - orber:dbg("[~p] PullerConsumer:find_ids();~n" - "Id corrupt: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}). - -%% Delete a single object. -%% The list don not differ, i.e., no filter removed, raise exception. -delete_obj(List,List) -> corba:raise(#'CosNotifyFilter_FilterNotFound'{}); -delete_obj(List,_) -> List. - -%% Start timer which send a message each time we should pull for new events. -start_timer(State) -> - case catch timer:send_interval(?get_PullInterval(State), pull) of - {ok,PullTRef} -> - ?DBG("PULL CONSUMER STARTED PULL TIMER ~p~n", - [?get_PullInterval(State)]), - ?set_PullTimer(State, PullTRef); - What -> - orber:dbg("[~p] PullerConsumer:start_timer();~n" - "Unable to invoke timer:send_interval/2: ~p", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. -stop_timer(State) -> - ?DBG("PULL CONSUMER STOPPED TIMER~n",[]), - timer:cancel(?get_PullTimer(State)). - -%% Try pull event(s); which method is determined by which type this proxy is. -try_pull_events(State) when ?is_ANY(State) -> - case catch 'CosEventComm_PullSupplier':try_pull(?get_Client(State)) of - {_,false} -> - {noreply, State}; - {Event, true} -> - case ?not_isConvertedStructured(Event) of - true -> - forward(seq, State, - cosNotification_eventDB:filter_events([any:get_value(Event)], - ?get_AllFilter(State))); - _ -> - forward(any, State, - cosNotification_eventDB:filter_events([Event], - ?get_AllFilter(State))) - end; - _-> - {noreply, State} - end; -try_pull_events(State) when ?is_SEQUENCE(State) -> - case catch 'CosNotifyComm_SequencePullSupplier': - try_pull_structured_events(?get_Client(State), ?get_BatchLimit(State)) of - {_,false} -> - {noreply, State}; - {EventSeq, true} -> - %% We cannot convert parts of the sequence to any, event though they - %% are converted from any to structured. Would be 'impossible' to send. - forward(seq, State, - cosNotification_eventDB:filter_events(EventSeq, - ?get_AllFilter(State))); - _-> - {noreply, State} - end; -try_pull_events(State) when ?is_STRUCTURED(State) -> - case catch 'CosNotifyComm_StructuredPullSupplier': - try_pull_structured_event(?get_Client(State)) of - {_,false} -> - {noreply, State}; - {Event, true} when ?not_isConvertedAny(Event) -> - forward(any, State, - cosNotification_eventDB:filter_events([Event#'CosNotification_StructuredEvent'.remainder_of_body], - ?get_AllFilter(State))); - {Event, true} -> - forward(seq, State, - cosNotification_eventDB:filter_events([Event], - ?get_AllFilter(State))); - _-> - {noreply, State} - end. - - - -%% Forward events -forward(_, State, {[], _}) when ?is_ANDOP(State) -> - %% Did not pass filtering. Since AND no need to pass on. - {noreply, State}; -forward(Type, State, {[], Failed}) -> - %% Did not pass filtering, but since OR it may pass Admin filters, hence, pass - %% on to Admin - forward(Type, State, Failed, ?get_MyAdmin(State), 'MATCH'); -forward(Type, State, {Passed, _}) when ?is_ANDOP(State) -> - %% Did pass filtering, but since AND we must pass it to Admin to check against - %% its Filters. Just ignore the ones that failed. - forward(Type, State, Passed, ?get_MyAdmin(State), 'MATCH'); -forward(Type, State, {Passed, []}) -> - %% Did pass filtering, and since OR we can pass it to the Channel directly. - forward(Type, State, Passed, ?get_MyChannel(State), 'MATCHED'); -forward(Type, State, {Passed, Failed}) -> - %% Some passed filtering, and since OR we can pass the ones that passed directly - %% to the channel and the other ones via the admin. - forward(Type, State, Passed, ?get_MyChannel(State), 'MATCHED'), - forward(Type, State, Failed, ?get_MyAdmin(State), 'MATCH'). - -forward(any, State, [Event], SendTo, Status) -> - case catch oe_CosNotificationComm_Event:callAny(SendTo, Event, Status) of - ok -> - ?DBG("PROXY FORWARD ANY: ~p~n",[Event]), - {noreply, State}; - {'EXCEPTION', E} when is_record(E, 'OBJECT_NOT_EXIST') orelse - is_record(E, 'NO_PERMISSION') orelse - is_record(E, 'CosEventComm_Disconnected') -> - orber:dbg("[~p] PullerConsumer:forward();~n" - "Admin/Channel no longer exists; terminating and dropping: ~p", - [?LINE, Event], ?DEBUG_LEVEL), - 'CosNotification_Common':notify([{proxy, State#state.this}, - {client, ?get_Client(State)}, - {reason, {'EXCEPTION', E}}]), - {stop, normal, State}; - R when ?is_PersistentConnection(State) -> - orber:dbg("[~p] PullerConsumer:forward();~n" - "Admin/Channel respond incorrect: ~p~n" - "Dropping: ~p", [?LINE, R, Event], ?DEBUG_LEVEL), - {noreply, State}; - R -> - orber:dbg("[~p] PullerConsumer:forward();~n" - "Admin/Channel respond incorrect: ~p~n" - "Terminating and dropping: ~p", - [?LINE, R, Event], ?DEBUG_LEVEL), - 'CosNotification_Common':notify([{proxy, State#state.this}, - {client, ?get_Client(State)}, - {reason, R}]), - {stop, normal, State} - end; -forward(seq, State, Event, SendTo, Status) -> - case catch oe_CosNotificationComm_Event:callSeq(SendTo, Event, Status) of - ok -> - ?DBG("PROXY FORWARD SEQUENCE: ~p~n",[Event]), - {noreply, State}; - {'EXCEPTION', E} when is_record(E, 'OBJECT_NOT_EXIST') orelse - is_record(E, 'NO_PERMISSION') orelse - is_record(E, 'CosEventComm_Disconnected') -> - orber:dbg("[~p] PullerConsumer:forward();~n" - "Admin/Channel no longer exists; terminating and dropping: ~p", - [?LINE, Event], ?DEBUG_LEVEL), - 'CosNotification_Common':notify([{proxy, State#state.this}, - {client, ?get_Client(State)}, - {reason, {'EXCEPTION', E}}]), - {stop, normal, State}; - R when ?is_PersistentConnection(State) -> - orber:dbg("[~p] PullerConsumer:forward();~n" - "Admin/Channel respond incorrect: ~p~n" - "Dropping: ~p", [?LINE, R, Event], ?DEBUG_LEVEL), - {noreply, State}; - R -> - orber:dbg("[~p] PullerConsumer:forward();~n" - "Admin/Channel respond incorrect: ~p~n" - "Terminating and dropping: ~p", - [?LINE, R, Event], ?DEBUG_LEVEL), - 'CosNotification_Common':notify([{proxy, State#state.this}, - {client, ?get_Client(State)}, - {reason, R}]), - {stop, normal, State} - end. - -%%--------------- MISC FUNCTIONS, E.G. DEBUGGING ------------- -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosNotification/src/PullerSupplier_impl.erl b/lib/cosNotification/src/PullerSupplier_impl.erl deleted file mode 100644 index e1956cff28..0000000000 --- a/lib/cosNotification/src/PullerSupplier_impl.erl +++ /dev/null @@ -1,915 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : PullerSupplier_impl.erl -%% Purpose : -%%---------------------------------------------------------------------- - --module('PullerSupplier_impl'). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% cosEvent files. --include_lib("cosEvent/include/CosEventChannelAdmin.hrl"). -%% Application files --include("CosNotification.hrl"). --include("CosNotifyChannelAdmin.hrl"). --include("CosNotifyComm.hrl"). --include("CosNotifyFilter.hrl"). - --include("CosNotification_Definitions.hrl"). - -%%--------------- EXPORTS ------------------------------------ -%%--------------- External ----------------------------------- -%%----- CosNotifyChannelAdmin::ProxyPullSupplier ------------- --export([connect_any_pull_consumer/4]). - -%%----- CosNotifyChannelAdmin::SequenceProxyPullSupplier ----- --export([connect_sequence_pull_consumer/4]). - -%%----- CosNotifyChannelAdmin::StructuredProxyPullSupplier --- --export([connect_structured_pull_consumer/4]). - -%%----- Inherit from CosNotifyChannelAdmin::ProxySupplier ---- --export([obtain_offered_types/4, - validate_event_qos/4]). - -%%----- Inherit from CosNotification::QoSAdmin --------------- --export([get_qos/3, - set_qos/4, - validate_qos/4]). - -%%----- Inherit from CosNotifyComm::NotifySubscribe ---------- --export([subscription_change/5]). - -%%----- Inherit from CosNotifyFilter::FilterAdmin ------------ --export([add_filter/4, - remove_filter/4, - get_filter/4, - get_all_filters/3, - remove_all_filters/3]). - -%%----- Inherit from CosEventComm::PullSupplier ------------- --export([pull/3, - try_pull/3, - disconnect_pull_supplier/3]). - -%%----- Inherit from CosNotifyComm::SequencePullSupplier -- --export([pull_structured_events/4, - try_pull_structured_events/4, - disconnect_sequence_pull_supplier/3]). - -%%----- Inherit from CosNotifyComm::StructuredPullSupplier -- --export([pull_structured_event/3, - try_pull_structured_event/3, - disconnect_structured_pull_supplier/3]). - -%%----- Inherit from CosEventChannelAdmin::ProxyPullSupplier --export([connect_pull_consumer/4]). - -%% Attributes (external) CosNotifyChannelAdmin::ProxySupplier --export(['_get_MyType'/3, - '_get_MyAdmin'/3, - '_get_priority_filter'/3, - '_set_priority_filter'/4, - '_get_lifetime_filter'/3, - '_set_lifetime_filter'/4]). - -%%--------------- Internal ----------------------------------- -%%----- Inherit from cosNotificationComm -------------------- --export([callAny/5, - callSeq/5]). - -%%--------------- gen_server specific exports ---------------- --export([handle_info/2, code_change/3]). --export([init/1, terminate/2]). - -%%--------------- LOCAL DEFINITIONS -------------------------- -%% Data structures --record(state, {myType, - myAdmin, - myAdminPid, - myChannel, - myFilters = [], - myOperator, - idCounter = 0, - prioFil, - lifetFil, - client, - qosGlobal, - qosLocal, - pacingTimer, - respondTo, - subscribeType = false, - subscribeData = true, - etsR, - eventDB}). - -%% Data structures constructors --define(get_InitState(_MyT, _MyA, _MyAP, _QS, _LQS, _Ch, _MyOp, _GT, _GL, _TR), - #state{myType = _MyT, - myAdmin = _MyA, - myAdminPid= _MyAP, - myChannel = _Ch, - myOperator= _MyOp, - qosGlobal = _QS, - qosLocal = _LQS, - etsR = ets:new(oe_ets, [set, protected]), - eventDB = cosNotification_eventDB:create_db(_LQS, _GT, _GL, _TR)}). - - -%% Data structures selectors -%% Attributes --define(get_MyType(S), S#state.myType). --define(get_MyAdmin(S), S#state.myAdmin). --define(get_MyAdminPid(S), S#state.myAdmin). --define(get_MyChannel(S), S#state.myChannel). --define(get_MyOperator(S), S#state.myOperator). --define(get_PrioFil(S), S#state.prioFil). --define(get_LifeTFil(S), S#state.lifetFil). -%% Client Object --define(get_Client(S), S#state.client). -%% QoS --define(get_GlobalQoS(S), S#state.qosGlobal). --define(get_LocalQoS(S), S#state.qosLocal). --define(get_BothQoS(S), {S#state.qosGlobal, S#state.qosLocal}). -%% Filters --define(get_Filter(S, I), find_obj(lists:keysearch(I, 1, S#state.myFilters))). --define(get_AllFilter(S), S#state.myFilters). --define(get_AllFilterID(S), find_ids(S#state.myFilters)). -%% Event --define(get_Event(S), cosNotification_eventDB:get_event(S#state.eventDB)). --define(get_Events(S,M), cosNotification_eventDB:get_events(S#state.eventDB, M)). --define(get_RespondTo(S), S#state.respondTo). -%% Amin --define(get_PacingTimer(S), S#state.pacingTimer). --define(get_PacingInterval(S), round(?not_GetPacingInterval((S#state.qosLocal))/10000000)). --define(get_BatchLimit(S), ?not_GetMaximumBatchSize((S#state.qosLocal))). -%% Subscribe --define(get_AllSubscribe(S), lists:flatten(ets:match(S#state.etsR, - {'$1',subscribe}))). --define(get_SubscribeType(S), S#state.subscribeType). --define(get_SubscribeData(S), S#state.subscribeData). -%% ID --define(get_IdCounter(S), S#state.idCounter). --define(get_SubscribeDB(S), S#state.etsR). - -%% Data structures modifiers -%% Attributes --define(set_PrioFil(S,D), S#state{prioFil=D}). --define(set_LifeTFil(S,D), S#state{lifetFil=D}). -%% Client Object --define(set_Client(S,D), S#state{client=D}). --define(del_Client(S), S#state{client=undefined}). -%% QoS --define(set_LocalQoS(S,D), S#state{qosLocal=D}). --define(set_GlobalQoS(S,D), S#state{qosGlobal=D}). --define(set_BothQoS(S,GD,LD), S#state{qosGlobal=GD, qosLocal=LD}). --define(update_EventDB(S,Q), S#state{eventDB= - cosNotification_eventDB:update(S#state.eventDB, Q)}). -%% Filters --define(add_Filter(S,I,O), S#state{myFilters=[{I,O}|S#state.myFilters]}). --define(del_Filter(S,I), S#state{myFilters= - delete_obj(lists:keydelete(I, 1, S#state.myFilters), - S#state.myFilters)}). --define(del_AllFilter(S), S#state{myFilters=[]}). --define(set_Unconnected(S), S#state{client=undefined}). --define(reset_RespondTo(S), S#state{respondTo=undefined}). --define(set_RespondTo(S,F), S#state{respondTo=F}). -%% Event --define(add_Event(S,E), catch cosNotification_eventDB: - add_event(S#state.eventDB, E, S#state.lifetFil, S#state.prioFil)). --define(addAndGet_Event(S,E), catch cosNotification_eventDB: - add_and_get_event(S#state.eventDB, E, S#state.lifetFil, S#state.prioFil)). -%% Admin --define(set_PacingTimer(S,T), S#state{pacingTimer=T}). -%% Subscribe --define(add_Subscribe(S,E), ets:insert(S#state.etsR, {E, subscribe})). --define(del_Subscribe(S,E), ets:delete(S#state.etsR, E)). --define(set_SubscribeType(S,T), S#state{subscribeType=T}). --define(set_SubscribeData(S,D), S#state{subscribeData=D}). -%% ID --define(set_IdCounter(S,V), S#state{idCounter=V}). --define(new_Id(S), 'CosNotification_Common':create_id(S#state.idCounter)). - -%% MISC --define(is_ANY(S), S#state.myType == 'PULL_ANY'). --define(is_STRUCTURED(S), S#state.myType == 'PULL_STRUCTURED'). --define(is_SEQUENCE(S), S#state.myType == 'PULL_SEQUENCE'). --define(is_ANDOP(S), S#state.myOperator == 'AND_OP'). --define(is_UnConnected(S), S#state.client == undefined). --define(is_Connected(S), S#state.client =/= undefined). --define(is_Waiting(S), S#state.respondTo =/= undefined). --define(is_SubscribedFor(S,K), ets:lookup(S#state.etsR, K) =/= []). --define(is_BatchLimitReached(S,M), cosNotification_eventDB: - status(S#state.eventDB, {batchLimit, - ?not_GetMaximumBatchSize((S#state.qosLocal)), M})). - -%%----------------------------------------------------------% -%% function : handle_info, code_change -%% Arguments: -%% Returns : -%% Effect : Functions demanded by the gen_server module. -%%----------------------------------------------------------- - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -handle_info(Info, State) -> - ?DBG("INFO: ~p~n", [Info]), - case Info of - {'EXIT', Pid, Reason} when ?get_MyAdminPid(State)==Pid-> - ?DBG("PARENT ADMIN: ~p TERMINATED.~n",[Reason]), - {stop, Reason, State}; - {'EXIT', _Pid, _Reason} -> - ?DBG("PROXYPUSHSUPPLIER: ~p TERMINATED.~n",[_Reason]), - {noreply, State}; - {pacing, TS} when ?is_Waiting(State) -> - case ?get_PacingTimer(State) of - {_, TS} -> - ?DBG("PULL SUPPLIER PACING LIMIT REACHED~n",[]), - {RespondTo, Max} = ?get_RespondTo(State), - {EventSeq, _} = ?get_Events(State, Max), - corba:reply(RespondTo, EventSeq), - {noreply, ?reset_RespondTo(State)}; - _ -> - %% Must have been an old timer event, i.e., we reached the - %% Batch Limit before Pace limit and we were not able - %% to stop the timer before it triggered an event. - ?DBG("PULL SUPPLIER OLD PACING LIMIT REACHED~n",[]), - {noreply, State} - end; - {pacing, _} -> - ?DBG("PULL SUPPLIER PACING LIMIT REACHED BUT NO CLIENT; IMPOSSIBLE!!!~n",[]), - {noreply, State}; - _ -> - {noreply, State} - end. - -%%----------------------------------------------------------% -%% function : init, terminate -%% Arguments: -%%----------------------------------------------------------- - -init([MyType, MyAdmin, MyAdminPid, InitQoS, LQS, MyChannel, Options, Operator]) -> - process_flag(trap_exit, true), - GCTime = 'CosNotification_Common':get_option(gcTime, Options, - ?not_DEFAULT_SETTINGS), - GCLimit = 'CosNotification_Common':get_option(gcLimit, Options, - ?not_DEFAULT_SETTINGS), - TimeRef = 'CosNotification_Common':get_option(timeService, Options, - ?not_DEFAULT_SETTINGS), - {ok, ?get_InitState(MyType, MyAdmin, MyAdminPid, InitQoS, LQS, MyChannel, - Operator, GCTime, GCLimit, TimeRef)}. - -terminate(_Reason, State) when ?is_UnConnected(State) -> - ok; -terminate(_Reason, State) -> - Client = ?get_Client(State), - case catch corba_object:is_nil(Client) of - false when ?is_ANY(State) -> - 'CosNotification_Common':disconnect('CosEventComm_PullConsumer', - disconnect_pull_consumer, - Client); - false when ?is_SEQUENCE(State) -> - 'CosNotification_Common':disconnect('CosNotifyComm_SequencePullConsumer', - disconnect_sequence_pull_consumer, - Client); - false when ?is_STRUCTURED(State) -> - 'CosNotification_Common':disconnect('CosNotifyComm_StructuredPullConsumer', - disconnect_structured_pull_consumer, - Client); - _ -> - ok - end. - -%%----------------------------------------------------------- -%%----- CosNotifyChannelAdmin_ProxySupplier attributes ------ -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% Attribute: '_get_MyType' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_MyType'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_MyType(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_MyAdmin' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_MyAdmin'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_MyAdmin(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_*et_priority_filter' -%% Type : read/write -%% Returns : -%%----------------------------------------------------------- -'_get_priority_filter'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_PrioFil(State), State}. -'_set_priority_filter'(_OE_THIS, _OE_FROM, State, PrioF) -> - {reply, ok, ?set_PrioFil(State, PrioF)}. - - -%%----------------------------------------------------------% -%% Attribute: '_*et_lifetime_filter' -%% Type : read/write -%% Returns : -%%----------------------------------------------------------- -'_get_lifetime_filter'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_LifeTFil(State), State}. -'_set_lifetime_filter'(_OE_THIS, _OE_FROM, State, LifeTF) -> - {reply, ok, ?set_LifeTFil(State, LifeTF)}. - -%%----------------------------------------------------------- -%%------- Exported external functions ----------------------- -%%----------------------------------------------------------- -%%----- CosEventChannelAdmin::ProxyPullSupplier ------------- -%%----------------------------------------------------------% -%% function : connect_pull_consumer -%% Arguments: Client - CosEventComm::PullConsumer -%% Returns : ok | {'EXCEPTION', #'AlreadyConnected'{}} | -%% {'EXCEPTION', #'TypeError'{}} | -%% {'EXCEPTION', #'BAD_OPERATION'{}} -%% Both exceptions from CosEventChannelAdmin!!! -%%----------------------------------------------------------- -connect_pull_consumer(OE_THIS, OE_FROM, State, Client) -> - connect_any_pull_consumer(OE_THIS, OE_FROM, State, Client). - -%%----- CosNotifyChannelAdmin::ProxyPullSupplier ------------ -%%----------------------------------------------------------% -%% function : connect_any_pull_consumer -%% Arguments: Client - CosEventComm::PullConsumer -%% Returns : ok | {'EXCEPTION', #'AlreadyConnected'{}} | -%% {'EXCEPTION', #'TypeError'{}} | -%% {'EXCEPTION', #'BAD_OPERATION'{}} -%% Both exceptions from CosEventChannelAdmin!!! -%%----------------------------------------------------------- -connect_any_pull_consumer(_OE_THIS, _OE_FROM, State, Client) when ?is_ANY(State) -> - ?not_TypeCheck(Client, 'CosEventComm_PullConsumer'), - if - ?is_Connected(State) -> - corba:raise(#'CosEventChannelAdmin_AlreadyConnected'{}); - true -> - {reply, ok, ?set_Client(State, Client)} - end; -connect_any_pull_consumer(_, _, _, _) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----- CosNotifyChannelAdmin::SequenceProxyPullSupplier ---- -%%----------------------------------------------------------% -%% function : connect_sequence_pull_consumer -%% Arguments: Client - CosNotifyComm::SequencePullConsumer -%% Returns : ok | {'EXCEPTION', #'AlreadyConnected'{}} | -%% {'EXCEPTION', #'TypeError'{}} | -%% {'EXCEPTION', #'BAD_OPERATION'{}} -%%----------------------------------------------------------- -connect_sequence_pull_consumer(_OE_THIS, _OE_FROM, State, Client) when ?is_SEQUENCE(State) -> - ?not_TypeCheck(Client, 'CosNotifyComm_SequencePullConsumer'), - if - ?is_Connected(State) -> - corba:raise(#'CosEventChannelAdmin_AlreadyConnected'{}); - true -> - {reply, ok, ?set_Client(State, Client)} - end; -connect_sequence_pull_consumer(_, _, _, _) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----- CosNotifyChannelAdmin::StructuredProxyPullSupplier -- -%%----------------------------------------------------------% -%% function : connect_structured_pull_consumer -%% Arguments: Client - CosNotifyComm::StructuredPullConsumer -%% Returns : ok | {'EXCEPTION', #'AlreadyConnected'{}} | -%% {'EXCEPTION', #'TypeError'{}} | -%% {'EXCEPTION', #'BAD_OPERATION'{}} -%%----------------------------------------------------------- -connect_structured_pull_consumer(_OE_THIS, _OE_FROM, State, Client) when ?is_STRUCTURED(State) -> - ?not_TypeCheck(Client, 'CosNotifyComm_StructuredPullConsumer'), - if - ?is_Connected(State) -> - corba:raise(#'CosEventChannelAdmin_AlreadyConnected'{}); - true -> - {reply, ok, ?set_Client(State, Client)} - end; -connect_structured_pull_consumer(_, _, _, _) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----- Inherit from CosNotifyChannelAdmin::ProxySupplier --- -%%----------------------------------------------------------% -%% function : obtain_offered_types -%% Arguments: Mode - enum 'ObtainInfoMode' (CosNotifyChannelAdmin) -%% Returns : CosNotification::EventTypeSeq -%%----------------------------------------------------------- -obtain_offered_types(_OE_THIS, _OE_FROM, State, 'ALL_NOW_UPDATES_OFF') -> - {reply, ?get_AllSubscribe(State), ?set_SubscribeType(State, false)}; -obtain_offered_types(_OE_THIS, _OE_FROM, State, 'ALL_NOW_UPDATES_ON') -> - {reply, ?get_AllSubscribe(State), ?set_SubscribeType(State, true)}; -obtain_offered_types(_OE_THIS, _OE_FROM, State, 'NONE_NOW_UPDATES_OFF') -> - {reply, [], ?set_SubscribeType(State, false)}; -obtain_offered_types(_OE_THIS, _OE_FROM, State, 'NONE_NOW_UPDATES_ON') -> - {reply, [], ?set_SubscribeType(State, true)}; -obtain_offered_types(_,_,_,What) -> - orber:dbg("[~p] PullerSupplier:obtain_offered_types(~p);~n" - "Incorrect enumerant", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : validate_event_qos -%% Arguments: RequiredQoS - CosNotification::QoSProperties -%% Returns : ok | {'EXCEPTION', #'UnsupportedQoS'{}} -%% AvilableQoS - CosNotification::NamedPropertyRangeSeq (out) -%%----------------------------------------------------------- -validate_event_qos(_OE_THIS, _OE_FROM, State, RequiredQoS) -> - AvilableQoS = 'CosNotification_Common':validate_event_qos(RequiredQoS, - ?get_LocalQoS(State)), - {reply, {ok, AvilableQoS}, State}. - -%%----- Inherit from CosNotification::QoSAdmin -------------- -%%----------------------------------------------------------% -%% function : get_qos -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -get_qos(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_GlobalQoS(State), State}. - -%%----------------------------------------------------------% -%% function : set_qos -%% Arguments: QoS - CosNotification::QoSProperties, i.e., -%% [#'Property'{name, value}, ...] where name eq. string() -%% and value eq. any(). -%% Returns : ok | {'EXCEPTION', CosNotification::UnsupportedQoS} -%%----------------------------------------------------------- -set_qos(_OE_THIS, _OE_FROM, State, QoS) -> - {NewQoS, LQS} = 'CosNotification_Common':set_qos(QoS, ?get_BothQoS(State), - proxy, ?get_MyAdmin(State), - false), - NewState = ?update_EventDB(State, LQS), - {reply, ok, ?set_BothQoS(NewState, NewQoS, LQS)}. - -%%----------------------------------------------------------% -%% function : validate_qos -%% Arguments: Required_qos - CosNotification::QoSProperties -%% [#'Property'{name, value}, ...] where name eq. string() -%% and value eq. any(). -%% Returns : {'EXCEPTION', CosNotification::UnsupportedQoS} -%% {ok, CosNotification::NamedPropertyRangeSeq} -%%----------------------------------------------------------- -validate_qos(_OE_THIS, _OE_FROM, State, Required_qos) -> - QoS = 'CosNotification_Common':validate_qos(Required_qos, ?get_BothQoS(State), - proxy, ?get_MyAdmin(State), - false), - {reply, {ok, QoS}, State}. - -%%----- Inherit from CosNotifyComm::NotifySubscribe --------- -%%----------------------------------------------------------% -%% function : subscription_change -%% Arguments: Added - Removed - CosNotification::EventTypeSeq -%% Returns : ok -%%----------------------------------------------------------- -subscription_change(_OE_THIS, _OE_FROM, State, Added, Removed) -> - cosNotification_Filter:validate_types(Added), - cosNotification_Filter:validate_types(Removed), - %% On this "side", we care about which type of events the client - %% will require, since the client (or an agent) clearly stated - %% that it's only interested in these types of events. - %% Also see PusherConsumer- and PullerConsumer-'offer_change'. - update_subscribe(remove, State, Removed), - CurrentSub = ?get_AllSubscribe(State), - NewState = - case cosNotification_Filter:check_types(Added++CurrentSub) of - true -> - %% Types supplied does in some way cause all events to be valid. - %% Smart? Would have been better to not supply any at all. - ?set_SubscribeData(State, true); - {ok, Which, WC} -> - ?set_SubscribeData(State, {Which, WC}) - end, - update_subscribe(add, NewState, Added), - case ?get_SubscribeType(NewState) of - true -> - %% Perhaps we should handle exception here?! - %% Probably not. Better to stay "on-line". - catch 'CosNotifyComm_NotifyPublish': - offer_change(?get_Client(NewState), Added, Removed), - ok; - _-> - ok - end, - {reply, ok, NewState}. - -update_subscribe(_, _, [])-> - ok; -update_subscribe(add, State, [H|T]) -> - ?add_Subscribe(State, H), - update_subscribe(add, State, T); -update_subscribe(remove, State, [H|T]) -> - ?del_Subscribe(State, H), - update_subscribe(remove, State, T). - -%%----- Inherit from CosNotifyFilter::FilterAdmin ----------- -%%----------------------------------------------------------% -%% function : add_filter -%% Arguments: Filter - CosNotifyFilter::Filter -%% Returns : FilterID - long -%%----------------------------------------------------------- -add_filter(_OE_THIS, _OE_FROM, State, Filter) -> - 'CosNotification_Common':type_check(Filter, 'CosNotifyFilter_Filter'), - FilterID = ?new_Id(State), - NewState = ?set_IdCounter(State, FilterID), - {reply, FilterID, ?add_Filter(NewState, FilterID, Filter)}. - -%%----------------------------------------------------------% -%% function : remove_filter -%% Arguments: FilterID - long -%% Returns : ok -%%----------------------------------------------------------- -remove_filter(_OE_THIS, _OE_FROM, State, FilterID) when is_integer(FilterID) -> - {reply, ok, ?del_Filter(State, FilterID)}; -remove_filter(_,_,_,What) -> - orber:dbg("[~p] PullerSupplier:remove_filter(~p); Not an integer", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : get_filter -%% Arguments: FilterID - long -%% Returns : Filter - CosNotifyFilter::Filter | -%% {'EXCEPTION', #'CosNotifyFilter_FilterNotFound'{}} -%%----------------------------------------------------------- -get_filter(_OE_THIS, _OE_FROM, State, FilterID) when is_integer(FilterID) -> - {reply, ?get_Filter(State, FilterID), State}; -get_filter(_,_,_,What) -> - orber:dbg("[~p] PullerSupplier:get_filter(~p); Not an integer", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : get_all_filters -%% Arguments: - -%% Returns : Filter - CosNotifyFilter::FilterIDSeq -%%----------------------------------------------------------- -get_all_filters(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_AllFilterID(State), State}. - -%%----------------------------------------------------------% -%% function : remove_all_filters -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -remove_all_filters(_OE_THIS, _OE_FROM, State) -> - {reply, ok, ?del_AllFilter(State)}. - -%%----- Inherit from CosEventComm::PullSupplier ------------- -%%----------------------------------------------------------% -%% function : disconnect_pull_supplier -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -disconnect_pull_supplier(_OE_THIS, _OE_FROM, State) -> - {stop, normal, ok, ?set_Unconnected(State)}. - -%%----------------------------------------------------------% -%% function : pull -%% Arguments: - -%% Returns : any - CORBA::ANY -%%----------------------------------------------------------- -pull(_OE_THIS, OE_FROM, State) when ?is_ANY(State) -> - case ?get_Event(State) of - {[], _} -> - {noreply, ?set_RespondTo(State, OE_FROM)}; - {Event,_} -> - {reply, Event, State} - end; -pull(_,_,_) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : try_pull -%% Arguments: - -%% Returns : any - CORBA::ANY -%% HasEvent - boolean (out-type) -%%----------------------------------------------------------- -try_pull(_OE_THIS, _OE_FROM, State) when ?is_ANY(State) -> - case ?get_Event(State) of - {[], _} -> - {reply, {any:create(orber_tc:null(), null), false}, State}; - {Event, Bool} -> - {reply, {Event, Bool}, State} - end; -try_pull(_,_,_) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----- Inherit from CosNotifyComm::SequencePullSupplier ---- -%%----------------------------------------------------------% -%% function : disconnect_sequence_pull_supplier -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -disconnect_sequence_pull_supplier(_OE_THIS, _OE_FROM, State) -> - {stop, normal, ok, ?set_Unconnected(State)}. - -%%----------------------------------------------------------% -%% function : pull_structured_events -%% Arguments: Max - long() -%% Returns : [StructuredEvent, ..] -%%----------------------------------------------------------- -pull_structured_events(_OE_THIS, OE_FROM, State, Max) when ?is_SEQUENCE(State) -> - case ?is_BatchLimitReached(State, Max) of - true -> - %% This test is not fool-proof; if Events have been stored - %% using StartTime they will still be there but we cannot - %% deliver them anyway. To solve this "problem" would cost! - %% Hence, since it works fine otherwise it will do. - case ?get_Events(State, Max) of - {[], false} -> - NewState = start_timer(State), - {noreply, ?set_RespondTo(NewState, {OE_FROM, Max})}; - {Event,_} -> - {reply, Event, State} - end; - _-> - NewState = start_timer(State), - {noreply, ?set_RespondTo(NewState, {OE_FROM, Max})} - end; -pull_structured_events(_,_,_,_) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : try_pull_structured_events -%% Arguments: Max - long() -%% Returns : [StructuredEvent, ..] -%% HasEvent - Boolean() -%%----------------------------------------------------------- -try_pull_structured_events(_OE_THIS, _OE_FROM, State, Max) when ?is_SEQUENCE(State) -> - {reply, ?get_Events(State, Max), State}; -try_pull_structured_events(_,_,_,_) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----- Inherit from CosNotifyComm::StructuredPullSupplier -- -%%----------------------------------------------------------% -%% function : disconnect_structured_pull_supplier -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -disconnect_structured_pull_supplier(_OE_THIS, _OE_FROM, State) -> - {stop, normal, ok, ?set_Unconnected(State)}. - -%%----------------------------------------------------------% -%% function : pull_structured_event -%% Arguments: - -%% Returns : -%%----------------------------------------------------------- -pull_structured_event(_OE_THIS, OE_FROM, State) when ?is_STRUCTURED(State) -> - case ?get_Event(State) of - {[], _} -> - {noreply, ?set_RespondTo(State, OE_FROM)}; - {Event,_} -> - {reply, Event, State} - end; -pull_structured_event(_,_,_) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : try_pull_structured_event -%% Arguments: - -%% Returns : -%%----------------------------------------------------------- -try_pull_structured_event(_OE_THIS, _OE_FROM, State) when ?is_STRUCTURED(State) -> - case ?get_Event(State) of - {[], _} -> - {reply, - {?not_CreateSE("","","",[],[],any:create(orber_tc:null(), null)), false}, - State}; - {Event, Bool} -> - {reply, {Event, Bool}, State} - end; -try_pull_structured_event(_,_,_) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - - -%%--------------- LOCAL FUNCTIONS ---------------------------- -find_obj({value, {_, Obj}}) -> Obj; -find_obj(_) -> {'EXCEPTION', #'CosNotifyFilter_FilterNotFound'{}}. - -find_ids(List) -> find_ids(List, []). -find_ids([], Acc) -> Acc; -find_ids([{I,_}|T], Acc) -> find_ids(T, [I|Acc]); -find_ids(_, _) -> corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}). - -%% Delete a single object. -%% The list do not differ, i.e., no filter removed, raise exception. -delete_obj(List,List) -> corba:raise(#'CosNotifyFilter_FilterNotFound'{}); -delete_obj(List,_) -> List. - - -%%----------------------------------------------------------- -%% function : callSeq -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -callSeq(_OE_THIS, OE_FROM, State, EventsIn, Status) -> - %% We should do something here, i.e., see what QoS this Object offers and - %% act accordingly. - corba:reply(OE_FROM, ok), - case cosNotification_eventDB:validate_event(?get_SubscribeData(State), EventsIn, - ?get_AllFilter(State), - ?get_SubscribeDB(State), - Status) of - {[], _} -> - ?DBG("PROXY NOSUBSCRIPTION SEQUENCE/STRUCTURED: ~p~n",[EventsIn]), - {noreply, State}; - %% Just one event and we got a client waiting => there is no need to store - %% the event, just transform it and pass it on. - {[Event], _} when ?is_ANY(State), ?is_Waiting(State) -> - ?DBG("PROXY RECEIVED SEQUENCE[1]==>ANY: ~p~n",[Event]), - AnyEvent = any:create('CosNotification_StructuredEvent':tc(),Event), - case ?addAndGet_Event(State, AnyEvent) of - {[], _} -> - ?DBG("PROXY RECEIVED UNDELIVERABLE SEQUENCE[1]: ~p~n", - [Event]), - %% Cannot deliver the event at the moment; perhaps Starttime - %% set or Deadline passed. - {noreply, State}; - {PossiblyOtherEvent, _} -> - ?DBG("PROXY RECEIVED SEQUENCE[1] ~p; DELIVER: ~p~n", - [Event, PossiblyOtherEvent]), - corba:reply(?get_RespondTo(State), PossiblyOtherEvent), - {noreply, ?reset_RespondTo(State)} - end; - {[Event],_} when ?is_STRUCTURED(State), ?is_Waiting(State) -> - case ?addAndGet_Event(State, Event) of - {[], _} -> - ?DBG("PROXY RECEIVED UNDELIVERABLE SEQUENCE[1]: ~p~n", - [Event]), - %% Cannot deliver the event at the moment; perhaps Starttime - %% set or Deadline passed. - {noreply, State}; - {PossiblyOtherEvent, _} -> - ?DBG("PROXY RECEIVED SEQUENCE[1] ~p; DELIVER: ~p~n", - [Event, PossiblyOtherEvent]), - corba:reply(?get_RespondTo(State), PossiblyOtherEvent), - {noreply, ?reset_RespondTo(State)} - end; - %% A sequence of events => store them and extract the first (according to QoS) - %% event and forward it. - {Events,_} when ?is_ANY(State), ?is_Waiting(State) -> - ?DBG("PROXY RECEIVED SEQUENCE==>ANY: ~p~n",[Events]), - store_events(State, Events), - case ?get_Event(State) of - {[], _} -> - {noreply, State}; - {AnyEvent, _} -> - corba:reply(?get_RespondTo(State), AnyEvent), - {noreply, ?reset_RespondTo(State)} - end; - {Events, _} when ?is_STRUCTURED(State), ?is_Waiting(State) -> - ?DBG("PROXY RECEIVED SEQUENCE: ~p~n",[Events]), - store_events(State, Events), - case ?get_Event(State) of - {[], _} -> - {noreply, State}; - {_StrEvent, _} -> - corba:reply(?get_RespondTo(State), Events), - {noreply, ?reset_RespondTo(State)} - end; - {Events, _} when ?is_SEQUENCE(State), ?is_Waiting(State) -> - ?DBG("PROXY RECEIVED SEQUENCE: ~p~n",[Events]), - %% Store them first and extract Max events in QoS order. - store_events(State, Events), - {RespondTo, Max} = ?get_RespondTo(State), - case ?is_BatchLimitReached(State, Max) of - true -> - {EventSeq, _} = ?get_Events(State, Max), - corba:reply(RespondTo, EventSeq), - stop_timer(State), - {noreply, ?reset_RespondTo(State)}; - _-> - {noreply, State} - end; - %% No client waiting. Store the event(s). - {Events, _} -> - ?DBG("PROXY RECEIVED SEQUENCE: ~p~n",[Events]), - store_events(State, Events), - {noreply, State} - end. - -store_events(_State, []) -> - ok; -store_events(State, [Event|Rest]) when ?is_ANY(State) -> - AnyEvent = any:create('CosNotification_StructuredEvent':tc(),Event), - ?add_Event(State,AnyEvent), - store_events(State, Rest); -store_events(State, [Event|Rest]) -> - ?add_Event(State,Event), - store_events(State, Rest). - -%%----------------------------------------------------------- -%% function : callAny -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -callAny(_OE_THIS, OE_FROM, State, EventIn, Status) -> - corba:reply(OE_FROM, ok), - case cosNotification_eventDB:validate_event(?get_SubscribeData(State), EventIn, - ?get_AllFilter(State), - ?get_SubscribeDB(State), - Status) of - {[],_} -> - ?DBG("PROXY NOSUBSCRIPTION ANY: ~p~n",[EventIn]), - {noreply, State}; - {Event,_} when ?is_ANY(State), ?is_Waiting(State) -> - ?DBG("PROXY RECEIVED ANY: ~p~n",[Event]), - case ?addAndGet_Event(State, Event) of - {[],_} -> - %% Unable to deliver the event (Starttime, Deadline etc). - {noreply, State}; - {MaybeOtherEvent , _} -> - corba:reply(?get_RespondTo(State), MaybeOtherEvent), - {noreply, ?reset_RespondTo(State)} - end; - {Event,_} when ?is_ANY(State) -> - ?DBG("PROXY RECEIVED ANY: ~p~n",[Event]), - ?add_Event(State,Event), - {noreply, State}; - {Event,_} when ?is_STRUCTURED(State), ?is_Waiting(State) -> - ?DBG("PROXY RECEIVED ANY==>STRUCTURED: ~p~n",[Event]), - case ?addAndGet_Event(State, ?not_CreateSE("","%ANY","",[],[],Event)) of - {[],_} -> - %% Unable to deliver the event (Starttime, Deadline etc). - {noreply, State}; - {MaybeOtherEvent , _} -> - corba:reply(?get_RespondTo(State), MaybeOtherEvent), - {noreply, ?reset_RespondTo(State)} - end; - {Event,_} when ?is_SEQUENCE(State), ?is_Waiting(State) -> - ?DBG("PROXY RECEIVED ANY==>SEQUENCE[1]: ~p~n",[Event]), - ?add_Event(State,?not_CreateSE("","%ANY","",[],[],Event)), - {RespondTo, Max} = ?get_RespondTo(State), - case ?is_BatchLimitReached(State, Max) of - true -> - {EventSeq, _} = ?get_Events(State, Max), - corba:reply(RespondTo, EventSeq), - stop_timer(State), - {noreply, ?reset_RespondTo(State)}; - _ -> - {noreply, State} - end; - {Event,_} -> - ?DBG("PROXY RECEIVED ANY==>STRUCTURED/SEQUENCE: ~p~n",[Event]), - ?add_Event(State,?not_CreateSE("","%ANY","",[],[],Event)), - {noreply, State} - end. - - - -%% Start timers which send a message each time we should push events. Only used -%% when this objects is defined to supply sequences. -start_timer(State) -> - TS = erlang:timestamp(), - case catch timer:send_after(timer:seconds(?get_PacingInterval(State)), - {pacing, TS}) of - {ok,PacTRef} -> - ?DBG("PULL SUPPLIER STARTED TIMER, BATCH LIMIT: ~p~n", - [?get_BatchLimit(State)]), - ?set_PacingTimer(State, {PacTRef, TS}); - What -> - orber:dbg("[~p] PullerSupplier:start_timer();~n" - "Unable to invoke timer:send_interval/2: ~p", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -stop_timer(State) -> - case ?get_PacingTimer(State) of - undefined -> - ok; - {Timer, _} -> - ?DBG("PULL SUPPLIER STOPPED TIMER~n",[]), - timer:cancel(Timer) - end. - -%%--------------- MISC FUNCTIONS, E.G. DEBUGGING ------------- -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosNotification/src/PusherConsumer_impl.erl b/lib/cosNotification/src/PusherConsumer_impl.erl deleted file mode 100644 index f82f9d8bbd..0000000000 --- a/lib/cosNotification/src/PusherConsumer_impl.erl +++ /dev/null @@ -1,730 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : PusherConsumer_impl.erl -%% Purpose : -%%---------------------------------------------------------------------- - --module('PusherConsumer_impl'). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% cosEvent files. --include_lib("cosEvent/include/CosEventChannelAdmin.hrl"). --include_lib("cosEvent/include/CosEventComm.hrl"). -%% Application files --include("CosNotification.hrl"). --include("CosNotifyChannelAdmin.hrl"). --include("CosNotifyComm.hrl"). --include("CosNotifyFilter.hrl"). - --include("CosNotification_Definitions.hrl"). - -%%--------------- EXPORTS ------------------------------------ -%%--------------- External ----------------------------------- -%%----- CosNotifyChannelAdmin::ProxyPushConsumer ------------- --export([connect_any_push_supplier/4]). - -%%----- CosNotifyChannelAdmin::SequenceProxyPushConsumer ----- --export([connect_sequence_push_supplier/4]). - -%%----- CosNotifyChannelAdmin::StructuredProxyPushConsumer --- --export([connect_structured_push_supplier/4]). - -%%----- Inherit from CosNotifyChannelAdmin::ProxyConsumer ---- --export([obtain_subscription_types/4, - validate_event_qos/4]). - -%%----- Inherit from CosNotification::QoSAdmin --------------- --export([get_qos/3, - set_qos/4, - validate_qos/4]). - -%%----- Inherit from CosNotifyComm::NotifyPublish ------------ --export([offer_change/5]). - -%%----- Inherit from CosNotifyFilter::FilterAdmin ------------ --export([add_filter/4, - remove_filter/4, - get_filter/4, - get_all_filters/3, - remove_all_filters/3]). - -%%----- Inherit from CosEventComm::PushConsumer ------------- --export([push/4, - disconnect_push_consumer/3]). - -%%----- Inherit from CosNotifyComm::SequencePushConsumer ---- --export([push_structured_events/4, - disconnect_sequence_push_consumer/3]). - -%%----- Inherit from CosNotifyComm::StructuredPushConsumer -- --export([push_structured_event/4, - disconnect_structured_push_consumer/3]). - -%%----- Inherit from CosEventChannelAdmin::ProxyPushConsumer --export([connect_push_supplier/4]). - -%% Attributes (external) CosNotifyChannelAdmin::ProxySupplier --export(['_get_MyType'/3, - '_get_MyAdmin'/3]). - -%%--------------- gen_server specific exports ---------------- --export([handle_info/2, code_change/3]). --export([init/1, terminate/2]). - -%%--------------- LOCAL DEFINITIONS -------------------------- -%% Data structures --record(state, {myType, - myAdmin, - myAdminPid, - myChannel, - myFilters = [], - myOperator, - idCounter = 0, - client, - qosGlobal, - qosLocal, - publishType = false, - etsR, - eventDB}). - -%% Data structures constructors --define(get_InitState(_MyT, _MyA, _MyAP, _QS, _LQS, _Ch, _EDB, _MyOP), - #state{myType = _MyT, - myAdmin = _MyA, - myAdminPid= _MyAP, - myChannel = _Ch, - myOperator= _MyOP, - qosGlobal = _QS, - qosLocal = _LQS, - etsR = ets:new(oe_ets, [set, protected]), - eventDB = _EDB}). - -%%-------------- Data structures selectors ----------------- -%% Attributes --define(get_MyType(S), S#state.myType). --define(get_MyAdmin(S), S#state.myAdmin). --define(get_MyAdminPid(S), S#state.myAdminPid). --define(get_MyChannel(S), S#state.myChannel). --define(get_MyOperator(S), S#state.myOperator). -%% Client Object --define(get_Client(S), S#state.client). -%% QoS --define(get_GlobalQoS(S), S#state.qosGlobal). --define(get_LocalQoS(S), S#state.qosLocal). --define(get_BothQoS(S), {S#state.qosGlobal, S#state.qosLocal}). -%% Filters --define(get_Filter(S, I), find_obj(lists:keysearch(I, 1, S#state.myFilters))). --define(get_AllFilter(S), S#state.myFilters). --define(get_AllFilterID(S), find_ids(S#state.myFilters)). -%% Publish --define(get_AllPublish(S), lists:flatten(ets:match(S#state.etsR, - {'$1',publish}))). --define(get_PublishType(S), S#state.publishType). -%% ID --define(get_IdCounter(S), S#state.idCounter). -%% Event --define(get_Event(S), cosNotification_eventDB:get_event(S#state.eventDB)). --define(get_Events(S,M), cosNotification_eventDB:get_events(S#state.eventDB, M)). - --define(get_EventCounter(S), S#state.eventCounter). -%% Admin --define(get_BatchLimit(S), ?not_GetMaximumBatchSize((S#state.qosLocal))). - -%%-------------- Data structures modifiers ----------------- -%% Client Object --define(set_Client(S,D), S#state{client=D}). --define(del_Client(S), S#state{client=undefined}). --define(set_Unconnected(S), S#state{client=undefined}). -%% QoS --define(set_LocalQoS(S,D), S#state{qosLocal=D}). --define(set_GlobalQoS(S,D), S#state{qosGlobal=D}). --define(set_BothQoS(S,GD,LD), S#state{qosGlobal=GD, qosLocal=LD}). -%% Filters --define(add_Filter(S,I,O), S#state{myFilters=[{I,O}|S#state.myFilters]}). --define(del_Filter(S,I), S#state{myFilters= - delete_obj(lists:keydelete(I, 1, S#state.myFilters), - S#state.myFilters)}). --define(del_AllFilter(S), S#state{myFilters=[]}). -%% Publish --define(add_Publish(S,E), ets:insert(S#state.etsR, {E, publish})). --define(del_Publish(S,E), ets:delete(S#state.etsR, E)). --define(set_PublishType(S,T), S#state{publishType=T}). -%% ID --define(set_IdCounter(S,V), S#state{idCounter=V}). --define(new_Id(S), 'CosNotification_Common':create_id(S#state.idCounter)). -%% Event --define(add_Event(S,E), cosNotification_eventDB:add_event(S#state.eventDB, E)). --define(update_EventDB(S,Q), S#state{eventDB= - cosNotification_eventDB:update(S#state.eventDB, Q)}). - --define(set_EventCounter(S,V), S#state{eventCounter=V}). --define(add_to_EventCounter(S,V),S#state{eventCounter=S#state.eventCounter+V}). --define(reset_EventCounter(S), S#state{eventCounter=0}). --define(increase_EventCounter(S),S#state{eventCounter=(S#state.eventCounter+1)}). --define(decrease_EventCounter(S),S#state{eventCounter=S#state.eventCounter-1}). --define(add_ToEventCounter(S,A), S#state{eventCounter=(S#state.eventCounter+A)}). --define(sub_FromEventCounter(S,_A), S#state{eventCounter=(S#state.eventCounter-_A)}). --define(set_EventCounterTo(S,V), S#state{eventCounter=V}). - -%% MISC --define(is_ANY(S), S#state.myType == 'PUSH_ANY'). --define(is_STRUCTURED(S), S#state.myType == 'PUSH_STRUCTURED'). --define(is_SEQUENCE(S), S#state.myType == 'PUSH_SEQUENCE'). --define(is_ANDOP(S), S#state.myOperator == 'AND_OP'). --define(is_UnConnected(S), S#state.client == undefined). --define(is_Connected(S), S#state.client =/= undefined). --define(is_PersistentConnection(S), - ?not_GetConnectionReliability((S#state.qosLocal)) == ?not_Persistent). --define(is_PersistentEvent(S), - ?not_GetEventReliability((S#state.qosLocal)) == ?not_Persistent). --define(is_BatchLimitReached(S), S#state.eventCounter >= - ?not_GetMaximumBatchSize((S#state.qosLocal))). - - -%%----------------------------------------------------------% -%% function : handle_info, code_change -%% Arguments: -%% Returns : -%% Effect : Functions demanded by the gen_server module. -%%----------------------------------------------------------- - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -handle_info(Info, State) -> - ?DBG("INFO: ~p~n", [Info]), - case Info of - {'EXIT', Pid, Reason} when ?get_MyAdminPid(State)==Pid-> - ?DBG("PARENT ADMIN: ~p TERMINATED.~n",[Reason]), - {stop, Reason, State}; - {'EXIT', _Pid, _Reason} -> - ?DBG("PROXYPUSHCONSUMER: ~p TERMINATED.~n",[_Reason]), - {noreply, State}; - _ -> - {noreply, State} - end. - -%%----------------------------------------------------------% -%% function : init, terminate -%% Arguments: -%%----------------------------------------------------------- - -init(['PUSH_SEQUENCE', MyAdmin, MyAdminPid, InitQoS, LQS, - MyChannel, Options, Operator]) -> - process_flag(trap_exit, true), - %% Only if MyType is 'PUSH_SEQUENCE' we need an ets to store events in. - %% Otherwise we'll forward them at once. Why? We don't know when the next event - %% is due. - GCTime = 'CosNotification_Common':get_option(gcTime, Options, - ?not_DEFAULT_SETTINGS), - GCLimit = 'CosNotification_Common':get_option(gcLimit, Options, - ?not_DEFAULT_SETTINGS), - TimeRef = 'CosNotification_Common':get_option(timeService, Options, - ?not_DEFAULT_SETTINGS), - {ok, ?get_InitState('PUSH_SEQUENCE', MyAdmin, MyAdminPid, InitQoS, LQS, MyChannel, - cosNotification_eventDB:create_db(LQS, GCTime, GCLimit, TimeRef), - Operator)}; -init([MyType, MyAdmin, MyAdminPid, InitQoS, LQS, MyChannel, _Options, Operator]) -> - process_flag(trap_exit, true), - {ok, ?get_InitState(MyType, MyAdmin, MyAdminPid, InitQoS, LQS, MyChannel, - undefined, Operator)}. - -terminate(_Reason, State) when ?is_UnConnected(State) -> - ok; -terminate(_Reason, State) -> - Client = ?get_Client(State), - case catch corba_object:is_nil(Client) of - false when ?is_ANY(State) -> - 'CosNotification_Common':disconnect('CosEventComm_PushSupplier', - disconnect_push_supplier, - Client); - false when ?is_SEQUENCE(State) -> - 'CosNotification_Common':disconnect('CosNotifyComm_SequencePushSupplier', - disconnect_sequence_push_supplier, - Client); - false when ?is_STRUCTURED(State) -> - 'CosNotification_Common':disconnect('CosNotifyComm_StructuredPushSupplier', - disconnect_structured_push_supplier, - Client); - _ -> - ok - end. - -%%----------------------------------------------------------- -%%----- CosNotifyChannelAdmin_ProxyConsumer attributes ------ -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% Attribute: '_get_MyType' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_MyType'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_MyType(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_MyAdmin' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_MyAdmin'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_MyAdmin(State), State}. - -%%----------------------------------------------------------- -%%------- Exported external functions ----------------------- -%%----------------------------------------------------------- -%%----- CosEventChannelAdmin::ProxyPushConsumer ------------- -%%----------------------------------------------------------% -%% function : connect_push_supplier -%% Arguments: Client - CosEventComm::PushSupplier -%% Returns : ok | {'EXCEPTION', #'AlreadyConnected'{}} | -%% {'EXCEPTION', #'TypeError'{}} -%% Both exceptions from CosEventChannelAdmin!!! -%%----------------------------------------------------------- -connect_push_supplier(OE_THIS, OE_FROM, State, Client) -> - connect_any_push_supplier(OE_THIS, OE_FROM, State, Client). - -%%----- CosNotifyChannelAdmin::ProxyPushConsumer ------------ -%%----------------------------------------------------------% -%% function : connect_any_push_supplier -%% Arguments: Client - CosEventComm::PushSupplier -%% Returns : ok | {'EXCEPTION', #'AlreadyConnected'{}} | -%% {'EXCEPTION', #'TypeError'{}} -%% Both exceptions from CosEventChannelAdmin!!! -%%----------------------------------------------------------- -connect_any_push_supplier(_OE_THIS, _OE_FROM, State, Client) when ?is_ANY(State) -> - ?not_TypeCheck(Client, 'CosEventComm_PushSupplier'), - if - ?is_Connected(State) -> - corba:raise(#'CosEventChannelAdmin_AlreadyConnected'{}); - true -> - {reply, ok, ?set_Client(State, Client)} - end; -connect_any_push_supplier(_, _, _, _) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----- CosNotifyChannelAdmin::SequenceProxyPushConsumer ---- -%%----------------------------------------------------------% -%% function : connect_sequence_push_supplier -%% Arguments: Client - CosNotifyComm::SequencePushSupplier -%% Returns : ok | {'EXCEPTION', #'AlreadyConnected'{}} | -%% {'EXCEPTION', #'TypeError'{}} -%%----------------------------------------------------------- -connect_sequence_push_supplier(_OE_THIS, _OE_FROM, State, Client) when ?is_SEQUENCE(State) -> - ?not_TypeCheck(Client, 'CosNotifyComm_SequencePushSupplier'), - if - ?is_Connected(State) -> - corba:raise(#'CosEventChannelAdmin_AlreadyConnected'{}); - true -> - {reply, ok, ?set_Client(State, Client)} - end; -connect_sequence_push_supplier(_, _, _, _) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----- CosNotifyChannelAdmin::StructuredProxyPushConsumer -- -%%----------------------------------------------------------% -%% function : connect_structured_push_supplier -%% Arguments: Client - CosNotifyComm::StructuredPushSupplier -%% Returns : ok | {'EXCEPTION', #'AlreadyConnected'{}} | -%% {'EXCEPTION', #'TypeError'{}} -%%----------------------------------------------------------- -connect_structured_push_supplier(_OE_THIS, _OE_FROM, State, Client) when ?is_STRUCTURED(State) -> - ?not_TypeCheck(Client, 'CosNotifyComm_StructuredPushSupplier'), - if - ?is_Connected(State) -> - corba:raise(#'CosEventChannelAdmin_AlreadyConnected'{}); - true -> - {reply, ok, ?set_Client(State, Client)} - end; -connect_structured_push_supplier(_, _, _, _) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----- Inherit from CosNotifyChannelAdmin::ProxyConsumer --- -%%----------------------------------------------------------% -%% function : obtain_subscription_types -%% Arguments: Mode - enum 'ObtainInfoMode' (CosNotifyChannelAdmin) -%% Returns : CosNotification::EventTypeSeq -%%----------------------------------------------------------- -obtain_subscription_types(_OE_THIS, _OE_FROM, State, 'ALL_NOW_UPDATES_OFF') -> - {reply, ?get_AllPublish(State), ?set_PublishType(State, false)}; -obtain_subscription_types(_OE_THIS, _OE_FROM, State, 'ALL_NOW_UPDATES_ON') -> - {reply, ?get_AllPublish(State), ?set_PublishType(State, true)}; -obtain_subscription_types(_OE_THIS, _OE_FROM, State, 'NONE_NOW_UPDATES_OFF') -> - {reply, [], ?set_PublishType(State, false)}; -obtain_subscription_types(_OE_THIS, _OE_FROM, State, 'NONE_NOW_UPDATES_ON') -> - {reply, [], ?set_PublishType(State, true)}; -obtain_subscription_types(_,_,_,What) -> - orber:dbg("[~p] PusherConsumer:obtain_subscription_types(~p);~n" - "Incorrect enumerant", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : validate_event_qos -%% Arguments: RequiredQoS - CosNotification::QoSProperties -%% Returns : ok | {'EXCEPTION', #'UnsupportedQoS'{}} -%% AvilableQoS - CosNotification::NamedPropertyRangeSeq (out) -%%----------------------------------------------------------- -validate_event_qos(_OE_THIS, _OE_FROM, State, RequiredQoS) -> - AvilableQoS = 'CosNotification_Common':validate_event_qos(RequiredQoS, - ?get_LocalQoS(State)), - {reply, {ok, AvilableQoS}, State}. - -%%----- Inherit from CosNotification::QoSAdmin -------------- -%%----------------------------------------------------------% -%% function : get_qos -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -get_qos(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_GlobalQoS(State), State}. - -%%----------------------------------------------------------% -%% function : set_qos -%% Arguments: QoS - CosNotification::QoSProperties, i.e., -%% [#'Property'{name, value}, ...] where name eq. string() -%% and value eq. any(). -%% Returns : ok | {'EXCEPTION', CosNotification::UnsupportedQoS} -%%----------------------------------------------------------- -set_qos(_OE_THIS, _OE_FROM, State, QoS) -> - {NewQoS, LQS} = 'CosNotification_Common':set_qos(QoS, ?get_BothQoS(State), - proxy, ?get_MyAdmin(State), - false), - NewState = ?update_EventDB(State, LQS), - {reply, ok, ?set_BothQoS(NewState, NewQoS, LQS)}. - -%%----------------------------------------------------------% -%% function : validate_qos -%% Arguments: Required_qos - CosNotification::QoSProperties -%% [#'Property'{name, value}, ...] where name eq. string() -%% and value eq. any(). -%% Returns : {'EXCEPTION', CosNotification::UnsupportedQoS} -%% {ok, CosNotification::NamedPropertyRangeSeq} -%%----------------------------------------------------------- -validate_qos(_OE_THIS, _OE_FROM, State, Required_qos) -> - QoS = 'CosNotification_Common':validate_qos(Required_qos, ?get_BothQoS(State), - proxy, ?get_MyAdmin(State), - false), - {reply, {ok, QoS}, State}. - -%%----- Inherit from CosNotifyComm::NotifyPublish ----------- -%%----------------------------------------------------------% -%% function : offer_change -%% Arguments: Added - #'CosNotification_EventType'{} -%% Removed - #'CosNotification_EventType'{} -%% Returns : ok | -%% {'EXCEPTION', #'CosNotifyComm_InvalidEventType'{}} -%%----------------------------------------------------------- -offer_change(_OE_THIS, _OE_FROM, State, Added, Removed) -> - cosNotification_Filter:validate_types(Added), - cosNotification_Filter:validate_types(Removed), - %% On this "side" we don't really care about which - %% type of events the client will supply. - %% Perhaps, later on, if we want to check this against Filters - %% associated with this object we may change this approach, i.e., if - %% the filter will not allow passing certain event types. But the - %% user should see to that that situation never occurs. It would add - %% extra overhead. Also see PusherSupplier- and PullerSuppler- - %% 'subscription_change'. - update_publish(add, State, Added), - update_publish(remove, State, Removed), - case ?get_PublishType(State) of - true -> - %% Perhaps we should handle exception here?! - %% Probably not. Better to stay "on-line". - catch 'CosNotifyComm_NotifySubscribe': - subscription_change(?get_Client(State), Added, Removed), - ok; - _-> - ok - end, - {reply, ok, State}. - -update_publish(_, _, [])-> - ok; -update_publish(add, State, [H|T]) -> - ?add_Publish(State, H), - update_publish(add, State, T); -update_publish(remove, State, [H|T]) -> - ?del_Publish(State, H), - update_publish(remove, State, T). - -%%----- Inherit from CosNotifyFilter::FilterAdmin ----------- -%%----------------------------------------------------------% -%% function : add_filter -%% Arguments: Filter - CosNotifyFilter::Filter -%% Returns : FilterID - long -%%----------------------------------------------------------- -add_filter(_OE_THIS, _OE_FROM, State, Filter) -> - 'CosNotification_Common':type_check(Filter, 'CosNotifyFilter_Filter'), - FilterID = ?new_Id(State), - NewState = ?set_IdCounter(State, FilterID), - {reply, FilterID, ?add_Filter(NewState, FilterID, Filter)}. - -%%----------------------------------------------------------% -%% function : remove_filter -%% Arguments: FilterID - long -%% Returns : ok -%%----------------------------------------------------------- -remove_filter(_OE_THIS, _OE_FROM, State, FilterID) when is_integer(FilterID) -> - {reply, ok, ?del_Filter(State, FilterID)}; -remove_filter(_,_,_,What) -> - orber:dbg("[~p] PusherConsumer:remove_filter(~p); Not an integer", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : get_filter -%% Arguments: FilterID - long -%% Returns : Filter - CosNotifyFilter::Filter | -%% {'EXCEPTION', #'CosNotifyFilter_FilterNotFound'{}} -%%----------------------------------------------------------- -get_filter(_OE_THIS, _OE_FROM, State, FilterID) when is_integer(FilterID) -> - {reply, ?get_Filter(State, FilterID), State}; -get_filter(_,_,_,What) -> - orber:dbg("[~p] PusherConsumer:get_filter(~p); Not an integer", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : get_all_filters -%% Arguments: - -%% Returns : Filter - CosNotifyFilter::FilterIDSeq -%%----------------------------------------------------------- -get_all_filters(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_AllFilterID(State), State}. - -%%----------------------------------------------------------% -%% function : remove_all_filters -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -remove_all_filters(_OE_THIS, _OE_FROM, State) -> - {reply, ok, ?del_AllFilter(State)}. - -%%----- Inherit from CosEventComm::PushConsumer ------------- -%%----------------------------------------------------------% -%% function : disconnect_push_consumer -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -disconnect_push_consumer(_OE_THIS, _OE_FROM, State) -> - {stop, normal, ok, ?set_Unconnected(State)}. - -%%----------------------------------------------------------% -%% function : push -%% Arguments: AnyEvent -%% Returns : ok | -%%----------------------------------------------------------- -push(OE_THIS, OE_FROM, State, Event) when ?is_ANY(State) -> - corba:reply(OE_FROM, ok), - case {?not_isConvertedStructured(Event), - cosNotification_eventDB:filter_events([Event], ?get_AllFilter(State))} of - {_, {[],_}} when ?is_ANDOP(State) -> - {noreply, State}; - {true, {[],[_]}} -> - %% Is OR and converted, change back and forward to Admin - forward(seq, ?get_MyAdmin(State), State, [any:get_value(Event)], - 'MATCH', OE_THIS); - {_, {[],[_]}} -> - %% Is OR and not converted, forward to Admin - forward(any, ?get_MyAdmin(State), State, Event, 'MATCH', OE_THIS); - {true, {[_],_}} when ?is_ANDOP(State) -> - %% Is AND and converted, change back and forward to Admin - forward(seq, ?get_MyAdmin(State), State, [any:get_value(Event)], - 'MATCH', OE_THIS); - {true, {[_],_}} -> - %% Is OR and converted, change back and forward to Channel - forward(seq, ?get_MyChannel(State), State, [any:get_value(Event)], - 'MATCHED', OE_THIS); - {_, {[_],_}} when ?is_ANDOP(State) -> - %% Is AND and not converted, forward to Admin - forward(any, ?get_MyAdmin(State), State, Event, 'MATCH', OE_THIS); - _ -> - %% Is OR and not converted, forward to Channel - forward(any, ?get_MyChannel(State), State, Event, 'MATCHED', OE_THIS) - end; -push(_, _, _, _) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----- Inherit from CosNotifyComm::SequencePushConsumer ---- -%%----------------------------------------------------------% -%% function : disconnect_sequence_push_consumer -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -disconnect_sequence_push_consumer(_OE_THIS, _OE_FROM, State) -> - {stop, normal, ok, ?set_Unconnected(State)}. - -%%----------------------------------------------------------% -%% function : push_structured_events -%% Arguments: CosNotification::EventBatch -%% Returns : ok | -%%----------------------------------------------------------- -push_structured_events(OE_THIS, OE_FROM, State, Events) when ?is_SEQUENCE(State) -> - corba:reply(OE_FROM, ok), - %% We cannot convert parts of the sequence to any, event though they - %% are converted from any to structured. Would be 'impossible' to send. - case cosNotification_eventDB:filter_events(Events, ?get_AllFilter(State)) of - {[],_} when ?is_ANDOP(State) -> - {noreply, State}; - {[],Failed} -> - forward(seq, ?get_MyAdmin(State), State, Failed, 'MATCH', OE_THIS); - {Passed, _} when ?is_ANDOP(State) -> - forward(seq, ?get_MyAdmin(State), State, Passed, 'MATCH', OE_THIS); - {Passed, []} -> - forward(seq, ?get_MyChannel(State), State, Passed, 'MATCHED', OE_THIS); - {Passed, Failed} -> - %% Is OR, send Passed to channel and Failed to Admin. - forward(seq, ?get_MyChannel(State), State, Passed, 'MATCHED', OE_THIS), - forward(seq, ?get_MyAdmin(State), State, Failed, 'MATCH', OE_THIS) - end; -push_structured_events(_,_,_,_) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----- Inherit from CosNotifyComm::StructuredPushConsumer -- -%%----------------------------------------------------------% -%% function : disconnect_structured_push_consumer -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -disconnect_structured_push_consumer(_OE_THIS, _OE_FROM, State) -> - {stop, normal, ok, ?set_Unconnected(State)}. - -%%----------------------------------------------------------% -%% function : push_structured_event -%% Arguments: CosNotification::StructuredEvent -%% Returns : ok | -%%----------------------------------------------------------- -push_structured_event(OE_THIS, OE_FROM, State, Event) when ?is_STRUCTURED(State) -> - corba:reply(OE_FROM, ok), - case {?not_isConvertedAny(Event), - cosNotification_eventDB:filter_events([Event], ?get_AllFilter(State))} of - {_, {[],_}} when ?is_ANDOP(State) -> - {noreply, State}; - {true, {[],[_]}} -> - %% Is OR and converted, change back and forward to Admin - forward(any, ?get_MyAdmin(State), State, - Event#'CosNotification_StructuredEvent'.remainder_of_body, - 'MATCH', OE_THIS); - {_, {[],[_]}} -> - %% Is OR and not converted, forward to Admin - forward(seq, ?get_MyAdmin(State), State, [Event], 'MATCH', OE_THIS); - {true, {[_],_}} when ?is_ANDOP(State) -> - %% Is AND and converted, change back and forward to Admin - forward(any, ?get_MyAdmin(State), State, - Event#'CosNotification_StructuredEvent'.remainder_of_body, - 'MATCH', OE_THIS); - {true, {[_],_}} -> - %% Is OR and converted, change back and forward to Channel - forward(any, ?get_MyChannel(State), State, - Event#'CosNotification_StructuredEvent'.remainder_of_body, - 'MATCHED', OE_THIS); - {_, {[_],_}} when ?is_ANDOP(State) -> - %% Is AND and not converted, forward to Admin - forward(seq, ?get_MyAdmin(State), State, [Event], 'MATCH', OE_THIS); - _ -> - %% Is OR and not converted, forward to Channel - forward(seq, ?get_MyChannel(State), State, [Event], 'MATCHED', OE_THIS) - end; -push_structured_event(_,_,_,_) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%--------------- LOCAL FUNCTIONS ---------------------------- -find_obj({value, {_, Obj}}) -> Obj; -find_obj(_) -> {'EXCEPTION', #'CosNotifyFilter_FilterNotFound'{}}. - -find_ids(List) -> find_ids(List, []). -find_ids([], Acc) -> Acc; -find_ids([{I,_}|T], Acc) -> find_ids(T, [I|Acc]); -find_ids(What, _) -> - orber:dbg("[~p] PusherConsumer:find_ids();~n" - "Id corrupt: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}). - -%% Delete a single object. -%% The list don not differ, i.e., no filter removed, raise exception. -delete_obj(List,List) -> corba:raise(#'CosNotifyFilter_FilterNotFound'{}); -delete_obj(List,_) -> List. - -%% Forward events -forward(any, SendTo, State, Event, Status, OE_THIS) -> - case catch oe_CosNotificationComm_Event:callAny(SendTo, Event, Status) of - ok -> - ?DBG("PROXY FORWARD ANY: ~p~n",[Event]), - {noreply, State}; - {'EXCEPTION', E} when is_record(E, 'OBJECT_NOT_EXIST') orelse - is_record(E, 'NO_PERMISSION') orelse - is_record(E, 'CosEventComm_Disconnected') -> - orber:dbg("[~p] PusherConsumer:forward();~n" - "Admin/Channel no longer exists; terminating and dropping: ~p", - [?LINE, Event], ?DEBUG_LEVEL), - 'CosNotification_Common':notify([{proxy, OE_THIS}, - {client, ?get_Client(State)}, - {reason, {'EXCEPTION', E}}]), - {stop, normal, State}; - R when ?is_PersistentConnection(State) -> - orber:dbg("[~p] PusherConsumer:forward();~n" - "Admin/Channel respond incorrect: ~p~n" - "Dropping: ~p", [?LINE, R, Event], ?DEBUG_LEVEL), - {noreply, State}; - R -> - orber:dbg("[~p] PusherConsumer:forward();~n" - "Admin/Channel respond incorrect: ~p~n" - "Terminating and dropping: ~p", - [?LINE, R, Event], ?DEBUG_LEVEL), - 'CosNotification_Common':notify([{proxy, OE_THIS}, - {client, ?get_Client(State)}, - {reason, R}]), - {stop, normal, State} - end; -forward(seq, SendTo, State, Event, Status, OE_THIS) -> - case catch oe_CosNotificationComm_Event:callSeq(SendTo, Event, Status) of - ok -> - {noreply, State}; - {'EXCEPTION', E} when is_record(E, 'OBJECT_NOT_EXIST') orelse - is_record(E, 'NO_PERMISSION') orelse - is_record(E, 'CosEventComm_Disconnected') -> - ?DBG("ADMIN NO LONGER EXIST; DROPPING: ~p~n", [Event]), - 'CosNotification_Common':notify([{proxy, OE_THIS}, - {client, ?get_Client(State)}, - {reason, {'EXCEPTION', E}}]), - {stop, normal, State}; - R when ?is_PersistentConnection(State) -> - orber:dbg("[~p] PusherConsumer:forward();~n" - "Admin/Channel respond incorrect: ~p~n" - "Dropping: ~p", [?LINE, R, Event], ?DEBUG_LEVEL), - {noreply, State}; - R -> - orber:dbg("[~p] PusherConsumer:forward();~n" - "Admin/Channel respond incorrect: ~p~n" - "Terminating and dropping: ~p", - [?LINE, R, Event], ?DEBUG_LEVEL), - 'CosNotification_Common':notify([{proxy, OE_THIS}, - {client, ?get_Client(State)}, - {reason, R}]), - {stop, normal, State} - end. - -%%--------------- MISC FUNCTIONS, E.G. DEBUGGING ------------- -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosNotification/src/PusherSupplier_impl.erl b/lib/cosNotification/src/PusherSupplier_impl.erl deleted file mode 100644 index d3e44f3ef9..0000000000 --- a/lib/cosNotification/src/PusherSupplier_impl.erl +++ /dev/null @@ -1,1053 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : PusherSupplier_impl.erl -%% Purpose : -%%---------------------------------------------------------------------- - --module('PusherSupplier_impl'). - - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% cosEvent files. --include_lib("cosEvent/include/CosEventChannelAdmin.hrl"). --include_lib("cosEvent/include/CosEventComm.hrl"). -%% Application files --include("CosNotification.hrl"). --include("CosNotifyChannelAdmin.hrl"). --include("CosNotifyComm.hrl"). --include("CosNotifyFilter.hrl"). - --include("CosNotification_Definitions.hrl"). - -%%--------------- EXPORTS ------------------------------------ -%%--------------- External ----------------------------------- -%%----- CosNotifyChannelAdmin::ProxyPushSupplier ------------- --export([connect_any_push_consumer/4]). - -%%----- CosNotifyChannelAdmin::StructuredProxyPushSupplier --- --export([connect_structured_push_consumer/4]). - -%%----- CosNotifyChannelAdmin::SequenceProxyPushSupplier ----- --export([connect_sequence_push_consumer/4]). - -%%----- CosNotifyChannelAdmin::*ProxyPushSupplier ------------ --export([suspend_connection/3, - resume_connection/3]). - -%%----- Inherit from CosNotifyChannelAdmin::ProxySupplier ---- --export([obtain_offered_types/4, - validate_event_qos/4]). - -%%----- Inherit from CosNotification::QoSAdmin --------------- --export([get_qos/3, - set_qos/4, - validate_qos/4]). - -%%----- Inherit from CosNotifyComm::NotifySubscribe ---------- --export([subscription_change/5]). - -%%----- Inherit from CosNotifyFilter::FilterAdmin ------------ --export([add_filter/4, - remove_filter/4, - get_filter/4, - get_all_filters/3, - remove_all_filters/3]). - -%%----- Inherit from CosEventComm::PushSupplier ------------- --export([disconnect_push_supplier/3]). - -%%----- Inherit from CosNotifyComm::StructuredPushSupplier -- --export([disconnect_structured_push_supplier/3]). - -%%----- Inherit from CosNotifyComm::SequencePushSupplier ---- --export([disconnect_sequence_push_supplier/3]). - -%%----- Inherit from CosEventChannelAdmin::ProxyPushSupplier --export([connect_push_consumer/4]). - -%% Attributes (external) CosNotifyChannelAdmin::ProxySupplier --export(['_get_MyType'/3, - '_get_MyAdmin'/3, - '_get_priority_filter'/3, - '_set_priority_filter'/4, - '_get_lifetime_filter'/3, - '_set_lifetime_filter'/4]). - -%%--------------- Internal ----------------------------------- -%%----- Inherit from cosNotificationComm --------------------- --export([callAny/5, - callSeq/5]). - -%%--------------- gen_server specific exports ---------------- --export([handle_info/2, code_change/3]). --export([init/1, terminate/2]). - -%%--------------- LOCAL DEFINITIONS -------------------------- -%% Data structures --record(state, {myType, - myAdmin, - myAdminPid, - myChannel, - myFilters = [], - myOperator, - idCounter = 0, - prioFil, - lifetFil, - client, - qosGlobal, - qosLocal, - suspended = false, - pacingTimer, - subscribeType = false, - subscribeData = true, - etsR, - eventDB, - this, - maxCache, - cacheTimeout, - cacheInterval}). - -%% Data structures constructors --define(get_InitState(_MyT, _MyA, _MyAP, _QS, _LQS, _Ch, _MyOp, _GT, _GL, _TR), - #state{myType = _MyT, - myAdmin = _MyA, - myAdminPid= _MyAP, - qosGlobal = _QS, - qosLocal = _LQS, - myChannel = _Ch, - myOperator=_MyOp, - etsR = ets:new(oe_ets, [set, protected]), - eventDB = cosNotification_eventDB:create_db(_LQS, _GT, _GL, _TR), - maxCache = cosNotificationApp:max_events()}). - -%% Data structures selectors -%%-------------- Data structures selectors ----------------- -%% Attributes --define(get_MyType(S), S#state.myType). --define(get_MyAdmin(S), S#state.myAdmin). --define(get_MyAdminPid(S), S#state.myAdminPid). --define(get_MyChannel(S), S#state.myChannel). --define(get_MyOperator(S), S#state.myOperator). --define(get_PrioFil(S), S#state.prioFil). --define(get_LifeTFil(S), S#state.lifetFil). -%% Client Object --define(get_Client(S), S#state.client). -%% QoS --define(get_GlobalQoS(S), S#state.qosGlobal). --define(get_LocalQoS(S), S#state.qosLocal). --define(get_BothQoS(S), {S#state.qosGlobal, S#state.qosLocal}). -%% Filters --define(get_Filter(S, I), find_obj(lists:keysearch(I, 1, S#state.myFilters))). --define(get_AllFilter(S), S#state.myFilters). --define(get_AllFilterID(S), find_ids(S#state.myFilters)). -%% Amin --define(get_PacingTimer(S), S#state.pacingTimer). --define(get_PacingInterval(S), round(?not_GetPacingInterval((S#state.qosLocal))/10000000)). --define(get_BatchLimit(S), ?not_GetMaximumBatchSize((S#state.qosLocal))). -%% Subscribe --define(get_AllSubscribe(S), lists:flatten(ets:match(S#state.etsR, - {'$1',subscribe}))). --define(get_SubscribeType(S), S#state.subscribeType). --define(get_SubscribeData(S), S#state.subscribeData). -%% ID --define(get_IdCounter(S), S#state.idCounter). --define(get_SubscribeDB(S), S#state.etsR). -%% Event --define(is_PersistentConnection(S), - (?not_GetConnectionReliability((S#state.qosLocal)) == ?not_Persistent)). --define(is_PersistentEvent(S), - (?not_GetEventReliability((S#state.qosLocal)) == ?not_Persistent)). - --define(get_Event(S), cosNotification_eventDB:get_event(S#state.eventDB, - false)). -% (not ?is_PersistentEvent(S)))). --define(get_Events(S,M), cosNotification_eventDB:get_events(S#state.eventDB, M, false)). -% (not ?is_PersistentEvent(S)))). - -%%-------------- Data structures modifiers ----------------- -%% Attributes --define(set_PrioFil(S,D), S#state{prioFil=D}). --define(set_LifeTFil(S,D), S#state{lifetFil=D}). -%% Client Object --define(set_Client(S,D), S#state{client=D}). --define(del_Client(S), S#state{client=undefined}). --define(set_Unconnected(S), S#state{client=undefined}). --define(set_Suspended(S), S#state{suspended=true}). --define(set_NotSuspended(S), S#state{suspended=false}). -%% QoS --define(set_LocalQoS(S,D), S#state{qosLocal=D}). --define(set_GlobalQoS(S,D), S#state{qosGlobal=D}). --define(set_BothQoS(S,GD,LD), S#state{qosGlobal=GD, qosLocal=LD}). -%% Filters --define(add_Filter(S,I,O), S#state{myFilters=[{I,O}|S#state.myFilters]}). --define(del_Filter(S,I), S#state{myFilters= - delete_obj(lists:keydelete(I, 1, S#state.myFilters), - S#state.myFilters)}). --define(del_AllFilter(S), S#state{myFilters=[]}). -%% Admin --define(set_PacingTimer(S,T), S#state{pacingTimer=T}). -%% Publish -%% Subscribe --define(add_Subscribe(S,E), ets:insert(S#state.etsR, {E, subscribe})). --define(del_Subscribe(S,E), ets:delete(S#state.etsR, E)). --define(set_SubscribeType(S,T), S#state{subscribeType=T}). --define(set_SubscribeData(S,D), S#state{subscribeData=D}). -%% ID --define(set_IdCounter(S,V), S#state{idCounter=V}). --define(new_Id(S), 'CosNotification_Common':create_id(S#state.idCounter)). -%% Events --define(add_Event(S,E), catch cosNotification_eventDB: - add_event(S#state.eventDB, E, S#state.lifetFil, S#state.prioFil)). --define(addAndGet_Event(S,E), catch cosNotification_eventDB: - add_and_get_event(S#state.eventDB, E, S#state.lifetFil, S#state.prioFil, - false)). -% ?is_PersistentEvent(S))). --define(update_EventDB(S,Q), S#state{eventDB= - cosNotification_eventDB:update(S#state.eventDB, Q)}). - - -%%-------------- MISC ---------------------------------------- --define(is_ANY(S), S#state.myType == 'PUSH_ANY'). --define(is_STRUCTURED(S), S#state.myType == 'PUSH_STRUCTURED'). --define(is_SEQUENCE(S), S#state.myType == 'PUSH_SEQUENCE'). --define(is_ANDOP(S), S#state.myOperator == 'AND_OP'). --define(is_UnConnected(S), S#state.client == undefined). --define(is_Connected(S), S#state.client =/= undefined). --define(is_Suspended(S), S#state.suspended == true). --define(is_NotSuspended(S), S#state.suspended == false). --define(is_BatchLimitReached(S), cosNotification_eventDB:status(S#state.eventDB, - {batchLimit, - ?not_GetMaximumBatchSize((S#state.qosLocal))})). --define(has_Filters(S), S#state.myFilters =/= []). - -%%----------------------------------------------------------% -%% function : handle_info, code_change -%% Arguments: -%% Returns : -%% Effect : Functions demanded by the gen_server module. -%%----------------------------------------------------------- - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -handle_info(Info, #state{cacheTimeout = Timeout, - cacheInterval = Interval} = State) -> - ?DBG("INFO: ~p~n", [Info]), - case Info of - {'EXIT', Pid, Reason} when ?get_MyAdminPid(State)==Pid -> - ?DBG("PARENT ADMIN: ~p TERMINATED.~n",[Reason]), - {stop, Reason, State}; - {'EXIT', _Pid, _Reason} -> - ?DBG("PROXYPUSHSUPPLIER: ~p TERMINATED.~n",[_Reason]), - {noreply, State}; - pacing -> - lookup_and_push(State, true); - cacheInterval -> - lookup_and_push(State, true); - cacheTimeout when Timeout == undefined, Interval == undefined -> - %% Late message, do not terminate - {noreply, State}; - cacheTimeout -> - 'CosNotification_Common':notify([{proxy, State#state.this}, - {client, State#state.client}, - {reason, - {timer, "Reached upper limit"}}]), - {stop, normal, State}; - _ -> - {noreply, State} - end. - -%%----------------------------------------------------------% -%% function : init, terminate -%% Arguments: -%%----------------------------------------------------------- - -init([MyType, MyAdmin, MyAdminPid, InitQoS, LQS, MyChannel, Options, Operator]) -> - process_flag(trap_exit, true), - GCTime = 'CosNotification_Common':get_option(gcTime, Options, - ?not_DEFAULT_SETTINGS), - GCLimit = 'CosNotification_Common':get_option(gcLimit, Options, - ?not_DEFAULT_SETTINGS), - TimeRef = 'CosNotification_Common':get_option(timeService, Options, - ?not_DEFAULT_SETTINGS), - timer:start(), - {ok, ?get_InitState(MyType, MyAdmin, MyAdminPid, - InitQoS, LQS, MyChannel, Operator, GCTime, GCLimit, TimeRef)}. - -terminate(_Reason, State) when ?is_UnConnected(State) -> - stop_timer(State#state.cacheTimeout), - stop_timer(State#state.cacheInterval), - stop_timer(State#state.pacingTimer), - %% We are not connected to a Client. Hence, no need to invoke disconnect. - ok; -terminate(_Reason, State) when ?is_ANY(State) -> - stop_timer(State#state.cacheTimeout), - stop_timer(State#state.cacheInterval), - stop_timer(State#state.pacingTimer), - 'CosNotification_Common':disconnect('CosEventComm_PushConsumer', - disconnect_push_consumer, - ?get_Client(State)); -terminate(_Reason, State) when ?is_SEQUENCE(State) -> - stop_timer(State#state.cacheTimeout), - stop_timer(State#state.cacheInterval), - stop_timer(State#state.pacingTimer), - 'CosNotification_Common':disconnect('CosNotifyComm_SequencePushConsumer', - disconnect_sequence_push_consumer, - ?get_Client(State)); -terminate(_Reason, State) when ?is_STRUCTURED(State) -> - stop_timer(State#state.cacheTimeout), - stop_timer(State#state.cacheInterval), - stop_timer(State#state.pacingTimer), - 'CosNotification_Common':disconnect('CosNotifyComm_StructuredPushConsumer', - disconnect_structured_push_consumer, - ?get_Client(State)). - -%%----------------------------------------------------------- -%%----- CosNotifyChannelAdmin_ProxySupplier attributes ------ -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% Attribute: '_get_MyType' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_MyType'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_MyType(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_MyAdmin' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_MyAdmin'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_MyAdmin(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_*et_priority_filter' -%% Type : read/write -%% Returns : -%%----------------------------------------------------------- -'_get_priority_filter'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_PrioFil(State), State}. -'_set_priority_filter'(_OE_THIS, _OE_FROM, State, PrioF) -> - {reply, ok, ?set_PrioFil(State, PrioF)}. - -%%----------------------------------------------------------% -%% Attribute: '_*et_lifetime_filter' -%% Type : read/write -%% Returns : -%%----------------------------------------------------------- -'_get_lifetime_filter'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_LifeTFil(State), State}. -'_set_lifetime_filter'(_OE_THIS, _OE_FROM, State, LifeTF) -> - {reply, ok, ?set_LifeTFil(State, LifeTF)}. - -%%----------------------------------------------------------- -%%------- Exported external functions ----------------------- -%%----------------------------------------------------------- -%%----- CosEventChannelAdmin::ProxyPushSupplier ------------- -%%----------------------------------------------------------% -%% function : connect_push_consumer -%% Arguments: Client - CosEventComm::PushConsumer -%% Returns : ok | {'EXCEPTION', #'AlreadyConnected'{}} | -%% {'EXCEPTION', #'TypeError'{}} -%% Both exceptions from CosEventChannelAdmin!!!! -%%----------------------------------------------------------- -connect_push_consumer(OE_THIS, OE_FROM, State, Client) -> - connect_any_push_consumer(OE_THIS, OE_FROM, State, Client). - -%%----- CosNotifyChannelAdmin::ProxyPushSupplier ------------ -%%----------------------------------------------------------% -%% function : connect_any_push_consumer -%% Arguments: Client - CosEventComm::PushConsumer -%% Returns : ok | {'EXCEPTION', #'AlreadyConnected'{}} | -%% {'EXCEPTION', #'TypeError'{}} -%% Both exceptions from CosEventChannelAdmin!!!! -%%----------------------------------------------------------- -connect_any_push_consumer(OE_THIS, _OE_FROM, State, Client) when ?is_ANY(State) -> - 'CosNotification_Common':type_check(Client, 'CosEventComm_PushConsumer'), - if - ?is_Connected(State) -> - corba:raise(#'CosEventChannelAdmin_AlreadyConnected'{}); - true -> - {reply, ok, State#state{client = Client, this = OE_THIS}} - end; -connect_any_push_consumer(_, _, _, _) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----- CosNotifyChannelAdmin::SequenceProxyPushSupplier ---- -%%----------------------------------------------------------% -%% function : connect_sequence_push_consumer -%% Arguments: Client - CosNotifyComm::SequencePushConsumer -%% Returns : ok | {'EXCEPTION', #'AlreadyConnected'{}} | -%% {'EXCEPTION', #'TypeError'{}} -%%----------------------------------------------------------- -connect_sequence_push_consumer(OE_THIS, _OE_FROM, State, Client) when ?is_SEQUENCE(State) -> - 'CosNotification_Common':type_check(Client, - 'CosNotifyComm_SequencePushConsumer'), - if - ?is_Connected(State) -> - corba:raise(#'CosEventChannelAdmin_AlreadyConnected'{}); - true -> - NewState = start_timer(State), - {reply, ok, NewState#state{client = Client, this = OE_THIS}} - end; -connect_sequence_push_consumer(_, _, _, _) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----- CosNotifyChannelAdmin::StructuredProxyPushSupplier --- -%%----------------------------------------------------------% -%% function : connect_structured_push_consumer -%% Arguments: Client - CosNotifyComm::StructuredPushConsumer -%% Returns : ok | {'EXCEPTION', #'AlreadyConnected'{}} | -%% {'EXCEPTION', #'TypeError'{}} -%%----------------------------------------------------------- -connect_structured_push_consumer(OE_THIS, _OE_FROM, State, Client) when ?is_STRUCTURED(State) -> - 'CosNotification_Common':type_check(Client, - 'CosNotifyComm_StructuredPushConsumer'), - if - ?is_Connected(State) -> - corba:raise(#'CosEventChannelAdmin_AlreadyConnected'{}); - true -> - {reply, ok, State#state{client = Client, this = OE_THIS}} - end; -connect_structured_push_consumer(_, _, _, _) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----- CosNotifyChannelAdmin::*ProxyPushSupplier ----------- -%%----------------------------------------------------------% -%% function : suspend_connection -%% Arguments: -%% Returns : ok | {'EXCEPTION', #'ConnectionAlreadyInactive'{}} | -%% {'EXCEPTION', #'NotConneced'{}} -%%----------------------------------------------------------- -suspend_connection(_OE_THIS, _OE_FROM, State) when ?is_Connected(State) -> - if - ?is_Suspended(State) -> - corba:raise(#'CosNotifyChannelAdmin_ConnectionAlreadyInactive'{}); - true -> - stop_timer(State#state.pacingTimer), - {reply, ok, State#state{pacingTimer = undefined, - suspended=true}} - end; -suspend_connection(_,_,_)-> - corba:raise(#'CosNotifyChannelAdmin_NotConnected'{}). - -%%----------------------------------------------------------% -%% function : resume_connection -%% Arguments: -%% Returns : ok | {'EXCEPTION', #'ConnectionAlreadyActive'{}} | -%% {'EXCEPTION', #'NotConneced'{}} -%%----------------------------------------------------------- -resume_connection(_OE_THIS, OE_FROM, State) when ?is_Connected(State) -> - if - ?is_NotSuspended(State) -> - corba:raise(#'CosNotifyChannelAdmin_ConnectionAlreadyActive'{}); - true -> - corba:reply(OE_FROM, ok), - if - ?is_SEQUENCE(State) -> - start_timer(State); - true -> - ok - end, - lookup_and_push(?set_NotSuspended(State)) - end; -resume_connection(_,_,_) -> - corba:raise(#'CosNotifyChannelAdmin_NotConnected'{}). - -%%----- Inherit from CosNotifyChannelAdmin::ProxySupplier --- -%%----------------------------------------------------------% -%% function : obtain_offered_types -%% Arguments: Mode - enum 'ObtainInfoMode' (CosNotifyChannelAdmin) -%% Returns : CosNotification::EventTypeSeq -%%----------------------------------------------------------- -obtain_offered_types(_OE_THIS, _OE_FROM, State, 'ALL_NOW_UPDATES_OFF') -> - {reply, ?get_AllSubscribe(State), ?set_SubscribeType(State, false)}; -obtain_offered_types(_OE_THIS, _OE_FROM, State, 'ALL_NOW_UPDATES_ON') -> - {reply, ?get_AllSubscribe(State), ?set_SubscribeType(State, true)}; -obtain_offered_types(_OE_THIS, _OE_FROM, State, 'NONE_NOW_UPDATES_OFF') -> - {reply, [], ?set_SubscribeType(State, false)}; -obtain_offered_types(_OE_THIS, _OE_FROM, State, 'NONE_NOW_UPDATES_ON') -> - {reply, [], ?set_SubscribeType(State, true)}; -obtain_offered_types(_,_,_,What) -> - orber:dbg("[~p] PusherSupplier:obtain_offered_types(~p);~n" - "Bad enumerant", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : validate_event_qos -%% Arguments: RequiredQoS - CosNotification::QoSProperties -%% Returns : ok | {'EXCEPTION', #'UnsupportedQoS'{}} -%% AvilableQoS - CosNotification::NamedPropertyRangeSeq (out) -%%----------------------------------------------------------- -validate_event_qos(_OE_THIS, _OE_FROM, State, RequiredQoS) -> - AvilableQoS = 'CosNotification_Common':validate_event_qos(RequiredQoS, - ?get_LocalQoS(State)), - {reply, {ok, AvilableQoS}, State}. - -%%----- Inherit from CosNotification::QoSAdmin -------------- -%%----------------------------------------------------------% -%% function : get_qos -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -get_qos(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_GlobalQoS(State), State}. - -%%----------------------------------------------------------% -%% function : set_qos -%% Arguments: QoS - CosNotification::QoSProperties, i.e., -%% [#'Property'{name, value}, ...] where name eq. string() -%% and value eq. any(). -%% Returns : ok | {'EXCEPTION', CosNotification::UnsupportedQoS} -%%----------------------------------------------------------- -set_qos(_OE_THIS, _OE_FROM, State, QoS) -> - {NewQoS, LQS} = 'CosNotification_Common':set_qos(QoS, ?get_BothQoS(State), - proxy, ?get_MyAdmin(State), - false), - NewState = ?update_EventDB(State, LQS), - {reply, ok, ?set_BothQoS(NewState, NewQoS, LQS)}. - -%%----------------------------------------------------------% -%% function : validate_qos -%% Arguments: Required_qos - CosNotification::QoSProperties -%% [#'Property'{name, value}, ...] where name eq. string() -%% and value eq. any(). -%% Returns : {'EXCEPTION', CosNotification::UnsupportedQoS} -%% {ok, CosNotification::NamedPropertyRangeSeq} -%%----------------------------------------------------------- -validate_qos(_OE_THIS, _OE_FROM, State, Required_qos) -> - QoS = 'CosNotification_Common':validate_qos(Required_qos, ?get_BothQoS(State), - proxy, ?get_MyAdmin(State), - false), - {reply, {ok, QoS}, State}. - -%%----- Inherit from CosNotifyComm::NotifySubscribe --------- -%%----------------------------------------------------------% -%% function : subscription_change -%% Arguments: Added - #'CosNotification_EventType'{} -%% Removed - #'CosNotification_EventType'{} -%% Returns : ok | -%% {'EXCEPTION', #'CosNotifyComm_InvalidEventType'{}} -%%----------------------------------------------------------- -subscription_change(_OE_THIS, _OE_FROM, State, Added, Removed) -> - cosNotification_Filter:validate_types(Added), - cosNotification_Filter:validate_types(Removed), - %% On this "side", we care about which type of events the client - %% will require, since the client (or an agent) clearly stated - %% that it's only interested in these types of events. - %% Also see PusherConsumer- and PullerConsumer-'offer_change'. - update_subscribe(remove, State, Removed), - CurrentSub = ?get_AllSubscribe(State), - NewState = - case cosNotification_Filter:check_types(Added++CurrentSub) of - true -> - %% Types supplied does in some way cause all events to be valid. - %% Smart? Would have been better to not supply any at all. - ?set_SubscribeData(State, true); - {ok, Which, WC} -> - ?set_SubscribeData(State, {Which, WC}) - end, - update_subscribe(add, NewState, Added), - case ?get_SubscribeType(NewState) of - true -> - %% Perhaps we should handle exception here?! - %% Probably not. Better to stay "on-line". - catch 'CosNotifyComm_NotifyPublish': - offer_change(?get_Client(NewState), Added, Removed), - ok; - _-> - ok - end, - {reply, ok, NewState}. - -update_subscribe(_, _, [])-> - ok; -update_subscribe(add, State, [H|T]) -> - ?add_Subscribe(State, H), - update_subscribe(add, State, T); -update_subscribe(remove, State, [H|T]) -> - ?del_Subscribe(State, H), - update_subscribe(remove, State, T). - -%%----- Inherit from CosNotifyFilter::FilterAdmin ----------- -%%----------------------------------------------------------% -%% function : add_filter -%% Arguments: Filter - CosNotifyFilter::Filter -%% Returns : FilterID - long -%%----------------------------------------------------------- -add_filter(_OE_THIS, _OE_FROM, State, Filter) -> - 'CosNotification_Common':type_check(Filter, 'CosNotifyFilter_Filter'), - FilterID = ?new_Id(State), - NewState = ?set_IdCounter(State, FilterID), - {reply, FilterID, ?add_Filter(NewState, FilterID, Filter)}. - -%%----------------------------------------------------------% -%% function : remove_filter -%% Arguments: FilterID - long -%% Returns : ok -%%----------------------------------------------------------- -remove_filter(_OE_THIS, _OE_FROM, State, FilterID) when is_integer(FilterID) -> - {reply, ok, ?del_Filter(State, FilterID)}; -remove_filter(_,_,_,What) -> - orber:dbg("[~p] PusherSupplier:remove_filter(~p); Not an integer", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : get_filter -%% Arguments: FilterID - long -%% Returns : Filter - CosNotifyFilter::Filter | -%% {'EXCEPTION', #'CosNotifyFilter_FilterNotFound'{}} -%%----------------------------------------------------------- -get_filter(_OE_THIS, _OE_FROM, State, FilterID) when is_integer(FilterID) -> - {reply, ?get_Filter(State, FilterID), State}; -get_filter(_,_,_,What) -> - orber:dbg("[~p] PusherSupplier:get_filter(~p); Not an integer", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : get_all_filters -%% Arguments: - -%% Returns : Filter - CosNotifyFilter::FilterIDSeq -%%----------------------------------------------------------- -get_all_filters(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_AllFilterID(State), State}. - -%%----------------------------------------------------------% -%% function : remove_all_filters -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -remove_all_filters(_OE_THIS, _OE_FROM, State) -> - {reply, ok, ?del_AllFilter(State)}. - - -%%----- Inherit from CosEventComm::PushSupplier ------------- -%%----------------------------------------------------------% -%% function : disconnect_push_supplier -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -disconnect_push_supplier(_OE_THIS, _OE_FROM, State) -> - {stop, normal, ok, ?set_Unconnected(State)}. - -%%----- Inherit from CosNotifyComm::StructuredPushSupplier -- -%%----------------------------------------------------------% -%% function : disconnect_structured_push_supplier -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -disconnect_structured_push_supplier(_OE_THIS, _OE_FROM, State) -> - {stop, normal, ok, ?set_Unconnected(State)}. - -%%----- Inherit from CosNotifyComm::SequencePushSupplier ---- -%%----------------------------------------------------------% -%% function : disconnect_sequence_push_supplier -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -disconnect_sequence_push_supplier(_OE_THIS, _OE_FROM, State) -> - {stop, normal, ok, ?set_Unconnected(State)}. - -%%--------------- LOCAL FUNCTIONS ---------------------------- -find_obj({value, {_, Obj}}) -> Obj; -find_obj(_) -> {'EXCEPTION', #'CosNotifyFilter_FilterNotFound'{}}. - -find_ids(List) -> find_ids(List, []). -find_ids([], Acc) -> Acc; -find_ids([{I,_}|T], Acc) -> find_ids(T, [I|Acc]); -find_ids(What, _) -> - orber:dbg("[~p] PusherSupplier:find_ids();~n" - "Id corrupt: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}). - -%% Delete a single object. -%% The list do not differ, i.e., no filter removed, raise exception. -delete_obj(List,List) -> corba:raise(#'CosNotifyFilter_FilterNotFound'{}); -delete_obj(List,_) -> List. - -%%----------------------------------------------------------- -%% function : callSeq -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -callSeq(_OE_THIS, OE_FROM, State, EventsIn, Status) -> - corba:reply(OE_FROM, ok), - case cosNotification_eventDB:validate_event(?get_SubscribeData(State), EventsIn, - ?get_AllFilter(State), - ?get_SubscribeDB(State), - Status) of - {[],_} -> - ?DBG("PROXY NOSUBSCRIPTION SEQUENCE/STRUCTURED: ~p~n",[EventsIn]), - {noreply, State}; - {Events,_} when ?is_Suspended(State) -> - store_events(State, Events), - {noreply, State}; - {Events,_} when ?is_UnConnected(State) -> - orber:dbg("[~p] PusherSupplier:callAny();~n" - "Not connected, dropping event(s): ~p", - [?LINE, Events], ?DEBUG_LEVEL), - {noreply, State}; - {[Event],_} when ?is_STRUCTURED(State) -> - ?DBG("PROXY RECEIVED SEQUENCE: ~p~n",[Event]), - empty_db(State, ?addAndGet_Event(State, Event)); - {[Event],_} when ?is_ANY(State) -> - ?DBG("PROXY RECEIVED SEQUENCE: ~p~n",[Event]), - AnyEvent = any:create('CosNotification_StructuredEvent':tc(),Event), - empty_db(State, ?addAndGet_Event(State, AnyEvent)); - {Events,_} -> - ?DBG("PROXY RECEIVED SEQUENCE: ~p~n",[Events]), - store_events(State, Events), - lookup_and_push(State) - end. - -%%----------------------------------------------------------- -%% function : callAny -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -callAny(_OE_THIS, OE_FROM, State, EventIn, Status) -> - corba:reply(OE_FROM, ok), - case cosNotification_eventDB:validate_event(?get_SubscribeData(State), EventIn, - ?get_AllFilter(State), - ?get_SubscribeDB(State), - Status) of - {[],_} -> - ?DBG("PROXY NOSUBSCRIPTION ANY: ~p~n",[EventIn]), - %% To be on the safe side, test if there are any events that not - %% have been forwarded (should only be possible if StartTime is used). - lookup_and_push(State); - {Event,_} when ?is_Suspended(State), ?is_ANY(State) -> - ?add_Event(State, Event), - {noreply, State}; - {Event,_} when ?is_Suspended(State) -> - ?add_Event(State, ?not_CreateSE("","%ANY","",[],[],Event)), - {noreply, State}; - {Event,_} when ?is_UnConnected(State) -> - orber:dbg("[~p] PusherSupplier:callAny();~n" - "Not connected, dropping event: ~p", - [?LINE, Event], ?DEBUG_LEVEL), - {noreply, State}; - {Event,_} when ?is_ANY(State) -> - ?DBG("PROXY RECEIVED ANY: ~p~n",[Event]), - %% We must store the event since there may be other events that should - %% be delivered first, e.g., higher priority. - empty_db(State, ?addAndGet_Event(State, Event)); - {Event,_} when ?is_SEQUENCE(State) -> - ?DBG("PROXY RECEIVED ANY==>SEQUENCE: ~p~n",[Event]), - StrEvent = ?not_CreateSE("","%ANY","",[],[],Event), - ?add_Event(State, StrEvent), - lookup_and_push(State); - {Event,_} -> - ?DBG("PROXY RECEIVED ANY==>STRUCTURED: ~p~n",[Event]), - StrEvent = ?not_CreateSE("","%ANY","",[],[],Event), - empty_db(State, ?addAndGet_Event(State, StrEvent)) - end. - -%% Lookup and push "the correct" amount of events. -lookup_and_push(State) -> - %% The boolean indicates, if false, that we will only push events if we have - %% passed the BatchLimit. If true we will ignore this limit and push events - %% anyway (typcially invoked when pacing limit passed). - lookup_and_push(State, false). -lookup_and_push(State, false) when ?is_SEQUENCE(State) -> - case ?is_BatchLimitReached(State) of - true -> - case ?get_Events(State, ?get_BatchLimit(State)) of - {[], _, _} -> - ?DBG("BATCHLIMIT (~p) REACHED BUT NO EVENTS FOUND~n", - [?get_BatchLimit(State)]), - {noreply, State}; - {Events, _, Keys} -> - ?DBG("BATCHLIMIT (~p) REACHED, EVENTS FOUND: ~p~n", - [?get_BatchLimit(State), Events]), - case catch 'CosNotifyComm_SequencePushConsumer': - push_structured_events(?get_Client(State), Events) of - ok -> - cosNotification_eventDB:delete_events(Keys), - lookup_and_push(reset_cache(State), false); - {'EXCEPTION', E} when is_record(E, 'OBJECT_NOT_EXIST') orelse - is_record(E, 'NO_PERMISSION') orelse - is_record(E, 'CosEventComm_Disconnected') -> - ?DBG("PUSH SUPPLIER CLIENT NO LONGER EXIST~n", []), - 'CosNotification_Common':notify([{proxy, State#state.this}, - {client, ?get_Client(State)}, - {reason, {'EXCEPTION', E}}]), - {stop, normal, State}; - What when ?is_PersistentEvent(State), - ?is_PersistentConnection(State) -> - orber:dbg("[~p] PusherSupplier:lookup_and_push();~n" - "Client respond incorrect: ~p", - [?LINE, What], ?DEBUG_LEVEL), - check_cache(State); - What when ?is_PersistentConnection(State) -> - %% Here we should do something when we want to handle - %% Persistent EventReliability. - orber:dbg("[~p] PusherSupplier:lookup_and_push();~n" - "Client respond incorrect: ~p~n" - "Dropping events: ~p", - [?LINE, What, Events], ?DEBUG_LEVEL), - cosNotification_eventDB:delete_events(Keys), - {noreply, State}; - WhatII -> - orber:dbg("[~p] PusherSupplier:lookup_and_push();~n" - "Client respond incorrect: ~p~n" - "Terminating and dropping events: ~p", - [?LINE, WhatII, Events], ?DEBUG_LEVEL), - 'CosNotification_Common':notify([{proxy, State#state.this}, - {client, ?get_Client(State)}, - {reason, WhatII}]), - {stop, normal, State} - end - end; - _ -> - ?DBG("BATCHLIMIT (~p) NOT REACHED~n",[?get_BatchLimit(State)]), - {noreply, State} - end; -lookup_and_push(State, true) when ?is_SEQUENCE(State) -> - case ?get_Events(State, ?get_BatchLimit(State)) of - {[], _, _} -> - ?DBG("PACELIMIT REACHED BUT NO EVENTS FOUND~n", []), - {noreply, State}; - {Events, _, Keys} -> - ?DBG("PACELIMIT REACHED, EVENTS FOUND: ~p~n", [Events]), - case catch 'CosNotifyComm_SequencePushConsumer': - push_structured_events(?get_Client(State), Events) of - ok -> - cosNotification_eventDB:delete_events(Keys), - lookup_and_push(reset_cache(State), false); - {'EXCEPTION', E} when is_record(E, 'OBJECT_NOT_EXIST') orelse - is_record(E, 'NO_PERMISSION') orelse - is_record(E, 'CosEventComm_Disconnected') -> - orber:dbg("[~p] PusherSupplier:lookup_and_push();~n" - "Client no longer exists; terminating and dropping events: ~p", - [?LINE, Events], ?DEBUG_LEVEL), - 'CosNotification_Common':notify([{proxy, State#state.this}, - {client, ?get_Client(State)}, - {reason, {'EXCEPTION', E}}]), - {stop, normal, State}; - What when ?is_PersistentEvent(State), - ?is_PersistentConnection(State) -> - orber:dbg("[~p] PusherSupplier:lookup_and_push();~n" - "Client respond incorrect: ~p", - [?LINE, What], ?DEBUG_LEVEL), - check_cache(State); - What when ?is_PersistentConnection(State) -> - %% Here we should do something when we want to handle - %% Persistent EventReliability. - orber:dbg("[~p] PusherSupplier:lookup_and_push();~n" - "Client respond incorrect: ~p~n" - "Dropping events: ~p", - [?LINE, What, Events], ?DEBUG_LEVEL), - cosNotification_eventDB:delete_events(Keys), - {noreply, State}; - WhatII -> - orber:dbg("[~p] PusherSupplier:lookup_and_push();~n" - "Client respond incorrect: ~p~n" - "Terminating and dropping events: ~p", - [?LINE, WhatII, Events], ?DEBUG_LEVEL), - 'CosNotification_Common':notify([{proxy, State#state.this}, - {client, ?get_Client(State)}, - {reason, WhatII}]), - {stop, normal, State} - end - end; -lookup_and_push(State, _) -> - empty_db(State, ?get_Event(State)). - - -%% Push all events stored while not connected or received in sequence. -empty_db(State, {[], _, _}) -> - {noreply, State}; -empty_db(State, {Event, _, Keys}) when ?is_STRUCTURED(State) -> - case catch 'CosNotifyComm_StructuredPushConsumer': - push_structured_event(?get_Client(State), Event) of - ok -> - cosNotification_eventDB:delete_events(Keys), - NewState = reset_cache(State), - empty_db(NewState, ?get_Event(NewState)); - {'EXCEPTION', E} when is_record(E, 'OBJECT_NOT_EXIST') orelse - is_record(E, 'NO_PERMISSION') orelse - is_record(E, 'CosEventComm_Disconnected') -> - orber:dbg("[~p] PusherSupplier:empty_db();~n" - "Client no longer exists; terminating and dropping: ~p", - [?LINE, Event], ?DEBUG_LEVEL), - 'CosNotification_Common':notify([{proxy, State#state.this}, - {client, ?get_Client(State)}, - {reason, {'EXCEPTION', E}}]), - {stop, normal, State}; - What when ?is_PersistentEvent(State), - ?is_PersistentConnection(State) -> - orber:dbg("[~p] PusherSupplier:lookup_and_push();~n" - "Client respond incorrect: ~p", - [?LINE, What], ?DEBUG_LEVEL), - check_cache(State); - What when ?is_PersistentConnection(State) -> - %% Here we should do something when we want to handle - %% Persistent EventReliability. - orber:dbg("[~p] PusherSupplier:empty_db();~n" - "Client respond incorrect: ~p~n" - "Dropping event: ~p", - [?LINE, What, Event], ?DEBUG_LEVEL), - cosNotification_eventDB:delete_events(Keys), - {noreply, State}; - WhatII -> - orber:dbg("[~p] PusherSupplier:empty_db();~n" - "Client respond incorrect: ~p~n" - "Terminating and dropping: ~p", - [?LINE, WhatII, Event], ?DEBUG_LEVEL), - 'CosNotification_Common':notify([{proxy, State#state.this}, - {client, ?get_Client(State)}, - {reason, WhatII}]), - {stop, normal, State} - end; -empty_db(State, {Event, _, Keys}) when ?is_ANY(State) -> - case catch 'CosEventComm_PushConsumer':push(?get_Client(State), Event) of - ok -> - cosNotification_eventDB:delete_events(Keys), - NewState = reset_cache(State), - empty_db(NewState, ?get_Event(NewState)); - {'EXCEPTION', E} when is_record(E, 'OBJECT_NOT_EXIST') orelse - is_record(E, 'NO_PERMISSION') orelse - is_record(E, 'CosEventComm_Disconnected') -> - orber:dbg("[~p] PusherSupplier:empty_db();~n" - "Client no longer exists; terminating and dropping: ~p", - [?LINE, Event], ?DEBUG_LEVEL), - 'CosNotification_Common':notify([{proxy, State#state.this}, - {client, ?get_Client(State)}, - {reason, {'EXCEPTION', E}}]), - {stop, normal, State}; - What when ?is_PersistentEvent(State), - ?is_PersistentConnection(State) -> - orber:dbg("[~p] PusherSupplier:lookup_and_push();~n" - "Client respond incorrect: ~p", - [?LINE, What], ?DEBUG_LEVEL), - check_cache(State); - What when ?is_PersistentConnection(State) -> - %% Here we should do something when we want to handle - %% Persistent EventReliability. - orber:dbg("[~p] PusherSupplier:empty_db();~n" - "Client respond incorrect: ~p~n" - "Dropping Event: ~p", - [?LINE, What, Event], ?DEBUG_LEVEL), - cosNotification_eventDB:delete_events(Keys), - {noreply, State}; - WhatII -> - orber:dbg("[~p] PusherSupplier:empty_db();~n" - "Client respond incorrect: ~p~n" - "Terminating and dropping: ~p", - [?LINE, WhatII, Event], ?DEBUG_LEVEL), - 'CosNotification_Common':notify([{proxy, State#state.this}, - {client, ?get_Client(State)}, - {reason, WhatII}]), - {stop, normal, State} - end. - -reset_cache(#state{cacheTimeout = undefined, - cacheInterval = undefined} = State) -> - State; -reset_cache(State) -> - stop_timer(State#state.cacheTimeout), - stop_timer(State#state.cacheInterval), - State#state{cacheTimeout = undefined, - cacheInterval = undefined}. - -check_cache(#state{maxCache = Max, cacheTimeout = Timeout, - cacheInterval = Interval} = State) -> - case cosNotification_eventDB:status(State#state.eventDB, eventCounter) of - Count when Count > Max -> - %% Reached the upper limit, terminate. - 'CosNotification_Common':notify([{proxy, State#state.this}, - {client, State#state.client}, - {reason, {max_events, Max}}]), - {stop, normal, State}; - _ when Timeout == undefined, Interval == undefined -> - case {timer:send_interval(cosNotificationApp:interval_events(), - cacheInterval), - timer:send_after(cosNotificationApp:timeout_events(), - cacheTimeout)} of - {{ok, IntervalRef}, {ok, TimeoutRef}} -> - {noreply, State#state{cacheTimeout = TimeoutRef, - cacheInterval = IntervalRef}}; - Error -> - orber:dbg("[~p] PusherSupplier:check_cache();~n" - "Unable to start timers: ~p", - [?LINE, Error], ?DEBUG_LEVEL), - 'CosNotification_Common':notify([{proxy, State#state.this}, - {client, State#state.client}, - {reason, {timer, Error}}]), - {stop, normal, State} - end; - _ -> - %% Timers already started. - {noreply, State} - end. - -store_events(_State, []) -> - ok; -store_events(State, [Event|Rest]) when ?is_ANY(State) -> - AnyEvent = any:create('CosNotification_StructuredEvent':tc(),Event), - ?add_Event(State, AnyEvent), - store_events(State, Rest); -store_events(State, [Event|Rest]) -> - ?add_Event(State, Event), - store_events(State, Rest). - -%% Start timers which send a message each time we should push events. Only used -%% when this objects is defined to supply sequences. -start_timer(State) -> - case ?get_PacingInterval(State) of - 0 -> - ?DBG("PUSH SUPPLIER STARTED NO TIMER (0), BATCH LIMIT: ~p~n", - [?get_BatchLimit(State)]), - - State; - PacInt -> - case catch timer:send_interval(timer:seconds(PacInt), pacing) of - {ok,PacTRef} -> - ?DBG("PUSH SUPPLIER STARTED TIMER, BATCH LIMIT: ~p~n", - [?get_BatchLimit(State)]), - ?set_PacingTimer(State, PacTRef); - What -> - orber:dbg("[~p] PusherSupplier:start_timer();~n" - "Unable to invoke timer:send_interval/2: ~p", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end - end. - -stop_timer(undefined) -> - ?DBG("PUSH SUPPLIER HAVE NO TIMER TO STOP~n",[]), - ok; -stop_timer(Timer) -> - ?DBG("PUSH SUPPLIER STOPPED TIMER~n",[]), - timer:cancel(Timer), - ok. - - -%%--------------- MISC FUNCTIONS, E.G. DEBUGGING ------------- -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosNotification/src/cosNotification.app.src b/lib/cosNotification/src/cosNotification.app.src deleted file mode 100644 index 52ce164d46..0000000000 --- a/lib/cosNotification/src/cosNotification.app.src +++ /dev/null @@ -1,122 +0,0 @@ -{application, cosNotification, - [{description, "The Erlang CosNotification application"}, - {vsn, "%VSN%"}, - {modules, - [ - 'CosNotification_Common', - 'CosNotifyChannelAdmin_ConsumerAdmin_impl', - 'CosNotifyChannelAdmin_EventChannelFactory_impl', - 'CosNotifyChannelAdmin_EventChannel_impl', - 'CosNotifyChannelAdmin_SupplierAdmin_impl', - 'PullerConsumer_impl', - 'PullerSupplier_impl', - 'PusherConsumer_impl', - 'PusherSupplier_impl', - 'cosNotificationApp', - 'CosNotifyFilter_Filter_impl', - 'CosNotifyFilter_MappingFilter_impl', - 'CosNotifyFilter_FilterFactory_impl', - 'cosNotification_Scanner', - 'cosNotification_Grammar', - 'cosNotification_Filter', - 'cosNotification_eventDB', - 'oe_CosNotification', - 'oe_cosNotificationAppComm', - 'oe_CosNotificationComm_Event', - 'CosNotification', - 'CosNotification_AdminPropertiesAdmin', - 'CosNotification_EventHeader', - 'CosNotification_EventType', - 'CosNotification_FixedEventHeader', - 'CosNotification_NamedPropertyRange', - 'CosNotification_Property', - 'CosNotification_PropertyError', - 'CosNotification_PropertyRange', - 'CosNotification_QoSAdmin', - 'CosNotification_StructuredEvent', - 'CosNotification_UnsupportedAdmin', - 'CosNotification_UnsupportedQoS', - 'CosNotification_EventBatch', - 'CosNotification_EventTypeSeq', - 'CosNotification_NamedPropertyRangeSeq', - 'CosNotification_PropertyErrorSeq', - 'CosNotification_PropertySeq', - 'oe_CosNotifyChannelAdmin', - 'CosNotifyChannelAdmin_AdminLimit', - 'CosNotifyChannelAdmin_AdminLimitExceeded', - 'CosNotifyChannelAdmin_AdminNotFound', - 'CosNotifyChannelAdmin_ChannelNotFound', - 'CosNotifyChannelAdmin_ConnectionAlreadyActive', - 'CosNotifyChannelAdmin_ConnectionAlreadyInactive', - 'CosNotifyChannelAdmin_ConsumerAdmin', - 'CosNotifyChannelAdmin_EventChannel', - 'CosNotifyChannelAdmin_EventChannelFactory', - 'CosNotifyChannelAdmin_NotConnected', - 'CosNotifyChannelAdmin_ProxyConsumer', - 'CosNotifyChannelAdmin_ProxyNotFound', - 'CosNotifyChannelAdmin_ProxyPullConsumer', - 'CosNotifyChannelAdmin_ProxyPullSupplier', - 'CosNotifyChannelAdmin_ProxyPushConsumer', - 'CosNotifyChannelAdmin_ProxyPushSupplier', - 'CosNotifyChannelAdmin_ProxySupplier', - 'CosNotifyChannelAdmin_SequenceProxyPullConsumer', - 'CosNotifyChannelAdmin_SequenceProxyPullSupplier', - 'CosNotifyChannelAdmin_SequenceProxyPushConsumer', - 'CosNotifyChannelAdmin_SequenceProxyPushSupplier', - 'CosNotifyChannelAdmin_StructuredProxyPullConsumer', - 'CosNotifyChannelAdmin_StructuredProxyPullSupplier', - 'CosNotifyChannelAdmin_StructuredProxyPushConsumer', - 'CosNotifyChannelAdmin_StructuredProxyPushSupplier', - 'CosNotifyChannelAdmin_SupplierAdmin', - 'CosNotifyChannelAdmin_AdminIDSeq', - 'CosNotifyChannelAdmin_ChannelIDSeq', - 'CosNotifyChannelAdmin_ProxyIDSeq', - 'oe_CosNotifyComm', - 'CosNotifyComm_InvalidEventType', - 'CosNotifyComm_NotifyPublish', - 'CosNotifyComm_NotifySubscribe', - 'CosNotifyComm_PullConsumer', - 'CosNotifyComm_PullSupplier', - 'CosNotifyComm_PushConsumer', - 'CosNotifyComm_PushSupplier', - 'CosNotifyComm_SequencePullConsumer', - 'CosNotifyComm_SequencePullSupplier', - 'CosNotifyComm_SequencePushConsumer', - 'CosNotifyComm_SequencePushSupplier', - 'CosNotifyComm_StructuredPullConsumer', - 'CosNotifyComm_StructuredPullSupplier', - 'CosNotifyComm_StructuredPushConsumer', - 'CosNotifyComm_StructuredPushSupplier', - 'oe_CosNotifyFilter', - 'CosNotifyFilter_CallbackNotFound', - 'CosNotifyFilter_ConstraintExp', - 'CosNotifyFilter_ConstraintInfo', - 'CosNotifyFilter_ConstraintNotFound', - 'CosNotifyFilter_DuplicateConstraintID', - 'CosNotifyFilter_Filter', - 'CosNotifyFilter_FilterAdmin', - 'CosNotifyFilter_FilterFactory', - 'CosNotifyFilter_FilterNotFound', - 'CosNotifyFilter_InvalidConstraint', - 'CosNotifyFilter_InvalidGrammar', - 'CosNotifyFilter_InvalidValue', - 'CosNotifyFilter_MappingConstraintInfo', - 'CosNotifyFilter_MappingConstraintPair', - 'CosNotifyFilter_MappingFilter', - 'CosNotifyFilter_UnsupportedFilterableData', - 'CosNotifyFilter_CallbackIDSeq', - 'CosNotifyFilter_ConstraintExpSeq', - 'CosNotifyFilter_ConstraintIDSeq', - 'CosNotifyFilter_ConstraintInfoSeq', - 'CosNotifyFilter_FilterIDSeq', - 'CosNotifyFilter_MappingConstraintInfoSeq', - 'CosNotifyFilter_MappingConstraintPairSeq' - ] - }, - {registered, [cosNotificationSup, oe_cosNotificationFactory]}, - {applications, [orber, stdlib, kernel]}, - {env, []}, - {mod, {cosNotificationApp, []}}, - {runtime_dependencies, ["stdlib-2.5","orber-3.6.27","kernel-3.0","erts-7.0", - "cosTime-1.1.14","cosEvent-2.1.15"]} -]}. diff --git a/lib/cosNotification/src/cosNotification.appup.src b/lib/cosNotification/src/cosNotification.appup.src deleted file mode 100644 index 6c3b2833b7..0000000000 --- a/lib/cosNotification/src/cosNotification.appup.src +++ /dev/null @@ -1,7 +0,0 @@ -{"%VSN%", - [ - ], - [ - ] -}. - diff --git a/lib/cosNotification/src/cosNotificationApp.erl b/lib/cosNotification/src/cosNotificationApp.erl deleted file mode 100644 index f6231ed47e..0000000000 --- a/lib/cosNotification/src/cosNotificationApp.erl +++ /dev/null @@ -1,436 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : cosNotificationApp.erl -%% Purpose : -%%---------------------------------------------------------------------- - --module(cosNotificationApp). - -%%--------------- INCLUDES ----------------------------------- -%% Local --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% Application files --include("CosNotification.hrl"). --include("CosNotifyChannelAdmin.hrl"). --include("CosNotifyComm.hrl"). --include("CosNotifyFilter.hrl"). - --include("CosNotification_Definitions.hrl"). -%%--------------- EXPORTS------------------------------------- -%% cosNotification API external --export([start/0, stop/0, - start_factory/1, start_factory/0, stop_factory/1, - start_global_factory/0, start_global_factory/1, - start_filter_factory/1, start_filter_factory/0, stop_filter_factory/1, - install/0, install/1, uninstall/0, uninstall/1, - install_event/0, install_event/1, uninstall_event/0, uninstall_event/1, - install_typed/0, install_typed/1, uninstall_typed/0, uninstall_typed/1, - create_structured_event/6, type_check/0, notify/0, max_events/0, - timeout_events/0, interval_events/0]). - -%% Application callbacks --export([start/2, init/1, stop/1]). - -%%--------------- DEFINES ------------------------------------ --define(IDL_MODULES, ['oe_CosNotification', - 'oe_cosNotificationAppComm', - 'oe_CosNotifyComm', - 'oe_CosNotifyFilter', - 'oe_CosNotifyChannelAdmin']). --define(EVENT_IDL_MODULES, ['oe_CosEventComm', - 'oe_CosEventChannelAdmin']). --define(TYPED_IDL_MODULES, ['oe_CosTypedEvent', - 'oe_CosTypedNotification']). - --define(FACTORY_NAME, oe_cosNotificationFactory). --define(SUPERVISOR_NAME, cosNotificationSup). - - -%%------------------------------------------------------------ -%% function : install/X -%% Arguments: - | Time (seconds) -%% Returns : ok | EXIT | EXCEPTION -%% Effect : Install necessary data in the IFR DB -%%------------------------------------------------------------ - -install() -> - install(0). - -install(Time) when is_integer(Time) -> - install_loop(?IDL_MODULES, timer:seconds(Time)); -install(_Time) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%------------------------------------------------------------ -%% function : install_event/X -%% Arguments: - | Time (seconds) -%% Returns : ok | EXIT | EXCEPTION -%% Effect : Install necessary data in the IFR DB -%%------------------------------------------------------------ - -install_event() -> - install_event(0). - -install_event(Time) when is_integer(Time) -> - install_loop(?EVENT_IDL_MODULES, timer:seconds(Time)); -install_event(_Time) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%------------------------------------------------------------ -%% function : install_typed/X -%% Arguments: - | Time (seconds) -%% Returns : ok | EXIT | EXCEPTION -%% Effect : Install necessary data in the IFR DB -%%------------------------------------------------------------ - -install_typed() -> - install_typed(0). - -install_typed(Time) when is_integer(Time) -> - install_loop(?TYPED_IDL_MODULES, timer:seconds(Time)); -install_typed(_Time) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -install_loop([], _) -> - ok; -install_loop([H|T], Time) -> - H:'oe_register'(), - timer:sleep(Time), - install_loop(T, Time). - -%%------------------------------------------------------------ -%% function : uninstall/X -%% Arguments: - | Time (seconds) -%% Returns : ok | EXIT | EXCEPTION -%% Effect : Remove data related to cosNotificationin from the IFR DB -%%------------------------------------------------------------ - -uninstall() -> - uninstall(0). - -uninstall(Time) when is_integer(Time) -> - uninstall_loop(lists:reverse(?IDL_MODULES), timer:seconds(Time)); -uninstall(_Time) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%------------------------------------------------------------ -%% function : uninstall_event/X -%% Arguments: - | Time (seconds) -%% Returns : ok | EXIT | EXCEPTION -%% Effect : Remove data related to cosNotificationin from the IFR DB -%%------------------------------------------------------------ - -uninstall_event() -> - uninstall_event(0). - -uninstall_event(Time) when is_integer(Time) -> - uninstall_loop(lists:reverse(?EVENT_IDL_MODULES), timer:seconds(Time)); -uninstall_event(_Time) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%------------------------------------------------------------ -%% function : uninstall_typed/X -%% Arguments: - | Time (seconds) -%% Returns : ok | EXIT | EXCEPTION -%% Effect : Remove data related to cosNotificationin from the IFR DB -%%------------------------------------------------------------ - -uninstall_typed() -> - uninstall_typed(0). - -uninstall_typed(Time) when is_integer(Time) -> - uninstall_loop(lists:reverse(?TYPED_IDL_MODULES), timer:seconds(Time)); -uninstall_typed(_Time) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -uninstall_loop([], _) -> - ok; -uninstall_loop([H|T], Time) -> - H:'oe_unregister'(), - timer:sleep(Time), - uninstall_loop(T, Time). - - -%%------------------------------------------------------------ -%% function : start/stop -%% Arguments: -%% Returns : -%% Effect : Starts or stops the cosTRansaction application. -%%------------------------------------------------------------ - -start() -> - application:start(cosNotification). -stop() -> - application:stop(cosNotification). - -%%------------------------------------------------------------ -%% function : start_factory -%% Arguments: none or an argumentlist whith default values. -%% Returns : ObjectRef | {'EXCEPTION', _} | {'EXIT', Reason} -%% Effect : Starts a CosNotifyChannelAdmin_EventChannelFactory -%%------------------------------------------------------------ -start_factory() -> - start_factory(?not_DEFAULT_SETTINGS). - -start_factory(Args) when is_list(Args) -> - SO = 'CosNotification_Common':get_option(server_options, Args, ?not_DEFAULT_SETTINGS), - SPEC = ['CosNotifyChannelAdmin_EventChannelFactory',Args, - [{sup_child, true}, - {regname, {local, oe_cosNotificationFactory}}|SO]], - case supervisor:start_child(?SUPERVISOR_NAME, SPEC) of - {ok, Pid, Obj} when is_pid(Pid) -> - Obj; - Other-> - orber:dbg("[~p] cosNotificationApp:start_factory( ~p ).~n" - "Reason: ~p~n", [?LINE, Args, Other], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end; -start_factory(Args) -> - orber:dbg("[~p] cosNotificationApp:start_factory( ~p ).~n" - "Bad parameters~n", [?LINE, Args], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%------------------------------------------------------------ -%% function : start_global_factory -%% Arguments: none or an argumentlist whith default values. -%% Returns : ObjectRef | {'EXCEPTION', _} | {'EXIT', Reason} -%% Effect : Starts a CosNotifyChannelAdmin_EventChannelFactory -%%------------------------------------------------------------ -start_global_factory() -> - start_global_factory(?not_DEFAULT_SETTINGS). - -start_global_factory(Args) when is_list(Args) -> - SO = 'CosNotification_Common':get_option(server_options, Args, ?not_DEFAULT_SETTINGS), - Name = 'CosNotification_Common':create_name(), - SPEC = ['CosNotifyChannelAdmin_EventChannelFactory',Args, - [{sup_child, true}, - {regname, {global, Name}}|SO]], - case supervisor:start_child(?SUPERVISOR_NAME, SPEC) of - {ok, Pid, Obj} when is_pid(Pid) -> - Obj; - Other-> - orber:dbg("[~p] cosNotificationApp:start_global_factory( ~p ).~n" - "Reason: ~p~n", [?LINE, Args, Other], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end; -start_global_factory(Args) -> - orber:dbg("[~p] cosNotificationApp:start_global_factory( ~p ).~n" - "Bad parameters~n", [?LINE, Args], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - - -%%------------------------------------------------------------ -%% function : stop_factory -%% Arguments: Factory Object Reference -%% Returns : ok | {'EXCEPTION', _} -%% Effect : -%%------------------------------------------------------------ - -stop_factory(Fac)-> - corba:dispose(Fac). - -%%------------------------------------------------------------ -%% function : start_filter_factory -%% Arguments: none or an argumentlist which by default is defined -%% in CosNotification_Definitions.hrl, i.e., '?not_FILTERFAC_DEF' -%% Returns : ObjectRef | {'EXCEPTION', _} | {'EXIT', Reason} -%% Effect : Starts a CosNotifyChannelAdmin_EventChannelFactory -%%------------------------------------------------------------ -start_filter_factory() -> - start_filter_factory([{typecheck, true}, - {tty, false}, - {logfile, false}, - {server_options, []}]). -start_filter_factory(Args) when is_list(Args) -> - SO = 'CosNotification_Common':get_option(server_options, Args, - ?not_DEFAULT_SETTINGS), - SPEC = ['CosNotifyFilter_FilterFactory',Args, [{sup_child, true}|SO]], - case supervisor:start_child(?SUPERVISOR_NAME, SPEC) of - {ok, Pid, Obj} when is_pid(Pid) -> - Obj; - Other-> - orber:dbg("[~p] cosNotificationApp:start_filter_factory( ~p ).~n" - "Reason: ~p~n", [?LINE, Args, Other], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end; -start_filter_factory(Args) -> - orber:dbg("[~p] cosNotificationApp:start_filter_factory( ~p ).~n" - "Bad parameters~n", [?LINE, Args], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - - -%%------------------------------------------------------------ -%% function : stop_filter_factory -%% Arguments: FilterFactory Object Reference -%% Returns : ok | {'EXCEPTION', _} -%% Effect : -%%------------------------------------------------------------ - -stop_filter_factory(Fac)-> - corba:dispose(Fac). - - -%%------------------------------------------------------------ -%% function : create_structured_event -%% Arguments: -%% Returns : -%% Effect : -%%------------------------------------------------------------ -create_structured_event(StrD,StrT,StrE,PSeqV,PSeqF,AnyR) - when is_list(StrD) andalso is_list(StrT) andalso is_list(StrE) - andalso is_list(PSeqV) andalso is_list(PSeqF) andalso - is_record(AnyR, any) -> -#'CosNotification_StructuredEvent'{header = - #'CosNotification_EventHeader'{fixed_header = - #'CosNotification_FixedEventHeader'{event_type = - #'CosNotification_EventType'{domain_name=StrD, - type_name=StrT}, - event_name = StrE}, - variable_header = PSeqV}, - filterable_data = PSeqF, - remainder_of_body = AnyR}; -create_structured_event(_StrD,_StrT,_StrE,_PSeqV,_PSeqF,_AnyR) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - - -%%------------------------------------------------------------ -%% function : type_check -%% Arguments: -%% Returns : -%% Effect : -%%------------------------------------------------------------ -type_check() -> - case application:get_env(cosNotification, type_check) of - {ok, Boolean} when is_atom(Boolean) -> - Boolean; - _ -> - true - end. - -%%------------------------------------------------------------ -%% function : notify -%% Arguments: -%% Returns : -%% Effect : -%%------------------------------------------------------------ -notify() -> - case application:get_env(cosNotification, notify) of - {ok, Module} when is_atom(Module) -> - Module; - _ -> - false - end. - -%%------------------------------------------------------------ -%% function : max_events -%% Arguments: -%% Returns : -%% Effect : -%%------------------------------------------------------------ -max_events() -> - case application:get_env(cosNotification, max_events) of - {ok, Max} when is_integer(Max) -> - Max; - _ -> - 50 - end. - -%%------------------------------------------------------------ -%% function : timeout_events -%% Arguments: -%% Returns : -%% Effect : -%%------------------------------------------------------------ -timeout_events() -> - case application:get_env(cosNotification, timeout_events) of - {ok, Max} when is_integer(Max) -> - Max; - _ -> - 3000000 %% 5 minutes - end. - - -%%------------------------------------------------------------ -%% function : interval_events -%% Arguments: -%% Returns : -%% Effect : -%%------------------------------------------------------------ -interval_events() -> - case application:get_env(cosNotification, interval_events) of - {ok, Max} when is_integer(Max) -> - Max; - _ -> - 10000 %% 10 seconds - end. - - -%%------------------------------------------------------------ -%% function : start -%% Arguments: Type - see module application -%% Arg - see module application -%% Returns : -%% Effect : Module callback for application -%%------------------------------------------------------------ - -start(_, _) -> - supervisor:start_link({local, ?SUPERVISOR_NAME}, cosNotificationApp, app_init). - - -%%------------------------------------------------------------ -%% function : stop -%% Arguments: Arg - see module application -%% Returns : -%% Effect : Module callback for application -%%------------------------------------------------------------ - -stop(_) -> - ok. - -%%------------------------------------------------------------ -%% function : init -%% Arguments: -%% Returns : -%% Effect : -%%------------------------------------------------------------ - -%% Starting using create_factory/X -init(own_init) -> - {ok,{{simple_one_for_one,50,10}, - [{"oe_NotChild", - {'CosNotification_Common',create_link, []}, - transient,100000,worker, - ['CosNotifyChannelAdmin_EventChannel', - 'CosNotifyChannelAdmin_EventChannel_impl']}]}}; -%% When starting as an application. -init(app_init) -> - {ok,{{simple_one_for_one,50,10}, - [{"oe_NotChild", - {'CosNotification_Common',create_link, []}, - transient,100000,worker, - ['CosNotifyChannelAdmin_EventChannel', - 'CosNotifyChannelAdmin_EventChannel_impl']}]}}. - - -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosNotification/src/cosNotificationAppComm.idl b/lib/cosNotification/src/cosNotificationAppComm.idl deleted file mode 100644 index 09e0af2568..0000000000 --- a/lib/cosNotification/src/cosNotificationAppComm.idl +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef _OE_COSNOTIFICATIONCOMM_IDL_ -#define _OE_COSNOTIFICATIONCOMM_IDL_ - -#include - -module oe_CosNotificationComm { - - interface Event { - - enum status {MATCH, MATCHED}; - void callSeq(in CosNotification::EventBatch events, in status stat); - void callAny(in any event, in status stat); - }; - -}; -#endif /* ifndef _OE_COSNOTIFICATIONCOMM_IDL_ */ - diff --git a/lib/cosNotification/src/cosNotificationComm.cfg b/lib/cosNotification/src/cosNotificationComm.cfg deleted file mode 100644 index 89d207528d..0000000000 --- a/lib/cosNotification/src/cosNotificationComm.cfg +++ /dev/null @@ -1,3 +0,0 @@ -{this, "oe_CosNotificationComm::Event"}. -{from, "oe_CosNotificationComm::Event"}. -{{handle_info, "oe_CosNotificationComm::Event"}, true}. diff --git a/lib/cosNotification/src/cosNotification_Filter.erl b/lib/cosNotification/src/cosNotification_Filter.erl deleted file mode 100644 index a92c9b8d41..0000000000 --- a/lib/cosNotification/src/cosNotification_Filter.erl +++ /dev/null @@ -1,965 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : cosNotification_Filter.erl -%% Purpose : -%%---------------------------------------------------------------------- - --module(cosNotification_Filter). - - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% Application files --include("CosNotification.hrl"). --include("CosNotifyChannelAdmin.hrl"). --include("CosNotifyComm.hrl"). --include("CosNotifyFilter.hrl"). - --include("CosNotification_Definitions.hrl"). - -%%--------------- EXPORTS ------------------------------------ -%% Internal Filter Functions --export([eval/1, - eval/2, - create_filter/1, - check_types/1, - match_types/3, - validate_types/1]). - -%%--------------- DEFINES ------------------------------------ --define(EVENT_PATH, [{dotid,"header"}, {dotid,"fixed_header"}, - {dotid,"event_name"}]). --define(DOMAIN_PATH, [{dotid,"header"}, {dotid,"fixed_header"}, - {dotid,"event_type"}, {dotid,"domain_name"}]). --define(TYPE_PATH, [{dotid,"header"}, {dotid,"fixed_header"}, - {dotid,"event_type"}, {dotid,"type_name"}]). --define(VARIABLE_PATH(I), [{dotid,"header"}, {dotid,"variable_header"}, {dotid,I}]). --define(FILTERABLE_PATH(I), [{dotid,"filterable_data"}, {dotid,I}]). - - -%%------------------------------------------------------------ -%%--------------- FILTER FUNCTIONS --------------------------- -%%------------------------------------------------------------ -%%------------------------------------------------------------ -%% function : create_filter/1 -%% Arguments: String - Filter grammar -%% Returns : -%% Effect : -%%------------------------------------------------------------ -create_filter(Str) -> - {ok, Tokens} = cosNotification_Scanner:scan(Str), - case cosNotification_Grammar:parse(Tokens) of - {ok, Filter} -> - {ok, Filter}; - _-> - corba:raise(#'CosNotifyFilter_InvalidConstraint'{constr = Str}) - end. - -%%------------------------------------------------------------ -%% function : eval -%% Arguments: -%% Returns : -%% Effect : -%%------------------------------------------------------------ - -eval('$empty') -> true; -eval(Tree) -> eval(Tree, []). - - -%% Leaf expressions (literals and idents). -eval('$empty', _) -> true; -eval(Lit, _Env) when is_number(Lit) -> Lit; -eval(Lit, _Env) when is_list(Lit) -> Lit; %list == string -eval(Lit, _Env) when is_atom(Lit) -> Lit; %atom == bool -eval({component, V}, []) -> - %% Cannot evaluate variables at this stage. - throw({error, {unbound_variable, V}}); -eval({component, V}, Env) -> - case catch lookup(V, Env, undefined) of - {ok, Val} -> - Val; - _X -> - {error, {unbound_variable, V}} - end; - -%% CORBA2.3-15/26 states: -%% "The name parameters in tk_objref, tk_struct, tk_union, tk_enum, tk_alias, -%% tk_value, tk_value_box, tk_abstract_interface, tk_native and tk_except TypeCodes -%% and the member name parameters in tk_struct, tk_union, tk_enum, tk_value and -%% tk_except TypeCodes are not specified by (or significant in) GIOP. Agents should -%% not make assumptions about type equivalence based on these name values; only the -%% structural information (including RepositoryId values, if provided) is -%% significant. If provided, the strings should be the simple, unscoped names -%% supplied in the OMG IDL definition text. If omitted, they are encoded as empty -%% strings." -%% Makes it rather hard to follow the grammar 100 %. -eval({default_component, V}, Env) -> - case catch lookup(V, Env, default_component) of - {ok, false} -> - false; - {ok, true} -> - true; - _X -> - {error, {unbound_variable, V}} - end; -eval({exist_component, V}, Env) -> - case catch lookup(V, Env, exist_component) of - {ok, false} -> - false; - {ok, _} -> - true; - {error, _} -> - false; - _X -> - {error, {unbound_variable, V}} - end; -%% Arithmetic expressions. -eval({'*', X, Y}, Env) -> - eval_arith({fun(_X, _Y) -> _X*_Y end, X, Y}, Env); -eval({'/', X, Y}, Env) -> - eval_arith({fun(_X, _Y) -> _X/_Y end, X, Y}, Env); -eval({'+', X, Y}, Env) -> - eval_arith({fun(_X, _Y) -> _X+_Y end, X, Y}, Env); -eval({'-', X, Y}, Env) -> - eval_arith({fun(_X, _Y) -> _X-_Y end, X, Y}, Env); -eval({'u-', X}, Env) -> - eval_arith({fun(_X) -> -_X end, X}, Env); -%% Relational expressions. -eval({'==', X, Y}, Env) -> - eval_rel({fun(_X, _Y) -> _X == _Y end, X, Y}, Env); -eval({'!=', X, Y}, Env) -> - eval_rel({fun(_X, _Y) -> _X /= _Y end, X, Y}, Env); -eval({'<', X, Y}, Env) -> - eval_rel({fun(_X, _Y) -> _X < _Y end, X, Y}, Env); -eval({'<=', X, Y}, Env) -> - eval_rel({fun(_X, _Y) -> _X =< _Y end, X, Y}, Env); -eval({'>', X, Y}, Env) -> - eval_rel({fun(_X, _Y) -> _X > _Y end, X, Y}, Env); -eval({'>=', X, Y}, Env) -> - eval_rel({fun(_X, _Y) -> _X >= _Y end, X, Y}, Env); -eval({'~', Needle, Haystack}, Env) -> %substring match - N = eval(Needle, Env), - H = eval(Haystack, Env), - if - is_list(N) andalso is_list(H) -> - string:str(H, N) /= 0; - true -> - throw({error, {bad_type, Needle, Haystack}}) - end; -eval({'in', Needle, Haystack}, Env) -> %set membership - N = eval(Needle, Env), - H = eval(Haystack, Env), - if - is_list(H) -> - lists:member(N, H); - true -> - throw({error, {bad_type, Needle, Haystack}}) - end; -%% Boolean expressions. -eval({'and', false, _Y}, _Env) -> - false; -eval({'and', _X, false}, _Env) -> - false; -eval({'and', X, Y}, Env) -> - eval_and_bool({fun(_X, _Y) -> _X and _Y end, X, Y}, Env); - -eval({'or', true, _Y}, _Env) -> - true; -eval({'or', _X, true}, _Env) -> - true; -eval({'or', X, Y}, Env) -> - eval_or_bool({fun(_X, _Y) -> _X or _Y end, X, Y}, Env); -eval({'not', X}, Env) -> - eval_bool({fun(_X) -> not _X end, X}, Env); -%% Catch-all -eval(_T, _Env) -> - throw({error, internal}). - -eval_bool({Fun, X}, Env) -> - Xe = eval(X, Env), - if - is_atom(Xe) -> - Fun(Xe); - true -> - throw({error, {bad_type, X}}) - end. -eval_and_bool({Fun, X, Y}, Env) -> - case eval(X, Env) of - false -> - %% No need for evaluating the other expression. - false; - Xe -> - Ye = eval(Y, Env), - if - is_atom(Xe) andalso is_atom(Ye) -> - Fun(Xe, Ye); - true -> - throw({error, {bad_type, X, Y}}) - end - end. -eval_or_bool({Fun, X, Y}, Env) -> - case eval(X, Env) of - true -> - %% No need for evaluating the other expression. - true; - Xe -> - Ye = eval(Y, Env), - if - is_atom(Xe) andalso is_atom(Ye) -> - Fun(Xe, Ye); - true -> - throw({error, {bad_type, X, Y}}) - end - end. - - -%% According to issue 2203, OMG stated that arithmetic operations involving booleans -%% is allowed. TRUE equals 1 and FALSE 0. They refer to: - -%% "We at NEC like this feature, and feel it is both required and -%% standard with the way CORBA treats boolean values. We feel it's -%% required because it allows the constraint grammar to handle -%% expressions that combine the results of boolean comparisons, -%% which we feel is typically expected of a constraint grammar -%% (e.g., ($.fruit == apples) + ($.color == red) + ($.kind == macintosh) > 2) -%% Furthermore, while we have no fundamental opposition to explicitly -%% stating that TRUE=1 and FALSE=0, we don't necessarily feel it's -%% necessary because section 12.3.1 of CORBA alread states that -%% "Boolean values are encoded as single octets, where TRUE is the -%% value 1, and FALSE is 0." Essentially, we feel CORBA already -%% defines TRUE to be 1 and FALSE to be 0, however we are not -%% opposed to adding such a statement into Notification if folks -%% feel it's necessary." -%% If still valid, see: ftp://ftp.omg.org/pub/docs/telecom/99-07-06.txt - -%% The section they refer to (CORBA-2.0) merely states that TRUE and FALSE are -%% encoded as 1 and 0 in GIOP. Does not imply that booleans may be used as numeric. -%% But, they have stated that this should be the case so..... - -remap_bool(Num) when is_number(Num) -> Num; -remap_bool(true) -> 1; -remap_bool(false) -> 0; -remap_bool(X) -> throw({error, {bad_type, X}}). - -eval_arith({Fun, X}, Env) -> - Xe = remap_bool(eval(X, Env)), - Fun(Xe); -eval_arith({Fun, X, Y}, Env) -> - Xe = remap_bool(eval(X, Env)), - Ye = remap_bool(eval(Y, Env)), - Fun(Xe, Ye). - -eval_rel({Fun, X, Y}, Env) -> - Xe = eval(X, Env), - Ye = eval(Y, Env), - if - is_number(Xe) andalso is_number(Ye) -> - Fun(Xe, Ye); - is_list(Xe) andalso is_list(Ye) -> - Fun(Xe, Ye); - is_atom(Xe) andalso is_atom(Ye) -> - Fun(Xe, Ye); - true -> - throw({error, {bad_type, X, Y}}) - end. - -%%------------------------------------------------------------ -%% function : get_variable -%% Arguments: A sequence of CosNotification::Property{}, i.e., -%% name-value pairs. -%% ID - name in the Property -%% Any - remainder of body -%% Returns : Value in the Property | false -%% Comment : When searching for a variable we must start with -%% 'variable_header' followed by 'filterable_body'. -%% If not found we will then look in the 'remainder_of_body' -%%------------------------------------------------------------ - -get_variable([], ID, Any) when is_record(Any, any) -> - case {any:get_value(Any), any:get_typecode(Any)} of - {#'CosNotification_Property'{name=ID, value=A}, _} -> - any:get_value(A); - {_, TC} when is_atom(TC) -> - %% Since TC atom it must be a simple type, which don't have members. - throw({error, {bad_id, ID}}); - {Value, {tk_alias,_,ID,_}} when is_record(Value, any) -> - %% {tk_alias, IFRId, ID, TypeCode} - any:get_value(Value); - {Value, {tk_alias,_,ID,_}} -> - %% {tk_alias, IFRId, ID, TypeCode} - Value; - {Value, _TC} -> - get_variable([],ID, Value) - end; -get_variable([], ID, #'CosNotification_Property'{name=ID, value=Any}) -> - any:get_value(Any); -get_variable([], ID, [#'CosNotification_Property'{name=ID, value=Any}|_]) -> - any:get_value(Any); -get_variable([], ID, [H|T]) when is_record(H, 'CosNotification_Property') -> - get_variable([], ID, T); -get_variable([], ID, false) -> - throw({error, {bad_id, ID}}); -get_variable([], ID, Value) -> - M = element(1, Value), - case catch M:tc() of - {tk_struct,_,_,SList} -> - %% {tk_struct, Id, Name, ElementList}. - Field = get_field(ID, SList), - element(Field, Value); - {tk_union,_,_,_, DefNo, UList} -> - %% {tk_union, Id, Name, DiscrTC, Default, ElementList} - case id2switch(UList, ID) of - [default] when DefNo >= 0 -> - element(3, Value); - [default] -> - throw({error, {bad_id, "Bad Union ID supplied"}}); - Found -> - case catch lists:member(element(2, Value), Found) of - true -> - element(3, Value); - _ -> - throw({error, {bad_id, "Bad Union ID supplied"}}) - end - end; - _-> - throw({error, {bad_id, ID}}) - end; -get_variable([#'CosNotification_Property'{name=ID, value=A}|_], ID, _) -> - any:get_value(A); -get_variable([_|T], ID, Any) -> - get_variable(T, ID, Any). - -%%------------------------------------------------------------ -%% function : lookup -%% Arguments: T - A parse tree representing the grammar. -%% S - The event we want to extract data from -%% Op - which type of lookup should be done on this -%% component, e.g., 'default' or 'exist'. -%% Returns : {ok, boolean()} | -%% {error, _} -%% Comment : WARNING!!!! -%% This function uses some Orber core information to -%% extract data, e.g., TypeCode representation. Why? -%% We don't want to see the performance take a plunge -%% due to that users write constraints which they -%% can/may not know is slow. The alternative would be -%% to use the IFR. However, these shortcuts aren't -%% that frequent and we can easily update the code. -%% To update, investigate: -%% * lookup/3 cases related to '_type_id' -%% * lookup/3 cases related to unions -%% * get_variable/3 -%% * id2switch/2 -%% * switch2alias/2 -%%------------------------------------------------------------ -%% Done parsing, return the result. -lookup([],S,_) -> {ok, S}; -lookup('$empty', #'CosNotification_StructuredEvent'{remainder_of_body = Any},_) -> - {ok, any:get_value(Any)}; -lookup('$empty',S,_) when is_record(S, any) -> - {ok, any:get_value(S)}; - -%%------- varid -------- -%% CosNotification-revision-98-11-01/46 states: -%% "The following rules govern translation of a run-time variable, $variable , -%% into a specific event field. If the run-time variable is reserved -%% (e.g., $curtime) this translation takes precedence. Next, the first matching -%% translation is chosen respectively from: -%% * a simple-typed member of $.header.fixed_header, -%% * properties in $.header.variable_header, -%% and properties in $.header.filterable_data. -%% If no match is found, the translation defaults to $.variable. -%% Given these rules, an unstructured event with a $.priority member and a -%% structured event using $.header.variable_header(priority) can be specified -%% in a generic constraint using the run-time variable $priority . -%% Alternatively, a constraint can be written specifically for a structured or -%% unstructured event by avoiding the use of run-time variables." - -%% The above contains one error; $.header.filterable_data is not a part of the -%% header, but contained in the event body. - -%% For any events we must first verify that a path exist, e.g., -%% "header"->"fixed_header"->"event_type"->"domain_name", otherwise we will -%% use {dotid, "xxx"}. -lookup([{varid, "type_name"}|T], - #'CosNotification_StructuredEvent' - {header = #'CosNotification_EventHeader' - {fixed_header = #'CosNotification_FixedEventHeader' - {event_type = #'CosNotification_EventType'{type_name=TN}}}}, Op) -> - lookup(T, TN, Op); -lookup([{varid, "type_name"}|T], Any, Op) when is_record(Any, any) -> - case locate_var([?TYPE_PATH, ?VARIABLE_PATH("type_name"), - ?FILTERABLE_PATH("type_name")], Any, Op) of - {ok, Val} -> - lookup(T, Val, Op); - _ -> - lookup(T, get_variable([], "type_name", Any), Op) - end; -lookup([{varid, "domain_name"}|T], - #'CosNotification_StructuredEvent' - {header = #'CosNotification_EventHeader' - {fixed_header = #'CosNotification_FixedEventHeader' - {event_type = #'CosNotification_EventType'{domain_name=DN}}}}, Op) -> - lookup(T, DN, Op); -lookup([{varid, "domain_name"}|T], Any, Op) when is_record(Any, any) -> - case locate_var([?DOMAIN_PATH, ?VARIABLE_PATH("domain_name"), - ?FILTERABLE_PATH("domain_name")], Any, Op) of - {ok, Val} -> - lookup(T, Val, Op); - _ -> - lookup(T, get_variable([], "domain_name", Any), Op) - end; -lookup([{varid, "event_name"}|T], - #'CosNotification_StructuredEvent' - {header = #'CosNotification_EventHeader' - {fixed_header = #'CosNotification_FixedEventHeader' - {event_name = EN}}}, Op) -> - lookup(T, EN, Op); -lookup([{varid, "event_name"}|T], Any, Op) when is_record(Any, any) -> - case locate_var([?EVENT_PATH, ?VARIABLE_PATH("event_name"), - ?FILTERABLE_PATH("event_name")], Any, Op) of - {ok, Val} -> - lookup(T, Val, Op); - _ -> - lookup(T, get_variable([], "event_name", Any), Op) - end; - -lookup([{varid, ID}|T], - #'CosNotification_StructuredEvent'{header = - #'CosNotification_EventHeader'{variable_header = VS}, - filterable_data = FS, - remainder_of_body = Any}, Op) -> - lookup(T, get_variable(VS++FS, ID, Any), Op); -lookup([{varid, ID}|T], Any, Op) -> - case locate_var([?VARIABLE_PATH(ID), ?FILTERABLE_PATH(ID)], Any, Op) of - {ok, Val} -> - lookup(T, Val, Op); - _ -> - lookup(T, get_variable([], ID, Any), Op) - end; - -%%------- dotid -------- -%% First level -lookup([{dotid, "header"}|T], - #'CosNotification_StructuredEvent'{header = S}, Op) -> - lookup(T, S, Op); -lookup([{dotid, "filterable_data"}|T], - #'CosNotification_StructuredEvent'{filterable_data = S}, Op) -> - lookup(T, S, Op); - -lookup([{dotid, remainder_of_body}|T], - #'CosNotification_StructuredEvent'{remainder_of_body = S}, Op) -> - lookup(T, S, Op); -%% Second level. Previous token must have been header -lookup([{dotid, "fixed_header"}|T], - #'CosNotification_EventHeader'{fixed_header = S}, Op) -> - lookup(T, S, Op); -lookup([{dotid, "variable_header"}|T], - #'CosNotification_EventHeader'{variable_header = S}, Op) -> - lookup(T, S, Op); -%% Third level. Previous token must have been fixed_header. -lookup([{dotid, "event_type"}|T], - #'CosNotification_FixedEventHeader'{event_type = S}, Op) -> - lookup(T, S, Op); -lookup([{dotid, "event_name"}|T], - #'CosNotification_FixedEventHeader'{event_name = S}, Op) -> - lookup(T, S, Op); -%% Fourth level. Previous token must have been event_type -lookup([{dotid, "domain_name"}|T], #'CosNotification_EventType'{domain_name = S}, Op) -> - lookup(T, S, Op); -lookup([{dotid, "type_name"}|T], #'CosNotification_EventType'{type_name = S}, Op) -> - lookup(T, S, Op); - -%% Leaf expressions -lookup([{dotid, "name"}|T], #'CosNotification_Property'{name=S}, Op) -> - lookup(T, S, Op); -lookup([{dotid, "value"}|T], #'CosNotification_Property'{value=S}, Op) -> - lookup(T, S, Op); - -lookup([{dotid, ID}|T], - #'CosNotification_StructuredEvent'{remainder_of_body = Any}, Op) -> - lookup(T, get_variable([], ID, Any), Op); -lookup([{dotid, ID}|T], Any, Op) -> - lookup(T, get_variable([], ID, Any), Op); - -lookup([{associd, ID}|T], S, Op) when is_list(S) -> - %% Refers to an associative array, i.e., a list of - %% #'CosNotification_Property'{name=ID, value=A} - lookup(T, get_variable(S, ID, false), Op); - -lookup([{dotint, Position}|T], S, Op) when is_record(S, any) -> - lookup(T, element(Position+2, any:get_value(S)), Op); -lookup([{dotint, Position}|T], S, Op) -> - lookup(T, element(Position+2, S), Op); - -lookup([{uint, ID}|T], S, Op) when is_record(S, any) -> - lookup([{uint, ID}|T], any:get_value(S), Op); -lookup([{uint, ID} |T], S, Op) when is_tuple(S) -> - case catch element(2, S) of - ID -> - %% The supplied union do contain the requested discriminator. - lookup(T, element(3, S), Op); - _Other when Op == exist_component -> - throw({error, {bad_id, "Bad Union ID"}}); - Other -> - %% Check if default is allowed. - M = element(1, S), - case catch M:tc() of - {tk_union,_,_,_,DefNo, UList} -> - %% {tk_union, Id, Name, DiscrTC, Default, ElementList} - case switch2alias(UList, ID) of - {ok, [], _} -> - throw({error, {bad_id, "Bad Union ID"}}); - {ok, default, _} when DefNo >= 0 -> - lookup(T, element(3, S), Op); - {ok, List, _} -> - case lists:member(Other, List) of - true -> - lookup(T, element(3, S), Op); - _-> - throw({error, {bad_id, "Bad Union ID"}}) - end - end - end - end; -lookup([{ustr, ID}|T], S, Op) when is_record(S, any) -> - lookup([{ustr, ID}|T], any:get_value(S), Op); -lookup([{ustr, ID}|T], S, Op) when is_tuple(S) -> - M = element(1, S), - case catch M:tc() of - {tk_union,_,_,_,DefNo, UList} -> - case id2switch(UList, ID) of - [default] when DefNo >= 0 -> - lookup(T, element(3, S), Op); - [default] -> - throw({error, {bad_id, "Bad Union ID supplied"}}); - Found -> - case catch lists:member(element(2, S), Found) of - true -> - lookup(T, element(3, S), Op); - _ -> - throw({error, {bad_id, "Bad Union ID supplied"}}) - end - end - end; -lookup([default|T], S, Op) when is_record(S, any) -> - lookup([default|T], any:get_value(S), Op); -lookup([default|T], S, Op) when is_tuple(S) -> - M = element(1, S), - case catch M:tc() of - {tk_union,_,_,_,DefNo, _UList} when DefNo < 0 -> - %% {tk_union, Id, Name, DiscrTC, Default, ElementList} - throw({error, {bad_id, "No default discriminator"}}); - {tk_union,_,_,_,_DefNo, UList} -> - %% {tk_union, Id, Name, DiscrTC, Default, ElementList} - %% Check if the label really is default. - case lists:keymember(element(2, S), 1, UList) of - false -> - lookup(T, element(3, S), Op); - _-> - throw({error, {bad_id, "Bad Union"}}) - end; - _-> - throw({error, {bad_id, "Bad Union"}}) - end; - -lookup([{arrindex, Index}|T], S, Op) when is_tuple(S) -> - %% The OMG uses c/c++ index. We must add one. - lookup(T, element(Index+1,S), Op); - -%%%%%%%%%%%%%%%%%%%%%%% LEAF EXPRESSIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% got '$._length', which maps to the 'remainder_of_body' -lookup(['_length'], - #'CosNotification_StructuredEvent'{remainder_of_body = Any}, _Op) -> - {ok, length(any:get_value(Any))}; -lookup(['_length'], S, _Op) when is_record(S, any) -> - {ok, length(any:get_value(S))}; -lookup(['_length'], S, _Op) when is_list(S) -> - {ok, length(S)}; -lookup(['_length'], S, _Op) when is_tuple(S) -> - {ok, length(tuple_to_list(S))}; - -%% got '$._d', which maps to the 'remainder_of_body' -%% The discriminator may, accordiong to the CORBA specification, be (2.3/p3-37): -%% * integer_type -%% * char_type -%% * boolean_type -%% * enum_type -%% * scoped_name -lookup(['_d'], - #'CosNotification_StructuredEvent'{remainder_of_body = Any}, - default_component) -> - lookup(['_d'], any:get_value(Any), default_component); -lookup(['_d'], S, default_component) when is_record(S, any) -> - lookup(['_d'], any:get_value(S), default_component); -lookup(['_d'], S, default_component) -> - M = element(1, S), - case catch M:tc() of - {tk_union,_,_,_,DefNo,_} when DefNo < 0 -> - %% '-1' indicates that no default value may exist. - {ok, false}; - {tk_union,_,_,_,_,UList} -> - %% May be using the default setting; check if the Value is in the list. - {ok, not lists:keymember(element(2, S), 1, UList)}; - _ -> - {ok, false} - end; -lookup(['_d'], - #'CosNotification_StructuredEvent'{remainder_of_body = Any}, _Op) -> - {ok, element(2, any:get_value(Any))}; -lookup(['_d'], S, _Op) when is_record(S, any) -> - {ok, element(2, any:get_value(S))}; -lookup(['_d'], S, _Op) -> - {ok, element(2, S)}; - - -lookup(['_type_id'], S, _Op) when is_record(S,'CosNotification_StructuredEvent') -> - {ok, "StructuredEvent"}; -lookup(['_type_id'], S, _Op) when is_record(S,'CosNotification_EventHeader') -> - {ok, "EventHeader"}; -lookup(['_type_id'], S, _Op) when is_record(S,'CosNotification_FixedEventHeader') -> - {ok, "FixedEventHeader"}; -lookup(['_type_id'], S, _Op) when is_record(S,'CosNotification_EventType') -> - {ok, "EventType"}; -lookup(['_type_id'], S, _Op) when is_record(S,'CosNotification_Property') -> - {ok, "Property"}; -lookup(['_type_id'], S, _Op) when is_tuple(S) -> - M=element(1, S), - Name = case catch M:tc() of - {tk_union,_,ID,_,_,_} -> - ID; - {tk_enum, _, ID, _} -> - ID; - {tk_exception, _, ID, _} -> - ID; - {tk_alias, _, ID, _} -> - ID; - {tk_struct,_,ID,_} -> - ID - end, - {ok, Name}; - -lookup(['_repos_id'], S, _Op) when is_record(S,'CosNotification_StructuredEvent') -> - {ok, 'CosNotification_StructuredEvent':id()}; -lookup(['_repos_id'], S, _Op) when is_record(S,'CosNotification_EventHeader') -> - {ok, 'CosNotification_EventHeader':id()}; -lookup(['_repos_id'], S, _Op) when is_record(S,'CosNotification_FixedEventHeader') -> - {ok, 'CosNotification_FixedEventHeader':id()}; -lookup(['_repos_id'], S, _Op) when is_record(S,'CosNotification_EventType') -> - {ok, 'CosNotification_EventType':id()}; -lookup(['_repos_id'], S, _Op) when is_record(S,'CosNotification_Property') -> - {ok, 'CosNotification_Property':id()}; -lookup(['_repos_id'], S, _Op) when is_tuple(S) -> - M = element(1, S), - {ok, M:id()}; - -lookup(_, _, _) -> - error. - - -%%------------------------------------------------------------ -%% function : locate_var -%% Arguments: Paths - A list of path-lists which tells us where -%% to search for runtime variables and in which -%% order. -%% S - Data -%% Op - se lookup/3 -%% Returns : {error, _} | -%% {ok, Val} -%%------------------------------------------------------------ -locate_var([], _S, _) -> - {error, "not found"}; -locate_var([H|T], S, Op) -> - case catch lookup(H, S, Op) of - {ok, Val} -> - {ok,Val}; - _ -> - locate_var(T, S, Op) - end. - -%%------------------------------------------------------------ -%% function : id2switch -%% Arguments: UList - The list of elements contained in the -%% Union TypeCode. -%% ID - string() eq name of element. -%% Returns : Acc - A list of switches related to given ID. -%%------------------------------------------------------------ -id2switch(UList, ID) -> - id2switch(UList, ID, [], false). -id2switch([], _, Acc, _) -> - Acc; -id2switch([{Sw, ID, _}|T], ID, Acc, _) -> - id2switch(T, ID, [Sw|Acc], true); -id2switch([_|_T], _ID, Acc, true) -> - Acc; -id2switch([_|T], ID, Acc, Found) -> - id2switch(T, ID, Acc, Found). - -%%------------------------------------------------------------ -%% function : switch2alias -%% Arguments: UList - The list of elements contained in the -%% Union TypeCode. -%% Switch - the union discriminator. -%% Returns : Acc - A list of switches that are defined with the same -%% ID - The switches common ID. -%% Comment : A union IDL code can look like: -%% union Union switch(long) { -%% case 1: -%% case 2: long ID; }; -%% In this case supplying Switch == 1 (or) the result -%% should be {ok, [1,2], "ID"} -%%------------------------------------------------------------ -switch2alias([], _Switch) -> - %% Is it really possible to define an empty union?? - {ok, [], undefined}; -switch2alias([{Sw, ID, TC}|UList], Switch) -> - switch2alias([{Sw, ID, TC}|UList], Switch, [], ID, false). - - -switch2alias([{default, ID, _}], _, _, _, false) -> - {ok, default, ID}; -switch2alias([], _, _Acc, _, false) -> - {ok, [], undefined}; -switch2alias([], _, Acc, PreviousID, _) -> - {ok, Acc, PreviousID}; - -%% Seen the ID before but just found the correct switch, e.g., -%% [... {0,"K",{tk_string,0}}, {2,"K",{tk_string,0}}...] and switch eq '2' -switch2alias([{Switch, PreviousID, _}|T], Switch, Acc, PreviousID, _Found) -> - switch2alias(T, Switch, [Switch|Acc], PreviousID, true); - -%% First time for this ID and found the correct switch -switch2alias([{Switch, ID, _}|T], Switch, _Acc, _PreviousID, false) -> - switch2alias(T, Switch, [Switch], ID, true); - -%% Seen this ID and found the correct switch before. -switch2alias([{Sw, PreviousID, _}|T], Switch, Acc, PreviousID, true) -> - switch2alias(T, Switch, [Sw|Acc], PreviousID, true); - -%% Seen this ID but not found the correct switch. -switch2alias([{Sw, PreviousID, _}|T], Switch, Acc, PreviousID, false) -> - switch2alias(T, Switch, [Sw|Acc], PreviousID, false); - -%% No more of the correct ID/Switch. Done. -switch2alias([{_, _ID, _}|_], _, Acc, PreviousID, true) -> - {ok, Acc, PreviousID}; -%% Not found correct switch and ID is updated. -switch2alias([{Sw, ID, _}|T], Switch, _Acc, _PreviousID, Found) -> - switch2alias(T, Switch, [Sw], ID, Found). - - -%%------------------------------------------------------------ -%% function : get_field -%% Arguments: ID - element name -%% List - The list of elements contained in the -%% TypeCode. -%% Returns : false | -%% offset -%%------------------------------------------------------------ -get_field(ID, List) -> - get_field(ID, List, 2). -get_field(_ID, [], _) -> - false; -get_field(ID, [ID|_], I) -> - %% Memberlists in enum. - I; -get_field(ID, [{ID,_}|_], I) -> - %% Memberlists in structs. - I; -get_field(ID, [_|T], I) -> - get_field(ID, T, I+1). - -%%------------------------------------------------------------ -%% function : check_types -%% Arguments: A sequence of CosNotification::EventType{}, i.e., -%% name-value pairs. -%% Returns : {ok, WhichType, WC} -%% WhichType - type/domain/both -%% WC - [Types using wildcard] -%%------------------------------------------------------------ -%% With check_types we try to determin if one or more EventTypes force us to check -%% all events against this constraint. For example: -%% EventType A1 has domain_name="car",type_name = "*" -%% EventType A2 has domain_name="*",type_name = "DodgeViper" -%% Since A1 says that we must test against any type_name and A2 -%% against any domain_name, we must test all events using these permutations. -%% It's better to do these test now instead of when we are up and running. But -%% if a client change the constraints VERY often it's up to them and they have -%% to accept the delay. -%%------------------------------------------------------------ - -%% If types is an empty list it means that this constraint must be used -%% for all events. -check_types([]) -> true; -check_types(Types) -> check_types(Types, both, []). -check_types([], Which, WildCard) -> {ok, Which, WildCard}; -%% The following cases means that all events matches. -check_types([#'CosNotification_EventType'{domain_name="",type_name = ""}|_T],_,_) -> - true; -check_types([#'CosNotification_EventType'{domain_name="",type_name = "*"}|_T],_,_) -> - true; -check_types([#'CosNotification_EventType'{domain_name="*",type_name = ""}|_T],_,_) -> - true; -check_types([#'CosNotification_EventType'{domain_name="*",type_name = "*"}|_T],_,_) -> - true; -%% The following cases means that all events must be tested using this constraint. -check_types([#'CosNotification_EventType'{domain_name="",type_name = Ty}|T], domain,WC) when is_list(Ty) -> - check_wildcard(T, all, WC, "", Ty); -check_types([#'CosNotification_EventType'{domain_name="*",type_name = Ty}|T], domain, WC) when is_list(Ty) -> - check_wildcard(T, all, WC, "", Ty); -check_types([#'CosNotification_EventType'{domain_name=Do,type_name = ""}|T], type,WC) when is_list(Do) -> - check_wildcard(T, all, WC, Do, ""); -check_types([#'CosNotification_EventType'{domain_name=Do,type_name = "*"}|T], type,WC) when is_list(Do) -> - check_wildcard(T, all, WC, Do, ""); -%% The following cases is used to prevent other cases from converting, -%% for example, all->type. -check_types([#'CosNotification_EventType'{domain_name="",type_name = Ty}|T], all,WC) when is_list(Ty) -> - check_wildcard(T, all, WC, "", Ty); -check_types([#'CosNotification_EventType'{domain_name="*",type_name = Ty}|T], all,WC) when is_list(Ty) -> - check_wildcard(T, all, WC, "", Ty); -check_types([#'CosNotification_EventType'{domain_name=Do,type_name = ""}|T], all,WC) when is_list(Do) -> - check_wildcard(T, all, WC, Do, ""); -check_types([#'CosNotification_EventType'{domain_name=Do,type_name = "*"}|T], all,WC) when is_list(Do) -> - check_wildcard(T, all, WC, Do, ""); -%% The following cases means that all events with matching Type must be -%% tested using this constraint. -check_types([#'CosNotification_EventType'{domain_name="",type_name = Ty}|T], _W,WC) when is_list(Ty) -> - check_wildcard(T, type, WC, "", Ty); -check_types([#'CosNotification_EventType'{domain_name="*",type_name = Ty}|T], _W,WC) when is_list(Ty) -> - check_wildcard(T, type, WC, "", Ty); -%% The following cases means that all events with matching Domain must be -%% tested using this constraint. -check_types([#'CosNotification_EventType'{domain_name=Do,type_name = ""}|T], _W,WC) when is_list(Do) -> - check_wildcard(T, domain, WC, Do, ""); -check_types([#'CosNotification_EventType'{domain_name=Do,type_name = "*"}|T], _W,WC) when is_list(Do) -> - check_wildcard(T, domain, WC, Do, ""); -%% Sorry, no shortcuts. -check_types([#'CosNotification_EventType'{domain_name=Do,type_name=Ty}|T], W,WC) when is_list(Do) andalso is_list(Ty) -> - check_wildcard(T, W, WC, Do, Ty); -check_types([H|_], _,_) when is_record(H, 'CosNotification_EventType') -> - %% Not valid. - corba:raise(#'CosNotifyComm_InvalidEventType'{type=H}); -check_types(_,_,_) -> - %% Wasn't even a correct input. - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -check_wildcard(Types, Which, WC, Domain, Type) -> - NewWC = - case {string:chr(Domain, $*), string:chr(Type, $*)} of - {0, 0} -> - WC; - {0, _}-> - [{type, Domain, convert_wildcard(Type, [])}|WC]; - {_, 0}-> - [{domain, convert_wildcard(Domain, []), Type}|WC]; - _-> - [{both, convert_wildcard(Domain, []), convert_wildcard(Type, [])}|WC] - end, - check_types(Types, Which, NewWC). - -%% Change '*' to '.*', see re:compile/1 documentation. -convert_wildcard([], Acc) -> - case re:compile(lists:reverse(Acc)) of - {ok, Expr} -> - Expr; - _ -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end; -convert_wildcard([$*|T], Acc) -> - convert_wildcard(T, [$*, $.|Acc]); -convert_wildcard([H|T], Acc) -> - convert_wildcard(T, [H|Acc]). - -%%------------------------------------------------------------ -%% function : match_types -%% Arguments: A sequence of {Which, Domain, Type}, i.e., the same as -%% returned from cosNotification_Filter:check_types/3 -%% Returns : bolean() -%%------------------------------------------------------------ -match_types(_, _, []) -> - false; -match_types(Domain, Type, [{domain, WCDomain, Type}|T]) -> - L=length(Domain), - case catch re:run(Domain, WCDomain) of - nomatch -> - match_types(Domain, Type, T); - {match, [{0, L}]} -> - true; - _-> - match_types(Domain, Type, T) - end; -match_types(Domain, Type, [{type, Domain, WCType}|T]) -> - L=length(Type), - case catch re:run(Type, WCType) of - nomatch -> - match_types(Domain, Type, T); - {match, [{0, L}]} -> - true; - _-> - match_types(Domain, Type, T) - end; -match_types(Domain, Type, [{both, WCDomain, WCType}|T]) -> - L1=length(Domain), - case catch re:run(Domain, WCDomain) of - nomatch -> - match_types(Domain, Type, T); - {match, [{0, L1}]} -> - L2=length(Type), - case catch re:run(Type, WCType) of - nomatch -> - match_types(Domain, Type, T); - {match, [{0, L2}]} -> - true; - _ -> - match_types(Domain, Type, T) - end; - _-> - match_types(Domain, Type, T) - end; -match_types(Domain, Type, [_|T]) -> - match_types(Domain, Type, T). - -%%------------------------------------------------------------ -%% function : validate_types -%% Arguments: A sequence of CosNotification::EventType{}, i.e., -%% name-value pairs. -%% Returns : ok | -%% {'EXCEPTION', #'CosNotifyComm_InvalidEventType'{}} -%%------------------------------------------------------------ - -validate_types([]) -> - ok; -validate_types([#'CosNotification_EventType'{domain_name=Do,type_name=Ty}|T]) - when is_list(Do) andalso is_list(Ty) -> - validate_types(T); -validate_types([H|_]) - when is_record(H, 'CosNotification_EventType') -> - %% Not valid. - corba:raise(#'CosNotifyComm_InvalidEventType'{type=H}); -validate_types(_) -> - %% Wasn't even a correct input. - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - - -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosNotification/src/cosNotification_Grammar.yrl b/lib/cosNotification/src/cosNotification_Grammar.yrl deleted file mode 100644 index f4a42d022e..0000000000 --- a/lib/cosNotification/src/cosNotification_Grammar.yrl +++ /dev/null @@ -1,168 +0,0 @@ -%%-------------------------------------------------------------------- -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%%-------------------------------------------------------------------- -%% File : cosNotification_Grammar.yrl -%% Purpose : Implement the constraint grammar for CosNotification filters. -%%-------------------------------------------------------------------- - -Nonterminals - '' '' '' '' '' '' - '' '' '' '' '' - '' '' '' '' '' ''. - -Terminals -% 'dbslsh' 'bslshd' - 'bslsh' 'ident' 'string' - '_length' '_d''_type_id' '_repos_id' - 'not' 'or' 'and' 'num' - 'in' '~' '.' 'dollar' - 'ADDOP' 'RELOP' 'MULOP' 'default' 'exist' - 'TRUE' 'FALSE' - '(' ')' '[' ']' 'int'. - -Left 100 'or'. -Left 200 'and'. -%Nonassoc 300 'RELOP'. % '==', '!=', '<', '>', '<=', '=>' -Left 300 'RELOP'. -%Nonassoc 400 'in'. -Left 400 'in'. -%Nonassoc 500 '~'. -Left 500 '~'. -Left 600 'ADDOP'. % '+', '-' -Left 700 'MULOP'. % '*', '/' -Unary 800 'not'. -Unary 900 'exist'. -Unary 900 'default'. -%Unary 900 'u-'. % unary minus - -Rootsymbol ''. -Endsymbol '$end'. - -'' -> '$empty' : '$empty'. -'' -> '' : '$1'. - -'' -> '' : '$1'. - -'' -> '' : '$1'. - -'' -> '' 'or' '' : {'or', '$1', '$3'}. -'' -> '' : '$1'. - -'' -> '' 'and' '' : {'and', '$1', '$3'}. -'' -> '' : '$1'. - -'' -> '' 'RELOP' '' : {element(2, '$2'), '$1', '$3'}. -'' -> '' : '$1'. - -'' -> '' : '$1'. -'' -> '' 'in' '' : {'in', '$1', '$3'}. -'' -> '' 'in' 'dollar' '' : {'in', '$1', examin_comp({'component', '$4'})}. - -'' -> '' : '$1'. -'' -> '' '~' '' : {'~', '$1', '$3'}. - -'' -> '' : '$1'. -'' -> '' 'ADDOP' '' : {element(2, '$2'), '$1', '$3'}. - -'' -> '' : '$1'. -'' -> '' 'MULOP' '' : {element(2, '$2'), '$1', '$3'}. - -'' -> '' : '$1'. -'' -> 'not' '' : {'not', '$2'}. - -'' -> '(' '' ')' : '$2'. -'' -> 'num' : element(2, '$1'). -'' -> 'int' : element(2, '$1'). -'' -> 'string' : element(2, '$1'). -'' -> 'TRUE' : 'true'. -'' -> 'FALSE' : 'false'. -'' -> 'ADDOP' 'num' : create_unary(element(2, '$1'), element(2, '$2')). -'' -> 'ADDOP' 'int' : create_unary(element(2, '$1'), element(2, '$2')). -'' -> '' : list_to_atom('$1'). -'' -> 'dollar' '' : examin_comp({component, '$2'}). -'' -> 'default' 'dollar' '' : examin_comp({'default_component', '$3'}). -'' -> 'exist' 'dollar' '' : examin_comp({'exist_component', '$3'}). - -%% The following rules are used to create Components. The format used is: -%% [...] -'' -> '.' '' : '$2'. -'' -> '[' 'int' ']' '' : [{'arrindex', element(2, '$2')} | '$4']. %% CompArray -'' -> '(' '' ')' '' : [{'associd', '$2'} | '$4']. %%CompAssoc -'' -> '' '' : [{'varid', '$1'} | '$2']. %% run-time variable -'' -> '$empty' : []. - -'' -> '.' '' : '$2'. -'' -> '[' 'int' ']' '' : [{'arrindex', element(2, '$2')} | '$4']. %% CompArray -'' -> '(' '' ')' '' : [{'associd', '$2'} | '$4']. %%CompAssoc -'' -> '$empty' : []. - -'' -> '' '' : [{'dotid', '$1'} | '$2']. -'' -> 'int' '' : [{'dotint', element(2, '$1')} | '$2']. %% ComPos -'' -> '(' '' ')' '' : ['$2' | '$4']. %% UnionPos -'' -> '_length' : ['_length']. %% arrays or sequences ONLY -'' -> '_d' : ['_d']. %% discriminated unions ONLY -'' -> '_type_id' : ['_type_id']. %% ok if info can be obtained -'' -> '_repos_id' : ['_repos_id']. %% ok if info can be obtained - -'' -> 'ident' : element(2, '$1'). -'' -> 'bslsh' 'ident' : element(2, '$2'). - -'' -> 'int' : {'uint', element(2, '$1')}. -'' -> 'ADDOP' 'int' : {'uint', create_unary(element(2, '$1'), element(2, '$2'))}. -'' -> 'string' : {'ustr', element(2, '$1')}. -'' -> '$empty': 'default'. - -Erlang code. -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2009. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%%---------------------------------------------------------------------- -%% File : cosNotification_Grammar.erl -%% Purpose : THIS FILE HAS BEEN GENERATED. DO NOT EDIT!!!! -%%---------------------------------------------------------------------- - --include("CosNotification_Definitions.hrl"). - -create_unary('+', Val) when is_number(Val) -> Val; -create_unary('-', Val) when is_number(Val) -> -Val; -create_unary(_, _) -> return_error(0, "syntax error"). - -examin_comp({T, []}) -> - {T, '$empty'}; -examin_comp(V) -> - V. - diff --git a/lib/cosNotification/src/cosNotification_Scanner.erl b/lib/cosNotification/src/cosNotification_Scanner.erl deleted file mode 100644 index 31f27a8d78..0000000000 --- a/lib/cosNotification/src/cosNotification_Scanner.erl +++ /dev/null @@ -1,269 +0,0 @@ -%%---------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : cosNotification_Scanner.erl -%% Purpose : Scan and pre-process a grammar. -%%---------------------------------------------------------------------- - --module('cosNotification_Scanner'). - --export([scan/1]). - -scan(Str) -> - RSL = scan(Str, 1, [], any), - {ok, lists:reverse(RSL)}. - - -%% Guard macros used at top scan functions only --define(is_number(X), X >= $0, X =< $9). --define(is_upper(X), X >= $A, X =< $Z). --define(is_lower(X), X >= $a, X =< $z). - -%%---------------------------------------------------------------------- -%% scan -%% -%% A-Z -scan([X|Str], Line, Out, Type) when ?is_upper(X) -> - scan_name(Str, [X], Line, Out, Type); -%% a-z -scan([X|Str], Line, Out, Type) when ?is_lower(X) -> - scan_name(Str, [X], Line, Out, Type); -%% 0-9 -scan([X|Str], Line, Out, Type) when ?is_number(X) -> - scan_number(Str, [X], Line, Out, Type); - -%% RELOP:s == != <= >= > < -scan([$=,$= | Str], Line, Out, _Type) -> - scan(Str, Line, [{'RELOP', '=='} | Out], any); -scan([$!,$= | Str], Line, Out, _Type) -> - scan(Str, Line, [{'RELOP', '!='} | Out], any); -scan([$<,$= | Str], Line, Out, _Type) -> - scan(Str, Line, [{'RELOP', '<='} | Out], any); -scan([$>,$= | Str], Line, Out, _Type) -> - scan(Str, Line, [{'RELOP', '>='} | Out], any); -scan([$> | Str], Line, Out, _Type) -> - scan(Str, Line, [{'RELOP', '>'} | Out], any); -scan([$< | Str], Line, Out, _Type) -> - scan(Str, Line, [{'RELOP', '<'} | Out], any); - -%% ADDOP:s + - -scan([$+ | Str], Line, Out, Type) -> - scan(Str, Line, [{'ADDOP', '+'} | Out], Type); -scan([$- | Str], Line, Out, Type) -> - scan(Str, Line, [{'ADDOP', '-'} | Out], Type); - -%% MULOP:s * / -scan([$* | Str], Line, Out, _Type) -> - scan(Str, Line, [{'MULOP', '*'} | Out], any); -scan([$/ | Str], Line, Out, _Type) -> - scan(Str, Line, [{'MULOP', '/'} | Out], any); - -%% TAB -scan([9| T], Line, Out, Type) -> scan(T, Line, Out, Type); -%% SP -scan([32| T], Line, Out, Type) -> scan(T, Line, Out, Type); -%% CR -scan([$\r|Str], Line, Out, Type) -> - scan(Str, Line, Out, Type); -%% LF -scan([$\n|Str], Line, Out, Type) -> - scan(Str, Line+1, Out, Type); -%% \\ -scan([92, 92 | Str], Line, Out, Type) -> - scan(Str, Line, [{'dbslsh', Line} | Out], Type); -%% \' -scan([92, 39 | Str], Line, Out, Type) -> - scan(Str, Line, [{'bslshd', Line} | Out], Type); -%% '\' -scan([92 | Str], Line, Out, Type) -> - scan(Str, Line, [{'bslsh', Line} | Out], Type); -%% '_' -scan([$_ | Str], Line, Out, dollar) -> - scan_name(Str, [$_], Line, Out, dollar); -%% '$' -scan([$$, 92 | Str], Line, Out, _Type) -> - scan(Str, Line, [{'bslsh', Line}, {'dollar', Line} | Out], dollar); -scan([$$ | Str], Line, Out, _Type) -> - scan(Str, Line, [{'dollar', Line} | Out], dollar); -scan([$"|Str], Line, Out, Type) -> - scan_const(char, Str, [], Line, Out, Type); -scan([$'|Str], Line, Out, Type) -> - scan_const(string, Str, [], Line, Out, Type); - -%% Writing '+.' is not allowed ('+' or '-' are only allowed -%% as unary for (within a component) which must be en integer). -scan([$. | Str], Line, [{'ADDOP', Op}|Out], _) -> - scan_frac(Str, [$.], Line, [{'ADDOP', Op}|Out], any); -%% Must be a -scan([$. | Str], Line, Out, dollar) -> - scan(Str, Line, [{'.',Line} | Out], dollar); -%% Number -scan([$. | Str], Line, Out, Type) -> - scan_frac(Str, [$.], Line, Out, Type); -scan([C|Str], Line, Out, Type) -> - scan(Str, Line, [{list_to_atom([C]), Line} | Out], Type); - -scan([], _Line, Out, _Type) -> - Out. - -%%---------------------------------------------------------------------- -%% scan_name -%% - -scan_number([X|Str], Accum, Line, Out, Type) when ?is_number(X) -> - scan_number(Str, [X|Accum], Line, Out, Type); -scan_number([X|Str], Accum, Line, Out, dollar) when X==$. -> - scan(Str, Line, [{'.', Line}, - {'int', list_to_integer(lists:reverse(Accum))} | Out], dollar); -scan_number([X|Str], Accum, Line, Out, Type) when X==$. -> - scan_frac(Str, [X|Accum], Line, Out, Type); -scan_number([X|Str], Accum, Line, Out, Type) when X==$e -> - scan_exp(Str, [X|Accum], Line, Out, Type); -scan_number([X|Str], Accum, Line, Out, Type) when X==$E -> - scan_exp(Str, [X|Accum], Line, Out, Type); -scan_number(Str, Accum, Line, Out, Type) -> - scan(Str, Line, [{'int', list_to_integer(lists:reverse(Accum))} | Out], Type). - - -%% Floating point number scan. -%% -%% Non trivial scan. A float consists of an integral part, a -%% decimal point, a fraction part, an e or E and a signed integer -%% exponent. Either the integer part or the fraction part but not -%% both may be missing, and either the decimal point or the -%% exponent part but not both may be missing. The exponent part -%% must consist of an e or E and a possibly signed exponent. -%% -%% Analysis shows that "1." ".7" "1e2" ".5e-3" "1.7e2" "1.7e-2" -%% is allowed and "1" ".e9" is not. The sign is only allowed just -%% after an e or E. The scanner reads a number as an integer -%% until it encounters a "." so the integer part only error case -%% will not be caught in the scanner (but rather in expression -%% evaluation) - -scan_frac([$e | _Str], [$.], _Line, _Out, _Type) -> - {error, "illegal_float"}; -scan_frac([$E | _Str], [$.], _Line, _Out, _Type) -> - {error, "illegal_float"}; -scan_frac(Str, Accum, Line, Out, Type) -> - scan_frac2(Str, Accum, Line, Out, Type). - -scan_frac2([X|Str], Accum, Line, Out, Type) when ?is_number(X) -> - scan_frac2(Str, [X|Accum], Line, Out, Type); -scan_frac2([X|Str], Accum, Line, Out, Type) when X==$e -> - scan_exp(Str, [X|Accum], Line, Out, Type); -scan_frac2([X|Str], Accum, Line, Out, Type) when X==$E -> - scan_exp(Str, [X|Accum], Line, Out, Type); -%% Since '.2' is allowed, we add '0' in front to be sure (erlang do not allow -%% list_to_float(".2") and list_to_float("0.2") eq. list_to_float("00.2")). -scan_frac2(Str, Accum, Line, Out, Type) -> - scan(Str, Line, [{'num', list_to_float([$0|lists:reverse(Accum)])} | Out], Type). - -scan_exp([X|Str], Accum, Line, Out, Type) when X==$- -> - scan_exp2(Str, [X|Accum], Line, Out, Type); -scan_exp(Str, Accum, Line, Out, Type) -> - scan_exp2(Str, Accum, Line, Out, Type). - -scan_exp2([X|Str], Accum, Line, Out, Type) when ?is_number(X) -> - scan_exp2(Str, [X|Accum], Line, Out, Type); -%% Since '.2' is allowed, we add '0' in front to be sure (erlang do not allow -%% list_to_float(".2")). -scan_exp2(Str, Accum, Line, Out, Type) -> - scan(Str, Line, [{'num', list_to_float([$0|lists:reverse(Accum)])} | Out], Type). - - -scan_name([X|Str], Accum, Line, Out, Type) when ?is_upper(X) -> - scan_name(Str, [X|Accum], Line, Out, Type); -scan_name([X|Str], Accum, Line, Out, Type) when ?is_lower(X) -> - scan_name(Str, [X|Accum], Line, Out, Type); -scan_name([X|Str], Accum, Line, Out, Type) when ?is_number(X) -> - scan_name(Str, [X|Accum], Line, Out, Type); -scan_name([$_|Str], Accum, Line, Out, dollar) -> - scan_name(Str, [$_|Accum], Line, Out, dollar); -scan_name(S, Accum, Line, [{bslsh,LL} | Out], Type) -> - %% An escaped identifier. - L = lists:reverse(Accum), - scan(S, Line, [{'ident', L}, {bslsh,LL} | Out], Type); -scan_name(S, Accum, Line, Out, Type) -> - L = lists:reverse(Accum), - {X, NewType} = case check_name(L) of - false -> - {{'ident', L}, Type}; - _ -> - {{list_to_atom(L), Line}, any} - end, - scan(S, Line, [X | Out], NewType). - -%% Shall scan a constant -scan_const(char, [$" | Rest], Accum, Line, Out, Type) -> - scan(Rest, Line, - [{'ident', list_to_atom(lists:reverse(Accum))} | Out], Type); -scan_const(char, [], _Accum, _Line, Out, _Type) -> %% Bad string -% {error, "bad_string"}; - Out; -scan_const(string, [$' | Rest], Accum, Line, Out, Type) -> - scan(Rest, Line, - [{'string', lists:reverse(Accum)} | Out], Type); -scan_const(Mode, [$\\, C | Rest], Accum, Line, Out, Type) -> - case escaped_char(C) of - error -> - %% Bad escape character - %% {error, "bad_escape_character"}; - scan_const(Mode, Rest, [C | Accum], Line, Out, Type); - EC -> - scan_const(Mode, Rest, [EC | Accum], Line, Out, Type) - end; -scan_const(Mode, [C | Rest], Accum, Line, Out, Type) -> - scan_const(Mode, Rest, [C | Accum], Line, Out, Type). - -%% Escaped character. Escaped chars are repr as two characters in the -%% input list of letters and this is translated into one char. -escaped_char($n) -> $\n; -escaped_char($t) -> $\t; -escaped_char($v) -> $\v; -escaped_char($b) -> $\b; -escaped_char($r) -> $ ; -escaped_char($f) -> $\f; -escaped_char($a) -> $\a; -escaped_char($\\) -> $\\; -escaped_char($?) -> $?; -escaped_char($') -> $'; -escaped_char($") -> $"; -%% Error -escaped_char(_Other) -> error. - - -check_name("exist") -> true; -check_name("default") -> true; -check_name("_length") -> true; -check_name("_d") -> true; -check_name("_type_id") -> true; -check_name("_repos_id") -> true; -check_name("not") -> true; -check_name("or") -> true; -check_name("and") -> true; -check_name("FALSE") -> true; -check_name("TRUE") -> true; -check_name("in") -> true; -check_name(_) -> false. - - diff --git a/lib/cosNotification/src/cosNotification_eventDB.erl b/lib/cosNotification/src/cosNotification_eventDB.erl deleted file mode 100644 index cd3c74d617..0000000000 --- a/lib/cosNotification/src/cosNotification_eventDB.erl +++ /dev/null @@ -1,1351 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : cosNotification_eventDB.erl -%% Purpose : -%% Purpose : This module is supposed to centralize Event storage. -%% Comments: -%% * Setting Order Policy to AnyOrder eq. Priority order -%% -%% * Setting Discard Policy to AnyOrder eq. RejectNewEvents. -%% -%% * DB ordering: Since the deliver- and discard-order may differ we need -%% two ets-tables, both of type 'ordered_set'. They contain: -%% - table 1 (T1): deliver order key and the associated event. -%% - table 2 (T2): discard order key. -%% -%% When adding a new event we add, if necessary, related keys in T2. -%% For example, if we should discard events in FIFO order, the delivery -%% order may be set to Priority order. If the Max Event limit is reached -%% we first look in T2 to find out which event to discard by using and -%% reorder the key elements. T2 gives {TimeStamp, Priority}, which is used -%% to lookup in T1 as {Priority, TimeStamp}. -%% A TimeStamp is always included in the DB keys, even if FIFO or LIFO -%% is used, since lots of events probably will have the same prioity and -%% with a little bit of bad luck some events will never be delivered. -%% -%% Note: deliver order AnyOrder and PriorityOrder is equal since the later -%% is defined as default. -%% discard order AnyOrder and RejectNewEvents is equal since the later -%% is defined as default. -%% The keys used is ('-' indicates T2 is not needed and, thus, not instantiated): -%% -%% T1 policy T1 Key T2 Policy T2 Key -%% ------------------------------------------------------------------ -%% DeadlineOrder {DL, Key, Prio} PriorityOrder {Prio, Key, DL} -%% DeadlineOrder {DL, Key} FifoOrder {Key, DL} -%% DeadlineOrder {DL, Key} LifoOrder {Key, DL} -%% DeadlineOrder {DL, Key} RejectNewEvents - -%% DeadlineOrder {DL, Key} DeadlineOrder - -%% FifoOrder {Key, DL} DeadlineOrder {DL, Key} -%% FifoOrder {Key, Prio} PriorityOrder {Prio, Key} -%% FifoOrder Key RejectNewEvents - -%% FifoOrder Key Fifo - -%% FifoOrder Key Lifo - -%% PriorityOrder {Prio, Key, DL} DeadlineOrder {DL, Key, Prio} -%% PriorityOrder {Prio, Key} Fifo {Key, Prio} -%% PriorityOrder {Prio, Key} Lifo {Key, Prio} -%% PriorityOrder {Prio, Key} RejectNewEvents - -%% ------------------------------------------------------------------ -%% DL == Deadline, Key == TimeStamp, Prio == Priority -%% -%% NOTE: If defined, the Discard DB Keys are the same as in Event DB, except -%% that the first and last Key change place. {K1,K2}<->{K2,K1} and -%% {K1,K2,K3}<->{K3,K2,K1}. -%%---------------------------------------------------------------------- --module(cosNotification_eventDB). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). --include_lib("cosTime/include/TimeBase.hrl"). - -%% Application files --include("CosNotification.hrl"). --include("CosNotifyChannelAdmin.hrl"). --include("CosNotifyComm.hrl"). --include("CosNotifyFilter.hrl"). - --include("CosNotification_Definitions.hrl"). - -%%--------------- EXPORTS ------------------------------------ -%% Internal Filter Functions --export([validate_event/5, - create_db/4, - destroy_db/1, - get_event/1, - get_event/2, - get_events/2, - get_events/3, - delete_events/1, - update/2, - update/4, - add_event/2, - add_event/4, - add_and_get_event/2, - add_and_get_event/3, - add_and_get_event/4, - add_and_get_event/5, - gc_events/2, - gc_events_local/4, - gc_start/2, - filter_events/2, - filter_events/3, - status/2]). - -%%--------------- DATA STRUCTURES ---------------------------- --record(dbRef, {orderRef, discardRef, orderPolicy, discardPolicy, - defPriority, maxEvents, defStopT, startTsupport, - stopTsupport, gcTime, gcLimit, timeRef}). - - - -%%--------------- DEFINES ------------------------------------ - --define(CreateRef(OR, DR, O, D, DP, ME, DS, StaT, StoT, GT, GL, TR), - #dbRef{orderRef=OR, discardRef=DR, orderPolicy=O, discardPolicy=D, - defPriority=DP, maxEvents=ME, defStopT=DS, startTsupport=StaT, - stopTsupport=StoT, gcTime=GT, gcLimit=round(ME*GL/100), - timeRef=TR}). - - --define(get_OrderP(DR), DR#dbRef.orderPolicy). --define(get_DiscardP(DR), DR#dbRef.discardPolicy). --define(get_OrderRef(DR), DR#dbRef.orderRef). --define(get_DiscardRef(DR), DR#dbRef.orderRef). --define(get_DefPriority(DR), DR#dbRef.defPriority). --define(get_MaxEvents(DR), DR#dbRef.maxEvents). --define(get_DefStopT(DR), DR#dbRef.defStopT). --define(get_StartTsupport(DR), DR#dbRef.startTsupport). --define(get_StopTsupport(DR), DR#dbRef.stopTsupport). --define(get_GCTime(DR), DR#dbRef.gcTime). --define(get_GCLimit(DR), DR#dbRef.gcLimit). --define(get_TimeRef(DR), DR#dbRef.timeRef). - --define(set_OrderP(DR, O), DR#dbRef{orderPolicy = O}). --define(set_DiscardP(DR, D), DR#dbRef{discardPolicy = D}). --define(set_OrderRef(DR, E), DR#dbRef{orderRef = E}). --define(set_DiscardRef(DR, E), DR#dbRef{orderRef = E}). --define(set_DefPriority(DR, DP), DR#dbRef{defPriority = DP}). --define(set_MaxEvents(DR, ME), DR#dbRef{maxEvents = ME}). --define(set_DefStopT(DR, DS), DR#dbRef{defStopT = DS}). --define(set_StartTsupport(DR, B), DR#dbRef{startTsupport = B}). --define(set_StopTsupport(DR, B), DR#dbRef{stopTsupport = B}). - --define(is_StartTNotSupported(DR), DR#dbRef.startTsupport == false). --define(is_StopTNotSupported(DR), DR#dbRef.stopTsupport == false). --define(is_TimeoutNotUsed(DR), DR#dbRef.defStopT == 0). - - -%%------------------------------------------------------------ -%% function : status -%% Arguments: DBRef -%% Key - which information we want. -%% Returns : Data related to the Key. -%%------------------------------------------------------------ -status(DBRef, eventCounter) -> - ets:info(?get_OrderRef(DBRef), size); -status(DBRef, {batchLimit, Limit}) -> - case ets:info(?get_OrderRef(DBRef), size) of - Current when is_integer(Current) andalso Current >= Limit -> - ?debug_print("BATCH LIMIT (~p) REACHED, CONTAINS: ~p~n", [Limit, Current]), - true; - _Other -> - ?debug_print("BATCH LIMIT (~p) NOT REACHED, CONTAINS: ~p~n", - [Limit, _Other]), - false - end; -status(DBRef, {batchLimit, Limit, TemporaryMax}) -> - case ets:info(?get_OrderRef(DBRef), size) of - Current when is_integer(Current) andalso Current >= TemporaryMax -> - ?debug_print("MAX LIMIT (~p) REACHED, CONTAINS: ~p~n", - [TemporaryMax, Current]), - true; - Current when is_integer(Current) andalso Current >= Limit -> - ?debug_print("BATCH LIMIT (~p) REACHED, CONTAINS: ~p~n", [Limit, Current]), - true; - _Other -> - ?debug_print("BATCH LIMIT (~p) NOT REACHED, CONTAINS: ~p~n", - [Limit, _Other]), - false - end; -status(_, _) -> - error. - - -%%------------------------------------------------------------ -%% function : gc_events_local -%% Arguments: DBRef -%% Returns : -%% Comment : This function is intended for "emergency" GC, i.e., -%% when the DB must discard events we should first try -%% to remove events with expired deadlines. -%%------------------------------------------------------------ -gc_events_local(_, _, false, _) -> - ok; -gc_events_local(_, _, _, 0) -> - ok; -gc_events_local(ORef, DRef, _, _) -> - gc_loop(ets:first(ORef), ORef, DRef). - -%%------------------------------------------------------------ -%% function : gc_events -%% Arguments: DBRef -%% Priority - 'low', 'medium' or 'high'; will determine -%% how important a fast gc is. -%% Returns : -%% Comment : This function is intended for background GC. -%%------------------------------------------------------------ -gc_events(DBRef, _Priority) when ?is_TimeoutNotUsed(DBRef) -> - ok; -gc_events(DBRef, _Priority) when ?is_StopTNotSupported(DBRef) -> - ok; -gc_events(DBRef, Priority) -> - TS = erlang:monotonic_time(), - {resolution, TR} = lists:keyfind(resolution, 1, erlang:system_info(os_monotonic_time_source)), - case get(oe_GC_timestamp) of - Num when TS > Num -> - put(oe_GC_timestamp, TS + ?get_GCTime(DBRef) * TR), - spawn_link(?MODULE, gc_start, [DBRef, Priority]); - _-> - ok - end. - -%%------------------------------------------------------------ -%% function : gc_start -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -gc_start(#dbRef{orderRef = ORef, discardRef = DRef}, Priority) -> - process_flag(priority, Priority), - gc_loop(ets:first(ORef), ORef, DRef). - -gc_loop('$end_of_table', _, _) -> - ok; -gc_loop(Key, ORef, DRef) -> - [{Keys,DL,_,_,_}]=ets:lookup(ORef, Key), - case check_deadline(DL) of - true when DRef == undefined -> - ets:delete(ORef, Key); - true -> - ets:delete(ORef, Key), - gc_discard_DB(Keys, DRef); - _ -> - ok - end, - gc_loop(ets:next(ORef, Key), ORef, DRef). - -gc_discard_DB({Key1, Key2}, DRef) -> - ets:delete(DRef, {Key2, Key1}); -gc_discard_DB({Key1, Key2, Key3}, DRef) -> - ets:delete(DRef, {Key3, Key2, Key1}). - -%%------------------------------------------------------------ -%% function : create_FIFO_Key -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -create_FIFO_Key() -> - {M, S, U} = erlang:timestamp(), - -M*1000000000000 - S*1000000 - U. - -%%------------------------------------------------------------ -%% function : convert_FIFO_Key -%% Arguments: -%% Returns : A timestamp tuple -%% Comment : Used when we must reuse a timestamp, i.e., only -%% when we must reorder the DB. -%%------------------------------------------------------------ -convert_FIFO_Key(Key) -> - K = abs(Key), - Secs = trunc(K/1000000), - M = trunc(K/1000000000000), - S = Secs-M*1000000, - U = K - S*1000000-M*1000000000000, - {M, S, U}. - -%%------------------------------------------------------------ -%% function : extract_priority -%% Arguments: Event -%% Defalt Value -%% Mapping Filter Value -%% - false value not needed (depends on QoS type) -%% - undefined value needed but no filter associated. -%% Returns : -%%------------------------------------------------------------ -extract_priority(_, _, false) -> - false; -extract_priority(#'CosNotification_StructuredEvent' - {header = #'CosNotification_EventHeader' - {variable_header = VH}}, DefPriority, undefined) -> - extract_value(VH, ?not_Priority, DefPriority); -%% Maybe a unstructured event. -extract_priority(_, DefPriority, undefined) -> - DefPriority; -extract_priority(_, _, PriorityOverride) -> - %% Must have an associated MappingFilter for Priority. - PriorityOverride. - -%%------------------------------------------------------------ -%% function : extract_start_time -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -extract_start_time(_, false, _) -> - false; -extract_start_time(#'CosNotification_StructuredEvent' - {header = #'CosNotification_EventHeader' - {variable_header = VH}}, _, TRef) -> - ST = case extract_value(VH, ?not_StartTime, undefined) of - UTC when is_record(UTC, 'TimeBase_UtcT') -> - UTC; - _ -> - false - end, - convert_time(ST, TRef, erlang:timestamp()); -extract_start_time(_, _, _) -> - false. - -%%------------------------------------------------------------ -%% function : extract_deadline -%% Arguments: Structured Event -%% Default Timeout Value - TimeT or UtcT (see cosTime). -%% StopTSupported - boolean(). -%% TRef - reference to TimeService -%% Mapping Filter Value -%% - false eq. value not needed (depends on QoS type) -%% - undefined eq. value needed but no filter associated. -%% Now - used when we want to reuse old TimeStamp which -%% must be done when changing QoS. -%% Returns : A modified return from erlang:timestamp(). -%%------------------------------------------------------------ -extract_deadline(_, _, _, _, false) -> - false; -extract_deadline(Event, DefaultT, StopTSupported, TRef, MappingVal) -> - extract_deadline(Event, DefaultT, StopTSupported, TRef, MappingVal, erlang:timestamp()). - -extract_deadline(_, _, _, _, false, _) -> - false; -extract_deadline(#'CosNotification_StructuredEvent' - {header = #'CosNotification_EventHeader' - {variable_header = VH}}, DefaultT, StopTSupported, - TRef, undefined, Now) -> - DL = case extract_value(VH, ?not_Timeout, undefined) of - undefined when StopTSupported == true, TRef =/= undefined -> - case extract_value(VH, ?not_StopTime, undefined) of - undefined -> - DefaultT; - DefinedTime -> - DefinedTime - end; - undefined -> - DefaultT; - DefinedTime -> - DefinedTime - end, - convert_time(DL, TRef, Now); -%% Maybe a unstructured event. -extract_deadline(_, Time, _, TRef, undefined, Now) -> - convert_time(Time, TRef, Now); -extract_deadline(_, _, _, TRef, DOverride, Now) -> - %% Must have an associated MappingFilter defining a Deadline. - convert_time(DOverride, TRef, Now). - -convert_time(0, _, _) -> - false; -convert_time(UTC, TRef, {M,S,U}) when is_record(UTC, 'TimeBase_UtcT') -> - case catch get_time_diff(UTC, TRef) of - {'EXCEPTION', _} -> - false; - {'EXIT', _} -> - false; - DL -> - MicroSecs = round(DL/10), - Secs = round(MicroSecs/1000000), - MegaSecs = round(Secs/1000000), - {-M-MegaSecs, -S-Secs+MegaSecs, -U-MicroSecs+Secs} - end; -convert_time(DL, _, {M,S,U}) when is_integer(DL) -> - MicroSecs = round(DL/10), - Secs = round(MicroSecs/1000000), - MegaSecs = round(Secs/1000000), - {-M-MegaSecs, -S-Secs+MegaSecs, -U-MicroSecs+Secs}; -convert_time(_, _, _) -> - false. - - -get_time_diff(UTC, TRef) -> - UTO = 'CosTime_TimeService':universal_time(TRef), - UTO2 = 'CosTime_TimeService':uto_from_utc(TRef, UTC), - TIO = 'CosTime_UTO':time_to_interval(UTO, UTO2), - #'TimeBase_IntervalT'{lower_bound=LB, upper_bound = UB} = - 'CosTime_TIO':'_get_time_interval'(TIO), - UB-LB. - -check_deadline(DL) when is_tuple(DL) -> - {M,S,U} = erlang:timestamp(), - DL >= {-M,-S,-U}; -check_deadline(_DL) -> - %% This case will cover if no timeout is set. - false. - -check_start_time(ST) when is_tuple(ST) -> - {M,S,U} = erlang:timestamp(), - ST >= {-M,-S,-U}; -check_start_time(_ST) -> - %% This case will cover if no earliest delivery time is set. - true. - -%%------------------------------------------------------------ -%% function : extract_value -%% Arguments: A Property Sequence -%% ID - wanted property string() -%% Other - default-value. -%% Returns : Value associated with given ID or default value. -%%------------------------------------------------------------ -extract_value([], _, Other) -> - Other; -extract_value([#'CosNotification_Property'{name=ID, value=V}|_], ID, _) -> - any:get_value(V); -extract_value([_H|T], ID, Other) -> - extract_value(T, ID, Other). - -%%------------------------------------------------------------ -%% function : get_event -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -get_event(DBRef) -> - get_event(DBRef, true). -get_event(DBRef, Delete) -> - case get_events(DBRef, 1, Delete) of - {[], false} -> - {[], false}; - {[], false, Keys} -> - {[], false, Keys}; - {[Event], Bool} -> - {Event, Bool}; - {[Event], Bool, Keys} -> - {Event, Bool, Keys} - end. - -%%------------------------------------------------------------ -%% function : get_events -%% Arguments: -%% Returns : A list of events (possibly empty) and a boolean -%% indicating if event found. -%% Comments : Try to extract Max events from the database. -%%------------------------------------------------------------ -get_events(#dbRef{orderRef = ORef, discardRef = DRef}, Max) -> - event_loop(ets:last(ORef), ORef, DRef, Max, [], [], true). - -get_events(#dbRef{orderRef = ORef, discardRef = DRef}, Max, Delete) -> - event_loop(ets:last(ORef), ORef, DRef, Max, [], [], Delete). - -event_loop('$end_of_table', _, _, _, [], _, true) -> - {[], false}; -event_loop('$end_of_table', _, _, _, [], [], _) -> - {[], false, []}; -event_loop('$end_of_table', _ORef, _, _, Accum, _Keys, true) -> - {lists:reverse(Accum), true}; -event_loop('$end_of_table', _ORef, _, _, Accum, Keys, _) -> - {lists:reverse(Accum), true, Keys}; -event_loop(_, _ORef, _, 0, [], _Keys, true) -> - %% Only possible if some tries to pull a sequence of 0 events. - %% Should we really test for this case? - {[], false}; -event_loop(_, _ORef, _, 0, [], Keys, _) -> - {[], false, Keys}; -event_loop(_, _ORef, _, 0, Accum, _Keys, true) -> - {lists:reverse(Accum), true}; -event_loop(_, _ORef, _, 0, Accum, Keys, _) -> - {lists:reverse(Accum), true, Keys}; -event_loop(Key, ORef, undefined, Left, Accum, Keys, Delete) -> - [{_,DL,ST,_PO,Event}]=ets:lookup(ORef, Key), - case check_deadline(DL) of - true -> - ets:delete(ORef, Key), - event_loop(ets:prev(ORef, Key), ORef, undefined, - Left, Accum, Keys, Delete); - false -> - case check_start_time(ST) of - true when Delete == true -> - ets:delete(ORef, Key), - event_loop(ets:prev(ORef, Key), ORef, undefined, - Left-1, [Event|Accum], Keys, Delete); - true -> - event_loop(ets:prev(ORef, Key), ORef, undefined, - Left-1, [Event|Accum], [{ORef, Key}|Keys], Delete); - false -> - event_loop(ets:prev(ORef, Key), ORef, undefined, - Left, Accum, Keys, Delete) - end - end; -event_loop({Key1, Key2}, ORef, DRef, Left, Accum, Keys, Delete) -> - [{_,DL,ST,_PO,Event}]=ets:lookup(ORef, {Key1, Key2}), - case check_deadline(DL) of - true -> - ets:delete(ORef, {Key1, Key2}), - ets:delete(DRef, {Key2, Key1}), - event_loop(ets:prev(ORef, {Key1, Key2}), ORef, DRef, - Left, Accum, Keys, Delete); - false -> - case check_start_time(ST) of - true when Delete == true -> - ets:delete(ORef, {Key1, Key2}), - ets:delete(DRef, {Key2, Key1}), - event_loop(ets:prev(ORef, {Key1, Key2}), ORef, DRef, - Left-1, [Event|Accum], Keys, Delete); - true -> - event_loop(ets:prev(ORef, {Key1, Key2}), ORef, DRef, - Left-1, [Event|Accum], - [{ORef, {Key1, Key2}}, {DRef, {Key2, Key1}}|Keys], - Delete); - false -> - event_loop(ets:prev(ORef, {Key1, Key2}), ORef, DRef, - Left, Accum, Keys, Delete) - end - end; -event_loop({Key1, Key2, Key3}, ORef, DRef, Left, Accum, Keys, Delete) -> - [{_,DL,ST,_PO,Event}]=ets:lookup(ORef, {Key1, Key2, Key3}), - case check_deadline(DL) of - true -> - ets:delete(ORef, {Key1, Key2, Key3}), - ets:delete(DRef, {Key3, Key2, Key1}), - event_loop(ets:prev(ORef, {Key1, Key2, Key3}), ORef, DRef, - Left, Accum, Keys, Delete); - false -> - case check_start_time(ST) of - true when Delete == true -> - ets:delete(ORef, {Key1, Key2, Key3}), - ets:delete(DRef, {Key3, Key2, Key1}), - event_loop(ets:prev(ORef, {Key1, Key2, Key3}), ORef, DRef, - Left-1, [Event|Accum], Keys, Delete); - true -> - event_loop(ets:prev(ORef, {Key1, Key2, Key3}), ORef, DRef, - Left-1, [Event|Accum], - [{ORef, {Key1, Key2, Key3}}, - {DRef, {Key3, Key2, Key1}}|Keys], Delete); - false -> - event_loop(ets:prev(ORef, {Key1, Key2, Key3}), ORef, DRef, - Left, Accum, Keys, Delete) - end - end. - -%%------------------------------------------------------------ -%% function : delete_events -%% Arguments: EventList - what's returned by get_event, get_events -%% and add_and_get_event. -%% Returns : -%% Comment : Shall be invoked when it's safe to premanently remove -%% the events found in the EventList. -%% -%%------------------------------------------------------------ -delete_events([]) -> - ok; -delete_events([{DB, Key}|T]) -> - ets:delete(DB, Key), - delete_events(T). - -%%------------------------------------------------------------ -%% function : update -%% Arguments: -%% Returns : -%% Comment : As default we shall deliver Events in Priority order. -%% Hence, if AnyOrder set we will still deliver in -%% Priority order. -%%------------------------------------------------------------ -update(undefined, _QoS) -> - ok; -update(DBRef, QoS) -> - update(DBRef, QoS, undefined, undefined). - -update(DBRef, QoS, LifeFilter, PrioFilter) -> - case updated_order(DBRef, ?not_GetOrderPolicy(QoS)) of - false -> - case updated_discard(DBRef, ?not_GetDiscardPolicy(QoS)) of - false -> - DBR2 = ?set_DefPriority(DBRef, ?not_GetPriority(QoS)), - DBR3 = ?set_MaxEvents(DBR2, ?not_GetMaxEventsPerConsumer(QoS)), - DBR4 = ?set_DefStopT(DBR3, ?not_GetTimeout(QoS)), - DBR5 = ?set_StartTsupport(DBR4, ?not_GetStartTimeSupported(QoS)), - DBR6 = ?set_StopTsupport(DBR5, ?not_GetStopTimeSupported(QoS)), - case ets:info(?get_OrderRef(DBR6), size) of - N when N =< ?get_MaxEvents(DBR6) -> - %% Even if the QoS MaxEvents have been changed - %% we don't reach the limit. - DBR6; - N -> - %% The QoS MaxEvents must have been decreased. - discard_events(DBR6, N-?get_MaxEvents(DBR6)), - DBR6 - end; - true -> - destroy_discard_db(DBRef), - NewDBRef = create_db(QoS, ?get_GCTime(DBRef), ?get_GCLimit(DBRef), - ?get_TimeRef(DBRef)), - move_events(DBRef, NewDBRef, ets:first(?get_OrderRef(DBRef)), - LifeFilter, PrioFilter) - end; - true -> - destroy_discard_db(DBRef), - NewDBRef = create_db(QoS, ?get_GCTime(DBRef), ?get_GCLimit(DBRef), - ?get_TimeRef(DBRef)), - move_events(DBRef, NewDBRef, ets:first(?get_OrderRef(DBRef)), - LifeFilter, PrioFilter) - end. - -updated_order(#dbRef{orderPolicy = Equal}, Equal) -> false; -updated_order(#dbRef{orderPolicy = ?not_PriorityOrder}, ?not_AnyOrder) -> false; -updated_order(#dbRef{orderPolicy = ?not_AnyOrder}, ?not_PriorityOrder) -> false; -updated_order(_, _) -> true. - -updated_discard(#dbRef{discardPolicy = Equal}, Equal) -> false; -updated_discard(#dbRef{discardPolicy = ?not_RejectNewEvents}, ?not_AnyOrder) -> false; -updated_discard(#dbRef{discardPolicy = ?not_AnyOrder}, ?not_RejectNewEvents) -> false; -updated_discard(_, _) -> true. - -move_events(DBRef, NewDBRef, '$end_of_table', _, _) -> - destroy_order_db(DBRef), - case ets:info(?get_OrderRef(NewDBRef), size) of - N when N =< ?get_MaxEvents(NewDBRef) -> - %% Even if the QoS MaxEvents have been changed - %% we don't reach the limit. - NewDBRef; - N -> - %% The QoS MaxEvents must have been decreased. - discard_events(DBRef, N-?get_MaxEvents(NewDBRef)), - NewDBRef - end; -move_events(DBRef, NewDBRef, Key, LifeFilter, PrioFilter) -> - [{Keys, DeadLine, StartTime, PriorityOverride, Event}] = - ets:lookup(?get_OrderRef(DBRef), Key), - case check_deadline(DeadLine) of - true -> - ok; - _-> - write_event(?get_OrderP(DBRef), - {Keys, DeadLine, StartTime, PriorityOverride, Event}, - DBRef, NewDBRef, Key, LifeFilter, PrioFilter) - end, - ets:delete(?get_OrderRef(DBRef), Key), - move_events(DBRef, NewDBRef, ets:next(?get_OrderRef(DBRef), Key), - LifeFilter, PrioFilter). - -%% We cannot use do_add_event directly since we MUST lookup the timestamp (TS). -write_event(?not_DeadlineOrder, {{_, TS, _Prio}, DL, ST, PO, Event}, _DBRef, NewDBRef, - _Key, _LifeFilter, _PrioFilter) -> - StartT = update_starttime(NewDBRef, Event, ST), - %% Deadline and Priority previously extracted. - do_add_event(NewDBRef, Event, TS, DL, StartT, PO); -write_event(?not_DeadlineOrder, {{_, TS}, DL, _ST, PO, Event}, _DBRef, NewDBRef, - _Key, _LifeFilter, PrioFilter) -> - %% Priority not previously extracted. - POverride = update_priority(NewDBRef, PrioFilter, Event, PO), - StartT = extract_start_time(Event, ?get_StartTsupport(NewDBRef), - ?get_TimeRef(NewDBRef)), - do_add_event(NewDBRef, Event, TS, DL, StartT, POverride); -write_event(?not_FifoOrder, {{TS, _PorD}, DL, ST, PO, Event}, _DBRef, NewDBRef, - _Key, LifeFilter, PrioFilter) -> - %% Priority or Deadline have been extracted before but we cannot tell which. - POverride = update_priority(NewDBRef, PrioFilter, Event, PO), - DeadL = update_deadline(NewDBRef, LifeFilter, Event, TS, DL), - StartT = update_starttime(NewDBRef, Event, ST), - do_add_event(NewDBRef, Event, TS, DeadL, StartT, POverride); -write_event(?not_FifoOrder, {TS, DL, ST, PO, Event}, _DBRef, NewDBRef, - _Key, LifeFilter, PrioFilter) -> - %% Priority and Deadline not extracetd before. Do it now. - POverride = update_priority(NewDBRef, PrioFilter, Event, PO), - DeadL = update_deadline(NewDBRef, LifeFilter, Event, TS, DL), - StartT = update_starttime(NewDBRef, Event, ST), - do_add_event(NewDBRef, Event, TS, DeadL, StartT, POverride); -%% Order Policy must be AnyOrder or PriorityOrder. -write_event(_, {{_Prio, TS}, DL, ST, PO, Event}, _DBRef, NewDBRef, - _Key, LifeFilter, _PrioFilter) -> - DeadL = update_deadline(NewDBRef, LifeFilter, Event, TS, DL), - StartT = update_starttime(NewDBRef, Event, ST), - do_add_event(NewDBRef, Event, TS, DeadL, StartT, PO); -write_event(_, {{_Prio, TS, DL}, DL, ST, PO, Event}, _DBRef, NewDBRef, _Key, _, _) -> - %% Both Deadline and Priority have been extracetd before. - StartT = update_starttime(NewDBRef, Event, ST), - do_add_event(NewDBRef, Event, TS, DL, StartT, PO). - - -%%------------------------------------------------------------ -%% function : update_priority -%% Arguments: -%% Returns : -%% Comment : The purpose with this function is to avoid -%% calling MappingFilter priority again, especially -%% deadline again (we especially want to avoid calling -%% since it may require intra-ORB communication. -%% Use only when doing an update. -%%------------------------------------------------------------ -update_priority(DBRef, PrioFilter, Event, OldPrio) when is_atom(OldPrio) -> - get_prio_mapping_value(DBRef, PrioFilter, Event); -update_priority(_DBRef, _PrioFilter, _Event, OldPrio) -> - OldPrio. - -%%------------------------------------------------------------ -%% function : update_deadline -%% Arguments: -%% Returns : -%% Comment : The purpose with this function is to avoid -%% calling MappingFilter or parsing the events for -%% deadline again (we especially want to avoid calling -%% the MappingFilter since it may require intra-ORB -%% communication. Use only when doing an update. -%%------------------------------------------------------------ -update_deadline(DBRef, _LifeFilter, _Event, _TS, _OldDeadL) when - ?get_DiscardP(DBRef) =/= ?not_DeadlineOrder, - ?get_OrderP(DBRef) =/= ?not_DeadlineOrder, - ?is_StopTNotSupported(DBRef) -> - %% We do not need to extract the Deadline since it will not be used. - false; -update_deadline(DBRef, LifeFilter, Event, TS, OldDeadL) when is_atom(OldDeadL) -> - %% We need the Deadline and it have not been extracetd before. - DOverride = get_life_mapping_value(DBRef, LifeFilter, Event), - %% We must find out when the event was delivered; setting a deadline using - %% a new timestamp would not be accurate since we cannot tell for how long - %% the event have been waiting. - OldNow = convert_FIFO_Key(TS), - extract_deadline(Event, ?get_DefStopT(DBRef), ?get_StopTsupport(DBRef), - ?get_TimeRef(DBRef), DOverride, OldNow); -update_deadline(_DBRef, _LifeFilter, _Event, _TS, OldDeadL) -> - %% We need the Deadline and it have been extracetd before. - OldDeadL. - -%%------------------------------------------------------------ -%% function : update_starttime -%% Arguments: -%% Returns : -%% Comment : The purpose with this function is to avoid -%% parsing the events for starttime again. -%% Use only when doing an update. -%%------------------------------------------------------------ -update_starttime(DBRef, Event, OldStartT) when is_atom(OldStartT) -> - %% Probably not previously extracted; try to get it. - extract_start_time(Event, ?get_StartTsupport(DBRef), ?get_TimeRef(DBRef)); -update_starttime(_DBRef, _Event, OldStartT) -> - %% Previously extracted. - OldStartT. - -%%------------------------------------------------------------ -%% function : discard_events -%% Arguments: DBRef -%% N - number of events we must discard. -%% Returns : -%% Comment : As default we shall Reject New Events when the limit -%% is reached. Any discard order will do the same. -%% -%% This function can only be used for the discard policies -%% Fifo, Priority and Deadline. Any or RejectNewEvents -%% will not allow events to be stored at all, i.e., no events -%% to discard. Lifo will not be stored either since when -%% trying to add an event it is definitely the last event in. -%%------------------------------------------------------------ -%% Since no Discard DB must the same Order policy. -discard_events(#dbRef{orderRef = ORef, discardRef = undefined, - discardPolicy = ?not_DeadlineOrder}, N) -> - ?debug_print("Discarding ~p events Deadline Order.",[N]), - index_loop_backward(ets:last(ORef), undefined, ORef, N); -discard_events(#dbRef{orderRef = ORef, discardRef = DRef, - discardPolicy = ?not_DeadlineOrder}, N) -> - ?debug_print("Discarding ~p events Deadline Order.",[N]), - index_loop_backward(ets:last(DRef), DRef, ORef, N); -%% Fifo. -discard_events(#dbRef{orderRef = ORef, discardRef = undefined, - discardPolicy = ?not_FifoOrder}, N) -> - ?debug_print("Discarding ~p events Fifo Order.",[N]), - index_loop_backward(ets:last(ORef), undefined, ORef, N); -discard_events(#dbRef{orderRef = ORef, discardRef = DRef, - discardPolicy = ?not_FifoOrder}, N) -> - ?debug_print("Discarding ~p events Fifo Order.",[N]), - index_loop_backward(ets:last(DRef), DRef, ORef, N); -%% Lifo- or Priority-Order -discard_events(#dbRef{orderRef = ORef, discardRef = undefined}, N) -> - ?debug_print("Discarding ~p events Lifo- or Priority-Order.",[N]), - index_loop_forward(ets:first(ORef), undefined, ORef, N); -discard_events(#dbRef{orderRef = ORef, discardRef = DRef}, N) -> - ?debug_print("Discarding ~p events Lifo- or Priority-Order.",[N]), - index_loop_forward(ets:first(DRef), DRef, ORef, N). - - -index_loop_forward('$end_of_table', _, _, _Left) -> - ok; -index_loop_forward(_, _, _, 0) -> - ok; -index_loop_forward(Key, undefined, ORef, Left) -> - ets:delete(ORef, Key), - NewKey=ets:next(ORef, Key), - index_loop_forward(NewKey, undefined, ORef, Left-1); - -index_loop_forward({Key1, Key2, Key3}, DRef, ORef, Left) -> - ets:delete(DRef, {Key1, Key2, Key3}), - ets:delete(ORef, {Key3, Key2, Key1}), - NewKey=ets:next(DRef, {Key1, Key2, Key3}), - index_loop_forward(NewKey, DRef, ORef, Left-1); - -index_loop_forward({Key1, Key2}, DRef, ORef, Left) -> - ets:delete(DRef, {Key1, Key2}), - ets:delete(ORef, {Key2, Key1}), - NewKey=ets:next(DRef, {Key1, Key2}), - index_loop_forward(NewKey, DRef, ORef, Left-1). - -index_loop_backward('$end_of_table', _, _, _) -> - ok; -index_loop_backward(_, _, _, 0) -> - ok; -index_loop_backward(Key, undefined, ORef, Left) -> - ets:delete(ORef, Key), - NewKey=ets:prev(ORef, Key), - index_loop_backward(NewKey, undefined, ORef, Left-1); -index_loop_backward({Key1, Key2}, DRef, ORef, Left) -> - ets:delete(DRef, {Key1, Key2}), - ets:delete(ORef, {Key2, Key1}), - NewKey=ets:prev(DRef, {Key1, Key2}), - index_loop_backward(NewKey, DRef, ORef, Left-1); -index_loop_backward({Key1, Key2, Key3}, DRef, ORef, Left) -> - ets:delete(DRef, {Key1, Key2, Key3}), - ets:delete(ORef, {Key3, Key2, Key1}), - NewKey=ets:prev(DRef, {Key1, Key2, Key3}), - index_loop_backward(NewKey, DRef, ORef, Left-1). - -%%------------------------------------------------------------ -%% function : add_and_get_event -%% Arguments: DBRef and Event -%% Returns : {[], bool()} | {Event, bool()} -%% Comment : This function is a mixture of ad anf get events. -%% The intended use to avoid storing an event when -%% not necessary. -%%------------------------------------------------------------ -add_and_get_event(DBRef, Event) -> - add_and_get_event(DBRef, Event, undefined, undefined, true). - -add_and_get_event(DBRef, Event, Delete) -> - add_and_get_event(DBRef, Event, undefined, undefined, Delete). - -add_and_get_event(DBRef, Event, LifeFilter, PrioFilter) -> - add_and_get_event(DBRef, Event, LifeFilter, PrioFilter, true). - -add_and_get_event(DBRef, Event, LifeFilter, PrioFilter, Delete) -> - case ets:info(?get_OrderRef(DBRef), size) of - 0 when ?is_StartTNotSupported(DBRef), ?is_StopTNotSupported(DBRef), - Delete == true -> - %% No stored events and no timeouts used; just return the event. - {Event, false}; - 0 when ?is_StartTNotSupported(DBRef), ?is_StopTNotSupported(DBRef) -> - %% No stored events and no timeouts used; just return the event. - {Event, false, []}; - 0 when ?is_StartTNotSupported(DBRef) -> - %% Only deadline supported, lookup values and cehck if ok. - DOverride = get_life_mapping_value(DBRef, LifeFilter, Event), - DL = extract_deadline(Event, ?get_DefStopT(DBRef), - ?get_StopTsupport(DBRef), ?get_TimeRef(DBRef), - DOverride), - case check_deadline(DL) of - true when Delete == true -> - %% Expired, just discard the event. - {[], false}; - true -> - {[], false, []}; - _ when Delete == true -> - %% Not expired, we can safely return the event. - {Event, false}; - _ -> - %% Not expired, we can safely return the event. - {Event, false, []} - end; - 0 when ?is_StopTNotSupported(DBRef) -> - %% Only starttime allowed, test if we can deliver the event now. - ST = extract_start_time(Event, ?get_StartTsupport(DBRef), - ?get_TimeRef(DBRef)), - case check_start_time(ST) of - false when Delete == true -> - DOverride = get_life_mapping_value(DBRef, LifeFilter, Event), - POverride = get_prio_mapping_value(DBRef, PrioFilter, Event), - DL = extract_deadline(Event, ?get_DefStopT(DBRef), - ?get_StopTsupport(DBRef), - ?get_TimeRef(DBRef), DOverride), - do_add_event(DBRef, Event, create_FIFO_Key(), DL, ST, POverride), - {[], true}; - false -> - DOverride = get_life_mapping_value(DBRef, LifeFilter, Event), - POverride = get_prio_mapping_value(DBRef, PrioFilter, Event), - DL = extract_deadline(Event, ?get_DefStopT(DBRef), - ?get_StopTsupport(DBRef), - ?get_TimeRef(DBRef), DOverride), - do_add_event(DBRef, Event, create_FIFO_Key(), DL, ST, POverride), - {[], true, []}; - _ when Delete == true -> - %% Starttime ok, just return the event. - {Event, false}; - _ -> - %% Starttime ok, just return the event. - {Event, false, []} - end; - _-> - %% Event already stored, just have to accept the overhead. - ST = extract_start_time(Event, ?get_StartTsupport(DBRef), - ?get_TimeRef(DBRef)), - DOverride = get_life_mapping_value(DBRef, LifeFilter, Event), - POverride = get_prio_mapping_value(DBRef, PrioFilter, Event), - DL = extract_deadline(Event, ?get_DefStopT(DBRef), - ?get_StopTsupport(DBRef), - ?get_TimeRef(DBRef), DOverride), - do_add_event(DBRef, Event, create_FIFO_Key(), DL, ST, POverride), - get_event(DBRef, Delete) - end. - -%%------------------------------------------------------------ -%% function : add_event -%% Arguments: DBRef and Event -%% Returns : true (or whatever 'ets:insert' returns) | -%% {'EXCEPTION', #'IMP_LIMIT'{}} -%% Comment : As default we shall deliver Events in Priority order. -%% Hence, if AnyOrder set we will still deliver in -%% Priority order. But we cannot use only the Priority -%% value since if "all" events have the same priority -%% there is a risk that some never will be delivered if -%% the EventDB always contain events. -%% -%% When discard and order policy is equal we only use one -%% DB since all we have to do is to "read from the other -%% end" to discard the correct event(s). -%% -%% In the discard DB we must also store keys necessary to -%% lookup the event in the order DB. -%% -%% If event limit reached 'IMPL_LIMIT' is raised if -%% the discard policy is RejectNewEvents or AnyOrder. -%% Theses two policies we currently define to be equal. -%%------------------------------------------------------------ - -add_event(DBRef, Event) -> - %% Save overhead by first checking if we really need to extract - %% Deadline and/or Priority. - Deadline = get_life_mapping_value(DBRef, undefined, Event), - Priority = get_prio_mapping_value(DBRef, undefined, Event), - add_event_helper(DBRef, Event, Deadline, Priority). - -add_event(DBRef, Event, LifeFilter, PrioFilter) -> - %% Save overhead by first checking if we really need to extract - %% Deadline and/or Priority. - Deadline = get_life_mapping_value(DBRef, LifeFilter, Event), - Priority = get_prio_mapping_value(DBRef, PrioFilter, Event), - add_event_helper(DBRef, Event, Deadline, Priority). - -add_event_helper(DBRef, Event, DOverride, POverride) -> - case ets:info(?get_OrderRef(DBRef), size) of - N when N < ?get_MaxEvents(DBRef), N > ?get_GCLimit(DBRef) -> - gc_events(DBRef, low), - DL = extract_deadline(Event, ?get_DefStopT(DBRef), - ?get_StopTsupport(DBRef), ?get_TimeRef(DBRef), - DOverride), - case check_deadline(DL) of - true -> - true; - _ -> - ST = extract_start_time(Event, ?get_StartTsupport(DBRef), - ?get_TimeRef(DBRef)), - do_add_event(DBRef, Event, create_FIFO_Key(), DL, ST, POverride) - end; - N when N < ?get_MaxEvents(DBRef) -> - DL = extract_deadline(Event, ?get_DefStopT(DBRef), - ?get_StopTsupport(DBRef), ?get_TimeRef(DBRef), - DOverride), - case check_deadline(DL) of - true -> - true; - _ -> - ST = extract_start_time(Event, ?get_StartTsupport(DBRef), - ?get_TimeRef(DBRef)), - do_add_event(DBRef, Event, create_FIFO_Key(), DL, ST, POverride) - end; - _N when ?get_DiscardP(DBRef) == ?not_RejectNewEvents -> - gc_events(DBRef, low), - corba:raise(#'IMP_LIMIT'{completion_status=?COMPLETED_NO}); - _N when ?get_DiscardP(DBRef) == ?not_AnyOrder -> - gc_events(DBRef, low), - corba:raise(#'IMP_LIMIT'{completion_status=?COMPLETED_NO}); - _N when ?get_DiscardP(DBRef) == ?not_LifoOrder -> - gc_events(DBRef, low), - corba:raise(#'IMP_LIMIT'{completion_status=?COMPLETED_NO}); - _N -> - gc_events(DBRef, low), - %% Other discard policy; we must first store the event - %% and the look up in the Discard DB which event we - %% should remove. - DL = extract_deadline(Event, ?get_DefStopT(DBRef), - ?get_StopTsupport(DBRef), ?get_TimeRef(DBRef), - DOverride), - case check_deadline(DL) of - true -> - true; - _ -> - ST = extract_start_time(Event, ?get_StartTsupport(DBRef), - ?get_TimeRef(DBRef)), - do_add_event(DBRef, Event, create_FIFO_Key(), DL, ST, POverride), - discard_events(DBRef, 1) - end - end. - - -do_add_event(#dbRef{orderRef = ORef, orderPolicy = ?not_DeadlineOrder, - discardRef = DRef, discardPolicy = ?not_PriorityOrder, - defPriority = DefPrio, defStopT = _DefStopT}, Event, Key, DL, ST, PO) -> - Prio = extract_priority(Event, DefPrio, PO), - ets:insert(ORef, {{DL, Key, Prio}, DL, ST, PO, Event}), - ets:insert(DRef, {{Prio, Key, DL}}); -do_add_event(#dbRef{orderRef = ORef, orderPolicy = ?not_DeadlineOrder, - discardRef = DRef, discardPolicy = ?not_FifoOrder, - defStopT = _DefStopT}, Event, Key, DL, ST, PO) -> - ets:insert(ORef, {{DL, Key}, DL, ST, PO, Event}), - ets:insert(DRef, {{Key, DL}}); -do_add_event(#dbRef{orderRef = ORef, orderPolicy = ?not_DeadlineOrder, - discardRef = DRef, discardPolicy = ?not_LifoOrder, - defStopT = _DefStopT}, Event, Key, DL, ST, PO) -> - ets:insert(ORef, {{DL, Key}, DL, ST, PO, Event}), - ets:insert(DRef, {{Key, DL}}); -%% Either the same (DeadlineOrder), RejectNewEvents or AnyOrder. No need -%% to store anything in the discard policy, i.e., if the same we'll just -%% read "from the other end" and AnyOrder and RejectNewEvents is equal. -do_add_event(#dbRef{orderRef = ORef, orderPolicy = ?not_DeadlineOrder, - defStopT = _DefStopT}, Event, Key, DL, ST, PO) -> - ets:insert(ORef, {{DL, Key}, DL, ST, PO, Event}); - - -do_add_event(#dbRef{orderRef = ORef, orderPolicy = ?not_FifoOrder, - discardRef = DRef, discardPolicy = ?not_DeadlineOrder, - defStopT = _DefStopT}, Event, Key, DL, ST, PO) -> - ets:insert(ORef, {{Key, DL}, DL, ST, PO, Event}), - ets:insert(DRef, {{DL, Key}}); -do_add_event(#dbRef{orderRef = ORef, orderPolicy = ?not_FifoOrder, - discardRef = DRef, discardPolicy = ?not_PriorityOrder, - defPriority = DefPrio}, Event, Key, DL, ST, PO) -> - Prio = extract_priority(Event, DefPrio, PO), - ets:insert(ORef, {{Key, Prio}, DL, ST, PO, Event}), - ets:insert(DRef, {{Prio, Key}}); -%% The discard policy must RejectNewEvents, AnyOrder, Fifo or Lifo order. -do_add_event(#dbRef{orderRef = ORef, orderPolicy = ?not_FifoOrder, - discardRef = _DRef}, Event, Key, DL, ST, PO) -> - ets:insert(ORef, {Key, DL, ST, PO, Event}); - -%% Order Policy must be AnyOrder or PriorityOrder. -do_add_event(#dbRef{orderRef = ORef, - discardRef = DRef, discardPolicy = ?not_DeadlineOrder, - defPriority = DefPrio, defStopT = _DefStopT}, Event, Key, DL, ST, PO) -> - Prio = extract_priority(Event, DefPrio, PO), - ets:insert(ORef, {{Prio, Key, DL}, DL, ST, PO, Event}), - ets:insert(DRef, {{DL, Key, Prio}}); -do_add_event(#dbRef{orderRef = ORef, - discardRef = DRef, discardPolicy = ?not_FifoOrder, - defPriority = DefPrio}, Event, Key, DL, ST, PO) -> - Prio = extract_priority(Event, DefPrio, PO), - ets:insert(ORef, {{Prio, Key}, DL, ST, PO, Event}), - ets:insert(DRef, {{Key, Prio}}); - -do_add_event(#dbRef{orderRef = ORef, - discardRef = DRef, discardPolicy = ?not_LifoOrder, - defPriority = DefPrio}, Event, Key, DL, ST, PO) -> - Prio = extract_priority(Event, DefPrio, PO), - ets:insert(ORef, {{Prio, Key}, DL, ST, PO, Event}), - ets:insert(DRef, {{Key, Prio}}); - -%% Order Policy must be AnyOrder or PriorityOrder and Discard Policy must be -%% AnyOrder or RejectNewEvents -do_add_event(#dbRef{orderRef = ORef, defPriority = DefPrio}, Event, Key, DL, ST, PO) -> - Prio = extract_priority(Event, DefPrio, PO), - ets:insert(ORef, {{Prio, Key}, DL, ST, PO, Event}). - -%%------------------------------------------------------------ -%% function : destroy_db -%% Arguments: A DB reference -%% Returns : -%%------------------------------------------------------------ -destroy_db(#dbRef{orderRef = ORef, discardRef = undefined}) -> - ets:delete(ORef); -destroy_db(#dbRef{orderRef = ORef, discardRef = DRef}) -> - ets:delete(ORef), - ets:delete(DRef). - -%%------------------------------------------------------------ -%% function : destroy_discard_db -%% Arguments: A DB reference -%% Returns : -%%------------------------------------------------------------ -destroy_discard_db(#dbRef{discardRef = undefined}) -> - ok; -destroy_discard_db(#dbRef{discardRef = DRef}) -> - ets:delete(DRef). - -%%------------------------------------------------------------ -%% function : destroy_order_db -%% Arguments: A DB reference -%% Returns : -%%------------------------------------------------------------ -destroy_order_db(#dbRef{orderRef = ORef}) -> - ets:delete(ORef). - -%%------------------------------------------------------------ -%% function : create_db -%% Arguments: QoS (local representation). -%% Returns : A DB reference -%%------------------------------------------------------------ -create_db(QoS, GCTime, GCLimit, TimeRef) -> - DiscardRef = - case {?not_GetDiscardPolicy(QoS), ?not_GetOrderPolicy(QoS)} of - {Equal, Equal} -> - undefined; - {?not_PriorityOrder, ?not_AnyOrder} -> - %% NOTE: Any- and Priority-Order delivery policy is equal. - undefined; - {?not_RejectNewEvents, _} -> - undefined; - {?not_AnyOrder, _} -> - undefined; - {?not_LifoOrder, ?not_FifoOrder} -> - undefined; - _ -> - ets:new(oe_ets, [set, public, ordered_set]) - end, - DBRef = ?CreateRef(ets:new(oe_ets, [set, public, ordered_set]), - DiscardRef, - ?not_GetOrderPolicy(QoS), ?not_GetDiscardPolicy(QoS), - ?not_GetPriority(QoS), ?not_GetMaxEventsPerConsumer(QoS), - ?not_GetTimeout(QoS), ?not_GetStartTimeSupported(QoS), - ?not_GetStopTimeSupported(QoS), GCTime, GCLimit, TimeRef), - if - ?is_TimeoutNotUsed(DBRef), ?is_StopTNotSupported(DBRef) -> - ok; - true -> - TS = erlang:monotonic_time(), - {resolution, TR} = lists:keyfind(resolution, 1, - erlang:system_info(os_monotonic_time_source)), - put(oe_GC_timestamp, TS+GCTime*TR) - end, - DBRef. - -%%------------------------------------------------------------ -%% function : get_prio_mapping_value -%% Arguments: A MappingFilter reference | undefined -%% Event (Any or Structured) -%% Returns : undefined | Data -%%------------------------------------------------------------ -get_prio_mapping_value(DBRef, _, _) when ?get_DiscardP(DBRef) =/= ?not_PriorityOrder, - ?get_OrderP(DBRef) =/= ?not_AnyOrder, - ?get_OrderP(DBRef) =/= ?not_PriorityOrder -> - false; -get_prio_mapping_value(_, undefined, _) -> - undefined; -get_prio_mapping_value(_, MFilter, Event) when is_record(Event, 'any') -> - case catch 'CosNotifyFilter_MappingFilter':match(MFilter, Event) of - {false, DefVal} when is_record(DefVal, 'any') -> - any:get_value(DefVal); - {true, Matched} when is_record(Matched, 'any') -> - any:get_value(Matched); - _ -> - undefined - end; -get_prio_mapping_value(_, MFilter, Event) -> - case catch 'CosNotifyFilter_MappingFilter':match_structured(MFilter, Event) of - {false, DefVal} when is_record(DefVal, 'any') -> - any:get_value(DefVal); - {true, Matched} when is_record(Matched, 'any') -> - any:get_value(Matched); - _ -> - undefined - end. - -%%------------------------------------------------------------ -%% function : get_life_mapping_value -%% Arguments: A MappingFilter reference | undefined -%% Event (Any or Structured) -%% Returns : undefined | Data -%%------------------------------------------------------------ -get_life_mapping_value(DBRef, _, _) when ?get_DiscardP(DBRef) =/= ?not_DeadlineOrder, - ?get_OrderP(DBRef) =/= ?not_DeadlineOrder, - ?is_StopTNotSupported(DBRef) -> - false; -get_life_mapping_value(_, undefined, _) -> - undefined; -get_life_mapping_value(_, MFilter, Event) when is_record(Event, 'any') -> - case catch 'CosNotifyFilter_MappingFilter':match(MFilter, Event) of - {false, DefVal} when is_record(DefVal, 'any') -> - any:get_value(DefVal); - {true, Matched} when is_record(Matched, 'any') -> - any:get_value(Matched); - _ -> - undefined - end; -get_life_mapping_value(_, MFilter, Event) -> - case catch 'CosNotifyFilter_MappingFilter':match_structured(MFilter, Event) of - {false, DefVal} when is_record(DefVal, 'any') -> - any:get_value(DefVal); - {true, Matched} when is_record(Matched, 'any') -> - any:get_value(Matched); - _ -> - undefined - end. - -%%------------------------------------------------------------ -%% function : validate_event -%% Arguments: Subscribe data -%% A sequence of Events, 'structured' or an 'any' record -%% A list of filter references -%% Status, i.e., do we have to filter the events or just check subscr. -%% Returns : A tuple of two lists; list1 the events that passed -%% and list2 the events that didn't pass. -%%------------------------------------------------------------ -validate_event(true, Events, Filters, _, 'MATCH') -> - filter_events(Events, Filters, false); -validate_event(true, Events, _Filters, _, _) -> - {Events, []}; -validate_event({_Which, _WC}, Event, Filters, _, 'MATCH') when is_record(Event, any) -> - filter_events(Event, Filters, false); -validate_event({_Which, _WC}, Event, _Filters, _, _) when is_record(Event, any) -> - {Event, []}; -validate_event({Which, WC}, Events, Filters, DBRef, 'MATCH') -> - Passed=validate_event2(DBRef, Events, Which, WC, []), - filter_events(Passed, Filters, true); -validate_event({Which, WC}, Events, _Filters, DBRef, _) -> - Passed=validate_event2(DBRef, Events, Which, WC, []), - {lists:reverse(Passed), []}. - -validate_event2(_, [], _, _, []) -> - []; -validate_event2(_, [], _, _, Acc) -> - Acc; -validate_event2(DBRef, [Event|T], Which, WC, Acc) -> - ET = ((Event#'CosNotification_StructuredEvent'.header) - #'CosNotification_EventHeader'.fixed_header) - #'CosNotification_FixedEventHeader'.event_type, - CheckList = - case Which of - both -> - [ET]; - domain -> - [ET, - ET#'CosNotification_EventType'{type_name=""}, - ET#'CosNotification_EventType'{type_name="*"}]; - type -> - [ET, - ET#'CosNotification_EventType'{domain_name=""}, - ET#'CosNotification_EventType'{domain_name="*"}]; - _ -> - [ET, - ET#'CosNotification_EventType'{type_name=""}, - ET#'CosNotification_EventType'{type_name="*"}, - ET#'CosNotification_EventType'{domain_name=""}, - ET#'CosNotification_EventType'{domain_name="*"}] - end, - case check_subscription(DBRef, CheckList) of - true -> - validate_event2(DBRef, T, Which, WC, [Event|Acc]); - _-> - case catch cosNotification_Filter:match_types( - ET#'CosNotification_EventType'.domain_name, - ET#'CosNotification_EventType'.type_name, - WC) of - true -> - validate_event2(DBRef, T, Which, WC, [Event|Acc]); - _-> - validate_event2(DBRef, T, Which, WC, Acc) - end - end. - -check_subscription(_, []) -> - false; -check_subscription(DBRef, [H|T]) -> - case ets:lookup(DBRef, H) of - [] -> - check_subscription(DBRef, T); - _ -> - true - end. - - -%%------------------------------------------------------------ -%% function : filter_events -%% Arguments: A sequence of structured Events or #any -%% Returns : A tuple of two lists; list1 the events that passed -%% and list2 the events that didn't pass. -%%------------------------------------------------------------ - -filter_events(Events, []) -> - {Events, []}; -filter_events(Events, Filters) -> - filter_events(Events, Filters, [], [], false). - -filter_events(Events, [], false) -> - {Events, []}; -filter_events(Events, [], _) -> - {lists:reverse(Events), []}; -filter_events(Events, Filters, Reversed) -> - filter_events(Events, Filters, [], [], Reversed). - -filter_events([], _, AccPassed, AccFailed, false) -> - {lists:reverse(AccPassed), lists:reverse(AccFailed)}; -filter_events([], _, AccPassed, AccFailed, _) -> - {AccPassed, AccFailed}; -filter_events([H|T], Filters, AccPassed, AccFailed, Reversed) -> - case call_filters(Filters, H) of - true -> - filter_events(T, Filters, [H|AccPassed], AccFailed, Reversed); - _ -> - filter_events(T, Filters, AccPassed, [H|AccFailed], Reversed) - end; -filter_events(Any, Filters, _AccPassed, _AccFailed, _Reversed) -> - case call_filters(Filters, Any) of - true -> - {Any, []}; - _ -> - {[], Any} - end. - -call_filters([], _) -> - false; -call_filters([{_,H}|T], Event) when is_record(Event, any) -> - case catch 'CosNotifyFilter_Filter':match(H, Event) of - true -> - true; - _-> - call_filters(T, Event) - end; -call_filters([{_,H}|T], Event) when ?not_isConvertedAny(Event) -> - case catch 'CosNotifyFilter_Filter':match(H, - Event#'CosNotification_StructuredEvent'.remainder_of_body) of - true -> - true; - _-> - call_filters(T, Event) - end; -call_filters([{_,H}|T], Event) -> - case catch 'CosNotifyFilter_Filter':match_structured(H, Event) of - true -> - true; - _-> - call_filters(T, Event) - end. - - -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosNotification/test/Makefile b/lib/cosNotification/test/Makefile deleted file mode 100644 index 583cca1f42..0000000000 --- a/lib/cosNotification/test/Makefile +++ /dev/null @@ -1,192 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1999-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions 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=$(COSNOTIFICATION_VSN) -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/cosNotification_test - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- -TEST_SPEC_FILE = cosNotification.spec -COVER_FILE = cosNotification.cover - - -IDL_FILES = - -IDLOUTDIR = idl_output - -MODULES = \ - notification_SUITE \ - grammar_SUITE \ - eventDB_SUITE \ - generated_SUITE \ - notify_test_impl - -GEN_MODULES = \ - oe_notify_test_server \ - notify_test_data \ - notify_test_computer \ - notify_test_studies \ - notify_test_ShortArray \ - notify_test_uni1 \ - notify_test_uni2 \ - notify_test_X \ - notify_test_K \ - notify_test_SeqPushC \ - notify_test_StrPushC \ - notify_test_AnyPushC \ - notify_test_SeqPullC \ - notify_test_StrPullC \ - notify_test_AnyPullC \ - notify_test_SeqPushS \ - notify_test_StrPushS \ - notify_test_AnyPushS \ - notify_test_SeqPullS \ - notify_test_StrPullS \ - notify_test_AnyPullS \ - notify_test_funcs - -GEN_HRL_FILES = \ - oe_notify_test_server.hrl \ - notify_test_SeqPushC.hrl \ - notify_test_StrPushC.hrl \ - notify_test_AnyPushC.hrl \ - notify_test_SeqPullC.hrl \ - notify_test_StrPullC.hrl \ - notify_test_AnyPullC.hrl \ - notify_test_SeqPushS.hrl \ - notify_test_StrPushS.hrl \ - notify_test_AnyPushS.hrl \ - notify_test_SeqPullS.hrl \ - notify_test_StrPullS.hrl \ - notify_test_AnyPullS.hrl \ - notify_test.hrl \ - notify_test_funcs.hrl - -ERL_FILES = $(MODULES:%=%.erl) - -HRL_FILES = - -GEN_FILES = \ - $(GEN_HRL_FILES:%=$(IDLOUTDIR)/%) \ - $(GEN_MODULES:%=$(IDLOUTDIR)/%.erl) - -GEN_TARGET_FILES = $(GEN_MODULES:%=$(IDLOUTDIR)/%.$(EMULATOR)) - -SUITE_TARGET_FILES = $(MODULES:%=%.$(EMULATOR)) - -TARGET_FILES = \ - $(GEN_TARGET_FILES) \ - $(SUITE_TARGET_FILES) - - -# ---------------------------------------------------- -# PROGRAMS -# ---------------------------------------------------- -LOCAL_CLASSPATH = $(ERL_TOP)lib/cosNotification/priv:$(ERL_TOP)lib/cosNotification/test -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -ERL_IDL_FLAGS += \ - -pa $(ERL_TOP)/lib/cosNotification/ebin \ - -pa $(ERL_TOP)/lib/cosNotification/src \ - -pa $(ERL_TOP)/lib/cosTime/ebin \ - -pa $(ERL_TOP)/lib/cosTime/include \ - -pa $(ERL_TOP)/lib/orber/ebin \ - -pa $(ERL_TOP)/lib/ic/ebin \ - -pa $(ERL_TOP)/lib/cosNotification/include \ - -I$(ERL_TOP)/lib/cosEvent/src \ - -I$(ERL_TOP)/lib/cosNotification/include \ - -ERL_COMPILE_FLAGS += \ - $(ERL_IDL_FLAGS) \ - -pa $(ERL_TOP)/lib/orber/include \ - -pa $(ERL_TOP)/lib/cosEvent/ebin \ - -pa $(ERL_TOP)/lib/cosNotification/ebin \ - -pa $(ERL_TOP)/lib/cosNotification/test/idl_output \ - -pa $(ERL_TOP)/lib/cosTime/ebin \ - -pa $(ERL_TOP)/lib/cosTime/include \ - -pa $(ERL_TOP)/lib/cosNotification/include \ - -pa $(ERL_TOP)/lib/ic/ebin \ - -I$(ERL_TOP)/lib/cosTime/ebin \ - -I$(ERL_TOP)/lib/cosTime/include \ - -I$(ERL_TOP)/lib/orber/include \ - -I$(ERL_TOP)/lib/cosNotification/src \ - -I$(ERL_TOP)/lib/cosNotification/include \ - -I$(ERL_TOP)/lib/cosNotification \ - -I$(ERL_TOP)/lib/cosNotification/test/$(IDLOUTDIR) - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- - - -tests debug opt: $(TARGET_FILES) - -clean: - rm -f idl_output/* - rm -f $(TARGET_FILES) - rm -f errs core *~ - -docs: - -# ---------------------------------------------------- -# Special Targets -# ---------------------------------------------------- - -IDL-GENERATED: notify_test_server.idl - erlc $(ERL_COMPILE_FLAGS) -o$(IDLOUTDIR) \ - +'{cfgfile,"notify_test_server.cfg"}' notify_test_server.idl - >IDL-GENERATED - -$(GEN_FILES): IDL-GENERATED - -$(TARGET_FILES): IDL-GENERATED - -# ---------------------------------------------------- -# Release Targets -# ---------------------------------------------------- -# We don't copy generated intermediate erlang and hrl files - -include $(ERL_TOP)/make/otp_release_targets.mk - -release_spec: - -release_docs_spec: - -release_tests_spec: tests - $(INSTALL_DIR) "$(RELSYSDIR)" - $(INSTALL_DATA) $(IDL_FILES) $(TEST_SPEC_FILE) \ - $(COVER_FILE) $(ERL_FILES) "$(RELSYSDIR)" - $(INSTALL_DIR) "$(RELSYSDIR)/$(IDLOUTDIR)" - $(INSTALL_DATA) $(GEN_TARGET_FILES) $(GEN_FILES) \ - "$(RELSYSDIR)/$(IDLOUTDIR)" - $(INSTALL_DATA) $(SUITE_TARGET_FILES) "$(RELSYSDIR)" - diff --git a/lib/cosNotification/test/cosNotification.cover b/lib/cosNotification/test/cosNotification.cover deleted file mode 100644 index 604f313521..0000000000 --- a/lib/cosNotification/test/cosNotification.cover +++ /dev/null @@ -1,2 +0,0 @@ -{incl_app,cosNotification,details}. - diff --git a/lib/cosNotification/test/cosNotification.spec b/lib/cosNotification/test/cosNotification.spec deleted file mode 100644 index 8ec1baca33..0000000000 --- a/lib/cosNotification/test/cosNotification.spec +++ /dev/null @@ -1 +0,0 @@ -{suites,"../cosNotification_test",all}. diff --git a/lib/cosNotification/test/eventDB_SUITE.erl b/lib/cosNotification/test/eventDB_SUITE.erl deleted file mode 100644 index a0c47ad4c7..0000000000 --- a/lib/cosNotification/test/eventDB_SUITE.erl +++ /dev/null @@ -1,896 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%-------------------------------------------------------------------- -%% File : eventDB_SUITE.erl -%% Purpose : -%%-------------------------------------------------------------------- - --module(eventDB_SUITE). -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% cosEvent files. --include_lib("cosEvent/include/CosEventChannelAdmin.hrl"). -%% cosTime files. --include_lib("cosTime/include/TimeBase.hrl"). -%% Application files --include_lib("cosNotification/include/CosNotification.hrl"). --include_lib("cosNotification/include/CosNotifyChannelAdmin.hrl"). --include_lib("cosNotification/include/CosNotifyComm.hrl"). --include_lib("cosNotification/include/CosNotifyFilter.hrl"). - --include_lib("cosNotification/src/CosNotification_Definitions.hrl"). - --include("idl_output/notify_test.hrl"). - --include_lib("common_test/include/ct.hrl"). - -%%--------------- DEFINES ------------------------------------ --define(default_timeout, test_server:minutes(20)). --define(match(ExpectedRes, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - ExpectedRes -> - io:format("------ CORRECT RESULT ------~n~p~n", - [AcTuAlReS]), - AcTuAlReS; - _ -> - io:format("###### ERROR ERROR ######~n~p~n", - [AcTuAlReS]), - exit(AcTuAlReS) - end - end()). - - --define(EVENT1, ?not_CreateSE("","event1","", - [#'CosNotification_Property' - {name="Priority", - value=any:create(orber_tc:short(), 0)}, - #'CosNotification_Property' - {name="StartTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=900000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="StopTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=900000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="Timeout", - value=any:create(orber_tc:unsigned_long_long(), 900000000)}], - [], any:create(orber_tc:null(), null))). --define(EVENT2, ?not_CreateSE("","event2","", - [#'CosNotification_Property' - {name="Priority", - value=any:create(orber_tc:short(), 0)}, - #'CosNotification_Property' - {name="StartTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=800000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="StopTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=800000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="Timeout", - value=any:create(orber_tc:unsigned_long_long(), 800000000)}], - [], any:create(orber_tc:null(), null))). --define(EVENT3, ?not_CreateSE("","event3","", - [#'CosNotification_Property' - {name="Priority", - value=any:create(orber_tc:short(), 0)}, - #'CosNotification_Property' - {name="StartTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=700000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="StopTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=700000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="Timeout", - value=any:create(orber_tc:unsigned_long_long(), 700000000)}], - [], any:create(orber_tc:null(), null))). --define(EVENT4, ?not_CreateSE("","event4","", - [#'CosNotification_Property' - {name="Priority", - value=any:create(orber_tc:short(), 2)}, - #'CosNotification_Property' - {name="StartTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=300000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="StopTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=300000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="Timeout", - value=any:create(orber_tc:unsigned_long_long(), 300000000)}], - [], any:create(orber_tc:null(), null))). --define(EVENT5, ?not_CreateSE("","event5","", - [#'CosNotification_Property' - {name="Priority", - value=any:create(orber_tc:short(), 2)}, - #'CosNotification_Property' - {name="StartTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=200000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="StopTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=200000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="Timeout", - value=any:create(orber_tc:unsigned_long_long(), 200000000)}], - [], any:create(orber_tc:null(), null))). --define(EVENT6, ?not_CreateSE("","event6","", - [#'CosNotification_Property' - {name="Priority", - value=any:create(orber_tc:short(), 0)}, - #'CosNotification_Property' - {name="StartTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=500000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="StopTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=500000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="Timeout", - value=any:create(orber_tc:unsigned_long_long(), 500000000)}], - [], any:create(orber_tc:null(), null))). --define(EVENT7, ?not_CreateSE("","event7","", - [#'CosNotification_Property' - {name="Priority", - value=any:create(orber_tc:short(), -1)}, - #'CosNotification_Property' - {name="StartTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=400000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="StopTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=400000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="Timeout", - value=any:create(orber_tc:unsigned_long_long(), 400000000)}], - [], any:create(orber_tc:null(), null))). --define(EVENT8, ?not_CreateSE("","event8","", - [#'CosNotification_Property' - {name="Priority", - value=any:create(orber_tc:short(), -1)}, - #'CosNotification_Property' - {name="StartTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=600000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="StopTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=600000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="Timeout", - value=any:create(orber_tc:unsigned_long_long(), 600000000)}], - [], any:create(orber_tc:null(), null))). --define(EVENT9, ?not_CreateSE("","event9","", - [#'CosNotification_Property' - {name="Priority", - value=any:create(orber_tc:short(), 0)}, - #'CosNotification_Property' - {name="StartTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=100000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="StopTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=100000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="Timeout", - value=any:create(orber_tc:unsigned_long_long(), 100000000)}], - [], any:create(orber_tc:null(), null))). - --define(EVENTS, [?EVENT1, ?EVENT2, ?EVENT3, ?EVENT4, ?EVENT5, ?EVENT6, ?EVENT7, - ?EVENT8, ?EVENT9]). - - --define(PRIOORDER, [?EVENT4, ?EVENT5, ?EVENT1, ?EVENT2, ?EVENT3, ?EVENT6, ?EVENT9, - ?EVENT7, ?EVENT8]). - --define(FIFOORDER, ?EVENTS). - --define(DEADLINEORDER, [?EVENT9, ?EVENT5, ?EVENT4, ?EVENT7, ?EVENT6, ?EVENT8, ?EVENT3, - ?EVENT2, ?EVENT1]). - --define(NO_OF_EVENTS, 9). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, - cases/0, init_per_suite/1, end_per_suite/1, reorder_api/1, - lookup_api/1, - discard_api/1, max_events_api/1, gc_api/1, auto_gc_api/1, - start_stop_time_api/1, mapping_filter_api/1, persisten_event_api/1, - init_per_testcase/2, end_per_testcase/2]). - -%%----------------------------------------------------------------- -%% Func: all/1 -%% Args: -%% Returns: -%%----------------------------------------------------------------- -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - cases(). - -groups() -> - []. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -cases() -> - [persisten_event_api, start_stop_time_api, - mapping_filter_api, max_events_api, discard_api, - reorder_api, lookup_api, gc_api, auto_gc_api]. - - - -%%----------------------------------------------------------------- -%% Init and cleanup functions. -%%----------------------------------------------------------------- -init_per_testcase(_Case, Config) -> - Dog=test_server:timetrap(?default_timeout), - [{watchdog, Dog}|Config]. - - -end_per_testcase(_Case, Config) -> - Dog = proplists:get_value(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. - -init_per_suite(Config) -> - Path = code:which(?MODULE), - code:add_pathz(filename:join(filename:dirname(Path), "idl_output")), - orber:jump_start(), - cosTime:install_time(), - cosTime:start(), - if - is_list(Config) -> - Config; - true -> - exit("Config not a list") - end. - -end_per_suite(Config) -> - Path = code:which(?MODULE), - code:del_path(filename:join(filename:dirname(Path), "idl_output")), - cosTime:stop(), - cosTime:uninstall_time(), - orber:jump_stop(), - Config. - - -%%----------------------------------------------------------------- -%% cosNotification_eventDB lookup API tests -%%----------------------------------------------------------------- -%% The event DB is used to store events which cannot be -%% delivered at once. This case is supposed to test -%% that the events are delivered in the correct order -%% if a MappingFilter have benn associated. -mapping_filter_api(_Config) -> - InitQoS = ?not_CreateInitQoS(), - InitQoS2 = ?not_SetMaxEventsPerConsumer(InitQoS,100), - InitQoS3 = ?not_SetStartTimeSupported(InitQoS2, false), - InitQoS4 = ?not_SetStopTimeSupported(InitQoS3, true), - QoS = ?not_SetDiscardPolicy(InitQoS4, ?not_AnyOrder), - - PriorityQoS = ?not_SetOrderPolicy(QoS, ?not_PriorityOrder), - DeadlineQoS = ?not_SetOrderPolicy(QoS, ?not_DeadlineOrder), - - %% "Calculate" data once: - %% NOTE! Even though the an Event do not match any of the constarints the - %% default value will be used. Hence, the events will not be stored in the - %% way described in the definitions above. For example, when using deadline order - %% all the events will be stored in FIFO order since the usag of a MappingFilter - %% all evnts will have the same deadline (except event6). - Events = ?EVENTS, - PrioOrder = [?EVENT6, ?EVENT1, ?EVENT2, ?EVENT3, ?EVENT4, ?EVENT5, ?EVENT7, - ?EVENT8, ?EVENT9], - DeadlineOrder = [?EVENT1, ?EVENT2, ?EVENT3, ?EVENT4, ?EVENT5, ?EVENT7, ?EVENT8, - ?EVENT9], - - - FiFac = 'CosNotifyFilter_FilterFactory':oe_create(), - ?match({_,key,_,_,_,_}, FiFac), - - PrioFilter = 'CosNotifyFilter_FilterFactory': - create_mapping_filter(FiFac, "EXTENDED_TCL", any:create(orber_tc:short(), 0)), - DLFilter = 'CosNotifyFilter_FilterFactory': - create_mapping_filter(FiFac, "EXTENDED_TCL", any:create(orber_tc:unsigned_long_long(), 1000000000)), - - ?match([_], - 'CosNotifyFilter_MappingFilter':add_mapping_constraints(PrioFilter, - [#'CosNotifyFilter_MappingConstraintPair' - {constraint_expression = #'CosNotifyFilter_ConstraintExp' - {event_types = [#'CosNotification_EventType' - {domain_name = "", - type_name = "event6"}], - constraint_expr = "2==2"}, - result_to_set = any:create(orber_tc:short(), 10)}])), - ?match([_], - 'CosNotifyFilter_MappingFilter':add_mapping_constraints(DLFilter, - [#'CosNotifyFilter_MappingConstraintPair' - {constraint_expression = #'CosNotifyFilter_ConstraintExp' - {event_types = [#'CosNotification_EventType' - {domain_name = "", - type_name = "event6"}], - constraint_expr = "2==2"}, - result_to_set = any:create(orber_tc:unsigned_long_long(), 200000000)}])), - - - do_lookup(PriorityQoS, Events, PrioOrder, "Priority Order", undefined, PrioFilter, 0), - do_lookup(DeadlineQoS, Events, DeadlineOrder, "Deadline Order", DLFilter, undefined, 23000), - ok. - -do_lookup(QoS, Events, Return, Txt, DLFilter, PrioFilter, Timeout) -> - io:format("#################### ~s ###################~n", [Txt]), - Ref = cosNotification_eventDB:create_db(QoS, 60, 50, undefined), - create_loop(Events, Ref, DLFilter, PrioFilter), - timer:sleep(Timeout), - ?match({Return,_}, cosNotification_eventDB:get_events(Ref, ?NO_OF_EVENTS)), - cosNotification_eventDB:destroy_db(Ref). - -%%----------------------------------------------------------------- -%% cosNotification_eventDB discard API tests -%%----------------------------------------------------------------- -%% The event DB is used to store events which cannot be -%% delivered at once. If MaxEvents limit is reached there -%% different ways we can discard the. This case will test -%% all permutations of order and discard policies. -discard_api(_Config) -> - InitQoS1 = ?not_CreateInitQoS(), - InitQoS2 = ?not_SetPriority(InitQoS1, 10), - InitQoS3 = ?not_SetStartTimeSupported(InitQoS2, false), - QoS = ?not_SetMaxEventsPerConsumer(InitQoS3, 5), - %% The different order policies. To each order we must apply every possible - %% discard policy to each order policy setting. We also have to test and - %% change the policies for each setting. - AnyQoS = ?not_SetOrderPolicy(QoS, ?not_AnyOrder), - PriorityQoS = ?not_SetOrderPolicy(QoS, ?not_PriorityOrder), - FifoQoS = ?not_SetOrderPolicy(QoS, ?not_FifoOrder), - DeadlineQoS = ?not_SetOrderPolicy(QoS, ?not_DeadlineOrder), - - Events = ?EVENTS, - - %% Test using Any discard policy - do_discard(Events, ?not_SetDiscardPolicy(AnyQoS, ?not_AnyOrder), - [?EVENT4, ?EVENT5, ?EVENT1, ?EVENT2, ?EVENT3], - "Discard and Order eq. Any"), - do_discard(Events, ?not_SetDiscardPolicy(PriorityQoS, ?not_AnyOrder), - [?EVENT4, ?EVENT5, ?EVENT1, ?EVENT2, ?EVENT3], - "Discard Any and Order Priority"), - do_discard(Events, ?not_SetDiscardPolicy(FifoQoS, ?not_AnyOrder), - [?EVENT1, ?EVENT2, ?EVENT3, ?EVENT4, ?EVENT5], - "Discard Any and Order Fifo"), - do_discard(Events, ?not_SetDiscardPolicy(DeadlineQoS, ?not_AnyOrder), - [?EVENT5, ?EVENT4, ?EVENT3, ?EVENT2, ?EVENT1], - "Discard Any and Order Deadline"), - - %% Test using RejectNewEvents discard policy - do_discard(Events, ?not_SetDiscardPolicy(AnyQoS, ?not_RejectNewEvents), - [?EVENT4, ?EVENT5, ?EVENT1, ?EVENT2, ?EVENT3], - "Discard RejectNewEvents and Order Any"), - do_discard(Events, ?not_SetDiscardPolicy(PriorityQoS, ?not_RejectNewEvents), - [?EVENT4, ?EVENT5, ?EVENT1, ?EVENT2, ?EVENT3], - "Discard RejectNewEvents and Order Priority"), - do_discard(Events, ?not_SetDiscardPolicy(FifoQoS, ?not_RejectNewEvents), - [?EVENT1, ?EVENT2, ?EVENT3, ?EVENT4, ?EVENT5], - "Discard RejectNewEvents and Order Fifo"), - do_discard(Events, ?not_SetDiscardPolicy(DeadlineQoS, ?not_RejectNewEvents), - [?EVENT5, ?EVENT4, ?EVENT3, ?EVENT2, ?EVENT1], - "Discard RejectNewEvents and Order Deadline"), - - %% Test using Lifo discard policy - do_discard(Events, ?not_SetDiscardPolicy(AnyQoS, ?not_LifoOrder), - [?EVENT4, ?EVENT5, ?EVENT1, ?EVENT2, ?EVENT3], - "Discard Lifo and Order Any"), - do_discard(Events, ?not_SetDiscardPolicy(PriorityQoS, ?not_LifoOrder), - [?EVENT4, ?EVENT5, ?EVENT1, ?EVENT2, ?EVENT3], - "Discard Lifo and Order Priority"), - do_discard(Events, ?not_SetDiscardPolicy(FifoQoS, ?not_LifoOrder), - [?EVENT1, ?EVENT2, ?EVENT3, ?EVENT4, ?EVENT5], - "Discard Lifo and Order Fifo"), - do_discard(Events, ?not_SetDiscardPolicy(DeadlineQoS, ?not_LifoOrder), - [?EVENT5, ?EVENT4, ?EVENT3, ?EVENT2, ?EVENT1], - "Discard Lifo and Order Deadline"), - - %% Test using Fifo discard policy - do_discard(Events, ?not_SetDiscardPolicy(AnyQoS, ?not_FifoOrder), - [?EVENT5, ?EVENT6, ?EVENT9, ?EVENT7, ?EVENT8], - "Discard Fifo and Order Any"), - do_discard(Events, ?not_SetDiscardPolicy(PriorityQoS, ?not_FifoOrder), - [?EVENT5, ?EVENT6, ?EVENT9, ?EVENT7, ?EVENT8], - "Discard Fifo and Order Priority"), - do_discard(Events, ?not_SetDiscardPolicy(FifoQoS, ?not_FifoOrder), - [?EVENT5, ?EVENT6, ?EVENT7, ?EVENT8, ?EVENT9], - "Discard Fifo and Order Fifo"), - do_discard(Events, ?not_SetDiscardPolicy(DeadlineQoS, ?not_FifoOrder), - [?EVENT9, ?EVENT5, ?EVENT7, ?EVENT6, ?EVENT8], - "Discard Fifo and Order Deadline"), - - %% Test using Priority discard policy - do_discard(Events, ?not_SetDiscardPolicy(AnyQoS, ?not_PriorityOrder), - [?EVENT4, ?EVENT5, ?EVENT1, ?EVENT2, ?EVENT3], - "Discard Priority and Order Any"), - do_discard(Events, ?not_SetDiscardPolicy(PriorityQoS, ?not_PriorityOrder), - [?EVENT4, ?EVENT5, ?EVENT1, ?EVENT2, ?EVENT3], - "Discard Priority and Order Priority"), - do_discard(Events, ?not_SetDiscardPolicy(FifoQoS, ?not_PriorityOrder), - [?EVENT1, ?EVENT2, ?EVENT3, ?EVENT4, ?EVENT5], - "Discard Priority and Order Fifo"), - do_discard(Events, ?not_SetDiscardPolicy(DeadlineQoS, ?not_PriorityOrder), - [?EVENT5, ?EVENT4, ?EVENT3, ?EVENT2, ?EVENT1], - "Discard Priority and Order Deadline"), - - %% Test using Deadline discard policy - do_discard(Events, ?not_SetDiscardPolicy(AnyQoS, ?not_DeadlineOrder), - [?EVENT1, ?EVENT2, ?EVENT3, ?EVENT6, ?EVENT8], - "Discard Deadline and Order Any"), - do_discard(Events, ?not_SetDiscardPolicy(PriorityQoS, ?not_DeadlineOrder), - [?EVENT1, ?EVENT2, ?EVENT3, ?EVENT6, ?EVENT8], - "Discard Deadline and Order Priority"), - do_discard(Events, ?not_SetDiscardPolicy(FifoQoS, ?not_DeadlineOrder), - [?EVENT1, ?EVENT2, ?EVENT3, ?EVENT6, ?EVENT8], - "Discard Deadline and Order Fifo"), - do_discard(Events, ?not_SetDiscardPolicy(DeadlineQoS, ?not_DeadlineOrder), - [?EVENT6, ?EVENT8, ?EVENT3, ?EVENT2, ?EVENT1], - "Discard Deadline and Order Deadline"), - - ok. - -do_discard(Events, QoS, Reply, Txt) -> - io:format("################# ~s #################~n", [Txt]), - Ref = cosNotification_eventDB:create_db(QoS, 60, 50, undefined), - create_loop(Events, Ref), - ?match({Reply,_}, cosNotification_eventDB:get_events(Ref, ?NO_OF_EVENTS)), - cosNotification_eventDB:destroy_db(Ref). - - -%%----------------------------------------------------------------- -%% cosNotification_eventDB lookup API tests -%%----------------------------------------------------------------- -%% The event DB is used to store events which cannot be -%% delivered at once. This case is supposed to test -%% that the events are delivered in the correct order. -lookup_api(_Config) -> - InitQoS = ?not_CreateInitQoS(), - InitQoS2 = ?not_SetMaxEventsPerConsumer(InitQoS,100), - InitQoS3 = ?not_SetStartTimeSupported(InitQoS2, false), - QoS = ?not_SetDiscardPolicy(InitQoS3, ?not_AnyOrder), - - AnyQoS = ?not_SetOrderPolicy(QoS, ?not_AnyOrder), - PriorityQoS = ?not_SetOrderPolicy(QoS, ?not_PriorityOrder), - FifoQoS = ?not_SetOrderPolicy(QoS, ?not_FifoOrder), - DeadlineQoS = ?not_SetOrderPolicy(QoS, ?not_DeadlineOrder), - - %% "Calculate" data once: - Events = ?EVENTS, - PrioOrder = ?PRIOORDER, - FifoOrder = ?FIFOORDER, - DeadlineOrder = ?DEADLINEORDER, - - do_lookup(PriorityQoS, Events, PrioOrder, "Priority Order"), - do_lookup(FifoQoS, Events, FifoOrder, "Fifo Order"), - do_lookup(DeadlineQoS, Events, DeadlineOrder, "Deadline Order"), - do_lookup(AnyQoS, Events, PrioOrder, "Any Order"), - ok. - -do_lookup(QoS, Events, Return, Txt) -> - io:format("#################### ~s ###################~n", [Txt]), - Ref = cosNotification_eventDB:create_db(QoS, 60, 50, undefined), - create_loop(Events, Ref), - ?match({Return,_}, cosNotification_eventDB:get_events(Ref, ?NO_OF_EVENTS)), - cosNotification_eventDB:destroy_db(Ref). - - -%%----------------------------------------------------------------- -%% cosNotification_eventDB max events API tests -%%----------------------------------------------------------------- -%% The event DB is used to store events which cannot be -%% delivered at once. If the MaxEvents QoS is updated we must be -%% able to reduce the amount of stored events. -max_events_api(_Config) -> - - QoS1 = ?not_CreateInitQoS(), - QoS2 = ?not_SetOrderPolicy(QoS1, ?not_FifoOrder), - QoS3 = ?not_SetDiscardPolicy(QoS2, ?not_RejectNewEvents), - QoS4 = ?not_SetStartTimeSupported(QoS3, false), - QoS_NO_OF_EVENTS = ?not_SetMaxEventsPerConsumer(QoS4, ?NO_OF_EVENTS), - QoS_5_EVENTS = ?not_SetMaxEventsPerConsumer(QoS4, 5), - - Events = ?EVENTS, - Events5 = [?EVENT1, ?EVENT2, ?EVENT3, ?EVENT4, ?EVENT5], - - %% Initiate DB and 'NO_OF_EVENTS' events. - Ref1 = cosNotification_eventDB:create_db(QoS_NO_OF_EVENTS, 60, 50, undefined), - create_loop(Events, Ref1), - - %% Reduce the limit to 5 and extract all and see if it's ok. - Ref2 = cosNotification_eventDB:update(Ref1, QoS_5_EVENTS), - ?match({Events5, true}, cosNotification_eventDB:get_events(Ref2, ?NO_OF_EVENTS)), - - %% Add 'NO_OF_EVENTS' events. Since the only allow 5 events the DB will only - %% contain 5 events. - create_loop(Events, Ref2), - Ref3 = cosNotification_eventDB:update(Ref2, QoS_NO_OF_EVENTS), - - ?match({Events5, true}, cosNotification_eventDB:get_events(Ref3, ?NO_OF_EVENTS)), - create_loop(Events, Ref3), - ?match({Events, true}, cosNotification_eventDB:get_events(Ref3, ?NO_OF_EVENTS)), - cosNotification_eventDB:destroy_db(Ref3), - ok. - - -%%----------------------------------------------------------------- -%% cosNotification_eventDB persisten events API tests -%%----------------------------------------------------------------- -%% The event DB is used to store events which cannot be -%% delivered at once. -persisten_event_api(_Config) -> - - QoS1 = ?not_CreateInitQoS(), - QoS2 = ?not_SetOrderPolicy(QoS1, ?not_FifoOrder), - QoS3 = ?not_SetDiscardPolicy(QoS2, ?not_RejectNewEvents), - QoS4 = ?not_SetStartTimeSupported(QoS3, false), - QoS = ?not_SetMaxEventsPerConsumer(QoS4, ?NO_OF_EVENTS), - - Event1 = ?EVENT1, - - Ref = cosNotification_eventDB:create_db(QoS, 60, 50, undefined), - %% Clean DB, should be empty - ?match(0, cosNotification_eventDB:status(Ref, eventCounter)), - cosNotification_eventDB:add_event(Ref, Event1), - ?match(1, cosNotification_eventDB:status(Ref, eventCounter)), - %% Get event without removing it. Should still be one event stored - ?match({[Event1], _, _}, cosNotification_eventDB:get_events(Ref, 2, false)), - ?match(1, cosNotification_eventDB:status(Ref, eventCounter)), - {_, _, Keys} = - ?match({Event1, _, _}, cosNotification_eventDB:get_event(Ref, false)), - ?match(1, cosNotification_eventDB:status(Ref, eventCounter)), - %% Clear the events and check that the DB is empty. - cosNotification_eventDB:delete_events(Keys), - ?match(0, cosNotification_eventDB:status(Ref, eventCounter)), - ?match({[], _, []}, cosNotification_eventDB:get_event(Ref, false)), - ?match({[], _, []}, cosNotification_eventDB:get_events(Ref, 2, false)), - - cosNotification_eventDB:destroy_db(Ref), - ok. - -%%----------------------------------------------------------------- -%% cosNotification_eventDB gc API tests -%%----------------------------------------------------------------- -%% The event DB is used to store events which cannot be -%% delivered at once. If Deadline defined the events that -%% are older must be discarded. -gc_api(_Config) -> - - QoS1 = ?not_CreateInitQoS(), - QoS2 = ?not_SetOrderPolicy(QoS1, ?not_FifoOrder), - QoS3 = ?not_SetDiscardPolicy(QoS2, ?not_RejectNewEvents), - QoS4 = ?not_SetStartTimeSupported(QoS3, false), - QoS_NO_OF_EVENTS = ?not_SetMaxEventsPerConsumer(QoS4, ?NO_OF_EVENTS), - - Events = ?EVENTS, - Events6 = [?EVENT1, ?EVENT2, ?EVENT3, ?EVENT4, ?EVENT6, ?EVENT7, ?EVENT8], - %% Initiate DB and 'NO_OF_EVENTS' events. - Ref = cosNotification_eventDB:create_db(QoS_NO_OF_EVENTS, 60, 50, undefined), - create_loop(Events, Ref), - - %% Sleep so some events will get 'old'. - timer:sleep(23000), - - %% Reduce the limit to 5 and extract all and see if it's ok. - cosNotification_eventDB:gc_events(Ref, high), - - %% Since gc is done by another process we must wait so it will have a chance - %% to complete the job. - timer:sleep(2000), - - ?match({Events6, true}, cosNotification_eventDB:get_events(Ref, ?NO_OF_EVENTS)), - - create_loop(Events, Ref), - timer:sleep(23000), - ?match({Events6, true}, cosNotification_eventDB:get_events(Ref, ?NO_OF_EVENTS)), - cosNotification_eventDB:destroy_db(Ref), - ok. - - -%%----------------------------------------------------------------- -%% cosNotification_eventDB gc API tests -%%----------------------------------------------------------------- -%% The event DB is used to store events which cannot be -%% delivered at once. If Deadline defined the events that -%% are older must be discarded. -auto_gc_api(_Config) -> - - QoS1 = ?not_CreateInitQoS(), - QoS2 = ?not_SetOrderPolicy(QoS1, ?not_FifoOrder), - QoS3 = ?not_SetDiscardPolicy(QoS2, ?not_RejectNewEvents), - QoS4 = ?not_SetStopTimeSupported(QoS3, true), - QoS5 = ?not_SetStartTimeSupported(QoS4, false), - QoS_NO_OF_EVENTS = ?not_SetMaxEventsPerConsumer(QoS5, ?NO_OF_EVENTS), - - Events6 = [?EVENT1, ?EVENT2, ?EVENT3, ?EVENT7, ?EVENT8, ?EVENT9], - %% Initiate DB - Ref = cosNotification_eventDB:create_db(QoS_NO_OF_EVENTS, 50, 50, undefined), - create_loop([?EVENT1, ?EVENT2, ?EVENT3, ?EVENT4, ?EVENT6], Ref), - - %% Sleep so some events will get 'old'. - timer:sleep(60000), - create_loop([?EVENT7, ?EVENT8, ?EVENT9], Ref), - - %% Since gc is done by another process we must wait so it will have a chance - %% to complete the job. - timer:sleep(2000), - - ?match({Events6, true}, cosNotification_eventDB:get_events(Ref, ?NO_OF_EVENTS)), - - cosNotification_eventDB:destroy_db(Ref), - - ok. - - -%%----------------------------------------------------------------- -%% cosNotification_eventDB start- and stop-time API tests -%%----------------------------------------------------------------- -%% The event DB is used to store events which cannot be -%% delivered at once. If Deadline defined the events that -%% are older must be discarded. -start_stop_time_api(_Config) -> - - QoS1 = ?not_CreateInitQoS(), - QoS2 = ?not_SetOrderPolicy(QoS1, ?not_FifoOrder), - QoS3 = ?not_SetDiscardPolicy(QoS2, ?not_RejectNewEvents), - QoS4 = ?not_SetStopTimeSupported(QoS3, true), - QoS5 = ?not_SetStartTimeSupported(QoS4, true), - QoS_NO_OF_EVENTS = ?not_SetMaxEventsPerConsumer(QoS5, ?NO_OF_EVENTS), - - %% Initiate DB - TimeService = cosTime:start_time_service(2, 0), - Ref = cosNotification_eventDB:create_db(QoS_NO_OF_EVENTS, 50, 50, TimeService), - - T1 = 'CosTime_UTO':'_get_utc_time'('CosTime_UTO': - absolute_time('CosTime_TimeService': - new_universal_time(TimeService, - 100000000, 0, 2))), - T2 = 'CosTime_UTO':'_get_utc_time'('CosTime_UTO': - absolute_time('CosTime_TimeService': - new_universal_time(TimeService, - 200000000, 0, 2))), - T3 = 'CosTime_UTO':'_get_utc_time'('CosTime_UTO': - absolute_time('CosTime_TimeService': - new_universal_time(TimeService, - 300000000, 0, 2))), - T4 = 'CosTime_UTO':'_get_utc_time'('CosTime_UTO': - absolute_time('CosTime_TimeService': - new_universal_time(TimeService, - 400000000, 0, 2))), - %% Delivered after 10 seconds discarded after 20. - EVENT1 = ?not_CreateSE("","event1","", - [#'CosNotification_Property' - {name="Priority", - value=any:create(orber_tc:short(), 1)}, - #'CosNotification_Property' - {name="StartTime", - value=any:create('TimeBase_UtcT':tc(), T1)}, - #'CosNotification_Property' - {name="StopTime", - value=any:create('TimeBase_UtcT':tc(), T2)}], - [], any:create(orber_tc:null(), null)), - - %% Delivered after 30 seconds discarded after 10, i.e., always discarded. - EVENT2 = ?not_CreateSE("","event2","", - [#'CosNotification_Property' - {name="Priority", - value=any:create(orber_tc:short(), 3)}, - #'CosNotification_Property' - {name="StartTime", - value=any:create('TimeBase_UtcT':tc(), T3)}, - #'CosNotification_Property' - {name="StopTime", - value=any:create('TimeBase_UtcT':tc(), T1)}], - [], any:create(orber_tc:null(), null)), - - %% Delivered after 20 seconds discarded after 40 - EVENT3 = ?not_CreateSE("","event3","", - [#'CosNotification_Property' - {name="Priority", - value=any:create(orber_tc:short(), 2)}, - #'CosNotification_Property' - {name="StartTime", - value=any:create('TimeBase_UtcT':tc(), T2)}, - #'CosNotification_Property' - {name="StopTime", - value=any:create('TimeBase_UtcT':tc(), T4)}], - [], any:create(orber_tc:null(), null)), - - - - - create_loop([EVENT1, EVENT2, EVENT3], Ref), - - ?match({[], false}, cosNotification_eventDB:get_events(Ref, ?NO_OF_EVENTS)), - - %% Sleep so some events will get 'old'. - timer:sleep(12000), - - ?match({[EVENT1], true}, cosNotification_eventDB:get_events(Ref, ?NO_OF_EVENTS)), - - ?match({[], false}, cosNotification_eventDB:get_events(Ref, ?NO_OF_EVENTS)), - - timer:sleep(10000), - - ?match({[EVENT3], true}, cosNotification_eventDB:get_events(Ref, ?NO_OF_EVENTS)), - - timer:sleep(20000), - - %% See if EVENT2 really have been discarded. - ?match({[], false}, cosNotification_eventDB:get_events(Ref, ?NO_OF_EVENTS)), - - cosNotification_eventDB:destroy_db(Ref), - - cosTime:stop_time_service(TimeService), - - ok. - - -%%----------------------------------------------------------------- -%% cosNotification_eventDB order API tests -%%----------------------------------------------------------------- -%% The event DB is used to store events which cannot be -%% delivered at once. If the QoS is updated we must be -%% able to change the ordering of events as the discard -%% and order policies tells us. -reorder_api(_Config) -> - %% We need to test switching between: - %% * Priority -> Fifo - %% * Priority -> Deadline - %% * Fifo -> Priority - %% * Fifo -> Deadline - %% * Deadline -> Priority - %% * Deadline -> Fifo - QoS = ?not_CreateInitQoS(), - QoS2 = ?not_SetMaxEventsPerConsumer(QoS,100), - QoS3 = ?not_SetPriority(QoS2, 10), - QoS4 = ?not_SetStartTimeSupported(QoS3, false), - QoS5 = ?not_SetOrderPolicy(QoS4, ?not_AnyOrder), - - - %% Test all order policies using Any order discard policy. - reorder_helper(?not_SetDiscardPolicy(QoS5, ?not_AnyOrder), "Discard Any"), - reorder_helper(?not_SetDiscardPolicy(QoS5, ?not_PriorityOrder), "Discard Priority"), - reorder_helper(?not_SetDiscardPolicy(QoS5, ?not_DeadlineOrder), "Discard Deadline"), - reorder_helper(?not_SetDiscardPolicy(QoS5, ?not_FifoOrder), "Discard Fifo"), - reorder_helper(?not_SetDiscardPolicy(QoS5, ?not_LifoOrder), "Discard Lifo"), - reorder_helper(?not_SetDiscardPolicy(QoS5, ?not_RejectNewEvents), "Reject New Events"), - - ok. - - -reorder_helper(QoS, Txt) -> - io:format("$$$$$$$$$$$$$$$$$$$$ ~s $$$$$$$$$$$$$$$$$$$~n", [Txt]), - %% Create a DB with the above settings. - Ref = cosNotification_eventDB:create_db(QoS, 60, 50, undefined), - - Events = ?EVENTS, - PrioOrder = ?PRIOORDER, - FifoOrder = ?FIFOORDER, - DeadlineOrder = ?DEADLINEORDER, - - %% Test all order policies using Any order discard policy. - Ref2 = do_reorder(Ref, Events, ?not_SetOrderPolicy(QoS, ?not_FifoOrder), - FifoOrder, "Priority -> Fifo"), - Ref3 = do_reorder(Ref2, Events, ?not_SetOrderPolicy(QoS, ?not_PriorityOrder), - PrioOrder, "Fifo -> Priority"), - Ref4 = do_reorder(Ref3, Events, ?not_SetOrderPolicy(QoS, ?not_DeadlineOrder), - DeadlineOrder, "Priority -> Deadline"), - - Ref5 = do_reorder(Ref4, Events, ?not_SetOrderPolicy(QoS, ?not_PriorityOrder), - PrioOrder, "Deadline -> Priority"), - - Ref6 = do_reorder(Ref5, Events, ?not_SetOrderPolicy(QoS, ?not_FifoOrder), - FifoOrder, "Priority -> Fifo"), - - Ref7 = do_reorder(Ref6, Events, ?not_SetOrderPolicy(QoS, ?not_DeadlineOrder), - DeadlineOrder, "Fifo -> Deadline"), - - Ref8 = do_reorder(Ref7, Events, ?not_SetOrderPolicy(QoS, ?not_FifoOrder), - FifoOrder, "Deadline -> Fifo"), - cosNotification_eventDB:destroy_db(Ref8), - ok. - - - -do_reorder(Ref, Events, QoS, Reply, Txt) -> - create_loop(Events, Ref), - io:format("################# ~s #################~n", [Txt]), - NewRef = cosNotification_eventDB:update(Ref, QoS), - ?match({Reply,_}, cosNotification_eventDB:get_events(NewRef, ?NO_OF_EVENTS)), - NewRef. - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- -%% This functions takes as argument a list of structured events. -create_loop([], _Ref) -> - ok; -create_loop([H|T], Ref) -> - catch cosNotification_eventDB:add_event(Ref, H), - create_loop(T, Ref). - -create_loop([], _Ref, _Life, _Prio) -> - ok; -create_loop([H|T], Ref, Life, Prio) -> - catch cosNotification_eventDB:add_event(Ref, H, Life, Prio), - create_loop(T, Ref, Life, Prio). - -%%-------------------- End of Module ------------------------------ diff --git a/lib/cosNotification/test/generated_SUITE.erl b/lib/cosNotification/test/generated_SUITE.erl deleted file mode 100644 index 8e3ccbd90e..0000000000 --- a/lib/cosNotification/test/generated_SUITE.erl +++ /dev/null @@ -1,1928 +0,0 @@ -%%----------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2004-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File : generated_SUITE.erl -%% Purpose : -%%----------------------------------------------------------------- - --module(generated_SUITE). - --include_lib("common_test/include/ct.hrl"). --include_lib("orber/include/corba.hrl"). - --define(default_timeout, test_server:minutes(3)). - --define(match(ExpectedRes, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - ExpectedRes -> - AcTuAlReS; - _ -> - io:format("###### ERROR ERROR ######~n~p~n", - [AcTuAlReS]), - exit(AcTuAlReS) - end - end()). - --define(nomatch(Not, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - Not -> - io:format("###### ERROR ERROR ######~n~p~n", - [AcTuAlReS]), - exit(AcTuAlReS); - _ -> - AcTuAlReS - end - end()). - - --define(checktc(_Op), - fun(TC) -> - case orber_tc:check_tc(TC) of - false -> - io:format("###### ERROR ERROR ######~n~p - ~p~n", [Op, TC]), - exit(TC); - true -> - true - end - end). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --compile(export_all). - -%%----------------------------------------------------------------- -%% Func: all/1 -%% Args: -%% Returns: -%%----------------------------------------------------------------- -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - ['CosNotification', - 'CosNotification_AdminPropertiesAdmin', - 'CosNotification_EventHeader', - 'CosNotification_EventType', - 'CosNotification_FixedEventHeader', - 'CosNotification_NamedPropertyRange', - 'CosNotification_Property', - 'CosNotification_PropertyError', - 'CosNotification_PropertyRange', - 'CosNotification_QoSAdmin', - 'CosNotification_StructuredEvent', - 'CosNotification_UnsupportedAdmin', - 'CosNotification_UnsupportedQoS', - 'CosNotification_EventBatch', - 'CosNotification_EventTypeSeq', - 'CosNotification_NamedPropertyRangeSeq', - 'CosNotification_PropertyErrorSeq', - 'CosNotifyChannelAdmin_AdminLimit', - 'CosNotifyChannelAdmin_AdminNotFound', - 'CosNotifyChannelAdmin_ChannelNotFound', - 'CosNotifyChannelAdmin_ConnectionAlreadyActive', - 'CosNotifyChannelAdmin_ConnectionAlreadyInactive', - 'CosNotifyChannelAdmin_NotConnected', - 'CosNotifyChannelAdmin_AdminIDSeq', - 'CosNotifyChannelAdmin_ChannelIDSeq', - 'CosNotifyChannelAdmin_ProxyIDSeq', - 'CosNotifyFilter_CallbackNotFound', - 'CosNotifyFilter_ConstraintExp', - 'CosNotifyFilter_ConstraintInfo', - 'CosNotifyFilter_ConstraintNotFound', - 'CosNotifyFilter_DuplicateConstraintID', - 'CosNotifyFilter_FilterNotFound', - 'CosNotifyFilter_InvalidConstraint', - 'CosNotifyFilter_InvalidGrammar', - 'CosNotifyFilter_InvalidValue', - 'CosNotifyFilter_MappingConstraintInfo', - 'CosNotifyFilter_MappingConstraintPair', - 'CosNotifyFilter_UnsupportedFilterableData', - 'CosNotifyFilter_CallbackIDSeq', - 'CosNotifyFilter_ConstraintExpSeq', - 'CosNotifyFilter_ConstraintIDSeq', - 'CosNotifyFilter_ConstraintInfoSeq', - 'CosNotifyFilter_FilterIDSeq', - 'CosNotifyFilter_MappingConstraintInfoSeq', - 'CosNotifyFilter_MappingConstraintPairSeq', - 'CosNotifyComm_InvalidEventType', - 'CosNotifyChannelAdmin_ConsumerAdmin', - 'CosNotifyChannelAdmin_EventChannel', - 'CosNotifyChannelAdmin_EventChannelFactory', - 'CosNotifyChannelAdmin_ProxyConsumer', - 'CosNotifyChannelAdmin_ProxyNotFound', - 'CosNotifyChannelAdmin_ProxyPullConsumer', - 'CosNotifyChannelAdmin_ProxyPullSupplier', - 'CosNotifyChannelAdmin_ProxyPushConsumer', - 'CosNotifyChannelAdmin_ProxyPushSupplier', - 'CosNotifyChannelAdmin_ProxySupplier', - 'CosNotifyChannelAdmin_SequenceProxyPullConsumer', - 'CosNotifyChannelAdmin_SequenceProxyPullSupplier', - 'CosNotifyChannelAdmin_SequenceProxyPushConsumer', - 'CosNotifyChannelAdmin_SequenceProxyPushSupplier', - 'CosNotifyChannelAdmin_StructuredProxyPullConsumer', - 'CosNotifyChannelAdmin_StructuredProxyPullSupplier', - 'CosNotifyChannelAdmin_StructuredProxyPushConsumer', - 'CosNotifyChannelAdmin_StructuredProxyPushSupplier', - 'CosNotifyChannelAdmin_SupplierAdmin', - 'CosNotifyFilter_Filter', 'CosNotifyFilter_FilterAdmin', - 'CosNotifyFilter_FilterFactory', - 'CosNotifyFilter_MappingFilter', - 'CosNotifyComm_NotifyPublish', - 'CosNotifyComm_NotifySubscribe', - 'CosNotifyComm_PullConsumer', - 'CosNotifyComm_PullSupplier', - 'CosNotifyComm_PushConsumer', - 'CosNotifyComm_PushSupplier', - 'CosNotifyComm_SequencePullConsumer', - 'CosNotifyComm_SequencePullSupplier', - 'CosNotifyComm_SequencePushConsumer', - 'CosNotifyComm_SequencePushSupplier', - 'CosNotifyComm_StructuredPullConsumer', - 'CosNotifyComm_StructuredPullSupplier', - 'CosNotifyComm_StructuredPushConsumer', - 'CosNotifyComm_StructuredPushSupplier', - oe_CosNotificationComm_Event, - 'CosNotification_PropertySeq']. - -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -%%----------------------------------------------------------------- -%% Init and cleanup functions. -%%----------------------------------------------------------------- -init_per_testcase(_Case, Config) -> - Dog=test_server:timetrap(?default_timeout), - [{watchdog, Dog}|Config]. - - -end_per_testcase(_Case, Config) -> - Dog = proplists:get_value(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification' -%% Description: -%%----------------------------------------------------------------- -'CosNotification'(_) -> - ?match("EventReliability", 'CosNotification':'EventReliability'()), - ?match(0, 'CosNotification':'BestEffort'()), - ?match(1, 'CosNotification':'Persistent'()), - ?match("ConnectionReliability", 'CosNotification':'ConnectionReliability'()), - ?match("Priority", 'CosNotification':'Priority'()), - ?match(-32767, 'CosNotification':'LowestPriority'()), - ?match(32767, 'CosNotification':'HighestPriority'()), - ?match(0, 'CosNotification':'DefaultPriority'()), - ?match("StartTime", 'CosNotification':'StartTime'()), - ?match("StopTime", 'CosNotification':'StopTime'()), - ?match("Timeout", 'CosNotification':'Timeout'()), - ?match("OrderPolicy", 'CosNotification':'OrderPolicy'()), - ?match(0, 'CosNotification':'AnyOrder'()), - ?match(1, 'CosNotification':'FifoOrder'()), - ?match(2, 'CosNotification':'PriorityOrder'()), - ?match(3, 'CosNotification':'DeadlineOrder'()), - ?match("DiscardPolicy", 'CosNotification':'DiscardPolicy'()), - ?match(4, 'CosNotification':'LifoOrder'()), - ?match(5, 'CosNotification':'RejectNewEvents'()), - ?match("MaximumBatchSize", 'CosNotification':'MaximumBatchSize'()), - ?match("PacingInterval", 'CosNotification':'PacingInterval'()), - ?match("StartTimeSupported", 'CosNotification':'StartTimeSupported'()), - ?match("StopTimeSupported", 'CosNotification':'StopTimeSupported'()), - ?match("MaxEventsPerConsumer", 'CosNotification':'MaxEventsPerConsumer'()), - ?match("MaxQueueLength", 'CosNotification':'MaxQueueLength'()), - ?match("MaxConsumers", 'CosNotification':'MaxConsumers'()), - ?match("MaxSuppliers", 'CosNotification':'MaxSuppliers'()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_EventHeader' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_EventHeader'(_) -> - ?match(true, orber_tc:check_tc('CosNotification_EventHeader':tc())), - ?match("IDL:omg.org/CosNotification/EventHeader:1.0", - 'CosNotification_EventHeader':id()), - ?match("CosNotification_EventHeader", - 'CosNotification_EventHeader':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_EventType' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_EventType'(_) -> - ?match(true, orber_tc:check_tc('CosNotification_EventType':tc())), - ?match("IDL:omg.org/CosNotification/EventType:1.0", - 'CosNotification_EventType':id()), - ?match("CosNotification_EventType", - 'CosNotification_EventType':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_FixedEventHeader' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_FixedEventHeader'(_) -> - ?match(true, orber_tc:check_tc('CosNotification_FixedEventHeader':tc())), - ?match("IDL:omg.org/CosNotification/FixedEventHeader:1.0", - 'CosNotification_FixedEventHeader':id()), - ?match("CosNotification_FixedEventHeader", - 'CosNotification_FixedEventHeader':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_NamedPropertyRange' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_NamedPropertyRange'(_) -> - ?match(true, orber_tc:check_tc('CosNotification_NamedPropertyRange':tc())), - ?match("IDL:omg.org/CosNotification/NamedPropertyRange:1.0", - 'CosNotification_NamedPropertyRange':id()), - ?match("CosNotification_NamedPropertyRange", - 'CosNotification_NamedPropertyRange':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_Property' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_Property'(_) -> - ?match(true, orber_tc:check_tc('CosNotification_Property':tc())), - ?match("IDL:omg.org/CosNotification/Property:1.0", - 'CosNotification_Property':id()), - ?match("CosNotification_Property", - 'CosNotification_Property':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_PropertyError' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_PropertyError'(_) -> - ?match(true, orber_tc:check_tc('CosNotification_PropertyError':tc())), - ?match("IDL:omg.org/CosNotification/PropertyError:1.0", - 'CosNotification_PropertyError':id()), - ?match("CosNotification_PropertyError", - 'CosNotification_PropertyError':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_PropertyRange' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_PropertyRange'(_) -> - ?match(true, orber_tc:check_tc('CosNotification_PropertyRange':tc())), - ?match("IDL:omg.org/CosNotification/PropertyRange:1.0", - 'CosNotification_PropertyRange':id()), - ?match("CosNotification_PropertyRange", - 'CosNotification_PropertyRange':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_StructuredEvent' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_StructuredEvent'(_) -> - ?match(true, orber_tc:check_tc('CosNotification_StructuredEvent':tc())), - ?match("IDL:omg.org/CosNotification/StructuredEvent:1.0", - 'CosNotification_StructuredEvent':id()), - ?match("CosNotification_StructuredEvent", - 'CosNotification_StructuredEvent':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_UnsupportedAdmin' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_UnsupportedAdmin'(_) -> - ?match(true, orber_tc:check_tc('CosNotification_UnsupportedAdmin':tc())), - ?match("IDL:omg.org/CosNotification/UnsupportedAdmin:1.0", - 'CosNotification_UnsupportedAdmin':id()), - ?match("CosNotification_UnsupportedAdmin", - 'CosNotification_UnsupportedAdmin':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_UnsupportedQoS' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_UnsupportedQoS'(_) -> - ?match(true, orber_tc:check_tc('CosNotification_UnsupportedQoS':tc())), - ?match("IDL:omg.org/CosNotification/UnsupportedQoS:1.0", - 'CosNotification_UnsupportedQoS':id()), - ?match("CosNotification_UnsupportedQoS", - 'CosNotification_UnsupportedQoS':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_EventBatch' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_EventBatch'(_) -> - ?match(true, orber_tc:check_tc('CosNotification_EventBatch':tc())), - ?match("IDL:omg.org/CosNotification/EventBatch:1.0", - 'CosNotification_EventBatch':id()), - ?match("CosNotification_EventBatch", - 'CosNotification_EventBatch':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_EventTypeSeq' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_EventTypeSeq'(_) -> - ?match(true, orber_tc:check_tc('CosNotification_EventTypeSeq':tc())), - ?match("IDL:omg.org/CosNotification/EventTypeSeq:1.0", - 'CosNotification_EventTypeSeq':id()), - ?match("CosNotification_EventTypeSeq", - 'CosNotification_EventTypeSeq':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_NamedPropertyRangeSeq' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_NamedPropertyRangeSeq'(_) -> - ?match(true, orber_tc:check_tc('CosNotification_NamedPropertyRangeSeq':tc())), - ?match("IDL:omg.org/CosNotification/NamedPropertyRangeSeq:1.0", - 'CosNotification_NamedPropertyRangeSeq':id()), - ?match("CosNotification_NamedPropertyRangeSeq", - 'CosNotification_NamedPropertyRangeSeq':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_PropertyErrorSeq' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_PropertyErrorSeq'(_) -> - ?match(true, orber_tc:check_tc('CosNotification_PropertyErrorSeq':tc())), - ?match("IDL:omg.org/CosNotification/PropertyErrorSeq:1.0", - 'CosNotification_PropertyErrorSeq':id()), - ?match("CosNotification_PropertyErrorSeq", - 'CosNotification_PropertyErrorSeq':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_PropertySeq' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_PropertySeq'(_) -> - ?match(true, orber_tc:check_tc('CosNotification_PropertySeq':tc())), - ?match("IDL:omg.org/CosNotification/PropertySeq:1.0", - 'CosNotification_PropertySeq':id()), - ?match("CosNotification_PropertySeq", - 'CosNotification_PropertySeq':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_AdminLimit' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_AdminLimit'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyChannelAdmin_AdminLimit':tc())), - ?match("IDL:omg.org/CosNotifyChannelAdmin/AdminLimit:1.0", - 'CosNotifyChannelAdmin_AdminLimit':id()), - ?match("CosNotifyChannelAdmin_AdminLimit", - 'CosNotifyChannelAdmin_AdminLimit':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_AdminLimitExceeded' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_AdminLimitExceeded'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyChannelAdmin_AdminLimitExceeded':tc())), - ?match("IDL:omg.org/CosNotifyChannelAdmin/AdminLimitExceeded:1.0", - 'CosNotifyChannelAdmin_AdminLimitExceeded':id()), - ?match("CosNotifyChannelAdmin_AdminLimitExceeded", - 'CosNotifyChannelAdmin_AdminLimitExceeded':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_AdminNotFound' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_AdminNotFound'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyChannelAdmin_AdminNotFound':tc())), - ?match("IDL:omg.org/CosNotifyChannelAdmin/AdminNotFound:1.0", - 'CosNotifyChannelAdmin_AdminNotFound':id()), - ?match("CosNotifyChannelAdmin_AdminNotFound", - 'CosNotifyChannelAdmin_AdminNotFound':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_ChannelNotFound' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_ChannelNotFound'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyChannelAdmin_ChannelNotFound':tc())), - ?match("IDL:omg.org/CosNotifyChannelAdmin/ChannelNotFound:1.0", - 'CosNotifyChannelAdmin_ChannelNotFound':id()), - ?match("CosNotifyChannelAdmin_ChannelNotFound", - 'CosNotifyChannelAdmin_ChannelNotFound':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_ConnectionAlreadyActive' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_ConnectionAlreadyActive'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyChannelAdmin_ConnectionAlreadyActive':tc())), - ?match("IDL:omg.org/CosNotifyChannelAdmin/ConnectionAlreadyActive:1.0", - 'CosNotifyChannelAdmin_ConnectionAlreadyActive':id()), - ?match("CosNotifyChannelAdmin_ConnectionAlreadyActive", - 'CosNotifyChannelAdmin_ConnectionAlreadyActive':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_ConnectionAlreadyInactive' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_ConnectionAlreadyInactive'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyChannelAdmin_ConnectionAlreadyInactive':tc())), - ?match("IDL:omg.org/CosNotifyChannelAdmin/ConnectionAlreadyInactive:1.0", - 'CosNotifyChannelAdmin_ConnectionAlreadyInactive':id()), - ?match("CosNotifyChannelAdmin_ConnectionAlreadyInactive", - 'CosNotifyChannelAdmin_ConnectionAlreadyInactive':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_NotConnected' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_NotConnected'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyChannelAdmin_NotConnected':tc())), - ?match("IDL:omg.org/CosNotifyChannelAdmin/NotConnected:1.0", - 'CosNotifyChannelAdmin_NotConnected':id()), - ?match("CosNotifyChannelAdmin_NotConnected", - 'CosNotifyChannelAdmin_NotConnected':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_AdminIDSeq' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_AdminIDSeq'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyChannelAdmin_AdminIDSeq':tc())), - ?match("IDL:omg.org/CosNotifyChannelAdmin/AdminIDSeq:1.0", - 'CosNotifyChannelAdmin_AdminIDSeq':id()), - ?match("CosNotifyChannelAdmin_AdminIDSeq", - 'CosNotifyChannelAdmin_AdminIDSeq':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_ChannelIDSeq' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_ChannelIDSeq'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyChannelAdmin_ChannelIDSeq':tc())), - ?match("IDL:omg.org/CosNotifyChannelAdmin/ChannelIDSeq:1.0", - 'CosNotifyChannelAdmin_ChannelIDSeq':id()), - ?match("CosNotifyChannelAdmin_ChannelIDSeq", - 'CosNotifyChannelAdmin_ChannelIDSeq':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_ProxyIDSeq' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_ProxyIDSeq'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyChannelAdmin_ProxyIDSeq':tc())), - ?match("IDL:omg.org/CosNotifyChannelAdmin/ProxyIDSeq:1.0", - 'CosNotifyChannelAdmin_ProxyIDSeq':id()), - ?match("CosNotifyChannelAdmin_ProxyIDSeq", - 'CosNotifyChannelAdmin_ProxyIDSeq':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_CallbackNotFound' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_CallbackNotFound'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_CallbackNotFound':tc())), - ?match("IDL:omg.org/CosNotifyFilter/CallbackNotFound:1.0", - 'CosNotifyFilter_CallbackNotFound':id()), - ?match("CosNotifyFilter_CallbackNotFound", - 'CosNotifyFilter_CallbackNotFound':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_ConstraintExp' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_ConstraintExp'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_ConstraintExp':tc())), - ?match("IDL:omg.org/CosNotifyFilter/ConstraintExp:1.0", - 'CosNotifyFilter_ConstraintExp':id()), - ?match("CosNotifyFilter_ConstraintExp", - 'CosNotifyFilter_ConstraintExp':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_ConstraintInfo' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_ConstraintInfo'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_ConstraintInfo':tc())), - ?match("IDL:omg.org/CosNotifyFilter/ConstraintInfo:1.0", - 'CosNotifyFilter_ConstraintInfo':id()), - ?match("CosNotifyFilter_ConstraintInfo", - 'CosNotifyFilter_ConstraintInfo':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_ConstraintNotFound' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_ConstraintNotFound'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_ConstraintNotFound':tc())), - ?match("IDL:omg.org/CosNotifyFilter/ConstraintNotFound:1.0", - 'CosNotifyFilter_ConstraintNotFound':id()), - ?match("CosNotifyFilter_ConstraintNotFound", - 'CosNotifyFilter_ConstraintNotFound':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_DuplicateConstraintID' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_DuplicateConstraintID'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_DuplicateConstraintID':tc())), - ?match("IDL:omg.org/CosNotifyFilter/DuplicateConstraintID:1.0", - 'CosNotifyFilter_DuplicateConstraintID':id()), - ?match("CosNotifyFilter_DuplicateConstraintID", - 'CosNotifyFilter_DuplicateConstraintID':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_FilterNotFound' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_FilterNotFound'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_FilterNotFound':tc())), - ?match("IDL:omg.org/CosNotifyFilter/FilterNotFound:1.0", - 'CosNotifyFilter_FilterNotFound':id()), - ?match("CosNotifyFilter_FilterNotFound", - 'CosNotifyFilter_FilterNotFound':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_InvalidConstraint' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_InvalidConstraint'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_InvalidConstraint':tc())), - ?match("IDL:omg.org/CosNotifyFilter/InvalidConstraint:1.0", - 'CosNotifyFilter_InvalidConstraint':id()), - ?match("CosNotifyFilter_InvalidConstraint", - 'CosNotifyFilter_InvalidConstraint':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_InvalidGrammar' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_InvalidGrammar'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_InvalidGrammar':tc())), - ?match("IDL:omg.org/CosNotifyFilter/InvalidGrammar:1.0", - 'CosNotifyFilter_InvalidGrammar':id()), - ?match("CosNotifyFilter_InvalidGrammar", - 'CosNotifyFilter_InvalidGrammar':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_InvalidValue' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_InvalidValue'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_InvalidValue':tc())), - ?match("IDL:omg.org/CosNotifyFilter/InvalidValue:1.0", - 'CosNotifyFilter_InvalidValue':id()), - ?match("CosNotifyFilter_InvalidValue", - 'CosNotifyFilter_InvalidValue':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_MappingConstraintInfo' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_MappingConstraintInfo'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_MappingConstraintInfo':tc())), - ?match("IDL:omg.org/CosNotifyFilter/MappingConstraintInfo:1.0", - 'CosNotifyFilter_MappingConstraintInfo':id()), - ?match("CosNotifyFilter_MappingConstraintInfo", - 'CosNotifyFilter_MappingConstraintInfo':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_MappingConstraintPair' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_MappingConstraintPair'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_MappingConstraintPair':tc())), - ?match("IDL:omg.org/CosNotifyFilter/MappingConstraintPair:1.0", - 'CosNotifyFilter_MappingConstraintPair':id()), - ?match("CosNotifyFilter_MappingConstraintPair", - 'CosNotifyFilter_MappingConstraintPair':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_UnsupportedFilterableData' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_UnsupportedFilterableData'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_UnsupportedFilterableData':tc())), - ?match("IDL:omg.org/CosNotifyFilter/UnsupportedFilterableData:1.0", - 'CosNotifyFilter_UnsupportedFilterableData':id()), - ?match("CosNotifyFilter_UnsupportedFilterableData", - 'CosNotifyFilter_UnsupportedFilterableData':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_CallbackIDSeq' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_CallbackIDSeq'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_CallbackIDSeq':tc())), - ?match("IDL:omg.org/CosNotifyFilter/CallbackIDSeq:1.0", - 'CosNotifyFilter_CallbackIDSeq':id()), - ?match("CosNotifyFilter_CallbackIDSeq", - 'CosNotifyFilter_CallbackIDSeq':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_ConstraintExpSeq' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_ConstraintExpSeq'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_ConstraintExpSeq':tc())), - ?match("IDL:omg.org/CosNotifyFilter/ConstraintExpSeq:1.0", - 'CosNotifyFilter_ConstraintExpSeq':id()), - ?match("CosNotifyFilter_ConstraintExpSeq", - 'CosNotifyFilter_ConstraintExpSeq':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_ConstraintIDSeq' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_ConstraintIDSeq'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_ConstraintIDSeq':tc())), - ?match("IDL:omg.org/CosNotifyFilter/ConstraintIDSeq:1.0", - 'CosNotifyFilter_ConstraintIDSeq':id()), - ?match("CosNotifyFilter_ConstraintIDSeq", - 'CosNotifyFilter_ConstraintIDSeq':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_ConstraintInfoSeq' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_ConstraintInfoSeq'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_ConstraintInfoSeq':tc())), - ?match("IDL:omg.org/CosNotifyFilter/ConstraintInfoSeq:1.0", - 'CosNotifyFilter_ConstraintInfoSeq':id()), - ?match("CosNotifyFilter_ConstraintInfoSeq", - 'CosNotifyFilter_ConstraintInfoSeq':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_FilterIDSeq' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_FilterIDSeq'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_FilterIDSeq':tc())), - ?match("IDL:omg.org/CosNotifyFilter/FilterIDSeq:1.0", - 'CosNotifyFilter_FilterIDSeq':id()), - ?match("CosNotifyFilter_FilterIDSeq", - 'CosNotifyFilter_FilterIDSeq':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_MappingConstraintInfoSeq' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_MappingConstraintInfoSeq'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_MappingConstraintInfoSeq':tc())), - ?match("IDL:omg.org/CosNotifyFilter/MappingConstraintInfoSeq:1.0", - 'CosNotifyFilter_MappingConstraintInfoSeq':id()), - ?match("CosNotifyFilter_MappingConstraintInfoSeq", - 'CosNotifyFilter_MappingConstraintInfoSeq':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_MappingConstraintPairSeq' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_MappingConstraintPairSeq'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_MappingConstraintPairSeq':tc())), - ?match("IDL:omg.org/CosNotifyFilter/MappingConstraintPairSeq:1.0", - 'CosNotifyFilter_MappingConstraintPairSeq':id()), - ?match("CosNotifyFilter_MappingConstraintPairSeq", - 'CosNotifyFilter_MappingConstraintPairSeq':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyComm_InvalidEventType' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyComm_InvalidEventType'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyComm_InvalidEventType':tc())), - ?match("IDL:omg.org/CosNotifyComm/InvalidEventType:1.0", - 'CosNotifyComm_InvalidEventType':id()), - ?match("CosNotifyComm_InvalidEventType", - 'CosNotifyComm_InvalidEventType':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_ProxyNotFound' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_ProxyNotFound'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyChannelAdmin_ProxyNotFound':tc())), - ?match("IDL:omg.org/CosNotifyChannelAdmin/ProxyNotFound:1.0", - 'CosNotifyChannelAdmin_ProxyNotFound':id()), - ?match("CosNotifyChannelAdmin_ProxyNotFound", - 'CosNotifyChannelAdmin_ProxyNotFound':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_AdminPropertiesAdmin' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_AdminPropertiesAdmin'(_) -> - ?nomatch(undefined, 'CosNotification_AdminPropertiesAdmin':oe_tc(get_admin)), - ?nomatch(undefined, 'CosNotification_AdminPropertiesAdmin':oe_tc(set_admin)), - ?match(undefined, 'CosNotification_AdminPropertiesAdmin':oe_tc(undefined)), - ?match([_|_], 'CosNotification_AdminPropertiesAdmin':oe_get_interface()), - ?match("IDL:omg.org/CosNotification/AdminPropertiesAdmin:1.0", - 'CosNotification_AdminPropertiesAdmin':typeID()), - check_tc('CosNotification_AdminPropertiesAdmin':oe_get_interface()), - ?match(true, 'CosNotification_AdminPropertiesAdmin':oe_is_a('CosNotification_AdminPropertiesAdmin':typeID())), - ?match(false, 'CosNotification_AdminPropertiesAdmin':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_QoSAdmin' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_QoSAdmin'(_) -> - ?nomatch(undefined, 'CosNotification_QoSAdmin':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotification_QoSAdmin':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotification_QoSAdmin':oe_tc(validate_qos)), - ?match(undefined, 'CosNotification_QoSAdmin':oe_tc(undefined)), - ?match([_|_], 'CosNotification_QoSAdmin':oe_get_interface()), - ?match("IDL:omg.org/CosNotification/QoSAdmin:1.0", - 'CosNotification_QoSAdmin':typeID()), - check_tc('CosNotification_QoSAdmin':oe_get_interface()), - ?match(true, 'CosNotification_QoSAdmin':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(false, 'CosNotification_QoSAdmin':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_ConsumerAdmin' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_ConsumerAdmin'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc('_get_MyID')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc('_get_MyChannel')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc('_get_MyOperator')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc('_get_priority_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc('_set_priority_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc('_get_lifetime_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc('_set_lifetime_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc('_get_pull_suppliers')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc('_get_push_suppliers')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(get_proxy_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(obtain_notification_pull_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(obtain_notification_push_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(destroy)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(subscription_change)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(remove_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(obtain_push_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(obtain_pull_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(callSeq)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(callAny)), - ?match(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_ConsumerAdmin':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/ConsumerAdmin:1.0", - 'CosNotifyChannelAdmin_ConsumerAdmin':typeID()), - check_tc('CosNotifyChannelAdmin_ConsumerAdmin':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_is_a('CosNotifyChannelAdmin_ConsumerAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_is_a('CosNotifyComm_NotifySubscribe':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_is_a('CosEventChannelAdmin_ConsumerAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_is_a('oe_CosNotificationComm_Event':typeID())), - ?match(false, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_EventChannel' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_EventChannel'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc('_get_MyFactory')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc('_get_default_consumer_admin')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc('_get_default_supplier_admin')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc('_get_default_filter_factory')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(new_for_consumers)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(new_for_suppliers)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(get_consumeradmin)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(get_supplieradmin)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(get_all_consumeradmins)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(get_all_supplieradmins)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(get_admin)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(set_admin)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(for_consumers)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(for_suppliers)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(destroy)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(callSeq)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(callAny)), - ?match(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_EventChannel':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/EventChannel:1.0", - 'CosNotifyChannelAdmin_EventChannel':typeID()), - check_tc('CosNotifyChannelAdmin_EventChannel':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_EventChannel':oe_is_a('CosNotifyChannelAdmin_EventChannel':typeID())), - ?match(true, 'CosNotifyChannelAdmin_EventChannel':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_EventChannel':oe_is_a('CosNotification_AdminPropertiesAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_EventChannel':oe_is_a('CosEventChannelAdmin_EventChannel':typeID())), - ?match(true, 'CosNotifyChannelAdmin_EventChannel':oe_is_a('oe_CosNotificationComm_Event':typeID())), - ?match(false, 'CosNotifyChannelAdmin_EventChannel':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_EventChannelFactory' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_EventChannelFactory'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannelFactory':oe_tc(create_channel)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannelFactory':oe_tc(get_all_channels)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannelFactory':oe_tc(get_event_channel)), - ?match(undefined, 'CosNotifyChannelAdmin_EventChannelFactory':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_EventChannelFactory':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/EventChannelFactory:1.0", - 'CosNotifyChannelAdmin_EventChannelFactory':typeID()), - check_tc('CosNotifyChannelAdmin_EventChannelFactory':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_EventChannelFactory':oe_is_a('CosNotifyChannelAdmin_EventChannelFactory':typeID())), - ?match(false, 'CosNotifyChannelAdmin_EventChannelFactory':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_ProxyConsumer' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_ProxyConsumer'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyConsumer':oe_tc('_get_MyType')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyConsumer':oe_tc('_get_MyAdmin')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyConsumer':oe_tc(obtain_subscription_types)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyConsumer':oe_tc(validate_event_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyConsumer':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyConsumer':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyConsumer':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyConsumer':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyConsumer':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyConsumer':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyConsumer':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyConsumer':oe_tc(remove_all_filters)), - ?match(undefined, 'CosNotifyChannelAdmin_ProxyConsumer':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_ProxyConsumer':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/ProxyConsumer:1.0", - 'CosNotifyChannelAdmin_ProxyConsumer':typeID()), - check_tc('CosNotifyChannelAdmin_ProxyConsumer':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_ProxyConsumer':oe_is_a('CosNotifyChannelAdmin_ProxyConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyConsumer':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyConsumer':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(false, 'CosNotifyChannelAdmin_ProxyConsumer':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_ProxyPullConsumer' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_ProxyPullConsumer'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(connect_any_pull_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(suspend_connection)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(resume_connection)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc('_get_MyType')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc('_get_MyAdmin')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(obtain_subscription_types)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(validate_event_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(remove_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(offer_change)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(disconnect_pull_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(connect_pull_supplier)), - ?match(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/ProxyPullConsumer:1.0", - 'CosNotifyChannelAdmin_ProxyPullConsumer':typeID()), - check_tc('CosNotifyChannelAdmin_ProxyPullConsumer':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_is_a('CosNotifyChannelAdmin_ProxyPullConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_is_a('CosNotifyChannelAdmin_ProxyConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_is_a('CosNotifyComm_PullConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_is_a('CosNotifyComm_NotifyPublish':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_is_a('CosEventComm_PullConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_is_a('CosEventChannelAdmin_ProxyPullConsumer':typeID())), - ?match(false, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_ProxyPullSupplier' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_ProxyPullSupplier'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc('_get_MyType')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc('_get_MyAdmin')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc('_get_priority_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc('_set_priority_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc('_get_lifetime_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc('_set_lifetime_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(obtain_offered_types)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(validate_event_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(remove_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(subscription_change)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(pull)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(try_pull)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(disconnect_pull_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(connect_pull_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(callSeq)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(callAny)), - ?match(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/ProxyPullSupplier:1.0", - 'CosNotifyChannelAdmin_ProxyPullSupplier':typeID()), - check_tc('CosNotifyChannelAdmin_ProxyPullSupplier':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_is_a('CosNotifyChannelAdmin_ProxyPullSupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_is_a('CosNotifyChannelAdmin_ProxySupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_is_a('CosNotifyComm_PullSupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_is_a('CosNotifyComm_NotifySubscribe':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_is_a('CosEventComm_PullSupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_is_a('CosEventChannelAdmin_ProxyPullSupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_is_a('oe_CosNotificationComm_Event':typeID())), - ?match(false, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_ProxyPushConsumer' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_ProxyPushConsumer'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc(connect_any_push_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc('_get_MyType')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc('_get_MyAdmin')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc(obtain_subscription_types)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc(validate_event_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc(remove_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc(offer_change)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc(push)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc(disconnect_push_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc(connect_push_supplier)), - ?match(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/ProxyPushConsumer:1.0", - 'CosNotifyChannelAdmin_ProxyPushConsumer':typeID()), - check_tc('CosNotifyChannelAdmin_ProxyPushConsumer':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_is_a('CosNotifyChannelAdmin_ProxyPushConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_is_a('CosNotifyChannelAdmin_ProxyConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_is_a('CosNotifyComm_PushConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_is_a('CosNotifyComm_NotifyPublish':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_is_a('CosEventComm_PushConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_is_a('CosEventChannelAdmin_ProxyPushConsumer':typeID())), - ?match(false, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_ProxyPushSupplier' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_ProxyPushSupplier'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(connect_any_push_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(suspend_connection)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(resume_connection)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc('_get_MyType')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc('_get_MyAdmin')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc('_get_priority_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc('_set_priority_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc('_get_lifetime_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc('_set_lifetime_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(obtain_offered_types)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(validate_event_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(remove_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(subscription_change)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(disconnect_push_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(connect_push_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(callSeq)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(callAny)), - ?match(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/ProxyPushSupplier:1.0", - 'CosNotifyChannelAdmin_ProxyPushSupplier':typeID()), - check_tc('CosNotifyChannelAdmin_ProxyPushSupplier':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_is_a('CosNotifyChannelAdmin_ProxyPushSupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_is_a('CosNotifyChannelAdmin_ProxySupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_is_a('CosNotifyComm_PushSupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_is_a('CosNotifyComm_NotifySubscribe':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_is_a('CosEventComm_PushSupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_is_a('CosEventChannelAdmin_ProxyPushSupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_is_a('oe_CosNotificationComm_Event':typeID())), - ?match(false, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_ProxySupplier' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_ProxySupplier'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc('_get_MyType')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc('_get_MyAdmin')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc('_get_priority_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc('_set_priority_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc('_get_lifetime_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc('_set_lifetime_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc(obtain_offered_types)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc(validate_event_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc(remove_all_filters)), - ?match(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_ProxySupplier':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/ProxySupplier:1.0", - 'CosNotifyChannelAdmin_ProxySupplier':typeID()), - check_tc('CosNotifyChannelAdmin_ProxySupplier':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_ProxySupplier':oe_is_a('CosNotifyChannelAdmin_ProxySupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxySupplier':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxySupplier':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(false, 'CosNotifyChannelAdmin_ProxySupplier':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_SequenceProxyPullConsumer' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_SequenceProxyPullConsumer'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc(connect_sequence_pull_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc(suspend_connection)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc(resume_connection)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc('_get_MyType')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc('_get_MyAdmin')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc(obtain_subscription_types)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc(validate_event_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc(remove_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc(disconnect_sequence_pull_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc(offer_change)), - ?match(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/SequenceProxyPullConsumer:1.0", - 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':typeID()), - check_tc('CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_is_a('CosNotifyChannelAdmin_SequenceProxyPullConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_is_a('CosNotifyChannelAdmin_ProxyConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_is_a('CosNotifyComm_SequencePullConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_is_a('CosNotifyComm_NotifyPublish':typeID())), - ?match(false, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_SequenceProxyPullSupplier' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_SequenceProxyPullSupplier'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(connect_sequence_pull_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc('_get_MyType')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc('_get_MyAdmin')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc('_get_priority_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc('_set_priority_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc('_get_lifetime_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc('_set_lifetime_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(obtain_offered_types)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(validate_event_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(remove_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(pull_structured_events)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(try_pull_structured_events)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(disconnect_sequence_pull_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(subscription_change)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(callSeq)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(callAny)), - ?match(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/SequenceProxyPullSupplier:1.0", - 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':typeID()), - check_tc('CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_is_a('CosNotifyChannelAdmin_SequenceProxyPullSupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_is_a('CosNotifyChannelAdmin_ProxySupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_is_a('CosNotifyComm_SequencePullSupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_is_a('CosNotifyComm_NotifySubscribe':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_is_a('oe_CosNotificationComm_Event':typeID())), - ?match(false, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_SequenceProxyPushConsumer' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_SequenceProxyPushConsumer'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc(connect_sequence_push_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc('_get_MyType')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc('_get_MyAdmin')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc(obtain_subscription_types)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc(validate_event_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc(remove_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc(push_structured_events)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc(disconnect_sequence_push_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc(offer_change)), - ?match(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/SequenceProxyPushConsumer:1.0", - 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':typeID()), - check_tc('CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_is_a('CosNotifyChannelAdmin_SequenceProxyPushConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_is_a('CosNotifyChannelAdmin_ProxyConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_is_a('CosNotifyComm_SequencePushConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_is_a('CosNotifyComm_NotifyPublish':typeID())), - ?match(false, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_SequenceProxyPushSupplier' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_SequenceProxyPushSupplier'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(connect_sequence_push_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(suspend_connection)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(resume_connection)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc('_get_MyType')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc('_get_MyAdmin')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc('_get_priority_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc('_set_priority_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc('_get_lifetime_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc('_set_lifetime_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(obtain_offered_types)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(validate_event_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(remove_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(disconnect_sequence_push_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(subscription_change)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(callSeq)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(callAny)), - ?match(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/SequenceProxyPushSupplier:1.0", - 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':typeID()), - check_tc('CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_is_a('CosNotifyChannelAdmin_SequenceProxyPushSupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_is_a('CosNotifyChannelAdmin_ProxySupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_is_a('CosNotifyComm_SequencePushSupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_is_a('CosNotifyComm_NotifySubscribe':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_is_a('oe_CosNotificationComm_Event':typeID())), - ?match(false, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_StructuredProxyPullConsumer' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_StructuredProxyPullConsumer'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc(connect_structured_pull_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc(suspend_connection)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc(resume_connection)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc('_get_MyType')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc('_get_MyAdmin')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc(obtain_subscription_types)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc(validate_event_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc(remove_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc(disconnect_structured_pull_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc(offer_change)), - ?match(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/StructuredProxyPullConsumer:1.0", - 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':typeID()), - check_tc('CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_is_a('CosNotifyChannelAdmin_StructuredProxyPullConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_is_a('CosNotifyChannelAdmin_ProxyConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_is_a('CosNotifyComm_StructuredPullConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_is_a('CosNotifyComm_NotifyPublish':typeID())), - ?match(false, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_StructuredProxyPullSupplier' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_StructuredProxyPullSupplier'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(connect_structured_pull_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc('_get_MyType')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc('_get_MyAdmin')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc('_get_priority_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc('_set_priority_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc('_get_lifetime_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc('_set_lifetime_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(obtain_offered_types)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(validate_event_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(remove_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(pull_structured_event)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(try_pull_structured_event)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(disconnect_structured_pull_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(subscription_change)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(callSeq)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(callAny)), - ?match(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/StructuredProxyPullSupplier:1.0", - 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':typeID()), - check_tc('CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_is_a('CosNotifyChannelAdmin_StructuredProxyPullSupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_is_a('CosNotifyChannelAdmin_ProxySupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_is_a('CosNotifyComm_StructuredPullSupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_is_a('CosNotifyComm_NotifySubscribe':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_is_a('oe_CosNotificationComm_Event':typeID())), - ?match(false, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_StructuredProxyPushConsumer' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_StructuredProxyPushConsumer'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc(connect_structured_push_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc('_get_MyType')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc('_get_MyAdmin')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc(obtain_subscription_types)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc(validate_event_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc(remove_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc(push_structured_event)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc(disconnect_structured_push_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc(offer_change)), - ?match(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/StructuredProxyPushConsumer:1.0", - 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':typeID()), - check_tc('CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_is_a('CosNotifyChannelAdmin_StructuredProxyPushConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_is_a('CosNotifyChannelAdmin_ProxyConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_is_a('CosNotifyComm_StructuredPushConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_is_a('CosNotifyComm_NotifyPublish':typeID())), - ?match(false, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_StructuredProxyPushSupplier' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_StructuredProxyPushSupplier'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(connect_structured_push_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(suspend_connection)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(resume_connection)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc('_get_MyType')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc('_get_MyAdmin')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc('_get_priority_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc('_set_priority_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc('_get_lifetime_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc('_set_lifetime_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(obtain_offered_types)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(validate_event_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(remove_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(disconnect_structured_push_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(subscription_change)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(callSeq)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(callAny)), - ?match(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/StructuredProxyPushSupplier:1.0", - 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':typeID()), - check_tc('CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_is_a('CosNotifyChannelAdmin_StructuredProxyPushSupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_is_a('CosNotifyChannelAdmin_ProxySupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_is_a('CosNotifyComm_StructuredPushSupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_is_a('CosNotifyComm_NotifySubscribe':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_is_a('oe_CosNotificationComm_Event':typeID())), - ?match(false, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_SupplierAdmin' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_SupplierAdmin'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc('_get_MyID')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc('_get_MyChannel')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc('_get_MyOperator')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc('_get_pull_consumers')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc('_get_push_consumers')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(get_proxy_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(obtain_notification_pull_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(obtain_notification_push_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(destroy)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(offer_change)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(remove_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(obtain_push_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(obtain_pull_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(callSeq)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(callAny)), - ?match(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_SupplierAdmin':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/SupplierAdmin:1.0", - 'CosNotifyChannelAdmin_SupplierAdmin':typeID()), - check_tc('CosNotifyChannelAdmin_SupplierAdmin':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_SupplierAdmin':oe_is_a('CosNotifyChannelAdmin_SupplierAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SupplierAdmin':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SupplierAdmin':oe_is_a('CosNotifyComm_NotifyPublish':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SupplierAdmin':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SupplierAdmin':oe_is_a('CosEventChannelAdmin_SupplierAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SupplierAdmin':oe_is_a('oe_CosNotificationComm_Event':typeID())), - ?match(false, 'CosNotifyChannelAdmin_SupplierAdmin':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_Filter' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_Filter'(_) -> - ?nomatch(undefined, 'CosNotifyFilter_Filter':oe_tc('_get_constraint_grammar')), - ?nomatch(undefined, 'CosNotifyFilter_Filter':oe_tc(add_constraints)), - ?nomatch(undefined, 'CosNotifyFilter_Filter':oe_tc(modify_constraints)), - ?nomatch(undefined, 'CosNotifyFilter_Filter':oe_tc(get_constraints)), - ?nomatch(undefined, 'CosNotifyFilter_Filter':oe_tc(get_all_constraints)), - ?nomatch(undefined, 'CosNotifyFilter_Filter':oe_tc(remove_all_constraints)), - ?nomatch(undefined, 'CosNotifyFilter_Filter':oe_tc(destroy)), - ?nomatch(undefined, 'CosNotifyFilter_Filter':oe_tc(match)), - ?nomatch(undefined, 'CosNotifyFilter_Filter':oe_tc(match_structured)), - ?nomatch(undefined, 'CosNotifyFilter_Filter':oe_tc(match_typed)), - ?nomatch(undefined, 'CosNotifyFilter_Filter':oe_tc(attach_callback)), - ?nomatch(undefined, 'CosNotifyFilter_Filter':oe_tc(detach_callback)), - ?nomatch(undefined, 'CosNotifyFilter_Filter':oe_tc(get_callbacks)), - ?match(undefined, 'CosNotifyFilter_Filter':oe_tc(undefined)), - ?match([_|_], 'CosNotifyFilter_Filter':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyFilter/Filter:1.0", - 'CosNotifyFilter_Filter':typeID()), - check_tc('CosNotifyFilter_Filter':oe_get_interface()), - ?match(true, 'CosNotifyFilter_Filter':oe_is_a('CosNotifyFilter_Filter':typeID())), - ?match(false, 'CosNotifyFilter_Filter':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_FilterAdmin' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_FilterAdmin'(_) -> - ?nomatch(undefined, 'CosNotifyFilter_FilterAdmin':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyFilter_FilterAdmin':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyFilter_FilterAdmin':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyFilter_FilterAdmin':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyFilter_FilterAdmin':oe_tc(remove_all_filters)), - ?match(undefined, 'CosNotifyFilter_FilterAdmin':oe_tc(undefined)), - ?match([_|_], 'CosNotifyFilter_FilterAdmin':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyFilter/FilterAdmin:1.0", - 'CosNotifyFilter_FilterAdmin':typeID()), - check_tc('CosNotifyFilter_FilterAdmin':oe_get_interface()), - ?match(true, 'CosNotifyFilter_FilterAdmin':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(false, 'CosNotifyFilter_FilterAdmin':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_FilterFactory' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_FilterFactory'(_) -> - ?nomatch(undefined, 'CosNotifyFilter_FilterFactory':oe_tc(create_filter)), - ?nomatch(undefined, 'CosNotifyFilter_FilterFactory':oe_tc(create_mapping_filter)), - ?match(undefined, 'CosNotifyFilter_FilterFactory':oe_tc(undefined)), - ?match([_|_], 'CosNotifyFilter_FilterFactory':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyFilter/FilterFactory:1.0", - 'CosNotifyFilter_FilterFactory':typeID()), - check_tc('CosNotifyFilter_FilterFactory':oe_get_interface()), - ?match(true, 'CosNotifyFilter_FilterFactory':oe_is_a('CosNotifyFilter_FilterFactory':typeID())), - ?match(false, 'CosNotifyFilter_FilterFactory':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_MappingFilter' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_MappingFilter'(_) -> - ?nomatch(undefined, 'CosNotifyFilter_MappingFilter':oe_tc('_get_constraint_grammar')), - ?nomatch(undefined, 'CosNotifyFilter_MappingFilter':oe_tc('_get_value_type')), - ?nomatch(undefined, 'CosNotifyFilter_MappingFilter':oe_tc('_get_default_value')), - ?nomatch(undefined, 'CosNotifyFilter_MappingFilter':oe_tc(add_mapping_constraints)), - ?nomatch(undefined, 'CosNotifyFilter_MappingFilter':oe_tc(modify_mapping_constraints)), - ?nomatch(undefined, 'CosNotifyFilter_MappingFilter':oe_tc(get_mapping_constraints)), - ?nomatch(undefined, 'CosNotifyFilter_MappingFilter':oe_tc(get_all_mapping_constraints)), - ?nomatch(undefined, 'CosNotifyFilter_MappingFilter':oe_tc(remove_all_mapping_constraints)), - ?nomatch(undefined, 'CosNotifyFilter_MappingFilter':oe_tc(destroy)), - ?nomatch(undefined, 'CosNotifyFilter_MappingFilter':oe_tc(match)), - ?nomatch(undefined, 'CosNotifyFilter_MappingFilter':oe_tc(match_structured)), - ?nomatch(undefined, 'CosNotifyFilter_MappingFilter':oe_tc(match_typed)), - ?match(undefined, 'CosNotifyFilter_MappingFilter':oe_tc(undefined)), - ?match([_|_], 'CosNotifyFilter_MappingFilter':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyFilter/MappingFilter:1.0", - 'CosNotifyFilter_MappingFilter':typeID()), - check_tc('CosNotifyFilter_MappingFilter':oe_get_interface()), - ?match(true, 'CosNotifyFilter_MappingFilter':oe_is_a('CosNotifyFilter_MappingFilter':typeID())), - ?match(false, 'CosNotifyFilter_MappingFilter':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyComm_NotifyPublish' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyComm_NotifyPublish'(_) -> - ?nomatch(undefined, 'CosNotifyComm_NotifyPublish':oe_tc(offer_change)), - ?match(undefined, 'CosNotifyComm_NotifyPublish':oe_tc(undefined)), - ?match([_|_], 'CosNotifyComm_NotifyPublish':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyComm/NotifyPublish:1.0", - 'CosNotifyComm_NotifyPublish':typeID()), - check_tc('CosNotifyComm_NotifyPublish':oe_get_interface()), - ?match(true, 'CosNotifyComm_NotifyPublish':oe_is_a('CosNotifyComm_NotifyPublish':typeID())), - ?match(false, 'CosNotifyComm_NotifyPublish':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyComm_NotifySubscribe' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyComm_NotifySubscribe'(_) -> - ?nomatch(undefined, 'CosNotifyComm_NotifySubscribe':oe_tc(subscription_change)), - ?match(undefined, 'CosNotifyComm_NotifySubscribe':oe_tc(undefined)), - ?match([_|_], 'CosNotifyComm_NotifySubscribe':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyComm/NotifySubscribe:1.0", - 'CosNotifyComm_NotifySubscribe':typeID()), - check_tc('CosNotifyComm_NotifySubscribe':oe_get_interface()), - ?match(true, 'CosNotifyComm_NotifySubscribe':oe_is_a('CosNotifyComm_NotifySubscribe':typeID())), - ?match(false, 'CosNotifyComm_NotifySubscribe':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyComm_PullConsumer' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyComm_PullConsumer'(_) -> - ?nomatch(undefined, 'CosNotifyComm_PullConsumer':oe_tc(offer_change)), - ?nomatch(undefined, 'CosNotifyComm_PullConsumer':oe_tc(disconnect_pull_consumer)), - ?match(undefined, 'CosNotifyComm_PullConsumer':oe_tc(undefined)), - ?match([_|_], 'CosNotifyComm_PullConsumer':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyComm/PullConsumer:1.0", - 'CosNotifyComm_PullConsumer':typeID()), - check_tc('CosNotifyComm_PullConsumer':oe_get_interface()), - ?match(true, 'CosNotifyComm_PullConsumer':oe_is_a('CosNotifyComm_PullConsumer':typeID())), - ?match(true, 'CosNotifyComm_PullConsumer':oe_is_a('CosNotifyComm_NotifyPublish':typeID())), - ?match(true, 'CosNotifyComm_PullConsumer':oe_is_a('CosEventComm_PullConsumer':typeID())), - ?match(false, 'CosNotifyComm_PullConsumer':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyComm_PullSupplier' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyComm_PullSupplier'(_) -> - ?nomatch(undefined, 'CosNotifyComm_PullSupplier':oe_tc(subscription_change)), - ?nomatch(undefined, 'CosNotifyComm_PullSupplier':oe_tc(pull)), - ?nomatch(undefined, 'CosNotifyComm_PullSupplier':oe_tc(try_pull)), - ?nomatch(undefined, 'CosNotifyComm_PullSupplier':oe_tc(disconnect_pull_supplier)), - ?match(undefined, 'CosNotifyComm_PullSupplier':oe_tc(undefined)), - ?match([_|_], 'CosNotifyComm_PullSupplier':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyComm/PullSupplier:1.0", - 'CosNotifyComm_PullSupplier':typeID()), - check_tc('CosNotifyComm_PullSupplier':oe_get_interface()), - ?match(true, 'CosNotifyComm_PullSupplier':oe_is_a('CosNotifyComm_PullSupplier':typeID())), - ?match(true, 'CosNotifyComm_PullSupplier':oe_is_a('CosNotifyComm_NotifySubscribe':typeID())), - ?match(true, 'CosNotifyComm_PullSupplier':oe_is_a('CosEventComm_PullSupplier':typeID())), - ?match(false, 'CosNotifyComm_PullSupplier':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyComm_PushConsumer' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyComm_PushConsumer'(_) -> - ?nomatch(undefined, 'CosNotifyComm_PushConsumer':oe_tc(offer_change)), - ?nomatch(undefined, 'CosNotifyComm_PushConsumer':oe_tc(push)), - ?nomatch(undefined, 'CosNotifyComm_PushConsumer':oe_tc(disconnect_push_consumer)), - ?match(undefined, 'CosNotifyComm_PushConsumer':oe_tc(undefined)), - ?match([_|_], 'CosNotifyComm_PushConsumer':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyComm/PushConsumer:1.0", - 'CosNotifyComm_PushConsumer':typeID()), - check_tc('CosNotifyComm_PushConsumer':oe_get_interface()), - ?match(true, 'CosNotifyComm_PushConsumer':oe_is_a('CosNotifyComm_PushConsumer':typeID())), - ?match(true, 'CosNotifyComm_PushConsumer':oe_is_a('CosNotifyComm_NotifyPublish':typeID())), - ?match(true, 'CosNotifyComm_PushConsumer':oe_is_a('CosEventComm_PushConsumer':typeID())), - ?match(false, 'CosNotifyComm_PushConsumer':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyComm_PushSupplier' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyComm_PushSupplier'(_) -> - ?nomatch(undefined, 'CosNotifyComm_PushSupplier':oe_tc(subscription_change)), - ?nomatch(undefined, 'CosNotifyComm_PushSupplier':oe_tc(disconnect_push_supplier)), - ?match(undefined, 'CosNotifyComm_PushSupplier':oe_tc(undefined)), - ?match([_|_], 'CosNotifyComm_PushSupplier':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyComm/PushSupplier:1.0", - 'CosNotifyComm_PushSupplier':typeID()), - check_tc('CosNotifyComm_PushSupplier':oe_get_interface()), - ?match(true, 'CosNotifyComm_PushSupplier':oe_is_a('CosNotifyComm_PushSupplier':typeID())), - ?match(true, 'CosNotifyComm_PushSupplier':oe_is_a('CosNotifyComm_NotifySubscribe':typeID())), - ?match(true, 'CosNotifyComm_PushSupplier':oe_is_a('CosEventComm_PushSupplier':typeID())), - ?match(false, 'CosNotifyComm_PushSupplier':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyComm_SequencePullConsumer' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyComm_SequencePullConsumer'(_) -> - ?nomatch(undefined, 'CosNotifyComm_SequencePullConsumer':oe_tc(disconnect_sequence_pull_consumer)), - ?nomatch(undefined, 'CosNotifyComm_SequencePullConsumer':oe_tc(offer_change)), - ?match(undefined, 'CosNotifyComm_SequencePullConsumer':oe_tc(undefined)), - ?match([_|_], 'CosNotifyComm_SequencePullConsumer':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyComm/SequencePullConsumer:1.0", - 'CosNotifyComm_SequencePullConsumer':typeID()), - check_tc('CosNotifyComm_SequencePullConsumer':oe_get_interface()), - ?match(true, 'CosNotifyComm_SequencePullConsumer':oe_is_a('CosNotifyComm_SequencePullConsumer':typeID())), - ?match(true, 'CosNotifyComm_SequencePullConsumer':oe_is_a('CosNotifyComm_NotifyPublish':typeID())), - ?match(false, 'CosNotifyComm_SequencePullConsumer':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyComm_SequencePullSupplier' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyComm_SequencePullSupplier'(_) -> - ?nomatch(undefined, 'CosNotifyComm_SequencePullSupplier':oe_tc(pull_structured_events)), - ?nomatch(undefined, 'CosNotifyComm_SequencePullSupplier':oe_tc(try_pull_structured_events)), - ?nomatch(undefined, 'CosNotifyComm_SequencePullSupplier':oe_tc(disconnect_sequence_pull_supplier)), - ?nomatch(undefined, 'CosNotifyComm_SequencePullSupplier':oe_tc(subscription_change)), - ?match(undefined, 'CosNotifyComm_SequencePullSupplier':oe_tc(undefined)), - ?match([_|_], 'CosNotifyComm_SequencePullSupplier':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyComm/SequencePullSupplier:1.0", - 'CosNotifyComm_SequencePullSupplier':typeID()), - check_tc('CosNotifyComm_SequencePullSupplier':oe_get_interface()), - ?match(true, 'CosNotifyComm_SequencePullSupplier':oe_is_a('CosNotifyComm_SequencePullSupplier':typeID())), - ?match(true, 'CosNotifyComm_SequencePullSupplier':oe_is_a('CosNotifyComm_NotifySubscribe':typeID())), - ?match(false, 'CosNotifyComm_SequencePullSupplier':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyComm_SequencePushConsumer' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyComm_SequencePushConsumer'(_) -> - ?nomatch(undefined, 'CosNotifyComm_SequencePushConsumer':oe_tc(push_structured_events)), - ?nomatch(undefined, 'CosNotifyComm_SequencePushConsumer':oe_tc(disconnect_sequence_push_consumer)), - ?nomatch(undefined, 'CosNotifyComm_SequencePushConsumer':oe_tc(offer_change)), - ?match(undefined, 'CosNotifyComm_SequencePushConsumer':oe_tc(undefined)), - ?match([_|_], 'CosNotifyComm_SequencePushConsumer':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyComm/SequencePushConsumer:1.0", - 'CosNotifyComm_SequencePushConsumer':typeID()), - check_tc('CosNotifyComm_SequencePushConsumer':oe_get_interface()), - ?match(true, 'CosNotifyComm_SequencePushConsumer':oe_is_a('CosNotifyComm_SequencePushConsumer':typeID())), - ?match(true, 'CosNotifyComm_SequencePushConsumer':oe_is_a('CosNotifyComm_NotifyPublish':typeID())), - ?match(false, 'CosNotifyComm_SequencePushConsumer':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyComm_SequencePushSupplier' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyComm_SequencePushSupplier'(_) -> - ?nomatch(undefined, 'CosNotifyComm_SequencePushSupplier':oe_tc(disconnect_sequence_push_supplier)), - ?nomatch(undefined, 'CosNotifyComm_SequencePushSupplier':oe_tc(subscription_change)), - ?match(undefined, 'CosNotifyComm_SequencePushSupplier':oe_tc(undefined)), - ?match([_|_], 'CosNotifyComm_SequencePushSupplier':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyComm/SequencePushSupplier:1.0", - 'CosNotifyComm_SequencePushSupplier':typeID()), - check_tc('CosNotifyComm_SequencePushSupplier':oe_get_interface()), - ?match(true, 'CosNotifyComm_SequencePushSupplier':oe_is_a('CosNotifyComm_SequencePushSupplier':typeID())), - ?match(true, 'CosNotifyComm_SequencePushSupplier':oe_is_a('CosNotifyComm_NotifySubscribe':typeID())), - ?match(false, 'CosNotifyComm_SequencePushSupplier':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyComm_StructuredPullConsumer' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyComm_StructuredPullConsumer'(_) -> - ?nomatch(undefined, 'CosNotifyComm_StructuredPullConsumer':oe_tc(disconnect_structured_pull_consumer)), - ?nomatch(undefined, 'CosNotifyComm_StructuredPullConsumer':oe_tc(offer_change)), - ?match(undefined, 'CosNotifyComm_StructuredPullConsumer':oe_tc(undefined)), - ?match([_|_], 'CosNotifyComm_StructuredPullConsumer':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyComm/StructuredPullConsumer:1.0", - 'CosNotifyComm_StructuredPullConsumer':typeID()), - check_tc('CosNotifyComm_StructuredPullConsumer':oe_get_interface()), - ?match(true, 'CosNotifyComm_StructuredPullConsumer':oe_is_a('CosNotifyComm_StructuredPullConsumer':typeID())), - ?match(true, 'CosNotifyComm_StructuredPullConsumer':oe_is_a('CosNotifyComm_NotifyPublish':typeID())), - ?match(false, 'CosNotifyComm_StructuredPullConsumer':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyComm_StructuredPullSupplier' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyComm_StructuredPullSupplier'(_) -> - ?nomatch(undefined, 'CosNotifyComm_StructuredPullSupplier':oe_tc(pull_structured_event)), - ?nomatch(undefined, 'CosNotifyComm_StructuredPullSupplier':oe_tc(try_pull_structured_event)), - ?nomatch(undefined, 'CosNotifyComm_StructuredPullSupplier':oe_tc(disconnect_structured_pull_supplier)), - ?nomatch(undefined, 'CosNotifyComm_StructuredPullSupplier':oe_tc(subscription_change)), - ?match(undefined, 'CosNotifyComm_StructuredPullSupplier':oe_tc(undefined)), - ?match([_|_], 'CosNotifyComm_StructuredPullSupplier':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyComm/StructuredPullSupplier:1.0", - 'CosNotifyComm_StructuredPullSupplier':typeID()), - check_tc('CosNotifyComm_StructuredPullSupplier':oe_get_interface()), - ?match(true, 'CosNotifyComm_StructuredPullSupplier':oe_is_a('CosNotifyComm_StructuredPullSupplier':typeID())), - ?match(true, 'CosNotifyComm_StructuredPullSupplier':oe_is_a('CosNotifyComm_NotifySubscribe':typeID())), - ?match(false, 'CosNotifyComm_StructuredPullSupplier':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyComm_StructuredPushConsumer' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyComm_StructuredPushConsumer'(_) -> - ?nomatch(undefined, 'CosNotifyComm_StructuredPushConsumer':oe_tc(push_structured_event)), - ?nomatch(undefined, 'CosNotifyComm_StructuredPushConsumer':oe_tc(disconnect_structured_push_consumer)), - ?nomatch(undefined, 'CosNotifyComm_StructuredPushConsumer':oe_tc(offer_change)), - ?match(undefined, 'CosNotifyComm_StructuredPushConsumer':oe_tc(undefined)), - ?match([_|_], 'CosNotifyComm_StructuredPushConsumer':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyComm/StructuredPushConsumer:1.0", - 'CosNotifyComm_StructuredPushConsumer':typeID()), - check_tc('CosNotifyComm_StructuredPushConsumer':oe_get_interface()), - ?match(true, 'CosNotifyComm_StructuredPushConsumer':oe_is_a('CosNotifyComm_StructuredPushConsumer':typeID())), - ?match(true, 'CosNotifyComm_StructuredPushConsumer':oe_is_a('CosNotifyComm_NotifyPublish':typeID())), - ?match(false, 'CosNotifyComm_StructuredPushConsumer':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyComm_StructuredPushSupplier' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyComm_StructuredPushSupplier'(_) -> - ?nomatch(undefined, 'CosNotifyComm_StructuredPushSupplier':oe_tc(disconnect_structured_push_supplier)), - ?nomatch(undefined, 'CosNotifyComm_StructuredPushSupplier':oe_tc(subscription_change)), - ?match(undefined, 'CosNotifyComm_StructuredPushSupplier':oe_tc(undefined)), - ?match([_|_], 'CosNotifyComm_StructuredPushSupplier':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyComm/StructuredPushSupplier:1.0", - 'CosNotifyComm_StructuredPushSupplier':typeID()), - check_tc('CosNotifyComm_StructuredPushSupplier':oe_get_interface()), - ?match(true, 'CosNotifyComm_StructuredPushSupplier':oe_is_a('CosNotifyComm_StructuredPushSupplier':typeID())), - ?match(true, 'CosNotifyComm_StructuredPushSupplier':oe_is_a('CosNotifyComm_NotifySubscribe':typeID())), - ?match(false, 'CosNotifyComm_StructuredPushSupplier':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'oe_CosNotificationComm_Event' -%% Description: -%%----------------------------------------------------------------- -'oe_CosNotificationComm_Event'(_) -> - ?nomatch(undefined, 'oe_CosNotificationComm_Event':oe_tc(callSeq)), - ?nomatch(undefined, 'oe_CosNotificationComm_Event':oe_tc(callAny)), - ?match(undefined, 'oe_CosNotificationComm_Event':oe_tc(undefined)), - ?match([_|_], 'oe_CosNotificationComm_Event':oe_get_interface()), - ?match("IDL:oe_CosNotificationComm/Event:1.0", - 'oe_CosNotificationComm_Event':typeID()), - check_tc('oe_CosNotificationComm_Event':oe_get_interface()), - ?match(true, 'oe_CosNotificationComm_Event':oe_is_a('oe_CosNotificationComm_Event':typeID())), - ?match(false, 'oe_CosNotificationComm_Event':oe_is_a("wrong")), - ok. - - - - -%%----------------------------------------------------------------- -%% MISC functions -%%----------------------------------------------------------------- -check_tc([]) -> - ok; -check_tc([{Op, {RetType, InParameters, OutParameters}}|T]) -> - io:format("checked - ~s~n", [Op]), - lists:all(?checktc(Op), [RetType|InParameters]), - lists:all(?checktc(Op), OutParameters), - check_tc(T). - - diff --git a/lib/cosNotification/test/grammar_SUITE.erl b/lib/cosNotification/test/grammar_SUITE.erl deleted file mode 100644 index 536292fdee..0000000000 --- a/lib/cosNotification/test/grammar_SUITE.erl +++ /dev/null @@ -1,1091 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%-------------------------------------------------------------------- -%% File : grammar_SUITE.erl -%% Purpose : Testing the CosNotification BNF grammar. -%%-------------------------------------------------------------------- - --module(grammar_SUITE). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% cosEvent files. --include_lib("cosEvent/include/CosEventChannelAdmin.hrl"). -%% Application files --include_lib("cosNotification/include/CosNotification.hrl"). --include_lib("cosNotification/include/CosNotifyChannelAdmin.hrl"). --include_lib("cosNotification/include/CosNotifyComm.hrl"). --include_lib("cosNotification/include/CosNotifyFilter.hrl"). - --include_lib("cosNotification/src/CosNotification_Definitions.hrl"). - --include("idl_output/notify_test.hrl"). - --include_lib("common_test/include/ct.hrl"). - -%%--------------- DEFINES ------------------------------------ --define(default_timeout, test_server:minutes(20)). --define(match(ExpectedRes, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - ExpectedRes -> - io:format("------ CORRECT RESULT ------~n~p~n", - [AcTuAlReS]), - AcTuAlReS; - _ -> - io:format("###### ERROR ERROR ######~n~p~n", - [AcTuAlReS]), - exit(AcTuAlReS) - end - end()). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, - cases/0, init_per_suite/1, end_per_suite/1, - union_api/1, enum_api/1, simple_types_api/1, - components_api/1, positional_api/1, variable_api/1, - init_per_testcase/2, end_per_testcase/2]). - --import(cosNotification_Filter, [create_filter/1, eval/2]). - -%%----------------------------------------------------------------- -%% Func: all/1 -%% Args: -%% Returns: -%%----------------------------------------------------------------- -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - cases(). - -groups() -> - []. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -cases() -> - [variable_api, union_api, enum_api, simple_types_api, - components_api, positional_api]. - -%%----------------------------------------------------------------- -%% Init and cleanup functions. -%%----------------------------------------------------------------- -init_per_testcase(_Case, Config) -> - Path = code:which(?MODULE), - code:add_pathz(filename:join(filename:dirname(Path), "idl_output")), - Dog=test_server:timetrap(?default_timeout), - [{watchdog, Dog}|Config]. - - -end_per_testcase(_Case, Config) -> - Path = code:which(?MODULE), - code:del_path(filename:join(filename:dirname(Path), "idl_output")), - Dog = proplists:get_value(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. - -init_per_suite(Config) -> - Path = code:which(?MODULE), - code:add_pathz(filename:join(filename:dirname(Path), "idl_output")), - if - is_list(Config) -> - Config; - true -> - exit("Config not a list") - end. - -end_per_suite(Config) -> - Path = code:which(?MODULE), - code:del_path(filename:join(filename:dirname(Path), "idl_output")), - Config. - - -%%----------------------------------------------------------------- -%% simple types grammar tests -%%----------------------------------------------------------------- -simple_types_api(_Config) -> - %% Will always be true, no matter what kind of event we receive. - {ok,T1} = ?match({ok, _}, create_filter("2==2 and 3<4")), - ?match(true, eval(T1, ?not_CreateSE("DomainName","TypeName","EventName", - [],[], any:create(orber_tc:null(), null)))), - - %% Will always be true, no matter what kind of event we receive. - {ok,T2} = ?match({ok, _}, create_filter("")), - ?match(true, eval(T2, ?not_CreateSE("DomainName","TypeName","EventName", - [],[], any:create(orber_tc:null(), null)))), - - %% Check if $variable works - {ok,T3} = ?match({ok, _}, create_filter("$city == \'Berlin\'")), - ?match(true, eval(T3, ?not_CreateSE("DomainName","TypeName","EventName", - [#'CosNotification_Property'{name="city", - value=any:create(orber_tc:string(0), "Berlin")}], - [], any:create(orber_tc:null(), null)))), - ?match(false, eval(T3, ?not_CreateSE("DomainName","TypeName", "EventName", - [#'CosNotification_Property'{name="city", - value=any:create(orber_tc:string(0), "Dallas")}], - - [], any:create(orber_tc:null(), null)))), - - - {ok,T4} = ?match({ok, _}, create_filter("$zip == 44")), - ?match(true, eval(T4, ?not_CreateSE("DomainName","TypeName", "EventName", - [#'CosNotification_Property'{name="zip", - value=any:create(orber_tc:short(), 44)}], - - [], any:create(orber_tc:null(), null)))), - ?match(true, eval(T4, ?not_CreateSE("DomainName","TypeName", "EventName", - [],[], - any:create('CosNotification_Property':tc(), - #'CosNotification_Property' - {name="zip", - value=any:create(orber_tc:short(), - 44)})))), - ?match(false, eval(T4, ?not_CreateSE("DomainName","TypeName", "EventName", - [#'CosNotification_Property'{name="zip", - value=any:create(orber_tc:short(), 33)}], - - [], any:create(orber_tc:null(), null)))), - - %% Will always be true, no matter what kind of event we receive. - {ok,T5} = ?match({ok, _}, create_filter("\'oo'\~\'foobar\'")), - ?match(true, eval(T5, ?not_CreateSE("DomainName","TypeName","EventName", - [],[], any:create(orber_tc:null(), null)))), - %% Will always be false, no matter what kind of event we receive. - {ok,T6} = ?match({ok, _}, create_filter("\'o1'\~\'foobar\'")), - ?match(false, eval(T6, ?not_CreateSE("DomainName","TypeName","EventName", - [],[], any:create(orber_tc:null(), null)))), - - %% Can we apply the ~ operation as above using a variable - {ok,T7} = ?match({ok, _}, create_filter("$str~\'foobar\'")), - ?match(true, eval(T7, ?not_CreateSE("DomainName","TypeName","EventName", - [#'CosNotification_Property'{name="str", - value=any:create(orber_tc:string(0), "oo")}], - [], any:create(orber_tc:null(), null)))), - ?match(false, eval(T7, ?not_CreateSE("DomainName","TypeName","EventName", - [#'CosNotification_Property'{name="str", - value=any:create(orber_tc:string(0), "ok")}], - [], any:create(orber_tc:null(), null)))), - - - - {ok,_T8} = ?match({ok, _}, create_filter("$\\zip == 44444")), - - ok. - -%%----------------------------------------------------------------- -%% enum grammar tests -%%----------------------------------------------------------------- -enum_api(_Config) -> - %% Accept events whose 'in' enum is set to the value 'HOUSE' or 'CAR'. - {ok,T1} = ?match({ok, _}, create_filter("$.\\in == HOUSE or $.\\in == CAR")), - - ?match(true, eval(T1, any:create(orber_tc:alias("IFRId","in",tk_any), - any:create({tk_enum, "IFRId", "in", ["HOUSE", "CAR"]}, - 'HOUSE')))), - ?match(false, eval(T1, any:create(orber_tc:alias("IFRId","in",tk_any), - any:create({tk_enum, "IFRId", "in", ["HOUSE", "CAR"]}, - 'GARAGE')))), - ok. - - -%%----------------------------------------------------------------- -%% Union grammar tests -%%----------------------------------------------------------------- -union_api(_Config) -> - {ok,T1} = ?match({ok, _}, create_filter("exist $.uni1._d and $.uni1._d == 1 and $.uni1.(1) == 10")), - {ok,T2} = ?match({ok, _}, create_filter("default $.uni1._d and $.uni1.() == 10")), - {ok,T3} = ?match({ok, _}, create_filter("default $.uni1._d and $.uni1.(999) == 10")), - ?match(true, eval(T1, ?not_CreateSE("DomainName","CommunicationsAlarm", - "EventName",[],[], - any:create(orber_tc:alias("IDL:notify_test/namedAny:1.0", - "uni1", - tk_any), - any:create(notify_test_uni1:tc(), - #notify_test_uni1{label= 1, - value=10}))))), - ?match(true, eval(T2, ?not_CreateSE("DomainName","CommunicationsAlarm", - "EventName",[],[], - any:create(orber_tc:alias("IDL:notify_test/namedAny:1.0", - "uni1", - tk_any), - any:create(notify_test_uni1:tc(), - #notify_test_uni1{label= 100, - value=10}))))), - ?match(true, eval(T3, ?not_CreateSE("DomainName","CommunicationsAlarm", - "EventName",[],[], - any:create(orber_tc:alias("IDL:notify_test/namedAny:1.0", - "uni1", - tk_any), - any:create(notify_test_uni1:tc(), - #notify_test_uni1{label= 100, - value=10}))))), - ?match(true, eval(T1, any:create(orber_tc:alias("IDL:notify_test/namedAny:1.0", - "uni1", - tk_any), - any:create(notify_test_uni1:tc(), - #notify_test_uni1{label= 1, - value=10})))), - ?match(false, eval(T2, any:create(orber_tc:alias("IDL:notify_test/namedAny:1.0", - "uni1", - tk_any), - any:create(notify_test_uni1:tc(), - #notify_test_uni1{label= 1, - value=10})))), - ?match(false, eval(T3, any:create(orber_tc:alias("IDL:notify_test/namedAny:1.0", - "uni1", - tk_any), - any:create(notify_test_uni1:tc(), - #notify_test_uni1{label= 1, - value=10})))), - ?match(true, eval(T1, ?not_CreateSE("DomainName","CommunicationsAlarm", - "EventName",[],[], - any:create(notify_test_studies:tc(), #notify_test_studies - {uni1 = #notify_test_uni1{label= 1, value=10}, - gpa = 90, - tests = [#'CosNotification_Property' - {name="midterm", value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property' - {name="final", value=any:create(orber_tc:short(), 60)}], - monthly_attendance = {0,1,2,10}})))), - ?match(false, eval(T2, ?not_CreateSE("DomainName","CommunicationsAlarm", - "EventName",[],[], - any:create(notify_test_studies:tc(), #notify_test_studies - {uni1 = #notify_test_uni1{label= 1, value=10}, - gpa = 90, - tests = [#'CosNotification_Property' - {name="midterm", value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property' - {name="final", value=any:create(orber_tc:short(), 60)}], - monthly_attendance = {0,1,2,10}})))), - ?match(false, eval(T3, ?not_CreateSE("DomainName","CommunicationsAlarm", - "EventName",[],[], - any:create(notify_test_studies:tc(), #notify_test_studies - {uni1 = #notify_test_uni1{label= 1, value=10}, - gpa = 90, - tests = [#'CosNotification_Property' - {name="midterm", value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property' - {name="final", value=any:create(orber_tc:short(), 60)}], - monthly_attendance = {0,1,2,10}})))), - ?match(true, eval(T1, any:create(notify_test_studies:tc(), #notify_test_studies - {uni1 = #notify_test_uni1{label= 1, value=10}, - gpa = 90, - tests = [#'CosNotification_Property' - {name="midterm", value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property' - {name="final", value=any:create(orber_tc:short(), 60)}], - monthly_attendance = {0,1,2,10}}))), - ?match(false, eval(T2, any:create(notify_test_studies:tc(), #notify_test_studies - {uni1 = #notify_test_uni1{label= 1, value=10}, - gpa = 90, - tests = [#'CosNotification_Property' - {name="midterm", value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property' - {name="final", value=any:create(orber_tc:short(), 60)}], - monthly_attendance = {0,1,2,10}}))), - ?match(false, eval(T3, any:create(notify_test_studies:tc(), #notify_test_studies - {uni1 = #notify_test_uni1{label= 1, value=10}, - gpa = 90, - tests = [#'CosNotification_Property' - {name="midterm", value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property' - {name="final", value=any:create(orber_tc:short(), 60)}], - monthly_attendance = {0,1,2,10}}))), - - {ok,T4} = ?match({ok, _}, create_filter("exist $.alias.uni1._d and $.alias.uni1._d == 1 and $.alias.uni1.(1) == 10")), - ?match(true, eval(T4, ?not_CreateSE("DomainName","CommunicationsAlarm", - "EventName",[],[], - any:create(orber_tc:alias(notify_test_studies:id(), - "alias", - notify_test_studies:tc()), - #notify_test_studies - {uni1 = #notify_test_uni1{label= 1, value=10}, - gpa = 90, tests = [], - monthly_attendance = {0,1,2,10}})))), - ?match(true, eval(T4, any:create(orber_tc:alias(notify_test_studies:id(), - "alias", - notify_test_studies:tc()), - #notify_test_studies - {uni1 = #notify_test_uni1{label= 1, value=10}, - gpa = 90, tests = [], - monthly_attendance = {0,1,2,10}}))), - %% Accept events with a default union discriminator set to the value 2. - {ok,T5} = ?match({ok, _}, create_filter("default $._d and $.defvalue == 2")), - ?match(true, eval(T5, any:create(notify_test_uni1:tc(), - #notify_test_uni1{label= 100, value=2}))), - %% label not default. - ?match(false, eval(T5, any:create(notify_test_uni1:tc(), - #notify_test_uni1{label= 2, value=2}))), - %% Default does not exist (nor the component defvalue) - ?match(false, eval(T5, any:create(notify_test_uni2:tc(), - #notify_test_uni2{label= 100, value=2}))), - %% Both wrong - ?match(false, eval(T5, any:create(notify_test_uni2:tc(), - #notify_test_uni2{label= 2, value=2}))), - - {ok,T6} = ?match({ok, _}, create_filter("default $._d and $.(-8) == 2")), - ?match(true, eval(T6, any:create(notify_test_uni1:tc(), - #notify_test_uni1{label= 100, value=2}))), - %% label not default. - ?match(false, eval(T6, any:create(notify_test_uni1:tc(), - #notify_test_uni1{label= 2, value=2}))), - %% Default does not exist (nor the component defvalue) - ?match(false, eval(T6, any:create(notify_test_uni2:tc(), - #notify_test_uni2{label= 100, value=2}))), - %% Both wrong - ?match(false, eval(T6, any:create(notify_test_uni2:tc(), - #notify_test_uni2{label= 2, value=2}))), - %% the same as the above, but we try to access a label that is not default - {ok,T7} = ?match({ok, _}, create_filter("default $._d and $.(2) == 2")), - ?match({error, _}, eval(T7, any:create(notify_test_uni1:tc(), - #notify_test_uni1{label= 100, value=2}))), - - %% Must be a default-union with its 'defvalue' set to 2. - {ok,T8} = ?match({ok, _}, create_filter("default $._d and $.('defvalue') == 2")), - ?match(true, eval(T8, any:create(notify_test_uni1:tc(), - #notify_test_uni1{label= 100, value=2}))), - %% label not default. - ?match(false, eval(T8, any:create(notify_test_uni1:tc(), - #notify_test_uni1{label= 2, value=2}))), - %% Default does not exist (nor the component defvalue) - ?match(false, eval(T8, any:create(notify_test_uni2:tc(), - #notify_test_uni2{label= 100, value=2}))), - %% Both wrong - ?match(false, eval(T8, any:create(notify_test_uni2:tc(), - #notify_test_uni2{label= 2, value=2}))), - - %% Must be a default-union with its value set to 2. - {ok,T9} = ?match({ok, _}, create_filter("default $._d and $.(+100) == 2")), - ?match(true, eval(T9, any:create(notify_test_uni1:tc(), - #notify_test_uni1{label= 100, value=2}))), - %% label not default. - ?match(false, eval(T9, any:create(notify_test_uni1:tc(), - #notify_test_uni1{label= 2, value=2}))), - %% Default does not exist (nor the component defvalue) - ?match(false, eval(T9, any:create(notify_test_uni2:tc(), - #notify_test_uni2{label= 100, value=2}))), - %% Both wrong - ?match(false, eval(T9, any:create(notify_test_uni2:tc(), - #notify_test_uni2{label= 2, value=2}))), - - %% So far, we have only tested to access the union itself. No will use more - %% complex union members. - %% T10 and T11 is "equal" - {ok,T10} = ?match({ok, _}, create_filter("$.M < 54")), - {ok,T11} = ?match({ok, _}, create_filter("$.(5) < 54")), - ?match(false, eval(T10, any:create(notify_test_K:tc(), - #notify_test_K{label= 5, value=54}))), - ?match(false, eval(T11, any:create(notify_test_K:tc(), - #notify_test_K{label= 5, value=54}))), - ?match(true, eval(T10, any:create(notify_test_K:tc(), - #notify_test_K{label= 5, value=50}))), - ?match(true, eval(T11, any:create(notify_test_K:tc(), - #notify_test_K{label= 5, value=50}))), - ?match({error,_}, eval(T10, any:create(notify_test_K:tc(), - #notify_test_K{label= -1, value=50}))), - ?match({error,_}, eval(T11, any:create(notify_test_K:tc(), - #notify_test_K{label= -1, value=50}))), - - %% T12 and T13 is "equal" - {ok,T12} = ?match({ok, _}, create_filter("$.L.C < 128")), - {ok,T13} = ?match({ok, _}, create_filter("$.(3).2 < 128")), - ?match(true, eval(T12, any:create(notify_test_K:tc(), - #notify_test_K{label= 3, value= - #notify_test_X{'A' = 1, - 'B' = "string", - 'C' = 120}}))), - ?match(true, eval(T13, any:create(notify_test_K:tc(), - #notify_test_K{label= 3, value= - #notify_test_X{'A' = 1, - 'B' = "string", - 'C' = 120}}))), - ?match(false, eval(T12, any:create(notify_test_K:tc(), - #notify_test_K{label= 3, value= - #notify_test_X{'A' = 1, - 'B' = "string", - 'C' = 200}}))), - ?match(false, eval(T13, any:create(notify_test_K:tc(), - #notify_test_K{label= 3, value= - #notify_test_X{'A' = 1, - 'B' = "string", - 'C' = 200}}))), - - %% Test if 'putty' is a substring of K - {ok,T15} = ?match({ok, _}, create_filter("'putty' ~ $.(2)")), - {ok,T16} = ?match({ok, _}, create_filter("'putty' ~ $.K")), - ?match(true, eval(T15, any:create(notify_test_K:tc(), - #notify_test_K{label= 2, value= "isputtyok"}))), - ?match(true, eval(T16, any:create(notify_test_K:tc(), - #notify_test_K{label= 2, value= "isputtyok"}))), - ?match(false, eval(T15, any:create(notify_test_K:tc(), - #notify_test_K{label= 2, value= "notputtok"}))), - ?match(false, eval(T16, any:create(notify_test_K:tc(), - #notify_test_K{label= 2, value= "notputtok"}))), - - {ok,_T17} = ?match({ok, _}, create_filter("'putty' ~ $.(3).1")), - {ok,_T18} = ?match({ok, _}, create_filter("'putty' ~ $.L.B")), - ?match(true, eval(T12, any:create(notify_test_K:tc(), - #notify_test_K{label= 3, value= - #notify_test_X{'A' = 1, - 'B' = "isputtyok", - 'C' = 120}}))), - ?match(true, eval(T13, any:create(notify_test_K:tc(), - #notify_test_K{label= 3, value= - #notify_test_X{'A' = 1, - 'B' = "isputtyok", - 'C' = 120}}))), - ?match(false, eval(T12, any:create(notify_test_K:tc(), - #notify_test_K{label= 3, value= - #notify_test_X{'A' = 1, - 'B' = "notputtok", - 'C' = 200}}))), - ?match(false, eval(T13, any:create(notify_test_K:tc(), - #notify_test_K{label= 3, value= - #notify_test_X{'A' = 1, - 'B' = "notputtok", - 'C' = 200}}))), - - %% Please observe that the switch 0 and 2 is defined to be equivalent. - {ok,T19} = ?match({ok, _}, create_filter("$._d == 2 and $.(0) != 'hoob'")), - {ok,T20} = ?match({ok, _}, create_filter("$._d == 2 and $.(2) != 'hoob'")), - ?match(true, eval(T19, any:create(notify_test_K:tc(), - #notify_test_K{label= 2, value= "nothoob"}))), - ?match(true, eval(T20, any:create(notify_test_K:tc(), - #notify_test_K{label= 2, value= "nothoob"}))), - ?match(false, eval(T19, any:create(notify_test_K:tc(), - #notify_test_K{label= 2, value= "hoob"}))), - ?match(false, eval(T20, any:create(notify_test_K:tc(), - #notify_test_K{label= 2, value= "hoob"}))), - - ?match(false, eval(T19, any:create(notify_test_K:tc(), - #notify_test_K{label= 5, value= 55}))), - ?match(false, eval(T20, any:create(notify_test_K:tc(), - #notify_test_K{label= 5, value= 55}))), - - ?match(false, eval(T19, any:create(notify_test_K:tc(), - #notify_test_K{label= 100, value= "nothoob"}))), - ?match(false, eval(T20, any:create(notify_test_K:tc(), - #notify_test_K{label= 100, value= "nothoob"}))), - - {ok,T21} = ?match({ok, _}, create_filter("exist $.K")), - {ok,T22} = ?match({ok, _}, create_filter("exist $.(0) or exist $.(2)")), - ?match(true, eval(T21, any:create(notify_test_K:tc(), - #notify_test_K{label= 0, value= "hoob"}))), - ?match(true, eval(T22, any:create(notify_test_K:tc(), - #notify_test_K{label= 0, value= "hoob"}))), - ?match(true, eval(T21, any:create(notify_test_K:tc(), - #notify_test_K{label= 2, value= "hoob"}))), - ?match(true, eval(T22, any:create(notify_test_K:tc(), - #notify_test_K{label= 2, value= "hoob"}))), - ?match(false, eval(T21, any:create(notify_test_K:tc(), - #notify_test_K{label= 5, value= 55}))), - ?match(false, eval(T22, any:create(notify_test_K:tc(), - #notify_test_K{label= 5, value= 55}))), - - - %% Please observe that the switch 0 and 2 is defined to be equivalent. - {ok,T23} = ?match({ok, _}, create_filter("exist $.(2)")), - {ok,T24} = ?match({ok, _}, create_filter("exist $.(0)")), - ?match(true, eval(T23, any:create(notify_test_K:tc(), - #notify_test_K{label= 2, value= "hoob"}))), - ?match(false, eval(T24, any:create(notify_test_K:tc(), - #notify_test_K{label= 2, value= "hoob"}))), - ?match(false, eval(T23, any:create(notify_test_K:tc(), - #notify_test_K{label= 0, value= "hoob"}))), - ?match(true, eval(T24, any:create(notify_test_K:tc(), - #notify_test_K{label= 0, value= "hoob"}))), - ?match(false, eval(T23, any:create(notify_test_K:tc(), - #notify_test_K{label= 5, value= 55}))), - ?match(false, eval(T24, any:create(notify_test_K:tc(), - #notify_test_K{label= 5, value= 55}))), - - ok. - -%%----------------------------------------------------------------- -%% Variables grammar tests -%%----------------------------------------------------------------- -variable_api(_Config) -> - %% Accept all "CommunicationsAlarm" events - {ok,T0} = ?match({ok, _}, create_filter("$type_name == 'CommunicationsAlarm'")), - - ?match(true, eval(T0, ?not_CreateSE("DomainName","CommunicationsAlarm", - "EventName",[],[], - any:create(orber_tc:null(), null)))), - ?match(false, eval(T0, ?not_CreateSE("DomainName","CommunicationsOK", - "EventName", [],[], - any:create(orber_tc:null(), null)))), - ?match(true, eval(T0, ?not_CreateSE("DomainName","CommunicationsAlarm", - "EventName", [],[], - any:create(orber_tc:alias("IFRId", "type_name", - orber_tc:string(0)), - "CommunicationsOK")))), - - ?match(true, eval(T0, any:create(orber_tc:alias("IFRId", "type_name", - orber_tc:string(0)), - "CommunicationsAlarm"))), - ?match(false, eval(T0, any:create(orber_tc:alias("IFRId", "type_name", - orber_tc:string(0)), - "CommunicationsOK"))), - - - %% Accept all "CommunicationsAlarm" events but no "lost_packet" messages. - {ok,T1} = ?match({ok, _}, create_filter("$type_name == 'CommunicationsAlarm' and not ($event_name == 'lost_packet')")), - - ?match(true, eval(T1, ?not_CreateSE("DomainName","CommunicationsAlarm", - "EventName",[],[], - any:create(orber_tc:null(), null)))), - ?match(false, eval(T1, ?not_CreateSE("DomainName","CommunicationsAlarm", - "lost_packet", [],[], - any:create(orber_tc:null(), null)))), - ?match(true, - eval(T1, any:create(orber_tc:sequence('CosNotification_Property':tc(),0), - [#'CosNotification_Property'{name="type_name", - value=any:create(orber_tc:string(0), "CommunicationsAlarm")}, - #'CosNotification_Property'{name="event_name", - value=any:create(orber_tc:string(0), "EventName")}]))), - ?match(false, - eval(T1, any:create(orber_tc:sequence('CosNotification_Property':tc(),0), - [#'CosNotification_Property'{name="type_name", - value=any:create(orber_tc:string(0), "CommunicationsAlarm")}, - #'CosNotification_Property'{name="event_name", - value=any:create(orber_tc:string(0), "lost_packet")}]))), - - - %% Accept "CommunicationsAlarm" events with priorities ranging from 1 to 5. - {ok,T2} = ?match({ok, _}, create_filter("$type_name == 'CommunicationsAlarm' and $priority >= 1 and $priority <= 5")), - ?match(true, eval(T2, ?not_CreateSE("DomainName","CommunicationsAlarm", - "EventName", - [#'CosNotification_Property'{name="priority", - value=any:create(orber_tc:short(), 2)}], - [], any:create(orber_tc:null(), null)))), - ?match(false, eval(T2, ?not_CreateSE("DomainName","CommunicationsAlarm", - "EventName", - [#'CosNotification_Property'{name="priority", - value=any:create(orber_tc:short(), 20)}], - [], any:create(orber_tc:null(), null)))), - - %% Select "MOVIE" events featuring at least 3 of the Marx Brothers. - {ok,T3} = ?match({ok, _}, create_filter("$type_name == 'MOVIE' and (('groucho' in $starlist) + ('chico' in $starlist) + ('harpo' in $starlist) + ('zeppo' in $starlist) + ('gummo' in $starlist)) > 2")), - ?match(true, eval(T3, ?not_CreateSE("DomainName","MOVIE", - "EventName", - [#'CosNotification_Property'{name="starlist", - value=any:create(orber_tc:sequence(orber_tc:string(0),0), - ["groucho", "harpo", "sam", "gummo"])}], - [], any:create(orber_tc:null(), null)))), - ?match(false, eval(T3, ?not_CreateSE("DomainName","MOVIE", - "EventName", - [#'CosNotification_Property'{name="starlist", - value=any:create(orber_tc:sequence(orber_tc:string(0),0), - ["frodo", "bilbo", "sam", "gummo"])}], - [], any:create(orber_tc:null(), null)))), - %% Accept students that took all 3 tests and had an average score of at least 80%. - {ok,T4} = ?match({ok, _}, create_filter("$test._length == 3 and ($test[0].score + $test[1].score + $test[2].score)/3 >=80")), - ?match(true, eval(T4, ?not_CreateSE("DomainName","TypeName", - "EventName", [], - [#'CosNotification_Property'{name="test", - value=any:create(orber_tc:array(notify_test_data:tc(),0), - {#notify_test_data{score=75}, - #notify_test_data{score=80}, - #notify_test_data{score=85}})}], - any:create(orber_tc:null(), null)))), - ?match(false, eval(T4, ?not_CreateSE("DomainName","TypeName", - "EventName", [], - [#'CosNotification_Property'{name="test", - value=any:create(orber_tc:array(notify_test_data:tc(),0), - {#notify_test_data{score=75}, - #notify_test_data{score=80}, - #notify_test_data{score=80}})}], - any:create(orber_tc:null(), null)))), - ?match(false, eval(T4, ?not_CreateSE("DomainName","TypeName", - "EventName", [], - [#'CosNotification_Property'{name="test", - value=any:create(orber_tc:array(notify_test_data:tc(),0), - {#notify_test_data{score=75}, - #notify_test_data{score=85}})}], - any:create(orber_tc:null(), null)))), - %% Select processes that exceed a certain usage threshold. - {ok,T5} = ?match({ok, _}, create_filter("$memsize / 5.5 + $cputime * 1275.0 + $filesize * 1.25 > 500000.0")), - ?match(true, eval(T5, ?not_CreateSE("DomainName","TypeName", - "EventName", [], - [#'CosNotification_Property'{name="memsize", - value=any:create(orber_tc:float(), 5.5)}, - #'CosNotification_Property'{name="cputime", - value=any:create(orber_tc:float(), 0.00078431137)}, - #'CosNotification_Property'{name="filesize", - value=any:create(orber_tc:float(), 500000)}], - any:create(orber_tc:null(), null)))), - ?match(false, eval(T5, ?not_CreateSE("DomainName","TypeName", - "EventName", [], - [#'CosNotification_Property'{name="memsize", - value=any:create(orber_tc:float(), 5.5)}, - #'CosNotification_Property'{name="cputime", - value=any:create(orber_tc:float(), 0.00078431137)}, - #'CosNotification_Property'{name="filesize", - value=any:create(orber_tc:float(), 500)}], - any:create(orber_tc:null(), null)))), - ?match({error, _}, eval(T5, ?not_CreateSE("DomainName","TypeName", - "EventName", [], - [#'CosNotification_Property'{name="memsize", - value=any:create(orber_tc:float(), 5.5)}, - #'CosNotification_Property'{name="filesize", - value=any:create(orber_tc:float(), 500)}], - any:create(orber_tc:null(), null)))), - - ?match(true, eval(T5, ?not_CreateSE("DomainName","TypeName", - "EventName", [], [], - any:create(orber_tc:sequence('CosNotification_Property':tc(),0), - [#'CosNotification_Property'{name="memsize", - value=any:create(orber_tc:float(), 5.5)}, - #'CosNotification_Property'{name="cputime", - value=any:create(orber_tc:float(), 0.00078431137)}, - #'CosNotification_Property'{name="filesize", - value=any:create(orber_tc:float(), 500000)}])))), - ?match(false, eval(T5, ?not_CreateSE("DomainName","TypeName", - "EventName", [], [], - any:create(orber_tc:sequence('CosNotification_Property':tc(),0), - [#'CosNotification_Property'{name="memsize", - value=any:create(orber_tc:float(), 5.5)}, - #'CosNotification_Property'{name="cputime", - value=any:create(orber_tc:float(), 0.00078431137)}, - #'CosNotification_Property'{name="filesize", - value=any:create(orber_tc:float(), 500)}])))), - ?match({error, _}, eval(T5, ?not_CreateSE("DomainName","TypeName", - "EventName", [], [], - any:create(orber_tc:sequence('CosNotification_Property':tc(),0), - [#'CosNotification_Property'{name="memsize", - value=any:create(orber_tc:float(), 5.5)}, - #'CosNotification_Property'{name="filesize", - value=any:create(orber_tc:float(), 500)}])))), - - ?match(true, eval(T5, any:create(orber_tc:sequence('CosNotification_Property':tc(),0), - [#'CosNotification_Property'{name="memsize", - value=any:create(orber_tc:float(), 5.5)}, - #'CosNotification_Property'{name="cputime", - value=any:create(orber_tc:float(), 0.00078431137)}, - #'CosNotification_Property'{name="filesize", - value=any:create(orber_tc:float(), 500000)}]))), - ?match(false, eval(T5, any:create(orber_tc:sequence('CosNotification_Property':tc(),0), - [#'CosNotification_Property'{name="memsize", - value=any:create(orber_tc:float(), 5.5)}, - #'CosNotification_Property'{name="cputime", - value=any:create(orber_tc:float(), 0.00078431137)}, - #'CosNotification_Property'{name="filesize", - value=any:create(orber_tc:float(), 500)}]))), - ?match({error, _}, eval(T5, any:create(orber_tc:sequence('CosNotification_Property':tc(),0), - [#'CosNotification_Property'{name="memsize", - value=any:create(orber_tc:float(), 5.5)}, - #'CosNotification_Property'{name="filesize", - value=any:create(orber_tc:float(), 500)}]))), - - %% Accept events where a threshold has the unscoped type name 'data'. - {ok,T6} = ?match({ok, _}, create_filter("exist $threshold._type_id and $threshold._type_id == 'data'")), - ?match(true, eval(T6, any:create(orber_tc:alias(notify_test_data:id(), - "threshold", - notify_test_data:tc()), - #notify_test_data{score = 10, name = "Erlang"}))), - - - - ?match(true, eval(T6, ?not_CreateSE("DomainName","TypeName", - "EventName", [], - [#'CosNotification_Property' - {name="threshold", - value=any:create(notify_test_data:tc(), - #notify_test_data - {score = 10, - name = "Erlang"})}], - any:create(orber_tc:null(), null)))), - - - ?match(true, eval(T6, ?not_CreateSE("DomainName","TypeName", - "EventName", [], - [#'CosNotification_Property' - {name="NotThreshold", - value=any:create(notify_test_data:tc(), - #notify_test_data - {score = 10, - name = "Erlang"})}], - any:create(orber_tc:alias(notify_test_data:id(), - "threshold", - notify_test_data:tc()), - #notify_test_data{score = 10, name = "Erlang"})))), - - - - %% Accept events with a serviceUser property of the correct standard type. - {ok,T7} = ?match({ok, _}, create_filter("$violation(TestData)._repos_id == 'IDL:notify_test/data:1.0'")), - ?match(true, eval(T7, ?not_CreateSE("DomainName","TypeName", - "EventName", [], - [#'CosNotification_Property' - {name="violation", - value=any:create(orber_tc:array('CosNotification_Property':tc(),0), - [#'CosNotification_Property' - {name="TestData", - value=any:create(notify_test_data:tc(), - #notify_test_data - {score=100, - name="perfect score"})}])}], - any:create(orber_tc:null(), null)))), - - {ok,T8} = ?match({ok, _}, create_filter("$type_name == 'CommunicationsAlarm' and $event_name == 'lost_packet' and $priority < 2")), - %% All correct - Event1 = ?not_CreateSE("DomainName","CommunicationsAlarm", - "lost_packet", - [#'CosNotification_Property'{name="priority", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)), - %% Priority to high - Event2 = ?not_CreateSE("DomainName","CommunicationsAlarm", - "lost_packet", - [#'CosNotification_Property'{name="priority", - value=any:create(orber_tc:short(), 2)}], - [], any:create(orber_tc:null(), null)), - %% Misspell event_name, i.e., lost_packets instead of lost_packet - Event3 = ?not_CreateSE("DomainName","CommunicationsAlarm", - "lost_packets", - [#'CosNotification_Property'{name="priority", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)), - %% Another type_name - Event4 = ?not_CreateSE("DomainName","TemperatureAlarm", - "lost_packets", - [#'CosNotification_Property'{name="priority", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)), - - ?match(true, eval(T8, Event1)), - ?match(false, eval(T8, Event2)), - ?match(false, eval(T8, Event3)), - ?match(false, eval(T8, Event4)), - - {ok,T9} = ?match({ok, _}, create_filter("$gpa < 80 or $tests(midterm) > $tests(final) or $monthly_attendance[3] < 10")), - - %% midterm > final yields true, the others false - Event5 = ?not_CreateSE("DomainName","TypeName", - "EventName", [], - [#'CosNotification_Property' - {name="tests", - value=any:create(orber_tc:array('CosNotification_Property':tc(),0), - [#'CosNotification_Property'{name="midterm", - value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property'{name="final", - value=any:create(orber_tc:short(), 60)}])}, - #'CosNotification_Property'{name="monthly_attendance", - value=any:create(orber_tc:array(orber_tc:short(), 0), - {0,1,2,10})}, - #'CosNotification_Property'{name="gpa", - value=any:create(orber_tc:short(), 90)}], - any:create(orber_tc:null(), null)), - - %% monthly_attendance[3] < 10 yields true, the others false - Event6 = ?not_CreateSE("DomainName","TypeName", - "EventName", [], - [#'CosNotification_Property'{name="tests", - value=any:create(orber_tc:array('CosNotification_Property':tc(),0), - [#'CosNotification_Property'{name="midterm", - value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property'{name="final", - value=any:create(orber_tc:short(), 80)}])}, - #'CosNotification_Property'{name="monthly_attendance", - value=any:create(orber_tc:array(orber_tc:short(), 0), - {0,1,2,9})}, - #'CosNotification_Property'{name="gpa", - value=any:create(orber_tc:short(), 90)}], - any:create(orber_tc:null(), null)), - - %% gpa < 80 true, rest false. - Event7 = ?not_CreateSE("DomainName","TypeName", - "EventName", [], - [#'CosNotification_Property'{name="tests", - value=any:create(orber_tc:array('CosNotification_Property':tc(),0), - [#'CosNotification_Property'{name="midterm", - value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property'{name="final", - value=any:create(orber_tc:short(), 80)}])}, - #'CosNotification_Property'{name="monthly_attendance", - value=any:create(orber_tc:array(orber_tc:short(), 0), - {0,1,2,10})}, - #'CosNotification_Property'{name="gpa", - value=any:create(orber_tc:short(), 70)}], - any:create(orber_tc:null(), null)), - - %% All false - Event8 = ?not_CreateSE("DomainName","TypeName", - "EventName", [], - [#'CosNotification_Property'{name="tests", - value=any:create(orber_tc:array('CosNotification_Property':tc(),0), - [#'CosNotification_Property'{name="midterm", - value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property'{name="final", - value=any:create(orber_tc:short(), 80)}])}, - #'CosNotification_Property'{name="monthly_attendance", - value=any:create(orber_tc:array(orber_tc:short(), 0), - {0,1,2,10})}, - #'CosNotification_Property'{name="gpa", - value=any:create(orber_tc:short(), 80)}], - any:create(orber_tc:null(), null)), - - ?match(true, eval(T9, Event5)), - ?match(true, eval(T9, Event6)), - ?match(true, eval(T9, Event7)), - ?match(false, eval(T9, Event8)), - ok. - -%%----------------------------------------------------------------- -%% Misc grammar tests -%%----------------------------------------------------------------- -positional_api(_Config) -> - {ok,T1} = ?match({ok, _}, create_filter("$.3 < 80 or $.1(midterm) > $.1(final) or $.2[3] < 10")), - - %% midterm > final yields true, the others false - Event1 = any:create(notify_test_studies:tc(), #notify_test_studies - {gpa = 90, - tests = [#'CosNotification_Property' - {name="midterm", value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property' - {name="final", value=any:create(orber_tc:short(), 60)}], - monthly_attendance = {0,1,2,10}}), - %% monthly_attendance[3] < 10 yields true, the others false - Event2 = any:create(notify_test_studies:tc(), #notify_test_studies - {gpa = 90, - tests = [#'CosNotification_Property' - {name="midterm", value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property' - {name="final", value=any:create(orber_tc:short(), 80)}], - monthly_attendance = {0,1,2,9}}), - %% gpa < 80 true, rest false. - Event3 = any:create(notify_test_studies:tc(), #notify_test_studies - {gpa = 70, - tests = [#'CosNotification_Property' - {name="midterm", value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property' - {name="final", value=any:create(orber_tc:short(), 80)}], - monthly_attendance = {0,1,2,10}}), - %% All false - Event4 = any:create(notify_test_studies:tc(), #notify_test_studies - {gpa = 80, - tests = [#'CosNotification_Property' - {name="midterm", value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property' - {name="final", value=any:create(orber_tc:short(), 80)}], - monthly_attendance = {0,1,2,10}}), - - ?match(true, eval(T1, Event1)), - ?match(true, eval(T1, Event2)), - ?match(true, eval(T1, Event3)), - ?match(false, eval(T1, Event4)), - - {ok,T2} = ?match({ok, _}, create_filter("$.0.0.0.1 == 'CommunicationsAlarm'")), - - Event5 = ?not_CreateSE("DomainName","CommunicationsAlarm", - "lost_packet", [], [], - any:create(orber_tc:null(), null)), - - ?match(true, eval(T2, Event5)), - - ok. - -%%----------------------------------------------------------------- -%% Components grammar tests -%%----------------------------------------------------------------- -components_api(_Config) -> - {ok,T1} = ?match({ok, _}, create_filter("$ == 2")), - ?match(true, eval(T1, ?not_CreateSE("DomainName","TypeName","EventName", - [],[], any:create(orber_tc:short(), 2)))), - ?match(true, eval(T1, any:create(orber_tc:short(), 2))), - ?match(false, eval(T1, ?not_CreateSE("DomainName","TypeName","EventName", - [],[], any:create(orber_tc:short(), 3)))), - ?match(false, eval(T1, any:create(orber_tc:short(), 3))), - - %% Select "MOVIE" events featuring at least 3 of the Marx Brothers. - {ok,T2} = ?match({ok, _}, create_filter("$type_name == 'MOVIE' and (('groucho' in $.starlist) + ('chico' in $.starlist) + ('harpo' in $.starlist) + ('zeppo' in $.starlist) + ('gummo' in $.starlist)) > 2")), - ?match(true, eval(T2, ?not_CreateSE("DomainName","MOVIE", "EventName", [], [], - any:create(orber_tc:alias("IFRId","starlist",tk_any), - any:create(orber_tc:sequence(orber_tc:string(0),0), - ["groucho", "harpo", "sam", "gummo"]))))), - ?match(false, eval(T2, ?not_CreateSE("DomainName","MOVIE", "EventName", [], [], - any:create(orber_tc:alias("IFRId","starlist",tk_any), - any:create(orber_tc:sequence(orber_tc:string(0),0), - ["frodo", "bilbo", "sam", "gummo"]))))), - - %% Accept only recent events (e.g., generated within the last 15 minutes or so). - {ok,_T3} = ?match({ok, _}, create_filter("$origination_timestamp.high + 2 < $curtime.high")), - - - %% Accept students that took all 3 tests and had an average score of at least 80%. - {ok,T4} = ?match({ok, _}, create_filter("$.test._length == 3 and ($.test[0].score + $.test[1].score + $.test[2].score)/3 >=80")), - ?match(true, eval(T4, ?not_CreateSE("DomainName","TypeName", "EventName", [], [], - any:create(orber_tc:alias("IFRId","test",tk_any), - any:create(orber_tc:array(notify_test_data:tc(),0), - {#notify_test_data{score=75}, - #notify_test_data{score=80}, - #notify_test_data{score=85}}))))), - ?match(false, eval(T4, ?not_CreateSE("DomainName","TypeName", "EventName", [], [], - any:create(orber_tc:alias("IFRId","test",tk_any), - any:create(orber_tc:array(notify_test_data:tc(),0), - {#notify_test_data{score=75}, - #notify_test_data{score=80}, - #notify_test_data{score=80}}))))), - ?match(false, eval(T4, ?not_CreateSE("DomainName","TypeName", "EventName", [], [], - any:create(orber_tc:alias("IFRId","test",tk_any), - any:create(orber_tc:array(notify_test_data:tc(),0), - {#notify_test_data{score=75}, - #notify_test_data{score=80}}))))), - - %% Select processes that exceed a certain usage threshold. - {ok,T5} = ?match({ok, _}, create_filter("$.memsize / 5.5 + $.cputime * 1275.0 + $.filesize * 1.25 > 500000.0")), - ?match(true, eval(T5, ?not_CreateSE("DomainName","TypeName", "EventName", [], [], - any:create(notify_test_computer:tc(), - #notify_test_computer - {memsize=5.5, - cputime = 0.00078431137, - filesize = 500000})))), - ?match(false, eval(T5, ?not_CreateSE("DomainName","TypeName", "EventName", [], [], - any:create(notify_test_computer:tc(), - #notify_test_computer - {memsize=5.5, - cputime = 0.00078431137, - filesize = 500})))), - ?match({error,_}, eval(T5, ?not_CreateSE("DomainName","TypeName", "EventName", [], [], - any:create(notify_test_computer:tc(), - #notify_test_computer - {memsize=5.5, - cputime = 0.00078431137})))), - - %% Accept only Notification Service structured events. - {ok,T6} = ?match({ok, _}, create_filter("$._repos_id == 'IDL:omg.org/CosNotification/StructuredEvent:1.0'")), - ?match(true, eval(T6, ?not_CreateSE("DomainName","CommunicationsAlarm", - "EventName", - [], [], any:create(orber_tc:null(), null)))), - - - - %% Accept only those events that have a specified security "rights list". - {ok,T7} = ?match({ok, _}, create_filter("exist $.header.variable_header(required_rights)")), - ?match(false, eval(T7, ?not_CreateSE("DomainName","CommunicationsAlarm", - "lost_packet", - [#'CosNotification_Property'{name="priority", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)))), - ?match(true, eval(T7, ?not_CreateSE("DomainName","CommunicationsAlarm", - "lost_packet", - [#'CosNotification_Property'{name="required_rights", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)))), - - - {ok,T8} = ?match({ok, _}, create_filter("$.header.fixed_header.event_type.type_name == 'CommunicationsAlarm' and $.header.fixed_header.event_name == 'lost_packet' and $.header.variable_header(priority) < 2")), - %% All correct - Event1 = ?not_CreateSE("DomainName","CommunicationsAlarm", - "lost_packet", - [#'CosNotification_Property'{name="priority", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)), - %% Priority to high - Event2 = ?not_CreateSE("DomainName","CommunicationsAlarm", - "lost_packet", - [#'CosNotification_Property'{name="priority", - value=any:create(orber_tc:short(), 2)}], - [], any:create(orber_tc:null(), null)), - %% Misspell event_name, i.e., lost_packets instead of lost_packet - Event3 = ?not_CreateSE("DomainName","CommunicationsAlarm", - "lost_packets", - [#'CosNotification_Property'{name="priority", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)), - %% Another type_name - Event4 = ?not_CreateSE("DomainName","TemperatureAlarm", - "lost_packets", - [#'CosNotification_Property'{name="priority", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)), - - ?match(true, eval(T8, Event1)), - ?match(false, eval(T8, Event2)), - ?match(false, eval(T8, Event3)), - ?match(false, eval(T8, Event4)), - - - {ok,T9} = ?match({ok, _}, create_filter("$.gpa < 80 or $.tests(midterm) > $.tests(final) or $.monthly_attendance[3] < 10")), - - %% midterm > final yields true, the others false - Event5 = ?not_CreateSE("DomainName","TypeName", - "EventName", [], [], - any:create(notify_test_studies:tc(), #notify_test_studies - {gpa = 90, - tests = [#'CosNotification_Property' - {name="midterm", value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property' - {name="final", value=any:create(orber_tc:short(), 60)}], - monthly_attendance = {0,1,2,10}})), - %% monthly_attendance[3] < 10 yields true, the others false - Event6 = ?not_CreateSE("DomainName","TypeName", - "EventName", [], [], - any:create(notify_test_studies:tc(), #notify_test_studies - {gpa = 90, - tests = [#'CosNotification_Property' - {name="midterm", value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property' - {name="final", value=any:create(orber_tc:short(), 80)}], - monthly_attendance = {0,1,2,9}})), - %% gpa < 80 true, rest false. - Event7 = ?not_CreateSE("DomainName","TypeName", - "EventName", [], [], - any:create(notify_test_studies:tc(), #notify_test_studies - {gpa = 70, - tests = [#'CosNotification_Property' - {name="midterm", value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property' - {name="final", value=any:create(orber_tc:short(), 80)}], - monthly_attendance = {0,1,2,10}})), - %% All false - Event8 = ?not_CreateSE("DomainName","TypeName", - "EventName", [], [], - any:create(notify_test_studies:tc(), #notify_test_studies - {gpa = 80, - tests = [#'CosNotification_Property' - {name="midterm", value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property' - {name="final", value=any:create(orber_tc:short(), 80)}], - monthly_attendance = {0,1,2,10}})), - - ?match(true, eval(T9, Event5)), - ?match(true, eval(T9, Event6)), - ?match(true, eval(T9, Event7)), - ?match(false, eval(T9, Event8)), - ok. - - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- - -%%-------------------- End of Module ------------------------------ diff --git a/lib/cosNotification/test/notification_SUITE.erl b/lib/cosNotification/test/notification_SUITE.erl deleted file mode 100644 index 624a76c64a..0000000000 --- a/lib/cosNotification/test/notification_SUITE.erl +++ /dev/null @@ -1,2163 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%-------------------------------------------------------------------- -%% File : notification_SUITE.erl -%% Purpose : -%%-------------------------------------------------------------------- - --module(notification_SUITE). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% cosEvent files. --include_lib("cosEvent/include/CosEventChannelAdmin.hrl"). -%% Application files --include_lib("cosNotification/include/CosNotification.hrl"). --include_lib("cosNotification/include/CosNotifyChannelAdmin.hrl"). --include_lib("cosNotification/include/CosNotifyComm.hrl"). --include_lib("cosNotification/include/CosNotifyFilter.hrl"). - --include_lib("cosNotification/src/CosNotification_Definitions.hrl"). - --include("idl_output/notify_test.hrl"). - --include_lib("common_test/include/ct.hrl"). - -%%--------------- DEFINES ------------------------------------ --define(default_timeout, test_server:minutes(20)). --define(match(ExpectedRes, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - ExpectedRes -> - io:format("------ CORRECT RESULT ------~n~p~n", - [AcTuAlReS]), - AcTuAlReS; - _ -> - io:format("###### ERROR ERROR ######~n~p~n", - [AcTuAlReS]), - exit(AcTuAlReS) - end - end()). - --define(defaultQoS, - [#'CosNotification_Property'{name='CosNotification':'MaximumBatchSize'(), - value=any:create(orber_tc:long(), 100)}, - #'CosNotification_Property'{name='CosNotification':'PacingInterval'(), - value=any:create(orber_tc:unsigned_long_long(), - 20000000)}, - #'CosNotification_Property'{name='CosNotification':'OrderPolicy'(), - value=any:create(orber_tc:short(), - 'CosNotification':'AnyOrder'())}, - #'CosNotification_Property'{name='CosNotification':'EventReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'BestEffort'())}, - #'CosNotification_Property'{name='CosNotification':'ConnectionReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'BestEffort'())}, - #'CosNotification_Property'{name='CosNotification':'DiscardPolicy'(), - value=any:create(orber_tc:short(), - 'CosNotification':'AnyOrder'())}, - #'CosNotification_Property'{name='CosNotification':'StartTimeSupported'(), - value=any:create(orber_tc:boolean(), false)}, - #'CosNotification_Property'{name='CosNotification':'StopTimeSupported'(), - value=any:create(orber_tc:boolean(), false)}, - #'CosNotification_Property'{name='CosNotification':'Priority'(), - value=any:create(orber_tc:short(), - 'CosNotification':'DefaultPriority'())}]). --define(defaultQoS2, - [#'CosNotification_Property'{name='CosNotification':'MaximumBatchSize'(), - value=any:create(orber_tc:long(), 1)}, - #'CosNotification_Property'{name='CosNotification':'PacingInterval'(), - value=any:create(orber_tc:unsigned_long_long(), - 0)}, - #'CosNotification_Property'{name='CosNotification':'OrderPolicy'(), - value=any:create(orber_tc:short(), - 'CosNotification':'AnyOrder'())}, - #'CosNotification_Property'{name='CosNotification':'EventReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'BestEffort'())}, - #'CosNotification_Property'{name='CosNotification':'ConnectionReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'BestEffort'())}, - #'CosNotification_Property'{name='CosNotification':'DiscardPolicy'(), - value=any:create(orber_tc:short(), - 'CosNotification':'AnyOrder'())}, - #'CosNotification_Property'{name='CosNotification':'StartTimeSupported'(), - value=any:create(orber_tc:boolean(), false)}, - #'CosNotification_Property'{name='CosNotification':'StopTimeSupported'(), - value=any:create(orber_tc:boolean(), false)}, - #'CosNotification_Property'{name='CosNotification':'Priority'(), - value=any:create(orber_tc:short(), - 'CosNotification':'DefaultPriority'())}]). --define(defaultAdm, - [#'CosNotification_Property'{name='CosNotification':'MaxQueueLength'(), - value=any:create(orber_tc:long(), 100)}, - #'CosNotification_Property'{name='CosNotification':'MaxConsumers'(), - value=any:create(orber_tc:long(), 100)}, - #'CosNotification_Property'{name='CosNotification':'MaxSuppliers'(), - value=any:create(orber_tc:long(), 100)}]). - --define(FAC_OPT, []). - - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, cases/0, - init_per_suite/1, end_per_suite/1, qos_api/1, adm_api/1, - cosevent_api/1, filter_adm_api/1, events_api/1, events2_api/1, - event_qos_api/1, filter_api/1, mapping_filter_api/1, subscription_api/1, - init_per_testcase/2, end_per_testcase/2, persistent_max_events_api/1, - persistent_timeout_events_api/1, persistent_recover_events_api/1, - app_test/1]). - --export([terminated/1]). - -%%----------------------------------------------------------------- -%% Func: all/1 -%% Args: -%% Returns: -%%----------------------------------------------------------------- -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - cases(). - -groups() -> - []. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - -cases() -> - [persistent_max_events_api, - persistent_timeout_events_api, - persistent_recover_events_api, mapping_filter_api, - filter_api, filter_adm_api, event_qos_api, qos_api, - adm_api, cosevent_api, subscription_api, events_api, - events2_api, app_test]. - -%%----------------------------------------------------------------- -%% Init and cleanup functions. -%%----------------------------------------------------------------- -init_per_testcase(_Case, Config) -> - Path = code:which(?MODULE), - code:add_pathz(filename:join(filename:dirname(Path), "idl_output")), - Dog=test_server:timetrap(?default_timeout), - [{watchdog, Dog}|Config]. - -end_per_testcase(_Case, Config) -> - Path = code:which(?MODULE), - code:del_path(filename:join(filename:dirname(Path), "idl_output")), - Dog = proplists:get_value(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. - -init_per_suite(Config) -> - Path = code:which(?MODULE), - code:add_pathz(filename:join(filename:dirname(Path), "idl_output")), - ok = corba:orb_init([{flags, 16#02}, {orber_debug_level, 10}]), - orber:jump_start(), - cosNotificationApp:install_event(), - cosNotificationApp:install(), - 'oe_notify_test_server':'oe_register'(), - cosNotificationApp:start(), - if - is_list(Config) -> - Config; - true -> - exit("Config not a list") - end. - -end_per_suite(Config) -> - cosNotificationApp:stop(), - Path = code:which(?MODULE), - code:del_path(filename:join(filename:dirname(Path), "idl_output")), - 'oe_notify_test_server':'oe_unregister'(), - cosNotificationApp:uninstall(), - cosNotificationApp:uninstall_event(), - orber:jump_stop(), - Config. - - -%%----------------------------------------------------------------- -%% Tests app file -%%----------------------------------------------------------------- -app_test(_Config) -> - ok=test_server:app_test(cosNotification), - ok. - - -%%----------------------------------------------------------------- -%% Persistent events max limit -%%----------------------------------------------------------------- -persistent_max_events_api(_Config) -> - QoSPersistent = - [#'CosNotification_Property'{name='CosNotification':'ConnectionReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'Persistent'())}], - QoSEventPersistent = - [#'CosNotification_Property'{name='CosNotification':'EventReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'Persistent'())}], - application:set_env(cosNotification, notify, ?MODULE), - application:set_env(cosNotification, max_events, 2), - application:set_env(cosNotification, timeout_events, 300000), - application:set_env(cosNotification, interval_events, 10000), - %% Initialize the application. - Fac = (catch cosNotificationApp:start_global_factory(?FAC_OPT)), - ?match({_,key,_,_,_,_}, Fac), - {Ch, _Id1} = (catch 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(Fac, ?defaultQoS2, ?defaultAdm)), - ?match({_,key,_,_,_,_}, Ch), - - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSEventPersistent)), - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSPersistent)), - - %% Create the Admin objects - {AdminSupplier, _ASID}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_EventChannel':new_for_suppliers(Ch,'AND_OP')), - {AdminConsumer, _ACID}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_EventChannel':new_for_consumers(Ch,'AND_OP')), - - %% Create Proxies and clients - {SequenceProxyPushSupplier,_ID}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_notification_push_supplier(AdminConsumer, 'SEQUENCE_EVENT')), - PushSeqC=?match({_,key,_,_,_,_}, 'notify_test_SeqPushC':oe_create(['PUSH_SEQUENCE',SequenceProxyPushSupplier], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':connect_sequence_push_consumer(SequenceProxyPushSupplier, PushSeqC)), - - {SequenceProxyPushConsumer,_ID}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_SupplierAdmin':obtain_notification_push_consumer(AdminSupplier, 'SEQUENCE_EVENT')), - PushSeqS=?match({_,key,_,_,_,_}, 'notify_test_SeqPushS':oe_create(['PUSH_SEQUENCE',SequenceProxyPushConsumer], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':connect_sequence_push_supplier(SequenceProxyPushConsumer, PushSeqS)), - - %% Create a couple of Events to test with. - Event = ?not_CreateSE("DomainName","CommunicationsAlarm", - "lost_packet", - [#'CosNotification_Property'{name="priority", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)), - - ?match(ok, 'notify_test_SeqPushC':doAction(PushSeqC, {action, action})), - - %% Push and check the state. - ?match(ok,'CosNotifyChannelAdmin_SequenceProxyPushConsumer':push_structured_events(SequenceProxyPushConsumer, [Event])), - ?match([], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - ?match(false, corba_object:non_existent(SequenceProxyPushSupplier)), - - ?match(ok,'CosNotifyChannelAdmin_SequenceProxyPushConsumer':push_structured_events(SequenceProxyPushConsumer, [Event])), - ?match([], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - ?match(false, corba_object:non_existent(SequenceProxyPushSupplier)), - %% Now we've reached the limit. This call will terminate the proxy. - %% We cannot check for data at this point since the broken connection - %% will result in that the client terminates. - ?match(ok,'CosNotifyChannelAdmin_SequenceProxyPushConsumer':push_structured_events(SequenceProxyPushConsumer, [Event])), - timer:sleep(5000), - ?match(true, corba_object:non_existent(SequenceProxyPushSupplier)), - ?match(true, corba_object:non_existent(PushSeqC)), - - - catch corba:dispose(SequenceProxyPushConsumer), - catch corba:dispose(SequenceProxyPushSupplier), - catch corba:dispose(AdminConsumer), - catch corba:dispose(AdminSupplier), - catch corba:dispose(Ch), - catch cosNotificationApp:stop_factory(Fac), - catch corba:dispose(PushSeqS), - catch corba:dispose(PushSeqC), - application:set_env(cosNotification, notify, undefined), - application:set_env(cosNotification, max_events, undefined), - application:set_env(cosNotification, timeout_events, undefined), - application:set_env(cosNotification, interval_events, undefined), - ok. - -terminated(Items) -> - io:format("Proxy terminated due to: ~p~n", [Items]). - -%%----------------------------------------------------------------- -%% Persistent events timeout -%%----------------------------------------------------------------- -persistent_timeout_events_api(_Config) -> - QoSPersistent = - [#'CosNotification_Property'{name='CosNotification':'ConnectionReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'Persistent'())}], - QoSEventPersistent = - [#'CosNotification_Property'{name='CosNotification':'EventReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'Persistent'())}], - application:set_env(cosNotification, notify, ?MODULE), - application:set_env(cosNotification, max_events, 1000), - application:set_env(cosNotification, timeout_events, 4000), - application:set_env(cosNotification, interval_events, 1000), - %% Initialize the application. - Fac = (catch cosNotificationApp:start_global_factory(?FAC_OPT)), - ?match({_,key,_,_,_,_}, Fac), - {Ch, _Id1} = (catch 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(Fac, ?defaultQoS2, ?defaultAdm)), - ?match({_,key,_,_,_,_}, Ch), - - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSEventPersistent)), - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSPersistent)), - - %% Create the Admin objects - {AdminSupplier, _ASID}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_EventChannel':new_for_suppliers(Ch,'AND_OP')), - {AdminConsumer, _ACID}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_EventChannel':new_for_consumers(Ch,'AND_OP')), - - %% Create Proxies and clients - {SequenceProxyPushSupplier,_ID}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_notification_push_supplier(AdminConsumer, 'SEQUENCE_EVENT')), - PushSeqC=?match({_,key,_,_,_,_}, 'notify_test_SeqPushC':oe_create(['PUSH_SEQUENCE',SequenceProxyPushSupplier], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':connect_sequence_push_consumer(SequenceProxyPushSupplier, PushSeqC)), - - {SequenceProxyPushConsumer,_ID}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_SupplierAdmin':obtain_notification_push_consumer(AdminSupplier, 'SEQUENCE_EVENT')), - PushSeqS=?match({_,key,_,_,_,_}, 'notify_test_SeqPushS':oe_create(['PUSH_SEQUENCE',SequenceProxyPushConsumer], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':connect_sequence_push_supplier(SequenceProxyPushConsumer, PushSeqS)), - - %% Create a couple of Events to test with. - Event = ?not_CreateSE("DomainName","CommunicationsAlarm", - "lost_packet", - [#'CosNotification_Property'{name="priority", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)), - - ?match(ok, 'notify_test_SeqPushC':doAction(PushSeqC, {action, action})), - - %% Push and check the state. - ?match(ok,'CosNotifyChannelAdmin_SequenceProxyPushConsumer':push_structured_events(SequenceProxyPushConsumer, [Event])), - ?match([], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - ?match(false, corba_object:non_existent(SequenceProxyPushSupplier)), - - %% Now we've reached the limit. This call will terminate the proxy. - %% We cannot check for data at this point since the broken connection - %% will result in that the client terminates. - ?match(ok,'CosNotifyChannelAdmin_SequenceProxyPushConsumer':push_structured_events(SequenceProxyPushConsumer, [Event])), - timer:sleep(10000), - ?match(true, corba_object:non_existent(SequenceProxyPushSupplier)), - ?match(true, corba_object:non_existent(PushSeqC)), - - - catch corba:dispose(SequenceProxyPushConsumer), - catch corba:dispose(SequenceProxyPushSupplier), - catch corba:dispose(AdminConsumer), - catch corba:dispose(AdminSupplier), - catch corba:dispose(Ch), - catch cosNotificationApp:stop_factory(Fac), - catch corba:dispose(PushSeqS), - catch corba:dispose(PushSeqC), - application:set_env(cosNotification, notify, undefined), - application:set_env(cosNotification, max_events, undefined), - application:set_env(cosNotification, timeout_events, undefined), - application:set_env(cosNotification, interval_events, undefined), - ok. - -%%----------------------------------------------------------------- -%% Persistent events max limit -%%----------------------------------------------------------------- -persistent_recover_events_api(_Config) -> - QoSPersistent = - [#'CosNotification_Property'{name='CosNotification':'ConnectionReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'Persistent'())}], - QoSEventPersistent = - [#'CosNotification_Property'{name='CosNotification':'EventReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'Persistent'())}], - application:set_env(cosNotification, notify, ?MODULE), - application:set_env(cosNotification, max_events, 1000), - application:set_env(cosNotification, timeout_events, 100000), - application:set_env(cosNotification, interval_events, 1000), - %% Initialize the application. - Fac = (catch cosNotificationApp:start_global_factory(?FAC_OPT)), - ?match({_,key,_,_,_,_}, Fac), - {Ch, _Id1} = (catch 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(Fac, ?defaultQoS2, ?defaultAdm)), - ?match({_,key,_,_,_,_}, Ch), - - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSEventPersistent)), - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSPersistent)), - - %% Create the Admin objects - {AdminSupplier, _ASID}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_EventChannel':new_for_suppliers(Ch,'AND_OP')), - {AdminConsumer, _ACID}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_EventChannel':new_for_consumers(Ch,'AND_OP')), - - %% Create Proxies and clients - {SequenceProxyPushSupplier,_ID}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_notification_push_supplier(AdminConsumer, 'SEQUENCE_EVENT')), - PushSeqC=?match({_,key,_,_,_,_}, 'notify_test_SeqPushC':oe_create(['PUSH_SEQUENCE',SequenceProxyPushSupplier], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':connect_sequence_push_consumer(SequenceProxyPushSupplier, PushSeqC)), - - {SequenceProxyPushConsumer,_ID}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_SupplierAdmin':obtain_notification_push_consumer(AdminSupplier, 'SEQUENCE_EVENT')), - PushSeqS=?match({_,key,_,_,_,_}, 'notify_test_SeqPushS':oe_create(['PUSH_SEQUENCE',SequenceProxyPushConsumer], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':connect_sequence_push_supplier(SequenceProxyPushConsumer, PushSeqS)), - - %% Create a couple of Events to test with. - Event = ?not_CreateSE("DomainName","CommunicationsAlarm", - "lost_packet", - [#'CosNotification_Property'{name="priority", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)), - - ?match(ok, 'notify_test_SeqPushC':doAction(PushSeqC, {action, action})), - - %% Push and check the state. - ?match(ok,'CosNotifyChannelAdmin_SequenceProxyPushConsumer':push_structured_events(SequenceProxyPushConsumer, [Event])), - ?match([], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - ?match(false, corba_object:non_existent(SequenceProxyPushSupplier)), - %% Allow the proxy to try a few times and then change the client behavior - timer:sleep(4000), - ?match(ok, 'notify_test_SeqPushC':doAction(PushSeqC, {action, undefined})), - %% Wait some time so that the proxy timeout has kicked in. - timer:sleep(4000), - - %% Now the communication should work again. - ?match([Event], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - ?match(false, corba_object:non_existent(SequenceProxyPushSupplier)), - - ?match(ok,'CosNotifyChannelAdmin_SequenceProxyPushConsumer':push_structured_events(SequenceProxyPushConsumer, [Event])), - timer:sleep(4000), - ?match([Event], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - - catch corba:dispose(SequenceProxyPushConsumer), - catch corba:dispose(SequenceProxyPushSupplier), - catch corba:dispose(AdminConsumer), - catch corba:dispose(AdminSupplier), - catch corba:dispose(Ch), - catch cosNotificationApp:stop_factory(Fac), - catch corba:dispose(PushSeqS), - catch corba:dispose(PushSeqC), - application:set_env(cosNotification, notify, undefined), - application:set_env(cosNotification, max_events, undefined), - application:set_env(cosNotification, timeout_events, undefined), - application:set_env(cosNotification, interval_events, undefined), - ok. - - -%%----------------------------------------------------------------- -%% CosNotifyFilter::Filter API tests -%%----------------------------------------------------------------- -mapping_filter_api(_Config) -> - FiFac = 'CosNotifyFilter_FilterFactory':oe_create(), - ?match({_,key,_,_,_,_}, FiFac), - - Filter = 'CosNotifyFilter_FilterFactory':create_mapping_filter(FiFac, - "EXTENDED_TCL", - any:create(orber_tc:short(), 10)), - ?match({_,key,_,_,_,_}, Filter), - - ?match("EXTENDED_TCL", 'CosNotifyFilter_MappingFilter':'_get_constraint_grammar'(Filter)), - - %% Test before we add any constarints. - ?match([], 'CosNotifyFilter_MappingFilter':get_all_mapping_constraints(Filter)), - ?match({'EXCEPTION', {'CosNotifyFilter_ConstraintNotFound', _, 1}}, - 'CosNotifyFilter_MappingFilter':get_mapping_constraints(Filter, [1])), - ?match(ok, 'CosNotifyFilter_MappingFilter':remove_all_mapping_constraints(Filter)), - - %% Try adding an incorrect constraint_expr - ?match({'EXCEPTION',{'CosNotifyFilter_InvalidConstraint',_,_}}, - 'CosNotifyFilter_MappingFilter':add_mapping_constraints(Filter, - [#'CosNotifyFilter_MappingConstraintPair' - {constraint_expression = #'CosNotifyFilter_ConstraintExp' - {event_types = [#'CosNotification_EventType' - {domain_name = "name", - type_name = "type"}], - constraint_expr = "2==2 and 3<"}, - result_to_set = any:create(orber_tc:short(), 10)}])), - %% Try adding two correct constraint_expr - [{_,_,CID1,_},{_,_,CID2,_}]= - ?match([{'CosNotifyFilter_MappingConstraintInfo',_,_,_}, {'CosNotifyFilter_MappingConstraintInfo',_,_,_}], - 'CosNotifyFilter_MappingFilter':add_mapping_constraints(Filter, - [#'CosNotifyFilter_MappingConstraintPair' - {constraint_expression = #'CosNotifyFilter_ConstraintExp' - {event_types = [#'CosNotification_EventType' - {domain_name = "name", - type_name = "type"}], - constraint_expr = "2==2 and 3<4"}, - result_to_set = any:create(orber_tc:short(), 10)}, - #'CosNotifyFilter_MappingConstraintPair' - {constraint_expression = #'CosNotifyFilter_ConstraintExp' - {event_types = [#'CosNotification_EventType' - {domain_name = "name2", - type_name = "type2"}], - constraint_expr = "$.test._length == 3 and ($.test[0].score + $.test[1].score + $.test[2].score)/3 >=80"}, - result_to_set = any:create(orber_tc:short(), 10)}])), - - ?match([{'CosNotifyFilter_MappingConstraintInfo',_,CID2,_}, {'CosNotifyFilter_MappingConstraintInfo',_,CID1,_}], - 'CosNotifyFilter_MappingFilter':get_all_mapping_constraints(Filter)), - ?match([{'CosNotifyFilter_MappingConstraintInfo',_,CID1,_}], - 'CosNotifyFilter_MappingFilter':get_mapping_constraints(Filter, [CID1])), - ?match(ok, 'CosNotifyFilter_MappingFilter':remove_all_mapping_constraints(Filter)), - ?match([], 'CosNotifyFilter_MappingFilter':get_all_mapping_constraints(Filter)), - - %% Try adding a constraint_expr with using invalid value, i.e., not short. - ?match({'EXCEPTION',{'CosNotifyFilter_InvalidValue',_,_,_}}, - 'CosNotifyFilter_MappingFilter':add_mapping_constraints(Filter, - [#'CosNotifyFilter_MappingConstraintPair' - {constraint_expression = #'CosNotifyFilter_ConstraintExp' - {event_types = [#'CosNotification_EventType' - {domain_name = "name", - type_name = "type"}], - constraint_expr = "2==2 and 3<8"}, - result_to_set = any:create(orber_tc:long(), 10)}])), - - %% Try adding one correct and one incorrect constraint_expr - ?match({'EXCEPTION',{'CosNotifyFilter_InvalidConstraint',_,_}}, - 'CosNotifyFilter_MappingFilter':add_mapping_constraints(Filter, - [#'CosNotifyFilter_MappingConstraintPair' - {constraint_expression = #'CosNotifyFilter_ConstraintExp' - {event_types = [#'CosNotification_EventType' - {domain_name = "name", - type_name = "type"}], - constraint_expr = "2==2 and 3<"}, - result_to_set = any:create(orber_tc:short(), 10)}, - #'CosNotifyFilter_MappingConstraintPair' - {constraint_expression = #'CosNotifyFilter_ConstraintExp' - {event_types = [#'CosNotification_EventType' - {domain_name = "name2", - type_name = "type2"}], - constraint_expr = "$.test._length == 3 and ($.test[0].score + $.test[1].score + $.test[2].score)/3 >=80"}, - result_to_set = any:create(orber_tc:short(), 10)}])), - - %% Following testcases test different domain_name and type_name, e.g., - %% wildcards etc. - [{_,ConInfoData,CID3,_}] = - ?match([{'CosNotifyFilter_MappingConstraintInfo',_,_,_}], - 'CosNotifyFilter_MappingFilter':add_mapping_constraints(Filter, - [#'CosNotifyFilter_MappingConstraintPair' - {constraint_expression = #'CosNotifyFilter_ConstraintExp' - {event_types = [#'CosNotification_EventType' - {domain_name = "domain", - type_name = ""}, - #'CosNotification_EventType' - {domain_name = "*", - type_name = "type"}], - constraint_expr = "2==2 and 3<4"}, - result_to_set = any:create(orber_tc:short(), 10)}])), - - %% Try removing a constraint - ?match(ok, 'CosNotifyFilter_MappingFilter':modify_mapping_constraints(Filter,[CID3],[])), - ?match([], 'CosNotifyFilter_MappingFilter':get_all_mapping_constraints(Filter)), - - %% Add e new constraint - [{_,_,CID4,_}] = - ?match([{'CosNotifyFilter_MappingConstraintInfo',_,_,_}], - 'CosNotifyFilter_MappingFilter':add_mapping_constraints(Filter, - [#'CosNotifyFilter_MappingConstraintPair' - {constraint_expression = #'CosNotifyFilter_ConstraintExp' - {event_types = [#'CosNotification_EventType' - {domain_name = "domain1", - type_name = ""}, - #'CosNotification_EventType' - {domain_name = "domain2", - type_name = "*"}], - constraint_expr = "2==2 and 3<4"}, - result_to_set = any:create(orber_tc:short(), 10)}])), - - %% Try to update the constraint associated with CID4 to equal CID3. - ?match(ok, 'CosNotifyFilter_MappingFilter':modify_mapping_constraints(Filter,[], - [#'CosNotifyFilter_MappingConstraintInfo' - {constraint_expression= - #'CosNotifyFilter_ConstraintExp' - {event_types =[#'CosNotification_EventType' - {domain_name = "domain", - type_name = ""}, - #'CosNotification_EventType' - {domain_name = "*", - type_name = "type"}], - constraint_expr = "2==2 and 3<4"}, - constraint_id=CID4, - value = any:create(orber_tc:short(), 10)}])), - - ?match([{_,ConInfoData,CID4,_}], 'CosNotifyFilter_MappingFilter':get_all_mapping_constraints(Filter)), - - ?match({'EXCEPTION', {'CosNotifyFilter_ConstraintNotFound', _, CID3}}, - 'CosNotifyFilter_MappingFilter':get_mapping_constraints(Filter, [CID3])), - ?match(ok, 'CosNotifyFilter_MappingFilter':remove_all_mapping_constraints(Filter)), - ?match([], 'CosNotifyFilter_MappingFilter':get_all_mapping_constraints(Filter)), - - ?match([{'CosNotifyFilter_MappingConstraintInfo',_,_,_}], - 'CosNotifyFilter_MappingFilter':add_mapping_constraints(Filter, - [#'CosNotifyFilter_MappingConstraintPair' - {constraint_expression = #'CosNotifyFilter_ConstraintExp' - {event_types = [#'CosNotification_EventType' - {domain_name = "", - type_name = "type1"}, - #'CosNotification_EventType' - {domain_name = "*", - type_name = "type2"}], - constraint_expr = "2==2 and 3<4"}, - result_to_set = any:create(orber_tc:short(), 10)}])), - - ?match([{'CosNotifyFilter_MappingConstraintInfo',_,_,_}], - 'CosNotifyFilter_MappingFilter':add_mapping_constraints(Filter, - [#'CosNotifyFilter_MappingConstraintPair' - {constraint_expression = #'CosNotifyFilter_ConstraintExp' - {event_types = [#'CosNotification_EventType' - {domain_name = "domain1", - type_name = "type1"}, - #'CosNotification_EventType' - {domain_name = "domain2", - type_name = "type2"}], - constraint_expr = "2==2 and 3<4"}, - result_to_set = any:create(orber_tc:short(), 10)}])), - - ?match([{'CosNotifyFilter_MappingConstraintInfo',_,_,_}], - 'CosNotifyFilter_MappingFilter':add_mapping_constraints(Filter, - [#'CosNotifyFilter_MappingConstraintPair' - {constraint_expression = #'CosNotifyFilter_ConstraintExp' - {event_types = [#'CosNotification_EventType' - {domain_name = "dom*", - type_name = "type1"}, - #'CosNotification_EventType' - {domain_name = "domain2", - type_name = "typ*"}], - constraint_expr = "2==2 and 3<4"}, - result_to_set = any:create(orber_tc:short(), 10)}])), - - ?match([{'CosNotifyFilter_MappingConstraintInfo',_,_,_}], - 'CosNotifyFilter_MappingFilter':add_mapping_constraints(Filter, - [#'CosNotifyFilter_MappingConstraintPair' - {constraint_expression = #'CosNotifyFilter_ConstraintExp' - {event_types = [#'CosNotification_EventType' - {domain_name = "dom*1", - type_name = "type1"}, - #'CosNotification_EventType' - {domain_name = "domain2", - type_name = "typ*2"}], - constraint_expr = "2==2 and 3<4"}, - result_to_set = any:create(orber_tc:short(), 10)}])), - - catch corba:dispose(FiFac), - catch corba:dispose(Filter), - ok. - - -%%----------------------------------------------------------------- -%% CosNotifyFilter::Filter API tests -%%----------------------------------------------------------------- -filter_api(_Config) -> - Fac = cosNotificationApp:start_global_factory(?FAC_OPT), - ?match({_,key,_,_,_,_}, Fac), - {Ch, _Id1} = 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(Fac, ?defaultQoS, ?defaultAdm), - AC= 'CosNotifyChannelAdmin_EventChannel':for_consumers(Ch), - - FiFac = 'CosNotifyFilter_FilterFactory':oe_create(), - ?match({_,key,_,_,_,_}, FiFac), - - Filter = 'CosNotifyFilter_FilterFactory':create_filter(FiFac,"EXTENDED_TCL"), - ?match({_,key,_,_,_,_}, Filter), - - ?match("EXTENDED_TCL", 'CosNotifyFilter_Filter':'_get_constraint_grammar'(Filter)), - - %% Test Callback management. - ?match({'EXCEPTION',{'BAD_PARAM',_,_,_}}, - 'CosNotifyFilter_Filter':attach_callback(Filter, Ch)), - ?match([], 'CosNotifyFilter_Filter':get_callbacks(Filter)), - ?match({'EXCEPTION',{'CosNotifyFilter_CallbackNotFound',_}}, - 'CosNotifyFilter_Filter':detach_callback(Filter, 0)), - ID='CosNotifyFilter_Filter':attach_callback(Filter, AC), - ?match([ID], 'CosNotifyFilter_Filter':get_callbacks(Filter)), - ?match(ok, 'CosNotifyFilter_Filter':detach_callback(Filter, ID)), - ?match([], 'CosNotifyFilter_Filter':get_callbacks(Filter)), - - %% This callback is just attached so we can test that we can call notify_subscribe. - _ID2='CosNotifyFilter_Filter':attach_callback(Filter, AC), - - %% Test before we add any constarints. - ?match([], 'CosNotifyFilter_Filter':get_all_constraints(Filter)), - ?match({'EXCEPTION', {'CosNotifyFilter_ConstraintNotFound', _, 1}}, - 'CosNotifyFilter_Filter':get_constraints(Filter, [1])), - ?match(ok, 'CosNotifyFilter_Filter':remove_all_constraints(Filter)), - - %% Try adding an incorrect constraint_expr - ?match({'EXCEPTION',{'CosNotifyFilter_InvalidConstraint',_,_}}, - 'CosNotifyFilter_Filter':add_constraints(Filter, - [#'CosNotifyFilter_ConstraintExp'{event_types = - [#'CosNotification_EventType'{ - domain_name = "name", - type_name = "type"}], - constraint_expr = "2==2 and 3<"}])), - %% Try adding two correct constraint_expr - [{_,_,CID1},{_,_,CID2}]= - ?match([{'CosNotifyFilter_ConstraintInfo',_,_}, {'CosNotifyFilter_ConstraintInfo',_,_}], - 'CosNotifyFilter_Filter':add_constraints(Filter, - [#'CosNotifyFilter_ConstraintExp'{event_types = - [#'CosNotification_EventType'{ - domain_name = "name", - type_name = "type"}], - constraint_expr = "2==2 and 3<4"}, - #'CosNotifyFilter_ConstraintExp'{event_types = - [#'CosNotification_EventType'{ - domain_name = "name2", - type_name = "type2"}], - constraint_expr = "$.test._length == 3 and ($.test[0].score + $.test[1].score + $.test[2].score)/3 >=80"}])), - - ?match([{'CosNotifyFilter_ConstraintInfo',_,CID2}, {'CosNotifyFilter_ConstraintInfo',_,CID1}], - 'CosNotifyFilter_Filter':get_all_constraints(Filter)), - ?match([{'CosNotifyFilter_ConstraintInfo',_,CID1}], - 'CosNotifyFilter_Filter':get_constraints(Filter, [CID1])), - ?match(ok, 'CosNotifyFilter_Filter':remove_all_constraints(Filter)), - ?match([], 'CosNotifyFilter_Filter':get_all_constraints(Filter)), - - %% Try adding one correct and one incorrect constraint_expr - ?match({'EXCEPTION',{'CosNotifyFilter_InvalidConstraint',_,_}}, - 'CosNotifyFilter_Filter':add_constraints(Filter, - [#'CosNotifyFilter_ConstraintExp'{event_types = - [#'CosNotification_EventType'{ - domain_name = "name", - type_name = "type"}], - constraint_expr = "2==2 and 3<"}, - #'CosNotifyFilter_ConstraintExp'{event_types = - [#'CosNotification_EventType'{ - domain_name = "name2", - type_name = "type2"}], - constraint_expr = "$.test._length == 3 and ($.test[0].score + $.test[1].score + $.test[2].score)/3 >=80"}])), - - %% Following testcases test different domain_name and type_name, e.g., - %% wildcards etc. - [{_,ConInfoData,CID3}] = - ?match([{'CosNotifyFilter_ConstraintInfo',_,_}], - 'CosNotifyFilter_Filter':add_constraints(Filter, - [#'CosNotifyFilter_ConstraintExp'{event_types = - [#'CosNotification_EventType'{ - domain_name = "domain", - type_name = ""}, - #'CosNotification_EventType'{ - domain_name = "*", - type_name = "type"}], - constraint_expr = "2==2 and 3<4"}])), - - %% Try removing a constraint - ?match(ok, 'CosNotifyFilter_Filter':modify_constraints(Filter,[CID3],[])), - ?match([], 'CosNotifyFilter_Filter':get_all_constraints(Filter)), - - %% Add e new constraint - [{_,_,CID4}] = - ?match([{'CosNotifyFilter_ConstraintInfo',_,_}], - 'CosNotifyFilter_Filter':add_constraints(Filter, - [#'CosNotifyFilter_ConstraintExp'{event_types = - [#'CosNotification_EventType'{ - domain_name = "domain1", - type_name = ""}, - #'CosNotification_EventType'{ - domain_name = "domain2", - type_name = "*"}], - constraint_expr = "2==2 and 3<4"}])), - - %% Try to update the constraint associated with CID4 to equal CID3. - ?match(ok, 'CosNotifyFilter_Filter':modify_constraints(Filter,[], - [#'CosNotifyFilter_ConstraintInfo'{constraint_expression= - #'CosNotifyFilter_ConstraintExp'{event_types = - [#'CosNotification_EventType'{ - domain_name = "domain", - type_name = ""}, - #'CosNotification_EventType'{ - domain_name = "*", - type_name = "type"}], - constraint_expr = "2==2 and 3<4"}, - constraint_id=CID4}])), - - ?match([{_,ConInfoData,CID4}], 'CosNotifyFilter_Filter':get_all_constraints(Filter)), - - ?match({'EXCEPTION', {'CosNotifyFilter_ConstraintNotFound', _, CID3}}, - 'CosNotifyFilter_Filter':get_constraints(Filter, [CID3])), - ?match(ok, 'CosNotifyFilter_Filter':remove_all_constraints(Filter)), - ?match([], 'CosNotifyFilter_Filter':get_all_constraints(Filter)), - - ?match([{'CosNotifyFilter_ConstraintInfo',_,_}], - 'CosNotifyFilter_Filter':add_constraints(Filter, - [#'CosNotifyFilter_ConstraintExp'{event_types = - [#'CosNotification_EventType'{ - domain_name = "", - type_name = "type1"}, - #'CosNotification_EventType'{ - domain_name = "*", - type_name = "type2"}], - constraint_expr = "2==2 and 3<4"}])), - - ?match([{'CosNotifyFilter_ConstraintInfo',_,_}], - 'CosNotifyFilter_Filter':add_constraints(Filter, - [#'CosNotifyFilter_ConstraintExp'{event_types = - [#'CosNotification_EventType'{ - domain_name = "domain1", - type_name = "type1"}, - #'CosNotification_EventType'{ - domain_name = "domain2", - type_name = "type2"}], - constraint_expr = "2==2 and 3<4"}])), - - ?match([{'CosNotifyFilter_ConstraintInfo',_,_}], - 'CosNotifyFilter_Filter':add_constraints(Filter, - [#'CosNotifyFilter_ConstraintExp'{event_types = - [#'CosNotification_EventType'{ - domain_name = "dom*", - type_name = "type1"}, - #'CosNotification_EventType'{ - domain_name = "domain2", - type_name = "typ*"}], - constraint_expr = "2==2 and 3<4"}])), - - ?match([{'CosNotifyFilter_ConstraintInfo',_,_}], - 'CosNotifyFilter_Filter':add_constraints(Filter, - [#'CosNotifyFilter_ConstraintExp'{event_types = - [#'CosNotification_EventType'{ - domain_name = "dom*1", - type_name = "type1"}, - #'CosNotification_EventType'{ - domain_name = "domain2", - type_name = "typ*2"}], - constraint_expr = "2==2 and 3<4"}])), - - catch corba:dispose(FiFac), - catch corba:dispose(Filter), - catch corba:dispose(AC), - catch corba:dispose(Ch), - catch corba:dispose(Fac), - ok. - -%%----------------------------------------------------------------- -%% Subscription handling API tests -%%----------------------------------------------------------------- -subscription_api(_Config) -> - %% Initialize the application. - Fac = (catch cosNotificationApp:start_global_factory(?FAC_OPT)), - ?match({_,key,_,_,_,_}, Fac), - {Ch, _Id1} = (catch 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(Fac, ?defaultQoS, ?defaultAdm)), - ?match({_,key,_,_,_,_}, Ch), - - %% Create the Admin objects - {AdminSupplier, _ASID}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_EventChannel':new_for_suppliers(Ch,'OR_OP')), - {AdminConsumer, _ACID}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_EventChannel':new_for_consumers(Ch,'OR_OP')), - - %% Create Suppliers Proxies - {StructuredProxyPullSupplier,_}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_notification_pull_supplier(AdminConsumer, 'STRUCTURED_EVENT')), - {StructuredProxyPushSupplier,_}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_notification_push_supplier(AdminConsumer, 'STRUCTURED_EVENT')), - - %% Now we must create a Client for each proxy and connect them. - PushStrC=?match({_,key,_,_,_,_}, 'notify_test_StrPushC':oe_create(['PUSH_STRUCTURED',StructuredProxyPushSupplier], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':connect_structured_push_consumer(StructuredProxyPushSupplier, PushStrC)), - PullStrC=?match({_,key,_,_,_,_}, 'notify_test_StrPullC':oe_create(['PULL_STRUCTURED',StructuredProxyPullSupplier], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':connect_structured_pull_consumer(StructuredProxyPullSupplier, PullStrC)), - - %% Create Consumers Proxies - {StructuredProxyPullConsumer,_}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_SupplierAdmin':obtain_notification_pull_consumer(AdminSupplier, 'STRUCTURED_EVENT')), - {StructuredProxyPushConsumer,_}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_SupplierAdmin':obtain_notification_push_consumer(AdminSupplier, 'STRUCTURED_EVENT')), - - %% Now we must create a Client for each proxy and connect them. - PushStrS=?match({_,key,_,_,_,_}, 'notify_test_StrPushS':oe_create(['PUSH_STRUCTURED',StructuredProxyPushConsumer], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':connect_structured_push_supplier(StructuredProxyPushConsumer, PushStrS)), - - PullStrS=?match({_,key,_,_,_,_}, 'notify_test_StrPullS':oe_create(['PULL_STRUCTURED',StructuredProxyPullConsumer], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':connect_structured_pull_supplier(StructuredProxyPullConsumer, PullStrS)), - - ES1=[#'CosNotification_EventType'{domain_name = "name1", type_name = "type1"}, - #'CosNotification_EventType'{domain_name = "name2", type_name = "type2"}], - ES2=[#'CosNotification_EventType'{domain_name = "name3", type_name = "type3"}, - #'CosNotification_EventType'{domain_name = "name4", type_name = "type4"}], - - %% Initially it should have no associated types. Test that and set that - %% all updates should be forwarded to client. - ?match([], 'CosNotifyChannelAdmin_StructuredProxyPushConsumer': - obtain_subscription_types(StructuredProxyPushConsumer, - 'ALL_NOW_UPDATES_ON')), - ?match([], 'CosNotifyChannelAdmin_StructuredProxyPullConsumer': - obtain_subscription_types(StructuredProxyPullConsumer, - 'ALL_NOW_UPDATES_ON')), - - %% Update the offered types. - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer': - offer_change(StructuredProxyPushConsumer, ES1, [])), - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer': - offer_change(StructuredProxyPullConsumer, ES1, [])), - - %% To be sure, wait a couple of seconds. - timer:sleep(5000), - ?match([{'CosNotification_EventType',_,_}, - {'CosNotification_EventType',_,_}], - 'notify_test_StrPushC':doAction(PushStrS, return_data)), - ?match([{'CosNotification_EventType',_,_}, - {'CosNotification_EventType',_,_}], - 'notify_test_StrPullC':doAction(PullStrS, return_data)), - - %% Update the offered types. Remove ES1 and add ES2. - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer': - offer_change(StructuredProxyPushConsumer, ES2, ES1)), - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer': - offer_change(StructuredProxyPullConsumer, ES2, ES1)), - - %% To be sure, wait a couple of seconds. - timer:sleep(5000), - ?match([{'CosNotification_EventType',_,_}, - {'CosNotification_EventType',_,_}], - 'notify_test_StrPushC':doAction(PushStrS, return_data)), - ?match([{'CosNotification_EventType',_,_}, - {'CosNotification_EventType',_,_}], - 'notify_test_StrPullC':doAction(PullStrS, return_data)), - - %% Now, the objects should only contain 'ES2'. Test it. - ?match([{'CosNotification_EventType',_,_}, - {'CosNotification_EventType',_,_}], - 'CosNotifyChannelAdmin_StructuredProxyPushConsumer': - obtain_subscription_types(StructuredProxyPushConsumer, - 'ALL_NOW_UPDATES_ON')), - ?match([{'CosNotification_EventType',_,_}, - {'CosNotification_EventType',_,_}], - 'CosNotifyChannelAdmin_StructuredProxyPullConsumer': - obtain_subscription_types(StructuredProxyPullConsumer, - 'ALL_NOW_UPDATES_ON')), - - %% Now we will use wildcards, empty strings and test if they really - %% are ignored if so requested. - ES3=[#'CosNotification_EventType'{domain_name = "name1", type_name = "*"}, - #'CosNotification_EventType'{domain_name = "*", type_name = "type2"}], - ES4=[#'CosNotification_EventType'{domain_name = "name1", type_name = "*"}, - #'CosNotification_EventType'{domain_name = "name2", type_name = ""}], - ES5=[#'CosNotification_EventType'{domain_name = "na*", type_name = "type1"}], - ES6=[#'CosNotification_EventType'{domain_name = "n*1", type_name = "type1"}], - ES7=[#'CosNotification_EventType'{domain_name = "*1", type_name = "type1"}], - ES8=[#'CosNotification_EventType'{domain_name = "n*m*1", type_name = "type1"}], - ES9=[#'CosNotification_EventType'{domain_name = "n**1", type_name = "type1"}], - ES10=[#'CosNotification_EventType'{domain_name = "nam*1", type_name = "type1"}], - - Event1 = ?not_CreateSE("name1","type1", - "event_name", - [#'CosNotification_Property'{name="property_name", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)), - Event2 = ?not_CreateSE("name2","type1", - "event_name", - [#'CosNotification_Property'{name="property_name", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)), - Event3 = ?not_CreateSE("mame1","type1", - "event_name", - [#'CosNotification_Property'{name="property_name", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)), - Event4 = ?not_CreateSE("naame1","type1", - "event_name", - [#'CosNotification_Property'{name="property_name", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)), - Event5 = ?not_CreateSE("nname1","type1", - "event_name", - [#'CosNotification_Property'{name="property_name", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)), - Event6 = ?not_CreateSE("name12","type1", - "event_name", - [#'CosNotification_Property'{name="property_name", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)), - - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier': - subscription_change(StructuredProxyPullSupplier, ES3, [])), - - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, Event1)), - - ?match(Event1, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier': - subscription_change(StructuredProxyPullSupplier, ES4, ES3)), - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, Event1)), - ?match(Event1, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier': - subscription_change(StructuredProxyPullSupplier, ES5, ES4)), - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, Event1)), - ?match(Event1, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier': - subscription_change(StructuredProxyPullSupplier, ES6, ES5)), - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, Event1)), - ?match(Event1, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier': - subscription_change(StructuredProxyPullSupplier, ES7, ES6)), - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, Event1)), - ?match(Event1, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier': - subscription_change(StructuredProxyPullSupplier, ES8, ES7)), - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, Event1)), - ?match(Event1, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier': - subscription_change(StructuredProxyPullSupplier, ES9, ES8)), - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, Event1)), - ?match(Event1, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, Event2)), - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, Event3)), - - timer:sleep(5000), - ?match({_NilStrEvent,false}, 'notify_test_StrPullC':doAction(PullStrC, try_pull_str)), - - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier': - subscription_change(StructuredProxyPullSupplier, ES10, ES9)), - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, Event1)), - ?match(Event1, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, Event4)), - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, Event5)), - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, Event6)), - - timer:sleep(5000), - ?match({_NilStrEvent,false}, 'notify_test_StrPullC':doAction(PullStrC, try_pull_str)), - - - catch corba:dispose(StructuredProxyPushConsumer), - catch corba:dispose(StructuredProxyPullConsumer), - catch corba:dispose(StructuredProxyPushSupplier), - catch corba:dispose(StructuredProxyPullSupplier), - catch corba:dispose(AdminConsumer), - catch corba:dispose(AdminSupplier), - catch corba:dispose(Ch), - catch cosNotificationApp:stop_factory(Fac), - - timer:sleep(5000), - ?match(true, corba_object:non_existent(PullStrS)), - ?match(true, corba_object:non_existent(PushStrS)), - ?match(true, corba_object:non_existent(PullStrC)), - ?match(true, corba_object:non_existent(PushStrC)), - - ok. - -%%----------------------------------------------------------------- -%% Filter admin API tests -%%----------------------------------------------------------------- -filter_adm_api(_Config) -> - Fac = (catch cosNotificationApp:start_global_factory(?FAC_OPT)), - ?match({_,key,_,_,_,_}, Fac), - {Ch, _Id1} = (catch 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(Fac, ?defaultQoS, ?defaultAdm)), - ?match({_,key,_,_,_,_}, Ch), - - FiFac = 'CosNotifyFilter_FilterFactory':oe_create(), - ?match({_,key,_,_,_,_}, FiFac), - - Filter = 'CosNotifyFilter_FilterFactory':create_filter(FiFac,"EXTENDED_TCL"), - ?match({_,key,_,_,_,_}, Filter), - - AC=?match({_,key,_,_,_,_}, - 'CosNotifyChannelAdmin_EventChannel':for_consumers(Ch)), - filter_tests('CosNotifyChannelAdmin_ConsumerAdmin', AC, Filter, Ch), - - AS=?match({_,key,_,_,_,_}, - 'CosNotifyChannelAdmin_EventChannel':for_suppliers(Ch)), - filter_tests('CosNotifyChannelAdmin_SupplierAdmin', AS, Filter, Ch), - - PushS=?match({_,key,_,_,_,_}, - 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_push_supplier(AC)), - filter_tests('CosNotifyChannelAdmin_ProxyPushSupplier', PushS, Filter, Ch), - - PullS=?match({_,key,_,_,_,_}, - 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_pull_supplier(AC)), - filter_tests('CosNotifyChannelAdmin_ProxyPullSupplier', PullS, Filter, Ch), - - PushC=?match({_,key,_,_,_,_}, - 'CosNotifyChannelAdmin_SupplierAdmin':obtain_push_consumer(AS)), - filter_tests('CosNotifyChannelAdmin_ProxyPushConsumer', PushC, Filter, Ch), - - PullC=?match({_,key,_,_,_,_}, - 'CosNotifyChannelAdmin_SupplierAdmin':obtain_pull_consumer(AS)), - filter_tests('CosNotifyChannelAdmin_ProxyPullConsumer', PullC, Filter, Ch), - - catch corba:dispose(FiFac), - catch corba:dispose(Filter), - catch corba:dispose(PushS), - catch corba:dispose(PullS), - catch corba:dispose(PushC), - catch corba:dispose(PullC), - catch corba:dispose(AC), - catch corba:dispose(AS), - catch corba:dispose(Ch), - catch cosNotificationApp:stop_factory(Fac), - ok. - -filter_tests(Mod, Obj, Filter, Ch) -> - io:format("############ TESTING MODULE ~p FILTER ############~n", [Mod]), - %% No filter added. - ?match([], Mod:get_all_filters(Obj)), - ?match(ok, Mod:remove_all_filters(Obj)), - ?match({'EXCEPTION',{'CosNotifyFilter_FilterNotFound',_}}, - Mod:get_filter(Obj, 0)), - %% Try add a Filter which is not a filter. - ?match({'EXCEPTION',{'BAD_PARAM',_,_,_}}, Mod:add_filter(Obj, Ch)), - %% Try to remove a single filter. - ?match({'EXCEPTION',{'CosNotifyFilter_FilterNotFound',_}}, - Mod:remove_filter(Obj, 0)), - ID = Mod:add_filter(Obj, Filter), - ?match([ID], Mod:get_all_filters(Obj)), - ?match(Filter, Mod:get_filter(Obj, ID)), - ?match(ok, Mod:remove_filter(Obj, ID)), - ?match([], Mod:get_all_filters(Obj)), - ID2 = Mod:add_filter(Obj, Filter), - ?match([ID2], Mod:get_all_filters(Obj)), - ?match(ok, Mod:remove_all_filters(Obj)), - ?match([], Mod:get_all_filters(Obj)), - ok. - -%%----------------------------------------------------------------- -%% Creating different event pushing and pulling API tests -%%----------------------------------------------------------------- -events_api(_Config) -> - %% Initialize the application. - Fac = (catch cosNotificationApp:start_global_factory(?FAC_OPT)), - ?match({_,key,_,_,_,_}, Fac), - {Ch, Id1} = (catch 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(Fac, ?defaultQoS, ?defaultAdm)), - ?match({_,key,_,_,_,_}, Ch), - events_api_helper(Fac, Ch, Id1). - -events2_api(doc) -> ["CosNotification event pushing and pulling tests II", ""]; -events2_api(suite) -> []; -events2_api(_Config) -> - %% Initialize the application. - Fac = (catch cosNotificationApp:start_global_factory(?FAC_OPT)), - ?match({_,key,_,_,_,_}, Fac), - {Ch, Id1} = (catch 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(Fac, ?defaultQoS2, ?defaultAdm)), - ?match({_,key,_,_,_,_}, Ch), - events_api_helper(Fac, Ch, Id1). - -events_api_helper(Fac, Ch, _Id1) -> - %% Now we will set up a test environment, with the following structure: - %% - %% Channel - %% / \ - %% Supplier Adm Consumer Adm - %% / \ - %% 1 proxy of each possible type - %% To each proxy we will connect a test client - %% The events will flow in ===>> direction. - %% - %% For the supplier Admins this include: - %% - ProxyPushConsumer - %% - SequenceProxyPushConsumer - %% - StructuredProxyPushConsumer - %% - ProxyPullConsumer - %% - SequenceProxyPullConsumer - %% - StructuredProxyPullConsumer - %% - %% For the consumer Admins this include: - %% - ProxyPushSupplier - %% - SequenceProxyPushSupplier - %% - StructuredProxyPushSupplier - %% - ProxyPullSupplier - %% - SequenceProxyPullSupplier - %% - StructuredProxyPullSupplier - %% - %% - %% We will not use any Filters to begin with, just want to make sure we can - %% deliver events from all start- to end-points. - - %% Create the Admin objects - {AdminSupplier, _ASID}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_EventChannel':new_for_suppliers(Ch,'AND_OP')), - {AdminConsumer, _ACID}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_EventChannel':new_for_consumers(Ch,'AND_OP')), - - %% Create Suppliers Proxies - {ProxyPullSupplier,_ID1}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_notification_pull_supplier(AdminConsumer, 'ANY_EVENT')), - {StructuredProxyPullSupplier,_ID2}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_notification_pull_supplier(AdminConsumer, 'STRUCTURED_EVENT')), - {SequenceProxyPullSupplier,_ID3}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_notification_pull_supplier(AdminConsumer, 'SEQUENCE_EVENT')), - - {ProxyPushSupplier,_I4D}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_notification_push_supplier(AdminConsumer, 'ANY_EVENT')), - {StructuredProxyPushSupplier,_ID5}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_notification_push_supplier(AdminConsumer, 'STRUCTURED_EVENT')), - {SequenceProxyPushSupplier,_ID6}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_notification_push_supplier(AdminConsumer, 'SEQUENCE_EVENT')), - - %% Now we must create a Client for each proxy and connect them. - PushAnyC=?match({_,key,_,_,_,_}, 'notify_test_AnyPushC':oe_create(['PUSH_ANY', ProxyPushSupplier], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_ProxyPushSupplier':connect_any_push_consumer(ProxyPushSupplier, PushAnyC)), - - PushStrC=?match({_,key,_,_,_,_}, 'notify_test_StrPushC':oe_create(['PUSH_STRUCTURED',StructuredProxyPushSupplier], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':connect_structured_push_consumer(StructuredProxyPushSupplier, PushStrC)), - - PushSeqC=?match({_,key,_,_,_,_}, 'notify_test_SeqPushC':oe_create(['PUSH_SEQUENCE',SequenceProxyPushSupplier], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':connect_sequence_push_consumer(SequenceProxyPushSupplier, PushSeqC)), - - PullAnyC=?match({_,key,_,_,_,_}, 'notify_test_AnyPullC':oe_create(['PULL_ANY', ProxyPullSupplier], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_ProxyPullSupplier':connect_any_pull_consumer(ProxyPullSupplier, PullAnyC)), - - PullStrC=?match({_,key,_,_,_,_}, 'notify_test_StrPullC':oe_create(['PULL_STRUCTURED',StructuredProxyPullSupplier], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':connect_structured_pull_consumer(StructuredProxyPullSupplier, PullStrC)), - - PullSeqC=?match({_,key,_,_,_,_}, 'notify_test_SeqPullC':oe_create(['PULL_SEQUENCE',SequenceProxyPullSupplier], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':connect_sequence_pull_consumer(SequenceProxyPullSupplier, PullSeqC)), - - - %% Create Consumers Proxies - {ProxyPullConsumer,_ID7}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_SupplierAdmin':obtain_notification_pull_consumer(AdminSupplier, 'ANY_EVENT')), - {StructuredProxyPullConsumer,_ID8}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_SupplierAdmin':obtain_notification_pull_consumer(AdminSupplier, 'STRUCTURED_EVENT')), - {SequenceProxyPullConsumer,_ID9}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_SupplierAdmin':obtain_notification_pull_consumer(AdminSupplier, 'SEQUENCE_EVENT')), - - {ProxyPushConsumer,_ID10}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_SupplierAdmin':obtain_notification_push_consumer(AdminSupplier, 'ANY_EVENT')), - {StructuredProxyPushConsumer,_ID11}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_SupplierAdmin':obtain_notification_push_consumer(AdminSupplier, 'STRUCTURED_EVENT')), - {SequenceProxyPushConsumer,_ID12}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_SupplierAdmin':obtain_notification_push_consumer(AdminSupplier, 'SEQUENCE_EVENT')), - - %% Now we must create a Client for each proxy and connect them. - PushAnyS=?match({_,key,_,_,_,_}, 'notify_test_AnyPushS':oe_create(['PUSH_ANY', ProxyPushConsumer], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_ProxyPushConsumer':connect_any_push_supplier(ProxyPushConsumer, PushAnyS)), - - PushStrS=?match({_,key,_,_,_,_}, 'notify_test_StrPushS':oe_create(['PUSH_STRUCTURED',StructuredProxyPushConsumer], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':connect_structured_push_supplier(StructuredProxyPushConsumer, PushStrS)), - - PushSeqS=?match({_,key,_,_,_,_}, 'notify_test_SeqPushS':oe_create(['PUSH_SEQUENCE',SequenceProxyPushConsumer], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':connect_sequence_push_supplier(SequenceProxyPushConsumer, PushSeqS)), - - PullAnyS=?match({_,key,_,_,_,_}, 'notify_test_AnyPullS':oe_create(['PULL_ANY', ProxyPullConsumer], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_ProxyPullConsumer':connect_any_pull_supplier(ProxyPullConsumer, PullAnyS)), - - PullStrS=?match({_,key,_,_,_,_}, 'notify_test_StrPullS':oe_create(['PULL_STRUCTURED',StructuredProxyPullConsumer], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':connect_structured_pull_supplier(StructuredProxyPullConsumer, PullStrS)), - - PullSeqS=?match({_,key,_,_,_,_}, 'notify_test_SeqPullS':oe_create(['PULL_SEQUENCE',SequenceProxyPullConsumer], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':connect_sequence_pull_supplier(SequenceProxyPullConsumer, PullSeqS)), - - - %% Create a couple of Events to test with. - Event = ?not_CreateSE("DomainName","CommunicationsAlarm", - "lost_packet", - [#'CosNotification_Property'{name="priority", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)), - - Event2 = ?not_CreateSE("DomainName","TemperatureAlarm", - "over_heated", - [#'CosNotification_Property'{name="priority", - value=any:create(orber_tc:short(), 10)}], - [], any:create(orber_tc:null(), null)), - - - AnyEvent = any:create(orber_tc:long(), 100), - - StrEvent = ?not_CreateSE("","%ANY","",[],[],AnyEvent), - NilAnyEvent = any:create(orber_tc:null(), null), - NilStrEvent = ?not_CreateSE("","","",[],[],NilAnyEvent), - - ConvertedStr = any:create('CosNotification_StructuredEvent':tc(), Event), - - io:format("###################### PUSH STRUCTURED ########################"), - - %% Test with pushing a structured event. - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, Event)), - - %% Wait for a while so we are sure that all events have been delivered as far - %% as the Notification service can automatically. - timer:sleep(5000), - - %% Check if the Clients have received and stored the events. - ?match([{any,_,Event}], 'notify_test_AnyPushC':doAction(PushAnyC, return_data)), - ?match([Event], 'notify_test_StrPushC':doAction(PushStrC, return_data)), - ?match([Event], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - - %% Instruct the Clients to pull the events and check if they match. - ?match({any,_,Event}, 'notify_test_AnyPullC':doAction(PullAnyC, pull_any)), - ?match(Event, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - ?match([Event], 'notify_test_SeqPullC':doAction(PullSeqC, {pull_seq,1})), - - io:format("###################### PUSH SEQUENCE ########################"), - - %% Create an Event Sequence and push it. - EventSeq = [Event, Event2], - - %% Test with pushing a event sequence. - ?match(ok,'CosNotifyChannelAdmin_SequenceProxyPushConsumer':push_structured_events(SequenceProxyPushConsumer, EventSeq)), - - %% Wait for a while so we are sure that all events have been delivered as far - %% as the Notification service can automatically. - timer:sleep(5000), - - %% Instruct the Clients to pull the events and check if they match. - ?match({any,_,Event}, 'notify_test_AnyPullC':doAction(PullAnyC, pull_any)), - ?match(Event, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - ?match([Event,Event2], 'notify_test_SeqPullC':doAction(PullSeqC, {pull_seq,2})), - ?match({any,_,Event2}, 'notify_test_AnyPullC':doAction(PullAnyC, pull_any)), - ?match(Event2, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - - %% Check if the Push Clients have received and stored the events. - ?match([{any,_,Event}, {any,_,Event2}], 'notify_test_AnyPushC':doAction(PushAnyC, return_data)), - ?match([Event, Event2], 'notify_test_StrPushC':doAction(PushStrC, return_data)), - ?match([Event, Event2], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - - io:format("###################### PUSH ANY ########################"), - - %% Test with pushing an any event. - ?match(ok,'CosEventChannelAdmin_ProxyPushConsumer':push(ProxyPushConsumer, AnyEvent)), - - %% Wait for a while so we are sure that all events have been delivered as far - %% as the Notification service can automatically. - timer:sleep(5000), - - %% Check if the Clients have received and stored the events. - ?match([AnyEvent], 'notify_test_AnyPushC':doAction(PushAnyC, return_data)), - ?match([StrEvent], 'notify_test_StrPushC':doAction(PushStrC, return_data)), - ?match([StrEvent], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - - %% Instruct the Clients to pull the events and check if they match. - ?match(AnyEvent, 'notify_test_AnyPullC':doAction(PullAnyC, pull_any)), - ?match(StrEvent, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - ?match([StrEvent], 'notify_test_SeqPullC':doAction(PullSeqC, {pull_seq,10})), - - - - io:format("###################### PUSH CONVERTED ANY #############"), - - %% Test with pushing a structured event. - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, StrEvent)), - - %% Wait for a while so we are sure that all events have been delivered as far - %% as the Notification service can automatically. - timer:sleep(5000), - - %% Check if the Clients have received and stored the events. - ?match([AnyEvent], 'notify_test_AnyPushC':doAction(PushAnyC, return_data)), - ?match([StrEvent], 'notify_test_StrPushC':doAction(PushStrC, return_data)), - ?match([StrEvent], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - - %% Instruct the Clients to pull the events and check if they match. - ?match(AnyEvent, 'notify_test_AnyPullC':doAction(PullAnyC, pull_any)), - ?match(StrEvent, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - ?match([StrEvent], 'notify_test_SeqPullC':doAction(PullSeqC, {pull_seq,1})), - - - io:format("###################### PUSH CONVERTED STRUCTURED ########"), - - %% Test with pushing an any event. - ?match(ok,'CosEventChannelAdmin_ProxyPushConsumer':push(ProxyPushConsumer, ConvertedStr)), - - %% Wait for a while so we are sure that all events have been delivered as far - %% as the Notification service can automatically. - timer:sleep(5000), - - %% Check if the Clients have received and stored the events. - ?match([ConvertedStr], 'notify_test_AnyPushC':doAction(PushAnyC, return_data)), - ?match([Event], 'notify_test_StrPushC':doAction(PushStrC, return_data)), - ?match([Event], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - - %% Instruct the Clients to pull the events and check if they match. - ?match(ConvertedStr, 'notify_test_AnyPullC':doAction(PullAnyC, pull_any)), - ?match(Event, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - ?match([Event], 'notify_test_SeqPullC':doAction(PullSeqC, {pull_seq,10})), - - - io:format("###################### TRY PULL ########################"), - - %% Now we will push an any event after a delay. This means that try_pull-functions, - %% since it's not blocking, will return, [], NilAny or NilStructured events and - %% the Boolean false. - spawn(notify_test_impl, delay, [ProxyPushConsumer, AnyEvent, 20000, - 'CosEventChannelAdmin_ProxyPushConsumer',push]), - ?match([], 'notify_test_AnyPushC':doAction(PushAnyC, return_data)), - ?match([], 'notify_test_StrPushC':doAction(PushStrC, return_data)), - ?match([], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - - %% Instruct the Clients to pull the events and check if they match. - ?match({NilAnyEvent,false}, 'notify_test_AnyPullC':doAction(PullAnyC, try_pull_any)), - ?match({NilStrEvent,false}, 'notify_test_StrPullC':doAction(PullStrC, try_pull_str)), - ?match({[],false}, 'notify_test_SeqPullC':doAction(PullSeqC, {try_pull_seq,10})), - - - %% Instruct the Clients to pull the events and check if they match. - %% Pull is blocking so in the print-out we should see that nothing - %% is returned until the pushed event reaches the end proxies. - ?match(AnyEvent, 'notify_test_AnyPullC':doAction(PullAnyC, pull_any)), - ?match(StrEvent, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - ?match([StrEvent], 'notify_test_SeqPullC':doAction(PullSeqC, {pull_seq,1})), - - %% To make sure there are no other circumstanses which lead to a delay we - %% hold for some time. - timer:sleep(5000), - %% Check if the Clients have received and stored the events. - ?match([AnyEvent], 'notify_test_AnyPushC':doAction(PushAnyC, return_data)), - ?match([StrEvent], 'notify_test_StrPushC':doAction(PushStrC, return_data)), - ?match([StrEvent], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - - %% Test with pushing a event sequence but only pull sequences of length 1. - ?match(ok,'CosNotifyChannelAdmin_SequenceProxyPushConsumer':push_structured_events(SequenceProxyPushConsumer, EventSeq)), - - %% Wait for a while so we are sure that all events have been delivered as far - %% as the Notification service can automatically. - timer:sleep(5000), - %% Pull 1 event at a time. - ?match([Event], 'notify_test_SeqPullC':doAction(PullSeqC, {pull_seq,1})), - ?match([Event2], 'notify_test_SeqPullC':doAction(PullSeqC, {pull_seq,1})), - - %% Following cases already tested; done for clean up. - ?match({any,_,Event}, 'notify_test_AnyPullC':doAction(PullAnyC, pull_any)), - ?match(Event, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - ?match({any,_,Event2}, 'notify_test_AnyPullC':doAction(PullAnyC, pull_any)), - ?match(Event2, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - ?match([{any,_,Event}, {any,_,Event2}], 'notify_test_AnyPushC':doAction(PushAnyC, return_data)), - ?match([Event, Event2], 'notify_test_StrPushC':doAction(PushStrC, return_data)), - ?match([Event, Event2], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - %% clean up done - - - io:format("###################### PROXY PULLER ########################"), - - %% Now we will just add Events to a cleint and wait for the Notification service - %% to pull the events and forward them to the consumer clients. - ?match(ok, 'notify_test_SeqPushC':doAction(PullAnyS, {set_data, [AnyEvent]})), - - - %% Instruct the Clients to pull the events and check if they match. - %% Pull is blocking so in the print-out we should see that nothing - %% is returned until the pushed event reaches the end proxies. - ?match(AnyEvent, 'notify_test_AnyPullC':doAction(PullAnyC, pull_any)), - ?match(StrEvent, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - ?match([StrEvent], 'notify_test_SeqPullC':doAction(PullSeqC, {pull_seq,10})), - - %% To make sure there are no other circumstanses which lead to a delay we - %% hold for some time. - timer:sleep(5000), - %% Check if the Clients have received and stored the events. - ?match([AnyEvent], 'notify_test_AnyPushC':doAction(PushAnyC, return_data)), - ?match([StrEvent], 'notify_test_StrPushC':doAction(PushStrC, return_data)), - ?match([StrEvent], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - - io:format("###################### SUSPENDED CONNECTION ################"), - - - %% Suspend the connections - ?match(ok,'CosNotifyChannelAdmin_SequenceProxyPushSupplier':suspend_connection(SequenceProxyPushSupplier)), - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushSupplier':suspend_connection(StructuredProxyPushSupplier)), - - %% Test with pushing a event sequence. - ?match(ok,'CosNotifyChannelAdmin_SequenceProxyPushConsumer':push_structured_events(SequenceProxyPushConsumer, EventSeq)), - - %% Wait for a while so we are sure that all events have been delivered as far - %% as the Notification service can automatically. - timer:sleep(5000), - - %% Instruct the Clients to pull the events and check if they match. - ?match({any,_,Event}, 'notify_test_AnyPullC':doAction(PullAnyC, pull_any)), - ?match(Event, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - ?match([Event,Event2], 'notify_test_SeqPullC':doAction(PullSeqC, {pull_seq,2})), - ?match({any,_,Event2}, 'notify_test_AnyPullC':doAction(PullAnyC, pull_any)), - ?match(Event2, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - - %% Check if the Any Client have received and stored the events. - ?match([{any,_,Event}, {any,_,Event2}], 'notify_test_AnyPushC':doAction(PushAnyC, return_data)), - - %% Check if the other Clients have received any events. Error if have. - ?match([], 'notify_test_StrPushC':doAction(PushStrC, return_data)), - ?match([], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - - ?match(ok,'CosNotifyChannelAdmin_SequenceProxyPushSupplier':resume_connection(SequenceProxyPushSupplier)), - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushSupplier':resume_connection(StructuredProxyPushSupplier)), - - %% To be sure the test case don't fail due to time-race, sleep. - timer:sleep(5000), - - ?match([Event, Event2], 'notify_test_StrPushC':doAction(PushStrC, return_data)), - ?match([Event, Event2], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - - - io:format("###################### FILTER EVENTS #######################"), - - %% Now we will add filters and see if the system behaves correctly. - FiFac = 'CosNotifyFilter_FilterFactory':oe_create(), - Filter = 'CosNotifyFilter_FilterFactory':create_filter(FiFac,"EXTENDED_TCL"), - %% Add constraints to the Filter - [{_,_,CID1},{_,_,CID2}]= - ?match([{'CosNotifyFilter_ConstraintInfo',_,_}, {'CosNotifyFilter_ConstraintInfo',_,_}], - 'CosNotifyFilter_Filter':add_constraints(Filter, - [#'CosNotifyFilter_ConstraintExp'{event_types = - [#'CosNotification_EventType'{ - domain_name = "Spare*", - type_name = "MOVIE"}], - constraint_expr = "$type_name == 'MOVIE' and (('groucho' in $starlist) + ('chico' in $starlist) + ('harpo' in $starlist) + ('zeppo' in $starlist) + ('gummo' in $starlist)) > 2"}, - #'CosNotifyFilter_ConstraintExp'{event_types = - [#'CosNotification_EventType'{ - domain_name = "*", - type_name = "TestResults"}], - constraint_expr = "$test._length == 3 and ($test[0].score + $test[1].score + $test[2].score)/3 >=80"}])), - - ?match([{'CosNotifyFilter_ConstraintInfo',_,CID2}, {'CosNotifyFilter_ConstraintInfo',_,CID1}], - 'CosNotifyFilter_Filter':get_all_constraints(Filter)), - ?match([{'CosNotifyFilter_ConstraintInfo',_,CID1}], - 'CosNotifyFilter_Filter':get_constraints(Filter, [CID1])), - - %% Associate the Filter with different objects. - %% Since we use the same filter for both objects the events will never reach the admin. - _FilterID = 'CosNotifyChannelAdmin_ConsumerAdmin':add_filter(AdminConsumer, Filter), - - _FilterID2 = 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':add_filter(StructuredProxyPushConsumer, Filter), - event_filtering(FiFac, Filter, AdminConsumer, StructuredProxyPushConsumer, PushAnyC, - PushStrC, PushSeqC, PullAnyC, PullStrC, PullSeqC), - %% Remove the proxy filter so we can check if the events are filtered correctly by the admin. - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':remove_all_filters(StructuredProxyPushConsumer)), - event_filtering(FiFac, Filter, AdminConsumer, StructuredProxyPushConsumer, PushAnyC, - PushStrC, PushSeqC, PullAnyC, PullStrC, PullSeqC), - - - catch corba:dispose(Filter), - catch corba:dispose(FiFac), - catch corba:dispose(SequenceProxyPushConsumer), - catch corba:dispose(StructuredProxyPushConsumer), - catch corba:dispose(ProxyPushConsumer), - catch corba:dispose(SequenceProxyPullConsumer), - catch corba:dispose(StructuredProxyPullConsumer), - catch corba:dispose(ProxyPullConsumer), - catch corba:dispose(SequenceProxyPushSupplier), - catch corba:dispose(StructuredProxyPushSupplier), - catch corba:dispose(ProxyPushSupplier), - catch corba:dispose(SequenceProxyPullSupplier), - catch corba:dispose(StructuredProxyPullSupplier), - catch corba:dispose(ProxyPullSupplier), - catch corba:dispose(AdminConsumer), - catch corba:dispose(AdminSupplier), - catch corba:dispose(Ch), - catch cosNotificationApp:stop_factory(Fac), - %% The Clients should have terminated by now. Check if it is so. - timer:sleep(5000), - ?match(true, corba_object:non_existent(PullSeqS)), - ?match(true, corba_object:non_existent(PullStrS)), - ?match(true, corba_object:non_existent(PullAnyS)), - ?match(true, corba_object:non_existent(PushSeqS)), - ?match(true, corba_object:non_existent(PushStrS)), - ?match(true, corba_object:non_existent(PushAnyS)), - ?match(true, corba_object:non_existent(PullSeqC)), - ?match(true, corba_object:non_existent(PullStrC)), - ?match(true, corba_object:non_existent(PullAnyC)), - ?match(true, corba_object:non_existent(PushSeqC)), - ?match(true, corba_object:non_existent(PushStrC)), - ?match(true, corba_object:non_existent(PushAnyC)), - ok. - -event_filtering(_FiFac, _Filter, _AdminConsumer, StructuredProxyPushConsumer, PushAnyC, PushStrC, PushSeqC, PullAnyC, PullStrC, PullSeqC) -> - NilAnyEvent = any:create(orber_tc:null(), null), - NilStrEvent = ?not_CreateSE("","","",[],[],NilAnyEvent), - - TrueEvent1 = ?not_CreateSE("SpareTime","MOVIE", - "EventName", - [#'CosNotification_Property'{name="starlist", - value=any:create(orber_tc:sequence(orber_tc:string(0),0), - ["groucho", "harpo", "sam", "gummo"])}], - [], any:create(orber_tc:null(), null)), - TrueEvent2 = ?not_CreateSE("Studies","TestResults", - "EventName", [], - [#'CosNotification_Property'{name="test", - value=any:create(orber_tc:array(notify_test_data:tc(),3), - {#notify_test_data{score=75, - name="name"}, - #notify_test_data{score=80, - name="name"}, - #notify_test_data{score=85, - name="name"}})}], - any:create(orber_tc:null(), null)), - - FalseEvent1 = ?not_CreateSE("SpareTime","MOVIE", - "EventName", - [#'CosNotification_Property'{name="starlist", - value=any:create(orber_tc:sequence(orber_tc:string(0),0), - ["frodo", "bilbo", "sam", "gummo"])}], - [], any:create(orber_tc:null(), null)), - FalseEvent2 = ?not_CreateSE("Studies","TestResults", - "EventName", [], - [#'CosNotification_Property'{name="test", - value=any:create(orber_tc:array(notify_test_data:tc(),3), - {#notify_test_data{score=75, - name="name"}, - #notify_test_data{score=80, - name="name"}, - #notify_test_data{score=80, - name="name"}})}], - any:create(orber_tc:null(), null)), - %% Test with pushing the first structured event that should not be filtered away. - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, TrueEvent1)), - - %% Wait for a while so we are sure that all events have been delivered as far - %% as the Notification service can automatically. - timer:sleep(5000), - - %% Check if the Clients have received and stored the events. - ?match([{any,_,TrueEvent1}], 'notify_test_AnyPushC':doAction(PushAnyC, return_data)), - ?match([TrueEvent1], 'notify_test_StrPushC':doAction(PushStrC, return_data)), - ?match([TrueEvent1], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - - %% Instruct the Clients to pull the events and check if they match. - ?match({any,_,TrueEvent1}, 'notify_test_AnyPullC':doAction(PullAnyC, pull_any)), - ?match(TrueEvent1, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - ?match([TrueEvent1], 'notify_test_SeqPullC':doAction(PullSeqC, {pull_seq,1})), - - %% Test with pushing the second structured event that should not be filtered away. - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, TrueEvent2)), - - %% Wait for a while so we are sure that all events have been delivered as far - %% as the Notification service can automatically. - timer:sleep(5000), - - %% Check if the Clients have received and stored the events. - ?match([{any,_,TrueEvent2}], 'notify_test_AnyPushC':doAction(PushAnyC, return_data)), - ?match([TrueEvent2], 'notify_test_StrPushC':doAction(PushStrC, return_data)), - ?match([TrueEvent2], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - - %% Instruct the Clients to pull the events and check if they match. - ?match({any,_,TrueEvent2}, 'notify_test_AnyPullC':doAction(PullAnyC, pull_any)), - ?match(TrueEvent2, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - ?match([TrueEvent2], 'notify_test_SeqPullC':doAction(PullSeqC, {pull_seq,1})), - - %% Test with pushing the first structured event that should be filtered away. - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, FalseEvent1)), - - %% Wait for a while so we are sure that all events have been delivered as far - %% as the Notification service can automatically. - timer:sleep(5000), - - %% Check if the Clients have received and stored the events. - ?match([], 'notify_test_AnyPushC':doAction(PushAnyC, return_data)), - ?match([], 'notify_test_StrPushC':doAction(PushStrC, return_data)), - ?match([], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - - %% Instruct the Clients to pull the events and check if they match. - ?match({NilAnyEvent,false}, 'notify_test_AnyPullC':doAction(PullAnyC, try_pull_any)), - ?match({NilStrEvent,false}, 'notify_test_StrPullC':doAction(PullStrC, try_pull_str)), - ?match({[],false}, 'notify_test_SeqPullC':doAction(PullSeqC, {try_pull_seq,10})), - - %% Test with pushing the second structured event that should be filtered away. - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, FalseEvent2)), - - %% Wait for a while so we are sure that all events have been delivered as far - %% as the Notification service can automatically. - timer:sleep(5000), - - %% Check if the Clients have received and stored the events. - ?match([], 'notify_test_AnyPushC':doAction(PushAnyC, return_data)), - ?match([], 'notify_test_StrPushC':doAction(PushStrC, return_data)), - ?match([], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - - %% Instruct the Clients to pull the events and check if they match. - ?match({NilAnyEvent,false}, 'notify_test_AnyPullC':doAction(PullAnyC, try_pull_any)), - ?match({NilStrEvent,false}, 'notify_test_StrPullC':doAction(PullStrC, try_pull_str)), - ?match({[],false}, 'notify_test_SeqPullC':doAction(PullSeqC, {try_pull_seq,10})). - - - -%%----------------------------------------------------------------- -%% Creating different cosEvent API tests -%%----------------------------------------------------------------- -cosevent_api(_Config) -> - Fac = (catch cosNotificationApp:start_global_factory(?FAC_OPT)), - ?match({_,key,_,_,_,_}, Fac), - {Ch, _Id1} = (catch 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(Fac, ?defaultQoS, ?defaultAdm)), - ?match({_,key,_,_,_,_}, Ch), - AC=?match({_,key,_,_,_,_}, - 'CosEventChannelAdmin_EventChannel':for_consumers(Ch)), - AS=?match({_,key,_,_,_,_}, - 'CosEventChannelAdmin_EventChannel':for_suppliers(Ch)), - - PushS=?match({_,key,_,_,_,_}, - 'CosEventChannelAdmin_ConsumerAdmin':obtain_push_supplier(AC)), - PullS=?match({_,key,_,_,_,_}, - 'CosEventChannelAdmin_ConsumerAdmin':obtain_pull_supplier(AC)), - - PushC=?match({_,key,_,_,_,_}, - 'CosEventChannelAdmin_SupplierAdmin':obtain_push_consumer(AS)), - PullC=?match({_,key,_,_,_,_}, - 'CosEventChannelAdmin_SupplierAdmin':obtain_pull_consumer(AS)), - - PushAnyC=?match({_,key,_,_,_,_}, - 'notify_test_AnyPushC':oe_create(['PUSH_ANY', PushC], - [{local_typecheck, false}])), - PushStrC=?match({_,key,_,_,_,_}, - 'notify_test_StrPushC':oe_create(['PUSH_STRUCTURED',false], - [{local_typecheck, false}])), - PushSeqC=?match({_,key,_,_,_,_}, - 'notify_test_SeqPushC':oe_create(['PUSH_SEQUENCE',false], - [{local_typecheck, false}])), - - PullAnyC=?match({_,key,_,_,_,_}, - 'notify_test_AnyPullC':oe_create(['PULL_ANY', PullC], - [{local_typecheck, false}])), - PullStrC=?match({_,key,_,_,_,_}, - 'notify_test_StrPullC':oe_create(['PULL_STRUCTURED',false], - [{local_typecheck, false}])), - PullSeqC=?match({_,key,_,_,_,_}, - 'notify_test_SeqPullC':oe_create(['PULL_SEQUENCE',false], - [{local_typecheck, false}])), - - PushAnyS=?match({_,key,_,_,_,_}, - 'notify_test_AnyPushS':oe_create(['PUSH_ANY', PushC], - [{local_typecheck, false}])), - PushStrS=?match({_,key,_,_,_,_}, - 'notify_test_StrPushS':oe_create(['PUSH_STRUCTURED',false], - [{local_typecheck, false}])), - PushSeqS=?match({_,key,_,_,_,_}, - 'notify_test_SeqPushS':oe_create(['PUSH_SEQUENCE',false], - [{local_typecheck, false}])), - - PullAnyS=?match({_,key,_,_,_,_}, - 'notify_test_AnyPullS':oe_create(['PULL_ANY', PullS], - [{local_typecheck, false}])), - PullStrS=?match({_,key,_,_,_,_}, - 'notify_test_StrPullS':oe_create(['PULL_STRUCTURED',false], - [{local_typecheck, false}])), - PullSeqS=?match({_,key,_,_,_,_}, - 'notify_test_SeqPullS':oe_create(['PULL_SEQUENCE',false], - [{local_typecheck, false}])), - - %% In the OMG specification Proxies do not inherrit from CosEvent. Must use - %% Notify interface. - ?match({'EXCEPTION',{'BAD_PARAM',_,_,_}}, - 'CosEventChannelAdmin_ProxyPullConsumer':connect_pull_supplier(PullC, PushStrS)), - - ?match(ok, - 'CosEventChannelAdmin_ProxyPushSupplier':connect_push_consumer(PushS, PushAnyC)), - ?match(ok, - 'CosEventChannelAdmin_ProxyPullSupplier':connect_pull_consumer(PullS, PullAnyC)), - - ?match(ok, - 'CosEventChannelAdmin_ProxyPushConsumer':connect_push_supplier(PushC, PushAnyS)), - ?match(ok, - 'CosEventChannelAdmin_ProxyPullConsumer':connect_pull_supplier(PullC, PullAnyS)), - - ?match({'EXCEPTION',{'CosEventChannelAdmin_AlreadyConnected',_}}, - 'CosEventChannelAdmin_ProxyPullConsumer':connect_pull_supplier(PullC, PullAnyS)), - - ?match({'EXCEPTION',{'CosEventChannelAdmin_AlreadyConnected',_}}, - 'CosNotifyChannelAdmin_ProxyPullConsumer':connect_pull_supplier(PullC, PullAnyS)), - - ?match(true, corba_object:is_a(PushS, "IDL:omg.org/CosNotifyChannelAdmin/ProxyPushSupplier:1.0")), - ?match(true, corba_object:is_a(PushS, "IDL:omg.org/CosEventChannelAdmin/ProxyPushSupplier:1.0")), - - catch corba:dispose(PushStrC), - catch corba:dispose(PushSeqC), - catch corba:dispose(PullStrC), - catch corba:dispose(PullSeqC), - catch corba:dispose(PushStrS), - catch corba:dispose(PushSeqS), - catch corba:dispose(PullStrS), - catch corba:dispose(PullSeqS), - catch corba:dispose(PushS), - catch corba:dispose(PullS), - catch corba:dispose(PushC), - catch corba:dispose(PullC), - catch corba:dispose(AC), - catch corba:dispose(AS), - catch corba:dispose(Ch), - catch cosNotificationApp:stop_factory(Fac), - - %% The Clients should have terminated by now. Check if it is so. - timer:sleep(5000), - ?match(true, corba_object:non_existent(PullAnyS)), - ?match(true, corba_object:non_existent(PushAnyS)), - ?match(true, corba_object:non_existent(PullAnyC)), - ?match(true, corba_object:non_existent(PushAnyC)), - - - ok. - -%%----------------------------------------------------------------- -%% AdminPropertiesAdmin API tests -%%----------------------------------------------------------------- -adm_api(_Config) -> - Fac = (catch cosNotificationApp:start_global_factory(?FAC_OPT)), - ?match({_,key,_,_,_,_}, Fac), - - %% We need a few AdminProp:s to "play" with. - MQ0 = [#'CosNotification_Property'{name='CosNotification':'MaxQueueLength'(), - value=any:create(orber_tc:long(), 0)}], - MC0 = [#'CosNotification_Property'{name='CosNotification':'MaxConsumers'(), - value=any:create(orber_tc:long(), 0)}], - MS0 = [#'CosNotification_Property'{name='CosNotification':'MaxSuppliers'(), - value=any:create(orber_tc:long(), 0)}], - MQError1 = [#'CosNotification_Property'{name='CosNotification':'MaxQueueLength'(), - value=any:create(orber_tc:'float'(), 1.5)}], - MQError2 = [#'CosNotification_Property'{name='CosNotification':'MaxQueueLength'(), - value=any:create(orber_tc:long(), -1)}], - - {Ch, _Id1} = (catch 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(Fac, ?defaultQoS, ?defaultAdm)), - ?match({_,key,_,_,_,_}, Ch), - - %% Set new admin - ?match(ok, 'CosNotification_AdminPropertiesAdmin':set_admin(Ch, MQ0)), - %% It should be a list of three items. If we support more admin:s this - %% must be updated. - ?match([_,_,_], 'CosNotification_AdminPropertiesAdmin':get_admin(Ch)), - - %% Try to set admin with an uncorrect value, i.e., not integer >= 0. - ?match({'EXCEPTION',{'CosNotification_UnsupportedAdmin',_,_}}, - 'CosNotification_AdminPropertiesAdmin':set_admin(Ch, MQError1)), - ?match({'EXCEPTION',{'CosNotification_UnsupportedAdmin',_,_}}, - 'CosNotification_AdminPropertiesAdmin':set_admin(Ch, MQError2)), - - %% Try setting the other two admins and chech if the value is correct. - ?match(ok, 'CosNotification_AdminPropertiesAdmin':set_admin(Ch, MC0)), - ?match([_,_,_], 'CosNotification_AdminPropertiesAdmin':get_admin(Ch)), - - ?match(ok, 'CosNotification_AdminPropertiesAdmin':set_admin(Ch, MS0)), - ?match([_,_,_], 'CosNotification_AdminPropertiesAdmin':get_admin(Ch)), - - catch corba:dispose(Ch), - catch cosNotificationApp:stop_factory(Fac), - ok. - - -%%----------------------------------------------------------------- -%% QoSAdm API tests -%%----------------------------------------------------------------- -qos_api(_Config) -> - Fac = (catch cosNotificationApp:start_global_factory(?FAC_OPT)), - ?match({_,key,_,_,_,_}, Fac), - - {Ch, _Id1} = (catch 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(Fac, ?defaultQoS, ?defaultAdm)), - ?match({_,key,_,_,_,_}, Ch), - - - QoSPersistent = [#'CosNotification_Property'{name='CosNotification':'ConnectionReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'Persistent'())}], - QoSBestEffort = [#'CosNotification_Property'{name='CosNotification':'ConnectionReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'BestEffort'())}], - - QoSEventPersistent = [#'CosNotification_Property'{name='CosNotification':'EventReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'Persistent'())}], - QoSEventBestEffort = [#'CosNotification_Property'{name='CosNotification':'EventReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'BestEffort'())}], - - QoSOKMaxBatchSize = [#'CosNotification_Property'{name='CosNotification':'MaximumBatchSize'(), - value=any:create(orber_tc:long(), 200)}], - QoSToHighMaxBatchSize = [#'CosNotification_Property'{name='CosNotification':'MaximumBatchSize'(), - value=any:create(orber_tc:long(), 100000000)}], - - QoSToLowMaxBatchSize = [#'CosNotification_Property'{name='CosNotification':'MaximumBatchSize'(), - value=any:create(orber_tc:long(), -1)}], - - QoSOKStopTimeSupp = [#'CosNotification_Property'{name='CosNotification':'StopTimeSupported'(), - value=any:create(orber_tc:boolean(), true)}], - QoSWrongStopTimeSupp = [#'CosNotification_Property'{name="StopTimeSupp", - value=any:create(orber_tc:boolean(), true)}], - - QoSOKStartTimeSupp = [#'CosNotification_Property'{name='CosNotification':'StartTimeSupported'(), - value=any:create(orber_tc:boolean(), true)}], - QoSWrongStartTimeSupp = [#'CosNotification_Property'{name="StartTimeSupp", - value=any:create(orber_tc:boolean(), true)}], - QoSOKTimout = [#'CosNotification_Property'{name='CosNotification':'Timeout'(), - value=any:create(orber_tc:unsigned_long_long(), 100)}], - - - %% The most complex QoS to set is ConnectionReliability, and the reason for this - %% is that we cannot set the Channel to offer best effort while its children - %% offer persistent. A child may only offer Persistent if its parent do, which - %% is why we must check the following: - %% - %% # Persistent Change to Best Effort - %% _____ - %% | | (1) -> Check if children BE - %% |Chann| (2) ok <- - %% ----- - %% | - %% _____ - %% | | (3) -> Check if children BE - %% |Admin| (4) Check if parent Pers. <- - %% ----- - %% | - %% _____ - %% | | (5) -> ok - %% |Proxy| (6) Check if parent Pers. <- - %% ----- - %% NOTE: a parent always exists but we may change the QoS before creating any - %% childrens. The cases (2) and (5) is always ok, i.e., no need to confirm - %% with parent or children. - - %% We only have a channel. At the moment we can set ConnectionReliability - %% without asking anyone. - Q1='CosNotification_QoSAdmin':get_qos(Ch), - ?match({ok, _}, 'CosNotification_QoSAdmin':validate_qos(Ch, QoSBestEffort)), - - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSPersistent)), - %% Match if no problems occur if we try to set QoS as is. - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSPersistent)), - - %% Check validate. - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSEventPersistent)), - ?match({ok, _}, 'CosNotification_QoSAdmin':validate_qos(Ch, QoSOKTimout)), - ?match({ok, _}, 'CosNotification_QoSAdmin':validate_qos(Ch, QoSEventBestEffort)), - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSEventBestEffort)), - ?match({ok, _}, 'CosNotification_QoSAdmin':validate_qos(Ch, QoSOKTimout)), - - Q2='CosNotification_QoSAdmin':get_qos(Ch), - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSBestEffort)), - ?match(Q1, 'CosNotification_QoSAdmin':get_qos(Ch)), - - %% Now we add an Admin object. An Admin object cannot switch ConnectionReliability - %% to BestEffort without checking with its children or Persistent without - %% confirming this with its Parent. At the moment, however, we only have a parent. - {CAdm, Id2} = 'CosNotifyChannelAdmin_EventChannel':new_for_consumers(Ch, 'AND_OP'), - ?match(Q1,'CosNotification_QoSAdmin':get_qos(CAdm)), - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosNotification_QoSAdmin':set_qos(CAdm, QoSPersistent)), - ?match(Q1, 'CosNotification_QoSAdmin':get_qos(CAdm)), - ?match(ok, 'CosNotification_QoSAdmin':set_qos(CAdm, QoSBestEffort)), - ?match(Q1, 'CosNotification_QoSAdmin':get_qos(CAdm)), - - %% Check if we can extract the Admin from the channel correctly. - ?match([0,Id2],'CosNotifyChannelAdmin_EventChannel':get_all_consumeradmins(Ch)), - ?match(CAdm,'CosNotifyChannelAdmin_EventChannel':get_consumeradmin(Ch, Id2)), - ?match(Ch, 'CosNotifyChannelAdmin_ConsumerAdmin':'_get_MyChannel'(CAdm)), - ?match(Id2, 'CosNotifyChannelAdmin_ConsumerAdmin':'_get_MyID'(CAdm)), - - %% Change the channel to provide Persistent service. Now we can set the - %% Admin service to Persistent to. (4) - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSPersistent)), - ?match(ok, 'CosNotification_QoSAdmin':set_qos(CAdm, QoSPersistent)), - ?match(Q2, 'CosNotification_QoSAdmin':get_qos(CAdm)), - - %% Since the Admin object now provide Persistent the Channel cannot switch - %% to BestEffort. (1) - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosNotification_QoSAdmin':set_qos(Ch, QoSBestEffort)), - %% Should still match Persistent. - ?match(Q2, 'CosNotification_QoSAdmin':get_qos(Ch)), - {PSup, _Id3} = 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_notification_push_supplier(CAdm, 'ANY_EVENT'), - ?match(Q2, 'CosNotification_QoSAdmin':get_qos(CAdm)), - ?match('PUSH_ANY', 'CosNotifyChannelAdmin_ProxyPushConsumer':'_get_MyType'(PSup)), - ?match(CAdm, 'CosNotifyChannelAdmin_ProxyPushConsumer':'_get_MyAdmin'(PSup)), - ?match(Q2, 'CosNotification_QoSAdmin':get_qos(PSup)), - - %% At this point they all offer persistent connection, which means we have - %% to start with the proxy if we want to change to Best Effort. Hence, - %% the following two cases will fail. - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosNotification_QoSAdmin':set_qos(Ch, QoSBestEffort)), - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosNotification_QoSAdmin':set_qos(CAdm, QoSBestEffort)), - ?match(ok, 'CosNotification_QoSAdmin':set_qos(PSup, QoSBestEffort)), - %% Still not possible to change channel to Best Effort. - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosNotification_QoSAdmin':set_qos(Ch, QoSBestEffort)), - ?match(ok, 'CosNotification_QoSAdmin':set_qos(CAdm, QoSBestEffort)), - %% Now we change the channel to Best Effort. - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSBestEffort)), - - %% Test if really are Best Effort - ?match(Q1, 'CosNotification_QoSAdmin':get_qos(Ch)), - ?match(Q1, 'CosNotification_QoSAdmin':get_qos(CAdm)), - ?match(Q1, 'CosNotification_QoSAdmin':get_qos(PSup)), - - %% Testing MaximumBatchSize (The highest value is defined in - %% CosNotification_Common.erl - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSOKMaxBatchSize)), - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosNotification_QoSAdmin':set_qos(Ch, QoSToHighMaxBatchSize)), - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosNotification_QoSAdmin':set_qos(Ch, QoSToLowMaxBatchSize)), - - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSOKStartTimeSupp)), - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSOKStopTimeSupp)), - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosNotification_QoSAdmin':set_qos(Ch, QoSWrongStartTimeSupp)), - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosNotification_QoSAdmin':set_qos(Ch, QoSWrongStopTimeSupp)), - - catch corba:dispose(CAdm), - catch corba:dispose(PSup), - catch corba:dispose(Ch), - cosNotificationApp:stop_factory(Fac), - ok. - -%%----------------------------------------------------------------- -%% QoSAdm API tests -%%----------------------------------------------------------------- -event_qos_api(_Config) -> - Fac = (catch cosNotificationApp:start_global_factory(?FAC_OPT)), - ?match({_,key,_,_,_,_}, Fac), - - %% Create some objects to test with. We start with default settings. - {Ch, _Id1} = (catch 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(Fac, ?defaultQoS, ?defaultAdm)), - {CAdm, _Id2} = 'CosNotifyChannelAdmin_EventChannel':new_for_consumers(Ch, 'AND_OP'), - {PSup, _Id3} = 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_notification_push_supplier(CAdm, 'ANY_EVENT'), - - %% Try setting an unsupported QoS. - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosNotifyChannelAdmin_ProxyConsumer': - validate_event_qos(PSup, - [#'CosNotification_Property'{name="Unsupported QoS", - value=any:create(orber_tc:short(), 1)}])), - %% Try setting min and max priority. - ?match({ok, _}, 'CosNotifyChannelAdmin_ProxyConsumer': - validate_event_qos(PSup, - [#'CosNotification_Property'{name=?not_Priority, - value=any:create(orber_tc:short(), - ?not_LowestPriority)}, - #'CosNotification_Property'{name=?not_Priority, - value=any:create(orber_tc:short(), - ?not_HighestPriority)}])), - %% Try setting priority values which are 1 to high and 1 to low respectively. - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, - 'CosNotifyChannelAdmin_ProxyConsumer': - validate_event_qos(PSup, - [#'CosNotification_Property'{name=?not_Priority, - value=any:create(orber_tc:short(), - ?not_LowestPriority-1)}, - #'CosNotification_Property'{name=?not_Priority, - value=any:create(orber_tc:short(), - ?not_HighestPriority+1)}])), - %% Try setting start- and stop-time (false default). Note the value associated - %% with this property is not really a short but that is not what we are testing - %% here so... - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosNotifyChannelAdmin_ProxyConsumer': - validate_event_qos(PSup, - [#'CosNotification_Property'{name=?not_StartTime, - value=any:create(orber_tc:short(), 0)}])), - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosNotifyChannelAdmin_ProxyConsumer': - validate_event_qos(PSup, - [#'CosNotification_Property'{name=?not_StopTime, - value=any:create(orber_tc:short(), 0)}])), - %% Allow StopTime - ?match(ok, 'CosNotification_QoSAdmin':set_qos(PSup, [#'CosNotification_Property'{name='CosNotification':'StopTimeSupported'(), - value=any:create(orber_tc:boolean(), true)}])), - ?match({ok,_}, - 'CosNotifyChannelAdmin_ProxyConsumer': - validate_event_qos(PSup, - [#'CosNotification_Property'{name=?not_StopTime, - value=any:create(orber_tc:short(), 0)}])), - %% Allow StartTime - ?match(ok, 'CosNotification_QoSAdmin':set_qos(PSup, [#'CosNotification_Property'{name='CosNotification':'StartTimeSupported'(), - value=any:create(orber_tc:boolean(), true)}])), - ?match({ok,_}, - 'CosNotifyChannelAdmin_ProxyConsumer': - validate_event_qos(PSup, - [#'CosNotification_Property'{name=?not_StopTime, - value=any:create(orber_tc:short(), 0)}, - #'CosNotification_Property'{name=?not_StartTime, - value=any:create(orber_tc:short(), 0)}])), - - %% We must reset StopTime since we cannot guarantee that an event will be delivered - %% if risk beeing discarded due to a delay. - ?match(ok, 'CosNotification_QoSAdmin':set_qos(PSup, [#'CosNotification_Property'{name='CosNotification':'StopTimeSupported'(), - value=any:create(orber_tc:boolean(), false)}])), - %% Does it accept Best Effort EventReliability? Must always be true. - ?match({ok,_}, - 'CosNotifyChannelAdmin_ProxyConsumer': - validate_event_qos(PSup, - [#'CosNotification_Property'{name=?not_EventReliability, - value=any:create(orber_tc:short(), ?not_BestEffort)}])), - %% Default is Best Effort; test if we can set Persistent EventReliability. - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosNotifyChannelAdmin_ProxyConsumer': - validate_event_qos(PSup, - [#'CosNotification_Property'{name=?not_EventReliability, - value=any:create(orber_tc:short(), ?not_Persistent)}])), - - %% Set Persistent - QoSPersistent = [#'CosNotification_Property'{name='CosNotification':'ConnectionReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'Persistent'())}], - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSPersistent)), - ?match(ok, 'CosNotification_QoSAdmin':set_qos(CAdm, QoSPersistent)), - ?match(ok, 'CosNotification_QoSAdmin':set_qos(PSup, QoSPersistent)), - - %% Does it accept Best Effort EventReliability? Must always be true. - ?match({ok, _}, - 'CosNotifyChannelAdmin_ProxyConsumer': - validate_event_qos(PSup, - [#'CosNotification_Property'{name=?not_EventReliability, - value=any:create(orber_tc:short(), ?not_BestEffort)}])), - %% Test if we can use Persistent EventReliability. - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosNotifyChannelAdmin_ProxyConsumer': - validate_event_qos(PSup, - [#'CosNotification_Property'{name=?not_EventReliability, - value=any:create(orber_tc:short(), ?not_Persistent)}])), - QoSEventPersistent = [#'CosNotification_Property'{name='CosNotification':'EventReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'Persistent'())}], - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSEventPersistent)), - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosNotification_QoSAdmin':set_qos(CAdm, QoSEventPersistent)), - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosNotification_QoSAdmin':set_qos(PSup, QoSEventPersistent)), - - ?match(ok, 'CosNotification_QoSAdmin':set_qos(PSup, [#'CosNotification_Property'{name='CosNotification':'StopTimeSupported'(), - value=any:create(orber_tc:boolean(), true)}])), - ?match({ok,_}, - 'CosNotifyChannelAdmin_ProxyConsumer': - validate_event_qos(PSup, - [#'CosNotification_Property'{name=?not_StopTime, - value=any:create(orber_tc:short(), 0)}, - #'CosNotification_Property'{name=?not_StartTime, - value=any:create(orber_tc:short(), 0)}])), - catch corba:dispose(CAdm), - catch corba:dispose(PSup), - catch corba:dispose(Ch), - cosNotificationApp:stop_factory(Fac), - ok. - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- - -%%-------------------- End of Module ------------------------------ diff --git a/lib/cosNotification/test/notify_test_impl.erl b/lib/cosNotification/test/notify_test_impl.erl deleted file mode 100644 index 6c833f4915..0000000000 --- a/lib/cosNotification/test/notify_test_impl.erl +++ /dev/null @@ -1,300 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : notify_test_impl.erl -%%---------------------------------------------------------------------- - --module(notify_test_impl). - --include_lib("orber/include/corba.hrl"). --include("idl_output/notify_test.hrl"). - -%%--------------- specified functions ------------------------ --export([stop_normal/2, - stop_brutal/2, - print/2, - doAction/3, - delay/5, - %% Exports from CosNotifyComm::StructuredPushConsumer - push_structured_event/3, disconnect_structured_push_consumer/2, - %% Exports from "CosNotifyComm::SequencePushConsumer" - push_structured_events/3, disconnect_sequence_push_consumer/2, - %% Exports from CosEventComm::PushConsumer - push/3, disconnect_push_consumer/2, - %% Exports from CosNotifyComm::NotifyPublish - disconnect_sequence_pull_consumer/2, - %% Exports from CosNotifyComm::StructuredPullConsumer - disconnect_structured_pull_consumer/2, - %% Exports from CosEventComm::PullConsumer - disconnect_pull_consumer/2, - %% Exports from CosNotifyComm::SequencePushSupplier - disconnect_sequence_push_supplier/2, - %% Exports from CosNotifyComm::StructuredPushSupplier - disconnect_structured_push_supplier/2, - %% Exports from CosEventComm::PushSupplier - disconnect_push_supplier/2, - %% Exports from CosNotifyComm::SequencePullSupplier - pull_structured_events/3, - try_pull_structured_events/3, - disconnect_sequence_pull_supplier/2, - %% Exports from CosNotifyComm::StructuredPullSupplier - pull_structured_event/2, - try_pull_structured_event/2, - disconnect_structured_pull_supplier/2, - %% Exports from CosEventComm::PullSupplier - pull/2, - try_pull/2, - disconnect_pull_supplier/2, - %% Exports from CosNotifyComm::SequencePullConsumer - offer_change/4, - %% Exports from CosNotifyComm::NotifySubscribe - subscription_change/4]). - -%%--------------- gen_server specific ------------------------ --export([init/1, terminate/2]). --export([handle_call/3, handle_cast/2, handle_info/2, code_change/3]). -%% Data structures --record(state, {myType, proxy, data, action}). - -%%--------------- LOCAL DATA --------------------------------- - -%%------------------------------------------------------------ -%% function : init, terminate -%%------------------------------------------------------------ -init([MyType, Proxy]) -> - process_flag(trap_exit,true), - {ok, #state{myType=MyType, proxy=Proxy, data=[]}}. - -terminate(Reason, State) -> - io:format("notify_test:terminate(~p ~p)~n",[Reason, State#state.myType]), - ok. - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. -handle_call(_,_, State) -> - {noreply, State}. -handle_cast(_, State) -> - {noreply, State}. -handle_info(_Info, State) -> - {noreply, State}. - -%%--------------- SERVER FUNCTIONS --------------------------- - -print(Self, State) -> - io:format("notify_test:print(~p ~p)~n",[Self, State]), - {reply, ok, State}. - -doAction(_Self, State, {set_data, Data}) -> - io:format("notify_test:doAction(add_data) ~p~n",[Data]), - {reply, ok, State#state{data=Data}}; -doAction(_Self, State, {add_data, Data}) -> - io:format("notify_test:doAction(add_data) ~p~n",[Data]), - {reply, ok, State#state{data=State#state.data++Data}}; -doAction(_Self, State, return_data) -> - io:format("notify_test:doAction(return_data)~n",[]), - {reply, State#state.data, State#state{data=[]}}; -doAction(_Self, State, clear_data) -> - io:format("notify_test:doAction(return_data)~n",[]), - {reply, ok, State#state{data=[]}}; -doAction(_Self, State, pull_any) -> - io:format("notify_test:doAction(pull_any)~n",[]), - Event='CosNotifyChannelAdmin_ProxyPullSupplier':pull(State#state.proxy), - {reply, Event, State}; -doAction(_Self, State, {pull_seq, Max}) -> - io:format("notify_test:doAction(pull_sequence)~n",[]), - Event='CosNotifyChannelAdmin_SequenceProxyPullSupplier':pull_structured_events(State#state.proxy, Max), - {reply, Event, State}; -doAction(_Self, State, pull_str) -> - Event='CosNotifyChannelAdmin_StructuredProxyPullSupplier':pull_structured_event(State#state.proxy), - io:format("notify_test:doAction(pull_structured)~n",[]), - {reply, Event, State}; -doAction(_Self, State, try_pull_any) -> - io:format("notify_test:doAction(try_pull_any)~n",[]), - Event='CosNotifyChannelAdmin_ProxyPullSupplier':try_pull(State#state.proxy), - {reply, Event, State}; -doAction(_Self, State, {try_pull_seq, Max}) -> - io:format("notify_test:doAction(try_pull_sequence)~n",[]), - Event='CosNotifyChannelAdmin_SequenceProxyPullSupplier':try_pull_structured_events(State#state.proxy, Max), - {reply, Event, State}; -doAction(_Self, State, try_pull_str) -> - Event='CosNotifyChannelAdmin_StructuredProxyPullSupplier':try_pull_structured_event(State#state.proxy), - io:format("notify_test:doAction(try_pull_structured)~n",[]), - {reply, Event, State}; -doAction(_Self, State, {action, Action}) -> - io:format("notify_test:doAction(~p)~n",[Action]), - {reply, ok, State#state{action = Action}}; - -doAction(_, State, _) -> - {reply, nop, State}. - -stop_normal(_Self, State) -> - {stop, normal, ok, State}. - -stop_brutal(_Self, _State) -> - exit("killed_brutal"). - - - -%%--------------- CosNotifyComm::NotifyPublish -------- -offer_change(_Self, State, Added, Removed) -> - ND=loop(Removed, State#state.data), - ND2=Added++ND, - {reply, ok, State#state{data=ND2}}. - -loop([],Data) -> - Data; -loop([H|T], Data) -> - ND=lists:delete(H,Data), - loop(T, ND). - -%%--------------- CosNotifyComm::NotifySubscribe -------- -subscription_change(_Self, State, Added, Removed) -> - ND=loop(Removed, State#state.data), - ND2=Added++ND, - {reply, ok, State#state{data=ND2}}. - -%%--------------- CosNotifyComm::SequencePushConsumer -------- -push_structured_events(_Self, #state{action = undefined} = State, Event) -> - io:format("notify_test:push_structured_events(~p)~n",[Event]), - {reply, ok, State#state{data=State#state.data++Event}}; -push_structured_events(_Self, #state{action = Action} = State, Event) -> - io:format("notify_test:push_structured_events(~p)~nAction: ~p~n", - [Event, Action]), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}), - {reply, ok, State#state{data=State#state.data++Event}}. -disconnect_sequence_push_consumer(_Self, State) -> - io:format("disconnect_sequence_push_consumer~n",[]), - {stop, normal, ok, State}. - -%%--------------- CosNotifyComm::StructuredPushConsumer -------- -push_structured_event(_Self, State, Event) -> - io:format("notify_test:push_structured_event(~p)~n",[Event]), - {reply, ok, State#state{data=State#state.data++[Event]}}. -disconnect_structured_push_consumer(_Self, State) -> - io:format("disconnect_structured_push_consumer~n",[]), - {stop, normal, ok, State}. - -%%--------------- CosEventComm::PushConsumer -------- -push(_Self, State, Event) -> - io:format("notify_test:push(~p)~n",[Event]), - {reply, ok, State#state{data=State#state.data++[Event]}}. -disconnect_push_consumer(_Self, State) -> - io:format("disconnect_push_consumer~n",[]), - {stop, normal, ok, State}. - -%%--------------- CosNotifyComm::SequencePullConsumer -------- -disconnect_sequence_pull_consumer(_Self, State) -> - io:format("disconnect_sequence_pull_consumer~n",[]), - {stop, normal, ok, State}. - -%%--------------- CosNotifyComm::StructuredPullConsumer -------- -disconnect_structured_pull_consumer(_Self, State) -> - io:format("disconnect_structured_pull_consumer~n",[]), - {stop, normal, ok, State}. - -%%--------------- CosEventComm::PullConsumer -------- -disconnect_pull_consumer(_Self, State) -> - io:format("disconnect_pull_consumer~n",[]), - {stop, normal, ok, State}. - -%%--------------- CosNotifyComm::SequencePushSupplier -------- -disconnect_sequence_push_supplier(_Self, State) -> - io:format("disconnect_sequence_push_supplier~n",[]), - {stop, normal, ok, State}. - -%%--------------- CosNotifyComm::StructuredPushSupplier -------- -disconnect_structured_push_supplier(_Self, State) -> - io:format("disconnect_structured_push_supplier~n",[]), - {stop, normal, ok, State}. - -%%--------------- CosEventComm::PushSupplier -------- -disconnect_push_supplier(_Self, State) -> - io:format("disconnect_push_supplier~n",[]), - {stop, normal, ok, State}. - -%%--------------- CosNotifyComm::SequencePullSupplier -------- -pull_structured_events(_Self, State, _Max) -> - io:format("notify_test:pullstructured_events()~n",[]), - {reply, ok, State}. -try_pull_structured_events(_Self, State, Max) -> - io:format("notify_test:try_pull_structured_events()~n",[]), - case State#state.data of - [] -> - {reply, {[],false}, State}; - List -> - R = split(List,Max), - {reply, {lists:sublist(List, Max), true}, State#state{data=R}} - end. - -split([],_) -> - []; -split(R,0) -> - R; -split([_H|T],Max) -> - split(T, Max-1). - -disconnect_sequence_pull_supplier(_Self, State) -> - io:format("disconnect_sequence_pull_supplier~n",[]), - {stop, normal, ok, State}. - -%%--------------- CosNotifyComm::StructuredPullSupplier -------- -pull_structured_event(_Self, State) -> - io:format("notify_test:pull_structured_event()~n",[]), - {reply, ok, State}. -try_pull_structured_event(_Self, State) -> - io:format("notify_test:try_pull_structured_event()~n",[]), - case State#state.data of - [] -> - {reply, {[],false}, State}; - [H|T] -> - {reply, {H, true}, State#state{data=T}} - end. -disconnect_structured_pull_supplier(_Self, State) -> - io:format("disconnect_structured_pull_supplier~n",[]), - {stop, normal, ok, State}. - -%%--------------- CosEventComm::PullSupplier -------- -pull(_Self, State) -> - io:format("notify_test:pull()~n",[]), - {reply, 'CosEventComm_PullSupplier':pull(State#state.proxy), State}. -try_pull(_Self, State) -> - io:format("notify_test:try_pull()~n",[]), - case State#state.data of - [] -> - {reply, {[],false}, State}; - [H|T] -> - {reply, {H, true}, State#state{data=T}} - end. -disconnect_pull_supplier(_Self, State) -> - io:format("disconnect_pull_supplier~n",[]), - {stop, normal, ok, State}. - -%%--------------- LOCAL FUNCTIONS ---------------------------- - -delay(Obj, Event, Time, Mod, F) -> - io:format("notify_test:delay(~p) TIME: ~p~n",[Event, erlang:timestamp()]), - timer:sleep(Time), - Mod:F(Obj, Event), - io:format("notify_test:delay() DONE: ~p~n",[erlang:timestamp()]), - ok. - -%%--------------- END OF MODULE ------------------------------ - diff --git a/lib/cosNotification/test/notify_test_server.cfg b/lib/cosNotification/test/notify_test_server.cfg deleted file mode 100644 index 60f50b23bb..0000000000 --- a/lib/cosNotification/test/notify_test_server.cfg +++ /dev/null @@ -1,55 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -{this, "notify_test::SeqPushC"}. -{{handle_info, "notify_test::SeqPushC"}, true}. -{{impl, "notify_test::SeqPushC"}, "notify_test_impl"}. -{this, "notify_test::StrPushC"}. -{{handle_info, "notify_test::StrPushC"}, true}. -{{impl, "notify_test::StrPushC"}, "notify_test_impl"}. -{this, "notify_test::AnyPushC"}. -{{handle_info, "notify_test::AnyPushC"}, true}. -{{impl, "notify_test::AnyPushC"}, "notify_test_impl"}. -{this, "notify_test::SeqPullC"}. -{{handle_info, "notify_test::SeqPullC"}, true}. -{{impl, "notify_test::SeqPullC"}, "notify_test_impl"}. -{this, "notify_test::StrPullC"}. -{{handle_info, "notify_test::StrPullC"}, true}. -{{impl, "notify_test::StrPullC"}, "notify_test_impl"}. -{this, "notify_test::AnyPullC"}. -{{handle_info, "notify_test::AnyPullC"}, true}. -{{impl, "notify_test::AnyPullC"}, "notify_test_impl"}. -{this, "notify_test::SeqPushS"}. -{{handle_info, "notify_test::SeqPushS"}, true}. -{{impl, "notify_test::SeqPushS"}, "notify_test_impl"}. -{this, "notify_test::StrPushS"}. -{{handle_info, "notify_test::StrPushS"}, true}. -{{impl, "notify_test::StrPushS"}, "notify_test_impl"}. -{this, "notify_test::AnyPushS"}. -{{handle_info, "notify_test::AnyPushS"}, true}. -{{impl, "notify_test::AnyPushS"}, "notify_test_impl"}. -{this, "notify_test::SeqPullS"}. -{{handle_info, "notify_test::SeqPullS"}, true}. -{{impl, "notify_test::SeqPullS"}, "notify_test_impl"}. -{this, "notify_test::StrPullS"}. -{{handle_info, "notify_test::StrPullS"}, true}. -{{impl, "notify_test::StrPullS"}, "notify_test_impl"}. -{this, "notify_test::AnyPullS"}. -{{handle_info, "notify_test::AnyPullS"}, true}. -{{impl, "notify_test::AnyPullS"}, "notify_test_impl"}. diff --git a/lib/cosNotification/test/notify_test_server.idl b/lib/cosNotification/test/notify_test_server.idl deleted file mode 100644 index 0334d67717..0000000000 --- a/lib/cosNotification/test/notify_test_server.idl +++ /dev/null @@ -1,114 +0,0 @@ -// -// %CopyrightBegin% -// -// Copyright Ericsson AB 1999-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -// - -#ifndef _NOTIFY_TEST_SERVER_IDL -#define _NOTIFY_TEST_SERVER_IDL - -#include -#include - -module notify_test { - - enum action {PULL_SEQ, PULL_STR, PULL_ANY, PUSH_SEQ, PUSH_STR, PUSH_ANY}; - - struct data { - short score; - string name; - }; - - struct computer { - float memsize; - float cputime; - float filesize; - }; - - struct X { - long A; - string B; - short C; - }; - - - union K switch(short) { - case -1: short neg; - case 0: - case 2: string K; - case 3: X L; - case 5: long M; - default: short N; - }; - - union uni1 switch(long) { - case 1: - case 2: long lo; - case 3: short sh; - default: short defvalue; - }; - - union uni2 switch(long) { - case 1: - case 2: long lo; - case 3: short sh; - }; - - typedef any namedAny; - typedef short ShortArray[4]; - struct studies { - uni1 uni1; - CosNotification::PropertySeq tests; - ShortArray monthly_attendance; - short gpa; - }; - - interface funcs { - void print(); - void doAction(in action Act); - }; - - // interface server - interface SeqPushC : funcs, CosNotifyComm::SequencePushConsumer { - }; - interface StrPushC : funcs, CosNotifyComm::StructuredPushConsumer { - }; - interface AnyPushC : funcs, CosEventComm::PushConsumer { - }; - interface SeqPullC : funcs, CosNotifyComm::SequencePullConsumer { - }; - interface StrPullC : funcs, CosNotifyComm::StructuredPullConsumer { - }; - interface AnyPullC : funcs, CosEventComm::PullConsumer { - }; - - interface SeqPushS : funcs, CosNotifyComm::SequencePushSupplier { - }; - interface StrPushS : funcs, CosNotifyComm::StructuredPushSupplier { - }; - interface AnyPushS : funcs, CosEventComm::PushSupplier { - }; - interface SeqPullS : funcs, CosNotifyComm::SequencePullSupplier { - }; - interface StrPullS : funcs, CosNotifyComm::StructuredPullSupplier { - }; - interface AnyPullS : funcs, CosEventComm::PullSupplier { - }; - -}; - -#endif diff --git a/lib/cosNotification/vsn.mk b/lib/cosNotification/vsn.mk deleted file mode 100644 index 1677057670..0000000000 --- a/lib/cosNotification/vsn.mk +++ /dev/null @@ -1,2 +0,0 @@ -COSNOTIFICATION_VSN = 1.2.3 - -- cgit v1.2.3