summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraky <aky@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2011-06-15 19:30:41 +0000
committeraky <aky@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2011-06-15 19:30:41 +0000
commit002a35c976740817a6fe39ae9ce4370325981b14 (patch)
tree3b134798f245a78f475e1f9fa24096a57dbf4f23
parentaa110a041fecfa6fc0cd4fa6f73c5d31812f28da (diff)
downloadATCD-002a35c976740817a6fe39ae9ce4370325981b14.tar.gz
Wed Jun 15 19:29:26 UTC 2011 Akshay V. Dabholkar <aky@dre.vanderbilt.edu>
-rw-r--r--CIAO/CIAO_TAO_DAnCE.mwc3
-rw-r--r--CIAO/ciao/Contexts/Swapping/CIAO_UpgradeableContext.idl17
-rw-r--r--CIAO/ciao/Contexts/Swapping/Upgradeable_Context_Impl_T.cpp69
-rw-r--r--CIAO/ciao/Contexts/Swapping/Upgradeable_Context_Impl_T.h76
-rw-r--r--CIAO/ciao/Servants/Swapping/CIAO_SwapExec.idl12
-rw-r--r--CIAO/ciao/Servants/Swapping/CIAO_Swapping_Servant_export.h58
-rw-r--r--CIAO/ciao/Servants/Swapping/Dynamic_Component_Servant_Base.cpp28
-rw-r--r--CIAO/ciao/Servants/Swapping/Dynamic_Component_Servant_Base.h54
-rw-r--r--CIAO/ciao/Servants/Swapping/Dynamic_Component_Servant_T.cpp87
-rw-r--r--CIAO/ciao/Servants/Swapping/Dynamic_Component_Servant_T.h85
-rw-r--r--CIAO/ciao/Servants/Swapping/Swapping_Servant_Home_Impl_Base.cpp31
-rw-r--r--CIAO/ciao/Servants/Swapping/Swapping_Servant_Home_Impl_Base.h63
-rw-r--r--CIAO/ciao/Servants/Swapping/Swapping_Servant_Home_Impl_T.cpp213
-rw-r--r--CIAO/ciao/Servants/Swapping/Swapping_Servant_Home_Impl_T.h121
-rw-r--r--CIAO/ciao/Servants/Swapping/Swapping_Servants.mpc6
15 files changed, 923 insertions, 0 deletions
diff --git a/CIAO/CIAO_TAO_DAnCE.mwc b/CIAO/CIAO_TAO_DAnCE.mwc
index f34144eb1b4..c6846762221 100644
--- a/CIAO/CIAO_TAO_DAnCE.mwc
+++ b/CIAO/CIAO_TAO_DAnCE.mwc
@@ -14,6 +14,9 @@ workspace {
$(TAO_ROOT)/orbsvcs/orbsvcs/CosNaming_Skel.mpc
$(TAO_ROOT)/orbsvcs/Naming_Service
$(TAO_ROOT)/orbsvcs/orbsvcs/Svc_Utils.mpc
+ $(TAO_ROOT)/orbsvcs/orbsvcs/RTEvent.mpc
+ $(TAO_ROOT)/orbsvcs/orbsvcs/RTEvent_Serv.mpc
+ $(TAO_ROOT)/orbsvcs/orbsvcs/RTEvent_Skel.mpc
ccm
ciao
$(DANCE_ROOT)
diff --git a/CIAO/ciao/Contexts/Swapping/CIAO_UpgradeableContext.idl b/CIAO/ciao/Contexts/Swapping/CIAO_UpgradeableContext.idl
new file mode 100644
index 00000000000..98bb309d39c
--- /dev/null
+++ b/CIAO/ciao/Contexts/Swapping/CIAO_UpgradeableContext.idl
@@ -0,0 +1,17 @@
+// $Id$
+
+#include "ccm/CCM_Container.idl"
+#include "tao/PortableServer/PortableServer_include.pidl"
+
+module CIAO
+{
+ local interface UpgradeableContext : ::Components::SessionContext
+ {
+ ::Components::ConsumerDescriptions get_registered_consumers
+ (in ::Components::FeatureName publisher_name)
+ raises (::Components::InvalidName, ::Components::InvalidConnection);
+ void deactivate_facet (in PortableServer::ObjectId oid);
+ void update_port_activator (in PortableServer::ObjectId oid);
+ void remove_facet (in Object reference);
+ };
+};
diff --git a/CIAO/ciao/Contexts/Swapping/Upgradeable_Context_Impl_T.cpp b/CIAO/ciao/Contexts/Swapping/Upgradeable_Context_Impl_T.cpp
new file mode 100644
index 00000000000..839700d77c3
--- /dev/null
+++ b/CIAO/ciao/Contexts/Swapping/Upgradeable_Context_Impl_T.cpp
@@ -0,0 +1,69 @@
+// $Id$
+
+#ifndef CIAO_UPGRADEABLE_CONTEXT_IMPL_T_C
+#define CIAO_UPGRADEABLE_CONTEXT_IMPL_T_C
+
+#include "Upgradeable_Context_Impl_T.h"
+
+#include "ciao/Servant_Activator.h"
+
+namespace CIAO
+{
+ template <typename BASE_CTX,
+ typename SVNT,
+ typename COMP>
+ Upgradeable_Context_Impl<BASE_CTX, SVNT, COMP>::Upgradeable_Context_Impl (
+ Components::CCMHome_ptr the_home,
+ Session_Container *c,
+ SVNT *sv)
+ : Context_Impl<BASE_CTX, SVNT, COMP> (the_home, c, sv)
+ {
+ }
+
+ template <typename BASE_CTX,
+ typename SVNT,
+ typename COMP>
+ Upgradeable_Context_Impl<BASE_CTX, SVNT, COMP>::~Upgradeable_Context_Impl (void)
+ {
+ }
+
+ template <typename BASE_CTX,
+ typename SVNT,
+ typename COMP>
+ void
+ Upgradeable_Context_Impl<BASE_CTX, SVNT, COMP>::deactivate_facet (
+ const PortableServer::ObjectId &oid)
+ {
+ this->container_->deactivate_facet (oid);
+ }
+
+ template <typename BASE_CTX,
+ typename SVNT,
+ typename COMP>
+ void
+ Upgradeable_Context_Impl<BASE_CTX, SVNT, COMP>::remove_facet (
+ CORBA::Object_ptr reference)
+ {
+ PortableServer::ObjectId_var oid =
+ this->container_->the_facet_cons_POA ()->reference_to_id (reference);
+
+ this->update_port_activator (oid.in ());
+
+ this->deactivate_facet (oid.in ());
+ }
+
+ template <typename BASE_CTX,
+ typename SVNT,
+ typename COMP>
+ void
+ Upgradeable_Context_Impl<BASE_CTX, SVNT, COMP>::update_port_activator (
+ const PortableServer::ObjectId &oid)
+ {
+ CIAO::Servant_Activator *sa =
+ this->container_->ports_servant_activator ();
+ sa->update_port_activator (oid);
+ }
+
+}
+
+#endif /* CIAO_UPGRADEABLE_CONTEXT_IMPL_T_C */
diff --git a/CIAO/ciao/Contexts/Swapping/Upgradeable_Context_Impl_T.h b/CIAO/ciao/Contexts/Swapping/Upgradeable_Context_Impl_T.h
new file mode 100644
index 00000000000..d51d8483b35
--- /dev/null
+++ b/CIAO/ciao/Contexts/Swapping/Upgradeable_Context_Impl_T.h
@@ -0,0 +1,76 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Upgradeable_Context_Impl_T.h
+ *
+ * $Id$
+ *
+ */
+//=============================================================================
+
+
+#ifndef CIAO_UPGRADEABLE_CONTEXT_IMPL_T_H
+#define CIAO_UPGRADEABLE_CONTEXT_IMPL_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "ciao/CIAO_UpgradeableContextC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ciao/Context_Impl_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+namespace CORBA
+{
+ class SystemException;
+}
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+namespace CIAO
+{
+ template <typename BASE_CTX,
+ typename SVNT,
+ typename COMP>
+ class Upgradeable_Context_Impl
+ : public virtual Context_Impl<BASE_CTX, SVNT, COMP>
+ {
+ public:
+ Upgradeable_Context_Impl (Components::CCMHome_ptr the_home,
+ Session_Container *c,
+ SVNT *sv);
+
+ virtual ~Upgradeable_Context_Impl (void);
+
+ virtual void
+ deactivate_facet (const PortableServer::ObjectId &oid);
+
+ virtual void
+ update_port_activator (const PortableServer::ObjectId &oid);
+
+ virtual void
+ remove_facet (CORBA::Object_ptr reference);
+
+ virtual ::Components::ConsumerDescriptions *
+ get_registered_consumers (const char *publisher_name) = 0;
+
+ private:
+ /// Not to be used
+ Upgradeable_Context_Impl (void);
+ };
+}
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "Upgradeable_Context_Impl_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Upgradeable_Context_Impl_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* CIAO_UPGRADEABLE_CONTEXT_IMPL_T_H */
diff --git a/CIAO/ciao/Servants/Swapping/CIAO_SwapExec.idl b/CIAO/ciao/Servants/Swapping/CIAO_SwapExec.idl
new file mode 100644
index 00000000000..b52f7db782a
--- /dev/null
+++ b/CIAO/ciao/Servants/Swapping/CIAO_SwapExec.idl
@@ -0,0 +1,12 @@
+// $Id$
+
+#include "ccm/CCM_EnterpriseComponent.idl"
+
+module CIAO
+{
+ local interface Swap_Exec : ::Components::EnterpriseComponent
+ {
+ Components::EnterpriseComponent incarnate ();
+ Components::EnterpriseComponent etherealize ();
+ };
+};
diff --git a/CIAO/ciao/Servants/Swapping/CIAO_Swapping_Servant_export.h b/CIAO/ciao/Servants/Swapping/CIAO_Swapping_Servant_export.h
new file mode 100644
index 00000000000..672c412e343
--- /dev/null
+++ b/CIAO/ciao/Servants/Swapping/CIAO_Swapping_Servant_export.h
@@ -0,0 +1,58 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl CIAO_Swapping_Servant
+// ------------------------------
+#ifndef CIAO_SWAPPING_SERVANT_EXPORT_H
+#define CIAO_SWAPPING_SERVANT_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS) && !defined (CIAO_SWAPPING_SERVANT_HAS_DLL)
+# define CIAO_SWAPPING_SERVANT_HAS_DLL 0
+#endif /* ACE_AS_STATIC_LIBS && CIAO_SWAPPING_SERVANT_HAS_DLL */
+
+#if !defined (CIAO_SWAPPING_SERVANT_HAS_DLL)
+# define CIAO_SWAPPING_SERVANT_HAS_DLL 1
+#endif /* ! CIAO_SWAPPING_SERVANT_HAS_DLL */
+
+#if defined (CIAO_SWAPPING_SERVANT_HAS_DLL) && (CIAO_SWAPPING_SERVANT_HAS_DLL == 1)
+# if defined (CIAO_SWAPPING_SERVANT_BUILD_DLL)
+# define CIAO_Swapping_Servant_Export ACE_Proper_Export_Flag
+# define CIAO_SWAPPING_SERVANT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define CIAO_SWAPPING_SERVANT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* CIAO_SWAPPING_SERVANT_BUILD_DLL */
+# define CIAO_Swapping_Servant_Export ACE_Proper_Import_Flag
+# define CIAO_SWAPPING_SERVANT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define CIAO_SWAPPING_SERVANT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* CIAO_SWAPPING_SERVANT_BUILD_DLL */
+#else /* CIAO_SWAPPING_SERVANT_HAS_DLL == 1 */
+# define CIAO_Swapping_Servant_Export
+# define CIAO_SWAPPING_SERVANT_SINGLETON_DECLARATION(T)
+# define CIAO_SWAPPING_SERVANT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* CIAO_SWAPPING_SERVANT_HAS_DLL == 1 */
+
+// Set CIAO_SWAPPING_SERVANT_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (CIAO_SWAPPING_SERVANT_NTRACE)
+# if (ACE_NTRACE == 1)
+# define CIAO_SWAPPING_SERVANT_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define CIAO_SWAPPING_SERVANT_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !CIAO_SWAPPING_SERVANT_NTRACE */
+
+#if (CIAO_SWAPPING_SERVANT_NTRACE == 1)
+# define CIAO_SWAPPING_SERVANT_TRACE(X)
+#else /* (CIAO_SWAPPING_SERVANT_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define CIAO_SWAPPING_SERVANT_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (CIAO_SWAPPING_SERVANT_NTRACE == 1) */
+
+#endif /* CIAO_SWAPPING_SERVANT_EXPORT_H */
+
+// End of auto generated file.
diff --git a/CIAO/ciao/Servants/Swapping/Dynamic_Component_Servant_Base.cpp b/CIAO/ciao/Servants/Swapping/Dynamic_Component_Servant_Base.cpp
new file mode 100644
index 00000000000..5127e369f92
--- /dev/null
+++ b/CIAO/ciao/Servants/Swapping/Dynamic_Component_Servant_Base.cpp
@@ -0,0 +1,28 @@
+#include "ciao/Servants/Swapping/Dynamic_Component_Servant_Base.h"
+
+ACE_RCSID (ciao,
+ Dynamic_Component_Servant_Base,
+ "$Id$")
+
+namespace CIAO
+{
+ Dynamic_Component_Servant_Base::Dynamic_Component_Servant_Base (void)
+ : container_ (0)
+ {
+ // 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);
+ }
+
+ Dynamic_Component_Servant_Base::Dynamic_Component_Servant_Base
+ (Session_Container * c)
+ : container_ (c)
+ {
+ }
+
+ Dynamic_Component_Servant_Base::~Dynamic_Component_Servant_Base (void)
+ {
+ }
+}
diff --git a/CIAO/ciao/Servants/Swapping/Dynamic_Component_Servant_Base.h b/CIAO/ciao/Servants/Swapping/Dynamic_Component_Servant_Base.h
new file mode 100644
index 00000000000..75f32819036
--- /dev/null
+++ b/CIAO/ciao/Servants/Swapping/Dynamic_Component_Servant_Base.h
@@ -0,0 +1,54 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Dynamic_Component_Servant_Base.h
+ *
+ * $Id$
+ *
+ */
+//=============================================================================
+
+#ifndef CIAO_DYNAMIC_COMPONENT_SERVANT_BASE__H
+#define CIAO_DYNAMIC_COMPONENT_SERVANT_BASE__H
+
+#include /**/ "ace/pre.h"
+
+#include "ciao/Servants/Swapping/CIAO_Swapping_Servant_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/PortableServer.h"
+
+namespace CIAO
+{
+ class Session_Container;
+
+ class CIAO_Swapping_Servant_Export Dynamic_Component_Servant_Base
+ {
+ public:
+ /// @todo Not to be used, no idea why this should be public, have to check this
+ Dynamic_Component_Servant_Base (void);
+
+ explicit Dynamic_Component_Servant_Base (Session_Container *c);
+
+ virtual ~Dynamic_Component_Servant_Base (void);
+
+ virtual PortableServer::Servant
+ create (PortableServer::ObjectId &oid) = 0;
+
+ virtual void destroy (PortableServer::ObjectId &oid) = 0;
+
+ virtual void update_destroy_count () = 0;
+
+ protected:
+ Session_Container *container_;
+ };
+
+}
+
+#include /**/ "ace/post.h"
+
+#endif /* CIAO_DYNAMIC_COMPONENT_SERVANT_BASE__H */
diff --git a/CIAO/ciao/Servants/Swapping/Dynamic_Component_Servant_T.cpp b/CIAO/ciao/Servants/Swapping/Dynamic_Component_Servant_T.cpp
new file mode 100644
index 00000000000..a23f8559c89
--- /dev/null
+++ b/CIAO/ciao/Servants/Swapping/Dynamic_Component_Servant_T.cpp
@@ -0,0 +1,87 @@
+// $Id$
+
+#ifndef CIAO_DYNAMIC_COMPONENT_SERVANT_T_C
+#define CIAO_DYNAMIC_COMPONENT_SERVANT_T_C
+
+#include "Dynamic_Component_Servant_T.h"
+
+namespace CIAO
+{
+ template <typename COMP_SVNT>
+ Dynamic_Component_Servant<COMP_SVNT>::Dynamic_Component_Servant (
+ Components::EnterpriseComponent_ptr ec,
+ Components::CCMHome_ptr home,
+ const char* ins_name,
+ Home_Servant_Impl_Base *home_servant,
+ Session_Container *c)
+ : Dynamic_Component_Servant_Base (c)
+ , executor_ (Components::EnterpriseComponent::_duplicate (ec))
+ , ins_name_ (ins_name)
+ , home_servant_ (home_servant)
+ , home_ (Components::CCMHome::_duplicate (home))
+ , component_removed_ (false)
+ {
+ }
+
+ template <typename COMP_SVNT>
+ void Dynamic_Component_Servant<COMP_SVNT>::update_destroy_count (void)
+ {
+ component_removed_ = true;
+ }
+
+ template <typename COMP_SVNT>
+ Dynamic_Component_Servant<COMP_SVNT>::~Dynamic_Component_Servant (void)
+ {
+ }
+
+ template <typename COMP_SVNT>
+ void Dynamic_Component_Servant<COMP_SVNT>::destroy (
+ PortableServer::ObjectId &oid)
+ {
+ // @@Jai, here is a logical problem. You find a servant from a map
+ // having a list of servants and you turn on a bit. What is the
+ // granularity of the bit? Looks like its too coarse. Do you see
+ // what I am saying?
+ COMP_SVNT *servant = 0;
+
+ if (0 == this->servant_map_.find (oid, servant))
+ {
+ servant->remove ();
+ component_removed_ = true;
+ }
+ }
+
+ template <typename COMP_SVNT>
+ PortableServer::Servant Dynamic_Component_Servant<COMP_SVNT>::create (
+ PortableServer::ObjectId &oid)
+ {
+ CIAO::Swap_Exec_var swap_exec =
+ CIAO::Swap_Exec::_narrow (this->executor_.in ());
+
+ ::Components::EnterpriseComponent_var ciao_ec =
+ swap_exec->incarnate ();
+
+ typedef typename COMP_SVNT::_exec_type exec_type;
+ typename COMP_SVNT::_exec_type::_var_type ciao_comp =
+ exec_type::_narrow (ciao_ec.in ());
+
+ /// @@ Jai, should you be using ACE_NEW_THROW_EX here?
+ COMP_SVNT *svt = new COMP_SVNT (ciao_comp.in (),
+ this->home_.in (),
+ this->ins_name_.in (),
+ this->home_servant_,
+ this->container_);
+
+ // @@Jai, see the problem with a coarse grained stuff here.
+ if (component_removed_ == true)
+ {
+ component_removed_ = false;
+ }
+
+ PortableServer::ServantBase_var safe (svt);
+ this->servant_map_.bind (oid, svt);
+ return safe._retn ();
+ }
+}
+
+#endif /* CIAO_DYNAMIC_COMPONENT_SERVANT_T_C */
diff --git a/CIAO/ciao/Servants/Swapping/Dynamic_Component_Servant_T.h b/CIAO/ciao/Servants/Swapping/Dynamic_Component_Servant_T.h
new file mode 100644
index 00000000000..244a51b1891
--- /dev/null
+++ b/CIAO/ciao/Servants/Swapping/Dynamic_Component_Servant_T.h
@@ -0,0 +1,85 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Dynamic_Component_Servant_T.h
+ *
+ * $Id$
+ *
+ * This file contains the declaration of a mixin base class for
+ * the generated home servant class.
+ *
+ */
+//=============================================================================
+
+
+#ifndef CIAO_DYNAMIC_COMPONENT_SERVANT_T_H
+#define CIAO_DYNAMIC_COMPONENT_SERVANT_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "Dynamic_Component_Servant_Base.h"
+#include "CIAO_SwapExecC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/Key_Adapters.h"
+#include "ace/Hash_Map_Manager_T.h"
+
+namespace CIAO
+{
+ template <typename COMP_SVNT>
+ class Dynamic_Component_Servant
+ : public virtual Dynamic_Component_Servant_Base
+ {
+ public:
+ // @@Jai, please add documentation for these methods.
+ Dynamic_Component_Servant (Components::EnterpriseComponent_ptr ec,
+ Components::CCMHome_ptr home,
+ const char* ins_name,
+ Home_Servant_Impl_Base *home_servant,
+ Session_Container *c);
+
+ virtual ~Dynamic_Component_Servant (void);
+
+ virtual PortableServer::Servant create (PortableServer::ObjectId &oid);
+
+ virtual void destroy (PortableServer::ObjectId &oid);
+
+ virtual void update_destroy_count (void);
+
+ protected:
+ Components::EnterpriseComponent_var executor_;
+
+ CORBA::String_var ins_name_;
+
+ Home_Servant_Impl_Base *home_servant_;
+
+ Components::CCMHome_var home_;
+
+ // @@ Jai, please document why this is there.
+ ACE_Hash_Map_Manager_Ex<PortableServer::ObjectId,
+ COMP_SVNT *,
+ TAO_ObjectId_Hash,
+ ACE_Equal_To<PortableServer::ObjectId>,
+ TAO_SYNCH_MUTEX>
+ servant_map_;
+
+ // @@ Jai, please explain what this flag means?
+ bool component_removed_;
+ };
+}
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "Dynamic_Component_Servant_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Dynamic_Component_Servant_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* CIAO_DYNAMIC_COMPONENT_SERVANT_T_H */
diff --git a/CIAO/ciao/Servants/Swapping/Swapping_Servant_Home_Impl_Base.cpp b/CIAO/ciao/Servants/Swapping/Swapping_Servant_Home_Impl_Base.cpp
new file mode 100644
index 00000000000..d33d197ee7e
--- /dev/null
+++ b/CIAO/ciao/Servants/Swapping/Swapping_Servant_Home_Impl_Base.cpp
@@ -0,0 +1,31 @@
+// $Id$
+
+#include "Swapping_Servant_Home_Impl_Base.h"
+
+namespace CIAO
+{
+ Swapping_Home_Servant_Impl_Base::Swapping_Home_Servant_Impl_Base (
+ Swapping_Container * c)
+ : container_ (c)
+ {
+ }
+
+ Swapping_Home_Servant_Impl_Base::~Swapping_Home_Servant_Impl_Base (void)
+ {
+ }
+
+ // Operations for CCMHome interface.
+
+ CORBA::IRObject_ptr
+ Swapping_Home_Servant_Impl_Base::get_component_def (void)
+ {
+ throw CORBA::NO_IMPLEMENT ();
+ }
+
+ CORBA::IRObject_ptr
+ Swapping_Home_Servant_Impl_Base::get_home_def (void)
+ {
+ throw CORBA::NO_IMPLEMENT ();
+ }
+
+}
diff --git a/CIAO/ciao/Servants/Swapping/Swapping_Servant_Home_Impl_Base.h b/CIAO/ciao/Servants/Swapping/Swapping_Servant_Home_Impl_Base.h
new file mode 100644
index 00000000000..749eefe4ce7
--- /dev/null
+++ b/CIAO/ciao/Servants/Swapping/Swapping_Servant_Home_Impl_Base.h
@@ -0,0 +1,63 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Swapping_Servant_Home_Impl_Base.h
+ *
+ * $Id$
+ *
+ */
+//=============================================================================
+
+#ifndef CIAO_SWAPPING_SERVANT_HOME_IMPL_BASE_H
+#define CIAO_SWAPPING_SERVANT_HOME_IMPL_BASE_H
+
+#include /**/ "ace/pre.h"
+
+#include "ciao/Servants/Swapping/CIAO_Swapping_Servant_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "CCM_HomeS.h"
+
+namespace CIAO
+{
+ class Swapping_Container;
+
+ /**
+ * @class Swapping_Home_Servant_Impl_Base
+ *
+ */
+ // @@ Jai, why are you inheriting from "home" here? What is the
+ // point?
+ // @@ JAI, probably my class naming convention was the problem.
+ // This is a home implementation and that is why inheriting from
+ // "home".
+ //
+ class CIAO_Swapping_Servant_Export Swapping_Home_Servant_Impl_Base
+ : public virtual POA_Components::CCMHome
+ {
+ public:
+ Swapping_Home_Servant_Impl_Base (Swapping_Container * c);
+
+ virtual ~Swapping_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);
+
+ protected:
+ Swapping_Container *container_;
+
+ private:
+ /// Not to be used
+ Swapping_Home_Servant_Impl_Base (void);
+ };
+}
+
+#include /**/ "ace/post.h"
+
+#endif /* CIAO_SWAPPING_SERVANT_HOME_IMPL_BASE_H */
diff --git a/CIAO/ciao/Servants/Swapping/Swapping_Servant_Home_Impl_T.cpp b/CIAO/ciao/Servants/Swapping/Swapping_Servant_Home_Impl_T.cpp
new file mode 100644
index 00000000000..fbc804ca1aa
--- /dev/null
+++ b/CIAO/ciao/Servants/Swapping/Swapping_Servant_Home_Impl_T.cpp
@@ -0,0 +1,213 @@
+// $Id$
+
+#ifndef CIAO_SWAPPING_SERVANT_IMPL_T_C
+#define CIAO_SWAPPING_SERVANT_IMPL_T_C
+
+#include "ciao/Swapping_Servant_Home_Impl_T.h"
+#include "ciao/Dynamic_Component_Servant_T.h"
+
+namespace CIAO
+{
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename COMP_SVNT>
+ Swapping_Home_Servant_Impl<BASE_SKEL,
+ EXEC,
+ COMP_SVNT>::Swapping_Home_Servant_Impl (
+ typename EXEC::_ptr_type exe,
+ Session_Container * c,
+ const char* ins_name,
+ const char* obj_id,
+ const char* repo_id)
+ : Home_Servant_Impl_Base (c),
+ executor_ (EXEC::_duplicate (exe)),
+ ins_name_ (ins_name),
+ obj_id_ (obj_id),
+ repo_id_ (repo_id)
+ {
+ }
+
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename COMP_SVNT>
+ Swapping_Home_Servant_Impl<BASE_SKEL,
+ EXEC,
+ COMP_SVNT>::~Swapping_Home_Servant_Impl ()
+ {
+ const DYNAMIC_SERVANT_MAP_ITERATOR end =
+ this->dynamic_servant_map_.end ();
+
+ PortableServer::ObjectId_var oid =
+ PortableServer::string_to_ObjectId (this->obj_id_);
+
+ try
+ {
+ this->container_->delete_servant_from_map (oid);
+ }
+ catch (const CORBA::Exception& ex)
+ {
+ ex._tao_print_exception ("~Swapping_Home_Servant_Impl\t\n");
+ }
+
+ for (DYNAMIC_SERVANT_MAP_ITERATOR iter =
+ this->dynamic_servant_map_.begin ();
+ iter != end; ++iter)
+ {
+ (*iter).int_id_->destroy (oid);
+ }
+ }
+
+ // Operations for CCMHome interface.
+
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename COMP_SVNT>
+ void
+ Swapping_Home_Servant_Impl<BASE_SKEL,
+ EXEC,
+ COMP_SVNT>::remove_component (
+ ::Components::CCMObject_ptr
+ )
+ {
+ PortableServer::ObjectId_var oid =
+ PortableServer::string_to_ObjectId (this->obj_id_);
+
+ Dynamic_Component_Servant_Base *servant = 0;
+
+ if (this->dynamic_servant_map_.find (oid.in (), servant) == 0)
+ {
+ servant->destroy (oid);
+ }
+ }
+
+ // Operations for keyless home interface.
+
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename COMP_SVNT>
+ Components::CCMObject_ptr
+ Swapping_Home_Servant_Impl<BASE_SKEL,
+ EXEC,
+ COMP_SVNT>::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
+ Swapping_Home_Servant_Impl<BASE_SKEL,
+ EXEC,
+ COMP_SVNT>::create (
+ )
+ {
+ if (this->executor_.in () == 0)
+ {
+ throw CORBA::INTERNAL ();
+ }
+
+
+ ::Components::EnterpriseComponent_var _ciao_ec =
+ this->executor_->create ();
+
+ return this->_ciao_activate_component (_ciao_ec.in ());
+ }
+
+ // CIAO-specific operations.
+
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename COMP_SVNT>
+ typename COMP_SVNT::_stub_ptr_type
+ Swapping_Home_Servant_Impl<BASE_SKEL,
+ EXEC,
+ COMP_SVNT>::_ciao_activate_component (
+ ::Components::EnterpriseComponent_ptr ec
+ )
+ {
+ CORBA::Object_var hobj =
+ this->container_->get_home_objref (this);
+
+ Components::CCMHome_var home =
+ Components::CCMHome::_narrow (hobj.in ());
+
+ PortableServer::ObjectId_var oid =
+ PortableServer::string_to_ObjectId (this->obj_id_);
+
+ CORBA::Object_var objref =
+ this->container_->generate_reference (
+ this->obj_id_,
+ this->repo_id_,
+ Container::Component);
+
+ Dynamic_Component_Servant_Base *svt =
+ new Dynamic_Component_Servant<COMP_SVNT> (ec,
+ home.in (),
+ this->ins_name_,
+ this,
+ this->container_);
+
+ this->container_->add_servant_to_map (oid, svt);
+
+ this->dynamic_servant_map_.bind (oid.in (), svt);
+
+ typedef typename COMP_SVNT::_stub_type stub_type;
+ typename COMP_SVNT::_stub_var_type ho =
+ stub_type::_narrow (objref.in ());
+
+ return ho._retn ();
+ }
+
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename COMP_SVNT>
+ void
+ Swapping_Home_Servant_Impl<BASE_SKEL,
+ EXEC,
+ COMP_SVNT>::update_component_map (
+ PortableServer::ObjectId &oid)
+ {
+ Dynamic_Component_Servant_Base *servant = 0;
+
+ if (this->dynamic_servant_map_.find (oid, servant) == 0)
+ {
+ servant->update_destroy_count ();
+ this->dynamic_servant_map_.unbind (oid);
+ }
+
+ return;
+ }
+
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename COMP_SVNT>
+ void
+ Swapping_Home_Servant_Impl<BASE_SKEL,
+ EXEC,
+ COMP_SVNT>::_ciao_passivate_component (
+ typename COMP_SVNT::_stub_ptr_type comp
+ )
+ {
+ PortableServer::ObjectId_var oid;
+
+ this->container_->uninstall_component (comp,
+ oid.out ());
+
+ COMP_SVNT *servant = 0;
+
+ if (this->component_map_.find (oid.in (), servant) == 0)
+ {
+ PortableServer::ServantBase_var safe (servant);
+
+ servant->ciao_passivate ();
+
+ this->component_map_.unbind (oid.in ());
+ }
+ }
+}
+
+#endif /* CIAO_SWAPPING_SERVANT_IMPL_T_C */
diff --git a/CIAO/ciao/Servants/Swapping/Swapping_Servant_Home_Impl_T.h b/CIAO/ciao/Servants/Swapping/Swapping_Servant_Home_Impl_T.h
new file mode 100644
index 00000000000..e6c59a6f37d
--- /dev/null
+++ b/CIAO/ciao/Servants/Swapping/Swapping_Servant_Home_Impl_T.h
@@ -0,0 +1,121 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Swapping_Servant_Home_Impl_T.h
+ *
+ * $Id$
+ *
+ * This file contains the declaration of a mixin base class for
+ * the generated home servant class.
+ *
+ */
+//=============================================================================
+
+
+#ifndef CIAO_SWAPPING_SERVANT_HOME_IMPL_T_H
+#define CIAO_SWAPPING_SERVANT_HOME_IMPL_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "ciao/Home_Servant_Impl_Base.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ciao/Dynamic_Component_Servant_Base.h"
+
+#include "tao/PortableServer/Key_Adapters.h"
+
+#include "ace/Hash_Map_Manager_T.h"
+
+namespace CIAO
+{
+ class Session_Container;
+
+ /**
+ * @class Swapping_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 Swapping_Home_Servant_Impl
+ : public virtual BASE_SKEL,
+ public virtual Home_Servant_Impl_Base
+ {
+ public:
+ Swapping_Home_Servant_Impl (typename EXEC::_ptr_type exe,
+ Session_Container * c,
+ const char* ins_name,
+ const char* obj_id,
+ const char* repo_id);
+
+ virtual ~Swapping_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 (::Components::EnterpriseComponent_ptr ec);
+
+ void
+ _ciao_passivate_component (typename COMP_SVNT::_stub_ptr_type comp);
+
+ protected:
+ typename EXEC::_var_type executor_;
+
+ ACE_Hash_Map_Manager_Ex<PortableServer::ObjectId,
+ COMP_SVNT *,
+ TAO_ObjectId_Hash,
+ ACE_Equal_To<PortableServer::ObjectId>,
+ TAO_SYNCH_MUTEX>
+ component_map_;
+
+ typedef ACE_Hash_Map_Manager_Ex<PortableServer::ObjectId,
+ Dynamic_Component_Servant_Base *,
+ TAO_ObjectId_Hash,
+ ACE_Equal_To<PortableServer::ObjectId>,
+ TAO_SYNCH_MUTEX> DYNAMIC_SERVANT_MAP;
+
+ typedef DYNAMIC_SERVANT_MAP::iterator DYNAMIC_SERVANT_MAP_ITERATOR;
+ DYNAMIC_SERVANT_MAP dynamic_servant_map_;
+
+ const char* ins_name_;
+ const char* obj_id_;
+ const char* repo_id_;
+ };
+}
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "Swapping_Servant_Home_Impl_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Swapping_Servant_Home_Impl_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* CIAO_SWAPPING_SERVANT_HOME_IMPL_T_H */
diff --git a/CIAO/ciao/Servants/Swapping/Swapping_Servants.mpc b/CIAO/ciao/Servants/Swapping/Swapping_Servants.mpc
new file mode 100644
index 00000000000..0815af50445
--- /dev/null
+++ b/CIAO/ciao/Servants/Swapping/Swapping_Servants.mpc
@@ -0,0 +1,6 @@
+// $Id$
+
+project(CIAO_Swapping_Servants) : ciao_lib, ciao_container_base, utils, \
+ ccm_componentserver_stub, ciao_servant_activator, ciao_session_container {
+ dynamicflags = CIAO_SWAPPING_SERVANT_BUILD_DLL
+}