diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2012-09-27 09:30:10 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2012-09-27 09:30:10 +0000 |
commit | dd9e32da40dd7e770a2e48da4b20b730d7170836 (patch) | |
tree | f34fd06f76cc8ef66b13fc88d48424a2b4f53df3 | |
parent | 9efc4602046e22199d1fd9314f682f94a74c3e6f (diff) | |
download | ATCD-dd9e32da40dd7e770a2e48da4b20b730d7170836.tar.gz |
Thu Sep 27 09:29:38 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl>
* bin/ciao_tests.lst:
* examples/Hello:
Added new Hello test that isn't dependent on CCM events
-rw-r--r-- | CIAO/ChangeLog | 6 | ||||
-rw-r--r-- | CIAO/bin/ciao_tests.lst | 11 | ||||
-rw-r--r-- | CIAO/examples/Hello/Base/Hello.idl | 34 | ||||
-rw-r--r-- | CIAO/examples/Hello/Base/Hello.mpc | 111 | ||||
-rw-r--r-- | CIAO/examples/Hello/Receiver/Hello_Receiver.idl | 18 | ||||
-rw-r--r-- | CIAO/examples/Hello/Receiver/Hello_Receiver.mpc | 133 | ||||
-rw-r--r-- | CIAO/examples/Hello/Receiver/Hello_Receiver_exec.cpp | 166 | ||||
-rw-r--r-- | CIAO/examples/Hello/Receiver/Hello_Receiver_exec.h | 69 | ||||
-rw-r--r-- | CIAO/examples/Hello/Sender/Hello_Sender.idl | 19 | ||||
-rw-r--r-- | CIAO/examples/Hello/Sender/Hello_Sender.mpc | 134 | ||||
-rw-r--r-- | CIAO/examples/Hello/Sender/Hello_Sender_exec.cpp | 207 | ||||
-rw-r--r-- | CIAO/examples/Hello/descriptors/Plan.cdp | 238 | ||||
-rwxr-xr-x | CIAO/examples/Hello/descriptors/run_test.pl | 260 |
13 files changed, 1401 insertions, 5 deletions
diff --git a/CIAO/ChangeLog b/CIAO/ChangeLog index 404ee777015..f93a9bbf099 100644 --- a/CIAO/ChangeLog +++ b/CIAO/ChangeLog @@ -1,3 +1,9 @@ +Thu Sep 27 09:29:38 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> + + * bin/ciao_tests.lst: + * examples/Hello: + Added new Hello test that isn't dependent on CCM events + Thu Sep 27 08:59:45 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> * bin/ciao_tests.lst: diff --git a/CIAO/bin/ciao_tests.lst b/CIAO/bin/ciao_tests.lst index bed9684cbd9..e70ac1e52b1 100644 --- a/CIAO/bin/ciao_tests.lst +++ b/CIAO/bin/ciao_tests.lst @@ -11,14 +11,15 @@ # testing vendor specific features, these can use DDS4CCM_NDDS and # DDS4CCM_OPENDDS # -TAO/CIAO/examples/Hello/descriptors/run_test.pl: !CCM_NOEVENT -TAO/CIAO/examples/Hello/descriptors/run_test_shs.pl: !CCM_NOEVENT -TAO/CIAO/examples/Hello/descriptors/run_test_PlanLocality_DifferentProcesses.pl: !CCM_NOEVENT -TAO/CIAO/examples/Hello/descriptors/run_test_PlanLocality_SameProcess.pl: !CCM_NOEVENT +TAO/CIAO/examples/Hello/descriptors/run_test.pl +TAO/CIAO/examples/Hello_Event/descriptors/run_test.pl: !CCM_NOEVENT +TAO/CIAO/examples/Hello_Event/descriptors/run_test_shs.pl: !CCM_NOEVENT +TAO/CIAO/examples/Hello_Event/descriptors/run_test_PlanLocality_DifferentProcesses.pl: !CCM_NOEVENT +TAO/CIAO/examples/Hello_Event/descriptors/run_test_PlanLocality_SameProcess.pl: !CCM_NOEVENT +TAO/CIAO/examples/Hello_Event/descriptors/run_test_without_ns.pl: !CCM_NOEVENT TAO/CIAO/examples/BasicSP/descriptors/run_test.pl: !CCM_NOEVENT TAO/CIAO/examples/Null_Component/descriptors/run_test.pl: TAO/CIAO/examples/Null_Component/descriptors/run_test_without_ns.pl: -TAO/CIAO/examples/Hello/descriptors/run_test_without_ns.pl: !CCM_NOEVENT TAO/CIAO/examples/Display/descriptors/run_all_in_one.pl: !CCM_NOEVENT TAO/CIAO/tutorials/Quoter/Simple/descriptors/run_test.pl: !CCM_NOEVENT TAO/CIAO/tests/Collocation/descriptors/run_test.pl: CCM_DIRECTCOLL diff --git a/CIAO/examples/Hello/Base/Hello.idl b/CIAO/examples/Hello/Base/Hello.idl new file mode 100644 index 00000000000..f5d6a9ae36f --- /dev/null +++ b/CIAO/examples/Hello/Base/Hello.idl @@ -0,0 +1,34 @@ +// $Id$ + +#ifndef HELLO_IDL +#define HELLO_IDL + +#pragma ciao lem "Base/HelloE.idl" + +module Hello +{ + exception InternalError + { + long id; + string error_string; + }; + + // Sender/Receiver interface + interface MyFoo + { + long foo (in string in_str, out string answer) + raises (InternalError); + void hello (out long answer) + raises (InternalError); + + attribute short rw_attrib + getraises (InternalError) + setraises (InternalError); + + readonly attribute short ro_attrib + raises (InternalError); + }; +}; + +#endif + diff --git a/CIAO/examples/Hello/Base/Hello.mpc b/CIAO/examples/Hello/Base/Hello.mpc new file mode 100644 index 00000000000..bff69c6b788 --- /dev/null +++ b/CIAO/examples/Hello/Base/Hello.mpc @@ -0,0 +1,111 @@ +// $Id$ + +project(Hello_Example_idl_gen) : componentidldefaults { + custom_only = 1 + idlflags += -Wb,stub_export_macro=HELLO_STUB_Export \ + -Wb,stub_export_include=Hello_stub_export.h \ + -Wb,skel_export_macro=HELLO_SKEL_Export \ + -Wb,skel_export_include=Hello_skel_export.h \ + -Wb,conn_export_macro=HELLO_CONN_Export \ + -Wb,conn_export_include=Hello_conn_export.h \ + -Wb,exec_export_macro=HELLO_EXEC_Export \ + -Wb,exec_export_include=Hello_exec_export.h \ + -I.. + + IDL_Files { + Hello.idl + } +} + +project(Hello_Example_lem_gen) : ciaoidldefaults { + after += Hello_Example_idl_gen Hello_Example_lema_gen + custom_only = 1 + idlflags += -Wb,export_macro=HELLO_LEM_STUB_Export \ + -Wb,export_include=Hello_lem_stub_export.h \ + -I.. -SS -Gxhst + + IDL_Files { + HelloE.idl + } +} + +project(Hello_Example_stub) : ccm_stub { + after += Hello_Example_lem_gen + libs += + libout = ../lib + libpaths += ../lib + includes += .. + + sharedname = Hello_stub + dynamicflags += HELLO_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + HelloC.cpp + } + + Header_Files { + HelloC.h + Hello_stub_export.h +} + + Inline_Files { + HelloC.inl + } +} + +project(Hello_Example_lem_stub) : ccm_executor { + after += Hello_Example_lem_gen Hello_Example_stub Hello_Example_lemae_gen Hello_Example_skel + libs += Hello_stub Hello_skel + libout = ../lib + libpaths += ../lib + includes += .. + + sharedname = Hello_lem_stub + dynamicflags += HELLO_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + HelloEC.cpp + } + + Header_Files { + HelloEC.h + Hello_lem_stub_export.h +} + + Inline_Files { + HelloEC.inl + } +} + +project(Hello_Example_skel) : ciao_executor { + after += Hello_Example_stub + sharedname = Hello_skel + libs += Hello_stub + libout = ../lib + libpaths += ../lib + includes += .. + + dynamicflags += HELLO_SKEL_BUILD_DLL + + IDL_Files { + } + + Source_Files { + HelloS.cpp + } + + Header_Files { + HelloS.h + Hello_skel_export.h + } + + Inline_Files { + } +} + diff --git a/CIAO/examples/Hello/Receiver/Hello_Receiver.idl b/CIAO/examples/Hello/Receiver/Hello_Receiver.idl new file mode 100644 index 00000000000..242594e5681 --- /dev/null +++ b/CIAO/examples/Hello/Receiver/Hello_Receiver.idl @@ -0,0 +1,18 @@ +// $Id$ + +#ifndef HELLO_RECEIVER_IDL +#define HELLO_RECEIVER_IDL + +#include <Components.idl> + +#include "Base/Hello.idl" + +module Hello +{ + component Receiver + { + /// Provides + provides MyFoo do_my_foo; + }; +}; +#endif diff --git a/CIAO/examples/Hello/Receiver/Hello_Receiver.mpc b/CIAO/examples/Hello/Receiver/Hello_Receiver.mpc new file mode 100644 index 00000000000..badc6086f5d --- /dev/null +++ b/CIAO/examples/Hello/Receiver/Hello_Receiver.mpc @@ -0,0 +1,133 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p Hello_Base Hello_Receiver" + +project(Hello_Example_Base_Hello_Receiver_idl_gen) : componentidldefaults { + custom_only = 1 + after += Hello_Example_idl_gen + idlflags += -Wb,stub_export_macro=HELLO_RECEIVER_STUB_Export \ + -Wb,stub_export_include=Hello_Receiver_stub_export.h \ + -Wb,skel_export_macro=HELLO_RECEIVER_SVNT_Export \ + -Wb,skel_export_include=Hello_Receiver_svnt_export.h \ + -Wb,exec_export_macro=HELLO_RECEIVER_EXEC_Export \ + -Wb,exec_export_include=Hello_Receiver_exec_export.h \ + -Glem -I.. + + IDL_Files { + Hello_Receiver.idl + } +} + +project(Hello_Example_Base_Hello_Receiver_lem_gen) : ciaoidldefaults { + after += Hello_Example_Base_Hello_Receiver_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=HELLO_RECEIVER_LEM_STUB_Export \ + -Wb,stub_export_include=Hello_Receiver_lem_stub_export.h \ + -SS -Gxhst -I.. + + IDL_Files { + Hello_ReceiverE.idl + } +} + +project(Hello_Example_Base_Hello_Receiver_l_stub) : ccm_svnt, messaging { + after += Hello_Example_Base_Hello_Receiver_lem_gen Hello_Example_Base_Hello_Receiver_stub Hello_Example_stub + libs += Hello_stub Hello_Receiver_stub + libpaths += ../lib + libout = ../lib + sharedname = Hello_Receiver_lem_stub + dynamicflags += HELLO_RECEIVER_LEM_STUB_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + Hello_ReceiverEC.cpp + } + + Header_Files { + Hello_ReceiverEC.h + Hello_Receiver_lem_stub_export.h + } + + Inline_Files { + Hello_ReceiverEC.inl + } +} + +project(Hello_Example_Base_Hello_Receiver_stub) : ccm_stub, messaging { + after += Hello_Example_Base_Hello_Receiver_idl_gen Hello_Example_stub + libs += Hello_stub + libpaths += ../lib + libout = ../lib + sharedname = Hello_Receiver_stub + dynamicflags += HELLO_RECEIVER_STUB_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + Hello_ReceiverC.cpp + } + + Header_Files { + Hello_ReceiverC.h + Hello_Receiver_stub_export.h + } + + Inline_Files { + Hello_ReceiverC.inl + } +} + +project(Hello_Example_Base_Hello_Receiver_exec) : ciao_executor, messaging { + after += Hello_Example_Base_Hello_Receiver_l_stub Hello_Example_Base_Hello_Receiver_stub Hello_Example_stub Hello_Example_lem_stub + sharedname = Hello_Receiver_exec + libs += Hello_Receiver_stub Hello_Receiver_lem_stub Hello_stub Hello_lem_stub + libpaths += ../lib + libout = ../lib + dynamicflags += HELLO_RECEIVER_EXEC_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + Hello_Receiver_exec.cpp + } + + Header_Files { + Hello_Receiver_exec.h + Hello_Receiver_exec_export.h + } + + Inline_Files { + } +} + +project(Hello_Example_Base_Hello_Receiver_svnt) : ciao_servant, messaging { + after += Hello_Example_Base_skel Hello_Example_Base_Hello_Receiver_l_stub Hello_Example_stub Hello_Example_skel Hello_Example_lem_stub + sharedname = Hello_Receiver_svnt + libs += Hello_Receiver_stub Hello_Receiver_lem_stub \ + Hello_skel \ + Hello_stub Hello_lem_stub + libpaths += ../lib + libout = ../lib + dynamicflags += HELLO_RECEIVER_SVNT_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + Hello_ReceiverS.cpp + Hello_Receiver_svnt.cpp + } + + Header_Files { + Hello_ReceiverS.h + Hello_Receiver_svnt.h + Hello_Receiver_svnt_export.h + } + + Inline_Files { + } +} + diff --git a/CIAO/examples/Hello/Receiver/Hello_Receiver_exec.cpp b/CIAO/examples/Hello/Receiver/Hello_Receiver_exec.cpp new file mode 100644 index 00000000000..8b431b6d6c5 --- /dev/null +++ b/CIAO/examples/Hello/Receiver/Hello_Receiver_exec.cpp @@ -0,0 +1,166 @@ +// -*- C++ -*- +// $Id$ + +#include "Hello_Receiver_exec.h" +#include "ace/OS_NS_unistd.h" + +namespace CIAO_Hello_Receiver_Impl +{ + MyFoo_exec_i::MyFoo_exec_i ( + ::Hello::CCM_Receiver_Context_ptr ctx) + : ciao_context_ ( + ::Hello::CCM_Receiver_Context::_duplicate (ctx)), + get_rw_ (false), + get_ro_ (false) + { + } + + MyFoo_exec_i::~MyFoo_exec_i (void) + { + } + + ::CORBA::Long + MyFoo_exec_i::foo (const char * in_str, ::CORBA::String_out answer) + { + if (ACE_OS::strlen (in_str) == 0) + { + Hello::InternalError ex (42, "Hello world"); + throw ex; + } + else + { + ACE_OS::sleep (ACE_OS::rand () % 2); + answer = CORBA::string_dup ("This is my answer : Hi"); + return ACE_OS::rand () % 100; + } + } + + void + MyFoo_exec_i::hello (::CORBA::Long_out answer) + { + ACE_OS::sleep (ACE_OS::rand () % 2); + answer = ACE_OS::rand () % 100; + } + + ::CORBA::Short + MyFoo_exec_i::rw_attrib () + { + if (this->get_rw_) + { + this->get_rw_ = false; + Hello::InternalError ex (42, "Hello world"); + throw ex; + } + else + { + ACE_OS::sleep (ACE_OS::rand () % 2); + this->get_rw_ = true; + } + return ACE_OS::rand () % 100; + } + + void + MyFoo_exec_i::rw_attrib (::CORBA::Short new_value) + { + if (new_value == 0) + { + Hello::InternalError ex (42, "Hello world"); + throw ex; + } + else + { + ACE_OS::sleep (ACE_OS::rand () % 2); + } + } + + CORBA::Short + MyFoo_exec_i::ro_attrib () + { + if (this->get_ro_) + { + this->get_ro_ = false; + Hello::InternalError ex (42, "Hello world"); + throw ex; + } + else + { + ACE_OS::sleep (ACE_OS::rand () % 2); + this->get_ro_ = true; + } + return ACE_OS::rand () % 100; + } + + Receiver_exec_i::Receiver_exec_i (void) + { + } + + Receiver_exec_i::~Receiver_exec_i (void) + { + } + + ::Hello::CCM_MyFoo_ptr + Receiver_exec_i::get_do_my_foo (void) + { + if ( ::CORBA::is_nil (this->ciao_do_my_foo_.in ())) + { + MyFoo_exec_i *tmp = 0; + ACE_NEW_RETURN ( + tmp, + MyFoo_exec_i ( + this->context_.in ()), + ::Hello::CCM_MyFoo::_nil ()); + + this->ciao_do_my_foo_ = tmp; + } + + return + ::Hello::CCM_MyFoo::_duplicate ( + this->ciao_do_my_foo_.in ()); + } + + void + Receiver_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + this->context_ = ::Hello::CCM_Receiver_Context::_narrow (ctx); + + if ( ::CORBA::is_nil (this->context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + Receiver_exec_i::configuration_complete (void) + { + } + + void + Receiver_exec_i::ccm_activate (void) + { + } + + void + Receiver_exec_i::ccm_passivate (void) + { + } + + void + Receiver_exec_i::ccm_remove (void) + { + } + + extern "C" ::Components::EnterpriseComponent_ptr + create_Hello_AMI_Receiver_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_RETURN ( + retval, + Receiver_exec_i, + ::Components::EnterpriseComponent::_nil ()); + + return retval; + } +} diff --git a/CIAO/examples/Hello/Receiver/Hello_Receiver_exec.h b/CIAO/examples/Hello/Receiver/Hello_Receiver_exec.h new file mode 100644 index 00000000000..602e820ac59 --- /dev/null +++ b/CIAO/examples/Hello/Receiver/Hello_Receiver_exec.h @@ -0,0 +1,69 @@ +// -*- C++ -*- +// $Id$ + +#ifndef CIAO_HELLO_RECEIVER_EXEC_H_ +#define CIAO_HELLO_RECEIVER_EXEC_H_ + +#include "Hello_ReceiverEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/LocalObject.h" +#include "Hello_Receiver_exec_export.h" + +namespace CIAO_Hello_Receiver_Impl +{ + class MyFoo_exec_i + : public virtual ::Hello::CCM_MyFoo, + public virtual ::CORBA::LocalObject + { + public: + MyFoo_exec_i (::Hello::CCM_Receiver_Context_ptr ctx); + virtual ~MyFoo_exec_i (void); + + virtual ::CORBA::Long foo (const char * in_str, ::CORBA::String_out answer); + + virtual void hello (::CORBA::Long_out answer); + + virtual ::CORBA::Short rw_attrib (); + + virtual void rw_attrib (::CORBA::Short new_value); + + virtual CORBA::Short ro_attrib (); + private: + ::Hello::CCM_Receiver_Context_var ciao_context_; + bool get_rw_; + bool get_ro_; + }; + + class Receiver_exec_i + : public virtual Receiver_Exec, + public virtual ::CORBA::LocalObject + { + public: + Receiver_exec_i (void); + virtual ~Receiver_exec_i (void); + + virtual ::Hello::CCM_MyFoo_ptr get_do_my_foo (void); + + 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); + + private: + ::Hello::CCM_Receiver_Context_var context_; + ::Hello::CCM_MyFoo_var ciao_do_my_foo_; + }; + + extern "C" HELLO_RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_Hello_AMI_Receiver_Impl (void); +} + +#endif /* ifndef */ + diff --git a/CIAO/examples/Hello/Sender/Hello_Sender.idl b/CIAO/examples/Hello/Sender/Hello_Sender.idl new file mode 100644 index 00000000000..df1f83c6a18 --- /dev/null +++ b/CIAO/examples/Hello/Sender/Hello_Sender.idl @@ -0,0 +1,19 @@ +// $Id$ + +#ifndef HELLO_SENDER_IDL +#define HELLO_SENDER_IDL + +#include <Components.idl> + +#include "Base/Hello.idl" + +module Hello +{ + component Sender + { + /// For synchronous invocation + uses MyFoo run_my_foo; + }; +}; + +#endif diff --git a/CIAO/examples/Hello/Sender/Hello_Sender.mpc b/CIAO/examples/Hello/Sender/Hello_Sender.mpc new file mode 100644 index 00000000000..114c93ec6d8 --- /dev/null +++ b/CIAO/examples/Hello/Sender/Hello_Sender.mpc @@ -0,0 +1,134 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p Hello_Base Hello_Sender" + +project(Hello_Example_Base_Hello_Sender_idl_gen) : componentidldefaults { + after += Hello_Example_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=HELLO_SENDER_STUB_Export \ + -Wb,stub_export_include=Hello_Sender_stub_export.h \ + -Wb,skel_export_macro=HELLO_SENDER_SVNT_Export \ + -Wb,skel_export_include=Hello_Sender_svnt_export.h \ + -Wb,exec_export_macro=HELLO_SENDER_EXEC_Export \ + -Wb,exec_export_include=Hello_Sender_exec_export.h \ + -I.. + + IDL_Files { + Hello_Sender.idl + } +} + +project(Hello_Example_Base_Hello_Sender_lem_gen) : ciaoidldefaults { + after += Hello_Example_Base_Hello_Sender_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=HELLO_SENDER_LEM_STUB_Export \ + -Wb,stub_export_include=Hello_Sender_lem_stub_export.h \ + -SS -Gxhst -I.. + + IDL_Files { + Hello_SenderE.idl + } +} + +project(Hello_Example_Base_Hello_Sender_lem_stub) : ccm_svnt { + after += Hello_Example_Base_Hello_Sender_lem_gen Hello_Example_stub Conn_Hello_Base_stub + libs += Hello_stub + libpaths += ../lib + libout = ../lib + sharedname = Hello_Sender_lem_stub + dynamicflags += HELLO_SENDER_LEM_STUB_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + Hello_SenderEC.cpp + } + + Header_Files { + Hello_SenderEC.h + Hello_Sender_lem_stub_export.h + } + + Inline_Files { + Hello_SenderEC.inl + } +} + +project(Hello_Example_Base_Hello_Sender_stub) : ccm_stub { + after += Hello_Example_Base_Hello_Sender_idl_gen Hello_Example_Base_stub Hello_Example_stub Conn_Hello_Base_stub + libs += Hello_stub + libpaths += ../lib + libout = ../lib + sharedname = Hello_Sender_stub + dynamicflags += HELLO_SENDER_STUB_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + Hello_SenderC.cpp + } + + Header_Files { + Hello_SenderC.h + Hello_Sender_stub_export.h + } + + Inline_Files { + Hello_SenderC.inl + } +} + +project(Hello_Example_Base_Hello_Sender_exec) : ciao_executor { + after += Hello_Example_Base_Hello_Sender_lem_stub Hello_Example_Base_Hello_Sender_stub Hello_Example_Base_exec Conn_Hello_Base_stub Hello_Example_lem_stub + sharedname = Hello_Sender_exec + libs += Hello_Sender_stub Hello_Sender_lem_stub Hello_stub Hello_stub Hello_lem_stub + libpaths += ../lib + libout = ../lib + dynamicflags += HELLO_SENDER_EXEC_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + Hello_Sender_exec.cpp + } + + Header_Files { + Hello_Sender_exec.h + Hello_Sender_exec_export.h + } + + Inline_Files { + } +} + +project(Hello_Example_Base_Hello_Sender_svnt) : ciao_servant { + after += Hello_Example_Base_skel Hello_Example_Base_Hello_Sender_lem_stub Hello_Example_Base_Hello_Sender_stub Hello_Example_Base_exec Hello_Example_skel + sharedname = Hello_Sender_svnt + libs += Hello_Sender_stub Hello_Sender_lem_stub \ + Hello_skel \ + Hello_stub + libpaths += ../lib + libout = ../lib + dynamicflags += HELLO_SENDER_SVNT_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + Hello_SenderS.cpp + Hello_Sender_svnt.cpp + } + + Header_Files { + Hello_SenderS.h + Hello_Sender_svnt.h + Hello_Sender_svnt_export.h + } + + Inline_Files { + } +} + + diff --git a/CIAO/examples/Hello/Sender/Hello_Sender_exec.cpp b/CIAO/examples/Hello/Sender/Hello_Sender_exec.cpp new file mode 100644 index 00000000000..92b9afeb43d --- /dev/null +++ b/CIAO/examples/Hello/Sender/Hello_Sender_exec.cpp @@ -0,0 +1,207 @@ +// -*- C++ -*- +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v1.8.3 + * 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 "Hello_Sender_exec.h" + +#include "ace/OS_NS_unistd.h" + +namespace CIAO_Hello_Sender_Impl +{ + //============================================================ + // Worker thread for synchronous invocations for MyFoo + //============================================================ + synch_foo_generator::synch_foo_generator ( + ::Hello::CCM_Sender_Context_ptr context) + : ciao_context_(::Hello::CCM_Sender_Context::_duplicate (context)) + { + } + + int synch_foo_generator::svc () + { + ACE_OS::sleep (3); + ::Hello::MyFoo_var my_foo_ami_ = + ciao_context_->get_connection_run_my_foo (); + + //run synch calls + CORBA::String_var out_str; + for (int i = 0; i < 5; ++i) + { + CORBA::Long result = my_foo_ami_->foo ("Do something synchronous", + out_str.out ()); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("Sender (SYNCH):\tInvoked synchronous call (FOO)") + ACE_TEXT(" result <%u> answer <%C>\n"), result, out_str.in ())); + + CORBA::Long answer; + my_foo_ami_->hello (answer); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("Sender (SYNCH):\tInvoked synchronous call ") + ACE_TEXT("(HELLO) answer <%u>\n"), answer)); + + try + { + CORBA::Short rw_attrib = my_foo_ami_->rw_attrib (); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("Sender (SYNCH):\tInvoked synchronous call ") + ACE_TEXT("(GET_RW_ATTRIB) answer <%u>\n"), rw_attrib)); + } + catch (const Hello::InternalError& ex) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("Sender (SYNCH FOO) :\tExpected Except caught :") + ACE_TEXT(" <%u> <%C>\n"), ex.id, ex.error_string.in ())); + } + + try + { + my_foo_ami_->rw_attrib (15); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("Sender (SYNCH):\tInvoked synchronous call ") + ACE_TEXT("(SET_RW_ATTRIB) to <15>\n"))); + } + catch (const Hello::InternalError& ex) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("Sender (SYNCH FOO) :\tExpected Except caught :") + ACE_TEXT(" <%u> <%C>\n"), ex.id, ex.error_string.in ())); + } + + try + { + CORBA::Short ro_attrib = my_foo_ami_->ro_attrib (); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("Sender (SYNCH):\tInvoked synchronous call ") + ACE_TEXT("(GET_RO_ATTRIB) answer <%u>\n"), ro_attrib)); + } + catch (const Hello::InternalError& ex) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("Sender (SYNCH FOO) :\tExpected Except caught :") + ACE_TEXT(" <%u> <%C>\n"), ex.id, ex.error_string.in ())); + } + } + try + { + CORBA::Long result = my_foo_ami_->foo ("", out_str.out ()); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("Sender (SYNCH) :\tInvoked synchronous call result ") + ACE_TEXT("<%u> answer <%C>\n"), result, out_str.in ())); + } + catch (const Hello::InternalError& ex) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("Sender (SYNCH FOO) :\tExpected Except caught : ") + ACE_TEXT("<%u> <%C>\n"), ex.id, ex.error_string.in ())); + } + try + { + my_foo_ami_->rw_attrib (0); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("Sender (SYNCH) :\tInvoked synchronous call rw_attrib\n"))); + } + catch (const Hello::InternalError& ex) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("Sender (SYNCH RW_ATTRIB) :\tExpected Except caught :") + ACE_TEXT(" <%u> <%C>\n"), ex.id, ex.error_string.in ())); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("ERROR: Caught unexpected except:"); + } + return 0; + } + + //============================================================ + // Component Executor Implementation Class: Sender_exec_i + //============================================================ + Sender_exec_i::Sender_exec_i (void) : + synch_foo_gen_ (0) + { + } + + Sender_exec_i::~Sender_exec_i (void) + { + } + + // Supported operations and attributes. + + // Component attributes. + + // Port operations. + // Operations from Components::SessionComponent. + + void + Sender_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + this->ciao_context_ = + ::Hello::CCM_Sender_Context::_narrow (ctx); + if ( ::CORBA::is_nil (this->ciao_context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + Sender_exec_i::configuration_complete (void) + { + } + + void + Sender_exec_i::ccm_activate (void) + { + this->synch_foo_gen_ = + new synch_foo_generator (this->ciao_context_.in()); + this->synch_foo_gen_->activate (THR_NEW_LWP | THR_JOINABLE, 1); + } + + void + Sender_exec_i::ccm_passivate (void) + { + } + + void + Sender_exec_i::ccm_remove (void) + { + delete this->synch_foo_gen_; + this->synch_foo_gen_ = 0; + } + + extern "C" HELLO_SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_Hello_Sender_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_NORETURN ( + retval, + Sender_exec_i); + + return retval; + } +} diff --git a/CIAO/examples/Hello/descriptors/Plan.cdp b/CIAO/examples/Hello/descriptors/Plan.cdp new file mode 100644 index 00000000000..86d852990df --- /dev/null +++ b/CIAO/examples/Hello/descriptors/Plan.cdp @@ -0,0 +1,238 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no" ?> +<!-- $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"> + + <UUID>6D382DAE-9024-4C4D-B91B-A0F9176AFACF</UUID> + <!--this plan is made for using the synchronous connection between Sender and Receiver--> + + <implementation xmi:id="Hello_ReceiverHomeImplementation"> + <name>Hello_ReceiverHomeImplementation</name> + <source/> + <artifact xmi:idref="Hello_Receiver_ExecArtifact"/> + <artifact xmi:idref="Hello_Receiver_SvntArtifact"/> + <execParameter> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Hello_AMI_Receiver_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Hello.ImplementationArtifacts.ReceiverArtifacts.Receiver_exec</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Hello_Receiver_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Hello.ImplementationArtifacts.ReceiverArtifacts.Receiver_svnt</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="Hello_SenderHomeImplementation"> + <name>Hello_SenderHomeImplementation</name> + <source/> + <artifact xmi:idref="Hello_Sender_ExecArtifact"/> + <artifact xmi:idref="Hello_Sender_SvntArtifact"/> + <execParameter> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Hello_Sender_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Hello.ImplementationArtifacts.SenderArtifacts.Sender_exec</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Hello_Sender_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Hello.ImplementationArtifacts.SenderArtifacts.Sender_svnt</string> + </value> + </value> + </execParameter> + </implementation> + + <instance xmi:id="Hello.ComponentImplementations.HelloImplementation.Hello.Receiver"> + <name>Hello.ComponentImplementations.HelloImplementation.Hello.Receiver</name> + <node>Receiver</node> + <source/> + <implementation xmi:idref="Hello_ReceiverHomeImplementation"/> + <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="Hello.ComponentImplementations.HelloImplementation.Hello.Sender"> + <name>Hello.ComponentImplementations.HelloImplementation.Hello.Sender</name> + <node>Sender</node> + <source/> + <implementation xmi:idref="Hello_SenderHomeImplementation"/> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Sender.ior</string> + </value> + </value> + </configProperty> + </instance> + + <!-- this plan is made for using the synchronous connection between Sender and Receiver> + <instead of using the synchronous port on the AMI connector--> + + <!--synchronous connection between Sender and Receiver--> + <connection> + <name>synch_foo_connection</name> + <internalEndpoint> + <portName>do_my_foo</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="Hello.ComponentImplementations.HelloImplementation.Hello.Receiver" /> + </internalEndpoint> + <internalEndpoint> + <portName>run_my_foo</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="Hello.ComponentImplementations.HelloImplementation.Hello.Sender" /> + </internalEndpoint> + </connection> + + <artifact xmi:id="Hello_Receiver_SvntArtifact"> + <name>Hello.ImplementationArtifacts.ReceiverArtifacts.Receiver_svnt</name> + <source/> + <node/> + <location>Hello_Receiver_svnt</location> + <execParameter> + <name>entryPoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Hello_AMI_ReceiverHome_Servant</string> + </value> + </value> + </execParameter> + </artifact> + + <artifact xmi:id="Hello_Receiver_ExecArtifact"> + <name>Hello.ImplementationArtifacts.ReceiverArtifacts.Receiver_exec</name> + <source/> + <node/> + <location>Hello_Receiver_exec</location> + <execParameter> + <name>entryPoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Hello_AMI_ReceiverHome_Impl</string> + </value> + </value> + </execParameter> + </artifact> + + <artifact xmi:id="Hello_Sender_SvntArtifact"> + <name>Hello.ImplementationArtifacts.SenderArtifacts.Sender_svnt</name> + <source/> + <node/> + <location>Hello_Sender_svnt</location> + <execParameter> + <name>entryPoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Hello_AMI_SenderHome_Servant</string> + </value> + </value> + </execParameter> + </artifact> + + <artifact xmi:id="Hello_Sender_ExecArtifact"> + <name>Hello.ImplementationArtifacts.SenderArtifacts.Sender_exec</name> + <source/> + <node/> + <location>Hello_Sender_exec</location> + <execParameter> + <name>entryPoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Hello_AMI_SenderHome_Impl</string> + </value> + </value> + </execParameter> + </artifact> + +</Deployment:DeploymentPlan> diff --git a/CIAO/examples/Hello/descriptors/run_test.pl b/CIAO/examples/Hello/descriptors/run_test.pl new file mode 100755 index 00000000000..e1ac985ad30 --- /dev/null +++ b/CIAO/examples/Hello/descriptors/run_test.pl @@ -0,0 +1,260 @@ +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 = ( 60000, 60001 ); +@iorbases = ( "Sender.ior", "Receiver.ior"); +@iorfiles = 0; +@nodenames = ( "Sender", "Receiver" ); + +# 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 (); + +if ($#ARGV == -1) { + opendir(DIR, "."); + @files = grep(/\.cdp$/,readdir(DIR)); + closedir(DIR); +} +else { + @files = @ARGV; +} + +foreach $file (@files) { + print "=============================\nStarting test for deployment $file\n================================\n"; + + # Invoke naming service + + $NS = $tg_naming->CreateProcess ("$TAO_ROOT/orbsvcs/Naming_Service/tao_cosnaming", " -ORBEndpoint iiop://localhost:60003 -o $ior_nsfile"); + + print STDERR "Starting Naming Service with -ORBEndpoint iiop://localhost:60003 -o ns.ior\n"; + + $ns_status = $NS->Spawn (); + + if ($ns_status != 0) { + print STDERR "ERROR: Unable to execute the naming service\n"; + kill_open_processes (); + exit 1; + } + + 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 $file -k file://$ior_emfile\n"; + $E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-x $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 90 seconds to allow task to complete\n"; + sleep (90); + + # 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 $file\n"; + + $E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-k file://$ior_emfile -x $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 (); + # Sleep for a couple seconds to make sure everything has a chance to shut down. + sleep 5; +} +print "Executor returned.\n"; +print "Shutting down rest of the processes.\n"; + +delete_ior_files (); +kill_open_processes (); + +exit $status; |