diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2010-06-20 17:54:16 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2010-06-20 17:54:16 +0000 |
commit | dadad6aa69e6407aee5eaacf96cd9d23a1f4c9b5 (patch) | |
tree | f8b46bf686f380904c293eeb5d618a2bd53a44d5 | |
parent | 578e2ee2fde50b3a7cb17d7250e51d608bb836e7 (diff) | |
download | ATCD-dadad6aa69e6407aee5eaacf96cd9d23a1f4c9b5.tar.gz |
Sun Jun 20 17:48:00 UTC 2010 William R. Otte <wotte@dre.vanderbilt.edu>
* DAnCE/DAnCE/DAnCE_LocalityManager.idl:
* DAnCE/LocalityManager/Handler/LocalityActivator_Impl.cpp:
Layout changes.
* DAnCE/LocalityManager/Daemon/Locality_Manager.mpc:
* DAnCE/LocalityManager/Daemon/Locality_Manager_Impl.h:
* DAnCE/LocalityManager/Daemon/Locality_Manager_Impl.cpp:
Scheduler integration
* DAnCE/LocalityManager/Scheduler/Deployment_Completion.h:
* DAnCE/LocalityManager/Scheduler/Deployment_Completion.cpp:
* DAnCE/LocalityManager/Scheduler/Deployment_Event.h:
* DAnCE/LocalityManager/Scheduler/Deployment_Event.inl:
* DAnCE/LocalityManager/Scheduler/Deployment_Scheduler.h:
* DAnCE/LocalityManager/Scheduler/Events:
* DAnCE/LocalityManager/Scheduler/Events/Configured.h:
* DAnCE/LocalityManager/Scheduler/Events/Configured.cpp:
* DAnCE/LocalityManager/Scheduler/Events/Connect.h:
* DAnCE/LocalityManager/Scheduler/Events/Connect.cpp:
* DAnCE/LocalityManager/Scheduler/Events/Endpoint.h:
* DAnCE/LocalityManager/Scheduler/Events/Endpoint.cpp:
* DAnCE/LocalityManager/Scheduler/Events/Install.h:
* DAnCE/LocalityManager/Scheduler/Events/Install.cpp:
* DAnCE/LocalityManager/Scheduler/Events/Passivate.h:
* DAnCE/LocalityManager/Scheduler/Events/Passivate.cpp:
* DAnCE/LocalityManager/Scheduler/Events/Remove.h:
* DAnCE/LocalityManager/Scheduler/Events/Remove.cpp:
* DAnCE/LocalityManager/Scheduler/Events/Start.h:
* DAnCE/LocalityManager/Scheduler/Events/Start.cpp:
* DAnCE/LocalityManager/Scheduler/Plugin_Manager.h:
* DAnCE/LocalityManager/Scheduler/Plugin_Manager.cpp:
* DAnCE/LocalityManager/Scheduler/Scheduler.mpc:
Re-factored event scheduler events.
* DAnCE/MPC/config/dance_completion_counter.mpb:
* DAnCE/MPC/config/dance_deployment_scheduler.mpb:
Linking fixes/MPC optimization.
* DAnCE/NodeApplication/NodeApplication_Impl.cpp:
Bugfixes.
* ciao/Deployment/Handlers/Component_Handler.h:
* ciao/Deployment/Handlers/Component_Handler.cpp:
* ciao/Deployment/Handlers/Container_Handler.h:
* ciao/Deployment/Handlers/Container_Handler.cpp:
* ciao/Deployment/Handlers/Home_Handler.h:
* ciao/Deployment/Handlers/Home_Handler.cpp:
* ciao/Deployment/Handlers/Homed_Component_Handler.h:
* ciao/Deployment/Handlers/Homed_Component_Handler.cpp:
Added factory methods, re-arranged configuration logic.
* ciao/Deployment/Interceptors/CIAO_Deployment_Interceptors.mpc:
* ciao/Deployment/Interceptors/CIAO_Deployment_Interceptors_export.h:
* ciao/Deployment/Interceptors/Deployment_Interceptors.h:
* ciao/Deployment/Interceptors/Deployment_Interceptors.cpp:
* ciao/Deployment/Interceptors/Name_Utilities.h:
* ciao/Deployment/Interceptors/Name_Utilities.cpp:
Moved initial deployment interceptors into CIAO.
* DAnCE/LocalityManager/Daemon/Deployment_Interceptors.h:
* DAnCE/LocalityManager/Daemon/Deployment_Interceptors.cpp:
* DAnCE/LocalityManager/Daemon/Name_Utilities.h:
* DAnCE/LocalityManager/Daemon/Name_Utilities.cpp:
* DAnCE/LocalityManager/Scheduler/Deployment_Events.h:
* DAnCE/LocalityManager/Scheduler/Deployment_Events.inl:
* DAnCE/LocalityManager/Scheduler/Deployment_Events.cpp:
Removed these files.
48 files changed, 2201 insertions, 777 deletions
diff --git a/CIAO/ChangeLog b/CIAO/ChangeLog index bc371b01555..74d5f80a704 100644 --- a/CIAO/ChangeLog +++ b/CIAO/ChangeLog @@ -1,20 +1,99 @@ +Sun Jun 20 17:48:00 UTC 2010 William R. Otte <wotte@dre.vanderbilt.edu> + + * DAnCE/DAnCE/DAnCE_LocalityManager.idl: + * DAnCE/LocalityManager/Handler/LocalityActivator_Impl.cpp: + + Layout changes. + + * DAnCE/LocalityManager/Daemon/Locality_Manager.mpc: + * DAnCE/LocalityManager/Daemon/Locality_Manager_Impl.h: + * DAnCE/LocalityManager/Daemon/Locality_Manager_Impl.cpp: + + Scheduler integration + + + * DAnCE/LocalityManager/Scheduler/Deployment_Completion.h: + * DAnCE/LocalityManager/Scheduler/Deployment_Completion.cpp: + * DAnCE/LocalityManager/Scheduler/Deployment_Event.h: + * DAnCE/LocalityManager/Scheduler/Deployment_Event.inl: + * DAnCE/LocalityManager/Scheduler/Deployment_Scheduler.h: + * DAnCE/LocalityManager/Scheduler/Events: + * DAnCE/LocalityManager/Scheduler/Events/Configured.h: + * DAnCE/LocalityManager/Scheduler/Events/Configured.cpp: + * DAnCE/LocalityManager/Scheduler/Events/Connect.h: + * DAnCE/LocalityManager/Scheduler/Events/Connect.cpp: + * DAnCE/LocalityManager/Scheduler/Events/Endpoint.h: + * DAnCE/LocalityManager/Scheduler/Events/Endpoint.cpp: + * DAnCE/LocalityManager/Scheduler/Events/Install.h: + * DAnCE/LocalityManager/Scheduler/Events/Install.cpp: + * DAnCE/LocalityManager/Scheduler/Events/Passivate.h: + * DAnCE/LocalityManager/Scheduler/Events/Passivate.cpp: + * DAnCE/LocalityManager/Scheduler/Events/Remove.h: + * DAnCE/LocalityManager/Scheduler/Events/Remove.cpp: + * DAnCE/LocalityManager/Scheduler/Events/Start.h: + * DAnCE/LocalityManager/Scheduler/Events/Start.cpp: + * DAnCE/LocalityManager/Scheduler/Plugin_Manager.h: + * DAnCE/LocalityManager/Scheduler/Plugin_Manager.cpp: + * DAnCE/LocalityManager/Scheduler/Scheduler.mpc: + + Re-factored event scheduler events. + + * DAnCE/MPC/config/dance_completion_counter.mpb: + * DAnCE/MPC/config/dance_deployment_scheduler.mpb: + + Linking fixes/MPC optimization. + + * DAnCE/NodeApplication/NodeApplication_Impl.cpp: + + Bugfixes. + + * ciao/Deployment/Handlers/Component_Handler.h: + * ciao/Deployment/Handlers/Component_Handler.cpp: + * ciao/Deployment/Handlers/Container_Handler.h: + * ciao/Deployment/Handlers/Container_Handler.cpp: + * ciao/Deployment/Handlers/Home_Handler.h: + * ciao/Deployment/Handlers/Home_Handler.cpp: + * ciao/Deployment/Handlers/Homed_Component_Handler.h: + * ciao/Deployment/Handlers/Homed_Component_Handler.cpp: + + Added factory methods, re-arranged configuration logic. + + * ciao/Deployment/Interceptors/CIAO_Deployment_Interceptors.mpc: + * ciao/Deployment/Interceptors/CIAO_Deployment_Interceptors_export.h: + * ciao/Deployment/Interceptors/Deployment_Interceptors.h: + * ciao/Deployment/Interceptors/Deployment_Interceptors.cpp: + * ciao/Deployment/Interceptors/Name_Utilities.h: + * ciao/Deployment/Interceptors/Name_Utilities.cpp: + + Moved initial deployment interceptors into CIAO. + + * DAnCE/LocalityManager/Daemon/Deployment_Interceptors.h: + * DAnCE/LocalityManager/Daemon/Deployment_Interceptors.cpp: + * DAnCE/LocalityManager/Daemon/Name_Utilities.h: + * DAnCE/LocalityManager/Daemon/Name_Utilities.cpp: + * DAnCE/LocalityManager/Scheduler/Deployment_Events.h: + * DAnCE/LocalityManager/Scheduler/Deployment_Events.inl: + * DAnCE/LocalityManager/Scheduler/Deployment_Events.cpp: + + Removed these files. + Sun Jun 20 13:10:16 UTC 2010 James H. Hill <hillj at cs dot iupui dot edu> * connectors/ami4ccm/models: * connectors/ami4ccm/models/ami4ccm.xme: PICML model for the ami4ccm backend. - + * connectors/dds4ccm/models/dds4ccm.xme: - - Update of dds4ccm PICML model after updating the PICML metamodel to + + Update of dds4ccm PICML model after updating the PICML metamodel to completely support IDL statements it was currently lacking, such as 'native' and array struct members. * connectors/dds4ccm/examples/Shapes/models/Shapes.xme: - + Regenerated Shapes example. - + Fri Jun 18 20:29:14 UTC 2010 William R. Otte <wotte@dre.vanderbilt.edu> * MPC/config/ciao_base.mpb: diff --git a/CIAO/DAnCE/DAnCE/DAnCE_LocalityManager.idl b/CIAO/DAnCE/DAnCE/DAnCE_LocalityManager.idl index a91a38df9d2..f13ecc71601 100644 --- a/CIAO/DAnCE/DAnCE/DAnCE_LocalityManager.idl +++ b/CIAO/DAnCE/DAnCE/DAnCE_LocalityManager.idl @@ -28,8 +28,7 @@ module DAnCE void install_instance (in ::Deployment::DeploymentPlan plan, in unsigned long instanceRef, out any instance_reference) - raises (Deployment::ResourceNotAvailable, - Deployment::StartError, + raises (Deployment::StartError, Deployment::InvalidProperty, Deployment::InvalidNodeExecParameter, Deployment::InvalidComponentExecParameter); @@ -37,7 +36,8 @@ module DAnCE void provide_endpoint_reference (in ::Deployment::DeploymentPlan plan, in unsigned long connectionRef, out any endpoint_reference) - raises (Deployment::PlanError); + raises (Deployment::StartError, + Deployment::InvalidProperty); void connect_instance (in ::Deployment::DeploymentPlan plan, in unsigned long connectionRef, @@ -59,8 +59,8 @@ module DAnCE raises (Deployment::StartError); void passivate_instance (in ::Deployment::DeploymentPlan plan, - in unsigned long instanceRef, - in any instance_reference) + in unsigned long instanceRef, + in any instance_reference) raises (Deployment::StopError); void remove_instance (in ::Deployment::DeploymentPlan plan, diff --git a/CIAO/DAnCE/LocalityManager/Daemon/Locality_Manager.mpc b/CIAO/DAnCE/LocalityManager/Daemon/Locality_Manager.mpc index 23183b8a4a1..c4a2c5a0a9d 100644 --- a/CIAO/DAnCE/LocalityManager/Daemon/Locality_Manager.mpc +++ b/CIAO/DAnCE/LocalityManager/Daemon/Locality_Manager.mpc @@ -1,18 +1,15 @@ // $Id$ project (DAnCE_LocalityManager_Impl) : dance_lib, dance_output, naming, \ - dance_skel, dance_logger, ciao_deployment_handlers { + dance_skel, dance_logger, dance_deployment_scheduler { dynamicflags = LOCALITY_MANAGER_IMPL_BUILD_DLL Source_Files { Locality_Manager_Impl.cpp - Deployment_Interceptors.cpp - Name_Utilities.cpp } Header_Files { - Name_Utilities.h Locality_Manager_Impl.h Locality_Manager_Impl_Export.h } diff --git a/CIAO/DAnCE/LocalityManager/Daemon/Locality_Manager_Impl.cpp b/CIAO/DAnCE/LocalityManager/Daemon/Locality_Manager_Impl.cpp index 2cd92e2418c..8df75aeee6d 100644 --- a/CIAO/DAnCE/LocalityManager/Daemon/Locality_Manager_Impl.cpp +++ b/CIAO/DAnCE/LocalityManager/Daemon/Locality_Manager_Impl.cpp @@ -7,17 +7,19 @@ #include "Locality_Manager_Impl.h" #include "Logger/Log_Macros.h" - -/* - * CIAO Instance handlers - * @TODO: Needs to be replaced by dynamic provisioning system. - */ -#include "ciao/Deployment/Handlers/Container_Handler.h" -#include "ciao/Deployment/Handlers/Component_Handler.h" -#include "ciao/Deployment/Handlers/Home_Handler.h" -#include "ciao/Deployment/Handlers/Homed_Component_Handler.h" -#include "Deployment_Interceptors.h" -// +#include "DAnCE/DAnCE_Utility.h" +#include "DAnCE/DAnCE_PropertiesC.h" +#include "LocalityManager/Scheduler/Plugin_Manager.h" +#include "LocalityManager/Scheduler/Deployment_Completion.h" +#include "LocalityManager/Scheduler/Events/Install.h" +#include "LocalityManager/Scheduler/Events/Connect.h" +#include "LocalityManager/Scheduler/Events/Endpoint.h" +#include "LocalityManager/Scheduler/Events/Start.h" +#include "LocalityManager/Scheduler/Events/Configured.h" +#include "LocalityManager/Scheduler/Events/Remove.h" +#include "LocalityManager/Scheduler/Events/Passivate.h" + +using DAnCE::Utility::extract_and_throw_exception; namespace DAnCE { @@ -27,15 +29,20 @@ namespace DAnCE PortableServer::POA_ptr poa) : uuid_ (uuid), orb_ (CORBA::ORB::_duplicate (orb)), - poa_ (PortableServer::POA::_duplicate (poa)) + poa_ (PortableServer::POA::_duplicate (poa)), + spawn_delay_ (30) { DANCE_TRACE ("LocalityManager_i::LocalityManager_i"); + this->scheduler_.activate (THR_DETACHED, + 1); } // Implementation skeleton destructor LocalityManager_i::~LocalityManager_i (void) { DANCE_TRACE ("LocalityManager_i::~LocalityManager_i"); + + this->scheduler_.terminate_scheduler (); } void @@ -47,48 +54,90 @@ namespace DAnCE ACE_TEXT ("LocalityManager_i::init - ") ACE_TEXT ("Received %u properties from init\n"), props->length ())); - - this->props_ = props; - // Initialize the CIAO instance handlers - ::DAnCE::InstanceDeploymentHandler_ptr tmp; + if (props) + { + this->props_ = props; + + DAnCE::Utility::update_property_value (ENTITY_POA, + *this->props_, + this->poa_); + + PLUGIN_MANAGER::instance ()->set_configuration (*props); + } + + std::string type = + PLUGIN_MANAGER::instance ()->register_installation_handler ("CIAO_Deployment_Handlers", + "create_Container_Handler"); - DAnCE::Utility::PROPERTY_MAP tmp_props; + if (type.c_str ()) + { + this->handler_order_.push_back (type.c_str ()); + this->instance_handlers_[type.c_str ()] = INSTANCE_LIST (); + } - ACE_NEW_THROW_EX (tmp, - CIAO::Container_Handler_i (tmp_props, - this->orb_, - this->poa_), - CORBA::NO_MEMORY ()); + DANCE_DEBUG (6, (LM_DEBUG, DLINFO + ACE_TEXT ("LocalityManager_i::init - ") + ACE_TEXT ("Registered handler for <%C>\n"), + type.c_str ())); - this->instance_handlers_[tmp->instance_type ()] = Handler (tmp); - this->handler_order_.push_back (tmp->instance_type ()); + type = + PLUGIN_MANAGER::instance ()->register_installation_handler ("CIAO_Deployment_Handlers", + "create_Home_Handler"); + if (type.c_str ()) + { + this->handler_order_.push_back (type.c_str ()); + this->instance_handlers_[type.c_str ()] = INSTANCE_LIST (); + } - ACE_NEW_THROW_EX (tmp, - CIAO::Home_Handler_i, - CORBA::NO_MEMORY ()); - - this->instance_handlers_[tmp->instance_type ()] = Handler (tmp); - this->handler_order_.push_back (tmp->instance_type ()); - - ACE_NEW_THROW_EX (tmp, - CIAO::Component_Handler_i (), - CORBA::NO_MEMORY ()); + DANCE_DEBUG (6, (LM_DEBUG, DLINFO + ACE_TEXT ("LocalityManager_i::init - ") + ACE_TEXT ("Registered handler for <%C>\n"), + type.c_str ())); - this->instance_handlers_[tmp->instance_type ()] = Handler (tmp); - this->handler_order_.push_back (tmp->instance_type ()); + type = + PLUGIN_MANAGER::instance ()->register_installation_handler ("CIAO_Deployment_Handlers", + "create_Homed_Component_Handler"); + if (type.c_str ()) + { + this->handler_order_.push_back (type.c_str ()); + this->instance_handlers_[type.c_str ()] = INSTANCE_LIST (); + } - ACE_NEW_THROW_EX (tmp, - CIAO::Homed_Component_Handler_i (), - CORBA::NO_MEMORY ()); + DANCE_DEBUG (6, (LM_DEBUG, DLINFO + ACE_TEXT ("LocalityManager_i::init - ") + ACE_TEXT ("Registered handler for <%C>\n"), + type.c_str ())); + + type = + PLUGIN_MANAGER::instance ()->register_installation_handler ("CIAO_Deployment_Handlers", + "create_Component_Handler"); + if (type.c_str ()) + { + this->handler_order_.push_back (type.c_str ()); + this->instance_handlers_[type.c_str ()] = INSTANCE_LIST (); + } - this->instance_handlers_[tmp->instance_type ()] = Handler (tmp); - this->handler_order_.push_back (tmp->instance_type ()); + DANCE_DEBUG (6, (LM_DEBUG, DLINFO + ACE_TEXT ("LocalityManager_i::init - ") + ACE_TEXT ("Registered handler for <%C>\n"), + type.c_str ())); + + PLUGIN_MANAGER::instance ()->register_interceptor ("CIAO_Deployment_Interceptors", + "create_CIAO_StoreReferences"); - ACE_NEW_THROW_EX (this->ii_interceptor_, - DAnCE_StoreReferences_i (this->orb_.in (), - props), - CORBA::NO_MEMORY ()); + if (this->props_) + { + if (DAnCE::Utility::get_property_value (DAnCE::LOCALITY_TIMEOUT, + *this->props_, + this->spawn_delay_)) + { + DANCE_DEBUG (6, (LM_DEBUG, DLINFO + ACE_TEXT ("LocalityManager_i::configure - ") + ACE_TEXT ("Using provided spawn delay %u\n"), + this->spawn_delay_)); + } + } } ::Deployment::Properties * @@ -116,20 +165,34 @@ namespace DAnCE const char *instance_type = Utility::get_instance_type (plan.implementation[implRef].execParameter); - instance_handlers_[instance_type].instances_.push_back (i); + instance_handlers_[instance_type].push_back (i); } return this->_this (); - // Add your implementation here } ::Deployment::Application_ptr - LocalityManager_i::startLaunch (const ::Deployment::Properties &, + LocalityManager_i::startLaunch (const ::Deployment::Properties &prop, ::Deployment::Connections_out providedReference) { DANCE_TRACE ("LocalityManager_i::startLaunch"); + this->install_instances (prop); + + this->collect_references (providedReference); + + return this->_this (); + } + + void + LocalityManager_i::install_instances (const ::Deployment::Properties &prop) + { + DANCE_TRACE ("LocalityManager_i::install_instances"); + + CORBA::ULong dispatched (0); + Deployment_Completion completion; + for (HANDLER_ORDER::const_iterator i = this->handler_order_.begin (); i != this->handler_order_.end (); ++i) @@ -139,9 +202,7 @@ namespace DAnCE ACE_TEXT ("Starting installation of %C type instances\n"), i->c_str ())); - ::DAnCE::InstanceDeploymentHandler_ptr handler = - this->instance_handlers_[*i].handler_; - INSTANCE_LIST &inst_list = this->instance_handlers_[*i].instances_; + INSTANCE_LIST &inst_list = this->instance_handlers_[*i]; for (INSTANCE_LIST::const_iterator j = inst_list.begin (); j != inst_list.end (); @@ -152,36 +213,93 @@ namespace DAnCE ACE_TEXT ("Starting installation of instance %C\n"), this->plan_.instance[*j].name.in ())); - - this->ii_interceptor_->instance_pre_install (this->plan_, - *j); - - CORBA::Any_var reference; - handler->install_instance (this->plan_, - *j, - reference.out ()); + Install_Instance *event (0); + Event_Future result; + completion.accept (result); - CORBA::Any exception; - - this->ii_interceptor_->instance_post_install (this->plan_, - *j, - reference.in (), - exception); - this->instance_references_[*j] = reference._retn (); + ACE_NEW_THROW_EX (event, + Install_Instance (this->plan_, + *j, + i->c_str (), + result), + CORBA::NO_MEMORY ()); - - // @@ todo: post-interceptor + this->scheduler_.schedule_event (event); + ++dispatched; } } - - ::Deployment::Connections *conn_cmp; - ACE_NEW_THROW_EX (conn_cmp, - ::Deployment::Connections (this->plan_.connection.length ()), - CORBA::NO_MEMORY ()); + ACE_Time_Value tv (ACE_OS::gettimeofday () + ACE_Time_Value (this->spawn_delay_)); - CORBA::ULong pos (0); + if (!completion.wait_on_completion (&tv)) + { + DANCE_ERROR (1, (LM_ERROR, DLINFO + ACE_TEXT ("LocalityManager_i::startLaunch - ") + ACE_TEXT ("Timed out while waiting on completion of scheduler\n"))); + } + + tv = ACE_Time_Value::zero; + + Event_List completed_events; + completion.completed_events (completed_events); + + if (completed_events.size () != dispatched) + { + DANCE_ERROR (2, (LM_WARNING, DLINFO + ACE_TEXT ("LocalityManager_i::startLaunch - ") + ACE_TEXT ("Received only %u completed events, expected %u\n"), + dispatched, + completed_events.size ())); + } + for (Event_List::iterator i = completed_events.begin (); + i != completed_events.end (); + ++i) + { + Event_Result event; + if (i->get (event, &tv) != 0) + { + DANCE_ERROR (1, (LM_ERROR, DLINFO + ACE_TEXT ("LocalityManager_i::startLaunch - ") + ACE_TEXT ("Failed to get future value for current instance\n"))); + continue; + } + + if (event.exception_ && + !(extract_and_throw_exception < Deployment::StartError > + (event.contents_.in ()) || + extract_and_throw_exception < Deployment::InvalidProperty > + (event.contents_.in ()) || + extract_and_throw_exception < Deployment::InvalidNodeExecParameter > + (event.contents_.in ()) || + extract_and_throw_exception < Deployment::InvalidComponentExecParameter > + (event.contents_.in ())) + ) + { + DANCE_ERROR (1, (LM_ERROR, DLINFO + ACE_TEXT ("LocalityManager_i::startLaunch - ") + ACE_TEXT ("Error: Unnown exception propagated\n"))); + throw ::Deployment::StartError (event.id_.c_str (), + "Unknown exception"); + } + + DANCE_DEBUG (5, (LM_INFO, DLINFO + ACE_TEXT ("LocalityManager_i::startLaunch - ") + ACE_TEXT ("Instance <%C> successfully deployed\n"), + event.id_.c_str ())); + + this->instance_references_[event.id_] = event.contents_; + } + } + + void + LocalityManager_i::collect_references (::Deployment::Connections_out &providedReference) + { + DANCE_TRACE ("LocalityManager_i::collect_references"); + + CORBA::ULong dispatched (0); + Deployment_Completion completion; + for (CORBA::ULong i = 0; i < this->plan_.connection.length (); ++i) @@ -202,29 +320,90 @@ namespace DAnCE const char *inst_type = Utility::get_instance_type (this->plan_.implementation[implRef].execParameter); - CORBA::Any_var ref; - - this->instance_handlers_[inst_type].handler_-> - provide_endpoint_reference (this->plan_, - i, - ref.out ()); - CORBA::Object_var obj_ref; - - ref >>= CORBA::Any::to_object (obj_ref); - conn_cmp->length (pos + 1); - (*conn_cmp)[pos].name = conn.name.in (); - (*conn_cmp)[pos].endpoint.length (1); - (*conn_cmp)[pos].endpoint[0] = obj_ref; - ++pos; + Endpoint_Reference *event (0); + Event_Future result; + completion.accept (result); + + ACE_NEW_THROW_EX (event, + Endpoint_Reference (this->plan_, + i, + inst_type, + result), + CORBA::NO_MEMORY ()); + + this->scheduler_.schedule_event (event); + ++dispatched; } } } - + + ACE_Time_Value tv (ACE_OS::gettimeofday () + ACE_Time_Value (this->spawn_delay_)); + + if (!completion.wait_on_completion (&tv)) + { + DANCE_ERROR (1, (LM_ERROR, DLINFO + ACE_TEXT ("LocalityManager_i::startLaunch - ") + ACE_TEXT ("Timed out while waiting on completion of scheduler\n"))); + } + + tv = ACE_Time_Value::zero; + + Event_List completed_events; + completion.completed_events (completed_events); + + if (completed_events.size () != dispatched) + { + DANCE_ERROR (2, (LM_WARNING, DLINFO + ACE_TEXT ("LocalityManager_i::startLaunch - ") + ACE_TEXT ("Received only %u completed events, expected %u\n"), + dispatched, + completed_events.size ())); + } + + ::Deployment::Connections *conn_cmp; + ACE_NEW_THROW_EX (conn_cmp, + ::Deployment::Connections (this->plan_.connection.length ()), + CORBA::NO_MEMORY ()); + + CORBA::ULong pos (0); + for (Event_List::iterator i = completed_events.begin (); + i != completed_events.end (); + ++i) + { + Event_Result event; + if (i->get (event, &tv) != 0) + { + DANCE_ERROR (1, (LM_ERROR, DLINFO + ACE_TEXT ("LocalityManager_i::startLaunch - ") + ACE_TEXT ("Failed to get future value for current instance\n"))); + continue; + } + + if (event.exception_ && + !(extract_and_throw_exception < Deployment::StartError > + (event.contents_.in ()) || + extract_and_throw_exception < Deployment::InvalidProperty > + (event.contents_.in ()))) + { + DANCE_ERROR (1, (LM_ERROR, DLINFO + ACE_TEXT ("LocalityManager_i::startLaunch - ") + ACE_TEXT ("Error: Unnown exception propagated\n"))); + throw ::Deployment::StartError (event.id_.c_str (), + "Unknown exception"); + } + + CORBA::Object_var obj_ref; + + event.contents_ >>= CORBA::Any::to_object (obj_ref); + conn_cmp->length (pos + 1); + (*conn_cmp)[pos].name = event.id_.c_str (); + (*conn_cmp)[pos].endpoint.length (1); + (*conn_cmp)[pos].endpoint[0] = obj_ref; + ++pos; + } providedReference = conn_cmp; - - return this->_this (); } void @@ -237,6 +416,8 @@ namespace DAnCE typedef std::map < std::string, CORBA::ULong > ConnMap; ConnMap conns; + Deployment_Completion completion; + DANCE_DEBUG (6, (LM_TRACE, DLINFO ACE_TEXT ("LocalityManager_i::finishLaunch - ") ACE_TEXT ("Starting finsihLaunch, received %u references, ") @@ -250,6 +431,8 @@ namespace DAnCE conns[this->plan_.connection[i].name.in ()] = i; } + CORBA::ULong dispatched; + for (CORBA::ULong i = 0; i < providedReference.length (); ++i) { const char * name = providedReference[i].name.in (); @@ -300,31 +483,147 @@ namespace DAnCE const char *inst_type = Utility::get_instance_type (this->plan_.implementation[implRef].execParameter); + + Connect_Instance *event (0); + Event_Future result; + completion.accept (result); + + ACE_NEW_THROW_EX (event, + Connect_Instance (this->plan_, + conn_ref->second, + reference, + inst_type, + result), + CORBA::NO_MEMORY ()); - // @@ placeholder for pre_connect interceptor - this->instance_handlers_[inst_type].handler_-> - connect_instance (this->plan_, - conn_ref->second, - reference); - // @@ placeholder for post_connect interceptor + this->scheduler_.schedule_event (event); + ++dispatched; } + ACE_Time_Value tv (ACE_OS::gettimeofday () + ACE_Time_Value (this->spawn_delay_)); + + if (!completion.wait_on_completion (&tv)) + { + DANCE_ERROR (1, (LM_ERROR, DLINFO + ACE_TEXT ("LocalityManager_i::finishLaunch - ") + ACE_TEXT ("Timed out while waiting on completion of scheduler\n"))); + } + + tv = ACE_Time_Value::zero; + + Event_List completed_events; + completion.completed_events (completed_events); + + if (completed_events.size () != dispatched) + { + DANCE_ERROR (2, (LM_WARNING, DLINFO + ACE_TEXT ("LocalityManager_i::finishLaunch - ") + ACE_TEXT ("Received only %u completed events, expected %u\n"), + dispatched, + completed_events.size ())); + } + + for (Event_List::iterator i = completed_events.begin (); + i != completed_events.end (); + ++i) + { + Event_Result event; + if (i->get (event, &tv) != 0) + { + DANCE_ERROR (1, (LM_ERROR, DLINFO + ACE_TEXT ("LocalityManager_i::finishLaunch - ") + ACE_TEXT ("Failed to get future value for current instance\n"))); + continue; + } + + if (event.exception_ && + !(extract_and_throw_exception < Deployment::StartError > + (event.contents_.in ()) || + extract_and_throw_exception < Deployment::InvalidConnection > + (event.contents_.in ())) + ) + { + DANCE_ERROR (1, (LM_ERROR, DLINFO + ACE_TEXT ("LocalityManager_i::finishLaunch - ") + ACE_TEXT ("Error: Unnown exception propagated\n"))); + throw ::Deployment::StartError (event.id_.c_str (), + "Unknown exception"); + } + } + dispatched = 0; + for (HANDLER_ORDER::const_iterator i = this->handler_order_.begin (); i != this->handler_order_.end (); ++i) { - ::DAnCE::InstanceDeploymentHandler_ptr handler = - this->instance_handlers_[*i].handler_; - INSTANCE_LIST &inst_list = this->instance_handlers_[*i].instances_; + INSTANCE_LIST &inst_list = this->instance_handlers_[*i]; - for (INSTANCE_LIST::const_iterator i = inst_list.begin (); - i != inst_list.end (); - ++i) + for (INSTANCE_LIST::const_iterator j = inst_list.begin (); + j != inst_list.end (); + ++j) { - CORBA::Any_var reference; - handler->instance_configured (this->plan_, - *i); + Instance_Configured *event (0); + Event_Future result; + completion.accept (result); + + ACE_NEW_THROW_EX (event, + Instance_Configured (this->plan_, + *j, + i->c_str (), + result), + CORBA::NO_MEMORY ()); + + this->scheduler_.schedule_event (event); + ++dispatched; + } + } + + tv = ACE_OS::gettimeofday () + ACE_Time_Value (this->spawn_delay_); + + if (!completion.wait_on_completion (&tv)) + { + DANCE_ERROR (1, (LM_ERROR, DLINFO + ACE_TEXT ("LocalityManager_i::finishLaunch - ") + ACE_TEXT ("Timed out while waiting on completion of scheduler\n"))); + } + + tv = ACE_Time_Value::zero; + + completion.completed_events (completed_events); + + if (completed_events.size () != dispatched) + { + DANCE_ERROR (2, (LM_WARNING, DLINFO + ACE_TEXT ("LocalityManager_i::finishLaunch - ") + ACE_TEXT ("Received only %u completed events, expected %u\n"), + dispatched, + completed_events.size ())); + } + + for (Event_List::iterator i = completed_events.begin (); + i != completed_events.end (); + ++i) + { + Event_Result event; + if (i->get (event, &tv) != 0) + { + DANCE_ERROR (1, (LM_ERROR, DLINFO + ACE_TEXT ("LocalityManager_i::finishLaunch - ") + ACE_TEXT ("Failed to get future value for current instance\n"))); + continue; + } + + if (event.exception_ && + !(extract_and_throw_exception < Deployment::StartError > + (event.contents_.in ())) + ) + { + DANCE_ERROR (1, (LM_ERROR, DLINFO + ACE_TEXT ("LocalityManager_i::finishLaunch - ") + ACE_TEXT ("Error: Unnown exception propagated\n"))); + throw ::Deployment::StartError (event.id_.c_str (), + "Unknown exception from instance_configured"); } } @@ -336,70 +635,274 @@ namespace DAnCE LocalityManager_i::start (void) { DANCE_TRACE ("LocalityManager_i::start"); - + + Deployment_Completion completion; + CORBA::ULong dispatched (0); + for (HANDLER_ORDER::const_iterator i = this->handler_order_.begin (); i != this->handler_order_.end (); ++i) { - ::DAnCE::InstanceDeploymentHandler_ptr handler = - this->instance_handlers_[*i].handler_; - INSTANCE_LIST &inst_list = this->instance_handlers_[*i].instances_; + INSTANCE_LIST &inst_list = this->instance_handlers_[*i]; - for (INSTANCE_LIST::const_iterator i = inst_list.begin (); - i != inst_list.end (); - ++i) + for (INSTANCE_LIST::const_iterator j = inst_list.begin (); + j != inst_list.end (); + ++j) { - CORBA::Any_var reference; - handler->activate_instance (this->plan_, - *i, - reference.in ()); + Start_Instance *event (0); + Event_Future result; + completion.accept (result); + + const char *name = this->plan_.instance[*j].name.in (); + + ACE_NEW_THROW_EX (event, + Start_Instance (this->plan_, + *j, + this->instance_references_[name].in (), + i->c_str (), + result), + CORBA::NO_MEMORY ()); + + this->scheduler_.schedule_event (event); + ++dispatched; } } + + ACE_Time_Value tv (ACE_OS::gettimeofday () + ACE_Time_Value (this->spawn_delay_)); + + if (!completion.wait_on_completion (&tv)) + { + DANCE_ERROR (1, (LM_ERROR, DLINFO + ACE_TEXT ("LocalityManager_i::start - ") + ACE_TEXT ("Timed out while waiting on completion of scheduler\n"))); + } + + tv = ACE_Time_Value::zero; + + Event_List completed_events; + completion.completed_events (completed_events); + + if (completed_events.size () != dispatched) + { + DANCE_ERROR (2, (LM_WARNING, DLINFO + ACE_TEXT ("LocalityManager_i::start - ") + ACE_TEXT ("Received only %u completed events, expected %u\n"), + dispatched, + completed_events.size ())); + } + + for (Event_List::iterator i = completed_events.begin (); + i != completed_events.end (); + ++i) + { + Event_Result event; + if (i->get (event, &tv) != 0) + { + DANCE_ERROR (1, (LM_ERROR, DLINFO + ACE_TEXT ("LocalityManager_i::start - ") + ACE_TEXT ("Failed to get future value for current instance\n"))); + continue; + } + + if (event.exception_ && + !(extract_and_throw_exception < Deployment::StartError > + (event.contents_.in ())) + ) + { + DANCE_ERROR (1, (LM_ERROR, DLINFO + ACE_TEXT ("LocalityManager_i::start - ") + ACE_TEXT ("Error: Unnown exception propagated\n"))); + throw ::Deployment::StartError (event.id_.c_str (), + "Unknown exception"); + } + + DANCE_DEBUG (5, (LM_INFO, DLINFO + ACE_TEXT ("LocalityManager_i::start - ") + ACE_TEXT ("Instance <%C> successfully activated\n"), + event.id_.c_str ())); + } } void LocalityManager_i::destroyApplication (::Deployment::Application_ptr) { DANCE_TRACE ("LocalityManager_i::destroyApplication"); - + + Deployment_Completion completion; + CORBA::ULong dispatched (0); + for (size_t i = this->handler_order_.size (); i > 0; --i) { - ::DAnCE::InstanceDeploymentHandler_ptr handler = - this->instance_handlers_[this->handler_order_[i-1]].handler_; - INSTANCE_LIST &inst_list = this->instance_handlers_[this->handler_order_[i-1]].instances_; + INSTANCE_LIST &inst_list = this->instance_handlers_[this->handler_order_[i-1]]; for (INSTANCE_LIST::const_iterator j = inst_list.begin (); j != inst_list.end (); ++j) { - CORBA::Any_var reference; - handler->passivate_instance (this->plan_, - *j, - reference.in ()); + Passivate_Instance *event (0); + Event_Future result; + completion.accept (result); + + const char *name = this->plan_.instance[*j].name.in (); + + ACE_NEW_THROW_EX (event, + Passivate_Instance (this->plan_, + *j, + this->instance_references_[name].in (), + this->handler_order_[i-1].c_str (), + result), + CORBA::NO_MEMORY ()); + + this->scheduler_.schedule_event (event); + ++dispatched; } } + + ACE_Time_Value tv (ACE_OS::gettimeofday () + ACE_Time_Value (this->spawn_delay_)); + + if (!completion.wait_on_completion (&tv)) + { + DANCE_ERROR (1, (LM_ERROR, DLINFO + ACE_TEXT ("LocalityManager_i::destroyApplication - ") + ACE_TEXT ("Timed out while waiting on completion of scheduler\n"))); + } + + tv = ACE_Time_Value::zero; + + Event_List completed_events; + completion.completed_events (completed_events); + + if (completed_events.size () != dispatched) + { + DANCE_ERROR (2, (LM_WARNING, DLINFO + ACE_TEXT ("LocalityManager_i::destroyApplication - ") + ACE_TEXT ("Received only %u completed events, expected %u\n"), + dispatched, + completed_events.size ())); + } + dispatched = 0; + + for (Event_List::iterator i = completed_events.begin (); + i != completed_events.end (); + ++i) + { + Event_Result event; + if (i->get (event, &tv) != 0) + { + DANCE_ERROR (1, (LM_ERROR, DLINFO + ACE_TEXT ("LocalityManager_i::destroyApplication - ") + ACE_TEXT ("Failed to get future value for current instance\n"))); + continue; + } + + if (event.exception_ && + !(extract_and_throw_exception < Deployment::StopError > + (event.contents_.in ())) + ) + { + DANCE_ERROR (1, (LM_ERROR, DLINFO + ACE_TEXT ("LocalityManager_i::destroyApplication - ") + ACE_TEXT ("Error: Unnown exception propagated\n"))); + throw ::Deployment::StopError (event.id_.c_str (), + "Unknown exception"); + } + + DANCE_DEBUG (5, (LM_INFO, DLINFO + ACE_TEXT ("LocalityManager_i::destroyApplication - ") + ACE_TEXT ("Instance <%C> successfully passivated\n"), + event.id_.c_str ())); + } + for (size_t i = this->handler_order_.size (); i > 0; --i) { - ::DAnCE::InstanceDeploymentHandler_ptr handler = - this->instance_handlers_[this->handler_order_[i-1]].handler_; - INSTANCE_LIST &inst_list = this->instance_handlers_[this->handler_order_[i-1]].instances_; + INSTANCE_LIST &inst_list = this->instance_handlers_[this->handler_order_[i-1]]; for (INSTANCE_LIST::const_iterator j = inst_list.begin (); j != inst_list.end (); ++j) { - CORBA::Any_var reference; - handler->remove_instance (this->plan_, - *j, - reference.in ()); + Remove_Instance *event (0); + Event_Future result; + completion.accept (result); + + const char *name = this->plan_.instance[*j].name.in (); + + REFERENCE_MAP::iterator ref = this->instance_references_.find (name); + + ACE_NEW_THROW_EX (event, + Remove_Instance (this->plan_, + *j, + ref->second.in (), + this->handler_order_[i-1].c_str (), + result), + CORBA::NO_MEMORY ()); + + this->instance_references_.erase (ref); + + this->scheduler_.schedule_event (event); + ++dispatched; } } - // Add your implementation here + + tv = ACE_OS::gettimeofday () + ACE_Time_Value (this->spawn_delay_); + + if (!completion.wait_on_completion (&tv)) + { + DANCE_ERROR (1, (LM_ERROR, DLINFO + ACE_TEXT ("LocalityManager_i::destroyApplication - ") + ACE_TEXT ("Timed out while waiting on completion of scheduler\n"))); + } + + tv = ACE_Time_Value::zero; + + completion.completed_events (completed_events); + + if (completed_events.size () != dispatched) + { + DANCE_ERROR (2, (LM_WARNING, DLINFO + ACE_TEXT ("LocalityManager_i::destroyApplication - ") + ACE_TEXT ("Received only %u completed events, expected %u\n"), + dispatched, + completed_events.size ())); + } + + dispatched = 0; + + for (Event_List::iterator i = completed_events.begin (); + i != completed_events.end (); + ++i) + { + Event_Result event; + if (i->get (event, &tv) != 0) + { + DANCE_ERROR (1, (LM_ERROR, DLINFO + ACE_TEXT ("LocalityManager_i::destroyApplication - ") + ACE_TEXT ("Failed to get future value for current instance\n"))); + continue; + } + + if (event.exception_ && + !(extract_and_throw_exception < Deployment::StopError > + (event.contents_.in ())) + ) + { + DANCE_ERROR (1, (LM_ERROR, DLINFO + ACE_TEXT ("LocalityManager_i::destroyApplication - ") + ACE_TEXT ("Error: Unnown exception propagated\n"))); + throw ::Deployment::StopError (event.id_.c_str (), + "Unknown exception"); + } + + DANCE_DEBUG (5, (LM_INFO, DLINFO + ACE_TEXT ("LocalityManager_i::destroyApplication - ") + ACE_TEXT ("Instance <%C> successfully removed\n"), + event.id_.c_str ())); + } } diff --git a/CIAO/DAnCE/LocalityManager/Daemon/Locality_Manager_Impl.h b/CIAO/DAnCE/LocalityManager/Daemon/Locality_Manager_Impl.h index 74128bec132..221abb845c2 100644 --- a/CIAO/DAnCE/LocalityManager/Daemon/Locality_Manager_Impl.h +++ b/CIAO/DAnCE/LocalityManager/Daemon/Locality_Manager_Impl.h @@ -23,6 +23,8 @@ #include "LocalityManager/Daemon/Locality_Manager_Impl_Export.h" +#include "LocalityManager/Scheduler/Deployment_Scheduler.h" + #include <map> #include <vector> #include <list> @@ -73,24 +75,18 @@ namespace DAnCE void destroyApplication (::Deployment::Application_ptr app); private: + void install_instances (const ::Deployment::Properties &prop); + + void collect_references (::Deployment::Connections_out &providedReference); + ACE_TString uuid_; CORBA::ORB_var orb_; PortableServer::POA_var poa_; typedef std::list< CORBA::ULong > INSTANCE_LIST; - struct Handler - { - Handler (void) {}; - Handler (::DAnCE::InstanceDeploymentHandler_ptr h) - : handler_ (h) {}; - - ::DAnCE::InstanceDeploymentHandler_var handler_; - INSTANCE_LIST instances_; - }; - typedef std::map <std::string, - Handler> HANDLER_TABLE; + INSTANCE_LIST> HANDLER_TABLE; HANDLER_TABLE instance_handlers_; @@ -98,15 +94,17 @@ namespace DAnCE HANDLER_ORDER handler_order_; - typedef std::map < CORBA::ULong, CORBA::Any_var > REFERENCE_MAP; + typedef std::map < std::string, CORBA::Any_var > REFERENCE_MAP; REFERENCE_MAP instance_references_; ::Deployment::DeploymentPlan plan_; - ::DAnCE::InstanceInstallation_var ii_interceptor_; - ::Deployment::Properties_var props_; + + DAnCE::Deployment_Scheduler scheduler_; + + CORBA::ULong spawn_delay_; }; } diff --git a/CIAO/DAnCE/LocalityManager/Handler/LocalityActivator_Impl.cpp b/CIAO/DAnCE/LocalityManager/Handler/LocalityActivator_Impl.cpp index 50707f0a3c6..6f2f24d8d47 100644 --- a/CIAO/DAnCE/LocalityManager/Handler/LocalityActivator_Impl.cpp +++ b/CIAO/DAnCE/LocalityManager/Handler/LocalityActivator_Impl.cpp @@ -470,7 +470,7 @@ namespace DAnCE void DAnCE_LocalityActivator_i:: multi_threaded_wait_for_callback (Server_Info &si, - ACE_Time_Value &timeout) + ACE_Time_Value &timeout) { DANCE_TRACE ("DAnCE_LocalityActivator_i::multi_threaded_wait_for_callback"); @@ -481,7 +481,7 @@ namespace DAnCE CORBA::NO_RESOURCES ()); while (! si.activated_ ) - if (si.condition_.wait (/*&timeout*/) == -1) + if (si.condition_.wait (&timeout) == -1) { DANCE_ERROR (1, (LM_ERROR, DLINFO ACE_TEXT ("DAnCE_LocalityActivator_i::multi_threaded_wait_for_callback - ") diff --git a/CIAO/DAnCE/LocalityManager/Scheduler/Deployment_Completion.cpp b/CIAO/DAnCE/LocalityManager/Scheduler/Deployment_Completion.cpp index 5ec39122a6d..763518a312f 100644 --- a/CIAO/DAnCE/LocalityManager/Scheduler/Deployment_Completion.cpp +++ b/CIAO/DAnCE/LocalityManager/Scheduler/Deployment_Completion.cpp @@ -24,8 +24,9 @@ namespace DAnCE } void - Deployment_Completion::update (const Event_Future &future) + Deployment_Completion::update (const Event_Future &evt) { + this->completed_events_.push_back (evt); this->decrement_exec_count (); } @@ -57,6 +58,17 @@ namespace DAnCE } void + Deployment_Completion::completed_events (Event_List &event_list) + { + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, + guard, + this->mutex_, CORBA::NO_RESOURCES ()); + + event_list.swap (this->completed_events_); + this->completed_events_.clear (); + } + + void Deployment_Completion::on_all_completed () { this->condition_.broadcast (); diff --git a/CIAO/DAnCE/LocalityManager/Scheduler/Deployment_Completion.h b/CIAO/DAnCE/LocalityManager/Scheduler/Deployment_Completion.h index 6fdf2eff75d..e067e01ed2a 100644 --- a/CIAO/DAnCE/LocalityManager/Scheduler/Deployment_Completion.h +++ b/CIAO/DAnCE/LocalityManager/Scheduler/Deployment_Completion.h @@ -37,6 +37,8 @@ namespace DAnCE /// Waits for completion of all events, with a timeout bool wait_on_completion (ACE_Time_Value *tv); + + void completed_events (Event_List &event_list); protected: virtual void on_all_completed (); @@ -46,6 +48,8 @@ namespace DAnCE private: TAO_SYNCH_MUTEX mutex_; ACE_Condition< TAO_SYNCH_MUTEX > condition_; + + Event_List completed_events_; }; } diff --git a/CIAO/DAnCE/LocalityManager/Scheduler/Deployment_Event.h b/CIAO/DAnCE/LocalityManager/Scheduler/Deployment_Event.h index deb95e27ef7..6caac6da82c 100644 --- a/CIAO/DAnCE/LocalityManager/Scheduler/Deployment_Event.h +++ b/CIAO/DAnCE/LocalityManager/Scheduler/Deployment_Event.h @@ -10,9 +10,12 @@ #include /**/ "ace/pre.h" #include "ace/Future.h" +#include "ace/Method_Request.h" #include "tao/AnyTypeCode/Any.h" #include "LocalityManager/Scheduler/Deployment_Scheduler_export.h" +#include <list> + namespace DAnCE { struct Deployment_Scheduler_Export Event_Result @@ -32,6 +35,22 @@ namespace DAnCE }; typedef ACE_Future< Event_Result > Event_Future; + + typedef std::list <Event_Future> Event_List; + + class Deployment_Scheduler_Export Deployment_Event : + public virtual ACE_Method_Request + { + public: + Deployment_Event (Event_Future holder, + const char *instance_type); + + Event_Future get_future (void); + + protected: + Event_Future holder_; + std::string instance_type_; + }; } #if defined (__ACE_INLINE__) diff --git a/CIAO/DAnCE/LocalityManager/Scheduler/Deployment_Event.inl b/CIAO/DAnCE/LocalityManager/Scheduler/Deployment_Event.inl index acb12d1f684..07a2bc12bfa 100644 --- a/CIAO/DAnCE/LocalityManager/Scheduler/Deployment_Event.inl +++ b/CIAO/DAnCE/LocalityManager/Scheduler/Deployment_Event.inl @@ -28,6 +28,21 @@ namespace DAnCE contents_ (any) { } + + ACE_INLINE + Deployment_Event::Deployment_Event (Event_Future holder, + const char *inst_type) + : holder_ (holder), + instance_type_ (inst_type) + { + } + + ACE_INLINE + Event_Future + Deployment_Event::get_future (void) + { + return holder_; + } } #endif diff --git a/CIAO/DAnCE/LocalityManager/Scheduler/Deployment_Events.cpp b/CIAO/DAnCE/LocalityManager/Scheduler/Deployment_Events.cpp deleted file mode 100644 index 08806d275f4..00000000000 --- a/CIAO/DAnCE/LocalityManager/Scheduler/Deployment_Events.cpp +++ /dev/null @@ -1,411 +0,0 @@ -// $Id$ - -#include "Deployment_Events.h" -#include "tao/AnyTypeCode/ExceptionA.h" -#include "Logger/Log_Macros.h" -#include "Deployment/Deployment_StartErrorC.h" -#include "DAnCE/DAnCE_DeploymentInterceptorsC.h" -#include "DAnCE/DAnCE_LocalityManagerC.h" -#include "DAnCE/DAnCE_Utility.h" -#include "Plugin_Manager.h" - -#if !defined (__ACE_INLINE__) -#include "LocalityManager/Scheduler/Deployment_Events.inl" -#endif - -namespace DAnCE -{ - Install_Instance::Install_Instance (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - const char *inst_type, - Event_Future holder) - : Deployment_Event (holder, inst_type), - plan_ (plan), - instanceRef_ (instanceRef) - { - } - - Install_Instance::~Install_Instance (void) - { - } - - int - Install_Instance::call (void) - { - DANCE_DEBUG (10, (LM_TRACE, DLINFO - ACE_TEXT ("Install_Instance::call - ") - ACE_TEXT ("Entering Install_Instance\n"))); - - const char *name = this->plan_.instance[this->instanceRef_].name.in (); - - try - { - const Plugin_Manager::INST_INTERCEPTORS &interceptors = - PLUGIN_MANAGER::instance ()->fetch_installation_interceptors (); - - DANCE_DEBUG (10, (LM_TRACE, DLINFO - ACE_TEXT ("Install_Instance::call - ") - ACE_TEXT ("Invoking pre-install interceptors\n"))); - for (Plugin_Manager::INST_INTERCEPTORS::const_iterator i = interceptors.begin (); - i != interceptors.end (); - ++i) - { - (*i)->instance_pre_install (this->plan_, - this->instanceRef_); - } - - ::Deployment::MonolithicDeploymentDescription &mdd = - this->plan_.implementation[this->plan_.instance[this->instanceRef_].implementationRef]; - - const char *inst_type = - DAnCE::Utility::get_instance_type (mdd.execParameter); - - if (inst_type == 0) - { - throw ::Deployment::PlanError (name, - "Invalid instance type\n"); - } - - ::DAnCE::InstanceDeploymentHandler_var handler = - PLUGIN_MANAGER::instance ()->fetch_installation_handler (inst_type); - - if (CORBA::is_nil (handler)) - { - throw ::Deployment::StartError (name, - "Unable to load appropriate instance handler"); - } - - ::CORBA::Any_var instance_ref; - ::CORBA::Any_var instance_excep; - - try - { - DANCE_DEBUG (10, (LM_TRACE, DLINFO - ACE_TEXT ("Install_Instance::call - ") - ACE_TEXT ("Invoking install_instance on handler for type <%C>\n"), - inst_type)); - handler->install_instance (this->plan_, - this->instanceRef_, - instance_ref.out ()); - DANCE_DEBUG (10, (LM_TRACE, DLINFO - ACE_TEXT ("Install_Instance::call - ") - ACE_TEXT ("install_instance completed\n"))); - } - catch (CORBA::Exception &ex) - { - DANCE_ERROR (3, (LM_ERROR, DLINFO - ACE_TEXT ("Install_Instance::call - ") - ACE_TEXT ("Caught CORBA exception while installing instance ") - ACE_TEXT ("%u:<%C>\n"), - this->instanceRef_, - name)); - CORBA::Any *tmp = 0; - ACE_NEW_THROW_EX (tmp, - CORBA::Any, - CORBA::NO_MEMORY ()); - instance_excep = tmp; - *tmp <<= ex; - } - catch (...) - { - DANCE_ERROR (3, (LM_ERROR, DLINFO - ACE_TEXT ("Install_Instance::call - ") - ACE_TEXT ("Caught C++ exception while installing instance ") - ACE_TEXT ("%u:<%C>\n"), - this->instanceRef_, - name)); - - ::Deployment::StartError ex_tmp (name, - "Caught unknown C++ exception from install"); - CORBA::Any *tmp = 0; - ACE_NEW_THROW_EX (tmp, - CORBA::Any, - CORBA::NO_MEMORY ()); - instance_excep = tmp; - *tmp <<= ex_tmp; - } - - DANCE_DEBUG (10, (LM_TRACE, DLINFO - ACE_TEXT ("Install_Instance::call - ") - ACE_TEXT ("Invoking post-install interceptors\n"))); - for (Plugin_Manager::INST_INTERCEPTORS::const_iterator i = interceptors.begin (); - i != interceptors.end (); - ++i) - { - (*i)->instance_post_install (this->plan_, - this->instanceRef_, - instance_ref.in (), - instance_excep.in ()); - } - - Event_Result result (name, false, instance_ref._retn ()); - - DANCE_DEBUG (10, (LM_TRACE, DLINFO - ACE_TEXT ("Install_Instance::call - ") - ACE_TEXT ("Signaling result for instance <%C>\n"), - name)); - this->holder_.set (result); - } - catch (CORBA::Exception &ex) - { - DANCE_ERROR (3, (LM_ERROR, DLINFO - ACE_TEXT ("Install_Instance::call - ") - ACE_TEXT ("CORBA Exception propagated from interceptors for instance ") - ACE_TEXT ("%u:<%C>\n"), - this->instanceRef_, - name)); - - Event_Result result (name, true); - - CORBA::Any *tmp = 0; - ACE_NEW_NORETURN (tmp, - CORBA::Any); - - if (tmp) - { - result.contents_ = tmp; - *tmp <<= ex; - } - - this->holder_.set (result); - return -1; - } - return 0; - } - - Connect_Instance::Connect_Instance (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong connectionRef, - const ::CORBA::Any &provided_ref, - const char *inst_type, - Event_Future holder) - : Deployment_Event (holder, inst_type), - plan_ (plan), - connectionRef_ (connectionRef), - provided_ref_ (provided_ref) - { - } - - Connect_Instance::~Connect_Instance (void) - { - } - - - int - Connect_Instance::call (void) - { - const char *name = this->plan_.connection[this->connectionRef_].name.in (); - - DANCE_DEBUG (10, (LM_TRACE, DLINFO - ACE_TEXT ("Connect_Instance::call - ") - ACE_TEXT ("Entering Connect_Instance for connection %C\n"), - name)); - try - { - DANCE_DEBUG (10, (LM_TRACE, DLINFO - ACE_TEXT ("Connect_Instance::call - ") - ACE_TEXT ("Invoking pre-conneciton interceptors\n"))); - - const Plugin_Manager::CONN_INTERCEPTORS &conn_int = - PLUGIN_MANAGER::instance ()->fetch_connection_interceptors (); - - for (Plugin_Manager::CONN_INTERCEPTORS::const_iterator i = conn_int.begin (); - i != conn_int.end (); - ++i) - { - (*i)->instance_pre_connect (this->plan_, - this->connectionRef_, - this->provided_ref_); - } - - ::CORBA::Any_var instance_excep; - - try - { - ::DAnCE::InstanceDeploymentHandler_var handler = - PLUGIN_MANAGER::instance ()->fetch_installation_handler (this->instance_type_.c_str ()); - - if (CORBA::is_nil (handler)) - { - throw ::Deployment::StartError (name, - "Unable to load appropriate instance handler"); - } - - DANCE_DEBUG (10, (LM_TRACE, DLINFO - ACE_TEXT ("Connect_Instance::call - ") - ACE_TEXT ("Invoking connect_instance on handler\n"))); - - handler->connect_instance (this->plan_, - this->connectionRef_, - this->provided_ref_); - - DANCE_DEBUG (10, (LM_TRACE, DLINFO - ACE_TEXT ("Connect_Instance::call - ") - ACE_TEXT ("connect_instance successfull completed\n"))); - } - catch (CORBA::Exception &ex_tmp) - { - DANCE_ERROR (3, (LM_ERROR, DLINFO - ACE_TEXT ("Connect_Instance::call - ") - ACE_TEXT ("CORBA Exception propagated from connect_instance\n"))); - - CORBA::Any *tmp = 0; - ACE_NEW_THROW_EX (tmp, - CORBA::Any, - CORBA::NO_MEMORY ()); - instance_excep = tmp; - *tmp <<= ex_tmp; - } - catch (...) - { - DANCE_ERROR (3, (LM_ERROR, DLINFO - ACE_TEXT ("Connect_Instance::call - ") - ACE_TEXT ("C++ Exception propagated from connect_instance\n"))); - - ::Deployment::InvalidConnection ex_tmp (name, - "Unknown C++ exception\n"); - CORBA::Any *tmp = 0; - ACE_NEW_THROW_EX (tmp, - CORBA::Any, - CORBA::NO_MEMORY ()); - instance_excep = tmp; - *tmp <<= ex_tmp; - } - - DANCE_DEBUG (10, (LM_TRACE, DLINFO - ACE_TEXT ("Install_Instance::call - ") - ACE_TEXT ("Invoking post-install interceptors\n"))); - for (Plugin_Manager::CONN_INTERCEPTORS::const_iterator i = conn_int.begin (); - i != conn_int.end (); - ++i) - { - (*i)->instance_post_connect (this->plan_, - this->connectionRef_, - instance_excep.in ()); - } - - Event_Result result (name, false); - - this->holder_.set (result); - } - catch (CORBA::Exception &ex) - { - DANCE_ERROR (1, (LM_ERROR, DLINFO - ACE_TEXT ("Connect_Instance::call - ") - ACE_TEXT ("Exception propagated out of interceptors for connection <%C>: %C\n"), - name, - ex._info ().c_str ())); - - Event_Result result (name, true); - - CORBA::Any *tmp = 0; - ACE_NEW_NORETURN (tmp, - CORBA::Any); - - if (tmp) - { - result.contents_ = tmp; - *tmp <<= ex; - } - - this->holder_.set (result); - return -1; - } - - return 0; - } - - - Remove_Instance::Remove_Instance (::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - const CORBA::Any &reference, - const char *inst_type, - Event_Future holder) - : Deployment_Event (holder, inst_type), - plan_ (plan), - instanceRef_ (instanceRef), - reference_ (reference) - { - } - - Remove_Instance::~Remove_Instance (void) - { - } - - int - Remove_Instance::call (void) - { - DANCE_DEBUG (10, (LM_TRACE, DLINFO - ACE_TEXT ("Remove_Instance::call - ") - ACE_TEXT ("Entering Remove_Instance\n"))); - - const char *name = this->plan_.instance[this->instanceRef_].name.in (); - - try - { - ::Deployment::MonolithicDeploymentDescription &mdd = - this->plan_.implementation[this->plan_.instance[this->instanceRef_].implementationRef]; - - const char *inst_type = - DAnCE::Utility::get_instance_type (mdd.execParameter); - - if (inst_type == 0) - { - throw ::Deployment::StopError (name, - "Invalid instance type\n"); - } - - ::DAnCE::InstanceDeploymentHandler_var handler = - PLUGIN_MANAGER::instance ()->fetch_installation_handler (inst_type); - - if (CORBA::is_nil (handler)) - { - throw ::Deployment::StopError (name, - "Unable to load appropriate instance handler"); - } - - DANCE_DEBUG (10, (LM_TRACE, DLINFO - ACE_TEXT ("Remove_Instance::call - ") - ACE_TEXT ("Invoking remove_instance on handler for type <%C>\n"), - inst_type)); - handler->remove_instance (this->plan_, - this->instanceRef_, - this->reference_); - DANCE_DEBUG (10, (LM_TRACE, DLINFO - ACE_TEXT ("Remove_Instance::call - ") - ACE_TEXT ("remove_instance completed\n"))); - - } - catch (CORBA::Exception &ex) - { - DANCE_ERROR (3, (LM_ERROR, DLINFO - ACE_TEXT ("Remove_Instance::call - ") - ACE_TEXT ("Caught CORBA exception while removeing instance ") - ACE_TEXT ("%u:<%C>\n"), - this->instanceRef_, - name)); - - ::Deployment::StopError ex_tmp (name, - ex._info ().c_str ()); - Event_Result result (name, true); - - CORBA::Any *tmp = 0; - ACE_NEW_NORETURN (tmp, - CORBA::Any); - - if (tmp) - { - result.contents_ = tmp; - *tmp <<= ex; - } - - this->holder_.set (result); - return -1; - } - - Event_Result result (name, false); - - this->holder_.set (result); - - return 0; - } -} diff --git a/CIAO/DAnCE/LocalityManager/Scheduler/Deployment_Events.h b/CIAO/DAnCE/LocalityManager/Scheduler/Deployment_Events.h deleted file mode 100644 index d365e479744..00000000000 --- a/CIAO/DAnCE/LocalityManager/Scheduler/Deployment_Events.h +++ /dev/null @@ -1,102 +0,0 @@ -/** - * @file Deployment_Events.h - * @author William R. Otte <wotte@dre.vanderbilt.eud> - * - * $Id$ - * - * This file contains all schedulable deployment events. - */ - -#ifndef DEPLOYMENT_EVENTS_H -#define DEPLOYMENT_EVENTS_H - -#include /**/ "ace/pre.h" - -#include "ace/Method_Request.h" -#include "ace/Future.h" -#include "Deployment/Deployment_DeploymentPlanC.h" -#include "LocalityManager/Scheduler/Deployment_Scheduler_export.h" -#include "LocalityManager/Scheduler/Deployment_Event.h" - -namespace DAnCE -{ - class Deployment_Scheduler_Export Deployment_Event : - public virtual ACE_Method_Request - { - public: - Deployment_Event (Event_Future holder, - const char *instance_type); - - Event_Future get_future (void); - - protected: - Event_Future holder_; - std::string instance_type_; - }; - - class Deployment_Scheduler_Export Install_Instance : - public virtual Deployment_Event - { - public: - Install_Instance (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - const char *instance_type, - Event_Future holder); - - virtual ~Install_Instance (void); - - virtual int call (void); - - private: - ::Deployment::DeploymentPlan plan_; - ::CORBA::ULong instanceRef_; - }; - - class Deployment_Scheduler_Export Connect_Instance : - public virtual Deployment_Event - { - public: - Connect_Instance (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong connectionRef, - const ::CORBA::Any &provided_ref, - const char *instance_type, - Event_Future holder); - - virtual ~Connect_Instance (void); - - virtual int call (void); - - private: - ::Deployment::DeploymentPlan plan_; - ::CORBA::ULong connectionRef_; - ::CORBA::Any provided_ref_; - }; - - class Deployment_Scheduler_Export Remove_Instance : - public virtual Deployment_Event - { - public: - Remove_Instance (::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - const CORBA::Any &reference, - const char *instance_type, - Event_Future holder); - - virtual ~Remove_Instance (void); - - virtual int call (void); - - private: - ::Deployment::DeploymentPlan & plan_; - ::CORBA::ULong instanceRef_; - ::CORBA::Any reference_; - }; -} - -#if defined (__ACE_INLINE__) -#include "LocalityManager/Scheduler/Deployment_Events.inl" -#endif - -#include /**/ "ace/post.h" - -#endif diff --git a/CIAO/DAnCE/LocalityManager/Scheduler/Deployment_Events.inl b/CIAO/DAnCE/LocalityManager/Scheduler/Deployment_Events.inl deleted file mode 100644 index a5be9d429cb..00000000000 --- a/CIAO/DAnCE/LocalityManager/Scheduler/Deployment_Events.inl +++ /dev/null @@ -1,25 +0,0 @@ -// $Id$ - -#ifndef DEPLOYMENT_EVENTS_INL -#define DEPLOYMENT_EVENTS_INL - -namespace DAnCE -{ - ACE_INLINE - Deployment_Event::Deployment_Event (Event_Future holder, - const char *inst_type) - : holder_ (holder), - instance_type_ (inst_type) - { - } - - ACE_INLINE - Event_Future - Deployment_Event::get_future (void) - { - return holder_; - } -} - -#endif - diff --git a/CIAO/DAnCE/LocalityManager/Scheduler/Deployment_Scheduler.h b/CIAO/DAnCE/LocalityManager/Scheduler/Deployment_Scheduler.h index ed76600c310..dd1a446aacb 100644 --- a/CIAO/DAnCE/LocalityManager/Scheduler/Deployment_Scheduler.h +++ b/CIAO/DAnCE/LocalityManager/Scheduler/Deployment_Scheduler.h @@ -10,7 +10,7 @@ #include "ace/Task.h" #include "ace/Activation_Queue.h" -#include "LocalityManager/Scheduler/Deployment_Events.h" +#include "LocalityManager/Scheduler/Deployment_Event.h" namespace DAnCE { diff --git a/CIAO/DAnCE/LocalityManager/Scheduler/Events/Configured.cpp b/CIAO/DAnCE/LocalityManager/Scheduler/Events/Configured.cpp new file mode 100644 index 00000000000..e0f68bddbe2 --- /dev/null +++ b/CIAO/DAnCE/LocalityManager/Scheduler/Events/Configured.cpp @@ -0,0 +1,105 @@ +// $Id$ +#include "Configured.h" + +#include "tao/AnyTypeCode/ExceptionA.h" +#include "Logger/Log_Macros.h" +#include "Deployment/Deployment_StartErrorC.h" +#include "DAnCE/DAnCE_DeploymentInterceptorsC.h" +#include "DAnCE/DAnCE_LocalityManagerC.h" +#include "DAnCE/DAnCE_Utility.h" +#include "LocalityManager/Scheduler/Deployment_Event.h" +#include "LocalityManager/Scheduler/Plugin_Manager.h" + +namespace DAnCE +{ + Instance_Configured::Instance_Configured (::Deployment::DeploymentPlan & plan, + ::CORBA::ULong instanceRef, + const char *inst_type, + Event_Future holder) + : Deployment_Event (holder, inst_type), + plan_ (plan), + instanceRef_ (instanceRef) + { + } + + Instance_Configured::~Instance_Configured (void) + { + } + + int + Instance_Configured::call (void) + { + DANCE_DEBUG (10, (LM_TRACE, DLINFO + ACE_TEXT ("Instance_Configured::call - ") + ACE_TEXT ("Entering Instance_Configured\n"))); + + const char *name = this->plan_.instance[this->instanceRef_].name.in (); + + try + { + ::Deployment::MonolithicDeploymentDescription &mdd = + this->plan_.implementation[this->plan_.instance[this->instanceRef_].implementationRef]; + + const char *inst_type = + DAnCE::Utility::get_instance_type (mdd.execParameter); + + if (inst_type == 0) + { + throw ::Deployment::StartError (name, + "Invalid instance type\n"); + } + + ::DAnCE::InstanceDeploymentHandler_var handler = + PLUGIN_MANAGER::instance ()->fetch_installation_handler (inst_type); + + if (CORBA::is_nil (handler)) + { + throw ::Deployment::StartError (name, + "Unable to load appropriate instance handler"); + } + + DANCE_DEBUG (10, (LM_TRACE, DLINFO + ACE_TEXT ("Instance_Configured::call - ") + ACE_TEXT ("Invoking activate_instance on handler for type <%C>\n"), + inst_type)); + handler->instance_configured (this->plan_, + this->instanceRef_); + DANCE_DEBUG (10, (LM_TRACE, DLINFO + ACE_TEXT ("Instance_Configured::call - ") + ACE_TEXT ("instance_configured completed\n"))); + + } + catch (CORBA::Exception &ex) + { + DANCE_ERROR (3, (LM_ERROR, DLINFO + ACE_TEXT ("Instance_Configured::call - ") + ACE_TEXT ("Caught CORBA exception while starting instance ") + ACE_TEXT ("%u:<%C>\n"), + this->instanceRef_, + name)); + + ::Deployment::StartError ex_tmp (name, + ex._info ().c_str ()); + Event_Result result (name, true); + + CORBA::Any *tmp = 0; + ACE_NEW_NORETURN (tmp, + CORBA::Any); + + if (tmp) + { + result.contents_ = tmp; + *tmp <<= ex; + } + + this->holder_.set (result); + return -1; + } + + Event_Result result (name, false); + + this->holder_.set (result); + + return 0; + } +} diff --git a/CIAO/DAnCE/LocalityManager/Scheduler/Events/Configured.h b/CIAO/DAnCE/LocalityManager/Scheduler/Events/Configured.h new file mode 100644 index 00000000000..0890cf690df --- /dev/null +++ b/CIAO/DAnCE/LocalityManager/Scheduler/Events/Configured.h @@ -0,0 +1,40 @@ +/** + * @file Configured.h + * @author William R. Otte <wotte@dre.vanderbilt.edu> + * + * $Id$ + * + */ + +#ifndef EVENT_CONFIGURED_H +#define EVENT_CONFIGURED_H + +#include "LocalityManager/Scheduler/Deployment_Scheduler_export.h" +#include "LocalityManager/Scheduler/Deployment_Event.h" +#include "Deployment/Deployment_DeploymentPlanC.h" + +namespace DAnCE +{ + /** + * @class + */ + class Deployment_Scheduler_Export Instance_Configured : + public virtual Deployment_Event + { + public: + Instance_Configured (::Deployment::DeploymentPlan & plan, + ::CORBA::ULong instanceRef, + const char *instance_type, + Event_Future holder); + + virtual ~Instance_Configured (void); + + virtual int call (void); + + private: + ::Deployment::DeploymentPlan &plan_; + ::CORBA::ULong instanceRef_; + }; +} + +#endif diff --git a/CIAO/DAnCE/LocalityManager/Scheduler/Events/Connect.cpp b/CIAO/DAnCE/LocalityManager/Scheduler/Events/Connect.cpp new file mode 100644 index 00000000000..8e509e8cfff --- /dev/null +++ b/CIAO/DAnCE/LocalityManager/Scheduler/Events/Connect.cpp @@ -0,0 +1,155 @@ +// $Id$ +#include "Connect.h" + +#include "tao/AnyTypeCode/ExceptionA.h" +#include "Logger/Log_Macros.h" +#include "Deployment/Deployment_StartErrorC.h" +#include "DAnCE/DAnCE_DeploymentInterceptorsC.h" +#include "DAnCE/DAnCE_LocalityManagerC.h" +#include "DAnCE/DAnCE_Utility.h" +#include "LocalityManager/Scheduler/Deployment_Event.h" +#include "LocalityManager/Scheduler/Plugin_Manager.h" + +namespace DAnCE +{ + Connect_Instance::Connect_Instance (::Deployment::DeploymentPlan & plan, + ::CORBA::ULong connectionRef, + const ::CORBA::Any &provided_ref, + const char *inst_type, + Event_Future holder) + : Deployment_Event (holder, inst_type), + plan_ (plan), + connectionRef_ (connectionRef), + provided_ref_ (provided_ref) + { + } + + Connect_Instance::~Connect_Instance (void) + { + } + + + int + Connect_Instance::call (void) + { + const char *name = this->plan_.connection[this->connectionRef_].name.in (); + + DANCE_DEBUG (10, (LM_TRACE, DLINFO + ACE_TEXT ("Connect_Instance::call - ") + ACE_TEXT ("Entering Connect_Instance for connection %C\n"), + name)); + try + { + DANCE_DEBUG (10, (LM_TRACE, DLINFO + ACE_TEXT ("Connect_Instance::call - ") + ACE_TEXT ("Invoking pre-conneciton interceptors\n"))); + + const Plugin_Manager::CONN_INTERCEPTORS &conn_int = + PLUGIN_MANAGER::instance ()->fetch_connection_interceptors (); + + for (Plugin_Manager::CONN_INTERCEPTORS::const_iterator i = conn_int.begin (); + i != conn_int.end (); + ++i) + { + (*i)->instance_pre_connect (this->plan_, + this->connectionRef_, + this->provided_ref_); + } + + ::CORBA::Any_var instance_excep; + + try + { + ::DAnCE::InstanceDeploymentHandler_var handler = + PLUGIN_MANAGER::instance ()->fetch_installation_handler (this->instance_type_.c_str ()); + + if (CORBA::is_nil (handler)) + { + throw ::Deployment::StartError (name, + "Unable to load appropriate instance handler"); + } + + DANCE_DEBUG (10, (LM_TRACE, DLINFO + ACE_TEXT ("Connect_Instance::call - ") + ACE_TEXT ("Invoking connect_instance on handler\n"))); + + handler->connect_instance (this->plan_, + this->connectionRef_, + this->provided_ref_); + + DANCE_DEBUG (10, (LM_TRACE, DLINFO + ACE_TEXT ("Connect_Instance::call - ") + ACE_TEXT ("connect_instance successfull completed\n"))); + } + catch (CORBA::Exception &ex_tmp) + { + DANCE_ERROR (3, (LM_ERROR, DLINFO + ACE_TEXT ("Connect_Instance::call - ") + ACE_TEXT ("CORBA Exception propagated from connect_instance\n"))); + + CORBA::Any *tmp = 0; + ACE_NEW_THROW_EX (tmp, + CORBA::Any, + CORBA::NO_MEMORY ()); + instance_excep = tmp; + *tmp <<= ex_tmp; + } + catch (...) + { + DANCE_ERROR (3, (LM_ERROR, DLINFO + ACE_TEXT ("Connect_Instance::call - ") + ACE_TEXT ("C++ Exception propagated from connect_instance\n"))); + + ::Deployment::InvalidConnection ex_tmp (name, + "Unknown C++ exception\n"); + CORBA::Any *tmp = 0; + ACE_NEW_THROW_EX (tmp, + CORBA::Any, + CORBA::NO_MEMORY ()); + instance_excep = tmp; + *tmp <<= ex_tmp; + } + + DANCE_DEBUG (10, (LM_TRACE, DLINFO + ACE_TEXT ("Install_Instance::call - ") + ACE_TEXT ("Invoking post-install interceptors\n"))); + for (Plugin_Manager::CONN_INTERCEPTORS::const_iterator i = conn_int.begin (); + i != conn_int.end (); + ++i) + { + (*i)->instance_post_connect (this->plan_, + this->connectionRef_, + instance_excep.in ()); + } + + Event_Result result (name, false); + + this->holder_.set (result); + } + catch (CORBA::Exception &ex) + { + DANCE_ERROR (1, (LM_ERROR, DLINFO + ACE_TEXT ("Connect_Instance::call - ") + ACE_TEXT ("Exception propagated out of interceptors for connection <%C>: %C\n"), + name, + ex._info ().c_str ())); + + Event_Result result (name, true); + + CORBA::Any *tmp = 0; + ACE_NEW_NORETURN (tmp, + CORBA::Any); + + if (tmp) + { + result.contents_ = tmp; + *tmp <<= ex; + } + + this->holder_.set (result); + return -1; + } + + return 0; + } +} diff --git a/CIAO/DAnCE/LocalityManager/Scheduler/Events/Connect.h b/CIAO/DAnCE/LocalityManager/Scheduler/Events/Connect.h new file mode 100644 index 00000000000..60c6b09dd6c --- /dev/null +++ b/CIAO/DAnCE/LocalityManager/Scheduler/Events/Connect.h @@ -0,0 +1,42 @@ +/** + * @file Connect.h + * @author William R. Otte <wotte@dre.vanderbilt.edu> + * + * $Id$ + * + */ + +#ifndef EVENT_CONNECT_H +#define EVENT_CONNECT_H + +#include "LocalityManager/Scheduler/Deployment_Scheduler_export.h" +#include "LocalityManager/Scheduler/Deployment_Event.h" +#include "Deployment/Deployment_DeploymentPlanC.h" + +namespace DAnCE +{ + /** + * @class + */ + class Deployment_Scheduler_Export Connect_Instance : + public virtual Deployment_Event + { + public: + Connect_Instance (::Deployment::DeploymentPlan & plan, + ::CORBA::ULong connectionRef, + const ::CORBA::Any &provided_ref, + const char *instance_type, + Event_Future holder); + + virtual ~Connect_Instance (void); + + virtual int call (void); + + private: + ::Deployment::DeploymentPlan &plan_; + ::CORBA::ULong connectionRef_; + ::CORBA::Any provided_ref_; + }; +} + +#endif diff --git a/CIAO/DAnCE/LocalityManager/Scheduler/Events/Endpoint.cpp b/CIAO/DAnCE/LocalityManager/Scheduler/Events/Endpoint.cpp new file mode 100644 index 00000000000..fdc836aeee0 --- /dev/null +++ b/CIAO/DAnCE/LocalityManager/Scheduler/Events/Endpoint.cpp @@ -0,0 +1,101 @@ +// $Id$ +#include "Endpoint.h" + +#include "tao/AnyTypeCode/ExceptionA.h" +#include "Logger/Log_Macros.h" +#include "Deployment/Deployment_StartErrorC.h" +#include "DAnCE/DAnCE_DeploymentInterceptorsC.h" +#include "DAnCE/DAnCE_LocalityManagerC.h" +#include "DAnCE/DAnCE_Utility.h" +#include "LocalityManager/Scheduler/Deployment_Event.h" +#include "LocalityManager/Scheduler/Plugin_Manager.h" + +namespace DAnCE +{ + Endpoint_Reference::Endpoint_Reference (::Deployment::DeploymentPlan & plan, + ::CORBA::ULong connectionRef, + const char *inst_type, + Event_Future holder) + : Deployment_Event (holder, inst_type), + plan_ (plan), + connectionRef_ (connectionRef) + { + } + + Endpoint_Reference::~Endpoint_Reference (void) + { + } + + int + Endpoint_Reference::call (void) + { + const char *name = this->plan_.connection[this->connectionRef_].name.in (); + + DANCE_DEBUG (10, (LM_TRACE, DLINFO + ACE_TEXT ("Endpoint_Reference::call - ") + ACE_TEXT ("Entering Endpoint_Reference for connection <%C>\n"), + name));; + + try + { + if (this->instance_type_.c_str () == 0) + { + throw ::Deployment::StartError (name, + "Invalid instance type\n"); + } + + ::DAnCE::InstanceDeploymentHandler_var handler = + PLUGIN_MANAGER::instance ()->fetch_installation_handler (this->instance_type_.c_str ()); + + if (CORBA::is_nil (handler)) + { + throw ::Deployment::StartError (name, + "Unable to load appropriate instance handler"); + } + + DANCE_DEBUG (10, (LM_TRACE, DLINFO + ACE_TEXT ("Endpoint_Reference::call - ") + ACE_TEXT ("Invoking activate_instance on handler for type <%C>\n"), + this->instance_type_.c_str ())); + CORBA::Any_var ref; + handler->provide_endpoint_reference (this->plan_, + this->connectionRef_, + ref.out ()); + DANCE_DEBUG (10, (LM_TRACE, DLINFO + ACE_TEXT ("Endpoint_Reference::call - ") + ACE_TEXT ("endpoint_reference completed for <%C>\n"), + name)); + + Event_Result result (name, false, ref._retn ()); + this->holder_.set (result); + } + catch (CORBA::Exception &ex) + { + DANCE_ERROR (3, (LM_ERROR, DLINFO + ACE_TEXT ("Endpoint_Reference::call - ") + ACE_TEXT ("Caught CORBA exception while getting endpoint ") + ACE_TEXT ("%u:<%C>\n"), + this->connectionRef_, + name)); + + ::Deployment::InvalidConnection ex_tmp (name, + ex._info ().c_str ()); + Event_Result result (name, true); + + CORBA::Any *tmp = 0; + ACE_NEW_NORETURN (tmp, + CORBA::Any); + + if (tmp) + { + result.contents_ = tmp; + *tmp <<= ex; + } + + this->holder_.set (result); + return -1; + } + + return 0; + } +} diff --git a/CIAO/DAnCE/LocalityManager/Scheduler/Events/Endpoint.h b/CIAO/DAnCE/LocalityManager/Scheduler/Events/Endpoint.h new file mode 100644 index 00000000000..3df344178d1 --- /dev/null +++ b/CIAO/DAnCE/LocalityManager/Scheduler/Events/Endpoint.h @@ -0,0 +1,40 @@ +/** + * @file Endpoint.h + * @author William R. Otte <wotte@dre.vanderbilt.edu> + * + * $Id$ + * + */ + +#ifndef EVENT_ENDPOINT_H +#define EVENT_ENDPOINT_H + +#include "LocalityManager/Scheduler/Deployment_Scheduler_export.h" +#include "LocalityManager/Scheduler/Deployment_Event.h" +#include "Deployment/Deployment_DeploymentPlanC.h" + +namespace DAnCE +{ + /** + * @class + */ + class Deployment_Scheduler_Export Endpoint_Reference : + public virtual Deployment_Event + { + public: + Endpoint_Reference (::Deployment::DeploymentPlan & plan, + ::CORBA::ULong connectionRef, + const char *instance_type, + Event_Future holder); + + virtual ~Endpoint_Reference (void); + + virtual int call (void); + + private: + ::Deployment::DeploymentPlan &plan_; + ::CORBA::ULong connectionRef_; + }; +} + +#endif diff --git a/CIAO/DAnCE/LocalityManager/Scheduler/Events/Install.cpp b/CIAO/DAnCE/LocalityManager/Scheduler/Events/Install.cpp new file mode 100644 index 00000000000..b7c7283946a --- /dev/null +++ b/CIAO/DAnCE/LocalityManager/Scheduler/Events/Install.cpp @@ -0,0 +1,172 @@ +// $Id$ +#include "Install.h" + +#include "tao/AnyTypeCode/ExceptionA.h" +#include "Logger/Log_Macros.h" +#include "Deployment/Deployment_StartErrorC.h" +#include "DAnCE/DAnCE_DeploymentInterceptorsC.h" +#include "DAnCE/DAnCE_LocalityManagerC.h" +#include "DAnCE/DAnCE_Utility.h" +#include "LocalityManager/Scheduler/Deployment_Event.h" +#include "LocalityManager/Scheduler/Plugin_Manager.h" + +namespace DAnCE +{ + Install_Instance::Install_Instance (::Deployment::DeploymentPlan & plan, + ::CORBA::ULong instanceRef, + const char *inst_type, + Event_Future holder) + : Deployment_Event (holder, inst_type), + plan_ (plan), + instanceRef_ (instanceRef) + { + } + + Install_Instance::~Install_Instance (void) + { + } + + int + Install_Instance::call (void) + { + DANCE_DEBUG (10, (LM_TRACE, DLINFO + ACE_TEXT ("Install_Instance::call - ") + ACE_TEXT ("Entering Install_Instance\n"))); + + const char *name = this->plan_.instance[this->instanceRef_].name.in (); + + try + { + const Plugin_Manager::INST_INTERCEPTORS &interceptors = + PLUGIN_MANAGER::instance ()->fetch_installation_interceptors (); + + DANCE_DEBUG (10, (LM_TRACE, DLINFO + ACE_TEXT ("Install_Instance::call - ") + ACE_TEXT ("Invoking pre-install interceptors\n"))); + for (Plugin_Manager::INST_INTERCEPTORS::const_iterator i = interceptors.begin (); + i != interceptors.end (); + ++i) + { + (*i)->instance_pre_install (this->plan_, + this->instanceRef_); + } + + ::Deployment::MonolithicDeploymentDescription &mdd = + this->plan_.implementation[this->plan_.instance[this->instanceRef_].implementationRef]; + + const char *inst_type = + DAnCE::Utility::get_instance_type (mdd.execParameter); + + if (inst_type == 0) + { + throw ::Deployment::PlanError (name, + "Invalid instance type\n"); + } + + ::DAnCE::InstanceDeploymentHandler_var handler = + PLUGIN_MANAGER::instance ()->fetch_installation_handler (inst_type); + + if (CORBA::is_nil (handler)) + { + throw ::Deployment::StartError (name, + "Unable to load appropriate instance handler"); + } + + ::CORBA::Any_var instance_ref; + ::CORBA::Any_var instance_excep; + + try + { + DANCE_DEBUG (10, (LM_TRACE, DLINFO + ACE_TEXT ("Install_Instance::call - ") + ACE_TEXT ("Invoking install_instance on handler for type <%C>\n"), + inst_type)); + handler->install_instance (this->plan_, + this->instanceRef_, + instance_ref.out ()); + DANCE_DEBUG (10, (LM_TRACE, DLINFO + ACE_TEXT ("Install_Instance::call - ") + ACE_TEXT ("install_instance completed\n"))); + } + catch (CORBA::Exception &ex) + { + DANCE_ERROR (3, (LM_ERROR, DLINFO + ACE_TEXT ("Install_Instance::call - ") + ACE_TEXT ("Caught CORBA exception while installing instance ") + ACE_TEXT ("%u:<%C>\n"), + this->instanceRef_, + name)); + CORBA::Any *tmp = 0; + ACE_NEW_THROW_EX (tmp, + CORBA::Any, + CORBA::NO_MEMORY ()); + instance_excep = tmp; + *tmp <<= ex; + } + catch (...) + { + DANCE_ERROR (3, (LM_ERROR, DLINFO + ACE_TEXT ("Install_Instance::call - ") + ACE_TEXT ("Caught C++ exception while installing instance ") + ACE_TEXT ("%u:<%C>\n"), + this->instanceRef_, + name)); + + ::Deployment::StartError ex_tmp (name, + "Caught unknown C++ exception from install"); + CORBA::Any *tmp = 0; + ACE_NEW_THROW_EX (tmp, + CORBA::Any, + CORBA::NO_MEMORY ()); + instance_excep = tmp; + *tmp <<= ex_tmp; + } + + DANCE_DEBUG (10, (LM_TRACE, DLINFO + ACE_TEXT ("Install_Instance::call - ") + ACE_TEXT ("Invoking post-install interceptors\n"))); + for (Plugin_Manager::INST_INTERCEPTORS::const_iterator i = interceptors.begin (); + i != interceptors.end (); + ++i) + { + (*i)->instance_post_install (this->plan_, + this->instanceRef_, + instance_ref.in (), + instance_excep.in ()); + } + + Event_Result result (name, false, instance_ref._retn ()); + + DANCE_DEBUG (10, (LM_TRACE, DLINFO + ACE_TEXT ("Install_Instance::call - ") + ACE_TEXT ("Signaling result for instance <%C>\n"), + name)); + this->holder_.set (result); + } + catch (CORBA::Exception &ex) + { + DANCE_ERROR (3, (LM_ERROR, DLINFO + ACE_TEXT ("Install_Instance::call - ") + ACE_TEXT ("CORBA Exception propagated from interceptors for instance ") + ACE_TEXT ("%u:<%C>\n"), + this->instanceRef_, + name)); + + Event_Result result (name, true); + + CORBA::Any *tmp = 0; + ACE_NEW_NORETURN (tmp, + CORBA::Any); + + if (tmp) + { + result.contents_ = tmp; + *tmp <<= ex; + } + + this->holder_.set (result); + return -1; + } + return 0; + } +} diff --git a/CIAO/DAnCE/LocalityManager/Scheduler/Events/Install.h b/CIAO/DAnCE/LocalityManager/Scheduler/Events/Install.h new file mode 100644 index 00000000000..8f2d485a144 --- /dev/null +++ b/CIAO/DAnCE/LocalityManager/Scheduler/Events/Install.h @@ -0,0 +1,40 @@ +/** + * @file Insall.h + * @author William R. Otte <wotte@dre.vanderbilt.edu> + * + * $Id$ + * + */ + +#ifndef EVENT_INSTALL_H +#define EVENT_INSTALL_H + +#include "LocalityManager/Scheduler/Deployment_Scheduler_export.h" +#include "LocalityManager/Scheduler/Deployment_Event.h" +#include "Deployment/Deployment_DeploymentPlanC.h" + +namespace DAnCE +{ + /** + * @class + */ + class Deployment_Scheduler_Export Install_Instance : + public virtual Deployment_Event + { + public: + Install_Instance (::Deployment::DeploymentPlan & plan, + ::CORBA::ULong instanceRef, + const char *instance_type, + Event_Future holder); + + virtual ~Install_Instance (void); + + virtual int call (void); + + private: + ::Deployment::DeploymentPlan &plan_; + ::CORBA::ULong instanceRef_; + }; +} + +#endif diff --git a/CIAO/DAnCE/LocalityManager/Scheduler/Events/Passivate.cpp b/CIAO/DAnCE/LocalityManager/Scheduler/Events/Passivate.cpp new file mode 100644 index 00000000000..f976d5ffdff --- /dev/null +++ b/CIAO/DAnCE/LocalityManager/Scheduler/Events/Passivate.cpp @@ -0,0 +1,108 @@ +// $Id$ +#include "Passivate.h" + +#include "tao/AnyTypeCode/ExceptionA.h" +#include "Logger/Log_Macros.h" +#include "Deployment/Deployment_StartErrorC.h" +#include "DAnCE/DAnCE_DeploymentInterceptorsC.h" +#include "DAnCE/DAnCE_LocalityManagerC.h" +#include "DAnCE/DAnCE_Utility.h" +#include "LocalityManager/Scheduler/Deployment_Event.h" +#include "LocalityManager/Scheduler/Plugin_Manager.h" + +namespace DAnCE +{ + Passivate_Instance::Passivate_Instance (::Deployment::DeploymentPlan & plan, + ::CORBA::ULong instanceRef, + const CORBA::Any &ref, + const char *inst_type, + Event_Future holder) + : Deployment_Event (holder, inst_type), + plan_ (plan), + instanceRef_ (instanceRef), + ref_ (ref) + { + } + + Passivate_Instance::~Passivate_Instance (void) + { + } + + int + Passivate_Instance::call (void) + { + DANCE_DEBUG (10, (LM_TRACE, DLINFO + ACE_TEXT ("Passivate_Instance::call - ") + ACE_TEXT ("Entering Passivate_Instance\n"))); + + const char *name = this->plan_.instance[this->instanceRef_].name.in (); + + try + { + ::Deployment::MonolithicDeploymentDescription &mdd = + this->plan_.implementation[this->plan_.instance[this->instanceRef_].implementationRef]; + + const char *inst_type = + DAnCE::Utility::get_instance_type (mdd.execParameter); + + if (inst_type == 0) + { + throw ::Deployment::StopError (name, + "Invalid instance type\n"); + } + + ::DAnCE::InstanceDeploymentHandler_var handler = + PLUGIN_MANAGER::instance ()->fetch_installation_handler (inst_type); + + if (CORBA::is_nil (handler)) + { + throw ::Deployment::StopError (name, + "Unable to load appropriate instance handler"); + } + + DANCE_DEBUG (10, (LM_TRACE, DLINFO + ACE_TEXT ("Passivate_Instance::call - ") + ACE_TEXT ("Invoking activate_instance on handler for type <%C>\n"), + inst_type)); + handler->passivate_instance (this->plan_, + this->instanceRef_, + this->ref_); + DANCE_DEBUG (10, (LM_TRACE, DLINFO + ACE_TEXT ("Passivate_Instance::call - ") + ACE_TEXT ("passivate_instance completed\n"))); + + } + catch (CORBA::Exception &ex) + { + DANCE_ERROR (3, (LM_ERROR, DLINFO + ACE_TEXT ("Passivate_Instance::call - ") + ACE_TEXT ("Caught CORBA exception while passivating instance ") + ACE_TEXT ("%u:<%C>\n"), + this->instanceRef_, + name)); + + ::Deployment::StopError ex_tmp (name, + ex._info ().c_str ()); + Event_Result result (name, true); + + CORBA::Any *tmp = 0; + ACE_NEW_NORETURN (tmp, + CORBA::Any); + + if (tmp) + { + result.contents_ = tmp; + *tmp <<= ex; + } + + this->holder_.set (result); + return -1; + } + + Event_Result result (name, false); + + this->holder_.set (result); + + return 0; + } +} diff --git a/CIAO/DAnCE/LocalityManager/Scheduler/Events/Passivate.h b/CIAO/DAnCE/LocalityManager/Scheduler/Events/Passivate.h new file mode 100644 index 00000000000..e8765966008 --- /dev/null +++ b/CIAO/DAnCE/LocalityManager/Scheduler/Events/Passivate.h @@ -0,0 +1,42 @@ +/** + * @file Passivate.h + * @author William R. Otte <wotte@dre.vanderbilt.edu> + * + * $Id$ + * + */ + +#ifndef EVENT_PASSIVATE_H +#define EVENT_PASSIVATE_H + +#include "LocalityManager/Scheduler/Deployment_Scheduler_export.h" +#include "LocalityManager/Scheduler/Deployment_Event.h" +#include "Deployment/Deployment_DeploymentPlanC.h" + +namespace DAnCE +{ + /** + * @class + */ + class Deployment_Scheduler_Export Passivate_Instance : + public virtual Deployment_Event + { + public: + Passivate_Instance (::Deployment::DeploymentPlan & plan, + ::CORBA::ULong instanceRef, + const CORBA::Any &ref, + const char *instance_type, + Event_Future holder); + + virtual ~Passivate_Instance (void); + + virtual int call (void); + + private: + ::Deployment::DeploymentPlan &plan_; + ::CORBA::ULong instanceRef_; + const ::CORBA::Any &ref_; + }; +} + +#endif diff --git a/CIAO/DAnCE/LocalityManager/Scheduler/Events/Remove.cpp b/CIAO/DAnCE/LocalityManager/Scheduler/Events/Remove.cpp new file mode 100644 index 00000000000..2bbe62a1d76 --- /dev/null +++ b/CIAO/DAnCE/LocalityManager/Scheduler/Events/Remove.cpp @@ -0,0 +1,108 @@ +// $Id$ +#include "Remove.h" + +#include "tao/AnyTypeCode/ExceptionA.h" +#include "Logger/Log_Macros.h" +#include "Deployment/Deployment_StartErrorC.h" +#include "DAnCE/DAnCE_DeploymentInterceptorsC.h" +#include "DAnCE/DAnCE_LocalityManagerC.h" +#include "DAnCE/DAnCE_Utility.h" +#include "LocalityManager/Scheduler/Deployment_Event.h" +#include "LocalityManager/Scheduler/Plugin_Manager.h" + +namespace DAnCE +{ + Remove_Instance::Remove_Instance (::Deployment::DeploymentPlan & plan, + ::CORBA::ULong instanceRef, + const CORBA::Any &reference, + const char *inst_type, + Event_Future holder) + : Deployment_Event (holder, inst_type), + plan_ (plan), + instanceRef_ (instanceRef), + reference_ (reference) + { + } + + Remove_Instance::~Remove_Instance (void) + { + } + + int + Remove_Instance::call (void) + { + DANCE_DEBUG (10, (LM_TRACE, DLINFO + ACE_TEXT ("Remove_Instance::call - ") + ACE_TEXT ("Entering Remove_Instance\n"))); + + const char *name = this->plan_.instance[this->instanceRef_].name.in (); + + try + { + ::Deployment::MonolithicDeploymentDescription &mdd = + this->plan_.implementation[this->plan_.instance[this->instanceRef_].implementationRef]; + + const char *inst_type = + DAnCE::Utility::get_instance_type (mdd.execParameter); + + if (inst_type == 0) + { + throw ::Deployment::StopError (name, + "Invalid instance type\n"); + } + + ::DAnCE::InstanceDeploymentHandler_var handler = + PLUGIN_MANAGER::instance ()->fetch_installation_handler (inst_type); + + if (CORBA::is_nil (handler)) + { + throw ::Deployment::StopError (name, + "Unable to load appropriate instance handler"); + } + + DANCE_DEBUG (10, (LM_TRACE, DLINFO + ACE_TEXT ("Remove_Instance::call - ") + ACE_TEXT ("Invoking remove_instance on handler for type <%C>\n"), + inst_type)); + handler->remove_instance (this->plan_, + this->instanceRef_, + this->reference_); + DANCE_DEBUG (10, (LM_TRACE, DLINFO + ACE_TEXT ("Remove_Instance::call - ") + ACE_TEXT ("remove_instance completed\n"))); + + } + catch (CORBA::Exception &ex) + { + DANCE_ERROR (3, (LM_ERROR, DLINFO + ACE_TEXT ("Remove_Instance::call - ") + ACE_TEXT ("Caught CORBA exception while removeing instance ") + ACE_TEXT ("%u:<%C>\n"), + this->instanceRef_, + name)); + + ::Deployment::StopError ex_tmp (name, + ex._info ().c_str ()); + Event_Result result (name, true); + + CORBA::Any *tmp = 0; + ACE_NEW_NORETURN (tmp, + CORBA::Any); + + if (tmp) + { + result.contents_ = tmp; + *tmp <<= ex; + } + + this->holder_.set (result); + return -1; + } + + Event_Result result (name, false); + + this->holder_.set (result); + + return 0; + } +} diff --git a/CIAO/DAnCE/LocalityManager/Scheduler/Events/Remove.h b/CIAO/DAnCE/LocalityManager/Scheduler/Events/Remove.h new file mode 100644 index 00000000000..5a64d631508 --- /dev/null +++ b/CIAO/DAnCE/LocalityManager/Scheduler/Events/Remove.h @@ -0,0 +1,42 @@ +/** + * @file Remove.h + * @author William R. Otte <wotte@dre.vanderbilt.edu> + * + * $Id$ + * + */ + +#ifndef EVENT_REMOVE_H +#define EVENT_REMOVE_H + +#include "LocalityManager/Scheduler/Deployment_Scheduler_export.h" +#include "LocalityManager/Scheduler/Deployment_Event.h" +#include "Deployment/Deployment_DeploymentPlanC.h" + +namespace DAnCE +{ + /** + * @class + */ + class Deployment_Scheduler_Export Remove_Instance : + public virtual Deployment_Event + { + public: + Remove_Instance (::Deployment::DeploymentPlan & plan, + ::CORBA::ULong instanceRef, + const CORBA::Any &reference, + const char *instance_type, + Event_Future holder); + + virtual ~Remove_Instance (void); + + virtual int call (void); + + private: + ::Deployment::DeploymentPlan & plan_; + ::CORBA::ULong instanceRef_; + ::CORBA::Any reference_; + }; +} + +#endif diff --git a/CIAO/DAnCE/LocalityManager/Scheduler/Events/Start.cpp b/CIAO/DAnCE/LocalityManager/Scheduler/Events/Start.cpp new file mode 100644 index 00000000000..ebcb274ef16 --- /dev/null +++ b/CIAO/DAnCE/LocalityManager/Scheduler/Events/Start.cpp @@ -0,0 +1,108 @@ +// $Id$ +#include "Start.h" + +#include "tao/AnyTypeCode/ExceptionA.h" +#include "Logger/Log_Macros.h" +#include "Deployment/Deployment_StartErrorC.h" +#include "DAnCE/DAnCE_DeploymentInterceptorsC.h" +#include "DAnCE/DAnCE_LocalityManagerC.h" +#include "DAnCE/DAnCE_Utility.h" +#include "LocalityManager/Scheduler/Deployment_Event.h" +#include "LocalityManager/Scheduler/Plugin_Manager.h" + +namespace DAnCE +{ + Start_Instance::Start_Instance (::Deployment::DeploymentPlan & plan, + ::CORBA::ULong instanceRef, + const CORBA::Any &ref, + const char *inst_type, + Event_Future holder) + : Deployment_Event (holder, inst_type), + plan_ (plan), + instanceRef_ (instanceRef), + ref_ (ref) + { + } + + Start_Instance::~Start_Instance (void) + { + } + + int + Start_Instance::call (void) + { + DANCE_DEBUG (10, (LM_TRACE, DLINFO + ACE_TEXT ("Start_Instance::call - ") + ACE_TEXT ("Entering Start_Instance\n"))); + + const char *name = this->plan_.instance[this->instanceRef_].name.in (); + + try + { + ::Deployment::MonolithicDeploymentDescription &mdd = + this->plan_.implementation[this->plan_.instance[this->instanceRef_].implementationRef]; + + const char *inst_type = + DAnCE::Utility::get_instance_type (mdd.execParameter); + + if (inst_type == 0) + { + throw ::Deployment::StartError (name, + "Invalid instance type\n"); + } + + ::DAnCE::InstanceDeploymentHandler_var handler = + PLUGIN_MANAGER::instance ()->fetch_installation_handler (inst_type); + + if (CORBA::is_nil (handler)) + { + throw ::Deployment::StartError (name, + "Unable to load appropriate instance handler"); + } + + DANCE_DEBUG (10, (LM_TRACE, DLINFO + ACE_TEXT ("Start_Instance::call - ") + ACE_TEXT ("Invoking activate_instance on handler for type <%C>\n"), + inst_type)); + handler->activate_instance (this->plan_, + this->instanceRef_, + this->ref_); + DANCE_DEBUG (10, (LM_TRACE, DLINFO + ACE_TEXT ("Start_Instance::call - ") + ACE_TEXT ("start_instance completed\n"))); + + } + catch (CORBA::Exception &ex) + { + DANCE_ERROR (3, (LM_ERROR, DLINFO + ACE_TEXT ("Start_Instance::call - ") + ACE_TEXT ("Caught CORBA exception while starting instance ") + ACE_TEXT ("%u:<%C>\n"), + this->instanceRef_, + name)); + + ::Deployment::StartError ex_tmp (name, + ex._info ().c_str ()); + Event_Result result (name, true); + + CORBA::Any *tmp = 0; + ACE_NEW_NORETURN (tmp, + CORBA::Any); + + if (tmp) + { + result.contents_ = tmp; + *tmp <<= ex; + } + + this->holder_.set (result); + return -1; + } + + Event_Result result (name, false); + + this->holder_.set (result); + + return 0; + } +} diff --git a/CIAO/DAnCE/LocalityManager/Scheduler/Events/Start.h b/CIAO/DAnCE/LocalityManager/Scheduler/Events/Start.h new file mode 100644 index 00000000000..53bde082f88 --- /dev/null +++ b/CIAO/DAnCE/LocalityManager/Scheduler/Events/Start.h @@ -0,0 +1,42 @@ +/** + * @file Start.h + * @author William R. Otte <wotte@dre.vanderbilt.edu> + * + * $Id$ + * + */ + +#ifndef EVENT_START_H +#define EVENT_START_H + +#include "LocalityManager/Scheduler/Deployment_Scheduler_export.h" +#include "LocalityManager/Scheduler/Deployment_Event.h" +#include "Deployment/Deployment_DeploymentPlanC.h" + +namespace DAnCE +{ + /** + * @class + */ + class Deployment_Scheduler_Export Start_Instance : + public virtual Deployment_Event + { + public: + Start_Instance (::Deployment::DeploymentPlan & plan, + ::CORBA::ULong instanceRef, + const CORBA::Any &instance_ref, + const char *instance_type, + Event_Future holder); + + virtual ~Start_Instance (void); + + virtual int call (void); + + private: + ::Deployment::DeploymentPlan &plan_; + ::CORBA::ULong instanceRef_; + const CORBA::Any &ref_; + }; +} + +#endif diff --git a/CIAO/DAnCE/LocalityManager/Scheduler/Plugin_Manager.cpp b/CIAO/DAnCE/LocalityManager/Scheduler/Plugin_Manager.cpp index 63cd4594680..a6dd66e6161 100644 --- a/CIAO/DAnCE/LocalityManager/Scheduler/Plugin_Manager.cpp +++ b/CIAO/DAnCE/LocalityManager/Scheduler/Plugin_Manager.cpp @@ -22,7 +22,7 @@ namespace DAnCE this->config_ = config; } - const char * + char * Plugin_Manager::register_installation_handler (const ACE_TCHAR *artifact, const ACE_TCHAR *entrypoint) { @@ -114,7 +114,7 @@ namespace DAnCE ACE_TEXT ("Successfully created installation handler for instance type <%C>\n"), instance_type.in ())); - return instance_type.in (); + return instance_type._retn (); } catch (const CORBA::Exception &ex) { diff --git a/CIAO/DAnCE/LocalityManager/Scheduler/Plugin_Manager.h b/CIAO/DAnCE/LocalityManager/Scheduler/Plugin_Manager.h index 6ca13baa1aa..4d5fede2f49 100644 --- a/CIAO/DAnCE/LocalityManager/Scheduler/Plugin_Manager.h +++ b/CIAO/DAnCE/LocalityManager/Scheduler/Plugin_Manager.h @@ -38,8 +38,8 @@ namespace DAnCE void set_configuration (const Deployment::Properties &config); /// Registers a new installation handler. - const char * register_installation_handler (const ACE_TCHAR *artifact, - const ACE_TCHAR *entrypoint); + char * register_installation_handler (const ACE_TCHAR *artifact, + const ACE_TCHAR *entrypoint); /// Registers a new deployment interceptor void register_interceptor (const ACE_TCHAR *artifact, diff --git a/CIAO/DAnCE/LocalityManager/Scheduler/Scheduler.mpc b/CIAO/DAnCE/LocalityManager/Scheduler/Scheduler.mpc index 9f7bada4beb..e0e057e327a 100644 --- a/CIAO/DAnCE/LocalityManager/Scheduler/Scheduler.mpc +++ b/CIAO/DAnCE/LocalityManager/Scheduler/Scheduler.mpc @@ -6,10 +6,16 @@ project(DAnCE_Deployment_Scheduler) : dance_lib, dance_output, dance_skel, dance Source_Files { Deployment_Event.cpp - Deployment_Events.cpp Plugin_Manager.cpp Deployment_Scheduler.cpp Deployment_Completion.cpp + Events/Install.cpp + Events/Remove.cpp + Events/Connect.cpp + Events/Endpoint.cpp + Events/Start.cpp + Events/Passivate.cpp + Events/Configured.cpp } Inline_Files { @@ -19,10 +25,13 @@ project(DAnCE_Deployment_Scheduler) : dance_lib, dance_output, dance_skel, dance Header_Files { Plugin_Manager.h Deployment_Event.h - Deployment_Events.h Deployment_Scheduler.h Deployment_Scheduler_export.h Deployment_Completion.h + Events/Install.h + Events/Remove.h + Events/Connect.h + Events/Endpoint.h } specific { diff --git a/CIAO/DAnCE/MPC/config/dance_completion_counter.mpb b/CIAO/DAnCE/MPC/config/dance_completion_counter.mpb new file mode 100644 index 00000000000..87d48d738dd --- /dev/null +++ b/CIAO/DAnCE/MPC/config/dance_completion_counter.mpb @@ -0,0 +1,3 @@ +project { + includes += $(DANCE_ROOT)/tools +}
\ No newline at end of file diff --git a/CIAO/DAnCE/MPC/config/dance_deployment_scheduler.mpb b/CIAO/DAnCE/MPC/config/dance_deployment_scheduler.mpb index 7bc051ba37d..bb7800e7918 100644 --- a/CIAO/DAnCE/MPC/config/dance_deployment_scheduler.mpb +++ b/CIAO/DAnCE/MPC/config/dance_deployment_scheduler.mpb @@ -1,5 +1,5 @@ // $Id$ -project : dance_skel, dance_logger { +project : dance_skel, dance_logger, dance_completion_counter { after += DAnCE_Deployment_Scheduler libs += DAnCE_Deployment_Scheduler }
\ No newline at end of file diff --git a/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp b/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp index 66d35b5b60d..f086b18104c 100644 --- a/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp +++ b/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp @@ -18,6 +18,8 @@ #include "DAnCE/DAnCE_LocalityManagerC.h" #include "DAnCE/LocalityManager/Scheduler/Plugin_Manager.h" #include "DAnCE/LocalityManager/Scheduler/Deployment_Completion.h" +#include "LocalityManager/Scheduler/Events/Install.h" +#include "LocalityManager/Scheduler/Events/Remove.h" #include "Split_Plan/Locality_Splitter.h" #include "Split_Plan/Split_Plan.h" @@ -118,14 +120,12 @@ NodeApplication_Impl::prepare_instances (const LocalitySplitter::TSubPlans& plan this->sub_plans_ [ lm_idd.name.in () ] = SUB_PLAN (loc_manager_instance, sub_plan); - CORBA::Any_var reference; - Install_Instance *event (0); Event_Future result; completion.accept (result); ACE_NEW_THROW_EX (event, - Install_Instance (sub_plan, + Install_Instance (this->sub_plans_ [ lm_idd.name.in () ].second, loc_manager_instance, DAnCE::DANCE_LOCALITYMANAGER, result @@ -140,7 +140,7 @@ NodeApplication_Impl::prepare_instances (const LocalitySplitter::TSubPlans& plan ACE_Time_Value tv (ACE_OS::gettimeofday () + ACE_Time_Value (this->spawn_delay_)); - if (completion.wait_on_completion (&tv)) + if (!completion.wait_on_completion (&tv)) { DANCE_ERROR (1, (LM_ERROR, DLINFO ACE_TEXT("NodeApplication_Impl::prepare_instances - ") diff --git a/CIAO/ciao/Deployment/Handlers/Component_Handler.cpp b/CIAO/ciao/Deployment/Handlers/Component_Handler.cpp index e968534eca9..0d6d58a7358 100644 --- a/CIAO/ciao/Deployment/Handlers/Component_Handler.cpp +++ b/CIAO/ciao/Deployment/Handlers/Component_Handler.cpp @@ -471,3 +471,12 @@ namespace CIAO } } + +extern "C" +{ + ::DAnCE::InstanceDeploymentHandler_ptr + CIAO_Locality_Handler_Export create_Component_Handler (void) + { + return new CIAO::Component_Handler_i (); + } +} diff --git a/CIAO/ciao/Deployment/Handlers/Component_Handler.h b/CIAO/ciao/Deployment/Handlers/Component_Handler.h index 3353520d5f7..13a33508c75 100644 --- a/CIAO/ciao/Deployment/Handlers/Component_Handler.h +++ b/CIAO/ciao/Deployment/Handlers/Component_Handler.h @@ -85,4 +85,11 @@ namespace CIAO Deployment_Common::INSTANCES instances_; }; } + +extern "C" +{ + ::DAnCE::InstanceDeploymentHandler_ptr + CIAO_Locality_Handler_Export create_Component_Handler (void); +} + #endif diff --git a/CIAO/ciao/Deployment/Handlers/Container_Handler.cpp b/CIAO/ciao/Deployment/Handlers/Container_Handler.cpp index 189013369cf..e1872730c32 100644 --- a/CIAO/ciao/Deployment/Handlers/Container_Handler.cpp +++ b/CIAO/ciao/Deployment/Handlers/Container_Handler.cpp @@ -1,31 +1,19 @@ // $Id$ #include "Container_Handler.h" +#include "tao/ORB_Core.h" #include "ciao/Logger/Log_Macros.h" #include "ciao/Containers/Session/Session_Container.h" #include "ciao/Base/Server_init.h" - +#include "DAnCE/DAnCE_Utility.h" +#include "DAnCE/DAnCE_PropertiesC.h" #include "CIAO_State.h" namespace CIAO { - Container_Handler_i::Container_Handler_i (const DAnCE::Utility::PROPERTY_MAP &, - CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa) - : orb_ (CORBA::ORB::_duplicate (orb)), - poa_ (PortableServer::POA::_duplicate (poa)) - + Container_Handler_i::Container_Handler_i (void) { CIAO_TRACE ("Container_Handler_i::Container_Handler_i"); - CIAO::Server_init (orb_); - - // For the time being, we are going to go ahead and construct a container. - ::Deployment::DeploymentPlan plan; - plan.instance.length (1); - plan.instance[0].name = ""; - - ::CORBA::Any_var any; - this->install_instance (plan, 0, any.out ()); } // Destructor @@ -204,9 +192,54 @@ namespace CIAO } void - Container_Handler_i::configure (const ::Deployment::Properties & ) + Container_Handler_i::configure (const ::Deployment::Properties &props ) { + CIAO_DEBUG (6, (LM_DEBUG, CLINFO + ACE_TEXT ("Container_Handler_i::configure - ") + ACE_TEXT ("Received %u properties for configuration\n"), + props.length ())); + + DAnCE::Utility::get_property_value (DAnCE::ENTITY_POA, + props, + this->poa_); + + if (CORBA::is_nil (this->poa_)) + { + CIAO_ERROR (1, (LM_ERROR, CLINFO + ACE_TEXT ("Container_Handler_i::configure -") + ACE_TEXT ("Unable to locate POA.\n"))); + throw ::Deployment::StartError ("CIAO Container Handler", + "Unable to locate POA"); + } + this->orb_ = TAO_ORB_Core_instance ()->orb (); + + if (CORBA::is_nil (this->orb_)) + { + CIAO_ERROR (1, (LM_ERROR, CLINFO + ACE_TEXT ("Container_Handler_i::configure -") + ACE_TEXT ("Unable to locate ORB.\n"))); + throw ::Deployment::StartError ("CIAO Container Handler", + "Unable to locate ORB"); + } + + CIAO::Server_init (orb_); + + // For the time being, we are going to go ahead and construct a container. + ::Deployment::DeploymentPlan plan; + plan.instance.length (1); + plan.instance[0].name = ""; + + ::CORBA::Any_var any; + this->install_instance (plan, 0, any.out ()); } } +extern "C" +{ + ::DAnCE::InstanceDeploymentHandler_ptr + CIAO_Locality_Handler_Export create_Container_Handler (void) + { + return new CIAO::Container_Handler_i (); + } +} diff --git a/CIAO/ciao/Deployment/Handlers/Container_Handler.h b/CIAO/ciao/Deployment/Handlers/Container_Handler.h index 850c4c8fb57..f8ab77bb25b 100644 --- a/CIAO/ciao/Deployment/Handlers/Container_Handler.h +++ b/CIAO/ciao/Deployment/Handlers/Container_Handler.h @@ -34,9 +34,7 @@ namespace CIAO { public: // Constructor - Container_Handler_i (const DAnCE::Utility::PROPERTY_MAP &props, - CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa); + Container_Handler_i (void); // Destructor virtual ~Container_Handler_i (void); @@ -88,4 +86,11 @@ namespace CIAO PortableServer::POA_var poa_; }; } + +extern "C" +{ + ::DAnCE::InstanceDeploymentHandler_ptr + CIAO_Locality_Handler_Export create_Container_Handler (void); +} + #endif diff --git a/CIAO/ciao/Deployment/Handlers/Home_Handler.cpp b/CIAO/ciao/Deployment/Handlers/Home_Handler.cpp index 01a529cc7cb..af85f6e9660 100644 --- a/CIAO/ciao/Deployment/Handlers/Home_Handler.cpp +++ b/CIAO/ciao/Deployment/Handlers/Home_Handler.cpp @@ -377,3 +377,12 @@ namespace CIAO } } + +extern "C" +{ + ::DAnCE::InstanceDeploymentHandler_ptr + CIAO_Locality_Handler_Export create_Home_Handler (void) + { + return new CIAO::Home_Handler_i (); + } +} diff --git a/CIAO/ciao/Deployment/Handlers/Home_Handler.h b/CIAO/ciao/Deployment/Handlers/Home_Handler.h index 21117e6d408..8b896d56fdf 100644 --- a/CIAO/ciao/Deployment/Handlers/Home_Handler.h +++ b/CIAO/ciao/Deployment/Handlers/Home_Handler.h @@ -84,4 +84,11 @@ namespace CIAO Deployment_Common::INSTANCES instances_; }; } + +extern "C" +{ + ::DAnCE::InstanceDeploymentHandler_ptr + CIAO_Locality_Handler_Export create_Home_Handler (void); +} + #endif diff --git a/CIAO/ciao/Deployment/Handlers/Homed_Component_Handler.cpp b/CIAO/ciao/Deployment/Handlers/Homed_Component_Handler.cpp index 07aeca459a0..eecb6330dfe 100644 --- a/CIAO/ciao/Deployment/Handlers/Homed_Component_Handler.cpp +++ b/CIAO/ciao/Deployment/Handlers/Homed_Component_Handler.cpp @@ -429,3 +429,12 @@ namespace CIAO } } + +extern "C" +{ + ::DAnCE::InstanceDeploymentHandler_ptr + CIAO_Locality_Handler_Export create_Homed_Component_Handler (void) + { + return new CIAO::Homed_Component_Handler_i (); + } +} diff --git a/CIAO/ciao/Deployment/Handlers/Homed_Component_Handler.h b/CIAO/ciao/Deployment/Handlers/Homed_Component_Handler.h index 267a2f6a3fc..9e6f3afe2b5 100644 --- a/CIAO/ciao/Deployment/Handlers/Homed_Component_Handler.h +++ b/CIAO/ciao/Deployment/Handlers/Homed_Component_Handler.h @@ -85,4 +85,11 @@ namespace CIAO Deployment_Common::INSTANCES instances_; }; } + +extern "C" +{ + ::DAnCE::InstanceDeploymentHandler_ptr + CIAO_Locality_Handler_Export create_Homed_Component_Handler (void); +} + #endif diff --git a/CIAO/ciao/Deployment/Interceptors/CIAO_Deployment_Interceptors.mpc b/CIAO/ciao/Deployment/Interceptors/CIAO_Deployment_Interceptors.mpc new file mode 100644 index 00000000000..01057532c68 --- /dev/null +++ b/CIAO/ciao/Deployment/Interceptors/CIAO_Deployment_Interceptors.mpc @@ -0,0 +1,15 @@ +// $Id$ +project (CIAO_Deployment_Interceptors) : ciao_base, ciao_lib, ciao_output, \ + naming, ciao_logger, dance_stub { + dynamicflags = CIAO_DEPLOOYMENT_INTERCEPTORS_BUILD_DLL + + Source_Files { + Deployment_Interceptors.cpp + Name_Utilities.cpp + } + + Header_Files { + Deployment_Interceptors.h + Name_Utilities.h + } +} diff --git a/CIAO/ciao/Deployment/Interceptors/CIAO_Deployment_Interceptors_export.h b/CIAO/ciao/Deployment/Interceptors/CIAO_Deployment_Interceptors_export.h new file mode 100644 index 00000000000..be780cf9f8a --- /dev/null +++ b/CIAO/ciao/Deployment/Interceptors/CIAO_Deployment_Interceptors_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl CIAO_Deployment_Interceptors +// ------------------------------ +#ifndef CIAO_DEPLOYMENT_INTERCEPTORS_EXPORT_H +#define CIAO_DEPLOYMENT_INTERCEPTORS_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (CIAO_DEPLOYMENT_INTERCEPTORS_HAS_DLL) +# define CIAO_DEPLOYMENT_INTERCEPTORS_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && CIAO_DEPLOYMENT_INTERCEPTORS_HAS_DLL */ + +#if !defined (CIAO_DEPLOYMENT_INTERCEPTORS_HAS_DLL) +# define CIAO_DEPLOYMENT_INTERCEPTORS_HAS_DLL 1 +#endif /* ! CIAO_DEPLOYMENT_INTERCEPTORS_HAS_DLL */ + +#if defined (CIAO_DEPLOYMENT_INTERCEPTORS_HAS_DLL) && (CIAO_DEPLOYMENT_INTERCEPTORS_HAS_DLL == 1) +# if defined (CIAO_DEPLOYMENT_INTERCEPTORS_BUILD_DLL) +# define CIAO_Deployment_Interceptors_Export ACE_Proper_Export_Flag +# define CIAO_DEPLOYMENT_INTERCEPTORS_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define CIAO_DEPLOYMENT_INTERCEPTORS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* CIAO_DEPLOYMENT_INTERCEPTORS_BUILD_DLL */ +# define CIAO_Deployment_Interceptors_Export ACE_Proper_Import_Flag +# define CIAO_DEPLOYMENT_INTERCEPTORS_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define CIAO_DEPLOYMENT_INTERCEPTORS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* CIAO_DEPLOYMENT_INTERCEPTORS_BUILD_DLL */ +#else /* CIAO_DEPLOYMENT_INTERCEPTORS_HAS_DLL == 1 */ +# define CIAO_Deployment_Interceptors_Export +# define CIAO_DEPLOYMENT_INTERCEPTORS_SINGLETON_DECLARATION(T) +# define CIAO_DEPLOYMENT_INTERCEPTORS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* CIAO_DEPLOYMENT_INTERCEPTORS_HAS_DLL == 1 */ + +// Set CIAO_DEPLOYMENT_INTERCEPTORS_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (CIAO_DEPLOYMENT_INTERCEPTORS_NTRACE) +# if (ACE_NTRACE == 1) +# define CIAO_DEPLOYMENT_INTERCEPTORS_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define CIAO_DEPLOYMENT_INTERCEPTORS_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !CIAO_DEPLOYMENT_INTERCEPTORS_NTRACE */ + +#if (CIAO_DEPLOYMENT_INTERCEPTORS_NTRACE == 1) +# define CIAO_DEPLOYMENT_INTERCEPTORS_TRACE(X) +#else /* (CIAO_DEPLOYMENT_INTERCEPTORS_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define CIAO_DEPLOYMENT_INTERCEPTORS_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (CIAO_DEPLOYMENT_INTERCEPTORS_NTRACE == 1) */ + +#endif /* CIAO_DEPLOYMENT_INTERCEPTORS_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/LocalityManager/Daemon/Deployment_Interceptors.cpp b/CIAO/ciao/Deployment/Interceptors/Deployment_Interceptors.cpp index 9c66fdf5208..c639877dd2b 100644 --- a/CIAO/DAnCE/LocalityManager/Daemon/Deployment_Interceptors.cpp +++ b/CIAO/ciao/Deployment/Interceptors/Deployment_Interceptors.cpp @@ -1,49 +1,42 @@ // $Id$ #include "Deployment_Interceptors.h" -#include "Logger/Log_Macros.h" +#include "tao/ORB_Core.h" #include "Name_Utilities.h" +#include "Deployment/Deployment_StartErrorC.h" #include "DAnCE/DAnCE_PropertiesC.h" #include "DAnCE/DAnCE_Utility.h" +#include "ciao/Logger/Log_Macros.h" -namespace DAnCE +namespace CIAO { // Implementation skeleton constructor - DAnCE_StoreReferences_i::DAnCE_StoreReferences_i (CORBA::ORB_ptr orb, - const ::Deployment::Properties *prop_ptr) - : orb_ (CORBA::ORB::_duplicate (orb)) - + CIAO_StoreReferences_i::CIAO_StoreReferences_i (void) { - if (prop_ptr) + this->orb_ = TAO_ORB_Core_instance ()->orb (); + + if (CORBA::is_nil (this->orb_)) { - const ::Deployment::Properties &props = *prop_ptr; - - for (CORBA::ULong i = 0; i < props.length (); ++i) - { - if (ACE_OS::strcmp (props[i].name.in (), - DAnCE::LOCALITY_NAMINGCONTEXT) == 0) - { - CORBA::Object_var obj; - props[i].value >>= CORBA::Any::to_object (obj); - - ctx_ = CosNaming::NamingContext::_narrow (obj.in ()); - } - } + CIAO_ERROR (1, (LM_ERROR, CLINFO + ACE_TEXT ("Container_Handler_i::configure -") + ACE_TEXT ("Unable to locate ORB.\n"))); + throw ::Deployment::StartError ("CIAO Container Handler", + "Unable to locate ORB"); } } // Implementation skeleton destructor - DAnCE_StoreReferences_i::~DAnCE_StoreReferences_i (void) + CIAO_StoreReferences_i::~CIAO_StoreReferences_i (void) { } - void DAnCE_StoreReferences_i::instance_pre_install (::Deployment::DeploymentPlan &, + void CIAO_StoreReferences_i::instance_pre_install (::Deployment::DeploymentPlan &, ::CORBA::ULong) { // no-op } - void DAnCE_StoreReferences_i::instance_post_install (const ::Deployment::DeploymentPlan &plan, + void CIAO_StoreReferences_i::instance_post_install (const ::Deployment::DeploymentPlan &plan, ::CORBA::ULong instance_index, const ::CORBA::Any &instance_reference, const ::CORBA::Any &) @@ -52,7 +45,7 @@ namespace DAnCE plan.instance[instance_index]; DANCE_DEBUG (9, (LM_TRACE, DLINFO - ACE_TEXT ("DAnCE_StoreReferences_i::instance_post_install - ") + ACE_TEXT ("CIAO_StoreReferences_i::instance_post_install - ") ACE_TEXT ("Interceptor post install for instance %C\n"), plan.instance[instance_index].name.in ())); @@ -68,7 +61,7 @@ namespace DAnCE if (!(instance_reference >>= CORBA::Any::to_object (obj))) { DANCE_ERROR (1, (LM_WARNING, DLINFO - ACE_TEXT ("DAnCE_StoreReferences_i::instance_post_install - ") + ACE_TEXT ("CIAO_StoreReferences_i::instance_post_install - ") ACE_TEXT ("Unable to extract instance reference from Any\n"))); } @@ -76,7 +69,7 @@ namespace DAnCE inst.configProperty[i].value >>= CORBA::Any::to_string (name, 0); DANCE_DEBUG (9, (LM_TRACE, DLINFO - ACE_TEXT ("DAnCE_StoreReferences_i::instance_post_install - ") + ACE_TEXT ("CIAO_StoreReferences_i::instance_post_install - ") ACE_TEXT ("Registering name %C for instance %C\n"), name, plan.instance[instance_index].name.in ())); @@ -102,30 +95,40 @@ namespace DAnCE } void - DAnCE_StoreReferences_i::configure (const ::Deployment::Properties & ) + CIAO_StoreReferences_i::configure (const ::Deployment::Properties &props ) { - + for (CORBA::ULong i = 0; i < props.length (); ++i) + { + if (ACE_OS::strcmp (props[i].name.in (), + DAnCE::LOCALITY_NAMINGCONTEXT) == 0) + { + CORBA::Object_var obj; + props[i].value >>= CORBA::Any::to_object (obj); + + ctx_ = CosNaming::NamingContext::_narrow (obj.in ()); + } + } } // Implementation skeleton constructor - DAnCE_ReferenceLookup_i::DAnCE_ReferenceLookup_i (void) + CIAO_ReferenceLookup_i::CIAO_ReferenceLookup_i (void) { } // Implementation skeleton destructor - DAnCE_ReferenceLookup_i::~DAnCE_ReferenceLookup_i (void) + CIAO_ReferenceLookup_i::~CIAO_ReferenceLookup_i (void) { } void - DAnCE_ReferenceLookup_i::instance_pre_connect (::Deployment::DeploymentPlan &, + CIAO_ReferenceLookup_i::instance_pre_connect (::Deployment::DeploymentPlan &, ::CORBA::ULong, ::CORBA::Any &) { // Add your implementation here } - void DAnCE_ReferenceLookup_i::instance_post_connect (const ::Deployment::DeploymentPlan &, + void CIAO_ReferenceLookup_i::instance_post_connect (const ::Deployment::DeploymentPlan &, ::CORBA::ULong, const ::CORBA::Any &) { @@ -133,9 +136,18 @@ namespace DAnCE } void - DAnCE_ReferenceLookup_i::configure (const ::Deployment::Properties & ) + CIAO_ReferenceLookup_i::configure (const ::Deployment::Properties & ) { } } + +extern "C" +{ + ::DAnCE::DeploymentInterceptor_ptr + CIAO_Deployment_Interceptors_Export create_CIAO_StoreReferences (void) + { + return new CIAO::CIAO_StoreReferences_i (); + } +} diff --git a/CIAO/DAnCE/LocalityManager/Daemon/Deployment_Interceptors.h b/CIAO/ciao/Deployment/Interceptors/Deployment_Interceptors.h index 61a3fc80973..d993d7186b0 100644 --- a/CIAO/DAnCE/LocalityManager/Daemon/Deployment_Interceptors.h +++ b/CIAO/ciao/Deployment/Interceptors/Deployment_Interceptors.h @@ -17,21 +17,21 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "tao/LocalObject.h" +#include "CIAO_Deployment_Interceptors_export.h" -namespace DAnCE +namespace CIAO { - class DAnCE_StoreReferences_i + class CIAO_Deployment_Interceptors_Export CIAO_StoreReferences_i : public virtual DAnCE::InstanceInstallation, public virtual ::CORBA::LocalObject { public: // Constructor - DAnCE_StoreReferences_i (CORBA::ORB_ptr orb, - const ::Deployment::Properties *props); + CIAO_StoreReferences_i (void); // Destructor - virtual ~DAnCE_StoreReferences_i (void); + virtual ~CIAO_StoreReferences_i (void); virtual void instance_pre_install (::Deployment::DeploymentPlan & plan, @@ -51,16 +51,16 @@ namespace DAnCE CosNaming::NamingContext_var ctx_; }; - class DAnCE_ReferenceLookup_i + class CIAO_ReferenceLookup_i : public virtual DAnCE::InstanceConnection, public virtual ::CORBA::LocalObject { public: // Constructor - DAnCE_ReferenceLookup_i (void); + CIAO_ReferenceLookup_i (void); // Destructor - virtual ~DAnCE_ReferenceLookup_i (void); + virtual ~CIAO_ReferenceLookup_i (void); virtual void instance_pre_connect (::Deployment::DeploymentPlan & plan, @@ -76,4 +76,11 @@ namespace DAnCE void configure(const Deployment::Properties&); }; } + +extern "C" +{ + ::DAnCE::DeploymentInterceptor_ptr + CIAO_Deployment_Interceptors_Export create_CIAO_StoreReferences (void); +} + #endif diff --git a/CIAO/DAnCE/LocalityManager/Daemon/Name_Utilities.cpp b/CIAO/ciao/Deployment/Interceptors/Name_Utilities.cpp index 94549fa1162..ee6c8b90abc 100644 --- a/CIAO/DAnCE/LocalityManager/Daemon/Name_Utilities.cpp +++ b/CIAO/ciao/Deployment/Interceptors/Name_Utilities.cpp @@ -7,7 +7,7 @@ #include "ace/Tokenizer_T.h" #include "Logger/Log_Macros.h" -namespace DAnCE +namespace CIAO { namespace Name_Utilities { bool diff --git a/CIAO/DAnCE/LocalityManager/Daemon/Name_Utilities.h b/CIAO/ciao/Deployment/Interceptors/Name_Utilities.h index 2685ee36012..467cced4ae7 100644 --- a/CIAO/DAnCE/LocalityManager/Daemon/Name_Utilities.h +++ b/CIAO/ciao/Deployment/Interceptors/Name_Utilities.h @@ -11,7 +11,7 @@ #include "orbsvcs/CosNamingC.h" -namespace DAnCE +namespace CIAO { namespace Name_Utilities { |