diff options
Diffstat (limited to 'CIAO/tests/DAnCE')
18 files changed, 3362 insertions, 1 deletions
diff --git a/CIAO/tests/DAnCE/Components/Progressive_exec.h b/CIAO/tests/DAnCE/Components/Progressive_exec.h index 09c0fbc2a35..cc563faa3c2 100644 --- a/CIAO/tests/DAnCE/Components/Progressive_exec.h +++ b/CIAO/tests/DAnCE/Components/Progressive_exec.h @@ -56,7 +56,7 @@ namespace CIAO_Simple_Progressive_Impl ::Simple::CCM_Progressive_Context_ptr); virtual ~Trigger_exec_i (void); - // Operations and attributes from ::Simple::Trigger + // Operations and attributes from Simple::Trigger // TAO_IDL - Generated from // be/be_visitor_operation/operation_ch.cpp:37 diff --git a/CIAO/tests/DAnCE/NodeManager-Deployments/PublishConnectionExplicitHome.cdp b/CIAO/tests/DAnCE/NodeManager-Deployments/PublishConnectionExplicitHome.cdp index 784a675ba07..b0313928731 100644 --- a/CIAO/tests/DAnCE/NodeManager-Deployments/PublishConnectionExplicitHome.cdp +++ b/CIAO/tests/DAnCE/NodeManager-Deployments/PublishConnectionExplicitHome.cdp @@ -185,6 +185,14 @@ <implementation xmi:idref="SimpleConsumerHomeImplementation" /> </instance> + <instance xmi:id="SimpleConsumerHomeInstance2"> + <name>SimpleConsumerHome2</name> + <node>Node</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleConsumerHomeImplementation" /> + </instance> + <instance xmi:id="SimpleConsumerComponentInstance"> <name>SimpleConsumerComponent</name> <node>Node</node> @@ -204,6 +212,25 @@ </configProperty> </instance> + <instance xmi:id="SimpleConsumerComponentInstance2"> + <name>SimpleConsumerComponent2</name> + <node>Node</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleConsumerComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.CIAO.ComponentHomeId</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleConsumerHome2</string> + </value> + </value> + </configProperty> + </instance> + <connection> <name>TestConnection</name> <internalEndpoint> @@ -219,6 +246,21 @@ <instance xmi:idref="SimpleConsumerComponentInstance" /> </internalEndpoint> </connection> + <connection> + <name>TestConnection2</name> + <internalEndpoint> + <portName>hello_</portName> + <provider>false</provider> + <kind>EventPublisher</kind> + <instance xmi:idref="SimplePublisherComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>hello_</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance xmi:idref="SimpleConsumerComponentInstance2" /> + </internalEndpoint> + </connection> <!-- Artifacts declarations --> <artifact xmi:id="SimplePublisher_ExecArtifact"> diff --git a/CIAO/tests/DAnCE/PartialShutdown/Base/PartialShutdown.idl b/CIAO/tests/DAnCE/PartialShutdown/Base/PartialShutdown.idl new file mode 100644 index 00000000000..73e59ec1568 --- /dev/null +++ b/CIAO/tests/DAnCE/PartialShutdown/Base/PartialShutdown.idl @@ -0,0 +1,26 @@ +// $Id$ + +/** + * @file PartialShutdown.idl + * @author Marcel Smit <msmit@remedy.nl> + */ + +#ifndef PARTIALSHUTDOWN_IDL_ +#define PARTIALSHUTDOWN_IDL_ + +#include <Components.idl> + +#pragma ciao lem "Base/PartialShutdownE.idl" + +module PartialShutdown +{ + local interface Writer { + void write_line (in string line); + }; + + local interface Reader { + CORBA::StringSeq read_lines (); + }; +}; + +#endif /* PARTIALSHUTDOWN_IDL_ */ diff --git a/CIAO/tests/DAnCE/PartialShutdown/Base/PartialShutdown.mpc b/CIAO/tests/DAnCE/PartialShutdown/Base/PartialShutdown.mpc new file mode 100644 index 00000000000..41ec839bbec --- /dev/null +++ b/CIAO/tests/DAnCE/PartialShutdown/Base/PartialShutdown.mpc @@ -0,0 +1,89 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -n PartialShutdown" + +project(PartialShutdown_idl_gen) : componentidldefaults { + custom_only = 1 + idlflags += -Wb,stub_export_macro=PARTIALSHUTDOWN_STUB_Export \ + -Wb,stub_export_include=PartialShutdown_stub_export.h \ + -Wb,skel_export_macro=PARTIALSHUTDOWN_SKEL_Export \ + -Wb,skel_export_include=PartialShutdown_skel_export.h \ + -Wb,exec_export_macro=PARTIALSHUTDOWN_EXEC_Export \ + -Wb,exec_export_include=PartialShutdown_exec_export.h \ + -Gxhex -Gxhsk -Gxhst + + IDL_Files { + PartialShutdown.idl + } +} + +project(PartialShutdown_lem_gen) : ciaoidldefaults, avoids_ccm_noevent { + custom_only = 1 + after += PartialShutdown_idl_gen + idlflags += \ + -Wb,export_macro=PARTIALSHUTDOWN_STUB_Export \ + -Wb,export_include=PartialShutdown_stub_export.h \ + -I.. + + IDL_Files { + PartialShutdownE.idl + } +} + +project(PartialShutdown_stub) : ccm_stub { + after += PartialShutdown_lem_gen + libs += + + libout = ../lib + libpaths += ../lib + + sharedname = PartialShutdown_stub + dynamicflags += PARTIALSHUTDOWN_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + PartialShutdownC.cpp + PartialShutdownEC.cpp + } + + Header_Files { + PartialShutdownC.h + PartialShutdownEC.h + PartialShutdown_stub_export.h + } + + Inline_Files { + PartialShutdownC.inl + } +} + + +project(PartialShutdown_skel) : ciao_executor { + after += PartialShutdown_stub PartialShutdown_lem_stub + sharedname = PartialShutdown_skel + libs += PartialShutdown_stub + + libout = ../lib + libpaths += ../lib + + dynamicflags += PARTIALSHUTDOWN_SKEL_BUILD_DLL + + IDL_Files { + } + + Source_Files { + PartialShutdownS.cpp + } + + Header_Files { + PartialShutdownS.h + PartialShutdown_skel_export.h + } + + Inline_Files { + PartialShutdownS.inl + } +} + + diff --git a/CIAO/tests/DAnCE/PartialShutdown/Component1/Component1.idl b/CIAO/tests/DAnCE/PartialShutdown/Component1/Component1.idl new file mode 100644 index 00000000000..5b4df332640 --- /dev/null +++ b/CIAO/tests/DAnCE/PartialShutdown/Component1/Component1.idl @@ -0,0 +1,29 @@ +// $Id$ + +/** + * @file Component1.idl + * @author Marcel Smit <msmit@remedy.nl> + */ + +#ifndef COMPONENT1_IDL_ +#define COMPONENT1_IDL_ + +#include "Base/PartialShutdown.idl" + +module PartialShutdown +{ + component Component1 + { + uses Writer write_to_comp_2; + uses Writer write_to_comp_3; + + uses Reader read_from_comp_2; + uses Reader read_from_comp_3; + + provides Writer comp_1_writer; + + provides Reader comp_1_reader; + }; +}; + +#endif /* COMPONENT1_IDL_ */ diff --git a/CIAO/tests/DAnCE/PartialShutdown/Component1/Component1.mpc b/CIAO/tests/DAnCE/PartialShutdown/Component1/Component1.mpc new file mode 100755 index 00000000000..bc4fd0d067a --- /dev/null +++ b/CIAO/tests/DAnCE/PartialShutdown/Component1/Component1.mpc @@ -0,0 +1,151 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p PartialShutdown Component1" + +project(PartialShutdown_Component1_idl_gen) : componentidldefaults { + custom_only = 1 + idlflags += -Wb,stub_export_macro=COMPONENT1_STUB_Export \ + -Wb,stub_export_include=Component1_stub_export.h \ + -Wb,skel_export_macro=COMPONENT1_SVNT_Export \ + -Wb,skel_export_include=Component1_svnt_export.h \ + -Wb,exec_export_macro=COMPONENT1_EXEC_Export \ + -Wb,exec_export_include=Component1_exec_export.h \ + -Gxhex -Gxhsk -Gxhst -I.. + + IDL_Files { + Component1.idl + } +} + +project(PartialShutdown_Component1_lem_gen) : ciaoidldefaults { + after += PartialShutdown_Component1_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=COMPONENT1_LEM_STUB_Export \ + -Wb,stub_export_include=Component1_lem_stub_export.h \ + -SS -Gxhst -I.. + + IDL_Files { + Component1E.idl + } +} + +project(PartialShutdown_Component1_lem_stub) : ccm_svnt { + after += PartialShutdown_Component1_lem_gen PartialShutdown_Component1_stub \ + PartialShutdown_stub + libs += PartialShutdown_stub Component1_stub + + includes += .. + + libout = ../lib + libpaths += ../lib + + sharedname = Component1_lem_stub + dynamicflags += COMPONENT1_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Component1EC.cpp + } + + Header_Files { + Component1EC.h + Component1_lem_stub_export.h + } + + Inline_Files { + Component1EC.inl + } +} + +project(PartialShutdown_Component1_stub) : ccm_stub { + after += PartialShutdown_Component1_idl_gen PartialShutdown_stub + libs += PartialShutdown_stub + + includes += .. + + libout = ../lib + libpaths += ../lib + + sharedname = Component1_stub + dynamicflags += COMPONENT1_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Component1C.cpp + } + + Header_Files { + Component1C.h + Component1_stub_export.h + } + + Inline_Files { + Component1C.inl + } +} + +project(PartialShutdown_Component1_exec) : ciao_executor { + after += PartialShutdown_Component1_lem_stub PartialShutdown_Component1_stub + sharedname = Component1_exec + libs += Component1_stub Component1_lem_stub PartialShutdown_stub + + includes += .. + + libout = ../lib + libpaths += ../lib + + dynamicflags += COMPONENT1_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Component1_exec.cpp + } + + Header_Files { + Component1_exec.h + Component1_exec_export.h + } + + Inline_Files { + } +} + + +project(PartialShutdown_Component1_svnt) : ciao_servant { + after += PartialShutdown_Component1_lem_stub \ + PartialShutdown_Component1_lem_stub + sharedname = Component1_svnt + libs += Component1_stub Component1_lem_stub PartialShutdown_stub + + includes += .. + + libout = ../lib + libpaths += ../lib + + dynamicflags += COMPONENT1_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Component1S.cpp + Component1_svnt.cpp + } + + Header_Files { + Component1S.h + Component1_svnt.h + Component1_svnt_export.h + } + + Inline_Files { + Component1S.inl + } +} + + diff --git a/CIAO/tests/DAnCE/PartialShutdown/Component1/Component1_exec.cpp b/CIAO/tests/DAnCE/PartialShutdown/Component1/Component1_exec.cpp new file mode 100644 index 00000000000..087c39bd758 --- /dev/null +++ b/CIAO/tests/DAnCE/PartialShutdown/Component1/Component1_exec.cpp @@ -0,0 +1,431 @@ +// -*- C++ -*- +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v2.0.0 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ + +#include "Component1_exec.h" +#include "tao/ORB_Core.h" +#include "ace/Reactor.h" + +namespace CIAO_PartialShutdown_Component1_Impl +{ + /** + * WriteTicker + */ + + WriteTicker::WriteTicker (Component1_exec_i &callback) + : callback_ (callback) + { + } + + int + WriteTicker::handle_timeout (const ACE_Time_Value &, const void *) + { + // Notify the subscribers + this->callback_.write_all (); + return 0; + } + + /** + * ReadTicker + */ + + ReadTicker::ReadTicker (Component1_exec_i &callback) + : callback_ (callback) + { + } + + int + ReadTicker::handle_timeout (const ACE_Time_Value &, const void *) + { + // Notify the subscribers + this->callback_.read_all (); + return 0; + } + + /** + * Facet Executor Implementation Class: comp_1_writer_exec_i + */ + + comp_1_writer_exec_i::comp_1_writer_exec_i ( + ::PartialShutdown::CCM_Component1_Context_ptr ctx, + Component1_exec_i & callback) + : ciao_context_ ( + ::PartialShutdown::CCM_Component1_Context::_duplicate (ctx)) + , callback_ (callback) + { + } + + comp_1_writer_exec_i::~comp_1_writer_exec_i (void) + { + } + + // Operations from ::PartialShutdown::Writer + + void + comp_1_writer_exec_i::write_line (const char * line) + { + this->callback_.write_line (line); + } + + /** + * Facet Executor Implementation Class: comp_1_reader_exec_i + */ + + comp_1_reader_exec_i::comp_1_reader_exec_i ( + ::PartialShutdown::CCM_Component1_Context_ptr ctx, + Component1_exec_i & callback) + : ciao_context_ ( + ::PartialShutdown::CCM_Component1_Context::_duplicate (ctx)) + , callback_ (callback) + { + } + + comp_1_reader_exec_i::~comp_1_reader_exec_i (void) + { + } + + // Operations from ::PartialShutdown::Reader + + ::CORBA::StringSeq * + comp_1_reader_exec_i::read_lines (void) + { + return this->callback_.read_lines (); + } + + /** + * Component Executor Implementation Class: Component1_exec_i + */ + + Component1_exec_i::Component1_exec_i (void) + { + ACE_NEW_THROW_EX (this->write_ticker_, + WriteTicker (*this), + ::CORBA::NO_MEMORY ()); + ACE_NEW_THROW_EX (this->read_ticker_, + ReadTicker (*this), + ::CORBA::NO_MEMORY ()); + } + + Component1_exec_i::~Component1_exec_i (void) + { + delete this->write_ticker_; + delete this->read_ticker_; + if (!::CORBA::is_nil (this->ciao_context_.in ())) + { + PartialShutdown::Reader_var read_from_comp_2 = + this->ciao_context_->get_connection_read_from_comp_2 (); + if (!::CORBA::is_nil (read_from_comp_2.in ())) + { + ACE_ERROR ((LM_ERROR, "Component1_exec_i::~Component1_exec_i - " + "ERROR: Read interface of component 2 still valid\n")); + } + else + { + ACE_DEBUG ((LM_DEBUG, "Component1_exec_i::~Component1_exec_i - " + "OK: Read interface of component 2 is not valid\n")); + } + PartialShutdown::Reader_var read_from_comp_3 = + this->ciao_context_->get_connection_read_from_comp_3 (); + if (!::CORBA::is_nil (read_from_comp_3.in ())) + { + ACE_ERROR ((LM_ERROR, "Component1_exec_i::~Component1_exec_i - " + "ERROR: Read interface of component 3 still valid\n")); + } + else + { + ACE_DEBUG ((LM_DEBUG, "Component1_exec_i::~Component1_exec_i - " + "OK: Read interface of component 3 is not valid\n")); + } + + PartialShutdown::Writer_var writer_to_comp_2 = + this->ciao_context_->get_connection_write_to_comp_2 (); + if (!::CORBA::is_nil (writer_to_comp_2.in ())) + { + ACE_ERROR ((LM_ERROR, "Component1_exec_i::~Component1_exec_i - " + "ERROR: Write interface of component 2 still valid\n")); + } + else + { + ACE_DEBUG ((LM_DEBUG, "Component1_exec_i::~Component1_exec_i - " + "OK: Write interface of component 2 is not valid\n")); + } + + PartialShutdown::Writer_var writer_to_comp_3 = + this->ciao_context_->get_connection_write_to_comp_3 (); + if (!::CORBA::is_nil (writer_to_comp_3.in ())) + { + ACE_ERROR ((LM_ERROR, "Component1_exec_i::~Component1_exec_i - " + "ERROR: Write interface of component 3 still valid\n")); + } + else + { + ACE_DEBUG ((LM_DEBUG, "Component1_exec_i::~Component1_exec_i - " + "OK: Write interface of component 3 is not valid\n")); + } + } + } + + // Supported operations and attributes. + ACE_Reactor* + Component1_exec_i::reactor (void) + { + ACE_Reactor* reactor = 0; + ::CORBA::Object_var ccm_object = + this->ciao_context_->get_CCM_object(); + if (! ::CORBA::is_nil (ccm_object.in ())) + { + ::CORBA::ORB_var orb = ccm_object->_get_orb (); + if (! ::CORBA::is_nil (orb.in ())) + { + reactor = orb->orb_core ()->reactor (); + } + } + if (reactor == 0) + { + throw ::CORBA::INTERNAL (); + } + return reactor; + } + + void Component1_exec_i::read_all (void) + { + PartialShutdown::Reader_var read_from_comp_2 = + this->ciao_context_->get_connection_read_from_comp_2 (); + if (::CORBA::is_nil (read_from_comp_2.in ())) + { + ACE_ERROR ((LM_ERROR, "Component1_exec_i::read_all - " + "ERROR: Reader of component 2 seems NIL\n")); + } + else + { + ::CORBA::StringSeq_var strings_from_2 = + read_from_comp_2->read_lines (); + for (::CORBA::ULong i = 0; i < strings_from_2->length (); ++i) + { + ACE_DEBUG ((LM_DEBUG, "COMPONENT1: READ FROM COMPONENT2 : %C\n", + strings_from_2[i].in ())); + } + } + + PartialShutdown::Reader_var read_from_comp_3 = + this->ciao_context_->get_connection_read_from_comp_3 (); + if (::CORBA::is_nil (read_from_comp_3.in ())) + { + ACE_DEBUG ((LM_DEBUG, "Component1_exec_i::read_all - " + "Reader of component 3 seems NIL\n")); + } + else + { + ::CORBA::StringSeq_var strings_from_3 = + read_from_comp_3->read_lines (); + for (::CORBA::ULong i = 0; i < strings_from_3->length (); ++i) + { + ACE_DEBUG ((LM_DEBUG, "COMPONENT1: READ FROM COMPONENT3 : %C\n", + strings_from_3[i].in ())); + } + } + } + + void Component1_exec_i::write_all (void) + { + const char * str_to_comp_2 = "FROM COMPONENT1 TO COMPONENT2"; + const char * str_to_comp_3 = "FROM COMPONENT1 TO COMPONENT3"; + + PartialShutdown::Writer_var writer_to_comp_2 = + this->ciao_context_->get_connection_write_to_comp_2 (); + if (::CORBA::is_nil (writer_to_comp_2.in ())) + { + ACE_ERROR ((LM_ERROR, "Component1_exec_i::write_all - " + "ERROR: Writer to component 2 seems NIL\n")); + } + else + { + writer_to_comp_2->write_line (str_to_comp_2); + } + + PartialShutdown::Writer_var writer_to_comp_3 = + this->ciao_context_->get_connection_write_to_comp_3 (); + + if (::CORBA::is_nil (writer_to_comp_3.in ())) + { + ACE_DEBUG ((LM_DEBUG, "Component1_exec_i::write_all - " + "Writer to component 3 seems NIL\n")); + } + else + { + writer_to_comp_3->write_line (str_to_comp_3); + } + } + + void + Component1_exec_i::write_line (const char* line) + { + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, _guard, + this->mutex_, CORBA::INTERNAL ()); + { + ACE_DEBUG ((LM_DEBUG, "Component1_exec_i::write_line - " + "New line: <%C>\n", + line)); + this->strings_.push_back (line); + } + } + + + ::CORBA::StringSeq * + Component1_exec_i::read_lines (void) + { + CORBA::StringSeq *args = 0; + ACE_NEW_THROW_EX (args, + CORBA::StringSeq, + CORBA::NO_MEMORY ()); + + CORBA::StringSeq_var safe_args (args); + + // Copy the argument vector to the string sequence. + + args->length (this->strings_.size ()); + for (::CORBA::ULong i = 0; i < this->strings_.size (); ++i) + { + (*args)[i] = CORBA::string_dup (this->strings_[i]); + } + + return safe_args._retn (); + } + + // Component attributes and port operations. + + ::PartialShutdown::CCM_Writer_ptr + Component1_exec_i::get_comp_1_writer (void) + { + if ( ::CORBA::is_nil (this->ciao_comp_1_writer_.in ())) + { + comp_1_writer_exec_i *tmp = 0; + ACE_NEW_RETURN ( + tmp, + comp_1_writer_exec_i ( + this->ciao_context_.in (), + *this), + ::PartialShutdown::CCM_Writer::_nil ()); + + this->ciao_comp_1_writer_ = tmp; + } + + return + ::PartialShutdown::CCM_Writer::_duplicate ( + this->ciao_comp_1_writer_.in ()); + } + + ::PartialShutdown::CCM_Reader_ptr + Component1_exec_i::get_comp_1_reader (void) + { + if ( ::CORBA::is_nil (this->ciao_comp_1_reader_.in ())) + { + comp_1_reader_exec_i *tmp = 0; + ACE_NEW_RETURN ( + tmp, + comp_1_reader_exec_i ( + this->ciao_context_.in (), + *this), + ::PartialShutdown::CCM_Reader::_nil ()); + + this->ciao_comp_1_reader_ = tmp; + } + + return + ::PartialShutdown::CCM_Reader::_duplicate ( + this->ciao_comp_1_reader_.in ()); + } + + // Operations from Components::SessionComponent. + + void + Component1_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + this->ciao_context_ = + ::PartialShutdown::CCM_Component1_Context::_narrow (ctx); + + if ( ::CORBA::is_nil (this->ciao_context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + Component1_exec_i::configuration_complete (void) + { + /* Your code here. */ + } + + void + Component1_exec_i::ccm_activate (void) + { + if (this->reactor ()->schedule_timer ( + this->write_ticker_, + 0, + ACE_Time_Value (5, 0), + ACE_Time_Value (1, 0)) == -1) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Sender_exec_i::start : ") + ACE_TEXT ("Error scheduling write ticker\n"))); + } + if (this->reactor ()->schedule_timer ( + this->read_ticker_, + 0, + ACE_Time_Value (5, 0), + ACE_Time_Value (1, 0)) == -1) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Sender_exec_i::start : ") + ACE_TEXT ("Error scheduling read ticker\n"))); + } + } + + void + Component1_exec_i::ccm_passivate (void) + { + this->reactor ()->cancel_timer (this->write_ticker_); + this->reactor ()->cancel_timer (this->read_ticker_); + } + + void + Component1_exec_i::ccm_remove (void) + { + /* Your code here. */ + } + + extern "C" COMPONENT1_EXEC_Export ::Components::EnterpriseComponent_ptr + create_PartialShutdown_Component1_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_NORETURN ( + retval, + Component1_exec_i); + + return retval; + } +} diff --git a/CIAO/tests/DAnCE/PartialShutdown/Component1/Component1_exec.h b/CIAO/tests/DAnCE/PartialShutdown/Component1/Component1_exec.h new file mode 100644 index 00000000000..909af1656b4 --- /dev/null +++ b/CIAO/tests/DAnCE/PartialShutdown/Component1/Component1_exec.h @@ -0,0 +1,207 @@ +// -*- C++ -*- +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v2.0.0 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ +#ifndef CIAO_COMPONENT1_EXEC_CACZYE_H_ +#define CIAO_COMPONENT1_EXEC_CACZYE_H_ + +#include /**/ "ace/pre.h" + +#include "Component1EC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ "Component1_exec_export.h" +#include "tao/LocalObject.h" + +#include <vector> + +namespace CIAO_PartialShutdown_Component1_Impl +{ + class Component1_exec_i; + + /** + * WriteTicker + */ + + class WriteTicker : + public ACE_Event_Handler + { + public: + WriteTicker (Component1_exec_i &callback); + int handle_timeout (const ACE_Time_Value &, const void *); + private: + /// Maintains a handle that actually process the event + Component1_exec_i &callback_; + }; + + /** + * ReadTicker + */ + + class ReadTicker : + public ACE_Event_Handler + { + public: + ReadTicker (Component1_exec_i &callback); + int handle_timeout (const ACE_Time_Value &, const void *); + private: + /// Maintains a handle that actually process the event + Component1_exec_i &callback_; + }; + + /** + * Provider Executor Implementation Class: comp_1_writer_exec_i + */ + + class comp_1_writer_exec_i + : public virtual ::PartialShutdown::CCM_Writer, + public virtual ::CORBA::LocalObject + { + public: + comp_1_writer_exec_i ( + ::PartialShutdown::CCM_Component1_Context_ptr ctx, + Component1_exec_i & callback); + virtual ~comp_1_writer_exec_i (void); + + //@{ + /** Operations and attributes from PartialShutdown::Writer. */ + + virtual + void write_line (const char * line); + //@} + + private: + ::PartialShutdown::CCM_Component1_Context_var ciao_context_; + Component1_exec_i & callback_; + }; + + /** + * Provider Executor Implementation Class: comp_1_reader_exec_i + */ + + class comp_1_reader_exec_i + : public virtual ::PartialShutdown::CCM_Reader, + public virtual ::CORBA::LocalObject + { + public: + comp_1_reader_exec_i ( + ::PartialShutdown::CCM_Component1_Context_ptr ctx, + Component1_exec_i & callback); + virtual ~comp_1_reader_exec_i (void); + + //@{ + /** Operations and attributes from PartialShutdown::Reader. */ + virtual + ::CORBA::StringSeq * read_lines (void); + //@} + + private: + ::PartialShutdown::CCM_Component1_Context_var ciao_context_; + Component1_exec_i & callback_; + }; + + /** + * Component Executor Implementation Class: Component1_exec_i + */ + + class Component1_exec_i + : public virtual Component1_Exec, + public virtual ::CORBA::LocalObject + { + public: + Component1_exec_i (void); + virtual ~Component1_exec_i (void); + + //@{ + /** Supported operations and attributes. */ + + //@} + + //@{ + /** Component attributes and port operations. */ + + virtual ::PartialShutdown::CCM_Writer_ptr + get_comp_1_writer (void); + + virtual ::PartialShutdown::CCM_Reader_ptr + get_comp_1_reader (void); + //@} + + //@{ + /** Operations from Components::SessionComponent. */ + virtual void set_session_context (::Components::SessionContext_ptr ctx); + virtual void configuration_complete (void); + virtual void ccm_activate (void); + virtual void ccm_passivate (void); + virtual void ccm_remove (void); + //@} + + //@{ + /** User defined public operations. */ + void read_all (void); + void write_all (void); + + void write_line (const char * line); + ::CORBA::StringSeq * read_lines (void); + //@} + + private: + ::PartialShutdown::CCM_Component1_Context_var ciao_context_; + + //@{ + /** Component attributes. */ + ::PartialShutdown::CCM_Writer_var ciao_comp_1_writer_; + ::PartialShutdown::CCM_Reader_var ciao_comp_1_reader_; + //@} + + //@{ + /** User defined members. */ + WriteTicker * write_ticker_; + ReadTicker * read_ticker_; + + TAO_SYNCH_MUTEX mutex_; + typedef std::vector <const char *> Strings; + Strings strings_; + //@} + + //@{ + /** User defined private operations. */ + + //@} + + /// Get the ACE_Reactor + ACE_Reactor* reactor (void); + }; + + extern "C" COMPONENT1_EXEC_Export ::Components::EnterpriseComponent_ptr + create_PartialShutdown_Component1_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* ifndef */ diff --git a/CIAO/tests/DAnCE/PartialShutdown/Component2/Component2.idl b/CIAO/tests/DAnCE/PartialShutdown/Component2/Component2.idl new file mode 100644 index 00000000000..0cd9e01f32d --- /dev/null +++ b/CIAO/tests/DAnCE/PartialShutdown/Component2/Component2.idl @@ -0,0 +1,29 @@ +// $Id$ + +/** + * @file Component2.idl + * @author Marcel Smit <msmit@remedy.nl> + */ + +#ifndef COMPONENT2_IDL_ +#define COMPONENT2_IDL_ + +#include "Base/PartialShutdown.idl" + +module PartialShutdown +{ + component Component2 + { + uses Writer write_to_comp_1; + uses Writer write_to_comp_3; + + uses Reader read_from_comp_1; + uses Reader read_from_comp_3; + + provides Writer comp_2_writer; + + provides Reader comp_2_reader; + }; +}; + +#endif /* COMPONENT2_IDL_ */ diff --git a/CIAO/tests/DAnCE/PartialShutdown/Component2/Component2.mpc b/CIAO/tests/DAnCE/PartialShutdown/Component2/Component2.mpc new file mode 100755 index 00000000000..393d13e9121 --- /dev/null +++ b/CIAO/tests/DAnCE/PartialShutdown/Component2/Component2.mpc @@ -0,0 +1,149 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p PartialShutdown Component2" + +project(PartialShutdown_Component2_idl_gen) : componentidldefaults { + custom_only = 1 + idlflags += -Wb,stub_export_macro=COMPONENT2_STUB_Export \ + -Wb,stub_export_include=Component2_stub_export.h \ + -Wb,skel_export_macro=COMPONENT2_SVNT_Export \ + -Wb,skel_export_include=Component2_svnt_export.h \ + -Wb,exec_export_macro=COMPONENT2_EXEC_Export \ + -Wb,exec_export_include=Component2_exec_export.h \ + -Gxhex -Gxhsk -Gxhst -I.. + + IDL_Files { + Component2.idl + } +} + +project(PartialShutdown_Component2_lem_gen) : ciaoidldefaults { + after += PartialShutdown_Component2_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=COMPONENT2_LEM_STUB_Export \ + -Wb,stub_export_include=Component2_lem_stub_export.h \ + -SS -Gxhst -I.. + + IDL_Files { + Component2E.idl + } +} + +project(PartialShutdown_Component2_lem_stub) : ccm_svnt { + after += PartialShutdown_Component2_lem_gen PartialShutdown_Component2_stub PartialShutdown_stub + libs += PartialShutdown_stub Component2_stub + + includes += .. + + libout = ../lib + libpaths += ../lib + + sharedname = Component2_lem_stub + dynamicflags += COMPONENT2_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Component2EC.cpp + } + + Header_Files { + Component2EC.h + Component2_lem_stub_export.h + } + + Inline_Files { + Component2EC.inl + } +} + +project(PartialShutdown_Component2_stub) : ccm_stub { + after += PartialShutdown_Component2_idl_gen PartialShutdown_stub + libs += PartialShutdown_stub + + includes += .. + + libout = ../lib + libpaths += ../lib + + sharedname = Component2_stub + dynamicflags += COMPONENT2_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Component2C.cpp + } + + Header_Files { + Component2C.h + Component2_stub_export.h + } + + Inline_Files { + Component2C.inl + } +} + +project(PartialShutdown_Component2_exec) : ciao_executor { + after += PartialShutdown_Component2_lem_stub PartialShutdown_Component2_stub + sharedname = Component2_exec + libs += Component2_stub Component2_lem_stub PartialShutdown_stub + + includes += .. + + libout = ../lib + libpaths += ../lib + + dynamicflags += COMPONENT2_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Component2_exec.cpp + } + + Header_Files { + Component2_exec.h + Component2_exec_export.h + } + + Inline_Files { + } +} + + +project(PartialShutdown_Component2_svnt) : ciao_servant { + after += PartialShutdown_Component2_lem_stub + sharedname = Component2_svnt + libs += Component2_stub Component2_lem_stub PartialShutdown_stub + + includes += .. + + libout = ../lib + libpaths += ../lib + + dynamicflags += COMPONENT2_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Component2S.cpp + Component2_svnt.cpp + } + + Header_Files { + Component2S.h + Component2_svnt.h + Component2_svnt_export.h + } + + Inline_Files { + Component2S.inl + } +} + + diff --git a/CIAO/tests/DAnCE/PartialShutdown/Component2/Component2_exec.cpp b/CIAO/tests/DAnCE/PartialShutdown/Component2/Component2_exec.cpp new file mode 100644 index 00000000000..81be92a6023 --- /dev/null +++ b/CIAO/tests/DAnCE/PartialShutdown/Component2/Component2_exec.cpp @@ -0,0 +1,431 @@ +// -*- C++ -*- +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v2.0.0 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ + +#include "Component2_exec.h" +#include "tao/ORB_Core.h" +#include "ace/Reactor.h" + +namespace CIAO_PartialShutdown_Component2_Impl +{ + + /** + * WriteTicker + */ + + WriteTicker::WriteTicker (Component2_exec_i &callback) + : callback_ (callback) + { + } + + int + WriteTicker::handle_timeout (const ACE_Time_Value &, const void *) + { + // Notify the subscribers + this->callback_.write_all (); + return 0; + } + + /** + * ReadTicker + */ + + ReadTicker::ReadTicker (Component2_exec_i &callback) + : callback_ (callback) + { + } + + int + ReadTicker::handle_timeout (const ACE_Time_Value &, const void *) + { + // Notify the subscribers + this->callback_.read_all (); + return 0; + } + + /** + * Facet Executor Implementation Class: comp_2_writer_exec_i + */ + + comp_2_writer_exec_i::comp_2_writer_exec_i ( + ::PartialShutdown::CCM_Component2_Context_ptr ctx, + Component2_exec_i & callback) + : ciao_context_ ( + ::PartialShutdown::CCM_Component2_Context::_duplicate (ctx)) + , callback_(callback) + { + } + + comp_2_writer_exec_i::~comp_2_writer_exec_i (void) + { + } + + // Operations from ::PartialShutdown::Writer + + void + comp_2_writer_exec_i::write_line (const char * line) + { + this->callback_.write_line(line); + } + + /** + * Facet Executor Implementation Class: comp_2_reader_exec_i + */ + + comp_2_reader_exec_i::comp_2_reader_exec_i ( + ::PartialShutdown::CCM_Component2_Context_ptr ctx, + Component2_exec_i & callback) + : ciao_context_ ( + ::PartialShutdown::CCM_Component2_Context::_duplicate (ctx)) + , callback_(callback) + { + } + + comp_2_reader_exec_i::~comp_2_reader_exec_i (void) + { + } + + // Operations from ::PartialShutdown::Reader + + ::CORBA::StringSeq * + comp_2_reader_exec_i::read_lines (void) + { + return this->callback_.read_lines (); + } + + /** + * Component Executor Implementation Class: Component2_exec_i + */ + + Component2_exec_i::Component2_exec_i (void) + { + ACE_NEW_THROW_EX (this->write_ticker_, + WriteTicker (*this), + ::CORBA::NO_MEMORY ()); + ACE_NEW_THROW_EX (this->read_ticker_, + ReadTicker (*this), + ::CORBA::NO_MEMORY ()); + } + + Component2_exec_i::~Component2_exec_i (void) + { + delete this->write_ticker_; + delete this->read_ticker_; + if (!::CORBA::is_nil (this->ciao_context_.in ())) + { + PartialShutdown::Reader_var read_from_comp_1 = + this->ciao_context_->get_connection_read_from_comp_1 (); + if (!::CORBA::is_nil (read_from_comp_1.in ())) + { + ACE_ERROR ((LM_ERROR, "Component2_exec_i::~Component2_exec_i - " + "ERROR: Read interface of component 1 still valid\n")); + } + else + { + ACE_DEBUG ((LM_DEBUG, "Component2_exec_i::~Component2_exec_i - " + "OK: Read interface of component 1 is not valid\n")); + } + PartialShutdown::Reader_var read_from_comp_3 = + this->ciao_context_->get_connection_read_from_comp_3 (); + if (!::CORBA::is_nil (read_from_comp_3.in ())) + { + ACE_ERROR ((LM_ERROR, "Component2_exec_i::~Component2_exec_i - " + "ERROR: Read interface of component 3 still valid\n")); + } + else + { + ACE_DEBUG ((LM_DEBUG, "Component2_exec_i::~Component2_exec_i - " + "OK: Read interface of component 3 is not valid\n")); + } + + PartialShutdown::Writer_var writer_to_comp_1 = + this->ciao_context_->get_connection_write_to_comp_1 (); + if (!::CORBA::is_nil (writer_to_comp_1.in ())) + { + ACE_ERROR ((LM_ERROR, "Component2_exec_i::~Component2_exec_i - " + "ERROR: Write interface of component 1 still valid\n")); + } + else + { + ACE_DEBUG ((LM_DEBUG, "Component2_exec_i::~Component2_exec_i - " + "OK: Write interface of component 1 is not valid\n")); + } + + PartialShutdown::Writer_var writer_to_comp_3 = + this->ciao_context_->get_connection_write_to_comp_3 (); + if (!::CORBA::is_nil (writer_to_comp_3.in ())) + { + ACE_ERROR ((LM_ERROR, "Component2_exec_i::~Component2_exec_i - " + "ERROR: Write interface of component 3 still valid\n")); + } + else + { + ACE_DEBUG ((LM_DEBUG, "Component2_exec_i::~Component2_exec_i - " + "OK: Write interface of component 3 is not valid\n")); + } + } + } + + // Supported operations and attributes. + ACE_Reactor* + Component2_exec_i::reactor (void) + { + ACE_Reactor* reactor = 0; + ::CORBA::Object_var ccm_object = + this->ciao_context_->get_CCM_object(); + if (! ::CORBA::is_nil (ccm_object.in ())) + { + ::CORBA::ORB_var orb = ccm_object->_get_orb (); + if (! ::CORBA::is_nil (orb.in ())) + { + reactor = orb->orb_core ()->reactor (); + } + } + if (reactor == 0) + { + throw ::CORBA::INTERNAL (); + } + return reactor; + } + + void Component2_exec_i::read_all (void) + { + PartialShutdown::Reader_var read_from_comp_1 = + this->ciao_context_->get_connection_read_from_comp_1 (); + if (::CORBA::is_nil (read_from_comp_1.in ())) + { + ACE_ERROR ((LM_ERROR, "Component2_exec_i::read_all - " + "ERROR: Reader of component 1 seems NIL\n")); + } + else + { + ::CORBA::StringSeq_var strings_from_1 = + read_from_comp_1->read_lines (); + for (::CORBA::ULong i = 0; i < strings_from_1->length (); ++i) + { + ACE_DEBUG ((LM_DEBUG, "COMPONENT2: READ FROM COMPONENT1 : %C\n", + strings_from_1[i].in ())); + } + } + + PartialShutdown::Reader_var read_from_comp_3 = + this->ciao_context_->get_connection_read_from_comp_3 (); + if (::CORBA::is_nil (read_from_comp_3.in ())) + { + ACE_DEBUG ((LM_DEBUG, "Component2_exec_i::read_all - " + "Reader of component 3 seems NIL\n")); + } + else + { + ::CORBA::StringSeq_var strings_from_3 = + read_from_comp_3->read_lines (); + for (::CORBA::ULong i = 0; i < strings_from_3->length (); ++i) + { + ACE_DEBUG ((LM_DEBUG, "COMPONENT2: READ FROM COMPONENT3 : %C\n", + strings_from_3[i].in ())); + } + } + } + + void Component2_exec_i::write_all (void) + { + const char * str_to_comp_1 = "FROM COMPONENT2 TO COMPONENT1"; + const char * str_to_comp_3 = "FROM COMPONENT2 TO COMPONENT3"; + + PartialShutdown::Writer_var writer_to_comp_1 = + this->ciao_context_->get_connection_write_to_comp_1 (); + if (::CORBA::is_nil (writer_to_comp_1.in ())) + { + ACE_ERROR ((LM_ERROR, "Component2_exec_i::write_all - " + "ERROR: Writer to component 1 seems NIL\n")); + } + else + { + writer_to_comp_1->write_line (str_to_comp_1); + } + + PartialShutdown::Writer_var writer_to_comp_3 = + this->ciao_context_->get_connection_write_to_comp_3 (); + + if (::CORBA::is_nil (writer_to_comp_3.in ())) + { + ACE_DEBUG ((LM_DEBUG, "Component2_exec_i::write_all - " + "Writer to component 3 seems NIL\n")); + } + else + { + writer_to_comp_3->write_line (str_to_comp_3); + } + } + + void + Component2_exec_i::write_line (const char* line) + { + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, _guard, + this->mutex_, CORBA::INTERNAL ()); + { + ACE_DEBUG ((LM_DEBUG, "Component2_exec_i::write_line - " + "New line: <%C>\n", + line)); + this->strings_.push_back (line); + } + } + + + ::CORBA::StringSeq * + Component2_exec_i::read_lines (void) + { + CORBA::StringSeq *args = 0; + ACE_NEW_THROW_EX (args, + CORBA::StringSeq, + CORBA::NO_MEMORY ()); + + CORBA::StringSeq_var safe_args (args); + + // Copy the argument vector to the string sequence. + + args->length (this->strings_.size ()); + for (::CORBA::ULong i = 0; i < this->strings_.size (); ++i) + { + (*args)[i] = CORBA::string_dup (this->strings_[i]); + } + + return safe_args._retn (); + } + // Component attributes and port operations. + + ::PartialShutdown::CCM_Writer_ptr + Component2_exec_i::get_comp_2_writer (void) + { + if ( ::CORBA::is_nil (this->ciao_comp_2_writer_.in ())) + { + comp_2_writer_exec_i *tmp = 0; + ACE_NEW_RETURN ( + tmp, + comp_2_writer_exec_i ( + this->ciao_context_.in (), + *this), + ::PartialShutdown::CCM_Writer::_nil ()); + + this->ciao_comp_2_writer_ = tmp; + } + + return + ::PartialShutdown::CCM_Writer::_duplicate ( + this->ciao_comp_2_writer_.in ()); + } + + ::PartialShutdown::CCM_Reader_ptr + Component2_exec_i::get_comp_2_reader (void) + { + if ( ::CORBA::is_nil (this->ciao_comp_2_reader_.in ())) + { + comp_2_reader_exec_i *tmp = 0; + ACE_NEW_RETURN ( + tmp, + comp_2_reader_exec_i ( + this->ciao_context_.in (), + *this), + ::PartialShutdown::CCM_Reader::_nil ()); + + this->ciao_comp_2_reader_ = tmp; + } + + return + ::PartialShutdown::CCM_Reader::_duplicate ( + this->ciao_comp_2_reader_.in ()); + } + + // Operations from Components::SessionComponent. + + void + Component2_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + this->ciao_context_ = + ::PartialShutdown::CCM_Component2_Context::_narrow (ctx); + + if ( ::CORBA::is_nil (this->ciao_context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + Component2_exec_i::configuration_complete (void) + { + /* Your code here. */ + } + + void + Component2_exec_i::ccm_activate (void) + { + if (this->reactor ()->schedule_timer ( + this->write_ticker_, + 0, + ACE_Time_Value (5, 0), + ACE_Time_Value (1, 0)) == -1) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Sender_exec_i::start : ") + ACE_TEXT ("Error scheduling write ticker\n"))); + } + if (this->reactor ()->schedule_timer ( + this->read_ticker_, + 0, + ACE_Time_Value (5, 0), + ACE_Time_Value (1, 0)) == -1) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Sender_exec_i::start : ") + ACE_TEXT ("Error scheduling read ticker\n"))); + } + } + + void + Component2_exec_i::ccm_passivate (void) + { + this->reactor ()->cancel_timer (this->write_ticker_); + this->reactor ()->cancel_timer (this->read_ticker_); + } + + void + Component2_exec_i::ccm_remove (void) + { + /* Your code here. */ + } + + extern "C" COMPONENT2_EXEC_Export ::Components::EnterpriseComponent_ptr + create_PartialShutdown_Component2_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_NORETURN ( + retval, + Component2_exec_i); + + return retval; + } +} diff --git a/CIAO/tests/DAnCE/PartialShutdown/Component2/Component2_exec.h b/CIAO/tests/DAnCE/PartialShutdown/Component2/Component2_exec.h new file mode 100644 index 00000000000..a1201914d12 --- /dev/null +++ b/CIAO/tests/DAnCE/PartialShutdown/Component2/Component2_exec.h @@ -0,0 +1,208 @@ +// -*- C++ -*- +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v2.0.0 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ +#ifndef CIAO_COMPONENT2_EXEC_M1RLIS_H_ +#define CIAO_COMPONENT2_EXEC_M1RLIS_H_ + +#include /**/ "ace/pre.h" + +#include "Component2EC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ "Component2_exec_export.h" +#include "tao/LocalObject.h" + +#include <vector> + +namespace CIAO_PartialShutdown_Component2_Impl +{ + class Component2_exec_i; + + /** + * WriteTicker + */ + + class WriteTicker : + public ACE_Event_Handler + { + public: + WriteTicker (Component2_exec_i &callback); + int handle_timeout (const ACE_Time_Value &, const void *); + private: + /// Maintains a handle that actually process the event + Component2_exec_i &callback_; + }; + + /** + * ReadTicker + */ + + class ReadTicker : + public ACE_Event_Handler + { + public: + ReadTicker (Component2_exec_i &callback); + int handle_timeout (const ACE_Time_Value &, const void *); + private: + /// Maintains a handle that actually process the event + Component2_exec_i &callback_; + }; + + /** + * Provider Executor Implementation Class: comp_2_writer_exec_i + */ + + class comp_2_writer_exec_i + : public virtual ::PartialShutdown::CCM_Writer, + public virtual ::CORBA::LocalObject + { + public: + comp_2_writer_exec_i ( + ::PartialShutdown::CCM_Component2_Context_ptr ctx, + Component2_exec_i &callback); + virtual ~comp_2_writer_exec_i (void); + + //@{ + /** Operations and attributes from PartialShutdown::Writer. */ + + virtual + void write_line (const char * line); + //@} + + private: + ::PartialShutdown::CCM_Component2_Context_var ciao_context_; + Component2_exec_i &callback_; + }; + + /** + * Provider Executor Implementation Class: comp_2_reader_exec_i + */ + + class comp_2_reader_exec_i + : public virtual ::PartialShutdown::CCM_Reader, + public virtual ::CORBA::LocalObject + { + public: + comp_2_reader_exec_i ( + ::PartialShutdown::CCM_Component2_Context_ptr ctx, + Component2_exec_i &callback); + virtual ~comp_2_reader_exec_i (void); + + //@{ + /** Operations and attributes from PartialShutdown::Reader. */ + + virtual + ::CORBA::StringSeq * read_lines (void); + //@} + + private: + ::PartialShutdown::CCM_Component2_Context_var ciao_context_; + Component2_exec_i &callback_; + }; + + /** + * Component Executor Implementation Class: Component2_exec_i + */ + + class Component2_exec_i + : public virtual Component2_Exec, + public virtual ::CORBA::LocalObject + { + public: + Component2_exec_i (void); + virtual ~Component2_exec_i (void); + + //@{ + /** Supported operations and attributes. */ + + //@} + + //@{ + /** Component attributes and port operations. */ + + virtual ::PartialShutdown::CCM_Writer_ptr + get_comp_2_writer (void); + + virtual ::PartialShutdown::CCM_Reader_ptr + get_comp_2_reader (void); + //@} + + //@{ + /** Operations from Components::SessionComponent. */ + virtual void set_session_context (::Components::SessionContext_ptr ctx); + virtual void configuration_complete (void); + virtual void ccm_activate (void); + virtual void ccm_passivate (void); + virtual void ccm_remove (void); + //@} + + //@{ + /** User defined public operations. */ + void read_all (void); + void write_all (void); + + void write_line (const char * line); + ::CORBA::StringSeq * read_lines (void); + //@} + + private: + ::PartialShutdown::CCM_Component2_Context_var ciao_context_; + + //@{ + /** Component attributes. */ + ::PartialShutdown::CCM_Writer_var ciao_comp_2_writer_; + ::PartialShutdown::CCM_Reader_var ciao_comp_2_reader_; + //@} + + //@{ + /** User defined members. */ + WriteTicker * write_ticker_; + ReadTicker * read_ticker_; + TAO_SYNCH_MUTEX mutex_; + typedef std::vector <const char *> Strings; + Strings strings_; + + //@} + + //@{ + /** User defined private operations. */ + + //@} + + /// Get the ACE_Reactor + ACE_Reactor* reactor (void); + }; + + extern "C" COMPONENT2_EXEC_Export ::Components::EnterpriseComponent_ptr + create_PartialShutdown_Component2_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* ifndef */ diff --git a/CIAO/tests/DAnCE/PartialShutdown/Component3/Component3.idl b/CIAO/tests/DAnCE/PartialShutdown/Component3/Component3.idl new file mode 100644 index 00000000000..1edc514d783 --- /dev/null +++ b/CIAO/tests/DAnCE/PartialShutdown/Component3/Component3.idl @@ -0,0 +1,29 @@ +// $Id$ + +/** + * @file Component3.idl + * @author Marcel Smit <msmit@remedy.nl> + */ + +#ifndef COMPONENT3_IDL_ +#define COMPONENT3_IDL_ + +#include "Base/PartialShutdown.idl" + +module PartialShutdown +{ + component Component3 + { + uses Writer write_to_comp_1; + uses Writer write_to_comp_2; + + uses Reader read_from_comp_1; + uses Reader read_from_comp_2; + + provides Writer comp_3_writer; + + provides Reader comp_3_reader; + }; +}; + +#endif /* COMPONENT3_IDL_ */ diff --git a/CIAO/tests/DAnCE/PartialShutdown/Component3/Component3.mpc b/CIAO/tests/DAnCE/PartialShutdown/Component3/Component3.mpc new file mode 100755 index 00000000000..4d765df747f --- /dev/null +++ b/CIAO/tests/DAnCE/PartialShutdown/Component3/Component3.mpc @@ -0,0 +1,149 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p PartialShutdown Component3" + +project(PartialShutdown_Component3_idl_gen) : componentidldefaults { + custom_only = 1 + idlflags += -Wb,stub_export_macro=COMPONENT3_STUB_Export \ + -Wb,stub_export_include=Component3_stub_export.h \ + -Wb,skel_export_macro=COMPONENT3_SVNT_Export \ + -Wb,skel_export_include=Component3_svnt_export.h \ + -Wb,exec_export_macro=COMPONENT3_EXEC_Export \ + -Wb,exec_export_include=Component3_exec_export.h \ + -Gxhex -Gxhsk -Gxhst -I.. + + IDL_Files { + Component3.idl + } +} + +project(PartialShutdown_Component3_lem_gen) : ciaoidldefaults { + after += PartialShutdown_Component3_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=COMPONENT3_LEM_STUB_Export \ + -Wb,stub_export_include=Component3_lem_stub_export.h \ + -SS -Gxhst -I.. + + IDL_Files { + Component3E.idl + } +} + +project(PartialShutdown_Component3_lem_stub) : ccm_svnt { + after += PartialShutdown_Component3_lem_gen PartialShutdown_Component3_stub PartialShutdown_stub + libs += PartialShutdown_stub Component3_stub + + libout = ../lib + libpaths += ../lib + + includes += .. + + sharedname = Component3_lem_stub + dynamicflags += COMPONENT3_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Component3EC.cpp + } + + Header_Files { + Component3EC.h + Component3_lem_stub_export.h + } + + Inline_Files { + Component3EC.inl + } +} + +project(PartialShutdown_Component3_stub) : ccm_stub { + after += PartialShutdown_Component3_idl_gen PartialShutdown_stub + libs += PartialShutdown_stub + + includes += .. + + libout = ../lib + libpaths += ../lib + + sharedname = Component3_stub + dynamicflags += COMPONENT3_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Component3C.cpp + } + + Header_Files { + Component3C.h + Component3_stub_export.h + } + + Inline_Files { + Component3C.inl + } +} + +project(PartialShutdown_Component3_exec) : ciao_executor { + after += PartialShutdown_Component3_lem_stub PartialShutdown_Component3_stub + sharedname = Component3_exec + libs += Component3_stub Component3_lem_stub PartialShutdown_stub + + includes += .. + + libout = ../lib + libpaths += ../lib + + dynamicflags += COMPONENT3_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Component3_exec.cpp + } + + Header_Files { + Component3_exec.h + Component3_exec_export.h + } + + Inline_Files { + } +} + + +project(PartialShutdown_Component3_svnt) : ciao_servant { + after += PartialShutdown_Component3_lem_stub + sharedname = Component3_svnt + libs += Component3_stub Component3_lem_stub PartialShutdown_stub + + includes += .. + + libout = ../lib + libpaths += ../lib + + dynamicflags += COMPONENT3_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Component3S.cpp + Component3_svnt.cpp + } + + Header_Files { + Component3S.h + Component3_svnt.h + Component3_svnt_export.h + } + + Inline_Files { + Component3S.inl + } +} + + diff --git a/CIAO/tests/DAnCE/PartialShutdown/Component3/Component3_exec.cpp b/CIAO/tests/DAnCE/PartialShutdown/Component3/Component3_exec.cpp new file mode 100644 index 00000000000..9b62382a25a --- /dev/null +++ b/CIAO/tests/DAnCE/PartialShutdown/Component3/Component3_exec.cpp @@ -0,0 +1,432 @@ +// -*- C++ -*- +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v2.0.0 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ + +#include "Component3_exec.h" +#include "tao/ORB_Core.h" +#include "ace/Reactor.h" + +namespace CIAO_PartialShutdown_Component3_Impl +{ + + /** + * WriteTicker + */ + + WriteTicker::WriteTicker (Component3_exec_i &callback) + : callback_ (callback) + { + } + + int + WriteTicker::handle_timeout (const ACE_Time_Value &, const void *) + { + // Notify the subscribers + this->callback_.write_all (); + return 0; + } + + /** + * ReadTicker + */ + + ReadTicker::ReadTicker (Component3_exec_i &callback) + : callback_ (callback) + { + } + + int + ReadTicker::handle_timeout (const ACE_Time_Value &, const void *) + { + // Notify the subscribers + this->callback_.read_all (); + return 0; + } + + /** + * Facet Executor Implementation Class: comp_3_writer_exec_i + */ + + comp_3_writer_exec_i::comp_3_writer_exec_i ( + ::PartialShutdown::CCM_Component3_Context_ptr ctx, + Component3_exec_i & callback) + : ciao_context_ ( + ::PartialShutdown::CCM_Component3_Context::_duplicate (ctx)) + , callback_ (callback) + { + } + + comp_3_writer_exec_i::~comp_3_writer_exec_i (void) + { + } + + // Operations from ::PartialShutdown::Writer + + void + comp_3_writer_exec_i::write_line (const char * line) + { + this->callback_.write_line (line); + } + + /** + * Facet Executor Implementation Class: comp_3_reader_exec_i + */ + + comp_3_reader_exec_i::comp_3_reader_exec_i ( + ::PartialShutdown::CCM_Component3_Context_ptr ctx, + Component3_exec_i & callback) + : ciao_context_ ( + ::PartialShutdown::CCM_Component3_Context::_duplicate (ctx)) + , callback_ (callback) + { + } + + comp_3_reader_exec_i::~comp_3_reader_exec_i (void) + { + } + + // Operations from ::PartialShutdown::Reader + + ::CORBA::StringSeq * + comp_3_reader_exec_i::read_lines (void) + { + return this->callback_.read_lines (); + } + + /** + * Component Executor Implementation Class: Component3_exec_i + */ + + Component3_exec_i::Component3_exec_i (void) + { + ACE_NEW_THROW_EX (this->write_ticker_, + WriteTicker (*this), + ::CORBA::NO_MEMORY ()); + ACE_NEW_THROW_EX (this->read_ticker_, + ReadTicker (*this), + ::CORBA::NO_MEMORY ()); + } + + Component3_exec_i::~Component3_exec_i (void) + { + delete this->write_ticker_; + delete this->read_ticker_; + if (!::CORBA::is_nil (this->ciao_context_.in ())) + { + PartialShutdown::Reader_var read_from_comp_1 = + this->ciao_context_->get_connection_read_from_comp_1 (); + if (!::CORBA::is_nil (read_from_comp_1.in ())) + { + ACE_ERROR ((LM_ERROR, "Component3_exec_i::~Component3_exec_i - " + "ERROR: Read interface of component 1 still valid\n")); + } + else + { + ACE_DEBUG ((LM_DEBUG, "Component3_exec_i::~Component3_exec_i - " + "OK: Read interface of component 1 is not valid\n")); + } + PartialShutdown::Reader_var read_from_comp_2 = + this->ciao_context_->get_connection_read_from_comp_2 (); + if (!::CORBA::is_nil (read_from_comp_2.in ())) + { + ACE_ERROR ((LM_ERROR, "Component3_exec_i::~Component3_exec_i - " + "ERROR: Read interface of component 2 still valid\n")); + } + else + { + ACE_DEBUG ((LM_DEBUG, "Component3_exec_i::~Component3_exec_i - " + "OK: Read interface of component 2 is not valid\n")); + } + + PartialShutdown::Writer_var writer_to_comp_1 = + this->ciao_context_->get_connection_write_to_comp_1 (); + if (!::CORBA::is_nil (writer_to_comp_1.in ())) + { + ACE_ERROR ((LM_ERROR, "Component3_exec_i::~Component3_exec_i - " + "ERROR: Write interface of component 1 still valid\n")); + } + else + { + ACE_DEBUG ((LM_DEBUG, "Component3_exec_i::~Component3_exec_i - " + "OK: Write interface of component 1 is not valid\n")); + } + + PartialShutdown::Writer_var writer_to_comp_2 = + this->ciao_context_->get_connection_write_to_comp_2 (); + if (!::CORBA::is_nil (writer_to_comp_2.in ())) + { + ACE_ERROR ((LM_ERROR, "Component3_exec_i::~Component3_exec_i - " + "ERROR: Write interface of component 2 still valid\n")); + } + else + { + ACE_DEBUG ((LM_DEBUG, "Component3_exec_i::~Component3_exec_i - " + "OK: Write interface of component 2 is not valid\n")); + } + } + } + + // Supported operations and attributes. + ACE_Reactor* + Component3_exec_i::reactor (void) + { + ACE_Reactor* reactor = 0; + ::CORBA::Object_var ccm_object = + this->ciao_context_->get_CCM_object(); + if (! ::CORBA::is_nil (ccm_object.in ())) + { + ::CORBA::ORB_var orb = ccm_object->_get_orb (); + if (! ::CORBA::is_nil (orb.in ())) + { + reactor = orb->orb_core ()->reactor (); + } + } + if (reactor == 0) + { + throw ::CORBA::INTERNAL (); + } + return reactor; + } + + void Component3_exec_i::read_all (void) + { + PartialShutdown::Reader_var read_from_comp_1 = + this->ciao_context_->get_connection_read_from_comp_1 (); + if (::CORBA::is_nil (read_from_comp_1.in ())) + { + ACE_ERROR ((LM_ERROR, "Component3_exec_i::read_all - " + "ERROR: Reader of component 1 seems NIL\n")); + } + else + { + ::CORBA::StringSeq_var strings_from_1 = + read_from_comp_1->read_lines (); + for (::CORBA::ULong i = 0; i < strings_from_1->length (); ++i) + { + ACE_DEBUG ((LM_DEBUG, "COMPONENT3: READ FROM COMPONENT1 : %C\n", + strings_from_1[i].in ())); + } + } + + PartialShutdown::Reader_var read_from_comp_2 = + this->ciao_context_->get_connection_read_from_comp_2 (); + if (::CORBA::is_nil (read_from_comp_2.in ())) + { + ACE_ERROR ((LM_ERROR, "Component3_exec_i::read_all - " + "ERROR: Reader of component 2 seems NIL\n")); + } + else + { + ::CORBA::StringSeq_var strings_from_2 = + read_from_comp_2->read_lines (); + for (::CORBA::ULong i = 0; i < strings_from_2->length (); ++i) + { + ACE_DEBUG ((LM_DEBUG, "COMPONENT3: READ FROM COMPONENT2 : %C\n", + strings_from_2[i].in ())); + } + } + } + + void Component3_exec_i::write_all (void) + { + const char * str_to_comp_1 = "FROM COMPONENT3 TO COMPONENT1"; + const char * str_to_comp_2 = "FROM COMPONENT3 TO COMPONENT2"; + + PartialShutdown::Writer_var writer_to_comp_1 = + this->ciao_context_->get_connection_write_to_comp_1 (); + if (::CORBA::is_nil (writer_to_comp_1.in ())) + { + ACE_ERROR ((LM_ERROR, "Component3_exec_i::write_all - " + "ERROR: Writer to component 1 seems NIL\n")); + } + else + { + writer_to_comp_1->write_line (str_to_comp_1); + } + + PartialShutdown::Writer_var writer_to_comp_2 = + this->ciao_context_->get_connection_write_to_comp_2 (); + + if (::CORBA::is_nil (writer_to_comp_2.in ())) + { + ACE_ERROR ((LM_ERROR, "Component3_exec_i::write_all - " + "ERROR: Writer to component 2 seems NIL\n")); + } + else + { + writer_to_comp_2->write_line (str_to_comp_2); + } + } + + void + Component3_exec_i::write_line (const char* line) + { + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, _guard, + this->mutex_, CORBA::INTERNAL ()); + { + ACE_DEBUG ((LM_DEBUG, "Component3_exec_i::write_line - " + "New line: <%C>\n", + line)); + this->strings_.push_back (line); + } + } + + + ::CORBA::StringSeq * + Component3_exec_i::read_lines (void) + { + CORBA::StringSeq *args = 0; + ACE_NEW_THROW_EX (args, + CORBA::StringSeq, + CORBA::NO_MEMORY ()); + + CORBA::StringSeq_var safe_args (args); + + // Copy the argument vector to the string sequence. + + args->length (this->strings_.size ()); + for (::CORBA::ULong i = 0; i < this->strings_.size (); ++i) + { + (*args)[i] = CORBA::string_dup (this->strings_[i]); + } + + return safe_args._retn (); + } + + // Component attributes and port operations. + + ::PartialShutdown::CCM_Writer_ptr + Component3_exec_i::get_comp_3_writer (void) + { + if ( ::CORBA::is_nil (this->ciao_comp_3_writer_.in ())) + { + comp_3_writer_exec_i *tmp = 0; + ACE_NEW_RETURN ( + tmp, + comp_3_writer_exec_i ( + this->ciao_context_.in (), + *this), + ::PartialShutdown::CCM_Writer::_nil ()); + + this->ciao_comp_3_writer_ = tmp; + } + + return + ::PartialShutdown::CCM_Writer::_duplicate ( + this->ciao_comp_3_writer_.in ()); + } + + ::PartialShutdown::CCM_Reader_ptr + Component3_exec_i::get_comp_3_reader (void) + { + if ( ::CORBA::is_nil (this->ciao_comp_3_reader_.in ())) + { + comp_3_reader_exec_i *tmp = 0; + ACE_NEW_RETURN ( + tmp, + comp_3_reader_exec_i ( + this->ciao_context_.in (), + *this), + ::PartialShutdown::CCM_Reader::_nil ()); + + this->ciao_comp_3_reader_ = tmp; + } + + return + ::PartialShutdown::CCM_Reader::_duplicate ( + this->ciao_comp_3_reader_.in ()); + } + + // Operations from Components::SessionComponent. + + void + Component3_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + this->ciao_context_ = + ::PartialShutdown::CCM_Component3_Context::_narrow (ctx); + + if ( ::CORBA::is_nil (this->ciao_context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + Component3_exec_i::configuration_complete (void) + { + /* Your code here. */ + } + + void + Component3_exec_i::ccm_activate (void) + { + if (this->reactor ()->schedule_timer ( + this->write_ticker_, + 0, + ACE_Time_Value (5, 0), + ACE_Time_Value (1, 0)) == -1) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Sender_exec_i::start : ") + ACE_TEXT ("Error scheduling write ticker\n"))); + } + if (this->reactor ()->schedule_timer ( + this->read_ticker_, + 0, + ACE_Time_Value (5, 0), + ACE_Time_Value (1, 0)) == -1) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Sender_exec_i::start : ") + ACE_TEXT ("Error scheduling read ticker\n"))); + } + } + + void + Component3_exec_i::ccm_passivate (void) + { + this->reactor ()->cancel_timer (this->write_ticker_); + this->reactor ()->cancel_timer (this->read_ticker_); + } + + void + Component3_exec_i::ccm_remove (void) + { + /* Your code here. */ + } + + extern "C" COMPONENT3_EXEC_Export ::Components::EnterpriseComponent_ptr + create_PartialShutdown_Component3_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_NORETURN ( + retval, + Component3_exec_i); + + return retval; + } +} diff --git a/CIAO/tests/DAnCE/PartialShutdown/Component3/Component3_exec.h b/CIAO/tests/DAnCE/PartialShutdown/Component3/Component3_exec.h new file mode 100644 index 00000000000..b243f0ec5f6 --- /dev/null +++ b/CIAO/tests/DAnCE/PartialShutdown/Component3/Component3_exec.h @@ -0,0 +1,210 @@ +// -*- C++ -*- +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v2.0.0 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ +#ifndef CIAO_COMPONENT3_EXEC_UTY3AH_H_ +#define CIAO_COMPONENT3_EXEC_UTY3AH_H_ + +#include /**/ "ace/pre.h" + +#include "Component3EC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ "Component3_exec_export.h" +#include "tao/LocalObject.h" + +#include <vector> + +namespace CIAO_PartialShutdown_Component3_Impl +{ + class Component3_exec_i; + + /** + * WriteTicker + */ + + class WriteTicker : + public ACE_Event_Handler + { + public: + WriteTicker (Component3_exec_i &callback); + int handle_timeout (const ACE_Time_Value &, const void *); + private: + /// Maintains a handle that actually process the event + Component3_exec_i &callback_; + }; + + /** + * ReadTicker + */ + + class ReadTicker : + public ACE_Event_Handler + { + public: + ReadTicker (Component3_exec_i &callback); + int handle_timeout (const ACE_Time_Value &, const void *); + private: + /// Maintains a handle that actually process the event + Component3_exec_i &callback_; + }; + + + /** + * Provider Executor Implementation Class: comp_3_writer_exec_i + */ + + class comp_3_writer_exec_i + : public virtual ::PartialShutdown::CCM_Writer, + public virtual ::CORBA::LocalObject + { + public: + comp_3_writer_exec_i ( + ::PartialShutdown::CCM_Component3_Context_ptr ctx, + Component3_exec_i & callback); + virtual ~comp_3_writer_exec_i (void); + + //@{ + /** Operations and attributes from PartialShutdown::Writer. */ + + virtual + void write_line (const char * line); + //@} + + private: + ::PartialShutdown::CCM_Component3_Context_var ciao_context_; + Component3_exec_i & callback_; + }; + + /** + * Provider Executor Implementation Class: comp_3_reader_exec_i + */ + + class comp_3_reader_exec_i + : public virtual ::PartialShutdown::CCM_Reader, + public virtual ::CORBA::LocalObject + { + public: + comp_3_reader_exec_i ( + ::PartialShutdown::CCM_Component3_Context_ptr ctx, + Component3_exec_i & callback); + virtual ~comp_3_reader_exec_i (void); + + //@{ + /** Operations and attributes from PartialShutdown::Reader. */ + + virtual + ::CORBA::StringSeq * read_lines (void); + //@} + + private: + ::PartialShutdown::CCM_Component3_Context_var ciao_context_; + Component3_exec_i & callback_; + }; + + /** + * Component Executor Implementation Class: Component3_exec_i + */ + + class Component3_exec_i + : public virtual Component3_Exec, + public virtual ::CORBA::LocalObject + { + public: + Component3_exec_i (void); + virtual ~Component3_exec_i (void); + + //@{ + /** Supported operations and attributes. */ + + //@} + + //@{ + /** Component attributes and port operations. */ + + virtual ::PartialShutdown::CCM_Writer_ptr + get_comp_3_writer (void); + + virtual ::PartialShutdown::CCM_Reader_ptr + get_comp_3_reader (void); + //@} + + //@{ + /** Operations from Components::SessionComponent. */ + virtual void set_session_context (::Components::SessionContext_ptr ctx); + virtual void configuration_complete (void); + virtual void ccm_activate (void); + virtual void ccm_passivate (void); + virtual void ccm_remove (void); + //@} + + //@{ + /** User defined public operations. */ + void read_all (void); + void write_all (void); + + void write_line (const char * line); + ::CORBA::StringSeq * read_lines (void); + + //@} + + private: + ::PartialShutdown::CCM_Component3_Context_var ciao_context_; + + //@{ + /** Component attributes. */ + ::PartialShutdown::CCM_Writer_var ciao_comp_3_writer_; + ::PartialShutdown::CCM_Reader_var ciao_comp_3_reader_; + //@} + + //@{ + /** User defined members. */ + WriteTicker * write_ticker_; + ReadTicker * read_ticker_; + TAO_SYNCH_MUTEX mutex_; + typedef std::vector <const char *> Strings; + Strings strings_; + + //@} + + //@{ + /** User defined private operations. */ + + //@} + + /// Get the ACE_Reactor + ACE_Reactor* reactor (void); + }; + + extern "C" COMPONENT3_EXEC_Export ::Components::EnterpriseComponent_ptr + create_PartialShutdown_Component3_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* ifndef */ diff --git a/CIAO/tests/DAnCE/PartialShutdown/descriptors/Plan.cdp b/CIAO/tests/DAnCE/PartialShutdown/descriptors/Plan.cdp new file mode 100644 index 00000000000..f6bc9377a28 --- /dev/null +++ b/CIAO/tests/DAnCE/PartialShutdown/descriptors/Plan.cdp @@ -0,0 +1,486 @@ +<!-- $Id$ --> +<Deployment:DeploymentPlan + xmlns:Deployment="http://www.omg.org/Deployment" + xmlns:xmi="http://www.omg.org/XMI" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.omg.org/Deployment Deployment.xsd"> + <label>PartialShutdown_Depl_1</label> + <UUID>PartialShutdown_Depl_1</UUID> + + <implementation xmi:id="Component1Implementation"> + <name>Component1Implementation</name> + <source/> + <artifact xmi:idref="Component1_ExecArtifact" /> + <artifact xmi:idref="Component1_SvntArtifact" /> + <execParameter> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_PartialShutdown_Component1_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_PartialShutdown_Component1_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Component1_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Component1_exec</string> + </value> + </value> + </execParameter> + </implementation> + <implementation xmi:id="Component2Implementation"> + <name>Component2Implementation</name> + <source/> + <artifact xmi:idref="Component2_ExecArtifact" /> + <artifact xmi:idref="Component2_SvntArtifact" /> + <execParameter> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_PartialShutdown_Component2_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_PartialShutdown_Component2_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Component2_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Component2_exec</string> + </value> + </value> + </execParameter> + </implementation> + <implementation xmi:id="Component3Implementation"> + <name>Component3Implementation</name> + <source/> + <artifact xmi:idref="Component3_ExecArtifact" /> + <artifact xmi:idref="Component3_SvntArtifact" /> + <execParameter> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_PartialShutdown_Component3_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_PartialShutdown_Component3_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Component3_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Component3_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <instance xmi:id="Component1Instance"> + <name>Component1</name> + <node>ComponentNode</node> + <source/> + <implementation xmi:idref="Component1Implementation" /> + </instance> + <instance xmi:id="Component2Instance"> + <name>Component2</name> + <node>ComponentNode</node> + <source/> + <implementation xmi:idref="Component2Implementation" /> + </instance> + <instance xmi:id="Component3Instance"> + <name>Component3</name> + <node>ComponentNode</node> + <source/> + <implementation xmi:idref="Component3Implementation" /> + </instance> + + <!-- writer connections : + 1 writes to 2 + 1 writes to 3 + 2 writes to 1 + 2 writes to 3 + 3 writes to 1 + 3 writes to 2 + --> + <connection> + <name>component1_2_write</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>write_to_comp_2</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="Component1Instance" /> + </internalEndpoint> + <internalEndpoint> + <portName>comp_2_writer</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="Component2Instance" /> + </internalEndpoint> + </connection> + <connection> + <name>component1_3_write</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>write_to_comp_3</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="Component1Instance" /> + </internalEndpoint> + <internalEndpoint> + <portName>comp_3_writer</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="Component3Instance" /> + </internalEndpoint> + </connection> + + <connection> + <name>component2_1_write</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>write_to_comp_1</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="Component2Instance" /> + </internalEndpoint> + <internalEndpoint> + <portName>comp_1_writer</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="Component1Instance" /> + </internalEndpoint> + </connection> + <connection> + <name>component2_3_write</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>write_to_comp_3</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="Component2Instance" /> + </internalEndpoint> + <internalEndpoint> + <portName>comp_3_writer</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="Component3Instance" /> + </internalEndpoint> + </connection> + <connection> + <name>component3_1_write</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>write_to_comp_1</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="Component3Instance" /> + </internalEndpoint> + <internalEndpoint> + <portName>comp_1_writer</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="Component1Instance" /> + </internalEndpoint> + </connection> + <connection> + <name>component3_2_write</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>write_to_comp_2</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="Component3Instance" /> + </internalEndpoint> + <internalEndpoint> + <portName>comp_2_writer</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="Component2Instance" /> + </internalEndpoint> + </connection> + + <!-- reader connections : + 1 reads from 2 + 1 reads from 3 + 2 reads from 1 + 2 reads from 3 + 3 reads from 1 + 3 reads from 2 + --> + <connection> + <name>component1_2_read</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>read_from_comp_2</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="Component1Instance" /> + </internalEndpoint> + <internalEndpoint> + <portName>comp_2_reader</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="Component2Instance" /> + </internalEndpoint> + </connection> + <connection> + <name>component1_3_read</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>read_from_comp_3</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="Component1Instance" /> + </internalEndpoint> + <internalEndpoint> + <portName>comp_3_reader</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="Component3Instance" /> + </internalEndpoint> + </connection> + + <connection> + <name>component2_1_read</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>read_from_comp_1</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="Component2Instance" /> + </internalEndpoint> + <internalEndpoint> + <portName>comp_1_reader</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="Component1Instance" /> + </internalEndpoint> + </connection> + <connection> + <name>component2_3_read</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>read_from_comp_3</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="Component2Instance" /> + </internalEndpoint> + <internalEndpoint> + <portName>comp_3_reader</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="Component3Instance" /> + </internalEndpoint> + </connection> + + <connection> + <name>component3_1_read</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>read_from_comp_1</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="Component3Instance" /> + </internalEndpoint> + <internalEndpoint> + <portName>comp_1_reader</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="Component1Instance" /> + </internalEndpoint> + </connection> + + <connection> + <name>component3_2_read</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>read_from_comp_2</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="Component3Instance" /> + </internalEndpoint> + <internalEndpoint> + <portName>comp_2_reader</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="Component2Instance" /> + </internalEndpoint> + </connection> + + <artifact xmi:id="Component1_ExecArtifact"> + <name>Component1_exec</name> + <source/> + <node/> + <location>Component1_exec</location> + </artifact> + <artifact xmi:id="Component1_SvntArtifact"> + <name>Component1_svnt</name> + <source/> + <node/> + <location>Component1_svnt</location> + </artifact> + <artifact xmi:id="Component1_StubArtifact"> + <name>Component1_stub</name> + <source/> + <node/> + <location>Component1_stub</location> + </artifact> + + <artifact xmi:id="Component2_ExecArtifact"> + <name>Component2_exec</name> + <source/> + <node/> + <location>Component2_exec</location> + </artifact> + <artifact xmi:id="Component2_SvntArtifact"> + <name>Component2_svnt</name> + <source/> + <node/> + <location>Component2_svnt</location> + </artifact> + <artifact xmi:id="Component2_StubArtifact"> + <name>Component2_stub</name> + <source/> + <node/> + <location>Component2_stub</location> + </artifact> + + <artifact xmi:id="Component3_ExecArtifact"> + <name>Component3_exec</name> + <source/> + <node/> + <location>Component3_exec</location> + </artifact> + <artifact xmi:id="Component3_SvntArtifact"> + <name>Component3_svnt</name> + <source/> + <node/> + <location>Component3_svnt</location> + </artifact> + <artifact xmi:id="Component3_StubArtifact"> + <name>Component3_stub</name> + <source/> + <node/> + <location>Component3_stub</location> + </artifact> +</Deployment:DeploymentPlan> diff --git a/CIAO/tests/DAnCE/PartialShutdown/descriptors/run_test.pl b/CIAO/tests/DAnCE/PartialShutdown/descriptors/run_test.pl new file mode 100755 index 00000000000..b22641e5e32 --- /dev/null +++ b/CIAO/tests/DAnCE/PartialShutdown/descriptors/run_test.pl @@ -0,0 +1,263 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{'ACE_ROOT'}/bin"; +use PerlACE::TestTarget; + +$CIAO_ROOT = "$ENV{'CIAO_ROOT'}"; +$TAO_ROOT = "$ENV{'TAO_ROOT'}"; +$DANCE_ROOT = "$ENV{'DANCE_ROOT'}"; + +$daemons_running = 0; +$em_running = 0; +$ns_running = 0; + +$nr_daemon = 3; +@ports = ( 60010, 60011, 60012 ); +@iorbases = ( "NodeApp1.ior", "NodeApp2.ior", "NodeApp3.ior" ); +@iorfiles = 0; +@nodenames = ( "ComponentNode", "ComponentNode", "ComponentNode" ); + +# ior files other than daemon +# ior files other than daemon +$ior_nsbase = "ns.ior"; +$ior_nsfile = 0; +$ior_embase = "EM.ior"; +$ior_emfile = 0; + +# Processes +$E = 0; +$EM = 0; +$NS = 0; +@DEAMONS = 0; + +# targets +@tg_daemons = 0; +$tg_naming = 0; +$tg_exe_man = 0; +$tg_executor = 0; + +$status = 0; +$cdp_file = "Plan.cdp"; +# $cdp_shutdown_3 = "shutdown_comp_3.cdp"; +# $cdp_shutdown_rest = "shutdown_rest.cdp"; + +sub create_targets { + # naming service + $tg_naming = PerlACE::TestTarget::create_target (1) || die "Create target for ns failed\n"; + $tg_naming->AddLibPath ('../lib'); + # daemon + for ($i = 0; $i < $nr_daemon; ++$i) { + $tg_daemons[$i] = PerlACE::TestTarget::create_target ($i+1) || die "Create target for daemon $i failed\n"; + $tg_daemons[$i]->AddLibPath ('../lib'); + } + # execution manager + $tg_exe_man = PerlACE::TestTarget::create_target (1) || die "Create target for EM failed\n"; + $tg_exe_man->AddLibPath ('../lib'); + # executor (plan_launcher) + $tg_executor = PerlACE::TestTarget::create_target (1) || die "Create target for executor failed\n"; + $tg_executor->AddLibPath ('../lib'); +} + +sub init_ior_files { + $ior_nsfile = $tg_naming->LocalFile ($ior_nsbase); + $ior_emfile = $tg_exe_man->LocalFile ($ior_embase); + for ($i = 0; $i < $nr_daemon; ++$i) { + $iorfiles[$i] = $tg_daemons[$i]->LocalFile ($iorbases[$i]); + } + delete_ior_files (); +} + +# Delete if there are any .ior files. +sub delete_ior_files { + for ($i = 0; $i < $nr_daemon; ++$i) { + $tg_daemons[$i]->DeleteFile ($iorbases[$i]); + } + $tg_naming->DeleteFile ($ior_nsbase); + $tg_exe_man->DeleteFile ($ior_embase); + for ($i = 0; $i < $nr_daemon; ++$i) { + $iorfiles[$i] = $tg_daemons[$i]->LocalFile ($iorbases[$i]); + } +} + +sub kill_node_daemon { + for ($i = 0; $i < $nr_daemon; ++$i) { + $DEAMONS[$i]->Kill (); $DEAMONS[$i]->TimedWait (1); + } +} + +sub kill_open_processes { + if ($daemons_running == 1) { + kill_node_daemon (); + } + + if ($em_running == 1) { + $EM->Kill (); $EM->TimedWait (1); + } + + if ($ns_running == 1) { + $NS->Kill (); $NS->TimedWait (1); + } + # in case shutdown did not perform as expected + $tg_executor->KillAll ('dance_locality_manager'); +} + +sub run_node_daemons { + for ($i = 0; $i < $nr_daemon; ++$i) { + $iorbase = $iorbases[$i]; + $iorfile = $iorfiles[$i]; + $port = $ports[$i]; + $nodename = $nodenames[$i]; + $iiop = "iiop://localhost:$port"; + $node_app = $tg_daemons[$i]->GetArchDir("$DANCE_ROOT/bin/") . "dance_locality_manager"; + + $d_cmd = "$DANCE_ROOT/bin/dance_node_manager"; + $d_param = "-ORBEndpoint $iiop -s $node_app -n $nodename=$iorfile -t 30 --domain-nc corbaloc:rir:/NameService"; + + print "Run dance_node_manager with $d_param\n"; + + $DEAMONS[$i] = $tg_daemons[$i]->CreateProcess ($d_cmd, $d_param); + $DEAMONS[$i]->Spawn (); + + if ($tg_daemons[$i]->WaitForFileTimed($iorbase, + $tg_daemons[$i]->ProcessStartWaitInterval ()) == -1) { + print STDERR + "ERROR: The ior $iorfile file of node daemon $i could not be found\n"; + for (; $i >= 0; --$i) { + $DEAMONS[$i]->Kill (); $DEAMONS[$i]->TimedWait (1); + } + return -1; + } + } + return 0; +} + +create_targets (); +init_ior_files (); + +# Invoke naming service + +$NS = $tg_naming->CreateProcess ("$TAO_ROOT/orbsvcs/Naming_Service/tao_cosnaming", " -ORBEndpoint iiop://localhost:60003 -o $ior_nsfile"); + +$ns_status = $NS->Spawn (); + +if ($ns_status != 0) { + print STDERR "ERROR: Unable to execute the naming service\n"; + kill_open_processes (); + exit 1; +} + +print STDERR "Starting Naming Service with -ORBEndpoint iiop://localhost:60003 -o ns.ior\n"; + +if ($tg_naming->WaitForFileTimed ($ior_nsbase, + $tg_naming->ProcessStartWaitInterval ()) == -1) { + print STDERR "ERROR: cannot find naming service IOR file\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} + +$ns_running = 1; +# Set up NamingService environment +$ENV{"NameServiceIOR"} = "corbaloc:iiop:localhost:60003/NameService"; + +# Invoke node daemon. +print "Invoking node daemon\n"; +$status = run_node_daemons (); + +if ($status != 0) { + print STDERR "ERROR: Unable to execute the node daemon\n"; + kill_open_processes (); + exit 1; +} + +$daemons_running = 1; + +# Invoke execution manager. +print "Invoking execution manager (dance_execution_manager.exe) with -e$ior_emfile\n"; +$EM = $tg_exe_man->CreateProcess ("$DANCE_ROOT/bin/dance_execution_manager", + "-e$ior_emfile --domain-nc corbaloc:rir:/NameService"); +$em_status = $EM->Spawn (); + +if ($em_status != 0) { + print STDERR "ERROR: dance_execution_manager returned $em_status"; + exit 1; +} + +if ($tg_exe_man->WaitForFileTimed ($ior_embase, + $tg_exe_man->ProcessStartWaitInterval ()) == -1) { + print STDERR + "ERROR: The ior file of execution manager could not be found\n"; + kill_open_processes (); + exit 1; +} + +$em_running = 1; + +# Invoke executor - start the application -. +print "Invoking executor - launch the application -\n"; + +print "Start dance_plan_launcher.exe with -x $cdp_file -k file://$ior_emfile\n"; +$E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-x $cdp_file -k file://$ior_emfile"); +$pl_status = $E->SpawnWaitKill (2 * $tg_executor->ProcessStartWaitInterval ()); + +if ($pl_status != 0) { + print STDERR "ERROR: dance_plan_launcher returned $pl_status\n"; + kill_open_processes (); + exit 1; +} + +for ($i = 0; $i < $nr_daemon; ++$i) { + if ($tg_daemons[$i]->WaitForFileTimed ($iorbases[$i], + $tg_daemons[$i]->ProcessStopWaitInterval ()) == -1) { + print STDERR "ERROR: The ior file of daemon $i could not be found\n"; + kill_open_processes (); + exit 1; + } +} + +print "Sleeping 20 seconds shutting down\n"; +sleep (20); + +# Invoke executor - stop the application -. +print "Invoking executor - shutting down -\n"; +print "by running dance_plan_launcher.exe with -k file://$ior_emfile -x $cdp_file\n"; + +$E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-k file://$ior_emfile -x $cdp_file -s"); +$pl_status = $E->SpawnWaitKill ($tg_executor->ProcessStartWaitInterval ()); + +if ($pl_status != 0) { + print STDERR "ERROR: dance_plan_launcher returned $pl_status\n"; + kill_open_processes (); + exit 1; +} + +# print "Sleeping 10 seconds before shutting down the rest\n"; +# sleep (10); + +# Invoke executor - stop the application -. +# print "Invoking executor - shutdown component 3 -\n"; +# print "by running dance_plan_launcher.exe with -k file://$ior_emfile -x $cdp_shutdown_rest\n"; + +# $E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", +# "-k file://$ior_emfile -x $cdp_shutdown_rest -s"); +# $pl_status = $E->SpawnWaitKill ($tg_executor->ProcessStartWaitInterval ()); +# +# if ($pl_status != 0) { +# print STDERR "ERROR: dance_plan_launcher returned $pl_status\n"; +# kill_open_processes (); +# exit 1; +# } + +# print "Executor returned.\n"; +# print "Shutting down rest of the processes.\n"; + +delete_ior_files (); +kill_open_processes (); + +exit $status; |