diff options
author | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-02-28 04:25:09 +0000 |
---|---|---|
committer | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-02-28 04:25:09 +0000 |
commit | 3b8d28c9e5eb018f4ac5edae8efde18a06a8ecc6 (patch) | |
tree | b4d8bd23544debe69979d27e6f8044838cc05913 | |
parent | b47e229129d4e553473481668e3ad1160371d636 (diff) | |
download | ATCD-3b8d28c9e5eb018f4ac5edae8efde18a06a8ecc6.tar.gz |
*** empty log message ***
-rw-r--r-- | TAO/CIAO/ChangeLog | 24 | ||||
-rw-r--r-- | TAO/CIAO/ciao/ComponentServer_Impl.h | 2 | ||||
-rw-r--r-- | TAO/CIAO/ciao/ServerActivator_Impl.cpp | 10 | ||||
-rw-r--r-- | TAO/CIAO/ciao/ServerActivator_Impl.h | 6 | ||||
-rw-r--r-- | TAO/CIAO/examples/handcrafted/Hello/hello_servants.cpp | 92 | ||||
-rw-r--r-- | TAO/CIAO/examples/handcrafted/Hello/hello_servants.h | 11 | ||||
-rw-r--r-- | TAO/CIAO/tools/Daemon/CIAO_Daemon.cpp | 63 | ||||
-rw-r--r-- | TAO/CIAO/tools/ServerActivator/README | 7 | ||||
-rw-r--r-- | TAO/CIAO/tools/ServerActivator/ServerActivator.cpp | 22 | ||||
-rw-r--r-- | TAO/CIAO/tools/ServerActivator/ServerActivator_test_client.cpp | 1 |
10 files changed, 94 insertions, 144 deletions
diff --git a/TAO/CIAO/ChangeLog b/TAO/CIAO/ChangeLog index a389e6146b8..ae5ab3a20ff 100644 --- a/TAO/CIAO/ChangeLog +++ b/TAO/CIAO/ChangeLog @@ -1,3 +1,27 @@ +Thu Feb 27 22:15:48 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * ciao/ComponentServer_Impl.h: Fixed a cut-n-paste error in a comment. + + * ciao/ServerActivator_Impl.cpp: + * ciao/ServerActivator_Impl.h: Changed to cache an IOR to + the ComponentInstallation interface and pass the IOR with + -ORBInitRef option to the ComponentServer. We will need it when + installing a component home in the container. + + * examples/handcrafted/Hello/hello_servants.cpp: + * examples/handcrafted/Hello/hello_servants.h: Removed inheriting + the component specific context from the SessionContext local + interface. This component example should be run as Service + component, not Session component. + + * tools/ServerActivator/README: + * tools/Daemon/CIAO_Daemon.cpp: + * tools/ServerActivator/ServerActivator.cpp: Changed to propagate + the ComponentInstallation somehow. + + * tools/ServerActivator/ServerActivator_test_client.cpp: Removed a + redundant $Id$ tag. + Sat Feb 22 23:45:52 2003 Nanbor Wang <nanbor@cs.wustl.edu> * docs/releasenotes.html: diff --git a/TAO/CIAO/ciao/ComponentServer_Impl.h b/TAO/CIAO/ciao/ComponentServer_Impl.h index 17e0140702c..95c56fb21d5 100644 --- a/TAO/CIAO/ciao/ComponentServer_Impl.h +++ b/TAO/CIAO/ciao/ComponentServer_Impl.h @@ -55,7 +55,7 @@ namespace CIAO /// increase the reference count of the POA. virtual PortableServer::POA_ptr _default_POA (void); - /// Initialize the container with a name. + /// Initialize the ComponentServer with a name. int init (::Components::ConfigValues &options ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); diff --git a/TAO/CIAO/ciao/ServerActivator_Impl.cpp b/TAO/CIAO/ciao/ServerActivator_Impl.cpp index 2f2aa3d9e36..883b5949ea7 100644 --- a/TAO/CIAO/ciao/ServerActivator_Impl.cpp +++ b/TAO/CIAO/ciao/ServerActivator_Impl.cpp @@ -46,7 +46,8 @@ CIAO::ServerActivator_Impl::_default_POA (void) int CIAO::ServerActivator_Impl::init (const char *server_location, - CORBA::ULong spawn_delay + CORBA::ULong spawn_delay, + const char *installation_ior ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { @@ -58,6 +59,8 @@ CIAO::ServerActivator_Impl::init (const char *server_location, this->server_path_ = CORBA::string_dup (server_location); + this->installation_ior_ = CORBA::string_dup (installation_ior); + PortableServer::POAManager_var mgr = this->poa_->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (-1); @@ -146,9 +149,10 @@ CIAO::ServerActivator_Impl::create_component_server (const Components::ConfigVal ACE_TRY_CHECK; // spawn the new ComponentServer. - options.command_line ("%s -k %s", + options.command_line ("%s -k %s -ORBInitRef ComponentInstallation=%s", this->server_path_.in (), - cb_ior.in ()); + cb_ior.in (), + this->installation_ior_.in ()); options.avoid_zombies (1); if (component_server.spawn (options) == -1) diff --git a/TAO/CIAO/ciao/ServerActivator_Impl.h b/TAO/CIAO/ciao/ServerActivator_Impl.h index 6930e461baf..2292afd44ba 100644 --- a/TAO/CIAO/ciao/ServerActivator_Impl.h +++ b/TAO/CIAO/ciao/ServerActivator_Impl.h @@ -110,7 +110,8 @@ namespace CIAO /// ServerActivator should wait (in second) for ComponentServer to /// call back. int init (const char *server_location, - CORBA::ULong delay + CORBA::ULong delay, + const char *installation_ior ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); @@ -152,6 +153,9 @@ namespace CIAO /// Child poa that uses active object map. PortableServer::POA_var callback_poa_; + /// Cached the IOR string to ComponentInstallation Interface + CORBA::String_var installation_ior_; + /// Specify the time in second ServerActivator will wait for a /// child ComponentServer to callback. Default is 5 second. CORBA::ULong spawn_delay_; diff --git a/TAO/CIAO/examples/handcrafted/Hello/hello_servants.cpp b/TAO/CIAO/examples/handcrafted/Hello/hello_servants.cpp index bfe28b1e887..964fede30af 100644 --- a/TAO/CIAO/examples/handcrafted/Hello/hello_servants.cpp +++ b/TAO/CIAO/examples/handcrafted/Hello/hello_servants.cpp @@ -20,72 +20,6 @@ CIAO_HelloWorld_Context::~CIAO_HelloWorld_Context () } -void * -CIAO_HelloWorld_Context::_tao_QueryInterface (ptr_arith_t type) -{ - void *retv = 0; - - if (type == ACE_reinterpret_cast ( - ptr_arith_t, - &CCM_HelloWorld_Context::_tao_class_id) - ) - { - retv = ACE_reinterpret_cast (void*, this); - } - else if (type == ACE_reinterpret_cast ( - ptr_arith_t, - &::Components::SessionContext::_tao_class_id) - ) - { - retv = - ACE_reinterpret_cast ( - void *, - ACE_static_cast ( - Components::SessionContext_ptr, - this - ) - ); - } - else if (type == ACE_reinterpret_cast ( - ptr_arith_t, - &::Components::CCMContext::_tao_class_id) - ) - { - retv = - ACE_reinterpret_cast ( - void *, - ACE_static_cast ( - Components::CCMContext_ptr, - this - ) - ); - } - else if (type == ACE_reinterpret_cast ( - ptr_arith_t, - &CORBA::Object::_tao_class_id) - ) - { - retv = - ACE_reinterpret_cast ( - void *, - ACE_static_cast (CORBA::Object_ptr, this) - ); - } - - if (retv != 0) - { - this->_add_ref (); - } - - return retv; -} - -const char* -CIAO_HelloWorld_Context::_interface_repository_id (void) const -{ - return CCM_HelloWorld_Context::_interface_repository_id (); -} - // Operations for HellowWorld attributes, event source, and // receptable defined in CCM_HelloWorld_Context. @@ -144,32 +78,6 @@ CIAO_HelloWorld_Context::set_rollback_only (ACE_ENV_SINGLE_ARG_DECL) } -// Operations for ::Components::SessionContext interface -CORBA::Object_ptr -CIAO_HelloWorld_Context::get_CCM_object (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - Components::IllegalState)) -{ - // @@ How do I check for IllegalState here? When it's not in a - // callback operation... - // ACE_THROW_RETURN (::Components::IllegalState (), 0); - - if (CORBA::is_nil (this->component_.in ())) - { - CORBA::Object_var obj = this->container_->get_objref (this->servant_ - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - this->component_ = HelloWorld::_narrow (obj.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - if (CORBA::is_nil (this->component_.in ())) - ACE_THROW_RETURN (CORBA::INTERNAL (), 0); // This should not happen... - } - return HelloWorld::_duplicate (this->component_.in ()); -} - //////////////////////////////////////////////////////////////// /////////////////// CIAO_HelloWorld_Servant //////////////////// diff --git a/TAO/CIAO/examples/handcrafted/Hello/hello_servants.h b/TAO/CIAO/examples/handcrafted/Hello/hello_servants.h index 317a588a0ee..02cb8dc18f6 100644 --- a/TAO/CIAO/examples/handcrafted/Hello/hello_servants.h +++ b/TAO/CIAO/examples/handcrafted/Hello/hello_servants.h @@ -28,8 +28,7 @@ class CIAO_HelloWorld_Servant; class HELLO_SERVANT_Export CIAO_HelloWorld_Context : - public virtual CCM_HelloWorld_Context, - public virtual ::Components::SessionContext + public virtual CCM_HelloWorld_Context { public: // Ctor. @@ -44,9 +43,6 @@ public: // This is strange, but thankfully, this is generated code so it's // okay (?) to mess with this. - virtual void *_tao_QueryInterface (ptr_arith_t type); - virtual const char* _interface_repository_id (void) const; - // Operations for HellowWorld attributes, event source, and // receptable defined in CCM_HelloWorld_Context. @@ -69,11 +65,6 @@ public: Components::IllegalState)); - // Operations for ::Components::SessionContext interface - virtual CORBA::Object_ptr get_CCM_object (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - Components::IllegalState)); - protected: ::Components::CCMHome_var home_; diff --git a/TAO/CIAO/tools/Daemon/CIAO_Daemon.cpp b/TAO/CIAO/tools/Daemon/CIAO_Daemon.cpp index 308188fbf2f..1f7802d07bb 100644 --- a/TAO/CIAO/tools/Daemon/CIAO_Daemon.cpp +++ b/TAO/CIAO/tools/Daemon/CIAO_Daemon.cpp @@ -140,73 +140,74 @@ main (int argc, char *argv[]) // Implicit activation CIAO::Daemon_var daemon = daemon_servant->_this (); - // Create and install the ServerActivator servant + // Create and install the ComponentInstallation servant - CIAO::ServerActivator_Impl *activator_servant = 0; + CIAO::ComponentInstallation_Impl *installation_servant = 0; - ACE_NEW_RETURN (activator_servant, - CIAO::ServerActivator_Impl (orb.in (), - poa.in ()), + ACE_NEW_RETURN (installation_servant, + CIAO::ComponentInstallation_Impl (orb.in (), + poa.in ()), -1); - activator_servant->init (comserv_path_, - spawn_wait_ - ACE_ENV_ARG_PARAMETER); + installation_servant->init (installation_datafile_, + section_name_ + ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - PortableServer::ServantBase_var safe_activator (activator_servant); + PortableServer::ServantBase_var safe_installation (installation_servant); - Components::Deployment::ServerActivator_ptr activator - = activator_servant->_ciao_get_objref (); + Components::Deployment::ComponentInstallation_var installation + = installation_servant->_this (); - CORBA::String_var str = orb->object_to_string (activator + CORBA::String_var str = orb->object_to_string (installation.in () ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - adapter->bind ("ServerActivator", str.in () ACE_ENV_ARG_PARAMETER); + adapter->bind ("ComponentInstallation", str.in () ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - if (daemon_servant->bind ("ServerActivator", activator) != 0) + if (daemon_servant->bind ("ComponentInstallation", installation.in ()) != 0) ACE_ERROR_RETURN ((LM_ERROR, - "Failed to register ServerActivator with CIAO Daemon\n"), + "Failed to register ComponentInstallation with CIAO Daemon\n"), -1); - // Create and install the ComponentInstallation servant + // Create and install the ServerActivator servant - CIAO::ComponentInstallation_Impl *installation_servant = 0; + CIAO::ServerActivator_Impl *activator_servant = 0; - ACE_NEW_RETURN (installation_servant, - CIAO::ComponentInstallation_Impl (orb.in (), - poa.in ()), + ACE_NEW_RETURN (activator_servant, + CIAO::ServerActivator_Impl (orb.in (), + poa.in ()), -1); - installation_servant->init (installation_datafile_, - section_name_ - ACE_ENV_ARG_PARAMETER); + activator_servant->init (comserv_path_, + spawn_wait_, + str.in () + ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - PortableServer::ServantBase_var safe_installation (installation_servant); + PortableServer::ServantBase_var safe_activator (activator_servant); - Components::Deployment::ComponentInstallation_var installation - = installation_servant->_this (); + Components::Deployment::ServerActivator_ptr activator + = activator_servant->_ciao_get_objref (); - str = orb->object_to_string (installation.in () + str = orb->object_to_string (activator ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - adapter->bind ("ComponentInstallation", str.in () ACE_ENV_ARG_PARAMETER); + adapter->bind ("ServerActivator", str.in () ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - if (daemon_servant->bind ("ComponentInstallation", installation.in ()) != 0) + if (daemon_servant->bind ("ServerActivator", activator) != 0) ACE_ERROR_RETURN ((LM_ERROR, - "Failed to register ComponentInstallation with CIAO Daemon\n"), + "Failed to register ServerActivator with CIAO Daemon\n"), -1); + // Now register daemon with IOR table and write its IOR. str = orb->object_to_string (daemon.in () ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - // Now register daemon with IOR table and write its IOR. adapter->bind ("CIAO-Daemon", str.in () ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; diff --git a/TAO/CIAO/tools/ServerActivator/README b/TAO/CIAO/tools/ServerActivator/README index c9ba3589d0b..1335c11b1a7 100644 --- a/TAO/CIAO/tools/ServerActivator/README +++ b/TAO/CIAO/tools/ServerActivator/README @@ -27,6 +27,13 @@ Other command line flags supported by ServerActivator include: * -o <filename> : Specify the filename ServerActivator uses to write the IOR. + * -i <ior> : Specify the IOR for the ComponentInstallation interface. + It will be passed as + + "-ORBInitRef ComponentInstallation=<ior>" + + command line options to the ComponentServer. + * -d <second> : Specify the time, in second, ServerActivator will wait for the ComponentServer to callback to notify ServerActivator their IOR. ServerActivator diff --git a/TAO/CIAO/tools/ServerActivator/ServerActivator.cpp b/TAO/CIAO/tools/ServerActivator/ServerActivator.cpp index 1a8996a0b4b..44cf4def4cb 100644 --- a/TAO/CIAO/tools/ServerActivator/ServerActivator.cpp +++ b/TAO/CIAO/tools/ServerActivator/ServerActivator.cpp @@ -19,12 +19,13 @@ char *ior_file_name_ = 0; char *comserv_path_ = "../ComponentServer/ComponentServer"; +char *installation_ior_ = 0; CORBA::ULong spawn_wait_ = 5; int parse_args (int argc, char *argv[]) { - ACE_Get_Opt get_opts (argc, argv, "n:o:d:"); + ACE_Get_Opt get_opts (argc, argv, "n:o:d:i:"); int c; while ((c = get_opts ()) != -1) @@ -32,15 +33,19 @@ parse_args (int argc, char *argv[]) { case 'o': // get the file name to write to ior_file_name_ = get_opts.opt_arg (); - break; + break; case 'n': // get the path name to the component server comserv_path_ = get_opts.opt_arg (); - break; + break; case 'd': // get the path name to the component server spawn_wait_ = ACE_OS::atoi (get_opts.opt_arg ()); - break; + break; + + case 'i': // get the ior to a ComponentInstallation interface + installation_ior_ = get_opts.opt_arg (); + break; case '?': // display help for use of the server. default: @@ -54,6 +59,12 @@ parse_args (int argc, char *argv[]) -1); } + if (installation_ior_ == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "An IOR to a ComponentInstallation interface is needed." + " Specified with \"-i <ior>\"\n"), + -1); + return 0; } @@ -115,7 +126,8 @@ main (int argc, char *argv[]) -1); activator_servant->init (comserv_path_, - spawn_wait_ + spawn_wait_, + installation_ior_ ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; diff --git a/TAO/CIAO/tools/ServerActivator/ServerActivator_test_client.cpp b/TAO/CIAO/tools/ServerActivator/ServerActivator_test_client.cpp index 7457dc99d36..e969783ea63 100644 --- a/TAO/CIAO/tools/ServerActivator/ServerActivator_test_client.cpp +++ b/TAO/CIAO/tools/ServerActivator/ServerActivator_test_client.cpp @@ -1,5 +1,4 @@ // $Id$ -// $Id$ #include "CCM_DeploymentC.h" #include "Client_init.h" |