[omniORB] Resolving Names.
Óscar
Óscar
Wed, 16 Jan 2002 17:30:05 +0100
Thanks, but before test them, I have a doubt: when bind() receives a
Name does not bind all contexts inside the path, does it?
Duncan Grisby wrote:
>
> On Wednesday 16 January, =?iso-8859-1?Q?=D3scar?= Rafael de la Cr=
uz =?iso-8859-1?Q?S=E1nchez?= de la Plaza wrote:
>
> > I would like to have two utilities to work with the Naming Service. I=
t
> > would be interesting to have two utility functions:
> >
> > - One receiving a name in format
> > "context/subcontext1/subtontext2/.../object" and a CORBA::Object_ptr.
> > The funcion binds the object reference received with the given name.
> > - The other one receiving a name (in the same format) and returning a=
n
> > object reference if it exists.
>
> The standard CosNaming::NamingContextExt interface almost does what
> you want:
>
> interface NamingContextExt : NamingContext {
> ...
> Name to_name(in StringName sn) raises(InvalidName);
> ...
> Object resolve_str(in StringName n)
> raises(NotFound, CannotProceed, InvalidName, AlreadyBound);
> };
>
> resolve_str() does the second of your wishes; to bind an object, you
> need two calls:
>
> Name_var name = nc->to_name("path/to/object");
> nc->bind(name, obj);
>
> Unfortunately, the to_name() call involves a remote call to the Naming
> service. You can avoid it with the omniORB-specific:
>
> Name_var name = omniURI::stringToName("path/to/object");
> nc->bind(name, obj);
>
> Cheers,
>
> Duncan.
>
> --
> -- Duncan Grisby \ Research Engineer --
> -- AT&T Laboratories Cambridge --
> -- http://www.uk.research.att.com/~dpg1 --
--
-
=====================================================
Óscar Rafael de la Cruz Sánchez de la Plaza.
GMV S.A. Directorate of Space and Defense.
Ground Systems / Control Systems and On-board Software.
P.T.M. Isaac Newton, 11. 28760. Tres Cantos. MADRID.
Phone.: +34 91 807 3348 Fax.: +34 91 807 2199
Ext.: 3348. Room.: 201
e-mail: ocruz@gmv.es