// Now there are no other bindings under this name
impl.Bind(n[0],obj,bt);
}
} else {
// No: bind in a different context
NamingContext context = resolveFirstAsContext(impl,n);
// Compute tail
NameComponent[] tail = new NameComponent[n.length - 1];
System.arraycopy(n,1,tail,0,n.length-1);
// How should we propagate the bind
switch (bt.value()) {
case BindingType._nobject:
{
// Bind as object
if (rebind)
context.rebind(tail,obj);
else
context.bind(tail,obj);
}
break;
case BindingType._ncontext:
{
// Narrow to a naming context using Java casts. It must
// work.
NamingContext objContext = (NamingContext)obj;
// Bind as context
if (rebind)
context.rebind_context(tail,objContext);
else
context.bind_context(tail,objContext);