diff options
Diffstat (limited to 'modules/CIAO/examples/Hello')
33 files changed, 3607 insertions, 0 deletions
diff --git a/modules/CIAO/examples/Hello/Hello_Base/Hello_Base.idl b/modules/CIAO/examples/Hello/Hello_Base/Hello_Base.idl new file mode 100644 index 00000000000..18b300932ee --- /dev/null +++ b/modules/CIAO/examples/Hello/Hello_Base/Hello_Base.idl @@ -0,0 +1,21 @@ +//$Id$: + +#ifndef CIAO_HELLO_IDL +#define CIAO_HELLO_IDL + +#include <Components.idl> + +module Hello +{ + interface ReadMessage + { + string get_message(); + }; + + eventtype TimeOut + { + public string data; + }; +}; + +#endif /* CIAO_HELLO_IDL */ diff --git a/modules/CIAO/examples/Hello/Hello_Base/Hello_Base.mpc b/modules/CIAO/examples/Hello/Hello_Base/Hello_Base.mpc new file mode 100644 index 00000000000..e945af42a14 --- /dev/null +++ b/modules/CIAO/examples/Hello/Hello_Base/Hello_Base.mpc @@ -0,0 +1,66 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -n Hello_Base" + +project(Hello_Base_idl_gen) : ciaoidldefaults, anytypecode { + custom_only = 1 + idlflags += -Wb,stub_export_macro=HELLO_BASE_STUB_Export \ + -Wb,stub_export_include=Hello_Base_stub_export.h \ + -Wb,skel_export_macro=HELLO_BASE_SKEL_Export \ + -Wb,skel_export_include=Hello_Base_skel_export.h + + IDL_Files { + Hello_Base.idl + } +} + +project(Hello_Base_stub) : ccm_stub { + after += Hello_Base_idl_gen + libout = ../lib + sharedname = Hello_Base_stub + dynamicflags = HELLO_BASE_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Hello_BaseC.cpp + } + + Header_Files { + Hello_BaseC.h + Hello_Base_stub_export.h + } + + Inline_Files { + Hello_BaseC.inl + } +} + + +project(Hello_Base_skel) : ccm_svnt { + after += Hello_Base_stub + sharedname = Hello_Base_skel + libs += Hello_Base_stub + libout = ../lib + libpaths += ../lib + + dynamicflags = HELLO_BASE_SKEL_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Hello_BaseS.cpp + } + + Header_Files { + Hello_BaseS.h + Hello_Base_skel_export.h + } + + Inline_Files { + Hello_BaseS.inl + } +} + + diff --git a/modules/CIAO/examples/Hello/Hello_Base/Hello_Base_skel_export.h b/modules/CIAO/examples/Hello/Hello_Base/Hello_Base_skel_export.h new file mode 100644 index 00000000000..f1a43a7ff9e --- /dev/null +++ b/modules/CIAO/examples/Hello/Hello_Base/Hello_Base_skel_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl HELLO_BASE_SKEL +// ------------------------------ +#ifndef HELLO_BASE_SKEL_EXPORT_H +#define HELLO_BASE_SKEL_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (HELLO_BASE_SKEL_HAS_DLL) +# define HELLO_BASE_SKEL_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && HELLO_BASE_SKEL_HAS_DLL */ + +#if !defined (HELLO_BASE_SKEL_HAS_DLL) +# define HELLO_BASE_SKEL_HAS_DLL 1 +#endif /* ! HELLO_BASE_SKEL_HAS_DLL */ + +#if defined (HELLO_BASE_SKEL_HAS_DLL) && (HELLO_BASE_SKEL_HAS_DLL == 1) +# if defined (HELLO_BASE_SKEL_BUILD_DLL) +# define HELLO_BASE_SKEL_Export ACE_Proper_Export_Flag +# define HELLO_BASE_SKEL_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define HELLO_BASE_SKEL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* HELLO_BASE_SKEL_BUILD_DLL */ +# define HELLO_BASE_SKEL_Export ACE_Proper_Import_Flag +# define HELLO_BASE_SKEL_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define HELLO_BASE_SKEL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* HELLO_BASE_SKEL_BUILD_DLL */ +#else /* HELLO_BASE_SKEL_HAS_DLL == 1 */ +# define HELLO_BASE_SKEL_Export +# define HELLO_BASE_SKEL_SINGLETON_DECLARATION(T) +# define HELLO_BASE_SKEL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* HELLO_BASE_SKEL_HAS_DLL == 1 */ + +// Set HELLO_BASE_SKEL_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (HELLO_BASE_SKEL_NTRACE) +# if (ACE_NTRACE == 1) +# define HELLO_BASE_SKEL_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define HELLO_BASE_SKEL_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !HELLO_BASE_SKEL_NTRACE */ + +#if (HELLO_BASE_SKEL_NTRACE == 1) +# define HELLO_BASE_SKEL_TRACE(X) +#else /* (HELLO_BASE_SKEL_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define HELLO_BASE_SKEL_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (HELLO_BASE_SKEL_NTRACE == 1) */ + +#endif /* HELLO_BASE_SKEL_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/examples/Hello/Hello_Base/Hello_Base_stub_export.h b/modules/CIAO/examples/Hello/Hello_Base/Hello_Base_stub_export.h new file mode 100644 index 00000000000..b7a3ee2c879 --- /dev/null +++ b/modules/CIAO/examples/Hello/Hello_Base/Hello_Base_stub_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl HELLO_BASE_STUB +// ------------------------------ +#ifndef HELLO_BASE_STUB_EXPORT_H +#define HELLO_BASE_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (HELLO_BASE_STUB_HAS_DLL) +# define HELLO_BASE_STUB_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && HELLO_BASE_STUB_HAS_DLL */ + +#if !defined (HELLO_BASE_STUB_HAS_DLL) +# define HELLO_BASE_STUB_HAS_DLL 1 +#endif /* ! HELLO_BASE_STUB_HAS_DLL */ + +#if defined (HELLO_BASE_STUB_HAS_DLL) && (HELLO_BASE_STUB_HAS_DLL == 1) +# if defined (HELLO_BASE_STUB_BUILD_DLL) +# define HELLO_BASE_STUB_Export ACE_Proper_Export_Flag +# define HELLO_BASE_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define HELLO_BASE_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* HELLO_BASE_STUB_BUILD_DLL */ +# define HELLO_BASE_STUB_Export ACE_Proper_Import_Flag +# define HELLO_BASE_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define HELLO_BASE_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* HELLO_BASE_STUB_BUILD_DLL */ +#else /* HELLO_BASE_STUB_HAS_DLL == 1 */ +# define HELLO_BASE_STUB_Export +# define HELLO_BASE_STUB_SINGLETON_DECLARATION(T) +# define HELLO_BASE_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* HELLO_BASE_STUB_HAS_DLL == 1 */ + +// Set HELLO_BASE_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (HELLO_BASE_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define HELLO_BASE_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define HELLO_BASE_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !HELLO_BASE_STUB_NTRACE */ + +#if (HELLO_BASE_STUB_NTRACE == 1) +# define HELLO_BASE_STUB_TRACE(X) +#else /* (HELLO_BASE_STUB_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define HELLO_BASE_STUB_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (HELLO_BASE_STUB_NTRACE == 1) */ + +#endif /* HELLO_BASE_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/examples/Hello/Receiver/Receiver.idl b/modules/CIAO/examples/Hello/Receiver/Receiver.idl new file mode 100644 index 00000000000..909b93a8081 --- /dev/null +++ b/modules/CIAO/examples/Hello/Receiver/Receiver.idl @@ -0,0 +1,20 @@ +//$Id$: + +#ifndef RECEIVER_IDL +#define RECEIVER_IDL + +#include "../Hello_Base/Hello_Base.idl" + +module Hello +{ + component Receiver + { + uses ReadMessage read_message; + consumes TimeOut click_in; + }; + + home ReceiverHome manages Receiver + { + }; +}; +#endif /*RECEIVER_IDL*/ diff --git a/modules/CIAO/examples/Hello/Receiver/Receiver.mpc b/modules/CIAO/examples/Hello/Receiver/Receiver.mpc new file mode 100644 index 00000000000..643ac2445f9 --- /dev/null +++ b/modules/CIAO/examples/Hello/Receiver/Receiver.mpc @@ -0,0 +1,117 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl Receiver" + +project(Hello_Receiver_idl_gen) : componentidldefaults { + 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 \ + -Gxhst -Gxhsv -Gxhex + + IDL_Files { + Receiver.idl + } +} + +project(Hello_Receiver_lem_gen) : ciaoidldefaults { + custom_only = 1 + after += Hello_Receiver_idl_gen + idlflags += -Wb,export_macro=RECEIVER_EXEC_Export \ + -Wb,export_include=Receiver_exec_export.h \ + -SS + + IDL_Files { + ReceiverE.idl + } +} + +project(Hello_Receiver_stub) : ccm_stub { + after += Hello_Receiver_idl_gen Hello_Base_stub + libs += Hello_Base_stub + libout = ../lib + libpaths += ../lib + + sharedname = Hello_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(Hello_Receiver_exec) : ciao_executor { + after += Hello_Receiver_lem_gen Hello_Receiver_stub + sharedname = Hello_Receiver_exec + libs += Hello_Receiver_stub Hello_Base_stub + libout = ../lib + libpaths += ../lib + + dynamicflags = RECEIVER_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + ReceiverEC.cpp + Receiver_exec.cpp + } + + Header_Files { + ReceiverEC.h + Receiver_exec.h + Receiver_exec_export.h + } + + Inline_Files { + ReceiverEC.inl + } +} + + +project(Hello_Receiver_svnt) : ciao_servant { + after += Hello_Base_skel Hello_Receiver_exec + sharedname = Hello_Receiver_svnt + libs += Hello_Receiver_exec \ + Hello_Receiver_stub \ + Hello_Base_skel \ + Hello_Base_stub + libout = ../lib + libpaths += ../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/modules/CIAO/examples/Hello/Receiver/Receiver_exec.cpp b/modules/CIAO/examples/Hello/Receiver/Receiver_exec.cpp new file mode 100644 index 00000000000..7b3c7203899 --- /dev/null +++ b/modules/CIAO/examples/Hello/Receiver/Receiver_exec.cpp @@ -0,0 +1,132 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.dre.vanderbilt.edu/CIAO + +#include "Receiver_exec.h" +#include "ciao/CIAO_common.h" + +namespace CIAO_Hello_Receiver_Impl +{ + Receiver_exec_i::Receiver_exec_i () + { + } + + Receiver_exec_i::~Receiver_exec_i () + { + } + + void + Receiver_exec_i::push_click_in (::Hello::TimeOut * ev) + { + //Get the message from the Sender first. + ACE_DEBUG ((LM_DEBUG, + "Receiver - Informed by the Sender with message [%C]\n", + ev->data ())); + + Hello::ReadMessage_var rev + = this->context_->get_connection_read_message(); + + if (CORBA::is_nil (rev.in ())) + throw CORBA::BAD_INV_ORDER (); + + CORBA::String_var str = rev->get_message (); + + ACE_DEBUG ((LM_DEBUG, + "Receiver - Got message from the server [%C]\n", + str.in () )); + } + + // Operations from Components::SessionComponen + void + Receiver_exec_i::set_session_context (::Components::SessionContext_ptr ctx) + { + ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::set_session_context\n")); + + this->context_ = + ::Hello::CCM_Receiver_Context::_narrow (ctx); + + if (CORBA::is_nil (this->context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + Receiver_exec_i::configuration_complete () + { + ACE_DEBUG ((LM_DEBUG, + "Receiver_exec_i::configuration_complete\n")); + } + + void + Receiver_exec_i::ccm_activate () + { + ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::ccm_activate\n")); + } + + void + Receiver_exec_i::ccm_passivate () + { + ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::ccm_passivate\n")); + } + + void + Receiver_exec_i::ccm_remove () + { + ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::ccm_remove\n")); + } + + + ReceiverHome_exec_i::ReceiverHome_exec_i () + { + } + + ReceiverHome_exec_i::~ReceiverHome_exec_i () + { + } + + ::Components::EnterpriseComponent_ptr + ReceiverHome_exec_i::create () + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_THROW_EX ( + retval, + Receiver_exec_i, + ::CORBA::NO_MEMORY ()); + + return retval; + } + + extern "C" RECEIVER_EXEC_Export ::Components::HomeExecutorBase_ptr + create_Hello_ReceiverHome_Impl (void) + { + ::Components::HomeExecutorBase_ptr retval = + ::Components::HomeExecutorBase::_nil (); + + ACE_NEW_RETURN ( + retval, + ReceiverHome_exec_i, + ::Components::HomeExecutorBase::_nil ()); + + return retval; + } +} + diff --git a/modules/CIAO/examples/Hello/Receiver/Receiver_exec.h b/modules/CIAO/examples/Hello/Receiver/Receiver_exec.h new file mode 100644 index 00000000000..32dd156e018 --- /dev/null +++ b/modules/CIAO/examples/Hello/Receiver/Receiver_exec.h @@ -0,0 +1,108 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.dre.vanderbilt.edu/CIAO + +#ifndef CIAO_RECEIVER_EXEC_H +#define CIAO_RECEIVER_EXEC_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" + +namespace CIAO_Hello_Receiver_Impl +{ + /** + * @class Receiver_exec_i + * + * Receiver executor implementation class. + */ + class RECEIVER_EXEC_Export Receiver_exec_i + : public virtual Receiver_Exec, + public virtual ::CORBA::LocalObject + { + + public: + /// Default constructor. + Receiver_exec_i (); + + /// Default destructor. + ~Receiver_exec_i (); + + // Operation which will be called upon receiving the timeout event. + virtual void + push_click_in (::Hello::TimeOut *ev); + + // Operations from Components::SessionComponent + virtual void set_session_context (::Components::SessionContext_ptr ctx); + + virtual void configuration_complete (); + + virtual void ccm_activate (); + virtual void ccm_passivate (); + virtual void ccm_remove (); + + protected: + /// Copmponent specific context + ::Hello::CCM_Receiver_Context_var context_; + + private: + CORBA::String_var message_; + }; + + /** + * @class ReceiverHome_exec_i + * + * Receiver home executor implementation class. + */ + class RECEIVER_EXEC_Export ReceiverHome_exec_i + : public virtual ReceiverHome_Exec, + public virtual ::CORBA::LocalObject + { + public: + ReceiverHome_exec_i (void); + virtual ~ReceiverHome_exec_i (void); + + // Supported or inherited operations. + + // Home operations. + + // Factory and finder operations. + + // Attribute operations. + + // Implicit operations. + + virtual ::Components::EnterpriseComponent_ptr + create (); + }; + + extern "C" RECEIVER_EXEC_Export ::Components::HomeExecutorBase_ptr + create_Hello_ReceiverHome_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_RECEIVER_EXEC_H */ diff --git a/modules/CIAO/examples/Hello/Sender/Sender.idl b/modules/CIAO/examples/Hello/Sender/Sender.idl new file mode 100644 index 00000000000..978f08d7559 --- /dev/null +++ b/modules/CIAO/examples/Hello/Sender/Sender.idl @@ -0,0 +1,43 @@ +//$Id$ + +#ifndef SENDER_IDL +#define SENDER_IDL + + +#include "../Hello_Base/Hello_Base.idl" + +module Hello +{ + /* This is a Sender specific interface which will be used to get the + * process start. + */ + + interface trigger + { + void start (); + }; + + enum COLOR_SELECTION + { + empty, + white, + red, + yellow + }; + + component Sender supports trigger + { + provides ReadMessage push_message; + publishes TimeOut click_out; + attribute string local_message; + readonly attribute long hertz; + + // A test attribute to test setting attributes through XML + attribute COLOR_SELECTION color; + }; + + home SenderHome manages Sender + { + }; +}; +#endif /*SENDER_IDL*/ diff --git a/modules/CIAO/examples/Hello/Sender/Sender.mpc b/modules/CIAO/examples/Hello/Sender/Sender.mpc new file mode 100644 index 00000000000..341eaa1ef96 --- /dev/null +++ b/modules/CIAO/examples/Hello/Sender/Sender.mpc @@ -0,0 +1,138 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p Hello_Base -u Hello -c starter Sender" + +project(Hello_Sender_idl_gen) : componentidldefaults { + 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 + + IDL_Files { + Sender.idl + } +} + +project(Hello_Sender_lem_gen) : ciaoidldefaults { + after += Hello_Sender_idl_gen + custom_only = 1 + idlflags += -Wb,export_macro=SENDER_EXEC_Export \ + -Wb,export_include=Sender_exec_export.h \ + -SS + + IDL_Files { + SenderE.idl + } +} + +project(Hello_Sender_stub) : ccm_stub { + after += Hello_Sender_idl_gen Hello_Base_stub + libs += Hello_Base_stub + libout = ../lib + libpaths += ../lib + + sharedname = Hello_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(Hello_Sender_exec) : ciao_executor { + after += Hello_Sender_lem_gen Hello_Sender_stub + sharedname = Hello_Sender_exec + libs += Hello_Sender_stub Hello_Base_stub + libout = ../lib + libpaths += ../lib + + dynamicflags = SENDER_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SenderEC.cpp + Sender_exec.cpp + } + + Header_Files { + SenderEC.h + Sender_exec.h + Sender_exec_export.h + } + + Inline_Files { + SenderEC.inl + } +} + + +project(Hello_Sender_svnt) : ciao_servant { + after += Hello_Base_skel Hello_Sender_exec + sharedname = Hello_Sender_svnt + libs += Hello_Sender_exec \ + Hello_Sender_stub \ + Hello_Base_skel \ + Hello_Base_stub + libout = ../lib + libpaths += ../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 + } +} + +project (Hello_starter) : ccm_stub, valuetype { + exename = starter + after += Hello_Sender_stub + libs += Hello_Sender_stub Hello_Base_stub + libout = ../lib + libpaths += ../lib + + IDL_Files { + } + + Source_Files { + starter.cpp + } + + Header_Files { + } + + Inline_Files { + } +} + diff --git a/modules/CIAO/examples/Hello/Sender/Sender_exec.cpp b/modules/CIAO/examples/Hello/Sender/Sender_exec.cpp new file mode 100644 index 00000000000..eab8e47d31a --- /dev/null +++ b/modules/CIAO/examples/Hello/Sender/Sender_exec.cpp @@ -0,0 +1,195 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.dre.vanderbilt.edu/CIAO + +#include "Sender_exec.h" +#include "ciao/CIAO_common.h" + +namespace CIAO_Hello_Sender_Impl +{ + char* + Message_Impl::get_message () + { + ACE_DEBUG ((LM_EMERGENCY, "Sender sending out message: [%C]\n", component_.message_.in ())); + return CORBA::string_dup (component_.message_.in ()); + } + + Sender_exec_i::~Sender_exec_i () + { + } + + void + Sender_exec_i::local_message (const char * local_message) + { + message_ = CORBA::string_dup (local_message); + } + + char * + Sender_exec_i::local_message () + { + return CORBA::string_dup (message_.in ()); + } + + void + Sender_exec_i::hertz (CORBA::Long hertz) + { + this->hertz_ = hertz; + ACE_DEBUG ((LM_EMERGENCY, "Sender_exec_i::Hertz:%d\n", this->hertz_)); + } + + CORBA::Long + Sender_exec_i::hertz () + { + return this->hertz_; + } + + ::Hello::COLOR_SELECTION + Sender_exec_i::color () + { + // Your code here. + return this->color_; + } + + void + Sender_exec_i::color (::Hello::COLOR_SELECTION color) + { + this->color_ = color; + } + + Hello::CCM_ReadMessage_ptr + Sender_exec_i::get_push_message () + { + ACE_DEBUG ((LM_EMERGENCY, + "Sender_exec.i::get_push_message called\n")); + return ( new Message_Impl (*this) ); + } + + void + Sender_exec_i::start () + { + Hello::TimeOut_var event = new OBV_Hello::TimeOut; + event->data ("ACE/TAO/CIAO"); + ACE_DEBUG ((LM_EMERGENCY, "Sender initiates the process.\n")); + this->context_->push_click_out (event.in ()); + + ACE_DEBUG ((LM_EMERGENCY, "My current color is:")); + + switch (this->color_) + { + case ::Hello::empty: + ACE_DEBUG ((LM_EMERGENCY, "ERROR: Enum attribute initialization failed.\n")); + break; + + case ::Hello::white: + ACE_DEBUG ((LM_EMERGENCY, "white\n")); + break; + + case ::Hello::red: + ACE_DEBUG ((LM_EMERGENCY, "red\n")); + break; + + case ::Hello::yellow: + ACE_DEBUG ((LM_EMERGENCY, "yellow\n")); + break; + + default: + ACE_DEBUG ((LM_EMERGENCY, "Unknown color!\n")); + + } + } + + void + Sender_exec_i::set_session_context (::Components::SessionContext_ptr ctx) + { + ACE_DEBUG ((LM_EMERGENCY, "Sender_exec_i::set_session_context\n")); + + this->context_ = + ::Hello::CCM_Sender_Context::_narrow (ctx); + + if (CORBA::is_nil (this->context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + Sender_exec_i::configuration_complete () + { + ACE_DEBUG ((LM_EMERGENCY, + "Sender_exec_i::configuration_complete\n")); + } + + void + Sender_exec_i::ccm_activate () + { + ACE_DEBUG ((LM_EMERGENCY, + "Sender_exec_i::ccm_activate\n")); + } + + void + Sender_exec_i::ccm_passivate () + { + ACE_DEBUG ((LM_EMERGENCY, "Sender_exec_i::ccm_passivate\n")); + } + + void + Sender_exec_i::ccm_remove () + { + ACE_DEBUG ((LM_EMERGENCY, "Sender_exec_i::ccm_remove\n")); + } + + SenderHome_exec_i::SenderHome_exec_i () + { + } + + SenderHome_exec_i::~SenderHome_exec_i () + { + } + + ::Components::EnterpriseComponent_ptr + SenderHome_exec_i::create () + { + ACE_DEBUG ((LM_EMERGENCY, "(%P|%t) creating SenderHome\n")); + + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_THROW_EX ( + retval, + Sender_exec_i, + ::CORBA::NO_MEMORY ()); + + return retval; + } + + extern "C" SENDER_EXEC_Export ::Components::HomeExecutorBase_ptr + create_Hello_SenderHome_Impl (void) + { + ::Components::HomeExecutorBase_ptr retval = + ::Components::HomeExecutorBase::_nil (); + + ACE_NEW_RETURN ( + retval, + SenderHome_exec_i, + ::Components::HomeExecutorBase::_nil ()); + + return retval; + } +} + diff --git a/modules/CIAO/examples/Hello/Sender/Sender_exec.h b/modules/CIAO/examples/Hello/Sender/Sender_exec.h new file mode 100644 index 00000000000..14a2ea598ec --- /dev/null +++ b/modules/CIAO/examples/Hello/Sender/Sender_exec.h @@ -0,0 +1,176 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.dre.vanderbilt.edu/CIAO + +#ifndef CIAO_SENDER_EXEC_H +#define CIAO_SENDER_EXEC_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" + +namespace CIAO_Hello_Sender_Impl +{ + /** + * @class Sender_exec_i + * + * Sender executor implementation class. + */ + class SENDER_EXEC_Export Sender_exec_i + : public virtual Sender_Exec, + public virtual ::CORBA::LocalObject + { + + public: + /// Default constructor. + Sender_exec_i () + : message_(CORBA::string_dup ("Default Message")), + color_ (::Hello::empty) + { + } + + /// Secondary construction. + Sender_exec_i (const char* local_message) + : message_ (CORBA::string_dup (local_message)), + color_ (::Hello::empty) + { + } + + /// Default destructor. + virtual ~Sender_exec_i (); + + /// Operation to set the value of the attribute "local_message" + virtual void local_message (const char * local_message); + + /// Operation to get the value of the attribute "local_message" + virtual char * local_message (); + + /// Operation to set the value of the attribute "hertz" + virtual void hertz (CORBA::Long hertz); + + /// Operation to get the value of the attribute "hertz" + virtual CORBA::Long hertz (); + + /* Operations for obtaining the interface reference. */ + /* This method will be used in the assembly face so the + * ObjRef of this read_message facet will be sent to the + * client side(receptacle). + */ + // Note: You can specify the return type as ::Hello::CCM_message * + virtual ::Hello::CCM_ReadMessage_ptr + get_push_message (); + + virtual ::Hello::COLOR_SELECTION + color (); + + virtual void + color (::Hello::COLOR_SELECTION); + + // Operation inside of the trigger interface. + virtual void start (); + + // Operations from Components::SessionComponent + virtual void set_session_context (::Components::SessionContext_ptr ctx); + + virtual void configuration_complete (); + + virtual void ccm_activate (); + + virtual void ccm_passivate (); + + virtual void ccm_remove (); + + protected: + /// Copmponent specific context + ::Hello::CCM_Sender_Context_var context_; + + private: + CORBA::String_var message_; + + CORBA::Long hertz_; + + ::Hello::COLOR_SELECTION color_; + + friend class Message_Impl; + }; + + + // + // + // + class Message_Impl : public virtual Hello::CCM_ReadMessage, + public virtual ::CORBA::LocalObject + { + public: + Message_Impl (Sender_exec_i& component) + : component_ (component) + { + } + + virtual char * + get_message (); + + private: + Sender_exec_i& component_; + }; + + /** + * @class SenderHome_exec_i + * + * Sender home executor implementation class. + */ + class SENDER_EXEC_Export SenderHome_exec_i + : public virtual SenderHome_Exec, + public virtual ::CORBA::LocalObject + { + public: + SenderHome_exec_i (void); + virtual ~SenderHome_exec_i (void); + + // Supported or inherited operations. + + // Home operations. + + // Factory and finder operations. + + // Attribute operations. + + // Implicit operations. + + virtual ::Components::EnterpriseComponent_ptr + create (); + }; + + extern "C" SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_Hello_Sender_Impl (void); + + extern "C" SENDER_EXEC_Export ::Components::HomeExecutorBase_ptr + create_Hello_SenderHome_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_SENDER_EXEC_H */ diff --git a/modules/CIAO/examples/Hello/Sender/starter.cpp b/modules/CIAO/examples/Hello/Sender/starter.cpp new file mode 100644 index 00000000000..4a1c04fbe9a --- /dev/null +++ b/modules/CIAO/examples/Hello/Sender/starter.cpp @@ -0,0 +1,88 @@ +//$Id$: + +#include "SenderC.h" +#include "ace/Get_Opt.h" + +// IOR file of the Sender +const ACE_TCHAR * ior = 0; +const char * message = 0; + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:m:")); + int c = 0; + + while ((c = get_opts ()) != -1) + { + switch (c) + { + case 'k': + ior = get_opts.opt_arg (); + break; + + case 'm': + message = ACE_TEXT_ALWAYS_CHAR(get_opts.opt_arg ()); + break; + + case '?': // display help for use of the server. + default: + ACE_ERROR_RETURN ((LM_ERROR, + "Usage: %s\n" + "-k <Sender IOR> (default is file://Sender.ior)\n", + "-m <Message>\n", + argv [0]), + -1); + break; + } + } + + if (ior == 0) + { + ior = ACE_TEXT("file://Sender.ior"); + } + + return 0; +} + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + try + { + // Initialize orb + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + + if (parse_args (argc, argv) != 0) + { + return -1; + } + + CORBA::Object_var obj = orb->string_to_object (ior); + + Hello::Sender_var sender = Hello::Sender::_narrow (obj.in ()); + + if (CORBA::is_nil (sender.in ())) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to acquire Sender's objref\n"), + -1); + } + + if (message) + { + sender->local_message (message); + } + + sender->start (); + + orb->destroy (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Unknown exception\n"); + return -1; + } + + return 0; +} diff --git a/modules/CIAO/examples/Hello/descriptors/Aliased_Map.dat b/modules/CIAO/examples/Hello/descriptors/Aliased_Map.dat new file mode 100644 index 00000000000..30e6930c2a3 --- /dev/null +++ b/modules/CIAO/examples/Hello/descriptors/Aliased_Map.dat @@ -0,0 +1,2 @@ +SenderNode corbaloc:iiop:localhost:60001/Alias.NodeManager +ReceiverNode corbaloc:iiop:localhost:60001/Alias.NodeManager
\ No newline at end of file diff --git a/modules/CIAO/examples/Hello/descriptors/DeploymentPlan.cdp b/modules/CIAO/examples/Hello/descriptors/DeploymentPlan.cdp new file mode 100644 index 00000000000..fb0bf963c32 --- /dev/null +++ b/modules/CIAO/examples/Hello/descriptors/DeploymentPlan.cdp @@ -0,0 +1,361 @@ +<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>Hello_Deployment_1</label> + <UUID>Hello_Deployment_1</UUID> + + <!-- Implementations declarations --> + + <!-- Home implementation --> + <implementation xmi:id="Hello_ReceiverHomeImplementation"> + <name>Hello_ReceiverHomeImplementation</name> + <source/> + <artifact xmi:idref="Hello_Receiver_ExecArtifact" /> + <artifact xmi:idref="Hello_Receiver_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Hello_ReceiverHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Hello_ReceiverHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Hello_Receiver_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Hello_Receiver_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="Hello_ReceiverComponentImplementation"> + <name>Hello_ReceiverComponentImplementation</name> + <source/> + <artifact xmi:idref="Hello_Receiver_ExecArtifact" /> + <artifact xmi:idref="Hello_Receiver_SvntArtifact" /> + </implementation> + + <implementation xmi:id="Hello_SenderHomeImplementation"> + <name>Hello_SenderHomeImplementation</name> + <source/> + <artifact xmi:idref="Hello_Sender_ExecArtifact" /> + <artifact xmi:idref="Hello_Sender_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Hello_SenderHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Hello_SenderHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Hello_Sender_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Hello_Sender_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="Hello_SenderComponentImplementation"> + <name>Hello_SenderComponentImplementation</name> + <source/> + <artifact xmi:idref="Hello_Sender_ExecArtifact" /> + <artifact xmi:idref="Hello_Sender_SvntArtifact" /> + </implementation> + + <instance xmi:id="Hello_ReceiverHomeInstance"> + <name>Hello_ReceiverHome</name> + <node>ReceiverNode</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="Hello_ReceiverHomeImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ReceiverHome.ior</string> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.RegisterNaming</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ReceiverHome</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="Hello_ReceiverComponentInstance"> + <name>Hello_ReceiverComponent</name> + <node>ReceiverNode</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="Hello_ReceiverComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Hello_ReceiverHome</string> + </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> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.RegisterNaming</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Receiver</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="Hello_SenderHomeInstance"> + <name>Hello_SenderHome</name> + <node>SenderNode</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="Hello_SenderHomeImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SenderHome.ior</string> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.RegisterNaming</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SenderHome</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="Hello_SenderComponentInstance"> + <name>Hello_SenderComponent</name> + <node>SenderNode</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="Hello_SenderComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Hello_SenderHome</string> + </value> + </value> + </configProperty> + <configProperty> + <name>local_message</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>hello, world!</string> + </value> + </value> + </configProperty> + <configProperty> + <name>color</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>COLOR_SELECTION</name> + <typeId>IDL:Hello/COLOR_SELECTION:1.0</typeId> + <member>empty</member> + <member>white</member> + <member>red</member> + <member>yellow</member> + </enum> + </type> + <value> + <enum>yellow</enum> + </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> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.RegisterNaming</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Sender</string> + </value> + </value> + </configProperty> + </instance> + + <connection> + <name>MessageConnection</name> + <internalEndpoint> + <portName>read_message</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="Hello_ReceiverComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>push_message</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="Hello_SenderComponentInstance" /> + </internalEndpoint> + </connection> + + <connection> + <name>EventConnection</name> + <internalEndpoint> + <portName>click_out</portName> + <provider>false</provider> + <kind>EventPublisher</kind> + <instance xmi:idref="Hello_SenderComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>click_in</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance xmi:idref="Hello_ReceiverComponentInstance" /> + </internalEndpoint> + </connection> + + <!-- Artifacts declarations --> + <artifact xmi:id="Hello_Receiver_ExecArtifact"> + <name>Hello_Receiver_exec</name> + <source/> + <node/> + <location>Hello_Receiver_exec</location> + </artifact> + <artifact xmi:id="Hello_Receiver_SvntArtifact"> + <name>Hello_Receiver_svnt</name> + <source/> + <node/> + <location>Hello_Receiver_svnt</location> + </artifact> + + <artifact xmi:id="Hello_Sender_ExecArtifact"> + <name>Hello_Sender_exec</name> + <source/> + <node/> + <location>Hello_Sender_exec</location> + </artifact> + <artifact xmi:id="Hello_Sender_SvntArtifact"> + <name>Hello_Sender_svnt</name> + <source/> + <node/> + <location>Hello_Sender_svnt</location> + </artifact> + +</Deployment:DeploymentPlan> diff --git a/modules/CIAO/examples/Hello/descriptors/DeploymentPlan_without_ns.cdp b/modules/CIAO/examples/Hello/descriptors/DeploymentPlan_without_ns.cdp new file mode 100644 index 00000000000..6d5b3f05780 --- /dev/null +++ b/modules/CIAO/examples/Hello/descriptors/DeploymentPlan_without_ns.cdp @@ -0,0 +1,317 @@ +<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>Hello_Deployment_1</label> + <UUID>Hello_Deployment_1</UUID> + + <!-- Implementations declarations --> + + <!-- Home implementation --> + <implementation xmi:id="Hello_ReceiverHomeImplementation"> + <name>Hello_ReceiverHomeImplementation</name> + <source/> + <artifact xmi:idref="Hello_Receiver_ExecArtifact" /> + <artifact xmi:idref="Hello_Receiver_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Hello_ReceiverHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Hello_ReceiverHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Hello_Receiver_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Hello_Receiver_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="Hello_ReceiverComponentImplementation"> + <name>Hello_ReceiverComponentImplementation</name> + <source/> + <artifact xmi:idref="Hello_Receiver_ExecArtifact" /> + <artifact xmi:idref="Hello_Receiver_SvntArtifact" /> + </implementation> + + <implementation xmi:id="Hello_SenderHomeImplementation"> + <name>Hello_SenderHomeImplementation</name> + <source/> + <artifact xmi:idref="Hello_Sender_ExecArtifact" /> + <artifact xmi:idref="Hello_Sender_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Hello_SenderHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Hello_SenderHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Hello_Sender_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Hello_Sender_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="Hello_SenderComponentImplementation"> + <name>Hello_SenderComponentImplementation</name> + <source/> + <artifact xmi:idref="Hello_Sender_ExecArtifact" /> + <artifact xmi:idref="Hello_Sender_SvntArtifact" /> + </implementation> + + <instance xmi:id="Hello_ReceiverHomeInstance"> + <name>Hello_ReceiverHome</name> + <node>ReceiverNode</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="Hello_ReceiverHomeImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ReceiverHome.ior</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="Hello_ReceiverComponentInstance"> + <name>Hello_ReceiverComponent</name> + <node>ReceiverNode</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="Hello_ReceiverComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Hello_ReceiverHome</string> + </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="Hello_SenderHomeInstance"> + <name>Hello_SenderHome</name> + <node>SenderNode</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="Hello_SenderHomeImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SenderHome.ior</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="Hello_SenderComponentInstance"> + <name>Hello_SenderComponent</name> + <node>SenderNode</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="Hello_SenderComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Hello_SenderHome</string> + </value> + </value> + </configProperty> + <configProperty> + <name>local_message</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>hello, world!</string> + </value> + </value> + </configProperty> + <configProperty> + <name>color</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>COLOR_SELECTION</name> + <typeId>IDL:Hello/COLOR_SELECTION:1.0</typeId> + <member>empty</member> + <member>white</member> + <member>red</member> + <member>yellow</member> + </enum> + </type> + <value> + <enum>yellow</enum> + </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>MessageConnection</name> + <internalEndpoint> + <portName>read_message</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="Hello_ReceiverComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>push_message</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="Hello_SenderComponentInstance" /> + </internalEndpoint> + </connection> + + <connection> + <name>EventConnection</name> + <internalEndpoint> + <portName>click_out</portName> + <provider>false</provider> + <kind>EventPublisher</kind> + <instance xmi:idref="Hello_SenderComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>click_in</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance xmi:idref="Hello_ReceiverComponentInstance" /> + </internalEndpoint> + </connection> + + <!-- Artifacts declarations --> + <artifact xmi:id="Hello_Receiver_ExecArtifact"> + <name>Hello_Receiver_exec</name> + <source/> + <node/> + <location>Hello_Receiver_exec</location> + </artifact> + <artifact xmi:id="Hello_Receiver_SvntArtifact"> + <name>Hello_Receiver_svnt</name> + <source/> + <node/> + <location>Hello_Receiver_svnt</location> + </artifact> + + <artifact xmi:id="Hello_Sender_ExecArtifact"> + <name>Hello_Sender_exec</name> + <source/> + <node/> + <location>Hello_Sender_exec</location> + </artifact> + <artifact xmi:id="Hello_Sender_SvntArtifact"> + <name>Hello_Sender_svnt</name> + <source/> + <node/> + <location>Hello_Sender_svnt</location> + </artifact> + +</Deployment:DeploymentPlan> diff --git a/modules/CIAO/examples/Hello/descriptors/Domain.cdd b/modules/CIAO/examples/Hello/descriptors/Domain.cdd new file mode 100644 index 00000000000..882b29724cd --- /dev/null +++ b/modules/CIAO/examples/Hello/descriptors/Domain.cdd @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<Deployment:Domain + 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>Hello Domain</label> +<UUID>effd4bd0-6db0-4c50-9bb7-db9decebae1c</UUID> +<node> + <name>Sender</name> + <label>Sender's Node</label> +</node> +<node> + <name>Receiver</name> + <label>Receiver's Node</label> +</node> +</Deployment:Domain> diff --git a/modules/CIAO/examples/Hello/descriptors/Hello.pcd b/modules/CIAO/examples/Hello/descriptors/Hello.pcd new file mode 100644 index 00000000000..a0f5051444a --- /dev/null +++ b/modules/CIAO/examples/Hello/descriptors/Hello.pcd @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no" ?> +<Deployment:PackageConfiguration +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>Hello Example Configuration for Unix machines</label> + <UUID>559d65e8-0407-48c0-a158-dafe21360fef</UUID> + <basePackage href="Hello.cpd"/> +</Deployment:PackageConfiguration> diff --git a/modules/CIAO/examples/Hello/descriptors/NodeManagerMap.dat b/modules/CIAO/examples/Hello/descriptors/NodeManagerMap.dat new file mode 100644 index 00000000000..fb390806728 --- /dev/null +++ b/modules/CIAO/examples/Hello/descriptors/NodeManagerMap.dat @@ -0,0 +1,4 @@ +SenderNode corbaloc:iiop:localhost:60001/Sender.NodeManager + + +ReceiverNode corbaloc:iiop:localhost:60002/Receiver.NodeManager
\ No newline at end of file diff --git a/modules/CIAO/examples/Hello/descriptors/package.tpd b/modules/CIAO/examples/Hello/descriptors/package.tpd new file mode 100644 index 00000000000..d447a2abb4a --- /dev/null +++ b/modules/CIAO/examples/Hello/descriptors/package.tpd @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no" ?> +<Deployment:TopLevelPackageDescription +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"> + <package href="Hello.pcd"/> +</Deployment:TopLevelPackageDescription> diff --git a/modules/CIAO/examples/Hello/descriptors/run_NodeDaemons.pl b/modules/CIAO/examples/Hello/descriptors/run_NodeDaemons.pl new file mode 100755 index 00000000000..2baf6b0cb0b --- /dev/null +++ b/modules/CIAO/examples/Hello/descriptors/run_NodeDaemons.pl @@ -0,0 +1,43 @@ +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::Run_Test; + +$status = 0; +$iorfile1 = PerlACE::LocalFile ("NodeApp1.ior"); +$iorfile2 = PerlACE::LocalFile ("NodeApp2.ior"); + +#for ($iter = 0; $iter <= $#ARGV; $iter++) { +# if ($ARGV[$iter] eq "-h" || $ARGV[$iter] eq "-?") { +# print "Run_Test Perl script for NodeApplicationTest \n\n"; +# print "run_test \n"; +# print "\n"; +# print "-h -- prints this information\n"; +# exit 0; +# } +#} + + +unlink $iorfile1; +unlink $iorfile2; + +$CIAO_ROOT=$ENV{'CIAO_ROOT'}; +$DANCE_ROOT = "$ENV{'DANCE_ROOT'}"; + +PerlACE::add_lib_path ('../lib'); + +$SV1 = new PerlACE::Process ("$DANCE_ROOT/bin/dance_node_manager", + "-ORBEndpoint iiop://localhost:60001 -s $CIAO_ROOT/bin/ciao_componentserver -n Sender=NodeApp1.ior -t 30 --instance-nc corbaloc:rir:/NameService"); + +$SV2 = new PerlACE::Process ("$DANCE_ROOT/bin/dance_node_manager", + "-ORBEndpoint iiop://localhost:60002 -s $CIAO_ROOT/bin/ciao_componentserver -n Receiver=NodeApp2.ior -t 30 --instance-nc corbaloc:rir:/NameService"); + +$SV1->Spawn (); +$SV2->Spawn (); + +sleep (99999999999); diff --git a/modules/CIAO/examples/Hello/descriptors/run_test.pl b/modules/CIAO/examples/Hello/descriptors/run_test.pl new file mode 100755 index 00000000000..a34d57731eb --- /dev/null +++ b/modules/CIAO/examples/Hello/descriptors/run_test.pl @@ -0,0 +1,205 @@ +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::Run_Test; + +$CIAO_ROOT = "$ENV{'CIAO_ROOT'}"; +$TAO_ROOT = "$ENV{'TAO_ROOT'}"; +$DAnCE = "$ENV{'DANCE_ROOT'}"; + +$daemons_running = 0; +$em_running = 0; +$ns_running = 0; + +$daemons = 2; +@ports = ( 60001, 60002 ); +@iorfiles = ( "NodeApp1.ior", "NodeApp2.ior" ); +@nodenames = ( "Sender", "Receiver" ); + +$status = 0; +$dat_file = "NodeManagerMap.dat"; +$cdp_file = "DeploymentPlan.cdp"; + +$controller_exec = "$CIAO_ROOT/examples/Hello/Sender/starter"; + +$nsior = PerlACE::LocalFile ("ns.ior"); + +PerlACE::add_lib_path ('../lib'); + +unlink $nsior; + +$E = 0; +$EM = 0; + +# Delete if there are any .ior files. +sub delete_ior_files { + for ($i = 0; $i < $daemons; ++$i) { + unlink $iorfiles[$i]; + } + unlink PerlACE::LocalFile ("EM.ior"); + unlink PerlACE::LocalFile ("Receiver.ior"); + unlink PerlACE::LocalFile ("Sender.ior"); + unlink PerlACE::LocalFile ("DAM.ior"); + unlink PerlACE::LocalFile ("ns.ior"); +} + +sub kill_node_daemons { + for ($i = 0; $i < $daemons; ++$i) { + $Daemons[$i]->Kill (); $Daemons[$i]->TimedWait (1); + } +} + +sub kill_open_processes { + if ($daemons_running == 1) { + kill_node_daemons (); + } + + if ($em_running == 1) { + $EM->Kill (); + $EM->TimedWait (1); + } + + if ($ns_running == 1) { + $NS->Kill (); + $NS->TimedWait (1); + } + +} + +sub run_node_daemons { + for ($i = 0; $i < $daemons; ++$i) + { + $iorfile = $iorfiles[$i]; + $port = $ports[$i]; + $nodename = $nodenames[$i]; + $iiop = "iiop://localhost:$port"; + $node_app = "$CIAO_ROOT/bin/ciao_componentserver"; + + $d_cmd = "$DAnCE/bin/dance_node_manager"; + $d_param = "-ORBEndpoint $iiop -s $node_app -n $nodename=$iorfile -t 30 --instance-nc corbaloc:rir:/NameService"; + + print "Run dance_node_manager with $d_param\n"; + + $Daemons[$i] = new PerlACE::Process ($d_cmd, $d_param); + $result = $Daemons[$i]->Spawn (); + push(@processes, $Daemons[$i]); + + if (PerlACE::waitforfile_timed ($iorfile, + 30) == -1) { + print STDERR + "ERROR: The ior $iorfile file of node daemon $i could not be found\n"; + for (; $i >= 0; --$i) { + $Daemons[$i]->Kill (); $Daemons[$i]->TimedWait (1); + } + return -1; + } + } + return 0; +} + +delete_ior_files (); + +# Invoke naming service + +$NS = new PerlACE::Process ("$TAO_ROOT/orbsvcs/Naming_Service/Naming_Service", "-m 0 -ORBEndpoint iiop://localhost:60003 -o ns.ior"); + +$NS->Spawn (); + +print STDERR "Starting Naming Service with -m 0 -ORBEndpoint iiop://localhost:60003 -o ns.ior\n"; + +if (PerlACE::waitforfile_timed ($nsior, $PerlACE::wait_interval_for_process_creation) == -1) +{ + print STDERR "ERROR: cannot find naming service IOR file\n"; + $NS->Kill (); + exit 1; +} + +$ns_running = 1; + +# Set up NamingService environment +$ENV{"NameServiceIOR"} = "corbaloc:iiop:localhost:60003/NameService"; + + +# Invoke node daemons. +print "Invoking node daemons\n"; +$status = run_node_daemons (); + +if ($status != 0) { + print STDERR "ERROR: Unable to execute the node daemons\n"; + kill_open_processes (); + exit 1; +} + +$daemons_running = 1; + +# Invoke execution manager. +print "Invoking execution manager (dance_execution_manager.exe) with -eEM.ior --node-map $dat_file\n"; +$EM = new PerlACE::Process ("$DAnCE/bin/dance_execution_manager", + "-eEM.ior --node-map $dat_file"); +$EM->Spawn (); + +if (PerlACE::waitforfile_timed ("EM.ior", + $PerlACE::wait_interval_for_process_creation) == -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 - start the application -\n"; + +print "Start dance_plan_launcher.exe with -x DeploymentPlan.cdp -k file://EM.ior\n"; +$E = + new PerlACE::Process ("$DAnCE/bin/dance_plan_launcher", + "-x DeploymentPlan.cdp -k file://EM.ior"); + +$E->SpawnWaitKill (50); + +if (PerlACE::waitforfile_timed ( + "Receiver.ior", + $PerlACE::wait_interval_for_process_creation) == -1) { + print STDERR "ERROR: The ior file of receiver could not be found\n"; + kill_open_processes (); + exit 1; +} + +if (PerlACE::waitforfile_timed ("Sender.ior", + $PerlACE::wait_interval_for_process_creation) == -1) { + print STDERR "ERROR: The ior file of sender could not be found\n"; + kill_open_processes (); + exit 1; +} + +print "Invoking the controller ($controller_exec -k file://Sender.ior)\n"; +$controller = new PerlACE::Process ("$controller_exec", "-k file://Sender.ior"); +$result = $controller->SpawnWaitKill (30); + +if ($result != 0) { + print STDERR "ERROR: The controller returned $result\n"; + $status = 1; +} + +# Invoke executor - stop the application -. +print "Invoking executor - stop the application -\n"; +print "by running dance_plan_launcher.exe with -k file://EM.ior -x DeploymentPlan.cdp -q\n"; + +$E = + new PerlACE::Process ("$DAnCE/bin/dance_plan_launcher", + "-k file://EM.ior -x DeploymentPlan.cdp -q"); +$E->SpawnWaitKill (30); + +print "Executor returned.\n"; +print "Shutting down rest of the processes.\n"; + +delete_ior_files (); +kill_open_processes (); + +exit $status; diff --git a/modules/CIAO/examples/Hello/descriptors/run_test_alias.pl b/modules/CIAO/examples/Hello/descriptors/run_test_alias.pl new file mode 100755 index 00000000000..4d53ae417d4 --- /dev/null +++ b/modules/CIAO/examples/Hello/descriptors/run_test_alias.pl @@ -0,0 +1,195 @@ +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::Run_Test; + +$CIAO_ROOT = "$ENV{'CIAO_ROOT'}"; +$TAO_ROOT = "$ENV{'TAO_ROOT'}"; +$DAnCE = "$ENV{'DANCE_ROOT'}"; +$daemons_running = 0; +$em_running = 0; +$ns_running = 0; +$daemons = 1; +@ports = ( 60001 ); +@iorfiles = ( "NodeApp1.ior" ); +@nodenames = ( "Alias" ); +$status = 0; +$dat_file = "Aliased_Map.dat"; +$cdp_file = "DeploymentPlan.cdp"; +$controller_exec = "$CIAO_ROOT/examples/Hello/Sender/starter"; + +$nsior = PerlACE::LocalFile ("ns.ior"); + +PerlACE::add_lib_path ('../lib'); + +unlink $nsior; + +$E = 0; +$EM = 0; + +# Delete if there are any .ior files. +sub delete_ior_files { + for ($i = 0; $i < $daemons; ++$i) { + unlink $iorfiles[$i]; + } + unlink PerlACE::LocalFile ("EM.ior"); + unlink PerlACE::LocalFile ("Receiver.ior"); + unlink PerlACE::LocalFile ("Sender.ior"); + unlink PerlACE::LocalFile ("DAM.ior"); + unlink PerlACE::LocalFile ("ns.ior"); +} + +sub kill_node_daemons { + for ($i = 0; $i < $daemons; ++$i) { + $Daemons[$i]->Kill (); $Daemons[$i]->TimedWait (1); + } +} + +sub kill_open_processes { + if ($daemons_running == 1) { + kill_node_daemons (); + } + + if ($em_running == 1) { + $EM->Kill (); + $EM->TimedWait (1); + } + + if ($ns_running == 1) { + $NS->Kill (); + $NS->TimedWait (1); + } + +} + +sub run_node_daemons { + for ($i = 0; $i < $daemons; ++$i) + { + $iorfile = $iorfiles[$i]; + $port = $ports[$i]; + $nodename = $nodenames[$i]; + $iiop = "iiop://localhost:$port"; + $node_app = "$CIAO_ROOT/bin/ciao_componentserver"; + + $d_cmd = "$DAnCE/bin/dance_node_manager"; + $d_param = "-ORBEndpoint $iiop -s $node_app -n $nodename=$iorfile -t 30 --instance-nc corbaloc:rir:/NameService"; + + $Daemons[$i] = new PerlACE::Process ($d_cmd, $d_param); + $result = $Daemons[$i]->Spawn (); + push(@processes, $Daemons[$i]); + + if (PerlACE::waitforfile_timed ($iorfile, + 30) == -1) { + print STDERR + "ERROR: The ior $iorfile file of node daemon $i could not be found\n"; + for (; $i >= 0; --$i) { + $Daemons[$i]->Kill (); $Daemons[$i]->TimedWait (1); + } + return -1; + } + } + return 0; +} + +delete_ior_files (); + +# Invoke naming service + +$NS = new PerlACE::Process ("$TAO_ROOT/orbsvcs/Naming_Service/Naming_Service", "-m 0 -ORBEndpoint iiop://localhost:60003 -o ns.ior"); + +$NS->Spawn (); + +print STDERR "Starting Naming Service\n"; + +if (PerlACE::waitforfile_timed ($nsior, $PerlACE::wait_interval_for_process_creation) == -1) +{ + print STDERR "ERROR: cannot find naming service IOR file\n"; + $NS->Kill (); + exit 1; +} + +$ns_running = 1; + +# Set up NamingService environment +$ENV{"NameServiceIOR"} = "corbaloc:iiop:localhost:60003/NameService"; + + +# Invoke node daemons. +print "Invoking node daemons\n"; +$status = run_node_daemons (); + +if ($status != 0) { + print STDERR "ERROR: Unable to execute the node daemons\n"; + kill_open_processes (); + exit 1; +} + +$daemons_running = 1; + +# Invoke execution manager. +print "Invoking execution manager\n"; +$EM = new PerlACE::Process ("$DAnCE/bin/dance_execution_manager", + "-eEM.ior --node-map $dat_file"); +$EM->Spawn (); + +if (PerlACE::waitforfile_timed ("EM.ior", + $PerlACE::wait_interval_for_process_creation) == -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 - start the application -\n"; +$E = + new PerlACE::Process ("$DAnCE/bin/dance_plan_launcher", + "-x DeploymentPlan.cdp -k file://EM.ior"); + +$E->SpawnWaitKill (5000); + +if (PerlACE::waitforfile_timed ( + "Receiver.ior", + $PerlACE::wait_interval_for_process_creation) == -1) { + print STDERR "ERROR: The ior file of receiver could not be found\n"; + kill_open_processes (); + exit 1; +} + +if (PerlACE::waitforfile_timed ("Sender.ior", + $PerlACE::wait_interval_for_process_creation) == -1) { + print STDERR "ERROR: The ior file of sender could not be found\n"; + kill_open_processes (); + exit 1; +} + +print "Invoking the controller\n"; +$controller = new PerlACE::Process ("$controller_exec", "-k file://Sender.ior"); +$result = $controller->SpawnWaitKill (3000); + +if ($result != 0) { + print STDERR "ERROR: The controller returned $result\n"; + $status = 1; +} + +# Invoke executor - stop the application -. +print "Invoking executor - stop the application -\n"; +$E = + new PerlACE::Process ("$DAnCE/bin/dance_plan_launcher", + "-k file://EM.ior -x DeploymentPlan.cdp -q"); +$E->SpawnWaitKill (3000); + +print "Executor returned.\n"; +print "Shutting down rest of the processes.\n"; + +delete_ior_files (); +kill_open_processes (); + +exit $status; diff --git a/modules/CIAO/examples/Hello/descriptors/run_test_without_ns.pl b/modules/CIAO/examples/Hello/descriptors/run_test_without_ns.pl new file mode 100755 index 00000000000..f973c3837dc --- /dev/null +++ b/modules/CIAO/examples/Hello/descriptors/run_test_without_ns.pl @@ -0,0 +1,181 @@ +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::Run_Test; + +$CIAO_ROOT = "$ENV{'CIAO_ROOT'}"; +$TAO_ROOT = "$ENV{'TAO_ROOT'}"; +$DAnCE = "$ENV{'DANCE_ROOT'}"; + +$daemons_running = 0; +$em_running = 0; +$ns_running = 0; + +$daemons = 2; +@ports = ( 60001, 60002 ); +@iorfiles = ( "NodeApp1.ior", "NodeApp2.ior" ); +@nodenames = ( "Sender", "Receiver" ); + +$status = 0; +$dat_file = "NodeManagerMap.dat"; +$cdp_file = "DeploymentPlan_without_ns.cdp"; + +$controller_exec = "$CIAO_ROOT/examples/Hello/Sender/starter"; + +PerlACE::add_lib_path ('../lib'); + +unlink $nsior; + +$E = 0; +$EM = 0; + +# Delete if there are any .ior files. +sub delete_ior_files { + for ($i = 0; $i < $daemons; ++$i) { + unlink $iorfiles[$i]; + } + unlink PerlACE::LocalFile ("EM.ior"); + unlink PerlACE::LocalFile ("Receiver.ior"); + unlink PerlACE::LocalFile ("Sender.ior"); + unlink PerlACE::LocalFile ("DAM.ior"); +} + +sub kill_node_daemons { + for ($i = 0; $i < $daemons; ++$i) { + $Daemons[$i]->Kill (); $Daemons[$i]->TimedWait (1); + } +} + +sub kill_open_processes { + if ($daemons_running == 1) { + kill_node_daemons (); + } + + if ($em_running == 1) { + $EM->Kill (); + $EM->TimedWait (1); + } + + if ($ns_running == 1) { + $NS->Kill (); + $NS->TimedWait (1); + } + +} + +sub run_node_daemons { + for ($i = 0; $i < $daemons; ++$i) + { + $iorfile = $iorfiles[$i]; + $port = $ports[$i]; + $nodename = $nodenames[$i]; + $iiop = "iiop://localhost:$port"; + $node_app = "$CIAO_ROOT/bin/ciao_componentserver"; + + $d_cmd = "$DAnCE/bin/dance_node_manager"; + $d_param = "-ORBEndpoint $iiop -s $node_app -n $nodename=$iorfile -t 30"; + + print "Run dance_node_manager with $d_param\n"; + + $Daemons[$i] = new PerlACE::Process ($d_cmd, $d_param); + $result = $Daemons[$i]->Spawn (); + push(@processes, $Daemons[$i]); + + if (PerlACE::waitforfile_timed ($iorfile, + 30) == -1) { + print STDERR + "ERROR: The ior $iorfile file of node daemon $i could not be found\n"; + for (; $i >= 0; --$i) { + $Daemons[$i]->Kill (); $Daemons[$i]->TimedWait (1); + } + return -1; + } + } + return 0; +} + +delete_ior_files (); + +# Invoke node daemons. +print "Invoking node daemons\n"; +$status = run_node_daemons (); + +if ($status != 0) { + print STDERR "ERROR: Unable to execute the node daemons\n"; + kill_open_processes (); + exit 1; +} + +$daemons_running = 1; + +# Invoke execution manager. +print "Invoking execution manager (dance_execution_manager.exe) with -eEM.ior --node-map $dat_file\n"; +$EM = new PerlACE::Process ("$DAnCE/bin/dance_execution_manager", + "-eEM.ior --node-map $dat_file"); +$EM->Spawn (); + +if (PerlACE::waitforfile_timed ("EM.ior", + $PerlACE::wait_interval_for_process_creation) == -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 - start the application -\n"; + +print "Start dance_plan_launcher.exe with -x DeploymentPlan_without_ns.cdp -k file://EM.ior\n"; +$E = + new PerlACE::Process ("$DAnCE/bin/dance_plan_launcher", + "-x DeploymentPlan_without_ns.cdp -k file://EM.ior"); + +$E->SpawnWaitKill (5000); + +if (PerlACE::waitforfile_timed ( + "Receiver.ior", + $PerlACE::wait_interval_for_process_creation) == -1) { + print STDERR "ERROR: The ior file of receiver could not be found\n"; + kill_open_processes (); + exit 1; +} + +if (PerlACE::waitforfile_timed ("Sender.ior", + $PerlACE::wait_interval_for_process_creation) == -1) { + print STDERR "ERROR: The ior file of sender could not be found\n"; + kill_open_processes (); + exit 1; +} + +print "Invoking the controller ($controller_exec -k file://Sender.ior)\n"; +$controller = new PerlACE::Process ("$controller_exec", "-k file://Sender.ior"); +$result = $controller->SpawnWaitKill (3000); + +if ($result != 0) { + print STDERR "ERROR: The controller returned $result\n"; + $status = 1; +} + +# Invoke executor - stop the application -. +print "Invoking executor - stop the application -\n"; +print "by running dance_plan_launcher.exe with -k file://EM.ior -x DeploymentPlan.cdp -q\n"; + +$E = + new PerlACE::Process ("$DAnCE/bin/dance_plan_launcher", + "-k file://EM.ior -x DeploymentPlan.cdp -q"); +$E->SpawnWaitKill (3000); + +print "Executor returned.\n"; +print "Shutting down rest of the processes.\n"; + +delete_ior_files (); +kill_open_processes (); + +exit $status; diff --git a/modules/CIAO/examples/Hello/descriptors/svc_em.conf b/modules/CIAO/examples/Hello/descriptors/svc_em.conf new file mode 100644 index 00000000000..2aa568bf9af --- /dev/null +++ b/modules/CIAO/examples/Hello/descriptors/svc_em.conf @@ -0,0 +1,9 @@ +# $Id$ +# +# Please see $TAO_ROOT/docs/Options.html for details on these options. +# + +static Advanced_Resource_Factory "-ORBReactorType select_st -ORBInputCDRAllocator null -ORBConnectionCacheLock null -ORBFlushingStrategy blocking" +static Client_Strategy_Factory "-ORBProfileLock null -ORBClientConnectionHandler RW" +static Server_Strategy_Factory "-ORBConcurrency thread-per-connection -ORBPOALock thread -ORBAllowReactivationOfSystemids 0" + diff --git a/modules/CIAO/examples/Hello/descriptors_RTCCM/NodeManagerMap.dat b/modules/CIAO/examples/Hello/descriptors_RTCCM/NodeManagerMap.dat new file mode 100644 index 00000000000..9880f37997e --- /dev/null +++ b/modules/CIAO/examples/Hello/descriptors_RTCCM/NodeManagerMap.dat @@ -0,0 +1,2 @@ +SenderNode corbaloc:iiop:localhost:60001/NodeManager +ReceiverNode corbaloc:iiop:localhost:60002/NodeManager
\ No newline at end of file diff --git a/modules/CIAO/examples/Hello/descriptors_RTCCM/RTsvc.conf b/modules/CIAO/examples/Hello/descriptors_RTCCM/RTsvc.conf new file mode 100644 index 00000000000..1bfd9e8eaba --- /dev/null +++ b/modules/CIAO/examples/Hello/descriptors_RTCCM/RTsvc.conf @@ -0,0 +1,5 @@ +# No options required for regular testing + +# For real-time testing, uncomment the following line: +static RT_ORB_Loader "-ORBSchedPolicy SCHED_FIFO -ORBScopePolicy SYSTEM" + diff --git a/modules/CIAO/examples/Hello/descriptors_RTCCM/input.csr b/modules/CIAO/examples/Hello/descriptors_RTCCM/input.csr new file mode 100644 index 00000000000..a3881225930 --- /dev/null +++ b/modules/CIAO/examples/Hello/descriptors_RTCCM/input.csr @@ -0,0 +1,70 @@ + +<CIAO:ServerResources + xmlns:CIAO="http://www.dre.vanderbilt.edu/ServerResources" + xmlns:xmi="http://www.omg.org/XMI" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.dre.vanderbilt.edu/ServerResources CIAOServerResources.xsd"> + + <cmdline> + <arg> -ORBDebugLevel 10 -ORBEndpoint corbaloc://foo/bar</arg> + </cmdline> + + <svcconf> + <uri> + svcconf.uri + </uri> + </svcconf> + + <orbConfigs> + <resources> + <threadpool id="threadpool-1"> + <stacksize>100</stacksize> + <static_threads>50</static_threads> + <dynamic_threads>25</dynamic_threads> + <default_priority>5</default_priority> + <allow_request_buffering>true</allow_request_buffering> + <max_buffered_requests>10</max_buffered_requests> + <max_request_buffered_size>20</max_request_buffered_size> + </threadpool> + + <threadpoolWithLanes id="threadpool-2"> + <threadpoolLane> + <static_threads>50</static_threads> + <dynamic_threads>25</dynamic_threads> + <priority>36</priority> + </threadpoolLane> + <stacksize>100</stacksize> + <allow_borrowing>true</allow_borrowing> + <allow_request_buffering>true</allow_request_buffering> + <max_buffered_requests>10</max_buffered_requests> + <max_request_buffered_size>20</max_request_buffered_size> + </threadpoolWithLanes> + + <connectionBands id="cb-1"> + <band> + <low>0</low> + <high>10</high> + </band> + <band> + <low>11</low> + <high>20</high> + </band> + </connectionBands> + </resources> + + <policySet id="test_policy_set_id"> + <priorityModel server_priority="10"> + <priority_model>SERVER_DECLARED</priority_model> + </priorityModel> + <priorityModel> + <priority_model>CLIENT_PROPAGATED</priority_model> + </priorityModel> + + <threadpool>threadpool-1</threadpool> + <threadpool>threadpool-2</threadpool> + + <priorityBandedConnection>cb-1</priorityBandedConnection> + + </policySet> + </orbConfigs> +</CIAO:ServerResources>
\ No newline at end of file diff --git a/modules/CIAO/examples/Hello/descriptors_RTCCM/rt-config-example.cdp b/modules/CIAO/examples/Hello/descriptors_RTCCM/rt-config-example.cdp new file mode 100644 index 00000000000..67f51f99fb9 --- /dev/null +++ b/modules/CIAO/examples/Hello/descriptors_RTCCM/rt-config-example.cdp @@ -0,0 +1,215 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no" ?> +<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 Modified_Deployment.xsd"> + + <label>Hello-DeploymentPlan</label> + + <UUID>Hello_Plan_UUID_0001</UUID> + + <realizes> + <label>BasicSP-realizes-cid</label> + <UUID>c0965470-7b83-11d9-9669-0800200c9a66</UUID> + <specificType/> + <supportedType>IDL:Hello/Sender:1.0</supportedType> + <port> + <name>read_message</name> + <specificType>IDL:Hello/ReadMessage:1.0</specificType> + <supportedType>IDL:Hello/ReadMessage:1.0</supportedType> + <provider>false</provider> + <exclusiveProvider>false</exclusiveProvider> + <exclusiveUser>true</exclusiveUser> + <optional>false</optional> + <kind>SimplexReceptacle</kind> + </port> + </realizes> + + <implementation id="Hello-Sender-mdd"> + <name>Hello-Sender-mdd</name> + <source/> + <artifact>Hello-Sender_exec</artifact> + <artifact>Hello-Sender_svnt</artifact> + </implementation> + + <implementation id="Hello-Receiver-mdd"> + <name>Hello-Receiver-mdd</name> + <source/> + <artifact>Hello-Receiver_exec</artifact> + <artifact>Hello-Receiver_svnt</artifact> + </implementation> + + <instance id="Hello-Sender-idd"> + <name>Hello-Sender-idd</name> + <node>SenderNode</node> + <source/> + <implementation>Hello-Sender-mdd</implementation> + <configProperty> + <name>ComponentIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Sender.ior</string> + </value> + </value> + </configProperty> + <configProperty> + <name>local_message</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>This is a test message passed in through XML.</string> + </value> + </value> + </configProperty> + <deployedResource> + <resourceUsage>InstanceUsesResource</resourceUsage> + <requirementName>CIAO:PolicySet</requirementName> + <resourceName>test_server_resource_id</resourceName> + <resourceValue> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>test_policy_set_id</string> + </value> + </resourceValue> + </deployedResource> + </instance> + + <instance id="Hello-Receiver-idd"> + <name>Hello-Receiver-idd</name> + <node>ReceiverNode</node> + <source/> + <implementation>Hello-Receiver-mdd</implementation> + <configProperty> + <name>ComponentIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Receiver.ior</string> + </value> + </value> + </configProperty> + </instance> + + <connection> + <name>hell_event_connection</name> + <internalEndpoint> + <portName>click_out</portName> + <kind>EventPublisher</kind> + <instance>Hello-Sender-idd</instance> + </internalEndpoint> + <internalEndpoint> + <portName>click_in</portName> + <kind>EventConsumer</kind> + <instance>Hello-Receiver-idd</instance> + </internalEndpoint> + </connection> + + <connection> + <name>hello_facet_connection</name> + <internalEndpoint> + <portName>push_message</portName> + <kind>Facet</kind> + <instance>Hello-Sender-idd</instance> + </internalEndpoint> + <internalEndpoint> + <portName>read_message</portName> + <kind>SimplexReceptacle</kind> + <instance>Hello-Receiver-idd</instance> + </internalEndpoint> + </connection> + + <artifact id="Hello-Sender_exec"> + <name>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_SenderHome_Impl</string> + </value> + </value> + </execParameter> + </artifact> + + <artifact id="Hello-Sender_svnt"> + <name>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_SenderHome_Servant</string> + </value> + </value> + </execParameter> + </artifact> + + <artifact id="Hello-Receiver_exec"> + <name>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_ReceiverHome_Impl</string> + </value> + </value> + </execParameter> + </artifact> + + <artifact id="Hello-Receiver_svnt"> + <name>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_ReceiverHome_Servant</string> + </value> + </value> + </execParameter> + </artifact> + + <infoProperty> + <name>CIAOServerResources</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>rt-config-example.csr</string> + </value> + </value> + </infoProperty> + +</Deployment:deploymentPlan> diff --git a/modules/CIAO/examples/Hello/descriptors_RTCCM/rt-config-example.csr b/modules/CIAO/examples/Hello/descriptors_RTCCM/rt-config-example.csr new file mode 100644 index 00000000000..fa567f78c90 --- /dev/null +++ b/modules/CIAO/examples/Hello/descriptors_RTCCM/rt-config-example.csr @@ -0,0 +1,73 @@ + +<CIAO:ServerResources + xmlns:CIAO="http://www.dre.vanderbilt.edu/ServerResources" + xmlns:xmi="http://www.omg.org/XMI" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.dre.vanderbilt.edu/ServerResources CIAOServerResources.xsd" + id="test_server_resource_id"> + + <cmdline> + <arg>-r</arg> + </cmdline> + + <svcconf> + <uri>RTsvc.conf</uri> + </svcconf> + + <orbConfigs> + <resources> + <threadpool id="threadpool-1"> + <stacksize>0</stacksize> + <static_threads>5</static_threads> + <dynamic_threads>0</dynamic_threads> + <default_priority>1</default_priority> + <allow_request_buffering>false</allow_request_buffering> + <max_buffered_requests>0</max_buffered_requests> + <max_request_buffered_size>0</max_request_buffered_size> + </threadpool> + + <threadpoolWithLanes id="threadpool-2"> + <threadpoolLane> + <static_threads>5</static_threads> + <dynamic_threads>0</dynamic_threads> + <priority>2</priority> + </threadpoolLane> + <threadpoolLane> + <static_threads>5</static_threads> + <dynamic_threads>0</dynamic_threads> + <priority>1</priority> + </threadpoolLane> + <stacksize>0</stacksize> + <allow_borrowing>false</allow_borrowing> + <allow_request_buffering>false</allow_request_buffering> + <max_buffered_requests>0</max_buffered_requests> + <max_request_buffered_size>0</max_request_buffered_size> + </threadpoolWithLanes> + + <connectionBands id="cb-1"> + <band> + <low>0</low> + <high>10</high> + </band> + <band> + <low>11</low> + <high>20</high> + </band> + </connectionBands> + </resources> + + <policySet id="test_policy_set_id"> + <priorityModel server_priority="1"> + <priority_model>SERVER_DECLARED</priority_model> + </priorityModel> + </policySet> + + <policySet id="test_policy_set_2"> + <priorityModel> + <priority_model>CLIENT_PROPAGATED</priority_model> + </priorityModel> + <threadpool>threadpool-2</threadpool> + </policySet> + + </orbConfigs> +</CIAO:ServerResources> diff --git a/modules/CIAO/examples/Hello/descriptors_RTCCM/rt-example.cdp b/modules/CIAO/examples/Hello/descriptors_RTCCM/rt-example.cdp new file mode 100644 index 00000000000..43b4bed5cec --- /dev/null +++ b/modules/CIAO/examples/Hello/descriptors_RTCCM/rt-example.cdp @@ -0,0 +1,271 @@ +<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>Hello-DeploymentPlan</label> + <UUID>Hello_Plan_UUID_0001</UUID> + <!-- Could be ZERO --> + <realizes> + <label>BasicSP-realizes-cid</label> + <UUID>c0965470-7b83-11d9-9669-0800200c9a66</UUID> + <specificType><!-- @@ What does here? --></specificType> + <supportedType>IDL:BasicSP/EC:1.0</supportedType> + <port> + <name>read_message</name> + <specificType>IDL:Hello/ReadMessage:1.0</specificType> + <supportedType>IDL:Hello/ReadMessage:1.0</supportedType> + <provider>false</provider> + <exclusiveProvider>false</exclusiveProvider> + <exclusiveUser>true</exclusiveUser> + <optional>false</optional> + <kind>SimplexReceptacle</kind> + </port> + </realizes> + + <implementation id="Hello-Sender-mdd"> + <name>Hello-Sender-mdd</name> + <source><!-- @@ Don't know what goes here --></source> + <artifact>Hello-Sender_exec</artifact> + <artifact>Hello-Sender_svnt</artifact> + <!-- + <execParameter></execParameter> + <deployRequirement></deployRequirement> + --> + </implementation> + + <implementation id="Hello-Receiver-mdd"> + <name>Hello-Receiver-mdd</name> + <source><!-- @@ Don't know what goes here --></source> + <artifact>Hello-Receiver_exec</artifact> + <artifact>Hello-Receiver_svnt</artifact> + <!-- + <execParameter></execParameter> + <deployRequirement></deployRequirement> + --> + </implementation> + + <instance id="Hello-Sender-idd"> + <name>Hello-Sender-idd</name> + <node>SenderNode</node> + <source><!-- @@ What goes here --></source> + <implementation>Hello-Sender-mdd</implementation> + + <!-- Add this property if you want to write component reference to IOR --> + <configProperty> + <name>ComponentIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Sender.ior</string> + </value> + </value> + </configProperty> + + <!-- Add this property if you want to initialize component attribute --> + <configProperty> + <name>local_message</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>This is a test message passed in through XML.</string> + </value> + </value> + </configProperty> + + <!-- This attribute initializes an enumerated value --> + <configProperty> + <name>color</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>COLOR_SELECTION</name> + <typeId>IDL:Hello/COLOR_SELECTION:1.0</typeId> + <member>empty</member> + <member>white</member> + <member>red</member> + <member>yellow</member> + </enum> + </type> + <value> + <enum>yellow</enum> + </value> + </value> + </configProperty> + + <deployedResource> + <resourceUsage>InstanceUsesResource</resourceUsage> + <requirementName>CIAO:PolicySet</requirementName> + <resourceName>test_server_resource_id</resourceName> + <property> + <name>CIAO:InstancePolicy</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>test_policy_set_id</string> + </value> + </value> + </property> + </deployedResource> + + </instance> + + <instance id="Hello-Receiver-idd"> + <name>Hello-Receiver-idd</name> + <node>SenderNode</node> + <source><!-- @@ What goes here --></source> + <implementation>Hello-Receiver-mdd</implementation> + <configProperty> + <name>ComponentIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Receiver.ior</string> + </value> + </value> + </configProperty> + + <deployedResource> + <resourceUsage>InstanceUsesResource</resourceUsage> + <requirementName>CIAO:PolicySet</requirementName> + <resourceName>test_server_resource_id</resourceName> + <property> + <name>CIAO:InstancePolicy</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>test_policy_set_id</string> + </value> + </value> + </property> + </deployedResource> + + </instance> + + + <connection> + <name>hell_event_connection</name> + <internalEndpoint> + <portName>click_out</portName> + <kind>EventPublisher</kind> + <instance>Hello-Sender-idd</instance> + </internalEndpoint> + <internalEndpoint> + <portName>click_in</portName> + <kind>EventConsumer</kind> + <instance>Hello-Receiver-idd</instance> + </internalEndpoint> + </connection> + + <connection> + <name>hello_facet_connection</name> + <internalEndpoint> + <portName>push_message</portName> + <kind>Facet</kind> + <instance>Hello-Sender-idd</instance> + </internalEndpoint> + <internalEndpoint> + <portName>read_message</portName> + <kind>SimplexReceptacle</kind> + <instance>Hello-Receiver-idd</instance> + </internalEndpoint> + </connection> + + <!-- @@ Runtime library name must match exactly in "location" tag --> + <artifact id="Hello-Sender_exec"> + <name>Sender_exec</name> + <source><!-- @@ Not sure about this--></source> + <node><!-- blank --></node> + <location>Hello_Sender_exec</location> + <execParameter> + <name>entryPoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Hello_SenderHome_Impl</string> + </value> + </value> + </execParameter> + </artifact> + + <artifact id="Hello-Sender_svnt"> + <name>Sender_svnt</name> + <source><!-- @@ Not sure --></source> + <node><!-- blank --></node> + <location>Hello_Sender_svnt</location> + <execParameter> + <name>entryPoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Hello_SenderHome_Servant</string> + </value> + </value> + </execParameter> + </artifact> + + <artifact id="Hello-Receiver_exec"> + <name>Receiver_exec</name> + <source><!-- @@ Not sure about this--></source> + <node><!-- blank --></node> + <location>Hello_Receiver_exec</location> + <execParameter> + <name>entryPoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Hello_ReceiverHome_Impl</string> + </value> + </value> + </execParameter> + </artifact> + + <artifact id="Hello-Receiver_svnt"> + <name>Receiver_svnt</name> + <source><!-- @@ Not sure --></source> + <node><!-- blank --></node> + <location>Hello_Receiver_svnt</location> + <execParameter> + <name>entryPoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Hello_ReceiverHome_Servant</string> + </value> + </value> + </execParameter> + </artifact> + + <infoProperty> + <name>CIAOServerResources</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>rt-config-example.csr</string> + </value> + </value> + </infoProperty> + +</Deployment:deploymentPlan> diff --git a/modules/CIAO/examples/Hello/descriptors_RTCCM/rt_run_test.pl b/modules/CIAO/examples/Hello/descriptors_RTCCM/rt_run_test.pl new file mode 100755 index 00000000000..ee8ec147df6 --- /dev/null +++ b/modules/CIAO/examples/Hello/descriptors_RTCCM/rt_run_test.pl @@ -0,0 +1,165 @@ +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::Run_Test; +$CIAO_ROOT = $PerlACE::CIAO_ROOT; +$DAnCE = "$CIAO_ROOT/DAnCE"; + +$daemons_running = 0; +$em_running = 0; +$daemons = 2; +@ports = ( 60001, 60002 ); +@iorfiles = ( "NodeApp1.ior", "NodeApp2.ior" ); +$status = 0; +$dat_file = "NodeManagerMap.dat"; +$cdp_file = "DeploymentPlan.cdp"; +$controller_exec = "$CIAO_ROOT/examples/Hello/Sender/starter"; + +PerlACE::add_lib_path ('../lib'); + +$E = 0; +$EM = 0; + +# Delete if there are any .ior files. +sub delete_ior_files { + for ($i = 0; $i < $daemons; ++$i) { + unlink $iorfiles[$i]; + } + unlink PerlACE::LocalFile ("EM.ior"); + unlink PerlACE::LocalFile ("Receiver.ior"); + unlink PerlACE::LocalFile ("Sender.ior"); + unlink PerlACE::LocalFile ("DAM.ior"); +} + +sub kill_node_daemons { + for ($i = 0; $i < $daemons; ++$i) { + $Daemons[$i]->Kill (); $Daemons[$i]->TimedWait (1); + } +} + +sub kill_open_processes { + if ($daemons_running == 1) { + kill_node_daemons (); + } + + if ($em_running == 1) { + $EM->Kill (); + $EM->TimedWait (1); + } +} + +sub run_node_daemons { + for ($i = 0; $i < $daemons; ++$i) + { + $iorfile = $iorfiles[$i]; + $port = $ports[$i]; + + $iiop = "iiop://localhost:$port"; + $node_app = "$CIAO_ROOT/bin/NodeApplication"; + + $d_cmd = "$DANCE_ROOT/bin/dance_node_manager"; + + # NON-RT +# $d_param = "-ORBEndpoint $iiop -s $node_app -o $iorfile"; + + # RT enabled + $d_param = "-ORBEndpoint $iiop -s $node_app -a \"-r\" -o $iorfile"; + + $Daemons[$i] = new PerlACE::Process ($d_cmd, $d_param); + $result = $Daemons[$i]->Spawn (); + push(@processes, $Daemons[$i]); + + if (PerlACE::waitforfile_timed ($iorfile, + $PerlACE::wait_interval_for_process_creation) == -1) { + print STDERR + "ERROR: The ior file of node daemon $i could not be found\n"; + for (; $i > 0; --$i) { + $Daemons[$i]->Kill (); $Daemons[$i]->TimedWait (1); + } + return -1; + } + } + $daemons_running = 1; + return 0; +} + +delete_ior_files (); + +# Invoke node daemons. +print "Invoking node daemons\n"; +$status = run_node_daemons (); + +if ($status != 0) { + print STDERR "ERROR: Unable to execute the node daemons\n"; + exit 1; +} + +$ns_running = 1; + +# Invoke execution manager. +print "Invoking execution manager\n"; +$EM = new PerlACE::Process ("$CIAO_ROOT/bin/Execution_Manager", + "-o EM.ior -i $dat_file"); +$EM->Spawn (); + +if (PerlACE::waitforfile_timed ("EM.ior", + $PerlACE::wait_interval_for_process_creation) == -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 - start the application -\n"; +$E = + new PerlACE::Process ("$CIAO_ROOT/bin/plan_launcher", + "-p rt-example.cdp -k file://EM.ior -o DAM.ior"); + +$E->SpawnWaitKill (5000); + +if (PerlACE::waitforfile_timed ( + "Receiver.ior", + $PerlACE::wait_interval_for_process_creation) == -1) { + print STDERR "ERROR: The ior file of receiver could not be found\n"; + kill_open_processes (); + exit 1; +} + +if (PerlACE::waitforfile_timed ("Sender.ior", + $PerlACE::wait_interval_for_process_creation) == -1) { + print STDERR "ERROR: The ior file of sender could not be found\n"; + kill_open_processes (); + exit 1; +} + +print "Invoking the controller\n"; +$controller = new PerlACE::Process ("$controller_exec", "-k file://Sender.ior"); +$result = $controller->SpawnWaitKill (3000); + +if ($result != 0) { + print STDERR "ERROR: The controller returned $result\n"; + $status = 1; +} + +# Invoke executor - stop the application -. +print "Invoking executor - stop the application -\n"; +$E = + new PerlACE::Process ("$CIAO_ROOT/bin/plan_launcher", + "-k file://EM.ior -i file://DAM.ior"); +$E->SpawnWaitKill (3000); + +print "Executor returned.\n"; +print "Shutting down rest of the processes.\n"; + +delete_ior_files (); +kill_open_processes (); + +exit $status; diff --git a/modules/CIAO/examples/Hello/step-by-step.html b/modules/CIAO/examples/Hello/step-by-step.html new file mode 100644 index 00000000000..e40fb3fbee3 --- /dev/null +++ b/modules/CIAO/examples/Hello/step-by-step.html @@ -0,0 +1,234 @@ +<!--//$Id$ --> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> + <title>Step-By-Step of How to build a CIAO application</title> +</head> + +<body + text = "#000000" + link = "#000fff" + vLink= "#ff0f0f" + aLink = "#0000ff" + bgColor = "#ffffff"> + +<hr> +<h2>Simple <a href="http://www.dre.vanderbilt.edu/CIAO">CIAO</a> tutorial</h2> +<b>Note:</b> +<UL> +<li><a href="http://www.dre.vanderbilt.edu/cosmic">CoSMIC</a> tools are not used in this tutorial.</li> +<li>This is only a <em>GENERAL</em> way of building up a CIAO application and deploying it with DAnCE. The user could always change the process in his own way. For example: the IDL file content, the project structure etc.</li> +<li>To download the code of this example please refer to the SVN repository at <code>$CIAO_ROOT/examples/Hello</code>.</li> +</UL> +<hr> + +<h2>Example Description</h2> +This Hello example is contructed in the following ways: +<UL> +<li>1. There are 2 components in the system: Sender and Receiver</li> +<li>2. The Sender will send out the timeout event to the Receiver.</li> +<li>3. Upon receiving the timeout event, the Receiver will go and fetch data from the Sender. </li> +<li>4. The user could deploy multiple instances of the Receiver without changing any C++/idl source code.</li> +</UL> +<hr> + +<h2>Step-By-Step</h2> +<h3>Hello_Base</h3> + +<OL> +<li>Write an IDL file (<a href="./Hello_Base/Hello_Base.idl"><code>Hello_Base.idl</code></a>) which contains all + the interfaces and events common to all the components. The reason + we do this is because the generated lib of this idl file will be + linked in by all the components in the system. To reduce the size + of the component lib we have to include only the necesary part. In + this example, we have an eventtype <code>timeout</code> and an + interface <code>ReadMessage</code>, which are used by both the + Sender and the Receiver, so we put both of them in <a href="Hello_Base/Hello_Base.idl">Hello_Base.idl</a>.</li> + <P> + +<li>Look at the <a href="Hello_Base/Hello_Base.mpc"><code>Hello_Base.mpc</code></a> file to get an idea how the Hello_Base_stub + and Hello_Base_svnt projects are organized. + <a href="http://downloads.ociweb.com/MPC/MakeProjectCreator.pdf">MPC</a> is a utility we used to generate makefiles or VC + project/solution files for all <a href="http://www.cs.wustl.edu/~schmidt/ACE.html">ACE</a>, + <a href="http://www.cs.wustl.edu/~schmidt/TAO.html">TAO</a> and <a href="http://www.cs.wustl.edu/~schmidt/CIAO.html">CIAO</a> + libraries.</li> +</Ol> + +<hr> + +<h3>For Every Components</h3> + +<ol> +<li>Execute : <br> +<ul> +<code>$CIAO_ROOT/bin/generate_component_mpc.pl -p Hello_Base Sender</code> in Sender directory<br> +<code>$CIAO_ROOT/bin/generate_component_mpc.pl -p Hello_Base Receiver</code> in Receiver directory<br> +</ul> +Note: +<ul> +<li>I have different directories for <code>"Hello_Base", "Sender", "Receiver"</code> respectively.</li> + +<li>For every <code>_stub</code> project, add:<br> + <code>"libs += Hello_Base_DnC_stub"</code><br> + +</ul> +The output of this scripts includes an MPC file and 3 export header files +(..._svnt_export.h, ..._exec_export.h and ..._stub_export.h). +<P> + +<li>Write an idl file for every component (<a href="Sender/Sender.idl"><code>Sender.idl</code></a> and + <a href="Receiver/Receiver.idl"><code>Receiver.idl</code></a>). <br> Here you can put the + component specific IDL definitions in this file. In this example we have a interface <code>trigger</code> + specific to the Sender. Please note that the Sender component + <code>"supports"</code> (IDL keyword) this interface. </li> <P> + +<li>Write the CIDL file for every component (<a href="Sender/Sender.cidl"><code>Sender.cidl</code></a> and + <a href="Receiver/Receiver.cidl"><code>Receiver.cidl</code></a>). +</li><P> + +<li>Compile these cidl files, using <code>$CIAO_ROOT/bin/cidlc.exe Receiver.cidl --gen-exec-impl -I$CIAO_ROOT/ccm -I$CIAO_ROOT -I$TAO_ROOT</code>. + This'll result in ..._exec.cpp/..._exec.h and ..._svnt.cpp/..._svnt.h files. +</li><P> + +<li>Write <code>_exec.h</code> and <code>_exec.cpp</code> files which actually implement the component.</li> +<P> +</OL> + +Writing all those files could be troublesome to a new CCM user. The +best way of learning this is to read the example source code. If you +are familliar with CORBA programming, it should not take too much time +before you can declare yourself as a CCM programmer. <P> + +<hr> <P> + +<h3>The Entry Point</h3> + +After both components are implemented we still need a small program to +initialize the process. In Sender.idl there is a Sender specific +interface with a single method in it created for this purpose. Hence +there is a CORBA client application called <code>starter</code>. The +<code>starter</code> will make a invocation on a supported interface +called <code>trigger</code> on the Sender component to get the whole +distributed application started. The <code>starter</code> will first +obtain the Sender component object reference through the ior string +supplied as a command argument. Please see the the last part of +<code>Hello/Sender/Sender.mpc</code> file for details. <P> + +<hr> + +<h3>Make</h3> + +<UL> +<li>Go to the directory <code>$CIAO_ROOT/DAnCE</code> and do:<br> + <code>$ACE_ROOT/bin/mwc.pl</code></li> + <br>For example, using <code>$ACE_ROOT/bin/mwc.pl -type vc71</code> if you are using Visual C++ 7.1 IDE + <br>or <code>$ACE_ROOT/bin/mwc.pl -type gnuace</code> on Linux platforms.</li><P> +<li>Look at the generated Makefile(*unx) or Solution/workspace files(Windows) and you got it.</li> +</UL> +After building DAnCE, a solution or makefile should be generated for this CIAO example. +Navigate to <code>$CIAO_ROOT/examples/Hello</code> and execute <code>$ACE_ROOT/bin/mwc.pl -type vc71</code> for +Visual C++ 7.1 or <code>$ACE_ROOT/bin/mwc.pl -type gnuace</code> on Linux platforms. +Build this example using Visual Studio or make. +<P><hr> + +<h3>Assemble</h3> + +Now we can step forward to build the assembly. Here we are going to +build the simplest case only, which is 1 Receiver and 1 Sender. If you +are interested in CIAO you could try 1 Sender with multiple +Receivers. However, you need to change the Sender.idl to make it +<em>publishes</em> timeout event instead of <em>emits</em> event.<br> +Note: Creating the deployment plan descriptor is a tedious and + error-prone job, you can download <a + href="http://www.dre.vanderbilt.edu/cosmic">CoSMIC</a> to assist + you in this step. <P> + +<UL> +<li>You need to create an XML descriptor file to describe your <em>deployment plan</em>, which is + defined in a <EM>Deployment Plan Descriptor</EM> (.cdp) (see <a href="./descriptors/DeploymentPlan.cdp">Hello deployment plan<a>). + In this file, you need to declaratively specify how the component assembly is constructed. Specificly, you need to specify + the component types, component instances, component connections, implementation artifact descriptions, and whether you + want to register component instances with naming service.<P> + +<li> Please make sure that the Modified_Deployment.xsd and XMI.xsd files are in the Hello/descriptors directory. +The former file can be found in $CIAO_ROOT/docs/schema directory. <P> + +<li> Create the <em>NodeManagerMap.dat</em> file containing the CORBALOC IIOP address of each <code>NodeManager</code> + where it is running. Please refer to the existing <a href="./descriptors/NodeManagerMap.dat"> + <code>NodeManagerMap.dat</code></a> for details. + As you can see, we only specify 2 <code>NodeManagers</code>, which means these two components + will be installed in the different <code>NodeApplication</code> server. Please refer to the + <em>flattened_deploymentplan.cdp</em> file to see how a deployer + could specify the mapping between components and nodes.</li> +</li> +</UL> + +<hr> +<h3>Deploy with <A href="../../docs/releasenotes/dance.html">DAnCE</A></h3> +Finally you are ready to deploy the component-based application you have developed. +<br><br> + +<UL> + <LI> If you wish to register one or more of your component + instances with CORBA <em>naming service</em>, then please start your naming service + first with multicast mode first ("-m 1" option). Use <code>-o</code> to define where + the output ior should be saved.<P> + + <LI> Go into the <em> descriptors </em> directory Start NodeManagers + (NodeDameon) by running <code> run_NodeDaemons.pl </code> <P> + + <LI> There are two ways to start the execution manager : + <ol> + <li>Using the naming service to locate the node deamons<br/> + Navigate to <em>$CIAO_ROOT/examples/Hello/descriptor</em> and execute + <code>$DANCE_ROOT/bin/dance_execution_manager -eEM.ior --domain-nc file://ns.ior</code><br/> + --domain-nc should point to the ior file of the naming service. + </li> + + <li>Without using the naming service.<br/> + Navigate to <em>$CIAO_ROOT/examples/Hello/descriptor</em> and execute:<br/> + <code>$DANCE_ROOT/bin/dance_execution_manager -eEM.ior --node-map NodeManagerMap.dat </code><br/> + <em>NOTE</em>: As one can see, we use the "NodeManagerMap.dat" file to instruct the + Execution_Manager how to find the endpoint of each individual NodeManager (i.e., Node Daemon) where + component(s) will be deployed. This is non-standard. + </li> + </ol> + </LI> + </ul><P> + + <LI> Start the plan launcher, with or without using the Naming Service: <br/> + <ol> + <li>Using the naming service<br/> + Navigate to <em>$CIAO_ROOT/examples/Hello/descriptors_naming</em> and execute:<br/> + <code> $DANCE_ROOT/bin/dance_plan_launcher -d deploymentplan_naming.cdp -k file://../descriptors/EM.ior </code> + </li> + <li>Without using the naming service<br/> + Navigate to <em>$CIAO_ROOT/examples/Hello/descriptors</em> and execute:<br/> + <code> $DANCE_ROOT/bin/dance_plan_launcher -x deploymentplan.cdp -k file://EM.ior </code><P> + </li> + After this, components should be deployed successfully.<P> + </ol> +</LI> + + <LI> You can go into the <em>$CIAO_ROOT/examples/Hello/descriptor</em> directory and + run execute <code>$CIAO_ROOT/examples/Hello/Sender/starter -k file://Sender.ior</code> to start the application. Please make sure that the component IOR + file for the Sender component (<code>Sender.ior</code>) is present when you run this client.<P> + </LI> + <LI>To stop deployment just run $DANCE_ROOT/bin/dance_plan_launcher -x DeploymentPlan.cdp -k file://EM.ior -q + </LI> +</UL> +<br/> +<br/> +In addition, have a look at <a href="./descriptors/run_test.pl"><code>run_test.pl</code></a> and see how this can be established. + +<hr> +<h3>More Features</h3> +Recently DAnCE is enabled with a feature called <em>Redeployment and Reconfiguration</em> (ReDaC). For more information +about how to use this feature, please refer to the ReDaC-Usage-Example.html under $CIAO_ROOT/examples/Hello/. +<br><br> + +<hr> +<b>Email: </b><a href="mailto:"</a<ADDRESS>ciao-users@cse.wustl.edu</ADDRESS> +</body> +</html> + |