Class: Hyrax::WorkingDirectory Deprecated

Inherits:
Object
  • Object
show all
Defined in:
app/services/hyrax/working_directory.rb

Overview

Deprecated.

Use JobIoWrapper instead

Class Method Summary collapse

Class Method Details

.copy_repository_resource_to_working_directory(file, id) ⇒ String

Returns path of the working file.

Parameters:

  • file (#original_name, #id)

    the resource in the repo

  • id (String)

    the identifier of the FileSet

Returns:

  • (String)

    path of the working file



28
29
30
31
# File 'app/services/hyrax/working_directory.rb', line 28

def copy_repository_resource_to_working_directory(file, id)
  Hyrax.logger.debug "Loading #{file.original_name} (#{file.id}) from the repository to the working directory"
  copy_stream_to_working_directory(id, file.original_name, StringIO.new(file.content))
end

.find_or_retrieve(repository_file_id, id, filepath = nil) ⇒ String

Deprecated.

No longer used anywhere in Hyrax code, naively assumes filenames of versions/revisions are distinct

Returns the file passed as filepath if that file exists. Otherwise it grabs the file from repository, puts it on the disk and returns that path.

Parameters:

  • repository_file_id (String)

    identifier for Hydra::PCDM::File

  • id (String)

    the identifier of the FileSet

  • filepath (String, NilClass) (defaults to: nil)

    path to existing cached copy of the file

Returns:

  • (String)

    path of the working file



13
14
15
16
17
18
19
20
21
22
23
# File 'app/services/hyrax/working_directory.rb', line 13

def find_or_retrieve(repository_file_id, id, filepath = nil)
  Deprecation.warn("Hyrax::WorkingDirectory.find_or_retrieve() is deprecated and no longer used in Hyrax")
  return filepath if filepath && File.exist?(filepath)
  repository_file = Hydra::PCDM::File.find(repository_file_id)
  working_path = full_filename(id, repository_file.original_name)
  if File.exist?(working_path)
    Hyrax.logger.debug "#{repository_file.original_name} already exists in the working directory at #{working_path}"
    return working_path
  end
  copy_repository_resource_to_working_directory(repository_file, id)
end