dor-services 6.4.0 → 6.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8f84301c1b84bb4155b4dec895cb2b3d63daea54637b35f51728a8268c792ee
4
- data.tar.gz: 8accea8e3978a89bf772dd0ecb14b17229b6755b8a8a1c3e12b790b59eaae3ee
3
+ metadata.gz: c8fda5b9a8dcdb85f290832205f6048a235e28e4ef6cf7deab312bcd40ec98da
4
+ data.tar.gz: b2e10373a24d6c531cd36fb72fa3ebc31d8e52354d5c1bd39615958bd08386f0
5
5
  SHA512:
6
- metadata.gz: 923ed4f14197cdb8fdc821276b7d500ffaa0fde36187cf537ee894ac025213dde7fe7905bd71e25f9d1b25d057b10649c48016e6bbf41a5dd1cef4efc3df001c
7
- data.tar.gz: 26e4f1ab094617dc635340f0a31858ba0e1d9ad31565c7bedd83fb58b013432ecfc303a875702a4db846eaa820e5cf0776ab3bb1daac2e726fe70fcf6e775ee0
6
+ metadata.gz: 17d7c18682c5b8acc1730f3e293a2ba4643b5970b0a91cc3e11796006c3d204e408eb5ee49e243d29f0b44ba412667efdf3b9377cbf23b082da9e3a193b49b10
7
+ data.tar.gz: 9ee4653efdfe1fb63603e0311362562f4f09a1b965c1e4e92a81009d084cadc10d41e46f29543605f020133f75dea5fd79698daa122c5fbdd2c34e853949b68b
@@ -6,6 +6,13 @@ require 'jhove_service'
6
6
  require 'dor-services'
7
7
 
8
8
  module Dor
9
+ # Extracts technical metadata from files using JHOVE
10
+ # If this is a new version it gets the old technicalMetadata datastream by
11
+ # making an API call to sdr-services-app (via dor-services-app) and
12
+ # only overwrites/adds parts for the files that were changed or added.
13
+ # This allows us to avoid re-staging files that have not changed.
14
+ # Switching to a more granular data model that has file metadata separate from
15
+ # the Work metadata will allow us to simplify this greatly.
9
16
  class TechnicalMetadataService
10
17
  # @param [Dor::Item] dor_item The DOR item being processed by the technical metadata robot
11
18
  # @return [Boolean] True if technical metadata is correctly added or updated
@@ -45,6 +52,7 @@ module Dor
45
52
  end
46
53
  end
47
54
  end
55
+ private_class_method :test_jhove_service
48
56
 
49
57
  # @param [Dor::Item] dor_item The DOR item being processed by the technical metadata robot
50
58
  # @return [FileGroupDifference] The differences between two versions of a group of files
@@ -52,21 +60,26 @@ module Dor
52
60
  return Moab::FileGroupDifference.new if dor_item.contentMetadata.nil?
53
61
  raise Dor::ParameterError, 'Missing Dor::Config.stacks.local_workspace_root' if Config.stacks.local_workspace_root.nil?
54
62
 
55
- inventory_diff = Sdr::Client.get_content_diff(dor_item.pid, dor_item.contentMetadata.content, 'all')
63
+ client = Dor::Services::Client.object(dor_item.pid).sdr
64
+ current_content = dor_item.contentMetadata.content
65
+ inventory_diff = client.content_diff(current_content: current_content)
56
66
  inventory_diff.group_difference('content')
57
67
  end
68
+ private_class_method :get_content_group_diff
58
69
 
59
70
  # @param [FileGroupDifference] content_group_diff
60
71
  # @return [Hash<Symbol,Array>] Sets of filenames grouped by change type for use in performing file or metadata operations
61
72
  def self.get_file_deltas(content_group_diff)
62
73
  content_group_diff.file_deltas
63
74
  end
75
+ private_class_method :get_file_deltas
64
76
 
65
77
  # @param [Hash<Symbol,Array>] deltas Sets of filenames grouped by change type for use in performing file or metadata operations
66
78
  # @return [Array<String>] The list of filenames for files that are either added or modifed since the previous version
67
79
  def self.get_new_files(deltas)
68
80
  deltas[:added] + deltas[:modified]
69
81
  end
82
+ private_class_method :get_new_files
70
83
 
71
84
  # @param [Dor::Item] dor_item The DOR item being processed by the technical metadata robot
72
85
  # @return [String] The technicalMetadata datastream from the previous version of the digital object
@@ -76,6 +89,7 @@ module Dor
76
89
 
77
90
  get_dor_technical_metadata(dor_item)
78
91
  end
92
+ private_class_method :get_old_technical_metadata
79
93
 
80
94
  # @param [String] druid The identifier of the digital object being processed by the technical metadata robot
81
95
  # @return [String] The technicalMetadata datastream from the previous version of the digital object (fetched from SDR storage)
@@ -87,6 +101,7 @@ module Dor
87
101
 
88
102
  nil
89
103
  end
104
+ private_class_method :get_sdr_technical_metadata
90
105
 
91
106
  # @param [Dor::Item] dor_item The DOR item being processed by the technical metadata robot
92
107
  # @return [String] The technicalMetadata datastream from the previous version of the digital object (fetched from DOR fedora).
@@ -101,13 +116,15 @@ module Dor
101
116
 
102
117
  nil
103
118
  end
119
+ private_class_method :get_dor_technical_metadata
104
120
 
105
121
  # @param [String] druid The identifier of the digital object being processed by the technical metadata robot
106
122
  # @param [String] dsname The identifier of the metadata datastream
107
123
  # @return [String] The datastream contents from the previous version of the digital object (fetched from SDR storage)
108
124
  def self.get_sdr_metadata(druid, dsname)
109
- Sdr::Client.get_sdr_metadata(druid, dsname)
125
+ Dor::Services::Client.object(druid).sdr.metadata(datastream: dsname)
110
126
  end
127
+ private_class_method :get_sdr_metadata
111
128
 
112
129
  # @param [DruidTools::Druid] druid A wrapper class for the druid identifier. Used to generate paths
113
130
  # @param [Array<String>] new_files The list of filenames for files that are either added or modifed since the previous version
@@ -125,6 +142,7 @@ module Dor
125
142
  tech_md_file = jhove_service.create_technical_metadata(jhove_output_file)
126
143
  IO.read(tech_md_file)
127
144
  end
145
+ private_class_method :get_new_technical_metadata
128
146
 
129
147
  # @param [Pathname] temp_dir The pathname of the temp folder in the object's workspace area
130
148
  # @param [Object] new_files [Array<String>] The list of filenames for files that are either added or modifed since the previous version
@@ -134,6 +152,7 @@ module Dor
134
152
  fileset_pathname.open('w') { |f| f.puts(new_files) }
135
153
  fileset_pathname
136
154
  end
155
+ private_class_method :write_fileset
137
156
 
138
157
  # @param [String] old_techmd The technicalMetadata datastream from the previous version of the digital object
139
158
  # @param [String] new_techmd The technicalMetadata datastream for the new files of the new digital object version
@@ -164,6 +183,7 @@ module Dor
164
183
  end
165
184
  merged_nodes
166
185
  end
186
+ private_class_method :merge_file_nodes
167
187
 
168
188
  # @param [String] technical_metadata A technicalMetadata datastream contents
169
189
  # @return [Hash<String,Nokogiri::XML::Node>] The set of nodes from a technicalMetadata datastream, indexed by filename
@@ -191,6 +211,7 @@ module Dor
191
211
  end
192
212
  file_hash
193
213
  end
214
+ private_class_method :get_file_nodes
194
215
 
195
216
  # @param [String] druid The identifier of the digital object being processed by the technical metadata robot
196
217
  # @param [Hash<String,Nokogiri::XML::Node>] merged_nodes The complete set of technicalMetadata nodes for the digital object, indexed by filename
@@ -206,5 +227,6 @@ module Dor
206
227
  merged_nodes.keys.sort.each { |path| doc << merged_nodes[path] }
207
228
  doc + '</technicalMetadata>'
208
229
  end
230
+ private_class_method :build_technical_metadata
209
231
  end
210
232
  end
@@ -24,6 +24,9 @@ module Sdr
24
24
  # @param [String] dsname The identifier of the metadata datastream
25
25
  # @return [String] The datastream contents from the previous version of the digital object (fetched from SDR storage)
26
26
  def get_sdr_metadata(druid, dsname)
27
+ Deprecation.warn(self, 'Sdr::Client.get_sdr_metadata is deprecated and will be removed in dor-services 7. ' \
28
+ 'Use Dor::Services::Client.object(object_identifier).sdr.metadatra(datastream:) instead')
29
+
27
30
  client["objects/#{druid}/metadata/#{dsname}.xml"].get
28
31
  rescue RestClient::ResourceNotFound
29
32
  nil
@@ -32,6 +35,9 @@ module Sdr
32
35
  # @param [String] druid The object identifier
33
36
  # @return [Moab::SignatureCatalog] the catalog of all files previously ingested
34
37
  def get_signature_catalog(druid)
38
+ Deprecation.warn(self, 'Sdr::Client.get_signature_catalog is deprecated and will be removed in dor-services 7. ' \
39
+ 'Use Dor::Services::Client.object(object_identifier).sdr.signature_catalog instead')
40
+
35
41
  response = client["objects/#{druid}/manifest/signatureCatalog.xml"].get
36
42
  Moab::SignatureCatalog.parse(response)
37
43
  rescue RestClient::ResourceNotFound
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dor
4
- VERSION = '6.4.0'
4
+ VERSION = '6.5.0'
5
5
  end
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: 6.4.0
4
+ version: 6.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Klein
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2019-02-02 00:00:00.000000000 Z
17
+ date: 2019-02-08 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: active-fedora
@@ -90,14 +90,14 @@ dependencies:
90
90
  requirements:
91
91
  - - "~>"
92
92
  - !ruby/object:Gem::Version
93
- version: '1.3'
93
+ version: '1.5'
94
94
  type: :runtime
95
95
  prerelease: false
96
96
  version_requirements: !ruby/object:Gem::Requirement
97
97
  requirements:
98
98
  - - "~>"
99
99
  - !ruby/object:Gem::Version
100
- version: '1.3'
100
+ version: '1.5'
101
101
  - !ruby/object:Gem::Dependency
102
102
  name: equivalent-xml
103
103
  requirement: !ruby/object:Gem::Requirement