TAO::Portable_Server::POA_Current_Impl Class Reference

Implementation of the PortableServer::Current object. More...

#include <POA_Current_Impl.h>

Collaboration diagram for TAO::Portable_Server::POA_Current_Impl:

Collaboration graph
[legend]
List of all members.

Public Member Functions

PortableServer::POA_ptr get_POA (void)
PortableServer::ObjectIdget_object_id (void)
PortableServer::Servant get_servant (void)
CORBA::Object_ptr get_reference (void)
void poa (::TAO_Root_POA *)
 Set the POA implementation.
::TAO_Root_POApoa (void) const
 Get the POA implemantation.
TAO_ORB_Coreorb_core (void) const
 ORB Core for this current.
void object_id (const PortableServer::ObjectId &id)
 Set the object ID.
const PortableServer::ObjectIdobject_id (void) const
 Get the object ID.
void replace_object_id (const PortableServer::ObjectId &system_id)
 Just replace the object id smartly.
void object_key (const TAO::ObjectKey &key)
 Set the object key.
const TAO::ObjectKey & object_key (void) const
 Get the object key.
void servant (PortableServer::Servant servant)
 Set the servant for the current upcall.
PortableServer::Servant servant (void) const
 Get the servant for the current upcall.
void priority (CORBA::Short priority)
 Set the priority for the current upcall.
CORBA::Short priority (void) const
 Get the priority for the current upcall.
 POA_Current_Impl (void)
 Convenience constructor combining construction & initialization.
POA_Current_Implprevious (void) const
 Return the previous current implementation.
void teardown (void)
 Teardown the current for this request.
void setup (::TAO_Root_POA *impl, const TAO::ObjectKey &key)
 Setup the current.

Protected Attributes

::TAO_Root_POApoa_
 The POA implementation invoking an upcall.
CORBA::Octet object_id_buf_ [TAO_POA_OBJECT_ID_BUF_SIZE]
PortableServer::ObjectId object_id_
const TAO::ObjectKey * object_key_
 The object key of the current context.
PortableServer::Servant servant_
 The servant for the current upcall.
CORBA::Short priority_
 The priority for the current upcall.
POA_Current_Implprevious_current_impl_
 Current previous from <this>.
bool setup_done_
 Is setup complete?
TAO_TSS_Resourcestss_resources_
 Pointer to tss resources.

Private Member Functions

 POA_Current_Impl (const POA_Current_Impl &)
void operator= (const POA_Current_Impl &)

Friends

class ::TAO_Root_POA

Detailed Description

Implementation of the PortableServer::Current object.

Objects of this class hold state information regarding the current POA invocation. Savvy readers will notice that this contains substantially more methods than the POA spec shows; they exist because the ORB either (a) needs them or (b) finds them useful for implementing a more efficient ORB. The intent is that instances of this class are held in Thread-Specific Storage so that upcalls can get context information regarding their invocation. The POA itself must insure that all <set_*> operations are performed in the execution thread so that the proper <TAO_POA_Current> pointer is obtained from TSS.

Definition at line 66 of file POA_Current_Impl.h.


Constructor & Destructor Documentation

TAO::Portable_Server::POA_Current_Impl::POA_Current_Impl ( void   ) 

Convenience constructor combining construction & initialization.

Definition at line 24 of file POA_Current_Impl.cpp.

00025       : poa_ (0),
00026         object_id_ (TAO_POA_OBJECT_ID_BUF_SIZE, 0, object_id_buf_),
00027         object_key_ (0),
00028         servant_ (0),
00029         priority_ (TAO_INVALID_PRIORITY),
00030         previous_current_impl_ (0),
00031         setup_done_ (false)
00032     {
00033     }

TAO::Portable_Server::POA_Current_Impl::POA_Current_Impl ( const POA_Current_Impl  )  [private]


Member Function Documentation

PortableServer::ObjectId * TAO::Portable_Server::POA_Current_Impl::get_object_id ( void   ) 

Return pointer to the object id through which this was invoked. This may be necessary in cases where a <Servant> is serving under the guise of multiple object ids.

Definition at line 77 of file POA_Current_Impl.cpp.

References ACE_NEW_RETURN.

Referenced by TAO::Portable_Server::POA_Current::get_object_id(), and TAO::Portable_Server::RequestProcessingStrategyDefaultServant::servant_to_id().

00078     {
00079       PortableServer::ObjectId *objid = 0;
00080 
00081       // Create a new one and pass it back
00082       ACE_NEW_RETURN (objid,
00083                       PortableServer::ObjectId (this->object_id_),
00084                       0);
00085       return objid;
00086     }

PortableServer::POA_ptr TAO::Portable_Server::POA_Current_Impl::get_POA ( void   ) 

Return pointer to the invoking POA. Raises the <CORBA::NoContext> exception.

Definition at line 71 of file POA_Current_Impl.cpp.

Referenced by TAO::Portable_Server::POA_Current::get_POA().

00072     {
00073       return PortableServer::POA::_duplicate (this->poa_);
00074     }

CORBA::Object_ptr TAO::Portable_Server::POA_Current_Impl::get_reference ( void   ) 

This operation returns a locally manufactured reference to the object in the context of which it is called.

Definition at line 89 of file POA_Current_Impl.cpp.

References TAO_Root_POA::id_to_reference(), and poa_.

Referenced by TAO::Portable_Server::POA_Current::get_reference().

00090     {
00091       return this->poa_->id_to_reference (this->object_id_);
00092     }

PortableServer::Servant TAO::Portable_Server::POA_Current_Impl::get_servant ( void   ) 

Returns a reference to the servant that hosts the object in whose context it is called.

Definition at line 95 of file POA_Current_Impl.cpp.

References servant_.

Referenced by TAO::Portable_Server::POA_Current::get_servant().

00096     {
00097       return this->servant_;
00098     }

ACE_INLINE const PortableServer::ObjectId & TAO::Portable_Server::POA_Current_Impl::object_id ( void   )  const

Get the object ID.

Definition at line 47 of file POA_Current_Impl.inl.

References object_id_.

00048     {
00049       return this->object_id_;
00050     }

ACE_INLINE void TAO::Portable_Server::POA_Current_Impl::object_id ( const PortableServer::ObjectId id  ) 

Set the object ID.

Definition at line 26 of file POA_Current_Impl.inl.

References ACE_OS::memcpy(), object_id_, and object_id_buf_.

Referenced by TAO::Portable_Server::ServantRetentionStrategyRetain::find_servant(), TAO::Portable_Server::RequestProcessingStrategyServantLocator::locate_servant(), and TAO::Portable_Server::RequestProcessingStrategyServantActivator::locate_servant().

00027     {
00028       if (this->object_id_.release () ||
00029           this->object_id_.get_buffer() == this->object_id_buf_)
00030         {
00031           // Resize the current object_id_.  If it is less than the
00032           // length of the current buffer, no allocation will take place.
00033           size_t id_size = id.length ();
00034           this->object_id_.length (id_size);
00035 
00036           // Get the buffer and copy the new object id in it's place.
00037           ACE_OS::memcpy (this->object_id_.get_buffer (),
00038                           id.get_buffer (), id_size);
00039         }
00040       else
00041         {
00042           this->object_id_ = id;
00043         }
00044     }

ACE_INLINE const TAO::ObjectKey & TAO::Portable_Server::POA_Current_Impl::object_key ( void   )  const

Get the object key.

Definition at line 71 of file POA_Current_Impl.inl.

References object_key_.

00072     {
00073       return *this->object_key_;
00074     }

ACE_INLINE void TAO::Portable_Server::POA_Current_Impl::object_key ( const TAO::ObjectKey &  key  ) 

Set the object key.

Definition at line 65 of file POA_Current_Impl.inl.

References object_key_.

Referenced by TAO_ServantBase::_create_stub().

00066     {
00067       this->object_key_ = &key;
00068     }

void TAO::Portable_Server::POA_Current_Impl::operator= ( const POA_Current_Impl  )  [private]

TAO_ORB_Core & TAO::Portable_Server::POA_Current_Impl::orb_core ( void   )  const

ORB Core for this current.

Definition at line 101 of file POA_Current_Impl.cpp.

References TAO_Root_POA::orb_core(), and poa_.

Referenced by TAO_ServantBase::_create_stub(), and TAO_Root_POA::check_for_valid_wait_for_completions().

00103     {
00104       return this->poa_->orb_core ();
00105     }

ACE_INLINE::TAO_Root_POA * TAO::Portable_Server::POA_Current_Impl::poa ( void   )  const

Get the POA implemantation.

Definition at line 20 of file POA_Current_Impl.inl.

References poa_.

00021     {
00022       return this->poa_;
00023     }

ACE_INLINE void TAO::Portable_Server::POA_Current_Impl::poa ( ::TAO_Root_POA  ) 

Set the POA implementation.

Definition at line 14 of file POA_Current_Impl.inl.

References poa_.

Referenced by TAO_ServantBase::_create_stub().

00015     {
00016       this->poa_ = p;
00017     }

POA_Current_Impl * TAO::Portable_Server::POA_Current_Impl::previous ( void   )  const

Return the previous current implementation.

Definition at line 55 of file POA_Current_Impl.cpp.

References previous_current_impl_.

00056     {
00057       return this->previous_current_impl_;
00058     }

ACE_INLINE CORBA::Short TAO::Portable_Server::POA_Current_Impl::priority ( void   )  const

Get the priority for the current upcall.

Definition at line 95 of file POA_Current_Impl.inl.

References priority_.

00096     {
00097       return this->priority_;
00098     }

ACE_INLINE void TAO::Portable_Server::POA_Current_Impl::priority ( CORBA::Short  priority  ) 

Set the priority for the current upcall.

Definition at line 89 of file POA_Current_Impl.inl.

References priority_.

Referenced by TAO_ServantBase::_create_stub(), and TAO::Portable_Server::Servant_Upcall::priority().

00090     {
00091       this->priority_ = priority;
00092     }

ACE_INLINE void TAO::Portable_Server::POA_Current_Impl::replace_object_id ( const PortableServer::ObjectId system_id  ) 

Just replace the object id smartly.

Definition at line 53 of file POA_Current_Impl.inl.

References object_id_.

Referenced by TAO::Portable_Server::ServantRetentionStrategyNonRetain::find_servant().

00055     {
00056       // This has the effect of replacing the underlying buffer
00057       // with that of another object id without copying.
00058       object_id_.replace (system_id.maximum (),
00059                           system_id.length (),
00060                           const_cast <CORBA::Octet *> (system_id.get_buffer ()),
00061                           0);
00062     }

ACE_INLINE PortableServer::Servant TAO::Portable_Server::POA_Current_Impl::servant ( void   )  const

Get the servant for the current upcall.

Definition at line 83 of file POA_Current_Impl.inl.

References servant_.

Referenced by servant().

00084     {
00085       return this->servant_;
00086     }

ACE_INLINE void TAO::Portable_Server::POA_Current_Impl::servant ( PortableServer::Servant  servant  ) 

Set the servant for the current upcall.

Definition at line 77 of file POA_Current_Impl.inl.

References servant(), and servant_.

Referenced by TAO_ServantBase::_create_stub(), TAO::Portable_Server::Servant_Upcall::prepare_for_upcall_i(), and TAO::Portable_Server::RequestProcessingStrategyDefaultServant::servant_to_id().

00078     {
00079       this->servant_ = servant;
00080     }

void TAO::Portable_Server::POA_Current_Impl::setup ( ::TAO_Root_POA impl,
const TAO::ObjectKey &  key 
)

Setup the current.

Definition at line 36 of file POA_Current_Impl.cpp.

References TAO_TSS_Resources::instance(), object_key_, poa_, TAO_TSS_Resources::poa_current_impl_, previous_current_impl_, setup_done_, and tss_resources_.

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

00037     {
00038       // Remember information about this upcall.
00039       this->poa_ = p;
00040       this->object_key_ = &key;
00041 
00042       // Set the current context and remember the old one.
00043       this->tss_resources_ = TAO_TSS_Resources::instance ();
00044 
00045       this->previous_current_impl_ =
00046         static_cast <POA_Current_Impl *>
00047                          (this->tss_resources_->poa_current_impl_);
00048       this->tss_resources_->poa_current_impl_ = this;
00049 
00050       // Setup is complete.
00051       this->setup_done_ = true;
00052     }

void TAO::Portable_Server::POA_Current_Impl::teardown ( void   ) 

Teardown the current for this request.

Definition at line 61 of file POA_Current_Impl.cpp.

References TAO_TSS_Resources::poa_current_impl_, previous_current_impl_, and tss_resources_.

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

00062     {
00063       if (this->setup_done_)
00064         {
00065           // Reset the old context.
00066           this->tss_resources_->poa_current_impl_ = this->previous_current_impl_;
00067         }
00068     }


Friends And Related Function Documentation

friend class ::TAO_Root_POA [friend]

Definition at line 69 of file POA_Current_Impl.h.


Member Data Documentation

PortableServer::ObjectId TAO::Portable_Server::POA_Current_Impl::object_id_ [protected]

The object ID of the current context. This is the user id and not the id the goes into the IOR. Note also that unlike the <object_key>, this field is stored by value.

Definition at line 161 of file POA_Current_Impl.h.

Referenced by object_id(), and replace_object_id().

CORBA::Octet TAO::Portable_Server::POA_Current_Impl::object_id_buf_[TAO_POA_OBJECT_ID_BUF_SIZE] [protected]

In order to avoid memory allocations, we will populate the object id with this buffer.

Definition at line 154 of file POA_Current_Impl.h.

Referenced by object_id().

const TAO::ObjectKey* TAO::Portable_Server::POA_Current_Impl::object_key_ [protected]

The object key of the current context.

Definition at line 164 of file POA_Current_Impl.h.

Referenced by object_key(), and setup().

::TAO_Root_POA* TAO::Portable_Server::POA_Current_Impl::poa_ [protected]

The POA implementation invoking an upcall.

Definition at line 150 of file POA_Current_Impl.h.

Referenced by get_reference(), orb_core(), poa(), and setup().

POA_Current_Impl* TAO::Portable_Server::POA_Current_Impl::previous_current_impl_ [protected]

Current previous from <this>.

Definition at line 173 of file POA_Current_Impl.h.

Referenced by TAO_Root_POA::check_for_valid_wait_for_completions(), previous(), setup(), and teardown().

CORBA::Short TAO::Portable_Server::POA_Current_Impl::priority_ [protected]

The priority for the current upcall.

Definition at line 170 of file POA_Current_Impl.h.

Referenced by priority().

PortableServer::Servant TAO::Portable_Server::POA_Current_Impl::servant_ [protected]

The servant for the current upcall.

Definition at line 167 of file POA_Current_Impl.h.

Referenced by get_servant(), and servant().

bool TAO::Portable_Server::POA_Current_Impl::setup_done_ [protected]

Is setup complete?

Definition at line 176 of file POA_Current_Impl.h.

Referenced by setup().

TAO_TSS_Resources* TAO::Portable_Server::POA_Current_Impl::tss_resources_ [protected]

Pointer to tss resources.

Definition at line 179 of file POA_Current_Impl.h.

Referenced by setup(), and teardown().


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