TAO_POAManager_Factory Class Reference

#include <POAManagerFactory.h>

Inheritance diagram for TAO_POAManager_Factory:

Inheritance graph
[legend]
Collaboration diagram for TAO_POAManager_Factory:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 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)
virtual ::PortableServer::POAManagerFactory::POAManagerSeq * list (void)
virtual ::PortableServer::POAManager_ptr find (const char *id)
void remove_all_poamanagers (void)
int remove_poamanager (::PortableServer::POAManager_ptr poamanager)
int register_poamanager (::PortableServer::POAManager_ptr poamanager)

Private Types

typedef ACE_Unbounded_Set<
::PortableServer::POAManager_ptr
POAMANAGERSET

Private Attributes

TAO_Object_Adapterobject_adapter_
POAMANAGERSET poamanager_set_

Detailed Description

Definition at line 41 of file POAManagerFactory.h.


Member Typedef Documentation

typedef ACE_Unbounded_Set< ::PortableServer::POAManager_ptr> TAO_POAManager_Factory::POAMANAGERSET [private]

Definition at line 67 of file POAManagerFactory.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_POAManager_Factory::TAO_POAManager_Factory ( TAO_Object_Adapter object_adapter  ) 

Definition at line 17 of file POAManagerFactory.cpp.

00017                                                                                   :
00018   object_adapter_ (object_adapter)
00019 {
00020 }

TAO_POAManager_Factory::~TAO_POAManager_Factory ( void   )  [virtual]

Definition at line 22 of file POAManagerFactory.cpp.

References remove_all_poamanagers().

00023 {
00024   this->remove_all_poamanagers ();
00025 }


Member Function Documentation

PortableServer::POAManager_ptr TAO_POAManager_Factory::create_POAManager ( const char *  id,
const ::CORBA::PolicyList &  policies 
)

Definition at line 28 of file POAManagerFactory.cpp.

References TAO_Objref_Var_T< T >::_retn(), CORBA::SystemException::_tao_minor_code(), ACE_NEW_THROW_EX, CORBA::COMPLETED_NO, find(), TAO_Objref_Var_T< T >::in(), CORBA::is_nil(), TAO_POA_Policy_Set::merge_policies(), TAO_Policy_Validator::merge_policies(), object_adapter_, TAO_Object_Adapter::orb_core(), TAO_POA_Policy_Set::policies(), register_poamanager(), TAO_POA_Policy_Set::validate_policies(), and TAO_Object_Adapter::validator().

Referenced by TAO_Object_Adapter::open().

00032 {
00033   // Validate the policy.
00034   TAO_POA_Policy_Set tao_policies (TAO_POA_Policy_Set (this->object_adapter_.default_poa_policies ()));
00035 
00036   // Merge policies from the ORB level.
00037   this->object_adapter_.validator ().merge_policies (tao_policies.policies ());
00038 
00039   // Merge in any policies that the user may have specified.
00040   tao_policies.merge_policies (policies);
00041 
00042   // If any of the policy objects specified are not valid for the ORB
00043   // implementation, if conflicting policy objects are specified, or
00044   // if any of the specified policy objects require prior
00045   // administrative action that has not been performed, an
00046   // InvalidPolicy exception is raised containing the index in the
00047   // policies parameter value of the first offending policy object.
00048   tao_policies.validate_policies (this->object_adapter_.validator (),
00049                                   this->object_adapter_.orb_core ());
00050 
00051   PortableServer::POAManager_var poamanager;
00052 
00053   if (id != 0)
00054   {
00055     poamanager = this->find (id);
00056 
00057     // If we already have a manager with the same name throw an exception
00058     if (!CORBA::is_nil (poamanager.in()))
00059       {
00060         throw ::PortableServer::POAManagerFactory::ManagerAlreadyExists ();
00061       }
00062   }
00063 
00064   // this indirection brought to you by borland's compiler and its refusal
00065   // to directly assign the newly created TAO_POA_Manager to a POAManager_var.
00066   {
00067     PortableServer::POAManager_ptr pm = 0;
00068     ACE_NEW_THROW_EX (pm,
00069                       TAO_POA_Manager (object_adapter_, id, policies, this),
00070                       CORBA::NO_MEMORY
00071                       (CORBA::SystemException::_tao_minor_code (0, ENOMEM),
00072                        CORBA::COMPLETED_NO));
00073     poamanager = pm;
00074   }
00075 
00076   this->register_poamanager (poamanager.in ());
00077 
00078   return poamanager._retn ();
00079 }

PortableServer::POAManager_ptr TAO_POAManager_Factory::find ( const char *  id  ) 

Definition at line 108 of file POAManagerFactory.cpp.

References ACE_Unbounded_Set_Ex< T, C >::end(), poamanager_set_, and ACE_OS::strcmp().

Referenced by create_POAManager().

00109 {
00110   ::PortableServer::POAManager_ptr poamanager =
00111     ::PortableServer::POAManager::_nil();
00112 
00113   for (POAMANAGERSET::iterator iterator = this->poamanager_set_.begin ();
00114         iterator != this->poamanager_set_.end ();
00115         ++iterator)
00116     {
00117       CORBA::String_var poamanagerid = (*iterator)->get_id ();
00118 
00119       if (ACE_OS::strcmp (id, poamanagerid.in()) == 0)
00120         {
00121           poamanager = PortableServer::POAManager::_duplicate (*iterator);
00122           break;
00123         }
00124     }
00125 
00126   return poamanager;
00127 }

PortableServer::POAManagerFactory::POAManagerSeq * TAO_POAManager_Factory::list ( void   ) 

Definition at line 82 of file POAManagerFactory.cpp.

References ACE_NEW_THROW_EX, ACE_Unbounded_Set_Ex< T, C >::end(), poamanager_set_, and ACE_Unbounded_Set_Ex< T, C >::size().

00083 {
00084   ::PortableServer::POAManagerFactory::POAManagerSeq_var poamanagers;
00085   CORBA::ULong number_of_poamanagers = static_cast <CORBA::ULong>
00086                                               (this->poamanager_set_.size ());
00087   ACE_NEW_THROW_EX (poamanagers,
00088                     PortableServer::POAManagerFactory::POAManagerSeq (
00089                       number_of_poamanagers),
00090                     CORBA::NO_MEMORY ());
00091 
00092   poamanagers->length (number_of_poamanagers);
00093 
00094   CORBA::ULong index = 0;
00095   for (POAMANAGERSET::iterator iterator = this->poamanager_set_.begin ();
00096         iterator != this->poamanager_set_.end ();
00097         ++iterator, ++index)
00098     {
00099       ::PortableServer::POAManager_ptr poamanager = (*iterator);
00100       poamanagers[index] =
00101         PortableServer::POAManager::_duplicate (poamanager);
00102     }
00103 
00104   return poamanagers._retn ();
00105 }

int TAO_POAManager_Factory::register_poamanager ( ::PortableServer::POAManager_ptr  poamanager  ) 

Definition at line 157 of file POAManagerFactory.cpp.

References ACE_Unbounded_Set_Ex< T, C >::insert(), and poamanager_set_.

Referenced by create_POAManager().

00159 {
00160   return this->poamanager_set_.insert (
00161     PortableServer::POAManager::_duplicate (poamanager));
00162 }

void TAO_POAManager_Factory::remove_all_poamanagers ( void   ) 

Definition at line 130 of file POAManagerFactory.cpp.

References ACE_Unbounded_Set_Ex< T, C >::end(), poamanager_set_, CORBA::release(), and ACE_Unbounded_Set_Ex< T, C >::reset().

Referenced by TAO_Object_Adapter::release_poa_manager_factory(), and ~TAO_POAManager_Factory().

00131 {
00132   for (POAMANAGERSET::iterator iterator = this->poamanager_set_.begin ();
00133         iterator != this->poamanager_set_.end ();
00134         ++iterator)
00135     {
00136       ::PortableServer::POAManager_ptr poamanager = (*iterator);
00137       CORBA::release (poamanager);
00138     }
00139   this->poamanager_set_.reset ();
00140 }

int TAO_POAManager_Factory::remove_poamanager ( ::PortableServer::POAManager_ptr  poamanager  ) 

Definition at line 143 of file POAManagerFactory.cpp.

References poamanager_set_, CORBA::release(), and ACE_Unbounded_Set_Ex< T, C >::remove().

00145 {
00146   int retval = this->poamanager_set_.remove (poamanager);
00147 
00148   if (retval == 0)
00149     {
00150       CORBA::release (poamanager);
00151     }
00152 
00153   return retval;
00154 }


Member Data Documentation

TAO_Object_Adapter& TAO_POAManager_Factory::object_adapter_ [private]

Definition at line 65 of file POAManagerFactory.h.

Referenced by create_POAManager().

POAMANAGERSET TAO_POAManager_Factory::poamanager_set_ [private]

Definition at line 69 of file POAManagerFactory.h.

Referenced by find(), list(), register_poamanager(), remove_all_poamanagers(), and remove_poamanager().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:41:33 2010 for TAO_PortableServer by  doxygen 1.4.7