code: @Override
  	public void rename(Name oldname, Name newname) throws NamingException
      {
          if (oldname.isEmpty() || newname.isEmpty())
              throw new InvalidNameException("Cannot rename empty name");
  
          // Extract components that belong to this namespace
          String oldnm = oldname.toString();
          String newnm = newname.toString();
  
          // Check if new name exists
          if (bindings.get(newnm) != null)
              throw new NameAlreadyBoundException(newname.toString() + " is already bound");
  
          // Check if old name is bound
          Object oldBinding = bindings.remove(oldnm);
          if (oldBinding == null)
              throw new NameNotFoundException(oldname.toString() + " not bound");
  
          bindings.put(newnm, oldBinding);
      }
docs: /*
  (non-Javadoc)
  @see javax.naming.Context#rename(javax.naming.Name, javax.naming.Name)