TAO::Portable_Server::RequestProcessingStrategyDefaultServant Class Reference

#include <RequestProcessingStrategyDefaultServant.h>

Inheritance diagram for TAO::Portable_Server::RequestProcessingStrategyDefaultServant:

Inheritance graph
[legend]
Collaboration diagram for TAO::Portable_Server::RequestProcessingStrategyDefaultServant:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 RequestProcessingStrategyDefaultServant (void)
virtual void strategy_cleanup (void)
PortableServer::ServantManager_ptr get_servant_manager (void)
void set_servant_manager (PortableServer::ServantManager_ptr imgr)
PortableServer::Servant get_servant (void)
void set_servant (PortableServer::Servant servant)
virtual TAO_SERVANT_LOCATION locate_servant (const PortableServer::ObjectId &system_id, PortableServer::Servant &servant)
virtual PortableServer::Servant locate_servant (const char *operation, const PortableServer::ObjectId &system_id, TAO::Portable_Server::Servant_Upcall &servant_upcall, TAO::Portable_Server::POA_Current_Impl &poa_current_impl, bool &wait_occurred_restart_call)
virtual PortableServer::Servant system_id_to_servant (const PortableServer::ObjectId &system_id)
virtual PortableServer::Servant id_to_servant (const PortableServer::ObjectId &id)
virtual void cleanup_servant (PortableServer::Servant servant, const PortableServer::ObjectId &user_id)
virtual void etherealize_objects (CORBA::Boolean etherealize_objects)
virtual PortableServer::ObjectIdservant_to_id (PortableServer::Servant servant)
virtual void post_invoke_servant_cleanup (const PortableServer::ObjectId &system_id, const TAO::Portable_Server::Servant_Upcall &servant_upcall)
virtual::PortableServer::RequestProcessingPolicyValue type () const

Private Attributes

PortableServer::ServantBase_var default_servant_

Constructor & Destructor Documentation

TAO::Portable_Server::RequestProcessingStrategyDefaultServant::RequestProcessingStrategyDefaultServant void   ) 
 

Definition at line 26 of file RequestProcessingStrategyDefaultServant.cpp.

00027       : default_servant_ (0)
00028     {
00029     }


Member Function Documentation

void TAO::Portable_Server::RequestProcessingStrategyDefaultServant::cleanup_servant PortableServer::Servant  servant,
const PortableServer::ObjectId user_id
[virtual]
 

Implements TAO::Portable_Server::RequestProcessingStrategy.

Definition at line 183 of file RequestProcessingStrategyDefaultServant.cpp.

References TAO_Root_POA::unbind_using_user_id().

00187     {
00188       if (servant)
00189         {
00190           // ATTENTION: Trick locking here, see class header for details
00191           Non_Servant_Upcall non_servant_upcall (*this->poa_);
00192           ACE_UNUSED_ARG (non_servant_upcall);
00193 
00194           servant->_remove_ref ();
00195         }
00196 
00197       // This operation causes the association of the Object Id specified
00198       // by the oid parameter and its servant to be removed from the
00199       // Active Object Map.
00200       if (this->poa_->unbind_using_user_id (user_id) != 0)
00201         {
00202           throw ::CORBA::OBJ_ADAPTER ();
00203         }
00204     }

void TAO::Portable_Server::RequestProcessingStrategyDefaultServant::etherealize_objects CORBA::Boolean  etherealize_objects  )  [virtual]
 

Implements TAO::Portable_Server::RequestProcessingStrategy.

Definition at line 207 of file RequestProcessingStrategyDefaultServant.cpp.

00209     {
00210     }

PortableServer::Servant TAO::Portable_Server::RequestProcessingStrategyDefaultServant::get_servant void   )  [virtual]
 

Implements TAO::Portable_Server::RequestProcessingStrategy.

Definition at line 51 of file RequestProcessingStrategyDefaultServant.cpp.

References default_servant_, and PortableServer::Servant_var< T >::in().

00052     {
00053       // This operation returns the default servant associated with the
00054       // POA.
00055       return this->default_servant_.in ();
00056     }

PortableServer::ServantManager_ptr TAO::Portable_Server::RequestProcessingStrategyDefaultServant::get_servant_manager void   )  [virtual]
 

Implements TAO::Portable_Server::RequestProcessingStrategy.

Definition at line 38 of file RequestProcessingStrategyDefaultServant.cpp.

00039     {
00040       throw PortableServer::POA::WrongPolicy ();
00041     }

PortableServer::Servant TAO::Portable_Server::RequestProcessingStrategyDefaultServant::id_to_servant const PortableServer::ObjectId id  )  [virtual]
 

Implements TAO::Portable_Server::RequestProcessingStrategy.

Definition at line 164 of file RequestProcessingStrategyDefaultServant.cpp.

References default_servant_, and PortableServer::Servant_var< T >::in().

00166     {
00167       PortableServer::Servant servant = this->default_servant_.in ();
00168 
00169       if (servant == 0)
00170         {
00171           /*
00172            * If using default servant request processing strategy but
00173            * no default servant is available, we will raise the
00174            * ObjectNotActive system exception.
00175            */
00176           throw PortableServer::POA::ObjectNotActive ();
00177         }
00178 
00179       return servant;
00180     }

PortableServer::Servant TAO::Portable_Server::RequestProcessingStrategyDefaultServant::locate_servant const char *  operation,
const PortableServer::ObjectId system_id,
TAO::Portable_Server::Servant_Upcall servant_upcall,
TAO::Portable_Server::POA_Current_Impl poa_current_impl,
bool &  wait_occurred_restart_call
[virtual]
 

Implements TAO::Portable_Server::RequestProcessingStrategy.

Definition at line 111 of file RequestProcessingStrategyDefaultServant.cpp.

References default_servant_, TAO_Root_POA::find_servant(), and PortableServer::Servant_var< T >::in().

00118     {
00119       PortableServer::Servant servant = 0;
00120 
00121       servant = this->poa_->find_servant (system_id,
00122                                           servant_upcall,
00123                                           poa_current_impl);
00124 
00125       if (servant == 0)
00126         {
00127           // If the POA has the USE_DEFAULT_SERVANT policy, a default servant
00128           // has been associated with the POA so the POA will invoke the
00129           // appropriate method on that servant. If no servant has been
00130           // associated with the POA, the POA raises the OBJ_ADAPTER system
00131           // exception.
00132           PortableServer::Servant default_servant = this->default_servant_.in ();
00133           if (default_servant == 0)
00134             {
00135               throw ::CORBA::OBJ_ADAPTER (
00136                 CORBA::OMGVMCID | 3,
00137                 CORBA::COMPLETED_NO);
00138             }
00139           else
00140             {
00141               // Success
00142               servant = default_servant;
00143             }
00144         }
00145 
00146         return servant;
00147     }

TAO_SERVANT_LOCATION TAO::Portable_Server::RequestProcessingStrategyDefaultServant::locate_servant const PortableServer::ObjectId system_id,
PortableServer::Servant servant
[virtual]
 

Implements TAO::Portable_Server::RequestProcessingStrategy.

Definition at line 90 of file RequestProcessingStrategyDefaultServant.cpp.

References default_servant_, PortableServer::Servant_var< T >::in(), TAO_Root_POA::servant_present(), TAO_DEFAULT_SERVANT, TAO_SERVANT_LOCATION, and TAO_SERVANT_NOT_FOUND.

00094     {
00095       TAO_SERVANT_LOCATION location = TAO_SERVANT_NOT_FOUND;
00096 
00097       location = this->poa_->servant_present (system_id, servant);
00098 
00099       if (location == TAO_SERVANT_NOT_FOUND)
00100         {
00101           if (this->default_servant_.in () != 0)
00102             {
00103               location = TAO_DEFAULT_SERVANT;
00104             }
00105         }
00106 
00107       return location;
00108     }

void TAO::Portable_Server::RequestProcessingStrategyDefaultServant::post_invoke_servant_cleanup const PortableServer::ObjectId system_id,
const TAO::Portable_Server::Servant_Upcall servant_upcall
[virtual]
 

Implements TAO::Portable_Server::RequestProcessingStrategy.

Definition at line 240 of file RequestProcessingStrategyDefaultServant.cpp.

00243     {
00244     }

PortableServer::ObjectId * TAO::Portable_Server::RequestProcessingStrategyDefaultServant::servant_to_id PortableServer::Servant  servant  )  [virtual]
 

Implements TAO::Portable_Server::RequestProcessingStrategy.

Definition at line 213 of file RequestProcessingStrategyDefaultServant.cpp.

References default_servant_, TAO::Portable_Server::POA_Current_Impl::get_object_id(), PortableServer::Servant_var< T >::in(), TAO_TSS_Resources::instance(), TAO_TSS_Resources::poa_current_impl_, TAO::Portable_Server::POA_Current_Impl::servant(), and TAO_Root_POA::servant_to_user_id().

00216     {
00217       PortableServer::Servant default_servant = this->default_servant_.in ();
00218 
00219       if (default_servant != 0 &&
00220           default_servant == servant)
00221         {
00222           // If they are the same servant, then check if we are in an
00223           // upcall.
00224           TAO::Portable_Server::POA_Current_Impl *poa_current_impl =
00225             static_cast <TAO::Portable_Server::POA_Current_Impl *>
00226                         (TAO_TSS_Resources::instance ()->poa_current_impl_);
00227           // If we are in an upcall on the default servant, return the
00228           // ObjectId associated with the current invocation.
00229           if (poa_current_impl != 0 &&
00230               servant == poa_current_impl->servant ())
00231             {
00232               return poa_current_impl->get_object_id ();
00233             }
00234         }
00235 
00236       return this->poa_->servant_to_user_id (servant);
00237     }

void TAO::Portable_Server::RequestProcessingStrategyDefaultServant::set_servant PortableServer::Servant  servant  )  [virtual]
 

Implements TAO::Portable_Server::RequestProcessingStrategy.

Definition at line 59 of file RequestProcessingStrategyDefaultServant.cpp.

References default_servant_.

00062     {
00063       // This operation registers the specified servant with the POA as
00064       // the default servant. This servant will be used for all requests
00065       // for which no servant is found in the Active Object Map.
00066       this->default_servant_ = servant;
00067 
00068       // The implementation of set_servant will invoke _add_ref at least
00069       // once on the Servant argument before returning. When the POA no
00070       // longer needs the Servant, it will invoke _remove_ref on it the
00071       // same number of times.
00072       if (servant != 0)
00073         {
00074           // A recursive thread lock without using a recursive thread
00075           // lock.  Non_Servant_Upcall has a magic constructor and
00076           // destructor.  We unlock the Object_Adapter lock for the
00077           // duration of the servant activator upcalls; reacquiring once
00078           // the upcalls complete.  Even though we are releasing the lock,
00079           // other threads will not be able to make progress since
00080           // <Object_Adapter::non_servant_upcall_in_progress_> has been
00081           // set.
00082           Non_Servant_Upcall non_servant_upcall (*this->poa_);
00083           ACE_UNUSED_ARG (non_servant_upcall);
00084 
00085           servant->_add_ref ();
00086         }
00087     }

void TAO::Portable_Server::RequestProcessingStrategyDefaultServant::set_servant_manager PortableServer::ServantManager_ptr  imgr  )  [virtual]
 

Implements TAO::Portable_Server::RequestProcessingStrategy.

Definition at line 44 of file RequestProcessingStrategyDefaultServant.cpp.

References PortableServer::ServantManager_ptr.

00046     {
00047       throw PortableServer::POA::WrongPolicy ();
00048     }

void TAO::Portable_Server::RequestProcessingStrategyDefaultServant::strategy_cleanup void   )  [virtual]
 

Reimplemented from TAO::Portable_Server::RequestProcessingStrategy.

Definition at line 32 of file RequestProcessingStrategyDefaultServant.cpp.

References default_servant_.

00033     {
00034       this->default_servant_ = 0;
00035     }

PortableServer::Servant TAO::Portable_Server::RequestProcessingStrategyDefaultServant::system_id_to_servant const PortableServer::ObjectId system_id  )  [virtual]
 

Implements TAO::Portable_Server::RequestProcessingStrategy.

Definition at line 150 of file RequestProcessingStrategyDefaultServant.cpp.

References default_servant_, TAO_Root_POA::find_servant(), and PortableServer::Servant_var< T >::in().

00152     {
00153       PortableServer::Servant servant = this->default_servant_.in ();
00154 
00155       if (servant == 0)
00156         {
00157           servant = this->poa_->find_servant (system_id);
00158         }
00159 
00160       return servant;
00161     }

PortableServer::RequestProcessingPolicyValue TAO::Portable_Server::RequestProcessingStrategyDefaultServant::type  )  const [virtual]
 

Implements TAO::Portable_Server::RequestProcessingStrategy.

Definition at line 247 of file RequestProcessingStrategyDefaultServant.cpp.

00248     {
00249       return ::PortableServer::USE_DEFAULT_SERVANT;
00250     }


Member Data Documentation

PortableServer::ServantBase_var TAO::Portable_Server::RequestProcessingStrategyDefaultServant::default_servant_ [private]
 

Definition at line 98 of file RequestProcessingStrategyDefaultServant.h.

Referenced by get_servant(), id_to_servant(), locate_servant(), servant_to_id(), set_servant(), strategy_cleanup(), and system_id_to_servant().


The documentation for this class was generated from the following files:
Generated on Sun Jan 27 13:29:12 2008 for TAO_PortableServer by doxygen 1.3.6