diff options
author | mhengstmengel <mhengstmengel@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2011-05-10 12:42:39 +0000 |
---|---|---|
committer | mhengstmengel <mhengstmengel@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2011-05-10 12:42:39 +0000 |
commit | add1f0c8d1f87192c5b5bd8b86ad581c3989c88e (patch) | |
tree | 4ae61304b4962ad6e6e3c95cdd22ed76683fee96 /CIAO/examples | |
parent | 20389370394b17984fe7b3bc4a72b7ab1c48a09f (diff) | |
download | ATCD-add1f0c8d1f87192c5b5bd8b86ad581c3989c88e.tar.gz |
Tue May 10 12:38:37 UTC 2011 Marijke Hengstmengel <mhengstmengel@remedy.nl>
* bin/ciao_tests.lst:
* examples/Display/Display_Base/Display_Base.idl:
* examples/Display/descriptors/flattened_deploymentplannat.cdp:
* examples/Display/descriptors/run_test.pl:
* examples/Display/NavDisplayGUI_exec/DetailView.h:
* examples/Display/NavDisplayGUI_exec/RootPanel.cpp:
* examples/Display/NavDisplayGUI_exec/NodeItem.cpp:
* examples/Display/NavDisplayGUI_exec/MapView.cpp:
* examples/Display/NavDisplayGUI_exec/RootPanel.h:
* examples/Display/NavDisplayGUI_exec/NodeItem.h:
* examples/Display/NavDisplayGUI_exec/Worker.cpp:
* examples/Display/NavDisplayGUI_exec/NavDisplayGUI.mpc:
* examples/Display/NavDisplayGUI_exec/MapView.h:
* examples/Display/NavDisplayGUI_exec/NavDisplayGUI_exec.cpp:
* examples/Display/NavDisplayGUI_exec/NavUnit.cpp:
* examples/Display/NavDisplayGUI_exec/NavDisplayGUI_exec.h:
* examples/Display/NavDisplayGUI_exec/NavUnit.h:
* examples/Display/NavDisplayGUI_exec/DetailView.cpp:
* examples/Display/RateGen/controller.cpp:
* examples/Display/RateGen/RateGen_exec.cpp:
* examples/Display/GPS/GPS.idl:
* examples/Display/GPS/GPS_exec.h:
* examples/Display/GPS/GPS_exec.cpp:
* examples/Display/NavDisplay/NavDisplay_exec.cpp:
* examples/Display/NavDisplay/NavDisplay.idl:
* examples/Display/NavDisplay/NavDisplay_exec.h:
Made test working again with GUI display, using one or more GPS devices.
Used only QT4, removed qt3support. Not yet tested on Windows.
* examples/Display/descriptors/basicNodeDaemon.pl:
* examples/Display/descriptors/flattened_deploymentplan.cdp:
* examples/Display/descriptors/DeploymentPlan.cdp:
* examples/Display/GPS/GPS_tracing_exec.cpp:
* examples/Display/GPS/GPS_tracing_exec.h:
Deleted this files. Not used anymore.
* examples/Display/descriptors/deploymentplanmore.cdp:
* examples/Display/descriptors/run_test_one_contr.pl:
* examples/Display/descriptors/run_all_in_one.pl:
* examples/Display/descriptors/run_test_more.pl:
* examples/Display/descriptors/deploymentplanone.cdp:
* examples/Display/descriptors/run_test_more_contr.pl:
* examples/Display/descriptors/run_test_one.pl:
Added scripts for running GUI test (one and more) and test_all_in_one for testsuite.
Diffstat (limited to 'CIAO/examples')
37 files changed, 2852 insertions, 1074 deletions
diff --git a/CIAO/examples/Display/Display_Base/Display_Base.idl b/CIAO/examples/Display/Display_Base/Display_Base.idl index ec603ddaf0f..fe7fb8ffd14 100644 --- a/CIAO/examples/Display/Display_Base/Display_Base.idl +++ b/CIAO/examples/Display/Display_Base/Display_Base.idl @@ -17,6 +17,11 @@ module HUDisplay { + struct GPS_position + { + long pos_x; + long pos_y; + }; /** * @brief interface opmode defines the "operation mode" interface. */ @@ -40,8 +45,9 @@ module HUDisplay */ interface position { - long posx (); - long posy (); + GPS_position posxy (); + unsigned short id (); + boolean started (); }; }; diff --git a/CIAO/examples/Display/GPS/GPS.idl b/CIAO/examples/Display/GPS/GPS.idl index a3a437d98db..1088de1abb9 100644 --- a/CIAO/examples/Display/GPS/GPS.idl +++ b/CIAO/examples/Display/GPS/GPS.idl @@ -19,6 +19,8 @@ module HUDisplay provides position MyLocation; publishes tick Ready; consumes tick Refresh; + /// The attribute can be configured via the deploymentplan + attribute unsigned short id; }; home GPSHome manages GPS diff --git a/CIAO/examples/Display/GPS/GPS_exec.cpp b/CIAO/examples/Display/GPS/GPS_exec.cpp index 79a9fead93e..5d40faeb3cf 100644 --- a/CIAO/examples/Display/GPS/GPS_exec.cpp +++ b/CIAO/examples/Display/GPS/GPS_exec.cpp @@ -1,4 +1,3 @@ - // $Id$ #include "GPS_exec.h" @@ -8,21 +7,28 @@ #define DISPLACEMENT 256 // Operations from HUDisplay::position -CORBA::Long -MyImpl::Position_Impl::posx () + +HUDisplay::GPS_position +MyImpl::Position_Impl::posxy () { - return component_.posx(); + return component_.posxy(); } -CORBA::Long -MyImpl::Position_Impl::posy () +CORBA::UShort +MyImpl::Position_Impl::id () { - return component_.posy(); + return component_.id(); } +CORBA::Boolean +MyImpl::Position_Impl::started () +{ + return component_.started (); +} /// Default constructor. MyImpl::GPS_exec_i::GPS_exec_i () +: id_(1), started_(false) { ACE_OS::srand ((u_int) ACE_OS::time ()); this->positionx_ = ACE_OS::rand (); @@ -35,42 +41,61 @@ MyImpl::GPS_exec_i::~GPS_exec_i () } // Operations from HUDisplay::GPS - HUDisplay::CCM_position_ptr - MyImpl::GPS_exec_i::get_MyLocation () - { - ACE_DEBUG ((LM_DEBUG, - "GPS_exec::get_MyLocation called\n")); - return (new Position_Impl (*this)); - } +HUDisplay::CCM_position_ptr +MyImpl::GPS_exec_i::get_MyLocation () +{ + ACE_DEBUG ((LM_DEBUG, + "GPS_exec::get_MyLocation facet called by NavDisplay\n")); + return (new Position_Impl (*this)); +} void MyImpl::GPS_exec_i::push_Refresh (HUDisplay::tick *) { ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("GPS: Received Refresh Event\n"))); + ACE_TEXT ("GPS: Received Refresh Event from RateGen for GPS %u\n"), + this->id_)); // Refresh position this->positionx_ += ACE_OS::rand () % DISPLACEMENT - (DISPLACEMENT/2); this->positiony_ += ACE_OS::rand () % DISPLACEMENT - (DISPLACEMENT/2); + started_= true; - // Nitify others - HUDisplay::tick_var event = new OBV_HUDisplay::tick; + // Notify others + HUDisplay::tick_var event = new OBV_HUDisplay::tick (); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("GPS: Notify NavDisplay via Ready event.\n"))); this->context_->push_Ready (event); } -CORBA::Long -MyImpl::GPS_exec_i::posx () +HUDisplay::GPS_position +MyImpl::GPS_exec_i::posxy () { - return this->positionx_; + HUDisplay::GPS_position pos; + pos.pos_x = this->positionx_; + pos.pos_y = this->positiony_; + return pos; } -CORBA::Long -MyImpl::GPS_exec_i::posy () +CORBA::UShort +MyImpl::GPS_exec_i::id () { - return this->positiony_; + return this->id_; } +void +MyImpl::GPS_exec_i::id ( + const ::CORBA::UShort id) +{ + this->id_ = id; +} + +CORBA::Boolean +MyImpl::GPS_exec_i::started () +{ + return started_; +} // Operations from Components::SessionComponent void diff --git a/CIAO/examples/Display/GPS/GPS_exec.h b/CIAO/examples/Display/GPS/GPS_exec.h index f0ca86823b8..35567922005 100644 --- a/CIAO/examples/Display/GPS/GPS_exec.h +++ b/CIAO/examples/Display/GPS/GPS_exec.h @@ -40,9 +40,12 @@ namespace MyImpl void push_Refresh (HUDisplay::tick *); // Operations from HUDisplay::position - CORBA::Long posx (); + HUDisplay::GPS_position posxy (); - CORBA::Long posy (); + CORBA::UShort id (); + void id ( const ::CORBA::UShort id); + + CORBA::Boolean started (); // Operations from Components::SessionComponent void set_session_context (Components::SessionContext_ptr ctx); @@ -61,9 +64,10 @@ namespace MyImpl private: CORBA::Long positionx_, positiony_; + CORBA::UShort id_; + CORBA::Boolean started_; }; - /** * @class GPSHome_exec_i * @@ -95,9 +99,11 @@ namespace MyImpl } // Operations from HUDisplay::position - CORBA::Long posx (); + HUDisplay::GPS_position posxy (); + + CORBA::UShort id (); - CORBA::Long posy (); + CORBA::Boolean started (); private: GPS_exec_i& component_; diff --git a/CIAO/examples/Display/GPS/GPS_tracing_exec.cpp b/CIAO/examples/Display/GPS/GPS_tracing_exec.cpp deleted file mode 100644 index 9a989e12bdd..00000000000 --- a/CIAO/examples/Display/GPS/GPS_tracing_exec.cpp +++ /dev/null @@ -1,131 +0,0 @@ -// $Id$ - -#include "GPS_tracing_exec.h" - -#include "ace/OS_NS_time.h" - -#define DISPLACEMENT 256 - -/// Default constructor. -MyImpl::GPS_tracing_exec_i::GPS_tracing_exec_i () : dx_(1), dy_(1) -{ - ACE_OS::srand ((u_int) ACE_OS::time ()); - - this->positionx_ = 20; - this->positiony_ = 25; -} - -/// Default destructor. -MyImpl::GPS_tracing_exec_i::~GPS_tracing_exec_i () -{ -} - -// Operations from HUDisplay::GPS - -HUDisplay::CCM_position_ptr -MyImpl::GPS_tracing_exec_i::get_MyLocation () -{ - return HUDisplay::CCM_position::_duplicate (this); -} - -void -MyImpl::GPS_tracing_exec_i::push_Refresh (HUDisplay::tick *) -{ - // Refresh position - if(this->positionx_ > 500) this->dx_ = -1; - if(this->positionx_ < 10) this->dx_ = 1; - if(this->positiony_ > 300) this->dy_ = -1; - if(this->positiony_ < 10) this->dy_ = 1; - - this->positionx_ += this->dx_; - this->positiony_ += this->dy_; - - // Nitify others - HUDisplay::tick_var event = new OBV_HUDisplay::tick; - - this->context_->push_Ready (event); -} - -// Operations from HUDisplay::position - -CORBA::Long -MyImpl::GPS_tracing_exec_i::posx () -{ - return this->positionx_; -} - -CORBA::Long -MyImpl::GPS_tracing_exec_i::posy () -{ - return this->positiony_; -} - -// Operations from Components::SessionComponent -void -MyImpl::GPS_tracing_exec_i::set_session_context ( - Components::SessionContext_ptr ctx) -{ - if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, - "MyImpl::GPS_tracing_exec_i::set_session_context\n")); - - this->context_ = - HUDisplay::CCM_GPS_Context::_narrow (ctx); - - if (CORBA::is_nil (this->context_.in ())) - throw CORBA::INTERNAL (); - // Urm, we actually discard exceptions thown from this operation. -} - -void -MyImpl::GPS_tracing_exec_i::configuraton_complete () -{ -} - -void -MyImpl::GPS_tracing_exec_i::ccm_activate () -{ - if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, "MyImpl::GPS_tracing_exec_i::ccm_activate\n")); -} - -void -MyImpl::GPS_tracing_exec_i::ccm_passivate () -{ - if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, "MyImpl::GPS_tracing_exec_i::ccm_passivate\n")); -} - -void -MyImpl::GPS_tracing_exec_i::ccm_remove () -{ - if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, "MyImpl::GPS_tracing_exec_i::ccm_remove\n")); -} - -/// Default ctor. -MyImpl::GPSHome_tracing_exec_i::GPSHome_tracing_exec_i () -{ -} - -/// Default dtor. -MyImpl::GPSHome_tracing_exec_i::~GPSHome_tracing_exec_i () -{ -} - -// Explicit home operations. - -// Implicit home operations. - -::Components::EnterpriseComponent_ptr -MyImpl::GPSHome_tracing_exec_i::create () -{ - return new MyImpl::GPS_tracing_exec_i; -} - - -extern "C" GPS_EXEC_Export ::Components::HomeExecutorBase_ptr -createGPSHome_Tracing_Impl (void) -{ - return new MyImpl::GPSHome_tracing_exec_i; -} diff --git a/CIAO/examples/Display/GPS/GPS_tracing_exec.h b/CIAO/examples/Display/GPS/GPS_tracing_exec.h deleted file mode 100644 index a03432cc42c..00000000000 --- a/CIAO/examples/Display/GPS/GPS_tracing_exec.h +++ /dev/null @@ -1,112 +0,0 @@ -// $Id$ - -/** - * @file GPS_tracing_exec.h - * - * Header file for the actual GPS and GPSHome component - * implementations. - * - * @author Nanbor Wang <nanbor@cse.wustl.edu> - */ - -#ifndef GPS_TRACING_EXEC_H -#define GPS_TRACING_EXEC_H - -#include "GPSEIC.h" -#include "tao/LocalObject.h" - -namespace MyImpl -{ - /** - * @class GPS_tracing_exec_i - * - * RateGen executor implementation class. - */ - class GPS_EXEC_Export GPS_tracing_exec_i : - public virtual HUDisplay::GPS_Exec, - public virtual ::CORBA::LocalObject - { - public: - /// Default constructor. - GPS_tracing_exec_i (); - - /// Default destructor. - ~GPS_tracing_exec_i (); - - // Operations from HUDisplay::GPS - - virtual HUDisplay::CCM_position_ptr - get_MyLocation (); - - virtual void - push_Refresh (HUDisplay::tick *ev); - - // Operations from HUDisplay::position - - virtual CORBA::Long - posx (); - - virtual CORBA::Long - posy (); - - // 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: - /// Current GPS reading. - CORBA::Long positionx_; - CORBA::Long positiony_; - - /// Delta amounts to emulate the position shift of each reading. - int dx_; - int dy_; - - /// Copmponent specific context - HUDisplay::CCM_GPS_Context_var context_; - }; - - /** - * @class GPSHome_tracing_exec_i - * - * GPS home executor implementation class. - */ - class GPS_EXEC_Export GPSHome_tracing_exec_i : - public virtual HUDisplay::CCM_GPSHome, - public virtual ::CORBA::LocalObject - { - public: - /// Default ctor. - GPSHome_tracing_exec_i (); - - /// Default dtor. - ~GPSHome_tracing_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" GPS_EXEC_Export ::Components::HomeExecutorBase_ptr -createGPSHome_Tracing_Impl (void); - -#endif /* GPS_TRACING_EXEC_H */ diff --git a/CIAO/examples/Display/NavDisplay/NavDisplay.idl b/CIAO/examples/Display/NavDisplay/NavDisplay.idl index a786f7f9d06..2925c19cd70 100644 --- a/CIAO/examples/Display/NavDisplay/NavDisplay.idl +++ b/CIAO/examples/Display/NavDisplay/NavDisplay.idl @@ -18,7 +18,11 @@ module HUDisplay component NavDisplay { consumes tick Refresh; - uses position GPSLocation; + uses multiple position GPSLocation; + /// The attribute can be configured via deploymentplan + // This number must indicate the number of GPS devices + // which are also defined in the deploymentplan. + attribute long number_of_GPS; }; home NavDisplayHome manages NavDisplay diff --git a/CIAO/examples/Display/NavDisplay/NavDisplay_exec.cpp b/CIAO/examples/Display/NavDisplay/NavDisplay_exec.cpp index 40db3c816cc..4ede4e984ef 100644 --- a/CIAO/examples/Display/NavDisplay/NavDisplay_exec.cpp +++ b/CIAO/examples/Display/NavDisplay/NavDisplay_exec.cpp @@ -4,6 +4,7 @@ /// Default constructor. MyImpl::NavDisplay_exec_impl::NavDisplay_exec_impl (void) +: number_of_GPS_(1) { } @@ -19,26 +20,38 @@ MyImpl::NavDisplay_exec_impl::push_Refresh (HUDisplay::tick *ev) { ACE_UNUSED_ARG (ev); -// ACE_DEBUG ((LM_DEBUG, -// ACE_TEXT ("NAVDISPLAY: Received Refresh Event\n"))); - - // Refresh position - HUDisplay::position_var loc = - this->context_->get_connection_GPSLocation (); - - if (CORBA::is_nil (loc.in ())) + ACE_DEBUG ((LM_DEBUG, + "NavDisplay receives Refresh event from GPS supplier.\n")); + ACE_DEBUG ((LM_DEBUG, + "NavDisplay reads coordinates via GPS receptacle.\n")); + ::HUDisplay::NavDisplay::GPSLocationConnections_var locs = + this->context_->get_connections_GPSLocation (); + for(CORBA::ULong i = 0; i < locs->length(); ++i) { - throw CORBA::BAD_INV_ORDER (); + HUDisplay::position_var loc = locs[i].objref; + if (CORBA::is_nil (loc.in ())) + { + throw CORBA::BAD_INV_ORDER (); + } + HUDisplay::GPS_position posxy = loc->posxy(); + CORBA::Long x = posxy.pos_x % 500; + CORBA::Long y = posxy.pos_y % 300; + + ACE_DEBUG ((LM_DEBUG,"NAVDISPLAY: Current Location is: (%u, %u)\n", + x,y)); } +} +//needed for GUI implementation if more then one GPS device is used. +CORBA::Long +MyImpl::NavDisplay_exec_impl::number_of_GPS () +{ + return this->number_of_GPS_; +} - CORBA::Long x = loc->posx () % 500; - - CORBA::Long y = loc->posy () % 300; - - ACE_DEBUG ((LM_DEBUG, - "NAVDISPLAY: Current Location is: (%d, %d)\n", - x, - y)); +void +MyImpl::NavDisplay_exec_impl::number_of_GPS (CORBA::Long number_of_GPS) +{ + this->number_of_GPS_ = number_of_GPS; } // Operations from Components::SessionComponent @@ -46,8 +59,8 @@ void MyImpl::NavDisplay_exec_impl::set_session_context ( Components::SessionContext_ptr ctx) { - ACE_DEBUG ((LM_DEBUG, - "MyImpl::NavDisplay_exec_impl::set_session_context\n")); + //ACE_DEBUG ((LM_DEBUG, + // "MyImpl::NavDisplay_exec_impl::set_session_context\n")); this->context_ = HUDisplay::CCM_NavDisplay_Context::_narrow (ctx); @@ -55,7 +68,6 @@ MyImpl::NavDisplay_exec_impl::set_session_context ( { throw CORBA::INTERNAL (); } - // Urm, we actually discard exceptions thown from this operation. } void @@ -66,15 +78,15 @@ MyImpl::NavDisplay_exec_impl::configuration_complete (void) void MyImpl::NavDisplay_exec_impl::ccm_activate (void) { - ACE_DEBUG ((LM_DEBUG, - "MyImpl::NavDisplay_exec_impl::ccm_activate\n")); + //ACE_DEBUG ((LM_DEBUG, + // "MyImpl::NavDisplay_exec_impl::ccm_activate\n")); } void MyImpl::NavDisplay_exec_impl::ccm_remove (void) { - ACE_DEBUG ((LM_DEBUG, - "MyImpl::NavDisplay_exec_impl::ccm_remove\n")); + //ACE_DEBUG ((LM_DEBUG, + // "MyImpl::NavDisplay_exec_impl::ccm_remove\n")); } /// Default ctor. diff --git a/CIAO/examples/Display/NavDisplay/NavDisplay_exec.h b/CIAO/examples/Display/NavDisplay/NavDisplay_exec.h index 8c32f5dd0e4..e53fba908cb 100644 --- a/CIAO/examples/Display/NavDisplay/NavDisplay_exec.h +++ b/CIAO/examples/Display/NavDisplay/NavDisplay_exec.h @@ -55,9 +55,18 @@ namespace MyImpl virtual void ccm_remove (void); + + //attribute operations + + virtual CORBA::Long number_of_GPS (); + virtual void number_of_GPS (CORBA::Long number_of_GPS); + protected: /// Copmponent specific context HUDisplay::CCM_NavDisplay_Context_var context_; + // Needed for compatability with NavDisplayGUI + CORBA::Long number_of_GPS_; + }; /** diff --git a/CIAO/examples/Display/NavDisplayGUI_exec/DetailView.cpp b/CIAO/examples/Display/NavDisplayGUI_exec/DetailView.cpp index e854d06ef59..94eaefb36a8 100644 --- a/CIAO/examples/Display/NavDisplayGUI_exec/DetailView.cpp +++ b/CIAO/examples/Display/NavDisplayGUI_exec/DetailView.cpp @@ -1,126 +1,47 @@ // $Id$ #include "DetailView.h" -#include <Qt/q3table.h> #include <Qt/qlayout.h> -#include <Qt/qpushbutton.h> -#include <Qt/qtabwidget.h> #include <Qt/qlabel.h> -#include <Qt/qlineedit.h> #include <Qt/qspinbox.h> -DetailView::DetailView(QWidget *parent, const char *name) -: QWidget(parent, name), current_unit(0) +DetailView::DetailView(QWidget *parent) +: QWidget(parent) { - QGridLayout *grid = new QGridLayout(this, 8, 10); - - // Create a label containing a QMovie - separatorlabel = new QLabel(this, "label0" ); - - grid->addMultiCellWidget(separatorlabel, 0, 0, 0, 9); - - QLabel *sem_id_label = new QLabel("FDN:", this); - grid->addWidget(sem_id_label, 1, 0); - sem_id_val = new QLineEdit(this); - sem_id_val->setReadOnly(1); - grid->addMultiCellWidget(sem_id_val, 1, 1, 1, 7); - - QLabel *descr_label = new QLabel("Description:", this); - grid->addWidget(descr_label, 2, 0); - descr_edit = new QLineEdit(this); - grid->addMultiCellWidget(descr_edit, 2, 2, 1, 7); - - QLabel *x_label = new QLabel("X coordinate:", this); - grid->addWidget(x_label, 3, 0); + QGridLayout *grid = new QGridLayout(this); + grid->setHorizontalSpacing (1); + grid->setColumnMinimumWidth (0, 79); + grid->setColumnMinimumWidth (1, 30); + grid->setColumnMinimumWidth (2, 30); + grid->setColumnMinimumWidth (3, 35); + grid->setColumnMinimumWidth (4, 80); + grid->setColumnMinimumWidth (5, 30); + grid->setColumnMinimumWidth (6, 30); + + QLabel *x_label = new QLabel("X coordinate red GPS:", this); + grid->addWidget(x_label, 1, 0); x_edit = new QSpinBox(this); - x_edit->setMinValue(0); - x_edit->setMaxValue(65535); - grid->addWidget(x_edit, 3, 1); - - QLabel *y_label = new QLabel("Y coordinate:", this); - grid->addWidget(y_label, 3, 3); + x_edit->setMinimum(0); + x_edit->setMaximum(65535); + x_edit->setReadOnly(true); + grid->addWidget(x_edit, 1, 2); + QLabel *y_label = new QLabel("Y coordinate red GPS:", this); + grid->addWidget(y_label, 1, 4); y_edit = new QSpinBox(this); - y_edit->setMinValue(0); - y_edit->setMaxValue(65535); - grid->addWidget(y_edit, 3, 4); - - QLabel *z_label = new QLabel("Z coordinate:", this); - grid->addWidget(z_label, 3, 6); - z_edit = new QSpinBox(this); - z_edit->setMinValue(0); - z_edit->setMaxValue(65535); - grid->addWidget(z_edit, 3, 7); - - // Create a label containing a QMovie - QString path_to_movie; - char *ace_root = ACE_OS::getenv("ACE_ROOT"); - if(ace_root) - { - path_to_movie += ace_root; - path_to_movie += "/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/trolltech.gif"; - } - else - { - path_to_movie = "../NavDisplayGUI_exec/trolltech.gif"; - } - movie = new QMovie(path_to_movie); - movielabel = new QLabel(this, "label1" ); -// movie->connectStatus(this, SLOT(movieStatus(int))); -// movie->connectUpdate(this, SLOT(movieUpdate(const QRect&))); - movielabel->setFrameStyle( QFrame::Box | QFrame::Plain ); - movielabel->setMovie(movie); - movielabel->setFixedSize( 128+movielabel->frameWidth()*2, - 64+movielabel->frameWidth()*2 ); - grid->addMultiCellWidget(new QLabel("", this), 1, 4, 8, 8); - grid->addMultiCellWidget(movielabel, 1, 4, 9, 9); - - - QPushButton *apply = new QPushButton("Apply", this); - apply->setDefault(1); - grid->addWidget(apply, 7, 9); - - // FUZZ: disable check_for_lack_ACE_OS - connect(apply, SIGNAL(clicked()), this, SLOT(apply())); - // FUZZ: enable check_for_lack_ACE_OS - - QTabWidget *tabs = new QTabWidget(this); - - - child_list = new Q3Table(0, 6, tabs); - child_list->setSelectionMode(Q3Table::Single); - child_list->horizontalHeader()->setLabel(0, "FDN"); - child_list->horizontalHeader()->setLabel(1, "Description"); - child_list->horizontalHeader()->setLabel(2, "X Coordinate"); - child_list->horizontalHeader()->setLabel(3, "Y Coordinate"); - child_list->horizontalHeader()->setLabel(4, "Z Coordinate"); - child_list->horizontalHeader()->setLabel(5, "Color"); - - parent_list = new Q3Table(0, 6, tabs); - parent_list->setSelectionMode(Q3Table::Single); - parent_list->horizontalHeader()->setLabel(0, "FDN"); - parent_list->horizontalHeader()->setLabel(1, "Description"); - parent_list->horizontalHeader()->setLabel(2, "X Coordinate"); - parent_list->horizontalHeader()->setLabel(3, "Y Coordinate"); - parent_list->horizontalHeader()->setLabel(4, "Z Coordinate"); - parent_list->horizontalHeader()->setLabel(5, "Color"); - - tabs->addTab(child_list, "Property set &1"); - tabs->addTab(parent_list, "Property set &2"); - - grid->addMultiCellWidget(new QLabel(this), 4, 4, 0, 9); - grid->addMultiCellWidget(tabs, 5, 5, 0, 9); + y_edit->setMinimum(0); + y_edit->setMaximum(65535); + y_edit->setReadOnly(true); + grid->addWidget(y_edit, 1, 6); } DetailView::~DetailView() { - delete movie; } void DetailView::currentNode(NavUnit *unit) { UnitLocation loc = unit->getLocation(); - descr_edit->setText(unit->getShortDescr()); this->updateLocation(loc); } @@ -129,38 +50,4 @@ DetailView::updateLocation(const UnitLocation &loc) { x_edit->setValue(static_cast<int>(loc.x_)); y_edit->setValue(static_cast<int>(loc.y_)); - z_edit->setValue(static_cast<int>(loc.z_)); -} - -void -DetailView::apply() -{ -} - - -void -DetailView::movieUpdate( const QRect& ) -{ - // Uncomment this to test animated icons on your window manager - //setIcon( movie.framePixmap() ); -} - - -void -DetailView::movieStatus( int ) -{ -/* switch ( s ) - { - case QMovie::SourceEmpty: - case QMovie::UnrecognizedFormat: - { - QPixmap pm("tt-logo.png"); - movielabel->setPixmap(pm); - movielabel->setFixedSize(pm.size()); - } - break; - default: - if ( movielabel->movie() ) // for flicker-free animation: - movielabel->setBackgroundMode( Qt::NoBackground ); - }*/ } diff --git a/CIAO/examples/Display/NavDisplayGUI_exec/DetailView.h b/CIAO/examples/Display/NavDisplayGUI_exec/DetailView.h index 2f0cf44d69a..3652d427a42 100644 --- a/CIAO/examples/Display/NavDisplayGUI_exec/DetailView.h +++ b/CIAO/examples/Display/NavDisplayGUI_exec/DetailView.h @@ -6,11 +6,8 @@ #include "NavUnit.h" #include <Qt/qwidget.h> -#include <Qt/qmovie.h> -#include <Qt/q3table.h> class QLabel; -class QLineEdit; class QSpinBox; class DetailView : public QWidget @@ -18,31 +15,16 @@ class DetailView : public QWidget Q_OBJECT public: - DetailView(QWidget *parent, const char *name = 0); + DetailView(QWidget *parent); virtual ~DetailView(); public slots: - void movieStatus(int); - void movieUpdate(const QRect&); void currentNode(NavUnit *unit); void updateLocation(const UnitLocation &loc); - void apply(); private: - QLineEdit *sem_id_val; - QLineEdit *descr_edit; - QSpinBox *x_edit; QSpinBox *y_edit; - QSpinBox *z_edit; - Q3Table *child_list; - Q3Table *parent_list; - QLabel *movielabel; - QMovie *movie; - QLabel *separatorlabel; - QMovie separator; - - - NavUnit *current_unit; + QSpinBox *x_edit; }; diff --git a/CIAO/examples/Display/NavDisplayGUI_exec/MapView.cpp b/CIAO/examples/Display/NavDisplayGUI_exec/MapView.cpp index f1dfac65400..e70874d4b99 100644 --- a/CIAO/examples/Display/NavDisplayGUI_exec/MapView.cpp +++ b/CIAO/examples/Display/NavDisplayGUI_exec/MapView.cpp @@ -2,39 +2,30 @@ #include "MapView.h" #include <stdlib.h> - #include "worldmap1.xpm" MapView::MapView( - Q3Canvas& c, - QWidget* parent, - const char* name, - Qt::WindowFlags f) + QGraphicsScene& c, + QWidget* parent ) : - Q3CanvasView(&c, parent, name, f), + QGraphicsView(&c, parent), bg_pixmap_(worldmap1) { - viewport()->setBackgroundMode(Qt::NoBackground); - enableClipper(TRUE); - if(!bg_pixmap_.isNull()) - { - resizeContents(bg_pixmap_.width(), bg_pixmap_.height()); - } - else - resizeContents(100, 100); - - canvas()->setBackgroundPixmap(bg_pixmap_); + setSceneRect (0,0, 601, 388); + setMinimumSize(bg_pixmap_.width() -10, bg_pixmap_.height() -10); } void MapView::clear() { - /* - QCanvasItemList list = canvas()->allItems(); - for(QCanvasItemList::Iterator it = list.begin(); it != list.end(); ++it) - { - if(*it) - delete *it; - } - */ } + +void +MapView::resizeEvent (QResizeEvent * event) +{ + QSize old = event->oldSize(); + QSize size(this->width(), this->height()); + QPixmap oo = bg_pixmap_.scaled(this->width() , this->height()); + setBackgroundBrush(QBrush(oo)); +} + diff --git a/CIAO/examples/Display/NavDisplayGUI_exec/MapView.h b/CIAO/examples/Display/NavDisplayGUI_exec/MapView.h index 0e7ad045f8b..72f3acf5584 100644 --- a/CIAO/examples/Display/NavDisplayGUI_exec/MapView.h +++ b/CIAO/examples/Display/NavDisplayGUI_exec/MapView.h @@ -3,16 +3,20 @@ #ifndef __MAPVIEW_H #define __MAPVIEW_H -#include <Qt/q3canvas.h> #include <Qt/qpixmap.h> +#include <Qt/qgraphicsscene.h> +#include <Qt/qgraphicsview.h> +#include <Qt/qwidget.h> +#include <Qt/qevent.h> -class MapView : public Q3CanvasView +class MapView : public QGraphicsView { Q_OBJECT public: - MapView(Q3Canvas&, QWidget* parent=0, const char* name=0, Qt::WindowFlags f=0); + MapView(QGraphicsScene&, QWidget* parent=0); void clear(); + void resizeEvent (QResizeEvent *); protected: QPixmap bg_pixmap_; diff --git a/CIAO/examples/Display/NavDisplayGUI_exec/NavDisplayGUI.mpc b/CIAO/examples/Display/NavDisplayGUI_exec/NavDisplayGUI.mpc index 5389e3d3cb9..bf4d7a4d9b2 100644 --- a/CIAO/examples/Display/NavDisplayGUI_exec/NavDisplayGUI.mpc +++ b/CIAO/examples/Display/NavDisplayGUI_exec/NavDisplayGUI.mpc @@ -1,6 +1,6 @@ // $Id$ -project(Display_NavDisplayGUI_exec_moc) : ace_qt4, qt4_qt3support , avoids_ccm_noevent{ +project(Display_NavDisplayGUI_exec_moc) : ace_qt4, avoids_ccm_noevent{ custom_only = 1 MOC_Files { DetailView.h @@ -10,7 +10,7 @@ project(Display_NavDisplayGUI_exec_moc) : ace_qt4, qt4_qt3support , avoids_ccm_n } } -project(Display_NavDisplayGUI_exec) : ciao_executor, ace_qt4, qt4_qt3support , avoids_ccm_noevent{ +project(Display_NavDisplayGUI_exec) : ciao_executor, ace_qt4, avoids_ccm_noevent{ after += Display_NavDisplay_lem_gen \ Display_NavDisplay_svnt \ Display_NavDisplayGUI_exec_moc @@ -54,7 +54,7 @@ project(Display_NavDisplayGUI_exec) : ciao_executor, ace_qt4, qt4_qt3support , a } } -project(Display_NavDisplayGUI_svnt) : ciao_servant, ace_qt4, qt4_qt3support, avoids_ccm_noevent { +project(Display_NavDisplayGUI_svnt) : ciao_servant, ace_qt4, avoids_ccm_noevent { after += Display_Base_skel Display_NavDisplayGUI_exec sharedname = NavDisplayGUI_svnt includes += ../NavDisplay diff --git a/CIAO/examples/Display/NavDisplayGUI_exec/NavDisplayGUI_exec.cpp b/CIAO/examples/Display/NavDisplayGUI_exec/NavDisplayGUI_exec.cpp index 9a67140671f..2291a6b5a90 100644 --- a/CIAO/examples/Display/NavDisplayGUI_exec/NavDisplayGUI_exec.cpp +++ b/CIAO/examples/Display/NavDisplayGUI_exec/NavDisplayGUI_exec.cpp @@ -16,7 +16,7 @@ static const char *argv[] = /// Default constructor. MyImpl::NavDisplayGUI_exec_impl::NavDisplayGUI_exec_impl (void) - : unit_(1, "Model T3+"), loc_(50, 20, 0) + : number_of_GPS_(1), loc_(10, 10) { } @@ -31,44 +31,58 @@ void MyImpl::NavDisplayGUI_exec_impl::push_Refresh ( HUDisplay::tick * /* ev */) { - //ACE_DEBUG ((LM_DEBUG, "ENTER: MyImpl::NavDisplayGUI_exec_impl::push_Refresh()\n")); + ACE_DEBUG ((LM_DEBUG, "ENTER: MyImpl::NavDisplayGUI_exec_impl::push_Refresh().\n")); + ACE_DEBUG ((LM_DEBUG, "NavDisplay receives Refresh event from a GPS supplier.\n")); // Refresh position - HUDisplay::position_var loc = - this->context_->get_connection_GPSLocation (); + ACE_DEBUG ((LM_DEBUG, "NavDisplay reads coordinates via GPS receptacles.\n")); - CORBA::Long lx = loc->posx (); + ::HUDisplay::NavDisplay::GPSLocationConnections_var locs = + this->context_->get_connections_GPSLocation (); - CORBA::Long ly = loc->posy (); - - mutex_.acquire (); - - loc_.x_ = lx % 500; - loc_.y_ = ly % 300; - - this->unit_.setLocation (loc_); - - mutex_.release (); - - //ACE_DEBUG ((LM_DEBUG, "DISPLAY: Current Location is: %d %d\n", int(attrs.x_), int(attrs.y_))); - - RootPanel *root_pane = worker_->getMainWindow (); - - if (root_pane != 0) + for(CORBA::ULong i = 0; i < locs->length(); ++i) { - UpdatePositionCmd *cmd = UpdatePositionCmd::create ( - root_pane, - &(this->unit_)); - QCustomEvent *evt = new QCustomEvent (QEvent::User, cmd); - QApplication::postEvent (root_pane, evt); + HUDisplay::position_var loc = locs[i].objref; + + //only if GPS is started, update position + if (loc->started ()) + { + HUDisplay::GPS_position posxy = loc->posxy(); + loc_.x_ = posxy.pos_x; + loc_.y_ = posxy.pos_y; + + navunitarr[i]->setLocation (loc_); + RootPanel *root_pane = worker_->getMainWindow (); + + if (root_pane != 0) + { + UpdatePositionCmd *cmd = UpdatePositionCmd::create ( + root_pane, navunitarr[i]); + NavEvent *evt = new NavEvent (cmd); + QApplication::postEvent (root_pane, evt); + } + } } + ACE_DEBUG ((LM_DEBUG, + "LEAVE: MyImpl::NavDisplayGUI_exec_impl::push_Refresh()\n")); +} + +CORBA::Long +MyImpl::NavDisplayGUI_exec_impl::number_of_GPS () +{ + return this->number_of_GPS_; +} - //ACE_DEBUG ((LM_DEBUG, "LEAVE: MyImpl::NavDisplayGUI_exec_impl::push_Refresh()\n")); +void +MyImpl::NavDisplayGUI_exec_impl::number_of_GPS (CORBA::Long number_of_GPS) +{ + this->number_of_GPS_ = number_of_GPS; } // Operations from Components::SessionComponent void -MyImpl::NavDisplayGUI_exec_impl::set_session_context (Components::SessionContext_ptr ctx) +MyImpl::NavDisplayGUI_exec_impl::set_session_context ( + Components::SessionContext_ptr ctx) { this->context_ = HUDisplay::CCM_NavDisplay_Context::_narrow (ctx); @@ -77,7 +91,7 @@ MyImpl::NavDisplayGUI_exec_impl::set_session_context (Components::SessionContext { throw CORBA::INTERNAL (); } - // Urm, we actually discard exceptions thown from this operation. + // Urm, we actually discard exceptions thrown from this operation. } void @@ -88,6 +102,7 @@ MyImpl::NavDisplayGUI_exec_impl::configuration_complete (void) void MyImpl::NavDisplayGUI_exec_impl::ccm_activate (void) { + ACE_DEBUG((LM_DEBUG,"MyImpl::NavDisplayGUI_exec_impl::ccm_activate \n")); worker_ = new Worker (sizeof (argv) / sizeof (argv[0]), const_cast<char **> (argv)); @@ -97,14 +112,24 @@ MyImpl::NavDisplayGUI_exec_impl::ccm_activate (void) "Cannot activate client threads\n")); throw Components::CCMException (); } - worker_->waitUntillInitialized (); - AddNavUnitCmd *cmd = AddNavUnitCmd::create ( - worker_->getMainWindow(), - &(this->unit_)); - QCustomEvent *evt = new QCustomEvent (QEvent::User, cmd); - QApplication::postEvent (worker_->getMainWindow (), evt); + NavEvent::set_type(QEvent::User); + + //make for all GPS devices a unit with initial different locations. + for (int i = 0; i < number_of_GPS(); i ++) + { + NavUnit * unit; + unit = new NavUnit((i+ 1)); + navunitarr.push_back(unit); + navunitarr[i]->setLocation (UnitLocation(10.0 + (10*i), 20.0 + (10*i))); + + AddNavUnitCmd *cmd = AddNavUnitCmd::create ( + worker_->getMainWindow(), + (navunitarr[i])); + NavEvent *evt = new NavEvent (cmd); + QApplication::postEvent (worker_->getMainWindow (), evt); + } } void @@ -115,7 +140,7 @@ MyImpl::NavDisplayGUI_exec_impl::ccm_passivate (void) if (target != 0) { QuitCmd *cmd = QuitCmd::create( target); - QCustomEvent *evt = new QCustomEvent (QEvent::User, cmd); + NavEvent *evt = new NavEvent (cmd); QApplication::postEvent (target, evt); worker_->thr_mgr ()->wait (); } @@ -126,6 +151,11 @@ MyImpl::NavDisplayGUI_exec_impl::ccm_passivate (void) void MyImpl::NavDisplayGUI_exec_impl::ccm_remove (void) { + for (std::vector<NavUnit*>::iterator unitObj = navunitarr.begin(); + unitObj != navunitarr.end(); ++unitObj) + { + delete *unitObj; + } } /// Default ctor. diff --git a/CIAO/examples/Display/NavDisplayGUI_exec/NavDisplayGUI_exec.h b/CIAO/examples/Display/NavDisplayGUI_exec/NavDisplayGUI_exec.h index ce1a35f35eb..5f0c9193b0f 100644 --- a/CIAO/examples/Display/NavDisplayGUI_exec/NavDisplayGUI_exec.h +++ b/CIAO/examples/Display/NavDisplayGUI_exec/NavDisplayGUI_exec.h @@ -17,6 +17,7 @@ #include "ace/Synch.h" #include "tao/LocalObject.h" #include "NavUnit.h" +#include <vector> class Worker; @@ -27,6 +28,7 @@ namespace MyImpl * * RateGen executor implementation class. */ + class NAVDISPLAY_EXEC_Export NavDisplayGUI_exec_impl : public virtual ::CIAO_HUDisplay_NavDisplay_Impl::NavDisplay_Exec, public virtual ::CORBA::LocalObject @@ -59,13 +61,19 @@ namespace MyImpl virtual void ccm_remove (void); + + //attribute operations + virtual CORBA::Long number_of_GPS (); + virtual void number_of_GPS (CORBA::Long number_of_GPS); + protected: /// Copmponent specific context HUDisplay::CCM_NavDisplay_Context_var context_; Worker *worker_; - NavUnit unit_; + CORBA::Long number_of_GPS_; UnitLocation loc_; - TAO_SYNCH_MUTEX mutex_; + std::vector<NavUnit*> navunitarr; + TAO_SYNCH_RECURSIVE_MUTEX mutex_; }; /** diff --git a/CIAO/examples/Display/NavDisplayGUI_exec/NavUnit.cpp b/CIAO/examples/Display/NavDisplayGUI_exec/NavUnit.cpp index f3b4be4cd3a..d7a4d2f44af 100644 --- a/CIAO/examples/Display/NavDisplayGUI_exec/NavUnit.cpp +++ b/CIAO/examples/Display/NavDisplayGUI_exec/NavUnit.cpp @@ -1,8 +1,9 @@ // $Id$ #include "NavUnit.h" +#include "tao/LocalObject.h" -NavUnit::NavUnit(const UnitID &id, const char *short_descr) -: id_(id), short_descr_(short_descr) +NavUnit::NavUnit(const UnitID &id) +: id_(id) { } diff --git a/CIAO/examples/Display/NavDisplayGUI_exec/NavUnit.h b/CIAO/examples/Display/NavDisplayGUI_exec/NavUnit.h index 86dd2cccbd7..cfb32ad1f36 100644 --- a/CIAO/examples/Display/NavDisplayGUI_exec/NavUnit.h +++ b/CIAO/examples/Display/NavDisplayGUI_exec/NavUnit.h @@ -9,12 +9,11 @@ class UnitLocation { public: - UnitLocation() {x_ = y_ = z_ = 0.0;} + UnitLocation() {x_ = y_ = 0.0;} UnitLocation( double x, - double y, - double z) : - x_(x), y_(y), z_(z) {} + double y) : + x_(x), y_(y) {} UnitLocation(const UnitLocation &ul) { operator = (ul); } @@ -23,12 +22,11 @@ public: { x_ = ul.x_; y_ = ul.y_; - z_ = ul.z_; return *this; } public: - double x_, y_, z_; + double x_, y_; }; typedef unsigned long UnitID; @@ -36,21 +34,18 @@ typedef unsigned long UnitID; class NavUnit { public: - NavUnit(const UnitID &id, const char *short_descr); + NavUnit(const UnitID &id); + NavUnit(const NavUnit&); virtual ~NavUnit() {} public: UnitID getID() const {return id_;} - const char *getShortDescr() const {return short_descr_.c_str();} - void setShortDescr(const char *short_descr) {short_descr_ = short_descr;} - UnitLocation getLocation() const {return loc_;} void setLocation(const UnitLocation &loc) {loc_ = loc;} protected: UnitID id_; - ACE_CString short_descr_; UnitLocation loc_; }; diff --git a/CIAO/examples/Display/NavDisplayGUI_exec/NodeItem.cpp b/CIAO/examples/Display/NavDisplayGUI_exec/NodeItem.cpp index 75681470a05..7c7dc85062a 100644 --- a/CIAO/examples/Display/NavDisplayGUI_exec/NodeItem.cpp +++ b/CIAO/examples/Display/NavDisplayGUI_exec/NodeItem.cpp @@ -3,58 +3,14 @@ #include "NodeItem.h" #include <Qt/qbrush.h> -QBrush *NodeItem::normal = new QBrush(Qt::red); -QBrush *NodeItem::highlighted = new QBrush(Qt::green); - -NodeItem::NodeItem(Q3Canvas *canvas, NavUnit &unit) - : Q3CanvasEllipse(8, 8, canvas), - unit_(unit), - blink_timer(canvas), - is_selected_(0) -{ - setBrush(*normal); - setZ(128); -} - -void NodeItem::moveBy(double dx, double dy, double /* dz */) -{ - Q3CanvasEllipse::moveBy (dx, dy); -} - -void -NodeItem::timerDone() +NodeItem::NodeItem(QGraphicsScene *canvas, NavUnit &unit) + : QGraphicsRectItem(0.0, 0.0, 10.0, 10.0,0, canvas), + unit_(unit) { - if(selected()) - { - if(brush() == *normal) - setBrush(*highlighted); - else - setBrush(*normal); - - canvas()->update(); - } + setRect(unit_.getLocation().x_, unit_.getLocation().y_, 10.0, 10.0); + // There are only 7 colors defined. + int color_id = unit_.getID() % 7; + QBrush *br = new QBrush(Qt::GlobalColor(arrayColors[color_id])); + setBrush(*br); } -void -NodeItem::setSelected(bool yes) -{ - is_selected_ = yes; - - if(yes) - { - // FUZZ: disable check_for_lack_ACE_OS - connect(&blink_timer, SIGNAL(timeout()), - SLOT(timerDone())); - // FUZZ: enable check_for_lack_ACE_OS - - blink_timer.start(500); - } - else - { - blink_timer.stop(); - disconnect(SIGNAL(timeout()), this, - SLOT(timerDone())); - setBrush(*normal); - canvas()->update(); - } -} diff --git a/CIAO/examples/Display/NavDisplayGUI_exec/NodeItem.h b/CIAO/examples/Display/NavDisplayGUI_exec/NodeItem.h index b9e27a62256..a284fc339f0 100644 --- a/CIAO/examples/Display/NavDisplayGUI_exec/NodeItem.h +++ b/CIAO/examples/Display/NavDisplayGUI_exec/NodeItem.h @@ -4,44 +4,35 @@ #define __NODEITEM_H #include "NavUnit.h" -#include <Qt/q3canvas.h> #include <Qt/qtimer.h> #include <Qt/qbrush.h> #include <Qt/qobject.h> +#include <Qt/qgraphicsitem.h> + +const int arrayColors[] = { + 12, //Qt::yellow, + 7, //Qt::red, + 8, //Qt::green, + 11, //Qt::magenta, + 9, //Qt::blue, + 10, //Qt::cyan + 3, //Qt::white + } ; class NodeItem: public QObject, - public Q3CanvasEllipse + public QGraphicsRectItem { Q_OBJECT public: - NodeItem(Q3Canvas *canvas, NavUnit &unit); - - ~NodeItem() {} - - enum { - nodeRTTI = 1 - }; - - void moveBy(double dx, double dy, double dz); - - virtual int rtti() const {return nodeRTTI;} - - virtual void setSelected(bool yes); - virtual bool selected() const {return is_selected_;} + NodeItem(QGraphicsScene *canvas, NavUnit &unit); public slots: - void timerDone(); private: NavUnit &unit_; - QTimer blink_timer; - bool is_selected_; - static QBrush *normal; - static QBrush *highlighted; }; - #endif // __NODEITEM_H diff --git a/CIAO/examples/Display/NavDisplayGUI_exec/RootPanel.cpp b/CIAO/examples/Display/NavDisplayGUI_exec/RootPanel.cpp index 9ba841720ea..48c49448e18 100644 --- a/CIAO/examples/Display/NavDisplayGUI_exec/RootPanel.cpp +++ b/CIAO/examples/Display/NavDisplayGUI_exec/RootPanel.cpp @@ -3,32 +3,25 @@ #include "RootPanel.h" #include <Qt/qmenubar.h> #include <Qt/qapplication.h> -#include <Qt/qprogressdialog.h> #include <Qt/qsplitter.h> #include <stdlib.h> #include "NodeItem.h" #include "Command.h" -RootPanel::RootPanel(Q3Canvas &c, QWidget *parent, const char *name) -: QMainWindow(parent, name), canvas(c) +RootPanel::RootPanel(QGraphicsScene &c, QWidget *parent) +: QMainWindow(parent), canvas(c) { - QSplitter *s1 = new QSplitter( Qt::Vertical, this , "main" ); - navview = new MapView(canvas, s1); - s1->moveToFirst(navview); + QSplitter *s1 = new QSplitter( Qt::Vertical, parent ); + navview = new MapView(canvas, s1); details = new DetailView(s1); - QMenuBar* menu = menuBar(); - - Q3PopupMenu* file = new Q3PopupMenu; - //file->insertItem("&Fill canvas", this, SLOT(init()), CTRL+Key_F); - //file->insertItem("&Erase canvas", this, SLOT(clear()), CTRL+Key_E); - //file->insertItem("&New view", this, SLOT(newView()), CTRL+Key_N); - file->insertSeparator(); - file->insertItem("E&xit", qApp, SLOT(quit()), Qt::CTRL + Qt::Key_Q); - menu->insertItem("&File", file); - + QMenu *filemenu = menuBar()->addMenu(tr("&File")); + QAction *exitAct = new QAction(tr("E&xit"), this); + exitAct->setShortcut(Qt::CTRL + Qt::Key_Q); + connect(exitAct, SIGNAL(triggered()), qApp, SLOT(quit())); + filemenu->addAction(exitAct); setCentralWidget(s1); } @@ -42,10 +35,11 @@ RootPanel::addUnit(NavUnit *unit) { NodeItem *el = new NodeItem(&canvas, *unit); nodeMap.bind(unit->getID(), el); - UnitLocation loc = unit->getLocation(); - el->move(loc.x_, loc.y_); - el->show(); - this->details->currentNode(unit); + // only for first GPS write details. + if(unit->getID() == 0) + { + this->details->currentNode(unit); + } } void @@ -53,11 +47,19 @@ RootPanel::updateUnit(NavUnit *unit) { NodeItem *el = 0; nodeMap.find(unit->getID(), el); + UnitLocation loc = unit->getLocation(); - el->move(loc.x_, loc.y_); - //canvas.update(); + //width is incl. borders and text, so correct for this . + loc.x_ = (long)loc.x_ % (navview->width() + 40); + loc.y_ = (long)loc.y_ % (navview->height() + 80); - this->details->updateLocation(loc); + el->moveBy(loc.x_ - el->pos().x() , loc.y_ - el->pos().y()); + el->show(); + canvas.update(); + if(unit->getID() == 0) + { + this->details->updateLocation(loc); + } } void @@ -66,20 +68,40 @@ RootPanel::clear() navview->clear(); } +int NavEvent::registered_type_ = (-1); + +NavEvent::NavEvent(CommandBase* cmd) + : QEvent (static_cast<QEvent::Type> (NavEvent::registered_type_)), + cmd_ (cmd) +{ +} +NavEvent::~NavEvent () +{ +} + +CommandBase* NavEvent::cmd () const +{ + return this->cmd_; +} + +void NavEvent::set_type (int type) +{ + NavEvent::registered_type_ = type; +} + +QEvent::Type NavEvent::get_type () +{ + return static_cast<QEvent::Type> (NavEvent::registered_type_); +} + void -RootPanel::customEvent(QCustomEvent *e) +RootPanel::customEvent(QEvent *e) { - CommandBase *cmd = (CommandBase*)(e->data()); - cmd->execute(); - delete cmd; -/* - int elapsed = time.restart(); - int fps = (elapsed == 0 ? 1000 : 1000 / elapsed); - - if(prev_fps != fps) - { - prev_fps = fps; - ups->setNum(prev_fps); - } -*/ + if (e->type () == NavEvent::get_type ()) + { + NavEvent* ne = dynamic_cast<NavEvent*> (e); + CommandBase* cmd = ne->cmd (); + cmd->execute(); + delete cmd; + } } diff --git a/CIAO/examples/Display/NavDisplayGUI_exec/RootPanel.h b/CIAO/examples/Display/NavDisplayGUI_exec/RootPanel.h index 75a18d51fc3..49f8958e80f 100644 --- a/CIAO/examples/Display/NavDisplayGUI_exec/RootPanel.h +++ b/CIAO/examples/Display/NavDisplayGUI_exec/RootPanel.h @@ -11,11 +11,31 @@ #include "DetailView.h" #include <Qt/qmainwindow.h> #include <Qt/qevent.h> -#include <Qt/q3popupmenu.h> +#include <Qt/qgraphicsscene.h> + +#include "Command.h" class NodeItem; class QMouseEvent; +class NavEvent : public QEvent +{ +public: + NavEvent(CommandBase* cmd); + virtual ~NavEvent (); + + CommandBase* cmd () const; + + static void set_type (int type); + + static QEvent::Type get_type (); + +private: + CommandBase* cmd_; + + static int registered_type_; +}; + class RootPanel : public QMainWindow { Q_OBJECT @@ -27,7 +47,7 @@ typedef ACE_Hash_Map_Manager_Ex<ACE_UINT64, ACE_Null_Mutex> NodeItemMap; public: - RootPanel(Q3Canvas&, QWidget *parent = 0, const char *name = 0); + RootPanel(QGraphicsScene&, QWidget *parent = 0); ~RootPanel(); public: @@ -36,13 +56,11 @@ public: protected: void clear(); - virtual void customEvent(QCustomEvent *e); + virtual void customEvent(QEvent *e); - Q3Canvas& canvas; + QGraphicsScene& canvas; MapView *navview; DetailView *details; - - Q3PopupMenu* options; NodeItemMap nodeMap; }; diff --git a/CIAO/examples/Display/NavDisplayGUI_exec/Worker.cpp b/CIAO/examples/Display/NavDisplayGUI_exec/Worker.cpp index 43b72a0a2aa..53966c62cce 100644 --- a/CIAO/examples/Display/NavDisplayGUI_exec/Worker.cpp +++ b/CIAO/examples/Display/NavDisplayGUI_exec/Worker.cpp @@ -6,6 +6,7 @@ #include <Qt/qcdestyle.h> #include <Qt/qwindowsstyle.h> #include <Qt/qdesktopwidget.h> +#include <Qt/qgraphicsscene.h> int Worker::svc (void) @@ -13,18 +14,12 @@ Worker::svc (void) ACE_DEBUG((LM_DEBUG, "ENTER: Worker::svc()\n")); QApplication a(argc_, argv_); -// a.setStyle(new QPlatinumStyle); - Q3Canvas canvas(600, 387); - //QCanvas canvas(566, 679); - //QCanvas canvas(550, 723); - canvas.setAdvancePeriod(30); + QGraphicsScene canvas(1,1,650, 410); RootPanel root_panel(canvas); - root_panel.resize(root_panel.sizeHint()); + root_panel.resize(620, 460); + root_panel.setWindowTitle("NavDisplay"); - root_panel.resize(600, 650); - root_panel.setCaption("NavDisplay"); - - a.setMainWidget(&root_panel); + a.setActiveWindow(&root_panel); QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) ); diff --git a/CIAO/examples/Display/RateGen/RateGen_exec.cpp b/CIAO/examples/Display/RateGen/RateGen_exec.cpp index 58f3ed9be79..ba4834e7f24 100644 --- a/CIAO/examples/Display/RateGen/RateGen_exec.cpp +++ b/CIAO/examples/Display/RateGen/RateGen_exec.cpp @@ -241,7 +241,7 @@ MyImpl::RateGen_exec_i::pulse (void) try { ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("Pushing HUDisplay::tick event!\n"))); + ACE_TEXT ("Rate Generator sends Pulse to GPS!\n"))); HUDisplay::tick_var ev = new OBV_HUDisplay::tick (); this->context_->push_Pulse (ev.in ()); diff --git a/CIAO/examples/Display/RateGen/controller.cpp b/CIAO/examples/Display/RateGen/controller.cpp index 0eb9394eaee..38cc5f476cb 100644 --- a/CIAO/examples/Display/RateGen/controller.cpp +++ b/CIAO/examples/Display/RateGen/controller.cpp @@ -41,13 +41,13 @@ parse_args (int argc, ACE_TCHAR *argv[]) 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 <RateGen IOR> (default is file://RateGen.ior)\n" - "-r <rate in hertz> (default is 3)\n" - "\n", - argv [0]), + "usage: %s\n" + "-o (Turn on the rate generator)\n" + "-f (Turn off the rate generator)\n" + "-k <RateGen IOR> (default is file://RateGen.ior)\n" + "-r <rate in hertz> (default is 3)\n" + "\n", + argv [0]), -1); break; } @@ -107,7 +107,6 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) ACE_DEBUG ((LM_DEBUG, "Rate Generator stopped\n")); } - orb->destroy (); } catch (const CORBA::Exception& ex) diff --git a/CIAO/examples/Display/descriptors/DeploymentPlan.cdp b/CIAO/examples/Display/descriptors/DeploymentPlan.cdp deleted file mode 100644 index 7738d55138b..00000000000 --- a/CIAO/examples/Display/descriptors/DeploymentPlan.cdp +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no" ?> -<!-- $Id$ --> -<Deployment:DeploymentPlan - - xmlns:Deployment="http://www.omg.org/Deployment" - xmlns:xmi="http://www.omg.org/XMI" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.omg.org/Deployment Deployment.xsd"> - - <label>Display Deployment Plan</label> - - <instance xmi:id="RateGen_Instance"> - <name>RateGen_Instance</name> - <node>RateGenNode</node> - </instance> - - <instance xmi:id="GPS_Instance"> - <name>GPS_Instance</name> - <node>GPSNode</node> - </instance> - - <instance xmi:id="NavDisplay_Instance"> - <name>NavDisplay_Instance</name> - <node>NavDisplayNode</node> - </instance> - -</Deployment:DeploymentPlan> diff --git a/CIAO/examples/Display/descriptors/basicNodeDaemon.pl b/CIAO/examples/Display/descriptors/basicNodeDaemon.pl deleted file mode 100755 index 3e0ab781003..00000000000 --- a/CIAO/examples/Display/descriptors/basicNodeDaemon.pl +++ /dev/null @@ -1,54 +0,0 @@ -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; - -$tg = PerlACE::TestTarget::create_target (1) || die "Create target for ns failed\n"; - -$status = 0; -$iorbase1 = "NodeApp1.ior"; -$iorbase2 = "NodeApp2.ior"; -$iorbase3 = "NodeApp3.ior"; -$iorbase4 = "NodeApp4.ior"; -$iorbase5 = "NodeApp5.ior"; - -$iorfile1 = $tg->LocalFile ("NodeApp1.ior"); -$iorfile2 = $tg->LocalFile ("NodeApp2.ior"); -$iorfile3 = $tg->LocalFile ("NodeApp3.ior"); -$iorfile4 = $tg->LocalFile ("NodeApp4.ior"); -$iorfile5 = $tg->LocalFile ("NodeApp5.ior"); - -$tg->DeleteFile ("NodeApp1.ior"); -$tg->DeleteFile ("NodeApp2.ior"); -$tg->DeleteFile ("NodeApp3.ior"); -$tg->DeleteFile ("NodeApp4.ior"); -$tg->DeleteFile ("NodeApp5.ior"); - -$CIAO_ROOT=$ENV{'CIAO_ROOT'}; - -$SV1 = $tg->CreateProcess ("$DANCE_ROOT/bin/dance_node_manager", - "-ORBEndpoint iiop://localhost:10000 -s $DANCE_ROOT/bin/dance_locality_manager"); - -$SV2 = $tg->CreateProcess ("$DANCE_ROOT/bin/dance_node_manager", - "-ORBEndpoint iiop://localhost:20000 -s $DANCE_ROOT/bin/dance_locality_manager"); - -$SV3 = $tg->CreateProcess ("$DANCE_ROOT/bin/dance_node_manager", - "-ORBEndpoint iiop://localhost:30000 -s $DANCE_ROOT/bin/dance_locality_manager"); - -$SV4 = $tg->CreateProcess ("$DANCE_ROOT/bin/dance_node_manager", - "-ORBEndpoint iiop://localhost:40000 -s $DANCE_ROOT/bin/dance_locality_manager"); - -$SV5 = $tg->CreateProcess ("$DANCE_ROOT/bin/dance_node_manager", - "-ORBEndpoint iiop://localhost:50000 -s $DANCE_ROOT/bin/dance_locality_manager"); -$SV1->Spawn (); -$SV2->Spawn (); -$SV3->Spawn (); -$SV4->Spawn (); -$SV5->Spawn (); - -sleep (99999999999); diff --git a/CIAO/examples/Display/descriptors/deploymentplanmore.cdp b/CIAO/examples/Display/descriptors/deploymentplanmore.cdp new file mode 100644 index 00000000000..3fbb0dd334b --- /dev/null +++ b/CIAO/examples/Display/descriptors/deploymentplanmore.cdp @@ -0,0 +1,984 @@ +<!-- $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>Display-DeploymentPlan</label> + <UUID>Display_Plan_UUID_0001</UUID> + + <implementation xmi:id="HUDisplay-RateGen-mdd"> + <name>HUDisplay-RateGen-mdd</name> + <source/> + <artifact xmi:idref="HUDisplay-RateGen_svnt" /> + <artifact xmi:idref="HUDisplay-RateGen_exec" /> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>createRateGenHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_HUDisplay_RateGenHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>RateGen_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>RateGen_exec</string> + </value> + </value> + </execParameter> + </implementation> + <implementation xmi:id="HUDisplay-RateGen-comp-mdd"> + <name>HUDisplay-RateGen-comp-mdd</name> + <source/> + <artifact xmi:idref="HUDisplay-RateGen_svnt" /> + <artifact xmi:idref="HUDisplay-RateGen_exec" /> + <execParameter> + <name>edu.vanderbilt.dre.DAnCE.ImplementationType</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>edu.vanderbilt.dre.CCM.HomedComponent</string> + </value> + </value> + </execParameter> + </implementation> + + + + <implementation xmi:id="HUDisplay-NavDisplay-mdd"> + <name>HUDisplay-NavDisplay-mdd</name> + <source/> + <artifact xmi:idref="HUDisplay-NavDisplay_svnt"/> + <artifact xmi:idref="HUDisplay-NavDisplay_exec"/> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>createNavDisplayHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_HUDisplay_NavDisplayHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>NavDisplayGUI_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>NavDisplayGUI_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="HUDisplay-NavDisplay-comp-mdd"> + <name>HUDisplay-NavDisplay-comp-mdd</name> + <source/> + <artifact xmi:idref="HUDisplay-NavDisplay_svnt"/> + <artifact xmi:idref="HUDisplay-NavDisplay_exec"/> + <execParameter> + <name>edu.vanderbilt.dre.DAnCE.ImplementationType</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>edu.vanderbilt.dre.CCM.HomedComponent</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="HUDisplay-GPS-mdd"> + <name>HUDisplay-GPS-mdd</name> + <source/> + <artifact xmi:idref="HUDisplay-GPS_svnt" /> + <artifact xmi:idref="HUDisplay-GPS_exec" /> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>createGPSHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_HUDisplay_GPSHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>GPS_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>GPS_exec</string> + </value> + </value> + </execParameter> + </implementation> + <implementation xmi:id="HUDisplay-GPS-comp-mdd"> + <name>HUDisplay-GPS-comp_mdd</name> + <source/> + <artifact xmi:idref="HUDisplay-GPS_svnt" /> + <artifact xmi:idref="HUDisplay-GPS_exec" /> + <execParameter> + <name>edu.vanderbilt.dre.DAnCE.ImplementationType</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>edu.vanderbilt.dre.CCM.HomedComponent</string> + </value> + </value> + </execParameter> + </implementation> + + <instance xmi:id="HUDisplay-GPS-idd"> + <name>HUDisplay-GPS-idd</name> + <node>GPSNode1</node> + <source/> + <implementation xmi:idref="HUDisplay-GPS-mdd"/> + <!-- Add this property if you want to write component reference to IOR --> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>GPSHome.ior</string> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.RegisterNaming</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>GPSHome</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="HUDisplay-GPS2-idd"> + <name>HUDisplay-GPS2-idd</name> + <node>GPSNode2</node> + <source/> + <implementation xmi:idref="HUDisplay-GPS-mdd"/> + <!-- Add this property if you want to write component reference to IOR --> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>GPS2Home.ior</string> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.RegisterNaming</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>GPS2Home</string> + </value> + </value> + </configProperty> + </instance> + +<instance xmi:id="HUDisplay-GPS3-idd"> + <name>HUDisplay-GPS3-idd</name> + <node>GPSNode3</node> + <source/> + <implementation xmi:idref="HUDisplay-GPS-mdd"/> + <!-- Add this property if you want to write component reference to IOR --> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>GPS2Home.ior</string> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.RegisterNaming</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>GPS2Home</string> + </value> + </value> + </configProperty> + </instance> + +<instance xmi:id="HUDisplay-GPS-comp-idd"> + <name>HUDisplay-GPS-comp-idd</name> + <node>GPSNode1</node> + <source/> + <implementation xmi:idref="HUDisplay-GPS-comp-mdd"/> + <!-- Add this property if you want to write component reference to IOR --> + <configProperty> + <name>edu.vanderbilt.dre.CIAO.ComponentHomeId</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>HUDisplay-GPS-idd</string> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>GPS.ior</string> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.RegisterNaming</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>GPS</string> + </value> + </value> + </configProperty> + <configProperty> + <name>id</name> + <value> + <type> + <kind>tk_ushort</kind> + </type> + <value> + <ushort>10</ushort> + </value> + </value> + </configProperty> + </instance> + +<instance xmi:id="HUDisplay-GPS2-comp-idd"> + <name>HUDisplay-GPS2-comp-idd</name> + <node>GPSNode2</node> + <source/> + <implementation xmi:idref="HUDisplay-GPS-comp-mdd"/> + <!-- Add this property if you want to write component reference to IOR --> + <configProperty> + <name>edu.vanderbilt.dre.CIAO.ComponentHomeId</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>HUDisplay-GPS2-idd</string> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>GPS2.ior</string> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.RegisterNaming</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>GPS2</string> + </value> + </value> + </configProperty> + <configProperty> + <name>id</name> + <value> + <type> + <kind>tk_ushort</kind> + </type> + <value> + <ushort>13</ushort> + </value> + </value> + </configProperty> + </instance> + +<instance xmi:id="HUDisplay-GPS3-comp-idd"> + <name>HUDisplay-GPS3-comp-idd</name> + <node>GPSNode3</node> + <source/> + <implementation xmi:idref="HUDisplay-GPS-comp-mdd"/> + <!-- Add this property if you want to write component reference to IOR --> + <configProperty> + <name>edu.vanderbilt.dre.CIAO.ComponentHomeId</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>HUDisplay-GPS3-idd</string> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>GPS3.ior</string> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.RegisterNaming</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>GPS3</string> + </value> + </value> + </configProperty> + <configProperty> + <name>id</name> + <value> + <type> + <kind>tk_ushort</kind> + </type> + <value> + <ushort>5</ushort> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="HUDisplay-RateGen-idd"> + <name>HUDisplay-RateGen-idd</name> + <node>RateGenNode</node> + <source/> + <implementation xmi:idref="HUDisplay-RateGen-mdd"/> + <!-- Add this property if you want to write component reference to IOR --> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>RateGenHome.ior</string> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.RegisterNaming</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>RateGenHome</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="HUDisplay-RateGen-comp-idd"> + <name>HUDisplay-RateGen-comp-idd</name> + <node>RateGenNode</node> + <source/> + <implementation xmi:idref="HUDisplay-RateGen-comp-mdd"/> + <configProperty> + <name>edu.vanderbilt.dre.CIAO.ComponentHomeId</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>HUDisplay-RateGen-idd</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> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.RegisterNaming</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>RateGen</string> + </value> + </value> + </configProperty> + <!-- Add this property if you want to initialize component attribute --> + <configProperty> + <name>hertz</name> + <value> + <type> + <kind>tk_long</kind> + </type> + <value> + <long>2</long> + </value> + </value> + </configProperty> + </instance> + +<instance xmi:id="HUDisplay-RateGen2-idd"> + <name>HUDisplay-RateGen2-idd</name> + <node>RateGenNode</node> + <source/> + <implementation xmi:idref="HUDisplay-RateGen-mdd"/> + <!-- Add this property if you want to write component reference to IOR --> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>RateGen2Home.ior</string> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.RegisterNaming</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>RateGen2Home</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="HUDisplay-RateGen2-comp-idd"> + <name>HUDisplay-RateGen2-comp-idd</name> + <node>RateGenNode</node> + <source/> + <implementation xmi:idref="HUDisplay-RateGen-comp-mdd"/> + <configProperty> + <name>edu.vanderbilt.dre.CIAO.ComponentHomeId</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>HUDisplay-RateGen2-idd</string> + </value> + </value> + </configProperty> + <!-- Add this property if you want to write component reference to IOR --> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>RateGen2.ior</string> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.RegisterNaming</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>RateGen2</string> + </value> + </value> + </configProperty> + <!-- Add this property if you want to initialize component attribute --> + <configProperty> + <name>hertz</name> + <value> + <type> + <kind>tk_long</kind> + </type> + <value> + <long>2</long> + </value> + </value> + </configProperty> + </instance> + + +<instance xmi:id="HUDisplay-RateGen3-idd"> + <name>HUDisplay-RateGen3-idd</name> + <node>RateGenNode</node> + <source/> + <implementation xmi:idref="HUDisplay-RateGen-mdd"/> + <!-- Add this property if you want to write component reference to IOR --> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>RateGen3Home.ior</string> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.RegisterNaming</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>RateGen3Home</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="HUDisplay-RateGen3-comp-idd"> + <name>HUDisplay-RateGen3-comp-idd</name> + <node>RateGenNode</node> + <source/> + <implementation xmi:idref="HUDisplay-RateGen-comp-mdd"/> + <configProperty> + <name>edu.vanderbilt.dre.CIAO.ComponentHomeId</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>HUDisplay-RateGen3-idd</string> + </value> + </value> + </configProperty> + <!-- Add this property if you want to write component reference to IOR --> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>RateGen3.ior</string> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.RegisterNaming</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>RateGen3</string> + </value> + </value> + </configProperty> + <!-- Add this property if you want to initialize component attribute --> + <configProperty> + <name>hertz</name> + <value> + <type> + <kind>tk_long</kind> + </type> + <value> + <long>2</long> + </value> + </value> + </configProperty> + </instance> + + + <instance xmi:id="HUDisplay-NavDisplay-idd"> + <name>HUDisplay-NavDisplay-idd</name> + <node>AirFrameDevice</node> + <source/> + <implementation xmi:idref="HUDisplay-NavDisplay-mdd" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>NavDisplayHome.ior</string> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.RegisterNaming</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>NavDisplayHome</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="HUDisplay-NavDisplay-comp-idd"> + <name>HUDisplay-NavDisplay-comp-idd</name> + <node>AirFrameDevice</node> + <source/> + <implementation xmi:idref="HUDisplay-NavDisplay-comp-mdd" /> + <configProperty> + <name>edu.vanderbilt.dre.CIAO.ComponentHomeId</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>HUDisplay-NavDisplay-idd</string> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>NavDisplay.ior</string> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.RegisterNaming</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>NavDisplay</string> + </value> + </value> + </configProperty> + <configProperty> + <name>number_of_GPS</name> + <value> + <type> + <kind>tk_long</kind> + </type> + <value> + <long>3</long> + </value> + </value> + </configProperty> + </instance> + + <connection> + <name>Pulse_Refresh</name> + <internalEndpoint> + <portName>Pulse</portName> + <provider>false</provider> + <kind>EventPublisher</kind> + <instance xmi:idref="HUDisplay-RateGen-comp-idd"/> + </internalEndpoint> + <internalEndpoint> + <portName>Refresh</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance xmi:idref="HUDisplay-GPS-comp-idd" /> + </internalEndpoint> + </connection> + + <connection> + <name>Refresh_Ready</name> + <internalEndpoint> + <portName>Ready</portName> + <provider>false</provider> + <kind>EventPublisher</kind> + <instance xmi:idref="HUDisplay-GPS-comp-idd" /> + </internalEndpoint> + <internalEndpoint> + <portName>Refresh</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance xmi:idref="HUDisplay-NavDisplay-comp-idd" /> + </internalEndpoint> + </connection> + + <connection> + <name>GPSLocation_MyLocation_facet</name> + <internalEndpoint> + <portName>MyLocation</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="HUDisplay-GPS-comp-idd"/> + </internalEndpoint> + <internalEndpoint> + <portName>GPSLocation</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="HUDisplay-NavDisplay-comp-idd" /> + </internalEndpoint> + </connection> + +<connection> + <name>Pulse_Refresh2</name> + <internalEndpoint> + <portName>Pulse</portName> + <provider>false</provider> + <kind>EventPublisher</kind> + <instance xmi:idref="HUDisplay-RateGen2-comp-idd"/> + </internalEndpoint> + <internalEndpoint> + <portName>Refresh</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance xmi:idref="HUDisplay-GPS2-comp-idd" /> + </internalEndpoint> + </connection> + + <connection> + <name>Refresh_Ready2</name> + <internalEndpoint> + <portName>Ready</portName> + <provider>false</provider> + <kind>EventPublisher</kind> + <instance xmi:idref="HUDisplay-GPS2-comp-idd" /> + </internalEndpoint> + <internalEndpoint> + <portName>Refresh</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance xmi:idref="HUDisplay-NavDisplay-comp-idd" /> + </internalEndpoint> + </connection> + + <connection> + <name>GPSLocation_MyLocation_facet2</name> + <internalEndpoint> + <portName>MyLocation</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="HUDisplay-GPS2-comp-idd"/> + </internalEndpoint> + <internalEndpoint> + <portName>GPSLocation</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="HUDisplay-NavDisplay-comp-idd" /> + </internalEndpoint> + </connection> + + +<connection> + <name>Pulse_Refresh3</name> + <internalEndpoint> + <portName>Pulse</portName> + <provider>false</provider> + <kind>EventPublisher</kind> + <instance xmi:idref="HUDisplay-RateGen3-comp-idd"/> + </internalEndpoint> + <internalEndpoint> + <portName>Refresh</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance xmi:idref="HUDisplay-GPS3-comp-idd" /> + </internalEndpoint> + </connection> + + <connection> + <name>Refresh_Ready3</name> + <internalEndpoint> + <portName>Ready</portName> + <provider>false</provider> + <kind>EventPublisher</kind> + <instance xmi:idref="HUDisplay-GPS3-comp-idd" /> + </internalEndpoint> + <internalEndpoint> + <portName>Refresh</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance xmi:idref="HUDisplay-NavDisplay-comp-idd" /> + </internalEndpoint> + </connection> + + <connection> + <name>GPSLocation_MyLocation_facet3</name> + <internalEndpoint> + <portName>MyLocation</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="HUDisplay-GPS3-comp-idd"/> + </internalEndpoint> + <internalEndpoint> + <portName>GPSLocation</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="HUDisplay-NavDisplay-comp-idd" /> + </internalEndpoint> + </connection> + + <artifact xmi:id="HUDisplay-RateGen_svnt"> + <name>RateGen_svnt</name> + <source/> + <node/> + <location>RateGen_svnt</location> + </artifact> + + <artifact xmi:id="HUDisplay-RateGen_exec"> + <name>RateGen_exec</name> + <source><!-- @@ Not sure --></source> + <node><!-- blank --></node> + <location>RateGen_exec</location> + </artifact> + + <artifact xmi:id="HUDisplay-GPS_svnt"> + <name>GPS_svnt</name> + <source/> + <node/> + <location>GPS_svnt</location> + </artifact> + + <artifact xmi:id="HUDisplay-GPS_exec"> + <name>GPS_exec</name> + <source/> + <node/> + <location>GPS_exec</location> + </artifact> + + <artifact xmi:id="HUDisplay-NavDisplay_svnt"> + <name>NavDisplayGUI_svnt</name> + <source/> + <node/> + <location>NavDisplayGUI_svnt</location> + </artifact> + + <artifact xmi:id="HUDisplay-NavDisplay_exec"> + <name>NavDisplayGUI_exec</name> + <source/> + <node/> + <location>NavDisplayGUI_exec</location> + </artifact> + +</Deployment:DeploymentPlan> diff --git a/CIAO/examples/Display/descriptors/deploymentplanone.cdp b/CIAO/examples/Display/descriptors/deploymentplanone.cdp new file mode 100644 index 00000000000..115f2565f0d --- /dev/null +++ b/CIAO/examples/Display/descriptors/deploymentplanone.cdp @@ -0,0 +1,546 @@ +<!-- $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>Display-DeploymentPlan</label> + <UUID>Display_Plan_UUID_0001</UUID> + + <implementation xmi:id="HUDisplay-RateGen-mdd"> + <name>HUDisplay-RateGen-mdd</name> + <source/> + <artifact xmi:idref="HUDisplay-RateGen_svnt" /> + <artifact xmi:idref="HUDisplay-RateGen_exec" /> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>createRateGenHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_HUDisplay_RateGenHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>RateGen_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>RateGen_exec</string> + </value> + </value> + </execParameter> + </implementation> + <implementation xmi:id="HUDisplay-RateGen-comp-mdd"> + <name>HUDisplay-RateGen-comp-mdd</name> + <source/> + <artifact xmi:idref="HUDisplay-RateGen_svnt" /> + <artifact xmi:idref="HUDisplay-RateGen_exec" /> + <execParameter> + <name>edu.vanderbilt.dre.DAnCE.ImplementationType</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>edu.vanderbilt.dre.CCM.HomedComponent</string> + </value> + </value> + </execParameter> + </implementation> + + + + <implementation xmi:id="HUDisplay-NavDisplay-mdd"> + <name>HUDisplay-NavDisplay-mdd</name> + <source/> + <artifact xmi:idref="HUDisplay-NavDisplay_svnt"/> + <artifact xmi:idref="HUDisplay-NavDisplay_exec"/> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>createNavDisplayHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_HUDisplay_NavDisplayHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>NavDisplayGUI_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>NavDisplayGUI_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="HUDisplay-NavDisplay-comp-mdd"> + <name>HUDisplay-NavDisplay-comp-mdd</name> + <source/> + <artifact xmi:idref="HUDisplay-NavDisplay_svnt"/> + <artifact xmi:idref="HUDisplay-NavDisplay_exec"/> + <execParameter> + <name>edu.vanderbilt.dre.DAnCE.ImplementationType</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>edu.vanderbilt.dre.CCM.HomedComponent</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="HUDisplay-GPS-mdd"> + <name>HUDisplay-GPS-mdd</name> + <source/> + <artifact xmi:idref="HUDisplay-GPS_svnt" /> + <artifact xmi:idref="HUDisplay-GPS_exec" /> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>createGPSHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_HUDisplay_GPSHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>GPS_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>GPS_exec</string> + </value> + </value> + </execParameter> + </implementation> + <implementation xmi:id="HUDisplay-GPS-comp-mdd"> + <name>HUDisplay-GPS-comp_mdd</name> + <source/> + <artifact xmi:idref="HUDisplay-GPS_svnt" /> + <artifact xmi:idref="HUDisplay-GPS_exec" /> + <execParameter> + <name>edu.vanderbilt.dre.DAnCE.ImplementationType</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>edu.vanderbilt.dre.CCM.HomedComponent</string> + </value> + </value> + </execParameter> + </implementation> + + <instance xmi:id="HUDisplay-GPS-idd"> + <name>HUDisplay-GPS-idd</name> + <node>GPSNode</node> + <source/> + <implementation xmi:idref="HUDisplay-GPS-mdd"/> + <!-- Add this property if you want to write component reference to IOR --> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>GPSHome.ior</string> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.RegisterNaming</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>GPSHome</string> + </value> + </value> + </configProperty> + </instance> + +<instance xmi:id="HUDisplay-GPS-comp-idd"> + <name>HUDisplay-GPS-comp-idd</name> + <node>GPSNode</node> + <source/> + <implementation xmi:idref="HUDisplay-GPS-comp-mdd"/> + <!-- Add this property if you want to write component reference to IOR --> + <configProperty> + <name>edu.vanderbilt.dre.CIAO.ComponentHomeId</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>HUDisplay-GPS-idd</string> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>GPS.ior</string> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.RegisterNaming</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>GPS</string> + </value> + </value> + </configProperty> + </instance> + + + <instance xmi:id="HUDisplay-RateGen-idd"> + <name>HUDisplay-RateGen-idd</name> + <node>RateGenNode</node> + <source/> + <implementation xmi:idref="HUDisplay-RateGen-mdd"/> + <!-- Add this property if you want to write component reference to IOR --> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>RateGenHome.ior</string> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.RegisterNaming</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>RateGenHome</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="HUDisplay-RateGen-comp-idd"> + <name>HUDisplay-RateGen-comp-idd</name> + <node>RateGenNode</node> + <source/> + <implementation xmi:idref="HUDisplay-RateGen-comp-mdd"/> + <configProperty> + <name>edu.vanderbilt.dre.CIAO.ComponentHomeId</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>HUDisplay-RateGen-idd</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> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.RegisterNaming</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>RateGen</string> + </value> + </value> + </configProperty> + <!-- Add this property if you want to initialize component attribute --> + <configProperty> + <name>hertz</name> + <value> + <type> + <kind>tk_long</kind> + </type> + <value> + <long>2</long> + </value> + </value> + </configProperty> + </instance> + + + <instance xmi:id="HUDisplay-NavDisplay-idd"> + <name>HUDisplay-NavDisplay-idd</name> + <node>AirFrameDevice</node> + <source/> + <implementation xmi:idref="HUDisplay-NavDisplay-mdd" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>NavDisplayHome.ior</string> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.RegisterNaming</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>NavDisplayHome</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="HUDisplay-NavDisplay-comp-idd"> + <name>HUDisplay-NavDisplay-comp-idd</name> + <node>AirFrameDevice</node> + <source/> + <implementation xmi:idref="HUDisplay-NavDisplay-comp-mdd" /> + <configProperty> + <name>edu.vanderbilt.dre.CIAO.ComponentHomeId</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>HUDisplay-NavDisplay-idd</string> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>NavDisplay.ior</string> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.RegisterNaming</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>NavDisplay</string> + </value> + </value> + </configProperty> + <configProperty> + <name>number_of_GPS</name> + <value> + <type> + <kind>tk_long</kind> + </type> + <value> + <long>1</long> + </value> + </value> + </configProperty> + </instance> + + <connection> + <name>Pulse_Refresh</name> + <internalEndpoint> + <portName>Pulse</portName> + <provider>false</provider> + <kind>EventPublisher</kind> + <instance xmi:idref="HUDisplay-RateGen-comp-idd"/> + </internalEndpoint> + <internalEndpoint> + <portName>Refresh</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance xmi:idref="HUDisplay-GPS-comp-idd" /> + </internalEndpoint> + </connection> + + <connection> + <name>Refresh_Ready</name> + <internalEndpoint> + <portName>Ready</portName> + <provider>false</provider> + <kind>EventPublisher</kind> + <instance xmi:idref="HUDisplay-GPS-comp-idd" /> + </internalEndpoint> + <internalEndpoint> + <portName>Refresh</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance xmi:idref="HUDisplay-NavDisplay-comp-idd" /> + </internalEndpoint> + </connection> + + <connection> + <name>GPSLocation_MyLocation_facet</name> + <internalEndpoint> + <portName>MyLocation</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="HUDisplay-GPS-comp-idd"/> + </internalEndpoint> + <internalEndpoint> + <portName>GPSLocation</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="HUDisplay-NavDisplay-comp-idd" /> + </internalEndpoint> + </connection> + + <artifact xmi:id="HUDisplay-RateGen_svnt"> + <name>RateGen_svnt</name> + <source/> + <node/> + <location>RateGen_svnt</location> + </artifact> + + <artifact xmi:id="HUDisplay-RateGen_exec"> + <name>RateGen_exec</name> + <source><!-- @@ Not sure --></source> + <node><!-- blank --></node> + <location>RateGen_exec</location> + </artifact> + + <artifact xmi:id="HUDisplay-GPS_svnt"> + <name>GPS_svnt</name> + <source/> + <node/> + <location>GPS_svnt</location> + </artifact> + + <artifact xmi:id="HUDisplay-GPS_exec"> + <name>GPS_exec</name> + <source/> + <node/> + <location>GPS_exec</location> + </artifact> + + <artifact xmi:id="HUDisplay-NavDisplay_svnt"> + <name>NavDisplayGUI_svnt</name> + <source/> + <node/> + <location>NavDisplayGUI_svnt</location> + </artifact> + + <artifact xmi:id="HUDisplay-NavDisplay_exec"> + <name>NavDisplayGUI_exec</name> + <source/> + <node/> + <location>NavDisplayGUI_exec</location> + </artifact> + +</Deployment:DeploymentPlan> diff --git a/CIAO/examples/Display/descriptors/flattened_deploymentplan.cdp b/CIAO/examples/Display/descriptors/flattened_deploymentplan.cdp deleted file mode 100644 index 1b9f437690a..00000000000 --- a/CIAO/examples/Display/descriptors/flattened_deploymentplan.cdp +++ /dev/null @@ -1,306 +0,0 @@ -<!-- $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>Display-DeploymentPlan</label> - <UUID>Display_Plan_UUID_0001</UUID> - <!-- Exactly one realizes - This realizes section may also not be right. --> - <realizes> - <label>HUDisplay-realizes-cid</label> - <UUID>4edb0436-da3f-450e-baed-79127c1405b2</UUID> - <specificType><!-- @@ What does here? --></specificType> - <supportedType>IDL:HUDisplay/RateGen:1.0</supportedType> - <port> - <name>Pulse</name> - <specificType>IDL:HUDisplay/TimeOut:1.0</specificType> - <supportedType>IDL:HUDisplay/TimeOut:1.0</supportedType> - <provider>false</provider> - <exclusiveProvider>false</exclusiveProvider> - <exclusiveUser>false</exclusiveUser> - <optional>false</optional> - <kind>EventPublisher</kind> - </port> - </realizes> - - - - - <implementation id="HUDisplay-RateGen-mdd"> - <name>HUDisplay-RateGen-mdd</name> - <source><!-- @@ Don't know what goes here --></source> - <artifact>HUDisplay-RateGen_svnt</artifact> - <artifact>HUDisplay-RateGen_exec</artifact> - <!-- - <execParameter></execParameter> - <deployRequirement></deployRequirement> - --> - </implementation> - - <implementation id="HUDisplay-NavDisplay-mdd"> - <name>HUDisplay-NavDisplay-mdd</name> - <source><!-- @@ Don't know what goes here --></source> - <artifact>HUDisplay-NavDisplay_svnt</artifact> - <artifact>HUDisplay-NavDisplay_exec</artifact> - <!-- - <execParameter></execParameter> - <deployRequirement></deployRequirement> - --> - </implementation> - - <implementation id="HUDisplay-GPS-mdd"> - <name>HUDisplay-GPS-mdd</name> - <source><!-- @@ Don't know what goes here --></source> - <artifact>HUDisplay-GPS_svnt</artifact> - <artifact>HUDisplay-GPS_exec</artifact> - <!-- - <execParameter></execParameter> - <deployRequirement></deployRequirement> - --> - </implementation> - - - - - <instance id="HUDisplay-GPS-idd"> - <name>HUDisplay-GPS-idd</name> - <node>AirFrameDevice</node> - <source><!-- @@ What goes here --></source> - <implementation>HUDisplay-GPS-mdd</implementation> - <!-- Add this property if you want to write component reference to IOR --> - <configProperty> - <name>ComponentIOR</name> - <value> - <type> - <kind>tk_string</kind> - </type> - <value> - <string>GPS.ior</string> - </value> - </value> - </configProperty> - </instance> - - - <instance id="HUDisplay-RateGen-idd"> - <name>HUDisplay-RateGen-idd</name> - <node>AirFrameDevice</node> - <source><!-- @@ What goes here --></source> - <implementation>HUDisplay-RateGen-mdd</implementation> - <!-- Add this property if you want to write component reference to IOR --> - <configProperty> - <name>ComponentIOR</name> - <value> - <type> - <kind>tk_string</kind> - </type> - <value> - <string>RateGen.ior</string> - </value> - </value> - </configProperty> - <!-- Add this property if you want to initialize component attribute --> - <configProperty> - <name>hertz</name> - <value> - <type> - <kind>tk_long</kind> - </type> - <value> - <long>2</long> - </value> - </value> - </configProperty> - </instance> - - <instance id="HUDisplay-NavDisplay-idd"> - <name>HUDisplay-NavDisplay-idd</name> - <node>AirFrameDevice</node> - <source><!-- @@ What goes here --></source> - <implementation>HUDisplay-NavDisplay-mdd</implementation> - <configProperty> - <name>ComponentIOR</name> - <value> - <type> - <kind>tk_string</kind> - </type> - <value> - <string>NavDisplay.ior</string> - </value> - </value> - </configProperty> - </instance> - - - <connection> - <name>Pulse_Refresh</name> - <internalEndpoint> - <portName>Pulse</portName> - <kind>EventPublisher</kind> - <instance>HUDisplay-RateGen-idd</instance> - </internalEndpoint> - <internalEndpoint> - <portName>Refresh</portName> - <kind>EventConsumer</kind> - <instance>HUDisplay-GPS-idd</instance> - </internalEndpoint> - </connection> - - <connection> - <name>Refresh_Ready</name> - <internalEndpoint> - <portName>Ready</portName> - <kind>EventPublisher</kind> - <instance>HUDisplay-GPS-idd</instance> - </internalEndpoint> - <internalEndpoint> - <portName>Refresh</portName> - <kind>EventConsumer</kind> - <instance>HUDisplay-NavDisplay-idd</instance> - </internalEndpoint> - </connection> - - <connection> - <name>GPSLocation_MyLocation_facet</name> - <internalEndpoint> - <portName>MyLocation</portName> - <kind>Facet</kind> - <instance>HUDisplay-GPS-idd</instance> - </internalEndpoint> - <internalEndpoint> - <portName>GPSLocation</portName> - <kind>SimplexReceptacle</kind> - <instance>HUDisplay-NavDisplay-idd</instance> - </internalEndpoint> - </connection> - - - - - - <artifact id="HUDisplay-RateGen_svnt"> - <name>RateGen_svnt</name> - <source><!-- @@ Not sure --></source> - <node><!-- blank --></node> - <location>RateGen_svnt</location> - <execParameter> - <name>entryPoint</name> - <value> - <type> - <kind>tk_string</kind> - </type> - <value> - <string>create_HUDisplay_RateGenHome_Servant</string> - </value> - </value> - </execParameter> - <!-- @@ This has dependancies that need to be specified, how? --> - </artifact> - - <artifact id="HUDisplay-RateGen_exec"> - <name>RateGen_exec</name> - <source><!-- @@ Not sure --></source> - <node><!-- blank --></node> - <location>RateGen_exec</location> - <execParameter> - <name>entryPoint</name> - <value> - <type> - <kind>tk_string</kind> - </type> - <value> - <string>createRateGenHome_Impl</string> - </value> - </value> - </execParameter> - - <!-- @@ This has dependancies that need to be specified, how? --> - </artifact> - - - <artifact id="HUDisplay-GPS_svnt"> - <name>GPS_svnt</name> - <source><!-- @@ Not sure --></source> - <node><!-- blank --></node> - <location>GPS_svnt</location> - <execParameter> - <name>entryPoint</name> - <value> - <type> - <kind>tk_string</kind> - </type> - <value> - <string>create_HUDisplay_GPSHome_Servant</string> - </value> - </value> - </execParameter> - <!-- @@ This has dependancies that need to be specified, how? --> - </artifact> - - - <artifact id="HUDisplay-GPS_exec"> - <name>GPS_exec</name> - <source><!-- @@ Not sure about this--></source> - <node><!-- blank --></node> - <location>GPS_exec</location> - <execParameter> - <name>entryPoint</name> - <value> - <type> - <kind>tk_string</kind> - </type> - <value> - <string>createGPSHome_Impl</string> - </value> - </value> - </execParameter> - - <!-- @@ This has dependancies that need to be specified, how? --> - </artifact> - - - <artifact id="HUDisplay-NavDisplay_svnt"> - <name>NavDisplay_svnt</name> - <source><!-- @@ Not sure --></source> - <node><!-- blank --></node> - <location>NavDisplay_svnt</location> - <execParameter> - <name>entryPoint</name> - <value> - <type> - <kind>tk_string</kind> - </type> - <value> - <string>create_HUDisplay_NavDisplayHome_Servant</string> - </value> - </value> - </execParameter> - <!-- @@ This has dependancies that need to be specified, how? --> - </artifact> - - - <artifact id="HUDisplay-NavDisplay_exec"> - <name>NavDisplay_exec</name> - <source><!-- @@ Not sure --></source> - <node><!-- blank --></node> - <location>NavDisplay_exec</location> - <execParameter> - <name>entryPoint</name> - <value> - <type> - <kind>tk_string</kind> - </type> - <value> - <string>createNavDisplayHome_Impl</string> - </value> - </value> - </execParameter> - <!-- @@ This has dependancies that need to be specified, how? --> - </artifact> - - - -</Deployment:deploymentPlan> diff --git a/CIAO/examples/Display/descriptors/flattened_deploymentplannat.cdp b/CIAO/examples/Display/descriptors/flattened_deploymentplannat.cdp index 10a1e5527c9..ea904395af9 100644 --- a/CIAO/examples/Display/descriptors/flattened_deploymentplannat.cdp +++ b/CIAO/examples/Display/descriptors/flattened_deploymentplannat.cdp @@ -7,7 +7,7 @@ <label>Display-DeploymentPlan</label> <UUID>Display_Plan_UUID_0001</UUID> - + <implementation xmi:id="HUDisplay-RateGen-mdd"> <name>HUDisplay-RateGen-mdd</name> <source/> @@ -77,8 +77,6 @@ </execParameter> </implementation> - - <implementation xmi:id="HUDisplay-NavDisplay-mdd"> <name>HUDisplay-NavDisplay-mdd</name> <source/> @@ -201,7 +199,7 @@ </execParameter> </implementation> <implementation xmi:id="HUDisplay-GPS-comp-mdd"> - <name>HUDisplay-GPS-comp_mdd</name> + <name>HUDisplay-GPS-comp-mdd</name> <source/> <artifact xmi:idref="HUDisplay-GPS_svnt" /> <artifact xmi:idref="HUDisplay-GPS_exec" /> @@ -220,7 +218,7 @@ <instance xmi:id="HUDisplay-GPS-idd"> <name>HUDisplay-GPS-idd</name> - <node>AirFrameDevice_2</node> + <node>GPSNode</node> <source/> <implementation xmi:idref="HUDisplay-GPS-mdd"/> <!-- Add this property if you want to write component reference to IOR --> @@ -249,8 +247,8 @@ </instance> <instance xmi:id="HUDisplay-GPS-comp-idd"> - <name>HUDisplay-GPS-comp_idd</name> - <node>AirFrameDevice_2</node> + <name>HUDisplay-GPS-comp-idd</name> + <node>GPSNode</node> <source/> <implementation xmi:idref="HUDisplay-GPS-comp-mdd"/> <!-- Add this property if you want to write component reference to IOR --> @@ -287,11 +285,22 @@ </value> </value> </configProperty> + <configProperty> + <name>id</name> + <value> + <type> + <kind>tk_ushort</kind> + </type> + <value> + <ushort>1</ushort> + </value> + </value> + </configProperty> </instance> <instance xmi:id="HUDisplay-RateGen-idd"> <name>HUDisplay-RateGen-idd</name> - <node>AirFrameDevice</node> + <node>RateGenNode</node> <source/> <implementation xmi:idref="HUDisplay-RateGen-mdd"/> <!-- Add this property if you want to write component reference to IOR --> @@ -318,10 +327,10 @@ </value> </configProperty> </instance> - + <instance xmi:id="HUDisplay-RateGen-comp-idd"> <name>HUDisplay-RateGen-comp-idd</name> - <node>AirFrameDevice</node> + <node>RateGenNode</node> <source/> <implementation xmi:idref="HUDisplay-RateGen-comp-mdd"/> <configProperty> @@ -375,7 +384,7 @@ <instance xmi:id="HUDisplay-NavDisplay-idd"> <name>HUDisplay-NavDisplay-idd</name> - <node>AirFrameDevice_3</node> + <node>AirFrameDevice</node> <source/> <implementation xmi:idref="HUDisplay-NavDisplay-mdd" /> <configProperty> @@ -404,7 +413,7 @@ <instance xmi:id="HUDisplay-NavDisplay-comp-idd"> <name>HUDisplay-NavDisplay-comp-idd</name> - <node>AirFrameDevice_3</node> + <node>AirFrameDevice</node> <source/> <implementation xmi:idref="HUDisplay-NavDisplay-comp-mdd" /> <configProperty> @@ -440,6 +449,18 @@ </value> </value> </configProperty> + <!-- Add this property if you have nore then 1 GPS instance.--> + <configProperty> + <name>number_of_GPS</name> + <value> + <type> + <kind>tk_long</kind> + </type> + <value> + <long>1</long> + </value> + </value> + </configProperty> </instance> <connection> @@ -532,5 +553,4 @@ <location>NavDisplay_exec</location> </artifact> - </Deployment:DeploymentPlan> diff --git a/CIAO/examples/Display/descriptors/run_all_in_one.pl b/CIAO/examples/Display/descriptors/run_all_in_one.pl new file mode 100755 index 00000000000..b34fb051ced --- /dev/null +++ b/CIAO/examples/Display/descriptors/run_all_in_one.pl @@ -0,0 +1,270 @@ +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 = ( 60001, 60002, 60003 ); +@iorbases = ( "RateGen.ior" , "GPS.ior", "NavDisplay.ior"); +@iorfiles = 0; +@nodenames = ( "RateGenNode", "GPSNode", "AirFrameDevice"); +$controller_exec = "$CIAO_ROOT/examples/Display/RateGen/controller"; + +# 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 = "flattened_deploymentplannat.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 = "-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:60004 -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:60004 -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:60004/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 --instance-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 5 seconds to allow task to complete\n"; +sleep (5); +print "Invoking the controller for RateGen with rate = 1\n"; +$controller = $tg_executor->CreateProcess ("$controller_exec", "-k file://RateGen.ior -o"); +$result = $controller->SpawnWaitKill ($tg_executor->ProcessStopWaitInterval ()); +if ($result != 0) { + print STDERR "ERROR: The controller returned $result\n"; + $status = 1; +} + +# put some delay here. +sleep (10); + +# invoking the controller again to stop the rategen +print "Invoking the controller to stop RateGen\n"; +$controller = $tg_executor->CreateProcess ("$controller_exec", "-k file://RateGen.ior -f"); +$result = $controller->SpawnWaitKill ($tg_executor->ProcessStopWaitInterval ()); +if ($result != 0) { + print STDERR "ERROR: The controller returned $result\n"; + $status = 1; +} +print "Sleeping 10 seconds to allow task to complete\n"; +sleep (10); + + + +# Invoke executor - stop the application -. +print "Invoking executor - stop the application -\n"; +print "by running dance_plan_launcher.exe with -k file://$ior_emfile -x $cdp_file\n"; + +$E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-k file://$ior_emfile -x $cdp_file -s"); + +$pl_status = $E->SpawnWaitKill (2 * $tg_executor->ProcessStartWaitInterval ()); + +if ($pl_status != 0) { + print STDERR "ERROR: dance_plan_launcher returned $pl_status\n"; + kill_open_processes (); + exit 1; +} + + + +print "Executor returned.\n"; +print "Shutting down rest of the processes.\n"; + +delete_ior_files (); +kill_open_processes (); + +exit $status; diff --git a/CIAO/examples/Display/descriptors/run_test.pl b/CIAO/examples/Display/descriptors/run_test.pl index 8a0752ed5a5..8482df59e1b 100755 --- a/CIAO/examples/Display/descriptors/run_test.pl +++ b/CIAO/examples/Display/descriptors/run_test.pl @@ -20,7 +20,7 @@ $nr_daemon = 3; @ports = ( 60001, 60002, 60003 ); @iorbases = ( "RateGen.ior" , "GPS.ior", "NavDisplay.ior"); @iorfiles = 0; -@nodenames = ( "AirFrameDevice", "AirFrameDevice_2", "AirFrameDevice_3"); +@nodenames = ( "RateGenNode", "GPSNode", "AirFrameDevice"); #$controller_exec = "$CIAO_ROOT/examples/Display/RateGen/controller"; # ior files other than daemon @@ -115,7 +115,7 @@ sub run_node_daemons { $d_cmd = "$DANCE_ROOT/bin/dance_node_manager"; $d_param = "-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); diff --git a/CIAO/examples/Display/descriptors/run_test_more.pl b/CIAO/examples/Display/descriptors/run_test_more.pl new file mode 100755 index 00000000000..2674eedd679 --- /dev/null +++ b/CIAO/examples/Display/descriptors/run_test_more.pl @@ -0,0 +1,270 @@ +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 = 5; +@ports = ( 60001, 60002, 60003, 60004, 60005 ); +@iorbases = ( "GPS.ior","GPS2.ior", "GPS3.ior", "RateGen.ior" ,"NavDisplay.ior"); +@iorfiles = 0; +@nodenames = ( "GPSNode1", "GPSNode2", "GPSNode3","RateGenNode", "AirFrameDevice"); +$controller_exec = "$CIAO_ROOT/examples/Display/RateGen/controller"; + + +# 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 = "deploymentplanmore.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"; + $d_param = "-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:60010 -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:60010 -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:60010/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 --instance-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 "Invoking the controller\n"; +#$controller = $tg_executor->CreateProcess ("$controller_exec", "-k file://RateGen.ior -o"); +#$result = $controller->SpawnWaitKill ($tg_executor->ProcessStopWaitInterval ()); +#if ($result != 0) { +# print STDERR "ERROR: The controller returned $result\n"; +# $status = 1; +#} + +# put some delay here. +sleep (20); + +# invoking the controller again to stop the rategen +#print "Invoking the controller to stop RateGen\n"; +#$controller = $tg_executor->CreateProcess ("$controller_exec", "-k file://RateGen.ior -f"); +#$result = $controller->SpawnWaitKill ($tg_executor->ProcessStopWaitInterval ()); +#if ($result != 0) { +# print STDERR "ERROR: The controller returned $result\n"; +# $status = 1; +#} + +print "Sleeping 900 seconds to allow task to complete\n"; +sleep (900); + +# Invoke executor - stop the application -. +print "Invoking executor - stop the application -\n"; +print "by running dance_plan_launcher.exe with -k file://$ior_emfile -x $cdp_file\n"; + +$E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-k file://$ior_emfile -x $cdp_file -s"); + +$pl_status = $E->SpawnWaitKill (2 * $tg_executor->ProcessStartWaitInterval ()); + +if ($pl_status != 0) { + print STDERR "ERROR: dance_plan_launcher returned $pl_status\n"; + kill_open_processes (); + exit 1; +} + +print "Executor returned.\n"; +print "Shutting down rest of the processes.\n"; + +delete_ior_files (); +kill_open_processes (); + +exit $status; diff --git a/CIAO/examples/Display/descriptors/run_test_more_contr.pl b/CIAO/examples/Display/descriptors/run_test_more_contr.pl new file mode 100755 index 00000000000..4565bacd72e --- /dev/null +++ b/CIAO/examples/Display/descriptors/run_test_more_contr.pl @@ -0,0 +1,81 @@ +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'}"; + +$controller_exec = "$CIAO_ROOT/examples/Display/RateGen/controller"; + +$tg_executor = 0; + +$status = 0; + +sub create_targets { + # executor (plan_launcher) + $tg_executor = PerlACE::TestTarget::create_target (1) || die "Create target for executor failed\n"; + $tg_executor->AddLibPath ('../lib'); +} + +create_targets (); + +print "Invoking the controller for first RateGen with rate = 1\n"; +$controller = $tg_executor->CreateProcess ("$controller_exec", "-k file://RateGen.ior -o -r1"); +$result = $controller->SpawnWaitKill (3 * $tg_executor->ProcessStopWaitInterval ()); +if ($result != 0) { + print STDERR "ERROR: The controller returned $result\n"; + $status = 1; +} + +# put some delay here. +sleep (5); +print "Invoking the controller for second RateGen with rate = 2\n"; +$controller = $tg_executor->CreateProcess ("$controller_exec", "-k file://RateGen2.ior -o -r2"); +$result = $controller->SpawnWaitKill (3 * $tg_executor->ProcessStopWaitInterval ()); +if ($result != 0) { + print STDERR "ERROR: The controller returned $result\n"; + $status = 1; +} + +print "Invoking the controller for third RateGen with rate = 2\n"; +$controller = $tg_executor->CreateProcess ("$controller_exec", "-k file://RateGen3.ior -o -r2"); +$result = $controller->SpawnWaitKill (3 * $tg_executor->ProcessStopWaitInterval ()); +if ($result != 0) { + print STDERR "ERROR: The controller returned $result\n"; + $status = 1; +} + +sleep (15); +# invoking the controller again to stop the rategen +print "Invoking the controller to stop the second RateGen\n"; +$controller = $tg_executor->CreateProcess ("$controller_exec", "-k file://RateGen2.ior -f"); +$result = $controller->SpawnWaitKill (3 * $tg_executor->ProcessStopWaitInterval ()); +if ($result != 0) { + print STDERR "ERROR: The controller returned $result\n"; + $status = 1; +} +# invoking the controller again to stop the rategen +print "Invoking the controller to stop the first RateGen\n"; +$controller = $tg_executor->CreateProcess ("$controller_exec", "-k file://RateGen.ior -f"); +$result = $controller->SpawnWaitKill (3 * $tg_executor->ProcessStopWaitInterval ()); +if ($result != 0) { + print STDERR "ERROR: The controller returned $result\n"; + $status = 1; +} + +# invoking the controller again to stop the rategen +print "Invoking the controller to stop the third RateGen\n"; +$controller = $tg_executor->CreateProcess ("$controller_exec", "-k file://RateGen3.ior -f"); +$result = $controller->SpawnWaitKill (3 * $tg_executor->ProcessStopWaitInterval ()); +if ($result != 0) { + print STDERR "ERROR: The controller returned $result\n"; + $status = 1; +} +exit $status;
\ No newline at end of file diff --git a/CIAO/examples/Display/descriptors/run_test_one.pl b/CIAO/examples/Display/descriptors/run_test_one.pl new file mode 100755 index 00000000000..521929a9d0c --- /dev/null +++ b/CIAO/examples/Display/descriptors/run_test_one.pl @@ -0,0 +1,247 @@ +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 = ( 60001, 60003, 60004 ); +@iorbases = ( "GPS.ior", "RateGen.ior" ,"NavDisplay.ior"); +@iorfiles = 0; +@nodenames = ( "GPSNode", "RateGenNode", "AirFrameDevice"); + +# 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 = "deploymentplanone.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"; + $d_param = "-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:60005 -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:60005 -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:60005/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 --instance-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 300 seconds to allow task to complete\n"; +sleep (300); + +# Invoke executor - stop the application -. +print "Invoking executor - stop the application -\n"; +print "by running dance_plan_launcher.exe with -k file://$ior_emfile -x $cdp_file\n"; + +$E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-k file://$ior_emfile -x $cdp_file -s"); + +$pl_status = $E->SpawnWaitKill (2 * $tg_executor->ProcessStartWaitInterval ()); + +if ($pl_status != 0) { + print STDERR "ERROR: dance_plan_launcher returned $pl_status\n"; + kill_open_processes (); + exit 1; +} + +print "Executor returned.\n"; +print "Shutting down rest of the processes.\n"; + +delete_ior_files (); +kill_open_processes (); + +exit $status; diff --git a/CIAO/examples/Display/descriptors/run_test_one_contr.pl b/CIAO/examples/Display/descriptors/run_test_one_contr.pl new file mode 100755 index 00000000000..e0e53039877 --- /dev/null +++ b/CIAO/examples/Display/descriptors/run_test_one_contr.pl @@ -0,0 +1,47 @@ +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'}"; + +$controller_exec = "$CIAO_ROOT/examples/Display/RateGen/controller"; + +$tg_executor = 0; + +$status = 0; + +sub create_targets { + # executor (plan_launcher) + $tg_executor = PerlACE::TestTarget::create_target (1) || die "Create target for executor failed\n"; + $tg_executor->AddLibPath ('../lib'); +} + +create_targets (); + +print "Invoking the controller for first RateGen with rate = 2\n"; +$controller = $tg_executor->CreateProcess ("$controller_exec", "-k file://RateGen.ior -o -r2"); +$result = $controller->SpawnWaitKill (3 * $tg_executor->ProcessStopWaitInterval ()); +if ($result != 0) { + print STDERR "ERROR: The controller returned $result\n"; + $status = 1; +} + +# put some delay here. +sleep (10); + +# invoking the controller again to stop the rategen +print "Invoking the controller to stop the first RateGen\n"; +$controller = $tg_executor->CreateProcess ("$controller_exec", "-k file://RateGen.ior -f"); +$result = $controller->SpawnWaitKill ($tg_executor->ProcessStopWaitInterval ()); +if ($result != 0) { + print STDERR "ERROR: The controller returned $result\n"; + $status = 1; +}exit $status; |