public static void bind ( final Context _ctx , final String _nameStr , final Object _object ) throws NamingException { final Name names = _ctx . getNameParser ( "" ) . parse ( _nameStr ) ; if ( names . size ( ) > 0 ) { Context subCtx = _ctx ; for ( int idx = 0 ; idx < names . size ( ) - 1 ; idx ++ ) { final String name = names . get ( idx ) ; try { subCtx = ( Context ) subCtx . lookup ( name ) ; if ( Util . LOG . isDebugEnabled ( ) ) { Util . LOG . debug ( "Subcontext " + name + " already exists" ) ; } } catch ( final NameNotFoundException e ) { subCtx = subCtx . createSubcontext ( name ) ; if ( Util . LOG . isDebugEnabled ( ) ) { Util . LOG . debug ( "Subcontext " + name + " created" ) ; } } } subCtx . rebind ( names . get ( names . size ( ) - 1 ) , _object ) ; if ( Util . LOG . isDebugEnabled ( ) ) { Util . LOG . debug ( "Bound object to " + names . get ( names . size ( ) - 1 ) ) ; } } }
Bing given object at the given name path within given name context .