class StorageStrategy {

  public Path createFileAndApply(FileSystem fs, Path file) throws IOException {
    List<Path> locations = getNonExistentLocations(fs, file.getParent());
    if (!fs.createNewFile(file)) {
      throw new IOException(String.format("File [%s] already exists on file system [%s].",
          file.toUri().getPath(), fs.getUri()));
    }
    applyToFile(fs, file);

    if (locations.isEmpty()) {
      return file;
    }

    for (Path location : locations) {
      applyStrategy(fs, location, getFolderPermission(), deleteOnExit);
    }
    return locations.get(locations.size() - 1);
  }

  @JsonCreator public  StorageStrategy(@JsonProperty("umask") String umask,
                         @JsonProperty("deleteOnExit") boolean deleteOnExit);

}