dor-services 7.2.4 → 8.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/config/config_defaults.yml +24 -41
  3. data/config/dev_console_env.rb.example +0 -9
  4. data/lib/dor-services.rb +6 -9
  5. data/lib/dor/config.rb +2 -126
  6. data/lib/dor/datastreams/content_metadata_ds.rb +7 -0
  7. data/lib/dor/datastreams/embargo_metadata_ds.rb +1 -1
  8. data/lib/dor/datastreams/role_metadata_ds.rb +1 -1
  9. data/lib/dor/datastreams/workflow_definition_ds.rb +0 -22
  10. data/lib/dor/datastreams/workflow_ds.rb +2 -64
  11. data/lib/dor/indexers/workflows_indexer.rb +7 -1
  12. data/lib/dor/models/abstract.rb +2 -4
  13. data/lib/dor/models/workflow_object.rb +0 -46
  14. data/lib/dor/release_tags.rb +13 -0
  15. data/lib/dor/release_tags/identity_metadata.rb +202 -0
  16. data/lib/dor/release_tags/purl.rb +50 -0
  17. data/lib/dor/release_tags/purl_client.rb +44 -0
  18. data/lib/dor/services/release_tag_service.rb +9 -179
  19. data/lib/dor/services/state_service.rb +23 -0
  20. data/lib/dor/static_config.rb +108 -0
  21. data/lib/dor/static_config/fedora_config.rb +36 -0
  22. data/lib/dor/static_config/solr_config.rb +21 -0
  23. data/lib/dor/static_config/ssl_config.rb +33 -0
  24. data/lib/dor/static_config/stacks_config.rb +39 -0
  25. data/lib/dor/static_config/suri_config.rb +45 -0
  26. data/lib/dor/static_config/workflow_config.rb +51 -0
  27. data/lib/dor/version.rb +1 -1
  28. data/lib/dor/workflow/document.rb +0 -10
  29. metadata +26 -66
  30. data/lib/dor/services/cleanup_service.rb +0 -63
  31. data/lib/dor/services/create_workflow_service.rb +0 -53
  32. data/lib/dor/services/delete_service.rb +0 -60
  33. data/lib/dor/services/metadata_handlers/catalog_handler.rb +0 -27
  34. data/lib/dor/services/metadata_service.rb +0 -64
  35. data/lib/dor/services/mods2dc.xslt +0 -474
  36. data/lib/dor/services/public_desc_metadata_service.rb +0 -184
  37. data/lib/dor/services/purl_client.rb +0 -42
  38. data/lib/dor/services/thumbnail_service.rb +0 -59
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dor
4
+ class StateService
5
+ def initialize(pid)
6
+ @pid = pid
7
+ end
8
+
9
+ def allows_modification?
10
+ !client.lifecycle('dor', pid, 'submitted') ||
11
+ client.active_lifecycle('dor', pid, 'opened') ||
12
+ client.workflow_status('dor', pid, 'accessionWF', 'sdr-ingest-transfer') == 'hold'
13
+ end
14
+
15
+ private
16
+
17
+ attr_reader :pid
18
+
19
+ def client
20
+ Dor::Config.workflow.client
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,108 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rsolr'
4
+
5
+ module Dor
6
+ # Provides configuration for dor-services
7
+ class StaticConfig
8
+ extend ActiveSupport::Autoload
9
+ eager_autoload do
10
+ autoload :SslConfig
11
+ autoload :FedoraConfig
12
+ autoload :SolrConfig
13
+ autoload :StacksConfig
14
+ autoload :SuriConfig
15
+ autoload :WorkflowConfig
16
+ end
17
+
18
+ def initialize(hash)
19
+ @ssl = SslConfig.new(hash.fetch(:ssl))
20
+ @fedora = FedoraConfig.new(hash.fetch(:fedora))
21
+ @solr = SolrConfig.new(hash.fetch(:solr))
22
+ @stacks = StacksConfig.new(hash.fetch(:stacks))
23
+ @suri = SuriConfig.new(hash.fetch(:suri))
24
+ @workflow = WorkflowConfig.new(hash.fetch(:workflow))
25
+ end
26
+
27
+ def configure(&block)
28
+ instance_eval(&block)
29
+ maybe_connect_solr
30
+ end
31
+
32
+ def maybe_connect_solr
33
+ return unless solr.url.present?
34
+
35
+ ActiveFedora::SolrService.register
36
+ ActiveFedora::SolrService.instance.instance_variable_set :@conn, make_solr_connection
37
+ end
38
+
39
+ def make_solr_connection
40
+ ::RSolr.connect(url: Dor::Config.solr.url)
41
+ end
42
+
43
+ # This is consumed by ActiveFedora.configurator
44
+ def solr_config
45
+ { url: solr.url }
46
+ end
47
+
48
+ # This is consumed by ActiveFedora.configurator
49
+ def fedora_config
50
+ fedora_uri = URI.parse(fedora.url)
51
+ connection_opts = { url: fedora.safeurl, user: fedora_uri.user, password: fedora_uri.password }
52
+ connection_opts[:ssl_client_cert] = OpenSSL::X509::Certificate.new(File.read(ssl.cert_file)) if ssl.cert_file.present?
53
+ connection_opts[:ssl_client_key] = OpenSSL::PKey::RSA.new(File.read(ssl.key_file), ssl.key_pass) if ssl.key_file.present?
54
+ connection_opts[:ssl_cert_store] = default_ssl_cert_store
55
+ connection_opts
56
+ end
57
+
58
+ # This is consumed by ActiveFedora.configurator
59
+ def predicate_config
60
+ # rubocop:disable Security/YAMLLoad
61
+ YAML.load(File.read(File.expand_path('../../config/predicate_mappings.yml', __dir__)))
62
+ # rubocop:enable Security/YAMLLoad
63
+ end
64
+
65
+ def default_ssl_cert_store
66
+ @default_ssl_cert_store ||= RestClient::Request.default_ssl_cert_store
67
+ end
68
+
69
+ def cleanup
70
+ @cleanup.configure(&block) if block_given?
71
+ @cleanup
72
+ end
73
+
74
+ def ssl(&block)
75
+ @ssl.configure(&block) if block_given?
76
+ @ssl
77
+ end
78
+
79
+ def fedora(&block)
80
+ @fedora.configure(&block) if block_given?
81
+ @fedora
82
+ end
83
+
84
+ def solr(&block)
85
+ @solr.configure(&block) if block_given?
86
+
87
+ @solr
88
+ end
89
+
90
+ def stacks(&block)
91
+ @stacks.configure(&block) if block_given?
92
+
93
+ @stacks
94
+ end
95
+
96
+ def suri(&block)
97
+ @suri.configure(&block) if block_given?
98
+
99
+ @suri
100
+ end
101
+
102
+ def workflow(&block)
103
+ @workflow.configure(&block) if block_given?
104
+
105
+ @workflow
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'dor/certificate_authenticated_rest_resource_factory'
4
+
5
+ module Dor
6
+ class StaticConfig
7
+ # Represents the configuration for Fedora 3
8
+ class FedoraConfig
9
+ def initialize(hash)
10
+ @url = hash.fetch(:url)
11
+ end
12
+
13
+ def configure(&block)
14
+ instance_eval(&block)
15
+ end
16
+
17
+ def client
18
+ CertificateAuthenticatedRestResourceFactory.create(:fedora)
19
+ end
20
+
21
+ def url(new_value = nil)
22
+ @url = new_value if new_value
23
+ @url
24
+ end
25
+
26
+ # The url without the username or password
27
+ def safeurl
28
+ fedora_uri = URI.parse(url)
29
+ fedora_uri.user = fedora_uri.password = nil
30
+ fedora_uri.to_s
31
+ rescue URI::InvalidURIError
32
+ nil
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dor
4
+ class StaticConfig
5
+ class SolrConfig
6
+ # Represents the configuration for Solr
7
+ def initialize(hash)
8
+ @url = hash.fetch(:url)
9
+ end
10
+
11
+ def configure(&block)
12
+ instance_eval(&block)
13
+ end
14
+
15
+ def url(new_value = nil)
16
+ @url = new_value if new_value
17
+ @url
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dor
4
+ class StaticConfig
5
+ class SslConfig
6
+ # Represents the client side certificate configuration for Fedora 3
7
+ def initialize(hash)
8
+ @cert_file = hash.fetch(:cert_file)
9
+ @key_file = hash.fetch(:key_file)
10
+ @key_pass = hash.fetch(:key_pass)
11
+ end
12
+
13
+ def configure(&block)
14
+ instance_eval(&block)
15
+ end
16
+
17
+ def cert_file(new_value = nil)
18
+ @cert_file = new_value if new_value
19
+ @cert_file
20
+ end
21
+
22
+ def key_file(new_value = nil)
23
+ @key_file = new_value if new_value
24
+ @key_file
25
+ end
26
+
27
+ def key_pass(new_value = nil)
28
+ @key_pass = new_value if new_value
29
+ @key_pass
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dor
4
+ class StaticConfig
5
+ # Represents the configuration for the shared filesystem direcotories
6
+ class StacksConfig
7
+ def initialize(hash)
8
+ @document_cache_host = hash.fetch(:document_cache_host)
9
+ @local_stacks_root = hash.fetch(:local_stacks_root)
10
+ @local_workspace_root = hash.fetch(:local_workspace_root)
11
+ @local_document_cache_root = hash.fetch(:local_document_cache_root)
12
+ end
13
+
14
+ def configure(&block)
15
+ instance_eval(&block)
16
+ end
17
+
18
+ def document_cache_host(new_value = nil)
19
+ @document_cache_host = new_value if new_value
20
+ @document_cache_host
21
+ end
22
+
23
+ def local_stacks_root(new_value = nil)
24
+ @local_stacks_root = new_value if new_value
25
+ @local_stacks_root
26
+ end
27
+
28
+ def local_workspace_root(new_value = nil)
29
+ @local_workspace_root = new_value if new_value
30
+ @local_workspace_root
31
+ end
32
+
33
+ def local_document_cache_root(new_value = nil)
34
+ @local_document_cache_root = new_value if new_value
35
+ @local_document_cache_root
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dor
4
+ class StaticConfig
5
+ # Represents the configuration for the identifier minter service (suri)
6
+ class SuriConfig
7
+ def initialize(hash)
8
+ @mint_ids = hash.fetch(:mint_ids)
9
+ @pass = hash.fetch(:pass)
10
+ @id_namespace = hash.fetch(:id_namespace)
11
+ @url = hash.fetch(:url)
12
+ @user = hash.fetch(:user)
13
+ end
14
+
15
+ def configure(&block)
16
+ instance_eval(&block)
17
+ end
18
+
19
+ def mint_ids(new_value = nil)
20
+ @mint_ids = new_value if new_value
21
+ @mint_ids
22
+ end
23
+
24
+ def id_namespace(new_value = nil)
25
+ @id_namespace = new_value if new_value
26
+ @id_namespace
27
+ end
28
+
29
+ def url(new_value = nil)
30
+ @url = new_value if new_value
31
+ @url
32
+ end
33
+
34
+ def user(new_value = nil)
35
+ @user = new_value if new_value
36
+ @user
37
+ end
38
+
39
+ def pass(new_value = nil)
40
+ @pass = new_value if new_value
41
+ @pass
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dor
4
+ class StaticConfig
5
+ # Represents the configuration for the workflow service
6
+ class WorkflowConfig
7
+ def initialize(hash)
8
+ @url = hash.fetch(:url)
9
+ @timeout = hash.fetch(:timeout)
10
+ @logfile = hash.fetch(:logfile)
11
+ @shift_age = hash.fetch(:shift_age)
12
+ end
13
+
14
+ def configure(&block)
15
+ instance_eval(&block)
16
+ end
17
+
18
+ def client
19
+ @client ||= Dor::Workflow::Client.new(url: url, logger: client_logger, timeout: timeout)
20
+ end
21
+
22
+ def url(new_value = nil)
23
+ @url = new_value if new_value
24
+ @url
25
+ end
26
+
27
+ def timeout(new_value = nil)
28
+ @timeout = new_value if new_value
29
+ @timeout
30
+ end
31
+
32
+ def logfile(new_value = nil)
33
+ @logfile = new_value if new_value
34
+ @logfile
35
+ end
36
+
37
+ def shift_age(new_value = nil)
38
+ @shift_age = new_value if new_value
39
+ @shift_age
40
+ end
41
+
42
+ def client_logger
43
+ if logfile && shift_age
44
+ Logger.new(logfile, shift_age)
45
+ elsif logfile
46
+ Logger.new(logfile)
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dor
4
- VERSION = '7.2.4'
4
+ VERSION = '8.0.0'
5
5
  end
@@ -26,16 +26,6 @@ module Dor
26
26
  self.ng_xml = Nokogiri::XML(node)
27
27
  end
28
28
 
29
- # is this an incomplete workflow with steps that have a priority > 0
30
- def expedited?
31
- processes.any? { |proc| !proc.completed? && proc.priority.to_i > 0 }
32
- end
33
-
34
- # @return [Integer] value of the first > 0 priority. Defaults to 0
35
- def priority
36
- processes.map { |proc| proc.priority.to_i }.detect(0) { |p| p > 0 }
37
- end
38
-
39
29
  # @return [Dor::WorkflowDefinitionDs]
40
30
  def definition
41
31
  @definition ||= begin
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dor-services
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.2.4
4
+ version: 8.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Klein
@@ -11,10 +11,16 @@ authors:
11
11
  - Renzo Sanchez-Silva
12
12
  - Joseph Atzberger
13
13
  - Johnathan Martin
14
+ - Naomi Dushay
15
+ - Justin Coyne
16
+ - Chris Beer
17
+ - Peter Mangiafico
18
+ - Michael J. Giarlo
19
+ - Justin Littman
14
20
  autorequire:
15
21
  bindir: bin
16
22
  cert_chain: []
17
- date: 2019-08-14 00:00:00.000000000 Z
23
+ date: 2019-09-16 00:00:00.000000000 Z
18
24
  dependencies:
19
25
  - !ruby/object:Gem::Dependency
20
26
  name: active-fedora
@@ -50,20 +56,6 @@ dependencies:
50
56
  - - "~>"
51
57
  - !ruby/object:Gem::Version
52
58
  version: '5.1'
53
- - !ruby/object:Gem::Dependency
54
- name: confstruct
55
- requirement: !ruby/object:Gem::Requirement
56
- requirements:
57
- - - "~>"
58
- - !ruby/object:Gem::Version
59
- version: 0.2.7
60
- type: :runtime
61
- prerelease: false
62
- version_requirements: !ruby/object:Gem::Requirement
63
- requirements:
64
- - - "~>"
65
- - !ruby/object:Gem::Version
66
- version: 0.2.7
67
59
  - !ruby/object:Gem::Dependency
68
60
  name: deprecation
69
61
  requirement: !ruby/object:Gem::Requirement
@@ -78,26 +70,6 @@ dependencies:
78
70
  - - "~>"
79
71
  - !ruby/object:Gem::Version
80
72
  version: '0'
81
- - !ruby/object:Gem::Dependency
82
- name: dor-services-client
83
- requirement: !ruby/object:Gem::Requirement
84
- requirements:
85
- - - ">="
86
- - !ruby/object:Gem::Version
87
- version: 1.5.0
88
- - - "<"
89
- - !ruby/object:Gem::Version
90
- version: 3.0.0
91
- type: :runtime
92
- prerelease: false
93
- version_requirements: !ruby/object:Gem::Requirement
94
- requirements:
95
- - - ">="
96
- - !ruby/object:Gem::Version
97
- version: 1.5.0
98
- - - "<"
99
- - !ruby/object:Gem::Version
100
- version: 3.0.0
101
73
  - !ruby/object:Gem::Dependency
102
74
  name: json
103
75
  requirement: !ruby/object:Gem::Requirement
@@ -214,20 +186,6 @@ dependencies:
214
186
  - - "<"
215
187
  - !ruby/object:Gem::Version
216
188
  version: '3'
217
- - !ruby/object:Gem::Dependency
218
- name: ruby-cache
219
- requirement: !ruby/object:Gem::Requirement
220
- requirements:
221
- - - "~>"
222
- - !ruby/object:Gem::Version
223
- version: 0.3.0
224
- type: :runtime
225
- prerelease: false
226
- version_requirements: !ruby/object:Gem::Requirement
227
- requirements:
228
- - - "~>"
229
- - !ruby/object:Gem::Version
230
- version: 0.3.0
231
189
  - !ruby/object:Gem::Dependency
232
190
  name: rubydora
233
191
  requirement: !ruby/object:Gem::Requirement
@@ -282,14 +240,14 @@ dependencies:
282
240
  requirements:
283
241
  - - "~>"
284
242
  - !ruby/object:Gem::Version
285
- version: '3.0'
243
+ version: '3.3'
286
244
  type: :runtime
287
245
  prerelease: false
288
246
  version_requirements: !ruby/object:Gem::Requirement
289
247
  requirements:
290
248
  - - "~>"
291
249
  - !ruby/object:Gem::Version
292
- version: '3.0'
250
+ version: '3.3'
293
251
  - !ruby/object:Gem::Dependency
294
252
  name: druid-tools
295
253
  requirement: !ruby/object:Gem::Requirement
@@ -422,14 +380,14 @@ dependencies:
422
380
  requirements:
423
381
  - - "~>"
424
382
  - !ruby/object:Gem::Version
425
- version: 0.65.0
383
+ version: 0.74.0
426
384
  type: :development
427
385
  prerelease: false
428
386
  version_requirements: !ruby/object:Gem::Requirement
429
387
  requirements:
430
388
  - - "~>"
431
389
  - !ruby/object:Gem::Version
432
- version: 0.65.0
390
+ version: 0.74.0
433
391
  - !ruby/object:Gem::Dependency
434
392
  name: rubocop-rspec
435
393
  requirement: !ruby/object:Gem::Requirement
@@ -488,7 +446,7 @@ dependencies:
488
446
  version: '0'
489
447
  description: Contains classes to register objects and initialize workflows
490
448
  email:
491
- - mbklein@stanford.edu
449
+ - dlss-infrastructure-team@lists.stanford.edu
492
450
  executables: []
493
451
  extensions: []
494
452
  extra_rdoc_files: []
@@ -540,26 +498,29 @@ files:
540
498
  - lib/dor/models/set.rb
541
499
  - lib/dor/models/workflow_object.rb
542
500
  - lib/dor/models/workflow_solr_document.rb
501
+ - lib/dor/release_tags.rb
502
+ - lib/dor/release_tags/identity_metadata.rb
503
+ - lib/dor/release_tags/purl.rb
504
+ - lib/dor/release_tags/purl_client.rb
543
505
  - lib/dor/rest_resource_factory.rb
544
- - lib/dor/services/cleanup_service.rb
545
506
  - lib/dor/services/collection_service.rb
546
- - lib/dor/services/create_workflow_service.rb
547
507
  - lib/dor/services/creative_commons_license_service.rb
548
- - lib/dor/services/delete_service.rb
549
508
  - lib/dor/services/embargo_service.rb
550
- - lib/dor/services/metadata_handlers/catalog_handler.rb
551
- - lib/dor/services/metadata_service.rb
552
- - lib/dor/services/mods2dc.xslt
553
509
  - lib/dor/services/ontology.rb
554
510
  - lib/dor/services/open_data_license_service.rb
555
- - lib/dor/services/public_desc_metadata_service.rb
556
- - lib/dor/services/purl_client.rb
557
511
  - lib/dor/services/release_tag_service.rb
558
512
  - lib/dor/services/search_service.rb
513
+ - lib/dor/services/state_service.rb
559
514
  - lib/dor/services/status_service.rb
560
515
  - lib/dor/services/suri_service.rb
561
516
  - lib/dor/services/tag_service.rb
562
- - lib/dor/services/thumbnail_service.rb
517
+ - lib/dor/static_config.rb
518
+ - lib/dor/static_config/fedora_config.rb
519
+ - lib/dor/static_config/solr_config.rb
520
+ - lib/dor/static_config/ssl_config.rb
521
+ - lib/dor/static_config/stacks_config.rb
522
+ - lib/dor/static_config/suri_config.rb
523
+ - lib/dor/static_config/workflow_config.rb
563
524
  - lib/dor/utils/hydrus_shims.rb
564
525
  - lib/dor/utils/ng_tidy.rb
565
526
  - lib/dor/utils/pid_utils.rb
@@ -589,8 +550,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
589
550
  - !ruby/object:Gem::Version
590
551
  version: 1.3.6
591
552
  requirements: []
592
- rubyforge_project:
593
- rubygems_version: 2.7.8
553
+ rubygems_version: 3.0.3
594
554
  signing_key:
595
555
  specification_version: 4
596
556
  summary: Ruby implmentation of DOR services used by the SULAIR Digital Library