diff options
Diffstat (limited to 'modules/CIAO/examples/BasicSP')
29 files changed, 3590 insertions, 0 deletions
diff --git a/modules/CIAO/examples/BasicSP/BMClosedED/BMClosedED.idl b/modules/CIAO/examples/BasicSP/BMClosedED/BMClosedED.idl new file mode 100644 index 00000000000..9ea963189fd --- /dev/null +++ b/modules/CIAO/examples/BasicSP/BMClosedED/BMClosedED.idl @@ -0,0 +1,24 @@ +//$Id$ + +#ifndef BMCLOSEDED_IDL +#define BMCLOSEDED_IDL + +#include "BasicSP.idl" +#include "BasicSPE.idl" + +module BasicSP +{ + component BMClosedED + { + provides ReadData dataout; + uses ReadData datain; + publishes DataAvailable out_avail; + consumes DataAvailable in_avail; + }; + + home BMClosedEDHome manages BMClosedED + { + }; +}; + +#endif /* BMCLOSEDED_IDL */ diff --git a/modules/CIAO/examples/BasicSP/BMClosedED/BMClosedED.mpc b/modules/CIAO/examples/BasicSP/BMClosedED/BMClosedED.mpc new file mode 100644 index 00000000000..4805a2137bd --- /dev/null +++ b/modules/CIAO/examples/BasicSP/BMClosedED/BMClosedED.mpc @@ -0,0 +1,114 @@ +// $Id$ + +project(BMClosedED_idl_gen) : componentidldefaults { + custom_only = 1 + after += BasicSP_idl_gen + idlflags += -I $(CIAO_ROOT)/examples/BasicSP \ + -Wb,stub_export_macro=BMCLOSEDED_STUB_Export \ + -Wb,stub_export_include=BMClosedED_stub_export.h \ + -Wb,skel_export_macro=BMCLOSEDED_SVNT_Export \ + -Wb,skel_export_include=BMClosedED_svnt_export.h \ + -Wb,exec_export_macro=BMCLOSEDED_EXEC_Export \ + -Wb,exec_export_include=BMClosedED_exec_export.h \ + + IDL_Files { + BMClosedED.idl + } +} + +project(BMClosedED_lem_gen) : ciaoidldefaults { + after += BMClosedED_idl_gen + custom_only = 1 + idlflags += -Wb,export_macro=BMCLOSEDED_EXEC_Export \ + -Wb,export_include=BMClosedED_exec_export.h \ + -SS -I $(CIAO_ROOT)/examples/BasicSP + + IDL_Files { + BMClosedEDE.idl + } +} + +project(BMClosedED_stub): ccm_stub { + libout = ../lib + libpaths += ../lib + after += BasicSP_stub BasicSP_lem_gen BMClosedED_idl_gen + sharedname = BMClosedED_stub + includes += $(CIAO_ROOT)/examples/BasicSP + libs += BasicSP_stub + dynamicflags = BMCLOSEDED_STUB_BUILD_DLL + + IDL_Files { + } + + Header_Files { + BMClosedEDC.h + } + + Source_Files { + BMClosedEDC.cpp + } + + Inline_Files { + } +} + +project(BMClosedED_exec) : ciao_executor { + after += BMClosedED_stub BMClosedED_lem_gen BasicSP_exec + sharedname = BMClosedED_exec + libs += BMClosedED_stub + libs += BasicSP_stub BasicSP_exec + includes += $(CIAO_ROOT)/examples/BasicSP + libout = ../lib + libpaths += ../lib + + dynamicflags = BMCLOSEDED_EXEC_BUILD_DLL + + IDL_Files { + } + + Header_Files { + BMClosedED_exec.h + BMClosedED_exec_export.h + BMClosedEDEC.h + } + + Source_Files { + BMClosedED_exec.cpp + BMClosedEDEC.cpp + } + + Inline_Files { + } +} + +project(BMClosedED_svnt) : ciao_servant { + after += BasicSP_svnt BMClosedED_exec BasicSP_exec + + includes += $(CIAO_ROOT)/examples/BasicSP + + sharedname = BMClosedED_svnt + + libs += BMClosedED_stub BMClosedED_exec BasicSP_exec + libs += BasicSP_stub BasicSP_svnt + libout = ../lib + libpaths += ../lib + + dynamicflags = BMCLOSEDED_SVNT_BUILD_DLL + + IDL_Files { + } + + Header_Files { + BMClosedED_svnt.h + BMClosedEDS.h + } + + Source_Files { + BMClosedED_svnt.cpp + BMClosedEDS.cpp + } + + Inline_Files { + } +} + diff --git a/modules/CIAO/examples/BasicSP/BMClosedED/BMClosedED_exec.cpp b/modules/CIAO/examples/BasicSP/BMClosedED/BMClosedED_exec.cpp new file mode 100644 index 00000000000..9b3808d8ce4 --- /dev/null +++ b/modules/CIAO/examples/BasicSP/BMClosedED/BMClosedED_exec.cpp @@ -0,0 +1,193 @@ +// $Id$ + +#include "ace/SString.h" +#include "ace/OS_NS_string.h" +#include "BMClosedED_exec.h" + +#define DISPLACEMENT 256 + +MyImpl::ReadData_Impl::ReadData_Impl (const char* name) + : str_ (name) +{ +} + +MyImpl::ReadData_Impl::~ReadData_Impl (void) +{ +} + +void +MyImpl::ReadData_Impl::set_name (const char* name) +{ + this->str_ = name; +} + +char * +MyImpl::ReadData_Impl::get_data (void) +{ + return CORBA::string_dup (this->str_.in()); +} + +//================================================= + +/// Default constructor. +MyImpl::BMClosedED_exec_i::BMClosedED_exec_i (void) + : dataout_ (new ReadData_Impl("")) +{ +} + +/// Default destructor. +MyImpl::BMClosedED_exec_i::~BMClosedED_exec_i (void) +{ + delete this->dataout_; +} + +// Operations from HUDisplay::BMClosedED + +BasicSP::CCM_ReadData_ptr +MyImpl::BMClosedED_exec_i::get_dataout (void) +{ + return BasicSP::CCM_ReadData::_duplicate (this->dataout_); +} + +void +MyImpl::BMClosedED_exec_i::push_in_avail (BasicSP::DataAvailable *) +{ + + ACE_DEBUG ((LM_EMERGENCY, + "BMClosedED - Doing computations\n")); + + ACE_DEBUG ((LM_EMERGENCY, + "BMClosedED - Doing data fetch\n")); + + // Refresh position + BasicSP::ReadData_var dat + = this->context_->get_connection_datain (); + + if (CORBA::is_nil (dat.in ())) + { + ACE_DEBUG ((LM_EMERGENCY, + "BMClosedED - got nil from get_connection\n")); + + throw CORBA::BAD_INV_ORDER (); + } + + CORBA::String_var str = + dat->get_data (); + + ACE_DEBUG ((LM_EMERGENCY, + "BMClosedED - Display data is [%s]\n", + str.in ())); + + if (ACE_OS::strcmp (str.in (), "BM DEVICE DATA") == 0) + { + this->dataout_->set_name ("BM CLOSED ED DATA"); + } + + // Notify others. + BasicSP::DataAvailable_var event = + new OBV_BasicSP::DataAvailable; + + this->context_->push_out_avail (event); +} + +// Operations from Components::SessionComponent +void +MyImpl::BMClosedED_exec_i::set_session_context ( + Components::SessionContext_ptr ctx + ) +{ + ACE_DEBUG ((LM_EMERGENCY, + "MyImpl::BMClosedED_exec_i::set_session_context\n")); + + this->context_ = + BasicSP::CCM_BMClosedED_Context::_narrow (ctx); + + if (CORBA::is_nil (this->context_.in ())) + { + throw CORBA::INTERNAL (); + } + // Urm, we actually discard exceptions thown from this operation. +} + +void +MyImpl::BMClosedED_exec_i::configuration_complete (void) +{ +} + +void +MyImpl::BMClosedED_exec_i::ccm_activate (void) +{ + ACE_DEBUG ((LM_EMERGENCY, + "MyImpl::BMClosedED_exec_i::ccm_activate\n")); +} + +void +MyImpl::BMClosedED_exec_i::ccm_passivate (void) +{ + // if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_EMERGENCY, + "MyImpl::BMClosedED_exec_i::ccm_passivate\n")); +} + +void +MyImpl::BMClosedED_exec_i::ccm_remove (void) +{ + // if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_EMERGENCY, + "MyImpl::BMClosedED_exec_i::ccm_remove\n")); +} + +extern "C" BMCLOSEDED_EXEC_Export ::Components::EnterpriseComponent_ptr +create_BasicSP_BMClosedED_Impl (void) +{ + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_RETURN (retval, + MyImpl::BMClosedED_exec_i, + ::Components::EnterpriseComponent::_nil ()); + + return retval; +} + +/// Default ctor. +MyImpl::BMClosedEDHome_exec_i::BMClosedEDHome_exec_i (void) +{ +} + +/// Default dtor. +MyImpl::BMClosedEDHome_exec_i::~BMClosedEDHome_exec_i (void) +{ +} + +// Explicit home operations. + +// Implicit home operations. + +::Components::EnterpriseComponent_ptr +MyImpl::BMClosedEDHome_exec_i::create (void) +{ + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_THROW_EX ( + retval, + MyImpl::BMClosedED_exec_i, + ::CORBA::NO_MEMORY ()); + + return retval; +} + +extern "C" BMCLOSEDED_EXEC_Export ::Components::HomeExecutorBase_ptr +create_BasicSP_BMClosedEDHome_Impl (void) +{ + ::Components::HomeExecutorBase_ptr retval = + ::Components::HomeExecutorBase::_nil (); + + ACE_NEW_RETURN ( + retval, + MyImpl::BMClosedEDHome_exec_i, + ::Components::HomeExecutorBase::_nil ()); + + return retval; +} diff --git a/modules/CIAO/examples/BasicSP/BMClosedED/BMClosedED_exec.h b/modules/CIAO/examples/BasicSP/BMClosedED/BMClosedED_exec.h new file mode 100644 index 00000000000..904421ec63b --- /dev/null +++ b/modules/CIAO/examples/BasicSP/BMClosedED/BMClosedED_exec.h @@ -0,0 +1,133 @@ +// $Id$ + +//================================================================ +/** + * @file BMClosedED_exec.h + * + * @author Balachandran Natarajan <bala@dre.vanderbilt.edu> + */ +//================================================================ + +#ifndef CIAO_BMCLOSED_EXEC_H +#define CIAO_BMCLOSED_EXEC_H + +#include "BMClosedEDEC.h" +#include "tao/LocalObject.h" +#include "BMClosedED_exec_export.h" + +// The namespace name for the actual implementation classes doesn't +// really matter. Since there may be several different +// implementations for a component, they can very well be in different +// namespaces. +namespace MyImpl +{ + /** + * @class ReadData_Impl + * + * Implementation of the ReadData interface + */ + class BMCLOSEDED_EXEC_Export ReadData_Impl : + public virtual ::BasicSP::CCM_ReadData, + public virtual ::CORBA::LocalObject + { + public: + /// Constructor + ReadData_Impl(const char* name); + + void set_name (const char* name); + + virtual char * + get_data (void); + + ~ReadData_Impl (void); + + private: + CORBA::String_var str_; + }; + + /** + * @class BMClosedED_exec_i + * + * An example RateGen executor implementation class. + */ + class BMCLOSEDED_EXEC_Export BMClosedED_exec_i : + public virtual CIAO_BasicSP_BMClosedED_Impl::BMClosedED_Exec, + // CIAO container implementation depends on correct reference + // counting of local interfaces, so we take a short cut to + public virtual ::CORBA::LocalObject + { + public: + /// Default constructor. + BMClosedED_exec_i (void); + + /// Default destructor. + ~BMClosedED_exec_i (void); + + // Operations from HUDisplay::BMClosedED + + virtual BasicSP::CCM_ReadData_ptr + get_dataout (); + + virtual void + push_in_avail (BasicSP::DataAvailable *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: + CORBA::String_var str_; + + MyImpl::ReadData_Impl* dataout_; + + /// Copmponent specific context + BasicSP::CCM_BMClosedED_Context_var context_; + }; + + extern "C" BMCLOSEDED_EXEC_Export ::Components::EnterpriseComponent_ptr + create_BasicSP_BMClosedED_Impl (void); + + /** + * @class BMClosedEDHome_exec_i + * + * BMClosedED home executor implementation class. + */ + class BMCLOSEDED_EXEC_Export BMClosedEDHome_exec_i : + public virtual CIAO_BasicSP_BMClosedED_Impl::BMClosedEDHome_Exec, + public virtual ::CORBA::LocalObject + { + public: + /// Default ctor. + BMClosedEDHome_exec_i (); + + /// Default dtor. + ~BMClosedEDHome_exec_i (); + + // Explicit home operations. + + // Implicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + create (); + }; + +} + +// Executor DLL entry point. CIAO's deployment and assembly framework +// invokes this function on the resulting DLL to get the home executor. +extern "C" BMCLOSEDED_EXEC_Export ::Components::HomeExecutorBase_ptr +create_BasicSP_BMClosedEDHome_Impl (void); + +#endif /* CIAO_BMCLOSED_EXEC_H*/ diff --git a/modules/CIAO/examples/BasicSP/BMClosedED/config b/modules/CIAO/examples/BasicSP/BMClosedED/config new file mode 100644 index 00000000000..a122025755d --- /dev/null +++ b/modules/CIAO/examples/BasicSP/BMClosedED/config @@ -0,0 +1 @@ +BMClosedED_exec|createBMClosedEDHome_Impl|BMClosedED_svnt|createBMClosedEDHome_Servant diff --git a/modules/CIAO/examples/BasicSP/BMDevice/BMDevice.idl b/modules/CIAO/examples/BasicSP/BMDevice/BMDevice.idl new file mode 100644 index 00000000000..9c14d839875 --- /dev/null +++ b/modules/CIAO/examples/BasicSP/BMDevice/BMDevice.idl @@ -0,0 +1,31 @@ +//$Id$ +//============================================================================= +/** + * @file BMDevice.idl + * + * Definition of the BMDevice component + * + * @author Balachandran Natarajan <bala@dre.vanderbilt.edu> + */ +//============================================================================= +#ifndef CIAO_BMDEVICE_IDL +#define CIAO_BMDEVICE_IDL + +#include "BasicSP.idl" +#include "BasicSPE.idl" + +module BasicSP +{ + component BMDevice + { + provides ReadData data_read; + publishes DataAvailable data_available; + consumes TimeOut timeout; + }; + + home BMDeviceHome manages BMDevice + { + }; +}; + +#endif /*CIAO_BMDEVICE_IDL */ diff --git a/modules/CIAO/examples/BasicSP/BMDevice/BMDevice.mpc b/modules/CIAO/examples/BasicSP/BMDevice/BMDevice.mpc new file mode 100644 index 00000000000..b3c3a377bd5 --- /dev/null +++ b/modules/CIAO/examples/BasicSP/BMDevice/BMDevice.mpc @@ -0,0 +1,116 @@ +// $Id$ + +project(BMDevice_idl_gen): componentidldefaults { + custom_only = 1 + after += BasicSP_idl_gen + idlflags += -I $(CIAO_ROOT)/examples/BasicSP \ + -Wb,stub_export_macro=BMDEVICE_STUB_Export \ + -Wb,stub_export_include=BMDevice_stub_export.h \ + -Wb,skel_export_macro=BMDEVICE_SVNT_Export \ + -Wb,skel_export_include=BMDevice_svnt_export.h \ + -Wb,exec_export_macro=BMDEVICE_EXEC_Export \ + -Wb,exec_export_include=BMDevice_exec_export.h \ + + IDL_Files { + BMDevice.idl + } +} + +project(BMDevice_lem_gen) : ciaoidldefaults { + after += BasicSP_lem_gen BMDevice_idl_gen + custom_only = 1 + idlflags += -Wb,export_macro=BMDEVICE_EXEC_Export \ + -Wb,export_include=BMDevice_exec_export.h \ + -SS \ + -I $(CIAO_ROOT)/examples/BasicSP + + IDL_Files { + BMDeviceE.idl + } +} + +project(BMDevice_stub): ccm_stub { + libout = ../lib + libpaths += ../lib + after += BasicSP_stub BMDevice_idl_gen + sharedname = BMDevice_stub + includes += $(CIAO_ROOT)/examples/BasicSP + + libs += BasicSP_stub + + dynamicflags = BMDEVICE_STUB_BUILD_DLL + + IDL_Files { + } + + Header_Files { + BMDeviceC.h + BMDevice_stub_export.h + } + + Source_Files { + BMDeviceC.cpp + } + + Inline_Files { + } +} + +project(BMDevice_exec) : ciao_executor { + after += BMDevice_stub BMDevice_lem_gen BasicSP_exec + sharedname = BMDevice_exec + libs += BMDevice_stub BasicSP_stub BasicSP_exec + libout = ../lib + libpaths += ../lib + + includes += $(CIAO_ROOT)/examples/BasicSP + + dynamicflags = BMDEVICE_EXEC_BUILD_DLL + + IDL_Files { + } + + Header_Files { + BMDevice_exec.h + BMDevice_exec_export.h + BMDeviceEC.h + } + + Source_Files { + BMDevice_exec.cpp + BMDeviceEC.cpp + } + + Inline_Files { + } +} + +project(BMDevice_svnt) : ciao_servant { + after += BasicSP_svnt BMDevice_exec BasicSP_exec + includes += $(CIAO_ROOT)/examples/BasicSP + + sharedname = BMDevice_svnt + + libs += BMDevice_stub BMDevice_exec BasicSP_exec + libs += BasicSP_stub BasicSP_svnt + dynamicflags = BMDEVICE_SVNT_BUILD_DLL + libout = ../lib + libpaths += ../lib + + IDL_Files { + } + + Header_Files { + BMDeviceS.h + BMDevice_svnt.h + BMDevice_svnt_export.h + } + + Source_Files { + BMDeviceS.cpp + BMDevice_svnt.cpp + } + + Inline_Files { + } +} diff --git a/modules/CIAO/examples/BasicSP/BMDevice/BMDevice_exec.cpp b/modules/CIAO/examples/BasicSP/BMDevice/BMDevice_exec.cpp new file mode 100644 index 00000000000..50a84ba37af --- /dev/null +++ b/modules/CIAO/examples/BasicSP/BMDevice/BMDevice_exec.cpp @@ -0,0 +1,159 @@ +// $Id$ + +#include "BMDevice_exec.h" + +#define DISPLACEMENT 256 + +MyImpl::ReadData_Impl::ReadData_Impl (const char* name) + : str_ (name) +{ +} + +MyImpl::ReadData_Impl::~ReadData_Impl (void) +{ +} + +void +MyImpl::ReadData_Impl::set_name (const char* name) +{ + this->str_ = name; +} + +char * +MyImpl::ReadData_Impl::get_data (void) +{ + return CORBA::string_dup (this->str_.in()); +} + +//================================================= + +/// Default constructor. +MyImpl::BMDevice_exec_i::BMDevice_exec_i (void) + : data_read_ (new ReadData_Impl ("BM DEVICE DATA")) +{ +} + +/// Default destructor. +MyImpl::BMDevice_exec_i::~BMDevice_exec_i (void) +{ + delete this->data_read_; +} + +BasicSP::CCM_ReadData_ptr +MyImpl::BMDevice_exec_i::get_data_read (void) +{ + return + BasicSP::CCM_ReadData::_duplicate (this->data_read_); +} + +void +MyImpl::BMDevice_exec_i::push_timeout (BasicSP::TimeOut *) +{ + // Notify others + BasicSP::DataAvailable_var event = + new OBV_BasicSP::DataAvailable; + + ACE_DEBUG ((LM_EMERGENCY, + "BMDevice, received a timeout from EC\n")); + + this->context_->push_data_available (event); +} + +// Operations from Components::SessionComponent +void +MyImpl::BMDevice_exec_i:: set_session_context ( + Components::SessionContext_ptr ctx) +{ + ACE_DEBUG ((LM_EMERGENCY, + "MyImpl::BMDevice_exec_i::set_session_context\n")); + + this->context_ = + BasicSP::CCM_BMDevice_Context::_narrow (ctx); + + if (CORBA::is_nil (this->context_.in ())) + { + throw CORBA::INTERNAL (); + } + // Urm, we actually discard exceptions thown from this operation. +} + +void +MyImpl::BMDevice_exec_i::configuration_complete (void) +{ +} + +void +MyImpl::BMDevice_exec_i::ccm_activate (void) +{ + ACE_DEBUG ((LM_EMERGENCY, + "MyImpl::BMDevice_exec_i::ccm_activate\n")); +} + +void +MyImpl::BMDevice_exec_i::ccm_passivate (void) +{ + ACE_DEBUG ((LM_EMERGENCY, + "MyImpl::BMDevice_exec_i::ccm_passivate\n")); +} + +void +MyImpl::BMDevice_exec_i::ccm_remove (void) +{ + ACE_DEBUG ((LM_EMERGENCY, + "MyImpl::BMDevice_exec_i::ccm_remove\n")); +} + +extern "C" BMDEVICE_EXEC_Export ::Components::EnterpriseComponent_ptr +create_BasicSP_BMDevice_Impl (void) +{ + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_RETURN (retval, + MyImpl::BMDevice_exec_i, + ::Components::EnterpriseComponent::_nil ()); + + return retval; +} + +/// Default ctor. +MyImpl::BMDeviceHome_exec_i::BMDeviceHome_exec_i (void) +{ +} + +/// Default dtor. +MyImpl::BMDeviceHome_exec_i::~BMDeviceHome_exec_i (void) +{ +} + +// Explicit home operations. + +// Implicit home operations. + +::Components::EnterpriseComponent_ptr +MyImpl::BMDeviceHome_exec_i::create (void) +{ + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_THROW_EX (retval, + MyImpl::BMDevice_exec_i, + ::CORBA::NO_MEMORY ()); + + return retval; +} + + +extern "C" BMDEVICE_EXEC_Export ::Components::HomeExecutorBase_ptr +create_BasicSP_BMDeviceHome_Impl (void) +{ + ::Components::HomeExecutorBase_ptr retval = + ::Components::HomeExecutorBase::_nil (); + + ACE_NEW_RETURN (retval, + MyImpl::BMDeviceHome_exec_i, + ::Components::HomeExecutorBase::_nil ()); + + return retval; +} + diff --git a/modules/CIAO/examples/BasicSP/BMDevice/BMDevice_exec.h b/modules/CIAO/examples/BasicSP/BMDevice/BMDevice_exec.h new file mode 100644 index 00000000000..7dee3fc7c43 --- /dev/null +++ b/modules/CIAO/examples/BasicSP/BMDevice/BMDevice_exec.h @@ -0,0 +1,130 @@ +// $Id$ + +// ================================================================ +/** + * @file BMDevice_exec.h + * + * Header file for the actual BMDevice and BMDeviceHome component + * implementations. These classes are the implementations of local + * interfaces defined in BMDeviceEI.idl. + * + * @author Balachandran Natarajan <bala@dre.vanderbilt.edu> + */ +// ================================================================ + +#ifndef CIAO_BMDEVICE_EXEC_H +#define CIAO_BMDEVICE_EXEC_H + +#include "BMDevice_exec_export.h" +#include "BMDeviceEC.h" +#include "tao/LocalObject.h" + +namespace MyImpl +{ + /** + * @class ReadData_Impl + * + * Implementation of the ReadData interface + */ + class BMDEVICE_EXEC_Export ReadData_Impl : + public virtual ::BasicSP::CCM_ReadData, + public virtual ::CORBA::LocalObject + { + public: + /// Constructor + ReadData_Impl(const char* name); + + void set_name (const char* name); + + virtual char * + get_data (void); + + ~ReadData_Impl (void); + + private: + CORBA::String_var str_; + }; + + /** + * @class BMDEVICE_exec_i + * + * An example RateGen executor implementation class. + */ + class BMDEVICE_EXEC_Export BMDevice_exec_i : + public virtual CIAO_BasicSP_BMDevice_Impl::BMDevice_Exec, + public virtual ::CORBA::LocalObject + { + public: + /// Default constructor. + BMDevice_exec_i (void); + + /// Default destructor. + ~BMDevice_exec_i (void); + + // Operations from BasicSP::BMDevice + + virtual BasicSP::CCM_ReadData_ptr + get_data_read (void); + + virtual void + push_timeout (BasicSP::TimeOut *ev); + + // Operations from Components::SessionComponent + + virtual void + set_session_context (Components::SessionContext_ptr ctx); + + virtual void + configuration_complete (void); + + virtual void + ccm_activate (void); + + virtual void + ccm_passivate (void); + + virtual void + ccm_remove (void); + protected: + + /// Copmponent specific context + BasicSP::CCM_BMDevice_Context_var context_; + + private: + MyImpl::ReadData_Impl* data_read_; + }; + + extern "C" BMDEVICE_EXEC_Export ::Components::EnterpriseComponent_ptr + create_BasicSP_BMDevice_Impl (void); + + /** + * @class BMDeviceHome_exec_i + * + * BMDevice home executor implementation class. + */ + class BMDEVICE_EXEC_Export BMDeviceHome_exec_i : + public virtual CIAO_BasicSP_BMDevice_Impl::BMDeviceHome_Exec, + public virtual ::CORBA::LocalObject + { + public: + /// Default ctor. + BMDeviceHome_exec_i (void); + + /// Default dtor. + ~BMDeviceHome_exec_i (void); + + // Explicit home operations. + + // Implicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + create (void); + }; +} + +// Executor DLL entry point. CIAO's deployment and assembly framework +// invokes this function on the resulting DLL to get the home executor. +extern "C" BMDEVICE_EXEC_Export ::Components::HomeExecutorBase_ptr +createBMDeviceHome_Impl (void); + +#endif /* CIAO_BMDEVICE_EXEC_H*/ diff --git a/modules/CIAO/examples/BasicSP/BMDisplay/BMDisplay.idl b/modules/CIAO/examples/BasicSP/BMDisplay/BMDisplay.idl new file mode 100644 index 00000000000..1bcf144de33 --- /dev/null +++ b/modules/CIAO/examples/BasicSP/BMDisplay/BMDisplay.idl @@ -0,0 +1,21 @@ +//$Id$ + +#ifndef BMDISPLAY_IDL +#define BMDISPLAY_IDL + +#include "BasicSP.idl" + +module BasicSP +{ + component BMDisplay + { + consumes DataAvailable data_ready; + uses ReadData comp_data; + }; + + home BMDisplayHome manages BMDisplay + { + }; +}; + +#endif /* BMDISPLAY_IDL */ diff --git a/modules/CIAO/examples/BasicSP/BMDisplay/BMDisplay.mpc b/modules/CIAO/examples/BasicSP/BMDisplay/BMDisplay.mpc new file mode 100644 index 00000000000..c3e3f300173 --- /dev/null +++ b/modules/CIAO/examples/BasicSP/BMDisplay/BMDisplay.mpc @@ -0,0 +1,118 @@ +// $Id$ + +project(BMDisplay_idl_gen): componentidldefaults,anytypecode { + custom_only = 1 + idlflags += -I $(CIAO_ROOT)/examples/BasicSP \ + -Wb,stub_export_macro=BMDISPLAY_STUB_Export \ + -Wb,stub_export_include=BMDisplay_stub_export.h \ + -Wb,skel_export_macro=BMDISPLAY_SVNT_Export \ + -Wb,skel_export_include=BMDisplay_svnt_export.h \ + -Wb,exec_export_macro=BMDISPLAY_EXEC_Export \ + -Wb,exec_export_include=BMDisplay_exec_export.h \ + + IDL_Files { + BMDisplay.idl + } +} + +project(BMDisplay_lem_gen) : ciaoidldefaults { + after += BasicSP_lem_gen BMDisplay_idl_gen + custom_only = 1 + + idlflags += -I $(CIAO_ROOT)/examples/BasicSP \ + -Wb,export_macro=BMDISPLAY_EXEC_Export \ + -Wb,export_include=BMDisplay_exec_export.h \ + -SS + + IDL_Files { + BMDisplayE.idl + } + +} + +project(BMDisplay_stub): ccm_stub { + after += BasicSP_stub BMDisplay_idl_gen + sharedname = BMDisplay_stub + includes += $(CIAO_ROOT)/examples/BasicSP + libout = ../lib + libpaths += ../lib + + libs += BasicSP_stub + + dynamicflags = BMDISPLAY_STUB_BUILD_DLL + + IDL_Files { + } + + Header_Files { + BMDisplayC.h + BMDisplay_stub_export.h + } + + Source_Files { + BMDisplayC.cpp + } + + Inline_Files { + } +} + +project(BMDisplay_exec) : ciao_executor { + after += BMDisplay_stub BMDisplay_lem_gen + + sharedname = BMDisplay_exec + libs += BMDisplay_stub + libs += BasicSP_stub + includes += $(CIAO_ROOT)/examples/BasicSP + libout = ../lib + libpaths += ../lib + + dynamicflags = BMDISPLAY_EXEC_BUILD_DLL + + IDL_Files { + } + + Header_Files { + BMDisplay_exec.h + BMDisplay_exec_export.h + BMDisplayEC.h + } + + Source_Files { + BMDisplay_exec.cpp + BMDisplayEC.cpp + } + + Inline_Files { + } +} + +project(BMDisplay_svnt) : ciao_servant { + after += BasicSP_svnt BMDisplay_exec + includes += $(CIAO_ROOT)/examples/BasicSP + + sharedname = BMDisplay_svnt + + libs += BMDisplay_stub BMDisplay_exec + libs += BasicSP_stub BasicSP_svnt + dynamicflags = BMDISPLAY_SVNT_BUILD_DLL + libout = ../lib + libpaths += ../lib + + IDL_Files { + } + + Source_Files { + BMDisplayS.cpp + BMDisplay_svnt.cpp + } + + Header_Files { + BMDisplayS.h + BMDisplay_svnt.h + BMDisplay_svnt_export.h + } + + Inline_Files { + } +} diff --git a/modules/CIAO/examples/BasicSP/BMDisplay/BMDisplay_exec.cpp b/modules/CIAO/examples/BasicSP/BMDisplay/BMDisplay_exec.cpp new file mode 100644 index 00000000000..c52461c27dd --- /dev/null +++ b/modules/CIAO/examples/BasicSP/BMDisplay/BMDisplay_exec.cpp @@ -0,0 +1,142 @@ +// $Id$ + +#include "BMDisplay_exec.h" + +/// Default constructor. +MyImpl::BMDisplay_exec_i::BMDisplay_exec_i () +{ +} + +/// Default destructor. +MyImpl::BMDisplay_exec_i::~BMDisplay_exec_i () +{ +} + +// Operations from BasicSP::BMDisplay + +void +MyImpl::BMDisplay_exec_i::push_data_ready ( + BasicSP::DataAvailable *ev + ) +{ + ACE_UNUSED_ARG (ev); + + ACE_DEBUG ((LM_EMERGENCY, + "BMDisplay - Doing computations\n")); + + ACE_DEBUG ((LM_EMERGENCY, + "BMDisplay - Doing data fetch\n")); + // Refresh position + BasicSP::ReadData_var dat + = this->context_->get_connection_comp_data (); + + if (CORBA::is_nil (dat.in ())) + throw CORBA::BAD_INV_ORDER (); + + CORBA::String_var str = + dat->get_data (); + + ACE_DEBUG ((LM_EMERGENCY, + "BMDisplay - Display data is [%s]\n", + str.in ())); + +} + +// Operations from Components::SessionComponent +void +MyImpl::BMDisplay_exec_i::set_session_context ( + Components::SessionContext_ptr ctx + ) +{ + ACE_DEBUG ((LM_EMERGENCY, + "MyImpl::BMDisplay_exec_i::set_session_context\n")); + this->context_ = + BasicSP::CCM_BMDisplay_Context::_narrow (ctx); + + if (CORBA::is_nil (this->context_.in ())) + throw CORBA::INTERNAL (); + // Urm, we actually discard exceptions thown from this operation. +} + +void +MyImpl::BMDisplay_exec_i::configuration_complete ( + ) +{ +} + +void +MyImpl::BMDisplay_exec_i::ccm_activate () +{ + ACE_DEBUG ((LM_EMERGENCY, + "MyImpl::BMDisplay_exec_i::ccm_activate\n")); +} + +void +MyImpl::BMDisplay_exec_i::ccm_passivate ( + ) +{ + ACE_DEBUG ((LM_EMERGENCY, + "MyImpl::BMDisplay_exec_i::ccm_passivate\n")); +} + +void +MyImpl::BMDisplay_exec_i::ccm_remove () +{ + ACE_DEBUG ((LM_EMERGENCY, + "MyImpl::BMDisplay_exec_i::ccm_remove\n")); +} + +extern "C" BMDISPLAY_EXEC_Export ::Components::EnterpriseComponent_ptr +create_BasicSP_BMDisplay_Impl (void) +{ + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_RETURN (retval, + MyImpl::BMDisplay_exec_i, + ::Components::EnterpriseComponent::_nil ()); + + return retval; +} + +/// Default ctor. +MyImpl::BMDisplayHome_exec_impl::BMDisplayHome_exec_impl () +{ +} + +/// Default dtor. +MyImpl::BMDisplayHome_exec_impl::~BMDisplayHome_exec_impl () +{ +} + +// Explicit home operations. + +// Implicit home operations. + +::Components::EnterpriseComponent_ptr +MyImpl::BMDisplayHome_exec_impl::create () +{ + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_THROW_EX ( + retval, + MyImpl::BMDisplay_exec_i, + ::CORBA::NO_MEMORY ()); + + return retval; +} + +extern "C" BMDISPLAY_EXEC_Export ::Components::HomeExecutorBase_ptr +create_BasicSP_BMDisplayHome_Impl (void) +{ + ::Components::HomeExecutorBase_ptr retval = + ::Components::HomeExecutorBase::_nil (); + + ACE_NEW_RETURN ( + retval, + MyImpl::BMDisplayHome_exec_impl, + ::Components::HomeExecutorBase::_nil ()); + + return retval; +} diff --git a/modules/CIAO/examples/BasicSP/BMDisplay/BMDisplay_exec.h b/modules/CIAO/examples/BasicSP/BMDisplay/BMDisplay_exec.h new file mode 100644 index 00000000000..e52ceb879a0 --- /dev/null +++ b/modules/CIAO/examples/BasicSP/BMDisplay/BMDisplay_exec.h @@ -0,0 +1,96 @@ +// $Id$ + +//============================================================== +/** + * @file BMDisplay_exec.h + * + * Header file for the actual BMDisplay and BMDisplayHome component + * implementations. + * + * @author Balachandran Natarajan <bala@dre.vanderbilt.edu> + */ +//============================================================== +#ifndef CIAO_BMDISPLAY_EXEC_H +#define CIAO_BMDISPLAY_EXEC_H + +#include "BMDisplayEC.h" +#include "tao/LocalObject.h" +#include "BMDisplay_exec_export.h" + +namespace MyImpl +{ + /** + * @class BMDisplay_exec_i + * + * RateGen executor implementation class. + */ + class BMDISPLAY_EXEC_Export BMDisplay_exec_i : + public virtual CIAO_BasicSP_BMDisplay_Impl::BMDisplay_Exec, + public virtual ::CORBA::LocalObject + { + public: + /// Default constructor. + BMDisplay_exec_i (); + + /// Default destructor. + ~BMDisplay_exec_i (); + + // Operations from BasicSP::BMDisplay + + virtual void + push_data_ready (BasicSP::DataAvailable *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 + BasicSP::CCM_BMDisplay_Context_var context_; + }; + + extern "C" BMDISPLAY_EXEC_Export ::Components::EnterpriseComponent_ptr + create_BasicSP_BMDisplay_Impl (void); + + /** + * @class BMDisplayHome_exec_impl + * + * BMDisplay home executor implementation class. + */ + class BMDISPLAY_EXEC_Export BMDisplayHome_exec_impl : + public virtual CIAO_BasicSP_BMDisplay_Impl::BMDisplayHome_Exec, + public virtual ::CORBA::LocalObject + { + public: + /// Default ctor. + BMDisplayHome_exec_impl (); + + /// Default dtor. + ~BMDisplayHome_exec_impl (); + + // Explicit home operations. + + // Implicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + create (); + }; + +} + +extern "C" BMDISPLAY_EXEC_Export ::Components::HomeExecutorBase_ptr +createBMDisplayHome_Impl (void); + +#endif /* BMDISPLAY_EXEC_H */ diff --git a/modules/CIAO/examples/BasicSP/BasicSP.idl b/modules/CIAO/examples/BasicSP/BasicSP.idl new file mode 100644 index 00000000000..0b000c9cf56 --- /dev/null +++ b/modules/CIAO/examples/BasicSP/BasicSP.idl @@ -0,0 +1,48 @@ +// $Id$ +//============================================================================= +/** + * @file BasicSP.idl + * + * Definition of events, and common interfaces used in the BasicSP module. + * + * @author Balachandran Natarajan <bala@dre.vanderbilt.edu> + */ +//============================================================================= + +#ifndef CIAO_BASIC_SP_IDL +#define CIAO_BASIC_SP_IDL + +#include <Components.idl> + +// @@NOTE: Do we need a pragma prefix. Anyway its broken now in TAO.. +// #pragma prefix "" + +module BasicSP +{ + + /** + * @NOTE: Not sure whether this is a good abstraction. Just copying + * the stuff from Cadena folks. + */ + /** + * @interface ReadData + * + */ + + interface ReadData { + string get_data (); + }; + + /** + * @eventtype Events that represent timeouts + */ + eventtype TimeOut {}; + + /** + * @eventtype Events that represent data availability + */ + eventtype DataAvailable {}; + +}; + +#endif /*CIAO_BASIC_SP_IDL*/ diff --git a/modules/CIAO/examples/BasicSP/BasicSP.mpc b/modules/CIAO/examples/BasicSP/BasicSP.mpc new file mode 100644 index 00000000000..177c0f373a6 --- /dev/null +++ b/modules/CIAO/examples/BasicSP/BasicSP.mpc @@ -0,0 +1,100 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -n HUDisplay" + +project(BasicSP_idl_gen): componentidldefaults { + custom_only = 1 + idlflags += -Wb,stub_export_macro=BASICSP_STUB_Export \ + -Wb,stub_export_include=BasicSP_stub_export.h \ + -Wb,skel_export_macro=BASICSP_SVNT_Export \ + -Wb,skel_export_include=BasicSP_svnt_export.h \ + -Wb,exec_export_macro=BASICSP_EXEC_Export \ + -Wb,exec_export_include=BasicSP_exec_export.h + + IDL_Files { + BasicSP.idl + } +} + +project(BasicSP_lem_gen) : ciaoidldefaults { + custom_only = 1 + after += BasicSP_idl_gen + idlflags += -Wb,export_macro=BASICSP_EXEC_Export \ + -Wb,export_include=BasicSP_exec_export.h \ + -SS + + IDL_Files { + BasicSPE.idl + } +} + +project(BasicSP_stub): ccm_stub { + after += BasicSP_lem_gen + sharedname = BasicSP_stub + dynamicflags = BASICSP_STUB_BUILD_DLL + includes += $(CIAO_ROOT)/examples/BasicSP + libout = lib + libpaths += lib + + IDL_Files { + } + Header_Files { + BasicSPC.h + } + Source_Files { + BasicSPC.cpp + } + Inline_Files { + } +} + +project(BasicSP_svnt) : ciao_servant { + after += BasicSP_exec + sharedname = BasicSP_svnt + libs += BasicSP_exec BasicSP_stub + includes += $(CIAO_ROOT)/examples/BasicSP + dynamicflags = BASICSP_SVNT_BUILD_DLL + libout = lib + libpaths += lib + + IDL_Files { + } + + Header_Files { + BasicSPS.h + BasicSP_svnt.h + } + + Source_Files { + BasicSPS.cpp + BasicSP_svnt.cpp + } + + Inline_Files { + } +} + +project(BasicSP_exec) : ciao_executor { + after += BasicSP_stub BasicSP_lem_gen + sharedname = BasicSP_exec + libs += BasicSP_stub + dynamicflags = BASICSP_EXEC_BUILD_DLL + includes += $(CIAO_ROOT)/examples/BasicSP + libout = lib + libpaths += lib + + IDL_Files { + } + + Header_Files { + BasicSP_exec_export.h + BasicSPEC.h + } + + Source_Files { + BasicSPEC.cpp + } + + Inline_Files { + } +} + diff --git a/modules/CIAO/examples/BasicSP/BasicSP.mwc b/modules/CIAO/examples/BasicSP/BasicSP.mwc new file mode 100644 index 00000000000..781791601d9 --- /dev/null +++ b/modules/CIAO/examples/BasicSP/BasicSP.mwc @@ -0,0 +1,9 @@ +// $Id$ + +workspace { + BasicSP.mpc + BMClosedED/BMClosedED.mpc + BMDevice/BMDevice.mpc + BMDisplay/BMDisplay.mpc + EC/EC.mpc +} diff --git a/modules/CIAO/examples/BasicSP/EC/EC.idl b/modules/CIAO/examples/BasicSP/EC/EC.idl new file mode 100644 index 00000000000..93cce410942 --- /dev/null +++ b/modules/CIAO/examples/BasicSP/EC/EC.idl @@ -0,0 +1,41 @@ +// $Id$ +//============================================================================= +/** + * @file EC.idl + * + * Definition of events, and common interfaces used in the BasicSP module. + * + * @author Balachandran Natarajan <bala@dre.vanderbilt.edu> + */ +//============================================================================= + +#ifndef CIAO_EC_IDL +#define CIAO_EC_IDL + +#include "BasicSP.idl" + +module BasicSP +{ + interface trigger + { + void start (); + void stop (); + }; + + component EC supports trigger + { + publishes TimeOut timeout; + + /// The attribute can be configured via the home or the + /// component property file. + attribute long hertz; + }; + + home ECHome manages EC + { + // Explicit operations + factory new_EC (in long hertz); + }; +}; + +#endif /* CIAO_EC_IDL*/ diff --git a/modules/CIAO/examples/BasicSP/EC/EC.mpc b/modules/CIAO/examples/BasicSP/EC/EC.mpc new file mode 100644 index 00000000000..ee27913422c --- /dev/null +++ b/modules/CIAO/examples/BasicSP/EC/EC.mpc @@ -0,0 +1,157 @@ +// $Id$ + +project(EC_idl_gen): componentidldefaults { + custom_only = 1 + idlflags += -I $(CIAO_ROOT)/examples/BasicSP \ + -Wb,stub_export_macro=EC_STUB_Export \ + -Wb,stub_export_include=EC_stub_export.h \ + -Wb,skel_export_macro=EC_SVNT_Export \ + -Wb,skel_export_include=EC_svnt_export.h \ + -Wb,exec_export_macro=EC_EXEC_Export \ + -Wb,exec_export_include=EC_exec_export.h + + IDL_Files { + EC.idl + } +} + +project(EC_lem_gen) : ciaoidldefaults { + after += BasicSP_lem_gen EC_idl_gen + custom_only = 1 + + idlflags += -Wb,export_macro=EC_EXEC_Export \ + -Wb,export_include=EC_exec_export.h \ + -SS \ + -I $(CIAO_ROOT)/examples/BasicSP + + IDL_Files { + ECE.idl + } +} + +project(EC_stub): ccm_stub { + after += BasicSP_stub EC_idl_gen + sharedname = EC_stub + includes += $(CIAO_ROOT)/examples/BasicSP + libpaths += .. + libout = ../lib + libpaths += ../lib + + libs += BasicSP_stub + + dynamicflags = EC_STUB_BUILD_DLL + + IDL_Files { + } + + Header_Files { + ECC.h + EC_stub_export.h + } + + Source_Files { + ECC.cpp + } + + Inline_Files { + } +} + +project(EC_exec) : ciao_executor { + after += EC_stub EC_lem_gen + sharedname = EC_exec + libs += EC_stub BasicSP_stub + includes += $(CIAO_ROOT)/examples/BasicSP + libout = ../lib + libpaths += ../lib + + dynamicflags = EC_EXEC_BUILD_DLL + + IDL_Files { + } + + Header_Files { + EC_exec.h + EC_exec_export.h + ECEC.h + } + + Source_Files { + EC_exec.cpp + ECEC.cpp + } + + Inline_Files { + } +} + +project(EC_svnt) : ciao_servant { + after += BasicSP_svnt EC_exec + includes += $(CIAO_ROOT)/examples/BasicSP + + sharedname = EC_svnt + + libs += EC_stub EC_exec + libs += BasicSP_stub BasicSP_svnt + dynamicflags = EC_SVNT_BUILD_DLL + libout = ../lib + libpaths += ../lib + + IDL_Files { + } + + Header_Files { + ECS.h + EC_svnt.h + EC_svnt_export.h + } + + Source_Files { + ECS.cpp + EC_svnt.cpp + } +} + +project (EC_client) : ccm_stub { + after += EC_stub + exename = client + libs += EC_stub BasicSP_stub + includes += $(CIAO_ROOT)/examples/BasicSP + libout = ../lib + libpaths += ../lib + + IDL_Files { + } + + Header_Files { + } + + Source_Files { + client.cpp + } + + Inline_Files { + } +} + +project (EC_controller) : ccm_stub { + after += EC_stub + exename = controller + includes += $(CIAO_ROOT)/examples/BasicSP + libs += EC_stub BasicSP_stub + libout = ../lib + libpaths += ../lib + + IDL_Files { + } + + Header_Files { + } + + Source_Files { + controller.cpp + } + + Inline_Files { + } +} diff --git a/modules/CIAO/examples/BasicSP/EC/EC_exec.cpp b/modules/CIAO/examples/BasicSP/EC/EC_exec.cpp new file mode 100644 index 00000000000..9c903f9b2c0 --- /dev/null +++ b/modules/CIAO/examples/BasicSP/EC/EC_exec.cpp @@ -0,0 +1,296 @@ +// $Id$ + +#include "EC_exec.h" +#include "ace/Timer_Queue.h" +#include "ace/Reactor.h" + +//================================================================= + +MyImpl::timeout_Handler::timeout_Handler (MyImpl::EC_exec_i *cb) + : active_ (0), + done_ (0), + tid_ (0), + pulse_callback_ (cb) +{ + // Nothing + this->reactor (new ACE_Reactor); +} + +MyImpl::timeout_Handler::~timeout_Handler () +{ + delete this->reactor (); + this->reactor (0); +} + +int +MyImpl::timeout_Handler::open_h () +{ + return this->activate (); +} + +int +MyImpl::timeout_Handler::close_h () +{ + this->done_ = 1; + this->reactor ()->notify (); + + ACE_DEBUG ((LM_EMERGENCY, "Waiting\n")); + return this->wait (); +} + +int +MyImpl::timeout_Handler::start (CORBA::Long hertz) +{ + if (hertz == 0 || this->active_ != 0) // Not valid + return -1; + + long usec = 1000000 / hertz; + + this->tid_ = this->reactor ()->schedule_timer (this, + 0, + ACE_Time_Value (0, usec), + ACE_Time_Value (0, usec)); + + this->active_ = 1; + return 0; +} + +int +MyImpl::timeout_Handler::stop (void) +{ + if (this->active_ == 0) // Not valid. + return -1; + + this->reactor ()->cancel_timer (this); + + this->active_ = 0; + return 0; +} + +int +MyImpl::timeout_Handler::active (void) +{ + return this->active_; +} + +int +MyImpl::timeout_Handler::handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask close_mask) +{ + ACE_DEBUG ((LM_EMERGENCY, + ACE_TEXT ("[%x] handle = %d, close_mask = %d\n"), + this, + handle, + close_mask)); + + return 0; +} + +int +MyImpl::timeout_Handler::handle_timeout (const ACE_Time_Value &, + const void *) +{ + this->pulse_callback_->pulse (); + + // ACE_DEBUG ((LM_EMERGENCY, + // ACE_TEXT ("[%x] with count #%05d timed out at %d.%d!\n"), + // this, + // tv.sec (), + // tv.usec ())); + + return 0; +} + +int +MyImpl::timeout_Handler::svc (void) +{ + this->reactor ()->owner (ACE_OS::thr_self ()); + + while (!this->done_) + this->reactor ()->handle_events (); + + return 0; +} + +//================================================================= + +MyImpl::EC_exec_i::EC_exec_i () + : hertz_ (0), + pulser_ (this) +{ + +} + +MyImpl::EC_exec_i::EC_exec_i (CORBA::Long hz) + : hertz_ (hz), + pulser_ (this) +{ +} + +MyImpl::EC_exec_i::~EC_exec_i () +{ +} + +CORBA::Long +MyImpl::EC_exec_i::hertz () +{ + return this->hertz_; +} + +void +MyImpl::EC_exec_i::hertz (CORBA::Long hertz) +{ + this->hertz_ = hertz; +} + +// Operations from supported interface(s) + +void +MyImpl::EC_exec_i::start () +{ + if (this->hertz_ == 0 || this->pulser_.active()) + throw CORBA::BAD_INV_ORDER (); + + // @@ Start the rate generator + this->pulser_.start (this->hertz_); +} + +void +MyImpl::EC_exec_i::stop () +{ + if (! this->pulser_.active ()) + throw CORBA::BAD_INV_ORDER (); + + // @@ stop the rate generator + this->pulser_.stop (); +} + +CORBA::Boolean +MyImpl::EC_exec_i::active () +{ + return this->pulser_.active (); +} + +// Operations from Components::SessionComponent + +void +MyImpl::EC_exec_i::set_session_context (Components::SessionContext_ptr ctx) +{ + ACE_DEBUG ((LM_EMERGENCY, "MyImpl::EC_exec_i::set_session_context\n")); + + this->context_ = + BasicSP::CCM_EC_Context::_narrow (ctx); + + if (CORBA::is_nil (this->context_.in ())) + throw CORBA::INTERNAL (); + // Urm, we actually discard exceptions thown from this operation. + +} + +void +MyImpl::EC_exec_i::configuration_complete () +{ +} + +void +MyImpl::EC_exec_i::ccm_activate () +{ + ACE_DEBUG ((LM_EMERGENCY, "MyImpl::EC_exec_i::ccm_activate\n")); + + this->pulser_.open_h (); +} + +void +MyImpl::EC_exec_i::ccm_passivate () +{ + ACE_DEBUG ((LM_EMERGENCY, "MyImpl::EC_exec_i::ccm_passivate\n")); + this->pulser_.close_h (); +} + +void +MyImpl::EC_exec_i::ccm_remove () +{ + ACE_DEBUG ((LM_EMERGENCY, "MyImpl::EC_exec_i::ccm_remove\n")); +} + +void +MyImpl::EC_exec_i::pulse (void) +{ + try + { + ACE_DEBUG ((LM_EMERGENCY, + ACE_TEXT ("Pushing BasicSP::TimeOut event!\n"))); + + BasicSP::TimeOut_var ev = new OBV_BasicSP::TimeOut (); + + this->context_->push_timeout (ev.in ()); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Caught exception while pushing " + "BasicSP::TimeOut event to BMDevice"); + } +} + +extern "C" EC_EXEC_Export ::Components::EnterpriseComponent_ptr +create_BasicSP_EC_Impl (void) +{ + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_RETURN (retval, + MyImpl::EC_exec_i, + ::Components::EnterpriseComponent::_nil ()); + + return retval; +} + +MyImpl::ECHome_exec_i::ECHome_exec_i () +{ +} + +MyImpl::ECHome_exec_i::~ECHome_exec_i () +{ +} + +::Components::EnterpriseComponent_ptr +MyImpl::ECHome_exec_i::new_EC (CORBA::Long hertz) +{ + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_THROW_EX ( + retval, + MyImpl::EC_exec_i (hertz), + ::CORBA::NO_MEMORY ()); + + return retval; +} + +::Components::EnterpriseComponent_ptr +MyImpl::ECHome_exec_i::create () +{ + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_THROW_EX ( + retval, + MyImpl::EC_exec_i, + ::CORBA::NO_MEMORY ()); + + return retval; +} + +extern "C" EC_EXEC_Export ::Components::HomeExecutorBase_ptr +create_BasicSP_ECHome_Impl (void) +{ + ::Components::HomeExecutorBase_ptr retval = + ::Components::HomeExecutorBase::_nil (); + + ACE_NEW_RETURN ( + retval, + MyImpl::ECHome_exec_i, + ::Components::HomeExecutorBase::_nil ()); + + return retval; +} diff --git a/modules/CIAO/examples/BasicSP/EC/EC_exec.h b/modules/CIAO/examples/BasicSP/EC/EC_exec.h new file mode 100644 index 00000000000..e42352971cd --- /dev/null +++ b/modules/CIAO/examples/BasicSP/EC/EC_exec.h @@ -0,0 +1,168 @@ +// $Id$ + +//============================================================ +/** + * @file EC_exec.h + * + * Header file for the actualy EC and ECHome component + * implementation. + * + * @author Balachandran Natarajan <bala@dre.vanderbilt.edu> + */ +//============================================================ + +#ifndef EC_EXEC_H +#define EC_EXEC_H + +#include "ECEC.h" +#include "tao/LocalObject.h" +#include "ace/Thread_Manager.h" +#include "ace/Task.h" +#include "EC_exec_export.h" + +namespace MyImpl +{ + // Forward decl. + class EC_exec_i; + + /** + * @brief Active pulse generater + */ + class timeout_Handler : public ACE_Task_Base + { + public: + // Default constructor + timeout_Handler (EC_exec_i *cb); + ~timeout_Handler (); + + int open_h (void); + + int close_h (void); + + int start (CORBA::Long hertz); + + int stop (void); + + int active (void); + + // Handle the timeout. + virtual int handle_timeout (const ACE_Time_Value &tv, + const void *arg); + + // Called when <Time_Handler> is removed. + virtual int handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask close_mask); + + virtual int svc (void); + + private: + /// Tracking whether we are actively generating pulse or not. + long active_; + + /// Flag to indicate completion of this active object. + int done_; + + /// The timer id we are waiting. + long tid_; + + EC_exec_i *pulse_callback_; + + ACE_Thread_Manager thr_mgr_; + }; + + extern "C" EC_EXEC_Export ::Components::EnterpriseComponent_ptr + create_BasicSP_EC_Impl (void); + + /** + * @class EC_exec_i + * + * EC executor implementation class. + */ + class EC_EXEC_Export EC_exec_i : + public virtual CIAO_BasicSP_EC_Impl::EC_Exec, + public virtual ::CORBA::LocalObject + { + public: + /// Default constructor. + EC_exec_i (); + + /// Initialize with a default frequency. + EC_exec_i (CORBA::Long hz); + + /// Default destructor. + ~EC_exec_i (); + + // Attribute operations. + + virtual CORBA::Long hertz (); + + virtual void hertz (CORBA::Long hertz); + + // Operations from supported interface(s) + + virtual void start (); + + virtual void stop (); + + virtual CORBA::Boolean active (); + + // 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 (); + + /// Helper function to be called back by timeout_Handler + void pulse (void); + + protected: + /// Frequency + CORBA::Long hertz_; + + /// Copmponent specific context + BasicSP::CCM_EC_Context_var context_; + + /// An active object that actually trigger the generation of + /// periodic events. + timeout_Handler pulser_; + }; + + /** + * @class ECHome_exec_i + * + * EC home executor implementation class. + */ + class EC_EXEC_Export ECHome_exec_i : + public virtual ::CIAO_BasicSP_EC_Impl::ECHome_Exec, + public virtual ::CORBA::LocalObject + { + public: + /// Default ctor. + ECHome_exec_i (); + + /// Default dtor. + ~ECHome_exec_i (); + + // Explicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + new_EC (CORBA::Long hertz); + + // Implicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + create (); + }; + +} + +extern "C" EC_EXEC_Export ::Components::HomeExecutorBase_ptr +createECHome_Impl (void); + +#endif /* CIAO_ECGEN_EXEC_H */ diff --git a/modules/CIAO/examples/BasicSP/EC/README b/modules/CIAO/examples/BasicSP/EC/README new file mode 100644 index 00000000000..7e032780ab1 --- /dev/null +++ b/modules/CIAO/examples/BasicSP/EC/README @@ -0,0 +1,9 @@ +/** + +@page EC README File + + The EC component. This shouldnt be needed if we had a way to +integrate EC sugly into CIAO. We dont at the time of writing this +example on May 12, 2003. Hence this holy hack! + +*/ diff --git a/modules/CIAO/examples/BasicSP/EC/client.cpp b/modules/CIAO/examples/BasicSP/EC/client.cpp new file mode 100644 index 00000000000..ace0a8c1209 --- /dev/null +++ b/modules/CIAO/examples/BasicSP/EC/client.cpp @@ -0,0 +1,62 @@ +// $Id$ + +//============================================================== +/** + * @file client.cpp + * + * This is a simple client test program that interact with the EC + * component implementation. This test uses the explicit factory + * operation in the home interface to create a EC component + * instance, run it for a while, and destroy the component instance. + */ +//============================================================== + +#include "ECC.h" +#include "ace/streams.h" +#include "ace/OS_NS_unistd.h" + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + try + { + // Initialize orb + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + + // Resolve HomeFinder interface + + CORBA::Object_var obj + = orb->string_to_object ("file://ec.ior"); + + BasicSP::ECHome_var home + = BasicSP::ECHome::_narrow (obj.in ()); + + if (CORBA::is_nil (home.in ())) + ACE_ERROR_RETURN ((LM_ERROR, "Unable to acquire ECHome objref\n"), -1); + + BasicSP::EC_var pulser + = home->create (); + + // Place to plug in the rate + pulser->hertz (5); + + pulser->start (); + + ACE_OS::sleep (45); + + pulser->stop (); + + home->remove_component (pulser.in ()); + + orb->destroy (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Who is the culprit\n"); + ACE_ERROR_RETURN ((LM_ERROR, + "Uncaught CORBA exception\n"), + 1); + } + + return 0; +} diff --git a/modules/CIAO/examples/BasicSP/EC/controller.cpp b/modules/CIAO/examples/BasicSP/EC/controller.cpp new file mode 100644 index 00000000000..5897abb93ee --- /dev/null +++ b/modules/CIAO/examples/BasicSP/EC/controller.cpp @@ -0,0 +1,126 @@ +// $Id$ + +/** + * @file controller.cpp + * + * This program interact with a EC component, and set the rate of the + * EC. + */ + +#include "ECC.h" +#include "ace/Get_Opt.h" +#include "ace/streams.h" + +const ACE_TCHAR *rategen_ior_ = ACE_TEXT("file://rategen.ior"); +int rate = 3; +int turn_on = 1; + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:r:of")); + int c; + + while ((c = get_opts ()) != -1) + { + switch (c) + { + case 'o': + turn_on = 1; + break; + + case 'f': + turn_on = 0; + break; + + case 'k': + rategen_ior_ = get_opts.opt_arg (); + break; + + case 'r': + rate = ACE_OS::atoi (get_opts.opt_arg ()); + break; + + case '?': // display help for use of the server. + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s\n" + "-o (Turn on the rate generator)\n" + "-f (Turn off the rate generator)\n" + "-k <EC IOR> (default is file://rategen.ior)\n" + "-r <rate in hertz> (default is 3)\n" + "\n", + argv [0]), + -1); + break; + } + } + + if (rategen_ior_ == 0) + { + rategen_ior_ = ACE_TEXT("file://ec.ior"); + } + + if (rate == 0) + { + rate = 3; + } + + 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 (rategen_ior_); + + BasicSP::EC_var pulser + = BasicSP::EC::_narrow (obj.in ()); + + if (CORBA::is_nil (pulser.in ())) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to acquire 'EC' objref\n"), + -1); + } + + pulser->hertz (rate); + + if (turn_on) + { + pulser->hertz (rate); + + ACE_DEBUG ((LM_EMERGENCY, "Start up the Event services\n")); + + pulser->start (); + } + else + { + pulser->stop (); + + ACE_DEBUG ((LM_EMERGENCY, "Stop the ES\n")); + } + + orb->destroy (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Who is the culprit\n"); + ACE_ERROR_RETURN ((LM_ERROR, + "Uncaught CORBA exception\n"), + 1); + } + + return 0; +} diff --git a/modules/CIAO/examples/BasicSP/README.html b/modules/CIAO/examples/BasicSP/README.html new file mode 100644 index 00000000000..9bd740215e1 --- /dev/null +++ b/modules/CIAO/examples/BasicSP/README.html @@ -0,0 +1,70 @@ +<HTML> +<!-- $Id$ --> +<BODY> + +This document describes how to compile/run the BasicSP (HUDisplay) example with the new DnC implementation. + +<H3> Installing </H3> + +<UL> + <LI> Make sure you have the latest DAnCE framework built. + </LI> + + <LI> + Get the latest cidl compiler (if you did not compile from source) from: + <A href="http://www.dre.vanderbilt.edu/cidlc/binary/"> + http://www.dre.vanderbilt.edu/cidlc/binary/ + </A> + + Copy the file into the <code> $CIAO_ROOT/bin </code> directory. + Build ACE, TAO, DAnCE before you proceed. + + <br><br> + <em>NOTE</em>: <br> + While buiding DAnCE, we also suggest that you build the tests in the $CIAO_ROOT/test directory and make sure + all the tests run OK before you proceed to try out the BasicSP example or any other DAnCE-based + applications. To do this, open the file + + $ACE_ROOT/bin/MakeProjectCreator/config/global.features, + + then change the line from "cidl = 0" to "cidl = 1". <br><br> + + After this, go back to the $CIAO_ROOT/DAnCE directory to generate your workspace/project or makefile by using MPC.<br> + After the DAnCE and the tests are build OK, go to the $CIAO_ROOT/DAnCE/tests/NodeApplicationTest directory and make + sure all the three perl scripts (run_test.pl, run_test_simple.pl and run_test_ex.pl) run successfully. + + <br><br> + </LI> + + <LI> Generate the project/make files for the <em> BasicSP </em> example directory: + <UL> + <LI> <em> linux: </em> <code> [in $CIAO_ROOT/examples/BasicSP] mwc.pl -type gnuace</code> </LI> + <LI> <em> windows: </em> <code> [in %CIAO_ROOT%/examples/BasicSP] mwc.pl -type vc71</code> </LI> + </UL> + </LI> + + + <LI> Build the generated solution/make files </LI> +</UL> + +<H3> Running the test </H3> + +<UL> + + <LI> Change into the $CIAO_ROOT/examples/BasicSP/descriptors directory Start NodeManagers (NodeDameon) by running <code> basicNodeDaemon.pl </code> + + <LI> Start the execution manager: + <code>$CIAO_ROOT/DAnCE/ExecutionManager/Execution_Manager -o EM.ior -i NodeManagerMap.dat </code> + </LI> + + <LI> Start the executor: + <code> $CIAO_ROOT/DAnCE/Plan_Launcher/plan_launcher -p flattern_deploymentplan.cdp -k file://EM.ior </code> + + <LI> After this, components should be deployed successfully. You can run the $CIAO_ROOT/examples/BasicSP/EC/controller to start the application. + Please make sure that the component IOR file for the EC component is present when you run this client. + + <BR/> + </LI> +</UL> + +</BODY> </HTML> diff --git a/modules/CIAO/examples/BasicSP/RepoMan_Usage.html b/modules/CIAO/examples/BasicSP/RepoMan_Usage.html new file mode 100644 index 00000000000..b0854d03b96 --- /dev/null +++ b/modules/CIAO/examples/BasicSP/RepoMan_Usage.html @@ -0,0 +1,117 @@ +<!-- $Id$ --> + +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> + <title>Step-By-Step instructions about how to use Repository Manager with DAnCE</title> +</head> + +<body + text = "#000000" + link = "#000fff" + vLink= "#ff0f0f" + aLink = "#0000ff" + bgColor = "#ffffff"> + +<hr><h2>Step-By-Step instructions about how to use Repository Manager with DAnCE</h2><hr> + +<P>This file explains how to run the BasicSP example using the integrated Repository Manager (RepoMan).<P> + +<li>Be sure to add $CIAO_ROOT/HTTP_DOWNLOADED_LIBS into your PATH environment variable. This directory include the +downloaded component lib files.</li> <P> + +<li>If you want to use CORBA <em>naming service</em> to get the RepoMan object reference, then please start naming +service with multicast mode.</li> <P> +<PRE> + $TAO_ROOT/orbsvcs/Naming_Service/naming_service -m 1 +</PRE> + +<li>Build & start JAWS server.</li> <P> +<OL> +<li> Be sure to set JAWS_DOCUMENT_ROOT to the installation path of the RepoMan, i.e., +$CIAO_ROOT/DAnCE/RepositoryManager.</li> +<li> Start JAWS:</li> +<PRE> +Change the current directory into $ACE_ROOT/apps/JAWS/server +main +</PRE> +</OL> + +<li>Start RepoMan. Make sure you have BasicSP or BMClosedED, BMDevice, BMDisplay & EC installed in the +RepoMan you want to use. Please refer to the README file of RepoMan to get the instructions +about how to installed Packages into RepoMan.</li> <P> +<OL> +<li>Using ior file: </li> +<PRE> +Change the current directory into $CIAO_ROOT/DAnCE/RepositoryManager +RepositoryManagerDaemon -o +</PRE> +<li>Using Naming Service:</li> +<PRE> +Change the current directory into $CIAO_ROOT/DAnCE/RepositoryManager +RepositoryManagerDaemon -v [NameofRM] +</PRE> +</OL> + +<li>Change the current directory into $CIAO_ROOT/examples/BasicSP/descriptors.</li> <P> + +<li>Start NodeManagers.</li> <P> +<PRE> + basicNodeDaemon.pl +</PRE> + +<li>Start ExecutionManager.</li> <P> +<PRE> + $CIAO_ROOT/DAnCE/ExecutionManager/Execution_Manager -o EM.ior -i NodeManagerMap.dat +</PRE> + +<li>Start plan_launcher.</li> <P> +<OL> +<li>Not using RepoMan:</li> +<PRE> +$CIAO_ROOT/DAnCE/Plan_Launcher/plan_launcher -p flattened_deploymentplan.cdp -k file://EM.ior +</PRE> + +<li>Using ior file to get RepoMan, providing the name of one composite componemt:</li> +<PRE> +$CIAO_ROOT/DAnCE/Plan_Launcher/plan_launcher -p flattened_deploymentplan.cdp +-a BasicSP +-k file://EM.ior +-l file://$CIAO_ROOT/DAnCE/RepositoryManager/RepositoryManagerDaemon.ior +</PRE> + +<li>Using naming service to get RepoMan, providing the name of one composite componemt:</li> +<PRE> +$CIAO_ROOT/DAnCE/Plan_Launcher/plan_launcher -p flattened_deploymentplan.cdp +-a BasicSP +-k file://EM.ior +-v [NameofRM] +</PRE> + +<li>Using naming service to get RepoMan, providing the names of several individual componemts:</li> +<PRE> +$CIAO_ROOT/DAnCE/Plan_Launcher/plan_launcher -p flattened_deploymentplan.cdp +-a BMClosedED+BMDevice+BMDisplay+EC +-k file://EM.ior +-v [NameofRM] +</PRE> + +<li>Using naming service to get RepoMan, providing the types of several individual componemts:</li> +<PRE> +$CIAO_ROOT/DAnCE/Plan_Launcher/plan_launcher -p flattened_deploymentplan.cdp +-e IDL:BasicSP/EC:1.0+IDL:BasicSP/BMDisplay:1.0+IDL:BasicSP/BMDevice:1.0+IDL:BasicSP/BMClosedED:1.0 +-k file://EM.ior +-v [NameofRM] +</PRE> +</OL> + +<li>Start the application.</li> +<PRE> + $CIAO_ROOT/examples/BasicSP/EC/controller +</PRE> + +<hr><b>Email: </b><a href="mailto:"</a<ADDRESS>shanshan.jiang@vanderbilt.edu</ADDRESS> + +</body> + +</html> diff --git a/modules/CIAO/examples/BasicSP/descriptors/BasicSP.dat b/modules/CIAO/examples/BasicSP/descriptors/BasicSP.dat new file mode 100644 index 00000000000..2131aeec973 --- /dev/null +++ b/modules/CIAO/examples/BasicSP/descriptors/BasicSP.dat @@ -0,0 +1,4 @@ +EC corbaloc:iiop:localhost:10000/EC.NodeManager +BMDisplay corbaloc:iiop:localhost:20000/BMDisplay.NodeManager +BMClosedED corbaloc:iiop:localhost:30000/BMClosedED.NodeManager +BMDevice corbaloc:iiop:localhost:40000/BMDevice.NodeManager diff --git a/modules/CIAO/examples/BasicSP/descriptors/BasicSP_Homed.cdp b/modules/CIAO/examples/BasicSP/descriptors/BasicSP_Homed.cdp new file mode 100644 index 00000000000..cb705023256 --- /dev/null +++ b/modules/CIAO/examples/BasicSP/descriptors/BasicSP_Homed.cdp @@ -0,0 +1,504 @@ +<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>BasicSP_Homed</label> + <UUID>BasicSP_Homed</UUID> + <implementation xmi:id="ECHomeImplementation"> + <name>ECHomeImplementation</name> + <source/> + <artifact xmi:idref="EC_ExecArtifact" /> + <artifact xmi:idref="EC_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_BasicSP_ECHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_BasicSP_ECHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>EC_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>EC_exec</string> + </value> + </value> + </execParameter> + </implementation> + <implementation xmi:id="BMClosedEDHomeImplementation"> + <name>BMClosedEDHomeImplementation</name> + <source/> + <artifact xmi:idref="BMClosedED_ExecArtifact" /> + <artifact xmi:idref="BMClosedED_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_BasicSP_BMClosedEDHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_BasicSP_BMClosedEDHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>BMClosedED_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>BMClosedED_exec</string> + </value> + </value> + </execParameter> + </implementation> + <implementation xmi:id="BMDeviceHomeImplementation"> + <name>BMDeviceHomeImplementation</name> + <source/> + <artifact xmi:idref="BMDevice_ExecArtifact" /> + <artifact xmi:idref="BMDevice_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_BasicSP_BMDeviceHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_BasicSP_BMDeviceHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>BMDevice_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>BMDevice_exec</string> + </value> + </value> + </execParameter> + </implementation> + <implementation xmi:id="BMDisplayHomeImplementation"> + <name>BMDisplayHomeImplementation</name> + <source/> + <artifact xmi:idref="BMDisplay_ExecArtifact" /> + <artifact xmi:idref="BMDisplay_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_BasicSP_BMDisplayHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_BasicSP_BMDisplayHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>BMDisplay_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>BMDisplay_exec</string> + </value> + </value> + </execParameter> + </implementation> + <implementation xmi:id="ECComponentImplementation"> + <name>ECComponentImplementation</name> + <source/> + <artifact xmi:idref="EC_ExecArtifact" /> + <artifact xmi:idref="EC_SvntArtifact" /> + <artifact xmi:idref="EC_StubArtifact" /> + </implementation> + <implementation xmi:id="BMClosedEDComponentImplementation"> + <name>BMClosedEDComponentImplementation</name> + <source/> + <artifact xmi:idref="BMClosedED_ExecArtifact" /> + <artifact xmi:idref="BMClosedED_SvntArtifact" /> + <artifact xmi:idref="BMClosedED_StubArtifact" /> + </implementation> + <implementation xmi:id="BMDeviceComponentImplementation"> + <name>BMDeviceComponentImplementation</name> + <source/> + <artifact xmi:idref="BMDevice_ExecArtifact" /> + <artifact xmi:idref="BMDevice_SvntArtifact" /> + <artifact xmi:idref="BMDevice_StubArtifact" /> + </implementation> + <implementation xmi:id="BMDisplayComponentImplementation"> + <name>BMDisplayComponentImplementation</name> + <source/> + <artifact xmi:idref="BMDisplay_ExecArtifact" /> + <artifact xmi:idref="BMDisplay_SvntArtifact" /> + <artifact xmi:idref="BMDisplay_StubArtifact" /> + </implementation> + <instance xmi:id="ECHomeInstance"> + <name>ECHome</name> + <node>EC</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="ECHomeImplementation" /> + </instance> + <instance xmi:id="BMClosedEDHomeInstance"> + <name>BMClosedEDHome</name> + <node>BMClosedED</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="BMClosedEDHomeImplementation" /> + </instance> + <instance xmi:id="BMDeviceHomeInstance"> + <name>BMDeviceHome</name> + <node>BMDevice</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="BMDeviceHomeImplementation" /> + </instance> + <instance xmi:id="BMDisplayHomeInstance"> + <name>BMDisplayHome</name> + <node>BMDisplay</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="BMDisplayHomeImplementation" /> + </instance> + <instance xmi:id="ECComponentInstance"> + <name>ECComponent</name> + <node>EC</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="ECComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ECHome</string> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>rategen.ior</string> + </value> + </value> + </configProperty> + </instance> + <instance xmi:id="BMClosedEDComponentInstance"> + <name>BMClosedEDComponent</name> + <node>BMClosedED</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="BMClosedEDComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>BMClosedEDHome</string> + </value> + </value> + </configProperty> + </instance> + <instance xmi:id="BMDeviceComponentInstance"> + <name>BMDeviceComponent</name> + <node>BMDevice</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="BMDeviceComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>BMDeviceHome</string> + </value> + </value> + </configProperty> + </instance> + <instance xmi:id="BMDisplayComponentInstance"> + <name>BMDisplayComponent</name> + <node>BMDisplay</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="BMDisplayComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>BMDisplayHome</string> + </value> + </value> + </configProperty> + </instance> + + <connection> + <name>datain_data_readBasicSP.ComponentImplementations.BasicSP.BasicSP.BMClosedEDBMDeviceComponentInstance</name> + <internalEndpoint> + <portName>datain</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="BMClosedEDComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>data_read</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="BMDeviceComponentInstance" /> + </internalEndpoint> + </connection> + + <connection> + <name>comp_data_dataoutBMDisplayComponentInstanceBMDisplayComponentInstance</name> + <internalEndpoint> + <portName>comp_data</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="BMDisplayComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>dataout</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="BMClosedEDComponentInstance" /> + </internalEndpoint> + </connection> + + <connection> + <name>timeout_timeoutECComponentInstanceBMDeviceComponentInstance</name> + <internalEndpoint> + <portName>timeout</portName> + <provider>false</provider> + <kind>EventPublisher</kind> + <instance xmi:idref="ECComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>timeout</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance xmi:idref="BMDeviceComponentInstance" /> + </internalEndpoint> + </connection> + + <connection> + <name>data_available_in_availBMDeviceComponentInstanceBMDisplayComponentInstance</name> + <internalEndpoint> + <portName>data_available</portName> + <provider>false</provider> + <kind>EventPublisher</kind> + <instance xmi:idref="BMDeviceComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>in_avail</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance xmi:idref="BMClosedEDComponentInstance" /> + </internalEndpoint> + </connection> + + <connection> + <name>out_avail_data_readyBMDisplayComponentInstanceBMDisplayComponentInstance</name> + <internalEndpoint> + <portName>out_avail</portName> + <provider>false</provider> + <kind>EventPublisher</kind> + <instance xmi:idref="BMClosedEDComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>data_ready</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance xmi:idref="BMDisplayComponentInstance" /> + </internalEndpoint> + </connection> + + <artifact xmi:id="BMDisplay_ExecArtifact"> + <name>BMDisplay_exec</name> + <source/> + <node/> + <location>BMDisplay_exec</location> + </artifact> + <artifact xmi:id="BMDisplay_SvntArtifact"> + <name>BMDisplay_svnt</name> + <source/> + <node/> + <location>BMDisplay_svnt</location> + </artifact> + <artifact xmi:id="BMDisplay_StubArtifact"> + <name>BMDisplay_stub</name> + <source/> + <node/> + <location>BMDisplay_stub</location> + </artifact> + <artifact xmi:id="BMClosedED_ExecArtifact"> + <name>BMClosedED_exec</name> + <source/> + <node/> + <location>BMClosedED_exec</location> + </artifact> + <artifact xmi:id="BMClosedED_SvntArtifact"> + <name>BMClosedED_svnt</name> + <source/> + <node/> + <location>BMClosedED_svnt</location> + </artifact> + <artifact xmi:id="BMClosedED_StubArtifact"> + <name>BMClosedED_stub</name> + <source/> + <node/> + <location>BMClosedED_stub</location> + </artifact> + <artifact xmi:id="BMDevice_ExecArtifact"> + <name>BMDevice_exec</name> + <source/> + <node/> + <location>BMDevice_exec</location> + </artifact> + <artifact xmi:id="BMDevice_SvntArtifact"> + <name>BMDevice_svnt</name> + <source/> + <node/> + <location>BMDevice_svnt</location> + </artifact> + <artifact xmi:id="BMDevice_StubArtifact"> + <name>BMDevice_stub</name> + <source/> + <node/> + <location>BMDevice_stub</location> + </artifact> + <artifact xmi:id="EC_ExecArtifact"> + <name>EC_exec</name> + <source/> + <node/> + <location>EC_exec</location> + </artifact> + <artifact xmi:id="EC_SvntArtifact"> + <name>EC_svnt</name> + <source/> + <node/> + <location>EC_svnt</location> + </artifact> + <artifact xmi:id="EC_StubArtifact"> + <name>EC_stub</name> + <source/> + <node/> + <location>EC_stub</location> + </artifact> +</Deployment:DeploymentPlan> diff --git a/modules/CIAO/examples/BasicSP/descriptors/BasicSP_Unhomed.cdp b/modules/CIAO/examples/BasicSP/descriptors/BasicSP_Unhomed.cdp new file mode 100644 index 00000000000..469858ec97d --- /dev/null +++ b/modules/CIAO/examples/BasicSP/descriptors/BasicSP_Unhomed.cdp @@ -0,0 +1,408 @@ +<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>BasicSP_Unhomed</label> + <UUID>BasicSP_Unhomed</UUID> + + <implementation xmi:id="BMDisplayComponentImplementation"> + <name>BMDisplayComponentImplementation</name> + <source/> + <artifact xmi:idref="BMDisplay_ExecArtifact" /> + <artifact xmi:idref="BMDisplay_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_BasicSP_BMDisplay_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_BasicSP_BMDisplay_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>BMDisplay_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>BMDisplay_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="BMClosedEDComponentImplementation"> + <name>BMClosedEDComponentImplementation</name> + <source/> + <artifact xmi:idref="BMClosedED_ExecArtifact" /> + <artifact xmi:idref="BMClosedED_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_BasicSP_BMClosedED_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_BasicSP_BMClosedED_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>BMClosedED_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>BMClosedED_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="BMDeviceComponentImplementation"> + <name>BMDeviceComponentImplementation</name> + <source/> + <artifact xmi:idref="BMDevice_ExecArtifact" /> + <artifact xmi:idref="BMDevice_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_BasicSP_BMDevice_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_BasicSP_BMDevice_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>BMDevice_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>BMDevice_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="ECComponentImplementation"> + <name>ECComponentImplementation</name> + <source/> + <artifact xmi:idref="EC_ExecArtifact" /> + <artifact xmi:idref="EC_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_BasicSP_EC_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_BasicSP_EC_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>EC_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>EC_exec</string> + </value> + </value> + </execParameter> + </implementation> + <instance xmi:id="BMDisplayComponentInstance"> + <name>BMDisplayComponent</name> + <node>BMDisplay</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="BMDisplayComponentImplementation" /> + </instance> + <instance xmi:id="BMClosedEDComponentInstance"> + <name>BMClosedEDComponent</name> + <node>BMClosedED</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="BMClosedEDComponentImplementation" /> + </instance> + <instance xmi:id="BMDeviceComponentInstance"> + <name>BMDeviceComponent</name> + <node>BMDevice</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="BMDeviceComponentImplementation" /> + </instance> + <instance xmi:id="ECComponentInstance"> + <name>ECComponent</name> + <node>EC</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="ECComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>rategen.ior</string> + </value> + </value> + </configProperty> + </instance> + + <connection> + <name>datain_data_readBasicSP.ComponentImplementations.BasicSP.BasicSP.BMClosedEDBMDeviceComponentInstance</name> + <internalEndpoint> + <portName>datain</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="BMClosedEDComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>data_read</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="BMDeviceComponentInstance" /> + </internalEndpoint> + </connection> + + <connection> + <name>comp_data_dataoutBMDisplayComponentInstanceBMDisplayComponentInstance</name> + <internalEndpoint> + <portName>comp_data</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="BMDisplayComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>dataout</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="BMClosedEDComponentInstance" /> + </internalEndpoint> + </connection> + + <connection> + <name>timeout_timeoutECComponentInstanceBMDeviceComponentInstance</name> + <internalEndpoint> + <portName>timeout</portName> + <provider>false</provider> + <kind>EventPublisher</kind> + <instance xmi:idref="ECComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>timeout</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance xmi:idref="BMDeviceComponentInstance" /> + </internalEndpoint> + </connection> + + <connection> + <name>data_available_in_availBMDeviceComponentInstanceBMDisplayComponentInstance</name> + <internalEndpoint> + <portName>data_available</portName> + <provider>false</provider> + <kind>EventPublisher</kind> + <instance xmi:idref="BMDeviceComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>in_avail</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance xmi:idref="BMClosedEDComponentInstance" /> + </internalEndpoint> + </connection> + + <connection> + <name>out_avail_data_readyBMDisplayComponentInstanceBMDisplayComponentInstance</name> + <internalEndpoint> + <portName>out_avail</portName> + <provider>false</provider> + <kind>EventPublisher</kind> + <instance xmi:idref="BMClosedEDComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>data_ready</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance xmi:idref="BMDisplayComponentInstance" /> + </internalEndpoint> + </connection> + + <artifact xmi:id="BMDisplay_ExecArtifact"> + <name>BMDisplay_exec</name> + <source/> + <node/> + <location>BMDisplay_exec</location> + </artifact> + <artifact xmi:id="BMDisplay_SvntArtifact"> + <name>BMDisplay_svnt</name> + <source/> + <node/> + <location>BMDisplay_svnt</location> + </artifact> + <artifact xmi:id="BMDisplay_StubArtifact"> + <name>BMDisplay_stub</name> + <source/> + <node/> + <location>BMDisplay_stub</location> + </artifact> + <artifact xmi:id="BMClosedED_ExecArtifact"> + <name>BMClosedED_exec</name> + <source/> + <node/> + <location>BMClosedED_exec</location> + </artifact> + <artifact xmi:id="BMClosedED_SvntArtifact"> + <name>BMClosedED_svnt</name> + <source/> + <node/> + <location>BMClosedED_svnt</location> + </artifact> + <artifact xmi:id="BMClosedED_StubArtifact"> + <name>BMClosedED_stub</name> + <source/> + <node/> + <location>BMClosedED_stub</location> + </artifact> + <artifact xmi:id="EC_ExecArtifact"> + <name>EC_exec</name> + <source/> + <node/> + <location>EC_exec</location> + </artifact> + <artifact xmi:id="EC_SvntArtifact"> + <name>EC_svnt</name> + <source/> + <node/> + <location>EC_svnt</location> + </artifact> + <artifact xmi:id="EC_StubArtifact"> + <name>EC_stub</name> + <source/> + <node/> + <location>EC_stub</location> + </artifact> + <artifact xmi:id="BMDevice_ExecArtifact"> + <name>BMDevice_exec</name> + <source/> + <node/> + <location>BMDevice_exec</location> + </artifact> + <artifact xmi:id="BMDevice_SvntArtifact"> + <name>BMDevice_svnt</name> + <source/> + <node/> + <location>BMDevice_svnt</location> + </artifact> + <artifact xmi:id="BMDevice_StubArtifact"> + <name>BMDevice_stub</name> + <source/> + <node/> + <location>BMDevice_stub</location> + </artifact> +</Deployment:DeploymentPlan> diff --git a/modules/CIAO/examples/BasicSP/descriptors/run_test.pl b/modules/CIAO/examples/BasicSP/descriptors/run_test.pl new file mode 100755 index 00000000000..1e2c88135e1 --- /dev/null +++ b/modules/CIAO/examples/BasicSP/descriptors/run_test.pl @@ -0,0 +1,193 @@ +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 = 4; +@ports = ( 10000, 20000, 30000, 40000 ); +@iorfiles = ( "NodeApp1.ior", "NodeApp2.ior", "NodeApp3.ior", "NodeApp4.ior" ); +@nodenames = ( "EC", "BMDisplay", "BMClosedED", "BMDevice" ); +$status = 0; +$dat_file = "BasicSP.dat"; +$cdp_file = "BasicSP_Unhomed.cdp"; +$controller_exec = "$CIAO_ROOT/examples/BasicSP/EC/controller"; + +PerlACE::add_lib_path ('../lib'); + +$nsior = PerlACE::LocalFile ("ns.ior"); + +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 ("rategen.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 "$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; +} + +if ($#ARGV == 0) +{ + $cdp_file = $ARGV[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 $cdp_file -k file://EM.ior"); + +$E->SpawnWaitKill (5000); + +if (PerlACE::waitforfile_timed ( + "rategen.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; +} + +print "Invoking the controller\n"; +$controller = new PerlACE::Process ("$controller_exec", "-o"); +$result = $controller->SpawnWaitKill (3000); + +if ($result != 0) { + print STDERR "ERROR: The controller returned $result\n"; + $status = 1; +} + +sleep 10; +# 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 $cdp_file -q"); +$E->SpawnWaitKill (3000); + +print "Executor returned.\n"; +print "Shutting down rest of the processes.\n"; + +delete_ior_files (); +kill_open_processes (); + +exit $status; |