void createPlainFile(String path, Directory currentDirectory, User currentUser)
      throws InvalidFileNameException, InvalidMaskException, FileAlreadyExistsException {

    Directory directory = absolutePath(path, currentUser, currentDirectory);
    String filename = getLastPathToken(path);
    directory.checkAccessWrite(currentUser);

    for (File f : directory.getFilesSet()) {
      if (f.getFilename().equals(filename)) throw new FileAlreadyExistsException(filename);
    }
    directory.addFile(
        new PlainFile(
            this.generateUniqueId(), filename, currentUser.getUmask(), currentUser, directory));
  }