private void callBindOrRebind(NameComponent[] pth,Name name,java.lang.Object obj,boolean rebind) throws NamingException {
  if (_nc == null)   throw new ConfigurationException("Context does not have a corresponding NamingContext");
  try {
    obj=NamingManager.getStateToBind(obj,name,this,_env);
    if (obj instanceof CNCtx) {
      obj=((CNCtx)obj)._nc;
    }
    if (obj instanceof org.omg.CosNaming.NamingContext) {
      NamingContext nobj=NamingContextHelper.narrow((org.omg.CORBA.Object)obj);
      if (rebind)       _nc.rebind_context(pth,nobj);
 else       _nc.bind_context(pth,nobj);
    }
 else     if (obj instanceof org.omg.CORBA.Object) {
      if (rebind)       _nc.rebind(pth,(org.omg.CORBA.Object)obj);
 else       _nc.bind(pth,(org.omg.CORBA.Object)obj);
    }
 else     throw new IllegalArgumentException("Only instances of org.omg.CORBA.Object can be bound");
  }
 catch (  BAD_PARAM e) {
    NamingException ne=new NotContextException(name.toString());
    ne.setRootCause(e);
    throw ne;
  }
catch (  Exception e) {
    throw ExceptionMapper.mapException(e,this,pth);
  }
}

private void callBindOrRebind ( NameComponent [ ] pth , Name name , java . lang . Object obj , boolean rebind ) throws NamingException { if ( _nc == null ) throw new ConfigurationException ( "Context does not have a corresponding NamingContext" ) ; try { obj = NamingManager . getStateToBind ( obj , name , this , _env ) ; if ( obj instanceof CNCtx ) { obj = ( ( CNCtx ) obj ) . _nc ; } if ( obj instanceof org . omg . CosNaming . NamingContext ) { NamingContext nobj = NamingContextHelper . narrow ( ( org . omg . CORBA . Object ) obj ) ; if ( rebind ) _nc . rebind_context ( pth , nobj ) ; else _nc . bind_context ( pth , nobj ) ; } else if ( obj instanceof org . omg . CORBA . Object ) { if ( rebind ) _nc . rebind ( pth , ( org . omg . CORBA . Object ) obj ) ; else _nc . bind ( pth , ( org . omg . CORBA . Object ) obj ) ; } else throw new IllegalArgumentException ( "Only instances of org.omg.CORBA.Object can be bound" ) ; } catch ( BAD_PARAM e ) { NamingException ne = new NotContextException ( name . toString ( ) ) ; ne . setRootCause ( e ) ; throw ne ; } catch ( Exception e ) { throw ExceptionMapper . mapException ( e , this , pth ) ; } }
performs bind or rebind in the context depending on whether the flag rebind is set . the only objects allowed to be bound are of types org . omg . corba . object , org . omg . cosnaming . namingcontext . you can use a state factory to turn other objects ( such as remote ) into these acceptable forms . uses the cos naming apis bind / rebind or bind_context / rebind_context .
