diff options
Diffstat (limited to 'TAO/tao/PortableServer')
25 files changed, 1410 insertions, 82 deletions
diff --git a/TAO/tao/PortableServer/Acceptor_Filter_Factory.cpp b/TAO/tao/PortableServer/Acceptor_Filter_Factory.cpp new file mode 100644 index 00000000000..033aace13b3 --- /dev/null +++ b/TAO/tao/PortableServer/Acceptor_Filter_Factory.cpp @@ -0,0 +1,50 @@ +// @(#) $Id$ + +#include "tao/PortableServer/Acceptor_Filter_Factory.h" +#include "tao/PortableServer/Default_Acceptor_Filter.h" + +ACE_RCSID(PortableServer, + Acceptor_Filter_Factory, + "$Id$") + + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +TAO_Acceptor_Filter_Factory::~TAO_Acceptor_Filter_Factory(void) +{ +} + +TAO_Acceptor_Filter* +TAO_Acceptor_Filter_Factory::create_object (TAO_POA_Manager& ) +{ + TAO_Acceptor_Filter *filter; + + ACE_NEW_RETURN (filter, + TAO_Default_Acceptor_Filter (), + 0); + + return filter; +} + + +int +TAO_Acceptor_Filter_Factory::initialize (void) +{ + return ACE_Service_Config::process_directive + (ace_svc_desc_TAO_Acceptor_Filter_Factory); +} + +TAO_END_VERSIONED_NAMESPACE_DECL + +static int +TAO_Requires_Acceptor_Filter_Factory = +TAO_Acceptor_Filter_Factory::initialize (); + +ACE_FACTORY_DEFINE (TAO_PortableServer, TAO_Acceptor_Filter_Factory) +ACE_STATIC_SVC_DEFINE (TAO_Acceptor_Filter_Factory, + ACE_TEXT ("TAO_Acceptor_Filter_Factory"), + ACE_SVC_OBJ_T, + &ACE_SVC_NAME (TAO_Acceptor_Filter_Factory), + ACE_Service_Type::DELETE_THIS + | ACE_Service_Type::DELETE_OBJ, + 0) diff --git a/TAO/tao/PortableServer/Acceptor_Filter_Factory.h b/TAO/tao/PortableServer/Acceptor_Filter_Factory.h new file mode 100644 index 00000000000..3d4267ff944 --- /dev/null +++ b/TAO/tao/PortableServer/Acceptor_Filter_Factory.h @@ -0,0 +1,68 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Acceptor_Filter_Factory.h + * + * $Id$ + * + * Provides default acceptor filters for use by the POA. + * + * @author Yan Dai <dai_y@ociweb.com> + * @author Phil Mesnier <mesnier_p@ociweb.com> + */ +//============================================================================= + + +#ifndef TAO_ACCEPTOR_FILTER_FACTORY_H +#define TAO_ACCEPTOR_FILTER_FACTORY_H + +#include /**/ "ace/pre.h" + +#include "portableserver_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/Versioned_Namespace.h" + +#include "ace/Service_Object.h" +#include "ace/Service_Config.h" + +class TAO_POA_Manager; +class TAO_Acceptor_Filter; + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class TAO_Acceptor_Filter_Factory + * + * @brief Default class for factories providing the endpoint acceptor + * filter objects. + * + * The TAO_Acceptor_Filter_Factory is a loadable service object. It exists + * to allow external application of filters used to control the assembly of + * object references and how endpoints are assigned. + */ +class TAO_PortableServer_Export TAO_Acceptor_Filter_Factory + : public ACE_Service_Object +{ +public: + virtual ~TAO_Acceptor_Filter_Factory(void); + + virtual TAO_Acceptor_Filter* create_object (TAO_POA_Manager& poamanager); + + /// Static initializer ensures the factory is loaded + static int initialize (void); + +}; + +TAO_END_VERSIONED_NAMESPACE_DECL + +ACE_STATIC_SVC_DECLARE (TAO_Acceptor_Filter_Factory) +ACE_FACTORY_DECLARE (TAO_PortableServer, TAO_Acceptor_Filter_Factory) + +#include /**/ "ace/post.h" + +#endif /* TAO_ACCEPTOR_FILTER_FACTORY_H */ diff --git a/TAO/tao/PortableServer/Default_Acceptor_Filter.h b/TAO/tao/PortableServer/Default_Acceptor_Filter.h index b9288216837..3b1bca11b17 100644 --- a/TAO/tao/PortableServer/Default_Acceptor_Filter.h +++ b/TAO/tao/PortableServer/Default_Acceptor_Filter.h @@ -46,7 +46,7 @@ public: TAO_Default_Acceptor_Filter (void); /// Populate @a mprofile with all available endpoints. - int fill_profile (const TAO::ObjectKey &object_key, + virtual int fill_profile (const TAO::ObjectKey &object_key, TAO_MProfile &mprofile, TAO_Acceptor **acceptors_begin, TAO_Acceptor **acceptors_end, diff --git a/TAO/tao/PortableServer/Default_Servant_Dispatcher.cpp b/TAO/tao/PortableServer/Default_Servant_Dispatcher.cpp index ae93dee3d61..44d6a2356dd 100644 --- a/TAO/tao/PortableServer/Default_Servant_Dispatcher.cpp +++ b/TAO/tao/PortableServer/Default_Servant_Dispatcher.cpp @@ -15,7 +15,7 @@ TAO_Default_Servant_Dispatcher::~TAO_Default_Servant_Dispatcher (void) TAO_Root_POA * TAO_Default_Servant_Dispatcher::create_Root_POA (const ACE_CString &name, - TAO_POA_Manager &poa_manager, + PortableServer::POAManager_ptr poa_manager, const TAO_POA_Policy_Set &policies, ACE_Lock &lock, TAO_SYNCH_MUTEX &thread_lock, diff --git a/TAO/tao/PortableServer/Default_Servant_Dispatcher.h b/TAO/tao/PortableServer/Default_Servant_Dispatcher.h index 412e8eea9c6..e5f5f2b71db 100644 --- a/TAO/tao/PortableServer/Default_Servant_Dispatcher.h +++ b/TAO/tao/PortableServer/Default_Servant_Dispatcher.h @@ -62,7 +62,7 @@ public: /// Factory method for creating new POA's. TAO_Root_POA *create_Root_POA ( const ACE_CString &name, - TAO_POA_Manager &poa_manager, + PortableServer::POAManager_ptr poa_manager, const TAO_POA_Policy_Set &policies, ACE_Lock &lock, TAO_SYNCH_MUTEX &thread_lock, diff --git a/TAO/tao/PortableServer/Object_Adapter.cpp b/TAO/tao/PortableServer/Object_Adapter.cpp index 224b531864f..45519170d6e 100644 --- a/TAO/tao/PortableServer/Object_Adapter.cpp +++ b/TAO/tao/PortableServer/Object_Adapter.cpp @@ -11,6 +11,7 @@ #include "tao/PortableServer/Default_Servant_Dispatcher.h" #include "tao/PortableServer/Collocated_Object_Proxy_Broker.h" #include "tao/PortableServer/POAManager.h" +#include "tao/PortableServer/POAManagerFactory.h" #include "tao/PortableServer/Servant_Base.h" // -- ACE Include -- @@ -591,13 +592,16 @@ TAO_Object_Adapter::open (ACE_ENV_SINGLE_ARG_DECL) TAO_Default_Servant_Dispatcher); } - TAO_POA_Manager *poa_manager; - ACE_NEW_THROW_EX (poa_manager, - TAO_POA_Manager (*this), + ACE_NEW_THROW_EX (this->poa_manager_factory_, + TAO_POAManager_Factory (*this), CORBA::NO_MEMORY ()); - ACE_CHECK; - PortableServer::POAManager_var safe_poa_manager = poa_manager; + ::CORBA::PolicyList policy; + PortableServer::POAManager_var poa_manager + = poa_manager_factory_->create_POAManager (TAO_DEFAULT_ROOTPOAMANAGER_NAME, + policy + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; // This makes sure that the default resources are open when the Root // POA is created. @@ -639,7 +643,7 @@ TAO_Object_Adapter::open (ACE_ENV_SINGLE_ARG_DECL) TAO_Root_POA::String root_poa_name (TAO_DEFAULT_ROOTPOA_NAME); this->root_ = this->servant_dispatcher_->create_Root_POA (root_poa_name, - *poa_manager, + poa_manager.in (), policies, this->lock (), this->thread_lock (), @@ -662,11 +666,6 @@ TAO_Object_Adapter::open (ACE_ENV_SINGLE_ARG_DECL) // for this servant. this->root_->establish_components (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; - - // Release the POA_Manager_var since we got here without error. The - // TAO_POA object takes ownership of the POA_Manager object - // (actually it shares the ownership with its peers). - (void) safe_poa_manager._retn (); } void @@ -684,14 +683,18 @@ TAO_Object_Adapter::close (int wait_for_completion // destroyed. In the case of the POA, this means that all object // etherealizations have finished and root POA has been destroyed // (implying that all descendent POAs have also been destroyed). - TAO_Root_POA *root = 0; + TAO_POAManager_Factory* factory = 0; { ACE_GUARD (ACE_Lock, ace_mon, this->lock ()); if (this->root_ == 0) return; root = this->root_; this->root_ = 0; + if (this->poa_manager_factory_ == 0) + return; + factory = this->poa_manager_factory_; + this->poa_manager_factory_ = 0; } CORBA::Boolean etherealize_objects = 1; root->destroy (etherealize_objects, @@ -699,6 +702,7 @@ TAO_Object_Adapter::close (int wait_for_completion ACE_ENV_ARG_PARAMETER); ACE_CHECK; ::CORBA::release (root); + ::CORBA::release (factory); } void diff --git a/TAO/tao/PortableServer/Object_Adapter.h b/TAO/tao/PortableServer/Object_Adapter.h index edcdda83bc7..6d36e4631a4 100644 --- a/TAO/tao/PortableServer/Object_Adapter.h +++ b/TAO/tao/PortableServer/Object_Adapter.h @@ -50,6 +50,7 @@ class TAO_POA_Manager; class TAO_TSS_Resources; class TAO_Transport; class TAO_Servant_Dispatcher; +class TAO_POAManager_Factory; namespace TAO { @@ -493,6 +494,9 @@ private: /// The Root POA TAO_Root_POA *root_; + /// The POAManager factory. + TAO_POAManager_Factory *poa_manager_factory_; + /// The default validator and the beginning of the chain of /// policy validators. TAO_POA_Default_Policy_Validator default_validator_; diff --git a/TAO/tao/PortableServer/POAManager.cpp b/TAO/tao/PortableServer/POAManager.cpp index 8a8055d8c23..1c92bb471e0 100644 --- a/TAO/tao/PortableServer/POAManager.cpp +++ b/TAO/tao/PortableServer/POAManager.cpp @@ -1,6 +1,7 @@ // $Id$ #include "tao/PortableServer/POAManager.h" +#include "tao/PortableServer/POAManagerFactory.h" #include "tao/PortableServer/Root_POA.h" #include "tao/PortableServer/poa_macros.h" #include "tao/Server_Strategy_Factory.h" @@ -17,23 +18,36 @@ ACE_RCSID (PortableServer, TAO_BEGIN_VERSIONED_NAMESPACE_DECL -TAO_POA_Manager::TAO_POA_Manager (TAO_Object_Adapter &object_adapter) +TAO_POA_Manager::TAO_POA_Manager ( + TAO_Object_Adapter &object_adapter, + const char * id, + const ::CORBA::PolicyList &policies, + PortableServer::POAManagerFactory_ptr poa_manager_factory) : state_ (PortableServer::POAManager::HOLDING), lock_ (object_adapter.lock ()), poa_collection_ (), object_adapter_ (object_adapter), - poa_manager_id_ (this->generate_manager_id ()) + id_ (id == 0 ? this->generate_manager_id () : CORBA::string_dup (id)), + poa_manager_factory_ (* (dynamic_cast <TAO_POAManager_Factory*> (poa_manager_factory))), + policies_ (policies) { + poa_manager_factory->_add_ref (); } TAO_POA_Manager::~TAO_POA_Manager (void) { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, "(%P|%t)~TAO_POA_Manager : %s\n", this->id_.in ())); + } + poa_manager_factory_._remove_ref (); } -PortableInterceptor::AdapterManagerId -TAO_POA_Manager::get_manager_id (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +char * +TAO_POA_Manager::get_id (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) { - return this->poa_manager_id_; + return CORBA::string_dup (this->id_.in ()); } void @@ -162,7 +176,7 @@ TAO_POA_Manager::adapter_manager_state_changed (PortableServer::POAManager::Stat if (ior_adapter) { - ior_adapter->adapter_manager_state_changed (TAO_POA_Manager::poa_manager_id_, + ior_adapter->adapter_manager_state_changed (this->id_.in (), adapter_state ACE_ENV_ARG_PARAMETER); ACE_CHECK; @@ -303,7 +317,7 @@ TAO_POA_Manager::remove_poa (TAO_Root_POA *poa) { if (this->poa_collection_.is_empty ()) { - ::CORBA::release (this); + this->poa_manager_factory_.remove_poamanager (this); } } diff --git a/TAO/tao/PortableServer/POAManager.h b/TAO/tao/PortableServer/POAManager.h index 056efb7578c..5e90d177cc2 100644 --- a/TAO/tao/PortableServer/POAManager.h +++ b/TAO/tao/PortableServer/POAManager.h @@ -42,7 +42,13 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL // Forward decl. class TAO_Root_POA; class TAO_Object_Adapter; +class TAO_POAManager_Factory; +namespace PortableServer +{ + class POAManagerFactory; + typedef POAManagerFactory *POAManagerFactory_ptr; +} class TAO_PortableServer_Export TAO_POA_Manager : public PortableServer::POAManager, @@ -80,11 +86,15 @@ public: PortableServer::POAManager::State get_state (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); - TAO_POA_Manager (TAO_Object_Adapter &object_adapter); + char *get_id (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); - ~TAO_POA_Manager (void); + TAO_POA_Manager (TAO_Object_Adapter &object_adapter, + const char * id, + const ::CORBA::PolicyList & policies, + PortableServer::POAManagerFactory_ptr poa_manager_factory); - PortableInterceptor::AdapterManagerId get_manager_id (ACE_ENV_SINGLE_ARG_DECL); + ~TAO_POA_Manager (void); /// Check the state of this POA manager void check_state (ACE_ENV_SINGLE_ARG_DECL); @@ -96,6 +106,8 @@ public: ACE_ENV_SINGLE_ARG_DECL ); + CORBA::PolicyList& get_policies (); + protected: void activate_i (ACE_ENV_SINGLE_ARG_DECL) @@ -134,13 +146,6 @@ protected: int register_poa (TAO_Root_POA *poa); - /** - * Generate an AdapterManagerId for this POAManager. - * @return A value that uniquely identifies the POAManager within a - * given process. - */ - PortableInterceptor::AdapterManagerId generate_manager_id (void) const; - protected: PortableServer::POAManager::State state_; @@ -153,8 +158,21 @@ protected: TAO_Object_Adapter &object_adapter_; - PortableInterceptor::AdapterManagerId poa_manager_id_; + CORBA::String_var id_; + + TAO_POAManager_Factory& poa_manager_factory_; + + CORBA::PolicyList policies_; + +private : + /** + * Generate an id for this POAManager. + * @return A value that uniquely identifies the POAManager within a + * given process. + * @note: The id_ has the ownership of the memory allocated in this method. + */ + char* generate_manager_id (void) const; }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/PortableServer/POAManager.i b/TAO/tao/PortableServer/POAManager.i index 19adb23dd8f..5dad4c14de5 100644 --- a/TAO/tao/PortableServer/POAManager.i +++ b/TAO/tao/PortableServer/POAManager.i @@ -84,7 +84,7 @@ TAO_POA_Manager::get_state (ACE_ENV_SINGLE_ARG_DECL) return this->get_state_i (); } -ACE_INLINE PortableInterceptor::AdapterManagerId +ACE_INLINE char* TAO_POA_Manager::generate_manager_id (void) const { // The AdapterManagerId must be unique across all Adapter Managers @@ -101,7 +101,7 @@ TAO_POA_Manager::generate_manager_id (void) const // shifting of 64 bit addresses is performed since the // TAO_POA_Manager object is not large enough to allow that trick. - PortableInterceptor::AdapterManagerId id = 0; + CORBA::Long id = 0; // Note that we reinterpret_cast to an "unsigned long" instead of // CORBA::ULong since we need to first cast to an integer large @@ -109,14 +109,10 @@ TAO_POA_Manager::generate_manager_id (void) const // 64-bit platforms. if (sizeof (this) == 4) // 32 bit address - id = - static_cast <PortableInterceptor::AdapterManagerId> - (reinterpret_cast <ptrdiff_t> (this)); + id = reinterpret_cast <ptrdiff_t> (this); else if (sizeof (this) == 8) // 64 bit address -- use lower 32 bits - id = - static_cast <PortableInterceptor::AdapterManagerId> - (reinterpret_cast <ptrdiff_t> (this) & 0xFFFFFFFFu); + id = reinterpret_cast <ptrdiff_t> (this) & 0xFFFFFFFFu; // @@ If we ever hit a platform where neither of the above cases are // satisfied, we're up the creek! @@ -126,7 +122,16 @@ TAO_POA_Manager::generate_manager_id (void) const // // ORB, or perhaps specific to the process. // id = ...GENERATE_ID_ATOMICALLY...; // Fallback - return id; + char* buf = new char [25]; + ACE_OS::sprintf (buf, "POAManager%d", id); + return buf; } +ACE_INLINE +CORBA::PolicyList& TAO_POA_Manager::get_policies () +{ + return this->policies_; +} + + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/PortableServer/POAManager.pidl b/TAO/tao/PortableServer/POAManager.pidl index 6c9f72580be..c678575ac30 100644 --- a/TAO/tao/PortableServer/POAManager.pidl +++ b/TAO/tao/PortableServer/POAManager.pidl @@ -50,6 +50,8 @@ module PortableServer raises(AdapterInactive); State get_state (); + + string get_id(); }; }; diff --git a/TAO/tao/PortableServer/POAManagerC.h b/TAO/tao/PortableServer/POAManagerC.h index 9d767071182..7de37664de8 100644 --- a/TAO/tao/PortableServer/POAManagerC.h +++ b/TAO/tao/PortableServer/POAManagerC.h @@ -248,6 +248,13 @@ namespace PortableServer CORBA::SystemException )) = 0; + virtual char * get_id ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + ::CORBA::SystemException + )) = 0; + // TAO_IDL - Generated from // be\be_visitor_interface/interface_ch.cpp:210 diff --git a/TAO/tao/PortableServer/POAManagerFactory.cpp b/TAO/tao/PortableServer/POAManagerFactory.cpp new file mode 100644 index 00000000000..4547d162af2 --- /dev/null +++ b/TAO/tao/PortableServer/POAManagerFactory.cpp @@ -0,0 +1,155 @@ +// $Id$ + +#include "tao/PortableServer/POAManagerFactory.h" +#include "tao/PortableServer/POAManager.h" +#include "tao/EndpointPolicy/EndpointPolicyTypeC.h" + +#include "ace/OS_NS_string.h" + +ACE_RCSID (PortableServer, + POAManagerFactory, + "$Id$") + + +TAO_POAManager_Factory::TAO_POAManager_Factory (TAO_Object_Adapter &object_adapter) : + object_adapter_ (object_adapter) +{ +} + +TAO_POAManager_Factory::~TAO_POAManager_Factory (void) +{ + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, "(%P|%t)~TAO_POAManager_Factory \n")); + } + + for (POAMANAGERSET::iterator iterator = this->poamanager_set_.begin (); + iterator != this->poamanager_set_.end (); + ++iterator) + { + ::PortableServer::POAManager_ptr poamanager = (*iterator); + CORBA::release (poamanager); + } +} + +::PortableServer::POAManager_ptr +TAO_POAManager_Factory::create_POAManager ( + const char * id, + const ::CORBA::PolicyList & policies + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::PortableServer::POAManagerFactory::ManagerAlreadyExists, + ::CORBA::PolicyError)) +{ + if (policies.length () > 1 + || (policies.length () == 1 && policies[0]->policy_type () != EndpointPolicy::ENDPOINT_POLICY_TYPE)) + { + ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY), + ::PortableServer::POAManager::_nil ()); + } + + PortableServer::POAManager_var poamanager = PortableServer::POAManager::_nil (); + if (id != 0) + { + poamanager = this->find (id ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::PortableServer::POAManager::_nil ()); + + // If we already have a manager with the same name throw an exception + if (!CORBA::is_nil (poamanager)) + { + ACE_THROW_RETURN ( + ::PortableServer::POAManagerFactory::ManagerAlreadyExists (), + ::PortableServer::POAManager::_nil ()); + } + } + + ACE_NEW_THROW_EX (poamanager, + TAO_POA_Manager (object_adapter_, id, policies, this), + CORBA::NO_MEMORY ( + CORBA::SystemException::_tao_minor_code (0, + ENOMEM), + CORBA::COMPLETED_NO)); + ACE_CHECK_RETURN (::PortableServer::POAManager::_nil ()); + + this->register_poamanager (poamanager.in ()); + + return PortableServer::POAManager::_duplicate (poamanager.in ()); +} + +::PortableServer::POAManagerFactory::POAManagerSeq * +TAO_POAManager_Factory::list ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::PortableServer::POAManagerFactory::POAManagerSeq_var poamanagers; + CORBA::ULong number_of_poamanagers = static_cast <CORBA::ULong> + (this->poamanager_set_.size ()); + ACE_NEW_THROW_EX (poamanagers, + PortableServer::POAManagerFactory::POAManagerSeq ( + number_of_poamanagers), + CORBA::NO_MEMORY ()); + ACE_CHECK_RETURN (0); + + poamanagers->length (number_of_poamanagers); + + CORBA::ULong index = 0; + for (POAMANAGERSET::iterator iterator = this->poamanager_set_.begin (); + iterator != this->poamanager_set_.end (); + ++iterator, ++index) + { + ::PortableServer::POAManager_ptr poamanager = (*iterator); + poamanagers[index] = + PortableServer::POAManager::_duplicate (poamanager); + } + + return poamanagers._retn (); +} + +::PortableServer::POAManager_ptr +TAO_POAManager_Factory::find ( + const char * id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::PortableServer::POAManager_ptr poamanager = + ::PortableServer::POAManager::_nil(); + + for (POAMANAGERSET::iterator iterator = this->poamanager_set_.begin (); + iterator != this->poamanager_set_.end (); + ++iterator) + { + CORBA::String_var poamanagerid = + (*iterator)->get_id (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::PortableServer::POAManager::_nil()); + + if (ACE_OS::strcmp (id, poamanagerid) == 0) + { + poamanager = PortableServer::POAManager::_duplicate (*iterator); + break; + } + } + + return poamanager; +} + +int +TAO_POAManager_Factory::remove_poamanager ( + ::PortableServer::POAManager_ptr poamanager) +{ + int retval = 0; + retval = this->poamanager_set_.remove (poamanager); + + if (retval == 0) + { + CORBA::release (poamanager); + } + + return retval; +} + +int +TAO_POAManager_Factory::register_poamanager ( + ::PortableServer::POAManager_ptr poamanager) +{ + return this->poamanager_set_.insert ( + PortableServer::POAManager::_duplicate (poamanager)); +} diff --git a/TAO/tao/PortableServer/POAManagerFactory.h b/TAO/tao/PortableServer/POAManagerFactory.h new file mode 100644 index 00000000000..ce8a82d0ac0 --- /dev/null +++ b/TAO/tao/PortableServer/POAManagerFactory.h @@ -0,0 +1,80 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file POAManagerFactory.h + * + * $Id$ + * + * POAManagerFactory + * + * @author Johnny Willemsen <jwillemsen@remedy.nl> + */ +//============================================================================= + +#ifndef TAO_POAMANAGERFACTORY_H +#define TAO_POAMANAGERFACTORY_H +#include /**/ "ace/pre.h" + +#include "tao/PortableServer/portableserver_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/PortableServer/POAManagerFactoryC.h" +#include "tao/PortableServer/Object_Adapter.h" +#include "tao/LocalObject.h" +#include "ace/Unbounded_Set.h" + +// This is to remove "inherits via dominance" warnings from MSVC. +// MSVC is being a little too paranoid. +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + +class TAO_PortableServer_Export TAO_POAManager_Factory : + public ::PortableServer::POAManagerFactory, + public TAO_Local_RefCounted_Object +{ +public: + TAO_POAManager_Factory (TAO_Object_Adapter &object_adapter); + + virtual ~TAO_POAManager_Factory (void); + + virtual ::PortableServer::POAManager_ptr create_POAManager ( + const char * id, + const ::CORBA::PolicyList & policies + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::PortableServer::POAManagerFactory::ManagerAlreadyExists, + ::CORBA::PolicyError)); + + virtual ::PortableServer::POAManagerFactory::POAManagerSeq * list ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::PortableServer::POAManager_ptr find ( + const char * id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + int remove_poamanager (::PortableServer::POAManager_ptr poamanager); + + int register_poamanager (::PortableServer::POAManager_ptr poamanager); + +private: + TAO_Object_Adapter &object_adapter_; + + typedef ACE_Unbounded_Set < ::PortableServer::POAManager_ptr> POAMANAGERSET; + + POAMANAGERSET poamanager_set_; +}; + + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif /* _MSC_VER */ + +#include /**/ "ace/post.h" +#endif /* TAO_POAMANAGERFACTORY_H */ diff --git a/TAO/tao/PortableServer/POAManagerFactory.pidl b/TAO/tao/PortableServer/POAManagerFactory.pidl new file mode 100644 index 00000000000..562190c8685 --- /dev/null +++ b/TAO/tao/PortableServer/POAManagerFactory.pidl @@ -0,0 +1,47 @@ +/** + * @file POAManagerFactory.pidl + * + * $Id$ + * + * @brief Pre-compiled IDL source for the PortableServer module. + * + $ACE_ROOT/bin/tao_idl \ + -Gp -Gd -Ge 1 -Sc -Sci -I$TAO_ROOT \ + -Wb,export_macro=TAO_PortableServer_Export \ + -Wb,export_include="tao/PortableServer/portableserver_export.h" \ + -Wb,pre_include="ace/pre.h" \ + -Wb,post_include="ace/post.h" \ + POAManagerFactory.pidl + */ + +#ifndef _PORTABLESERVER_POAMANAGER_FACTORY_IDL +#define _PORTABLESERVER_POAMANAGER_FACTORY_IDL + +#include "tao/Policy.pidl" + +#pragma prefix "omg.org" + +module PortableServer +{ +# pragma version PortableServer 2.3 + + local interface POAManager; + + local interface POAManagerFactory + { + typedef sequence<POAManager> POAManagerSeq; + + exception ManagerAlreadyExists {}; + + POAManager create_POAManager( + in string id, + in CORBA::PolicyList policies + ) raises(ManagerAlreadyExists, CORBA::PolicyError); + + POAManagerSeq list(); + + POAManager find(in string id); + }; +}; + +#endif // _PORTABLESERVER_POAMANAGER_FACTORY_IDL diff --git a/TAO/tao/PortableServer/POAManagerFactoryC.cpp b/TAO/tao/PortableServer/POAManagerFactoryC.cpp new file mode 100644 index 00000000000..ae838de1e98 --- /dev/null +++ b/TAO/tao/PortableServer/POAManagerFactoryC.cpp @@ -0,0 +1,423 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +// TAO_IDL - Generated from +// be/be_codegen.cpp:282 + + +#include "POAManagerFactoryC.h" +#include "tao/AnyTypeCode/Null_RefCount_Policy.h" +#include "tao/AnyTypeCode/TypeCode_Constants.h" +#include "tao/AnyTypeCode/Alias_TypeCode_Static.h" +#include "tao/AnyTypeCode/Objref_TypeCode_Static.h" +#include "tao/AnyTypeCode/Sequence_TypeCode_Static.h" +#include "tao/AnyTypeCode/String_TypeCode_Static.h" +#include "tao/AnyTypeCode/Struct_TypeCode_Static.h" +#include "tao/AnyTypeCode/TypeCode_Struct_Field.h" +#include "tao/CDR.h" +#include "tao/AnyTypeCode/Any.h" +#include "tao/AnyTypeCode/Any_Impl_T.h" +#include "tao/AnyTypeCode/Any_Dual_Impl_T.h" +#include "ace/OS_NS_string.h" + +// TAO_IDL - Generated from +// be/be_visitor_arg_traits.cpp:71 +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + + +// Arg traits specializations. +namespace TAO +{ +} + +TAO_END_VERSIONED_NAMESPACE_DECL + + + +// TAO_IDL - Generated from +// be/be_visitor_interface/interface_cs.cpp:60 + +// Traits specializations for PortableServer::POAManagerFactory. + +PortableServer::POAManagerFactory_ptr +TAO::Objref_Traits<PortableServer::POAManagerFactory>::duplicate ( + PortableServer::POAManagerFactory_ptr p + ) +{ + return PortableServer::POAManagerFactory::_duplicate (p); +} + +void +TAO::Objref_Traits<PortableServer::POAManagerFactory>::release ( + PortableServer::POAManagerFactory_ptr p + ) +{ + ::CORBA::release (p); +} + +PortableServer::POAManagerFactory_ptr +TAO::Objref_Traits<PortableServer::POAManagerFactory>::nil (void) +{ + return PortableServer::POAManagerFactory::_nil (); +} + +::CORBA::Boolean +TAO::Objref_Traits<PortableServer::POAManagerFactory>::marshal ( + const PortableServer::POAManagerFactory_ptr p, + TAO_OutputCDR & cdr + ) +{ + return ::CORBA::Object::marshal (p, cdr); +} + +// TAO_IDL - Generated from +// be/be_visitor_sequence/sequence_cs.cpp:65 + +#if !defined (_PORTABLESERVER_POAMANAGERFACTORY_POAMANAGERSEQ_CS_) +#define _PORTABLESERVER_POAMANAGERFACTORY_POAMANAGERSEQ_CS_ + +PortableServer::POAManagerFactory::POAManagerSeq::POAManagerSeq (void) +{} + +PortableServer::POAManagerFactory::POAManagerSeq::POAManagerSeq ( + ::CORBA::ULong max + ) + : TAO::unbounded_object_reference_sequence< + PortableServer::POAManager, + PortableServer::POAManager_var + > + (max) +{} + +PortableServer::POAManagerFactory::POAManagerSeq::POAManagerSeq ( + ::CORBA::ULong max, + ::CORBA::ULong length, + PortableServer::POAManager_ptr * buffer, + ::CORBA::Boolean release + ) + : TAO::unbounded_object_reference_sequence< + PortableServer::POAManager, + PortableServer::POAManager_var + > + (max, length, buffer, release) +{} + +PortableServer::POAManagerFactory::POAManagerSeq::POAManagerSeq ( + const POAManagerSeq &seq + ) + : TAO::unbounded_object_reference_sequence< + PortableServer::POAManager, + PortableServer::POAManager_var + > + (seq) +{} + +PortableServer::POAManagerFactory::POAManagerSeq::~POAManagerSeq (void) +{} + +void PortableServer::POAManagerFactory::POAManagerSeq::_tao_any_destructor ( + void * _tao_void_pointer + ) +{ + POAManagerSeq * _tao_tmp_pointer = + static_cast<POAManagerSeq *> (_tao_void_pointer); + delete _tao_tmp_pointer; +} + +#endif /* end #if !defined */ + +// TAO_IDL - Generated from +// be/be_visitor_typecode/alias_typecode.cpp:50 + + + +// TAO_IDL - Generated from +// be/be_visitor_typecode/typecode_defn.cpp:942 + +namespace PortableServer +{ + extern ::CORBA::TypeCode_ptr const _tc_POAManager; +} + + +#ifndef _TAO_TYPECODE_PortableServer_POAManagerFactory_POAManagerSeq_GUARD +#define _TAO_TYPECODE_PortableServer_POAManagerFactory_POAManagerSeq_GUARD + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ + namespace TypeCode + { + TAO::TypeCode::Sequence< ::CORBA::TypeCode_ptr const *, + TAO::Null_RefCount_Policy> + PortableServer_POAManagerFactory_POAManagerSeq_0 ( + ::CORBA::tk_sequence, + &PortableServer::_tc_POAManager, + 0U); + + ::CORBA::TypeCode_ptr const tc_PortableServer_POAManagerFactory_POAManagerSeq_0 = + &PortableServer_POAManagerFactory_POAManagerSeq_0; + + } +} + + +TAO_END_VERSIONED_NAMESPACE_DECL + + +#endif /* _TAO_TYPECODE_PortableServer_POAManagerFactory_POAManagerSeq_GUARD */ + +static TAO::TypeCode::Alias<char const *, + ::CORBA::TypeCode_ptr const *, + TAO::Null_RefCount_Policy> + _tao_tc_PortableServer_POAManagerFactory_POAManagerSeq ( + ::CORBA::tk_alias, + "IDL:omg.org/PortableServer/POAManagerFactory/POAManagerSeq:2.3", + "POAManagerSeq", + &TAO::TypeCode::tc_PortableServer_POAManagerFactory_POAManagerSeq_0); + +::CORBA::TypeCode_ptr const PortableServer::POAManagerFactory::_tc_POAManagerSeq = + &_tao_tc_PortableServer_POAManagerFactory_POAManagerSeq; + +// TAO_IDL - Generated from +// be/be_visitor_exception/exception_cs.cpp:63 + +PortableServer::POAManagerFactory::ManagerAlreadyExists::ManagerAlreadyExists (void) + : ::CORBA::UserException ( + "IDL:omg.org/PortableServer/POAManagerFactory/ManagerAlreadyExists:2.3", + "ManagerAlreadyExists" + ) +{ +} + +PortableServer::POAManagerFactory::ManagerAlreadyExists::~ManagerAlreadyExists (void) +{ +} + +PortableServer::POAManagerFactory::ManagerAlreadyExists::ManagerAlreadyExists (const ::PortableServer::POAManagerFactory::ManagerAlreadyExists &_tao_excp) + : ::CORBA::UserException ( + _tao_excp._rep_id (), + _tao_excp._name () + ) +{ +} + +PortableServer::POAManagerFactory::ManagerAlreadyExists& +PortableServer::POAManagerFactory::ManagerAlreadyExists::operator= (const ::PortableServer::POAManagerFactory::ManagerAlreadyExists &_tao_excp) +{ + this->::CORBA::UserException::operator= (_tao_excp); + return *this; +} + +void PortableServer::POAManagerFactory::ManagerAlreadyExists::_tao_any_destructor (void *_tao_void_pointer) +{ + ManagerAlreadyExists *_tao_tmp_pointer = + static_cast<ManagerAlreadyExists *> (_tao_void_pointer); + delete _tao_tmp_pointer; +} + +PortableServer::POAManagerFactory::ManagerAlreadyExists * +PortableServer::POAManagerFactory::ManagerAlreadyExists::_downcast ( ::CORBA::Exception *_tao_excp) +{ + return dynamic_cast<ManagerAlreadyExists *> (_tao_excp); +} + +const PortableServer::POAManagerFactory::ManagerAlreadyExists * +PortableServer::POAManagerFactory::ManagerAlreadyExists::_downcast ( ::CORBA::Exception const *_tao_excp) +{ + return dynamic_cast<const ManagerAlreadyExists *> (_tao_excp); +} + +::CORBA::Exception *PortableServer::POAManagerFactory::ManagerAlreadyExists::_alloc (void) +{ + ::CORBA::Exception *retval = 0; + ACE_NEW_RETURN (retval, ::PortableServer::POAManagerFactory::ManagerAlreadyExists, 0); + return retval; +} + +::CORBA::Exception * +PortableServer::POAManagerFactory::ManagerAlreadyExists::_tao_duplicate (void) const +{ + ::CORBA::Exception *result = 0; + ACE_NEW_RETURN ( + result, + ::PortableServer::POAManagerFactory::ManagerAlreadyExists (*this), + 0 + ); + return result; +} + +void PortableServer::POAManagerFactory::ManagerAlreadyExists::_raise (void) const +{ + TAO_RAISE (*this); +} + +void PortableServer::POAManagerFactory::ManagerAlreadyExists::_tao_encode ( + TAO_OutputCDR & + ACE_ENV_ARG_DECL + ) const +{ + ACE_THROW ( ::CORBA::MARSHAL ()); +} + +void PortableServer::POAManagerFactory::ManagerAlreadyExists::_tao_decode ( + TAO_InputCDR & + ACE_ENV_ARG_DECL + ) +{ + ACE_THROW ( ::CORBA::MARSHAL ()); +} + +// TAO extension - the virtual _type method. +::CORBA::TypeCode_ptr PortableServer::POAManagerFactory::ManagerAlreadyExists::_tao_type (void) const +{ + return ::PortableServer::POAManagerFactory::_tc_ManagerAlreadyExists; +} + +// TAO_IDL - Generated from +// be/be_visitor_typecode/struct_typecode.cpp:89 + +static TAO::TypeCode::Struct_Field<char const *, ::CORBA::TypeCode_ptr const *> const * const _tao_fields_PortableServer_POAManagerFactory_ManagerAlreadyExists = 0; +static TAO::TypeCode::Struct<char const *, + ::CORBA::TypeCode_ptr const *, + TAO::TypeCode::Struct_Field<char const *, ::CORBA::TypeCode_ptr const *> const *, + TAO::Null_RefCount_Policy> + _tao_tc_PortableServer_POAManagerFactory_ManagerAlreadyExists ( + ::CORBA::tk_except, + "IDL:omg.org/PortableServer/POAManagerFactory/ManagerAlreadyExists:2.3", + "ManagerAlreadyExists", + _tao_fields_PortableServer_POAManagerFactory_ManagerAlreadyExists, + 0); + +::CORBA::TypeCode_ptr const PortableServer::POAManagerFactory::_tc_ManagerAlreadyExists = + &_tao_tc_PortableServer_POAManagerFactory_ManagerAlreadyExists; + +PortableServer::POAManagerFactory::POAManagerFactory (void) +{} + +PortableServer::POAManagerFactory::~POAManagerFactory (void) +{} + +PortableServer::POAManagerFactory_ptr +PortableServer::POAManagerFactory::_narrow ( + ::CORBA::Object_ptr _tao_objref + ACE_ENV_ARG_DECL_NOT_USED + ) +{ + return POAManagerFactory::_duplicate ( + dynamic_cast<POAManagerFactory_ptr> (_tao_objref) + ); +} + +PortableServer::POAManagerFactory_ptr +PortableServer::POAManagerFactory::_unchecked_narrow ( + ::CORBA::Object_ptr _tao_objref + ACE_ENV_ARG_DECL_NOT_USED + ) +{ + return POAManagerFactory::_duplicate ( + dynamic_cast<POAManagerFactory_ptr> (_tao_objref) + ); +} + +PortableServer::POAManagerFactory_ptr +PortableServer::POAManagerFactory::_duplicate (POAManagerFactory_ptr obj) +{ + if (! ::CORBA::is_nil (obj)) + { + obj->_add_ref (); + } + + return obj; +} + +void +PortableServer::POAManagerFactory::_tao_release (POAManagerFactory_ptr obj) +{ + ::CORBA::release (obj); +} + +::CORBA::Boolean +PortableServer::POAManagerFactory::_is_a ( + const char *value + ACE_ENV_ARG_DECL_NOT_USED + ) +{ + if ( + !ACE_OS::strcmp ( + value, + "IDL:omg.org/PortableServer/POAManagerFactory:2.3" + ) || + !ACE_OS::strcmp ( + value, + "IDL:omg.org/CORBA/LocalObject:1.0" + ) || + !ACE_OS::strcmp ( + value, + "IDL:omg.org/CORBA/Object:1.0" + ) + ) + { + return true; // success using local knowledge + } + else + { + return false; + } +} + +const char* PortableServer::POAManagerFactory::_interface_repository_id (void) const +{ + return "IDL:omg.org/PortableServer/POAManagerFactory:2.3"; +} + +::CORBA::Boolean +PortableServer::POAManagerFactory::marshal (TAO_OutputCDR &) +{ + return false; +} + +// TAO_IDL - Generated from +// be/be_visitor_typecode/objref_typecode.cpp:76 + +static TAO::TypeCode::Objref<char const *, + TAO::Null_RefCount_Policy> + _tao_tc_PortableServer_POAManagerFactory ( + ::CORBA::tk_local_interface, + "IDL:omg.org/PortableServer/POAManagerFactory:2.3", + "POAManagerFactory"); + +namespace PortableServer +{ + ::CORBA::TypeCode_ptr const _tc_POAManagerFactory = + &_tao_tc_PortableServer_POAManagerFactory; +} + + + diff --git a/TAO/tao/PortableServer/POAManagerFactoryC.h b/TAO/tao/PortableServer/POAManagerFactoryC.h new file mode 100644 index 00000000000..77890521957 --- /dev/null +++ b/TAO/tao/PortableServer/POAManagerFactoryC.h @@ -0,0 +1,381 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +// TAO_IDL - Generated from +// be/be_codegen.cpp:154 + +#ifndef _TAO_IDL_POAMANAGERFACTORYC_H_ +#define _TAO_IDL_POAMANAGERFACTORYC_H_ + +#include /**/ "ace/pre.h" + + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/PortableServer/portableserver_export.h" +#include "tao/AnyTypeCode/AnyTypeCode_methods.h" +#include "tao/ORB.h" +#include "tao/SystemException.h" +#include "tao/Environment.h" +#include "tao/Object.h" +#include "tao/AnyTypeCode/PolicyA.h" +#include "tao/Sequence_T.h" +#include "tao/Objref_VarOut_T.h" +#include "tao/Seq_Var_T.h" +#include "tao/Seq_Out_T.h" +#include "tao/Versioned_Namespace.h" + +#include "tao/PolicyC.h" + +#if defined (TAO_EXPORT_MACRO) +#undef TAO_EXPORT_MACRO +#endif +#define TAO_EXPORT_MACRO TAO_PortableServer_Export + +// TAO_IDL - Generated from +// be/be_visitor_module/module_ch.cpp:49 + +namespace PortableServer +{ + + // TAO_IDL - Generated from + // be/be_interface.cpp:640 + +#if !defined (_PORTABLESERVER_POAMANAGER__VAR_OUT_CH_) +#define _PORTABLESERVER_POAMANAGER__VAR_OUT_CH_ + + class POAManager; + typedef POAManager *POAManager_ptr; + + typedef + TAO_Objref_Var_T< + POAManager + > + POAManager_var; + + typedef + TAO_Objref_Out_T< + POAManager + > + POAManager_out; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be/be_interface.cpp:640 + +#if !defined (_PORTABLESERVER_POAMANAGERFACTORY__VAR_OUT_CH_) +#define _PORTABLESERVER_POAMANAGERFACTORY__VAR_OUT_CH_ + + class POAManagerFactory; + typedef POAManagerFactory *POAManagerFactory_ptr; + + typedef + TAO_Objref_Var_T< + POAManagerFactory + > + POAManagerFactory_var; + + typedef + TAO_Objref_Out_T< + POAManagerFactory + > + POAManagerFactory_out; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be/be_visitor_interface/interface_ch.cpp:54 + +#if !defined (_PORTABLESERVER_POAMANAGERFACTORY_CH_) +#define _PORTABLESERVER_POAMANAGERFACTORY_CH_ + + class TAO_PortableServer_Export POAManagerFactory + : public virtual ::CORBA::Object + { + public: + typedef POAManagerFactory_ptr _ptr_type; + typedef POAManagerFactory_var _var_type; + + // The static operations. + static POAManagerFactory_ptr _duplicate (POAManagerFactory_ptr obj); + + static void _tao_release (POAManagerFactory_ptr obj); + + static POAManagerFactory_ptr _narrow ( + ::CORBA::Object_ptr obj + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ); + + static POAManagerFactory_ptr _unchecked_narrow ( + ::CORBA::Object_ptr obj + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ); + + static POAManagerFactory_ptr _nil (void) + { + return static_cast<POAManagerFactory_ptr> (0); + } + + + + // TAO_IDL - Generated from + // be/be_visitor_sequence/sequence_ch.cpp:101 + +#if !defined (_PORTABLESERVER_POAMANAGERFACTORY_POAMANAGERSEQ_CH_) +#define _PORTABLESERVER_POAMANAGERFACTORY_POAMANAGERSEQ_CH_ + + class POAManagerSeq; + + typedef + TAO_VarSeq_Var_T< + POAManagerSeq + > + POAManagerSeq_var; + + typedef + TAO_Seq_Out_T< + POAManagerSeq + > + POAManagerSeq_out; + + class TAO_PortableServer_Export POAManagerSeq + : public + TAO::unbounded_object_reference_sequence< + PortableServer::POAManager, + PortableServer::POAManager_var + > + { + public: + POAManagerSeq (void); + POAManagerSeq ( ::CORBA::ULong max); + POAManagerSeq ( + ::CORBA::ULong max, + ::CORBA::ULong length, + PortableServer::POAManager_ptr* buffer, + ::CORBA::Boolean release = false + ); + POAManagerSeq (const POAManagerSeq &); + ~POAManagerSeq (void); + + static void _tao_any_destructor (void *); + + typedef POAManagerSeq_var _var_type; + }; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be/be_visitor_typecode/typecode_decl.cpp:49 + + static ::CORBA::TypeCode_ptr const _tc_POAManagerSeq; + + // TAO_IDL - Generated from + // be/be_visitor_exception/exception_ch.cpp:53 + +#if !defined (_PORTABLESERVER_POAMANAGERFACTORY_MANAGERALREADYEXISTS_CH_) +#define _PORTABLESERVER_POAMANAGERFACTORY_MANAGERALREADYEXISTS_CH_ + + class TAO_PortableServer_Export ManagerAlreadyExists : public ::CORBA::UserException + { + public: + + ManagerAlreadyExists (void); + ManagerAlreadyExists (const ManagerAlreadyExists &); + ~ManagerAlreadyExists (void); + + ManagerAlreadyExists &operator= (const ManagerAlreadyExists &); + + static void _tao_any_destructor (void *); + + static ManagerAlreadyExists *_downcast ( ::CORBA::Exception *); + static const ManagerAlreadyExists *_downcast ( ::CORBA::Exception const *); + + static ::CORBA::Exception *_alloc (void); + + virtual ::CORBA::Exception *_tao_duplicate (void) const; + + virtual void _raise (void) const; + + virtual void _tao_encode ( + TAO_OutputCDR &cdr + ACE_ENV_ARG_DECL + ) const; + + virtual void _tao_decode ( + TAO_InputCDR &cdr + ACE_ENV_ARG_DECL + ); + + virtual ::CORBA::TypeCode_ptr _tao_type (void) const; + }; + + // TAO_IDL - Generated from + // be/be_visitor_typecode/typecode_decl.cpp:49 + + static ::CORBA::TypeCode_ptr const _tc_ManagerAlreadyExists; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::PortableServer::POAManager_ptr create_POAManager ( + const char * id, + const ::CORBA::PolicyList & policies + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::PortableServer::POAManagerFactory::ManagerAlreadyExists, + ::CORBA::PolicyError + )) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::PortableServer::POAManagerFactory::POAManagerSeq * list ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + ::CORBA::SystemException + )) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::PortableServer::POAManager_ptr find ( + const char * id + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + ::CORBA::SystemException + )) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_interface/interface_ch.cpp:210 + + virtual ::CORBA::Boolean _is_a ( + const char *type_id + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ); + + virtual const char* _interface_repository_id (void) const; + virtual ::CORBA::Boolean marshal (TAO_OutputCDR &cdr); + + protected: + // Abstract or local interface only. + POAManagerFactory (void); + + virtual ~POAManagerFactory (void); + + private: + // Private and unimplemented for concrete interfaces. + POAManagerFactory (const POAManagerFactory &); + + void operator= (const POAManagerFactory &); + }; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be/be_visitor_typecode/typecode_decl.cpp:49 + + extern TAO_PortableServer_Export ::CORBA::TypeCode_ptr const _tc_POAManagerFactory; + +// TAO_IDL - Generated from +// be/be_visitor_module/module_ch.cpp:78 + +} // module PortableServer + +// TAO_IDL - Generated from +// be/be_visitor_traits.cpp:63 +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + + +// Traits specializations. +namespace TAO +{ + +#if !defined (_PORTABLESERVER_POAMANAGER__TRAITS_) +#define _PORTABLESERVER_POAMANAGER__TRAITS_ + + template<> + struct TAO_PortableServer_Export Objref_Traits< ::PortableServer::POAManager> + { + static ::PortableServer::POAManager_ptr duplicate ( + ::PortableServer::POAManager_ptr + ); + static void release ( + ::PortableServer::POAManager_ptr + ); + static ::PortableServer::POAManager_ptr nil (void); + static ::CORBA::Boolean marshal ( + const ::PortableServer::POAManager_ptr p, + TAO_OutputCDR & cdr + ); + }; + +#endif /* end #if !defined */ + +#if !defined (_PORTABLESERVER_POAMANAGERFACTORY__TRAITS_) +#define _PORTABLESERVER_POAMANAGERFACTORY__TRAITS_ + + template<> + struct TAO_PortableServer_Export Objref_Traits< ::PortableServer::POAManagerFactory> + { + static ::PortableServer::POAManagerFactory_ptr duplicate ( + ::PortableServer::POAManagerFactory_ptr + ); + static void release ( + ::PortableServer::POAManagerFactory_ptr + ); + static ::PortableServer::POAManagerFactory_ptr nil (void); + static ::CORBA::Boolean marshal ( + const ::PortableServer::POAManagerFactory_ptr p, + TAO_OutputCDR & cdr + ); + }; + +#endif /* end #if !defined */ +} +TAO_END_VERSIONED_NAMESPACE_DECL + + + +// TAO_IDL - Generated from +// be/be_codegen.cpp:1092 +#include /**/ "ace/post.h" + +#endif /* ifndef */ + + diff --git a/TAO/tao/PortableServer/PortableServer.h b/TAO/tao/PortableServer/PortableServer.h index 4c27f187332..256499a7456 100644 --- a/TAO/tao/PortableServer/PortableServer.h +++ b/TAO/tao/PortableServer/PortableServer.h @@ -41,6 +41,7 @@ TAO_END_VERSIONED_NAMESPACE_DECL #include "tao/PortableServer/PortableServerC.h" #undef TAO_PORTABLESERVER_SAFE_INCLUDE #include "tao/PortableServer/POAManagerC.h" +#include "tao/PortableServer/POAManagerFactoryC.h" #include "tao/PortableServer/PS_CurrentC.h" #include "tao/PortableServer/PortableServer_Functions.h" #include "tao/PortableServer/PortableServer_WFunctions.h" diff --git a/TAO/tao/PortableServer/PortableServer.pidl b/TAO/tao/PortableServer/PortableServer.pidl index 938c7edeaec..50000e9bcb8 100644 --- a/TAO/tao/PortableServer/PortableServer.pidl +++ b/TAO/tao/PortableServer/PortableServer.pidl @@ -74,9 +74,12 @@ module PortableServer const CORBA::PolicyType SERVANT_RETENTION_POLICY_ID = 21; const CORBA::PolicyType REQUEST_PROCESSING_POLICY_ID = 22; - // Forward declaration + // Forward declaration POAManager interface. local interface POAManager; + // Forward declaration POAManagerFactory interface. + local interface POAManagerFactory; + // Forward declaration AdapterActivator interface. local interface AdapterActivator; @@ -146,6 +149,7 @@ module PortableServer readonly attribute POA the_parent; readonly attribute POAList the_children; readonly attribute POAManager the_POAManager; + readonly attribute POAManagerFactory the_POAManagerFactory; attribute AdapterActivator the_activator; // Servant Manager registration: diff --git a/TAO/tao/PortableServer/PortableServerC.h b/TAO/tao/PortableServer/PortableServerC.h index f84d9eeaa47..80c5bdc4fcc 100644 --- a/TAO/tao/PortableServer/PortableServerC.h +++ b/TAO/tao/PortableServer/PortableServerC.h @@ -197,6 +197,25 @@ namespace PortableServer #endif /* end #if !defined */ +#if !defined (_PORTABLESERVER_POAMANAGERFACTORY__VAR_OUT_CH_) +#define _PORTABLESERVER_POAMANAGERFACTORY__VAR_OUT_CH_ + + class POAManagerFactory; + typedef POAManagerFactory *POAManagerFactory_ptr; + + typedef + TAO_Objref_Var_T< + POAManagerFactory + > + POAManagerFactory_var; + + typedef + TAO_Objref_Out_T< + POAManagerFactory + > + POAManagerFactory_out; + +#endif /* end #if !defined */ // TAO_IDL - Generated from // be\be_interface.cpp:598 @@ -978,6 +997,13 @@ namespace PortableServer CORBA::SystemException )) = 0; + virtual ::PortableServer::POAManagerFactory_ptr the_POAManagerFactory ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) = 0; + // TAO_IDL - Generated from // be\be_visitor_operation/operation_ch.cpp:46 diff --git a/TAO/tao/PortableServer/Regular_POA.cpp b/TAO/tao/PortableServer/Regular_POA.cpp index 7383d7bd9cf..08f4965c8e7 100644 --- a/TAO/tao/PortableServer/Regular_POA.cpp +++ b/TAO/tao/PortableServer/Regular_POA.cpp @@ -12,7 +12,7 @@ ACE_RCSID (PortableServer, TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_Regular_POA::TAO_Regular_POA (const TAO_Root_POA::String &name, - TAO_POA_Manager &poa_manager, + PortableServer::POAManager_ptr poa_manager, const TAO_POA_Policy_Set &policies, TAO_Root_POA *parent, ACE_Lock &lock, diff --git a/TAO/tao/PortableServer/Regular_POA.h b/TAO/tao/PortableServer/Regular_POA.h index 7a6d3c2289c..eddd7bf3205 100644 --- a/TAO/tao/PortableServer/Regular_POA.h +++ b/TAO/tao/PortableServer/Regular_POA.h @@ -39,7 +39,7 @@ class TAO_PortableServer_Export TAO_Regular_POA { public: TAO_Regular_POA (const String &name, - TAO_POA_Manager &poa_manager, + PortableServer::POAManager_ptr poa_manager, const TAO_POA_Policy_Set &policies, TAO_Root_POA *parent, ACE_Lock &lock, diff --git a/TAO/tao/PortableServer/Root_POA.cpp b/TAO/tao/PortableServer/Root_POA.cpp index ba9b69a719b..b476ae8bec6 100644 --- a/TAO/tao/PortableServer/Root_POA.cpp +++ b/TAO/tao/PortableServer/Root_POA.cpp @@ -19,6 +19,7 @@ #include "tao/PortableServer/AdapterActivatorC.h" #include "tao/PortableServer/Non_Servant_Upcall.h" #include "tao/PortableServer/POAManager.h" +#include "tao/PortableServer/POAManagerFactory.h" #include "tao/PortableServer/ServantManagerC.h" #include "tao/PortableServer/poa_macros.h" #include "tao/PortableServer/POA_Guard.h" @@ -30,6 +31,7 @@ #include "tao/PortableServer/ServantRetentionStrategy.h" #include "tao/PortableServer/ImplicitActivationStrategy.h" #include "tao/PortableServer/ThreadStrategy.h" +#include "tao/PortableServer/Acceptor_Filter_Factory.h" #include "tao/StringSeqC.h" #include "tao/PortableInterceptorC.h" @@ -199,7 +201,7 @@ TAO_Root_POA::set_obj_ref_factory ( } TAO_Root_POA::TAO_Root_POA (const TAO_Root_POA::String &name, - TAO_POA_Manager &poa_manager, + PortableServer::POAManager_ptr poa_manager, const TAO_POA_Policy_Set &policies, TAO_Root_POA *parent, ACE_Lock &lock, @@ -208,7 +210,8 @@ TAO_Root_POA::TAO_Root_POA (const TAO_Root_POA::String &name, TAO_Object_Adapter *object_adapter ACE_ENV_ARG_DECL) : name_ (name), - poa_manager_ (poa_manager), + poa_manager_ (* (dynamic_cast <TAO_POA_Manager*> (poa_manager))), + poa_manager_factory_ (* (object_adapter->poa_manager_factory_)), tagged_component_ (), tagged_component_id_ (), profile_id_array_ (0), @@ -232,6 +235,7 @@ TAO_Root_POA::TAO_Root_POA (const TAO_Root_POA::String &name, wait_for_completion_pending_ (0), waiting_destruction_ (0), servant_deactivation_condition_ (thread_lock), + filter_factory_ (0), caller_key_to_object_ (0), servant_for_key_to_object_ (0) { @@ -311,6 +315,10 @@ TAO_Root_POA::TAO_Root_POA (const TAO_Root_POA::String &name, TAO_Root_POA::~TAO_Root_POA (void) { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, "(%P|%t)~TAO_Root_POA : %s\n", this->the_name ())); + } } void @@ -399,41 +407,53 @@ TAO_Root_POA::create_POA_i (const char *adapter_name, // created and associated with the new POA. Otherwise, the specified // POAManager object is associated with the new POA. The POAManager // object can be obtained using the attribute name the_POAManager. - TAO_POA_Manager* tao_poa_manager = 0; - PortableServer::POAManager_var safe_poa_manager; + + PortableServer::POAManager_var the_poa_manager; + if (CORBA::is_nil (poa_manager)) { - ACE_NEW_THROW_EX (tao_poa_manager, - TAO_POA_Manager (this->object_adapter ()), - CORBA::NO_MEMORY ()); + PortableServer::POA_var poa = PortableServer::POA::_duplicate (this); + PortableServer::POA_var root_poa; + + // Find the RootPOA by traversing the POA hierarchy until the + // RootPOA is reached. The RootPOA has no parent. + while (!CORBA::is_nil (poa.in ())) + { + root_poa = poa; + poa = poa->the_parent (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (PortableServer::POA::_nil ()); + } + + // Get the POAManagerFactory instance owned by RootPOA. + PortableServer::POAManagerFactory_var tao_poa_manager_factory + = root_poa->the_POAManagerFactory (); + + CORBA::PolicyList empty_policies; + // The POAManager name will be generated when the POAManager instance + // is created. + the_poa_manager + = tao_poa_manager_factory->create_POAManager (0, + empty_policies + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (PortableServer::POA::_nil ()); - safe_poa_manager = tao_poa_manager; } else { - // This is the POAManager that was passed in. Do not put it in the - // safe_poa_manager as we do not want it to be destroyed in case - // an exception is thrown during the create_POA_i() method. - tao_poa_manager = dynamic_cast<TAO_POA_Manager *> (poa_manager); + the_poa_manager = PortableServer::POAManager::_duplicate (poa_manager); } PortableServer::POA_var poa = this->create_POA_i (adapter_name, - *tao_poa_manager, + the_poa_manager.in (), tao_policies ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (PortableServer::POA::_nil ()); - // Release the POA_Manager_var since we got here without error. The - // TAO_Regular_POA object takes ownership of the POA_Manager object - // (actually it shares the ownership with its peers). - (void) safe_poa_manager._retn (); - return poa._retn (); } TAO_Root_POA * TAO_Root_POA::new_POA (const String &name, - TAO_POA_Manager &poa_manager, + PortableServer::POAManager_ptr poa_manager, const TAO_POA_Policy_Set &policies, TAO_Root_POA *parent, ACE_Lock &lock, @@ -462,7 +482,7 @@ TAO_Root_POA::new_POA (const String &name, PortableServer::POA_ptr TAO_Root_POA::create_POA_i (const TAO_Root_POA::String &adapter_name, - TAO_POA_Manager &poa_manager, + PortableServer::POAManager_ptr poa_manager, const TAO_POA_Policy_Set &policies ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, @@ -2252,13 +2272,22 @@ TAO_Root_POA::key_to_stub_i (const TAO::ObjectKey &key, ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); - TAO_Default_Acceptor_Filter filter; + if (this->filter_factory_ == 0) + this->filter_factory_ + = ACE_Dynamic_Service<TAO_Acceptor_Filter_Factory>::instance ("TAO_Acceptor_Filter_Factory"); + + TAO_Acceptor_Filter* filter = + this->filter_factory_->create_object (this->poa_manager_); + + // Give ownership to the auto pointer. + auto_ptr<TAO_Acceptor_Filter> new_filter (filter); + TAO_Stub *data = this->create_stub_object ( key, type_id, client_exposed_policies._retn (), - &filter, + filter, this->orb_core_.lane_resources ().acceptor_registry () ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); @@ -2532,8 +2561,8 @@ TAO_Root_POA::ORT_adapter_i (void) ACE_CATCHANY { ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Cannot initialize the " - "object_reference_template_adapter"); + "(%P|%t) Cannot initialize the " + "object_reference_template_adapter\n"); } ACE_ENDTRY; ACE_CHECK_RETURN (0); @@ -2862,13 +2891,14 @@ TAO_Root_POA::the_POAManager (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) return PortableServer::POAManager::_duplicate (&this->poa_manager_); } -PortableInterceptor::AdapterManagerId -TAO_Root_POA::get_manager_id (ACE_ENV_SINGLE_ARG_DECL) +PortableServer::POAManagerFactory_ptr +TAO_Root_POA::the_POAManagerFactory (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException)) { - return this->poa_manager_.get_manager_id (ACE_ENV_SINGLE_ARG_PARAMETER); + return PortableServer::POAManagerFactory::_duplicate (&this->poa_manager_factory_); } + CORBA::ORB_ptr TAO_Root_POA::_get_orb (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) { diff --git a/TAO/tao/PortableServer/Root_POA.h b/TAO/tao/PortableServer/Root_POA.h index 59d8e490c0c..eb6502c9ad1 100644 --- a/TAO/tao/PortableServer/Root_POA.h +++ b/TAO/tao/PortableServer/Root_POA.h @@ -68,9 +68,11 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL // Forward Declaration class TAO_Acceptor_Filter; +class TAO_Acceptor_Filter_Factory; class TAO_Acceptor_Registry; class TAO_IORInfo; class TAO_Regular_POA; +class TAO_POAManager_Factory; namespace PortableInterceptor { @@ -208,11 +210,8 @@ public: ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); - /// @todo At the moment to POAManagerFactory is implemented and the - /// POAManager has the get_id method this can be zapped, IORInfo can - /// then just call get_id - PortableInterceptor::AdapterManagerId get_manager_id ( - ACE_ENV_SINGLE_ARG_DECL) + PortableServer::POAManagerFactory_ptr the_POAManagerFactory ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); /// This method returns the adapter_name as a sequence of strings of @@ -359,7 +358,7 @@ public: ); TAO_Root_POA (const String &name, - TAO_POA_Manager &poa_manager, + PortableServer::POAManager_ptr poa_manager, const TAO_POA_Policy_Set &policies, TAO_Root_POA *parent, ACE_Lock &lock, @@ -605,7 +604,7 @@ protected: /// Template method for creating new POA's of this type. virtual TAO_Root_POA *new_POA (const String &name, - TAO_POA_Manager &poa_manager, + PortableServer::POAManager_ptr poa_manager, const TAO_POA_Policy_Set &policies, TAO_Root_POA *parent, ACE_Lock &lock, @@ -625,7 +624,7 @@ protected: PortableServer::POA::InvalidPolicy)); PortableServer::POA_ptr create_POA_i (const String &adapter_name, - TAO_POA_Manager &poa_manager, + PortableServer::POAManager_ptr poa_manager, const TAO_POA_Policy_Set &policies ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, @@ -879,8 +878,10 @@ protected: String name_; - /// The POA Manager belonging to this POA + /// Reference to the POAManager that this poa assicuates with. TAO_POA_Manager &poa_manager_; + /// Reference to the POAManagerFactory that generate the POAManager. + TAO_POAManager_Factory& poa_manager_factory_; IOP::TaggedComponentList tagged_component_; @@ -942,6 +943,8 @@ protected: TAO_SYNCH_CONDITION servant_deactivation_condition_; + TAO_Acceptor_Filter_Factory * filter_factory_; + public: // @todo Temporarily for servant retention CORBA::ULong caller_key_to_object_; diff --git a/TAO/tao/PortableServer/Servant_Dispatcher.h b/TAO/tao/PortableServer/Servant_Dispatcher.h index d2741f46546..10c062e52d1 100644 --- a/TAO/tao/PortableServer/Servant_Dispatcher.h +++ b/TAO/tao/PortableServer/Servant_Dispatcher.h @@ -36,6 +36,12 @@ class TAO_Root_POA; class TAO_ORB_Core; class TAO_ServerRequest; +namespace PortableServer +{ + class POAManager; + typedef POAManager *POAManager_ptr; +} + /** * @class TAO_Servant_Dispatcher * @@ -70,7 +76,7 @@ public: /// Factory method for creating new POA's. virtual TAO_Root_POA *create_Root_POA ( const ACE_CString &name, - TAO_POA_Manager &poa_manager, + PortableServer::POAManager_ptr poa_manager, const TAO_POA_Policy_Set &policies, ACE_Lock &lock, TAO_SYNCH_MUTEX &thread_lock, |