diff options
author | bala <balanatarajan@users.noreply.github.com> | 2000-11-15 00:29:15 +0000 |
---|---|---|
committer | bala <balanatarajan@users.noreply.github.com> | 2000-11-15 00:29:15 +0000 |
commit | c0ddf10d808126ca0378c2e99941697e10908a2f (patch) | |
tree | d1424e0cb07342aef9592c359bb31df40e9d82b9 /TAO/orbsvcs/orbsvcs/FaultTolerance | |
parent | ebd564ca39a019c5c72aca0e4f05ab06a449ed37 (diff) | |
download | ATCD-c0ddf10d808126ca0378c2e99941697e10908a2f.tar.gz |
ChangeLogTag: Tue Nov 14 18:21:29 2000 Balachandran Natarajan <bala@cs.wustl.edu>
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/FaultTolerance')
8 files changed, 283 insertions, 27 deletions
diff --git a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ORBInitializer.cpp b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ORBInitializer.cpp new file mode 100644 index 00000000000..a1c2b16555c --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ORBInitializer.cpp @@ -0,0 +1,82 @@ +// -*- C++ -*- +// +// $Id$ + +#include "FT_ORBInitializer.h" +#include "FT_PolicyFactory.h" +#include "orbsvcs/FT_CORBAC.h" +#include "tao/Exception.h" + + +ACE_RCSID (FaultTolerance, FT_ORBInitializer, "$Id$") +void +TAO_FT_ORBInitializer::pre_init ( + PortableInterceptor::ORBInitInfo_ptr + TAO_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + +} + +void +TAO_FT_ORBInitializer::post_init ( + PortableInterceptor::ORBInitInfo_ptr info + TAO_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->register_policy_factories (info + TAO_ENV_ARG_PARAMETER); + ACE_CHECK; +} + +void +TAO_FT_ORBInitializer::register_policy_factories ( + PortableInterceptor::ORBInitInfo_ptr info + TAO_ENV_ARG_DECL) +{ + // Register the FTCORBA policy factories. + + PortableInterceptor::PolicyFactory_ptr temp_factory = + PortableInterceptor::PolicyFactory::_nil (); + PortableInterceptor::PolicyFactory_var policy_factory; + + TAO_ENV_ARG_DEFN; + + // This policy factory is used for all FTCORBA related policies. + + ACE_NEW_THROW_EX (temp_factory, + TAO_FT_PolicyFactory, + CORBA::NO_MEMORY ( + CORBA::SystemException::_tao_minor_code ( + TAO_DEFAULT_MINOR_CODE, + ENOMEM), + CORBA::COMPLETED_NO)); + ACE_CHECK; + + policy_factory = temp_factory; + + // Bind the same policy factory to all RTCORBA related policy + // types since a single policy factory is used to create each of + // the different types of RTCORBA policies. + + CORBA::PolicyType type = FT::REQUEST_DURATION_POLICY; + info->register_policy_factory (type, + policy_factory.in () + TAO_ENV_ARG_PARAMETER); + ACE_CHECK; + + type = FT::HEARTBEAT_POLICY; + info->register_policy_factory (type, + policy_factory.in () + TAO_ENV_ARG_PARAMETER); + ACE_CHECK; + + type = FT::HEARTBEAT_ENABLED_POLICY; + info->register_policy_factory (type, + policy_factory.in () + TAO_ENV_ARG_PARAMETER); + ACE_CHECK; + + // Transfer ownership of the policy factory to the registry. + (void) policy_factory._retn (); +} diff --git a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ORBInitializer.h b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ORBInitializer.h new file mode 100644 index 00000000000..eba0417afd6 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ORBInitializer.h @@ -0,0 +1,72 @@ +// -*- C++ -*- +// +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// FaultTolerance +// +// = FILENAME +// FT_ORBInitializer.h +// +// = AUTHOR +// Bala Natarajan <bala@cs.wustl.edu> +// +// ============================================================================ + +#ifndef TAO_FT_ORB_INITIALIZER_H +#define TAO_FT_ORB_INITIALIZER_H + +#include "ace/pre.h" + +#include "tao/corbafwd.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/PortableInterceptorC.h" +#include "tao/LocalObject.h" +#include "fault_tol_export.h" + +// This is to remove "inherits via dominance" warnings from MSVC. +// MSVC is being a little too paranoid. +#if defined(_MSC_VER) +#if (_MSC_VER >= 1200) +#pragma warning(push) +#endif /* _MSC_VER >= 1200 */ +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + +/// RTCORBA ORB initializer. +class TAO_FT_Export TAO_FT_ORBInitializer : + public virtual PortableInterceptor::ORBInitializer, + public virtual TAO_Local_RefCounted_Object +{ +public: + + virtual void pre_init (PortableInterceptor::ORBInitInfo_ptr info + TAO_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void post_init (PortableInterceptor::ORBInitInfo_ptr info + TAO_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + +private: + + void register_policy_factories ( + PortableInterceptor::ORBInitInfo_ptr info + TAO_ENV_ARG_DECL); + ///< Register FTCORBA policy factories. + +}; + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +#pragma warning(pop) +#endif /* _MSC_VER */ + +#include "ace/post.h" + +#endif /* TAO_FT_ORB_INITIALIZER_H */ diff --git a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_PolicyFactory.cpp b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_PolicyFactory.cpp new file mode 100644 index 00000000000..38d79c5d6d9 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_PolicyFactory.cpp @@ -0,0 +1,36 @@ +// -*- C++ -*- +// +// $Id$ + +#include "FT_PolicyFactory.h" + +ACE_RCSID (FaultTolerance, FT_PolicyFactory, "$Id$") + +#include "tao/PolicyC.h" + + +CORBA::Policy_ptr +TAO_FT_PolicyFactory::create_policy ( + CORBA::PolicyType type, + const CORBA::Any & + TAO_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + CORBA::PolicyError)) +{ + CORBA::Policy_ptr policy = CORBA::Policy::_nil (); + + TAO_ENV_ARG_DEFN; + + if (type == FT::REQUEST_DURATION_POLICY) + return TAO_FT_Request_Duration_Policy::create (val, + ACE_TRY_ENV); + else if (type == FT::HEARTBEAT_POLICY) + return TAO_FT_Heart_Beat_Policy::create (val, + ACE_TRY_ENV); + else if (type == FT::HEARTBEAT_ENABLED_POLICY) + return TAO_FT_Heart_Beat_Enabled_Policy::create (val, + ACE_TRY_ENV); + + ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_TYPE), + CORBA::Policy::_nil ()); +} diff --git a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_PolicyFactory.h b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_PolicyFactory.h new file mode 100644 index 00000000000..c70ca559a9c --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_PolicyFactory.h @@ -0,0 +1,63 @@ +// -*- C++ -*- +// +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO +// +// = FILENAME +// FT_PolicyFactory.h +// +// = AUTHOR +// Bala Natarajan <bala@cs.wustl.edu> +// +// ============================================================================ + +#ifndef TAO_FT_POLICY_FACTORY_H +#define TAO_FT_POLICY_FACTORY_H + +#include "ace/pre.h" + +#include "tao/corbafwd.h" + + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/PortableInterceptorC.h" +#include "tao/LocalObject.h" + +// This is to remove "inherits via dominance" warnings from MSVC. +// MSVC is being a little too paranoid. +#if defined(_MSC_VER) +#if (_MSC_VER >= 1200) +#pragma warning(push) +#endif /* _MSC_VER >= 1200 */ +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + +/// Policy factory for all RTCORBA related policies. +class TAO_Export TAO_FT_PolicyFactory : + public PortableInterceptor::PolicyFactory, + public TAO_Local_RefCounted_Object +{ +public: + + virtual CORBA::Policy_ptr create_policy (CORBA::PolicyType type, + const CORBA::Any &value + TAO_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + CORBA::PolicyError)); +}; + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +#pragma warning(pop) +#endif /* _MSC_VER */ + + +#include "ace/post.h" + +#endif /* TAO_FT_POLICY_FACTORY_H */ diff --git a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Service_Activate.cpp b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Service_Activate.cpp index cf2ac2e057a..9d57b8448b4 100644 --- a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Service_Activate.cpp +++ b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Service_Activate.cpp @@ -1,8 +1,10 @@ #include "FT_Service_Activate.h" #include "FT_Service_Callbacks.h" +#include "FT_ORBInitializer.h" #include "tao/Service_Callbacks.h" #include "ace/Dynamic_Service.h" + ACE_RCSID(FaultTolerance, FT_Service_Activate, "$Id$") TAO_FT_Service_Activate::TAO_FT_Service_Activate (void) @@ -13,12 +15,37 @@ TAO_FT_Service_Activate::~TAO_FT_Service_Activate (void) { } +int +TAO_FT_Service_Activate::init (int /*argc*/, + ACE_TCHAR *argv[]) +{ + ACE_UNUSED_ARG (argv); + + cout << "Did we get here " <<endl; + PortableInterceptor::ORBInitializer_ptr temp_orb_initializer = + PortableInterceptor::ORBInitializer::_nil (); + PortableInterceptor::ORBInitializer_var orb_initializer; + + // Register the RTCORBA ORBInitializer. + ACE_NEW_RETURN (temp_orb_initializer, + TAO_FT_ORBInitializer, + -1); + + orb_initializer = temp_orb_initializer; + + PortableInterceptor::register_orb_initializer (orb_initializer.in ()); + + return 0; +} + + TAO_Service_Callbacks * TAO_FT_Service_Activate::activate_services (TAO_ORB_Core *orb_core) ACE_THROW_SPEC (()) { TAO_FT_Service_Callbacks *ft_service_callback = 0; + cout << "Did we get here 1" <<endl; // Construct service callback object ACE_NEW_RETURN (ft_service_callback, TAO_FT_Service_Callbacks (orb_core), diff --git a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Service_Activate.h b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Service_Activate.h index dd970eda954..85a4075a565 100644 --- a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Service_Activate.h +++ b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Service_Activate.h @@ -47,6 +47,9 @@ public: virtual ~TAO_FT_Service_Activate (void); // The destructor + virtual int init (int argc, ACE_TCHAR *argv[]); + // Initializes object when dynamic linking occurs. + virtual TAO_Service_Callbacks *activate_services (TAO_ORB_Core *orb) ACE_THROW_SPEC (()); // Create and activate the service callbacks into the orb. diff --git a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Service_Callbacks.cpp b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Service_Callbacks.cpp index 85c01abae4f..dd502796c8f 100644 --- a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Service_Callbacks.cpp +++ b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Service_Callbacks.cpp @@ -192,26 +192,6 @@ TAO_FT_Service_Callbacks::object_is_nil (CORBA::Object_ptr obj) } -CORBA::Policy_ptr -TAO_FT_Service_Callbacks::service_create_policy ( - CORBA::PolicyType type, - const CORBA::Any &val, - CORBA::Environment &ACE_TRY_ENV) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - - if (type == FT::REQUEST_DURATION_POLICY) - return TAO_FT_Request_Duration_Policy::create (val, - ACE_TRY_ENV); - else if (type == FT::HEARTBEAT_POLICY) - return TAO_FT_Heart_Beat_Policy::create (val, - ACE_TRY_ENV); - else if (type == FT::HEARTBEAT_ENABLED_POLICY) - return TAO_FT_Heart_Beat_Enabled_Policy::create (val, - ACE_TRY_ENV); - return CORBA::Policy::_nil (); -} - void TAO_FT_Service_Callbacks::service_context_list ( TAO_Stub *&stub, diff --git a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Service_Callbacks.h b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Service_Callbacks.h index 0dfed91af08..50bd0f1bb84 100644 --- a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Service_Callbacks.h +++ b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Service_Callbacks.h @@ -67,13 +67,6 @@ public: // Need to do is_equivalent and hash also here - virtual CORBA::Policy_ptr service_create_policy ( - CORBA::PolicyType policy, - const CORBA::Any &val, - CORBA::Environment &ACE_TRY_ENV) - ACE_THROW_SPEC ((CORBA::SystemException)); - // Create a CORBA::Policy from CORBA::Policy - virtual void service_context_list (TAO_Stub *&stub, IOP::ServiceContextList &service_list, CORBA::Boolean restart, |