diff options
author | dengg <dengg@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-09-15 03:32:25 +0000 |
---|---|---|
committer | dengg <dengg@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-09-15 03:32:25 +0000 |
commit | 83017f297fb8d2770ad1204e2aa97f7992c54bfc (patch) | |
tree | 0a62c9781ff723aefba970f4802d8bbf79b0d69d | |
parent | 745a25326b970083976da352c690b776bcf9b234 (diff) | |
download | ATCD-83017f297fb8d2770ad1204e2aa97f7992c54bfc.tar.gz |
Tue Sep 14 22:29:00 2004 Gan Deng <gan.deng@vanderbilt.edu>
-rw-r--r-- | TAO/CIAO/DAnCE/ChangeLog_EC | 20 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/CCM_Core.mpc | 5 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/Container_Base.cpp | 221 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/Container_Base.h | 79 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/Container_Base.inl | 10 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/Port_Activator.h | 2 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/Servant_Activator.h | 2 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/Servant_Impl_Base.cpp | 3 |
8 files changed, 262 insertions, 80 deletions
diff --git a/TAO/CIAO/DAnCE/ChangeLog_EC b/TAO/CIAO/DAnCE/ChangeLog_EC index 0a74264ac84..522e6001d05 100644 --- a/TAO/CIAO/DAnCE/ChangeLog_EC +++ b/TAO/CIAO/DAnCE/ChangeLog_EC @@ -1,3 +1,23 @@ +Tue Sep 14 22:29:00 2004 Gan Deng <gan.deng@vanderbilt.edu> + + * DAnCE/ciao/Port_Activator.cpp + * DAnCE/ciao/Port_Activator.h + * DAnCE/ciao/Port_Activator_T.cpp + * DAnCE/ciao/Port_Activator_T.h + * DAnCE/ciao/Servant_Activator.cpp + * DAnCE/ciao/Servant_Activator.h + + Added these files, which are obtained from main trunk. + + * DAnCE/ciao/CCM_Core.mpc + * DAnCE/ciao/Container_Base.cpp + * DAnCE/ciao/Container_Base.h + * DAnCE/ciao/Container_Base.inl + * DAnCE/ciao/Servant_Impl_Base.cpp + + Merged above files from main trunk. The main trunk fixed + the long-lasting CIAO problem. + Fri Sep 10 17:11:00 2004 Gan Deng <gan.deng@vanderbilt.edu> * DAnCE/Config_Handlers/CPK_Handler.cpp diff --git a/TAO/CIAO/DAnCE/ciao/CCM_Core.mpc b/TAO/CIAO/DAnCE/ciao/CCM_Core.mpc index 75134687e83..5f3e84f0e1f 100644 --- a/TAO/CIAO/DAnCE/ciao/CCM_Core.mpc +++ b/TAO/CIAO/DAnCE/ciao/CCM_Core.mpc @@ -151,8 +151,9 @@ project(Deployment_svnt) : taolib_with_idl, portableserver, valuetype,ifr_client } -project (CIAO_DnC_Server) : orbsvcslib, portableserver, iorinterceptor, objreftemplate, valuetype, ifr_client, security { +project (CIAO_DnC_Server) : orbsvcslib, portableserver, valuetype, ifr_client, utils, security { after += CIAO_DnC_Container Deployment_svnt + includes += $(CIAO_ROOT)/DAnCE sharedname = CIAO_DnC_Server libs += CIAO_DnC_Client CIAO_DnC_Container CIAO_DnC_Events CIAO_Deployment_svnt CIAO_Deployment_stub idlflags += -Wb,export_include=CIAO_Server_Export.h -Wb,export_macro=CIAO_SERVER_Export @@ -167,6 +168,8 @@ project (CIAO_DnC_Server) : orbsvcslib, portableserver, iorinterceptor, objrefte NodeApplication_Impl.cpp Server_init.cpp Servant_Impl_Base.cpp + Servant_Activator.cpp + Port_Activator.cpp StandardConfigurator_Impl.cpp } diff --git a/TAO/CIAO/DAnCE/ciao/Container_Base.cpp b/TAO/CIAO/DAnCE/ciao/Container_Base.cpp index 07b1349b084..5573ad45e95 100644 --- a/TAO/CIAO/DAnCE/ciao/Container_Base.cpp +++ b/TAO/CIAO/DAnCE/ciao/Container_Base.cpp @@ -2,7 +2,10 @@ #include "Container_Base.h" #include "ace/DLL.h" +#include "tao/Utils/PolicyList_Destroyer.h" #include "ace/OS_NS_stdio.h" +#include "Servant_Activator.h" + #include "ace/Dynamic_Service.h" #if !defined (__ACE_INLINE__) @@ -21,13 +24,13 @@ CIAO::Container::~Container () } PortableServer::POA_ptr -CIAO::Container::_ciao_the_POA (void) +CIAO::Container::the_POA (void) const { - return this->poa_.in (); + return this->component_poa_.in (); } CORBA::ORB_ptr -CIAO::Container::_ciao_the_ORB () +CIAO::Container::the_ORB (void) const { return this->orb_.in (); } @@ -214,13 +217,13 @@ ACE_Atomic_Op <ACE_SYNCH_MUTEX, long> CIAO::Session_Container::serial_number_ (0); CIAO::Session_Container::Session_Container (CORBA::ORB_ptr o, - int static_config_flag, - const Static_Config_EntryPoints_Maps* maps - ) + bool static_config_flag, + const Static_Config_EntryPoints_Maps* maps) : Container (o), number_ (0), static_config_flag_ (static_config_flag), - static_entrypts_maps_ (maps) + static_entrypts_maps_ (maps), + sa_ (0) { } @@ -245,7 +248,8 @@ CIAO::Session_Container::init (const char *name, } CORBA::Object_var poa_object = - this->orb_->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); + this->orb_->resolve_initial_references("RootPOA" + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (-1); if (CORBA::is_nil (poa_object.in ())) @@ -254,27 +258,22 @@ CIAO::Session_Container::init (const char *name, -1); PortableServer::POA_var root_poa = - PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); + PortableServer::POA::_narrow (poa_object.in () + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (-1); - // Set up proper poa policies here. Default policies seems to be - // fine for session container. If you add some other default - // policies here, then you need to "add" more_policies below - // instead of simply assigning more_policies to the init policy - // list. - CORBA::PolicyList policies (0); - - if (more_policies != 0) - policies = *more_policies; + this->create_component_POA (name, + more_policies, + root_poa.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); - this->poa_ = root_poa->create_POA (name, - PortableServer::POAManager::_nil (), - policies - ACE_ENV_ARG_PARAMETER); + this->create_facet_consumer_POA (root_poa.in () + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (-1); PortableServer::POAManager_var poa_manager = - this->poa_->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); + root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (-1); poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); @@ -289,19 +288,101 @@ CIAO::Session_Container::init (const char *name, return 0; } + +void +CIAO::Session_Container::create_component_POA (const char *name, + const CORBA::PolicyList *p, + PortableServer::POA_ptr root + ACE_ENV_ARG_DECL) +{ + // Set up proper poa policies here. Default policies seems to be + // fine for session container. If you add some other default + // policies here, then you need to "add" more_policies below + // instead of simply assigning more_policies to the init policy + // list. + CORBA::PolicyList policies (0); + + if (p != 0) + policies = *p; + + PortableServer::POAManager_var poa_manager = + root->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + this->component_poa_ = + root->create_POA (name, + poa_manager.in (), + policies + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + +void +CIAO::Session_Container::create_facet_consumer_POA ( + PortableServer::POA_ptr root + ACE_ENV_ARG_DECL) +{ + PortableServer::POAManager_var poa_manager = + root->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + TAO::Utils::PolicyList_Destroyer policies (3); + policies.length (3); + + policies[0] = + root->create_id_assignment_policy (PortableServer::USER_ID + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + policies[1] = + root->create_request_processing_policy (PortableServer::USE_SERVANT_MANAGER + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + // Servant Retention Policy + policies[2] = + root->create_servant_retention_policy (PortableServer::RETAIN + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + this->facet_cons_poa_ = + root->create_POA ("facet_consumer_poa", + poa_manager.in (), + policies + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + ACE_NEW_THROW_EX (this->sa_, + Servant_Activator (this->orb_.in ()), + CORBA::NO_MEMORY ()); + + this->facet_cons_poa_->set_servant_manager ( + this->sa_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + CORBA::Object_ptr -CIAO::Session_Container::install_servant (PortableServer::Servant p +CIAO::Session_Container::install_servant (PortableServer::Servant p, + Container::OA_Type t ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { + PortableServer::POA_ptr tmp = 0; + + if (t == Container::Component) + tmp = this->component_poa_.in (); + else + tmp = this->facet_cons_poa_.in (); + PortableServer::ObjectId_var oid - = this->poa_->activate_object (p - ACE_ENV_ARG_PARAMETER); + = tmp->activate_object (p + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); CORBA::Object_var objref - = this->poa_->id_to_reference (oid.in () - ACE_ENV_ARG_PARAMETER); + = tmp->id_to_reference (oid.in () + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); return objref._retn (); @@ -314,13 +395,13 @@ CIAO::Session_Container::install_component (PortableServer::Servant p, ACE_THROW_SPEC ((CORBA::SystemException)) { PortableServer::ObjectId_var id - = this->poa_->activate_object (p - ACE_ENV_ARG_PARAMETER); + = this->component_poa_->activate_object (p + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); CORBA::Object_var objref - = this->poa_->id_to_reference (id.in () - ACE_ENV_ARG_PARAMETER); + = this->component_poa_->id_to_reference (id.in () + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); oid = id._retn (); @@ -415,8 +496,10 @@ CIAO::Session_Container::ciao_install_home (const char *exe_dll_name, PortableServer::ServantBase_var safe (home_servant); - CORBA::Object_var objref = this->install_servant (home_servant - ACE_ENV_ARG_PARAMETER); + CORBA::Object_var objref = + this->install_servant (home_servant, + Container::Component + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (Components::CCMHome::_nil ()); Components::CCMHome_var homeref = @@ -433,36 +516,54 @@ CIAO::Session_Container::ciao_uninstall_home (Components::CCMHome_ptr homeref ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - this->uninstall (homeref + this->uninstall (homeref, + Container::Component ACE_ENV_ARG_PARAMETER); + ACE_CHECK; } void -CIAO::Session_Container::uninstall (CORBA::Object_ptr objref +CIAO::Session_Container::uninstall (CORBA::Object_ptr objref, + Container::OA_Type t ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - PortableServer::ObjectId_var oid - = this->poa_->reference_to_id (objref - ACE_ENV_ARG_PARAMETER); + PortableServer::POA_ptr tmp = 0; + + if (t == Container::Component) + tmp = this->component_poa_.in (); + else + tmp = this->facet_cons_poa_.in (); + + PortableServer::ObjectId_var oid = + tmp->reference_to_id (objref + ACE_ENV_ARG_PARAMETER); ACE_CHECK; - this->poa_->deactivate_object (oid.in () - ACE_ENV_ARG_PARAMETER); + tmp->deactivate_object (oid.in () + ACE_ENV_ARG_PARAMETER); } void -CIAO::Session_Container::uninstall (PortableServer::Servant svt +CIAO::Session_Container::uninstall (PortableServer::Servant svt, + Container::OA_Type t ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { + PortableServer::POA_ptr tmp = 0; + + if (t == Container::Component) + tmp = this->component_poa_.in (); + else + tmp = this->facet_cons_poa_.in (); + PortableServer::ObjectId_var oid - = this->poa_->servant_to_id (svt - ACE_ENV_ARG_PARAMETER); + = tmp->servant_to_id (svt + ACE_ENV_ARG_PARAMETER); ACE_CHECK; - this->poa_->deactivate_object (oid.in () - ACE_ENV_ARG_PARAMETER); + tmp->deactivate_object (oid.in () + ACE_ENV_ARG_PARAMETER); } void @@ -472,12 +573,12 @@ CIAO::Session_Container::uninstall_component (Components::CCMObject_ptr objref, ACE_THROW_SPEC ((CORBA::SystemException)) { PortableServer::ObjectId_var id - = this->poa_->reference_to_id (objref - ACE_ENV_ARG_PARAMETER); + = this->component_poa_->reference_to_id (objref + ACE_ENV_ARG_PARAMETER); ACE_CHECK; - this->poa_->deactivate_object (id.in () - ACE_ENV_ARG_PARAMETER); + this->component_poa_->deactivate_object (id.in () + ACE_ENV_ARG_PARAMETER); ACE_CHECK; oid = id._retn (); @@ -485,17 +586,25 @@ CIAO::Session_Container::uninstall_component (Components::CCMObject_ptr objref, CORBA::Object_ptr CIAO::Session_Container::generate_reference (const char *obj_id, - const char *repo_id + const char *repo_id, + Container::OA_Type t ACE_ENV_ARG_DECL) { + PortableServer::POA_ptr tmp = 0; + + if (t == Container::Component) + tmp = this->component_poa_.in (); + else + tmp = this->facet_cons_poa_.in (); + PortableServer::ObjectId_var oid = PortableServer::string_to_ObjectId (obj_id); - CORBA::Object_var objref = - this->poa_->create_reference_with_id (oid.in (), - repo_id - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; + CORBA::Object_var objref = + tmp->create_reference_with_id (oid.in (), + repo_id + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); return objref._retn (); } diff --git a/TAO/CIAO/DAnCE/ciao/Container_Base.h b/TAO/CIAO/DAnCE/ciao/Container_Base.h index da3e29b90cc..09e3ebab47c 100644 --- a/TAO/CIAO/DAnCE/ciao/Container_Base.h +++ b/TAO/CIAO/DAnCE/ciao/Container_Base.h @@ -34,6 +34,7 @@ namespace CIAO { + class Servant_Activator; /** * @class Container * @@ -46,16 +47,25 @@ namespace CIAO public virtual POA_CIAO::ContainerEventService { public: + enum OA_Type + { + Component, + Facet_Consumer + }; + Container (CORBA::ORB_ptr o); virtual ~Container (void) = 0; - /// Get the containing POA. This operation does *NOT* - /// increase the reference count of the POA. - virtual PortableServer::POA_ptr _ciao_the_POA (void); + /// Get component's POA. + /** + * This operation does *NOT* increase the reference count of the + * POA. Look at the const qualifier in the method. + */ + PortableServer::POA_ptr the_POA (void) const; /// Get a reference to the underlying ORB. - virtual CORBA::ORB_ptr _ciao_the_ORB (void); + CORBA::ORB_ptr the_ORB (void) const; /// Initialize the container with a name. virtual int init (const char *name = 0, @@ -152,8 +162,17 @@ namespace CIAO // Reference to the ORB CORBA::ORB_var orb_; - // Reference to the POA - PortableServer::POA_var poa_; + /// POA within which all the components in this container will be + /// activated. + PortableServer::POA_var component_poa_; + + /// POA within which all the facets and receptacles will be + /// activated. + /** + * Having two POA's allows us to associate different policies that + * are distinct from the component. + */ + PortableServer::POA_var facet_cons_poa_; /// Factory for event services. EventService_Factory * event_service_factory_; @@ -167,7 +186,6 @@ namespace CIAO /// Object reference to the events interface ContainerEventService_var events_ref_; - }; class Session_Container; @@ -210,9 +228,8 @@ namespace CIAO // It appears to be a boolean value. Please use bool // instead. Session_Container (CORBA::ORB_ptr o, - int static_config_flag =0, - const Static_Config_EntryPoints_Maps* static_entrypts_maps =0 - ); + bool static_config_flag = false, + const Static_Config_EntryPoints_Maps* static_entrypts_maps =0); virtual ~Session_Container (void); @@ -256,7 +273,8 @@ namespace CIAO ACE_THROW_SPEC ((CORBA::SystemException)); // Install a servant for component or home. - CORBA::Object_ptr install_servant (PortableServer::Servant p + CORBA::Object_ptr install_servant (PortableServer::Servant p, + Container::OA_Type t ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); @@ -272,20 +290,43 @@ namespace CIAO ACE_THROW_SPEC ((CORBA::SystemException)); // Uninstall a servant for component or home. - void uninstall (CORBA::Object_ptr objref + void uninstall (CORBA::Object_ptr objref, + Container::OA_Type t ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); // Uninstall a servant for component or home. - void uninstall (PortableServer::Servant svt + void uninstall (PortableServer::Servant svt, + Container::OA_Type t ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); // Analog of the POA method that creates an object reference from // an object id string. CORBA::Object_ptr generate_reference (const char *obj_id, - const char *repo_id - ACE_ENV_ARG_DECL_WITH_DEFAULTS); + const char *repo_id, + Container::OA_Type t + ACE_ENV_ARG_DECL); + + /// Return the servant activator factory that activates the + /// servants for facets and consumers. + Servant_Activator *ports_servant_activator (void) const; + + private: + + /// Create POA for the component. + /** + * This is the POA that is returned to the component applications + * if they need one. + */ + void create_component_POA (const char *name, + const CORBA::PolicyList *p, + PortableServer::POA_ptr root + ACE_ENV_ARG_DECL); + + /// Create POA for the facets and consumers alone. + void create_facet_consumer_POA (PortableServer::POA_ptr root + ACE_ENV_ARG_DECL); protected: long number_; @@ -296,8 +337,12 @@ namespace CIAO // boolean value. Please use bool instead. // // It looks like it can also be declared const, as well. - int static_config_flag_; + bool static_config_flag_; const Static_Config_EntryPoints_Maps* static_entrypts_maps_; + + /// The servant activator factory used to activate facets and + /// consumer servants. + Servant_Activator *sa_; }; } @@ -310,7 +355,7 @@ namespace CIAO { \ CORBA::ValueFactory factory = new FACTORY; \ CORBA::ORB_ptr orb = \ - this->context_->_ciao_the_Container ()->_ciao_the_ORB (); \ + this->context_->_ciao_the_Container ()->the_ORB (); \ CORBA::ValueFactory prev_factory = \ orb->register_value_factory ( \ VALUETYPE::_tao_obv_static_repository_id (), \ diff --git a/TAO/CIAO/DAnCE/ciao/Container_Base.inl b/TAO/CIAO/DAnCE/ciao/Container_Base.inl index aeaa1930061..2b580d3cc93 100644 --- a/TAO/CIAO/DAnCE/ciao/Container_Base.inl +++ b/TAO/CIAO/DAnCE/ciao/Container_Base.inl @@ -16,6 +16,12 @@ CIAO::Session_Container::get_objref (PortableServer::Servant p ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - return this->_ciao_the_POA ()->servant_to_reference (p - ACE_ENV_ARG_PARAMETER); + return this->the_POA ()->servant_to_reference (p + ACE_ENV_ARG_PARAMETER); +} + +ACE_INLINE CIAO::Servant_Activator * +CIAO::Session_Container::ports_servant_activator (void) const +{ + return this->sa_; } diff --git a/TAO/CIAO/DAnCE/ciao/Port_Activator.h b/TAO/CIAO/DAnCE/ciao/Port_Activator.h index 71245214879..1903b8c314c 100644 --- a/TAO/CIAO/DAnCE/ciao/Port_Activator.h +++ b/TAO/CIAO/DAnCE/ciao/Port_Activator.h @@ -19,7 +19,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "ciao/CIAO_Server_Export.h" +#include "CIAO_Server_Export.h" #include "tao/PortableServer/PortableServer.h" diff --git a/TAO/CIAO/DAnCE/ciao/Servant_Activator.h b/TAO/CIAO/DAnCE/ciao/Servant_Activator.h index 4b4fbf65130..826ad1b386a 100644 --- a/TAO/CIAO/DAnCE/ciao/Servant_Activator.h +++ b/TAO/CIAO/DAnCE/ciao/Servant_Activator.h @@ -15,7 +15,7 @@ #include /**/ "ace/pre.h" #include "ace/Array_Base.h" -#include "ciao/CIAO_Server_Export.h" +#include "CIAO_Server_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once diff --git a/TAO/CIAO/DAnCE/ciao/Servant_Impl_Base.cpp b/TAO/CIAO/DAnCE/ciao/Servant_Impl_Base.cpp index a8b6533caf2..78260c0e60a 100644 --- a/TAO/CIAO/DAnCE/ciao/Servant_Impl_Base.cpp +++ b/TAO/CIAO/DAnCE/ciao/Servant_Impl_Base.cpp @@ -108,8 +108,7 @@ namespace CIAO Servant_Impl_Base::_default_POA ( ACE_ENV_SINGLE_ARG_DECL_NOT_USED) { - return - PortableServer::POA::_duplicate (container_->_ciao_the_POA ()); + PortableServer::POA::_duplicate (container_->the_POA ()); } } |