Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

<Naming Service> Naming context & bindings vs. directories & files

2 views
Skip to first unread message

Alex Vinokur

unread,
Dec 8, 2005, 1:26:20 PM12/8/05
to
Naming contexts in Naming service are similar to directories in file systems.
Are 'bindings related to a naming context' similar to 'files related to a directory'?

In other words, can a naming context hold several bindings?


Example (Pseudo-code)

CosNaming::NamingContext_var inc;

CosNaming::Name name;
name.length(1);

name[0].id = “id-a1”;
name[0].kind = "kind-a1";
inc->bind(name, obj1);

name.length(2);
name[0].id = “id-b1”;
name[0].kind = "kind-b1";

name[1].id = "id-b2";
name[1].kind = "kind-b2";
inc->bind(name, obj2);

Here we have the following naming contexts:
/id-a1.kind-a1 the only binding: name->obj1
/id-b1.kind-b1
/id-b1.kind-b1/id-b2.kind-b2 the only binding: name->obj2

Can we add a new binding to a naming context?

--
Alex Vinokur
email: alex DOT vinokur AT gmail DOT com
http://mathforum.org/library/view/10978.html
http://sourceforge.net/users/alexvn


Douglas C. Schmidt

unread,
Dec 8, 2005, 9:54:16 PM12/8/05
to
Hi Alex,

>> Naming contexts in Naming service are similar to directories in file systems.

Right.

>> Are 'bindings related to a naming context' similar to 'files related to a directory'?

Yes.

>> In other words, can a naming context hold several bindings?

Assuming by "binding" you mean "the mapping of string name to object
reference" then yes, a naming context can have many bindings, just
like a directory can have many files (and subdirectories).

>> Example (Pseudo-code)
>>
>> CosNaming::NamingContext_var inc;
>>
>> CosNaming::Name name;
>> name.length(1);
>>
>> name[0].id = “id-a1”;
>> name[0].kind = "kind-a1";
>> inc->bind(name, obj1);
>>
>> name.length(2);
>> name[0].id = “id-b1”;
>> name[0].kind = "kind-b1";
>>
>> name[1].id = "id-b2";
>> name[1].kind = "kind-b2";
>> inc->bind(name, obj2);
>>
>> Here we have the following naming contexts:

Actually, there's just one naming context here. You have to use a
different operation to create/bind a naming context
(bind_new_context()).

>> /id-a1.kind-a1 the only binding: name->obj1
>> /id-b1.kind-b1
>> /id-b1.kind-b1/id-b2.kind-b2 the only binding: name->obj2
>>
>> Can we add a new binding to a naming context?

Sure, that's what the bind() method does for object references and
bind_new_context() does for contexts.

Please take a look at the discussion of naming contexts in IONA's
ORBacus documentation at

http://www.iona.com/devcenter/orbacus/training_download.html

It may save you a lot of time.

Thanks,

Doug
--
Dr. Douglas C. Schmidt Professor and Associate Chair
Electrical Engineering and Computer Science TEL: (615) 343-8197
Institute for Software Integrated Systems WEB: www.dre.vanderbilt.edu/~schmidt
Vanderbilt University, Nashville TN, 37203 NET: d.sc...@vanderbilt.edu
--
Dr. Douglas C. Schmidt Professor and Associate Chair
Electrical Engineering and Computer Science TEL: (615) 343-8197
Institute for Software Integrated Systems WEB: www.dre.vanderbilt.edu/~schmidt
Vanderbilt University, Nashville TN, 37203 NET: d.sc...@vanderbilt.edu

Alex Vinokur

unread,
Dec 9, 2005, 8:49:40 AM12/9/05
to

"Douglas C. Schmidt" <sch...@ace.cs.wustl.edu> wrote in message news:dnarko$9...@ace.cs.wustl.edu...
> Hi Alex,

[snip]

> Please take a look at the discussion of naming contexts in IONA's
> ORBacus documentation at
>
> http://www.iona.com/devcenter/orbacus/training_download.html


It is excellent documentation!

Particularly, I found out answers om questions in "19.12. Context Creation Example".

Indeed, excellent!

>
> It may save you a lot of time.
>
> Thanks,
>

[snip]

Thanks.

Alex Vinokur

unread,
Dec 10, 2005, 12:55:11 AM12/10/05
to

"Alex Vinokur" <ale...@users.sourceforge.net> wrote in message news:dnc22s$7en$1...@domitilla.aioe.org...

>
> "Douglas C. Schmidt" <sch...@ace.cs.wustl.edu> wrote in message news:dnarko$9...@ace.cs.wustl.edu...
> > Hi Alex,
>
> [snip]
>
> > Please take a look at the discussion of naming contexts in IONA's
> > ORBacus documentation at
> >
> > http://www.iona.com/devcenter/orbacus/training_download.html
>
>
> It is excellent documentation!
>
> Particularly, I found out answers om questions in "19.12. Context Creation Example".
>
[snip]


I have some question related to binding objects.

===============================================

CosNaming::NamingContext_var inc = ...; // Get initial context
CosNaming::Name name;

name.length(1);
name[0].id = CORBA::string_dup("a"); // kind is empty
CosNaming::NamingContext_var a;
a = inc->bind_new_context(name); // inc -> a; context

FOO::Foo_var foo1 = ...;
name.length(2);
name[1].id = CORBA::string_dup("b");
inc->bind(name, foo1); // a -> b; object

// So far it seems to be OK.

// Are the following actions legal?
FOO::Foo_var foo2 = ...;
name.length(3);
name[1].id = CORBA::string_dup("c1");
name[2].id = CORBA::string_dup("c2");
inc->bind(name, foo2); // a -> c2; object


FOO::Foo_var foo3 = ...;
FOO::Foo_var foo4 = ...;
name.length(3);
name[1].id = CORBA::string_dup("d1");
inc->bind(name, foo3); // a -> d1; object
name[2].id = CORBA::string_dup("d2");
inc->bind(name, foo4); // a -> d2; object

===============================================

In other words, can a object (in a given context) have name lenght greater than 1 (i.e., its pathname outgoing from the context
has more than 1 arc/edge)?

Phil Mesnier

unread,
Dec 10, 2005, 8:45:07 AM12/10/05
to Alex Vinokur
Hi Alex,

Alex Vinokur wrote:
>
> I have some question related to binding objects.
>
> ===============================================
>
> CosNaming::NamingContext_var inc = ...; // Get initial context
> CosNaming::Name name;
>
> name.length(1);
> name[0].id = CORBA::string_dup("a"); // kind is empty
> CosNaming::NamingContext_var a;
> a = inc->bind_new_context(name); // inc -> a; context
>
> FOO::Foo_var foo1 = ...;
> name.length(2);
> name[1].id = CORBA::string_dup("b");
> inc->bind(name, foo1); // a -> b; object
>
> // So far it seems to be OK.
>

Right. Likewise you could keep the name length 1 and use:

name[0].id = CORBA::string_dup("b");
a->bind(name, foo1);

both will yield inc->a->b

> // Are the following actions legal?
> FOO::Foo_var foo2 = ...;
> name.length(3);
> name[1].id = CORBA::string_dup("c1");
> name[2].id = CORBA::string_dup("c2");
> inc->bind(name, foo2); // a -> c2; object
>

This is legal, but if you ran this code as you present it here, this
bind would result in a NotFound exception. The reason is that for a name
of length n, components 0..n-1 must refer to contexts.

If a context "c1" existed, your code would result in a binding:
inc->a->c1->c2. If binding a->c1 existed but did not refer to a context,
your code would yield another exception.

>
> FOO::Foo_var foo3 = ...;
> FOO::Foo_var foo4 = ...;
> name.length(3);
> name[1].id = CORBA::string_dup("d1");
> inc->bind(name, foo3); // a -> d1; object
> name[2].id = CORBA::string_dup("d2");
> inc->bind(name, foo4); // a -> d2; object
>
> ===============================================
>
> In other words, can a object (in a given context) have name lenght greater than 1 (i.e., its pathname outgoing from the context
> has more than 1 arc/edge)?
>
>

Yes, but as I said above, all intermediate name components must refer to
existing contexts. If a naming context is like a directory, and a
binding is like a filename, then a compound name is like a path.

HTH,
Phil

Alex Vinokur

unread,
Dec 10, 2005, 10:32:53 AM12/10/05
to

"Phil Mesnier" <mesn...@ociweb.com> wrote in message news:439ADBE3...@ociweb.com...
[snip]

> Yes, but as I said above, all intermediate name components must refer to
> existing contexts. If a naming context is like a directory, and a
> binding is like a filename, then a compound name is like a path.
>
[snip]

Thanks.

----------------------------


FOO::Foo_var foo3 = ...;
FOO::Foo_var foo4 = ...;
name.length(3);
name[1].id = CORBA::string_dup("d1");
inc->bind(name, foo3); // a -> d1; object
name[2].id = CORBA::string_dup("d2");
inc->bind(name, foo4); // a -> d2; object

----------------------------

So, the code below is semantically illegal because non-leaf node d1 is not context, but object (?).

0 new messages