summaryrefslogtreecommitdiff
path: root/modules/CIAO/ciao
diff options
context:
space:
mode:
authorWilliam R. Otte <wotte@dre.vanderbilt.edu>2009-11-10 20:33:31 +0000
committerWilliam R. Otte <wotte@dre.vanderbilt.edu>2009-11-10 20:33:31 +0000
commitf1790ce045fad390af2c69b2c25f714705c90b66 (patch)
tree45261f5f605e6cf33789427f838cc87599dbc485 /modules/CIAO/ciao
parent0e7e7420693d452ba049b31217a915c2c52da1fe (diff)
downloadATCD-f1790ce045fad390af2c69b2c25f714705c90b66.tar.gz
branching/taggingtest_branch_one
Diffstat (limited to 'modules/CIAO/ciao')
-rw-r--r--modules/CIAO/ciao/CIAO.mpc37
-rw-r--r--modules/CIAO/ciao/CIAO_Client_Export.h58
-rw-r--r--modules/CIAO/ciao/CIAO_Config.h20
-rw-r--r--modules/CIAO/ciao/CIAO_Container_Export.h58
-rw-r--r--modules/CIAO/ciao/CIAO_FailureReasons.idl25
-rw-r--r--modules/CIAO/ciao/CIAO_Server_Export.h58
-rw-r--r--modules/CIAO/ciao/Client_init.cpp95
-rw-r--r--modules/CIAO/ciao/Client_init.h75
-rw-r--r--modules/CIAO/ciao/ComponentServer/CIAO_CS_Client.idl40
-rw-r--r--modules/CIAO/ciao/ComponentServer/CIAO_ComponentInstallation_Impl.cpp129
-rw-r--r--modules/CIAO/ciao/ComponentServer/CIAO_ComponentInstallation_Impl.h65
-rw-r--r--modules/CIAO/ciao/ComponentServer/CIAO_ComponentServer.cpp363
-rw-r--r--modules/CIAO/ciao/ComponentServer/CIAO_ComponentServer.h60
-rw-r--r--modules/CIAO/ciao/ComponentServer/CIAO_ComponentServer.idl66
-rw-r--r--modules/CIAO/ciao/ComponentServer/CIAO_ComponentServer.mpc99
-rw-r--r--modules/CIAO/ciao/ComponentServer/CIAO_ComponentServer_Impl.cpp262
-rw-r--r--modules/CIAO/ciao/ComponentServer/CIAO_ComponentServer_Impl.h82
-rw-r--r--modules/CIAO/ciao/ComponentServer/CIAO_Container_Impl.cpp476
-rw-r--r--modules/CIAO/ciao/ComponentServer/CIAO_Container_Impl.h119
-rw-r--r--modules/CIAO/ciao/ComponentServer/CIAO_Properties.idl27
-rw-r--r--modules/CIAO/ciao/ComponentServer/CIAO_ServerActivator_Impl.cpp518
-rw-r--r--modules/CIAO/ciao/ComponentServer/CIAO_ServerActivator_Impl.h192
-rw-r--r--modules/CIAO/ciao/Containers/CIAO_Servant_Activator.idl24
-rw-r--r--modules/CIAO/ciao/Containers/CIAO_Servant_Activator.mpc24
-rw-r--r--modules/CIAO/ciao/Containers/Container_Base.cpp50
-rw-r--r--modules/CIAO/ciao/Containers/Container_Base.h159
-rw-r--r--modules/CIAO/ciao/Containers/Container_Base.idl82
-rw-r--r--modules/CIAO/ciao/Containers/Container_Base.inl33
-rw-r--r--modules/CIAO/ciao/Containers/Containers.mpc30
-rw-r--r--modules/CIAO/ciao/Containers/Servant_Activator.cpp167
-rw-r--r--modules/CIAO/ciao/Containers/Servant_Activator.h100
-rw-r--r--modules/CIAO/ciao/Containers/Session/Session_Container.cpp920
-rw-r--r--modules/CIAO/ciao/Containers/Session/Session_Container.h231
-rw-r--r--modules/CIAO/ciao/Containers/Session/Session_Container.idl15
-rw-r--r--modules/CIAO/ciao/Containers/Session/Session_Container.inl13
-rw-r--r--modules/CIAO/ciao/Containers/Session/Session_Container.mpc30
-rw-r--r--modules/CIAO/ciao/Contexts/Context.mpc16
-rw-r--r--modules/CIAO/ciao/Contexts/Context_Impl_Base.cpp76
-rw-r--r--modules/CIAO/ciao/Contexts/Context_Impl_Base.h105
-rw-r--r--modules/CIAO/ciao/Contexts/Context_Impl_Base.inl24
-rw-r--r--modules/CIAO/ciao/Contexts/Context_Impl_T.cpp63
-rw-r--r--modules/CIAO/ciao/Contexts/Context_Impl_T.h114
-rw-r--r--modules/CIAO/ciao/Contexts/Context_Impl_export.h58
-rw-r--r--modules/CIAO/ciao/Logger/CIAOLoggerFactory.h19
-rw-r--r--modules/CIAO/ciao/Logger/CIAO_Logger_Export.h58
-rw-r--r--modules/CIAO/ciao/Logger/File_Logger_Backend.cpp46
-rw-r--r--modules/CIAO/ciao/Logger/File_Logger_Backend.h52
-rw-r--r--modules/CIAO/ciao/Logger/Log_Macros.h82
-rw-r--r--modules/CIAO/ciao/Logger/Logger.mpc18
-rw-r--r--modules/CIAO/ciao/Logger/Logger_Service.cpp151
-rw-r--r--modules/CIAO/ciao/Logger/Logger_Service.h34
-rw-r--r--modules/CIAO/ciao/Servants/CIAO_Port_Activator.idl37
-rw-r--r--modules/CIAO/ciao/Servants/CIAO_Servant_Impl_export.h58
-rw-r--r--modules/CIAO/ciao/Servants/Home_Servant_Impl_Base.cpp31
-rw-r--r--modules/CIAO/ciao/Servants/Home_Servant_Impl_Base.h67
-rw-r--r--modules/CIAO/ciao/Servants/Home_Servant_Impl_T.cpp225
-rw-r--r--modules/CIAO/ciao/Servants/Home_Servant_Impl_T.h107
-rw-r--r--modules/CIAO/ciao/Servants/Port_Activator.cpp39
-rw-r--r--modules/CIAO/ciao/Servants/Port_Activator.h82
-rw-r--r--modules/CIAO/ciao/Servants/Port_Activator_T.cpp79
-rw-r--r--modules/CIAO/ciao/Servants/Port_Activator_T.h80
-rw-r--r--modules/CIAO/ciao/Servants/Servant_Impl_Base.cpp758
-rw-r--r--modules/CIAO/ciao/Servants/Servant_Impl_Base.h247
-rw-r--r--modules/CIAO/ciao/Servants/Servant_Impl_T.cpp239
-rw-r--r--modules/CIAO/ciao/Servants/Servant_Impl_T.h111
-rw-r--r--modules/CIAO/ciao/Servants/Servant_Impl_Utils_T.cpp182
-rw-r--r--modules/CIAO/ciao/Servants/Servants.mpc57
-rw-r--r--modules/CIAO/ciao/Servants/StandardConfigurator_Impl.cpp33
-rw-r--r--modules/CIAO/ciao/Servants/StandardConfigurator_Impl.h73
-rw-r--r--modules/CIAO/ciao/Server_init.cpp281
-rw-r--r--modules/CIAO/ciao/Server_init.h103
-rw-r--r--modules/CIAO/ciao/Valuetype_Factories/ConfigValue.cpp43
-rw-r--r--modules/CIAO/ciao/Valuetype_Factories/ConfigValue.h38
-rw-r--r--modules/CIAO/ciao/Valuetype_Factories/ConfigValue_Export.h58
-rw-r--r--modules/CIAO/ciao/Valuetype_Factories/Cookie_Export.h58
-rw-r--r--modules/CIAO/ciao/Valuetype_Factories/Cookies.cpp68
-rw-r--r--modules/CIAO/ciao/Valuetype_Factories/Cookies.h70
-rw-r--r--modules/CIAO/ciao/Valuetype_Factories/Cookies.inl10
-rw-r--r--modules/CIAO/ciao/Valuetype_Factories/Factories.mpc23
-rw-r--r--modules/CIAO/ciao/Version.h9
80 files changed, 8984 insertions, 0 deletions
diff --git a/modules/CIAO/ciao/CIAO.mpc b/modules/CIAO/ciao/CIAO.mpc
new file mode 100644
index 00000000000..8339e017ecc
--- /dev/null
+++ b/modules/CIAO/ciao/CIAO.mpc
@@ -0,0 +1,37 @@
+// $Id$
+project(CIAO_Exception_IDL) : ciaoidldefaults {
+ custom_only = 1
+ IDL_Files {
+ idlflags += -Sci -SS
+ CIAO_FailureReasons.idl
+ }
+}
+
+project(CIAO_Client) : ccm_stub, ciao_lib, ccm_cookie, ccm_configvalue {
+ dynamicflags = CIAO_CLIENT_BUILD_DLL
+ after += CIAO_Exception_IDL
+ Source_Files {
+ Client_init.cpp
+ }
+ Header_Files {
+ Client_init.h
+ CIAO_Client_Export.h
+ }
+ IDL_Files {
+ }
+}
+
+project(CIAO_Server) : ccm_stub, naming, ciao_client, ciao_lib, ccm_cookie {
+ dynamicflags = CIAO_SERVER_BUILD_DLL
+
+ Source_Files {
+ Server_init.cpp
+ }
+ Header_Files {
+ CIAO_Server_Export.h
+ Server_init.h
+ }
+ IDL_Files {
+ }
+}
+
diff --git a/modules/CIAO/ciao/CIAO_Client_Export.h b/modules/CIAO/ciao/CIAO_Client_Export.h
new file mode 100644
index 00000000000..3360fbc80cc
--- /dev/null
+++ b/modules/CIAO/ciao/CIAO_Client_Export.h
@@ -0,0 +1,58 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl CIAO_CLIENT
+// ------------------------------
+#ifndef CIAO_CLIENT_EXPORT_H
+#define CIAO_CLIENT_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS) && !defined (CIAO_CLIENT_HAS_DLL)
+# define CIAO_CLIENT_HAS_DLL 0
+#endif /* ACE_AS_STATIC_LIBS && CIAO_CLIENT_HAS_DLL */
+
+#if !defined (CIAO_CLIENT_HAS_DLL)
+# define CIAO_CLIENT_HAS_DLL 1
+#endif /* ! CIAO_CLIENT_HAS_DLL */
+
+#if defined (CIAO_CLIENT_HAS_DLL) && (CIAO_CLIENT_HAS_DLL == 1)
+# if defined (CIAO_CLIENT_BUILD_DLL)
+# define CIAO_CLIENT_Export ACE_Proper_Export_Flag
+# define CIAO_CLIENT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define CIAO_CLIENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* CIAO_CLIENT_BUILD_DLL */
+# define CIAO_CLIENT_Export ACE_Proper_Import_Flag
+# define CIAO_CLIENT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define CIAO_CLIENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* CIAO_CLIENT_BUILD_DLL */
+#else /* CIAO_CLIENT_HAS_DLL == 1 */
+# define CIAO_CLIENT_Export
+# define CIAO_CLIENT_SINGLETON_DECLARATION(T)
+# define CIAO_CLIENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* CIAO_CLIENT_HAS_DLL == 1 */
+
+// Set CIAO_CLIENT_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (CIAO_CLIENT_NTRACE)
+# if (ACE_NTRACE == 1)
+# define CIAO_CLIENT_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define CIAO_CLIENT_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !CIAO_CLIENT_NTRACE */
+
+#if (CIAO_CLIENT_NTRACE == 1)
+# define CIAO_CLIENT_TRACE(X)
+#else /* (CIAO_CLIENT_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define CIAO_CLIENT_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (CIAO_CLIENT_NTRACE == 1) */
+
+#endif /* CIAO_CLIENT_EXPORT_H */
+
+// End of auto generated file.
diff --git a/modules/CIAO/ciao/CIAO_Config.h b/modules/CIAO/ciao/CIAO_Config.h
new file mode 100644
index 00000000000..42b04622520
--- /dev/null
+++ b/modules/CIAO/ciao/CIAO_Config.h
@@ -0,0 +1,20 @@
+// -*- C++ -*-
+//=============================================================================
+/**
+ * @file CIAO_Config.h
+ *
+ * $Id$
+ *
+ * CIAO compile time configuration file.
+ *
+ * @author Bala Natarajan <bala @ dre.vanderbilt.edu>
+ */
+//=============================================================================
+#ifndef CIAO_CONFIG_H
+#define CIAO_CONFIG_H
+
+#if !defined (CIAO_DEFAULT_MAP_SIZE)
+# define CIAO_DEFAULT_MAP_SIZE 64
+#endif /* CIAO_DEFAULT_MAP_SIZE */
+
+#endif /*CIAO_CONFIG_H*/
diff --git a/modules/CIAO/ciao/CIAO_Container_Export.h b/modules/CIAO/ciao/CIAO_Container_Export.h
new file mode 100644
index 00000000000..239e7ba1c87
--- /dev/null
+++ b/modules/CIAO/ciao/CIAO_Container_Export.h
@@ -0,0 +1,58 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl CIAO_CONTAINER
+// ------------------------------
+#ifndef CIAO_CONTAINER_EXPORT_H
+#define CIAO_CONTAINER_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS) && !defined (CIAO_CONTAINER_HAS_DLL)
+# define CIAO_CONTAINER_HAS_DLL 0
+#endif /* ACE_AS_STATIC_LIBS && CIAO_CONTAINER_HAS_DLL */
+
+#if !defined (CIAO_CONTAINER_HAS_DLL)
+# define CIAO_CONTAINER_HAS_DLL 1
+#endif /* ! CIAO_CONTAINER_HAS_DLL */
+
+#if defined (CIAO_CONTAINER_HAS_DLL) && (CIAO_CONTAINER_HAS_DLL == 1)
+# if defined (CIAO_CONTAINER_BUILD_DLL)
+# define CIAO_CONTAINER_Export ACE_Proper_Export_Flag
+# define CIAO_CONTAINER_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define CIAO_CONTAINER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* CIAO_CONTAINER_BUILD_DLL */
+# define CIAO_CONTAINER_Export ACE_Proper_Import_Flag
+# define CIAO_CONTAINER_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define CIAO_CONTAINER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* CIAO_CONTAINER_BUILD_DLL */
+#else /* CIAO_CONTAINER_HAS_DLL == 1 */
+# define CIAO_CONTAINER_Export
+# define CIAO_CONTAINER_SINGLETON_DECLARATION(T)
+# define CIAO_CONTAINER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* CIAO_CONTAINER_HAS_DLL == 1 */
+
+// Set CIAO_CONTAINER_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (CIAO_CONTAINER_NTRACE)
+# if (ACE_NTRACE == 1)
+# define CIAO_CONTAINER_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define CIAO_CONTAINER_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !CIAO_CONTAINER_NTRACE */
+
+#if (CIAO_CONTAINER_NTRACE == 1)
+# define CIAO_CONTAINER_TRACE(X)
+#else /* (CIAO_CONTAINER_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define CIAO_CONTAINER_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (CIAO_CONTAINER_NTRACE == 1) */
+
+#endif /* CIAO_CONTAINER_EXPORT_H */
+
+// End of auto generated file.
diff --git a/modules/CIAO/ciao/CIAO_FailureReasons.idl b/modules/CIAO/ciao/CIAO_FailureReasons.idl
new file mode 100644
index 00000000000..c5bae8c9cbc
--- /dev/null
+++ b/modules/CIAO/ciao/CIAO_FailureReasons.idl
@@ -0,0 +1,25 @@
+/**
+ * @file CIAO_FailureReasons.idl
+ * @author William R. Otte <wotte@dre.vanderbilt.edu>
+ * $Id$
+ * Failure code definitions for CIAO. The VID is based on that of TAO, but
+ * our failure reasons start at that base since this is a different namespace.
+ */
+
+#ifndef CIAO_FAILUREREASONS_IDL
+#define CIAO_FAILUREREASONS_IDL
+
+#include <ccm/CCM_Exceptions.idl>
+
+module CIAO
+{
+ const Components::FailureReason VID = 0x54410000;
+ const Components::FailureReason MAX_FAILURE = VID | 0xfff;
+
+ // Container failures
+ const Components::FailureReason SERVER_SPAWN_FAILURE = VID | 0x001;
+ const Components::FailureReason CALLBACK_TIMEOUT_EXCEEDED = VID | 0x002;
+};
+
+#endif
+
diff --git a/modules/CIAO/ciao/CIAO_Server_Export.h b/modules/CIAO/ciao/CIAO_Server_Export.h
new file mode 100644
index 00000000000..e56c08a014c
--- /dev/null
+++ b/modules/CIAO/ciao/CIAO_Server_Export.h
@@ -0,0 +1,58 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl CIAO_SERVER
+// ------------------------------
+#ifndef CIAO_SERVER_EXPORT_H
+#define CIAO_SERVER_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS) && !defined (CIAO_SERVER_HAS_DLL)
+# define CIAO_SERVER_HAS_DLL 0
+#endif /* ACE_AS_STATIC_LIBS && CIAO_SERVER_HAS_DLL */
+
+#if !defined (CIAO_SERVER_HAS_DLL)
+# define CIAO_SERVER_HAS_DLL 1
+#endif /* ! CIAO_SERVER_HAS_DLL */
+
+#if defined (CIAO_SERVER_HAS_DLL) && (CIAO_SERVER_HAS_DLL == 1)
+# if defined (CIAO_SERVER_BUILD_DLL)
+# define CIAO_SERVER_Export ACE_Proper_Export_Flag
+# define CIAO_SERVER_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define CIAO_SERVER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* CIAO_SERVER_BUILD_DLL */
+# define CIAO_SERVER_Export ACE_Proper_Import_Flag
+# define CIAO_SERVER_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define CIAO_SERVER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* CIAO_SERVER_BUILD_DLL */
+#else /* CIAO_SERVER_HAS_DLL == 1 */
+# define CIAO_SERVER_Export
+# define CIAO_SERVER_SINGLETON_DECLARATION(T)
+# define CIAO_SERVER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* CIAO_SERVER_HAS_DLL == 1 */
+
+// Set CIAO_SERVER_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (CIAO_SERVER_NTRACE)
+# if (ACE_NTRACE == 1)
+# define CIAO_SERVER_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define CIAO_SERVER_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !CIAO_SERVER_NTRACE */
+
+#if (CIAO_SERVER_NTRACE == 1)
+# define CIAO_SERVER_TRACE(X)
+#else /* (CIAO_SERVER_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define CIAO_SERVER_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (CIAO_SERVER_NTRACE == 1) */
+
+#endif /* CIAO_SERVER_EXPORT_H */
+
+// End of auto generated file.
diff --git a/modules/CIAO/ciao/Client_init.cpp b/modules/CIAO/ciao/Client_init.cpp
new file mode 100644
index 00000000000..c8e5bd8907d
--- /dev/null
+++ b/modules/CIAO/ciao/Client_init.cpp
@@ -0,0 +1,95 @@
+// $Id$
+
+#include "Client_init.h"
+#include <ccm/CCM_CookieC.h>
+#include <ccm/CCM_ReceptacleC.h>
+#include <ccm/CCM_EventsC.h>
+#include <ccm/CCM_ObjectC.h>
+#include "Valuetype_Factories/ConfigValue.h"
+#include "ciao/Logger/Log_Macros.h"
+
+int
+CIAO::Client_init (CORBA::ORB_ptr o)
+{
+ CIAO_REGISTER_VALUE_FACTORY (o, Components::Cookie_init,
+ Components::Cookie);
+ CIAO_REGISTER_VALUE_FACTORY (o, Components::PortDescription_init,
+ Components::PortDescription);
+ CIAO_REGISTER_VALUE_FACTORY (o, Components::FacetDescription_init,
+ Components::FacetDescription);
+ CIAO_REGISTER_VALUE_FACTORY (o, Components::ConnectionDescription_init,
+ Components::ConnectionDescription);
+ CIAO_REGISTER_VALUE_FACTORY (o, Components::ReceptacleDescription_init,
+ Components::ReceptacleDescription);
+ CIAO_REGISTER_VALUE_FACTORY (o, Components::ConsumerDescription_init,
+ Components::ConsumerDescription);
+ CIAO_REGISTER_VALUE_FACTORY (o, Components::EmitterDescription_init,
+ Components::EmitterDescription);
+ CIAO_REGISTER_VALUE_FACTORY (o, Components::SubscriberDescription_init,
+ Components::SubscriberDescription);
+ CIAO_REGISTER_VALUE_FACTORY (o, Components::PublisherDescription_init,
+ Components::PublisherDescription);
+ CIAO_REGISTER_VALUE_FACTORY (o, Components::ConfigValue_init,
+ Components::ConfigValue);
+ CIAO_REGISTER_VALUE_FACTORY (o, Components::ComponentPortDescription_init,
+ Components::ComponentPortDescription);
+ return 0;
+}
+
+namespace CIAO
+{
+ namespace Utility
+ {
+ void build_config_values_map (CONFIGVALUE_MAP &map,
+ const ::Components::ConfigValues &config)
+ {
+ CIAO_TRACE("CIAO::build_config_values_map");
+ map.unbind_all ();
+
+ for (CORBA::ULong i = 0; i < config.length (); ++i)
+ {
+ int const retval = map.rebind (config[i]->name (), config[i]->value ());
+
+ if (retval == 1)
+ {
+ CIAO_ERROR ((LM_WARNING, CLINFO
+ "build_config_values_map: Duplicate value for %C encountered, "
+ "old value overwritten.\n",
+ config[i]->name ()));
+ }
+ else if (retval == -1)
+ {
+ CIAO_ERROR ((LM_WARNING, CLINFO "build_config_values_map: Error binding value for %C, ignoring.\n",
+ config[i]->name ()));
+ }
+ else
+ {
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "build_config_values_map: Bound value for config value %C\n",
+ config[i]->name ()));
+ }
+ }
+ }
+
+ void build_config_values_sequence (::Components::ConfigValues &config,
+ const CONFIGVALUE_MAP &map)
+ {
+ CIAO_TRACE ("CIAO::build_config_values_sequence");
+
+ config.length (map.current_size ());
+
+ CORBA::ULong pos = 0;
+
+ for (CONFIGVALUE_MAP::const_iterator i = map.begin ();
+ (i.advance ()) != 0; ++pos)
+ {
+ Components::ConfigValue_var newval;
+ ACE_NEW_THROW_EX (newval,
+ ConfigValue_impl (i->ext_id_.c_str (), i->int_id_),
+ CORBA::NO_MEMORY ());
+ config[pos] = newval._retn ();
+ }
+ }
+ }
+}
+
diff --git a/modules/CIAO/ciao/Client_init.h b/modules/CIAO/ciao/Client_init.h
new file mode 100644
index 00000000000..6a31e474a3a
--- /dev/null
+++ b/modules/CIAO/ciao/Client_init.h
@@ -0,0 +1,75 @@
+// -*- C++ -*-
+//
+// $Id$
+
+/**
+ * @file Client_init.h
+ *
+ * Initializing CIAO client side ORB, if they need to.
+ *
+ * @author Nanbor Wang <nanbor@cs.wustl.edu>
+ */
+
+#ifndef CIAO_CLIENT_INIT_H
+#define CIAO_CLIENT_INIT_H
+
+#include /**/ "ace/pre.h"
+
+#include "CIAO_Client_Export.h"
+
+#if !defined ACE_LACKS_PRAGMA_ONCE
+#pragma once
+#endif /* ! ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Hash_Map_Manager_T.h"
+#include "tao/orbconf.h"
+#include "tao/AnyTypeCode/Any.h"
+#include "ccm/CCM_StandardConfiguratorC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+namespace CORBA
+{
+ class ORB;
+ typedef ORB *ORB_ptr;
+}
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+namespace CIAO
+{
+ /**
+ * The initialize routine for any clients that need to access
+ * component. This routine now simply registers various valuetype
+ * factories defined in CIAO_Component.pidl. Currently, this method
+ * should be call right after ORB initialization but we should try
+ * to register these stuff automatically.
+ */
+ CIAO_CLIENT_Export int Client_init (CORBA::ORB_ptr o);
+
+ namespace Utility
+ {
+ typedef ACE_Hash_Map_Manager_Ex<ACE_CString,
+ CORBA::Any,
+ ACE_Hash<ACE_CString>,
+ ACE_Equal_To<ACE_CString>,
+ ACE_Null_Mutex> CONFIGVALUE_MAP;
+
+ void CIAO_CLIENT_Export build_config_values_map (CONFIGVALUE_MAP &map,
+ const ::Components::ConfigValues &config);
+
+ void CIAO_CLIENT_Export build_config_values_sequence (::Components::ConfigValues &config,
+ const CONFIGVALUE_MAP &map);
+ }
+}
+
+#define CIAO_REGISTER_VALUE_FACTORY(ORB,FACTORY,VALUETYPE) {\
+ CORBA::ValueFactory factory = new FACTORY; \
+ CORBA::ValueFactory prev_factory = \
+ ORB->register_value_factory \
+ (VALUETYPE::_tao_obv_static_repository_id (), \
+ factory); \
+ if (prev_factory) prev_factory->_remove_ref (); \
+ factory->_remove_ref (); }
+
+#include /**/ "ace/post.h"
+
+#endif /* CIAO_CLIENT_INIT_H */
diff --git a/modules/CIAO/ciao/ComponentServer/CIAO_CS_Client.idl b/modules/CIAO/ciao/ComponentServer/CIAO_CS_Client.idl
new file mode 100644
index 00000000000..7e8acd0e245
--- /dev/null
+++ b/modules/CIAO/ciao/ComponentServer/CIAO_CS_Client.idl
@@ -0,0 +1,40 @@
+/**
+ * @file CIAO_CS_Client.idl
+ * @author William R. Otte <wotte@dre.vanderbilt.edu>
+ * $Id$
+ * A couple CIAO-specific extensions to the component server client
+ * interfaces.
+ */
+
+#ifndef CIAO_COMPONENTSERVER_IDL_
+#define CIAO_COMPONENTSERVER_IDL_
+
+#include <ccm/ComponentServer/CCM_ComponentServer_Client.idl>
+
+module CIAO
+{
+ module Deployment
+ {
+ interface ServerActivator : ::Components::Deployment::ServerActivator
+ {
+ /// Used by spawned component servers to notify the server
+ /// activator of their object reference and retrieve
+ /// configuration information.
+ void component_server_callback (in ::Components::Deployment::ComponentServer serverref,
+ in string server_UUID,
+ out ::Components::ConfigValues config);
+
+ void configuration_complete (in string server_UUID);
+ };
+
+ interface ComponentInstallation :
+ ::Components::Deployment::ComponentInstallation
+ {
+ };
+ };
+};
+
+
+#endif
+
+
diff --git a/modules/CIAO/ciao/ComponentServer/CIAO_ComponentInstallation_Impl.cpp b/modules/CIAO/ciao/ComponentServer/CIAO_ComponentInstallation_Impl.cpp
new file mode 100644
index 00000000000..b01175fcbd4
--- /dev/null
+++ b/modules/CIAO/ciao/ComponentServer/CIAO_ComponentInstallation_Impl.cpp
@@ -0,0 +1,129 @@
+// $Id$
+
+#include "CIAO_ComponentInstallation_Impl.h"
+#include "ciao/Logger/Log_Macros.h"
+
+namespace CIAO
+{
+ namespace Deployment
+ {
+
+ ComponentInstallation_Impl::ComponentInstallation_Impl()
+ {
+ CIAO_TRACE ("ComponentInstallation_Impl::ComponentInstallation_Impl");
+ }
+
+ ComponentInstallation_Impl::~ComponentInstallation_Impl()
+ {
+ CIAO_TRACE ("ComponentInstallation_Impl::~ComponentInstallation_Impl");
+ }
+
+ void
+ ComponentInstallation_Impl::install (const char * implUUID, const char * component_loc)
+ {
+ CIAO_TRACE ("ComponentInstallation_Impl::install");
+
+ CIAO_DEBUG ((LM_DEBUG, CLINFO "ComponentInstallation_Impl::install - "
+ "implUUID %C, component_loc %C\n", implUUID, component_loc));
+
+ ACE_CString location = component_loc;
+
+ if (0 == this->locations_.find (implUUID))
+ {
+ this->locations_.bind (implUUID, location);
+ }
+ else
+ {
+ CIAO_DEBUG ((LM_DEBUG, CLINFO "ComponentInstallation_Impl::install - Location for artifact %C "
+ "already present, replacing.\n",
+ implUUID));
+ this->locations_.rebind (implUUID, location);
+ }
+ }
+
+
+ void
+ ComponentInstallation_Impl::replace (const char *uuid, const char *loc)
+ {
+ CIAO_TRACE ("ComponentInstallation_Impl::replace");
+
+ this->locations_.rebind (uuid, loc);
+ }
+
+ void
+ ComponentInstallation_Impl::remove (const char *uuid)
+ {
+ CIAO_TRACE ("ComponentInstallation_Impl::remove");
+ this->locations_.unbind (uuid);
+ }
+
+ char *
+ ComponentInstallation_Impl::get_implementation (const char * implUUID)
+ {
+ CIAO_TRACE ("ComponentInstallation_Impl::get_implementation");
+
+ ACE_CString s;
+ if (0 == this->locations_.find (implUUID, s))
+ {
+ CIAO_DEBUG ((LM_DEBUG, CLINFO "ComponentInstallation_Impl::get_implementation - "
+ "ComponentInstallation_Impl::get_implementation for UUID %C, location %C\n",
+ implUUID, s.c_str()));
+
+ return CORBA::string_dup (s.c_str());
+ }
+ else
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "ComponentInstallation_Impl::get_implementation - "
+ "cannot find location for specified implementation UUID %C\n", implUUID));
+ throw ::Components::Deployment::UnknownImplId();
+ return 0;
+ }
+ }
+
+
+ char *
+ ComponentInstallation_Impl::get_valuetypefactory_location (const char * implUUID,
+ const char * repid)
+ {
+ CIAO_TRACE ("ComponentInstallation_Impl::get_valuetypefactory_location");
+
+ ACE_CString key = ComponentInstallation_Impl::valuefactory_key (implUUID, repid);
+ ACE_CString s;
+ if (0 == this->locations_.find (implUUID, s))
+ {
+ CIAO_DEBUG ((LM_DEBUG, CLINFO "ComponentInstallation_Impl::get_valuetypefactory_location - "
+ "UUID:\"%C\" repid:\"%C\" -> location:\"%C\"\n", implUUID, repid, s.c_str()));
+ return CORBA::string_dup (s.c_str());
+ }
+ else
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "ComponentInstallation_Impl::get_valuetypefactory_location - "
+ "cannot find location for implementation UUID %C and repid %C.\n", implUUID, repid));
+ throw ::Components::Deployment::InstallationFailure();
+ return 0;
+ }
+ return 0;
+ }
+
+
+ void
+ ComponentInstallation_Impl::install_valuetypefactory_location (const char * implUUID,
+ const char * repid,
+ const char * loc)
+ {
+ CIAO_TRACE ("ComponentInstallation_Impl::install_valuetypefactory_location");
+ ACE_CString key = ComponentInstallation_Impl::valuefactory_key (implUUID, repid);
+ if (0 != this->locations_.find (key))
+ {
+ ACE_CString location = loc;
+ this->locations_.bind (implUUID, location);
+ }
+ else
+ {
+ // I don't certaint that we should throw exception here
+ //throw ::Components::Deployment::InstallationFailure();
+ }
+ }
+ }
+}
+
diff --git a/modules/CIAO/ciao/ComponentServer/CIAO_ComponentInstallation_Impl.h b/modules/CIAO/ciao/ComponentServer/CIAO_ComponentInstallation_Impl.h
new file mode 100644
index 00000000000..699a3bd4369
--- /dev/null
+++ b/modules/CIAO/ciao/ComponentServer/CIAO_ComponentInstallation_Impl.h
@@ -0,0 +1,65 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CIAO_ComponentInstallation_Impl.h
+ *
+ * $Id$
+ *
+ * @brief Return location of component artifact
+ *
+ * @author Erwin Gottlieb <eg@prismtech.com>
+ */
+//=============================================================================
+
+#ifndef COMPONENTINSTALLATION_IMPL_H_
+#define COMPONENTINSTALLATION_IMPL_H_
+
+#include "ace/Map_Manager.h"
+#include "ciao/ComponentServer/CIAO_CS_ClientS.h"
+
+#include "tao/ORB.h"
+#include "ciao/ComponentServer/CIAO_CS_Client_svnt_export.h"
+
+namespace CIAO
+{
+ namespace Deployment
+ {
+
+ class CIAO_CS_CLIENT_SVNT_Export ComponentInstallation_Impl
+ : public virtual POA_CIAO::Deployment::ComponentInstallation
+ {
+ public:
+ ComponentInstallation_Impl();
+
+ virtual ~ComponentInstallation_Impl();
+
+ virtual void install (const char * implUUID,
+ const char * component_loc);
+
+ virtual void replace (const char * implUUID,
+ const char * component_loc);
+
+ virtual void remove (const char * implUUID);
+
+ virtual char * get_implementation (const char * implUUID);
+
+ virtual char * get_valuetypefactory_location (const char * implUUID,
+ const char * repid);
+
+ void install_valuetypefactory_location (const char * implUUID,
+ const char * repid,
+ const char * loc);
+
+ private:
+ typedef ACE_Map_Manager< ACE_CString, ACE_CString, ACE_Null_Mutex > TLocations;
+ TLocations locations_;
+
+ static ACE_CString valuefactory_key (const char* uuid, const char* repid)
+ {
+ return ACE_CString (repid) + "@" + uuid;
+ };
+ };
+ }
+}
+#endif /*COMPONENTINSTALLATION_IMPL_H_*/
diff --git a/modules/CIAO/ciao/ComponentServer/CIAO_ComponentServer.cpp b/modules/CIAO/ciao/ComponentServer/CIAO_ComponentServer.cpp
new file mode 100644
index 00000000000..0adfc3ea526
--- /dev/null
+++ b/modules/CIAO/ciao/ComponentServer/CIAO_ComponentServer.cpp
@@ -0,0 +1,363 @@
+/**
+ * @file CIAO_ComponentServer.cpp
+ * @author William R. Otte
+ * // $Id$
+ * Implementation and main for CIAO_ComponentServer.
+ */
+
+#include "CIAO_ComponentServer.h"
+
+#include "ace/OS_NS_string.h"
+#include "ace/Log_Msg.h"
+#include "ace/Get_Opt.h"
+#include "ace/Sched_Params.h"
+#include "ace/Trace.h"
+#include "ace/Env_Value_T.h"
+#include "tao/ORB.h"
+#include "tao/Object.h"
+#include "tao/CORBA_methods.h"
+#include "tao/PortableServer/PortableServer.h"
+#include "tao/ORB_Core.h"
+#include "ciao/Logger/Logger_Service.h"
+#include "ciao/Logger/Log_Macros.h"
+#include "ciao/Server_init.h"
+
+
+#include "CIAO_ComponentServer_Impl.h"
+#include "CIAO_CS_ClientC.h"
+
+#ifdef CIAO_BUILD_COMPONENTSERVER_EXE
+
+int ACE_TMAIN (int argc, ACE_TCHAR **argv)
+{
+ // Tracing disabled by default
+ CIAO_DISABLE_TRACE ();
+
+ CIAO_TRACE ("CIAO_ComponentServer::ACE_TMAIN");
+
+ try
+ {
+ CIAO::Deployment::ComponentServer_Task cs (argc, argv);
+ cs.run ();
+ return 0;
+ }
+ catch (CIAO::Deployment::ComponentServer_Task::Error &e)
+ {
+ CIAO_DEBUG ((LM_ALERT, CLINFO "CIAO_ComponentServer main: Caught ComponentServer exception: %C\n",
+ e.err_.c_str ()));
+ }
+ catch (...)
+ {
+ CIAO_DEBUG ((LM_ALERT, CLINFO "CIAO_ComponentServer main: Caught unknown exception.\n"));
+ }
+
+ return -1;
+}
+
+#endif /* CIAO_BUILD_COMPONENTSERVER_EXE */
+
+bool
+write_IOR (const ACE_TCHAR * ior_file_name, 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 true;
+ }
+ return false;
+}
+
+namespace CIAO
+{
+ namespace Deployment
+ {
+ ComponentServer_Task::ComponentServer_Task (int argc, ACE_TCHAR **argv)
+ : orb_ (0),
+ uuid_ (""),
+ callback_ior_str_ (ACE_TEXT(""))
+ {
+ CIAO_TRACE ("CIAO_ComponentServer_Task::CIAO_ComponentServer_Task ()");
+
+ Logger_Service
+ *clf = ACE_Dynamic_Service<Logger_Service>::instance ("CIAO_Logger_Backend_Factory");
+
+ if (!clf)
+ clf = new Logger_Service;
+
+ this->logger_.reset (clf);
+
+ this->logger_->init (argc, argv);
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO "CIAO_ComponentServer_Task::CIAO_ComponentServer_Task - "
+ "Creating server object\n"));
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO "CIAO_ComponentServer_Task::CIAO_ComponentServer_Task - "
+ "Creating ORB\n"));
+ this->orb_ = CORBA::ORB_init (argc, argv);
+
+ this->parse_args (argc, argv);
+ this->configure_logging_backend ();
+
+ CIAO::Server_init (this->orb_.in ());
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO "CIAO_ComponentServer_Task::CIAO_ComponentServer_Task - "
+ "CIAO_ComponentServer object created.\n"));
+ }
+
+ int
+ ComponentServer_Task::svc (void)
+ {
+ CIAO_TRACE ("ComponentServer_Task::svc");
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO "ComponentServer_Task::svc - "
+ "Activating the root POA\n"));
+ CORBA::Object_var object =
+ this->orb_->resolve_initial_references ("RootPOA");
+
+ PortableServer::POA_var root_poa =
+ PortableServer::POA::_narrow (object.in ());
+
+ PortableServer::POAManager_var poa_manager =
+ root_poa->the_POAManager ();
+
+ poa_manager->activate ();
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO "ComponentServer_Task::svc - "
+ "Creating server implementation object\n"));
+ CIAO::Deployment::CIAO_ComponentServer_i *ci_srv = 0;
+ ACE_NEW_NORETURN (ci_srv, CIAO_ComponentServer_i (this->uuid_, this->orb_.in (), root_poa.in ()));
+
+ if (ci_srv == 0)
+ {
+ CIAO_ERROR ((LM_CRITICAL, "ComponentServer_Task::run - "
+ "Out of memory error while allocating servant."));
+ throw Error ("Out of memory whilst allocating servant.");
+ }
+
+ PortableServer::ServantBase_var safe (ci_srv);
+
+ ComponentServer_var cs (ci_srv->_this ());
+
+ if (this->output_file_ != ACE_TEXT(""))
+ {
+ CORBA::String_var ior = this->orb_->object_to_string (cs.in ());
+ write_IOR (this->output_file_.c_str (), ior.in ());
+ }
+
+
+ if (this->callback_ior_str_ != ACE_TEXT(""))
+ {
+ CIAO_DEBUG ((LM_TRACE, CLINFO " resolving callback IOR\n"));
+ CORBA::Object_ptr obj = this->orb_->string_to_object (this->callback_ior_str_.c_str ());
+ ServerActivator_var sa (ServerActivator::_narrow (obj));
+
+ if (CORBA::is_nil (sa.in ()))
+ {
+ CIAO_DEBUG ((LM_ERROR, CLINFO "ComponentServer_Task::svc - "
+ "Failed to narrow callback IOR\n"));
+ throw Error ("Failed to narrow callback IOR");
+ }
+
+ Components::ConfigValues_var config;
+ {
+ Components::ConfigValues *cf = 0;
+ ACE_NEW_NORETURN (cf, Components::ConfigValues (0));
+
+ if (cf == 0)
+ {
+ CIAO_ERROR ((LM_CRITICAL, "ComponentServer_Task::run - "
+ "Out of memory error while allocating config values."));
+ }
+ else
+ {
+ config = cf;
+ }
+ }
+
+ // Make callback.
+ CIAO_DEBUG ((LM_TRACE, CLINFO "ComponentServer_Task::svc - "
+ "Making callback on my ServerActivator\n"));
+
+ try
+ {
+ // Callback to NodeApplication to get configuration
+ sa->component_server_callback (cs.in (),
+ this->uuid_.c_str (),
+ config.out ());
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO "ComponentServer_Task::svc - "
+ "Configuration received\n"));
+ // @@WO: Probably need to do something with these config values.
+
+ ci_srv->init (sa.in (), config._retn ());
+
+ CIAO_DEBUG ((LM_NOTICE, CLINFO "ComponentServer_Task::svc - "
+ "Configuration complete for component server %C\n",
+ this->uuid_.c_str ()));
+
+ sa->configuration_complete (this->uuid_.c_str ());
+ }
+ catch (const CORBA::BAD_PARAM &)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "ComponentServer_Task::svc - "
+ "The Callback IOR provided pointed to the wrong ServerActivator\n"));
+ throw Error ("Bad callback IOR");
+ }
+ catch (...)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "ComponentServer_Task::svc - "
+ "Caught exception while calling back\n"));
+ throw Error ("Caught exception while calling back");
+ }
+
+ }
+ else
+ {
+ CIAO_DEBUG ((LM_TRACE, CLINFO "ComponentServer_Task::svc - "
+ "Initializing ComponentServer without ServantActivator callback\n"));
+ ci_srv->init (0, 0);
+ }
+
+ this->orb_->run ();
+ CIAO_DEBUG ((LM_TRACE, CLINFO "ComponentServer_Task::svc - "
+ "ORB Event loop completed.\n"));
+
+ root_poa->destroy (1, 1);
+
+ this->orb_->destroy ();
+
+ return 0;
+ }
+
+ void
+ ComponentServer_Task::run (void)
+ {
+ CIAO_TRACE ("ComponentServer_Task::run");
+
+ CIAO_DEBUG ((LM_DEBUG, CLINFO "ComponentServer_Task::run - Starting ORB\n"));
+ this->svc ();
+ CIAO_DEBUG ((LM_INFO, CLINFO "ComponentServer_Task::run - ORB has shutdown, terminating ComponentServer\n"));
+ }
+
+ void
+ ComponentServer_Task::parse_args (int argc, ACE_TCHAR **argv)
+ {
+ CIAO_TRACE ("ComponentServer_Task::parse_args");
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO "ComponentServer_Task::parse_args - parsing arguments...\n"));
+
+ ACE_Get_Opt opts (argc, argv, ACE_TEXT("hu:c:"), 1, 0,
+ ACE_Get_Opt::RETURN_IN_ORDER);
+ opts.long_option (ACE_TEXT("uuid"), 'u', ACE_Get_Opt::ARG_REQUIRED);
+ opts.long_option (ACE_TEXT("callback-ior"), 'c', ACE_Get_Opt::ARG_REQUIRED);
+ opts.long_option (ACE_TEXT("help"), 'h');
+ opts.long_option (ACE_TEXT("log-level"),'l', ACE_Get_Opt::ARG_REQUIRED);
+ opts.long_option (ACE_TEXT("trace"),'t', ACE_Get_Opt::NO_ARG);
+ opts.long_option (ACE_TEXT("output-ior"),'o', ACE_Get_Opt::ARG_REQUIRED);
+
+ //int j;
+ int c;
+ ACE_CString s;
+
+ while ((c = opts ()) != -1)
+ {
+ CIAO_DEBUG ((LM_TRACE, CLINFO "ComponentServer_Task::parse_args - "
+ "Found option: \"%s\" with argument \"%s\"\n",
+ opts.last_option (), opts.opt_arg ()));
+
+ switch (c)
+ {
+ case 'u':
+ CIAO_DEBUG ((LM_DEBUG, CLINFO "ComponentServer_Task::parse_args - "
+ "uuid is %s\n",
+ opts.opt_arg ()));
+ this->uuid_ = ACE_TEXT_ALWAYS_CHAR (opts.opt_arg ());
+ break;
+
+ case 'c':
+ CIAO_DEBUG ((LM_DEBUG, CLINFO "ComponentServer_Task::parse_args - "
+ "callback ior is %s\n",
+ opts.opt_arg ()));
+ this->callback_ior_str_ = opts.opt_arg ();
+ break;
+
+ case 'l':
+ {
+ continue; // no-op, already taken care of
+ }
+
+ case 't':
+ continue; // already taken care of
+
+ case 'o':
+ CIAO_DEBUG ((LM_DEBUG, CLINFO "ComponentServer_Task::parse_args - "
+ "IOR Output file: %s\n",
+ opts.opt_arg ()));
+ this->output_file_ = opts.opt_arg ();
+ break;
+
+ case 'h':
+ this->usage ();
+ throw Error ("Command line help requested, bailing out....");
+
+ default:
+ CIAO_ERROR ((LM_ERROR, CLINFO " Unknown option: %s\n",
+ opts.last_option ()));
+ this->usage ();
+ ACE_CString err ("Unknown option ");
+ err += ACE_TEXT_ALWAYS_CHAR (opts.last_option ());
+ throw Error (err);
+ }
+ }
+
+ // check required options.
+ if (this->uuid_ == "")
+ throw Error ("Option required: -u|--uuid");
+ if (this->callback_ior_str_ == ACE_TEXT(""))
+ CIAO_ERROR ((LM_WARNING, CLINFO
+ "ComponentServer_Task::parse_args - Starting ComponentServer without a callback IOR\n"));
+ }
+
+ void
+ ComponentServer_Task::usage (void)
+ {
+ CIAO_TRACE ("ComponentServer_Task::usage");
+ // Shouldn't be subject to CIAO's logging policy
+ ACE_ERROR ((LM_EMERGENCY, "Usage: CIAO_ComponentServer <options>\n"
+ "Options:\n"
+ "\t-h|--help\t\t\t\tShow help\n"
+ "\t-l|--log-level <level>\t\t\tSets log level (default 5). 1 - most detailed.\n"
+ "\t-u|--uuid <uuid> \t\t\tSets UUID of spawned component server (required)\n"
+ "\t-c|--callback-ior <string ior>\t\tSets callback url for the spawning ServerActivator.\n"
+ "\t-o|--output-ior <filename>\t\tOutputs the IOR of the component server object to file\n"
+ ));
+
+ }
+
+ void
+ ComponentServer_Task::configure_logging_backend (void)
+ {
+ Logger_Service
+ *clf = ACE_Dynamic_Service<Logger_Service>::instance ("CIAO_Logger_Backend_Factory");
+ if (clf)
+ {
+ CIAO_DEBUG ((LM_TRACE, CLINFO "ComponentServer_Task::configure_logging_backend - "
+ "Replacing logger backend\n"));
+ ACE_Log_Msg_Backend * backend = clf->get_logger_backend(this->orb_);
+ backend->open(0);
+ ACE_Log_Msg::msg_backend (backend);
+ ACE_Log_Msg * ace = ACE_Log_Msg::instance();
+ ace->clr_flags(ace->flags());
+ ace->set_flags(ACE_Log_Msg::CUSTOM);
+ }
+ }
+ }
+}
+
+
diff --git a/modules/CIAO/ciao/ComponentServer/CIAO_ComponentServer.h b/modules/CIAO/ciao/ComponentServer/CIAO_ComponentServer.h
new file mode 100644
index 00000000000..8e05789d0e6
--- /dev/null
+++ b/modules/CIAO/ciao/ComponentServer/CIAO_ComponentServer.h
@@ -0,0 +1,60 @@
+// $Id$
+/**
+ * @file CIAO_ComponentServer.h
+ * @author William R. Otte
+ *
+ * Defines interface for the bootstrap element of the CIAO Component
+ * Server.
+ */
+
+#ifndef CIAO_COMPONENTSERVER_H_
+#define CIAO_COMPONENTSERVER_H_
+
+#include "ace/String_Base.h"
+#include "ace/Task.h"
+#include "tao/ORB.h"
+#include "ciao/Logger/Logger_Service.h"
+
+namespace CIAO
+{
+ namespace Deployment
+ {
+ class ComponentServer_Task : ACE_Task_Base
+ {
+ public:
+ ComponentServer_Task (int argc, ACE_TCHAR **argv);
+
+ int svc (void);
+
+ struct Error
+ {
+ Error (const ACE_CString &err) : err_(err) {}
+
+ ACE_CString err_;
+ };
+
+ void run (void);
+
+ private:
+ void parse_args (int argc, ACE_TCHAR **argv);
+
+ void get_log_level (int argc, ACE_TCHAR **argv);
+
+ void set_log_level (void);
+
+ void configure_logging_backend (void);
+
+ void usage (void);
+
+ CORBA::ORB_var orb_;
+
+ auto_ptr<CIAO::Logger_Service> logger_;
+
+ ACE_CString uuid_;
+ ACE_TString callback_ior_str_;
+ ACE_TString output_file_;
+ };
+ }
+}
+
+#endif
diff --git a/modules/CIAO/ciao/ComponentServer/CIAO_ComponentServer.idl b/modules/CIAO/ciao/ComponentServer/CIAO_ComponentServer.idl
new file mode 100644
index 00000000000..14290ae6683
--- /dev/null
+++ b/modules/CIAO/ciao/ComponentServer/CIAO_ComponentServer.idl
@@ -0,0 +1,66 @@
+/**
+ * @file CIAO_ComponentServer.idl
+ * @author William R. Otte <wotte@dre.vanderbilt.edu>
+ * $Id$
+ * A couple CIAO-specific extensions to the component server
+ * interfaces.
+ */
+
+#ifndef CIAO_COMPONENTSERVER_IDL_
+#define CIAO_COMPONENTSERVER_IDL_
+
+#include <ccm/CCM_Object.idl>
+#include <ccm/ComponentServer/CCM_ComponentServer.idl>
+
+module CIAO
+{
+ module Deployment
+ {
+ interface ComponentServer : ::Components::Deployment::ComponentServer
+ {
+ oneway void shutdown ();
+ };
+
+ exception InvalidComponent
+ {
+ };
+
+ /**
+ * @interface CIAO_Container
+ * @brief CIAO specific extensions to the component server interface.
+ */
+ interface Container : Components::Deployment::Container
+ {
+ /// Instruct the container to install a component without
+ /// an explicit home.
+ ::Components::CCMObject install_component (in ::Components::Deployment::UUID id,
+ in string entrypt,
+ in ::Components::ConfigValues config)
+ raises (::Components::Deployment::UnknownImplId,
+ ::Components::Deployment::ImplEntryPointNotFound,
+ ::Components::Deployment::InstallationFailure,
+ ::Components::Deployment::InvalidConfiguration);
+
+ /// Activate component with specified ID, if no ID provided,
+ /// activates all components.
+ void activate_component (in ::Components::CCMObject comp)
+ raises (InvalidComponent);
+
+ /// Passivate component with specified ID, if no ID provided,
+ /// passivates all components.
+ void passivate_component (in ::Components::CCMObject comp)
+ raises (InvalidComponent);
+
+ /// Instruct the container to remove a component installed
+ /// without an explicit home. If the component was installed
+ /// with an explicit home, this operation will fail.
+ void remove_component (in ::Components::CCMObject cref)
+ raises (::Components::RemoveFailure);
+
+ /// Returns a sequence of all homeless components.
+ ::Components::CCMObjectSeq get_components ();
+ };
+ };
+};
+
+#endif /* CIAO_COMPONENTSERVER_IDL_ */
diff --git a/modules/CIAO/ciao/ComponentServer/CIAO_ComponentServer.mpc b/modules/CIAO/ciao/ComponentServer/CIAO_ComponentServer.mpc
new file mode 100644
index 00000000000..89627e2e94e
--- /dev/null
+++ b/modules/CIAO/ciao/ComponentServer/CIAO_ComponentServer.mpc
@@ -0,0 +1,99 @@
+// $Id$
+
+project(CIAO_ComponentServer_IDL) : ciaoidldefaults, anytypecode {
+ idlflags += -Wb,stub_export_macro=CIAO_COMPONENTSERVER_STUB_Export \
+ -Wb,stub_export_include=CIAO_ComponentServer_stub_export.h \
+ -Wb,skel_export_macro=CIAO_COMPONENTSERVER_SVNT_Export \
+ -Wb,skel_export_include=CIAO_ComponentServer_svnt_export.h \
+ -Gxhst -Gxhsk
+
+ custom_only=1
+
+ IDL_Files {
+ CIAO_ComponentServer.idl
+ }
+}
+
+project(CIAO_CS_Client_IDL) : ciaoidldefaults, anytypecode {
+ idlflags += -Wb,stub_export_macro=CIAO_COMPONENTSERVER_STUB_Export \
+ -Wb,stub_export_include=CIAO_ComponentServer_stub_export.h \
+ -Wb,skel_export_macro=CIAO_CS_CLIENT_SVNT_Export \
+ -Wb,skel_export_include=CIAO_CS_Client_svnt_export.h
+
+ custom_only=1
+
+ IDL_Files {
+ CIAO_Properties.idl
+ idlflags += -SS -Sci -Gxhsk
+ }
+ IDL_Files {
+ CIAO_CS_Client.idl
+ }
+}
+
+project(CIAO_ComponentServer_stub) : ccm_componentserver_stub, ciaolib_with_idl, ciao_output, \
+ messaging, anytypecode, ciao_lib {
+ after += CIAO_ComponentServer_IDL CIAO_CS_Client_IDL
+ dynamicflags = CIAO_COMPONENTSERVER_STUB_BUILD_DLL
+
+ IDL_Files {
+ }
+ Source_Files {
+ CIAO_ComponentServerC.cpp
+ CIAO_CS_ClientC.cpp
+ CIAO_PropertiesC.cpp
+ }
+ Header_Files {
+ CIAO_ComponentServer_stub_export.h
+ }
+}
+
+project(CIAO_CS_Client_svnt) : ccm_svnt, ccm_componentserver_svnt, ciao_componentserver_stub, portableserver, \
+ ciao_client, ciao_lib, threads, avoids_ace_for_tao {
+ dynamicflags = CIAO_CS_CLIENT_SVNT_BUILD_DLL
+ after += CIAO_CS_Client_IDL
+ IDL_Files {
+ }
+ Source_Files {
+ CIAO_ServerActivator_Impl.cpp
+ CIAO_ComponentInstallation_Impl.cpp
+ CIAO_CS_ClientS.cpp
+ }
+ Header_Files {
+ CIAO_ServerActivator_Impl.h
+ CIAO_ComponentInstallation_Impl.h
+ CIAO_CS_ClientS.h
+ CIAO_CS_Client_svnt_export.h
+ }
+}
+
+project(CIAO_ComponentServer_svnt) : ccm_componentserver_svnt, ciao_componentserver_stub, portableserver, \
+ ciao_session_container, naming, ciao_server, ciao_lib {
+
+ dynamicflags = CIAO_COMPONENTSERVER_SVNT_BUILD_DLL
+
+ IDL_Files {
+ }
+ Source_Files {
+ CIAO_ComponentServer_Impl.cpp
+ CIAO_ComponentServerS.cpp
+ CIAO_Container_Impl.cpp
+ }
+ Header_Files {
+ CIAO_ComponentServer_svnt_export.h
+ }
+}
+
+project(CIAO_ComponentServer_exe) : ccm_componentserver_svnt, portableserver, ciao_componentserver_svnt, \
+ messaging, anytypecode, ciao_server, ciaoexe, ciao_session_container,\
+ ciao_logger {
+ exename = ciao_componentserver
+ macros += CIAO_BUILD_COMPONENTSERVER_EXE
+ Source_Files {
+ CIAO_ComponentServer.cpp
+ }
+ Inline_Files {
+ }
+ IDL_Files {
+ }
+}
diff --git a/modules/CIAO/ciao/ComponentServer/CIAO_ComponentServer_Impl.cpp b/modules/CIAO/ciao/ComponentServer/CIAO_ComponentServer_Impl.cpp
new file mode 100644
index 00000000000..c0da9280dcf
--- /dev/null
+++ b/modules/CIAO/ciao/ComponentServer/CIAO_ComponentServer_Impl.cpp
@@ -0,0 +1,262 @@
+// $Id$
+#include "CIAO_ComponentServer_Impl.h"
+
+#include "ciao/Logger/Log_Macros.h"
+
+#include "CIAO_CS_ClientC.h"
+#include "CIAO_Container_Impl.h"
+#include "CIAO_PropertiesC.h"
+
+namespace CIAO
+{
+ namespace Deployment
+ {
+ CIAO_ComponentServer_i::CIAO_ComponentServer_i (const ACE_CString &uuid,
+ CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa)
+ : uuid_ (uuid),
+ orb_ (CORBA::ORB::_duplicate (orb)),
+ poa_ (PortableServer::POA::_duplicate (poa)),
+ containers_ ()
+ {
+ CIAO_TRACE("CIAO_ComponentServer_i::CIAO_ComponentServer_i");
+ }
+
+ // Destructor
+ CIAO_ComponentServer_i::~CIAO_ComponentServer_i (void)
+ {
+ CIAO_TRACE("CIAO_ComponentServer_i::~CIAO_ComponentServer_i");
+ }
+
+ void
+ CIAO_ComponentServer_i::shutdown (void)
+ {
+ CIAO_TRACE("CIAO_ComponentServer_i::shutdown");
+
+ CIAO_DEBUG ((LM_DEBUG, CLINFO "CIAO_ComponentServer_i::shutdown - ORB shutdown request received at %C.\n",
+ this->uuid_.c_str ()));
+
+ if (!this->containers_.is_empty ())
+ CIAO_ERROR ((LM_ERROR, CLINFO "CIAO_ComponentServer_i::shutdown - ComponentServer %C still containers!\n",
+ this->uuid_.c_str ()));
+
+ this->orb_->shutdown ();
+ }
+
+
+ ::Components::ConfigValues *
+ CIAO_ComponentServer_i::configuration (void)
+ {
+ CIAO_TRACE("CIAO_ComponentServer_i::configuration");
+ return this->config_values_.out ();
+ }
+
+
+ ::Components::Deployment::ServerActivator_ptr
+ CIAO_ComponentServer_i::get_server_activator (void)
+ {
+ CIAO_TRACE("CIAO_ComponentServer_i::get_server_activator");
+ return this->serv_act_.in ();
+ }
+
+ ::Components::Deployment::Container_ptr
+ CIAO_ComponentServer_i::create_container (const ::Components::ConfigValues & config)
+ {
+ CIAO_TRACE("CIAO_ComponentServer_i::create_container");
+
+ try
+ {
+ CIAO_DEBUG ((LM_INFO, CLINFO "CIAO_ComponentServer_i::create_container - Request received with %u config values\n",
+ config.length ()));
+
+ CORBA::PolicyList policies;
+ const char *name = 0;
+ CIAO_Container_i *cont = 0;
+ ACE_NEW_THROW_EX (cont,
+ CIAO_Container_i (config, 0, name, &policies, this->ci_.in (),
+ this->orb_.in (), this->poa_.in ()),
+ CORBA::NO_MEMORY ());
+
+ CIAO_DEBUG ((LM_DEBUG, CLINFO "CIAO_ComponentServer_i::create_container - "
+ "Container servant successfully allocated.\n"));
+
+ PortableServer::ServantBase_var safe_config = cont;
+ CIAO::Deployment::Container_var cont_var = cont->_this ();
+
+ this->containers_.insert (CIAO::Deployment::Container::_duplicate(cont_var.in ()));
+
+ CIAO_DEBUG ((LM_INFO, CLINFO "CIAO_ComponentServer_i::create_container - Container successfully activated and stored,"
+ "now manage %u containers\n",
+ this->containers_.size ()));
+
+ return cont_var._retn ();
+ }
+ catch (const CORBA::NO_MEMORY &)
+ {
+ CIAO_ERROR ((LM_CRITICAL, CLINFO "CIAO_ComponentServer_Impl: Out of memory exception whilst creating container.\n"));
+ throw;
+ }
+ catch (...)
+ {
+ CIAO_ERROR ((LM_ERROR, "CIAO_ComponentServer_Impl: Caught unknown exception\n"));
+ }
+
+ throw Components::CreateFailure ();
+ }
+
+
+
+ void
+ CIAO_ComponentServer_i::remove_container (::Components::Deployment::Container_ptr cref)
+ {
+ CIAO_TRACE("CIAO_ComponentServer_i::remove_container");
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO "CIAO_ComponentServer_i::remove_container - remove request received.\n"));
+
+ if (CORBA::is_nil (cref))
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "CIAO_ComponentServer_i::remove_container - "
+ "Error: Received nil container reference\n"));
+ throw Components::RemoveFailure ();
+ }
+
+ if (this->containers_.is_empty ())
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "CIAO_ComponentServer_i::remove_container - "
+ "Error: I don't manage any containers!\n"));
+ throw Components::RemoveFailure ();
+ }
+
+ try
+ {
+ CONTAINERS::ITERATOR i (this->containers_.begin ());
+
+ // @@ TODO: artifact from when this was a sequence, should probably use .find,
+ // which will work properly with the new parameterized set class.
+ for (CONTAINERS::iterator i = this->containers_.begin ();
+ i.done () != 1; i.advance ())
+ {
+ if (CORBA::is_nil (*i))
+ {
+ ACE_ERROR ((LM_WARNING, CLINFO
+ "CIAO_ComponentServer_i::remove_container - "
+ "Managed container reference is nil, skipping.\n"));
+ continue;
+ }
+
+ if ((*i)->_is_equivalent (cref))
+ {
+ CIAO_DEBUG ((LM_TRACE, CLINFO "CIAO_ComponentServer_i::remove_container - Found container, invoking remove....\n"));
+ cref->remove ();
+ if (this->containers_.remove (*i) != 0)
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "CIAO_ComponentServer_i::remove_container - Unable to remove "
+ "container reference from internal structure....\n"));
+ CIAO_DEBUG ((LM_TRACE, CLINFO "CIAO_ComponentServer_i::remove_container - Remove completed, destroying object, "
+ "now manage %u containers\n", this->containers_.size ()));
+ return;
+ }
+ }
+ }
+ catch (const CORBA::Exception &ex)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "CIAO_ComponentServer_i::remove_container - "
+ "Caught CORBA exception whilst removing container: %C\n",
+ ex._info ().c_str ()));
+ }
+ catch (...)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "CIAO_ComponentServer_i::remove_container - Error: Unknown exception caught while removing a container.\n"));
+ }
+ throw Components::RemoveFailure ();
+ }
+
+
+ ::Components::Deployment::Containers *
+ CIAO_ComponentServer_i::get_containers (void)
+ {
+ CIAO_TRACE("CIAO_ComponentServer_i::get_containers");
+
+ ::Components::Deployment::Containers *tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ ::Components::Deployment::Containers (this->containers_.size ()),
+ CORBA::NO_MEMORY ());
+
+ ::Components::Deployment::Containers_var retval (tmp);
+ CORBA::ULong pos (0);
+ retval->length (this->containers_.size ());
+
+ for (CONTAINERS::iterator i = this->containers_.begin ();
+ i.done () != 1; i.advance ())
+ {
+ retval[pos++] = ::CIAO::Deployment::Container::_duplicate (*i);
+ }
+
+ return retval._retn ();
+ }
+
+
+ void
+ CIAO_ComponentServer_i::remove (void)
+ {
+ CIAO_TRACE("CIAO_ComponentServer_i::remove");
+
+ bool successful = true;
+
+ for (CONTAINERS::iterator i = this->containers_.begin ();
+ i.done () != 1; i.advance ())
+ {
+ try
+ {
+ (*i)->remove ();
+ }
+ catch (const CORBA::Exception &ex)
+ {
+ successful = false;
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "CIAO_ComponentServer_i::remove - "
+ "Intercepted CORBA exception while trying to remove a container:%C\n",
+ ex._info ().c_str ()));
+ }
+ catch (...)
+ {
+ successful = false;
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "CIAO_ComponentServer_i::remove - "
+ "Intercepted exception while trying to remove a container\n"));
+ }
+ }
+
+ this->containers_.reset ();
+
+ if (!successful)
+ throw ::Components::RemoveFailure ();
+ }
+
+ void
+ CIAO_ComponentServer_i::init (::Components::Deployment::ServerActivator_ptr sa,
+ Components::ConfigValues *cvs)
+ {
+ if (!CORBA::is_nil (sa))
+ this->serv_act_ = ::Components::Deployment::ServerActivator::_duplicate(sa);
+
+ if (cvs != 0)
+ {
+ this->config_values_ = cvs;
+
+ for (CORBA::ULong i = 0; i < this->config_values_->length (); ++i)
+ {
+ if (ACE_OS::strcmp (CIAO::Deployment::COMPONENTINSTALLATION_REF,
+ this->config_values_[i]->name ()) == 0)
+ {
+ CIAO::Deployment::ComponentInstallation_ptr tmp;
+ this->config_values_[i]->value () >>= tmp;
+ this->ci_ = CIAO::Deployment::ComponentInstallation::_duplicate (tmp);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/modules/CIAO/ciao/ComponentServer/CIAO_ComponentServer_Impl.h b/modules/CIAO/ciao/ComponentServer/CIAO_ComponentServer_Impl.h
new file mode 100644
index 00000000000..7d3753bd6ca
--- /dev/null
+++ b/modules/CIAO/ciao/ComponentServer/CIAO_ComponentServer_Impl.h
@@ -0,0 +1,82 @@
+// $Id$
+/**
+ * @file CIAO_ComponentServer_Impl.h
+ * @author William R. Otte <wotte@dre.vanderbilt.edu>
+ */
+
+#ifndef CIAO_COMPONENTSERVER_IMPL_H_
+#define CIAO_COMPONENTSERVER_IMPL_H_
+
+#include "ciao/ComponentServer/CIAO_ComponentServerS.h"
+#include "ciao/ComponentServer/CIAO_CS_ClientC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+#pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/String_Base.h"
+#include "ace/Unbounded_Set_Ex.h"
+
+namespace CIAO
+{
+ namespace Deployment
+ {
+ class CIAO_COMPONENTSERVER_SVNT_Export CIAO_ComponentServer_i
+ : public virtual POA_CIAO::Deployment::ComponentServer
+ {
+ public:
+ // Constructor
+ CIAO_ComponentServer_i (const ACE_CString &uuid, CORBA::ORB_ptr orb, PortableServer::POA_ptr poa);
+
+ // Destructor
+ virtual ~CIAO_ComponentServer_i (void);
+
+ virtual void shutdown (void);
+
+ virtual ::Components::ConfigValues * configuration (void);
+
+ virtual
+ ::Components::Deployment::ServerActivator_ptr get_server_activator (void);
+
+ virtual
+ ::Components::Deployment::Container_ptr create_container (const ::Components::ConfigValues & config);
+
+ virtual
+ void remove_container (::Components::Deployment::Container_ptr cref);
+
+ virtual
+ ::Components::Deployment::Containers * get_containers (void);
+
+ virtual
+ void remove (void);
+
+ void init (::Components::Deployment::ServerActivator_ptr sa,
+ Components::ConfigValues *cvs);
+
+ private:
+ ACE_CString uuid_;
+ CORBA::ORB_var orb_;
+ PortableServer::POA_var poa_;
+ ::Components::Deployment::ServerActivator_var serv_act_;
+ Components::ConfigValues_var config_values_;
+
+ template<typename T>
+ struct _is_equivalent
+ {
+ bool operator() (const T &a, const T &b) const
+ {
+ return a->_is_equivalent (const_cast <T&> (b));
+ }
+ };
+
+ typedef ACE_Unbounded_Set_Ex <Container_var,
+ _is_equivalent<Container_var> > CONTAINERS;
+
+ CONTAINERS containers_;
+
+ CIAO::Deployment::ComponentInstallation_var ci_;
+ };
+ }
+}
+
+#endif
diff --git a/modules/CIAO/ciao/ComponentServer/CIAO_Container_Impl.cpp b/modules/CIAO/ciao/ComponentServer/CIAO_Container_Impl.cpp
new file mode 100644
index 00000000000..a119c3ebd9b
--- /dev/null
+++ b/modules/CIAO/ciao/ComponentServer/CIAO_Container_Impl.cpp
@@ -0,0 +1,476 @@
+// $Id$
+#include "CIAO_Container_Impl.h"
+
+#include "ace/Log_Msg.h"
+#include "ccm/CCM_HomeC.h"
+#include "ciao/Server_init.h"
+#include "ciao/Client_init.h"
+#include "CIAO_PropertiesC.h"
+#include "CIAO_CS_ClientC.h"
+#include "ciao/Logger/Log_Macros.h"
+
+namespace CIAO
+{
+ namespace Deployment
+ {
+ // Constructor
+ CIAO_Container_i::CIAO_Container_i (const Components::ConfigValues &config,
+ const Static_Config_EntryPoints_Maps *static_entrypts,
+ const char *name,
+ const CORBA::PolicyList *policies,
+ CIAO::Deployment::ComponentInstallation_ptr ci,
+ CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa)
+ : orb_ (CORBA::ORB::_duplicate (orb)),
+ poa_ (PortableServer::POA::_duplicate (poa)),
+ config_ (config.length ()),
+ static_entrypts_maps_ (static_entrypts),
+ ci_ (CIAO::Deployment::ComponentInstallation::_duplicate (ci))
+ {
+ CIAO_TRACE("CIAO_Container_i::CIAO_Container_i");
+
+ for (CORBA::ULong i = 0; i < config.length (); ++i)
+ {
+ this->config_[i] = config[i];
+ }
+
+ try
+ {
+ if (this->static_entrypts_maps_ == 0)
+ {
+ CIAO_DEBUG((LM_DEBUG, CLINFO "CIAO_Container_i: creating Session container with dynamic linkage\n"));
+ this->container_ = new CIAO::Session_Container (this->orb_.in (), this, false,
+ 0, name, policies);
+ }
+ else
+ {
+ CIAO_DEBUG((LM_DEBUG, CLINFO "CIAO_Container_i: creating Session container with static linkage\n"));
+ this->container_ = new CIAO::Session_Container (this->orb_.in (), this, true,
+ this->static_entrypts_maps_,
+ name, policies);
+ }
+ }
+ catch (...)
+ {
+ CIAO_ERROR((LM_ERROR, CLINFO "CIAO_Container_i::CIAO_Container_i - "
+ "Caught exception while allocating container implementation\n"));
+ throw;
+ }
+ }
+
+
+ // Destructor
+ CIAO_Container_i::~CIAO_Container_i (void)
+ {
+ CIAO_TRACE("CIAO_Container_i::~CIAO_Container_i");
+ }
+
+ ::Components::CCMObject_ptr
+ CIAO_Container_i::install_component (const char * id,
+ const char * entrypt,
+ const ::Components::ConfigValues & config)
+ {
+ CIAO_TRACE("CIAO_Container_i::install_component");
+
+ if (!id)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "CIAO_Container_i::install_component - "
+ "No home ID provided\n"));
+ throw ::Components::Deployment::InvalidConfiguration ();
+ }
+
+ Components::CCMObject_var comp;
+
+ if (this->component_map_.find (id, comp) == 0)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "CIAO_Container_i::install_component - "
+ "Component with id %C already installed, aborting\n",
+ id));
+ throw Components::CreateFailure ();
+ }
+
+ if (!entrypt)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "CIAO_Container_i::install_component - "
+ "No executor entrypoint found.\n"));
+ throw ::Components::Deployment::InvalidConfiguration ();
+ }
+
+ CIAO_DEBUG ((LM_INFO, CLINFO "CIAO_Container_i::install_component - "
+ "Attempting to install home with id [%C]\n",
+ id));
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "CIAO_Container_i::install_component - "
+ "Extracting ConfigValues from sequence of length [%u]\n",
+ config.length ()));
+
+ CIAO::Utility::CONFIGVALUE_MAP cm;
+ CIAO::Utility::build_config_values_map (cm, config);
+ CORBA::Any val;
+
+ const char *tmp = 0;
+ CORBA::String_var exec_art, svnt_art, svnt_entry;
+
+ if (cm.find (SVNT_ENTRYPT, val) == 0)
+ {
+ val >>= tmp;
+ svnt_entry = tmp;
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "CIAO_Container_i::install_component - "
+ "Found Servant entrypoint %C\n", svnt_entry.in ()));
+ }
+ else
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "CIAO_Container_i::install_component - "
+ "Error: No Servant entrypoint provided, aborting installation\n"));
+ throw Components::InvalidConfiguration ();
+ }
+
+ if (cm.find (SVNT_ARTIFACT, val) == 0)
+ {
+ val >>= tmp;
+ svnt_art = this->ci_->get_implementation (tmp);
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "CIAO_Container_i::install_component - "
+ "Found Servant artifact %C\n", svnt_art.in ()));
+ }
+ else
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "CIAO_Container_i::install_component - "
+ "Error: No Servant artifact provided, aborting installation\n"));
+ throw Components::InvalidConfiguration ();
+ }
+
+
+ if (cm.find (EXEC_ARTIFACT, val) == 0)
+ {
+ val >>= tmp;
+ exec_art = this->ci_->get_implementation (tmp);
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "CIAO_Container_i::install_component - "
+ "Found executor artifact: %C\n", exec_art.in ()));
+ }
+ else
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "CIAO_Container_i::install_component - "
+ "Error: No Executor artifact provided, aborting installation\n"));
+ }
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "CIAO_Container_i::install_component - "
+ "Extraction resulted in map of [%u] values\n", cm.current_size ()));
+
+ comp = this->container_->install_component (exec_art,
+ entrypt,
+ svnt_art,
+ svnt_entry,
+ id);
+
+ if (this->component_map_.bind (id,
+ Components::CCMObject::_duplicate (comp.in ())) == -1)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "CIAO_Container_i::install_component - "
+ "Unable to bind componnet into component map\n"));
+ }
+
+ return comp._retn ();
+ }
+
+ void
+ CIAO_Container_i::remove_component (::Components::CCMObject_ptr cref)
+ {
+ CIAO_TRACE("CIAO_Container_i::remove_component");
+
+ Component_Iterator i = this->component_map_.begin ();
+ while (!i.done ())
+ {
+ if (i->item ()->_is_equivalent (cref))
+ {
+ CIAO_DEBUG ((LM_TRACE, CLINFO "CIAO_Container_i::remove_component - "
+ "Successfully found matching component\n"));
+ break;
+ }
+ i.advance ();
+ }
+
+ if (i.done ())
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "CIAO_Container_i::remove_component - "
+ "Unable to find matching component managed by this container, throwing RemoveFailure\n"));
+ throw Components::RemoveFailure ();
+ }
+
+ if (!CORBA::is_nil (this->container_.in ()))
+ {
+ CIAO_DEBUG ((LM_TRACE, CLINFO "CIAO_Container_i::remove_component - "
+ "Invoking remove on the container impl for component %C.\n",
+ i->key ().c_str ()));
+ this->container_->uninstall_component (cref);
+ CIAO_DEBUG ((LM_INFO, CLINFO "CIAO_Container_i::remove_component - "
+ "Successfully removed component %C\n",
+ i->key ().c_str ()));
+ }
+
+ if (this->component_map_.unbind (i->key ()) != 0)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "CIAO_Container_i::remove_component - "
+ "Unable to unbind removed component with id %C from component map\n",
+ i->key ().c_str ()));
+ }
+ }
+
+ ::Components::CCMObjectSeq *
+ CIAO_Container_i::get_components (void)
+ {
+ CIAO_TRACE("CIAO_Container_i::get_components");
+ throw CORBA::NO_IMPLEMENT ();
+ return 0;
+ }
+
+ ::Components::ConfigValues *
+ CIAO_Container_i::configuration (void)
+ {
+ CIAO_TRACE("CIAO_Container_i::configuration");
+ throw CORBA::NO_IMPLEMENT ();
+ return 0;
+ }
+
+ ::Components::Deployment::ComponentServer_ptr
+ CIAO_Container_i::get_component_server (void)
+ {
+ CIAO_TRACE("CIAO_Container_i::get_component_server");
+ throw CORBA::NO_IMPLEMENT ();
+ return 0;
+ }
+
+ ::Components::CCMHome_ptr
+ CIAO_Container_i::install_home (const char * id,
+ const char * entrypt,
+ const ::Components::ConfigValues & config)
+ {
+ CIAO_TRACE("CIAO_Container_i::install_home");
+
+ if (!id)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "CIAO_Container_i::install_home - "
+ "No home ID provided\n"));
+ throw ::Components::Deployment::InvalidConfiguration ();
+ }
+
+ Components::CCMHome_var home;
+
+ if (this->home_map_.find (id, home) == 0)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "CIAO_Container_i::install_home - "
+ "Home with id %C already installed, aborting\n",
+ id));
+ throw Components::CreateFailure ();
+ }
+
+ if (!entrypt)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "CIAO_Container_i::install_home - "
+ "No executor entrypoint found.\n"));
+ throw ::Components::Deployment::InvalidConfiguration ();
+ }
+
+ CIAO_DEBUG ((LM_INFO, CLINFO "CIAO_Container_i::install_home - "
+ "Attempting to install home with id [%C]\n", id));
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "CIAO_Container_i::install_home - "
+ "Extracting ConfigValues from sequence of length [%u]\n",
+ config.length ()));
+
+ CIAO::Utility::CONFIGVALUE_MAP cm;
+ CIAO::Utility::build_config_values_map (cm, config);
+ CORBA::Any val;
+
+ const char *tmp = 0;
+ CORBA::String_var exec_art, svnt_art, svnt_entry;
+ if (cm.find (SVNT_ENTRYPT, val) == 0)
+ {
+ val >>= tmp;
+ svnt_entry = tmp;
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "CIAO_Container_i::install_home - "
+ "Found Servant entrypoint %C\n", svnt_entry.in ()));
+ }
+ else
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "CIAO_Container_i::install_home - "
+ "Error: No Servant entrypoint provided, aborting installation\n"));
+ throw Components::InvalidConfiguration ();
+ }
+
+ if (cm.find (SVNT_ARTIFACT, val) == 0)
+ {
+ val >>= tmp;
+ svnt_art = this->ci_->get_implementation (tmp);
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "CIAO_Container_i::install_home - "
+ "Found Servant artifact %C\n", svnt_art.in ()));
+ }
+ else
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "CIAO_Container_i::install_home - "
+ "Error: No Servant artifact provided, aborting installation\n"));
+ throw Components::InvalidConfiguration ();
+ }
+
+
+ if (cm.find (EXEC_ARTIFACT, val) == 0)
+ {
+ val >>= tmp;
+ exec_art = this->ci_->get_implementation (tmp);
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "CIAO_Container_i::install_home - "
+ "Found executor artifact: %C\n", exec_art.in ()));
+ }
+ else
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "CIAO_Container_i::install_home - "
+ "Error: No Executor artifact provided, aborting installation\n"));
+ }
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "CIAO_Container_i::install_home - "
+ "Extraction resulted in map of [%u] values", cm.current_size ()));
+
+
+ // extract config values here...
+
+ //CIAO_DEBUG ((LM_DEBUG, CLINFO "CIAO_Container_i::install_home - ",
+ //"Executor entrypoint [%C], servant entrypoint [%C], servant library [%C]\n",
+ //entrypt, svnt_entrypt.in (), svnt_library.in ()));
+
+ home = this->container_->install_home (exec_art,
+ entrypt,
+ svnt_art,
+ svnt_entry,
+ id);
+
+ if (this->home_map_.bind (id,
+ Components::CCMHome::_duplicate (home.in ())) == -1)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "CIAO_Container_i::install_home - "
+ "Unable to bind home into home map\n"));
+ }
+
+ return home._retn ();
+ }
+
+ void
+ CIAO_Container_i::remove_home (::Components::CCMHome_ptr href)
+ {
+ CIAO_TRACE("CIAO_Container_i::remove_home");
+
+ Home_Iterator i = this->home_map_.begin ();
+ while (!i.done ())
+ {
+ if (i->item ()->_is_equivalent (href))
+ {
+ CIAO_DEBUG ((LM_TRACE, CLINFO "CIAO_Container_i::remove_home - "
+ "Successfully found matching home\n"));
+ break;
+ }
+ i.advance ();
+ }
+
+ if (i.done ())
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "CIAO_Container_i::remove_home - "
+ "Unable to find matching home managed by this container, throwing RemoveFailure\n"));
+ throw Components::RemoveFailure ();
+ }
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO "CIAO_Container_i::remove_home - "
+ "Invoking remove on the container impl for home %C.\n",
+ i->key ().c_str ()));
+ this->container_->uninstall_home (href);
+ CIAO_DEBUG ((LM_INFO, CLINFO "CIAO_Container_i::remove_home - "
+ "Successfully removed home %C\n",
+ i->key ().c_str ()));
+
+ if (this->home_map_.unbind (i->key ()) != 0)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "CIAO_Container_i::remove_home - "
+ "Unable to unbind removed home with id %C from home map\n",
+ i->key ().c_str ()));
+ }
+ }
+
+ ::Components::CCMHomes *
+ CIAO_Container_i::get_homes (void)
+ {
+ CIAO_TRACE("CIAO_Container_i::get_homes");
+
+ ::Components::CCMHomes *tmp_homes = 0;
+
+ ACE_NEW_THROW_EX (tmp_homes,
+ ::Components::CCMHomes (this->home_map_.current_size ()),
+ CORBA::NO_MEMORY ());
+
+ ::Components::CCMHomes_var retval (tmp_homes);
+ retval->length (this->home_map_.current_size ());
+ Home_Iterator i = this->home_map_.begin ();
+ CORBA::ULong pos = 0;
+ while (!i.done ())
+ {
+ retval[pos++] = ::Components::CCMHome::_duplicate (i->item ().in ());
+ i.advance ();
+ }
+
+ return retval._retn ();
+ }
+
+ void
+ CIAO_Container_i::remove (void)
+ {
+ CIAO_TRACE("CIAO_Container_i::remove");
+
+ if (this->home_map_.current_size () != 0 ||
+ this->component_map_.current_size () != 0)
+ {
+ CIAO_ERROR ((LM_WARNING, CLINFO "CIAO_Container_i::remove - "
+ "Attempting to remove container that still has %u homes and %u components installed\n",
+ this->home_map_.current_size (),
+ this->component_map_.current_size ()));
+ }
+ }
+
+ void
+ CIAO_Container_i::activate_component (::Components::CCMObject_ptr comp)
+ {
+ CIAO_TRACE ("CIAO_Container_i::activate_component");
+
+ this->container_->activate_component (comp);
+ }
+
+
+ void
+ CIAO_Container_i::passivate_component (::Components::CCMObject_ptr comp)
+ {
+ CIAO_TRACE ("CIAO_Container_i::passivate_component");
+
+ this->container_->passivate_component (comp);
+ }
+
+
+ PortableServer::POA_ptr
+ CIAO_Container_i::_default_POA (void)
+ {
+ CIAO_TRACE ("CIAO_Container_i::_default_POA");
+ return PortableServer::POA::_duplicate (this->poa_.in ());
+ }
+ }
+}
diff --git a/modules/CIAO/ciao/ComponentServer/CIAO_Container_Impl.h b/modules/CIAO/ciao/ComponentServer/CIAO_Container_Impl.h
new file mode 100644
index 00000000000..cdd5336f482
--- /dev/null
+++ b/modules/CIAO/ciao/ComponentServer/CIAO_Container_Impl.h
@@ -0,0 +1,119 @@
+// $Id$
+/**
+ * @file CIAO_Container_Impl.h
+ * @author William R. Otte <wotte@dre.vanderbilt.edu>
+ */
+
+#ifndef CIAO_CONTAINER_H_
+#define CIAO_CONTAINER_H_
+
+#include "CIAO_ComponentServerS.h"
+#include "CIAO_CS_ClientC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+#pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ciao/Containers/Session/Session_Container.h"
+
+#include "CIAO_ComponentServer_svnt_export.h"
+
+namespace CIAO
+{
+ namespace Deployment
+ {
+ /**
+ * @class CIAO_Container
+ * @brief Implements external interface for CIAO container.
+ */
+ class CIAO_COMPONENTSERVER_SVNT_Export CIAO_Container_i
+ : public virtual POA_CIAO::Deployment::Container
+ {
+ public:
+ /// Constructor
+ CIAO_Container_i (const Components::ConfigValues &config,
+ const Static_Config_EntryPoints_Maps *,
+ const char *,
+ const CORBA::PolicyList *,
+ CIAO::Deployment::ComponentInstallation_ptr,
+ CORBA::ORB_ptr,
+ PortableServer::POA_ptr);
+
+ /// Destructor
+ virtual ~CIAO_Container_i (void);
+
+ virtual ::Components::CCMObject_ptr install_component (
+ const char * id,
+ const char * entrypt,
+ const ::Components::ConfigValues & config);
+
+ virtual void remove_component (::Components::CCMObject_ptr cref);
+
+ virtual ::Components::CCMObjectSeq * get_components (void);
+
+ virtual ::Components::ConfigValues * configuration (void);
+
+ virtual
+ ::Components::Deployment::ComponentServer_ptr get_component_server (void);
+
+ virtual ::Components::CCMHome_ptr install_home (const char * id,
+ const char * entrypt,
+ const ::Components::ConfigValues & config);
+
+ virtual void remove_home (::Components::CCMHome_ptr href);
+
+ virtual ::Components::CCMHomes * get_homes (void);
+
+ virtual void remove (void);
+
+ virtual void activate_component (::Components::CCMObject_ptr comp);
+
+ virtual void passivate_component (::Components::CCMObject_ptr comp);
+
+ virtual PortableServer::POA_ptr _default_POA (void);
+
+ private:
+ /// Keep a pointer to the managing ORB serving this servant.
+ CORBA::ORB_var orb_;
+
+ PortableServer::POA_var poa_;
+
+ CIAO::Container_var container_;
+
+ Components::ConfigValues config_;
+
+ const Static_Config_EntryPoints_Maps* static_entrypts_maps_;
+
+ /// To store all created CCMHome object
+ typedef ACE_Hash_Map_Manager_Ex<ACE_CString,
+ Components::CCMHome_var,
+ ACE_Hash<ACE_CString>,
+ ACE_Equal_To<ACE_CString>,
+ ACE_Null_Mutex> CCMHome_Map;
+
+ typedef CCMHome_Map::iterator Home_Iterator;
+ CCMHome_Map home_map_;
+
+ /// To store all created Component object.
+ // @@Gan, see how this caching is duplicated..
+ typedef ACE_Hash_Map_Manager_Ex<ACE_CString,
+ Components::CCMObject_var,
+ ACE_Hash<ACE_CString>,
+ ACE_Equal_To<ACE_CString>,
+ ACE_Null_Mutex> CCMComponent_Map;
+
+ typedef CCMComponent_Map::iterator Component_Iterator;
+ CCMComponent_Map component_map_;
+
+ typedef ACE_Hash_Map_Manager_Ex<ACE_CString,
+ ACE_CString,
+ ACE_Hash<ACE_CString>,
+ ACE_Equal_To<ACE_CString>,
+ ACE_Null_Mutex> CCMNaming_Map;
+ CCMNaming_Map naming_map_;
+
+ CIAO::Deployment::ComponentInstallation_var ci_;
+ };
+ }
+}
+#endif /* CIAO_CONTAINER_H_ */
diff --git a/modules/CIAO/ciao/ComponentServer/CIAO_Properties.idl b/modules/CIAO/ciao/ComponentServer/CIAO_Properties.idl
new file mode 100644
index 00000000000..2e42c8d2cf1
--- /dev/null
+++ b/modules/CIAO/ciao/ComponentServer/CIAO_Properties.idl
@@ -0,0 +1,27 @@
+/**
+ * @file CIAO_Properties.idl
+ * @author William R. Otte
+ * $Id$
+ * Standardizes names of configvalues used by CIAO.
+ */
+
+#ifndef CIAO_PROPERTIES_IDL
+#define CIAO_PROPERTIES_IDL
+
+module CIAO
+{
+ module Deployment
+ {
+ const string SVNT_ENTRYPT = "edu.vanderbilt.dre.CIAO.ServantEntrypoint";
+ const string SVNT_ARTIFACT = "edu.vanderbilt.dre.CIAO.ServantArtifact";
+ const string EXEC_ARTIFACT = "edu.vanderbilt.dre.CIAO.ExecutorArtifact";
+ const string SERVER_UUID = "edu.vanderbilt.dre.CIAO.ServerUUID";
+ const string SERVER_EXECUTABLE = "edu.vanderbilt.dre.CIAO.ComponentServerExecutable";
+ const string SERVER_ARGUMENTS = "edu.vanderbilt.dre.CIAO.ComponentServerArgs";
+ const string SERVER_TIMEOUT = "edu.vanderbilt.dre.CIAO.ServerTimeout";
+ const string SERVER_MULTITHREAD = "edu.vanderbilt.dre.CIAO.Multithreaded";
+ const string REGISTER_NAMING = "edu.vanderbilt.dre.CIAO.RegisterNaming";
+ const string COMPONENTINSTALLATION_REF = "edu.vanderbilt.dre.CIAO.ComponentInstallation";
+ };
+};
+#endif /* CIAO_PROPERTIES_IDL */
diff --git a/modules/CIAO/ciao/ComponentServer/CIAO_ServerActivator_Impl.cpp b/modules/CIAO/ciao/ComponentServer/CIAO_ServerActivator_Impl.cpp
new file mode 100644
index 00000000000..ad88ee927de
--- /dev/null
+++ b/modules/CIAO/ciao/ComponentServer/CIAO_ServerActivator_Impl.cpp
@@ -0,0 +1,518 @@
+// $Id$
+
+#include "CIAO_ServerActivator_Impl.h"
+#include "ace/Log_Msg.h"
+#include "ace/UUID.h"
+#include "ciao/Logger/Log_Macros.h"
+#include "ciao/Client_init.h"
+#include "ciao/CIAO_FailureReasonsC.h"
+
+#include "CIAO_ComponentServerC.h"
+#include "CIAO_PropertiesC.h"
+
+namespace CIAO
+{
+ namespace Deployment
+ {
+ CIAO_ServerActivator_i::CIAO_ServerActivator_i (CORBA::ULong def_spawn_delay,
+ const char * default_cs_path,
+ const char * cs_args,
+ bool multithreaded,
+ CIAO::Deployment::ComponentInstallation_ptr ci,
+ CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa)
+ : spawn_delay_ (def_spawn_delay),
+ multithreaded_ (multithreaded),
+ orb_ (CORBA::ORB::_duplicate (orb)),
+ poa_ (PortableServer::POA::_duplicate (poa)),
+ cs_path_ (default_cs_path),
+ cs_args_ (cs_args),
+ mutex_ (),
+ condition_ (mutex_),
+ ci_ (CIAO::Deployment::ComponentInstallation::_duplicate (ci))
+
+ {
+ CIAO_TRACE ("CIAO_ServerActivator_i::CIAO_ServerActivator_i");
+ ACE_Utils::UUID_GENERATOR::instance ()->init ();
+ }
+
+ CIAO_ServerActivator_i::~CIAO_ServerActivator_i(void)
+ {
+ }
+
+ void
+ CIAO_ServerActivator_i::component_server_callback (
+ ::Components::Deployment::ComponentServer_ptr serverref,
+ const char * server_UUID,
+ ::Components::ConfigValues_out config)
+ {
+ CIAO_TRACE("CIAO_ServerActivator_i::component_server_callback");
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "CIAO_ServerActivator_i::component_server_callback - "
+ "Received callback from ComponentServer %C\n",
+ server_UUID));
+
+ if (this->server_infos_.is_empty ())
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "CIAO_ServerActivator_i::component_server_callback - "
+ "Received callback from ComponentServer %C, but I don't manage any.\n",
+ server_UUID));
+ throw CORBA::BAD_PARAM ();
+ }
+
+ //SERVER_INFOS::iterator i (this->server_infos_.begin ());
+ //i.first ();
+ Server_Info *info = 0;
+
+ for (SERVER_INFOS::iterator i (this->server_infos_.begin ());
+ !i.done (); ++i)
+ {
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "CIAO_ServerActivator_i::component_server_callback - "
+ "Comparing %C with %C\n", (*i)->uuid_.c_str (), server_UUID));
+ if ((*i)->uuid_ == server_UUID)
+ {
+ info = (*i).get ();
+ }
+ }
+
+ if (info == 0)
+ { CIAO_ERROR ((LM_WARNING, CLINFO
+ "CIAO_ServerActivator_i::component_server_callback - "
+ "Received callback from ComponentServer %C, which doesn't belong to me.\n",
+ server_UUID));
+ throw CORBA::BAD_PARAM ();
+ }
+
+ if (info->activated_)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "CIAO_ServerActivator_i::component_server_callback - "
+ "Received callback from ComponentServer %C, which has already been configured.\n",
+ server_UUID));
+ throw CORBA::BAD_INV_ORDER ();
+ }
+
+ if (!CORBA::is_nil (info->ref_))
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "CIAO_ServerActivator_i::component_server_callback - "
+ "Received callback from ComponentServer %C, which has already called back.\n",
+ server_UUID));
+ throw CORBA::BAD_INV_ORDER ();
+ }
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "CIAO_ServerActivator_i::component_server_callback - "
+ "Received callback from ComponentServer %C\n",
+ server_UUID));
+
+ info->ref_ = ::Components::Deployment::ComponentServer::_duplicate (serverref);
+
+ this->create_component_server_config_values (*info, config);
+
+ // @@TODO: May want to print out configvalues here.
+ CIAO_DEBUG ((LM_DEBUG, CLINFO
+ "CIAO_ServerActivator_i::component_server_callback - "
+ "Generated %u ConfigValues for ComponentServer %C\n",
+ config->length (), server_UUID));
+ }
+
+ void
+ CIAO_ServerActivator_i::configuration_complete (const char *server_UUID)
+ {
+ CIAO_TRACE ("CIAO_ServerActivator_i::configuration_complete");
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "CIAO_ServerActivator_i::configuration_complete - "
+ "Received configuration_complete from ComponentServer %C\n",
+ server_UUID));
+
+ try
+ {
+ if (this->server_infos_.is_empty ())
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "CIAO_ServerActivator_i::configuration_complete - "
+ "Received callback from ComponentServer %C, but I don't manage any.\n",
+ server_UUID));
+ throw CORBA::BAD_PARAM ();
+ }
+
+ Server_Info *info = 0;
+
+ for (SERVER_INFOS::ITERATOR j (this->server_infos_);
+ !j.done (); ++j)
+ {
+ if ((*j)->uuid_ == server_UUID)
+ {
+ info = (*j).get ();
+ }
+ }
+
+ if (info == 0)
+ {
+ CIAO_ERROR ((LM_WARNING, CLINFO
+ "CIAO_ServerActivator_i::configuration_complete - "
+ "Received configuration_complete from ComponentServer %C, which doesn't belong to me.\n",
+ server_UUID));
+ throw CORBA::BAD_PARAM ();
+ }
+
+ if (info->activated_)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "CIAO_ServerActivator_i::configuration_complete - "
+ "Received configuration_complete from ComponentServer %C, which has already been completed.\n",
+ server_UUID));
+ throw CORBA::BAD_INV_ORDER ();
+ }
+
+ if (CORBA::is_nil (info->ref_.in ()))
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "CIAO_ServerActivator_i::configuration_complete - "
+ "Received configuration_complete from ComponentServer %C, which has not called back.\n",
+ server_UUID));
+ throw CORBA::BAD_INV_ORDER ();
+ }
+
+ info->activated_ = true;
+ }
+ catch (...)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "CIAO_ServerActivator_i::configuration_complete - "
+ "Caught unknown exception while processing configuration_complete\n"));
+ throw;
+ }
+ }
+
+ ::Components::Deployment::ComponentServer_ptr
+ CIAO_ServerActivator_i::create_component_server (const ::Components::ConfigValues & config)
+ {
+ CIAO_TRACE("CIAO_ServerActivator_i::create_component_server");
+
+ Safe_Server_Info server (new Server_Info (config.length () + 1));
+
+ CIAO::Utility::build_config_values_map (*server->cmap_, config);
+
+ ACE_CString cmd_options = this->construct_command_line (*server);
+
+ CIAO_DEBUG ((LM_DEBUG, CLINFO
+ "CIAO_ServerActivator_i::create_component_server - ComponentServer arguments: %C\n",
+ cmd_options.c_str ()));
+
+ server_infos_.insert_tail (server);
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "CIAO_ServerActivator_i::create_component_server - "
+ "Attempting to spawn ComponentServer with UUID %C\n",
+ server->uuid_.c_str ()));
+ // Now we need to get a copy of the one that was inserted...
+ pid_t pid = this->spawn_component_server (*server, cmd_options);
+ ACE_UNUSED_ARG (pid);
+
+ ACE_Time_Value timeout (this->spawn_delay_);
+
+ CORBA::Any val;
+
+ if (server->cmap_->find (SERVER_TIMEOUT, val) == 0)
+ {
+ CORBA::ULong t;
+ if (val >>= t)
+ {
+ CIAO_DEBUG ((LM_DEBUG, CLINFO "CIAO_ServerActivator_i::create_component_server - "
+ "Using provided non-default server timeout of %u\n", t));
+ timeout = ACE_Time_Value (t);
+ }
+ else
+ {
+ CIAO_ERROR ((LM_WARNING, CLINFO "CIAO_ServerActivator_i::create_component_server - "
+ "Failed to extract provided non-default server timeout from property '%C', "
+ "falling back to default timeout of %u\n",
+ this->spawn_delay_));
+ }
+ }
+
+ if (this->multithreaded_)
+ this->multi_threaded_wait_for_callback (*server, timeout/*, pid*/);
+ else
+ this->single_threaded_wait_for_callback (*server, timeout/*, pid*/);
+
+ CIAO_DEBUG ((LM_DEBUG, CLINFO
+ "CIAO_ServerActivator_i::create_component_server - "
+ "ComponentServer %C successfully spawned and configured!\n",
+ server->uuid_.c_str ()));
+
+ return ::Components::Deployment::ComponentServer::_duplicate (server->ref_.in ());
+ }
+
+ ACE_CString
+ CIAO_ServerActivator_i::construct_command_line (Server_Info &server)
+ {
+ CIAO_TRACE ("CIAO_ServerActivator_i::construct_command_line");
+
+ // Build our command line to launch the compoent server
+ ACE_CString cmd_options (this->cs_args_);
+
+ CORBA::Any val;
+
+ if (server.cmap_->find (SERVER_UUID, val) == 0)
+ {
+ // Nodeapplication has requested a custom uuid
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "CIAO_ServerActivator_i::construct_command_line - Using provided UUID\n"));
+ const char *uuid = 0;
+ val >>= uuid;
+ server.uuid_ = uuid;
+ }
+ else
+ {
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "CIAO_ServerActivator_i::construct_command_line - Using generated UUID\n"));
+ ACE_Utils::UUID uuid;
+ ACE_Utils::UUID_GENERATOR::instance ()->generate_UUID (uuid);
+ server.uuid_ = *uuid.to_string ();
+ }
+
+ CIAO_DEBUG ((LM_DEBUG, CLINFO
+ "CIAO_ServerActivator_i::construct_command_line - Creating component server "
+ " with UUID %C\n", server.uuid_.c_str ()));
+
+ cmd_options += " -u ";
+ cmd_options += server.uuid_;
+
+ return cmd_options;
+ }
+
+ pid_t
+ CIAO_ServerActivator_i::spawn_component_server (const Server_Info &si,
+ const ACE_CString &cmd_line)
+ {
+ CIAO_TRACE ("CIAO_ServerActivator_i::spawn_component_server");
+
+ ACE_Process_Options options;
+
+ // Get my object reference
+ CORBA::Object_var obj = this->poa_->servant_to_reference (this);
+ CORBA::String_var ior = this->orb_->object_to_string (obj.in ());
+ CORBA::Any val;
+
+ const char *path = this->cs_path_.c_str ();
+
+ if (si.cmap_->find (SERVER_EXECUTABLE, val) == 0)
+ {
+ val >>= path;
+ CIAO_DEBUG ((LM_DEBUG, CLINFO "CIAO_ServerActivator_i::spawn_component_server - "
+ "Using provided component server executable:%C\n", path));
+ }
+ else
+ {
+ CIAO_DEBUG ((LM_DEBUG, CLINFO "CIAO_ServerActivator_i::spawn_component_server - "
+ "Using default component server execuable\n"));
+ }
+
+ options.command_line ("%s %s -c %s",
+ path,
+ cmd_line.c_str (),
+ ior.in ());
+
+ options.avoid_zombies (0);
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "CIAO_ServerActivator_i::spawn_component_server - Spawning process, command line is %s\n",
+ options.command_line_buf ()));
+
+ pid_t const pid = this->process_manager_.spawn (options,
+ &this->child_handler_);
+
+ if (pid == ACE_INVALID_PID)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "Failed to spawn a ComponentServer process\n"));
+ throw Components::CreateFailure (CIAO::SERVER_SPAWN_FAILURE);
+ }
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "CIAO_ServerActivator_i::spawn_component_server - Process successfully spawned with pid %u\n",
+ pid));
+ return pid;
+ }
+
+ void
+ CIAO_ServerActivator_i::
+ single_threaded_wait_for_callback (const Server_Info &si,
+ ACE_Time_Value &timeout)
+ {
+ CIAO_TRACE ("CIAO_ServerActivator_i::single_threaded_wait_for_callback");
+
+ // Below code is broken for thread-per-connection concurrency model,
+ // since the main thread is running ORB event loop and will spawn
+ // a different thread to handle the call <register_node_application>,
+ // the <perform_work> operation will not be invoked and finally
+ // a timeout will occur. For a similar reason, it won't work
+ // for thread-pool concurrency model.
+ while (true)
+ {
+ this->orb_->perform_work (timeout);
+
+ if (timeout == ACE_Time_Value::zero)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "CIAO_ServerActivator_i::single_threaded_wait_for_callback - "
+ "Timed out while waiting for ComponentServer %C to call back.\n",
+ si.uuid_.c_str ()));
+ throw ::Components::CreateFailure (CIAO::CALLBACK_TIMEOUT_EXCEEDED);
+ }
+
+ if (si.activated_)
+ {
+ break;
+ }
+ }
+ }
+
+ void
+ CIAO_ServerActivator_i::
+ multi_threaded_wait_for_callback (const Server_Info &si,
+ ACE_Time_Value &timeout)
+ {
+ CIAO_TRACE ("CIAO_ServerActivator_i::multi_threaded_wait_for_callback");
+
+ // Wait for a conditional variable
+ ACE_GUARD_THROW_EX ( TAO_SYNCH_MUTEX,
+ guard,
+ this->mutex_,
+ CORBA::NO_RESOURCES ());
+
+ while (! si.activated_ )
+ if (this->condition_.wait (&timeout) == -1)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "CIAO_ServerActivator_i::multi_threaded_wait_for_callback - "
+ "Timed out while waiting for ComponentServer %C to call back.\n",
+ si.uuid_.c_str ()));
+ throw Components::CreateFailure (CIAO::CALLBACK_TIMEOUT_EXCEEDED);
+ }
+ }
+
+ void
+ CIAO_ServerActivator_i::remove_component_server (::Components::Deployment::ComponentServer_ptr server)
+ {
+ CIAO_TRACE ("CIAO_ServerActivator_i::remove_component_server");
+
+ if (this->server_infos_.is_empty ())
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "CIAO_ServerActivator_i::remove_component_server - "
+ "I don't manage any ComponentServers.\n"));
+ throw CORBA::BAD_PARAM ();
+ }
+
+ Server_Info *info = 0;
+
+ for (SERVER_INFOS::ITERATOR i (this->server_infos_);
+ !i.done (); ++i)
+ {
+ if ((*i)->ref_->_is_equivalent (server))
+ {
+ info = (*i).get ();
+ }
+ }
+
+ if (!info)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "CIAO_ServerActivator_i::remove_component_server - "
+ "Failed to find equivalent ComponentServer under my management.\n"));
+ throw ::Components::RemoveFailure ();
+ }
+
+ try
+ {
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "CIAO_ServerActivator_i::remove_component_server - "
+ "Calling remove () on ComponentServer %C\n",
+ info->uuid_.c_str ()));
+ server->remove ();
+ }
+ catch (::Components::RemoveFailure &)
+ {
+ CIAO_ERROR ((LM_WARNING, CLINFO
+ "CIAO_ServerActivator_i::remove_component_server - "
+ "Received RemoveFailure exception from ComponentServer %C\n",
+ info->uuid_.c_str ()));
+ }
+
+ // If this is a CIAO component server, call shutdown
+ CIAO::Deployment::ComponentServer_var ccs =
+ CIAO::Deployment::ComponentServer::_narrow (server);
+ if (!CORBA::is_nil (ccs))
+ {
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "CIAO_ServerActivator_i::remove_component_server - "
+ "Calling shutdown () on ComponentServer %C\n",
+ info->uuid_.c_str ()));
+ ccs->shutdown ();
+ }
+ else
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "CIAO_ServerActivator_i::remove_component_server - "
+ "ComponentServer %C is not a CIAO_ComponentServer, not calling shutdown.\n",
+ info->uuid_.c_str ()));
+
+ CIAO_DEBUG ((LM_INFO, CLINFO
+ "CIAO_ServerActivator_i::remove_component_server - "
+ "ComponentServer %C successfully shut down.\n",
+ info->uuid_.c_str ()));
+ }
+
+ ::Components::Deployment::ComponentServers *
+ CIAO_ServerActivator_i::get_component_servers (void)
+ {
+ CIAO_TRACE ("CIAO_ServerActivator_i::get_component_servers");
+
+ ::Components::Deployment::ComponentServers_var retval = new
+ Components::Deployment::ComponentServers (this->server_infos_.size ());
+
+ CORBA::ULong pos = 0;
+
+ for (SERVER_INFOS::ITERATOR i (this->server_infos_);
+ !i.done (); ++i)
+ {
+ retval[pos++] =
+ ::Components::Deployment::ComponentServer::_duplicate ((*i)->ref_);
+ }
+
+ return retval._retn ();
+ }
+
+ void
+ CIAO_ServerActivator_i::create_component_server_config_values (
+ const Server_Info &,
+ Components::ConfigValues_out &config)
+ {
+ ACE_NEW_THROW_EX (config,
+ Components::ConfigValues (1),
+ CORBA::NO_MEMORY ());
+
+ CIAO::Deployment::ComponentInstallation_ptr ci =
+ CIAO::Deployment::ComponentInstallation::_duplicate (this->ci_.in ());
+ CORBA::Any ci_any;
+ ci_any <<= ci;
+
+ OBV_Components::ConfigValue* p = 0;
+ ACE_NEW_THROW_EX (p,
+ OBV_Components::ConfigValue (),
+ CORBA::NO_MEMORY ());
+ p->name (CIAO::Deployment::COMPONENTINSTALLATION_REF);
+ p->value (ci_any);
+ config->length (1);
+ config.operator[](0) = p;
+ }
+ }
+}
+
diff --git a/modules/CIAO/ciao/ComponentServer/CIAO_ServerActivator_Impl.h b/modules/CIAO/ciao/ComponentServer/CIAO_ServerActivator_Impl.h
new file mode 100644
index 00000000000..93c10435d00
--- /dev/null
+++ b/modules/CIAO/ciao/ComponentServer/CIAO_ServerActivator_Impl.h
@@ -0,0 +1,192 @@
+// $Id$
+/**
+ * @file CIAO_ServerActivator_Impl.h
+ * @author William R. Otte
+ */
+
+#ifndef CIAO_SERVERACTIVATOR_H_
+#define CIAO_SERVERACTIVATOR_H_
+
+#include "ace/Process_Manager.h"
+#include "ace/Event_Handler.h"
+#include "ace/Condition_T.h"
+#include "ace/OS_NS_sys_wait.h"
+#include "ace/Refcounted_Auto_Ptr.h"
+#include "ace/Unbounded_Set_Ex.h"
+#include "ace/Synch_Traits.h"
+#include "ace/Condition_T.h"
+#include "tao/PortableServer/PortableServer.h"
+#include "tao/orbconf.h"
+#include "ciao/Client_init.h"
+#include "ciao/ComponentServer/CIAO_CS_ClientS.h"
+#include "ciao/ComponentServer/CIAO_ComponentServerC.h"
+#include "ciao/ComponentServer/CIAO_CS_Client_svnt_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+#pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+namespace CIAO
+{
+ namespace Deployment
+ {
+ /**
+ * @brief The signal handler class for the SIGCHLD handling to avoid
+ * zombies
+ */
+ class Child_Handler : public virtual ACE_Event_Handler
+ {
+ public:
+ virtual int handle_signal (int,
+ siginfo_t *,
+ ucontext_t *)
+ {
+ // @@ Note that this code is not portable to all OS platforms
+ // since it uses print statements within signal handler context.
+ ACE_exitcode status;
+ // makes a claal to the underlying os system call
+ // -1 to wait for any child process
+ // and WNOHANG so that it retuurns immediately
+ ACE_OS::waitpid (-1 ,&status, WNOHANG, 0);
+
+ return 0;
+ }
+ };
+
+ /**
+ * @author William R. Otte <wotte@dre.vanderbilt.edu>
+ * @brief Default server activator for CIAO component servers.
+ *
+ * Implements the default component server activation strategy
+ * which is to spawn new processes. This is not thread-safe,
+ * nor is it intended to be. Containers are reated serially,
+ * so there will be only one actor *modifying* data at a particular
+ * point in time.
+ */
+ class CIAO_CS_CLIENT_SVNT_Export CIAO_ServerActivator_i
+ : public virtual POA_CIAO::Deployment::ServerActivator
+ {
+ public:
+ /// Constructor
+ CIAO_ServerActivator_i (CORBA::ULong def_spawn_delay,
+ const char * default_cs_path,
+ const char * cs_args,
+ bool multithreaded,
+ CIAO::Deployment::ComponentInstallation_ptr ci,
+ CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa_);
+
+ /// Destructor
+ virtual ~CIAO_ServerActivator_i (void);
+
+ virtual
+ void component_server_callback (
+ ::Components::Deployment::ComponentServer_ptr serverref,
+ const char * server_UUID,
+ ::Components::ConfigValues_out config);
+
+ virtual void configuration_complete (const char *server_UUID);
+
+ virtual
+ ::Components::Deployment::ComponentServer_ptr
+ create_component_server (const ::Components::ConfigValues & config);
+
+ virtual
+ void remove_component_server (
+ ::Components::Deployment::ComponentServer_ptr server);
+
+ virtual
+ ::Components::Deployment::ComponentServers * get_component_servers (void);
+
+ private:
+ struct Server_Info;
+
+ /// Builds command line options based on configuration information.
+ /// May modify the uuid of the component server.
+ ACE_CString construct_command_line (Server_Info &si);
+
+ /// Spawns the component server process, but does not wait for it
+ /// to call back.
+ pid_t spawn_component_server (const Server_Info &si,
+ const ACE_CString &cmd_line);
+
+ /// This method is only applicable when our program is configured as
+ /// singled threaded . Internally it uses a <perform_work> blocking
+ /// call to wait for NA object to call back
+ void single_threaded_wait_for_callback (const Server_Info &si,
+ ACE_Time_Value &timeout);
+
+ /// This method is only applicable when our program is configured as
+ /// multiple threaded. Internally it waits on a conditional variable
+ /// that could be modified by the callback servant which runs in
+ /// another thread
+ void multi_threaded_wait_for_callback (const Server_Info &si,
+ ACE_Time_Value &timeout);
+
+ void create_component_server_config_values (const Server_Info &info,
+ Components::ConfigValues_out &config);
+
+ struct Server_Info
+ {
+ Server_Info (size_t cmap_size_hint = 128)
+ : cmap_ (new CIAO::Utility::CONFIGVALUE_MAP (cmap_size_hint)),
+ ref_ (Components::Deployment::ComponentServer::_nil ()),
+ pid_ (ACE_INVALID_PID),
+ activated_ (false) {}
+
+ typedef ACE_Refcounted_Auto_Ptr <CIAO::Utility::CONFIGVALUE_MAP,
+ ACE_Null_Mutex> CONFIGVALUE_MAP_PTR;
+
+ ACE_CString uuid_;
+ CONFIGVALUE_MAP_PTR cmap_;
+ Components::Deployment::ComponentServer_var ref_;
+ pid_t pid_;
+ bool activated_;
+ };
+
+ typedef ACE_Refcounted_Auto_Ptr<Server_Info, ACE_Null_Mutex> Safe_Server_Info;
+
+ struct _server_info
+ {
+ bool operator() (const Safe_Server_Info &a, const Safe_Server_Info &b) const
+ {
+ return a->uuid_ == b->uuid_;
+ }
+ };
+
+ // Presumably, there won't be too many component servers per node application
+ typedef ACE_Unbounded_Set_Ex <Safe_Server_Info, _server_info> SERVER_INFOS;
+
+ /// Default args to pass to all componentservers.
+ ACE_CString default_args_;
+
+ SERVER_INFOS server_infos_;
+
+ ACE_Process_Manager process_manager_;
+
+ Child_Handler child_handler_;
+
+ CORBA::ULong spawn_delay_;
+
+ /////*******NEW
+ bool multithreaded_;
+
+ CORBA::ORB_var orb_;
+
+ PortableServer::POA_var poa_;
+
+ ACE_CString cs_path_;
+
+ ACE_CString cs_args_;
+
+ TAO_SYNCH_MUTEX mutex_;
+
+ ACE_Condition<TAO_SYNCH_MUTEX> condition_;
+
+ CIAO::Deployment::ComponentInstallation_var ci_;
+ };
+
+
+ }
+}
+#endif /* CIAO_SERVERACTIVATOR_H_ */
diff --git a/modules/CIAO/ciao/Containers/CIAO_Servant_Activator.idl b/modules/CIAO/ciao/Containers/CIAO_Servant_Activator.idl
new file mode 100644
index 00000000000..18aa906e0e2
--- /dev/null
+++ b/modules/CIAO/ciao/Containers/CIAO_Servant_Activator.idl
@@ -0,0 +1,24 @@
+/**
+ * @file CIAO_Servant_Activator.idl
+ * @author William R. Otte <wotte@dre.vanderbilt.edu>
+ * $Id$
+ * Local interface extensions for the CIAO servant activator.
+ */
+
+#ifndef CIAO_SERVANT_ACTIVATOR_IDL
+#define CIAO_SERVANT_ACTIVATOR_IDL
+
+#include "tao/PortableServer/ServantActivator.pidl"
+#include "ciao/Servants/CIAO_Port_Activator.idl"
+
+module CIAO
+{
+ local interface Servant_Activator : PortableServer::ServantActivator
+ {
+ boolean update_port_activator (in PortableServer::ObjectId oid);
+
+ boolean register_port_activator (in Port_Activator pa);
+ };
+};
+
+#endif
diff --git a/modules/CIAO/ciao/Containers/CIAO_Servant_Activator.mpc b/modules/CIAO/ciao/Containers/CIAO_Servant_Activator.mpc
new file mode 100644
index 00000000000..9f17d55807d
--- /dev/null
+++ b/modules/CIAO/ciao/Containers/CIAO_Servant_Activator.mpc
@@ -0,0 +1,24 @@
+// $Id$
+
+project(CIAO_Servant_Activator_stub_idl) : ciaoidldefaults {
+ custom_only = 1
+ idlflags += -Wb,stub_export_include=CIAO_Servant_Activator_export.h \
+ -Wb,stub_export_macro=CIAO_SERVANT_ACTIVATOR_Export \
+ -SS -Sci -Gxhst
+ IDL_Files {
+ CIAO_Servant_Activator.idl
+ }
+}
+
+project(CIAO_Servant_Activator_stub) : ciao_lib, portableserver, ciao_port_activator_stub, avoids_minimum_corba {
+ after += CIAO_Servant_Activator_stub_idl
+ dynamicflags = CIAO_SERVANT_ACTIVATOR_BUILD_DLL
+
+ IDL_Files {
+ }
+ Source_Files {
+ Servant_Activator.cpp
+ CIAO_Servant_ActivatorC.cpp
+ }
+}
+
diff --git a/modules/CIAO/ciao/Containers/Container_Base.cpp b/modules/CIAO/ciao/Containers/Container_Base.cpp
new file mode 100644
index 00000000000..9fa616e7299
--- /dev/null
+++ b/modules/CIAO/ciao/Containers/Container_Base.cpp
@@ -0,0 +1,50 @@
+// $Id$
+
+#include "Container_Base.h"
+#include "ciao/Logger/Log_Macros.h"
+
+#if !defined (__ACE_INLINE__)
+# include "Container_Base.inl"
+#endif /* __ACE_INLINE__ */
+
+namespace CIAO
+{
+ ////////////////////////////////////////////////////////////////
+
+ Container_i::Container_i (CORBA::ORB_ptr o)
+ : orb_ (CORBA::ORB::_duplicate (o)),
+ container_impl_ (0)
+ {
+ }
+
+ Container_i::Container_i (CORBA::ORB_ptr o,
+ Deployment::CIAO_Container_i *container_impl)
+ : orb_ (CORBA::ORB::_duplicate (o)),
+ container_impl_ (container_impl)
+ {
+ }
+
+ Container_i::~Container_i (void)
+ {
+ }
+
+ CORBA::PolicyList *
+ Container_i::get_receptacle_policy (const char* name)
+ {
+ CORBA::PolicyList_var policy_list;
+
+ ACE_NEW_THROW_EX (policy_list,
+ CORBA::PolicyList (),
+ CORBA::NO_MEMORY ());
+
+ if (this->rec_pol_map_.find (name, policy_list) != 0)
+ {
+ CIAO_ERROR ((LM_DEBUG, CLINFO
+ "Container_i::get_receptacle_policy - No policies found "
+ "for the receptacle %C\n",
+ name));
+ }
+
+ return policy_list._retn ();
+ }
+}
diff --git a/modules/CIAO/ciao/Containers/Container_Base.h b/modules/CIAO/ciao/Containers/Container_Base.h
new file mode 100644
index 00000000000..722f3f8a5ac
--- /dev/null
+++ b/modules/CIAO/ciao/Containers/Container_Base.h
@@ -0,0 +1,159 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Container_Base.h
+ *
+ * $Id$
+ *
+ * Header file for CIAO's container implementations
+ *
+ * @author Nanbor Wang <nanbor@cs.wustl.edu>
+ * @author Gan Deng <dengg@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef CIAO_CONTAINER_BASE_H
+#define CIAO_CONTAINER_BASE_H
+
+#include /**/ "ace/pre.h"
+
+#include "ciao/Containers/Container_Base_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Hash_Map_Manager_T.h"
+#include "tao/LocalObject.h"
+#include "tao/PortableServer/PortableServer.h"
+#include "ccm/CCM_ContainerC.h"
+
+#include "ciao/Containers/Container_BaseC.h"
+
+namespace CIAO
+{
+ class Dynamic_Component_Servant_Base;
+
+ namespace Deployment
+ {
+ class CIAO_Container_i;
+ }
+
+ typedef ACE_Hash_Map_Manager_Ex<ACE_CString,
+ CORBA::PolicyList,
+ ACE_Hash<ACE_CString>,
+ ACE_Equal_To<ACE_CString>,
+ ACE_Null_Mutex> REC_POL_MAP;
+ typedef ACE_Hash_Map_Iterator<ACE_CString,
+ CORBA::PolicyList,
+ ACE_Null_Mutex> REC_POL_MAP_ITERATOR;
+
+ /**
+ * @class Container
+ *
+ * @brief Common container interface definition.
+ *
+ * Perhaps we can use local interface to define these interfaces as
+ * we will also get reference counting automatically.
+ */
+ class CIAO_CONTAINER_BASE_Export Container_i :
+ public virtual Container,
+ public virtual ::CORBA::LocalObject
+ {
+ public:
+ Container_i (CORBA::ORB_ptr o);
+ Container_i (CORBA::ORB_ptr o, Deployment::CIAO_Container_i *container_impl);
+
+ virtual ~Container_i (void) = 0;
+
+ /// Initialize the container with a name.
+ virtual void init (const char *name = 0,
+ const CORBA::PolicyList *more_policies = 0) = 0;
+
+ /// Get component's POA.
+ /**
+ * This operation does *NOT* increase the reference count of the
+ * POA. Look at the const qualifier in the method.
+ */
+ virtual PortableServer::POA_ptr the_POA (void);
+ virtual PortableServer::POA_ptr the_port_POA (void);
+
+ /// Get the receptacle policy given the receptacle name
+ CORBA::PolicyList * get_receptacle_policy (const char *name);
+
+ /// Install a new home
+ virtual Components::CCMHome_ptr install_home (const char *primary_artifact,
+ const char *entry_point,
+ const char *servant_artifact,
+ const char *servant_entrypoint,
+ const char *name) = 0;
+
+ /// Uninstall a servant for component or home.
+ virtual void uninstall_home (Components::CCMHome_ptr homeref) = 0;
+
+ virtual Components::CCMObject_ptr install_component (const char *primary_artifact,
+ const char *entry_point,
+ const char *servant_artifact,
+ const char *servant_entrypoint,
+ const char *name) = 0;
+
+ virtual void uninstall_component (Components::CCMObject_ptr compref) = 0;
+
+ virtual CORBA::Object_ptr get_objref (PortableServer::Servant p) = 0;
+
+ virtual CORBA::Object_ptr install_servant (PortableServer::Servant objref,
+ Container_Types::OA_Type type,
+ PortableServer::ObjectId_out oid) = 0;
+
+ /// Uninstall a servant for component.
+ virtual void uninstall_servant (PortableServer::Servant objref,
+ Container_Types::OA_Type type,
+ PortableServer::ObjectId_out oid) = 0;
+
+ virtual void add_servant_to_map (PortableServer::ObjectId &oid,
+ Dynamic_Component_Servant_Base* servant) = 0;
+
+ virtual void delete_servant_from_map (PortableServer::ObjectId &oid) = 0;
+
+ /// Get a reference to the underlying ORB.
+ CORBA::ORB_ptr the_ORB (void) const;
+
+ /// Set the policy map for all the receptacles hosted in this container.
+ void set_receptacle_policy_map (::CIAO::REC_POL_MAP &rec_pol_map);
+
+ protected:
+ /// Reference to the ORB
+ CORBA::ORB_var orb_;
+
+ /// 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_;
+
+ PortableServer::POA_var home_servant_poa_;
+
+ Deployment::CIAO_Container_i *container_impl_;
+
+ ::CIAO::REC_POL_MAP rec_pol_map_;
+
+ private:
+ /// Not allowed to be used
+ Container_i (void);
+ };
+}
+
+#if defined (__ACE_INLINE__)
+# include "Container_Base.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* CIAO_CONTAINER_BASE_H */
diff --git a/modules/CIAO/ciao/Containers/Container_Base.idl b/modules/CIAO/ciao/Containers/Container_Base.idl
new file mode 100644
index 00000000000..01a79b71a15
--- /dev/null
+++ b/modules/CIAO/ciao/Containers/Container_Base.idl
@@ -0,0 +1,82 @@
+/**
+ * @file Container_Base.idl
+ * @author William R. Otte <wotte@dre.vanderbilt.edu>
+ * $Id$
+ * Container local interface.
+ */
+
+#include "tao/PortableServer/PortableServer_include.pidl"
+#include "ccm/CCM_Home.idl"
+#include "ciao/Containers/CIAO_Servant_Activator.idl"
+
+module CIAO
+{
+ module Container_Types
+ {
+ enum OA_Type
+ {
+ COMPONENT_t,
+ HOME_t,
+ FACET_CONSUMER_t
+ };
+ };
+
+ exception InvalidComponent
+ {
+ };
+
+ /**
+ * @interface Container
+ * @brief Internal container interfaces.
+ *
+ * This interface provides interfactes to two portions of the CIAO
+ * container architecture: The generic external container interface
+ * created by the component server, and the component specific container
+ * portions generated by the CIDL compiler (the component servant)
+ */
+ local interface Container
+ {
+ CORBA::PolicyList get_receptacle_policy (in string name);
+ // **** Methods used by external container
+ Components::CCMHome install_home (in string primary_artifact,
+ in string entry_point,
+ in string servant_artifact,
+ in string servant_entrypoint,
+ in string name);
+
+ void uninstall_home (in Components::CCMHome homeptr);
+
+ Components::CCMObject install_component (in string primary_artifact,
+ in string entry_point,
+ in string servant_artifact,
+ in string servant_entrypoint,
+ in string name);
+
+ void activate_component (in Components::CCMObject name);
+
+ void passivate_component (in Components::CCMObject name);
+
+ void uninstall_component (in Components::CCMObject compptr);
+
+ // *** Methods used by component specific container portions
+ Object install_servant (in PortableServer::Servant svnt,
+ in Container_Types::OA_Type type,
+ out PortableServer::ObjectId oid);
+
+ void uninstall_servant (in PortableServer::Servant compptr,
+ in Container_Types::OA_Type type,
+ out PortableServer::ObjectId oid);
+
+ Servant_Activator ports_servant_activator ();
+
+ Object generate_reference (in string obj_id,
+ in string repo_id,
+ in Container_Types::OA_Type type);
+
+ Object get_objref (in PortableServer::Servant p);
+
+ PortableServer::POA the_POA ();
+
+ PortableServer::POA the_port_POA ();
+ };
+};
diff --git a/modules/CIAO/ciao/Containers/Container_Base.inl b/modules/CIAO/ciao/Containers/Container_Base.inl
new file mode 100644
index 00000000000..b4198116983
--- /dev/null
+++ b/modules/CIAO/ciao/Containers/Container_Base.inl
@@ -0,0 +1,33 @@
+// $Id$
+
+namespace CIAO
+{
+ ACE_INLINE PortableServer::POA_ptr
+ Container_i::the_POA (void)
+ {
+ return this->component_poa_.in ();
+ }
+
+ ACE_INLINE PortableServer::POA_ptr
+ Container_i::the_port_POA (void)
+ {
+ return this->facet_cons_poa_.in ();
+ }
+
+ ACE_INLINE CORBA::ORB_ptr
+ Container_i::the_ORB (void) const
+ {
+ return this->orb_.in ();
+ }
+
+ ACE_INLINE void
+ Container_i::set_receptacle_policy_map (::CIAO::REC_POL_MAP &rec_pol_map)
+ {
+ for (::CIAO::REC_POL_MAP_ITERATOR it = rec_pol_map.begin ();
+ it != rec_pol_map.end ();
+ ++it)
+ {
+ this->rec_pol_map_.bind ((*it).ext_id_, (*it).int_id_);
+ }
+ }
+}
diff --git a/modules/CIAO/ciao/Containers/Containers.mpc b/modules/CIAO/ciao/Containers/Containers.mpc
new file mode 100644
index 00000000000..3e17afdb9fd
--- /dev/null
+++ b/modules/CIAO/ciao/Containers/Containers.mpc
@@ -0,0 +1,30 @@
+// $Id$
+
+project(CIAO_Container_Base_idl) : taoidldefaults {
+ custom_only = 1
+
+ idlflags += -Wb,export_include=Container_Base_export.h \
+ -Wb,export_macro=CIAO_CONTAINER_BASE_Export \
+ -SS -Sci -Gxhst
+
+ IDL_Files {
+ Container_Base.idl
+ }
+}
+project(CIAO_Container_Base) : ciao_lib, ccm_svnt, ciao_servant_activator, ciao_port_activator_stub {
+ after += CIAO_Container_Base_idl
+ dynamicflags += CIAO_CONTAINER_BASE_BUILD_DLL
+
+ IDL_Files {
+ }
+ Source_Files {
+ Container_Base.cpp
+ Container_BaseC.cpp
+ }
+ Inline_Files {
+ Container_Base.inl
+ }
+ Header_Files {
+ Container_Base.h
+ }
+}
diff --git a/modules/CIAO/ciao/Containers/Servant_Activator.cpp b/modules/CIAO/ciao/Containers/Servant_Activator.cpp
new file mode 100644
index 00000000000..eb7efa2a98d
--- /dev/null
+++ b/modules/CIAO/ciao/Containers/Servant_Activator.cpp
@@ -0,0 +1,167 @@
+#include "Servant_Activator.h"
+
+#include "tao/PortableServer/PortableServer_Functions.h"
+#include "ciao/Logger/Log_Macros.h"
+
+ACE_RCSID (ciao,
+ Servant_Activator_i,
+ "$Id$")
+
+namespace CIAO
+{
+ Servant_Activator_i::Servant_Activator_i (CORBA::ORB_ptr o)
+ : orb_ (CORBA::ORB::_duplicate (o)),
+ slot_index_ (0)
+ {
+ }
+
+ Servant_Activator_i::~Servant_Activator_i (void)
+ {
+ CIAO_TRACE ("Servant_Activator_i::~Servant_Activator_i");
+ }
+
+ bool
+ Servant_Activator_i::update_port_activator (
+ const PortableServer::ObjectId &oid)
+ {
+ CIAO_TRACE ("Servant_Activator_i::update_port_activator");
+
+ CORBA::String_var str =
+ PortableServer::ObjectId_to_string (oid);
+ {
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX,
+ guard,
+ this->mutex_,
+ CORBA::NO_RESOURCES ());
+
+ Port_Activators::iterator pa_iter = this->pa_.find (str.in ());
+
+ if (pa_iter != this->pa_.end ())
+ {
+ this->pa_.erase (pa_iter);
+ }
+ else return false;
+ }
+
+ return true;
+ }
+
+ PortableServer::Servant
+ Servant_Activator_i::incarnate (const PortableServer::ObjectId &oid,
+ PortableServer::POA_ptr)
+ {
+ CIAO_TRACE ("Servant_Activator_i::incarnate");
+
+ CORBA::String_var str =
+ PortableServer::ObjectId_to_string (oid);
+
+ CIAO_DEBUG ((LM_INFO, CLINFO
+ "Servant_Activator_i::incarnate, "
+ "Attempting to activate port name [%C]\n",
+ str.in ()));
+
+ Port_Activators::iterator pa_iter;
+
+ {
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX,
+ guard,
+ this->mutex_,
+ CORBA::NO_RESOURCES ());
+
+ pa_iter = this->pa_.find (str.in ());
+ }
+
+ if (pa_iter == this->pa_.end ())
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "Servant_Activator_i::incarnate - "
+ "Unable to find sutible port activator for ObjectID %C\n",
+ str.in ()));
+ throw CORBA::OBJECT_NOT_EXIST ();
+ }
+
+ if (CORBA::is_nil (pa_iter->second))
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "Servant_Activator_i::incarnate - "
+ "Port Activator for ObjectId %C was nil!\n",
+ str.in ()));
+ throw CORBA::OBJECT_NOT_EXIST ();
+ }
+
+ CIAO_DEBUG ((LM_INFO, CLINFO
+ "Servant_Activator_i::incarnate - Activating Port %C\n",
+ str.in ()));
+
+ return pa_iter->second->activate (oid);
+ }
+
+ void
+ Servant_Activator_i::etherealize (const PortableServer::ObjectId &oid,
+ PortableServer::POA_ptr ,
+ PortableServer::Servant servant,
+ CORBA::Boolean ,
+ CORBA::Boolean)
+ {
+ CORBA::String_var str =
+ PortableServer::ObjectId_to_string (oid);
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO "Servant_Activator_i::etherealize - "
+ "Attempting to etherealize servant with object ID %C\n",
+ str.in ()));
+
+ Port_Activators::iterator pa_iter;
+
+ {
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX,
+ guard,
+ this->mutex_,
+ CORBA::NO_RESOURCES ());
+
+ pa_iter = this->pa_.find (str.in ());
+ }
+
+ if (pa_iter == this->pa_.end ())
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "Servant_Activator_i::etherealize - "
+ "Unable to find sutible port activator for ObjectID %C\n",
+ str.in ()));
+ throw CORBA::OBJECT_NOT_EXIST ();
+ }
+
+ if (CORBA::is_nil (pa_iter->second))
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "Servant_Activator_i::etherealize - "
+ "Port Activator for ObjectId %C was nil!\n",
+ str.in ()));
+ throw CORBA::OBJECT_NOT_EXIST ();
+ }
+
+ pa_iter->second->deactivate (servant);
+ }
+
+ bool
+ Servant_Activator_i::register_port_activator (Port_Activator_ptr pa)
+ {
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ guard,
+ this->mutex_,
+ false);
+
+ CIAO_DEBUG ((LM_INFO, CLINFO "Servant_Activator_i::register_port_activator - "
+ "Registering a port activator for port [%C] with ObjectID [%C]\n",
+ pa->name (), pa->oid ()));
+
+ try
+ {
+ this->pa_ [pa->oid ()] = Port_Activator::_duplicate (pa);
+ }
+ catch (...)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "Servant_Activator_i::register_port_activator - "
+ "Unable to register a port activator for port [%C] with ObjectID [%C]\n",
+ pa->name (), pa->oid ()));
+ return false;
+ }
+
+ return true;
+ }
+}
diff --git a/modules/CIAO/ciao/Containers/Servant_Activator.h b/modules/CIAO/ciao/Containers/Servant_Activator.h
new file mode 100644
index 00000000000..bf228c48e18
--- /dev/null
+++ b/modules/CIAO/ciao/Containers/Servant_Activator.h
@@ -0,0 +1,100 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Servant_Activator.h
+ *
+ * $Id$
+ *
+ * @authors Balachandran Natarajan <bala@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef CIAO_SERVANT_ACTIVATOR_H
+#define CIAO_SERVANT_ACTIVATOR_H
+
+#include /**/ "ace/pre.h"
+
+#include "CIAO_Servant_Activator_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Array_Base.h"
+#include "tao/PortableServer/ServantActivatorC.h"
+#include "tao/LocalObject.h"
+#include "ciao/Containers/CIAO_Servant_ActivatorC.h"
+
+#include <map>
+#include <string>
+
+namespace CIAO
+{
+ class Port_Activator;
+
+ /**
+ * @class Servant_Activator
+ *
+ * @brief Activator that is registered with the POA for facet and
+ * consumer servants.
+ *
+ * This class acts like a factory in some sense. This factory is
+ * registered with the POA with RETAIN policy. When the factory gets
+ * a call back as part of the upcall, this factory looks at the
+ * list of port activators registered, uses the OID to pick the
+ * right one (yes a linear algorithm is used), calls activate () on
+ * it which returns the servant for *that* port.
+ */
+ class CIAO_SERVANT_ACTIVATOR_Export Servant_Activator_i
+ : public virtual ::CIAO::Servant_Activator,
+ public virtual ::CORBA::LocalObject
+ {
+ public:
+ Servant_Activator_i (CORBA::ORB_ptr o);
+
+ virtual ~Servant_Activator_i (void);
+
+ virtual ::CORBA::Boolean update_port_activator (
+ const ::PortableServer::ObjectId &oid);
+
+ virtual ::CORBA::Boolean register_port_activator (
+ ::CIAO::Port_Activator_ptr pa);
+
+ /// Template methods overridden to get callbacks.
+ /**
+ * If you would like to know the details of the following two
+ * methods, please PortableServer documentation. This is probably
+ * not the place to document what these mean.
+ */
+ virtual PortableServer::Servant incarnate (
+ const PortableServer::ObjectId &oid,
+ PortableServer::POA_ptr poa);
+
+ virtual void etherealize (const PortableServer::ObjectId &oid,
+ PortableServer::POA_ptr adapter,
+ PortableServer::Servant servant,
+ CORBA::Boolean cleanup_in_progress,
+ CORBA::Boolean remaining_activations);
+ /// Local helper methods
+
+ private:
+ /// Pointer to our ORB
+ CORBA::ORB_var orb_;
+
+ typedef std::map <std::string, Port_Activator_var> Port_Activators;
+
+ /// Array of port activators
+ Port_Activators pa_;
+
+ /// Running index of the slot that has been just filled in.
+ size_t slot_index_;
+
+ /// Mutex that synchronizes access to the array.
+ TAO_SYNCH_MUTEX mutex_;
+ };
+}
+
+#include /**/ "ace/post.h"
+
+#endif /*CIAO_SERVANT_ACTIVATOR_H*/
diff --git a/modules/CIAO/ciao/Containers/Session/Session_Container.cpp b/modules/CIAO/ciao/Containers/Session/Session_Container.cpp
new file mode 100644
index 00000000000..ae909f0691a
--- /dev/null
+++ b/modules/CIAO/ciao/Containers/Session/Session_Container.cpp
@@ -0,0 +1,920 @@
+// $Id$
+
+#include "Session_Container.h"
+
+#include "tao/Utils/PolicyList_Destroyer.h"
+#include "ciao/Containers/Servant_Activator.h"
+#include "ccm/ComponentServer/CCM_ComponentServer_BaseC.h"
+#include "ciao/ComponentServer/CIAO_ComponentServerC.h"
+#include "ciao/Servants/Servant_Impl_Base.h"
+#include "ciao/Logger/Log_Macros.h"
+
+#if !defined (__ACE_INLINE__)
+# include "Session_Container.inl"
+#endif /* __ACE_INLINE__ */
+
+namespace CIAO
+{
+ ///////////////////////////////////////////////////////////////
+
+ ACE_Atomic_Op <TAO_SYNCH_MUTEX, unsigned long>
+ Session_Container::serial_number_ (0);
+
+ Session_Container::Session_Container (CORBA::ORB_ptr o,
+ Deployment::CIAO_Container_i *container_impl,
+ bool static_config_flag,
+ const Static_Config_EntryPoints_Maps* maps,
+ const char *name,
+ const CORBA::PolicyList *more_policies)
+ : Container_i (o, container_impl),
+ number_ (0),
+ static_config_flag_ (static_config_flag),
+ static_entrypts_maps_ (maps),
+ sa_ (0)
+ {
+ this->init (name, more_policies);
+ }
+
+ Session_Container::~Session_Container (void)
+ {
+ if (! CORBA::is_nil (this->component_poa_.in ()))
+ {
+ this->component_poa_->destroy (1, 1);
+ }
+
+ if (! CORBA::is_nil (this->facet_cons_poa_.in ()))
+ {
+ this->facet_cons_poa_->destroy (1, 1);
+ }
+
+ if (! CORBA::is_nil (this->home_servant_poa_.in ()))
+ {
+ this->home_servant_poa_->destroy (1, 1);
+ }
+
+ // delete this->sa_;
+ }
+
+ void
+ Session_Container::init (const char *name,
+ const CORBA::PolicyList *more_policies)
+ {
+ CIAO_TRACE ("Session_Container::init");
+
+ char buffer[MAXPATHLEN];
+
+ if (name == 0)
+ {
+ this->number_ = ++Session_Container::serial_number_;
+ CIAO_DEBUG ((LM_TRACE, CLINFO "Session_Container::init - "
+ "Constructing container name from serial number %u\n",
+ this->number_));
+ ACE_OS::sprintf (buffer,
+ "CIAO::Session_Container-%ld",
+ this->number_);
+ name = buffer;
+ }
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO "Session_Container::init - "
+ "Initializing a container with name %C\n",
+ name));
+
+ CORBA::Object_var poa_object =
+ this->orb_->resolve_initial_references ("RootPOA");
+
+ if (CORBA::is_nil (poa_object.in ()))
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "CIAO::Session_Container: Unable to initialize the POA.\n"));
+ throw Components::CreateFailure ();
+ }
+
+ PortableServer::POA_var root_poa =
+ PortableServer::POA::_narrow (poa_object.in ());
+
+ this->create_component_POA (name,
+ more_policies,
+ root_poa.in ());
+
+ ACE_CString port_poa_name (name);
+ port_poa_name += ":Port_POA";
+ this->create_facet_consumer_POA (port_poa_name.c_str (),
+ more_policies,
+ root_poa.in ());
+
+ PortableServer::POAManager_var poa_manager =
+ root_poa->the_POAManager ();
+
+ poa_manager->activate ();
+ }
+
+ void
+ Session_Container::create_component_POA (const char *name,
+ const CORBA::PolicyList *p,
+ PortableServer::POA_ptr root)
+ {
+ CIAO_TRACE ("Session_Container::create_component_POA");
+
+ // 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 ();
+
+ this->component_poa_ =
+ root->create_POA (name, poa_manager.in (), policies);
+ }
+
+ void
+ Session_Container::create_facet_consumer_POA (const char *name,
+ const CORBA::PolicyList *p,
+ PortableServer::POA_ptr root)
+ {
+ CIAO_TRACE ("Session_Container::create_facet_consumer_POA");
+
+ PortableServer::POAManager_var poa_manager = root->the_POAManager ();
+ CORBA::ULong p_length = 0;
+
+ if (p != 0)
+ {
+ p_length = p->length ();
+ }
+
+ TAO::Utils::PolicyList_Destroyer policies (p_length + 3);
+ policies.length (p_length + 3);
+
+ policies[0] =
+ root->create_id_assignment_policy (PortableServer::USER_ID);
+
+ // Servant Manager Policy
+ policies[1] =
+ root->create_request_processing_policy (PortableServer::USE_SERVANT_MANAGER);
+
+ // Servant Retention Policy
+ policies[2] =
+ root->create_servant_retention_policy (PortableServer::RETAIN);
+
+ for (CORBA::ULong i = 0; i < p_length; ++i)
+ {
+ policies[i+3] = (*p)[i];
+ }
+
+ this->facet_cons_poa_ =
+ root->create_POA (name,
+ poa_manager.in (),
+ policies);
+
+ Servant_Activator_i *sa = 0;
+ ACE_NEW_THROW_EX (sa,
+ Servant_Activator_i (this->orb_.in ()),
+ CORBA::NO_MEMORY ());
+ this->sa_ = sa;
+
+ this->facet_cons_poa_->set_servant_manager (this->sa_.in ());
+ }
+
+ CORBA::Object_ptr
+ Session_Container::install_servant (PortableServer::Servant p,
+ Container_Types::OA_Type t,
+ PortableServer::ObjectId_out oid)
+ {
+ CIAO_TRACE ("Session_Container::install_servant");
+
+ PortableServer::POA_ptr tmp = PortableServer::POA::_nil();
+
+ if (t == Container_Types::COMPONENT_t ||
+ t == Container_Types::HOME_t)
+ {
+ tmp = this->component_poa_.in ();
+ }
+ else
+ {
+ tmp = this->facet_cons_poa_.in ();
+ }
+
+ PortableServer::ObjectId_var tmp_id = tmp->activate_object (p);
+
+ CORBA::Object_var objref = tmp->id_to_reference (tmp_id.in ());
+ oid = tmp_id._retn ();
+
+ return objref._retn ();
+ }
+
+ //@@ Apparently we need to be cautious when handling the exception
+ // thrown here. We should make sure that new DnC interfaces
+ // NodeApplication/NodeApplicationManager etc will cache the new
+ // exceptions--> rethrow of new exceptions is needed.
+ // --Tao
+ Components::CCMHome_ptr
+ Session_Container::install_home (const char *primary_artifact,
+ const char *entry_point,
+ const char *servant_artifact,
+ const char *servant_entrypoint,
+ const char *name)
+ {
+ CIAO_TRACE ("Session_Container::install_home");
+
+ HomeFactory hcreator = 0;
+ HomeServantFactory screator = 0;
+
+ if (!this->static_config_flag_)
+ {
+ CIAO_DEBUG ((LM_DEBUG, CLINFO
+ "Session_Container::install_home - "
+ "Loading home [%C] from shared libraries\n",
+ name));
+ CIAO_DEBUG ((LM_DEBUG, CLINFO
+ "Session_Container::install_home - "
+ "Executor library [%C] with entrypoint [%C]\n",
+ primary_artifact, entry_point));
+ CIAO_DEBUG ((LM_DEBUG, CLINFO
+ "Session_Container::install_home - "
+ "Servant library [%C] with entrypoint [%C]\n",
+ servant_artifact, servant_entrypoint));
+
+ if (primary_artifact == 0 || servant_artifact == 0)
+ {
+ ACE_CString exception;
+
+ if (primary_artifact == 0)
+ {
+ exception = "Null component executor DLL name";
+ }
+
+ if (servant_artifact == 0)
+ {
+ exception = "Null component servant DLL name";
+ }
+
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "Session_Container::install_home - "
+ "ERROR: %C\n",
+ exception.c_str ()));
+
+ throw Components::Deployment::UnknownImplId ();
+ }
+
+ ACE_DLL executor_dll;
+ ACE_DLL servant_dll;
+
+ if (executor_dll.open (ACE_TEXT_CHAR_TO_TCHAR (primary_artifact),
+ ACE_DEFAULT_SHLIB_MODE,
+ 0) != 0)
+ {
+ ACE_CString error ("Failed to open executor DLL: ");
+ error += primary_artifact;
+
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "Session_Container::install_home - "
+ "ERROR in opening the executor DLL [%C]\n",
+ primary_artifact));
+
+ throw Components::Deployment::UnknownImplId ();
+ }
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "Session_Container::install_home - "
+ "Executor DLL successfully opened\n"));
+
+ if (servant_dll.open (ACE_TEXT_CHAR_TO_TCHAR (servant_artifact),
+ ACE_DEFAULT_SHLIB_MODE,
+ 0) != 0)
+ {
+ ACE_CString error ("Failed to open executor DLL: ");
+ error += servant_artifact;
+
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "Session_Container::install_home - "
+ "ERROR in opening the servant DLL [%C]\n",
+ servant_artifact));
+
+ throw Components::Deployment::UnknownImplId ();
+ }
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "Session_Container::install_home - "
+ "Servant DLL successfully openend.\n"));
+
+ if (entry_point == 0 || servant_entrypoint == 0)
+ {
+ ACE_CString error ("Entry point is null for ");
+
+ if (entry_point == 0)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "Session_Container::install_home - "
+ "ERROR in opening the executor entry point "
+ "for executor DLL [%C]\n",
+ primary_artifact));
+ error += primary_artifact;
+ }
+ else
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "Session_Container::install_home - "
+ "ERROR in opening the servant entry point "
+ "for servant DLL [%C]\n",
+ servant_artifact));
+ error += servant_artifact;
+ }
+
+ throw Components::Deployment::ImplEntryPointNotFound ();
+ }
+
+ // We have to do this casting in two steps because the C++
+ // standard forbids casting a pointer-to-object (including
+ // void*) directly to a pointer-to-function.
+ void *void_ptr = executor_dll.symbol (ACE_TEXT_CHAR_TO_TCHAR (entry_point));
+ ptrdiff_t tmp_ptr = reinterpret_cast<ptrdiff_t> (void_ptr);
+ hcreator = reinterpret_cast<HomeFactory> (tmp_ptr);
+
+ void_ptr = servant_dll.symbol (ACE_TEXT_CHAR_TO_TCHAR (servant_entrypoint));
+ tmp_ptr = reinterpret_cast<ptrdiff_t> (void_ptr);
+ screator = reinterpret_cast<HomeServantFactory> (tmp_ptr);
+ }
+ else
+ {
+ CIAO_DEBUG ((LM_DEBUG, CLINFO
+ "Session_Container::install_home - "
+ "Loading statically linked home [%C]\n",
+ name));
+
+ if (static_entrypts_maps_ == 0
+ || static_entrypts_maps_->home_creator_funcptr_map_ == 0
+ || static_entrypts_maps_->home_servant_creator_funcptr_map_ == 0)
+ {
+ CIAO_DEBUG ((LM_ERROR, CLINFO
+ "Session_Container::install_home - ERROR: Static entrypoint "
+ "maps are null or imcomplete.\n"));
+ throw Components::Deployment::ImplEntryPointNotFound ();
+ }
+
+ ACE_CString entry_point_str (entry_point);
+ static_entrypts_maps_->home_creator_funcptr_map_->find (entry_point_str,
+ hcreator);
+
+ ACE_CString servant_entrypoint_str (servant_entrypoint);
+ static_entrypts_maps_->home_servant_creator_funcptr_map_->find (
+ servant_entrypoint_str, screator);
+ }
+
+ if (hcreator == 0 || screator == 0)
+ {
+ ACE_CString error ("Entry point ");
+
+ if (hcreator == 0)
+ {
+ error += entry_point;
+ error += " invalid in dll ";
+ error += primary_artifact;
+ }
+ else
+ {
+ error += servant_entrypoint;
+ error += " invalid in dll ";
+ error += servant_artifact;
+ }
+
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "Session_Container::install_home - Error: %C\n",
+ error.c_str ()));
+
+ throw Components::Deployment::ImplEntryPointNotFound ();
+ }
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "Session_Container::install_home - Loading home executor\n"));
+ Components::HomeExecutorBase_var home_executor = hcreator ();
+
+ if (CORBA::is_nil (home_executor.in ()))
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "Session_Container::install_home - "
+ "Home executor factory failed.\n"));
+ throw Components::Deployment::InstallationFailure ();
+ }
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "Session_Container::install_home - Loading home servant\n"));
+ PortableServer::Servant home_servant = screator (home_executor.in (),
+ this,
+ name);
+
+ if (home_servant == 0)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "Session_Container::install_home - "
+ "Home servant factory failed.\n"));
+ throw Components::Deployment::InstallationFailure ();
+ }
+
+ PortableServer::ServantBase_var safe (home_servant);
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "Session_Container::install_home - Installing home servant\n"));
+
+ PortableServer::ObjectId_var oid;
+
+ CORBA::Object_var objref =
+ this->install_servant (home_servant, Container_Types::HOME_t, oid.out ());
+
+ Components::CCMHome_var homeref =
+ Components::CCMHome::_narrow (objref.in ());
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "Session_Container::install_home - Home successfully created with name\n"));
+
+ return homeref._retn ();
+ }
+
+ Components::CCMObject_ptr
+ Session_Container::install_component (const char *primary_artifact,
+ const char *entry_point,
+ const char *servant_artifact,
+ const char *servant_entrypoint,
+ const char *name)
+ {
+ CIAO_TRACE ("Session_Container::install_component");
+
+ ComponentFactory ccreator = 0;
+ ComponentServantFactory screator = 0;
+
+ if (!this->static_config_flag_)
+ {
+ CIAO_DEBUG ((LM_DEBUG, CLINFO
+ "Session_Container::install_component - "
+ "Loading component [%C] from shared libraries\n",
+ name));
+ CIAO_DEBUG ((LM_DEBUG, CLINFO
+ "Session_Container::install_component - "
+ "Executor library [%C] with entrypoint [%C]\n",
+ primary_artifact, entry_point));
+ CIAO_DEBUG ((LM_DEBUG, CLINFO
+ "Session_Container::install_component - "
+ "Servant library [%C] with entrypoint [%C]\n",
+ servant_artifact, servant_entrypoint));
+
+ ACE_DLL executor_dll, servant_dll;
+
+ if (primary_artifact == 0 || servant_artifact == 0)
+ {
+ ACE_CString exception;
+
+ if (primary_artifact == 0)
+ {
+ exception = "Null component executor DLL name";
+ }
+
+ if (servant_artifact == 0)
+ {
+ exception = "Null component servant DLL name";
+ }
+
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "Session_Container::install_component -"
+ "ERROR: %C\n",
+ exception.c_str ()));
+
+ throw Components::Deployment::UnknownImplId ();
+ }
+
+ if (executor_dll.open (ACE_TEXT_CHAR_TO_TCHAR (primary_artifact),
+ ACE_DEFAULT_SHLIB_MODE,
+ 0) != 0)
+ {
+ ACE_CString error ("Failed to open executor DLL: ");
+ error += primary_artifact;
+
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "Session_Container::install_component - "
+ "ERROR in opening the executor DLL [%C]\n",
+ primary_artifact));
+
+ throw Components::Deployment::UnknownImplId ();
+ }
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "Session_Container::install_component - Executor DLL successfully opened\n"));
+
+ if (servant_dll.open (ACE_TEXT_CHAR_TO_TCHAR (servant_artifact),
+ ACE_DEFAULT_SHLIB_MODE,
+ 0) != 0)
+ {
+ ACE_CString error ("Failed to open executor DLL: ");
+ error += servant_artifact;
+
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "Session_Container::install_component - "
+ "ERROR in opening the servant DLL [%C]\n",
+ servant_artifact));
+
+ throw Components::Deployment::UnknownImplId ();
+ }
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "Session_Container::install_component - Servant DLL successfully openend.\n"));
+
+ if (entry_point == 0 || servant_entrypoint == 0)
+ {
+ ACE_CString error ("Entry point is null for ");
+
+ if (entry_point == 0)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "Session_Container::install_component - "
+ "ERROR in opening the executor entry point "
+ "for executor DLL [%C]\n",
+ primary_artifact));
+ error += primary_artifact;
+ }
+ else
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "Session_Container::install_component - "
+ "ERROR in opening the servant entry point "
+ "for servant DLL [%C]\n",
+ servant_artifact));
+ error += servant_artifact;
+ }
+
+ throw Components::Deployment::ImplEntryPointNotFound ();
+ }
+
+ // We have to do this casting in two steps because the C++
+ // standard forbids casting a pointer-to-object (including
+ // void*) directly to a pointer-to-function.
+ void *void_ptr = executor_dll.symbol (ACE_TEXT_CHAR_TO_TCHAR (entry_point));
+ ptrdiff_t tmp_ptr = reinterpret_cast<ptrdiff_t> (void_ptr);
+ ccreator = reinterpret_cast<ComponentFactory> (tmp_ptr);
+
+ void_ptr = servant_dll.symbol (ACE_TEXT_CHAR_TO_TCHAR (servant_entrypoint));
+ tmp_ptr = reinterpret_cast<ptrdiff_t> (void_ptr);
+ screator = reinterpret_cast<ComponentServantFactory> (tmp_ptr);
+ }
+ else
+ {
+ CIAO_DEBUG ((LM_DEBUG, CLINFO
+ "Session_Container::install_component - "
+ "Loading statically linked component [%C]\n",
+ name));
+
+ if (static_entrypts_maps_ == 0
+ || static_entrypts_maps_->component_creator_funcptr_map_ == 0
+ || static_entrypts_maps_->component_servant_creator_funcptr_map_ == 0)
+ {
+ CIAO_DEBUG ((LM_ERROR, CLINFO
+ "Session_Container::install_component - "
+ "ERROR: Static entrypoint "
+ "maps are null or imcomplete.\n"));
+ throw Components::Deployment::ImplEntryPointNotFound ();
+ }
+
+ ACE_CString entry_point_str (entry_point);
+ static_entrypts_maps_->component_creator_funcptr_map_->find (entry_point_str,
+ ccreator);
+
+ ACE_CString servant_entrypoint_str (servant_entrypoint);
+ static_entrypts_maps_->component_servant_creator_funcptr_map_->find (servant_entrypoint_str,
+ screator);
+ }
+
+ if (ccreator == 0 || screator == 0)
+ {
+ ACE_CString error ("Entry point ");
+
+ if (ccreator == 0)
+ {
+ error += entry_point;
+ error += " invalid in dll ";
+ error += primary_artifact;
+ }
+ else
+ {
+ error += servant_entrypoint;
+ error += " invalid in dll ";
+ error += servant_artifact;
+ }
+
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "Session_Container::install_component - Error: %C\n",
+ error.c_str ()));
+
+ throw Components::Deployment::ImplEntryPointNotFound ();
+ }
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "Session_Container::install_component - "
+ "Loading component executor\n"));
+ Components::EnterpriseComponent_var component_executor = ccreator ();
+
+ if (CORBA::is_nil (component_executor.in ()))
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "Session_Container::install_component - "
+ "Component executor factory failed.\n"));
+ throw Components::Deployment::InstallationFailure ();
+ }
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "Session_Container::install_component - "
+ "Loading component servant\n"));
+ PortableServer::Servant component_servant = screator (component_executor.in (),
+ this,
+ name);
+
+ if (component_servant == 0)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "Session_Container::install_component - "
+ "Component servant factory failed.\n"));
+ throw Components::Deployment::InstallationFailure ();
+ }
+
+ PortableServer::ServantBase_var safe (component_servant);
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "Session_Container::install_component - "
+ "Installing component servant\n"));
+
+ PortableServer::ObjectId_var oid;
+
+ CORBA::Object_var objref =
+ this->install_servant (component_servant, Container_Types::COMPONENT_t, oid.out ());
+
+ Components::CCMObject_var componentref =
+ Components::CCMObject::_narrow (objref.in ());
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "Session_Container::install_component - "
+ "Component successfully created\n"));
+
+ return componentref._retn ();
+ }
+
+ void
+ Session_Container::activate_component (Components::CCMObject_ptr compref)
+ {
+ CIAO_TRACE("Session_Container::activate_component");
+
+ try
+ {
+
+ PortableServer::Servant svt;
+
+ try
+ {
+ svt = this->component_poa_->reference_to_servant (compref);
+ }
+ catch (...)
+ {
+ throw InvalidComponent ();
+ }
+
+ CIAO::Servant_Impl_Base *sess = dynamic_cast<CIAO::Servant_Impl_Base *> (svt);
+
+ if (sess == 0)
+ throw CIAO::InvalidComponent ();
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO "Session_Container::activate_component - "
+ "Invoking CCM activate on provided component object reference.\n"));
+ sess->activate_component ();
+ }
+ catch (const CIAO::InvalidComponent &)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "Session_Container::activate_component - "
+ "Failed to retrieve servant and/or cast to servant pointer.\n"));
+ throw;
+ }
+ catch (const CORBA::Exception &ex)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "Session_Container::activate_component - "
+ "Caught CORBA exception while activating a component: %C\n",
+ ex._info ().c_str ()));
+ throw;
+ }
+ catch (...)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "Session_Container::activate_component - "
+ "Caught unknown C++ eception while activating a component.\n"));
+ throw;
+ }
+ }
+
+ void
+ Session_Container::passivate_component (Components::CCMObject_ptr compref)
+ {
+ CIAO_TRACE ("Session_Container::passivate_component");
+
+ try
+ {
+ PortableServer::Servant svt;
+
+ try
+ {
+ svt = this->component_poa_->reference_to_servant (compref);
+ }
+ catch (...)
+ {
+ throw InvalidComponent ();
+ }
+
+ CIAO::Servant_Impl_Base *sess = dynamic_cast<CIAO::Servant_Impl_Base *> (svt);
+
+ if (sess == 0)
+ throw CIAO::InvalidComponent ();
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO "Session_Container::passivate_component - "
+ "Invoking CCM activate on provided component object reference.\n"));
+ sess->passivate_component ();
+ }
+ catch (const CIAO::InvalidComponent &)
+ {
+ throw;
+ }
+ catch (const CORBA::Exception &ex)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "Session_Container::passivate_component - "
+ "Caught CORBA exception while passivating a component: %C\n",
+ ex._info ().c_str ()));
+ throw;
+ }
+ catch (...)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "Session_Container::passivate_component - "
+ "Caught unknown C++ eception while passivating a component.\n"));
+ throw;
+ }
+ }
+
+ void
+ Session_Container::uninstall (CORBA::Object_ptr objref, Container_Types::OA_Type y)
+ {
+ CIAO_TRACE ("Session_Container::uninstall");
+
+ PortableServer::Servant svnt;
+
+ switch (y)
+ {
+ case Container_Types::COMPONENT_t:
+ case Container_Types::HOME_t:
+ svnt = this->component_poa_->reference_to_servant (objref);
+ break;
+ default:
+ svnt = this->facet_cons_poa_->reference_to_servant (objref);
+ break;
+ }
+
+ PortableServer::ObjectId_var oid;
+ this->uninstall_servant (svnt, y, oid.out ());
+ }
+
+ void
+ Session_Container::uninstall_home (Components::CCMHome_ptr homeref)
+ {
+ CIAO_TRACE ("Session_Container::uninstall_home");
+
+ this->uninstall (homeref, Container_Types::HOME_t);
+ }
+
+ void
+ Session_Container::uninstall_component (Components::CCMObject_ptr homeref)
+ {
+ CIAO_TRACE ("Session_Container::uninstall_component");
+
+ PortableServer::Servant svnt = this->component_poa_->reference_to_servant (homeref);
+
+ if (svnt == 0)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "Session_Container::uninstall_component - "
+ "Unable to convert provided CCMObject reference to Servant."));
+ throw ::Components::RemoveFailure ();
+ }
+
+ CIAO::Servant_Impl_Base * svt = dynamic_cast < CIAO::Servant_Impl_Base * > (svnt);
+
+ if (svt == 0)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "Session_Container::uninstall_component - "
+ "Unable to convert provided servant reference to servant implementation."));
+ throw ::Components::RemoveFailure ();
+ }
+
+ svt->remove ();
+
+ //this->uninstall (homeref, Container_Types::COMPONENT_t);
+ }
+
+ void
+ Session_Container::uninstall_servant (PortableServer::Servant svnt,
+ Container_Types::OA_Type t,
+ PortableServer::ObjectId_out oid)
+ {
+ CIAO_TRACE ("Session_Container::uninstall_servant");
+
+ PortableServer::POA_ptr tmp = PortableServer::POA::_nil();
+
+ if ((t == Container_Types::COMPONENT_t) ||
+ (t == Container_Types::HOME_t))
+ {
+ CIAO_DEBUG ((LM_TRACE, CLINFO "Session_Container::uninstall_servant - "
+ "Removing component or home servant\n"));
+ tmp = this->component_poa_.in ();
+ }
+ else
+ {
+ CIAO_DEBUG ((LM_TRACE, CLINFO "Session_Container::uninstall_servant - "
+ "Removing facet or consumer servant\n"));
+ tmp = this->facet_cons_poa_.in ();
+ }
+
+ try
+ {
+ PortableServer::ObjectId_var tmp_id;
+ tmp_id = tmp->servant_to_id (svnt);
+ tmp->deactivate_object (tmp_id);
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO "Session_Container::uninstall_servant - "
+ "Servant successfully removed, reference count is %u\n",
+ svnt->_refcount_value () - 1));
+
+ svnt->_remove_ref ();
+
+ oid = tmp_id._retn ();
+ }
+ catch (const CORBA::Exception &ex)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "Session_Container::uninstall_servant - "
+ "Caught CORBA exception while uninstalling servant: %C\n",
+ ex._info ().c_str ()));
+ throw Components::RemoveFailure ();
+ }
+
+ }
+
+ void
+ Session_Container::add_servant_to_map (PortableServer::ObjectId &,
+ Dynamic_Component_Servant_Base*)
+ {
+ CIAO_TRACE ("Session_Container::add_servant_to_map");
+ throw CORBA::NO_IMPLEMENT ();
+ }
+
+ void
+ Session_Container::delete_servant_from_map (PortableServer::ObjectId &)
+ {
+ CIAO_TRACE ("Session_Container::delete_servant_from_map");
+ throw CORBA::NO_IMPLEMENT ();
+ }
+
+ void
+ Session_Container::deactivate_facet (const PortableServer::ObjectId &)
+ {
+ CIAO_TRACE ("Session_Container::deactivate_facet");
+ }
+
+ CORBA::Object_ptr
+ Session_Container::get_home_objref (PortableServer::Servant)
+ {
+ CIAO_TRACE ("Session_Container::get_home_objref");
+ throw CORBA::NO_IMPLEMENT ();
+ }
+
+ CORBA::Object_ptr
+ Session_Container::generate_reference (const char *obj_id,
+ const char *repo_id,
+ Container_Types::OA_Type t)
+ {
+ CIAO_TRACE ("Session_Container::generate_reference");
+
+ PortableServer::POA_ptr tmp = PortableServer::POA::_nil();
+
+ if (t == Container_Types::COMPONENT_t ||
+ t == Container_Types::HOME_t)
+ {
+ tmp = this->component_poa_.in ();
+ }
+ else
+ {
+ tmp = this->facet_cons_poa_.in ();
+ }
+
+ PortableServer::ObjectId_var oid =
+ PortableServer::string_to_ObjectId (obj_id);
+
+ CORBA::String_var str = PortableServer::ObjectId_to_string (oid.in ());
+
+ CORBA::Object_var objref =
+ tmp->create_reference_with_id (oid.in (), repo_id);
+
+ return objref._retn ();
+ }
+}
diff --git a/modules/CIAO/ciao/Containers/Session/Session_Container.h b/modules/CIAO/ciao/Containers/Session/Session_Container.h
new file mode 100644
index 00000000000..75a4d5bb00a
--- /dev/null
+++ b/modules/CIAO/ciao/Containers/Session/Session_Container.h
@@ -0,0 +1,231 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Session_Container.h
+ *
+ * $Id$
+ *
+ * Header file for CIAO's container implementations
+ *
+ * @author Nanbor Wang <nanbor@cs.wustl.edu>
+ * @author Gan Deng <dengg@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef CIAO_SESSION_CONTAINER_H
+#define CIAO_SESSION_CONTAINER_H
+
+#include /**/ "ace/pre.h"
+
+#include "ciao/Containers/Session/Session_Container_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/Servant_Base.h"
+#include "ciao/Containers/Container_Base.h"
+
+namespace CIAO
+{
+ class Session_Container;
+ class Servant_Activator;
+ class Home_Servant_Impl_Base;
+
+ namespace Deployment
+ {
+ class CIAO_Container_i;
+ }
+
+ typedef ::Components::HomeExecutorBase_ptr (*HomeFactory) (void);
+ typedef ::PortableServer::Servant (*HomeServantFactory) (::Components::HomeExecutorBase_ptr p,
+ ::CIAO::Container_ptr c,
+ const char *ins_name);
+ typedef ::Components::EnterpriseComponent_ptr (*ComponentFactory) (void);
+ typedef ::PortableServer::Servant (*ComponentServantFactory) (::Components::EnterpriseComponent_ptr,
+ ::CIAO::Container_ptr,
+ const char *);
+
+ typedef ACE_Hash_Map_Manager_Ex<ACE_CString,
+ HomeFactory,
+ ACE_Hash<ACE_CString>,
+ ACE_Equal_To<ACE_CString>,
+ ACE_Null_Mutex>
+ HOMECREATOR_FUNCPTR_MAP;
+
+ typedef ACE_Hash_Map_Manager_Ex<ACE_CString,
+ HomeServantFactory,
+ ACE_Hash<ACE_CString>,
+ ACE_Equal_To<ACE_CString>,
+ ACE_Null_Mutex>
+ HOMESERVANTCREATOR_FUNCPTR_MAP;
+
+ typedef ACE_Hash_Map_Manager_Ex<ACE_CString,
+ ComponentFactory,
+ ACE_Hash<ACE_CString>,
+ ACE_Equal_To<ACE_CString>,
+ ACE_Null_Mutex>
+ COMPONENTCREATOR_FUNCPTR_MAP;
+
+ typedef ACE_Hash_Map_Manager_Ex<ACE_CString,
+ ComponentServantFactory,
+ ACE_Hash<ACE_CString>,
+ ACE_Equal_To<ACE_CString>,
+ ACE_Null_Mutex>
+ COMPONENTSERVANTCREATOR_FUNCPTR_MAP;
+
+
+ struct SESSION_CONTAINER_Export Static_Config_EntryPoints_Maps
+ {
+ /// Map of home creator entry point name and func ptr
+ HOMECREATOR_FUNCPTR_MAP* home_creator_funcptr_map_;
+
+ /// Map of home servant creator entry point name and func ptr
+ HOMESERVANTCREATOR_FUNCPTR_MAP* home_servant_creator_funcptr_map_;
+
+ /// Map of home creator entry point name and func ptr
+ COMPONENTCREATOR_FUNCPTR_MAP* component_creator_funcptr_map_;
+
+ /// Map of home servant creator entry point name and func ptr
+ COMPONENTSERVANTCREATOR_FUNCPTR_MAP* component_servant_creator_funcptr_map_;
+ };
+
+ class SESSION_CONTAINER_Export Session_Container : public Container_i
+ {
+ public:
+ Session_Container (CORBA::ORB_ptr o,
+ Deployment::CIAO_Container_i *container_impl,
+ bool static_config_flag = false,
+ const Static_Config_EntryPoints_Maps* static_entrypts_maps =0,
+ const char *name = 0,
+ const CORBA::PolicyList *more_policies = 0);
+
+ virtual ~Session_Container (void);
+
+ /**
+ * @brief Simply installing a home executor into the component.
+ *
+ * This operation install a home executor into the component. It
+ * requires the name of the DLLs to executor and the servant glue
+ * code, and the entry points to the respective DLLs. Currently,
+ * we don't try to manage the lifetime of DLL objects, but we
+ * should at some later point.
+ *
+ * @retval Home objref of the installed home.
+ */
+ /// Install a new home
+ virtual Components::CCMHome_ptr install_home (const char *primary_artifact,
+ const char *entry_point,
+ const char *servant_artifact,
+ const char *servant_entrypoint,
+ const char *name);
+
+ virtual void uninstall_home (Components::CCMHome_ptr homeref);
+
+ virtual Components::CCMObject_ptr install_component (const char *primary_artifact,
+ const char *entry_point,
+ const char *servant_artifact,
+ const char *servant_entrypoint,
+ const char *name);
+
+ /// Activate component
+ virtual void activate_component (Components::CCMObject_ptr compref);
+
+ virtual void passivate_component (Components::CCMObject_ptr compref);
+
+ virtual void uninstall_component (Components::CCMObject_ptr compref);
+
+ /// Uninstall a servant
+ virtual void uninstall_servant (PortableServer::Servant objref,
+ Container_Types::OA_Type type,
+ PortableServer::ObjectId_out oid);
+
+ /// Install a servant for component or home.
+ virtual CORBA::Object_ptr install_servant (PortableServer::Servant p,
+ Container_Types::OA_Type type,
+ PortableServer::ObjectId_out oid);
+
+ /// Get an object reference to a component or home from the servant.
+ virtual CORBA::Object_ptr get_objref (PortableServer::Servant p);
+
+ /// Uninstall a servant for component or home.
+ void uninstall (CORBA::Object_ptr objref, Container_Types::OA_Type t);
+
+ /// Uninstall a servant for component or home.
+ void uninstall (PortableServer::Servant svt, Container_Types::OA_Type t);
+
+ virtual void add_servant_to_map (PortableServer::ObjectId &oid,
+ Dynamic_Component_Servant_Base* servant);
+
+ virtual void delete_servant_from_map (PortableServer::ObjectId &oid);
+
+ // @@Jai, could yo please add documentation?
+ /*
+ * @@Jai, you may want to consider moving these away from the
+ * container interface. I know what you are going to say
+ * :-). Consider using dynamic_cast <> to access
+ * add_servant_to_map, delete_servant_from_map and
+ * deactivate_facet from the Swapping_Conatiner's interface. It
+ * would make the base container interface much cleaner.
+ */
+ virtual void deactivate_facet (const PortableServer::ObjectId &oid);
+
+ virtual CORBA::Object_ptr get_home_objref (PortableServer::Servant p);
+
+ /// 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,
+ Container_Types::OA_Type t);
+
+ /// Return the servant activator factory that activates the
+ /// servants for facets and consumers.
+ ::CIAO::Servant_Activator_ptr ports_servant_activator (void);
+
+ private:
+
+ /// Initialize the container with a name.
+ virtual void init (const char *name = 0,
+ const CORBA::PolicyList *more_policies = 0);
+
+ /// 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);
+
+ /// Create POA for the facets and consumers alone.
+ void create_facet_consumer_POA (const char *name,
+ const CORBA::PolicyList *p,
+ PortableServer::POA_ptr root);
+
+ /// Not allowed to be
+ Session_Container (void);
+
+ protected:
+ unsigned long number_;
+
+ /// Static variable to store the highest number we have given out until
+ /// now
+ static ACE_Atomic_Op <TAO_SYNCH_MUTEX, unsigned long> serial_number_;
+
+ const 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_var sa_;
+ };
+}
+
+#if defined (__ACE_INLINE__)
+# include "Session_Container.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* CIAO_SESSION_CONTAINER_H */
diff --git a/modules/CIAO/ciao/Containers/Session/Session_Container.idl b/modules/CIAO/ciao/Containers/Session/Session_Container.idl
new file mode 100644
index 00000000000..65021db65c8
--- /dev/null
+++ b/modules/CIAO/ciao/Containers/Session/Session_Container.idl
@@ -0,0 +1,15 @@
+/**
+ * @file Session_Container.idl
+ * @author William R. Otte <wotte@dre.vanderbilt.edu>
+ * $Id$
+ * Extends the basic container interface for session capabilities.
+ */
+
+#include "ciao/Containers/Container_Base.idl"
+
+module CIAO
+{
+ local interface Session_Container : Container
+ {
+ };
+};
diff --git a/modules/CIAO/ciao/Containers/Session/Session_Container.inl b/modules/CIAO/ciao/Containers/Session/Session_Container.inl
new file mode 100644
index 00000000000..03461c07ac6
--- /dev/null
+++ b/modules/CIAO/ciao/Containers/Session/Session_Container.inl
@@ -0,0 +1,13 @@
+// $Id$ -*- C++ -*-
+
+ACE_INLINE CORBA::Object_ptr
+CIAO::Session_Container::get_objref (PortableServer::Servant p)
+{
+ return this->the_POA ()->servant_to_reference (p);
+}
+
+ACE_INLINE CIAO::Servant_Activator_ptr
+CIAO::Session_Container::ports_servant_activator (void)
+{
+ return Servant_Activator::_duplicate(this->sa_.in ());
+}
diff --git a/modules/CIAO/ciao/Containers/Session/Session_Container.mpc b/modules/CIAO/ciao/Containers/Session/Session_Container.mpc
new file mode 100644
index 00000000000..261a5eb0e45
--- /dev/null
+++ b/modules/CIAO/ciao/Containers/Session/Session_Container.mpc
@@ -0,0 +1,30 @@
+// -*- MPC -*-
+// $Id$
+
+project(CIAO_Session_Container_idl) : ciaoidldefaults {
+ custom_only = 1
+ idlflags += -Wb,export_include=Session_Container_export.h \
+ -Wb,export_macro=SESSION_CONTAINER_Export \
+ -Gxhst -SS -Sci
+ IDL_Files {
+ Session_Container.idl
+ }
+}
+
+project(CIAO_Session_Container) : ccm_svnt, ciao_lib, ciao_container_base, utils, \
+ ccm_componentserver_stub, ciao_servant_activator, ciao_servant {
+ after += CIAO_Session_Container_idl
+ dynamicflags += SESSION_CONTAINER_BUILD_DLL
+
+ IDL_Files {
+ }
+ Source_Files {
+ Session_Container.cpp
+ }
+ Inline_Files {
+ Session_Container.inl
+ }
+ Header_Files {
+ Session_Container.h
+ }
+}
diff --git a/modules/CIAO/ciao/Contexts/Context.mpc b/modules/CIAO/ciao/Contexts/Context.mpc
new file mode 100644
index 00000000000..955521cfa3b
--- /dev/null
+++ b/modules/CIAO/ciao/Contexts/Context.mpc
@@ -0,0 +1,16 @@
+//$Id$
+project(CIAO_Context_Impl) : ccm_svnt, ciao_container_base, portableserver, ciao_output {
+ dynamicflags = CONTEXT_IMPL_BUILD_DLL
+ Source_Files {
+ Context_Impl_Base.cpp
+ Context_Impl_T.cpp
+ }
+ Header_Files {
+ Context_Impl_Base.h
+ Context_Impl_T.h
+ Context_Impl_export.h
+ }
+ Inline_Files {
+ Context_Impl_Base.inl
+ }
+}
diff --git a/modules/CIAO/ciao/Contexts/Context_Impl_Base.cpp b/modules/CIAO/ciao/Contexts/Context_Impl_Base.cpp
new file mode 100644
index 00000000000..d695b58025a
--- /dev/null
+++ b/modules/CIAO/ciao/Contexts/Context_Impl_Base.cpp
@@ -0,0 +1,76 @@
+// $Id$
+
+#include "Context_Impl_Base.h"
+
+#if !defined (__ACE_INLINE__)
+# include "Context_Impl_Base.inl"
+#endif /* __ACE_INLINE__ */
+
+#include "ciao/Containers/Container_BaseC.h"
+
+namespace CIAO
+{
+ Context_Impl_Base::Context_Impl_Base (void)
+ {
+ // This constructor is here to keep MSVC happy and should
+ // not be used at all. This constructor should be removed
+ // in the future. Until then, we have the ACE_ASSERT
+ // below to detect a runtime call to this constructor.
+ ACE_ASSERT (0);
+ }
+
+ Context_Impl_Base::Context_Impl_Base (Components::CCMHome_ptr home,
+ Container_ptr c)
+ : home_ (Components::CCMHome::_duplicate (home)),
+ container_ (Container::_duplicate (c))
+ {
+ }
+
+ Context_Impl_Base::~Context_Impl_Base (void)
+ {
+ }
+
+ // Operations from ::Components::CCMContext.
+
+ Components::Principal_ptr
+ Context_Impl_Base::get_caller_principal (void)
+ {
+ throw CORBA::NO_IMPLEMENT ();
+ }
+
+ Components::CCMHome_ptr
+ Context_Impl_Base::get_CCM_home (void)
+ {
+ return Components::CCMHome::_duplicate (this->home_.in ());
+ }
+
+ CORBA::Boolean
+ Context_Impl_Base::get_rollback_only (void)
+ {
+ throw CORBA::NO_IMPLEMENT ();
+ }
+
+ Components::Transaction::UserTransaction_ptr
+ Context_Impl_Base::get_user_transaction (void)
+ {
+ throw CORBA::NO_IMPLEMENT ();
+ }
+
+ CORBA::Boolean
+ Context_Impl_Base::is_caller_in_role (const char * /* role */)
+ {
+ throw CORBA::NO_IMPLEMENT ();
+ }
+
+ void
+ Context_Impl_Base::set_rollback_only (void)
+ {
+ throw CORBA::NO_IMPLEMENT ();
+ }
+
+ CORBA::Object_ptr
+ Context_Impl_Base::resolve_service_reference(const char *)
+ {
+ throw CORBA::NO_IMPLEMENT ();
+ }
+}
diff --git a/modules/CIAO/ciao/Contexts/Context_Impl_Base.h b/modules/CIAO/ciao/Contexts/Context_Impl_Base.h
new file mode 100644
index 00000000000..4cb9954f061
--- /dev/null
+++ b/modules/CIAO/ciao/Contexts/Context_Impl_Base.h
@@ -0,0 +1,105 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Context_Impl_Base.h
+ *
+ * $Id$
+ *
+ * This file contains the non-template declaration of a base class for
+ * the template mixin for the generated context class.
+ *
+ * @author Jeff Parsons <j.parsons@vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef CIAO_CONTEXT_IMPL_BASE_H
+#define CIAO_CONTEXT_IMPL_BASE_H
+
+#include /**/ "ace/pre.h"
+
+#include "Context_Impl_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ccm/CCM_ContextC.h"
+
+namespace Components
+{
+ class CCMHome;
+ typedef CCMHome *CCMHome_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ CCMHome
+ >
+ CCMHome_var;
+}
+
+namespace CIAO
+{
+ class Container;
+ typedef Container *Container_ptr;
+ typedef TAO_Objref_Var_T<Container> Container_var;
+
+ /**
+ * @class Context_Impl_Base
+ *
+ * @brief Non-template base class for Context_Impl.
+ *
+ * Holds the non-template parts of its child class
+ * Context_Impl.
+ */
+ class Context_Impl_Export Context_Impl_Base
+ : public virtual Components::CCMContext
+ {
+ public:
+ /// @todo This constructor should be declarated private but it seems
+ /// the compilers want it, have to sort this out in detail.
+ Context_Impl_Base (void);
+
+ Context_Impl_Base (Components::CCMHome_ptr home, Container_ptr c);
+
+ virtual ~Context_Impl_Base (void);
+
+ // Operations from ::Components::CCMContext.
+
+ virtual Components::Principal_ptr get_caller_principal ();
+
+ virtual Components::CCMHome_ptr get_CCM_home ();
+
+ virtual CORBA::Boolean get_rollback_only ();
+
+ virtual Components::Transaction::UserTransaction_ptr get_user_transaction ();
+
+ virtual CORBA::Boolean is_caller_in_role (const char *role);
+
+ virtual void set_rollback_only ();
+
+ virtual CORBA::Object_ptr resolve_service_reference(const char *service_id);
+
+ /// CIAO-specific.
+ CIAO::Container_ptr _ciao_the_Container (void) const;
+
+ /// Accessors for the private member.
+ const char *_ciao_instance_id (void) const;
+ void _ciao_instance_id (const char *instance_id);
+
+ protected:
+ Components::CCMHome_var home_;
+ Container_var container_;
+
+ private:
+ CORBA::String_var ciao_instance_id_;
+ };
+}
+
+#if defined (__ACE_INLINE__)
+# include "Context_Impl_Base.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* CIAO_CONTEXT_IMPL_BASE_H */
diff --git a/modules/CIAO/ciao/Contexts/Context_Impl_Base.inl b/modules/CIAO/ciao/Contexts/Context_Impl_Base.inl
new file mode 100644
index 00000000000..7365d9c0b48
--- /dev/null
+++ b/modules/CIAO/ciao/Contexts/Context_Impl_Base.inl
@@ -0,0 +1,24 @@
+// $Id$
+
+namespace CIAO
+{
+ // CIAO-specific.
+
+ ACE_INLINE CIAO::Container_ptr
+ Context_Impl_Base::_ciao_the_Container (void) const
+ {
+ return this->container_;
+ }
+
+ ACE_INLINE const char *
+ Context_Impl_Base::_ciao_instance_id (void) const
+ {
+ return this->ciao_instance_id_.in ();
+ }
+
+ ACE_INLINE void
+ Context_Impl_Base::_ciao_instance_id (const char *instance_id)
+ {
+ this->ciao_instance_id_ = instance_id;
+ }
+}
diff --git a/modules/CIAO/ciao/Contexts/Context_Impl_T.cpp b/modules/CIAO/ciao/Contexts/Context_Impl_T.cpp
new file mode 100644
index 00000000000..f3afa79af0e
--- /dev/null
+++ b/modules/CIAO/ciao/Contexts/Context_Impl_T.cpp
@@ -0,0 +1,63 @@
+// $Id$
+
+#ifndef CIAO_CONTEXT_IMPL_T_C
+#define CIAO_CONTEXT_IMPL_T_C
+
+#include "Context_Impl_T.h"
+
+namespace CIAO
+{
+ template <typename BASE_CTX,
+ typename SVNT,
+ typename COMP>
+ Context_Impl<BASE_CTX, SVNT, COMP>::Context_Impl (
+ Components::CCMHome_ptr the_home,
+ Container_ptr c,
+ SVNT *sv)
+ : Context_Impl_Base (the_home, c),
+ servant_ (sv)
+ {
+ }
+
+ template <typename BASE_CTX,
+ typename SVNT,
+ typename COMP>
+ Context_Impl<BASE_CTX, SVNT, COMP>::~Context_Impl (void)
+ {
+ }
+
+ // Operations from ::Components::SessionContext.
+
+ template <typename BASE_CTX,
+ typename SVNT,
+ typename COMP>
+ CORBA::Object_ptr
+ Context_Impl<BASE_CTX, SVNT, COMP>::get_CCM_object (void)
+ {
+ if (CORBA::is_nil (this->component_.in ()))
+ {
+ CORBA::Object_var obj;
+
+ try
+ {
+ obj = this->container_->get_objref (this->servant_);
+ }
+ catch (const CORBA::Exception& ex)
+ {
+ ex._tao_print_exception ("Caught Exception\n");
+ return CORBA::Object::_nil ();
+ }
+
+ this->component_ = COMP::_narrow (obj.in ());
+
+ if (CORBA::is_nil (this->component_.in ()))
+ {
+ throw CORBA::INTERNAL ();
+ }
+ }
+
+ return COMP::_duplicate (this->component_.in ());
+ }
+}
+
+#endif /* CIAO_CONTEXT_IMPL_T_C */
diff --git a/modules/CIAO/ciao/Contexts/Context_Impl_T.h b/modules/CIAO/ciao/Contexts/Context_Impl_T.h
new file mode 100644
index 00000000000..284251771cd
--- /dev/null
+++ b/modules/CIAO/ciao/Contexts/Context_Impl_T.h
@@ -0,0 +1,114 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Context_Impl_T.h
+ *
+ * $Id$
+ *
+ * This file contains the declaration of a mixin base class for
+ * the generated context class.
+ *
+ * @author Jeff Parsons <j.parsons@vanderbilt.edu>
+ */
+//=============================================================================
+
+
+#ifndef CIAO_CONTEXT_IMPL_T_H
+#define CIAO_CONTEXT_IMPL_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "Context_Impl_Base.h"
+#include "tao/LocalObject.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+namespace CORBA
+{
+ class SystemException;
+}
+
+namespace SecurityLevel2
+{
+ class Credentials;
+}
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+namespace Components
+{
+ typedef SecurityLevel2::Credentials Principal;
+ typedef Principal *Principal_ptr;
+
+ class IllegalState;
+
+ namespace Transaction
+ {
+ class UserTransaction;
+ typedef UserTransaction *UserTransaction_ptr;
+ }
+}
+
+namespace CIAO
+{
+ class Container;
+ typedef Container *Container_ptr;
+
+ /**
+ * @class Context_Impl
+ *
+ * @brief Mixin base class for generated context.
+ *
+ * This class implements operations and contains parameterized
+ * members common to all generated servants.
+ */
+ template <typename BASE_CTX,
+ typename SVNT,
+ typename COMP>
+ class Context_Impl : public virtual BASE_CTX,
+ public virtual Context_Impl_Base,
+ public virtual ::CORBA::LocalObject
+ {
+ public:
+ /// Type definition of the context type.
+ typedef BASE_CTX context_type;
+
+ /// Type definition of the var type for the context.
+ typedef typename context_type::_var_type _var_type;
+
+ /// Type definition of the servant type.
+ typedef SVNT servant_type;
+
+ /// Type definition of the component type.
+ typedef COMP component_type;
+
+ Context_Impl (Components::CCMHome_ptr the_home,
+ Container_ptr c,
+ SVNT *sv);
+
+ virtual ~Context_Impl (void);
+
+ // Operations from ::Components::SessionContext.
+
+ virtual CORBA::Object_ptr get_CCM_object ();
+
+ protected:
+ SVNT *servant_;
+ typename COMP::_var_type component_;
+ };
+}
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "Context_Impl_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Context_Impl_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* CIAO_CONTEXT_IMPL_T_H */
diff --git a/modules/CIAO/ciao/Contexts/Context_Impl_export.h b/modules/CIAO/ciao/Contexts/Context_Impl_export.h
new file mode 100644
index 00000000000..644dbfc00bb
--- /dev/null
+++ b/modules/CIAO/ciao/Contexts/Context_Impl_export.h
@@ -0,0 +1,58 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl Context_Impl
+// ------------------------------
+#ifndef CONTEXT_IMPL_EXPORT_H
+#define CONTEXT_IMPL_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS) && !defined (CONTEXT_IMPL_HAS_DLL)
+# define CONTEXT_IMPL_HAS_DLL 0
+#endif /* ACE_AS_STATIC_LIBS && CONTEXT_IMPL_HAS_DLL */
+
+#if !defined (CONTEXT_IMPL_HAS_DLL)
+# define CONTEXT_IMPL_HAS_DLL 1
+#endif /* ! CONTEXT_IMPL_HAS_DLL */
+
+#if defined (CONTEXT_IMPL_HAS_DLL) && (CONTEXT_IMPL_HAS_DLL == 1)
+# if defined (CONTEXT_IMPL_BUILD_DLL)
+# define Context_Impl_Export ACE_Proper_Export_Flag
+# define CONTEXT_IMPL_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define CONTEXT_IMPL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* CONTEXT_IMPL_BUILD_DLL */
+# define Context_Impl_Export ACE_Proper_Import_Flag
+# define CONTEXT_IMPL_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define CONTEXT_IMPL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* CONTEXT_IMPL_BUILD_DLL */
+#else /* CONTEXT_IMPL_HAS_DLL == 1 */
+# define Context_Impl_Export
+# define CONTEXT_IMPL_SINGLETON_DECLARATION(T)
+# define CONTEXT_IMPL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* CONTEXT_IMPL_HAS_DLL == 1 */
+
+// Set CONTEXT_IMPL_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (CONTEXT_IMPL_NTRACE)
+# if (ACE_NTRACE == 1)
+# define CONTEXT_IMPL_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define CONTEXT_IMPL_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !CONTEXT_IMPL_NTRACE */
+
+#if (CONTEXT_IMPL_NTRACE == 1)
+# define CONTEXT_IMPL_TRACE(X)
+#else /* (CONTEXT_IMPL_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define CONTEXT_IMPL_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (CONTEXT_IMPL_NTRACE == 1) */
+
+#endif /* CONTEXT_IMPL_EXPORT_H */
+
+// End of auto generated file.
diff --git a/modules/CIAO/ciao/Logger/CIAOLoggerFactory.h b/modules/CIAO/ciao/Logger/CIAOLoggerFactory.h
new file mode 100644
index 00000000000..3abee97aaf1
--- /dev/null
+++ b/modules/CIAO/ciao/Logger/CIAOLoggerFactory.h
@@ -0,0 +1,19 @@
+// $Id$
+#ifndef LOGGERFACTORY_H_
+#define LOGGERFACTORY_H_
+
+#include "ace/Service_Object.h"
+#include "tao/ORB.h"
+#include "ace/Log_Msg_Backend.h"
+
+namespace CIAO
+ {
+
+ class CIAOLoggerFactory : public ACE_Service_Object
+ {
+ public:
+ virtual ACE_Log_Msg_Backend * get_logger_backend (CORBA::ORB_ptr orb) = 0;
+ };
+} // CIAO
+
+#endif /*LOGGERFACTORY_H_*/
diff --git a/modules/CIAO/ciao/Logger/CIAO_Logger_Export.h b/modules/CIAO/ciao/Logger/CIAO_Logger_Export.h
new file mode 100644
index 00000000000..b1760b426f9
--- /dev/null
+++ b/modules/CIAO/ciao/Logger/CIAO_Logger_Export.h
@@ -0,0 +1,58 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl CIAO_Logger
+// ------------------------------
+#ifndef CIAO_LOGGER_EXPORT_H
+#define CIAO_LOGGER_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS) && !defined (CIAO_LOGGER_HAS_DLL)
+# define CIAO_LOGGER_HAS_DLL 0
+#endif /* ACE_AS_STATIC_LIBS && CIAO_LOGGER_HAS_DLL */
+
+#if !defined (CIAO_LOGGER_HAS_DLL)
+# define CIAO_LOGGER_HAS_DLL 1
+#endif /* ! CIAO_LOGGER_HAS_DLL */
+
+#if defined (CIAO_LOGGER_HAS_DLL) && (CIAO_LOGGER_HAS_DLL == 1)
+# if defined (CIAO_LOGGER_BUILD_DLL)
+# define CIAO_Logger_Export ACE_Proper_Export_Flag
+# define CIAO_LOGGER_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define CIAO_LOGGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* CIAO_LOGGER_BUILD_DLL */
+# define CIAO_Logger_Export ACE_Proper_Import_Flag
+# define CIAO_LOGGER_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define CIAO_LOGGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* CIAO_LOGGER_BUILD_DLL */
+#else /* CIAO_LOGGER_HAS_DLL == 1 */
+# define CIAO_Logger_Export
+# define CIAO_LOGGER_SINGLETON_DECLARATION(T)
+# define CIAO_LOGGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* CIAO_LOGGER_HAS_DLL == 1 */
+
+// Set CIAO_LOGGER_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (CIAO_LOGGER_NTRACE)
+# if (ACE_NTRACE == 1)
+# define CIAO_LOGGER_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define CIAO_LOGGER_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !CIAO_LOGGER_NTRACE */
+
+#if (CIAO_LOGGER_NTRACE == 1)
+# define CIAO_LOGGER_TRACE(X)
+#else /* (CIAO_LOGGER_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define CIAO_LOGGER_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (CIAO_LOGGER_NTRACE == 1) */
+
+#endif /* CIAO_LOGGER_EXPORT_H */
+
+// End of auto generated file.
diff --git a/modules/CIAO/ciao/Logger/File_Logger_Backend.cpp b/modules/CIAO/ciao/Logger/File_Logger_Backend.cpp
new file mode 100644
index 00000000000..160926b8ecd
--- /dev/null
+++ b/modules/CIAO/ciao/Logger/File_Logger_Backend.cpp
@@ -0,0 +1,46 @@
+// $Id$
+#include "File_Logger_Backend.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/Log_Record.h"
+#include "ace/Log_Msg.h"
+#include "ciao/Logger/Log_Macros.h"
+
+namespace CIAO
+{
+
+ int
+ File_Logger_Backend::open (const ACE_TCHAR *)
+ {
+ CIAO_DEBUG ( (LM_DEBUG, CLINFO "Setting logger's output to file \"%s\"", this->filename_.c_str()));
+ this->fh_ = ACE_OS::fopen (this->filename_.c_str(), "w");
+ if (0 == this->fh_)
+ {
+ ACE_CString s = "Failed to open log file \"";
+ s += ACE_TEXT_ALWAYS_CHAR (this->filename_.c_str ());
+ s += "\"";
+ throw LoggerError (s.c_str());
+ }
+ return 0;
+ }
+
+ int
+ File_Logger_Backend::close (void)
+ {
+ if (0 != this->fh_)
+ {
+ ACE_OS::fclose (this->fh_);
+ this->fh_ = 0;
+ }
+ return 0;
+ }
+
+ ssize_t
+ File_Logger_Backend::log (ACE_Log_Record &log_record)
+ {
+ int res = log_record.print (0, ACE_Log_Msg::VERBOSE, this->fh_);
+ ACE_OS::fflush (this->fh_);
+ return res;
+ }
+
+}
+
diff --git a/modules/CIAO/ciao/Logger/File_Logger_Backend.h b/modules/CIAO/ciao/Logger/File_Logger_Backend.h
new file mode 100644
index 00000000000..99b899484c2
--- /dev/null
+++ b/modules/CIAO/ciao/Logger/File_Logger_Backend.h
@@ -0,0 +1,52 @@
+// $Id$
+#ifndef FILE_LOGGER_BACKEND_H_
+#define FILE_LOGGER_BACKEND_H_
+
+#include "ace/Log_Msg_Backend.h"
+#include "ace/SString.h"
+//#include "ace/String_Base.h"
+
+#include "CIAO_Logger_Export.h"
+
+namespace CIAO
+ {
+
+ class CIAO_Logger_Export LoggerError
+ {
+ public:
+ LoggerError (const char * msg)
+ : errmsg_ (msg) {};
+ ACE_CString errmsg_;
+ };
+
+ class CIAO_Logger_Export File_Logger_Backend : public ACE_Log_Msg_Backend
+ {
+ public:
+ File_Logger_Backend (const ACE_TCHAR * fname)
+ : fh_ (0), filename_ (fname) {}
+
+ virtual ~File_Logger_Backend (void)
+ {
+ this->close();
+ };
+
+ virtual int open (const ACE_TCHAR *logger_key);
+
+ virtual int reset (void)
+ {
+ this->close();
+ return this->open (0);
+ };
+
+ virtual int close (void);
+
+ virtual ssize_t log (ACE_Log_Record &log_record);
+
+ private:
+ FILE * fh_;
+ ACE_TString filename_;
+ };
+
+} // CIAO
+
+#endif /*FILE_LOGGER_BACKEND_H_*/
diff --git a/modules/CIAO/ciao/Logger/Log_Macros.h b/modules/CIAO/ciao/Logger/Log_Macros.h
new file mode 100644
index 00000000000..d6c7744e539
--- /dev/null
+++ b/modules/CIAO/ciao/Logger/Log_Macros.h
@@ -0,0 +1,82 @@
+// $Id$
+/**
+ * @file Log_Macros.h
+ * @author William R. Otte <wotte@dre.vanderbilt.edu>
+ *
+ * Macros used for logging in CIAO.
+ */
+
+#ifndef CIAO_LOG_MACROS_H_
+#define CIAO_LOG_MACROS_H_
+
+// default information printed with CIAO logging messages.
+
+#define CLINFO "(%P|%t) [%M] - %T - "
+
+#if (CIAO_NTRACE == 1)
+# if !defined (ACE_NTRACE)
+# define CIAO_TRACE(X) do {} while (0)
+# define CIAO_ENABLE_TRACE(X) do {} while (0)
+# define CIAO_DISABLE_TRACE(X) do {} while (0)
+# else
+# if (ACE_NTRACE == 0)
+# error CIAO_TRACE cannot be disabled if ACE_TRACE is enabled
+# else
+# define CIAO_TRACE(X) do {} while (0)
+# define CIAO_ENABLE_TRACE(X) do {} while (0)
+# define CIAO_DISABLE_TRACE(X) do {} while (0)
+# endif
+# endif
+#else
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define CIAO_TRACE(X) ACE_TRACE_IMPL(X)
+# define CIAO_ENABLE_TRACE() ACE_Trace::start_tracing ()
+# define CIAO_DISABLE_TRACE() ACE_Trace::stop_tracing ()
+# undef CLINFO // Make log messages indent with tracing.
+# define CLINFO "%I(%P|%t) [%M] - %T - "
+# include "ace/Trace.h"
+#endif /* CIAO_NTRACE */
+
+#if defined (CIAO_NLOGGING)
+# define CIAO_ERROR(X) do {} while (0)
+# define CIAO_DEBUG(X) do {} while (0)
+#define CIAO_ERROR_RETURN(X, Y) return (Y)
+#define CIAO_ERROR_BREAK(X) { break; }
+#else
+# if !defined (CIAO_ERROR)
+# define CIAO_ERROR(X) \
+ do { \
+ int __ace_error = ACE_Log_Msg::last_error_adapter (); \
+ ACE_Log_Msg *ace___ = ACE_Log_Msg::instance (); \
+ ace___->conditional_set (__FILE__, __LINE__, -1, __ace_error); \
+ ace___->log X; \
+ } while (0)
+# endif
+# if !defined (CIAO_DEBUG)
+# define CIAO_DEBUG(X) \
+ do { \
+ int __ace_error = ACE_Log_Msg::last_error_adapter (); \
+ ACE_Log_Msg *ace___ = ACE_Log_Msg::instance (); \
+ ace___->conditional_set (__FILE__, __LINE__, 0, __ace_error); \
+ ace___->log X; \
+ } while (0)
+# endif
+# if !defined (CIAO_ERROR_RETURN)
+# define CIAO_ERROR_RETURN(X, Y) \
+ do { \
+ int __ace_error = ACE_Log_Msg::last_error_adapter (); \
+ ACE_Log_Msg *ace___ = ACE_Log_Msg::instance (); \
+ ace___->conditional_set (__FILE__, __LINE__, Y, __ace_error); \
+ ace___->log X; \
+ return Y; \
+ } while (0)
+# endif
+# if !defined (CIAO_ERROR_BREAK)
+# define CIAO_ERROR_BREAK(X) { CIAO_ERROR (X); break; }
+# endif
+#endif
+
+
+#endif
diff --git a/modules/CIAO/ciao/Logger/Logger.mpc b/modules/CIAO/ciao/Logger/Logger.mpc
new file mode 100644
index 00000000000..642071d4abe
--- /dev/null
+++ b/modules/CIAO/ciao/Logger/Logger.mpc
@@ -0,0 +1,18 @@
+// -*- MPC -*-
+// $Id$
+
+project(CIAO_Logger): ciao_lib, messaging {
+ sharedname = CIAO_Logger
+ dynamicflags = CIAO_LOGGER_BUILD_DLL
+
+ Source_Files {
+ File_Logger_Backend.cpp
+ Logger_Service.cpp
+ }
+ Header_Files {
+ }
+}
+
+
+
+
diff --git a/modules/CIAO/ciao/Logger/Logger_Service.cpp b/modules/CIAO/ciao/Logger/Logger_Service.cpp
new file mode 100644
index 00000000000..d5c1c9c5fbf
--- /dev/null
+++ b/modules/CIAO/ciao/Logger/Logger_Service.cpp
@@ -0,0 +1,151 @@
+// $Id$
+#include "Logger_Service.h"
+#include "Log_Macros.h"
+#include "ace/Get_Opt.h"
+#include "ace/CORBA_macros.h"
+#include "ace/Env_Value_T.h"
+#include "tao/SystemException.h"
+
+namespace CIAO
+{
+ Logger_Service::Logger_Service (void)
+ : filename_ (ACE_TEXT("")),
+ trace_ (false),
+ log_level_ (5)
+ {
+ }
+
+ int
+ Logger_Service::init (int argc, ACE_TCHAR * argv[])
+ {
+ // Get prospective values from the environment first, those given on
+ // command line can override
+ ACE_Env_Value<int> log (ACE_TEXT("CIAO_LOG_LEVEL"), this->log_level_);
+ this->log_level_ = log;
+
+ ACE_Env_Value<int> trace (ACE_TEXT("CIAO_TRACE_ENABLE"), this->trace_);
+ this->trace_ = trace;
+
+ ACE_Env_Value<const ACE_TCHAR *> filename (ACE_TEXT("CIAO_LOG_FILE"), this->filename_.c_str ());
+ this->filename_ = filename;
+
+ this->parse_args (argc, argv);
+ this->set_levels ();
+
+ return 0;
+ }
+
+ void
+ Logger_Service::parse_args (int argc, ACE_TCHAR **argv)
+ {
+ const ACE_TCHAR *shortl = ACE_TEXT("-l");
+ const ACE_TCHAR *longl = ACE_TEXT("--log-level");
+ const ACE_TCHAR *tracel = ACE_TEXT("--trace");
+ const ACE_TCHAR *traces = ACE_TEXT("-t");
+ const ACE_TCHAR *lfl = ACE_TEXT("--log-file");
+ const ACE_TCHAR *lfs = ACE_TEXT("-f");
+
+ // We need to actually FIND the -l option, as the get_opt won't ignore
+ // the ORB options and such.
+ for (int i = 0; i < argc; ++i)
+ {
+ if (ACE_OS::strncmp (argv[i], traces, 2) == 0 ||
+ ACE_OS::strncmp (argv[i], tracel, 7) == 0)
+ {
+ this->trace_ = true;
+ continue;
+ }
+
+ if (ACE_OS::strncmp (argv[i], shortl, 2) == 0 ||
+ ACE_OS::strncmp (argv[i], longl,11 ) == 0)
+ {
+ if ((i + 1) < argc && *argv[i + 1] != '-')
+ {
+ int level = ACE_OS::atoi (argv[i + 1]);
+
+ if (level != 0)
+ this->log_level_ = level;
+ }
+ }
+
+ if (ACE_OS::strncmp (argv[i], lfs, 2) == 0 ||
+ ACE_OS::strncmp (argv[i], lfl, 10 ) == 0)
+ {
+ if ((i + 1) < argc && *argv[i + 1] != '-')
+ {
+ this->filename_ = argv[i+1];
+ }
+ }
+ }
+ }
+
+ void
+ Logger_Service::set_levels (void)
+ {
+ if (this->trace_)
+ {
+ CIAO_ENABLE_TRACE ();
+ this->log_level_ = 10;
+ }
+ else
+ {
+ CIAO_DISABLE_TRACE ();
+ }
+
+ u_long new_mask = 0;
+
+ if (this->log_level_ >= 9)
+ {
+ new_mask |= LM_TRACE;
+ }
+ if (this->log_level_ >= 8)
+ {
+ new_mask |= LM_DEBUG;
+ }
+ if (this->log_level_ >= 7)
+ {
+ new_mask |= LM_INFO;
+ }
+ if (this->log_level_ >= 6)
+ {
+ new_mask |= LM_NOTICE;
+ }
+ if (this->log_level_ >= 5)
+ {
+ new_mask |= LM_WARNING;
+ }
+ if (this->log_level_ >= 4)
+ {
+ new_mask |= LM_ERROR;
+ }
+ if (this->log_level_ >= 3)
+ {
+ new_mask |= LM_CRITICAL;
+ }
+ if (this->log_level_ >= 2)
+ {
+ new_mask |= LM_ALERT;
+ }
+ if (this->log_level_ >= 1)
+ {
+ new_mask |= LM_EMERGENCY;
+ }
+ ACE_Log_Msg::instance()->priority_mask(new_mask, ACE_Log_Msg::PROCESS);
+ CIAO_DEBUG ( (LM_TRACE, CLINFO "Logging level is set to %i\n", this->log_level_));
+ }
+
+ ACE_Log_Msg_Backend *
+ Logger_Service::get_logger_backend (CORBA::ORB_ptr)
+ {
+ File_Logger_Backend * the_backend;
+ ACE_NEW_THROW_EX (the_backend,
+ File_Logger_Backend (this->filename_.c_str()),
+ CORBA::NO_MEMORY());
+ return the_backend;
+ }
+
+} // CIAO
+
+using namespace CIAO;
+ACE_FACTORY_DEFINE (CIAO_Logger, Logger_Service)
+
diff --git a/modules/CIAO/ciao/Logger/Logger_Service.h b/modules/CIAO/ciao/Logger/Logger_Service.h
new file mode 100644
index 00000000000..0ebbd53d57e
--- /dev/null
+++ b/modules/CIAO/ciao/Logger/Logger_Service.h
@@ -0,0 +1,34 @@
+// $Id$
+#ifndef CIAO_LOGGER_SERVICE_H_
+#define CIAO_LOGGER_SERVICE_H_
+
+#include "CIAO_Logger_Export.h"
+#include "CIAOLoggerFactory.h"
+#include "File_Logger_Backend.h"
+
+namespace CIAO
+ {
+
+ class CIAO_Logger_Export Logger_Service : public CIAOLoggerFactory
+ {
+ public:
+ Logger_Service (void);
+
+ virtual int init (int argc, ACE_TCHAR * argv[]);
+ virtual ACE_Log_Msg_Backend * get_logger_backend (CORBA::ORB_ptr orb);
+
+ private:
+
+ void parse_args (int argc, ACE_TCHAR **argv);
+ void set_levels (void);
+
+ ACE_TString filename_;
+ bool trace_;
+ int log_level_;
+ };
+
+} // DAnCE
+
+ACE_FACTORY_DECLARE (CIAO_Logger, Logger_Service)
+
+#endif /*LOGGER_SERVICE_H_*/
diff --git a/modules/CIAO/ciao/Servants/CIAO_Port_Activator.idl b/modules/CIAO/ciao/Servants/CIAO_Port_Activator.idl
new file mode 100644
index 00000000000..593a9b33ce0
--- /dev/null
+++ b/modules/CIAO/ciao/Servants/CIAO_Port_Activator.idl
@@ -0,0 +1,37 @@
+/**
+ * @file CIAO_Port_Activator.idl
+ * @author Wiliam R. Otte <wotte@dre.vanderbilt.edu
+ * $Id$
+ * Local interface describing servant activators for component ports.
+ */
+
+#ifndef CIAO_PORT_ACTIVATOR_IDL_
+#define CIAO_PORT_ACTIVATOR_IDL_
+
+#include "tao/PortableServer/ServantActivator.pidl"
+
+module CIAO
+{
+ module Port_Activator_Types
+ {
+ enum Type
+ {
+ FACET,
+ SINK
+ };
+ };
+
+ local interface Port_Activator
+ {
+ // OID of port this activator encapsulates
+ attribute string oid;
+ // name of the port
+ readonly attribute string name;
+
+ PortableServer::Servant activate (in PortableServer::ObjectId oid);
+
+ void deactivate (in PortableServer::Servant servant);
+ };
+};
+
+#endif
diff --git a/modules/CIAO/ciao/Servants/CIAO_Servant_Impl_export.h b/modules/CIAO/ciao/Servants/CIAO_Servant_Impl_export.h
new file mode 100644
index 00000000000..c624a706b48
--- /dev/null
+++ b/modules/CIAO/ciao/Servants/CIAO_Servant_Impl_export.h
@@ -0,0 +1,58 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl CIAO_Servant_Impl
+// ------------------------------
+#ifndef CIAO_SERVANT_IMPL_EXPORT_H
+#define CIAO_SERVANT_IMPL_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS) && !defined (CIAO_SERVANT_IMPL_HAS_DLL)
+# define CIAO_SERVANT_IMPL_HAS_DLL 0
+#endif /* ACE_AS_STATIC_LIBS && CIAO_SERVANT_IMPL_HAS_DLL */
+
+#if !defined (CIAO_SERVANT_IMPL_HAS_DLL)
+# define CIAO_SERVANT_IMPL_HAS_DLL 1
+#endif /* ! CIAO_SERVANT_IMPL_HAS_DLL */
+
+#if defined (CIAO_SERVANT_IMPL_HAS_DLL) && (CIAO_SERVANT_IMPL_HAS_DLL == 1)
+# if defined (CIAO_SERVANT_IMPL_BUILD_DLL)
+# define CIAO_Servant_Impl_Export ACE_Proper_Export_Flag
+# define CIAO_SERVANT_IMPL_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define CIAO_SERVANT_IMPL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* CIAO_SERVANT_IMPL_BUILD_DLL */
+# define CIAO_Servant_Impl_Export ACE_Proper_Import_Flag
+# define CIAO_SERVANT_IMPL_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define CIAO_SERVANT_IMPL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* CIAO_SERVANT_IMPL_BUILD_DLL */
+#else /* CIAO_SERVANT_IMPL_HAS_DLL == 1 */
+# define CIAO_Servant_Impl_Export
+# define CIAO_SERVANT_IMPL_SINGLETON_DECLARATION(T)
+# define CIAO_SERVANT_IMPL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* CIAO_SERVANT_IMPL_HAS_DLL == 1 */
+
+// Set CIAO_SERVANT_IMPL_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (CIAO_SERVANT_IMPL_NTRACE)
+# if (ACE_NTRACE == 1)
+# define CIAO_SERVANT_IMPL_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define CIAO_SERVANT_IMPL_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !CIAO_SERVANT_IMPL_NTRACE */
+
+#if (CIAO_SERVANT_IMPL_NTRACE == 1)
+# define CIAO_SERVANT_IMPL_TRACE(X)
+#else /* (CIAO_SERVANT_IMPL_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define CIAO_SERVANT_IMPL_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (CIAO_SERVANT_IMPL_NTRACE == 1) */
+
+#endif /* CIAO_SERVANT_IMPL_EXPORT_H */
+
+// End of auto generated file.
diff --git a/modules/CIAO/ciao/Servants/Home_Servant_Impl_Base.cpp b/modules/CIAO/ciao/Servants/Home_Servant_Impl_Base.cpp
new file mode 100644
index 00000000000..eeeedb34d59
--- /dev/null
+++ b/modules/CIAO/ciao/Servants/Home_Servant_Impl_Base.cpp
@@ -0,0 +1,31 @@
+// $Id$
+
+#include "Home_Servant_Impl_Base.h"
+#include "ciao/Containers/Container_Base.h"
+
+namespace CIAO
+{
+ Home_Servant_Impl_Base::Home_Servant_Impl_Base (Container_ptr c)
+ : container_ (Container::_duplicate(c))
+ {
+ }
+
+ Home_Servant_Impl_Base::~Home_Servant_Impl_Base (void)
+ {
+ }
+
+ // Operations for CCMHome interface.
+
+ CORBA::IRObject_ptr
+ Home_Servant_Impl_Base::get_component_def (void)
+ {
+ throw CORBA::NO_IMPLEMENT ();
+ }
+
+ CORBA::IRObject_ptr
+ Home_Servant_Impl_Base::get_home_def (void)
+ {
+ throw CORBA::NO_IMPLEMENT ();
+ }
+
+}
diff --git a/modules/CIAO/ciao/Servants/Home_Servant_Impl_Base.h b/modules/CIAO/ciao/Servants/Home_Servant_Impl_Base.h
new file mode 100644
index 00000000000..f1c6de82b60
--- /dev/null
+++ b/modules/CIAO/ciao/Servants/Home_Servant_Impl_Base.h
@@ -0,0 +1,67 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Home_Servant_Impl_Base.h
+ *
+ * $Id$
+ *
+ * This file contains the non-template declaration of a base class for
+ * the template mixin for the generated home servant class.
+ *
+ * @author Jeff Parsons <j.parsons@vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef CIAO_HOME_SERVANT_IMPL_BASE_H
+#define CIAO_HOME_SERVANT_IMPL_BASE_H
+
+#include /**/ "ace/pre.h"
+
+#include "CIAO_Servant_Impl_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ccm/CCM_HomeS.h"
+#include "ciao/Containers/Container_BaseC.h"
+
+namespace CIAO
+{
+ /**
+ * @class Home_Servant_Impl_Base
+ *
+ * @brief Non-template base class for Home_Servant_Impl.
+ *
+ * Holds the non-template parts of its child class
+ * Home_Servant_Impl.
+ */
+ class CIAO_Servant_Impl_Export Home_Servant_Impl_Base
+ : public virtual POA_Components::CCMHome
+ {
+ public:
+ Home_Servant_Impl_Base (Container_ptr c);
+
+ virtual ~Home_Servant_Impl_Base (void);
+
+ // Operations for CCMHome interface.
+
+ virtual ::CORBA::IRObject_ptr get_component_def (void);
+
+ virtual ::CORBA::IRObject_ptr get_home_def (void);
+
+ virtual void update_component_map (PortableServer::ObjectId &oid) = 0;
+
+ protected:
+ Container_var container_;
+
+ private:
+ /// Not to be used
+ Home_Servant_Impl_Base (void);
+ };
+}
+
+#include /**/ "ace/post.h"
+
+#endif /* CIAO_HOME_SERVANT_IMPL_BASE_H */
diff --git a/modules/CIAO/ciao/Servants/Home_Servant_Impl_T.cpp b/modules/CIAO/ciao/Servants/Home_Servant_Impl_T.cpp
new file mode 100644
index 00000000000..0fb77c96811
--- /dev/null
+++ b/modules/CIAO/ciao/Servants/Home_Servant_Impl_T.cpp
@@ -0,0 +1,225 @@
+// $Id$
+
+#ifndef CIAO_HOME_SERVANT_IMPL_T_C
+#define CIAO_HOME_SERVANT_IMPL_T_C
+
+#include "Home_Servant_Impl_T.h"
+#include "ccm/CCM_ObjectC.h"
+#include "ccm/CCM_EnterpriseComponentC.h"
+#include "ciao/Containers/Container_BaseC.h"
+#include "ciao/Logger/Log_Macros.h"
+
+namespace CIAO
+{
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename COMP_SVNT>
+ Home_Servant_Impl<BASE_SKEL,
+ EXEC,
+ COMP_SVNT>::Home_Servant_Impl (
+ typename EXEC::_ptr_type exe,
+ Container_ptr c,
+ const char *ins_name
+ )
+ : Home_Servant_Impl_Base (c),
+ ins_name_ (ins_name),
+ executor_ (EXEC::_duplicate (exe)),
+ serial_number_ (0)
+ {
+ CIAO_DEBUG ((LM_TRACE, CLINFO "Home_Servant_Impl<>::Home_Servant_Impl - "
+ "Creating servant for home with ID %C\n",
+ ins_name));
+ }
+
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename COMP_SVNT>
+ Home_Servant_Impl<BASE_SKEL,
+ EXEC,
+ COMP_SVNT>::~Home_Servant_Impl (void)
+ {
+ CIAO_TRACE ("Home_Servant_Impl<>::destructor");
+
+ OBJ_ITERATOR const end = this->objref_map_.end ();
+
+ for (OBJ_ITERATOR iter = this->objref_map_.begin ();
+ iter != end;
+ ++iter)
+ {
+ this->remove_component (((*iter).int_id_).in ());
+ }
+ }
+
+ // Operations for CCMHome interface.
+
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename COMP_SVNT>
+ void
+ Home_Servant_Impl<BASE_SKEL,
+ EXEC,
+ COMP_SVNT>::remove_component (
+ ::Components::CCMObject_ptr comp)
+ {
+ CIAO_TRACE ("Home_Servant_Impl<>::remove_component");
+
+ PortableServer::ObjectId_var oid =
+ this->container_->the_POA ()->reference_to_id (comp);
+
+ Components::CCMObject_var ccm_obj_var = Components::CCMObject::_nil ();
+ if (objref_map_.find (oid.in (), ccm_obj_var) != 0)
+ {
+ CIAO_ERROR ((LM_WARNING, CLINFO "Home_Servant_Impl<>::remove_component - Invalid component object reference\n"));
+ throw Components::RemoveFailure ();
+ }
+
+ typedef typename COMP_SVNT::_stub_type stub_type;
+ typename COMP_SVNT::_stub_var_type _ciao_comp =
+ stub_type::_narrow (ccm_obj_var.in ());
+
+ if (CORBA::is_nil (_ciao_comp.in ()))
+ {
+ throw Components::RemoveFailure ();
+ }
+
+ _ciao_comp->remove ();
+
+ CIAO_DEBUG ((LM_INFO, CLINFO "Home_Servant_Impl<>::remove_component - Removed the component\n"));
+ }
+
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename COMP_SVNT>
+ void
+ Home_Servant_Impl<BASE_SKEL,
+ EXEC,
+ COMP_SVNT>::update_component_map (
+ PortableServer::ObjectId &oid)
+ {
+ CIAO_TRACE ("Home_Servant_Impl<>::update_component_map");
+
+ Components::CCMObject_var ccm_obj_ptr;
+ if (objref_map_.unbind (oid, ccm_obj_ptr) != 0)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "Home_Servant_Impl<>::update_component_map - "
+ "Invalid component object reference\n"));
+ return;
+ }
+
+ return;
+ }
+
+ // Operations for keyless home interface.
+
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename COMP_SVNT>
+ Components::CCMObject_ptr
+ Home_Servant_Impl<BASE_SKEL,
+ EXEC,
+ COMP_SVNT>::create_component (void)
+ {
+ CIAO_TRACE ("Home_Servant_Impl<>::create_component");
+
+ return this->create ();
+ }
+
+ // Operations for implicit home interface.
+
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename COMP_SVNT>
+ typename COMP_SVNT::_stub_ptr_type
+ Home_Servant_Impl<BASE_SKEL,
+ EXEC,
+ COMP_SVNT>::create (void)
+ {
+ CIAO_TRACE ("Home_Servant_Impl<>::create");
+
+ if (this->executor_.in () == 0)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "Home_Servant_Impl<>:create - nil executor reference\n"));
+ throw CORBA::INTERNAL ();
+ }
+
+ ::Components::EnterpriseComponent_var _ciao_ec =
+ this->executor_->create ();
+
+ typedef typename COMP_SVNT::_exec_type exec_type;
+ typename COMP_SVNT::_exec_type::_var_type _ciao_comp =
+ exec_type::_narrow (_ciao_ec.in ());
+
+ return this->_ciao_activate_component (_ciao_comp.in ());
+ }
+
+ // CIAO-specific operations.
+
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename COMP_SVNT>
+ typename COMP_SVNT::_stub_ptr_type
+ Home_Servant_Impl<BASE_SKEL,
+ EXEC,
+ COMP_SVNT>::_ciao_activate_component (
+ typename COMP_SVNT::_exec_type::_ptr_type exe)
+ {
+ CIAO_TRACE ("Home_Servant_Impl<>::_ciao_activate_component");
+
+ CORBA::Object_var hobj = this->container_->get_objref (this);
+
+ Components::CCMHome_var home =
+ Components::CCMHome::_narrow (hobj.in ());
+
+ char buffer[256];
+ unsigned long serial = this->serial_number_++;
+ ACE_OS::sprintf (buffer,
+ "%ld",
+ serial);
+
+ typedef typename COMP_SVNT::_stub_type stub_type;
+ COMP_SVNT *svt = 0;
+ ACE_NEW_THROW_EX (svt,
+ COMP_SVNT (exe,
+ home.in (),
+ (this->ins_name_ + buffer).c_str (),
+ this,
+ this->container_),
+ CORBA::NO_MEMORY ());
+
+ PortableServer::ServantBase_var safe (svt);
+ PortableServer::ObjectId_var oid;
+
+ CORBA::Object_var objref =
+ this->container_->install_servant (svt,
+ Container_Types::COMPONENT_t,
+ oid.out ());
+
+ typedef typename COMP_SVNT::_stub_type stub_type;
+ typename COMP_SVNT::_stub_var_type ho = stub_type::_narrow (objref.in ());
+
+ Components::CCMObject_var ccmobjref =
+ Components::CCMObject::_narrow (objref.in ());
+
+ this->objref_map_.bind (
+ oid.in (),
+ Components::CCMObject::_duplicate (ccmobjref.in ()));
+
+ return ho._retn ();
+ }
+
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename COMP_SVNT>
+ void
+ Home_Servant_Impl<BASE_SKEL,
+ EXEC,
+ COMP_SVNT>::_ciao_passivate_component (
+ typename COMP_SVNT::_stub_ptr_type comp)
+ {
+ CIAO_TRACE ("Home_Servant_Impl<>::_ciao_passivate_component");
+
+ this->container_->uninstall_component (comp);
+ }
+}
+
+#endif /* CIAO_HOME_SERVANT_IMPL_T_C */
diff --git a/modules/CIAO/ciao/Servants/Home_Servant_Impl_T.h b/modules/CIAO/ciao/Servants/Home_Servant_Impl_T.h
new file mode 100644
index 00000000000..80b57189ef1
--- /dev/null
+++ b/modules/CIAO/ciao/Servants/Home_Servant_Impl_T.h
@@ -0,0 +1,107 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Home_Servant_Impl_T.h
+ *
+ * $Id$
+ *
+ * This file contains the declaration of a mixin base class for
+ * the generated home servant class.
+ *
+ * @authors Jeff Parsons <j.parsons@vanderbilt.edu>
+ */
+//=============================================================================
+
+
+#ifndef CIAO_HOME_SERVANT_IMPL_T_H
+#define CIAO_HOME_SERVANT_IMPL_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "Home_Servant_Impl_Base.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Hash_Map_Manager_T.h"
+#include "tao/PortableServer/Key_Adapters.h"
+
+namespace CIAO
+{
+ class Container;
+ typedef Container *Container_ptr;
+
+
+ /**
+ * @class Home_Servant_Impl
+ *
+ * @brief Mixin base class for generated home servant.
+ *
+ * This class implements operations
+ * common to all generated home servants.
+ */
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename COMP_SVNT>
+ class Home_Servant_Impl
+ : public virtual BASE_SKEL,
+ public virtual Home_Servant_Impl_Base
+ {
+ public:
+ Home_Servant_Impl (typename EXEC::_ptr_type exe,
+ Container_ptr c,
+ const char *ins_name);
+
+ virtual ~Home_Servant_Impl (void);
+
+ // Operations for CCMHome interface.
+ virtual void remove_component (Components::CCMObject_ptr comp);
+
+ // Operations for keyless home interface.
+ virtual ::Components::CCMObject_ptr create_component ();
+
+ // Operations for implicit home interface.
+ virtual typename COMP_SVNT::_stub_ptr_type create ();
+
+ virtual void update_component_map (PortableServer::ObjectId &oid);
+
+ protected:
+ // CIAO-specific operations.
+ typename COMP_SVNT::_stub_ptr_type
+ _ciao_activate_component (typename COMP_SVNT::_exec_type::_ptr_type exe);
+
+ void
+ _ciao_passivate_component (typename COMP_SVNT::_stub_ptr_type comp);
+
+ protected:
+ ACE_CString ins_name_;
+ typename EXEC::_var_type executor_;
+
+ typedef ACE_Hash_Map_Manager_Ex<PortableServer::ObjectId,
+ Components::CCMObject_var,
+ TAO_ObjectId_Hash,
+ ACE_Equal_To<PortableServer::ObjectId>,
+ TAO_SYNCH_MUTEX>
+ OBJREF_MAP;
+
+ typedef OBJREF_MAP::iterator OBJ_ITERATOR;
+
+ OBJREF_MAP objref_map_;
+
+ ACE_Atomic_Op <TAO_SYNCH_MUTEX, unsigned long> serial_number_;
+ };
+}
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "Home_Servant_Impl_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Home_Servant_Impl_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* CIAO_HOME_SERVANT_IMPL_T_H */
diff --git a/modules/CIAO/ciao/Servants/Port_Activator.cpp b/modules/CIAO/ciao/Servants/Port_Activator.cpp
new file mode 100644
index 00000000000..68e253dea13
--- /dev/null
+++ b/modules/CIAO/ciao/Servants/Port_Activator.cpp
@@ -0,0 +1,39 @@
+#include "Port_Activator.h"
+
+ACE_RCSID (ciao,
+ Servant_Activator,
+ "$Id$")
+
+namespace CIAO
+{
+ Port_Activator_i::Port_Activator_i (const char *oid,
+ const char *name,
+ Port_Activator_Types::Type t)
+ : oid_ (oid),
+ name_ (name),
+ t_ (t)
+ {
+ }
+
+ Port_Activator_i::~Port_Activator_i (void)
+ {
+ }
+
+ char*
+ Port_Activator_i::oid (void)
+ {
+ return CORBA::string_dup(this->oid_.in ());
+ }
+
+ void
+ Port_Activator_i::oid (const char* oid)
+ {
+ this->oid_ = oid;
+ }
+
+ char*
+ Port_Activator_i::name (void)
+ {
+ return CORBA::string_dup(this->name_.in ());
+ }
+}
diff --git a/modules/CIAO/ciao/Servants/Port_Activator.h b/modules/CIAO/ciao/Servants/Port_Activator.h
new file mode 100644
index 00000000000..5f5cb019a94
--- /dev/null
+++ b/modules/CIAO/ciao/Servants/Port_Activator.h
@@ -0,0 +1,82 @@
+// -*- C++ -*-
+//=============================================================================
+/**
+ * @file Port_Activator.h
+ *
+ * $Id$
+ *
+ * @authors Bala Natarajan <bala@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef CIAO_PORT_ACTIVATOR_H
+#define CIAO_PORT_ACTIVATOR_H
+
+#include /**/ "ace/pre.h"
+
+#include "CIAO_Servant_Impl_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/PortableServer.h"
+#include "ciao/Servants/CIAO_Port_ActivatorC.h"
+
+namespace CIAO
+{
+ /**
+ * @class Port_Activator_i
+ *
+ * @brief Base class for port activations
+ *
+ * This is a ABC for the Port_Activator_T <> template class where
+ * the bulk of the work is done. This class is simply a place holder
+ * so that we could use the pointer to this class to achieve
+ * polymorphism for facet and consumer servant activations.
+ *
+ */
+ class CIAO_Servant_Impl_Export Port_Activator_i :
+ public virtual Port_Activator
+ {
+ public:
+ Port_Activator_i (const char *oid, const char *name, Port_Activator_Types::Type t);
+
+ virtual ~Port_Activator_i (void);
+
+ /// Return the oid of port that this activator encapulates.
+ virtual char* oid (void);
+
+ /// Set the oid
+ virtual void oid (const char* oid);
+
+ /// Return the oid of port that this activator encapulates.
+ virtual char* name (void);
+
+ /// Activate the servant reponsible for this port.
+ /**
+ * There are intentionally no throw specifications. It is the
+ * caller's responsibility to handle CORBA and C++
+ * specifications.
+ */
+ virtual PortableServer::Servant activate (
+ const PortableServer::ObjectId &oid) = 0;
+
+ virtual void deactivate (::PortableServer::Servant servant) = 0;
+
+ protected:
+ /// The object ID that is used to activate the servant within the
+ /// POA.
+ CORBA::String_var oid_;
+
+ /// Name of the port
+ CORBA::String_var name_;
+
+ /// What type of port is it, a consumer or facet.
+ Port_Activator_Types::Type const t_;
+ };
+}
+
+#include /**/ "ace/post.h"
+
+#endif /*CIAO_PORT_ACTIVATOR_H*/
diff --git a/modules/CIAO/ciao/Servants/Port_Activator_T.cpp b/modules/CIAO/ciao/Servants/Port_Activator_T.cpp
new file mode 100644
index 00000000000..6b8b69b2e24
--- /dev/null
+++ b/modules/CIAO/ciao/Servants/Port_Activator_T.cpp
@@ -0,0 +1,79 @@
+// $Id$
+
+#ifndef CIAO_PORT_ACTIVATOR_T_CPP
+#define CIAO_PORT_ACTIVATOR_T_CPP
+
+#include "Port_Activator_T.h"
+#include "tao/CORBA_String.h"
+
+#include "ace/OS_NS_string.h"
+
+namespace CIAO
+{
+ template <typename SERV,
+ typename EXEC,
+ typename CONTEXT,
+ typename COMP_SERV>
+ Port_Activator_T<SERV, EXEC, CONTEXT, COMP_SERV>::Port_Activator_T (
+ const char *oid,
+ const char *name,
+ Port_Activator_Types::Type t,
+ EXEC *e,
+ CONTEXT *c,
+ COMP_SERV *cc)
+ : Port_Activator_i (oid, name, t)
+ , executor_ (e)
+ , context_ (c)
+ , comp_serv_ (cc)
+ {
+ }
+
+ template <typename SERV,
+ typename EXEC,
+ typename CONTEXT,
+ typename COMP_SERV>
+ void
+ Port_Activator_T<SERV, EXEC, CONTEXT, COMP_SERV>::deactivate (
+ PortableServer::Servant servant)
+ {
+ SERVANT *s = dynamic_cast<SERVANT *> (servant);
+ s->_remove_ref ();
+ }
+
+ template <typename SERV,
+ typename EXEC,
+ typename CONTEXT,
+ typename COMP_SERV>
+ PortableServer::Servant
+ Port_Activator_T<SERV, EXEC, CONTEXT, COMP_SERV>::activate (
+ const PortableServer::ObjectId &oid)
+ {
+ CORBA::String_var str =
+ PortableServer::ObjectId_to_string (oid);
+
+ // An additional check, may not be necessary. Being on the safe
+ // side.
+ if (ACE_OS::strcmp (this->oid_.in (), str.in ()) == 0)
+ {
+ if (this->executor_ == 0 && this->t_ == Port_Activator_Types::FACET)
+ {
+ CORBA::Object_var tmp =
+ this->comp_serv_->get_facet_executor (this->name_.in ());
+
+ this->executor_ = EXEC::_narrow (tmp.in ());
+ }
+
+ SERVANT *s = 0;
+
+ ACE_NEW_THROW_EX (s,
+ SERVANT (this->executor_,
+ this->context_),
+ CORBA::NO_MEMORY ());
+ return s;
+ }
+
+ throw CORBA::OBJECT_NOT_EXIST ();
+ }
+}
+
+#endif /*SERVANT_ACTIVATOR_T_CPP*/
diff --git a/modules/CIAO/ciao/Servants/Port_Activator_T.h b/modules/CIAO/ciao/Servants/Port_Activator_T.h
new file mode 100644
index 00000000000..4e40d895e8e
--- /dev/null
+++ b/modules/CIAO/ciao/Servants/Port_Activator_T.h
@@ -0,0 +1,80 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Port_Activator_T.h
+ *
+ * $Id$
+ *
+ * @authors Bala Natarajan <bala@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef CIAO_PORT_ACTIVATOR_T_H
+#define CIAO_PORT_ACTIVATOR_T_H
+#include /**/ "ace/pre.h"
+
+#include "ciao/Servants/Port_Activator.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+
+namespace CIAO
+{
+ /**
+ * @class Port_Activator_T
+ *
+ * @brief Concrete class that implements the strategy for creating
+ * the right type of servant for the ports in question.
+ *
+ * This class is parametrized by the servant type for the port, the
+ * executor type for the port, the context for the component and the
+ * component servant which instantiated this class within the
+ * container.
+ */
+ template <typename SERV,
+ typename EXEC,
+ typename CONTEXT,
+ typename COMP_SERV>
+ class Port_Activator_T : public virtual Port_Activator_i
+ {
+ public:
+ typedef SERV SERVANT;
+
+ Port_Activator_T (const char *oid,
+ const char *name,
+ Port_Activator_Types::Type t,
+ EXEC *e,
+ CONTEXT *c,
+ COMP_SERV *cs);
+
+ /// Template method from the base class, please see the base class
+ /// documentation for details.
+ virtual PortableServer::Servant activate (const PortableServer::ObjectId &oid);
+
+ virtual void deactivate (PortableServer::Servant servant);
+
+ private:
+ /// The executor
+ EXEC *executor_;
+
+ /// Context classes
+ CONTEXT *context_;
+
+ /// Component servant which created <this>
+ COMP_SERV *comp_serv_;
+ };
+}
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "Port_Activator_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Port_Activator_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+#endif /*CIAO_SERVANT_ACTIVATOR_T_H*/
diff --git a/modules/CIAO/ciao/Servants/Servant_Impl_Base.cpp b/modules/CIAO/ciao/Servants/Servant_Impl_Base.cpp
new file mode 100644
index 00000000000..b8f000e7854
--- /dev/null
+++ b/modules/CIAO/ciao/Servants/Servant_Impl_Base.cpp
@@ -0,0 +1,758 @@
+// $Id$
+
+#include "Servant_Impl_Base.h"
+
+#include "StandardConfigurator_Impl.h"
+#include "ciao/Logger/Log_Macros.h"
+#include "ciao/Containers/Container_BaseC.h"
+
+namespace CIAO
+{
+ Servant_Impl_Base::Servant_Impl_Base (Components::CCMHome_ptr home,
+ Home_Servant_Impl_Base *home_servant,
+ Container_ptr c)
+ : home_ (Components::CCMHome::_duplicate (home)),
+ home_servant_ (home_servant),
+ container_ (Container::_duplicate (c))
+ {
+ }
+
+ Servant_Impl_Base::~Servant_Impl_Base (void)
+ {
+ }
+
+ // Operations for CCMObject interface.
+
+ ::Components::PrimaryKeyBase *
+ Servant_Impl_Base::get_primary_key (void)
+ {
+ CIAO_TRACE("Servant_Impl_Base::get_primary_key");
+ throw ::Components::NoKeyAvailable ();
+ }
+
+ CORBA::IRObject_ptr
+ Servant_Impl_Base::get_component_def (void)
+ {
+ CIAO_TRACE("Servant_Impl_Base::get_component_def");
+ throw ::CORBA::NO_IMPLEMENT ();
+ }
+
+ void
+ Servant_Impl_Base::configuration_complete (void)
+ {
+ CIAO_TRACE("Servant_Impl_Base::configuration_complete (void)");
+ // CIAO to-do
+ }
+
+ void
+ Servant_Impl_Base::remove (void)
+ {
+ CIAO_TRACE("Servant_Impl_Base::remove (void)");
+ try
+ {
+ // Removing Facets
+ Components::FacetDescriptions_var facets = this->get_all_facets ();
+
+ CORBA::ULong const facet_len = facets->length ();
+
+ for (CORBA::ULong i = 0; i < facet_len; ++i)
+ {
+ PortableServer::ObjectId_var facet_id =
+ this->container_->the_port_POA ()->reference_to_id (
+ facets[i]->facet_ref ());
+
+ this->container_->the_port_POA ()->deactivate_object (
+ facet_id);
+
+ CIAO::Servant_Activator_var sa =
+ this->container_->ports_servant_activator ();
+
+ if (!CORBA::is_nil (sa.in ()))
+ {
+ sa->update_port_activator (facet_id.in ());
+ }
+ }
+
+ // Removed Facets
+
+ // Removing Consumers
+ Components::ConsumerDescriptions_var consumers =
+ this->get_all_consumers ();
+
+ CORBA::ULong const consumer_len = consumers->length ();
+
+ for (CORBA::ULong j = 0; j < consumer_len; ++j)
+ {
+ PortableServer::ObjectId_var cons_id =
+ this->container_->the_port_POA ()->reference_to_id (
+ consumers[j]->consumer ());
+
+ this->container_->the_port_POA ()->deactivate_object (
+ cons_id);
+
+ CIAO::Servant_Activator_var sa =
+ this->container_->ports_servant_activator ();
+
+ if (!CORBA::is_nil (sa.in ()))
+ {
+ sa->update_port_activator (cons_id.in ());
+ }
+ }
+
+ Components::SessionComponent_var temp = this->get_executor ();
+ temp->ccm_remove ();
+
+ CORBA::Object_var objref = this->container_->get_objref (this);
+
+ Components::CCMObject_var ccmobjref =
+ Components::CCMObject::_narrow (objref.in ());
+
+ PortableServer::ObjectId_var oid;
+
+ this->container_->uninstall_servant (this,
+ Container_Types::COMPONENT_t,
+ oid.out ());
+
+ if (this->home_servant_)
+ this->home_servant_->update_component_map (oid);
+ }
+ catch (const CORBA::Exception& ex)
+ {
+ ex._tao_print_exception ("Port not active\n");
+ }
+ }
+
+ ::Components::ConnectionDescriptions *
+ Servant_Impl_Base::get_connections (const char * /* name */)
+ {
+ CIAO_TRACE("Servant_Impl_Base::get_connections (const char * /* name */)");
+ throw CORBA::NO_IMPLEMENT ();
+ }
+
+ ::Components::ComponentPortDescription *
+ Servant_Impl_Base::get_all_ports (void)
+ {
+ CIAO_TRACE("Servant_Impl_Base::get_all_ports (void)");
+ OBV_Components::ComponentPortDescription *cps = 0;
+ ACE_NEW_THROW_EX (cps,
+ OBV_Components::ComponentPortDescription,
+ CORBA::NO_MEMORY ());
+ ::Components::ComponentPortDescription_var retv = cps;
+
+ ::Components::FacetDescriptions_var facets_desc =
+ this->get_all_facets ();
+
+ ::Components::ReceptacleDescriptions_var receptacle_desc =
+ this->get_all_receptacles ();
+
+ ::Components::ConsumerDescriptions_var consumer_desc =
+ this->get_all_consumers ();
+
+ ::Components::EmitterDescriptions_var emitter_desc =
+ this->get_all_emitters ();
+
+ ::Components::PublisherDescriptions_var publisher_desc =
+ this->get_all_publishers ();
+
+ retv->facets (facets_desc.in ());
+ retv->receptacles (receptacle_desc.in ());
+ retv->consumers (consumer_desc.in ());
+ retv->emitters (emitter_desc.in ());
+ retv->publishers (publisher_desc.in ());
+
+ return retv._retn ();
+ }
+
+ ::CORBA::Object_ptr
+ Servant_Impl_Base::provide_facet (const char *name)
+ {
+ CIAO_TRACE("Servant_Impl_Base::provide_facet (const char *name)");
+ if (0 == name)
+ {
+ throw Components::InvalidName ();
+ }
+
+ CORBA::Object_ptr retval = this->lookup_facet (name);
+
+ if ( ::CORBA::is_nil (retval))
+ {
+ throw Components::InvalidName ();
+ }
+
+ return retval;
+ }
+
+ Components::FacetDescriptions *
+ Servant_Impl_Base::get_named_facets (
+ const ::Components::NameList & names)
+ {
+ CIAO_TRACE("Servant_Impl_Base::get_named_facets");
+ Components::FacetDescriptions *retval = 0;
+ ACE_NEW_THROW_EX (retval,
+ ::Components::FacetDescriptions,
+ CORBA::NO_MEMORY ());
+ Components::FacetDescriptions_var safe_retval = retval;
+ CORBA::ULong const len = names.length ();
+ safe_retval->length (len);
+
+ for (CORBA::ULong i = 0; i < len; ++i)
+ {
+ ::Components::FacetDescription *tmp =
+ this->lookup_facet_description (names[i]);
+
+ if (0 == tmp)
+ {
+ throw Components::InvalidName ();
+ }
+
+ safe_retval[i] = tmp;
+ }
+
+ return safe_retval._retn ();
+ }
+
+ ::Components::FacetDescriptions *
+ Servant_Impl_Base::get_all_facets (void)
+ {
+ CIAO_TRACE ("Servant_Impl_Base::get_all_facets (void)");
+ ::Components::FacetDescriptions *tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ ::Components::FacetDescriptions,
+ CORBA::NO_MEMORY ());
+
+ ::Components::FacetDescriptions_var retval = tmp;
+
+ retval->length (this->facet_table_.size ());
+ CORBA::ULong i = 0UL;
+
+ for (FacetTable::const_iterator iter = this->facet_table_.begin ();
+ iter != this->facet_table_.end ();
+ ++iter, ++i)
+ {
+ retval[i] = iter->second;
+ }
+
+ return retval._retn ();
+ }
+
+
+ ::Components::ConsumerDescriptions *
+ Servant_Impl_Base::get_all_consumers (void)
+ {
+ CIAO_TRACE("Servant_Impl_Base::get_all_consumers (void)");
+ ::Components::ConsumerDescriptions *tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ ::Components::ConsumerDescriptions (
+ this->consumer_table_.size ()),
+ CORBA::NO_MEMORY ());
+
+ ::Components::ConsumerDescriptions_var retval = tmp;
+
+ retval->length (this->consumer_table_.size ());
+ CORBA::ULong i = 0UL;
+
+ for (ConsumerTable::const_iterator iter = this->consumer_table_.begin ();
+ iter != this->consumer_table_.end ();
+ ++iter, ++i)
+ {
+ retval[i] = iter->second;
+ }
+
+ return retval._retn ();
+ }
+
+
+ ::Components::EventConsumerBase_ptr
+ Servant_Impl_Base::get_consumer (const char *sink_name)
+ {
+ CIAO_TRACE("Servant_Impl_Base::get_consumer (const char *sink_name)");
+ if (!sink_name)
+ {
+ throw Components::InvalidName ();
+ }
+
+ Components::EventConsumerBase_ptr retval =
+ this->lookup_consumer (sink_name);
+
+ if (CORBA::is_nil (retval))
+ {
+ throw Components::InvalidName ();
+ }
+
+ return retval;
+ }
+
+ ::Components::ConsumerDescriptions *
+ Servant_Impl_Base::get_named_consumers (
+ const ::Components::NameList & names)
+ {
+ CIAO_TRACE("Servant_Impl_Base::get_named_consumers");
+ Components::ConsumerDescriptions *retval = 0;
+ ACE_NEW_THROW_EX (retval,
+ ::Components::ConsumerDescriptions,
+ CORBA::NO_MEMORY ());
+ Components::ConsumerDescriptions_var safe_retval = retval;
+ CORBA::ULong const len = names.length ();
+ safe_retval->length (len);
+
+ for (CORBA::ULong i = 0; i < len; ++i)
+ {
+ ::Components::ConsumerDescription *tmp =
+ this->lookup_consumer_description (names[i]);
+
+ if (0 == tmp)
+ {
+ throw Components::InvalidName ();
+ }
+
+ safe_retval[i] = tmp;
+ }
+
+ return safe_retval._retn ();
+ }
+
+ ::Components::EmitterDescriptions *
+ Servant_Impl_Base::get_named_emitters (
+ const ::Components::NameList & /* names */)
+ {
+ CIAO_TRACE("Servant_Impl_Base::get_named_emitters");
+ throw CORBA::NO_IMPLEMENT ();
+ }
+
+ ::Components::ReceptacleDescriptions *
+ Servant_Impl_Base::get_all_receptacles (void)
+ {
+ CIAO_TRACE(" Servant_Impl_Base::get_all_receptacles (void)");
+ CIAO_DEBUG ((LM_TRACE, CLINFO "Servant_Impl_Base::get_all_receptacles\n"));
+
+ ::Components::ReceptacleDescriptions *tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ ::Components::ReceptacleDescriptions,
+ CORBA::NO_MEMORY ());
+
+ ::Components::ReceptacleDescriptions_var retval = tmp;
+
+ retval->length (this->receptacle_table_.current_size ());
+ CORBA::ULong i = 0;
+
+ CIAO_DEBUG ((LM_DEBUG, CLINFO
+ "Servant_Impl_Base::get_all_receptacles - Building sequence of length %d\n",
+ retval->length()));
+
+ for (ReceptacleTable::iterator iter = this->receptacle_table_.begin ();
+ iter != this->receptacle_table_.end ();
+ ++iter, ++i)
+ {
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "Servant_Impl_Base::get_all_receptacles - Starting loop iteration...\n",
+ retval->length()));
+
+ ReceptacleTable::ENTRY & entry = *iter;
+ retval[i] = entry.int_id_;
+ }
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO "Servant_Impl_Base::get_all_receptacles - Escaped loop.\n"));
+ return retval._retn ();
+ }
+
+ ::Components::ReceptacleDescriptions *
+ Servant_Impl_Base::get_named_receptacles (
+ const ::Components::NameList & /* names */)
+ {
+ CIAO_TRACE("Servant_Impl_Base::get_named_receptacles");
+ throw ::CORBA::NO_IMPLEMENT ();
+ }
+
+ ::Components::PublisherDescriptions *
+ Servant_Impl_Base::get_named_publishers (
+ const ::Components::NameList & /* names */)
+ {
+ CIAO_TRACE("Servant_Impl_Base::get_named_publishers");
+ throw ::CORBA::NO_IMPLEMENT ();
+ }
+
+ /// Protected operations.
+ void
+ Servant_Impl_Base::add_facet (const char *port_name,
+ ::CORBA::Object_ptr port_ref)
+ {
+ CIAO_TRACE("Servant_Impl_Base::add_facet");
+ if (0 == port_name || ::CORBA::is_nil (port_ref))
+ {
+ throw ::CORBA::BAD_PARAM ();
+ }
+
+ ::Components::FacetDescription *fd = 0;
+ ACE_NEW_THROW_EX (fd,
+ ::OBV_Components::FacetDescription (port_name,
+ port_ref->_interface_repository_id (),
+ port_ref),
+ CORBA::NO_MEMORY ());
+ ::Components::FacetDescription_var safe = fd;
+
+ FacetTable::value_type entry;
+ entry.first = port_name;
+ entry.second = safe._retn ();
+
+ {
+ ACE_WRITE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, mon, this->lock_,
+ CORBA::NO_RESOURCES ());
+
+ (void) this->facet_table_.insert (entry);
+ }
+ }
+
+ CORBA::Object_ptr
+ Servant_Impl_Base::lookup_facet (const char *port_name)
+ {
+ CIAO_TRACE("Servant_Impl_Base::lookup_facet");
+ if (0 == port_name)
+ {
+ return CORBA::Object::_nil ();
+ }
+
+ ACE_READ_GUARD_THROW_EX (TAO_SYNCH_MUTEX,
+ mon,
+ this->lock_,
+ CORBA::NO_RESOURCES ());
+
+ FacetTable::const_iterator iter =
+ this->facet_table_.find (port_name);
+
+ if (iter == this->facet_table_.end ())
+ {
+ return CORBA::Object::_nil ();
+ }
+
+ return CORBA::Object::_duplicate (iter->second->facet_ref ());
+ }
+
+ ::Components::FacetDescription *
+ Servant_Impl_Base::lookup_facet_description (const char *port_name)
+ {
+ CIAO_TRACE("Servant_Impl_Base::lookup_facet_description");
+ if (0 == port_name)
+ {
+ /// Calling function will throw InvalidName after getting this.
+ return 0;
+ }
+
+ ::Components::FacetDescription_var fd;
+
+ {
+ ACE_READ_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ mon,
+ this->lock_,
+ 0);
+ FacetTable::const_iterator iter =
+ this->facet_table_.find (port_name);
+
+ if (iter != this->facet_table_.end ())
+ {
+ fd = iter->second;
+ }
+ }
+
+ return fd._retn ();
+ }
+
+ void
+ Servant_Impl_Base::add_receptacle (const char *receptacle_name,
+ CORBA::Object_ptr recept_ref,
+ ::Components::Cookie * cookie)
+ {
+ CIAO_TRACE("Servant_Impl_Base::add_receptacle");
+ CIAO_DEBUG ((LM_INFO, CLINFO
+ "Servant_Impl_Base::add_receptacle - attempting to add new connection to receptacle (%C)\n",
+ receptacle_name));
+
+ ::Components::ReceptacleDescription_var safe;
+ ::Components::ReceptacleDescription *rd = 0;
+
+ if (this->receptacle_table_.find (receptacle_name,
+ safe) == -1)
+ {
+ CIAO_DEBUG ((LM_DEBUG, CLINFO
+ "Servant_Impl_Base::add_receptacle - Found no receptacle named (%C), creating it...\n",
+ receptacle_name));
+
+ ACE_NEW_THROW_EX (rd,
+ OBV_Components::ReceptacleDescription,
+ CORBA::NO_MEMORY ());
+ safe = rd;
+
+ rd->name (receptacle_name);
+ rd->type_id ();
+ // The receptacle is a multiplex receptacle if and only if a
+ // cookie was given.
+ rd->is_multiple (cookie != 0);
+
+ ::Components::ConnectionDescription *cd = 0;
+ ACE_NEW_THROW_EX (cd,
+ OBV_Components::ConnectionDescription (cookie,
+ recept_ref),
+ CORBA::NO_MEMORY ());
+ ::Components::ConnectionDescription_var cd_safe = cd;
+ ::Components::ConnectionDescriptions cds (1);
+
+ cds.length (1);
+ cds[0] = cd_safe;
+ rd->connections (cds);
+ }
+ else
+ {
+ CIAO_DEBUG ((LM_DEBUG, CLINFO
+ "Servant_Impl_Base::add_receptacle - Found a receptacle named (%C)\n",
+ receptacle_name));
+ rd = safe.inout ();
+
+ ::Components::ConnectionDescription *cd = 0;
+ ACE_NEW_THROW_EX (cd,
+ OBV_Components::ConnectionDescription (cookie,
+ recept_ref),
+ CORBA::NO_MEMORY ());
+ ::Components::ConnectionDescription_var cd_safe = cd;
+ ::Components::ConnectionDescriptions & cds = rd->connections ();
+ CORBA::ULong old_length = cds.length ();
+ cds.length (old_length + 1);
+ cds [old_length] = cd_safe;
+
+ CIAO_DEBUG ((LM_DEBUG, CLINFO
+ "Servant_Impl_Base::add_receptacle - Added new connection to "
+ "existing receptacle named (%C)\n",
+ receptacle_name));
+ }
+
+ if (this->receptacle_table_.bind (receptacle_name, safe) == 0)
+ {
+ CIAO_DEBUG ((LM_INFO, CLINFO
+ "Servant_Impl_Base::add_receptacle - Successfully added new receptacle named (%C)\n",
+ receptacle_name));
+ }
+ }
+
+ void
+ Servant_Impl_Base::add_consumer (const char *port_name,
+ ::Components::EventConsumerBase_ptr port_ref)
+ {
+ CIAO_TRACE("Servant_Impl_Base::add_consumer");
+ if (0 == port_name || ::CORBA::is_nil (port_ref))
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "Servant_Impl_Base::add_consumer - Bad port name [%C] or bad objref\n",
+ port_name));
+ throw ::CORBA::BAD_PARAM ();
+ return;
+ }
+
+ ::Components::ConsumerDescription *cd = 0;
+ ACE_NEW_THROW_EX (cd,
+ ::OBV_Components::ConsumerDescription,
+ CORBA::NO_MEMORY ());
+
+ ::Components::ConsumerDescription_var safe = cd;
+
+ cd->name (port_name);
+ cd->type_id (port_ref->_interface_repository_id ());
+ cd->consumer (port_ref);
+
+ ConsumerTable::value_type entry;
+ entry.first = port_name;
+ entry.second = safe._retn ();
+
+ ACE_WRITE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, mon, this->lock_,
+ CORBA::NO_RESOURCES ());
+
+ (void) this->consumer_table_.insert (entry);
+ }
+
+ ::Components::EventConsumerBase_ptr
+ Servant_Impl_Base::lookup_consumer (const char *port_name)
+ {
+ CIAO_TRACE("Servant_Impl_Base::lookup_consumer");
+ if (0 == port_name)
+ {
+ return ::Components::EventConsumerBase::_nil ();
+ }
+
+ ACE_READ_GUARD_THROW_EX (TAO_SYNCH_MUTEX,
+ mon,
+ this->lock_,
+ CORBA::NO_RESOURCES ());
+
+ ConsumerTable::const_iterator iter =
+ this->consumer_table_.find (port_name);
+
+ if (iter == this->consumer_table_.end ())
+ {
+ return ::Components::EventConsumerBase::_nil ();
+ }
+
+ return
+ ::Components::EventConsumerBase::_duplicate (
+ iter->second->consumer ());
+ }
+
+ ::Components::ConsumerDescription *
+ Servant_Impl_Base::lookup_consumer_description (
+ const char *port_name)
+ {
+ CIAO_TRACE("Servant_Impl_Base::lookup_consumer_description");
+ if (0 == port_name)
+ {
+ /// Calling function will throw InvalidName after getting this.
+ return 0;
+ }
+
+ ::Components::ConsumerDescription_var cd;
+ ConsumerTable::const_iterator iter;
+
+ {
+ ACE_READ_GUARD_THROW_EX (TAO_SYNCH_MUTEX,
+ mon,
+ this->lock_,
+ CORBA::NO_RESOURCES ());
+
+ iter = this->consumer_table_.find (port_name);
+
+ if (iter != this->consumer_table_.end ())
+ {
+ cd = iter->second;
+ }
+ }
+
+ return cd._retn ();
+ }
+
+ ::Components::StandardConfigurator_ptr
+ Servant_Impl_Base::get_standard_configurator (void)
+ {
+ CIAO_TRACE("Servant_Impl_Base::get_standard_configurator (void)");
+ // Create the configurator servant.
+ StandardConfigurator_Impl *config_impl = 0;
+
+ ACE_NEW_THROW_EX (config_impl,
+ StandardConfigurator_Impl (this),
+ CORBA::NO_MEMORY ());
+
+
+ Components::StandardConfigurator_var configurator =
+ config_impl->_this ();
+
+ return configurator._retn ();
+ }
+
+ void
+ Servant_Impl_Base::activate_component (void)
+ {
+ CIAO_TRACE ("Servant_Impl_Base::activate_component");
+ throw CORBA::NO_IMPLEMENT ();
+ }
+
+
+ void
+ Servant_Impl_Base::passivate_component (void)
+ {
+ CIAO_TRACE ("Servant_Impl_Base::passivate_component");
+ throw CORBA::NO_IMPLEMENT ();
+ }
+
+ Components::SessionComponent_ptr
+ Servant_Impl_Base::get_executor (void)
+ {
+ CIAO_TRACE ("Servant_Impl_Base::get_executor");
+ throw CORBA::NO_IMPLEMENT ();
+ }
+
+ void
+ Servant_Impl_Base::set_attributes (const Components::ConfigValues &/*descr*/)
+ {
+ CIAO_TRACE ("Servant_Impl_Base::set_attributes");
+ throw CORBA::NO_IMPLEMENT ();
+ }
+
+ ::Components::CCMHome_ptr
+ Servant_Impl_Base::get_ccm_home (void)
+ {
+ CIAO_TRACE ("Servant_Impl_Base::get_ccm_home");
+ throw CORBA::NO_IMPLEMENT ();
+ }
+
+ PortableServer::POA_ptr
+ Servant_Impl_Base::_default_POA (void)
+ {
+ CIAO_TRACE("Servant_Impl_Base::_default_POA (void)");
+ return
+ PortableServer::POA::_duplicate (container_->the_POA ());
+ }
+
+ ::Components::Cookie *
+ Servant_Impl_Base::subscribe (const char *,
+ ::Components::EventConsumerBase_ptr)
+ {
+ CIAO_TRACE ("Servant_Impl_Base::subscribe");
+ throw CORBA::NO_IMPLEMENT ();
+ }
+
+
+ ::Components::EventConsumerBase_ptr
+ Servant_Impl_Base::unsubscribe (const char *,
+ ::Components::Cookie *)
+ {
+ CIAO_TRACE ("Servant_Impl_Base::unsubscribe");
+ throw CORBA::NO_IMPLEMENT ();
+ }
+
+ void
+ Servant_Impl_Base::connect_consumer (const char *,
+ ::Components::EventConsumerBase_ptr)
+ {
+ CIAO_TRACE ("Servant_Impl_Base::connect_consumer");
+ throw CORBA::NO_IMPLEMENT ();
+ }
+
+ ::Components::EventConsumerBase_ptr
+ Servant_Impl_Base::disconnect_consumer (const char *)
+ {
+ CIAO_TRACE ("Servant_Impl_Base::disconnect_consumer");
+ throw CORBA::NO_IMPLEMENT ();
+ }
+
+ ::Components::EmitterDescriptions *
+ Servant_Impl_Base::get_all_emitters (void)
+ {
+ CIAO_TRACE ("Servant_Impl_Base::get_all_emitters");
+ throw CORBA::NO_IMPLEMENT ();
+ }
+
+ ::Components::PublisherDescriptions *
+ Servant_Impl_Base::get_all_publishers (void)
+ {
+ CIAO_TRACE ("Servant_Impl_Base::get_all_publishers");
+ throw CORBA::NO_IMPLEMENT ();
+ }
+
+ ::CORBA::Boolean
+ Servant_Impl_Base::same_component (::CORBA::Object_ptr)
+ {
+ CIAO_TRACE ("Servant_Impl_Base::same_component");
+ throw CORBA::NO_IMPLEMENT ();
+ }
+
+
+ ::Components::Cookie *
+ Servant_Impl_Base::connect (const char *,
+ ::CORBA::Object_ptr)
+ {
+ CIAO_TRACE ("Servant_Impl_Base::connect");
+ throw CORBA::NO_IMPLEMENT ();
+ }
+
+ ::CORBA::Object_ptr
+ Servant_Impl_Base::disconnect (const char *,
+ ::Components::Cookie *)
+ {
+ CIAO_TRACE ("Servant_Impl_Base::disconnect");
+ throw CORBA::NO_IMPLEMENT ();
+ }
+}
+
diff --git a/modules/CIAO/ciao/Servants/Servant_Impl_Base.h b/modules/CIAO/ciao/Servants/Servant_Impl_Base.h
new file mode 100644
index 00000000000..ef6a1c47aa5
--- /dev/null
+++ b/modules/CIAO/ciao/Servants/Servant_Impl_Base.h
@@ -0,0 +1,247 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Servant_Impl_Base.h
+ *
+ * $Id$
+ *
+ * This file contains the non-template declaration of a base class for
+ * the template mixin for the generated servant class.
+ *
+ * @author Jeff Parsons <j.parsons@vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef CIAO_SERVANT_IMPL_BASE_H
+#define CIAO_SERVANT_IMPL_BASE_H
+
+#include /**/ "ace/pre.h"
+
+#include "CIAO_Servant_Impl_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "Home_Servant_Impl_Base.h"
+#include "ciao/Containers/CIAO_Servant_ActivatorC.h"
+
+#include "ace/Hash_Map_Manager_T.h"
+#include "ace/Array_Map.h"
+#include "ccm/CCM_ContainerC.h"
+#include "ccm/CCM_ObjectS.h"
+#include "ccm/CCM_StandardConfiguratorC.h"
+
+
+
+namespace CIAO
+{
+ class Container;
+ typedef Container *Container_ptr;
+ typedef TAO_Objref_Var_T<Container> Container_var;
+
+ namespace Servant {
+ template<typename T_var>
+ void describe_simplex_receptacle (
+ const char *port_name,
+ const char *port_type_repo_id,
+ T_var &connection,
+ ::Components::ReceptacleDescriptions_var &descriptions,
+ CORBA::ULong slot);
+
+ template<typename T_var>
+ void describe_multiplex_receptacle (
+ const char *port_name,
+ const char *port_type_repo_id,
+ ACE_Array_Map<ptrdiff_t, T_var> &objrefs,
+ ::Components::ReceptacleDescriptions_var &descriptions,
+ CORBA::ULong slot);
+
+ template<typename T_var>
+ void describe_pub_event_source (
+ const char *port_name,
+ const char *port_type_repo_id,
+ ACE_Array_Map<ptrdiff_t, T_var> &consumers,
+ ::Components::PublisherDescriptions_var &descriptions,
+ CORBA::ULong slot);
+
+ template<typename T_var>
+ void describe_emit_event_source (
+ const char *port_name,
+ const char *port_type_repo_id,
+ T_var &consumer_ref,
+ ::Components::EmitterDescriptions_var &descriptions,
+ CORBA::ULong slot);
+ } /* Servant */
+
+ /**
+ * @class Servant_Impl_Base
+ *
+ * @brief Non-template base class for Servant_Impl.
+ *
+ * Holds the non-template parts of its child class
+ * Servant_Impl.
+ */
+ class CIAO_Servant_Impl_Export Servant_Impl_Base
+ : public virtual POA_Components::CCMObject
+ {
+ protected:
+ Servant_Impl_Base (Components::CCMHome_ptr home,
+ Home_Servant_Impl_Base *home_servant,
+ Container_ptr c);
+
+ public:
+ virtual ~Servant_Impl_Base (void);
+
+ /// Operations for CCMObject interface.
+
+ virtual ::Components::PrimaryKeyBase * get_primary_key (void);
+
+ virtual CORBA::IRObject_ptr get_component_def (void);
+
+ virtual Components::SessionComponent_ptr get_executor (void);
+
+ virtual void configuration_complete (void);
+
+ virtual void activate_component (void);
+
+ virtual void passivate_component (void);
+
+ virtual ::Components::CCMHome_ptr get_ccm_home (void);
+
+ virtual void remove (void);
+
+ virtual ::Components::ConnectionDescriptions *
+ get_connections (const char *name);
+
+ virtual ::Components::ComponentPortDescription * get_all_ports (void);
+
+ virtual CORBA::Object_ptr provide_facet (const char *name);
+
+ virtual ::Components::FacetDescriptions *
+ get_named_facets (const ::Components::NameList & names);
+
+ virtual ::Components::FacetDescriptions * get_all_facets (void);
+
+ virtual ::Components::ConsumerDescriptions * get_all_consumers (void);
+
+ virtual ::Components::EventConsumerBase_ptr
+ get_consumer (const char *sink_name);
+
+ virtual ::Components::ConsumerDescriptions *
+ get_named_consumers (const ::Components::NameList & names);
+
+ virtual ::Components::EmitterDescriptions *
+ get_named_emitters (const ::Components::NameList & names);
+
+ virtual ::Components::ReceptacleDescriptions *
+ get_named_receptacles (const ::Components::NameList & names);
+
+ virtual ::Components::ReceptacleDescriptions *
+ get_all_receptacles (void);
+
+ virtual ::Components::PublisherDescriptions *
+ get_named_publishers (const ::Components::NameList & names);
+
+ /// Operation to set attributes on the component.
+ virtual void set_attributes (const Components::ConfigValues &descr);
+
+ // Creates and returns the StandardConfigurator for the component.
+ virtual ::Components::StandardConfigurator_ptr
+ get_standard_configurator (void);
+
+ /// Override that returns the (passed-in) default POA of our member
+ /// component's container, to ensure that we get registered
+ /// to that POA when _this() is called.
+ virtual PortableServer::POA_ptr _default_POA (void);
+
+ virtual ::Components::Cookie * subscribe (const char * publisher_name,
+ ::Components::EventConsumerBase_ptr subscriber);
+
+ virtual ::Components::EventConsumerBase_ptr unsubscribe (const char * publisher_name,
+ ::Components::Cookie * ck);
+
+ virtual void connect_consumer (const char * emitter_name,
+ ::Components::EventConsumerBase_ptr consumer);
+
+ virtual ::Components::EventConsumerBase_ptr disconnect_consumer (const char * source_name);
+
+ virtual ::Components::EmitterDescriptions * get_all_emitters (void);
+
+ virtual ::Components::PublisherDescriptions * get_all_publishers (void);
+
+ virtual ::CORBA::Boolean same_component (::CORBA::Object_ptr object_ref);
+
+ virtual ::Components::Cookie * connect (const char * name,
+ ::CORBA::Object_ptr connection);
+
+ virtual ::CORBA::Object_ptr disconnect (const char * name,
+ ::Components::Cookie * ck);
+
+
+ protected:
+ void add_facet (const char *port_name,
+ ::CORBA::Object_ptr port_ref);
+
+ CORBA::Object_ptr lookup_facet (const char *port_name);
+
+ ::Components::FacetDescription *lookup_facet_description (
+ const char *port_name);
+
+ void add_receptacle (const char *receptacle_name,
+ CORBA::Object_ptr recept_ref,
+ ::Components::Cookie * cookie);
+
+ void add_consumer (const char *port_name,
+ ::Components::EventConsumerBase_ptr port_ref);
+
+ ::Components::EventConsumerBase_ptr lookup_consumer (
+ const char *port_name);
+
+ ::Components::ConsumerDescription *lookup_consumer_description (
+ const char *port_name);
+
+ /// Called from generated servant class to help with
+ /// get_all_*() methods.
+
+ protected:
+ typedef ACE_Array_Map<ACE_CString,
+ ::Components::FacetDescription_var>
+ FacetTable;
+
+ typedef ACE_Array_Map<ACE_CString,
+ ::Components::ConsumerDescription_var>
+ ConsumerTable;
+
+ typedef ACE_Hash_Map_Manager_Ex<const char *,
+ ::Components::ReceptacleDescription_var,
+ ACE_Hash<const char *>,
+ ACE_Equal_To<const char *>,
+ ACE_Null_Mutex>
+ ReceptacleTable;
+
+ FacetTable facet_table_;
+ ConsumerTable consumer_table_;
+ ReceptacleTable receptacle_table_;
+ Components::CCMHome_var home_;
+ Home_Servant_Impl_Base *home_servant_;
+ Container_var container_;
+
+ private:
+ /// For internal locking of table reads and writes.
+ TAO_SYNCH_MUTEX lock_;
+ };
+}
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "Servant_Impl_Utils_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Servant_Impl_Utils_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* CIAO_SERVANT_IMPL_T_H */
diff --git a/modules/CIAO/ciao/Servants/Servant_Impl_T.cpp b/modules/CIAO/ciao/Servants/Servant_Impl_T.cpp
new file mode 100644
index 00000000000..8c3b00a09d0
--- /dev/null
+++ b/modules/CIAO/ciao/Servants/Servant_Impl_T.cpp
@@ -0,0 +1,239 @@
+// $Id$
+
+#ifndef CIAO_SERVANT_IMPL_T_C
+#define CIAO_SERVANT_IMPL_T_C
+
+#include "Servant_Impl_T.h"
+#include <ccm/CCM_EntityContextC.h>
+
+namespace CIAO
+{
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename CONTEXT>
+ Servant_Impl<BASE_SKEL, EXEC, CONTEXT>::Servant_Impl (
+ EXEC * exe,
+ Components::CCMHome_ptr home,
+ Home_Servant_Impl_Base *home_servant,
+ Container_ptr c
+ )
+ : Servant_Impl_Base (home, home_servant, c),
+ activated_ (false),
+ configuration_completed_ (false),
+ executor_ (EXEC::_duplicate (exe))
+ {
+ }
+
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename CONTEXT>
+ Servant_Impl<BASE_SKEL, EXEC, CONTEXT>::~Servant_Impl (void)
+ {
+ CIAO_DEBUG ((LM_INFO, "Servant_Impl_T::~Servant_Impl - "
+ "Executor object reference count is %u\n",
+ this->executor_->_refcount_value ()));
+
+ // **********************************************************************
+ /*
+ try
+ {
+ ::Components::SessionComponent_var scom =
+ ::Components::SessionComponent::_narrow (
+ this->executor_.in ()
+ );
+
+ if (! ::CORBA::is_nil (scom.in ()))
+ {
+ scom->ccm_remove ();
+ }
+ }
+ catch (const CORBA::Exception& ex)
+ {
+ }
+ */
+ // *********************************************************************
+
+ this->context_->_remove_ref ();
+ }
+
+ // Operations for CCMObject interface.
+
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename CONTEXT>
+ CORBA::Boolean
+ Servant_Impl<BASE_SKEL, EXEC, CONTEXT>::same_component (
+ CORBA::Object_ptr object_ref
+ )
+ {
+ if (::CORBA::is_nil (object_ref))
+ {
+ throw ::CORBA::BAD_PARAM ();
+ }
+
+ ::CORBA::Object_var the_other =
+ object_ref->_get_component ();
+
+ ::CORBA::Object_var me =
+ this->context_->get_CCM_object ();
+
+ return me->_is_equivalent (the_other.in ());
+
+ }
+
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename CONTEXT>
+ ::Components::CCMHome_ptr
+ Servant_Impl<BASE_SKEL, EXEC, CONTEXT>::get_ccm_home (
+ )
+ {
+ return this->context_->get_CCM_home ();
+ }
+
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename CONTEXT>
+ Components::SessionComponent_ptr
+ Servant_Impl<BASE_SKEL, EXEC, CONTEXT>::get_executor (
+ )
+ {
+ ::Components::SessionComponent_var temp =
+ ::Components::SessionComponent::_narrow (
+ this->executor_.in ()
+ );
+ return temp._retn ();
+ }
+
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename CONTEXT>
+ CORBA::Object_ptr
+ Servant_Impl<BASE_SKEL, EXEC, CONTEXT>::_get_component (
+ )
+ {
+ ::Components::SessionContext_var sc =
+ ::Components::SessionContext::_narrow (
+ this->context_
+ );
+
+ if (! ::CORBA::is_nil (sc.in ()))
+ {
+ return sc->get_CCM_object ();
+ }
+
+ ::Components::EntityContext_var ec =
+ ::Components::EntityContext::_narrow (
+ this->context_
+ );
+
+ if (! ::CORBA::is_nil (ec.in ()))
+ {
+ return ec->get_CCM_object ();
+ }
+
+ throw CORBA::INTERNAL ();
+ }
+
+ // CIAO-specific operations.
+
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename CONTEXT>
+ void
+ Servant_Impl<BASE_SKEL, EXEC, CONTEXT>::activate_component (
+ )
+ {
+ if (this->configuration_completed_ == 1)
+ {
+ this->ciao_activate ();
+ }
+ }
+
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename CONTEXT>
+ void
+ Servant_Impl<BASE_SKEL, EXEC, CONTEXT>::passivate_component (
+ )
+ {
+ if (this->activated_ == 1)
+ {
+ this->ciao_passivate ();
+ }
+ }
+
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename CONTEXT>
+ void
+ Servant_Impl<BASE_SKEL, EXEC, CONTEXT>::configuration_complete (
+ )
+ {
+ ::Components::SessionComponent_var temp =
+ ::Components::SessionComponent::_narrow (
+ this->executor_.in ()
+ );
+
+ if (! ::CORBA::is_nil (temp.in ()))
+ {
+ if (this->configuration_completed_ == 0)
+ {
+ this->configuration_completed_ = 1;
+ temp->configuration_complete ();
+ }
+ }
+ }
+
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename CONTEXT>
+ void
+ Servant_Impl<BASE_SKEL, EXEC, CONTEXT>::ciao_activate ()
+ {
+ ::Components::SessionComponent_var temp =
+ ::Components::SessionComponent::_narrow (
+ this->executor_.in ()
+ );
+
+ if (! ::CORBA::is_nil (temp.in ()))
+ {
+ if (this->activated_ == 0)
+ {
+ this->activated_ = 1;
+ temp->ccm_activate ();
+ }
+ }
+ }
+
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename CONTEXT>
+ CORBA::Boolean
+ Servant_Impl<BASE_SKEL, EXEC, CONTEXT>::is_activated (
+ )
+ {
+ return this->activated_;
+ }
+
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename CONTEXT>
+ void
+ Servant_Impl<BASE_SKEL, EXEC, CONTEXT>::ciao_passivate (
+ )
+ {
+ // @@ Jai, could you please see why this is required?
+ ::Components::SessionComponent_var temp =
+ ::Components::SessionComponent::_narrow (
+ this->executor_.in ()
+ );
+
+ if (! ::CORBA::is_nil (temp.in ()))
+ temp->ccm_passivate ();
+
+ this->activated_ = 0;
+ }
+}
+
+#endif /* CIAO_SERVANT_IMPL_T_C */
diff --git a/modules/CIAO/ciao/Servants/Servant_Impl_T.h b/modules/CIAO/ciao/Servants/Servant_Impl_T.h
new file mode 100644
index 00000000000..10c25af865b
--- /dev/null
+++ b/modules/CIAO/ciao/Servants/Servant_Impl_T.h
@@ -0,0 +1,111 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Servant_Impl_T.h
+ *
+ * $Id$
+ *
+ * This file contains the declaration of a mixin base class for
+ * the generated servant class.
+ *
+ * @authors Boris Kolpackov <boris@dre.vanderbilt.edu>
+ * Jeff Parsons <j.parsons@vanderbilt.edu>
+ */
+//=============================================================================
+
+
+#ifndef CIAO_SERVANT_IMPL_T_H
+#define CIAO_SERVANT_IMPL_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "Servant_Impl_Base.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+namespace CIAO
+{
+ /**
+ * @class Servant_Impl
+ *
+ * @brief Mixin base class for generated servant.
+ *
+ * This class implements navigation and other operations
+ * common to all generated servants.
+ */
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename CONTEXT>
+ class Servant_Impl : public virtual BASE_SKEL,
+ public virtual Servant_Impl_Base
+ {
+ public:
+ Servant_Impl (EXEC * exe,
+ Components::CCMHome_ptr home,
+ Home_Servant_Impl_Base *home_servant,
+ Container_ptr c);
+
+ virtual ~Servant_Impl (void);
+
+ // Operations for CCMObject interface.
+
+ virtual CORBA::Boolean
+ same_component (CORBA::Object_ptr object_ref);
+
+ virtual ::Components::CCMHome_ptr
+ get_ccm_home ();
+
+ virtual CORBA::Object_ptr
+ _get_component ();
+
+ virtual Components::SessionComponent_ptr
+ get_executor ();
+
+ // CIAO-specific operations.
+
+ void
+ configuration_complete ();
+
+ void
+ ciao_activate ();
+
+ /// @@NOTE: The busted operation.
+ void
+ ciao_passivate ();
+
+ CORBA::Boolean
+ is_activated ();
+
+ virtual void
+ activate_component ();
+
+ virtual void
+ passivate_component ();
+
+ protected:
+
+ CORBA::Boolean activated_;
+ CORBA::Boolean configuration_completed_;
+
+ /// Initialized in this constructor.
+ typename EXEC::_var_type executor_;
+
+ /// Initialized in the derived, generated servant constructor.
+ CONTEXT * context_;
+ };
+}
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "Servant_Impl_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Servant_Impl_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* CIAO_SERVANT_IMPL_T_H */
diff --git a/modules/CIAO/ciao/Servants/Servant_Impl_Utils_T.cpp b/modules/CIAO/ciao/Servants/Servant_Impl_Utils_T.cpp
new file mode 100644
index 00000000000..4d4332fd5a8
--- /dev/null
+++ b/modules/CIAO/ciao/Servants/Servant_Impl_Utils_T.cpp
@@ -0,0 +1,182 @@
+// $Id$
+
+#ifndef CIAO_SERVANT_IMPL_UTILS_T_C
+#define CIAO_SERVANT_IMPL_UTILS_T_C
+
+#include "ciao/Servants/Servant_Impl_Base.h"
+#include "ciao/Valuetype_Factories/Cookies.h"
+#include "ciao/Logger/Log_Macros.h"
+
+namespace CIAO
+{
+ template<typename T_var>
+ void
+ Servant::describe_simplex_receptacle (
+ const char *port_name,
+ const char *port_type_repo_id,
+ T_var &connection,
+ ::Components::ReceptacleDescriptions_var &descriptions,
+ CORBA::ULong slot)
+ {
+ CIAO_TRACE ("Servant::describe_simplex_receptacle");
+
+ ::Components::ReceptacleDescription *elem = 0;
+ ACE_NEW_THROW_EX (elem,
+ ::OBV_Components::ReceptacleDescription,
+ CORBA::NO_MEMORY ());
+
+ ::Components::ReceptacleDescription_var safe_elem = elem;
+
+ elem->name (port_name);
+ elem->type_id (port_type_repo_id);
+ elem->is_multiple (false);
+ elem->connections ().length (1UL);
+
+ ::Components::ConnectionDescription *conn = 0;
+ ACE_NEW (conn, ::OBV_Components::ConnectionDescription);
+ ::Components::ConnectionDescription_var safe_conn = conn;
+
+ conn->ck (0);
+ conn->objref (connection.in ());
+
+ elem->connections ()[0UL] = safe_conn._retn ();
+ descriptions[slot] = safe_elem._retn ();
+ }
+
+ template<typename T_var>
+ void
+ Servant::describe_multiplex_receptacle (
+ const char *port_name,
+ const char *port_type_repo_id,
+ ACE_Array_Map<ptrdiff_t, T_var> &objrefs,
+ ::Components::ReceptacleDescriptions_var &descriptions,
+ CORBA::ULong slot
+ )
+ {
+ CIAO_TRACE ("Servant::describe_multiplex_receptacle");
+
+ ::Components::ReceptacleDescription *elem = 0;
+ ACE_NEW_THROW_EX (elem,
+ ::OBV_Components::ReceptacleDescription,
+ CORBA::NO_MEMORY ());
+
+ ::Components::ReceptacleDescription_var safe_elem = elem;
+
+ elem->name (port_name);
+ elem->type_id (port_type_repo_id);
+ elem->is_multiple (true);
+ elem->connections ().length (objrefs.size ());
+
+ CORBA::ULong seq_slot = 0UL;
+ ::Components::ConnectionDescription *conn = 0;
+
+ typedef typename ACE_Array_Map<ptrdiff_t, T_var>::const_iterator
+ CONST_ITERATOR;
+
+ for (CONST_ITERATOR iter = objrefs.begin ();
+ iter != objrefs.end ();
+ ++iter, ++seq_slot)
+ {
+ ACE_NEW_THROW_EX (conn,
+ ::OBV_Components::ConnectionDescription,
+ CORBA::NO_MEMORY ());
+ ::Components::ConnectionDescription_var safe_conn = conn;
+
+ ::Components::Cookie *key_cookie = 0;
+ ACE_NEW_THROW_EX (key_cookie,
+ CIAO::Cookie_Impl (iter->first),
+ CORBA::NO_MEMORY ());
+
+ // Valuetype member set operation calls add_ref.
+ conn->ck (key_cookie);
+ CORBA::remove_ref (key_cookie);
+
+ conn->objref (iter->second.in ());
+
+ elem->connections ()[seq_slot] = safe_conn._retn ();
+ }
+
+ descriptions[slot] = safe_elem._retn ();
+ }
+
+ template<typename T_var>
+ void
+ Servant::describe_pub_event_source (
+ const char *port_name,
+ const char *port_type_repo_id,
+ ACE_Array_Map<ptrdiff_t, T_var> &consumers,
+ ::Components::PublisherDescriptions_var &descriptions,
+ CORBA::ULong slot
+ )
+ {
+ CIAO_TRACE ("Servant::describe_pub_event_source");
+
+ ::Components::PublisherDescription *elem = 0;
+ ACE_NEW_THROW_EX (elem,
+ ::OBV_Components::PublisherDescription,
+ CORBA::NO_MEMORY ());
+
+ ::Components::PublisherDescription_var safe_elem = elem;
+
+ elem->name (port_name);
+ elem->type_id (port_type_repo_id);
+ elem->consumers ().length (consumers.size ());
+
+ ptrdiff_t map_slot = 0UL;
+ ::Components::SubscriberDescription *sub = 0;
+
+ typedef typename ACE_Array_Map<ptrdiff_t, T_var>::const_iterator
+ CONST_ITERATOR;
+
+ for (CONST_ITERATOR iter = consumers.begin ();
+ iter != consumers.end ();
+ ++iter, ++map_slot)
+ {
+ ACE_NEW_THROW_EX (sub,
+ ::OBV_Components::SubscriberDescription,
+ CORBA::NO_MEMORY ());
+ ::Components::SubscriberDescription_var safe_sub = sub;
+
+ ::Components::Cookie *key_cookie = 0;
+ ACE_NEW (key_cookie,
+ CIAO::Cookie_Impl (iter->first));
+
+ // Valuetype member set operation calls add_ref.
+ sub->ck (key_cookie);
+ CORBA::remove_ref (key_cookie);
+
+ sub->consumer (iter->second.in ());
+
+ elem->consumers ()[map_slot] = safe_sub._retn ();
+ }
+
+ descriptions[slot] = safe_elem._retn ();
+ }
+
+ template<typename T_var>
+ void
+ Servant::describe_emit_event_source (
+ const char *port_name,
+ const char *port_type_repo_id,
+ T_var &consumer_ref,
+ ::Components::EmitterDescriptions_var &descriptions,
+ CORBA::ULong slot)
+ {
+ CIAO_TRACE ("Servant::describe_emit_event_source");
+ ::Components::EmitterDescription *elem = 0;
+ ACE_NEW_THROW_EX (elem,
+ ::OBV_Components::EmitterDescription,
+ CORBA::NO_MEMORY ());
+ ::Components::EmitterDescription_var safe_elem = elem;
+
+ elem->name (port_name);
+ elem->type_id (port_type_repo_id);
+
+ // Valuetype 'set' call increments the reference count.
+ elem->consumer (consumer_ref.in ());
+
+ descriptions[slot] = safe_elem._retn ();
+ }
+}
+
+#endif /* CIAO_SERVANT_IMPL_T_C */
diff --git a/modules/CIAO/ciao/Servants/Servants.mpc b/modules/CIAO/ciao/Servants/Servants.mpc
new file mode 100644
index 00000000000..3bce7351c57
--- /dev/null
+++ b/modules/CIAO/ciao/Servants/Servants.mpc
@@ -0,0 +1,57 @@
+// $Id$
+project(CIAO_Port_Activator_stub_idl) : ciaoidldefaults {
+ custom_only = 1
+ idlflags += -Wb,stub_export_include=CIAO_Port_Activator_export.h \
+ -Wb,stub_export_macro=CIAO_PORT_ACTIVATOR_Export \
+ -SS -Sci -Gxhst
+ IDL_Files {
+ CIAO_Port_Activator.idl
+ }
+}
+
+project(CIAO_Port_Activator_stub) : portableserver, ciao_lib {
+ dynamicflags = CIAO_PORT_ACTIVATOR_BUILD_DLL
+ after += CIAO_Port_Activator_stub_idl
+ IDL_Files {
+ }
+ Source_Files {
+ CIAO_Port_ActivatorC.cpp
+ }
+ Header_Files {
+ }
+}
+
+project(CIAO_Servant_Impl) : ciao_servant_activator, ciao_port_activator_stub, ciao_container_base, ccm_svnt, ciao_output {
+ dynamicflags = CIAO_SERVANT_IMPL_BUILD_DLL
+ IDL_Files {
+ }
+
+ Source_Files {
+ Home_Servant_Impl_Base.cpp
+ Home_Servant_Impl_T.cpp
+ Servant_Impl_Base.cpp
+ Servant_Impl_T.cpp
+ StandardConfigurator_Impl.cpp
+ Port_Activator.cpp
+ }
+
+ Template_Files {
+ Servant_Impl_Utils_T.cpp
+ Port_Activator_T.cpp
+ }
+
+ Header_Files {
+ CIAO_Servant_Impl_export.h
+ Home_Servant_Impl_Base.h
+ Home_Servant_Impl_T.h
+ Servant_Impl_Base.h
+ Servant_Impl_T.h
+ StandardConfigurator_Impl.h
+ Port_Activator.h
+ Port_Activator_T.h
+ }
+
+ Inline_Files {
+ Port_Activator.inl
+ }
+}
diff --git a/modules/CIAO/ciao/Servants/StandardConfigurator_Impl.cpp b/modules/CIAO/ciao/Servants/StandardConfigurator_Impl.cpp
new file mode 100644
index 00000000000..59b683fb82b
--- /dev/null
+++ b/modules/CIAO/ciao/Servants/StandardConfigurator_Impl.cpp
@@ -0,0 +1,33 @@
+// StandardConfigurator.cpp,v 1.0 2004/14/04 08:47:46 white Exp
+
+#include "StandardConfigurator_Impl.h"
+#include "Servant_Impl_Base.h"
+
+ACE_RCSID (ciao,
+ StandardConfigurator_Impl,
+ "$Id$")
+
+namespace CIAO
+{
+ StandardConfigurator_Impl::StandardConfigurator_Impl (
+ Servant_Impl_Base* servant)
+ : component_ (servant)
+ {
+ }
+
+ StandardConfigurator_Impl::~StandardConfigurator_Impl (void)
+ {
+ }
+
+ void
+ StandardConfigurator_Impl::set_configuration (
+ const Components::ConfigValues &descr)
+ {
+ this->component_->set_attributes (descr);
+ }
+
+ void
+ StandardConfigurator_Impl::configure (Components::CCMObject_ptr)
+ {
+ }
+}
diff --git a/modules/CIAO/ciao/Servants/StandardConfigurator_Impl.h b/modules/CIAO/ciao/Servants/StandardConfigurator_Impl.h
new file mode 100644
index 00000000000..4f49e216b88
--- /dev/null
+++ b/modules/CIAO/ciao/Servants/StandardConfigurator_Impl.h
@@ -0,0 +1,73 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file StandardConfigurator_Impl.h
+ *
+ * $Id$
+ *
+ * This file contains implementation for the servant of
+ * Components::StandardConfigurator interface.
+ *
+ * @author Jules White <jules@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef CIAO_STANDARDCONFIGURATOR_IMPL_H
+#define CIAO_STANDARDCONFIGURATOR_IMPL_H
+
+# include /**/ "ace/pre.h"
+
+#include "CIAO_Servant_Impl_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ccm/CCM_StandardConfiguratorS.h"
+
+namespace CIAO
+{
+ class Servant_Impl_Base;
+}
+
+namespace CIAO
+{
+ /**
+ * @class StandardConfigurator_Impl
+ *
+ * @brief Servant implementation for Components::StandardConfigurator
+ *
+ * This class implements the Components::StandardConfigurator
+ * interface as defined by the CCM spcification. This class aids
+ * in setting the initial values of component attributes that are
+ * defined in the meta data.
+ */
+ class CIAO_Servant_Impl_Export StandardConfigurator_Impl
+ : public virtual POA_Components::StandardConfigurator
+ {
+ public:
+ /// Constructor
+ StandardConfigurator_Impl (Servant_Impl_Base* toconfigure);
+
+ /// Destructor
+ virtual ~StandardConfigurator_Impl (void);
+
+ /// This method will call set_attributes on the component that is
+ /// being configured, i.e, the template method from
+ /// StandardConfigurator interface.
+ virtual void set_configuration (const Components::ConfigValues & descr);
+
+ void configure (Components::CCMObject_ptr comp);
+
+ private:
+ /// The component whose attributes are going to be configured via
+ /// set_attributes
+ Servant_Impl_Base* const component_;
+ };
+
+}
+
+#include /**/ "ace/post.h"
+
+#endif /* CIAO_STANDARDCONFIGURATOR_IMPL_H */
diff --git a/modules/CIAO/ciao/Server_init.cpp b/modules/CIAO/ciao/Server_init.cpp
new file mode 100644
index 00000000000..1c8fe5499f7
--- /dev/null
+++ b/modules/CIAO/ciao/Server_init.cpp
@@ -0,0 +1,281 @@
+// $Id$
+
+#include "Server_init.h"
+
+#include <ccm/CCM_ComponentC.h>
+#include <ccm/CCM_StandardConfiguratorC.h>
+#include "Valuetype_Factories/Cookies.h"
+#include "ciao/Logger/Log_Macros.h"
+#include "Client_init.h"
+#include "ace/Tokenizer_T.h"
+
+namespace CIAO
+{
+ int
+ Server_init (CORBA::ORB_ptr o)
+ {
+ Client_init (o);
+ CIAO_REGISTER_VALUE_FACTORY (o,
+ CIAO::Cookie_Impl_init,
+ Components::Cookie);
+ return 0;
+ }
+
+ namespace Utility
+ {
+ int write_IOR (const ACE_TCHAR *pathname, const char *ior)
+ {
+ FILE* ior_output_file_ = ACE_OS::fopen (pathname, ACE_TEXT("w"));
+
+ if (ior_output_file_)
+ {
+ ACE_OS::fprintf (ior_output_file_,
+ "%s",
+ ior);
+ ACE_OS::fclose (ior_output_file_);
+ return 0;
+ }
+
+ return -1;
+ }
+
+ // --------------------------------------------------------------
+ // Implementation of NameUtility class
+ // --------------------------------------------------------------
+ bool NameUtility::bind_name (const char *namestr,
+ CORBA::Object_ptr obj,
+ CosNaming::NamingContextExt_var &root)
+ {
+ if (namestr == 0)
+ {
+ CIAO_ERROR ((LM_WARNING, CLINFO
+ "NameUtility::bind_name - "
+ "called with null name, aborting registration.\n"));
+ return false;
+ }
+
+ CosNaming::Name name;
+ NameUtility::create_name (namestr, name);
+
+ if (name.length () > 1)
+ {
+ // This name has contexts, create them.
+ name.length (name.length () - 1);
+ Utility::NameUtility::create_context_path (root.in (), name);
+ name.length (name.length () + 1);
+ }
+
+ return NameUtility::bind_object_path (root.in (), name, obj);
+ }
+
+ void
+ NameUtility::create_name (const char *namestr, CosNaming::Name &name)
+ {
+ ACE_Auto_Basic_Array_Ptr<char> namebfr (ACE::strnew (namestr));
+ ACE_Tokenizer_T<char> tok (namebfr.get ());
+
+ tok.delimiter ('/');
+
+ for (char *p = tok.next (); p; p=tok.next ())
+ {
+ CORBA::ULong const pos = name.length ();
+ name.length (pos + 1);
+ name[pos].id = CORBA::string_dup (p);
+ }
+ }
+
+ void NameUtility::create_context_path (const CosNaming::NamingContextExt_ptr nc,
+ const CosNaming::Name& name)
+ {
+ bool isNotFound = false;
+ CORBA::ULong lengthMissing = 0;
+ CORBA::ULong const OriginalLength = name.length ();
+ CosNaming::Name tmpName;
+ CosNaming::NamingContext_var tmpCtxVar;
+
+ try
+ {
+ tmpCtxVar = nc->bind_new_context (name);
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "NameUtility::CreateContextPath - Bound Context.\n\n"));
+ }
+ catch (const CosNaming::NamingContext::AlreadyBound&)
+ {
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "NameUtility::CreateContextPath - Context Already Bound.\n\n"));
+ }
+ catch (const CosNaming::NamingContext::NotFound& nf)
+ {
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "NameUtility::CreateContextPath - Context not found.\n\n"));
+ isNotFound = true;
+ lengthMissing = nf.rest_of_name.length ();
+ }
+
+ if (lengthMissing == name.length ())
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "NameUtility::CreateContextPath - Null name length.\n\n"));
+ }
+
+ if (isNotFound)
+ {
+ for (CORBA::ULong l = OriginalLength - lengthMissing;
+ l < OriginalLength;
+ ++l)
+ {
+ tmpName.length (l + 1);
+
+ for (CORBA::ULong i = 0; i <= l; ++i)
+ {
+ tmpName[i] = name[i];
+
+ CORBA::String_var newSCName = nc->to_string (tmpName);
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "NameUtility::CreateContextPath - What's left of the name:%C\n",
+ newSCName.in ()));
+ }
+
+ tmpCtxVar = nc->bind_new_context (tmpName);
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "NameUtility::CreateContextPath - Bound New Context.\n"));
+ }
+ }
+ }
+
+ //---------------------------------------------------------------------------------------------
+ bool NameUtility::bind_object_path (const CosNaming::NamingContextExt_ptr nc,
+ const CosNaming::Name& name,
+ const CORBA::Object_ptr obj)
+ {
+ CosNaming::Name tmpName;
+ CORBA::String_var newSCName = nc->to_string (name);
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "NameUtility::BindObjectPath - The name is: %C\n", newSCName.in ()));
+
+ try
+ {
+ nc->rebind(name, obj);
+ }
+
+ catch (const CosNaming::NamingContext::NotFound&)
+ {
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "NameUtility::BindObjectPath - Name not found, doing new bind.\n"));
+ nc->bind (name, obj);
+ }
+ catch (...)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "NameUtility::BindObjectPath - Caught exception while binding name in nameing service.\n"));
+ return false;
+ }
+ return true;
+ }
+
+ //---------------------------------------------------------------------------------------------
+ CosNaming::BindingList *
+ NameUtility::list_bindings (const CosNaming::NamingContext_ptr nc,
+ const CosNaming::Name& name,
+ CORBA::ULong max_list_size)
+ {
+ CosNaming::BindingList_var basicListV;
+ CosNaming::BindingIterator_var bIterV;
+
+ CORBA::Object_var objV;
+ CosNaming::NamingContext_var tmpContextV;
+
+ if (name.length () == 0)
+ {
+ tmpContextV = CosNaming::NamingContext::_duplicate (nc);
+ }
+ else
+ {
+ objV = nc->resolve (name);
+ tmpContextV = CosNaming::NamingContext::_narrow (objV.in ());
+ }
+
+ if (CORBA::is_nil (tmpContextV.in ()))
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "NameUtility::listBindings: Nil context.\n"));
+ return 0;
+ }
+
+ tmpContextV->list(max_list_size, basicListV.out (), bIterV.out ());
+
+ CORBA::Long max_remaining = max_list_size - basicListV->length ();
+ CORBA::Boolean moreBindings = !CORBA::is_nil (bIterV.in ());
+
+ if (moreBindings)
+ {
+ while (moreBindings && (max_remaining > 0) )
+ {
+ CosNaming::BindingList_var tmpListV;
+
+ moreBindings = bIterV->next_n (max_remaining, tmpListV.out ());
+
+ // Append 'tmpListV' to 'basicListV'
+ CORBA::ULong basicListLen = basicListV->length ();
+ basicListV->length (basicListLen+tmpListV->length ());
+
+ for (CORBA::ULong i = 0; i < tmpListV->length (); ++i)
+ {
+ (*basicListV)[i+basicListLen] = (*tmpListV)[i];
+ }
+
+ // Re-calculate 'max_remaining'
+ max_remaining = max_list_size - basicListV->length();
+ }
+
+ bIterV->destroy ();
+ }
+
+ return basicListV._retn ();
+ }
+
+ //---------------------------------------------------------------------------------------------
+ void
+ NameUtility::recursive_unbind (const CosNaming::NamingContext_ptr nc,
+ const CosNaming::Name& name)
+ {
+ CORBA::Object_var objV;
+ CosNaming::NamingContext_var tmpContextV;
+
+ objV = nc->resolve(name);
+ tmpContextV = CosNaming::NamingContext::_narrow (objV.in ());
+
+ if (CORBA::is_nil (tmpContextV.in ()))
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "NameUtility::recursiveUnbind - Nil context reference.\n"));
+ return;
+ }
+
+ CosNaming::BindingList_var blV;
+ CosNaming::Name tmpName;
+ tmpName.length (0);
+
+ blV = NameUtility::list_bindings (tmpContextV.in (),
+ tmpName,
+ 10000); // 'max_list_size'
+
+ for (CORBA::ULong i = 0; i < blV->length (); ++i)
+ {
+ tmpName = (*blV)[i].binding_name;
+
+ if ((*blV)[i].binding_type == CosNaming::nobject)
+ {
+ tmpContextV->unbind(tmpName);
+ }
+ else if ((*blV)[i].binding_type==CosNaming::ncontext)
+ {
+ NameUtility::recursive_unbind (tmpContextV.in (), tmpName);
+ }
+ }
+
+ nc->unbind (name);
+ tmpContextV->destroy ();
+ }
+ } /* namespace Utility */
+} /* namespace CIAO */
diff --git a/modules/CIAO/ciao/Server_init.h b/modules/CIAO/ciao/Server_init.h
new file mode 100644
index 00000000000..bb9e00ede9f
--- /dev/null
+++ b/modules/CIAO/ciao/Server_init.h
@@ -0,0 +1,103 @@
+// $Id$
+
+/**
+ * @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>
+ * @author Gan Deng <dengg@dre.vanderbilt.edu>
+ * @author William R. Otte <wotte@dre.vanderbilt.edu>
+ */
+
+#ifndef CIAO_SERVER_INIT_H
+#define CIAO_SERVER_INIT_H
+
+#include /**/ "ace/pre.h"
+
+#include "CIAO_Server_Export.h"
+
+#if !defined ACE_LACKS_PRAGMA_ONCE
+#pragma once
+#endif /* ! ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/SString.h"
+#include "orbsvcs/CosNamingC.h"
+#include "ccm/CCM_StandardConfiguratorC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+namespace CORBA
+{
+ class ORB;
+ typedef ORB *ORB_ptr;
+}
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+namespace CIAO
+{
+ /**
+ * The initialize routine for any server that need to access
+ * component. This routine now simply registers various valuetype
+ * factories defined in CIAO_Component.pidl. Currently, this method
+ * should be call right after ORB initialization but we should try
+ * 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 ACE_TCHAR *pathname,
+ const char *IOR);
+
+ class CIAO_SERVER_Export NameUtility
+ {
+ /**
+ * A utility class to bind naming context. This class is contributed by
+ * Dipa Suri <dipa.suri@lmco.com>.
+ *
+ * The concept/code are derived from
+ * http://www.informit.com/articles/article.asp?p=23266&seqNum=6
+ */
+
+ public:
+ static bool bind_name (const char *namestr,
+ CORBA::Object_ptr obj,
+ CosNaming::NamingContextExt_var &root);
+
+ static void create_name (const char *namestr, CosNaming::Name &);
+
+ /// For each 'NameComponent' in 'name', create a corresponding 'NamingContext'.
+ static void create_context_path (const CosNaming::NamingContextExt_ptr,
+ const CosNaming::Name &);
+
+ /// For the first [0, length-2] NameComponents of 'name', create a
+ /// corresponding 'NamingContext'.
+ /// For the length-1 NameComponent of 'name', bind it to the object
+ /// reference 'obj'.
+ static bool bind_object_path (const CosNaming::NamingContextExt_ptr,
+ const CosNaming::Name&,
+ const CORBA::Object_ptr);
+
+ /// Get a list of all bindings under the given context, up to
+ /// max_list_size.
+ static CosNaming::BindingList * list_bindings (const CosNaming::NamingContext_ptr,
+ const CosNaming::Name&,
+ CORBA::ULong);
+
+ /// Recursively unbind all objects and contexts below the given name
+ /// context, given the initial context nc.
+ /// Assumes a tree shape to service (not cyclic)
+ static void recursive_unbind (const CosNaming::NamingContext_ptr,
+ const CosNaming::Name&);
+
+ };
+ }
+}
+
+#include /**/ "ace/post.h"
+
+#endif /* CIAO_SERVER_INIT_H */
diff --git a/modules/CIAO/ciao/Valuetype_Factories/ConfigValue.cpp b/modules/CIAO/ciao/Valuetype_Factories/ConfigValue.cpp
new file mode 100644
index 00000000000..30a12b438b3
--- /dev/null
+++ b/modules/CIAO/ciao/Valuetype_Factories/ConfigValue.cpp
@@ -0,0 +1,43 @@
+// $Id$
+#include "ConfigValue.h"
+
+ACE_RCSID (ciao,
+ ConfigValue,
+ "$Id$")
+
+namespace CIAO
+{
+ ConfigValue_impl::ConfigValue_impl()
+ {
+ CORBA::Any any;
+ any <<= CORBA::Short(0);
+ name((const char*)"");
+ value(any);
+ }
+
+
+ ConfigValue_impl::ConfigValue_impl(const char* the_name,
+ const CORBA::Any& the_value)
+ : OBV_Components::ConfigValue()
+ {
+ CORBA::Any any = the_value;
+ name( the_name );
+ value( any );
+ }
+
+ CORBA::ValueBase* ConfigValue_impl::_copy_value()
+ {
+ return new ConfigValue_impl(name(),value());
+ }
+
+ ConfigValue_impl::~ConfigValue_impl()
+ throw ()
+ {
+ }
+
+ CORBA::ValueBase *
+ ConfigValueFactory::create_for_unmarshal ()
+ {
+ return new ConfigValue_impl();
+ }
+}
diff --git a/modules/CIAO/ciao/Valuetype_Factories/ConfigValue.h b/modules/CIAO/ciao/Valuetype_Factories/ConfigValue.h
new file mode 100644
index 00000000000..3592c045f79
--- /dev/null
+++ b/modules/CIAO/ciao/Valuetype_Factories/ConfigValue.h
@@ -0,0 +1,38 @@
+// $Id$
+
+
+#ifndef CIAO_CONFIG_VALUE_H
+#define CIAO_CONFIG_VALUE_H
+#include /**/ "ace/pre.h"
+
+#include "ccm/CCM_StandardConfiguratorC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ConfigValue_Export.h"
+// #include "ace/Active_Map_Manager.h"
+
+namespace CIAO
+{
+ class ConfigValue_Factory_Export ConfigValue_impl
+ : public virtual OBV_Components::ConfigValue,
+ public virtual CORBA::DefaultValueRefCountBase
+ {
+ public:
+ ConfigValue_impl();
+ ConfigValue_impl(const char* the_name, const CORBA::Any& the_value);
+ ~ConfigValue_impl() throw();
+ virtual CORBA::ValueBase* _copy_value();
+ };
+
+ class ConfigValueFactory : virtual public Components::ConfigValue_init
+ {
+ public:
+ CORBA::ValueBase * create_for_unmarshal ();
+ };
+}
+
+#include /**/ "ace/post.h"
+#endif /* CIAO_CONFIG_VALUE_H */
diff --git a/modules/CIAO/ciao/Valuetype_Factories/ConfigValue_Export.h b/modules/CIAO/ciao/Valuetype_Factories/ConfigValue_Export.h
new file mode 100644
index 00000000000..71ec6ce9491
--- /dev/null
+++ b/modules/CIAO/ciao/Valuetype_Factories/ConfigValue_Export.h
@@ -0,0 +1,58 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl ConfigValue_Factory
+// ------------------------------
+#ifndef CONFIGVALUE_FACTORY_EXPORT_H
+#define CONFIGVALUE_FACTORY_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS) && !defined (CONFIGVALUE_FACTORY_HAS_DLL)
+# define CONFIGVALUE_FACTORY_HAS_DLL 0
+#endif /* ACE_AS_STATIC_LIBS && CONFIGVALUE_FACTORY_HAS_DLL */
+
+#if !defined (CONFIGVALUE_FACTORY_HAS_DLL)
+# define CONFIGVALUE_FACTORY_HAS_DLL 1
+#endif /* ! CONFIGVALUE_FACTORY_HAS_DLL */
+
+#if defined (CONFIGVALUE_FACTORY_HAS_DLL) && (CONFIGVALUE_FACTORY_HAS_DLL == 1)
+# if defined (CONFIGVALUE_FACTORY_BUILD_DLL)
+# define ConfigValue_Factory_Export ACE_Proper_Export_Flag
+# define CONFIGVALUE_FACTORY_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define CONFIGVALUE_FACTORY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* CONFIGVALUE_FACTORY_BUILD_DLL */
+# define ConfigValue_Factory_Export ACE_Proper_Import_Flag
+# define CONFIGVALUE_FACTORY_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define CONFIGVALUE_FACTORY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* CONFIGVALUE_FACTORY_BUILD_DLL */
+#else /* CONFIGVALUE_FACTORY_HAS_DLL == 1 */
+# define ConfigValue_Factory_Export
+# define CONFIGVALUE_FACTORY_SINGLETON_DECLARATION(T)
+# define CONFIGVALUE_FACTORY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* CONFIGVALUE_FACTORY_HAS_DLL == 1 */
+
+// Set CONFIGVALUE_FACTORY_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (CONFIGVALUE_FACTORY_NTRACE)
+# if (ACE_NTRACE == 1)
+# define CONFIGVALUE_FACTORY_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define CONFIGVALUE_FACTORY_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !CONFIGVALUE_FACTORY_NTRACE */
+
+#if (CONFIGVALUE_FACTORY_NTRACE == 1)
+# define CONFIGVALUE_FACTORY_TRACE(X)
+#else /* (CONFIGVALUE_FACTORY_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define CONFIGVALUE_FACTORY_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (CONFIGVALUE_FACTORY_NTRACE == 1) */
+
+#endif /* CONFIGVALUE_FACTORY_EXPORT_H */
+
+// End of auto generated file.
diff --git a/modules/CIAO/ciao/Valuetype_Factories/Cookie_Export.h b/modules/CIAO/ciao/Valuetype_Factories/Cookie_Export.h
new file mode 100644
index 00000000000..277717f4d5c
--- /dev/null
+++ b/modules/CIAO/ciao/Valuetype_Factories/Cookie_Export.h
@@ -0,0 +1,58 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl Cookie_Factory
+// ------------------------------
+#ifndef COOKIE_FACTORY_EXPORT_H
+#define COOKIE_FACTORY_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS) && !defined (COOKIE_FACTORY_HAS_DLL)
+# define COOKIE_FACTORY_HAS_DLL 0
+#endif /* ACE_AS_STATIC_LIBS && COOKIE_FACTORY_HAS_DLL */
+
+#if !defined (COOKIE_FACTORY_HAS_DLL)
+# define COOKIE_FACTORY_HAS_DLL 1
+#endif /* ! COOKIE_FACTORY_HAS_DLL */
+
+#if defined (COOKIE_FACTORY_HAS_DLL) && (COOKIE_FACTORY_HAS_DLL == 1)
+# if defined (COOKIE_FACTORY_BUILD_DLL)
+# define Cookie_Factory_Export ACE_Proper_Export_Flag
+# define COOKIE_FACTORY_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define COOKIE_FACTORY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* COOKIE_FACTORY_BUILD_DLL */
+# define Cookie_Factory_Export ACE_Proper_Import_Flag
+# define COOKIE_FACTORY_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define COOKIE_FACTORY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* COOKIE_FACTORY_BUILD_DLL */
+#else /* COOKIE_FACTORY_HAS_DLL == 1 */
+# define Cookie_Factory_Export
+# define COOKIE_FACTORY_SINGLETON_DECLARATION(T)
+# define COOKIE_FACTORY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* COOKIE_FACTORY_HAS_DLL == 1 */
+
+// Set COOKIE_FACTORY_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (COOKIE_FACTORY_NTRACE)
+# if (ACE_NTRACE == 1)
+# define COOKIE_FACTORY_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define COOKIE_FACTORY_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !COOKIE_FACTORY_NTRACE */
+
+#if (COOKIE_FACTORY_NTRACE == 1)
+# define COOKIE_FACTORY_TRACE(X)
+#else /* (COOKIE_FACTORY_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define COOKIE_FACTORY_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (COOKIE_FACTORY_NTRACE == 1) */
+
+#endif /* COOKIE_FACTORY_EXPORT_H */
+
+// End of auto generated file.
diff --git a/modules/CIAO/ciao/Valuetype_Factories/Cookies.cpp b/modules/CIAO/ciao/Valuetype_Factories/Cookies.cpp
new file mode 100644
index 00000000000..0d32ffe9d89
--- /dev/null
+++ b/modules/CIAO/ciao/Valuetype_Factories/Cookies.cpp
@@ -0,0 +1,68 @@
+// $Id$
+
+#include "Cookies.h"
+
+#if !defined (__ACE_INLINE__)
+#include "Cookies.inl"
+#endif /* !defined INLINE */
+
+ACE_RCSID (ciao,
+ Cookies,
+ "$Id$")
+
+namespace CIAO
+{
+ Cookie_Impl::Cookie_Impl (ptrdiff_t const &key)
+ {
+ this->cookieValue ().length (sizeof (ptrdiff_t));
+ ACE_OS::memcpy (this->cookieValue ().get_buffer (false),
+ &key,
+ sizeof (ptrdiff_t));
+ }
+
+ Cookie_Impl::~Cookie_Impl (void)
+ {
+ }
+
+ bool
+ Cookie_Impl::extract (Components::Cookie const * const ck,
+ ptrdiff_t &key)
+ {
+ Cookie_Impl const * const c =
+ dynamic_cast <Cookie_Impl const *> (ck);
+
+ if (c == 0)
+ {
+ return false;
+ }
+
+ CORBA::OctetSeq const &x = c->cookieValue ();
+
+ if (x.length () != sizeof (ptrdiff_t))
+ {
+ return false;
+ }
+
+ key = *reinterpret_cast<const ptrdiff_t*> (x.get_buffer ());
+
+ return true;
+ }
+
+ //========================================================
+
+ CORBA::ValueBase *
+ Cookie_Impl_init::create_for_unmarshal (void)
+ {
+ CORBA::ValueBase *ret_val = 0;
+
+ ACE_NEW_THROW_EX (ret_val,
+ CIAO::Cookie_Impl,
+ CORBA::NO_MEMORY ());
+
+ return ret_val;
+ }
+
+ Cookie_Impl_init::~Cookie_Impl_init (void)
+ {
+ }
+}
diff --git a/modules/CIAO/ciao/Valuetype_Factories/Cookies.h b/modules/CIAO/ciao/Valuetype_Factories/Cookies.h
new file mode 100644
index 00000000000..8fd92b348f8
--- /dev/null
+++ b/modules/CIAO/ciao/Valuetype_Factories/Cookies.h
@@ -0,0 +1,70 @@
+// $Id$
+
+/**
+ * @file Cookies.h
+ *
+ * A CIAO implementation of Cookie valuetype.
+ *
+ * @author Nanbor Wang <nanbor@cs.wustl.edu>
+ */
+
+#ifndef CIAO_COOKIES_H
+#define CIAO_COOKIES_H
+
+#include /**/ "ace/pre.h"
+
+#include "Cookie_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ccm/CCM_CookieC.h"
+
+#include "ace/Active_Map_Manager.h"
+
+namespace CIAO
+{
+ /**
+ * @class Cookie_Impl
+ *
+ * @brief A cookie implementation using an unsigned integer
+ * big enough to hold an address, even on a 64-bit machine.
+ */
+ class Cookie_Factory_Export Cookie_Impl
+ : public virtual OBV_Components::Cookie
+ {
+ public:
+ Cookie_Impl (void);
+ virtual ~Cookie_Impl (void);
+
+ /// Initialize a @c Cookie with a @c ptrdiff_t
+ Cookie_Impl (ptrdiff_t const &key);
+
+ /// Extract the @c CORBA::ULong
+ static bool extract (Components::Cookie const * const c,
+ ptrdiff_t &key);
+ };
+
+ /**
+ * @class Cookie_Impl_init
+ *
+ * @brief Valuefactory implementation for Cookie_Impl.
+ */
+ class Cookie_Factory_Export Cookie_Impl_init
+ : public virtual Components::Cookie_init
+ {
+ public:
+ virtual ~Cookie_Impl_init (void);
+
+ virtual CORBA::ValueBase *create_for_unmarshal (void);
+ };
+}
+
+#if defined (__ACE_INLINE__)
+#include "Cookies.inl"
+#endif /* defined INLINE */
+
+#include /**/ "ace/post.h"
+
+#endif /* CIAO_COOKIES_H */
diff --git a/modules/CIAO/ciao/Valuetype_Factories/Cookies.inl b/modules/CIAO/ciao/Valuetype_Factories/Cookies.inl
new file mode 100644
index 00000000000..406485110c4
--- /dev/null
+++ b/modules/CIAO/ciao/Valuetype_Factories/Cookies.inl
@@ -0,0 +1,10 @@
+/* -*- C++ -*- */
+// $Id$
+
+namespace CIAO
+{
+ ACE_INLINE
+ Cookie_Impl::Cookie_Impl (void)
+ {
+ }
+}
diff --git a/modules/CIAO/ciao/Valuetype_Factories/Factories.mpc b/modules/CIAO/ciao/Valuetype_Factories/Factories.mpc
new file mode 100644
index 00000000000..c03e88e1ec8
--- /dev/null
+++ b/modules/CIAO/ciao/Valuetype_Factories/Factories.mpc
@@ -0,0 +1,23 @@
+//$Id$
+project(CCM_Cookie_Factory) : ccm_stub, ciao_lib {
+ dynamicflags = COOKIE_FACTORY_BUILD_DLL
+ Source_Files {
+ Cookies.cpp
+ }
+ Header_Files {
+ Cookies.h
+ }
+ Inline_Files {
+ Cookies.inl
+ }
+}
+
+project(CCM_ConfigValue_Factory) : ccm_stub, ciao_lib {
+ dynamicflags = CONFIGVALUE_FACTORY_BUILD_DLL
+ Source_Files {
+ ConfigValue.cpp
+ }
+ Header_Files {
+ ConfigValue.h
+ }
+}
diff --git a/modules/CIAO/ciao/Version.h b/modules/CIAO/ciao/Version.h
new file mode 100644
index 00000000000..1b2b41508e5
--- /dev/null
+++ b/modules/CIAO/ciao/Version.h
@@ -0,0 +1,9 @@
+
+// -*- C++ -*-
+// $Id$
+// This is file was automatically generated by \$ACE_ROOT/bin/make_release.
+
+#define CIAO_MAJOR_VERSION 0
+#define CIAO_MINOR_VERSION 7
+#define CIAO_BETA_VERSION 4
+#define CIAO_VERSION "0.7.4"