Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

TAO_Adapter_Registry Class Reference

#include <Adapter.h>

Collaboration diagram for TAO_Adapter_Registry:

Collaboration graph
[legend]
List of all members.

Public Methods

 TAO_Adapter_Registry (TAO_ORB_Core *orb_core)
 ~TAO_Adapter_Registry (void)
 Close the. More...

void close (int wait_for_completion ACE_ENV_ARG_DECL) throw ()
void check_close (int wait_for_completion ACE_ENV_ARG_DECL) throw ()
void insert (TAO_Adapter *adapter ACE_ENV_ARG_DECL)
 Insert a new adapter into the registry. More...

void dispatch (TAO_ObjectKey &key, TAO_ServerRequest &request, CORBA::Object_out forward_to ACE_ENV_ARG_DECL) throw (CORBA::SystemException)
CORBA::Object_ptr create_collocated_object (TAO_Stub *, const TAO_MProfile &)
 Create a collocated object using the given profile and stub. More...

TAO_Adapterfind_adapter (const char *name) const
 Fetch the adapter named <name>. More...


Private Attributes

TAO_ORB_Coreorb_core_
 The ORB Core. More...

size_t adapters_capacity_
 A simple array of adapters. More...

size_t adapters_count_
TAO_Adapter ** adapters_

Constructor & Destructor Documentation

TAO_Adapter_Registry::TAO_Adapter_Registry TAO_ORB_Core   orb_core
 

Definition at line 27 of file Adapter.cpp.

References ACE_NEW.

00028   : orb_core_ (oc)
00029   , adapters_capacity_ (16) // @@ Make it configurable
00030   , adapters_count_ (0)
00031   , adapters_ (0)
00032 {
00033   ACE_NEW (this->adapters_,
00034            TAO_Adapter*[this->adapters_capacity_]);
00035 }

TAO_Adapter_Registry::~TAO_Adapter_Registry void   
 

Close the.

Definition at line 37 of file Adapter.cpp.

References adapters_, and adapters_count_.

00038 {
00039   for (size_t i = 0; i != this->adapters_count_; ++i)
00040     {
00041       delete this->adapters_[i];
00042     }
00043 
00044   delete[] this->adapters_;
00045 }


Member Function Documentation

void TAO_Adapter_Registry::check_close int wait_for_completion    ACE_ENV_ARG_DECL throw ()
 

Verify if the close() call can be invoked in the current context for *all* adapters. Raise the right exception if not.

Definition at line 74 of file Adapter.cpp.

References ACE_CATCHALL, ACE_DEBUG, ACE_ENDTRY, ACE_ENV_ARG_DECL, ACE_ENV_ARG_PARAMETER, ACE_LIB_TEXT, ACE_TRY, ACE_TRY_CHECK, and LM_DEBUG.

00077 {
00078   ACE_TRY
00079     {
00080       for (size_t i = 0; i != this->adapters_count_; ++i)
00081         {
00082           this->adapters_[i]->check_close (wait_for_completion
00083                                            ACE_ENV_ARG_PARAMETER);
00084           ACE_TRY_CHECK;
00085         }
00086     }
00087   ACE_CATCHALL
00088     {
00089       if (TAO_debug_level > 3)
00090         ACE_DEBUG ((LM_DEBUG,
00091                     ACE_LIB_TEXT ("(%P|%t) Exception in TAO_Adapter_Registry::check_close () \n")));
00092       return;
00093     }
00094   ACE_ENDTRY;
00095 
00096   return;
00097 }

void TAO_Adapter_Registry::close int wait_for_completion    ACE_ENV_ARG_DECL throw ()
 

Close each of of the Adapters and then cleanup the Registry. It is possible that an Adapter will reject a close() call if it is invoked in an innapropriate context (think shutting down the POA while performing an upcall).

Definition at line 48 of file Adapter.cpp.

References ACE_ANY_EXCEPTION, ACE_CATCHANY, ACE_ENDTRY, ACE_ENV_ARG_DECL, ACE_ENV_ARG_PARAMETER, ACE_PRINT_EXCEPTION, ACE_TRY, and ACE_TRY_CHECK.

00051 {
00052   ACE_TRY
00053     {
00054       for (size_t i = 0; i != this->adapters_count_; ++i)
00055         {
00056           this->adapters_[i]->close (wait_for_completion
00057                                      ACE_ENV_ARG_PARAMETER);
00058           ACE_TRY_CHECK;
00059         }
00060     }
00061   ACE_CATCHANY
00062     {
00063       if (TAO_debug_level > 3)
00064         ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
00065                              "Exception in TAO_Adapter_Registry::close () \n");
00066       return;
00067     }
00068   ACE_ENDTRY;
00069 
00070   return;
00071 }

CORBA::Object_ptr TAO_Adapter_Registry::create_collocated_object TAO_Stub  ,
const TAO_MProfile  
 

Create a collocated object using the given profile and stub.

Definition at line 164 of file Adapter.cpp.

References adapters_, adapters_count_, and TAO_Adapter::create_collocated_object.

Referenced by TAO_ORB_Core::create_collocated_object.

00166 {
00167   for (size_t i = 0; i != this->adapters_count_; ++i)
00168     {
00169       CORBA::Object_ptr x =
00170         this->adapters_[i]->create_collocated_object (stub,
00171                                                       mprofile);
00172       if (x != 0)
00173         return x;
00174     }
00175   return 0;
00176 }

void TAO_Adapter_Registry::dispatch TAO_ObjectKey   key,
TAO_ServerRequest   request,
CORBA::Object_out forward_to    ACE_ENV_ARG_DECL
throw (CORBA::SystemException)
 

Dispatch the request to all the adapters. It tries the adapters ordered by priority, stopping when the adapter returns a status different from DS_MISMATCHED_KEY

Definition at line 137 of file Adapter.cpp.

References ACE_CHECK, ACE_ENV_ARG_DECL, ACE_ENV_ARG_PARAMETER, ACE_THROW, TAO_Adapter::DS_MISMATCHED_KEY, and CORBA::is_nil.

00142 {
00143   for (size_t i = 0; i != this->adapters_count_; ++i)
00144     {
00145       int r = this->adapters_[i]->dispatch (key,
00146                                             request,
00147                                             forward_to
00148                                              ACE_ENV_ARG_PARAMETER);
00149       ACE_CHECK;
00150 
00151       if (r != TAO_Adapter::DS_MISMATCHED_KEY)
00152         {
00153           return;
00154         }
00155     }
00156 
00157   if (CORBA::is_nil (forward_to))
00158     {
00159       ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
00160     }
00161 }

TAO_Adapter * TAO_Adapter_Registry::find_adapter const char *    name const
 

Fetch the adapter named <name>.

Definition at line 179 of file Adapter.cpp.

References adapters_, adapters_count_, and ACE_OS_String::strcmp.

Referenced by TAO_ORB_Core::poa_adapter.

00180 {
00181   for (TAO_Adapter **i = this->adapters_;
00182        i != this->adapters_ + this->adapters_count_;
00183        ++i)
00184     {
00185       if (ACE_OS::strcmp ((*i)->name (), name) == 0)
00186         return *i;
00187     }
00188   return 0;
00189 
00190 }

void TAO_Adapter_Registry::insert TAO_Adapter *adapter    ACE_ENV_ARG_DECL
 

Insert a new adapter into the registry.

Definition at line 99 of file Adapter.cpp.

References ACE_CHECK, ACE_ENV_ARG_DECL, ACE_NEW_THROW_EX, adapters_, adapters_capacity_, adapters_count_, and TAO_Adapter::priority.

Referenced by TAO_ORB_Core::resolve_ior_table_i, and TAO_ORB_Core::root_poa.

00101 {
00102   if (this->adapters_capacity_ == this->adapters_count_)
00103     {
00104       this->adapters_capacity_ *= 2;
00105       TAO_Adapter **tmp;
00106       ACE_NEW_THROW_EX (tmp,
00107                         TAO_Adapter*[this->adapters_capacity_],
00108                         CORBA::NO_MEMORY ());
00109       ACE_CHECK;
00110 
00111       for (size_t i = 0; i != this->adapters_count_; ++i)
00112         tmp[i] = this->adapters_[i];
00113       delete[] this->adapters_;
00114       this->adapters_ = tmp;
00115     }
00116 
00117   int priority = adapter->priority ();
00118   for (size_t i = 0; i != this->adapters_count_; ++i)
00119     {
00120       if (this->adapters_[i]->priority () >= priority)
00121         {
00122           for (size_t j = this->adapters_count_ + 1;
00123                j > i;
00124                --j)
00125             {
00126               this->adapters_[j] = this->adapters_[j - 1];
00127             }
00128           this->adapters_[i] = adapter;
00129           this->adapters_count_++;
00130           return;
00131         }
00132     }
00133   this->adapters_[this->adapters_count_++] = adapter;
00134 }


Member Data Documentation

TAO_Adapter** TAO_Adapter_Registry::adapters_ [private]
 

Definition at line 163 of file Adapter.h.

Referenced by create_collocated_object, find_adapter, insert, and ~TAO_Adapter_Registry.

size_t TAO_Adapter_Registry::adapters_capacity_ [private]
 

A simple array of adapters.

Definition at line 161 of file Adapter.h.

Referenced by insert.

size_t TAO_Adapter_Registry::adapters_count_ [private]
 

Definition at line 162 of file Adapter.h.

Referenced by create_collocated_object, find_adapter, insert, and ~TAO_Adapter_Registry.

TAO_ORB_Core* TAO_Adapter_Registry::orb_core_ [private]
 

The ORB Core.

Definition at line 158 of file Adapter.h.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 15:03:14 2003 for TAO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002