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 (CORBA::Environment &ACE_TRY_ENV)
 Wait for non-servant upcalls to complete.

void wait_for_non_servant_upcalls_to_complete (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 ()
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

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

ACE_Lockcreate_lock (int enable_locking, TAO_SYNCH_MUTEX &thread_lock)
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

CORBA::ULong transient_poa_name_size_ = 0

Private Member Functions

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


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

Detailed Description

Defines the Object Adapter abstraction.

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

Definition at line 73 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 374 of file Object_Adapter.h.

Referenced by TAO_Object_Adapter().

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 381 of file Object_Adapter.h.

Referenced by TAO_Object_Adapter().

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 366 of file Object_Adapter.h.

Referenced by TAO_Object_Adapter().

typedef PortableServer::ObjectId TAO_Object_Adapter::poa_name
 

Definition at line 80 of file Object_Adapter.h.

Referenced by activate_poa(), bind_persistent_poa(), TAO_Object_Adapter::No_Hint_Strategy::bind_persistent_poa(), TAO_Object_Adapter::Active_Hint_Strategy::bind_persistent_poa(), bind_poa(), bind_transient_poa(), find_persistent_poa(), TAO_Object_Adapter::No_Hint_Strategy::find_persistent_poa(), TAO_Object_Adapter::Active_Hint_Strategy::find_persistent_poa(), find_poa(), find_transient_poa(), TAO_Root_POA::is_poa_generated(), TAO_Object_Adapter::iteratable_poa_name::iteratable_poa_name(), locate_poa(), TAO_Root_POA::parse_ir_object_key(), TAO_Root_POA::parse_key(), unbind_persistent_poa(), TAO_Object_Adapter::No_Hint_Strategy::unbind_persistent_poa(), TAO_Object_Adapter::Active_Hint_Strategy::unbind_persistent_poa(), unbind_poa(), and unbind_transient_poa().

typedef PortableServer::ObjectId_out TAO_Object_Adapter::poa_name_out
 

Definition at line 82 of file Object_Adapter.h.

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

typedef PortableServer::ObjectId_var TAO_Object_Adapter::poa_name_var
 

Definition at line 81 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 361 of file Object_Adapter.h.

Referenced by TAO_Object_Adapter().

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 346 of file Object_Adapter.h.

Referenced by TAO_Object_Adapter().

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 354 of file Object_Adapter.h.

Referenced by TAO_Object_Adapter().

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

Base class of the id map.

Definition at line 337 of file Object_Adapter.h.

Referenced by TAO_Object_Adapter().


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_hash_map, persistent_poa_name_linear_map, persistent_poa_name_map, 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_active_map, transient_poa_hash_map, transient_poa_linear_map, transient_poa_map, 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     default_validator_ (orb_core),
00161     default_poa_policies_ ()
00162 {
00163   TAO_Object_Adapter::set_transient_poa_name_size (creation_parameters);
00164 
00165   Hint_Strategy *hint_strategy = 0;
00166   if (creation_parameters.use_active_hint_in_poa_names_)
00167     ACE_NEW (hint_strategy,
00168              Active_Hint_Strategy (creation_parameters.poa_map_size_));
00169   else
00170     ACE_NEW (hint_strategy,
00171              No_Hint_Strategy);
00172 
00173   // Give ownership to the auto pointer.
00174   auto_ptr<Hint_Strategy> new_hint_strategy (hint_strategy);
00175 
00176   new_hint_strategy->object_adapter (this);
00177 
00178   persistent_poa_name_map *ppnm = 0;
00179   switch (creation_parameters.poa_lookup_strategy_for_persistent_id_policy_)
00180     {
00181     case TAO_LINEAR:
00182 #if (TAO_HAS_MINIMUM_POA_MAPS == 0)
00183       ACE_NEW (ppnm,
00184                persistent_poa_name_linear_map (creation_parameters.poa_map_size_));
00185 
00186       break;
00187 #else
00188       ACE_ERROR ((LM_ERROR,
00189                   "linear option for -ORBPersistentidPolicyDemuxStrategy "
00190                   "not supported with minimum POA maps. "
00191                   "Ingoring option to use default... \n"));
00192       /* FALL THROUGH */
00193 #endif /* TAO_HAS_MINIMUM_POA_MAPS == 0 */
00194     case TAO_DYNAMIC_HASH:
00195     default:
00196       ACE_NEW (ppnm,
00197                persistent_poa_name_hash_map (creation_parameters.poa_map_size_));
00198       break;
00199     }
00200   // Give ownership to the auto pointer.
00201   auto_ptr<persistent_poa_name_map> new_persistent_poa_name_map (ppnm);
00202 
00203   transient_poa_map *tpm = 0;
00204   switch (creation_parameters.poa_lookup_strategy_for_transient_id_policy_)
00205     {
00206 #if (TAO_HAS_MINIMUM_POA_MAPS == 0)
00207     case TAO_LINEAR:
00208       ACE_NEW (tpm,
00209                transient_poa_linear_map (creation_parameters.poa_map_size_));
00210       break;
00211     case TAO_DYNAMIC_HASH:
00212       ACE_NEW (tpm,
00213                transient_poa_hash_map (creation_parameters.poa_map_size_));
00214       break;
00215 #else
00216     case TAO_LINEAR:
00217     case TAO_DYNAMIC_HASH:
00218       ACE_ERROR ((LM_ERROR,
00219                   "linear and dynamic options for -ORBTransientidPolicyDemuxStrategy "
00220                   "are not supported with minimum POA maps. "
00221                   "Ingoring option to use default... \n"));
00222       /* FALL THROUGH */
00223 #endif /* TAO_HAS_MINIMUM_POA_MAPS == 0 */
00224     case TAO_ACTIVE_DEMUX:
00225     default:
00226       ACE_NEW (tpm,
00227                transient_poa_active_map (creation_parameters.poa_map_size_));
00228       break;
00229     }
00230   // Give ownership to the auto pointer.
00231   auto_ptr<transient_poa_map> new_transient_poa_map (tpm);
00232 
00233   this->hint_strategy_ =
00234     new_hint_strategy.release ();
00235   this->persistent_poa_name_map_ =
00236     new_persistent_poa_name_map.release ();
00237   this->transient_poa_map_ =
00238     new_transient_poa_map.release ();
00239 }

TAO_Object_Adapter::~TAO_Object_Adapter void   ) 
 

Destructor.

Definition at line 299 of file Object_Adapter.cpp.

References hint_strategy_, persistent_poa_name_map_, servant_dispatcher_, and transient_poa_map_.

00300 {
00301   delete this->hint_strategy_;
00302   delete this->persistent_poa_name_map_;
00303   delete this->transient_poa_map_;
00304   delete this->lock_;
00305 
00306   delete this->servant_dispatcher_;
00307 }


Member Function Documentation

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

Definition at line 432 of file Object_Adapter.cpp.

References ACE_CATCH, ACE_CHECK_RETURN, ACE_ENDTRY, ACE_ENV_ARG_NOT_USED, ACE_ENV_ARG_PARAMETER, ACE_THROW_RETURN, ACE_TRY, ACE_TRY_CHECK, 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 poa_name.

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

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

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 129 of file Object_Adapter.i.

References TAO_Object_Adapter::Hint_Strategy::bind_persistent_poa(), hint_strategy_, poa_name, and poa_name_out.

Referenced by bind_poa().

00132 {
00133   return this->hint_strategy_->bind_persistent_poa (folded_name,
00134                                                     poa,
00135                                                     system_name);
00136 }

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

Definition at line 512 of file Object_Adapter.cpp.

References bind_persistent_poa(), bind_transient_poa(), TAO_Root_POA::persistent(), poa_name, and poa_name_out.

Referenced by TAO_Root_POA::TAO_Root_POA().

00515 {
00516   if (poa->persistent ())
00517     return this->bind_persistent_poa (folded_name,
00518                                       poa,
00519                                       system_name);
00520   else
00521     return this->bind_transient_poa (poa,
00522                                      system_name);
00523 }

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

Definition at line 111 of file Object_Adapter.i.

References ACE_NEW_RETURN, ACE_Map< poa_name, TAO_Root_POA * >::bind_create_key(), poa_name, poa_name_out, and transient_poa_map_.

Referenced by bind_poa().

00113 {
00114   poa_name name;
00115   int result = this->transient_poa_map_->bind_create_key (poa,
00116                                                           name);
00117 
00118   if (result == 0)
00119     {
00120       ACE_NEW_RETURN (system_name,
00121                       poa_name (name),
00122                       -1);
00123     }
00124 
00125   return result;
00126 }

void TAO_Object_Adapter::check_close int  wait_for_completion  )  [virtual]
 

Implements TAO_Adapter.

Definition at line 742 of file Object_Adapter.cpp.

References ACE_CHECK, ACE_ENV_ARG_PARAMETER, and TAO_Root_POA::check_for_valid_wait_for_completions().

Referenced by close().

00744 {
00745   TAO_Root_POA::check_for_valid_wait_for_completions (this->orb_core (),
00746                                                  wait_for_completion
00747                                                  ACE_ENV_ARG_PARAMETER);
00748   ACE_CHECK;
00749 }

void TAO_Object_Adapter::close int  wait_for_completion  )  [virtual]
 

Implements TAO_Adapter.

Definition at line 703 of file Object_Adapter.cpp.

References ACE_CHECK, ACE_ENV_ARG_PARAMETER, ACE_GUARD, check_close(), TAO_Root_POA::destroy(), and poa_manager_factory_.

00705 {
00706   this->check_close (wait_for_completion ACE_ENV_ARG_PARAMETER);
00707   ACE_CHECK;
00708 
00709   // Shutting down the ORB causes all object adapters to be destroyed,
00710   // since they cannot exist in the absence of an ORB. Shut down is
00711   // complete when all ORB processing (including request processing
00712   // and object deactivation or other operations associated with
00713   // object adapters) has completed and the object adapters have been
00714   // destroyed. In the case of the POA, this means that all object
00715   // etherealizations have finished and root POA has been destroyed
00716   // (implying that all descendent POAs have also been destroyed).
00717   TAO_Root_POA *root = 0;
00718   TAO_POAManager_Factory* factory = 0;
00719   {
00720     ACE_GUARD (ACE_Lock, ace_mon, this->lock ());
00721     if (this->root_ == 0)
00722       return;
00723     root = this->root_;
00724     this->root_ = 0;
00725     if (this->poa_manager_factory_ == 0)
00726       return;
00727     factory = this->poa_manager_factory_;
00728     this->poa_manager_factory_ = 0;
00729   }
00730   CORBA::Boolean etherealize_objects = 1;
00731   root->destroy (etherealize_objects,
00732                  wait_for_completion
00733                  ACE_ENV_ARG_PARAMETER);
00734   ACE_CHECK;
00735   ::CORBA::release (root);
00736 #if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00737   ::CORBA::release (factory);
00738 #endif
00739 }

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

Implements TAO_Adapter.

Definition at line 914 of file Object_Adapter.cpp.

References ACE_NEW_RETURN, get_collocated_servant(), and TAO_Stub::servant_orb().

00916 {
00917   TAO_ServantBase *sb = this->get_collocated_servant (mp);
00918 
00919   // Set the servant ORB.  Do not duplicate the ORB here since
00920   // TAO_Stub::servant_orb() duplicates it.
00921   stub->servant_orb (this->orb_core_.orb ());
00922 
00923   // It is ok to create a collocated object even when <sb> is
00924   // zero. This constructor will set the stub collocated indicator and
00925   // the strategized proxy broker if required.
00926   CORBA::Object_ptr x;
00927   ACE_NEW_RETURN (x,
00928                   CORBA::Object (stub,
00929                                  1,
00930                                  sb),
00931                   CORBA::Object::_nil ());
00932 
00933   // Success.
00934   return x;
00935 }

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

Definition at line 311 of file Object_Adapter.cpp.

References ACE_NEW_RETURN.

00313 {
00314 #if defined (ACE_HAS_THREADS)
00315   if (enable_locking)
00316     {
00317       ACE_Lock *the_lock = 0;
00318       ACE_NEW_RETURN (the_lock,
00319                       ACE_Lock_Adapter<TAO_SYNCH_MUTEX> (thread_lock),
00320                       0);
00321       return the_lock;
00322     }
00323 #else
00324   ACE_UNUSED_ARG (enable_locking);
00325   ACE_UNUSED_ARG (thread_lock);
00326 #endif /* ACE_HAS_THREADS */
00327 
00328   ACE_Lock *the_lock = 0;
00329   ACE_NEW_RETURN (the_lock,
00330                   ACE_Lock_Adapter<ACE_SYNCH_NULL_MUTEX> (),
00331                   0);
00332   return the_lock;
00333 }

ACE_INLINE TAO_POA_Policy_Set & TAO_Object_Adapter::default_poa_policies void   ) 
 

Return the set of default policies.

Definition at line 22 of file Object_Adapter.i.

References default_poa_policies_.

00023 {
00024   return this->default_poa_policies_;
00025 }

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

Implements TAO_Adapter.

Definition at line 758 of file Object_Adapter.cpp.

References ACE_ANY_EXCEPTION, ACE_CATCHANY, ACE_CHECK_RETURN, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_RE_THROW, ACE_TRY, ACE_TRY_CHECK, TAO_ServerRequest::caught_exception(), dispatch_servant(), TAO_ServerRequest::forward_location(), TAO::unbounded_value_sequence< T >::get_buffer(), CORBA::is_nil(), ACE_OS::memcmp(), TAO::ServerRequestInterceptor_Adapter::receive_request_service_contexts(), TAO_ServerRequest::reply_status(), TAO_ServerRequest::send_cached_reply(), TAO::ServerRequestInterceptor_Adapter::send_exception(), TAO::ServerRequestInterceptor_Adapter::send_other(), and TAO_ORB_Core::serverrequestinterceptor_adapter().

00762 {
00763   if (ACE_OS::memcmp (key.get_buffer (),
00764                       &TAO_Root_POA::objectkey_prefix[0],
00765                       TAO_Root_POA::TAO_OBJECTKEY_PREFIX_SIZE) != 0)
00766     {
00767       return TAO_Adapter::DS_MISMATCHED_KEY;
00768     }
00769 
00770   int result = 0;
00771 
00772 #if TAO_HAS_INTERCEPTORS == 1
00773   TAO::ServerRequestInterceptor_Adapter *sri_adapter =
00774     orb_core_.serverrequestinterceptor_adapter ();
00775 
00776   ACE_TRY
00777     {
00778       if (sri_adapter != 0)
00779         {
00780 #if TAO_HAS_EXTENDED_FT_INTERCEPTORS == 1
00781           CORBA::OctetSeq_var ocs;
00782           sri_adapter->tao_ft_interception_point (request,
00783                                                  0,  // args
00784                                                  0,  // nargs
00785                                                  0,  // servant_upcall
00786                                                  0,  // exceptions
00787                                                  0, // nexceptions
00788                                                  ocs.out ()
00789                                                  ACE_ENV_ARG_PARAMETER);
00790           ACE_TRY_CHECK;
00791 
00792           /// If we have a cached result, just go ahead and send the reply
00793           /// and let us  return
00794           if (ocs.ptr () != 0)
00795             {
00796               // request.result_seq (
00797               request.send_cached_reply (ocs.inout ());
00798 
00799               return TAO_Adapter::DS_OK;
00800             }
00801 
00802           // If a PortableInterceptor::ForwardRequest exception was
00803           // thrown, then set the forward_to object reference and return
00804           // with the appropriate return status.
00805           forward_to.ptr () = request.forward_location ();
00806           if (!CORBA::is_nil (request.forward_location ()))
00807             {
00808               return TAO_Adapter::DS_FORWARD;
00809             }
00810 #endif /*TAO_HAS_EXTENDED_FT_INTERCEPTORS*/
00811 
00812           // The receive_request_service_contexts() interception point
00813           // must be invoked before the operation is dispatched to the
00814           // servant.
00815           sri_adapter->receive_request_service_contexts (request,
00816                                                          0,  // args
00817                                                          0,  // nargs
00818                                                          0,  // servant_upcall
00819                                                          0,  // exceptions
00820                                                          0   // nexceptions
00821                                                          ACE_ENV_ARG_PARAMETER);
00822           ACE_TRY_CHECK;
00823 
00824           // If a PortableInterceptor::ForwardRequest exception was
00825           // thrown, then set the forward_to object reference and return
00826           // with the appropriate return status.
00827           forward_to.ptr () = request.forward_location ();
00828           if (!CORBA::is_nil (request.forward_location ()))
00829             {
00830               return TAO_Adapter::DS_FORWARD;
00831             }
00832         }
00833 #endif  /* TAO_HAS_INTERCEPTORS == 1 */
00834 
00835       result = this->dispatch_servant (key,
00836                                        request,
00837                                        forward_to
00838                                        ACE_ENV_ARG_PARAMETER);
00839 
00840 #if TAO_HAS_INTERCEPTORS == 1
00841       ACE_TRY_CHECK;
00842 
00843       if (result == TAO_Adapter::DS_FORWARD)
00844         {
00845           request.forward_location (forward_to.ptr ());
00846           if (sri_adapter != 0)
00847             {
00848               sri_adapter->send_other (request,
00849                                        0,  // args
00850                                        0,  // nargs
00851                                        0,  // servant_upcall
00852                                        0,  // exceptions
00853                                        0   // nexceptions
00854                                        ACE_ENV_ARG_PARAMETER);
00855               ACE_TRY_CHECK;
00856             }
00857         }
00858     }
00859   ACE_CATCHANY
00860     {
00861       // Just assume the current exception is a system exception, the
00862       // status can only change when the interceptor changes this
00863       // and this is only done when the sri_adapter is available. If we
00864       // don't have an sri_adapter we just rethrow the exception
00865       PortableInterceptor::ReplyStatus status =
00866         PortableInterceptor::SYSTEM_EXCEPTION;
00867 
00868       if (sri_adapter != 0)
00869         {
00870           request.caught_exception (&ACE_ANY_EXCEPTION);
00871 
00872           sri_adapter->send_exception (request,
00873                                        0,  // args
00874                                        0,  // nargs
00875                                        0,  // servant_upcall
00876                                        0,  // exceptions
00877                                        0   // nexceptions
00878                                        ACE_ENV_ARG_PARAMETER);
00879           ACE_TRY_CHECK;
00880 
00881           status =
00882             request.reply_status ();
00883         }
00884 
00885       // Only re-throw the exception if it hasn't been transformed by
00886       // the send_exception() interception point (e.g. to a
00887       // LOCATION_FORWARD).
00888       if (status == PortableInterceptor::SYSTEM_EXCEPTION
00889           || status == PortableInterceptor::USER_EXCEPTION)
00890         {
00891           ACE_RE_THROW;
00892         }
00893     }
00894   ACE_ENDTRY;
00895   ACE_CHECK_RETURN (result);
00896 #endif  /* TAO_HAS_INTERCEPTORS == 1 */
00897 
00898   return result;
00899 }

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

Definition at line 336 of file Object_Adapter.cpp.

References ACE_CHECK_RETURN, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_FUNCTION_TIMEPROBE, TAO_ServerRequest::collocated(), do_dispatch(), TAO_ServerRequest::operation(), 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().

00340 {
00341   ACE_FUNCTION_TIMEPROBE (TAO_OBJECT_ADAPTER_DISPATCH_SERVANT_START);
00342 
00343   // This object is magical, i.e., it has a non-trivial constructor
00344   // and destructor.
00345   TAO::Portable_Server::Servant_Upcall servant_upcall (&this->orb_core_);
00346 
00347   // Set up state in the POA et al (including the POA Current), so
00348   // that we know that this servant is currently in an upcall.
00349   const char *operation = req.operation ();
00350   int result =
00351     servant_upcall.prepare_for_upcall (key,
00352                                        operation,
00353                                        forward_to
00354                                        ACE_ENV_ARG_PARAMETER);
00355   ACE_CHECK_RETURN (result);
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         ACE_ENV_SINGLE_ARG_PARAMETER);
00365       ACE_CHECK_RETURN (result);
00366     }
00367   else
00368     {
00369       servant_upcall.pre_invoke_remote_request (req
00370                                                 ACE_ENV_ARG_PARAMETER);
00371       ACE_CHECK_RETURN (result);
00372     }
00373 
00374   // Servant dispatch.
00375   {
00376     ACE_FUNCTION_TIMEPROBE (TAO_SERVANT_DISPATCH_START);
00377 
00378     do_dispatch (req, servant_upcall ACE_ENV_ARG_PARAMETER);
00379     ACE_CHECK_RETURN (result);
00380   }
00381 
00382   return result;
00383 }

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 1282 of file Object_Adapter.cpp.

References ACE_CHECK, and ACE_ENV_ARG_PARAMETER.

Referenced by dispatch_servant().

01285 {
01286   upcall.servant ()->_dispatch(req,
01287                                &upcall
01288                                ACE_ENV_ARG_PARAMETER);
01289   ACE_CHECK;
01290 }

ACE_INLINE int TAO_Object_Adapter::enable_locking  )  const
 

Definition at line 16 of file Object_Adapter.i.

References enable_locking_.

Referenced by TAO::Portable_Server::ServantRetentionStrategyRetain::is_servant_in_map(), and TAO::Portable_Server::ServantRetentionStrategyRetain::is_user_id_in_map().

00017 {
00018   return this->enable_locking_;
00019 }

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

Definition at line 77 of file Object_Adapter.i.

References ACE_ENV_ARG_PARAMETER, TAO_Object_Adapter::Hint_Strategy::find_persistent_poa(), hint_strategy_, and poa_name.

Referenced by find_poa().

00080 {
00081   return this->hint_strategy_->find_persistent_poa (system_name,
00082                                                     poa
00083                                                     ACE_ENV_ARG_PARAMETER);
00084 }

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 87 of file Object_Adapter.i.

References ACE_ENV_ARG_PARAMETER, find_persistent_poa(), find_transient_poa(), and poa_name.

Referenced by locate_poa().

00093 {
00094   if (activate_it)
00095     {
00096       return this->find_persistent_poa (system_name,
00097                                         poa
00098                                         ACE_ENV_ARG_PARAMETER);
00099     }
00100   else
00101     {
00102       return this->find_transient_poa (system_name,
00103                                        root,
00104                                        poa_creation_time,
00105                                        poa
00106                                        ACE_ENV_ARG_PARAMETER);
00107     }
00108 }

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

Definition at line 64 of file Object_Adapter.i.

References ACE_ENV_ARG_PARAMETER, find_servant_i(), TAO_OBJECT_ADAPTER_GUARD_RETURN, and TAO_SERVANT_NOT_FOUND.

Referenced by get_collocated_servant().

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

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

Definition at line 575 of file Object_Adapter.cpp.

References ACE_CHECK_RETURN, ACE_ENV_ARG_PARAMETER, locate_poa(), TAO_Root_POA::locate_servant_i(), TAO_SERVANT_LOCATION, and TAO_SERVANT_NOT_FOUND.

Referenced by find_servant().

00578 {
00579   PortableServer::ObjectId id;
00580   TAO_Root_POA *poa = 0;
00581 
00582   this->locate_poa (key,
00583                     id,
00584                     poa
00585                     ACE_ENV_ARG_PARAMETER);
00586   ACE_CHECK_RETURN (TAO_SERVANT_NOT_FOUND);
00587 
00588   TAO_SERVANT_LOCATION servant_location = poa->locate_servant_i (id,
00589                                                                  servant
00590                                                                  ACE_ENV_ARG_PARAMETER);
00591   ACE_CHECK_RETURN (TAO_SERVANT_NOT_FOUND);
00592 
00593   return servant_location;
00594 }

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 486 of file Object_Adapter.cpp.

References ACE_Map< poa_name, TAO_Root_POA * >::find(), poa_name, and transient_poa_map_.

Referenced by find_poa().

00491 {
00492   int result = 0;
00493 
00494   if (root)
00495     {
00496       poa = this->root_;
00497     }
00498   else
00499     {
00500       result = this->transient_poa_map_->find (system_name,
00501                                                poa);
00502     }
00503 
00504   if (poa == 0
00505       || (result == 0 && !poa->validate_lifespan (false, poa_creation_time)))
00506     result = -1;
00507 
00508   return result;
00509 }

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

Helper method to get collocated servant.

Definition at line 963 of file Object_Adapter.cpp.

References TAO_Profile::_key(), ACE_CATCHANY, ACE_DECLARE_NEW_CORBA_ENV, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_TRY, ACE_TRY_CHECK, find_servant(), TAO_MProfile::get_profile(), ACE_OS::memcmp(), TAO_MProfile::profile_count(), and TAO_PHandle.

Referenced by create_collocated_object(), and initialize_collocated_object().

00964 {
00965   for (TAO_PHandle j = 0;
00966        j != mp.profile_count ();
00967        ++j)
00968     {
00969       const TAO_Profile *profile = mp.get_profile (j);
00970       TAO::ObjectKey_var objkey = profile->_key ();
00971 
00972       if (ACE_OS::memcmp (objkey->get_buffer (),
00973                           &TAO_Root_POA::objectkey_prefix[0],
00974                           TAO_Root_POA::TAO_OBJECTKEY_PREFIX_SIZE) != 0)
00975         continue;
00976 
00977       TAO_ServantBase *servant = 0;
00978 
00979       ACE_DECLARE_NEW_CORBA_ENV;
00980       ACE_TRY
00981         {
00982           this->find_servant (objkey.in (),
00983               servant
00984               ACE_ENV_ARG_PARAMETER);
00985           ACE_TRY_CHECK;
00986         }
00987       ACE_CATCHANY
00988         {
00989         }
00990       ACE_ENDTRY;
00991 
00992       return servant;
00993     }
00994 
00995   return 0;
00996 }

void TAO_Object_Adapter::init_default_policies TAO_POA_Policy_Set policies  ) 
 

Initialize the default set of POA policies.

Definition at line 242 of file Object_Adapter.cpp.

References ACE_CHECK, and ACE_ENV_ARG_PARAMETER.

Referenced by open().

00244 {
00245   // Initialize the default policies.
00246 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00247 
00248   TAO::Portable_Server::ThreadPolicy thread_policy (PortableServer::ORB_CTRL_MODEL);
00249   policies.merge_policy (&thread_policy ACE_ENV_ARG_PARAMETER);
00250   ACE_CHECK;
00251 
00252 #endif /* TAO_HAS_MINIMUM_POA == 0 */
00253 
00254 #if !defined (CORBA_E_MICRO)
00255   // Lifespan policy.
00256   TAO::Portable_Server::LifespanPolicy lifespan_policy (PortableServer::TRANSIENT);
00257   policies.merge_policy (&lifespan_policy ACE_ENV_ARG_PARAMETER);
00258   ACE_CHECK;
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 ACE_ENV_ARG_PARAMETER);
00265   ACE_CHECK;
00266 #endif
00267 
00268 #if !defined (CORBA_E_MICRO)
00269   // ID assignment policy.
00270   TAO::Portable_Server::IdAssignmentPolicy id_assignment_policy (PortableServer::SYSTEM_ID);
00271   policies.merge_policy (&id_assignment_policy ACE_ENV_ARG_PARAMETER);
00272   ACE_CHECK;
00273 #endif
00274 
00275 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00276   // Implicit activation policy.
00277   TAO::Portable_Server::ImplicitActivationPolicy implicit_activation_policy
00278     (PortableServer::NO_IMPLICIT_ACTIVATION);
00279   policies.merge_policy (&implicit_activation_policy ACE_ENV_ARG_PARAMETER);
00280   ACE_CHECK;
00281 
00282   // Servant retention policy.
00283   TAO::Portable_Server::ServantRetentionPolicy servant_retention_policy
00284     (PortableServer::RETAIN);
00285   policies.merge_policy (&servant_retention_policy ACE_ENV_ARG_PARAMETER);
00286   ACE_CHECK;
00287 
00288   // Request processing policy.
00289   TAO::Portable_Server::RequestProcessingPolicy request_processing_policy
00290     (PortableServer::USE_ACTIVE_OBJECT_MAP_ONLY);
00291   policies.merge_policy (&request_processing_policy ACE_ENV_ARG_PARAMETER);
00292   ACE_CHECK;
00293 #endif /* TAO_HAS_MINIMUM_POA == 0 */
00294 #if defined (CORBA_E_MICRO)
00295   ACE_UNUSED_ARG (policies);
00296 #endif
00297 }

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

Implements TAO_Adapter.

Definition at line 938 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().

00939 {
00940   // If we have been forwarded: use the forwarded profiles
00941   const TAO_MProfile &mp = stub->forward_profiles () ? *(stub->forward_profiles ())
00942                                                      : stub->base_profiles ();
00943 
00944   TAO_ServantBase *sb = this->get_collocated_servant (mp);
00945 
00946   // Set the servant ORB.  Do not duplicate the ORB here since
00947   // TAO_Stub::servant_orb() duplicates it.
00948   stub->servant_orb (this->orb_core_.orb ());
00949 
00950   // It is ok to set the object as a collocated object even when
00951   // <sb> is zero.
00952   stub->collocated_servant (sb);
00953 
00954   // Mark the stub as collocated. This will set the strategized object
00955   // proxy broker if required.
00956   stub->is_collocated (true);
00957 
00958   // Return 0 (success) iff we found a servant.
00959   return ! sb;
00960 }

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

Definition at line 386 of file Object_Adapter.cpp.

References ACE_CHECK, ACE_ENV_ARG_PARAMETER, ACE_FUNCTION_TIMEPROBE, ACE_THROW, find_poa(), TAO_Root_POA::parse_key(), and poa_name.

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().

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

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

Definition at line 53 of file Object_Adapter.i.

References ACE_ENV_ARG_PARAMETER, 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                                  ACE_ENV_ARG_PARAMETER);
00061 }

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

Definition at line 538 of file Object_Adapter.cpp.

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

Referenced by locate_servant().

00540 {
00541   ACE_FUNCTION_TIMEPROBE (TAO_POA_LOCATE_SERVANT_START);
00542 
00543   PortableServer::ObjectId id;
00544   TAO_Root_POA *poa = 0;
00545 
00546   this->locate_poa (key,
00547                     id,
00548                     poa
00549                     ACE_ENV_ARG_PARAMETER);
00550   ACE_CHECK_RETURN (-1);
00551 
00552   PortableServer::Servant servant = 0;
00553   TAO_SERVANT_LOCATION servant_location =
00554     poa->locate_servant_i (id,
00555                            servant
00556                            ACE_ENV_ARG_PARAMETER);
00557   ACE_CHECK_RETURN (-1);
00558 
00559   switch (servant_location)
00560     {
00561     case TAO_SERVANT_FOUND:
00562       // Optimistic attitude
00563     case TAO_DEFAULT_SERVANT:
00564     case TAO_SERVANT_MANAGER:
00565       return 0;
00566 
00567     case TAO_SERVANT_NOT_FOUND:
00568       return -1;
00569     }
00570 
00571   return -1;
00572 }

ACE_INLINE ACE_Lock & TAO_Object_Adapter::lock void   ) 
 

Definition at line 28 of file Object_Adapter.i.

Referenced by TAO::Portable_Server::RequestProcessingStrategyServantLocator::locate_servant(), TAO::Portable_Server::Servant_Upcall::lookup_POA(), 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().

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

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

Implements TAO_Adapter.

Definition at line 902 of file Object_Adapter.cpp.

References TAO_OBJID_ROOTPOA.

00903 {
00904   return TAO_OBJID_ROOTPOA;
00905 }

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 165 of file Object_Adapter.i.

References non_servant_upcall_in_progress_.

00166 {
00167   return this->non_servant_upcall_in_progress_;
00168 }

void TAO_Object_Adapter::open  )  [virtual]
 

Implements TAO_Adapter.

Definition at line 597 of file Object_Adapter.cpp.

References TAO_Local_RefCounted_Object::_add_ref(), ACE_CHECK, ACE_CHECK_RETURN, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_NEW, ACE_NEW_THROW_EX, 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_POA_Policy_Set::merge_policy(), TAO_Thread_Lane_Resources_Manager::open_default_resources(), poa_manager_factory_, PortableServer::POAManager_ptr, PortableServer::POAManager_var, PortableServer::POAManagerFactory_ptr, TAO_POA_Policy_Set::policies(), servant_dispatcher_, TAO_Root_POA::String, TAO_DEFAULT_ROOTPOA_NAME, TAO_DEFAULT_ROOTPOAMANAGER_NAME, TAO_ORB_Core::thread_lane_resources_manager(), thread_lock(), TAO_POA_Policy_Set::validate_policies(), and validator().

00598 {
00599   // Add in the default POA policies to the default list.
00600   this->init_default_policies (this->default_poa_policies ()
00601                                ACE_ENV_ARG_PARAMETER);
00602   ACE_CHECK;
00603 
00604   // If a POA extension hasn't changed the servant dispatcher, initialize the
00605   // default one.
00606   if (this->servant_dispatcher_ == 0)
00607     {
00608       ACE_NEW (this->servant_dispatcher_,
00609                TAO_Default_Servant_Dispatcher);
00610     }
00611 
00612 #if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00613   ACE_NEW_THROW_EX (this->poa_manager_factory_,
00614                     TAO_POAManager_Factory (*this),
00615                     CORBA::NO_MEMORY ());
00616 
00617   ::CORBA::PolicyList policy;
00618   PortableServer::POAManager_var poa_manager
00619     = poa_manager_factory_->create_POAManager (TAO_DEFAULT_ROOTPOAMANAGER_NAME,
00620                                               policy
00621                                               ACE_ENV_ARG_PARAMETER);
00622   ACE_CHECK;
00623 #else
00624   PortableServer::POAManager_var poa_manager;
00625   PortableServer::POAManager_ptr pm = PortableServer::POAManager::_nil ();
00626   ::CORBA::PolicyList policy_list;
00627   PortableServer::POAManagerFactory_ptr fptr;
00628   ACE_NEW_THROW_EX (pm,
00629                     TAO_POA_Manager (*this, 0, policy_list, fptr),
00630                     CORBA::NO_MEMORY
00631                     (CORBA::SystemException::_tao_minor_code (0, ENOMEM),
00632                       CORBA::COMPLETED_NO));
00633   ACE_CHECK_RETURN (::PortableServer::POAManager::_nil ());
00634   poa_manager = pm;
00635 #endif
00636 
00637   // This makes sure that the default resources are open when the Root
00638   // POA is created.
00639   this->orb_core_.thread_lane_resources_manager ().open_default_resources (ACE_ENV_SINGLE_ARG_PARAMETER);
00640   ACE_CHECK;
00641 
00642   TAO_POA_Policy_Set policies (this->default_poa_policies ());
00643 
00644 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00645   // Specify the implicit activation policy since it should
00646   // be different from the default.  Note that merge_policy
00647   // takes a const reference and makes its own copy of the
00648   // policy.  (Otherwise, we'd have to allocate the policy
00649   // on the heap.)
00650   // Implicit activation policy.
00651   TAO::Portable_Server::ImplicitActivationPolicy implicit_activation_policy
00652     (PortableServer::IMPLICIT_ACTIVATION);
00653   policies.merge_policy (&implicit_activation_policy ACE_ENV_ARG_PARAMETER);
00654   ACE_CHECK;
00655 #endif /* TAO_HAS_MINIMUM_POA == 0 */
00656 
00657   // Merge policies from the ORB level.
00658   this->validator ().merge_policies (policies.policies ()
00659                                      ACE_ENV_ARG_PARAMETER);
00660   ACE_CHECK;
00661 
00662   // If any of the policy objects specified are not valid for the ORB
00663   // implementation, if conflicting policy objects are specified, or
00664   // if any of the specified policy objects require prior
00665   // administrative action that has not been performed, an
00666   // InvalidPolicy exception is raised containing the index in the
00667   // policies parameter value of the first offending policy object.
00668   policies.validate_policies (this->validator (),
00669                               this->orb_core_
00670                               ACE_ENV_ARG_PARAMETER);
00671   ACE_CHECK;
00672 
00673   // Construct a new POA
00674   TAO_Root_POA::String root_poa_name (TAO_DEFAULT_ROOTPOA_NAME);
00675   this->root_ =
00676     this->servant_dispatcher_->create_Root_POA (root_poa_name,
00677                                                 poa_manager.in (),
00678                                                 policies,
00679                                                 this->lock (),
00680                                                 this->thread_lock (),
00681                                                 this->orb_core_,
00682                                                 this
00683                                                 ACE_ENV_ARG_PARAMETER);
00684   ACE_CHECK;
00685 
00686   // The Object_Adapter will keep a reference to the Root POA so that
00687   // on its destruction, it can check whether the Root POA has been
00688   // destroyed yet or not.
00689   this->root_->_add_ref ();
00690 
00691   // Lock access for the duration of this transaction.
00692   TAO::Portable_Server::POA_Guard poa_guard (*this->root_ ACE_ENV_ARG_PARAMETER);
00693   ACE_CHECK;
00694 
00695   // Iterate over the registered IOR interceptors so that they may be
00696   // given the opportunity to add tagged components to the profiles
00697   // for this servant.
00698   this->root_->establish_components (ACE_ENV_SINGLE_ARG_PARAMETER);
00699   ACE_CHECK;
00700 }

ACE_INLINE TAO_ORB_Core & TAO_Object_Adapter::orb_core void   )  const
 

Access to ORB Core.

Definition at line 159 of file Object_Adapter.i.

00160 {
00161   return this->orb_core_;
00162 }

int TAO_Object_Adapter::priority void   )  const [virtual]
 

Implements TAO_Adapter.

Definition at line 752 of file Object_Adapter.cpp.

00753 {
00754   return 0;
00755 }

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

Definition at line 40 of file Object_Adapter.i.

00041 {
00042   return this->reverse_lock_;
00043 }

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

Implements TAO_Adapter.

Definition at line 908 of file Object_Adapter.cpp.

References CORBA::Object::_duplicate().

00909 {
00910   return CORBA::Object::_duplicate (this->root_);
00911 }

ACE_INLINE TAO_Root_POA * TAO_Object_Adapter::root_poa void   )  const
 

Access the root poa.

Definition at line 153 of file Object_Adapter.i.

00154 {
00155   return this->root_;
00156 }

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 1273 of file Object_Adapter.cpp.

References servant_dispatcher_.

01274 {
01275   if (this->servant_dispatcher_)
01276     delete this->servant_dispatcher_;
01277 
01278   this->servant_dispatcher_ = dispatcher;
01279 }

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, TAO_LINEAR, and transient_poa_name_size_.

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 34 of file Object_Adapter.i.

References thread_lock_.

Referenced by open().

00035 {
00036   return this->thread_lock_;
00037 }

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

Definition at line 47 of file Object_Adapter.i.

References transient_poa_name_size_.

Referenced by TAO_Root_POA::parse_key().

00048 {
00049   return TAO_Object_Adapter::transient_poa_name_size_;
00050 }

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

Definition at line 145 of file Object_Adapter.i.

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

Referenced by unbind_poa().

00147 {
00148   return this->hint_strategy_->unbind_persistent_poa (folded_name,
00149                                                       system_name);
00150 }

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

Definition at line 526 of file Object_Adapter.cpp.

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

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

00529 {
00530   if (poa->persistent ())
00531     return this->unbind_persistent_poa (folded_name,
00532                                         system_name);
00533   else
00534     return this->unbind_transient_poa (system_name);
00535 }

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

Definition at line 139 of file Object_Adapter.i.

References poa_name, transient_poa_map_, and ACE_Map< poa_name, TAO_Root_POA * >::unbind().

Referenced by unbind_poa().

00140 {
00141   return this->transient_poa_map_->unbind (system_name);
00142 }

TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE TAO_Policy_Validator & TAO_Object_Adapter::validator void   ) 
 

Return the validator.

Definition at line 10 of file Object_Adapter.i.

References default_validator_.

Referenced by open().

00011 {
00012   return this->default_validator_;
00013 }

void TAO_Object_Adapter::wait_for_non_servant_upcalls_to_complete void   ) 
 

Non-exception throwing version.

Definition at line 1255 of file Object_Adapter.cpp.

References ACE_CATCHANY, ACE_ENDTRY, ACE_ERROR, ACE_TRY_CHECK, ACE_TRY_ENV, ACE_TRY_NEW_ENV, and LM_ERROR.

01256 {
01257   // Non-exception throwing version.
01258   ACE_TRY_NEW_ENV
01259     {
01260       this->wait_for_non_servant_upcalls_to_complete (ACE_TRY_ENV);
01261       ACE_TRY_CHECK;
01262     }
01263   ACE_CATCHANY
01264     {
01265       ACE_ERROR ((LM_ERROR,
01266                   "TAO_Object_Adapter::wait_for_non_servant_upcalls_to_complete "
01267                   "threw exception it should not have!\n"));
01268     }
01269   ACE_ENDTRY;
01270 }

void TAO_Object_Adapter::wait_for_non_servant_upcalls_to_complete CORBA::Environment ACE_TRY_ENV  ) 
 

Wait for non-servant upcalls to complete.

Definition at line 1232 of file Object_Adapter.cpp.

References ACE_THROW, ACE_TRY_ENV, enable_locking_, non_servant_upcall_condition_, non_servant_upcall_in_progress_, and ACE_OS::thr_equal().

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

01233 {
01234 #if defined (ACE_HAS_EXCEPTIONS)
01235   ACE_UNUSED_ARG (ACE_TRY_ENV); // FUZZ: ignore check_for_ace_check
01236 #endif
01237 
01238   // Check if a non-servant upcall is in progress.  If a non-servant
01239   // upcall is in progress, wait for it to complete.  Unless of
01240   // course, the thread making the non-servant upcall is this thread.
01241   while (this->enable_locking_ &&
01242          this->non_servant_upcall_in_progress_ &&
01243          ! ACE_OS::thr_equal (this->non_servant_upcall_thread_,
01244                               ACE_OS::thr_self ()))
01245     {
01246       // If so wait...
01247       int result =
01248         this->non_servant_upcall_condition_.wait ();
01249       if (result == -1)
01250         ACE_THROW (CORBA::OBJ_ADAPTER ());
01251     }
01252 }


Friends And Related Function Documentation

friend class Active_Hint_Strategy [friend]
 

Definition at line 298 of file Object_Adapter.h.

friend class No_Hint_Strategy [friend]
 

Definition at line 328 of file Object_Adapter.h.

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

Definition at line 464 of file Object_Adapter.h.

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

Definition at line 466 of file Object_Adapter.h.

friend class TAO_Root_POA [friend]
 

Definition at line 78 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 506 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 502 of file Object_Adapter.h.

Referenced by validator().

int TAO_Object_Adapter::enable_locking_ [protected]
 

Definition at line 401 of file Object_Adapter.h.

Referenced by enable_locking(), TAO::Portable_Server::Servant_Upcall::poa_cleanup(), TAO::Portable_Server::Servant_Upcall::servant_cleanup(), TAO_Root_POA::wait_for_completions(), wait_for_non_servant_upcalls_to_complete(), and TAO::Portable_Server::Non_Servant_Upcall::~Non_Servant_Upcall().

Hint_Strategy* TAO_Object_Adapter::hint_strategy_ [protected]
 

Definition at line 332 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 405 of file Object_Adapter.h.

TAO_SYNCH_CONDITION TAO_Object_Adapter::non_servant_upcall_condition_ [private]
 

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

Definition at line 482 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 486 of file Object_Adapter.h.

Referenced by TAO::Portable_Server::Non_Servant_Upcall::Non_Servant_Upcall(), non_servant_upcall_in_progress(), wait_for_non_servant_upcalls_to_complete(), 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 489 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 492 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 399 of file Object_Adapter.h.

persistent_poa_name_map* TAO_Object_Adapter::persistent_poa_name_map_ [protected]
 

Persistent POA map.

Definition at line 388 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::Active_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 498 of file Object_Adapter.h.

Referenced by close(), and open().

ACE_Reverse_Lock<ACE_Lock> TAO_Object_Adapter::reverse_lock_ [protected]
 

Definition at line 407 of file Object_Adapter.h.

TAO_Root_POA* TAO_Object_Adapter::root_ [private]
 

The Root POA.

Definition at line 495 of file Object_Adapter.h.

TAO_Servant_Dispatcher* TAO_Object_Adapter::servant_dispatcher_ [protected]
 

Strategy for dispatching a request to a servant.

Definition at line 385 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 403 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 391 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 114 of file Object_Adapter.cpp.

Referenced by set_transient_poa_name_size(), and transient_poa_name_size().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 12:45:38 2006 for TAO_PortableServer by doxygen 1.3.6