summaryrefslogtreecommitdiff
path: root/TAO
diff options
context:
space:
mode:
authornanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-07-07 03:41:19 +0000
committernanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-07-07 03:41:19 +0000
commit538a477421b04055f6f32ae80eb952081e0fcd74 (patch)
treeed4a6c7ab81e4ad79994616be7dc46c10f2863e1 /TAO
parent7c445ab5b4e9f37d091466156c678ecca0a8b3f0 (diff)
downloadATCD-538a477421b04055f6f32ae80eb952081e0fcd74.tar.gz
ChangeLogTag:Sun Jul 06 21:40:39 2003 Nanbor Wang <nanbor@cs.wustl.edu>
Diffstat (limited to 'TAO')
-rw-r--r--TAO/CIAO/ChangeLog53
-rw-r--r--TAO/CIAO/ciao/CIAO_Servers.idl5
-rw-r--r--TAO/CIAO/ciao/ComponentServer_Impl.h1
-rw-r--r--TAO/CIAO/ciao/ComponentServer_Impl.inl2
-rw-r--r--TAO/CIAO/ciao/ServerActivator_Impl.cpp201
-rw-r--r--TAO/CIAO/ciao/ServerActivator_Impl.h107
-rw-r--r--TAO/CIAO/ciao/ServerActivator_Impl.inl10
-rw-r--r--TAO/CIAO/ciao/Server_init.cpp19
-rw-r--r--TAO/CIAO/ciao/Server_init.h10
-rw-r--r--TAO/CIAO/docs/ConfigValues.html15
-rw-r--r--TAO/CIAO/examples/OEP/Display/descriptors/svcmap.dat3
-rw-r--r--TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.cpp19
-rw-r--r--TAO/CIAO/tools/Assembly_Deployer/Deployment_Configuration.cpp5
-rw-r--r--TAO/CIAO/tools/ComponentServer/ComponentServer.cpp30
-rw-r--r--TAO/CIAO/tools/Daemon/CIAO_Daemon.cpp19
-rw-r--r--TAO/CIAO/tools/Daemon/README5
-rw-r--r--TAO/CIAO/tools/Simple_Component_Server/Simple_Component_Server.cpp1
17 files changed, 429 insertions, 76 deletions
diff --git a/TAO/CIAO/ChangeLog b/TAO/CIAO/ChangeLog
index 430973b801d..aae1de12997 100644
--- a/TAO/CIAO/ChangeLog
+++ b/TAO/CIAO/ChangeLog
@@ -1,3 +1,56 @@
+Sun Jul 06 21:40:39 2003 Nanbor Wang <nanbor@cs.wustl.edu>
+
+ There are two major changes in this entry.
+
+ 1. A scheme for associating component server with a logical
+ configuration and to map the logical name to a real svc.conf
+ file. Each local CIAO_Daemon can determine what default
+ svc.conf file to use, if none specified, and how logical
+ names map to actual svc.conf files.
+
+ 2. Added mechanism to pass the ConfigValues from
+ Components::Deployment::ServerActivator::create_component_server
+ to a Components::Deployment::ComponentServer instance which it
+ can later use for futher configure the ComponentServer.
+
+ * ciao/Server_init.cpp:
+ * ciao/Server_init.h: Added a new Utility namespace for commonly
+ used server side functions. Currently only a write_IOR
+ method is available.
+
+ * ciao/CIAO_Servers.idl: Updated
+ CIAO::Activator_Callback::register_component_server method to
+ pass back ComponentServer's ConfigValues.
+
+ * docs/ConfigValues.html: Docuement the new ConfigValue name
+ ("CIAO-svcconf-id") that CIAO recognize.
+
+ * ciao/ServerActivator_Impl.cpp:
+ * ciao/ServerActivator_Impl.h:
+ * ciao/ServerActivator_Impl.inl: Changed to support:
+
+ Activator_Callback change.
+
+ Mechanisms to maintain an (id, svc.conf) mapping, and keeping a
+ default svc.conf file.
+
+ * ciao/ComponentServer_Impl.h:
+ * ciao/ComponentServer_Impl.inl: Changed to update the
+ ConfigValues when calling back to the ServerActivator.
+
+ * examples/OEP/Display/descriptors/svcmap.dat: Added an example
+ svcconf-id to svc.conf filename mapping file.
+
+ * tools/Assembly_Deployer/Assembly_Visitors.cpp:
+
+ * tools/Assembly_Deployer/Deployment_Configuration.cpp: Enhanced
+ to provide a more comprehensive error message.
+
+ * tools/ComponentServer/ComponentServer.cpp:
+ * tools/Daemon/CIAO_Daemon.cpp:
+ * tools/Daemon/README:
+ * tools/Simple_Component_Server/Simple_Component_Server.cpp:
+
Sun Jul 06 19:41:06 2003 Nanbor Wang <nanbor@cs.wustl.edu>
* examples/OEP/Display/NavDisplayGUI_exec/README: Documented how
diff --git a/TAO/CIAO/ciao/CIAO_Servers.idl b/TAO/CIAO/ciao/CIAO_Servers.idl
index 19180649f38..8f5b7fcf3ee 100644
--- a/TAO/CIAO/ciao/CIAO_Servers.idl
+++ b/TAO/CIAO/ciao/CIAO_Servers.idl
@@ -13,7 +13,8 @@ module CIAO
{
interface Activator_Callback
{
- ::Components::Deployment::ServerActivator
- register_component_server (in ::Components::Deployment::ComponentServer svr);
+ Components::Deployment::ServerActivator
+ register_component_server (in Components::Deployment::ComponentServer svr,
+ out Components::ConfigValues config);
};
};
diff --git a/TAO/CIAO/ciao/ComponentServer_Impl.h b/TAO/CIAO/ciao/ComponentServer_Impl.h
index 93d36f89b82..d9be8bd8782 100644
--- a/TAO/CIAO/ciao/ComponentServer_Impl.h
+++ b/TAO/CIAO/ciao/ComponentServer_Impl.h
@@ -93,6 +93,7 @@ namespace CIAO
// ------------ CIAO Internal operations -------------
/// Set the cached object reference
void set_objref (Components::Deployment::ServerActivator_ptr act,
+ const Components::ConfigValues &config,
Components::Deployment::ComponentServer_ptr cs = 0
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException));
diff --git a/TAO/CIAO/ciao/ComponentServer_Impl.inl b/TAO/CIAO/ciao/ComponentServer_Impl.inl
index 01c3dc84711..5b2f94c6b32 100644
--- a/TAO/CIAO/ciao/ComponentServer_Impl.inl
+++ b/TAO/CIAO/ciao/ComponentServer_Impl.inl
@@ -11,6 +11,7 @@ CIAO::ComponentServer_Impl::ComponentServer_Impl (CORBA::ORB_ptr o,
ACE_INLINE void
CIAO::ComponentServer_Impl::set_objref (Components::Deployment::ServerActivator_ptr act,
+ const Components::ConfigValues &config,
Components::Deployment::ComponentServer_ptr cs
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
@@ -18,6 +19,7 @@ CIAO::ComponentServer_Impl::set_objref (Components::Deployment::ServerActivator_
if (!CORBA::is_nil (this->activator_.in ()) || !CORBA::is_nil (this->objref_.in ()))
ACE_THROW (CORBA::BAD_INV_ORDER ());
+ this->config_ = new Components::ConfigValues (config);
this->activator_ = Components::Deployment::ServerActivator::_duplicate (act);
this->objref_ = Components::Deployment::ComponentServer::_duplicate (cs);
}
diff --git a/TAO/CIAO/ciao/ServerActivator_Impl.cpp b/TAO/CIAO/ciao/ServerActivator_Impl.cpp
index 5ddf15697b0..daa690b42b6 100644
--- a/TAO/CIAO/ciao/ServerActivator_Impl.cpp
+++ b/TAO/CIAO/ciao/ServerActivator_Impl.cpp
@@ -2,11 +2,23 @@
#include "ServerActivator_Impl.h"
#include "ace/Process.h"
+#include "ace/Read_Buffer.h"
#if !defined (__ACE_INLINE__)
# include "ServerActivator_Impl.inl"
#endif /* __ACE_INLINE__ */
+CIAO::Activator_Callback_Impl::Activator_Callback_Impl (CORBA::ORB_ptr o,
+ PortableServer::POA_ptr p,
+ Components::Deployment::ServerActivator_ptr s,
+ const Components::ConfigValues &config )
+ : orb_ (CORBA::ORB::_duplicate (o)),
+ poa_ (PortableServer::POA::_duplicate (p)),
+ activator_ (s)
+{
+ this->config_ = new Components::ConfigValues (config);
+}
+
CIAO::Activator_Callback_Impl::~Activator_Callback_Impl ()
{
}
@@ -17,15 +29,19 @@ CIAO::Activator_Callback_Impl::_default_POA (void)
return PortableServer::POA::_duplicate (this->poa_.in ());
}
-::Components::Deployment::ServerActivator_ptr
-CIAO::Activator_Callback_Impl::register_component_server (::Components::Deployment::ComponentServer_ptr svr)
+Components::Deployment::ServerActivator_ptr
+CIAO::Activator_Callback_Impl::register_component_server (Components::Deployment::ComponentServer_ptr svr,
+ Components::ConfigValues_out config
+ ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- this->server_ = ::Components::Deployment::ComponentServer::_duplicate (svr);
- return ::Components::Deployment::ServerActivator::_duplicate (this->activator_);
+ config = this->config_._retn ();
+
+ this->server_ = Components::Deployment::ComponentServer::_duplicate (svr);
+ return Components::Deployment::ServerActivator::_duplicate (this->activator_);
}
-::Components::Deployment::ComponentServer_ptr
+Components::Deployment::ComponentServer_ptr
CIAO::Activator_Callback_Impl::get_server_ref (void)
{
// Relinquish the ownership of the server reference. This method
@@ -47,7 +63,9 @@ CIAO::ServerActivator_Impl::_default_POA (void)
int
CIAO::ServerActivator_Impl::init (const char *server_location,
CORBA::ULong spawn_delay,
- const char *installation_ior
+ const char *installation_ior,
+ const char *default_svcconf,
+ const char *svc_conf_map
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
@@ -62,6 +80,13 @@ CIAO::ServerActivator_Impl::init (const char *server_location,
if (spawn_delay_ == 0)
ACE_THROW_RETURN (CORBA::BAD_PARAM (), -1);
+ // Initialize svc.conf map
+ if (this->init_svcconf_map (svc_conf_map) != 0)
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (), -1);
+
+ if (default_svcconf != 0)
+ this->default_svcconf_file_ = default_svcconf;
+
this->server_path_ = CORBA::string_dup (server_location);
this->installation_ior_ = CORBA::string_dup (installation_ior);
@@ -92,7 +117,7 @@ CIAO::ServerActivator_Impl::init (const char *server_location,
ACE_CHECK_RETURN (-1);
// And cache the object reference.
- this->objref_ = ::Components::Deployment::ServerActivator::_narrow (obj.in ()
+ this->objref_ = Components::Deployment::ServerActivator::_narrow (obj.in ()
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (-1);
@@ -103,18 +128,136 @@ CIAO::ServerActivator_Impl::init (const char *server_location,
return 0;
}
-::Components::Deployment::ComponentServer_ptr
+int
+CIAO::ServerActivator_Impl::init_svcconf_map (const char *filename)
+{
+ // It's fine if no svcconf map filename is provided. User assumes
+ // it's okay to use the default.
+ if (filename == 0)
+ return 0;
+
+ FILE *inf = ACE_OS::fopen (filename, "r");
+
+ if (inf != NULL)
+ {
+ ACE_Read_Buffer ior_buffer (inf);
+ char *data = 0;
+
+ while ((data = ior_buffer.read ('\n')) != 0)
+ {
+ ACE_CString aline (data);
+
+ // Each entry line is a comma delimited (hint, pathname) tuple.
+ ssize_t delpos = aline.find (',');
+
+ // Skip over comments (lines that start with '#' or invalid entries
+ // (lines without delimitor.)
+ if (aline[0] == '#' || delpos == ACE_CString::npos)
+ continue;
+
+ ACE_CString hint = aline.substring (0, delpos);
+ ACE_CString svcconf_name = aline.substring (delpos+1);
+
+ switch (this->svc_conf_map_.bind (hint, svcconf_name))
+ {
+ case 0:
+ // All is fine.
+ // Debug info:
+ ACE_DEBUG ((LM_DEBUG,
+ "Bound svc.conf hint \"%s\" successfully\n",
+ hint.c_str ()));
+ break;
+
+ case 1:
+ ACE_DEBUG ((LM_DEBUG,
+ "Duplication svc.conf hint \"%s\" found - ignore\n",
+ hint.c_str ()));
+ break;
+
+ case -1:
+ default:
+ // Unrecoverable error!!
+ ACE_ERROR_RETURN ((LM_DEBUG,
+ "Fail to bind svc.conf hint \"%s\" - abort\n",
+ hint.c_str ()),
+ -1);
+ }
+ }
+ }
+ else
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Fail to open svcconf map data file: %s.\n",
+ filename),
+ -1);
+
+ return 0;
+}
+
+const char *
+CIAO::ServerActivator_Impl::lookup_svcconf_pathname (const char *hint) const
+{
+ // Change this function to change the strategy of applying svc.conf files.
+
+ if (hint == 0)
+ {
+ if (this->default_svcconf_file_.length () > 0)
+ return this->default_svcconf_file_.c_str ();
+ else
+ return 0;
+ }
+
+ SVCCONF_MAP::ENTRY *entry;
+ if (this->svc_conf_map_.find (hint, entry) == 0)
+ return entry->int_id_.c_str ();
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Unable to find matching svc.conf file from hint: %s\n",
+ hint),
+ 0);
+}
+
+void
+CIAO::ServerActivator_Impl::parse_config_value (const Components::ConfigValues &options,
+ CompServ_Config_Info &config_info
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::InvalidConfiguration))
+{
+ for (CORBA::ULong l = 0; l < options.length (); ++l)
+ {
+ if (ACE_OS::strcmp (options[l]->name (), "CIAO-svcconf-id") == 0)
+ {
+ const char *str_in = 0;
+ if (options[l]->value () >>= str_in)
+ config_info.svcconf_hint_ = CORBA::string_dup (str_in);
+ ACE_CHECK;
+ }
+ else
+ {
+ Components::InvalidConfiguration exc;
+ exc.name = CORBA::string_dup (options[l]->name ());
+ exc.reason = Components::InvalidConfigValueType;
+ ACE_THROW (exc);
+ }
+ }
+}
+
+
+Components::Deployment::ComponentServer_ptr
CIAO::ServerActivator_Impl::create_component_server (const Components::ConfigValues & config
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
Components::CreateFailure,
Components::InvalidConfiguration))
{
- ACE_UNUSED_ARG (config); // This will be used later.
+ CompServ_Config_Info config_info;
+ this->parse_config_value (config,
+ config_info
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
ACE_DEBUG ((LM_DEBUG, "CIAO::ServerActivator_Impl::create_component_server\n"));
- ::Components::Deployment::ComponentServer_var retval;
+ Components::Deployment::ComponentServer_var retval;
// @@ Need to figure out a way to pass the config data over to the
// ComponentServer. One option will be to convert it (again) into
@@ -125,7 +268,8 @@ CIAO::ServerActivator_Impl::create_component_server (const Components::ConfigVal
ACE_NEW_THROW_EX (callback_servant,
CIAO::Activator_Callback_Impl (this->orb_.in (),
this->callback_poa_.in (),
- this->objref_.in ()),
+ this->objref_.in (),
+ config),
CORBA::INTERNAL ());
ACE_CHECK_RETURN (0);
@@ -155,17 +299,32 @@ CIAO::ServerActivator_Impl::create_component_server (const Components::ConfigVal
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
- // spawn the new ComponentServer.
- options.command_line ("%s -k %s -ORBInitRef ComponentInstallation=%s",
- this->server_path_.in (),
- cb_ior.in (),
- this->installation_ior_.in ());
+ const char *svcconf_path =
+ this->lookup_svcconf_pathname (config_info.svcconf_hint_.in ());
+
+ // spawn the new ComponentServer.
+ if (svcconf_path == 0)
+ options.command_line ("%s -k %s -ORBInitRef ComponentInstallation=%s",
+ this->server_path_.in (),
+ cb_ior.in (),
+ this->installation_ior_.in ());
+ else
+ {
+ ACE_DEBUG((LM_DEBUG, "Using svcconf file: %s\n",
+ svcconf_path));
+ options.command_line ("%s -k %s -ORBInitRef ComponentInstallation=%s "
+ "-ORBSvcConf %s",
+ this->server_path_.in (),
+ cb_ior.in (),
+ this->installation_ior_.in (),
+ svcconf_path);
+ }
options.avoid_zombies (1);
if (component_server.spawn (options) == -1)
{
ACE_DEBUG ((LM_ERROR, "Fail to spawn a ComponentServer process\n"));
- ACE_TRY_THROW (::Components::CreateFailure ());
+ ACE_TRY_THROW (Components::CreateFailure ());
}
// wait for server to pass back its object reference. with a timeout value.
@@ -190,7 +349,7 @@ CIAO::ServerActivator_Impl::create_component_server (const Components::ConfigVal
if (CORBA::is_nil (retval.in ()))
{
ACE_DEBUG ((LM_ERROR, "Fail to acquire the ComponentServer object\n"));
- ACE_TRY_THROW (::Components::CreateFailure ());
+ ACE_TRY_THROW (Components::CreateFailure ());
}
{
@@ -225,7 +384,7 @@ CIAO::ServerActivator_Impl::remove_component_server (Components::Deployment::Com
ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_);
if (this->cs_set_.object_in_set (server) == 0)
- ACE_THROW (::Components::RemoveFailure ());
+ ACE_THROW (Components::RemoveFailure ());
server->remove (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK;
@@ -233,10 +392,10 @@ CIAO::ServerActivator_Impl::remove_component_server (Components::Deployment::Com
// Should we remove the server still even if the previous call failed.
if (this->cs_set_.remove (server) == -1)
- ACE_THROW (::Components::RemoveFailure ());
+ ACE_THROW (Components::RemoveFailure ());
}
-::Components::Deployment::ComponentServers *
+Components::Deployment::ComponentServers *
CIAO::ServerActivator_Impl::get_component_servers (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
diff --git a/TAO/CIAO/ciao/ServerActivator_Impl.h b/TAO/CIAO/ciao/ServerActivator_Impl.h
index cdc2abc5ffe..f71869cfa42 100644
--- a/TAO/CIAO/ciao/ServerActivator_Impl.h
+++ b/TAO/CIAO/ciao/ServerActivator_Impl.h
@@ -47,7 +47,8 @@ namespace CIAO
/// Constructor.
Activator_Callback_Impl (CORBA::ORB_ptr o,
PortableServer::POA_ptr p,
- ::Components::Deployment::ServerActivator_ptr s);
+ Components::Deployment::ServerActivator_ptr s,
+ const Components::ConfigValues &cofig);
/// Destructor.
~Activator_Callback_Impl ();
@@ -58,12 +59,14 @@ namespace CIAO
/// Record the ComponentServer reference returned by the newly
/// spawned ComponentServer and give it back a reference to ServerActivator.
- ::Components::Deployment::ServerActivator_ptr
- register_component_server (::Components::Deployment::ComponentServer_ptr svr)
+ Components::Deployment::ServerActivator_ptr
+ register_component_server (Components::Deployment::ComponentServer_ptr svr,
+ Components::ConfigValues_out config
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException));
protected:
- ::Components::Deployment::ComponentServer_ptr get_server_ref (void);
+ Components::Deployment::ComponentServer_ptr get_server_ref (void);
CORBA::ORB_var orb_;
@@ -72,9 +75,11 @@ namespace CIAO
/// This servant only lives as long as a call to the
/// create_component_server method in ServerActivator, so there's
/// no need to duplicate the object reference here.
- ::Components::Deployment::ServerActivator_ptr activator_;
+ Components::Deployment::ServerActivator_ptr activator_;
- ::Components::Deployment::ComponentServer_var server_;
+ Components::Deployment::ComponentServer_var server_;
+
+ Components::ConfigValues_var config_;
};
/**
@@ -103,21 +108,43 @@ namespace CIAO
/// increase the reference count of the POA.
virtual PortableServer::POA_ptr _default_POA (void);
- /// Initialize the ServerActivator. The currently implementation
- /// of ServerActivator can only activate CIAO's own
- /// ComponentServer processes. You should specify the location
- /// (pathname) of the ComponentServer and the delay
- /// ServerActivator should wait (in second) for ComponentServer to
- /// call back.
+ /**
+ * Initialize the ServerActivator. The currently implementation
+ * of ServerActivator can only activate CIAO's own
+ * ComponentServer processes. You should specify the location
+ * (pathname) of the ComponentServer and the delay
+ * ServerActivator should wait (in second) for ComponentServer to
+ * call back.
+ *
+ * @param server_location A null-termiated char * string pointing
+ * to the pathname of a ComponentServer executable.
+
+ * @param delay instructs how long (in second) a ServerActivator
+ * should wait for a newly spawned ComponentServer to pass back
+ * its IOR.
+ *
+ * @param installation_ior A null-terminated char * string
+ * pointing to the stringified IOR of a ComponentInstallation that
+ * ComponentServer can use to location component implementation DLL.
+ *
+ * @param default_svcconf A null-terminated char * string pointing
+ * to the pathname of the default svcconf file a ComponentServer
+ * should use (specified using -ORBSvcConfFile) if no hint is given.
+ *
+ * @param svcconf_map_file A null-terminated char * string
+ * pointing to the pathname of a (hint, svcconf pathname) map.
+ */
int init (const char *server_location,
CORBA::ULong delay,
- const char *installation_ior
+ const char *installation_ior,
+ const char *default_svcconf,
+ const char *svcconf_map_file
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException));
/// Components::Deployment::ServerActivator defined attributes/operations.
- virtual ::Components::Deployment::ComponentServer_ptr
+ virtual Components::Deployment::ComponentServer_ptr
create_component_server (const Components::ConfigValues & config
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException,
@@ -129,18 +156,52 @@ namespace CIAO
ACE_THROW_SPEC ((CORBA::SystemException,
Components::RemoveFailure));
- virtual ::Components::Deployment::ComponentServers *
+ virtual Components::Deployment::ComponentServers *
get_component_servers (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException));
/// Return the cached ServerActivator object reference. Do not
/// release this object reference, or put it into an var.
- ::Components::Deployment::ServerActivator_ptr
+ Components::Deployment::ServerActivator_ptr
_ciao_get_objref (void);
const char *_ciao_get_ior (void);
protected:
+ /**
+ * Contains the information extracted from
+ * create_component_server's ConfigValue argument that
+ * ServerActivation cares.
+ */
+ typedef struct CS_config
+ {
+ CORBA::String_var svcconf_hint_; // ConfigValue::name: CIAO-svcconf-id
+ } CompServ_Config_Info;
+
+ /**
+ * Initialize svc_conf_map_ with the supplied filename.
+ */
+ int init_svcconf_map (const char *map_file);
+
+ /**
+ * Returns the pathname to the effective svc.conf file based on
+ * "hint." It may return the default svc.conf file when there's
+ * no hint (hint == 0) and we do have a default svc.conf path.
+ */
+ const char *lookup_svcconf_pathname (const char *hint) const;
+
+ /**
+ * Parse the ConfigValue arguement of the function
+ * create_component_server and extractg the information into
+ */
+ void parse_config_value (const Components::ConfigValues &options,
+ CompServ_Config_Info &config_info
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::InvalidConfiguration));
+
+
+ protected:
/// location of the ComponentServer.
CORBA::String_var server_path_;
@@ -161,7 +222,7 @@ namespace CIAO
CORBA::ULong spawn_delay_;
/// Cache a object reference to this servant.
- ::Components::Deployment::ServerActivator_var objref_;
+ Components::Deployment::ServerActivator_var objref_;
/// Cache the ior of the previous reference
CORBA::String_var ior_;
@@ -169,6 +230,18 @@ namespace CIAO
/// Synchronize access to the object set.
TAO_SYNCH_MUTEX lock_;
+ /// Default svc.conf filename.
+ ACE_CString default_svcconf_file_;
+
+ typedef ACE_Hash_Map_Manager_Ex<ACE_CString,
+ ACE_CString,
+ ACE_Hash<ACE_CString>,
+ ACE_Equal_To<ACE_CString>,
+ ACE_Null_Mutex> SVCCONF_MAP;
+
+ /// Map of (canonical svc.conf id, svc.conf) mapping
+ SVCCONF_MAP svc_conf_map_;
+
/// Keep a list of managed ComponentServer objects.
Object_Set<Components::Deployment::ComponentServer, Components::Deployment::ComponentServer_var> cs_set_;
};
diff --git a/TAO/CIAO/ciao/ServerActivator_Impl.inl b/TAO/CIAO/ciao/ServerActivator_Impl.inl
index 919f5bbab58..845900c53db 100644
--- a/TAO/CIAO/ciao/ServerActivator_Impl.inl
+++ b/TAO/CIAO/ciao/ServerActivator_Impl.inl
@@ -2,16 +2,6 @@
// $Id$
ACE_INLINE
-CIAO::Activator_Callback_Impl::Activator_Callback_Impl (CORBA::ORB_ptr o,
- PortableServer::POA_ptr p,
- ::Components::Deployment::ServerActivator_ptr s)
- : orb_ (CORBA::ORB::_duplicate (o)),
- poa_ (PortableServer::POA::_duplicate (p)),
- activator_ (s)
-{
-}
-
-ACE_INLINE
CIAO::ServerActivator_Impl::ServerActivator_Impl (CORBA::ORB_ptr o,
PortableServer::POA_ptr p)
: orb_ (CORBA::ORB::_duplicate (o)),
diff --git a/TAO/CIAO/ciao/Server_init.cpp b/TAO/CIAO/ciao/Server_init.cpp
index da2c4a27096..1a3a96f847c 100644
--- a/TAO/CIAO/ciao/Server_init.cpp
+++ b/TAO/CIAO/ciao/Server_init.cpp
@@ -34,3 +34,22 @@ CIAO::Server_init (CORBA::ORB_ptr o)
Components::ComponentPortDescription);
return 0;
}
+
+int
+CIAO::Utility::write_IOR (const char *pathname,
+ const char *ior)
+{
+ FILE* ior_output_file_ =
+ ACE_OS::fopen (pathname, "w");
+
+ if (ior_output_file_)
+ {
+ ACE_OS::fprintf (ior_output_file_,
+ "%s",
+ ior);
+ ACE_OS::fclose (ior_output_file_);
+ return 0;
+ }
+
+ return -1;
+}
diff --git a/TAO/CIAO/ciao/Server_init.h b/TAO/CIAO/ciao/Server_init.h
index 641a9bffd29..5630b3c4fa5 100644
--- a/TAO/CIAO/ciao/Server_init.h
+++ b/TAO/CIAO/ciao/Server_init.h
@@ -4,6 +4,7 @@
* @file Server_init.h
*
* Initializing CIAO Server side ORB, if they need to.
+ * I'm also puting some utilities functions here.
*
* @author Nanbor Wang <nanbor@cs.wustl.edu>
*/
@@ -29,6 +30,15 @@ namespace CIAO
* to register these stuff automatically.
*/
CIAO_SERVER_Export int Server_init (CORBA::ORB_ptr o);
+
+ namespace Utility
+ {
+ /// Write a string (usually a stringified IOR) to a file
+ /// designated by the @c pathname. The file named will always get
+ /// overwritten.
+ CIAO_SERVER_Export int write_IOR (const char *pathname,
+ const char *IOR);
+ }
}
#include "ace/post.h"
diff --git a/TAO/CIAO/docs/ConfigValues.html b/TAO/CIAO/docs/ConfigValues.html
index 5a45cfe5366..922ae6330e8 100644
--- a/TAO/CIAO/docs/ConfigValues.html
+++ b/TAO/CIAO/docs/ConfigValues.html
@@ -38,6 +38,21 @@ operation. CIAO accepts the following feature names:<p>
</td>
</tr>
<tr>
+ <td>CIAO-svcconf-id</td>
+ <td>string</td>
+ <td>
+ Optional
+ </td>
+ <td>
+ Specify the canonical svc.conf id. This id should only serve
+ as a hint for the deployment framework in determining the
+ actual svc.conf file used to start up the component server.
+ Currently, CIAO's ServerActivator maintains a set of svc.conf
+ files and use this id value to map to the exact svc.conf file
+ name.
+ </td>
+ </tr>
+ <tr>
<td>CIAO-ORB[option]</td>
<td>string</td>
<td>
diff --git a/TAO/CIAO/examples/OEP/Display/descriptors/svcmap.dat b/TAO/CIAO/examples/OEP/Display/descriptors/svcmap.dat
new file mode 100644
index 00000000000..c3aa4c70010
--- /dev/null
+++ b/TAO/CIAO/examples/OEP/Display/descriptors/svcmap.dat
@@ -0,0 +1,3 @@
+RT1,RTsvc1.conf
+RT2,RTsvc2.conf
+RT3,RTsvc3.conf
diff --git a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.cpp b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.cpp
index 2011085660d..93ef3894e69 100644
--- a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.cpp
+++ b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.cpp
@@ -69,8 +69,14 @@ CIAO::Assembly_Builder_Visitor::visit_processcollocation
if (pc->destination () != 0)
{
+ ACE_CString desti_string (pc->destination ());
+ ssize_t endpos = desti_string.find ('|');
+
+ ACE_CString destination_host =
+ desti_string.substring (0, endpos);
+
Components::Deployment::ServerActivator_var activator =
- this->deployment_config_.get_activator (pc->destination ());
+ 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",
@@ -80,6 +86,17 @@ CIAO::Assembly_Builder_Visitor::visit_processcollocation
Components::ConfigValues server_config;
// @@ Nothing to config yet.
+ 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;
+ }
+
this->compserv_ =
activator->create_component_server (server_config
ACE_ENV_ARG_PARAMETER);
diff --git a/TAO/CIAO/tools/Assembly_Deployer/Deployment_Configuration.cpp b/TAO/CIAO/tools/Assembly_Deployer/Deployment_Configuration.cpp
index d546e0756b8..a665612e77a 100644
--- a/TAO/CIAO/tools/Assembly_Deployer/Deployment_Configuration.cpp
+++ b/TAO/CIAO/tools/Assembly_Deployer/Deployment_Configuration.cpp
@@ -28,7 +28,10 @@ CIAO::Deployment_Configuration::init (const char *filename)
FILE *inf = ACE_OS::fopen (filename, "r");
if (inf == NULL)
- ACE_ERROR_RETURN ((LM_ERROR, "Fail to open data file.\n"), -1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Fail to open activator map data file: %s.\n",
+ filename),
+ -1);
char destination[NAME_BUFSIZE], ior[NAME_BUFSIZE];
diff --git a/TAO/CIAO/tools/ComponentServer/ComponentServer.cpp b/TAO/CIAO/tools/ComponentServer/ComponentServer.cpp
index 3d72ad1e00c..974080b3856 100644
--- a/TAO/CIAO/tools/ComponentServer/ComponentServer.cpp
+++ b/TAO/CIAO/tools/ComponentServer/ComponentServer.cpp
@@ -10,9 +10,7 @@
#include "ComponentServer_Impl.h"
#include "CIAO_ServersC.h"
#include "Server_init.h"
-#include "tao/IORTable/IORTable.h"
#include "ace/SString.h"
-#include "ace/Read_Buffer.h"
#include "ace/Get_Opt.h"
char *ior_file_name_ = 0;
@@ -60,23 +58,6 @@ parse_args (int argc, char *argv[])
}
int
-write_IOR(const char* ior)
-{
- FILE* ior_output_file_ =
- ACE_OS::fopen (ior_file_name_, "w");
-
- if (ior_output_file_)
- {
- ACE_OS::fprintf (ior_output_file_,
- "%s",
- ior);
- ACE_OS::fclose (ior_output_file_);
- }
-
- return 0;
-}
-
-int
main (int argc, char *argv[])
{
ACE_TRY_NEW_ENV
@@ -146,6 +127,7 @@ main (int argc, char *argv[])
Components::Deployment::ServerActivator_var activator;
+ Components::ConfigValues_var config;
if (use_callback)
{
@@ -158,13 +140,17 @@ main (int argc, char *argv[])
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
+ Components::ConfigValues_out config_out (config.out ());
+
activator
- = act_callback->register_component_server (comserv_obj.in ()
- ACE_ENV_ARG_PARAMETER);
+ = act_callback->register_component_server (comserv_obj.in (),
+ config_out
+ ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
}
comserv_servant->set_objref (activator.in (),
+ config.in (),
comserv_obj.in ()
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
@@ -172,7 +158,7 @@ main (int argc, char *argv[])
CORBA::String_var str = orb->object_to_string (comserv_obj.in ()
ACE_ENV_ARG_PARAMETER);
- write_IOR (str.in ());
+ CIAO::Utility::write_IOR (ior_file_name_, str.in ());
ACE_DEBUG ((LM_INFO, "ComponentServer IOR: %s\n", str.in ()));
// End Deployment part
diff --git a/TAO/CIAO/tools/Daemon/CIAO_Daemon.cpp b/TAO/CIAO/tools/Daemon/CIAO_Daemon.cpp
index c770cde7cb0..8e3da7d7461 100644
--- a/TAO/CIAO/tools/Daemon/CIAO_Daemon.cpp
+++ b/TAO/CIAO/tools/Daemon/CIAO_Daemon.cpp
@@ -14,6 +14,7 @@
#include "ServerActivator_Impl.h"
#include "ComponentInstallation_Impl.h"
#include "Daemon_Impl.h"
+#include "Server_init.h"
#include "tao/IORTable/IORTable.h"
#include "ace/SString.h"
#include "ace/Read_Buffer.h"
@@ -24,11 +25,13 @@ char *comserv_path_ = "../ComponentServer/ComponentServer";
CORBA::ULong spawn_wait_ = 5;
char *installation_datafile_ = "CIAO_Installation_Data.ini";
char *section_name_ = 0;
+char *default_svcconf_ = 0;
+char *svcconf_config_ = 0;
int
parse_args (int argc, char *argv[])
{
- ACE_Get_Opt get_opts (argc, argv, "i:n:o:d:s:");
+ ACE_Get_Opt get_opts (argc, argv, "i:n:o:d:s:c:m:");
int c;
while ((c = get_opts ()) != -1)
@@ -55,6 +58,14 @@ parse_args (int argc, char *argv[])
section_name_ = get_opts.opt_arg ();
break;
+ case 'c': // get the default svc.conf filename for ComponentServer
+ default_svcconf_ = get_opts.opt_arg ();
+ break;
+
+ case 'm': // get the svc.conf map configuration filename
+ svcconf_config_ = get_opts.opt_arg ();
+ break;
+
case '?': // display help for use of the server.
default:
ACE_ERROR_RETURN ((LM_ERROR,
@@ -100,6 +111,8 @@ main (int argc, char *argv[])
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
+ CIAO::Server_init (orb.in ());
+
if (parse_args (argc, argv) != 0)
return -1;
@@ -182,7 +195,9 @@ main (int argc, char *argv[])
activator_servant->init (comserv_path_,
spawn_wait_,
- str.in ()
+ str.in (),
+ default_svcconf_,
+ svcconf_config_
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
diff --git a/TAO/CIAO/tools/Daemon/README b/TAO/CIAO/tools/Daemon/README
index c089665c782..2d2a435d779 100644
--- a/TAO/CIAO/tools/Daemon/README
+++ b/TAO/CIAO/tools/Daemon/README
@@ -58,6 +58,11 @@ Other command line flags supported by ServerActivator include:
uses the name "ComponentInstallation" if this flag is not
specified.
+ * -c <svcconf name>: Specify the default svcconf filename for ComponentServer
+
+ * -m <svcconf map>: Specify the svc.conf map configuration file.
+ This file contains the (hint, svc.conf filename)
+ tuples (two strings delimited by a comma).
DaemonController:
=================
diff --git a/TAO/CIAO/tools/Simple_Component_Server/Simple_Component_Server.cpp b/TAO/CIAO/tools/Simple_Component_Server/Simple_Component_Server.cpp
index e8220ae8f5e..863093a0f52 100644
--- a/TAO/CIAO/tools/Simple_Component_Server/Simple_Component_Server.cpp
+++ b/TAO/CIAO/tools/Simple_Component_Server/Simple_Component_Server.cpp
@@ -93,6 +93,7 @@ int breakdown (char *source,
for (p = line.next ();
p && cntr < len;
++cntr, p=line.next ())
+ // @@ More memory leaks?
list[cntr] = ACE::strnew (p);
return cntr;