public void bind( NameComponent[] nc, org.omg.CORBA.Object obj)
throws NotFound, CannotProceed, InvalidName, AlreadyBound
{
if( destroyed )
throw new CannotProceed();
if( nc == null || nc.length == 0 )
throw new InvalidName();
if( obj == null )
throw new org.omg.CORBA.BAD_PARAM();
Name n = new Name( nc );
Name ctx = n.ctxName();
NameComponent nb = n.baseNameComponent();
if( ctx == null )
{
if( names.containsKey( n ))
{
// if the name is still in use, try to ping the object
org.omg.CORBA.Object s = (org.omg.CORBA.Object)names.get(n);
if( isDead(s) )
{
rebind( n.components(), obj );
return;
}
throw new AlreadyBound();
}
else if( contexts.containsKey( n ))
{
// if the name is still in use, try to ping the object
org.omg.CORBA.Object s = (org.omg.CORBA.Object)contexts.get(n);
if( isDead(s) )
{
unbind( n.components());
}
throw new AlreadyBound();
}
if(( names.put( n, obj )) != null )
throw new CannotProceed( _this(), n.components() );
if( logger.isInfoEnabled() )
{
logger.info("Bound name: " + n.toString());
}