diff options
Diffstat (limited to 'modules/CIAO/ciao/Contexts')
-rw-r--r-- | modules/CIAO/ciao/Contexts/Context.mpc | 16 | ||||
-rw-r--r-- | modules/CIAO/ciao/Contexts/Context_Impl_Base.cpp | 76 | ||||
-rw-r--r-- | modules/CIAO/ciao/Contexts/Context_Impl_Base.h | 106 | ||||
-rw-r--r-- | modules/CIAO/ciao/Contexts/Context_Impl_Base.inl | 24 | ||||
-rw-r--r-- | modules/CIAO/ciao/Contexts/Context_Impl_T.cpp | 63 | ||||
-rw-r--r-- | modules/CIAO/ciao/Contexts/Context_Impl_T.h | 114 | ||||
-rw-r--r-- | modules/CIAO/ciao/Contexts/Context_Impl_export.h | 58 | ||||
-rw-r--r-- | modules/CIAO/ciao/Contexts/Swapping/CIAO_UpgradeableContext.idl | 17 | ||||
-rw-r--r-- | modules/CIAO/ciao/Contexts/Swapping/Upgradeable_Context_Impl_T.cpp | 69 | ||||
-rw-r--r-- | modules/CIAO/ciao/Contexts/Swapping/Upgradeable_Context_Impl_T.h | 76 |
10 files changed, 619 insertions, 0 deletions
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..0db40ef13e0 --- /dev/null +++ b/modules/CIAO/ciao/Contexts/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 "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/Contexts/Swapping/CIAO_UpgradeableContext.idl b/modules/CIAO/ciao/Contexts/Swapping/CIAO_UpgradeableContext.idl new file mode 100644 index 00000000000..98bb309d39c --- /dev/null +++ b/modules/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/modules/CIAO/ciao/Contexts/Swapping/Upgradeable_Context_Impl_T.cpp b/modules/CIAO/ciao/Contexts/Swapping/Upgradeable_Context_Impl_T.cpp new file mode 100644 index 00000000000..839700d77c3 --- /dev/null +++ b/modules/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/modules/CIAO/ciao/Contexts/Swapping/Upgradeable_Context_Impl_T.h b/modules/CIAO/ciao/Contexts/Swapping/Upgradeable_Context_Impl_T.h new file mode 100644 index 00000000000..d51d8483b35 --- /dev/null +++ b/modules/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 */ |