diff options
author | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-08-25 02:58:22 +0000 |
---|---|---|
committer | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-08-25 02:58:22 +0000 |
commit | 6d93330346ed8adac793fcf88b76bb103676e9e7 (patch) | |
tree | 380a6386037b7f32cddd57aae13b891c69c655d6 | |
parent | 1607617b5481a723f824fc5c03e61163ba2fb621 (diff) | |
download | ATCD-6d93330346ed8adac793fcf88b76bb103676e9e7.tar.gz |
*** empty log message ***
20 files changed, 690 insertions, 78 deletions
diff --git a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Deployer.mpc b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Deployer.mpc index 1249f2429f4..e19baa18c72 100644 --- a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Deployer.mpc +++ b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Deployer.mpc @@ -1,4 +1,4 @@ -project(Assembly_Manager): ciao_server, acexml, iortable { +project(Assembly_Manager): ciao_server, acexml, iortable, rtcorba { libs += CIAO_XML_Helpers libpaths += ../XML_Helpers diff --git a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.cpp b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.cpp index 9f56fdffdab..291d555df59 100644 --- a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.cpp +++ b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.cpp @@ -64,52 +64,74 @@ CIAO::Assembly_Builder_Visitor::visit_processcollocation ACE_ENV_ARG_DECL) { ACE_DEBUG ((LM_DEBUG, "processcollocation %s\n", pc->id ())); + Components::ConfigValues server_config; + + // Destination logical host id. + ACE_CString destination_host; if (pc->destination () != 0) { ACE_CString desti_string (pc->destination ()); ssize_t endpos = desti_string.find ('|'); - ACE_CString destination_host = + destination_host = desti_string.substring (0, endpos); - Components::Deployment::ServerActivator_var activator = - this->deployment_config_.get_activator (destination_host.c_str ()); - - if (CORBA::is_nil (activator.in ())) - ACE_ERROR_RETURN ((LM_ERROR, "Fail to acquire ServerActivator (%s)\n", - pc->destination ()), - -1); - - Components::ConfigValues server_config; - // @@ check for RTCAD file, parse the file, and insert the thing in server_config. - if (endpos != ACE_CString::npos) { ACE_CString svcconf = desti_string.substring (endpos + 1); server_config.length (1); - Components::ConfigValue *item = new OBV_Components::ConfigValue (); - item->name (CORBA::string_dup ("CIAO-svcconf-id")); - item->value () <<= CORBA::string_dup (svcconf.c_str ()); - server_config[0] = item; + Components::ConfigValue *newconfig = + new OBV_Components::ConfigValue; + newconfig->name ((const char *) "CIAO-svcconf-id"); + newconfig->value () <<= svcconf.c_str (); + server_config[0] = newconfig; } + } - this->compserv_ = - activator->create_component_server (server_config - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); + // @@ check for RTCAD file, parse the file, and insert the thing in server_config. - this->context_.component_servers_.enqueue_tail (this->compserv_); + const char *rtcad = pc->rtcad_filename (); - Components::ConfigValues container_config; - // @@ Should we get the config value from Softpkg_Info? - this->container_ = - this->compserv_->create_container (container_config - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); + if (rtcad != 0) + { + ACE_DEBUG ((LM_DEBUG, + "Using RTCAD file: %s\n", + rtcad)); + CORBA::ULong len = server_config.length (); + server_config.length (len+1); + + Components::ConfigValue *newconfig = + new OBV_Components::ConfigValue; + newconfig->name ((const char *) "CIAO-rtcad-filename"); + newconfig->value () <<= rtcad; + server_config[len] = newconfig; } + Components::Deployment::ServerActivator_var activator = + this->deployment_config_.get_activator + (destination_host.length () == 0 ? 0 : destination_host.c_str ()); + + if (CORBA::is_nil (activator.in ())) + ACE_ERROR_RETURN ((LM_ERROR, "Fail to acquire ServerActivator (%s)\n", + pc->destination ()), + -1); + + this->compserv_ = + activator->create_component_server (server_config + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + ACE_DEBUG ((LM_DEBUG, "Done creating component server\n")); + + this->context_.component_servers_.enqueue_tail (this->compserv_); + + // @@ Do not create a default container here. We should wait until + // the children ask for a specific containers + this->container_ = Components::Deployment::Container::_nil (); + this->rtpolicy_name_.clear (); + + // Now deal with the children nodes. CIAO::Assembly_Placement::Container::ITERATOR iter (*pc); CIAO::Assembly_Placement::Node *node = 0; @@ -156,20 +178,28 @@ CIAO::Assembly_Builder_Visitor::visit_homeplacement home_config.length (2); Components::ConfigValue *item = new OBV_Components::ConfigValue (); - item->name (CORBA::string_dup ("CIAO-servant-UUID")); - item->value () <<= CORBA::string_dup (info.servant_UUID_.c_str ()); + item->name ((const char *) "CIAO-servant-UUID"); + item->value () <<= info.servant_UUID_.c_str (); home_config[0] = item; item = new OBV_Components::ConfigValue (); - item->name (CORBA::string_dup ("CIAO-servant-entrypt")); - item->value () <<= CORBA::string_dup (info.servant_entrypt_.c_str ()); + item->name ((const char *) "CIAO-servant-entrypt"); + item->value () <<= info.servant_entrypt_.c_str (); home_config[1] = item; - // How do I get a customized container here, if we named a + // @@ How do I get a customized container here, if we named a // RTpolicy_Set for this home placement? + // @@ We actually have to take care of both home_config and + // container_config here. Should we use a Container Manager + // here to make sure that we always use the same container for + // different homes with similar policies? Naw, we'll just + // require putting similar policied home together for now. They + // have abandoned this implementation already anyway. + Components::Deployment::Container_var container - = this->get_current_container (ACE_ENV_SINGLE_ARG_PARAMETER); + = this->get_container (hp->rtpolicyset_ref () + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (-1); if (CORBA::is_nil (container.in ())) @@ -257,11 +287,13 @@ CIAO::Assembly_Builder_Visitor::visit_componentinstantiation return 0; } -Components::Deployment::Container_ptr -CIAO::Assembly_Builder_Visitor::get_current_container (ACE_ENV_SINGLE_ARG_DECL) +Components::Deployment::ComponentServer_ptr +CIAO::Assembly_Builder_Visitor::get_current_componentserver (ACE_ENV_SINGLE_ARG_DECL) { if (CORBA::is_nil (this->compserv_.in ())) { + ACE_DEBUG ((LM_DEBUG, "Creating new ComponenetServer\n")); + Components::Deployment::ServerActivator_var activator = this->deployment_config_.get_default_activator (); @@ -278,13 +310,54 @@ CIAO::Assembly_Builder_Visitor::get_current_container (ACE_ENV_SINGLE_ARG_DECL) ACE_CHECK_RETURN (0); this->context_.component_servers_.enqueue_tail (this->compserv_); + this->container_ = Components::Deployment::Container::_nil (); + this->rtpolicy_name_.clear (); + } + return Components::Deployment::ComponentServer::_duplicate + (this->compserv_.in ()); +} + +Components::Deployment::Container_ptr +CIAO::Assembly_Builder_Visitor::get_container (const char *rtpolicy + ACE_ENV_ARG_DECL) +{ + // If we are not using the same rtpolicy set, or the there's no + // cached container, then create a new one. + if (this->rtpolicy_name_ != ACE_CString (rtpolicy) || + CORBA::is_nil (this->container_.in ())) + { + Components::Deployment::ComponentServer_var server + = this->get_current_componentserver (); Components::ConfigValues container_config; // @@ Should we get the config value from Softpkg_Info? + if (rtpolicy != 0) + { + CORBA::ULong len = container_config.length (); + container_config.length (len + 1); + + Components::ConfigValue *newconfig + = new OBV_Components::ConfigValue; + + newconfig->name ((const char *) "CIAO-RTPolicySet"); + newconfig->value () <<= rtpolicy; + container_config[len] = newconfig; + } + this->container_ = - this->compserv_->create_container (container_config - ACE_ENV_ARG_PARAMETER); + server->create_container (container_config + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); + + this->rtpolicy_name_ = rtpolicy; + + if (rtpolicy != 0) + ACE_DEBUG ((LM_DEBUG, + "Creating container with RTPolicySet %s\n", + rtpolicy)); + else + ACE_DEBUG ((LM_DEBUG, + "Creating container with empty policy set\n")); } return Components::Deployment::Container::_duplicate diff --git a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.h b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.h index fa3f5072cab..c0b83f7f463 100644 --- a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.h +++ b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.h @@ -89,8 +89,19 @@ namespace CIAO virtual int visit_componentinstantiation (Assembly_Placement::componentinstantiation *ci ACE_ENV_ARG_DECL_WITH_DEFAULTS); + Components::Deployment::ComponentServer_ptr + get_current_componentserver (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); + + /// Return a container with the specified @c rtpolicy set name. + /// This method doesn't necessary create a new container. It + /// always compare the rtpolicy name of the cached "current + /// container" and see if the cached container fits our needs. If + /// it does, then no new container is created. I.e., if there are + /// consecutive homeplacement elements with the same rtpolicy set + /// name, they will be installed into a single container. Components::Deployment::Container_ptr - get_current_container (void); + get_container (const char *rtpolicy + ACE_ENV_ARG_DECL_WITH_DEFAULTS); protected: /// Registering a component using the info specified in @c i . @@ -109,6 +120,10 @@ namespace CIAO /// container.) Components::Deployment::Container_var container_; + /// The name of the RTPolicy_Set of the active (referenced by @c + /// container_) container. + ACE_CString rtpolicy_name_; + /// Current Component Home. We only support keyless home /// operations for now. Components::KeylessCCMHome_var home_; diff --git a/TAO/CIAO/tools/Assembly_Deployer/Deployment_Configuration.cpp b/TAO/CIAO/tools/Assembly_Deployer/Deployment_Configuration.cpp index a665612e77a..2b327d3d56c 100644 --- a/TAO/CIAO/tools/Assembly_Deployer/Deployment_Configuration.cpp +++ b/TAO/CIAO/tools/Assembly_Deployer/Deployment_Configuration.cpp @@ -54,6 +54,9 @@ CIAO::Deployment_Configuration::init (const char *filename) const char * CIAO::Deployment_Configuration::get_activator_ior (const char *name) { + if (name == 0) + return get_default_activator_ior (); + ACE_Hash_Map_Entry <ACE_CString, CIAO::Deployment_Configuration::Activator_Info> *entry; @@ -77,6 +80,9 @@ Components::Deployment::ServerActivator_ptr CIAO::Deployment_Configuration::get_activator (const char *name ACE_ENV_ARG_DECL) { + if (name == 0) + return get_default_activator (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_Hash_Map_Entry <ACE_CString, CIAO::Deployment_Configuration::Activator_Info> *entry; @@ -102,7 +108,7 @@ CIAO::Deployment_Configuration::get_activator (const char *name } Components::Deployment::ServerActivator_ptr -CIAO::Deployment_Configuration::get_default_activator (void) +CIAO::Deployment_Configuration::get_default_activator (ACE_ENV_SINGLE_ARG_DECL) { if (CORBA::is_nil (this->default_activator_.activator_.in ())) { diff --git a/TAO/CIAO/tools/Assembly_Deployer/Deployment_Configuration.h b/TAO/CIAO/tools/Assembly_Deployer/Deployment_Configuration.h index fc6e8e6a6d1..5279ad2cb7b 100644 --- a/TAO/CIAO/tools/Assembly_Deployer/Deployment_Configuration.h +++ b/TAO/CIAO/tools/Assembly_Deployer/Deployment_Configuration.h @@ -75,7 +75,8 @@ namespace CIAO int init (const char *filename); /** - * @retval 0 if no valid name were found. + * @retval 0 if no valid name were found. When @c name = 0, then + * this function behave exactly as get_default_activator_ior. */ virtual const char *get_activator_ior (const char *name); @@ -87,13 +88,14 @@ namespace CIAO * * @retval 0 if no valid daemon is configured. */ - virtual const char *get_default_activator_ior (void); + virtual const char *get_default_activator_ior (); /** * @retval nil if no valid name were found. */ virtual Components::Deployment::ServerActivator_ptr - get_activator (const char *name); + get_activator (const char *name + ACE_ENV_ARG_DECL_WITH_DEFAULTS); /** * Return the reference to the default ServerActivator the @@ -102,7 +104,7 @@ namespace CIAO * @retval nil if no valid daemon is configured. */ virtual Components::Deployment::ServerActivator_ptr - get_default_activator (void); + get_default_activator (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); protected: CORBA::ORB_var orb_; diff --git a/TAO/CIAO/tools/ChangeLog b/TAO/CIAO/tools/ChangeLog index b52380f71d1..11825a661a6 100644 --- a/TAO/CIAO/tools/ChangeLog +++ b/TAO/CIAO/tools/ChangeLog @@ -1,3 +1,44 @@ +Sun Aug 24 21:45:33 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * tools/Assembly_Deployer/Assembly_Deployer.mpc: + * tools/Daemon/Daemon.mpc: Both CIAO_Daemon and Assembly_Manager + depend on RTCORBA library now because they both required to + handle RTCORBA related types. + + * tools/Assembly_Deployer/Assembly_Visitors.cpp: + * tools/Assembly_Deployer/Assembly_Visitors.h: Decoupled the + container creation functionality from the creation of + ComponentServer into a separate method. This allows us to + better manage the type of container and the associating policy + sets. + + * tools/Assembly_Deployer/Deployment_Configuration.cpp: + * tools/Assembly_Deployer/Deployment_Configuration.h: Changed the + get_activator[_ior] functions to return default activator where + there's no valid activator id available instead of throwing an + exception. + + * tools/ComponentServer/ComponentServer.cpp: Invoke the init + method of ComponentServer servant. This function is now + supported. + + * tools/RTComponentServer/ComponentServer_Task.cpp: + * tools/RTComponentServer/ComponentServer_Task.h: + * tools/RTComponentServer/RTComponentServer.cpp: + * tools/RTComponentServer/RTComponentServer.mpc: + * tools/RTComponentServer/RTConfig_Manager.cpp: + * tools/RTComponentServer/RTConfig_Manager.h: + * tools/RTComponentServer/RTServer_Impl.cpp: + * tools/RTComponentServer/RTServer_Impl.h: + * tools/RTComponentServer/RTServer_Impl.inl: Added/Changed to + properly support the real-time ComponentServer implementation. + + * tools/ServerActivator/ServerActivator.cpp: Fixed a fuzz error. + + * tools/XML_Helpers/Assembly_Spec.inl: Changed to return 0 if + rtcad_filename and rtpolicyset_name is not specified in the + original XML file. + Thu Aug 14 16:27:52 2003 Nanbor Wang <nanbor@cs.wustl.edu> * tools/XML_Helpers/RTCAD-example.rtd: diff --git a/TAO/CIAO/tools/ComponentServer/ComponentServer.cpp b/TAO/CIAO/tools/ComponentServer/ComponentServer.cpp index 974080b3856..9f5619fd958 100644 --- a/TAO/CIAO/tools/ComponentServer/ComponentServer.cpp +++ b/TAO/CIAO/tools/ComponentServer/ComponentServer.cpp @@ -105,7 +105,11 @@ main (int argc, char *argv[]) // But it's not sure to me where exactly we can get the // ConfigValues needed by the init method at this moment. - // comserv_servant->init (config ACE_ENV_ARG_PARAMETER); + Components::ConfigValues configs; + + comserv_servant->init (configs + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; // Configuring ComponentServer. PortableServer::ObjectId_var cs_oid diff --git a/TAO/CIAO/tools/Daemon/Daemon.mpc b/TAO/CIAO/tools/Daemon/Daemon.mpc index e90eb7c982d..9df4271a1fa 100644 --- a/TAO/CIAO/tools/Daemon/Daemon.mpc +++ b/TAO/CIAO/tools/Daemon/Daemon.mpc @@ -11,7 +11,7 @@ project(CIAO_Daemon): ciao_server, iortable { } } -project(DaemonController) : ciao_server, acexml { +project(DaemonController) : ciao_server, acexml, rtcorba { libs += CIAO_XML_Helpers libpaths += ../XML_Helpers diff --git a/TAO/CIAO/tools/RTComponentServer/ComponentServer_Task.cpp b/TAO/CIAO/tools/RTComponentServer/ComponentServer_Task.cpp index aa26de129b9..22d216d113f 100644 --- a/TAO/CIAO/tools/RTComponentServer/ComponentServer_Task.cpp +++ b/TAO/CIAO/tools/RTComponentServer/ComponentServer_Task.cpp @@ -2,14 +2,50 @@ #include "ComponentServer_Task.h" #include "tao/RTPortableServer/RTPortableServer.h" -#include "ComponentServer_Impl.h" +#include "RTServer_Impl.h" #include "Server_init.h" #include "CIAO_ServersC.h" +#include "../XML_Helpers/XML_Utils.h" +#include "RTPortableServer/RTPortableServer.h" #if !defined (__ACE_INLINE__) # include "ComponentServer_Task.inl" #endif /* __ACE_INLINE__ */ +void +add_rtcad_configs (const char *rtcadfile, + Components::ConfigValues &configs + ACE_ENV_ARG_DECL_WITH_DEFAULTS) +{ + CIAO::RTConfiguration::RTORB_Resource_Info resources; + CIAO::RTConfiguration::Policy_Sets psets; + + if (CIAO::XML_Utils::parse_rtcad_extension (rtcadfile, + resources, + psets) == 0) + { + // Successfully parse the rtcad file. + + CORBA::ULong len = configs.length (); + configs.length (len+2); + + Components::ConfigValue *newconfig + = new OBV_Components::ConfigValue; + + newconfig->name ((const char *) "CIAO-RTResources"); + newconfig->value () <<= resources; + configs[len] = newconfig; + + ++len; + newconfig = new OBV_Components::ConfigValue; + newconfig->name ((const char *) "CIAO-RTPolicySets"); + newconfig->value () <<= psets; + configs[len] = newconfig; + } + + ACE_DEBUG ((LM_DEBUG, "Done adding RTCAD config\n")); +} + int CIAO::ComponentServer_Task::svc () { @@ -43,11 +79,12 @@ CIAO::ComponentServer_Task::svc () ACE_TRY_CHECK; // ... - CIAO::ComponentServer_Impl *comserv_servant; + CIAO::RTServer::RTComponentServer_Impl *comserv_servant; ACE_NEW_RETURN (comserv_servant, - CIAO::ComponentServer_Impl (this->orb_.in (), - root_poa.in ()), + CIAO::RTServer::RTComponentServer_Impl (this->orb_.in (), + rt_orb.in (), + root_poa.in ()), -1); PortableServer::ServantBase_var safe_servant (comserv_servant); @@ -56,7 +93,18 @@ CIAO::ComponentServer_Task::svc () // But it's not sure to me where exactly we can get the // ConfigValues needed by the init method at this moment. - // comserv_servant->init (config ACE_ENV_ARG_PARAMETER); + // @@ Manually add config values here. + + Components::ConfigValues configs; + if (this->options_.rtcad_filename_.length () != 0) + add_rtcad_configs (this->options_.rtcad_filename_.c_str (), + configs + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + comserv_servant->init (configs + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; // Configuring ComponentServer. PortableServer::ObjectId_var cs_oid @@ -78,9 +126,11 @@ CIAO::ComponentServer_Task::svc () "Unable to activate RTComponentServer object\n"), -1); - Components::Deployment::ServerActivator_var activator; - Components::ConfigValues_var config; + + // We are just storing the original configuration here. + // Currently, we don't really use this ConfigValues direclty. + Components::ConfigValues_var more_config; if (this->options_.use_callback_) { @@ -93,7 +143,7 @@ CIAO::ComponentServer_Task::svc () ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - Components::ConfigValues_out config_out (config.out ()); + Components::ConfigValues_out config_out (more_config.out ()); activator = act_callback->register_component_server (comserv_obj.in (), @@ -103,7 +153,7 @@ CIAO::ComponentServer_Task::svc () } comserv_servant->set_objref (activator.in (), - config.in (), + more_config.in (), comserv_obj.in () ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; diff --git a/TAO/CIAO/tools/RTComponentServer/ComponentServer_Task.h b/TAO/CIAO/tools/RTComponentServer/ComponentServer_Task.h index ebb953c8731..0b9c7430770 100644 --- a/TAO/CIAO/tools/RTComponentServer/ComponentServer_Task.h +++ b/TAO/CIAO/tools/RTComponentServer/ComponentServer_Task.h @@ -43,7 +43,7 @@ namespace CIAO // default ctor. _options () : use_callback_ (1) {} - // The name of the file to write stringified IOR to. + // The name of the file to write stringified IOR to. ACE_CString ior_output_filename_; // Stringified IOR of a CIAO's callback object. @@ -52,6 +52,9 @@ namespace CIAO // CIAO ComponentServer uses the callback object to pass it's // own object reference back to ServerActivator. int use_callback_; + + // RTCAD extension filename. + ACE_CString rtcad_filename_; } Options; ComponentServer_Task (ACE_Thread_Manager &thread_manager, diff --git a/TAO/CIAO/tools/RTComponentServer/RTComponentServer.cpp b/TAO/CIAO/tools/RTComponentServer/RTComponentServer.cpp index 65dace769c2..5454281b488 100644 --- a/TAO/CIAO/tools/RTComponentServer/RTComponentServer.cpp +++ b/TAO/CIAO/tools/RTComponentServer/RTComponentServer.cpp @@ -13,7 +13,7 @@ parse_args (int argc, char *argv[], CIAO::ComponentServer_Task::Options &opts) { - ACE_Get_Opt get_opts (argc, argv, "nk:o:"); + ACE_Get_Opt get_opts (argc, argv, "nk:o:r:"); int c; while ((c = get_opts ()) != -1) @@ -31,6 +31,10 @@ parse_args (int argc, opts.callback_ior_ = get_opts.opt_arg (); break; + case 'r': // get the filename of RTCAD extension file + opts.rtcad_filename_ = get_opts.opt_arg (); + break; + case '?': // display help for use of the server. default: ACE_ERROR_RETURN ((LM_ERROR, @@ -116,6 +120,7 @@ main (int argc, char **argv) int result = parse_args (argc, argv, options); + if (result != 0) return result; diff --git a/TAO/CIAO/tools/RTComponentServer/RTComponentServer.mpc b/TAO/CIAO/tools/RTComponentServer/RTComponentServer.mpc index 8397a8efb40..09cf026a514 100644 --- a/TAO/CIAO/tools/RTComponentServer/RTComponentServer.mpc +++ b/TAO/CIAO/tools/RTComponentServer/RTComponentServer.mpc @@ -12,6 +12,7 @@ project(RTComponentServer): ciao_server,rt_server { ComponentServer_Task.cpp RTComponentServer.cpp RTConfig_Manager.cpp + RTServer_Impl.cpp } } diff --git a/TAO/CIAO/tools/RTComponentServer/RTConfig_Manager.cpp b/TAO/CIAO/tools/RTComponentServer/RTConfig_Manager.cpp index 9f52a72729f..45046e02741 100644 --- a/TAO/CIAO/tools/RTComponentServer/RTConfig_Manager.cpp +++ b/TAO/CIAO/tools/RTComponentServer/RTConfig_Manager.cpp @@ -1,6 +1,5 @@ // $Id$ -#include "tao/RTCORBA/RTCORBA.h" #include "RTConfig_Manager.h" #include "ace/SString.h" @@ -152,6 +151,8 @@ CIAO::RTPolicy_Set_Manager::init (const CIAO::RTConfiguration::Policy_Sets &sets ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { + ACE_DEBUG ((LM_DEBUG, "RTPolicy_Set_Manager::init\n")); + for (CORBA::ULong i = 0; i < sets.length (); ++i) { CORBA::ULong np = sets[i].configs.length (); @@ -225,6 +226,8 @@ CIAO::RTPolicy_Set_Manager::create_single_policy ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)) { + ACE_DEBUG ((LM_DEBUG, "RTPolicy_Set_Manager::create_single_policy\n")); + CORBA::Policy_var retv; switch (policy_config.type) @@ -248,10 +251,33 @@ CIAO::RTPolicy_Set_Manager::create_single_policy break; case RTCORBA::THREADPOOL_POLICY_TYPE: - retv = this->orb_->create_policy (RTCORBA::THREADPOOL_POLICY_TYPE, - policy_config.configuration - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); + { + char *idref; + policy_config.configuration >>= idref; + RTCORBA::ThreadpoolId tpid = + this->resource_manager_.find_threadpool_by_name (idref + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + retv = this->rtorb_->create_threadpool_policy (tpid + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + } + break; + + case RTCORBA::PRIORITY_BANDED_CONNECTION_POLICY_TYPE: + { + char *idref; + policy_config.configuration >>= idref; + RTCORBA::PriorityBands_var bands = + this->resource_manager_.find_priority_bands_by_name (idref + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + retv = this->rtorb_->create_priority_banded_connection_policy (bands + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + } break; default: diff --git a/TAO/CIAO/tools/RTComponentServer/RTConfig_Manager.h b/TAO/CIAO/tools/RTComponentServer/RTConfig_Manager.h index 064129047b9..a4bc0a65cbf 100644 --- a/TAO/CIAO/tools/RTComponentServer/RTConfig_Manager.h +++ b/TAO/CIAO/tools/RTComponentServer/RTConfig_Manager.h @@ -24,6 +24,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/RTCORBA/RTCORBA.h" #include "../XML_Helpers/RTConfigurationC.h" namespace CIAO diff --git a/TAO/CIAO/tools/RTComponentServer/RTServer_Impl.cpp b/TAO/CIAO/tools/RTComponentServer/RTServer_Impl.cpp new file mode 100644 index 00000000000..fb427b4e9be --- /dev/null +++ b/TAO/CIAO/tools/RTComponentServer/RTServer_Impl.cpp @@ -0,0 +1,219 @@ +// $Id$ + +#include "RTServer_Impl.h" + +#if !defined (__ACE_INLINE__) +# include "RTServer_Impl.inl" +#endif /* __ACE_INLINE__ */ + +CIAO::RTServer::RTComponentServer_Impl::~RTComponentServer_Impl () +{ +} + +int +CIAO::RTServer::RTComponentServer_Impl::init (Components::ConfigValues &options + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ Initialize ComponentServer and create the internal container + // implementation that actually interacts with installed + // homes/components. + + ACE_NEW_THROW_EX (this->config_, + ::Components::ConfigValues (), + CORBA::INTERNAL ()); + ACE_CHECK_RETURN (-1); + + *this->config_ = options; + + this->parse_server_config_values (options + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + // We will probably need two ORBs in this process. One for the + // deployment framework, and one for the actual components. + return 0; +} + +Components::Deployment::Container_ptr +CIAO::RTServer::RTComponentServer_Impl::create_container +(const Components::ConfigValues & config + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure, + Components::InvalidConfiguration)) +{ + ACE_DEBUG ((LM_DEBUG, "RTComponentServer_Impl::create_container\n")); + + CIAO::RTServer::RTContainer_Impl *container_servant = 0; + + ACE_NEW_THROW_EX (container_servant, + CIAO::RTServer::RTContainer_Impl (this->orb_.in (), + this->poa_.in (), + this->get_objref (), + this->policy_set_manager_), + CORBA::INTERNAL ()); + ACE_CHECK_RETURN (0); + + PortableServer::ServantBase_var safe_servant (container_servant); + container_servant->init (config, + this->get_component_installation () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + PortableServer::ObjectId_var oid + = this->poa_->activate_object (container_servant + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + CORBA::Object_var obj + = this->poa_->id_to_reference (oid.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + Components::Deployment::Container_var ci + = Components::Deployment::Container::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + // Cached the objref in its servant. + container_servant->set_objref (ci.in () ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + { + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0); + + this->container_set_.add (ci.in ()); + } + + return ci._retn (); +} + +void +CIAO::RTServer::RTComponentServer_Impl:: +parse_server_config_values (const Components::ConfigValues &options + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidConfiguration)) +{ + ACE_DEBUG ((LM_DEBUG, "RTComponentServer_Impl::parse_server_config_values\n")); + + for (CORBA::ULong i = 0; i < options.length (); ++i) + { + ACE_DEBUG ((LM_DEBUG, "parse_server_options: %s\n", options[i]->name ())); + + if (ACE_OS::strcmp (options[i]->name (), "CIAO-RTResources") == 0) + { + CIAO::RTConfiguration::RTORB_Resource_Info *resource_info; + if (options[i]->value () >>= resource_info) + { + // initialize the resource manager with resource defintions. + this->resource_manager_.init (*resource_info + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + } + else if (ACE_OS::strcmp (options[i]->name (), "CIAO-RTPolicySets") == 0) + { + CIAO::RTConfiguration::Policy_Sets * policy_sets; + if (options[i]->value () >>= policy_sets) + { + // initialize the policyset manager with policy set defintions. + this->policy_set_manager_.init (*policy_sets + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + } + else + { + Components::InvalidConfiguration exc; + exc.name = CORBA::string_dup (options[i]->name ()); + exc.reason = Components::UnknownConfigValueName; + ACE_THROW (exc); + } + } +} + +// ============================================================ + +CIAO::RTServer::RTContainer_Impl::~RTContainer_Impl () +{ +} + +int +CIAO::RTServer::RTContainer_Impl::init (const Components::ConfigValues &options, + Components::Deployment::ComponentInstallation_ptr inst + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_DEBUG ((LM_DEBUG, "RTContainer_Impl::init\n")); + + this->config_ = options; + this->parse_container_config_values (options + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + this->installation_ = + Components::Deployment::ComponentInstallation::_duplicate (inst); + + // @@ Initialize container and create the internal container + // implementation that actually interacts with installed + // homes/components. + + // @@ We will need a container factory here later on when we support + // more kinds of container implementations. + + // @@ Fish out the ComponentServer object reference from <options>. + + ACE_NEW_THROW_EX (this->container_, + CIAO::Session_Container (this->orb_.in ()), + CORBA::INTERNAL ()); + ACE_CHECK_RETURN (-1); + + return this->container_->init (0, + this->Policies_.ptr () + ACE_ENV_ARG_PARAMETER); +} + +void +CIAO::RTServer::RTContainer_Impl:: +parse_container_config_values (const Components::ConfigValues &options + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidConfiguration)) +{ + ACE_DEBUG ((LM_DEBUG, "parse_container_config_values")); + + for (CORBA::ULong i = 0; i < options.length (); ++i) + { + ACE_DEBUG ((LM_DEBUG, "options.name= %s\n", options[i]->name ())); + + if (ACE_OS::strcmp (options[i]->name (), "CIAO-RTPolicySet") == 0) + { + char *ps_name; + if (options[i]->value () >>= ps_name) + { + ACE_DEBUG ((LM_DEBUG, + "-Using RTPolicySet named: %s\n", + ps_name)); + CORBA::PolicyList_var policies = + // initialize the policyset manager with policy set defintions. + this->policyset_manager_.find_policies_by_name (ps_name + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + this->Policies_ = policies; + ACE_DEBUG ((LM_DEBUG, + "Found RTPolicySet named: %s\n", + ps_name)); + } + } + else + { + Components::InvalidConfiguration exc; + exc.name = CORBA::string_dup (options[i]->name ()); + exc.reason = Components::UnknownConfigValueName; + ACE_THROW (exc); + } + } +} diff --git a/TAO/CIAO/tools/RTComponentServer/RTServer_Impl.h b/TAO/CIAO/tools/RTComponentServer/RTServer_Impl.h new file mode 100644 index 00000000000..559c02e7ed7 --- /dev/null +++ b/TAO/CIAO/tools/RTComponentServer/RTServer_Impl.h @@ -0,0 +1,153 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file RTServer_Impl.h + * + * $Id$ + * + * This file contains real-time extended implementations for the + * servants of + * Components::Deployment::ComponentServer, and + * Components::Deplayment::Container. + * + * It also contains the real-time extended version of + * CIAO::Session_Container. + * + * Currently, they are only used in the RTComponentServer + * implementation. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= + + +#ifndef CIAO_RTSERVER_IMPL_H +#define CIAO_RTSERVER_IMPL_H +#include /**/ "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ComponentServer_Impl.h" +#include "Container_Impl.h" +#include "Container_Base.h" +#include "RTConfig_Manager.h" + +namespace CIAO +{ + namespace RTServer + { + /** + * @class RTComponentServer + * + * @brief Real-time extention servant implementation of + * Components::Deployment::ComponentServer + * + * This class implements the Components::Deployment::ComponentServer + * interface as defined by the CCM spcification. As the interface + * implies, this is actually part of the deployment interface and is + * used to manage the lifecycle of containers running on the server. + */ + class RTComponentServer_Impl + : public virtual CIAO::ComponentServer_Impl + { + public: + /// Constructor + RTComponentServer_Impl (CORBA::ORB_ptr o, + RTCORBA::RTORB_ptr rto, + PortableServer::POA_ptr p); + + /// Destructor + virtual ~RTComponentServer_Impl (void); + + /// Initialize the ComponentServer with a name. + int init (::Components::ConfigValues &options + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidConfiguration)); + + virtual ::Components::Deployment::Container_ptr + create_container (const Components::ConfigValues & config + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure, + Components::InvalidConfiguration)); + + protected: + void parse_server_config_values (const Components::ConfigValues &options + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Real-time resource manager + CIAO::RTResource_Config_Manager resource_manager_; + + // Real-time Policy_Set_Manager + CIAO::RTPolicy_Set_Manager policy_set_manager_; + }; + + /** + * @class RTContainer + * + * @brief Real-time extention servant implementation of + * Components::Deployment::Container + */ + class RTContainer_Impl + : public virtual CIAO::Container_Impl + { + public: + /// Constructor + RTContainer_Impl (CORBA::ORB_ptr o, + PortableServer::POA_ptr p, + Components::Deployment::ComponentServer_ptr server, + CIAO::RTPolicy_Set_Manager &policyset_manager); + + /// Destructor + virtual ~RTContainer_Impl (void); + + /// Initialize the container with a name. + int init (const Components::ConfigValues &options, + Components::Deployment::ComponentInstallation_ptr installation + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + void parse_container_config_values (const Components::ConfigValues &options + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidConfiguration)); + + // Hold a reference to the policy manager that we use to acquire + // the policy list. + CIAO::RTPolicy_Set_Manager &policyset_manager_; + + // Effective policies + CORBA::PolicyList_var Policies_; + }; + + class RTSession_Container + : public CIAO::Session_Container + { + public: + RTSession_Container (CORBA::ORB_ptr o); + + virtual ~RTSession_Container (void); + + /// Initialize the container with a name. + virtual int init (const char *name = 0, + const CORBA::PolicyList *add_policies = 0 + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + }; + } +} + +#if defined (__ACE_INLINE__) +# include "RTServer_Impl.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* CIAO_RTSERVER_IMPL_H */ diff --git a/TAO/CIAO/tools/RTComponentServer/RTServer_Impl.inl b/TAO/CIAO/tools/RTComponentServer/RTServer_Impl.inl new file mode 100644 index 00000000000..667081695d0 --- /dev/null +++ b/TAO/CIAO/tools/RTComponentServer/RTServer_Impl.inl @@ -0,0 +1,24 @@ +/* -*- C++ -*- */ +// $Id$ + +ACE_INLINE +CIAO::RTServer::RTComponentServer_Impl::RTComponentServer_Impl (CORBA::ORB_ptr o, + RTCORBA::RTORB_ptr rto, + PortableServer::POA_ptr p) + : ComponentServer_Impl (o, p), + resource_manager_ (rto), + policy_set_manager_ (resource_manager_, o, rto) +{ +} + +ACE_INLINE +CIAO::RTServer::RTContainer_Impl::RTContainer_Impl (CORBA::ORB_ptr o, + PortableServer::POA_ptr p, + Components::Deployment::ComponentServer_ptr s, + CIAO::RTPolicy_Set_Manager &pm) + : Container_Impl (o, + p, + s), + policyset_manager_ (pm) +{ +} diff --git a/TAO/CIAO/tools/RTComponentServer/TEMP b/TAO/CIAO/tools/RTComponentServer/TEMP deleted file mode 100644 index 606c3e7d519..00000000000 --- a/TAO/CIAO/tools/RTComponentServer/TEMP +++ /dev/null @@ -1,15 +0,0 @@ -$Id$ - -This directory contains the ComponentServer implementation and a -simple test program called ComponentServer_test_client. - -ComponentServer supports the following command line flags: - - * -n : Do not try to call back ServerActivator. This is only useful - when testing the server and the server is not created by a - ServerActivator. - - * -o <filename> : Specify the filename ComponentServer will write - IOR to. This is only useful when debugging also. - - * -d <IOR> : Specify the IOR to the ServerActivator.
\ No newline at end of file diff --git a/TAO/CIAO/tools/ServerActivator/ServerActivator.cpp b/TAO/CIAO/tools/ServerActivator/ServerActivator.cpp index e7747afb208..61261a95d7d 100644 --- a/TAO/CIAO/tools/ServerActivator/ServerActivator.cpp +++ b/TAO/CIAO/tools/ServerActivator/ServerActivator.cpp @@ -1,7 +1,7 @@ // $Id$ /** - * @file Server_Activator.cpp + * @file ServerActivator.cpp * * @brief CIAO's server activator implementation * diff --git a/TAO/CIAO/tools/XML_Helpers/Assembly_Spec.inl b/TAO/CIAO/tools/XML_Helpers/Assembly_Spec.inl index 7a984378acf..e524761cc92 100644 --- a/TAO/CIAO/tools/XML_Helpers/Assembly_Spec.inl +++ b/TAO/CIAO/tools/XML_Helpers/Assembly_Spec.inl @@ -91,6 +91,8 @@ CIAO::Assembly_Placement::homeplacement::componentfileref (const char *ref) ACE_INLINE const char * CIAO::Assembly_Placement::homeplacement::rtpolicyset_ref (void) const { + if (this->rtpolicyset_ref_.length () == 0) + return 0; return this->rtpolicyset_ref_.c_str (); } @@ -127,6 +129,8 @@ CIAO::Assembly_Placement::processcollocation::rtcad_filename (const char *fn) ACE_INLINE const char * CIAO::Assembly_Placement::processcollocation::rtcad_filename () const { + if (this->rtcad_filename_.length () == 0) + return 0; return this->rtcad_filename_.c_str (); } |