TAO_Object_Adapter Class Reference

Defines the Object Adapter abstraction. More...

#include <Object_Adapter.h>

Inheritance diagram for TAO_Object_Adapter:

Inheritance graph
[legend]
Collaboration diagram for TAO_Object_Adapter:

Collaboration graph
[legend]
List of all members.

Public Types

typedef PortableServer::ObjectId poa_name
typedef PortableServer::ObjectId_var poa_name_var
typedef PortableServer::ObjectId_out poa_name_out

Public Member Functions

 TAO_Object_Adapter (const TAO_Server_Strategy_Factory::Active_Object_Map_Creation_Parameters &creation_parameters, TAO_ORB_Core &orb_core)
 Constructor.
 ~TAO_Object_Adapter (void)
 Destructor.
int dispatch_servant (const TAO::ObjectKey &key, TAO_ServerRequest &req, CORBA::Object_out forward_to)
int locate_servant (const TAO::ObjectKey &key)
TAO_SERVANT_LOCATION find_servant (const TAO::ObjectKey &key, PortableServer::Servant &servant)
int find_poa (const poa_name &system_name, CORBA::Boolean activate_it, CORBA::Boolean root, const TAO::Portable_Server::Temporary_Creation_Time &poa_creation_time, TAO_Root_POA *&poa)
int bind_poa (const poa_name &folded_name, TAO_Root_POA *poa, poa_name_out system_name)
int unbind_poa (TAO_Root_POA *poa, const poa_name &folded_name, const poa_name &system_name)
int activate_poa (const poa_name &folded_name, TAO_Root_POA *&poa)
ACE_Locklock (void)
TAO_SYNCH_MUTEXthread_lock (void)
ACE_Reverse_Lock< ACE_Lock > & reverse_lock (void)
TAO_Root_POAroot_poa (void) const
 Access the root poa.
TAO_ORB_Coreorb_core (void) const
 Access to ORB Core.
void wait_for_non_servant_upcalls_to_complete (void)
 Wait for non-servant upcalls to complete.
void wait_for_non_servant_upcalls_to_complete_no_throw (void)
 Non-exception throwing version.
TAO_Policy_Validatorvalidator (void)
 Return the validator.
int enable_locking () const
TAO_POA_Policy_Setdefault_poa_policies (void)
 Return the set of default policies.
void servant_dispatcher (TAO_Servant_Dispatcher *dispatcher)
void init_default_policies (TAO_POA_Policy_Set &policies)
 Initialize the default set of POA policies.
virtual void open (void)
virtual void close (int wait_for_completion)
virtual void check_close (int wait_for_completion)
virtual int priority (void) const
virtual int dispatch (TAO::ObjectKey &key, TAO_ServerRequest &request, CORBA::Object_out forward_to)
virtual const char * name (void) const
virtual CORBA::Object_ptr root (void)
virtual CORBA::Object_ptr create_collocated_object (TAO_Stub *, const TAO_MProfile &)
virtual CORBA::Long initialize_collocated_object (TAO_Stub *)
TAO::Portable_Server::Non_Servant_Upcallnon_servant_upcall_in_progress (void) const

Static Public Member Functions

static CORBA::ULong transient_poa_name_size (void)

Protected Types

typedef ACE_Map< poa_name,
TAO_Root_POA * > 
transient_poa_map
 Base class of the id map.
typedef ACE_Hash_Map_Manager_Ex_Adapter<
poa_name, TAO_Root_POA *,
TAO_ObjectId_Hash, ACE_Equal_To<
poa_name >, TAO_Incremental_Key_Generator
transient_poa_hash_map
 Id hash map.
typedef ACE_Map_Manager_Adapter<
poa_name, TAO_Root_POA *,
TAO_Incremental_Key_Generator
transient_poa_linear_map
 Id linear map.
typedef ACE_Active_Map_Manager_Adapter<
poa_name, TAO_Root_POA *,
TAO_Ignore_Original_Key_Adapter
transient_poa_active_map
 Id active map.
typedef ACE_Map< poa_name,
TAO_Root_POA * > 
persistent_poa_name_map
 Base class of the name map.
typedef ACE_Hash_Map_Manager_Ex_Adapter<
poa_name, TAO_Root_POA *,
TAO_ObjectId_Hash, ACE_Equal_To<
PortableServer::ObjectId >,
ACE_Noop_Key_Generator< poa_name > > 
persistent_poa_name_hash_map
 Id hash map.
typedef ACE_Map_Manager_Adapter<
poa_name, TAO_Root_POA *,
ACE_Noop_Key_Generator< poa_name > > 
persistent_poa_name_linear_map
 Id linear map.

Protected Member Functions

int locate_servant_i (const TAO::ObjectKey &key)
TAO_SERVANT_LOCATION find_servant_i (const TAO::ObjectKey &key, PortableServer::Servant &servant)
void dispatch_servant_i (const TAO::ObjectKey &key, TAO_ServerRequest &req, void *context)
void locate_poa (const TAO::ObjectKey &key, PortableServer::ObjectId &id, TAO_Root_POA *&poa)
int find_transient_poa (const poa_name &system_name, CORBA::Boolean root, const TAO::Portable_Server::Temporary_Creation_Time &poa_creation_time, TAO_Root_POA *&poa)
int find_persistent_poa (const poa_name &system_name, TAO_Root_POA *&poa)
int bind_transient_poa (TAO_Root_POA *poa, poa_name_out system_name)
int bind_persistent_poa (const poa_name &folded_name, TAO_Root_POA *poa, poa_name_out system_name)
int unbind_transient_poa (const poa_name &system_name)
int unbind_persistent_poa (const poa_name &folded_name, const poa_name &system_name)
virtual void do_dispatch (TAO_ServerRequest &req, TAO::Portable_Server::Servant_Upcall &upcall)

Static Protected Member Functions

static ACE_Lockcreate_lock (int enable_locking, TAO_SYNCH_MUTEX &thread_lock)
static void set_transient_poa_name_size (const TAO_Server_Strategy_Factory::Active_Object_Map_Creation_Parameters &creation_parameters)

Protected Attributes

Hint_Strategyhint_strategy_
TAO_Servant_Dispatcherservant_dispatcher_
 Strategy for dispatching a request to a servant.
persistent_poa_name_mappersistent_poa_name_map_
 Persistent POA map.
transient_poa_maptransient_poa_map_
 Transient POA map.
TAO_ORB_Coreorb_core_
int enable_locking_
TAO_SYNCH_MUTEX thread_lock_
ACE_Locklock_
ACE_Reverse_Lock< ACE_Lockreverse_lock_

Static Protected Attributes

static CORBA::ULong transient_poa_name_size_ = 0

Private Member Functions

TAO_ServantBaseget_collocated_servant (const TAO_MProfile &mp)
 Helper method to get collocated servant.

Static Private Member Functions

static void release_poa_manager_factory (TAO_POAManager_Factory *factory)

Private Attributes

TAO_SYNCH_CONDITION non_servant_upcall_condition_
 Condition variable for waiting on non-servant upcalls to end.
TAO::Portable_Server::Non_Servant_Upcallnon_servant_upcall_in_progress_
unsigned int non_servant_upcall_nesting_level_
 Current nesting level of non_servant_upcalls.
ACE_thread_t non_servant_upcall_thread_
 Id of thread making the non-servant upcall.
TAO_Root_POAroot_
 The Root POA.
TAO_POAManager_Factorypoa_manager_factory_
 The POAManager factory.
TAO_POA_Default_Policy_Validator default_validator_
TAO_POA_Policy_Set default_poa_policies_

Friends

class TAO_Root_POA
class Active_Hint_Strategy
class No_Hint_Strategy
class TAO::Portable_Server::Non_Servant_Upcall
class TAO::Portable_Server::Servant_Upcall

Classes

class  Active_Hint_Strategy
 This class uses active demux hint for POA active hint strategy. More...
class  Hint_Strategy
 Base class for POA active hint strategy. More...
class  iteratable_poa_name
 This class allows iteration over a folded poa name. More...
class  No_Hint_Strategy
 This class doesn't use any hints for POA active hint strategy. More...
class  poa_name_iterator
 Iterator for a folded poa name. More...

Detailed Description

Defines the Object Adapter abstraction.

This class will be used as a facade for the POAs in a server

Definition at line 74 of file Object_Adapter.h.


Member Typedef Documentation

typedef ACE_Hash_Map_Manager_Ex_Adapter< poa_name, TAO_Root_POA *, TAO_ObjectId_Hash, ACE_Equal_To<PortableServer::ObjectId>, ACE_Noop_Key_Generator<poa_name> > TAO_Object_Adapter::persistent_poa_name_hash_map [protected]

Id hash map.

Definition at line 355 of file Object_Adapter.h.

typedef ACE_Map_Manager_Adapter< poa_name, TAO_Root_POA *, ACE_Noop_Key_Generator<poa_name> > TAO_Object_Adapter::persistent_poa_name_linear_map [protected]

Id linear map.

Definition at line 362 of file Object_Adapter.h.

typedef ACE_Map< poa_name, TAO_Root_POA *> TAO_Object_Adapter::persistent_poa_name_map [protected]

Base class of the name map.

Definition at line 347 of file Object_Adapter.h.

typedef PortableServer::ObjectId TAO_Object_Adapter::poa_name

Definition at line 81 of file Object_Adapter.h.

typedef PortableServer::ObjectId_out TAO_Object_Adapter::poa_name_out

Definition at line 83 of file Object_Adapter.h.

typedef PortableServer::ObjectId_var TAO_Object_Adapter::poa_name_var

Definition at line 82 of file Object_Adapter.h.

typedef ACE_Active_Map_Manager_Adapter< poa_name, TAO_Root_POA *, TAO_Ignore_Original_Key_Adapter> TAO_Object_Adapter::transient_poa_active_map [protected]

Id active map.

Definition at line 342 of file Object_Adapter.h.

typedef ACE_Hash_Map_Manager_Ex_Adapter< poa_name, TAO_Root_POA *, TAO_ObjectId_Hash, ACE_Equal_To<poa_name>, TAO_Incremental_Key_Generator> TAO_Object_Adapter::transient_poa_hash_map [protected]

Id hash map.

Definition at line 327 of file Object_Adapter.h.

typedef ACE_Map_Manager_Adapter< poa_name, TAO_Root_POA *, TAO_Incremental_Key_Generator> TAO_Object_Adapter::transient_poa_linear_map [protected]

Id linear map.

Definition at line 335 of file Object_Adapter.h.

typedef ACE_Map< poa_name, TAO_Root_POA *> TAO_Object_Adapter::transient_poa_map [protected]

Base class of the id map.

Definition at line 318 of file Object_Adapter.h.


Constructor & Destructor Documentation

TAO_Object_Adapter::TAO_Object_Adapter ( const TAO_Server_Strategy_Factory::Active_Object_Map_Creation_Parameters creation_parameters,
TAO_ORB_Core orb_core 
)

Constructor.

Definition at line 143 of file Object_Adapter.cpp.

References ACE_ERROR, ACE_NEW, hint_strategy_, LM_ERROR, persistent_poa_name_map_, TAO_Server_Strategy_Factory::Active_Object_Map_Creation_Parameters::poa_lookup_strategy_for_persistent_id_policy_, TAO_Server_Strategy_Factory::Active_Object_Map_Creation_Parameters::poa_lookup_strategy_for_transient_id_policy_, TAO_Server_Strategy_Factory::Active_Object_Map_Creation_Parameters::poa_map_size_, ACE_Auto_Basic_Ptr< X >::release(), set_transient_poa_name_size(), TAO_ACTIVE_DEMUX, TAO_DYNAMIC_HASH, TAO_LINEAR, transient_poa_map_, and TAO_Server_Strategy_Factory::Active_Object_Map_Creation_Parameters::use_active_hint_in_poa_names_.

00145   : hint_strategy_ (0),
00146     servant_dispatcher_ (0),
00147     persistent_poa_name_map_ (0),
00148     transient_poa_map_ (0),
00149     orb_core_ (orb_core),
00150     enable_locking_ (orb_core_.server_factory ()->enable_poa_locking ()),
00151     thread_lock_ (),
00152     lock_ (TAO_Object_Adapter::create_lock (enable_locking_,
00153                                             thread_lock_)),
00154     reverse_lock_ (*lock_),
00155     non_servant_upcall_condition_ (thread_lock_),
00156     non_servant_upcall_in_progress_ (0),
00157     non_servant_upcall_nesting_level_ (0),
00158     non_servant_upcall_thread_ (ACE_OS::NULL_thread),
00159     root_ (0),
00160 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00161     poa_manager_factory_ (0),
00162 #endif
00163     default_validator_ (orb_core),
00164     default_poa_policies_ ()
00165 {
00166   TAO_Object_Adapter::set_transient_poa_name_size (creation_parameters);
00167 
00168   Hint_Strategy *hint_strategy = 0;
00169   if (creation_parameters.use_active_hint_in_poa_names_)
00170     ACE_NEW (hint_strategy,
00171              Active_Hint_Strategy (creation_parameters.poa_map_size_));
00172   else
00173     ACE_NEW (hint_strategy,
00174              No_Hint_Strategy);
00175 
00176   // Give ownership to the auto pointer.
00177   auto_ptr<Hint_Strategy> new_hint_strategy (hint_strategy);
00178 
00179   new_hint_strategy->object_adapter (this);
00180 
00181   persistent_poa_name_map *ppnm = 0;
00182   switch (creation_parameters.poa_lookup_strategy_for_persistent_id_policy_)
00183     {
00184     case TAO_LINEAR:
00185 #if (TAO_HAS_MINIMUM_POA_MAPS == 0)
00186       ACE_NEW (ppnm,
00187                persistent_poa_name_linear_map (creation_parameters.poa_map_size_));
00188 
00189       break;
00190 #else
00191       ACE_ERROR ((LM_ERROR,
00192                   "linear option for -ORBPersistentidPolicyDemuxStrategy "
00193                   "not supported with minimum POA maps. "
00194                   "Ingoring option to use default... \n"));
00195       /* FALL THROUGH */
00196 #endif /* TAO_HAS_MINIMUM_POA_MAPS == 0 */
00197     case TAO_DYNAMIC_HASH:
00198     default:
00199       ACE_NEW (ppnm,
00200                persistent_poa_name_hash_map (creation_parameters.poa_map_size_));
00201       break;
00202     }
00203   // Give ownership to the auto pointer.
00204   auto_ptr<persistent_poa_name_map> new_persistent_poa_name_map (ppnm);
00205 
00206   transient_poa_map *tpm = 0;
00207   switch (creation_parameters.poa_lookup_strategy_for_transient_id_policy_)
00208     {
00209 #if (TAO_HAS_MINIMUM_POA_MAPS == 0)
00210     case TAO_LINEAR:
00211       ACE_NEW (tpm,
00212                transient_poa_linear_map (creation_parameters.poa_map_size_));
00213       break;
00214     case TAO_DYNAMIC_HASH:
00215       ACE_NEW (tpm,
00216                transient_poa_hash_map (creation_parameters.poa_map_size_));
00217       break;
00218 #else
00219     case TAO_LINEAR:
00220     case TAO_DYNAMIC_HASH:
00221       ACE_ERROR ((LM_ERROR,
00222                   "linear and dynamic options for -ORBTransientidPolicyDemuxStrategy "
00223                   "are not supported with minimum POA maps. "
00224                   "Ingoring option to use default... \n"));
00225       /* FALL THROUGH */
00226 #endif /* TAO_HAS_MINIMUM_POA_MAPS == 0 */
00227     case TAO_ACTIVE_DEMUX:
00228     default:
00229       ACE_NEW (tpm,
00230                transient_poa_active_map (creation_parameters.poa_map_size_));
00231       break;
00232     }
00233   // Give ownership to the auto pointer.
00234   auto_ptr<transient_poa_map> new_transient_poa_map (tpm);
00235 
00236   this->hint_strategy_ =
00237     new_hint_strategy.release ();
00238   this->persistent_poa_name_map_ =
00239     new_persistent_poa_name_map.release ();
00240   this->transient_poa_map_ =
00241     new_transient_poa_map.release ();
00242 }

TAO_Object_Adapter::~TAO_Object_Adapter ( void   ) 

Destructor.

Definition at line 294 of file Object_Adapter.cpp.

References hint_strategy_, lock_, persistent_poa_name_map_, release(), release_poa_manager_factory(), root_, servant_dispatcher_, and transient_poa_map_.

00295 {
00296   delete this->hint_strategy_;
00297   delete this->persistent_poa_name_map_;
00298   delete this->transient_poa_map_;
00299   delete this->lock_;
00300 
00301   delete this->servant_dispatcher_;
00302 
00303   // This cleanup may have already occurred in the close() method.  If
00304   // that is the case then this won't cause any harm since root_ and
00305   // poa_manager_factory_ would have been set to zero.  But, if close
00306   // wasn't called, then these would be leaked.  It may be better if
00307   // these pointers had a corresponding _var version so that this cleanup
00308   // could be automatic.
00309   ::CORBA::release (this->root_);
00310 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00311   release_poa_manager_factory (this->poa_manager_factory_);
00312 #endif
00313 }


Member Function Documentation

int TAO_Object_Adapter::activate_poa ( const poa_name folded_name,
TAO_Root_POA *&  poa 
)

Definition at line 436 of file Object_Adapter.cpp.

References TAO_Object_Adapter::iteratable_poa_name::begin(), TAO_Object_Adapter::iteratable_poa_name::end(), TAO_Root_POA::find_POA_i(), TAO_Root_POA::name(), and root_.

Referenced by TAO_Object_Adapter::No_Hint_Strategy::find_persistent_poa(), and TAO_Object_Adapter::Active_Hint_Strategy::find_persistent_poa().

00438 {
00439   int result = -1;
00440 
00441 #if (TAO_HAS_MINIMUM_POA == 0) &&  !defined (CORBA_E_MICRO)
00442 
00443   iteratable_poa_name ipn (folded_name);
00444   iteratable_poa_name::iterator iterator = ipn.begin ();
00445   iteratable_poa_name::iterator end = ipn.end ();
00446 
00447   TAO_Root_POA *parent = this->root_;
00448   if (parent == 0 || parent->name () != *iterator)
00449     throw ::CORBA::OBJ_ADAPTER ();
00450   else
00451     ++iterator;
00452 
00453   for (;
00454        iterator != end;
00455        ++iterator)
00456     {
00457       TAO_Root_POA *current = 0;
00458 
00459       try
00460         {
00461           current = parent->find_POA_i (*iterator, 1);
00462         }
00463       catch (const PortableServer::POA::AdapterNonExistent&)
00464         {
00465           return -1;
00466         }
00467 
00468       parent = current;
00469     }
00470 
00471   poa = parent;
00472   result = 0;
00473 #else
00474   ACE_UNUSED_ARG (folded_name);
00475   ACE_UNUSED_ARG (poa);
00476 #endif /* TAO_HAS_MINIMUM_POA == 0 */
00477 
00478   return result;
00479 }

ACE_INLINE int TAO_Object_Adapter::bind_persistent_poa ( const poa_name folded_name,
TAO_Root_POA poa,
poa_name_out  system_name 
) [protected]

Definition at line 117 of file Object_Adapter.inl.

References TAO_Object_Adapter::Hint_Strategy::bind_persistent_poa(), hint_strategy_, and TAO::Portable_Server::Servant_Upcall::poa().

00120 {
00121   return this->hint_strategy_->bind_persistent_poa (folded_name,
00122                                                     poa,
00123                                                     system_name);
00124 }

int TAO_Object_Adapter::bind_poa ( const poa_name folded_name,
TAO_Root_POA poa,
poa_name_out  system_name 
)

Definition at line 506 of file Object_Adapter.cpp.

References bind_transient_poa(), and TAO_Root_POA::persistent().

Referenced by TAO_Root_POA::TAO_Root_POA().

00509 {
00510   if (poa->persistent ())
00511     return this->bind_persistent_poa (folded_name, poa, system_name);
00512   else
00513     return this->bind_transient_poa (poa, system_name);
00514 }

ACE_INLINE int TAO_Object_Adapter::bind_transient_poa ( TAO_Root_POA poa,
poa_name_out  system_name 
) [protected]

Definition at line 100 of file Object_Adapter.inl.

References ACE_NEW_RETURN, ACE_Map< KEY, VALUE >::bind_create_key(), name(), TAO::Portable_Server::Servant_Upcall::poa(), and transient_poa_map_.

Referenced by bind_poa().

00102 {
00103   poa_name name;
00104   int result = this->transient_poa_map_->bind_create_key (poa, name);
00105 
00106   if (result == 0)
00107     {
00108       ACE_NEW_RETURN (system_name,
00109                       poa_name (name),
00110                       -1);
00111     }
00112 
00113   return result;
00114 }

void TAO_Object_Adapter::check_close ( int  wait_for_completion  )  [virtual]

Implements TAO_Adapter.

Definition at line 701 of file Object_Adapter.cpp.

References TAO_Root_POA::check_for_valid_wait_for_completions().

Referenced by close().

00702 {
00703   TAO_Root_POA::check_for_valid_wait_for_completions (this->orb_core (),
00704                                                  wait_for_completion);
00705 }

void TAO_Object_Adapter::close ( int  wait_for_completion  )  [virtual]

Implements TAO_Adapter.

Definition at line 662 of file Object_Adapter.cpp.

References ACE_GUARD, check_close(), poa_manager_factory_, release(), release_poa_manager_factory(), root(), and root_.

00663 {
00664   this->check_close (wait_for_completion);
00665 
00666   // Shutting down the ORB causes all object adapters to be destroyed,
00667   // since they cannot exist in the absence of an ORB. Shut down is
00668   // complete when all ORB processing (including request processing
00669   // and object deactivation or other operations associated with
00670   // object adapters) has completed and the object adapters have been
00671   // destroyed. In the case of the POA, this means that all object
00672   // etherealizations have finished and root POA has been destroyed
00673   // (implying that all descendent POAs have also been destroyed).
00674   TAO_Root_POA *root = 0;
00675 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00676   TAO_POAManager_Factory* factory = 0;
00677 #endif
00678   {
00679     ACE_GUARD (ACE_Lock, ace_mon, this->lock ());
00680     if (this->root_ == 0)
00681       return;
00682     root = this->root_;
00683     this->root_ = 0;
00684 
00685 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00686     if (this->poa_manager_factory_ == 0)
00687       return;
00688     factory = this->poa_manager_factory_;
00689     this->poa_manager_factory_ = 0;
00690 #endif
00691   }
00692   CORBA::Boolean etherealize_objects = true;
00693   root->destroy (etherealize_objects, wait_for_completion);
00694   ::CORBA::release (root);
00695 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00696   release_poa_manager_factory (factory);
00697 #endif
00698 }

CORBA::Object_ptr TAO_Object_Adapter::create_collocated_object ( TAO_Stub ,
const TAO_MProfile  
) [virtual]

Implements TAO_Adapter.

Definition at line 858 of file Object_Adapter.cpp.

References CORBA::Object::_nil(), ACE_NEW_RETURN, get_collocated_servant(), and TAO_Stub::servant_orb().

00860 {
00861   TAO_ServantBase *sb = this->get_collocated_servant (mp);
00862 
00863   // Set the servant ORB.  Do not duplicate the ORB here since
00864   // TAO_Stub::servant_orb() duplicates it.
00865   stub->servant_orb (this->orb_core_.orb ());
00866 
00867   // It is ok to create a collocated object even when <sb> is
00868   // zero. This constructor will set the stub collocated indicator and
00869   // the strategized proxy broker if required.
00870   CORBA::Object_ptr x;
00871   ACE_NEW_RETURN (x,
00872                   CORBA::Object (stub,
00873                                  1,
00874                                  sb),
00875                   CORBA::Object::_nil ());
00876 
00877   // Success.
00878   return x;
00879 }

ACE_Lock * TAO_Object_Adapter::create_lock ( int  enable_locking,
TAO_SYNCH_MUTEX thread_lock 
) [static, protected]

Definition at line 317 of file Object_Adapter.cpp.

References ACE_NEW_RETURN.

00319 {
00320 #if defined (ACE_HAS_THREADS)
00321   if (enable_locking)
00322     {
00323       ACE_Lock *the_lock = 0;
00324       ACE_NEW_RETURN (the_lock,
00325                       ACE_Lock_Adapter<TAO_SYNCH_MUTEX> (thread_lock),
00326                       0);
00327       return the_lock;
00328     }
00329 #else
00330   ACE_UNUSED_ARG (enable_locking);
00331   ACE_UNUSED_ARG (thread_lock);
00332 #endif /* ACE_HAS_THREADS */
00333 
00334   ACE_Lock *the_lock = 0;
00335   ACE_NEW_RETURN (the_lock,
00336                   ACE_Lock_Adapter<ACE_SYNCH_NULL_MUTEX> (),
00337                   0);
00338   return the_lock;
00339 }

ACE_INLINE TAO_POA_Policy_Set & TAO_Object_Adapter::default_poa_policies ( void   ) 

Return the set of default policies.

Definition at line 23 of file Object_Adapter.inl.

References default_poa_policies_.

00024 {
00025   return this->default_poa_policies_;
00026 }

int TAO_Object_Adapter::dispatch ( TAO::ObjectKey &  key,
TAO_ServerRequest request,
CORBA::Object_out  forward_to 
) [virtual]

Implements TAO_Adapter.

Definition at line 714 of file Object_Adapter.cpp.

References TAO_ServerRequest::caught_exception(), dispatch_servant(), TAO_Adapter::DS_FORWARD, TAO_Adapter::DS_MISMATCHED_KEY, TAO_Adapter::DS_OK, TAO_ServerRequest::forward_location(), TAO_ServerRequest::is_forwarded(), ACE_OS::memcmp(), TAO_Root_POA::objectkey_prefix, orb_core_, TAO_ServerRequest::pi_reply_status(), TAO_Pseudo_Out_T< T >::ptr(), TAO_ServerRequest::reply_status(), TAO_ServerRequest::send_cached_reply(), TAO_ORB_Core::serverrequestinterceptor_adapter(), SYSTEM_EXCEPTION, TAO_Root_POA::TAO_OBJECTKEY_PREFIX_SIZE, and USER_EXCEPTION.

00717 {
00718   if (key.length() < TAO_Root_POA::TAO_OBJECTKEY_PREFIX_SIZE
00719       || ACE_OS::memcmp (key.get_buffer (),
00720                          &TAO_Root_POA::objectkey_prefix[0],
00721                          TAO_Root_POA::TAO_OBJECTKEY_PREFIX_SIZE) != 0)
00722     {
00723       return TAO_Adapter::DS_MISMATCHED_KEY;
00724     }
00725 
00726   int result = 0;
00727 
00728 #if TAO_HAS_INTERCEPTORS == 1
00729   TAO::ServerRequestInterceptor_Adapter *sri_adapter =
00730     orb_core_.serverrequestinterceptor_adapter ();
00731 
00732   try
00733     {
00734       if (sri_adapter != 0)
00735         {
00736 #if TAO_HAS_EXTENDED_FT_INTERCEPTORS == 1
00737           CORBA::OctetSeq_var ocs;
00738           sri_adapter->tao_ft_interception_point (request,
00739                                                  0,  // args
00740                                                  0,  // nargs
00741                                                  0,  // servant_upcall
00742                                                  0,  // exceptions
00743                                                  0, // nexceptions
00744                                                  ocs.out ());
00745 
00746           /// If we have a cached result, just go ahead and send the reply
00747           /// and let us  return
00748           if (ocs.ptr () != 0)
00749             {
00750               // request.result_seq (
00751               request.send_cached_reply (ocs.inout ());
00752 
00753               return TAO_Adapter::DS_OK;
00754             }
00755 
00756           // If a PortableInterceptor::ForwardRequest exception was
00757           // thrown, then set the forward_to object reference and return
00758           // with the appropriate return status.
00759           forward_to.ptr () = request.forward_location ();
00760           if (request.is_forwarded ())
00761             {
00762               return TAO_Adapter::DS_FORWARD;
00763             }
00764 #endif /*TAO_HAS_EXTENDED_FT_INTERCEPTORS*/
00765 
00766           // The receive_request_service_contexts() interception point
00767           // must be invoked before the operation is dispatched to the
00768           // servant.
00769           sri_adapter->receive_request_service_contexts (request,
00770                                                          0,  // args
00771                                                          0,  // nargs
00772                                                          0,  // servant_upcall
00773                                                          0,  // exceptions
00774                                                          0);   // nexceptions
00775 
00776           // If a PortableInterceptor::ForwardRequest exception was
00777           // thrown, then set the forward_to object reference and return
00778           // with the appropriate return status.
00779           forward_to.ptr () = request.forward_location ();
00780           if (request.is_forwarded ())
00781             {
00782               return TAO_Adapter::DS_FORWARD;
00783             }
00784         }
00785 #endif  /* TAO_HAS_INTERCEPTORS == 1 */
00786 
00787       result = this->dispatch_servant (key, request, forward_to);
00788 
00789 #if TAO_HAS_INTERCEPTORS == 1
00790 
00791       if (result == TAO_Adapter::DS_FORWARD)
00792         {
00793           request.reply_status (GIOP::LOCATION_FORWARD);
00794           request.pi_reply_status (PortableInterceptor::LOCATION_FORWARD);
00795           request.forward_location (forward_to.ptr ());
00796           if (sri_adapter != 0)
00797             {
00798               sri_adapter->send_other (request,
00799                                        0,  // args
00800                                        0,  // nargs
00801                                        0,  // servant_upcall
00802                                        0,  // exceptions
00803                                        0   // nexceptions
00804                                       );
00805             }
00806         }
00807     }
00808   catch ( ::CORBA::Exception& ex)
00809     {
00810       // Just assume the current exception is a system exception, the
00811       // status can only change when the interceptor changes this
00812       // and this is only done when the sri_adapter is available. If we
00813       // don't have an sri_adapter we just rethrow the exception
00814       PortableInterceptor::ReplyStatus status =
00815         PortableInterceptor::SYSTEM_EXCEPTION;
00816 
00817       if (sri_adapter != 0)
00818         {
00819           request.caught_exception (&ex);
00820 
00821           sri_adapter->send_exception (request,
00822                                        0,  // args
00823                                        0,  // nargs
00824                                        0,  // servant_upcall
00825                                        0,  // exceptions
00826                                        0);   // nexceptions
00827 
00828           status = request.pi_reply_status ();
00829         }
00830 
00831       // Only re-throw the exception if it hasn't been transformed by
00832       // the send_exception() interception point (e.g. to a
00833       // LOCATION_FORWARD).
00834       if (status == PortableInterceptor::SYSTEM_EXCEPTION
00835           || status == PortableInterceptor::USER_EXCEPTION)
00836         {
00837           throw;
00838         }
00839     }
00840 #endif  /* TAO_HAS_INTERCEPTORS == 1 */
00841 
00842   return result;
00843 }

int TAO_Object_Adapter::dispatch_servant ( const TAO::ObjectKey &  key,
TAO_ServerRequest req,
CORBA::Object_out  forward_to 
)

Definition at line 342 of file Object_Adapter.cpp.

References ACE_FUNCTION_TIMEPROBE, TAO_ServerRequest::collocated(), do_dispatch(), TAO_Adapter::DS_FORWARD, TAO_Adapter::DS_OK, TAO_ServerRequest::forward_location(), TAO_ServerRequest::operation(), TAO_ServerRequest::pi_reply_status(), TAO::Portable_Server::Servant_Upcall::pre_invoke_collocated_request(), TAO::Portable_Server::Servant_Upcall::pre_invoke_remote_request(), and TAO::Portable_Server::Servant_Upcall::prepare_for_upcall().

Referenced by dispatch().

00345 {
00346   ACE_FUNCTION_TIMEPROBE (TAO_OBJECT_ADAPTER_DISPATCH_SERVANT_START);
00347 
00348   // This object is magical, i.e., it has a non-trivial constructor
00349   // and destructor.
00350   TAO::Portable_Server::Servant_Upcall servant_upcall (&this->orb_core_);
00351 
00352   // Set up state in the POA et al (including the POA Current), so
00353   // that we know that this servant is currently in an upcall.
00354   const char *operation = req.operation ();
00355   int result = servant_upcall.prepare_for_upcall (key, operation, forward_to);
00356 
00357   if (result != TAO_Adapter::DS_OK)
00358     return result;
00359 
00360   // Preprocess request.
00361   if (req.collocated ())
00362     {
00363       servant_upcall.pre_invoke_collocated_request ();
00364     }
00365   else
00366     {
00367       servant_upcall.pre_invoke_remote_request (req);
00368     }
00369 
00370   // Servant dispatch.
00371   {
00372     ACE_FUNCTION_TIMEPROBE (TAO_SERVANT_DISPATCH_START);
00373 
00374     do_dispatch (req, servant_upcall);
00375   }
00376 
00377 #if TAO_HAS_INTERCEPTORS == 1
00378   // ServerInterceptor might have raised ForwardRequest. In case of
00379   // remote calls invocations the LocationForwardReply would have been
00380   // sent in earlier stage, but in colocal scenario no message is sent
00381   // and the LocationForward object must be passed over here to
00382   // calling operation's mem-space.
00383   if (req.collocated() && req.pi_reply_status () == PortableInterceptor::LOCATION_FORWARD)
00384     {
00385       forward_to = req.forward_location ();
00386       result = TAO_Adapter::DS_FORWARD;
00387     }
00388 #endif
00389 
00390   return result;
00391 }

void TAO_Object_Adapter::dispatch_servant_i ( const TAO::ObjectKey &  key,
TAO_ServerRequest req,
void *  context 
) [protected]

void TAO_Object_Adapter::do_dispatch ( TAO_ServerRequest req,
TAO::Portable_Server::Servant_Upcall upcall 
) [protected, virtual]

Definition at line 1217 of file Object_Adapter.cpp.

References TAO_ServantBase::_dispatch(), and TAO::Portable_Server::Servant_Upcall::servant().

Referenced by dispatch_servant().

01219 {
01220   upcall.servant ()->_dispatch(req, &upcall);
01221 }

ACE_INLINE int TAO_Object_Adapter::enable_locking (  )  const

Definition at line 17 of file Object_Adapter.inl.

References enable_locking_.

00018 {
00019   return this->enable_locking_;
00020 }

ACE_INLINE int TAO_Object_Adapter::find_persistent_poa ( const poa_name system_name,
TAO_Root_POA *&  poa 
) [protected]

Definition at line 73 of file Object_Adapter.inl.

References TAO_Object_Adapter::Hint_Strategy::find_persistent_poa(), hint_strategy_, and TAO::Portable_Server::Servant_Upcall::poa().

Referenced by find_poa().

00075 {
00076   return this->hint_strategy_->find_persistent_poa (system_name, poa);
00077 }

ACE_INLINE int TAO_Object_Adapter::find_poa ( const poa_name system_name,
CORBA::Boolean  activate_it,
CORBA::Boolean  root,
const TAO::Portable_Server::Temporary_Creation_Time poa_creation_time,
TAO_Root_POA *&  poa 
)

Definition at line 80 of file Object_Adapter.inl.

References find_persistent_poa(), find_transient_poa(), and TAO::Portable_Server::Servant_Upcall::poa().

Referenced by locate_poa().

00085 {
00086   if (activate_it)
00087     {
00088       return this->find_persistent_poa (system_name, poa);
00089     }
00090   else
00091     {
00092       return this->find_transient_poa (system_name,
00093                                        root,
00094                                        poa_creation_time,
00095                                        poa);
00096     }
00097 }

ACE_INLINE TAO_SERVANT_LOCATION TAO_Object_Adapter::find_servant ( const TAO::ObjectKey &  key,
PortableServer::Servant servant 
)

Definition at line 63 of file Object_Adapter.inl.

References find_servant_i(), TAO::Portable_Server::Servant_Upcall::servant(), TAO_OBJECT_ADAPTER_GUARD_RETURN, and TAO_SERVANT_NOT_FOUND.

Referenced by get_collocated_servant().

00065 {
00066   // Lock access for the duration of this transaction.
00067   TAO_OBJECT_ADAPTER_GUARD_RETURN (TAO_SERVANT_NOT_FOUND);
00068 
00069   return this->find_servant_i (key, servant);
00070 }

TAO_SERVANT_LOCATION TAO_Object_Adapter::find_servant_i ( const TAO::ObjectKey &  key,
PortableServer::Servant servant 
) [protected]

Definition at line 557 of file Object_Adapter.cpp.

References locate_poa(), and TAO_Root_POA::locate_servant_i().

Referenced by find_servant().

00559 {
00560   PortableServer::ObjectId id;
00561   TAO_Root_POA *poa = 0;
00562 
00563   this->locate_poa (key, id, poa);
00564 
00565   return poa->locate_servant_i (id, servant);
00566 }

int TAO_Object_Adapter::find_transient_poa ( const poa_name system_name,
CORBA::Boolean  root,
const TAO::Portable_Server::Temporary_Creation_Time poa_creation_time,
TAO_Root_POA *&  poa 
) [protected]

Definition at line 482 of file Object_Adapter.cpp.

References ACE_Map< KEY, VALUE >::find(), root_, transient_poa_map_, and TAO_Root_POA::validate_lifespan().

Referenced by find_poa().

00486 {
00487   int result = 0;
00488 
00489   if (root)
00490     {
00491       poa = this->root_;
00492     }
00493   else
00494     {
00495       result = this->transient_poa_map_->find (system_name, poa);
00496     }
00497 
00498   if (poa == 0
00499       || (result == 0 && !poa->validate_lifespan (false, poa_creation_time)))
00500     result = -1;
00501 
00502   return result;
00503 }

TAO_ServantBase * TAO_Object_Adapter::get_collocated_servant ( const TAO_MProfile mp  )  [private]

Helper method to get collocated servant.

Definition at line 920 of file Object_Adapter.cpp.

References find_servant(), TAO_MProfile::get_profile(), ACE_OS::memcmp(), TAO_Root_POA::objectkey_prefix, TAO_MProfile::profile_count(), and TAO_Root_POA::TAO_OBJECTKEY_PREFIX_SIZE.

Referenced by create_collocated_object(), and initialize_collocated_object().

00921 {
00922   for (TAO_PHandle j = 0;
00923        j != mp.profile_count ();
00924        ++j)
00925     {
00926       const TAO_Profile *profile = mp.get_profile (j);
00927       TAO::ObjectKey_var objkey = profile->_key ();
00928 
00929       if (objkey->length() < TAO_Root_POA::TAO_OBJECTKEY_PREFIX_SIZE
00930           || ACE_OS::memcmp (objkey->get_buffer (),
00931                              &TAO_Root_POA::objectkey_prefix[0],
00932                              TAO_Root_POA::TAO_OBJECTKEY_PREFIX_SIZE) != 0)
00933         continue;
00934 
00935       TAO_ServantBase *servant = 0;
00936 
00937       try
00938         {
00939           this->find_servant (objkey.in (), servant);
00940         }
00941       catch (const ::CORBA::Exception&)
00942         {
00943         }
00944 
00945       return servant;
00946     }
00947 
00948   return 0;
00949 }

void TAO_Object_Adapter::init_default_policies ( TAO_POA_Policy_Set policies  ) 

Initialize the default set of POA policies.

Definition at line 245 of file Object_Adapter.cpp.

References TAO_POA_Policy_Set::merge_policy().

Referenced by open().

00246 {
00247   // Initialize the default policies.
00248 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00249 
00250   TAO::Portable_Server::ThreadPolicy thread_policy (PortableServer::ORB_CTRL_MODEL);
00251   policies.merge_policy (&thread_policy);
00252 
00253 #endif /* TAO_HAS_MINIMUM_POA == 0 */
00254 
00255 #if !defined (CORBA_E_MICRO)
00256   // Lifespan policy.
00257   TAO::Portable_Server::LifespanPolicy lifespan_policy (PortableServer::TRANSIENT);
00258   policies.merge_policy (&lifespan_policy);
00259 #endif
00260 
00261 #if !defined (CORBA_E_MICRO)
00262   // ID uniqueness policy.
00263   TAO::Portable_Server::IdUniquenessPolicy id_uniqueness_policy (PortableServer::UNIQUE_ID);
00264   policies.merge_policy (&id_uniqueness_policy);
00265 #endif
00266 
00267 #if !defined (CORBA_E_MICRO)
00268   // ID assignment policy.
00269   TAO::Portable_Server::IdAssignmentPolicy id_assignment_policy (PortableServer::SYSTEM_ID);
00270   policies.merge_policy (&id_assignment_policy);
00271 #endif
00272 
00273 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00274   // Implicit activation policy.
00275   TAO::Portable_Server::ImplicitActivationPolicy implicit_activation_policy
00276     (PortableServer::NO_IMPLICIT_ACTIVATION);
00277   policies.merge_policy (&implicit_activation_policy);
00278 
00279   // Servant retention policy.
00280   TAO::Portable_Server::ServantRetentionPolicy servant_retention_policy
00281     (PortableServer::RETAIN);
00282   policies.merge_policy (&servant_retention_policy);
00283 
00284   // Request processing policy.
00285   TAO::Portable_Server::RequestProcessingPolicy request_processing_policy
00286     (PortableServer::USE_ACTIVE_OBJECT_MAP_ONLY);
00287   policies.merge_policy (&request_processing_policy);
00288 #endif /* TAO_HAS_MINIMUM_POA == 0 */
00289 #if defined (CORBA_E_MICRO)
00290   ACE_UNUSED_ARG (policies);
00291 #endif
00292 }

CORBA::Long TAO_Object_Adapter::initialize_collocated_object ( TAO_Stub  )  [virtual]

Implements TAO_Adapter.

Definition at line 882 of file Object_Adapter.cpp.

References TAO_Stub::base_profiles(), TAO_Stub::collocated_servant(), TAO_Stub::forward_profiles(), get_collocated_servant(), TAO_Stub::is_collocated(), and TAO_Stub::servant_orb().

00883 {
00884   // If we have been forwarded: use the forwarded profiles
00885   const TAO_MProfile &mp = stub->forward_profiles () ? *(stub->forward_profiles ())
00886                                                      : stub->base_profiles ();
00887 
00888   TAO_ServantBase *sb = this->get_collocated_servant (mp);
00889 
00890   // Set the servant ORB.  Do not duplicate the ORB here since
00891   // TAO_Stub::servant_orb() duplicates it.
00892   stub->servant_orb (this->orb_core_.orb ());
00893 
00894   // It is ok to set the object as a collocated object even when
00895   // <sb> is zero.
00896   stub->collocated_servant (sb);
00897 
00898   // Mark the stub as collocated. This will set the strategized object
00899   // proxy broker if required.
00900   stub->is_collocated (true);
00901 
00902   // Return 0 (success) iff we found a servant.
00903   return ! sb;
00904 }

void TAO_Object_Adapter::locate_poa ( const TAO::ObjectKey &  key,
PortableServer::ObjectId id,
TAO_Root_POA *&  poa 
) [protected]

Definition at line 394 of file Object_Adapter.cpp.

References ACE_FUNCTION_TIMEPROBE, CORBA::COMPLETED_NO, find_poa(), CORBA::OMGVMCID, and TAO_Root_POA::parse_key().

Referenced by find_servant_i(), locate_servant_i(), TAO::Portable_Server::Servant_Upcall::lookup_POA(), and TAO::Portable_Server::Servant_Upcall::prepare_for_upcall_i().

00397 {
00398   TAO_Object_Adapter::poa_name poa_system_name;
00399   CORBA::Boolean is_root = false;
00400   CORBA::Boolean is_persistent = false;
00401   CORBA::Boolean is_system_id = false;
00402   TAO::Portable_Server::Temporary_Creation_Time poa_creation_time;
00403 
00404   int result = 0;
00405 
00406   {
00407     ACE_FUNCTION_TIMEPROBE (TAO_POA_PARSE_KEY_START);
00408 
00409     result = TAO_Root_POA::parse_key (key,
00410                                       poa_system_name,
00411                                       system_id,
00412                                       is_root,
00413                                       is_persistent,
00414                                       is_system_id,
00415                                       poa_creation_time);
00416   }
00417 
00418   if (result != 0)
00419     throw ::CORBA::OBJ_ADAPTER ();
00420 
00421   {
00422     ACE_FUNCTION_TIMEPROBE (TAO_OBJECT_ADAPTER_FIND_POA_START);
00423 
00424     result = this->find_poa (poa_system_name,
00425                              is_persistent,
00426                              is_root,
00427                              poa_creation_time,
00428                              poa);
00429   }
00430 
00431   if (result != 0)
00432     throw ::CORBA::OBJECT_NOT_EXIST (CORBA::OMGVMCID | 2, CORBA::COMPLETED_NO);
00433 }

ACE_INLINE int TAO_Object_Adapter::locate_servant ( const TAO::ObjectKey &  key  ) 

Definition at line 54 of file Object_Adapter.inl.

References locate_servant_i(), and TAO_OBJECT_ADAPTER_GUARD_RETURN.

00055 {
00056   // Lock access for the duration of this transaction.
00057   TAO_OBJECT_ADAPTER_GUARD_RETURN (-1);
00058 
00059   return this->locate_servant_i (key);
00060 }

int TAO_Object_Adapter::locate_servant_i ( const TAO::ObjectKey &  key  )  [protected]

Definition at line 528 of file Object_Adapter.cpp.

References ACE_FUNCTION_TIMEPROBE, locate_poa(), TAO_Root_POA::locate_servant_i(), TAO_DEFAULT_SERVANT, TAO_SERVANT_FOUND, TAO_SERVANT_MANAGER, and TAO_SERVANT_NOT_FOUND.

Referenced by locate_servant().

00529 {
00530   ACE_FUNCTION_TIMEPROBE (TAO_POA_LOCATE_SERVANT_START);
00531 
00532   PortableServer::ObjectId id;
00533   TAO_Root_POA *poa = 0;
00534 
00535   this->locate_poa (key, id, poa);
00536 
00537   PortableServer::Servant servant = 0;
00538   TAO_SERVANT_LOCATION servant_location =
00539     poa->locate_servant_i (id, servant);
00540 
00541   switch (servant_location)
00542     {
00543     case TAO_SERVANT_FOUND:
00544       // Optimistic attitude
00545     case TAO_DEFAULT_SERVANT:
00546     case TAO_SERVANT_MANAGER:
00547       return 0;
00548 
00549     case TAO_SERVANT_NOT_FOUND:
00550       return -1;
00551     }
00552 
00553   return -1;
00554 }

ACE_INLINE ACE_Lock & TAO_Object_Adapter::lock ( void   ) 

Definition at line 29 of file Object_Adapter.inl.

References lock_.

Referenced by TAO::Portable_Server::RequestProcessingStrategyServantLocator::locate_servant(), TAO::Portable_Server::Non_Servant_Upcall::Non_Servant_Upcall(), open(), TAO::Portable_Server::Servant_Upcall::prepare_for_upcall_i(), TAO::Portable_Server::Servant_Upcall::upcall_cleanup(), and TAO::Portable_Server::Non_Servant_Upcall::~Non_Servant_Upcall().

00030 {
00031   return *this->lock_;
00032 }

const char * TAO_Object_Adapter::name ( void   )  const [virtual]

Implements TAO_Adapter.

Definition at line 846 of file Object_Adapter.cpp.

References TAO_OBJID_ROOTPOA.

Referenced by TAO_Object_Adapter::Active_Hint_Strategy::bind_persistent_poa(), and bind_transient_poa().

00847 {
00848   return TAO_OBJID_ROOTPOA;
00849 }

ACE_INLINE TAO::Portable_Server::Non_Servant_Upcall * TAO_Object_Adapter::non_servant_upcall_in_progress ( void   )  const

Pointer to the non-servant upcall in progress. If no non-servant upcall is in progress, this pointer is zero.

Definition at line 153 of file Object_Adapter.inl.

References non_servant_upcall_in_progress_.

Referenced by TAO_Root_POA::destroy_i().

00154 {
00155   return this->non_servant_upcall_in_progress_;
00156 }

void TAO_Object_Adapter::open ( void   )  [virtual]

Implements TAO_Adapter.

Definition at line 569 of file Object_Adapter.cpp.

References CORBA::Object::_add_ref(), CORBA::SystemException::_tao_minor_code(), ACE_NEW, ACE_NEW_THROW_EX, CORBA::COMPLETED_NO, TAO_POAManager_Factory::create_POAManager(), TAO_Servant_Dispatcher::create_Root_POA(), TAO_Root_POA::establish_components(), TAO_Objref_Var_T< T >::in(), init_default_policies(), lock(), TAO_Policy_Validator::merge_policies(), TAO_Thread_Lane_Resources_Manager::open_default_resources(), orb_core_, poa_manager_factory_, root_, servant_dispatcher_, TAO_DEFAULT_ROOTPOA_NAME, TAO_DEFAULT_ROOTPOAMANAGER_NAME, TAO_ORB_Core::thread_lane_resources_manager(), thread_lock(), and validator().

00570 {
00571   // Add in the default POA policies to the default list.
00572   this->init_default_policies (this->default_poa_policies ());
00573 
00574   // If a POA extension hasn't changed the servant dispatcher, initialize the
00575   // default one.
00576   if (this->servant_dispatcher_ == 0)
00577     {
00578       ACE_NEW (this->servant_dispatcher_,
00579                TAO_Default_Servant_Dispatcher);
00580     }
00581 
00582 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00583   ACE_NEW_THROW_EX (this->poa_manager_factory_,
00584                     TAO_POAManager_Factory (*this),
00585                     CORBA::NO_MEMORY ());
00586 
00587   ::CORBA::PolicyList policy;
00588   PortableServer::POAManager_var poa_manager
00589     = poa_manager_factory_->create_POAManager (TAO_DEFAULT_ROOTPOAMANAGER_NAME,
00590                                               policy);
00591 #else
00592   PortableServer::POAManager_ptr poa_manager_ptr;
00593   ::CORBA::PolicyList policy_list;
00594   ACE_NEW_THROW_EX (poa_manager_ptr,
00595                     TAO_POA_Manager (*this, TAO_DEFAULT_ROOTPOAMANAGER_NAME),
00596                     CORBA::NO_MEMORY
00597                     (CORBA::SystemException::_tao_minor_code (0, ENOMEM),
00598                       CORBA::COMPLETED_NO));
00599 
00600   PortableServer::POAManager_var poa_manager = poa_manager_ptr;
00601   // Keep reference of POAManager in TAO_Object_Adapter so the POAManager
00602   // object is destructed after RootPOA is destructed.
00603   the_poa_manager_ = poa_manager;
00604 
00605 #endif
00606 
00607   // This makes sure that the default resources are open when the Root
00608   // POA is created.
00609   this->orb_core_.thread_lane_resources_manager ().open_default_resources ();
00610 
00611   TAO_POA_Policy_Set policies (this->default_poa_policies ());
00612 
00613 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00614   // Specify the implicit activation policy since it should
00615   // be different from the default.  Note that merge_policy
00616   // takes a const reference and makes its own copy of the
00617   // policy.  (Otherwise, we'd have to allocate the policy
00618   // on the heap.)
00619   // Implicit activation policy.
00620   TAO::Portable_Server::ImplicitActivationPolicy implicit_activation_policy
00621     (PortableServer::IMPLICIT_ACTIVATION);
00622   policies.merge_policy (&implicit_activation_policy);
00623 #endif /* TAO_HAS_MINIMUM_POA == 0 */
00624 
00625   // Merge policies from the ORB level.
00626   this->validator ().merge_policies (policies.policies ());
00627 
00628   // If any of the policy objects specified are not valid for the ORB
00629   // implementation, if conflicting policy objects are specified, or
00630   // if any of the specified policy objects require prior
00631   // administrative action that has not been performed, an
00632   // InvalidPolicy exception is raised containing the index in the
00633   // policies parameter value of the first offending policy object.
00634   policies.validate_policies (this->validator (), this->orb_core_);
00635 
00636   // Construct a new POA
00637   TAO_Root_POA::String root_poa_name (TAO_DEFAULT_ROOTPOA_NAME);
00638   this->root_ =
00639     this->servant_dispatcher_->create_Root_POA (root_poa_name,
00640                                                 poa_manager.in (),
00641                                                 policies,
00642                                                 this->lock (),
00643                                                 this->thread_lock (),
00644                                                 this->orb_core_,
00645                                                 this);
00646 
00647   // The Object_Adapter will keep a reference to the Root POA so that
00648   // on its destruction, it can check whether the Root POA has been
00649   // destroyed yet or not.
00650   this->root_->_add_ref ();
00651 
00652   // Lock access for the duration of this transaction.
00653   TAO::Portable_Server::POA_Guard poa_guard (*this->root_);
00654 
00655   // Iterate over the registered IOR interceptors so that they may be
00656   // given the opportunity to add tagged components to the profiles
00657   // for this servant.
00658   this->root_->establish_components ();
00659 }

ACE_INLINE TAO_ORB_Core & TAO_Object_Adapter::orb_core ( void   )  const

Access to ORB Core.

Definition at line 147 of file Object_Adapter.inl.

References orb_core_.

Referenced by TAO_POA_Manager::adapter_manager_state_changed(), and TAO_POAManager_Factory::create_POAManager().

00148 {
00149   return this->orb_core_;
00150 }

int TAO_Object_Adapter::priority ( void   )  const [virtual]

Implements TAO_Adapter.

Definition at line 708 of file Object_Adapter.cpp.

00709 {
00710   return 0;
00711 }

void TAO_Object_Adapter::release_poa_manager_factory ( TAO_POAManager_Factory factory  )  [static, private]

Definition at line 908 of file Object_Adapter.cpp.

References release(), and TAO_POAManager_Factory::remove_all_poamanagers().

Referenced by close(), and ~TAO_Object_Adapter().

00910 {
00911   if (factory != 0)
00912     {
00913       factory->remove_all_poamanagers ();
00914       ::CORBA::release (factory);
00915     }
00916 }

ACE_INLINE ACE_Reverse_Lock< ACE_Lock > & TAO_Object_Adapter::reverse_lock ( void   ) 

Definition at line 41 of file Object_Adapter.inl.

References reverse_lock_.

00042 {
00043   return this->reverse_lock_;
00044 }

CORBA::Object_ptr TAO_Object_Adapter::root ( void   )  [virtual]

Implements TAO_Adapter.

Definition at line 852 of file Object_Adapter.cpp.

References CORBA::Object::_duplicate().

Referenced by close().

00853 {
00854   return CORBA::Object::_duplicate (this->root_);
00855 }

ACE_INLINE TAO_Root_POA * TAO_Object_Adapter::root_poa ( void   )  const

Access the root poa.

Definition at line 141 of file Object_Adapter.inl.

References root_.

00142 {
00143   return this->root_;
00144 }

void TAO_Object_Adapter::servant_dispatcher ( TAO_Servant_Dispatcher dispatcher  ) 

Set the servant dispatcher method. Ownership is transferred to this Object Adapter. Note: This should only be called at initialization.

Definition at line 1208 of file Object_Adapter.cpp.

References servant_dispatcher_.

01209 {
01210   if (this->servant_dispatcher_)
01211     delete this->servant_dispatcher_;
01212 
01213   this->servant_dispatcher_ = dispatcher;
01214 }

void TAO_Object_Adapter::set_transient_poa_name_size ( const TAO_Server_Strategy_Factory::Active_Object_Map_Creation_Parameters creation_parameters  )  [static, protected]

Definition at line 117 of file Object_Adapter.cpp.

References TAO_Server_Strategy_Factory::Active_Object_Map_Creation_Parameters::poa_lookup_strategy_for_transient_id_policy_, ACE_Active_Map_Manager_Key::size(), TAO_ACTIVE_DEMUX, TAO_DYNAMIC_HASH, and TAO_LINEAR.

Referenced by TAO_Object_Adapter().

00118 {
00119   if (TAO_Object_Adapter::transient_poa_name_size_ == 0)
00120     {
00121       switch (creation_parameters.poa_lookup_strategy_for_transient_id_policy_)
00122         {
00123 #if (TAO_HAS_MINIMUM_POA_MAPS == 0)
00124         case TAO_LINEAR:
00125           TAO_Object_Adapter::transient_poa_name_size_ =
00126             sizeof (CORBA::ULong);
00127           break;
00128         case TAO_DYNAMIC_HASH:
00129           TAO_Object_Adapter::transient_poa_name_size_ =
00130             sizeof (CORBA::ULong);
00131           break;
00132 #endif /* TAO_HAS_MINIMUM_POA_MAPS == 0 */
00133         case TAO_ACTIVE_DEMUX:
00134         default:
00135           TAO_Object_Adapter::transient_poa_name_size_ =
00136             static_cast <CORBA::ULong>(
00137                              ACE_Active_Map_Manager_Key::size ());
00138           break;
00139         }
00140     }
00141 }

ACE_INLINE TAO_SYNCH_MUTEX & TAO_Object_Adapter::thread_lock ( void   ) 

Definition at line 35 of file Object_Adapter.inl.

References thread_lock_.

Referenced by TAO_Root_POA::create_POA_i(), and open().

00036 {
00037   return this->thread_lock_;
00038 }

ACE_INLINE CORBA::ULong TAO_Object_Adapter::transient_poa_name_size ( void   )  [static]

Definition at line 48 of file Object_Adapter.inl.

References transient_poa_name_size_.

Referenced by TAO_Root_POA::parse_key().

00049 {
00050   return TAO_Object_Adapter::transient_poa_name_size_;
00051 }

ACE_INLINE int TAO_Object_Adapter::unbind_persistent_poa ( const poa_name folded_name,
const poa_name system_name 
) [protected]

Definition at line 133 of file Object_Adapter.inl.

References hint_strategy_, and TAO_Object_Adapter::Hint_Strategy::unbind_persistent_poa().

00135 {
00136   return this->hint_strategy_->unbind_persistent_poa (folded_name,
00137                                                       system_name);
00138 }

int TAO_Object_Adapter::unbind_poa ( TAO_Root_POA poa,
const poa_name folded_name,
const poa_name system_name 
)

Definition at line 517 of file Object_Adapter.cpp.

References TAO_Root_POA::persistent(), and unbind_transient_poa().

Referenced by TAO_Root_POA::complete_destruction_i(), and TAO_Root_POA::TAO_Root_POA().

00520 {
00521   if (poa->persistent ())
00522     return this->unbind_persistent_poa (folded_name, system_name);
00523   else
00524     return this->unbind_transient_poa (system_name);
00525 }

ACE_INLINE int TAO_Object_Adapter::unbind_transient_poa ( const poa_name system_name  )  [protected]

Definition at line 127 of file Object_Adapter.inl.

References transient_poa_map_, and ACE_Map< KEY, VALUE >::unbind().

Referenced by unbind_poa().

00128 {
00129   return this->transient_poa_map_->unbind (system_name);
00130 }

TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE TAO_Policy_Validator & TAO_Object_Adapter::validator ( void   ) 

Return the validator.

Definition at line 11 of file Object_Adapter.inl.

References default_validator_.

Referenced by TAO_Root_POA::create_POA_i(), TAO_POAManager_Factory::create_POAManager(), and open().

00012 {
00013   return this->default_validator_;
00014 }

void TAO_Object_Adapter::wait_for_non_servant_upcalls_to_complete ( void   ) 

Wait for non-servant upcalls to complete.

Definition at line 1174 of file Object_Adapter.cpp.

References non_servant_upcall_condition_, ACE_OS::thr_equal(), and ACE_OS::thr_self().

Referenced by TAO::Portable_Server::Servant_Upcall::lookup_POA(), TAO::Portable_Server::POA_Guard::POA_Guard(), TAO::Portable_Server::Servant_Upcall::prepare_for_upcall_i(), and wait_for_non_servant_upcalls_to_complete_no_throw().

01175 {
01176   // Check if a non-servant upcall is in progress.  If a non-servant
01177   // upcall is in progress, wait for it to complete.  Unless of
01178   // course, the thread making the non-servant upcall is this thread.
01179   while (this->enable_locking_ &&
01180          this->non_servant_upcall_in_progress_ &&
01181          ! ACE_OS::thr_equal (this->non_servant_upcall_thread_,
01182                               ACE_OS::thr_self ()))
01183     {
01184       // If so wait...
01185       int const result = this->non_servant_upcall_condition_.wait ();
01186       if (result == -1)
01187         throw ::CORBA::OBJ_ADAPTER ();
01188     }
01189 }

void TAO_Object_Adapter::wait_for_non_servant_upcalls_to_complete_no_throw ( void   ) 

Non-exception throwing version.

Definition at line 1192 of file Object_Adapter.cpp.

References ACE_ERROR, LM_ERROR, and wait_for_non_servant_upcalls_to_complete().

Referenced by TAO::Portable_Server::Servant_Upcall::upcall_cleanup().

01193 {
01194   // Non-exception throwing version.
01195   try
01196     {
01197       this->wait_for_non_servant_upcalls_to_complete ();
01198     }
01199   catch (const ::CORBA::Exception&)
01200     {
01201       ACE_ERROR ((LM_ERROR,
01202                   "TAO_Object_Adapter::wait_for_non_servant_upcalls_to_complete "
01203                   "threw exception it should not have!\n"));
01204     }
01205 }


Friends And Related Function Documentation

friend class Active_Hint_Strategy [friend]

Definition at line 280 of file Object_Adapter.h.

friend class No_Hint_Strategy [friend]

Definition at line 309 of file Object_Adapter.h.

friend class TAO::Portable_Server::Non_Servant_Upcall [friend]

Definition at line 445 of file Object_Adapter.h.

friend class TAO::Portable_Server::Servant_Upcall [friend]

Definition at line 447 of file Object_Adapter.h.

friend class TAO_Root_POA [friend]

Definition at line 79 of file Object_Adapter.h.


Member Data Documentation

TAO_POA_Policy_Set TAO_Object_Adapter::default_poa_policies_ [private]

Save a list of default policies that should be included in every POA (unless overridden).

Definition at line 495 of file Object_Adapter.h.

Referenced by default_poa_policies().

TAO_POA_Default_Policy_Validator TAO_Object_Adapter::default_validator_ [private]

The default validator and the beginning of the chain of policy validators.

Definition at line 491 of file Object_Adapter.h.

Referenced by validator().

int TAO_Object_Adapter::enable_locking_ [protected]

Definition at line 382 of file Object_Adapter.h.

Referenced by enable_locking(), and TAO::Portable_Server::Servant_Upcall::servant_cleanup().

Hint_Strategy* TAO_Object_Adapter::hint_strategy_ [protected]

Definition at line 313 of file Object_Adapter.h.

Referenced by bind_persistent_poa(), find_persistent_poa(), TAO_Object_Adapter(), unbind_persistent_poa(), and ~TAO_Object_Adapter().

ACE_Lock* TAO_Object_Adapter::lock_ [protected]

Definition at line 386 of file Object_Adapter.h.

Referenced by lock(), and ~TAO_Object_Adapter().

TAO_SYNCH_CONDITION TAO_Object_Adapter::non_servant_upcall_condition_ [private]

Condition variable for waiting on non-servant upcalls to end.

Definition at line 466 of file Object_Adapter.h.

Referenced by wait_for_non_servant_upcalls_to_complete(), and TAO::Portable_Server::Non_Servant_Upcall::~Non_Servant_Upcall().

TAO::Portable_Server::Non_Servant_Upcall* TAO_Object_Adapter::non_servant_upcall_in_progress_ [private]

Pointer to the non-servant upcall in progress. If no non-servant upcall is in progress, this pointer is zero.

Definition at line 470 of file Object_Adapter.h.

Referenced by TAO::Portable_Server::Non_Servant_Upcall::Non_Servant_Upcall(), non_servant_upcall_in_progress(), and TAO::Portable_Server::Non_Servant_Upcall::~Non_Servant_Upcall().

unsigned int TAO_Object_Adapter::non_servant_upcall_nesting_level_ [private]

Current nesting level of non_servant_upcalls.

Definition at line 473 of file Object_Adapter.h.

Referenced by TAO::Portable_Server::Non_Servant_Upcall::Non_Servant_Upcall(), and TAO::Portable_Server::Non_Servant_Upcall::~Non_Servant_Upcall().

ACE_thread_t TAO_Object_Adapter::non_servant_upcall_thread_ [private]

Id of thread making the non-servant upcall.

Definition at line 476 of file Object_Adapter.h.

Referenced by TAO::Portable_Server::Non_Servant_Upcall::Non_Servant_Upcall(), and TAO::Portable_Server::Non_Servant_Upcall::~Non_Servant_Upcall().

TAO_ORB_Core& TAO_Object_Adapter::orb_core_ [protected]

Definition at line 380 of file Object_Adapter.h.

Referenced by dispatch(), open(), and orb_core().

persistent_poa_name_map* TAO_Object_Adapter::persistent_poa_name_map_ [protected]

Persistent POA map.

Definition at line 369 of file Object_Adapter.h.

Referenced by TAO_Object_Adapter::No_Hint_Strategy::bind_persistent_poa(), TAO_Object_Adapter::Active_Hint_Strategy::bind_persistent_poa(), TAO_Object_Adapter::No_Hint_Strategy::find_persistent_poa(), TAO_Object_Adapter(), TAO_Object_Adapter::No_Hint_Strategy::unbind_persistent_poa(), TAO_Object_Adapter::Active_Hint_Strategy::unbind_persistent_poa(), and ~TAO_Object_Adapter().

TAO_POAManager_Factory* TAO_Object_Adapter::poa_manager_factory_ [private]

The POAManager factory.

Definition at line 483 of file Object_Adapter.h.

Referenced by close(), and open().

ACE_Reverse_Lock<ACE_Lock> TAO_Object_Adapter::reverse_lock_ [protected]

Definition at line 388 of file Object_Adapter.h.

Referenced by reverse_lock().

TAO_Root_POA* TAO_Object_Adapter::root_ [private]

The Root POA.

Definition at line 479 of file Object_Adapter.h.

Referenced by activate_poa(), close(), find_transient_poa(), open(), root_poa(), and ~TAO_Object_Adapter().

TAO_Servant_Dispatcher* TAO_Object_Adapter::servant_dispatcher_ [protected]

Strategy for dispatching a request to a servant.

Definition at line 366 of file Object_Adapter.h.

Referenced by open(), TAO::Portable_Server::Servant_Upcall::post_invoke(), TAO::Portable_Server::Servant_Upcall::pre_invoke_collocated_request(), TAO::Portable_Server::Servant_Upcall::pre_invoke_remote_request(), servant_dispatcher(), and ~TAO_Object_Adapter().

TAO_SYNCH_MUTEX TAO_Object_Adapter::thread_lock_ [protected]

Definition at line 384 of file Object_Adapter.h.

Referenced by thread_lock().

transient_poa_map* TAO_Object_Adapter::transient_poa_map_ [protected]

Transient POA map.

Definition at line 372 of file Object_Adapter.h.

Referenced by bind_transient_poa(), find_transient_poa(), TAO_Object_Adapter(), unbind_transient_poa(), and ~TAO_Object_Adapter().

TAO_BEGIN_VERSIONED_NAMESPACE_DECL CORBA::ULong TAO_Object_Adapter::transient_poa_name_size_ = 0 [static, protected]

Definition at line 376 of file Object_Adapter.h.

Referenced by transient_poa_name_size().


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