Horus Doc || Corba Reference || Corba   Client Server   Stubs C++   Stubs Java   Servant Generator  

HxNSBinding Class Reference

Class to facilitate communication with the Corba NamingService to store servers (Constructor objects) in the NS in the "HxCorba/Servers" context. More...

#include <HxNSBinding.h>

List of all members.

Public Methods

virtual ~HxNSBinding ()
 Destructor, remove binding from NS. More...


Static Public Methods

HxNSBinding * bindServer (const char *name, const char *nsAddress)
 Registers the Constructor object of the HxServer instance in the NS that should be present at the given nsAddress and returns the binding. More...


Detailed Description

Class to facilitate communication with the Corba NamingService to store servers (Constructor objects) in the NS in the "HxCorba/Servers" context.


Constructor & Destructor Documentation

HxNSBinding::~HxNSBinding   [virtual]
 

Destructor, remove binding from NS.

00024 {
00025     try {
00026         _nc->unbind(_name);
00027     }
00028     catch(CORBA::Exception&) {
00029     }
00030 }


Member Function Documentation

HxNSBinding * HxNSBinding::bindServer const char *    name,
const char *    nsAddress
[static]
 

Registers the Constructor object of the HxServer instance in the NS that should be present at the given nsAddress and returns the binding.

00034 {
00035     HxString address = nsAddress;
00036     if(address.find(":") == HxString::npos)
00037         address += ":8001";
00038 
00039     HxString corbaloc = "corbaloc::";
00040     corbaloc += address;
00041     corbaloc += "/NameService";
00042 
00043     try {
00044         CORBA::Object_var obj =
00045             HxServer::instance()->string_to_object(corbaloc.c_str());
00046         CosNaming::NamingContext_var nc = 
00047             CosNaming::NamingContext::_narrow(obj);
00048         nc = getContext(nc, "HxCorba");
00049         nc = getContext(nc, "Servers");
00050 
00051         CosNaming::Name path;
00052         path.length(1);
00053         path[0].id = name;
00054 
00055         CORBA::Object_var ctor = 
00056             HxServer::instance()->getInitialObject("Constructor");
00057 
00058         nc->bind(path, ctor);
00059 
00060         return new HxNSBinding(path, nc);
00061     }
00062     catch(CORBA::Exception& ex) {
00063         std::cerr << ex << std::endl;
00064     }
00065 
00066     return NULL;
00067 }


The documentation for this class was generated from the following files:
Generated on Mon Jan 27 15:20:56 2003 for CorbaReference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001