#include <Hash_Naming_Context.h>
Inheritance diagram for TAO_Hash_Naming_Context:
Public Member Functions | |
TAO_Hash_Naming_Context (PortableServer::POA_ptr poa, const char *poa_id) | |
Constructor. | |
void | interface (TAO_Naming_Context *i) |
Set our pointer. | |
virtual | ~TAO_Hash_Naming_Context (void) |
Destructor. | |
TAO_Naming_Context * | interface (void) |
Get the pointer to our . | |
int | root (void) |
int | destroyed (void) |
virtual void | bind (const CosNaming::Name &n, CORBA::Object_ptr obj ACE_ENV_ARG_DECL) |
virtual void | rebind (const CosNaming::Name &n, CORBA::Object_ptr obj ACE_ENV_ARG_DECL) |
virtual void | bind_context (const CosNaming::Name &n, CosNaming::NamingContext_ptr nc ACE_ENV_ARG_DECL) |
virtual void | rebind_context (const CosNaming::Name &n, CosNaming::NamingContext_ptr nc ACE_ENV_ARG_DECL) |
virtual CORBA::Object_ptr | resolve (const CosNaming::Name &n ACE_ENV_ARG_DECL) |
virtual void | unbind (const CosNaming::Name &n ACE_ENV_ARG_DECL) |
virtual CosNaming::NamingContext_ptr | bind_new_context (const CosNaming::Name &n ACE_ENV_ARG_DECL) |
virtual void | destroy (ACE_ENV_SINGLE_ARG_DECL) |
virtual PortableServer::POA_ptr | _default_POA (void) |
Returns the Default POA of this Servant object. | |
Protected Member Functions | |
CosNaming::NamingContext_ptr | get_context (const CosNaming::Name &name ACE_ENV_ARG_DECL) |
Protected Attributes | |
TAO_Bindings_Map * | context_ |
TAO_Naming_Context * | interface_ |
TAO_SYNCH_RECURSIVE_MUTEX | lock_ |
Lock used to serialize access to the underlying data structure. | |
int | destroyed_ |
PortableServer::POA_var | poa_ |
POA we are registered with. | |
ACE_CString | poa_id_ |
This class contains 'algorithm' code that is common to two hash-table-based implementations of the NamingContext: TAO_Transient_Naming_Context and TAO_Persistent_Naming_Context. To help achieve this 'templatization', we use the abstract base class TAO_Bindings_Map, which provides a common interface to the data structures used in TAO_Persistent_Namng_Context and TAO_Transient_Naming_Context.
Definition at line 116 of file Hash_Naming_Context.h.
|
Constructor.
Definition at line 35 of file Hash_Naming_Context.cpp.
00037 : context_ (0), 00038 interface_ (0), 00039 destroyed_ (0), 00040 poa_ (PortableServer::POA::_duplicate (poa)), 00041 poa_id_ (poa_id) 00042 { 00043 } |
|
Destructor.
Definition at line 51 of file Hash_Naming_Context.cpp.
00052 { 00053 delete context_; 00054 } |
|
Returns the Default POA of this Servant object.
Implements TAO_Naming_Context_Impl. Definition at line 57 of file Hash_Naming_Context.cpp. Referenced by TAO_Storable_Naming_Context::destroy(), and destroy().
00058 {
00059 return PortableServer::POA::_duplicate (this->poa_.in ());
00060 }
|
|
Create a binding for name and object in the naming context. Compound names are treated as follows: ctx->bind (<c1; c2; c3; cn>, obj) = (ctx->resolve (<c1; c2; cn-1>))->bind (, obj) if the there already exists a binding for the specified name, exception is thrown. Naming contexts should be bound using and in order to participate in name resolution later. Implements TAO_Naming_Context_Impl. Reimplemented in TAO_Storable_Naming_Context. Definition at line 119 of file Hash_Naming_Context.cpp. References ACE_CATCH, ACE_CHECK, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_GUARD_THROW_EX, ACE_THROW, ACE_TRY, ACE_TRY_CHECK, ACE_TRY_THROW, TAO_Bindings_Map::bind(), get_context(), and TAO_SYNCH_RECURSIVE_MUTEX.
00122 { 00123 ACE_GUARD_THROW_EX (TAO_SYNCH_RECURSIVE_MUTEX, 00124 ace_mon, this->lock_, 00125 CORBA::INTERNAL ()); 00126 ACE_CHECK; 00127 00128 // Check to make sure this object didn't have <destroy> method 00129 // invoked on it. 00130 if (this->destroyed_) 00131 ACE_THROW (CORBA::OBJECT_NOT_EXIST ()); 00132 00133 // Get the length of the name. 00134 CORBA::ULong name_len = n.length (); 00135 00136 // Check for invalid name. 00137 if (name_len == 0) 00138 ACE_THROW (CosNaming::NamingContext::InvalidName()); 00139 00140 // If we received compound name, resolve it to get the context in 00141 // which the binding should take place, then perform the binding on 00142 // target context. 00143 if (name_len > 1) 00144 { 00145 CosNaming::NamingContext_var context = 00146 this->get_context (n ACE_ENV_ARG_PARAMETER); 00147 ACE_CHECK; 00148 00149 CosNaming::Name simple_name; 00150 simple_name.length (1); 00151 simple_name[0] = n[name_len - 1]; 00152 ACE_TRY 00153 { 00154 context->bind (simple_name, obj ACE_ENV_ARG_PARAMETER); 00155 ACE_TRY_CHECK; 00156 } 00157 ACE_CATCH (CORBA::TIMEOUT, timeoutEx) 00158 { 00159 ACE_TRY_THROW (CosNaming::NamingContext::CannotProceed 00160 (context.in (), simple_name)); 00161 } 00162 ACE_ENDTRY; 00163 } 00164 // If we received a simple name, we need to bind it in this context. 00165 else 00166 { 00167 // Try binding the name. 00168 int result = this->context_->bind (n[0].id, 00169 n[0].kind, 00170 obj, 00171 CosNaming::nobject); 00172 if (result == 1) 00173 ACE_THROW (CosNaming::NamingContext::AlreadyBound()); 00174 00175 // Something went wrong with the internal structure 00176 else if (result == -1) 00177 ACE_THROW (CORBA::INTERNAL ()); 00178 } 00179 } |
|
This is the version of specifically for binding naming contexts, so that they will participate in name resolution when compound names are passed to be resolved. Implements TAO_Naming_Context_Impl. Reimplemented in TAO_Storable_Naming_Context. Definition at line 247 of file Hash_Naming_Context.cpp. References ACE_CATCH, ACE_CHECK, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_GUARD_THROW_EX, ACE_THROW, ACE_TRY, ACE_TRY_CHECK, ACE_TRY_THROW, TAO_Bindings_Map::bind(), get_context(), CORBA::is_nil(), and TAO_SYNCH_RECURSIVE_MUTEX. Referenced by bind_new_context().
00250 { 00251 ACE_GUARD_THROW_EX (TAO_SYNCH_RECURSIVE_MUTEX, ace_mon, 00252 this->lock_, 00253 CORBA::INTERNAL ()); 00254 ACE_CHECK; 00255 00256 // Check to make sure this object didn't have <destroy> method 00257 // invoked on it. 00258 if (this->destroyed_) 00259 ACE_THROW (CORBA::OBJECT_NOT_EXIST ()); 00260 00261 // Do not allow binding of nil context reference. 00262 if (CORBA::is_nil (nc)) 00263 ACE_THROW (CORBA::BAD_PARAM ()); 00264 00265 // Get the length of the name. 00266 CORBA::ULong name_len = n.length (); 00267 00268 // Check for invalid name. 00269 if (name_len == 0) 00270 ACE_THROW (CosNaming::NamingContext::InvalidName()); 00271 00272 // If we received compound name, resolve it to get the context in 00273 // which the binding should take place, then perform the binding on 00274 // target context. 00275 if (name_len > 1) 00276 { 00277 CosNaming::NamingContext_var context = 00278 get_context (n ACE_ENV_ARG_PARAMETER); 00279 ACE_CHECK; 00280 00281 CosNaming::Name simple_name; 00282 simple_name.length (1); 00283 simple_name[0] = n[name_len - 1]; 00284 ACE_TRY 00285 { 00286 context->bind_context (simple_name, nc ACE_ENV_ARG_PARAMETER); 00287 ACE_TRY_CHECK; 00288 } 00289 ACE_CATCH (CORBA::TIMEOUT, timeoutEx) 00290 { 00291 ACE_TRY_THROW (CosNaming::NamingContext::CannotProceed 00292 (context.in (), simple_name)); 00293 } 00294 ACE_ENDTRY; 00295 } 00296 // If we received a simple name, we need to bind it in this context. 00297 else 00298 { 00299 // Try binding the name. 00300 int result = this->context_->bind (n[0].id, 00301 n[0].kind, 00302 nc, 00303 CosNaming::ncontext); 00304 if (result == 1) 00305 ACE_THROW (CosNaming::NamingContext::AlreadyBound()); 00306 00307 // Something went wrong with the internal structure 00308 else if (result == -1) 00309 ACE_THROW (CORBA::INTERNAL ()); 00310 } 00311 } |
|
This operation creates a new context and binds it to the name supplied as an argument. The newly-created context is implemented by the same server as the context in which it was bound (the name argument excluding the last component). Implements TAO_Naming_Context_Impl. Reimplemented in TAO_Storable_Naming_Context. Definition at line 537 of file Hash_Naming_Context.cpp. References ACE_CATCHANY, ACE_CHECK_RETURN, ACE_DECLARE_NEW_CORBA_ENV, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_GUARD_THROW_EX, ACE_RE_THROW, ACE_THROW_RETURN, ACE_TRY, ACE_TRY_CHECK, ACE_TRY_CHECK_EX, ACE_TRY_EX, bind_context(), get_context(), TAO_Naming_Context_Impl::new_context(), and TAO_SYNCH_RECURSIVE_MUTEX.
00539 { 00540 ACE_GUARD_THROW_EX (TAO_SYNCH_RECURSIVE_MUTEX, 00541 ace_mon, 00542 this->lock_, 00543 CORBA::INTERNAL ()); 00544 ACE_CHECK_RETURN (CosNaming::NamingContext::_nil ()); 00545 00546 // Check to make sure this object didn't have <destroy> method 00547 // invoked on it. 00548 if (this->destroyed_) 00549 ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (), 00550 CosNaming::NamingContext::_nil ()); 00551 00552 // Get the length of the name. 00553 CORBA::ULong name_len = n.length (); 00554 00555 // Check for invalid name. 00556 if (name_len == 0) 00557 ACE_THROW_RETURN (CosNaming::NamingContext::InvalidName(), 00558 CosNaming::NamingContext::_nil ()); 00559 00560 // If we received compound name, resolve it to get the context in 00561 // which the binding should take place, then perform the operation on 00562 // target context. 00563 if (name_len > 1) 00564 { 00565 CosNaming::NamingContext_var context = 00566 get_context (n ACE_ENV_ARG_PARAMETER); 00567 ACE_CHECK_RETURN (CosNaming::NamingContext::_nil ()); 00568 00569 CosNaming::Name simple_name; 00570 simple_name.length (1); 00571 simple_name[0] = n[name_len - 1]; 00572 return context->bind_new_context (simple_name ACE_ENV_ARG_PARAMETER); 00573 } 00574 00575 // If we received a simple name, we need to bind it in this context. 00576 00577 // Stores our new Naming Context. 00578 CosNaming::NamingContext_var result = 00579 CosNaming::NamingContext::_nil (); 00580 00581 // Create new context. 00582 result = new_context (ACE_ENV_SINGLE_ARG_PARAMETER); 00583 ACE_CHECK_RETURN (CosNaming::NamingContext::_nil ()); 00584 00585 // Bind the new context to the name. 00586 ACE_TRY 00587 { 00588 bind_context (n, 00589 result.in () 00590 ACE_ENV_ARG_PARAMETER); 00591 ACE_TRY_CHECK; 00592 } 00593 ACE_CATCHANY 00594 { 00595 // If the bind() operation fails we must destroy the recently 00596 // created context, should any exceptions be raised by the 00597 // destroy() operation we want to ignore them. 00598 { 00599 ACE_DECLARE_NEW_CORBA_ENV; 00600 ACE_TRY_EX(DESTROY) 00601 { 00602 result->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); 00603 ACE_TRY_CHECK_EX(DESTROY); 00604 } 00605 ACE_CATCHANY 00606 { 00607 } 00608 ACE_ENDTRY; 00609 } 00610 // Re-raise the exception in bind_context() 00611 ACE_RE_THROW; 00612 } 00613 ACE_ENDTRY; 00614 ACE_CHECK_RETURN (CosNaming::NamingContext::_nil ()); 00615 return result._retn (); 00616 } |
|
Delete the naming context. The user should take care to any bindings in which the given context is bound to some names, to avoid dangling references when invoking operation. NOTE: is a no-op on the root context. NOTE: after is invoked on a Naming Context, all BindingIterators associated with that Naming Context are also destroyed. Implements TAO_Naming_Context_Impl. Reimplemented in TAO_Storable_Naming_Context. Definition at line 619 of file Hash_Naming_Context.cpp. References _default_POA(), ACE_CHECK, ACE_ENV_ARG_PARAMETER, ACE_GUARD_THROW_EX, ACE_THROW, TAO_Bindings_Map::current_size(), poa_id_, root(), and TAO_SYNCH_RECURSIVE_MUTEX.
00620 { 00621 ACE_GUARD_THROW_EX (TAO_SYNCH_RECURSIVE_MUTEX, 00622 ace_mon, 00623 this->lock_, 00624 CORBA::INTERNAL ()); 00625 ACE_CHECK; 00626 00627 // Check to make sure this object didn't have <destroy> method 00628 // invoked on it. 00629 if (this->destroyed_) 00630 ACE_THROW (CORBA::OBJECT_NOT_EXIST ()); 00631 00632 if (this->context_->current_size () != 0) 00633 ACE_THROW (CosNaming::NamingContext::NotEmpty()); 00634 00635 // Destroy is a no-op on a root context. 00636 if (root ()) 00637 return; 00638 00639 else 00640 { 00641 this->destroyed_ = 2; 00642 00643 // Remove self from POA. Because of reference counting, the POA 00644 // will automatically delete the servant when all pending requests 00645 // on this servant are complete. 00646 00647 PortableServer::POA_var poa = 00648 this->_default_POA (); 00649 00650 PortableServer::ObjectId_var id = 00651 PortableServer::string_to_ObjectId (poa_id_.fast_rep ()); 00652 00653 ACE_CHECK; 00654 00655 poa->deactivate_object (id.in () 00656 ACE_ENV_ARG_PARAMETER); 00657 ACE_CHECK; 00658 } 00659 } |
|
Returns true if this context had operation invoked on it, and false otherwise. Definition at line 669 of file Hash_Naming_Context.cpp.
00670 { 00671 return this->destroyed_; 00672 } |
|
is used by methods that need to resolve a compound name before performing the actual operation (e.g., bind, unbind, etc.) takes a full name (including the last component that doesn't need to be resolved), and returns a pointer to the target context. Definition at line 63 of file Hash_Naming_Context.cpp. References ACE_CATCH, ACE_CHECK_RETURN, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_RE_THROW, ACE_THROW_RETURN, ACE_TRY, ACE_TRY_CHECK, CORBA::is_nil(), and resolve(). Referenced by TAO_Storable_Naming_Context::bind(), bind(), TAO_Storable_Naming_Context::bind_context(), bind_context(), TAO_Storable_Naming_Context::bind_new_context(), bind_new_context(), TAO_Storable_Naming_Context::rebind(), rebind(), TAO_Storable_Naming_Context::rebind_context(), rebind_context(), TAO_Storable_Naming_Context::unbind(), and unbind().
00065 { 00066 // Naming context we will return. 00067 CosNaming::NamingContext_var result = 00068 CosNaming::NamingContext::_nil (); 00069 00070 // Create compound name to be resolved, i.e., 00071 // (<name> - last component). To avoid copying, we can just reuse 00072 // <name>'s buffer, since we will not be modifying it. 00073 CORBA::ULong name_len = name.length (); 00074 CosNaming::Name comp_name (name.maximum (), 00075 name_len - 1, 00076 const_cast<CosNaming::NameComponent*> (name.get_buffer ())); 00077 ACE_TRY 00078 { 00079 // Resolve the name. 00080 CORBA::Object_var context = resolve (comp_name 00081 ACE_ENV_ARG_PARAMETER); 00082 ACE_TRY_CHECK; 00083 00084 // Try narrowing object reference to the NamingContext type. 00085 result = CosNaming::NamingContext::_narrow (context.in () 00086 ACE_ENV_ARG_PARAMETER); 00087 ACE_TRY_CHECK; 00088 } 00089 ACE_CATCH (CosNaming::NamingContext::NotFound, ex) 00090 { 00091 // Add the last component of the name, which was stripped before 00092 // the call to resolve. 00093 CORBA::ULong rest_len = ex.rest_of_name.length () + 1; 00094 ex.rest_of_name.length (rest_len); 00095 ex.rest_of_name[rest_len - 1] = name[name_len - 1]; 00096 00097 ACE_RE_THROW; 00098 } 00099 ACE_ENDTRY; 00100 ACE_CHECK_RETURN (CosNaming::NamingContext::_nil ()); 00101 00102 if (CORBA::is_nil (result.in ())) 00103 { 00104 CosNaming::Name rest; 00105 rest.length (2); 00106 rest[0] = name[name_len - 2]; 00107 rest[1] = name[name_len - 1]; 00108 ACE_THROW_RETURN (CosNaming::NamingContext::NotFound 00109 (CosNaming::NamingContext::not_context, 00110 rest), 00111 CosNaming::NamingContext::_nil ()); 00112 } 00113 // Finally, if everything went smoothly, just return the resolved 00114 // context. 00115 return result._retn (); 00116 } |
|
Get the pointer to our .
Definition at line 675 of file Hash_Naming_Context.cpp. References interface_.
00676 { 00677 return this->interface_; 00678 } |
|
Set our pointer.
Definition at line 46 of file Hash_Naming_Context.cpp. References interface_. Referenced by TAO_Bindings_Iterator< ITERATOR, TABLE_ENTRY >::~TAO_Bindings_Iterator().
00047 { 00048 this->interface_ = i; 00049 } |
|
This is similar to operation above, except for when the binding for the specified name already exists in the specified context. In that case, the existing binding is replaced with the new one. Implements TAO_Naming_Context_Impl. Reimplemented in TAO_Storable_Naming_Context. Definition at line 182 of file Hash_Naming_Context.cpp. References ACE_CATCH, ACE_CHECK, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_GUARD_THROW_EX, ACE_THROW, ACE_TRY, ACE_TRY_CHECK, ACE_TRY_THROW, get_context(), TAO_Bindings_Map::rebind(), and TAO_SYNCH_RECURSIVE_MUTEX.
00185 { 00186 ACE_GUARD_THROW_EX (TAO_SYNCH_RECURSIVE_MUTEX, ace_mon, 00187 this->lock_, 00188 CORBA::INTERNAL ()); 00189 ACE_CHECK; 00190 00191 // Check to make sure this object didn't have <destroy> method 00192 // invoked on it. 00193 if (this->destroyed_) 00194 ACE_THROW (CORBA::OBJECT_NOT_EXIST ()); 00195 00196 // Get the length of the name. 00197 CORBA::ULong name_len = n.length (); 00198 00199 // Check for invalid name. 00200 if (name_len == 0) 00201 ACE_THROW (CosNaming::NamingContext::InvalidName()); 00202 00203 // If we received compound name, resolve it to get the context in 00204 // which the rebinding should take place, then perform the rebinding 00205 // on target context. 00206 if (name_len > 1) 00207 { 00208 CosNaming::NamingContext_var context = 00209 get_context (n ACE_ENV_ARG_PARAMETER); 00210 ACE_CHECK; 00211 00212 CosNaming::Name simple_name; 00213 simple_name.length (1); 00214 simple_name[0] = n[name_len - 1]; 00215 ACE_TRY 00216 { 00217 context->rebind (simple_name, obj ACE_ENV_ARG_PARAMETER); 00218 ACE_TRY_CHECK; 00219 } 00220 ACE_CATCH (CORBA::TIMEOUT, timeoutEx) 00221 { 00222 ACE_TRY_THROW (CosNaming::NamingContext::CannotProceed 00223 (context.in (), simple_name)); 00224 } 00225 ACE_ENDTRY; 00226 } 00227 else 00228 // If we received a simple name, we need to rebind it in this 00229 // context. 00230 { 00231 int result = this->context_->rebind (n[0].id, 00232 n[0].kind, 00233 obj, 00234 CosNaming::nobject); 00235 // Check for error conditions. 00236 if (result == -1) 00237 ACE_THROW (CORBA::INTERNAL ()); 00238 00239 else if (result == -2) 00240 ACE_THROW (CosNaming::NamingContext::NotFound 00241 (CosNaming::NamingContext::not_object, 00242 n)); 00243 } 00244 } |
|
This is a version of specifically for naming contexts, so that they can participate in name resolution when compound names are passed. Implements TAO_Naming_Context_Impl. Reimplemented in TAO_Storable_Naming_Context. Definition at line 314 of file Hash_Naming_Context.cpp. References ACE_CATCH, ACE_CHECK, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_GUARD_THROW_EX, ACE_THROW, ACE_TRY, ACE_TRY_CHECK, ACE_TRY_THROW, get_context(), TAO_Bindings_Map::rebind(), and TAO_SYNCH_RECURSIVE_MUTEX.
00317 { 00318 ACE_GUARD_THROW_EX (TAO_SYNCH_RECURSIVE_MUTEX, ace_mon, 00319 this->lock_, 00320 CORBA::INTERNAL ()); 00321 ACE_CHECK; 00322 00323 // Check to make sure this object didn't have <destroy> method 00324 // invoked on it. 00325 if (this->destroyed_) 00326 ACE_THROW (CORBA::OBJECT_NOT_EXIST ()); 00327 00328 // Get the length of the name. 00329 CORBA::ULong name_len = n.length (); 00330 00331 // Check for invalid name. 00332 if (name_len == 0) 00333 ACE_THROW (CosNaming::NamingContext::InvalidName()); 00334 00335 // If we received compound name, resolve it to get the context in 00336 // which the rebinding should take place, then perform the rebinding 00337 // on target context. 00338 if (name_len > 1) 00339 { 00340 CosNaming::NamingContext_var context = 00341 get_context (n ACE_ENV_ARG_PARAMETER); 00342 ACE_CHECK; 00343 00344 CosNaming::Name simple_name; 00345 simple_name.length (1); 00346 simple_name[0] = n[name_len - 1]; 00347 ACE_TRY 00348 { 00349 context->rebind_context (simple_name, nc ACE_ENV_ARG_PARAMETER); 00350 ACE_TRY_CHECK; 00351 } 00352 ACE_CATCH (CORBA::TIMEOUT, timeoutEx) 00353 { 00354 ACE_TRY_THROW (CosNaming::NamingContext::CannotProceed 00355 (context.in (), simple_name)); 00356 } 00357 ACE_ENDTRY; 00358 } 00359 else 00360 // If we received a simple name, we need to rebind it in this 00361 // context. 00362 { 00363 int result = this->context_->rebind (n[0].id, 00364 n[0].kind, 00365 nc, 00366 CosNaming::ncontext); 00367 // Check for error conditions. 00368 if (result == -1) 00369 ACE_THROW (CORBA::INTERNAL ()); 00370 00371 else if (result == -2) 00372 ACE_THROW (CosNaming::NamingContext::NotFound 00373 (CosNaming::NamingContext::not_context, 00374 n)); 00375 } 00376 } |
|
Return object reference that is bound to the name. Compound name resolve is defined as follows: ctx->resolve (<c1; c2; cn>) = ctx->resolve (<c1; c2 cn-1>)->resolve () The naming service does not return the type of the object. Clients are responsible for "narrowing" the object to the appropriate type. Implements TAO_Naming_Context_Impl. Reimplemented in TAO_Storable_Naming_Context. Definition at line 379 of file Hash_Naming_Context.cpp. References ACE_CATCH, ACE_CHECK_RETURN, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_GUARD_THROW_EX, ACE_THROW_RETURN, ACE_TRY, ACE_TRY_CHECK, ACE_TRY_THROW, TAO_Bindings_Map::find(), CORBA::is_nil(), and TAO_SYNCH_RECURSIVE_MUTEX. Referenced by get_context().
00381 { 00382 ACE_GUARD_THROW_EX (TAO_SYNCH_RECURSIVE_MUTEX, ace_mon, this->lock_, 00383 CORBA::INTERNAL ()); 00384 ACE_CHECK_RETURN (CORBA::Object::_nil ()); 00385 00386 // Check to make sure this object didn't have <destroy> method 00387 // invoked on it. 00388 if (this->destroyed_) 00389 ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (), 00390 CORBA::Object::_nil ()); 00391 00392 // Get the length of the name. 00393 CORBA::ULong name_len = n.length (); 00394 00395 // Check for invalid name. 00396 if (name_len == 0) 00397 ACE_THROW_RETURN (CosNaming::NamingContext::InvalidName(), 00398 CORBA::Object::_nil ()); 00399 00400 // Resolve the first component of the name. 00401 00402 // Stores the binding type for the first name component. 00403 CosNaming::BindingType type; 00404 00405 // Stores the object reference bound to the first name component. 00406 CORBA::Object_var result; 00407 00408 if (this->context_->find (n[0].id, 00409 n[0].kind, 00410 result.out (), 00411 type) == -1) 00412 ACE_THROW_RETURN (CosNaming::NamingContext::NotFound 00413 (CosNaming::NamingContext::missing_node, 00414 n), 00415 CORBA::Object::_nil ()); 00416 00417 // If the name we have to resolve is a compound name, we need to 00418 // resolve it recursively. 00419 if (name_len > 1) 00420 { 00421 CosNaming::NamingContext_var context = 00422 CosNaming::NamingContext::_nil (); 00423 00424 if (type == CosNaming::ncontext) 00425 { 00426 // Narrow to NamingContext. 00427 context = CosNaming::NamingContext::_narrow (result.in () 00428 ACE_ENV_ARG_PARAMETER); 00429 ACE_CHECK_RETURN (CORBA::Object::_nil ()); 00430 } 00431 else 00432 // The first name component wasn't bound to a NamingContext. 00433 ACE_THROW_RETURN (CosNaming::NamingContext::NotFound 00434 (CosNaming::NamingContext::not_context, 00435 n), 00436 CORBA::Object::_nil ()); 00437 00438 // If narrow failed... 00439 if (CORBA::is_nil (context.in ())) 00440 ACE_THROW_RETURN (CosNaming::NamingContext::NotFound 00441 (CosNaming::NamingContext::not_context, 00442 n), 00443 CORBA::Object::_nil ()); 00444 else 00445 { 00446 // Successfully resolved the first name component, need to 00447 // recursively call resolve on <n> without the first component. 00448 00449 // We need a name just like <n> but without the first 00450 // component. Instead of copying data we can reuse <n>'s 00451 // buffer since we will only be using it for 'in' parameters 00452 // (no modifications). 00453 CosNaming::Name rest_of_name 00454 (n.maximum () - 1, 00455 n.length () - 1, 00456 const_cast<CosNaming::NameComponent*> (n.get_buffer ()) 00457 + 1); 00458 00459 // If there are any exceptions, they will propagate up. 00460 ACE_TRY 00461 { 00462 CORBA::Object_ptr resolved_ref; 00463 resolved_ref = context->resolve (rest_of_name 00464 ACE_ENV_ARG_PARAMETER); 00465 ACE_TRY_CHECK; 00466 return resolved_ref; 00467 } 00468 ACE_CATCH (CORBA::TIMEOUT, timeoutEx) 00469 { 00470 ACE_TRY_THROW (CosNaming::NamingContext::CannotProceed 00471 (context.in (), rest_of_name)); 00472 } 00473 ACE_ENDTRY; 00474 } 00475 } 00476 // If the name we had to resolve was simple, we just need to return 00477 // the result. 00478 return result._retn (); 00479 } |
|
Returns true if this Naming Context is a root Naming Context for the server, and false otherwise. Definition at line 662 of file Hash_Naming_Context.cpp. References ACE_OS::strcmp(), and TAO_ROOT_NAMING_CONTEXT. Referenced by TAO_Storable_Naming_Context::destroy(), and destroy().
00663 { 00664 return (ACE_OS::strcmp (this->poa_id_.fast_rep (), 00665 TAO_ROOT_NAMING_CONTEXT) == 0); 00666 } |
|
Remove the name binding from the context. When compound names are used, unbind is defined as follows: ctx->unbind (<c1; c2; cn>) = (ctx->resolve (<c1; c2; cn-1>))->unbind () Implements TAO_Naming_Context_Impl. Reimplemented in TAO_Storable_Naming_Context. Definition at line 482 of file Hash_Naming_Context.cpp. References ACE_CATCH, ACE_CHECK, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_GUARD_THROW_EX, ACE_THROW, ACE_TRY, ACE_TRY_CHECK, ACE_TRY_THROW, get_context(), TAO_SYNCH_RECURSIVE_MUTEX, and TAO_Bindings_Map::unbind().
00484 { 00485 ACE_GUARD_THROW_EX (TAO_SYNCH_RECURSIVE_MUTEX, ace_mon, 00486 this->lock_, 00487 CORBA::INTERNAL ()); 00488 ACE_CHECK; 00489 00490 // Check to make sure this object didn't have <destroy> method 00491 // invoked on it. 00492 if (this->destroyed_) 00493 ACE_THROW (CORBA::OBJECT_NOT_EXIST ()); 00494 00495 // Get the length of the name. 00496 CORBA::ULong name_len = n.length (); 00497 00498 // Check for invalid name. 00499 if (name_len == 0) 00500 ACE_THROW (CosNaming::NamingContext::InvalidName()); 00501 00502 // If we received compound name, resolve it to get the context in 00503 // which the unbinding should take place, then perform the unbinding 00504 // on target context. 00505 if (name_len > 1) 00506 { 00507 CosNaming::NamingContext_var context = 00508 get_context (n ACE_ENV_ARG_PARAMETER); 00509 ACE_CHECK; 00510 00511 CosNaming::Name simple_name; 00512 simple_name.length (1); 00513 simple_name[0] = n[name_len - 1]; 00514 ACE_TRY 00515 { 00516 context->unbind (simple_name ACE_ENV_ARG_PARAMETER); 00517 ACE_TRY_CHECK; 00518 } 00519 ACE_CATCH (CORBA::TIMEOUT, timeoutEx) 00520 { 00521 ACE_TRY_THROW (CosNaming::NamingContext::CannotProceed 00522 (context.in (), simple_name)); 00523 } 00524 ACE_ENDTRY; 00525 } 00526 // If we received a simple name, we need to unbind it in this 00527 // context. 00528 else 00529 if (this->context_->unbind (n[0].id, 00530 n[0].kind) == -1) 00531 ACE_THROW (CosNaming::NamingContext::NotFound 00532 (CosNaming::NamingContext::missing_node, 00533 n)); 00534 } |
|
Pointer to the data structure used to store this Naming Context's bindings. is initialized with a concrete data structure by subclasses, which know which data structure to use. Definition at line 244 of file Hash_Naming_Context.h. Referenced by TAO_Storable_Naming_Context::new_context(), and TAO_Storable_Naming_Context::recreate_all(). |
|
Flag indicating whether this Naming Context is no longer valid. This flag is necessary because immediate destruction might not be possible if there are pending requests on this servant in the POA. Definition at line 263 of file Hash_Naming_Context.h. |
|
Pointer to the object for which we serve as a , i.e., the object that delegates to us all client CosNaming::NamingContext CORBA calls. We need this pointer for reference counting. Definition at line 252 of file Hash_Naming_Context.h. Referenced by interface(). |
|
Lock used to serialize access to the underlying data structure.
Definition at line 255 of file Hash_Naming_Context.h. |
|
POA we are registered with.
Reimplemented in TAO_Storable_Naming_Context. Definition at line 266 of file Hash_Naming_Context.h. |
|
ID with which we are registered with . Note, if is equivalent to TAO_ROOT_NAMING_CONTEXT, then this Naming Context is the root Naming Context for the server, i.e., it is un<destroy>able. Definition at line 273 of file Hash_Naming_Context.h. Referenced by destroy(). |