summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Naming
diff options
context:
space:
mode:
authornobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-10-14 05:31:07 +0000
committernobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-10-14 05:31:07 +0000
commit78a4b9ed4b3f9d5533e058722b6ae51c7aa51f1e (patch)
tree7edd744393baa971ad33c2b642d1a0249cd8848c /TAO/orbsvcs/orbsvcs/Naming
parentaf62d68095ddb3b0334a8a6d7ef55f1709808028 (diff)
downloadATCD-78a4b9ed4b3f9d5533e058722b6ae51c7aa51f1e.tar.gz
This commit was manufactured by cvs2svn to create tag 'ACE-4_5_53'.ACE-4_5_53
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/Naming')
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.cpp884
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.h232
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Entries.cpp110
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Entries.h104
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp269
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.h135
6 files changed, 0 insertions, 1734 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.cpp b/TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.cpp
deleted file mode 100644
index 05a056bd0ec..00000000000
--- a/TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.cpp
+++ /dev/null
@@ -1,884 +0,0 @@
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// cos
-//
-// = FILENAME
-// CosNaming_i.cpp
-//
-// = AUTHOR
-// Marina Spivak <marina@cs.wustl.edu> and
-// Sergio Flores-Gaitan <sergio@cs.wustl.edu>
-//
-// ============================================================================
-
-#include "CosNaming_i.h"
-
-ACE_RCSID(Naming, CosNaming_i, "$Id$")
-
-TAO_NamingContext::TAO_NamingContext (PortableServer::POA_ptr poa,
- const char *poa_id,
- size_t default_hash_table_size,
- int root)
- : context_ (default_hash_table_size),
- root_ (root),
- lock_ (0),
- poa_ (PortableServer::POA::_duplicate (poa)),
- counter_ (0),
- hash_table_size_ (default_hash_table_size),
- poa_id_ (poa_id)
-{
- // Get the lock from the ORB, which knows what type is appropriate.
- // This method must be called AFTER the ORB has been initialized via
- // <CORBA::ORB_init> since otherwise <TAO_ORB_Core_instance> won't
- // work correctly...
- ACE_ALLOCATOR (this->lock_,
- TAO_ORB_Core_instance ()->server_factory ()->create_servant_lock ());
-}
-
-TAO_NamingContext::~TAO_NamingContext (void)
-{
- delete this->lock_;
-}
-
-// Return the Default POA of this Servant
-
-PortableServer::POA_ptr
-TAO_NamingContext::_default_POA (CORBA::Environment &/*env*/)
-{
- return PortableServer::POA::_duplicate (this->poa_.in ());
-}
-
-CosNaming::NamingContext_ptr
-TAO_NamingContext::get_context (const CosNaming::Name &name,
- CORBA::Environment &_env)
-{
- // The naming context we will return.
- CosNaming::NamingContext_var result =
- CosNaming::NamingContext::_nil ();
-
- // Create compound name to be resolved (<name> - last component).
- // To avoid copying (and thus memory allocations), we can just reuse
- // <name>'s buffer, since we will not be modifying it.
- CORBA::ULong len = name.length ();
- CosNaming::Name comp_name (name.maximum (),
- len - 1,
- ACE_const_cast
- (CosNaming::NameComponent*,
- name.get_buffer ()));
- TAO_TRY
- {
- // Resolve the name.
- CORBA::Object_var context = resolve (comp_name,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- // @@ There may be a check for context being nil needed.
-
- // Try narrowing object reference to a context type.
- result = CosNaming::NamingContext::_narrow (context.in (),
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
- }
- TAO_CATCH (CosNaming::NamingContext::NotFound, ex)
- {
- // Add the last component of the name, which was stripped before
- // the call to resolve.
- CORBA::ULong rest_len = ex.rest_of_name.length ();
- ex.rest_of_name.length (rest_len + 1);
- ex.rest_of_name[rest_len] = name[len - 1];
-
- if (ex.why == CosNaming::NamingContext::not_object)
- ex.why = CosNaming::NamingContext::missing_node;
-
- TAO_RETHROW_RETURN (result._retn ());
- }
- TAO_CATCHANY
- {
- TAO_RETHROW_RETURN (result._retn ());
- }
- TAO_ENDTRY;
- // This has to be outside the TRY block, othewise we'll catch our
- // own exception.
- if (CORBA::is_nil (result.in ()))
- {
- CosNaming::Name rest;
- rest.length (2);
- rest[0] = name[len - 2];
- rest[1] = name[len - 1];
- TAO_THROW_RETURN (CosNaming::NamingContext::NotFound (CosNaming::NamingContext::not_context,
- rest),
- result._retn());
- }
- // Finally, if everything went smoothly, just return the resolved
- // context.
- return result._retn ();
-}
-
-void
-TAO_NamingContext::bind (const CosNaming::Name& n,
- CORBA::Object_ptr obj,
- CORBA::Environment &_env)
-{
- ACE_GUARD_THROW (ACE_Lock, ace_mon, *this->lock_, CORBA::INTERNAL (CORBA::COMPLETED_NO));
-
- // Get the length of the name.
- CORBA::ULong len = n.length ();
-
- // Check for invalid name.
- if (len == 0)
- TAO_THROW (CosNaming::NamingContext::InvalidName());
-
- // If we received compound name, resolve it to get the context in
- // which the binding should take place, then perform the binding on
- // target context.
- if (len > 1)
- {
- TAO_TRY
- {
- CosNaming::NamingContext_var context =
- this->get_context (n, TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- CosNaming::Name simple_name;
- simple_name.length (1);
- simple_name[0] = n[len - 1];
- context->bind (simple_name, obj, TAO_TRY_ENV);
- TAO_CHECK_ENV;
- }
- TAO_CATCHANY
- {
- TAO_RETHROW;
- }
- TAO_ENDTRY;
- }
- // If we received a simple name, we need to bind it in this context.
- else
- {
- TAO_IntId entry (obj, CosNaming::nobject);
- TAO_ExtId name (n[0].id, n[0].kind);
-
- // Try binding the name.
- int result = this->context_.bind (name, entry);
- if (result == 1)
- TAO_THROW (CosNaming::NamingContext::AlreadyBound());
-
- // Something went wrong with the internal structure
- else if (result == -1)
- TAO_THROW (CORBA::INTERNAL (CORBA::COMPLETED_NO));
- }
-}
-
-void
-TAO_NamingContext::rebind (const CosNaming::Name& n,
- CORBA::Object_ptr obj,
- CORBA::Environment &_env)
-{
- ACE_GUARD_THROW (ACE_Lock, ace_mon, *this->lock_, CORBA::INTERNAL (CORBA::COMPLETED_NO));
-
- // Get the length of the name.
- CORBA::ULong len = n.length ();
-
- // Check for invalid name.
- if (len == 0)
- TAO_THROW (CosNaming::NamingContext::InvalidName());
-
- // If we received compound name, resolve it to get the context in
- // which the rebinding should take place, then perform the rebinding
- // on target context.
- if (len > 1)
- {
- TAO_TRY
- {
- CosNaming::NamingContext_var context =
- get_context (n, TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- CosNaming::Name simple_name;
- simple_name.length (1);
- simple_name[0] = n[len - 1];
- context->rebind (simple_name, obj, TAO_TRY_ENV);
- TAO_CHECK_ENV;
- }
- TAO_CATCHANY
- {
- TAO_RETHROW;
- }
- TAO_ENDTRY;
- }
- else
- {
- // If we received a simple name, we need to rebind it in this
- // context.
-
- TAO_IntId entry (obj, CosNaming::nobject);
- TAO_ExtId name (n[0].id, n[0].kind);
- TAO_IntId oldentry;
- TAO_ExtId oldname;
-
- // Try rebinding the name.
- int result = this->context_.rebind (name,
- entry,
- oldname,
- oldentry);
- // Something went wrong with the internal structure
- if (result == -1)
- TAO_THROW (CORBA::INTERNAL (CORBA::COMPLETED_NO));
- }
-}
-
-void
-TAO_NamingContext::bind_context (const CosNaming::Name &n,
- CosNaming::NamingContext_ptr nc,
- CORBA::Environment &_env)
-{
- ACE_GUARD_THROW (ACE_Lock, ace_mon, *this->lock_, CORBA::INTERNAL (CORBA::COMPLETED_NO));
-
- // Get the length of the name.
- CORBA::ULong len = n.length ();
-
- // Check for invalid name.
- if (len == 0)
- TAO_THROW (CosNaming::NamingContext::InvalidName());
-
- // If we received compound name, resolve it to get the context in
- // which the binding should take place, then perform the binding on
- // target context.
- if (len > 1)
- {
- TAO_TRY
- {
- CosNaming::NamingContext_var context =
- get_context (n, TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- CosNaming::Name simple_name;
- simple_name.length (1);
- simple_name[0] = n[len - 1];
- context->bind_context (simple_name, nc, TAO_TRY_ENV);
- TAO_CHECK_ENV;
- }
- TAO_CATCHANY
- {
- TAO_RETHROW;
- }
- TAO_ENDTRY;
- }
- // If we received a simple name, we need to bind it in this context.
- else
- {
- TAO_IntId entry (nc, CosNaming::ncontext);
- TAO_ExtId name (n[0].id, n[0].kind);
-
- // Try binding the name.
- int result = this->context_.bind (name, entry);
- if (result == 1)
- TAO_THROW (CosNaming::NamingContext::AlreadyBound());
-
- // Something went wrong with the internal structure
- else if (result == -1)
- TAO_THROW (CORBA::INTERNAL (CORBA::COMPLETED_NO));
- }
-}
-
-void
-TAO_NamingContext::rebind_context (const CosNaming::Name &n,
- CosNaming::NamingContext_ptr nc,
- CORBA::Environment &_env)
-{
- ACE_GUARD_THROW (ACE_Lock, ace_mon, *this->lock_, CORBA::INTERNAL (CORBA::COMPLETED_NO));
-
- // Get the length of the name.
- CORBA::ULong len = n.length ();
-
- // Check for invalid name.
- if (len == 0)
- TAO_THROW (CosNaming::NamingContext::InvalidName());
-
- // If we received compound name, resolve it to get the context in
- // which the rebinding should take place, then perform the rebinding
- // on target context.
- if (len > 1)
- {
- TAO_TRY
- {
- CosNaming::NamingContext_var context =
- get_context (n, TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- CosNaming::Name simple_name;
- simple_name.length (1);
- simple_name[0] = n[len - 1];
- context->rebind_context (simple_name, nc, TAO_TRY_ENV);
- TAO_CHECK_ENV;
- }
- TAO_CATCHANY
- {
- TAO_RETHROW;
- }
- TAO_ENDTRY;
- }
- // If we received a simple name, we need to rebind it in this
- // context.
- else
- {
- TAO_IntId entry (nc, CosNaming::ncontext);
- TAO_ExtId name (n[0].id, n[0].kind);
- TAO_IntId oldentry;
- TAO_ExtId oldname;
-
- // Try rebinding the name.
- if (this->context_.rebind (name,
- entry,
- oldname,
- oldentry) < 0)
- TAO_THROW (CORBA::INTERNAL (CORBA::COMPLETED_NO));
- }
-}
-
-CORBA::Object_ptr
-TAO_NamingContext::resolve (const CosNaming::Name& n,
- CORBA::Environment &_env)
-{
- CORBA::Object_ptr result = CORBA::Object::_nil ();
- ACE_GUARD_THROW_RETURN (ACE_Lock, ace_mon, *this->lock_,
- CORBA::INTERNAL (CORBA::COMPLETED_NO),
- result);
-
- // Get the length of the name.
- CORBA::ULong len = n.length ();
-
- // Check for invalid name.
- if (len == 0)
- TAO_THROW_RETURN (CosNaming::NamingContext::InvalidName(),
- result);
-
- // Resolve the first component of the name.
- TAO_ExtId name (n[0].id, n[0].kind);
- TAO_IntId entry;
-
- if (this->context_.find (name,
- entry) == -1)
- TAO_THROW_RETURN (CosNaming::NamingContext::NotFound
- (CosNaming::NamingContext::not_object,
- n),
- result);
- result = entry.ref_;
-
- //@@ Once TAO_TRY_THROW is implemented, the whole if (len > 1) can be put in a try block
- //with rethrow in CATCHANY.
-
- // If the name we have to resolve is a compound name we need to
- // recursively resolve it.
- if (len > 1)
- {
- CosNaming::NamingContext_var context =
- CosNaming::NamingContext::_nil ();
- if (entry.type_ == CosNaming::ncontext)
- {
- TAO_TRY
- {
- context = CosNaming::NamingContext::_narrow (result,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
- }
- TAO_CATCHANY
- {
- TAO_RETHROW_RETURN (context._retn ());
- }
- TAO_ENDTRY;
- }
- else
- TAO_THROW_RETURN (CosNaming::NamingContext::NotFound (CosNaming::NamingContext::not_context,
- n),
- context._retn ());
- if (CORBA::is_nil (context.in ()))
- TAO_THROW_RETURN (CosNaming::NamingContext::NotFound (CosNaming::NamingContext::not_context,
- n),
- context._retn ());
- else
- {
- // Recursively call resolve on <n> without the first component.
-
- // We need a name just like <n> but without the first
- // component. Instead of copying data we can reuse <n>'s
- // buffer since we will only be using it for 'in' parameters
- // (no modifications).
- CosNaming::Name rest_of_name
- (n.maximum () - 1,
- n.length () - 1,
- ACE_const_cast (CosNaming::NameComponent*,
- n.get_buffer ())
- + 1);
- // If there are any exceptions, they will propagate up.
- return context->resolve (rest_of_name,
- _env);
- }
- }
- // If the name we had to resolve was simple, we just need to return
- // the result. Since we don't want the result to be destroyed when
- // this method returns we need to duplicate it.
- return CORBA::Object::_duplicate (result);
-}
-
-void
-TAO_NamingContext::unbind (const CosNaming::Name& n,
- CORBA::Environment &_env)
-{
- ACE_GUARD_THROW (ACE_Lock, ace_mon, *this->lock_, CORBA::INTERNAL (CORBA::COMPLETED_NO));
-
- // Get the length of the name.
- CORBA::ULong len = n.length ();
-
- // Check for invalid name.
- if (len == 0)
- TAO_THROW (CosNaming::NamingContext::InvalidName());
-
- // If we received compound name, resolve it to get the context in
- // which the unbinding should take place, then perform the unbinding
- // on target context.
- if (len > 1)
- {
- TAO_TRY
- {
- CosNaming::NamingContext_var context =
- get_context (n, TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- CosNaming::Name simple_name;
- simple_name.length (1);
- simple_name[0] = n[len - 1];
- context->unbind (simple_name, TAO_TRY_ENV);
- TAO_CHECK_ENV;
- }
- TAO_CATCHANY
- {
- TAO_RETHROW;
- }
- TAO_ENDTRY;
- }
- // If we received a simple name, we need to unbind it in this
- // context.
- else
- {
- TAO_ExtId name (n[0].id, n[0].kind);
- // Try unbinding the name.
- if (this->context_.unbind (name) == -1)
- TAO_THROW (CosNaming::NamingContext::NotFound
- (CosNaming::NamingContext::not_object,
- n));
- }
-}
-
-CosNaming::NamingContext_ptr
-TAO_NamingContext::new_context (CORBA::Environment &_env)
-{
- ACE_GUARD_THROW_RETURN (ACE_Lock,
- ace_mon,
- *this->lock_,
- CORBA::INTERNAL (CORBA::COMPLETED_NO),
- CosNaming::NamingContext::_nil ());
-
- TAO_NamingContext *c = 0;
- CosNaming::NamingContext_var result;
- char poa_id[BUFSIZ];
- ACE_OS::sprintf (poa_id,
- "%s_%ld",
- this->poa_id_.c_str (),
- this->counter_++);
-
- ACE_NEW_THROW_RETURN (c,
- TAO_NamingContext (poa_.in (),
- poa_id,
- this->hash_table_size_),
- CORBA::NO_MEMORY (CORBA::COMPLETED_NO),
- result._retn ());
- TAO_TRY
- {
- PortableServer::ObjectId_var id =
- PortableServer::string_to_ObjectId (poa_id);
-
- this->poa_->activate_object_with_id (id.in (),
- c,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- result = c->_this (TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- return result._retn ();
- }
- TAO_CATCHANY
- {
- delete c;
- TAO_RETHROW_RETURN (result._retn ());
- }
- TAO_ENDTRY;
-
- return result._retn ();
-}
-
-CosNaming::NamingContext_ptr
-TAO_NamingContext::bind_new_context (const CosNaming::Name& n,
- CORBA::Environment &_env)
-{
- CosNaming::NamingContext_var result =
- CosNaming::NamingContext::_nil ();
-
- result = new_context (_env);
- TAO_CHECK_ENV_RETURN (_env, CosNaming::NamingContext::_nil ());
-
- TAO_TRY
- {
- bind_context (n,
- result.in (),
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
- }
- TAO_CATCHANY
- {
- result->destroy (_env);
- TAO_RETHROW_RETURN (CosNaming::NamingContext::_nil ());
- }
- TAO_ENDTRY;
-
- return result._retn ();
-}
-
-void
-TAO_NamingContext::destroy (CORBA::Environment &_env)
-{
- {
- ACE_GUARD_THROW (ACE_Lock,
- ace_mon,
- *this->lock_,
- CORBA::INTERNAL (CORBA::COMPLETED_NO));
-
- if (this->context_.current_size () != 0)
- TAO_THROW (CosNaming::NamingContext::NotEmpty());
-
- if (this->root_ != 0)
- return; // Destroy is a no-op on a root context.
- else
- {
- TAO_TRY
- {
- PortableServer::POA_var poa =
- this->_default_POA (TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- PortableServer::ObjectId_var id =
- poa->servant_to_id (this,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- poa->deactivate_object (id.in (),
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
- }
- TAO_CATCHANY
- {
- TAO_RETHROW;
- }
- TAO_ENDTRY;
- }
- }
-
- // Let go of the lock and commit suicide. We *must* be dynamically
- // allocated for this to work right...
- if (this->root_ == 0)
- delete this;
-}
-
-void
-TAO_NamingContext::list (CORBA::ULong how_many,
- CosNaming::BindingList_out bl,
- CosNaming::BindingIterator_out bi,
- CORBA::Environment &_env)
-{
- // Allocate nil out parameters in case we won't be able to complete
- // the operation.
- bi = CosNaming::BindingIterator::_nil ();
- ACE_NEW_THROW (bl,
- CosNaming::BindingList (0),
- CORBA::NO_MEMORY (CORBA::COMPLETED_NO));
-
- // Obtain a lock before we proceed with the operation.
- ACE_GUARD_THROW (ACE_Lock,
- ace_mon,
- *this->lock_,
- CORBA::INTERNAL (CORBA::COMPLETED_NO));
-
- // Dynamically allocate hash map iterator.
- TAO_NamingContext::HASH_MAP::ITERATOR *hash_iter = 0;
- ACE_NEW_THROW (hash_iter,
- TAO_NamingContext::HASH_MAP::ITERATOR (context_),
- CORBA::NO_MEMORY (CORBA::COMPLETED_NO));
-
- // Number of bindings that will go into the BindingList.
- CORBA::ULong n;
-
- // A pointer to BindingIterator servant.
- TAO_BindingIterator *bind_iter = 0;
-
- // Calculate number of bindings that will go into bl.
- if (this->context_.current_size () > how_many)
- n = how_many;
- else
- n = this->context_.current_size ();
-
- // Use hash iterator to populate a BindingList with bindings.
- bl->length (n);
-
- TAO_NamingContext::HASH_MAP::ENTRY *hash_entry;
-
- for (CORBA::ULong i = 0; i < n; i++)
- {
- hash_iter->next (hash_entry);
- hash_iter->advance ();
-
- if (populate_binding (hash_entry, bl[i]) == 0)
- {
- delete hash_iter;
- TAO_THROW (CORBA::NO_MEMORY(CORBA::COMPLETED_NO));
- }
- }
-
- // Now we are done with the BindingsList, and we can follow up on
- // the iterator business.
-
- // If we do not need to pass back BindingIterator.
- if (this->context_.current_size () <= how_many)
- delete hash_iter;
- else
- {
- TAO_TRY
- {
- // Create a BindingIterator for return.
- list_helper (bind_iter,
- hash_iter,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- char poa_id[BUFSIZ];
- ACE_OS::sprintf (poa_id,
- "%s_%ld",
- this->poa_id_.c_str (),
- this->counter_++);
-
- PortableServer::ObjectId_var id =
- PortableServer::string_to_ObjectId (poa_id);
-
- this->poa_->activate_object_with_id (id.in (),
- bind_iter,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- bi = bind_iter->_this (TAO_TRY_ENV);
- TAO_CHECK_ENV;
- }
- TAO_CATCHANY
- {
- delete bind_iter;
- TAO_RETHROW;
- }
- TAO_ENDTRY;
- }
-}
-
-void
-TAO_NamingContext::list_helper (TAO_BindingIterator* &bind_iter,
- TAO_NamingContext::HASH_MAP::ITERATOR *hash_iter,
- CORBA::Environment &_env)
-{
- TAO_TRY
- {
- ACE_NEW_TRY_THROW (bind_iter,
- TAO_BindingIterator (hash_iter, this->poa_.in (), this->lock_),
- CORBA::NO_MEMORY (CORBA::COMPLETED_NO));
- TAO_CHECK_ENV;
- }
- TAO_CATCHANY
- {
- delete hash_iter;
- TAO_RETHROW;
- }
- TAO_ENDTRY;
-}
-
-TAO_BindingIterator::TAO_BindingIterator (TAO_NamingContext::HASH_MAP::ITERATOR *hash_iter,
- PortableServer::POA_ptr poa,
- ACE_Lock *lock)
- : hash_iter_ (hash_iter),
- lock_ (lock),
- poa_ (PortableServer::POA::_duplicate (poa))
-
-{
-}
-
-TAO_BindingIterator::~TAO_BindingIterator (void)
-{
- delete hash_iter_;
-}
-
-// Return the Default POA of this Servant
-PortableServer::POA_ptr
-TAO_BindingIterator::_default_POA (CORBA::Environment &/*env*/)
-{
- return PortableServer::POA::_duplicate (this->poa_.in ());
-}
-
-CORBA::Boolean
-TAO_BindingIterator::next_one (CosNaming::Binding_out b,
- CORBA::Environment &_env)
-{
- CosNaming::Binding *binding;
-
- // Allocate a binding to be returned (even if there no more
- // bindings, we need to allocate an out parameter.)
- ACE_NEW_THROW_RETURN (binding,
- CosNaming::Binding,
- CORBA::NO_MEMORY (CORBA::COMPLETED_NO),
- 0);
- b = binding;
-
- ACE_GUARD_THROW_RETURN (ACE_Lock,
- ace_mon,
- *this->lock_,
- CORBA::INTERNAL (CORBA::COMPLETED_NO), 0);
- // If there are no more bindings.
- if (hash_iter_->done ())
- return 0;
- else
- {
- TAO_NamingContext::HASH_MAP::ENTRY *hash_entry;
- hash_iter_->next (hash_entry);
-
- if (TAO_NamingContext::populate_binding (hash_entry, *binding) == 0)
- TAO_THROW_RETURN (CORBA::NO_MEMORY (CORBA::COMPLETED_NO), 0);
-
- hash_iter_->advance ();
- return 1;
- }
-}
-
-int
-TAO_NamingContext::populate_binding (TAO_NamingContext::HASH_MAP::ENTRY *hash_entry,
- CosNaming::Binding &b)
-{
- b.binding_type = hash_entry->int_id_.type_;
- b.binding_name.length (1);
-
- // Here we perform a check before assignment to make sure
- // CORBA::string_dup is not called on 0 pointer, since the spec does
- // not say what should happen in that case.
- if (hash_entry->ext_id_.id_.fast_rep () != 0)
- {
- b.binding_name[0].id =
- hash_entry->ext_id_.id_.fast_rep ();
- if (b.binding_name[0].id.in () == 0)
- return 0;
- }
- if (hash_entry->ext_id_.kind_.fast_rep () != 0)
- {
- b.binding_name[0].kind =
- hash_entry->ext_id_.kind_.fast_rep ();
- if (b.binding_name[0].kind.in () == 0)
- return 0;
- }
- return 1;
-}
-
-CORBA::Boolean
-TAO_BindingIterator::next_n (CORBA::ULong how_many,
- CosNaming::BindingList_out bl,
- CORBA::Environment &_env)
-{
- // We perform an allocation before obtaining the lock so that an out
- // parameter is allocated in case we fail to obtain the lock.
- ACE_NEW_THROW_RETURN (bl,
- CosNaming::BindingList (0),
- CORBA::NO_MEMORY (CORBA::COMPLETED_NO),
- 0);
- // Obtain a lock.
- ACE_GUARD_THROW_RETURN (ACE_Lock,
- ace_mon,
- *this->lock_,
- CORBA::INTERNAL (CORBA::COMPLETED_NO),
- 0);
-
- // If there are no more bindings...
- if (hash_iter_->done ())
- return 0;
- else
- {
- // Initially assume that iterator has the requested number of
- // bindings.
- bl->length (how_many);
-
- TAO_NamingContext::HASH_MAP::ENTRY *hash_entry;
-
- // Iterate and populate the BindingList.
-
- for (CORBA::ULong i = 0; i < how_many; i++)
- {
- hash_iter_->next (hash_entry);
-
- if (TAO_NamingContext::populate_binding (hash_entry, bl[i]) == 0)
- TAO_THROW_RETURN (CORBA::NO_MEMORY (CORBA::COMPLETED_NO), 0);
-
- if (hash_iter_->advance () == 0)
- {
- // If no more bindings left, reset length to the actual
- // number of bindings populated and get out of the loop.
- bl->length (i + 1);
- break;
- }
- }
- return 1;
- }
-}
-
-void
-TAO_BindingIterator::destroy (CORBA::Environment &_env)
-{
- TAO_TRY
- {
- PortableServer::POA_var poa =
- this->_default_POA (TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- PortableServer::ObjectId_var id =
- poa->servant_to_id (this,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- poa->deactivate_object (id.in (),
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- // Commit suicide: must have been dynamically allocated
- delete this;
- }
- TAO_CATCHANY
- {
- TAO_RETHROW;
- }
- TAO_ENDTRY;
-}
-
-#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-template class ACE_Hash_Map_Manager<TAO_ExtId, TAO_IntId, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Entry<TAO_ExtId, TAO_IntId>;
-template class ACE_Hash_Map_Iterator_Base<TAO_ExtId, TAO_IntId, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Iterator<TAO_ExtId, TAO_IntId, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Reverse_Iterator<TAO_ExtId, TAO_IntId, ACE_Null_Mutex>;
-#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-#pragma instantiate ACE_Hash_Map_Manager<TAO_ExtId, TAO_IntId, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Entry<TAO_ExtId, TAO_IntId>
-#pragma instantiate ACE_Hash_Map_Iterator_Base<TAO_ExtId, TAO_IntId, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Iterator<TAO_ExtId, TAO_IntId, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Reverse_Iterator<TAO_ExtId, TAO_IntId, ACE_Null_Mutex>
-#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.h b/TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.h
deleted file mode 100644
index ce7bdca0f0f..00000000000
--- a/TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.h
+++ /dev/null
@@ -1,232 +0,0 @@
-/* -*- C++ -*- */
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// cos
-//
-// = FILENAME
-// CosNaming_i.h
-//
-// = AUTHOR
-// Marina Spivak <marina@cs.wustl.edu> and
-// Sergio Flores-Gaitan <sergio@cs.wustl.edu>
-//
-// ============================================================================
-
-#if !defined (TAO_NAMING_I_H)
-#define TAO_NAMING_I_H
-
-#include "orbsvcs/CosNamingS.h"
-#include "Entries.h"
-
-// Forward declaration.
-class TAO_BindingIterator;
-
-class TAO_ORBSVCS_Export TAO_NamingContext : public POA_CosNaming::NamingContext
-{
- // = TITLE
- // This class implements the <NamingContext> interface that is
- // part of the <CosNaming> IDL module.
- //
- // = DESCRIPTION
- // Extensive comments can be found in the Naming IDL file.
-
-public:
- typedef ACE_Hash_Map_Manager<TAO_ExtId, TAO_IntId, ACE_Null_Mutex>
- HASH_MAP;
-
- // = Initialization and termination methods.
- TAO_NamingContext (PortableServer::POA_ptr poa,
- const char *poa_id,
- size_t default_hash_table_size = ACE_DEFAULT_MAP_SIZE,
- int root = 0);
- // Default constructor, which initializes the <size> of the table,
- // and sets a root flag.
-
- ~TAO_NamingContext (void);
- // destructor.
-
- // Returns the Default POA of this Servant object
- virtual PortableServer::POA_ptr _default_POA (CORBA::Environment &env);
-
- virtual void bind (const CosNaming::Name &n,
- CORBA::Object_ptr obj,
- CORBA::Environment &IT_env);
- // Create a binding for name <n> and object <obj> in the naming
- // context. Compound names are treated as follows: ctx->bind (<c1;
- // c2; c3; cn>, obj) = (ctx->resolve (<c1; c2; cn-1>))->bind (<cn>,
- // obj) if the there already exists a binding for the specified
- // name, <AlreadyBound> exception is thrown. Naming contexts should
- // be bound using <bind_context> and <rebind_context> in order to
- // participate in name resolution later.
-
- virtual void rebind (const CosNaming::Name &n,
- CORBA::Object_ptr obj,
- CORBA::Environment &IT_env);
- // This is similar to <bind> 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.
-
- virtual void bind_context (const CosNaming::Name &n,
- CosNaming::NamingContext_ptr nc,
- CORBA::Environment &IT_env);
- // This is the version of <bind> specifically for binding naming
- // contexts, so that they will participate in name resolution when
- // compound names are passed to be resolved.
-
- virtual void rebind_context (const CosNaming::Name &n,
- CosNaming::NamingContext_ptr nc,
- CORBA::Environment &IT_env);
- // This is a version of <rebind> specifically for naming contexts,
- // so that they can participate in name resolution when compound
- // names are passed.
-
- virtual CORBA::Object_ptr resolve (const CosNaming::Name &n,
- CORBA::Environment &IT_env);
- // 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 (<cn>) The naming service
- // does not return the type of the object. Clients are responsible
- // for "narrowing" the object to the appropriate type.
-
- virtual void unbind (const CosNaming::Name &n,
- CORBA::Environment &IT_env);
- // 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 (<cn>)
-
- virtual CosNaming::NamingContext_ptr new_context (CORBA::Environment &IT_env);
- // This operation returns a new naming context implemented by the
- // same naming server in which the operation was invoked. The
- // context is not bound.
-
- virtual CosNaming::NamingContext_ptr bind_new_context (const CosNaming::Name &n,
- CORBA::Environment &IT_env);
- // 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).
-
- virtual void destroy (CORBA::Environment &IT_env);
- // Delete the naming context. NOTE: the user should <unbind> any
- // bindings in which the given context is bound to some names before
- // invoking <destroy> operation on it.
- // NOTE: this operation is a no-op on the root context.
-
- virtual void list (CORBA::ULong how_many,
- CosNaming::BindingList_out bl,
- CosNaming::BindingIterator_out bi,
- CORBA::Environment &IT_env);
- // Returns at most the requested number of bindings <how_many> in
- // <bl>. If the naming context contains additional bindings, they
- // are returned with a BindingIterator. In the naming context does
- // not contain any additional bindings <bi> returned as null.
-
- static int populate_binding (TAO_NamingContext::HASH_MAP::ENTRY *hash_entry,
- CosNaming::Binding &b);
- // Helper function used by TAO_NamingContext and
- // TAO_BindingIterator: populate a binding <b> with info contained
- // in <hash_entry>. Return 1 if everything went smoothly, 0 if an
- // allocation failed.
-
-protected:
- // = These are the helper methods used by other methods.
-
- CosNaming::NamingContext_ptr get_context (const CosNaming::Name &name,
- CORBA::Environment &_env);
- // This is used by methods that need to resolve a compound name to
- // get the reference to the target context 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)
- // Returns a pointer to the target context.
-
- int is_valid (CORBA::ULong len,
- CORBA::Environment &_env);
- // Check to see if we've got a valid name and raise an exception if
- // we don't.
-
- void list_helper (TAO_BindingIterator *&bind_iter,
- TAO_NamingContext::HASH_MAP::ITERATOR *hash_iter,
- CORBA::Environment &_env);
- // This is a helper function for <list> method. It is necessary due
- // to inability to have 2 TRY blocks in one function.
-
- HASH_MAP context_;
- // This implementation of <NamingContext> uses <ACE_Hash_Map> for
- // storage and manipulation of name-object bindings.
-
- int root_;
- // Flag indicating whether the context is a root or not. It allows
- // to do things like have <destroy> be a no-op on root context.
- // Values: 1 indicates root, 0 indicates not a root.
-
- ACE_Lock *lock_;
- // Lock to serialize access to the underlying data structure. This
- // is a lock adapter that hides the type of lock, which may be a
- // null lock if the ORB decides threading is not necessary.
-
- PortableServer::POA_var poa_;
- // Implement a different <_default_POA>.
-
- u_long counter_;
- // This counter is used to generate names for children.
-
- size_t hash_table_size_;
- // Hash table size.
-
- ACE_CString poa_id_;
- // My POA Id.
-};
-
-class TAO_ORBSVCS_Export TAO_BindingIterator : public POA_CosNaming::BindingIterator
-{
- // = TITLE
- // This class implements the <BindingIterator> interface that is
- // part of the <CosNaming> idl module.
- //
- // = DESCRIPTION
- // <TAO_BindingIterator> constructor expects a pointer to a
- // dynamically allocated hash map iterator. Destructor
- // deallocates hash map iterator.
-public:
- // = Intialization and termination methods.
- TAO_BindingIterator (TAO_NamingContext::HASH_MAP::ITERATOR *hash_iter,
- PortableServer::POA_ptr poa,
- ACE_Lock *lock);
- // Constructor.
-
- ~TAO_BindingIterator (void);
- // Destructor.
-
- // Returns the Default POA of this Servant object
- virtual PortableServer::POA_ptr _default_POA (CORBA::Environment &env);
-
- CORBA::Boolean next_one (CosNaming::Binding_out b,
- CORBA::Environment &IT_env);
- // This operation returns the next binding. If there are no more
- // bindings false is returned.
-
- CORBA::Boolean next_n (CORBA::ULong how_many,
- CosNaming::BindingList_out bl,
- CORBA::Environment &IT_env);
- // This operation returns at most the requested number of bindings.
-
- void destroy (CORBA::Environment &IT_env);
- // This operation destroys the iterator.
-
-private:
- TAO_NamingContext::HASH_MAP::ITERATOR *hash_iter_;
- // A pointer to the hash map iterator.
-
- ACE_Lock *lock_;
- // Lock passed on from <TAO_NamingContext> to serialize access to the
- // internal data structure.
-
- PortableServer::POA_var poa_;
- // Implement a different _default_POA()
-};
-
-#endif /* TAO_NAMING_I_H */
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Entries.cpp b/TAO/orbsvcs/orbsvcs/Naming/Entries.cpp
deleted file mode 100644
index a6795aafdd3..00000000000
--- a/TAO/orbsvcs/orbsvcs/Naming/Entries.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// cos
-//
-// = FILENAME
-// Entries.cpp
-//
-// = AUTHOR
-// Marina Spivak <marina@cs.wustl.edu>
-//
-// ============================================================================
-
-#include "Entries.h"
-
-ACE_RCSID(Naming, Entries, "$Id$")
-
-TAO_IntId::TAO_IntId (void)
- : type_ (CosNaming::nobject)
-{
- ref_ = CORBA::Object::_nil ();
-}
-
-TAO_IntId::TAO_IntId (CORBA::Object_ptr obj,
- CosNaming::BindingType type)
- : type_ (type)
-{
- ref_ = CORBA::Object::_duplicate (obj);
-}
-
-TAO_IntId::TAO_IntId (const TAO_IntId &rhs)
-{
- type_ = rhs.type_;
- ref_ = CORBA::Object::_duplicate (rhs.ref_);
-}
-
-TAO_IntId::~TAO_IntId (void)
-{
- CORBA::release (ref_);
-}
-
-void
-TAO_IntId::operator= (const TAO_IntId &rhs)
-{
- // check for self assignment.
- if (&rhs == this)
- return;
-
- type_ = rhs.type_;
-
- CORBA::release (ref_);
- ref_ = CORBA::Object::_duplicate (rhs.ref_);
-}
-
-TAO_ExtId::TAO_ExtId (void)
- : kind_ (),
- id_ ()
-{
-}
-
-TAO_ExtId::TAO_ExtId (const char *id,
- const char *kind)
- : kind_ (kind),
- id_ (id)
-{
-}
-
-TAO_ExtId::TAO_ExtId (const TAO_ExtId &rhs)
-{
- id_ = rhs.id_;
- kind_ = rhs.kind_;
-}
-
-TAO_ExtId::~TAO_ExtId (void)
-{
-}
-
-void
-TAO_ExtId::operator= (const TAO_ExtId &rhs)
-{
- // Check for self assignment.
- if (&rhs == this)
- return;
-
- id_ = rhs.id_;
- kind_ = rhs.kind_;
-}
-
-int
-TAO_ExtId::operator== (const TAO_ExtId &rhs) const
-{
- return id_ == rhs.id_ && kind_ == rhs.kind_;
-}
-
-int
-TAO_ExtId::operator!= (const TAO_ExtId &rhs) const
-{
- return id_ != rhs.id_ || kind_ != rhs.kind_;
-}
-
-u_long
-TAO_ExtId::hash (void) const
-{
- ACE_CString temp (id_);
- temp += kind_;
-
- return temp.hash ();
-}
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Entries.h b/TAO/orbsvcs/orbsvcs/Naming/Entries.h
deleted file mode 100644
index 8aec6d8914d..00000000000
--- a/TAO/orbsvcs/orbsvcs/Naming/Entries.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/* -*- C++ -*- */
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// cos
-//
-// = FILENAME
-// Entries.h
-//
-// = AUTHOR
-// Marina Spivak <marina@cs.wustl.edu>
-//
-// ============================================================================
-
-#if !defined (TAO_ENTRIES_H)
-#define TAO_ENTRIES_H
-
-#include "ace/Hash_Map_Manager.h"
-#include "ace/Synch.h"
-#include "ace/SString.h"
-
-#include "tao/corba.h"
-#include "orbsvcs/CosNamingC.h"
-
-class TAO_ORBSVCS_Export TAO_IntId
-{
- // = TITLE
- // Stores information a context keeps for each bound name.
- //
- // = DESCRIPTION
- // Each bound name is associated with an object reference and
- // the type of binding.
-public:
- // = Initialization and termination methods.
- TAO_IntId (void);
- // Constructor.
-
- TAO_IntId (CORBA::Object_ptr obj,
- CosNaming::BindingType type /* = CosNaming::nobject */);
- // Constructor.
-
- TAO_IntId (const TAO_IntId & rhs);
- // Copy constructor.
-
- ~TAO_IntId (void);
- // Destructor.
-
- void operator= (const TAO_IntId & rhs);
- // Assignment operator (does copy memory).
-
- CORBA::Object_ptr ref_;
- // CORBA object reference of the bound object.
-
- CosNaming::BindingType type_;
- // Indicator of whether the object is a NamingContext that should
- // participate in name resolution when compound names are used.
-};
-
-class TAO_ORBSVCS_Export TAO_ExtId
-{
- // = TITLE
- // Stores the name to which an object is bound.
- //
- // = DESCRIPTION
- // This class is used as the External ID for the
- // <ACE_Hash_Map_Manager>.
-public:
- // = Initialization and termination methods.
-
- TAO_ExtId (void);
- // Constructor.
-
- TAO_ExtId (const char *id,
- const char *kind);
- // Constructor.
-
- TAO_ExtId (const TAO_ExtId & rhs);
- // Copy constructor.
-
- ~TAO_ExtId (void);
- // Destructor.
-
- void operator= (const TAO_ExtId & rhs);
- // Assignment operator (does copy memory).
-
- int operator== (const TAO_ExtId &rhs) const;
- // Equality comparison operator (must match both id_ and kind_).
-
- int operator!= (const TAO_ExtId &rhs) const;
- // Inequality comparison operator.
-
- u_long hash (void) const;
- // This class has to have a hash for use with ACE_Hash_Map_Manager.
-
- ACE_CString kind_;
- // Any information user wants to store (not used by Naming Service).
-
- ACE_CString id_;
- // Any information user wants to store (not used by Naming Service).
-};
-
-#endif /* TAO_ENTRIES_H */
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp b/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp
deleted file mode 100644
index 77a7e8e7234..00000000000
--- a/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp
+++ /dev/null
@@ -1,269 +0,0 @@
-// $Id$
-
-#include "orbsvcs/CosNamingC.h"
-#include "tao/corba.h"
-#include "Naming_Utils.h"
-#include "ace/Arg_Shifter.h"
-
-ACE_RCSID(Naming, Naming_Utils, "$Id$")
-
-TAO_Naming_Server::TAO_Naming_Server (void)
- : naming_context_impl_ (0),
- naming_context_ (),
- ior_multicast_ (0),
- naming_service_ior_ ()
-{
-}
-
-TAO_Naming_Server::TAO_Naming_Server (CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- size_t context_size,
- ACE_Time_Value *timeout,
- int resolve_for_existing_naming_service)
- : naming_context_impl_ (0),
- naming_context_ (),
- ior_multicast_ (0),
- naming_service_ior_ ()
-{
- if (this->init (orb,
- poa,
- context_size,
- timeout,
- resolve_for_existing_naming_service) == -1)
- ACE_ERROR ((LM_ERROR,
- "(%P|%t) %p\n",
- "TAO_Naming_Server::init"));
-}
-
-
-int
-TAO_Naming_Server::init (CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- size_t context_size,
- ACE_Time_Value *timeout,
- int resolve_for_existing_naming_service)
-{
- CORBA::Object_var naming_obj;
-
- if (resolve_for_existing_naming_service)
- naming_obj = orb->resolve_initial_references ("NameService", timeout);
-
- if (CORBA::is_nil (naming_obj.in ()))
- {
- if (TAO_debug_level > 0)
- ACE_DEBUG ((LM_DEBUG,
- "\nNameService not resolved, so we'll become a NameService\n"));
- return this->init_new_naming (orb,
- poa,
- context_size);
- }
- else
- {
- if (TAO_debug_level > 0)
- ACE_DEBUG ((LM_DEBUG,
- "\nNameService found!\n"));
-
- TAO_TRY
- {
- this->naming_context_ =
- CosNaming::NamingContext::_narrow (naming_obj.in (),
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- this->naming_service_ior_ =
- orb->object_to_string (naming_obj.in (),
- TAO_TRY_ENV);
-
- TAO_CHECK_ENV;
- }
- TAO_CATCHANY
- {
- TAO_TRY_ENV.print_exception ("TAO_Naming_Server::init");
- }
- TAO_ENDTRY;
- }
- return 0;
-}
-
-int
-TAO_Naming_Server::init_new_naming (CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- size_t context_size)
-{
- ACE_NEW_RETURN (this->naming_context_impl_,
- TAO_NamingContext (poa,
- "root",
- context_size,
- 1),
- -1);
-
- TAO_TRY
- {
- PortableServer::ObjectId_var id =
- PortableServer::string_to_ObjectId ("NameService");
-
- poa->activate_object_with_id (id.in (),
- this->naming_context_impl_,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- this->naming_context_ =
- this->naming_context_impl_->_this (TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- // Stringify the objref we'll be implementing, and print it to
- // stdout. Someone will take that string and give it to a
- // client.
- this->naming_service_ior_=
- orb->object_to_string (this->naming_context_.in (),
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- if (TAO_debug_level > 0)
- ACE_DEBUG ((LM_DEBUG,
- "NameService IOR is <%s>\n",
- this->naming_service_ior_.in ()));
-
-#if defined (ACE_HAS_IP_MULTICAST)
- // Get reactor instance from TAO.
- ACE_Reactor *reactor =
- TAO_ORB_Core_instance ()->reactor ();
-
- // First, see if the user has given us a multicast port number
- // for the name service on the command-line;
- u_short port =
- TAO_ORB_Core_instance ()->orb_params ()->name_service_port ();
-
- if (port == 0)
- {
- const char *port_number =
- ACE_OS::getenv ("NameServicePort");
-
- if (port_number != 0)
- port = ACE_OS::atoi (port_number);
- }
-
- if (port == 0)
- port = TAO_DEFAULT_NAME_SERVER_REQUEST_PORT;
-
- // Instantiate a server which will receive requests for an ior
- ACE_NEW_RETURN (this->ior_multicast_,
- TAO_IOR_Multicast (this->naming_service_ior_.in (),
- port,
- ACE_DEFAULT_MULTICAST_ADDR,
- TAO_SERVICEID_NAMESERVICE),
- -1);
-
- // Register event handler for the ior multicast.
- if (reactor->register_handler (this->ior_multicast_,
- ACE_Event_Handler::READ_MASK) == -1)
- {
- if (TAO_debug_level > 0)
- ACE_DEBUG ((LM_DEBUG,
- "cannot register Event handler\n"));
- return -1;
- }
- else
- {
- if (TAO_debug_level > 0)
- ACE_DEBUG ((LM_DEBUG,
- "The multicast server setup is done.\n"));
- }
-#endif /* ACE_HAS_IP_MULTICAST */
- }
- TAO_CATCHANY
- {
- TAO_TRY_ENV.print_exception ("Naming Service");
- return -1;
- }
- TAO_ENDTRY;
- return 0;
-}
-
-// Returns the "NameService" NamingContext implementation object.
-
-TAO_NamingContext &
-TAO_Naming_Server::get_naming_context (void)
-{
- return *this->naming_context_impl_;
-}
-
-CORBA::String
-TAO_Naming_Server::naming_service_ior (void)
-{
- return CORBA::string_dup (this->naming_service_ior_.in ());
-}
-
-// Returns a pointer to the NamingContext.
-
-CosNaming::NamingContext_ptr
-TAO_Naming_Server::operator-> (void) const
-{
- return this->naming_context_.ptr ();
-}
-
-TAO_Naming_Server::~TAO_Naming_Server (void)
-{
- if (this->ior_multicast_ != 0)
- {
- TAO_ORB_Core_instance ()->reactor ()->remove_handler
- (this->ior_multicast_,
- ACE_Event_Handler::READ_MASK | ACE_Event_Handler::DONT_CALL);
- delete this->ior_multicast_;
- }
- delete this->naming_context_impl_;
-}
-
-// Returns a pointer to the NamingContext.
-
-CosNaming::NamingContext_ptr
-TAO_Naming_Client::operator -> (void) const
-{
- return this->naming_context_.ptr ();
-}
-
-// Returns a pointer to the NamingContext.
-
-CosNaming::NamingContext_ptr
-TAO_Naming_Client::get_context (void) const
-{
- return this->naming_context_.ptr ();
-}
-
-int
-TAO_Naming_Client::init (CORBA::ORB_ptr orb,
- ACE_Time_Value *timeout)
-{
- TAO_TRY
- {
- CORBA::Object_var naming_obj =
- orb->resolve_initial_references ("NameService", timeout);
-
- if (CORBA::is_nil (naming_obj.in ()))
- ACE_ERROR_RETURN ((LM_ERROR,
- " (%P|%t) Unable to initialize the NameService.\n"),
- -1);
- this->naming_context_ =
- CosNaming::NamingContext::_narrow (naming_obj.in (),
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
- }
- TAO_CATCHANY
- {
- TAO_TRY_ENV.print_exception ("init");
- return -1;
- }
- TAO_ENDTRY;
-
- return 0;
-}
-
-TAO_Naming_Client::TAO_Naming_Client (void)
-{
- // Do nothing
-}
-
-TAO_Naming_Client::~TAO_Naming_Client (void)
-{
- // Do nothing
-}
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.h b/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.h
deleted file mode 100644
index ca950c1d7f2..00000000000
--- a/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/* -*- C++ -*- */
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// TAO/orbsvcs/Naming_Service
-//
-// = FILENAME
-// Naming_Utils.h
-//
-// = DESCRIPTION
-// This class implements wrapper classes for clients and servers
-// of the Naming Service.
-//
-// = AUTHORS
-// Nagarajan Surendran (naga@cs.wustl.edu), Matt Braun
-// <mjb2@cs.wustl.edu>, and Douglas C. Schmidt <schmidt@cs.wustl.edu>.
-//
-// ============================================================================
-
-#if !defined (TAO_NAMING_UTILS_H)
-#define TAO_NAMING_UTILS_H
-
-#include "tao/corba.h"
-#include "orbsvcs/CosNamingC.h"
-#include "orbsvcs/IOR_Multicast.h"
-#include "CosNaming_i.h"
-
-class TAO_ORBSVCS_Export TAO_Naming_Server
-{
- // = TITLE
- //
- // Defines a wrapper class that holds the root Naming Context.
- //
- // = DESCRIPTION
- //
- // This class either finds an existing Naming Service or creates
- // one. It also defines the operator-> so that <NamingContext>
- // functions like <bind>, <unbind> .. can be called on a
- // <NameServer> object. This class is intended to simplify
- // programs that want to play the role of a Naming Service
- // servers. To simplify programs that want to play the role of
- // Naming Service clients, use <TAO_Naming_Client>.
-public:
- TAO_Naming_Server (void);
- // Default constructor.
-
- TAO_Naming_Server (CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- size_t context_size = ACE_DEFAULT_MAP_SIZE,
- ACE_Time_Value *timeout = 0,
- int resolve_for_existing_naming_service = 1);
- // Either find an existing Naming Service or creates one. Takes the
- // POA under which to register the Naming Service implementation
- // object.
-
- int init (CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- size_t context_size = ACE_DEFAULT_MAP_SIZE,
- ACE_Time_Value *timeout = 0,
- int resolve_for_existing_naming_service = 1);
- // Either find an existing Naming Service or creates one. Takes the
- // POA under which to register the Naming Service implementation
- // object.
-
- ~TAO_Naming_Server (void);
- // Destructor.
-
- TAO_NamingContext &get_naming_context (void);
- // Returns the "NameService" NamingContext implementation object
- // reference.
-
- CORBA::String naming_service_ior (void);
- // Returns the IOR of the naming service.
-
- CosNaming::NamingContext_ptr operator-> (void) const;
- // Returns a <NamingContext_ptr>.
-
-protected:
- int init_new_naming (CORBA::ORB_ptr orb,
- PortableServer::POA_ptr root_poa,
- size_t context_size);
- // Initialize a new name server under the given ORB and POA.
-
- TAO_NamingContext *naming_context_impl_;
- // Naming context implementation for "NameService".
-
- CosNaming::NamingContext_var naming_context_;
- // NamingContext ptr.
-
- TAO_IOR_Multicast *ior_multicast_;
- // The ior_multicast event handler.
-
- CORBA::String_var naming_service_ior_;
- // The IOR string of the naming service.
-};
-
-class TAO_ORBSVCS_Export TAO_Naming_Client
-{
- // = TITLE
- // Defines a wrapper class that simplifies initialization and
- // access to a <NamingContext>.
- //
- // = DESCRIPTION
- // This class takes an ORB reference and contacts the
- // NamingService naming context object under that. It also
- // defines the operator-> so that <NamingContext> functions like
- // <resolve>, etc. can be called on a <NameServer> object. This
- // class is intended to simplify programs that want to play the
- // role of a Naming Service clients.
-public:
- // = Initialization and termination methods.
- TAO_Naming_Client (void);
- // Default constructor.
-
- int init (CORBA::ORB_ptr orb,
- ACE_Time_Value *timeout = 0);
- // Initialize the name server.
-
- ~TAO_Naming_Client (void);
- // Destructor.
-
- CosNaming::NamingContext_ptr operator-> (void) const;
- // Returns a <NamingContext_ptr>.
-
- CosNaming::NamingContext_ptr get_context (void) const;
- // Returns the NamingContext
-
-protected:
- CosNaming::NamingContext_var naming_context_;
- // NamingContext ptr.
-};
-
-#endif /* TAO_NAMING_UTILS_H */