summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2004-09-15 03:32:25 +0000
committernobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2004-09-15 03:32:25 +0000
commit745a25326b970083976da352c690b776bcf9b234 (patch)
treef9d3a011e43549d4cb71cf645eb0880ed3a0f70e
parentefb42303c73abc73a13d80a3612ec263ce0c4d6c (diff)
downloadATCD-745a25326b970083976da352c690b776bcf9b234.tar.gz
This commit was manufactured by cvs2svn to create branch
'EC_integration_DAnCE'.
-rw-r--r--TAO/CIAO/DAnCE/ciao/Context_Impl_Base.h106
-rw-r--r--TAO/CIAO/DAnCE/ciao/Context_Impl_T.cpp66
-rw-r--r--TAO/CIAO/DAnCE/ciao/Context_Impl_T.h103
-rw-r--r--TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_Base.cpp39
-rw-r--r--TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_Base.h68
-rw-r--r--TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_T.cpp266
-rw-r--r--TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_T.h120
-rw-r--r--TAO/CIAO/DAnCE/ciao/Port_Activator.cpp28
-rw-r--r--TAO/CIAO/DAnCE/ciao/Port_Activator.h83
-rw-r--r--TAO/CIAO/DAnCE/ciao/Port_Activator_T.cpp68
-rw-r--r--TAO/CIAO/DAnCE/ciao/Port_Activator_T.h80
-rw-r--r--TAO/CIAO/DAnCE/ciao/Servant_Activator.cpp132
-rw-r--r--TAO/CIAO/DAnCE/ciao/Servant_Activator.h104
13 files changed, 1263 insertions, 0 deletions
diff --git a/TAO/CIAO/DAnCE/ciao/Context_Impl_Base.h b/TAO/CIAO/DAnCE/ciao/Context_Impl_Base.h
new file mode 100644
index 00000000000..47177e8fab9
--- /dev/null
+++ b/TAO/CIAO/DAnCE/ciao/Context_Impl_Base.h
@@ -0,0 +1,106 @@
+// -*- 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 "tao/Objref_VarOut_T.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "CIAO_Server_Export.h"
+#include "ciao/CCM_ContainerC.h"
+
+namespace Components
+{
+ class CCMHome;
+ typedef CCMHome *CCMHome_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ CCMHome
+ >
+ CCMHome_var;
+}
+
+namespace CIAO
+{
+ class Session_Container;
+
+ /**
+ * @class Context_Impl_Base
+ *
+ * @brief Non-template base class for Context_Impl.
+ *
+ * Holds the non-template parts of its child class
+ * Context_Impl.
+ */
+ class CIAO_SERVER_Export Context_Impl_Base
+ : public virtual Components::CCMContext
+ {
+ public:
+ Context_Impl_Base (Components::CCMHome_ptr home,
+ Session_Container * c);
+
+ virtual ~Context_Impl_Base (void);
+
+ // Operations from ::Components::CCMContext.
+
+ virtual Components::Principal_ptr
+ get_caller_principal (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual Components::CCMHome_ptr
+ get_CCM_home (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::Boolean
+ get_rollback_only (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::IllegalState));
+
+ virtual Components::Transaction::UserTransaction_ptr
+ get_user_transaction (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::IllegalState));
+
+ virtual CORBA::Boolean
+ is_caller_in_role (const char *role
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void
+ set_rollback_only (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::IllegalState));
+
+ // CIAO-specific.
+
+ CIAO::Session_Container *_ciao_the_Container (void) const;
+
+ protected:
+ Components::CCMHome_var home_;
+ Session_Container *container_;
+ };
+}
+
+#include /**/ "ace/post.h"
+
+#endif /* CIAO_CONTEXT_IMPL_BASE_H */
diff --git a/TAO/CIAO/DAnCE/ciao/Context_Impl_T.cpp b/TAO/CIAO/DAnCE/ciao/Context_Impl_T.cpp
new file mode 100644
index 00000000000..da166b8d174
--- /dev/null
+++ b/TAO/CIAO/DAnCE/ciao/Context_Impl_T.cpp
@@ -0,0 +1,66 @@
+// $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,
+ typename COMP_VAR>
+ Context_Impl<BASE_CTX, SVNT, COMP, COMP_VAR>::Context_Impl (
+ Components::CCMHome_ptr home,
+ Session_Container *c,
+ SVNT *sv)
+ : Context_Impl_Base (home, c),
+ servant_ (sv)
+ {
+ }
+
+ template <typename BASE_CTX,
+ typename SVNT,
+ typename COMP,
+ typename COMP_VAR>
+ Context_Impl<BASE_CTX, SVNT, COMP, COMP_VAR>::~Context_Impl (void)
+ {
+ }
+
+ // Operations from ::Components::SessionContext.
+
+ template <typename BASE_CTX,
+ typename SVNT,
+ typename COMP,
+ typename COMP_VAR>
+ CORBA::Object_ptr
+ Context_Impl<BASE_CTX, SVNT, COMP, COMP_VAR>::get_CCM_object (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::IllegalState))
+ {
+ if (CORBA::is_nil (this->component_.in ()))
+ {
+ CORBA::Object_var obj =
+ this->container_->get_objref (this->servant_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ this->component_ = COMP::_narrow (obj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ if (CORBA::is_nil (this->component_.in ()))
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ CORBA::Object::_nil ());
+ }
+ }
+
+ return COMP::_duplicate (this->component_.in ());
+ }
+}
+
+#endif /* CIAO_CONTEXT_IMPL_T_C */
diff --git a/TAO/CIAO/DAnCE/ciao/Context_Impl_T.h b/TAO/CIAO/DAnCE/ciao/Context_Impl_T.h
new file mode 100644
index 00000000000..2cc2895e23f
--- /dev/null
+++ b/TAO/CIAO/DAnCE/ciao/Context_Impl_T.h
@@ -0,0 +1,103 @@
+// -*- 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 */
+
+namespace CORBA
+{
+ class SystemException;
+}
+
+namespace SecurityLevel2
+{
+ class Credentials;
+}
+
+namespace Components
+{
+ typedef SecurityLevel2::Credentials Principal;
+ typedef Principal *Principal_ptr;
+
+ class IllegalState;
+
+ namespace Transaction
+ {
+ class UserTransaction;
+ typedef UserTransaction *UserTransaction_ptr;
+ }
+}
+
+namespace CIAO
+{
+ class Session_Container;
+
+ /**
+ * @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,
+ typename COMP_VAR>
+ class Context_Impl : public virtual BASE_CTX,
+ public virtual Context_Impl_Base,
+ public virtual TAO_Local_RefCounted_Object
+ {
+ public:
+ Context_Impl (Components::CCMHome_ptr home,
+ Session_Container *c,
+ SVNT *sv);
+
+ virtual ~Context_Impl (void);
+
+ // Operations from ::Components::SessionContext.
+
+ virtual CORBA::Object_ptr
+ get_CCM_object (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::IllegalState));
+
+ protected:
+ SVNT *servant_;
+ COMP_VAR 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/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_Base.cpp b/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_Base.cpp
new file mode 100644
index 00000000000..fcc6d814161
--- /dev/null
+++ b/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_Base.cpp
@@ -0,0 +1,39 @@
+// $Id$
+
+#include "Home_Servant_Impl_Base.h"
+
+namespace CIAO
+{
+ Home_Servant_Impl_Base::Home_Servant_Impl_Base (Session_Container * c)
+ : container_ (c)
+ {
+ }
+
+ Home_Servant_Impl_Base::~Home_Servant_Impl_Base (void)
+ {
+ }
+
+ // Operations for CCMHome interface.
+
+ CORBA::IRObject_ptr
+ Home_Servant_Impl_Base::get_component_def (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (),
+ CORBA::IRObject::_nil ());
+ }
+
+ CORBA::IRObject_ptr
+ Home_Servant_Impl_Base::get_home_def (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (),
+ CORBA::IRObject::_nil ());
+ }
+
+}
+
diff --git a/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_Base.h b/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_Base.h
new file mode 100644
index 00000000000..91a41a32226
--- /dev/null
+++ b/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_Base.h
@@ -0,0 +1,68 @@
+// -*- 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 "CCM_ComponentS.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "CIAO_Server_Export.h"
+
+namespace CIAO
+{
+ class Session_Container;
+
+ /**
+ * @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_SERVER_Export Home_Servant_Impl_Base
+ : public virtual POA_Components::CCMHome
+ {
+ public:
+ Home_Servant_Impl_Base (Session_Container * c);
+
+ virtual ~Home_Servant_Impl_Base (void);
+
+ // Operations for CCMHome interface.
+
+ virtual ::CORBA::IRObject_ptr
+ get_component_def (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual ::CORBA::IRObject_ptr
+ get_home_def (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ protected:
+ Session_Container *container_;
+ };
+}
+
+#include /**/ "ace/post.h"
+
+#endif /* CIAO_HOME_SERVANT_IMPL_BASE_H */
+
diff --git a/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_T.cpp b/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_T.cpp
new file mode 100644
index 00000000000..e12d589655d
--- /dev/null
+++ b/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_T.cpp
@@ -0,0 +1,266 @@
+// $Id$
+
+#ifndef CIAO_HOME_SERVANT_IMPL_T_C
+#define CIAO_HOME_SERVANT_IMPL_T_C
+
+#include "Home_Servant_Impl_T.h"
+
+namespace CIAO
+{
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename EXEC_VAR,
+ typename COMP,
+ typename COMP_VAR,
+ typename COMP_EXEC,
+ typename COMP_EXEC_VAR,
+ typename COMP_SVNT>
+ Home_Servant_Impl<BASE_SKEL,
+ EXEC,
+ EXEC_VAR,
+ COMP,
+ COMP_VAR,
+ COMP_EXEC,
+ COMP_EXEC_VAR,
+ COMP_SVNT>::Home_Servant_Impl (
+ EXEC * exe,
+ Session_Container * c
+ )
+ : Home_Servant_Impl_Base (c),
+ executor_ (EXEC::_duplicate (exe))
+ {
+ }
+
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename EXEC_VAR,
+ typename COMP,
+ typename COMP_VAR,
+ typename COMP_EXEC,
+ typename COMP_EXEC_VAR,
+ typename COMP_SVNT>
+ Home_Servant_Impl<BASE_SKEL,
+ EXEC,
+ EXEC_VAR,
+ COMP,
+ COMP_VAR,
+ COMP_EXEC,
+ COMP_EXEC_VAR,
+ COMP_SVNT>::~Home_Servant_Impl (void)
+ {
+ }
+
+ // Operations for CCMHome interface.
+
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename EXEC_VAR,
+ typename COMP,
+ typename COMP_VAR,
+ typename COMP_EXEC,
+ typename COMP_EXEC_VAR,
+ typename COMP_SVNT>
+ void
+ Home_Servant_Impl<BASE_SKEL,
+ EXEC,
+ EXEC_VAR,
+ COMP,
+ COMP_VAR,
+ COMP_EXEC,
+ COMP_EXEC_VAR,
+ COMP_SVNT>::remove_component (
+ ::Components::CCMObject_ptr comp
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::RemoveFailure))
+ {
+ COMP_VAR _ciao_comp = COMP::_narrow (comp
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (CORBA::is_nil (_ciao_comp.in ()))
+ {
+ ACE_THROW (CORBA::INTERNAL ());
+ }
+
+ _ciao_comp->remove (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->_ciao_passivate_component (_ciao_comp.in ()
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ // Operations for keyless home interface.
+
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename EXEC_VAR,
+ typename COMP,
+ typename COMP_VAR,
+ typename COMP_EXEC,
+ typename COMP_EXEC_VAR,
+ typename COMP_SVNT>
+ Components::CCMObject_ptr
+ Home_Servant_Impl<BASE_SKEL,
+ EXEC,
+ EXEC_VAR,
+ COMP,
+ COMP_VAR,
+ COMP_EXEC,
+ COMP_EXEC_VAR,
+ COMP_SVNT>::create_component (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CreateFailure))
+ {
+ return this->create (ACE_ENV_SINGLE_ARG_PARAMETER);
+ }
+
+ // Operations for implicit home interface.
+
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename EXEC_VAR,
+ typename COMP,
+ typename COMP_VAR,
+ typename COMP_EXEC,
+ typename COMP_EXEC_VAR,
+ typename COMP_SVNT>
+ COMP *
+ Home_Servant_Impl<BASE_SKEL,
+ EXEC,
+ EXEC_VAR,
+ COMP,
+ COMP_VAR,
+ COMP_EXEC,
+ COMP_EXEC_VAR,
+ COMP_SVNT>::create (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CreateFailure))
+ {
+ if (this->executor_.in () == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ COMP::_nil ());
+ }
+
+ ::Components::EnterpriseComponent_var _ciao_ec =
+ this->executor_->create (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (COMP::_nil ());
+
+ COMP_EXEC_VAR _ciao_comp =
+ COMP_EXEC::_narrow (_ciao_ec.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (COMP::_nil ());
+
+ return this->_ciao_activate_component (_ciao_comp.in ()
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ // CIAO-specific operations.
+
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename EXEC_VAR,
+ typename COMP,
+ typename COMP_VAR,
+ typename COMP_EXEC,
+ typename COMP_EXEC_VAR,
+ typename COMP_SVNT>
+ COMP *
+ Home_Servant_Impl<BASE_SKEL,
+ EXEC,
+ EXEC_VAR,
+ COMP,
+ COMP_VAR,
+ COMP_EXEC,
+ COMP_EXEC_VAR,
+ COMP_SVNT>::_ciao_activate_component (
+ COMP_EXEC *exe
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ CORBA::Object_var hobj =
+ this->container_->get_objref (this
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (COMP::_nil ());
+
+ Components::CCMHome_var home =
+ Components::CCMHome::_narrow (hobj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (COMP::_nil ());
+
+ COMP_SVNT *svt = 0;
+ ACE_NEW_RETURN (svt,
+ COMP_SVNT (exe,
+ home.in (),
+ this->container_),
+ COMP::_nil ());
+
+ PortableServer::ServantBase_var safe (svt);
+ PortableServer::ObjectId_var oid;
+
+ CORBA::Object_var objref =
+ this->container_->install_component (svt,
+ oid.out ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (COMP::_nil ());
+
+ COMP_VAR ho = COMP::_narrow (objref.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (COMP::_nil ());
+
+ if (this->component_map_.bind (oid.in (), svt) == 0)
+ {
+ safe._retn ();
+ }
+
+ return ho._retn ();
+ }
+
+ template <typename BASE_SKEL,
+ typename EXEC,
+ typename EXEC_VAR,
+ typename COMP,
+ typename COMP_VAR,
+ typename COMP_EXEC,
+ typename COMP_EXEC_VAR,
+ typename COMP_SVNT>
+ void
+ Home_Servant_Impl<BASE_SKEL,
+ EXEC,
+ EXEC_VAR,
+ COMP,
+ COMP_VAR,
+ COMP_EXEC,
+ COMP_EXEC_VAR,
+ COMP_SVNT>::_ciao_passivate_component (
+ COMP *comp
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ PortableServer::ObjectId_var oid;
+ this->container_->uninstall_component (comp,
+ oid.out ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ COMP_SVNT *servant = 0;
+
+ if (this->component_map_.unbind (oid.in (), servant) == 0)
+ {
+ PortableServer::ServantBase_var safe (servant);
+
+ servant->_ciao_passivate (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ }
+}
+
+#endif /* CIAO_HOME_SERVANT_IMPL_T_C */
diff --git a/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_T.h b/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_T.h
new file mode 100644
index 00000000000..8ff3e858990
--- /dev/null
+++ b/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_T.h
@@ -0,0 +1,120 @@
+// -*- 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 "tao/PortableServer/Key_Adapters.h"
+#include "ace/Hash_Map_Manager_T.h"
+
+namespace CIAO
+{
+ class Session_Container;
+
+ /**
+ * @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 EXEC_VAR,
+ typename COMP,
+ typename COMP_VAR,
+ typename COMP_EXEC,
+ typename COMP_EXEC_VAR,
+ typename COMP_SVNT>
+ class Home_Servant_Impl
+ : public virtual BASE_SKEL,
+ public virtual Home_Servant_Impl_Base,
+ public virtual PortableServer::RefCountServantBase
+ {
+ public:
+ Home_Servant_Impl (EXEC * exe,
+ Session_Container * c);
+
+ virtual ~Home_Servant_Impl (void);
+
+ // Operations for CCMHome interface.
+
+ virtual void
+ remove_component (Components::CCMObject_ptr comp
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::RemoveFailure));
+
+ // Operations for keyless home interface.
+
+ virtual ::Components::CCMObject_ptr
+ create_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CreateFailure));
+
+ // Operations for implicit home interface.
+
+ virtual COMP *
+ create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CreateFailure));
+
+ protected:
+ // CIAO-specific operations.
+
+ COMP *
+ _ciao_activate_component (COMP_EXEC *exe
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void
+ _ciao_passivate_component (COMP *comp
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ protected:
+ EXEC_VAR executor_;
+
+ ACE_Hash_Map_Manager_Ex<PortableServer::ObjectId,
+ COMP_SVNT *,
+ TAO_ObjectId_Hash,
+ ACE_Equal_To<PortableServer::ObjectId>,
+ ACE_SYNCH_MUTEX>
+ component_map_;
+ };
+}
+
+#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/TAO/CIAO/DAnCE/ciao/Port_Activator.cpp b/TAO/CIAO/DAnCE/ciao/Port_Activator.cpp
new file mode 100644
index 00000000000..c9686a23ef3
--- /dev/null
+++ b/TAO/CIAO/DAnCE/ciao/Port_Activator.cpp
@@ -0,0 +1,28 @@
+#include "Port_Activator.h"
+
+ACE_RCSID (ciao,
+ Servant_Activator,
+ "$Id$")
+
+namespace CIAO
+{
+ Port_Activator::Port_Activator (const char *oid,
+ const char *name,
+ Type t)
+ : oid_ (oid)
+ , name_ (name)
+ , t_ (t)
+ {
+ }
+
+ Port_Activator::~Port_Activator (void)
+ {
+ }
+
+ const char*
+ Port_Activator::name (void) const
+ {
+ // @@ TODO, need to be inlined.
+ return this->oid_.in ();
+ }
+}
diff --git a/TAO/CIAO/DAnCE/ciao/Port_Activator.h b/TAO/CIAO/DAnCE/ciao/Port_Activator.h
new file mode 100644
index 00000000000..71245214879
--- /dev/null
+++ b/TAO/CIAO/DAnCE/ciao/Port_Activator.h
@@ -0,0 +1,83 @@
+// -*- 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 "ace/config-lite.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ciao/CIAO_Server_Export.h"
+
+#include "tao/PortableServer/PortableServer.h"
+
+namespace CIAO
+{
+ /**
+ * @class Port_Activator
+ *
+ * @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_SERVER_Export Port_Activator
+ {
+ public:
+ enum Type
+ {
+ Facet,
+ Sink
+ };
+
+ Port_Activator (const char *oid,
+ const char *name,
+ Type t);
+
+ virtual ~Port_Activator (void);
+
+ /// Return the name of port that this activator encapulates.
+ const char* name (void) const;
+
+ /// 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
+ ACE_ENV_ARG_DECL) = 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 conumer or facet.
+ Type t_;
+ };
+}
+
+
+
+#include /**/ "ace/post.h"
+#endif /*CIAO_PORT_ACTIVATOR_H*/
diff --git a/TAO/CIAO/DAnCE/ciao/Port_Activator_T.cpp b/TAO/CIAO/DAnCE/ciao/Port_Activator_T.cpp
new file mode 100644
index 00000000000..f2832290731
--- /dev/null
+++ b/TAO/CIAO/DAnCE/ciao/Port_Activator_T.cpp
@@ -0,0 +1,68 @@
+// $Id$
+#ifndef CIAO_PORT_ACTIVATOR_T_CPP
+#define CIAO_PORT_ACTIVATOR_T_CPP
+
+#include "Port_Activator_T.h"
+#include "tao/CORBA_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::Type t,
+ EXEC *e,
+ CONTEXT *c,
+ COMP_SERV *cc)
+ : Port_Activator (oid, name, t)
+ , executor_ (e)
+ , context_ (c)
+ , comp_serv_ (cc)
+ {
+ }
+
+ 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
+ ACE_ENV_ARG_DECL)
+ {
+ 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::Facet)
+ {
+ CORBA::Object_var tmp =
+ this->comp_serv_->get_facet_executor (this->name_);
+
+ this->executor_ = EXEC::_narrow (tmp.in ());
+ }
+
+ SERVANT *s = 0;
+
+ ACE_NEW_THROW_EX (s,
+ SERVANT (this->executor_,
+ this->context_),
+ CORBA::NO_MEMORY ());
+ return s;
+ }
+
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+}
+
+#endif /*SERVANT_ACTIVATOR_T_CPP*/
diff --git a/TAO/CIAO/DAnCE/ciao/Port_Activator_T.h b/TAO/CIAO/DAnCE/ciao/Port_Activator_T.h
new file mode 100644
index 00000000000..c5f179e01d6
--- /dev/null
+++ b/TAO/CIAO/DAnCE/ciao/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/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
+ {
+ public:
+ typedef SERV SERVANT;
+
+ Port_Activator_T (const char *oid,
+ const char *name,
+ Port_Activator::Type t,
+ EXEC *e,
+ CONTEXT *c,
+ COMP_SERV *cs);
+
+ /// Template method from the base class, please see the base class
+ /// documentation for details.
+ PortableServer::Servant activate (
+ const PortableServer::ObjectId &oid
+ ACE_ENV_ARG_DECL);
+
+ 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/TAO/CIAO/DAnCE/ciao/Servant_Activator.cpp b/TAO/CIAO/DAnCE/ciao/Servant_Activator.cpp
new file mode 100644
index 00000000000..4f6dce18a5c
--- /dev/null
+++ b/TAO/CIAO/DAnCE/ciao/Servant_Activator.cpp
@@ -0,0 +1,132 @@
+#include "Servant_Activator.h"
+#include "CIAO_common.h"
+#include "Port_Activator.h"
+#include "ace/Log_Msg.h"
+#include "ace/OS_NS_string.h"
+
+ACE_RCSID (ciao,
+ Servant_Activator,
+ "$Id$")
+
+namespace CIAO
+{
+ Servant_Activator::Servant_Activator (CORBA::ORB_ptr o)
+ : orb_ (CORBA::ORB::_duplicate (o))
+ // @@ TODO, avoid this magic number
+ , pa_ (64)
+ , slot_index_ (0)
+ {
+ }
+
+ Servant_Activator::~Servant_Activator (void)
+ {
+ {
+ ACE_GUARD (TAO_SYNCH_MUTEX,
+ guard,
+ this->mutex_);
+
+ const unsigned int sz = this->slot_index_;
+
+ for (unsigned int t = 0; t != sz; ++t)
+ {
+ Port_Activator *&tmp = this->pa_[t];
+
+ delete tmp;
+ }
+ }
+ }
+
+ PortableServer::Servant
+ Servant_Activator::incarnate (const PortableServer::ObjectId &oid,
+ PortableServer::POA_ptr
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::ForwardRequest))
+ {
+ CORBA::String_var str =
+ PortableServer::ObjectId_to_string (oid);
+
+ if (CIAO::debug_level () > 10)
+ ACE_DEBUG ((LM_DEBUG,
+ "CIAO (%P|%t) - Servant_Activator::incarnate, "
+ "activating port name [%s] \n",
+ str.in ()));
+
+ {
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ guard,
+ this->mutex_,
+ false);
+
+ const unsigned int sz = this->slot_index_;
+
+ Port_Activator *tmp = 0;
+
+ for (unsigned int t = 0; t != sz; ++t)
+ {
+ if (this->pa_.get (tmp, t) == -1)
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+
+ if (tmp == 0)
+ {
+ if (CIAO::debug_level () > 10)
+ ACE_ERROR ((LM_ERROR,
+ "CIAO (%P|%t) - Servant_Activator::incarnate (),"
+ " value from the array is null \n"));
+ continue;
+ }
+ if (ACE_OS::strcmp (tmp->name (),
+ str.in ()) == 0)
+ // We should try avoiding making outbound calls with the
+ // lock held. Oh well, let us get some sense of sanity in
+ // CIAO to do think about these.
+ return this->pa_[t]->activate (oid
+ ACE_ENV_ARG_PARAMETER);
+ }
+ }
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ void
+ Servant_Activator::etherealize (const PortableServer::ObjectId &,
+ PortableServer::POA_ptr ,
+ PortableServer::Servant ,
+ CORBA::Boolean ,
+ CORBA::Boolean
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ /// Need to investigate what needs to be handled here..
+ }
+
+ bool
+ Servant_Activator::register_port_activator (Port_Activator *pa)
+ {
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ guard,
+ this->mutex_,
+ false);
+
+ // @@ TODO, need to implement a better algorithm here.
+ //
+ if (this->slot_index_ >= this->pa_.size ())
+ this->pa_.size ((this->slot_index_ + 1));
+
+ if (this->pa_.set (pa, this->slot_index_) == 0)
+ {
+ ++this->slot_index_;
+
+ if (CIAO::debug_level () > 10)
+ ACE_DEBUG ((LM_DEBUG,
+ "CIAO (%P|%t) - Servant_Activator::register_port_activator,"
+ " the slot_index_ is [%d] \n",
+ this->slot_index_));
+
+ return true;
+ }
+
+ return false;
+ }
+}
diff --git a/TAO/CIAO/DAnCE/ciao/Servant_Activator.h b/TAO/CIAO/DAnCE/ciao/Servant_Activator.h
new file mode 100644
index 00000000000..4b4fbf65130
--- /dev/null
+++ b/TAO/CIAO/DAnCE/ciao/Servant_Activator.h
@@ -0,0 +1,104 @@
+// -*- 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 "ace/Array_Base.h"
+#include "ciao/CIAO_Server_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/PortableServer.h"
+#include "tao/LocalObject.h"
+
+#if defined(_MSC_VER)
+#if (_MSC_VER >= 1200)
+#pragma warning(push)
+#endif /* _MSC_VER >= 1200 */
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+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_SERVER_Export Servant_Activator
+ : public virtual PortableServer::ServantActivator
+ , public virtual TAO_Local_RefCounted_Object
+ {
+ public:
+ Servant_Activator (CORBA::ORB_ptr o);
+
+ virtual ~Servant_Activator (void);
+
+ /// 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.
+ */
+ PortableServer::Servant incarnate (
+ const PortableServer::ObjectId &oid,
+ PortableServer::POA_ptr poa
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::ForwardRequest));
+
+ void etherealize (const PortableServer::ObjectId &oid,
+ PortableServer::POA_ptr adapter,
+ PortableServer::Servant servant,
+ CORBA::Boolean cleanup_in_progress,
+ CORBA::Boolean remaining_activations
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Local helper methods
+ bool register_port_activator (Port_Activator *pa);
+
+ private:
+ /// Pointer to our ORB
+ CORBA::ORB_var orb_;
+
+ /// @@ This should be changed at some point of time so that we
+ /// don't land up with a linear algorithm
+ typedef ACE_Array_Base<Port_Activator *> 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.
+ ACE_SYNCH_MUTEX mutex_;
+ };
+}
+
+#include /**/ "ace/post.h"
+#endif /*CIAO_SERVANT_ACTIVATOR_H*/