TAO_Table_Adapter Class Reference

#include <Table_Adapter.h>

Inheritance diagram for TAO_Table_Adapter:

Inheritance graph
[legend]
Collaboration diagram for TAO_Table_Adapter:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_Table_Adapter (TAO_ORB_Core *orb_core)
 Constructor.

virtual ~TAO_Table_Adapter (void)
 Destructor.

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 foward_to) throw (CORBA::SystemException)
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 *)

Private Member Functions

CORBA::Long find_object (TAO::ObjectKey &key, CORBA::Object_out forward_to) throw (CORBA::SystemException)

Private Attributes

TAO_ORB_Core *const  orb_core_
 The ORB Core we belong to.

TAO_IOR_Table_Implroot_
 The table implementation.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_Table_Adapter::TAO_Table_Adapter TAO_ORB_Core orb_core  ) 
 

Constructor.

Definition at line 24 of file Table_Adapter.cpp.

00025   :  orb_core_ (orb_core)
00026   ,  root_ (0)
00027 {
00028 }

TAO_Table_Adapter::~TAO_Table_Adapter void   )  [virtual]
 

Destructor.

Definition at line 30 of file Table_Adapter.cpp.

00031 {
00032   ::CORBA::release (this->root_);
00033 }


Member Function Documentation

void TAO_Table_Adapter::check_close int  wait_for_completion  )  [virtual]
 

Implements TAO_Adapter.

Definition at line 52 of file Table_Adapter.cpp.

00053 {
00054 }

void TAO_Table_Adapter::close int  wait_for_completion  )  [virtual]
 

Implements TAO_Adapter.

Definition at line 45 of file Table_Adapter.cpp.

00046 {
00047   ::CORBA::release (this->root_);
00048   this->root_ = 0;
00049 }

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

Implements TAO_Adapter.

Definition at line 86 of file Table_Adapter.cpp.

References CORBA::Object::_nil(), ACE_NEW_RETURN, and initialize_collocated_object().

00088 {
00089   CORBA::Object_ptr result = CORBA::Object::_nil ();
00090 
00091   if (! this->initialize_collocated_object (stub)) // 0 == success
00092     {
00093       // A reference was found in the table. The stub has been forwarded
00094       // to this. The collocation indicators are now correct on the stub
00095       // (although they may well now indicate that the stub is not in fact
00096       // collocated at all).
00097       ACE_NEW_RETURN (result,
00098                       CORBA::Object (stub,
00099                                      stub->is_collocated (),
00100                                      stub->collocated_servant ()),
00101                       CORBA::Object::_nil ());
00102 
00103     }
00104 
00105   return result;
00106 }

int TAO_Table_Adapter::dispatch TAO::ObjectKey key,
TAO_ServerRequest request,
CORBA::Object_out  foward_to
throw (CORBA::SystemException) [virtual]
 

Implements TAO_Adapter.

Definition at line 63 of file Table_Adapter.cpp.

00068 {
00069   return this->find_object (key, forward_to) ? TAO_Adapter::DS_FORWARD
00070                                              : TAO_Adapter::DS_MISMATCHED_KEY;
00071 }

CORBA::Long TAO_Table_Adapter::find_object TAO::ObjectKey key,
CORBA::Object_out  forward_to
throw (CORBA::SystemException) [private]
 

Helper method to find an object bound in the table.

Returns:
1 if found, 0 otherwise.

Definition at line 144 of file Table_Adapter.cpp.

References ACE_CATCH, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_TRY, ACE_TRY_CHECK, and TAO::ObjectKey::encode_sequence_to_string().

Referenced by initialize_collocated_object().

00148 {
00149   CORBA::String_var object_key;
00150   TAO::ObjectKey::encode_sequence_to_string (object_key.out (),
00151                                             key);
00152   ACE_TRY
00153     {
00154       CORBA::String_var ior =
00155         this->root_->find (object_key.in () ACE_ENV_ARG_PARAMETER);
00156       ACE_TRY_CHECK;
00157 
00158       forward_to =
00159         this->orb_core_->orb ()->string_to_object (ior.in ()
00160                                                    ACE_ENV_ARG_PARAMETER);
00161       ACE_TRY_CHECK;
00162     }
00163   ACE_CATCH (IORTable::NotFound, nf_ex)
00164     {
00165       return 0;
00166     }
00167   ACE_ENDTRY;
00168   return 1;
00169 }

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

Implements TAO_Adapter.

Definition at line 109 of file Table_Adapter.cpp.

References TAO_Profile::_key(), CORBA::Object::_nil(), ACE_CATCHANY, ACE_ENDTRY, ACE_TRY_NEW_ENV, TAO_Stub::add_forward_profiles(), TAO_Stub::base_profiles(), find_object(), TAO_Stub::forward_profiles(), TAO_MProfile::get_profile(), TAO_Stub::next_profile(), and TAO_PHandle.

Referenced by create_collocated_object().

00110 {
00111   // Get the effective profile set.
00112   const TAO_MProfile &mp = stub->forward_profiles () ? *(stub->forward_profiles ())
00113                                                      : stub->base_profiles ();
00114   TAO_PHandle j = 0;
00115   // We only look at the key from the 0th profile but we only really care about
00116   // corbaloc's here where all profiles share a single object key
00117   TAO::ObjectKey_var key = mp.get_profile (j)->_key ();
00118 
00119   CORBA::Object_var forward_to = CORBA::Object::_nil ();
00120   CORBA::Boolean found = false;
00121 
00122   ACE_TRY_NEW_ENV
00123     {
00124       found = this->find_object (key, forward_to.out ());
00125     }
00126   ACE_CATCHANY
00127     {
00128     }
00129   ACE_ENDTRY;
00130 
00131   if (found)
00132     {
00133       // This call will set the appropriate collocation values
00134       // to correspond to the reference we found in the table.
00135       stub->add_forward_profiles (forward_to->_stubobj ()->base_profiles ());
00136       stub->next_profile ();
00137     }
00138 
00139   // 0 for success
00140   return ! found;
00141 }

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

Implements TAO_Adapter.

Definition at line 74 of file Table_Adapter.cpp.

00075 {
00076   return "IORTable";
00077 }

void TAO_Table_Adapter::open  )  [virtual]
 

Implements TAO_Adapter.

Definition at line 36 of file Table_Adapter.cpp.

References ACE_CHECK, and ACE_NEW_THROW_EX.

00037 {
00038   ACE_NEW_THROW_EX (this->root_,
00039                     TAO_IOR_Table_Impl (),
00040                     CORBA::NO_MEMORY ());
00041   ACE_CHECK;
00042 }

int TAO_Table_Adapter::priority void   )  const [virtual]
 

Implements TAO_Adapter.

Definition at line 57 of file Table_Adapter.cpp.

00058 {
00059   return 16; // @@
00060 }

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

Implements TAO_Adapter.

Definition at line 80 of file Table_Adapter.cpp.

References CORBA::Object::_duplicate().

00081 {
00082   return CORBA::Object::_duplicate (this->root_);
00083 }


Member Data Documentation

TAO_ORB_Core* const TAO_Table_Adapter::orb_core_ [private]
 

The ORB Core we belong to.

Definition at line 69 of file Table_Adapter.h.

TAO_IOR_Table_Impl* TAO_Table_Adapter::root_ [private]
 

The table implementation.

Definition at line 72 of file Table_Adapter.h.


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 13:07:17 2006 for TAO_IORTable by doxygen 1.3.6