diff options
author | mcorino <mcorino@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2011-10-20 09:46:10 +0000 |
---|---|---|
committer | mcorino <mcorino@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2011-10-20 09:46:10 +0000 |
commit | 02686f8d5108580e8a3d56bfe9b124405fdedd18 (patch) | |
tree | 0426ac218b7505e1c06dbf5ff8d2b10144d7ce75 | |
parent | b2334408ebeffc6686b1f976247926df8411caec (diff) | |
download | ATCD-02686f8d5108580e8a3d56bfe9b124405fdedd18.tar.gz |
Tue Oct 20 09:30:13 UTC 2011 Martin Corino <mcorino@remedy.nl>
Merged changes from Remedy work branch.
393 files changed, 22211 insertions, 2906 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog index 3e4daaf240f..64b2fadda5f 100644 --- a/ACE/ChangeLog +++ b/ACE/ChangeLog @@ -1,3 +1,24 @@ +Tue Oct 20 09:30:13 UTC 2011 Martin Corino <mcorino@remedy.nl> + + Merged changes from Remedy work branch. + + === start changelog === + + Tue Oct 18 09:23:13 UTC 2011 Marijke Hengstmengel <mhengstmengel@remedy.nl> + + * bin/MakeProjectCreator/config/global.features: + Add ccm_direct_collocation + + Wed Oct 12 13:08:13 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * bin/MakeProjectCreator/config/crosscompile.mpb: + Fixed install issues. + + * bin/mwc.pl: + Removed unnecessary STDERR. + + === end changelog === + Thu Oct 20 06:57:38 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> * *.*: diff --git a/ACE/bin/MakeProjectCreator/config/crosscompile.mpb b/ACE/bin/MakeProjectCreator/config/crosscompile.mpb index d755f480cac..225b6a19cde 100644 --- a/ACE/bin/MakeProjectCreator/config/crosscompile.mpb +++ b/ACE/bin/MakeProjectCreator/config/crosscompile.mpb @@ -13,7 +13,7 @@ project { } verbatim(gnuace, circuit) { ifneq ($(CROSS-COMPILE),) - all clean realclean idl_stubs depend lib_warning require_warning avoid_warning: + all clean realclean idl_stubs depend lib_warning require_warning avoid_warning install: " @echo This project will not build on CROSS-COMPILE platforms." else } diff --git a/ACE/bin/MakeProjectCreator/config/global.features b/ACE/bin/MakeProjectCreator/config/global.features index b7a1c75278f..e30673e6bc7 100644 --- a/ACE/bin/MakeProjectCreator/config/global.features +++ b/ACE/bin/MakeProjectCreator/config/global.features @@ -153,5 +153,7 @@ link_codecfactory = 0 ccm_lw = 1 // Feature for CCM for disabling events. ccm_noevent = 0 +// Feature for direct collocation +ccm_direct_collocation = 0 valuetype_out_indirection=1 diff --git a/ACE/bin/mwc.pl b/ACE/bin/mwc.pl index 8e8a838eb29..171ca860954 100755 --- a/ACE/bin/mwc.pl +++ b/ACE/bin/mwc.pl @@ -34,7 +34,7 @@ my($mpcpath) = (defined $mpcroot ? $mpcroot : unshift(@INC, $mpcpath . '/modules'); if (defined $mpcroot) { - print STDERR "MPC_ROOT was set to $mpcroot.\n"; + print "MPC_ROOT was set to $mpcroot.\n"; } if (! -d "$mpcpath/modules") { diff --git a/CIAO/ChangeLog b/CIAO/ChangeLog index 85bebba557c..b72ab84c4ac 100644 --- a/CIAO/ChangeLog +++ b/CIAO/ChangeLog @@ -1,3 +1,501 @@ +Tue Oct 20 09:30:13 UTC 2011 Martin Corino <mcorino@remedy.nl> + + Merged changes from Remedy work branch. + + === start changelog === + + Thu Oct 20 08:56:25 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * ciao/Deployment/Handlers/Connection_Handler.cpp: + Optimized logging + + * tests/DAnCE/Components/SimpleMultipleUser_exec.cpp: + Reverted extra test. More investigation needed. + + Wed Oct 19 14:19:49 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * ciao/Deployment/Handlers/Connection_Handler.cpp: + Fixed some typos in comments. + + * tests/DAnCE/Components/SimpleMultipleUser_exec.cpp: + Added extra tests on exit. + + Tue Oct 18 14:06:44 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * ciao/Servants/Connector_Servant_Impl_Base.cpp: + * ciao/Servants/Home_Servant_Impl_T.cpp: + * ciao/Servants/Servant_Impl_Base.cpp: + * ciao/Servants/Session/Servant_Impl_T.cpp: + Using class variables in a thread safe way. + Code alignment. + + Tue Oct 18 10:02:14 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * NEWS: + Info about thread safety. + + * ciao/Containers/Servant_Activator.cpp: + Minor code updates. + + * ciao/Contexts/Context_Impl_Base_T.cpp: + * ciao/Contexts/Session/Session_Context_T.cpp: + Made the container_ variable thread safe. + + Tue Oct 18 08:57:34 UTC 2011 Marijke Hengstmengel <mhengstmengel@remedy.nl> + + * MPC/ccm_direct_collocation.mpb: + * MPC/avoids_ccm_direct_collocation.mpb: + * MPC/ciaoidldefaults.mpb: + * MPC/ccm_svnt.mpb: + * MPC/ccm.mpb: + * MPC/ciao_base.mpb: + * MPC/ciao.mpb: + * MPC/ciao_servant.mpb: + * MPC/ciao_servant_activator_stub.mpb: + Add direct_collocation to projects + + + + + Tue Oct 18 08:31:34 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * ciao/Containers/Container_Base_T.cpp: + Using temporary _var variables in order to be thread safe. + + Mon Oct 17 14:01:44 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * ciao/Deployment/Handlers/CIAO_State.h: + * ciao/Deployment/Handlers/CIAO_State.cpp: + * ciao/Deployment/Handlers/Connection_Handler.h: + * ciao/Deployment/Handlers/Connection_Handler.cpp: + Using mutexes to be threadsafe. + + * ciao/Deployment/Interceptors/Deployment_Interceptors.cpp: + Using this for class variable. + + * ciao/Servants/Extension/Servant_Impl_T.cpp: + Renamed some variables. + + Mon Oct 17 08:31:17 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * connectors/dds4ccm/impl/DDS_Event_Connector_T.cpp: + * connectors/dds4ccm/impl/DDS_State_Connector_T.cpp: + A subscriber must be created when just listeners are created. + + Fri Oct 14 12:18:05 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * bin/ciao_tests.lst: + * connectors/dds4ccm/tests/ResetTopic/TooLong: + * connectors/dds4ccm/tests/ResetTopic/TooLong/Base: + * connectors/dds4ccm/tests/ResetTopic/TooLong/Base/TL_ResetTopic_Base.idl: + * connectors/dds4ccm/tests/ResetTopic/TooLong/Base/TL_ResetTopic_Base.mpc: + * connectors/dds4ccm/tests/ResetTopic/TooLong/Connector: + * connectors/dds4ccm/tests/ResetTopic/TooLong/Connector/TL_ResetTopic_Connector.idl: + * connectors/dds4ccm/tests/ResetTopic/TooLong/Connector/TL_ResetTopic_Connector.mpc: + * connectors/dds4ccm/tests/ResetTopic/TooLong/Sender: + * connectors/dds4ccm/tests/ResetTopic/TooLong/Sender/SenderDriver.cpp: + * connectors/dds4ccm/tests/ResetTopic/TooLong/Sender/TL_ResetTopic_Sender.idl: + * connectors/dds4ccm/tests/ResetTopic/TooLong/Sender/TL_ResetTopic_Sender.mpc: + * connectors/dds4ccm/tests/ResetTopic/TooLong/Sender/TL_ResetTopic_Sender_exec.h: + * connectors/dds4ccm/tests/ResetTopic/TooLong/Sender/TL_ResetTopic_Sender_exec.cpp: + * connectors/dds4ccm/tests/ResetTopic/TooLong/descriptors: + * connectors/dds4ccm/tests/ResetTopic/TooLong/descriptors/Plan.cdp: + * connectors/dds4ccm/tests/ResetTopic/TooLong/descriptors/run_test.pl: + Added a test which test whether the correct exception is thrown when a topic cannot + be created by DDS. + + Thu Oct 13 06:30:15 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * connectors/dds4ccm/impl/logger/Log_Macros.h: + Fixed compile errors when all logging is disabled. Seems that no space + is allowed between the declaration and the first bracket ( "XXX (Y)" should + be "XXX(Y)" ). + + Wed Oct 12 13:10:27 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * ciao/Base/CIAO_Base.mpc: + * ciao/Deployment/Interceptors/CIAO_Deployment_Interceptors.mpc: + * connectors/dds4ccm/idl/dds4ccm_lem_stub.mpc: + * connectors/dds4ccm/idl/dds4ccm_skel.mpc: + * connectors/dds4ccm/idl/dds4ccm_stub.mpc: + * connectors/dds4ccm/idl/ndds/ndds_idltocpp_lem_stub.mpc: + * connectors/dds4ccm/idl/ndds/ndds_idltocpp_skel.mpc: + * connectors/dds4ccm/idl/ndds/ndds_idltocpp_stub.mpc: + * connectors/dds4ccm/impl/dds4ccm_impl.mpc: + * connectors/dds4ccm/impl/logger/dds4ccm_logger.mpc: + * connectors/dds4ccm/impl/ndds/ndds_idltocpp.mpc: + Fixed several install issues. + + Wed Oct 12 12:37:47 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * bin/ciao_tests.lst: + * connectors/dds4ccm/tests/CollocatedPubSub: + * connectors/dds4ccm/tests/CollocatedPubSub/Base: + * connectors/dds4ccm/tests/CollocatedPubSub/Base/Collocated_Base.idl: + * connectors/dds4ccm/tests/CollocatedPubSub/Base/Collocated_Base.mpc: + * connectors/dds4ccm/tests/CollocatedPubSub/Connector: + * connectors/dds4ccm/tests/CollocatedPubSub/Connector/Collocated_Connector.idl: + * connectors/dds4ccm/tests/CollocatedPubSub/Connector/Collocated_Connector.mpc: + * connectors/dds4ccm/tests/CollocatedPubSub/PubSubComponent: + * connectors/dds4ccm/tests/CollocatedPubSub/PubSubComponent/PubSub_Component.idl: + * connectors/dds4ccm/tests/CollocatedPubSub/PubSubComponent/PubSub_Component.mpc: + * connectors/dds4ccm/tests/CollocatedPubSub/PubSubComponent/PubSub_Component_exec.h: + * connectors/dds4ccm/tests/CollocatedPubSub/PubSubComponent/PubSub_Component_exec.cpp: + * connectors/dds4ccm/tests/CollocatedPubSub/SubComponent: + * connectors/dds4ccm/tests/CollocatedPubSub/SubComponent/Sub_Component.idl: + * connectors/dds4ccm/tests/CollocatedPubSub/SubComponent/Sub_Component.mpc: + * connectors/dds4ccm/tests/CollocatedPubSub/SubComponent/Sub_Component_exec.h: + * connectors/dds4ccm/tests/CollocatedPubSub/SubComponent/Sub_Component_exec.cpp: + * connectors/dds4ccm/tests/CollocatedPubSub/descriptors: + * connectors/dds4ccm/tests/CollocatedPubSub/descriptors/Plan.cdp: + * connectors/dds4ccm/tests/CollocatedPubSub/descriptors/run_test.pl: + New test. Three components running on the same node. One writes the samples + to DDS and collects these sample at the same time. The other two components just + listen. All listeners have a QueryFilter applied. + + Wed Oct 12 12:25:34 UTC 2011 Marijke Hengstmengel <mhengstmengel@remedy.nl> + + * tests/Collocation: + * tests/Collocation/Sender: + * tests/Collocation/Sender/Sender.idl: + * tests/Collocation/Sender/Sender_exec.cpp: + * tests/Collocation/Sender/Sender.mpc: + * tests/Collocation/Sender/Sender_exec.h: + * tests/Collocation/.project: + * tests/Collocation/Coll_Base: + * tests/Collocation/Coll_Base/Base.mpc: + * tests/Collocation/Coll_Base/Base.idl: + * tests/Collocation/descriptors: + * tests/Collocation/descriptors/run_test.pl: + * tests/Collocation/descriptors/PlanAllOnOne.cdp: + * tests/Collocation/Receiver: + * tests/Collocation/Receiver/Receiver.mpc: + * tests/Collocation/Receiver/Receiver_exec.h: + * tests/Collocation/Receiver/Receiver_exec.cpp: + * tests/Collocation/Receiver/Receiver.idl: + Test for collocation, for playing with results change OrbStrategy in cdp plan + + Wed Oct 12 09:07:34 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.cpp: + We also need to create a subscriber and publisher when the user + is using a ConnectorStatusListener; the Subscriber Listener and + Publisher Listener are involved in the ConnectorStatusListener. + + Wed Oct 12 08:58:10 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_exec.cpp: + * connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_impl.cpp: + Extended this test a bit more. + + Tue Oct 11 14:27:23 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * connectors/dds4ccm/idl/ndds/ndds_dcps.idl: + Layout changes. + + * connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.cpp: + Fixed warnings. + + Tue Oct 11 09:34:02 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * NEWS: + Updated. + + * ciao/Deployment/Handlers/Connection_Handler.h: + * ciao/Deployment/Handlers/Connection_Handler.cpp: + Improved logging: mentioning the connection which has + been pre-established. + + * connectors/dds4ccm/impl/DDS_Event_Connector_T.cpp: + * connectors/dds4ccm/impl/DDS_State_Connector_T.cpp: + * connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.h: + * connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.cpp: + Prevent the creation of a subscriber or publisher when + they are not needed. + + * connectors/dds4ccm/tests/ResetTopic/README: + Updated. + + Mon Oct 10 14:11:45 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * ciao/Deployment/Handlers/Connection_Handler.h: + * ciao/Deployment/Handlers/Connection_Handler.cpp: + Added validate_connection when a user want's the connections to + be connected during deployment (instead of on first usage). This can + be switched on by setting the CIAO_PRE_ESTABLISH_CONNECTIONS define + + Mon Oct 10 08:03:56 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * connectors/dds4ccm/tests/NonChangeableAttribute/Component/NonChangeable_Component_exec.cpp: + No need to check of the NonChangeable exception, since the topic name can be reset. + + Mon Oct 10 07:55:48 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * connectors/dds4ccm/tests/LateBinding/UpdateWrite/Sender/WU_LateBinding_Sender_exec.h: + * connectors/dds4ccm/tests/LateBinding/UpdateWrite/Sender/WU_LateBinding_Sender_exec.cpp: + No need to check of the NonChangeable exception. Since the topic name can be reset. + + Mon Oct 10 07:46:35 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * connectors/dds4ccm/tests/ResetTopic/UpdateListen/Receiver/UL_ResetTopic_Receiver_exec.h: + * connectors/dds4ccm/tests/ResetTopic/UpdateListen/Receiver/UL_ResetTopic_Receiver_exec.cpp: + * connectors/dds4ccm/tests/ResetTopic/WriteListen/Receiver/WL_ResetTopic_Receiver_exec.h: + * connectors/dds4ccm/tests/ResetTopic/WriteListen/Receiver/WL_ResetTopic_Receiver_exec.cpp: + Fixed ref count issue. Because of this, the core crashed on exit. + + Fri Oct 7 15:41:09 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * connectors/dds4ccm/tests/ResetTopic/UpdateListen/Receiver/UL_ResetTopic_Receiver_exec.h: + Minor change of names. + + * connectors/dds4ccm/tests/ResetTopic/WriteListen/Receiver/WL_ResetTopic_Receiver_exec.h: + * connectors/dds4ccm/tests/ResetTopic/WriteListen/Receiver/WL_ResetTopic_Receiver_exec.cpp: + Some extra check on whether samples were received during each run. + + Fri Oct 7 15:30:37 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * connectors/dds4ccm/tests/ResetTopic/UpdateListen/Receiver/UL_ResetTopic_Receiver_exec.h: + * connectors/dds4ccm/tests/ResetTopic/UpdateListen/Receiver/UL_ResetTopic_Receiver_exec.cpp: + Some extra check on whether samples were received during each run. + + Thu Oct 6 11:34:13 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * connectors/dds4ccm/impl/DDS_Event_Connector_T.cpp: + * connectors/dds4ccm/impl/DDS_State_Connector_T.cpp: + * connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.cpp: + + * connectors/dds4ccm/impl/ndds/DomainParticipantManager.cpp: + Optimized logging. + + * connectors/dds4ccm/tests/LateBinding/ReadGet/Receiver/RG_LateBinding_Receiver_exec.cpp: + * connectors/dds4ccm/tests/LateBinding/ReadGet/Sender/RG_LateBinding_Sender_exec.cpp: + Removed unnecessary logging. + + * connectors/dds4ccm/tests/ResetTopic/ToEmpty/Sender/TE_ResetTopic_Sender.mpc: + * connectors/dds4ccm/tests/ResetTopic/UpdateListen/Receiver/UL_ResetTopic_Receiver.mpc: + * connectors/dds4ccm/tests/ResetTopic/UpdateListen/Sender/UL_ResetTopic_Sender.mpc: + * connectors/dds4ccm/tests/ResetTopic/WriteListen/Receiver/WL_ResetTopic_Receiver.mpc: + * connectors/dds4ccm/tests/ResetTopic/WriteListen/Sender/WL_ResetTopic_Sender.mpc: + Fixed warnings on FC15. + + Wed Oct 5 15:12:49 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * connectors/dds4ccm/tests/ResetTopic/ToEmpty/Sender/TE_ResetTopic_Sender_exec.h: + * connectors/dds4ccm/tests/ResetTopic/ToEmpty/Sender/TE_ResetTopic_Sender_exec.cpp: + * connectors/dds4ccm/tests/ResetTopic/ToEmpty/descriptors/Plan.cdp: + Enabled test for state connector. + + Wed Oct 5 14:16:49 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * connectors/dds4ccm/impl/DDS_Event_Connector_T.cpp: + * connectors/dds4ccm/impl/DDS_State_Connector_T.cpp: + Start DDS when the topic name is not empty. + + * bin/ciao_tests.lst: + * connectors/dds4ccm/tests/ResetTopic/ToEmpty: + * connectors/dds4ccm/tests/ResetTopic/ToEmpty/Base: + * connectors/dds4ccm/tests/ResetTopic/ToEmpty/Base/TE_ResetTopic_Base.idl: + * connectors/dds4ccm/tests/ResetTopic/ToEmpty/Base/TE_ResetTopic_Base.mpc: + * connectors/dds4ccm/tests/ResetTopic/ToEmpty/Connector: + * connectors/dds4ccm/tests/ResetTopic/ToEmpty/Connector/TE_ResetTopic_Connector.idl: + * connectors/dds4ccm/tests/ResetTopic/ToEmpty/Connector/TE_ResetTopic_Connector.mpc: + * connectors/dds4ccm/tests/ResetTopic/ToEmpty/Sender: + * connectors/dds4ccm/tests/ResetTopic/ToEmpty/Sender/SenderDriver.cpp: + * connectors/dds4ccm/tests/ResetTopic/ToEmpty/Sender/TE_ResetTopic_Sender.idl: + * connectors/dds4ccm/tests/ResetTopic/ToEmpty/Sender/TE_ResetTopic_Sender.mpc: + * connectors/dds4ccm/tests/ResetTopic/ToEmpty/Sender/TE_ResetTopic_Sender_exec.h: + * connectors/dds4ccm/tests/ResetTopic/ToEmpty/Sender/TE_ResetTopic_Sender_exec.cpp: + * connectors/dds4ccm/tests/ResetTopic/ToEmpty/descriptors: + * connectors/dds4ccm/tests/ResetTopic/ToEmpty/descriptors/Plan.cdp: + * connectors/dds4ccm/tests/ResetTopic/ToEmpty/descriptors/run_test.pl: + * connectors/dds4ccm/tests/ResetTopic/UpdateListen/Receiver/ReceiverDriver.cpp: + * connectors/dds4ccm/tests/ResetTopic/UpdateListen/Sender/SenderDriver.cpp: + * connectors/dds4ccm/tests/ResetTopic/WriteListen/Receiver/ReceiverDriver.cpp: + * connectors/dds4ccm/tests/ResetTopic/WriteListen/Sender/SenderDriver.cpp: + Clearing topic name on a running DDS connector. After clearing, start writing. + The connector should throw a bad_inv_order exception. Setting the topic name again. + The sender should be able to write again. Need to expanded with an updater + (state connector). + + Wed Oct 5 12:39:54 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * connectors/dds4ccm/impl/DDS_Event_Connector_T.cpp: + * connectors/dds4ccm/impl/DDS_State_Connector_T.cpp: + Components are always set when a port is obtained. This does not + depend on whether the topic name has been set. + + Wed Oct 5 12:29:41 UTC 2011 Marcel Smit <msmit@remedy.nl> + + + * connectors/dds4ccm/impl/DDS_Event_Connector_T.h: + * connectors/dds4ccm/impl/DDS_Event_Connector_T.cpp: + * connectors/dds4ccm/impl/DDS_State_Connector_T.h: + * connectors/dds4ccm/impl/DDS_State_Connector_T.cpp: + Reset the components in the ccm_remove method itself since this is + the only place where these components need to be reset. + + * connectors/dds4ccm/tests/KeyedSamples/Sender/Keyed_Test_Sender_exec.h: + * connectors/dds4ccm/tests/KeyedSamples/Sender/Keyed_Test_Sender_exec.cpp: + Applied coding conventions. + + * bin/ciao_tests.lst: + * connectors/dds4ccm/tests/ResetTopic/UpdateListen: + * connectors/dds4ccm/tests/ResetTopic/UpdateListen/Base: + * connectors/dds4ccm/tests/ResetTopic/UpdateListen/Base/UL_ResetTopic_Base.idl: + * connectors/dds4ccm/tests/ResetTopic/UpdateListen/Base/UL_ResetTopic_Base.mpc: + * connectors/dds4ccm/tests/ResetTopic/UpdateListen/Connector: + * connectors/dds4ccm/tests/ResetTopic/UpdateListen/Connector/UL_ResetTopic_Connector.idl: + * connectors/dds4ccm/tests/ResetTopic/UpdateListen/Connector/UL_ResetTopic_Connector.mpc: + * connectors/dds4ccm/tests/ResetTopic/UpdateListen/Receiver: + * connectors/dds4ccm/tests/ResetTopic/UpdateListen/Receiver/ReceiverDriver.cpp: + * connectors/dds4ccm/tests/ResetTopic/UpdateListen/Receiver/UL_ResetTopic_Receiver.idl: + * connectors/dds4ccm/tests/ResetTopic/UpdateListen/Receiver/UL_ResetTopic_Receiver.mpc: + * connectors/dds4ccm/tests/ResetTopic/UpdateListen/Receiver/UL_ResetTopic_Receiver_exec.h: + * connectors/dds4ccm/tests/ResetTopic/UpdateListen/Receiver/UL_ResetTopic_Receiver_exec.cpp: + * connectors/dds4ccm/tests/ResetTopic/UpdateListen/Sender: + * connectors/dds4ccm/tests/ResetTopic/UpdateListen/Sender/SenderDriver.cpp: + * connectors/dds4ccm/tests/ResetTopic/UpdateListen/Sender/UL_ResetTopic_Sender.idl: + * connectors/dds4ccm/tests/ResetTopic/UpdateListen/Sender/UL_ResetTopic_Sender.mpc: + * connectors/dds4ccm/tests/ResetTopic/UpdateListen/Sender/UL_ResetTopic_Sender_exec.h: + * connectors/dds4ccm/tests/ResetTopic/UpdateListen/Sender/UL_ResetTopic_Sender_exec.cpp: + * connectors/dds4ccm/tests/ResetTopic/UpdateListen/descriptors: + * connectors/dds4ccm/tests/ResetTopic/UpdateListen/descriptors/Plan.cdp: + * connectors/dds4ccm/tests/ResetTopic/UpdateListen/descriptors/run_test.pl: + A new test which tests the reset of topic names in the state connector. + + * connectors/dds4ccm/tests/ResetTopic/WriteListen/Receiver/WL_ResetTopic_Receiver_exec.cpp: + Removed unnecessary logging + + Wed Oct 5 07:58:13 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * bin/ciao_tests.lst: + * connectors/dds4ccm/tests/ResetTopic/WriteListen: + * connectors/dds4ccm/tests/ResetTopic/WriteListen/Base: + * connectors/dds4ccm/tests/ResetTopic/WriteListen/Base/WL_ResetTopic_Base.idl: + * connectors/dds4ccm/tests/ResetTopic/WriteListen/Base/WL_ResetTopic_Base.mpc: + * connectors/dds4ccm/tests/ResetTopic/WriteListen/Connector: + * connectors/dds4ccm/tests/ResetTopic/WriteListen/Connector/WL_ResetTopic_Connector.idl: + * connectors/dds4ccm/tests/ResetTopic/WriteListen/Connector/WL_ResetTopic_Connector.mpc: + * connectors/dds4ccm/tests/ResetTopic/WriteListen/Receiver: + * connectors/dds4ccm/tests/ResetTopic/WriteListen/Receiver/ReceiverDriver.cpp: + * connectors/dds4ccm/tests/ResetTopic/WriteListen/Receiver/WL_ResetTopic_Receiver.idl: + * connectors/dds4ccm/tests/ResetTopic/WriteListen/Receiver/WL_ResetTopic_Receiver.mpc: + * connectors/dds4ccm/tests/ResetTopic/WriteListen/Receiver/WL_ResetTopic_Receiver_exec.h: + * connectors/dds4ccm/tests/ResetTopic/WriteListen/Receiver/WL_ResetTopic_Receiver_exec.cpp: + * connectors/dds4ccm/tests/ResetTopic/WriteListen/Sender: + * connectors/dds4ccm/tests/ResetTopic/WriteListen/Sender/SenderDriver.cpp: + * connectors/dds4ccm/tests/ResetTopic/WriteListen/Sender/WL_ResetTopic_Sender.idl: + * connectors/dds4ccm/tests/ResetTopic/WriteListen/Sender/WL_ResetTopic_Sender.mpc: + * connectors/dds4ccm/tests/ResetTopic/WriteListen/Sender/WL_ResetTopic_Sender_exec.h: + * connectors/dds4ccm/tests/ResetTopic/WriteListen/Sender/WL_ResetTopic_Sender_exec.cpp: + * connectors/dds4ccm/tests/ResetTopic/WriteListen/descriptors: + * connectors/dds4ccm/tests/ResetTopic/WriteListen/descriptors/Plan.cdp: + * connectors/dds4ccm/tests/ResetTopic/WriteListen/descriptors/run_test.pl: + Reset of topic name during write and listen operations. + + Mon Oct 3 14:18:35 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * connectors/dds4ccm/impl/DDS_Event_Connector_T.cpp: + * connectors/dds4ccm/impl/DDS_Get_T.h: + * connectors/dds4ccm/impl/DDS_Get_T.cpp: + * connectors/dds4ccm/impl/DDS_Listen_T.h: + * connectors/dds4ccm/impl/DDS_Listen_T.cpp: + * connectors/dds4ccm/impl/DDS_StateListen_T.h: + * connectors/dds4ccm/impl/DDS_StateListen_T.cpp: + * connectors/dds4ccm/impl/DDS_State_Connector_T.cpp: + * connectors/dds4ccm/impl/DDS_Subscriber_Base_T.h: + * connectors/dds4ccm/impl/DDS_Subscriber_Base_T.cpp: + * connectors/dds4ccm/impl/DDS_Update_T.h: + * connectors/dds4ccm/impl/DDS_Update_T.cpp: + * connectors/dds4ccm/impl/DDS_Write_T.h: + * connectors/dds4ccm/impl/DDS_Write_T.cpp: + Setting the component to nil in the State connector and Event connector, + instead of setting it in the extended ports. + + Fri Sep 30 16:27:55 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * connectors/dds4ccm/tests/ResetTopic/ReadGet/Base/Reader_Starter.mpc: + * connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver.mpc: + * connectors/dds4ccm/tests/ResetTopic/ReadGet/Sender/RG_ResetTopic_Sender.mpc: + Fixed duplicate project names. + + Fri Sep 30 08:28:31 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * bin/ciao_tests.lst: + Added new test to the test framework + + Fri Sep 30 08:08:14 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * connectors/dds4ccm/idl/dds4ccm_lem_stub.mpc: + * connectors/dds4ccm/idl/dds4ccm_skel.mpc: + Layout changes + + * connectors/dds4ccm/impl/CCM_DataReader.cpp: + * connectors/dds4ccm/impl/DDS_Event_Connector_T.h: + * connectors/dds4ccm/impl/DDS_Event_Connector_T.cpp: + * connectors/dds4ccm/impl/DDS_Get_T.h: + * connectors/dds4ccm/impl/DDS_Get_T.cpp: + * connectors/dds4ccm/impl/DDS_Listen_T.h: + * connectors/dds4ccm/impl/DDS_Listen_T.cpp: + * connectors/dds4ccm/impl/DDS_StateListen_T.h: + * connectors/dds4ccm/impl/DDS_StateListen_T.cpp: + * connectors/dds4ccm/impl/DDS_State_Connector_T.h: + * connectors/dds4ccm/impl/DDS_State_Connector_T.cpp: + * connectors/dds4ccm/impl/DDS_Subscriber_Base_T.h: + * connectors/dds4ccm/impl/DDS_Subscriber_Base_T.cpp: + * connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.h: + * connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.cpp: + * connectors/dds4ccm/impl/DDS_Update_T.h: + * connectors/dds4ccm/impl/DDS_Update_T.cpp: + * connectors/dds4ccm/impl/DDS_Write_T.h: + * connectors/dds4ccm/impl/DDS_Write_T.cpp: + * connectors/dds4ccm/impl/Getter_T.cpp: + * connectors/dds4ccm/impl/Reader_T.cpp: + Ability to change the topic name. When a topic name changes, + DDS will be restarted. After restart, the connector manages the + new topic. + + * connectors/dds4ccm/impl/ndds/DomainParticipantManager.cpp: + Improved logging + + * connectors/dds4ccm/tests/LateBinding/ReadGet/Receiver/RG_LateBinding_Receiver_exec.cpp: + * connectors/dds4ccm/tests/LateBinding/ReadGet/Receiver/RG_LateBinding_Receiver_impl.h: + * connectors/dds4ccm/tests/LateBinding/ReadGet/Receiver/RG_LateBinding_Receiver_impl.cpp: + * connectors/dds4ccm/tests/LateBinding/ReadGet/Sender/RG_LateBinding_Sender_exec.cpp: + Removed test for NonChangeable exception. + + + * connectors/dds4ccm/tests/ResetTopic: + * connectors/dds4ccm/tests/ResetTopic/README: + * connectors/dds4ccm/tests/ResetTopic/ReadGet: + * connectors/dds4ccm/tests/ResetTopic/ReadGet/Base: + * connectors/dds4ccm/tests/ResetTopic/ReadGet/Base/RG_ResetTopic_Base.idl: + * connectors/dds4ccm/tests/ResetTopic/ReadGet/Base/RG_ResetTopic_Base.mpc: + * connectors/dds4ccm/tests/ResetTopic/ReadGet/Base/Reader_Starter.idl: + * connectors/dds4ccm/tests/ResetTopic/ReadGet/Base/Reader_Starter.mpc: + * connectors/dds4ccm/tests/ResetTopic/ReadGet/Connector: + * connectors/dds4ccm/tests/ResetTopic/ReadGet/Connector/RG_ResetTopic_Connector.idl: + * connectors/dds4ccm/tests/ResetTopic/ReadGet/Connector/RG_ResetTopic_Connector.mpc: + * connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver: + * connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver.idl: + * connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver.mpc: + * connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_exec.h: + * connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_exec.cpp: + * connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_impl.h: + * connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_impl.cpp: + * connectors/dds4ccm/tests/ResetTopic/ReadGet/Sender: + * connectors/dds4ccm/tests/ResetTopic/ReadGet/Sender/RG_ResetTopic_Sender.idl: + * connectors/dds4ccm/tests/ResetTopic/ReadGet/Sender/RG_ResetTopic_Sender.mpc: + * connectors/dds4ccm/tests/ResetTopic/ReadGet/Sender/RG_ResetTopic_Sender_exec.h: + * connectors/dds4ccm/tests/ResetTopic/ReadGet/Sender/RG_ResetTopic_Sender_exec.cpp: + * connectors/dds4ccm/tests/ResetTopic/ReadGet/descriptors: + * connectors/dds4ccm/tests/ResetTopic/ReadGet/descriptors/Plan.cdp: + * connectors/dds4ccm/tests/ResetTopic/ReadGet/descriptors/USER_QOS_PROFILES.xml: + * connectors/dds4ccm/tests/ResetTopic/ReadGet/descriptors/run_test.pl: + Added test which test the reset DDS within the connector. See readme for more information. + + === end changelog === + Thu Oct 13 19:09:42 UTC 2011 William R. Otte <wotte@dre.vanderbilt.edu> * ciao/Deployment/Handlers/Container_Handler.cpp: diff --git a/CIAO/MPC/config/avoids_ccm_direct_collocation.mpb b/CIAO/MPC/config/avoids_ccm_direct_collocation.mpb new file mode 100644 index 00000000000..96597091e05 --- /dev/null +++ b/CIAO/MPC/config/avoids_ccm_direct_collocation.mpb @@ -0,0 +1,6 @@ +// -*- MPC -*- +// $Id$ + +feature(ccm_direct_collocation) { + avoids += ccm_direct_collocation +} diff --git a/CIAO/MPC/config/ccm.mpb b/CIAO/MPC/config/ccm.mpb index a6c49e6b649..0c0a62e8a67 100644 --- a/CIAO/MPC/config/ccm.mpb +++ b/CIAO/MPC/config/ccm.mpb @@ -1,6 +1,6 @@ // -*- MPC -*- // $Id$ -project { +project : ccm_direct_collocation{ includes += $(CIAO_ROOT)/ccm } diff --git a/CIAO/MPC/config/ccm_direct_collocation.mpb b/CIAO/MPC/config/ccm_direct_collocation.mpb new file mode 100644 index 00000000000..20d299a11d1 --- /dev/null +++ b/CIAO/MPC/config/ccm_direct_collocation.mpb @@ -0,0 +1,7 @@ +// -*- MPC -*- +// $Id$ + +feature (ccm_direct_collocation) : taobaseidldefaults { + macros += CCM_DIRECTCOLL + idlflags += -DCCM_DIRECTCOLL -Gd +} diff --git a/CIAO/MPC/config/ccm_svnt.mpb b/CIAO/MPC/config/ccm_svnt.mpb index fedd8d8f748..83cd4060645 100644 --- a/CIAO/MPC/config/ccm_svnt.mpb +++ b/CIAO/MPC/config/ccm_svnt.mpb @@ -2,7 +2,7 @@ // $Id$ project : ccm_session_stub, portableserver, avoids_minimum_corba, \ - avoids_corba_e_compact, avoids_corba_e_micro { + avoids_corba_e_compact, avoids_corba_e_micro, ccm_direct_collocation { after += CCM_svnt libs += CCM_svnt } diff --git a/CIAO/MPC/config/ciao.mpb b/CIAO/MPC/config/ciao.mpb index e4cd35ca8a7..1a48adcfc9c 100644 --- a/CIAO/MPC/config/ciao.mpb +++ b/CIAO/MPC/config/ciao.mpb @@ -1,7 +1,7 @@ // -*- MPC -*- // $Id$ -project { +project: ccm_direct_collocation { includes += $(CIAO_ROOT) libpaths += $(ACE_ROOT)/lib } diff --git a/CIAO/MPC/config/ciao_base.mpb b/CIAO/MPC/config/ciao_base.mpb index c10abbf8a58..2ebb0aa4d27 100644 --- a/CIAO/MPC/config/ciao_base.mpb +++ b/CIAO/MPC/config/ciao_base.mpb @@ -1,6 +1,6 @@ // $Id$ -project : ccm_cookie, ccm_configvalue { +project : ccm_cookie, ccm_configvalue, ccm_direct_collocation { after += CIAO_Base_stub libs += CIAO_Base_stub } diff --git a/CIAO/MPC/config/ciao_servant.mpb b/CIAO/MPC/config/ciao_servant.mpb index 75641901a43..fd4c7cee9c2 100644 --- a/CIAO/MPC/config/ciao_servant.mpb +++ b/CIAO/MPC/config/ciao_servant.mpb @@ -3,7 +3,7 @@ project : ciao_logger, ciao_port_activator_stub, ciao_servant_activator_stub, \ ccm_svnt, taoidldefaults, portableserver, ccm_cookie, ccm_session_stub, \ - ciao_session_container_stub { + ciao_session_container_stub, ccm_direct_collocation { after += CIAO_Servant_Impl libs += CIAO_Servant_Impl } diff --git a/CIAO/MPC/config/ciao_servant_activator_stub.mpb b/CIAO/MPC/config/ciao_servant_activator_stub.mpb index 260db014f9d..1a21a98b816 100644 --- a/CIAO/MPC/config/ciao_servant_activator_stub.mpb +++ b/CIAO/MPC/config/ciao_servant_activator_stub.mpb @@ -1,7 +1,7 @@ // -*- MPC -*- // $Id$ -project : portableserver, avoids_minimum_corba { +project : portableserver, avoids_minimum_corba, ccm_direct_collocation { after += CIAO_Servant_Activator_stub libs += CIAO_Servant_Activator_stub } diff --git a/CIAO/MPC/config/ciaoidldefaults.mpb b/CIAO/MPC/config/ciaoidldefaults.mpb index 8e7a0cd9791..453c4219d04 100644 --- a/CIAO/MPC/config/ciaoidldefaults.mpb +++ b/CIAO/MPC/config/ciaoidldefaults.mpb @@ -1,7 +1,7 @@ // -*- MPC -*- // $Id$ -project : ccm_lw, ccm_noevent, taobaseidldefaults { +project : ccm_lw, ccm_noevent, ccm_direct_collocation, taobaseidldefaults { idlflags += -I$(CIAO_ROOT) -I$(CIAO_ROOT)/ccm Modify_Custom (IDL) { diff --git a/CIAO/NEWS b/CIAO/NEWS index 81ef52643ea..5015e80c10d 100644 --- a/CIAO/NEWS +++ b/CIAO/NEWS @@ -1,6 +1,32 @@ -USER VISIBLE CHANGES BETWEEN CIAO-1.0.5 and CIAO-1.0.6 +USER VISIBLE CHANGES BETWEEN CIAO-1.0.5 and CIAO-1.1.0 ======================================================= +. It is now possible to connect connections in a deployment plan + at deployment time instead of connecting them on first use. + This can be established by setting the CIAO_PRE_ESTABLISH_CONNECTIONS + define in your config.h. + +. The DDS4CCM connector now only creates a subscriber or + publisher when they are needed. Previously, the DDS4CCM + always created a publisher and subscriber, regardless + of need. + +. Besides late binding, it is now possible to reset the topic + name in the DDS4CCM connector. This means that the DDS4CCM + connector is able to switch between topics of the same data + type at runtime. Resetting a topic name means that DDS will + be closed down and started again, using the new topic name. + On the outside, all connections to and from the connector + stay intact; therefor the user doesn't need to re-establish + the connections again. Please see + $CIAO_ROOT/connectors/dds4ccm/tests/ResetTopic/README for + more info. This directory also contains some examples on how + to reset a topic name. + Since this is not spec-compliant behavior, an issue has been be + raised on the DDS4CCM specification. + +. Improved thread safety in the CIAO core. + USER VISIBLE CHANGES BETWEEN CIAO-1.0.4 and CIAO-1.0.5 ======================================================= diff --git a/CIAO/bin/ciao_tests.lst b/CIAO/bin/ciao_tests.lst index f8a2dfe0ec6..5c7224551f1 100644 --- a/CIAO/bin/ciao_tests.lst +++ b/CIAO/bin/ciao_tests.lst @@ -130,8 +130,14 @@ TAO/CIAO/connectors/dds4ccm/tests/MemLeakDetection/State_MemLeakDetection_Test/d TAO/CIAO/connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/descriptors/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST NDDS TAO/CIAO/connectors/dds4ccm/tests/LateBinding/ReadGet/descriptors/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST NDDS TAO/CIAO/connectors/dds4ccm/tests/LateBinding/UpdateWrite/descriptors/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST NDDS +TAO/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/descriptors/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST NDDS +TAO/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/descriptors/run_test.pl: !FIXED_BUGS_ONLY !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST NDDS +TAO/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/descriptors/run_test.pl: !FIXED_BUGS_ONLY !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST NDDS +TAO/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/descriptors/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST NDDS +TAO/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/descriptors/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST NDDS TAO/CIAO/connectors/dds4ccm/tests/Proxies/ReadWrite/descriptors/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST NDDS TAO/CIAO/connectors/dds4ccm/tests/TypeSupport/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST NDDS +TAO/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/descriptors/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST NDDS TAO/CIAO/connectors/dds4ccm/tutorials/Shapes/Shapes_asm/Deployment/scripts/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST NDDS TAO/CIAO/connectors/dds4ccm/performance-tests/Latency/descriptors/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST NDDS TAO/CIAO/connectors/dds4ccm/performance-tests/DDSLatency/descriptors/run_test_dds.pl: !ACE_FOR_TAO !ST NDDS diff --git a/CIAO/ciao/Base/CIAO_Base.mpc b/CIAO/ciao/Base/CIAO_Base.mpc index 581e172d591..6b4b0bb86f5 100644 --- a/CIAO/ciao/Base/CIAO_Base.mpc +++ b/CIAO/ciao/Base/CIAO_Base.mpc @@ -36,6 +36,7 @@ project(CIAO_Base_stub) : install, ciaolib_with_idl, ciao_output, \ } Header_Files { CIAO_PropertiesC.h + CIAO_ExceptionsC.h Server_init.h Client_init.h CIAO_Base_stub_export.h diff --git a/CIAO/ciao/Containers/Container_Base_T.cpp b/CIAO/ciao/Containers/Container_Base_T.cpp index 3f1d3e05498..81d912fe430 100644 --- a/CIAO/ciao/Containers/Container_Base_T.cpp +++ b/CIAO/ciao/Containers/Container_Base_T.cpp @@ -33,16 +33,19 @@ namespace CIAO { this->sa_ = ::CIAO::Servant_Activator::_nil (); - if (! CORBA::is_nil (this->component_poa_.in ())) + ::PortableServer::POA_var comp_poa_safe = this->component_poa_._retn (); + + if (! CORBA::is_nil (comp_poa_safe.in ())) { - this->component_poa_->destroy (1, 1); - this->component_poa_ = ::PortableServer::POA::_nil (); + comp_poa_safe->destroy (1, 1); } - if (! CORBA::is_nil (this->facet_cons_poa_.in ())) + ::PortableServer::POA_var facet_cons_poa_safe = + this->facet_cons_poa_._retn (); + + if (! CORBA::is_nil (facet_cons_poa_safe.in ())) { - this->facet_cons_poa_->destroy (1, 1); - this->facet_cons_poa_ = ::PortableServer::POA::_nil (); + facet_cons_poa_safe->destroy (1, 1); } this->root_poa_ = ::PortableServer::POA::_nil (); @@ -92,20 +95,20 @@ namespace CIAO { CIAO_TRACE ("Container_i::install_servant"); - PortableServer::POA_ptr tmp = PortableServer::POA::_nil(); + PortableServer::POA_var poa_safe; if (t == Container_Types::COMPONENT_t || t == Container_Types::HOME_t) { - tmp = this->component_poa_.in (); + poa_safe = PortableServer::POA::_duplicate(this->component_poa_.in ()); } else { - tmp = this->facet_cons_poa_.in (); + poa_safe = PortableServer::POA::_duplicate(this->facet_cons_poa_.in ()); } - PortableServer::ObjectId_var tmp_id = tmp->activate_object (p); - CORBA::Object_var objref = tmp->id_to_reference (tmp_id.in ()); + PortableServer::ObjectId_var tmp_id = poa_safe->activate_object (p); + CORBA::Object_var objref = poa_safe->id_to_reference (tmp_id.in ()); oid = tmp_id._retn (); return objref._retn (); @@ -118,19 +121,22 @@ namespace CIAO { CIAO_TRACE ("Container_i::uninstall"); - PortableServer::ServantBase_var svnt; + PortableServer::POA_var poa_safe; switch (y) { case Container_Types::COMPONENT_t: case Container_Types::HOME_t: - svnt = this->component_poa_->reference_to_servant (objref); + poa_safe = PortableServer::POA::_duplicate(this->component_poa_.in()); break; default: - svnt = this->facet_cons_poa_->reference_to_servant (objref); + poa_safe = PortableServer::POA::_duplicate(this->facet_cons_poa_.in()); break; } + PortableServer::ServantBase_var svnt = + poa_safe->reference_to_servant (objref); + PortableServer::ObjectId_var oid; this->uninstall_servant (svnt.in (), y, oid.out ()); } @@ -317,8 +323,10 @@ namespace CIAO { CIAO_TRACE ("Container_i::uninstall_component"); + PortableServer::POA_var poa_safe = + PortableServer::POA::_duplicate(this->component_poa_.in ()); PortableServer::ServantBase_var srv_tmp = - this->component_poa_->reference_to_servant (homeref); + poa_safe->reference_to_servant (homeref); CIAO::Connector_Servant_Impl_Base * svnt = dynamic_cast <CIAO::Connector_Servant_Impl_Base *> ( srv_tmp.in ()); @@ -348,7 +356,7 @@ namespace CIAO { CIAO_TRACE ("Container_i::uninstall_servant"); - PortableServer::POA_ptr tmp = PortableServer::POA::_nil(); + PortableServer::POA_var poa_safe; if ((t == Container_Types::COMPONENT_t) || (t == Container_Types::HOME_t)) @@ -359,7 +367,7 @@ namespace CIAO "Container_i::uninstall_servant - " "Removing component or home servant\n")); - tmp = this->component_poa_.in (); + poa_safe = PortableServer::POA::_duplicate(this->component_poa_.in ()); } else { @@ -369,13 +377,13 @@ namespace CIAO "Container_i::uninstall_servant - " "Removing facet or consumer servant\n")); - tmp = this->facet_cons_poa_.in (); + poa_safe = PortableServer::POA::_duplicate(this->facet_cons_poa_.in ()); } try { - PortableServer::ObjectId_var tmp_id = tmp->servant_to_id (svnt); - tmp->deactivate_object (tmp_id); + PortableServer::ObjectId_var tmp_id = poa_safe->servant_to_id (svnt); + poa_safe->deactivate_object (tmp_id); CIAO_DEBUG (9, (LM_TRACE, @@ -410,14 +418,15 @@ namespace CIAO try { - + PortableServer::POA_var poa_safe = + PortableServer::POA::_duplicate(this->component_poa_.in ()); CIAO::Connector_Servant_Impl_Base * svt = 0; PortableServer::ServantBase_var servant_from_reference; try { servant_from_reference = - this->component_poa_->reference_to_servant (compref); + poa_safe->reference_to_servant (compref); svt = dynamic_cast<CIAO::Connector_Servant_Impl_Base *> ( servant_from_reference.in ()); @@ -488,13 +497,15 @@ namespace CIAO try { + PortableServer::POA_var poa_safe = + PortableServer::POA::_duplicate(this->component_poa_.in ()); CIAO::Connector_Servant_Impl_Base * svt = 0; PortableServer::ServantBase_var servant_from_reference; try { servant_from_reference = - this->component_poa_->reference_to_servant (compref); + poa_safe->reference_to_servant (compref); svt = dynamic_cast<CIAO::Connector_Servant_Impl_Base *> ( servant_from_reference.in ()); @@ -561,7 +572,9 @@ namespace CIAO try { - svt = this->component_poa_->reference_to_servant (compref); + PortableServer::POA_var poa_safe = + PortableServer::POA::_duplicate(this->component_poa_.in ()); + svt = poa_safe->reference_to_servant (compref); } catch (CORBA::Exception &ex) { @@ -587,7 +600,7 @@ namespace CIAO "exception while retrieving servant."); } - if (!svt) + if (CORBA::is_nil (svt.in ())) { CIAO_ERROR (1, (LM_EMERGENCY, CLINFO "Container_i::set_attributes - %C\n" @@ -794,10 +807,12 @@ namespace CIAO throw ::Components::InvalidConnection (); } + PortableServer::POA_var poa_safe = + PortableServer::POA::_duplicate(this->component_poa_.in ()); try { PortableServer::ServantBase_var provider_tmp = - this->component_poa_->reference_to_servant (provider); + poa_safe->reference_to_servant (provider); CIAO_DEBUG (9, (LM_TRACE, @@ -822,7 +837,7 @@ namespace CIAO } PortableServer::ServantBase_var user_tmp = - this->component_poa_->reference_to_servant (user); + poa_safe->reference_to_servant (user); CIAO_DEBUG (9, (LM_TRACE, CLINFO "Container_i::connect_local_facet - " "Successfully fetched user servant [%C] from POA\n", user_port)); @@ -933,8 +948,10 @@ namespace CIAO try { + PortableServer::POA_var poa_safe = + PortableServer::POA::_duplicate(this->component_poa_.in ()); PortableServer::ServantBase_var srv_tmp = - this->component_poa_->reference_to_servant (provider); + poa_safe->reference_to_servant (provider); CIAO_DEBUG (9, (LM_TRACE, @@ -957,7 +974,7 @@ namespace CIAO throw ::Components::InvalidConnection (); } - srv_tmp = this->component_poa_->reference_to_servant (user); + srv_tmp = poa_safe->reference_to_servant (user); CIAO_DEBUG (9, (LM_TRACE, @@ -1039,7 +1056,9 @@ namespace CIAO ::CORBA::Object_ptr Container_i<BASE>::get_objref (PortableServer::Servant p) { - return this->component_poa_->servant_to_reference (p); + PortableServer::POA_var poa_safe = + PortableServer::POA::_duplicate(this->component_poa_.in ()); + return poa_safe->servant_to_reference (p); } template <typename BASE> @@ -1057,16 +1076,16 @@ namespace CIAO { CIAO_TRACE ("Container_i::generate_reference"); - PortableServer::POA_ptr tmp = PortableServer::POA::_nil(); + PortableServer::POA_var poa_safe; if (t == Container_Types::COMPONENT_t || t == Container_Types::HOME_t) { - tmp = this->component_poa_.in (); + poa_safe = PortableServer::POA::_duplicate(this->component_poa_.in ()); } else { - tmp = this->facet_cons_poa_.in (); + poa_safe = PortableServer::POA::_duplicate(this->facet_cons_poa_.in ()); } PortableServer::ObjectId_var oid = @@ -1076,7 +1095,7 @@ namespace CIAO PortableServer::ObjectId_to_string (oid.in ()); CORBA::Object_var objref = - tmp->create_reference_with_id (oid.in (), repo_id); + poa_safe->create_reference_with_id (oid.in (), repo_id); return objref._retn (); } diff --git a/CIAO/ciao/Containers/Servant_Activator.cpp b/CIAO/ciao/Containers/Servant_Activator.cpp index 7da2a332b71..4b37f61cb06 100644 --- a/CIAO/ciao/Containers/Servant_Activator.cpp +++ b/CIAO/ciao/Containers/Servant_Activator.cpp @@ -84,7 +84,7 @@ namespace CIAO throw CORBA::OBJECT_NOT_EXIST (); } - if (CORBA::is_nil (pa_iter->second)) + if (CORBA::is_nil (pa_iter->second.in ())) { CIAO_ERROR (1, (LM_ERROR, CLINFO "Servant_Activator_i::incarnate - " "Port Activator for ObjectId %C was nil!\n", @@ -133,7 +133,7 @@ namespace CIAO throw CORBA::OBJECT_NOT_EXIST (); } - if (CORBA::is_nil (pa_iter->second)) + if (CORBA::is_nil (pa_iter->second.in ())) { CIAO_ERROR (1, (LM_ERROR, CLINFO "Servant_Activator_i::etherealize - " "Port Activator for ObjectId %C was nil!\n", @@ -151,7 +151,7 @@ namespace CIAO guard, this->mutex_, false); - CORBA::String_var safe_oid (pa->oid ()); + ::CORBA::String_var safe_oid (pa->oid ()); ::CORBA::String_var safe_name (pa->name ()); CIAO_DEBUG (6, (LM_INFO, CLINFO "Servant_Activator_i::register_port_activator - " "Registering a port activator for port [%C] with ObjectID [%C]\n", diff --git a/CIAO/ciao/Contexts/Context_Impl_Base_T.cpp b/CIAO/ciao/Contexts/Context_Impl_Base_T.cpp index 4654d054eae..5cdb617d469 100644 --- a/CIAO/ciao/Contexts/Context_Impl_Base_T.cpp +++ b/CIAO/ciao/Contexts/Context_Impl_Base_T.cpp @@ -3,6 +3,8 @@ #ifndef CIAO_CONTEXT_IMPL_BASE_T_C #define CIAO_CONTEXT_IMPL_BASE_T_C +#include "ciao/Logger/Log_Macros.h" + namespace CIAO { template <typename CONTAINER_TYPE> @@ -78,7 +80,18 @@ namespace CIAO CORBA::Object_ptr Context_Impl_Base_T<CONTAINER_TYPE>::resolve_service_reference(const char *service_id) { - return this->container_->resolve_service_reference (service_id); + typename CONTAINER_TYPE::_var_type cnt_safe = + CONTAINER_TYPE::_duplicate (this->container_.in ()); + if (::CORBA::is_nil (cnt_safe.in ())) + { + CIAO_ERROR (1, + (LM_ERROR, + CLINFO + "Extension_Context_Impl::get_client_interceptor_registration - " + "Error: Container is nil\n")); + throw ::CORBA::INV_OBJREF (); + } + return cnt_safe->resolve_service_reference (service_id); } template <typename CONTAINER_TYPE> diff --git a/CIAO/ciao/Contexts/Session/Session_Context_T.cpp b/CIAO/ciao/Contexts/Session/Session_Context_T.cpp index 36d5c7914ab..a54bbe60263 100644 --- a/CIAO/ciao/Contexts/Session/Session_Context_T.cpp +++ b/CIAO/ciao/Contexts/Session/Session_Context_T.cpp @@ -32,7 +32,18 @@ namespace CIAO try { - obj = this->container_->get_objref (this->servant_); + ::CIAO::Session_Container_var cnt_safe = + ::CIAO::Session_Container::_duplicate (this->container_.in ()); + if (::CORBA::is_nil (cnt_safe.in ())) + { + CIAO_ERROR (1, + (LM_ERROR, + CLINFO + "Session_Context_Impl::get_CCM_object - " + "Error: Container is nil\n")); + throw ::CORBA::INV_OBJREF (); + } + obj = cnt_safe->get_objref (this->servant_); } catch (const CORBA::Exception& ex) { diff --git a/CIAO/ciao/Deployment/Handlers/CIAO_State.cpp b/CIAO/ciao/Deployment/Handlers/CIAO_State.cpp index 97c58878251..cad4f3049a5 100644 --- a/CIAO/ciao/Deployment/Handlers/CIAO_State.cpp +++ b/CIAO/ciao/Deployment/Handlers/CIAO_State.cpp @@ -20,6 +20,11 @@ namespace CIAO { CIAO_TRACE ("Deployment_State::add_container"); + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, + guard, + this->container_mutex_, + CORBA::NO_RESOURCES ()); + if (CIAO_debug_level && // Let's only perform this lookup if we have logging enabled. this->containers_.find (id) != this->containers_.end ()) { @@ -35,6 +40,12 @@ namespace CIAO Deployment_State::remove_container (const char *id) { CIAO_TRACE ("Deployment_State::remove_container"); + + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, + guard, + this->container_mutex_, + CORBA::NO_RESOURCES ()); + CONTAINERS::iterator pos = this->containers_.find (id); if (pos != this->containers_.end ()) @@ -46,12 +57,15 @@ namespace CIAO { CIAO_TRACE ("Deployment_State::fetch_container"); + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, + guard, + this->container_mutex_, + CORBA::NO_RESOURCES ()); + CONTAINERS::iterator pos = this->containers_.find (id); if (pos == this->containers_.end ()) - { - return CIAO::Container::_nil (); - } + return CIAO::Container::_nil (); return CIAO::Container::_duplicate (pos->second.in ()); } @@ -63,33 +77,58 @@ namespace CIAO { CIAO_TRACE ("Deployment_State::add_home"); - if (CIAO_debug_level && // Let's only perform this lookup if we have logging enabled. - this->homes_.find (id) != this->homes_.end ()) - { - CIAO_ERROR (1, (LM_WARNING, CLINFO - "Deployment_State::add_home - " - "Warning: Attempting to add duplicate home reference\n")); - } - - this->instance_container_[id] = cont_id; - this->homes_[id] = Components::CCMHome::_duplicate (home); + { + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, + guard, + this->home_mutex_, + CORBA::NO_RESOURCES ()); + + if (CIAO_debug_level && // Let's only perform this lookup if we have logging enabled. + this->homes_.find (id) != this->homes_.end ()) + { + CIAO_ERROR (1, (LM_WARNING, CLINFO + "Deployment_State::add_home - " + "Warning: Attempting to add duplicate home reference\n")); + } + this->homes_[id] = Components::CCMHome::_duplicate (home); + } + + { + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, + guard, + this->instance_container_mutex_, + CORBA::NO_RESOURCES ()); + this->instance_container_[id] = cont_id; + } } void Deployment_State::remove_home (const char *id) { CIAO_TRACE ("Deployment_State::remove_home"); - - HOMES::iterator pos = this->homes_.find (id); - - if (pos != this->homes_.end ()) - this->homes_.erase (pos); - - INSTANCE_CONTAINER::iterator cont = - this->instance_container_.find (id); - - if (cont != this->instance_container_.end ()) - this->instance_container_.erase (cont); + { + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, + guard, + this->home_mutex_, + CORBA::NO_RESOURCES ()); + + HOMES::iterator pos = this->homes_.find (id); + + if (pos != this->homes_.end ()) + this->homes_.erase (pos); + } + + { + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, + guard, + this->instance_container_mutex_, + CORBA::NO_RESOURCES ()); + INSTANCE_CONTAINER::iterator cont = + this->instance_container_.find (id); + + if (cont != this->instance_container_.end ()) + this->instance_container_.erase (cont); + } } Components::CCMHome_ptr @@ -97,9 +136,16 @@ namespace CIAO { CIAO_TRACE ("Deployment_State::fetch_home"); + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, + guard, + this->home_mutex_, + CORBA::NO_RESOURCES ()); + HOMES::iterator pos = this->homes_.find (id); - if (pos == this->homes_.end ()) return Components::CCMHome::_nil (); + if (pos == this->homes_.end ()) + return Components::CCMHome::_nil (); + return Components::CCMHome::_duplicate (pos->second.in ()); } @@ -110,16 +156,28 @@ namespace CIAO { CIAO_TRACE ("Deployment_State::add_component"); - if (CIAO_debug_level && // Let's only perform this lookup if we have logging enabled. - this->components_.find (id) != this->components_.end ()) - { - CIAO_ERROR (1, (LM_WARNING, CLINFO - "Deployment_State::add_component - " - "Warning: Attempting to add duplicate component reference\n")); - } - - this->instance_container_[id] = cont_id; - this->components_[id] = Components::CCMObject::_duplicate (component); + { + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, + guard, + this->component_mutex_, + CORBA::NO_RESOURCES ()); + + if (CIAO_debug_level && // Let's only perform this lookup if we have logging enabled. + this->components_.find (id) != this->components_.end ()) + { + CIAO_ERROR (1, (LM_WARNING, CLINFO + "Deployment_State::add_component - " + "Warning: Attempting to add duplicate component reference\n")); + } + this->components_[id] = Components::CCMObject::_duplicate (component); + } + { + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, + guard, + this->instance_container_mutex_, + CORBA::NO_RESOURCES ()); + this->instance_container_[id] = cont_id; + } } void @@ -127,16 +185,28 @@ namespace CIAO { CIAO_TRACE ("Deployment_State::remove_component"); - COMPONENTS::iterator pos = this->components_.find (id); - - if (pos != this->components_.end ()) - this->components_.erase (pos); - - INSTANCE_CONTAINER::iterator cont = - this->instance_container_.find (id); - - if (cont != this->instance_container_.end ()) - this->instance_container_.erase (cont); + { + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, + guard, + this->component_mutex_, + CORBA::NO_RESOURCES ()); + COMPONENTS::iterator pos = this->components_.find (id); + + if (pos != this->components_.end ()) + this->components_.erase (pos); + } + + { + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, + guard, + this->instance_container_mutex_, + CORBA::NO_RESOURCES ()); + INSTANCE_CONTAINER::iterator cont = + this->instance_container_.find (id); + + if (cont != this->instance_container_.end ()) + this->instance_container_.erase (cont); + } } Components::CCMObject_ptr @@ -144,12 +214,15 @@ namespace CIAO { CIAO_TRACE ("Deployment_State::fetch_component"); + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, + guard, + this->component_mutex_, + CORBA::NO_RESOURCES ()); + COMPONENTS::iterator pos = this->components_.find (id); if (pos == this->components_.end ()) - { - return Components::CCMObject::_nil (); - } + return Components::CCMObject::_nil (); return Components::CCMObject::_duplicate (pos->second.in ()); } @@ -159,6 +232,10 @@ namespace CIAO { CIAO_TRACE ("Deployment_State::instance_to_container"); + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, + guard, + this->instance_container_mutex_, + CORBA::NO_RESOURCES ()); INSTANCE_CONTAINER::const_iterator cont = this->instance_container_.find (id); diff --git a/CIAO/ciao/Deployment/Handlers/CIAO_State.h b/CIAO/ciao/Deployment/Handlers/CIAO_State.h index cb1d81f7ba3..a63a3c90dd1 100644 --- a/CIAO/ciao/Deployment/Handlers/CIAO_State.h +++ b/CIAO/ciao/Deployment/Handlers/CIAO_State.h @@ -56,25 +56,36 @@ namespace CIAO Connection_Handler connection_handler; private: + /// Container administration typedef std::map < std::string, CIAO::Container_var > CONTAINERS; CONTAINERS containers_; + TAO_SYNCH_MUTEX container_mutex_; + typedef std::map < std::string, std::string > INSTANCE_CONTAINER; /// maps instance ids to containers. INSTANCE_CONTAINER instance_container_; + TAO_SYNCH_MUTEX instance_container_mutex_; + + /// Homes administration typedef std::map < std::string, Components::CCMHome_var > HOMES; HOMES homes_; + TAO_SYNCH_MUTEX home_mutex_; + + /// Components administration typedef std::map < std::string, Components::CCMObject_var > COMPONENTS; COMPONENTS components_; + + TAO_SYNCH_MUTEX component_mutex_; }; typedef ACE_Singleton <Deployment_State, diff --git a/CIAO/ciao/Deployment/Handlers/Connection_Handler.cpp b/CIAO/ciao/Deployment/Handlers/Connection_Handler.cpp index 2e5c0a2e614..a2efc2e6d76 100644 --- a/CIAO/ciao/Deployment/Handlers/Connection_Handler.cpp +++ b/CIAO/ciao/Deployment/Handlers/Connection_Handler.cpp @@ -276,7 +276,7 @@ namespace CIAO } else { - //only because of the receptacle is an external endpoint + //only because the receptacle is an external endpoint this->disconnect_non_local (conn, conn.externalReference[0].portName.in ()); } break; @@ -320,7 +320,7 @@ namespace CIAO // pass through throw; } - // Since DANCE shutdown the Locality managers simultaniously, + // Since DANCE shuts down the Locality managers simultaniously, // it could be that one locality manager is shutdown while the // other wants to disconnect from this locality manager. Therefor // we catch an OBJECT_NOT_EXIST, TRANSIENT and a COMM_FAILURE at this point @@ -436,6 +436,10 @@ namespace CIAO ::Components::Cookie_var cookie = provided->connect (conn.externalReference[0].portName.in (), facet.in ()); +#if defined (CIAO_PRE_ESTABLISH_CONNECTIONS) + this->validate_connection(conn.name.in (), facet.in ()); +#endif + CIAO_DEBUG (5, (LM_INFO, CLINFO "Connection_Handler::connect_non_local_facet - " "Connection <%C> successfully established.\n", @@ -509,6 +513,10 @@ namespace CIAO ::Components::Cookie_var cookie = receptacle->connect (endpoint.portName.in (), provided.in ()); +#if defined (CIAO_PRE_ESTABLISH_CONNECTIONS) + this->validate_connection(conn.name.in (), provided.in ()); +#endif + CIAO_DEBUG (5, (LM_INFO, CLINFO "Connection_Handler::connect_non_local_receptacle - " "Connection <%C> successfully established.\n", @@ -597,6 +605,9 @@ namespace CIAO } Components::Cookie_var cookie = publisher->subscribe (endpoint.portName.in (), event.in ()); +#if defined (CIAO_PRE_ESTABLISH_CONNECTIONS) + this->validate_connection(conn.name.in (), publisher.in()); +#endif CIAO_DEBUG (5, (LM_INFO, CLINFO "Connection_Handler::connect_publisher - " @@ -704,6 +715,10 @@ namespace CIAO conn.externalReference[0].portName.in ())); } +#if defined (CIAO_PRE_ESTABLISH_CONNECTIONS) + this->validate_connection(conn.name.in (), event.in()); +#endif + CIAO_DEBUG (5, (LM_INFO, CLINFO "Connection_Handler::connect_consumer - " "Connection <%C> successfully established.\n", @@ -775,6 +790,9 @@ namespace CIAO emitter->connect_consumer (endpoint.portName.in (), event.in ()); +#if defined (CIAO_PRE_ESTABLISH_CONNECTIONS) + this->validate_connection(conn.name.in (), emitter.in()); +#endif CIAO_DEBUG (5, (LM_INFO, CLINFO "Connection_Handler::connect_emitter - " @@ -796,9 +814,14 @@ namespace CIAO CIAO_TRACE ("Connection_Handler::disconnect_non_local"); ::Components::CCMObject_var obj = this->get_ccm_object (conn.name.in ()); + CIAO_DEBUG (6, (LM_DEBUG, CLINFO + "Connection_Handler::disconnect_non_local - " + "About to disconnect <%C>\n", + conn.name.in())); ::CORBA::Object_var safe_tmp = obj->disconnect (port_name, this->get_cookie (conn.name.in ())); + this->remove_cookie (conn.name.in ()); } @@ -972,6 +995,9 @@ namespace CIAO facet_endpoint.portName.in (), receptacle, receptacle_endpoint.portName.in ()); +#if defined (CIAO_PRE_ESTABLISH_CONNECTIONS) + this->validate_connection(conn.name.in (), facet); +#endif CIAO_DEBUG (5, (LM_INFO, CLINFO "Connection_Handler::connect_local_port - " "Connected local port <%C>:<%C> to <%C>:<%C>\n", @@ -1062,6 +1088,36 @@ namespace CIAO receptacle_endpoint.portName.in ())); } + void + Connection_Handler::validate_connection (const char * conn, + ::CORBA::Object_ptr obj) + { + CIAO_TRACE ("Connection_Handler::validate_connection"); + try + { + if (!::CORBA::is_nil (obj)) + { + ::CORBA::PolicyList_var pl; + if (obj->_validate_connection (pl.out ())) + { + CIAO_DEBUG (6, (LM_DEBUG, CLINFO "Connection_Handler::validate_connection - " + "Succesfully validated connection <%C>. Connection has been pre-established.\n", + conn)); + } + else + { + CIAO_ERROR (1, (LM_ERROR, CLINFO "Connection_Handler::validate_connection - " + "Failed to pre-establish a connection <%C>.\n", + conn)); + } + } + } + catch (const ::CORBA::Exception &ex) + { + ex._tao_print_exception("Connection_Handler::validate_connection"); + } + } + bool Connection_Handler::is_local_connection (const ::Deployment::PlanConnectionDescription &conn) { @@ -1085,6 +1141,11 @@ namespace CIAO { CIAO_TRACE ("Connection_Handler::insert_cookie"); + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, + guard, + this->cookies_mutex_, + CORBA::NO_RESOURCES ()); + std::pair <std::string, CONNECTION_INFO> value_to_insert (connection_name, conn_info); std::pair<COOKIES::iterator, bool> ret = this->cookies_.insert (value_to_insert); @@ -1112,6 +1173,11 @@ namespace CIAO { CIAO_TRACE ("Connection_Handler::remove_cookie"); + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, + guard, + this->cookies_mutex_, + CORBA::NO_RESOURCES ()); + COOKIES::iterator it = this->cookies_.find (connection_name); if (it == this->cookies_.end ()) { @@ -1134,6 +1200,11 @@ namespace CIAO { CIAO_TRACE ("Connection_Handler::get_cookie"); + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, + guard, + this->cookies_mutex_, + CORBA::NO_RESOURCES ()); + COOKIES::iterator it = this->cookies_.find (connection_name); if (it == this->cookies_.end ()) { @@ -1157,6 +1228,8 @@ namespace CIAO ::Components::CCMObject_ptr Connection_Handler::get_ccm_object (const char * connection_name) { + CIAO_TRACE ("Connection_Handler::get_ccm_object"); + COOKIES::iterator it = this->cookies_.find (connection_name); if (it == this->cookies_.end ()) { @@ -1167,6 +1240,7 @@ namespace CIAO throw ::Deployment::InvalidConnection (connection_name, "Unable to find correct cookie"); } + ::Components::CCMObject_var ret = it->second.second; if (::CORBA::is_nil (ret.in ())) { @@ -1183,6 +1257,7 @@ namespace CIAO ::CORBA::ULong Connection_Handler::retrieve_endpoint (const ::Deployment::PlanConnectionDescription &conn) { + CIAO_TRACE ("Connection_Handler::retrieve_endpoint"); if (conn.internalEndpoint.length () == 0) { CIAO_ERROR (1, (LM_ERROR, CLINFO diff --git a/CIAO/ciao/Deployment/Handlers/Connection_Handler.h b/CIAO/ciao/Deployment/Handlers/Connection_Handler.h index 8238f2fe9a6..de4d22a7436 100644 --- a/CIAO/ciao/Deployment/Handlers/Connection_Handler.h +++ b/CIAO/ciao/Deployment/Handlers/Connection_Handler.h @@ -96,6 +96,9 @@ namespace CIAO bool is_local_connection (const ::Deployment::PlanConnectionDescription &conn); + void validate_connection (const char * conn, + ::CORBA::Object_ptr obj); + ::CORBA::ULong retrieve_endpoint (const ::Deployment::PlanConnectionDescription &conn); typedef std::pair < ::Components::Cookie_var, @@ -113,6 +116,8 @@ namespace CIAO ::Components::CCMObject_ptr get_ccm_object (const char * connection_name); COOKIES cookies_; + + TAO_SYNCH_MUTEX cookies_mutex_; }; } #endif diff --git a/CIAO/ciao/Deployment/Interceptors/CIAO_Deployment_Interceptors.mpc b/CIAO/ciao/Deployment/Interceptors/CIAO_Deployment_Interceptors.mpc index ff817cc208c..6e1dd990a85 100644 --- a/CIAO/ciao/Deployment/Interceptors/CIAO_Deployment_Interceptors.mpc +++ b/CIAO/ciao/Deployment/Interceptors/CIAO_Deployment_Interceptors.mpc @@ -1,5 +1,5 @@ // $Id$ -project (CIAO_Deployment_Interceptors) : ciao_base, ciao_lib, ciao_output, \ +project (CIAO_Deployment_Interceptors) : install, ciao_base, ciao_lib, ciao_output, \ naming, ciao_logger, dance_stub, dance_deployment_scheduler { dynamicflags += CIAO_DEPLOYMENT_INTERCEPTORS_BUILD_DLL @@ -12,4 +12,8 @@ project (CIAO_Deployment_Interceptors) : ciao_base, ciao_lib, ciao_output, \ Deployment_Interceptors.h Name_Utilities.h } + + specific { + install_dir = ciao/Deployment/Interceptors + } } diff --git a/CIAO/ciao/Deployment/Interceptors/Deployment_Interceptors.cpp b/CIAO/ciao/Deployment/Interceptors/Deployment_Interceptors.cpp index 08ffebefa2f..a548c5fa45a 100644 --- a/CIAO/ciao/Deployment/Interceptors/Deployment_Interceptors.cpp +++ b/CIAO/ciao/Deployment/Interceptors/Deployment_Interceptors.cpp @@ -116,7 +116,7 @@ namespace CIAO CORBA::Object_var obj; props[i].value >>= CORBA::Any::to_object (obj); - ctx_ = CosNaming::NamingContext::_narrow (obj.in ()); + this->ctx_ = CosNaming::NamingContext::_narrow (obj.in ()); } } } diff --git a/CIAO/ciao/Servants/Connector_Servant_Impl_Base.cpp b/CIAO/ciao/Servants/Connector_Servant_Impl_Base.cpp index d9155d9a286..aa2b5772680 100644 --- a/CIAO/ciao/Servants/Connector_Servant_Impl_Base.cpp +++ b/CIAO/ciao/Servants/Connector_Servant_Impl_Base.cpp @@ -33,28 +33,34 @@ namespace CIAO try { - PortableServer::POA_var port_poa = - this->container_->the_port_POA (); + Container_var cnt_safe = Container::_duplicate(this->container_.in ()); + PortableServer::POA_var port_poa = cnt_safe->the_port_POA (); - // Removing Facets - for (FacetTable::const_iterator iter = - this->facet_table_.begin (); - iter != this->facet_table_.end (); - ++iter) - { - PortableServer::ObjectId_var facet_id = - port_poa->reference_to_id (iter->second); + { + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, + mon, + this->lock_, + CORBA::NO_RESOURCES ()); + // Removing Facets + for (FacetTable::const_iterator iter = + this->facet_table_.begin (); + iter != this->facet_table_.end (); + ++iter) + { + PortableServer::ObjectId_var facet_id = + port_poa->reference_to_id (iter->second); - port_poa->deactivate_object (facet_id); + port_poa->deactivate_object (facet_id); - CIAO::Servant_Activator_var sa = - this->container_->ports_servant_activator (); + CIAO::Servant_Activator_var sa = + cnt_safe->ports_servant_activator (); - if (!CORBA::is_nil (sa.in ())) - { - sa->update_port_activator (facet_id.in ()); - } - } + if (!CORBA::is_nil (sa.in ())) + { + sa->update_port_activator (facet_id.in ()); + } + } + } this->ccm_remove (); @@ -189,19 +195,25 @@ namespace CIAO retval->length (this->facet_table_.size ()); CORBA::ULong i = 0UL; - for (FacetTable::const_iterator iter = - this->facet_table_.begin (); - iter != this->facet_table_.end (); - ++iter, ++i) - { - ::Components::FacetDescription *fd = 0; - ACE_NEW_THROW_EX (fd, - ::OBV_Components::FacetDescription (iter->first.c_str (), - iter->second->_interface_repository_id (), - iter->second), - CORBA::NO_MEMORY ()); - retval[i] = fd; - } + { + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, + mon, + this->lock_, + CORBA::NO_RESOURCES ()); + for (FacetTable::const_iterator iter = + this->facet_table_.begin (); + iter != this->facet_table_.end (); + ++iter, ++i) + { + ::Components::FacetDescription *fd = 0; + ACE_NEW_THROW_EX (fd, + ::OBV_Components::FacetDescription (iter->first.c_str (), + iter->second->_interface_repository_id (), + iter->second), + CORBA::NO_MEMORY ()); + retval[i] = fd; + } + } return retval._retn (); } @@ -502,7 +514,9 @@ namespace CIAO } { - ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, mon, this->lock_, + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, + mon, + this->lock_, CORBA::NO_RESOURCES ()); this->facet_table_[port_name] = ::CORBA::Object::_duplicate (port_ref); diff --git a/CIAO/ciao/Servants/Extension/Servant_Impl_T.cpp b/CIAO/ciao/Servants/Extension/Servant_Impl_T.cpp index 72a7166d719..263a27417b1 100644 --- a/CIAO/ciao/Servants/Extension/Servant_Impl_T.cpp +++ b/CIAO/ciao/Servants/Extension/Servant_Impl_T.cpp @@ -24,12 +24,12 @@ namespace CIAO ACE_NEW (this->context_, CONTEXT (home, c, this, ins_name)); - ::Components::ExtensionComponent_var scom = + ::Components::ExtensionComponent_var ecom = ::Components::ExtensionComponent::_narrow (exe); - if (! ::CORBA::is_nil (scom.in ())) + if (! ::CORBA::is_nil (ecom.in ())) { - scom->set_extension_context (this->context_); + ecom->set_extension_context (this->context_); } else { @@ -108,10 +108,10 @@ namespace CIAO CORBA::Object_ptr Extension_Servant_Impl<BASE_SKEL, EXEC, CONTEXT>::_get_component (void) { - ::Components::ExtensionContext_var sc = + ::Components::ExtensionContext_var ec = ::Components::ExtensionContext::_narrow (this->context_); - if (! ::CORBA::is_nil (sc.in ())) + if (! ::CORBA::is_nil (ec.in ())) { // @todo return sc->get_CCM_object (); } diff --git a/CIAO/ciao/Servants/Home_Servant_Impl_T.cpp b/CIAO/ciao/Servants/Home_Servant_Impl_T.cpp index 4d9ee76f6ff..cc334924559 100644 --- a/CIAO/ciao/Servants/Home_Servant_Impl_T.cpp +++ b/CIAO/ciao/Servants/Home_Servant_Impl_T.cpp @@ -69,15 +69,17 @@ namespace CIAO { CIAO_TRACE ("Home_Servant_Impl<>::remove_component"); - PortableServer::POA_var poa = - this->container_->the_POA (); - PortableServer::ObjectId_var oid = - poa->reference_to_id (comp); + typename CONTAINER::_var_type cnt_safe = + CONTAINER::_duplicate (this->container_.in()); + PortableServer::POA_var poa = cnt_safe->the_POA (); + PortableServer::ObjectId_var oid = poa->reference_to_id (comp); - Components::CCMObject_var ccm_obj_var = Components::CCMObject::_nil (); + Components::CCMObject_var ccm_obj_var; if (objref_map_.find (oid.in (), ccm_obj_var) != 0) { - CIAO_ERROR (1, (LM_WARNING, CLINFO "Home_Servant_Impl<>::remove_component - Invalid component object reference\n")); + CIAO_ERROR (1, (LM_WARNING, CLINFO + "Home_Servant_Impl<>::remove_component - " + "Invalid component object reference\n")); throw Components::RemoveFailure (); } @@ -94,7 +96,9 @@ namespace CIAO _ciao_comp->remove (); } - CIAO_DEBUG (6, (LM_INFO, CLINFO "Home_Servant_Impl<>::remove_component - Removed the component\n")); + CIAO_DEBUG (6, (LM_INFO, CLINFO + "Home_Servant_Impl<>::remove_component - " + "Removed the component\n")); } template <typename BASE_SKEL, @@ -113,8 +117,9 @@ namespace CIAO Components::CCMObject_var ccm_obj_ptr; if (objref_map_.unbind (oid, ccm_obj_ptr) != 0) { - CIAO_ERROR (1, (LM_ERROR, CLINFO "Home_Servant_Impl<>::update_component_map - " - "Invalid component object reference\n")); + CIAO_ERROR (1, (LM_ERROR, CLINFO + "Home_Servant_Impl<>::update_component_map - " + "Invalid component object reference\n")); } } @@ -148,12 +153,16 @@ namespace CIAO if (::CORBA::is_nil (this->executor_.in ())) { - CIAO_ERROR (1, (LM_ERROR, CLINFO "Home_Servant_Impl<>:create - nil executor reference\n")); + CIAO_ERROR (1, (LM_ERROR, CLINFO + "Home_Servant_Impl<>:create - " + "nil executor reference\n")); throw CORBA::INTERNAL (); } - ::Components::EnterpriseComponent_var _ciao_ec = - this->executor_->create (); + typename EXEC::_var_type exec_safe = + EXEC::_duplicate (this->executor_.in()); + + ::Components::EnterpriseComponent_var _ciao_ec = exec_safe->create (); typedef typename COMP_SVNT::_exec_type exec_type; typename COMP_SVNT::_exec_type::_var_type _ciao_comp = @@ -175,7 +184,10 @@ namespace CIAO { CIAO_TRACE ("Home_Servant_Impl<>::_ciao_activate_component"); - CORBA::Object_var hobj = this->container_->get_objref (this); + typename CONTAINER::_var_type cnt_safe = + CONTAINER::_duplicate (this->container_.in()); + + CORBA::Object_var hobj = cnt_safe->get_objref (this); Components::CCMHome_var home = Components::CCMHome::_narrow (hobj.in ()); @@ -194,16 +206,16 @@ namespace CIAO home.in (), (this->ins_name_ + buffer).c_str (), this, - this->container_), + cnt_safe), CORBA::NO_MEMORY ()); PortableServer::ServantBase_var safe (svt); PortableServer::ObjectId_var oid; CORBA::Object_var objref = - this->container_->install_servant (svt, - Container_Types::COMPONENT_t, - oid.out ()); + cnt_safe->install_servant (svt, + Container_Types::COMPONENT_t, + oid.out ()); typedef typename COMP_SVNT::_stub_type stub_type; typename COMP_SVNT::_stub_var_type ho = stub_type::_narrow (objref.in ()); @@ -229,7 +241,10 @@ namespace CIAO { CIAO_TRACE ("Home_Servant_Impl<>::_ciao_passivate_component"); - this->container_->uninstall_component (comp); + typename CONTAINER::_var_type cnt_safe = + CONTAINER::_duplicate (this->container_.in()); + + cnt_safe->uninstall_component (comp); } } diff --git a/CIAO/ciao/Servants/Servant_Impl_Base.cpp b/CIAO/ciao/Servants/Servant_Impl_Base.cpp index ad9096a23af..35c45e44fee 100644 --- a/CIAO/ciao/Servants/Servant_Impl_Base.cpp +++ b/CIAO/ciao/Servants/Servant_Impl_Base.cpp @@ -25,6 +25,8 @@ namespace CIAO try { + Container_var cnt_safe = + Container::_duplicate(this->container_.in ()); PortableServer::POA_var port_poa = this->container_->the_port_POA (); @@ -39,7 +41,7 @@ namespace CIAO port_poa->deactivate_object (cons_id); CIAO::Servant_Activator_var sa = - this->container_->ports_servant_activator (); + cnt_safe->ports_servant_activator (); if (!CORBA::is_nil (sa.in ())) { @@ -275,7 +277,9 @@ namespace CIAO } { - ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, mon, this->lock_, + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, + mon, + this->lock_, CORBA::NO_RESOURCES ()); this->consumer_table_[port_name] = ::Components::EventConsumerBase::_duplicate (port_ref); diff --git a/CIAO/ciao/Servants/Session/Servant_Impl_T.cpp b/CIAO/ciao/Servants/Session/Servant_Impl_T.cpp index 3b78d1d6680..32066508613 100644 --- a/CIAO/ciao/Servants/Session/Servant_Impl_T.cpp +++ b/CIAO/ciao/Servants/Session/Servant_Impl_T.cpp @@ -46,6 +46,7 @@ namespace CIAO typename CONTEXT> Session_Servant_Impl<BASE_SKEL, EXEC, CONTEXT>::~Session_Servant_Impl (void) { + //TODO: thread safe? How? if (this->executor_->_refcount_value () > 1) { CIAO_ERROR (1, diff --git a/CIAO/connectors/dds4ccm/idl/dds4ccm_lem_stub.mpc b/CIAO/connectors/dds4ccm/idl/dds4ccm_lem_stub.mpc index 130ab10f97a..c915f486cfe 100644 --- a/CIAO/connectors/dds4ccm/idl/dds4ccm_lem_stub.mpc +++ b/CIAO/connectors/dds4ccm/idl/dds4ccm_lem_stub.mpc @@ -21,9 +21,15 @@ project (DDS4CCM_lem_gen) : install, dds4ccm, ciaoidldefaults { dds4ccm_StateListenerControlE.idl dds4ccm_ConnectorE.idl } + + specific { + install_dir = connectors/dds4ccm/idl + } } -project (DDS4CCM_lem_stub) : install, dds4ccm, ccm_lem_stub, ccm_session_stub, ciaolib_with_idl, ciao_output, taolib, valuetype, ifr_client { +project (DDS4CCM_lem_stub) : install, dds4ccm, ccm_lem_stub, ccm_session_stub, \ + ciaolib_with_idl, ciao_output, taolib, valuetype, \ + ifr_client { after += DDS4CCM_stub DDS4CCM_lem_gen CIAO_NDDS_lem_stub libs += DDS4CCM_stub includes += $(CIAO_ROOT)/connectors @@ -50,7 +56,22 @@ project (DDS4CCM_lem_stub) : install, dds4ccm, ccm_lem_stub, ccm_session_stub, c dds4ccm_DataListenerControlEC.h dds4ccm_ConnectorStatusListenerEC.h dds4ccm_StateListenerControlEC.h + dds4ccm_ConnectorEC.h dds4ccm_lem_stub_export.h } + + Inline_Files { + dds4ccm_BaseEC.inl + dds_rtf2_dcpsEC.inl + dds4ccm_PortStatusListenerEC.inl + dds4ccm_DataListenerControlEC.inl + dds4ccm_ConnectorStatusListenerEC.inl + dds4ccm_StateListenerControlEC.inl + dds4ccm_ConnectorEC.inl + } + + specific { + install_dir = connectors/dds4ccm/idl + } } diff --git a/CIAO/connectors/dds4ccm/idl/dds4ccm_skel.mpc b/CIAO/connectors/dds4ccm/idl/dds4ccm_skel.mpc index 5ce6f26cf24..309ba352d67 100644 --- a/CIAO/connectors/dds4ccm/idl/dds4ccm_skel.mpc +++ b/CIAO/connectors/dds4ccm/idl/dds4ccm_skel.mpc @@ -1,6 +1,7 @@ // $Id$ -project (DDS4CCM_skel) : install, dds4ccm_lem_stub, ciaolib_with_idl, ciao_output, taolib, portableserver, ciao_servant { +project (DDS4CCM_skel) : install, dds4ccm_lem_stub, ciaolib_with_idl, \ + ciao_output, taolib, portableserver, ciao_servant { includes += $(CIAO_ROOT)/connectors dynamicflags += DDS4CCM_SKEL_BUILD_DLL @@ -8,12 +9,16 @@ project (DDS4CCM_skel) : install, dds4ccm_lem_stub, ciaolib_with_idl, ciao_outpu } Header_Files { + dds4ccm_skel_export.h + dds4ccm_EntityS.h + ccm_ddsS.h dds4ccm_BaseS.h dds4ccm_QueryFilterS.h dds4ccm_PortStatusListenerS.h dds4ccm_DataListenerControlS.h dds4ccm_StateListenerControlS.h dds4ccm_ConnectorStatusListenerS.h + dds4ccm_ConnectorS.h dds_rtf2_dcpsS.h } @@ -25,4 +30,17 @@ project (DDS4CCM_skel) : install, dds4ccm_lem_stub, ciaolib_with_idl, ciao_outpu dds4ccm_ConnectorS.cpp dds4ccm_StateListenerControlS.cpp } + + Inline_Files { + dds_rtf2_dcpsS.inl + dds4ccm_PortStatusListenerS.inl + dds4ccm_DataListenerControlS.inl + dds4ccm_ConnectorStatusListenerS.inl + dds4ccm_ConnectorS.inl + dds4ccm_StateListenerControlS.inl + } + + specific { + install_dir = connectors/dds4ccm/idl + } } diff --git a/CIAO/connectors/dds4ccm/idl/dds4ccm_stub.mpc b/CIAO/connectors/dds4ccm/idl/dds4ccm_stub.mpc index fe189aa6d4e..9d1abfae6ff 100644 --- a/CIAO/connectors/dds4ccm/idl/dds4ccm_stub.mpc +++ b/CIAO/connectors/dds4ccm/idl/dds4ccm_stub.mpc @@ -9,19 +9,20 @@ project (DDS4CCM_idl_gen) : install, dds4ccm, componentidldefaults { -I$(CIAO_ROOT)/connectors -Glem IDL_Files { + idlflags -= -Gsv idlflags += -Gxhst -Gxhsk -SS dds4ccm_Base.idl } IDL_Files { - idlflags -= -Gxhst -Gxhsk + idlflags -= -Gxhst -Gxhsk -Gsv -Glem idlflags -= -St -Sa idlflags += -SS dds4ccm_QueryFilter.idl } IDL_Files { - idlflags -= -Gxhst -Gxhsk + idlflags -= -Gxhst -Gxhsk -Gsv idlflags += -Sci -SS -Scc dds4ccm_Entity.idl ccm_dds.idl @@ -36,6 +37,10 @@ project (DDS4CCM_idl_gen) : install, dds4ccm, componentidldefaults { dds4ccm_StateListenerControl.idl dds4ccm_Connector.idl } + + specific { + install_dir = connectors/dds4ccm/idl + } } project (DDS4CCM_stub) : install, dds4ccm, ccm_stub, ciaolib_with_idl, ciao_output, taolib { @@ -47,12 +52,16 @@ project (DDS4CCM_stub) : install, dds4ccm, ccm_stub, ciaolib_with_idl, ciao_outp } Header_Files { + dds4ccm_stub_export.h + dds4ccm_EntityC.h + ccm_ddsC.h dds4ccm_BaseC.h dds4ccm_QueryFilterC.h dds4ccm_PortStatusListenerC.h dds4ccm_DataListenerControlC.h dds4ccm_ConnectorStatusListenerC.h dds4ccm_StateListenerControlC.h + dds4ccm_ConnectorC.h dds_rtf2_dcpsC.h } @@ -66,5 +75,19 @@ project (DDS4CCM_stub) : install, dds4ccm, ccm_stub, ciaolib_with_idl, ciao_outp dds4ccm_ConnectorC.cpp dds_rtf2_dcpsC.cpp } + + Inline_Files { + dds4ccm_BaseC.inl + dds4ccm_PortStatusListenerC.inl + dds4ccm_DataListenerControlC.inl + dds4ccm_ConnectorStatusListenerC.inl + dds4ccm_StateListenerControlC.inl + dds4ccm_ConnectorC.inl + dds_rtf2_dcpsC.inl + } + + specific { + install_dir = connectors/dds4ccm/idl + } } diff --git a/CIAO/connectors/dds4ccm/idl/ndds/ndds_dcps.idl b/CIAO/connectors/dds4ccm/idl/ndds/ndds_dcps.idl index 76829440c2a..573ca744dae 100644 --- a/CIAO/connectors/dds4ccm/idl/ndds/ndds_dcps.idl +++ b/CIAO/connectors/dds4ccm/idl/ndds/ndds_dcps.idl @@ -229,8 +229,8 @@ module DDS { local interface Listener {}; local interface TopicListener : Listener { - void on_inconsistent_topic(in Topic the_topic, - in InconsistentTopicStatus status); + void on_inconsistent_topic(in Topic the_topic, + in InconsistentTopicStatus status); }; local interface DataWriterListener : Listener { diff --git a/CIAO/connectors/dds4ccm/idl/ndds/ndds_idltocpp_lem_stub.mpc b/CIAO/connectors/dds4ccm/idl/ndds/ndds_idltocpp_lem_stub.mpc index 1a0dc70497c..ff39d52a23f 100644 --- a/CIAO/connectors/dds4ccm/idl/ndds/ndds_idltocpp_lem_stub.mpc +++ b/CIAO/connectors/dds4ccm/idl/ndds/ndds_idltocpp_lem_stub.mpc @@ -15,6 +15,10 @@ project (CIAO_NDDS_lem_gen) : install, ndds_idltocpp, ciaoidldefaults { IDL_Files { ndds_dcps_i_handleE.idl } + + specific { + install_dir = connectors/dds4ccm/idl/ndds + } } project (CIAO_NDDS_lem_stub) : install, ndds_idltocpp_stub, ccm_lem_stub, ccm_session_stub, ciaolib_with_idl, ciao_output, taolib, valuetype, ifr_client { @@ -35,5 +39,14 @@ project (CIAO_NDDS_lem_stub) : install, ndds_idltocpp_stub, ccm_lem_stub, ccm_se ndds_lem_stub_export.h ndds_dcps_i_handleEC.h } + + Inline_Files { + ndds_dcpsEC.inl + ndds_dcps_i_handleEC.inl + } + + specific { + install_dir = connectors/dds4ccm/idl/ndds + } } diff --git a/CIAO/connectors/dds4ccm/idl/ndds/ndds_idltocpp_skel.mpc b/CIAO/connectors/dds4ccm/idl/ndds/ndds_idltocpp_skel.mpc index 3ac0258877a..8a3c01e4d7f 100644 --- a/CIAO/connectors/dds4ccm/idl/ndds/ndds_idltocpp_skel.mpc +++ b/CIAO/connectors/dds4ccm/idl/ndds/ndds_idltocpp_skel.mpc @@ -9,6 +9,7 @@ project (CIAO_NDDS_skel) : install, ndds_idltocpp_stub, ciaolib_with_idl, ciao_o } Header_Files { + ndds_skel_export.h ndds_dcpsS.h ndds_dcps_i_handleS.h } @@ -17,4 +18,13 @@ project (CIAO_NDDS_skel) : install, ndds_idltocpp_stub, ciaolib_with_idl, ciao_o ndds_dcpsS.cpp ndds_dcps_i_handleS.cpp } + + Inline_Files { + ndds_dcpsS.inl + ndds_dcps_i_handleS.inl + } + + specific { + install_dir = connectors/dds4ccm/idl/ndds + } } diff --git a/CIAO/connectors/dds4ccm/idl/ndds/ndds_idltocpp_stub.mpc b/CIAO/connectors/dds4ccm/idl/ndds/ndds_idltocpp_stub.mpc index c57e5e28376..bb24ef53099 100644 --- a/CIAO/connectors/dds4ccm/idl/ndds/ndds_idltocpp_stub.mpc +++ b/CIAO/connectors/dds4ccm/idl/ndds/ndds_idltocpp_stub.mpc @@ -9,12 +9,18 @@ project (CIAO_NDDS_idl_gen) : install, ndds_idltocpp, componentidldefaults { -I$(CIAO_ROOT)/connectors -Glem IDL_Files { + idlflags -= -Gsv ndds_dcps.idl } + IDL_Files { - idlflags -= -Gxhst -Gxhsk + idlflags -= -Gxhst -Gxhsk -Gsv ndds_dcps_i_handle.idl } + + specific { + install_dir = connectors/dds4ccm/idl/ndds + } } project (CIAO_NDDS_stub) : install, ndds_idltocpp, ccm_stub, ciaolib_with_idl, ciao_output, taolib { @@ -27,6 +33,7 @@ project (CIAO_NDDS_stub) : install, ndds_idltocpp, ccm_stub, ciaolib_with_idl, c } Header_Files { + ndds_stub_export.h ndds_dcpsC.h ndds_dcps_i_handleC.h ndds_dcps_instance_handleC.h @@ -37,6 +44,21 @@ project (CIAO_NDDS_stub) : install, ndds_idltocpp, ccm_stub, ciaolib_with_idl, c ndds_dcps_i_handleC.cpp ndds_dcps_instance_handleC.cpp } + + Inline_Files { + ndds_dcpsC.inl + ndds_dcps_i_handleC.inl + } + + specific { + install_dir = connectors/dds4ccm/idl/ndds + } + + verbatim(gnuace, postinstall) { +" cp ndds_dcps_instance_handle.idl $(INSTALL_PREFIX)/include/connectors/dds4ccm/idl/ndds/" +" cp ndds_dcps_instance_handle*.h $(INSTALL_PREFIX)/include/connectors/dds4ccm/idl/ndds/" + } + } project (CIAO_NDDS_idl_install_only) { diff --git a/CIAO/connectors/dds4ccm/impl/CCM_DataReader.cpp b/CIAO/connectors/dds4ccm/impl/CCM_DataReader.cpp index ea7741dcc66..b60a111538e 100644 --- a/CIAO/connectors/dds4ccm/impl/CCM_DataReader.cpp +++ b/CIAO/connectors/dds4ccm/impl/CCM_DataReader.cpp @@ -43,7 +43,9 @@ CIAO::DDS4CCM::CCM_DataReader::create_readcondition ( ::DDS::ViewStateMask view_states, ::DDS::InstanceStateMask instance_states) { - return this->dds_entity ()->create_readcondition (sample_states, view_states, instance_states); + return this->dds_entity ()->create_readcondition (sample_states, + view_states, + instance_states); } ::DDS::QueryCondition_ptr @@ -54,7 +56,11 @@ CIAO::DDS4CCM::CCM_DataReader::create_querycondition ( const char * query_expression, const ::DDS::StringSeq & query_parameters) { - return this->dds_entity ()->create_querycondition (sample_states, view_states, instance_states, query_expression, query_parameters); + return this->dds_entity ()->create_querycondition (sample_states, + view_states, + instance_states, + query_expression, + query_parameters); } ::DDS::ReturnCode_t @@ -171,7 +177,8 @@ CIAO::DDS4CCM::CCM_DataReader::get_matched_publication_data ( ::DDS::PublicationBuiltinTopicData & publication_data, DDS_INSTANCE_HANDLE_T_IN publication_handle) { - return this->dds_entity ()->get_matched_publication_data (publication_data, publication_handle); + return this->dds_entity ()->get_matched_publication_data (publication_data, + publication_handle); } diff --git a/CIAO/connectors/dds4ccm/impl/DDS_Event_Connector_T.cpp b/CIAO/connectors/dds4ccm/impl/DDS_Event_Connector_T.cpp index 3786f19ca7c..1371b7e41c1 100644 --- a/CIAO/connectors/dds4ccm/impl/DDS_Event_Connector_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/DDS_Event_Connector_T.cpp @@ -35,6 +35,7 @@ DDS_Event_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::get_supplier_data (v this->supplier_obtained_ = true; this->supplier_.set_component (this); + this->init_publisher_ |= this->supplier_obtained_; return this->supplier_.get_data (); } @@ -46,6 +47,7 @@ DDS_Event_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::get_supplier_dds_ent this->supplier_obtained_ = true; this->supplier_.set_component (this); + this->init_publisher_ |= this->supplier_obtained_; return this->supplier_.get_dds_entity (); } @@ -57,6 +59,7 @@ DDS_Event_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::get_pull_consumer_fr this->pull_consumer_obtained_ = true; this->pull_consumer_.set_component (this); + this->init_subscriber_ |= this->pull_consumer_obtained_; return this->pull_consumer_.get_fresh_data (); } @@ -68,6 +71,7 @@ DDS_Event_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::get_push_consumer_da this->push_consumer_obtained_ = true; this->push_consumer_.set_component (this); + this->init_subscriber_ |= this->push_consumer_obtained_; return this->push_consumer_.get_data (); } @@ -79,6 +83,7 @@ DDS_Event_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::get_pull_consumer_da this->pull_consumer_obtained_ = true; this->pull_consumer_.set_component (this); + this->init_subscriber_ |= this->pull_consumer_obtained_; return this->pull_consumer_.get_data (); } @@ -90,6 +95,7 @@ DDS_Event_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::get_pull_consumer_fi this->pull_consumer_obtained_ = true; this->pull_consumer_.set_component (this); + this->init_subscriber_ |= this->pull_consumer_obtained_; return this->pull_consumer_.get_filter_config (); } @@ -101,6 +107,7 @@ DDS_Event_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::get_push_consumer_da this->push_consumer_obtained_ = true; this->push_consumer_.set_component (this); + this->init_subscriber_ |= this->push_consumer_obtained_; return this->push_consumer_.get_data_control (); } @@ -112,6 +119,7 @@ DDS_Event_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::get_pull_consumer_dd this->pull_consumer_obtained_ = true; this->pull_consumer_.set_component (this); + this->init_subscriber_ |= this->pull_consumer_obtained_; return this->pull_consumer_.get_dds_entity (); } @@ -142,6 +150,7 @@ DDS_Event_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::get_push_consumer_dd this->push_consumer_obtained_ = true; this->push_consumer_.set_component (this); + this->init_subscriber_ |= this->push_consumer_obtained_; return this->push_consumer_.get_dds_entity (); } @@ -153,6 +162,7 @@ DDS_Event_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::get_push_consumer_fi this->push_consumer_obtained_ = true; this->push_consumer_.set_component (this); + this->init_subscriber_ |= this->push_consumer_obtained_; return this->push_consumer_.get_filter_config (); } @@ -182,7 +192,46 @@ DDS_Event_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::topic_name ( { DDS4CCM_TRACE ("DDS_Event_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::topic_name"); - if (this->late_binded (topic_name)) + if (this->stop_dds (topic_name)) + { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO + "DDS_Event_Connector_T::topic_name - " + "Stopping DDS=>switching to new topic <%C>.\n", + topic_name)); + this->ccm_passivate (); + this->do_ccm_remove (); + + if (ACE_OS::strlen (topic_name) > 0) + { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO + "DDS_Event_Connector_T::topic_name - " + "DDS is down. Setting new to <%C>.\n", + topic_name)); + + TopicBaseConnector::topic_name (topic_name); + + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO + "DDS_Event_Connector_T::topic_name - " + "Initialize DDS again for topic <%C>.\n", + topic_name)); + + this->do_configuration_complete (); + this->do_ccm_activate (); + + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO + "DDS_Event_Connector_T::topic_name - " + "DDS up and running for topic <%C>.\n", + topic_name)); + } + else + { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO + "DDS_Event_Connector_T::topic_name - " + "DDS is down.\n")); + TopicBaseConnector::topic_name (topic_name); + } + } + else if (this->late_binded (topic_name)) { this->do_configuration_complete (); this->do_ccm_activate (); @@ -204,21 +253,24 @@ DDS_Event_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::do_configuration_com { DDS4CCM_TRACE ("DDS_Event_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::do_configuration_complete"); - TopicBaseConnector::configuration_complete (); + typename CCM_TYPE::push_consumer_traits::data_listener_type::_var_type + push_consumer_data_listener = + this->context_->get_connection_push_consumer_data_listener (); - typename CCM_TYPE::push_consumer_traits::data_listener_type::_var_type push_consumer_data_listener = - this->context_->get_connection_push_consumer_data_listener (); this->push_consumer_obtained_ |= ! ::CORBA::is_nil (push_consumer_data_listener.in ()); - ::CCM_DDS::PortStatusListener_var push_consumer_psl = this->context_->get_connection_push_consumer_status (); this->push_consumer_obtained_ |= ! ::CORBA::is_nil (push_consumer_psl.in ()); + this->init_subscriber_ |= this->push_consumer_obtained_; ::CCM_DDS::PortStatusListener_var pull_consumer_psl = this->context_->get_connection_pull_consumer_status (); this->pull_consumer_obtained_ |= ! ::CORBA::is_nil (pull_consumer_psl.in ()); + this->init_subscriber_ |= this->pull_consumer_obtained_; + + TopicBaseConnector::configuration_complete (); if (this->push_consumer_obtained_) { @@ -443,12 +495,12 @@ DDS_Event_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::ccm_passivate (void) } } + template <typename CCM_TYPE, typename DDS_TYPE, bool FIXED, typename SEQ_TYPE> void -DDS_Event_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::ccm_remove (void) +DDS_Event_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::do_ccm_remove (void) { - DDS4CCM_TRACE ("DDS_Event_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::ccm_remove"); - + DDS4CCM_TRACE ("DDS_Event_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::do_ccm_remove"); try { if (ACE_OS::strlen (this->topic_name_) != 0) @@ -475,7 +527,7 @@ DDS_Event_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::ccm_remove (void) DDS4CCM_PRINT_INTERNAL_EXCEPTION ( DDS4CCM_LOG_LEVEL_ERROR, ::CIAO::DDS4CCM::translate_retcode (ex.error_code), - "DDS_Event_Connector_T::ccm_remove"); + "DDS_Event_Connector_T::do_ccm_remove"); throw ::CORBA::INTERNAL (); } catch (const ::CORBA::Exception& ex) @@ -483,14 +535,37 @@ DDS_Event_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::ccm_remove (void) DDS4CCM_PRINT_CORBA_EXCEPTION ( DDS4CCM_LOG_LEVEL_ERROR, ex, - "DDS_Event_Connector_T::ccm_remove"); + "DDS_Event_Connector_T::do_ccm_remove"); throw; } catch (...) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO - "DDS_Event_Connector_T::ccm_remove - " + "DDS_Event_Connector_T::do_ccm_remove - " "Caught unexpected exception.\n")); throw ::CORBA::INTERNAL (); } } + +template <typename CCM_TYPE, typename DDS_TYPE, bool FIXED, typename SEQ_TYPE> +void +DDS_Event_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::ccm_remove (void) +{ + DDS4CCM_TRACE ("DDS_Event_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::ccm_remove"); + if (this->push_consumer_obtained_) + { + this->push_consumer_.set_component (::CORBA::Object::_nil ()); + } + + if (this->supplier_obtained_) + { + this->supplier_.set_component (::CORBA::Object::_nil ()); + } + + if (this->pull_consumer_obtained_) + { + this->pull_consumer_.set_component (::CORBA::Object::_nil ()); + } + + this->do_ccm_remove (); +} diff --git a/CIAO/connectors/dds4ccm/impl/DDS_Event_Connector_T.h b/CIAO/connectors/dds4ccm/impl/DDS_Event_Connector_T.h index 53436c30d26..d4ee38981ac 100644 --- a/CIAO/connectors/dds4ccm/impl/DDS_Event_Connector_T.h +++ b/CIAO/connectors/dds4ccm/impl/DDS_Event_Connector_T.h @@ -123,6 +123,7 @@ private: void do_configuration_complete (void); void do_ccm_activate (void); + void do_ccm_remove (void); typedef DDS_TopicBase_Connector_T<CCM_TYPE, DDS_TYPE, SEQ_TYPE> TopicBaseConnector; }; diff --git a/CIAO/connectors/dds4ccm/impl/DDS_Get_T.cpp b/CIAO/connectors/dds4ccm/impl/DDS_Get_T.cpp index 30fe30dd841..3837ed218ec 100644 --- a/CIAO/connectors/dds4ccm/impl/DDS_Get_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/DDS_Get_T.cpp @@ -45,7 +45,6 @@ DDS_Get_T<CCM_TYPE, TYPED_DDS_READER, VALUE_TYPE, SEQ_VALUE_TYPE, FIXED>::remove { DDS4CCM_TRACE ("DDS_Get_T<CCM_TYPE, TYPED_DDS_READER, VALUE_TYPE, SEQ_VALUE_TYPE, FIXED>::remove"); SubscriberBase_type::remove (subscriber); - this->dds_get_->_set_component (::CORBA::Object::_nil ()); } template <typename CCM_TYPE, typename TYPED_DDS_READER, typename VALUE_TYPE, typename SEQ_VALUE_TYPE, bool FIXED> diff --git a/CIAO/connectors/dds4ccm/impl/DDS_Get_T.h b/CIAO/connectors/dds4ccm/impl/DDS_Get_T.h index 7b670374730..5ec5598f196 100644 --- a/CIAO/connectors/dds4ccm/impl/DDS_Get_T.h +++ b/CIAO/connectors/dds4ccm/impl/DDS_Get_T.h @@ -35,8 +35,7 @@ public: ::DDS::Subscriber_ptr subscriber, const char * qos_profile); - void remove ( - ::DDS::Subscriber_ptr subscriber); + void remove (::DDS::Subscriber_ptr subscriber); private: typedef DDS_Subscriber_Base_T<CCM_TYPE, TYPED_DDS_READER, VALUE_TYPE, SEQ_VALUE_TYPE> diff --git a/CIAO/connectors/dds4ccm/impl/DDS_Listen_T.cpp b/CIAO/connectors/dds4ccm/impl/DDS_Listen_T.cpp index d6b6fb93c6f..d96d926e7a3 100644 --- a/CIAO/connectors/dds4ccm/impl/DDS_Listen_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/DDS_Listen_T.cpp @@ -81,8 +81,6 @@ DDS_Listen_T<CCM_TYPE, TYPED_DDS_READER, VALUE_TYPE, SEQ_VALUE_TYPE>::remove ( { DDS4CCM_TRACE ("DDS_Listen_T<CCM_TYPE, TYPED_DDS_READER, VALUE_TYPE, SEQ_VALUE_TYPE>::remove"); - this->data_control_->_set_component (::CORBA::Object::_nil ()); - SubscriberBase_type::remove (subscriber); } diff --git a/CIAO/connectors/dds4ccm/impl/DDS_StateListen_T.cpp b/CIAO/connectors/dds4ccm/impl/DDS_StateListen_T.cpp index 3f617c44643..62eb3c5db87 100644 --- a/CIAO/connectors/dds4ccm/impl/DDS_StateListen_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/DDS_StateListen_T.cpp @@ -82,7 +82,6 @@ DDS_StateListen_T<CCM_TYPE, TYPED_DDS_READER, VALUE_TYPE, SEQ_VALUE_TYPE>::remov { DDS4CCM_TRACE ("DDS_StateListen_T<CCM_TYPE, TYPED_DDS_READER, VALUE_TYPE, SEQ_VALUE_TYPE>::remove"); - this->data_control_->_set_component (::CORBA::Object::_nil ()); SubscriberBase_type::remove (subscriber); } diff --git a/CIAO/connectors/dds4ccm/impl/DDS_State_Connector_T.cpp b/CIAO/connectors/dds4ccm/impl/DDS_State_Connector_T.cpp index 7869391559c..ee278dd36fd 100644 --- a/CIAO/connectors/dds4ccm/impl/DDS_State_Connector_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/DDS_State_Connector_T.cpp @@ -34,6 +34,7 @@ DDS_State_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::get_observable_data this->observable_obtained_ = true; this->observable_.set_component (this); + this->init_publisher_ |= this->observable_obtained_; return this->observable_.get_data (); } @@ -45,6 +46,7 @@ DDS_State_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::get_observable_dds_e this->observable_obtained_ = true; this->observable_.set_component (this); + this->init_publisher_ |= this->observable_obtained_; return this->observable_.get_dds_entity (); } @@ -56,6 +58,7 @@ DDS_State_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::get_passive_observer this->passive_observer_obtained_ = true; this->passive_observer_.set_component (this); + this->init_subscriber_ |= this->passive_observer_obtained_; return this->passive_observer_.get_data (); } @@ -67,6 +70,7 @@ DDS_State_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::get_passive_observer this->passive_observer_obtained_ = true; this->passive_observer_.set_component (this); + this->init_subscriber_ |= this->passive_observer_obtained_; return this->passive_observer_.get_dds_entity (); } @@ -78,6 +82,7 @@ DDS_State_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::get_passive_observer this->passive_observer_obtained_ = true; this->passive_observer_.set_component (this); + this->init_subscriber_ |= this->passive_observer_obtained_; return this->passive_observer_.get_filter_config (); } @@ -108,6 +113,7 @@ DDS_State_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::get_pull_observer_da this->pull_observer_obtained_ = true; this->pull_observer_.set_component (this); + this->init_subscriber_ |= this->pull_observer_obtained_; return this->pull_observer_.get_data (); } @@ -119,6 +125,7 @@ DDS_State_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::get_pull_observer_fr this->pull_observer_obtained_ = true; this->pull_observer_.set_component (this); + this->init_subscriber_ |= this->pull_observer_obtained_; return this->pull_observer_.get_fresh_data (); } @@ -130,6 +137,7 @@ DDS_State_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::get_pull_observer_dd this->pull_observer_obtained_ = true; this->pull_observer_.set_component (this); + this->init_subscriber_ |= this->pull_observer_obtained_; return this->pull_observer_.get_dds_entity (); } @@ -141,6 +149,7 @@ DDS_State_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::get_pull_observer_fi this->pull_observer_obtained_ = true; this->pull_observer_.set_component (this); + this->init_subscriber_ |= this->pull_observer_obtained_; return this->pull_observer_.get_filter_config (); } @@ -171,6 +180,7 @@ DDS_State_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::get_push_observer_da this->push_observer_obtained_ = true; this->push_observer_.set_component (this); + this->init_subscriber_ |= this->push_observer_obtained_; return this->push_observer_.get_data (); } @@ -182,6 +192,7 @@ DDS_State_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::get_push_observer_da this->push_observer_obtained_ = true; this->push_observer_.set_component (this); + this->init_subscriber_ |= this->push_observer_obtained_; return this->push_observer_.get_data_control (); } @@ -193,6 +204,7 @@ DDS_State_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::get_push_observer_dd this->push_observer_obtained_ = true; this->push_observer_.set_component (this); + this->init_subscriber_ |= this->push_observer_obtained_; return this->push_observer_.get_dds_entity (); } @@ -204,6 +216,7 @@ DDS_State_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::get_push_observer_fi this->push_observer_obtained_ = true; this->push_observer_.set_component (this); + this->init_subscriber_ |= this->push_observer_obtained_; return this->push_observer_.get_filter_config (); } @@ -234,6 +247,7 @@ DDS_State_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::get_push_state_obser this->push_state_observer_obtained_ = true; this->push_state_observer_.set_component (this); + this->init_subscriber_ |= this->push_state_observer_obtained_; return this->push_state_observer_.get_data (); } @@ -245,6 +259,7 @@ DDS_State_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::get_push_state_obser this->push_state_observer_obtained_ = true; this->push_state_observer_.set_component (this); + this->init_subscriber_ |= this->push_state_observer_obtained_; return this->push_state_observer_.get_data_control (); } @@ -256,6 +271,7 @@ DDS_State_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::get_push_state_obser this->push_state_observer_obtained_ = true; this->push_state_observer_.set_component (this); + this->init_subscriber_ |= this->push_state_observer_obtained_; return this->push_state_observer_.get_dds_entity (); } @@ -267,6 +283,7 @@ DDS_State_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::get_push_state_obser this->push_state_observer_obtained_ = true; this->push_state_observer_.set_component (this); + this->init_subscriber_ |= this->push_state_observer_obtained_; return this->push_state_observer_.get_filter_config (); } @@ -296,7 +313,45 @@ DDS_State_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::topic_name ( { DDS4CCM_TRACE ("DDS_State_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::topic_name"); - if (this->late_binded (topic_name)) + if (this->stop_dds (topic_name)) + { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO + "DDS_State_Connector_T::topic_name - " + "Stopping DDS=>switching to new topic <%C>.\n", + topic_name)); + this->ccm_passivate (); + this->do_ccm_remove (); + + if (ACE_OS::strlen (topic_name) > 0) + { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO + "DDS_State_Connector_T::topic_name - " + "DDS is down. Setting new to <%C>.\n", + topic_name)); + + TopicBaseConnector::topic_name (topic_name); + + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO + "DDS_State_Connector_T::topic_name - " + "Initialize DDS again for topic <%C>.\n", + topic_name)); + + this->do_configuration_complete (); + this->do_ccm_activate (); + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO + "DDS_State_Connector_T::topic_name - " + "DDS up and running for topic <%C>.\n", + topic_name)); + } + else + { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO + "DDS_Event_Connector_T::topic_name - " + "DDS is down.\n")); + TopicBaseConnector::topic_name (topic_name); + } + } + else if (this->late_binded (topic_name)) { this->do_configuration_complete (); this->do_ccm_activate (); @@ -318,14 +373,13 @@ DDS_State_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::do_configuration_com { DDS4CCM_TRACE ("DDS_State_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::do_configuration_complete"); - TopicBaseConnector::configuration_complete (); - ::CCM_DDS::PortStatusListener_var push_observer_psl = this->context_->get_connection_push_observer_status (); typename CCM_TYPE::push_observer_traits::data_listener_type::_var_type push_observer_dl = this->context_->get_connection_push_observer_data_listener (); this->push_observer_obtained_ |= ! ::CORBA::is_nil (push_observer_psl.in ()); this->push_observer_obtained_ |= ! ::CORBA::is_nil (push_observer_dl.in ()); + this->init_subscriber_ |= this->push_observer_obtained_; ::CCM_DDS::PortStatusListener_var push_state_observer_psl = this->context_->get_connection_push_state_observer_status (); @@ -333,14 +387,19 @@ DDS_State_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::do_configuration_com this->context_->get_connection_push_state_observer_data_listener (); this->push_state_observer_obtained_ |= ! ::CORBA::is_nil (push_state_observer_psl.in ()); this->push_state_observer_obtained_ |= ! ::CORBA::is_nil (push_state_observer_dl.in ()); + this->init_subscriber_ |= this->push_state_observer_obtained_; ::CCM_DDS::PortStatusListener_var pull_observer_psl = this->context_->get_connection_pull_observer_status (); this->pull_observer_obtained_ |= ! ::CORBA::is_nil (pull_observer_psl.in ()); + this->init_subscriber_ |= this->pull_observer_obtained_; ::CCM_DDS::PortStatusListener_var passive_observer_psl = this->context_->get_connection_passive_observer_status (); this->passive_observer_obtained_ |= ! ::CORBA::is_nil (passive_observer_psl.in ()); + this->init_subscriber_ |= this->passive_observer_obtained_; + + TopicBaseConnector::configuration_complete (); if (this->observable_obtained_) { @@ -587,10 +646,9 @@ DDS_State_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::ccm_passivate (void) template <typename CCM_TYPE, typename DDS_TYPE, bool FIXED, typename SEQ_TYPE> void -DDS_State_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::ccm_remove (void) +DDS_State_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::do_ccm_remove (void) { - DDS4CCM_TRACE ("DDS_State_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::ccm_remove"); - + DDS4CCM_TRACE ("DDS_State_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::do_ccm_remove"); try { if (ACE_OS::strlen (this->topic_name_) != 0) @@ -627,7 +685,7 @@ DDS_State_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::ccm_remove (void) DDS4CCM_PRINT_INTERNAL_EXCEPTION ( DDS4CCM_LOG_LEVEL_ERROR, ::CIAO::DDS4CCM::translate_retcode (ex.error_code), - "DDS_State_Connector_T::ccm_remove"); + "DDS_State_Connector_T::do_ccm_remove"); throw ::CORBA::INTERNAL (); } catch (const ::CORBA::Exception& ex) @@ -635,15 +693,49 @@ DDS_State_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::ccm_remove (void) DDS4CCM_PRINT_CORBA_EXCEPTION ( DDS4CCM_LOG_LEVEL_ERROR, ex, - "DDS_State_Connector_T::ccm_remove"); + "DDS_State_Connector_T::do_ccm_remove"); throw; } catch (...) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO - "DDS_State_Connector_T::ccm_remove - " + "DDS_State_Connector_T::do_ccm_remove - " "Caught unexpected exception.\n")); throw ::CORBA::INTERNAL (); } } +template <typename CCM_TYPE, typename DDS_TYPE, bool FIXED, typename SEQ_TYPE> +void +DDS_State_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::ccm_remove (void) +{ + DDS4CCM_TRACE ("DDS_State_Connector_T<CCM_TYPE, DDS_TYPE, FIXED, SEQ_TYPE>::ccm_remove"); + + if (this->observable_obtained_) + { + this->observable_.set_component (::CORBA::Object::_nil ()); + } + + if (this->push_observer_obtained_) + { + this->push_observer_.set_component (::CORBA::Object::_nil ()); + } + + if (this->push_state_observer_obtained_) + { + this->push_state_observer_.set_component (::CORBA::Object::_nil ()); + } + + if (this->pull_observer_obtained_) + { + this->pull_observer_.set_component (::CORBA::Object::_nil ()); + } + + if (this->passive_observer_obtained_) + { + this->passive_observer_.set_component (::CORBA::Object::_nil ()); + } + + this->do_ccm_remove (); +} + diff --git a/CIAO/connectors/dds4ccm/impl/DDS_State_Connector_T.h b/CIAO/connectors/dds4ccm/impl/DDS_State_Connector_T.h index c67badb0454..b27b8f2887d 100644 --- a/CIAO/connectors/dds4ccm/impl/DDS_State_Connector_T.h +++ b/CIAO/connectors/dds4ccm/impl/DDS_State_Connector_T.h @@ -199,6 +199,7 @@ private: void do_configuration_complete (void); void do_ccm_activate (void); + void do_ccm_remove (void); typedef DDS_TopicBase_Connector_T<CCM_TYPE, DDS_TYPE, SEQ_TYPE> TopicBaseConnector; }; diff --git a/CIAO/connectors/dds4ccm/impl/DDS_Subscriber_Base_T.cpp b/CIAO/connectors/dds4ccm/impl/DDS_Subscriber_Base_T.cpp index cd08bf48d8b..3d95f4f60bc 100644 --- a/CIAO/connectors/dds4ccm/impl/DDS_Subscriber_Base_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/DDS_Subscriber_Base_T.cpp @@ -208,7 +208,6 @@ DDS_Subscriber_Base_T<CCM_TYPE, TYPED_DDS_READER, VALUE_TYPE, SEQ_VALUE_TYPE>::r } } this->cft_setting_->delete_contentfilteredtopic (subscriber); - this->dds_read_->_set_component (::CORBA::Object::_nil ()); this->dds_read_->set_dds_reader (::DDS::DataReader::_nil (), 0); this->condition_manager_.set_dds_entity (::DDS::DataReader::_nil ()); diff --git a/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.cpp b/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.cpp index d4cac2fb147..27f575acf07 100644 --- a/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.cpp @@ -7,6 +7,8 @@ template <typename CCM_TYPE, typename DDS_TYPE, typename SEQ_TYPE> DDS_TopicBase_Connector_T<CCM_TYPE, DDS_TYPE, SEQ_TYPE>::DDS_TopicBase_Connector_T (void) : BaseConnector () + , init_subscriber_ (false) + , init_publisher_(false) , late_binding_ (false) { } @@ -32,6 +34,27 @@ DDS_TopicBase_Connector_T<CCM_TYPE, DDS_TYPE, SEQ_TYPE>::late_binding (bool late this->late_binding_ |= late_binding; } + +template <typename CCM_TYPE, typename DDS_TYPE, typename SEQ_TYPE> +bool +DDS_TopicBase_Connector_T<CCM_TYPE, DDS_TYPE, SEQ_TYPE>::stop_dds ( + const char * topic_name) +{ + DDS4CCM_TRACE ("DDS_TopicBase_Connector_T<CCM_TYPE, DDS_TYPE, SEQ_TYPE>::stop_dds"); + + if (!::CORBA::is_nil (this->topic_name_.in ())) + { //topic name already set + // do not stop DDS when topic names are equal + if (ACE_OS::strlen (this->topic_name_.in ()) == 0) + return false; + return ACE_OS::strcmp (this->topic_name_.in (), topic_name) != 0; + } + else + { //topic is not set + return false; + } +} + template <typename CCM_TYPE, typename DDS_TYPE, typename SEQ_TYPE> bool DDS_TopicBase_Connector_T<CCM_TYPE, DDS_TYPE, SEQ_TYPE>::late_binded ( @@ -41,27 +64,23 @@ DDS_TopicBase_Connector_T<CCM_TYPE, DDS_TYPE, SEQ_TYPE>::late_binded ( this->late_binding (ACE_OS::strlen (topic_name) == 0); - if (this->late_binding () && - ACE_OS::strlen (topic_name) > 0 && + if (ACE_OS::strlen (topic_name) > 0 && + !CORBA::is_nil (this->topic_name_) && ACE_OS::strlen (this->topic_name_.in ()) == 0) { DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO ACE_TEXT ("DDS_TopicBase_Connector_T::late_binded - ") - ACE_TEXT ("Topic %C is late binded.\n"), topic_name)); + ACE_TEXT ("Topic <%C> is late binded.\n"), topic_name)); DDS_TopicBase_Connector_T::topic_name (topic_name); return true; } - else if (this->configuration_complete_) - { - throw ::CCM_DDS::NonChangeable (); - } - else + else if (!this->configuration_complete_) { - DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO - ACE_TEXT ("DDS_TopicBase_Connector_T::late_binded - ") - ACE_TEXT ("Topic %C is not late binded.\n"), topic_name)); DDS_TopicBase_Connector_T::topic_name (topic_name); } + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO + ACE_TEXT ("DDS_TopicBase_Connector_T::late_binded - ") + ACE_TEXT ("Topic <%C> is not late binded.\n"), topic_name)); return false; } @@ -80,19 +99,45 @@ DDS_TopicBase_Connector_T<CCM_TYPE, DDS_TYPE, SEQ_TYPE>::configuration_complete typesupport_name = type.get_type_name (); #endif + ::CCM_DDS::ConnectorStatusListener_var error_listener = + this->context_->get_connection_error_listener (); + this->init_subscriber_ |= ! ::CORBA::is_nil (error_listener.in ()); + this->init_publisher_ |= ! ::CORBA::is_nil (error_listener.in ()); + if (::CORBA::is_nil (this->topic_.in ())) { this->register_type (this->domain_participant_.in (), typesupport_name); + this->init_topic (this->domain_participant_.in (), this->topic_.inout () , this->topic_name_.in (), typesupport_name.in ()); } - this->init_subscriber (this->domain_participant_.in (), - this->subscriber_.inout ()); - this->init_publisher (this->domain_participant_.in (), - this->publisher_.inout ()); + + if (this->init_subscriber_) + { + this->init_subscriber (this->domain_participant_.in (), + this->subscriber_.inout ()); + } + else + { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO + "DDS_TopicBase_Connector_T::configuration_complete - " + "No need to create a subscriber.\n")); + } + + if (this->init_publisher_) + { + this->init_publisher (this->domain_participant_.in (), + this->publisher_.inout ()); + } + else + { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO + "DDS_TopicBase_Connector_T::configuration_complete - " + "No need to create a publisher.\n")); + } } template <typename CCM_TYPE, typename DDS_TYPE, typename SEQ_TYPE> @@ -106,12 +151,18 @@ DDS_TopicBase_Connector_T<CCM_TYPE, DDS_TYPE, SEQ_TYPE>::ccm_activate (void) this->activate_topic (reactor, this->topic_.in (), this->topiclistener_.inout ()); - this->activate_subscriber (reactor, - this->subscriber_.in (), - this->subscriber_listener_.inout ()); - this->activate_publisher (reactor, - this->publisher_.in (), - this->publisher_listener_.inout ()); + if (this->init_subscriber_) + { + this->activate_subscriber (reactor, + this->subscriber_.in (), + this->subscriber_listener_.inout ()); + } + if (this->init_publisher_) + { + this->activate_publisher (reactor, + this->publisher_.in (), + this->publisher_listener_.inout ()); + } } template <typename CCM_TYPE, typename DDS_TYPE, typename SEQ_TYPE> diff --git a/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.h b/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.h index a42b39d00a3..61900d21086 100644 --- a/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.h +++ b/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.h @@ -43,6 +43,7 @@ protected: bool late_binding (void); void late_binding (bool late_binding); bool late_binded (const char * topic_name); + bool stop_dds (const char * topic_name); CORBA::String_var topic_name_; DDS::StringSeq key_fields_; @@ -55,6 +56,9 @@ protected: ::DDS::Subscriber_var subscriber_; ::DDS::SubscriberListener_var subscriber_listener_; + bool init_subscriber_; + bool init_publisher_; + typedef DDS_Base_Connector_T<CCM_TYPE> BaseConnector; #if (CIAO_DDS4CCM_NDDS==1) diff --git a/CIAO/connectors/dds4ccm/impl/DDS_Update_T.cpp b/CIAO/connectors/dds4ccm/impl/DDS_Update_T.cpp index 87e38a86c9b..3277146a1bd 100644 --- a/CIAO/connectors/dds4ccm/impl/DDS_Update_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/DDS_Update_T.cpp @@ -126,7 +126,6 @@ DDS_Update_T<CCM_TYPE, TYPED_WRITER, VALUE_TYPE, SEQ_VALUE_TYPE>::remove ( ::CIAO::DDS4CCM::translate_retcode (retval))); throw ::CORBA::INTERNAL (); } - this->dds_update_->_set_component (::CORBA::Object::_nil ()); this->dds_update_->set_dds_writer (::DDS::DataWriter::_nil ()); this->ccm_data_writer_->set_dds_entity (::DDS::DataWriter::_nil ()); } diff --git a/CIAO/connectors/dds4ccm/impl/DDS_Write_T.cpp b/CIAO/connectors/dds4ccm/impl/DDS_Write_T.cpp index 5f6ab877bf6..c892fffe610 100644 --- a/CIAO/connectors/dds4ccm/impl/DDS_Write_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/DDS_Write_T.cpp @@ -89,6 +89,7 @@ DDS_Write_T<CCM_TYPE, TYPED_WRITER, VALUE_TYPE, SEQ_VALUE_TYPE>::configuration_c this->ccm_data_writer_->set_dds_entity (dwv_tmp.in ()); } } + template <typename CCM_TYPE, typename TYPED_WRITER, typename VALUE_TYPE, typename SEQ_VALUE_TYPE> void DDS_Write_T<CCM_TYPE, TYPED_WRITER, VALUE_TYPE, SEQ_VALUE_TYPE>::activate () @@ -118,7 +119,6 @@ DDS_Write_T<CCM_TYPE, TYPED_WRITER, VALUE_TYPE, SEQ_VALUE_TYPE>::remove ( if (retcode == ::DDS::RETCODE_OK) { - this->dds_write_->_set_component (::CORBA::Object::_nil ()); this->dds_write_->set_dds_writer (::DDS::DataWriter::_nil ()); this->ccm_data_writer_->set_dds_entity (::DDS::DataWriter::_nil ()); } diff --git a/CIAO/connectors/dds4ccm/impl/Getter_T.cpp b/CIAO/connectors/dds4ccm/impl/Getter_T.cpp index e2e9a77b862..13e5d5bda95 100644 --- a/CIAO/connectors/dds4ccm/impl/Getter_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/Getter_T.cpp @@ -295,7 +295,7 @@ namespace CIAO } // Check which conditions have triggered the wait method to 'wake up'. - for (::CORBA::ULong i = 0; i < active_conditions.length(); i++) + for (::CORBA::ULong i = 0; i < active_conditions.length(); ++i) { // Check whether this condition is the one we were waiting for. if (this->condition_manager_->check_condition (active_conditions[i].in ())) @@ -398,7 +398,7 @@ namespace CIAO ::DDS::SampleInfoSeq sample_info; SEQ_VALUE_TYPE data; // Check which conditions have triggered the wait method to 'wake up'. - for (::CORBA::ULong i = 0; i < active_conditions.length(); i++) + for (::CORBA::ULong i = 0; i < active_conditions.length(); ++i) { // Check whether this condition is the one we were waiting for. if (this->condition_manager_->check_condition (active_conditions[i].in ())) diff --git a/CIAO/connectors/dds4ccm/impl/Reader_T.cpp b/CIAO/connectors/dds4ccm/impl/Reader_T.cpp index 7594a282110..04141dc73ed 100644 --- a/CIAO/connectors/dds4ccm/impl/Reader_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/Reader_T.cpp @@ -28,6 +28,8 @@ namespace CIAO const VALUE_TYPE& an_instance, DDS_INSTANCE_HANDLE_T_IN instance_handle) { + DDS4CCM_TRACE ("Reader_T::check_handle"); + ::DDS::InstanceHandle_t const lookup_hnd = this->dds_reader ()->lookup_instance (an_instance); @@ -41,6 +43,8 @@ namespace CIAO const ::DDS::SampleInfoSeq& sample_infos, const bool determine_last) { + DDS4CCM_TRACE ("Reader_T::get_nr_valid_samples"); + CORBA::ULong nr_of_samples = 0; if (determine_last) { @@ -74,6 +78,8 @@ namespace CIAO ::CCM_DDS::ReadInfoSeq& infos, const ::DDS::SampleInfoSeq & sample_info) { + DDS4CCM_TRACE ("Reader_T::convert_data"); + CORBA::ULong samples_to_return = this->get_nr_valid_samples (sample_info, false); infos.length (samples_to_return); @@ -133,6 +139,7 @@ namespace CIAO ::DDS::QueryCondition_ptr qc) { DDS4CCM_TRACE ("Reader_T::read_wo_instance"); + ::DDS::ReturnCode_t retval = ::DDS::RETCODE_ERROR; if (! ::CORBA::is_nil (qc)) @@ -174,6 +181,8 @@ namespace CIAO ::DDS::SampleInfoSeq sample_info, bool throw_exception) { + DDS4CCM_TRACE ("Reader_T::return_loan"); + // Return the loan ::DDS::ReturnCode_t const retval = this->dds_reader ()->return_loan (data, sample_info); @@ -196,6 +205,8 @@ namespace CIAO SEQ_VALUE_TYPE& instances, ::CCM_DDS::ReadInfoSeq& infos) { + DDS4CCM_TRACE ("Reader_T::read_last"); + // This function has to return the last sample of all instances ::DDS::SampleInfoSeq sample_info; SEQ_VALUE_TYPE data; @@ -229,6 +240,8 @@ namespace CIAO SEQ_VALUE_TYPE& instances, ::CCM_DDS::ReadInfoSeq& infos) { + DDS4CCM_TRACE ("Reader_T::read_all"); + // This function has to return all samples of all instances ::DDS::SampleInfoSeq sample_info; SEQ_VALUE_TYPE data; @@ -249,6 +262,8 @@ namespace CIAO ::CCM_DDS::ReadInfo_out info, DDS_INSTANCE_HANDLE_T_IN instance_handle) { + DDS4CCM_TRACE ("Reader_T::read_one_last"); + ::DDS::InstanceHandle_t const lookup_hnd = this->check_handle (an_instance, instance_handle); @@ -287,6 +302,8 @@ namespace CIAO ::CCM_DDS::ReadInfoSeq& infos, DDS_INSTANCE_HANDLE_T_IN instance_handle) { + DDS4CCM_TRACE ("Reader_T::read_one_all"); + ::DDS::InstanceHandle_t const lookup_hnd = this->check_handle (an_instance, instance_handle); @@ -305,6 +322,7 @@ namespace CIAO Reader_T<READER_TYPE, TYPED_DDS_READER, VALUE_TYPE, SEQ_VALUE_TYPE>::query (void) { DDS4CCM_TRACE ("Reader_T::query"); + return this->condition_manager_->query (); } @@ -325,6 +343,7 @@ namespace CIAO ConditionManager * condition_manager) { DDS4CCM_TRACE ("Reader_T::set_dds_reader"); + this->dds_reader_ = TYPED_DDS_READER::_narrow (dr); if (!::CORBA::is_nil (dr) && ::CORBA::is_nil (this->dds_reader_.in ())) { diff --git a/CIAO/connectors/dds4ccm/impl/dds4ccm_impl.mpc b/CIAO/connectors/dds4ccm/impl/dds4ccm_impl.mpc index 9a92fee139a..f6cdb899543 100644 --- a/CIAO/connectors/dds4ccm/impl/dds4ccm_impl.mpc +++ b/CIAO/connectors/dds4ccm/impl/dds4ccm_impl.mpc @@ -27,4 +27,8 @@ project(CIAO_DDS4CCM_DDS_Impl) : install, dds4ccm_skel, dds4ccm_lem_stub, taolib TopicListener.cpp Utils.cpp } + + specific { + install_dir = connectors/dds4ccm/impl + } } diff --git a/CIAO/connectors/dds4ccm/impl/logger/Log_Macros.h b/CIAO/connectors/dds4ccm/impl/logger/Log_Macros.h index 727cadda94c..914f9f3119e 100644 --- a/CIAO/connectors/dds4ccm/impl/logger/Log_Macros.h +++ b/CIAO/connectors/dds4ccm/impl/logger/Log_Macros.h @@ -65,8 +65,8 @@ extern DDS4CCM_Logger_Export unsigned int DDS4CCM_debug_level; #if defined (DDS4CCM_NLOGGING) # define DDS4CCM_ERROR(L, X) do {} while (0) # define DDS4CCM_DEBUG(L, X) do {} while (0) -# define DDS4CCM_PRINT_INTERNAL_EXCEPTION (L, E, X) do {} while (0) -# define DDS4CCM_PRINT_CORBA_EXCEPTION (L, E, X) do {} while (0) +# define DDS4CCM_PRINT_INTERNAL_EXCEPTION(L, E, X) do {} while (0) +# define DDS4CCM_PRINT_CORBA_EXCEPTION(L, E, X) do {} while (0) # define DDS4CCM_ERROR_RETURN(L, X, Y) return (Y) # define DDS4CCM_ERROR_BREAK(L, X) { break; } #else @@ -82,6 +82,7 @@ extern DDS4CCM_Logger_Export unsigned int DDS4CCM_debug_level; } \ } while (0) # endif + # if !defined (DDS4CCM_DEBUG) # define DDS4CCM_DEBUG(L, X) \ do { \ diff --git a/CIAO/connectors/dds4ccm/impl/logger/dds4ccm_logger.mpc b/CIAO/connectors/dds4ccm/impl/logger/dds4ccm_logger.mpc index d6589d70acb..58d78a63dba 100644 --- a/CIAO/connectors/dds4ccm/impl/logger/dds4ccm_logger.mpc +++ b/CIAO/connectors/dds4ccm/impl/logger/dds4ccm_logger.mpc @@ -15,5 +15,9 @@ project(DDS4CCM_Logger): install, ciao_lib, taolib, acelib { Logger_Service.h Log_Macros.h } + + specific { + install_dir = connectors/dds4ccm/impl/logger + } } diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipant.cpp b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipant.cpp index 00248ecdc41..942c7b1419f 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipant.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipant.cpp @@ -484,7 +484,9 @@ namespace CIAO { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_DDS_NIL_RETURN, (LM_ERROR, DDS4CCM_INFO "DDS_DomainParticipant_i::create_topic - " - "Error: RTI DDS returned a nil topic\n")); + "Error: RTI DDS returned a nil topic " + "with name <%C> and type <%C>\n", + impl_name, type_name)); delete ccm_dds_tl; return ::DDS::Topic::_nil (); } @@ -496,7 +498,7 @@ namespace CIAO DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_INFO, DDS4CCM_INFO "DDS_DomainParticipant_i::create_topic - " - "Successfully created topic with name %C and type %C\n", + "Successfully created topic with name <%C> and type <%C>\n", impl_name, type_name)); DPMANAGER->add_topic (this->rti_entity (), dds_tp); @@ -512,7 +514,7 @@ namespace CIAO { DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO "DDS_DomainParticipant_i::create_topic - " - "Re-using topic with name %C and type %C.\n", + "Re-using topic with name <%C> and type <%C>.\n", impl_name, type_name)); DPMANAGER->_inc_ref (this->rti_entity (), dds_tp); diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantManager.cpp b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantManager.cpp index 226333eea71..43c7b648f02 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantManager.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantManager.cpp @@ -241,6 +241,9 @@ namespace CIAO { if (iter->second->_ref_count () == 1) { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_UNIMP_ACTION, (LM_TRACE, DDS4CCM_INFO + "DomainParticipantManager::remove_participant - " + "Delete participant since ref_count is one. \n")); delete iter->second; // Save to remove from list @@ -248,12 +251,12 @@ namespace CIAO } else { + iter->second->_dec_ref (); DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_UNIMP_ACTION, (LM_TRACE, DDS4CCM_INFO "DomainParticipantManager::remove_participant - " "Don't delete participant since " - "it's still used - ref_count <%d>\n", + "it's still used - ref_count is still <%d>\n", iter->second->_ref_count ())); - iter->second->_dec_ref (); return false; } } diff --git a/CIAO/connectors/dds4ccm/impl/ndds/ndds_idltocpp.mpc b/CIAO/connectors/dds4ccm/impl/ndds/ndds_idltocpp.mpc index 6994be18eb2..677f9eba314 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/ndds_idltocpp.mpc +++ b/CIAO/connectors/dds4ccm/impl/ndds/ndds_idltocpp.mpc @@ -36,4 +36,8 @@ project(CIAO_DDS4CCM_DDS_NDDS) : install, ndds_idltocpp_stub, taolib, \ WaitSet.cpp Utils.cpp } + + specific { + install_dir = connectors/dds4ccm/impl/ndds + } } diff --git a/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/Base/Collocated_Base.idl b/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/Base/Collocated_Base.idl new file mode 100644 index 00000000000..7cf07c81a11 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/Base/Collocated_Base.idl @@ -0,0 +1,21 @@ +// $Id$ + +#ifndef COLLACATED_BASE_ +#define COLLACATED_BASE_ + +#pragma ndds typesupport "Base/Collocated_BaseSupport.h" +#pragma opendds typesupport "Base/Collocated_BaseTypeSupportImpl.h" + +#pragma DCPS_DATA_TYPE "CoPubSub::Test_msg" + +module CoPubSub { + struct Test_msg { + string hello; + long msgId; + }; + typedef sequence <Test_msg> Test_msgSeq; +}; + + +#endif // COLLACATED_BASE_ + diff --git a/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/Base/Collocated_Base.mpc b/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/Base/Collocated_Base.mpc new file mode 100644 index 00000000000..958f6ebbd66 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/Base/Collocated_Base.mpc @@ -0,0 +1,26 @@ +// $Id$ + +project (Collocated_Base_stub) : taoidldefaults, dds4ccm_ts_default { + sharedname = Collocated_Base_stub + dynamicflags += COLLACATED_BASE_STUB_BUILD_DLL + libout = ../lib + + idlflags += -SS -Sci \ + -Wb,stub_export_macro=COLLACATED_BASE_STUB_Export \ + -Wb,stub_export_include=Collocated_Base_stub_export.h + + IDL_Files { + idlflags += -Gxhst + Collocated_Base.idl + } + + opendds_ts_flags += --export=COLLACATED_BASE_STUB_Export + + DDSGenerator_Files { + Collocated_Base.idl + } + + Source_Files { + } +} + diff --git a/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/Connector/Collocated_Connector.idl b/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/Connector/Collocated_Connector.idl new file mode 100644 index 00000000000..e5083387d94 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/Connector/Collocated_Connector.idl @@ -0,0 +1,18 @@ +//$Id$ + +#ifndef COLLACATED_CONNECTOR_ +#define COLLACATED_CONNECTOR_ + +#include <Components.idl> +#include <ccm_dds.idl> + +#include "Base/Collocated_Base.idl" + +#pragma ciao lem "Connector/Collocated_ConnectorE.idl" + +module CoPubSub { + module CCM_DDS::Typed <Test_msg, Test_msgSeq> Test_conn; +}; + +#endif // COLLACATED_CONNECTOR_ + diff --git a/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/Connector/Collocated_Connector.mpc b/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/Connector/Collocated_Connector.mpc new file mode 100644 index 00000000000..a75a0b6274a --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/Connector/Collocated_Connector.mpc @@ -0,0 +1,147 @@ +// $Id$ + +project(Collocated_Connector_idl_gen) : connectoridldefaults, dds4ccm { + after += DDS4CCM_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=COLLACATED_CONNECTOR_STUB_Export \ + -Wb,stub_export_include=Collocated_Connector_stub_export.h \ + -Wb,skel_export_macro=COLLACATED_CONNECTOR_SVNT_Export \ + -Wb,skel_export_include=Collocated_Connector_svnt_export.h \ + -Wb,svnt_export_macro=COLLACATED_CONNECTOR_SVNT_Export \ + -Wb,svnt_export_include=Collocated_Connector_svnt_export.h \ + -Wb,conn_export_macro=COLLACATED_CONNECTOR_CONN_Export \ + -Wb,conn_export_include=Collocated_Connector_conn_export.h \ + -I .. + + IDL_Files { + Collocated_Connector.idl + } +} + +project(Collocated_Connector_lem_gen) : ciaoidldefaults, dds4ccm { + custom_only = 1 + after += Collocated_Connector_idl_gen + idlflags += -Wb,stub_export_macro=COLLACATED_CONNECTOR_LEM_STUB_Export \ + -Wb,stub_export_include=Collocated_Connector_lem_stub_export.h \ + -SS -Gxhst -Sci \ + -I .. + + IDL_Files { + Collocated_ConnectorE.idl + } +} + +project(Collocated_Connector_lem_stub) : ccm_svnt, dds4ccm_lem_stub { + after += Collocated_Connector_lem_gen Collocated_Connector_stub Collocated_Base_stub + libs += Collocated_Base_stub Collocated_Connector_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = Collocated_Connector_lem_stub + dynamicflags += COLLACATED_CONNECTOR_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Collocated_ConnectorEC.cpp + } + + Header_Files { + Collocated_ConnectorEC.h + Collocated_Connector_lem_stub_export.h + } + + Inline_Files { + Collocated_ConnectorEC.inl + } +} + +project(Collocated_Connector_stub) : ccm_stub, dds4ccm_base { + after += Collocated_Connector_idl_gen Collocated_Base_stub + libs += Collocated_Base_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = Collocated_Connector_stub + dynamicflags += COLLACATED_CONNECTOR_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Collocated_ConnectorC.cpp + } + + Header_Files { + Collocated_ConnectorC.h + Collocated_Connector_stub_export.h + } + + Inline_Files { + Collocated_ConnectorC.inl + } +} + +project(Collocated_Connector_exec) : ciao_executor, dds4ccm_impl { + after += Collocated_Connector_lem_stub Collocated_Connector_stub \ + Collocated_Base_stub + sharedname = Collocated_Connector_exec + libs += Collocated_Connector_stub Collocated_Connector_lem_stub \ + Collocated_Base_stub Collocated_Base_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += COLLACATED_CONNECTOR_CONN_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Collocated_Connector_conn.cpp + } + + Header_Files { + Collocated_Connector_conn.h + Collocated_Connector_conn_export.h + } + + Inline_Files { + } +} + + +project(Collocated_Connector_svnt) : ciao_servant, dds4ccm_impl { + after += Collocated_Connector_lem_stub \ + Collocated_Connector_exec \ + Collocated_Connector_stub + sharedname = Collocated_Connector_svnt + libs += Collocated_Connector_stub \ + Collocated_Connector_lem_stub \ + Collocated_Base_stub \ + Collocated_Connector_exec + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += COLLACATED_CONNECTOR_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Collocated_ConnectorS.cpp + Collocated_Connector_svnt.cpp + } + + Header_Files { + Collocated_ConnectorS.h + Collocated_Connector_svnt.h + Collocated_Connector_svnt_export.h + } + + Inline_Files { + Collocated_ConnectorS.inl + } +} + + diff --git a/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/PubSubComponent/PubSub_Component.idl b/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/PubSubComponent/PubSub_Component.idl new file mode 100644 index 00000000000..0615dec14df --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/PubSubComponent/PubSub_Component.idl @@ -0,0 +1,16 @@ +// $Id$ + +#ifndef PUBSUB_COMPONENT_ +#define PUBSUB_COMPONENT_ + +#include <Components.idl> +#include "Connector/Collocated_Connector.idl" + +module CoPubSub { + component PubSub_comp { + port Test_conn::DDS_Write TestPub; + port Test_conn::DDS_Listen TestSub; + }; +}; + +#endif // PUBSUB_COMPONENT_ diff --git a/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/PubSubComponent/PubSub_Component.mpc b/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/PubSubComponent/PubSub_Component.mpc new file mode 100644 index 00000000000..502644612a9 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/PubSubComponent/PubSub_Component.mpc @@ -0,0 +1,146 @@ +// $Id$ + +project(PubSubComponent_idl_gen) : componentidldefaults, dds4ccm { + after += Collocated_Connector_idl_gen DDS_Starter_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=PUBSUB_COMPONENT_STUB_Export \ + -Wb,stub_export_include=PubSub_Component_stub_export.h \ + -Wb,skel_export_macro=PUBSUB_COMPONENT_SVNT_Export \ + -Wb,skel_export_include=PubSub_Component_svnt_export.h \ + -Wb,svnt_export_macro=PUBSUB_COMPONENT_SVNT_Export \ + -Wb,svnt_export_include=PubSub_Component_svnt_export.h \ + -Wb,exec_export_macro=PUBSUB_COMPONENT_EXEC_Export \ + -Wb,exec_export_include=PubSub_Component_exec_export.h \ + -I .. + + IDL_Files { + PubSub_Component.idl + } +} + +project(PubSubComponent_lem_gen) : ciaoidldefaults, dds4ccm { + after += PubSubComponent_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=PUBSUB_COMPONENT_LEM_STUB_Export \ + -Wb,stub_export_include=PubSubComponent_lem_stub_export.h \ + -SS -Gxhst -I $CIAO_ROOT/connectors -I .. + + IDL_Files { + PubSub_ComponentE.idl + } +} + +project(PubSubComponent_lem_stub) : ccm_svnt, dds4ccm_base { + after += PubSubComponent_lem_gen PubSubComponent_stub \ + Collocated_Base_stub + libs += Collocated_Base_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = PubSub_Component_lem_stub + dynamicflags += PUBSUB_COMPONENT_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + PubSub_ComponentEC.cpp + } + + Header_Files { + PubSub_ComponentEC.h + PubSub_Component_lem_stub_export.h + } + + Inline_Files { + PubSub_ComponentEC.inl + } +} + +project(PubSubComponent_stub) : ccm_stub, dds4ccm_base { + after += PubSubComponent_idl_gen Collocated_Base_stub \ + Collocated_Connector_stub + libs += Collocated_Base_stub Collocated_Connector_stub + includes += .. + libpaths += ../lib + libout = ../lib + sharedname = PubSub_Component_stub + dynamicflags += PUBSUB_COMPONENT_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + PubSub_ComponentC.cpp + } + + Header_Files { + PubSub_ComponentC.h + PubSub_Component_stub_export.h + } + + Inline_Files { + PubSub_ComponentC.inl + } +} + +project(PubSubComponent_exec) : ciao_executor, dds4ccm_lem_stub { + after += PubSubComponent_lem_stub PubSubComponent_stub \ + Collocated_Connector_lem_stub Collocated_Connector_stub + sharedname = PubSub_Component_exec + libs += PubSub_Component_stub PubSub_Component_lem_stub Collocated_Base_stub \ + Collocated_Connector_lem_stub Collocated_Connector_stub + libpaths += ../lib + includes += .. + libout = ../lib + dynamicflags += PUBSUB_COMPONENT_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + PubSub_Component_exec.cpp + } + + Header_Files { + PubSub_Component_exec.h + PubSub_Component_exec_export.h + } + + Inline_Files { + } +} + + +project(PubSubComponent_svnt) : ciao_servant, dds4ccm_lem_stub, dds4ccm_skel { + after += Collocated_Base_stub PubSubComponent_lem_stub \ + Collocated_Connector_stub \ + Collocated_Connector_svnt Collocated_Connector_lem_stub + sharedname = PubSub_Component_svnt + libs += PubSub_Component_stub PubSub_Component_lem_stub Collocated_Base_stub \ + Collocated_Connector_stub Collocated_Connector_svnt \ + Collocated_Connector_lem_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += PUBSUB_COMPONENT_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + PubSub_ComponentS.cpp + PubSub_Component_svnt.cpp + } + + Header_Files { + PubSub_ComponentS.h + PubSub_Component_svnt.h + PubSub_Component_svnt_export.h + } + + Inline_Files { + PubSub_ComponentS.inl + } +} + diff --git a/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/PubSubComponent/PubSub_Component_exec.cpp b/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/PubSubComponent/PubSub_Component_exec.cpp new file mode 100644 index 00000000000..3fdc5b19acc --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/PubSubComponent/PubSub_Component_exec.cpp @@ -0,0 +1,303 @@ +// -*- C++ -*- +// $Id$ + +#include "PubSub_Component_exec.h" +#include "tao/ORB_Core.h" +#include "ace/Reactor.h" + +namespace CIAO_CoPubSub_PubSub_comp_Impl +{ + + + /** + * WriteHandler + */ + WriteHandler::WriteHandler (PubSub_comp_exec_i &callback) + : callback_ (callback) + { + } + + int + WriteHandler::handle_timeout (const ACE_Time_Value &, const void *) + { + return this->callback_.tick (); + } + + /** + * Facet Executor Implementation Class: TestSub_data_listener_exec_i + */ + + TestSub_data_listener_exec_i::TestSub_data_listener_exec_i ( + ::CoPubSub::CCM_PubSub_comp_Context_ptr ctx) + : ciao_context_ ( + ::CoPubSub::CCM_PubSub_comp_Context::_duplicate (ctx)) + { + } + + TestSub_data_listener_exec_i::~TestSub_data_listener_exec_i (void) + { + } + + // Operations from ::CoPubSub::Test_conn::Listener + + void + TestSub_data_listener_exec_i::on_one_data ( + const ::CoPubSub::Test_msg & datum, + const ::CCM_DDS::ReadInfo & /* info */) + { + ACE_DEBUG ((LM_DEBUG, "TestSub_data_listener_exec_i::on_one_data - " + "New data received: <%C> - <%d>\n", + datum.hello.in (), datum.msgId)); + } + + void + TestSub_data_listener_exec_i::on_many_data ( + const ::CoPubSub::Test_msgSeq & /* data */, + const ::CCM_DDS::ReadInfoSeq & /* infos */) + { + /* Your code here. */ + } + + /** + * Facet Executor Implementation Class: TestSub_status_exec_i + */ + + TestSub_status_exec_i::TestSub_status_exec_i ( + ::CoPubSub::CCM_PubSub_comp_Context_ptr ctx) + : ciao_context_ ( + ::CoPubSub::CCM_PubSub_comp_Context::_duplicate (ctx)) + { + } + + TestSub_status_exec_i::~TestSub_status_exec_i (void) + { + } + + // Operations from ::CCM_DDS::PortStatusListener + + void + TestSub_status_exec_i::on_requested_deadline_missed ( + ::DDS::DataReader_ptr /* the_reader */, + const ::DDS::RequestedDeadlineMissedStatus & /* status */) + { + /* Your code here. */ + } + + void + TestSub_status_exec_i::on_sample_lost ( + ::DDS::DataReader_ptr /* the_reader */, + const ::DDS::SampleLostStatus & /* status */) + { + /* Your code here. */ + } + + /** + * Component Executor Implementation Class: PubSub_comp_exec_i + */ + + PubSub_comp_exec_i::PubSub_comp_exec_i (void) + : count_(-3) + { + ticker_ = new WriteHandler (*this); + } + + PubSub_comp_exec_i::~PubSub_comp_exec_i (void) + { + delete this->ticker_; + } + + // Supported operations and attributes. + ACE_Reactor* + PubSub_comp_exec_i::reactor (void) + { + ACE_Reactor* reactor = 0; + ::CORBA::Object_var ccm_object = + this->ciao_context_->get_CCM_object(); + if (! ::CORBA::is_nil (ccm_object.in ())) + { + ::CORBA::ORB_var orb = ccm_object->_get_orb (); + if (! ::CORBA::is_nil (orb.in ())) + { + reactor = orb->orb_core ()->reactor (); + } + } + if (reactor == 0) + { + throw ::CORBA::INTERNAL (); + } + return reactor; + } + + int + PubSub_comp_exec_i::tick (void) + { + CoPubSub::Test_msg sample; + sample.hello = CORBA::string_dup("CoPubSub Test Message"); + sample.msgId = ++this->count_; + + // Reference to the writer interface for the DDS4CCM connector for msg type + ::CoPubSub::Test_conn::Writer_var writer; + + writer = ciao_context_->get_connection_TestPub_data(); + + if (CORBA::is_nil(writer.in())) + { + ACE_ERROR ((LM_ERROR, "PubSub_comp_exec_i::tick - Writer seems nil.\n")); + return -1; // Don't reschedule timer + } + + try + { + writer->write_one(sample, DDS::HANDLE_NIL); + ACE_DEBUG ((LM_DEBUG, "PubSub_comp_exec_i::tick - " + "Sample has been written: <%C> - <%d>\n", + sample.hello.in (), sample.msgId)); + } + catch (CCM_DDS::InternalError & ex) // catch "normal" exception + { + ACE_ERROR ((LM_ERROR, "PubSub_comp_exec_i::tick - " + "ERROR: caught InternalError.\n")); + + return -1; // Don't reschedule timer + } + catch (const CORBA::Exception & ex) + { + ex._tao_print_exception("PubSub_comp_exec_i::tick - ERROR: "); + return -1; // Don't reschedule timer + } + catch (...) // catch everything else. If this is called something is wrong + { + ACE_ERROR ((LM_ERROR, "PubSub_comp_exec_i::tick - " + "ERROR: caught unknown exception.\n")); + return -1; // Don't reschedule timer + } + return 0; + } + + // Component attributes and port operations. + + ::CoPubSub::Test_conn::CCM_Listener_ptr + PubSub_comp_exec_i::get_TestSub_data_listener (void) + { + if ( ::CORBA::is_nil (this->ciao_TestSub_data_listener_.in ())) + { + TestSub_data_listener_exec_i *tmp = 0; + ACE_NEW_RETURN ( + tmp, + TestSub_data_listener_exec_i ( + this->ciao_context_.in ()), + ::CoPubSub::Test_conn::CCM_Listener::_nil ()); + + this->ciao_TestSub_data_listener_ = tmp; + } + + return + ::CoPubSub::Test_conn::CCM_Listener::_duplicate ( + this->ciao_TestSub_data_listener_.in ()); + } + + ::CCM_DDS::CCM_PortStatusListener_ptr + PubSub_comp_exec_i::get_TestSub_status (void) + { + if ( ::CORBA::is_nil (this->ciao_TestSub_status_.in ())) + { + TestSub_status_exec_i *tmp = 0; + ACE_NEW_RETURN ( + tmp, + TestSub_status_exec_i ( + this->ciao_context_.in ()), + ::CCM_DDS::CCM_PortStatusListener::_nil ()); + + this->ciao_TestSub_status_ = tmp; + } + + return + ::CCM_DDS::CCM_PortStatusListener::_duplicate ( + this->ciao_TestSub_status_.in ()); + } + + // Operations from Components::SessionComponent. + + void + PubSub_comp_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + this->ciao_context_ = + ::CoPubSub::CCM_PubSub_comp_Context::_narrow (ctx); + + if ( ::CORBA::is_nil (this->ciao_context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + PubSub_comp_exec_i::configuration_complete (void) + { + /* Your code here. */ + } + + void + PubSub_comp_exec_i::ccm_activate (void) + { + CCM_DDS::DataListenerControl_var control = + ciao_context_->get_connection_TestSub_data_control(); + + if (! CORBA::is_nil(control.in())) + { + try + { + control->mode(CCM_DDS::ONE_BY_ONE); + } + catch (const CORBA::Exception & ex) + { + ex._tao_print_exception("PubSub_comp_exec_i::ccm_activate - ERROR: "); + } + } + else + { + ACE_ERROR ((LM_ERROR, "PubSub_comp_exec_i::ccm_activate - " + "ERROR: Data listener control seems nil.\n")); + } + + ACE_Time_Value delay(3, 0); // timer = 3 seconds + 0 usec = 3 sec + ACE_Time_Value repeat(3, 0); // timer = 3 seconds + 0 usec = 3 sec + + if (this->reactor()->schedule_timer(this->ticker_, + 0, + delay, + repeat) == -1) + { + ACE_ERROR ((LM_ERROR, "PubSub_comp_exec_i::ccm_activate - " + "ERROR: Unable to schedule timer.\n")); + } + else + ACE_DEBUG ((LM_DEBUG, "PubSub_comp_exec_i::ccm_activate - " + "Timer is up and running.\n")); + } + + void + PubSub_comp_exec_i::ccm_passivate (void) + { + this->reactor()->cancel_timer(this->ticker_); + } + + void + PubSub_comp_exec_i::ccm_remove (void) + { + /* Your code here. */ + } + + extern "C" PUBSUB_COMPONENT_EXEC_Export ::Components::EnterpriseComponent_ptr + create_CoPubSub_PubSub_comp_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_NORETURN ( + retval, + PubSub_comp_exec_i); + + return retval; + } +} diff --git a/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/PubSubComponent/PubSub_Component_exec.h b/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/PubSubComponent/PubSub_Component_exec.h new file mode 100644 index 00000000000..6a1cb4a8d71 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/PubSubComponent/PubSub_Component_exec.h @@ -0,0 +1,171 @@ +// -*- C++ -*- +// $Id$ + +#ifndef CIAO_PUBSUB_COMPONENT_EXEC_VCU9KR_H_ +#define CIAO_PUBSUB_COMPONENT_EXEC_VCU9KR_H_ + +#include /**/ "ace/pre.h" + +#include "PubSub_ComponentEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ "PubSub_Component_exec_export.h" +#include "tao/LocalObject.h" + +namespace CIAO_CoPubSub_PubSub_comp_Impl +{ + class PubSub_comp_exec_i; + + /** + * WriteHandler + */ + class WriteHandler : + public ACE_Event_Handler + { + public: + WriteHandler (PubSub_comp_exec_i &callback); + virtual int handle_timeout (const ACE_Time_Value &, const void *); + private: + PubSub_comp_exec_i &callback_; + }; + + + /** + * Provider Executor Implementation Class: TestSub_data_listener_exec_i + */ + + class TestSub_data_listener_exec_i + : public virtual ::CoPubSub::Test_conn::CCM_Listener, + public virtual ::CORBA::LocalObject + { + public: + TestSub_data_listener_exec_i ( + ::CoPubSub::CCM_PubSub_comp_Context_ptr ctx); + virtual ~TestSub_data_listener_exec_i (void); + + /** @name Operations and attributes from CoPubSub::Test_conn::Listener */ + //@{ + + virtual + void on_one_data ( + const ::CoPubSub::Test_msg & datum, + const ::CCM_DDS::ReadInfo & info); + + virtual + void on_many_data ( + const ::CoPubSub::Test_msgSeq & data, + const ::CCM_DDS::ReadInfoSeq & infos); + //@} + + private: + ::CoPubSub::CCM_PubSub_comp_Context_var ciao_context_; + }; + + /** + * Provider Executor Implementation Class: TestSub_status_exec_i + */ + + class TestSub_status_exec_i + : public virtual ::CCM_DDS::CCM_PortStatusListener, + public virtual ::CORBA::LocalObject + { + public: + TestSub_status_exec_i ( + ::CoPubSub::CCM_PubSub_comp_Context_ptr ctx); + virtual ~TestSub_status_exec_i (void); + + /** @name Operations and attributes from CCM_DDS::PortStatusListener */ + //@{ + + virtual + void on_requested_deadline_missed ( + ::DDS::DataReader_ptr the_reader, + const ::DDS::RequestedDeadlineMissedStatus & status); + + virtual + void on_sample_lost ( + ::DDS::DataReader_ptr the_reader, + const ::DDS::SampleLostStatus & status); + //@} + + private: + ::CoPubSub::CCM_PubSub_comp_Context_var ciao_context_; + }; + + /** + * Component Executor Implementation Class: PubSub_comp_exec_i + */ + + class PubSub_comp_exec_i + : public virtual PubSub_comp_Exec, + public virtual ::CORBA::LocalObject + { + public: + PubSub_comp_exec_i (void); + virtual ~PubSub_comp_exec_i (void); + + /** @name Supported operations and attributes. */ + //@{ + + //@} + + /** @name Component attributes and port operations. */ + //@{ + + virtual ::CoPubSub::Test_conn::CCM_Listener_ptr + get_TestSub_data_listener (void); + + virtual ::CCM_DDS::CCM_PortStatusListener_ptr + get_TestSub_status (void); + //@} + + /** @name Operations from Components::SessionComponent. */ + //@{ + virtual void set_session_context (::Components::SessionContext_ptr ctx); + virtual void configuration_complete (void); + virtual void ccm_activate (void); + virtual void ccm_passivate (void); + virtual void ccm_remove (void); + //@} + + /** @name User defined public operations. */ + //@{ + int tick (void); + + //@} + + private: + ::CoPubSub::CCM_PubSub_comp_Context_var ciao_context_; + + /** @name Component attributes. */ + //@{ + ::CoPubSub::Test_conn::CCM_Listener_var ciao_TestSub_data_listener_; + ::CCM_DDS::CCM_PortStatusListener_var ciao_TestSub_status_; + //@} + + /** @name User defined members. */ + //@{ + WriteHandler *ticker_; + + ::CORBA::Long count_; + //@} + + /** @name User defined private operations. */ + //@{ + + //@} + + /// Get the ACE_Reactor + ACE_Reactor* reactor (void); + }; + + extern "C" PUBSUB_COMPONENT_EXEC_Export ::Components::EnterpriseComponent_ptr + create_CoPubSub_PubSub_comp_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* ifndef */ diff --git a/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/SubComponent/Sub_Component.idl b/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/SubComponent/Sub_Component.idl new file mode 100644 index 00000000000..a10072c233f --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/SubComponent/Sub_Component.idl @@ -0,0 +1,15 @@ +// $Id$ + +#ifndef SUB_COMPONENT_ +#define SUB_COMPONENT_ + +#include <Components.idl> +#include "Connector/Collocated_Connector.idl" + +module CoPubSub { + component Sub_comp { + port Test_conn::DDS_Listen TestSub; + }; +}; + +#endif // SUB_COMPONENT_ diff --git a/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/SubComponent/Sub_Component.mpc b/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/SubComponent/Sub_Component.mpc new file mode 100644 index 00000000000..86ed3573eb7 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/SubComponent/Sub_Component.mpc @@ -0,0 +1,146 @@ +// $Id$ + +project(SubComponent_idl_gen) : componentidldefaults, dds4ccm { + after += Collocated_Connector_idl_gen DDS_Starter_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=PUBSUB_COMPONENT_STUB_Export \ + -Wb,stub_export_include=Sub_Component_stub_export.h \ + -Wb,skel_export_macro=PUBSUB_COMPONENT_SVNT_Export \ + -Wb,skel_export_include=Sub_Component_svnt_export.h \ + -Wb,svnt_export_macro=PUBSUB_COMPONENT_SVNT_Export \ + -Wb,svnt_export_include=Sub_Component_svnt_export.h \ + -Wb,exec_export_macro=PUBSUB_COMPONENT_EXEC_Export \ + -Wb,exec_export_include=Sub_Component_exec_export.h \ + -I .. + + IDL_Files { + Sub_Component.idl + } +} + +project(SubComponent_lem_gen) : ciaoidldefaults, dds4ccm { + after += SubComponent_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=PUBSUB_COMPONENT_LEM_STUB_Export \ + -Wb,stub_export_include=SubComponent_lem_stub_export.h \ + -SS -Gxhst -I $CIAO_ROOT/connectors -I .. + + IDL_Files { + Sub_ComponentE.idl + } +} + +project(SubComponent_lem_stub) : ccm_svnt, dds4ccm_base { + after += SubComponent_lem_gen SubComponent_stub \ + Collocated_Base_stub + libs += Collocated_Base_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = Sub_Component_lem_stub + dynamicflags += PUBSUB_COMPONENT_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Sub_ComponentEC.cpp + } + + Header_Files { + Sub_ComponentEC.h + Sub_Component_lem_stub_export.h + } + + Inline_Files { + Sub_ComponentEC.inl + } +} + +project(SubComponent_stub) : ccm_stub, dds4ccm_base { + after += SubComponent_idl_gen Collocated_Base_stub \ + Collocated_Connector_stub + libs += Collocated_Base_stub Collocated_Connector_stub + includes += .. + libpaths += ../lib + libout = ../lib + sharedname = Sub_Component_stub + dynamicflags += PUBSUB_COMPONENT_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Sub_ComponentC.cpp + } + + Header_Files { + Sub_ComponentC.h + Sub_Component_stub_export.h + } + + Inline_Files { + Sub_ComponentC.inl + } +} + +project(SubComponent_exec) : ciao_executor, dds4ccm_lem_stub { + after += SubComponent_lem_stub SubComponent_stub \ + Collocated_Connector_lem_stub Collocated_Connector_stub + sharedname = Sub_Component_exec + libs += Sub_Component_stub Sub_Component_lem_stub Collocated_Base_stub \ + Collocated_Connector_lem_stub Collocated_Connector_stub + libpaths += ../lib + includes += .. + libout = ../lib + dynamicflags += PUBSUB_COMPONENT_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Sub_Component_exec.cpp + } + + Header_Files { + Sub_Component_exec.h + Sub_Component_exec_export.h + } + + Inline_Files { + } +} + + +project(SubComponent_svnt) : ciao_servant, dds4ccm_lem_stub, dds4ccm_skel { + after += Collocated_Base_stub SubComponent_lem_stub \ + Collocated_Connector_stub \ + Collocated_Connector_svnt Collocated_Connector_lem_stub + sharedname = Sub_Component_svnt + libs += Sub_Component_stub Sub_Component_lem_stub Collocated_Base_stub \ + Collocated_Connector_stub Collocated_Connector_svnt \ + Collocated_Connector_lem_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += PUBSUB_COMPONENT_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Sub_ComponentS.cpp + Sub_Component_svnt.cpp + } + + Header_Files { + Sub_ComponentS.h + Sub_Component_svnt.h + Sub_Component_svnt_export.h + } + + Inline_Files { + Sub_ComponentS.inl + } +} + diff --git a/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/SubComponent/Sub_Component_exec.cpp b/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/SubComponent/Sub_Component_exec.cpp new file mode 100644 index 00000000000..faaa7e51fe8 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/SubComponent/Sub_Component_exec.cpp @@ -0,0 +1,201 @@ +// -*- C++ -*- +// $Id$ + +#include "Sub_Component_exec.h" + +namespace CIAO_CoPubSub_Sub_comp_Impl +{ + + /** + * Facet Executor Implementation Class: TestSub_data_listener_exec_i + */ + + TestSub_data_listener_exec_i::TestSub_data_listener_exec_i ( + ::CoPubSub::CCM_Sub_comp_Context_ptr ctx) + : ciao_context_ ( + ::CoPubSub::CCM_Sub_comp_Context::_duplicate (ctx)) + { + } + + TestSub_data_listener_exec_i::~TestSub_data_listener_exec_i (void) + { + } + + // Operations from ::CoPubSub::Test_conn::Listener + + void + TestSub_data_listener_exec_i::on_one_data ( + const ::CoPubSub::Test_msg & datum, + const ::CCM_DDS::ReadInfo & /* info */) + { + ACE_DEBUG ((LM_DEBUG, "TestSub_data_listener_exec_i::on_one_data - " + "New data received: <%C> - <%d>\n", + datum.hello.in (), datum.msgId)); + } + + void + TestSub_data_listener_exec_i::on_many_data ( + const ::CoPubSub::Test_msgSeq & /* data */, + const ::CCM_DDS::ReadInfoSeq & /* infos */) + { + /* Your code here. */ + } + + /** + * Facet Executor Implementation Class: TestSub_status_exec_i + */ + + TestSub_status_exec_i::TestSub_status_exec_i ( + ::CoPubSub::CCM_Sub_comp_Context_ptr ctx) + : ciao_context_ ( + ::CoPubSub::CCM_Sub_comp_Context::_duplicate (ctx)) + { + } + + TestSub_status_exec_i::~TestSub_status_exec_i (void) + { + } + + // Operations from ::CCM_DDS::PortStatusListener + + void + TestSub_status_exec_i::on_requested_deadline_missed ( + ::DDS::DataReader_ptr /* the_reader */, + const ::DDS::RequestedDeadlineMissedStatus & /* status */) + { + /* Your code here. */ + } + + void + TestSub_status_exec_i::on_sample_lost ( + ::DDS::DataReader_ptr /* the_reader */, + const ::DDS::SampleLostStatus & /* status */) + { + /* Your code here. */ + } + + /** + * Component Executor Implementation Class: Sub_comp_exec_i + */ + + Sub_comp_exec_i::Sub_comp_exec_i (void){ + } + + Sub_comp_exec_i::~Sub_comp_exec_i (void) + { + } + + // Supported operations and attributes. + + // Component attributes and port operations. + + ::CoPubSub::Test_conn::CCM_Listener_ptr + Sub_comp_exec_i::get_TestSub_data_listener (void) + { + if ( ::CORBA::is_nil (this->ciao_TestSub_data_listener_.in ())) + { + TestSub_data_listener_exec_i *tmp = 0; + ACE_NEW_RETURN ( + tmp, + TestSub_data_listener_exec_i ( + this->ciao_context_.in ()), + ::CoPubSub::Test_conn::CCM_Listener::_nil ()); + + this->ciao_TestSub_data_listener_ = tmp; + } + + return + ::CoPubSub::Test_conn::CCM_Listener::_duplicate ( + this->ciao_TestSub_data_listener_.in ()); + } + + ::CCM_DDS::CCM_PortStatusListener_ptr + Sub_comp_exec_i::get_TestSub_status (void) + { + if ( ::CORBA::is_nil (this->ciao_TestSub_status_.in ())) + { + TestSub_status_exec_i *tmp = 0; + ACE_NEW_RETURN ( + tmp, + TestSub_status_exec_i ( + this->ciao_context_.in ()), + ::CCM_DDS::CCM_PortStatusListener::_nil ()); + + this->ciao_TestSub_status_ = tmp; + } + + return + ::CCM_DDS::CCM_PortStatusListener::_duplicate ( + this->ciao_TestSub_status_.in ()); + } + + // Operations from Components::SessionComponent. + + void + Sub_comp_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + this->ciao_context_ = + ::CoPubSub::CCM_Sub_comp_Context::_narrow (ctx); + + if ( ::CORBA::is_nil (this->ciao_context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + Sub_comp_exec_i::configuration_complete (void) + { + /* Your code here. */ + } + + void + Sub_comp_exec_i::ccm_activate (void) + { + CCM_DDS::DataListenerControl_var control = + ciao_context_->get_connection_TestSub_data_control(); + + if (! CORBA::is_nil(control.in())) + { + try + { + control->mode(CCM_DDS::ONE_BY_ONE); + } + catch (const CORBA::Exception & ex) + { + ex._tao_print_exception("Sub_comp_exec_i::ccm_activate - ERROR: "); + } + } + else + { + ACE_ERROR ((LM_ERROR, "Sub_comp_exec_i::ccm_activate - " + "ERROR: Listener control is nil.\n")); + } + } + + void + Sub_comp_exec_i::ccm_passivate (void) + { + /* Your code here. */ + } + + void + Sub_comp_exec_i::ccm_remove (void) + { + /* Your code here. */ + } + + extern "C" PUBSUB_COMPONENT_EXEC_Export ::Components::EnterpriseComponent_ptr + create_CoPubSub_Sub_comp_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_NORETURN ( + retval, + Sub_comp_exec_i); + + return retval; + } +} diff --git a/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/SubComponent/Sub_Component_exec.h b/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/SubComponent/Sub_Component_exec.h new file mode 100644 index 00000000000..d43763f78f4 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/SubComponent/Sub_Component_exec.h @@ -0,0 +1,150 @@ +// -*- C++ -*- +// $Id$ + +#ifndef CIAO_SUB_COMPONENT_EXEC_SXAYYT_H_ +#define CIAO_SUB_COMPONENT_EXEC_SXAYYT_H_ + +#include /**/ "ace/pre.h" + +#include "Sub_ComponentEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ "Sub_Component_exec_export.h" +#include "tao/LocalObject.h" + +namespace CIAO_CoPubSub_Sub_comp_Impl +{ + + /** + * Provider Executor Implementation Class: TestSub_data_listener_exec_i + */ + + class TestSub_data_listener_exec_i + : public virtual ::CoPubSub::Test_conn::CCM_Listener, + public virtual ::CORBA::LocalObject + { + public: + TestSub_data_listener_exec_i ( + ::CoPubSub::CCM_Sub_comp_Context_ptr ctx); + virtual ~TestSub_data_listener_exec_i (void); + + /** @name Operations and attributes from CoPubSub::Test_conn::Listener */ + //@{ + + virtual + void on_one_data ( + const ::CoPubSub::Test_msg & datum, + const ::CCM_DDS::ReadInfo & info); + + virtual + void on_many_data ( + const ::CoPubSub::Test_msgSeq & data, + const ::CCM_DDS::ReadInfoSeq & infos); + //@} + + private: + ::CoPubSub::CCM_Sub_comp_Context_var ciao_context_; + }; + + /** + * Provider Executor Implementation Class: TestSub_status_exec_i + */ + + class TestSub_status_exec_i + : public virtual ::CCM_DDS::CCM_PortStatusListener, + public virtual ::CORBA::LocalObject + { + public: + TestSub_status_exec_i ( + ::CoPubSub::CCM_Sub_comp_Context_ptr ctx); + virtual ~TestSub_status_exec_i (void); + + /** @name Operations and attributes from CCM_DDS::PortStatusListener */ + //@{ + + virtual + void on_requested_deadline_missed ( + ::DDS::DataReader_ptr the_reader, + const ::DDS::RequestedDeadlineMissedStatus & status); + + virtual + void on_sample_lost ( + ::DDS::DataReader_ptr the_reader, + const ::DDS::SampleLostStatus & status); + //@} + + private: + ::CoPubSub::CCM_Sub_comp_Context_var ciao_context_; + }; + + /** + * Component Executor Implementation Class: Sub_comp_exec_i + */ + + class Sub_comp_exec_i + : public virtual Sub_comp_Exec, + public virtual ::CORBA::LocalObject + { + public: + Sub_comp_exec_i (void); + virtual ~Sub_comp_exec_i (void); + + /** @name Supported operations and attributes. */ + //@{ + + //@} + + /** @name Component attributes and port operations. */ + //@{ + + virtual ::CoPubSub::Test_conn::CCM_Listener_ptr + get_TestSub_data_listener (void); + + virtual ::CCM_DDS::CCM_PortStatusListener_ptr + get_TestSub_status (void); + //@} + + /** @name Operations from Components::SessionComponent. */ + //@{ + virtual void set_session_context (::Components::SessionContext_ptr ctx); + virtual void configuration_complete (void); + virtual void ccm_activate (void); + virtual void ccm_passivate (void); + virtual void ccm_remove (void); + //@} + + /** @name User defined public operations. */ + //@{ + + //@} + + private: + ::CoPubSub::CCM_Sub_comp_Context_var ciao_context_; + + /** @name Component attributes. */ + //@{ + ::CoPubSub::Test_conn::CCM_Listener_var ciao_TestSub_data_listener_; + ::CCM_DDS::CCM_PortStatusListener_var ciao_TestSub_status_; + //@} + + /** @name User defined members. */ + //@{ + + //@} + + /** @name User defined private operations. */ + //@{ + + //@} + }; + + extern "C" PUBSUB_COMPONENT_EXEC_Export ::Components::EnterpriseComponent_ptr + create_CoPubSub_Sub_comp_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* ifndef */ diff --git a/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/descriptors/Plan.cdp b/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/descriptors/Plan.cdp new file mode 100644 index 00000000000..5dead0833fe --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/descriptors/Plan.cdp @@ -0,0 +1,654 @@ +<!-- $Id$ --> +<Deployment:DeploymentPlan + xmlns:Deployment="http://www.omg.org/Deployment" + xmlns:xmi="http://www.omg.org/XMI" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.omg.org/Deployment Deployment.xsd"> + <label>CollocatedDepl_1</label> + <UUID>CollocatedDepl_1</UUID> + + <implementation xmi:id="SubComponentImplementation"> + <name>SubComponentImplementation</name> + <source/> + <artifact xmi:idref="Sub_Component_ExecArtifact" /> + <artifact xmi:idref="Sub_Component_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_CoPubSub_Sub_comp_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_CoPubSub_Sub_comp_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Sub_Component_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Sub_Component_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="PubSubComponentImplementation"> + <name>PubSubComponentImplementation</name> + <source/> + <artifact xmi:idref="PubSub_Component_ExecArtifact" /> + <artifact xmi:idref="PubSub_Component_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_CoPubSub_PubSub_comp_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_CoPubSub_PubSub_comp_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>PubSub_Component_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>PubSub_Component_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="CollocatedConnectorComponentImplementation"> + <name>CollocatedConnectorComponentImplementation</name> + <source/> + <artifact xmi:idref="Collocated_Connector_ExecArtifact" /> + <artifact xmi:idref="Collocated_Connector_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_CoPubSub_Test_conn_DDS_Event_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_CoPubSub_Test_conn_DDS_Event_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Collocated_Connector_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Collocated_Connector_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <!-- SubComponent1 and its connector --> + <instance xmi:id="SubComponentInstance1"> + <name>SubComponent1</name> + <node>Node</node> + <source/> + <implementation xmi:idref="SubComponentImplementation" /> + </instance> + + <instance xmi:id="SubComponent1Connector"> + <name>SubComponent1Connector</name> + <node>Node</node> + <source/> + <implementation xmi:idref="CollocatedConnectorComponentImplementation" /> + <configProperty> + <name>topic_name</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>CollocatedTopic</string> + </value> + </value> + </configProperty> + <configProperty> + <name>push_consumer_filter</name> + <value> + <type> + <kind>tk_struct</kind> + <struct> + <name>QueryFilter</name> + <typeId>IDL:CCM_DDS/QueryFilter:1.0</typeId> + <member> + <name>expression</name> + <type> + <kind>tk_string</kind> + </type> + </member> + <member> + <name>parameters</name> + <type> + <kind>tk_sequence</kind> + <sequence> + <elementType> + <kind>tk_string</kind> + </elementType> + </sequence> + </type> + </member> + </struct> + </type> + <value> + <member> + <name>expression</name> + <value> + <string>msgId < %0</string> + </value> + </member> + <member> + <name>parameters</name> + <value> + <element> + <string>1</string> + </element> + </value> + </member> + </value> + </value> + </configProperty> + </instance> + + <!-- SubComponent2 and its connector --> + <instance xmi:id="SubComponentInstance2"> + <name>SubComponent2</name> + <node>Node</node> + <source/> + <implementation xmi:idref="SubComponentImplementation" /> + </instance> + + <instance xmi:id="SubComponent2Connector"> + <name>SubComponent2Connector</name> + <node>Node</node> + <source/> + <implementation xmi:idref="CollocatedConnectorComponentImplementation" /> + <configProperty> + <name>topic_name</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>CollocatedTopic</string> + </value> + </value> + </configProperty> + <configProperty> + <name>push_consumer_filter</name> + <value> + <type> + <kind>tk_struct</kind> + <struct> + <name>QueryFilter</name> + <typeId>IDL:CCM_DDS/QueryFilter:1.0</typeId> + <member> + <name>expression</name> + <type> + <kind>tk_string</kind> + </type> + </member> + <member> + <name>parameters</name> + <type> + <kind>tk_sequence</kind> + <sequence> + <elementType> + <kind>tk_string</kind> + </elementType> + </sequence> + </type> + </member> + </struct> + </type> + <value> + <member> + <name>expression</name> + <value> + <string>msgId < %0</string> + </value> + </member> + <member> + <name>parameters</name> + <value> + <element> + <string>1</string> + </element> + </value> + </member> + </value> + </value> + </configProperty> + </instance> + + <!-- PubSubComponent and its connector --> + <instance xmi:id="PubSubComponentInstance"> + <name>PubSubComponent</name> + <node>Node</node> + <source/> + <implementation xmi:idref="PubSubComponentImplementation" /> + </instance> + + <instance xmi:id="PubSubComponentConnector"> + <name>PubSubComponentConnector</name> + <node>Node</node> + <source/> + <implementation xmi:idref="CollocatedConnectorComponentImplementation" /> + <configProperty> + <name>topic_name</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>CollocatedTopic</string> + </value> + </value> + </configProperty> + <configProperty> + <name>push_consumer_filter</name> + <value> + <type> + <kind>tk_struct</kind> + <struct> + <name>QueryFilter</name> + <typeId>IDL:CCM_DDS/QueryFilter:1.0</typeId> + <member> + <name>expression</name> + <type> + <kind>tk_string</kind> + </type> + </member> + <member> + <name>parameters</name> + <type> + <kind>tk_sequence</kind> + <sequence> + <elementType> + <kind>tk_string</kind> + </elementType> + </sequence> + </type> + </member> + </struct> + </type> + <value> + <member> + <name>expression</name> + <value> + <string>msgId < %0</string> + </value> + </member> + <member> + <name>parameters</name> + <value> + <element> + <string>1</string> + </element> + </value> + </member> + </value> + </value> + </configProperty> + </instance> + + <!-- pubsub writer connection --> + <connection> + <name>writer_connection</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>TestPub_data</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="PubSubComponentInstance"/> + </internalEndpoint> + <internalEndpoint> + <portName>supplier_data</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="PubSubComponentConnector"/> + </internalEndpoint> + </connection> + + <!-- pub sub listener connections --> + <connection> + <name>pubsub_listener_filter</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>TestSub_filter_config</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="PubSubComponentInstance"/> + </internalEndpoint> + <internalEndpoint> + <portName>push_consumer_filter_config</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="PubSubComponentConnector"/> + </internalEndpoint> + </connection> + + <connection> + <name>pubsub_data_listener</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>TestSub_data_listener</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="PubSubComponentInstance"/> + </internalEndpoint> + <internalEndpoint> + <portName>push_consumer_data_listener</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="PubSubComponentConnector"/> + </internalEndpoint> + </connection> + + <connection> + <name>pubsub_listener_control</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>TestSub_data_control</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="PubSubComponentInstance"/> + </internalEndpoint> + <internalEndpoint> + <portName>push_consumer_data_control</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="PubSubComponentConnector"/> + </internalEndpoint> + </connection> + + <!-- sub1 listener connections --> + <connection> + <name>sub1_listener_filter</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>TestSub_filter_config</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="SubComponentInstance1"/> + </internalEndpoint> + <internalEndpoint> + <portName>push_consumer_filter_config</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="SubComponent1Connector"/> + </internalEndpoint> + </connection> + + <connection> + <name>sub1_data_listener</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>TestSub_data_listener</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="SubComponentInstance1"/> + </internalEndpoint> + <internalEndpoint> + <portName>push_consumer_data_listener</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="SubComponent1Connector"/> + </internalEndpoint> + </connection> + + <connection> + <name>sub1_listener_control</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>TestSub_data_control</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="SubComponentInstance1"/> + </internalEndpoint> + <internalEndpoint> + <portName>push_consumer_data_control</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="SubComponent1Connector"/> + </internalEndpoint> + </connection> + + <!-- sub2 listener connections --> + <connection> + <name>sub2_listener_filter</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>TestSub_filter_config</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="SubComponentInstance2"/> + </internalEndpoint> + <internalEndpoint> + <portName>push_consumer_filter_config</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="SubComponent2Connector"/> + </internalEndpoint> + </connection> + + <connection> + <name>sub2_data_listener</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>TestSub_data_listener</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="SubComponentInstance2"/> + </internalEndpoint> + <internalEndpoint> + <portName>push_consumer_data_listener</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="SubComponent2Connector"/> + </internalEndpoint> + </connection> + + <connection> + <name>sub2_listener_control</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>TestSub_data_control</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="SubComponentInstance2"/> + </internalEndpoint> + <internalEndpoint> + <portName>push_consumer_data_control</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="SubComponent2Connector"/> + </internalEndpoint> + </connection> + + <artifact xmi:id="Collocated_Connector_ExecArtifact"> + <name>Collocated_Connector_exec</name> + <source/> + <node/> + <location>Collocated_Connector_exec</location> + </artifact> + <artifact xmi:id="Collocated_Connector_SvntArtifact"> + <name>Collocated_Connector_svnt</name> + <source/> + <node/> + <location>Collocated_Connector_svnt</location> + </artifact> + <artifact xmi:id="Collocated_Connector_StubArtifact"> + <name>Collocated_Connector_stub</name> + <source/> + <node/> + <location>Collocated_Connector_stub</location> + </artifact> + + <artifact xmi:id="Sub_Component_ExecArtifact"> + <name>Sub_Component_exec</name> + <source/> + <node/> + <location>Sub_Component_exec</location> + </artifact> + <artifact xmi:id="Sub_Component_SvntArtifact"> + <name>Sub_Component_svnt</name> + <source/> + <node/> + <location>Sub_Component_svnt</location> + </artifact> + <artifact xmi:id="Sub_Component_StubArtifact"> + <name>Sub_Component_stub</name> + <source/> + <node/> + <location>Sub_Component_stub</location> + </artifact> + + <artifact xmi:id="PubSub_Component_ExecArtifact"> + <name>PubSub_Component_exec</name> + <source/> + <node/> + <location>PubSub_Component_exec</location> + </artifact> + <artifact xmi:id="PubSub_Component_SvntArtifact"> + <name>PubSub_Component_svnt</name> + <source/> + <node/> + <location>PubSub_Component_svnt</location> + </artifact> + <artifact xmi:id="PubSub_Component_StubArtifact"> + <name>PubSub_Component_stub</name> + <source/> + <node/> + <location>PubSub_Component_stub</location> + </artifact> + + <localityConstraint> + <constraint>SameProcess</constraint> + <constrainedInstance xmi:idref="PubSubComponentInstance"/> + <constrainedInstance xmi:idref="PubSubComponentConnector"/> + </localityConstraint> + + <localityConstraint> + <constraint>SameProcess</constraint> + <constrainedInstance xmi:idref="SubComponentInstance1"/> + <constrainedInstance xmi:idref="SubComponent1Connector"/> + <constrainedInstance xmi:idref="SubComponentInstance2"/> + <constrainedInstance xmi:idref="SubComponent2Connector"/> + </localityConstraint> + +</Deployment:DeploymentPlan> diff --git a/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/descriptors/run_test.pl b/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/descriptors/run_test.pl new file mode 100755 index 00000000000..2a6ecd3b4e8 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/CollocatedPubSub/descriptors/run_test.pl @@ -0,0 +1,244 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{'ACE_ROOT'}/bin"; +use PerlACE::TestTarget; + +$CIAO_ROOT = "$ENV{'CIAO_ROOT'}"; +$TAO_ROOT = "$ENV{'TAO_ROOT'}"; +$DANCE_ROOT = "$ENV{'DANCE_ROOT'}"; + +$daemons_running = 0; +$em_running = 0; +$ns_running = 0; + +$nr_daemon = 1; +@ports = ( 60001 ); +@iorbases = ( "NodeApp.ior" ); +@iorfiles = 0; +@nodenames = ( "Node" ); + +# ior files other than daemon +# ior files other than daemon +$ior_nsbase = "ns.ior"; +$ior_nsfile = 0; +$ior_embase = "EM.ior"; +$ior_emfile = 0; + +# Processes +$E = 0; +$EM = 0; +$NS = 0; +@DEAMONS = 0; + +# targets +@tg_daemons = 0; +$tg_naming = 0; +$tg_exe_man = 0; +$tg_executor = 0; + +$status = 0; +$cdp_file = "Plan.cdp"; + +sub create_targets { + # naming service + $tg_naming = PerlACE::TestTarget::create_target (1) || die "Create target for ns failed\n"; + $tg_naming->AddLibPath ('../lib'); + # daemon + for ($i = 0; $i < $nr_daemon; ++$i) { + $tg_daemons[$i] = PerlACE::TestTarget::create_target ($i+1) || die "Create target for daemon $i failed\n"; + $tg_daemons[$i]->AddLibPath ('../lib'); + } + # execution manager + $tg_exe_man = PerlACE::TestTarget::create_target (1) || die "Create target for EM failed\n"; + $tg_exe_man->AddLibPath ('../lib'); + # executor (plan_launcher) + $tg_executor = PerlACE::TestTarget::create_target (1) || die "Create target for executor failed\n"; + $tg_executor->AddLibPath ('../lib'); +} + +sub init_ior_files { + $ior_nsfile = $tg_naming->LocalFile ($ior_nsbase); + $ior_emfile = $tg_exe_man->LocalFile ($ior_embase); + for ($i = 0; $i < $nr_daemon; ++$i) { + $iorfiles[$i] = $tg_daemons[$i]->LocalFile ($iorbases[$i]); + } + delete_ior_files (); +} + +# Delete if there are any .ior files. +sub delete_ior_files { + for ($i = 0; $i < $nr_daemon; ++$i) { + $tg_daemons[$i]->DeleteFile ($iorbases[$i]); + } + $tg_naming->DeleteFile ($ior_nsbase); + $tg_exe_man->DeleteFile ($ior_embase); + for ($i = 0; $i < $nr_daemon; ++$i) { + $iorfiles[$i] = $tg_daemons[$i]->LocalFile ($iorbases[$i]); + } +} + +sub kill_node_daemon { + for ($i = 0; $i < $nr_daemon; ++$i) { + $DEAMONS[$i]->Kill (); $DEAMONS[$i]->TimedWait (1); + } +} + +sub kill_open_processes { + if ($daemons_running == 1) { + kill_node_daemon (); + } + + if ($em_running == 1) { + $EM->Kill (); $EM->TimedWait (1); + } + + if ($ns_running == 1) { + $NS->Kill (); $NS->TimedWait (1); + } + # in case shutdown did not perform as expected + $tg_executor->KillAll ('dance_locality_manager'); +} + +sub run_node_daemons { + for ($i = 0; $i < $nr_daemon; ++$i) { + $iorbase = $iorbases[$i]; + $iorfile = $iorfiles[$i]; + $port = $ports[$i]; + $nodename = $nodenames[$i]; + $iiop = "iiop://localhost:$port"; + $node_app = $tg_daemons[$i]->GetArchDir("$DANCE_ROOT/bin/") . "dance_locality_manager"; + + $d_cmd = "$DANCE_ROOT/bin/dance_node_manager"; + $d_param = "-ORBEndpoint $iiop -s $node_app -n $nodename=$iorfile -t 30 --domain-nc corbaloc:rir:/NameService"; + + print "Run dance_node_manager with $d_param\n"; + + $DEAMONS[$i] = $tg_daemons[$i]->CreateProcess ($d_cmd, $d_param); + $DEAMONS[$i]->Spawn (); + + if ($tg_daemons[$i]->WaitForFileTimed($iorbase, + $tg_daemons[$i]->ProcessStartWaitInterval ()) == -1) { + print STDERR + "ERROR: The ior $iorfile file of node daemon $i could not be found\n"; + for (; $i >= 0; --$i) { + $DEAMONS[$i]->Kill (); $DEAMONS[$i]->TimedWait (1); + } + return -1; + } + } + return 0; +} + +create_targets (); +init_ior_files (); + +# Invoke naming service + +$NS = $tg_naming->CreateProcess ("$TAO_ROOT/orbsvcs/Naming_Service/tao_cosnaming", " -ORBEndpoint iiop://localhost:60003 -o $ior_nsfile"); + +$ns_status = $NS->Spawn (); + +if ($ns_status != 0) { + print STDERR "ERROR: Unable to execute the naming service\n"; + kill_open_processes (); + exit 1; +} + +print STDERR "Starting Naming Service with -ORBEndpoint iiop://localhost:60003 -o ns.ior\n"; + +if ($tg_naming->WaitForFileTimed ($ior_nsbase, + $tg_naming->ProcessStartWaitInterval ()) == -1) { + print STDERR "ERROR: cannot find naming service IOR file\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} + +$ns_running = 1; +# Set up NamingService environment +$ENV{"NameServiceIOR"} = "corbaloc:iiop:localhost:60003/NameService"; + +# Invoke node daemon. +print "Invoking node daemon\n"; +$status = run_node_daemons (); + +if ($status != 0) { + print STDERR "ERROR: Unable to execute the node daemon\n"; + kill_open_processes (); + exit 1; +} + +$daemons_running = 1; + +# Invoke execution manager. +print "Invoking execution manager (dance_execution_manager.exe) with -e$ior_emfile\n"; +$EM = $tg_exe_man->CreateProcess ("$DANCE_ROOT/bin/dance_execution_manager", + "-e$ior_emfile --domain-nc corbaloc:rir:/NameService"); +$em_status = $EM->Spawn (); + +if ($em_status != 0) { + print STDERR "ERROR: dance_execution_manager returned $em_status"; + exit 1; +} + +if ($tg_exe_man->WaitForFileTimed ($ior_embase, + $tg_exe_man->ProcessStartWaitInterval ()) == -1) { + print STDERR + "ERROR: The ior file of execution manager could not be found\n"; + kill_open_processes (); + exit 1; +} + +$em_running = 1; + +# Invoke executor - start the application -. +print "Invoking executor - launch the application -\n"; + +print "Start dance_plan_launcher.exe with -x $cdp_file -k file://$ior_emfile\n"; +$E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-x $cdp_file -k file://$ior_emfile"); +$pl_status = $E->SpawnWaitKill (2 * $tg_executor->ProcessStartWaitInterval ()); + +if ($pl_status != 0) { + print STDERR "ERROR: dance_plan_launcher returned $pl_status\n"; + kill_open_processes (); + exit 1; +} + +for ($i = 0; $i < $nr_daemon; ++$i) { + if ($tg_daemons[$i]->WaitForFileTimed ($iorbases[$i], + $tg_daemons[$i]->ProcessStopWaitInterval ()) == -1) { + print STDERR "ERROR: The ior file of daemon $i could not be found\n"; + kill_open_processes (); + exit 1; + } +} + +print "Sleeping 30 seconds to allow task to complete\n"; +sleep (30); + +# Invoke executor - stop the application -. +print "Invoking executor - stop the application -\n"; +print "by running dance_plan_launcher.exe with -k file://$ior_emfile -x $cdp_file\n"; + +$E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-k file://$ior_emfile -x $cdp_file -s"); +$pl_status = $E->SpawnWaitKill ($tg_executor->ProcessStartWaitInterval ()); + +if ($pl_status != 0) { + print STDERR "ERROR: dance_plan_launcher returned $pl_status\n"; + kill_open_processes (); + exit 1; +} + +print "Executor returned.\n"; +print "Shutting down rest of the processes.\n"; + +delete_ior_files (); +kill_open_processes (); + +exit $status; diff --git a/CIAO/connectors/dds4ccm/tests/KeyedSamples/Sender/Keyed_Test_Sender_exec.cpp b/CIAO/connectors/dds4ccm/tests/KeyedSamples/Sender/Keyed_Test_Sender_exec.cpp index f1bcda297e7..fcae1ffefd6 100644 --- a/CIAO/connectors/dds4ccm/tests/KeyedSamples/Sender/Keyed_Test_Sender_exec.cpp +++ b/CIAO/connectors/dds4ccm/tests/KeyedSamples/Sender/Keyed_Test_Sender_exec.cpp @@ -91,34 +91,34 @@ namespace CIAO_Keyed_Test_Sender_Impl void Sender_exec_i::tick (void) { - if (this->last_key != this->ktests_.end ()) + if (this->last_key_ != this->ktests_.end ()) { try { KeyedTestConnector::Writer_var writer = this->ciao_context_->get_connection_info_write_data (); - ++this->last_key->second->iteration; - writer->write_one (this->last_key->second, ::DDS::HANDLE_NIL); + ++this->last_key_->second->iteration; + writer->write_one (this->last_key_->second, ::DDS::HANDLE_NIL); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Written key <%C> with <%d>\n"), - this->last_key->first.c_str (), - this->last_key->second->iteration)); + this->last_key_->first.c_str (), + this->last_key_->second->iteration)); } catch (const CCM_DDS::InternalError& ) { ACE_ERROR ((LM_ERROR, "ERROR: Internal Error while writing KeyedTest info for <%C>.\n", - this->last_key->first.c_str ())); + this->last_key_->first.c_str ())); } - ++this->last_key; + ++this->last_key_; } else { // Onto the next iteration - this->last_key = this->ktests_.begin (); - while (this->last_key != this->ktests_.end ()) + this->last_key_ = this->ktests_.begin (); + while (this->last_key_ != this->ktests_.end ()) { - if (this->last_key->second->iteration == this->iterations_) + if (this->last_key_->second->iteration == this->iterations_) { - ++this->last_key; + ++this->last_key_; } else { @@ -229,7 +229,7 @@ namespace CIAO_Keyed_Test_Sender_Impl this->ktests_[key] = new_key; } - this->last_key = this->ktests_.begin (); + this->last_key_ = this->ktests_.begin (); } void diff --git a/CIAO/connectors/dds4ccm/tests/KeyedSamples/Sender/Keyed_Test_Sender_exec.h b/CIAO/connectors/dds4ccm/tests/KeyedSamples/Sender/Keyed_Test_Sender_exec.h index b6085322894..c366385b14f 100644 --- a/CIAO/connectors/dds4ccm/tests/KeyedSamples/Sender/Keyed_Test_Sender_exec.h +++ b/CIAO/connectors/dds4ccm/tests/KeyedSamples/Sender/Keyed_Test_Sender_exec.h @@ -132,7 +132,7 @@ namespace CIAO_Keyed_Test_Sender_Impl typedef std::map<ACE_CString, KeyedTest_var> Keyed_Test_Table; Keyed_Test_Table ktests_; - Keyed_Test_Table::iterator last_key; + Keyed_Test_Table::iterator last_key_; //@} diff --git a/CIAO/connectors/dds4ccm/tests/LateBinding/ReadGet/Receiver/RG_LateBinding_Receiver_impl.cpp b/CIAO/connectors/dds4ccm/tests/LateBinding/ReadGet/Receiver/RG_LateBinding_Receiver_impl.cpp index 491fcbbcf11..e57ae4c813e 100644 --- a/CIAO/connectors/dds4ccm/tests/LateBinding/ReadGet/Receiver/RG_LateBinding_Receiver_impl.cpp +++ b/CIAO/connectors/dds4ccm/tests/LateBinding/ReadGet/Receiver/RG_LateBinding_Receiver_impl.cpp @@ -138,8 +138,8 @@ namespace CIAO_RG_LateBinding_Receiver_Impl this->start_reading (); this->set_topic_name_getter (); this->start_getting (); - this->set_topic_name_reader (true); - this->set_topic_name_getter (true); + this->set_topic_name_reader (); + this->set_topic_name_getter (); } void @@ -294,7 +294,7 @@ namespace CIAO_RG_LateBinding_Receiver_Impl } void - RG_LateBinding_Receiver_impl::set_topic_name_reader (bool test_non_changeable) + RG_LateBinding_Receiver_impl::set_topic_name_reader (void) { try { @@ -323,34 +323,17 @@ namespace CIAO_RG_LateBinding_Receiver_Impl "Unable to narrow connector interface\n")); throw ::CORBA::INTERNAL (); } - if (test_non_changeable) - { - conn->topic_name ("LateBindingTopicSecondTime"); - ACE_ERROR ((LM_ERROR, "RG_LateBinding_Receiver_impl::set_topic_name_reader - " - "ERROR: No NonChangeable exception thrown.\n")); - } - else - { - conn->topic_name ("LateBindingTopic"); - } + conn->topic_name ("LateBindingTopic"); } catch (const ::CCM_DDS::NonChangeable &) { - if (test_non_changeable) - { - ACE_DEBUG ((LM_DEBUG, "RG_LateBinding_Receiver_impl::set_topic_name_reader - " - "Expected NonChangeable caught.\n")); - } - else - { - ACE_ERROR ((LM_ERROR, "ERROR: RG_LateBinding_Receiver_impl::set_topic_name_reader - " - "Caught NonChangeable exception.\n")); - } + ACE_ERROR ((LM_ERROR, "ERROR: RG_LateBinding_Receiver_impl::set_topic_name_reader - " + "Caught NonChangeable exception.\n")); } } void - RG_LateBinding_Receiver_impl::set_topic_name_getter (bool test_non_changeable) + RG_LateBinding_Receiver_impl::set_topic_name_getter (void) { try { @@ -379,29 +362,12 @@ namespace CIAO_RG_LateBinding_Receiver_Impl "Unable to narrow connector interface\n")); throw ::CORBA::INTERNAL (); } - if (test_non_changeable) - { - conn->topic_name ("LateBindingTopicSecondTime"); - ACE_ERROR ((LM_ERROR, "RG_LateBinding_Receiver_impl::set_topic_name_getter - " - "ERROR: No NonChangeable exception thrown.\n")); - } - else - { - conn->topic_name ("LateBindingTopic"); - } + conn->topic_name ("LateBindingTopic"); } catch (const ::CCM_DDS::NonChangeable &) { - if (test_non_changeable) - { - ACE_DEBUG ((LM_DEBUG, "RG_LateBinding_Receiver_impl::set_topic_name_getter - " - "Expected NonChangeable caught.\n")); - } - else - { - ACE_ERROR ((LM_ERROR, "RG_LateBinding_Receiver_impl::set_topic_name_getter - " - "ERROR: Caught NonChangeable exception.\n")); - } + ACE_ERROR ((LM_ERROR, "RG_LateBinding_Receiver_impl::set_topic_name_getter - " + "ERROR: Caught NonChangeable exception.\n")); } } } diff --git a/CIAO/connectors/dds4ccm/tests/LateBinding/ReadGet/Receiver/RG_LateBinding_Receiver_impl.h b/CIAO/connectors/dds4ccm/tests/LateBinding/ReadGet/Receiver/RG_LateBinding_Receiver_impl.h index 786fa95e26a..43d1198c287 100644 --- a/CIAO/connectors/dds4ccm/tests/LateBinding/ReadGet/Receiver/RG_LateBinding_Receiver_impl.h +++ b/CIAO/connectors/dds4ccm/tests/LateBinding/ReadGet/Receiver/RG_LateBinding_Receiver_impl.h @@ -52,8 +52,8 @@ namespace CIAO_RG_LateBinding_Receiver_Impl LastSampleChecker * checker_; - void set_topic_name_reader (bool test_non_changeable=false); - void set_topic_name_getter (bool test_non_changeable=false); + void set_topic_name_reader (); + void set_topic_name_getter (); void start_reading (void); void start_getting (void); diff --git a/CIAO/connectors/dds4ccm/tests/LateBinding/UpdateWrite/Sender/WU_LateBinding_Sender_exec.cpp b/CIAO/connectors/dds4ccm/tests/LateBinding/UpdateWrite/Sender/WU_LateBinding_Sender_exec.cpp index c11c0efe344..163fb3877b1 100644 --- a/CIAO/connectors/dds4ccm/tests/LateBinding/UpdateWrite/Sender/WU_LateBinding_Sender_exec.cpp +++ b/CIAO/connectors/dds4ccm/tests/LateBinding/UpdateWrite/Sender/WU_LateBinding_Sender_exec.cpp @@ -53,8 +53,8 @@ namespace CIAO_WU_LateBinding_Sender_Impl else if (assingment == 1) { this->callback_.start_state_test (); - this->callback_.set_topic_name_writer (true); - this->callback_.set_topic_name_updater (true); + this->callback_.set_topic_name_writer (); + this->callback_.set_topic_name_updater (); } return 0; } @@ -139,7 +139,7 @@ namespace CIAO_WU_LateBinding_Sender_Impl } void - Sender_exec_i::set_topic_name_writer (bool test_non_changeable) + Sender_exec_i::set_topic_name_writer (void) { try { @@ -166,29 +166,16 @@ namespace CIAO_WU_LateBinding_Sender_Impl "Unable to narrow connector interface\n")); throw ::CORBA::INTERNAL (); } - if (test_non_changeable) - { - conn->topic_name ("LateBindingTopicSecondTime"); - ACE_ERROR ((LM_ERROR, "Sender_exec_i::set_topic_name_writer - " - "ERROR: No NonChangeable exception thrown.\n")); - } - else - { - conn->topic_name ("LateBindingTopic"); - } + conn->topic_name ("LateBindingTopic"); } catch (const ::CCM_DDS::NonChangeable &) { - if (test_non_changeable) - { - ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::set_topic_name_writer - " - "Expected NonChangeable caught.\n")); - } - else - { - ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::set_topic_name_writer - " - "Caught NonChangeable exception.\n")); - } + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::set_topic_name_writer - " + "Caught NonChangeable exception.\n")); + } + catch (const ::CORBA::Exception &ex) + { + ex._tao_print_exception("ERROR: Sender_exec_i::set_topic_name_writer - "); } } @@ -234,7 +221,7 @@ namespace CIAO_WU_LateBinding_Sender_Impl } void - Sender_exec_i::set_topic_name_updater(bool test_non_changeable) + Sender_exec_i::set_topic_name_updater(void) { try { @@ -261,29 +248,16 @@ namespace CIAO_WU_LateBinding_Sender_Impl "Unable to narrow connector interface\n")); throw ::CORBA::INTERNAL (); } - if (test_non_changeable) - { - conn->topic_name ("LateBindingTopicSecondTime"); - ACE_ERROR ((LM_ERROR, "Sender_exec_i::set_topic_name_updater - " - "ERROR: No NonChangeable exception thrown.\n")); - } - else - { - conn->topic_name ("LateBindingTopic"); - } + conn->topic_name ("LateBindingTopic"); } catch (const ::CCM_DDS::NonChangeable &) { - if (test_non_changeable) - { - ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::set_topic_name_updater - " - "Expected NonChangeable caught.\n")); - } - else - { - ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::set_topic_name_updater - " - "Caught NonChangeable exception.\n")); - } + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::set_topic_name_updater - " + "Caught NonChangeable exception.\n")); + } + catch (const ::CORBA::Exception &ex) + { + ex._tao_print_exception("ERROR: Sender_exec_i::set_topic_name_writer - "); } } diff --git a/CIAO/connectors/dds4ccm/tests/LateBinding/UpdateWrite/Sender/WU_LateBinding_Sender_exec.h b/CIAO/connectors/dds4ccm/tests/LateBinding/UpdateWrite/Sender/WU_LateBinding_Sender_exec.h index 345d9dba5db..499bbe90312 100644 --- a/CIAO/connectors/dds4ccm/tests/LateBinding/UpdateWrite/Sender/WU_LateBinding_Sender_exec.h +++ b/CIAO/connectors/dds4ccm/tests/LateBinding/UpdateWrite/Sender/WU_LateBinding_Sender_exec.h @@ -98,8 +98,8 @@ namespace CIAO_WU_LateBinding_Sender_Impl //@{ /** User defined public operations. */ - void set_topic_name_writer (bool test_non_changeable=false); - void set_topic_name_updater (bool test_non_changeable=false); + void set_topic_name_writer (void); + void set_topic_name_updater (void); void start_event_test (void); void start_state_test (void); //@} diff --git a/CIAO/connectors/dds4ccm/tests/NonChangeableAttribute/Component/NonChangeable_Component_exec.cpp b/CIAO/connectors/dds4ccm/tests/NonChangeableAttribute/Component/NonChangeable_Component_exec.cpp index e0939d5a991..9519d15b3f6 100644 --- a/CIAO/connectors/dds4ccm/tests/NonChangeableAttribute/Component/NonChangeable_Component_exec.cpp +++ b/CIAO/connectors/dds4ccm/tests/NonChangeableAttribute/Component/NonChangeable_Component_exec.cpp @@ -31,21 +31,19 @@ namespace CIAO_NonChangeable_NonChangeableComponent_Impl try { conn->topic_name ("nonchangeable_test"); - ACE_ERROR ((LM_ERROR, "NonChangeable_Connector_exec_impl_i::test_topic_name - " - "ERROR: Able to set topic name without " - "an exception.\n")); + ACE_DEBUG ((LM_DEBUG, "NonChangeable_Connector_exec_impl_i::test_topic_name - " + "Able to reset topic name without an exception.\n")); + return true; } catch (const ::CCM_DDS::NonChangeable &) { - ACE_DEBUG ((LM_DEBUG, "NonChangeable_Connector_exec_impl_i::test_topic_name - " - "Caught expected exception.\n")); - return true; + ACE_ERROR ((LM_ERROR, "NonChangeable_Connector_exec_impl_i::test_topic_name - " + "ERROR: Unable to reset topic name.\n")); } catch (...) { ACE_ERROR ((LM_ERROR, "NonChangeable_Connector_exec_impl_i::test_topic_name - " "ERROR: Caught unexpected exception.\n")); - return false; } return false; } diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/README b/CIAO/connectors/dds4ccm/tests/ResetTopic/README new file mode 100644 index 00000000000..c2d71f3d08b --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/README @@ -0,0 +1,32 @@ +// $Id$ + +In the early days of the DDS4CCM specification a topic name was not changable. +When it was set (doesn't matter if it was a late binded topic), the user was not +allowed to change it, otherwise a NonChangeable exception was thrown. + +The requirement from the field dictates that a topic name should be changeable. +When the topic name will be set a second time, the connector should shut down +DDS and start it again, using the new topic name. The connector does not tear +down the proxies. This means that the connector doesn't change on the outside. + +The ReadGet test has the following sequence: +1. Sender starts writing samples for TopicI +2. Sender informs the Receiver that samples has been written for TopicI +3. Receiver sets this topic name on his connector (late binding), and starts to + collect the samples. +4. Sender resets the topic name to TopicII and informs the receiver about this. +5. Receiver resets the topic name on his connector and starts collecting the + samples belonging to TopicII. + +Both listeners tests (UpdateListen and WriteListen) have about the same sequence: +1. Sender and Receiver start, writing and listening to the same topic. +2. After 10 second, the perl script starts two small executables; one to inform + the receiver to switch to topic II and one to inform the sender to switch to + topic II. The executables are spawned in this order. +3. Step one is repeated. +4. Step two will be repeated. + +The ToEmpty test will initially start writing samples for TopicI. After a while, +the topic name will be cleared. This means that the connector internally stops DDS. +After another while, the sender will start writing samples again, +but now for TopicII. This sequence repeats. diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Base/RG_ResetTopic_Base.idl b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Base/RG_ResetTopic_Base.idl new file mode 100644 index 00000000000..5a7452f2015 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Base/RG_ResetTopic_Base.idl @@ -0,0 +1,23 @@ +// $Id$ + +/** + * @file RG_ResetTopic_Base.idl + * @author Marcel Smit <msmit@remedy.nl> + */ + +#ifndef RG_RESETTOPIC_BASE_IDL +#define RG_RESETTOPIC_BASE_IDL + +#pragma ndds typesupport "Base/RG_ResetTopic_BaseSupport.h" + +#pragma DCPS_DATA_TYPE "RG_ResetTopicSample" +#pragma DCPS_DATA_KEY "RG_ResetTopicSample key" + +struct RG_ResetTopicSample { + string key; //@key + long iteration; +}; + +typedef sequence<RG_ResetTopicSample> RG_ResetTopicSampleSeq; + +#endif diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Base/RG_ResetTopic_Base.mpc b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Base/RG_ResetTopic_Base.mpc new file mode 100644 index 00000000000..36560836af9 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Base/RG_ResetTopic_Base.mpc @@ -0,0 +1,26 @@ +// $Id$ + +project (RG_ResetTopicBase_stub) : taoidldefaults, dds4ccm_ts_default { + sharedname = RG_ResetTopicBase_stub + dynamicflags += RG_RESETTOPIC_BASE_STUB_BUILD_DLL + libout = ../lib + + idlflags += -SS -Sci \ + -Wb,stub_export_macro=RG_RESETTOPIC_BASE_STUB_Export \ + -Wb,stub_export_include=LateBinding_Base_stub_export.h + + IDL_Files { + idlflags += -Gxhst + RG_ResetTopic_Base.idl + } + + opendds_ts_flags += --export=RG_RESETTOPIC_BASE_STUB_Export + + DDSGenerator_Files { + RG_ResetTopic_Base.idl + } + + Source_Files { + } +} + diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Base/Reader_Starter.idl b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Base/Reader_Starter.idl new file mode 100644 index 00000000000..bf198b37ea7 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Base/Reader_Starter.idl @@ -0,0 +1,20 @@ +// $Id$ + +/** + * @file Reader_Starter.idl + * @author Marcel Smit <msmit@remedy.nl> + */ + +#ifndef READER_STARTER_IDL +#define READER_STARTER_IDL + +#pragma ciao lem "Base/Reader_StarterE.idl" + +interface ReaderStarter +{ + void start_read (in string topic_name); + void set_reader_properties (in unsigned short nr_keys, + in unsigned short nr_iterations); +}; + +#endif /* READER_STARTER_IDL */ diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Base/Reader_Starter.mpc b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Base/Reader_Starter.mpc new file mode 100755 index 00000000000..050904fd873 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Base/Reader_Starter.mpc @@ -0,0 +1,113 @@ +// $Id$ + +project(reader_starter_rt_idl_gen) : componentidldefaults, dds4ccm { + custom_only = 1 + after += + idlflags += -Wb,stub_export_macro=READER_STARTER_STUB_Export \ + -Wb,stub_export_include=reader_starter_rt_stub_export.h \ + -Wb,skel_export_macro=READER_STARTER_SVNT_Export \ + -Wb,skel_export_include=reader_starter_rt_svnt_export.h \ + -Wb,svnt_export_macro=READER_STARTER_SVNT_Export \ + -Wb,svnt_export_include=reader_starter_rt_svnt_export.h \ + -Wb,exec_export_macro=READER_STARTER_EXEC_Export \ + -Wb,exec_export_include=Reader_Starter_exec_export.h -I.. + + IDL_Files { + Reader_Starter.idl + } +} + +project(reader_starter_rt_lem_gen) : ciaoidldefaults, dds4ccm { + after += reader_starter_rt_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=READER_STARTER_LEM_STUB_Export \ + -Wb,stub_export_include=reader_starter_rt_lem_stub_export.h \ + -SS -Gxhst -I.. + + IDL_Files { + Reader_StarterE.idl + } +} + +project(reader_starter_rt_lem_stub) : ccm_svnt, dds4ccm_base { + after += reader_starter_rt_lem_gen reader_starter_rt_stub + libs += reader_starter_rt_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = reader_starter_rt_lem_stub + dynamicflags += READER_STARTER_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Reader_StarterEC.cpp + } + + Header_Files { + Reader_StarterEC.h + reader_starter_rt_lem_stub_export.h + } + + Inline_Files { + Reader_StarterEC.inl + } +} + +project(reader_starter_rt_stub) : ccm_stub, dds4ccm_base { + after += reader_starter_rt_idl_gen + libs += + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = reader_starter_rt_stub + dynamicflags += READER_STARTER_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Reader_StarterC.cpp + } + + Header_Files { + Reader_StarterC.h + reader_starter_rt_stub_export.h + } + + Inline_Files { + Reader_StarterC.inl + } +} + + +project(reader_starter_rt_svnt) : ciao_servant, dds4ccm_lem_stub, dds4ccm_skel { + after += reader_starter_rt_lem_stub reader_starter_rt_stub + sharedname = reader_starter_rt_svnt + libs += reader_starter_rt_stub reader_starter_rt_lem_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += READER_STARTER_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Reader_StarterS.cpp + Reader_Starter_svnt.cpp + } + + Header_Files { + Reader_StarterS.h + Reader_Starter_svnt.h + reader_starter_rt_svnt_export.h + } + + Inline_Files { + Reader_StarterS.inl + } +} + + diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Connector/RG_ResetTopic_Connector.idl b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Connector/RG_ResetTopic_Connector.idl new file mode 100644 index 00000000000..1da3f3494d0 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Connector/RG_ResetTopic_Connector.idl @@ -0,0 +1,23 @@ +// $Id$ + +/** + * @file RG_ResetTopic_Connector.idl + * @author Marcel Smit <msmit@remedy.nl> + */ + +#ifndef RG_RESETTOPIC_CONNECTOR_IDL_ +#define RG_RESETTOPIC_CONNECTOR_IDL_ + +#include <Components.idl> +#include <ccm_dds.idl> + +#include "Base/RG_ResetTopic_Base.idl" + +#pragma ciao lem "Connector/RG_ResetTopic_ConnectorE.idl" + +module RG_ResetTopic +{ + module ::CCM_DDS::Typed < ::RG_ResetTopicSample, ::RG_ResetTopicSampleSeq> RG_ResetTopicSampleConnector; +}; + +#endif /* RG_ResetTopic_CONNECTOR_IDL_ */ diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Connector/RG_ResetTopic_Connector.mpc b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Connector/RG_ResetTopic_Connector.mpc new file mode 100644 index 00000000000..f5e8207275a --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Connector/RG_ResetTopic_Connector.mpc @@ -0,0 +1,148 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p RG_ResetTopicBase -l .. -o ../lib -u DDS RG_ResetTopic_Connector" + +project (RG_ResetTopicConnector_idl_gen) : connectoridldefaults, dds4ccm { + after += DDS4CCM_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=RG_RESETTOPIC_CONNECTOR_STUB_Export \ + -Wb,stub_export_include=LateBinding_Connector_stub_export.h \ + -Wb,skel_export_macro=RG_RESETTOPIC_CONNECTOR_SVNT_Export \ + -Wb,skel_export_include=LateBinding_Connector_svnt_export.h \ + -Wb,svnt_export_macro=RG_RESETTOPIC_CONNECTOR_SVNT_Export \ + -Wb,svnt_export_include=LateBinding_Connector_svnt_export.h \ + -Wb,conn_export_macro=RG_RESETTOPIC_CONNECTOR_CONN_Export \ + -Wb,conn_export_include=LateBinding_Connector_conn_export.h \ + -I .. + + IDL_Files { + RG_ResetTopic_Connector.idl + } +} + +project (RG_ResetTopicConnector_lem_gen) : ciaoidldefaults, dds4ccm { + custom_only = 1 + after += RG_ResetTopicConnector_idl_gen + idlflags += -Wb,stub_export_macro=RG_RESETTOPIC_CONNECTOR_LEM_STUB_Export \ + -Wb,stub_export_include=RG_ResetTopic_Connector_lem_stub_export.h \ + -SS -Gxhst \ + -I .. + + IDL_Files { + RG_ResetTopic_ConnectorE.idl + } +} + +project (RG_ResetTopicConnector_lem_stub) : ccm_svnt, dds4ccm_lem_stub { + after += RG_ResetTopicConnector_lem_gen RG_ResetTopicConnector_stub \ + RG_ResetTopicBase_stub + libs += RG_ResetTopicBase_stub RG_ResetTopicConnector_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = RG_ResetTopicConnector_lem_stub + dynamicflags += RG_RESETTOPIC_CONNECTOR_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + RG_ResetTopic_ConnectorEC.cpp + } + + Header_Files { + RG_ResetTopic_ConnectorEC.h + RG_ResetTopic_Connector_lem_stub_export.h + } + + Inline_Files { + RG_ResetTopic_ConnectorEC.inl + } +} + +project (RG_ResetTopicConnector_stub) : ccm_stub, dds4ccm_base { + after += RG_ResetTopicConnector_idl_gen RG_ResetTopicBase_stub + libs += RG_ResetTopicBase_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = RG_ResetTopicConnector_stub + dynamicflags += RG_RESETTOPIC_CONNECTOR_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + RG_ResetTopic_ConnectorC.cpp + } + + Header_Files { + RG_ResetTopic_ConnectorC.h + RG_ResetTopic_Connector_stub_export.h + } + + Inline_Files { + RG_ResetTopic_ConnectorC.inl + } +} + +project (RG_ResetTopicConnector_exec) : ciao_executor, dds4ccm_impl { + after += RG_ResetTopicConnector_lem_stub RG_ResetTopicConnector_stub \ + RG_ResetTopicBase_stub + sharedname = RG_ResetTopicConnector_exec + libs += RG_ResetTopicConnector_stub RG_ResetTopicConnector_lem_stub \ + RG_ResetTopicBase_stub RG_ResetTopicBase_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += RG_RESETTOPIC_CONNECTOR_CONN_BUILD_DLL + + IDL_Files { + } + + Source_Files { + RG_ResetTopic_Connector_conn.cpp + } + + Header_Files { + RG_ResetTopic_Connector_conn.h + RG_ResetTopic_Connector_conn_export.h + } + + Inline_Files { + } +} + + +project (RG_ResetTopicConnector_svnt) : ciao_servant, dds4ccm_impl { + after += RG_ResetTopicConnector_lem_stub RG_ResetTopicConnector_exec \ + RG_ResetTopicConnector_stub + sharedname = RG_ResetTopicConnector_svnt + libs += RG_ResetTopicConnector_stub \ + RG_ResetTopicConnector_lem_stub \ + RG_ResetTopicBase_stub \ + RG_ResetTopicConnector_exec + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += RG_RESETTOPIC_CONNECTOR_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + RG_ResetTopic_ConnectorS.cpp + RG_ResetTopic_Connector_svnt.cpp + } + + Header_Files { + RG_ResetTopic_ConnectorS.h + RG_ResetTopic_Connector_svnt.h + RG_ResetTopic_Connector_svnt_export.h + } + + Inline_Files { + RG_ResetTopic_ConnectorS.inl + } +} + + diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver.idl b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver.idl new file mode 100644 index 00000000000..1a3d83d66c6 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver.idl @@ -0,0 +1,25 @@ +// $Id$ + +/** + * @file + * @author Marcel Smit <msmit@remedy.nl> + */ + +#ifndef RECEIVER_IDL +#define RECEIVER_IDL + +#include "Connector/RG_ResetTopic_Connector.idl" +#include "Base/Reader_Starter.idl" + +module RG_ResetTopic +{ + component Receiver + { + port RG_ResetTopicSampleConnector::DDS_Get info_get; + port RG_ResetTopicSampleConnector::DDS_Read info_read; + + provides ReaderStarter start_reading; + }; +}; + +#endif diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver.mpc b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver.mpc new file mode 100644 index 00000000000..fe2ed2dae50 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver.mpc @@ -0,0 +1,158 @@ +// $Id$ + +project (RG_ResetTopicReceiver_idl_gen) : componentidldefaults, dds4ccm { + custom_only = 1 + after += RG_ResetTopicConnector_idl_gen + idlflags += -Wb,stub_export_macro=RECEIVER_STUB_Export \ + -Wb,stub_export_include=Receiver_stub_export.h \ + -Wb,skel_export_macro=RECEIVER_SVNT_Export \ + -Wb,skel_export_include=Receiver_svnt_export.h \ + -Wb,svnt_export_macro=RECEIVER_SVNT_Export \ + -Wb,svnt_export_include=Receiver_svnt_export.h \ + -Wb,exec_export_macro=RECEIVER_EXEC_Export \ + -Wb,exec_export_include=Receiver_exec_export.h \ + -I.. + IDL_Files { + RG_ResetTopic_Receiver.idl + } +} + +project (RG_ResetTopicReceiver_lem_gen) : ciaoidldefaults, dds4ccm { + after += RG_ResetTopicReceiver_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=RECEIVER_LEM_STUB_Export \ + -Wb,stub_export_include=Receiver_lem_stub_export.h \ + -SS -Gxhst -I.. + + IDL_Files { + RG_ResetTopic_ReceiverE.idl + } +} + +project (RG_ResetTopicReceiver_lem_stub) : ccm_svnt, dds4ccm_base { + after += RG_ResetTopicReceiver_lem_gen RG_ResetTopicReceiver_stub RG_ResetTopicConnector_stub \ + RG_ResetTopicBase_stub reader_starter_rt_stub + libs += Receiver_stub RG_ResetTopicConnector_stub RG_ResetTopicBase_stub \ + reader_starter_rt_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = Receiver_lem_stub + dynamicflags += RECEIVER_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + RG_ResetTopic_ReceiverEC.cpp + } + + Header_Files { + RG_ResetTopic_ReceiverEC.h + Receiver_lem_stub_export.h + } + + Inline_Files { + RG_ResetTopic_ReceiverEC.inl + } +} + +project (RG_ResetTopicReceiver_stub) : ccm_stub, dds4ccm_base { + after += RG_ResetTopicReceiver_idl_gen RG_ResetTopicConnector_stub \ + RG_ResetTopicBase_stub RG_ResetTopicConnector_lem_gen \ + reader_starter_rt_stub reader_starter_rt_lem_stub + libs += RG_ResetTopicConnector_stub RG_ResetTopicBase_stub \ + reader_starter_rt_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = Receiver_stub + dynamicflags += RECEIVER_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + RG_ResetTopic_ReceiverC.cpp + } + + Header_Files { + RG_ResetTopic_ReceiverC.h + Receiver_stub_export.h + } + + Inline_Files { + RG_ResetTopic_ReceiverC.inl + } +} + +project (RG_ResetTopicReceiver_exec) : ciao_executor, dds4ccm_lem_stub { + after += RG_ResetTopicReceiver_lem_stub RG_ResetTopicReceiver_stub \ + RG_ResetTopicBase_stub RG_ResetTopicConnector_stub \ + RG_ResetTopicConnector_lem_stub \ + reader_starter_rt_lem_stub reader_starter_rt_stub + sharedname = Receiver_exec + libs += Receiver_stub Receiver_lem_stub RG_ResetTopicBase_stub \ + RG_ResetTopicConnector_stub RG_ResetTopicConnector_lem_stub \ + reader_starter_rt_lem_stub reader_starter_rt_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += RECEIVER_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + RG_ResetTopic_Receiver_exec.cpp + RG_ResetTopic_Receiver_impl.cpp + } + + Header_Files { + RG_ResetTopic_Receiver_exec.h + RG_ResetTopic_Receiver_impl.h + Receiver_exec_export.h + } + + Inline_Files { + } +} + + +project (RG_ResetTopicReceiver_svnt) : ciao_servant, dds4ccm_lem_stub, dds4ccm_skel { + after += RG_ResetTopicReceiver_lem_stub RG_ResetTopicBase_stub \ + RG_ResetTopicConnector_stub RG_ResetTopicConnector_svnt \ + RG_ResetTopicReceiver_exec RG_ResetTopicConnector_lem_stub \ + reader_starter_rt_stub \ + reader_starter_rt_svnt reader_starter_rt_lem_stub + sharedname = Receiver_svnt + libs += Receiver_stub Receiver_lem_stub RG_ResetTopicBase_stub \ + RG_ResetTopicConnector_stub RG_ResetTopicConnector_svnt \ + Receiver_exec RG_ResetTopicConnector_lem_stub \ + reader_starter_rt_stub reader_starter_rt_svnt \ + reader_starter_rt_lem_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += RECEIVER_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + RG_ResetTopic_ReceiverS.cpp + RG_ResetTopic_Receiver_svnt.cpp + } + + Header_Files { + RG_ResetTopic_ReceiverS.h + RG_ResetTopic_Receiver_svnt.h + Receiver_svnt_export.h + } + + Inline_Files { + RG_ResetTopic_ReceiverS.inl + } +} + + diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_exec.cpp b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_exec.cpp new file mode 100644 index 00000000000..02b5ea6f723 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_exec.cpp @@ -0,0 +1,283 @@ +// -*- C++ -*- +// $Id$ + +#include "RG_ResetTopic_Receiver_exec.h" +#include "RG_ResetTopic_Receiver_impl.h" + +namespace CIAO_RG_ResetTopic_Receiver_Impl +{ + + /** + * Facet Executor Implementation Class: info_get_status_exec_i + */ + + info_get_status_exec_i::info_get_status_exec_i ( + ::RG_ResetTopic::CCM_Receiver_Context_ptr ctx) + : ciao_context_ ( + ::RG_ResetTopic::CCM_Receiver_Context::_duplicate (ctx)) + { + } + + info_get_status_exec_i::~info_get_status_exec_i (void) + { + } + + // Operations from ::CCM_DDS::PortStatusListener + + void + info_get_status_exec_i::on_requested_deadline_missed (::DDS::DataReader_ptr /* the_reader */, + const ::DDS::RequestedDeadlineMissedStatus & /* status */) + { + /* Your code here. */ + } + + void + info_get_status_exec_i::on_sample_lost (::DDS::DataReader_ptr /* the_reader */, + const ::DDS::SampleLostStatus & /* status */) + { + /* Your code here. */ + } + + /** + * Facet Executor Implementation Class: info_read_status_exec_i + */ + + info_read_status_exec_i::info_read_status_exec_i ( + ::RG_ResetTopic::CCM_Receiver_Context_ptr ctx) + : ciao_context_ ( + ::RG_ResetTopic::CCM_Receiver_Context::_duplicate (ctx)) + { + } + + info_read_status_exec_i::~info_read_status_exec_i (void) + { + } + + // Operations from ::CCM_DDS::PortStatusListener + + void + info_read_status_exec_i::on_requested_deadline_missed (::DDS::DataReader_ptr /* the_reader */, + const ::DDS::RequestedDeadlineMissedStatus & /* status */) + { + /* Your code here. */ + } + + void + info_read_status_exec_i::on_sample_lost (::DDS::DataReader_ptr /* the_reader */, + const ::DDS::SampleLostStatus & /* status */) + { + /* Your code here. */ + } + + /** + * Facet Executor Implementation Class: start_reading_exec_i + */ + + start_reading_exec_i::start_reading_exec_i ( + ::RG_ResetTopic::CCM_Receiver_Context_ptr ctx, + Receiver_exec_i &callback) + : ciao_context_ ( + ::RG_ResetTopic::CCM_Receiver_Context::_duplicate (ctx)) + , callback_ (callback) + { + } + + start_reading_exec_i::~start_reading_exec_i (void) + { + } + + // Operations from ::ReaderStarter + + void + start_reading_exec_i::start_read (const char * topic_name) + { + this->callback_.start_read (topic_name); + } + + void + start_reading_exec_i::set_reader_properties (::CORBA::UShort nr_keys, + ::CORBA::UShort nr_iterations) + { + this->callback_.keys (nr_keys); + this->callback_.iterations (nr_iterations); + } + + /** + * Component Executor Implementation Class: Receiver_exec_i + */ + + Receiver_exec_i::Receiver_exec_i (void) + : iterations_ (10) + , keys_ (5) + , impl_(0) + { + } + + Receiver_exec_i::~Receiver_exec_i (void) + { + delete this->impl_; + } + + // Supported operations and attributes. + ::CORBA::UShort + Receiver_exec_i::iterations (void) + { + return this->iterations_; + } + + void + Receiver_exec_i::iterations ( + const ::CORBA::UShort iterations) + { + this->iterations_ = iterations; + if (this->impl_) + { + this->impl_->iterations (iterations); + } + } + + ::CORBA::UShort + Receiver_exec_i::keys (void) + { + return this->keys_; + } + + void + Receiver_exec_i::keys ( + const ::CORBA::UShort keys) + { + this->keys_ = keys; + if (this->impl_) + { + this->impl_->keys (keys); + } + } + + void + Receiver_exec_i::start_read (const char * topic_name) + { + if (!this->impl_) + ACE_NEW_THROW_EX (this->impl_, + RG_ResetTopic_Receiver_impl ( + this->ciao_context_.in (), + this->iterations_, + this->keys_), + ::CORBA::INTERNAL ()); + this->impl_->start (topic_name); + } + + // Component attributes and port operations. + + ::CCM_DDS::CCM_PortStatusListener_ptr + Receiver_exec_i::get_info_get_status (void) + { + if ( ::CORBA::is_nil (this->ciao_info_get_status_.in ())) + { + info_get_status_exec_i *tmp = 0; + ACE_NEW_RETURN ( + tmp, + info_get_status_exec_i ( + this->ciao_context_.in ()), + ::CCM_DDS::CCM_PortStatusListener::_nil ()); + + this->ciao_info_get_status_ = tmp; + } + + return + ::CCM_DDS::CCM_PortStatusListener::_duplicate ( + this->ciao_info_get_status_.in ()); + } + + ::CCM_DDS::CCM_PortStatusListener_ptr + Receiver_exec_i::get_info_read_status (void) + { + if ( ::CORBA::is_nil (this->ciao_info_read_status_.in ())) + { + info_read_status_exec_i *tmp = 0; + ACE_NEW_RETURN ( + tmp, + info_read_status_exec_i ( + this->ciao_context_.in ()), + ::CCM_DDS::CCM_PortStatusListener::_nil ()); + + this->ciao_info_read_status_ = tmp; + } + + return + ::CCM_DDS::CCM_PortStatusListener::_duplicate ( + this->ciao_info_read_status_.in ()); + } + + ::CCM_ReaderStarter_ptr + Receiver_exec_i::get_start_reading (void) + { + if ( ::CORBA::is_nil (this->ciao_start_reading_.in ())) + { + start_reading_exec_i *tmp = 0; + ACE_NEW_RETURN ( + tmp, + start_reading_exec_i ( + this->ciao_context_.in (), + *this), + ::CCM_ReaderStarter::_nil ()); + + this->ciao_start_reading_ = tmp; + } + + return + ::CCM_ReaderStarter::_duplicate ( + this->ciao_start_reading_.in ()); + } + + // Operations from Components::SessionComponent. + + void + Receiver_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + this->ciao_context_ = + ::RG_ResetTopic::CCM_Receiver_Context::_narrow (ctx); + + if ( ::CORBA::is_nil (this->ciao_context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + Receiver_exec_i::configuration_complete (void) + { + /* Your code here. */ + } + + void + Receiver_exec_i::ccm_activate (void) + { + /* Your code here. */ + } + + void + Receiver_exec_i::ccm_passivate (void) + { + /* Your code here. */ + } + + void + Receiver_exec_i::ccm_remove (void) + { + /* Your code here. */ + } + + extern "C" RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_RG_ResetTopic_Receiver_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_NORETURN ( + retval, + Receiver_exec_i); + + return retval; + } +} diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_exec.h b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_exec.h new file mode 100644 index 00000000000..6b772b6a35e --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_exec.h @@ -0,0 +1,194 @@ +// -*- C++ -*- +// $Id$ + +#ifndef CIAO_RG_RESETTOPIC_RECEIVER_EXEC_MMKH3G_H_ +#define CIAO_RG_RESETTOPIC_RECEIVER_EXEC_MMKH3G_H_ + +#include /**/ "ace/pre.h" + +#include "RG_ResetTopic_ReceiverEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ "Receiver_exec_export.h" +#include "tao/LocalObject.h" + +namespace CIAO_RG_ResetTopic_Receiver_Impl +{ + class Receiver_exec_i; + class RG_ResetTopic_Receiver_impl; + /** + * Provider Executor Implementation Class: info_get1_status_exec_i + */ + + class info_get_status_exec_i + : public virtual ::CCM_DDS::CCM_PortStatusListener, + public virtual ::CORBA::LocalObject + { + public: + info_get_status_exec_i ( + ::RG_ResetTopic::CCM_Receiver_Context_ptr ctx); + virtual ~info_get_status_exec_i (void); + + /** @name Operations and attributes from CCM_DDS::PortStatusListener */ + //@{ + + virtual + void on_requested_deadline_missed (::DDS::DataReader_ptr the_reader, + const ::DDS::RequestedDeadlineMissedStatus & status); + + virtual + void on_sample_lost (::DDS::DataReader_ptr the_reader, + const ::DDS::SampleLostStatus & status); + //@} + + private: + ::RG_ResetTopic::CCM_Receiver_Context_var ciao_context_; + }; + + /** + * Provider Executor Implementation Class: info_read1_status_exec_i + */ + + class info_read_status_exec_i + : public virtual ::CCM_DDS::CCM_PortStatusListener, + public virtual ::CORBA::LocalObject + { + public: + info_read_status_exec_i ( + ::RG_ResetTopic::CCM_Receiver_Context_ptr ctx); + virtual ~info_read_status_exec_i (void); + + /** @name Operations and attributes from CCM_DDS::PortStatusListener */ + //@{ + + virtual + void on_requested_deadline_missed (::DDS::DataReader_ptr the_reader, + const ::DDS::RequestedDeadlineMissedStatus & status); + + virtual + void on_sample_lost (::DDS::DataReader_ptr the_reader, + const ::DDS::SampleLostStatus & status); + //@} + + private: + ::RG_ResetTopic::CCM_Receiver_Context_var ciao_context_; + }; + + /** + * Provider Executor Implementation Class: start_reading_exec_i + */ + + class start_reading_exec_i + : public virtual ::CCM_ReaderStarter, + public virtual ::CORBA::LocalObject + { + public: + start_reading_exec_i ( + ::RG_ResetTopic::CCM_Receiver_Context_ptr ctx, + Receiver_exec_i &callback_); + virtual ~start_reading_exec_i (void); + + /** @name Operations and attributes from ReaderStarter */ + //@{ + + virtual + void start_read (const char * topic_name); + + virtual + void set_reader_properties (::CORBA::UShort nr_keys, + ::CORBA::UShort nr_iterations); + //@} + + private: + ::RG_ResetTopic::CCM_Receiver_Context_var ciao_context_; + Receiver_exec_i &callback_; + }; + + /** + * Component Executor Implementation Class: Receiver_exec_i + */ + + class Receiver_exec_i + : public virtual Receiver_Exec, + public virtual ::CORBA::LocalObject + { + public: + Receiver_exec_i (void); + virtual ~Receiver_exec_i (void); + + /** @name Supported operations and attributes. */ + //@{ + + //@} + + /** @name Component attributes and port operations. */ + //@{ + + virtual ::CCM_DDS::CCM_PortStatusListener_ptr + get_info_get_status (void); + + virtual ::CCM_DDS::CCM_PortStatusListener_ptr + get_info_read_status (void); + + virtual ::CCM_ReaderStarter_ptr + get_start_reading (void); + + virtual ::CORBA::UShort iterations (void); + + virtual void iterations (::CORBA::UShort iterations); + + virtual ::CORBA::UShort keys (void); + + virtual void keys (::CORBA::UShort keys); + //@} + + /** @name Operations from Components::SessionComponent. */ + //@{ + virtual void set_session_context (::Components::SessionContext_ptr ctx); + virtual void configuration_complete (void); + virtual void ccm_activate (void); + virtual void ccm_passivate (void); + virtual void ccm_remove (void); + //@} + + /** @name User defined public operations. */ + //@{ + void + start_read (const char * topic_name); + //@} + + private: + ::RG_ResetTopic::CCM_Receiver_Context_var ciao_context_; + + /** @name Component attributes. */ + //@{ + ::CCM_DDS::CCM_PortStatusListener_var ciao_info_get_status_; + ::CCM_DDS::CCM_PortStatusListener_var ciao_info_read_status_; + ::CCM_ReaderStarter_var ciao_start_reading_; + + ::CORBA::UShort iterations_; + + ::CORBA::UShort keys_; + //@} + + /** @name User defined members. */ + //@{ + RG_ResetTopic_Receiver_impl *impl_; + //@} + + /** @name User defined private operations. */ + //@{ + + //@} + }; + + extern "C" RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_RG_ResetTopic_Receiver_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* ifndef */ diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_impl.cpp b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_impl.cpp new file mode 100644 index 00000000000..f25757e9552 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_impl.cpp @@ -0,0 +1,395 @@ +// $Id$ +#include "RG_ResetTopic_Receiver_impl.h" +#include "tao/ORB_Core.h" +#include "ace/Reactor.h" + +namespace CIAO_RG_ResetTopic_Receiver_Impl +{ + + /** + * Check last + */ + LastSampleChecker::LastSampleChecker (RG_ResetTopic_Receiver_impl &callback, + const ::CORBA::UShort &iterations) + : callback_ (callback) + , iterations_ (iterations) + { + } + + LastSampleChecker::~LastSampleChecker () + { + } + + int + LastSampleChecker::handle_timeout (const ACE_Time_Value &, const void *) + { + ACE_DEBUG ((LM_DEBUG, "Checking if last sample " + "is available in DDS...\n")); + if (this->callback_.check_last ()) + this->callback_.start_read (); + return 0; + } + + /** + * RG_ResetTopic_Receiver_impl + */ + RG_ResetTopic_Receiver_impl::RG_ResetTopic_Receiver_impl ( + ::RG_ResetTopic::CCM_Receiver_Context_ptr ctx, + const ::CORBA::UShort & iterations, + const ::CORBA::UShort & keys) + : ciao_context_ ( + ::RG_ResetTopic::CCM_Receiver_Context::_duplicate (ctx)) + , iterations_ (iterations) + , keys_ (keys) + , expected_per_run_ (keys * iterations) + , checker_ (0) + , topic_name_("") + { + } + + RG_ResetTopic_Receiver_impl::~RG_ResetTopic_Receiver_impl () + { + delete this->checker_; + } + + ACE_Reactor* + RG_ResetTopic_Receiver_impl::reactor (void) + { + ACE_Reactor* reactor = 0; + ::CORBA::Object_var ccm_object = + this->ciao_context_->get_CCM_object(); + if (! ::CORBA::is_nil (ccm_object.in ())) + { + ::CORBA::ORB_var orb = ccm_object->_get_orb (); + if (! ::CORBA::is_nil (orb.in ())) + { + reactor = orb->orb_core ()->reactor (); + } + } + if (reactor == 0) + { + throw ::CORBA::INTERNAL (); + } + return reactor; + } + + void + RG_ResetTopic_Receiver_impl::iterations (::CORBA::UShort iterations) + { + this->iterations_ = iterations; + } + + void + RG_ResetTopic_Receiver_impl::keys (::CORBA::UShort keys) + { + this->keys_= keys; + } + + bool + RG_ResetTopic_Receiver_impl::check_last (void) + { + ::RG_ResetTopic::RG_ResetTopicSampleConnector::Reader_var reader = + this->ciao_context_->get_connection_info_read_data (); + try + { + ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::check_last - " + "last iteration should be <%02d>\n", + this->iterations_)); + RG_ResetTopicSample datum; + ::CCM_DDS::ReadInfo readinfo; + char key[10]; + ACE_OS::sprintf (key, "KEY_%d", this->keys_); + datum.key = CORBA::string_dup (key); + reader->read_one_last ( + datum, + readinfo, + ::DDS::HANDLE_NIL); + ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::check_last - " + "last iteration <%02d> - <%02d>\n", + datum.iteration, + this->iterations_)); + return datum.iteration >= this->iterations_; + } + catch (const ::CCM_DDS::InternalError &) + { + ACE_DEBUG ((LM_DEBUG, "INTERNAL ERROR\n")); + } + catch (const ::CCM_DDS::NonExistent &) + { + ACE_DEBUG ((LM_DEBUG, "NONEXISTENT\n")); + } + catch (...) + { + ACE_ERROR ((LM_ERROR, "Receiver_exec_i::check_last: " + "ERROR: Unexpected exception caught\n")); + } + return false; + } + + void + RG_ResetTopic_Receiver_impl::start (const char * topic_name) + { + this->topic_name_ = topic_name; + //only the first time... + if (!this->checker_) + this->test_exception (); + this->set_topic_name_reader (topic_name); + + if (!this->checker_) + ACE_NEW_THROW_EX (this->checker_, + LastSampleChecker (*this, + this->iterations_), + ::CORBA::NO_MEMORY ()); + if (this->reactor ()->schedule_timer (this->checker_, + 0, + ACE_Time_Value (1, 0), + ACE_Time_Value (1, 0)) == -1) + { + ACE_ERROR ((LM_ERROR, "Receiver_exec_i::schedule_timer - " + "ERROR: Error while starting LastSampleChecker\n")); + } + } + + void + RG_ResetTopic_Receiver_impl::start_read (void) + { + if (this->checker_) + { + this->reactor ()->cancel_timer (this->checker_); + } + this->start_reading (); + this->set_topic_name_getter (this->topic_name_.c_str()); + this->start_getting (); + } + + void + RG_ResetTopic_Receiver_impl::check_samples ( + const char * test, + const RG_ResetTopicSampleSeq& samples, + const ::CORBA::UShort& expected) + { + bool error = samples.length () != expected; + if (ACE_OS::strcmp (test, "get") == 0) + { + error = !(samples.length () > 0); + } + if (error) + { + ACE_ERROR ((LM_ERROR, "RG_ResetTopic_Receiver_impl::check_samples - " + "ERROR: Unexpected number of %C samples received: " + "expected <%d> - received <%u>\n", + test, + expected, + samples.length ())); + } + else + { + ACE_DEBUG ((LM_DEBUG, "RG_ResetTopic_Receiver_impl::check_samples - " + "%C Samples found: <%u>\n", + test, + samples.length ())); + } + for (::CORBA::ULong i = 0; + i < samples.length (); + ++i) + { + ACE_DEBUG ((LM_DEBUG, "RG_ResetTopic_Receiver_impl::check_samples - " + "Sample %C: sample <%d> - key <%C> - iteration <%d>\n", + test, + i, + samples[i].key.in (), + samples[i].iteration)); + } + } + + void + RG_ResetTopic_Receiver_impl::test_exception (void) + { + try + { + if (! ::CORBA::is_nil (this->ciao_context_.in ())) + { + ::RG_ResetTopic::RG_ResetTopicSampleConnector::Reader_var reader = + this->ciao_context_->get_connection_info_read_data (); + if (::CORBA::is_nil (reader.in ())) + { + ACE_ERROR ((LM_ERROR, "RG_ResetTopic_Receiver_impl::test_exception - " + "ERROR: Unable to get reader interface from the " + "CIAO context\n")); + return; + } + + RG_ResetTopicSample sample; + ::CCM_DDS::ReadInfo readinfo; + sample.key = CORBA::string_dup ("KEY_1"); + reader->read_one_last (sample, + readinfo, + ::DDS::HANDLE_NIL); + ACE_ERROR ((LM_ERROR, "RG_ResetTopic_Receiver_impl::test_exception - " + "ERROR: No exception caught before topic name has been set\n")); + } + else + { + ACE_ERROR ((LM_ERROR, "RG_ResetTopic_Receiver_impl::test_exception - " + "ERROR: CIAO context seems to be NIL\n")); + } + } + catch (const ::CORBA::BAD_INV_ORDER &) + { + ACE_DEBUG ((LM_DEBUG, "RG_ResetTopic_Receiver_impl::test_exception - " + "Expected BAD_INV_ORDER thrown.\n")); + } + catch (const CORBA::Exception &e) + { + e._tao_print_exception("RG_ResetTopic_Receiver_impl::test_exception - " + "ERROR: Unexpected exception"); + } + catch (...) + { + ACE_ERROR ((LM_ERROR, "RG_ResetTopic_Receiver_impl::test_exception - " + "ERROR: expected and unknown exception caught\n")); + } + } + + void + RG_ResetTopic_Receiver_impl::start_reading (void) + { + ACE_DEBUG ((LM_DEBUG, "RG_ResetTopic_Receiver_impl::start_reading - " + "Start reading\n")); + ::RG_ResetTopic::RG_ResetTopicSampleConnector::Reader_var reader = + this->ciao_context_->get_connection_info_read_data (); + try + { + RG_ResetTopicSampleSeq samples; + ::CCM_DDS::ReadInfoSeq readinfo_seq; + reader->read_all (samples, readinfo_seq); + + this->check_samples ("read", samples, this->expected_per_run_); + } + catch (const CORBA::Exception &e) + { + e._tao_print_exception("RG_ResetTopic_Receiver_impl::start_reading - " + "ERROR: Unexpected exception"); + } + catch (...) + { + ACE_ERROR ((LM_ERROR, "RG_ResetTopic_Receiver_impl::start_reading - " + "ERROR: Caught unknow exception\n")); + } + } + + void + RG_ResetTopic_Receiver_impl::start_getting (void) + { + try + { + ::RG_ResetTopic::RG_ResetTopicSampleConnector::Getter_var getter = + this->ciao_context_->get_connection_info_get_fresh_data (); + if (::CORBA::is_nil (getter.in ())) + { + ACE_DEBUG ((LM_DEBUG, "RG_ResetTopic_Receiver_impl::start_getting - " + "ERROR: Unable to get writer interface from the " + "CIAO context\n")); + return; + } + DDS::Duration_t to; + to.sec = 1; + to.nanosec = 0; + getter->time_out (to); + + RG_ResetTopicSampleSeq samples; + ::CCM_DDS::ReadInfoSeq readinfos; + getter->get_many (samples, readinfos); + this->check_samples ("get", samples); + } + catch (const CORBA::Exception &e) + { + e._tao_print_exception("RG_ResetTopic_Receiver_impl::start_getting - " + "ERROR: Unexpected exception"); + } + catch (...) + { + ACE_ERROR ((LM_ERROR, "RG_ResetTopic_Receiver_impl::start_getting - " + "ERROR: expected and unknown exception caught\n")); + } + } + + void + RG_ResetTopic_Receiver_impl::set_topic_name_reader (const char * topic_name) + { + try + { + ACE_DEBUG ((LM_DEBUG, "RG_ResetTopic_Receiver_impl::set_topic_name_reader - " + "Setting topic name to <%C>\n", topic_name)); + ::RG_ResetTopic::RG_ResetTopicSampleConnector::Reader_var reader = + this->ciao_context_->get_connection_info_read_data (); + if (::CORBA::is_nil (reader.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: RG_ResetTopic_Receiver_impl::set_topic_name_reader - " + "Unable to get reader interface\n")); + throw ::CORBA::INTERNAL (); + } + ::CORBA::Object_var cmp = reader->_get_component (); + if (::CORBA::is_nil (cmp.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: RG_ResetTopic_Receiver_impl::set_topic_name_reader - " + "Unable to get component interface\n")); + throw ::CORBA::INTERNAL (); + } + ::RG_ResetTopic::RG_ResetTopicSampleConnector::CCM_DDS_State_var conn = + ::RG_ResetTopic::RG_ResetTopicSampleConnector::CCM_DDS_State::_narrow (cmp.in ()); + if (::CORBA::is_nil (conn.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: RG_ResetTopic_Receiver_impl::set_topic_name_reader - " + "Unable to narrow connector interface\n")); + throw ::CORBA::INTERNAL (); + } + + conn->topic_name (topic_name); + } + catch (const ::CCM_DDS::NonChangeable &) + { + ACE_ERROR ((LM_ERROR, "ERROR: RG_ResetTopic_Receiver_impl::set_topic_name_reader - " + "Caught NonChangeable exception.\n")); + } + } + + void + RG_ResetTopic_Receiver_impl::set_topic_name_getter (const char * topic_name) + { + try + { + ACE_DEBUG ((LM_DEBUG, "RG_ResetTopic_Receiver_impl::set_topic_name_getter - " + "Setting topic name to <%C>\n", topic_name)); + ::RG_ResetTopic::RG_ResetTopicSampleConnector::Getter_var getter = + this->ciao_context_->get_connection_info_get_fresh_data (); + if (::CORBA::is_nil (getter.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: RG_ResetTopic_Receiver_impl::set_topic_name_getter - " + "Unable to get getter interface\n")); + throw ::CORBA::INTERNAL (); + } + ::CORBA::Object_var cmp = getter->_get_component (); + if (::CORBA::is_nil (cmp.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: RG_ResetTopic_Receiver_impl::set_topic_name_getter - " + "Unable to get component interface\n")); + throw ::CORBA::INTERNAL (); + } + ::RG_ResetTopic::RG_ResetTopicSampleConnector::CCM_DDS_Event_var conn = + ::RG_ResetTopic::RG_ResetTopicSampleConnector::CCM_DDS_Event::_narrow (cmp.in ()); + if (::CORBA::is_nil (conn.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: RG_ResetTopic_Receiver_impl::set_topic_name_getter - " + "Unable to narrow connector interface\n")); + throw ::CORBA::INTERNAL (); + } + conn->topic_name (topic_name); + } + catch (const ::CCM_DDS::NonChangeable &) + { + ACE_ERROR ((LM_ERROR, "RG_ResetTopic_Receiver_impl::set_topic_name_getter - " + "ERROR: Caught NonChangeable exception.\n")); + } + } +} diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_impl.h b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_impl.h new file mode 100644 index 00000000000..241ab592731 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_impl.h @@ -0,0 +1,77 @@ +// $Id$ + +#ifndef RG_RESETTOPIC_RECEIVER_IMPL_H_ +#define RG_RESETTOPIC_RECEIVER_IMPL_H_ + +#include "RG_ResetTopic_ReceiverEC.h" + +namespace CIAO_RG_ResetTopic_Receiver_Impl +{ + class RG_ResetTopic_Receiver_impl; + + /** + * LastSampleChecker + */ + class LastSampleChecker + : public ACE_Event_Handler + { + public: + LastSampleChecker (RG_ResetTopic_Receiver_impl &callback, + const ::CORBA::UShort &iterations); + + virtual ~LastSampleChecker (void); + + virtual int handle_timeout (const ACE_Time_Value &tv, + const void *arg); + private: + RG_ResetTopic_Receiver_impl &callback_; + const ::CORBA::UShort iterations_; + }; + + /** + * RG_ResetTopic_Receiver_impl + */ + class RG_ResetTopic_Receiver_impl + { + public: + RG_ResetTopic_Receiver_impl ( + ::RG_ResetTopic::CCM_Receiver_Context_ptr ctx, + const ::CORBA::UShort & iterations, + const ::CORBA::UShort & keys); + ~RG_ResetTopic_Receiver_impl (void); + + void start (const char * topic_name); + bool check_last (void); + void start_read (void); + + + void iterations (::CORBA::UShort iterations); + void keys (::CORBA::UShort keys); + + private: + ::RG_ResetTopic::CCM_Receiver_Context_var ciao_context_; + ::CORBA::UShort iterations_; + ::CORBA::UShort keys_; + ::CORBA::UShort expected_per_run_; + + LastSampleChecker * checker_; + + ACE_CString topic_name_; + + void set_topic_name_reader (const char * topic_name); + void set_topic_name_getter (const char * topic_name); + + void start_reading (void); + void start_getting (void); + void test_exception (void); + + void check_samples ( + const char * test, + const RG_ResetTopicSampleSeq& samples, + const ::CORBA::UShort& expected=0); + + ACE_Reactor* reactor (void); + }; +}; + +#endif /* RG_RESETTOPIC_RECEIVER_IMPL_H_ */ diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Sender/RG_ResetTopic_Sender.idl b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Sender/RG_ResetTopic_Sender.idl new file mode 100644 index 00000000000..218682613f5 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Sender/RG_ResetTopic_Sender.idl @@ -0,0 +1,29 @@ +// $Id$ + +/** + * @file + * @author Marcel Smit <msmit@remedy.nl> + * + * by-hand idl3 translation of sender components. + */ + +#ifndef RG_RESETTOPIC_SENDER_IDL +#define RG_RESETTOPIC_SENDER_IDL + +#include "Connector/RG_ResetTopic_Connector.idl" +#include "Base/Reader_Starter.idl" + +module RG_ResetTopic +{ + component Sender + { + port RG_ResetTopicSampleConnector::DDS_Write info_write; + + attribute unsigned short iterations; + attribute unsigned short keys; + + uses ReaderStarter reader_start; + }; +}; + +#endif diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Sender/RG_ResetTopic_Sender.mpc b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Sender/RG_ResetTopic_Sender.mpc new file mode 100644 index 00000000000..b2ee15acdb8 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Sender/RG_ResetTopic_Sender.mpc @@ -0,0 +1,152 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p RG_ResetTopicBase -l ../lib -o ../lib -c controller -u DDS Sender" + +project (RG_ResetTopicSender_idl_gen) : componentidldefaults, dds4ccm { + after += RG_ResetTopicConnector_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=SENDER_STUB_Export \ + -Wb,stub_export_include=Sender_stub_export.h \ + -Wb,skel_export_macro=SENDER_SVNT_Export \ + -Wb,skel_export_include=Sender_svnt_export.h \ + -Wb,svnt_export_macro=SENDER_SVNT_Export \ + -Wb,svnt_export_include=Sender_svnt_export.h \ + -Wb,exec_export_macro=SENDER_EXEC_Export \ + -Wb,exec_export_include=Sender_exec_export.h \ + -I .. + + IDL_Files { + RG_ResetTopic_Sender.idl + } +} + +project (RG_ResetTopicSender_lem_gen) : ciaoidldefaults, dds4ccm { + after += RG_ResetTopicSender_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=SENDER_LEM_STUB_Export \ + -Wb,stub_export_include=Sender_lem_stub_export.h \ + -SS -Gxhst -I $CIAO_ROOT/connectors -I .. + + IDL_Files { + RG_ResetTopic_SenderE.idl + } +} + +project (RG_ResetTopicSender_lem_stub) : ccm_svnt, dds4ccm_base { + after += RG_ResetTopicSender_lem_gen RG_ResetTopicSender_stub \ + RG_ResetTopicBase_stub reader_starter_rt_stub + libs += RG_ResetTopicBase_stub Sender_stub reader_starter_rt_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = Sender_lem_stub + dynamicflags += SENDER_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + RG_ResetTopic_SenderEC.cpp + } + + Header_Files { + RG_ResetTopic_SenderEC.h + Sender_lem_stub_export.h + } + + Inline_Files { + RG_ResetTopic_SenderEC.inl + } +} + +project (RG_ResetTopicSender_stub) : ccm_stub, dds4ccm_base { + after += RG_ResetTopicSender_idl_gen RG_ResetTopicBase_stub \ + RG_ResetTopicConnector_stub reader_starter_rt_stub \ + reader_starter_rt_lem_stub + libs += RG_ResetTopicBase_stub RG_ResetTopicConnector_stub \ + reader_starter_rt_stub + includes += .. + libpaths += ../lib + libout = ../lib + sharedname = Sender_stub + dynamicflags += SENDER_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + RG_ResetTopic_SenderC.cpp + } + + Header_Files { + RG_ResetTopic_SenderC.h + Sender_stub_export.h + } + + Inline_Files { + RG_ResetTopic_SenderC.inl + } +} + +project (RG_ResetTopicSender_exec) : ciao_executor, dds4ccm_lem_stub { + after += RG_ResetTopicSender_lem_stub RG_ResetTopicSender_stub \ + RG_ResetTopicConnector_lem_stub RG_ResetTopicConnector_stub \ + reader_starter_rt_svnt reader_starter_rt_lem_stub + sharedname = Sender_exec + libs += Sender_stub Sender_lem_stub RG_ResetTopicBase_stub \ + RG_ResetTopicConnector_lem_stub RG_ResetTopicConnector_stub \ + reader_starter_rt_stub reader_starter_rt_svnt reader_starter_rt_lem_stub + libpaths += ../lib + includes += .. + libout = ../lib + dynamicflags += SENDER_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + RG_ResetTopic_Sender_exec.cpp + } + + Header_Files { + RG_ResetTopic_Sender_exec.h + Sender_exec_export.h + } + + Inline_Files { + } +} + + +project (RG_ResetTopicSender_svnt) : ciao_servant, dds4ccm_lem_stub, dds4ccm_skel { + after += RG_ResetTopicBase_stub RG_ResetTopicSender_lem_stub RG_ResetTopicConnector_stub \ + RG_ResetTopicConnector_svnt RG_ResetTopicConnector_lem_stub \ + reader_starter_rt_stub reader_starter_rt_lem_stub reader_starter_rt_svnt + sharedname = Sender_svnt + libs += Sender_stub Sender_lem_stub \ + RG_ResetTopicBase_stub RG_ResetTopicConnector_stub RG_ResetTopicConnector_svnt \ + RG_ResetTopicConnector_lem_stub reader_starter_rt_stub \ + reader_starter_rt_lem_stub reader_starter_rt_svnt + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += SENDER_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + RG_ResetTopic_SenderS.cpp + RG_ResetTopic_Sender_svnt.cpp + } + + Header_Files { + RG_ResetTopic_SenderS.h + RG_ResetTopic_Sender_svnt.h + Sender_svnt_export.h + } + + Inline_Files { + RG_ResetTopic_SenderS.inl + } +} + diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Sender/RG_ResetTopic_Sender_exec.cpp b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Sender/RG_ResetTopic_Sender_exec.cpp new file mode 100644 index 00000000000..1fa28b59098 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Sender/RG_ResetTopic_Sender_exec.cpp @@ -0,0 +1,257 @@ +// -*- C++ -*- +// $Id$ + +#include "RG_ResetTopic_Sender_exec.h" +#include "tao/ORB_Core.h" +#include "ace/Reactor.h" + +#define TOPIC_1 "ResetTopic1" +#define TOPIC_2 "ResetTopic2" + + +namespace CIAO_RG_ResetTopic_Sender_Impl +{ + + /** + * Timeout_Handler + */ + + Timeout_Handler::Timeout_Handler (Sender_exec_i &callback) + : callback_ (callback) + { + } + + int + Timeout_Handler::handle_timeout (const ACE_Time_Value &, const void *) + { + this->callback_.start_write (); + return 0; + } + + /** + * Component Executor Implementation Class: Sender_exec_i + */ + + Sender_exec_i::Sender_exec_i (void) + : iterations_ (0) + , keys_ (0) + , topic_name_ (TOPIC_2) + , run_(0) + , start_key_ (1) + , start_iteration_ (1) + { + } + + Sender_exec_i::~Sender_exec_i (void) + { + } + + // Supported operations and attributes. + ACE_Reactor* + Sender_exec_i::reactor (void) + { + ACE_Reactor* reactor = 0; + ::CORBA::Object_var ccm_object = + this->ciao_context_->get_CCM_object(); + if (! ::CORBA::is_nil (ccm_object.in ())) + { + ::CORBA::ORB_var orb = ccm_object->_get_orb (); + if (! ::CORBA::is_nil (orb.in ())) + { + reactor = orb->orb_core ()->reactor (); + } + } + if (reactor == 0) + { + throw ::CORBA::INTERNAL (); + } + return reactor; + } + + void + Sender_exec_i::start_write (void) + { + try + { + if (++this->run_ > 4) + return; + if (ACE_OS::strcmp (this->topic_name_.c_str(), TOPIC_1) == 0) + this->topic_name_ = TOPIC_2; + else + this->topic_name_ = TOPIC_1; + + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::start_write - " + "Setting topic name to <%C>\n", this->topic_name_.c_str())); + + ::RG_ResetTopic::RG_ResetTopicSampleConnector::Writer_var writer = + this->ciao_context_->get_connection_info_write_data (); + if (::CORBA::is_nil (writer.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::start_write - " + "Unable to get writer interface\n")); + throw ::CORBA::INTERNAL (); + } + ::CORBA::Object_var cmp = writer->_get_component (); + if (::CORBA::is_nil (cmp.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::start_write - " + "Unable to get component interface\n")); + throw ::CORBA::INTERNAL (); + } + ::RG_ResetTopic::RG_ResetTopicSampleConnector::CCM_DDS_Event_var conn = + ::RG_ResetTopic::RG_ResetTopicSampleConnector::CCM_DDS_Event::_narrow (cmp.in ()); + if (::CORBA::is_nil (conn.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::start_write - " + "Unable to narrow connector interface\n")); + throw ::CORBA::INTERNAL (); + } + + conn->topic_name (::CORBA::string_dup (this->topic_name_.c_str())); + + ::CORBA::UShort key = 0; + ::CORBA::UShort iter = 0; + for (key = this->start_key_; key < this->run_ * this->keys_ + 1; ++key) + { + RG_ResetTopicSample sample; + char tmp[7]; + ACE_OS::sprintf (tmp, "KEY_%d", key); + sample.key = CORBA::string_dup(tmp); + + for (iter = this->start_iteration_; iter < this->run_ * this->iterations_ + 1; ++iter) + { + sample.iteration = iter; + writer->write_one (sample, ::DDS::HANDLE_NIL); + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::start_event_test - " + "Sample written : key <%C> - iteration <%d>\n", + tmp, iter)); + } + } + this->start_key_ = key; + this->start_iteration_ = iter; + ACE_Time_Value tv (2, 0); + ACE_OS::sleep (tv); + ReaderStarter_var starter = + this->ciao_context_->get_connection_reader_start (); + if (!::CORBA::is_nil (starter.in ())) + { + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::start_event_test - " + "Inform the receiver that all samples were written\n")); + starter->set_reader_properties (this->start_key_ - 1, this->start_iteration_ - 1); + + starter->start_read (::CORBA::string_dup(this->topic_name_.c_str())); + } + else + { + ACE_ERROR ((LM_ERROR, "Sender_exec_i::start_event_test - " + "ERROR: unable to get connection to the ReaderStarter\n")); + } + } + catch (const ::CCM_DDS::NonChangeable &) + { + ACE_ERROR ((LM_ERROR, "Sender_exec_i::start_event_test - " + "ERROR: Caught NonChangeable exception.\n")); + } + catch (const ::CORBA::Exception & e) + { + e._tao_print_exception("Sender_exec_i::start_event_test - ERROR"); + } + catch (...) + { + ACE_ERROR ((LM_ERROR, "Sender_exec_i::start_event_test - " + "ERROR: Unexpected and unknown exception caught.\n")); + } + } + + + // Component attributes and port operations. + + ::CORBA::UShort + Sender_exec_i::iterations (void) + { + return this->iterations_; + } + + void + Sender_exec_i::iterations ( + const ::CORBA::UShort iterations) + { + this->iterations_ = iterations; + } + + ::CORBA::UShort + Sender_exec_i::keys (void) + { + return this->keys_; + } + + void + Sender_exec_i::keys ( + const ::CORBA::UShort keys) + { + this->keys_ = keys; + } + + // Operations from Components::SessionComponent. + + void + Sender_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + this->ciao_context_ = + ::RG_ResetTopic::CCM_Sender_Context::_narrow (ctx); + + if ( ::CORBA::is_nil (this->ciao_context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + Sender_exec_i::configuration_complete (void) + { + /* Your code here. */ + } + + void + Sender_exec_i::ccm_activate (void) + { + ACE_NEW_THROW_EX (this->to_handler_, + Timeout_Handler (*this), + ::CORBA::INTERNAL ()); + if (this->reactor ()->schedule_timer ( + this->to_handler_, + 0, + ACE_Time_Value (1, 0), + ACE_Time_Value (10, 0)) == -1) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Sender_exec_i::start : ") + ACE_TEXT ("Error scheduling timer"))); + } + } + + void + Sender_exec_i::ccm_passivate (void) + { + this->reactor()->cancel_timer(this->to_handler_); + } + + void + Sender_exec_i::ccm_remove (void) + { + delete this->to_handler_; + } + + extern "C" SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_RG_ResetTopic_Sender_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_NORETURN ( + retval, + Sender_exec_i); + + return retval; + } +} diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Sender/RG_ResetTopic_Sender_exec.h b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Sender/RG_ResetTopic_Sender_exec.h new file mode 100644 index 00000000000..66c55bfa8d9 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Sender/RG_ResetTopic_Sender_exec.h @@ -0,0 +1,139 @@ +// -*- C++ -*- +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v1.8.2 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ +#ifndef CIAO_RG_RESETTOPIC_SENDER_EXEC_YSJ9S8_H_ +#define CIAO_RG_RESETTOPIC_SENDER_EXEC_YSJ9S8_H_ + +#include /**/ "ace/pre.h" + +#include "RG_ResetTopic_SenderEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ "Sender_exec_export.h" +#include "tao/LocalObject.h" + +namespace CIAO_RG_ResetTopic_Sender_Impl +{ + class Sender_exec_i; + + /** + * Timeout_Handler + */ + class Timeout_Handler : + public ACE_Event_Handler + { + public: + Timeout_Handler (Sender_exec_i &callback); + /// Handle the timeout. + virtual int handle_timeout (const ACE_Time_Value &tv, + const void *arg); + private: + /// Maintains a handle that actually process the event + Sender_exec_i &callback_; + }; + + /** + * Component Executor Implementation Class: Sender_exec_i + */ + + class Sender_exec_i + : public virtual Sender_Exec, + public virtual ::CORBA::LocalObject + { + public: + Sender_exec_i (void); + virtual ~Sender_exec_i (void); + + //@{ + /** Supported operations and attributes. */ + + //@} + + //@{ + /** Component attributes and port operations. */ + + virtual ::CORBA::UShort iterations (void); + + virtual void iterations (::CORBA::UShort iterations); + + virtual ::CORBA::UShort keys (void); + + virtual void keys (::CORBA::UShort keys); + //@} + + //@{ + /** Operations from Components::SessionComponent. */ + virtual void set_session_context (::Components::SessionContext_ptr ctx); + virtual void configuration_complete (void); + virtual void ccm_activate (void); + virtual void ccm_passivate (void); + virtual void ccm_remove (void); + //@} + + //@{ + /** User defined public operations. */ + void start_write (void); + //@} + + private: + ::RG_ResetTopic::CCM_Sender_Context_var ciao_context_; + + //@{ + /** Component attributes. */ + + ::CORBA::UShort iterations_; + + ::CORBA::UShort keys_; + //@} + + //@{ + /** User defined members. */ + Timeout_Handler *to_handler_; + ACE_CString topic_name_; + ::CORBA::UShort run_; + ::CORBA::UShort start_key_; + ::CORBA::UShort start_iteration_; + //@} + + //@{ + /** User defined private operations. */ + + //@} + + /// Get the ACE_Reactor + ACE_Reactor* reactor (void); + }; + + extern "C" SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_RG_ResetTopic_Sender_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* ifndef */ diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/descriptors/Plan.cdp b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/descriptors/Plan.cdp new file mode 100644 index 00000000000..b47fe050e3c --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/descriptors/Plan.cdp @@ -0,0 +1,461 @@ +<!-- $Id$ --> +<Deployment:DeploymentPlan + xmlns:Deployment="http://www.omg.org/Deployment" + xmlns:xmi="http://www.omg.org/XMI" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.omg.org/Deployment Deployment.xsd"> + <label>ResetTopic_Depl_1</label> + <UUID>ResetTopic_Depl_1</UUID> + + <implementation xmi:id="ReceiverComponentImplementation"> + <name>ReceiverComponentImplementation</name> + <source/> + <artifact xmi:idref="Receiver_ExecArtifact" /> + <artifact xmi:idref="Receiver_SvntArtifact" /> + <execParameter> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_RG_ResetTopic_Receiver_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_RG_ResetTopic_Receiver_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Receiver_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Receiver_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="ResetTopic_EventConnectorImplementation"> + <name>ResetTopic_EventConnectorImplementation</name> + <source/> + <artifact xmi:idref="ResetTopic_Connector_ExecArtifact" /> + <artifact xmi:idref="ResetTopic_Connector_SvntArtifact" /> + <execParameter> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_RG_ResetTopic_RG_ResetTopicSampleConnector_DDS_Event_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_RG_ResetTopic_RG_ResetTopicSampleConnector_DDS_Event_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>RG_ResetTopic_Connector_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>RG_ResetTopic_Connector_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="ResetTopic_StateConnectorImplementation"> + <name>ResetTopic_StateConnectorImplementation</name> + <source/> + <artifact xmi:idref="ResetTopic_Connector_ExecArtifact" /> + <artifact xmi:idref="ResetTopic_Connector_SvntArtifact" /> + <execParameter> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_RG_ResetTopic_RG_ResetTopicSampleConnector_DDS_State_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_RG_ResetTopic_RG_ResetTopicSampleConnector_DDS_State_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>RG_ResetTopic_Connector_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>RG_ResetTopic_Connector_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SenderComponentImplementation"> + <name>SenderComponentImplementation</name> + <source/> + <artifact xmi:idref="Sender_ExecArtifact" /> + <artifact xmi:idref="Sender_SvntArtifact" /> + <execParameter> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_RG_ResetTopic_Sender_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_RG_ResetTopic_Sender_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Sender_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Sender_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <instance xmi:id="ReceiverComponentInstance"> + <name>ReceiverComponent</name> + <node>ReceiverNode</node> + <source/> + <implementation xmi:idref="ReceiverComponentImplementation" /> + </instance> + + <instance xmi:id="ResetTopic_SenderEventConnectorInstance"> + <name>ResetTopic_SenderEventConnectorInstance</name> + <node>SenderNode</node> + <source/> + <implementation xmi:idref="ResetTopic_EventConnectorImplementation" /> + <configProperty> + <name>topic_name</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ResetTopic1</string> + </value> + </value> + </configProperty> + <configProperty> + <name>qos_profile</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ResetTopic_Library#ResetTopic_Profile</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="ResetTopic_ReceiverEventConnectorInstance"> + <name>ResetTopic_ReceiverEventConnectorInstance</name> + <node>ReceiverNode</node> + <source/> + <implementation xmi:idref="ResetTopic_EventConnectorImplementation" /> + <configProperty> + <name>topic_name</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string></string> + </value> + </value> + </configProperty> + <configProperty> + <name>qos_profile</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ResetTopic_Library#ResetTopic_Profile</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="ResetTopic_ReceiverStateConnectorInstance"> + <name>ResetTopic_ReceiverStateConnectorInstance</name> + <node>ReceiverNode</node> + <source/> + <implementation xmi:idref="ResetTopic_StateConnectorImplementation" /> + <configProperty> + <name>topic_name</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string></string> + </value> + </value> + </configProperty> + <configProperty> + <name>qos_profile</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ResetTopic_Library#ResetTopic_Profile</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="SenderComponentInstance"> + <name>SenderComponent</name> + <node>SenderNode</node> + <source/> + <implementation xmi:idref="SenderComponentImplementation" /> + <configProperty> + <name>keys</name> + <value> + <type> + <kind>tk_ushort</kind> + </type> + <value> + <ushort>5</ushort> + </value> + </value> + </configProperty> + <configProperty> + <name>iterations</name> + <value> + <type> + <kind>tk_ushort</kind> + </type> + <value> + <ushort>10</ushort> + </value> + </value> + </configProperty> + </instance> + + <connection> + <name>reader_starter</name> + <internalEndpoint> + <portName>reader_start</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="SenderComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>start_reading</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="ReceiverComponentInstance" /> + </internalEndpoint> + </connection> + + <connection> + <name>reader_connection</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>info_read_data</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="ReceiverComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>passive_observer_data</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="ResetTopic_ReceiverStateConnectorInstance" /> + </internalEndpoint> + </connection> + + <connection> + <name>getter_connection</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>info_get_fresh_data</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="ReceiverComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>pull_consumer_fresh_data</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="ResetTopic_ReceiverEventConnectorInstance" /> + </internalEndpoint> + </connection> + + <connection> + <name>writer_connection</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>info_write_data</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="SenderComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>supplier_data</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="ResetTopic_SenderEventConnectorInstance" /> + </internalEndpoint> + </connection> + + <artifact xmi:id="Sender_ExecArtifact"> + <name>Sender_exec</name> + <source/> + <node/> + <location>Sender_exec</location> + </artifact> + <artifact xmi:id="Sender_SvntArtifact"> + <name>Sender_svnt</name> + <source/> + <node/> + <location>Sender_svnt</location> + </artifact> + <artifact xmi:id="Sender_StubArtifact"> + <name>Sender_stub</name> + <source/> + <node/> + <location>Sender_stub</location> + </artifact> + <artifact xmi:id="ResetTopic_Connector_ExecArtifact"> + <name>RG_ResetTopic_Connector_exec</name> + <source/> + <node/> + <location>RG_ResetTopicConnector_exec</location> + </artifact> + <artifact xmi:id="ResetTopic_Connector_SvntArtifact"> + <name>RG_ResetTopic_Connector_svnt</name> + <source/> + <node/> + <location>RG_ResetTopicConnector_svnt</location> + </artifact> + <artifact xmi:id="Receiver_ExecArtifact"> + <name>Receiver_exec</name> + <source/> + <node/> + <location>Receiver_exec</location> + </artifact> + <artifact xmi:id="Receiver_SvntArtifact"> + <name>Receiver_svnt</name> + <source/> + <node/> + <location>Receiver_svnt</location> + </artifact> + <artifact xmi:id="Receiver_StubArtifact"> + <name>Receiver_stub</name> + <source/> + <node/> + <location>Receiver_stub</location> + </artifact> +</Deployment:DeploymentPlan> diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/descriptors/USER_QOS_PROFILES.xml b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/descriptors/USER_QOS_PROFILES.xml new file mode 100644 index 00000000000..55c5d7657cd --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/descriptors/USER_QOS_PROFILES.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="c:/ndds/ndds.4.5d/scripts/../resource/rtiddsgen/../qos_profiles_4.5d/schema/rti_dds_qos_profiles.xsd" version="4.5d"> + <qos_library name="ResetTopic_Library"> + <qos_profile name="ResetTopic_Profile" is_default_qos="true"> + <datawriter_qos> + <reliability> + <kind>RELIABLE_RELIABILITY_QOS</kind> + <max_blocking_time> + <sec>10</sec> + <nanosec>0</nanosec> + </max_blocking_time> + </reliability> + <durability> + <kind>TRANSIENT_DURABILITY_QOS</kind> + </durability> + <history> + <kind>KEEP_ALL_HISTORY_QOS</kind> + </history> + <protocol> + <rtps_reliable_writer> + <max_heartbeat_retries>10</max_heartbeat_retries> + </rtps_reliable_writer> + </protocol> + </datawriter_qos> + <datareader_qos> + <reliability> + <kind>RELIABLE_RELIABILITY_QOS</kind> + </reliability> + <history> + <kind>KEEP_ALL_HISTORY_QOS</kind> + </history> + <durability> + <kind>TRANSIENT_LOCAL_DURABILITY_QOS</kind> + </durability> + </datareader_qos> + </qos_profile> + </qos_library> +</dds> diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/descriptors/run_test.pl b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/descriptors/run_test.pl new file mode 100755 index 00000000000..5eb32d70c34 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/descriptors/run_test.pl @@ -0,0 +1,244 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{'ACE_ROOT'}/bin"; +use PerlACE::TestTarget; + +$CIAO_ROOT = "$ENV{'CIAO_ROOT'}"; +$TAO_ROOT = "$ENV{'TAO_ROOT'}"; +$DANCE_ROOT = "$ENV{'DANCE_ROOT'}"; + +$daemons_running = 0; +$em_running = 0; +$ns_running = 0; + +$nr_daemon = 2; +@ports = ( 60001, 60002 ); +@iorbases = ( "NodeApp1.ior", "NodeApp2.ior" ); +@iorfiles = 0; +@nodenames = ( "SenderNode", "ReceiverNode" ); + +# ior files other than daemon +# ior files other than daemon +$ior_nsbase = "ns.ior"; +$ior_nsfile = 0; +$ior_embase = "EM.ior"; +$ior_emfile = 0; + +# Processes +$E = 0; +$EM = 0; +$NS = 0; +@DEAMONS = 0; + +# targets +@tg_daemons = 0; +$tg_naming = 0; +$tg_exe_man = 0; +$tg_executor = 0; + +$status = 0; +$cdp_file = "Plan.cdp"; + +sub create_targets { + # naming service + $tg_naming = PerlACE::TestTarget::create_target (1) || die "Create target for ns failed\n"; + $tg_naming->AddLibPath ('../lib'); + # daemon + for ($i = 0; $i < $nr_daemon; ++$i) { + $tg_daemons[$i] = PerlACE::TestTarget::create_target ($i+1) || die "Create target for daemon $i failed\n"; + $tg_daemons[$i]->AddLibPath ('../lib'); + } + # execution manager + $tg_exe_man = PerlACE::TestTarget::create_target (1) || die "Create target for EM failed\n"; + $tg_exe_man->AddLibPath ('../lib'); + # executor (plan_launcher) + $tg_executor = PerlACE::TestTarget::create_target (1) || die "Create target for executor failed\n"; + $tg_executor->AddLibPath ('../lib'); +} + +sub init_ior_files { + $ior_nsfile = $tg_naming->LocalFile ($ior_nsbase); + $ior_emfile = $tg_exe_man->LocalFile ($ior_embase); + for ($i = 0; $i < $nr_daemon; ++$i) { + $iorfiles[$i] = $tg_daemons[$i]->LocalFile ($iorbases[$i]); + } + delete_ior_files (); +} + +# Delete if there are any .ior files. +sub delete_ior_files { + for ($i = 0; $i < $nr_daemon; ++$i) { + $tg_daemons[$i]->DeleteFile ($iorbases[$i]); + } + $tg_naming->DeleteFile ($ior_nsbase); + $tg_exe_man->DeleteFile ($ior_embase); + for ($i = 0; $i < $nr_daemon; ++$i) { + $iorfiles[$i] = $tg_daemons[$i]->LocalFile ($iorbases[$i]); + } +} + +sub kill_node_daemon { + for ($i = 0; $i < $nr_daemon; ++$i) { + $DEAMONS[$i]->Kill (); $DEAMONS[$i]->TimedWait (1); + } +} + +sub kill_open_processes { + if ($daemons_running == 1) { + kill_node_daemon (); + } + + if ($em_running == 1) { + $EM->Kill (); $EM->TimedWait (1); + } + + if ($ns_running == 1) { + $NS->Kill (); $NS->TimedWait (1); + } + # in case shutdown did not perform as expected + $tg_executor->KillAll ('dance_locality_manager'); +} + +sub run_node_daemons { + for ($i = 0; $i < $nr_daemon; ++$i) { + $iorbase = $iorbases[$i]; + $iorfile = $iorfiles[$i]; + $port = $ports[$i]; + $nodename = $nodenames[$i]; + $iiop = "iiop://localhost:$port"; + $node_app = $tg_daemons[$i]->GetArchDir("$DANCE_ROOT/bin/") . "dance_locality_manager"; + + $d_cmd = "$DANCE_ROOT/bin/dance_node_manager"; + $d_param = "-ORBEndpoint $iiop -s $node_app -n $nodename=$iorfile -t 30 --domain-nc corbaloc:rir:/NameService"; + + print "Run dance_node_manager with $d_param\n"; + + $DEAMONS[$i] = $tg_daemons[$i]->CreateProcess ($d_cmd, $d_param); + $DEAMONS[$i]->Spawn (); + + if ($tg_daemons[$i]->WaitForFileTimed($iorbase, + $tg_daemons[$i]->ProcessStartWaitInterval ()) == -1) { + print STDERR + "ERROR: The ior $iorfile file of node daemon $i could not be found\n"; + for (; $i >= 0; --$i) { + $DEAMONS[$i]->Kill (); $DEAMONS[$i]->TimedWait (1); + } + return -1; + } + } + return 0; +} + +create_targets (); +init_ior_files (); + +# Invoke naming service + +$NS = $tg_naming->CreateProcess ("$TAO_ROOT/orbsvcs/Naming_Service/tao_cosnaming", " -ORBEndpoint iiop://localhost:60003 -o $ior_nsfile"); + +$ns_status = $NS->Spawn (); + +if ($ns_status != 0) { + print STDERR "ERROR: Unable to execute the naming service\n"; + kill_open_processes (); + exit 1; +} + +print STDERR "Starting Naming Service with -ORBEndpoint iiop://localhost:60003 -o ns.ior\n"; + +if ($tg_naming->WaitForFileTimed ($ior_nsbase, + $tg_naming->ProcessStartWaitInterval ()) == -1) { + print STDERR "ERROR: cannot find naming service IOR file\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} + +$ns_running = 1; +# Set up NamingService environment +$ENV{"NameServiceIOR"} = "corbaloc:iiop:localhost:60003/NameService"; + +# Invoke node daemon. +print "Invoking node daemon\n"; +$status = run_node_daemons (); + +if ($status != 0) { + print STDERR "ERROR: Unable to execute the node daemon\n"; + kill_open_processes (); + exit 1; +} + +$daemons_running = 1; + +# Invoke execution manager. +print "Invoking execution manager (dance_execution_manager.exe) with -e$ior_emfile\n"; +$EM = $tg_exe_man->CreateProcess ("$DANCE_ROOT/bin/dance_execution_manager", + "-e$ior_emfile --domain-nc corbaloc:rir:/NameService"); +$em_status = $EM->Spawn (); + +if ($em_status != 0) { + print STDERR "ERROR: dance_execution_manager returned $em_status"; + exit 1; +} + +if ($tg_exe_man->WaitForFileTimed ($ior_embase, + $tg_exe_man->ProcessStartWaitInterval ()) == -1) { + print STDERR + "ERROR: The ior file of execution manager could not be found\n"; + kill_open_processes (); + exit 1; +} + +$em_running = 1; + +# Invoke executor - start the application -. +print "Invoking executor - launch the application -\n"; + +print "Start dance_plan_launcher.exe with -x $cdp_file -k file://$ior_emfile\n"; +$E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-x $cdp_file -k file://$ior_emfile"); +$pl_status = $E->SpawnWaitKill (2 * $tg_executor->ProcessStartWaitInterval ()); + +if ($pl_status != 0) { + print STDERR "ERROR: dance_plan_launcher returned $pl_status\n"; + kill_open_processes (); + exit 1; +} + +for ($i = 0; $i < $nr_daemon; ++$i) { + if ($tg_daemons[$i]->WaitForFileTimed ($iorbases[$i], + $tg_daemons[$i]->ProcessStopWaitInterval ()) == -1) { + print STDERR "ERROR: The ior file of daemon $i could not be found\n"; + kill_open_processes (); + exit 1; + } +} + +print "Sleeping 60 seconds to allow task to complete\n"; +sleep (60); + +# Invoke executor - stop the application -. +print "Invoking executor - stop the application -\n"; +print "by running dance_plan_launcher.exe with -k file://$ior_emfile -x $cdp_file\n"; + +$E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-k file://$ior_emfile -x $cdp_file -s"); +$pl_status = $E->SpawnWaitKill ($tg_executor->ProcessStartWaitInterval ()); + +if ($pl_status != 0) { + print STDERR "ERROR: dance_plan_launcher returned $pl_status\n"; + kill_open_processes (); + exit 1; +} + +print "Executor returned.\n"; +print "Shutting down rest of the processes.\n"; + +delete_ior_files (); +kill_open_processes (); + +exit $status; diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/Base/TE_ResetTopic_Base.idl b/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/Base/TE_ResetTopic_Base.idl new file mode 100644 index 00000000000..916b4c10d05 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/Base/TE_ResetTopic_Base.idl @@ -0,0 +1,23 @@ +// $Id$ + +/** + * @file TE_ResetTopic_Base.idl + * @author Marcel Smit <msmit@remedy.nl> + */ + +#ifndef TE_RESETTOPIC_BASE_IDL +#define TE_RESETTOPIC_BASE_IDL + +#pragma ndds typesupport "Base/TE_ResetTopic_BaseSupport.h" + +#pragma DCPS_DATA_TYPE "TE_ResetTopicTest" +#pragma DCPS_DATA_KEY "TE_ResetTopicTest key" + +struct TE_ResetTopicTest { + string key; //@key + long iteration; +}; + +typedef sequence<TE_ResetTopicTest> TE_ResetTopicTestSeq; + +#endif diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/Base/TE_ResetTopic_Base.mpc b/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/Base/TE_ResetTopic_Base.mpc new file mode 100644 index 00000000000..e167c1d0daa --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/Base/TE_ResetTopic_Base.mpc @@ -0,0 +1,26 @@ +// $Id$ + +project (TE_ResetTopicBase_stub) : taoidldefaults, dds4ccm_ts_default { + sharedname = TE_ResetTopicBase_stub + dynamicflags += TE_RESETTOPIC_BASE_STUB_BUILD_DLL + libout = ../lib + + idlflags += -SS -Sci \ + -Wb,stub_export_macro=TE_RESETTOPIC_BASE_STUB_Export \ + -Wb,stub_export_include=ResetTopic_Base_stub_export.h + + IDL_Files { + idlflags += -Gxhst + TE_ResetTopic_Base.idl + } + + opendds_ts_flags += --export=TE_RESETTOPIC_BASE_STUB_Export + + DDSGenerator_Files { + TE_ResetTopic_Base.idl + } + + Source_Files { + } +} + diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/Connector/TE_ResetTopic_Connector.idl b/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/Connector/TE_ResetTopic_Connector.idl new file mode 100644 index 00000000000..7fa6bd3d791 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/Connector/TE_ResetTopic_Connector.idl @@ -0,0 +1,23 @@ +// $Id$ + +/** + * @file TE_ResetTopic_Connector.idl + * @author Marcel Smit <msmit@remedy.nl> + */ + +#ifndef TE_RESETTOPIC_CONNECTOR_IDL_ +#define TE_RESETTOPIC_CONNECTOR_IDL_ + +#include <Components.idl> +#include <ccm_dds.idl> + +#include "Base/TE_ResetTopic_Base.idl" + +#pragma ciao lem "Connector/TE_ResetTopic_ConnectorE.idl" + +module TE_ResetTopic +{ + module ::CCM_DDS::Typed < ::TE_ResetTopicTest, ::TE_ResetTopicTestSeq> TE_ResetTopicTestConnector; +}; + +#endif /* TE_ResetTopic_CONNECTOR_IDL_ */ diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/Connector/TE_ResetTopic_Connector.mpc b/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/Connector/TE_ResetTopic_Connector.mpc new file mode 100644 index 00000000000..dd159226915 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/Connector/TE_ResetTopic_Connector.mpc @@ -0,0 +1,148 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p TE_ResetTopicBase -l .. -o ../lib -u DDS TE_ResetTopic_Connector" + +project (TE_ResetTopicConnector_idl_gen) : connectoridldefaults, dds4ccm { + after += DDS4CCM_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=TE_RESETTOPIC_CONNECTOR_STUB_Export \ + -Wb,stub_export_include=ResetTopic_Connector_stub_export.h \ + -Wb,skel_export_macro=TE_RESETTOPIC_CONNECTOR_SVNT_Export \ + -Wb,skel_export_include=ResetTopic_Connector_svnt_export.h \ + -Wb,svnt_export_macro=TE_RESETTOPIC_CONNECTOR_SVNT_Export \ + -Wb,svnt_export_include=ResetTopic_Connector_svnt_export.h \ + -Wb,conn_export_macro=TE_RESETTOPIC_CONNECTOR_CONN_Export \ + -Wb,conn_export_include=ResetTopic_Connector_conn_export.h \ + -I .. + + IDL_Files { + TE_ResetTopic_Connector.idl + } +} + +project (TE_ResetTopicConnector_lem_gen) : ciaoidldefaults, dds4ccm { + custom_only = 1 + after += TE_ResetTopicConnector_idl_gen + idlflags += -Wb,stub_export_macro=TE_RESETTOPIC_CONNECTOR_LEM_STUB_Export \ + -Wb,stub_export_include=TE_ResetTopic_Connector_lem_stub_export.h \ + -SS -Gxhst \ + -I .. + + IDL_Files { + TE_ResetTopic_ConnectorE.idl + } +} + +project (TE_ResetTopicConnector_lem_stub) : ccm_svnt, dds4ccm_lem_stub { + after += TE_ResetTopicConnector_lem_gen TE_ResetTopicConnector_stub \ + TE_ResetTopicBase_stub + libs += TE_ResetTopicBase_stub TE_ResetTopicConnector_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = TE_ResetTopicConnector_lem_stub + dynamicflags += TE_RESETTOPIC_CONNECTOR_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + TE_ResetTopic_ConnectorEC.cpp + } + + Header_Files { + TE_ResetTopic_ConnectorEC.h + TE_ResetTopic_Connector_lem_stub_export.h + } + + Inline_Files { + TE_ResetTopic_ConnectorEC.inl + } +} + +project (TE_ResetTopicConnector_stub) : ccm_stub, dds4ccm_base { + after += TE_ResetTopicConnector_idl_gen TE_ResetTopicBase_stub + libs += TE_ResetTopicBase_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = TE_ResetTopicConnector_stub + dynamicflags += TE_RESETTOPIC_CONNECTOR_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + TE_ResetTopic_ConnectorC.cpp + } + + Header_Files { + TE_ResetTopic_ConnectorC.h + TE_ResetTopic_Connector_stub_export.h + } + + Inline_Files { + TE_ResetTopic_ConnectorC.inl + } +} + +project (TE_ResetTopicConnector_exec) : ciao_executor, dds4ccm_impl { + after += TE_ResetTopicConnector_lem_stub TE_ResetTopicConnector_stub \ + TE_ResetTopicBase_stub + sharedname = TE_ResetTopicConnector_exec + libs += TE_ResetTopicConnector_stub TE_ResetTopicConnector_lem_stub \ + TE_ResetTopicBase_stub TE_ResetTopicBase_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += TE_RESETTOPIC_CONNECTOR_CONN_BUILD_DLL + + IDL_Files { + } + + Source_Files { + TE_ResetTopic_Connector_conn.cpp + } + + Header_Files { + TE_ResetTopic_Connector_conn.h + TE_ResetTopic_Connector_conn_export.h + } + + Inline_Files { + } +} + + +project (TE_ResetTopicConnector_svnt) : ciao_servant, dds4ccm_impl { + after += TE_ResetTopicConnector_lem_stub TE_ResetTopicConnector_exec \ + TE_ResetTopicConnector_stub + sharedname = TE_ResetTopicConnector_svnt + libs += TE_ResetTopicConnector_stub \ + TE_ResetTopicConnector_lem_stub \ + TE_ResetTopicBase_stub \ + TE_ResetTopicConnector_exec + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += TE_RESETTOPIC_CONNECTOR_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + TE_ResetTopic_ConnectorS.cpp + TE_ResetTopic_Connector_svnt.cpp + } + + Header_Files { + TE_ResetTopic_ConnectorS.h + TE_ResetTopic_Connector_svnt.h + TE_ResetTopic_Connector_svnt_export.h + } + + Inline_Files { + TE_ResetTopic_ConnectorS.inl + } +} + + diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/Sender/SenderDriver.cpp b/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/Sender/SenderDriver.cpp new file mode 100644 index 00000000000..56ac8f1daa2 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/Sender/SenderDriver.cpp @@ -0,0 +1,93 @@ +//$Id$ +/* + * @file SenderDriver.cpp + * + * @author Marcel Smit + */ + + +#include "TE_ResetTopic_SenderC.h" +#include "ace/streams.h" +#include "ace/Get_Opt.h" + +const ACE_TCHAR *sender_ior = ACE_TEXT ("file://Sender.ior"); +const ACE_TCHAR *topic_name = ACE_TEXT (""); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("ek:n:")); + int c; + + while ((c = get_opts ()) != -1) + { + switch (c) + { + case 'k': + sender_ior = get_opts.opt_arg (); + break; + + case 'n': + topic_name = get_opts.opt_arg (); + break; + + case 'e': + topic_name = ""; + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s\n" + "-k <Sender IOR> (default is file://Sender.ior)\n" + "-n <new topic>\n" + "-e <clearing topic name>\n" + "\n", + argv [0]), + -1); + } + } + + return 0; +} + + +int ACE_TMAIN (int argc, ACE_TCHAR* argv[]) +{ + try + { + // initialize the ORB + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv); + if (parse_args (argc, argv) != 0) + { + return -1; + } + + // create the factory object reference, + CORBA::Object_var sender_obj = + orb->string_to_object (sender_ior); + + // downcast the object reference to the appropriate type + ::TE_ResetTopic::Sender_var sender = + ::TE_ResetTopic::Sender::_narrow (sender_obj.in ()); + + if (CORBA::is_nil (sender.in ())) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to acquire 'Sender' objref\n"), + -1); + } + sender->set_new_topic (topic_name); + + orb->destroy (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Who is the culprit in the SenderDriver?\n"); + ACE_ERROR_RETURN ((LM_ERROR, + "Uncaught CORBA exception\n"), + 1); + } + return 0; +} diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/Sender/TE_ResetTopic_Sender.idl b/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/Sender/TE_ResetTopic_Sender.idl new file mode 100644 index 00000000000..9712f2257bc --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/Sender/TE_ResetTopic_Sender.idl @@ -0,0 +1,32 @@ +// $Id$ + +/** + * @file + * @author Marcel Smit <msmit@remedy.nl> + * + * by-hand idl3 translation of sender components. + */ + +#ifndef TE_RESETTOPIC_SENDER_IDL +#define TE_RESETTOPIC_SENDER_IDL + +#include "Connector/TE_ResetTopic_Connector.idl" + +module TE_ResetTopic +{ + interface ChangeTopicInterface + { + void set_new_topic (in string topic_name); + }; + + component Sender supports ChangeTopicInterface + { + port TE_ResetTopicTestConnector::DDS_Write info_write; + port TE_ResetTopicTestConnector::DDS_Update info_update; + + attribute unsigned short iterations; + attribute unsigned short keys; + }; +}; + +#endif diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/Sender/TE_ResetTopic_Sender.mpc b/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/Sender/TE_ResetTopic_Sender.mpc new file mode 100644 index 00000000000..396ab0c1405 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/Sender/TE_ResetTopic_Sender.mpc @@ -0,0 +1,166 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p TE_ResetTopicBase -l ../lib -o ../lib -c controller -u DDS Sender" + +project (TE_ResetTopicSender_idl_gen) : componentidldefaults, dds4ccm { + after += TE_ResetTopicConnector_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=SENDER_STUB_Export \ + -Wb,stub_export_include=Sender_stub_export.h \ + -Wb,skel_export_macro=SENDER_SVNT_Export \ + -Wb,skel_export_include=Sender_svnt_export.h \ + -Wb,svnt_export_macro=SENDER_SVNT_Export \ + -Wb,svnt_export_include=Sender_svnt_export.h \ + -Wb,exec_export_macro=SENDER_EXEC_Export \ + -Wb,exec_export_include=Sender_exec_export.h \ + -I .. + + IDL_Files { + TE_ResetTopic_Sender.idl + } +} + +project (TE_ResetTopicSender_lem_gen) : ciaoidldefaults, dds4ccm { + after += TE_ResetTopicSender_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=SENDER_LEM_STUB_Export \ + -Wb,stub_export_include=Sender_lem_stub_export.h \ + -SS -Gxhst -I $CIAO_ROOT/connectors -I .. + + IDL_Files { + TE_ResetTopic_SenderE.idl + } +} + +project (TE_ResetTopicSender_lem_stub) : ccm_svnt, dds4ccm_base { + after += TE_ResetTopicSender_lem_gen TE_ResetTopicSender_stub TE_ResetTopicBase_stub + libs += TE_ResetTopicBase_stub Sender_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = Sender_lem_stub + dynamicflags += SENDER_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + TE_ResetTopic_SenderEC.cpp + } + + Header_Files { + TE_ResetTopic_SenderEC.h + Sender_lem_stub_export.h + } + + Inline_Files { + TE_ResetTopic_SenderEC.inl + } +} + +project (TE_ResetTopicSender_stub) : ccm_stub, dds4ccm_base { + after += TE_ResetTopicSender_idl_gen TE_ResetTopicBase_stub TE_ResetTopicConnector_stub + libs += TE_ResetTopicBase_stub TE_ResetTopicConnector_stub + includes += .. + libpaths += ../lib + libout = ../lib + sharedname = Sender_stub + dynamicflags += SENDER_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + TE_ResetTopic_SenderC.cpp + } + + Header_Files { + TE_ResetTopic_SenderC.h + Sender_stub_export.h + } + + Inline_Files { + TE_ResetTopic_SenderC.inl + } +} + +project (TE_ResetTopicSender_exec) : ciao_executor, dds4ccm_lem_stub { + after += TE_ResetTopicSender_lem_stub TE_ResetTopicSender_stub \ + TE_ResetTopicConnector_lem_stub TE_ResetTopicConnector_stub + sharedname = Sender_exec + libs += Sender_stub Sender_lem_stub TE_ResetTopicBase_stub \ + TE_ResetTopicConnector_lem_stub TE_ResetTopicConnector_stub + libpaths += ../lib + includes += .. + libout = ../lib + dynamicflags += SENDER_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + TE_ResetTopic_Sender_exec.cpp + } + + Header_Files { + TE_ResetTopic_Sender_exec.h + Sender_exec_export.h + } + + Inline_Files { + } +} + + +project (TE_ResetTopicSender_svnt) : ciao_servant, dds4ccm_lem_stub, dds4ccm_skel { + after += TE_ResetTopicBase_stub TE_ResetTopicSender_lem_stub TE_ResetTopicConnector_stub \ + TE_ResetTopicConnector_svnt TE_ResetTopicConnector_lem_stub + sharedname = Sender_svnt + libs += Sender_stub Sender_lem_stub \ + TE_ResetTopicBase_stub TE_ResetTopicConnector_stub TE_ResetTopicConnector_svnt TE_ResetTopicConnector_lem_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += SENDER_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + TE_ResetTopic_SenderS.cpp + TE_ResetTopic_Sender_svnt.cpp + } + + Header_Files { + TE_ResetTopic_SenderS.h + TE_ResetTopic_Sender_svnt.h + Sender_svnt_export.h + } + + Inline_Files { + TE_ResetTopic_SenderS.inl + } +} + +project (TE_ResetTopicSender_Driver) : ccm_stub, valuetype, dds4ccm_lem_stub { + exename = SenderDriver + after += TE_ResetTopicSender_stub TE_ResetTopicConnector_stub + libs += Sender_stub TE_ResetTopicBase_stub TE_ResetTopicConnector_stub + + includes += .. + libpaths += ../lib + + exeout = ../lib + IDL_Files { + } + + Source_Files { + SenderDriver.cpp + } + + Header_Files { + } + + Inline_Files { + } +} + diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/Sender/TE_ResetTopic_Sender_exec.cpp b/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/Sender/TE_ResetTopic_Sender_exec.cpp new file mode 100644 index 00000000000..c9d10361d79 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/Sender/TE_ResetTopic_Sender_exec.cpp @@ -0,0 +1,387 @@ +// -*- C++ -*- +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v1.8.2 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ + +#include "TE_ResetTopic_Sender_exec.h" +#include "tao/ORB_Core.h" +#include "ace/Reactor.h" + +namespace CIAO_TE_ResetTopic_Sender_Impl +{ + + /** + * Timeout_Handler + */ + + Timeout_Handler::Timeout_Handler (Sender_exec_i &callback) + : callback_ (callback) + { + } + + int + Timeout_Handler::handle_timeout (const ACE_Time_Value &, const void *) + { + // Notify the subscribers + this->callback_.start_event_test (); + return 0; + } + + /** + * Component Executor Implementation Class: Sender_exec_i + */ + + Sender_exec_i::Sender_exec_i (void) + : iterations_ (0) + , keys_ (0) + , to_handler_ (0) + , topic_name_ ("TopicI") + , old_topic_name_ ("TopicI") + { + ACE_NEW_THROW_EX (this->to_handler_, + Timeout_Handler (*this), + ::CORBA::INTERNAL ()); + } + + Sender_exec_i::~Sender_exec_i (void) + { + delete this->to_handler_; + } + + // Supported operations and attributes. + ACE_Reactor* + Sender_exec_i::reactor (void) + { + ACE_Reactor* reactor = 0; + ::CORBA::Object_var ccm_object = + this->ciao_context_->get_CCM_object(); + if (! ::CORBA::is_nil (ccm_object.in ())) + { + ::CORBA::ORB_var orb = ccm_object->_get_orb (); + if (! ::CORBA::is_nil (orb.in ())) + { + reactor = orb->orb_core ()->reactor (); + } + } + if (reactor == 0) + { + throw ::CORBA::INTERNAL (); + } + return reactor; + } + + void Sender_exec_i::set_new_topic (const char * topic_name) + { + ACE_GUARD (TAO_SYNCH_RECURSIVE_MUTEX, guard, this->topic_name_lock_); + + this->old_topic_name_ = this->topic_name_; + this->topic_name_ = topic_name; + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::set_new_topic - " + "New topic name set <%C>\n", + topic_name)); + } + + void + Sender_exec_i::create_samples (void) + { + for (CORBA::UShort i = 1; i < this->keys_ + 1; ++i) + { + char key[7]; + TE_ResetTopicTest *new_key = new TE_ResetTopicTest; + ACE_OS::sprintf (key, "KEY_%d", i); + new_key->key = CORBA::string_dup(key); + new_key->iteration = 0; + this->tests_[key] = new_key; + + ::TE_ResetTopic::TE_ResetTopicTestConnector::Updater_var updater = + this->ciao_context_->get_connection_info_update_data(); + + updater->create_one (*new_key); + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::create_samples - " + "Sample <%C> created\n", + key)); + } + } + + void + Sender_exec_i::set_topic_name (const char * topic_name) + { + if (ACE_OS::strcmp (topic_name, this->old_topic_name_.c_str()) != 0) + { + this->old_topic_name_ = topic_name; + this->set_topic_name_writer (topic_name); + this->set_topic_name_updater (topic_name); + } + } + + void + Sender_exec_i::set_topic_name_writer (const char * topic_name) + { + try + { + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::set_topic_name_writer - " + "Setting topic to <%C>\n", + topic_name)); + ::TE_ResetTopic::TE_ResetTopicTestConnector:: Writer_var writer = + this->ciao_context_->get_connection_info_write_data (); + if (::CORBA::is_nil (writer.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::set_topic_name_writer - " + "Unable to get writer interface\n")); + throw ::CORBA::INTERNAL (); + } + ::CORBA::Object_var cmp = writer->_get_component (); + if (::CORBA::is_nil (cmp.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::set_topic_name_writer - " + "Unable to get component interface\n")); + throw ::CORBA::INTERNAL (); + } + ::TE_ResetTopic::TE_ResetTopicTestConnector::CCM_DDS_Event_var conn = + ::TE_ResetTopic::TE_ResetTopicTestConnector::CCM_DDS_Event::_narrow (cmp.in ()); + if (::CORBA::is_nil (conn.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::set_topic_name_writer - " + "Unable to narrow connector interface\n")); + throw ::CORBA::INTERNAL (); + } + { + ACE_GUARD (TAO_SYNCH_RECURSIVE_MUTEX, guard, this->topic_name_lock_); + conn->topic_name (topic_name); + } + } + catch (const ::CCM_DDS::NonChangeable &) + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::set_topic_name_writer - " + "Caught NonChangeable exception.\n")); + } + } + + void + Sender_exec_i::set_topic_name_updater (const char * topic_name) + { + try + { + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::set_topic_name_updater - " + "Setting topic to <%C>\n", + topic_name)); + ::TE_ResetTopic::TE_ResetTopicTestConnector:: Updater_var updater = + this->ciao_context_->get_connection_info_update_data (); + if (::CORBA::is_nil (updater.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::set_topic_name_updater - " + "Unable to get updater interface\n")); + throw ::CORBA::INTERNAL (); + } + ::CORBA::Object_var cmp = updater->_get_component (); + if (::CORBA::is_nil (cmp.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::set_topic_name_updater - " + "Unable to get component interface\n")); + throw ::CORBA::INTERNAL (); + } + ::TE_ResetTopic::TE_ResetTopicTestConnector::CCM_DDS_State_var conn = + ::TE_ResetTopic::TE_ResetTopicTestConnector::CCM_DDS_State::_narrow (cmp.in ()); + if (::CORBA::is_nil (conn.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::set_topic_name_updater - " + "Unable to narrow connector interface\n")); + throw ::CORBA::INTERNAL (); + } + { + ACE_GUARD (TAO_SYNCH_RECURSIVE_MUTEX, guard, this->topic_name_lock_); + conn->topic_name (topic_name); + } + this->create_samples (); + } + catch (const ::CCM_DDS::NonChangeable &) + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::set_topic_name_updater - " + "Caught NonChangeable exception.\n")); + } + } + + void + Sender_exec_i::start_event_test (void) + { + // Set the topic name on the connector first. Therefor we need to + // get to the connector first. + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::start_event_test - Start\n")); + + try + { + for (::CORBA::UShort key = 1; key < this->keys_ + 1; ++key) + { + TE_ResetTopicTest sample; + char tmp[7]; + ACE_OS::sprintf (tmp, "KEY_%d", key); + sample.key = CORBA::string_dup(tmp); + + for (::CORBA::UShort iter = 1; iter < this->iterations_ + 1; ++iter) + { + this->set_topic_name (this->topic_name_.c_str ()); + ::TE_ResetTopic::TE_ResetTopicTestConnector:: Writer_var writer = + this->ciao_context_->get_connection_info_write_data (); + sample.iteration = iter; + writer->write_one (sample, ::DDS::HANDLE_NIL); + + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::start_event_test - " + "Sample for topic <%C> written : key <%C> - iteration <%d>\n", + this->topic_name_.c_str (), tmp, iter)); + + ACE_Time_Value tv (0, 5000); + ACE_OS::sleep (tv); + } + } + for (Sample_Table::iterator iter = this->tests_.begin (); + iter != this->tests_.end (); + ++iter) + { + for (::CORBA::UShort i = 1; i < this->iterations_ + 1; ++i) + { + this->set_topic_name (this->topic_name_.c_str ()); + ::TE_ResetTopic::TE_ResetTopicTestConnector:: Updater_var updater = + this->ciao_context_->get_connection_info_update_data (); + iter->second->iteration = i; + updater->update_one (iter->second, ::DDS::HANDLE_NIL); + + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::start_event_test - " + "Sample for topic <%C> updated : key <%C> - iteration <%d>\n", + this->topic_name_.c_str (), + iter->second->key.in (), + i)); + + ACE_Time_Value tv (0, 5000); + ACE_OS::sleep (tv); + } + } + } + catch (const ::CORBA::BAD_INV_ORDER & ex) + { + if (this->topic_name_.empty()) + ACE_DEBUG ((LM_DEBUG, "Expected BAD_INV_ORDER caught\n")); + else + ex._tao_print_exception("ERROR:"); + } + catch (const ::CORBA::Exception & ex) + { + ex._tao_print_exception("ERROR:"); + } + catch (...) + { + ACE_ERROR ((LM_ERROR, "Sender_exec_i::start_event_test - " + "ERROR: Unexpected and unknown exception caught.\n")); + } + } + + // Component attributes and port operations. + + ::CORBA::UShort + Sender_exec_i::iterations (void) + { + return this->iterations_; + } + + void + Sender_exec_i::iterations ( + const ::CORBA::UShort iterations) + { + this->iterations_ = iterations; + } + + ::CORBA::UShort + Sender_exec_i::keys (void) + { + return this->keys_; + } + + void + Sender_exec_i::keys ( + const ::CORBA::UShort keys) + { + this->keys_ = keys; + } + + // Operations from Components::SessionComponent. + + void + Sender_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + this->ciao_context_ = + ::TE_ResetTopic::CCM_Sender_Context::_narrow (ctx); + + if ( ::CORBA::is_nil (this->ciao_context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + Sender_exec_i::configuration_complete (void) + { + /* Your code here. */ + } + + void + Sender_exec_i::ccm_activate (void) + { + this->create_samples (); + if (this->reactor ()->schedule_timer ( + this->to_handler_, + 0, + ACE_Time_Value (5, 0), + ACE_Time_Value (5, 0)) == -1) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Sender_exec_i::start : ") + ACE_TEXT ("Error scheduling timer"))); + } + } + + void + Sender_exec_i::ccm_passivate (void) + { + this->reactor()->cancel_timer(this->to_handler_); + } + + void + Sender_exec_i::ccm_remove (void) + { + /* Your code here. */ + } + + extern "C" SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_TE_ResetTopic_Sender_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_NORETURN ( + retval, + Sender_exec_i); + + return retval; + } +} diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/Sender/TE_ResetTopic_Sender_exec.h b/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/Sender/TE_ResetTopic_Sender_exec.h new file mode 100644 index 00000000000..a60008c4a77 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/Sender/TE_ResetTopic_Sender_exec.h @@ -0,0 +1,147 @@ +// -*- C++ -*- +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v1.8.2 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ +#ifndef CIAO_TE_RESETTOPIC_SENDER_EXEC_YSJ9S8_H_ +#define CIAO_TE_RESETTOPIC_SENDER_EXEC_YSJ9S8_H_ + +#include /**/ "ace/pre.h" + +#include "TE_ResetTopic_SenderEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ "Sender_exec_export.h" +#include "tao/LocalObject.h" + +#include <map> + +namespace CIAO_TE_ResetTopic_Sender_Impl +{ + class Sender_exec_i; + + /** + * Timeout_Handler + */ + class Timeout_Handler : + public ACE_Event_Handler + { + public: + Timeout_Handler (Sender_exec_i &callback); + /// Handle the timeout. + virtual int handle_timeout (const ACE_Time_Value &tv, + const void *arg); + private: + /// Maintains a handle that actually process the event + Sender_exec_i &callback_; + }; + + /** + * Component Executor Implementation Class: Sender_exec_i + */ + + class Sender_exec_i + : public virtual Sender_Exec, + public virtual ::CORBA::LocalObject + { + public: + Sender_exec_i (void); + virtual ~Sender_exec_i (void); + + //@{ + /** Supported operations and attributes. */ + virtual void set_new_topic (const char * topic_name); + //@} + + //@{ + /** Component attributes and port operations. */ + + virtual ::CORBA::UShort iterations (void); + + virtual void iterations (::CORBA::UShort iterations); + + virtual ::CORBA::UShort keys (void); + + virtual void keys (::CORBA::UShort keys); + //@} + + //@{ + /** Operations from Components::SessionComponent. */ + virtual void set_session_context (::Components::SessionContext_ptr ctx); + virtual void configuration_complete (void); + virtual void ccm_activate (void); + virtual void ccm_passivate (void); + virtual void ccm_remove (void); + //@} + + //@{ + /** User defined public operations. */ + void set_topic_name (const char * topic_name); + void set_topic_name_writer (const char * topic_name); + void set_topic_name_updater (const char * topic_name); + void start_event_test (void); + //@} + + private: + ::TE_ResetTopic::CCM_Sender_Context_var ciao_context_; + + //@{ + /** Component attributes. */ + + ::CORBA::UShort iterations_; + + ::CORBA::UShort keys_; + //@} + + //@{ + /** User defined members. */ + Timeout_Handler *to_handler_; + ACE_CString topic_name_, old_topic_name_; + + TAO_SYNCH_RECURSIVE_MUTEX topic_name_lock_; + + typedef std::map<ACE_CString, TE_ResetTopicTest_var> Sample_Table; + + Sample_Table tests_; + //@} + + //@{ + /** User defined private operations. */ + void create_samples (void); + //@} + + /// Get the ACE_Reactor + ACE_Reactor* reactor (void); + }; + + extern "C" SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_TE_ResetTopic_Sender_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* ifndef */ diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/descriptors/Plan.cdp b/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/descriptors/Plan.cdp new file mode 100644 index 00000000000..9af446d47d0 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/descriptors/Plan.cdp @@ -0,0 +1,338 @@ +<!-- $Id$ --> +<Deployment:DeploymentPlan + xmlns:Deployment="http://www.omg.org/Deployment" + xmlns:xmi="http://www.omg.org/XMI" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.omg.org/Deployment Deployment.xsd"> + <label>ResetTopic_Depl_1</label> + <UUID>ResetTopic_Depl_1</UUID> + + <implementation xmi:id="ResetTopic_EventConnectorImplementation"> + <name>ResetTopic_EventConnectorImplementation</name> + <source/> + <artifact xmi:idref="ResetTopic_Connector_ExecArtifact" /> + <artifact xmi:idref="ResetTopic_Connector_SvntArtifact" /> + <execParameter> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_TE_ResetTopic_TE_ResetTopicTestConnector_DDS_Event_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_TE_ResetTopic_TE_ResetTopicTestConnector_DDS_Event_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>TE_ResetTopic_Connector_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>TE_ResetTopic_Connector_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="ResetTopic_StateConnectorImplementation"> + <name>ResetTopic_StateConnectorImplementation</name> + <source/> + <artifact xmi:idref="ResetTopic_Connector_ExecArtifact" /> + <artifact xmi:idref="ResetTopic_Connector_SvntArtifact" /> + <execParameter> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_TE_ResetTopic_TE_ResetTopicTestConnector_DDS_State_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_TE_ResetTopic_TE_ResetTopicTestConnector_DDS_State_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>TE_ResetTopic_Connector_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>TE_ResetTopic_Connector_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SenderComponentImplementation"> + <name>SenderComponentImplementation</name> + <source/> + <artifact xmi:idref="Sender_ExecArtifact" /> + <artifact xmi:idref="Sender_SvntArtifact" /> + <execParameter> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_TE_ResetTopic_Sender_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_TE_ResetTopic_Sender_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Sender_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Sender_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <instance xmi:id="ResetTopic_SenderEventConnectorInstance"> + <name>ResetTopic_SenderEventConnectorInstance</name> + <node>SenderNode</node> + <source/> + <implementation xmi:idref="ResetTopic_EventConnectorImplementation" /> + <configProperty> + <name>topic_name</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>TopicI</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="ResetTopic_SenderStateConnectorInstance"> + <name>ResetTopic_SenderStateConnectorInstance</name> + <node>SenderNode</node> + <source/> + <implementation xmi:idref="ResetTopic_StateConnectorImplementation" /> + <configProperty> + <name>topic_name</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>TopicI</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="SenderComponentInstance"> + <name>SenderComponent</name> + <node>SenderNode</node> + <source/> + <implementation xmi:idref="SenderComponentImplementation" /> + <configProperty> + <name>rate</name> + <value> + <type> + <kind>tk_ushort</kind> + </type> + <value> + <ushort>15</ushort> + </value> + </value> + </configProperty> + <configProperty> + <name>keys</name> + <value> + <type> + <kind>tk_ushort</kind> + </type> + <value> + <ushort>5</ushort> + </value> + </value> + </configProperty> + <configProperty> + <name>iterations</name> + <value> + <type> + <kind>tk_ushort</kind> + </type> + <value> + <ushort>10</ushort> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Sender.ior</string> + </value> + </value> + </configProperty> + </instance> + + <connection> + <name>writer_connection</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>info_write_data</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="SenderComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>supplier_data</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="ResetTopic_SenderEventConnectorInstance" /> + </internalEndpoint> + </connection> + + <connection> + <name>updater_connection</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>info_update_data</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="SenderComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>observable_data</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="ResetTopic_SenderStateConnectorInstance" /> + </internalEndpoint> + </connection> + + <artifact xmi:id="Sender_ExecArtifact"> + <name>Sender_exec</name> + <source/> + <node/> + <location>Sender_exec</location> + </artifact> + <artifact xmi:id="Sender_SvntArtifact"> + <name>Sender_svnt</name> + <source/> + <node/> + <location>Sender_svnt</location> + </artifact> + <artifact xmi:id="Sender_StubArtifact"> + <name>Sender_stub</name> + <source/> + <node/> + <location>Sender_stub</location> + </artifact> + <artifact xmi:id="ResetTopic_Connector_ExecArtifact"> + <name>TE_ResetTopic_Connector_exec</name> + <source/> + <node/> + <location>TE_ResetTopicConnector_exec</location> + </artifact> + <artifact xmi:id="ResetTopic_Connector_SvntArtifact"> + <name>TE_ResetTopic_Connector_svnt</name> + <source/> + <node/> + <location>TE_ResetTopicConnector_svnt</location> + </artifact> + <artifact xmi:id="Receiver_ExecArtifact"> + <name>Receiver_exec</name> + <source/> + <node/> + <location>Receiver_exec</location> + </artifact> + <artifact xmi:id="Receiver_SvntArtifact"> + <name>Receiver_svnt</name> + <source/> + <node/> + <location>Receiver_svnt</location> + </artifact> + <artifact xmi:id="Receiver_StubArtifact"> + <name>Receiver_stub</name> + <source/> + <node/> + <location>Receiver_stub</location> + </artifact> +</Deployment:DeploymentPlan> diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/descriptors/run_test.pl b/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/descriptors/run_test.pl new file mode 100755 index 00000000000..ca093570857 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ToEmpty/descriptors/run_test.pl @@ -0,0 +1,265 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{'ACE_ROOT'}/bin"; +use PerlACE::TestTarget; + +$CIAO_ROOT = "$ENV{'CIAO_ROOT'}"; +$TAO_ROOT = "$ENV{'TAO_ROOT'}"; +$DANCE_ROOT = "$ENV{'DANCE_ROOT'}"; + +$daemons_running = 0; +$em_running = 0; +$ns_running = 0; + +$nr_daemon = 1; +@ports = ( 60001 ); +@iorbases = ( "SenderNode.ior" ); +@iorfiles = 0; +@nodenames = ( "SenderNode" ); + +# ior files other than daemon +$ior_nsbase = "ns.ior"; +$ior_nsfile = 0; +$ior_embase = "EM.ior"; +$ior_emfile = 0; + +# Processes +$E = 0; +$EM = 0; +$NS = 0; +@DEAMONS = 0; + +# targets +@tg_daemons = 0; +$tg_naming = 0; +$tg_exe_man = 0; +$tg_executor = 0; + +$status = 0; +$cdp_file = "Plan.cdp"; + +sub create_targets { + # naming service + $tg_naming = PerlACE::TestTarget::create_target (1) || die "Create target for ns failed\n"; + $tg_naming->AddLibPath ('../lib'); + # daemon + for ($i = 0; $i < $nr_daemon; ++$i) { + $tg_daemons[$i] = PerlACE::TestTarget::create_target ($i+1) || die "Create target for daemon $i failed\n"; + $tg_daemons[$i]->AddLibPath ('../lib'); + } + # execution manager + $tg_exe_man = PerlACE::TestTarget::create_target (1) || die "Create target for EM failed\n"; + $tg_exe_man->AddLibPath ('../lib'); + # executor (plan_launcher) + $tg_executor = PerlACE::TestTarget::create_target (1) || die "Create target for executor failed\n"; + $tg_executor->AddLibPath ('../lib'); +} + +sub init_ior_files { + $ior_nsfile = $tg_naming->LocalFile ($ior_nsbase); + $ior_emfile = $tg_exe_man->LocalFile ($ior_embase); + for ($i = 0; $i < $nr_daemon; ++$i) { + $iorfiles[$i] = $tg_daemons[$i]->LocalFile ($iorbases[$i]); + } + delete_ior_files (); +} + +# Delete if there are any .ior files. +sub delete_ior_files { + for ($i = 0; $i < $nr_daemon; ++$i) { + $tg_daemons[$i]->DeleteFile ($iorbases[$i]); + } + $tg_naming->DeleteFile ($ior_nsbase); + $tg_exe_man->DeleteFile ($ior_embase); + for ($i = 0; $i < $nr_daemon; ++$i) { + $iorfiles[$i] = $tg_daemons[$i]->LocalFile ($iorbases[$i]); + } +} + +sub kill_node_daemon { + for ($i = 0; $i < $nr_daemon; ++$i) { + $DEAMONS[$i]->Kill (); $DEAMONS[$i]->TimedWait (1); + } +} + +sub kill_open_processes { + if ($daemons_running == 1) { + kill_node_daemon (); + } + + if ($em_running == 1) { + $EM->Kill (); $EM->TimedWait (1); + } + + if ($ns_running == 1) { + $NS->Kill (); $NS->TimedWait (1); + } + # in case shutdown did not perform as expected + $tg_executor->KillAll ('dance_locality_manager'); +} + +sub run_node_daemons { + for ($i = 0; $i < $nr_daemon; ++$i) { + $iorbase = $iorbases[$i]; + $iorfile = $iorfiles[$i]; + $port = $ports[$i]; + $nodename = $nodenames[$i]; + $iiop = "iiop://localhost:$port"; + $node_app = $tg_daemons[$i]->GetArchDir("$DANCE_ROOT/bin/") . "dance_locality_manager"; + + $d_cmd = "$DANCE_ROOT/bin/dance_node_manager"; + $d_param = "-ORBEndpoint $iiop -s $node_app -n $nodename=$iorfile -t 30 --domain-nc corbaloc:rir:/NameService"; + + print "Run dance_node_manager with $d_param\n"; + + $DEAMONS[$i] = $tg_daemons[$i]->CreateProcess ($d_cmd, $d_param); + $DEAMONS[$i]->Spawn (); + + if ($tg_daemons[$i]->WaitForFileTimed($iorbase, + $tg_daemons[$i]->ProcessStartWaitInterval ()) == -1) { + print STDERR + "ERROR: The ior $iorfile file of node daemon $i could not be found\n"; + for (; $i >= 0; --$i) { + $DEAMONS[$i]->Kill (); $DEAMONS[$i]->TimedWait (1); + } + return -1; + } + } + return 0; +} + +create_targets (); +init_ior_files (); + +# Invoke naming service + +$NS = $tg_naming->CreateProcess ("$TAO_ROOT/orbsvcs/Naming_Service/tao_cosnaming", " -ORBEndpoint iiop://localhost:60003 -o $ior_nsfile"); + +$ns_status = $NS->Spawn (); + +if ($ns_status != 0) { + print STDERR "ERROR: Unable to execute the naming service\n"; + kill_open_processes (); + exit 1; +} + +print STDERR "Starting Naming Service with -ORBEndpoint iiop://localhost:60003 -o ns.ior\n"; + +if ($tg_naming->WaitForFileTimed ($ior_nsbase, + $tg_naming->ProcessStartWaitInterval ()) == -1) { + print STDERR "ERROR: cannot find naming service IOR file\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} + +$ns_running = 1; +# Set up NamingService environment +$ENV{"NameServiceIOR"} = "corbaloc:iiop:localhost:60003/NameService"; + +# Invoke node daemon. +print "Invoking node daemon\n"; +$status = run_node_daemons (); + +if ($status != 0) { + print STDERR "ERROR: Unable to execute the node daemon\n"; + kill_open_processes (); + exit 1; +} + +$daemons_running = 1; + +# Invoke execution manager. +print "Invoking execution manager (dance_execution_manager.exe) with -e$ior_emfile\n"; +$EM = $tg_exe_man->CreateProcess ("$DANCE_ROOT/bin/dance_execution_manager", + "-e$ior_emfile --domain-nc corbaloc:rir:/NameService"); +$em_status = $EM->Spawn (); + +if ($em_status != 0) { + print STDERR "ERROR: dance_execution_manager returned $em_status"; + exit 1; +} + +if ($tg_exe_man->WaitForFileTimed ($ior_embase, + $tg_exe_man->ProcessStartWaitInterval ()) == -1) { + print STDERR + "ERROR: The ior file of execution manager could not be found\n"; + kill_open_processes (); + exit 1; +} + +$em_running = 1; + +# Invoke executor - start the application -. +print "Invoking executor - launch the application -\n"; + +print "Start dance_plan_launcher.exe with -x $cdp_file -k file://$ior_emfile\n"; +$E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-x $cdp_file -k file://$ior_emfile"); +$pl_status = $E->SpawnWaitKill (2 * $tg_executor->ProcessStartWaitInterval ()); + +if ($pl_status != 0) { + print STDERR "ERROR: dance_plan_launcher returned $pl_status\n"; + kill_open_processes (); + exit 1; +} + +for ($i = 0; $i < $nr_daemon; ++$i) { + if ($tg_daemons[$i]->WaitForFileTimed ($iorbases[$i], + $tg_daemons[$i]->ProcessStopWaitInterval ()) == -1) { + print STDERR "ERROR: The ior file of daemon $i could not be found\n"; + kill_open_processes (); + exit 1; + } +} + +print "Sleeping 10 seconds before clearing the topic name\n"; +sleep (10); + +$S = $tg_executor->CreateProcess ("../lib/SenderDriver", "-e"); +$driver_status = $S->SpawnWaitKill (2 * $tg_executor->ProcessStartWaitInterval ()); +if ($driver_status != 0) { + print STDERR "ERROR: unable to launch driver\n"; + kill_open_processes (); + exit 1; +} + +print "Sleeping 10 seconds before setting the topic name again\n"; +sleep (10); + +$S = $tg_executor->CreateProcess ("../lib/SenderDriver", "-n TopicIII"); +$driver_status = $S->SpawnWaitKill (2 * $tg_executor->ProcessStartWaitInterval ()); +if ($driver_status != 0) { + print STDERR "ERROR: unable to launch driver\n"; + kill_open_processes (); + exit 1; +} + +print "Sleeping 10 seconds before stopping\n"; +sleep (10); + +# Invoke executor - stop the application -. +print "Invoking executor - stop the application -\n"; +print "by running dance_plan_launcher.exe with -k file://$ior_emfile -x $cdp_file\n"; + +$E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-k file://$ior_emfile -x $cdp_file -s"); +$pl_status = $E->SpawnWaitKill ($tg_executor->ProcessStartWaitInterval ()); + +if ($pl_status != 0) { + print STDERR "ERROR: dance_plan_launcher returned $pl_status\n"; + kill_open_processes (); + exit 1; +} + +print "Executor returned.\n"; +print "Shutting down rest of the processes.\n"; + +delete_ior_files (); +kill_open_processes (); + +exit $status; diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/Base/TL_ResetTopic_Base.idl b/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/Base/TL_ResetTopic_Base.idl new file mode 100644 index 00000000000..96ef29afe8b --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/Base/TL_ResetTopic_Base.idl @@ -0,0 +1,23 @@ +// $Id$ + +/** + * @file TL_ResetTopic_Base.idl + * @author Marcel Smit <msmit@remedy.nl> + */ + +#ifndef TL_RESETTOPIC_BASE_IDL +#define TL_RESETTOPIC_BASE_IDL + +#pragma ndds typesupport "Base/TL_ResetTopic_BaseSupport.h" + +#pragma DCPS_DATA_TYPE "TL_ResetTopicTest" +#pragma DCPS_DATA_KEY "TL_ResetTopicTest key" + +struct TL_ResetTopicTest { + string key; //@key + long iteration; +}; + +typedef sequence<TL_ResetTopicTest> TL_ResetTopicTestSeq; + +#endif diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/Base/TL_ResetTopic_Base.mpc b/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/Base/TL_ResetTopic_Base.mpc new file mode 100644 index 00000000000..0ea8e8c66bb --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/Base/TL_ResetTopic_Base.mpc @@ -0,0 +1,26 @@ +// $Id$ + +project (TL_ResetTopicBase_stub) : taoidldefaults, dds4ccm_ts_default { + sharedname = TL_ResetTopicBase_stub + dynamicflags += TL_RESETTOPIC_BASE_STUB_BUILD_DLL + libout = ../lib + + idlflags += -SS -Sci \ + -Wb,stub_export_macro=TL_RESETTOPIC_BASE_STUB_Export \ + -Wb,stub_export_include=ResetTopic_Base_stub_export.h + + IDL_Files { + idlflags += -Gxhst + TL_ResetTopic_Base.idl + } + + opendds_ts_flags += --export=TL_RESETTOPIC_BASE_STUB_Export + + DDSGenerator_Files { + TL_ResetTopic_Base.idl + } + + Source_Files { + } +} + diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/Connector/TL_ResetTopic_Connector.idl b/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/Connector/TL_ResetTopic_Connector.idl new file mode 100644 index 00000000000..2da5ce49b47 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/Connector/TL_ResetTopic_Connector.idl @@ -0,0 +1,23 @@ +// $Id$ + +/** + * @file TL_ResetTopic_Connector.idl + * @author Marcel Smit <msmit@remedy.nl> + */ + +#ifndef TL_RESETTOPIC_CONNECTOR_IDL_ +#define TL_RESETTOPIC_CONNECTOR_IDL_ + +#include <Components.idl> +#include <ccm_dds.idl> + +#include "Base/TL_ResetTopic_Base.idl" + +#pragma ciao lem "Connector/TL_ResetTopic_ConnectorE.idl" + +module TL_ResetTopic +{ + module ::CCM_DDS::Typed < ::TL_ResetTopicTest, ::TL_ResetTopicTestSeq> TL_ResetTopicTestConnector; +}; + +#endif /* TL_ResetTopic_CONNECTOR_IDL_ */ diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/Connector/TL_ResetTopic_Connector.mpc b/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/Connector/TL_ResetTopic_Connector.mpc new file mode 100644 index 00000000000..b65dca4b5b5 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/Connector/TL_ResetTopic_Connector.mpc @@ -0,0 +1,148 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p TL_ResetTopicBase -l .. -o ../lib -u DDS TL_ResetTopic_Connector" + +project (TL_ResetTopicConnector_idl_gen) : connectoridldefaults, dds4ccm { + after += DDS4CCM_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=TL_RESETTOPIC_CONNECTOR_STUB_Export \ + -Wb,stub_export_include=ResetTopic_Connector_stub_export.h \ + -Wb,skel_export_macro=TL_RESETTOPIC_CONNECTOR_SVNT_Export \ + -Wb,skel_export_include=ResetTopic_Connector_svnt_export.h \ + -Wb,svnt_export_macro=TL_RESETTOPIC_CONNECTOR_SVNT_Export \ + -Wb,svnt_export_include=ResetTopic_Connector_svnt_export.h \ + -Wb,conn_export_macro=TL_RESETTOPIC_CONNECTOR_CONN_Export \ + -Wb,conn_export_include=ResetTopic_Connector_conn_export.h \ + -I .. + + IDL_Files { + TL_ResetTopic_Connector.idl + } +} + +project (TL_ResetTopicConnector_lem_gen) : ciaoidldefaults, dds4ccm { + custom_only = 1 + after += TL_ResetTopicConnector_idl_gen + idlflags += -Wb,stub_export_macro=TL_RESETTOPIC_CONNECTOR_LEM_STUB_Export \ + -Wb,stub_export_include=TL_ResetTopic_Connector_lem_stub_export.h \ + -SS -Gxhst \ + -I .. + + IDL_Files { + TL_ResetTopic_ConnectorE.idl + } +} + +project (TL_ResetTopicConnector_lem_stub) : ccm_svnt, dds4ccm_lem_stub { + after += TL_ResetTopicConnector_lem_gen TL_ResetTopicConnector_stub \ + TL_ResetTopicBase_stub + libs += TL_ResetTopicBase_stub TL_ResetTopicConnector_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = TL_ResetTopicConnector_lem_stub + dynamicflags += TL_RESETTOPIC_CONNECTOR_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + TL_ResetTopic_ConnectorEC.cpp + } + + Header_Files { + TL_ResetTopic_ConnectorEC.h + TL_ResetTopic_Connector_lem_stub_export.h + } + + Inline_Files { + TL_ResetTopic_ConnectorEC.inl + } +} + +project (TL_ResetTopicConnector_stub) : ccm_stub, dds4ccm_base { + after += TL_ResetTopicConnector_idl_gen TL_ResetTopicBase_stub + libs += TL_ResetTopicBase_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = TL_ResetTopicConnector_stub + dynamicflags += TL_RESETTOPIC_CONNECTOR_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + TL_ResetTopic_ConnectorC.cpp + } + + Header_Files { + TL_ResetTopic_ConnectorC.h + TL_ResetTopic_Connector_stub_export.h + } + + Inline_Files { + TL_ResetTopic_ConnectorC.inl + } +} + +project (TL_ResetTopicConnector_exec) : ciao_executor, dds4ccm_impl { + after += TL_ResetTopicConnector_lem_stub TL_ResetTopicConnector_stub \ + TL_ResetTopicBase_stub + sharedname = TL_ResetTopicConnector_exec + libs += TL_ResetTopicConnector_stub TL_ResetTopicConnector_lem_stub \ + TL_ResetTopicBase_stub TL_ResetTopicBase_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += TL_RESETTOPIC_CONNECTOR_CONN_BUILD_DLL + + IDL_Files { + } + + Source_Files { + TL_ResetTopic_Connector_conn.cpp + } + + Header_Files { + TL_ResetTopic_Connector_conn.h + TL_ResetTopic_Connector_conn_export.h + } + + Inline_Files { + } +} + + +project (TL_ResetTopicConnector_svnt) : ciao_servant, dds4ccm_impl { + after += TL_ResetTopicConnector_lem_stub TL_ResetTopicConnector_exec \ + TL_ResetTopicConnector_stub + sharedname = TL_ResetTopicConnector_svnt + libs += TL_ResetTopicConnector_stub \ + TL_ResetTopicConnector_lem_stub \ + TL_ResetTopicBase_stub \ + TL_ResetTopicConnector_exec + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += TL_RESETTOPIC_CONNECTOR_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + TL_ResetTopic_ConnectorS.cpp + TL_ResetTopic_Connector_svnt.cpp + } + + Header_Files { + TL_ResetTopic_ConnectorS.h + TL_ResetTopic_Connector_svnt.h + TL_ResetTopic_Connector_svnt_export.h + } + + Inline_Files { + TL_ResetTopic_ConnectorS.inl + } +} + + diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/Sender/SenderDriver.cpp b/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/Sender/SenderDriver.cpp new file mode 100644 index 00000000000..a89be8e0002 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/Sender/SenderDriver.cpp @@ -0,0 +1,93 @@ +//$Id$ +/* + * @file SenderDriver.cpp + * + * @author Marcel Smit + */ + + +#include "TL_ResetTopic_SenderC.h" +#include "ace/streams.h" +#include "ace/Get_Opt.h" + +const ACE_TCHAR *sender_ior = ACE_TEXT ("file://Sender.ior"); +const ACE_TCHAR *topic_name = ACE_TEXT (""); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("ek:n:")); + int c; + + while ((c = get_opts ()) != -1) + { + switch (c) + { + case 'k': + sender_ior = get_opts.opt_arg (); + break; + + case 'n': + topic_name = get_opts.opt_arg (); + break; + + case 'e': + topic_name = ""; + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s\n" + "-k <Sender IOR> (default is file://Sender.ior)\n" + "-n <new topic>\n" + "-e <clearing topic name>\n" + "\n", + argv [0]), + -1); + } + } + + return 0; +} + + +int ACE_TMAIN (int argc, ACE_TCHAR* argv[]) +{ + try + { + // initialize the ORB + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv); + if (parse_args (argc, argv) != 0) + { + return -1; + } + + // create the factory object reference, + CORBA::Object_var sender_obj = + orb->string_to_object (sender_ior); + + // downcast the object reference to the appropriate type + ::TL_ResetTopic::Sender_var sender = + ::TL_ResetTopic::Sender::_narrow (sender_obj.in ()); + + if (CORBA::is_nil (sender.in ())) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to acquire 'Sender' objref\n"), + -1); + } + sender->set_new_topic (topic_name); + + orb->destroy (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Who is the culprit in the SenderDriver?\n"); + ACE_ERROR_RETURN ((LM_ERROR, + "Uncaught CORBA exception\n"), + 1); + } + return 0; +} diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/Sender/TL_ResetTopic_Sender.idl b/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/Sender/TL_ResetTopic_Sender.idl new file mode 100644 index 00000000000..c5e00ade823 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/Sender/TL_ResetTopic_Sender.idl @@ -0,0 +1,32 @@ +// $Id$ + +/** + * @file + * @author Marcel Smit <msmit@remedy.nl> + * + * by-hand idl3 translation of sender components. + */ + +#ifndef TL_RESETTOPIC_SENDER_IDL +#define TL_RESETTOPIC_SENDER_IDL + +#include "Connector/TL_ResetTopic_Connector.idl" + +module TL_ResetTopic +{ + interface ChangeTopicInterface + { + void set_new_topic (in string topic_name); + }; + + component Sender supports ChangeTopicInterface + { + port TL_ResetTopicTestConnector::DDS_Write info_write; + port TL_ResetTopicTestConnector::DDS_Update info_update; + + attribute unsigned short iterations; + attribute unsigned short keys; + }; +}; + +#endif diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/Sender/TL_ResetTopic_Sender.mpc b/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/Sender/TL_ResetTopic_Sender.mpc new file mode 100644 index 00000000000..54d6d13d885 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/Sender/TL_ResetTopic_Sender.mpc @@ -0,0 +1,166 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p TL_ResetTopicBase -l ../lib -o ../lib -c controller -u DDS Sender" + +project (TL_ResetTopicSender_idl_gen) : componentidldefaults, dds4ccm { + after += TL_ResetTopicConnector_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=SENDER_STUB_Export \ + -Wb,stub_export_include=Sender_stub_export.h \ + -Wb,skel_export_macro=SENDER_SVNT_Export \ + -Wb,skel_export_include=Sender_svnt_export.h \ + -Wb,svnt_export_macro=SENDER_SVNT_Export \ + -Wb,svnt_export_include=Sender_svnt_export.h \ + -Wb,exec_export_macro=SENDER_EXEC_Export \ + -Wb,exec_export_include=Sender_exec_export.h \ + -I .. + + IDL_Files { + TL_ResetTopic_Sender.idl + } +} + +project (TL_ResetTopicSender_lem_gen) : ciaoidldefaults, dds4ccm { + after += TL_ResetTopicSender_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=SENDER_LEM_STUB_Export \ + -Wb,stub_export_include=Sender_lem_stub_export.h \ + -SS -Gxhst -I $CIAO_ROOT/connectors -I .. + + IDL_Files { + TL_ResetTopic_SenderE.idl + } +} + +project (TL_ResetTopicSender_lem_stub) : ccm_svnt, dds4ccm_base { + after += TL_ResetTopicSender_lem_gen TL_ResetTopicSender_stub TL_ResetTopicBase_stub + libs += TL_ResetTopicBase_stub Sender_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = Sender_lem_stub + dynamicflags += SENDER_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + TL_ResetTopic_SenderEC.cpp + } + + Header_Files { + TL_ResetTopic_SenderEC.h + Sender_lem_stub_export.h + } + + Inline_Files { + TL_ResetTopic_SenderEC.inl + } +} + +project (TL_ResetTopicSender_stub) : ccm_stub, dds4ccm_base { + after += TL_ResetTopicSender_idl_gen TL_ResetTopicBase_stub TL_ResetTopicConnector_stub + libs += TL_ResetTopicBase_stub TL_ResetTopicConnector_stub + includes += .. + libpaths += ../lib + libout = ../lib + sharedname = Sender_stub + dynamicflags += SENDER_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + TL_ResetTopic_SenderC.cpp + } + + Header_Files { + TL_ResetTopic_SenderC.h + Sender_stub_export.h + } + + Inline_Files { + TL_ResetTopic_SenderC.inl + } +} + +project (TL_ResetTopicSender_exec) : ciao_executor, dds4ccm_lem_stub { + after += TL_ResetTopicSender_lem_stub TL_ResetTopicSender_stub \ + TL_ResetTopicConnector_lem_stub TL_ResetTopicConnector_stub + sharedname = Sender_exec + libs += Sender_stub Sender_lem_stub TL_ResetTopicBase_stub \ + TL_ResetTopicConnector_lem_stub TL_ResetTopicConnector_stub + libpaths += ../lib + includes += .. + libout = ../lib + dynamicflags += SENDER_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + TL_ResetTopic_Sender_exec.cpp + } + + Header_Files { + TL_ResetTopic_Sender_exec.h + Sender_exec_export.h + } + + Inline_Files { + } +} + + +project (TL_ResetTopicSender_svnt) : ciao_servant, dds4ccm_lem_stub, dds4ccm_skel { + after += TL_ResetTopicBase_stub TL_ResetTopicSender_lem_stub TL_ResetTopicConnector_stub \ + TL_ResetTopicConnector_svnt TL_ResetTopicConnector_lem_stub + sharedname = Sender_svnt + libs += Sender_stub Sender_lem_stub \ + TL_ResetTopicBase_stub TL_ResetTopicConnector_stub TL_ResetTopicConnector_svnt TL_ResetTopicConnector_lem_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += SENDER_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + TL_ResetTopic_SenderS.cpp + TL_ResetTopic_Sender_svnt.cpp + } + + Header_Files { + TL_ResetTopic_SenderS.h + TL_ResetTopic_Sender_svnt.h + Sender_svnt_export.h + } + + Inline_Files { + TL_ResetTopic_SenderS.inl + } +} + +project (TL_ResetTopicSender_Driver) : ccm_stub, valuetype, dds4ccm_lem_stub { + exename = SenderDriver + after += TL_ResetTopicSender_stub TL_ResetTopicConnector_stub + libs += Sender_stub TL_ResetTopicBase_stub TL_ResetTopicConnector_stub + + includes += .. + libpaths += ../lib + + exeout = ../lib + IDL_Files { + } + + Source_Files { + SenderDriver.cpp + } + + Header_Files { + } + + Inline_Files { + } +} + diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/Sender/TL_ResetTopic_Sender_exec.cpp b/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/Sender/TL_ResetTopic_Sender_exec.cpp new file mode 100644 index 00000000000..ae6442eda81 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/Sender/TL_ResetTopic_Sender_exec.cpp @@ -0,0 +1,427 @@ +// -*- C++ -*- +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v1.8.2 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ + +#include "TL_ResetTopic_Sender_exec.h" +#include "tao/ORB_Core.h" +#include "ace/Reactor.h" + +namespace CIAO_TL_ResetTopic_Sender_Impl +{ + + /** + * Timeout_Handler + */ + + Timeout_Handler::Timeout_Handler (Sender_exec_i &callback) + : callback_ (callback) + { + } + + int + Timeout_Handler::handle_timeout (const ACE_Time_Value &, const void *) + { + // Notify the subscribers + this->callback_.start_event_test (); + return 0; + } + + /** + * Component Executor Implementation Class: Sender_exec_i + */ + + Sender_exec_i::Sender_exec_i (void) + : iterations_ (0) + , keys_ (0) + , to_handler_ (0) + , topic_name_ ("TopicI") + , old_topic_name_ ("TopicI") + { + ACE_NEW_THROW_EX (this->to_handler_, + Timeout_Handler (*this), + ::CORBA::INTERNAL ()); + } + + Sender_exec_i::~Sender_exec_i (void) + { + delete this->to_handler_; + } + + // Supported operations and attributes. + ACE_Reactor* + Sender_exec_i::reactor (void) + { + ACE_Reactor* reactor = 0; + ::CORBA::Object_var ccm_object = + this->ciao_context_->get_CCM_object(); + if (! ::CORBA::is_nil (ccm_object.in ())) + { + ::CORBA::ORB_var orb = ccm_object->_get_orb (); + if (! ::CORBA::is_nil (orb.in ())) + { + reactor = orb->orb_core ()->reactor (); + } + } + if (reactor == 0) + { + throw ::CORBA::INTERNAL (); + } + return reactor; + } + + void Sender_exec_i::set_new_topic (const char * topic_name) + { + ACE_GUARD (TAO_SYNCH_RECURSIVE_MUTEX, guard, this->topic_name_lock_); + + this->old_topic_name_ = this->topic_name_; + this->topic_name_ = topic_name; + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::set_new_topic - " + "New topic name set <%C>\n", + topic_name)); + } + + void + Sender_exec_i::create_samples (void) + { + for (CORBA::UShort i = 1; i < this->keys_ + 1; ++i) + { + char key[7]; + TL_ResetTopicTest *new_key = new TL_ResetTopicTest; + ACE_OS::sprintf (key, "KEY_%d", i); + new_key->key = CORBA::string_dup(key); + new_key->iteration = 0; + this->tests_[key] = new_key; + + ::TL_ResetTopic::TL_ResetTopicTestConnector::Updater_var updater = + this->ciao_context_->get_connection_info_update_data(); + + updater->create_one (*new_key); + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::create_samples - " + "Sample <%C> created\n", + key)); + } + } + + bool + Sender_exec_i::set_topic_name (const char * topic_name) + { + if (ACE_OS::strcmp (topic_name, this->old_topic_name_.c_str()) != 0) + { + this->old_topic_name_ = topic_name; + bool ret = this->set_topic_name_writer (topic_name); + ret |= this->set_topic_name_updater (topic_name); + return ret; + } + if (ACE_OS::strlen (this->topic_name_.c_str()) > 256) + return false; + return true; + } + + bool + Sender_exec_i::set_topic_name_writer (const char * topic_name) + { + try + { + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::set_topic_name_writer - " + "Setting topic to <%C>\n", + topic_name)); + ::TL_ResetTopic::TL_ResetTopicTestConnector:: Writer_var writer = + this->ciao_context_->get_connection_info_write_data (); + if (::CORBA::is_nil (writer.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::set_topic_name_writer - " + "Unable to get writer interface\n")); + return false; + } + ::CORBA::Object_var cmp = writer->_get_component (); + if (::CORBA::is_nil (cmp.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::set_topic_name_writer - " + "Unable to get component interface\n")); + return false; + } + ::TL_ResetTopic::TL_ResetTopicTestConnector::CCM_DDS_Event_var conn = + ::TL_ResetTopic::TL_ResetTopicTestConnector::CCM_DDS_Event::_narrow (cmp.in ()); + if (::CORBA::is_nil (conn.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::set_topic_name_writer - " + "Unable to narrow connector interface\n")); + return false; + } + { + ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX, guard, this->topic_name_lock_, false); + conn->topic_name (topic_name); + } + } + catch (const ::CCM_DDS::NonChangeable &) + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::set_topic_name_writer - " + "Caught NonChangeable exception.\n")); + return false; + } + catch (const ::CCM_DDS::InternalError &) + { + if (ACE_OS::strlen (topic_name) > 256) + { + ACE_DEBUG ((LM_ERROR, "Sender_exec_i::set_topic_name_writer - " + "Expected InternalErr exception caught.\n")); + } + else + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::set_topic_name_writer - " + "Caught InternalError exception.\n")); + } + return false; + } + return true; + } + + bool + Sender_exec_i::set_topic_name_updater (const char * topic_name) + { + try + { + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::set_topic_name_updater - " + "Setting topic to <%C>\n", + topic_name)); + ::TL_ResetTopic::TL_ResetTopicTestConnector:: Updater_var updater = + this->ciao_context_->get_connection_info_update_data (); + if (::CORBA::is_nil (updater.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::set_topic_name_updater - " + "Unable to get updater interface\n")); + return false; + } + ::CORBA::Object_var cmp = updater->_get_component (); + if (::CORBA::is_nil (cmp.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::set_topic_name_updater - " + "Unable to get component interface\n")); + return false; + } + ::TL_ResetTopic::TL_ResetTopicTestConnector::CCM_DDS_State_var conn = + ::TL_ResetTopic::TL_ResetTopicTestConnector::CCM_DDS_State::_narrow (cmp.in ()); + if (::CORBA::is_nil (conn.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::set_topic_name_updater - " + "Unable to narrow connector interface\n")); + return false; + } + { + ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX, guard, this->topic_name_lock_, false); + conn->topic_name (topic_name); + } + this->create_samples (); + } + catch (const ::CCM_DDS::NonChangeable &) + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::set_topic_name_updater - " + "Caught NonChangeable exception.\n")); + return false; + } + catch (const ::CCM_DDS::InternalError &) + { + if (ACE_OS::strlen (topic_name) > 256) + { + ACE_DEBUG ((LM_ERROR, "Sender_exec_i::set_topic_name_updater - " + "Expected InternalErr exception caught.\n")); + } + else + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::set_topic_name_updater - " + "Caught InternalError exception.\n")); + } + return false; + } + return true; + } + + void + Sender_exec_i::start_event_test (void) + { + // Set the topic name on the connector first. Therefor we need to + // get to the connector first. + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::start_event_test - Start\n")); + + try + { + for (::CORBA::UShort key = 1; key < this->keys_ + 1; ++key) + { + TL_ResetTopicTest sample; + char tmp[7]; + ACE_OS::sprintf (tmp, "KEY_%d", key); + sample.key = CORBA::string_dup(tmp); + + for (::CORBA::UShort iter = 1; iter < this->iterations_ + 1; ++iter) + { + if (this->set_topic_name (this->topic_name_.c_str ())) + { + ::TL_ResetTopic::TL_ResetTopicTestConnector:: Writer_var writer = + this->ciao_context_->get_connection_info_write_data (); + sample.iteration = iter; + writer->write_one (sample, ::DDS::HANDLE_NIL); + + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::start_event_test - " + "Sample for topic <%C> written : key <%C> - iteration <%d>\n", + this->topic_name_.c_str (), tmp, iter)); + } + + ACE_Time_Value tv (0, 5000); + ACE_OS::sleep (tv); + } + } + for (Sample_Table::iterator iter = this->tests_.begin (); + iter != this->tests_.end (); + ++iter) + { + for (::CORBA::UShort i = 1; i < this->iterations_ + 1; ++i) + { + if (this->set_topic_name (this->topic_name_.c_str ())) + { + ::TL_ResetTopic::TL_ResetTopicTestConnector:: Updater_var updater = + this->ciao_context_->get_connection_info_update_data (); + iter->second->iteration = i; + updater->update_one (iter->second, ::DDS::HANDLE_NIL); + + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::start_event_test - " + "Sample for topic <%C> updated : key <%C> - iteration <%d>\n", + this->topic_name_.c_str (), + iter->second->key.in (), + i)); + } + + ACE_Time_Value tv (0, 5000); + ACE_OS::sleep (tv); + } + } + } + catch (const ::CORBA::BAD_INV_ORDER & ex) + { + if (this->topic_name_.empty()) + ACE_DEBUG ((LM_DEBUG, "Expected BAD_INV_ORDER caught\n")); + else + ex._tao_print_exception("ERROR:"); + } + catch (const ::CORBA::Exception & ex) + { + ex._tao_print_exception("ERROR:"); + } + catch (...) + { + ACE_ERROR ((LM_ERROR, "Sender_exec_i::start_event_test - " + "ERROR: Unexpected and unknown exception caught.\n")); + } + } + + // Component attributes and port operations. + + ::CORBA::UShort + Sender_exec_i::iterations (void) + { + return this->iterations_; + } + + void + Sender_exec_i::iterations ( + const ::CORBA::UShort iterations) + { + this->iterations_ = iterations; + } + + ::CORBA::UShort + Sender_exec_i::keys (void) + { + return this->keys_; + } + + void + Sender_exec_i::keys ( + const ::CORBA::UShort keys) + { + this->keys_ = keys; + } + + // Operations from Components::SessionComponent. + + void + Sender_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + this->ciao_context_ = + ::TL_ResetTopic::CCM_Sender_Context::_narrow (ctx); + + if ( ::CORBA::is_nil (this->ciao_context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + Sender_exec_i::configuration_complete (void) + { + /* Your code here. */ + } + + void + Sender_exec_i::ccm_activate (void) + { + this->create_samples (); + if (this->reactor ()->schedule_timer ( + this->to_handler_, + 0, + ACE_Time_Value (5, 0), + ACE_Time_Value (5, 0)) == -1) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Sender_exec_i::start : ") + ACE_TEXT ("Error scheduling timer"))); + } + } + + void + Sender_exec_i::ccm_passivate (void) + { + this->reactor()->cancel_timer(this->to_handler_); + } + + void + Sender_exec_i::ccm_remove (void) + { + /* Your code here. */ + } + + extern "C" SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_TL_ResetTopic_Sender_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_NORETURN ( + retval, + Sender_exec_i); + + return retval; + } +} diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/Sender/TL_ResetTopic_Sender_exec.h b/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/Sender/TL_ResetTopic_Sender_exec.h new file mode 100644 index 00000000000..0c550395a3d --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/Sender/TL_ResetTopic_Sender_exec.h @@ -0,0 +1,147 @@ +// -*- C++ -*- +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v1.8.2 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ +#ifndef CIAO_TL_RESETTOPIC_SENDER_EXEC_YSJ9S8_H_ +#define CIAO_TL_RESETTOPIC_SENDER_EXEC_YSJ9S8_H_ + +#include /**/ "ace/pre.h" + +#include "TL_ResetTopic_SenderEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ "Sender_exec_export.h" +#include "tao/LocalObject.h" + +#include <map> + +namespace CIAO_TL_ResetTopic_Sender_Impl +{ + class Sender_exec_i; + + /** + * Timeout_Handler + */ + class Timeout_Handler : + public ACE_Event_Handler + { + public: + Timeout_Handler (Sender_exec_i &callback); + /// Handle the timeout. + virtual int handle_timeout (const ACE_Time_Value &tv, + const void *arg); + private: + /// Maintains a handle that actually process the event + Sender_exec_i &callback_; + }; + + /** + * Component Executor Implementation Class: Sender_exec_i + */ + + class Sender_exec_i + : public virtual Sender_Exec, + public virtual ::CORBA::LocalObject + { + public: + Sender_exec_i (void); + virtual ~Sender_exec_i (void); + + //@{ + /** Supported operations and attributes. */ + virtual void set_new_topic (const char * topic_name); + //@} + + //@{ + /** Component attributes and port operations. */ + + virtual ::CORBA::UShort iterations (void); + + virtual void iterations (::CORBA::UShort iterations); + + virtual ::CORBA::UShort keys (void); + + virtual void keys (::CORBA::UShort keys); + //@} + + //@{ + /** Operations from Components::SessionComponent. */ + virtual void set_session_context (::Components::SessionContext_ptr ctx); + virtual void configuration_complete (void); + virtual void ccm_activate (void); + virtual void ccm_passivate (void); + virtual void ccm_remove (void); + //@} + + //@{ + /** User defined public operations. */ + bool set_topic_name (const char * topic_name); + bool set_topic_name_writer (const char * topic_name); + bool set_topic_name_updater (const char * topic_name); + void start_event_test (void); + //@} + + private: + ::TL_ResetTopic::CCM_Sender_Context_var ciao_context_; + + //@{ + /** Component attributes. */ + + ::CORBA::UShort iterations_; + + ::CORBA::UShort keys_; + //@} + + //@{ + /** User defined members. */ + Timeout_Handler *to_handler_; + ACE_CString topic_name_, old_topic_name_; + + TAO_SYNCH_RECURSIVE_MUTEX topic_name_lock_; + + typedef std::map<ACE_CString, TL_ResetTopicTest_var> Sample_Table; + + Sample_Table tests_; + //@} + + //@{ + /** User defined private operations. */ + void create_samples (void); + //@} + + /// Get the ACE_Reactor + ACE_Reactor* reactor (void); + }; + + extern "C" SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_TL_ResetTopic_Sender_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* ifndef */ diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/descriptors/Plan.cdp b/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/descriptors/Plan.cdp new file mode 100644 index 00000000000..6bad6fc3866 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/descriptors/Plan.cdp @@ -0,0 +1,338 @@ +<!-- $Id$ --> +<Deployment:DeploymentPlan + xmlns:Deployment="http://www.omg.org/Deployment" + xmlns:xmi="http://www.omg.org/XMI" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.omg.org/Deployment Deployment.xsd"> + <label>ResetTopic_Depl_1</label> + <UUID>ResetTopic_Depl_1</UUID> + + <implementation xmi:id="ResetTopic_EventConnectorImplementation"> + <name>ResetTopic_EventConnectorImplementation</name> + <source/> + <artifact xmi:idref="ResetTopic_Connector_ExecArtifact" /> + <artifact xmi:idref="ResetTopic_Connector_SvntArtifact" /> + <execParameter> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_TL_ResetTopic_TL_ResetTopicTestConnector_DDS_Event_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_TL_ResetTopic_TL_ResetTopicTestConnector_DDS_Event_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>TL_ResetTopic_Connector_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>TL_ResetTopic_Connector_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="ResetTopic_StateConnectorImplementation"> + <name>ResetTopic_StateConnectorImplementation</name> + <source/> + <artifact xmi:idref="ResetTopic_Connector_ExecArtifact" /> + <artifact xmi:idref="ResetTopic_Connector_SvntArtifact" /> + <execParameter> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_TL_ResetTopic_TL_ResetTopicTestConnector_DDS_State_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_TL_ResetTopic_TL_ResetTopicTestConnector_DDS_State_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>TL_ResetTopic_Connector_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>TL_ResetTopic_Connector_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SenderComponentImplementation"> + <name>SenderComponentImplementation</name> + <source/> + <artifact xmi:idref="Sender_ExecArtifact" /> + <artifact xmi:idref="Sender_SvntArtifact" /> + <execParameter> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_TL_ResetTopic_Sender_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_TL_ResetTopic_Sender_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Sender_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Sender_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <instance xmi:id="ResetTopic_SenderEventConnectorInstance"> + <name>ResetTopic_SenderEventConnectorInstance</name> + <node>SenderNode</node> + <source/> + <implementation xmi:idref="ResetTopic_EventConnectorImplementation" /> + <configProperty> + <name>topic_name</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>TopicI</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="ResetTopic_SenderStateConnectorInstance"> + <name>ResetTopic_SenderStateConnectorInstance</name> + <node>SenderNode</node> + <source/> + <implementation xmi:idref="ResetTopic_StateConnectorImplementation" /> + <configProperty> + <name>topic_name</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>TopicI</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="SenderComponentInstance"> + <name>SenderComponent</name> + <node>SenderNode</node> + <source/> + <implementation xmi:idref="SenderComponentImplementation" /> + <configProperty> + <name>rate</name> + <value> + <type> + <kind>tk_ushort</kind> + </type> + <value> + <ushort>15</ushort> + </value> + </value> + </configProperty> + <configProperty> + <name>keys</name> + <value> + <type> + <kind>tk_ushort</kind> + </type> + <value> + <ushort>5</ushort> + </value> + </value> + </configProperty> + <configProperty> + <name>iterations</name> + <value> + <type> + <kind>tk_ushort</kind> + </type> + <value> + <ushort>10</ushort> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Sender.ior</string> + </value> + </value> + </configProperty> + </instance> + + <connection> + <name>writer_connection</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>info_write_data</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="SenderComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>supplier_data</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="ResetTopic_SenderEventConnectorInstance" /> + </internalEndpoint> + </connection> + + <connection> + <name>updater_connection</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>info_update_data</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="SenderComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>observable_data</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="ResetTopic_SenderStateConnectorInstance" /> + </internalEndpoint> + </connection> + + <artifact xmi:id="Sender_ExecArtifact"> + <name>Sender_exec</name> + <source/> + <node/> + <location>Sender_exec</location> + </artifact> + <artifact xmi:id="Sender_SvntArtifact"> + <name>Sender_svnt</name> + <source/> + <node/> + <location>Sender_svnt</location> + </artifact> + <artifact xmi:id="Sender_StubArtifact"> + <name>Sender_stub</name> + <source/> + <node/> + <location>Sender_stub</location> + </artifact> + <artifact xmi:id="ResetTopic_Connector_ExecArtifact"> + <name>TL_ResetTopic_Connector_exec</name> + <source/> + <node/> + <location>TL_ResetTopicConnector_exec</location> + </artifact> + <artifact xmi:id="ResetTopic_Connector_SvntArtifact"> + <name>TL_ResetTopic_Connector_svnt</name> + <source/> + <node/> + <location>TL_ResetTopicConnector_svnt</location> + </artifact> + <artifact xmi:id="Receiver_ExecArtifact"> + <name>Receiver_exec</name> + <source/> + <node/> + <location>Receiver_exec</location> + </artifact> + <artifact xmi:id="Receiver_SvntArtifact"> + <name>Receiver_svnt</name> + <source/> + <node/> + <location>Receiver_svnt</location> + </artifact> + <artifact xmi:id="Receiver_StubArtifact"> + <name>Receiver_stub</name> + <source/> + <node/> + <location>Receiver_stub</location> + </artifact> +</Deployment:DeploymentPlan> diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/descriptors/run_test.pl b/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/descriptors/run_test.pl new file mode 100755 index 00000000000..0a1c1735413 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/TooLong/descriptors/run_test.pl @@ -0,0 +1,265 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{'ACE_ROOT'}/bin"; +use PerlACE::TestTarget; + +$CIAO_ROOT = "$ENV{'CIAO_ROOT'}"; +$TAO_ROOT = "$ENV{'TAO_ROOT'}"; +$DANCE_ROOT = "$ENV{'DANCE_ROOT'}"; + +$daemons_running = 0; +$em_running = 0; +$ns_running = 0; + +$nr_daemon = 1; +@ports = ( 60001 ); +@iorbases = ( "SenderNode.ior" ); +@iorfiles = 0; +@nodenames = ( "SenderNode" ); + +# ior files other than daemon +$ior_nsbase = "ns.ior"; +$ior_nsfile = 0; +$ior_embase = "EM.ior"; +$ior_emfile = 0; + +# Processes +$E = 0; +$EM = 0; +$NS = 0; +@DEAMONS = 0; + +# targets +@tg_daemons = 0; +$tg_naming = 0; +$tg_exe_man = 0; +$tg_executor = 0; + +$status = 0; +$cdp_file = "Plan.cdp"; + +sub create_targets { + # naming service + $tg_naming = PerlACE::TestTarget::create_target (1) || die "Create target for ns failed\n"; + $tg_naming->AddLibPath ('../lib'); + # daemon + for ($i = 0; $i < $nr_daemon; ++$i) { + $tg_daemons[$i] = PerlACE::TestTarget::create_target ($i+1) || die "Create target for daemon $i failed\n"; + $tg_daemons[$i]->AddLibPath ('../lib'); + } + # execution manager + $tg_exe_man = PerlACE::TestTarget::create_target (1) || die "Create target for EM failed\n"; + $tg_exe_man->AddLibPath ('../lib'); + # executor (plan_launcher) + $tg_executor = PerlACE::TestTarget::create_target (1) || die "Create target for executor failed\n"; + $tg_executor->AddLibPath ('../lib'); +} + +sub init_ior_files { + $ior_nsfile = $tg_naming->LocalFile ($ior_nsbase); + $ior_emfile = $tg_exe_man->LocalFile ($ior_embase); + for ($i = 0; $i < $nr_daemon; ++$i) { + $iorfiles[$i] = $tg_daemons[$i]->LocalFile ($iorbases[$i]); + } + delete_ior_files (); +} + +# Delete if there are any .ior files. +sub delete_ior_files { + for ($i = 0; $i < $nr_daemon; ++$i) { + $tg_daemons[$i]->DeleteFile ($iorbases[$i]); + } + $tg_naming->DeleteFile ($ior_nsbase); + $tg_exe_man->DeleteFile ($ior_embase); + for ($i = 0; $i < $nr_daemon; ++$i) { + $iorfiles[$i] = $tg_daemons[$i]->LocalFile ($iorbases[$i]); + } +} + +sub kill_node_daemon { + for ($i = 0; $i < $nr_daemon; ++$i) { + $DEAMONS[$i]->Kill (); $DEAMONS[$i]->TimedWait (1); + } +} + +sub kill_open_processes { + if ($daemons_running == 1) { + kill_node_daemon (); + } + + if ($em_running == 1) { + $EM->Kill (); $EM->TimedWait (1); + } + + if ($ns_running == 1) { + $NS->Kill (); $NS->TimedWait (1); + } + # in case shutdown did not perform as expected + $tg_executor->KillAll ('dance_locality_manager'); +} + +sub run_node_daemons { + for ($i = 0; $i < $nr_daemon; ++$i) { + $iorbase = $iorbases[$i]; + $iorfile = $iorfiles[$i]; + $port = $ports[$i]; + $nodename = $nodenames[$i]; + $iiop = "iiop://localhost:$port"; + $node_app = $tg_daemons[$i]->GetArchDir("$DANCE_ROOT/bin/") . "dance_locality_manager"; + + $d_cmd = "$DANCE_ROOT/bin/dance_node_manager"; + $d_param = "-ORBEndpoint $iiop -s $node_app -n $nodename=$iorfile -t 30 --domain-nc corbaloc:rir:/NameService"; + + print "Run dance_node_manager with $d_param\n"; + + $DEAMONS[$i] = $tg_daemons[$i]->CreateProcess ($d_cmd, $d_param); + $DEAMONS[$i]->Spawn (); + + if ($tg_daemons[$i]->WaitForFileTimed($iorbase, + $tg_daemons[$i]->ProcessStartWaitInterval ()) == -1) { + print STDERR + "ERROR: The ior $iorfile file of node daemon $i could not be found\n"; + for (; $i >= 0; --$i) { + $DEAMONS[$i]->Kill (); $DEAMONS[$i]->TimedWait (1); + } + return -1; + } + } + return 0; +} + +create_targets (); +init_ior_files (); + +# Invoke naming service + +$NS = $tg_naming->CreateProcess ("$TAO_ROOT/orbsvcs/Naming_Service/tao_cosnaming", " -ORBEndpoint iiop://localhost:60003 -o $ior_nsfile"); + +$ns_status = $NS->Spawn (); + +if ($ns_status != 0) { + print STDERR "ERROR: Unable to execute the naming service\n"; + kill_open_processes (); + exit 1; +} + +print STDERR "Starting Naming Service with -ORBEndpoint iiop://localhost:60003 -o ns.ior\n"; + +if ($tg_naming->WaitForFileTimed ($ior_nsbase, + $tg_naming->ProcessStartWaitInterval ()) == -1) { + print STDERR "ERROR: cannot find naming service IOR file\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} + +$ns_running = 1; +# Set up NamingService environment +$ENV{"NameServiceIOR"} = "corbaloc:iiop:localhost:60003/NameService"; + +# Invoke node daemon. +print "Invoking node daemon\n"; +$status = run_node_daemons (); + +if ($status != 0) { + print STDERR "ERROR: Unable to execute the node daemon\n"; + kill_open_processes (); + exit 1; +} + +$daemons_running = 1; + +# Invoke execution manager. +print "Invoking execution manager (dance_execution_manager.exe) with -e$ior_emfile\n"; +$EM = $tg_exe_man->CreateProcess ("$DANCE_ROOT/bin/dance_execution_manager", + "-e$ior_emfile --domain-nc corbaloc:rir:/NameService"); +$em_status = $EM->Spawn (); + +if ($em_status != 0) { + print STDERR "ERROR: dance_execution_manager returned $em_status"; + exit 1; +} + +if ($tg_exe_man->WaitForFileTimed ($ior_embase, + $tg_exe_man->ProcessStartWaitInterval ()) == -1) { + print STDERR + "ERROR: The ior file of execution manager could not be found\n"; + kill_open_processes (); + exit 1; +} + +$em_running = 1; + +# Invoke executor - start the application -. +print "Invoking executor - launch the application -\n"; + +print "Start dance_plan_launcher.exe with -x $cdp_file -k file://$ior_emfile\n"; +$E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-x $cdp_file -k file://$ior_emfile"); +$pl_status = $E->SpawnWaitKill (2 * $tg_executor->ProcessStartWaitInterval ()); + +if ($pl_status != 0) { + print STDERR "ERROR: dance_plan_launcher returned $pl_status\n"; + kill_open_processes (); + exit 1; +} + +for ($i = 0; $i < $nr_daemon; ++$i) { + if ($tg_daemons[$i]->WaitForFileTimed ($iorbases[$i], + $tg_daemons[$i]->ProcessStopWaitInterval ()) == -1) { + print STDERR "ERROR: The ior file of daemon $i could not be found\n"; + kill_open_processes (); + exit 1; + } +} + +print "Sleeping 10 seconds before clearing the topic name\n"; +sleep (10); + +$S = $tg_executor->CreateProcess ("../lib/SenderDriver", "-e"); +$driver_status = $S->SpawnWaitKill (2 * $tg_executor->ProcessStartWaitInterval ()); +if ($driver_status != 0) { + print STDERR "ERROR: unable to launch driver\n"; + kill_open_processes (); + exit 1; +} + +print "Sleeping 10 seconds before setting the topic name again\n"; +sleep (10); + +$S = $tg_executor->CreateProcess ("../lib/SenderDriver", "-n ABCEDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789ABCEDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789ABCEDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789ABCEDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789ABCEDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"); +$driver_status = $S->SpawnWaitKill (2 * $tg_executor->ProcessStartWaitInterval ()); +if ($driver_status != 0) { + print STDERR "ERROR: unable to launch driver\n"; + kill_open_processes (); + exit 1; +} + +print "Sleeping 10 seconds before stopping\n"; +sleep (10); + +# Invoke executor - stop the application -. +print "Invoking executor - stop the application -\n"; +print "by running dance_plan_launcher.exe with -k file://$ior_emfile -x $cdp_file\n"; + +$E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-k file://$ior_emfile -x $cdp_file -s"); +$pl_status = $E->SpawnWaitKill ($tg_executor->ProcessStartWaitInterval ()); + +if ($pl_status != 0) { + print STDERR "ERROR: dance_plan_launcher returned $pl_status\n"; + kill_open_processes (); + exit 1; +} + +print "Executor returned.\n"; +print "Shutting down rest of the processes.\n"; + +delete_ior_files (); +kill_open_processes (); + +exit $status; diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Base/UL_ResetTopic_Base.idl b/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Base/UL_ResetTopic_Base.idl new file mode 100644 index 00000000000..c90d084978d --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Base/UL_ResetTopic_Base.idl @@ -0,0 +1,23 @@ +// $Id$ + +/** + * @file UL_ResetTopic_Base.idl + * @author Marcel Smit <msmit@remedy.nl> + */ + +#ifndef UL_RESETTOPIC_BASE_IDL +#define UL_RESETTOPIC_BASE_IDL + +#pragma ndds typesupport "Base/UL_ResetTopic_BaseSupport.h" + +#pragma DCPS_DATA_TYPE "UL_ResetTopicTest" +#pragma DCPS_DATA_KEY "UL_ResetTopicTest key" + +struct UL_ResetTopicTest { + string key; //@key + long iteration; +}; + +typedef sequence<UL_ResetTopicTest> UL_ResetTopicTestSeq; + +#endif diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Base/UL_ResetTopic_Base.mpc b/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Base/UL_ResetTopic_Base.mpc new file mode 100644 index 00000000000..bd879c16e8d --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Base/UL_ResetTopic_Base.mpc @@ -0,0 +1,26 @@ +// $Id$ + +project (UL_ResetTopicBase_stub) : taoidldefaults, dds4ccm_ts_default { + sharedname = UL_ResetTopicBase_stub + dynamicflags += UL_RESETTOPIC_BASE_STUB_BUILD_DLL + libout = ../lib + + idlflags += -SS -Sci \ + -Wb,stub_export_macro=UL_RESETTOPIC_BASE_STUB_Export \ + -Wb,stub_export_include=ResetTopic_Base_stub_export.h + + IDL_Files { + idlflags += -Gxhst + UL_ResetTopic_Base.idl + } + + opendds_ts_flags += --export=UL_RESETTOPIC_BASE_STUB_Export + + DDSGenerator_Files { + UL_ResetTopic_Base.idl + } + + Source_Files { + } +} + diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Connector/UL_ResetTopic_Connector.idl b/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Connector/UL_ResetTopic_Connector.idl new file mode 100644 index 00000000000..356d663a39a --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Connector/UL_ResetTopic_Connector.idl @@ -0,0 +1,23 @@ +// $Id$ + +/** + * @file UL_ResetTopic_Connector.idl + * @author Marcel Smit <msmit@remedy.nl> + */ + +#ifndef UL_RESETTOPIC_CONNECTOR_IDL_ +#define UL_RESETTOPIC_CONNECTOR_IDL_ + +#include <Components.idl> +#include <ccm_dds.idl> + +#include "Base/UL_ResetTopic_Base.idl" + +#pragma ciao lem "Connector/UL_ResetTopic_ConnectorE.idl" + +module UL_ResetTopic +{ + module ::CCM_DDS::Typed < ::UL_ResetTopicTest, ::UL_ResetTopicTestSeq> UL_ResetTopicTestConnector; +}; + +#endif /* UL_ResetTopic_CONNECTOR_IDL_ */ diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Connector/UL_ResetTopic_Connector.mpc b/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Connector/UL_ResetTopic_Connector.mpc new file mode 100644 index 00000000000..2c4579b3a4f --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Connector/UL_ResetTopic_Connector.mpc @@ -0,0 +1,148 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p UL_ResetTopicBase -l .. -o ../lib -u DDS UL_ResetTopic_Connector" + +project (UL_ResetTopicConnector_idl_gen) : connectoridldefaults, dds4ccm { + after += DDS4CCM_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=UL_RESETTOPIC_CONNECTOR_STUB_Export \ + -Wb,stub_export_include=ResetTopic_Connector_stub_export.h \ + -Wb,skel_export_macro=UL_RESETTOPIC_CONNECTOR_SVNT_Export \ + -Wb,skel_export_include=ResetTopic_Connector_svnt_export.h \ + -Wb,svnt_export_macro=UL_RESETTOPIC_CONNECTOR_SVNT_Export \ + -Wb,svnt_export_include=ResetTopic_Connector_svnt_export.h \ + -Wb,conn_export_macro=UL_RESETTOPIC_CONNECTOR_CONN_Export \ + -Wb,conn_export_include=ResetTopic_Connector_conn_export.h \ + -I .. + + IDL_Files { + UL_ResetTopic_Connector.idl + } +} + +project (UL_ResetTopicConnector_lem_gen) : ciaoidldefaults, dds4ccm { + custom_only = 1 + after += UL_ResetTopicConnector_idl_gen + idlflags += -Wb,stub_export_macro=UL_RESETTOPIC_CONNECTOR_LEM_STUB_Export \ + -Wb,stub_export_include=UL_ResetTopic_Connector_lem_stub_export.h \ + -SS -Gxhst \ + -I .. + + IDL_Files { + UL_ResetTopic_ConnectorE.idl + } +} + +project (UL_ResetTopicConnector_lem_stub) : ccm_svnt, dds4ccm_lem_stub { + after += UL_ResetTopicConnector_lem_gen UL_ResetTopicConnector_stub \ + UL_ResetTopicBase_stub + libs += UL_ResetTopicBase_stub UL_ResetTopicConnector_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = UL_ResetTopicConnector_lem_stub + dynamicflags += UL_RESETTOPIC_CONNECTOR_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + UL_ResetTopic_ConnectorEC.cpp + } + + Header_Files { + UL_ResetTopic_ConnectorEC.h + UL_ResetTopic_Connector_lem_stub_export.h + } + + Inline_Files { + UL_ResetTopic_ConnectorEC.inl + } +} + +project (UL_ResetTopicConnector_stub) : ccm_stub, dds4ccm_base { + after += UL_ResetTopicConnector_idl_gen UL_ResetTopicBase_stub + libs += UL_ResetTopicBase_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = UL_ResetTopicConnector_stub + dynamicflags += UL_RESETTOPIC_CONNECTOR_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + UL_ResetTopic_ConnectorC.cpp + } + + Header_Files { + UL_ResetTopic_ConnectorC.h + UL_ResetTopic_Connector_stub_export.h + } + + Inline_Files { + UL_ResetTopic_ConnectorC.inl + } +} + +project (UL_ResetTopicConnector_exec) : ciao_executor, dds4ccm_impl { + after += UL_ResetTopicConnector_lem_stub UL_ResetTopicConnector_stub \ + UL_ResetTopicBase_stub + sharedname = UL_ResetTopicConnector_exec + libs += UL_ResetTopicConnector_stub UL_ResetTopicConnector_lem_stub \ + UL_ResetTopicBase_stub UL_ResetTopicBase_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += UL_RESETTOPIC_CONNECTOR_CONN_BUILD_DLL + + IDL_Files { + } + + Source_Files { + UL_ResetTopic_Connector_conn.cpp + } + + Header_Files { + UL_ResetTopic_Connector_conn.h + UL_ResetTopic_Connector_conn_export.h + } + + Inline_Files { + } +} + + +project (UL_ResetTopicConnector_svnt) : ciao_servant, dds4ccm_impl { + after += UL_ResetTopicConnector_lem_stub UL_ResetTopicConnector_exec \ + UL_ResetTopicConnector_stub + sharedname = UL_ResetTopicConnector_svnt + libs += UL_ResetTopicConnector_stub \ + UL_ResetTopicConnector_lem_stub \ + UL_ResetTopicBase_stub \ + UL_ResetTopicConnector_exec + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += UL_RESETTOPIC_CONNECTOR_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + UL_ResetTopic_ConnectorS.cpp + UL_ResetTopic_Connector_svnt.cpp + } + + Header_Files { + UL_ResetTopic_ConnectorS.h + UL_ResetTopic_Connector_svnt.h + UL_ResetTopic_Connector_svnt_export.h + } + + Inline_Files { + UL_ResetTopic_ConnectorS.inl + } +} + + diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Receiver/ReceiverDriver.cpp b/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Receiver/ReceiverDriver.cpp new file mode 100644 index 00000000000..7189a56c2e8 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Receiver/ReceiverDriver.cpp @@ -0,0 +1,88 @@ +//$Id$ +/* + * @file ReceiverDriver.cpp + * + * @author Marcel Smit + */ + + +#include "UL_ResetTopic_ReceiverC.h" +#include "ace/streams.h" +#include "ace/Get_Opt.h" + +const ACE_TCHAR *receiver_ior = ACE_TEXT ("file://Receiver.ior"); +const ACE_TCHAR *topic_name = ACE_TEXT (""); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:n:")); + int c; + + while ((c = get_opts ()) != -1) + { + switch (c) + { + case 'k': + receiver_ior = get_opts.opt_arg (); + break; + + case 'n': + topic_name = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s\n" + "-k <Receiver IOR> (default is file://Receiver.ior)\n" + "-n <new topic>\n" + "\n", + argv [0]), + -1); + } + } + + return 0; +} + + +int ACE_TMAIN (int argc, ACE_TCHAR* argv[]) +{ + try + { + // initialize the ORB + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv); + if (parse_args (argc, argv) != 0) + { + return -1; + } + + // create the factory object reference, + CORBA::Object_var receiver_obj = + orb->string_to_object (receiver_ior); + + // downcast the object reference to the appropriate type + ::UL_ResetTopic::Receiver_var receiver = + ::UL_ResetTopic::Receiver::_narrow (receiver_obj.in ()); + + if (CORBA::is_nil (receiver.in ())) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to acquire 'Receiver' objref\n"), + -1); + } + receiver->set_new_topic (topic_name); + + orb->destroy (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Who is the culprit in the ReceiverDriver?\n"); + ACE_ERROR_RETURN ((LM_ERROR, + "Uncaught CORBA exception\n"), + 1); + } + return 0; +} diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Receiver/UL_ResetTopic_Receiver.idl b/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Receiver/UL_ResetTopic_Receiver.idl new file mode 100644 index 00000000000..045716c67fa --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Receiver/UL_ResetTopic_Receiver.idl @@ -0,0 +1,28 @@ +// $Id$ + +/** + * @file + * @author Marcel Smit <msmit@remedy.nl> + */ + +#ifndef RECEIVER_IDL +#define RECEIVER_IDL + +#include "Connector/UL_ResetTopic_Connector.idl" + +module UL_ResetTopic +{ + interface ChangeTopicInterface + { + void set_new_topic (in string topic_name); + }; + + component Receiver supports ChangeTopicInterface + { + port UL_ResetTopicTestConnector::DDS_StateListen info_out_state; + + attribute unsigned short iterations; + }; +}; + +#endif diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Receiver/UL_ResetTopic_Receiver.mpc b/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Receiver/UL_ResetTopic_Receiver.mpc new file mode 100644 index 00000000000..0de0609a041 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Receiver/UL_ResetTopic_Receiver.mpc @@ -0,0 +1,163 @@ +// $Id$ + +project (UL_ResetTopicReceiver_idl_gen) : componentidldefaults, dds4ccm { + custom_only = 1 + after += UL_ResetTopicConnector_idl_gen + idlflags += -Wb,stub_export_macro=RECEIVER_STUB_Export \ + -Wb,stub_export_include=Receiver_stub_export.h \ + -Wb,skel_export_macro=RECEIVER_SVNT_Export \ + -Wb,skel_export_include=Receiver_svnt_export.h \ + -Wb,svnt_export_macro=RECEIVER_SVNT_Export \ + -Wb,svnt_export_include=Receiver_svnt_export.h \ + -Wb,exec_export_macro=RECEIVER_EXEC_Export \ + -Wb,exec_export_include=Receiver_exec_export.h \ + -I.. + IDL_Files { + UL_ResetTopic_Receiver.idl + } +} + +project (UL_ResetTopicReceiver_lem_gen) : ciaoidldefaults, dds4ccm { + after += UL_ResetTopicReceiver_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=RECEIVER_LEM_STUB_Export \ + -Wb,stub_export_include=Receiver_lem_stub_export.h \ + -SS -Gxhst -I.. + + IDL_Files { + UL_ResetTopic_ReceiverE.idl + } +} + +project (UL_ResetTopicReceiver_lem_stub) : ccm_svnt, dds4ccm_base { + after += UL_ResetTopicReceiver_lem_gen UL_ResetTopicReceiver_stub UL_ResetTopicConnector_stub UL_ResetTopicBase_stub + libs += Receiver_stub UL_ResetTopicConnector_stub UL_ResetTopicBase_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = Receiver_lem_stub + dynamicflags += RECEIVER_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + UL_ResetTopic_ReceiverEC.cpp + } + + Header_Files { + UL_ResetTopic_ReceiverEC.h + Receiver_lem_stub_export.h + } + + Inline_Files { + UL_ResetTopic_ReceiverEC.inl + } +} + +project (UL_ResetTopicReceiver_stub) : ccm_stub, dds4ccm_base { + after += UL_ResetTopicReceiver_idl_gen UL_ResetTopicConnector_stub UL_ResetTopicBase_stub UL_ResetTopicConnector_lem_gen + libs += UL_ResetTopicConnector_stub UL_ResetTopicBase_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = Receiver_stub + dynamicflags += RECEIVER_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + UL_ResetTopic_ReceiverC.cpp + } + + Header_Files { + UL_ResetTopic_ReceiverC.h + Receiver_stub_export.h + } + + Inline_Files { + UL_ResetTopic_ReceiverC.inl + } +} + +project (UL_ResetTopicReceiver_exec) : ciao_executor, dds4ccm_lem_stub { + after += UL_ResetTopicReceiver_lem_stub UL_ResetTopicReceiver_stub \ + UL_ResetTopicBase_stub UL_ResetTopicConnector_stub \ + UL_ResetTopicConnector_lem_stub + sharedname = Receiver_exec + libs += Receiver_stub Receiver_lem_stub UL_ResetTopicBase_stub \ + UL_ResetTopicConnector_stub UL_ResetTopicConnector_lem_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += RECEIVER_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + UL_ResetTopic_Receiver_exec.cpp + } + + Header_Files { + UL_ResetTopic_Receiver_exec.h + Receiver_exec_export.h + } + + Inline_Files { + } +} + + +project (UL_ResetTopicReceiver_svnt) : ciao_servant, dds4ccm_lem_stub, dds4ccm_skel { + after += UL_ResetTopicReceiver_lem_stub UL_ResetTopicBase_stub UL_ResetTopicConnector_stub UL_ResetTopicConnector_svnt UL_ResetTopicReceiver_exec UL_ResetTopicConnector_lem_stub + sharedname = Receiver_svnt + libs += Receiver_stub Receiver_lem_stub UL_ResetTopicBase_stub UL_ResetTopicConnector_stub UL_ResetTopicConnector_svnt Receiver_exec UL_ResetTopicConnector_lem_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += RECEIVER_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + UL_ResetTopic_ReceiverS.cpp + UL_ResetTopic_Receiver_svnt.cpp + } + + Header_Files { + UL_ResetTopic_ReceiverS.h + UL_ResetTopic_Receiver_svnt.h + Receiver_svnt_export.h + } + + Inline_Files { + UL_ResetTopic_ReceiverS.inl + } +} + +project (UL_ResetTopicReceiver_Driver) : ccm_stub, valuetype, dds4ccm_lem_stub { + exename = ReceiverDriver + after += UL_ResetTopicReceiver_stub UL_ResetTopicConnector_stub + libs += Receiver_stub UL_ResetTopicBase_stub UL_ResetTopicConnector_stub + + includes += .. + libpaths += ../lib + + exeout = ../lib + IDL_Files { + } + + Source_Files { + ReceiverDriver.cpp + } + + Header_Files { + } + + Inline_Files { + } +} + diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Receiver/UL_ResetTopic_Receiver_exec.cpp b/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Receiver/UL_ResetTopic_Receiver_exec.cpp new file mode 100644 index 00000000000..7132fb5cb15 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Receiver/UL_ResetTopic_Receiver_exec.cpp @@ -0,0 +1,330 @@ +// -*- C++ -*- +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v2.0.4 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ + +#include "UL_ResetTopic_Receiver_exec.h" + +namespace CIAO_UL_ResetTopic_Receiver_Impl +{ + + /** + * Facet Executor Implementation Class: info_out_state_data_listener_exec_i + */ + + info_out_state_data_listener_exec_i::info_out_state_data_listener_exec_i ( + ::UL_ResetTopic::CCM_Receiver_Context_ptr ctx, + Atomic_Boolean &samples_received) + : ciao_context_ ( + ::UL_ResetTopic::CCM_Receiver_Context::_duplicate (ctx)) + , samples_received_(samples_received) + { + } + + info_out_state_data_listener_exec_i::~info_out_state_data_listener_exec_i (void) + { + } + + // Operations from ::UL_ResetTopic::UL_ResetTopicTestConnector::StateListener + + void + info_out_state_data_listener_exec_i::on_creation ( + const ::UL_ResetTopicTest & datum, + const ::CCM_DDS::ReadInfo & /* info */) + { + ACE_DEBUG ((LM_DEBUG, "info_out_state_data_listener_exec_i::on_creation - " + "Sample <%C> created\n", + datum.key.in ())); + } + + void + info_out_state_data_listener_exec_i::on_one_update ( + const ::UL_ResetTopicTest & datum, + const ::CCM_DDS::ReadInfo & /* info */) + { + this->samples_received_ = true; + ACE_DEBUG ((LM_DEBUG, "info_out_state_data_listener_exec_i::on_one_update - " + "Sample <%C> updated: <%u>\n", + datum.key.in (), + datum.iteration)); + } + + void + info_out_state_data_listener_exec_i::on_many_updates ( + const ::UL_ResetTopicTestSeq & /* data */, + const ::CCM_DDS::ReadInfoSeq & /* infos */) + { + /* Your code here. */ + } + + void + info_out_state_data_listener_exec_i::on_deletion ( + const ::UL_ResetTopicTest & /* datum */, + const ::CCM_DDS::ReadInfo & /* info */) + { + /* Your code here. */ + } + + /** + * Facet Executor Implementation Class: info_out_state_status_exec_i + */ + + info_out_state_status_exec_i::info_out_state_status_exec_i ( + ::UL_ResetTopic::CCM_Receiver_Context_ptr ctx) + : ciao_context_ ( + ::UL_ResetTopic::CCM_Receiver_Context::_duplicate (ctx)) + { + } + + info_out_state_status_exec_i::~info_out_state_status_exec_i (void) + { + } + + // Operations from ::CCM_DDS::PortStatusListener + + void + info_out_state_status_exec_i::on_requested_deadline_missed ( + ::DDS::DataReader_ptr /* the_reader */, + const ::DDS::RequestedDeadlineMissedStatus & /* status */) + { + /* Your code here. */ + } + + void + info_out_state_status_exec_i::on_sample_lost ( + ::DDS::DataReader_ptr /* the_reader */, + const ::DDS::SampleLostStatus & /* status */) + { + /* Your code here. */ + } + + /** + * Component Executor Implementation Class: Receiver_exec_i + */ + + Receiver_exec_i::Receiver_exec_i (void) + : iterations_ (0) + , samples_received_(false) + { + } + + Receiver_exec_i::~Receiver_exec_i (void) + { + } + + // Supported operations and attributes. + void + Receiver_exec_i::set_new_topic (::CORBA::Object_ptr cmp, + const char * topic_name) + { + if (::CORBA::is_nil (cmp)) + { + ACE_ERROR ((LM_ERROR, "ERROR: Receiver_exec_i::set_topic_name_writer - " + "Unable to get component interface\n")); + throw ::CORBA::INTERNAL (); + } + ::UL_ResetTopic::UL_ResetTopicTestConnector::CCM_DDS_State_var conn = + ::UL_ResetTopic::UL_ResetTopicTestConnector::CCM_DDS_State::_narrow (cmp); + if (::CORBA::is_nil (conn.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: Receiver_exec_i::set_topic_name_writer - " + "Unable to narrow connector interface\n")); + throw ::CORBA::INTERNAL (); + } + conn->topic_name (topic_name); + +// ::CCM_DDS::DataListenerControl_var dlc = +// this->ciao_context_->get_connection_info_out_event_data_control (); +// dlc->mode (::CCM_DDS::ONE_BY_ONE); + } + + void + Receiver_exec_i::set_new_topic (const char * topic_name) + { + // The ReceiverDriver invokes this method. Therefor first check wether + // samples were received during last run + + if (this->samples_received_.value()) + ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::set_new_topic - " + "OK, samples received during last run\n")); + else + ACE_ERROR ((LM_ERROR, "Receiver_exec_i::set_new_topic - " + "ERROR: No samples received during last run\n")); + + this->samples_received_ = false; + + ::CORBA::Object_var cmp; + try + { + ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::set_new_topic - " + "Setting topic to <%C>\n", + topic_name)); + //First listener + ::UL_ResetTopic::UL_ResetTopicTestConnector::Reader_var reader = + this->ciao_context_->get_connection_info_out_state_data(); + + if (::CORBA::is_nil (reader.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: Receiver_exec_i::set_new_topic - " + "ciao_info_out_event_data_listener_ seems nil\n")); + throw ::CORBA::INTERNAL (); + } + cmp = reader->_get_component (); + this->set_new_topic (cmp.in (), topic_name); + + //next listener + if (::CORBA::is_nil (this->ciao_info_out_state_status_.in ())) + { + ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::set_new_topic - " + "ciao_info_out_event_status_ seems nil\n")); + } + else + { + cmp = this->ciao_info_out_state_status_->_get_component (); + this->set_new_topic (cmp.in (), topic_name); + } + } + catch (const ::CCM_DDS::NonChangeable &) + { + ACE_ERROR ((LM_ERROR, "ERROR: Receiver_exec_i::set_topic_name_writer - " + "Caught NonChangeable exception.\n")); + } + } + + // Component attributes and port operations. + + ::UL_ResetTopic::UL_ResetTopicTestConnector::CCM_StateListener_ptr + Receiver_exec_i::get_info_out_state_data_listener (void) + { + if ( ::CORBA::is_nil (this->ciao_info_out_state_data_listener_.in ())) + { + info_out_state_data_listener_exec_i *tmp = 0; + ACE_NEW_RETURN ( + tmp, + info_out_state_data_listener_exec_i ( + this->ciao_context_.in (), + this->samples_received_), + ::UL_ResetTopic::UL_ResetTopicTestConnector::CCM_StateListener::_nil ()); + + this->ciao_info_out_state_data_listener_ = tmp; + } + + return + ::UL_ResetTopic::UL_ResetTopicTestConnector::CCM_StateListener::_duplicate ( + this->ciao_info_out_state_data_listener_.in ()); + } + + ::CCM_DDS::CCM_PortStatusListener_ptr + Receiver_exec_i::get_info_out_state_status (void) + { + if ( ::CORBA::is_nil (this->ciao_info_out_state_status_.in ())) + { + info_out_state_status_exec_i *tmp = 0; + ACE_NEW_RETURN ( + tmp, + info_out_state_status_exec_i ( + this->ciao_context_.in ()), + ::CCM_DDS::CCM_PortStatusListener::_nil ()); + + this->ciao_info_out_state_status_ = tmp; + } + + return + ::CCM_DDS::CCM_PortStatusListener::_duplicate ( + this->ciao_info_out_state_status_.in ()); + } + + ::CORBA::UShort + Receiver_exec_i::iterations (void) + { + return this->iterations_; + } + + void + Receiver_exec_i::iterations ( + const ::CORBA::UShort iterations) + { + this->iterations_ = iterations; + } + + // Operations from Components::SessionComponent. + + void + Receiver_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + this->ciao_context_ = + ::UL_ResetTopic::CCM_Receiver_Context::_narrow (ctx); + + if ( ::CORBA::is_nil (this->ciao_context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + Receiver_exec_i::configuration_complete (void) + { + ::CCM_DDS::StateListenerControl_var dlc = + this->ciao_context_->get_connection_info_out_state_data_control (); + dlc->mode (::CCM_DDS::ONE_BY_ONE); + } + + void + Receiver_exec_i::ccm_activate (void) + { + /* Your code here. */ + } + + void + Receiver_exec_i::ccm_passivate (void) + { + /* Your code here. */ + } + + void + Receiver_exec_i::ccm_remove (void) + { + if (this->samples_received_.value()) + ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::ccm_remove - " + "OK, samples received during last run\n")); + else + ACE_ERROR ((LM_ERROR, "Receiver_exec_i::ccm_remove - " + "ERROR: No samples received during last run\n")); + } + + extern "C" RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_UL_ResetTopic_Receiver_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_NORETURN ( + retval, + Receiver_exec_i); + + return retval; + } +} diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Receiver/UL_ResetTopic_Receiver_exec.h b/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Receiver/UL_ResetTopic_Receiver_exec.h new file mode 100644 index 00000000000..a534a4378b1 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Receiver/UL_ResetTopic_Receiver_exec.h @@ -0,0 +1,199 @@ +// -*- C++ -*- +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v2.0.4 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ +#ifndef CIAO_UL_RESETTOPIC_RECEIVER_EXEC_WHDIFX_H_ +#define CIAO_UL_RESETTOPIC_RECEIVER_EXEC_WHDIFX_H_ + +#include /**/ "ace/pre.h" + +#include "UL_ResetTopic_ReceiverEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ "Receiver_exec_export.h" +#include "tao/LocalObject.h" + +namespace CIAO_UL_ResetTopic_Receiver_Impl +{ + typedef ACE_Atomic_Op <TAO_SYNCH_MUTEX, CORBA::Boolean> Atomic_Boolean; + + /** + * Provider Executor Implementation Class: info_out_state_data_listener_exec_i + */ + + class info_out_state_data_listener_exec_i + : public virtual ::UL_ResetTopic::UL_ResetTopicTestConnector::CCM_StateListener, + public virtual ::CORBA::LocalObject + { + public: + info_out_state_data_listener_exec_i ( + ::UL_ResetTopic::CCM_Receiver_Context_ptr ctx, + Atomic_Boolean &samples_received); + virtual ~info_out_state_data_listener_exec_i (void); + + /** @name Operations and attributes from UL_ResetTopic::UL_ResetTopicTestConnector::StateListener */ + //@{ + + virtual + void on_creation ( + const ::UL_ResetTopicTest & datum, + const ::CCM_DDS::ReadInfo & info); + + virtual + void on_one_update ( + const ::UL_ResetTopicTest & datum, + const ::CCM_DDS::ReadInfo & info); + + virtual + void on_many_updates ( + const ::UL_ResetTopicTestSeq & data, + const ::CCM_DDS::ReadInfoSeq & infos); + + virtual + void on_deletion ( + const ::UL_ResetTopicTest & datum, + const ::CCM_DDS::ReadInfo & info); + //@} + + private: + ::UL_ResetTopic::CCM_Receiver_Context_var ciao_context_; + Atomic_Boolean &samples_received_; + }; + + /** + * Provider Executor Implementation Class: info_out_state_status_exec_i + */ + + class info_out_state_status_exec_i + : public virtual ::CCM_DDS::CCM_PortStatusListener, + public virtual ::CORBA::LocalObject + { + public: + info_out_state_status_exec_i ( + ::UL_ResetTopic::CCM_Receiver_Context_ptr ctx); + virtual ~info_out_state_status_exec_i (void); + + /** @name Operations and attributes from CCM_DDS::PortStatusListener */ + //@{ + + virtual + void on_requested_deadline_missed ( + ::DDS::DataReader_ptr the_reader, + const ::DDS::RequestedDeadlineMissedStatus & status); + + virtual + void on_sample_lost ( + ::DDS::DataReader_ptr the_reader, + const ::DDS::SampleLostStatus & status); + //@} + + private: + ::UL_ResetTopic::CCM_Receiver_Context_var ciao_context_; + }; + + /** + * Component Executor Implementation Class: Receiver_exec_i + */ + + class Receiver_exec_i + : public virtual Receiver_Exec, + public virtual ::CORBA::LocalObject + { + public: + Receiver_exec_i (void); + virtual ~Receiver_exec_i (void); + + /** @name Supported operations and attributes. */ + //@{ + + virtual void set_new_topic ( + const char * topic_name); + + //@} + + /** @name Component attributes and port operations. */ + //@{ + + virtual ::UL_ResetTopic::UL_ResetTopicTestConnector::CCM_StateListener_ptr + get_info_out_state_data_listener (void); + + virtual ::CCM_DDS::CCM_PortStatusListener_ptr + get_info_out_state_status (void); + + virtual ::CORBA::UShort iterations ( + void); + + virtual void iterations ( + ::CORBA::UShort iterations); + //@} + + /** @name Operations from Components::SessionComponent. */ + //@{ + virtual void set_session_context (::Components::SessionContext_ptr ctx); + virtual void configuration_complete (void); + virtual void ccm_activate (void); + virtual void ccm_passivate (void); + virtual void ccm_remove (void); + //@} + + /** @name User defined public operations. */ + //@{ + + //@} + + private: + ::UL_ResetTopic::CCM_Receiver_Context_var ciao_context_; + + /** @name Component attributes. */ + //@{ + ::UL_ResetTopic::UL_ResetTopicTestConnector::CCM_StateListener_var ciao_info_out_state_data_listener_; + ::CCM_DDS::CCM_PortStatusListener_var ciao_info_out_state_status_; + + ::CORBA::UShort iterations_; + //@} + + /** @name User defined members. */ + //@{ + Atomic_Boolean samples_received_; + //@} + + /** @name User defined private operations. */ + //@{ + void set_new_topic (::CORBA::Object_ptr cmp, + const char * topic_name); + + //@} + }; + + extern "C" RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_UL_ResetTopic_Receiver_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* ifndef */ diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Sender/SenderDriver.cpp b/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Sender/SenderDriver.cpp new file mode 100644 index 00000000000..188954c8b23 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Sender/SenderDriver.cpp @@ -0,0 +1,88 @@ +//$Id$ +/* + * @file SenderDriver.cpp + * + * @author Marcel Smit + */ + + +#include "UL_ResetTopic_SenderC.h" +#include "ace/streams.h" +#include "ace/Get_Opt.h" + +const ACE_TCHAR *sender_ior = ACE_TEXT ("file://Sender.ior"); +const ACE_TCHAR *topic_name = ACE_TEXT (""); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:n:")); + int c; + + while ((c = get_opts ()) != -1) + { + switch (c) + { + case 'k': + sender_ior = get_opts.opt_arg (); + break; + + case 'n': + topic_name = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s\n" + "-k <Sender IOR> (default is file://Sender.ior)\n" + "-n <new topic>\n" + "\n", + argv [0]), + -1); + } + } + + return 0; +} + + +int ACE_TMAIN (int argc, ACE_TCHAR* argv[]) +{ + try + { + // initialize the ORB + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv); + if (parse_args (argc, argv) != 0) + { + return -1; + } + + // create the factory object reference, + CORBA::Object_var sender_obj = + orb->string_to_object (sender_ior); + + // downcast the object reference to the appropriate type + ::UL_ResetTopic::Sender_var sender = + ::UL_ResetTopic::Sender::_narrow (sender_obj.in ()); + + if (CORBA::is_nil (sender.in ())) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to acquire 'Sender' objref\n"), + -1); + } + sender->set_new_topic (topic_name); + + orb->destroy (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Who is the culprit in the SenderDriver?\n"); + ACE_ERROR_RETURN ((LM_ERROR, + "Uncaught CORBA exception\n"), + 1); + } + return 0; +} diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Sender/UL_ResetTopic_Sender.idl b/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Sender/UL_ResetTopic_Sender.idl new file mode 100644 index 00000000000..2e17d246e34 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Sender/UL_ResetTopic_Sender.idl @@ -0,0 +1,31 @@ +// $Id$ + +/** + * @file + * @author Marcel Smit <msmit@remedy.nl> + * + * by-hand idl3 translation of sender components. + */ + +#ifndef UL_RESETTOPIC_SENDER_IDL +#define UL_RESETTOPIC_SENDER_IDL + +#include "Connector/UL_ResetTopic_Connector.idl" + +module UL_ResetTopic +{ + interface ChangeTopicInterface + { + void set_new_topic (in string topic_name); + }; + + component Sender supports ChangeTopicInterface + { + port UL_ResetTopicTestConnector::DDS_Update info_update; + + attribute unsigned short iterations; + attribute unsigned short keys; + }; +}; + +#endif diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Sender/UL_ResetTopic_Sender.mpc b/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Sender/UL_ResetTopic_Sender.mpc new file mode 100644 index 00000000000..d8f536e893c --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Sender/UL_ResetTopic_Sender.mpc @@ -0,0 +1,166 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p UL_ResetTopicBase -l ../lib -o ../lib -c controller -u DDS Sender" + +project (UL_ResetTopicSender_idl_gen) : componentidldefaults, dds4ccm { + after += UL_ResetTopicConnector_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=SENDER_STUB_Export \ + -Wb,stub_export_include=Sender_stub_export.h \ + -Wb,skel_export_macro=SENDER_SVNT_Export \ + -Wb,skel_export_include=Sender_svnt_export.h \ + -Wb,svnt_export_macro=SENDER_SVNT_Export \ + -Wb,svnt_export_include=Sender_svnt_export.h \ + -Wb,exec_export_macro=SENDER_EXEC_Export \ + -Wb,exec_export_include=Sender_exec_export.h \ + -I .. + + IDL_Files { + UL_ResetTopic_Sender.idl + } +} + +project (UL_ResetTopicSender_lem_gen) : ciaoidldefaults, dds4ccm { + after += UL_ResetTopicSender_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=SENDER_LEM_STUB_Export \ + -Wb,stub_export_include=Sender_lem_stub_export.h \ + -SS -Gxhst -I $CIAO_ROOT/connectors -I .. + + IDL_Files { + UL_ResetTopic_SenderE.idl + } +} + +project (UL_ResetTopicSender_lem_stub) : ccm_svnt, dds4ccm_base { + after += UL_ResetTopicSender_lem_gen UL_ResetTopicSender_stub UL_ResetTopicBase_stub + libs += UL_ResetTopicBase_stub Sender_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = Sender_lem_stub + dynamicflags += SENDER_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + UL_ResetTopic_SenderEC.cpp + } + + Header_Files { + UL_ResetTopic_SenderEC.h + Sender_lem_stub_export.h + } + + Inline_Files { + UL_ResetTopic_SenderEC.inl + } +} + +project (UL_ResetTopicSender_stub) : ccm_stub, dds4ccm_base { + after += UL_ResetTopicSender_idl_gen UL_ResetTopicBase_stub UL_ResetTopicConnector_stub + libs += UL_ResetTopicBase_stub UL_ResetTopicConnector_stub + includes += .. + libpaths += ../lib + libout = ../lib + sharedname = Sender_stub + dynamicflags += SENDER_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + UL_ResetTopic_SenderC.cpp + } + + Header_Files { + UL_ResetTopic_SenderC.h + Sender_stub_export.h + } + + Inline_Files { + UL_ResetTopic_SenderC.inl + } +} + +project (UL_ResetTopicSender_exec) : ciao_executor, dds4ccm_lem_stub { + after += UL_ResetTopicSender_lem_stub UL_ResetTopicSender_stub \ + UL_ResetTopicConnector_lem_stub UL_ResetTopicConnector_stub + sharedname = Sender_exec + libs += Sender_stub Sender_lem_stub UL_ResetTopicBase_stub \ + UL_ResetTopicConnector_lem_stub UL_ResetTopicConnector_stub + libpaths += ../lib + includes += .. + libout = ../lib + dynamicflags += SENDER_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + UL_ResetTopic_Sender_exec.cpp + } + + Header_Files { + UL_ResetTopic_Sender_exec.h + Sender_exec_export.h + } + + Inline_Files { + } +} + + +project (UL_ResetTopicSender_svnt) : ciao_servant, dds4ccm_lem_stub, dds4ccm_skel { + after += UL_ResetTopicBase_stub UL_ResetTopicSender_lem_stub UL_ResetTopicConnector_stub \ + UL_ResetTopicConnector_svnt UL_ResetTopicConnector_lem_stub + sharedname = Sender_svnt + libs += Sender_stub Sender_lem_stub \ + UL_ResetTopicBase_stub UL_ResetTopicConnector_stub UL_ResetTopicConnector_svnt UL_ResetTopicConnector_lem_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += SENDER_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + UL_ResetTopic_SenderS.cpp + UL_ResetTopic_Sender_svnt.cpp + } + + Header_Files { + UL_ResetTopic_SenderS.h + UL_ResetTopic_Sender_svnt.h + Sender_svnt_export.h + } + + Inline_Files { + UL_ResetTopic_SenderS.inl + } +} + +project (UL_ResetTopicSender_Driver) : ccm_stub, valuetype, dds4ccm_lem_stub { + exename = SenderDriver + after += UL_ResetTopicSender_stub UL_ResetTopicConnector_stub + libs += Sender_stub UL_ResetTopicBase_stub UL_ResetTopicConnector_stub + + includes += .. + libpaths += ../lib + + exeout = ../lib + IDL_Files { + } + + Source_Files { + SenderDriver.cpp + } + + Header_Files { + } + + Inline_Files { + } +} + diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Sender/UL_ResetTopic_Sender_exec.cpp b/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Sender/UL_ResetTopic_Sender_exec.cpp new file mode 100644 index 00000000000..28a53498b03 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Sender/UL_ResetTopic_Sender_exec.cpp @@ -0,0 +1,335 @@ +// -*- C++ -*- +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v1.8.2 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ + +#include "UL_ResetTopic_Sender_exec.h" +#include "tao/ORB_Core.h" +#include "ace/Reactor.h" + +namespace CIAO_UL_ResetTopic_Sender_Impl +{ + + /** + * Timeout_Handler + */ + + Timeout_Handler::Timeout_Handler (Sender_exec_i &callback) + : callback_ (callback) + { + } + + int + Timeout_Handler::handle_timeout (const ACE_Time_Value &, const void *) + { + // Notify the subscribers + this->callback_.start_event_test (); + return 0; + } + + /** + * Component Executor Implementation Class: Sender_exec_i + */ + + Sender_exec_i::Sender_exec_i (void) + : iterations_ (0) + , keys_ (0) + , to_handler_ (0) + , topic_name_ ("TopicI") + , old_topic_name_ ("TopicI") + { + ACE_NEW_THROW_EX (this->to_handler_, + Timeout_Handler (*this), + ::CORBA::INTERNAL ()); + } + + Sender_exec_i::~Sender_exec_i (void) + { + delete this->to_handler_; + } + + // Supported operations and attributes. + ACE_Reactor* + Sender_exec_i::reactor (void) + { + ACE_Reactor* reactor = 0; + ::CORBA::Object_var ccm_object = + this->ciao_context_->get_CCM_object(); + if (! ::CORBA::is_nil (ccm_object.in ())) + { + ::CORBA::ORB_var orb = ccm_object->_get_orb (); + if (! ::CORBA::is_nil (orb.in ())) + { + reactor = orb->orb_core ()->reactor (); + } + } + if (reactor == 0) + { + throw ::CORBA::INTERNAL (); + } + return reactor; + } + + void Sender_exec_i::create_samples (void) + { + ACE_GUARD (TAO_SYNCH_RECURSIVE_MUTEX, _guard, + this->keys_lock_); + + for (CORBA::UShort i = 1; i < this->keys_ + 1; ++i) + { + char key[7]; + UL_ResetTopicTest *new_key = new UL_ResetTopicTest; + ACE_OS::sprintf (key, "KEY_%d", i); + new_key->key = CORBA::string_dup(key); + new_key->iteration = 0; + this->tests_[key] = new_key; + + ::UL_ResetTopic::UL_ResetTopicTestConnector::Updater_var updater = + this->ciao_context_->get_connection_info_update_data(); + + updater->create_one (*new_key); + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::create_samples - " + "Sample <%C> created\n", + key)); + } + this->last_key_ = this->tests_.begin (); + } + + void Sender_exec_i::set_new_topic (const char * topic_name) + { + ACE_GUARD (TAO_SYNCH_RECURSIVE_MUTEX, guard, this->topic_name_lock_); + + this->old_topic_name_ = this->topic_name_; + this->topic_name_ = topic_name; + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::set_new_topic - " + "New topic name set <%C>\n", + topic_name)); + } + + void + Sender_exec_i::set_topic_name_updater (const char * topic_name) + { + try + { + if (ACE_OS::strcmp (topic_name, this->old_topic_name_.c_str()) != 0) + { + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::set_topic_name_updater - " + "Setting topic to <%C>\n", + topic_name)); + this->old_topic_name_ = topic_name; + ::UL_ResetTopic::UL_ResetTopicTestConnector:: Updater_var updater = + this->ciao_context_->get_connection_info_update_data (); + if (::CORBA::is_nil (updater.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::set_topic_name_updater - " + "Unable to get updater interface\n")); + throw ::CORBA::INTERNAL (); + } + ::CORBA::Object_var cmp = updater->_get_component (); + if (::CORBA::is_nil (cmp.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::set_topic_name_updater - " + "Unable to get component interface\n")); + throw ::CORBA::INTERNAL (); + } + ::UL_ResetTopic::UL_ResetTopicTestConnector::CCM_DDS_State_var conn = + ::UL_ResetTopic::UL_ResetTopicTestConnector::CCM_DDS_State::_narrow (cmp.in ()); + if (::CORBA::is_nil (conn.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::set_topic_name_updater - " + "Unable to narrow connector interface\n")); + throw ::CORBA::INTERNAL (); + } + { + ACE_GUARD (TAO_SYNCH_RECURSIVE_MUTEX, guard, this->topic_name_lock_); + conn->topic_name (topic_name); + } + this->create_samples (); + } + } + catch (const ::CCM_DDS::NonChangeable &) + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::set_topic_name_writer - " + "Caught NonChangeable exception.\n")); + } + } + + void + Sender_exec_i::start_event_test (void) + { + // Set the topic name on the connector first. Therefor we need to + // get to the connector first. + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::start_event_test - Start\n")); + try + { + if (this->last_key_ != this->tests_.end ()) + { + try + { + this->set_topic_name_updater (this->topic_name_.c_str ()); + ::UL_ResetTopic::UL_ResetTopicTestConnector:: Updater_var updater = + this->ciao_context_->get_connection_info_update_data (); + + { + ACE_GUARD (TAO_SYNCH_RECURSIVE_MUTEX, guard, this->keys_lock_) + ++this->last_key_->second->iteration; + updater->update_one (this->last_key_->second, ::DDS::HANDLE_NIL); + + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Updated key <%C> with <%d>\n"), + this->last_key_->first.c_str (), + this->last_key_->second->iteration)); + } + } + catch (const CCM_DDS::InternalError& ) + { + ACE_ERROR ((LM_ERROR, "ERROR: Internal Error while writing KeyedTest info for <%C>.\n", + this->last_key_->first.c_str ())); + } + { + ACE_GUARD (TAO_SYNCH_RECURSIVE_MUTEX, guard, this->keys_lock_) + ++this->last_key_; + } + } + else + { + // Onto the next iteration + { + ACE_GUARD (TAO_SYNCH_RECURSIVE_MUTEX, guard, this->keys_lock_) + this->last_key_ = this->tests_.begin (); + while (this->last_key_ != this->tests_.end ()) + { + if (this->last_key_->second->iteration == this->iterations_) + { + ++this->last_key_; + } + else + { + break; + } + } + } + } + } + catch (const ::CORBA::Exception & ex) + { + ex._tao_print_exception("ERROR:"); + } + catch (...) + { + ACE_ERROR ((LM_ERROR, "Sender_exec_i::start_event_test - " + "ERROR: Unexpected and unknown exception caught.\n")); + } + } + + // Component attributes and port operations. + + ::CORBA::UShort + Sender_exec_i::iterations (void) + { + return this->iterations_; + } + + void + Sender_exec_i::iterations ( + const ::CORBA::UShort iterations) + { + this->iterations_ = iterations; + } + + ::CORBA::UShort + Sender_exec_i::keys (void) + { + return this->keys_; + } + + void + Sender_exec_i::keys ( + const ::CORBA::UShort keys) + { + this->keys_ = keys; + } + + // Operations from Components::SessionComponent. + + void + Sender_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + this->ciao_context_ = + ::UL_ResetTopic::CCM_Sender_Context::_narrow (ctx); + + if ( ::CORBA::is_nil (this->ciao_context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + Sender_exec_i::configuration_complete (void) + { + /* Your code here. */ + } + + void + Sender_exec_i::ccm_activate (void) + { + this->create_samples (); + + if (this->reactor ()->schedule_timer ( + this->to_handler_, + 0, + ACE_Time_Value (2, 0), + ACE_Time_Value (0, 500000)) == -1) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Sender_exec_i::start : ") + ACE_TEXT ("Error scheduling timer"))); + } + } + + void + Sender_exec_i::ccm_passivate (void) + { + this->reactor()->cancel_timer(this->to_handler_); + } + + void + Sender_exec_i::ccm_remove (void) + { + /* Your code here. */ + } + + extern "C" SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_UL_ResetTopic_Sender_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_NORETURN ( + retval, + Sender_exec_i); + + return retval; + } +} diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Sender/UL_ResetTopic_Sender_exec.h b/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Sender/UL_ResetTopic_Sender_exec.h new file mode 100644 index 00000000000..9bf485bdaa8 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/Sender/UL_ResetTopic_Sender_exec.h @@ -0,0 +1,148 @@ +// -*- C++ -*- +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v1.8.2 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ +#ifndef CIAO_UL_RESETTOPIC_SENDER_EXEC_YSJ9S8_H_ +#define CIAO_UL_RESETTOPIC_SENDER_EXEC_YSJ9S8_H_ + +#include /**/ "ace/pre.h" + +#include "UL_ResetTopic_SenderEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ "Sender_exec_export.h" +#include "tao/LocalObject.h" + +#include <map> + +namespace CIAO_UL_ResetTopic_Sender_Impl +{ + class Sender_exec_i; + + /** + * Timeout_Handler + */ + class Timeout_Handler : + public ACE_Event_Handler + { + public: + Timeout_Handler (Sender_exec_i &callback); + /// Handle the timeout. + virtual int handle_timeout (const ACE_Time_Value &tv, + const void *arg); + private: + /// Maintains a handle that actually process the event + Sender_exec_i &callback_; + }; + + /** + * Component Executor Implementation Class: Sender_exec_i + */ + + class Sender_exec_i + : public virtual Sender_Exec, + public virtual ::CORBA::LocalObject + { + public: + Sender_exec_i (void); + virtual ~Sender_exec_i (void); + + //@{ + /** Supported operations and attributes. */ + virtual void set_new_topic (const char * topic_name); + //@} + + //@{ + /** Component attributes and port operations. */ + + virtual ::CORBA::UShort iterations (void); + + virtual void iterations (::CORBA::UShort iterations); + + virtual ::CORBA::UShort keys (void); + + virtual void keys (::CORBA::UShort keys); + //@} + + //@{ + /** Operations from Components::SessionComponent. */ + virtual void set_session_context (::Components::SessionContext_ptr ctx); + virtual void configuration_complete (void); + virtual void ccm_activate (void); + virtual void ccm_passivate (void); + virtual void ccm_remove (void); + //@} + + //@{ + /** User defined public operations. */ + void set_topic_name_updater (const char * topic_name); + void start_event_test (void); + //@} + + private: + ::UL_ResetTopic::CCM_Sender_Context_var ciao_context_; + + //@{ + /** Component attributes. */ + + ::CORBA::UShort iterations_; + + ::CORBA::UShort keys_; + //@} + + //@{ + /** User defined members. */ + Timeout_Handler *to_handler_; + ACE_CString topic_name_, old_topic_name_; + + TAO_SYNCH_RECURSIVE_MUTEX topic_name_lock_; + TAO_SYNCH_RECURSIVE_MUTEX keys_lock_; + + typedef std::map<ACE_CString, UL_ResetTopicTest_var> Sample_Table; + + Sample_Table tests_; + Sample_Table::iterator last_key_; + + //@} + + //@{ + /** User defined private operations. */ + void create_samples (void); + //@} + + /// Get the ACE_Reactor + ACE_Reactor* reactor (void); + }; + + extern "C" SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_UL_ResetTopic_Sender_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* ifndef */ diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/descriptors/Plan.cdp b/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/descriptors/Plan.cdp new file mode 100644 index 00000000000..599fe92554a --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/descriptors/Plan.cdp @@ -0,0 +1,407 @@ +<!-- $Id$ --> +<Deployment:DeploymentPlan + xmlns:Deployment="http://www.omg.org/Deployment" + xmlns:xmi="http://www.omg.org/XMI" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.omg.org/Deployment Deployment.xsd"> + <label>ResetTopic_Depl_1</label> + <UUID>ResetTopic_Depl_1</UUID> + + <implementation xmi:id="ReceiverComponentImplementation"> + <name>ReceiverComponentImplementation</name> + <source/> + <artifact xmi:idref="Receiver_ExecArtifact" /> + <artifact xmi:idref="Receiver_SvntArtifact" /> + <execParameter> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_UL_ResetTopic_Receiver_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_UL_ResetTopic_Receiver_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Receiver_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Receiver_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="ResetTopic_StateConnectorImplementation"> + <name>ResetTopic_StateConnectorImplementation</name> + <source/> + <artifact xmi:idref="ResetTopic_Connector_ExecArtifact" /> + <artifact xmi:idref="ResetTopic_Connector_SvntArtifact" /> + <execParameter> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_UL_ResetTopic_UL_ResetTopicTestConnector_DDS_State_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_UL_ResetTopic_UL_ResetTopicTestConnector_DDS_State_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>UL_ResetTopic_Connector_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>UL_ResetTopic_Connector_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SenderComponentImplementation"> + <name>SenderComponentImplementation</name> + <source/> + <artifact xmi:idref="Sender_ExecArtifact" /> + <artifact xmi:idref="Sender_SvntArtifact" /> + <execParameter> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_UL_ResetTopic_Sender_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_UL_ResetTopic_Sender_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Sender_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Sender_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <instance xmi:id="ReceiverComponentInstance"> + <name>ReceiverComponent</name> + <node>ReceiverNode</node> + <source/> + <implementation xmi:idref="ReceiverComponentImplementation" /> + <configProperty> + <name>iterations</name> + <value> + <type> + <kind>tk_ushort</kind> + </type> + <value> + <ushort>10</ushort> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Receiver.ior</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="ResetTopic_SenderStateConnectorInstance"> + <name>ResetTopic_SenderStateConnectorInstance</name> + <node>SenderNode</node> + <source/> + <implementation xmi:idref="ResetTopic_StateConnectorImplementation" /> + <configProperty> + <name>topic_name</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>TopicI</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="ResetTopic_ReceiverStateConnectorInstance"> + <name>ResetTopic_ReceiverStateConnectorInstance</name> + <node>ReceiverNode</node> + <source/> + <implementation xmi:idref="ResetTopic_StateConnectorImplementation" /> + <configProperty> + <name>topic_name</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>TopicI</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="SenderComponentInstance"> + <name>SenderComponent</name> + <node>SenderNode</node> + <source/> + <implementation xmi:idref="SenderComponentImplementation" /> + <configProperty> + <name>rate</name> + <value> + <type> + <kind>tk_ushort</kind> + </type> + <value> + <ushort>15</ushort> + </value> + </value> + </configProperty> + <configProperty> + <name>keys</name> + <value> + <type> + <kind>tk_ushort</kind> + </type> + <value> + <ushort>5</ushort> + </value> + </value> + </configProperty> + <configProperty> + <name>iterations</name> + <value> + <type> + <kind>tk_ushort</kind> + </type> + <value> + <ushort>10</ushort> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Sender.ior</string> + </value> + </value> + </configProperty> + </instance> + + <connection> + <name>state_listener</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>info_out_state_data_listener</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="ReceiverComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>push_state_observer_data_listener</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="ResetTopic_ReceiverStateConnectorInstance" /> + </internalEndpoint> + </connection> + + <connection> + <name>state_reader_listener</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>info_out_state_data</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="ReceiverComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>push_state_observer_data</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="ResetTopic_ReceiverStateConnectorInstance" /> + </internalEndpoint> + </connection> + + <connection> + <name>state_datacontrol</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>info_out_state_data_control</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="ReceiverComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>push_state_observer_data_control</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="ResetTopic_ReceiverStateConnectorInstance" /> + </internalEndpoint> + </connection> + + <connection> + <name>updater_connection</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>info_update_data</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="SenderComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>observable_data</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="ResetTopic_SenderStateConnectorInstance" /> + </internalEndpoint> + </connection> + + <artifact xmi:id="Sender_ExecArtifact"> + <name>Sender_exec</name> + <source/> + <node/> + <location>Sender_exec</location> + </artifact> + <artifact xmi:id="Sender_SvntArtifact"> + <name>Sender_svnt</name> + <source/> + <node/> + <location>Sender_svnt</location> + </artifact> + <artifact xmi:id="Sender_StubArtifact"> + <name>Sender_stub</name> + <source/> + <node/> + <location>Sender_stub</location> + </artifact> + <artifact xmi:id="ResetTopic_Connector_ExecArtifact"> + <name>UL_ResetTopic_Connector_exec</name> + <source/> + <node/> + <location>UL_ResetTopicConnector_exec</location> + </artifact> + <artifact xmi:id="ResetTopic_Connector_SvntArtifact"> + <name>UL_ResetTopic_Connector_svnt</name> + <source/> + <node/> + <location>UL_ResetTopicConnector_svnt</location> + </artifact> + <artifact xmi:id="Receiver_ExecArtifact"> + <name>Receiver_exec</name> + <source/> + <node/> + <location>Receiver_exec</location> + </artifact> + <artifact xmi:id="Receiver_SvntArtifact"> + <name>Receiver_svnt</name> + <source/> + <node/> + <location>Receiver_svnt</location> + </artifact> + <artifact xmi:id="Receiver_StubArtifact"> + <name>Receiver_stub</name> + <source/> + <node/> + <location>Receiver_stub</location> + </artifact> +</Deployment:DeploymentPlan> diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/descriptors/run_test.pl b/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/descriptors/run_test.pl new file mode 100755 index 00000000000..0d55bfd5fdc --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/UpdateListen/descriptors/run_test.pl @@ -0,0 +1,281 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{'ACE_ROOT'}/bin"; +use PerlACE::TestTarget; + +$CIAO_ROOT = "$ENV{'CIAO_ROOT'}"; +$TAO_ROOT = "$ENV{'TAO_ROOT'}"; +$DANCE_ROOT = "$ENV{'DANCE_ROOT'}"; + +$daemons_running = 0; +$em_running = 0; +$ns_running = 0; + +$nr_daemon = 2; +@ports = ( 60001, 60002 ); +@iorbases = ( "ReceiverNode.ior", "SenderNode.ior" ); +@iorfiles = 0; +@nodenames = ( "ReceiverNode", "SenderNode" ); + +# ior files other than daemon +$ior_nsbase = "ns.ior"; +$ior_nsfile = 0; +$ior_embase = "EM.ior"; +$ior_emfile = 0; + +# Processes +$E = 0; +$EM = 0; +$NS = 0; +@DEAMONS = 0; + +# targets +@tg_daemons = 0; +$tg_naming = 0; +$tg_exe_man = 0; +$tg_executor = 0; + +$status = 0; +$cdp_file = "Plan.cdp"; + +sub create_targets { + # naming service + $tg_naming = PerlACE::TestTarget::create_target (1) || die "Create target for ns failed\n"; + $tg_naming->AddLibPath ('../lib'); + # daemon + for ($i = 0; $i < $nr_daemon; ++$i) { + $tg_daemons[$i] = PerlACE::TestTarget::create_target ($i+1) || die "Create target for daemon $i failed\n"; + $tg_daemons[$i]->AddLibPath ('../lib'); + } + # execution manager + $tg_exe_man = PerlACE::TestTarget::create_target (1) || die "Create target for EM failed\n"; + $tg_exe_man->AddLibPath ('../lib'); + # executor (plan_launcher) + $tg_executor = PerlACE::TestTarget::create_target (1) || die "Create target for executor failed\n"; + $tg_executor->AddLibPath ('../lib'); +} + +sub init_ior_files { + $ior_nsfile = $tg_naming->LocalFile ($ior_nsbase); + $ior_emfile = $tg_exe_man->LocalFile ($ior_embase); + for ($i = 0; $i < $nr_daemon; ++$i) { + $iorfiles[$i] = $tg_daemons[$i]->LocalFile ($iorbases[$i]); + } + delete_ior_files (); +} + +# Delete if there are any .ior files. +sub delete_ior_files { + for ($i = 0; $i < $nr_daemon; ++$i) { + $tg_daemons[$i]->DeleteFile ($iorbases[$i]); + } + $tg_naming->DeleteFile ($ior_nsbase); + $tg_exe_man->DeleteFile ($ior_embase); + for ($i = 0; $i < $nr_daemon; ++$i) { + $iorfiles[$i] = $tg_daemons[$i]->LocalFile ($iorbases[$i]); + } +} + +sub kill_node_daemon { + for ($i = 0; $i < $nr_daemon; ++$i) { + $DEAMONS[$i]->Kill (); $DEAMONS[$i]->TimedWait (1); + } +} + +sub kill_open_processes { + if ($daemons_running == 1) { + kill_node_daemon (); + } + + if ($em_running == 1) { + $EM->Kill (); $EM->TimedWait (1); + } + + if ($ns_running == 1) { + $NS->Kill (); $NS->TimedWait (1); + } + # in case shutdown did not perform as expected + $tg_executor->KillAll ('dance_locality_manager'); +} + +sub run_node_daemons { + for ($i = 0; $i < $nr_daemon; ++$i) { + $iorbase = $iorbases[$i]; + $iorfile = $iorfiles[$i]; + $port = $ports[$i]; + $nodename = $nodenames[$i]; + $iiop = "iiop://localhost:$port"; + $node_app = $tg_daemons[$i]->GetArchDir("$DANCE_ROOT/bin/") . "dance_locality_manager"; + + $d_cmd = "$DANCE_ROOT/bin/dance_node_manager"; + $d_param = "-ORBEndpoint $iiop -s $node_app -n $nodename=$iorfile -t 30 --domain-nc corbaloc:rir:/NameService"; + + print "Run dance_node_manager with $d_param\n"; + + $DEAMONS[$i] = $tg_daemons[$i]->CreateProcess ($d_cmd, $d_param); + $DEAMONS[$i]->Spawn (); + + if ($tg_daemons[$i]->WaitForFileTimed($iorbase, + $tg_daemons[$i]->ProcessStartWaitInterval ()) == -1) { + print STDERR + "ERROR: The ior $iorfile file of node daemon $i could not be found\n"; + for (; $i >= 0; --$i) { + $DEAMONS[$i]->Kill (); $DEAMONS[$i]->TimedWait (1); + } + return -1; + } + } + return 0; +} + +create_targets (); +init_ior_files (); + +# Invoke naming service + +$NS = $tg_naming->CreateProcess ("$TAO_ROOT/orbsvcs/Naming_Service/tao_cosnaming", " -ORBEndpoint iiop://localhost:60003 -o $ior_nsfile"); + +$ns_status = $NS->Spawn (); + +if ($ns_status != 0) { + print STDERR "ERROR: Unable to execute the naming service\n"; + kill_open_processes (); + exit 1; +} + +print STDERR "Starting Naming Service with -ORBEndpoint iiop://localhost:60003 -o ns.ior\n"; + +if ($tg_naming->WaitForFileTimed ($ior_nsbase, + $tg_naming->ProcessStartWaitInterval ()) == -1) { + print STDERR "ERROR: cannot find naming service IOR file\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} + +$ns_running = 1; +# Set up NamingService environment +$ENV{"NameServiceIOR"} = "corbaloc:iiop:localhost:60003/NameService"; + +# Invoke node daemon. +print "Invoking node daemon\n"; +$status = run_node_daemons (); + +if ($status != 0) { + print STDERR "ERROR: Unable to execute the node daemon\n"; + kill_open_processes (); + exit 1; +} + +$daemons_running = 1; + +# Invoke execution manager. +print "Invoking execution manager (dance_execution_manager.exe) with -e$ior_emfile\n"; +$EM = $tg_exe_man->CreateProcess ("$DANCE_ROOT/bin/dance_execution_manager", + "-e$ior_emfile --domain-nc corbaloc:rir:/NameService"); +$em_status = $EM->Spawn (); + +if ($em_status != 0) { + print STDERR "ERROR: dance_execution_manager returned $em_status"; + exit 1; +} + +if ($tg_exe_man->WaitForFileTimed ($ior_embase, + $tg_exe_man->ProcessStartWaitInterval ()) == -1) { + print STDERR + "ERROR: The ior file of execution manager could not be found\n"; + kill_open_processes (); + exit 1; +} + +$em_running = 1; + +# Invoke executor - start the application -. +print "Invoking executor - launch the application -\n"; + +print "Start dance_plan_launcher.exe with -x $cdp_file -k file://$ior_emfile\n"; +$E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-x $cdp_file -k file://$ior_emfile"); +$pl_status = $E->SpawnWaitKill (2 * $tg_executor->ProcessStartWaitInterval ()); + +if ($pl_status != 0) { + print STDERR "ERROR: dance_plan_launcher returned $pl_status\n"; + kill_open_processes (); + exit 1; +} + +for ($i = 0; $i < $nr_daemon; ++$i) { + if ($tg_daemons[$i]->WaitForFileTimed ($iorbases[$i], + $tg_daemons[$i]->ProcessStopWaitInterval ()) == -1) { + print STDERR "ERROR: The ior file of daemon $i could not be found\n"; + kill_open_processes (); + exit 1; + } +} + +print "Sleeping 10 seconds before changing topic name\n"; +sleep (10); + +$R = $tg_executor->CreateProcess ("../lib/ReceiverDriver", "-n TopicII"); +$driver_status = $R->SpawnWaitKill (2 * $tg_executor->ProcessStartWaitInterval ()); +if ($driver_status != 0) { + print STDERR "ERROR: unable to launch driver\n"; + kill_open_processes (); + exit 1; +} + +$S = $tg_executor->CreateProcess ("../lib/SenderDriver", "-n TopicII"); +$driver_status = $S->SpawnWaitKill (2 * $tg_executor->ProcessStartWaitInterval ()); +if ($driver_status != 0) { + print STDERR "ERROR: unable to launch driver\n"; + kill_open_processes (); + exit 1; +} + +print "Sleeping 10 seconds before changing topic name\n"; +sleep (10); + +$R = $tg_executor->CreateProcess ("../lib/ReceiverDriver", "-n TopicIII"); +$driver_status = $R->SpawnWaitKill (2 * $tg_executor->ProcessStartWaitInterval ()); +if ($driver_status != 0) { + print STDERR "ERROR: unable to launch driver\n"; + kill_open_processes (); + exit 1; +} + +$S = $tg_executor->CreateProcess ("../lib/SenderDriver", "-n TopicIII"); +$driver_status = $S->SpawnWaitKill (2 * $tg_executor->ProcessStartWaitInterval ()); +if ($driver_status != 0) { + print STDERR "ERROR: unable to launch driver\n"; + kill_open_processes (); + exit 1; +} + +print "Sleeping 10 seconds before stopping\n"; +sleep (10); + +# Invoke executor - stop the application -. +print "Invoking executor - stop the application -\n"; +print "by running dance_plan_launcher.exe with -k file://$ior_emfile -x $cdp_file\n"; + +$E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-k file://$ior_emfile -x $cdp_file -s"); +$pl_status = $E->SpawnWaitKill ($tg_executor->ProcessStartWaitInterval ()); + +if ($pl_status != 0) { + print STDERR "ERROR: dance_plan_launcher returned $pl_status\n"; + kill_open_processes (); + exit 1; +} + +print "Executor returned.\n"; +print "Shutting down rest of the processes.\n"; + +delete_ior_files (); +kill_open_processes (); + +exit $status; diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Base/WL_ResetTopic_Base.idl b/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Base/WL_ResetTopic_Base.idl new file mode 100644 index 00000000000..d98bb51c419 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Base/WL_ResetTopic_Base.idl @@ -0,0 +1,23 @@ +// $Id$ + +/** + * @file WL_ResetTopic_Base.idl + * @author Marcel Smit <msmit@remedy.nl> + */ + +#ifndef WL_RESETTOPIC_BASE_IDL +#define WL_RESETTOPIC_BASE_IDL + +#pragma ndds typesupport "Base/WL_ResetTopic_BaseSupport.h" + +#pragma DCPS_DATA_TYPE "WL_ResetTopicTest" +#pragma DCPS_DATA_KEY "WL_ResetTopicTest key" + +struct WL_ResetTopicTest { + string key; //@key + long iteration; +}; + +typedef sequence<WL_ResetTopicTest> WL_ResetTopicTestSeq; + +#endif diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Base/WL_ResetTopic_Base.mpc b/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Base/WL_ResetTopic_Base.mpc new file mode 100644 index 00000000000..7d4c393fe03 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Base/WL_ResetTopic_Base.mpc @@ -0,0 +1,26 @@ +// $Id$ + +project (WL_ResetTopicBase_stub) : taoidldefaults, dds4ccm_ts_default { + sharedname = WL_ResetTopicBase_stub + dynamicflags += WL_RESETTOPIC_BASE_STUB_BUILD_DLL + libout = ../lib + + idlflags += -SS -Sci \ + -Wb,stub_export_macro=WL_RESETTOPIC_BASE_STUB_Export \ + -Wb,stub_export_include=ResetTopic_Base_stub_export.h + + IDL_Files { + idlflags += -Gxhst + WL_ResetTopic_Base.idl + } + + opendds_ts_flags += --export=WL_RESETTOPIC_BASE_STUB_Export + + DDSGenerator_Files { + WL_ResetTopic_Base.idl + } + + Source_Files { + } +} + diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Connector/WL_ResetTopic_Connector.idl b/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Connector/WL_ResetTopic_Connector.idl new file mode 100644 index 00000000000..458104748f6 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Connector/WL_ResetTopic_Connector.idl @@ -0,0 +1,23 @@ +// $Id$ + +/** + * @file WL_ResetTopic_Connector.idl + * @author Marcel Smit <msmit@remedy.nl> + */ + +#ifndef WL_RESETTOPIC_CONNECTOR_IDL_ +#define WL_RESETTOPIC_CONNECTOR_IDL_ + +#include <Components.idl> +#include <ccm_dds.idl> + +#include "Base/WL_ResetTopic_Base.idl" + +#pragma ciao lem "Connector/WL_ResetTopic_ConnectorE.idl" + +module WL_ResetTopic +{ + module ::CCM_DDS::Typed < ::WL_ResetTopicTest, ::WL_ResetTopicTestSeq> WL_ResetTopicTestConnector; +}; + +#endif /* WL_ResetTopic_CONNECTOR_IDL_ */ diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Connector/WL_ResetTopic_Connector.mpc b/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Connector/WL_ResetTopic_Connector.mpc new file mode 100644 index 00000000000..62db2b36ac7 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Connector/WL_ResetTopic_Connector.mpc @@ -0,0 +1,148 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p WL_ResetTopicBase -l .. -o ../lib -u DDS WL_ResetTopic_Connector" + +project (WL_ResetTopicConnector_idl_gen) : connectoridldefaults, dds4ccm { + after += DDS4CCM_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=WL_RESETTOPIC_CONNECTOR_STUB_Export \ + -Wb,stub_export_include=ResetTopic_Connector_stub_export.h \ + -Wb,skel_export_macro=WL_RESETTOPIC_CONNECTOR_SVNT_Export \ + -Wb,skel_export_include=ResetTopic_Connector_svnt_export.h \ + -Wb,svnt_export_macro=WL_RESETTOPIC_CONNECTOR_SVNT_Export \ + -Wb,svnt_export_include=ResetTopic_Connector_svnt_export.h \ + -Wb,conn_export_macro=WL_RESETTOPIC_CONNECTOR_CONN_Export \ + -Wb,conn_export_include=ResetTopic_Connector_conn_export.h \ + -I .. + + IDL_Files { + WL_ResetTopic_Connector.idl + } +} + +project (WL_ResetTopicConnector_lem_gen) : ciaoidldefaults, dds4ccm { + custom_only = 1 + after += WL_ResetTopicConnector_idl_gen + idlflags += -Wb,stub_export_macro=WL_RESETTOPIC_CONNECTOR_LEM_STUB_Export \ + -Wb,stub_export_include=WL_ResetTopic_Connector_lem_stub_export.h \ + -SS -Gxhst \ + -I .. + + IDL_Files { + WL_ResetTopic_ConnectorE.idl + } +} + +project (WL_ResetTopicConnector_lem_stub) : ccm_svnt, dds4ccm_lem_stub { + after += WL_ResetTopicConnector_lem_gen WL_ResetTopicConnector_stub \ + WL_ResetTopicBase_stub + libs += WL_ResetTopicBase_stub WL_ResetTopicConnector_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = WL_ResetTopicConnector_lem_stub + dynamicflags += WL_RESETTOPIC_CONNECTOR_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + WL_ResetTopic_ConnectorEC.cpp + } + + Header_Files { + WL_ResetTopic_ConnectorEC.h + WL_ResetTopic_Connector_lem_stub_export.h + } + + Inline_Files { + WL_ResetTopic_ConnectorEC.inl + } +} + +project (WL_ResetTopicConnector_stub) : ccm_stub, dds4ccm_base { + after += WL_ResetTopicConnector_idl_gen WL_ResetTopicBase_stub + libs += WL_ResetTopicBase_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = WL_ResetTopicConnector_stub + dynamicflags += WL_RESETTOPIC_CONNECTOR_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + WL_ResetTopic_ConnectorC.cpp + } + + Header_Files { + WL_ResetTopic_ConnectorC.h + WL_ResetTopic_Connector_stub_export.h + } + + Inline_Files { + WL_ResetTopic_ConnectorC.inl + } +} + +project (WL_ResetTopicConnector_exec) : ciao_executor, dds4ccm_impl { + after += WL_ResetTopicConnector_lem_stub WL_ResetTopicConnector_stub \ + WL_ResetTopicBase_stub + sharedname = WL_ResetTopicConnector_exec + libs += WL_ResetTopicConnector_stub WL_ResetTopicConnector_lem_stub \ + WL_ResetTopicBase_stub WL_ResetTopicBase_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += WL_RESETTOPIC_CONNECTOR_CONN_BUILD_DLL + + IDL_Files { + } + + Source_Files { + WL_ResetTopic_Connector_conn.cpp + } + + Header_Files { + WL_ResetTopic_Connector_conn.h + WL_ResetTopic_Connector_conn_export.h + } + + Inline_Files { + } +} + + +project (WL_ResetTopicConnector_svnt) : ciao_servant, dds4ccm_impl { + after += WL_ResetTopicConnector_lem_stub WL_ResetTopicConnector_exec \ + WL_ResetTopicConnector_stub + sharedname = WL_ResetTopicConnector_svnt + libs += WL_ResetTopicConnector_stub \ + WL_ResetTopicConnector_lem_stub \ + WL_ResetTopicBase_stub \ + WL_ResetTopicConnector_exec + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += WL_RESETTOPIC_CONNECTOR_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + WL_ResetTopic_ConnectorS.cpp + WL_ResetTopic_Connector_svnt.cpp + } + + Header_Files { + WL_ResetTopic_ConnectorS.h + WL_ResetTopic_Connector_svnt.h + WL_ResetTopic_Connector_svnt_export.h + } + + Inline_Files { + WL_ResetTopic_ConnectorS.inl + } +} + + diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Receiver/ReceiverDriver.cpp b/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Receiver/ReceiverDriver.cpp new file mode 100644 index 00000000000..9f0535437c9 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Receiver/ReceiverDriver.cpp @@ -0,0 +1,88 @@ +//$Id$ +/* + * @file ReceiverDriver.cpp + * + * @author Marcel Smit + */ + + +#include "WL_ResetTopic_ReceiverC.h" +#include "ace/streams.h" +#include "ace/Get_Opt.h" + +const ACE_TCHAR *receiver_ior = ACE_TEXT ("file://Receiver.ior"); +const ACE_TCHAR *topic_name = ACE_TEXT (""); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:n:")); + int c; + + while ((c = get_opts ()) != -1) + { + switch (c) + { + case 'k': + receiver_ior = get_opts.opt_arg (); + break; + + case 'n': + topic_name = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s\n" + "-k <Receiver IOR> (default is file://Receiver.ior)\n" + "-n <new topic>\n" + "\n", + argv [0]), + -1); + } + } + + return 0; +} + + +int ACE_TMAIN (int argc, ACE_TCHAR* argv[]) +{ + try + { + // initialize the ORB + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv); + if (parse_args (argc, argv) != 0) + { + return -1; + } + + // create the factory object reference, + CORBA::Object_var receiver_obj = + orb->string_to_object (receiver_ior); + + // downcast the object reference to the appropriate type + ::WL_ResetTopic::Receiver_var receiver = + ::WL_ResetTopic::Receiver::_narrow (receiver_obj.in ()); + + if (CORBA::is_nil (receiver.in ())) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to acquire 'Receiver' objref\n"), + -1); + } + receiver->set_new_topic (topic_name); + + orb->destroy (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Who is the culprit in the ReceiverDriver?\n"); + ACE_ERROR_RETURN ((LM_ERROR, + "Uncaught CORBA exception\n"), + 1); + } + return 0; +} diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Receiver/WL_ResetTopic_Receiver.idl b/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Receiver/WL_ResetTopic_Receiver.idl new file mode 100644 index 00000000000..439c960b511 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Receiver/WL_ResetTopic_Receiver.idl @@ -0,0 +1,28 @@ +// $Id$ + +/** + * @file + * @author Marcel Smit <msmit@remedy.nl> + */ + +#ifndef RECEIVER_IDL +#define RECEIVER_IDL + +#include "Connector/WL_ResetTopic_Connector.idl" + +module WL_ResetTopic +{ + interface ChangeTopicInterface + { + void set_new_topic (in string topic_name); + }; + + component Receiver supports ChangeTopicInterface + { + port WL_ResetTopicTestConnector::DDS_Listen info_out_event; + + attribute unsigned short iterations; + }; +}; + +#endif diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Receiver/WL_ResetTopic_Receiver.mpc b/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Receiver/WL_ResetTopic_Receiver.mpc new file mode 100644 index 00000000000..bd7eb36429a --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Receiver/WL_ResetTopic_Receiver.mpc @@ -0,0 +1,163 @@ +// $Id$ + +project (WL_ResetTopicReceiver_idl_gen) : componentidldefaults, dds4ccm { + custom_only = 1 + after += WL_ResetTopicConnector_idl_gen + idlflags += -Wb,stub_export_macro=RECEIVER_STUB_Export \ + -Wb,stub_export_include=Receiver_stub_export.h \ + -Wb,skel_export_macro=RECEIVER_SVNT_Export \ + -Wb,skel_export_include=Receiver_svnt_export.h \ + -Wb,svnt_export_macro=RECEIVER_SVNT_Export \ + -Wb,svnt_export_include=Receiver_svnt_export.h \ + -Wb,exec_export_macro=RECEIVER_EXEC_Export \ + -Wb,exec_export_include=Receiver_exec_export.h \ + -I.. + IDL_Files { + WL_ResetTopic_Receiver.idl + } +} + +project (WL_ResetTopicReceiver_lem_gen) : ciaoidldefaults, dds4ccm { + after += WL_ResetTopicReceiver_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=RECEIVER_LEM_STUB_Export \ + -Wb,stub_export_include=Receiver_lem_stub_export.h \ + -SS -Gxhst -I.. + + IDL_Files { + WL_ResetTopic_ReceiverE.idl + } +} + +project (WL_ResetTopicReceiver_lem_stub) : ccm_svnt, dds4ccm_base { + after += WL_ResetTopicReceiver_lem_gen WL_ResetTopicReceiver_stub WL_ResetTopicConnector_stub WL_ResetTopicBase_stub + libs += Receiver_stub WL_ResetTopicConnector_stub WL_ResetTopicBase_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = Receiver_lem_stub + dynamicflags += RECEIVER_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + WL_ResetTopic_ReceiverEC.cpp + } + + Header_Files { + WL_ResetTopic_ReceiverEC.h + Receiver_lem_stub_export.h + } + + Inline_Files { + WL_ResetTopic_ReceiverEC.inl + } +} + +project (WL_ResetTopicReceiver_stub) : ccm_stub, dds4ccm_base { + after += WL_ResetTopicReceiver_idl_gen WL_ResetTopicConnector_stub WL_ResetTopicBase_stub WL_ResetTopicConnector_lem_gen + libs += WL_ResetTopicConnector_stub WL_ResetTopicBase_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = Receiver_stub + dynamicflags += RECEIVER_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + WL_ResetTopic_ReceiverC.cpp + } + + Header_Files { + WL_ResetTopic_ReceiverC.h + Receiver_stub_export.h + } + + Inline_Files { + WL_ResetTopic_ReceiverC.inl + } +} + +project (WL_ResetTopicReceiver_exec) : ciao_executor, dds4ccm_lem_stub { + after += WL_ResetTopicReceiver_lem_stub WL_ResetTopicReceiver_stub \ + WL_ResetTopicBase_stub WL_ResetTopicConnector_stub \ + WL_ResetTopicConnector_lem_stub + sharedname = Receiver_exec + libs += Receiver_stub Receiver_lem_stub WL_ResetTopicBase_stub \ + WL_ResetTopicConnector_stub WL_ResetTopicConnector_lem_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += RECEIVER_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + WL_ResetTopic_Receiver_exec.cpp + } + + Header_Files { + WL_ResetTopic_Receiver_exec.h + Receiver_exec_export.h + } + + Inline_Files { + } +} + + +project (WL_ResetTopicReceiver_svnt) : ciao_servant, dds4ccm_lem_stub, dds4ccm_skel { + after += WL_ResetTopicReceiver_lem_stub WL_ResetTopicBase_stub WL_ResetTopicConnector_stub WL_ResetTopicConnector_svnt WL_ResetTopicReceiver_exec WL_ResetTopicConnector_lem_stub + sharedname = Receiver_svnt + libs += Receiver_stub Receiver_lem_stub WL_ResetTopicBase_stub WL_ResetTopicConnector_stub WL_ResetTopicConnector_svnt Receiver_exec WL_ResetTopicConnector_lem_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += RECEIVER_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + WL_ResetTopic_ReceiverS.cpp + WL_ResetTopic_Receiver_svnt.cpp + } + + Header_Files { + WL_ResetTopic_ReceiverS.h + WL_ResetTopic_Receiver_svnt.h + Receiver_svnt_export.h + } + + Inline_Files { + WL_ResetTopic_ReceiverS.inl + } +} + +project (WL_ResetTopicReceiver_Driver) : ccm_stub, valuetype, dds4ccm_lem_stub { + exename = ReceiverDriver + after += WL_ResetTopicReceiver_stub WL_ResetTopicConnector_stub + libs += Receiver_stub WL_ResetTopicBase_stub WL_ResetTopicConnector_stub + + includes += .. + libpaths += ../lib + + exeout = ../lib + IDL_Files { + } + + Source_Files { + ReceiverDriver.cpp + } + + Header_Files { + } + + Inline_Files { + } +} + diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Receiver/WL_ResetTopic_Receiver_exec.cpp b/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Receiver/WL_ResetTopic_Receiver_exec.cpp new file mode 100644 index 00000000000..8acf6fbead4 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Receiver/WL_ResetTopic_Receiver_exec.cpp @@ -0,0 +1,309 @@ +// -*- C++ -*- +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v1.8.2 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ + +#include "WL_ResetTopic_Receiver_exec.h" +#include "dds4ccm/impl/logger/Log_Macros.h" + +namespace CIAO_WL_ResetTopic_Receiver_Impl +{ + + /** + * Facet Executor Implementation Class: info_out_event_data_listener_exec_i + */ + + info_out_event_data_listener_exec_i::info_out_event_data_listener_exec_i ( + ::WL_ResetTopic::CCM_Receiver_Context_ptr ctx, + Atomic_Boolean &samples_received) + : ciao_context_ ( + ::WL_ResetTopic::CCM_Receiver_Context::_duplicate (ctx)) + , samples_received_(samples_received) + { + } + + info_out_event_data_listener_exec_i::~info_out_event_data_listener_exec_i (void) + { + } + + // Operations from ::WL_ResetTopic::WL_ResetTopicTestConnector::Listener + + void + info_out_event_data_listener_exec_i::on_one_data (const ::WL_ResetTopicTest & datum, + const ::CCM_DDS::ReadInfo & /* info */) + { + this->samples_received_ = true; + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("info_out_event_data_listener_exec_i::on_one_data - ") + ACE_TEXT ("received data for <%C> at %u\n"), + datum.key.in (), + datum.iteration)); + } + + void + info_out_event_data_listener_exec_i::on_many_data (const ::WL_ResetTopicTestSeq & /* data */, + const ::CCM_DDS::ReadInfoSeq & /* infos */) + { + ACE_ERROR ((LM_ERROR, "info_out_event_data_listener_exec_i::on_many_data : " + "Error: No callback to this method expected.\n")); + } + + /** + * Facet Executor Implementation Class: info_out_event_status_exec_i + */ + + info_out_event_status_exec_i::info_out_event_status_exec_i ( + ::WL_ResetTopic::CCM_Receiver_Context_ptr ctx) + : ciao_context_ ( + ::WL_ResetTopic::CCM_Receiver_Context::_duplicate (ctx)) + { + } + + info_out_event_status_exec_i::~info_out_event_status_exec_i (void) + { + } + + // Operations from ::CCM_DDS::PortStatusListener + + void + info_out_event_status_exec_i::on_requested_deadline_missed (::DDS::DataReader_ptr /* the_reader */, + const ::DDS::RequestedDeadlineMissedStatus & /* status */) + { + /* Your code here. */ + } + + void + info_out_event_status_exec_i::on_sample_lost (::DDS::DataReader_ptr /* the_reader */, + const ::DDS::SampleLostStatus & /* status */) + { + /* Your code here. */ + } + + + + /** + * Component Executor Implementation Class: Receiver_exec_i + */ + + Receiver_exec_i::Receiver_exec_i (void) + : iterations_ (0) + , samples_received_(0) + { + } + + Receiver_exec_i::~Receiver_exec_i (void) + { + } + + // Supported operations and attributes. + void + Receiver_exec_i::set_new_topic (::CORBA::Object_ptr cmp, + const char * topic_name) + { + if (::CORBA::is_nil (cmp)) + { + ACE_ERROR ((LM_ERROR, "ERROR: Receiver_exec_i::set_topic_name_writer - " + "Unable to get component interface\n")); + throw ::CORBA::INTERNAL (); + } + ::WL_ResetTopic::WL_ResetTopicTestConnector::CCM_DDS_Event_var conn = + ::WL_ResetTopic::WL_ResetTopicTestConnector::CCM_DDS_Event::_narrow (cmp); + if (::CORBA::is_nil (conn.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: Receiver_exec_i::set_topic_name_writer - " + "Unable to narrow connector interface\n")); + throw ::CORBA::INTERNAL (); + } + conn->topic_name (topic_name); + +// ::CCM_DDS::DataListenerControl_var dlc = +// this->ciao_context_->get_connection_info_out_event_data_control (); +// dlc->mode (::CCM_DDS::ONE_BY_ONE); + } + + void + Receiver_exec_i::set_new_topic (const char * topic_name) + { + + if (this->samples_received_.value()) + ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::set_new_topic - " + "OK, samples received during last run\n")); + else + ACE_ERROR ((LM_ERROR, "Receiver_exec_i::set_new_topic - " + "ERROR: No samples received during last run\n")); + + this->samples_received_ = false; + + ::CORBA::Object_var cmp; + try + { + ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::set_new_topic - " + "Setting topic to <%C>\n", + topic_name)); + //First listener + ::WL_ResetTopic::WL_ResetTopicTestConnector::Reader_var reader = + this->ciao_context_->get_connection_info_out_event_data(); + + if (::CORBA::is_nil (reader.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: Receiver_exec_i::set_new_topic - " + "ciao_info_out_event_data_listener_ seems nil\n")); + throw ::CORBA::INTERNAL (); + } + cmp = reader->_get_component (); + this->set_new_topic (cmp.in (), topic_name); + + //next listener + if (::CORBA::is_nil (this->ciao_info_out_event_status_.in ())) + { + ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::set_new_topic - " + "ciao_info_out_event_status_ seems nil\n")); + } + else + { + cmp = this->ciao_info_out_event_status_->_get_component (); + this->set_new_topic (cmp.in (), topic_name); + } + } + catch (const ::CCM_DDS::NonChangeable &) + { + ACE_ERROR ((LM_ERROR, "ERROR: Receiver_exec_i::set_topic_name_writer - " + "Caught NonChangeable exception.\n")); + } + } + + // Component attributes and port operations. + + ::WL_ResetTopic::WL_ResetTopicTestConnector::CCM_Listener_ptr + Receiver_exec_i::get_info_out_event_data_listener (void) + { + if ( ::CORBA::is_nil (this->ciao_info_out_event_data_listener_.in ())) + { + info_out_event_data_listener_exec_i *tmp = 0; + ACE_NEW_RETURN ( + tmp, + info_out_event_data_listener_exec_i ( + this->ciao_context_.in (), + this->samples_received_), + ::WL_ResetTopic::WL_ResetTopicTestConnector::CCM_Listener::_nil ()); + + this->ciao_info_out_event_data_listener_ = tmp; + } + + return + ::WL_ResetTopic::WL_ResetTopicTestConnector::CCM_Listener::_duplicate ( + this->ciao_info_out_event_data_listener_.in ()); + } + + ::CCM_DDS::CCM_PortStatusListener_ptr + Receiver_exec_i::get_info_out_event_status (void) + { + if ( ::CORBA::is_nil (this->ciao_info_out_event_status_.in ())) + { + info_out_event_status_exec_i *tmp = 0; + ACE_NEW_RETURN ( + tmp, + info_out_event_status_exec_i ( + this->ciao_context_.in ()), + ::CCM_DDS::CCM_PortStatusListener::_nil ()); + + this->ciao_info_out_event_status_ = tmp; + } + + return + ::CCM_DDS::CCM_PortStatusListener::_duplicate ( + this->ciao_info_out_event_status_.in ()); + } + + ::CORBA::UShort + Receiver_exec_i::iterations (void) + { + return this->iterations_; + } + + void + Receiver_exec_i::iterations ( + const ::CORBA::UShort iterations) + { + this->iterations_ = iterations; + } + + // Operations from Components::SessionComponent. + + void + Receiver_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + this->ciao_context_ = + ::WL_ResetTopic::CCM_Receiver_Context::_narrow (ctx); + + if ( ::CORBA::is_nil (this->ciao_context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + Receiver_exec_i::configuration_complete (void) + { + /* Your code here. */ + } + + void + Receiver_exec_i::ccm_activate (void) + { + ::CCM_DDS::DataListenerControl_var dlc = + this->ciao_context_->get_connection_info_out_event_data_control (); + dlc->mode (::CCM_DDS::ONE_BY_ONE); + } + + void + Receiver_exec_i::ccm_passivate (void) + { + } + + void + Receiver_exec_i::ccm_remove (void) + { + if (this->samples_received_.value()) + ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::ccm_remove - " + "OK, samples received during last run\n")); + else + ACE_ERROR ((LM_ERROR, "Receiver_exec_i::ccm_remove - " + "ERROR: No samples received during last run\n")); + } + + extern "C" RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_WL_ResetTopic_Receiver_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_NORETURN ( + retval, + Receiver_exec_i); + + return retval; + } +} diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Receiver/WL_ResetTopic_Receiver_exec.h b/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Receiver/WL_ResetTopic_Receiver_exec.h new file mode 100644 index 00000000000..3bcf2cf692d --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Receiver/WL_ResetTopic_Receiver_exec.h @@ -0,0 +1,181 @@ +// -*- C++ -*- +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v1.8.2 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ +#ifndef CIAO_WL_RESETTOPIC_RECEIVER_EXEC_KKU0OW_H_ +#define CIAO_WL_RESETTOPIC_RECEIVER_EXEC_KKU0OW_H_ + +#include /**/ "ace/pre.h" + +#include "WL_ResetTopic_ReceiverEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ "Receiver_exec_export.h" +#include "tao/LocalObject.h" + +namespace CIAO_WL_ResetTopic_Receiver_Impl +{ + typedef ACE_Atomic_Op <TAO_SYNCH_MUTEX, CORBA::Boolean> Atomic_Boolean; + + /** + * Provider Executor Implementation Class: info_out_event_data_listener_exec_i + */ + + class info_out_event_data_listener_exec_i + : public virtual ::WL_ResetTopic::WL_ResetTopicTestConnector::CCM_Listener, + public virtual ::CORBA::LocalObject + { + public: + info_out_event_data_listener_exec_i ( + ::WL_ResetTopic::CCM_Receiver_Context_ptr ctx, + Atomic_Boolean &samples_received); + virtual ~info_out_event_data_listener_exec_i (void); + + //@{ + /** Operations and attributes from WL_ResetTopic::WL_ResetTopicTestConnector::Listener. */ + + virtual + void on_one_data (const ::WL_ResetTopicTest & datum, + const ::CCM_DDS::ReadInfo & info); + + virtual + void on_many_data (const ::WL_ResetTopicTestSeq & data, + const ::CCM_DDS::ReadInfoSeq & infos); + //@} + + private: + ::WL_ResetTopic::CCM_Receiver_Context_var ciao_context_; + Atomic_Boolean &samples_received_; + }; + + /** + * Provider Executor Implementation Class: info_out_event_status_exec_i + */ + + class info_out_event_status_exec_i + : public virtual ::CCM_DDS::CCM_PortStatusListener, + public virtual ::CORBA::LocalObject + { + public: + info_out_event_status_exec_i ( + ::WL_ResetTopic::CCM_Receiver_Context_ptr ctx); + virtual ~info_out_event_status_exec_i (void); + + //@{ + /** Operations and attributes from CCM_DDS::PortStatusListener. */ + + virtual + void on_requested_deadline_missed (::DDS::DataReader_ptr the_reader, + const ::DDS::RequestedDeadlineMissedStatus & status); + + virtual + void on_sample_lost (::DDS::DataReader_ptr the_reader, + const ::DDS::SampleLostStatus & status); + //@} + + private: + ::WL_ResetTopic::CCM_Receiver_Context_var ciao_context_; + }; + + /** + * Component Executor Implementation Class: Receiver_exec_i + */ + + class Receiver_exec_i + : public virtual Receiver_Exec, + public virtual ::CORBA::LocalObject + { + public: + Receiver_exec_i (void); + virtual ~Receiver_exec_i (void); + + //@{ + /** Supported operations and attributes. */ + virtual void set_new_topic (const char * topic_name); + //@} + + //@{ + /** Component attributes and port operations. */ + + virtual ::WL_ResetTopic::WL_ResetTopicTestConnector::CCM_Listener_ptr + get_info_out_event_data_listener (void); + + virtual ::CCM_DDS::CCM_PortStatusListener_ptr + get_info_out_event_status (void); + + virtual ::CORBA::UShort iterations (void); + + virtual void iterations (::CORBA::UShort iterations); + //@} + + //@{ + /** Operations from Components::SessionComponent. */ + virtual void set_session_context (::Components::SessionContext_ptr ctx); + virtual void configuration_complete (void); + virtual void ccm_activate (void); + virtual void ccm_passivate (void); + virtual void ccm_remove (void); + //@} + + //@{ + /** User defined public operations. */ + + //@} + + private: + ::WL_ResetTopic::CCM_Receiver_Context_var ciao_context_; + + //@{ + /** Component attributes. */ + ::WL_ResetTopic::WL_ResetTopicTestConnector::CCM_Listener_var ciao_info_out_event_data_listener_; + ::CCM_DDS::CCM_PortStatusListener_var ciao_info_out_event_status_; + + ::CORBA::UShort iterations_; + //@} + + //@{ + /** User defined members. */ + Atomic_Boolean samples_received_; + + //@} + + //@{ + /** User defined private operations. */ + void set_new_topic (::CORBA::Object_ptr cmp, + const char * topic_name); + + //@} + }; + + extern "C" RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_WL_ResetTopic_Receiver_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* ifndef */ diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Sender/SenderDriver.cpp b/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Sender/SenderDriver.cpp new file mode 100644 index 00000000000..69163d68adf --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Sender/SenderDriver.cpp @@ -0,0 +1,88 @@ +//$Id$ +/* + * @file SenderDriver.cpp + * + * @author Marcel Smit + */ + + +#include "WL_ResetTopic_SenderC.h" +#include "ace/streams.h" +#include "ace/Get_Opt.h" + +const ACE_TCHAR *sender_ior = ACE_TEXT ("file://Sender.ior"); +const ACE_TCHAR *topic_name = ACE_TEXT (""); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:n:")); + int c; + + while ((c = get_opts ()) != -1) + { + switch (c) + { + case 'k': + sender_ior = get_opts.opt_arg (); + break; + + case 'n': + topic_name = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s\n" + "-k <Sender IOR> (default is file://Sender.ior)\n" + "-n <new topic>\n" + "\n", + argv [0]), + -1); + } + } + + return 0; +} + + +int ACE_TMAIN (int argc, ACE_TCHAR* argv[]) +{ + try + { + // initialize the ORB + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv); + if (parse_args (argc, argv) != 0) + { + return -1; + } + + // create the factory object reference, + CORBA::Object_var sender_obj = + orb->string_to_object (sender_ior); + + // downcast the object reference to the appropriate type + ::WL_ResetTopic::Sender_var sender = + ::WL_ResetTopic::Sender::_narrow (sender_obj.in ()); + + if (CORBA::is_nil (sender.in ())) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to acquire 'Sender' objref\n"), + -1); + } + sender->set_new_topic (topic_name); + + orb->destroy (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Who is the culprit in the SenderDriver?\n"); + ACE_ERROR_RETURN ((LM_ERROR, + "Uncaught CORBA exception\n"), + 1); + } + return 0; +} diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Sender/WL_ResetTopic_Sender.idl b/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Sender/WL_ResetTopic_Sender.idl new file mode 100644 index 00000000000..a9f15fccaec --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Sender/WL_ResetTopic_Sender.idl @@ -0,0 +1,31 @@ +// $Id$ + +/** + * @file + * @author Marcel Smit <msmit@remedy.nl> + * + * by-hand idl3 translation of sender components. + */ + +#ifndef WL_RESETTOPIC_SENDER_IDL +#define WL_RESETTOPIC_SENDER_IDL + +#include "Connector/WL_ResetTopic_Connector.idl" + +module WL_ResetTopic +{ + interface ChangeTopicInterface + { + void set_new_topic (in string topic_name); + }; + + component Sender supports ChangeTopicInterface + { + port WL_ResetTopicTestConnector::DDS_Write info_write; + + attribute unsigned short iterations; + attribute unsigned short keys; + }; +}; + +#endif diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Sender/WL_ResetTopic_Sender.mpc b/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Sender/WL_ResetTopic_Sender.mpc new file mode 100644 index 00000000000..9bc89b7f5fa --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Sender/WL_ResetTopic_Sender.mpc @@ -0,0 +1,166 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p WL_ResetTopicBase -l ../lib -o ../lib -c controller -u DDS Sender" + +project (WL_ResetTopicSender_idl_gen) : componentidldefaults, dds4ccm { + after += WL_ResetTopicConnector_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=SENDER_STUB_Export \ + -Wb,stub_export_include=Sender_stub_export.h \ + -Wb,skel_export_macro=SENDER_SVNT_Export \ + -Wb,skel_export_include=Sender_svnt_export.h \ + -Wb,svnt_export_macro=SENDER_SVNT_Export \ + -Wb,svnt_export_include=Sender_svnt_export.h \ + -Wb,exec_export_macro=SENDER_EXEC_Export \ + -Wb,exec_export_include=Sender_exec_export.h \ + -I .. + + IDL_Files { + WL_ResetTopic_Sender.idl + } +} + +project (WL_ResetTopicSender_lem_gen) : ciaoidldefaults, dds4ccm { + after += WL_ResetTopicSender_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=SENDER_LEM_STUB_Export \ + -Wb,stub_export_include=Sender_lem_stub_export.h \ + -SS -Gxhst -I $CIAO_ROOT/connectors -I .. + + IDL_Files { + WL_ResetTopic_SenderE.idl + } +} + +project (WL_ResetTopicSender_lem_stub) : ccm_svnt, dds4ccm_base { + after += WL_ResetTopicSender_lem_gen WL_ResetTopicSender_stub WL_ResetTopicBase_stub + libs += WL_ResetTopicBase_stub Sender_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = Sender_lem_stub + dynamicflags += SENDER_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + WL_ResetTopic_SenderEC.cpp + } + + Header_Files { + WL_ResetTopic_SenderEC.h + Sender_lem_stub_export.h + } + + Inline_Files { + WL_ResetTopic_SenderEC.inl + } +} + +project (WL_ResetTopicSender_stub) : ccm_stub, dds4ccm_base { + after += WL_ResetTopicSender_idl_gen WL_ResetTopicBase_stub WL_ResetTopicConnector_stub + libs += WL_ResetTopicBase_stub WL_ResetTopicConnector_stub + includes += .. + libpaths += ../lib + libout = ../lib + sharedname = Sender_stub + dynamicflags += SENDER_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + WL_ResetTopic_SenderC.cpp + } + + Header_Files { + WL_ResetTopic_SenderC.h + Sender_stub_export.h + } + + Inline_Files { + WL_ResetTopic_SenderC.inl + } +} + +project (WL_ResetTopicSender_exec) : ciao_executor, dds4ccm_lem_stub { + after += WL_ResetTopicSender_lem_stub WL_ResetTopicSender_stub \ + WL_ResetTopicConnector_lem_stub WL_ResetTopicConnector_stub + sharedname = Sender_exec + libs += Sender_stub Sender_lem_stub WL_ResetTopicBase_stub \ + WL_ResetTopicConnector_lem_stub WL_ResetTopicConnector_stub + libpaths += ../lib + includes += .. + libout = ../lib + dynamicflags += SENDER_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + WL_ResetTopic_Sender_exec.cpp + } + + Header_Files { + WL_ResetTopic_Sender_exec.h + Sender_exec_export.h + } + + Inline_Files { + } +} + + +project (WL_ResetTopicSender_svnt) : ciao_servant, dds4ccm_lem_stub, dds4ccm_skel { + after += WL_ResetTopicBase_stub WL_ResetTopicSender_lem_stub WL_ResetTopicConnector_stub \ + WL_ResetTopicConnector_svnt WL_ResetTopicConnector_lem_stub + sharedname = Sender_svnt + libs += Sender_stub Sender_lem_stub \ + WL_ResetTopicBase_stub WL_ResetTopicConnector_stub WL_ResetTopicConnector_svnt WL_ResetTopicConnector_lem_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += SENDER_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + WL_ResetTopic_SenderS.cpp + WL_ResetTopic_Sender_svnt.cpp + } + + Header_Files { + WL_ResetTopic_SenderS.h + WL_ResetTopic_Sender_svnt.h + Sender_svnt_export.h + } + + Inline_Files { + WL_ResetTopic_SenderS.inl + } +} + +project (WL_ResetTopicSender_Driver) : ccm_stub, valuetype, dds4ccm_lem_stub { + exename = SenderDriver + after += WL_ResetTopicSender_stub WL_ResetTopicConnector_stub + libs += Sender_stub WL_ResetTopicBase_stub WL_ResetTopicConnector_stub + + includes += .. + libpaths += ../lib + + exeout = ../lib + IDL_Files { + } + + Source_Files { + SenderDriver.cpp + } + + Header_Files { + } + + Inline_Files { + } +} + diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Sender/WL_ResetTopic_Sender_exec.cpp b/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Sender/WL_ResetTopic_Sender_exec.cpp new file mode 100644 index 00000000000..a90f457a4e1 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Sender/WL_ResetTopic_Sender_exec.cpp @@ -0,0 +1,283 @@ +// -*- C++ -*- +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v1.8.2 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ + +#include "WL_ResetTopic_Sender_exec.h" +#include "tao/ORB_Core.h" +#include "ace/Reactor.h" + +namespace CIAO_WL_ResetTopic_Sender_Impl +{ + + /** + * Timeout_Handler + */ + + Timeout_Handler::Timeout_Handler (Sender_exec_i &callback) + : callback_ (callback) + { + } + + int + Timeout_Handler::handle_timeout (const ACE_Time_Value &, const void *) + { + // Notify the subscribers + this->callback_.start_event_test (); + return 0; + } + + /** + * Component Executor Implementation Class: Sender_exec_i + */ + + Sender_exec_i::Sender_exec_i (void) + : iterations_ (0) + , keys_ (0) + , to_handler_ (0) + , topic_name_ ("TopicI") + , old_topic_name_ ("TopicI") + { + ACE_NEW_THROW_EX (this->to_handler_, + Timeout_Handler (*this), + ::CORBA::INTERNAL ()); + } + + Sender_exec_i::~Sender_exec_i (void) + { + delete this->to_handler_; + } + + // Supported operations and attributes. + ACE_Reactor* + Sender_exec_i::reactor (void) + { + ACE_Reactor* reactor = 0; + ::CORBA::Object_var ccm_object = + this->ciao_context_->get_CCM_object(); + if (! ::CORBA::is_nil (ccm_object.in ())) + { + ::CORBA::ORB_var orb = ccm_object->_get_orb (); + if (! ::CORBA::is_nil (orb.in ())) + { + reactor = orb->orb_core ()->reactor (); + } + } + if (reactor == 0) + { + throw ::CORBA::INTERNAL (); + } + return reactor; + } + + void Sender_exec_i::set_new_topic (const char * topic_name) + { + ACE_GUARD (TAO_SYNCH_RECURSIVE_MUTEX, guard, this->topic_name_lock_); + + this->old_topic_name_ = this->topic_name_; + this->topic_name_ = topic_name; + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::set_new_topic - " + "New topic name set <%C>\n", + topic_name)); + } + + void + Sender_exec_i::set_topic_name_writer (const char * topic_name) + { + try + { + if (ACE_OS::strcmp (topic_name, this->old_topic_name_.c_str()) != 0) + { + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::set_topic_name_writer - " + "Setting topic to <%C>\n", + topic_name)); + this->old_topic_name_ = topic_name; + ::WL_ResetTopic::WL_ResetTopicTestConnector:: Writer_var writer = + this->ciao_context_->get_connection_info_write_data (); + if (::CORBA::is_nil (writer.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::set_topic_name_writer - " + "Unable to get writer interface\n")); + throw ::CORBA::INTERNAL (); + } + ::CORBA::Object_var cmp = writer->_get_component (); + if (::CORBA::is_nil (cmp.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::set_topic_name_writer - " + "Unable to get component interface\n")); + throw ::CORBA::INTERNAL (); + } + ::WL_ResetTopic::WL_ResetTopicTestConnector::CCM_DDS_Event_var conn = + ::WL_ResetTopic::WL_ResetTopicTestConnector::CCM_DDS_Event::_narrow (cmp.in ()); + if (::CORBA::is_nil (conn.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::set_topic_name_writer - " + "Unable to narrow connector interface\n")); + throw ::CORBA::INTERNAL (); + } + { + ACE_GUARD (TAO_SYNCH_RECURSIVE_MUTEX, guard, this->topic_name_lock_); + conn->topic_name (topic_name); + } + } + } + catch (const ::CCM_DDS::NonChangeable &) + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::set_topic_name_writer - " + "Caught NonChangeable exception.\n")); + } + } + + void + Sender_exec_i::start_event_test (void) + { + // Set the topic name on the connector first. Therefor we need to + // get to the connector first. + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::start_event_test - Start\n")); + try + { + for (::CORBA::UShort key = 1; key < this->keys_ + 1; ++key) + { + WL_ResetTopicTest sample; + char tmp[7]; + ACE_OS::sprintf (tmp, "KEY_%d", key); + sample.key = CORBA::string_dup(tmp); + + for (::CORBA::UShort iter = 1; iter < this->iterations_ + 1; ++iter) + { + this->set_topic_name_writer (this->topic_name_.c_str ()); + ::WL_ResetTopic::WL_ResetTopicTestConnector:: Writer_var writer = + this->ciao_context_->get_connection_info_write_data (); + sample.iteration = iter; + writer->write_one (sample, ::DDS::HANDLE_NIL); + + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::start_event_test - " + "Sample for topic <%C> written : key <%C> - iteration <%d>\n", + this->topic_name_.c_str (), tmp, iter)); + + ACE_Time_Value tv (0, 50000); + ACE_OS::sleep (tv); + } + } + } + catch (const ::CORBA::Exception & ex) + { + ex._tao_print_exception("ERROR:"); + } + catch (...) + { + ACE_ERROR ((LM_ERROR, "Sender_exec_i::start_event_test - " + "ERROR: Unexpected and unknown exception caught.\n")); + } + } + + // Component attributes and port operations. + + ::CORBA::UShort + Sender_exec_i::iterations (void) + { + return this->iterations_; + } + + void + Sender_exec_i::iterations ( + const ::CORBA::UShort iterations) + { + this->iterations_ = iterations; + } + + ::CORBA::UShort + Sender_exec_i::keys (void) + { + return this->keys_; + } + + void + Sender_exec_i::keys ( + const ::CORBA::UShort keys) + { + this->keys_ = keys; + } + + // Operations from Components::SessionComponent. + + void + Sender_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + this->ciao_context_ = + ::WL_ResetTopic::CCM_Sender_Context::_narrow (ctx); + + if ( ::CORBA::is_nil (this->ciao_context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + Sender_exec_i::configuration_complete (void) + { + /* Your code here. */ + } + + void + Sender_exec_i::ccm_activate (void) + { + if (this->reactor ()->schedule_timer ( + this->to_handler_, + 0, + ACE_Time_Value (5, 0), + ACE_Time_Value (5, 0)) == -1) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Sender_exec_i::start : ") + ACE_TEXT ("Error scheduling timer"))); + } + } + + void + Sender_exec_i::ccm_passivate (void) + { + this->reactor()->cancel_timer(this->to_handler_); + } + + void + Sender_exec_i::ccm_remove (void) + { + /* Your code here. */ + } + + extern "C" SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_WL_ResetTopic_Sender_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_NORETURN ( + retval, + Sender_exec_i); + + return retval; + } +} diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Sender/WL_ResetTopic_Sender_exec.h b/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Sender/WL_ResetTopic_Sender_exec.h new file mode 100644 index 00000000000..b13f6176bfb --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/Sender/WL_ResetTopic_Sender_exec.h @@ -0,0 +1,139 @@ +// -*- C++ -*- +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v1.8.2 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ +#ifndef CIAO_WL_RESETTOPIC_SENDER_EXEC_YSJ9S8_H_ +#define CIAO_WL_RESETTOPIC_SENDER_EXEC_YSJ9S8_H_ + +#include /**/ "ace/pre.h" + +#include "WL_ResetTopic_SenderEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ "Sender_exec_export.h" +#include "tao/LocalObject.h" + +namespace CIAO_WL_ResetTopic_Sender_Impl +{ + class Sender_exec_i; + + /** + * Timeout_Handler + */ + class Timeout_Handler : + public ACE_Event_Handler + { + public: + Timeout_Handler (Sender_exec_i &callback); + /// Handle the timeout. + virtual int handle_timeout (const ACE_Time_Value &tv, + const void *arg); + private: + /// Maintains a handle that actually process the event + Sender_exec_i &callback_; + }; + + /** + * Component Executor Implementation Class: Sender_exec_i + */ + + class Sender_exec_i + : public virtual Sender_Exec, + public virtual ::CORBA::LocalObject + { + public: + Sender_exec_i (void); + virtual ~Sender_exec_i (void); + + //@{ + /** Supported operations and attributes. */ + virtual void set_new_topic (const char * topic_name); + //@} + + //@{ + /** Component attributes and port operations. */ + + virtual ::CORBA::UShort iterations (void); + + virtual void iterations (::CORBA::UShort iterations); + + virtual ::CORBA::UShort keys (void); + + virtual void keys (::CORBA::UShort keys); + //@} + + //@{ + /** Operations from Components::SessionComponent. */ + virtual void set_session_context (::Components::SessionContext_ptr ctx); + virtual void configuration_complete (void); + virtual void ccm_activate (void); + virtual void ccm_passivate (void); + virtual void ccm_remove (void); + //@} + + //@{ + /** User defined public operations. */ + void set_topic_name_writer (const char * topic_name); + void start_event_test (void); + //@} + + private: + ::WL_ResetTopic::CCM_Sender_Context_var ciao_context_; + + //@{ + /** Component attributes. */ + + ::CORBA::UShort iterations_; + + ::CORBA::UShort keys_; + //@} + + //@{ + /** User defined members. */ + Timeout_Handler *to_handler_; + ACE_CString topic_name_, old_topic_name_; + + TAO_SYNCH_RECURSIVE_MUTEX topic_name_lock_; + //@} + + //@{ + /** User defined private operations. */ + + //@} + + /// Get the ACE_Reactor + ACE_Reactor* reactor (void); + }; + + extern "C" SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_WL_ResetTopic_Sender_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* ifndef */ diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/descriptors/Plan.cdp b/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/descriptors/Plan.cdp new file mode 100644 index 00000000000..31cdd7950ce --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/descriptors/Plan.cdp @@ -0,0 +1,407 @@ +<!-- $Id$ --> +<Deployment:DeploymentPlan + xmlns:Deployment="http://www.omg.org/Deployment" + xmlns:xmi="http://www.omg.org/XMI" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.omg.org/Deployment Deployment.xsd"> + <label>ResetTopic_Depl_1</label> + <UUID>ResetTopic_Depl_1</UUID> + + <implementation xmi:id="ReceiverComponentImplementation"> + <name>ReceiverComponentImplementation</name> + <source/> + <artifact xmi:idref="Receiver_ExecArtifact" /> + <artifact xmi:idref="Receiver_SvntArtifact" /> + <execParameter> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_WL_ResetTopic_Receiver_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_WL_ResetTopic_Receiver_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Receiver_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Receiver_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="ResetTopic_EventConnectorImplementation"> + <name>ResetTopic_EventConnectorImplementation</name> + <source/> + <artifact xmi:idref="ResetTopic_Connector_ExecArtifact" /> + <artifact xmi:idref="ResetTopic_Connector_SvntArtifact" /> + <execParameter> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_WL_ResetTopic_WL_ResetTopicTestConnector_DDS_Event_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_WL_ResetTopic_WL_ResetTopicTestConnector_DDS_Event_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>WL_ResetTopic_Connector_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>WL_ResetTopic_Connector_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SenderComponentImplementation"> + <name>SenderComponentImplementation</name> + <source/> + <artifact xmi:idref="Sender_ExecArtifact" /> + <artifact xmi:idref="Sender_SvntArtifact" /> + <execParameter> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_WL_ResetTopic_Sender_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_WL_ResetTopic_Sender_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Sender_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Sender_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <instance xmi:id="ReceiverComponentInstance"> + <name>ReceiverComponent</name> + <node>ReceiverNode</node> + <source/> + <implementation xmi:idref="ReceiverComponentImplementation" /> + <configProperty> + <name>iterations</name> + <value> + <type> + <kind>tk_ushort</kind> + </type> + <value> + <ushort>10</ushort> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Receiver.ior</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="ResetTopic_SenderEventConnectorInstance"> + <name>ResetTopic_SenderEventConnectorInstance</name> + <node>SenderNode</node> + <source/> + <implementation xmi:idref="ResetTopic_EventConnectorImplementation" /> + <configProperty> + <name>topic_name</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>TopicI</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="ResetTopic_ReceiverEventConnectorInstance"> + <name>ResetTopic_ReceiverEventConnectorInstance</name> + <node>ReceiverNode</node> + <source/> + <implementation xmi:idref="ResetTopic_EventConnectorImplementation" /> + <configProperty> + <name>topic_name</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>TopicI</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="SenderComponentInstance"> + <name>SenderComponent</name> + <node>SenderNode</node> + <source/> + <implementation xmi:idref="SenderComponentImplementation" /> + <configProperty> + <name>rate</name> + <value> + <type> + <kind>tk_ushort</kind> + </type> + <value> + <ushort>15</ushort> + </value> + </value> + </configProperty> + <configProperty> + <name>keys</name> + <value> + <type> + <kind>tk_ushort</kind> + </type> + <value> + <ushort>5</ushort> + </value> + </value> + </configProperty> + <configProperty> + <name>iterations</name> + <value> + <type> + <kind>tk_ushort</kind> + </type> + <value> + <ushort>10</ushort> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Sender.ior</string> + </value> + </value> + </configProperty> + </instance> + + <connection> + <name>event_listener</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>info_out_event_data_listener</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="ReceiverComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>push_consumer_data_listener</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="ResetTopic_ReceiverEventConnectorInstance" /> + </internalEndpoint> + </connection> + + <connection> + <name>event_reader_listener</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>info_out_event_data</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="ReceiverComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>push_consumer_data</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="ResetTopic_ReceiverEventConnectorInstance" /> + </internalEndpoint> + </connection> + + <connection> + <name>event_datacontrol</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>info_out_event_data_control</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="ReceiverComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>push_consumer_data_control</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="ResetTopic_ReceiverEventConnectorInstance" /> + </internalEndpoint> + </connection> + + <connection> + <name>writer_connection</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>info_write_data</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="SenderComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>supplier_data</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="ResetTopic_SenderEventConnectorInstance" /> + </internalEndpoint> + </connection> + + <artifact xmi:id="Sender_ExecArtifact"> + <name>Sender_exec</name> + <source/> + <node/> + <location>Sender_exec</location> + </artifact> + <artifact xmi:id="Sender_SvntArtifact"> + <name>Sender_svnt</name> + <source/> + <node/> + <location>Sender_svnt</location> + </artifact> + <artifact xmi:id="Sender_StubArtifact"> + <name>Sender_stub</name> + <source/> + <node/> + <location>Sender_stub</location> + </artifact> + <artifact xmi:id="ResetTopic_Connector_ExecArtifact"> + <name>WL_ResetTopic_Connector_exec</name> + <source/> + <node/> + <location>WL_ResetTopicConnector_exec</location> + </artifact> + <artifact xmi:id="ResetTopic_Connector_SvntArtifact"> + <name>WL_ResetTopic_Connector_svnt</name> + <source/> + <node/> + <location>WL_ResetTopicConnector_svnt</location> + </artifact> + <artifact xmi:id="Receiver_ExecArtifact"> + <name>Receiver_exec</name> + <source/> + <node/> + <location>Receiver_exec</location> + </artifact> + <artifact xmi:id="Receiver_SvntArtifact"> + <name>Receiver_svnt</name> + <source/> + <node/> + <location>Receiver_svnt</location> + </artifact> + <artifact xmi:id="Receiver_StubArtifact"> + <name>Receiver_stub</name> + <source/> + <node/> + <location>Receiver_stub</location> + </artifact> +</Deployment:DeploymentPlan> diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/descriptors/run_test.pl b/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/descriptors/run_test.pl new file mode 100755 index 00000000000..0d55bfd5fdc --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/WriteListen/descriptors/run_test.pl @@ -0,0 +1,281 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{'ACE_ROOT'}/bin"; +use PerlACE::TestTarget; + +$CIAO_ROOT = "$ENV{'CIAO_ROOT'}"; +$TAO_ROOT = "$ENV{'TAO_ROOT'}"; +$DANCE_ROOT = "$ENV{'DANCE_ROOT'}"; + +$daemons_running = 0; +$em_running = 0; +$ns_running = 0; + +$nr_daemon = 2; +@ports = ( 60001, 60002 ); +@iorbases = ( "ReceiverNode.ior", "SenderNode.ior" ); +@iorfiles = 0; +@nodenames = ( "ReceiverNode", "SenderNode" ); + +# ior files other than daemon +$ior_nsbase = "ns.ior"; +$ior_nsfile = 0; +$ior_embase = "EM.ior"; +$ior_emfile = 0; + +# Processes +$E = 0; +$EM = 0; +$NS = 0; +@DEAMONS = 0; + +# targets +@tg_daemons = 0; +$tg_naming = 0; +$tg_exe_man = 0; +$tg_executor = 0; + +$status = 0; +$cdp_file = "Plan.cdp"; + +sub create_targets { + # naming service + $tg_naming = PerlACE::TestTarget::create_target (1) || die "Create target for ns failed\n"; + $tg_naming->AddLibPath ('../lib'); + # daemon + for ($i = 0; $i < $nr_daemon; ++$i) { + $tg_daemons[$i] = PerlACE::TestTarget::create_target ($i+1) || die "Create target for daemon $i failed\n"; + $tg_daemons[$i]->AddLibPath ('../lib'); + } + # execution manager + $tg_exe_man = PerlACE::TestTarget::create_target (1) || die "Create target for EM failed\n"; + $tg_exe_man->AddLibPath ('../lib'); + # executor (plan_launcher) + $tg_executor = PerlACE::TestTarget::create_target (1) || die "Create target for executor failed\n"; + $tg_executor->AddLibPath ('../lib'); +} + +sub init_ior_files { + $ior_nsfile = $tg_naming->LocalFile ($ior_nsbase); + $ior_emfile = $tg_exe_man->LocalFile ($ior_embase); + for ($i = 0; $i < $nr_daemon; ++$i) { + $iorfiles[$i] = $tg_daemons[$i]->LocalFile ($iorbases[$i]); + } + delete_ior_files (); +} + +# Delete if there are any .ior files. +sub delete_ior_files { + for ($i = 0; $i < $nr_daemon; ++$i) { + $tg_daemons[$i]->DeleteFile ($iorbases[$i]); + } + $tg_naming->DeleteFile ($ior_nsbase); + $tg_exe_man->DeleteFile ($ior_embase); + for ($i = 0; $i < $nr_daemon; ++$i) { + $iorfiles[$i] = $tg_daemons[$i]->LocalFile ($iorbases[$i]); + } +} + +sub kill_node_daemon { + for ($i = 0; $i < $nr_daemon; ++$i) { + $DEAMONS[$i]->Kill (); $DEAMONS[$i]->TimedWait (1); + } +} + +sub kill_open_processes { + if ($daemons_running == 1) { + kill_node_daemon (); + } + + if ($em_running == 1) { + $EM->Kill (); $EM->TimedWait (1); + } + + if ($ns_running == 1) { + $NS->Kill (); $NS->TimedWait (1); + } + # in case shutdown did not perform as expected + $tg_executor->KillAll ('dance_locality_manager'); +} + +sub run_node_daemons { + for ($i = 0; $i < $nr_daemon; ++$i) { + $iorbase = $iorbases[$i]; + $iorfile = $iorfiles[$i]; + $port = $ports[$i]; + $nodename = $nodenames[$i]; + $iiop = "iiop://localhost:$port"; + $node_app = $tg_daemons[$i]->GetArchDir("$DANCE_ROOT/bin/") . "dance_locality_manager"; + + $d_cmd = "$DANCE_ROOT/bin/dance_node_manager"; + $d_param = "-ORBEndpoint $iiop -s $node_app -n $nodename=$iorfile -t 30 --domain-nc corbaloc:rir:/NameService"; + + print "Run dance_node_manager with $d_param\n"; + + $DEAMONS[$i] = $tg_daemons[$i]->CreateProcess ($d_cmd, $d_param); + $DEAMONS[$i]->Spawn (); + + if ($tg_daemons[$i]->WaitForFileTimed($iorbase, + $tg_daemons[$i]->ProcessStartWaitInterval ()) == -1) { + print STDERR + "ERROR: The ior $iorfile file of node daemon $i could not be found\n"; + for (; $i >= 0; --$i) { + $DEAMONS[$i]->Kill (); $DEAMONS[$i]->TimedWait (1); + } + return -1; + } + } + return 0; +} + +create_targets (); +init_ior_files (); + +# Invoke naming service + +$NS = $tg_naming->CreateProcess ("$TAO_ROOT/orbsvcs/Naming_Service/tao_cosnaming", " -ORBEndpoint iiop://localhost:60003 -o $ior_nsfile"); + +$ns_status = $NS->Spawn (); + +if ($ns_status != 0) { + print STDERR "ERROR: Unable to execute the naming service\n"; + kill_open_processes (); + exit 1; +} + +print STDERR "Starting Naming Service with -ORBEndpoint iiop://localhost:60003 -o ns.ior\n"; + +if ($tg_naming->WaitForFileTimed ($ior_nsbase, + $tg_naming->ProcessStartWaitInterval ()) == -1) { + print STDERR "ERROR: cannot find naming service IOR file\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} + +$ns_running = 1; +# Set up NamingService environment +$ENV{"NameServiceIOR"} = "corbaloc:iiop:localhost:60003/NameService"; + +# Invoke node daemon. +print "Invoking node daemon\n"; +$status = run_node_daemons (); + +if ($status != 0) { + print STDERR "ERROR: Unable to execute the node daemon\n"; + kill_open_processes (); + exit 1; +} + +$daemons_running = 1; + +# Invoke execution manager. +print "Invoking execution manager (dance_execution_manager.exe) with -e$ior_emfile\n"; +$EM = $tg_exe_man->CreateProcess ("$DANCE_ROOT/bin/dance_execution_manager", + "-e$ior_emfile --domain-nc corbaloc:rir:/NameService"); +$em_status = $EM->Spawn (); + +if ($em_status != 0) { + print STDERR "ERROR: dance_execution_manager returned $em_status"; + exit 1; +} + +if ($tg_exe_man->WaitForFileTimed ($ior_embase, + $tg_exe_man->ProcessStartWaitInterval ()) == -1) { + print STDERR + "ERROR: The ior file of execution manager could not be found\n"; + kill_open_processes (); + exit 1; +} + +$em_running = 1; + +# Invoke executor - start the application -. +print "Invoking executor - launch the application -\n"; + +print "Start dance_plan_launcher.exe with -x $cdp_file -k file://$ior_emfile\n"; +$E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-x $cdp_file -k file://$ior_emfile"); +$pl_status = $E->SpawnWaitKill (2 * $tg_executor->ProcessStartWaitInterval ()); + +if ($pl_status != 0) { + print STDERR "ERROR: dance_plan_launcher returned $pl_status\n"; + kill_open_processes (); + exit 1; +} + +for ($i = 0; $i < $nr_daemon; ++$i) { + if ($tg_daemons[$i]->WaitForFileTimed ($iorbases[$i], + $tg_daemons[$i]->ProcessStopWaitInterval ()) == -1) { + print STDERR "ERROR: The ior file of daemon $i could not be found\n"; + kill_open_processes (); + exit 1; + } +} + +print "Sleeping 10 seconds before changing topic name\n"; +sleep (10); + +$R = $tg_executor->CreateProcess ("../lib/ReceiverDriver", "-n TopicII"); +$driver_status = $R->SpawnWaitKill (2 * $tg_executor->ProcessStartWaitInterval ()); +if ($driver_status != 0) { + print STDERR "ERROR: unable to launch driver\n"; + kill_open_processes (); + exit 1; +} + +$S = $tg_executor->CreateProcess ("../lib/SenderDriver", "-n TopicII"); +$driver_status = $S->SpawnWaitKill (2 * $tg_executor->ProcessStartWaitInterval ()); +if ($driver_status != 0) { + print STDERR "ERROR: unable to launch driver\n"; + kill_open_processes (); + exit 1; +} + +print "Sleeping 10 seconds before changing topic name\n"; +sleep (10); + +$R = $tg_executor->CreateProcess ("../lib/ReceiverDriver", "-n TopicIII"); +$driver_status = $R->SpawnWaitKill (2 * $tg_executor->ProcessStartWaitInterval ()); +if ($driver_status != 0) { + print STDERR "ERROR: unable to launch driver\n"; + kill_open_processes (); + exit 1; +} + +$S = $tg_executor->CreateProcess ("../lib/SenderDriver", "-n TopicIII"); +$driver_status = $S->SpawnWaitKill (2 * $tg_executor->ProcessStartWaitInterval ()); +if ($driver_status != 0) { + print STDERR "ERROR: unable to launch driver\n"; + kill_open_processes (); + exit 1; +} + +print "Sleeping 10 seconds before stopping\n"; +sleep (10); + +# Invoke executor - stop the application -. +print "Invoking executor - stop the application -\n"; +print "by running dance_plan_launcher.exe with -k file://$ior_emfile -x $cdp_file\n"; + +$E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-k file://$ior_emfile -x $cdp_file -s"); +$pl_status = $E->SpawnWaitKill ($tg_executor->ProcessStartWaitInterval ()); + +if ($pl_status != 0) { + print STDERR "ERROR: dance_plan_launcher returned $pl_status\n"; + kill_open_processes (); + exit 1; +} + +print "Executor returned.\n"; +print "Shutting down rest of the processes.\n"; + +delete_ior_files (); +kill_open_processes (); + +exit $status; diff --git a/CIAO/tests/Collocation/Coll_Base/Base.idl b/CIAO/tests/Collocation/Coll_Base/Base.idl new file mode 100644 index 00000000000..8633db8c001 --- /dev/null +++ b/CIAO/tests/Collocation/Coll_Base/Base.idl @@ -0,0 +1,20 @@ +// $Id$ +#ifndef BASE_IDL_ +#define BASE_IDL_ + +#pragma ciao lem "Coll_Base/BaseE.idl" + +struct pointer_id + { + long point; + string txt; + }; + +// Interfaces for communication between Sender and Receiver +interface Hello { + //string say_hello (); + void set_point(in pointer_id p); + }; + + +#endif /* BASE_IDL_ */ diff --git a/CIAO/tests/Collocation/Coll_Base/Base.mpc b/CIAO/tests/Collocation/Coll_Base/Base.mpc new file mode 100644 index 00000000000..8c2f2d3b3a6 --- /dev/null +++ b/CIAO/tests/Collocation/Coll_Base/Base.mpc @@ -0,0 +1,110 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -n -e -I .. -l ../lib -o ../lib Base" + +project(CollBase_idl_gen) : componentidldefaults, avoids_ccm_noevent { + custom_only = 1 + + idlflags += -Wb,stub_export_macro=BASE_STUB_Export \ + -Wb,stub_export_include=CollBase_stub_export.h \ + -Wb,skel_export_macro=BASE_SKEL_Export \ + -Wb,skel_export_include=CollBase_skel_export.h \ + -Gxhex -Gxhsk -Gxhst -Gex -Gd -I .. + + IDL_Files { + Base.idl + } +} + +project(CollBase_lem_gen) : ciaoidldefaults, avoids_ccm_noevent { + after += CollBase_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=BASE_LEM_STUB_Export \ + -Wb,stub_export_include=CollBase_lem_stub_export.h \ + -SS -Gxhst -I .. + + IDL_Files { + BaseE.idl + } +} + +project(CollBase_lem_stub) : ccm_svnt, avoids_ccm_noevent { + after += CollBase_lem_gen CollBase_stub + libs += CollBase_stub + includes += .. + libpaths += ../lib + libout = ../lib + sharedname = CollBase_lem_stub + dynamicflags += BASE_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + BaseEC.cpp + } + + Header_Files { + BaseEC.h + CollBase_lem_stub_export.h + } + + Inline_Files { + BaseEC.inl + } +} + +project(CollBase_stub) : ccm_stub, avoids_ccm_noevent { + after += CollBase_idl_gen + libs += + includes += .. + libpaths += ../lib + libout = ../lib + sharedname = CollBase_stub + dynamicflags += BASE_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + BaseC.cpp + } + + Header_Files { + BaseC.h + CollBase_stub_export.h + } + + Inline_Files { + BaseC.inl + } +} + + +project(CollBase_skel) : ciao_executor, avoids_ccm_noevent { + after += CollBase_stub CollBase_lem_stub + sharedname = CollBase_skel + libs += CollBase_stub + + includes += .. + libpaths += ../lib + libout = ../lib + dynamicflags += BASE_SKEL_BUILD_DLL + + IDL_Files { + } + + Source_Files { + BaseS.cpp + } + + Header_Files { + BaseS.h + CollBase_skel_export.h + } + + Inline_Files { + BaseS.inl + } +} + + diff --git a/CIAO/tests/Collocation/Receiver/Receiver.idl b/CIAO/tests/Collocation/Receiver/Receiver.idl new file mode 100644 index 00000000000..2b673b3011e --- /dev/null +++ b/CIAO/tests/Collocation/Receiver/Receiver.idl @@ -0,0 +1,19 @@ +// $Id$ + +#ifndef RECEIVER_IDL_ +#define RECEIVER_IDL_ + +#include <Components.idl> + +#include "Coll_Base/Base.idl" + +component Receiver { + // Which interfaces the Receiver provides. + //provides Bye bye_from_rec; + + // Which interfaces Receiver uses. + uses Hello hello_to_rec; + +}; + +#endif /* RECEIVER_IDL_ */ diff --git a/CIAO/tests/Collocation/Receiver/Receiver.mpc b/CIAO/tests/Collocation/Receiver/Receiver.mpc new file mode 100644 index 00000000000..369df637b11 --- /dev/null +++ b/CIAO/tests/Collocation/Receiver/Receiver.mpc @@ -0,0 +1,139 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p Base -c IDL2Client -e -I .. -l ../lib -o ../lib Receiver" + +project(CollBase_Receiver_idl_gen) : componentidldefaults, avoids_ccm_noevent { + custom_only = 1 + + idlflags += -Wb,stub_export_macro=RECEIVER_STUB_Export \ + -Wb,stub_export_include=Receiver_stub_export.h \ + -Wb,skel_export_macro=RECEIVER_SVNT_Export \ + -Wb,skel_export_include=Receiver_svnt_export.h \ + -Wb,exec_export_macro=RECEIVER_EXEC_Export \ + -Wb,exec_export_include=Receiver_exec_export.h \ + -Gxhex -Gxhsk -Gxhst -I .. + + IDL_Files { + Receiver.idl + } +} + +project(CollBase_Receiver_lem_gen) : ciaoidldefaults, avoids_ccm_noevent { + after += CollBase_Receiver_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=RECEIVER_LEM_STUB_Export \ + -Wb,stub_export_include=Receiver_lem_stub_export.h \ + -SS -Gxhst -I .. + + IDL_Files { + ReceiverE.idl + } +} + +project(CollBase_Receiver_lem_stub) : ccm_svnt, avoids_ccm_noevent { + after += CollBase_Receiver_lem_gen CollBase_Receiver_stub CollBase_stub CollBase_lem_stub + libs += CollBase_stub CollBase_lem_stub Receiver_stub + includes += .. + libpaths += ../lib + libout = ../lib + sharedname = Receiver_lem_stub + dynamicflags += RECEIVER_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + ReceiverEC.cpp + } + + Header_Files { + ReceiverEC.h + Receiver_lem_stub_export.h + } + + Inline_Files { + ReceiverEC.inl + } +} + +project(CollBase_Receiver_stub) : ccm_stub, avoids_ccm_noevent { + after += CollBase_Receiver_idl_gen CollBase_stub CollBase_lem_stub + libs += CollBase_stub CollBase_lem_stub + includes += .. + libpaths += ../lib + libout = ../lib + sharedname = Receiver_stub + dynamicflags += RECEIVER_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + ReceiverC.cpp + } + + Header_Files { + ReceiverC.h + Receiver_stub_export.h + } + + Inline_Files { + ReceiverC.inl + } +} + +project(CollBase_Receiver_exec) : ciao_executor, avoids_ccm_noevent { + after += CollBase_lem_stub CollBase_Receiver_lem_stub CollBase_Receiver_stub + sharedname = Receiver_exec + libs += CollBase_lem_stub Receiver_stub Receiver_lem_stub CollBase_stub CollBase_lem_stub + includes += .. + libpaths += ../lib + libout = ../lib + dynamicflags += RECEIVER_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Receiver_exec.cpp + } + + Header_Files { + Receiver_exec.h + Receiver_exec_export.h + } + + Inline_Files { + } +} + + +project(CollBase_Receiver_svnt) : ciao_servant, avoids_ccm_noevent { + after += CollBase_skel CollBase_lem_stub CollBase_Receiver_lem_stub + sharedname = Receiver_svnt + libs += Receiver_stub Receiver_lem_stub \ + CollBase_skel \ + CollBase_stub \ + CollBase_lem_stub + includes += .. + libpaths += ../lib + libout = ../lib + dynamicflags += RECEIVER_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + ReceiverS.cpp + Receiver_svnt.cpp + } + + Header_Files { + ReceiverS.h + Receiver_svnt.h + Receiver_svnt_export.h + } + + Inline_Files { + ReceiverS.inl + } +} diff --git a/CIAO/tests/Collocation/Receiver/Receiver_exec.cpp b/CIAO/tests/Collocation/Receiver/Receiver_exec.cpp new file mode 100644 index 00000000000..34e98f1c14f --- /dev/null +++ b/CIAO/tests/Collocation/Receiver/Receiver_exec.cpp @@ -0,0 +1,211 @@ +// -*- C++ -*- +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v2.0.2 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ + +#include "Receiver_exec.h" +#include "tao/ORB_Core.h" +#include "ace/Reactor.h" + +namespace CIAO_Receiver_Impl +{ + + /** + * HelloGenerator + */ + + HelloGenerator::HelloGenerator (Receiver_exec_i &generator) + : generator_ (generator) + { + } + + int + HelloGenerator::handle_timeout (const ACE_Time_Value &, const void *) + { + // Notify the subscribers + this->generator_.tick (); + return 0; + } + + /** + * Component Executor Implementation Class: Receiver_exec_i + */ + + Receiver_exec_i::Receiver_exec_i (void) + : interval_ (2, 1) + { + ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::Receiver_exec_i \n ")); + ACE_NEW_THROW_EX (this->hello_generator_, + HelloGenerator (*this), + ::CORBA::NO_MEMORY ()); + } + + Receiver_exec_i::~Receiver_exec_i (void) + { + } + + // Supported operations and attributes. + ACE_Reactor* + Receiver_exec_i::reactor (void) + { + ACE_Reactor* reactor = 0; + ::CORBA::Object_var ccm_object = + this->ciao_context_->get_CCM_object(); + if (! ::CORBA::is_nil (ccm_object.in ())) + { + ::CORBA::ORB_var orb = ccm_object->_get_orb (); + if (! ::CORBA::is_nil (orb.in ())) + { + reactor = orb->orb_core ()->reactor (); + } + } + if (reactor == 0) + { + throw ::CORBA::INTERNAL (); + } + return reactor; + } + + void + Receiver_exec_i::tick (void) + { + ACE_DEBUG ((LM_DEBUG, "$$$$$$$$$$$$$$ Start interface method in Receiver_exec_i::tick - " + "set point for sender.\n")); + try + { + /// Retrieve the connection to the sender. + Hello_var hello_to_rec = + this->ciao_context_->get_connection_hello_to_rec (); + if (! ::CORBA::is_nil (hello_to_rec.in ())) + { + /* CORBA::String_var message = hello_to_rec->say_hello (); + ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::tick - " + "got hello-message from sender <%C>.\n", + message.in())); +*/ pointer_id::_var_type p = new pointer_id; + p->point = (long)p.ptr (); + hello_to_rec->set_point(p.in()); + + ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::tick - " + "set_hello-point with pointer %@\n", + (void *)p.ptr ())); + + } + else + { + ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::tick - " + "no connection hello_to_rec with sender.\n")); + } + } + catch (const CORBA::Exception &e) + { + /// Always catch CORBA exceptions. There might be somthing wrong with + /// the CIAO framework (i.e. connection lost). + e._tao_print_exception("Receiverr_exec_i::tick - " + "Error: Unexpected exception"); + } + catch (...) + { + /// Just for all security + ACE_ERROR ((LM_ERROR, "Receiver_exec_i::tick - " + "Error: Unexpected and unknown exception caught\n")); + } + ACE_DEBUG ((LM_DEBUG, "$$$$$$$$$$$$$$ End interface method in Receiver_exec_i::tick - " + "set point for sender.\n")); + + } + // Component attributes and port operations. + + // Operations from Components::SessionComponent. + + void + Receiver_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + this->ciao_context_ = + ::CCM_Receiver_Context::_narrow (ctx); + + if ( ::CORBA::is_nil (this->ciao_context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + Receiver_exec_i::configuration_complete (void) + { + ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::configuration_complete \n ")); + /// No need to implement anything + } + + void + Receiver_exec_i::ccm_activate (void) + { + ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::ccm_activate \n ")); + /// No need to implement anything + /// Start the timer . + if (this->reactor ()->schedule_timer( + this->hello_generator_, // The callback object + 0, // No arguments for this callback + ACE_Time_Value (1, 0), // Initial delay + this->interval_) == -1) // Time interval + { + ACE_ERROR ((LM_ERROR, "Receiver_exec_i::ccm_activate - " + "Error scheduling timer\n")); + } + else + { + ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::ccm_activate - " + "Hello generator is running\n")); + } + } + + void + Receiver_exec_i::ccm_passivate (void) + { + /// No need to implement anything + ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::ccm_passivate \n ")); + } + + void + Receiver_exec_i::ccm_remove (void) + { + /// No need to implement anything + ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::ccm_remove \n ")); + } + + extern "C" RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_Receiver_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_NORETURN ( + retval, + Receiver_exec_i); + + return retval; + } +} diff --git a/CIAO/tests/Collocation/Receiver/Receiver_exec.h b/CIAO/tests/Collocation/Receiver/Receiver_exec.h new file mode 100644 index 00000000000..786a468d924 --- /dev/null +++ b/CIAO/tests/Collocation/Receiver/Receiver_exec.h @@ -0,0 +1,98 @@ +// -*- C++ -*- +// $Id$ + +#ifndef CIAO_RECEIVER_EXEC_0HSO8P_H_ +#define CIAO_RECEIVER_EXEC_0HSO8P_H_ + +#include /**/ "ace/pre.h" + +#include "ReceiverEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ "Receiver_exec_export.h" +#include "tao/LocalObject.h" +#include "tao/ORB_Core.h" +#include "ace/Reactor.h" + +namespace CIAO_Receiver_Impl +{ + // Forward declaration + class Receiver_exec_i; + + /** + * HelloGenerator + */ + class HelloGenerator : + public ACE_Event_Handler + { + public: + HelloGenerator (Receiver_exec_i &callback); + + //Callback from the reactor. + virtual int handle_timeout (const ACE_Time_Value &tv, + const void *arg); + private: + Receiver_exec_i &generator_; + }; + + /** + * Component Executor Implementation Class: Receiver_exec_i + */ + + class Receiver_exec_i + : public virtual Receiver_Exec, + public virtual ::CORBA::LocalObject + { + public: + Receiver_exec_i (void); + virtual ~Receiver_exec_i (void); + + /** @name Supported operations and attributes. */ + //@{ + //@} + + /** @name Component attributes and port operations. */ + //@{ + //@} + + /** @name Operations from Components::SessionComponent. */ + //@{ + virtual void set_session_context (::Components::SessionContext_ptr ctx); + virtual void configuration_complete (void); + virtual void ccm_activate (void); + virtual void ccm_passivate (void); + virtual void ccm_remove (void); + //@} + + /** @name User defined public operations. */ + //@{ + void tick (void); + //@} + + private: + ::CCM_Receiver_Context_var ciao_context_; + + /** @name Component attributes. */ + + /** @name User defined members. */ + //@{ + //@} + + /** @name User defined private operations. */ + //@{ + HelloGenerator * hello_generator_; + ACE_Time_Value interval_; + ACE_Reactor* reactor (void); + //@} + }; + + extern "C" RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_Receiver_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* ifndef */ diff --git a/CIAO/tests/Collocation/Sender/Sender.idl b/CIAO/tests/Collocation/Sender/Sender.idl new file mode 100644 index 00000000000..257a71c1079 --- /dev/null +++ b/CIAO/tests/Collocation/Sender/Sender.idl @@ -0,0 +1,16 @@ +// $Id$ +#ifndef SENDER_IDL_ +#define SENDER_IDL_ + +#include <Components.idl> + +#include "Coll_Base/Base.idl" + +component Sender { + provides Hello hello; + + // Which interfaces the Sender uses. + //uses Bye bye; +}; + +#endif /* SENDER_IDL_ */ diff --git a/CIAO/tests/Collocation/Sender/Sender.mpc b/CIAO/tests/Collocation/Sender/Sender.mpc new file mode 100644 index 00000000000..1b7d3460a18 --- /dev/null +++ b/CIAO/tests/Collocation/Sender/Sender.mpc @@ -0,0 +1,141 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p Base -e -I .. -l ../lib -o ../lib Sender" + +project(CollBase_Sender_idl_gen) : componentidldefaults, avoids_ccm_noevent { + custom_only = 1 + + idlflags += -Wb,stub_export_macro=SENDER_STUB_Export \ + -Wb,stub_export_include=Sender_stub_export.h \ + -Wb,skel_export_macro=SENDER_SVNT_Export \ + -Wb,skel_export_include=Sender_svnt_export.h \ + -Wb,exec_export_macro=SENDER_EXEC_Export \ + -Wb,exec_export_include=Sender_exec_export.h \ + -Gxhex -Gxhsk -Gxhst -I .. + + IDL_Files { + Sender.idl + } +} + +project(CollBase_Sender_lem_gen) : ciaoidldefaults, avoids_ccm_noevent { + after += CollBase_Sender_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=SENDER_LEM_STUB_Export \ + -Wb,stub_export_include=Sender_lem_stub_export.h \ + -SS -Gxhst -I .. + + IDL_Files { + SenderE.idl + } +} + +project(CollBase_Sender_lem_stub) : ccm_svnt, avoids_ccm_noevent { + after += CollBase_Sender_lem_gen CollBase_Sender_stub CollBase_stub CollBase_lem_stub + libs += CollBase_stub CollBase_lem_stub Sender_stub + includes += .. + libpaths += ../lib + libout = ../lib + sharedname = Sender_lem_stub + dynamicflags += SENDER_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SenderEC.cpp + } + + Header_Files { + SenderEC.h + Sender_lem_stub_export.h + } + + Inline_Files { + SenderEC.inl + } +} + +project(CollBase_Sender_stub) : ccm_stub, avoids_ccm_noevent { + after += CollBase_Sender_idl_gen CollBase_stub CollBase_lem_stub + libs += CollBase_stub CollBase_lem_stub + includes += .. + libpaths += ../lib + libout = ../lib + sharedname = Sender_stub + dynamicflags += SENDER_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SenderC.cpp + } + + Header_Files { + SenderC.h + Sender_stub_export.h + } + + Inline_Files { + SenderC.inl + } +} + +project(CollBase_Sender_exec) : ciao_executor, avoids_ccm_noevent { + after += CollBase_lem_stub CollBase_Sender_lem_stub CollBase_Sender_stub + sharedname = Sender_exec + libs += CollBase_lem_stub Sender_stub Sender_lem_stub CollBase_stub CollBase_lem_stub + includes += .. + libpaths += ../lib + libout = ../lib + dynamicflags += SENDER_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Sender_exec.cpp + } + + Header_Files { + Sender_exec.h + Sender_exec_export.h + } + + Inline_Files { + } +} + + +project(CollBase_Sender_svnt) : ciao_servant, avoids_ccm_noevent { + after += CollBase_skel CollBase_lem_stub CollBase_Sender_lem_stub + sharedname = Sender_svnt + libs += Sender_stub Sender_lem_stub \ + CollBase_skel \ + CollBase_stub \ + CollBase_lem_stub + includes += .. + libpaths += ../lib + libout = ../lib + dynamicflags += SENDER_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SenderS.cpp + Sender_svnt.cpp + } + + Header_Files { + SenderS.h + Sender_svnt.h + Sender_svnt_export.h + } + + Inline_Files { + SenderS.inl + } +} + + diff --git a/CIAO/tests/Collocation/Sender/Sender_exec.cpp b/CIAO/tests/Collocation/Sender/Sender_exec.cpp new file mode 100644 index 00000000000..eec14635c32 --- /dev/null +++ b/CIAO/tests/Collocation/Sender/Sender_exec.cpp @@ -0,0 +1,139 @@ +// -*- C++ -*- +// $Id$ + +#include "Sender_exec.h" + +namespace CIAO_Sender_Impl +{ + /** + * Facet Executor Implementation Class: hello_exec_i + */ + hello_exec_i::hello_exec_i (::CCM_Sender_Context_ptr ctx) + : ciao_context_ (::CCM_Sender_Context::_duplicate (ctx)) + { + } + + hello_exec_i::~hello_exec_i (void) + { + } + + // Operations from ::Hello +/* char * + hello_exec_i::say_hello (void) + { + ACE_DEBUG ((LM_DEBUG, "SENDER: hello_exec_i::say_hello .\n")); + return CORBA::string_dup ("Hello from sender."); + } +*/ + void + hello_exec_i::set_point (const pointer_id &p) + { + ACE_DEBUG ((LM_DEBUG, "SENDER: hello_exec_i::set_point pointer <%@>\n", (void *)&p)); + CORBA::Long ptr_nmb = (long)&p; + if (ptr_nmb == p.point) + { + ACE_DEBUG ((LM_DEBUG, "hello_exec_i::set_point - " + "current pointer <%u> is same as starting pointer <%u>," + "direct or thru_poa collocation ! \n", + ptr_nmb, p.point)); + } + else + { + ACE_ERROR ((LM_DEBUG, "Error: hello_exec_i::set_point - " + "current pointer <%u> is not the same as starting pointer <%u>" + ", No Collocation\n", + ptr_nmb, p.point)); + } + //return p._retn (); + } + + /** + * Component Executor Implementation Class: Sender_exec_i + */ + Sender_exec_i::Sender_exec_i (void) + { + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::Sender_exec_i \n ")); + } + + Sender_exec_i::~Sender_exec_i (void) + { + } + + + // Component attributes and port operations. + ::CCM_Hello_ptr + Sender_exec_i::get_hello (void) + { + if ( ::CORBA::is_nil (this->ciao_hello_.in ())) + { + hello_exec_i *tmp = 0; + ACE_NEW_RETURN ( + tmp, + hello_exec_i ( + this->ciao_context_.in ()), + ::CCM_Hello::_nil ()); + + this->ciao_hello_ = tmp; + } + + return + ::CCM_Hello::_duplicate ( + this->ciao_hello_.in ()); + } + + // Operations from Components::SessionComponent. + void + Sender_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::set_session_context \n ")); + + this->ciao_context_ = + ::CCM_Sender_Context::_narrow (ctx); + + if ( ::CORBA::is_nil (this->ciao_context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + Sender_exec_i::configuration_complete (void) + { + /* Your code here. */ + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::configuration_complete \n ")); + + } + + void + Sender_exec_i::ccm_activate (void) + { + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::ccm_activate \n ")); + /// Start the timer . + } + + void + Sender_exec_i::ccm_passivate (void) + { + } + + void + Sender_exec_i::ccm_remove (void) + { + /* Your code here. */ + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::ccm_remove \n ")); + } + + extern "C" SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_Sender_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_NORETURN ( + retval, + Sender_exec_i); + + return retval; + } +} diff --git a/CIAO/tests/Collocation/Sender/Sender_exec.h b/CIAO/tests/Collocation/Sender/Sender_exec.h new file mode 100644 index 00000000000..33d6d868036 --- /dev/null +++ b/CIAO/tests/Collocation/Sender/Sender_exec.h @@ -0,0 +1,136 @@ +// -*- C++ -*- +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v2.0.2 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ +#ifndef CIAO_SENDER_EXEC_SV8KRD_H_ +#define CIAO_SENDER_EXEC_SV8KRD_H_ + +#include /**/ "ace/pre.h" + +#include "SenderEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ "Sender_exec_export.h" +#include "tao/LocalObject.h" +#include "tao/ORB_Core.h" +#include "ace/Reactor.h" + + +#include <map> + +namespace CIAO_Sender_Impl +{ + //Forward declaration + class Sender_exec_i; + + /** + * Provider Executor Implementation Class: hello_exec_i + */ + + class hello_exec_i + : public virtual ::CCM_Hello, + public virtual ::CORBA::LocalObject + { + public: + hello_exec_i (::CCM_Sender_Context_ptr ctx); + virtual ~hello_exec_i (void); + + /** @name Operations and attributes from Hello */ + //@{ + +// virtual + // char * say_hello (void); + virtual + void set_point (const pointer_id & ); + + //@} + + private: + ::CCM_Sender_Context_var ciao_context_; + }; + + /** + * Component Executor Implementation Class: Sender_exec_i + */ + + class Sender_exec_i + : public virtual Sender_Exec, + public virtual ::CORBA::LocalObject + { + public: + Sender_exec_i (void); + virtual ~Sender_exec_i (void); + + /** @name Supported operations and attributes. */ + //@{ + + //@} + + /** @name Component attributes and port operations. */ + //@{ + + virtual ::CCM_Hello_ptr + get_hello (void); + + //@} + + /** @name Operations from Components::SessionComponent. */ + //@{ + virtual void set_session_context (::Components::SessionContext_ptr ctx); + virtual void configuration_complete (void); + virtual void ccm_activate (void); + virtual void ccm_passivate (void); + virtual void ccm_remove (void); + //@} + + /** @name User defined public operations. */ + //@{ + //@} + + private: + ::CCM_Sender_Context_var ciao_context_; + + /** @name Component attributes. */ + //@{ + ::CCM_Hello_var ciao_hello_; + + //@} + + /** @name User defined members. */ + //@{ + + //@} + }; + + extern "C" SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_Sender_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* ifndef */ diff --git a/CIAO/tests/Collocation/descriptors/PlanAllOnOne.cdp b/CIAO/tests/Collocation/descriptors/PlanAllOnOne.cdp new file mode 100644 index 00000000000..e32b831180f --- /dev/null +++ b/CIAO/tests/Collocation/descriptors/PlanAllOnOne.cdp @@ -0,0 +1,236 @@ +<!-- $Id$ --> +<Deployment:DeploymentPlan + xmlns:Deployment="http://www.omg.org/Deployment" + xmlns:xmi="http://www.omg.org/XMI" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.omg.org/Deployment Deployment.xsd"> + <label>RDBaseTest</label> + <UUID>RDBaseTest</UUID> + + <implementation xmi:id="CompSvrImpl"> + <name>CompSvr</name> + <source /> + <artifact xmi:idref="CompSvrArt" /> + <execParameter> + <name>edu.vanderbilt.dre.DAnCE.ImplementationType</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>edu.vanderbilt.dre.DAnCE.LocalityManager</string> + </value> + </value> + </execParameter> + </implementation> + +<implementation xmi:id="SenderImpl"> + <name>SenderImplementation</name> + <source/> + <artifact xmi:idref="Sender_ExecArtifact" /> + <artifact xmi:idref="Sender_SvntArtifact" /> + <execParameter> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Sender_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Sender_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Sender_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Sender_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="ReceiverImpl"> + <name>ReceiverImplementation</name> + <source/> + <artifact xmi:idref="Receiver_ExecArtifact" /> + <artifact xmi:idref="Receiver_SvntArtifact" /> + <execParameter> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Receiver_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Receiver_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Receiver_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Receiver_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <instance xmi:id="CompSvr1Inst"> + <name>ComponentServer1Instance</name> + <node>One</node> + <source /> + <implementation xmi:idref="CompSvrImpl" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.LocalityArguments</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <!--string>-ORBCollocation global -ORBCollocationStrategy thru_poa</string--> + <string>-ORBCollocation global -ORBCollocationStrategy direct</string> + <!--string>-ORBCollocation global -ORBCollocationStrategy best</string--> + <!--string>-ORBCollocation no</string--> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="SenderInstance"> + <name>Sender</name> + <node>One</node> + <source/> + <implementation xmi:idref="SenderImpl" /> + </instance> + + <instance xmi:id="ReceiverInstance"> + <name>Receiver</name> + <node>One</node> + <source/> + <implementation xmi:idref="ReceiverImpl" /> + </instance> + + <connection> + <name>hello_connection</name> + <internalEndpoint> + <portName>hello_to_rec</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="ReceiverInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>hello</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="SenderInstance" /> + </internalEndpoint> + </connection> + + <!--connection> + <name>bye_connection</name> + <internalEndpoint> + <portName>bye</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="SenderInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>bye_from_rec</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="ReceiverInstance" /> + </internalEndpoint> + </connection--> + + <artifact xmi:id="Sender_ExecArtifact"> + <name>Sender_exec</name> + <source/> + <node/> + <location>Sender_exec</location> + </artifact> + <artifact xmi:id="Sender_SvntArtifact"> + <name>Sender_svnt</name> + <source/> + <node/> + <location>Sender_svnt</location> + </artifact> + + <artifact xmi:id="Receiver_ExecArtifact"> + <name>Receiver_exec</name> + <source/> + <node/> + <location>Receiver_exec</location> + </artifact> + <artifact xmi:id="Receiver_SvntArtifact"> + <name>Receiver_svnt</name> + <source/> + <node/> + <location>Receiver_svnt</location> + </artifact> + + <artifact xmi:id="CompSvrArt"> + <name>CompoSvrArtifactName</name> + <source /> + <node /> + <location>dance_locality_manager</location> + </artifact> + + <localityConstraint> + <constraint>SameProcess</constraint> + <constrainedInstance xmi:idref="CompSvr1Inst" /> + <constrainedInstance xmi:idref="SenderInstance" /> + <constrainedInstance xmi:idref="ReceiverInstance" /> + </localityConstraint> + +</Deployment:DeploymentPlan> diff --git a/CIAO/tests/Collocation/descriptors/run_test.pl b/CIAO/tests/Collocation/descriptors/run_test.pl new file mode 100755 index 00000000000..3833aebb9bf --- /dev/null +++ b/CIAO/tests/Collocation/descriptors/run_test.pl @@ -0,0 +1,245 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{'ACE_ROOT'}/bin"; +use PerlACE::TestTarget; + +#$ENV{'DANCE_LOG_LEVEL'}=9; +$ENV{'CIAO_LOG_LEVEL'}=9; +$ENV{'TAO_debug_level'}=5; +$ENV{'DANCE_TRACE_ENABLE'}=1; +$ENV{'CIAO_TRACE_ENABLE'}=1; + +$CIAO_ROOT = "$ENV{'CIAO_ROOT'}"; +$TAO_ROOT = "$ENV{'TAO_ROOT'}"; +$DANCE_ROOT = "$ENV{'DANCE_ROOT'}"; + +$daemons_running = 0; +$em_running = 0; +$ns_running = 0; + +$nr_daemon = 1; +@ports = ( 60010 ); +@iorbases = ( "NodeApp1.ior" ); +@iorfiles = 0; +@nodenames = ( "One" ); + + +# ior files other than daemon +$ior_nsbase = "ns.ior"; +$ior_nsfile = 0; +$ior_embase = "EM.ior"; +$ior_emfile = 0; + +# Processes +$E = 0; +$EM = 0; +$NS = 0; +@DEAMONS = 0; + +# targets +@tg_daemons = 0; +$tg_naming = 0; +$tg_exe_man = 0; +$tg_executor = 0; + +$status = 0; +$cdp_file = "PlanAllOnOne.cdp"; + +sub create_targets { + # naming service + $tg_naming = PerlACE::TestTarget::create_target (1) || die "Create target for ns failed\n"; + $tg_naming->AddLibPath ('../lib'); + # daemon + for ($i = 0; $i < $nr_daemon; ++$i) { + $tg_daemons[$i] = PerlACE::TestTarget::create_target ($i+1) || die "Create target for daemon $i failed\n"; + $tg_daemons[$i]->AddLibPath ('../lib'); + } + # execution manager + $tg_exe_man = PerlACE::TestTarget::create_target (1) || die "Create target for EM failed\n"; + $tg_exe_man->AddLibPath ('../lib'); + # executor (plan_launcher) + $tg_executor = PerlACE::TestTarget::create_target (1) || die "Create target for executor failed\n"; + $tg_executor->AddLibPath ('../lib'); +} + +sub init_ior_files { + $ior_nsfile = $tg_naming->LocalFile ($ior_nsbase); + $ior_emfile = $tg_exe_man->LocalFile ($ior_embase); + for ($i = 0; $i < $nr_daemon; ++$i) { + $iorfiles[$i] = $tg_daemons[$i]->LocalFile ($iorbases[$i]); + } + delete_ior_files (); +} + +# Delete if there are any .ior files. +sub delete_ior_files { + for ($i = 0; $i < $nr_daemon; ++$i) { + $tg_daemons[$i]->DeleteFile ($iorbases[$i]); + } + $tg_naming->DeleteFile ($ior_nsbase); + $tg_exe_man->DeleteFile ($ior_embase); + for ($i = 0; $i < $nr_daemon; ++$i) { + $iorfiles[$i] = $tg_daemons[$i]->LocalFile ($iorbases[$i]); + } +} + +sub kill_node_daemon { + for ($i = 0; $i < $nr_daemon; ++$i) { + $DEAMONS[$i]->Kill (); $DEAMONS[$i]->TimedWait (1); + } +} + +sub kill_open_processes { + if ($daemons_running == 1) { + kill_node_daemon (); + } + + if ($em_running == 1) { + $EM->Kill (); $EM->TimedWait (1); + } + + if ($ns_running == 1) { + $NS->Kill (); $NS->TimedWait (1); + } + # in case shutdown did not perform as expected + $tg_executor->KillAll ('dance_locality_manager'); +} + +sub run_node_daemons { + for ($i = 0; $i < $nr_daemon; ++$i) { + $iorbase = $iorbases[$i]; + $iorfile = $iorfiles[$i]; + $port = $ports[$i]; + $nodename = $nodenames[$i]; + $iiop = "iiop://localhost:$port"; + $node_app = $tg_daemons[$i]->GetArchDir("$DANCE_ROOT/bin/") . "dance_locality_manager"; + + $d_cmd = "$DANCE_ROOT/bin/dance_node_manager"; + $d_param = "-ORBEndpoint $iiop -s $node_app -n $nodename=$iorfile -t 30 --domain-nc corbaloc:rir:/NameService -ORBDebug"; + print "Run dance_node_manager with $d_param\n"; + + $DEAMONS[$i] = $tg_daemons[$i]->CreateProcess ($d_cmd, $d_param); + $DEAMONS[$i]->Spawn (); + + if ($tg_daemons[$i]->WaitForFileTimed($iorbase, + $tg_daemons[$i]->ProcessStartWaitInterval ()) == -1) { + print STDERR + "ERROR: The ior $iorfile file of node daemon $i could not be found\n"; + for (; $i >= 0; --$i) { + $DEAMONS[$i]->Kill (); $DEAMONS[$i]->TimedWait (1); + } + return -1; + } + } + return 0; +} + +create_targets (); +init_ior_files (); + +# Invoke naming service + +$NS = $tg_naming->CreateProcess ("$TAO_ROOT/orbsvcs/Naming_Service/tao_cosnaming", " -ORBEndpoint iiop://localhost:60003 -o $ior_nsfile"); + +$ns_status = $NS->Spawn (); + +if ($ns_status != 0) { + print STDERR "ERROR: Unable to execute the naming service\n"; + kill_open_processes (); + exit 1; +} + +print STDERR "Starting Naming Service with -ORBEndpoint iiop://localhost:60003 -o ns.ior\n"; + +if ($tg_naming->WaitForFileTimed ($ior_nsbase, + $tg_naming->ProcessStartWaitInterval ()) == -1) { + print STDERR "ERROR: cannot find naming service IOR file\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} + +$ns_running = 1; +# Set up NamingService environment +$ENV{"NameServiceIOR"} = "corbaloc:iiop:localhost:60003/NameService"; + +# Invoke node daemon. +print "Invoking node daemon\n"; +$status = run_node_daemons (); + +if ($status != 0) { + print STDERR "ERROR: Unable to execute the node daemon\n"; + kill_open_processes (); + exit 1; +} + +$daemons_running = 1; + +# Invoke execution manager. +print "Invoking execution manager (dance_execution_manager.exe) with -e$ior_emfile\n"; +$EM = $tg_exe_man->CreateProcess ("$DANCE_ROOT/bin/dance_execution_manager", + "-e$ior_emfile --domain-nc corbaloc:rir:/NameService "); +$em_status = $EM->Spawn (); + +if ($em_status != 0) { + print STDERR "ERROR: dance_execution_manager returned $em_status"; + exit 1; +} + +if ($tg_exe_man->WaitForFileTimed ($ior_embase, + $tg_exe_man->ProcessStartWaitInterval ()) == -1) { + print STDERR + "ERROR: The ior file of execution manager could not be found\n"; + kill_open_processes (); + exit 1; +} + +$em_running = 1; + +# Invoke executor - start the application -. +print "Invoking executor - launch the application -\n"; + +print "Start dance_plan_launcher.exe with -x $cdp_file -k file://$ior_emfile\n"; +$E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-x $cdp_file -k file://$ior_emfile -l"); +$pl_status = $E->SpawnWaitKill (2 * $tg_executor->ProcessStartWaitInterval ()); + +if ($pl_status != 0) { + print STDERR "ERROR: dance_plan_launcher returned $pl_status\n"; + kill_open_processes (); + exit 1; +} + +for ($i = 0; $i < $nr_daemon; ++$i) { + if ($tg_daemons[$i]->WaitForFileTimed ($iorbases[$i], + $tg_daemons[$i]->ProcessStopWaitInterval ()) == -1) { + print STDERR "ERROR: The ior file of daemon $i could not be found\n"; + kill_open_processes (); + exit 1; + } +} + +sleep (15); + +# Invoke executor - stop the application -. +print "Invoking executor - shutting down -\n"; +print "by running dance_plan_launcher.exe with -k file://$ior_emfile -x $cdp_file\n"; + +$E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-k file://$ior_emfile -x $cdp_file -s"); +$pl_status = $E->SpawnWaitKill ($tg_executor->ProcessStartWaitInterval ()); + +if ($pl_status != 0) { + print STDERR "ERROR: dance_plan_launcher returned $pl_status\n"; + kill_open_processes (); + exit 1; +} + +delete_ior_files (); +kill_open_processes (); + +exit $status; diff --git a/CIAO/tests/DAnCE/Components/SimpleMultipleUser_exec.cpp b/CIAO/tests/DAnCE/Components/SimpleMultipleUser_exec.cpp index ca344c6ab33..ede38ef5a5b 100644 --- a/CIAO/tests/DAnCE/Components/SimpleMultipleUser_exec.cpp +++ b/CIAO/tests/DAnCE/Components/SimpleMultipleUser_exec.cpp @@ -2,6 +2,7 @@ #include "SimpleMultipleUser_exec.h" #include "ace/Log_Msg.h" +#include "ciao/Logger/Log_Macros.h" namespace CIAO_Simple_SimpleMultipleUser_Impl { @@ -98,7 +99,22 @@ namespace CIAO_Simple_SimpleMultipleUser_Impl SimpleMultipleUser_exec_i::ccm_remove () { ACE_TRACE ("SimpleMultipleUser_exec_i::ccm_remove ()"); - // Your code here. + //TODO: Enable this check again and resolve underlying issues. +/* + ::Simple::SimpleMultipleUser::trig_uses_mConnections_var conns = + this->context_->get_connections_trig_uses_m (); + if (conns->length() != 0) + { + ACE_ERROR ((LM_ERROR, CLINFO "SimpleMultipleUser_exec_i::ccm_remove - " + "ERROR: Connections still exists on exit - <%u> %@\n", + conns->length(), this)); + } + else + { + ACE_DEBUG ((LM_DEBUG, CLINFO "SimpleMultipleUser_exec_i::ccm_remove - " + "OK: Connections do not exist on exit %@\n", this)); + } +*/ } //================================================================== diff --git a/DAnCE/ChangeLog b/DAnCE/ChangeLog index 012a5283551..32ad1288413 100644 --- a/DAnCE/ChangeLog +++ b/DAnCE/ChangeLog @@ -1,3 +1,29 @@ +Tue Oct 20 09:30:13 UTC 2011 Martin Corino <mcorino@remedy.nl> + + Merged changes from Remedy work branch. + + === start changelog === + + Thu Oct 13 07:17:02 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * dance/Logger/Log_Macros.h: + Fix complile errors when all logging is disabled. + + Wed Oct 12 13:09:40 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * dance/DAnCE_Core.mpc: + * dance/LocalityManager/Configuration/Configuration.mpc: + * dance/LocalityManager/Interceptors/Error_Interceptors.mpc: + * dance/Plan_Launcher/Daemon/PL_Daemon.mpc: + * tools/Artifact_Installation/Artifact_Installation.mpc: + * tools/Convert_Plan/Convert_Plan.mpc: + * tools/Logger_Backend/ndds/NDDS_Logger.mpc: + * tools/System_Health/Interceptors/SHS_Interceptor.mpc: + * tools/System_Health/System_Health.mpc: + Fixed several install issues. + + === end changelog === + Thu Oct 20 02:37:36 UTC 2011 William R. Otte <wotte@dre.vanderbilt.edu> * tools/Split_Plan/Split_Plan.cpp: diff --git a/DAnCE/dance/DAnCE_Core.mpc b/DAnCE/dance/DAnCE_Core.mpc index dc030998f75..5801d78dc61 100644 --- a/DAnCE/dance/DAnCE_Core.mpc +++ b/DAnCE/dance/DAnCE_Core.mpc @@ -60,6 +60,12 @@ project (DAnCE_stub) : dancelib_with_idl, dance_output, \ Template_Files { DAnCE_Utility.tpp } + + InstallData_Files { + gendir = bin + ../bin/ciao.localityconfig + ../bin/nodemanager.localityconfig + } } project (DAnCE_skel) : dancelib_with_idl, dance_output, dance_stub, \ diff --git a/DAnCE/dance/LocalityManager/Configuration/Configuration.mpc b/DAnCE/dance/LocalityManager/Configuration/Configuration.mpc index 07e4da3febd..d1f920ef46e 100644 --- a/DAnCE/dance/LocalityManager/Configuration/Configuration.mpc +++ b/DAnCE/dance/LocalityManager/Configuration/Configuration.mpc @@ -1,5 +1,5 @@ // $Id$ -project (DAnCE_LM_Config_Plugins) : dance_deployment_stub, dance_stub, dance_lib, dance_output { +project (DAnCE_LM_Config_Plugins) : install, dance_deployment_stub, dance_stub, dance_lib, dance_output { dynamicflags += PROCESS_NAME_BUILD_DLL CPU_AFFINITY_BUILD_DLL PROCESS_PRIORITY_BUILD_DLL Source_Files { @@ -13,4 +13,8 @@ project (DAnCE_LM_Config_Plugins) : dance_deployment_stub, dance_stub, dance_lib Process_Priority.h CPU_Affinity.h } + + specific { + install_dir = dance/LocalityManager/Configuration + } } diff --git a/DAnCE/dance/LocalityManager/Interceptors/Error_Interceptors.mpc b/DAnCE/dance/LocalityManager/Interceptors/Error_Interceptors.mpc index f882502c5ac..9573e5c3501 100644 --- a/DAnCE/dance/LocalityManager/Interceptors/Error_Interceptors.mpc +++ b/DAnCE/dance/LocalityManager/Interceptors/Error_Interceptors.mpc @@ -1,6 +1,6 @@ // $Id$ -project (DAnCE_Error_Interceptors) : dance_skel, dance_lib, dance_output, dance_logger { +project (DAnCE_Error_Interceptors) : install, dance_skel, dance_lib, dance_output, dance_logger { dynamicflags += DANCE_ERROR_INTERCEPTORS_BUILD_DLL Source_Files { @@ -12,4 +12,8 @@ project (DAnCE_Error_Interceptors) : dance_skel, dance_lib, dance_output, dance_ Standard_Error.h Best_Effort.h } + + specific { + install_dir = dance/LocalityManager/Interceptors + } } diff --git a/DAnCE/dance/Logger/Log_Macros.h b/DAnCE/dance/Logger/Log_Macros.h index e770a78ab8b..db75b5db10c 100644 --- a/DAnCE/dance/Logger/Log_Macros.h +++ b/DAnCE/dance/Logger/Log_Macros.h @@ -92,6 +92,7 @@ extern DAnCE_Logger_Export unsigned int DAnCE_debug_level; #if defined (DANCE_NLOGGING) # define DANCE_ERROR(L, X) do {} while (0) # define DANCE_DEBUG(L, X) do {} while (0) +# define DANCE_TRACE_LOG(L, X) do {} while (0) #define DANCE_ERROR_RETURN(L, X, Y) return (Y) #define DANCE_ERROR_BREAK(L, X) { break; } #else diff --git a/DAnCE/dance/Plan_Launcher/Daemon/PL_Daemon.mpc b/DAnCE/dance/Plan_Launcher/Daemon/PL_Daemon.mpc index 1d74f0d36a6..db8db838284 100644 --- a/DAnCE/dance/Plan_Launcher/Daemon/PL_Daemon.mpc +++ b/DAnCE/dance/Plan_Launcher/Daemon/PL_Daemon.mpc @@ -1,5 +1,5 @@ // $Id$ -project (DAnCE_PL_Daemon_idl) : dancelib_with_idl, dance_output, gen_ostream, \ +project (DAnCE_PL_Daemon_idl) : install, dancelib_with_idl, dance_output, gen_ostream, \ valuetype, dance_deployment_stub { custom_only = 1 idlflags += -Wb,stub_export_macro=DANCE_PL_STUB_Export \ @@ -9,9 +9,13 @@ project (DAnCE_PL_Daemon_idl) : dancelib_with_idl, dance_output, gen_ostream, \ IDL_Files { PL_Daemon.idl } + + specific { + install_dir = dance/Plan_Launcher/Daemon + } } -project (DAnCE_PL_Daemon_stub) : dance_deployment_stub, dance_output, dance_lib { +project (DAnCE_PL_Daemon_stub) : install, dance_deployment_stub, dance_output, dance_lib { after += DAnCE_PL_Daemon_idl dynamicflags += DANCE_PL_STUB_BUILD_DLL @@ -26,6 +30,10 @@ project (DAnCE_PL_Daemon_stub) : dance_deployment_stub, dance_output, dance_lib Header_Files { PL_DaemonC.h } + + specific { + install_dir = dance/Plan_Launcher/Daemon + } } project (DAnCE_PL_Daemon) : dance_exe, install, dance_plan_launcher, utils, dance_stub { @@ -46,4 +54,8 @@ project (DAnCE_PL_Daemon) : dance_exe, install, dance_plan_launcher, utils, danc Header_Files { PL_Daemon_Impl.h } + + specific { + install_dir = dance/Plan_Launcher/Daemon + } } diff --git a/DAnCE/tools/Artifact_Installation/Artifact_Installation.mpc b/DAnCE/tools/Artifact_Installation/Artifact_Installation.mpc index b8a92bf81dc..3e940e70c39 100644 --- a/DAnCE/tools/Artifact_Installation/Artifact_Installation.mpc +++ b/DAnCE/tools/Artifact_Installation/Artifact_Installation.mpc @@ -1,15 +1,19 @@ // -*- MPC -*- // $Id$ -project (DAnCE_Artifact_Installation_IDL) : danceidldefaults { +project (DAnCE_Artifact_Installation_IDL) : install, danceidldefaults { custom_only = 1 IDL_Files { idlflags += -SS -Sci DAnCE_Artifact_Installation_Handler.idl } + + specific { + install_dir = tools/Artifact_Installation + } } -project (DAnCE_Artifact_Installation) : dance_lib, dynamicinterface, \ +project (DAnCE_Artifact_Installation) : install, dance_lib, dynamicinterface, \ dance_deployment_stub, dance_logger, dance_skel, utils { dynamicflags += DANCE_ARTIFACT_INSTALLATION_BUILD_DLL sharedname = DAnCE_Artifact_Installation @@ -26,9 +30,13 @@ project (DAnCE_Artifact_Installation) : dance_lib, dynamicinterface, \ } IDL_Files { } + + specific { + install_dir = tools/Artifact_Installation + } } -project (DAnCE_Installation_Repository_Manager) : dance_lib, dynamicinterface, dance_artifact_installation, \ +project (DAnCE_Installation_Repository_Manager) : install, dance_lib, dynamicinterface, dance_artifact_installation, \ dance_logger, utils { dynamicflags += INSTALLATION_REPOSITORY_MANAGER_BUILD_DLL sharedname = DAnCE_Installation_Repository_Manager @@ -40,9 +48,13 @@ project (DAnCE_Installation_Repository_Manager) : dance_lib, dynamicinterface, d } IDL_Files { } + + specific { + install_dir = tools/Artifact_Installation + } } -project (DAnCE_File_Installation) : dance_lib, dynamicinterface, dance_artifact_installation, \ +project (DAnCE_File_Installation) : install, dance_lib, dynamicinterface, dance_artifact_installation, \ dance_logger, utils { dynamicflags += ARTIFACT_INSTALLATION_HANDLER_BUILD_DLL sharedname = DAnCE_File_Installation @@ -54,9 +66,13 @@ project (DAnCE_File_Installation) : dance_lib, dynamicinterface, dance_artifact_ } IDL_Files { } + + specific { + install_dir = tools/Artifact_Installation + } } -project (DAnCE_Http_Installation) : dance_lib, dynamicinterface, dance_artifact_installation, \ +project (DAnCE_Http_Installation) : install, dance_lib, dynamicinterface, dance_artifact_installation, \ dance_logger, utils, inet { dynamicflags += ARTIFACT_INSTALLATION_HANDLER_BUILD_DLL sharedname = DAnCE_Http_Installation @@ -68,9 +84,13 @@ project (DAnCE_Http_Installation) : dance_lib, dynamicinterface, dance_artifact_ } IDL_Files { } + + specific { + install_dir = tools/Artifact_Installation + } } -project (DAnCE_Artifact_Installation_Exec) : dance_exe, dance_output, dance_artifact_installation, \ +project (DAnCE_Artifact_Installation_Exec) : install, dance_exe, dance_output, dance_artifact_installation, \ dance_installation_handlers, dance_installation_repository_manager, \ avoids_ace_for_tao, dance_convert_plan, dance_logger { exename = dance_artifact_installation @@ -82,4 +102,8 @@ project (DAnCE_Artifact_Installation_Exec) : dance_exe, dance_output, dance_arti } IDL_Files { } + + specific { + install_dir = tools/Artifact_Installation + } } diff --git a/DAnCE/tools/Convert_Plan/Convert_Plan.mpc b/DAnCE/tools/Convert_Plan/Convert_Plan.mpc index b154f87ac7c..2c731a9676e 100644 --- a/DAnCE/tools/Convert_Plan/Convert_Plan.mpc +++ b/DAnCE/tools/Convert_Plan/Convert_Plan.mpc @@ -1,5 +1,5 @@ // $Id$ -project (DAnCE_Convert_Plan) : dance_lib, dance_output, \ +project (DAnCE_Convert_Plan) : install, dance_lib, dance_output, \ dance_deployment_stub, dance_config_handlers { dynamicflags += DANCE_CONVERT_PLAN_BUILD_DLL @@ -8,14 +8,22 @@ project (DAnCE_Convert_Plan) : dance_lib, dance_output, \ Source_Files { Convert_Plan_Impl.cpp } + + specific { + install_dir = tools/Convert_Plan + } } -project (DAnCE_Convert_Plan_Exec) : dance_exe, dance_output, \ +project (DAnCE_Convert_Plan_Exec) : install, dance_exe, dance_output, \ dance_convert_plan { exename = dance_convert_plan Source_Files { Convert_Plan.cpp } + + specific { + install_dir = tools/Convert_Plan + } } diff --git a/DAnCE/tools/Logger_Backend/ndds/NDDS_Logger.mpc b/DAnCE/tools/Logger_Backend/ndds/NDDS_Logger.mpc index 874c5f28b31..3904912c94f 100644 --- a/DAnCE/tools/Logger_Backend/ndds/NDDS_Logger.mpc +++ b/DAnCE/tools/Logger_Backend/ndds/NDDS_Logger.mpc @@ -20,6 +20,10 @@ project(DAnCE_NDDS_Logger) : ndds_cck_ts_defaults, nddslib, taolib_with_idl, dan Source_Files { Log_Backend.cpp } + + specific { + install_dir = tools/Logger_Backend/ndds + } } project(DAnCE_NDDS_Log_Server) : ndds_cck_ts_defaults, nddsexe, taoidldefaults, taoclient, dance_output, install { @@ -33,4 +37,8 @@ project(DAnCE_NDDS_Log_Server) : ndds_cck_ts_defaults, nddsexe, taoidldefaults, Log_RecordSupport.cxx Log_Server.cpp } -}
\ No newline at end of file + + specific { + install_dir = tools/Logger_Backend/ndds + } +} diff --git a/DAnCE/tools/System_Health/Interceptors/SHS_Interceptor.mpc b/DAnCE/tools/System_Health/Interceptors/SHS_Interceptor.mpc index 3ba6bf7fb48..9a52ea1d7ca 100644 --- a/DAnCE/tools/System_Health/Interceptors/SHS_Interceptor.mpc +++ b/DAnCE/tools/System_Health/Interceptors/SHS_Interceptor.mpc @@ -1,6 +1,6 @@ // $Id$ -project (DAnCE_SHS_CORBA_Transport) : dance_lib, dance_output, dance_logger, \ +project (DAnCE_SHS_CORBA_Transport) : install, dance_lib, dance_output, dance_logger, \ dance_shs_daemon, naming, dance_deployment_scheduler { dynamicflags += DANCE_SHS_CORBA_TRANSPORT_BUILD_DLL @@ -13,9 +13,13 @@ project (DAnCE_SHS_CORBA_Transport) : dance_lib, dance_output, dance_logger, \ SHS_Transport.h SHS_CORBA_Transport.h } + + specific { + install_dir = tools/System_Health/Interceptors + } } -project (DAnCE_SHS_Interceptors) : dance_skel, dance_lib, dance_output, dance_logger, \ +project (DAnCE_SHS_Interceptors) : install, dance_skel, dance_lib, dance_output, dance_logger, \ dance_shs_daemon, naming { dynamicflags += DANCE_SHS_INTERCEPTORS_BUILD_DLL after += DAnCE_SHS_CORBA_Transport @@ -28,4 +32,8 @@ project (DAnCE_SHS_Interceptors) : dance_skel, dance_lib, dance_output, dance_lo Header_Files { SHS_Interceptor.h } + + specific { + install_dir = tools/System_Health/Interceptors + } } diff --git a/DAnCE/tools/System_Health/System_Health.mpc b/DAnCE/tools/System_Health/System_Health.mpc index c7393dfed97..a120521d7ac 100644 --- a/DAnCE/tools/System_Health/System_Health.mpc +++ b/DAnCE/tools/System_Health/System_Health.mpc @@ -28,6 +28,7 @@ project (DAnCE_System_Health_stub) : install, dance_lib, dance_output, gen_ostre Header_Files { SHS_DataModelC.h + SystemHealth_stub_export.h } specific { diff --git a/TAO/ChangeLog b/TAO/ChangeLog index d8a28c0a007..5364460d990 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,550 @@ +Tue Oct 20 09:30:13 UTC 2011 Martin Corino <mcorino@remedy.nl> + + Merged changes from Remedy work branch. + + === start changelog === + + Thu Oct 20 08:42:33 UTC 2011 Marijke Hengstmengel <hengstmengel_m@remedy.nl> + + * On_Demand_Act_Direct_Coll: + * On_Demand_Act_Direct_Coll/Collocated_Test.cpp: + * On_Demand_Act_Direct_Coll/Servant_Activator.cpp: + * On_Demand_Act_Direct_Coll/test_i.cpp: + * On_Demand_Act_Direct_Coll/Server_Task.h: + * On_Demand_Act_Direct_Coll/run_test.pl: + * On_Demand_Act_Direct_Coll/test_i.h: + * On_Demand_Act_Direct_Coll/Client_Task.cpp: + * On_Demand_Act_Direct_Coll/Server_Task.cpp: + * On_Demand_Act_Direct_Coll/Servant_Activator.h: + * On_Demand_Act_Direct_Coll/Client_Task.h: + * On_Demand_Act_Direct_Coll/On_Demand_Act_D_Coll.mpc: + * On_Demand_Act_Direct_Coll/test.idl: + Test with Servant Activator and thru_poa- and direct collocation. + + * bin/tao_orb_tests.lst + Added On_Demand_Act_Direct_Coll test. + + + Wed Oct 19 14:15:57 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * docs/tutorials/Quoter/RTCORBA/Broker.cpp: + * docs/tutorials/Quoter/RTCORBA/docs/distributor.html: + Fixed typos. + + * orbsvcs/orbsvcs/CosEvent/CEC_TypedProxyPushConsumer.h: + Fixed typo. + + * orbsvcs/orbsvcs/CosEvent/CEC_TypedProxyPushConsumer.cpp: + ++x instead of x++; + + Tue Oct 18 13:47:54 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * TAO_IDL/be/be_visitor_component/context_svh.cpp: + * TAO_IDL/be/be_visitor_component/context_svs.cpp: + Reverted last changes. Need a more robust implementation to + fix re-entrancy + + Tue Oct 18 11:35:58 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * TAO_IDL/be/be_visitor_exception/any_op_cs.cpp: + * TAO_IDL/be/be_visitor_interface/any_op_cs.cpp: + * TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp: + * TAO_IDL/be/be_visitor_structure/any_op_cs.cpp: + Layout changes to the generated code + + Tue Oct 18 10:51:21 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * TAO_IDL/be/be_visitor_component/context_svh.cpp: + * TAO_IDL/be/be_visitor_component/context_svs.cpp: + Using recursive mutexes instead of normal mutexes. + + Tue Oct 18 10:39:23 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * TAO_IDL/be/be_visitor_component/context_svs.cpp: + Fixed a minor indentation issue. + + Tue Oct 18 10:03:32 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * TAO_IDL/be/be_visitor_component/servant_svs.cpp: + Using the container_ variable in a thread safe way. + + Tue Oct 18 07:01:33 UTC 2011 Marijke Hengstmengel <hengstmengel_m@remedy.nl> + * tests/Collocated_DerivedIF/Collocated_DerivedIF.mpc: + Changes for duplicate project names. + + Mon Oct 17 13:08:33 UTC 2011 Marijke Hengstmengel <hengstmengel_m@remedy.nl> + * tests/Collocated_DerivedIF: + * tests/Collocated_DerivedIF/Client_Task.h: + * tests/Collocated_DerivedIF/Client_Task.cpp: + * tests/Collocated_DerivedIF/Collocated_DerivedIF.mpc: + * tests/Collocated_DerivedIF/Collocated_Test.cpp: + * tests/Collocated_DerivedIF/Hello.h: + * tests/Collocated_DerivedIF/Hello.cpp: + * tests/Collocated_DerivedIF/Server_Task.h: + * tests/Collocated_DerivedIF/Server_Task.cpp: + * tests/Collocated_DerivedIF/Test.idl: + * tests/Collocated_DerivedIFl/run_test.pl: + * tests/Collocated_DerivedIFl/README: + Test for -ORBCollocationStrategy direct and interface inheritance + + * tests/Collocated_Best/README: + Add ID + + Mon Oct 17 12:33:33 UTC 2011 Marijke Hengstmengel <hengstmengel_m@remedy.nl> + * docs/Options.html + Added new define TAO_DEFAULT_COLLOCATION_STRATEGY . + + Mon Oct 17 11:41:33 UTC 2011 Marijke Hengstmengel <hengstmengel_m@remedy.nl> + * docs/Options.html + Add new ORBCollocationStrategy best . + + Thu Oct 13 12:57:25 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * TAO_IDL/be_include/be_valuetype.h: + * TAO_IDL/be/be_valuetype.cpp: + Removed gen_skel_helper from here, not used at all + + * orbsvcs/tests/Notify/lib/Options_Parser.cpp: + Fixed compile error with gcc 4.6 + + Thu Oct 13 12:14:00 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * TAO_IDL/be/be_interface.cpp: + * TAO_IDL/be/be_visitor_interface/amh_si.cpp: + static_cast seems to be required, not sure why, reverting this part + to get our branch build green again + + Thu Oct 13 11:15:06 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * tao/AnyTypeCode/Any_Impl.cpp: + Layout changes + + * tao/LocalObject.cpp: + * tao/Object.cpp: + Log an error before throwing a NO_IMPLEMENT system exception + + Thu Oct 13 07:15:34 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * TAO_IDL/be/be_interface.cpp: + * TAO_IDL/be/be_visitor_interface/amh_si.cpp: + Further reduction of code being generated in case of interface + inheritance + + Thu Oct 13 06:46:25 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * TAO_IDL/be/be_interface.cpp: + Fixed problem with num_args that still was generated for arguments + + Wed Oct 12 14:14:32 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * TAO_IDL/be/be_interface.cpp: + * TAO_IDL/be/be_visitor_interface/interface_si.cpp: + Changed indentation and removed not needed static cast in the + generated code + + Wed Oct 12 12:06:33 UTC 2011 Marijke Hengstmengel <hengstmengel_m@remedy.nl> + * tests/Collocated_NoColl: + * tests/Collocated_NoColl/Client_Task.h: + * tests/Collocated_NoColl/Client_Task.cpp: + * tests/Collocated_NoColl/Collocated_NoColl.mpc: + * tests/Collocated_NoColl/Collocated_Test.cpp: + * tests/Collocated_NoColl/Hello.h: + * tests/Collocated_NoColl/Hello.cpp: + * tests/Collocated_NoColl/Server_Task.h: + * tests/Collocated_NoColl/Server_Task.cpp: + * tests/Collocated_NoColl/Test.idl: + * tests/Collocated_NoColl/run_test.pl: + Test for -ORBCollocation NO + + + Wed Oct 12 12:02:04 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * tao/Collocation_Strategy.h: + * tao/Invocation_Adapter.cpp: + Print the collocation strategy that we have determined + + * tests/Hello/run_test.pl: + Added -cdebug that enables ORBDebugLevel 10 for the client + + Wed Oct 12 10:09:25 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * TAO_IDL/be/be_visitor_operation/direct_proxy_impl_ss.cpp: + * TAO_IDL/be/be_visitor_operation/proxy_impl_xh.cpp: + * tao/Abstract_Servant_Base.h: + * tao/PortableServer/Direct_Collocation_Upcall_Wrapper.cpp: + * tao/PortableServer/Operation_Table.h: + Removed the num_args argument for the direct collocation skeleton + functions because it was not used at all + + Wed Oct 12 09:55:38 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * TAO_IDL/be/be_visitor_interface/amh_ss.cpp: + * TAO_IDL/be/be_visitor_interface/interface_cs.cpp: + * tao/Object_T.h: + * tao/Object_T.cpp: + * tao/PolicyC.cpp: + * tao/Valuetype/AbstractBase_T.h: + * tao/Valuetype/AbstractBase_T.cpp: + unchecked_narrow method was available with and without repository_id + argument but that wasn't used at all. merged both methods into one + and updated tao_idl code generation to not generate the repository_id + anymore + + Wed Oct 12 09:01:19 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * TAO_IDL/be/be_visitor_interface/amh_ss.cpp: + * TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp: + * TAO_IDL/be/be_visitor_interface/interface_cs.cpp: + * TAO_IDL/be/be_visitor_interface/interface_ss.cpp: + * tao/Object_T.h: + * tao/Object_T.cpp: + * tao/PolicyC.cpp: + * tao/PortableServer/PolicyS.cpp: + * tao/Valuetype/AbstractBase_T.h: + * tao/Valuetype/AbstractBase_T.cpp: + Removed the collocation opportunity from the narrow calls, the + boolean collocated only means whether the servant is collocated or + not and shouldn't include the fact whether we have a collocation + opportunity or not + + Tue Oct 11 17:38:06 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * tests/Collocated_Best/Collocated_Best_Direct/Client_Task.cpp: + * tests/Collocated_Best/Collocated_Best_NoColl/Client_Task.cpp: + * tests/Collocated_Best/Collocated_Best_ThuP/Client_Task.cpp: + Also check the string that returned + + Tue Oct 11 10:53:17 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * tao/Object_T.cpp: + Don't use collocation opportunity, just determine whether the + object is collocated or not. If this doesn't break any tests, we + need to do some more cleanup here + + Tue Oct 11 10:41:02 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * tao/CORBANAME_Parser.cpp: + * tao/Remote_Object_Proxy_Broker.cpp: + Enable through poa collocation by default + + Tue Oct 11 07:17:47 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * TAO_IDL/be/be_visitor_interface/interface_ss.cpp: + Layout changes and just always generate the orb optimize flags + + Mon Oct 10 17:43:50 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * tao/IIOP_Connector.cpp: + * tao/Invocation_Adapter.h: + * tao/Invocation_Adapter.cpp: + * tao/ORB_Core.h: + * tao/ORB_Core.cpp: + Moved collocation_strategy from the orb core to the invocation adapter + + * tests/Collocated_ThruP_Sp/Collocated_Test.cpp: + * tests/Collocated_ThruP_Sp/README: + * tests/Collocated_ThruP_Sp/Server_Task.cpp: + * tests/Collocated_ThruP_Sp/run_test.pl: + * tests/Collocated_ThruP_Sp_Gd/README: + * tests/Collocated_ThruP_Sp_Gd/run_test.pl: + Add -debug to the script, layout changes, missing Id + + Fri Oct 7 10:54:09 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * tao/ORB_Core.cpp: + Tweaked collocation strategy a little bit more, for direct we need + a servant, not for poa. If we are not collocated, we just go remote and + not give an exception + + Fri Oct 7 09:17:36 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * TAO_IDL/be/be_visitor_interface/interface_ss.cpp: + Layout change to generated code + + * tao/Invocation_Adapter.cpp: + Removed the check that servant != 0 before being able to invoke + collocated, collocation opportunities test shows a case where this + happens + + * tao/ORB_Core.cpp: + Added logging before we throw an exception related to collocation + mis configuration. If we are collocated with best opportunity without + any opportunity we default to remote instead of having an exception. + Through poa seems possible without a servant pointer + + Thu Oct 6 09:34:57 UTC 2011 Marijke Hengstmengel <mhengstmengel@remedy.nl> + + * tao/DynamicInterface/DII_Invocation_Adapter.cpp: + Set collocation_opportunity to TAO_CO_THRU_POA_STRATEGY instead of 0. + + Thu Oct 6 08:56:57 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * orbsvcs/ImplRepo_Service/ImplRepo_Service.mpc: + * orbsvcs/examples/RtEC/IIOPGateway/RtEC_IIOPGateway.mpc: + * tests/Oneway_Buffering/Oneway_Buffering.mpc: + * tests/Policies/Policies.mpc: + requires for corba_messaging is already pulled in through the + base projects + + Wed Oct 5 18:49:30 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * TAO_IDL/be/be_interface.cpp: + * TAO_IDL/be/be_visitor_interface/interface_ch.cpp: + * TAO_IDL/be/be_visitor_root/root_ch.cpp: + * TAO_IDL/be_include/be_global.h: + * TAO_IDL/be_include/be_interface.h: + * TAO_IDL/be_include/be_visitor_root/root_ch.h: + Even more cleanup of old stuff + + Wed Oct 5 18:42:43 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * TAO_IDL/be/be_home.cpp: + * TAO_IDL/be/be_interface.cpp: + * TAO_IDL/be/be_visitor_interface/interface_ch.cpp: + * TAO_IDL/be_include/be_interface.h: + * TAO_IDL/be/be_visitor_operation/base_proxy_impl_ch.cpp: + * TAO_IDL/be/be_visitor_operation/remote_proxy_impl_cs.cpp: + More cleanup + + * TAO_IDL/be_include/be_visitor_operation/base_proxy_impl_ch.h: + * TAO_IDL/be_include/be_visitor_operation/remote_proxy_impl_cs.h: + Removed these files. + + Wed Oct 5 18:34:21 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * TAO_IDL/be/be_home.cpp: + * TAO_IDL/be/be_interface.cpp: + * TAO_IDL/be/be_visitor_interface/interface_ch.cpp: + * TAO_IDL/be_include/be_interface.h: + Cleanup of very old stuff + + * TAO_IDL/be/be_visitor_operation/ami_cs.cpp: + Fixed cpb + + * tao/Valuetype/AbstractBase_T.h: + * tao/Valuetype/AbstractBase_T.cpp: + Updated for changes below + + * tests/CSD_Collocation/svc.conf.csd: + Removed deprecated arguments + + Wed Oct 5 13:01:20 UTC 2011 Marijke Hengstmengel <hengstmengel_m@remedy.nl> + + * tests/Collocated_Best/README + * tests/Collocated_ThruP_Sp/README + * tests/Collocated_ThruP_Sp_Gd/README + * tests/Bug_2241_Regression/README + Add README's + + * bin/tao_orb_tests.lst + Added Collocated_ThruP_Sp_Gd test. + + Wed Oct 5 12:41:20 UTC 2011 Marijke Hengstmengel <hengstmengel_m@remedy.nl> + + * TAO_IDL/be/be_visitor_interface/amh_ss.cpp: + * TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp: + * TAO_IDL/be/be_visitor_interface/interface_cs.cpp: + * TAO_IDL/be/be_visitor_interface/interface_ss.cpp: + * TAO_IDL/be/be_visitor_operation/operation.cpp: + * tao/PolicyC.cpp: + * tao/Collocation_Strategy.h: + * tao/PortableServer/PolicyS.cpp: + Change define TAO_CO_DIRECT_POA,remove POA + + * tao/DynamicInterface/DII_Invocation_Adapter.h: + * tao/DynamicInterface/DII_Invocation_Adapter.cpp: + * tao/Messaging/Asynch_Invocation_Adapter.h: + * tao/Messaging/Asynch_Invocation_Adapter.cpp: + * tao/Valuetype/AbstractBase_Invocation_Adapter.h: + * tao/Valuetype/AbstractBase_Invocation_Adapter.cpp: + Change proxybroker for collocation opertunities + + * tao/ORB_Core.cpp: + * tao/Invocation_Adapter.cpp: + Extended collocation_strategy with opertunities + Handling of BEST strategy and checking other strategies. + + * tests/Collocated_Best/Collocated_Best_Direct/run_test.pl: + + + + Wed Oct 5 08:35:20 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * TAO_IDL/be/be_codegen.cpp: + * TAO_IDL/be/be_component.cpp: + * TAO_IDL/be/be_interface.cpp: + * TAO_IDL/be/be_visitor_interface.cpp: + * TAO_IDL/be/be_visitor_interface/amh_ss.cpp: + * TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp: + * TAO_IDL/be/be_visitor_interface/interface_ch.cpp: + * TAO_IDL/be/be_visitor_interface/interface_ci.cpp: + * TAO_IDL/be/be_visitor_interface/interface_cs.cpp: + * TAO_IDL/be/be_visitor_interface/interface_sh.cpp: + * TAO_IDL/be/be_visitor_interface/interface_ss.cpp: + * TAO_IDL/be/be_visitor_operation/ami_cs.cpp: + * TAO_IDL/be/be_visitor_operation/direct_proxy_impl_ss.cpp: + * TAO_IDL/be/be_visitor_operation/operation.cpp: + * TAO_IDL/be/be_visitor_root/root_ch.cpp: + * TAO_IDL/be/be_visitor_valuetype/valuetype_sh.cpp: + * TAO_IDL/be_include/be_component.h: + * TAO_IDL/be_include/be_interface.h: + * TAO_IDL/be_include/be_visitor_interface.h: + * tao/Abstract_Servant_Base.h: + * tao/Collocated_Invocation.h: + * tao/Collocated_Invocation.cpp: + * tao/Collocation_Strategy.h: + * tao/Invocation_Adapter.h: + * tao/Invocation_Adapter.inl: + * tao/Invocation_Adapter.cpp: + * tao/ORB_Core.h: + * tao/ORB_Core.cpp: + * tao/Object.h: + * tao/Object.cpp: + * tao/Object_T.h: + * tao/Object_T.cpp: + * tao/PolicyC.h: + * tao/PolicyC.inl: + * tao/PolicyC.cpp: + * tao/PortableServer/Direct_Collocation_Upcall_Wrapper.h: + * tao/PortableServer/PolicyS.h: + * tao/PortableServer/PolicyS.cpp: + * tao/PortableServer/Servant_Base.h: + * tao/PortableServer/Servant_Base.cpp: + * tao/tao.mpc: + Rough reimplementatin of handling of collocated call. A pre condition + for using collocation is having a servant pointer. The core of TAO + also couldn't detect whether through poa collocation is requested + without having -Gp being enabled. The collocated proxy broker (cpb) + was only used for direct collocation, but didn't contain any interface + specific code. TAO_IDL now generated a collocation opportunity to + indicate which support it did generate, when the core than has + a servant pointer it can determine which opportunities it has an + what is requested. + + As side effect we get smaller generated code, less complexity, and + better performance + + This has to be finished but committing it right now. + + * TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_sh.cpp: + * TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_ss.cpp: + * TAO_IDL/be_include/be_visitor_interface/strategized_proxy_broker_sh.h: + * TAO_IDL/be_include/be_visitor_interface/strategized_proxy_broker_ss.h: + * tao/Collocation_Proxy_Broker.h: + * tao/Collocation_Proxy_Broker.cpp: + Removed these files. + + Wed Oct 5 07:15:46 UTC 2011 Marijke Hengstmengel <hengstmengel_m@remedy.nl> + + * tao/PortableServer/Collocated_Object_Proxy_Broker.cpp: + Add prefix TAO_COLLOCATION_ to Collocated strategy Thru_POA + + Tue Oct 4 16:36:46 UTC 2011 Marijke Hengstmengel <hengstmengel_m@remedy.nl> + + * TAO_IDL/be/be_visitor_interface/interface_ss.cpp: + Clean up debug text + + * tao/Invocation_Adapter.cpp: + * tao/ORB_Core.h: + * tao/ORB_Core.cpp: + Change Exception for collocated errors. + Add prefix TAO_COLLOCATION_ to Collocated strategies DIrect, Best and Thru_POA + Add TAO_DEFAULT_COLLOCATION_STRATEGY + + * tao/orbconf.h: + Add TAO_DEFAULT_COLLOCATION_STRATEGY + + * tests/Bug_2241_Regression/run_test.pl: + * tests/Collocated_Best/Collocated_Best_Direct/Collocated_Best_Direct.mpc: + * tests/Collocated_Best/Collocated_Best_NoColl/Hello.cpp: + * tests/Collocated_Best/Collocated_Best_ThuP/Collocated_Best_ThruP.mpc: + + * tests/Collocated_ThruP_Sp_Gd: + * tests/Collocated_ThruP_Sp_Gd/Client_Task.h: + * tests/Collocated_ThruP_Sp_Gd/Client_Task.cpp: + * tests/Collocated_ThruP_Sp_Gd/Collocated_Test.cpp: + * tests/Collocated_ThruP_Sp_Gd/Collocated_ThruP_Sp_Gd.mpc: + * tests/Collocated_ThruP_Sp_Gd/Hello.h: + * tests/Collocated_ThruP_Sp_Gd/Hello.cpp: + * tests/Collocated_ThruP_Sp_Gd/Server_Task.h: + * tests/Collocated_ThruP_Sp_Gd/Server_Task.cpp: + * tests/Collocated_ThruP_Sp_Gd/Test.idl: + * tests/Collocated_ThruP_Sp_Gd/run_test.pl: + New test for combination Sp and Gd + + Mon Oct 3 15:33:35 UTC 2011 Marijke Hengstmengel <hengstmengel_m@remedy.nl> + + * TAO_IDL/be/be_visitor_interface/interface_ss.cpp: + Change dead to 0 for Collocation_Proxy_Broker + + * tao/Collocation_Strategy.h: + * tao/Invocation_Adapter.cpp: + * tao/ORB_Core.h: + * tao/ORB_Core.cpp: + Add exceptions for situations if not used -Gp or used -Sp idl flags and + ORBCollocationStrategies Direct and Thru_Poa. Add strategie BEST. + To do: add prefix COLLOCATION_. + + * tests/Bug_2241_Regression/Client_Task.cpp: + * tests/Bug_2241_Regression/Hello.cpp: + * tests/Bug_2241_Regression/run_test.pl: + Catch expected exceptions. + + * tests/Collocated_Best: + * tests/Collocated_Best/Collocated_Best_Direct: + * tests/Collocated_Best/Collocated_Best_Direct/Client_Task.h: + * tests/Collocated_Best/Collocated_Best_Direct/Client_Task.cpp: + * tests/Collocated_Best/Collocated_Best_Direct/Collocated_Best_Direct.mpc: + * tests/Collocated_Best/Collocated_Best_Direct/Collocated_Test.cpp: + * tests/Collocated_Best/Collocated_Best_Direct/Hello.h: + * tests/Collocated_Best/Collocated_Best_Direct/Hello.cpp: + * tests/Collocated_Best/Collocated_Best_Direct/Server_Task.h: + * tests/Collocated_Best/Collocated_Best_Direct/Server_Task.cpp: + * tests/Collocated_Best/Collocated_Best_Direct/Test.idl: + * tests/Collocated_Best/Collocated_Best_Direct/run_test.pl: + + * tests/Collocated_Best/Collocated_Best_NoColl: + + * tests/Collocated_Best/Collocated_Best_NoColl/Client_Task.h: + * tests/Collocated_Best/Collocated_Best_NoColl/Client_Task.cpp: + * tests/Collocated_Best/Collocated_Best_NoColl/Collocated_Best_NoColl.mpc: + * tests/Collocated_Best/Collocated_Best_NoColl/Collocated_Test.cpp: + * tests/Collocated_Best/Collocated_Best_NoColl/Hello.h: + * tests/Collocated_Best/Collocated_Best_NoColl/Hello.cpp: + * tests/Collocated_Best/Collocated_Best_NoColl/Server_Task.h: + * tests/Collocated_Best/Collocated_Best_NoColl/Server_Task.cpp: + * tests/Collocated_Best/Collocated_Best_NoColl/Test.idl: + * tests/Collocated_Best/Collocated_Best_NoColl/run_test.pl: + + * tests/Collocated_Best/Collocated_Best_ThuP: + + * tests/Collocated_Best/Collocated_Best_ThuP/Client_Task.h: + * tests/Collocated_Best/Collocated_Best_ThuP/Client_Task.cpp: + * tests/Collocated_Best/Collocated_Best_ThuP/Collocated_Best_ThruP.mpc: + * tests/Collocated_Best/Collocated_Best_ThuP/Collocated_Test.cpp: + * tests/Collocated_Best/Collocated_Best_ThuP/Hello.h: + * tests/Collocated_Best/Collocated_Best_ThuP/Hello.cpp: + * tests/Collocated_Best/Collocated_Best_ThuP/Server_Task.h: + * tests/Collocated_Best/Collocated_Best_ThuP/Server_Task.cpp: + * tests/Collocated_Best/Collocated_Best_ThuP/Test.idl: + * tests/Collocated_Best/Collocated_Best_ThuP/run_test.pl: + + * tests/Collocated_ThruP_Sp: + + * tests/Collocated_ThruP_Sp/Client_Task.h: + * tests/Collocated_ThruP_Sp/Client_Task.cpp: + * tests/Collocated_ThruP_Sp/Collocated_Test.cpp: + * tests/Collocated_ThruP_Sp/Collocated_ThruP_Sp.mpc: + * tests/Collocated_ThruP_Sp/Hello.h: + * tests/Collocated_ThruP_Sp/Hello.cpp: + * tests/Collocated_ThruP_Sp/Server_Task.h: + * tests/Collocated_ThruP_Sp/Server_Task.cpp: + * tests/Collocated_ThruP_Sp/Test.idl: + * tests/Collocated_ThruP_Sp/run_test.pl: + tests for COLLOCATION_DIRECT. To do: add readme + + === end changelog === + Mon Oct 10 08:48:51 CEST 2011 Johnny Willemsen <jwillemsen@remedy.nl> * TAO version 2.0.5 released. @@ -1,6 +1,12 @@ -USER VISIBLE CHANGES BETWEEN TAO-2.0.5 and TAO-2.0.6 +USER VISIBLE CHANGES BETWEEN TAO-2.0.5 and TAO-2.1.0 ==================================================== + . Added new define TAO_DEFAULT_COLLOCATION_STRATEGY (default = thru_poa) which is used as + -ORBCollocationStrategy isn't specified. + + . Added new -ORBCollocationStrategy best. TAO tries to perform the best possible + collocation, first direct if possible, then through_poa if possible else no collocation. + USER VISIBLE CHANGES BETWEEN TAO-2.0.4 and TAO-2.0.5 ==================================================== diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp index b811ca7a72f..39003bec0d6 100644 --- a/TAO/TAO_IDL/be/be_codegen.cpp +++ b/TAO/TAO_IDL/be/be_codegen.cpp @@ -2669,8 +2669,6 @@ TAO_CodeGen::gen_skel_hdr_includes (void) } this->gen_standard_include (this->server_header_, - "tao/Collocation_Proxy_Broker.h"); - this->gen_standard_include (this->server_header_, "tao/PortableServer/PortableServer.h"); this->gen_standard_include (this->server_header_, "tao/PortableServer/Servant_Base.h"); diff --git a/TAO/TAO_IDL/be/be_component.cpp b/TAO/TAO_IDL/be/be_component.cpp index 9d2cd33ab31..68a612fb86f 100644 --- a/TAO/TAO_IDL/be/be_component.cpp +++ b/TAO/TAO_IDL/be/be_component.cpp @@ -369,19 +369,6 @@ be_component::gen_is_a_ancestors (TAO_OutStream *os) } void -be_component::gen_parent_collocation (TAO_OutStream *os) -{ - AST_Component *base = this->base_component (); - - if (base != 0) - { - *os << be_nl - << "this->" << base->flat_name () - << "_setup_collocation" << " ();"; - } -} - -void be_component::mirror_scan (AST_PortType *pt) { AST_Uses *u = 0; diff --git a/TAO/TAO_IDL/be/be_home.cpp b/TAO/TAO_IDL/be/be_home.cpp index cecee18c8cb..6c8aa51a9cd 100644 --- a/TAO/TAO_IDL/be/be_home.cpp +++ b/TAO/TAO_IDL/be/be_home.cpp @@ -133,42 +133,12 @@ be_home::destroy (void) delete [] this->relative_skel_name_; this->relative_skel_name_ = 0; - delete [] this->base_proxy_impl_name_; - this->base_proxy_impl_name_ = 0; - - delete [] this->remote_proxy_impl_name_; - this->remote_proxy_impl_name_ = 0; - delete [] this->direct_proxy_impl_name_; this->direct_proxy_impl_name_ = 0; - delete [] this->full_base_proxy_impl_name_; - this->full_base_proxy_impl_name_ = 0; - - delete [] this->full_remote_proxy_impl_name_; - this->full_remote_proxy_impl_name_ = 0; - delete [] this->full_direct_proxy_impl_name_; this->full_direct_proxy_impl_name_ = 0; - delete [] this->base_proxy_broker_; - this->base_proxy_broker_ = 0; - - delete [] this->remote_proxy_broker_; - this->remote_proxy_broker_ = 0; - - delete [] this->strategized_proxy_broker_; - this->strategized_proxy_broker_ = 0; - - delete [] this->full_base_proxy_broker_name_; - this->full_base_proxy_broker_name_ = 0; - - delete [] this->full_remote_proxy_broker_name_; - this->full_remote_proxy_broker_name_ = 0; - - delete [] this->full_strategized_proxy_broker_name_; - this->full_strategized_proxy_broker_name_ = 0; - delete [] this->client_scope_; this->client_scope_ = 0; diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp index 81ec9046965..dca37dd5cf7 100644 --- a/TAO/TAO_IDL/be/be_interface.cpp +++ b/TAO/TAO_IDL/be/be_interface.cpp @@ -50,15 +50,11 @@ const char *be_interface::suffix_table_[] = { "_Proxy_Impl", - "_Proxy_Broker" }; const char *be_interface::tag_table_[] = { - "_ThruPOA", "_Direct", - "_Remote", - "_Strategized", "_TAO_" }; @@ -88,18 +84,8 @@ be_interface::be_interface (UTL_ScopedName *n, n), be_type (AST_Decl::NT_interface, n), - base_proxy_impl_name_ (0), - remote_proxy_impl_name_ (0), direct_proxy_impl_name_ (0), - full_base_proxy_impl_name_ (0), - full_remote_proxy_impl_name_ (0), full_direct_proxy_impl_name_ (0), - base_proxy_broker_ (0), - remote_proxy_broker_ (0), - strategized_proxy_broker_ (0), - full_base_proxy_broker_name_ (0), - full_remote_proxy_broker_name_ (0), - full_strategized_proxy_broker_name_ (0), client_scope_ (0), flat_client_scope_ (0), server_scope_ (0), @@ -365,13 +351,13 @@ be_interface::compute_coll_names (int type, // in the loop. j.next (); - // We add the POA_ preffix only if the first component is not + // We add the POA_ prefix only if the first component is not // the global scope... if (ACE_OS::strcmp (item, "") != 0) { if (!j.is_done ()) { - // We only add the POA_ preffix if there are more than + // We only add the POA_ prefix if there are more than // two components in the name, in other words, if the // class is inside some scope. if (!poa_added) @@ -669,6 +655,7 @@ be_interface::gen_stub_ctor (TAO_OutStream *os) // Generate the constructor from stub and servant. if (!this->is_local ()) { + bool const abstract = this->is_abstract (); *os << be_nl_2 << "ACE_INLINE" << be_nl; *os << this->name () << "::" @@ -677,7 +664,8 @@ be_interface::gen_stub_ctor (TAO_OutStream *os) << "TAO_Stub *objref," << be_nl << "::CORBA::Boolean _tao_collocated," << be_nl << "TAO_Abstract_ServantBase *servant," << be_nl - << "TAO_ORB_Core *oc)" << be_uidt_nl + << "TAO_ORB_Core *" << (abstract ? "" : "oc") << ")" + << be_uidt_nl << ": "; bool the_check = @@ -740,29 +728,7 @@ be_interface::gen_stub_ctor (TAO_OutStream *os) *os << "::CORBA::Object (objref, _tao_collocated, servant, oc)"; } - if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) - { - *os << "," << be_nl - << "the" << this->base_proxy_broker_name () << "_ (0)" - << be_uidt << be_uidt; - } - - *os << be_nl << "{" << be_idt_nl; - - if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) - { - *os << "this->" << this->flat_name () - << "_setup_collocation ();"; - } - - if (this->is_abstract ()) - { - *os << be_nl - << "ACE_UNUSED_ARG (oc);"; - } - - *os << be_uidt_nl - << "}"; + *os << be_uidt << be_uidt_nl << "{" << be_nl << "}"; } } @@ -867,8 +833,7 @@ private: }; TAO_IDL_Gen_OpTable_Worker::TAO_IDL_Gen_OpTable_Worker ( - const char *skeleton_name - ) + const char *skeleton_name) : skeleton_name_ (skeleton_name) { } @@ -1286,7 +1251,7 @@ be_interface::gen_optable_entries (be_interface *derived_interface, const char *full_skeleton_name, TAO_OutStream *os) { - int lookup_strategy = + int const lookup_strategy = be_global->lookup_strategy (); if (lookup_strategy == BE_GlobalData::TAO_DYNAMIC_HASH) @@ -1326,7 +1291,7 @@ be_interface::gen_optable_entries (be_interface *derived_interface, *os << "}," << be_nl; - derived_interface->skel_count_++; + ++derived_interface->skel_count_; } else if (d->node_type () == AST_Decl::NT_attr) { @@ -1355,7 +1320,7 @@ be_interface::gen_optable_entries (be_interface *derived_interface, *os << "}," << be_nl; - derived_interface->skel_count_++; + ++derived_interface->skel_count_; if (!attr->readonly ()) { @@ -1377,7 +1342,7 @@ be_interface::gen_optable_entries (be_interface *derived_interface, *os << "}," << be_nl; - derived_interface->skel_count_++; + ++derived_interface->skel_count_; } } } @@ -1515,20 +1480,17 @@ be_interface::gen_collocated_skel_body (be_interface *derived, << "ACE_INLINE void" << be_nl << derived->full_direct_proxy_impl_name () << "::" << prefix << d->local_name () << " (" - << be_idt << be_idt_nl + << be_idt_nl << "TAO_Abstract_ServantBase *servant," << be_nl - << "TAO::Argument ** args," << be_nl - << "int num_args)" << be_uidt_nl; + << "TAO::Argument ** args)" << be_uidt_nl; - *os << be_uidt_nl - << "{" << be_idt_nl + *os << "{" << be_idt_nl << ancestor->full_direct_proxy_impl_name () << "::" << prefix << d->local_name () << " (" - << be_idt << be_idt_nl + << be_idt_nl << "servant," << be_nl - << "args," << be_nl - << "num_args);" << be_uidt - << be_uidt << be_uidt_nl + << "args);" << be_uidt + << be_uidt_nl << "}"<< be_nl; } @@ -1592,7 +1554,6 @@ be_interface::traverse_inheritance_graph ( this->insert_queue.reset (); this->del_queue.reset (); - // Insert ourselves in the queue. if (insert_queue.enqueue_tail (this) == -1) { @@ -2198,7 +2159,6 @@ be_interface::gen_skel_helper (be_interface *derived, // attributes defined by "ancestor", become methods on the derived // class which call the corresponding method of the base class by // doing the proper casting. - for (UTL_ScopeActiveIterator si (ancestor, UTL_Scope::IK_decls); !si.is_done (); si.next ()) @@ -2241,14 +2201,14 @@ be_interface::gen_skel_helper (be_interface *derived, << "void" << be_nl << derived->full_skel_name () << "::" << d->local_name () - << "_skel (" << be_idt << be_idt_nl + << "_skel (" << be_idt_nl << "TAO_ServerRequest & server_request," << be_nl << "void * servant_upcall," << be_nl - << "void * servant)" << be_uidt + << "void * servant)" << be_uidt_nl << "{" << be_idt_nl; - *os << ancestor->full_skel_name () + *os << ancestor->full_skel_name () << " * const impl =" << be_idt_nl << "static_cast<" << derived->full_skel_name () @@ -2256,11 +2216,11 @@ be_interface::gen_skel_helper (be_interface *derived, *os << ancestor->full_skel_name () << "::" << d->local_name () - << "_skel (" << be_idt << be_idt_nl + << "_skel (" << be_idt_nl << "server_request," << be_nl << "servant_upcall," << be_nl << "impl);" << be_uidt - << be_uidt << be_uidt_nl + << be_uidt_nl << "}"; } } @@ -2300,7 +2260,7 @@ be_interface::gen_skel_helper (be_interface *derived, << be_uidt_nl << "{" << be_idt_nl; - *os << ancestor->full_skel_name () + *os << ancestor->full_skel_name () << " * const impl = static_cast<" << derived->full_skel_name () << " *> (servant);" << be_nl; @@ -2406,8 +2366,7 @@ be_interface::gen_colloc_op_decl_helper (be_interface *derived, *os << "static void" << be_nl << d->local_name () << " (" << be_idt_nl << "TAO_Abstract_ServantBase *servant, " - << "TAO::Argument **args, " - << "int num_args);" << be_uidt_nl; + << "TAO::Argument **args);" << be_uidt_nl; } else if (d->node_type () == AST_Decl::NT_attr) { @@ -2422,8 +2381,7 @@ be_interface::gen_colloc_op_decl_helper (be_interface *derived, *os << "static void" << be_nl << "_get_" << d->local_name () << " (" << be_idt_nl << "TAO_Abstract_ServantBase *servant, " - << "TAO::Argument **args, " - << "int num_args);" << be_uidt_nl; + << "TAO::Argument **args);" << be_uidt_nl; if (!attr->readonly ()) { @@ -2435,8 +2393,7 @@ be_interface::gen_colloc_op_decl_helper (be_interface *derived, << "_set_" << d->local_name () << " (" << be_idt_nl << "TAO_Abstract_ServantBase *servant, " - << "TAO::Argument **args, " - << "int num_args);" << be_uidt_nl; + << "TAO::Argument **args);" << be_uidt_nl; } } } @@ -2728,42 +2685,12 @@ be_interface::destroy (void) delete [] this->relative_skel_name_; this->relative_skel_name_ = 0; - delete [] this->base_proxy_impl_name_; - this->base_proxy_impl_name_ = 0; - - delete [] this->remote_proxy_impl_name_; - this->remote_proxy_impl_name_ = 0; - delete [] this->direct_proxy_impl_name_; this->direct_proxy_impl_name_ = 0; - delete [] this->full_base_proxy_impl_name_; - this->full_base_proxy_impl_name_ = 0; - - delete [] this->full_remote_proxy_impl_name_; - this->full_remote_proxy_impl_name_ = 0; - delete [] this->full_direct_proxy_impl_name_; this->full_direct_proxy_impl_name_ = 0; - delete [] this->base_proxy_broker_; - this->base_proxy_broker_ = 0; - - delete [] this->remote_proxy_broker_; - this->remote_proxy_broker_ = 0; - - delete [] this->strategized_proxy_broker_; - this->strategized_proxy_broker_ = 0; - - delete [] this->full_base_proxy_broker_name_; - this->full_base_proxy_broker_name_ = 0; - - delete [] this->full_remote_proxy_broker_name_; - this->full_remote_proxy_broker_name_ = 0; - - delete [] this->full_strategized_proxy_broker_name_; - this->full_strategized_proxy_broker_name_ = 0; - delete [] this->client_scope_; this->client_scope_ = 0; @@ -3043,34 +2970,6 @@ be_interface::gen_is_a_ancestors (TAO_OutStream *os) return 0; } -void -be_interface::gen_parent_collocation (TAO_OutStream *os) -{ - long n_parents = this->n_inherits (); - bool has_parent = false; - AST_Type **parents = this->inherits (); - - if (n_parents > 0) - { - for (long i = 0; i < n_parents; ++i) - { - be_interface *inherited = - be_interface::narrow_from_decl (parents[i]); - - if (!has_parent) - { - *os << be_nl; - } - - has_parent = true; - - *os << be_nl - << "this->" << inherited->flat_name () - << "_setup_collocation" << " ();"; - } - } -} - // ================================================================= class Facet_Op_Attr_Helper @@ -3379,84 +3278,6 @@ be_interface::is_ami4ccm_rh (bool val) } const char * -be_interface::base_proxy_impl_name (void) -{ - if (this->base_proxy_impl_name_ == 0) - { - this->base_proxy_impl_name_ = - this->create_with_prefix_suffix ( - this->tag_table_[GC_PREFIX], - this->local_name (), - this->suffix_table_[PROXY_IMPL]); - } - - return this->base_proxy_impl_name_; -} - -const char * -be_interface::full_base_proxy_impl_name (void) -{ - if (this->full_base_proxy_impl_name_ == 0) - { - const char *scope = this->client_enclosing_scope (); - const char *base_name = - this->base_proxy_impl_name (); - size_t length = - ACE_OS::strlen (scope) + ACE_OS::strlen (base_name); - - ACE_NEW_RETURN (this->full_base_proxy_impl_name_, - char[length + 1], - 0); - - ACE_OS::strcpy (this->full_base_proxy_impl_name_, - scope); - ACE_OS::strcat (this->full_base_proxy_impl_name_, - base_name); - } - - return this->full_base_proxy_impl_name_; -} - -const char * -be_interface::remote_proxy_impl_name (void) -{ - if (this->remote_proxy_impl_name_ == 0) - { - this->remote_proxy_impl_name_ = - this->create_with_prefix_suffix ( - this->tag_table_[GC_PREFIX], - this->local_name (), - this->suffix_table_[PROXY_IMPL], - this->tag_table_[REMOTE]); - } - - return this->remote_proxy_impl_name_; -} - -const char * -be_interface::full_remote_proxy_impl_name (void) -{ - if (this->full_remote_proxy_impl_name_ == 0) - { - const char *scope = this->client_enclosing_scope (); - const char *base_name = this->remote_proxy_impl_name (); - size_t length = - ACE_OS::strlen (scope) + ACE_OS::strlen (base_name); - - ACE_NEW_RETURN (this->full_remote_proxy_impl_name_, - char[length + 1], - 0); - - ACE_OS::strcpy (this->full_remote_proxy_impl_name_, - scope); - ACE_OS::strcat (this->full_remote_proxy_impl_name_, - base_name); - } - - return this->full_remote_proxy_impl_name_; -} - -const char * be_interface::direct_proxy_impl_name (void) { if (this->direct_proxy_impl_name_ == 0) @@ -3498,125 +3319,6 @@ be_interface::full_direct_proxy_impl_name (void) const char * -be_interface::base_proxy_broker_name (void) -{ - if (this->base_proxy_broker_ == 0) - { - this->base_proxy_broker_ = - this->create_with_prefix_suffix ( - this->tag_table_[GC_PREFIX], - this->local_name (), - this->suffix_table_[PROXY_BROKER]); - } - - return this->base_proxy_broker_; -} - -const char * -be_interface::full_base_proxy_broker_name (void) -{ - if (this->full_base_proxy_broker_name_ == 0) - { - const char *scope = this->client_enclosing_scope (); - const char *base_name = this->base_proxy_broker_name (); - size_t length = - ACE_OS::strlen (scope) + ACE_OS::strlen (base_name); - - ACE_NEW_RETURN (this->full_base_proxy_broker_name_, - char[length + 1], - 0); - - ACE_OS::strcpy (this->full_base_proxy_broker_name_, - scope); - ACE_OS::strcat (this->full_base_proxy_broker_name_, - base_name); - } - - return this->full_base_proxy_broker_name_; -} - - -const char * -be_interface::remote_proxy_broker_name (void) -{ - if (this->remote_proxy_broker_ == 0) - { - this->remote_proxy_broker_ = - this->create_with_prefix_suffix ( - this->tag_table_[GC_PREFIX], - this->local_name (), - this->suffix_table_[PROXY_BROKER], - this->tag_table_[REMOTE]); - } - - return this->remote_proxy_broker_; -} - -const char * -be_interface::full_remote_proxy_broker_name (void) -{ - if (this->full_remote_proxy_broker_name_ == 0) - { - const char *scope = this->client_enclosing_scope (); - const char *base_name = this->remote_proxy_broker_name (); - size_t length = - ACE_OS::strlen (scope) + ACE_OS::strlen (base_name); - - ACE_NEW_RETURN (this->full_remote_proxy_broker_name_, - char[length + 1], - 0); - - ACE_OS::strcpy (this->full_remote_proxy_broker_name_, - scope); - ACE_OS::strcat (this->full_remote_proxy_broker_name_, - base_name); - } - - return this->full_remote_proxy_broker_name_; -} - - -const char * -be_interface::strategized_proxy_broker_name (void) -{ - if (this->strategized_proxy_broker_ == 0) - { - this->strategized_proxy_broker_ = - this->create_with_prefix_suffix ( - this->tag_table_[GC_PREFIX], - this->local_name (), - this->suffix_table_[PROXY_BROKER], - this->tag_table_[STRATEGIZED]); - } - - return this->strategized_proxy_broker_; -} - -const char * -be_interface::full_strategized_proxy_broker_name (void) -{ - if (this->full_strategized_proxy_broker_name_ == 0) - { - const char *scope = this->server_enclosing_scope (); - const char *base_name = - this->strategized_proxy_broker_name (); - size_t length = - ACE_OS::strlen (scope) + ACE_OS::strlen (base_name); - - ACE_NEW_RETURN (this->full_strategized_proxy_broker_name_, - char[length + 1], - 0); - - ACE_OS::strcpy (this->full_strategized_proxy_broker_name_, - scope); - ACE_OS::strcat (this->full_strategized_proxy_broker_name_, - base_name); - } - - return this->full_strategized_proxy_broker_name_; -} - -const char * be_interface::client_enclosing_scope (void) { if (this->client_scope_ == 0) diff --git a/TAO/TAO_IDL/be/be_valuetype.cpp b/TAO/TAO_IDL/be/be_valuetype.cpp index badb282a429..fc16fb8e30d 100644 --- a/TAO/TAO_IDL/be/be_valuetype.cpp +++ b/TAO/TAO_IDL/be/be_valuetype.cpp @@ -779,94 +779,5 @@ be_valuetype::abstract_supports_helper (be_interface *, return 0; } -int -be_valuetype::gen_skel_helper (be_interface *concrete, - be_interface *ancestor, - TAO_OutStream *os) -{ - // If derived and ancestor are same, skip it. - if (concrete == ancestor) - { - return 0; - } - - // If an operation or an attribute is abstract (declared in an - // abstract interface), we will either generate the full - // definition (if there are no concrete interfaces between the - // abstract ancestor and us) or, if there is a concrete ancestor - // in between, we will catch its definition elsewhere in this - // traversal. - if (ancestor->is_abstract ()) - { - return 0; - } - - // Else generate code that does the cast to the appropriate type. - - if (ancestor->nmembers () > 0) - { - // If there are elements in ancestor scope i.e., any operations and - // attributes defined by "ancestor", become methods on the derived class - // which call the corresponding method of the base class by doing the - // proper casting. - - for (UTL_ScopeActiveIterator si (ancestor, UTL_Scope::IK_decls); - !si.is_done (); - si.next ()) - { - // Get the next AST decl node - AST_Decl *d = si.item (); - - if (d->node_type () == AST_Decl::NT_op) - { - // Start from current indentation level. - os->indent (); - - *os << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl_2; - - if (os->stream_type () == TAO_OutStream::TAO_SVR_HDR) - { - // Generate the static method corresponding to this method. - *os << "static void " << d->local_name () - << "_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest &req, " << be_nl - << "void *obj," << be_nl - << "void *context" << be_uidt_nl - << ");" << be_uidt << "\n\n"; - } - else - { // Generate code in the inline file. - // Generate the static method corresponding to this method. - *os << "ACE_INLINE void " - << concrete->full_skel_name () << "::" - << d->local_name () - << "_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest &req," << be_nl - << "void *obj," << be_nl - << "void *context" << be_uidt_nl - << ")" << be_uidt_nl - << "{" << be_idt_nl; - *os << ancestor->full_skel_name () - << "_ptr impl = (" - << concrete->full_skel_name () - << "_ptr) obj;" << be_nl; - *os << ancestor->full_skel_name () - << "::" << d->local_name () - << "_skel (" << be_idt << be_idt_nl - << "req," << be_nl - << "(" << ancestor->full_skel_name () - << "_ptr) impl," << be_nl - << "context" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl - << "}\n"; - } - } - } // End of scope iterator. - } - - return 0; -} - IMPL_NARROW_FROM_DECL (be_valuetype) IMPL_NARROW_FROM_SCOPE (be_valuetype) diff --git a/TAO/TAO_IDL/be/be_visitor_component/context_svs.cpp b/TAO/TAO_IDL/be/be_visitor_component/context_svs.cpp index f5f2749fe00..418165944e4 100644 --- a/TAO/TAO_IDL/be/be_visitor_component/context_svs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_component/context_svs.cpp @@ -488,8 +488,8 @@ be_visitor_context_svs::gen_uses_multiplex ( << "retv = iter->second;" << be_nl << "n = this->ciao_uses_" << port_name << "_.erase (key);" << be_uidt_nl - << "}" << be_uidt_nl - << "}" << be_uidt; + << "}" << be_uidt << be_uidt_nl + << "}"; os_ << be_nl_2 << "if (n != 1UL)" << be_idt_nl diff --git a/TAO/TAO_IDL/be/be_visitor_component/servant_svs.cpp b/TAO/TAO_IDL/be/be_visitor_component/servant_svs.cpp index cd9943a1671..649c69a3d78 100644 --- a/TAO/TAO_IDL/be/be_visitor_component/servant_svs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_component/servant_svs.cpp @@ -320,14 +320,20 @@ be_visitor_servant_svs::visit_provides (be_provides *node) << "this)," << be_uidt_nl << "::CORBA::NO_MEMORY ());" << be_uidt_nl << be_nl << "::CIAO::Port_Activator_var pa = tmp;" << be_nl_2 + << "::CIAO::Container_var cnt_safe =" << be_idt_nl + << "::CIAO::Container::_duplicate (" + << "this->container_.in ());" << be_uidt_nl << be_nl + << "if (::CORBA::is_nil (cnt_safe.in ()))" << be_idt_nl + << "{" << be_idt_nl << "throw ::CORBA::INV_OBJREF ();" << be_uidt_nl + << "}" << be_uidt_nl << be_nl << "::CIAO::Servant_Activator_var sa =" << be_idt_nl - << "this->container_->ports_servant_activator ();" + << "cnt_safe->ports_servant_activator ();" << be_uidt_nl << be_nl << "if (sa->register_port_activator (pa.in ()))" << be_idt_nl << "{" << be_idt_nl << "::CORBA::Object_var obj =" << be_idt_nl - << "this->container_->generate_reference (" << be_idt_nl + << "cnt_safe->generate_reference (" << be_idt_nl << "obj_id.c_str ()," << be_nl << "\"" << obj->repoID () << "\"," << be_nl << "::CIAO::Container_Types::FACET_CONSUMER_t);" diff --git a/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp index a1cecbb2468..f19f1a6d63d 100644 --- a/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp @@ -144,53 +144,53 @@ be_visitor_exception_any_op_cs::visit_exception (be_exception *node) << "// Copying insertion." << be_nl << "void operator<<= (" << be_idt << be_idt_nl << "::CORBA::Any &_tao_any," << be_nl - << "const ::" << node->name () << " &_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << "const ::" << node->name () << " &_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "TAO::Any_Dual_Impl_T< ::" << node->name () << ">::insert_copy (" << be_idt << be_idt_nl << "_tao_any," << be_nl << "::" << node->name () << "::_tao_any_destructor," << be_nl << "::" << node->tc_name () << "," << be_nl - << "_tao_elem" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl + << "_tao_elem);" << be_uidt + << be_uidt << be_uidt_nl << "}" << be_nl_2; // Non-copying insertion operator." *os << "// Non-copying insertion." << be_nl << "void operator<<= (" << be_idt << be_idt_nl << "::CORBA::Any &_tao_any," << be_nl - << "::" << node->name () << " *_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << "::" << node->name () << " *_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "TAO::Any_Dual_Impl_T< ::" << node->name () << ">::insert (" << be_idt << be_idt_nl << "_tao_any," << be_nl << "::" << node->name () << "::_tao_any_destructor," << be_nl << "::" << node->tc_name () << "," << be_nl - << "_tao_elem" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl + << "_tao_elem);" << be_uidt + << be_uidt << be_uidt_nl << "}" << be_nl_2; // Extraction to non-const pointer operator. *os << "// Extraction to non-const pointer (deprecated)." << be_nl << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl << "const ::CORBA::Any &_tao_any," << be_nl - << "::" << node->name () << " *&_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << "::" << node->name () << " *&_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "return _tao_any >>= const_cast<" << be_idt << be_idt_nl << "const ::" << node->name () << " *&> (" << be_nl - << "_tao_elem" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl + << "_tao_elem);" << be_uidt + << be_uidt << be_uidt_nl << "}" << be_nl_2; // Extraction to const pointer operator. *os << "// Extraction to const pointer." << be_nl << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl << "const ::CORBA::Any &_tao_any," << be_nl - << "const ::" << node->name () << " *&_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << "const ::" << node->name () << " *&_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "return" << be_idt_nl << "TAO::Any_Dual_Impl_T< ::" << node->name () << ">::extract (" @@ -198,8 +198,8 @@ be_visitor_exception_any_op_cs::visit_exception (be_exception *node) << "_tao_any," << be_nl << "::" << node->name () << "::_tao_any_destructor," << be_nl << "::" << node->tc_name () << "," << be_nl - << "_tao_elem" << be_uidt_nl - << ");" << be_uidt << be_uidt << be_uidt_nl + << "_tao_elem);" << be_uidt + << be_uidt << be_uidt << be_uidt_nl << "}"; be_util::gen_nested_namespace_end (os, module); @@ -219,8 +219,8 @@ be_visitor_exception_any_op_cs::visit_exception (be_exception *node) << "// Copying insertion." << be_nl << "void operator<<= (" << be_idt << be_idt_nl << "::CORBA::Any &_tao_any," << be_nl - << "const " << node->name () << " &_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << "const " << node->name () << " &_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "TAO::Any_Dual_Impl_T<" << node->name () << ">::insert_copy (" << be_idt << be_idt_nl @@ -235,8 +235,8 @@ be_visitor_exception_any_op_cs::visit_exception (be_exception *node) *os << "// Non-copying insertion." << be_nl << "void operator<<= (" << be_idt << be_idt_nl << "::CORBA::Any &_tao_any," << be_nl - << node->name () << " *_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << node->name () << " *_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "TAO::Any_Dual_Impl_T<" << node->name () << ">::insert (" << be_idt << be_idt_nl @@ -251,13 +251,13 @@ be_visitor_exception_any_op_cs::visit_exception (be_exception *node) *os << "// Extraction to non-const pointer (deprecated)." << be_nl << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl << "const ::CORBA::Any &_tao_any," << be_nl - << node->name () << " *&_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << node->name () << " *&_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "return _tao_any >>= const_cast<" << be_idt << be_idt_nl << "const " << node->name () << " *&> (" << be_nl - << "_tao_elem" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl + << "_tao_elem);" << be_uidt + << be_uidt << be_uidt_nl << "}" << be_nl_2; // Extraction to const pointer operator. @@ -273,8 +273,8 @@ be_visitor_exception_any_op_cs::visit_exception (be_exception *node) << "_tao_any," << be_nl << node->name () << "::_tao_any_destructor," << be_nl << node->tc_name () << "," << be_nl - << "_tao_elem" << be_uidt_nl - << ");" << be_uidt << be_uidt << be_uidt_nl + << "_tao_elem);" << be_uidt + << be_uidt << be_uidt << be_uidt_nl << "}"; *os << be_global->core_versioning_end () << be_nl; diff --git a/TAO/TAO_IDL/be/be_visitor_interface.cpp b/TAO/TAO_IDL/be/be_visitor_interface.cpp index 6326664887f..76d01092d19 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface.cpp @@ -79,10 +79,6 @@ #include "be_visitor_interface/smart_proxy_ch.cpp" #include "be_visitor_interface/smart_proxy_cs.cpp" -// Proxy Brokers -#include "be_visitor_interface/strategized_proxy_broker_sh.cpp" -#include "be_visitor_interface/strategized_proxy_broker_ss.cpp" - // Proxy Impls #include "be_visitor_interface/direct_proxy_impl_sh.cpp" #include "be_visitor_interface/direct_proxy_impl_ss.cpp" diff --git a/TAO/TAO_IDL/be/be_visitor_interface/amh_si.cpp b/TAO/TAO_IDL/be/be_visitor_interface/amh_si.cpp index 5a81582e537..11b3910effa 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/amh_si.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/amh_si.cpp @@ -12,8 +12,7 @@ //============================================================================= be_visitor_amh_interface_si::be_visitor_amh_interface_si ( - be_visitor_context *ctx - ) + be_visitor_context *ctx) : be_visitor_interface_si (ctx) { } @@ -40,9 +39,7 @@ be_visitor_amh_interface_si::visit_interface (be_interface *node) int status = node->traverse_inheritance_graph ( - be_visitor_amh_interface_si::gen_skel_helper, - os - ); + be_visitor_amh_interface_si::gen_skel_helper, os); if (status == -1) { @@ -141,8 +138,8 @@ be_visitor_amh_interface_si::gen_skel_helper (be_interface *derived, << "_skel (" << be_idt << be_idt_nl << "TAO_ServerRequest & req," << be_nl << "void * context," << be_nl - << "void * obj" << be_uidt_nl - << ")" << be_uidt_nl + << "void * obj)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl; *os << ancestor_amh_name << "* const impl = static_cast<" @@ -150,11 +147,11 @@ be_visitor_amh_interface_si::gen_skel_helper (be_interface *derived, << " *> (obj);" << be_nl; *os << ancestor_amh_name << "::" << d->local_name () - << "_skel (" << be_idt << be_idt_nl + << "_skel (" << be_idt_nl << "req," << be_nl << "context," << be_nl - << "impl" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl + << "impl);" << be_uidt + << be_uidt_nl << "}"; } else if (nt == AST_Decl::NT_attr) @@ -177,11 +174,11 @@ be_visitor_amh_interface_si::gen_skel_helper (be_interface *derived, << "_skel (" << be_idt << be_idt_nl << "TAO_ServerRequest & req," << be_nl << "void * context," << be_nl - << "void * obj" << be_uidt_nl - << ")" << be_uidt_nl + << "void * obj)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl; - *os << ancestor_amh_name + *os << ancestor_amh_name << "* const impl = static_cast<" << derived_amh_name << " *> (obj);" << be_nl; @@ -191,8 +188,8 @@ be_visitor_amh_interface_si::gen_skel_helper (be_interface *derived, << "_skel (" << be_idt << be_idt_nl << "req," << be_nl << "context," << be_nl - << "impl" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl + << "impl);" << be_uidt + << be_uidt << be_uidt_nl << "}"; if (!attr->readonly ()) @@ -209,11 +206,11 @@ be_visitor_amh_interface_si::gen_skel_helper (be_interface *derived, << "_skel (" << be_idt << be_idt_nl << "TAO_ServerRequest & req," << be_nl << "void * context," << be_nl - << "void * obj" << be_uidt_nl - << ")" << be_uidt_nl + << "void * obj)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl; - *os << ancestor_amh_name + *os << ancestor_amh_name << "* const impl = static_cast<" << derived_amh_name << " *> (obj);" << be_nl; @@ -223,8 +220,8 @@ be_visitor_amh_interface_si::gen_skel_helper (be_interface *derived, << "_skel (" << be_idt << be_idt_nl << "req," << be_nl << "context," << be_nl - << "impl" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl + << "impl);" << be_uidt + << be_uidt << be_uidt_nl << "}"; } } diff --git a/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp index 645b5640710..2822f200472 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp @@ -97,21 +97,9 @@ be_visitor_amh_interface_ss::this_method (be_interface *node) { *os << "TAO::AbstractBase_Narrow_Utils<STUB_SCOPED_NAME>::unchecked_narrow ("; } - *os << be_idt << be_idt_nl - << "obj.in ()," << be_nl; + *os << "obj.in ());" << be_nl; - if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) - { - *os << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function_pointer" << be_uidt_nl; - } - else - { - *os << "0" << be_uidt_nl; - } - - *os << ");" << be_uidt << be_uidt << be_uidt_nl + *os << be_uidt << be_uidt_nl << "}"; } @@ -221,14 +209,12 @@ public: be_interface *derived); }; -TAO_IDL_Copy_Ctor_Worker:: -TAO_IDL_Copy_Ctor_Worker (void) +TAO_IDL_Copy_Ctor_Worker::TAO_IDL_Copy_Ctor_Worker (void) { } int -TAO_IDL_Copy_Ctor_Worker:: -emit (be_interface *derived, +TAO_IDL_Copy_Ctor_Worker::emit (be_interface *derived, TAO_OutStream *os, be_interface *base) { @@ -278,12 +264,11 @@ be_visitor_amh_interface_ss::generate_copy_ctor (be_interface *node, node->get_insert_queue ().reset (); node->get_del_queue ().reset (); - // Insert ourselves in the queue. if (node->get_insert_queue ().enqueue_tail (node) == -1) { ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_interface::traverse_inheritance_graph - " + "(%N:%l) be_interface::generate_copy_ctor - " "error generating entries\n"), -1); } diff --git a/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp index 9794c4e8e0a..765b0e5174a 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp @@ -59,8 +59,8 @@ be_visitor_interface_any_op_cs::visit_interface (be_interface *node) << "::CORBA::Boolean" << be_nl << "Any_Impl_T<" << node->name () << ">::to_object (" << be_idt << be_idt_nl - << "::CORBA::Object_ptr &_tao_elem" << be_uidt_nl - << ") const" << be_uidt_nl + << "::CORBA::Object_ptr &_tao_elem) const" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "_tao_elem = ::CORBA::Object::_duplicate (this->value_);" << be_nl << "return true;" << be_uidt_nl @@ -78,8 +78,8 @@ be_visitor_interface_any_op_cs::visit_interface (be_interface *node) << "Any_Impl_T<" << node->name () << ">::to_abstract_base (" << be_idt << be_idt_nl - << "::CORBA::AbstractBase_ptr &_tao_elem" << be_uidt_nl - << ") const" << be_uidt_nl + << "::CORBA::AbstractBase_ptr &_tao_elem) const" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "_tao_elem = ::CORBA::AbstractBase::_duplicate (this->value_);" << be_nl diff --git a/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp index 5c81c3159a5..113ec5afd2a 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp @@ -117,28 +117,16 @@ be_visitor_interface_cdr_op_cs::visit_interface (be_interface *node) if (!node->is_abstract ()) { - *os << "TAO::Narrow_Utils<RHS_SCOPED_NAME>::unchecked_narrow ("; + *os << "TAO::Narrow_Utils<RHS_SCOPED_NAME>::unchecked_narrow (" + << "obj.in ());"; } else { - *os << "TAO::AbstractBase_Narrow_Utils<RHS_SCOPED_NAME>::unchecked_narrow ("; + *os << "TAO::AbstractBase_Narrow_Utils<RHS_SCOPED_NAME>::unchecked_narrow (" + << "obj.in ());"; } - *os << be_idt << be_idt_nl - << "obj.in ()," << be_nl; - - if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) - { - *os << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function_pointer"; - } - else - { - *os << "0"; - } - - *os << ");" << be_uidt << be_uidt_nl << be_uidt_nl; + *os << be_nl << be_uidt_nl; *os << "return true;" << be_uidt_nl << "}" << be_nl; diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp index 53fd3d60e3e..c7f2c0abd69 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp @@ -46,20 +46,6 @@ be_visitor_interface_ch::visit_interface (be_interface *node) AST_Component *c = AST_Component::narrow_from_decl (node); - if (c != 0) - { - // Forward class declarations for components. - *os << be_nl_2 - << "class " << node->base_proxy_impl_name () - << ";" << be_nl - << "class " << node->remote_proxy_impl_name () - << ";" << be_nl - << "class " << node->base_proxy_broker_name () - << ";" << be_nl - << "class " << node->remote_proxy_broker_name () - << ";"; - } - // Now generate the class definition. *os << be_nl_2 << "class " << be_global->stub_export_macro () @@ -183,18 +169,6 @@ be_visitor_interface_ch::visit_interface (be_interface *node) << "virtual std::ostream &_tao_stream_v (std::ostream &) const;"; } - if (! node->is_local () && - (be_global->gen_direct_collocation() - || be_global->gen_thru_poa_collocation ())) - { - // Add the Proxy Broker member variable. - *os << be_uidt_nl << be_nl - << "private:" << be_idt_nl - << "TAO::Collocation_Proxy_Broker *" - << "the" << node->base_proxy_broker_name () - << "_;"; - } - *os << be_uidt_nl << be_nl << "protected:" << be_idt_nl; @@ -209,18 +183,6 @@ be_visitor_interface_ch::visit_interface (be_interface *node) << node->local_name () << " (void);" << be_nl_2; } - - if (be_global->gen_direct_collocation() - || be_global->gen_thru_poa_collocation ()) - { - *os << "// These methods traverse the " - << "inheritance tree and set the" - << be_nl - << "// parents piece of the given class in the right mode." - << be_nl - << "virtual void " << node->flat_name () - << "_setup_collocation (void);" << be_nl_2; - } } if (node->is_abstract () || node->is_local ()) @@ -263,8 +225,6 @@ be_visitor_interface_ch::visit_interface (be_interface *node) { // Friends declarations, component only. *os << be_nl_2 - << "friend class " << node->remote_proxy_impl_name () - << ";" << be_nl << "friend class " << node->direct_proxy_impl_name () << ";"; } @@ -296,9 +256,6 @@ be_visitor_interface_ch::visit_interface (be_interface *node) // Don't support smart proxies for local interfaces. if (! node->is_local ()) { - // List that generates proxy broker factory function pointer. - be_global->non_local_interfaces.enqueue_tail (node); - if (be_global->gen_smart_proxies ()) { *os << be_nl_2; diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ci.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ci.cpp index 75a3f3b0ef7..e4944a84974 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ci.cpp @@ -93,13 +93,6 @@ be_visitor_interface_ci::visit_interface (be_interface *node) << "TAO_ORB_Core *oc)" << be_uidt_nl; *os << ": ::CORBA::Object (ior, oc)" << be_idt_nl; - if (be_global->gen_direct_collocation() - || be_global->gen_thru_poa_collocation ()) - { - *os << ", the" << node->base_proxy_broker_name () - << "_ (0)"; - } - *os << be_uidt << be_uidt_nl << "{" << be_nl << "}" ; diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp index e5036e6ee9c..3dbb0b43fbf 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp @@ -149,22 +149,6 @@ be_visitor_interface_cs::visit_interface (be_interface *node) << "}"; } - if (!node->is_local () && - (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ())) - { - // Generate the proxy broker factory function pointer definition. - *os << be_nl_2 - << "// Function pointer for collocation factory initialization." - << be_nl - << "TAO::Collocation_Proxy_Broker * " << be_nl - << "(*" << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function_pointer) (" - << be_idt << be_idt_nl - << "::CORBA::Object_ptr obj) = 0;" << be_uidt - << be_uidt; - } - // Generate code for the elements of the interface. if (this->visit_scope (node) == -1) { @@ -189,80 +173,15 @@ be_visitor_interface_cs::visit_interface (be_interface *node) << node->name () << "::" << node->local_name () << " (void)" << be_nl; - if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) - { - *os << " : the" << node->base_proxy_broker_name () << "_ (0)" << be_nl; - } - - *os << "{" << be_idt_nl; + *os << "{" << be_nl; - if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) - { - *os << "this->" << node->flat_name () - << "_setup_collocation ();" << be_uidt_nl; - } - *os << be_uidt << "}"; - } - - if (! node->is_local () && - (be_global->gen_direct_collocation() - || be_global->gen_thru_poa_collocation ())) - { - *os << be_nl_2 - << "void" << be_nl - << node->name () << "::" << node->flat_name () - << "_setup_collocation ()" << be_nl - << "{" << be_idt_nl - << "if (" << "::" - << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function_pointer"; - - // Right now (29-01-04) we don't support collocation for - // abstract interfaces, and the 'collocated' arg will always - // be 0. However, just to be safe, we add a - // check for non-zero collocation factory function pointer - // (which at present is also 0 for abstract interfaces), - // in case the logic is changed in the future. - if (node->is_abstract ()) - { - *os << " && " << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function_pointer"; - } - - *os << ")" << be_idt_nl - << "{" << be_idt_nl - << "this->the" << node->base_proxy_broker_name () - << "_ =" << be_idt_nl - << "::" << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function_pointer ("; - - if (node->is_abstract ()) - { - *os << be_idt << be_idt_nl - << "this->equivalent_objref ()" << be_uidt_nl - << ");" << be_uidt; - } - else - { - *os << "this);"; - } - - *os << be_uidt << be_uidt_nl - << "}" << be_uidt; - - // Now we setup the immediate parents. - node->gen_parent_collocation (os); - - *os << be_uidt_nl << "}"; + *os << "}"; } *os << be_nl_2 << node->name () << "::~" << node->local_name () << " (void)" << be_nl; - *os << "{}" << be_nl_2; + *os << "{" << be_nl << "}" << be_nl_2; bool gen_any_destructor = be_global->any_support () @@ -488,22 +407,18 @@ be_visitor_interface_cs::gen_xxx_narrow (const char *pre, << "proxy = TAO::Narrow_Utils<" << node->local_name () << ">::" << pre << " ("; - *os << be_idt << be_idt_nl - << "_tao_objref," << be_nl - << "\"" << node->repoID () << "\"," << be_nl; + *os << be_idt << be_idt_nl; - if (be_global->gen_direct_collocation() - || be_global->gen_thru_poa_collocation ()) - { - *os << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function_pointer" << be_uidt_nl; - } - else + *os << "_tao_objref"; + if (ACE_OS::strcmp (pre, "narrow") == 0) { - *os << "0" << be_uidt_nl; + *os << "," << be_nl + << "\"" << node->repoID () << "\""; } - *os << ");" << be_uidt << be_nl + + *os << ");"; + + *os << be_uidt << be_uidt << be_nl << "return TAO_" << node->flat_name () << "_PROXY_FACTORY_ADAPTER::instance ()->create_proxy (proxy);" << be_uidt << be_uidt_nl @@ -525,21 +440,17 @@ be_visitor_interface_cs::gen_xxx_narrow (const char *pre, } *os << be_idt << be_idt_nl - << "_tao_objref," << be_nl - << "\"" << node->repoID () << "\"," << be_nl; + << "_tao_objref"; - if (be_global->gen_direct_collocation() - || be_global->gen_thru_poa_collocation ()) - { - *os << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function_pointer" << be_uidt_nl; - } - else + if (ACE_OS::strcmp (pre, "narrow") == 0) { - *os << "0" << be_uidt_nl; + *os << "," << be_nl + << "\"" << node->repoID () << "\""; } - *os << ");" << be_uidt << be_uidt << be_uidt_nl + + *os << ");"; + + *os << be_uidt << be_uidt << be_uidt << be_uidt_nl << "}" << be_nl_2; } diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp index ab11005da9b..ece9840819c 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp @@ -90,8 +90,6 @@ be_visitor_interface_sh::visit_interface (be_interface *node) { *os << be_nl_2 << "class " << node->direct_proxy_impl_name () - << ";" << be_nl - << "class " << node->strategized_proxy_broker_name () << ";"; } @@ -224,25 +222,7 @@ be_visitor_interface_sh::visit_interface (be_interface *node) be_visitor_context ctx (*this->ctx_); - if (be_global->gen_direct_collocation ()) - { - ctx = *this->ctx_; - // Generate strategized proxy broker. - be_visitor_interface_strategized_proxy_broker_sh ispb_visitor (&ctx); - - if (node->accept (&ispb_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("be_visitor_interface_sh::") - ACE_TEXT ("visit_interface - ") - ACE_TEXT ("codegen for strategized ") - ACE_TEXT ("proxy broker class failed\n")), - -1); - } - } - // Generate the collocated class. - ctx = *this->ctx_; if (be_global->gen_direct_collocation ()) diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp index f3a13665ef4..465650b6dc1 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp @@ -78,8 +78,7 @@ be_visitor_interface_si::visit_interface (be_interface *node) status = node->traverse_inheritance_graph ( be_interface::gen_colloc_op_defn_helper, - os - ); + os); if (status == -1) { diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp index 5d212d693ee..e5b50920af8 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp @@ -534,9 +534,9 @@ be_visitor_interface_ss::visit_interface (be_interface *node) *os << "TAO_IFR_Client_Adapter *_tao_adapter =" << be_idt_nl << "ACE_Dynamic_Service<TAO_IFR_Client_Adapter>::instance (" << be_idt << be_idt_nl - << "TAO_ORB_Core::ifr_client_adapter_name ()" - << be_uidt_nl - << ");" << be_uidt_nl << be_uidt_nl; + << "TAO_ORB_Core::ifr_client_adapter_name ());" + << be_uidt + << be_uidt_nl << be_uidt_nl; *os << "if (!_tao_adapter)" << be_idt_nl << "{" << be_idt_nl << "throw ::CORBA::INTF_REPOS (::CORBA::OMGVMCID | 1, ::CORBA::COMPLETED_NO);" @@ -899,30 +899,19 @@ be_visitor_interface_ss::this_method (be_interface *node) *os << "::CORBA::Object_ptr tmp = CORBA::Object_ptr ();" << be_nl_2; - if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) - { - *os << "::CORBA::Boolean const _tao_opt_colloc =" - << be_idt_nl - << "stub->servant_orb_var ()->orb_core ()->" - << "optimize_collocation_objects ();" << be_uidt_nl << be_nl; - } + *os << "::CORBA::Boolean const _tao_opt_colloc =" + << be_idt_nl + << "stub->servant_orb_var ()->orb_core ()->" + << "optimize_collocation_objects ();" << be_uidt_nl << be_nl; + *os << "ACE_NEW_RETURN (" << be_idt << be_idt_nl << "tmp," << be_nl << "::CORBA::Object (stub, "; - if (be_global->gen_direct_collocation() - || be_global->gen_thru_poa_collocation ()) - { - *os << "_tao_opt_colloc"; - } - else - { - *os << "false"; - } + *os << "_tao_opt_colloc"; *os << ", this)," << be_nl - << "0" << be_uidt_nl - << ");" << be_uidt_nl << be_nl; + << "0);" << be_uidt << be_uidt_nl << be_nl; *os << "::CORBA::Object_var obj = tmp;" << be_nl << "(void) safe_stub.release ();" << be_nl_2 @@ -931,21 +920,9 @@ be_visitor_interface_ss::this_method (be_interface *node) << "return" << be_idt_nl << "TAO::Narrow_Utils<STUB_SCOPED_NAME>::unchecked_narrow (" << be_idt << be_idt_nl - << "obj.in ()," << be_nl; + << "obj.in ());"; - if (be_global->gen_direct_collocation() - || be_global->gen_thru_poa_collocation ()) - { - *os << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function_pointer" << be_uidt_nl; - } - else - { - *os << "0" << be_uidt_nl; - } - - *os << ");" << be_uidt << be_uidt << be_uidt_nl + *os << be_uidt << be_uidt << be_uidt << be_uidt_nl << "}"; } @@ -994,110 +971,8 @@ be_visitor_interface_ss::generate_amh_classes (be_interface *node) int be_visitor_interface_ss::generate_proxy_classes (be_interface *node) { - TAO_OutStream *os = this->ctx_->stream (); be_visitor_context ctx = *this->ctx_; - // Strategized Proxy Broker Implementation. - if (be_global->gen_thru_poa_collocation () - || be_global->gen_direct_collocation ()) - { - - // Do not generate strategized proxy broker for thru-POA case. - // It isn't necessary. - if (be_global->gen_direct_collocation ()) - { - ctx = *this->ctx_; - be_visitor_interface_strategized_proxy_broker_ss ispb_visitor (&ctx); - - if (node->accept (&ispb_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("be_visitor_interface_ss::") - ACE_TEXT ("generate_proxy_classes - ") - ACE_TEXT ("codegen for Base Proxy Broker ") - ACE_TEXT ("class failed\n")), - -1); - } - } - - if (be_global->gen_direct_collocation() - || be_global->gen_thru_poa_collocation ()) - { - *os << be_nl_2; - - *os << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__; - - // Proxy Broker Factory Function. - *os << be_nl_2 - << "TAO::Collocation_Proxy_Broker *" << be_nl - << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function ( ::CORBA::Object_ptr)" - << be_nl - << "{" << be_idt_nl - << "return"; - - if (be_global->gen_direct_collocation ()) - { - *os << be_idt_nl - << "::" - << node->full_strategized_proxy_broker_name () - << "::" <<"the" - << node->strategized_proxy_broker_name () - << " ();" << be_uidt; - } - else - { - // @@ HACK! - - // Dummy function pointer for the thru-POA case. It isn't - // used to call a function but it is used to determine if - // collocation is available. - - // @todo Change the way TAO's ORB_Core detects collocation, - // or at least augment it so that we don't have to - // resort this hack. - *os << " reinterpret_cast<TAO::Collocation_Proxy_Broker *> (0xdead);" - << " // Dummy"; - } - - *os << be_uidt_nl - << "}" << be_nl_2; - - // Proxy Broker Function Pointer Initializer. - *os << "int" << be_nl - << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_Initializer (size_t)" << be_nl - << "{" << be_idt_nl - << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function_pointer = " - << be_idt_nl - << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function;" - << be_uidt_nl - << be_nl - << "return 0;" << be_uidt_nl - << "}" << be_nl_2; - - *os << "static int" << be_nl - << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Stub_Factory_Initializer_Scarecrow =" - << be_idt_nl - << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_Initializer (" << be_idt << be_idt_nl - << "reinterpret_cast<size_t> (" - << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_Initializer));" << be_uidt << be_uidt << be_uidt_nl; - } - } - if (be_global->gen_direct_collocation ()) { ctx = *this->ctx_; diff --git a/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_sh.cpp deleted file mode 100644 index 8dddfb293be..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_sh.cpp +++ /dev/null @@ -1,89 +0,0 @@ -// -// $Id$ -// - -be_visitor_interface_strategized_proxy_broker_sh:: -be_visitor_interface_strategized_proxy_broker_sh (be_visitor_context *ctx) - : be_visitor_interface (ctx) -{ - // No-Op. -} - -be_visitor_interface_strategized_proxy_broker_sh:: -~be_visitor_interface_strategized_proxy_broker_sh (void) -{ - // No-Op. -} - -int -be_visitor_interface_strategized_proxy_broker_sh::visit_interface ( - be_interface *node - ) -{ - TAO_OutStream *os = this->ctx_->stream (); - - *os << be_nl_2 - << "///////////////////////////////////////////////////////////////////////" - << be_nl - << "// Strategized Proxy Broker Declaration " << be_nl - << "//" << be_nl_2; - - *os << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl_2; - - *os << "class " << be_global->skel_export_macro () << " " - << node->strategized_proxy_broker_name () << be_idt_nl - << ": public virtual " - << "TAO::Collocation_Proxy_Broker" << be_uidt_nl << "{" - << be_nl - << "public: " << be_idt; - - // Destructor - *os << be_nl - << "virtual ~" << node->strategized_proxy_broker_name () << " (void);"; - - *os << be_nl_2 - << "TAO::Collocation_Strategy " - << "get_strategy (::CORBA::Object_ptr obj);" << be_nl; - - *os << be_nl - << "void" << be_nl - << "dispatch (" << be_idt << be_idt_nl - << "::CORBA::Object_ptr obj," << be_nl - << "::CORBA::Object_out forward_obj," << be_nl - << "bool &is_forwarded," << be_nl - << "TAO::Argument ** args," << be_nl - << "int num_args," << be_nl - << "const char * op," << be_nl - << "size_t op_len," << be_nl - << "TAO::Collocation_Strategy strategy" << be_uidt_nl - << ");" << be_uidt_nl; - - *os << be_nl - << "static " << node->strategized_proxy_broker_name () - << " *" << be_nl - << "the" << node->strategized_proxy_broker_name () - << " (void);" << be_uidt_nl; - - *os << "};"; - - *os << be_nl_2 - << "//" << be_nl - << "// End Strategized Proxy Broker Declaration " << be_nl - << "///////////////////////////////////////////////////////////////////////" - << be_nl_2; - - return 0; -} - -int be_visitor_interface_strategized_proxy_broker_sh::visit_component ( - be_component *node) -{ - return this->visit_interface (node); -} - -int be_visitor_interface_strategized_proxy_broker_sh::visit_connector ( - be_connector *node) -{ - return this->visit_component (node); -} diff --git a/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_ss.cpp deleted file mode 100644 index 5aafa765692..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_ss.cpp +++ /dev/null @@ -1,121 +0,0 @@ -// -// $Id$ - -be_visitor_interface_strategized_proxy_broker_ss:: -be_visitor_interface_strategized_proxy_broker_ss (be_visitor_context *ctx) - : be_visitor_interface (ctx) -{ - // No-Op. -} - - -be_visitor_interface_strategized_proxy_broker_ss:: -~be_visitor_interface_strategized_proxy_broker_ss (void) -{ - // No-Op. -} - -int -be_visitor_interface_strategized_proxy_broker_ss::visit_interface ( - be_interface *node - ) -{ - TAO_OutStream *os = this->ctx_->stream (); - - // Generate the class declaration. - os->indent (); - - *os << be_nl - << "///////////////////////////////////////////////////////////////////////" - << be_nl - << "// Strategized Proxy Broker Implementation" << be_nl - << "//" << be_nl_2; - - *os << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl_2; - - *os << "// Global static proxy broker." << be_nl - << "static " << node->full_strategized_proxy_broker_name () << be_nl - << "tao_" << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << ";" << be_nl_2; - - *os << "// Factory function Implementation." << be_nl - << node->full_strategized_proxy_broker_name () - << " *" << be_nl - << node->full_strategized_proxy_broker_name () << "::the" - << node->strategized_proxy_broker_name () - << " (void)" << be_nl - << "{" << be_idt_nl - << "return &" << "tao_" << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () << ";" << be_uidt_nl - << "}" << be_nl_2; - - // Destructor Implementation. - *os << node->full_strategized_proxy_broker_name () << "::~" - << node->strategized_proxy_broker_name () << " (void)" << be_nl - << "{" << be_nl - << "}" << be_nl_2; - - // get_strategy() impementation. - *os << "TAO::Collocation_Strategy" << be_nl - << node->full_strategized_proxy_broker_name () << "::" - << "get_strategy (" << be_idt << be_idt_nl - << "::CORBA::Object_ptr obj)" << be_uidt << be_uidt_nl - << "{" << be_idt_nl - << "return TAO_ORB_Core::collocation_strategy (obj);" << be_uidt_nl - << "}" << be_nl_2; - - // create_proxy implementation - *os << "void" << be_nl - << node->full_strategized_proxy_broker_name () << "::" - << "dispatch (" << be_idt << be_idt_nl - << "::CORBA::Object_ptr obj," << be_nl - << "::CORBA::Object_out forward_obj," << be_nl - << "bool & is_forwarded," << be_nl - << "TAO::Argument ** args," << be_nl - << "int num_args," << be_nl - << "const char * op," << be_nl - << "size_t op_len," << be_nl - << "TAO::Collocation_Strategy strategy)" << be_uidt << be_uidt_nl - << "{" << be_idt_nl - << "TAO::Direct_Collocation_Upcall_Wrapper collocation_upcall_wrapper;" << be_nl - << "collocation_upcall_wrapper.upcall (" << be_idt_nl - << "obj," << be_nl - << "forward_obj," << be_nl - << "is_forwarded," << be_nl - << "args," << be_nl - << "num_args," << be_nl - << "op," << be_nl - << "op_len," << be_nl - << "strategy);" << be_uidt << be_uidt_nl - << "}"; - - *os << be_nl_2 - << "//" << be_nl - << "// End Strategized Proxy Broker Implementation" << be_nl - << "///////////////////////////////////////////////////////////////////////"; - - return 0; -} - -int -be_visitor_interface_strategized_proxy_broker_ss::visit_component ( - be_component *node) -{ - return this->visit_interface (node); -} - -int -be_visitor_interface_strategized_proxy_broker_ss::visit_connector ( - be_connector *node) -{ - return this->visit_component (node); -} - -void -be_visitor_interface_strategized_proxy_broker_ss::gen_direct_operations ( - be_interface *, - TAO_OutStream *) -{ -} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp index 1edecc7e41c..948d44f0d4a 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp @@ -131,17 +131,6 @@ be_visitor_operation_ami_cs::visit_operation (be_operation *node) << "::CORBA::Object::tao_object_initialize (this);" << be_uidt_nl << "}" << be_uidt_nl << be_nl; - - if (be_global->gen_direct_collocation() - || be_global->gen_thru_poa_collocation ()) - { - *os << "if (this->the_TAO_" << parent->local_name () - << "_Proxy_Broker_ == 0)" << be_idt_nl - << "{" << be_idt_nl - << parent->flat_name () << "_setup_collocation (" - << ");" << be_uidt_nl - << "}" << be_uidt; - } } // Includes the reply handler, but we have to add 1 for the retval anyway. @@ -192,8 +181,6 @@ be_visitor_operation_ami_cs::visit_operation (be_operation *node) << "};" << be_uidt; } - be_interface *intf = be_interface::narrow_from_decl (parent); - ACE_CString base (node->local_name ()->get_string ()); /// The sendc_* operation makes the invocation with the @@ -216,13 +203,14 @@ be_visitor_operation_ami_cs::visit_operation (be_operation *node) << "\"" << op_name << "\"," << be_nl << len << "," << be_nl; - if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) + *os << "TAO::TAO_CO_NONE"; + if (be_global->gen_direct_collocation()) { - *os << "this->the" << intf->base_proxy_broker_name () << "_"; + *os << " | TAO::TAO_CO_DIRECT_STRATEGY"; } - else + if (be_global->gen_thru_poa_collocation()) { - *os << "0"; + *os << " | TAO::TAO_CO_THRU_POA_STRATEGY"; } *os << be_uidt_nl diff --git a/TAO/TAO_IDL/be/be_visitor_operation/base_proxy_impl_ch.cpp b/TAO/TAO_IDL/be/be_visitor_operation/base_proxy_impl_ch.cpp deleted file mode 100644 index 2b2aa030fd0..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_operation/base_proxy_impl_ch.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// $Id$ - -be_visitor_operation_base_proxy_impl_ch:: -be_visitor_operation_base_proxy_impl_ch (be_visitor_context *ctx) - : be_visitor_scope (ctx) -{ -} - -be_visitor_operation_base_proxy_impl_ch:: -~be_visitor_operation_base_proxy_impl_ch (void) -{ -} - -int be_visitor_operation_base_proxy_impl_ch::visit_operation (be_operation *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - this->ctx_->node (node); - - *os << be_nl_2 << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl_2; - - *os << "virtual "; - - // STEP I: generate the return type. - be_type *bt = be_type::narrow_from_decl (node->return_type ()); - - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_sh::" - "visit_operation - " - "Bad return type\n"), - -1); - } - - be_visitor_context ctx (*this->ctx_); - be_visitor_operation_rettype oro_visitor (&ctx); - - if (bt->accept (&oro_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_sh::" - "visit_operation - " - "codegen for return type failed\n"), - -1); - } - - // STEP 2: generate the operation name - *os << this->ctx_->port_prefix ().c_str () - << " " << node->local_name (); - - // STEP 3: generate the argument list with the appropriate mapping. For these - // we grab a visitor that generates the parameter listing - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_BASE_PROXY_IMPL_CH); - be_visitor_operation_arglist oabpi_visitor (&ctx); - - if (node->accept (&oabpi_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_sh::" - "visit_operation - " - "codegen for argument list failed\n"), - -1); - } - - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/direct_proxy_impl_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/direct_proxy_impl_ss.cpp index b62d7224634..e9c60885335 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/direct_proxy_impl_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/direct_proxy_impl_ss.cpp @@ -54,7 +54,7 @@ be_visitor_operation_direct_proxy_impl_ss::visit_operation ( } *os << "// TAO_IDL - Generated from " << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl_2; + << "// " << __FILE__ << ":" << __LINE__ << be_nl; *os << "void" << be_nl << intf->full_direct_proxy_impl_name () << "::"; @@ -83,21 +83,11 @@ be_visitor_operation_direct_proxy_impl_ss::visit_operation ( *os << " args"; } - *os << "," << be_nl - << "int)" << be_uidt_nl; + *os << ")" << be_uidt_nl; *os << be_uidt_nl << "{" << be_idt_nl; -#if 0 - << "TAO::Portable_Server::Servant_Upcall servant_upcall (" - << be_idt << be_idt_nl - << "obj->_stubobj ()" - << "->servant_orb_var ()->orb_core ()" - << be_uidt_nl - << ");" << be_uidt_nl << be_nl; -#endif /*if 0*/ - if (!node->void_return_type ()) { *os << "((TAO::Arg_Traits< "; @@ -125,10 +115,9 @@ be_visitor_operation_direct_proxy_impl_ss::visit_operation ( *os << be_uidt; } - *os << be_uidt << be_uidt_nl; + *os << be_uidt << be_uidt << be_uidt_nl; - *os << be_uidt_nl - << "}" << be_nl; + *os << "}" << be_nl << be_nl; return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp index bf7102103a5..fe40b0d6b14 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp @@ -168,8 +168,7 @@ be_visitor_operation::gen_stub_operation_body ( if (node->has_native ()) // native exists => no stub { - if (this->gen_raise_exception ("::CORBA::MARSHAL", - "") == -1) + if (this->gen_raise_exception ("::CORBA::MARSHAL", "") == -1) { ACE_ERROR_RETURN (( LM_ERROR, @@ -195,16 +194,6 @@ be_visitor_operation::gen_stub_operation_body ( << "::CORBA::Object::tao_object_initialize (this);" << be_uidt_nl << "}" << be_uidt_nl << be_nl; - - if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) - { - *os << "if (this->the" << intf->base_proxy_broker_name () << "_ == 0)" - << be_idt_nl - << "{" << be_idt_nl - << intf->flat_name () << "_setup_collocation ();" - << be_uidt_nl - << "}" << be_uidt_nl << be_nl; - } } // Declare return type helper class. @@ -291,13 +280,14 @@ be_visitor_operation::gen_stub_operation_body ( *os << lname << "\"," << be_nl << len << "," << be_nl; - if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) + *os << "TAO::TAO_CO_NONE"; + if (be_global->gen_direct_collocation()) { - *os << "this->the" << intf->base_proxy_broker_name () << "_"; + *os << " | TAO::TAO_CO_DIRECT_STRATEGY"; } - else + if (be_global->gen_thru_poa_collocation()) { - *os << "0"; + *os << " | TAO::TAO_CO_THRU_POA_STRATEGY"; } if (node->flags () == AST_Operation::OP_oneway) diff --git a/TAO/TAO_IDL/be/be_visitor_operation/proxy_impl_xh.cpp b/TAO/TAO_IDL/be/be_visitor_operation/proxy_impl_xh.cpp index 711b4abb1b0..d2c9175b538 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/proxy_impl_xh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/proxy_impl_xh.cpp @@ -45,8 +45,8 @@ int be_visitor_operation_proxy_impl_xh::visit_operation (be_operation *node) *os << this->ctx_->port_prefix ().c_str () << node->local_name () << " (" << be_idt_nl << "TAO_Abstract_ServantBase *servant, " - << "TAO::Argument **args, " - << "int num_args);" << be_uidt_nl; + << "TAO::Argument **args);" + << be_uidt_nl; return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_operation/remote_proxy_impl_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/remote_proxy_impl_cs.cpp deleted file mode 100644 index 81436f6c775..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_operation/remote_proxy_impl_cs.cpp +++ /dev/null @@ -1,140 +0,0 @@ -// $Id$ - -// ************************************************************ -// Operation visitor for client stubs -// ************************************************************ - -be_visitor_operation_remote_proxy_impl_cs:: -be_visitor_operation_remote_proxy_impl_cs (be_visitor_context *ctx) - : be_visitor_operation (ctx) -{ -} - -be_visitor_operation_remote_proxy_impl_cs:: -~be_visitor_operation_remote_proxy_impl_cs (void) -{ -} - -// Processing to be done after every element in the scope is processed. -int -be_visitor_operation_remote_proxy_impl_cs::post_process (be_decl *bd) -{ - // All we do here is to insert a comma and a newline. - TAO_OutStream *os = this->ctx_->stream (); - - if (!this->last_node (bd)) - { - *os << "," << be_nl; - } - - return 0; -} - -int -be_visitor_operation_remote_proxy_impl_cs::visit_operation ( - be_operation *node - ) -{ - if (node->is_local ()) - { - return 0; - } - - TAO_OutStream *os = this->ctx_->stream (); - this->ctx_->node (node); - - // Retrieve the operation return type. - be_type *bt = be_type::narrow_from_decl (node->return_type ()); - - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::" - "visit_operation - " - "Bad return type\n"), - -1); - } - - *os << be_nl_2 << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl_2; - - // Generate the return type mapping (same as in the header file) - be_visitor_context ctx = *this->ctx_; - be_visitor_operation_rettype ort_visitor (&ctx); - - if (bt->accept (&ort_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::" - "visit_operation - " - "codegen for return type failed\n"), - -1); - } - - // Generate the operation name - be_decl* scope = be_scope::narrow_from_scope (node->defined_in ())->decl (); - be_interface *interface = be_interface::narrow_from_decl (scope); - - *os <<" " << interface->full_remote_proxy_impl_name () - << "::" << node->local_name (); - - // Generate the argument list with the appropriate mapping (same as - // in the header file). - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_PROXY_IMPL_XS); - be_visitor_operation_arglist arglist_visitor (&ctx); - - if (node->accept (&arglist_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::" - "visit_operation - " - "codegen for argument list failed\n"), - -1); - } - - // Generate the code for the operation body. - return this->gen_stub_operation_body (node, - bt); -} - -int -be_visitor_operation_remote_proxy_impl_cs::visit_argument (be_argument *node) -{ - // This method is used to generate the ParamData table entry. - - TAO_OutStream *os = this->ctx_->stream (); - be_type *bt = 0; - - // Retrieve the type for this argument. - bt = be_type::narrow_from_decl (node->field_type ()); - - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::" - "visit_argument - " - "Bad argument type\n"), - -1); - } - - os->indent (); - *os << "{" << bt->tc_name () << ", "; - - switch (node->direction ()) - { - case AST_Argument::dir_IN: - *os << "PARAM_IN, "; - break; - case AST_Argument::dir_INOUT: - *os << "PARAM_INOUT, "; - break; - case AST_Argument::dir_OUT: - *os << "PARAM_OUT, "; - break; - } - *os << "0}"; - - return 0; -} - diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp index ed167664904..d02650ec314 100644 --- a/TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp @@ -59,8 +59,6 @@ be_visitor_root_ch::visit_root (be_root *node) } } - this->gen_proxy_broker_factory_pointers (); - this->gen_ref_counting_overrides (); this->gen_static_corba_overrides (); @@ -153,8 +151,6 @@ be_visitor_root_ch::gen_arg_traits (be_root *node) void be_visitor_root_ch::gen_fwd_decls (void) { - // If this IDL file contains an non local interface declaration, generate a - // forward declaration of the proxy broker for a possible collocated call. if (idl_global->non_local_iface_seen_) { *o_ << be_nl_2 @@ -167,11 +163,6 @@ be_visitor_root_ch::gen_fwd_decls (void) << "namespace TAO" << be_nl << "{" << be_idt_nl; - if (be_global->gen_direct_collocation () || be_global->gen_thru_poa_collocation ()) - { - *o_ << "class Collocation_Proxy_Broker;" << be_nl; - } - if (idl_global->abstract_iface_seen_) { *o_ << "template<typename T> class AbstractBase_Narrow_Utils;" << be_nl; @@ -185,43 +176,6 @@ be_visitor_root_ch::gen_fwd_decls (void) } void -be_visitor_root_ch::gen_proxy_broker_factory_pointers (void) -{ - size_t size = be_global->non_local_interfaces.size (); - - if (size == 0) - { - return; - } - - size_t index = 0; - be_interface *i = 0; - - *o_ << be_nl_2 - << "// Proxy Broker Factory function pointer declarations." - << be_nl_2 - << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__; - - for (index = 0; index < size; ++index) - { - be_global->non_local_interfaces.dequeue_head (i); - - if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) - { - *o_ << be_nl_2 - << "extern " << be_global->stub_export_macro () << be_nl - << "TAO::Collocation_Proxy_Broker *" << be_nl - << "(*" << i->flat_client_enclosing_scope () - << i->base_proxy_broker_name () - << "_Factory_function_pointer) (" - << be_idt << be_idt_nl - << "::CORBA::Object_ptr obj);" << be_uidt << be_uidt; - } - } -} - -void be_visitor_root_ch::gen_ref_counting_overrides (void) { size_t size = be_global->non_defined_interfaces.size (); diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp index 4cd24333daa..dc695cb2c7f 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp @@ -241,8 +241,8 @@ be_visitor_sequence_any_op_cs::visit_sequence (be_sequence *node) *os << "// Non-copying insertion." << be_nl << "void operator<<= (" << be_idt << be_idt_nl << "::CORBA::Any &_tao_any," << be_nl - << "::" << node->name () << " *_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << "::" << node->name () << " *_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "TAO::Any_Dual_Impl_T< ::" << node->name () << ">::insert (" << be_idt << be_idt_nl @@ -257,8 +257,8 @@ be_visitor_sequence_any_op_cs::visit_sequence (be_sequence *node) *os << "// Extraction to non-const pointer (deprecated)." << be_nl << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl << "const ::CORBA::Any &_tao_any," << be_nl - << "::" << node->name () << " *&_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << "::" << node->name () << " *&_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "return _tao_any >>= const_cast<" << be_idt << be_idt_nl << "const ::" << node->name () << " *&> (" << be_nl @@ -270,8 +270,8 @@ be_visitor_sequence_any_op_cs::visit_sequence (be_sequence *node) *os << "// Extraction to const pointer." << be_nl << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl << "const ::CORBA::Any &_tao_any," << be_nl - << "const ::" << node->name () << " *&_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << "const ::" << node->name () << " *&_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "return" << be_idt_nl << "TAO::Any_Dual_Impl_T< ::" << node->name () << ">::extract (" @@ -298,8 +298,8 @@ be_visitor_sequence_any_op_cs::visit_sequence (be_sequence *node) << "// Copying insertion." << be_nl << "void operator<<= (" << be_idt << be_idt_nl << "::CORBA::Any &_tao_any," << be_nl - << "const " << node->name () << " &_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << "const " << node->name () << " &_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "if (0 == &_tao_elem) // Trying to de-reference NULL object" @@ -321,8 +321,8 @@ be_visitor_sequence_any_op_cs::visit_sequence (be_sequence *node) *os << "// Non-copying insertion." << be_nl << "void operator<<= (" << be_idt << be_idt_nl << "::CORBA::Any &_tao_any," << be_nl - << node->name () << " *_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << node->name () << " *_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "TAO::Any_Dual_Impl_T<" << node->name () << ">::insert (" << be_idt << be_idt_nl @@ -337,8 +337,8 @@ be_visitor_sequence_any_op_cs::visit_sequence (be_sequence *node) *os << "// Extraction to non-const pointer (deprecated)." << be_nl << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl << "const ::CORBA::Any &_tao_any," << be_nl - << node->name () << " *&_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << node->name () << " *&_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "return _tao_any >>= const_cast<" << be_idt << be_idt_nl << "const " << node->name () << " *&> (" << be_nl @@ -350,8 +350,8 @@ be_visitor_sequence_any_op_cs::visit_sequence (be_sequence *node) *os << "// Extraction to const pointer." << be_nl << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl << "const ::CORBA::Any &_tao_any," << be_nl - << "const " << node->name () << " *&_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << "const " << node->name () << " *&_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "return" << be_idt_nl << "TAO::Any_Dual_Impl_T<" << node->name () << ">::extract (" @@ -359,8 +359,8 @@ be_visitor_sequence_any_op_cs::visit_sequence (be_sequence *node) << "_tao_any," << be_nl << node->name () << "::_tao_any_destructor," << be_nl << (td != 0 ? td->tc_name () : node->tc_name ()) << "," << be_nl - << "_tao_elem" << be_uidt_nl - << ");" << be_uidt << be_uidt << be_uidt_nl + << "_tao_elem);" << be_uidt + << be_uidt << be_uidt << be_uidt_nl << "}"; *os << be_global->core_versioning_end () << be_nl; diff --git a/TAO/TAO_IDL/be/be_visitor_structure/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_structure/any_op_cs.cpp index d64029fdd43..f5becf9ca44 100644 --- a/TAO/TAO_IDL/be/be_visitor_structure/any_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_structure/any_op_cs.cpp @@ -108,11 +108,11 @@ be_visitor_structure_any_op_cs::visit_structure (be_structure *node) be_util::gen_nested_namespace_begin (os, module); // Copying insertion. - *os << "// Copying insertion." << be_nl + *os << "/// Copying insertion." << be_nl << "void operator<<= (" << be_idt << be_idt_nl << "::CORBA::Any &_tao_any," << be_nl - << "const ::" << node->name () << " &_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << "const ::" << node->name () << " &_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "if (0 == &_tao_elem) // Trying to de-reference NULL object" << be_idt_nl @@ -125,45 +125,45 @@ be_visitor_structure_any_op_cs::visit_structure (be_structure *node) << "_tao_any," << be_nl << "::" << node->name () << "::_tao_any_destructor," << be_nl << "::" << node->tc_name () << "," << be_nl - << "_tao_elem" << be_uidt_nl - << ");" << be_uidt << be_uidt << be_uidt_nl + << "_tao_elem);" << be_uidt + << be_uidt << be_uidt << be_uidt_nl << "}" << be_nl_2; // Non-copying insertion. - *os << "// Non-copying insertion." << be_nl + *os << "/// Non-copying insertion." << be_nl << "void operator<<= (" << be_idt << be_idt_nl << "::CORBA::Any &_tao_any, ::" << be_nl - << node->name () << " *_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << node->name () << " *_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "TAO::Any_Dual_Impl_T< ::" << node->name () << ">::insert (" << be_idt << be_idt_nl << "_tao_any," << be_nl << "::" << node->name () << "::_tao_any_destructor," << be_nl << "::" << node->tc_name () << "," << be_nl - << "_tao_elem" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl + << "_tao_elem);" << be_uidt + << be_uidt << be_uidt_nl << "}" << be_nl_2; // Extraction to non-const pointer (deprecated, just calls the other). - *os << "// Extraction to non-const pointer (deprecated)." << be_nl + *os << "/// Extraction to non-const pointer (deprecated)." << be_nl << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl << "const ::CORBA::Any &_tao_any," << be_nl - << "::" << node->name () << " *&_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << "::" << node->name () << " *&_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "return _tao_any >>= const_cast<" << be_idt << be_idt_nl << "const ::" << node->name () << " *&> (" << be_nl - << "_tao_elem" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl + << "_tao_elem);" << be_uidt + << be_uidt << be_uidt_nl << "}" << be_nl_2; // Extraction to const pointer. - *os << "// Extraction to const pointer." << be_nl + *os << "/// Extraction to const pointer." << be_nl << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl << "const ::CORBA::Any &_tao_any," << be_nl - << "const ::" << node->name () << " *&_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << "const ::" << node->name () << " *&_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "return" << be_idt_nl << "TAO::Any_Dual_Impl_T< ::" << node->name () << ">::extract (" @@ -186,11 +186,11 @@ be_visitor_structure_any_op_cs::visit_structure (be_structure *node) *os << be_global->core_versioning_begin () << be_nl; // Copying insertion. - *os << "// Copying insertion." << be_nl - << "void operator<<= (" << be_idt << be_idt_nl + *os << "/// Copying insertion." << be_nl + << "void operator<<= (" << be_idt_nl << "::CORBA::Any &_tao_any," << be_nl - << "const " << node->name () << " &_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << "const " << node->name () << " &_tao_elem)" + << be_uidt_nl << "{" << be_idt_nl << "if (0 == &_tao_elem) // Trying to de-reference NULL object" << be_idt_nl @@ -198,58 +198,58 @@ be_visitor_structure_any_op_cs::visit_structure (be_structure *node) << "else" << be_idt_nl << "TAO::Any_Dual_Impl_T<" << node->name () << ">::insert_copy (" - << be_idt << be_idt_nl + << be_idt_nl << "_tao_any," << be_nl << node->name () << "::_tao_any_destructor," << be_nl << node->tc_name () << "," << be_nl - << "_tao_elem" << be_uidt_nl - << ");" << be_uidt << be_uidt << be_uidt_nl + << "_tao_elem);" + << be_uidt << be_uidt << be_uidt_nl << "}" << be_nl_2; // Non-copying insertion. - *os << "// Non-copying insertion." << be_nl - << "void operator<<= (" << be_idt << be_idt_nl + *os << "/// Non-copying insertion." << be_nl + << "void operator<<= (" << be_idt_nl << "::CORBA::Any &_tao_any," << be_nl - << node->name () << " *_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << node->name () << " *_tao_elem)" + << be_uidt_nl << "{" << be_idt_nl << "TAO::Any_Dual_Impl_T<" << node->name () << ">::insert (" - << be_idt << be_idt_nl + << be_idt_nl << "_tao_any," << be_nl << node->name () << "::_tao_any_destructor," << be_nl << node->tc_name () << "," << be_nl - << "_tao_elem" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl + << "_tao_elem);" + << be_uidt << be_uidt_nl << "}" << be_nl_2; // Extraction to non-const pointer (deprecated, just calls the other). - *os << "// Extraction to non-const pointer (deprecated)." << be_nl - << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl + *os << "/// Extraction to non-const pointer (deprecated)." << be_nl + << "::CORBA::Boolean operator>>= (" << be_idt_nl << "const ::CORBA::Any &_tao_any," << be_nl - << node->name () << " *&_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << node->name () << " *&_tao_elem)" + << be_uidt_nl << "{" << be_idt_nl << "return _tao_any >>= const_cast<" << be_idt << be_idt_nl << "const " << node->name () << " *&> (" << be_nl - << "_tao_elem" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl + << "_tao_elem);" << be_uidt + << be_uidt << be_uidt_nl << "}" << be_nl_2; // Extraction to const pointer. - *os << "// Extraction to const pointer." << be_nl - << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl + *os << "/// Extraction to const pointer." << be_nl + << "::CORBA::Boolean operator>>= (" << be_idt_nl << "const ::CORBA::Any &_tao_any," << be_nl - << "const " << node->name () << " *&_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << "const " << node->name () << " *&_tao_elem)" + << be_uidt_nl << "{" << be_idt_nl << "return" << be_idt_nl << "TAO::Any_Dual_Impl_T<" << node->name () << ">::extract (" - << be_idt << be_idt_nl + << be_idt_nl << "_tao_any," << be_nl << node->name () << "::_tao_any_destructor," << be_nl << node->tc_name () << "," << be_nl - << "_tao_elem" << be_uidt_nl - << ");" << be_uidt << be_uidt << be_uidt_nl + << "_tao_elem);" + << be_uidt << be_uidt << be_uidt_nl << "}"; *os << be_global->core_versioning_end () << be_nl; diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_sh.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_sh.cpp index a7b20bd1351..29ed2af7efc 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_sh.cpp @@ -78,12 +78,6 @@ be_visitor_valuetype_sh::visit_valuetype (be_valuetype *node) *os << "class " << node->direct_proxy_impl_name () << ";" << be_nl; } - if (be_global->gen_direct_collocation ()) - { - *os << "class " << node->strategized_proxy_broker_name () - << ";" << be_nl; - } - *os << be_nl; // Now generate the class definition. diff --git a/TAO/TAO_IDL/be_include/be_component.h b/TAO/TAO_IDL/be_include/be_component.h index 0122cdb0f15..07a91da0ed4 100644 --- a/TAO/TAO_IDL/be_include/be_component.h +++ b/TAO/TAO_IDL/be_include/be_component.h @@ -77,9 +77,6 @@ public: /// Generate the string compares for ancestors in _is_a(). virtual int gen_is_a_ancestors (TAO_OutStream *os); - /// Generate setup_collocation() for base component, if any. - virtual void gen_parent_collocation (TAO_OutStream *os); - // Narrowing. DEF_NARROW_FROM_DECL (be_component); diff --git a/TAO/TAO_IDL/be_include/be_global.h b/TAO/TAO_IDL/be_include/be_global.h index cdb382f7526..4838d0b77ff 100644 --- a/TAO/TAO_IDL/be_include/be_global.h +++ b/TAO/TAO_IDL/be_include/be_global.h @@ -766,10 +766,6 @@ public: /// Cleanup function. void destroy (void); - /// Used in the generation of declarations for - /// xxx_Proxy_Broker_Factory_function_pointer. - ACE_Unbounded_Queue<be_interface *> non_local_interfaces; - /// Used in the generation of extern function declarations so we /// can use non-defined interfaces as members and parameters. ACE_Unbounded_Queue<be_interface_fwd *> non_defined_interfaces; diff --git a/TAO/TAO_IDL/be_include/be_interface.h b/TAO/TAO_IDL/be_include/be_interface.h index 2591251a3b8..65bb4bec8ee 100644 --- a/TAO/TAO_IDL/be_include/be_interface.h +++ b/TAO/TAO_IDL/be_include/be_interface.h @@ -69,20 +69,6 @@ public: /// Retrieve the fully qualified collocated class name. const char *local_coll_name (int); - /// retrieve the name of the base proxy implementation. - virtual const char *base_proxy_impl_name (void); - - /// retrieve the fully qualified name of the base proxy - /// implementation. - virtual const char *full_base_proxy_impl_name (void); - - /// retrieve the name of the remote proxy implementation. - virtual const char *remote_proxy_impl_name (void); - - /// retrieve the fully qualified name of the remote - /// proxy implementation. - virtual const char *full_remote_proxy_impl_name (void); - /// retrieve the name of the direct proxy implementation. virtual const char *direct_proxy_impl_name (void); @@ -90,26 +76,6 @@ public: /// implementation. virtual const char *full_direct_proxy_impl_name (void); - /// retrieve the name of the base proxy broker. - virtual const char *base_proxy_broker_name (void); - - /// retrieve the fully qualified name of the base proxy broker. - virtual const char *full_base_proxy_broker_name (void); - - /// retrieve the name of the remote proxy broker implementation. - virtual const char *remote_proxy_broker_name (void); - - /// retrieve the fully qualified name of the remote proxy broker - /// implementation. - virtual const char *full_remote_proxy_broker_name (void); - - /// retrieve the name of the strategized proxy broker implementation. - virtual const char *strategized_proxy_broker_name (void); - - /// retrieve the fully qualified name of the strategized proxy broker - /// implementation. - virtual const char *full_strategized_proxy_broker_name (void); - /// Return the client scope that encloses the interface. virtual const char *client_enclosing_scope (void); @@ -344,9 +310,6 @@ public: /// Generate the string compares for ancestors in _is_a(). virtual int gen_is_a_ancestors (TAO_OutStream *os); - /// Generate setup_collocation() for base component, if any. - virtual void gen_parent_collocation (TAO_OutStream *os); - protected: /** * CDreate a new string made by the concatenation @@ -362,16 +325,12 @@ protected: enum Suffix_Code { PROXY_IMPL = 0, - PROXY_BROKER = 1 }; enum Tag_Code { - THRU_POA = 0, - DIRECT = 1, - REMOTE = 2, - STRATEGIZED = 3, - GC_PREFIX = 4 // Prefix used for the generated class + DIRECT = 0, + GC_PREFIX = 1 // Prefix used for the generated class // This prefix is used to avoid name conflicts // with the user classes. }; @@ -380,23 +339,10 @@ protected: static const char *tag_table_[]; // Proxy Implementation names. - char *base_proxy_impl_name_; - char *remote_proxy_impl_name_; char *direct_proxy_impl_name_; - char *full_base_proxy_impl_name_; - char *full_remote_proxy_impl_name_; char *full_direct_proxy_impl_name_; - // Proxy Broker Names. - char *base_proxy_broker_; - char *remote_proxy_broker_; - char *strategized_proxy_broker_; - - char *full_base_proxy_broker_name_; - char *full_remote_proxy_broker_name_; - char *full_strategized_proxy_broker_name_; - char *client_scope_; char *flat_client_scope_; diff --git a/TAO/TAO_IDL/be_include/be_valuetype.h b/TAO/TAO_IDL/be_include/be_valuetype.h index c92b4952dcd..ae090cbc735 100644 --- a/TAO/TAO_IDL/be_include/be_valuetype.h +++ b/TAO/TAO_IDL/be_include/be_valuetype.h @@ -126,12 +126,6 @@ public: be_interface *base, TAO_OutStream *os); - /// Helper method to generate *_skel operations for the concrete - /// interface that we support (if any) and those of its base classes. - static int gen_skel_helper (be_interface *node, - be_interface *base, - TAO_OutStream *os); - /// Accessor to the member. const char *fwd_helper_name (void) const; diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface.h b/TAO/TAO_IDL/be_include/be_visitor_interface.h index 516196294a6..740fa08dcae 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_interface.h +++ b/TAO/TAO_IDL/be_include/be_visitor_interface.h @@ -42,10 +42,6 @@ #include "be_visitor_interface/smart_proxy_ch.h" #include "be_visitor_interface/smart_proxy_cs.h" -// Proxy Brokers -#include "be_visitor_interface/strategized_proxy_broker_sh.h" -#include "be_visitor_interface/strategized_proxy_broker_ss.h" - // Proxy Impls #include "be_visitor_interface/direct_proxy_impl_sh.h" #include "be_visitor_interface/direct_proxy_impl_ss.h" diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/amh_si.h b/TAO/TAO_IDL/be_include/be_visitor_interface/amh_si.h index bbd8e6723c4..77eb09dc377 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_interface/amh_si.h +++ b/TAO/TAO_IDL/be_include/be_visitor_interface/amh_si.h @@ -21,11 +21,11 @@ public: int visit_interface (be_interface *node); + // Helper method passed to the template method to generate code for the + // AMH skeletons in the inline files. static int gen_skel_helper (be_interface *, be_interface *, TAO_OutStream *); - // Helper method passed to the template method to generate code for the - // AMH skeletons in the inline files. }; #endif /* AMH_SH_I_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/strategized_proxy_broker_sh.h b/TAO/TAO_IDL/be_include/be_visitor_interface/strategized_proxy_broker_sh.h deleted file mode 100644 index 36d89682895..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_interface/strategized_proxy_broker_sh.h +++ /dev/null @@ -1,47 +0,0 @@ -//============================================================================= -/** - * @file strategized_proxy_broker_sh.h - * - * $Id$ - * - * Concrete visitor for the Interface node. This - * visitor generates the declaration for the strategized - * ProxyBroker class. - * - * - * @author Angelo Corsaro <corsaro@cs.wustl.edu> - */ -//============================================================================= - - -#ifndef BE_STRATEGIZED_PROXY_BROKER_SH_H_ -#define BE_STRATEGIZED_PROXY_BROKER_SH_H_ - -/** - * @class be_visitor_interface_strategized_proxy_broker_sh - * - * @brief Generates the declaration for the base proxy - * broker class. - */ -class be_visitor_interface_strategized_proxy_broker_sh : public be_visitor_interface -{ - -public: - // -- Ctor/Dtor Decl. -- - be_visitor_interface_strategized_proxy_broker_sh (be_visitor_context *ctx); - - virtual ~be_visitor_interface_strategized_proxy_broker_sh (void); - - /// visit an interface - virtual int visit_interface (be_interface *node); - - /// This will just call the above method - no need to create - /// another set of visitors for this stuff. - virtual int visit_component (be_component *node); - - /// This will just call the above method - no need to create - /// another set of visitors for this stuff. - virtual int visit_connector (be_connector *node); -}; - -#endif /* BE_STRATEGIZED_PROXY_BROKER_SH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/strategized_proxy_broker_ss.h b/TAO/TAO_IDL/be_include/be_visitor_interface/strategized_proxy_broker_ss.h deleted file mode 100644 index 8962eed07f8..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_interface/strategized_proxy_broker_ss.h +++ /dev/null @@ -1,49 +0,0 @@ -//============================================================================= -/** - * @file strategized_proxy_broker_ss.h - * - * $Id$ - * - * Concrete visitor for the Interface node. This - * visitor generates the declaration for the strategized - * ProxyBroker class. - * - * - * @author Angelo Corsaro <corsaro@cs.wustl.edu> - */ -//============================================================================= - -#ifndef BE_STRATEGIZED_PROXY_BROKER_SS_H_ -#define BE_STRATEGIZED_PROXY_BROKER_SS_H_ - -/** - * @class be_visitor_interface_direct_proxy_impl_ss - * - * @brief Generates the implementation for the base proxy - * broker class. - */ -class be_visitor_interface_strategized_proxy_broker_ss - : public be_visitor_interface -{ -public: - // -- Ctor/Dtor Decl. -- - be_visitor_interface_strategized_proxy_broker_ss (be_visitor_context *ctx); - - virtual ~be_visitor_interface_strategized_proxy_broker_ss (void); - - /// visit an interface - virtual int visit_interface (be_interface *node); - - /// This will just call the above method - no need to create - /// another set of visitors for this stuff. - virtual int visit_component (be_component *node); - - /// This will just call the above method - no need to create - /// another set of visitors for this stuff. - virtual int visit_connector (be_connector *node); - -private: - void gen_direct_operations (be_interface *node, TAO_OutStream *os); -}; - -#endif /* BE_STRATEGIZED_PROXY_BROKER_SS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/base_proxy_impl_ch.h b/TAO/TAO_IDL/be_include/be_visitor_operation/base_proxy_impl_ch.h deleted file mode 100644 index 6634ce65a66..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/base_proxy_impl_ch.h +++ /dev/null @@ -1,40 +0,0 @@ -//============================================================================= -/** - * @file base_proxy_impl_ch.h - * - * $Id$ - * - * Visitor for generating code for proxy implementations. - * - * - * @author Angelo Corsaro - */ -//============================================================================= - - -#ifndef _BE_VISITOR_OPERATION_BASE_PROXY_IMPL_CH_H_ -#define _BE_VISITOR_OPERATION_BASE_PROXY_IMPL_CH_H_ - - -/** - * @class be_visitor_operation_base_proxy_impl_ch - * - * @brief be_visitor_operation_base_proxy_impl_ch - * - * Concrete visitor that generates the code for the base class - * of Proxy Impls. - */ -class be_visitor_operation_base_proxy_impl_ch : public be_visitor_scope -{ -public: - /// constructor - be_visitor_operation_base_proxy_impl_ch (be_visitor_context *ctx); - - /// destructor - ~be_visitor_operation_base_proxy_impl_ch (void); - - /// visit operation. - virtual int visit_operation (be_operation *node); -}; - -#endif /* _BE_VISITOR_OPERATION_BASE_PROXY_IMPL_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/remote_proxy_impl_cs.h b/TAO/TAO_IDL/be_include/be_visitor_operation/remote_proxy_impl_cs.h deleted file mode 100644 index cbc22ba84d7..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/remote_proxy_impl_cs.h +++ /dev/null @@ -1,54 +0,0 @@ -//============================================================================= -/** - * @file remote_proxy_impl_cs.h - * - * $Id$ - * - * Visitor for generating code for remote proxy impls - * in client stubs. - * - * - * - * @author Aniruddha Gokhale & Angelo Corsaro - */ -//============================================================================= - - -#ifndef _BE_VISITOR_OPERATION_REMOTE_PROXY_IMPL_OPERATION_REMOTE_PROXY_IMPL_CS_H_ -#define _BE_VISITOR_OPERATION_REMOTE_PROXY_IMPL_OPERATION_REMOTE_PROXY_IMPL_CS_H_ - -// ************************************************************ -// Operation_Remote_Proxy_Impl visitor for client stubs -// ************************************************************ - -/** - * @class be_visitor_operation_remote_proxy_impl_cs - * - * @brief be_visitor_operation_remote_proxy_impl_cs - * - * This is a concrete visitor to generate the client invocation - * code for the Remote Proxy Implementation. - */ -class be_visitor_operation_remote_proxy_impl_cs : public be_visitor_operation -{ -public: - /// constructor - be_visitor_operation_remote_proxy_impl_cs (be_visitor_context *ctx); - - /// destructor - ~be_visitor_operation_remote_proxy_impl_cs (void); - - /// visit operation_remote_proxy_impl. - virtual int visit_operation (be_operation *node); - - /// visit argument to generate ParamData entries - virtual int visit_argument (be_argument *node); - - // = template methods - - // =helper - /// stuff to output after every member of the scope is handled - virtual int post_process (be_decl *); -}; - -#endif /* _BE_VISITOR_OPERATION_REMOTE_PROXY_IMPL_OPERATION_REMOTE_PROXY_IMPL_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_ch.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_ch.h index 8bf913f21db..14ac16e5a56 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_root/root_ch.h +++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_ch.h @@ -44,7 +44,6 @@ private: /// the main scope traversal. int gen_arg_traits (be_root *node); void gen_fwd_decls (void); - void gen_proxy_broker_factory_pointers (void); void gen_ref_counting_overrides (void); void gen_static_corba_overrides (void); int gen_obv_decls (be_root *node); diff --git a/TAO/bin/tao_orb_tests.lst b/TAO/bin/tao_orb_tests.lst index 9fd01633c5f..2021797303f 100644 --- a/TAO/bin/tao_orb_tests.lst +++ b/TAO/bin/tao_orb_tests.lst @@ -34,6 +34,13 @@ TAO/tests/AMH_Exceptions/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO ! TAO/tests/AMH_Oneway/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !DISABLE_ToFix_LynxOS_x86 !ACE_FOR_TAO TAO/tests/CORBA_e_Implicit_Activation/run_test.pl: CORBA_E_COMPACT TAO/tests/Collocation/run_test.pl: !ACE_FOR_TAO +TAO/tests/Collocated_NoColl/run_test.pl: !ST +TAO/tests/Collocated_DerivedIF/run_test.pl: !ST +TAO/tests/Collocated_Best/Collocated_Best_Direct/run_test.pl: !ST +TAO/tests/Collocated_Best/Collocated_Best_NoColl/run_test.pl: !ST +TAO/tests/Collocated_Best/Collocated_Best_ThuP/run_test.pl: !ST +TAO/tests/Collocated_ThruP_Sp/run_test.pl: !ST +TAO/tests/Collocated_ThruP_Sp_Gd/run_test.pl: !ST TAO/tests/Collocation_Tests/run_test.pl: !ST TAO/tests/Collocation_Opportunities/run_test.pl: !ST !CORBA_E_MICRO TAO/tests/Collocation_Oneway_Tests/run_test.pl: !ST !NO_MESSAGING !CORBA_E_MICRO @@ -304,6 +311,7 @@ TAO/tests/POA/Default_Servant2/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_M TAO/tests/POA/Explicit_Activation/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ACE_FOR_TAO TAO/tests/POA/FindPOA/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO TAO/tests/POA/NewPOA/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO +TAO/tests/POA/On_Demand_Act_Direct_Coll/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !STATIC !ACE_FOR_TAO TAO/tests/POA/On_Demand_Activation/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !STATIC !ACE_FOR_TAO TAO/tests/POA/On_Demand_Loading/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !STATIC !KCC_Linux !ACE_FOR_TAO TAO/tests/POA/Reference_Counted_Servant/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ACE_FOR_TAO diff --git a/TAO/docs/Options.html b/TAO/docs/Options.html index fd8b5147c48..40995028e39 100644 --- a/TAO/docs/Options.html +++ b/TAO/docs/Options.html @@ -385,17 +385,20 @@ treated as collocated. When <em>no</em> is specified, no objects are treated as collocated. </td> </tr> <tr> - <td><code>-ORBCollocationStrategy</code> <em>thru_poa/direct</em> + <td><code>-ORBCollocationStrategy</code> <em>thru_poa/direct/best</em> </td> - <td>Specifies what type of collocated object to use. If the <code>thru_poa</code> -(default) strategy is used, TAO uses the collocation object + <td>Specifies what type of collocated object to use. If not specified +the TAO_DEFAULT_COLLOCATION_STRATEGY default (default on thru_poa) is used. +If the <code>thru_poa</code> strategy is used, TAO uses the collocation object implementation that respects POA's current state and policies. When using the <code>direct</code> strategy, method invocations on collocated objects become direct calls to servant without checking POA's status, which can increase performance. If you use the <code>direct</code> strategy, your interfaces must be compiled with the <code><a href="compiler.html#collocation-stubs">-Gd</a></code> IDL <a - href="compiler.html">compiler option</a>. </td> + href="compiler.html">compiler option</a>. If you choose for the <code>best</code> strategy, + TAO tries to perform the best possible collocation, first <code>direct</code> collocation if possible, +else <code>thru_poa</code> collocation if possible and otherwise no collocation. </td> </tr> <tr> <td><code>-ORBAMICollocation</code> <em>1|0</em> diff --git a/TAO/docs/tutorials/Quoter/RTCORBA/Broker.cpp b/TAO/docs/tutorials/Quoter/RTCORBA/Broker.cpp index e3aa2a1a293..ee2cb97d618 100644 --- a/TAO/docs/tutorials/Quoter/RTCORBA/Broker.cpp +++ b/TAO/docs/tutorials/Quoter/RTCORBA/Broker.cpp @@ -196,7 +196,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) // Run the event loop. ACE_DEBUG ((LM_DEBUG, "running the event loop:\n" - "*** message: ready to receieve stock information...\n\n")); + "*** message: ready to receive stock information...\n\n")); orb->run (); // Cleanup the POA and ORB. diff --git a/TAO/docs/tutorials/Quoter/RTCORBA/docs/distributor.html b/TAO/docs/tutorials/Quoter/RTCORBA/docs/distributor.html index 8738fbe78a0..64525c7cdf9 100644 --- a/TAO/docs/tutorials/Quoter/RTCORBA/docs/distributor.html +++ b/TAO/docs/tutorials/Quoter/RTCORBA/docs/distributor.html @@ -32,7 +32,7 @@ which is a subclass of POA_Stock::StockQuoter class. <P> <hr><h3>Implementation of StockDistributorHome interface</h3> -This interface is used to register the necessary factories and mappings with the specified orb and +This interface is used to register the necessary factories and mappings with the specified orb and create StockDistributor objects. <P> The Stock_StockDistributorHome_i class is generated automatically by the IDL compiler (using the -GI flag), @@ -48,7 +48,7 @@ The main steps of this function are described as follows: <P> <PRE> if (orb_->orb_core ()->reactor ()->register_handler (SIGINT, this) == -1) - ACE_DEBUG ((LM_DEBUG, "ERROR: Failed to register as a signal handler: %p\n", + ACE_DEBUG ((LM_DEBUG, "ERROR: Failed to register as a signal handler: %p\n", "register_handler\n")); </PRE> @@ -76,7 +76,7 @@ The main steps of this function are described as follows: <P> <li>Create a CORBA::PolicyList for the child POA.</li> -This step include several sub-stpes: +This step include several sub-steps: <OL> <li> Get a reference to the RTORB.</li> <li> Initialize a CORBA::PolicyList object.</li> @@ -90,38 +90,38 @@ create a lane for each priority.</li> <PRE> CORBA::Object_var obj = orb_->resolve_initial_references ("RTORB"); RTCORBA::RTORB_var rt_orb = RTCORBA::RTORB::_narrow (obj.in ()); - + TAO::Utils::PolicyList_Destroyer policies (2); policies.length (2); - + policies[0] = rt_orb->create_priority_model_policy (RTCORBA::SERVER_DECLARED, Stock::Priority_Mapping::VERY_LOW); - + RTCORBA::ThreadpoolLanes lanes (5); lanes.length (5); - - for (CORBA::ULong i = 0; i < lanes.length (); ++i) + + for (CORBA::ULong i = 0; i < lanes.length (); ++i) { lanes[i].lane_priority = static_cast<RTCORBA::Priority> (i); lanes[i].static_threads = 5; lanes[i].dynamic_threads = 0; } - - RTCORBA::ThreadpoolId threadpool_id = + + RTCORBA::ThreadpoolId threadpool_id = rt_orb->create_threadpool_with_lanes (1024*1024, lanes, false, false, 0, 0); - + policies[1] = rt_orb->create_threadpool_policy (threadpool_id); PortableServer::POA_var poa = this->_default_POA (); PortableServer::POAManager_var poa_mgr = poa->the_POAManager (); - + PortableServer::POA_var child_poa = - poa->create_POA ("StockDistributor_POA", + poa->create_POA ("StockDistributor_POA", poa_mgr.in (), policies); - + this->rt_poa_ = RTPortableServer::POA::_narrow (child_poa.in ()); </PRE> @@ -133,7 +133,7 @@ create a lane for each priority.</li> <h4>Implementing the create_distributor () member function</h4> -<li>Create a new instance of the StockDistributor_i. Then activate it under the located POA. +<li>Create a new instance of the StockDistributor_i. Then activate it under the located POA. This will cause the object to have the CLIENT_PROPAGATED policies. </li> <PRE> @@ -179,7 +179,7 @@ which is a subclass of POA_Stock::StockDistributor class. <P> orb_ (CORBA::ORB::_duplicate (poa->_get_orb ())) </PRE> -The "rate_" and "active_" are two private members of the Stock_StockDistributor_i class. They stand +The "rate_" and "active_" are two private members of the Stock_StockDistributor_i class. They stand for the notification rate and the active state of the StockDistributor object. <P> <h4>Implementing the subscribe_notifier () member function</h4> @@ -190,7 +190,7 @@ The main steps of this function are described as follows: <P> <li>Generate an unique id for the cookie and use it to create a new Cookie object.</li> <P> -<li>Insert the StockNameConsumer object and its priority into the StockDistributor object's subscriber map, +<li>Insert the StockNameConsumer object and its priority into the StockDistributor object's subscriber map, using the cookie id as the key.</li> <P> <li>Return the Cookie object.</li> <P> @@ -202,7 +202,7 @@ The main steps of this function are described as follows: <P> <li>Check the value of the Cookie object.</li> <P> <li>Get the write thread mutex of the subscriber map.</li> <P> - + <li>Search for the Cookie object in the argument in the StockDistributor object's subscriber map.</li> <P> <li>Erase the Cookie object from the StockDistributor object's subscribers' map.</li> <P> @@ -212,7 +212,7 @@ The main steps of this function are described as follows: <P> <h4>Implementing the provide_quoter_info () member function</h4> <li>Get the read thread mutex of the subscriber map.</li> <P> - + <li>Search for the Cookie object in the argument in the StockDistributor object's subscriber map.</li> <P> <PRE> @@ -224,11 +224,11 @@ The main steps of this function are described as follows: <P> <PRE> Stock_StockQuoter_i *quoter = new Stock_StockQuoter_i; PortableServer::ServantBase_var owner_transfer (quoter); - - PortableServer::ObjectId *oid = + + PortableServer::ObjectId *oid = this->rt_poa_->activate_object_with_priority (quoter, iter->second.second); - + CORBA::Object_var obj = rt_poa_->id_to_reference (*oid); Stock::StockQuoter_var quoter_var = ::Stock::StockQuoter::_narrow (obj.in ()); </PRE> @@ -257,12 +257,12 @@ While the state of the StockDistributor object is active, continue the following CORBA::Object_var obj = orb_->resolve_initial_references ("RTCurrent"); RTCORBA::Current_var rt_current = RTCORBA::Current::_narrow (obj); - + rt_current->the_priority (iter->second.second); // Tell the database to push its information to the // <consumer>, which passes along the CORBA priority - // in the service_context list of the GIOP message. + // in the service_context list of the GIOP message. STOCK_DATABASE->publish_stock_info (iter->second.first); } catch (CORBA::Exception &ex) @@ -288,10 +288,10 @@ While the state of the StockDistributor object is active, continue the following <li>Deactivate the StockDistributor object.</li> -<PRE> +<PRE> ::Stock::StockDistributor_var dist = this->_this (); PortableServer::ObjectId_var oid = this->rt_poa_->reference_to_id (dist.in ()); - + this->rt_poa_->deactivate_object (oid.in ()); </PRE> diff --git a/TAO/orbsvcs/ImplRepo_Service/ImplRepo_Service.mpc b/TAO/orbsvcs/ImplRepo_Service/ImplRepo_Service.mpc index 0c7770da4e6..910ccb62870 100644 --- a/TAO/orbsvcs/ImplRepo_Service/ImplRepo_Service.mpc +++ b/TAO/orbsvcs/ImplRepo_Service/ImplRepo_Service.mpc @@ -21,7 +21,6 @@ project(ImR_Locator_IDL) : orbsvcslib, orbsvcs_output, conv_lib, valuetype, port after += ImR_Activator_IDL libs += TAO_ImR_Activator_IDL // Dont try to build this project if ImR_Activator_IDL is not built - requires += corba_messaging dynamicflags += LOCATOR_IDL_BUILD_DLL idlflags += -Wb,export_macro=LocatorIDL_Export -Wb,export_include=locator_idl_export.h @@ -51,7 +50,6 @@ project(ImR_Activator) : orbsvcslib, orbsvcs_output, conv_lib, acexml, avoids_mi after += ImR_Activator_IDL ImR_Locator_IDL libs += TAO_ImR_Activator_IDL TAO_ImR_Locator_IDL // Dont try to build this project if ImR_Activator_IDL is not built - requires += corba_messaging Source_Files { ImR_Activator_i.cpp diff --git a/TAO/orbsvcs/examples/RtEC/IIOPGateway/RtEC_IIOPGateway.mpc b/TAO/orbsvcs/examples/RtEC/IIOPGateway/RtEC_IIOPGateway.mpc index 2671b2a5ed7..281f4775ed1 100644 --- a/TAO/orbsvcs/examples/RtEC/IIOPGateway/RtEC_IIOPGateway.mpc +++ b/TAO/orbsvcs/examples/RtEC/IIOPGateway/RtEC_IIOPGateway.mpc @@ -2,44 +2,28 @@ // $Id$ project(*Consumer): messaging, rteventexe, naming { - exename = Consumer - - requires += corba_messaging - Source_Files { Consumer.cpp } } project(*Supplier): messaging, rteventexe, naming { - exename = Supplier - - requires += corba_messaging - Source_Files { Supplier.cpp } } project(*): messaging, rteventexe, rtevent_serv, naming { - exename = Gateway - - requires += corba_messaging - Source_Files { Gateway.cpp } } project(*EC): messaging, rteventexe, rtevent_serv, naming { - exename = EC - - requires += corba_messaging - Source_Files { EC.cpp } diff --git a/TAO/orbsvcs/orbsvcs/CosEvent/CEC_TypedProxyPushConsumer.cpp b/TAO/orbsvcs/orbsvcs/CosEvent/CEC_TypedProxyPushConsumer.cpp index 95841b71732..c99dbc35ce9 100644 --- a/TAO/orbsvcs/orbsvcs/CosEvent/CEC_TypedProxyPushConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/CosEvent/CEC_TypedProxyPushConsumer.cpp @@ -380,7 +380,7 @@ TAO_CEC_TypedProxyPushConsumer_Guard:: return; this->locked_ = 1; - this->refcount_++; + ++this->refcount_; } TAO_CEC_TypedProxyPushConsumer_Guard:: diff --git a/TAO/orbsvcs/orbsvcs/CosEvent/CEC_TypedProxyPushConsumer.h b/TAO/orbsvcs/orbsvcs/CosEvent/CEC_TypedProxyPushConsumer.h index 547df4ccbfd..31720a9b33e 100644 --- a/TAO/orbsvcs/orbsvcs/CosEvent/CEC_TypedProxyPushConsumer.h +++ b/TAO/orbsvcs/orbsvcs/CosEvent/CEC_TypedProxyPushConsumer.h @@ -146,7 +146,7 @@ private: * @brief A Guard for the TypedProxyPushConsumer reference count * * This is a helper class used in the implementation of - * TypedProxyPushConumer. It provides a Guard mechanism to increment + * TypedProxyPushConsumer. It provides a Guard mechanism to increment * the reference count on the proxy, eliminating the need to hold * mutexes during long operations. */ diff --git a/TAO/orbsvcs/tests/Miop/McastHello/client.cpp b/TAO/orbsvcs/tests/Miop/McastHello/client.cpp index a84044b4085..38b253edba4 100644 --- a/TAO/orbsvcs/tests/Miop/McastHello/client.cpp +++ b/TAO/orbsvcs/tests/Miop/McastHello/client.cpp @@ -56,9 +56,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) */ Test::McastHello_var hello = TAO::Narrow_Utils<Test::McastHello>::unchecked_narrow ( - tmp.in (), - Test__TAO_McastHello_Proxy_Broker_Factory_function_pointer - ); + tmp.in ()); if (CORBA::is_nil (hello.in ())) { diff --git a/TAO/orbsvcs/tests/Notify/Basic/ConnectDisconnect.cpp b/TAO/orbsvcs/tests/Notify/Basic/ConnectDisconnect.cpp index 6891dcd7cd1..bb111e54370 100644 --- a/TAO/orbsvcs/tests/Notify/Basic/ConnectDisconnect.cpp +++ b/TAO/orbsvcs/tests/Notify/Basic/ConnectDisconnect.cpp @@ -328,6 +328,18 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) return 1; } - return client.check_results (); + int status = 0; + + try + { + status = client.check_results (); + } + catch (const CORBA::Exception& se) + { + se._tao_print_exception ("Error: "); + status = 1; + } + + return status; } diff --git a/TAO/orbsvcs/tests/Notify/Basic/Events.cpp b/TAO/orbsvcs/tests/Notify/Basic/Events.cpp index 5ec7883937c..779bde188e6 100644 --- a/TAO/orbsvcs/tests/Notify/Basic/Events.cpp +++ b/TAO/orbsvcs/tests/Notify/Basic/Events.cpp @@ -313,5 +313,17 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) return 1; } - return events.check_results (); + int status = 0; + + try + { + status = events.check_results (); + } + catch (const CORBA::Exception& se) + { + se._tao_print_exception ("Error: "); + status = 1; + } + + return status; } diff --git a/TAO/orbsvcs/tests/Notify/Basic/MultiTypes.cpp b/TAO/orbsvcs/tests/Notify/Basic/MultiTypes.cpp index 382a27887f1..1db133780ce 100644 --- a/TAO/orbsvcs/tests/Notify/Basic/MultiTypes.cpp +++ b/TAO/orbsvcs/tests/Notify/Basic/MultiTypes.cpp @@ -354,5 +354,17 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) return 1; } - return client.check_results (); + int status = 0; + + try + { + status = client.check_results (); + } + catch (const CORBA::Exception& se) + { + se._tao_print_exception ("Error: "); + status = 1; + } + + return status; } diff --git a/TAO/orbsvcs/tests/Notify/Basic/Sequence.cpp b/TAO/orbsvcs/tests/Notify/Basic/Sequence.cpp index 6b345e31871..9d4b0f3768b 100644 --- a/TAO/orbsvcs/tests/Notify/Basic/Sequence.cpp +++ b/TAO/orbsvcs/tests/Notify/Basic/Sequence.cpp @@ -349,5 +349,17 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) return 1; } - return events.check_results (); + int status = 0; + + try + { + status = events.check_results (); + } + catch (const CORBA::Exception& se) + { + se._tao_print_exception ("Error: "); + status = 1; + } + + return status; } diff --git a/TAO/orbsvcs/tests/Notify/Basic/Simple.cpp b/TAO/orbsvcs/tests/Notify/Basic/Simple.cpp index 5cc9b2df6ec..c27af8a8979 100644 --- a/TAO/orbsvcs/tests/Notify/Basic/Simple.cpp +++ b/TAO/orbsvcs/tests/Notify/Basic/Simple.cpp @@ -231,5 +231,17 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) return 1; } - return events.check_results (); + int status = 0; + + try + { + status = events.check_results (); + } + catch (const CORBA::Exception& se) + { + se._tao_print_exception ("Error: "); + status = 1; + } + + return status; } diff --git a/TAO/performance-tests/Anyop/anyop.cpp b/TAO/performance-tests/Anyop/anyop.cpp index fd82626063f..afaa7e0cf1c 100644 --- a/TAO/performance-tests/Anyop/anyop.cpp +++ b/TAO/performance-tests/Anyop/anyop.cpp @@ -83,8 +83,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) orb->string_to_object ("corbaloc:iiop:localhost:1234/Foo/Bar"); Param_Test_var param_test = - TAO::Narrow_Utils<Param_Test>::unchecked_narrow (obj.in (), - 0); + TAO::Narrow_Utils<Param_Test>::unchecked_narrow (obj.in ()); TAO_Stub *stub = param_test->_stubobj (); stub->type_id = CORBA::string_dup ("IDL:Param_Test:1.0"); diff --git a/TAO/performance-tests/Throughput/Receiver_Factory.h b/TAO/performance-tests/Throughput/Receiver_Factory.h index ea8ec3ff2a9..4ccf75b421b 100644 --- a/TAO/performance-tests/Throughput/Receiver_Factory.h +++ b/TAO/performance-tests/Throughput/Receiver_Factory.h @@ -8,11 +8,6 @@ #include "TestS.h" -#if defined (_MSC_VER) -# pragma warning(push) -# pragma warning (disable:4250) -#endif /* _MSC_VER */ - /// Implement the Test::Receiver_Factory interface class Receiver_Factory : public virtual POA_Test::Receiver_Factory @@ -31,9 +26,5 @@ private: CORBA::ORB_var orb_; }; -#if defined(_MSC_VER) -# pragma warning(pop) -#endif /* _MSC_VER */ - #include /**/ "ace/post.h" #endif /* THROUGHPUT_RECEIVER_FACTORY_H */ diff --git a/TAO/tao/Abstract_Servant_Base.h b/TAO/tao/Abstract_Servant_Base.h index a41fe1bec54..fcd601e961b 100644 --- a/TAO/tao/Abstract_Servant_Base.h +++ b/TAO/tao/Abstract_Servant_Base.h @@ -61,9 +61,7 @@ typedef void (*TAO_Skeleton)( typedef void (*TAO_Collocated_Skeleton)( TAO_Abstract_ServantBase *, - TAO::Argument **, - int - ); + TAO::Argument **); class TAO_Export TAO_Abstract_ServantBase { @@ -125,6 +123,15 @@ public: TAO::Collocation_Strategy s, const size_t length = 0) = 0; + virtual void _collocated_dispatch (::CORBA::Object_ptr obj, + ::CORBA::Object_out forward_obj, + bool &is_forwarded, + TAO::Argument ** args, + int num_args, + const char * op, + size_t op_len, + TAO::Collocation_Strategy strategy) = 0; + protected: /// Default constructor, only derived classes can be created. diff --git a/TAO/tao/AnyTypeCode/Any_Impl.cpp b/TAO/tao/AnyTypeCode/Any_Impl.cpp index bc5273c536b..6bf1047c835 100644 --- a/TAO/tao/AnyTypeCode/Any_Impl.cpp +++ b/TAO/tao/AnyTypeCode/Any_Impl.cpp @@ -103,8 +103,7 @@ TAO::Any_Impl::_remove_ref (void) } void -TAO::Any_Impl::_tao_decode (TAO_InputCDR & - ) +TAO::Any_Impl::_tao_decode (TAO_InputCDR &) { throw ::CORBA::NO_IMPLEMENT (); } diff --git a/TAO/tao/CDR.cpp b/TAO/tao/CDR.cpp index dc9ccc4cb57..668d4b7b557 100644 --- a/TAO/tao/CDR.cpp +++ b/TAO/tao/CDR.cpp @@ -219,8 +219,7 @@ TAO_OutputCDR::throw_skel_exception (int error_num ) ACE_NOTREACHED (break); case EACCES : // wchar but no codeset - throw ::CORBA::BAD_PARAM (CORBA::OMGVMCID | 23, - CORBA::COMPLETED_YES); + throw ::CORBA::BAD_PARAM (CORBA::OMGVMCID | 23, CORBA::COMPLETED_YES); ACE_NOTREACHED (break); #if (ERANGE != EINVAL) diff --git a/TAO/tao/CORBANAME_Parser.cpp b/TAO/tao/CORBANAME_Parser.cpp index f9a7fe1a5c8..0f7adf72a1a 100644 --- a/TAO/tao/CORBANAME_Parser.cpp +++ b/TAO/tao/CORBANAME_Parser.cpp @@ -51,7 +51,7 @@ parse_string_dynamic_request_helper (CORBA::Object_ptr naming_context, 2, "resolve_str", 11, - 0); + TAO::TAO_CO_NONE | TAO::TAO_CO_THRU_POA_STRATEGY); tao_call.invoke (0, 0); diff --git a/TAO/tao/Collocated_Invocation.cpp b/TAO/tao/Collocated_Invocation.cpp index 657dc7e38bc..0b338b2d60a 100644 --- a/TAO/tao/Collocated_Invocation.cpp +++ b/TAO/tao/Collocated_Invocation.cpp @@ -1,7 +1,6 @@ // $Id$ #include "tao/Collocated_Invocation.h" -#include "tao/Collocation_Proxy_Broker.h" #include "tao/ORB_Core.h" #include "tao/Request_Dispatcher.h" #include "tao/TAO_Server_Request.h" @@ -9,6 +8,7 @@ #include "tao/operation_details.h" #include "tao/PortableInterceptor.h" #include "tao/SystemException.h" +#include "tao/Abstract_Servant_Base.h" #if TAO_HAS_INTERCEPTORS == 1 # include "tao/PortableInterceptorC.h" @@ -33,8 +33,7 @@ namespace TAO } Invocation_Status - Collocated_Invocation::invoke (Collocation_Proxy_Broker *cpb, - Collocation_Strategy strat) + Collocated_Invocation::invoke (Collocation_Strategy strat) { Invocation_Status s = TAO_INVOKE_FAILURE; @@ -82,7 +81,8 @@ namespace TAO { bool is_forwarded = false; - cpb->dispatch (this->effective_target (), + this->effective_target ()->_servant()->_collocated_dispatch ( + this->effective_target (), this->forwarded_to_.out (), is_forwarded, this->details_.args (), diff --git a/TAO/tao/Collocated_Invocation.h b/TAO/tao/Collocated_Invocation.h index cdca74f975b..d86cd1bca01 100644 --- a/TAO/tao/Collocated_Invocation.h +++ b/TAO/tao/Collocated_Invocation.h @@ -83,8 +83,7 @@ namespace TAO * servant. * */ - Invocation_Status invoke (Collocation_Proxy_Broker *cpb, - Collocation_Strategy strat); + Invocation_Status invoke (Collocation_Strategy strat); private: diff --git a/TAO/tao/Collocation_Proxy_Broker.cpp b/TAO/tao/Collocation_Proxy_Broker.cpp deleted file mode 100644 index ea46473b3ee..00000000000 --- a/TAO/tao/Collocation_Proxy_Broker.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// -*- C++ -*- -// $Id$ - -#include "tao/Collocation_Proxy_Broker.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO::Collocation_Proxy_Broker::~Collocation_Proxy_Broker (void) -{ -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Collocation_Proxy_Broker.h b/TAO/tao/Collocation_Proxy_Broker.h deleted file mode 100644 index efc8465db89..00000000000 --- a/TAO/tao/Collocation_Proxy_Broker.h +++ /dev/null @@ -1,73 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Collocation_Proxy_Broker.h - * - * $Id$ - * - * - * @author Balachandran Natarajan <bala@dre.vanderbilt.edu> - */ -//============================================================================= - -#ifndef TAO_COLLOCATION_PROXY_BROKER_H -#define TAO_COLLOCATION_PROXY_BROKER_H - -#include /**/ "ace/pre.h" - -#include /**/ "tao/TAO_Export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/Collocation_Strategy.h" -#include /**/ "tao/Versioned_Namespace.h" - -#include "ace/os_include/os_stddef.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -template<typename T> class TAO_Pseudo_Var_T; -template<typename T> class TAO_Pseudo_Out_T; - -namespace CORBA -{ - class Object; - typedef Object *Object_ptr; - typedef TAO_Pseudo_Var_T<Object> Object_var; - typedef TAO_Pseudo_Out_T<Object> Object_out; -} - -namespace TAO -{ - class Argument; - - /** - * @class Collocation_Proxy_Broker - */ - class TAO_Export Collocation_Proxy_Broker - { - - public: - virtual ~Collocation_Proxy_Broker (void); - - virtual Collocation_Strategy get_strategy (CORBA::Object_ptr obj) = 0; - - virtual void dispatch (CORBA::Object_ptr obj, - CORBA::Object_out forward_obj, - bool & is_forwarded, - Argument ** args, - int num_args, - const char * op, - size_t op_len, - Collocation_Strategy strategy) = 0; - }; - -TAO_END_VERSIONED_NAMESPACE_DECL -} - -#include /**/ "ace/post.h" - -#endif /*TAO_COLLOCATION_PROXY_BROKER_H */ diff --git a/TAO/tao/Collocation_Strategy.h b/TAO/tao/Collocation_Strategy.h index 2a9e8c0aeaa..00e4050b5b5 100644 --- a/TAO/tao/Collocation_Strategy.h +++ b/TAO/tao/Collocation_Strategy.h @@ -19,7 +19,7 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL -/// Define symbolic names for the ORB collocation strategies. +/// Define symbolic names for the ORB collocation strategies as used at runtime. namespace TAO { enum Collocation_Strategy @@ -39,6 +39,29 @@ namespace TAO /// strategies. TAO_CS_LAST }; + + inline const char * translate_collocation_strategy (Collocation_Strategy cs) + { +#define TAO_CS(X) case X: return #X + switch (cs) + { + TAO_CS (TAO_CS_REMOTE_STRATEGY); + TAO_CS (TAO_CS_THRU_POA_STRATEGY); + TAO_CS (TAO_CS_DIRECT_STRATEGY); + TAO_CS (TAO_CS_LAST); + } + return "***Unknown enum value, update TAO::translate_collocation_strategy()"; +#undef TAO_CS + } + + /// No collocation possible + int const TAO_CO_NONE = 0x00; + + /// Through POA collocation is possible + int const TAO_CO_THRU_POA_STRATEGY = 0x01; + + /// Direct collocation is possible + int const TAO_CO_DIRECT_STRATEGY = 0x02; } TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp b/TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp index 8410e8eb9ea..e302ccaff0f 100644 --- a/TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp +++ b/TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp @@ -36,7 +36,7 @@ namespace TAO arg_number, operation, op_len, - 0, // Collocation Proxy broker pointer + TAO_CO_THRU_POA_STRATEGY, // default through POA collocation is possible TAO_TWOWAY_INVOCATION, mode) , exception_list_ (excp) @@ -158,7 +158,7 @@ namespace TAO int arg_number, const char *operation, size_t op_len, - Collocation_Proxy_Broker *b, + int collocation_opportunity, TAO_ORB_Core *oc, CORBA::Request *req, Invocation_Mode mode) @@ -167,7 +167,7 @@ namespace TAO arg_number, operation, op_len, - b, + collocation_opportunity, TAO_TWOWAY_INVOCATION, mode) , request_ (req) @@ -305,7 +305,7 @@ namespace TAO arg_count, operation, op_len, - 0, + TAO_CO_THRU_POA_STRATEGY, TAO_ONEWAY_INVOCATION, mode) { diff --git a/TAO/tao/DynamicInterface/DII_Invocation_Adapter.h b/TAO/tao/DynamicInterface/DII_Invocation_Adapter.h index f058c2b97c0..80b2c6f9274 100644 --- a/TAO/tao/DynamicInterface/DII_Invocation_Adapter.h +++ b/TAO/tao/DynamicInterface/DII_Invocation_Adapter.h @@ -141,7 +141,7 @@ namespace TAO int arg_number, const char *operation, size_t op_len, - Collocation_Proxy_Broker *b, + int collocation_opportunity, TAO_ORB_Core *oc, CORBA::Request *req, TAO::Invocation_Mode mode = TAO_DII_DEFERRED_INVOCATION); diff --git a/TAO/tao/IIOP_Connector.cpp b/TAO/tao/IIOP_Connector.cpp index 716376bb0d2..d28b2e87873 100644 --- a/TAO/tao/IIOP_Connector.cpp +++ b/TAO/tao/IIOP_Connector.cpp @@ -151,31 +151,31 @@ TAO_IIOP_Connector::set_validate_endpoint (TAO_Endpoint *endpoint) if (iiop_endpoint == 0) return -1; - const ACE_INET_Addr &remote_address = iiop_endpoint->object_addr (); + const ACE_INET_Addr &remote_address = iiop_endpoint->object_addr (); - // Verify that the remote ACE_INET_Addr was initialized properly. - // Failure can occur if hostname lookup failed when initializing the - // remote ACE_INET_Addr. + // Verify that the remote ACE_INET_Addr was initialized properly. + // Failure can occur if hostname lookup failed when initializing the + // remote ACE_INET_Addr. #if defined (ACE_HAS_IPV6) - if (remote_address.get_type () != AF_INET && - remote_address.get_type () != AF_INET6) + if (remote_address.get_type () != AF_INET && + remote_address.get_type () != AF_INET6) #else /* ACE_HAS_IPV6 */ - if (remote_address.get_type () != AF_INET) + if (remote_address.get_type () != AF_INET) #endif /* !ACE_HAS_IPV6 */ - { - if (TAO_debug_level > 0) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) - IIOP connection failed.\n") - ACE_TEXT (" This is most likely ") - ACE_TEXT ("due to a hostname lookup ") - ACE_TEXT ("failure.\n"))); - } - - return -1; - } - - return 0; + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) - IIOP connection failed.\n") + ACE_TEXT (" This is most likely ") + ACE_TEXT ("due to a hostname lookup ") + ACE_TEXT ("failure.\n"))); + } + + return -1; + } + + return 0; } TAO_Transport * diff --git a/TAO/tao/Invocation_Adapter.cpp b/TAO/tao/Invocation_Adapter.cpp index 0359a3efb57..f85187b0172 100644 --- a/TAO/tao/Invocation_Adapter.cpp +++ b/TAO/tao/Invocation_Adapter.cpp @@ -11,10 +11,10 @@ #include "tao/Collocated_Invocation.h" #include "tao/Transport.h" #include "tao/Transport_Mux_Strategy.h" -#include "tao/Collocation_Proxy_Broker.h" #include "tao/GIOP_Utils.h" #include "tao/TAOC.h" #include "tao/SystemException.h" +#include "tao/Collocation_Resolver.h" #include "ace/Service_Config.h" #if !defined (__ACE_INLINE__) @@ -74,13 +74,19 @@ namespace TAO // Default we go to remote Collocation_Strategy strat = TAO_CS_REMOTE_STRATEGY; - // If we have a collocated proxy broker we look if we maybe + // If we have the opportunity for collocation we maybe // can use a collocated invocation. Similarly, if the // target object reference contains a pointer to a servant, // the object reference also refers to a collocated object. - if (cpb_ != 0 || effective_target->_servant () != 0) + // get the ORBStrategy + strat = this->collocation_strategy (effective_target.in ()); + + if (TAO_debug_level > 2) { - strat = TAO_ORB_Core::collocation_strategy (effective_target.in ()); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("TAO (%P|%t) - Invocation_Adapter::invoke_i, ") + ACE_TEXT("making a %C invocation\n"), + TAO::translate_collocation_strategy(strat))); } if (strat == TAO_CS_REMOTE_STRATEGY || strat == TAO_CS_LAST) @@ -104,7 +110,6 @@ namespace TAO effective_target, strat); } - if (status == TAO_INVOKE_RESTART) { details.reset_request_service_info (); @@ -135,11 +140,20 @@ namespace TAO TAO_Stub * const stub = this->target_->_stubobj (); if (stub == 0) - throw ::CORBA::INTERNAL ( - CORBA::SystemException::_tao_minor_code ( - TAO::VMCID, - EINVAL), - CORBA::COMPLETED_NO); + { + if (TAO_debug_level > 0) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("Invocation_Adapter::get_stub, ") + ACE_TEXT ("raising CORBA::INTERNAL because of nil ") + ACE_TEXT ("stub.\n"))); + } + throw ::CORBA::INTERNAL ( + CORBA::SystemException::_tao_minor_code ( + TAO::VMCID, + EINVAL), + CORBA::COMPLETED_NO); + } return stub; } @@ -150,12 +164,6 @@ namespace TAO CORBA::Object_var &effective_target, Collocation_Strategy strat) { - // To make a collocated call we must have a collocated proxy broker, the - // invoke_i() will make sure that we only come here when we have one - ACE_ASSERT (cpb_ != 0 - || (strat == TAO_CS_THRU_POA_STRATEGY - && effective_target->_servant () != 0)); - // Initial state TAO::Invocation_Status status = TAO_INVOKE_START; @@ -165,7 +173,7 @@ namespace TAO details, this->type_ == TAO_TWOWAY_INVOCATION); - status = coll_inv.invoke (this->cpb_, strat); + status = coll_inv.invoke (strat); if (status == TAO_INVOKE_RESTART && (coll_inv.reply_status () == GIOP::LOCATION_FORWARD || @@ -228,14 +236,12 @@ namespace TAO bool const block_connect = rflags != static_cast<CORBA::Octet> (Messaging::SYNC_NONE) && rflags != static_cast<CORBA::Octet> (TAO::SYNC_DELAYED_BUFFERING); - // Create the resolver which will pick (or create) for us a // transport and a profile from the effective_target. Profile_Transport_Resolver resolver ( effective_target.in (), stub, block_connect); - resolver.resolve (max_wait_time); if (TAO_debug_level) @@ -245,13 +251,11 @@ namespace TAO ACE_TEXT ("TAO (%P|%t) - Invocation_Adapter::invoke_remote_i, ") ACE_TEXT ("max wait time consumed during transport resolution\n"))); } - // Update the request id now that we have a transport if (resolver.transport ()) { details.request_id (resolver.transport ()->tms ()->request_id ()); } - switch (this->type_) { case TAO_ONEWAY_INVOCATION: @@ -382,6 +386,100 @@ namespace TAO errno), CORBA::COMPLETED_NO); } + + TAO::Collocation_Strategy + Invocation_Adapter::collocation_strategy (CORBA::Object_ptr object) + { + TAO::Collocation_Strategy strategy = TAO::TAO_CS_REMOTE_STRATEGY; + TAO_Stub *stub = object->_stubobj (); + if (!CORBA::is_nil (stub->servant_orb_var ().in ()) && + stub->servant_orb_var ()->orb_core () != 0) + { + TAO_ORB_Core *orb_core = stub->servant_orb_var ()->orb_core (); + + if (orb_core->collocation_resolver ().is_collocated (object)) + { + switch (orb_core->get_collocation_strategy ()) + { + case TAO_ORB_Core::TAO_COLLOCATION_THRU_POA: + { + // check opportunity + if (ACE_BIT_ENABLED (this->collocation_opportunity_, + TAO::TAO_CO_THRU_POA_STRATEGY)) + { + strategy = TAO::TAO_CS_THRU_POA_STRATEGY; + } + else + { + if (TAO_debug_level > 0) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("Invocation_Adapter::collocation_strategy, ") + ACE_TEXT ("request for through poa collocation ") + ACE_TEXT ("without needed collocation opportunity.\n"))); + } + // collocation object, but no collocation_opportunity for Thru_poa + throw ::CORBA::INTERNAL ( + CORBA::SystemException::_tao_minor_code ( + TAO::VMCID, + EINVAL), + CORBA::COMPLETED_NO); + } + break; + } + case TAO_ORB_Core::TAO_COLLOCATION_DIRECT: + { + if (ACE_BIT_ENABLED (this->collocation_opportunity_, + TAO::TAO_CO_DIRECT_STRATEGY) + && (object->_servant () != 0)) + { + strategy = TAO::TAO_CS_DIRECT_STRATEGY; + } + else + { + if (TAO_debug_level > 0) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("Invocation_Adapter::collocation_strategy, ") + ACE_TEXT ("request for direct collocation ") + ACE_TEXT ("without needed collocation opportunity.\n"))); + } + // collocation object, but no collocation_opportunity for Direct + // or servant() == 0 + throw ::CORBA::INTERNAL ( + CORBA::SystemException::_tao_minor_code ( + TAO::VMCID, + EINVAL), + CORBA::COMPLETED_NO); + } + break; + } + case TAO_ORB_Core::TAO_COLLOCATION_BEST: + { + if (ACE_BIT_ENABLED (this->collocation_opportunity_, + TAO::TAO_CO_DIRECT_STRATEGY) + && (object->_servant () != 0)) + { + strategy = TAO::TAO_CS_DIRECT_STRATEGY; + } + else if (ACE_BIT_ENABLED (this->collocation_opportunity_, + TAO::TAO_CO_THRU_POA_STRATEGY)) + { + strategy = TAO::TAO_CS_THRU_POA_STRATEGY; + } + else + { + strategy = TAO::TAO_CS_REMOTE_STRATEGY; + } + break; + } + } + } + } + + return strategy; + } + } // End namespace TAO TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Invocation_Adapter.h b/TAO/tao/Invocation_Adapter.h index 958083c8945..f539c28de45 100644 --- a/TAO/tao/Invocation_Adapter.h +++ b/TAO/tao/Invocation_Adapter.h @@ -46,7 +46,6 @@ namespace TAO { class Argument; struct Exception_Data; - class Collocation_Proxy_Broker; class Profile_Transport_Resolver; /** @@ -94,9 +93,8 @@ namespace TAO * is an optimization which helps us to avoid calling strlen () * while creating a message format. * - * @param cpb The collocation proxy broker for the target if one - * exists. This is useful especially to route the call to the - * collocated target. + * @param collocation_opportunity Indicate which collocation optimizations + * should be possible * * @param type The operation type which could be a oneway or two * way operation. This information is available in the IDL file. @@ -109,7 +107,7 @@ namespace TAO int arg_number, const char *operation, size_t op_len, - Collocation_Proxy_Broker *cpb, + int collocation_opportunity, TAO::Invocation_Type type = TAO_TWOWAY_INVOCATION, TAO::Invocation_Mode mode = TAO_SYNCHRONOUS_INVOCATION); @@ -236,6 +234,16 @@ namespace TAO Invocation_Adapter (Invocation_Adapter const &); Invocation_Adapter & operator= (const Invocation_Adapter &); + /** + * This method returns the right collocation strategy, if any, + * to be used to perform a method invocation on the given object. + * + * @note + * No-Collocation is a special case of collocation. + */ + TAO::Collocation_Strategy collocation_strategy (CORBA::Object_ptr object); + //@} + protected: /// The target object on which this invocation is carried out. CORBA::Object_ptr target_; @@ -255,8 +263,8 @@ namespace TAO /// String length of the operation name. size_t const op_len_; - /// Collocation proxy broker for this operation. - Collocation_Proxy_Broker * const cpb_; + /// Collocation opportunity for this operation. + int const collocation_opportunity_; /// The invocation type Invocation_Type const type_; diff --git a/TAO/tao/Invocation_Adapter.inl b/TAO/tao/Invocation_Adapter.inl index 3ee1410310c..7acff3aa75a 100644 --- a/TAO/tao/Invocation_Adapter.inl +++ b/TAO/tao/Invocation_Adapter.inl @@ -13,7 +13,7 @@ namespace TAO int arg_number, const char *operation, size_t op_len, - Collocation_Proxy_Broker *p, + int collocation_opportunity, Invocation_Type type, Invocation_Mode mode) : target_ (target) @@ -21,7 +21,7 @@ namespace TAO , number_args_ (arg_number) , operation_ (operation) , op_len_ (op_len) - , cpb_ (p) + , collocation_opportunity_ (collocation_opportunity) , type_ (type) , mode_ (mode) { diff --git a/TAO/tao/LocalObject.cpp b/TAO/tao/LocalObject.cpp index 9f12cff39d9..80600b7d718 100644 --- a/TAO/tao/LocalObject.cpp +++ b/TAO/tao/LocalObject.cpp @@ -77,6 +77,10 @@ CORBA::LocalObject::_non_existent (void) char * CORBA::LocalObject::_repository_id (void) { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - Cannot get _repository_id from a LocalObject!\n"))); + throw ::CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 8, CORBA::COMPLETED_NO); } @@ -89,6 +93,10 @@ CORBA::LocalObject::_create_request (CORBA::Context_ptr, CORBA::Request_ptr &, CORBA::Flags) { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - Cannot call _create_request for a LocalObject!\n"))); + throw ::CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 4, CORBA::COMPLETED_NO); } @@ -102,24 +110,40 @@ CORBA::LocalObject::_create_request (CORBA::Context_ptr, CORBA::Request_ptr &, CORBA::Flags) { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - Cannot call _create_request for a LocalObject!\n"))); + throw ::CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 4, CORBA::COMPLETED_NO); } CORBA::Request_ptr CORBA::LocalObject::_request (const char *) { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - Cannot call _request for a LocalObject!\n"))); + throw ::CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 4, CORBA::COMPLETED_NO); } CORBA::Object_ptr CORBA::LocalObject::_get_component (void) { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - Cannot call _get_component for a LocalObject!\n"))); + throw ::CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 8, CORBA::COMPLETED_NO); } CORBA::InterfaceDef_ptr CORBA::LocalObject::_get_interface (void) { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - Cannot call _get_interface for a LocalObject!\n"))); + throw ::CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 8, CORBA::COMPLETED_NO); } #endif @@ -131,12 +155,20 @@ CORBA::LocalObject::_get_interface (void) CORBA::Policy_ptr CORBA::LocalObject::_get_policy (CORBA::PolicyType) { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - Cannot call _get_policy for a LocalObject!\n"))); + throw ::CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 8, CORBA::COMPLETED_NO); } CORBA::Policy_ptr CORBA::LocalObject::_get_cached_policy (TAO_Cached_Policy_Type) { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - Cannot call _get_cached_policy for a LocalObject!\n"))); + throw ::CORBA::NO_IMPLEMENT (); } @@ -144,18 +176,30 @@ CORBA::Object_ptr CORBA::LocalObject::_set_policy_overrides (const CORBA::PolicyList &, CORBA::SetOverrideType) { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - Cannot call _set_policy_overrides for a LocalObject!\n"))); + throw ::CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 8, CORBA::COMPLETED_NO); } CORBA::PolicyList * CORBA::LocalObject::_get_policy_overrides (const CORBA::PolicyTypeSeq &) { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - Cannot call _get_policy_overrides for a LocalObject!\n"))); + throw ::CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 8, CORBA::COMPLETED_NO); } CORBA::Boolean CORBA::LocalObject::_validate_connection (CORBA::PolicyList_out) { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - Cannot call _validate_connection for a LocalObject!\n"))); + throw ::CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 8, CORBA::COMPLETED_NO); } @@ -164,6 +208,10 @@ CORBA::LocalObject::_validate_connection (CORBA::PolicyList_out) CORBA::ORB_ptr CORBA::LocalObject::_get_orb (void) { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - Cannot call _get_orb for a LocalObject!\n"))); + throw ::CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 8, CORBA::COMPLETED_NO); } diff --git a/TAO/tao/Messaging/Asynch_Invocation_Adapter.cpp b/TAO/tao/Messaging/Asynch_Invocation_Adapter.cpp index 65036e25725..e0b8a583be7 100644 --- a/TAO/tao/Messaging/Asynch_Invocation_Adapter.cpp +++ b/TAO/tao/Messaging/Asynch_Invocation_Adapter.cpp @@ -27,14 +27,14 @@ namespace TAO int arg_number, const char *operation, size_t op_len, - Collocation_Proxy_Broker *p, + int collocation_opportunity, Invocation_Mode m) : Invocation_Adapter (target, args, arg_number, operation, op_len, - p, + collocation_opportunity, TAO_TWOWAY_INVOCATION, m) , safe_rd_ () diff --git a/TAO/tao/Messaging/Asynch_Invocation_Adapter.h b/TAO/tao/Messaging/Asynch_Invocation_Adapter.h index 4ac8cf80068..4c78afaedae 100644 --- a/TAO/tao/Messaging/Asynch_Invocation_Adapter.h +++ b/TAO/tao/Messaging/Asynch_Invocation_Adapter.h @@ -67,7 +67,7 @@ namespace TAO int arg_number, const char *operation, size_t op_len, - Collocation_Proxy_Broker *b, + int collocation_opportunity, TAO::Invocation_Mode mode = TAO_ASYNCHRONOUS_CALLBACK_INVOCATION); void invoke (Messaging::ReplyHandler_ptr reply_handler_ptr, diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index e29612762e7..ff5063de97a 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -217,7 +217,7 @@ TAO_ORB_Core::TAO_ORB_Core (const char *orbid, ft_send_extended_sc_ (false), opt_for_collocation_ (true), use_global_collocation_ (true), - collocation_strategy_ (THRU_POA), + collocation_strategy_ (TAO_DEFAULT_COLLOCATION_STRATEGY), #if (TAO_HAS_CORBA_MESSAGING == 1) @@ -439,7 +439,6 @@ TAO_ORB_Core::init (int &argc, char *argv[] ) this->use_implrepo_ = ACE_OS::atoi (use_IMR_env_var_value) ; } - while (arg_shifter.is_anything_left ()) { const ACE_TCHAR *current_arg = 0; @@ -613,9 +612,17 @@ TAO_ORB_Core::init (int &argc, char *argv[] ) // Specify which collocation policy we want to use. const ACE_TCHAR *opt = current_arg; if (ACE_OS::strcasecmp (opt, ACE_TEXT("thru_poa")) == 0) - this->collocation_strategy_ = THRU_POA; + { + this->collocation_strategy_ = TAO_COLLOCATION_THRU_POA; + } else if (ACE_OS::strcasecmp (opt, ACE_TEXT("direct")) == 0) - this->collocation_strategy_ = DIRECT; + { + this->collocation_strategy_ = TAO_COLLOCATION_DIRECT; + } + else if (ACE_OS::strcasecmp (opt, ACE_TEXT("best")) == 0) + { + this->collocation_strategy_ = TAO_COLLOCATION_BEST; + } arg_shifter.consume_arg (); } @@ -3611,39 +3618,4 @@ TAO_ORB_Core_instance (void) return orb_table->first_orb (); } - -TAO::Collocation_Strategy -TAO_ORB_Core::collocation_strategy (CORBA::Object_ptr object) -{ - TAO_Stub *stub = object->_stubobj (); - if (!CORBA::is_nil (stub->servant_orb_var ().in ()) && - stub->servant_orb_var ()->orb_core () != 0) - { - TAO_ORB_Core *orb_core = stub->servant_orb_var ()->orb_core (); - - if (orb_core->collocation_resolver ().is_collocated (object)) - { - switch (orb_core->get_collocation_strategy ()) - { - case THRU_POA: - return TAO::TAO_CS_THRU_POA_STRATEGY; - - case DIRECT: - { - ///////////////////////////////////////////////////////////// - // If the servant is null and you are collocated this means - // that the POA policy NON-RETAIN is set, and with that policy - // using the DIRECT collocation strategy is just insane. - ///////////////////////////////////////////////////////////// - ACE_ASSERT (object->_servant () != 0); - return TAO::TAO_CS_DIRECT_STRATEGY; - } - } - } - } - - // In this case the Object is a client. - return TAO::TAO_CS_REMOTE_STRATEGY; -} - TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/ORB_Core.h b/TAO/tao/ORB_Core.h index 136d43e24d8..085522ec1a8 100644 --- a/TAO/tao/ORB_Core.h +++ b/TAO/tao/ORB_Core.h @@ -225,7 +225,7 @@ public: /// Get the adapter registry TAO_Adapter_Registry &adapter_registry (void); - /// @name Collocation Strategies + /// @name Collocation Strategies as configured by the user //@{ enum { @@ -234,22 +234,16 @@ public: ORB_CONTROL, /// Collocated calls will go thru POA. - THRU_POA, + TAO_COLLOCATION_THRU_POA, /// Collocated calls invoke operation on Servant directly. - DIRECT - }; + TAO_COLLOCATION_DIRECT, - /** - * This method returns the right collocation strategy, if any, - * to be used to perform a method invocation on the given object. - * - * @note - * No-Collocation is a special case of collocation. - */ - static - TAO::Collocation_Strategy collocation_strategy (CORBA::Object_ptr object); - //@} + /// Collocated calls invoke operation on Servant directly if possible, + /// else Collocated calls will go thru POA if possible, else + /// use REMOTE_STRATEGY + TAO_COLLOCATION_BEST + }; /// Set/get the collocation flags //@{ diff --git a/TAO/tao/Object.cpp b/TAO/tao/Object.cpp index 8b8ed8d7fdb..55ea29155a8 100644 --- a/TAO/tao/Object.cpp +++ b/TAO/tao/Object.cpp @@ -209,7 +209,14 @@ CORBA::Object::_is_a (const char *type_id) // XXX if type_id is that of CORBA::Object, "yes, we comply" :-) if (this->protocol_proxy_ == 0) - throw ::CORBA::NO_IMPLEMENT (); + { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - No protocol proxy for %C\n"), + type_id)); + + throw ::CORBA::NO_IMPLEMENT (); + } if (this->_stubobj ()->type_id.in () != 0 && ACE_OS::strcmp (type_id, @@ -236,13 +243,6 @@ CORBA::Object::_is_collocated (void) const return false; } -void -CORBA::Object::set_collocated_servant (TAO_Abstract_ServantBase *b) -{ - this->protocol_proxy_->collocated_servant (b); - this->protocol_proxy_->is_collocated (true); -} - CORBA::Boolean CORBA::Object::_is_local (void) const { @@ -374,6 +374,11 @@ CORBA::Object::_create_request (CORBA::Context_ptr ctx, // object references. if (ctx != 0 || this->protocol_proxy_ == 0) { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - No protocol proxy for %C\n"), + operation)); + throw ::CORBA::NO_IMPLEMENT (); } @@ -414,6 +419,11 @@ CORBA::Object::_create_request (CORBA::Context_ptr ctx, // object references. if (ctx != 0 || this->protocol_proxy_ == 0) { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - No protocol proxy for %C\n"), + operation)); + throw ::CORBA::NO_IMPLEMENT (); } @@ -452,6 +462,11 @@ CORBA::Object::_request (const char *operation) } else { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - No protocol proxy for %C\n"), + operation)); + throw ::CORBA::NO_IMPLEMENT (); } } @@ -522,7 +537,13 @@ CORBA::Object::_get_policy (CORBA::PolicyType type) if (this->protocol_proxy_) return this->protocol_proxy_->get_policy (type); else - throw ::CORBA::NO_IMPLEMENT (); + { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - No protocol proxy in _get_policy\n"))); + + throw ::CORBA::NO_IMPLEMENT (); + } } CORBA::Policy_ptr @@ -533,7 +554,13 @@ CORBA::Object::_get_cached_policy (TAO_Cached_Policy_Type type) if (this->protocol_proxy_) return this->protocol_proxy_->get_cached_policy (type); else - throw ::CORBA::NO_IMPLEMENT (); + { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - No protocol proxy in _get_policy\n"))); + + throw ::CORBA::NO_IMPLEMENT (); + } } CORBA::Object_ptr @@ -544,7 +571,13 @@ CORBA::Object::_set_policy_overrides ( TAO_OBJECT_IOR_EVALUATE_RETURN; if (!this->protocol_proxy_) - throw ::CORBA::NO_IMPLEMENT (); + { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - No protocol proxy in _get_policy\n"))); + + throw ::CORBA::NO_IMPLEMENT (); + } TAO_Stub* stub = this->protocol_proxy_->set_policy_overrides (policies, set_add); @@ -581,7 +614,13 @@ CORBA::Object::_get_policy_overrides (const CORBA::PolicyTypeSeq & types) if (this->protocol_proxy_) return this->protocol_proxy_->get_policy_overrides (types); else - throw ::CORBA::NO_IMPLEMENT (); + { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - No protocol proxy in _get_policy\n"))); + + throw ::CORBA::NO_IMPLEMENT (); + } } CORBA::Boolean @@ -634,7 +673,13 @@ CORBA::Object::_get_orb (void) if (this->protocol_proxy_) return CORBA::ORB::_duplicate (this->protocol_proxy_->orb_core ()->orb ()); else - throw ::CORBA::INTERNAL (); + { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - No protocol proxy in _get_policy\n"))); + + throw ::CORBA::NO_IMPLEMENT (); + } } } diff --git a/TAO/tao/Object.h b/TAO/tao/Object.h index 932cff0dfc7..59ae911e3e0 100644 --- a/TAO/tao/Object.h +++ b/TAO/tao/Object.h @@ -306,15 +306,6 @@ namespace CORBA /// Accessor to the flag.. CORBA::Boolean is_evaluated (void) const; - /// Mutator for setting the servant in collocated cases. - /** - * This is used by the Object_Adapter to set the servant for - * collocated cases and only when the object is initialized. The - * object initialization takes place when IOR's are lazily - * evaluated. - */ - void set_collocated_servant (TAO_Abstract_ServantBase *); - /// Accessor for the ORB_Core.. TAO_ORB_Core *orb_core (void) const; @@ -339,8 +330,7 @@ namespace CORBA virtual char* convert_to_ior (bool use_omg_ior_format, const char* ior_prefix) const; - /// Wrapper for _remove_ref(), naming convention for - /// templatizing. + /// Wrapper for _remove_ref(), naming convention for templatizing. void _decr_refcount (void); protected: diff --git a/TAO/tao/Object_T.cpp b/TAO/tao/Object_T.cpp index e48f0a5287c..17abfa18791 100644 --- a/TAO/tao/Object_T.cpp +++ b/TAO/tao/Object_T.cpp @@ -16,44 +16,23 @@ namespace TAO template<typename T> T * Narrow_Utils<T>::narrow (CORBA::Object_ptr obj, - const char *repo_id, - Proxy_Broker_Factory pbf) + const char *repo_id) { if (CORBA::is_nil (obj)) { return T::_nil (); } - if (obj->_is_a (repo_id) == false) + if (!obj->_is_a (repo_id)) { return T::_nil (); } - return TAO::Narrow_Utils<T>::unchecked_narrow (obj, repo_id, pbf); + return TAO::Narrow_Utils<T>::unchecked_narrow (obj); } template<typename T> T * - Narrow_Utils<T>::unchecked_narrow (CORBA::Object_ptr obj, - Proxy_Broker_Factory pbf) - { - T *proxy = 0; - try - { - proxy = TAO::Narrow_Utils<T>::unchecked_narrow (obj, 0, pbf); - } - catch (const ::CORBA::Exception&) - { - // Swallow the exception - return T::_nil (); - } - - return proxy; - } - - template<typename T> T * - Narrow_Utils<T>::unchecked_narrow (CORBA::Object_ptr obj, - const char *, - Proxy_Broker_Factory pbf) + Narrow_Utils<T>::unchecked_narrow (CORBA::Object_ptr obj) { if (CORBA::is_nil (obj)) { @@ -65,34 +44,38 @@ namespace TAO return T::_duplicate (dynamic_cast<T *> (obj)); } - T_ptr proxy = Narrow_Utils<T>::lazy_evaluation (obj); - - if (!CORBA::is_nil (proxy)) + T_ptr proxy = T::_nil (); + try { - return proxy; + proxy = Narrow_Utils<T>::lazy_evaluation (obj); + + if (CORBA::is_nil (proxy)) + { + TAO_Stub* stub = obj->_stubobj (); + + if (stub != 0) + { + stub->_incr_refcnt (); + + bool const collocated = + !CORBA::is_nil (stub->servant_orb_var ().in ()) + && stub->optimize_collocation_objects () + && obj->_is_collocated (); + + ACE_NEW_RETURN (proxy, + T (stub, + collocated, + obj->_servant ()), + T::_nil ()); + } + } } - - TAO_Stub* stub = obj->_stubobj (); - - if (stub == 0) + catch (const ::CORBA::Exception&) { - // If we're here, we have been passed a bogus objref. - throw ::CORBA::BAD_PARAM (); + // Swallow the exception + return T::_nil (); } - stub->_incr_refcnt (); - - bool const collocated = - !CORBA::is_nil (stub->servant_orb_var ().in ()) - && stub->optimize_collocation_objects () - && obj->_is_collocated () - && pbf != 0; - - ACE_NEW_THROW_EX (proxy, - T (stub, - collocated, - obj->_servant ()), - CORBA::NO_MEMORY ()); return proxy; } diff --git a/TAO/tao/Object_T.h b/TAO/tao/Object_T.h index 0016da30550..cf8e24f9e7b 100644 --- a/TAO/tao/Object_T.h +++ b/TAO/tao/Object_T.h @@ -24,6 +24,7 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include /**/ "tao/Versioned_Namespace.h" +#include "tao/Collocation_Strategy.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL @@ -35,11 +36,6 @@ namespace CORBA namespace TAO { - class Collocation_Proxy_Broker; - - typedef - Collocation_Proxy_Broker * (* Proxy_Broker_Factory)(CORBA::Object_ptr); - template<typename T> class Narrow_Utils { @@ -47,15 +43,10 @@ namespace TAO typedef T *T_ptr; static T_ptr narrow (CORBA::Object_ptr, - const char *repo_id, - Proxy_Broker_Factory); + const char *repo_id); /// Version used the operators. - static T_ptr unchecked_narrow (CORBA::Object_ptr, Proxy_Broker_Factory); - - static T_ptr unchecked_narrow (CORBA::Object_ptr, - const char *repo_id, - Proxy_Broker_Factory); + static T_ptr unchecked_narrow (CORBA::Object_ptr); private: // Code for lazily evaluated IORs. diff --git a/TAO/tao/PolicyC.cpp b/TAO/tao/PolicyC.cpp index 604ac00ebcc..58b400fc979 100644 --- a/TAO/tao/PolicyC.cpp +++ b/TAO/tao/PolicyC.cpp @@ -368,12 +368,6 @@ TAO::Objref_Traits<CORBA::Policy>::marshal ( return CORBA::Object::marshal (p, cdr); } -// Function pointer for collocation factory initialization. -TAO::Collocation_Proxy_Broker * -(*CORBA__TAO_Policy_Proxy_Broker_Factory_function_pointer) ( - CORBA::Object_ptr obj - ) = 0; - // TAO_IDL - Generated from // be\be_visitor_operation/operation_cs.cpp:78 @@ -386,11 +380,6 @@ CORBA::PolicyType CORBA::Policy::policy_type ( ::CORBA::Object::tao_object_initialize (this); } - if (this->the_TAO_Policy_Proxy_Broker_ == 0) - { - CORBA_Policy_setup_collocation (); - } - TAO::Arg_Traits< ::CORBA::PolicyType>::ret_val _tao_retval; TAO::Argument *_the_tao_operation_signature [] = @@ -404,7 +393,7 @@ CORBA::PolicyType CORBA::Policy::policy_type ( 1, "_get_policy_type", 16, - this->the_TAO_Policy_Proxy_Broker_ + TAO::TAO_CO_NONE | TAO::TAO_CO_DIRECT_STRATEGY | TAO::TAO_CO_THRU_POA_STRATEGY ); _tao_call.invoke (0, 0); @@ -424,11 +413,6 @@ CORBA::PolicyType CORBA::Policy::policy_type ( ::CORBA::Object::tao_object_initialize (this); } - if (this->the_TAO_Policy_Proxy_Broker_ == 0) - { - CORBA_Policy_setup_collocation (); - } - TAO::Arg_Traits< ::CORBA::Policy>::ret_val _tao_retval; TAO::Argument *_the_tao_operation_signature [] = @@ -442,7 +426,7 @@ CORBA::PolicyType CORBA::Policy::policy_type ( 1, "copy", 4, - this->the_TAO_Policy_Proxy_Broker_ + TAO::TAO_CO_NONE | TAO::TAO_CO_DIRECT_STRATEGY | TAO::TAO_CO_THRU_POA_STRATEGY ); _tao_call.invoke (0, 0); @@ -462,11 +446,6 @@ void CORBA::Policy::destroy ( ::CORBA::Object::tao_object_initialize (this); } - if (this->the_TAO_Policy_Proxy_Broker_ == 0) - { - CORBA_Policy_setup_collocation (); - } - TAO::Arg_Traits< void>::ret_val _tao_retval; TAO::Argument *_the_tao_operation_signature [] = @@ -480,26 +459,14 @@ void CORBA::Policy::destroy ( 1, "destroy", 7, - this->the_TAO_Policy_Proxy_Broker_ + TAO::TAO_CO_NONE | TAO::TAO_CO_DIRECT_STRATEGY | TAO::TAO_CO_THRU_POA_STRATEGY ); _tao_call.invoke (0, 0); } CORBA::Policy::Policy (void) - : the_TAO_Policy_Proxy_Broker_ (0) -{ - this->CORBA_Policy_setup_collocation (); -} - -void -CORBA::Policy::CORBA_Policy_setup_collocation () { - if (::CORBA__TAO_Policy_Proxy_Broker_Factory_function_pointer) - { - this->the_TAO_Policy_Proxy_Broker_ = - ::CORBA__TAO_Policy_Proxy_Broker_Factory_function_pointer (this); - } } CORBA::Policy::~Policy (void) @@ -514,33 +481,19 @@ CORBA::Policy::_tao_any_destructor (void *_tao_void_pointer) } CORBA::Policy_ptr -CORBA::Policy::_narrow ( - CORBA::Object_ptr _tao_objref - - ) +CORBA::Policy::_narrow (CORBA::Object_ptr _tao_objref) { return TAO::Narrow_Utils<Policy>::narrow ( _tao_objref, - "IDL:omg.org/CORBA/Policy:1.0", - CORBA__TAO_Policy_Proxy_Broker_Factory_function_pointer - - ); + "IDL:omg.org/CORBA/Policy:1.0"); } CORBA::Policy_ptr -CORBA::Policy::_unchecked_narrow ( - CORBA::Object_ptr _tao_objref - - ) +CORBA::Policy::_unchecked_narrow (CORBA::Object_ptr _tao_objref) { return - TAO::Narrow_Utils<Policy>::unchecked_narrow ( - _tao_objref, - "IDL:omg.org/CORBA/Policy:1.0", - CORBA__TAO_Policy_Proxy_Broker_Factory_function_pointer - - ); + TAO::Narrow_Utils<Policy>::unchecked_narrow (_tao_objref); } CORBA::Policy_ptr @@ -722,9 +675,7 @@ CORBA::Boolean operator>> ( // Narrow to the right type. _tao_objref = TAO::Narrow_Utils<RHS_SCOPED_NAME>::unchecked_narrow ( - obj.in (), - CORBA__TAO_Policy_Proxy_Broker_Factory_function_pointer - ); + obj.in ()); return 1; } diff --git a/TAO/tao/PolicyC.h b/TAO/tao/PolicyC.h index dc478cbae50..c37bfeb1cfd 100644 --- a/TAO/tao/PolicyC.h +++ b/TAO/tao/PolicyC.h @@ -67,7 +67,6 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace TAO { - class Collocation_Proxy_Broker; template<typename T> class Narrow_Utils; } @@ -314,17 +313,10 @@ namespace CORBA virtual TAO_Policy_Scope _tao_scope (void) const; // **************************************************************** - private: - TAO::Collocation_Proxy_Broker *the_TAO_Policy_Proxy_Broker_; - protected: // Concrete interface only. Policy (void); - // These methods travese the inheritance tree and set the - // parents piece of the given class in the right mode. - virtual void CORBA_Policy_setup_collocation (void); - // Concrete non-local interface only. Policy ( IOP::IOR *ior, @@ -355,17 +347,6 @@ namespace CORBA } // module CORBA -// Proxy Broker Factory function pointer declarations. - -// TAO_IDL - Generated from -// be\be_visitor_root/root.cpp:139 - -extern TAO_Export -TAO::Collocation_Proxy_Broker * -(*CORBA__TAO_Policy_Proxy_Broker_Factory_function_pointer) ( - CORBA::Object_ptr obj - ); - // TAO_IDL - Generated from // be\be_visitor_traits.cpp:61 diff --git a/TAO/tao/PolicyC.inl b/TAO/tao/PolicyC.inl index f9aac3d9fae..05a60494650 100644 --- a/TAO/tao/PolicyC.inl +++ b/TAO/tao/PolicyC.inl @@ -39,21 +39,16 @@ CORBA::Policy::Policy ( TAO_Stub *objref, CORBA::Boolean _tao_collocated, TAO_Abstract_ServantBase *servant, - TAO_ORB_Core *oc - ) - : ::CORBA::Object (objref, _tao_collocated, servant, oc), - the_TAO_Policy_Proxy_Broker_ (0) + TAO_ORB_Core *oc) + : ::CORBA::Object (objref, _tao_collocated, servant, oc) { - this->CORBA_Policy_setup_collocation (); } ACE_INLINE CORBA::Policy::Policy ( IOP::IOR *ior, - TAO_ORB_Core *oc - ) - : ::CORBA::Object (ior, oc), - the_TAO_Policy_Proxy_Broker_ (0) + TAO_ORB_Core *oc) + : ::CORBA::Object (ior, oc) { } diff --git a/TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.cpp b/TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.cpp index c045934fa59..b6a94a51993 100644 --- a/TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.cpp +++ b/TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.cpp @@ -21,21 +21,21 @@ namespace TAO // Which collocation strategy should we use? if (stub != 0 && stub->servant_orb_var ()->orb_core ()->get_collocation_strategy () - == TAO_ORB_Core::THRU_POA) + == TAO_ORB_Core::TAO_COLLOCATION_THRU_POA) { TAO::Portable_Server::Servant_Upcall servant_upcall ( stub->servant_orb_var ()->orb_core ()); - CORBA::Object_var forward_to; - servant_upcall.prepare_for_upcall ( - stub->profile_in_use ()->object_key (), - "_is_a", - forward_to.out ()); + CORBA::Object_var forward_to; + servant_upcall.prepare_for_upcall ( + stub->profile_in_use ()->object_key (), + "_is_a", + forward_to.out ()); - servant_upcall.pre_invoke_collocated_request (); + servant_upcall.pre_invoke_collocated_request (); - return servant_upcall.servant ()->_is_a (type_id); - } + return servant_upcall.servant ()->_is_a (type_id); + } // Direct collocation strategy is used. if (target->_servant () != 0) @@ -43,7 +43,7 @@ namespace TAO return target->_servant ()->_is_a (type_id); } - return 0; + return false; } #if (TAO_HAS_MINIMUM_CORBA == 0) @@ -59,7 +59,7 @@ namespace TAO // Which collocation strategy should we use? if (stub != 0 && stub->servant_orb_var ()->orb_core () - ->get_collocation_strategy () == TAO_ORB_Core::THRU_POA) + ->get_collocation_strategy () == TAO_ORB_Core::TAO_COLLOCATION_THRU_POA) { TAO::Portable_Server::Servant_Upcall servant_upcall ( stub->servant_orb_var ()->orb_core ()); @@ -97,7 +97,7 @@ namespace TAO // Which collocation strategy should we use? if (stub != 0 && stub->servant_orb_var ()->orb_core () - ->get_collocation_strategy () == TAO_ORB_Core::THRU_POA) + ->get_collocation_strategy () == TAO_ORB_Core::TAO_COLLOCATION_THRU_POA) { TAO::Portable_Server::Servant_Upcall servant_upcall ( target->_stubobj ()->servant_orb_var ()->orb_core ()); @@ -135,7 +135,7 @@ namespace TAO // Which collocation strategy should we use? if (stub != 0 && stub->servant_orb_var ()->orb_core () - ->get_collocation_strategy () == TAO_ORB_Core::THRU_POA) + ->get_collocation_strategy () == TAO_ORB_Core::TAO_COLLOCATION_THRU_POA) { TAO::Portable_Server::Servant_Upcall servant_upcall ( stub->servant_orb_var ()->orb_core ()); @@ -174,7 +174,7 @@ namespace TAO // Which collocation strategy should we use? if (stub != 0 && stub->servant_orb_var ()->orb_core ()->get_collocation_strategy () - == TAO_ORB_Core::THRU_POA) + == TAO_ORB_Core::TAO_COLLOCATION_THRU_POA) { TAO::Portable_Server::Servant_Upcall servant_upcall ( target->_stubobj ()->servant_orb_var ()->orb_core ()); diff --git a/TAO/tao/PortableServer/Direct_Collocation_Upcall_Wrapper.cpp b/TAO/tao/PortableServer/Direct_Collocation_Upcall_Wrapper.cpp index fea4bc90175..56e68d482d9 100644 --- a/TAO/tao/PortableServer/Direct_Collocation_Upcall_Wrapper.cpp +++ b/TAO/tao/PortableServer/Direct_Collocation_Upcall_Wrapper.cpp @@ -20,7 +20,7 @@ TAO::Direct_Collocation_Upcall_Wrapper::upcall ( CORBA::Object_out forward_obj, bool & is_forwarded, TAO::Argument ** args, - int num_args, + int, const char * op, size_t op_len, TAO::Collocation_Strategy strategy) @@ -38,7 +38,7 @@ TAO::Direct_Collocation_Upcall_Wrapper::upcall ( try { #endif /* TAO_HAS_MINIMUM_CORBA && !CORBA_E_COMPACT && !CORBA_E_MICRO*/ - collocated_skel (servant, args, num_args); + collocated_skel (servant, args); #if (TAO_HAS_MINIMUM_CORBA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) } catch (const ::PortableServer::ForwardRequest& forward_request) diff --git a/TAO/tao/PortableServer/Direct_Collocation_Upcall_Wrapper.h b/TAO/tao/PortableServer/Direct_Collocation_Upcall_Wrapper.h index 02213483f81..9b8a6d02be2 100644 --- a/TAO/tao/PortableServer/Direct_Collocation_Upcall_Wrapper.h +++ b/TAO/tao/PortableServer/Direct_Collocation_Upcall_Wrapper.h @@ -51,7 +51,6 @@ namespace TAO class TAO_PortableServer_Export Direct_Collocation_Upcall_Wrapper { public: - /// Perform the upcall void upcall ( CORBA::Object_ptr obj, diff --git a/TAO/tao/PortableServer/Object_Adapter.cpp b/TAO/tao/PortableServer/Object_Adapter.cpp index 8686ad9979d..3b4940e3f6f 100644 --- a/TAO/tao/PortableServer/Object_Adapter.cpp +++ b/TAO/tao/PortableServer/Object_Adapter.cpp @@ -514,7 +514,7 @@ TAO_Object_Adapter::locate_servant_i (const TAO::ObjectKey &key) this->locate_poa (key, id, poa); PortableServer::Servant servant = 0; - TAO_SERVANT_LOCATION servant_location = + TAO_SERVANT_LOCATION const servant_location = poa->locate_servant_i (id, servant); switch (servant_location) diff --git a/TAO/tao/PortableServer/Operation_Table.h b/TAO/tao/PortableServer/Operation_Table.h index 87b81a7dec7..9a11e5f1b5a 100644 --- a/TAO/tao/PortableServer/Operation_Table.h +++ b/TAO/tao/PortableServer/Operation_Table.h @@ -32,14 +32,11 @@ class TAO_Abstract_ServantBase; typedef void (*TAO_Skeleton)( TAO_ServerRequest &, void *, - void * - ); + void *); typedef void (*TAO_Collocated_Skeleton)( TAO_Abstract_ServantBase *, - TAO::Argument **, - int - ); + TAO::Argument **); /** * @struct TAO_operation_db_entry diff --git a/TAO/tao/PortableServer/PolicyS.cpp b/TAO/tao/PortableServer/PolicyS.cpp index b9bffd54bbe..6a533af379a 100644 --- a/TAO/tao/PortableServer/PolicyS.cpp +++ b/TAO/tao/PortableServer/PolicyS.cpp @@ -204,99 +204,6 @@ TAO_CORBA_Policy_Perfect_Hash_OpTable::lookup (const char *str, unsigned int len } static TAO_CORBA_Policy_Perfect_Hash_OpTable tao_CORBA_Policy_optable; -/////////////////////////////////////////////////////////////////////// -// Strategized Proxy Broker Implementation -// - -// TAO_IDL - Generated from -// be\be_visitor_interface/strategized_proxy_broker_ss.cpp:40 - -// Factory function Implementation. -POA_CORBA::_TAO_Policy_Strategized_Proxy_Broker * -POA_CORBA::_TAO_Policy_Strategized_Proxy_Broker::the_TAO_Policy_Strategized_Proxy_Broker (void) -{ - static POA_CORBA::_TAO_Policy_Strategized_Proxy_Broker - strategized_proxy_broker; - - return &strategized_proxy_broker; -} - -POA_CORBA::_TAO_Policy_Strategized_Proxy_Broker::_TAO_Policy_Strategized_Proxy_Broker (void) -{ -} - -POA_CORBA::_TAO_Policy_Strategized_Proxy_Broker::~_TAO_Policy_Strategized_Proxy_Broker (void) -{ -} - -TAO::Collocation_Strategy -POA_CORBA::_TAO_Policy_Strategized_Proxy_Broker::get_strategy ( - CORBA::Object_ptr obj - - ) -{ - TAO::Collocation_Strategy strategy = - TAO_ORB_Core::collocation_strategy (obj); - - return strategy; -} - -void -POA_CORBA::_TAO_Policy_Strategized_Proxy_Broker::dispatch ( - CORBA::Object_ptr obj, - CORBA::Object_out forward_obj, - bool & is_forwarded, - TAO::Argument ** args, - int num_args, - const char * op, - size_t op_len, - TAO::Collocation_Strategy strategy - - ) -{ - TAO::Direct_Collocation_Upcall_Wrapper collocation_upcall_wrapper; - collocation_upcall_wrapper.upcall ( - obj, - forward_obj, - is_forwarded, - args, - num_args, - op, - op_len, - strategy - ); -} - -// -// End Strategized Proxy Broker Implementation -/////////////////////////////////////////////////////////////////////// - -// TAO_IDL - Generated from -// be\be_visitor_interface/interface_ss.cpp:999 - -TAO::Collocation_Proxy_Broker * -CORBA__TAO_Policy_Proxy_Broker_Factory_function (CORBA::Object_ptr) -{ - return - ::POA_CORBA::_TAO_Policy_Strategized_Proxy_Broker::the_TAO_Policy_Strategized_Proxy_Broker (); -} - -int -CORBA__TAO_Policy_Proxy_Broker_Factory_Initializer (size_t) -{ - CORBA__TAO_Policy_Proxy_Broker_Factory_function_pointer = - CORBA__TAO_Policy_Proxy_Broker_Factory_function; - - return 0; -} - -static int -CORBA__TAO_Policy_Proxy_Broker_Stub_Factory_Initializer_Scarecrow = - CORBA__TAO_Policy_Proxy_Broker_Factory_Initializer ( - reinterpret_cast<size_t> (CORBA__TAO_Policy_Proxy_Broker_Factory_Initializer) - ); - - /////////////////////////////////////////////////////////////////////// // Direct Proxy Implementation @@ -314,17 +221,12 @@ POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::~_TAO_Policy_Direct_Proxy_Impl (void) void POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::_get_policy_type ( TAO_Abstract_ServantBase *servant, - TAO::Argument ** args, - int - - ) + TAO::Argument ** args) { ((TAO::Arg_Traits< ::CORBA::PolicyType>::ret_val *) args[0])->arg () = dynamic_cast<POA_CORBA::Policy_ptr> (servant) - ->policy_type ( - - ); + ->policy_type (); } // TAO_IDL - Generated from // be\be_visitor_operation/direct_proxy_impl_ss.cpp:42 @@ -332,17 +234,12 @@ POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::_get_policy_type ( void POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::copy ( TAO_Abstract_ServantBase *servant, - TAO::Argument ** args, - int - - ) + TAO::Argument ** args) { ((TAO::Arg_Traits< CORBA::Policy>::ret_val *) args[0])->arg () = dynamic_cast<POA_CORBA::Policy_ptr> (servant) - ->copy ( - - ); + ->copy (); } // TAO_IDL - Generated from // be\be_visitor_operation/direct_proxy_impl_ss.cpp:42 @@ -350,15 +247,11 @@ POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::copy ( void POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::destroy ( TAO_Abstract_ServantBase *servant, - TAO::Argument **, - int - ) + TAO::Argument **) { dynamic_cast<POA_CORBA::Policy_ptr> (servant) - ->destroy ( - - ); + ->destroy (); } @@ -1026,9 +919,7 @@ POA_CORBA::Policy::_this (void) typedef ::CORBA::Policy STUB_SCOPED_NAME; return TAO::Narrow_Utils<STUB_SCOPED_NAME>::unchecked_narrow ( - obj.in (), - CORBA__TAO_Policy_Proxy_Broker_Factory_function_pointer - ); + obj.in ()); } #endif /* ifndef */ diff --git a/TAO/tao/PortableServer/PolicyS.h b/TAO/tao/PortableServer/PolicyS.h index 44603b46599..fc076ae73b5 100644 --- a/TAO/tao/PortableServer/PolicyS.h +++ b/TAO/tao/PortableServer/PolicyS.h @@ -42,7 +42,6 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "tao/Collocation_Proxy_Broker.h" #include "tao/PortableServer/PortableServer.h" #include "tao/PortableServer/Servant_Base.h" @@ -73,9 +72,6 @@ namespace POA_CORBA class Policy; typedef Policy *Policy_ptr; - class _TAO_Policy_Direct_Proxy_Impl; - class _TAO_Policy_Strategized_Proxy_Broker; - class TAO_PortableServer_Export Policy : public virtual PortableServer::ServantBase { @@ -182,48 +178,6 @@ namespace POA_CORBA ); }; - /////////////////////////////////////////////////////////////////////// - // Strategized Proxy Broker Declaration - // - - // TAO_IDL - Generated from - // be\be_visitor_interface/strategized_proxy_broker_sh.cpp:36 - - class TAO_PortableServer_Export _TAO_Policy_Strategized_Proxy_Broker - : public virtual TAO::Collocation_Proxy_Broker - { - public: - _TAO_Policy_Strategized_Proxy_Broker (void); - - virtual ~_TAO_Policy_Strategized_Proxy_Broker (void); - - TAO::Collocation_Strategy - get_strategy ( - CORBA::Object_ptr obj - - ); - - void - dispatch ( - CORBA::Object_ptr obj, - CORBA::Object_out forward_obj, - bool & is_forwarded, - TAO::Argument ** args, - int num_args, - const char * op, - size_t op_len, - TAO::Collocation_Strategy strategy - - ); - - static _TAO_Policy_Strategized_Proxy_Broker * - the_TAO_Policy_Strategized_Proxy_Broker (void); - }; - - // - // End Strategized Proxy Broker Declaration - /////////////////////////////////////////////////////////////////////// - // TAO_IDL - Generated from @@ -246,10 +200,7 @@ namespace POA_CORBA static void _get_policy_type ( TAO_Abstract_ServantBase *servant, - TAO::Argument ** args, - int num_args - - ); + TAO::Argument ** args); // TAO_IDL - Generated from // be\be_visitor_operation/proxy_impl_xh.cpp:24 @@ -257,10 +208,7 @@ namespace POA_CORBA static void copy ( TAO_Abstract_ServantBase *servant, - TAO::Argument ** args, - int num_args - - ); + TAO::Argument ** args); // TAO_IDL - Generated from // be\be_visitor_operation/proxy_impl_xh.cpp:24 @@ -268,10 +216,7 @@ namespace POA_CORBA static void destroy ( TAO_Abstract_ServantBase *servant, - TAO::Argument ** args, - int num_args - - ); + TAO::Argument ** args); }; // diff --git a/TAO/tao/PortableServer/Servant_Base.cpp b/TAO/tao/PortableServer/Servant_Base.cpp index 96e284963ef..4c33eb15523 100644 --- a/TAO/tao/PortableServer/Servant_Base.cpp +++ b/TAO/tao/PortableServer/Servant_Base.cpp @@ -5,6 +5,7 @@ #include "tao/PortableServer/Root_POA.h" #include "tao/PortableServer/Operation_Table.h" #include "tao/PortableServer/POA_Current_Impl.h" +#include "tao/PortableServer/Direct_Collocation_Upcall_Wrapper.h" #include "tao/Timeprobe.h" #include "tao/ORB_Core.h" @@ -328,4 +329,26 @@ TAO_ServantBase::_refcount_value (void) const return this->ref_count_.value (); } +void +TAO_ServantBase::_collocated_dispatch (::CORBA::Object_ptr obj, + ::CORBA::Object_out forward_obj, + bool &is_forwarded, + TAO::Argument ** args, + int num_args, + const char * op, + size_t op_len, + TAO::Collocation_Strategy strategy) +{ + TAO::Direct_Collocation_Upcall_Wrapper collocation_upcall_wrapper; + collocation_upcall_wrapper.upcall ( + obj, + forward_obj, + is_forwarded, + args, + num_args, + op, + op_len, + strategy); +} + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/PortableServer/Servant_Base.h b/TAO/tao/PortableServer/Servant_Base.h index 5b9090eb203..f2e43803cb4 100644 --- a/TAO/tao/PortableServer/Servant_Base.h +++ b/TAO/tao/PortableServer/Servant_Base.h @@ -134,6 +134,15 @@ public: virtual CORBA::ULong _refcount_value (void) const; //@} + virtual void _collocated_dispatch (::CORBA::Object_ptr obj, + ::CORBA::Object_out forward_obj, + bool &is_forwarded, + TAO::Argument ** args, + int num_args, + const char * op, + size_t op_len, + TAO::Collocation_Strategy strategy); + protected: /// Default constructor, only derived classes can be created. diff --git a/TAO/tao/PortableServer/Servant_Upcall.cpp b/TAO/tao/PortableServer/Servant_Upcall.cpp index 5b3383148c2..e172081ef7c 100644 --- a/TAO/tao/PortableServer/Servant_Upcall.cpp +++ b/TAO/tao/PortableServer/Servant_Upcall.cpp @@ -54,7 +54,7 @@ namespace TAO { bool wait_occurred_restart_call = false; - int result = + int const result = this->prepare_for_upcall_i (key, operation, forward_to, diff --git a/TAO/tao/Remote_Object_Proxy_Broker.cpp b/TAO/tao/Remote_Object_Proxy_Broker.cpp index 8dbf58e2a23..3d5d61b6032 100644 --- a/TAO/tao/Remote_Object_Proxy_Broker.cpp +++ b/TAO/tao/Remote_Object_Proxy_Broker.cpp @@ -34,7 +34,7 @@ namespace TAO 2, "_is_a", 5, - 0); + TAO::TAO_CO_NONE | TAO::TAO_CO_THRU_POA_STRATEGY); tao_call.invoke (0, 0); @@ -58,7 +58,7 @@ namespace TAO 1, "_non_existent", 13, - 0); + TAO::TAO_CO_NONE | TAO::TAO_CO_THRU_POA_STRATEGY); _tao_call.invoke (0, 0); @@ -80,7 +80,7 @@ namespace TAO 1, "_component", 10, - 0); + TAO::TAO_CO_NONE | TAO::TAO_CO_THRU_POA_STRATEGY); _tao_call.invoke (0, 0); @@ -118,7 +118,7 @@ namespace TAO 1, "_repository_id", 14, - 0); + TAO::TAO_CO_NONE | TAO::TAO_CO_THRU_POA_STRATEGY); _tao_call.invoke (0, 0); diff --git a/TAO/tao/Valuetype/AbstractBase_Invocation_Adapter.cpp b/TAO/tao/Valuetype/AbstractBase_Invocation_Adapter.cpp index bcb3e3c3849..b9018137a4b 100644 --- a/TAO/tao/Valuetype/AbstractBase_Invocation_Adapter.cpp +++ b/TAO/tao/Valuetype/AbstractBase_Invocation_Adapter.cpp @@ -14,7 +14,7 @@ namespace TAO int arg_number, const char *operation, size_t op_len, - Collocation_Proxy_Broker *p, + int collocation_opportunity, Invocation_Type type, Invocation_Mode mode) : Invocation_Adapter (target->equivalent_objref (), @@ -22,7 +22,7 @@ namespace TAO arg_number, operation, op_len, - p, + collocation_opportunity, type, mode) { diff --git a/TAO/tao/Valuetype/AbstractBase_Invocation_Adapter.h b/TAO/tao/Valuetype/AbstractBase_Invocation_Adapter.h index afac495a54f..498dd7eaae1 100644 --- a/TAO/tao/Valuetype/AbstractBase_Invocation_Adapter.h +++ b/TAO/tao/Valuetype/AbstractBase_Invocation_Adapter.h @@ -51,7 +51,7 @@ namespace TAO int arg_number, const char *operation, size_t op_len, - Collocation_Proxy_Broker *cpb, + int collocation_opportunity, TAO::Invocation_Type type = TAO_TWOWAY_INVOCATION, TAO::Invocation_Mode mode = TAO_SYNCHRONOUS_INVOCATION); diff --git a/TAO/tao/Valuetype/AbstractBase_T.cpp b/TAO/tao/Valuetype/AbstractBase_T.cpp index 01f4e0ab83f..18d9b04672e 100644 --- a/TAO/tao/Valuetype/AbstractBase_T.cpp +++ b/TAO/tao/Valuetype/AbstractBase_T.cpp @@ -14,47 +14,23 @@ namespace TAO template<typename T> T * AbstractBase_Narrow_Utils<T>::narrow ( CORBA::AbstractBase_ptr obj, - const char *repo_id, - Proxy_Broker_Factory pbf) + const char *repo_id) { if (CORBA::is_nil (obj)) { return T::_nil (); } - if (obj->_is_a (repo_id) == false) + if (!obj->_is_a (repo_id)) { return T::_nil (); } - return - AbstractBase_Narrow_Utils<T>::unchecked_narrow (obj, repo_id, pbf); + return AbstractBase_Narrow_Utils<T>::unchecked_narrow (obj); } template<typename T> T * - AbstractBase_Narrow_Utils<T>::unchecked_narrow ( - CORBA::AbstractBase_ptr obj, - Proxy_Broker_Factory pbf) - { - T *proxy = 0; - - try - { - proxy = - AbstractBase_Narrow_Utils<T>::unchecked_narrow (obj, 0, pbf); - } - catch (const ::CORBA::Exception&) - { - } - - return proxy; - } - - template<typename T> T * - AbstractBase_Narrow_Utils<T>::unchecked_narrow ( - CORBA::AbstractBase_ptr obj, - const char *, - Proxy_Broker_Factory pbf) + AbstractBase_Narrow_Utils<T>::unchecked_narrow (CORBA::AbstractBase_ptr obj) { if (CORBA::is_nil (obj)) { @@ -63,27 +39,32 @@ namespace TAO T_ptr proxy = T::_nil (); - if (obj->_is_objref ()) + try { - TAO_Stub* stub = obj->_stubobj (); - - bool const collocated = - !CORBA::is_nil (stub->servant_orb_var ().in ()) - && stub->optimize_collocation_objects () - && obj->_is_collocated () - && pbf != 0; - - ACE_NEW_THROW_EX (proxy, - T (obj->_stubobj (), - collocated, - obj->_servant ()), - CORBA::NO_MEMORY ()); + if (obj->_is_objref ()) + { + TAO_Stub* stub = obj->_stubobj (); + + bool const collocated = + !CORBA::is_nil (stub->servant_orb_var ().in ()) + && stub->optimize_collocation_objects () + && obj->_is_collocated (); + + ACE_NEW_RETURN (proxy, + T (obj->_stubobj (), + collocated, + obj->_servant ()), + T::_nil ()); + } + else + { + proxy = dynamic_cast<T *> (obj); + if (proxy) + proxy->_add_ref (); + } } - else + catch (const ::CORBA::Exception&) { - proxy = dynamic_cast<T *> (obj); - if (proxy) - proxy->_add_ref (); } return proxy; diff --git a/TAO/tao/Valuetype/AbstractBase_T.h b/TAO/tao/Valuetype/AbstractBase_T.h index 3d088a6645b..54eb936be9f 100644 --- a/TAO/tao/Valuetype/AbstractBase_T.h +++ b/TAO/tao/Valuetype/AbstractBase_T.h @@ -37,15 +37,9 @@ namespace TAO typedef T *T_ptr; static T_ptr narrow (CORBA::AbstractBase_ptr, - const char *repo_id, - Proxy_Broker_Factory); + const char *repo_id); - static T_ptr unchecked_narrow (CORBA::AbstractBase_ptr, - Proxy_Broker_Factory); - - static T_ptr unchecked_narrow (CORBA::AbstractBase_ptr, - const char *repo_id, - Proxy_Broker_Factory); + static T_ptr unchecked_narrow (CORBA::AbstractBase_ptr); }; } diff --git a/TAO/tao/orbconf.h b/TAO/tao/orbconf.h index 4d14a5af3a1..8e8efb4f900 100644 --- a/TAO/tao/orbconf.h +++ b/TAO/tao/orbconf.h @@ -885,6 +885,10 @@ enum TAO_Policy_Scope # define TAO_HAS_SEQUENCE_ITERATORS 0 #endif +#if !defined (TAO_DEFAULT_COLLOCATION_STRATEGY) +# define TAO_DEFAULT_COLLOCATION_STRATEGY TAO_COLLOCATION_THRU_POA +#endif + TAO_END_VERSIONED_NAMESPACE_DECL #include /**/ "ace/post.h" diff --git a/TAO/tao/tao.mpc b/TAO/tao/tao.mpc index 3318978a531..d431edf9503 100644 --- a/TAO/tao/tao.mpc +++ b/TAO/tao/tao.mpc @@ -105,7 +105,6 @@ project(TAO) : acelib, install, tao_output, taodefaults, pidl, extra_core, taoid Codeset_Manager_Factory_Base.cpp Codeset_Translator_Base.cpp Collocated_Invocation.cpp - Collocation_Proxy_Broker.cpp Collocation_Resolver.cpp Connect_Strategy.cpp Connection_Handler.cpp @@ -361,7 +360,6 @@ project(TAO) : acelib, install, tao_output, taodefaults, pidl, extra_core, taoid Codeset_Manager_Factory_Base.h Codeset_Translator_Base.h Collocated_Invocation.h - Collocation_Proxy_Broker.h Collocation_Resolver.h Collocation_Strategy.h Condition.h diff --git a/TAO/tests/AMH_Oneway/server.cpp b/TAO/tests/AMH_Oneway/server.cpp index c2db9616e73..d680776d9f6 100644 --- a/TAO/tests/AMH_Oneway/server.cpp +++ b/TAO/tests/AMH_Oneway/server.cpp @@ -81,7 +81,7 @@ public: ST_AMH_Server (int *argc, ACE_TCHAR **argv); virtual ~ST_AMH_Server (); - /// ORB inititalisation stuff + /// ORB initialization stuff int start_orb_and_poa (void); /// register the servant with the poa @@ -91,7 +91,7 @@ public: virtual void run_event_loop (); /// do post-run cleanup. This is necessary here because the servant - /// supplied to regiser_servant happens to be allocated on the + /// supplied to register_servant happens to be allocated on the /// stack, and done after the instance of ST_AMH_Server is /// created. This leads to the servant being destroyed before this /// class's destructor. And alternative solution would be allocate @@ -100,7 +100,7 @@ public: virtual void cleanup (); public: - /// Accesor method (for servants) to the initialised ORB + /// Accesor method (for servants) to the initialized ORB CORBA::ORB_ptr orb () { return this->orb_.in (); } protected: diff --git a/TAO/tests/Bug_1330_Regression/Test.idl b/TAO/tests/Bug_1330_Regression/Test.idl index cf161d304ee..c4d2bf46647 100644 --- a/TAO/tests/Bug_1330_Regression/Test.idl +++ b/TAO/tests/Bug_1330_Regression/Test.idl @@ -4,5 +4,7 @@ interface Test { - void test_method(); + void test_method(); + + oneway void shutdown (); }; diff --git a/TAO/tests/Bug_1330_Regression/Test_i.cpp b/TAO/tests/Bug_1330_Regression/Test_i.cpp index ff714f3bbd6..ef2e83a8dcd 100644 --- a/TAO/tests/Bug_1330_Regression/Test_i.cpp +++ b/TAO/tests/Bug_1330_Regression/Test_i.cpp @@ -3,18 +3,22 @@ // #include "Test_i.h" -Test_i::Test_i() +Test_i::Test_i(CORBA::ORB_ptr orb) + : orb_ (CORBA::ORB::_duplicate (orb)) { - // Noop } Test_i::~Test_i() { - // Noop } void Test_i::test_method (void) { - // Noop +} + +void +Test_i::shutdown (void) +{ + this->orb_->shutdown (0); } diff --git a/TAO/tests/Bug_1330_Regression/Test_i.h b/TAO/tests/Bug_1330_Regression/Test_i.h index 7c5d11c210e..e1f38a78323 100644 --- a/TAO/tests/Bug_1330_Regression/Test_i.h +++ b/TAO/tests/Bug_1330_Regression/Test_i.h @@ -11,15 +11,21 @@ class Test_i: public POA_Test { public: - /// Constructor - Test_i (void); + /// Constructor + Test_i (CORBA::ORB_ptr orb); - /// Destructor - ~Test_i (void); + /// Destructor + ~Test_i (void); - /// A method - void test_method(void); + /// A method + virtual void test_method(void); + virtual void shutdown (void); + +private: + /// Use an ORB reference to conver strings to objects and shutdown + /// the application. + CORBA::ORB_var orb_; }; #endif /* ! BUG_1330_REGRESSION_TEST_I_H */ diff --git a/TAO/tests/Bug_1330_Regression/client.cpp b/TAO/tests/Bug_1330_Regression/client.cpp index 4a0ab7db26d..8613d306f4f 100644 --- a/TAO/tests/Bug_1330_Regression/client.cpp +++ b/TAO/tests/Bug_1330_Regression/client.cpp @@ -5,12 +5,12 @@ #include "ace/Get_Opt.h" const ACE_TCHAR *ior = ACE_TEXT("corbaloc:iiop:localhost:12345/Name\\2dwith\\2dhyphens"); -int shutdown_server = 0; +bool shutdown_server = false; int parse_args (int argc, ACE_TCHAR *argv[]) { - ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:")); + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("sk:")); int c; while ((c = get_opts ()) != -1) @@ -20,7 +20,7 @@ parse_args (int argc, ACE_TCHAR *argv[]) ior = get_opts.opt_arg (); break; case 's': - shutdown_server = 1; + shutdown_server = true; break; case '?': default: @@ -65,12 +65,16 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) server->test_method(); result =0; + if (shutdown_server) + { + server->shutdown (); + } orb->destroy (); } catch (const CORBA::Exception&) { - result =1; + result = 1; } return result; diff --git a/TAO/tests/Bug_1330_Regression/run_test.pl b/TAO/tests/Bug_1330_Regression/run_test.pl index 84dd57fcc9d..b0a809e0ccd 100755 --- a/TAO/tests/Bug_1330_Regression/run_test.pl +++ b/TAO/tests/Bug_1330_Regression/run_test.pl @@ -35,10 +35,10 @@ $SV = $server->CreateProcess ("server", "-o $server_iorfile"); $CL1 = $client->CreateProcess ("client", - "-k \"corbaloc:iiop:$TARGETHOSTNAME:$port/Name\\2dwith\\2dhyphens\""); + "-ORBdebuglevel $debug_level -k \"corbaloc:iiop:$TARGETHOSTNAME:$port/Name\\2dwith\\2dhyphens\""); $CL2 = $client->CreateProcess ("client", - "-k corbaloc:iiop:$TARGETHOSTNAME:$port/Name%2dwith%2dhyphens"); + "-ORBdebuglevel $debug_level -s -k corbaloc:iiop:$TARGETHOSTNAME:$port/Name%2dwith%2dhyphens"); $server_status = $SV->Spawn (); @@ -69,7 +69,7 @@ if ($client_status != 0) { $status = 1; } -$server_status = $SV->TerminateWaitKill ($server->ProcessStopWaitInterval()); +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval()); if ($server_status != 0) { print STDERR "ERROR: server returned $server_status\n"; diff --git a/TAO/tests/Bug_1330_Regression/server.cpp b/TAO/tests/Bug_1330_Regression/server.cpp index 1d586aa6046..e76e80c4759 100644 --- a/TAO/tests/Bug_1330_Regression/server.cpp +++ b/TAO/tests/Bug_1330_Regression/server.cpp @@ -65,10 +65,14 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) if (parse_args (argc, argv) != 0) return 1; - Test_i server_impl; + Test_i *server_impl = 0; + ACE_NEW_RETURN (server_impl, + Test_i (orb.in ()), + 1); + PortableServer::ServantBase_var owner_transfer(server_impl); PortableServer::ObjectId_var id = - root_poa->activate_object (&server_impl); + root_poa->activate_object (server_impl); CORBA::Object_var object = root_poa->id_to_reference (id.in ()); @@ -85,26 +89,27 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) adapter->bind("Name-with-hyphens", ior.in()); - FILE *output_file= ACE_OS::fopen (ior_file, "w"); if (output_file == 0) ACE_ERROR_RETURN ((LM_ERROR, "SERVER (%P): Cannot open output file " - "for writing IOR: %C", - "server.ior"), + "for writing IOR: %s", + ior_file), 1); ACE_OS::fprintf (output_file, "%s", ior.in ()); ACE_OS::fclose (output_file); ACE_DEBUG ((LM_DEBUG, - "SERVER (%P): Activated as file://%C\n", - "server.ior")); + "SERVER (%P): Activated as file://%s\n", + ior_file)); poa_manager->activate(); orb->run (); root_poa->destroy (1, 1); + + orb->destroy (); } catch (const CORBA::Exception& ex) { diff --git a/TAO/tests/Bug_2241_Regression/Client_Task.cpp b/TAO/tests/Bug_2241_Regression/Client_Task.cpp index e39e0d96191..a4fe1dbbe2c 100644 --- a/TAO/tests/Bug_2241_Regression/Client_Task.cpp +++ b/TAO/tests/Bug_2241_Regression/Client_Task.cpp @@ -18,11 +18,11 @@ Client_Task::Client_Task (const ACE_TCHAR *ior, int Client_Task::svc (void) { + CORBA::Boolean exception = false; try { CORBA::Object_var tmp = this->corb_->string_to_object (input_); - Test::Hello_var hello = Test::Hello::_narrow(tmp.in ()); @@ -33,21 +33,32 @@ Client_Task::svc (void) input_), 1); } + try + { + CORBA::String_var the_string = hello->get_string (); - CORBA::String_var the_string = - hello->get_string (); - - ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n", - the_string.in ())); + ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n", + the_string.in ())); - hello->shutdown (); + hello->shutdown (); + } + catch (CORBA::INTERNAL) + { + exception = true; + ACE_DEBUG ((LM_DEBUG, "OK: Client_Task Expected exception received\n")); + corb_->destroy (); + return 0; + } } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Exception caught:"); return 1; } - + if (!exception) + { + ACE_ERROR ((LM_ERROR, "(ERROR: Client_Task::svc Expected exception not received\n")); + } return 0; } diff --git a/TAO/tests/Bug_2241_Regression/Hello.cpp b/TAO/tests/Bug_2241_Regression/Hello.cpp index cabcd9145d9..fa28f2a6135 100644 --- a/TAO/tests/Bug_2241_Regression/Hello.cpp +++ b/TAO/tests/Bug_2241_Regression/Hello.cpp @@ -16,42 +16,8 @@ char * Hello::get_string (void) { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) Upcall in process ..\n")); - - // Use portable thread IDs - ACE_Thread_ID self_ID; - ACE_Thread_ID this_ID; - this_ID.id(this->thr_id_); - - if (self_ID == this_ID) - { - if (this->orb_->orb_core ()->optimize_collocation_objects () && - this->orb_->orb_core ()->use_global_collocation ()) - { - ACE_ERROR ((LM_ERROR, - "(%P|%t) ERROR: A remote call has been made " - " exiting ..\n")); - ACE_OS::abort (); - } - else if (this->orb_->orb_core ()->optimize_collocation_objects () && - this->orb_->orb_core ()->use_global_collocation () == 0) - { - TAO::ORB_Table * const orb_table = - TAO::ORB_Table::instance (); - - TAO_ORB_Core_Auto_Ptr tmp (orb_table->find ("server_orb")); - if (tmp.get () == 0) - { - // We are running on a single ORB and this is an error. - ACE_ERROR ((LM_ERROR, - "(%P|%t) ERROR: A remote call has been made " - " with a single ORB " - " exiting ..\n")); - ACE_OS::abort (); - } - } - } + ACE_ERROR ((LM_ERROR, + "(%P|%t) ERROR: Unexpected Upcall in process ..\n")); return CORBA::string_dup ("Hello there!"); } diff --git a/TAO/tests/Bug_2241_Regression/README b/TAO/tests/Bug_2241_Regression/README new file mode 100644 index 00000000000..d865dd156e6 --- /dev/null +++ b/TAO/tests/Bug_2241_Regression/README @@ -0,0 +1,4 @@ +This test is build without idlflag -Gd, so Direct collocation isn't enabled. +Running this test with -ORBCollocationStrategy 'direct' should result in an Exception. + + diff --git a/TAO/tests/Bug_2241_Regression/run_test.pl b/TAO/tests/Bug_2241_Regression/run_test.pl index e9c473e8341..4cc8f95201a 100755 --- a/TAO/tests/Bug_2241_Regression/run_test.pl +++ b/TAO/tests/Bug_2241_Regression/run_test.pl @@ -18,36 +18,6 @@ $status = 0; $SV = $server->CreateProcess ("Bug_2241_Regression"); -print STDERR "======== Running in Default Mode \n"; -$SV->Arguments ("-o $server_iorfile -k file://$server_iorfile"); -$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); - -if ($sv != 0) { - print STDERR "ERROR in Collocated_Test\n"; - $status = 1; -} -$server->DeleteFile($iorbase); - -print STDERR "======== Running with global ORBCollocationStrategy\n"; -$SV->Arguments ("-o $server_iorfile -k file://$server_iorfile -ORBCollocation global"); -$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); - -if ($sv != 0) { - print STDERR "ERROR in Collocated_Test\n"; - $status = 1; -} -$server->DeleteFile($iorbase); - -print STDERR "======== Running with global ORBCollocationStrategy thru_poa\n"; -$SV->Arguments ("-o $server_iorfile -k file://$server_iorfile -ORBCollocation global -ORBCollocationStrategy thru_poa"); -$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); - -if ($sv != 0) { - print STDERR "ERROR in Collocated_Test\n"; - $status = 1; -} -$server->DeleteFile($iorbase); - print STDERR "======== Running with -ORBCollocation global -ORBCollocationStrategy direct \n"; $SV->Arguments ("-o $server_iorfile -k file://$server_iorfile -ORBCollocation global -ORBCollocationStrategy direct"); $sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); diff --git a/TAO/tests/Bug_2289_Regression/Bug_2289_Regression.mpc b/TAO/tests/Bug_2289_Regression/Bug_2289_Regression.mpc index 960c4f67ad2..cf4dc3f81cb 100644 --- a/TAO/tests/Bug_2289_Regression/Bug_2289_Regression.mpc +++ b/TAO/tests/Bug_2289_Regression/Bug_2289_Regression.mpc @@ -2,7 +2,7 @@ // $Id$ project(*idl): taoidldefaults { - idlflags += -Gp -Gd -Sa -St + idlflags += -Gp -Gd IDL_Files { Test.idl } diff --git a/TAO/tests/CSD_Collocation/svc.conf.csd b/TAO/tests/CSD_Collocation/svc.conf.csd index 496c14b0103..2e5fd28b84e 100644 --- a/TAO/tests/CSD_Collocation/svc.conf.csd +++ b/TAO/tests/CSD_Collocation/svc.conf.csd @@ -8,9 +8,9 @@ static Advanced_Resource_Factory "-ORBReactorType select_st -ORBInputCDRAllocato # Make sure we use RW client handler so if something goes wrong, the program will bloc, # i.e., won't work. -static Client_Strategy_Factory "-ORBProfileLock null -ORBClientConnectionHandler RW" +static Client_Strategy_Factory "-ORBClientConnectionHandler RW" # Not absolutely necessary for this test, but we add it for fun. -static Server_Strategy_Factory "-ORBConcurrency reactive -ORBPOALock null" +static Server_Strategy_Factory "-ORBConcurrency reactive" static TAO_CSD_TP_Strategy_Factory "-CSDtp child:2:OFF" diff --git a/TAO/tests/Collocated_Best/Collocated_Best_Direct/Client_Task.cpp b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Client_Task.cpp new file mode 100644 index 00000000000..8887b3ce577 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Client_Task.cpp @@ -0,0 +1,63 @@ +// +// $Id$ +// + +#include "Client_Task.h" +#include "TestC.h" + +Client_Task::Client_Task (const ACE_TCHAR *ior, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr) + : ACE_Task_Base (thr_mgr) + , input_ (ior) + , corb_ (CORBA::ORB::_duplicate (corb)) + +{ +} + +int +Client_Task::svc (void) +{ + int status = 0; + try + { + CORBA::Object_var tmp = + this->corb_->string_to_object (input_); + + Test::Hello_var hello = + Test::Hello::_narrow(tmp.in ()); + + if (CORBA::is_nil (hello.in ())) + { + ACE_ERROR_RETURN ((LM_DEBUG, + "Nil Test::Hello reference <%s>\n", + input_), + 1); + } + + CORBA::String_var the_string = + hello->get_string (); + + if (ACE_OS::strcmp (the_string.in (), "Hello there!") != 0) + { + ACE_ERROR ((LM_ERROR, "(%P|%t) - Error, incorrect string returned <%C>\n", + the_string.in ())); + status = 1; + } + else + { + ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n", + the_string.in ())); + } + + hello->shutdown (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + status = 1; + } + + return status; + +} diff --git a/TAO/tests/Collocated_Best/Collocated_Best_Direct/Client_Task.h b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Client_Task.h new file mode 100644 index 00000000000..8f6557cdec8 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Client_Task.h @@ -0,0 +1,37 @@ +// +// $Id$ +// + +#ifndef COLLOCATED_TEST_CLIENT_TASK_H +#define COLLOCATED_TEST_CLIENT_TASK_H +#include /**/ "ace/pre.h" +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/ORB.h" + + +/// Implement a Task to run the client as a thread +class Client_Task : public ACE_Task_Base +{ +public: + + /// Constructor + Client_Task (const ACE_TCHAR *input, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr); + + /// Thread entry point + int svc (void); + +private: + const ACE_TCHAR *input_; + + CORBA::ORB_var corb_; + +}; + +#include /**/ "ace/post.h" +#endif /* COLLOCATED_TEST_CLIENT_TASK_H */ diff --git a/TAO/tests/Collocated_Best/Collocated_Best_Direct/Collocated_Best_Direct.mpc b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Collocated_Best_Direct.mpc new file mode 100644 index 00000000000..2521cb67dda --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Collocated_Best_Direct.mpc @@ -0,0 +1,9 @@ +// -*- MPC -*- +// $Id$ + +// Enable DIRECT Collocation, disable Thru_Poa + +project(Collocated_Best_Direct): taoserver { + exename = Collocated_Best_Direct + idlflags += -Sp -Gd +} diff --git a/TAO/tests/Collocated_Best/Collocated_Best_Direct/Collocated_Test.cpp b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Collocated_Test.cpp new file mode 100644 index 00000000000..282295ad5e3 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Collocated_Test.cpp @@ -0,0 +1,106 @@ +//$Id$ +#include "Server_Task.h" +#include "Client_Task.h" +#include "ace/Get_Opt.h" +#include "ace/Argv_Type_Converter.h" +#include "ace/SString.h" +#include "ace/Manual_Event.h" + +const ACE_TCHAR *output = ACE_TEXT("test.ior"); +const ACE_TCHAR *input = ACE_TEXT("file://test.ior"); +// static int named_orbs = 0; +ACE_CString server_orb; +ACE_CString client_orb; +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:o:n")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + output = get_opts.opt_arg (); + break; + case 'k': + input = get_opts.opt_arg (); + break; + case 'n': + // named_orbs = 1; + server_orb.set ("server_orb"); + client_orb.set ("client_orb"); + break; + case '?': + default: + // This is a hack but that is okay! + return 0; + } + // Indicates successful parsing of the command line + return 0; +} + +int +ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +{ + if (parse_args (argc, + argv) == -1) + return -1; + + try + { + ACE_Argv_Type_Converter satc (argc, argv); + CORBA::ORB_var sorb = + CORBA::ORB_init (satc.get_argc (), + satc.get_TCHAR_argv (), + server_orb.c_str ()); + + ACE_Manual_Event me; + Server_Task server_task (output, + sorb.in (), + me, + ACE_Thread_Manager::instance ()); + + if (server_task.activate (THR_NEW_LWP | THR_JOINABLE, + 1, + 1) == -1) + { + ACE_ERROR ((LM_ERROR, "Error activating server task\n")); + } + + // Wait for the server thread to do some processing + me.wait (); + + ACE_Argv_Type_Converter catc (argc, argv); + CORBA::ORB_var corb = + CORBA::ORB_init (catc.get_argc (), + catc.get_TCHAR_argv (), + client_orb.c_str ()); + + Client_Task client_task (input, + corb.in (), + ACE_Thread_Manager::instance ()); + + if (client_task.activate (THR_NEW_LWP | THR_JOINABLE, + 1, + 1) == -1) + { + ACE_ERROR ((LM_ERROR, "Error activating client task\n")); + } + + // Wait for the client and server to finish + ACE_Thread_Manager::instance ()->wait (); + + // Now that all threads have completed we can destroy the ORB + sorb->destroy (); + if (server_orb != client_orb) + { + corb->destroy (); + } + } + catch (const CORBA::Exception&) + { + // Ignore exceptions.. + } + return 0; +} diff --git a/TAO/tests/Collocated_Best/Collocated_Best_Direct/Hello.cpp b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Hello.cpp new file mode 100644 index 00000000000..6494c809db8 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Hello.cpp @@ -0,0 +1,70 @@ +// +// $Id$ +// +#include "Hello.h" +#include "tao/ORB_Core.h" +#include "tao/ORB_Table.h" +#include "tao/ORB_Core_Auto_Ptr.h" + + Hello::Hello (CORBA::ORB_ptr orb, + ACE_thread_t thrid) + : orb_ (CORBA::ORB::_duplicate (orb)) + , thr_id_ (thrid) +{ +} + +char * +Hello::get_string (void) +{ + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) Upcall in process ..\n")); + + // Use portable thread IDs + ACE_Thread_ID self_ID; + // Thread ID from Server + ACE_Thread_ID this_ID; + this_ID.id(this->thr_id_); + + // Servant Thread ID same as Thread ID server, so a remote call, + // in case of a collocation the servant runs in calling thread (Client) + if (self_ID == this_ID) + { + if (this->orb_->orb_core ()->optimize_collocation_objects () && + this->orb_->orb_core ()->use_global_collocation ()) + { + ACE_ERROR ((LM_ERROR, + "(%P|%t) ERROR: A remote call has been made " + " exiting ..\n")); + ACE_OS::abort (); + } + else if (this->orb_->orb_core ()->optimize_collocation_objects () && + this->orb_->orb_core ()->use_global_collocation () == 0) + { + TAO::ORB_Table * const orb_table = + TAO::ORB_Table::instance (); + + TAO_ORB_Core_Auto_Ptr tmp (orb_table->find ("server_orb")); + if (tmp.get () == 0) + { + // We are running on a single ORB and this is an error. + ACE_ERROR ((LM_ERROR, + "(%P|%t) ERROR: A remote call has been made " + " with a single ORB " + " exiting ..\n")); + ACE_OS::abort (); + } + } + } + + return CORBA::string_dup ("Hello there!"); +} + +void +Hello::shutdown (void) +{ + // Give the client thread time to return from the collocated + // call to this method before shutting down the ORB. We sleep + // to avoid BAD_INV_ORDER exceptions on fast dual processor machines. + ACE_OS::sleep (1); + this->orb_->shutdown (0); +} diff --git a/TAO/tests/Collocated_Best/Collocated_Best_Direct/Hello.h b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Hello.h new file mode 100644 index 00000000000..1d5e27d075f --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Hello.h @@ -0,0 +1,34 @@ +// +// $Id$ +// + +#ifndef HELLO_H +#define HELLO_H +#include /**/ "ace/pre.h" + +#include "TestS.h" + +/// Implement the Test::Hello interface +class Hello + : public virtual POA_Test::Hello +{ +public: + /// Constructor + Hello (CORBA::ORB_ptr orb, + ACE_thread_t thr_id); + + // = The skeleton methods + virtual char * get_string (void); + + virtual void shutdown (void); + +private: + /// Use an ORB reference to conver strings to objects and shutdown + /// the application. + CORBA::ORB_var orb_; + + ACE_thread_t thr_id_; +}; + +#include /**/ "ace/post.h" +#endif /* HELLO_H */ diff --git a/TAO/tests/Collocated_Best/Collocated_Best_Direct/Server_Task.cpp b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Server_Task.cpp new file mode 100644 index 00000000000..98f37e052e3 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Server_Task.cpp @@ -0,0 +1,87 @@ +// +// $Id$ +// +#include "Server_Task.h" +#include "TestS.h" +#include "Hello.h" + +#include "ace/Manual_Event.h" + +Server_Task::Server_Task (const ACE_TCHAR *output, + CORBA::ORB_ptr sorb, + ACE_Manual_Event &me, + ACE_Thread_Manager *thr_mgr) + : ACE_Task_Base (thr_mgr) + , output_ (output) + , me_ (me) + , sorb_ (CORBA::ORB::_duplicate (sorb)) +{ +} + +int +Server_Task::svc (void) +{ + try + { + CORBA::Object_var poa_object = + this->sorb_->resolve_initial_references("RootPOA"); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in ()); + + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Panic: nil RootPOA\n"), + 1); + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (); + + Hello *hello_impl; + ACE_NEW_RETURN (hello_impl, + Hello (this->sorb_.in (), + ACE_Thread::self ()), + 1); + + PortableServer::ServantBase_var owner_transfer(hello_impl); + + PortableServer::ObjectId_var id = + root_poa->activate_object (hello_impl); + + CORBA::Object_var object = root_poa->id_to_reference (id.in ()); + + Test::Hello_var hello = + Test::Hello::_narrow (object.in ()); + + CORBA::String_var ior = + this->sorb_->object_to_string (hello.in ()); + + // Output the IOR to the <this->output_> + FILE *output_file= ACE_OS::fopen (this->output_, + "w"); + if (output_file == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot open output file for writing IOR: %s", + this->output_), + 1); + + ACE_OS::fprintf (output_file, "%s", ior.in ()); + ACE_OS::fclose (output_file); + + poa_manager->activate (); + + // Signal the main thread before we call orb->run (); + this->me_.signal (); + + this->sorb_->run (); + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + + return 0; +} diff --git a/TAO/tests/Collocated_Best/Collocated_Best_Direct/Server_Task.h b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Server_Task.h new file mode 100644 index 00000000000..e42043c0711 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Server_Task.h @@ -0,0 +1,48 @@ +// -*- C++ -*- +// +// $Id$ + +#ifndef COLLOCATED_SERVER_TASK_H +#define COLLOCATED_SERVER_TASK_H + +#include /**/ "ace/pre.h" + +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/ORB.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +class ACE_Manual_Event; +ACE_END_VERSIONED_NAMESPACE_DECL + +/// Implement a Task to run the server in a single thread +class Server_Task : public ACE_Task_Base +{ +public: + /// Constructor + Server_Task (const ACE_TCHAR *output, + CORBA::ORB_ptr sorb, + ACE_Manual_Event &me, + ACE_Thread_Manager *thr_mgr); + + /// Thread entry point + int svc (void); + +private: + /// Output file for IOR + const ACE_TCHAR *output_; + + /// Manual event to wake up the main thread to create a client + /// thread. + ACE_Manual_Event &me_; + + CORBA::ORB_var sorb_; +}; + +#include /**/ "ace/post.h" + +#endif /* COLLOCATED_SERVER_TASK_H */ diff --git a/TAO/tests/Collocated_Best/Collocated_Best_Direct/Test.idl b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Test.idl new file mode 100644 index 00000000000..3c0976e106d --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Test.idl @@ -0,0 +1,20 @@ +// +// $Id$ +// + +/// Put the interfaces in a module, to avoid global namespace pollution +module Test +{ + /// A very simple interface + interface Hello + { + /// Return a simple string + string get_string (); + + /// A method to shutdown the ORB + /** + * This method is used to simplify the test shutdown process + */ + oneway void shutdown (); + }; +}; diff --git a/TAO/tests/Collocated_Best/Collocated_Best_Direct/run_test.pl b/TAO/tests/Collocated_Best/Collocated_Best_Direct/run_test.pl new file mode 100755 index 00000000000..39650e4147e --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_Direct/run_test.pl @@ -0,0 +1,45 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +my $server = PerlACE::TestTarget::create_target(1) || die "Create target 1 failed\n"; + +$iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +$server->DeleteFile($iorbase); + +$status = 0; + +$SV = $server->CreateProcess ("Collocated_Best_Direct"); + +print STDERR "======== Running with ORBCollocationg = global, -ORBCollocationStrategy = direct)\n"; +$SV->Arguments ("-o $server_iorfile -k file://$server_iorfile -ORBCollocation global -ORBCollocationStrategy direct"); +$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); + +if ($sv != 0) { + print STDERR "ERROR in Collocated_Test\n"; + $status = 1; +} +$server->DeleteFile($iorbase); + +$server->DeleteFile($iorbase); + +print STDERR "======== Running with -ORBCollocation global -ORBCollocationStrategy best \n"; +$SV->Arguments ("-o $server_iorfile -k file://$server_iorfile -ORBCollocation global -ORBCollocationStrategy best"); +$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); + +if ($sv != 0) { + print STDERR "ERROR in Collocated_Test\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$server->GetStderrLog(); + +exit $status; diff --git a/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Client_Task.cpp b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Client_Task.cpp new file mode 100644 index 00000000000..4708f2680d8 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Client_Task.cpp @@ -0,0 +1,62 @@ +// +// $Id$ +// + +#include "Client_Task.h" +#include "TestC.h" + +Client_Task::Client_Task (const ACE_TCHAR *ior, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr) + : ACE_Task_Base (thr_mgr) + , input_ (ior) + , corb_ (CORBA::ORB::_duplicate (corb)) + +{ +} + +int +Client_Task::svc (void) +{ + int status = 0; + + try + { + CORBA::Object_var tmp = + this->corb_->string_to_object (input_); + + Test::Hello_var hello = + Test::Hello::_narrow(tmp.in ()); + + if (CORBA::is_nil (hello.in ())) + { + ACE_ERROR_RETURN ((LM_DEBUG, + "Nil Test::Hello reference <%s>\n", + input_), + 1); + } + + CORBA::String_var the_string = + hello->get_string (); + + if (ACE_OS::strcmp (the_string.in (), "Hello there!") != 0) + { + ACE_ERROR ((LM_ERROR, "(%P|%t) - Error, incorrect string returned <%C>\n", + the_string.in ())); + status = 1; + } + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n", + the_string.in ())); + + hello->shutdown (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + status = 1; + } + + return status; + +} diff --git a/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Client_Task.h b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Client_Task.h new file mode 100644 index 00000000000..8f6557cdec8 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Client_Task.h @@ -0,0 +1,37 @@ +// +// $Id$ +// + +#ifndef COLLOCATED_TEST_CLIENT_TASK_H +#define COLLOCATED_TEST_CLIENT_TASK_H +#include /**/ "ace/pre.h" +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/ORB.h" + + +/// Implement a Task to run the client as a thread +class Client_Task : public ACE_Task_Base +{ +public: + + /// Constructor + Client_Task (const ACE_TCHAR *input, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr); + + /// Thread entry point + int svc (void); + +private: + const ACE_TCHAR *input_; + + CORBA::ORB_var corb_; + +}; + +#include /**/ "ace/post.h" +#endif /* COLLOCATED_TEST_CLIENT_TASK_H */ diff --git a/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Collocated_Best_NoColl.mpc b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Collocated_Best_NoColl.mpc new file mode 100644 index 00000000000..9604c0aff49 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Collocated_Best_NoColl.mpc @@ -0,0 +1,8 @@ +// -*- MPC -*- +// $Id$ + +// Disable Thru_Pu and don't enable Direct +project(Collocated_Best_NoColl): taoserver { + exename = Collocated_Best_NoColl + idlflags += -Sp +} diff --git a/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Collocated_Test.cpp b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Collocated_Test.cpp new file mode 100644 index 00000000000..282295ad5e3 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Collocated_Test.cpp @@ -0,0 +1,106 @@ +//$Id$ +#include "Server_Task.h" +#include "Client_Task.h" +#include "ace/Get_Opt.h" +#include "ace/Argv_Type_Converter.h" +#include "ace/SString.h" +#include "ace/Manual_Event.h" + +const ACE_TCHAR *output = ACE_TEXT("test.ior"); +const ACE_TCHAR *input = ACE_TEXT("file://test.ior"); +// static int named_orbs = 0; +ACE_CString server_orb; +ACE_CString client_orb; +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:o:n")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + output = get_opts.opt_arg (); + break; + case 'k': + input = get_opts.opt_arg (); + break; + case 'n': + // named_orbs = 1; + server_orb.set ("server_orb"); + client_orb.set ("client_orb"); + break; + case '?': + default: + // This is a hack but that is okay! + return 0; + } + // Indicates successful parsing of the command line + return 0; +} + +int +ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +{ + if (parse_args (argc, + argv) == -1) + return -1; + + try + { + ACE_Argv_Type_Converter satc (argc, argv); + CORBA::ORB_var sorb = + CORBA::ORB_init (satc.get_argc (), + satc.get_TCHAR_argv (), + server_orb.c_str ()); + + ACE_Manual_Event me; + Server_Task server_task (output, + sorb.in (), + me, + ACE_Thread_Manager::instance ()); + + if (server_task.activate (THR_NEW_LWP | THR_JOINABLE, + 1, + 1) == -1) + { + ACE_ERROR ((LM_ERROR, "Error activating server task\n")); + } + + // Wait for the server thread to do some processing + me.wait (); + + ACE_Argv_Type_Converter catc (argc, argv); + CORBA::ORB_var corb = + CORBA::ORB_init (catc.get_argc (), + catc.get_TCHAR_argv (), + client_orb.c_str ()); + + Client_Task client_task (input, + corb.in (), + ACE_Thread_Manager::instance ()); + + if (client_task.activate (THR_NEW_LWP | THR_JOINABLE, + 1, + 1) == -1) + { + ACE_ERROR ((LM_ERROR, "Error activating client task\n")); + } + + // Wait for the client and server to finish + ACE_Thread_Manager::instance ()->wait (); + + // Now that all threads have completed we can destroy the ORB + sorb->destroy (); + if (server_orb != client_orb) + { + corb->destroy (); + } + } + catch (const CORBA::Exception&) + { + // Ignore exceptions.. + } + return 0; +} diff --git a/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Hello.cpp b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Hello.cpp new file mode 100644 index 00000000000..cfa1a886365 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Hello.cpp @@ -0,0 +1,76 @@ +// +// $Id$ +// +#include "Hello.h" +#include "tao/ORB_Core.h" +#include "tao/ORB_Table.h" +#include "tao/ORB_Core_Auto_Ptr.h" + + Hello::Hello (CORBA::ORB_ptr orb, + ACE_thread_t thrid) + : orb_ (CORBA::ORB::_duplicate (orb)) + , thr_id_ (thrid) +{ +} + +char * +Hello::get_string (void) +{ + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) Upcall in process ..\n")); + + // Use portable thread IDs + ACE_Thread_ID self_ID; + // Thread ID from Server + ACE_Thread_ID this_ID; + this_ID.id(this->thr_id_); + + // Servant Thread ID same as Thread ID server, so a remote call, + // in case of a collocation the servant runs in calling thread (Client) + if (self_ID == this_ID) + { + if (this->orb_->orb_core ()->optimize_collocation_objects () && + this->orb_->orb_core ()->use_global_collocation ()) + { + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) OK: A remote call has been made \n")); + } + else if (this->orb_->orb_core ()->optimize_collocation_objects () && + this->orb_->orb_core ()->use_global_collocation () == 0) + { + TAO::ORB_Table * const orb_table = + TAO::ORB_Table::instance (); + + TAO_ORB_Core_Auto_Ptr tmp (orb_table->find ("server_orb")); + if (tmp.get () == 0) + { + // We are running on a single ORB and this is an error. + ACE_ERROR ((LM_ERROR, + "(%P|%t) ERROR: A remote call has been made " + " with a single ORB " + " exiting ..\n")); + ACE_OS::abort (); + } + } + } + else + { + if (this->orb_->orb_core ()->optimize_collocation_objects () && + this->orb_->orb_core ()->use_global_collocation ()) + { + ACE_ERROR ((LM_ERROR, + "(%P|%t) ERROR: An unexpected collocated call has been made \n")); + } + } + return CORBA::string_dup ("Hello there!"); +} + +void +Hello::shutdown (void) +{ + // Give the client thread time to return from the collocated + // call to this method before shutting down the ORB. We sleep + // to avoid BAD_INV_ORDER exceptions on fast dual processor machines. + ACE_OS::sleep (1); + this->orb_->shutdown (0); +} diff --git a/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Hello.h b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Hello.h new file mode 100644 index 00000000000..1d5e27d075f --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Hello.h @@ -0,0 +1,34 @@ +// +// $Id$ +// + +#ifndef HELLO_H +#define HELLO_H +#include /**/ "ace/pre.h" + +#include "TestS.h" + +/// Implement the Test::Hello interface +class Hello + : public virtual POA_Test::Hello +{ +public: + /// Constructor + Hello (CORBA::ORB_ptr orb, + ACE_thread_t thr_id); + + // = The skeleton methods + virtual char * get_string (void); + + virtual void shutdown (void); + +private: + /// Use an ORB reference to conver strings to objects and shutdown + /// the application. + CORBA::ORB_var orb_; + + ACE_thread_t thr_id_; +}; + +#include /**/ "ace/post.h" +#endif /* HELLO_H */ diff --git a/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Server_Task.cpp b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Server_Task.cpp new file mode 100644 index 00000000000..98f37e052e3 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Server_Task.cpp @@ -0,0 +1,87 @@ +// +// $Id$ +// +#include "Server_Task.h" +#include "TestS.h" +#include "Hello.h" + +#include "ace/Manual_Event.h" + +Server_Task::Server_Task (const ACE_TCHAR *output, + CORBA::ORB_ptr sorb, + ACE_Manual_Event &me, + ACE_Thread_Manager *thr_mgr) + : ACE_Task_Base (thr_mgr) + , output_ (output) + , me_ (me) + , sorb_ (CORBA::ORB::_duplicate (sorb)) +{ +} + +int +Server_Task::svc (void) +{ + try + { + CORBA::Object_var poa_object = + this->sorb_->resolve_initial_references("RootPOA"); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in ()); + + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Panic: nil RootPOA\n"), + 1); + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (); + + Hello *hello_impl; + ACE_NEW_RETURN (hello_impl, + Hello (this->sorb_.in (), + ACE_Thread::self ()), + 1); + + PortableServer::ServantBase_var owner_transfer(hello_impl); + + PortableServer::ObjectId_var id = + root_poa->activate_object (hello_impl); + + CORBA::Object_var object = root_poa->id_to_reference (id.in ()); + + Test::Hello_var hello = + Test::Hello::_narrow (object.in ()); + + CORBA::String_var ior = + this->sorb_->object_to_string (hello.in ()); + + // Output the IOR to the <this->output_> + FILE *output_file= ACE_OS::fopen (this->output_, + "w"); + if (output_file == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot open output file for writing IOR: %s", + this->output_), + 1); + + ACE_OS::fprintf (output_file, "%s", ior.in ()); + ACE_OS::fclose (output_file); + + poa_manager->activate (); + + // Signal the main thread before we call orb->run (); + this->me_.signal (); + + this->sorb_->run (); + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + + return 0; +} diff --git a/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Server_Task.h b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Server_Task.h new file mode 100644 index 00000000000..e42043c0711 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Server_Task.h @@ -0,0 +1,48 @@ +// -*- C++ -*- +// +// $Id$ + +#ifndef COLLOCATED_SERVER_TASK_H +#define COLLOCATED_SERVER_TASK_H + +#include /**/ "ace/pre.h" + +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/ORB.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +class ACE_Manual_Event; +ACE_END_VERSIONED_NAMESPACE_DECL + +/// Implement a Task to run the server in a single thread +class Server_Task : public ACE_Task_Base +{ +public: + /// Constructor + Server_Task (const ACE_TCHAR *output, + CORBA::ORB_ptr sorb, + ACE_Manual_Event &me, + ACE_Thread_Manager *thr_mgr); + + /// Thread entry point + int svc (void); + +private: + /// Output file for IOR + const ACE_TCHAR *output_; + + /// Manual event to wake up the main thread to create a client + /// thread. + ACE_Manual_Event &me_; + + CORBA::ORB_var sorb_; +}; + +#include /**/ "ace/post.h" + +#endif /* COLLOCATED_SERVER_TASK_H */ diff --git a/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Test.idl b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Test.idl new file mode 100644 index 00000000000..3c0976e106d --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Test.idl @@ -0,0 +1,20 @@ +// +// $Id$ +// + +/// Put the interfaces in a module, to avoid global namespace pollution +module Test +{ + /// A very simple interface + interface Hello + { + /// Return a simple string + string get_string (); + + /// A method to shutdown the ORB + /** + * This method is used to simplify the test shutdown process + */ + oneway void shutdown (); + }; +}; diff --git a/TAO/tests/Collocated_Best/Collocated_Best_NoColl/run_test.pl b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/run_test.pl new file mode 100755 index 00000000000..f6009aa0dc8 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/run_test.pl @@ -0,0 +1,33 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +my $server = PerlACE::TestTarget::create_target(1) || die "Create target 1 failed\n"; + +$iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +$server->DeleteFile($iorbase); + +$status = 0; + +$SV = $server->CreateProcess ("Collocated_Best_NoColl"); + +print STDERR "======== Running with -ORBCollocation global -ORBCollocationStrategy best \n"; +$SV->Arguments ("-o $server_iorfile -k file://$server_iorfile -ORBCollocation global -ORBCollocationStrategy best"); +$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); + +if ($sv != 0) { + print STDERR "ERROR in Collocated_Test\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$server->GetStderrLog(); + +exit $status; diff --git a/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Client_Task.cpp b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Client_Task.cpp new file mode 100644 index 00000000000..bfbe61b4942 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Client_Task.cpp @@ -0,0 +1,63 @@ +// +// $Id$ +// + +#include "Client_Task.h" +#include "TestC.h" + +Client_Task::Client_Task (const ACE_TCHAR *ior, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr) + : ACE_Task_Base (thr_mgr) + , input_ (ior) + , corb_ (CORBA::ORB::_duplicate (corb)) + +{ +} + +int +Client_Task::svc (void) +{ + int status = 1; + try + { + CORBA::Object_var tmp = + this->corb_->string_to_object (input_); + + Test::Hello_var hello = + Test::Hello::_narrow(tmp.in ()); + + if (CORBA::is_nil (hello.in ())) + { + ACE_ERROR_RETURN ((LM_DEBUG, + "Nil Test::Hello reference <%s>\n", + input_), + 1); + } + + CORBA::String_var the_string = + hello->get_string (); + + if (ACE_OS::strcmp (the_string.in (), "Hello there!") != 0) + { + ACE_ERROR ((LM_ERROR, "(%P|%t) - Error, incorrect string returned <%C>\n", + the_string.in ())); + status = 1; + } + else + { + ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n", + the_string.in ())); + } + + hello->shutdown (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + status = 1; + } + + return status; + +} diff --git a/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Client_Task.h b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Client_Task.h new file mode 100644 index 00000000000..8f6557cdec8 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Client_Task.h @@ -0,0 +1,37 @@ +// +// $Id$ +// + +#ifndef COLLOCATED_TEST_CLIENT_TASK_H +#define COLLOCATED_TEST_CLIENT_TASK_H +#include /**/ "ace/pre.h" +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/ORB.h" + + +/// Implement a Task to run the client as a thread +class Client_Task : public ACE_Task_Base +{ +public: + + /// Constructor + Client_Task (const ACE_TCHAR *input, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr); + + /// Thread entry point + int svc (void); + +private: + const ACE_TCHAR *input_; + + CORBA::ORB_var corb_; + +}; + +#include /**/ "ace/post.h" +#endif /* COLLOCATED_TEST_CLIENT_TASK_H */ diff --git a/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Collocated_Best_ThruP.mpc b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Collocated_Best_ThruP.mpc new file mode 100644 index 00000000000..1d2e67eccdc --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Collocated_Best_ThruP.mpc @@ -0,0 +1,7 @@ +// -*- MPC -*- +// $Id$ + +// Thru_Poa default enabled, Direct default disabled +project(Collocated_Best_ThruP): taoserver { + exename = Collocated_Best_ThruP +} diff --git a/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Collocated_Test.cpp b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Collocated_Test.cpp new file mode 100644 index 00000000000..282295ad5e3 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Collocated_Test.cpp @@ -0,0 +1,106 @@ +//$Id$ +#include "Server_Task.h" +#include "Client_Task.h" +#include "ace/Get_Opt.h" +#include "ace/Argv_Type_Converter.h" +#include "ace/SString.h" +#include "ace/Manual_Event.h" + +const ACE_TCHAR *output = ACE_TEXT("test.ior"); +const ACE_TCHAR *input = ACE_TEXT("file://test.ior"); +// static int named_orbs = 0; +ACE_CString server_orb; +ACE_CString client_orb; +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:o:n")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + output = get_opts.opt_arg (); + break; + case 'k': + input = get_opts.opt_arg (); + break; + case 'n': + // named_orbs = 1; + server_orb.set ("server_orb"); + client_orb.set ("client_orb"); + break; + case '?': + default: + // This is a hack but that is okay! + return 0; + } + // Indicates successful parsing of the command line + return 0; +} + +int +ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +{ + if (parse_args (argc, + argv) == -1) + return -1; + + try + { + ACE_Argv_Type_Converter satc (argc, argv); + CORBA::ORB_var sorb = + CORBA::ORB_init (satc.get_argc (), + satc.get_TCHAR_argv (), + server_orb.c_str ()); + + ACE_Manual_Event me; + Server_Task server_task (output, + sorb.in (), + me, + ACE_Thread_Manager::instance ()); + + if (server_task.activate (THR_NEW_LWP | THR_JOINABLE, + 1, + 1) == -1) + { + ACE_ERROR ((LM_ERROR, "Error activating server task\n")); + } + + // Wait for the server thread to do some processing + me.wait (); + + ACE_Argv_Type_Converter catc (argc, argv); + CORBA::ORB_var corb = + CORBA::ORB_init (catc.get_argc (), + catc.get_TCHAR_argv (), + client_orb.c_str ()); + + Client_Task client_task (input, + corb.in (), + ACE_Thread_Manager::instance ()); + + if (client_task.activate (THR_NEW_LWP | THR_JOINABLE, + 1, + 1) == -1) + { + ACE_ERROR ((LM_ERROR, "Error activating client task\n")); + } + + // Wait for the client and server to finish + ACE_Thread_Manager::instance ()->wait (); + + // Now that all threads have completed we can destroy the ORB + sorb->destroy (); + if (server_orb != client_orb) + { + corb->destroy (); + } + } + catch (const CORBA::Exception&) + { + // Ignore exceptions.. + } + return 0; +} diff --git a/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Hello.cpp b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Hello.cpp new file mode 100644 index 00000000000..fe5d6fec8fa --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Hello.cpp @@ -0,0 +1,68 @@ +// +// $Id$ +// +#include "Hello.h" +#include "tao/ORB_Core.h" +#include "tao/ORB_Table.h" +#include "tao/ORB_Core_Auto_Ptr.h" +#include "./tao/Collocation_Strategy.h" + + Hello::Hello (CORBA::ORB_ptr orb, + ACE_thread_t thrid) + : orb_ (CORBA::ORB::_duplicate (orb)) + , thr_id_ (thrid) +{ +} + +char * +Hello::get_string (void) +{ + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) Upcall in process ..\n")); + + // Use portable thread IDs + ACE_Thread_ID self_ID; + ACE_Thread_ID this_ID; + this_ID.id(this->thr_id_); + + if (self_ID == this_ID) + { + if (this->orb_->orb_core ()->optimize_collocation_objects () && + this->orb_->orb_core ()->use_global_collocation ()) + { + ACE_ERROR ((LM_ERROR, + "(%P|%t) ERROR: A remote call has been made " + " exiting ..\n")); + ACE_OS::abort (); + } + else if (this->orb_->orb_core ()->optimize_collocation_objects () && + this->orb_->orb_core ()->use_global_collocation () == 0) + { + TAO::ORB_Table * const orb_table = + TAO::ORB_Table::instance (); + + TAO_ORB_Core_Auto_Ptr tmp (orb_table->find ("server_orb")); + if (tmp.get () == 0) + { + // We are running on a single ORB and this is an error. + ACE_ERROR ((LM_ERROR, + "(%P|%t) ERROR: A remote call has been made " + " with a single ORB " + " exiting ..\n")); + ACE_OS::abort (); + } + } + } + + return CORBA::string_dup ("Hello there!"); +} + +void +Hello::shutdown (void) +{ + // Give the client thread time to return from the collocated + // call to this method before shutting down the ORB. We sleep + // to avoid BAD_INV_ORDER exceptions on fast dual processor machines. + ACE_OS::sleep (1); + this->orb_->shutdown (0); +} diff --git a/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Hello.h b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Hello.h new file mode 100644 index 00000000000..1d5e27d075f --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Hello.h @@ -0,0 +1,34 @@ +// +// $Id$ +// + +#ifndef HELLO_H +#define HELLO_H +#include /**/ "ace/pre.h" + +#include "TestS.h" + +/// Implement the Test::Hello interface +class Hello + : public virtual POA_Test::Hello +{ +public: + /// Constructor + Hello (CORBA::ORB_ptr orb, + ACE_thread_t thr_id); + + // = The skeleton methods + virtual char * get_string (void); + + virtual void shutdown (void); + +private: + /// Use an ORB reference to conver strings to objects and shutdown + /// the application. + CORBA::ORB_var orb_; + + ACE_thread_t thr_id_; +}; + +#include /**/ "ace/post.h" +#endif /* HELLO_H */ diff --git a/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Server_Task.cpp b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Server_Task.cpp new file mode 100644 index 00000000000..98f37e052e3 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Server_Task.cpp @@ -0,0 +1,87 @@ +// +// $Id$ +// +#include "Server_Task.h" +#include "TestS.h" +#include "Hello.h" + +#include "ace/Manual_Event.h" + +Server_Task::Server_Task (const ACE_TCHAR *output, + CORBA::ORB_ptr sorb, + ACE_Manual_Event &me, + ACE_Thread_Manager *thr_mgr) + : ACE_Task_Base (thr_mgr) + , output_ (output) + , me_ (me) + , sorb_ (CORBA::ORB::_duplicate (sorb)) +{ +} + +int +Server_Task::svc (void) +{ + try + { + CORBA::Object_var poa_object = + this->sorb_->resolve_initial_references("RootPOA"); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in ()); + + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Panic: nil RootPOA\n"), + 1); + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (); + + Hello *hello_impl; + ACE_NEW_RETURN (hello_impl, + Hello (this->sorb_.in (), + ACE_Thread::self ()), + 1); + + PortableServer::ServantBase_var owner_transfer(hello_impl); + + PortableServer::ObjectId_var id = + root_poa->activate_object (hello_impl); + + CORBA::Object_var object = root_poa->id_to_reference (id.in ()); + + Test::Hello_var hello = + Test::Hello::_narrow (object.in ()); + + CORBA::String_var ior = + this->sorb_->object_to_string (hello.in ()); + + // Output the IOR to the <this->output_> + FILE *output_file= ACE_OS::fopen (this->output_, + "w"); + if (output_file == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot open output file for writing IOR: %s", + this->output_), + 1); + + ACE_OS::fprintf (output_file, "%s", ior.in ()); + ACE_OS::fclose (output_file); + + poa_manager->activate (); + + // Signal the main thread before we call orb->run (); + this->me_.signal (); + + this->sorb_->run (); + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + + return 0; +} diff --git a/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Server_Task.h b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Server_Task.h new file mode 100644 index 00000000000..e42043c0711 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Server_Task.h @@ -0,0 +1,48 @@ +// -*- C++ -*- +// +// $Id$ + +#ifndef COLLOCATED_SERVER_TASK_H +#define COLLOCATED_SERVER_TASK_H + +#include /**/ "ace/pre.h" + +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/ORB.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +class ACE_Manual_Event; +ACE_END_VERSIONED_NAMESPACE_DECL + +/// Implement a Task to run the server in a single thread +class Server_Task : public ACE_Task_Base +{ +public: + /// Constructor + Server_Task (const ACE_TCHAR *output, + CORBA::ORB_ptr sorb, + ACE_Manual_Event &me, + ACE_Thread_Manager *thr_mgr); + + /// Thread entry point + int svc (void); + +private: + /// Output file for IOR + const ACE_TCHAR *output_; + + /// Manual event to wake up the main thread to create a client + /// thread. + ACE_Manual_Event &me_; + + CORBA::ORB_var sorb_; +}; + +#include /**/ "ace/post.h" + +#endif /* COLLOCATED_SERVER_TASK_H */ diff --git a/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Test.idl b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Test.idl new file mode 100644 index 00000000000..3c0976e106d --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Test.idl @@ -0,0 +1,20 @@ +// +// $Id$ +// + +/// Put the interfaces in a module, to avoid global namespace pollution +module Test +{ + /// A very simple interface + interface Hello + { + /// Return a simple string + string get_string (); + + /// A method to shutdown the ORB + /** + * This method is used to simplify the test shutdown process + */ + oneway void shutdown (); + }; +}; diff --git a/TAO/tests/Collocated_Best/Collocated_Best_ThuP/run_test.pl b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/run_test.pl new file mode 100755 index 00000000000..99836c08852 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/run_test.pl @@ -0,0 +1,44 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +my $server = PerlACE::TestTarget::create_target(1) || die "Create target 1 failed\n"; + +$iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +$server->DeleteFile($iorbase); + +$status = 0; + +$SV = $server->CreateProcess ("Collocated_Best_ThruP"); + +$server->DeleteFile($iorbase); +print STDERR "======== Running with ORBCollocationg = global, (default ORBCollocationStrategy = thru_poa)\n"; +$SV->Arguments ("-o $server_iorfile -k file://$server_iorfile -ORBCollocation global"); +$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); + +if ($sv != 0) { + print STDERR "ERROR in Collocated_Test\n"; + $status = 1; +} +$server->DeleteFile($iorbase); + +print STDERR "======== Running with -ORBCollocation global -ORBCollocationStrategy best \n"; +$SV->Arguments ("-o $server_iorfile -k file://$server_iorfile -ORBCollocation global -ORBCollocationStrategy best"); +$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); + +if ($sv != 0) { + print STDERR "ERROR in Collocated_Test\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$server->GetStderrLog(); + +exit $status; diff --git a/TAO/tests/Collocated_Best/README b/TAO/tests/Collocated_Best/README new file mode 100644 index 00000000000..6abd103bbe4 --- /dev/null +++ b/TAO/tests/Collocated_Best/README @@ -0,0 +1,22 @@ +// $Id$ +CollocationStrategy TAO_COLLOCATION_BEST: + +This tests performs a series of checks on CollocationStrategy 'best' (TAO_COLLOCATION_BEST) support in TAO. + +With CollocationStrategy 'best' the best possible collocation strategy is tried to perform. + If TAO_COLLOCATION_DIRECT is possible, this has to be used, else if TAO_COLLOCATION_THRU_POA + is possible this has to be used, else use remote stub. + +The test Collocated_Best_Direct uses IDLflags -Sp, to disable Thru_poa collocation + and -Gd, to enable Direct collocation. +Starting the test with -ORBCollocationStrategy 'best' , + the test should use TAO_COLLOCATION_DIRECT collocation. + +The test Collocated_Best_ThruP uses default IDLflags,so Thru_poa collocation is enabled +and Direct collocation is default not enabled. +Starting the test with -ORBCollocationStrategy 'best', the test should use +TAO_COLLOCATION_THRU_POA collocation. + +The test Collocated_Best_ThruP uses IDLflags -Sp, to disable Thru_poa collocation +and Direct collocation is default not enabled. +Starting the test with -ORBCollocationStrategy 'best', the test should use no collocation, but remote stubs.
\ No newline at end of file diff --git a/TAO/tests/Collocated_DerivedIF/Client_Task.cpp b/TAO/tests/Collocated_DerivedIF/Client_Task.cpp new file mode 100644 index 00000000000..0ea9453a73d --- /dev/null +++ b/TAO/tests/Collocated_DerivedIF/Client_Task.cpp @@ -0,0 +1,69 @@ +// +// $Id$ +// + +#include "Client_Task.h" +#include "TestC.h" + +Client_Task::Client_Task (const ACE_TCHAR *ior, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr) + : ACE_Task_Base (thr_mgr) + , input_ (ior) + , corb_ (CORBA::ORB::_duplicate (corb)) + +{ +} + +int +Client_Task::svc (void) +{ + int status = 0; + + try + { + CORBA::Object_var tmp = + this->corb_->string_to_object (input_); + + Test::HelloAgain_var hello_again = + Test::HelloAgain::_narrow(tmp.in ()); + + if (CORBA::is_nil (hello_again.in())) + { + ACE_ERROR_RETURN ((LM_DEBUG, + "Nil Test::HelloAgain reference <%s>\n", + input_), + 1); + } + + CORBA::String_var the_string = hello_again->get_string (); + if (ACE_OS::strcmp (the_string.in (), "Hello there!") != 0) + { + ACE_ERROR ((LM_ERROR, "(%P|%t) - Error, incorrect string returned <%C>\n", + the_string.in ())); + status = 1; + } + ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string from hello_again returned <%C>\n", + the_string.in ())); + the_string = hello_again->get_string_again (); + + if (ACE_OS::strcmp (the_string.in (), "Bye!") != 0) + { + ACE_ERROR ((LM_ERROR, "(%P|%t) - Error, incorrect string returned <%C>\n", + the_string.in ())); + status = 1; + } + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string from hello_again returned <%C>\n", + the_string.in ())); + hello_again->shutdown (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + status = 1; + } + + return status; + +} diff --git a/TAO/tests/Collocated_DerivedIF/Client_Task.h b/TAO/tests/Collocated_DerivedIF/Client_Task.h new file mode 100644 index 00000000000..8f6557cdec8 --- /dev/null +++ b/TAO/tests/Collocated_DerivedIF/Client_Task.h @@ -0,0 +1,37 @@ +// +// $Id$ +// + +#ifndef COLLOCATED_TEST_CLIENT_TASK_H +#define COLLOCATED_TEST_CLIENT_TASK_H +#include /**/ "ace/pre.h" +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/ORB.h" + + +/// Implement a Task to run the client as a thread +class Client_Task : public ACE_Task_Base +{ +public: + + /// Constructor + Client_Task (const ACE_TCHAR *input, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr); + + /// Thread entry point + int svc (void); + +private: + const ACE_TCHAR *input_; + + CORBA::ORB_var corb_; + +}; + +#include /**/ "ace/post.h" +#endif /* COLLOCATED_TEST_CLIENT_TASK_H */ diff --git a/TAO/tests/Collocated_DerivedIF/Collocated_DerivedIF.mpc b/TAO/tests/Collocated_DerivedIF/Collocated_DerivedIF.mpc new file mode 100644 index 00000000000..7fab7ae785c --- /dev/null +++ b/TAO/tests/Collocated_DerivedIF/Collocated_DerivedIF.mpc @@ -0,0 +1,8 @@ +// -*- MPC -*- +// $Id$ + +// Thru_Pu is disabled, enable direct +project(Collocated_DIF): taoserver { + exename = Collocated_DerivedIF + idlflags += -Sp -Gd +} diff --git a/TAO/tests/Collocated_DerivedIF/Collocated_Test.cpp b/TAO/tests/Collocated_DerivedIF/Collocated_Test.cpp new file mode 100644 index 00000000000..282295ad5e3 --- /dev/null +++ b/TAO/tests/Collocated_DerivedIF/Collocated_Test.cpp @@ -0,0 +1,106 @@ +//$Id$ +#include "Server_Task.h" +#include "Client_Task.h" +#include "ace/Get_Opt.h" +#include "ace/Argv_Type_Converter.h" +#include "ace/SString.h" +#include "ace/Manual_Event.h" + +const ACE_TCHAR *output = ACE_TEXT("test.ior"); +const ACE_TCHAR *input = ACE_TEXT("file://test.ior"); +// static int named_orbs = 0; +ACE_CString server_orb; +ACE_CString client_orb; +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:o:n")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + output = get_opts.opt_arg (); + break; + case 'k': + input = get_opts.opt_arg (); + break; + case 'n': + // named_orbs = 1; + server_orb.set ("server_orb"); + client_orb.set ("client_orb"); + break; + case '?': + default: + // This is a hack but that is okay! + return 0; + } + // Indicates successful parsing of the command line + return 0; +} + +int +ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +{ + if (parse_args (argc, + argv) == -1) + return -1; + + try + { + ACE_Argv_Type_Converter satc (argc, argv); + CORBA::ORB_var sorb = + CORBA::ORB_init (satc.get_argc (), + satc.get_TCHAR_argv (), + server_orb.c_str ()); + + ACE_Manual_Event me; + Server_Task server_task (output, + sorb.in (), + me, + ACE_Thread_Manager::instance ()); + + if (server_task.activate (THR_NEW_LWP | THR_JOINABLE, + 1, + 1) == -1) + { + ACE_ERROR ((LM_ERROR, "Error activating server task\n")); + } + + // Wait for the server thread to do some processing + me.wait (); + + ACE_Argv_Type_Converter catc (argc, argv); + CORBA::ORB_var corb = + CORBA::ORB_init (catc.get_argc (), + catc.get_TCHAR_argv (), + client_orb.c_str ()); + + Client_Task client_task (input, + corb.in (), + ACE_Thread_Manager::instance ()); + + if (client_task.activate (THR_NEW_LWP | THR_JOINABLE, + 1, + 1) == -1) + { + ACE_ERROR ((LM_ERROR, "Error activating client task\n")); + } + + // Wait for the client and server to finish + ACE_Thread_Manager::instance ()->wait (); + + // Now that all threads have completed we can destroy the ORB + sorb->destroy (); + if (server_orb != client_orb) + { + corb->destroy (); + } + } + catch (const CORBA::Exception&) + { + // Ignore exceptions.. + } + return 0; +} diff --git a/TAO/tests/Collocated_DerivedIF/Hello.cpp b/TAO/tests/Collocated_DerivedIF/Hello.cpp new file mode 100644 index 00000000000..1db920f42f5 --- /dev/null +++ b/TAO/tests/Collocated_DerivedIF/Hello.cpp @@ -0,0 +1,84 @@ +// +// $Id$ +// +#include "Hello.h" +#include "tao/ORB_Core.h" +#include "tao/ORB_Table.h" +#include "tao/ORB_Core_Auto_Ptr.h" + + +HelloAgain::HelloAgain (CORBA::ORB_ptr orb, + ACE_thread_t thrid) + : orb_ (CORBA::ORB::_duplicate (orb)) + , thr_id_ (thrid) +{ +} +char * +HelloAgain::get_string_again (void) +{ + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) Upcall get_string_again in process ..\n")); + + /// Use portable thread IDs + ACE_Thread_ID self_ID; + // Thread ID from Server + ACE_Thread_ID this_ID; + this_ID.id(this->thr_id_); + + // Servant Thread ID same as Thread ID server, so a remote call, + // in case of a collocation the servant runs in calling thread (Client) + if (self_ID == this_ID) + { + ACE_ERROR ((LM_ERROR,"(%P|%t) ERROR: A remote call has been made \n")); + } + else + { + if (this->orb_->orb_core ()->optimize_collocation_objects () && + this->orb_->orb_core ()->use_global_collocation ()) + { + ACE_DEBUG ((LM_DEBUG, + "(%P|%t)OK: An expected collocated call has been made \n")); + } + } + return CORBA::string_dup ("Bye!"); +} + +char * +HelloAgain::get_string (void) +{ + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) HelloAgain::get_string Upcall get_string in process ..\n")); + + // Use portable thread IDs + ACE_Thread_ID self_ID; + // Thread ID from Server + ACE_Thread_ID this_ID; + this_ID.id(this->thr_id_); + + // Servant Thread ID same as Thread ID server, so a remote call, + // in case of a collocation the servant runs in calling thread (Client) + if (self_ID == this_ID) + { + ACE_ERROR ((LM_ERROR,"(%P|%t) ERROR: A remote call has been made \n")); + } + else + { + if (this->orb_->orb_core ()->optimize_collocation_objects () && + this->orb_->orb_core ()->use_global_collocation ()) + { + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) OK: An expected collocated call has been made \n")); + } + } + return CORBA::string_dup ("Hello there!"); +} +void +HelloAgain::shutdown (void) +{ + // Give the client thread time to return from the collocated + // call to this method before shutting down the ORB. We sleep + // to avoid BAD_INV_ORDER exceptions on fast dual processor machines. + ACE_OS::sleep (1); + this->orb_->shutdown (0); +} + diff --git a/TAO/tests/Collocated_DerivedIF/Hello.h b/TAO/tests/Collocated_DerivedIF/Hello.h new file mode 100644 index 00000000000..a028b36b192 --- /dev/null +++ b/TAO/tests/Collocated_DerivedIF/Hello.h @@ -0,0 +1,36 @@ +// +// $Id$ +// + +#ifndef HELLO_H +#define HELLO_H +#include /**/ "ace/pre.h" + +#include "TestS.h" + + /// Implement the Test::HelloAgain interface + class HelloAgain + : //public virtual Test::Hello, + public virtual POA_Test::HelloAgain + { + public: + /// Constructor + HelloAgain(CORBA::ORB_ptr orb, + ACE_thread_t thr_id); + + // = The skeleton methods + virtual char * get_string_again (void); + virtual char * get_string (void); + virtual void shutdown (void); + + + private: + /// Use an ORB reference to conver strings to objects and shutdown + /// the application. + CORBA::ORB_var orb_; + ACE_thread_t thr_id_; + }; + + +#include /**/ "ace/post.h" +#endif /* HELLO_H */ diff --git a/TAO/tests/Collocated_DerivedIF/README b/TAO/tests/Collocated_DerivedIF/README new file mode 100644 index 00000000000..a500775be3d --- /dev/null +++ b/TAO/tests/Collocated_DerivedIF/README @@ -0,0 +1,6 @@ +// $Id$ +CollocationStrategy direct and interface inheritance. + +The base needs to be generated also with direct collocation enabled, +otherwise no direct collocation. + diff --git a/TAO/tests/Collocated_DerivedIF/Server_Task.cpp b/TAO/tests/Collocated_DerivedIF/Server_Task.cpp new file mode 100644 index 00000000000..4d1e74d4a9a --- /dev/null +++ b/TAO/tests/Collocated_DerivedIF/Server_Task.cpp @@ -0,0 +1,91 @@ +// +// $Id$ +// +#include "Server_Task.h" +#include "TestS.h" +#include "Hello.h" + +#include "ace/Manual_Event.h" + +Server_Task::Server_Task (const ACE_TCHAR *output, + CORBA::ORB_ptr sorb, + ACE_Manual_Event &me, + ACE_Thread_Manager *thr_mgr) + : ACE_Task_Base (thr_mgr) + , output_ (output) + , me_ (me) + , sorb_ (CORBA::ORB::_duplicate (sorb)) +{ +} + +int +Server_Task::svc (void) +{ + try + { + CORBA::Object_var poa_object = + this->sorb_->resolve_initial_references("RootPOA"); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in ()); + + + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Panic: nil RootPOA\n"), + 1); + + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (); + + HelloAgain *hello_impl; + ACE_NEW_RETURN (hello_impl, + HelloAgain (this->sorb_.in (), + ACE_Thread::self ()), + 1); + PortableServer::ServantBase_var owner1_transfer(hello_impl); + + PortableServer::ObjectId_var id = + root_poa->activate_object (hello_impl); + + CORBA::Object_var object = root_poa->id_to_reference (id.in ()); + + Test::HelloAgain_var hello = + Test::HelloAgain::_narrow (object.in ()); + + CORBA::String_var ior = + this->sorb_->object_to_string (hello.in ()); + + + // Output the IOR to the <this->output_> + FILE *output_file= ACE_OS::fopen (this->output_, + "w"); + if (output_file == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot open output file for writing IOR: %s", + this->output_), + 1); + + ACE_OS::fprintf (output_file, "%s", ior.in ()); + // ACE_OS::fprintf (output_file, "%s", ior1.in ()); + + ACE_OS::fclose (output_file); + + poa_manager->activate (); + + // Signal the main thread before we call orb->run (); + this->me_.signal (); + + this->sorb_->run (); + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + + return 0; +} diff --git a/TAO/tests/Collocated_DerivedIF/Server_Task.h b/TAO/tests/Collocated_DerivedIF/Server_Task.h new file mode 100644 index 00000000000..e42043c0711 --- /dev/null +++ b/TAO/tests/Collocated_DerivedIF/Server_Task.h @@ -0,0 +1,48 @@ +// -*- C++ -*- +// +// $Id$ + +#ifndef COLLOCATED_SERVER_TASK_H +#define COLLOCATED_SERVER_TASK_H + +#include /**/ "ace/pre.h" + +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/ORB.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +class ACE_Manual_Event; +ACE_END_VERSIONED_NAMESPACE_DECL + +/// Implement a Task to run the server in a single thread +class Server_Task : public ACE_Task_Base +{ +public: + /// Constructor + Server_Task (const ACE_TCHAR *output, + CORBA::ORB_ptr sorb, + ACE_Manual_Event &me, + ACE_Thread_Manager *thr_mgr); + + /// Thread entry point + int svc (void); + +private: + /// Output file for IOR + const ACE_TCHAR *output_; + + /// Manual event to wake up the main thread to create a client + /// thread. + ACE_Manual_Event &me_; + + CORBA::ORB_var sorb_; +}; + +#include /**/ "ace/post.h" + +#endif /* COLLOCATED_SERVER_TASK_H */ diff --git a/TAO/tests/Collocated_DerivedIF/Test.idl b/TAO/tests/Collocated_DerivedIF/Test.idl new file mode 100644 index 00000000000..001c6e274a2 --- /dev/null +++ b/TAO/tests/Collocated_DerivedIF/Test.idl @@ -0,0 +1,23 @@ +// +// $Id$ +// + +/// Put the interfaces in a module, to avoid global namespace pollution +module Test +{ + /// A very simple interface + interface Hello + { + /// Return a simple string + string get_string (); + + /// A method to shutdown the ORB + oneway void shutdown (); + }; + + // A derived interface + interface HelloAgain : Hello + { + string get_string_again (); + }; +}; diff --git a/TAO/tests/Collocated_DerivedIF/run_test.pl b/TAO/tests/Collocated_DerivedIF/run_test.pl new file mode 100755 index 00000000000..5ac1c3c5df3 --- /dev/null +++ b/TAO/tests/Collocated_DerivedIF/run_test.pl @@ -0,0 +1,33 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +my $server = PerlACE::TestTarget::create_target(1) || die "Create target 1 failed\n"; + +$iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +$server->DeleteFile($iorbase); + +$status = 0; + +$SV = $server->CreateProcess ("Collocated_DerivedIF"); + +print STDERR "======== Running with -ORBCollocation global -ORBCollocationStrategy direct \n"; +$SV->Arguments ("-o $server_iorfile -k file://$server_iorfile -ORBCollocation global -ORBCollocationStrategy direct"); +$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); + +if ($sv != 0) { + print STDERR "ERROR in Collocated_Test\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$server->GetStderrLog(); + +exit $status; diff --git a/TAO/tests/Collocated_NoColl/Client_Task.cpp b/TAO/tests/Collocated_NoColl/Client_Task.cpp new file mode 100644 index 00000000000..4708f2680d8 --- /dev/null +++ b/TAO/tests/Collocated_NoColl/Client_Task.cpp @@ -0,0 +1,62 @@ +// +// $Id$ +// + +#include "Client_Task.h" +#include "TestC.h" + +Client_Task::Client_Task (const ACE_TCHAR *ior, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr) + : ACE_Task_Base (thr_mgr) + , input_ (ior) + , corb_ (CORBA::ORB::_duplicate (corb)) + +{ +} + +int +Client_Task::svc (void) +{ + int status = 0; + + try + { + CORBA::Object_var tmp = + this->corb_->string_to_object (input_); + + Test::Hello_var hello = + Test::Hello::_narrow(tmp.in ()); + + if (CORBA::is_nil (hello.in ())) + { + ACE_ERROR_RETURN ((LM_DEBUG, + "Nil Test::Hello reference <%s>\n", + input_), + 1); + } + + CORBA::String_var the_string = + hello->get_string (); + + if (ACE_OS::strcmp (the_string.in (), "Hello there!") != 0) + { + ACE_ERROR ((LM_ERROR, "(%P|%t) - Error, incorrect string returned <%C>\n", + the_string.in ())); + status = 1; + } + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n", + the_string.in ())); + + hello->shutdown (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + status = 1; + } + + return status; + +} diff --git a/TAO/tests/Collocated_NoColl/Client_Task.h b/TAO/tests/Collocated_NoColl/Client_Task.h new file mode 100644 index 00000000000..8f6557cdec8 --- /dev/null +++ b/TAO/tests/Collocated_NoColl/Client_Task.h @@ -0,0 +1,37 @@ +// +// $Id$ +// + +#ifndef COLLOCATED_TEST_CLIENT_TASK_H +#define COLLOCATED_TEST_CLIENT_TASK_H +#include /**/ "ace/pre.h" +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/ORB.h" + + +/// Implement a Task to run the client as a thread +class Client_Task : public ACE_Task_Base +{ +public: + + /// Constructor + Client_Task (const ACE_TCHAR *input, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr); + + /// Thread entry point + int svc (void); + +private: + const ACE_TCHAR *input_; + + CORBA::ORB_var corb_; + +}; + +#include /**/ "ace/post.h" +#endif /* COLLOCATED_TEST_CLIENT_TASK_H */ diff --git a/TAO/tests/Collocated_NoColl/Collocated_NoColl.mpc b/TAO/tests/Collocated_NoColl/Collocated_NoColl.mpc new file mode 100644 index 00000000000..8edb4eea37c --- /dev/null +++ b/TAO/tests/Collocated_NoColl/Collocated_NoColl.mpc @@ -0,0 +1,8 @@ +// -*- MPC -*- +// $Id$ + +// Thru_Pu is default enabled +project(Collocated_NoColl): taoserver { + exename = Collocated_NoColl + +} diff --git a/TAO/tests/Collocated_NoColl/Collocated_Test.cpp b/TAO/tests/Collocated_NoColl/Collocated_Test.cpp new file mode 100644 index 00000000000..282295ad5e3 --- /dev/null +++ b/TAO/tests/Collocated_NoColl/Collocated_Test.cpp @@ -0,0 +1,106 @@ +//$Id$ +#include "Server_Task.h" +#include "Client_Task.h" +#include "ace/Get_Opt.h" +#include "ace/Argv_Type_Converter.h" +#include "ace/SString.h" +#include "ace/Manual_Event.h" + +const ACE_TCHAR *output = ACE_TEXT("test.ior"); +const ACE_TCHAR *input = ACE_TEXT("file://test.ior"); +// static int named_orbs = 0; +ACE_CString server_orb; +ACE_CString client_orb; +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:o:n")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + output = get_opts.opt_arg (); + break; + case 'k': + input = get_opts.opt_arg (); + break; + case 'n': + // named_orbs = 1; + server_orb.set ("server_orb"); + client_orb.set ("client_orb"); + break; + case '?': + default: + // This is a hack but that is okay! + return 0; + } + // Indicates successful parsing of the command line + return 0; +} + +int +ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +{ + if (parse_args (argc, + argv) == -1) + return -1; + + try + { + ACE_Argv_Type_Converter satc (argc, argv); + CORBA::ORB_var sorb = + CORBA::ORB_init (satc.get_argc (), + satc.get_TCHAR_argv (), + server_orb.c_str ()); + + ACE_Manual_Event me; + Server_Task server_task (output, + sorb.in (), + me, + ACE_Thread_Manager::instance ()); + + if (server_task.activate (THR_NEW_LWP | THR_JOINABLE, + 1, + 1) == -1) + { + ACE_ERROR ((LM_ERROR, "Error activating server task\n")); + } + + // Wait for the server thread to do some processing + me.wait (); + + ACE_Argv_Type_Converter catc (argc, argv); + CORBA::ORB_var corb = + CORBA::ORB_init (catc.get_argc (), + catc.get_TCHAR_argv (), + client_orb.c_str ()); + + Client_Task client_task (input, + corb.in (), + ACE_Thread_Manager::instance ()); + + if (client_task.activate (THR_NEW_LWP | THR_JOINABLE, + 1, + 1) == -1) + { + ACE_ERROR ((LM_ERROR, "Error activating client task\n")); + } + + // Wait for the client and server to finish + ACE_Thread_Manager::instance ()->wait (); + + // Now that all threads have completed we can destroy the ORB + sorb->destroy (); + if (server_orb != client_orb) + { + corb->destroy (); + } + } + catch (const CORBA::Exception&) + { + // Ignore exceptions.. + } + return 0; +} diff --git a/TAO/tests/Collocated_NoColl/Hello.cpp b/TAO/tests/Collocated_NoColl/Hello.cpp new file mode 100644 index 00000000000..cfa1a886365 --- /dev/null +++ b/TAO/tests/Collocated_NoColl/Hello.cpp @@ -0,0 +1,76 @@ +// +// $Id$ +// +#include "Hello.h" +#include "tao/ORB_Core.h" +#include "tao/ORB_Table.h" +#include "tao/ORB_Core_Auto_Ptr.h" + + Hello::Hello (CORBA::ORB_ptr orb, + ACE_thread_t thrid) + : orb_ (CORBA::ORB::_duplicate (orb)) + , thr_id_ (thrid) +{ +} + +char * +Hello::get_string (void) +{ + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) Upcall in process ..\n")); + + // Use portable thread IDs + ACE_Thread_ID self_ID; + // Thread ID from Server + ACE_Thread_ID this_ID; + this_ID.id(this->thr_id_); + + // Servant Thread ID same as Thread ID server, so a remote call, + // in case of a collocation the servant runs in calling thread (Client) + if (self_ID == this_ID) + { + if (this->orb_->orb_core ()->optimize_collocation_objects () && + this->orb_->orb_core ()->use_global_collocation ()) + { + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) OK: A remote call has been made \n")); + } + else if (this->orb_->orb_core ()->optimize_collocation_objects () && + this->orb_->orb_core ()->use_global_collocation () == 0) + { + TAO::ORB_Table * const orb_table = + TAO::ORB_Table::instance (); + + TAO_ORB_Core_Auto_Ptr tmp (orb_table->find ("server_orb")); + if (tmp.get () == 0) + { + // We are running on a single ORB and this is an error. + ACE_ERROR ((LM_ERROR, + "(%P|%t) ERROR: A remote call has been made " + " with a single ORB " + " exiting ..\n")); + ACE_OS::abort (); + } + } + } + else + { + if (this->orb_->orb_core ()->optimize_collocation_objects () && + this->orb_->orb_core ()->use_global_collocation ()) + { + ACE_ERROR ((LM_ERROR, + "(%P|%t) ERROR: An unexpected collocated call has been made \n")); + } + } + return CORBA::string_dup ("Hello there!"); +} + +void +Hello::shutdown (void) +{ + // Give the client thread time to return from the collocated + // call to this method before shutting down the ORB. We sleep + // to avoid BAD_INV_ORDER exceptions on fast dual processor machines. + ACE_OS::sleep (1); + this->orb_->shutdown (0); +} diff --git a/TAO/tests/Collocated_NoColl/Hello.h b/TAO/tests/Collocated_NoColl/Hello.h new file mode 100644 index 00000000000..1d5e27d075f --- /dev/null +++ b/TAO/tests/Collocated_NoColl/Hello.h @@ -0,0 +1,34 @@ +// +// $Id$ +// + +#ifndef HELLO_H +#define HELLO_H +#include /**/ "ace/pre.h" + +#include "TestS.h" + +/// Implement the Test::Hello interface +class Hello + : public virtual POA_Test::Hello +{ +public: + /// Constructor + Hello (CORBA::ORB_ptr orb, + ACE_thread_t thr_id); + + // = The skeleton methods + virtual char * get_string (void); + + virtual void shutdown (void); + +private: + /// Use an ORB reference to conver strings to objects and shutdown + /// the application. + CORBA::ORB_var orb_; + + ACE_thread_t thr_id_; +}; + +#include /**/ "ace/post.h" +#endif /* HELLO_H */ diff --git a/TAO/tests/Collocated_NoColl/Server_Task.cpp b/TAO/tests/Collocated_NoColl/Server_Task.cpp new file mode 100644 index 00000000000..98f37e052e3 --- /dev/null +++ b/TAO/tests/Collocated_NoColl/Server_Task.cpp @@ -0,0 +1,87 @@ +// +// $Id$ +// +#include "Server_Task.h" +#include "TestS.h" +#include "Hello.h" + +#include "ace/Manual_Event.h" + +Server_Task::Server_Task (const ACE_TCHAR *output, + CORBA::ORB_ptr sorb, + ACE_Manual_Event &me, + ACE_Thread_Manager *thr_mgr) + : ACE_Task_Base (thr_mgr) + , output_ (output) + , me_ (me) + , sorb_ (CORBA::ORB::_duplicate (sorb)) +{ +} + +int +Server_Task::svc (void) +{ + try + { + CORBA::Object_var poa_object = + this->sorb_->resolve_initial_references("RootPOA"); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in ()); + + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Panic: nil RootPOA\n"), + 1); + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (); + + Hello *hello_impl; + ACE_NEW_RETURN (hello_impl, + Hello (this->sorb_.in (), + ACE_Thread::self ()), + 1); + + PortableServer::ServantBase_var owner_transfer(hello_impl); + + PortableServer::ObjectId_var id = + root_poa->activate_object (hello_impl); + + CORBA::Object_var object = root_poa->id_to_reference (id.in ()); + + Test::Hello_var hello = + Test::Hello::_narrow (object.in ()); + + CORBA::String_var ior = + this->sorb_->object_to_string (hello.in ()); + + // Output the IOR to the <this->output_> + FILE *output_file= ACE_OS::fopen (this->output_, + "w"); + if (output_file == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot open output file for writing IOR: %s", + this->output_), + 1); + + ACE_OS::fprintf (output_file, "%s", ior.in ()); + ACE_OS::fclose (output_file); + + poa_manager->activate (); + + // Signal the main thread before we call orb->run (); + this->me_.signal (); + + this->sorb_->run (); + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + + return 0; +} diff --git a/TAO/tests/Collocated_NoColl/Server_Task.h b/TAO/tests/Collocated_NoColl/Server_Task.h new file mode 100644 index 00000000000..e42043c0711 --- /dev/null +++ b/TAO/tests/Collocated_NoColl/Server_Task.h @@ -0,0 +1,48 @@ +// -*- C++ -*- +// +// $Id$ + +#ifndef COLLOCATED_SERVER_TASK_H +#define COLLOCATED_SERVER_TASK_H + +#include /**/ "ace/pre.h" + +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/ORB.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +class ACE_Manual_Event; +ACE_END_VERSIONED_NAMESPACE_DECL + +/// Implement a Task to run the server in a single thread +class Server_Task : public ACE_Task_Base +{ +public: + /// Constructor + Server_Task (const ACE_TCHAR *output, + CORBA::ORB_ptr sorb, + ACE_Manual_Event &me, + ACE_Thread_Manager *thr_mgr); + + /// Thread entry point + int svc (void); + +private: + /// Output file for IOR + const ACE_TCHAR *output_; + + /// Manual event to wake up the main thread to create a client + /// thread. + ACE_Manual_Event &me_; + + CORBA::ORB_var sorb_; +}; + +#include /**/ "ace/post.h" + +#endif /* COLLOCATED_SERVER_TASK_H */ diff --git a/TAO/tests/Collocated_NoColl/Test.idl b/TAO/tests/Collocated_NoColl/Test.idl new file mode 100644 index 00000000000..3c0976e106d --- /dev/null +++ b/TAO/tests/Collocated_NoColl/Test.idl @@ -0,0 +1,20 @@ +// +// $Id$ +// + +/// Put the interfaces in a module, to avoid global namespace pollution +module Test +{ + /// A very simple interface + interface Hello + { + /// Return a simple string + string get_string (); + + /// A method to shutdown the ORB + /** + * This method is used to simplify the test shutdown process + */ + oneway void shutdown (); + }; +}; diff --git a/TAO/tests/Collocated_NoColl/run_test.pl b/TAO/tests/Collocated_NoColl/run_test.pl new file mode 100755 index 00000000000..0b0ac76ed01 --- /dev/null +++ b/TAO/tests/Collocated_NoColl/run_test.pl @@ -0,0 +1,33 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +my $server = PerlACE::TestTarget::create_target(1) || die "Create target 1 failed\n"; + +$iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +$server->DeleteFile($iorbase); + +$status = 0; + +$SV = $server->CreateProcess ("Collocated_NoColl"); + +print STDERR "======== Running with -ORBCollocation no \n"; +$SV->Arguments ("-o $server_iorfile -k file://$server_iorfile -ORBCollocation no"); +$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); + +if ($sv != 0) { + print STDERR "ERROR in Collocated_Test\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$server->GetStderrLog(); + +exit $status; diff --git a/TAO/tests/Collocated_ThruP_Sp/Client_Task.cpp b/TAO/tests/Collocated_ThruP_Sp/Client_Task.cpp new file mode 100644 index 00000000000..7569e6ddb7b --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp/Client_Task.cpp @@ -0,0 +1,65 @@ +// +// $Id$ +// + +#include "Client_Task.h" +#include "TestC.h" + +Client_Task::Client_Task (const ACE_TCHAR *ior, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr) + : ACE_Task_Base (thr_mgr) + , input_ (ior) + , corb_ (CORBA::ORB::_duplicate (corb)) + +{ +} + +int +Client_Task::svc (void) +{ + CORBA::Boolean exception = false; + try + { + CORBA::Object_var tmp = + this->corb_->string_to_object (input_); + + Test::Hello_var hello = + Test::Hello::_narrow(tmp.in ()); + + if (CORBA::is_nil (hello.in ())) + { + ACE_ERROR_RETURN ((LM_DEBUG, + "Nil Test::Hello reference <%s>\n", + input_), + 1); + } + try + { + CORBA::String_var the_string = + hello->get_string (); + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n", + the_string.in ())); + + hello->shutdown (); + } + catch (CORBA::INTERNAL) + { + exception = true; + ACE_DEBUG ((LM_DEBUG, "OK: Client_Task Expected exception received\n")); + corb_->destroy (); + return 0; + } + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + if (!exception) + { + ACE_ERROR ((LM_ERROR, "(ERROR: Client_Task::svc Expected exception not received\n")); + } + return 0; +} diff --git a/TAO/tests/Collocated_ThruP_Sp/Client_Task.h b/TAO/tests/Collocated_ThruP_Sp/Client_Task.h new file mode 100644 index 00000000000..8f6557cdec8 --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp/Client_Task.h @@ -0,0 +1,37 @@ +// +// $Id$ +// + +#ifndef COLLOCATED_TEST_CLIENT_TASK_H +#define COLLOCATED_TEST_CLIENT_TASK_H +#include /**/ "ace/pre.h" +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/ORB.h" + + +/// Implement a Task to run the client as a thread +class Client_Task : public ACE_Task_Base +{ +public: + + /// Constructor + Client_Task (const ACE_TCHAR *input, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr); + + /// Thread entry point + int svc (void); + +private: + const ACE_TCHAR *input_; + + CORBA::ORB_var corb_; + +}; + +#include /**/ "ace/post.h" +#endif /* COLLOCATED_TEST_CLIENT_TASK_H */ diff --git a/TAO/tests/Collocated_ThruP_Sp/Collocated_Test.cpp b/TAO/tests/Collocated_ThruP_Sp/Collocated_Test.cpp new file mode 100644 index 00000000000..eade083328b --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp/Collocated_Test.cpp @@ -0,0 +1,105 @@ +//$Id$ +#include "Server_Task.h" +#include "Client_Task.h" +#include "ace/Get_Opt.h" +#include "ace/Argv_Type_Converter.h" +#include "ace/SString.h" +#include "ace/Manual_Event.h" + +const ACE_TCHAR *output = ACE_TEXT("test.ior"); +const ACE_TCHAR *input = ACE_TEXT("file://test.ior"); +// static int named_orbs = 0; +ACE_CString server_orb; +ACE_CString client_orb; +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:o:n")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + output = get_opts.opt_arg (); + break; + case 'k': + input = get_opts.opt_arg (); + break; + case 'n': + // named_orbs = 1; + server_orb.set ("server_orb"); + client_orb.set ("client_orb"); + break; + case '?': + default: + // This is a hack but that is okay! + return 0; + } + // Indicates successful parsing of the command line + return 0; +} + +int +ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +{ + if (parse_args (argc, argv) == -1) + return -1; + + try + { + ACE_Argv_Type_Converter satc (argc, argv); + CORBA::ORB_var sorb = + CORBA::ORB_init (satc.get_argc (), + satc.get_TCHAR_argv (), + server_orb.c_str ()); + + ACE_Manual_Event me; + Server_Task server_task (output, + sorb.in (), + me, + ACE_Thread_Manager::instance ()); + + if (server_task.activate (THR_NEW_LWP | THR_JOINABLE, + 1, + 1) == -1) + { + ACE_ERROR ((LM_ERROR, "Error activating server task\n")); + } + + // Wait for the server thread to do some processing + me.wait (); + + ACE_Argv_Type_Converter catc (argc, argv); + CORBA::ORB_var corb = + CORBA::ORB_init (catc.get_argc (), + catc.get_TCHAR_argv (), + client_orb.c_str ()); + + Client_Task client_task (input, + corb.in (), + ACE_Thread_Manager::instance ()); + + if (client_task.activate (THR_NEW_LWP | THR_JOINABLE, + 1, + 1) == -1) + { + ACE_ERROR ((LM_ERROR, "Error activating client task\n")); + } + + // Wait for the client and server to finish + ACE_Thread_Manager::instance ()->wait (); + + // Now that all threads have completed we can destroy the ORB + sorb->destroy (); + if (server_orb != client_orb) + { + corb->destroy (); + } + } + catch (const CORBA::Exception&) + { + // Ignore exceptions.. + } + return 0; +} diff --git a/TAO/tests/Collocated_ThruP_Sp/Collocated_ThruP_Sp.mpc b/TAO/tests/Collocated_ThruP_Sp/Collocated_ThruP_Sp.mpc new file mode 100644 index 00000000000..86c10ace774 --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp/Collocated_ThruP_Sp.mpc @@ -0,0 +1,9 @@ +// -*- MPC -*- +// $Id$ + +// Disable THRU_POA Collocation + +project(Collocated_ThruP_Sp): taoserver { + exename = Collocated_ThruP_Sp + idlflags += -Sp +} diff --git a/TAO/tests/Collocated_ThruP_Sp/Hello.cpp b/TAO/tests/Collocated_ThruP_Sp/Hello.cpp new file mode 100644 index 00000000000..e77d95e07bc --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp/Hello.cpp @@ -0,0 +1,32 @@ +// +// $Id$ +// +#include "Hello.h" +#include "tao/ORB_Core.h" +#include "tao/ORB_Table.h" +#include "tao/ORB_Core_Auto_Ptr.h" + + Hello::Hello (CORBA::ORB_ptr orb, + ACE_thread_t thrid) + : orb_ (CORBA::ORB::_duplicate (orb)) + , thr_id_ (thrid) +{ +} + +char * +Hello::get_string (void) +{ + ACE_ERROR ((LM_DEBUG, + "(%P|%t) ERROR: Upcall in process ..\n")); + return CORBA::string_dup ("Hello there!"); +} + +void +Hello::shutdown (void) +{ + // Give the client thread time to return from the collocated + // call to this method before shutting down the ORB. We sleep + // to avoid BAD_INV_ORDER exceptions on fast dual processor machines. + ACE_OS::sleep (1); + this->orb_->shutdown (0); +} diff --git a/TAO/tests/Collocated_ThruP_Sp/Hello.h b/TAO/tests/Collocated_ThruP_Sp/Hello.h new file mode 100644 index 00000000000..1d5e27d075f --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp/Hello.h @@ -0,0 +1,34 @@ +// +// $Id$ +// + +#ifndef HELLO_H +#define HELLO_H +#include /**/ "ace/pre.h" + +#include "TestS.h" + +/// Implement the Test::Hello interface +class Hello + : public virtual POA_Test::Hello +{ +public: + /// Constructor + Hello (CORBA::ORB_ptr orb, + ACE_thread_t thr_id); + + // = The skeleton methods + virtual char * get_string (void); + + virtual void shutdown (void); + +private: + /// Use an ORB reference to conver strings to objects and shutdown + /// the application. + CORBA::ORB_var orb_; + + ACE_thread_t thr_id_; +}; + +#include /**/ "ace/post.h" +#endif /* HELLO_H */ diff --git a/TAO/tests/Collocated_ThruP_Sp/README b/TAO/tests/Collocated_ThruP_Sp/README new file mode 100644 index 00000000000..e475dc45576 --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp/README @@ -0,0 +1,6 @@ +// $Id$ + +This test is build with idlflag -Sp, to disable Thru_poa collocation. +Running this test with -ORBCollocationStrategy Thru_poa should result in an Exception. + + diff --git a/TAO/tests/Collocated_ThruP_Sp/Server_Task.cpp b/TAO/tests/Collocated_ThruP_Sp/Server_Task.cpp new file mode 100644 index 00000000000..2cca42206ee --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp/Server_Task.cpp @@ -0,0 +1,87 @@ +// +// $Id$ +// +#include "Server_Task.h" +#include "TestS.h" +#include "Hello.h" + +#include "ace/Manual_Event.h" + +Server_Task::Server_Task (const ACE_TCHAR *output, + CORBA::ORB_ptr sorb, + ACE_Manual_Event &me, + ACE_Thread_Manager *thr_mgr) + : ACE_Task_Base (thr_mgr) + , output_ (output) + , me_ (me) + , sorb_ (CORBA::ORB::_duplicate (sorb)) +{ +} + +int +Server_Task::svc (void) +{ + try + { + CORBA::Object_var poa_object = + this->sorb_->resolve_initial_references("RootPOA"); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in ()); + + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Panic: nil RootPOA\n"), + 1); + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (); + + Hello *hello_impl = 0; + ACE_NEW_RETURN (hello_impl, + Hello (this->sorb_.in (), + ACE_Thread::self ()), + 1); + + PortableServer::ServantBase_var owner_transfer(hello_impl); + + PortableServer::ObjectId_var id = + root_poa->activate_object (hello_impl); + + CORBA::Object_var object = root_poa->id_to_reference (id.in ()); + + Test::Hello_var hello = + Test::Hello::_narrow (object.in ()); + + CORBA::String_var ior = + this->sorb_->object_to_string (hello.in ()); + + // Output the IOR to the <this->output_> + FILE *output_file= ACE_OS::fopen (this->output_, + "w"); + if (output_file == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot open output file for writing IOR: %s", + this->output_), + 1); + + ACE_OS::fprintf (output_file, "%s", ior.in ()); + ACE_OS::fclose (output_file); + + poa_manager->activate (); + + // Signal the main thread before we call orb->run (); + this->me_.signal (); + + this->sorb_->run (); + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + + return 0; +} diff --git a/TAO/tests/Collocated_ThruP_Sp/Server_Task.h b/TAO/tests/Collocated_ThruP_Sp/Server_Task.h new file mode 100644 index 00000000000..e42043c0711 --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp/Server_Task.h @@ -0,0 +1,48 @@ +// -*- C++ -*- +// +// $Id$ + +#ifndef COLLOCATED_SERVER_TASK_H +#define COLLOCATED_SERVER_TASK_H + +#include /**/ "ace/pre.h" + +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/ORB.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +class ACE_Manual_Event; +ACE_END_VERSIONED_NAMESPACE_DECL + +/// Implement a Task to run the server in a single thread +class Server_Task : public ACE_Task_Base +{ +public: + /// Constructor + Server_Task (const ACE_TCHAR *output, + CORBA::ORB_ptr sorb, + ACE_Manual_Event &me, + ACE_Thread_Manager *thr_mgr); + + /// Thread entry point + int svc (void); + +private: + /// Output file for IOR + const ACE_TCHAR *output_; + + /// Manual event to wake up the main thread to create a client + /// thread. + ACE_Manual_Event &me_; + + CORBA::ORB_var sorb_; +}; + +#include /**/ "ace/post.h" + +#endif /* COLLOCATED_SERVER_TASK_H */ diff --git a/TAO/tests/Collocated_ThruP_Sp/Test.idl b/TAO/tests/Collocated_ThruP_Sp/Test.idl new file mode 100644 index 00000000000..3c0976e106d --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp/Test.idl @@ -0,0 +1,20 @@ +// +// $Id$ +// + +/// Put the interfaces in a module, to avoid global namespace pollution +module Test +{ + /// A very simple interface + interface Hello + { + /// Return a simple string + string get_string (); + + /// A method to shutdown the ORB + /** + * This method is used to simplify the test shutdown process + */ + oneway void shutdown (); + }; +}; diff --git a/TAO/tests/Collocated_ThruP_Sp/run_test.pl b/TAO/tests/Collocated_ThruP_Sp/run_test.pl new file mode 100755 index 00000000000..a0812ae4f8e --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp/run_test.pl @@ -0,0 +1,60 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +my $server = PerlACE::TestTarget::create_target(1) || die "Create target 1 failed\n"; + +$iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +$server->DeleteFile($iorbase); + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +$SV = $server->CreateProcess ("Collocated_ThruP_Sp"); + +print STDERR "======== Running in Default Mode \n"; +$SV->Arguments ("-ORBdebuglevel $debug_level -o $server_iorfile -k file://$server_iorfile"); +$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); + +if ($sv != 0) { + print STDERR "ERROR in Collocated_Test\n"; + $status = 1; +} +$server->DeleteFile($iorbase); + +print STDERR "======== Running with global ORBCollocationStrategy\n"; +$SV->Arguments ("-ORBdebuglevel $debug_level -o $server_iorfile -k file://$server_iorfile -ORBCollocation global"); +$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); + +if ($sv != 0) { + print STDERR "ERROR in Collocated_Test\n"; + $status = 1; +} +$server->DeleteFile($iorbase); + +print STDERR "======== Running with global ORBCollocationStrategy thru_poa\n"; +$SV->Arguments ("-ORBdebuglevel $debug_level -o $server_iorfile -k file://$server_iorfile -ORBCollocation global -ORBCollocationStrategy thru_poa"); +$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); + +if ($sv != 0) { + print STDERR "ERROR in Collocated_Test\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$server->GetStderrLog(); + +exit $status; diff --git a/TAO/tests/Collocated_ThruP_Sp_Gd/Client_Task.cpp b/TAO/tests/Collocated_ThruP_Sp_Gd/Client_Task.cpp new file mode 100644 index 00000000000..7569e6ddb7b --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp_Gd/Client_Task.cpp @@ -0,0 +1,65 @@ +// +// $Id$ +// + +#include "Client_Task.h" +#include "TestC.h" + +Client_Task::Client_Task (const ACE_TCHAR *ior, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr) + : ACE_Task_Base (thr_mgr) + , input_ (ior) + , corb_ (CORBA::ORB::_duplicate (corb)) + +{ +} + +int +Client_Task::svc (void) +{ + CORBA::Boolean exception = false; + try + { + CORBA::Object_var tmp = + this->corb_->string_to_object (input_); + + Test::Hello_var hello = + Test::Hello::_narrow(tmp.in ()); + + if (CORBA::is_nil (hello.in ())) + { + ACE_ERROR_RETURN ((LM_DEBUG, + "Nil Test::Hello reference <%s>\n", + input_), + 1); + } + try + { + CORBA::String_var the_string = + hello->get_string (); + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n", + the_string.in ())); + + hello->shutdown (); + } + catch (CORBA::INTERNAL) + { + exception = true; + ACE_DEBUG ((LM_DEBUG, "OK: Client_Task Expected exception received\n")); + corb_->destroy (); + return 0; + } + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + if (!exception) + { + ACE_ERROR ((LM_ERROR, "(ERROR: Client_Task::svc Expected exception not received\n")); + } + return 0; +} diff --git a/TAO/tests/Collocated_ThruP_Sp_Gd/Client_Task.h b/TAO/tests/Collocated_ThruP_Sp_Gd/Client_Task.h new file mode 100644 index 00000000000..8f6557cdec8 --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp_Gd/Client_Task.h @@ -0,0 +1,37 @@ +// +// $Id$ +// + +#ifndef COLLOCATED_TEST_CLIENT_TASK_H +#define COLLOCATED_TEST_CLIENT_TASK_H +#include /**/ "ace/pre.h" +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/ORB.h" + + +/// Implement a Task to run the client as a thread +class Client_Task : public ACE_Task_Base +{ +public: + + /// Constructor + Client_Task (const ACE_TCHAR *input, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr); + + /// Thread entry point + int svc (void); + +private: + const ACE_TCHAR *input_; + + CORBA::ORB_var corb_; + +}; + +#include /**/ "ace/post.h" +#endif /* COLLOCATED_TEST_CLIENT_TASK_H */ diff --git a/TAO/tests/Collocated_ThruP_Sp_Gd/Collocated_Test.cpp b/TAO/tests/Collocated_ThruP_Sp_Gd/Collocated_Test.cpp new file mode 100644 index 00000000000..282295ad5e3 --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp_Gd/Collocated_Test.cpp @@ -0,0 +1,106 @@ +//$Id$ +#include "Server_Task.h" +#include "Client_Task.h" +#include "ace/Get_Opt.h" +#include "ace/Argv_Type_Converter.h" +#include "ace/SString.h" +#include "ace/Manual_Event.h" + +const ACE_TCHAR *output = ACE_TEXT("test.ior"); +const ACE_TCHAR *input = ACE_TEXT("file://test.ior"); +// static int named_orbs = 0; +ACE_CString server_orb; +ACE_CString client_orb; +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:o:n")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + output = get_opts.opt_arg (); + break; + case 'k': + input = get_opts.opt_arg (); + break; + case 'n': + // named_orbs = 1; + server_orb.set ("server_orb"); + client_orb.set ("client_orb"); + break; + case '?': + default: + // This is a hack but that is okay! + return 0; + } + // Indicates successful parsing of the command line + return 0; +} + +int +ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +{ + if (parse_args (argc, + argv) == -1) + return -1; + + try + { + ACE_Argv_Type_Converter satc (argc, argv); + CORBA::ORB_var sorb = + CORBA::ORB_init (satc.get_argc (), + satc.get_TCHAR_argv (), + server_orb.c_str ()); + + ACE_Manual_Event me; + Server_Task server_task (output, + sorb.in (), + me, + ACE_Thread_Manager::instance ()); + + if (server_task.activate (THR_NEW_LWP | THR_JOINABLE, + 1, + 1) == -1) + { + ACE_ERROR ((LM_ERROR, "Error activating server task\n")); + } + + // Wait for the server thread to do some processing + me.wait (); + + ACE_Argv_Type_Converter catc (argc, argv); + CORBA::ORB_var corb = + CORBA::ORB_init (catc.get_argc (), + catc.get_TCHAR_argv (), + client_orb.c_str ()); + + Client_Task client_task (input, + corb.in (), + ACE_Thread_Manager::instance ()); + + if (client_task.activate (THR_NEW_LWP | THR_JOINABLE, + 1, + 1) == -1) + { + ACE_ERROR ((LM_ERROR, "Error activating client task\n")); + } + + // Wait for the client and server to finish + ACE_Thread_Manager::instance ()->wait (); + + // Now that all threads have completed we can destroy the ORB + sorb->destroy (); + if (server_orb != client_orb) + { + corb->destroy (); + } + } + catch (const CORBA::Exception&) + { + // Ignore exceptions.. + } + return 0; +} diff --git a/TAO/tests/Collocated_ThruP_Sp_Gd/Collocated_ThruP_Sp_Gd.mpc b/TAO/tests/Collocated_ThruP_Sp_Gd/Collocated_ThruP_Sp_Gd.mpc new file mode 100644 index 00000000000..a5b5b6fdf8e --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp_Gd/Collocated_ThruP_Sp_Gd.mpc @@ -0,0 +1,9 @@ +// -*- MPC -*- +// $Id$ + +// Disable THRU_POA Collocation, enable Direct Collocation + +project(Coll_ThruP_Sp-Gd): taoserver { + exename = Coll_ThruP_Sp_Gd + idlflags += -Sp -Gd +} diff --git a/TAO/tests/Collocated_ThruP_Sp_Gd/Hello.cpp b/TAO/tests/Collocated_ThruP_Sp_Gd/Hello.cpp new file mode 100644 index 00000000000..e77d95e07bc --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp_Gd/Hello.cpp @@ -0,0 +1,32 @@ +// +// $Id$ +// +#include "Hello.h" +#include "tao/ORB_Core.h" +#include "tao/ORB_Table.h" +#include "tao/ORB_Core_Auto_Ptr.h" + + Hello::Hello (CORBA::ORB_ptr orb, + ACE_thread_t thrid) + : orb_ (CORBA::ORB::_duplicate (orb)) + , thr_id_ (thrid) +{ +} + +char * +Hello::get_string (void) +{ + ACE_ERROR ((LM_DEBUG, + "(%P|%t) ERROR: Upcall in process ..\n")); + return CORBA::string_dup ("Hello there!"); +} + +void +Hello::shutdown (void) +{ + // Give the client thread time to return from the collocated + // call to this method before shutting down the ORB. We sleep + // to avoid BAD_INV_ORDER exceptions on fast dual processor machines. + ACE_OS::sleep (1); + this->orb_->shutdown (0); +} diff --git a/TAO/tests/Collocated_ThruP_Sp_Gd/Hello.h b/TAO/tests/Collocated_ThruP_Sp_Gd/Hello.h new file mode 100644 index 00000000000..1d5e27d075f --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp_Gd/Hello.h @@ -0,0 +1,34 @@ +// +// $Id$ +// + +#ifndef HELLO_H +#define HELLO_H +#include /**/ "ace/pre.h" + +#include "TestS.h" + +/// Implement the Test::Hello interface +class Hello + : public virtual POA_Test::Hello +{ +public: + /// Constructor + Hello (CORBA::ORB_ptr orb, + ACE_thread_t thr_id); + + // = The skeleton methods + virtual char * get_string (void); + + virtual void shutdown (void); + +private: + /// Use an ORB reference to conver strings to objects and shutdown + /// the application. + CORBA::ORB_var orb_; + + ACE_thread_t thr_id_; +}; + +#include /**/ "ace/post.h" +#endif /* HELLO_H */ diff --git a/TAO/tests/Collocated_ThruP_Sp_Gd/README b/TAO/tests/Collocated_ThruP_Sp_Gd/README new file mode 100644 index 00000000000..c385fcfe91b --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp_Gd/README @@ -0,0 +1,7 @@ +// $Id$ + +This test is build with idlflag -Sp and Gd, to disable Thru_poa collocation, +but enable direct collocation. +Running this test with -ORBCollocationStrategy Thru_poa should result in an Exception. + + diff --git a/TAO/tests/Collocated_ThruP_Sp_Gd/Server_Task.cpp b/TAO/tests/Collocated_ThruP_Sp_Gd/Server_Task.cpp new file mode 100644 index 00000000000..98f37e052e3 --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp_Gd/Server_Task.cpp @@ -0,0 +1,87 @@ +// +// $Id$ +// +#include "Server_Task.h" +#include "TestS.h" +#include "Hello.h" + +#include "ace/Manual_Event.h" + +Server_Task::Server_Task (const ACE_TCHAR *output, + CORBA::ORB_ptr sorb, + ACE_Manual_Event &me, + ACE_Thread_Manager *thr_mgr) + : ACE_Task_Base (thr_mgr) + , output_ (output) + , me_ (me) + , sorb_ (CORBA::ORB::_duplicate (sorb)) +{ +} + +int +Server_Task::svc (void) +{ + try + { + CORBA::Object_var poa_object = + this->sorb_->resolve_initial_references("RootPOA"); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in ()); + + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Panic: nil RootPOA\n"), + 1); + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (); + + Hello *hello_impl; + ACE_NEW_RETURN (hello_impl, + Hello (this->sorb_.in (), + ACE_Thread::self ()), + 1); + + PortableServer::ServantBase_var owner_transfer(hello_impl); + + PortableServer::ObjectId_var id = + root_poa->activate_object (hello_impl); + + CORBA::Object_var object = root_poa->id_to_reference (id.in ()); + + Test::Hello_var hello = + Test::Hello::_narrow (object.in ()); + + CORBA::String_var ior = + this->sorb_->object_to_string (hello.in ()); + + // Output the IOR to the <this->output_> + FILE *output_file= ACE_OS::fopen (this->output_, + "w"); + if (output_file == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot open output file for writing IOR: %s", + this->output_), + 1); + + ACE_OS::fprintf (output_file, "%s", ior.in ()); + ACE_OS::fclose (output_file); + + poa_manager->activate (); + + // Signal the main thread before we call orb->run (); + this->me_.signal (); + + this->sorb_->run (); + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + + return 0; +} diff --git a/TAO/tests/Collocated_ThruP_Sp_Gd/Server_Task.h b/TAO/tests/Collocated_ThruP_Sp_Gd/Server_Task.h new file mode 100644 index 00000000000..e42043c0711 --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp_Gd/Server_Task.h @@ -0,0 +1,48 @@ +// -*- C++ -*- +// +// $Id$ + +#ifndef COLLOCATED_SERVER_TASK_H +#define COLLOCATED_SERVER_TASK_H + +#include /**/ "ace/pre.h" + +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/ORB.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +class ACE_Manual_Event; +ACE_END_VERSIONED_NAMESPACE_DECL + +/// Implement a Task to run the server in a single thread +class Server_Task : public ACE_Task_Base +{ +public: + /// Constructor + Server_Task (const ACE_TCHAR *output, + CORBA::ORB_ptr sorb, + ACE_Manual_Event &me, + ACE_Thread_Manager *thr_mgr); + + /// Thread entry point + int svc (void); + +private: + /// Output file for IOR + const ACE_TCHAR *output_; + + /// Manual event to wake up the main thread to create a client + /// thread. + ACE_Manual_Event &me_; + + CORBA::ORB_var sorb_; +}; + +#include /**/ "ace/post.h" + +#endif /* COLLOCATED_SERVER_TASK_H */ diff --git a/TAO/tests/Collocated_ThruP_Sp_Gd/Test.idl b/TAO/tests/Collocated_ThruP_Sp_Gd/Test.idl new file mode 100644 index 00000000000..3c0976e106d --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp_Gd/Test.idl @@ -0,0 +1,20 @@ +// +// $Id$ +// + +/// Put the interfaces in a module, to avoid global namespace pollution +module Test +{ + /// A very simple interface + interface Hello + { + /// Return a simple string + string get_string (); + + /// A method to shutdown the ORB + /** + * This method is used to simplify the test shutdown process + */ + oneway void shutdown (); + }; +}; diff --git a/TAO/tests/Collocated_ThruP_Sp_Gd/run_test.pl b/TAO/tests/Collocated_ThruP_Sp_Gd/run_test.pl new file mode 100755 index 00000000000..504290188c1 --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp_Gd/run_test.pl @@ -0,0 +1,60 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +my $server = PerlACE::TestTarget::create_target(1) || die "Create target 1 failed\n"; + +$iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +$server->DeleteFile($iorbase); + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +$SV = $server->CreateProcess ("Coll_ThruP_Sp_Gd"); + +print STDERR "======== Running in Default Mode \n"; +$SV->Arguments ("-ORBdebuglevel $debug_level -o $server_iorfile -k file://$server_iorfile"); +$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); + +if ($sv != 0) { + print STDERR "ERROR in Collocated_Test\n"; + $status = 1; +} +$server->DeleteFile($iorbase); + +print STDERR "======== Running with global ORBCollocationStrategy\n"; +$SV->Arguments ("-ORBdebuglevel $debug_level -o $server_iorfile -k file://$server_iorfile -ORBCollocation global"); +$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); + +if ($sv != 0) { + print STDERR "ERROR in Collocated_Test\n"; + $status = 1; +} +$server->DeleteFile($iorbase); + +print STDERR "======== Running with global ORBCollocationStrategy thru_poa\n"; +$SV->Arguments ("-ORBdebuglevel $debug_level -o $server_iorfile -k file://$server_iorfile -ORBCollocation global -ORBCollocationStrategy thru_poa"); +$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); + +if ($sv != 0) { + print STDERR "ERROR in Collocated_Test\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$server->GetStderrLog(); + +exit $status; diff --git a/TAO/tests/Collocation_Opportunities/run_test.pl b/TAO/tests/Collocation_Opportunities/run_test.pl index 689d8586e95..91e99715397 100755 --- a/TAO/tests/Collocation_Opportunities/run_test.pl +++ b/TAO/tests/Collocation_Opportunities/run_test.pl @@ -8,9 +8,17 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' use lib "$ENV{ACE_ROOT}/bin"; use PerlACE::TestTarget; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; -$SV = $server->CreateProcess ("Collocation_Opportunities"); +$SV = $server->CreateProcess ("Collocation_Opportunities", "-ORBdebuglevel $debug_level"); $test = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); diff --git a/TAO/tests/ForwardUponObjectNotExist/client.cpp b/TAO/tests/ForwardUponObjectNotExist/client.cpp index 783d187e115..70666db32e1 100755 --- a/TAO/tests/ForwardUponObjectNotExist/client.cpp +++ b/TAO/tests/ForwardUponObjectNotExist/client.cpp @@ -178,7 +178,6 @@ Worker::run_test (void) return; } - CORBA::Boolean r = server->test_is_a ("IDL:Foo:1.0"); diff --git a/TAO/tests/ForwardUponObjectNotExist/server.cpp b/TAO/tests/ForwardUponObjectNotExist/server.cpp index eb95494366b..133182484f3 100755 --- a/TAO/tests/ForwardUponObjectNotExist/server.cpp +++ b/TAO/tests/ForwardUponObjectNotExist/server.cpp @@ -97,6 +97,10 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) orb->run (); ACE_DEBUG ((LM_DEBUG, "(%P|%t)server: event loop finished\n")); + + root_poa->destroy (1, 1); + + orb->destroy (); } catch (const CORBA::Exception& ex) { diff --git a/TAO/tests/Hello/run_test.pl b/TAO/tests/Hello/run_test.pl index 719974e5c50..f45d4729c86 100755 --- a/TAO/tests/Hello/run_test.pl +++ b/TAO/tests/Hello/run_test.pl @@ -10,11 +10,14 @@ use PerlACE::TestTarget; $status = 0; $debug_level = '0'; - +$cdebug_level = '0'; foreach $i (@ARGV) { if ($i eq '-debug') { $debug_level = '10'; } + if ($i eq '-cdebug') { + $cdebug_level = '10'; + } } my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; @@ -27,7 +30,7 @@ $server->DeleteFile($iorbase); $client->DeleteFile($iorbase); $SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile"); -$CL = $client->CreateProcess ("client", "-k file://$client_iorfile"); +$CL = $client->CreateProcess ("client", "-ORBdebuglevel $cdebug_level -k file://$client_iorfile"); $server_status = $SV->Spawn (); if ($server_status != 0) { diff --git a/TAO/tests/Oneway_Buffering/Oneway_Buffering.mpc b/TAO/tests/Oneway_Buffering/Oneway_Buffering.mpc index 92fe4fbd3bc..f04ccc6e29a 100644 --- a/TAO/tests/Oneway_Buffering/Oneway_Buffering.mpc +++ b/TAO/tests/Oneway_Buffering/Oneway_Buffering.mpc @@ -24,7 +24,6 @@ project(*Server): messaging, taoserver { project(*Client): messaging, taoclient { exename = client - requires += corba_messaging after += *idl Source_Files { diff --git a/TAO/tests/POA/Etherealization/run_test.pl b/TAO/tests/POA/Etherealization/run_test.pl index b62766a5e7e..c55d9411bd9 100755 --- a/TAO/tests/POA/Etherealization/run_test.pl +++ b/TAO/tests/POA/Etherealization/run_test.pl @@ -8,9 +8,17 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' use lib "$ENV{ACE_ROOT}/bin"; use PerlACE::TestTarget; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; -$SV = $server->CreateProcess ("Etherealization"); +$SV = $server->CreateProcess ("Etherealization", "-ORBdebuglevel $debug_level"); $test = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); diff --git a/TAO/tests/POA/Nested_Non_Servant_Upcalls/run_test.pl b/TAO/tests/POA/Nested_Non_Servant_Upcalls/run_test.pl index 8da0c1f582c..edac726c827 100755 --- a/TAO/tests/POA/Nested_Non_Servant_Upcalls/run_test.pl +++ b/TAO/tests/POA/Nested_Non_Servant_Upcalls/run_test.pl @@ -8,9 +8,17 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' use lib "$ENV{ACE_ROOT}/bin"; use PerlACE::TestTarget; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; -$SV = $server->CreateProcess ("Nested_Non_Servant_Upcalls"); +$SV = $server->CreateProcess ("Nested_Non_Servant_Upcalls", "-ORBdebuglevel $debug_level"); $test = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); diff --git a/TAO/tests/POA/On_Demand_Act_Direct_Coll/Client_Task.cpp b/TAO/tests/POA/On_Demand_Act_Direct_Coll/Client_Task.cpp new file mode 100644 index 00000000000..2bde4bbba67 --- /dev/null +++ b/TAO/tests/POA/On_Demand_Act_Direct_Coll/Client_Task.cpp @@ -0,0 +1,87 @@ +// +// $Id$ +// + +#include "Client_Task.h" +#include "testC.h" + +Client_Task::Client_Task (const ACE_TCHAR *ior, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr, + CORBA::Boolean exception) + : ACE_Task_Base (thr_mgr) + , input_ (ior) + , corb_ (CORBA::ORB::_duplicate (corb)) + , except_ (exception) +{ +} + +int +Client_Task::svc (void) +{ + int status = 0; + try + { + // Get an object reference from the argument string. + CORBA::Object_var tmp = + this->corb_->string_to_object (input_); + + // Try to narrow the object reference to a test reference. + test_var test = test::_narrow (tmp.in ()); + if (CORBA::is_nil (test.in ())) + { + ACE_ERROR_RETURN ((LM_DEBUG, + "Nil Test::Hello reference <%s>\n", + input_), + 1); + } + + CORBA::String_var ior = + this->corb_->object_to_string (test.in ()); + + ACE_DEBUG ((LM_DEBUG, + "\nConnecting to: %C\n\n", + ior.in ())); + try + { + CORBA::String_var the_string = test->get_string (); + if (ACE_OS::strcmp (the_string.in (), "Hello there!") != 0) + { + ACE_ERROR ((LM_ERROR, "(%P|%t) - Error, incorrect string returned <%C>\n", + the_string.in ())); + } + else + { + ACE_DEBUG ((LM_DEBUG, "(%P|%t) - OK , correct string returned <%C>\n", + the_string.in ())); + } + test->shutdown (); + } + catch (CORBA::INTERNAL) + { + if (this->except_) + { + ACE_DEBUG ((LM_DEBUG, + "OK: Client_Task Expected exception with" + "direct collocation received\n")); + status = 0; + } + else + { + ACE_ERROR ((LM_ERROR, + "ERROR: Client_Task Unxpected exception with" + "thru_poa collocation received\n")); + status = 1; + } + } + corb_->destroy (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + status = 1; + } + + return status; + +} diff --git a/TAO/tests/POA/On_Demand_Act_Direct_Coll/Client_Task.h b/TAO/tests/POA/On_Demand_Act_Direct_Coll/Client_Task.h new file mode 100644 index 00000000000..f1b20a22fbf --- /dev/null +++ b/TAO/tests/POA/On_Demand_Act_Direct_Coll/Client_Task.h @@ -0,0 +1,39 @@ +// +// $Id$ +// + +#ifndef COLLOCATED_TEST_CLIENT_TASK_H +#define COLLOCATED_TEST_CLIENT_TASK_H +#include /**/ "ace/pre.h" +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/ORB.h" + + +/// Implement a Task to run the client as a thread +class Client_Task : public ACE_Task_Base +{ +public: + + /// Constructor + Client_Task (const ACE_TCHAR *input, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr, + CORBA::Boolean exception); + + /// Thread entry point + int svc (void); + +private: + const ACE_TCHAR *input_; + + CORBA::ORB_var corb_; + CORBA::Boolean except_; + +}; + +#include /**/ "ace/post.h" +#endif /* COLLOCATED_TEST_CLIENT_TASK_H */ diff --git a/TAO/tests/POA/On_Demand_Act_Direct_Coll/Collocated_Test.cpp b/TAO/tests/POA/On_Demand_Act_Direct_Coll/Collocated_Test.cpp new file mode 100644 index 00000000000..53f3bf81805 --- /dev/null +++ b/TAO/tests/POA/On_Demand_Act_Direct_Coll/Collocated_Test.cpp @@ -0,0 +1,103 @@ +//$Id$ +#include "Server_Task.h" +#include "Client_Task.h" +#include "ace/Get_Opt.h" +#include "ace/Argv_Type_Converter.h" +#include "ace/SString.h" +#include "ace/Manual_Event.h" + +const ACE_TCHAR *output = ACE_TEXT("test.ior"); +const ACE_TCHAR *input = ACE_TEXT("file://test.ior"); +CORBA::Boolean exception = false; + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:o:td:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + output = get_opts.opt_arg (); + break; + case 'k': + input = get_opts.opt_arg (); + break; + case 't': + // no exception expected + exception = false; + break; + case 'd': + // exception expected + exception = true; + break; + case '?': + default: + // This is a hack but that is okay! + return 0; + } + // Indicates successful parsing of the command line + return 0; +} + +int +ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +{ + + if (parse_args (argc, + argv) == -1) + return -1; + + try + { + ACE_Argv_Type_Converter satc (argc, argv); + CORBA::ORB_var sorb = + CORBA::ORB_init (satc.get_argc (), + satc.get_TCHAR_argv ()); + + ACE_Manual_Event me; + Server_Task server_task (output, + sorb.in (), + me, + ACE_Thread_Manager::instance ()); + + if (server_task.activate (THR_NEW_LWP | THR_JOINABLE, + 1, + 1) == -1) + { + ACE_ERROR ((LM_ERROR, "Error activating server task\n")); + } + + // Wait for the server thread to do some processing + me.wait (); + ACE_Argv_Type_Converter catc (argc, argv); + CORBA::ORB_var corb = + CORBA::ORB_init (catc.get_argc (), + catc.get_TCHAR_argv ()); + + Client_Task client_task (input, + corb.in (), + ACE_Thread_Manager::instance (), + exception); + + if (client_task.activate (THR_NEW_LWP | THR_JOINABLE, + 1, + 1) == -1) + { + ACE_ERROR ((LM_ERROR, "Error activating client task\n")); + } + + // Wait for the client and server to finish + ACE_Thread_Manager::instance ()->wait (); + + // Now that all threads have completed we can destroy the ORB + sorb->destroy (); + } + catch (const CORBA::Exception&) + { + // Ignore exceptions.. + } + return 0; +} diff --git a/TAO/tests/POA/On_Demand_Act_Direct_Coll/On_Demand_Act_D_Coll.mpc b/TAO/tests/POA/On_Demand_Act_Direct_Coll/On_Demand_Act_D_Coll.mpc new file mode 100644 index 00000000000..973e9e988e1 --- /dev/null +++ b/TAO/tests/POA/On_Demand_Act_Direct_Coll/On_Demand_Act_D_Coll.mpc @@ -0,0 +1,15 @@ +// -*- MPC -*- +// $Id$ + +project(On_Demand_Act_D_Coll): taoserver, portableserver { + exename = On_Demand_Act_D_Coll + idlflags += -Gd + + Source_Files { + Collocated_Test.cpp + Server_Task.cpp + Client_Task.cpp + Servant_Activator.cpp + test_i.cpp + } +} diff --git a/TAO/tests/POA/On_Demand_Act_Direct_Coll/Servant_Activator.cpp b/TAO/tests/POA/On_Demand_Act_Direct_Coll/Servant_Activator.cpp new file mode 100644 index 00000000000..646f86ba81b --- /dev/null +++ b/TAO/tests/POA/On_Demand_Act_Direct_Coll/Servant_Activator.cpp @@ -0,0 +1,64 @@ + +//============================================================================= +/** + * @file Servant_Activator.cpp + * + * $Id$ + * + * Implementation of ServantActivator, which is used by a POA with + * a RETAIN policy. + * + * + * @author Irfan Pyarali + */ +//============================================================================= + + +#include "Servant_Activator.h" +#include "test_i.h" +#include "ace/OS_NS_string.h" + +ServantActivator::ServantActivator (CORBA::ORB_ptr orb, + ACE_thread_t thrid) + : orb_ (CORBA::ORB::_duplicate (orb)), + thr_id_ (thrid) +{ + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ServantActivator::ServantActivator\n"))); +} + +PortableServer::Servant +ServantActivator::incarnate (const PortableServer::ObjectId &oid, + PortableServer::POA_ptr poa) +{ + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ServantActivator::incarnate\n"))); + // Convert ObjectId to String. + CORBA::String_var s = PortableServer::ObjectId_to_string (oid); + + // If ObjectId string has a test substring, create and return a + // test_i. + + if (ACE_OS::strstr (s.in (), "test") != 0) + return new test_i (this->orb_.in (), poa, this->thr_id_); + else + { + throw CORBA::OBJECT_NOT_EXIST (); + } +} + + +void +ServantActivator::etherealize (const PortableServer::ObjectId &, + PortableServer::POA_ptr , + PortableServer::Servant servant, + CORBA::Boolean , + CORBA::Boolean remaining_activations) +{ + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ServantActivator::etherealize\n"))); + // If there are no remaining activations i.e ObjectIds associated + // with test_i delete it. + if (!remaining_activations) + delete servant; +} diff --git a/TAO/tests/POA/On_Demand_Act_Direct_Coll/Servant_Activator.h b/TAO/tests/POA/On_Demand_Act_Direct_Coll/Servant_Activator.h new file mode 100644 index 00000000000..db87624ce55 --- /dev/null +++ b/TAO/tests/POA/On_Demand_Act_Direct_Coll/Servant_Activator.h @@ -0,0 +1,49 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Servant_Activator.h + * + * $Id$ + * + * Defines a ServantActivator class. + * + * + * @author Irfan Pyarali + */ +//============================================================================= + + +#include "tao/PortableServer/PortableServer.h" +#include "tao/PortableServer/ServantActivatorC.h" +#include "tao/LocalObject.h" + +#include "tao/ORB.h" + +class ServantActivator : + public virtual PortableServer::ServantActivator, + public virtual ::CORBA::LocalObject +{ +public: + ServantActivator (CORBA::ORB_ptr orb, ACE_thread_t thrid); + + /** + * This method is invoked by a POA with USE_SERVANT_MANAGER and + * RETAIN policies, whenever it receives a request for a test object + * that is not currently active. + */ + PortableServer::Servant incarnate (const PortableServer::ObjectId &oid, + PortableServer::POA_ptr poa); + + /// This method is invoked whenever a test object is deactivated. + void etherealize (const PortableServer::ObjectId &oid, + PortableServer::POA_ptr adapter, + PortableServer::Servant servant, + CORBA::Boolean cleanup_in_progress, + CORBA::Boolean remaining_activations); + +private: + /// A reference to the ORB. + CORBA::ORB_var orb_; + ACE_thread_t thr_id_; +}; diff --git a/TAO/tests/POA/On_Demand_Act_Direct_Coll/Server_Task.cpp b/TAO/tests/POA/On_Demand_Act_Direct_Coll/Server_Task.cpp new file mode 100644 index 00000000000..687ad1e98b6 --- /dev/null +++ b/TAO/tests/POA/On_Demand_Act_Direct_Coll/Server_Task.cpp @@ -0,0 +1,148 @@ +// +// $Id$ +// +#include "Server_Task.h" +#include "Servant_Activator.h" +#include "ace/OS_NS_stdio.h" +#include "ace/Manual_Event.h" + +static const ACE_TCHAR *ior_output_file = ACE_TEXT("test.ior"); + +static int +write_iors_to_file (const char *first_ior) +{ + FILE *output_file = ACE_OS::fopen (ior_output_file, "w"); + if (output_file == 0 ) + ACE_ERROR_RETURN ((LM_ERROR, "Cannot open output files for writing IORs: %Cn", + ior_output_file), + -1); + + int result = ACE_OS::fprintf (output_file, + "%s", + first_ior); + if (result <= 0 + || static_cast<size_t> (result) != ACE_OS::strlen (first_ior)) + ACE_ERROR_RETURN ((LM_ERROR, + "ACE_OS::fprintf failed while writing %C to %s\n", + first_ior, + ior_output_file), + -1); + + ACE_OS::fclose (output_file); + return 0; +} + +Server_Task::Server_Task (const ACE_TCHAR *output, + CORBA::ORB_ptr sorb, + ACE_Manual_Event &me, + ACE_Thread_Manager *thr_mgr) + : ACE_Task_Base (thr_mgr) + , output_ (output) + , me_ (me) + , sorb_ (CORBA::ORB::_duplicate (sorb)) +{ +} + +int +Server_Task::svc (void) +{ + try + { + CORBA::Object_var poa_object = + this->sorb_->resolve_initial_references("RootPOA"); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in ()); + + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Panic: nil RootPOA\n"), + 1); + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (); + + + CORBA::PolicyList policies (4); + policies.length (4); + + // ID Assignment Policy + policies[0] = + root_poa->create_id_assignment_policy (PortableServer::USER_ID); + + // Lifespan Policy + policies[1] = + root_poa->create_lifespan_policy (PortableServer::PERSISTENT); + + // Request Processing Policy + policies[2] = + root_poa->create_request_processing_policy (PortableServer::USE_SERVANT_MANAGER); + + PortableServer::POA_var first_poa; + { + // Servant Retention Policy + policies[3] = + root_poa->create_servant_retention_policy (PortableServer::RETAIN); + + ACE_CString name = "firstPOA"; + + // Create firstPOA as the child of RootPOA with the above policies + // firstPOA will use SERVANT_ACTIVATOR because of RETAIN policy. + first_poa = root_poa->create_POA (name.c_str (), + poa_manager.in (), + policies); + + } + + // Destroy the policy objects as they have been passed to + // create_POA and no longer needed. + for (CORBA::ULong i = 0; + i < policies.length (); + ++i) + { + CORBA::Policy_ptr policy = policies[i]; + policy->destroy (); + } + // Allocate the servant activator. + ServantActivator activator (this->sorb_.in (), ACE_Thread::self ()); + // Set ServantActivator object as the servant_manager of + // firstPOA. + + first_poa->set_servant_manager (&activator); + // Create a reference with user created ID in firstPOA which uses + // the ServantActivator. + + PortableServer::ObjectId_var first_test_oid = + PortableServer::string_to_ObjectId ("first test"); + + CORBA::Object_var first_test = + first_poa->create_reference_with_id (first_test_oid.in (), "IDL:test:1.0"); + // Invoke object_to_string on the references created in firstPOA + + CORBA::String_var first_test_ior = + this->sorb_->object_to_string (first_test.in ()); + + // Print the ior's of first_test. + ACE_DEBUG((LM_DEBUG,"<%C>\n", + first_test_ior.in ())); + + int write_result = write_iors_to_file (first_test_ior.in ()); + if (write_result != 0) + return write_result; + + // Set the poa_manager state to active, ready to process requests. + poa_manager->activate (); + this->me_.signal (); + // Run the ORB. + this->sorb_->run (); + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + + return 0; +} diff --git a/TAO/tests/POA/On_Demand_Act_Direct_Coll/Server_Task.h b/TAO/tests/POA/On_Demand_Act_Direct_Coll/Server_Task.h new file mode 100644 index 00000000000..e42043c0711 --- /dev/null +++ b/TAO/tests/POA/On_Demand_Act_Direct_Coll/Server_Task.h @@ -0,0 +1,48 @@ +// -*- C++ -*- +// +// $Id$ + +#ifndef COLLOCATED_SERVER_TASK_H +#define COLLOCATED_SERVER_TASK_H + +#include /**/ "ace/pre.h" + +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/ORB.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +class ACE_Manual_Event; +ACE_END_VERSIONED_NAMESPACE_DECL + +/// Implement a Task to run the server in a single thread +class Server_Task : public ACE_Task_Base +{ +public: + /// Constructor + Server_Task (const ACE_TCHAR *output, + CORBA::ORB_ptr sorb, + ACE_Manual_Event &me, + ACE_Thread_Manager *thr_mgr); + + /// Thread entry point + int svc (void); + +private: + /// Output file for IOR + const ACE_TCHAR *output_; + + /// Manual event to wake up the main thread to create a client + /// thread. + ACE_Manual_Event &me_; + + CORBA::ORB_var sorb_; +}; + +#include /**/ "ace/post.h" + +#endif /* COLLOCATED_SERVER_TASK_H */ diff --git a/TAO/tests/POA/On_Demand_Act_Direct_Coll/run_test.pl b/TAO/tests/POA/On_Demand_Act_Direct_Coll/run_test.pl new file mode 100755 index 00000000000..39409d83955 --- /dev/null +++ b/TAO/tests/POA/On_Demand_Act_Direct_Coll/run_test.pl @@ -0,0 +1,44 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +my $server = PerlACE::TestTarget::create_target(1) || die "Create target 1 failed\n"; + +$iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +$server->DeleteFile($iorbase); + +$status = 0; + +$SV = $server->CreateProcess ("On_Demand_Act_D_Coll"); + +print STDERR "======== Running with ORBCollocationg = global, -ORBCollocationStrategy = thru_poa)\n"; +$SV->Arguments ("-o $server_iorfile -k file://$server_iorfile -t -ORBCollocation global -ORBCollocationStrategy thru_poa"); +$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); + +if ($sv != 0) { + print STDERR "ERROR in On_Demand_Act_D_Coll test: Servant Activator and Collocation test\n"; + $status = 1; +} +$server->DeleteFile($iorbase); + + +print STDERR "======== Running with -ORBCollocation global -ORBCollocationStrategy direct \n"; +$SV->Arguments ("-o $server_iorfile -k file://$server_iorfile -d -ORBCollocation global -ORBCollocationStrategy direct"); +$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); + +if ($sv != 0) { + print STDERR "ERROR in On_Demand_Act_D_Coll test: Servant Activator and Collocation test\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$server->GetStderrLog(); + +exit $status; diff --git a/TAO/tests/POA/On_Demand_Act_Direct_Coll/test.idl b/TAO/tests/POA/On_Demand_Act_Direct_Coll/test.idl new file mode 100644 index 00000000000..687502ce8f9 --- /dev/null +++ b/TAO/tests/POA/On_Demand_Act_Direct_Coll/test.idl @@ -0,0 +1,13 @@ +// $Id$ + +interface test +{ + /// Return a simple string + string get_string (); + + void method (); + // A twoway operation. + + void shutdown (); + // Shutdown the server. +}; diff --git a/TAO/tests/POA/On_Demand_Act_Direct_Coll/test_i.cpp b/TAO/tests/POA/On_Demand_Act_Direct_Coll/test_i.cpp new file mode 100644 index 00000000000..41cd3c13348 --- /dev/null +++ b/TAO/tests/POA/On_Demand_Act_Direct_Coll/test_i.cpp @@ -0,0 +1,58 @@ +// $Id$ + +#include "test_i.h" +#include "ace/OS_NS_unistd.h" +#include "ace/OS_NS_string.h" + +// Constructor +test_i::test_i (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + ACE_thread_t thrid) + : orb_ (CORBA::ORB::_duplicate (orb)) + ,poa_ (PortableServer::POA::_duplicate (poa)) + ,thr_id_ (thrid) +{ +} + +void +test_i::method (void) +{ +} + +char * +test_i::get_string (void) +{ + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) Upcall in process ..\n")); + // Use portable thread IDs + ACE_Thread_ID self_ID; + // Thread ID from Server + ACE_Thread_ID this_ID; + this_ID.id(this->thr_id_); + + // Servant Thread ID same as Thread ID server, so a remote call, + // in case of a collocation the servant runs in calling thread (Client) + if (self_ID == this_ID) + { + ACE_ERROR ((LM_ERROR, + "(%P|%t) ERROR: A remote call has been made " + " exiting ..\n")); + ACE_OS::abort (); + } + else + { + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) OK: A collocated invocation has been made.\n")); + } + return CORBA::string_dup ("Hello there!"); +} + +void +test_i::shutdown (void) +{ + // Give the client thread time to return from the collocated + // call to this method before shutting down the ORB. We sleep + // to avoid BAD_INV_ORDER exceptions on fast dual processor machines. + ACE_OS::sleep (1); + this->orb_->shutdown (0); +} diff --git a/TAO/tests/POA/On_Demand_Act_Direct_Coll/test_i.h b/TAO/tests/POA/On_Demand_Act_Direct_Coll/test_i.h new file mode 100644 index 00000000000..44c4a114aea --- /dev/null +++ b/TAO/tests/POA/On_Demand_Act_Direct_Coll/test_i.h @@ -0,0 +1,44 @@ +//============================================================================= +/** + * @file test_i.h + * + * $Id$ + * + * Defines test_i class for the test interface + * + * + * @author Irfan Pyarali + */ +//============================================================================= + + +#include "testS.h" + +class test_i : public POA_test +{ +public: + /// Constructor - takes a POA and a value parameter + test_i (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + ACE_thread_t thr_id); + + /// A twoway operation. + void method (void); + + /// A twoway operation. + char * + get_string (void); + + /// Shutdown the ORB + void shutdown (void); + + +protected: + /// Our ORB. + CORBA::ORB_var orb_; + + /// Our POA. + PortableServer::POA_var poa_; +private: + ACE_thread_t thr_id_; +}; diff --git a/TAO/tests/Param_Test/anyop.cpp b/TAO/tests/Param_Test/anyop.cpp index 006d174f24e..c440b8198b2 100644 --- a/TAO/tests/Param_Test/anyop.cpp +++ b/TAO/tests/Param_Test/anyop.cpp @@ -87,10 +87,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) orb->string_to_object ("corbaloc:iiop:localhost:1234/Foo/Bar"); Param_Test_var param_test = - TAO::Narrow_Utils<Param_Test>::unchecked_narrow ( - obj.in (), - _TAO_Param_Test_Proxy_Broker_Factory_function_pointer - ); + TAO::Narrow_Utils<Param_Test>::unchecked_narrow (obj.in ()); TAO_Stub *stub = param_test->_stubobj (); stub->type_id = CORBA::string_dup ("IDL:Param_Test:1.0"); diff --git a/TAO/tests/Policies/Manipulation.cpp b/TAO/tests/Policies/Manipulation.cpp index 2feb981f76d..7e1169fb0f6 100644 --- a/TAO/tests/Policies/Manipulation.cpp +++ b/TAO/tests/Policies/Manipulation.cpp @@ -92,9 +92,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) orb->string_to_object ("corbaloc:iiop:localhost:12345/FakeIOR"); Test_var test = - TAO::Narrow_Utils<Test>::unchecked_narrow ( - object.in (), - _TAO_Test_Proxy_Broker_Factory_function_pointer); + TAO::Narrow_Utils<Test>::unchecked_narrow (object.in ()); if (CORBA::is_nil (test.in ())) { diff --git a/TAO/tests/Policies/Policies.mpc b/TAO/tests/Policies/Policies.mpc index 353c7a0ccec..05a385e23a3 100644 --- a/TAO/tests/Policies/Policies.mpc +++ b/TAO/tests/Policies/Policies.mpc @@ -3,5 +3,4 @@ project(Policies Manipulation): taoserver, messaging { exename = Manipulation - requires += corba_messaging } |