summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2004-08-17 09:25:33 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2004-08-17 09:25:33 +0000
commit52bfa96b2afa72cd575624c779e50754219c8d8e (patch)
treec39a1654519b059485b26660f9f5ebdef87a81ce
parent808f0d071e02f98bb06a6904a3d670c0de57d5a7 (diff)
downloadATCD-52bfa96b2afa72cd575624c779e50754219c8d8e.tar.gz
ChangeLogTag: Tue Aug 17 09:25:12 UTC 2004 Johnny Willemsen <jwillemsen@remedy.nl>
-rw-r--r--TAO/tao/PortableServer/ORTRework.txt38
-rwxr-xr-xTAO/tao/PortableServer/ObjectReferenceTemplate_Adapter.h20
-rw-r--r--TAO/tao/PortableServer/ObjectReferenceTemplate_Adapter_Factory.cpp2
-rw-r--r--TAO/tao/PortableServer/POA.cpp221
-rw-r--r--TAO/tao/PortableServer/POA.h109
-rw-r--r--TAO/tao/PortableServer/POA.i18
6 files changed, 322 insertions, 86 deletions
diff --git a/TAO/tao/PortableServer/ORTRework.txt b/TAO/tao/PortableServer/ORTRework.txt
index c5b99109c94..03d7f0d190b 100644
--- a/TAO/tao/PortableServer/ORTRework.txt
+++ b/TAO/tao/PortableServer/ORTRework.txt
@@ -1,3 +1,41 @@
+
+ * tao/PortableServer/ObjectReferenceTemplate_Adapter_Factory.cpp:
+ Fixed incorrect include
+
+ * tao/PortableServer/ObjectReferenceTemplate_Adapter.h:
+ - Added adapter_name as constructor argument
+ - Added destroy() method, called by POA when this adapter is not
+ needed anymore, adapter must do its own cleanup
+ - Added activate() method with just a ORT* to activate the adapter
+ with an existing factory.
+ - Added get_adapter_template and get_obj_ref_factory to get the real
+ servant, this is needed for the IORInterceptors
+
+ * tao/PortableServer/POA.{h,cpp,i}:
+ - Added invoke_key_to_object_helper() which will check for the ORT and
+ if available will call that or will call invoke_key_to_object
+ instead.
+ - Added object_reference_template_adapter() which will check
+ ir an ORT Adapter is already available, if not, tries to get an
+ ORT Adapater Factory, if that is available, create a new ORT
+ Adapter.
+ - Added some doxygen grouping to group methods belonging to each other
+ in one doxygen group.
+ - Added ort_adapter_ member to store the ORT Adapter when we have
+ retrieved one.
+ - Removed set_adapter_template() from the header file, there is no
+ implementation of this method and it is not needed
+ - Added TAO_POA_Static_Resources to store the name of the ORT factory,
+ used the TAO_ORB_Core_Static_Resources but I didn't it put it there
+ because the ORB_Core doesn't need to know anything or ORT.
+ - Removed old ort_template, def_ort_template and obj_ref_factory and
+ its usage.
+
+ * tao/PortableServer/Default_ORT*.*:
+ * tao/PortableServer/ObjectReferenceTemplate.{h,cpp,i}:
+ Removed these files, default ORT implementation is now in the ORT
+ library
+
Fri Aug 13 18:12:12 UTC 2004 Johnny Willemsen <jwillemsen@remedy.nl>
* tao/PortableServer/ObjectReferenceTemplate_Adapter.{h,cpp}
diff --git a/TAO/tao/PortableServer/ObjectReferenceTemplate_Adapter.h b/TAO/tao/PortableServer/ObjectReferenceTemplate_Adapter.h
index c6f35040034..1daae6e4e1a 100755
--- a/TAO/tao/PortableServer/ObjectReferenceTemplate_Adapter.h
+++ b/TAO/tao/PortableServer/ObjectReferenceTemplate_Adapter.h
@@ -30,6 +30,12 @@ namespace CORBA
typedef Object *Object_ptr;
}
+namespace PortableInterceptor
+{
+ class ObjectReferenceTemplate;
+ class ObjectReferenceFactory;
+}
+
/**
* @class TAO_ObjectReferenceTemplate_Adapter
*
@@ -48,8 +54,14 @@ public:
/// Activate the ORT library
virtual int activate (const char *server_id,
const char *orb_id,
+ PortableInterceptor::AdapterName *,
+ TAO_POA *poa) = 0;
+
+ virtual int activate (PortableInterceptor::ObjectReferenceFactory *current_factory,
TAO_POA *poa) = 0;
+ virtual int destroy (void) = 0;
+
/// Set the underlying POA pointer.
/**
* Upon destruction of the POA that this ObjectReferenceTemplate is
@@ -60,6 +72,12 @@ public:
*/
virtual void poa (TAO_POA * poa) = 0;
+ /// Accessor methods to ObjectReferenceTemplate template
+ virtual PortableInterceptor::ObjectReferenceTemplate * get_adapter_template (void) = 0;
+
+ /// Accessor methods to PortableInterceptor::ObjectReferenceFactory
+ virtual PortableInterceptor::ObjectReferenceFactory * get_obj_ref_factory (void) = 0;
+
/**
* @name PortableInterceptor::ObjectReferenceFactory Methods
*
@@ -75,8 +93,6 @@ public:
CORBA::SystemException
)) = 0;
//@}
-
-
};
#include /**/ "ace/post.h"
diff --git a/TAO/tao/PortableServer/ObjectReferenceTemplate_Adapter_Factory.cpp b/TAO/tao/PortableServer/ObjectReferenceTemplate_Adapter_Factory.cpp
index bcfc77c1d1b..439d837d799 100644
--- a/TAO/tao/PortableServer/ObjectReferenceTemplate_Adapter_Factory.cpp
+++ b/TAO/tao/PortableServer/ObjectReferenceTemplate_Adapter_Factory.cpp
@@ -1,6 +1,6 @@
// $Id$
-#include "tao/ObjectReferenceTemplate_Adapter_Factory.h"
+#include "tao/PortableServer/ObjectReferenceTemplate_Adapter_Factory.h"
#include "ace/Dynamic_Service.h"
ACE_RCSID (PortableServer,
diff --git a/TAO/tao/PortableServer/POA.cpp b/TAO/tao/PortableServer/POA.cpp
index e8b042b4ab7..447ec0a70c4 100644
--- a/TAO/tao/PortableServer/POA.cpp
+++ b/TAO/tao/PortableServer/POA.cpp
@@ -15,9 +15,9 @@ ACE_RCSID (PortableServer,
#include "tao/StringSeqC.h"
#include "tao/PortableServer/IORInfo.h"
-#include "tao/PortableServer/ObjectReferenceTemplate.h"
#include "tao/PortableServer/Default_Acceptor_Filter.h"
-
+#include "tao/PortableServer/ObjectReferenceTemplate_Adapter.h"
+#include "tao/PortableServer/ObjectReferenceTemplate_Adapter_Factory.h"
#include "tao/ORB_Core.h"
#include "tao/ORB.h"
#include "tao/Server_Strategy_Factory.h"
@@ -41,6 +41,7 @@ ACE_RCSID (PortableServer,
// auto_ptr class
#include "ace/Auto_Ptr.h"
+#include "ace/Dynamic_Service.h"
#if !defined (__ACE_INLINE__)
# include "POA.i"
@@ -171,10 +172,29 @@ TAO_POA::create_request_processing_policy (PortableServer::RequestProcessingPoli
void
TAO_POA::set_obj_ref_factory (
PortableInterceptor::ObjectReferenceFactory *current_factory
- ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_ENV_ARG_DECL)
{
- CORBA::add_ref (current_factory);
- this->obj_ref_factory_ = current_factory;
+ if (ort_adapter_ != 0)
+ {
+ ort_adapter_->destroy();
+ ort_adapter_ = 0;
+ }
+
+ TAO_ObjectReferenceTemplate_Adapter_Factory * ort_ap_factory =
+ this->object_reference_template_adapter_factory();
+
+ if (ort_ap_factory)
+ {
+ this->ort_adapter_ =
+ ort_ap_factory->create (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (ort_adapter_)
+ {
+ ort_adapter_->activate (current_factory,
+ this);
+ }
+ }
}
TAO_POA::TAO_POA (const TAO_POA::String &name,
@@ -194,6 +214,7 @@ TAO_POA::TAO_POA (const TAO_POA::String &name,
policies_ (policies),
parent_ (parent),
active_object_map_ (0),
+ ort_adapter_ (0),
adapter_state_ (PortableInterceptor::HOLDING),
#if (TAO_HAS_MINIMUM_POA == 0)
@@ -345,22 +366,6 @@ TAO_POA::TAO_POA (const TAO_POA::String &name,
}
#endif /* TAO_HAS_MINIMUM_CORBA */
-
- // Create an ObjectReferenceTemplate for this POA.
- ACE_NEW_THROW_EX (this->def_ort_template_,
- TAO_ObjectReferenceTemplate (
- this->orb_core_.server_id (),
- this->orb_core_.orbid (),
- this),
- CORBA::NO_MEMORY ());
- ACE_CHECK;
-
- this->ort_template_ = this->def_ort_template_;
-
- // Must increase ref count since this->obj_ref_factory_ will
- // descrease it upon destruction.
- CORBA::add_ref (this->ort_template_.in ());
- this->obj_ref_factory_ = this->ort_template_;
}
TAO_POA::~TAO_POA (void)
@@ -376,6 +381,7 @@ TAO_POA::complete_destruction_i (ACE_ENV_SINGLE_ARG_DECL)
// Delete the active object map.
delete this->active_object_map_;
+ active_object_map_ = 0;
// Remove POA from the POAManager.
int result = this->poa_manager_.remove_poa (this);
@@ -426,6 +432,12 @@ TAO_POA::complete_destruction_i (ACE_ENV_SINGLE_ARG_DECL)
}
+ if (ort_adapter_ != 0)
+ {
+ ort_adapter_->destroy ();
+ ort_adapter_ = 0;
+ }
+
CORBA::release (this);
}
@@ -845,7 +857,8 @@ TAO_POA::destroy_i (CORBA::Boolean etherealize_objects,
// Break all ties between the ObjectReferenceTemplate and this
// POA.
- this->def_ort_template_->poa (0);
+ if (this->ort_adapter_ == 0)
+ this->ort_adapter_->poa (0);
}
else
{
@@ -1921,14 +1934,32 @@ TAO_POA::create_reference_i (const char *intf,
1,
priority);
+ return this->invoke_key_to_object_helper (intf,
+ user_id
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::Object_ptr
+TAO_POA::invoke_key_to_object_helper (const char * repository_id,
+ const PortableServer::ObjectId & id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
const PortableInterceptor::ObjectId &user_oid =
- ACE_reinterpret_cast (const PortableInterceptor::ObjectId &,
- user_id);
+ reinterpret_cast <const PortableInterceptor::ObjectId &>(id);
// Ask the ORT to create the object.
- return this->obj_ref_factory_->make_object (intf,
+ if (this->object_reference_template_adapter ())
+ {
+ // Ask the ORT to create the object.
+ return this->ort_adapter_->make_object (repository_id,
user_oid
ACE_ENV_ARG_PARAMETER);
+ }
+ else
+ {
+ return this->invoke_key_to_object (ACE_ENV_SINGLE_ARG_PARAMETER);
+ }
}
CORBA::Object_ptr
@@ -2005,14 +2036,9 @@ TAO_POA::create_reference_with_id_i (const PortableServer::ObjectId &user_id,
1,
priority);
- const PortableInterceptor::ObjectId &user_oid =
- ACE_reinterpret_cast (const PortableInterceptor::ObjectId &,
- user_id);
-
- // Ask the ORT to create the object.
- return this->obj_ref_factory_->make_object (intf,
- user_oid
- ACE_ENV_ARG_PARAMETER);
+ return this->invoke_key_to_object_helper (intf,
+ user_id
+ ACE_ENV_ARG_PARAMETER);
}
PortableServer::ObjectId *
@@ -2253,19 +2279,14 @@ TAO_POA::servant_to_reference_i (PortableServer::Servant servant
1,
priority);
- const PortableInterceptor::ObjectId &user_oid =
- ACE_reinterpret_cast (const PortableInterceptor::ObjectId &,
- user_id);
-
// Ask the ORT to create the object.
// @@NOTE:There is a possible deadlock lurking here. We held the
// lock, and we are possibly trying to make a call into the
// application code. Think what would happen if the app calls us
// back. We need to get to this at some point.
- return this->obj_ref_factory_->make_object (
- servant->_interface_repository_id (),
- user_oid
- ACE_ENV_ARG_PARAMETER);
+ return this->invoke_key_to_object_helper (servant->_interface_repository_id (),
+ user_id
+ ACE_ENV_ARG_PARAMETER);
}
PortableServer::Servant
@@ -2605,14 +2626,9 @@ TAO_POA::id_to_reference_i (const PortableServer::ObjectId &id
1,
priority);
- const PortableInterceptor::ObjectId &user_oid =
- ACE_reinterpret_cast (const PortableInterceptor::ObjectId &,
- id);
-
- // Ask the ORT to create the object.
- return this->obj_ref_factory_->make_object (servant->_interface_repository_id (),
- user_oid
- ACE_ENV_ARG_PARAMETER);
+ return this->invoke_key_to_object_helper (servant->_interface_repository_id (),
+ id
+ ACE_ENV_ARG_PARAMETER);
}
else
// If the Object Id value is not active in the POA, an
@@ -4170,6 +4186,63 @@ TAO_POA::imr_notify_shutdown (void)
#endif /* TAO_HAS_MINIMUM_CORBA */
+TAO_ObjectReferenceTemplate_Adapter_Factory *
+TAO_POA::object_reference_template_adapter_factory (void)
+{
+ return ACE_Dynamic_Service<TAO_ObjectReferenceTemplate_Adapter_Factory>::instance (
+ TAO_POA::objectreferencetemplate_adapter_factory_name());
+}
+
+TAO_ObjectReferenceTemplate_Adapter *
+TAO_POA::object_reference_template_adapter (void)
+{
+ if (this->ort_adapter_ == 0)
+ {
+ // Lock access for the duration of this transaction.
+ TAO_POA_GUARD_RETURN (0);
+
+ if (this->ort_adapter_ == 0)
+ {
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ TAO_ObjectReferenceTemplate_Adapter_Factory * ort_ap_factory =
+ this->object_reference_template_adapter_factory();
+
+ if (ort_ap_factory)
+ {
+ this->ort_adapter_ =
+ ort_ap_factory->create (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (ort_adapter_)
+ {
+ // Get the full adapter name of this POA
+ PortableInterceptor::AdapterName *adapter_name =
+ this->adapter_name_i(ACE_ENV_SINGLE_ARG_PARAMETER)
+ ACE_TRY_CHECK;
+
+ ort_adapter_->activate (this->orb_core_.server_id (),
+ this->orb_core_.orbid (),
+ adapter_name,
+ this);
+ }
+ }
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "(%P|%t) Cannot initialize the "
+ "object_reference_template_adapter\n");
+ }
+ ACE_ENDTRY;
+ }
+ }
+
+ return this->ort_adapter_;
+}
+
+
TAO_POA_Guard::TAO_POA_Guard (TAO_POA &poa
ACE_ENV_ARG_DECL,
int check_for_destruction)
@@ -4304,6 +4377,52 @@ TAO_POA::Key_To_Object_Params::set (PortableServer::ObjectId_var &system_id,
this->priority_ = priority;
}
+void
+TAO_POA::objectreferencetemplate_adapter_factory_name (const char *name)
+{
+ TAO_POA_Static_Resources::instance ()->objectreferencetemplate_adapter_factory_name_ = name;
+}
+
+const char *
+TAO_POA::objectreferencetemplate_adapter_factory_name (void)
+{
+ return TAO_POA_Static_Resources::instance ()->objectreferencetemplate_adapter_factory_name_.c_str();
+}
+
+// Initialize instance_ to 0, since this is what we test for in the call
+// to instance (). Note that this does not require a constructor call, so
+// it is always initialized by the time that instance () can be called.
+TAO_POA_Static_Resources* TAO_POA_Static_Resources::instance_ = 0;
+
+// Force an instance to be created at module initialization time,
+// since we do not want to worry about double checked locking and
+// the race condition to initialize the lock.
+TAO_POA_Static_Resources* TAO_POA_Static_Resources::initialization_reference_ =
+ TAO_POA_Static_Resources::instance ();
+
+TAO_POA_Static_Resources*
+TAO_POA_Static_Resources::instance (void)
+{
+ if (TAO_POA_Static_Resources::instance_ == 0)
+ {
+ // This new is never freed on purpose. The data specified by
+ // it needs to be around for the last shared library that references
+ // this class. This could occur in a destructor in a shared library
+ // that is unloaded after this one. One solution to avoid this
+ // harmless memory leak would be to use reference counting.
+ ACE_NEW_RETURN (TAO_POA_Static_Resources::instance_,
+ TAO_POA_Static_Resources (),
+ 0);
+ }
+
+ return TAO_POA_Static_Resources::instance_;
+}
+
+TAO_POA_Static_Resources::TAO_POA_Static_Resources (void)
+ : objectreferencetemplate_adapter_factory_name_ ("ObjectReferenceTemplate_Adapter_Factory")
+{
+}
+
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Array_Base<TAO_Active_Object_Map::Map_Entry *>;
@@ -4321,13 +4440,11 @@ template class ACE_Write_Guard<ACE_Lock>;
template class ACE_Read_Guard<ACE_Lock>;
template class ACE_Array_Base <IOP::ProfileId>;
-//template class auto_ptr<TAO_Active_Object_Map_Iterator_Impl>;
template class auto_ptr<TAO_Active_Object_Map>;
# if defined (ACE_LACKS_AUTO_PTR) \
|| !(defined (ACE_HAS_STANDARD_CPP_LIBRARY) \
&& (ACE_HAS_STANDARD_CPP_LIBRARY != 0))
-//template class ACE_Auto_Basic_Ptr<TAO_Active_Object_Map_Iterator_Impl>;
template class ACE_Auto_Basic_Ptr<TAO_Active_Object_Map>;
# endif /* ACE_LACKS_AUTO_PTR */
@@ -4349,13 +4466,11 @@ template class ACE_Node<TAO_POA *>;
#pragma instantiate ACE_Write_Guard<ACE_Lock>
#pragma instantiate ACE_Read_Guard<ACE_Lock>
-//#pragma instantiate auto_ptr<TAO_Active_Object_Map_Iterator_Impl>
#pragma instantiate auto_ptr<TAO_Active_Object_Map>
# if defined (ACE_LACKS_AUTO_PTR) \
|| !(defined (ACE_HAS_STANDARD_CPP_LIBRARY) \
&& (ACE_HAS_STANDARD_CPP_LIBRARY != 0))
-//# pragma instantiate ACE_Auto_Basic_Ptr<TAO_Active_Object_Map_Iterator_Impl>
# pragma instantiate ACE_Auto_Basic_Ptr<TAO_Active_Object_Map>
# endif /* ACE_LACKS_AUTO_PTR */
diff --git a/TAO/tao/PortableServer/POA.h b/TAO/tao/PortableServer/POA.h
index 3b73f2f5b52..122667e3b37 100644
--- a/TAO/tao/PortableServer/POA.h
+++ b/TAO/tao/PortableServer/POA.h
@@ -44,10 +44,7 @@
// Portable Interceptor
#include "tao/PortableInterceptorC.h"
-// Map
#include "ace/Hash_Map_Manager_T.h"
-
-// ACE_Array_Base
#include "ace/Array_Base.h"
// Locking
@@ -68,15 +65,11 @@
#pragma warning(disable:4250)
#endif /* _MSC_VER */
-class TAO_Acceptor_Filter;
-class TAO_Acceptor_Registry;
class TAO_Temporary_Creation_Time;
-class TAO_ObjectReferenceTemplate;
class TAO_Creation_Time
{
public:
-
TAO_Creation_Time (const ACE_Time_Value &creation_time);
TAO_Creation_Time (void);
@@ -136,6 +129,10 @@ protected:
// Forward Declaration
class ServerObject_i;
+class TAO_Acceptor_Filter;
+class TAO_Acceptor_Registry;
+class TAO_ObjectReferenceTemplate_Adapter;
+class TAO_ObjectReferenceTemplate_Adapter_Factory;
namespace PortableInterceptor
{
@@ -162,7 +159,7 @@ public:
friend class TAO_POA_Current_Impl;
friend class TAO_POA_Manager;
friend class TAO_RT_Collocation_Resolver;
- friend class TAO_ObjectReferenceTemplate;
+ //friend class TAO_ObjectReferenceTemplate;
typedef ACE_CString String;
@@ -275,13 +272,10 @@ public:
/// Accessor methods to ObjectReferenceTemplate
PortableInterceptor::ObjectReferenceTemplate * get_adapter_template (void);
- void set_adapter_template (PortableInterceptor::ObjectReferenceTemplate *
- object_ref_template
- ACE_ENV_ARG_DECL);
-
/// Accessor methods to PortableInterceptor::ObjectReferenceFactory
PortableInterceptor::ObjectReferenceFactory * get_obj_ref_factory (void);
+ /// Set the object reference factory
void set_obj_ref_factory (
PortableInterceptor::ObjectReferenceFactory *current_factory
ACE_ENV_ARG_DECL);
@@ -406,8 +400,9 @@ public:
ACE_THROW_SPEC ((CORBA::SystemException));
#if (TAO_HAS_MINIMUM_POA == 0)
- // Methods added by the MIOP specification.
-
+ // Methods added by the
+ /// @name MIOP specification methods
+ //@{
virtual PortableServer::ObjectId * create_id_for_reference (
CORBA::Object_ptr the_ref
ACE_ENV_ARG_DECL_WITH_DEFAULTS
@@ -446,11 +441,9 @@ public:
CORBA::SystemException,
PortableServer::NotAGroupObject
));
-
- // End methods added by MIOP.
+ //@}
#endif /* TAO_HAS_MINIMUM_POA == 0 */
-
/// Accessor for POA policies.
TAO_POA_Policy_Set &policies (void);
@@ -658,17 +651,16 @@ protected:
#endif /* TAO_HAS_MINIMUM_POA == 0 */
-//
-// ImplRepo related.
-//
#if (TAO_HAS_MINIMUM_CORBA == 0)
+ /// @name Implementation repository related methods
+ //@{
/// ImplRepo helper method, notify the ImplRepo on startup
void imr_notify_startup (ACE_ENV_SINGLE_ARG_DECL);
/// ImplRepo helper method, notify the ImplRepo on shutdown
void imr_notify_shutdown (void);
-
+ //@}
#endif /* TAO_HAS_MINIMUM_CORBA */
CORBA::Object_ptr invoke_key_to_object (ACE_ENV_SINGLE_ARG_DECL);
@@ -858,6 +850,10 @@ protected:
/// prototype for creating new POA's. It should
static TAO_POA_Policy_Set &default_poa_policies (void);
+ static void objectreferencetemplate_adapter_factory_name (const char *name);
+
+ static const char *objectreferencetemplate_adapter_factory_name (void);
+
protected:
TAO_SERVANT_LOCATION locate_servant_i (const PortableServer::ObjectId &id,
@@ -873,6 +869,18 @@ protected:
ACE_ENV_ARG_DECL
);
+ CORBA::Object_ptr
+ invoke_key_to_object_helper (const char * repository_id,
+ const PortableServer::ObjectId & id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ TAO_ObjectReferenceTemplate_Adapter *
+ object_reference_template_adapter (void);
+
+ TAO_ObjectReferenceTemplate_Adapter_Factory *
+ object_reference_template_adapter_factory (void);
+
const TAO_Creation_Time &creation_time (void);
CORBA::Boolean persistent (void);
@@ -935,13 +943,8 @@ protected:
CORBA::OctetSeq id_;
- /// Keep a copy of the pointer to the actual implementation around
- /// so that we can call some TAO-specific methods on it.
- TAO_ObjectReferenceTemplate * def_ort_template_;
-
- PortableInterceptor::ObjectReferenceTemplate_var ort_template_;
-
- PortableInterceptor::ObjectReferenceFactory_var obj_ref_factory_;
+ /// Pointer to the object reference template adapter.
+ TAO_ObjectReferenceTemplate_Adapter *ort_adapter_;
/// Adapter can be accepting, rejecting etc.
PortableInterceptor::AdapterState adapter_state_;
@@ -1073,6 +1076,56 @@ protected:
#endif /* TAO_HAS_MINIMUM_POA == 0 */
+/**
+ * @class TAO_POA_Static_Resources
+ *
+ * @brief The static (global) resoures of all POA's.
+ *
+ * This class is used by the POA to store the resources global to
+ * all POA's. All instance variables that would have been
+ * declared "static" in TAO_POA, should be declared in this class
+ * to avoid the "static initialization order fiasco" as described in
+ * http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.11.
+ * Briefly, this is the problem that occurs if any static initializers
+ * in any other code call into set static members of TAO_POA.
+ * Since the order in which these initializers execute is unspecified,
+ * uninitialized members can be accessed.
+ */
+class TAO_PortableServer_Export TAO_POA_Static_Resources
+{
+public:
+
+ /// Return the singleton instance.
+ static TAO_POA_Static_Resources* instance (void);
+
+public:
+
+ /**
+ * Name of the factory object used to adapt function calls on the
+ * PortableInterceptor interfaces ORT. The default value is
+ * "ObjectReferenceTemplate_Adapter_Factory". If the ORT library is linked,
+ * the corresponding accessor function
+ * objectreferencefactory_adapter_factory_name() will be called to set
+ * the value to "Concrete_ObjectReferenceTemplate_Adapter_Factory".
+ */
+ ACE_CString objectreferencetemplate_adapter_factory_name_;
+
+private:
+ /// Constructor.
+ TAO_POA_Static_Resources (void);
+
+private:
+ /// The singleton instance.
+ static TAO_POA_Static_Resources* instance_;
+
+ /// Mostly unused variable whose sole purpose is to enforce
+ /// the instantiation of a TAO_POA_Static_Resources instance
+ /// at initialization time.
+ static TAO_POA_Static_Resources* initialization_reference_;
+};
+
+// ****************************************************************
+
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
#pragma warning(pop)
#endif /* _MSC_VER */
diff --git a/TAO/tao/PortableServer/POA.i b/TAO/tao/PortableServer/POA.i
index 761d5d67c13..508965d413a 100644
--- a/TAO/tao/PortableServer/POA.i
+++ b/TAO/tao/PortableServer/POA.i
@@ -466,13 +466,27 @@ TAO_POA::adapter_name (ACE_ENV_SINGLE_ARG_DECL)
ACE_INLINE PortableInterceptor::ObjectReferenceTemplate *
TAO_POA::get_adapter_template ()
{
- return this->ort_template_;
+ if (this->object_reference_template_adapter ())
+ {
+ return this->ort_adapter_->get_adapter_template();
+ }
+ else
+ {
+ ACE_THROW (CORBA::INTERNAL ());
+ }
}
ACE_INLINE PortableInterceptor::ObjectReferenceFactory *
TAO_POA::get_obj_ref_factory ()
{
- return this->obj_ref_factory_;
+ if (this->object_reference_template_adapter ())
+ {
+ return this->ort_adapter_->get_obj_ref_factory();
+ }
+ else
+ {
+ ACE_THROW (CORBA::INTERNAL ());
+ }
}
#if (TAO_HAS_MINIMUM_POA == 0)