Renames a http session, making sure the new name is unique for the site.

@param oldName the old name
@param newName the new name
@return true, if successful
337379
public boolean renameHttpSession(String oldName, String newName) {
		// Check new name validity
		if (newName == null || newName.isEmpty()) {
			log.warn("Trying to rename session from " + oldName + " illegal name: " + newName);
			return false;
		}

		// Check existing old name
		HttpSession session = getHttpSession(oldName);
		if (session == null) {
			return false;
		}

		// Check new name uniqueness
		if (getHttpSession(newName) != null) {
			log.warn("Trying to rename session from " + oldName + " to already existing: " + newName);
			return false;
		}

		// Rename the session and notify model
		session.setName(newName);
		this.model.fireHttpSessionUpdated(session);

		return true;
	}
1115476
public function rename($index, $newName)
    {
        if (!isset($this->names[$index])) {
            return false;
        }
        if ($this->names[$index] === $newName) {
            return false;
        }
        $this->context->getMappings();
        $this->names[$index] = $newName;
        $this->indexes = array_flip($this->names);
        $this->onRename($index, $newName);
        return true;
    }
143460
public function RenameColumn($OldName, $NewName, $TableName = '') {
      if ($TableName != '')
         $this->_TableName = $TableName;

      // Get the schema for this table
      $OldPrefix = $this->Database->DatabasePrefix;
      $this->Database->DatabasePrefix = $this->_DatabasePrefix;
      $Schema = $this->Database->SQL()->FetchTableSchema($this->_TableName);
      $this->Database->DatabasePrefix = $OldPrefix;

      // Get the definition for this column
      $OldColumn = ArrayValue($OldName, $Schema);
      $NewColumn = ArrayValue($NewName, $Schema);

      // Make sure that one column, or the other exists
      if (!$OldColumn && !$NewColumn)
         throw new Exception(sprintf(T('The `%1$s` column does not exist.'),$OldName));

      // Make sure the new column name isn't already taken
      if ($OldColumn && $NewColumn)
         throw new Exception(sprintf(T('You cannot rename the `%1$s` column to `%2$s` because that column already exists.'), $OldName, $NewName));

      // Rename the column
      // The syntax for renaming a column is:
      // ALTER TABLE tablename CHANGE COLUMN oldname newname originaldefinition;
      if (!$this->Query('alter table `'.$this->_TableName.'` change column `'.$OldName.'` `'.$NewName.'` '.$this->_DefineColumn($OldColumn)))
         throw new Exception(sprintf(T('Failed to rename table `%1$s` to `%2$s`.'), $OldName, $NewName));

      return TRUE;
   }
1176107
function rename($oldname, $newname)
    {
        if (!($this->bitmap & NET_SSH2_MASK_LOGIN)) {
            return false;
        }

        $oldname = $this->_realpath($oldname);
        $newname = $this->_realpath($newname);
        if ($oldname === false || $newname === false) {
            return false;
        }

        // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.3
        $packet = pack('Na*Na*', strlen($oldname), $oldname, strlen($newname), $newname);
        if (!$this->_send_sftp_packet(NET_SFTP_RENAME, $packet)) {
            return false;
        }

        $response = $this->_get_sftp_packet();
        if ($this->packet_type != NET_SFTP_STATUS) {
            user_error('Expected SSH_FXP_STATUS');
            return false;
        }

        // if $status isn't SSH_FX_OK it's probably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED
        if (strlen($response) < 4) {
            return false;
        }
        extract(unpack('Nstatus', $this->_string_shift($response, 4)));
        if ($status != NET_SFTP_STATUS_OK) {
            $this->_logError($response, $status);
            return false;
        }

        // don't move the stat cache entry over since this operation could very well change the
        // atime and mtime attributes
        //$this->_update_stat_cache($newname, $this->_query_stat_cache($oldname));
        $this->_remove_from_stat_cache($oldname);
        $this->_remove_from_stat_cache($newname);

        return true;
    }
1307259
def rename(new_name)
      json_body = { :name => new_name }.to_json
      HTTParty.put(base_request_uri, :body => json_body)
      @name = new_name
    end
970554
protected base_response rename_resource(nitro_service service, String newname)  throws Exception
	{
		if (!service.isLogin() && !get_object_type().equals("login"))
			service.login();

		options option = new options();
		option.set_action("rename");
		this.set_newname(newname);
		base_response response = post_request(service, option);
		return response;
	}
1183827
public final void setName(String newName)
                    throws ObjectManagerException {
        final String methodName = "setName";
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this, cclass, methodName, new Object[] { newName, storeName });

        objectManagerState.renameObjectStore(this, newName);

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this, cclass, methodName);
    }
41345
public void updateCurrentUsername(String newUsername) {
        final String originalThreadName = originalThreadNameLocal.get();
        if (originalThreadName != null && newUsername != null) {
            final Thread currentThread = Thread.currentThread();
            final String threadName = getThreadName(originalThreadName, newUsername);
            currentThread.setName(threadName);
        }
    }
74668
public synchronized boolean renameTo( Resource dest)
        throws SecurityException
    {
        if (_resource.renameTo(dest))
        {
            clear();
            return true;
        }
        return false;
    }
492494
public void rename(String oldName, String newName)
        throws IOException, ServerException {
        if (oldName == null || newName == null) {
            throw new IllegalArgumentException("Required argument missing");
        }
        Command cmd = new Command("RNFR", oldName);
        try {
            Reply reply = controlChannel.exchange(cmd);
            if (!Reply.isPositiveIntermediate(reply)) {
                throw new UnexpectedReplyCodeException(reply);
            }
            controlChannel.execute(new Command("RNTO", newName));
        } catch (FTPReplyParseException rpe) {
            throw ServerException.embedFTPReplyParseException(rpe);
        } catch (UnexpectedReplyCodeException urce) {
            throw ServerException.embedUnexpectedReplyCodeException(
                                urce,
                                "Server refused renaming file");
        }
    }
1212862
public function rename($oldName, $newName)
    {
        if (null !== $this->collection->get($newName)) {
            throw new RuntimeException(
                sprintf(
                    'Could not rename toggle %1$s to %2$s, a toggle with name %2$s already exists',
                    $oldName,
                    $newName
                )
            );
        }

        $currentToggle = $this->collection->get($oldName);

        if (null === $currentToggle) {
            throw new RuntimeException(
                sprintf(
                    'Could not rename toggle %1$s to %2$s, toggle with name %1$s does not exists',
                    $oldName,
                    $newName
                )
            );
        }

        $currentToggle->rename($newName);

        if (false === $this->add($currentToggle)) {
            throw new RuntimeException(
                sprintf(
                    'Failed to rename toggle %1$s to %2$s, an error occurred when saving toggle with new name',
                    $oldName,
                    $newName
                )
            );
        }

        return $this->remove($oldName);
    }
998872
private boolean isSessionNameUnique(final String name) {
		synchronized (this.sessions) {
			for (HttpSession session : sessions) {
				if (name.equals(session.getName())) {
					return false;
				}
			}
		}
		return true;
	}
981715
public Response<String> rename(final String oldkey, final String newkey) {
		return new PipelineOperation<String>() {

			@Override
			Response<String> execute(Pipeline jedisPipeline) throws DynoException {
				return jedisPipeline.rename(oldkey, newkey);
			}
		}.execute(oldkey, OpName.RENAME);

	}
249356
public static void rename(FileSystem fs, String oldName, String newName)
    throws IOException {
    Path oldDir = new Path(oldName);
    Path newDir = new Path(newName);
    if (!fs.rename(oldDir, newDir)) {
      throw new IOException("Could not rename " + oldDir + " to " + newDir);
    }
  }
352960
@Override
	public void rename(String oldname, String newname) throws NamingException
    {
        rename(new CompositeName(oldname), new CompositeName(newname));
    }
959895
public void rename(String newName) {
        URL url = FILE_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID());
        BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, "PUT");

        JsonObject updateInfo = new JsonObject();
        updateInfo.add("name", newName);

        request.setBody(updateInfo.toString());
        BoxAPIResponse response = request.send();
        response.disconnect();
    }
555001
public function rename($oldname, $newname)
    {
        $this->copy($oldname, $newname);

        // Delete the original object
        if ($this->isDir($oldname))
        {
            $this->deleteFolder($oldname);
        } else {
            $this->delete($oldname);
        }

        return true;
    }