summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsergio <sergio@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-11-11 07:19:07 +0000
committersergio <sergio@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-11-11 07:19:07 +0000
commit91ae4c878458aec1bc31943d8d3ee86c79abbbdd (patch)
treeb3a5f2b56a05d03e11395ce125e2af816961a353
parent2b72b080b25c63ef8b7fc73ee4092cdc02b1d145 (diff)
downloadATCD-91ae4c878458aec1bc31943d8d3ee86c79abbbdd.tar.gz
*** empty log message ***
-rw-r--r--TAO/orbsvcs/bin/Naming_Service/TAO/CosNaming_i.cpp115
-rw-r--r--TAO/orbsvcs/bin/Naming_Service/TAO/Makefile8
-rw-r--r--TAO/orbsvcs/bin/Naming_Service/TAO/clnt.cpp30
3 files changed, 119 insertions, 34 deletions
diff --git a/TAO/orbsvcs/bin/Naming_Service/TAO/CosNaming_i.cpp b/TAO/orbsvcs/bin/Naming_Service/TAO/CosNaming_i.cpp
index 9aa125336f5..042130672b2 100644
--- a/TAO/orbsvcs/bin/Naming_Service/TAO/CosNaming_i.cpp
+++ b/TAO/orbsvcs/bin/Naming_Service/TAO/CosNaming_i.cpp
@@ -86,7 +86,8 @@ NS_NamingContext::bind (const CosNaming::Name& n,
if (len == 0)
{
IT_env.clear ();
- IT_env.exception (new CosNaming::NamingContext::INVALID_NAME);
+ IT_env.exception (new CORBA::UNKNOWN (CORBA::COMPLETED_NO));
+ // IT_env.exception (new ACE_NESTED_CLASS (CosNaming,NamingContext)::InvalidName);
return;
}
/* @@ */// throw CosNaming::NamingContext::InvalidName ();
@@ -111,7 +112,13 @@ NS_NamingContext::bind (const CosNaming::Name& n,
// Try binding the name.
if (context_.bind (name, entry) == -1)
- ; /**/// throw CosNaming::NamingContext::AlreadyBound ();
+ {
+ IT_env.clear ();
+ IT_env.exception (new CORBA::UNKNOWN (CORBA::COMPLETED_NO));
+ // IT_env.exception (new ACE_NESTED_CLASS (CosNaming,NamingContext)::AlreadyBound);
+ return;
+ }
+ /**/// throw CosNaming::NamingContext::AlreadyBound ();
// May need to add case dealing with -1. (Maybe throw cannot
// proceed).
}
@@ -127,19 +134,25 @@ NS_NamingContext::rebind (const CosNaming::Name& n,
// check for invalid name.
if (len == 0)
- ;/* @@ */// throw CosNaming::NamingContext::InvalidName ();
+ {
+ IT_env.clear ();
+ IT_env.exception (new CORBA::UNKNOWN (CORBA::COMPLETED_NO));
+ // IT_env.exception (new ACE_NESTED_CLASS (CosNaming,NamingContext)::InvalidName);
+ return;
+ }
+ /* @@ */// throw CosNaming::NamingContext::InvalidName ();
// If we received compound name, resolve it to get the context in
// which the rebinding should take place, then perform the rebinding
// on target context.
if (len > 1)
- {
- CosNaming::NamingContext_var cont = get_context (n);
- CosNaming::Name simple_name;
- simple_name.length (1);
- simple_name[0] = n[len - 1];
- cont->rebind (simple_name, obj, IT_env);
- }
+ {
+ CosNaming::NamingContext_var cont = get_context (n);
+ CosNaming::Name simple_name;
+ simple_name.length (1);
+ simple_name[0] = n[len - 1];
+ cont->rebind (simple_name, obj, IT_env);
+ }
// If we received a simple name, we need to rebind it in this context.
else
{
@@ -147,7 +160,7 @@ NS_NamingContext::rebind (const CosNaming::Name& n,
NS_ExtId name (n[0].id, n[0].kind);
NS_IntId oldentry;
NS_ExtId oldname;
-
+
// Try rebinding the name.
if (context_.rebind (name, entry, oldname, oldentry) == -1)
;
@@ -165,7 +178,13 @@ NS_NamingContext::bind_context (const CosNaming::Name &n,
// Check for invalid name.
if (len == 0)
- ;/* @@ */// throw CosNaming::NamingContext::InvalidName ();
+ {
+ IT_env.clear ();
+ IT_env.exception (new CORBA::UNKNOWN (CORBA::COMPLETED_NO));
+ // IT_env.exception (new ACE_NESTED_CLASS (CosNaming,NamingContext)::InvalidName);
+ return;
+ }
+ /* @@ */// 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
@@ -188,7 +207,13 @@ NS_NamingContext::bind_context (const CosNaming::Name &n,
// Try binding the name.
if (context_.bind (name, entry) == 1)
- ; /* @@ */// throw CosNaming::NamingContext::AlreadyBound ();
+ {
+ IT_env.clear ();
+ IT_env.exception (new CORBA::UNKNOWN (CORBA::COMPLETED_NO));
+ // IT_env.exception (new ACE_NESTED_CLASS (CosNaming,NamingContext)::AlreadyBound);
+ return;
+ }
+ /* @@ */// throw CosNaming::NamingContext::AlreadyBound ();
// May need to add case dealing with -1.
}
}
@@ -203,7 +228,13 @@ NS_NamingContext::rebind_context (const CosNaming::Name &n,
// Check for invalid name.
if (len == 0)
- ; /* @@ */// throw CosNaming::NamingContext::InvalidName ();
+ {
+ IT_env.clear ();
+ IT_env.exception (new CORBA::UNKNOWN (CORBA::COMPLETED_NO));
+ // IT_env.exception (new ACE_NESTED_CLASS (CosNaming,NamingContext)::InvalidName);
+ return;
+ }
+ /* @@ */// 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
@@ -240,15 +271,27 @@ NS_NamingContext::resolve (const CosNaming::Name& n,
CORBA::ULong len = n.length ();
// check for invalid name.
- if (len == 0) {
- ; /* @@ *//// throw CosNaming::NamingContext::InvalidName ();
- }
+ if (len == 0)
+ {
+ IT_env.clear ();
+ // IT_env.exception (new ACE_NESTED_CLASS (CosNaming,NamingContext)::InvalidName);
+ IT_env.exception (new CORBA::UNKNOWN (CORBA::COMPLETED_NO));
+ return 0;
+ }
+ /* @@ *//// throw CosNaming::NamingContext::InvalidName ();
+
// resolve the first component of the name
NS_ExtId name (n[0].id, n[0].kind);
NS_IntId entry;
- if (context_.find (name, entry) == -1) {
- ; /* @@ */// throw CosNaming::NamingContext::NotFound (CosNaming::NamingContext::not_object, n);
- }
+ if (context_.find (name, entry) == -1)
+ {
+ IT_env.clear ();
+ // IT_env.exception (new ACE_NESTED_CLASS (CosNaming,NamingContext)::NotFound (CosNaming::NamingContext::not_object, n));
+ IT_env.exception (new CORBA::UNKNOWN (CORBA::COMPLETED_NO));
+ return 0;
+ }
+ /* @@ */// throw CosNaming::NamingContext::NotFound (CosNaming::NamingContext::not_object, n);
+
CORBA::Object_ptr item = entry.ref_;
// if the name we have to resolve is a compound name
@@ -259,7 +302,13 @@ NS_NamingContext::resolve (const CosNaming::Name& n,
if (entry.type_ == CosNaming::ncontext)
cont = CosNaming::NamingContext::_narrow (item);
else
- ; /* @@ */// throw CosNaming::NamingContext::NotFound (CosNaming::NamingContext::not_context, n);
+ {
+ IT_env.clear ();
+ IT_env.exception (new CORBA::UNKNOWN (CORBA::COMPLETED_NO));
+ // IT_env.exception (new ACE_NESTED_CLASS (CosNaming,NamingContext)::NotFound (CosNaming::NamingContext::not_context, n));
+ return 0;
+ }
+ /* @@ */// throw CosNaming::NamingContext::NotFound (CosNaming::NamingContext::not_context, n);
CosNaming::Name rest_of_name;
rest_of_name.length (len - 1);
@@ -285,7 +334,13 @@ NS_NamingContext::unbind (const CosNaming::Name& n,
// check for invalid name.
if (len == 0)
- ; /* @@ *//// throw CosNaming::NamingContext::InvalidName ();
+ {
+ IT_env.clear ();
+ IT_env.exception (new CORBA::UNKNOWN (CORBA::COMPLETED_NO));
+ // IT_env.exception (new ACE_NESTED_CLASS (CosNaming,NamingContext)::InvalidName);
+ return;
+ }
+ /* @@ *//// 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
@@ -305,7 +360,13 @@ NS_NamingContext::unbind (const CosNaming::Name& n,
NS_ExtId name (n[0].id, n[0].kind);
// try unbinding the name.
if (context_.unbind (name) == -1)
- ; /* @@ */// throw CosNaming::NamingContext::NotFound (CosNaming::NamingContext::not_object, n);
+ {
+ IT_env.clear ();
+ IT_env.exception (new CORBA::UNKNOWN (CORBA::COMPLETED_NO));
+ // IT_env.exception (new ACE_NESTED_CLASS (CosNaming,NamingContext)::NotFound (CosNaming::NamingContext::not_object, n));
+ return;
+ }
+ /* @@ */// throw CosNaming::NamingContext::NotFound (CosNaming::NamingContext::not_object, n);
}
}
@@ -350,7 +411,13 @@ NS_NamingContext::destroy (CORBA::Environment &IT_env)
ACE_UNUSED_ARG (IT_env);
if (context_.current_size () != 0)
- ; /* @@ */// throw CosNaming::NamingContext::NotEmpty ();
+ {
+ IT_env.clear ();
+ IT_env.exception (new CORBA::UNKNOWN (CORBA::COMPLETED_NO));
+ // IT_env.exception (new ACE_NESTED_CLASS (CosNaming,NamingContext)::NotEmpty);
+ return;
+ }
+ /* @@ */// throw CosNaming::NamingContext::NotEmpty ();
// destroy context
CORBA::release (tie_ref_);
diff --git a/TAO/orbsvcs/bin/Naming_Service/TAO/Makefile b/TAO/orbsvcs/bin/Naming_Service/TAO/Makefile
index dd03171abc2..dcbe6f8683b 100644
--- a/TAO/orbsvcs/bin/Naming_Service/TAO/Makefile
+++ b/TAO/orbsvcs/bin/Naming_Service/TAO/Makefile
@@ -11,13 +11,14 @@
LDLIBS = -lTAO
-IDL_SRC = CosNamingC.cpp CosNamingS.cpp
+IDL_SRC = CosNamingC.cpp CosNamingS.cpp loggerC.cpp
+
PROG_SRCS = $(IDL_SRC) NS_CosNaming.cpp svr.cpp clnt.cpp
LSRC = $(PROG_SRCS)
COSNAMING_SVR_OBJS = CosNamingC.o CosNamingS.o svr.o CosNaming_i.o NS_CosNaming.o
-COSNAMING_CLT_OBJS = CosNamingC.o clnt.o
+COSNAMING_CLT_OBJS = CosNamingC.o clnt.o loggerC.o
BIN = svr clnt
BUILD = $(BIN)
@@ -42,8 +43,9 @@ DCFLAGS = -g
LDFLAGS += -L$(TAO_ROOT)/tao
CPPFLAGS += -I$(TAO_ROOT) -I$(TAO_ROOT)/tao/compat $(TSS_ORB_FLAG)#-H
-$(IDL_SRC): CosNaming.idl
+$(IDL_SRC): CosNaming.idl logger.idl
$(TAO_ROOT)/TAO_IDL/tao_idl CosNaming.idl
+ $(TAO_ROOT)/TAO_IDL/tao_idl logger.idl
svr: $(addprefix $(VDIR),$(COSNAMING_SVR_OBJS))
$(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS)
diff --git a/TAO/orbsvcs/bin/Naming_Service/TAO/clnt.cpp b/TAO/orbsvcs/bin/Naming_Service/TAO/clnt.cpp
index 126c5a79556..4be80eeaf6a 100644
--- a/TAO/orbsvcs/bin/Naming_Service/TAO/clnt.cpp
+++ b/TAO/orbsvcs/bin/Naming_Service/TAO/clnt.cpp
@@ -19,6 +19,7 @@
#include "clnt.h"
#include "CosNaming_i.h"
+#include "../../Logger/loggerC.h"
// constructor
@@ -78,7 +79,18 @@ CosNaming_Client::parse_args (void)
int
CosNaming_Client::run (void)
{
+ //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ // Time to bind to logger server
+ CosNaming::Name n;
+ CORBA::Object_ptr l_obj;
+ Logger_var logger;
+ n.length (1);
+ n[0].id = CORBA::string_dup ("logger");
+
+ l_obj = this->CosNaming_->resolve (n, this->env_);
+ logger = Logger::_narrow (l_obj);
+ logger->log ("I am logging using a reference obtained from the Naming Service!!!", this->env_);
if (this->exit_later_)
{
@@ -98,16 +110,19 @@ CosNaming_Client::~CosNaming_Client (void)
int
CosNaming_Client::init (int argc, char **argv)
{
+ // Logger_ptr logger_1_;
+ // Logger obj ref
+ //Logger_Factory_ptr factory_;
+ // factory pointer for logger.
+
this->argc_ = argc;
this->argv_ = argv;
- // CosNaming::NamingContext_ptr cos_naming_i = new CosNaming::NamingContext;
-
// retrieve the ORB
- CORBA::ORB_init (this->argc_,
- this->argv_,
- "nameserver",
- this->env_);
+ CORBA::ORB_ptr orb = CORBA::ORB_init (this->argc_,
+ this->argv_,
+ "internet",
+ this->env_);
if (this->env_.exception () != 0)
{
@@ -133,7 +148,8 @@ CosNaming_Client::init (int argc, char **argv)
if (CORBA::is_nil (this->objref_) == CORBA::B_TRUE)
ACE_ERROR_RETURN ((LM_ERROR,
- " _bind returned null object for host (%s), port (%d)\n",
+ " _bind returned null object for key(%s), host (%s), port (%d)\n",
+ this->cosnaming_factory_key_,
this->hostname_,
this->portnum_),
1);