diff options
author | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-04-06 04:11:57 +0000 |
---|---|---|
committer | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-04-06 04:11:57 +0000 |
commit | 167114ff3f1b5810973abec9c27ca8819930b6e9 (patch) | |
tree | edd545d6935c0d3d9a37ec655813a3efa6163324 | |
parent | 3a70cbed493c14ac63ddfd057f84e733193199a1 (diff) | |
download | ATCD-167114ff3f1b5810973abec9c27ca8819930b6e9.tar.gz |
*** empty log message ***
39 files changed, 1346 insertions, 165 deletions
diff --git a/TAO/CIAO/ChangeLog b/TAO/CIAO/ChangeLog index 3511bbdc7a9..b01111198fc 100644 --- a/TAO/CIAO/ChangeLog +++ b/TAO/CIAO/ChangeLog @@ -1,3 +1,70 @@ +Sat Apr 05 20:08:27 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * ciao/CCM_Deployment.idl: + * ciao/Component_Base.idl: + The operation Components::Deployment::Assembly::build can throw + CreateFailure exception. It was missing in the IDL files. + + * ciao/Server_init.cpp: + Register OBV factory for CIAO::Cookie also. + + * docs/templates/CIAO_Glue_Session_Template.cpp: + Made sure we duplicate the object reference before adding them + to subscriber/connection active maps. + + * examples/handcrafted/Display/HUDisplay.idl: + * examples/handcrafted/Display/HUDisplay.mpc: + * examples/handcrafted/Display/HUDisplay_svnt.h: + * examples/handcrafted/Display/HUDisplay_svnt.inl: + * examples/handcrafted/Display/GPS/GPS_exec.cpp: + * examples/handcrafted/Display/GPS/GPS_exec.h: + * examples/handcrafted/Display/GPS/GPS_svnt.cpp: + * examples/handcrafted/Display/NavDisplay/NavDisplay_exec.cpp: + * examples/handcrafted/Display/NavDisplayGUI_exec/NavDisplayGUI_exec.cpp: + * examples/handcrafted/Display/RateGen/RateGen.mpc: + * examples/handcrafted/Display/RateGen/RateGen_svnt.cpp: + Updated the example to support 2-dimentional position interface. + Also fixed the reference counting problem in the servant glue + code. + + + * examples/handcrafted/Display/RateGen/controller.cpp: + Added a new + + * examples/handcrafted/Display/descriptors/HUDisplay.cad: + * examples/handcrafted/Display/descriptors/HUDisplayGUI.cad: + * examples/handcrafted/Display/descriptors/RemoteDisplay.cad: + * examples/handcrafted/Display/descriptors/RemoteDisplayGUI.cad: + Added variety of different composition example. See NOTE.txt + under the same directory for more information. + + * examples/handcrafted/Display/descriptors/test.dat: + Added a "Remote" entry so showcase how to deploy a system across + several machines. + + * tools/Assembly_Deployer/Assembly_Deployer.cpp: + * tools/Assembly_Deployer/Assembly_Deployer.mpc: + * tools/Assembly_Deployer/Assembly_Impl.cpp: + * tools/Assembly_Deployer/Assembly_Impl.h: + * tools/Assembly_Deployer/Assembly_Manager.cpp: + * tools/Assembly_Deployer/Assembly_Visitors.h: + Added support for establishing connections according to + Assembly_Spec. + + * tools/Assembly_Deployer/Assembly_Service.idl: + * tools/Assembly_Deployer/Assembly_Service_Impl.cpp: + * tools/Assembly_Deployer/Assembly_Service_Impl.h: + Added a simple interface in an attempt to solve the unreliable + shutdown problem. + + * tools/XML_Helpers/Assembly_Handlers.cpp: + * tools/XML_Helpers/Assembly_Handlers.h: + * tools/XML_Helpers/Assembly_Handlers.inl: + * tools/XML_Helpers/Assembly_Spec.cpp: + * tools/XML_Helpers/Assembly_Spec.h: + Fixed "connectevent" parsing. I had the "source" and + "destination" interface reversed. + Fri Apr 04 22:40:11 2003 Nanbor Wang <nanbor@cs.wustl.edu> * examples/handcrafted/Display/descriptors/*: Moved all XML diff --git a/TAO/CIAO/ciao/CCM_Deployment.idl b/TAO/CIAO/ciao/CCM_Deployment.idl index 1875fb5b8df..441466de3e5 100644 --- a/TAO/CIAO/ciao/CCM_Deployment.idl +++ b/TAO/CIAO/ciao/CCM_Deployment.idl @@ -66,7 +66,8 @@ module Components interface Assembly { - void build(); + void build() + raises (CreateFailure); void tear_down() raises (RemoveFailure); diff --git a/TAO/CIAO/ciao/Component_Base.idl b/TAO/CIAO/ciao/Component_Base.idl index 32188d01e4d..8b08cc1ece9 100644 --- a/TAO/CIAO/ciao/Component_Base.idl +++ b/TAO/CIAO/ciao/Component_Base.idl @@ -700,7 +700,8 @@ module Components { interface Assembly { - void build(); + void build() + raises (CreateFailure); void tear_down() raises (RemoveFailure); diff --git a/TAO/CIAO/ciao/Server_init.cpp b/TAO/CIAO/ciao/Server_init.cpp index 21e5fd2246e..da2c4a27096 100644 --- a/TAO/CIAO/ciao/Server_init.cpp +++ b/TAO/CIAO/ciao/Server_init.cpp @@ -10,6 +10,8 @@ CIAO::Server_init (CORBA::ORB_ptr o) { CIAO_REGISTER_VALUE_FACTORY (o, CIAO::Map_Key_Cookie_init, Components::Cookie); + CIAO_REGISTER_VALUE_FACTORY (o, CIAO::Map_Key_Cookie_init, + CIAO::Cookie); CIAO_REGISTER_VALUE_FACTORY (o, Components::PortDescription_init, Components::PortDescription); CIAO_REGISTER_VALUE_FACTORY (o, Components::FacetDescription_init, diff --git a/TAO/CIAO/docs/releasenotes.html b/TAO/CIAO/docs/releasenotes.html index c0abdc24c47..2b36725a6a8 100644 --- a/TAO/CIAO/docs/releasenotes.html +++ b/TAO/CIAO/docs/releasenotes.html @@ -19,6 +19,17 @@ <ol> <li><h3>Latest News</h3> <ul> + <li>Sat Apr 5 2003 - Added the support for connection + establishment and finished the multiple-component + <a href="../examples/handcrafted/Display/"> HUDisplay + example</a>. Check out the <a + href="../examples/handcrafted/Display/descriptors/NOTE.txt"> + note </a> to see how to play with it. You need to + have <a href="http://www.trolltech.com/">Qt</a> library + available if you want to play with the GUI based + component. If you don't, no worries. You can still play + with the non-GUI configurations.<p> + <li>Thu Apr 3 2003 - Added the XML documents handlers for componentassembly. They build the assembly specification that the assembly mechanisms use to compose an @@ -26,7 +37,7 @@ documents, these handlers do not have robust error handling capability as they assume a validator in ACEXML parser handles the validity of documents already (which - isn't the case for the time being.) + isn't the case for the time being.)<p> <li>Fri Mar 21 2003 - Finished the component implementations for the multi-component example. Next up, assembling diff --git a/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.cpp b/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.cpp index c0d8f60c2f2..376d6e3ffdb 100644 --- a/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.cpp +++ b/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.cpp @@ -132,10 +132,15 @@ void if (CORBA::is_nil (c)) ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0); + [eventtype]Consumer_var sub + = [eventtype]Consumer::_duplicate (c); + ACE_Active_Map_Manager_Key key; - this->ciao_publishes_[publish name]_map_.bind (c, + this->ciao_publishes_[publish name]_map_.bind (sub.in (), key); + sub._retn (); // Release ownership to map. + ::Components::Cookie_var retv = new CIAO::Map_Key_Cookie (key); return retv._retn (); } @@ -214,10 +219,15 @@ void if (CORBA::is_nil (c)) ACE_THROW_RETURN (::Components::InvalidConnection (), 0); + [uses type]_var conn + = [uses type]::_duplicate (c); + ACE_Active_Map_Manager_Key key; - this->ciao_muses_[receptacle name]_.bind (c, + this->ciao_muses_[receptacle name]_.bind (conn.in (), key); + conn._retn (); // Releases ownership to the map. + ::Components::Cookie_var retv = new CIAO::Map_Key_Cookie (key); return retv._retn (); } diff --git a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_exec.cpp b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_exec.cpp index 60f3429f872..a9608347aad 100644 --- a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_exec.cpp +++ b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_exec.cpp @@ -2,11 +2,14 @@ #include "GPS_exec.h" +#define DISPLACEMENT 256 + /// Default constructor. MyImpl::GPS_exec_impl::GPS_exec_impl () { ACE_OS::srand ((u_int) ACE_OS::time ()); - this->position_ = ACE_OS::rand (); + this->positionx_ = ACE_OS::rand (); + this->positiony_ = ACE_OS::rand (); } /// Default destructor. @@ -29,7 +32,8 @@ MyImpl::GPS_exec_impl::push_Refresh (HUDisplay::tick_ptr ev ACE_THROW_SPEC ((CORBA::SystemException)) { // Refresh position - this->position_ += ACE_OS::rand () % 64 - 32; + this->positionx_ += ACE_OS::rand () % DISPLACEMENT - (DISPLACEMENT/2); + this->positiony_ += ACE_OS::rand () % DISPLACEMENT - (DISPLACEMENT/2); // Nitify others HUDisplay::tick_var event = new OBV_HUDisplay::tick; @@ -41,10 +45,17 @@ MyImpl::GPS_exec_impl::push_Refresh (HUDisplay::tick_ptr ev // Operations from HUDisplay::position CORBA::Long -MyImpl::GPS_exec_impl::pos (ACE_ENV_SINGLE_ARG_DECL) +MyImpl::GPS_exec_impl::posx (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->positionx_; +} + +CORBA::Long +MyImpl::GPS_exec_impl::posy (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - return this->position_; + return this->positiony_; } // Operations from Components::SessionComponent diff --git a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_exec.h b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_exec.h index 964ed39743c..5bdcd9870e4 100644 --- a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_exec.h +++ b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_exec.h @@ -47,7 +47,11 @@ namespace MyImpl // Operations from HUDisplay::position virtual CORBA::Long - pos (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + posx (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::Long + posy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); // Operations from Components::SessionComponent @@ -73,7 +77,8 @@ namespace MyImpl ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)); protected: - CORBA::Long position_; + CORBA::Long positionx_; + CORBA::Long positiony_; /// Copmponent specific context HUDisplay::CCM_GPS_Context_var context_; diff --git a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_svnt.cpp b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_svnt.cpp index 17ae7329d52..903429e1f80 100644 --- a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_svnt.cpp +++ b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_svnt.cpp @@ -51,10 +51,15 @@ CIAO_GLUE_HUDisplay::GPS_Context::subscribe_Ready (HUDisplay::tickConsumer_ptr c if (CORBA::is_nil (c)) ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0); + HUDisplay::tickConsumer_var sub + = HUDisplay::tickConsumer::_duplicate (c); + ACE_Active_Map_Manager_Key key; - this->ciao_publishes_Ready_map_.bind (c, + this->ciao_publishes_Ready_map_.bind (sub.in (), key); + sub._retn (); // Release ownership. + ::Components::Cookie_var retv = new CIAO::Map_Key_Cookie (key); return retv._retn (); } diff --git a/TAO/CIAO/examples/handcrafted/Display/HUDisplay.idl b/TAO/CIAO/examples/handcrafted/Display/HUDisplay.idl index 64251cd9357..d26076beb39 100644 --- a/TAO/CIAO/examples/handcrafted/Display/HUDisplay.idl +++ b/TAO/CIAO/examples/handcrafted/Display/HUDisplay.idl @@ -40,7 +40,8 @@ module HUDisplay */ interface position { - long pos (); + long posx (); + long posy (); }; }; diff --git a/TAO/CIAO/examples/handcrafted/Display/HUDisplay.mpc b/TAO/CIAO/examples/handcrafted/Display/HUDisplay.mpc index 8cfca3c4c42..fc3e5a92ca6 100644 --- a/TAO/CIAO/examples/handcrafted/Display/HUDisplay.mpc +++ b/TAO/CIAO/examples/handcrafted/Display/HUDisplay.mpc @@ -1,7 +1,8 @@ // $Id$ // This file is generated with "generate_component_mpc.pl -n HUDisplay" + project(HUDisplay_stub): ciao_client { - + sharedname = HUDisplay_stub idlflags += -Wb,stub_export_macro=HUDISPLAY_STUB_Export -Wb,stub_export_include=HUDisplay_stub_export.h -Wb,skel_export_macro=HUDISPLAY_SVNT_Export -Wb,skel_export_include=HUDisplay_svnt_export.h dllflags = HUDISPLAY_STUB_BUILD_DLL @@ -18,8 +19,8 @@ project(HUDisplay_stub): ciao_client { project(HUDisplay_svnt) : ciao_server { depends += HUDisplay_stub sharedname = HUDisplay_svnt - libs += HUDisplay_stub - + libs += HUDisplay_stub + idlflags += -Wb,export_macro=HUDISPLAY_SVNT_Export -Wb,export_include=HUDisplay_svnt_export.h dllflags = HUDISPLAY_SVNT_BUILD_DLL @@ -33,7 +34,3 @@ project(HUDisplay_svnt) : ciao_server { HUDisplayEC.cpp } } - - - - diff --git a/TAO/CIAO/examples/handcrafted/Display/HUDisplay_svnt.h b/TAO/CIAO/examples/handcrafted/Display/HUDisplay_svnt.h index 64173f2fbab..828b032afb6 100644 --- a/TAO/CIAO/examples/handcrafted/Display/HUDisplay_svnt.h +++ b/TAO/CIAO/examples/handcrafted/Display/HUDisplay_svnt.h @@ -45,7 +45,10 @@ namespace CIAO_GLUE_HUDisplay ~position_Servant (); - virtual CORBA::Long pos (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + virtual CORBA::Long posx (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::Long posy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); // get_component implementation. diff --git a/TAO/CIAO/examples/handcrafted/Display/HUDisplay_svnt.inl b/TAO/CIAO/examples/handcrafted/Display/HUDisplay_svnt.inl index fc3ec25da3c..6a904e45130 100644 --- a/TAO/CIAO/examples/handcrafted/Display/HUDisplay_svnt.inl +++ b/TAO/CIAO/examples/handcrafted/Display/HUDisplay_svnt.inl @@ -25,8 +25,15 @@ CIAO_GLUE_HUDisplay::position_Servant::~position_Servant () // executor. ACE_INLINE CORBA::Long -CIAO_GLUE_HUDisplay::position_Servant::pos (ACE_ENV_SINGLE_ARG_DECL) +CIAO_GLUE_HUDisplay::position_Servant::posx (ACE_ENV_SINGLE_ARG_DECL) { // Simply relay to executor. May not need to return the result... - return this->executor_->pos (ACE_ENV_SINGLE_ARG_PARAMETER); + return this->executor_->posx (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +ACE_INLINE CORBA::Long +CIAO_GLUE_HUDisplay::position_Servant::posy (ACE_ENV_SINGLE_ARG_DECL) +{ + // Simply relay to executor. May not need to return the result... + return this->executor_->posy (ACE_ENV_SINGLE_ARG_PARAMETER); } diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_exec.cpp b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_exec.cpp index 52c8670ad5d..68495d06ebd 100644 --- a/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_exec.cpp +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_exec.cpp @@ -28,10 +28,14 @@ MyImpl::NavDisplay_exec_impl::push_Refresh (HUDisplay::tick_ptr ev if (CORBA::is_nil (loc.in ())) ACE_THROW (CORBA::BAD_INV_ORDER ()); - CORBA::Long position = loc->pos (ACE_ENV_ARG_PARAMETER); + CORBA::Long x = loc->posx (ACE_ENV_ARG_PARAMETER) % 500; + ACE_CHECK; + CORBA::Long y = loc->posy (ACE_ENV_ARG_PARAMETER) % 300; ACE_CHECK; - ACE_DEBUG ((LM_DEBUG, "DISPLAY: Current Location is: %d\n", position)); + ACE_DEBUG ((LM_DEBUG, "DISPLAY: Current Location is: (%d, %d)\n", + x, + y)); } // Operations from Components::SessionComponent diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/NavDisplayGUI_exec.cpp b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/NavDisplayGUI_exec.cpp index 0dcda8f7595..b3577be5810 100644 --- a/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/NavDisplayGUI_exec.cpp +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/NavDisplayGUI_exec.cpp @@ -38,22 +38,25 @@ MyImpl::NavDisplayGUI_exec_impl::push_Refresh (HUDisplay::tick_ptr ev //ACE_DEBUG ((LM_DEBUG, "ENTER: MyImpl::NavDisplayGUI_exec_impl::push_Refresh()\n")); // Refresh position - /*HUDisplay::position_var loc + HUDisplay::position_var loc = this->context_->get_connection_GPSLocation (ACE_ENV_ARG_PARAMETER); ACE_CHECK; - CORBA::Long position = loc->pos (ACE_ENV_ARG_PARAMETER); - ACE_CHECK;*/ + CORBA::Long lx = loc->posx (ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + CORBA::Long ly = loc->posy (ACE_ENV_ARG_PARAMETER); + ACE_CHECK; mutex_.acquire(); - loc_.x_ += dx_; - loc_.y_ += dy_; + loc_.x_ = lx % 500; + loc_.y_ = ly % 300; - if(loc_.x_ > 500) dx_ = -1; - if(loc_.x_ < 10) dx_ = 1; - if(loc_.y_ > 300) dy_ = -1; - if(loc_.y_ < 10) dy_ = 1; +// if(loc_.x_ > 500) dx_ = -1; +// if(loc_.x_ < 10) dx_ = 1; +// if(loc_.y_ > 300) dy_ = -1; +// if(loc_.y_ < 10) dy_ = 1; this->unit_.setLocation(loc_); diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.mpc b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.mpc index 9f7272e7ff3..dab7f24c219 100644 --- a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.mpc +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.mpc @@ -68,3 +68,15 @@ project (RateGen_client) : ciao_client { } } + +project (controller) : ciao_client { + exename = controller + depends += RateGen_stub + + IDL_Files { + } + + Source_Files { + controller.cpp + } +} diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.cpp b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.cpp index 8351a2c8e37..0d13146fc14 100644 --- a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.cpp +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.cpp @@ -36,9 +36,7 @@ CIAO_GLUE_HUDisplay::RateGen_Context::push_Pulse (HUDisplay::tick_ptr ev ++iter) { ACE_Active_Map_Manager<HUDisplay::tickConsumer_var>::ENTRY &entry = *iter; - HUDisplay::tickConsumer_var c - = HUDisplay::tickConsumer::_narrow (entry.int_id_.in ()); - c->push_tick (ev + entry.int_id_->push_tick (ev ACE_ENV_ARG_PARAMETER); ACE_CHECK; } @@ -54,10 +52,14 @@ CIAO_GLUE_HUDisplay::RateGen_Context::subscribe_Pulse (HUDisplay::tickConsumer_p if (CORBA::is_nil (c)) ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0); + HUDisplay::tickConsumer_var sub = HUDisplay::tickConsumer::_duplicate (c); + ACE_Active_Map_Manager_Key key; - this->ciao_publishes_Pulse_map_.bind (c, + this->ciao_publishes_Pulse_map_.bind (sub.in (), key); + sub._retn (); // Release ownership. + ::Components::Cookie_var retv = new CIAO::Map_Key_Cookie (key); return retv._retn (); } diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/controller.cpp b/TAO/CIAO/examples/handcrafted/Display/RateGen/controller.cpp new file mode 100644 index 00000000000..cb2de1a3839 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/controller.cpp @@ -0,0 +1,101 @@ +// $Id$ + +#include "RateGenC.h" +#include "ace/Get_Opt.h" + +char *rategen_ior_ = 0; +int rate = 2; + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "k:r:"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + rategen_ior_ = get_opts.opt_arg (); + break; + + case 'r': + rate = atoi (get_opts.opt_arg ()); + break; + + case '?': // display help for use of the server. + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s" + "-k <RateGen IOR> (default is file://rategen.ior)" + "-r <rate in hertz> (default is 3)" + "\n", + argv [0]), + -1); + } + + if (rategen_ior_ == 0) + rategen_ior_ = "file://rategen.ior"; + + if (rate == 0) + rate = 3; + + return 0; +} + +int +main (int argc, char *argv[]) +{ + ACE_TRY_NEW_ENV + { + // Initialize orb + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv ACE_ENV_ARG_PARAMETER); + + if (parse_args (argc, argv) != 0) + return -1; + + CORBA::Object_var obj + = orb->string_to_object (rategen_ior_ + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + HUDisplay::RateGen_var pulser + = HUDisplay::RateGen::_narrow (obj + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (pulser.in ())) + ACE_ERROR_RETURN ((LM_ERROR, "Unable to acquire 'RateGen' objref\n"), -1); + + pulser->hertz (rate + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_DEBUG ((LM_DEBUG, "Start up the Rate Generator\n")); + + pulser->start (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_DEBUG ((LM_DEBUG, "Press <enter> to stop the pulse generator\n")); + char dummy [256]; + cin.getline (dummy, 256); + + pulser->stop (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_DEBUG ((LM_DEBUG, "Rate Generator stopped\n")); + + orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Who is the culprit \n"); + cerr << "Uncaught CORBA exception" << endl; + return 1; + } + ACE_ENDTRY; + + return 0; +} diff --git a/TAO/CIAO/examples/handcrafted/Display/descriptors/DuelDisplay.cad b/TAO/CIAO/examples/handcrafted/Display/descriptors/DuelDisplay.cad new file mode 100644 index 00000000000..69e2903b6ce --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/descriptors/DuelDisplay.cad @@ -0,0 +1,113 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- XML doesn't really support the following $(CIAO_ROOT) syntax :) --> +<!DOCTYPE componentassembly SYSTEM "$(CIAO_ROOT)/docs/XML/componentassembly.dtd"> + +<componentassembly id="Single-process HUDisplay assembly"> + <componentfiles> + <componentfile id="com-RateGen"> + <fileinarchive name="RateGen.csd"/> + </componentfile> + <componentfile id="com-GPS"> + <fileinarchive name="GPS.csd"/> + </componentfile> + <componentfile id="com-NavDisplay"> + <fileinarchive name="NavDisplay.csd"/> + </componentfile> + <componentfile id="com-NavDisplayGUI"> + <fileinarchive name="NavDisplayGUI.csd"/> + </componentfile> + </componentfiles> + + <partitioning> + + <!-- A plain vanilla partition. We don't even need the processcollocation tag here. --> + <homeplacement id="a_RateGenHome"> + <componentfileref idref="com-RateGen"/> + <componentinstantiation id="a_RateGen"> + <registercomponent> + <!-- writeiortofile is a non-standard CIAO extension. --> + <writeiortofile name="rategen.ior"/> + </registercomponent> + </componentinstantiation> + </homeplacement> + + <homeplacement id="a_GPSHome"> + <componentfileref idref="com-GPS"/> + <componentinstantiation id="a_GPS"/> + </homeplacement> + + <homeplacement id="a_NavDisplayHome"> + <componentfileref idref="com-NavDisplay"/> + <componentinstantiation id="a_NavDisplay"/> + </homeplacement> + + <processcollocation> + <homeplacement id="a_NavDisplayGUIHome"> + <componentfileref idref="com-NavDisplayGUI"/> + <componentinstantiation id="a_NavDisplayGUI"/> + </homeplacement> + <destination>Remote</destination> + </processcollocation> + </partitioning> + + <connections> + + <connectevent> + <consumesport> + <consumesidentifier>Refresh</consumesidentifier> + <componentinstantiationref idref="a_GPS"/> + </consumesport> + <publishesport> + <publishesidentifier>Pulse</publishesidentifier> + <componentinstantiationref idref="a_RateGen"/> + </publishesport> + </connectevent> + + <connectevent> + <consumesport> + <consumesidentifier>Refresh</consumesidentifier> + <componentinstantiationref idref="a_NavDisplay"/> + </consumesport> + <publishesport> + <publishesidentifier>Ready</publishesidentifier> + <componentinstantiationref idref="a_GPS"/> + </publishesport> + </connectevent> + + <connectinterface> + <usesport> + <usesidentifier>GPSLocation</usesidentifier> + <componentinstantiationref idref="a_NavDisplay"/> + </usesport> + <providesport> + <providesidentifier>MyLocation</providesidentifier> + <componentinstantiationref idref="a_GPS"/> + </providesport> + </connectinterface> + + <connectevent> + <consumesport> + <consumesidentifier>Refresh</consumesidentifier> + <componentinstantiationref idref="a_NavDisplayGUI"/> + </consumesport> + <publishesport> + <publishesidentifier>Ready</publishesidentifier> + <componentinstantiationref idref="a_GPS"/> + </publishesport> + </connectevent> + + <connectinterface> + <usesport> + <usesidentifier>GPSLocation</usesidentifier> + <componentinstantiationref idref="a_NavDisplayGUI"/> + </usesport> + <providesport> + <providesidentifier>MyLocation</providesidentifier> + <componentinstantiationref idref="a_GPS"/> + </providesport> + </connectinterface> + + </connections> + +</componentassembly>
\ No newline at end of file diff --git a/TAO/CIAO/examples/handcrafted/Display/descriptors/HUDisplay.cad b/TAO/CIAO/examples/handcrafted/Display/descriptors/HUDisplay.cad index e9d087d75ba..9410aab95ba 100644 --- a/TAO/CIAO/examples/handcrafted/Display/descriptors/HUDisplay.cad +++ b/TAO/CIAO/examples/handcrafted/Display/descriptors/HUDisplay.cad @@ -21,7 +21,12 @@ <!-- A plain vanilla partition. We don't even need the processcollocation tag here. --> <homeplacement id="a_RateGenHome"> <componentfileref idref="com-RateGen"/> - <componentinstantiation id="a_RateGen"/> + <componentinstantiation id="a_RateGen"> + <registercomponent> + <!-- writeiortofile is a non-standard CIAO extension. --> + <writeiortofile name="rategen.ior"/> + </registercomponent> + </componentinstantiation> </homeplacement> <homeplacement id="a_GPSHome"> diff --git a/TAO/CIAO/examples/handcrafted/Display/descriptors/HUDisplayGUI.cad b/TAO/CIAO/examples/handcrafted/Display/descriptors/HUDisplayGUI.cad new file mode 100644 index 00000000000..a2957ee6fa9 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/descriptors/HUDisplayGUI.cad @@ -0,0 +1,81 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- XML doesn't really support the following $(CIAO_ROOT) syntax :) --> +<!DOCTYPE componentassembly SYSTEM "$(CIAO_ROOT)/docs/XML/componentassembly.dtd"> + +<componentassembly id="Single-process HUDisplay assembly"> + <componentfiles> + <componentfile id="com-RateGen"> + <fileinarchive name="RateGen.csd"/> + </componentfile> + <componentfile id="com-GPS"> + <fileinarchive name="GPS.csd"/> + </componentfile> + <componentfile id="com-NavDisplay"> + <fileinarchive name="NavDisplayGUI.csd"/> + </componentfile> + </componentfiles> + + <partitioning> + + <!-- A plain vanilla partition. We don't even need the processcollocation tag here. --> + <homeplacement id="a_RateGenHome"> + <componentfileref idref="com-RateGen"/> + <componentinstantiation id="a_RateGen"> + <registercomponent> + <!-- writeiortofile is a non-standard CIAO extension. --> + <writeiortofile name="rategen.ior"/> + </registercomponent> + </componentinstantiation> + </homeplacement> + + <homeplacement id="a_GPSHome"> + <componentfileref idref="com-GPS"/> + <componentinstantiation id="a_GPS"/> + </homeplacement> + + <homeplacement id="a_NavDisplayHome"> + <componentfileref idref="com-NavDisplay"/> + <componentinstantiation id="a_NavDisplay"/> + </homeplacement> + + </partitioning> + + <connections> + + <connectevent> + <consumesport> + <consumesidentifier>Refresh</consumesidentifier> + <componentinstantiationref idref="a_GPS"/> + </consumesport> + <publishesport> + <publishesidentifier>Pulse</publishesidentifier> + <componentinstantiationref idref="a_RateGen"/> + </publishesport> + </connectevent> + + <connectevent> + <consumesport> + <consumesidentifier>Refresh</consumesidentifier> + <componentinstantiationref idref="a_NavDisplay"/> + </consumesport> + <publishesport> + <publishesidentifier>Ready</publishesidentifier> + <componentinstantiationref idref="a_GPS"/> + </publishesport> + </connectevent> + + <connectinterface> + <usesport> + <usesidentifier>GPSLocation</usesidentifier> + <componentinstantiationref idref="a_NavDisplay"/> + </usesport> + <providesport> + <providesidentifier>MyLocation</providesidentifier> + <componentinstantiationref idref="a_GPS"/> + </providesport> + </connectinterface> + + </connections> + +</componentassembly>
\ No newline at end of file diff --git a/TAO/CIAO/examples/handcrafted/Display/descriptors/NOTE.txt b/TAO/CIAO/examples/handcrafted/Display/descriptors/NOTE.txt index 719e56a24df..35c307a917a 100644 --- a/TAO/CIAO/examples/handcrafted/Display/descriptors/NOTE.txt +++ b/TAO/CIAO/examples/handcrafted/Display/descriptors/NOTE.txt @@ -1,27 +1,136 @@ -Step1: -====== +This directory contains various XML descriptors and configuration +files required to compose the HUDisplay application in a variety of +different ways. Let's go over a few important files first: -W:\ACE_wrappers\TAO\CIAO\tools\Daemon\CIAO_Daemon -ORBEndpoint iiop://localhost:10000 -n ../../../../tools/ComponentServer/ComponentServer +test.dat: +--------- + This file describes the deployment daemons CIAO's Assembly_Manager + will contact to instantiate ComponentServer's, home's, and component + instances. Each line specify the name of a installation + "destination" (I used this to specify <processcollocation> + destination in various *.cad files) and the corresponding IOR for + the CIAO_Daemon. The first entry is the "default" destination the + deployment framework will use. -CIAO-Daemon IOR: corbaloc:iiop:1.2@localhost:10000/\14\01\0f\00RST]L\8e>\ae\cb\0 -c\00\00\00\00\00\01\00\00\00\01\00\00\00 -CIAO_Daemon is running... -CIAO::ServerActivator_Impl::create_component_server -ComponentServer IOR: IOR:010000003600000049444c3a6f6d672e6f72672f436f6d706f6e656 -e74732f4465706c6f796d656e742f436f6d706f6e656e745365727665723a312e300000000100000 -00000000060000000010102cd050000004349414f00cdc2051b00000014010f00525354644c8e3ec -b070100000000000100000001000000cd02000000000000000800000001cdcdcd004f41540100000 -01400000001cdcdcd01000100000000000901010000000000 -Running ComponentServer... + For example, test.dat now contains: + Default corbaloc:iiop:localhost:10000/ServerActivator + Remote corbaloc:iiop:localhost:12000/ServerActivator -Step2: -====== + You can copy and modify the copy to deploy the components in various + different locations to let the application truely "distributed". + For example, changing the remote ServerActivator to: + corbaloc:iiop:deuce.doc.wustl.edu:13000/ServerActivator -W:\ACE_wrappers\TAO\CIAO\tools\Assembly_Deployer\Assembly_Manager -o ior -c test.dat + Remember to start up the Assembly_Manager in Step 2 using the + revised "test.dat" you created, and start up the CIAO_Daemon's in + Step 1 according to the specification. -Step3: -====== +*.cad: +------ -W:\ACE_wrappers\TAO\CIAO\tools\Assembly_Deployer\Assembly_Deployer -k file://ior -a HUDisplay.cad
\ No newline at end of file + These files specify how an application should be composed. The + specification includes, where to install a component, what + implementation to use, and how to connect components together. + Currently, we have: + + HUDisplay.cad: Plain vanilla assembly descriptor. This file install + all components using the "Default" (the first daemon) + in 'test.dat. You can see the application output + from the default daemon shell. + + HUDisplayGUI.cad: Same as HUDisplay.cad, but instead of a text-based + NavDisplay component, this descriptor instantiate + a GUI NavDisplay window. + + RemoteDisplay.cad: This descriptor causes the NavDisplay component + to be instantiated in the "Remote" daemon. + + RemoteDisplayGUI.cad: Similar to RemoteDisplay.cad but uses a + GUI-based NavDisplay component. + + DuelDisplay.cad: A combination of HUDisplay.cad and + RemoteDisplayGUI.cad. This example uses 4 + components (two display components) and hooks them + up together. I think this is really cool. + +Unfortunately, there's no run_test.pl for starting and running these +example configurations/assemblies as these daemons/managers programs +are still under development. You will need several shell windows for +them. All the following step should be run from this subdirectory +($CIAO_ROOT/examples/handcrafted/Displaydescriptors/). Here are the +steps to demonstrate the examples: + +Step 1: +======= + + You need to start up all the CIAO_Daemon's as specified in the + deployment configuration file 'test.dat' (Notice the endpoint + specification.) I recommend running each CIAO_Daemon in its own + shell window so you can tell where a component in the example + application is running. Here are some hints on how to start the + daemons: + + $(CIAO_ROOT)/tools/Daemon/CIAO_Daemon -ORBEndpoint iiop://localhost:10000 -n ../../../../tools/ComponentServer/ComponentServer + + $(CIAO_ROOT)/tools/Daemon/CIAO_Daemon -ORBEndpoint iiop://localhost:12000 -n ../../../../tools/ComponentServer/ComponentServer + +Step 2: +======= + + Next, you will need to start up the Assembly_Manager which actually + does the assembly work. This should also be started in a separate + shell window. + + $(CIAO_ROOT/CIAO/tools/Assembly_Deployer/Assembly_Manager -o ior -c test.dat + +Step 3: +======= + + You then need to instruct the Assembly_Manager to deploy a specific + compoennt assembly descriptor. For example: + + $(CIAO_ROOT)/tools/Assembly_Deployer/Assembly_Deployer -k file://ior -a HUDisplay.cad + + Replace "HUDisplay.cad" with other '.cad' files as you like. + +Step 4: +======= + + All the .cad files instruct the Assembly_Manager to write the IOR of + the RateGen component to a file called "rategen.ior" in this + directory. You will then need to use a controller program in a + separate shell window to start up the Rate Generator. Start the + controller with: + + ../RateGen/controller + + See its source to check what options are available to start up the + controller. (Hints: you can control the rate (hertz) of the Rate + Generator component.) + + Once the controller is running, check out the Daemon window (for + text-based NavDisplay component) or the GUI window for the output. + Once you are happy with it, press <entry> in this shell window to + terminate the controller program and you will stop the RateGen + component from sending out more event. + + Repeat this step again to instruct the RateGen component to start + generating events. + +Step 5: +======= + + Once you are done with the test. Press <enter> in the shell window + running Assembly_Deployer that you started in Step 3. This will + tear_down the application, kill all ComponentServer's, and terminate + both the Assembly_Deployer and Assembly_Manager process. + + Repeat Step 2-5 using different configurations and assembly + descriptors. + +Step 6: +======= + + Terminate CIAO_Daemon (either using ^C or DaemonController.) diff --git a/TAO/CIAO/examples/handcrafted/Display/descriptors/RemoteDisplay.cad b/TAO/CIAO/examples/handcrafted/Display/descriptors/RemoteDisplay.cad new file mode 100644 index 00000000000..42fe7c9c83e --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/descriptors/RemoteDisplay.cad @@ -0,0 +1,83 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- XML doesn't really support the following $(CIAO_ROOT) syntax :) --> +<!DOCTYPE componentassembly SYSTEM "$(CIAO_ROOT)/docs/XML/componentassembly.dtd"> + +<componentassembly id="Single-process HUDisplay assembly"> + <componentfiles> + <componentfile id="com-RateGen"> + <fileinarchive name="RateGen.csd"/> + </componentfile> + <componentfile id="com-GPS"> + <fileinarchive name="GPS.csd"/> + </componentfile> + <componentfile id="com-NavDisplay"> + <fileinarchive name="NavDisplay.csd"/> + </componentfile> + </componentfiles> + + <partitioning> + + <!-- A plain vanilla partition. We don't even need the processcollocation tag here. --> + <homeplacement id="a_RateGenHome"> + <componentfileref idref="com-RateGen"/> + <componentinstantiation id="a_RateGen"> + <registercomponent> + <!-- writeiortofile is a non-standard CIAO extension. --> + <writeiortofile name="rategen.ior"/> + </registercomponent> + </componentinstantiation> + </homeplacement> + + <homeplacement id="a_GPSHome"> + <componentfileref idref="com-GPS"/> + <componentinstantiation id="a_GPS"/> + </homeplacement> + + <processcollocation> + <homeplacement id="a_NavDisplayHome"> + <componentfileref idref="com-NavDisplay"/> + <componentinstantiation id="a_NavDisplay"/> + </homeplacement> + <destination>Remote</destination> + </processcollocation> + </partitioning> + + <connections> + + <connectevent> + <consumesport> + <consumesidentifier>Refresh</consumesidentifier> + <componentinstantiationref idref="a_GPS"/> + </consumesport> + <publishesport> + <publishesidentifier>Pulse</publishesidentifier> + <componentinstantiationref idref="a_RateGen"/> + </publishesport> + </connectevent> + + <connectevent> + <consumesport> + <consumesidentifier>Refresh</consumesidentifier> + <componentinstantiationref idref="a_NavDisplay"/> + </consumesport> + <publishesport> + <publishesidentifier>Ready</publishesidentifier> + <componentinstantiationref idref="a_GPS"/> + </publishesport> + </connectevent> + + <connectinterface> + <usesport> + <usesidentifier>GPSLocation</usesidentifier> + <componentinstantiationref idref="a_NavDisplay"/> + </usesport> + <providesport> + <providesidentifier>MyLocation</providesidentifier> + <componentinstantiationref idref="a_GPS"/> + </providesport> + </connectinterface> + + </connections> + +</componentassembly>
\ No newline at end of file diff --git a/TAO/CIAO/examples/handcrafted/Display/descriptors/RemoteDisplayGUI.cad b/TAO/CIAO/examples/handcrafted/Display/descriptors/RemoteDisplayGUI.cad new file mode 100644 index 00000000000..aa0dd580038 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/descriptors/RemoteDisplayGUI.cad @@ -0,0 +1,83 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- XML doesn't really support the following $(CIAO_ROOT) syntax :) --> +<!DOCTYPE componentassembly SYSTEM "$(CIAO_ROOT)/docs/XML/componentassembly.dtd"> + +<componentassembly id="Single-process HUDisplay assembly"> + <componentfiles> + <componentfile id="com-RateGen"> + <fileinarchive name="RateGen.csd"/> + </componentfile> + <componentfile id="com-GPS"> + <fileinarchive name="GPS.csd"/> + </componentfile> + <componentfile id="com-NavDisplay"> + <fileinarchive name="NavDisplayGUI.csd"/> + </componentfile> + </componentfiles> + + <partitioning> + + <!-- A plain vanilla partition. We don't even need the processcollocation tag here. --> + <homeplacement id="a_RateGenHome"> + <componentfileref idref="com-RateGen"/> + <componentinstantiation id="a_RateGen"> + <registercomponent> + <!-- writeiortofile is a non-standard CIAO extension. --> + <writeiortofile name="rategen.ior"/> + </registercomponent> + </componentinstantiation> + </homeplacement> + + <homeplacement id="a_GPSHome"> + <componentfileref idref="com-GPS"/> + <componentinstantiation id="a_GPS"/> + </homeplacement> + + <processcollocation> + <homeplacement id="a_NavDisplayHome"> + <componentfileref idref="com-NavDisplay"/> + <componentinstantiation id="a_NavDisplay"/> + </homeplacement> + <destination>Remote</destination> + </processcollocation> + </partitioning> + + <connections> + + <connectevent> + <consumesport> + <consumesidentifier>Refresh</consumesidentifier> + <componentinstantiationref idref="a_GPS"/> + </consumesport> + <publishesport> + <publishesidentifier>Pulse</publishesidentifier> + <componentinstantiationref idref="a_RateGen"/> + </publishesport> + </connectevent> + + <connectevent> + <consumesport> + <consumesidentifier>Refresh</consumesidentifier> + <componentinstantiationref idref="a_NavDisplay"/> + </consumesport> + <publishesport> + <publishesidentifier>Ready</publishesidentifier> + <componentinstantiationref idref="a_GPS"/> + </publishesport> + </connectevent> + + <connectinterface> + <usesport> + <usesidentifier>GPSLocation</usesidentifier> + <componentinstantiationref idref="a_NavDisplay"/> + </usesport> + <providesport> + <providesidentifier>MyLocation</providesidentifier> + <componentinstantiationref idref="a_GPS"/> + </providesport> + </connectinterface> + + </connections> + +</componentassembly>
\ No newline at end of file diff --git a/TAO/CIAO/examples/handcrafted/Display/descriptors/test.dat b/TAO/CIAO/examples/handcrafted/Display/descriptors/test.dat index be142640322..d26b3d4e070 100644 --- a/TAO/CIAO/examples/handcrafted/Display/descriptors/test.dat +++ b/TAO/CIAO/examples/handcrafted/Display/descriptors/test.dat @@ -1 +1,2 @@ Default corbaloc:iiop:localhost:10000/ServerActivator +Remote corbaloc:iiop:localhost:12000/ServerActivator
\ No newline at end of file diff --git a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Deployer.cpp b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Deployer.cpp index 6d16f7cc7c0..22ccd028f6c 100644 --- a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Deployer.cpp +++ b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Deployer.cpp @@ -1,6 +1,7 @@ // $Id$ #include "CCM_DeploymentC.h" +#include "Assembly_ServiceC.h" #include "Client_init.h" #include "ace/Get_Opt.h" @@ -62,9 +63,13 @@ main (int argc, char *argv[]) orb->string_to_object(ior ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; + CIAO::Assembly_Service_var as_svc + = CIAO::Assembly_Service::_narrow (tmp.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + ::Components::Deployment::AssemblyFactory_var factory = - ::Components::Deployment::AssemblyFactory::_narrow(tmp.in () - ACE_ENV_ARG_PARAMETER); + as_svc->get_assemblyfactory (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; if (CORBA::is_nil (factory.in ())) @@ -102,6 +107,9 @@ main (int argc, char *argv[]) ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; + as_svc->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; } diff --git a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Deployer.mpc b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Deployer.mpc index 3bea7c9d71e..82dd8f68436 100644 --- a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Deployer.mpc +++ b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Deployer.mpc @@ -13,11 +13,15 @@ project(Assembly_Manager): ciao_server, acexml { ../XML_Helpers/Cascadable_DocHandler.cpp ../XML_Helpers/Assembly_Spec.cpp ../XML_Helpers/Assembly_Handlers.cpp + Assembly_Service_Impl.cpp + Assembly_ServiceC.cpp + Assembly_ServiceS.cpp } } project(Assembly_Deployer) : ciao_server { Source_Files { Assembly_Deployer.cpp + Assembly_ServiceC.cpp } }
\ No newline at end of file diff --git a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Impl.cpp b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Impl.cpp index 08a350cd3d2..9a8bb8057ed 100644 --- a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Impl.cpp +++ b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Impl.cpp @@ -80,6 +80,7 @@ CIAO::AssemblyFactory_Impl::create_assembly (const char * assembly_loc key); ::Components::Cookie_var retv = new CIAO::Map_Key_Cookie (key); + return retv._retn (); } @@ -140,8 +141,6 @@ CIAO::AssemblyFactory_Impl::destroy (Components::Cookie * c this->poa_->deactivate_object (oid ACE_ENV_ARG_PARAMETER); - - this->orb_->shutdown (0); } @@ -179,7 +178,8 @@ CIAO::Assembly_Impl::init (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) void CIAO::Assembly_Impl::build (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)) { ACE_DEBUG ((LM_DEBUG, "CIAO::Assembly_Impl::build %d\n", @@ -189,15 +189,34 @@ CIAO::Assembly_Impl::build (ACE_ENV_SINGLE_ARG_DECL) ACE_DEBUG ((LM_DEBUG, "------------------------------------\n")); + // Installing homes and instantiating components + CIAO::Assembly_Builder_Visitor builder (this->orb_.in (), this->assembly_context_, this->assembly_spec_->componentfiles_, this->deployment_config_); - int build_result = this->assembly_spec_->partitioning_.accept (builder); + int build_result = this->assembly_spec_->partitioning_.accept (builder + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; ACE_DEBUG ((LM_DEBUG, "------------------------------------\n")); - // @@ Connect components. + // Setting connections + + CIAO::Assembly_Spec::CONNECTION_QUEUE::ITERATOR + conn_iter (this->assembly_spec_->connections_); + + while (!conn_iter.done ()) + { + CIAO::Assembly_Connection::Connect_Info *connection; + conn_iter.next (connection); + + this->make_connection (connection + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + conn_iter.advance (); + } this->state_ = ::Components::Deployment::INSERVICE; } @@ -207,9 +226,6 @@ CIAO::Assembly_Impl::tear_down (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, Components::RemoveFailure)) { - ACE_DEBUG ((LM_DEBUG, - "CIAO::Assembly_Impl::tear_down %d\n", - this->serial_number_)); if (this->state_ != Components::Deployment::INSERVICE) return; // Nothing to do here. @@ -248,6 +264,9 @@ CIAO::Assembly_Impl::tear_down (ACE_ENV_SINGLE_ARG_DECL) } } + ACE_DEBUG ((LM_DEBUG, + "CIAO::Assembly_Impl::tear_down %d\n", + this->serial_number_)); this->state_ = ::Components::Deployment::INACTIVE; } @@ -261,6 +280,222 @@ CIAO::Assembly_Impl::get_state (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) return this->state_; } +void +CIAO::Assembly_Impl::make_connection (CIAO::Assembly_Connection::Connect_Info *info + ACE_ENV_ARG_DECL) +{ + switch (info->type_) + { + case CIAO::Assembly_Connection::INTERFACE: + { + CORBA::Object_var source + = this->resolve_interface (info->interface_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + Components::CCMObject_var comp + = this->resolve_component (info->component_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + comp->connect (info->name_.c_str (), + source.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + // @@ Register the connection? How? + } + break; + + case CIAO::Assembly_Connection::EMITTER_CONSUMER: + { + Components::EventConsumerBase_var source + = this->resolve_consumer (info->interface_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + Components::CCMObject_var comp + = this->resolve_component (info->component_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + comp->connect_consumer (info->name_.c_str (), + source.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + break; + + case CIAO::Assembly_Connection::PUBLISHER_CONSUMER: + { + Components::EventConsumerBase_var source + = this->resolve_consumer (info->interface_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + Components::CCMObject_var comp + = this->resolve_component (info->component_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + comp->subscribe (info->name_.c_str (), + source.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + break; + + case CIAO::Assembly_Connection::HOME: + ACE_THROW (CORBA::NO_IMPLEMENT ()); + + default: + ACE_THROW (CORBA::INTERNAL ()); + } +} + +CORBA::Object_ptr +CIAO::Assembly_Impl::resolve_interface (CIAO::Assembly_Connection::IF_Resolver_Info *info + ACE_ENV_ARG_DECL_WITH_DEFAULTS) +{ + switch (info->resolver_type ()) + { + case CIAO::Assembly_Connection::PROVIDER: + { + Components::CCMObject_var comp = + this->resolve_component (info->nested_resolver () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return comp->provide_facet (info->resolver_info () + ACE_ENV_ARG_PARAMETER); + } + + case CIAO::Assembly_Connection::CONSUMER: + return this->resolve_consumer (info + ACE_ENV_ARG_PARAMETER); + + case CIAO::Assembly_Connection::COMP_IDREF: + return this->resolve_component (info + ACE_ENV_ARG_PARAMETER); + + case CIAO::Assembly_Connection::HOME_IDREF: + return this->resolve_home (info + ACE_ENV_ARG_PARAMETER); + + case CIAO::Assembly_Connection::NAMINGSERVICE: + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); + + case CIAO::Assembly_Connection::STRINGIFIEDOBJECTREF: + return this->orb_->string_to_object (info->resolver_info () + ACE_ENV_ARG_PARAMETER); + + case CIAO::Assembly_Connection::HOMEFINDER: + return this->resolve_home (info + ACE_ENV_ARG_PARAMETER); + + case CIAO::Assembly_Connection::TRADERQUERY: + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); + + default: + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); + } +} + +Components::CCMObject_ptr +CIAO::Assembly_Impl::resolve_component (CIAO::Assembly_Connection::IF_Resolver_Info *info + ACE_ENV_ARG_DECL_WITH_DEFAULTS) +{ + if (info->resolver_type () == CIAO::Assembly_Connection::COMP_IDREF) + { + CIAO::Assembly_Context::COMP_MAP::ENTRY *entry; + + if (this->assembly_context_.instantiated_components_.find (info->resolver_info (), + entry) != 0) + // This isn't really a good exception to throw unless we can + // specify FailureReason somehow. + ACE_THROW_RETURN (Components::CreateFailure (), 0); + + return Components::CCMObject::_duplicate (entry->int_id_.in ()); + } + + CORBA::Object_var obj = this->resolve_interface (info + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + Components::CCMObject_var comp + = Components::CCMObject::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return comp._retn (); +} + +Components::CCMHome_ptr +CIAO::Assembly_Impl::resolve_home (CIAO::Assembly_Connection::IF_Resolver_Info *info + ACE_ENV_ARG_DECL_WITH_DEFAULTS) +{ + switch (info->resolver_type ()) + { + case CIAO::Assembly_Connection::HOME_IDREF: + { + CIAO::Assembly_Context::HOME_MAP::ENTRY *entry; + + if (this->assembly_context_.installed_homes_.find (info->resolver_info (), + entry) != 0) + // This isn't really a good exception to throw unless we can + // specify FailureReason somehow. + ACE_THROW_RETURN (Components::CreateFailure (), 0); + + return Components::CCMHome::_duplicate (entry->int_id_.in ()); + } + + case CIAO::Assembly_Connection::HOMEFINDER: + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); + + default: + { + CORBA::Object_var obj = this->resolve_interface (info + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + Components::CCMHome_var home + = Components::CCMHome::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return home._retn (); + } + } + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); +} + +Components::EventConsumerBase_ptr +CIAO::Assembly_Impl::resolve_consumer (CIAO::Assembly_Connection::IF_Resolver_Info *info + ACE_ENV_ARG_DECL_WITH_DEFAULTS) +{ + if (info->resolver_type () == CIAO::Assembly_Connection::CONSUMER) + { + Components::CCMObject_var comp = + this->resolve_component (info->nested_resolver () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return comp->get_consumer (info->resolver_info () + ACE_ENV_ARG_PARAMETER); + } + + CORBA::Object_var obj = this->resolve_interface (info + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + Components::EventConsumerBase_var consumer + = Components::EventConsumerBase::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return consumer._retn (); +} + #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) || \ defined (ACE_HAS_GNU_REPO) template class ACE_Active_Map_Manager<::Components::Deployment::Assembly_var>; diff --git a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Impl.h b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Impl.h index 007482b094d..043163ef879 100644 --- a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Impl.h +++ b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Impl.h @@ -136,7 +136,8 @@ namespace CIAO /// Components::Deployment::Assembly defined attributes/operations. virtual void build (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)); virtual void tear_down (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException, @@ -147,6 +148,26 @@ namespace CIAO ACE_THROW_SPEC ((CORBA::SystemException)); protected: + /** + * Connection establishment helper functions + */ + /// @{ + void make_connection (Assembly_Connection::Connect_Info *info + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + CORBA::Object_ptr + resolve_interface (Assembly_Connection::IF_Resolver_Info *info + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + Components::CCMObject_ptr + resolve_component (Assembly_Connection::IF_Resolver_Info *info + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + Components::CCMHome_ptr + resolve_home (Assembly_Connection::IF_Resolver_Info *info + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + Components::EventConsumerBase_ptr + resolve_consumer (Assembly_Connection::IF_Resolver_Info *info + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + /// @} + /// Keep a pointer to the managing ORB serving this servant. CORBA::ORB_var orb_; diff --git a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Manager.cpp b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Manager.cpp index 7a7db70f26d..6c9663ac3a5 100644 --- a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Manager.cpp +++ b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Manager.cpp @@ -8,6 +8,7 @@ */ #include "Assembly_Impl.h" +#include "Assembly_Service_Impl.h" #include "CIAO_ServersC.h" #include "Server_init.h" #include "tao/IORTable/IORTable.h" @@ -138,7 +139,7 @@ main (int argc, char *argv[]) ACE_TRY_CHECK; if (CORBA::is_nil (assembly_factory_obj.in ())) - ACE_ERROR_RETURN ((LM_ERROR, "Unable to activate ComponentServer object\n"), -1); + ACE_ERROR_RETURN ((LM_ERROR, "Unable to activate AssemblyFactory object\n"), -1); CORBA::String_var str = orb->object_to_string (assembly_factory_obj.in () @@ -163,6 +164,37 @@ main (int argc, char *argv[]) ACE_TRY_CHECK; } + // Now create the assembly service object + CIAO::Assembly_Service_Impl *service_servant; + ACE_NEW_RETURN (service_servant, + CIAO::Assembly_Service_Impl (orb.in (), + poa.in (), + assembly_factory_obj.in ()), + -1); + + safe_servant = service_servant; + + PortableServer::ObjectId_var as_oid + = poa->activate_object (service_servant + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + obj = poa->id_to_reference (as_oid + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CIAO::Assembly_Service_var service_obj = + CIAO::Assembly_Service::_narrow (obj + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (service_obj.in ())) + ACE_ERROR_RETURN ((LM_ERROR, "Unable to activate Assembly_Service object\n"), -1); + + + str = orb->object_to_string (service_obj.in () + ACE_ENV_ARG_PARAMETER); + write_IOR (str.in ()); ACE_DEBUG ((LM_INFO, "Assembly_Manager IOR: %s\n", str.in ())); diff --git a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Service.idl b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Service.idl new file mode 100644 index 00000000000..c471e67c83e --- /dev/null +++ b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Service.idl @@ -0,0 +1,15 @@ +// $Id$ + +#include "CCM_Deployment.idl" + +module CIAO +{ + + interface Assembly_Service + { + Components::Deployment::AssemblyFactory get_assemblyfactory (); + + oneway void shutdown (); + }; + +}; diff --git a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Service_Impl.cpp b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Service_Impl.cpp new file mode 100644 index 00000000000..cd0e50a2551 --- /dev/null +++ b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Service_Impl.cpp @@ -0,0 +1,36 @@ +// $Id$ + +#include "Assembly_Service_Impl.h" + +CIAO::Assembly_Service_Impl::Assembly_Service_Impl (CORBA::ORB_ptr o, + PortableServer::POA_ptr p, + Components::Deployment::AssemblyFactory_ptr f) + : orb_ (CORBA::ORB::_duplicate (o)), + poa_ (PortableServer::POA::_duplicate (p)), + factory_ (Components::Deployment::AssemblyFactory::_duplicate (f)) +{ +} + +CIAO::Assembly_Service_Impl::~Assembly_Service_Impl (void) +{ +} + +PortableServer::POA_ptr +CIAO::Assembly_Service_Impl::_default_POA (void) +{ + return PortableServer::POA::_duplicate (this->poa_.in ()); +} + +Components::Deployment::AssemblyFactory_ptr +CIAO::Assembly_Service_Impl::get_assemblyfactory (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return Components::Deployment::AssemblyFactory::_duplicate (this->factory_.in ()); +} + +void +CIAO::Assembly_Service_Impl::shutdown (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->orb_->shutdown (); +} diff --git a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Service_Impl.h b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Service_Impl.h new file mode 100644 index 00000000000..9d66d072c8c --- /dev/null +++ b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Service_Impl.h @@ -0,0 +1,67 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Assembly_Service_Impl.h + * + * $Id$ + * + * This file contains implementations for + * Components::Deployment::AssemblyFactory and + * Components::Deployment::Assembly interface. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= + + +#ifndef CIAO_ASSEMBLY_SERVICE_IMPL_H +#define CIAO_ASSEMBLY_SERVICE_IMPL_H +#include "ace/pre.h" + +#include "Assembly_ServiceS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace CIAO +{ + class Assembly_Service_Impl + : public virtual POA_CIAO::Assembly_Service, + public virtual PortableServer::RefCountServantBase + { + public: + /// Constructor + Assembly_Service_Impl (CORBA::ORB_ptr o, + PortableServer::POA_ptr p, + Components::Deployment::AssemblyFactory_ptr f); + + /// Destructor + virtual ~Assembly_Service_Impl (void); + + /// Get the containing POA. This operation does *not* + /// increase the reference count of the POA. + virtual PortableServer::POA_ptr _default_POA (void); + + virtual ::Components::Deployment::AssemblyFactory_ptr + get_assemblyfactory (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + /// Keep a pointer to the managing ORB serving this servant. + CORBA::ORB_var orb_; + + /// Keep a pointer to the managing POA. + PortableServer::POA_var poa_; + + /// Cached AssemblyFactory reference. + Components::Deployment::AssemblyFactory_var factory_; + }; +} + +#include "ace/post.h" +#endif /* CIAO_ASSEMBLY_IMPL_H */ diff --git a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.h b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.h index add69e46c09..6a9c57d4492 100644 --- a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.h +++ b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.h @@ -74,20 +74,30 @@ namespace CIAO /// Destructor virtual ~Assembly_Builder_Visitor (void); - virtual int visit_Container (Assembly_Placement::Container *c); + virtual int visit_Container (Assembly_Placement::Container *c + ACE_ENV_ARG_DECL_WITH_DEFAULTS); - virtual int visit_hostcollocation (Assembly_Placement::hostcollocation *hc); + virtual int visit_hostcollocation (Assembly_Placement::hostcollocation *hc + ACE_ENV_ARG_DECL_WITH_DEFAULTS); - virtual int visit_processcollocation (Assembly_Placement::processcollocation *pc); + virtual int visit_processcollocation (Assembly_Placement::processcollocation *pc + ACE_ENV_ARG_DECL_WITH_DEFAULTS); - virtual int visit_homeplacement (Assembly_Placement::homeplacement *hp); + virtual int visit_homeplacement (Assembly_Placement::homeplacement *hp + ACE_ENV_ARG_DECL_WITH_DEFAULTS); - virtual int visit_componentinstantiation (Assembly_Placement::componentinstantiation *ci); + virtual int visit_componentinstantiation (Assembly_Placement::componentinstantiation *ci + ACE_ENV_ARG_DECL_WITH_DEFAULTS); Components::Deployment::Container_ptr get_current_container (void); protected: + /// Registering a component using the info specified in @c i . + void register_component (Assembly_Placement::componentinstantiation::Register_Info *i, + Components::CCMObject_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + /// Current Component Server. Components::Deployment::ComponentServer_var compserv_; @@ -99,8 +109,9 @@ namespace CIAO /// container.) Components::Deployment::Container_var container_; - /// Current Component Home. - Components::CCMHome_var home_; + /// Current Component Home. We only support keyless home + /// operations for now. + Components::KeylessCCMHome_var home_; /// Keep a pointer to the managing ORB serving this servant. CORBA::ORB_var orb_; diff --git a/TAO/CIAO/tools/XML_Helpers/Assembly_Handlers.cpp b/TAO/CIAO/tools/XML_Helpers/Assembly_Handlers.cpp index 84defecf0ec..f64679e59c6 100644 --- a/TAO/CIAO/tools/XML_Helpers/Assembly_Handlers.cpp +++ b/TAO/CIAO/tools/XML_Helpers/Assembly_Handlers.cpp @@ -508,7 +508,8 @@ CIAO::Partitioning_Handler::startElement (const ACEXML_Char *namespaceURI, ACEXML_THROW (ACEXML_SAXException (ACE_TEXT ("\"extension\" is not yet supported."))); } - else if (ACE_OS::strcmp (qName, "partitioning") == 0) + else if (ACE_OS::strcmp (qName, "partitioning") == 0 || + ACE_OS::strcmp (qName, "destination") == 0) { // do nothing } @@ -603,13 +604,10 @@ CIAO::Partitioning_Handler::startElement (const ACEXML_Char *namespaceURI, break; - - break; - default: ACEXML_THROW (ACEXML_SAXException - ("Invalid tag encounter while parsing \"partitioning\"")); + ("Invalid state encounter while parsing \"partitioning\"")); } } @@ -649,10 +647,10 @@ CIAO::Connections_Handler::endElement (const ACEXML_Char *namespaceURI, if (ACE_OS::strcmp (qName, "stringifiedobjectref") == 0) { ACEXML_NEW_THROW_EX (this->resolver_, - CIAO::Assembly_Connection::IF_Resolver_Info - (CIAO::Assembly_Connection::STRINGIFIEDOBJECTREF, - this->characters_.c_str ()), - ACEXML_SAXException ("No memory left")); + CIAO::Assembly_Connection::IF_Resolver_Info + (CIAO::Assembly_Connection::STRINGIFIEDOBJECTREF, + this->characters_.c_str ()), + ACEXML_SAXException ("No memory left")); ACEXML_CHECK; return; } @@ -660,42 +658,49 @@ CIAO::Connections_Handler::endElement (const ACEXML_Char *namespaceURI, switch (this->state_) { case START: - if (ACE_OS::strcmp (qName, "consumesidentifier") == 0 || - ACE_OS::strcmp (qName, "usesidentifier") == 0) + if (ACE_OS::strcmp (qName, "usesidentifier") == 0 || + ACE_OS::strcmp (qName, "emitsidentifier") == 0 || + ACE_OS::strcmp (qName, "publishesidentifier") == 0) { - this->info_->name_ = this->characters_.c_str (); + this->info_.name_ = this->characters_.c_str (); } - if (ACE_OS::strcmp (qName, "consumesport") == 0 || - ACE_OS::strcmp (qName, "usesport") == 0 || - ACE_OS::strcmp (qName, "proxyhome") == 0) + else if (ACE_OS::strcmp (qName, "usesport") == 0 || + ACE_OS::strcmp (qName, "proxyhome") == 0) { if (this->resolver_ == 0) ACEXML_THROW (ACEXML_SAXException ("No valide IF resolver available")); - this->info_->component_ = this->resolver_; + this->info_.component_ = this->resolver_; this->resolver_ = 0; this->state_ = SOURCE; } + else if (ACE_OS::strcmp (qName, "emitsport") == 0 || + ACE_OS::strcmp (qName, "publishesport") == 0) + { + if (this->resolver_ == 0) + ACEXML_THROW (ACEXML_SAXException + ("No valide nested IF resolver available")); + this->info_.component_ = this->resolver_; + this->resolver_ = 0; + } + else if (ACE_OS::strcmp (qName, "connectevent") == 0) + this->context_->connections_.enqueue_tail (this->info_); else if (ACE_OS::strcmp (qName, "extension") == 0) { // @@ Not supported yet. } break; + case SOURCE: - if (ACE_OS::strcmp (qName, "destinationhome") == 0) + if (ACE_OS::strcmp (qName, "destinationhome") == 0 || + ACE_OS::strcmp (qName, "existinginterface") == 0) { if (this->resolver_ == 0) ACEXML_THROW (ACEXML_SAXException ("No valide IF resolver available")); - this->info_->interface_ = this->resolver_; + this->info_.interface_ = this->resolver_; this->resolver_ = 0; } - else if (ACE_OS::strcmp (qName, "providesidentifier") == 0 || - ACE_OS::strcmp (qName, "emitsidentifier") == 0 || - ACE_OS::strcmp (qName, "publishesidentifier") == 0) - { - this->resolver_info_ = this->characters_.c_str (); - } - else if (ACE_OS::strcmp (qName, "providesport") == 0) + else if (ACE_OS::strcmp (qName, "consumesport") == 0) { if (this->resolver_ == 0) ACEXML_THROW (ACEXML_SAXException @@ -704,16 +709,21 @@ CIAO::Connections_Handler::endElement (const ACEXML_Char *namespaceURI, ACEXML_NEW_THROW_EX (this->resolver_, CIAO::Assembly_Connection::IF_Resolver_Info - (CIAO::Assembly_Connection::PROVIDER, + (CIAO::Assembly_Connection::CONSUMER, this->resolver_info_.c_str (), nested), ACEXML_SAXException ("No memory left")); ACEXML_CHECK; - this->info_->interface_ = this->resolver_; + this->info_.interface_ = this->resolver_; this->resolver_ = 0; + this->state_ = START; } - else if (ACE_OS::strcmp (qName, "emitsport") == 0 || - ACE_OS::strcmp (qName, "publishesport") == 0) + else if (ACE_OS::strcmp (qName, "consumesidentifier") == 0 || + ACE_OS::strcmp (qName, "providesidentifier") == 0) + { + this->resolver_info_ = this->characters_.c_str (); + } + else if (ACE_OS::strcmp (qName, "providesport") == 0) { if (this->resolver_ == 0) ACEXML_THROW (ACEXML_SAXException @@ -722,20 +732,18 @@ CIAO::Connections_Handler::endElement (const ACEXML_Char *namespaceURI, ACEXML_NEW_THROW_EX (this->resolver_, CIAO::Assembly_Connection::IF_Resolver_Info - (CIAO::Assembly_Connection::CONSUMER, + (CIAO::Assembly_Connection::PROVIDER, this->resolver_info_.c_str (), nested), ACEXML_SAXException ("No memory left")); ACEXML_CHECK; - this->info_->interface_ = this->resolver_; + this->info_.interface_ = this->resolver_; this->resolver_ = 0; } else if (ACE_OS::strcmp (qName, "connectinterface") == 0 || - ACE_OS::strcmp (qName, "connectevent") == 0 || ACE_OS::strcmp (qName, "connecthomes") == 0) { this->context_->connections_.enqueue_tail (this->info_); - this->info_ = 0; this->state_ = START; } break; @@ -835,25 +843,33 @@ CIAO::Connections_Handler::startElement (const ACEXML_Char *namespaceURI, case START: if (ACE_OS::strcmp (qName, "connectinterface") == 0) { - this->create_info (atts - ACEXML_ENV_ARG_PARAMETER); + this->reset_info (atts + ACEXML_ENV_ARG_PARAMETER); ACEXML_CHECK; - this->info_->type_ = CIAO::Assembly_Connection::INTERFACE; + this->info_.type_ = CIAO::Assembly_Connection::INTERFACE; } else if (ACE_OS::strcmp (qName, "connectevent") == 0) { - this->create_info (atts - ACEXML_ENV_ARG_PARAMETER); + this->reset_info (atts + ACEXML_ENV_ARG_PARAMETER); ACEXML_CHECK; - + this->state_ = SOURCE; } else if (ACE_OS::strcmp (qName, "connecthomes") == 0) { - this->create_info (atts - ACEXML_ENV_ARG_PARAMETER); + this->reset_info (atts + ACEXML_ENV_ARG_PARAMETER); ACEXML_CHECK; - this->info_->type_ = CIAO::Assembly_Connection::HOME; + this->info_.type_ = CIAO::Assembly_Connection::HOME; + } + else if (ACE_OS::strcmp (qName, "emitsport") == 0) + { + this->info_.type_ = CIAO::Assembly_Connection::EMITTER_CONSUMER; + } + else if (ACE_OS::strcmp (qName, "publishesport") == 0) + { + this->info_.type_ = CIAO::Assembly_Connection::PUBLISHER_CONSUMER; } else if (ACE_OS::strcmp (qName, "extension") == 0) { @@ -862,14 +878,6 @@ CIAO::Connections_Handler::startElement (const ACEXML_Char *namespaceURI, break; case SOURCE: - if (ACE_OS::strcmp (qName, "emitsport") == 0) - { - this->info_->type_ = CIAO::Assembly_Connection::EMITTER_CONSUMER; - } - else if (ACE_OS::strcmp (qName, "publishesport") == 0) - { - this->info_->type_ = CIAO::Assembly_Connection::PUBLISHER_CONSUMER; - } break; default: @@ -881,22 +889,24 @@ CIAO::Connections_Handler::startElement (const ACEXML_Char *namespaceURI, } void -CIAO::Connections_Handler::create_info (ACEXML_Attributes *atts - ACEXML_ENV_ARG_DECL) +CIAO::Connections_Handler::reset_info (ACEXML_Attributes *atts + ACEXML_ENV_ARG_DECL) ACE_THROW_SPEC ((ACEXML_SAXException)) { - ACEXML_NEW_THROW_EX (this->info_, - CIAO::Assembly_Connection::Connect_Info (), - ACEXML_SAXException - ("Internal error, no memory.")); - ACEXML_CHECK; + this->info_.type_ = CIAO::Assembly_Connection::INVALID_CONN; + this->info_.id_.clear (); + this->info_.name_.clear (); + + // @@ Potential memory leaks below. Need to ensure the allocated + // memory is free when the Assembly_Spec is destroyed. + + this->info_.component_ = 0; + this->info_.interface_ = 0; for (size_t i = 0; i < atts->getLength (); ++i) { if (ACE_OS_String::strcmp (atts->getQName (i), ACE_TEXT ("id")) == 0) - { - this->info_->id_ = atts->getValue (i); - } + this->info_.id_ = atts->getValue (i); else ACEXML_THROW (ACEXML_SAXException diff --git a/TAO/CIAO/tools/XML_Helpers/Assembly_Handlers.h b/TAO/CIAO/tools/XML_Helpers/Assembly_Handlers.h index 6016637976a..5c9a25aa1d9 100644 --- a/TAO/CIAO/tools/XML_Helpers/Assembly_Handlers.h +++ b/TAO/CIAO/tools/XML_Helpers/Assembly_Handlers.h @@ -294,8 +294,8 @@ namespace CIAO protected: // Create a new blank Connect_Info. - void create_info (ACEXML_Attributes *atts - ACEXML_ENV_ARG_DECL) + void reset_info (ACEXML_Attributes *atts + ACEXML_ENV_ARG_DECL) ACE_THROW_SPEC ((ACEXML_SAXException)) ; long element_count_; @@ -303,7 +303,7 @@ namespace CIAO Assembly_Spec *context_; // Connection Info currently being built. - Assembly_Connection::Connect_Info *info_; + Assembly_Connection::Connect_Info info_; CH_States state_; diff --git a/TAO/CIAO/tools/XML_Helpers/Assembly_Handlers.inl b/TAO/CIAO/tools/XML_Helpers/Assembly_Handlers.inl index edaa7bc2471..32c53b4af5b 100644 --- a/TAO/CIAO/tools/XML_Helpers/Assembly_Handlers.inl +++ b/TAO/CIAO/tools/XML_Helpers/Assembly_Handlers.inl @@ -107,7 +107,6 @@ CIAO::Connections_Handler::Connections_Handler (Assembly_Spec *spec, ACEXML_ENV_ARG_PARAMETER), element_count_ (0), context_ (spec), - info_ (0), state_ (START) { } diff --git a/TAO/CIAO/tools/XML_Helpers/Assembly_Spec.cpp b/TAO/CIAO/tools/XML_Helpers/Assembly_Spec.cpp index a05bee015a5..b56a81ba7d5 100644 --- a/TAO/CIAO/tools/XML_Helpers/Assembly_Spec.cpp +++ b/TAO/CIAO/tools/XML_Helpers/Assembly_Spec.cpp @@ -11,7 +11,8 @@ int CIAO::Assembly_Placement::Node::accept -(CIAO::Assembly_Placement::Visitor &visitor) +(CIAO::Assembly_Placement::Visitor &visitor + ACE_ENV_ARG_DECL) { // This should have never gotten called. ACE_ASSERT (0); @@ -26,18 +27,22 @@ CIAO::Assembly_Placement::Node::~Node () int CIAO::Assembly_Placement::Container::accept -(CIAO::Assembly_Placement::Visitor &visitor) +(CIAO::Assembly_Placement::Visitor &visitor + ACE_ENV_ARG_DECL) { - return visitor.visit_Container (this); + return visitor.visit_Container (this + ACE_ENV_ARG_PARAMETER); } // ================================================================ int CIAO::Assembly_Placement::componentinstantiation::accept -(CIAO::Assembly_Placement::Visitor &visitor) +(CIAO::Assembly_Placement::Visitor &visitor + ACE_ENV_ARG_DECL) { - return visitor.visit_componentinstantiation (this); + return visitor.visit_componentinstantiation (this + ACE_ENV_ARG_PARAMETER); } CIAO::Assembly_Placement::componentinstantiation::~componentinstantiation () @@ -48,9 +53,11 @@ CIAO::Assembly_Placement::componentinstantiation::~componentinstantiation () int CIAO::Assembly_Placement::homeplacement::accept -(CIAO::Assembly_Placement::Visitor &visitor) +(CIAO::Assembly_Placement::Visitor &visitor + ACE_ENV_ARG_DECL) { - return visitor.visit_homeplacement (this); + return visitor.visit_homeplacement (this + ACE_ENV_ARG_PARAMETER); } CIAO::Assembly_Placement::homeplacement::~homeplacement () @@ -61,9 +68,11 @@ CIAO::Assembly_Placement::homeplacement::~homeplacement () int CIAO::Assembly_Placement::hostcollocation::accept -(CIAO::Assembly_Placement::Visitor &visitor) +(CIAO::Assembly_Placement::Visitor &visitor + ACE_ENV_ARG_DECL) { - return visitor.visit_hostcollocation (this); + return visitor.visit_hostcollocation (this + ACE_ENV_ARG_PARAMETER); } CIAO::Assembly_Placement::hostcollocation::~hostcollocation () @@ -74,9 +83,11 @@ CIAO::Assembly_Placement::hostcollocation::~hostcollocation () int CIAO::Assembly_Placement::processcollocation::accept -(CIAO::Assembly_Placement::Visitor &visitor) +(CIAO::Assembly_Placement::Visitor &visitor + ACE_ENV_ARG_DECL) { - return visitor.visit_processcollocation (this); + return visitor.visit_processcollocation (this + ACE_ENV_ARG_PARAMETER); } CIAO::Assembly_Placement::processcollocation::~processcollocation () diff --git a/TAO/CIAO/tools/XML_Helpers/Assembly_Spec.h b/TAO/CIAO/tools/XML_Helpers/Assembly_Spec.h index 545403cf62d..aadeecdf8d2 100644 --- a/TAO/CIAO/tools/XML_Helpers/Assembly_Spec.h +++ b/TAO/CIAO/tools/XML_Helpers/Assembly_Spec.h @@ -16,6 +16,7 @@ #include "ace/Hash_Map_Manager_T.h" #include "ace/Containers_T.h" #include "ace/SString.h" +#include "ace/CORBA_macros.h" namespace CIAO { @@ -61,7 +62,8 @@ namespace CIAO Node (const char *id = 0); /// Accepting a visitor. - virtual int accept (Visitor &v); + virtual int accept (Visitor &v + ACE_ENV_ARG_DECL_WITH_DEFAULTS); virtual ~Node (); @@ -95,7 +97,8 @@ namespace CIAO unsigned long cardinality); /// Accepting a visitor. - virtual int accept (Visitor &v); + virtual int accept (Visitor &v + ACE_ENV_ARG_DECL_WITH_DEFAULTS); //@{ /** Accesor/mutator for destination information */ @@ -152,11 +155,13 @@ namespace CIAO /// Accepting a visitor. - virtual int accept (Visitor &v); + virtual int accept (Visitor &v + ACE_ENV_ARG_DECL_WITH_DEFAULTS); virtual ~componentinstantiation (); - ACE_Unbounded_Queue <Register_Info> register_info_; + typedef ACE_Unbounded_Queue <Register_Info> REGISTRATION_QUEUE; + REGISTRATION_QUEUE register_info_; protected: }; @@ -186,7 +191,8 @@ namespace CIAO homeplacement (const char *id, unsigned long cardinality = 1); /// Accepting a visitor. - virtual int accept (Visitor &v); + virtual int accept (Visitor &v + ACE_ENV_ARG_DECL_WITH_DEFAULTS); virtual ~homeplacement (); @@ -213,7 +219,8 @@ namespace CIAO unsigned long cardinality = 1); /// Accepting a visitor. - virtual int accept (Visitor &v); + virtual int accept (Visitor &v + ACE_ENV_ARG_DECL_WITH_DEFAULTS); virtual ~hostcollocation (); @@ -230,7 +237,8 @@ namespace CIAO unsigned long cardinality = 1); /// Accepting a visitor. - virtual int accept (Visitor &v); + virtual int accept (Visitor &v + ACE_ENV_ARG_DECL_WITH_DEFAULTS); virtual ~processcollocation (); @@ -249,15 +257,20 @@ namespace CIAO virtual ~Visitor () = 0; - virtual int visit_Container (Container *c) = 0; + virtual int visit_Container (Container *c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) = 0; - virtual int visit_hostcollocation (hostcollocation *hc) = 0; + virtual int visit_hostcollocation (hostcollocation *hc + ACE_ENV_ARG_DECL_WITH_DEFAULTS) = 0; - virtual int visit_processcollocation (processcollocation *pc) = 0; + virtual int visit_processcollocation (processcollocation *pc + ACE_ENV_ARG_DECL_WITH_DEFAULTS) = 0; - virtual int visit_homeplacement (homeplacement *hp) = 0; + virtual int visit_homeplacement (homeplacement *hp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) = 0; - virtual int visit_componentinstantiation (componentinstantiation *ci) = 0; + virtual int visit_componentinstantiation (componentinstantiation *ci + ACE_ENV_ARG_DECL_WITH_DEFAULTS) = 0; protected: }; @@ -365,7 +378,8 @@ namespace CIAO Assembly_Placement::Container partitioning_; /// Connection data - ACE_Unbounded_Queue<Assembly_Connection::Connect_Info*> connections_; + typedef ACE_Unbounded_Queue<Assembly_Connection::Connect_Info> CONNECTION_QUEUE; + CONNECTION_QUEUE connections_; } Assembly_Spec; } |