summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Naming
diff options
context:
space:
mode:
authornobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-07-15 16:39:52 +0000
committernobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-07-15 16:39:52 +0000
commit2325b338766316babe9c0343e378fa3a24c9f32b (patch)
treedb208a2657302e9308ef1fb6157ce6059f1a65fb /TAO/orbsvcs/orbsvcs/Naming
parent9f29df04f390576fd4ff1c68d9a006ff543b46a5 (diff)
downloadATCD-ACE-4_6_45.tar.gz
This commit was manufactured by cvs2svn to create tag 'ACE-4_6_45'.ACE-4_6_45
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/Naming')
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Bindings_Iterator_T.cpp219
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Bindings_Iterator_T.h130
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Entries.cpp122
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Entries.h132
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Hash_Naming_Context.cpp579
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Hash_Naming_Context.h227
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Makefile.am42
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Naming_Context.cpp144
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Naming_Context.h294
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp317
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.h172
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Persistent_Context_Index.cpp344
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Persistent_Context_Index.h150
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Persistent_Entries.cpp204
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Persistent_Entries.h226
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Persistent_Naming_Context.cpp573
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Persistent_Naming_Context.h238
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/README68
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Transient_Naming_Context.cpp371
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Transient_Naming_Context.h179
20 files changed, 0 insertions, 4731 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Bindings_Iterator_T.cpp b/TAO/orbsvcs/orbsvcs/Naming/Bindings_Iterator_T.cpp
deleted file mode 100644
index be97306e0bc..00000000000
--- a/TAO/orbsvcs/orbsvcs/Naming/Bindings_Iterator_T.cpp
+++ /dev/null
@@ -1,219 +0,0 @@
-// $Id$
-
-#ifndef TAO_BINDINGS_ITERATOR_T_CPP
-#define TAO_BINDINGS_ITERATOR_T_CPP
-
-#include "Bindings_Iterator_T.h"
-
-#if !defined (ACE_LACKS_PRAGMA_ONCE)
-# pragma once
-#endif /* ACE_LACKS_PRAGMA_ONCE */
-
-template <class ITERATOR, class TABLE_ENTRY>
-TAO_Bindings_Iterator<ITERATOR, TABLE_ENTRY>::TAO_Bindings_Iterator (TAO_Hash_Naming_Context *context,
- ITERATOR *hash_iter,
- PortableServer::POA_ptr poa,
- ACE_SYNCH_RECURSIVE_MUTEX &lock)
- : destroyed_ (0),
- context_ (context),
- hash_iter_ (hash_iter),
- lock_ (lock),
- poa_ (PortableServer::POA::_duplicate (poa))
-
-{
-}
-
-template <class ITERATOR, class TABLE_ENTRY>
-TAO_Bindings_Iterator<ITERATOR, TABLE_ENTRY>::~TAO_Bindings_Iterator (void)
-{
- ACE_DECLARE_NEW_CORBA_ENV;
- delete hash_iter_;
-
- // Since we are going away, decrement the reference count on the
- // Naming Context we were iterating over.
- context_->interface ()->_remove_ref (ACE_TRY_ENV);
-}
-
-// Return the Default POA of this Servant
-template <class ITERATOR, class TABLE_ENTRY> PortableServer::POA_ptr
-TAO_Bindings_Iterator<ITERATOR, TABLE_ENTRY>::_default_POA (CORBA::Environment &/*env*/)
-{
- return PortableServer::POA::_duplicate (this->poa_.in ());
-}
-
-template <class ITERATOR, class TABLE_ENTRY> CORBA::Boolean
-TAO_Bindings_Iterator<ITERATOR, TABLE_ENTRY>::next_one (CosNaming::Binding_out b,
- CORBA::Environment &ACE_TRY_ENV)
- ACE_THROW_SPEC ((CORBA::SystemException))
-{
- 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_EX (binding,
- CosNaming::Binding,
- CORBA::NO_MEMORY ());
- ACE_CHECK_RETURN (0);
-
- b = binding;
-
- ACE_GUARD_THROW_EX (ACE_SYNCH_RECURSIVE_MUTEX,
- ace_mon,
- this->lock_,
- CORBA::INTERNAL ());
- ACE_CHECK_RETURN (0);
-
- // Check to make sure this object is still valid.
- if (this->destroyed_)
- ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (), 0);
-
- // If the context we are iterating over has been destroyed,
- // self-destruct.
- if (context_->destroyed ())
- {
- destroy (ACE_TRY_ENV);
- ACE_CHECK_RETURN (0);
-
- ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (), 0);
- }
-
- // If there are no more bindings.
- if (hash_iter_->done ())
- return 0;
- else
- {
- // Return a binding.
- TABLE_ENTRY *hash_entry;
- hash_iter_->next (hash_entry);
-
- if (populate_binding (hash_entry, *binding) == 0)
- ACE_THROW_RETURN (CORBA::NO_MEMORY (), 0);
-
- hash_iter_->advance ();
- return 1;
- }
-}
-
-template <class ITERATOR, class TABLE_ENTRY> CORBA::Boolean
-TAO_Bindings_Iterator<ITERATOR, TABLE_ENTRY>::next_n (CORBA::ULong how_many,
- CosNaming::BindingList_out bl,
- CORBA::Environment &ACE_TRY_ENV)
- ACE_THROW_SPEC ((CORBA::SystemException))
-{
- // 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_EX (bl,
- CosNaming::BindingList (0),
- CORBA::NO_MEMORY ());
- ACE_CHECK_RETURN (0);
- // Obtain the lock.
- ACE_GUARD_THROW_EX (ACE_SYNCH_RECURSIVE_MUTEX,
- ace_mon,
- this->lock_,
- CORBA::INTERNAL ());
- ACE_CHECK_RETURN (0);
-
- // Check to make sure this object is still valid.
- if (this->destroyed_)
- ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (), 0);
-
- // If the context we are iterating over has been destroyed,
- // self-destruct.
- if (context_->destroyed ())
- {
- destroy (ACE_TRY_ENV);
- ACE_CHECK_RETURN (0);
-
- ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (), 0);
- }
-
- // Check for illegal parameter values.
- if (how_many == 0)
- ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0);
-
- // If there are no more bindings...
- if (hash_iter_->done ())
- return 0;
- else
- {
- // Initially assume that the iterator has the requested number of
- // bindings.
- bl->length (how_many);
-
- TABLE_ENTRY *hash_entry;
-
- // Iterate and populate the BindingList.
- for (CORBA::ULong i = 0; i < how_many; i++)
- {
- hash_iter_->next (hash_entry);
-
- if (populate_binding (hash_entry, bl[i]) == 0)
- ACE_THROW_RETURN (CORBA::NO_MEMORY (), 0);
-
- if (hash_iter_->advance () == 0)
- {
- // If no more bindings are left, reset length to the actual
- // number of bindings populated, and get out of the loop.
- bl->length (i + 1);
- break;
- }
- }
- return 1;
- }
-}
-
-template <class ITERATOR, class TABLE_ENTRY> void
-TAO_Bindings_Iterator<ITERATOR, TABLE_ENTRY>::destroy (CORBA::Environment &ACE_TRY_ENV)
- ACE_THROW_SPEC ((CORBA::SystemException))
-{
- ACE_GUARD_THROW_EX (ACE_SYNCH_RECURSIVE_MUTEX,
- ace_mon,
- this->lock_,
- CORBA::INTERNAL ());
- ACE_CHECK;
-
- // Check to make sure this object is still valid.
- if (this->destroyed_)
- ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
-
- // Mark the object invalid.
- this->destroyed_ = 1;
-
- PortableServer::ObjectId_var id =
- poa_->servant_to_id (this,
- ACE_TRY_ENV);
- ACE_CHECK;
-
- poa_->deactivate_object (id.in (),
- ACE_TRY_ENV);
- ACE_CHECK;
-}
-
-template <class ITERATOR, class TABLE_ENTRY> int
-TAO_Bindings_Iterator<ITERATOR, TABLE_ENTRY>::populate_binding (TABLE_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 () != 0)
- {
- b.binding_name[0].id =
- hash_entry->ext_id_.id ();
- if (b.binding_name[0].id.in () == 0)
- return 0;
- }
- if (hash_entry->ext_id_.kind () != 0)
- {
- b.binding_name[0].kind =
- hash_entry->ext_id_.kind ();
- if (b.binding_name[0].kind.in () == 0)
- return 0;
- }
- return 1;
-}
-
-#endif /* TAO_BINDINGS_ITERATOR_T_CPP */
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Bindings_Iterator_T.h b/TAO/orbsvcs/orbsvcs/Naming/Bindings_Iterator_T.h
deleted file mode 100644
index 177061c8e67..00000000000
--- a/TAO/orbsvcs/orbsvcs/Naming/Bindings_Iterator_T.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/* -*- C++ -*- */
-// $Id$
-// ============================================================================
-//
-// = LIBRARY
-// cos
-//
-// = FILENAME
-// Hash_Binding_Iterator_T.h
-//
-// = AUTHOR
-// Marina Spivak <marina@cs.wustl.edu>
-//
-// ============================================================================
-
-#ifndef TAO_BINDINGS_ITERATOR_T_H
-#define TAO_BINDINGS_ITERATOR_T_H
-
-#include "Hash_Naming_Context.h"
-
-template <class ITERATOR, class TABLE_ENTRY>
-class TAO_Bindings_Iterator : public virtual PortableServer::RefCountServantBase,
- public virtual POA_CosNaming::BindingIterator
-{
- // = TITLE
- // This class implements the <BindingIterator> interface that is
- // part of the <CosNaming> idl module. This class works with Hash_Map-based
- // implementations of CosNaming::NamingContext.
- //
- // = DESCRIPTION
- // This class is templatized by the types of the underlying
- // hash table iterator and hash table entry, so that it can be
- // used for both TAO_Transient_Naming_Context and
- // TAO_Persistent_Naming_Context (and any other classes with
- // underlying data structures supporting
- // ACE_Hash_Map_Manager/Iterator - like interfaces).
- //
- // Instances of <TAO_Bindings_Iterator>s affect reference counts
- // of corresponding Naming Contexts. Reference count on a
- // Naming Context is incremented by one for a lifetime of each
- // instance of <TAO_Bindings_Iterator> created for that
- // context, i.e., a Naming Context cannot
- // be cleaned up (but, of course, it can be invalidated) before
- // all of its iterators have been cleaned up. When <destroy>
- // method is invoked on a Naming Context, all of its iterators are
- // destroyed in a "lazy evaluation" fashion, i.e., whenever a next
- // operation is invoked on an iterator, and it can detect that
- // the corresponding Naming Context has been invalidated, the
- // iterator is destroyed.
- //
-public:
- // = Intialization and termination methods.
- TAO_Bindings_Iterator (TAO_Hash_Naming_Context *context,
- ITERATOR *hash_iter,
- PortableServer::POA_ptr poa,
- ACE_SYNCH_RECURSIVE_MUTEX &lock);
- // Constructor expects a pointer to a
- // dynamically allocated hash map iterator (destructor
- // deallocates hash map iterator).
-
-
- ~TAO_Bindings_Iterator (void);
- // Destructor.
-
- virtual PortableServer::POA_ptr _default_POA (CORBA::Environment &env);
- // Returns the Default POA of this Servant object
-
- // = Idl methods.
-
- CORBA::Boolean next_one (CosNaming::Binding_out b,
- CORBA::Environment &ACE_TRY_ENV)
- ACE_THROW_SPEC ((CORBA::SystemException));
- // This operation passes back the next unseen binding. True is
- // returned if a binding is passed back, and false is returned otherwise.
-
- CORBA::Boolean next_n (CORBA::ULong how_many,
- CosNaming::BindingList_out bl,
- CORBA::Environment &ACE_TRY_ENV)
- ACE_THROW_SPEC ((CORBA::SystemException));
- // This operation passes back at most <how_many> unseen bindings.
- // True is returned if bindings were passed back, and false is
- // returned if no bindings were passed back.
-
- void destroy (CORBA::Environment &ACE_TRY_ENV)
- ACE_THROW_SPEC ((CORBA::SystemException));
- // This operation destroys the iterator.
-
- // = Helper method.
-
- static int populate_binding (TABLE_ENTRY *hash_entry,
- CosNaming::Binding &b);
- // Helper function used by TAO_*_Naming_Context and
- // TAO_BindingIterator: populate a binding <b> with info contained
- // in <hash_entry>. Return 1 if everything went smoothly, 0 if an
- // allocation failed.
-
-private:
- int destroyed_;
- // Flag indicating whether this iterator is still valid. (The
- // iterator becomes invalid when <destroy> method has been invoked
- // on it, or when <destroy> method has been invoked on the
- // corresponding Naming Context.) This flag is necessary
- // because immediate destruction of this servant might not be possible
- // due to pending requests in the POA.
-
- TAO_Hash_Naming_Context *context_;
- // Pointer to the Naming Context we are iterating over. We need
- // this pointer to make sure the context is still valid before
- // each iteration, and to decrement its reference count once we are <destroyed>.
-
- ITERATOR *hash_iter_;
- // A pointer to the hash map iterator.
-
- ACE_SYNCH_RECURSIVE_MUTEX &lock_;
- // Lock passed on from Naming Context to serialize access to the
- // internal data structure.
-
- PortableServer::POA_var poa_;
- // Implement a different _default_POA().
-};
-
-#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
-#include "Bindings_Iterator_T.cpp"
-#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
-
-#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
-#pragma implementation ("Bindings_Iterator_T.cpp")
-#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
-
-#endif /* TAO_BINDINGS_ITERATOR_T_H */
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Entries.cpp b/TAO/orbsvcs/orbsvcs/Naming/Entries.cpp
deleted file mode 100644
index 282bf055503..00000000000
--- a/TAO/orbsvcs/orbsvcs/Naming/Entries.cpp
+++ /dev/null
@@ -1,122 +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)
-{
-}
-
-const char *
-TAO_ExtId::id (void)
-{
- return id_.fast_rep ();
-}
-
-const char *
-TAO_ExtId::kind (void)
-{
- return kind_.fast_rep ();
-}
-
-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 561e07b5273..00000000000
--- a/TAO/orbsvcs/orbsvcs/Naming/Entries.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/* -*- C++ -*- */
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// cos
-//
-// = FILENAME
-// Entries.h
-//
-// = AUTHOR
-// Marina Spivak <marina@cs.wustl.edu>
-//
-// ============================================================================
-
-#ifndef TAO_ENTRIES_H
-#define TAO_ENTRIES_H
-
-#include "ace/Hash_Map_Manager.h"
-
-#if !defined (ACE_LACKS_PRAGMA_ONCE)
-# pragma once
-#endif /* ACE_LACKS_PRAGMA_ONCE */
-
-#include "ace/Synch.h"
-#include "ace/SString.h"
-
-#include "tao/corba.h"
-#include "orbsvcs/CosNamingC.h"
-
-class TAO_ORBSVCS_Export TAO_IntId
-{
- // = TITLE
- // Helper class for TAO_Transient_Bindings_Map: unifies several
- // data items, so they can be stored together as a <value>
- // for a <key> in a hash table holding the state of a Transient
- // Naming Context.
- //
- // = DESCRIPTION
- // This class holds CORBA Object pointer and a binding type, so
- // they can be stored together as a <value> for a <key> in a
- // hash table holding the state of a Transient Naming Context.
- //
-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).
-
- // = Data members.
-
- CORBA::Object_ptr ref_;
- // Object reference to be stored in a Transient Naming Context.
-
- CosNaming::BindingType type_;
- // Binding type for <ref_>.
-};
-
-class TAO_ORBSVCS_Export TAO_ExtId
-{
- // = TITLE
- // Helper class for TAO_Transient_Bindings_Map: unifies several
- // data items, so they can be stored together as a <key>
- // for a <value> in a hash table holding the state of a Transient
- // Naming Context.
- //
- // = DESCRIPTION
- // This class holds id and kind strings, so
- // they can be stored together as a <key> for a <value> in a
- // hash table holding the state of a Transient Naming Context.
- //
-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.
-
- // = Assignment and comparison operators.
-
- 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;
- // <hash> function is required in order for this class to be usable by
- // ACE_Hash_Map_Manager.
-
- // = Data members.
-
- ACE_CString kind_;
- // <kind> portion of the name to be associated with some object
- // reference in a Transient Naming Context.
-
- ACE_CString id_;
- // <id> portion of the name to be associated with some object
- // reference in a Transient Naming Context.
-
- // = Accessors: return <id_> and <kind_> in a const char * format.
-
- const char * id (void);
- const char * kind (void);
-};
-
-#endif /* TAO_ENTRIES_H */
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Hash_Naming_Context.cpp b/TAO/orbsvcs/orbsvcs/Naming/Hash_Naming_Context.cpp
deleted file mode 100644
index 24ca105d609..00000000000
--- a/TAO/orbsvcs/orbsvcs/Naming/Hash_Naming_Context.cpp
+++ /dev/null
@@ -1,579 +0,0 @@
-// $Id$
-// ============================================================================
-//
-// = LIBRARY
-// cos
-//
-// = FILENAME
-// Hash_Naming_Context.cpp
-//
-// = AUTHOR
-// Marina Spivak <marina@cs.wustl.edu> and
-// Sergio Flores-Gaitan <sergio@cs.wustl.edu>
-//
-// ============================================================================
-#include "ace/Auto_Ptr.h"
-#include "Hash_Naming_Context.h"
-
-ACE_RCSID(Naming, Hash_Naming_Context, "$Id$")
-
-TAO_Bindings_Map::~TAO_Bindings_Map (void)
-{
-}
-
-TAO_Hash_Naming_Context::TAO_Hash_Naming_Context (PortableServer::POA_ptr poa,
- const char *poa_id)
- : context_ (0),
- interface_ (0),
- destroyed_ (0),
- poa_ (PortableServer::POA::_duplicate (poa)),
- poa_id_ (poa_id)
-{
-}
-
-void
-TAO_Hash_Naming_Context::interface (TAO_Naming_Context *i)
-{
- this->interface_ = i;
-}
-
-TAO_Hash_Naming_Context::~TAO_Hash_Naming_Context (void)
-{
- delete context_;
-}
-
-PortableServer::POA_ptr
-TAO_Hash_Naming_Context::_default_POA (void)
-{
- return PortableServer::POA::_duplicate (this->poa_.in ());
-}
-
-CosNaming::NamingContext_ptr
-TAO_Hash_Naming_Context::get_context (const CosNaming::Name &name,
- CORBA::Environment &ACE_TRY_ENV)
-{
- // Naming context we will return.
- CosNaming::NamingContext_var result =
- CosNaming::NamingContext::_nil ();
-
- // Create compound name to be resolved, i.e.,
- // (<name> - last component). To avoid copying, we can just reuse
- // <name>'s buffer, since we will not be modifying it.
- CORBA::ULong name_len = name.length ();
- CosNaming::Name comp_name (name.maximum (),
- name_len - 1,
- ACE_const_cast
- (CosNaming::NameComponent*,
- name.get_buffer ()));
- ACE_TRY
- {
- // Resolve the name.
- CORBA::Object_var context = resolve (comp_name,
- ACE_TRY_ENV);
- ACE_TRY_CHECK;
-
- // Try narrowing object reference to the NamingContext type.
- result = CosNaming::NamingContext::_narrow (context.in (),
- ACE_TRY_ENV);
- ACE_TRY_CHECK;
- }
- ACE_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 () + 1;
- ex.rest_of_name.length (rest_len);
- ex.rest_of_name[rest_len - 1] = name[name_len - 1];
-
- ACE_RETHROW;
- }
- ACE_ENDTRY;
- ACE_CHECK_RETURN (CosNaming::NamingContext::_nil ());
-
- if (CORBA::is_nil (result.in ()))
- {
- CosNaming::Name rest;
- rest.length (2);
- rest[0] = name[name_len - 2];
- rest[1] = name[name_len - 1];
- ACE_THROW_RETURN (CosNaming::NamingContext::NotFound
- (CosNaming::NamingContext::not_context,
- rest),
- CosNaming::NamingContext::_nil ());
- }
- // Finally, if everything went smoothly, just return the resolved
- // context.
- return result._retn ();
-}
-
-void
-TAO_Hash_Naming_Context::bind (const CosNaming::Name& n,
- CORBA::Object_ptr obj,
- CORBA::Environment &ACE_TRY_ENV)
-{
- ACE_GUARD_THROW_EX (ACE_SYNCH_RECURSIVE_MUTEX,
- ace_mon, this->lock_,
- CORBA::INTERNAL ());
- ACE_CHECK;
-
- // Check to make sure this object didn't have <destroy> method
- // invoked on it.
- if (this->destroyed_)
- ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
-
- // Get the length of the name.
- CORBA::ULong name_len = n.length ();
-
- // Check for invalid name.
- if (name_len == 0)
- ACE_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 (name_len > 1)
- {
- CosNaming::NamingContext_var context =
- this->get_context (n, ACE_TRY_ENV);
- ACE_CHECK;
-
- CosNaming::Name simple_name;
- simple_name.length (1);
- simple_name[0] = n[name_len - 1];
- context->bind (simple_name, obj, ACE_TRY_ENV);
- ACE_CHECK;
- }
- // If we received a simple name, we need to bind it in this context.
- else
- {
- // Try binding the name.
- int result = this->context_->bind (n[0].id,
- n[0].kind,
- obj,
- CosNaming::nobject);
- if (result == 1)
- ACE_THROW (CosNaming::NamingContext::AlreadyBound());
-
- // Something went wrong with the internal structure
- else if (result == -1)
- ACE_THROW (CORBA::INTERNAL ());
- }
-}
-
-void
-TAO_Hash_Naming_Context::rebind (const CosNaming::Name& n,
- CORBA::Object_ptr obj,
- CORBA::Environment &ACE_TRY_ENV)
-{
- ACE_GUARD_THROW_EX (ACE_SYNCH_RECURSIVE_MUTEX, ace_mon,
- this->lock_,
- CORBA::INTERNAL ());
- ACE_CHECK;
-
- // Check to make sure this object didn't have <destroy> method
- // invoked on it.
- if (this->destroyed_)
- ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
-
- // Get the length of the name.
- CORBA::ULong name_len = n.length ();
-
- // Check for invalid name.
- if (name_len == 0)
- ACE_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 (name_len > 1)
- {
- CosNaming::NamingContext_var context =
- get_context (n, ACE_TRY_ENV);
- ACE_CHECK;
-
- CosNaming::Name simple_name;
- simple_name.length (1);
- simple_name[0] = n[name_len - 1];
- context->rebind (simple_name, obj, ACE_TRY_ENV);
- ACE_CHECK;
- }
- else
- // If we received a simple name, we need to rebind it in this
- // context.
- {
- int result = this->context_->rebind (n[0].id,
- n[0].kind,
- obj,
- CosNaming::nobject);
- // Check for error conditions.
- if (result == -1)
- ACE_THROW (CORBA::INTERNAL ());
-
- else if (result == -2)
- ACE_THROW (CosNaming::NamingContext::NotFound
- (CosNaming::NamingContext::not_object,
- n));
- }
-}
-
-void
-TAO_Hash_Naming_Context::bind_context (const CosNaming::Name &n,
- CosNaming::NamingContext_ptr nc,
- CORBA::Environment &ACE_TRY_ENV)
-{
- ACE_GUARD_THROW_EX (ACE_SYNCH_RECURSIVE_MUTEX, ace_mon,
- this->lock_,
- CORBA::INTERNAL ());
- ACE_CHECK;
-
- // Check to make sure this object didn't have <destroy> method
- // invoked on it.
- if (this->destroyed_)
- ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
-
- // Do not allow binding of nil context reference.
- if (CORBA::is_nil (nc))
- ACE_THROW (CORBA::BAD_PARAM ());
-
- // Get the length of the name.
- CORBA::ULong name_len = n.length ();
-
- // Check for invalid name.
- if (name_len == 0)
- ACE_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 (name_len > 1)
- {
- CosNaming::NamingContext_var context =
- get_context (n, ACE_TRY_ENV);
- ACE_CHECK;
-
- CosNaming::Name simple_name;
- simple_name.length (1);
- simple_name[0] = n[name_len - 1];
- context->bind_context (simple_name, nc, ACE_TRY_ENV);
- ACE_CHECK;
- }
- // If we received a simple name, we need to bind it in this context.
- else
- {
- // Try binding the name.
- int result = this->context_->bind (n[0].id,
- n[0].kind,
- nc,
- CosNaming::ncontext);
- if (result == 1)
- ACE_THROW (CosNaming::NamingContext::AlreadyBound());
-
- // Something went wrong with the internal structure
- else if (result == -1)
- ACE_THROW (CORBA::INTERNAL ());
- }
-}
-
-void
-TAO_Hash_Naming_Context::rebind_context (const CosNaming::Name &n,
- CosNaming::NamingContext_ptr nc,
- CORBA::Environment &ACE_TRY_ENV)
-{
- ACE_GUARD_THROW_EX (ACE_SYNCH_RECURSIVE_MUTEX, ace_mon,
- this->lock_,
- CORBA::INTERNAL ());
- ACE_CHECK;
-
- // Check to make sure this object didn't have <destroy> method
- // invoked on it.
- if (this->destroyed_)
- ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
-
- // Get the length of the name.
- CORBA::ULong name_len = n.length ();
-
- // Check for invalid name.
- if (name_len == 0)
- ACE_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 (name_len > 1)
- {
- CosNaming::NamingContext_var context =
- get_context (n, ACE_TRY_ENV);
- ACE_CHECK;
-
- CosNaming::Name simple_name;
- simple_name.length (1);
- simple_name[0] = n[name_len - 1];
- context->rebind_context (simple_name, nc, ACE_TRY_ENV);
- ACE_CHECK;
- }
- else
- // If we received a simple name, we need to rebind it in this
- // context.
- {
- int result = this->context_->rebind (n[0].id,
- n[0].kind,
- nc,
- CosNaming::ncontext);
- // Check for error conditions.
- if (result == -1)
- ACE_THROW (CORBA::INTERNAL ());
-
- else if (result == -2)
- ACE_THROW (CosNaming::NamingContext::NotFound
- (CosNaming::NamingContext::not_context,
- n));
- }
-}
-
-CORBA::Object_ptr
-TAO_Hash_Naming_Context::resolve (const CosNaming::Name& n,
- CORBA::Environment &ACE_TRY_ENV)
-{
- ACE_GUARD_THROW_EX (ACE_SYNCH_RECURSIVE_MUTEX, ace_mon, this->lock_,
- CORBA::INTERNAL ());
- ACE_CHECK_RETURN (CORBA::Object::_nil ());
-
- // Check to make sure this object didn't have <destroy> method
- // invoked on it.
- if (this->destroyed_)
- ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
- CORBA::Object::_nil ());
-
- // Get the length of the name.
- CORBA::ULong name_len = n.length ();
-
- // Check for invalid name.
- if (name_len == 0)
- ACE_THROW_RETURN (CosNaming::NamingContext::InvalidName(),
- CORBA::Object::_nil ());
-
- // Resolve the first component of the name.
-
- // Stores the binding type for the first name component.
- CosNaming::BindingType type;
- // Stores the object reference bound to the first name component.
- CORBA::Object_ptr obj = CORBA::Object::_nil ();
-
- if (this->context_->find (n[0].id,
- n[0].kind,
- obj,
- type) == -1)
- ACE_THROW_RETURN (CosNaming::NamingContext::NotFound
- (CosNaming::NamingContext::missing_node,
- n),
- CORBA::Object::_nil ());
-
- // Store the value in var to avoid memory leaks.
- CORBA::Object_var result = obj;
-
- // If the name we have to resolve is a compound name, we need to
- // resolve it recursively.
- if (name_len > 1)
- {
- CosNaming::NamingContext_var context =
- CosNaming::NamingContext::_nil ();
-
- if (type == CosNaming::ncontext)
- {
- // Narrow to NamingContext.
- context = CosNaming::NamingContext::_narrow (result.in (),
- ACE_TRY_ENV);
- ACE_CHECK_RETURN (result._retn ());
- }
- else
- // The first name component wasn't bound to a NamingContext.
- ACE_THROW_RETURN (CosNaming::NamingContext::NotFound
- (CosNaming::NamingContext::not_context,
- n),
- CORBA::Object::_nil ());
-
- // If narrow failed...
- if (CORBA::is_nil (context.in ()))
- ACE_THROW_RETURN (CosNaming::NamingContext::NotFound
- (CosNaming::NamingContext::not_context,
- n),
- CORBA::Object::_nil ());
- else
- {
- // Successfully resolved the first name component, need to
- // 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,
- ACE_TRY_ENV);
- }
- }
- // If the name we had to resolve was simple, we just need to return
- // the result.
- return result._retn ();
-}
-
-void
-TAO_Hash_Naming_Context::unbind (const CosNaming::Name& n,
- CORBA::Environment &ACE_TRY_ENV)
-{
- ACE_GUARD_THROW_EX (ACE_SYNCH_RECURSIVE_MUTEX, ace_mon,
- this->lock_,
- CORBA::INTERNAL ());
- ACE_CHECK;
-
- // Check to make sure this object didn't have <destroy> method
- // invoked on it.
- if (this->destroyed_)
- ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
-
- // Get the length of the name.
- CORBA::ULong name_len = n.length ();
-
- // Check for invalid name.
- if (name_len == 0)
- ACE_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 (name_len > 1)
- {
- CosNaming::NamingContext_var context =
- get_context (n, ACE_TRY_ENV);
- ACE_CHECK;
-
- CosNaming::Name simple_name;
- simple_name.length (1);
- simple_name[0] = n[name_len - 1];
- context->unbind (simple_name, ACE_TRY_ENV);
- ACE_CHECK;
- }
- // If we received a simple name, we need to unbind it in this
- // context.
- else
- if (this->context_->unbind (n[0].id,
- n[0].kind) == -1)
- ACE_THROW (CosNaming::NamingContext::NotFound
- (CosNaming::NamingContext::missing_node,
- n));
-}
-
-CosNaming::NamingContext_ptr
-TAO_Hash_Naming_Context::bind_new_context (const CosNaming::Name& n,
- CORBA::Environment &ACE_TRY_ENV)
-{
- ACE_GUARD_THROW_EX (ACE_SYNCH_RECURSIVE_MUTEX,
- ace_mon,
- this->lock_,
- CORBA::INTERNAL ());
- ACE_CHECK_RETURN (CosNaming::NamingContext::_nil ());
-
- // Check to make sure this object didn't have <destroy> method
- // invoked on it.
- if (this->destroyed_)
- ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
- CosNaming::NamingContext::_nil ());
-
- // Stores our new Naming Context.
- CosNaming::NamingContext_var result =
- CosNaming::NamingContext::_nil ();
-
- // Create new context.
- result = new_context (ACE_TRY_ENV);
- ACE_CHECK_RETURN (CosNaming::NamingContext::_nil ());
-
- // Bind the new context to the name.
- ACE_TRY
- {
- bind_context (n,
- result.in (),
- ACE_TRY_ENV);
- ACE_TRY_CHECK;
- }
- ACE_CATCHANY
- {
- {
- ACE_DECLARE_NEW_CORBA_ENV;
- result->destroy (ACE_TRY_ENV);
- }
- ACE_RETHROW;
- }
- ACE_ENDTRY;
- ACE_CHECK_RETURN (CosNaming::NamingContext::_nil ());
-
- return result._retn ();
-}
-
-void
-TAO_Hash_Naming_Context::destroy (CORBA::Environment &ACE_TRY_ENV)
-{
- ACE_GUARD_THROW_EX (ACE_SYNCH_RECURSIVE_MUTEX,
- ace_mon,
- this->lock_,
- CORBA::INTERNAL ());
- ACE_CHECK;
-
- // Check to make sure this object didn't have <destroy> method
- // invoked on it.
- if (this->destroyed_)
- ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
-
- if (this->context_->current_size () != 0)
- ACE_THROW (CosNaming::NamingContext::NotEmpty());
-
- // Destroy is a no-op on a root context.
- if (root ())
- return;
-
- else
- {
- this->destroyed_ = 1;
-
- // Remove self from POA. Because of reference counting, the POA
- // will automatically delete the servant when all pending requests
- // on this servant are complete.
-
- PortableServer::POA_var poa =
- this->_default_POA ();
-
- PortableServer::ObjectId_var id =
- PortableServer::string_to_ObjectId (poa_id_.fast_rep ());
-
- ACE_CHECK;
-
- poa->deactivate_object (id.in (),
- ACE_TRY_ENV);
- ACE_CHECK;
- }
-}
-
-int
-TAO_Hash_Naming_Context::root (void)
-{
- return (ACE_OS::strcmp (this->poa_id_.fast_rep (),
- TAO_ROOT_NAMING_CONTEXT) == 0);
-}
-
-int
-TAO_Hash_Naming_Context::destroyed (void)
-{
- return this->destroyed_;
-}
-
-TAO_Naming_Context *
-TAO_Hash_Naming_Context::interface (void)
-{
- return this->interface_;
-}
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Hash_Naming_Context.h b/TAO/orbsvcs/orbsvcs/Naming/Hash_Naming_Context.h
deleted file mode 100644
index b37759e94cf..00000000000
--- a/TAO/orbsvcs/orbsvcs/Naming/Hash_Naming_Context.h
+++ /dev/null
@@ -1,227 +0,0 @@
-/* -*- C++ -*- */
-// $Id$
-// ============================================================================
-//
-// = LIBRARY
-// cos
-//
-// = FILENAME
-// Hash_Naming_Context.h
-//
-// = AUTHOR
-// Marina Spivak <marina@cs.wustl.edu>
-//
-// ============================================================================
-
-#ifndef TAO_HASH_NAMING_CONTEXT_H
-#define TAO_HASH_NAMING_CONTEXT_H
-
-#include "Naming_Context.h"
-
-// This is to remove "inherits via dominance" warnings from MSVC.
-#if defined (_MSC_VER)
-# pragma warning (disable : 4250)
-#endif /* _MSC_VER */
-
-class TAO_ORBSVCS_Export TAO_Bindings_Map
-{
- // = TITLE
- // This abstract base class defines an interface for hash-based
- // data structures used in implementations of NamingContext
- // (i.e., TAO_Transient_Naming_Context and TAO_Persistent_Naming_Context)
- //
- // = DESCRIPTION
- // Define an interface for several hash-based data structures, so
- // that we can write some code that would work with any of them,
- // i.e., TAO_Hash_Naming_Context.
-
-public:
-
- virtual ~TAO_Bindings_Map (void);
- // Destructor.
-
- virtual size_t current_size (void) = 0;
- // Return current number of entries (name bindings) in the
- // underlying hash map.
-
- virtual int bind (const char *id,
- const char *kind,
- CORBA::Object_ptr obj,
- CosNaming::BindingType type) = 0;
- // Add a binding with the specified parameters to the table.
- // Return 0 on success and -1 on failure, 1 if there already is a
- // binding with <id> and <kind>.
-
- virtual int rebind (const char *id,
- const char *kind,
- CORBA::Object_ptr obj,
- CosNaming::BindingType type) = 0;
- // Overwrite a binding containing <id> and <kind> (or create a new
- // one if one doesn't exist) with the specified parameters. Returns
- // -1 on failure.
-
- virtual int unbind (const char * id,
- const char * kind) = 0;
- // Remove a binding containing <id> and <kind> from the table.
- // Return 0 on success and -1 on failure.
-
- virtual int find (const char * id,
- const char * kind,
- CORBA::Object_ptr & obj,
- CosNaming::BindingType &type) = 0;
- // Find the binding containing <id> and <kind> in the table, and
- // pass binding's type and object back to the caller by reference.
- // Return 0 on success and -1 on failure. Note: a 'duplicated' object
- // reference is assigned to <obj>, so the caller is responsible for
- // its deallocation.
-
-};
-
-class TAO_ORBSVCS_Export TAO_Hash_Naming_Context :public TAO_Naming_Context_Impl
-{
- // = TITLE
- // This class factors out common code for two 'ConcreteImplementors'
- // in the Bridge pattern architecture of the CosNaming::NamingContext
- // implementation.
- //
- // = DESCRIPTION
- // 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.
- //
-public:
- // = Initialization and termination methods.
- TAO_Hash_Naming_Context (PortableServer::POA_ptr poa,
- const char *poa_id);
- // Constructor.
-
- void interface (TAO_Naming_Context *i);
- // Set our <interface_> pointer.
-
- virtual ~TAO_Hash_Naming_Context (void);
- // Destructor.
-
- // = Accessors.
-
- TAO_Naming_Context *interface (void);
- // Get the pointer to our <interface>.
-
- int root (void);
- // Returns true if this Naming Context is a root Naming Context for
- // the server, and false otherwise.
-
- int destroyed (void);
- // Returns true if this context had <destroy> operation invoked on
- // it, and false otherwise.
-
- // = CosNaming::NamingContext idl interface methods.
-
- virtual void bind (const CosNaming::Name &n,
- CORBA::Object_ptr obj,
- CORBA::Environment &ACE_TRY_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 &ACE_TRY_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 &ACE_TRY_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 &ACE_TRY_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 &ACE_TRY_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 &ACE_TRY_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 bind_new_context (const CosNaming::Name &n,
- CORBA::Environment &ACE_TRY_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 &ACE_TRY_ENV);
- // Delete the naming context. The user should take care to <unbind> any
- // bindings in which the given context is bound to some names, to
- // avoid dangling references when invoking <destroy> operation.
- // NOTE: <destory> is a no-op on the root context.
- // NOTE: after <destroy> is invoked on a Naming Context, all
- // BindingIterators associated with that Naming Context are also destroyed.
-
- virtual PortableServer::POA_ptr _default_POA (void);
- // Returns the Default POA of this Servant object
-
-protected:
- // = Helper method used by other methods.
-
- CosNaming::NamingContext_ptr get_context (const CosNaming::Name &name,
- CORBA::Environment &_env);
- // <get_context> is used by methods that need to resolve a compound
- // name before performing the actual operation (e.g., bind,
- // unbind, etc.) <get_context> takes a full name (including the
- // last component that doesn't need to be resolved), and returns a
- // pointer to the target context.
-
- TAO_Bindings_Map *context_;
- // Pointer to the data structure used to store this Naming Context's
- // bindings. <context_> is initialized with a concrete data
- // structure by subclasses, which know which data structure to use.
-
- TAO_Naming_Context *interface_;
- // Pointer to the <interface> object for which we serve as a
- // <concrete implementation>, i.e., the object that delegates to us
- // all client CosNaming::NamingContext CORBA calls.
- // We need this pointer for reference counting.
-
- ACE_SYNCH_RECURSIVE_MUTEX lock_;
- // Lock used to serialize access to the underlying data structure.
-
- int destroyed_;
- // 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.
-
- PortableServer::POA_var poa_;
- // POA we are registered with.
-
- ACE_CString poa_id_;
- // ID with which we are registered with <poa_>.
- // Note, if <poa_id_> 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.
-};
-
-#endif /* TAO_HASH_NAMING_CONTEXT_H */
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Makefile.am b/TAO/orbsvcs/orbsvcs/Naming/Makefile.am
deleted file mode 100644
index 65f3bb1b56d..00000000000
--- a/TAO/orbsvcs/orbsvcs/Naming/Makefile.am
+++ /dev/null
@@ -1,42 +0,0 @@
-##---------------------------------------------------------------------------
-## $Id$
-##
-## Makefile for TAO's Naming Service library
-##
-##---------------------------------------------------------------------------
-
-##
-## Process this file with automake to create Makefile.in
-##
-
-## The number in AUTOMAKE_OPTIONS is the minimum required version automake
-## needed to process this file.
-AUTOMAKE_OPTIONS = 1.4
-
-INCLUDES = -I$(top_builddir) -I$(top_srcdir)
-
-lib_LTLIBRARIES = libTAO_Naming.la
-
-libTAO_Naming_la_LDADD = \
- $(top_builddir)/ace/libACE.la $(top_builddir)/TAO/tao/libTAO.la
-
-libTAO_Naming_la_SOURCES = \
- Entries.cpp \
- Hash_Naming_Context.cpp \
- Naming_Context.cpp \
- Naming_Utils.cpp
-
-noinst_HEADERS = \
- Entries.h \
- Hash_Naming_Context.h \
- Naming_Context.h \
- Naming_Utils.h
-
-EXTRA_DIST = README
-
-## Clean up some additional files/directories possibly created during
-## the configure script tests.
-clean-local:
- -rm -f *.bak *.rpo *.sym lib*.*_pure_* Makefile.old core
- -rm -rf ptrepository Templates.DB gcctemp.c gcctemp so_locations
-
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Naming_Context.cpp b/TAO/orbsvcs/orbsvcs/Naming/Naming_Context.cpp
deleted file mode 100644
index 335fb60c1ee..00000000000
--- a/TAO/orbsvcs/orbsvcs/Naming/Naming_Context.cpp
+++ /dev/null
@@ -1,144 +0,0 @@
-// $Id$
-// ============================================================================
-//
-// = LIBRARY
-// cos
-//
-// = FILENAME
-// Naming_Context.cpp
-//
-// = AUTHOR
-// Marina Spivak <marina@cs.wustl.edu>
-//
-// ============================================================================
-
-#include "Naming_Context.h"
-
-TAO_Naming_Context::TAO_Naming_Context (TAO_Naming_Context_Impl *impl)
- : impl_ (impl)
-{
-}
-
-TAO_Naming_Context::~TAO_Naming_Context (void)
-{
- delete impl_;
-}
-
-PortableServer::POA_ptr
-TAO_Naming_Context::_default_POA (CORBA::Environment &/*env*/)
-{
- return impl_->_default_POA ();
-}
-
-void
-TAO_Naming_Context::bind (const CosNaming::Name &n,
- CORBA::Object_ptr obj,
- CORBA::Environment &ACE_TRY_ENV)
- ACE_THROW_SPEC ((CORBA::SystemException,
- CosNaming::NamingContext::NotFound,
- CosNaming::NamingContext::CannotProceed,
- CosNaming::NamingContext::InvalidName,
- CosNaming::NamingContext::AlreadyBound))
-{
- impl_->bind (n, obj, ACE_TRY_ENV);
-}
-
-void
-TAO_Naming_Context::rebind (const CosNaming::Name &n,
- CORBA::Object_ptr obj,
- CORBA::Environment &ACE_TRY_ENV)
- ACE_THROW_SPEC ((CORBA::SystemException,
- CosNaming::NamingContext::NotFound,
- CosNaming::NamingContext::CannotProceed,
- CosNaming::NamingContext::InvalidName))
-{
- impl_->rebind (n, obj, ACE_TRY_ENV);
-}
-
-void
-TAO_Naming_Context::bind_context (const CosNaming::Name &n,
- CosNaming::NamingContext_ptr nc,
- CORBA::Environment &ACE_TRY_ENV)
- ACE_THROW_SPEC ((CORBA::SystemException,
- CosNaming::NamingContext::NotFound,
- CosNaming::NamingContext::CannotProceed,
- CosNaming::NamingContext::InvalidName,
- CosNaming::NamingContext::AlreadyBound))
-{
- impl_->bind_context (n, nc, ACE_TRY_ENV);
-}
-
-void
-TAO_Naming_Context::rebind_context (const CosNaming::Name &n,
- CosNaming::NamingContext_ptr nc,
- CORBA::Environment &ACE_TRY_ENV)
- ACE_THROW_SPEC ((CORBA::SystemException,
- CosNaming::NamingContext::NotFound,
- CosNaming::NamingContext::CannotProceed,
- CosNaming::NamingContext::InvalidName))
-{
- impl_->rebind_context (n, nc, ACE_TRY_ENV);
-}
-
-CORBA::Object_ptr
-TAO_Naming_Context::resolve (const CosNaming::Name &n,
- CORBA::Environment &ACE_TRY_ENV)
- ACE_THROW_SPEC ((CORBA::SystemException,
- CosNaming::NamingContext::NotFound,
- CosNaming::NamingContext::CannotProceed,
- CosNaming::NamingContext::InvalidName))
-{
- return impl_->resolve (n, ACE_TRY_ENV);
-}
-
-void
-TAO_Naming_Context::unbind (const CosNaming::Name &n,
- CORBA::Environment &ACE_TRY_ENV)
- ACE_THROW_SPEC ((CORBA::SystemException,
- CosNaming::NamingContext::NotFound,
- CosNaming::NamingContext::CannotProceed,
- CosNaming::NamingContext::InvalidName))
-{
- impl_->unbind (n, ACE_TRY_ENV);
-}
-
-CosNaming::NamingContext_ptr
-TAO_Naming_Context::new_context (CORBA::Environment &ACE_TRY_ENV)
- ACE_THROW_SPEC ((CORBA::SystemException))
-{
- return impl_->new_context (ACE_TRY_ENV);
-}
-
-CosNaming::NamingContext_ptr
-TAO_Naming_Context::bind_new_context (const CosNaming::Name &n,
- CORBA::Environment &ACE_TRY_ENV)
- ACE_THROW_SPEC ((CORBA::SystemException,
- CosNaming::NamingContext::NotFound,
- CosNaming::NamingContext::AlreadyBound,
- CosNaming::NamingContext::CannotProceed,
- CosNaming::NamingContext::InvalidName))
-{
- return impl_->bind_new_context (n, ACE_TRY_ENV);
-}
-
-void
-TAO_Naming_Context::destroy (CORBA::Environment &ACE_TRY_ENV)
- ACE_THROW_SPEC ((CORBA::SystemException,
- CosNaming::NamingContext::NotEmpty))
-{
- impl_->destroy (ACE_TRY_ENV);
-}
-
-void
-TAO_Naming_Context::list (CORBA::ULong how_many,
- CosNaming::BindingList_out bl,
- CosNaming::BindingIterator_out bi,
- CORBA::Environment &ACE_TRY_ENV)
- ACE_THROW_SPEC ((CORBA::SystemException))
-{
- impl_->list (how_many, bl, bi, ACE_TRY_ENV);
-}
-
-TAO_Naming_Context_Impl::~TAO_Naming_Context_Impl (void)
-{
-}
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Naming_Context.h b/TAO/orbsvcs/orbsvcs/Naming/Naming_Context.h
deleted file mode 100644
index 7aadc9fe6bf..00000000000
--- a/TAO/orbsvcs/orbsvcs/Naming/Naming_Context.h
+++ /dev/null
@@ -1,294 +0,0 @@
-/* -*- C++ -*- */
-// $Id$
-// ============================================================================
-//
-// = LIBRARY
-// cos
-//
-// = FILENAME
-// Naming_Context.h
-//
-// = AUTHOR
-// Marina Spivak <marina@cs.wustl.edu>
-//
-// ============================================================================
-
-#ifndef TAO_NAMING_CONTEXT_H
-#define TAO_NAMING_CONTEXT_H
-
-#include "orbsvcs/CosNamingS.h"
-
-class TAO_Naming_Context_Impl;
-
-// This is to remove "inherits via dominance" warnings from MSVC.
-#if defined (_MSC_VER)
-# pragma warning (disable : 4250)
-#endif /* _MSC_VER */
-
-class TAO_ORBSVCS_Export TAO_Naming_Context :
- public virtual PortableServer::RefCountServantBase,
- public virtual POA_CosNaming::NamingContext
-{
- // = TITLE
- // This class plays a role of the 'Abstraction' (aka 'Interface')
- // in the Bridge pattern architecture of the
- // CosNaming::NamingContext implementation.
- //
- // = DESCRIPTION
- // This class simply forwards all client requests to a concrete
- // NamingContext implementation through its <impl_> pointer. See
- // README file for more info. Comments for the idl methods
- // describe methods semantics - actual actions are carried out by
- // concrete implementors.
-
-public:
-
- // = Initialization and termination methods.
- TAO_Naming_Context (TAO_Naming_Context_Impl *impl);
- // Constructor. Initializes <impl_> with a concrete implementation.
-
- ~TAO_Naming_Context (void);
- // Destructor.
-
- // = CosNaming::NamingContext idl interface methods.
-
- virtual void bind (const CosNaming::Name &n,
- CORBA::Object_ptr obj,
- CORBA::Environment &ACE_TRY_ENV =
- TAO_default_environment ())
- ACE_THROW_SPEC ((CORBA::SystemException,
- CosNaming::NamingContext::NotFound,
- CosNaming::NamingContext::CannotProceed,
- CosNaming::NamingContext::InvalidName,
- CosNaming::NamingContext::AlreadyBound));
-
- // 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 &ACE_TRY_ENV =
- TAO_default_environment ())
- ACE_THROW_SPEC ((CORBA::SystemException,
- CosNaming::NamingContext::NotFound,
- CosNaming::NamingContext::CannotProceed,
- CosNaming::NamingContext::InvalidName));
-
- // 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 &ACE_TRY_ENV =
- TAO_default_environment ())
- ACE_THROW_SPEC ((CORBA::SystemException,
- CosNaming::NamingContext::NotFound,
- CosNaming::NamingContext::CannotProceed,
- CosNaming::NamingContext::InvalidName,
- CosNaming::NamingContext::AlreadyBound));
-
- // 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 &ACE_TRY_ENV =
- TAO_default_environment ())
- ACE_THROW_SPEC ((CORBA::SystemException,
- CosNaming::NamingContext::NotFound,
- CosNaming::NamingContext::CannotProceed,
- CosNaming::NamingContext::InvalidName));
- // 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 &ACE_TRY_ENV =
- TAO_default_environment ())
- ACE_THROW_SPEC ((CORBA::SystemException,
- CosNaming::NamingContext::NotFound,
- CosNaming::NamingContext::CannotProceed,
- CosNaming::NamingContext::InvalidName));
- // 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 &ACE_TRY_ENV =
- TAO_default_environment ())
- ACE_THROW_SPEC ((CORBA::SystemException,
- CosNaming::NamingContext::NotFound,
- CosNaming::NamingContext::CannotProceed,
- CosNaming::NamingContext::InvalidName));
-
- // 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 &ACE_TRY_ENV =
- TAO_default_environment ())
- ACE_THROW_SPEC ((CORBA::SystemException));
-
- // 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 &ACE_TRY_ENV =
- TAO_default_environment ())
- ACE_THROW_SPEC ((CORBA::SystemException,
- CosNaming::NamingContext::NotFound,
- CosNaming::NamingContext::AlreadyBound,
- CosNaming::NamingContext::CannotProceed,
- CosNaming::NamingContext::InvalidName));
-
- // 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 &ACE_TRY_ENV =
- TAO_default_environment ())
- ACE_THROW_SPEC ((CORBA::SystemException,
- CosNaming::NamingContext::NotEmpty));
- // Delete the naming context. The user should take care to <unbind> any
- // bindings in which the given context is bound to some names, to
- // avoid dangling references when invoking <destroy> operation.
- // NOTE: <destory> is a no-op on the root context.
- // NOTE: after <destroy> is invoked on a Naming Context, all
- // BindingIterators associated with that Naming Context are also destroyed.
-
- virtual void list (CORBA::ULong how_many,
- CosNaming::BindingList_out bl,
- CosNaming::BindingIterator_out bi,
- CORBA::Environment &ACE_TRY_ENV =
- TAO_default_environment ())
- ACE_THROW_SPEC ((CORBA::SystemException));
-
- // 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.
-
- virtual PortableServer::POA_ptr _default_POA (CORBA::Environment &env = TAO_default_environment ());
- // Returns the Default POA of this Servant object
-
-protected:
-
- TAO_Naming_Context_Impl *impl_;
- // A concrete implementor of the NamingContext functions.
-};
-
-class TAO_ORBSVCS_Export TAO_Naming_Context_Impl
-{
- // = TITLE
- // This abstract base class plays a role of the 'Implementor' in the Bridge
- // pattern architecture of the NamingContext implementation.
- //
- // = DESCRIPTION
- // Subclasses of TAO_Naming_Context_Impl provide concrete
- // implementations of the NamingContext functionality.
-
-public:
-
- virtual ~TAO_Naming_Context_Impl (void);
- // Destructor.
-
- // = CosNaming::NamingContext idl interface methods.
-
- virtual void bind (const CosNaming::Name &n,
- CORBA::Object_ptr obj,
- CORBA::Environment &ACE_TRY_ENV) = 0;
- // 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 &ACE_TRY_ENV) = 0;
- // 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 &ACE_TRY_ENV) = 0;
- // 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 &ACE_TRY_ENV) = 0;
- // 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 &ACE_TRY_ENV) = 0;
- // 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 &ACE_TRY_ENV) = 0;
- // 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
- &ACE_TRY_ENV) = 0;
- // 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 &ACE_TRY_ENV) = 0;
- // 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 &ACE_TRY_ENV) = 0;
- // Delete the naming context. The user should take care to <unbind> any
- // bindings in which the given context is bound to some names, to
- // avoid dangling references when invoking <destroy> operation.
- // NOTE: <destory> is a no-op on the root context.
- // NOTE: after <destroy> is invoked on a Naming Context, all
- // BindingIterators associated with that Naming Context are also destroyed.
-
- virtual void list (CORBA::ULong how_many,
- CosNaming::BindingList_out &bl,
- CosNaming::BindingIterator_out &bi,
- CORBA::Environment &ACE_TRY_ENV) = 0;
- // 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.
-
- virtual PortableServer::POA_ptr _default_POA (void) = 0;
- // Returns the Default POA of this Servant object
-};
-
-
-#endif /* TAO_NAMING_CONTEXT_H */
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp b/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp
deleted file mode 100644
index eba715964bf..00000000000
--- a/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp
+++ /dev/null
@@ -1,317 +0,0 @@
-// $Id$
-
-#include "orbsvcs/CosNamingC.h"
-#include "tao/corba.h"
-#include "Naming_Utils.h"
-#include "ace/Arg_Shifter.h"
-#include "Transient_Naming_Context.h"
-#include "Persistent_Context_Index.h"
-#include "ace/Auto_Ptr.h"
-
-ACE_RCSID(Naming, Naming_Utils, "$Id$")
-
-TAO_Naming_Server::TAO_Naming_Server (void)
- : naming_context_ (),
- ior_multicast_ (0),
- naming_service_ior_ (),
- context_index_ (0)
-{
-}
-
-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,
- LPCTSTR persistence_location)
- : naming_context_ (),
- ior_multicast_ (0),
- naming_service_ior_ (),
- context_index_ (0)
-{
- if (this->init (orb,
- poa,
- context_size,
- timeout,
- resolve_for_existing_naming_service,
- persistence_location) == -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,
- LPCTSTR persistence_location)
-{
- if (resolve_for_existing_naming_service)
- {
- ACE_DECLARE_NEW_CORBA_ENV;
- ACE_TRY
- {
- //
- // Try to find an existing Naming Service.
- //
- CORBA::Object_var naming_obj =
- orb->resolve_initial_references ("NameService",
- timeout,
- ACE_TRY_ENV);
- ACE_TRY_CHECK;
-
- if (!CORBA::is_nil (naming_obj.in ()))
- {
- //
- // Success in finding a Naming Service.
- //
- if (TAO_debug_level > 0)
- ACE_DEBUG ((LM_DEBUG,
- "\nNameService found!\n"));
-
- this->naming_context_ =
- CosNaming::NamingContext::_narrow (naming_obj.in (),
- ACE_TRY_ENV);
- ACE_TRY_CHECK;
-
- this->naming_service_ior_ =
- orb->object_to_string (naming_obj.in (),
- ACE_TRY_ENV);
- ACE_TRY_CHECK;
-
- return 0;
- }
- }
- ACE_CATCHANY
- {
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "TAO_Naming_Server::init");
- }
- ACE_ENDTRY;
- ACE_CHECK_RETURN (-1);
- }
-
- if (TAO_debug_level > 0)
- ACE_DEBUG ((LM_DEBUG,
- "\nWe'll become a NameService\n"));
-
- // Become a Naming Service.
- return this->init_new_naming (orb,
- poa,
- persistence_location,
- context_size);
-}
-
-int
-TAO_Naming_Server::init_new_naming (CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- LPCTSTR persistence_location,
- size_t context_size)
-{
- ACE_DECLARE_NEW_CORBA_ENV;
- ACE_TRY
- {
- if (persistence_location != 0)
- //
- // Initialize Persistent Naming Service.
- //
- {
- // Allocate and initialize Persistent Context Index.
- ACE_NEW_RETURN (this->context_index_,
- TAO_Persistent_Context_Index (orb, poa),
- -1);
-
- if (this->context_index_->open (persistence_location) == -1
- || this->context_index_->init (context_size) == -1)
- {
- if (TAO_debug_level >0)
- ACE_DEBUG ((LM_DEBUG,
- "TAO_Naming_Server: context_index initialization failed\n"));
- return -1;
- }
-
- // Set the root Naming Context reference and ior.
- this->naming_service_ior_= this->context_index_->root_ior ();
-
- CORBA::Object_var obj =
- orb->string_to_object (this->naming_service_ior_.in (),
- ACE_TRY_ENV);
- ACE_TRY_CHECK;
-
- this->naming_context_ =
- CosNaming::NamingContext::_narrow (obj.in (),
- ACE_TRY_ENV);
- ACE_TRY_CHECK;
- }
- else
- {
- //
- // Initialize Transient Naming Service.
- //
- this->naming_context_ =
- TAO_Transient_Naming_Context::make_new_context (poa,
- TAO_ROOT_NAMING_CONTEXT,
- context_size,
- ACE_TRY_ENV);
- ACE_TRY_CHECK;
-
- // Set the root Naming Context ior.
- this->naming_service_ior_=
- orb->object_to_string (this->naming_context_.in (),
- ACE_TRY_ENV);
- ACE_TRY_CHECK;
- }
-
- // Make the Naming Service locatable through iioploc.
- if (orb->_tao_add_to_IOR_table ("NameService",
- this->naming_context_.in ())
- == -1)
- {
- if (TAO_debug_level >0)
- ACE_DEBUG ((LM_DEBUG,
- "TAO_Naming_Server: cannot add to ior table.\n"));
- return -1;
- }
-#if defined (ACE_HAS_IP_MULTICAST)
- //
- // Install ior multicast handler.
- //
- // 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
- // on the command-line;
- u_short port =
- TAO_ORB_Core_instance ()->orb_params ()->name_service_port ();
-
- if (port == 0)
- {
- // Check environment var. for multicast port.
- const char *port_number =
- ACE_OS::getenv ("NameServicePort");
-
- if (port_number != 0)
- port = ACE_OS::atoi (port_number);
- }
-
- // Port wasn't specified on the command-line or in environment -
- // use the default.
- if (port == 0)
- port = TAO_DEFAULT_NAME_SERVER_REQUEST_PORT;
-
- // Instantiate a handler which will handle client requests for
- // the root Naming Context ior, received on the multicast port.
- 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,
- "TAO_Naming_Server: cannot register Event handler\n"));
- return -1;
- }
-
- if (TAO_debug_level > 0)
- ACE_DEBUG ((LM_DEBUG,
- "TAO_Naming_Server: The multicast server setup is done.\n"));
-
-#endif /* ACE_HAS_IP_MULTICAST */
- }
- ACE_CATCHANY
- {
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "TAO_Naming_Server");
- return -1;
- }
- ACE_ENDTRY;
- ACE_CHECK_RETURN (-1);
-
- return 0;
-}
-
-CORBA::String
-TAO_Naming_Server::naming_service_ior (void)
-{
- return CORBA::string_dup (this->naming_service_ior_.in ());
-}
-
-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 context_index_;
-}
-
-CosNaming::NamingContext_ptr
-TAO_Naming_Client::operator -> (void) const
-{
- return this->naming_context_.ptr ();
-}
-
-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)
-{
- ACE_DECLARE_NEW_CORBA_ENV;
- ACE_TRY
- {
- CORBA::Object_var naming_obj =
- orb->resolve_initial_references ("NameService", timeout, ACE_TRY_ENV);
- ACE_TRY_CHECK;
-
- 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 (),
- ACE_TRY_ENV);
- ACE_TRY_CHECK;
- }
- ACE_CATCHANY
- {
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "init");
- return -1;
- }
- ACE_ENDTRY;
- ACE_CHECK_RETURN (-1);
-
- 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 83f4c85eed7..00000000000
--- a/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/* -*- C++ -*- */
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// TAO/orbsvcs/Naming_Service
-//
-// = FILENAME
-// Naming_Utils.h
-//
-// = DESCRIPTION
-// Implement wrappers useful to Naming Service clients and servers.
-//
-// = AUTHORS
-// Nagarajan Surendran (naga@cs.wustl.edu), Matt Braun
-// <mjb2@cs.wustl.edu>, and Douglas C. Schmidt <schmidt@cs.wustl.edu>.
-//
-// ============================================================================
-
-#ifndef TAO_NAMING_UTILS_H
-#define TAO_NAMING_UTILS_H
-
-#include "tao/corba.h"
-#include "orbsvcs/CosNamingC.h"
-#include "orbsvcs/IOR_Multicast.h"
-#include "Naming_Context.h"
-
-// Forward decl;
-class TAO_Persistent_Context_Index;
-
-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 (if the
- // <resolve_for_existing_naming_service> flag is set) or creates
- // one (if <resolve_for_existing_naming_service> flag isn't set or
- // Naming Service was not found). This class also defines the
- // operator-> so that <NamingContext> functions like <bind>,
- // <unbind> .. can be called directly on a <TAO_Naming_Server>
- // object, and be forwareded to the root Naming Context.
- // This class is intended to simplify
- // programs that want to play the role of a Naming Service
- // server. To simplify programs that want to play the role of
- // Naming Service clients, use <TAO_Naming_Client>.
- //
- // If a Naming Service is created locally, a TAO_IOR_Multicast
- // event handler is created and installed on the ORB's reactor.
- // This event handler allows other clients on the network to
- // discover and use this Naming Service.
- // Event handler listens on a multicast port for messages from
- // clients looking for a Naming Service, and sends back the ior
- // of the root Naming Context. For more information on how this
- // bootstraping through a multicast process works, check out
- // orbsvcs/orbsvcs/TAO_IOR_Multicast.*, implementation of
- // <resolve_initial_references>, and orbsvcs/Naming/README.
-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,
- LPCTSTR persistence_location = 0);
- // Constructor. Attempts to find an existing Naming Service if
- // <resolve_for_existing_naming_service> is set to true. If it is
- // false, or no Naming Service was found during a <timeout> period,
- // create the Naming Service in this process. If creating the
- // Naming Service locally, make the root context of size
- // <context_size>, register it under the <poa>, and make the Naming
- // Service persistent if <persistence_location> is not 0.
- // (<persistence_location> specifies name of the file to use for
- // persistent storage).
-
- 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,
- LPCTSTR persistence_location = 0);
- // Initializer. Attempts to find an existing Naming Service if
- // <resolve_for_existing_naming_service> is set to true. If it is
- // false, or no Naming Service was found during a <timeout> period,
- // create the Naming Service in this process. If creating the
- // Naming Service locally, make the root context of size
- // <context_size>, register it under the <poa>, and make the Naming
- // Service persistent if <persistence_location> is not 0.
- // (<persistence_location> specifies name of the file to use for
- // persistent storage).
-
- ~TAO_Naming_Server (void);
- // Destructor.
-
- CORBA::String naming_service_ior (void);
- // Returns the IOR of the naming service.
-
- CosNaming::NamingContext_ptr operator-> (void) const;
- // Returns a <NamingContext_ptr> for the root Naming Context.
-
-protected:
- int init_new_naming (CORBA::ORB_ptr orb,
- PortableServer::POA_ptr root_poa,
- LPCTSTR persistence_location,
- size_t context_size);
- // Helper method: create Naming Service locally.
- // Make the root context of size
- // <context_size>, register it under the <root_poa>, and make the Naming
- // Service persistent if <persistence_location> is not 0.
- // (<persistence_location> specifies name of the file to use for
- // persistent storage).
-
- CosNaming::NamingContext_var naming_context_;
- // Root NamingContext_ptr.
-
- TAO_IOR_Multicast *ior_multicast_;
- // The ior_multicast event handler.
-
- CORBA::String_var naming_service_ior_;
- // The IOR string of the root naming context.
-
- TAO_Persistent_Context_Index *context_index_;
- // Pointer to the object used to create/initialize
- // the Naming Service when local persistent Naming Service is
- // desired.
-};
-
-class TAO_ORBSVCS_Export TAO_Naming_Client
-{
- // = TITLE
- // This class is intended to simplify programs that want to play
- // the role of Naming Service clients.
- //
- // = DESCRIPTION
- // Wrapper class that locates the root Naming Context. It also
- // defines the operator-> so that <NamingContext> functions like
- // <resolve>, etc. can be directly called on a
- // <TAO_Naming_Client> object, and will be forwarded to the root
- // Naming Context.
-public:
- // = Initialization and termination methods.
-
- TAO_Naming_Client (void);
- // Default constructor.
-
- int init (CORBA::ORB_ptr orb,
- ACE_Time_Value *timeout = 0);
- // Look for a Naming Service for a period of <timeout> using
- // <resolve_initial_references>. Return 0 if Naming Service is
- // successfully located, and -1 on failure.
-
- ~TAO_Naming_Client (void);
- // Destructor.
-
- CosNaming::NamingContext_ptr operator-> (void) const;
- // Returns a pointer to the root Naming Context.
-
- CosNaming::NamingContext_ptr get_context (void) const;
- // Returns a pointer to the root Naming Context.
-
-protected:
- CosNaming::NamingContext_var naming_context_;
- // Reference to the root Naming Context.
-};
-
-#endif /* TAO_NAMING_UTILS_H */
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Persistent_Context_Index.cpp b/TAO/orbsvcs/orbsvcs/Naming/Persistent_Context_Index.cpp
deleted file mode 100644
index 97f8ecad34c..00000000000
--- a/TAO/orbsvcs/orbsvcs/Naming/Persistent_Context_Index.cpp
+++ /dev/null
@@ -1,344 +0,0 @@
-// $Id$
-
-#include "Persistent_Context_Index.h"
-#include "Persistent_Naming_Context.h"
-#include "ace/Auto_Ptr.h"
-
-int
-TAO_Persistent_Context_Index::unbind (const char *poa_id)
-{
- ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1);
-
- TAO_Persistent_Index_ExtId name (poa_id);
- TAO_Persistent_Index_IntId entry;
- if (this->index_->unbind (name, entry, this->allocator_) != 0)
- return -1;
- else
- {
- // Free up the memory we allocated in bind().
- this->allocator_->free ((void *) (entry.counter_));
- return 0;
- }
-}
-
-int
-TAO_Persistent_Context_Index::bind (const char *poa_id,
- ACE_UINT32 *&counter,
- TAO_Persistent_Context_Index::CONTEXT *hash_map)
-{
- ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1);
-
- // Allocate memory for items to be stored in the table.
- size_t poa_id_len = ACE_OS::strlen (poa_id) + 1;
- size_t counter_len = sizeof (ACE_UINT32);
- char *ptr = (char *) this->allocator_->malloc (poa_id_len + counter_len);
-
- if (ptr == 0)
- return -1;
- else
- {
- // Populate memory with data.
- counter = ACE_reinterpret_cast (ACE_UINT32 *, ptr);
- *counter = 0;
- char * poa_id_ptr = ptr + counter_len;
- ACE_OS::strcpy (poa_id_ptr, poa_id);
-
- TAO_Persistent_Index_ExtId name (poa_id_ptr);
- TAO_Persistent_Index_IntId entry (counter, hash_map);
- int result = -1;
-
- // Do a normal bind. This will fail if there's already an
- // entry with the same name.
- result = this->index_->bind (name, entry, this->allocator_);
-
- if (result == 1)
- {
- // Entry already existed so bind failed. Free our dynamically allocated memory.
- this->allocator_->free ((void *) ptr);
- return result;
- }
-
- if (result == -1)
- // Free our dynamically allocated memory.
- this->allocator_->free ((void *) ptr);
- else
- // If bind() succeed, it will automatically sync
- // up the map manager entry. However, we must sync up our
- // name/value memory.
- this->allocator_->sync (ptr, poa_id_len + counter_len);
-
- return result;
- }
-}
-
-TAO_Persistent_Context_Index::TAO_Persistent_Context_Index
- (CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa)
- : allocator_ (0),
- index_ (0),
- index_file_ (0),
- base_address_ (0),
- orb_ (CORBA::ORB::_duplicate (orb)),
- poa_ (PortableServer::POA::_duplicate (poa))
-{
-}
-
-TAO_Persistent_Context_Index::~TAO_Persistent_Context_Index (void)
-{
- delete allocator_;
- ACE_OS::free (ACE_reinterpret_cast (void*, ACE_const_cast (LPTSTR, index_file_)));
-}
-
-ACE_Allocator*
-TAO_Persistent_Context_Index::allocator (void)
-{
- return allocator_;
-}
-
-char*
-TAO_Persistent_Context_Index::root_ior (void)
-{
- return CORBA::string_dup (root_ior_.in ());
-}
-
-CORBA::ORB_ptr
-TAO_Persistent_Context_Index::orb (void)
-{
- return orb_.in ();
-}
-
-int
-TAO_Persistent_Context_Index::open (LPCTSTR file_name,
- void *base_address)
-{
- this->base_address_ = base_address;
-
- index_file_ = ACE_OS::strdup (file_name);
- if (index_file_ == 0)
- return -1;
-
- return create_index ();
-}
-
-int
-TAO_Persistent_Context_Index::init (size_t context_size)
-{
- // Note: in case of an early exit from this (or helper) function due
- // to an error condition, we rely on POA to clean up all of the servants
- // already registered with it.
-
- // Return value of this function (necessary to keep compilers quiet).
- int status = 0;
-
- if (index_->current_size () == 0)
- // CASE 1:there are no Naming Contexts registered. We need to create
- // one.
- {
- ACE_DECLARE_NEW_CORBA_ENV;
-
- CosNaming::NamingContext_var result =
- TAO_Persistent_Naming_Context::make_new_context (poa_.in (),
- TAO_ROOT_NAMING_CONTEXT,
- context_size,
- this,
- ACE_TRY_ENV);
- ACE_CHECK_RETURN (-1);
-
- this->root_ior_=
- orb_->object_to_string (result.in (), ACE_TRY_ENV);
- ACE_CHECK_RETURN (-1);
- }
-
- else
- // CASE 2:Recreate all Naming Contexts.
- status = recreate_all ();
-
- return status;
-}
-
-int
-TAO_Persistent_Context_Index::recreate_all (void)
-{
- CONTEXT_INDEX::ITERATOR *index_iter = 0;
-
- ACE_NEW_RETURN (index_iter,
- (CONTEXT_INDEX::ITERATOR) (*index_),
- -1);
-
- ACE_Auto_Basic_Ptr<CONTEXT_INDEX::ITERATOR> it (index_iter);
-
- // Because of broken old g++!!!
- typedef ACE_Hash_Map_With_Allocator<TAO_Persistent_Index_ExtId,
- TAO_Persistent_Index_IntId> IND_DEF;
-
- IND_DEF::ENTRY *entry = 0;
-
- if (TAO_debug_level > 0)
- ACE_DEBUG ((LM_DEBUG, "Starting to recreate Naming Contexts from the file... \n"));
-
- // For each entry in <index_>, create a Naming Context servant.
- do
- {
- index_iter->next (entry);
-
- // Put together a servant for the new Naming Context.
-
- TAO_Persistent_Naming_Context *context_impl = 0;
- ACE_NEW_RETURN (context_impl,
- TAO_Persistent_Naming_Context (poa_.in (),
- entry->ext_id_.poa_id_,
- this,
- entry->int_id_.hash_map_,
- entry->int_id_.counter_),
- -1);
-
-
- // Put <context_impl> into the auto pointer temporarily, in case next
- // allocation fails.
- ACE_Auto_Basic_Ptr<TAO_Persistent_Naming_Context> temp (context_impl);
-
- TAO_Naming_Context *context = 0;
- ACE_NEW_RETURN (context,
- TAO_Naming_Context (context_impl),
- -1);
-
- // Let <implementation> know about it's <interface>.
- context_impl->interface (context);
-
- // Release auto pointer and start using reference counting to
- // control our servant.
- temp.release ();
- PortableServer::ServantBase_var s = context;
-
- // Register with the POA.
- ACE_DECLARE_NEW_CORBA_ENV;
- PortableServer::ObjectId_var id =
- PortableServer::string_to_ObjectId (entry->ext_id_.poa_id_);
-
- this->poa_->activate_object_with_id (id.in (),
- context,
- ACE_TRY_ENV);
- ACE_CHECK_RETURN (-1);
-
- CosNaming::NamingContext_var result = context->_this (ACE_TRY_ENV);
- ACE_CHECK_RETURN (-1);
-
- // If this is the root Naming Context, take a note of it.
- if (context_impl->root ())
- {
- this->root_ior_=
- orb_->object_to_string (result.in (), ACE_TRY_ENV);
- ACE_CHECK_RETURN (-1);
- }
- } while (index_iter->advance ());
-
- return 0;
-}
-
-int
-TAO_Persistent_Context_Index::create_index (void)
-{
- // Make sure that the file name is of the legal length.
- if (ACE_OS::strlen (index_file_) >= MAXNAMELEN + MAXPATHLEN)
- {
- errno = ENAMETOOLONG;
- return -1;
- }
-
-#if !defined (CHORUS)
- ACE_MMAP_Memory_Pool::OPTIONS options (base_address_);
-#else
- // Use base address == 0, don't use a fixed address.
- ACE_MMAP_Memory_Pool::OPTIONS options (0,
- 0,
- 0,
- ACE_CHORUS_LOCAL_NAME_SPACE_T_SIZE);
-#endif /* CHORUS */
-
- // Create the allocator with the appropriate options. The name used
- // for the lock is the same as one used for the file.
- ACE_NEW_RETURN (this->allocator_,
- ALLOCATOR (this->index_file_,
- this->index_file_,
- &options),
- -1);
-
-#if !defined (ACE_LACKS_ACCESS)
- // Now check if the backing store has been created successfully.
- if (ACE_OS::access (this->index_file_, F_OK) != 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- "create_index\n"),
- -1);
-#endif /* ACE_LACKS_ACCESS */
-
- void *context_index = 0;
-
- // This is the easy case since if we find hash table in the
- // memory-mapped file we know it's already initialized.
- if (this->allocator_->find (TAO_NAMING_CONTEXT_INDEX, context_index) == 0)
- this->index_ = (CONTEXT_INDEX *) context_index;
-
- // Create a new <index_> (because we've just created a new
- // memory-mapped file).
- else
- {
- size_t index_size = sizeof (CONTEXT_INDEX);
- context_index = this->allocator_->malloc (index_size);
-
- if (context_index == 0
- || create_index_helper (context_index) == -1
- || this->allocator_->bind (TAO_NAMING_CONTEXT_INDEX,
- context_index) == -1)
- {
- // Attempt to clean up.
- ACE_ERROR ((LM_ERROR,
- "create_index\n"));
- this->allocator_->remove ();
- return -1;
- }
- }
- return 0;
-}
-
-int
-TAO_Persistent_Context_Index::create_index_helper (void *buffer)
-{
- ACE_NEW_RETURN (this->index_,
- (buffer) CONTEXT_INDEX (this->allocator_),
- -1);
- return 0;
-}
-
-#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-template class ACE_Auto_Basic_Ptr<TAO_Naming_Context>;
-template class ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_SYNCH_MUTEX>;
-template class ACE_Allocator_Adapter<ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_SYNCH_MUTEX> >;
-template class ACE_Hash_Map_With_Allocator<TAO_Persistent_Index_ExtId, TAO_Persistent_Index_IntId>;
-template class ACE_Hash_Map_Manager<TAO_Persistent_Index_ExtId, TAO_Persistent_Index_IntId, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Manager_Ex<TAO_Persistent_Index_ExtId, TAO_Persistent_Index_IntId, ACE_Hash<TAO_Persistent_Index_ExtId>, ACE_Equal_To<TAO_Persistent_Index_ExtId>, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Entry<TAO_Persistent_Index_ExtId, TAO_Persistent_Index_IntId>;
-template class ACE_Hash<TAO_Persistent_Index_ExtId>;
-template class ACE_Equal_To<TAO_Persistent_Index_ExtId>;
-template class ACE_Hash_Map_Iterator_Base_Ex<TAO_Persistent_Index_ExtId, TAO_Persistent_Index_IntId, ACE_Hash<TAO_Persistent_Index_ExtId>, ACE_Equal_To<TAO_Persistent_Index_ExtId>, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Iterator<TAO_Persistent_Index_ExtId, TAO_Persistent_Index_IntId, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Iterator_Ex<TAO_Persistent_Index_ExtId, TAO_Persistent_Index_IntId, ACE_Hash<TAO_Persistent_Index_ExtId>, ACE_Equal_To<TAO_Persistent_Index_ExtId>, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Reverse_Iterator<TAO_Persistent_Index_ExtId, TAO_Persistent_Index_IntId, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Reverse_Iterator_Ex<TAO_Persistent_Index_ExtId, TAO_Persistent_Index_IntId, ACE_Hash<TAO_Persistent_Index_ExtId>, ACE_Equal_To<TAO_Persistent_Index_ExtId>, ACE_Null_Mutex>;
-template class ACE_Auto_Basic_Ptr<ACE_Hash_Map_With_Allocator<TAO_Persistent_Index_ExtId, TAO_Persistent_Index_IntId>::ITERATOR>;
-#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-#pragma instantiate ACE_Auto_Basic_Ptr<TAO_Naming_Context>
-#pragma instantiate ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_SYNCH_MUTEX>
-#pragma instantiate ACE_Allocator_Adapter<ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_SYNCH_MUTEX> >
-#pragma instantiate ACE_Hash_Map_With_Allocator<TAO_Persistent_Index_ExtId, TAO_Persistent_Index_IntId>
-#pragma instantiate ACE_Hash_Map_Manager<TAO_Persistent_Index_ExtId, TAO_Persistent_Index_IntId, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Manager_Ex<TAO_Persistent_Index_ExtId, TAO_Persistent_Index_IntId, ACE_Hash<TAO_Persistent_Index_ExtId>, ACE_Equal_To<TAO_Persistent_Index_ExtId>, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Entry<TAO_Persistent_Index_ExtId, TAO_Persistent_Index_IntId>
-#pragma instantiate ACE_Hash<TAO_Persistent_Index_ExtId>
-#pragma instantiate ACE_Equal_To<TAO_Persistent_Index_ExtId>
-#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<TAO_Persistent_Index_ExtId, TAO_Persistent_Index_IntId, ACE_Hash<TAO_Persistent_Index_ExtId>, ACE_Equal_To<TAO_Persistent_Index_ExtId>, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Iterator<TAO_Persistent_Index_ExtId, TAO_Persistent_Index_IntId, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Iterator_Ex<TAO_Persistent_Index_ExtId, TAO_Persistent_Index_IntId, ACE_Hash<TAO_Persistent_Index_ExtId>, ACE_Equal_To<TAO_Persistent_Index_ExtId>, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Reverse_Iterator<TAO_Persistent_Index_ExtId, TAO_Persistent_Index_IntId, ACE_Null_Mutex>
-#pragma instantiate ACE_Auto_Basic_Ptr<ACE_Hash_Map_With_Allocator<TAO_Persistent_Index_ExtId, TAO_Persistent_Index_IntId>::ITERATOR>
-#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<TAO_Persistent_Index_ExtId, TAO_Persistent_Index_IntId, ACE_Hash<TAO_Persistent_Index_ExtId>, ACE_Equal_To<TAO_Persistent_Index_ExtId>, ACE_Null_Mutex>
-#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Persistent_Context_Index.h b/TAO/orbsvcs/orbsvcs/Naming/Persistent_Context_Index.h
deleted file mode 100644
index 2b60b3ede0f..00000000000
--- a/TAO/orbsvcs/orbsvcs/Naming/Persistent_Context_Index.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/* -*- C++ -*- */
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// cos
-//
-// = FILENAME
-// Persistent_Context_Index.h
-//
-// = AUTHOR
-// Marina Spivak <marina@cs.wustl.edu>
-//
-// ============================================================================
-
-#ifndef TAO_PERSISTENT_CONTEXT_INDEX_H
-#define TAO_PERSISTENT_CONTEXT_INDEX_H
-
-#include "Persistent_Entries.h"
-
-class TAO_ORBSVCS_Export TAO_Persistent_Context_Index
-{
- // = TITLE
- // This class facilitates implementation of Persistent
- // Naming Service. It keeps track, centrally, of several pieces of
- // info for each Persistent Naming Context, allowing to perform the
- // initialization necessary for each Naming Context to
- // restore the state of the Naming Service from persistent storage
- // on server start-up.
- //
- // = DESCRIPTION
- // This class creates a memory-mapped file, allocates a hash
- // table from that file, and uses the hash table to store POA id,
- // and table and counter pointers for each Persistent Naming
- // Context. There are methods for adding and deleting entries
- // from this hash table as new Persistent Naming Contexts are
- // created and old ones are destroyed. This hash table
- // facilitates Persistent Naming Context servant initialization
- // upon Naming Server start-up.
-public:
- // = Some typedefs for convenience.
-
- typedef ACE_Hash_Map_With_Allocator<TAO_Persistent_Index_ExtId,
- TAO_Persistent_Index_IntId> CONTEXT_INDEX;
- // Hash map in which we will store info about each Persistent Naming Context.
-
- typedef ACE_Hash_Map_With_Allocator<TAO_Persistent_ExtId,
- TAO_Persistent_IntId> CONTEXT;
- // Hash map used by Persistent Naming Context to keep its state.
-
- typedef ACE_Allocator_Adapter <ACE_Malloc <ACE_MMAP_MEMORY_POOL, ACE_SYNCH_MUTEX>
- > ALLOCATOR;
- // Allocator we will be using to make the Naming Service persistent.
-
- // = Initialization and termination methods.
-
- TAO_Persistent_Context_Index (CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa);
- // Constructor.
-
- int open (LPCTSTR file_name,
- void * base_address = ACE_DEFAULT_BASE_ADDR);
- // Create ACE_Allocator, open/create memory-mapped file with the
- // specified file name/base address. Find or allocate <index_>.
- // Return 0 on success or -1 on failure.
-
- int init (size_t context_size);
- // If <index_> contains no entries (i.e., was just created), create
- // a root Persistent Naming Context servant with table of size
- // <context_size>, and make an entry for it
- // in the <index_>. If <index_> contains entries, create a
- // Persistent Naming Context servant for each entry. Return 0 on
- // success and -1 on failure.
-
- ~TAO_Persistent_Context_Index (void);
- // Destructor. The memory mapped file that was opened/created is
- // not deleted, since we want it to keep the state of the Naming
- // Service until the next run.
-
- // = Methods for adding/removing entries.
-
- int bind (const char *poa_id,
- ACE_UINT32 *&counter,
- CONTEXT *hash_map);
- // Create an entry for a Persistent Naming Context in <index_>,
- // i.e., a context with <poa_id>, <counter> and <hash_map> has just
- // been created, and is registering with us.
-
- int unbind (const char *poa_id);
- // Remove an entry for the Persistent Naming Context with <poa_id>
- // from <index_> (i.e., this context has just been destroyed).
-
- // = Accessors.
-
- ACE_Allocator *allocator (void);
- // Return allocator.
-
- CORBA::ORB_ptr orb (void);
- // Return orb pointer.
-
- char *root_ior (void);
- // Return ior of the root Naming Context (returns a copy - must be
- // deallocated by the user).
-
-private:
-
- int recreate_all (void);
- // Helper for the <init> method. Iterates over <index_>, and
- // creates a servant for each entry.
-
- int create_index (void);
- // Helper for the <open> method.
-
- int create_index_helper (void *buffer);
- // Helper for <create_index> method: places hash table into an
- // allocated space.
-
- ACE_SYNCH_MUTEX lock_;
- // Lock to prevent multiple threads from modifying entries in the
- // <index_> simultanneously.
-
- ALLOCATOR *allocator_;
- // Allocator that deals out memory from a memory-mapped file. We
- // use it here, and in TAO_Persistent_Naming_Context, whenever we
- // deal with data that should be kept in persistent store.
-
- CONTEXT_INDEX *index_;
- // Hash map where we keep entries for all Persistent Naming
- // Contexts.
-
- LPCTSTR index_file_;
- // Name of the memory-mapped file used by <allocator_>.
-
- void *base_address_;
- // Base address for the memory-mapped file.
-
- CORBA::ORB_var orb_;
- // ORB. We use it for several object_to_string conversions, and
- // keep it around for Persistent Naming Contexts' use.
-
- PortableServer::POA_var poa_;
- // POA under which to register Persistent Naming Context servants
- // during start-up.
-
- CORBA::String_var root_ior_;
- // The ior of the root Naming Context.
-};
-
-#endif /* TAO_PERSISTENT_CONTEXT_INDEX_H */
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Persistent_Entries.cpp b/TAO/orbsvcs/orbsvcs/Naming/Persistent_Entries.cpp
deleted file mode 100644
index e84401349f6..00000000000
--- a/TAO/orbsvcs/orbsvcs/Naming/Persistent_Entries.cpp
+++ /dev/null
@@ -1,204 +0,0 @@
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// cos
-//
-// = FILENAME
-// Persistent_Entries.cpp
-//
-// = AUTHOR
-// Marina Spivak <marina@cs.wustl.edu>
-//
-// ============================================================================
-
-#include "Persistent_Entries.h"
-#include "ace/SString.h"
-
-TAO_Persistent_IntId::TAO_Persistent_IntId (void)
- : ref_ (0),
- type_ (CosNaming::nobject)
-{
-}
-
-TAO_Persistent_IntId::TAO_Persistent_IntId (char * obj_ref,
- CosNaming::BindingType type)
- : ref_ (obj_ref),
- type_ (type)
-{
-}
-
-TAO_Persistent_IntId::TAO_Persistent_IntId (const TAO_Persistent_IntId &rhs)
-{
- ref_ = rhs.ref_;
- type_ = rhs.type_;
-}
-
-TAO_Persistent_IntId::~TAO_Persistent_IntId (void)
-{
-}
-
-void
-TAO_Persistent_IntId::operator= (const TAO_Persistent_IntId &rhs)
-{
- // check for self assignment.
- if (&rhs == this)
- return;
-
- type_ = rhs.type_;
- ref_ = rhs.ref_;
-}
-
-TAO_Persistent_ExtId::TAO_Persistent_ExtId (void)
- : id_ (0),
- kind_ (0)
-{
-}
-
-TAO_Persistent_ExtId::TAO_Persistent_ExtId (const char *id,
- const char *kind)
- : id_ (id),
- kind_ (kind)
-
-{
-}
-
-TAO_Persistent_ExtId::TAO_Persistent_ExtId (const TAO_Persistent_ExtId &rhs)
-{
- id_ = rhs.id_;
- kind_ = rhs.kind_;
-}
-
-TAO_Persistent_ExtId::~TAO_Persistent_ExtId (void)
-{
-}
-
-void
-TAO_Persistent_ExtId::operator= (const TAO_Persistent_ExtId &rhs)
-{
- // Check for self assignment.
- if (&rhs == this)
- return;
-
- id_ = rhs.id_;
- kind_ = rhs.kind_;
-}
-
-int
-TAO_Persistent_ExtId::operator== (const TAO_Persistent_ExtId &rhs) const
-{
- return (ACE_OS::strcmp (id_, rhs.id_) == 0)
- && (ACE_OS::strcmp (kind_, rhs.kind_) == 0);
-}
-
-int
-TAO_Persistent_ExtId::operator!= (const TAO_Persistent_ExtId &rhs) const
-{
- return (ACE_OS::strcmp (id_, rhs.id_) != 0)
- || (ACE_OS::strcmp (kind_, rhs.kind_) != 0);
-}
-
-u_long
-TAO_Persistent_ExtId::hash (void) const
-{
- ACE_CString temp (id_);
- temp += kind_;
-
- return temp.hash ();
-}
-
-const char *
-TAO_Persistent_ExtId::id (void)
-{
- return id_;
-}
-
-const char *
-TAO_Persistent_ExtId::kind (void)
-{
- return kind_;
-}
-
-TAO_Persistent_Index_IntId::TAO_Persistent_Index_IntId (void)
- : counter_ (0),
- hash_map_ (0)
-{
-}
-
-TAO_Persistent_Index_IntId::TAO_Persistent_Index_IntId (ACE_UINT32 *counter,
- ACE_Hash_Map_With_Allocator<TAO_Persistent_ExtId,
- TAO_Persistent_IntId> * hash_map)
- : counter_ (counter),
- hash_map_ (hash_map)
-{
-}
-
-TAO_Persistent_Index_IntId::TAO_Persistent_Index_IntId (const TAO_Persistent_Index_IntId &rhs)
-{
- counter_ = rhs.counter_;
- hash_map_ = rhs.hash_map_;
-}
-
-TAO_Persistent_Index_IntId::~TAO_Persistent_Index_IntId (void)
-{
-}
-
-void
-TAO_Persistent_Index_IntId::operator= (const TAO_Persistent_Index_IntId &rhs)
-{
- // check for self assignment.
- if (&rhs == this)
- return;
-
- counter_ = rhs.counter_;
- hash_map_ = rhs.hash_map_;
-}
-
-TAO_Persistent_Index_ExtId::TAO_Persistent_Index_ExtId (void)
- : poa_id_ (0)
-{
-}
-
-TAO_Persistent_Index_ExtId::TAO_Persistent_Index_ExtId (const char *poa_id)
- : poa_id_ (poa_id)
-{
-}
-
-TAO_Persistent_Index_ExtId::TAO_Persistent_Index_ExtId (const TAO_Persistent_Index_ExtId &rhs)
-{
- poa_id_ = rhs.poa_id_;
-}
-
-TAO_Persistent_Index_ExtId::~TAO_Persistent_Index_ExtId (void)
-{
-}
-
-void
-TAO_Persistent_Index_ExtId::operator= (const TAO_Persistent_Index_ExtId &rhs)
-{
- // Check for self assignment.
- if (&rhs == this)
- return;
-
- poa_id_ = rhs.poa_id_;
-}
-
-int
-TAO_Persistent_Index_ExtId::operator== (const TAO_Persistent_Index_ExtId &rhs) const
-{
- return (ACE_OS::strcmp (poa_id_, rhs.poa_id_) == 0);
-}
-
-int
-TAO_Persistent_Index_ExtId::operator!= (const TAO_Persistent_Index_ExtId &rhs) const
-{
- return (ACE_OS::strcmp (poa_id_, rhs.poa_id_) != 0);
-}
-
-u_long
-TAO_Persistent_Index_ExtId::hash (void) const
-{
- ACE_CString temp (poa_id_);
- return temp.hash ();
-}
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Persistent_Entries.h b/TAO/orbsvcs/orbsvcs/Naming/Persistent_Entries.h
deleted file mode 100644
index 69cf5d1a450..00000000000
--- a/TAO/orbsvcs/orbsvcs/Naming/Persistent_Entries.h
+++ /dev/null
@@ -1,226 +0,0 @@
-/* -*- C++ -*- */
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// cos
-//
-// = FILENAME
-// Persistent_Entries.h
-//
-// = AUTHOR
-// Marina Spivak <marina@cs.wustl.edu>
-//
-// ============================================================================
-
-#ifndef TAO_PERSISTENT_ENTRIES_H
-#define TAO_PERSISTENT_ENTRIES_H
-
-#include "ace/Hash_Map_With_Allocator_T.h"
-#include "tao/corba.h"
-#include "orbsvcs/CosNamingC.h"
-
-#if !defined (ACE_LACKS_PRAGMA_ONCE)
-# pragma once
-#endif /* ACE_LACKS_PRAGMA_ONCE */
-
-class TAO_ORBSVCS_Export TAO_Persistent_IntId
-{
- // = TITLE
- // Helper class for TAO_Persistent_Bindings_Map: unifies several
- // data items, so they can be stored together as a <value>
- // for a <key> in a hash table holding the state of a Persistent
- // Naming Context.
- //
- // = DESCRIPTION
- // This class holds a strigified IOR and a binding type, so
- // they can be stored together as a <value> for a <key> in a
- // hash table holding the state of a Persistent Naming Context.
- //
- // Memory for the ior isn't allocated/deallocated, this class just
- // copies a pointer.
-public:
- // = Initialization and termination methods.
- TAO_Persistent_IntId (void);
- // Constructor.
-
- TAO_Persistent_IntId (char * obj_ref,
- CosNaming::BindingType type /* = CosNaming::nobject */);
- // Constructor.
-
- TAO_Persistent_IntId (const TAO_Persistent_IntId & rhs);
- // Copy constructor.
-
- ~TAO_Persistent_IntId (void);
- // Destructor.
-
- void operator= (const TAO_Persistent_IntId & rhs);
- // Assignment operator.
-
- // = Data members.
-
- const char *ref_;
- // Stringified IOR to be stored in a Persistent Naming Context.
-
- CosNaming::BindingType type_;
- // Binding type for <ref_>.
-};
-
-class TAO_ORBSVCS_Export TAO_Persistent_ExtId
-{
- // = TITLE
- // Helper class for TAO_Persistent_Bindings_Map: unifies several
- // data items, so they can be stored together as a <key>
- // for a <value> in a hash table holding the state of a Persistent
- // Naming Context.
- //
- // = DESCRIPTION
- // This class holds id and kind strings, so
- // they can be stored together as a <key> for a <value> in a
- // hash table holding the state of a Persistent Naming Context.
- //
- // Memory for id and kind isn't allocated/deallocated, this
- // class just copies pointers.
-public:
- // = Initialization and termination methods.
-
- TAO_Persistent_ExtId (void);
- // Constructor.
-
- TAO_Persistent_ExtId (const char *id,
- const char *kind);
- // Constructor.
-
- TAO_Persistent_ExtId (const TAO_Persistent_ExtId & rhs);
- // Copy constructor.
-
- ~TAO_Persistent_ExtId (void);
- // Destructor.
-
- // = Assignment and comparison methods.
-
- void operator= (const TAO_Persistent_ExtId & rhs);
- // Assignment operator (does copy memory).
-
- int operator== (const TAO_Persistent_ExtId &rhs) const;
- // Equality comparison operator (must match both id_ and kind_).
-
- int operator!= (const TAO_Persistent_ExtId &rhs) const;
- // Inequality comparison operator.
-
- u_long hash (void) const;
- // <hash> function is required in order for this class to be usable by
- // ACE_Hash_Map_Manager.
-
- // = Data members.
-
- const char * id_;
- // <kind> portion of the name to be associated with some object
- // reference in a Persistent Naming Context.
-
- const char * kind_;
- // <id> portion of the name to be associated with some object
- // reference in a Persistent Naming Context.
-
- // Accessors.
-
- const char * id (void);
- const char * kind (void);
-};
-
-class TAO_ORBSVCS_Export TAO_Persistent_Index_IntId
-{
- // = TITLE
- // Helper class for TAO_Persistent_Context_Index: unifies several
- // data items, so they can be stored together as a <value>
- // for a <key> in a hash table holding the state of a Persistent
- // Context Index. (Persistent Context Index is like directory
- // that stores info about every active Naming Context).
- //
- // = DESCRIPTION
- // This class holds a counter and a hash map pointers, so
- // they can be stored together as a <value> for a <key> in a
- // hash table holding the state of a Persistent Context Index.
- //
-public:
- // = Initialization and termination methods.
- TAO_Persistent_Index_IntId (void);
- // Constructor.
-
- TAO_Persistent_Index_IntId (ACE_UINT32 *counter,
- ACE_Hash_Map_With_Allocator<TAO_Persistent_ExtId,
- TAO_Persistent_IntId> * hash_map);
- // Constructor.
-
- TAO_Persistent_Index_IntId (const TAO_Persistent_Index_IntId & rhs);
- // Copy constructor.
-
- ~TAO_Persistent_Index_IntId (void);
- // Destructor.
-
- void operator= (const TAO_Persistent_Index_IntId & rhs);
- // Assignment operator (does copy memory).
-
- // = Data members.
-
- ACE_UINT32 *counter_;
- // Pointer to a Persistent Naming Context's counter.
-
- ACE_Hash_Map_With_Allocator<TAO_Persistent_ExtId,
- TAO_Persistent_IntId> * hash_map_;
- // Pointer to a Persistent Naming Context's hash map.
-};
-
-class TAO_ORBSVCS_Export TAO_Persistent_Index_ExtId
-{
- // = TITLE
- // Helper class for TAO_Persistent_Context_Index: holds
- // Persistent Naming Context POA id, so it can be stored as a <key>
- // for a <value> in a hash table holding state of a Persistent
- // Context Index. (Persistent Context Index is like directory
- // that stores info about every active Naming Context).
- //
- // = DESCRIPTION
- // We need this wrapper class around the actual data because we must
- // provide <hash> function for it to work with
- // ACE_Hash_Map_Manager.
- //
-public:
- // = Initialization and termination methods.
-
- TAO_Persistent_Index_ExtId (void);
- // Constructor.
-
- TAO_Persistent_Index_ExtId (const char *poa_id);
- // Constructor.
-
- TAO_Persistent_Index_ExtId (const TAO_Persistent_Index_ExtId & rhs);
- // Copy constructor.
-
- ~TAO_Persistent_Index_ExtId (void);
- // Destructor.
-
- // = Assignment and comparison methods.
-
- void operator= (const TAO_Persistent_Index_ExtId & rhs);
- // Assignment operator (does copy memory).
-
- int operator== (const TAO_Persistent_Index_ExtId &rhs) const;
- // Equality comparison operator (must match both id_ and kind_).
-
- int operator!= (const TAO_Persistent_Index_ExtId &rhs) const;
- // Inequality comparison operator.
-
- u_long hash (void) const;
- // <hash> function is required in order for this class to be usable by
- // ACE_Hash_Map_Manager.
-
- // = Data member.
-
- const char * poa_id_;
- // POA id to be associated with the rest of the info for some
- // Persistent Naming Context in the Persistent Context Index.
-};
-
-#endif /* TAO_PERSISTENT_ENTRIES_H */
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Persistent_Naming_Context.cpp b/TAO/orbsvcs/orbsvcs/Naming/Persistent_Naming_Context.cpp
deleted file mode 100644
index 6542dc39e89..00000000000
--- a/TAO/orbsvcs/orbsvcs/Naming/Persistent_Naming_Context.cpp
+++ /dev/null
@@ -1,573 +0,0 @@
-// $Id$
-// ============================================================================
-//
-// = LIBRARY
-// cos
-//
-// = FILENAME
-// Persistent_Naming_Context.cpp
-//
-// = AUTHOR
-// Marina Spivak <marina@cs.wustl.edu>
-//
-// ============================================================================
-#include "ace/Auto_Ptr.h"
-#include "Persistent_Naming_Context.h"
-#include "Persistent_Context_Index.h"
-#include "Bindings_Iterator_T.h"
-
-ACE_RCSID(Naming, Persistent_Naming_Context, "$Id$")
-
-int
-TAO_Persistent_Bindings_Map::unbind (const char *id,
- const char *kind)
-{
- TAO_Persistent_ExtId name (id, kind);
- TAO_Persistent_IntId entry;
- if (this->map_->unbind (name, entry, this->allocator_) != 0)
- return -1;
- else
- {
- // Free up the memory we allocated in shared_bind(). Note that
- // this assumes that the "ref" pointer comes first and that
- // the ref, id and kind are contiguously allocated (see
- // shared_bind() for details).
- this->allocator_->free ((void *) (entry.ref_));
- return 0;
- }
-}
-
-int
-TAO_Persistent_Bindings_Map::bind (const char *id,
- const char *kind,
- CORBA::Object_ptr obj,
- CosNaming::BindingType type)
-{
- return this->shared_bind (id, kind, obj, type, 0);
-}
-
-int
-TAO_Persistent_Bindings_Map::rebind (const char *id,
- const char *kind,
- CORBA::Object_ptr obj,
- CosNaming::BindingType type)
-{
- return this->shared_bind (id, kind, obj, type, 1);
-}
-
-int
-TAO_Persistent_Bindings_Map::find (const char *id,
- const char *kind,
- CORBA::Object_ptr & obj,
- CosNaming::BindingType &type)
-{
- TAO_Persistent_ExtId name (id, kind);
- TAO_Persistent_IntId entry;
-
- if (this->map_->find (name,
- entry,
- this->allocator_) != 0)
- return -1;
- else
- {
- ACE_DECLARE_NEW_CORBA_ENV;
- obj = orb_->string_to_object (entry.ref_, ACE_TRY_ENV);
- ACE_CHECK_RETURN (-1);
- type = entry.type_;
-
- return 0;
- }
-}
-
-TAO_Persistent_Bindings_Map::TAO_Persistent_Bindings_Map (CORBA::ORB_ptr orb)
- : allocator_ (0),
- map_ (0),
- orb_ (CORBA::ORB::_duplicate (orb))
-{
-}
-
-TAO_Persistent_Bindings_Map::~TAO_Persistent_Bindings_Map (void)
-{
-}
-
-void
-TAO_Persistent_Bindings_Map::destroy (void)
-{
- this->map_->ACE_Hash_Map_With_Allocator<TAO_Persistent_ExtId, TAO_Persistent_IntId>::~ACE_Hash_Map_With_Allocator ();
- this->allocator_->free (map_);
-}
-
-TAO_Persistent_Bindings_Map::HASH_MAP *
-TAO_Persistent_Bindings_Map::map (void)
-{
- return this->map_;
-}
-
-size_t
-TAO_Persistent_Bindings_Map::total_size (void)
-{
- return this->map_->total_size ();
-}
-
-size_t
-TAO_Persistent_Bindings_Map::current_size (void)
-{
- return map_->current_size ();
-}
-
-int
-TAO_Persistent_Bindings_Map::open (size_t hash_table_size,
- ACE_Allocator *alloc)
-{
- allocator_ = alloc;
-
- // Use allocator to allocate space for the hash map.
- void *hash_map = 0;
- size_t map_size = sizeof (HASH_MAP);
- hash_map = this->allocator_->malloc (map_size);
-
- // If allocation failed ...
- if (hash_map == 0)
- return -1;
-
- // Initialize allocated hash map through placement new.
- if (open_helper (hash_table_size, hash_map) == -1)
- this->allocator_->free (hash_map);
-
- return 0;
-}
-
-int
-TAO_Persistent_Bindings_Map::open_helper (size_t hash_table_size,
- void *buffer)
-{
- ACE_NEW_RETURN (this->map_,
- (buffer) HASH_MAP (hash_table_size, this->allocator_),
- -1);
- return 0;
-}
-
-void
-TAO_Persistent_Bindings_Map::set (HASH_MAP *map,
- ACE_Allocator *alloc)
-{
- allocator_ = alloc;
- map_ = map;
-}
-
-int
-TAO_Persistent_Bindings_Map::shared_bind (const char * id,
- const char * kind,
- CORBA::Object_ptr obj,
- CosNaming::BindingType type,
- int rebind)
-{
- // Obtain a stringified ior of <obj> (i.e., the representation we can store).
- ACE_DECLARE_NEW_CORBA_ENV;
- CORBA::String_var ref = orb_->object_to_string (obj, ACE_TRY_ENV);
- ACE_CHECK_RETURN (-1);
-
- // Calculate and allocate the memory we need to store this name to
- // object binding.
- size_t id_len = ACE_OS::strlen (id) + 1;
- size_t kind_len = ACE_OS::strlen (kind) + 1;
- size_t ref_len = ACE_OS::strlen (ref) + 1;
- size_t total_len = id_len + kind_len + ref_len;
- char *ptr = (char *) this->allocator_->malloc (total_len);
-
- // Allocation failed - bail out.
- if (ptr == 0)
- return -1;
-
- // Allocation succeded - place the data into the allocated memory
- // and procceed.
- else
- {
- // Note that the <ref> *must* come first to make sure we can
- // retrieve this pointer later on in unbind().
- char * ref_ptr = ptr;
- char * id_ptr = ptr + ref_len;
- char * kind_ptr = ptr + ref_len + id_len;
- ACE_OS::strcpy (ref_ptr, ref.in ());
- ACE_OS::strcpy (id_ptr, id);
- ACE_OS::strcpy (kind_ptr, kind);
-
- TAO_Persistent_ExtId new_name (id_ptr, kind_ptr);
- TAO_Persistent_IntId new_entry (ref_ptr, type);
- int result = -1;
-
- if (rebind == 0)
- {
- // Do a normal bind. This will fail if there's already an
- // <new_internal> with the same name.
- result = this->map_->bind (new_name, new_entry, this->allocator_);
-
- if (result == 1)
- {
- // Entry already existed so bind failed. Free our
- // dynamically allocated memory.
- this->allocator_->free ((void *) ptr);
- return result;
- }
- }
- else
- // Rebind.
- {
- TAO_Persistent_ExtId old_name;
- TAO_Persistent_IntId old_entry;
-
- // Check that the types of old and new entries match.
- if (this->map_->find (new_name,
- old_entry,
- this->allocator_) == 0
- && type != old_entry.type_)
- result = -2;
-
- // If types match, perform rebind.
- else
- result = this->map_->rebind (new_name, new_entry,
- old_name, old_entry,
- this->allocator_);
- if (result == 1)
- {
- // Free up the old binding's memory, if it was replaced.
- // Note, this assumes that the "ref" pointer comes
- // first, and that the id, kind, and ref are contiguously
- // allocated (see beginning of this method for details).
- this->allocator_->free ((void *) old_entry.ref_);
- }
- }
-
- // Check for failures, and clean up dynamically allocated memory
- // if necessary.
- if (result < 0)
- this->allocator_->free ((void *) ptr);
-
- else
- // If bind() or rebind() succeeded, they will automatically sync
- // up the map manager entry. However, we must sync up our
- // name/value memory.
- this->allocator_->sync (ptr, total_len);
-
- return result;
- }
-}
-
-TAO_Persistent_Naming_Context::TAO_Persistent_Naming_Context (PortableServer::POA_ptr poa,
- const char *poa_id,
- TAO_Persistent_Context_Index *context_index)
-
- : TAO_Hash_Naming_Context (poa,
- poa_id),
- counter_ (0),
- persistent_context_ (0),
- index_ (context_index)
-{
- ACE_NEW (this->persistent_context_,
- TAO_Persistent_Bindings_Map (context_index->orb ()));
-
- // Set the superclass pointer.
- context_ = persistent_context_;
-}
-
-TAO_Persistent_Naming_Context::TAO_Persistent_Naming_Context (PortableServer::POA_ptr poa,
- const char *poa_id,
- TAO_Persistent_Context_Index *context_index,
- HASH_MAP *map,
- ACE_UINT32 *counter)
- : TAO_Hash_Naming_Context (poa,
- poa_id),
- counter_ (counter),
- persistent_context_ (0),
- index_ (context_index)
-{
- ACE_NEW (this->persistent_context_,
- TAO_Persistent_Bindings_Map (context_index->orb ()));
-
- // Set the superclass pointer.
- context_ = persistent_context_;
-
- persistent_context_->set (map, index_->allocator ());
-}
-
-int
-TAO_Persistent_Naming_Context::init (size_t hash_table_size)
-{
- return persistent_context_->open (hash_table_size, index_->allocator ());
-}
-
-TAO_Persistent_Naming_Context::~TAO_Persistent_Naming_Context (void)
-{
- // Perform appropriate cleanup based on the destruction level specified.
-
- if (this->destroyed_ > 1)
- {
- // Remove ourselves from context index.
- index_->unbind (poa_id_.c_str ());
- // Remove the underlying data structure from persistent storage.
- persistent_context_->destroy ();
- }
- else if (this->destroyed_ == 1)
- // Remove the underlying data structure from persistent storage.
- persistent_context_->destroy ();
-}
-
-void
-TAO_Persistent_Naming_Context::set_cleanup_level (int level)
-{
- this->destroyed_ = level;
-}
-
-CosNaming::NamingContext_ptr
-TAO_Persistent_Naming_Context::make_new_context (PortableServer::POA_ptr poa,
- const char *poa_id,
- size_t context_size,
- TAO_Persistent_Context_Index * ind,
- CORBA::Environment &ACE_TRY_ENV)
-{
- // Store the stub we will return here.
- CosNaming::NamingContext_var result;
-
- // Put together a servant for the new Naming Context.
-
- TAO_Persistent_Naming_Context *context_impl = 0;
- ACE_NEW_THROW_EX (context_impl,
- TAO_Persistent_Naming_Context (poa,
- poa_id,
- ind),
- CORBA::NO_MEMORY ());
- ACE_CHECK_RETURN (result._retn ());
-
- // Put <context_impl> into the auto pointer temporarily, in case next
- // allocation fails.
- ACE_Auto_Basic_Ptr<TAO_Persistent_Naming_Context> temp (context_impl);
-
- if (context_impl->init (context_size) == -1)
- ACE_THROW_RETURN (CORBA::NO_MEMORY (), result._retn ());
-
- // Insure appropriate cleanup in case of exception conditions ahead.
- context_impl->set_cleanup_level (1);
-
- // Register with the index of Naming Contexts.
- if (ind->bind (context_impl->poa_id_.c_str (),
- context_impl->counter_,
- context_impl->persistent_context_->map ()) == -1)
- ACE_THROW_RETURN (CORBA::INTERNAL (), result._retn ());
-
- // Insure appropriate cleanup in case of exception conditions ahead.
- context_impl->set_cleanup_level (2);
-
- TAO_Naming_Context *context = 0;
- ACE_NEW_THROW_EX (context,
- TAO_Naming_Context (context_impl),
- CORBA::NO_MEMORY ());
- ACE_CHECK_RETURN (result._retn ());
-
- // Let <implementation> know about it's <interface>.
- context_impl->interface (context);
-
- // Release auto pointer, and start using reference counting to
- // control our servant.
- temp.release ();
- PortableServer::ServantBase_var s = context;
-
- // Register the new context with the POA.
- PortableServer::ObjectId_var id =
- PortableServer::string_to_ObjectId (poa_id);
-
- poa->activate_object_with_id (id.in (),
- context,
- ACE_TRY_ENV);
- ACE_CHECK_RETURN (result._retn ());
-
- result = context->_this (ACE_TRY_ENV);
- ACE_CHECK_RETURN (CosNaming::NamingContext::_nil ());
-
- // Everything went smoothly, without errors - we don't need any cleanup.
- context_impl->set_cleanup_level (0);
-
- return result._retn ();
-}
-
-CosNaming::NamingContext_ptr
-TAO_Persistent_Naming_Context::new_context (CORBA::Environment &ACE_TRY_ENV)
-{
- ACE_GUARD_THROW_EX (ACE_SYNCH_RECURSIVE_MUTEX,
- ace_mon,
- this->lock_,
- CORBA::INTERNAL ());
- ACE_CHECK_RETURN (CosNaming::NamingContext::_nil ());
-
- // Check to make sure this object didn't have <destroy> method
- // invoked on it.
- if (this->destroyed_)
- ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
- CosNaming::NamingContext::_nil ());
-
- // Generate a POA id for the new context.
- char poa_id[BUFSIZ];
- ACE_OS::sprintf (poa_id,
- "%s_%ld",
- this->poa_id_.c_str (),
- (*this->counter_)++);
-
- CosNaming::NamingContext_var result =
- make_new_context (this->poa_.in (),
- poa_id,
- this->persistent_context_->total_size (),
- this->index_,
- ACE_TRY_ENV);
- ACE_CHECK_RETURN (CosNaming::NamingContext::_nil ());
-
- return result._retn ();
-}
-
-void
-TAO_Persistent_Naming_Context::list (CORBA::ULong how_many,
- CosNaming::BindingList_out &bl,
- CosNaming::BindingIterator_out &bi,
- CORBA::Environment &ACE_TRY_ENV)
-{
- // Allocate nil out parameters in case we won't be able to complete
- // the operation.
- bi = CosNaming::BindingIterator::_nil ();
- ACE_NEW_THROW_EX (bl,
- CosNaming::BindingList (0),
- CORBA::NO_MEMORY ());
- ACE_CHECK;
-
- // Obtain a lock before we proceed with the operation.
- ACE_GUARD_THROW_EX (ACE_SYNCH_RECURSIVE_MUTEX,
- ace_mon,
- this->lock_,
- CORBA::INTERNAL ());
- ACE_CHECK;
-
- // Check to make sure this object didn't have <destroy> method
- // invoked on it.
- if (this->destroyed_)
- ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
-
- // Dynamically allocate hash map iterator.
- HASH_MAP::ITERATOR *hash_iter = 0;
- ACE_NEW_THROW_EX (hash_iter,
- HASH_MAP::ITERATOR
- (*persistent_context_->map ()),
- CORBA::NO_MEMORY ());
- ACE_CHECK;
-
- // Store <hash_iter temporarily in auto pointer, in case we'll have
- // some failures and throw an exception.
- ACE_Auto_Basic_Ptr<HASH_MAP::ITERATOR> temp (hash_iter);
-
- // Silliness below is required because of broken old g++!!! E.g.,
- // without it, we could have just said HASH_MAP::ITERATOR everywhere we use ITER_DEF.
- typedef ACE_Hash_Map_With_Allocator<TAO_Persistent_ExtId, TAO_Persistent_IntId>::ITERATOR ITER_DEF;
- typedef ACE_Hash_Map_With_Allocator<TAO_Persistent_ExtId, TAO_Persistent_IntId>::ENTRY ENTRY_DEF;
-
- // Typedef to the type of BindingIterator servant for ease of use.
- typedef TAO_Bindings_Iterator<ITER_DEF, ENTRY_DEF> ITER_SERVANT;
-
- // A pointer to BindingIterator servant.
- ITER_SERVANT *bind_iter = 0;
-
- // Number of bindings that will go into the BindingList.
- CORBA::ULong n;
-
- // 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);
-
- ENTRY_DEF *hash_entry;
-
- for (CORBA::ULong i = 0; i < n; i++)
- {
- hash_iter->next (hash_entry);
- hash_iter->advance ();
-
- if (ITER_SERVANT::populate_binding (hash_entry, bl[i]) == 0)
- ACE_THROW (CORBA::NO_MEMORY());
- }
-
- // 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)
- return;
- else
- {
- // Create a BindingIterator for return.
- ACE_NEW_THROW_EX (bind_iter,
- ITER_SERVANT (this, hash_iter, this->poa_.in (), this->lock_),
- CORBA::NO_MEMORY ());
-
- // Release <hash_iter> from auto pointer, and start using the
- // reference counting to control our servant.
- temp.release ();
- PortableServer::ServantBase_var iter = bind_iter;
-
- // Increment reference count on this Naming Context, so it doesn't get
- // deleted before the BindingIterator servant gets deleted.
- interface_->_add_ref (ACE_TRY_ENV);
- ACE_CHECK;
-
- // Register with the POA.
- 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,
- ACE_TRY_ENV);
- ACE_CHECK;
-
- bi = bind_iter->_this (ACE_TRY_ENV);
- ACE_CHECK;
- }
-}
-
-#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-template class ACE_Hash_Map_With_Allocator<TAO_Persistent_ExtId, TAO_Persistent_IntId>;
-template class ACE_Hash_Map_Manager<TAO_Persistent_ExtId, TAO_Persistent_IntId, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Manager_Ex<TAO_Persistent_ExtId, TAO_Persistent_IntId, ACE_Hash<TAO_Persistent_ExtId>, ACE_Equal_To<TAO_Persistent_ExtId>, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Entry<TAO_Persistent_ExtId, TAO_Persistent_IntId>;
-template class ACE_Hash<TAO_Persistent_ExtId>;
-template class ACE_Equal_To<TAO_Persistent_ExtId>;
-template class ACE_Hash_Map_Iterator_Base_Ex<TAO_Persistent_ExtId, TAO_Persistent_IntId, ACE_Hash<TAO_Persistent_ExtId>, ACE_Equal_To<TAO_Persistent_ExtId>, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Iterator<TAO_Persistent_ExtId, TAO_Persistent_IntId, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Iterator_Ex<TAO_Persistent_ExtId, TAO_Persistent_IntId, ACE_Hash<TAO_Persistent_ExtId>, ACE_Equal_To<TAO_Persistent_ExtId>, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Reverse_Iterator<TAO_Persistent_ExtId, TAO_Persistent_IntId, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Reverse_Iterator_Ex<TAO_Persistent_ExtId, TAO_Persistent_IntId, ACE_Hash<TAO_Persistent_ExtId>, ACE_Equal_To<TAO_Persistent_ExtId>, ACE_Null_Mutex>;
-template class ACE_Auto_Basic_Ptr<TAO_Persistent_Naming_Context>;
-template class ACE_Auto_Basic_Ptr<ACE_Hash_Map_Iterator_Ex<TAO_Persistent_ExtId, TAO_Persistent_IntId, ACE_Hash<TAO_Persistent_ExtId>, ACE_Equal_To<TAO_Persistent_ExtId>, ACE_Null_Mutex > >;
-template class TAO_Bindings_Iterator<ACE_Hash_Map_Iterator_Ex<TAO_Persistent_ExtId, TAO_Persistent_IntId, ACE_Hash<TAO_Persistent_ExtId>, ACE_Equal_To<TAO_Persistent_ExtId>, ACE_Null_Mutex>, ACE_Hash_Map_Entry<TAO_Persistent_ExtId, TAO_Persistent_IntId> >;
-template class ACE_Auto_Basic_Ptr<TAO_Bindings_Iterator<ACE_Hash_Map_Iterator_Ex<TAO_Persistent_ExtId, TAO_Persistent_IntId, ACE_Hash<TAO_Persistent_ExtId>, ACE_Equal_To<TAO_Persistent_ExtId>, ACE_Null_Mutex>, ACE_Hash_Map_Entry<TAO_Persistent_ExtId, TAO_Persistent_IntId> > >;
-
-#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-
-#pragma instantiate ACE_Hash_Map_With_Allocator<TAO_Persistent_ExtId, TAO_Persistent_IntId>
-#pragma instantiate ACE_Hash_Map_Manager<TAO_Persistent_ExtId, TAO_Persistent_IntId, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Manager_Ex<TAO_Persistent_ExtId, TAO_Persistent_IntId, ACE_Hash<TAO_Persistent_ExtId>, ACE_Equal_To<TAO_Persistent_ExtId>, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Entry<TAO_Persistent_ExtId, TAO_Persistent_IntId>
-#pragma instantiate ACE_Hash<TAO_Persistent_ExtId>
-#pragma instantiate ACE_Equal_To<TAO_Persistent_ExtId>
-#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<TAO_Persistent_ExtId, TAO_Persistent_IntId, ACE_Hash<TAO_Persistent_ExtId>, ACE_Equal_To<TAO_Persistent_ExtId>, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Iterator<TAO_Persistent_ExtId, TAO_Persistent_IntId, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Iterator_Ex<TAO_Persistent_ExtId, TAO_Persistent_IntId, ACE_Hash<TAO_Persistent_ExtId>, ACE_Equal_To<TAO_Persistent_ExtId>, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Reverse_Iterator<TAO_Persistent_ExtId, TAO_Persistent_IntId, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<TAO_Persistent_ExtId, TAO_Persistent_IntId, ACE_Hash<TAO_Persistent_ExtId>, ACE_Equal_To<TAO_Persistent_ExtId>, ACE_Null_Mutex>
-#pragma instantiate ACE_Auto_Basic_Ptr<TAO_Persistent_Naming_Context>
-#pragma instantiate ACE_Auto_Basic_Ptr<ACE_Hash_Map_Iterator_Ex<TAO_Persistent_ExtId, TAO_Persistent_IntId, ACE_Hash<TAO_Persistent_ExtId>, ACE_Equal_To<TAO_Persistent_ExtId>, ACE_Null_Mutex> >
-#pragma instantiate TAO_Bindings_Iterator<ACE_Hash_Map_Iterator_Ex<TAO_Persistent_ExtId, TAO_Persistent_IntId, ACE_Hash<TAO_Persistent_ExtId>, ACE_Equal_To<TAO_Persistent_ExtId>, ACE_Null_Mutex>, ACE_Hash_Map_Entry<TAO_Persistent_ExtId, TAO_Persistent_IntId> >
-#pragma instantiate ACE_Auto_Basic_Ptr<TAO_Bindings_Iterator<ACE_Hash_Map_Iterator_Ex<TAO_Persistent_ExtId, TAO_Persistent_IntId, ACE_Hash<TAO_Persistent_ExtId>, ACE_Equal_To<TAO_Persistent_ExtId>, ACE_Null_Mutex>, ACE_Hash_Map_Entry<TAO_Persistent_ExtId, TAO_Persistent_IntId> > >
-#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Persistent_Naming_Context.h b/TAO/orbsvcs/orbsvcs/Naming/Persistent_Naming_Context.h
deleted file mode 100644
index 1f1338d4ec9..00000000000
--- a/TAO/orbsvcs/orbsvcs/Naming/Persistent_Naming_Context.h
+++ /dev/null
@@ -1,238 +0,0 @@
-/* -*- C++ -*- */
-// $Id$
-// ============================================================================
-//
-// = LIBRARY
-// cos
-//
-// = FILENAME
-// Persistent_Naming_Context.h
-//
-// = AUTHOR
-// Marina Spivak <marina@cs.wustl.edu>
-//
-// ============================================================================
-
-#ifndef TAO_PERSISTENT_NAMING_CONTEXT_H
-#define TAO_PERSISTENT_NAMING_CONTEXT_H
-
-#include "Hash_Naming_Context.h"
-#include "Persistent_Entries.h"
-
-class TAO_ORBSVCS_Export TAO_Persistent_Bindings_Map : public TAO_Bindings_Map
-{
- // = TITLE
- // Provides hash-table-based persistent storage for
- // name to object bindings in a Naming Context.
- //
- // = DESCRIPTION
- // Wrapper on top of ACE_Hash_Map_With_Allocator (which is a wrapper
- // around ACE_Hash_Map_Manager). Uses ACE_Allocator (allocating
- // from persistent storage) to make bindings persistent and
- // supports TAO_Bindings_Map interface. Used by TAO_Persistent_Naming_Context.
-public:
-
- typedef ACE_Hash_Map_With_Allocator<TAO_Persistent_ExtId, TAO_Persistent_IntId> HASH_MAP;
- // Underlying data structure - typedef for ease of use.
-
- // = Initialization and termination methods.
-
- TAO_Persistent_Bindings_Map (CORBA::ORB_ptr orb);
- // Constructor.
-
- int open (size_t hash_map_size,
- ACE_Allocator *alloc);
- // Allocate hash map of size <hash_map_size> from persistent storage
- // using the <alloc>.
-
- void set (HASH_MAP *map,
- ACE_Allocator *alloc);
- // The hash map has already been preallocated for us. We just need
- // to set our data members take ownership of it.
-
- virtual ~TAO_Persistent_Bindings_Map (void);
- // Destructor. Does not deallocate the hash map: if an instance of
- // this class goes out of scope, its hash_map remains in persistent storage.
-
- void destroy (void);
- // This method removes the hash map from persistent storage/frees up
- // the memory. The hash map better be empty, since we are not
- // cleaning up the insides. (We could add <close> to clean entries,
- // but not the data inside the entries.
-
- // = Accessor methods.
-
- HASH_MAP *map (void);
- // Get a pointer to the underlying hash map.
-
- size_t total_size (void);
- // Return the size of the underlying hash table.
-
- virtual size_t current_size (void);
- // Return the size of the underlying hash table.
-
- // = Name bindings manipulation methods.
-
- virtual int bind (const char *id,
- const char *kind,
- CORBA::Object_ptr obj,
- CosNaming::BindingType type);
- // Add a binding with the specified parameters to the table.
- // Return 0 on success and -1 on failure, 1 if there already is a
- // binding with <id> and <kind>.
-
- virtual int rebind (const char *id,
- const char *kind,
- CORBA::Object_ptr obj,
- CosNaming::BindingType type);
- // Overwrite a binding containing <id> and <kind> (or create a new
- // one if one doesn't exist) with the specified parameters. Return
- // 0 or 1 on success. Return -1 or -2 on failure. (-2 is returned
- // if the new and old bindings differ in type).
-
- virtual int unbind (const char * id,
- const char * kind);
- // Remove a binding containing <id> and <kind> from the table.
- // Return 0 on success and -1 on failure.
-
- virtual int find (const char * id,
- const char * kind,
- CORBA::Object_ptr & obj,
- CosNaming::BindingType &type);
- // Find the binding containing <id> and <kind> in the table, and
- // pass binding's type and object back to the caller by reference.
- // Return 0 on success and -1 on failure. Note: a 'duplicated' object
- // reference is assigned to <obj>, so the caller is responsible for
- // its deallocation.
-
-protected:
-
- int open_helper (size_t hash_table_size,
- void *buffer);
- // Helper to the <open> method. By isolating placement new into a
- // separate method, we can deal with memory allocation failures more
- // efficiently. If there is a problem in HASH_MAP constructor, we
- // can clean up preallocated space.
-
- int shared_bind (const char *id,
- const char *kind,
- CORBA::Object_ptr obj,
- CosNaming::BindingType type,
- int rebind);
- // Helper: factors common code from <bind> and <rebind>.
-
- ACE_Allocator *allocator_;
- // Pointer to the allocator we use to make bindings persistent.
-
- HASH_MAP *map_;
- // Pointer to the underlying hash map.
-
- CORBA::ORB_var orb_;
- // Pointer to the orb. We need it to do string/object conversions.
-};
-
-class TAO_Persistent_Context_Index;
-
-class TAO_ORBSVCS_Export TAO_Persistent_Naming_Context : public TAO_Hash_Naming_Context
-{
- // = TITLE
- // This class plays a role of a 'ConcreteImplementor' in the
- // Bridge pattern architecture of the CosNaming::NamingContext implementation.
- //
- // = DESCRIPTION
- // This class provides a persistent implementation of the
- // NamingContext functionality, i.e., the state is preserved across
- // process boundaries. Derives from TAO_Hash_Naming_Context and
- // uses TAO_Persistent_Bindings_Map to store name to object bindings.
- //
-public:
- typedef TAO_Persistent_Bindings_Map::HASH_MAP HASH_MAP;
- // Underlying data structure - typedef for ease of use.
-
- // = Initialization and termination methods.
-
- TAO_Persistent_Naming_Context (PortableServer::POA_ptr poa,
- const char *poa_id,
- TAO_Persistent_Context_Index *context_index);
- // Constructor. MUST be followed up by <init> to allocate the
- // underlying data structure from persistent storage!
-
- int init (size_t hash_table_size = ACE_DEFAULT_MAP_SIZE);
- // Allocate the underlying data structure from persistent storage.
- // Returns 0 on success and -1 on failure.
-
- TAO_Persistent_Naming_Context (PortableServer::POA_ptr poa,
- const char *poa_id,
- TAO_Persistent_Context_Index *context_index,
- HASH_MAP * map,
- ACE_UINT32 *counter);
- // Constructor that takes in preallocated data structure and takes
- // ownership of it. This constructor is for 'recreating' servants
- // from persistent state.
-
- virtual ~TAO_Persistent_Naming_Context (void);
- // Destructor.
-
- // = Utility methods.
- static CosNaming::NamingContext_ptr make_new_context (PortableServer::POA_ptr poa,
- const char *poa_id,
- size_t context_size,
- TAO_Persistent_Context_Index *ind,
- CORBA::Environment &ACE_TRY_ENV);
- // This utility method factors out the code needed to create a new
- // Persistent Naming Context servant and activate it under the
- // specified POA with the specified id. This function is static so
- // that the code can be used, both from inside the class (e.g., <new_context>),
- // and from outside (e.g., Naming_Utils.cpp).
-
- // = Methods not implemented in TAO_Hash_Naming_Context.
-
- virtual CosNaming::NamingContext_ptr new_context (CORBA::Environment &ACE_TRY_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 void list (CORBA::ULong how_many,
- CosNaming::BindingList_out &bl,
- CosNaming::BindingIterator_out &bi,
- CORBA::Environment &ACE_TRY_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.
-
-protected:
-
- void set_cleanup_level (int level);
- // Set <destroyed_> flag (inherited from TAO_Hash_Naming_Context) to
- // <level>. Legal values for <destroyed_> are 0, 1, and 2. The
- // values specify the extent of cleanup that should take place in the
- // context's destructor:
- // '0' - no cleanup (e.g., if the context goes out of scope, but
- // it's state is to remain in persistent storage);
- // '1' - free up the underlying data structure in persistent storage
- // (e.g., if the initialization of this context was only partially completed
- // due to some failures, and we need to roll back);
- // '2' - free up the underlying data structure, and deregister this
- // naming context from its <index_> (e.g., if the context had
- // <destroy> method invoked and needs to be completely removed from existence).
-
- ACE_UINT32 *counter_;
- // Counter used for generation of POA ids for children Naming
- // Contexts.
-
- TAO_Persistent_Bindings_Map *persistent_context_;
- // A pointer to the underlying data structure used to store name
- // bindings. While our superclass (TAO_Hash_Naming_Context) also
- // maintains a pointer to the data structure, keeping this pointer
- // around saves us from the need to downcast when invoking
- // non-virtual methods.
-
- TAO_Persistent_Context_Index *index_;
- // A pointer to the index object of this naming service: it keeps
- // track of all the naming contexts created. Every time we make a
- // new context or destroy one, we need to make an entry there.
- // Also, we get the allocator needed to initialize us from this guy.
-};
-
-#endif /* TAO_PERSISTENT_NAMING_CONTEXT_H */
diff --git a/TAO/orbsvcs/orbsvcs/Naming/README b/TAO/orbsvcs/orbsvcs/Naming/README
deleted file mode 100644
index ced27c7503f..00000000000
--- a/TAO/orbsvcs/orbsvcs/Naming/README
+++ /dev/null
@@ -1,68 +0,0 @@
-// $Id$
-
-CONTENT
-=======
-This directory contains files implementing CosNaming idl interfaces
-(from CORBA COSS), as well as a few utilities. Server code, service
-executable, and documentation for using the service are located in
-$TAO_ROOT/orbsvcs/Naming_Service.
-
-
-UTILITIES
-=========
-Naming_Utils.{h,cpp} contain utility classes that can simplify
-programs which play a role of Naming Service server or client. See
-$TAO_ROOT/orbsvcs/Naming_Service/Naming_Service.{h,cpp} and
-$TAO_ROOT/orbsvcs/tests/Simple_Naming/client.{h,cpp} for examples of
-using these classes.
-
-
-IMPLEMENTATION
-==============
-The architecture for TAO's implementation of CosNaming::NamingContext
-interface follows the Bridge pattern.
-
- * TAO_Naming_Context (in Naming_Context.h) inherits from
- POA skeleton, and plays the role of 'Abstraction' (aka 'Interface')
- in the Bridge architecture - it forwards all client
- requests to a 'ConcreteImplementor' through an 'Implementor' pointer.
-
- * TAO_Naming_Context_Impl (in Naming_Context.h) is an abstract base class for all
- concrete implementations of NamingContext functionality (i.e., 'Implementor').
-
- * Currently, TAO Naming Service has two 'ConcreteImplementors':
- TAO_Transient_Naming_Context (in Transient_Naming_Context.h), and
- TAO_Persistent_Naming_Context (in Persistent_Naming_Context.h),
- providing non-persistent and persistent, hash-table-based implementations of the
- NamingContext functionality, correspondingly. Both
- 'ConcreteImplementors' inherit from TAO_Hash_Naming_Context (in
- Hash_Naming_Context.h), which, in turn, inherits from
- TAO_Naming_Context_Impl. TAO_Hash_Naming_Context factors out code
- common to both 'ConcreteImplementors'. (Here we have a form of the
- Template Method pattern).
-
-* Other major classes:
- - TAO_Persistent_Context_Index - facilitates implementation of the
- Persistent version of the Naming Service.
- - TAO_BindingsIterator - implements CosNaming::BindingIterator
- interface. Can be used with either of the NamingContext 'ConcreteImplementors'.
-
-* Persistent implementation of the Naming Service uses ACE_Allocators
- and memory-mapped files.
-
-The Bridge implementation class structure makes it easy to:
-
-1) Create and plug-in different CosNaming::NamingContext implementations by
- subclassing TAO_Naming_Context_Impl.
-
-2) Dynamically load an appropriate NamingContext implementation at
- run-time, based on the config file entry, by making TAO_Naming_Context_Impl
- inherit from ACE_Service_Object...
-
-
-TO-DO
-=====
-Extend CosNaming::NamingContext interface and its implementation to
-support binding of more than one object per name and name
-resolution according to policies (e.g., random or round robin), to provide
-Load Balancing functionality.
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Transient_Naming_Context.cpp b/TAO/orbsvcs/orbsvcs/Naming/Transient_Naming_Context.cpp
deleted file mode 100644
index 7d68701e129..00000000000
--- a/TAO/orbsvcs/orbsvcs/Naming/Transient_Naming_Context.cpp
+++ /dev/null
@@ -1,371 +0,0 @@
-// $Id$
-// ============================================================================
-//
-// = LIBRARY
-// cos
-//
-// = FILENAME
-// Transient_Naming_Context.cpp
-//
-// = AUTHOR
-// Marina Spivak <marina@cs.wustl.edu> and
-// Sergio Flores-Gaitan <sergio@cs.wustl.edu>
-//
-// ============================================================================
-#include "ace/Auto_Ptr.h"
-#include "Transient_Naming_Context.h"
-#include "Bindings_Iterator_T.h"
-
-ACE_RCSID(Naming, Transient_Naming_Context, "$Id$")
-
-int
-TAO_Transient_Bindings_Map::unbind (const char *id,
- const char *kind)
-{
- TAO_ExtId name (id, kind);
- return this->map_.unbind (name);
-}
-
-int
-TAO_Transient_Bindings_Map::bind (const char *id,
- const char *kind,
- CORBA::Object_ptr obj,
- CosNaming::BindingType type)
-{
- return this->shared_bind (id, kind, obj, type, 0);
-}
-
-int
-TAO_Transient_Bindings_Map::rebind (const char *id,
- const char *kind,
- CORBA::Object_ptr obj,
- CosNaming::BindingType type)
-{
- return this->shared_bind (id, kind, obj, type, 1);
-}
-
-int
-TAO_Transient_Bindings_Map::find (const char *id,
- const char *kind,
- CORBA::Object_ptr & obj,
- CosNaming::BindingType &type)
-{
- TAO_ExtId name (id, kind);
- TAO_IntId entry;
-
- if (this->map_.find (name,
- entry) != 0)
- return -1;
- else
- {
- obj = CORBA::Object::_duplicate (entry.ref_);
- type = entry.type_;
- return 0;
- }
-}
-
-TAO_Transient_Bindings_Map::TAO_Transient_Bindings_Map (size_t hash_table_size)
- : map_ (hash_table_size)
-{
-}
-
-TAO_Transient_Bindings_Map::~TAO_Transient_Bindings_Map (void)
-{
-}
-
-TAO_Transient_Bindings_Map::HASH_MAP &
-TAO_Transient_Bindings_Map::map (void)
-{
- return map_;
-}
-
-size_t
-TAO_Transient_Bindings_Map::current_size (void)
-{
- return map_.current_size ();
-}
-
-size_t
-TAO_Transient_Bindings_Map::total_size (void)
-{
- return map_.total_size ();
-}
-
-int
-TAO_Transient_Bindings_Map::shared_bind (const char * id,
- const char * kind,
- CORBA::Object_ptr obj,
- CosNaming::BindingType type,
- int rebind)
-{
- TAO_ExtId new_name (id, kind);
- TAO_IntId new_entry (obj, type);
- TAO_IntId old_entry;
-
- if (rebind == 0)
- // Do a normal bind.
- return this->map_.bind (new_name, new_entry);
-
- else
- // Rebind.
- {
- // Check that types of old and new entries match.
- if (this->map_.find (new_name,
- old_entry) == 0
- && type != old_entry.type_)
- return -2;
-
- else
- return this->map_.rebind (new_name, new_entry);
- }
-}
-
-TAO_Transient_Naming_Context::TAO_Transient_Naming_Context (PortableServer::POA_ptr poa,
- const char *poa_id,
- size_t hash_table_size)
- : TAO_Hash_Naming_Context (poa,
- poa_id),
- counter_ (0),
- transient_context_ (0)
-{
- ACE_NEW (this->transient_context_,
- TAO_Transient_Bindings_Map (hash_table_size));
-
- context_ = transient_context_;
-}
-
-TAO_Transient_Naming_Context::~TAO_Transient_Naming_Context (void)
-{
-}
-
-CosNaming::NamingContext_ptr
-TAO_Transient_Naming_Context::make_new_context (PortableServer::POA_ptr poa,
- const char *poa_id,
- size_t context_size,
- CORBA::Environment &ACE_TRY_ENV)
-{
- // Store the stub we will return here.
- CosNaming::NamingContext_var result;
-
- // Put together a servant for the new Naming Context.
-
- TAO_Transient_Naming_Context *context_impl = 0;
- ACE_NEW_THROW_EX (context_impl,
- TAO_Transient_Naming_Context (poa,
- poa_id,
- context_size),
- CORBA::NO_MEMORY ());
- ACE_CHECK_RETURN (result._retn ());
-
- // Put <context_impl> into the auto pointer temporarily, in case next
- // allocation fails.
- ACE_Auto_Basic_Ptr<TAO_Transient_Naming_Context> temp (context_impl);
-
- TAO_Naming_Context *context = 0;
- ACE_NEW_THROW_EX (context,
- TAO_Naming_Context (context_impl),
- CORBA::NO_MEMORY ());
- ACE_CHECK_RETURN (result._retn ());
-
- // Let <implementation> know about it's <interface>.
- context_impl->interface (context);
-
- // Release auto pointer, and start using reference counting to
- // control our servant.
- temp.release ();
- PortableServer::ServantBase_var s = context;
-
- // Register the new context with the POA.
- PortableServer::ObjectId_var id =
- PortableServer::string_to_ObjectId (poa_id);
-
- poa->activate_object_with_id (id.in (),
- context,
- ACE_TRY_ENV);
- ACE_CHECK_RETURN (result._retn ());
-
- result = context->_this (ACE_TRY_ENV);
- ACE_CHECK_RETURN (CosNaming::NamingContext::_nil ());
-
- return result._retn ();
-}
-
-CosNaming::NamingContext_ptr
-TAO_Transient_Naming_Context::new_context (CORBA::Environment &ACE_TRY_ENV)
-{
- ACE_GUARD_THROW_EX (ACE_SYNCH_RECURSIVE_MUTEX,
- ace_mon,
- this->lock_,
- CORBA::INTERNAL ());
- ACE_CHECK_RETURN (CosNaming::NamingContext::_nil ());
-
- // Check to make sure this object didn't have <destroy> method
- // invoked on it.
- if (this->destroyed_)
- ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
- CosNaming::NamingContext::_nil ());
-
- // Generate a POA id for the new context.
- char poa_id[BUFSIZ];
- ACE_OS::sprintf (poa_id,
- "%s_%ld",
- this->poa_id_.c_str (),
- this->counter_++);
-
- // Create a new context.
- CosNaming::NamingContext_var result =
- make_new_context (this->poa_.in (),
- poa_id,
- this->transient_context_->total_size (),
- ACE_TRY_ENV);
- ACE_CHECK_RETURN (CosNaming::NamingContext::_nil ());
-
- return result._retn ();
-}
-
-void
-TAO_Transient_Naming_Context::list (CORBA::ULong how_many,
- CosNaming::BindingList_out &bl,
- CosNaming::BindingIterator_out &bi,
- CORBA::Environment &ACE_TRY_ENV)
-{
- // Allocate nil out parameters in case we won't be able to complete
- // the operation.
- bi = CosNaming::BindingIterator::_nil ();
- ACE_NEW_THROW_EX (bl,
- CosNaming::BindingList (0),
- CORBA::NO_MEMORY ());
- ACE_CHECK;
-
- // Obtain a lock before we proceed with the operation.
- ACE_GUARD_THROW_EX (ACE_SYNCH_RECURSIVE_MUTEX,
- ace_mon,
- this->lock_,
- CORBA::INTERNAL ());
- ACE_CHECK;
-
- // Check to make sure this object didn't have <destroy> method
- // invoked on it.
- if (this->destroyed_)
- ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
-
- // Dynamically allocate iterator for traversing the underlying hash map.
- HASH_MAP::ITERATOR *hash_iter = 0;
- ACE_NEW_THROW_EX (hash_iter,
- HASH_MAP::ITERATOR (transient_context_->map ()),
- CORBA::NO_MEMORY ());
- ACE_CHECK;
-
- // Store <hash_iter temporarily in auto pointer, in case we'll have
- // some failures and throw an exception.
- ACE_Auto_Basic_Ptr<HASH_MAP::ITERATOR> temp (hash_iter);
-
- // Silliness below is required because of broken old g++!!! E.g.,
- // without it, we could have just said HASH_MAP::ITERATOR everywhere we use ITER_DEF.
- typedef ACE_Hash_Map_Manager<TAO_ExtId, TAO_IntId, ACE_Null_Mutex>::ITERATOR ITER_DEF;
- typedef ACE_Hash_Map_Manager<TAO_ExtId, TAO_IntId, ACE_Null_Mutex>::ENTRY ENTRY_DEF;
-
- // Typedef to the type of BindingIterator servant for ease of use.
- typedef TAO_Bindings_Iterator<ITER_DEF, ENTRY_DEF>
- ITER_SERVANT;
-
- // A pointer to BindingIterator servant.
- ITER_SERVANT *bind_iter = 0;
-
- // Number of bindings that will go into the BindingList <bl>.
- CORBA::ULong n;
-
- // 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 the hash map iterator to populate <bl> with bindings.
- bl->length (n);
-
- ENTRY_DEF *hash_entry;
-
- for (CORBA::ULong i = 0; i < n; i++)
- {
- hash_iter->next (hash_entry);
- hash_iter->advance ();
-
- if (ITER_SERVANT::populate_binding (hash_entry, bl[i]) == 0)
- ACE_THROW (CORBA::NO_MEMORY());
- }
-
- // Now we are done with the BindingsList, and we can follow up on
- // the BindingIterator business.
-
- // If we do not need to pass back BindingIterator.
- if (this->context_->current_size () <= how_many)
- return;
- else
- {
- // Create a BindingIterator for return.
- ACE_NEW_THROW_EX (bind_iter,
- ITER_SERVANT (this, hash_iter, this->poa_.in (), this->lock_),
- CORBA::NO_MEMORY ());
-
- // Release <hash_iter> from auto pointer, and start using
- // reference counting to control our servant.
- temp.release ();
- PortableServer::ServantBase_var iter = bind_iter;
-
- // Increment reference count on this Naming Context, so it doesn't get
- // deleted before the BindingIterator servant gets deleted.
- interface_->_add_ref (ACE_TRY_ENV);
- ACE_CHECK;
-
- // Register with the POA.
- 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,
- ACE_TRY_ENV);
- ACE_CHECK;
-
- bi = bind_iter->_this (ACE_TRY_ENV);
- ACE_CHECK;
- }
-}
-#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-template class ACE_Hash_Map_Iterator_Base_Ex<TAO_ExtId, TAO_IntId, ACE_Hash<TAO_ExtId>, ACE_Equal_To<TAO_ExtId>, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Iterator<TAO_ExtId, TAO_IntId, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Iterator_Ex<TAO_ExtId, TAO_IntId, ACE_Hash<TAO_ExtId>, ACE_Equal_To<TAO_ExtId>, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Reverse_Iterator<TAO_ExtId, TAO_IntId, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Reverse_Iterator_Ex<TAO_ExtId, TAO_IntId, ACE_Hash<TAO_ExtId>, ACE_Equal_To<TAO_ExtId>, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Manager_Ex<TAO_ExtId, TAO_IntId, ACE_Hash<TAO_ExtId>, ACE_Equal_To<TAO_ExtId>, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Manager<TAO_ExtId, TAO_IntId, ACE_Null_Mutex>;
-template class ACE_Hash<TAO_ExtId>;
-template class ACE_Equal_To<TAO_ExtId>;
-template class ACE_Hash_Map_Entry<TAO_ExtId, TAO_IntId>;
-template class TAO_Bindings_Iterator<ACE_Hash_Map_Iterator_Ex<TAO_ExtId, TAO_IntId, ACE_Hash<TAO_ExtId>, ACE_Equal_To<TAO_ExtId>, ACE_Null_Mutex>, ACE_Hash_Map_Entry<TAO_ExtId, TAO_IntId> >;
-template class ACE_Auto_Basic_Ptr<TAO_Transient_Naming_Context>;
-template class ACE_Auto_Basic_Ptr<TAO_Bindings_Iterator<ACE_Hash_Map_Iterator_Ex<TAO_ExtId, TAO_IntId, ACE_Hash<TAO_ExtId>, ACE_Equal_To<TAO_ExtId>, ACE_Null_Mutex>, ACE_Hash_Map_Entry<TAO_ExtId, TAO_IntId> > >;
-template class ACE_Auto_Basic_Ptr<ACE_Hash_Map_Iterator_Ex<TAO_ExtId, TAO_IntId, ACE_Hash<TAO_ExtId>, ACE_Equal_To<TAO_ExtId>, ACE_Null_Mutex> >;
-#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-
-#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<TAO_ExtId, TAO_IntId, ACE_Hash<TAO_ExtId>, ACE_Equal_To<TAO_ExtId>, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Iterator<TAO_ExtId, TAO_IntId, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Iterator_Ex<TAO_ExtId, TAO_IntId, ACE_Hash<TAO_ExtId>, ACE_Equal_To<TAO_ExtId>, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Reverse_Iterator<TAO_ExtId, TAO_IntId, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<TAO_ExtId, TAO_IntId, ACE_Hash<TAO_ExtId>, ACE_Equal_To<TAO_ExtId>, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Manager_Ex<TAO_ExtId, TAO_IntId, ACE_Hash<TAO_ExtId>, ACE_Equal_To<TAO_ExtId>, ACE_Null_Mutex>
-
-#pragma instantiate ACE_Hash_Map_Manager<TAO_ExtId, TAO_IntId, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash<TAO_ExtId>
-#pragma instantiate ACE_Equal_To<TAO_ExtId>
-#pragma instantiate ACE_Hash_Map_Entry<TAO_ExtId, TAO_IntId>
-#pragma instantiate TAO_Bindings_Iterator<ACE_Hash_Map_Iterator_Ex<TAO_ExtId, TAO_IntId, ACE_Hash<TAO_ExtId>, ACE_Equal_To<TAO_ExtId>, ACE_Null_Mutex>, ACE_Hash_Map_Entry<TAO_ExtId, TAO_IntId> >
-#pragma instantiate ACE_Auto_Basic_Ptr<TAO_Transient_Naming_Context>
-#pragma instantiate ACE_Auto_Basic_Ptr<TAO_Bindings_Iterator<ACE_Hash_Map_Iterator_Ex<TAO_ExtId, TAO_IntId, ACE_Hash<TAO_ExtId>, ACE_Equal_To<TAO_ExtId>, ACE_Null_Mutex>, ACE_Hash_Map_Entry<TAO_ExtId, TAO_IntId> > >
-#pragma instantiate ACE_Auto_Basic_Ptr<ACE_Hash_Map_Iterator_Ex<TAO_ExtId, TAO_IntId, ACE_Hash<TAO_ExtId>, ACE_Equal_To<TAO_ExtId>, ACE_Null_Mutex> >
-#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Transient_Naming_Context.h b/TAO/orbsvcs/orbsvcs/Naming/Transient_Naming_Context.h
deleted file mode 100644
index b561ef6aa70..00000000000
--- a/TAO/orbsvcs/orbsvcs/Naming/Transient_Naming_Context.h
+++ /dev/null
@@ -1,179 +0,0 @@
-/* -*- C++ -*- */
-// $Id$
-// ============================================================================
-//
-// = LIBRARY
-// cos
-//
-// = FILENAME
-// Transient_Naming_Context.h
-//
-// = AUTHOR
-// Marina Spivak <marina@cs.wustl.edu>
-//
-// ============================================================================
-
-#ifndef TAO_TRANSIENT_NAMING_CONTEXT_H
-#define TAO_TRANSIENT_NAMING_CONTEXT_H
-
-#include "Hash_Naming_Context.h"
-#include "Entries.h"
-#include "ace/Hash_Map_Manager.h"
-
-#if !defined (ACE_LACKS_PRAGMA_ONCE)
-# pragma once
-#endif /* ACE_LACKS_PRAGMA_ONCE */
-
-class TAO_ORBSVCS_Export TAO_Transient_Bindings_Map : public TAO_Bindings_Map
-{
- // = TITLE
- // Provides hash-table-based transient storage for name to object bindings in a
- // Naming Context.
- //
- // = DESCRIPTION
- // A thin wrapper on top of ACE_Hash_Map_Manager. Supports
- // TAO_Bindings_Map interface. Used by TAO_Transient_Naming_Context.
-public:
-
- typedef ACE_Hash_Map_Manager<TAO_ExtId, TAO_IntId, ACE_Null_Mutex> HASH_MAP;
- // Underlying data structure - typedef for ease of use.
-
- // = Initialization and termination methods.
-
- TAO_Transient_Bindings_Map (size_t hash_table_size);
- // Constructor.
-
- virtual ~TAO_Transient_Bindings_Map (void);
- // Destructor.
-
- // = Accessors.
-
- HASH_MAP &map (void);
- // Get a reference to the underlying hash map.
-
- size_t total_size (void);
- // Return the size of the underlying hash table.
-
- virtual size_t current_size (void);
- // Return current number of entries (name bindings) in the
- // underlying hash map.
-
- // = Name bindings manipulation methods.
-
- virtual int bind (const char *id,
- const char *kind,
- CORBA::Object_ptr obj,
- CosNaming::BindingType type);
- // Add a binding with the specified parameters to the table.
- // Return 0 on success and -1 on failure, 1 if there already is a
- // binding with <id> and <kind>.
-
- virtual int rebind (const char *id,
- const char *kind,
- CORBA::Object_ptr obj,
- CosNaming::BindingType type);
- // Overwrite a binding containing <id> and <kind> (or create a new
- // one if one doesn't exist) with the specified parameters. Return
- // 0 or 1 on success. Return -1 or -2 on failure. (-2 is returned
- // if the new and old bindings differ in type).
-
- virtual int unbind (const char * id,
- const char * kind);
- // Remove a binding containing <id> and <kind> from the table.
- // Return 0 on success and -1 on failure.
-
- virtual int find (const char * id,
- const char * kind,
- CORBA::Object_ptr & obj,
- CosNaming::BindingType &type);
- // Find the binding containing <id> and <kind> in the table, and
- // pass binding's type and object back to the caller by reference.
- // Return 0 on success and -1 on failure. Note: a 'duplicated' object
- // reference is assigned to <obj>, so the caller is responsible for
- // its deallocation.
-
-private:
-
- int shared_bind (const char *id,
- const char *kind,
- CORBA::Object_ptr obj,
- CosNaming::BindingType type,
- int rebind);
- // Helper: factors common code from <bind> and <rebind>.
-
- HASH_MAP map_;
- // Hash map used for storage.
-};
-
-class TAO_ORBSVCS_Export TAO_Transient_Naming_Context : public TAO_Hash_Naming_Context
-{
- // = TITLE
- // This class plays a role of a 'ConcreteImplementor' in the
- // Bridge pattern architecture of the CosNaming::NamingContext
- // implementation.
- //
- // = DESCRIPTION
- // This class provides a transient implementation of the
- // NamingContext functionality, i.e., the state is not preserved
- // across process boundaries. Derives from
- // TAO_Hash_Naming_Context and uses TAO_Transient_Bindings_Map to
- // store name to object bindings.
-
-public:
-
- typedef TAO_Transient_Bindings_Map::HASH_MAP HASH_MAP;
- // Underlying data structure - typedef for ease of use.
-
- // = Initialization and termination methods.
-
- TAO_Transient_Naming_Context (PortableServer::POA_ptr poa,
- const char *poa_id,
- size_t hash_table_size
- = ACE_DEFAULT_MAP_SIZE);
- // Constructor.
-
- virtual ~TAO_Transient_Naming_Context (void);
- // Destructor.
-
- // = Utility methods.
- static CosNaming::NamingContext_ptr make_new_context (PortableServer::POA_ptr poa,
- const char *poa_id,
- size_t context_size,
- CORBA::Environment &ACE_TRY_ENV);
- // This utility method factors out the code needed to create a new
- // Transient Naming Context servant and activate it under the
- // specified POA with the specified id. This function is static so
- // that the code can be used, both from inside the class (e.g., <new_context>),
- // and from outside (e.g., Naming_Utils.cpp).
-
- // = Methods not implemented in TAO_Hash_Naming_Context.
-
- virtual CosNaming::NamingContext_ptr new_context (CORBA::Environment &ACE_TRY_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 void list (CORBA::ULong how_many,
- CosNaming::BindingList_out &bl,
- CosNaming::BindingIterator_out &bi,
- CORBA::Environment &ACE_TRY_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.
-
-protected:
-
- ACE_UINT32 counter_;
- // Counter used for generation of POA ids for children Naming
- // Contexts.
-
- TAO_Transient_Bindings_Map *transient_context_;
- // A pointer to the underlying data structure used to store name
- // bindings. While our superclass (TAO_Hash_Naming_Context) also
- // maintains a pointer to the data structure, keeping this pointer
- // around saves us from the need to downcast when invoking
- // non-virtual methods.
-};
-
-#endif /* TAO_TRANSIENT_NAMING_CONTEXT_H */