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 +5 -5
- data/.docker-stack/valkyrie-development/docker-compose.yml +11 -4
- data/.docker-stack/valkyrie-test/docker-compose.yml +11 -4
- data/CHANGELOG.md +7 -0
- data/README.md +6 -0
- data/lib/valkyrie/persistence/fedora/metadata_adapter.rb +8 -3
- data/lib/valkyrie/persistence/fedora/query_service.rb +1 -1
- data/lib/valkyrie/resource.rb +1 -1
- data/lib/valkyrie/storage/fedora.rb +8 -3
- data/lib/valkyrie/version.rb +1 -1
- data/tasks/dev.rake +14 -10
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d66ba588c11dfaa509ab8dfe2c43a1018462103121e43fecb07e06e31878155d
|
4
|
+
data.tar.gz: 235551dbdb14be9f7a2034cbcf6a288ebbe6a11511cac31ea1a62fb3dcadfa39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9f8eafb124d7db30b9b6ab51165327877ac9dbd25a71cc8e074eec99880fa64bce7864abaad28ea81d65634567b8937332d42b27046b42490890158ee10da1c
|
7
|
+
data.tar.gz: 9b2877caed49d8e4e1aff11050391c2ccb8bc8259428e69786f3cc0256fc536f3afb05da40ca98e9878024ccacc4367d216cc61f60c18d2f446f1157e479daaa
|
@@ -1,17 +1,24 @@
|
|
1
1
|
---
|
2
2
|
version: '3.4'
|
3
3
|
volumes:
|
4
|
-
|
4
|
+
fedora4:
|
5
|
+
fedora5:
|
5
6
|
db:
|
6
7
|
solr_repo:
|
7
8
|
solr_index:
|
8
9
|
services:
|
9
|
-
|
10
|
-
image: nulib/fcrepo4
|
10
|
+
fedora4:
|
11
|
+
image: nulib/fcrepo4:4.7.5
|
11
12
|
volumes:
|
12
|
-
-
|
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
|
-
|
4
|
+
fedora4:
|
5
|
+
fedora5:
|
5
6
|
db:
|
6
7
|
solr_repo:
|
7
8
|
solr_index:
|
8
9
|
services:
|
9
|
-
|
10
|
-
image: nulib/fcrepo4
|
10
|
+
fedora4:
|
11
|
+
image: nulib/fcrepo4:4.7.5
|
11
12
|
volumes:
|
12
|
-
-
|
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
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
|
-
|
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
|
-
|
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
|
|
data/lib/valkyrie/resource.rb
CHANGED
@@ -59,7 +59,7 @@ module Valkyrie
|
|
59
59
|
schema.delete(name)
|
60
60
|
end
|
61
61
|
define_method("#{name}=") do |value|
|
62
|
-
|
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)))
|
data/lib/valkyrie/version.rb
CHANGED
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
|
-
|
12
|
-
|
13
|
-
|
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
|
-
|
38
|
-
|
39
|
-
|
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.
|
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:
|
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.
|
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
|