valkyrie 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 548ddef374169cdcc984f7990ec0fb0d8b89502a
4
- data.tar.gz: 2ca99fe44d1cc2733eecb1b55c7f2ef100bcbe03
2
+ SHA256:
3
+ metadata.gz: d66ba588c11dfaa509ab8dfe2c43a1018462103121e43fecb07e06e31878155d
4
+ data.tar.gz: 235551dbdb14be9f7a2034cbcf6a288ebbe6a11511cac31ea1a62fb3dcadfa39
5
5
  SHA512:
6
- metadata.gz: bce389d966f1728e132f9167e871e44e1a9f2ad595e309a4c995be1eecc58e9fde87235d909823b0be65a6af46d682f8758ad2553c5e39d34cd3dd8da17a5a00
7
- data.tar.gz: 6cfdfffce9c65714d45489a7b1aa63c8062c96d24ca45b28036278ddb24b69dd96ce7497e0f03e058eee5e446e1d12b88f10cf081c27bb592c5f76cf4ef4e8e8
6
+ metadata.gz: d9f8eafb124d7db30b9b6ab51165327877ac9dbd25a71cc8e074eec99880fa64bce7864abaad28ea81d65634567b8937332d42b27046b42490890158ee10da1c
7
+ data.tar.gz: 9b2877caed49d8e4e1aff11050391c2ccb8bc8259428e69786f3cc0256fc536f3afb05da40ca98e9878024ccacc4367d216cc61f60c18d2f446f1157e479daaa
@@ -1,17 +1,24 @@
1
1
  ---
2
2
  version: '3.4'
3
3
  volumes:
4
- fedora:
4
+ fedora4:
5
+ fedora5:
5
6
  db:
6
7
  solr_repo:
7
8
  solr_index:
8
9
  services:
9
- fedora:
10
- image: nulib/fcrepo4
10
+ fedora4:
11
+ image: nulib/fcrepo4:4.7.5
11
12
  volumes:
12
- - fedora:/data
13
+ - fedora4:/data
13
14
  ports:
14
15
  - 8986:8080
16
+ fedora5:
17
+ image: nulib/fcrepo4:5.0.0
18
+ volumes:
19
+ - fedora5:/data
20
+ ports:
21
+ - 8996:8080
15
22
  db:
16
23
  image: healthcheck/postgres:alpine
17
24
  volumes:
@@ -1,17 +1,24 @@
1
1
  ---
2
2
  version: '3.4'
3
3
  volumes:
4
- fedora:
4
+ fedora4:
5
+ fedora5:
5
6
  db:
6
7
  solr_repo:
7
8
  solr_index:
8
9
  services:
9
- fedora:
10
- image: nulib/fcrepo4
10
+ fedora4:
11
+ image: nulib/fcrepo4:4.7.5
11
12
  volumes:
12
- - fedora:/data
13
+ - fedora4:/data
13
14
  ports:
14
15
  - 8988:8080
16
+ fedora5:
17
+ image: nulib/fcrepo4:5.0.0
18
+ volumes:
19
+ - fedora5:/data
20
+ ports:
21
+ - 8998:8080
15
22
  db:
16
23
  image: healthcheck/postgres:alpine
17
24
  volumes:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # v1.4.0 2018-01-08
2
+
3
+ ## Changes since last release.
4
+
5
+ * Add support for Fedora 5
6
+ [escowles](https://github.com/escowles)
7
+
1
8
  # v1.3.0 2018-12-03
2
9
 
3
10
  ## Changes since last release
data/README.md CHANGED
@@ -241,6 +241,12 @@ By default, it is assumed that a Valkyrie repository implementation shall use a
241
241
  1. Run `rake docker:test:down` to stop the server stack
242
242
  * The test stack cleans up after itself on exit.
243
243
 
244
+ ## Fedora 5 Compatibility
245
+ When configuring your adapter, include the `fedora_version` parameter in your metadata or storage adapter config. If Fedora requires auth, you can also include that in the URL, e.g.:
246
+ ```
247
+ Valkyrie::Storage::Fedora.new(connection: Ldp::Client.new("http://fedoraAdmin:fedoraAdmin@localhost:8988/rest"), fedora_version: 5)
248
+ ```
249
+
244
250
  The development and test stacks use fully contained virtual volumes and bind all services to different ports, so they can be running at the same time without issue.
245
251
 
246
252
  ## Get Help
@@ -9,15 +9,19 @@ module Valkyrie::Persistence::Fedora
9
9
  # schema: Valkyrie::Persistence::Fedora::PermissiveSchema.new(title: RDF::URI("http://bad.com/title"))
10
10
  # )
11
11
  class MetadataAdapter
12
- attr_reader :connection, :base_path, :schema
12
+ attr_reader :connection, :base_path, :schema, :fedora_version
13
13
 
14
14
  # @param [Ldp::Client] connection
15
15
  # @param [String] base_path
16
16
  # @param [Valkyrie::Persistence::Fedora::PermissiveSchema] schema
17
- def initialize(connection:, base_path: "/", schema: Valkyrie::Persistence::Fedora::PermissiveSchema.new)
17
+ # @param [Integer] fedora_version
18
+ def initialize(connection:, base_path: "/", schema: Valkyrie::Persistence::Fedora::PermissiveSchema.new, fedora_version: 4)
18
19
  @connection = connection
19
20
  @base_path = base_path
20
21
  @schema = schema
22
+ @fedora_version = fedora_version
23
+
24
+ warn "[DEPRECATION] `fedora_version` will default to 5 in the next major release." unless fedora_version
21
25
  end
22
26
 
23
27
  # Construct the query service object using this adapter
@@ -56,7 +60,8 @@ module Valkyrie::Persistence::Fedora
56
60
  # @param [RDF::URI] id the Valkyrie ID
57
61
  # @return [RDF::URI]
58
62
  def id_to_uri(id)
59
- RDF::URI("#{connection_prefix}/#{pair_path(id)}/#{CGI.escape(id.to_s)}")
63
+ prefix = fedora_version == 5 ? "" : "#{pair_path(id)}/"
64
+ RDF::URI("#{connection_prefix}/#{prefix}#{CGI.escape(id.to_s)}")
60
65
  end
61
66
 
62
67
  # Generate the pairtree path for a given Valkyrie ID
@@ -54,7 +54,7 @@ module Valkyrie::Persistence::Fedora
54
54
  # @return [Array<RDF::URI>]
55
55
  def include_uris
56
56
  [
57
- ::RDF::Vocab::Fcrepo4.InboundReferences
57
+ adapter.fedora_version == 5 ? "http://fedora.info/definitions/fcrepo#PreferInboundReferences" : ::RDF::Vocab::Fcrepo4.InboundReferences
58
58
  ]
59
59
  end
60
60
 
@@ -59,7 +59,7 @@ module Valkyrie
59
59
  schema.delete(name)
60
60
  end
61
61
  define_method("#{name}=") do |value|
62
- instance_variable_set("@#{name}", self.class.schema[name].call(value))
62
+ set_value(name, value)
63
63
  end
64
64
  type = type.meta(ordered: true) if name == :member_ids
65
65
  super(name, type)
@@ -2,13 +2,16 @@
2
2
  module Valkyrie::Storage
3
3
  # Implements the DataMapper Pattern to store binary data in fedora
4
4
  class Fedora
5
- attr_reader :connection, :base_path
5
+ attr_reader :connection, :base_path, :fedora_version
6
6
  PROTOCOL = 'fedora://'
7
7
 
8
8
  # @param [Ldp::Client] connection
9
- def initialize(connection:, base_path: "/")
9
+ def initialize(connection:, base_path: "/", fedora_version: 4)
10
10
  @connection = connection
11
11
  @base_path = base_path
12
+ @fedora_version = fedora_version
13
+
14
+ warn "[DEPRECATION] `fedora_version` will default to 5 in the next major release." unless fedora_version
12
15
  end
13
16
 
14
17
  # @param id [Valkyrie::ID]
@@ -31,11 +34,13 @@ module Valkyrie::Storage
31
34
  # @return [Valkyrie::StorageAdapter::StreamFile]
32
35
  def upload(file:, original_filename:, resource:)
33
36
  identifier = id_to_uri(resource.id) + '/original'
37
+ sha1 = fedora_version == 5 ? "sha" : "sha1"
34
38
  connection.http.put do |request|
35
39
  request.url identifier
36
40
  request.headers['Content-Type'] = file.content_type
37
41
  request.headers['Content-Disposition'] = "attachment; filename=\"#{original_filename}\""
38
- request.headers['digest'] = "sha1=#{Digest::SHA1.file(file)}"
42
+ request.headers['digest'] = "#{sha1}=#{Digest::SHA1.file(file)}"
43
+ request.headers['link'] = "<http://www.w3.org/ns/ldp#NonRDFSource>; rel=\"type\""
39
44
  request.body = file.tempfile.read
40
45
  end
41
46
  find_by(id: Valkyrie::ID.new(identifier.to_s.sub(/^.+\/\//, PROTOCOL)))
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Valkyrie
3
- VERSION = "1.3.0"
3
+ VERSION = "1.4.0"
4
4
  end
data/tasks/dev.rake CHANGED
@@ -7,10 +7,12 @@ namespace :server do
7
7
  require 'fcrepo_wrapper'
8
8
  SolrWrapper.wrap(shared_solr_opts.merge(port: 8984, instance_dir: 'tmp/blacklight-core-test')) do |solr|
9
9
  solr.with_collection(name: "blacklight-core-test", dir: Pathname.new(__dir__).join("..", "solr", "config").to_s) do
10
- FcrepoWrapper.wrap(shared_fedora_opts.merge(port: 8988, fcrepo_home_dir: "tmp/fcrepo4-test-data")) do |_fcrepo|
11
- puts "Setup solr & fedora."
12
- loop do
13
- sleep(1)
10
+ FcrepoWrapper.wrap(shared_fedora_opts.merge(port: 8988, fcrepo_home_dir: "tmp/fcrepo4-test-data", version: "4.7.5", instance_directory: "tmp/fcrepo4")) do |_fcrepo|
11
+ FcrepoWrapper::Instance.new(shared_fedora_opts.merge(port: 8998, fcrepo_home_dir: "tmp/fcrepo5-test-data", version: "5.0.0", instance_directory: "tmp/fcrepo5")).wrap do |_other_repo|
12
+ puts "Setup solr & Fedora"
13
+ loop do
14
+ sleep(1)
15
+ end
14
16
  end
15
17
  end
16
18
  end
@@ -22,7 +24,8 @@ namespace :server do
22
24
  require 'solr_wrapper'
23
25
  require 'fcrepo_wrapper'
24
26
  SolrWrapper.instance(shared_solr_opts.merge(port: 8984, instance_dir: 'tmp/blacklight-core-test')).remove_instance_dir!
25
- FcrepoWrapper.default_instance(shared_fedora_opts.merge(port: 8988, fcrepo_home_dir: "tmp/fcrepo4-test-data")).remove_instance_dir!
27
+ FcrepoWrapper.default_instance(shared_fedora_opts.merge(port: 8988, fcrepo_home_dir: "tmp/fcrepo4-test-data", instance_directory: "tmp/fcrepo4")).remove_instance_dir!
28
+ FcrepoWrapper::Instance.new(shared_fedora_opts.merge(port: 8998, fcrepo_home_dir: "tmp/fcrepo5-test-data", instance_directory: "tmp/fcrepo5")).remove_instance_dir!
26
29
  puts "Cleaned up test solr & fedora servers."
27
30
  end
28
31
 
@@ -33,10 +36,12 @@ namespace :server do
33
36
 
34
37
  SolrWrapper.wrap(shared_solr_opts.merge(port: 8983, instance_dir: 'tmp/blacklight-core')) do |solr|
35
38
  solr.with_collection(name: "blacklight-core", dir: Pathname.new(__dir__).join("..", "solr", "config").to_s) do
36
- FcrepoWrapper.wrap(shared_fedora_opts.merge(port: 8986, fcrepo_home_dir: "fcrepo4-dev-data")) do |_fcrepo|
37
- puts "Setup Solr & Fedora"
38
- loop do
39
- sleep(1)
39
+ FcrepoWrapper.wrap(shared_fedora_opts.merge(port: 8986, fcrepo_home_dir: "tmp/fcrepo4-dev-data", version: "4.7.5")) do |_fcrepo|
40
+ FcrepoWrapper::Instance.new(shared_fedora_opts.merge(port: 8996, fcrepo_home_dir: "tmp/fcrepo5-dev-data", version: "5.0.0")).wrap do |_fcrepo|
41
+ puts "Setup solr & Fedora"
42
+ loop do
43
+ sleep(1)
44
+ end
40
45
  end
41
46
  end
42
47
  end
@@ -51,7 +56,6 @@ namespace :server do
51
56
 
52
57
  def shared_fedora_opts
53
58
  opts = { managed: true, verbose: true, enable_jms: false, download_dir: "tmp" }
54
- opts[:version] = ENV['FCREPO_VERSION'] if ENV['FCREPO_VERSION']
55
59
  opts
56
60
  end
57
61
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: valkyrie
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trey Pendragon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-12-03 00:00:00.000000000 Z
11
+ date: 2019-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-struct
@@ -590,7 +590,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
590
590
  version: '0'
591
591
  requirements: []
592
592
  rubyforge_project:
593
- rubygems_version: 2.6.14
593
+ rubygems_version: 2.7.7
594
594
  signing_key:
595
595
  specification_version: 4
596
596
  summary: An ORM using the Data Mapper pattern, specifically built to solve Digital