[omniORB] Object type returned from resolve()
Thomas Lockhart
lockhart@fourpalms.org
Thu May 1 03:40:02 2003
This is a multi-part message in MIME format.
--------------000905010506040107070600
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
I think I'm noticing a difference in behavior between omniORBpy-2.0 and
-2.1. When calling resolve() on a NameContext node in a naming service
(a TAO naming service in particular) the -2.0 release returned an object
already narrowed to be a CosNaming._objref_NamingContext. The -2.1
release returns an omniORB.CORBA.Object from the call to resolve()
targeting a naming context node.
From looking at the docs, I see that a _narrow() might be necessary for
any call to resolve(), so afaict (without reading the standard) the new
behavior is permitted.
Was the change in behavior intentional? I'm not seeing mention of this
in release notes, on the web site, or in searching the mailing lists,
though of course I could have missed it.
Small test program enclosed.
- Tom
--------------000905010506040107070600
Content-Type: text/plain;
name="cosnaming_test.py"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="cosnaming_test.py"
#!/usr/bin/env python
import sys
from omniORB import CORBA
import CosNaming
TheOrb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
AnObject = TheOrb.resolve_initial_references("NameService")
TheNameService = AnObject._narrow(CosNaming.NamingContext)
ContextName = []
for i in (range(2)):
ContextName += [CosNaming.NameComponent(id = "test_"+str(i), kind = "")]
# top level context
context = TheNameService
for i in (range(2)):
# make sure the node does not exist
try:
context.unbind([ContextName[i]])
except:
pass
# bind a new context node
ncontext = context.bind_new_context([ContextName[i]])
print "ncontext is", ncontext, "(always NamingContext)"
context = ncontext._narrow(CosNaming.NamingContext)
print "context is", context, "(narrows to NamingContext)"
context = TheNameService
obj = context.resolve(ContextName)
print "object reference is", obj, "(2.0 is NamingContext, 2.1 is CORBA.Object)"
context = obj._narrow(CosNaming.NamingContext)
print "context is", context, "(always NamingContext)"
--------------000905010506040107070600--