summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-09-21 23:20:58 +0000
committerirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-09-21 23:20:58 +0000
commit970025839d5548be9ca7f0730e0f66b75ecb7a41 (patch)
treea9472996c9d88ccd7cda980f22b0dd3b46c19131
parent9b9fd1799f4cdc8cb3db537a6a6ee897fea2b78d (diff)
downloadATCD-970025839d5548be9ca7f0730e0f66b75ecb7a41.tar.gz
*** empty log message ***
-rw-r--r--TAO/ChangeLog-98c7
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.cpp32
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.h4
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp11
4 files changed, 43 insertions, 11 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c
index 5963552155a..59d08df41e7 100644
--- a/TAO/ChangeLog-98c
+++ b/TAO/ChangeLog-98c
@@ -1,3 +1,10 @@
+Mon Sep 21 18:20:35 1998 Irfan Pyarali <irfan@cs.wustl.edu>
+
+ * orbsvcs/orbsvcs/Naming/CosNaming_i.cpp (new_context and list):
+ Cannot call _this() directly since the POA has the USER_ID
+ policy. Therefore, added a simple scheme for producing names
+ based on a counter value.
+
Mon Sep 21 18:15:13 1998 Carlos O'Ryan <coryan@cs.wustl.edu>
* tao/ORB.cpp:
diff --git a/TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.cpp b/TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.cpp
index 5d40fada498..70eebcfdfc2 100644
--- a/TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.cpp
+++ b/TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.cpp
@@ -23,7 +23,8 @@ TAO_NamingContext::TAO_NamingContext (PortableServer::POA_ptr poa,
int root)
: lock_ (0),
root_ (root),
- poa_ (PortableServer::POA::_duplicate (poa))
+ poa_ (PortableServer::POA::_duplicate (poa)),
+ counter_ (0)
{
// Deal with faults.
if (context_.open (default_hash_table_size) == -1)
@@ -457,6 +458,12 @@ TAO_NamingContext::unbind (const CosNaming::Name& n,
CosNaming::NamingContext_ptr
TAO_NamingContext::new_context (CORBA::Environment &_env)
{
+ ACE_GUARD_THROW_RETURN (ACE_Lock,
+ ace_mon,
+ *this->lock_,
+ CORBA::INTERNAL (CORBA::COMPLETED_NO),
+ CosNaming::NamingContext::_nil ());
+
TAO_NamingContext *c = 0;
CosNaming::NamingContext_var result;
@@ -467,8 +474,20 @@ TAO_NamingContext::new_context (CORBA::Environment &_env)
result._retn ());
TAO_TRY
{
+ char name[BUFSIZ];
+ ACE_OS::sprintf (name, "%d", this->counter_++);
+
+ PortableServer::ObjectId_var id =
+ PortableServer::string_to_ObjectId (name);
+
+ this->poa_->activate_object_with_id (id.in (),
+ c,
+ TAO_TRY_ENV);
+ TAO_CHECK_ENV;
+
result = c->_this (TAO_TRY_ENV);
TAO_CHECK_ENV;
+
return result._retn ();
}
TAO_CATCHANY
@@ -661,6 +680,17 @@ TAO_NamingContext::list (CORBA::ULong how_many,
TAO_TRY_ENV);
TAO_CHECK_ENV;
+ char name[BUFSIZ];
+ ACE_OS::sprintf (name, "%d", this->counter_++);
+
+ PortableServer::ObjectId_var id =
+ PortableServer::string_to_ObjectId (name);
+
+ this->poa_->activate_object_with_id (id.in (),
+ bind_iter,
+ TAO_TRY_ENV);
+ TAO_CHECK_ENV;
+
bi = bind_iter->_this (TAO_TRY_ENV);
TAO_CHECK_ENV;
}
diff --git a/TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.h b/TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.h
index 9ad6d748e47..6567d8ebd45 100644
--- a/TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.h
+++ b/TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.h
@@ -155,7 +155,6 @@ protected:
// This is a helper function for <list> method.
// It is necessary due to inability to have 2 TRY blocks in one function.
-private:
HASH_MAP context_;
// This implementation of <NamingContext> uses <ACE_Hash_Map> for
// storage and manipulation of name-object bindings.
@@ -172,6 +171,9 @@ private:
PortableServer::POA_var poa_;
// Implement a different _default_POA()
+
+ u_long counter_;
+ // This counter is used to generate names for children
};
class TAO_ORBSVCS_Export TAO_BindingIterator : public POA_CosNaming::BindingIterator
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp b/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp
index b750398841f..fcf2722d88e 100644
--- a/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp
+++ b/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp
@@ -99,24 +99,17 @@ TAO_Naming_Server::init_new_naming (CORBA::ORB_ptr orb,
poa->activate_object_with_id (id.in (),
this->naming_context_impl_,
TAO_TRY_ENV);
-
TAO_CHECK_ENV;
this->naming_context_ =
this->naming_context_impl_->_this (TAO_TRY_ENV);
TAO_CHECK_ENV;
-
// Stringify the objref we'll be implementing, and print it to
// stdout. Someone will take that string and give it to a
- // client. Then release the object.
- CORBA::Object_var obj =
- poa->id_to_reference (id.in (),
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
+ // client.
this->naming_service_ior_=
- orb->object_to_string (obj.in (),
+ orb->object_to_string (this->naming_context_.in (),
TAO_TRY_ENV);
TAO_CHECK_ENV;