Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HashStore-java 1.1.0 Release #48

Open
wants to merge 607 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 107 commits
Commits
Show all changes
607 commits
Select commit Hold shift + click to select a range
25a970b
Update 'deleteObject' Runnable test to check for 1000 pids instead of 50
doulikecookiedough Jul 4, 2024
2734f03
Update 'HashStoreRunnable' test class exception messaging to 'e.getCa…
doulikecookiedough Jul 5, 2024
9a99113
Clean up 'HashStoreRunnable' and add/revise logging statements
doulikecookiedough Jul 5, 2024
9e1d9e2
Extract new protected method 'storeHashStoreRefsFiles' from 'tagObject'
doulikecookiedough Jul 9, 2024
d890db6
Organize new 'storeHashStoreRefsFile' method in 'FileHashStore' class…
doulikecookiedough Jul 9, 2024
9020775
Revise junit tests for 'tagObject', add new junit tests for 'storeHas…
doulikecookiedough Jul 9, 2024
6c727fa
Add new method 'unTagObject'
doulikecookiedough Jul 9, 2024
bfe2f27
Revise comment for accuracy
doulikecookiedough Jul 9, 2024
5a69daf
Add new junit test for 'unTagObject' and fix bug in existing 'tagObje…
doulikecookiedough Jul 9, 2024
259bf54
Add new junit tests for 'unTagObject'
doulikecookiedough Jul 9, 2024
b06d8c6
Revise 'findObject' to throw custom exception 'PidRefsFileNotFoundExc…
doulikecookiedough Jul 9, 2024
18d2e25
Add new junit test for 'unTagObject' and revise 'findObject' junit te…
doulikecookiedough Jul 9, 2024
cbd494d
Add clean-up code to 'unTagObject' when a pid refs file does not exis…
doulikecookiedough Jul 9, 2024
30e1e09
Revise 'unTagObject' javadoc and comments
doulikecookiedough Jul 9, 2024
5e2e7f1
Add print statements to 'HashStoreRunnable' to assist with debugging …
doulikecookiedough Jul 10, 2024
742eeac
Add 'unTagObject' to 'tagObject' process
doulikecookiedough Jul 10, 2024
e96a517
Add new junit tests for 'updateRefsFile'
doulikecookiedough Jul 10, 2024
b6d56cc
Add new junit tests for 'tagObject' and fix bug where a pid refs is d…
doulikecookiedough Jul 10, 2024
9eef991
Revise comments and add additional print statement to assist with deb…
doulikecookiedough Jul 10, 2024
355dd1b
Fix inaccurate argument string in 'verifyChecksumParameters'
doulikecookiedough Jul 10, 2024
81cb5ed
Cleanup 'FileHashStoreReferencesTest' class
doulikecookiedough Jul 10, 2024
84f8dc7
Merge pull request #89 from DataONEorg/feature-83-tagobject-cleanup
doulikecookiedough Jul 10, 2024
60127a4
Remove 'findObject' from 'HashStore' interface and move javadoc to 'F…
doulikecookiedough Jul 10, 2024
08e7c7e
Remove 'findObject' from 'HashStoreClient' and update README.md
doulikecookiedough Jul 10, 2024
bb47568
Cleanup test classes for ide warnings and re-organize junit tests
doulikecookiedough Jul 10, 2024
e0c3bb7
Move 'findObject' code in 'FileHashStore' to core and supporting meth…
doulikecookiedough Jul 10, 2024
47841f1
Merge pull request #90 from DataONEorg/feature-87-removefo-publicapi
doulikecookiedough Jul 10, 2024
a60586c
Code clean-up: Review/revise comments, refactor 'retrieveMetadata' me…
doulikecookiedough Jul 11, 2024
fd290ea
Code clean-up: Review/revise comments, refactor 'deleteMetadata' meth…
doulikecookiedough Jul 11, 2024
ccda4c5
Code clean-up: Revise deleteMetadata to call existing method to get p…
doulikecookiedough Jul 11, 2024
947459a
Code clean-up: Remove unused 'deleteRefsFile' method & update junit t…
doulikecookiedough Jul 11, 2024
487bbce
Resolve linting warning in 'putObject' by replacing .delete() call on…
doulikecookiedough Jul 11, 2024
c2b67de
Clean-up 'deleteObject' and 'unTagObject', refactor to begin with rem…
doulikecookiedough Jul 11, 2024
3b5b7d6
Rename method 'getMetadataDocInputStream' to 'getHashStoreMetadataInp…
doulikecookiedough Jul 11, 2024
83382f9
Code clean-up: remove redundant logging texts
doulikecookiedough Jul 11, 2024
cebdd2f
Accept IDE warning suggestion to weaken specific list types to a Coll…
doulikecookiedough Jul 11, 2024
c778e2d
Code clean-up: fix ide warnings for 'FileHashStoreUtility' class
doulikecookiedough Jul 11, 2024
261ca00
Code clean-up: fix ide warnings for 'ObjectMetadata' class
doulikecookiedough Jul 11, 2024
75b56c2
Code clean-up: remove redundant printstacktrace statement in 'HashSto…
doulikecookiedough Jul 11, 2024
cc1a43b
Code clean-up: address warnings for HashStore interface
doulikecookiedough Jul 11, 2024
207937a
Code clean-up: address warnings for HashStoreClient class
doulikecookiedough Jul 12, 2024
9010843
Code clean-up: Address additional warnigs from test classes
doulikecookiedough Jul 12, 2024
67bd37c
Accept ide warning to Weaken type from List to Collection in 'FileHas…
doulikecookiedough Jul 12, 2024
e6e1018
Refactor public api methods in 'FileHashStore' by extracting synchron…
doulikecookiedough Jul 12, 2024
3ccc3eb
Remove unused parameter from 'syncRenameMetadataDocForDeletion' and f…
doulikecookiedough Jul 12, 2024
f92ccca
Deactivate known intermittently failing test which issue has been cre…
doulikecookiedough Jul 12, 2024
c2098d3
Update storeObject HashStoreRunnable junit test
doulikecookiedough Jul 12, 2024
b0c5414
Fix warning for 'verifyObject' with boolean value in signature by rem…
doulikecookiedough Jul 12, 2024
d2f73b4
Remove todo item and add new junit tests for 'getHashStoreMetadataInp…
doulikecookiedough Jul 12, 2024
8cd0d34
Add missing junit tests for 'verifyChecksumParameters'
doulikecookiedough Jul 12, 2024
f649697
Add missing junit tests for 'shouldCalculateAlgorithm'
doulikecookiedough Jul 12, 2024
3d00b4b
Delete 'FileHashStoreReferencesTest' class, move and organize junit t…
doulikecookiedough Jul 12, 2024
7474db3
Rename 'FileHashStorePublicTest' to 'FileHashStoreInitTest' for accuracy
doulikecookiedough Jul 12, 2024
0e0dfcf
Add missing junit tests for 'isStringInRefsFile' in 'FileHashStorePro…
doulikecookiedough Jul 12, 2024
6c7e151
Fix bug in 'validateTmpObject' and add missing 'validateTmpObject' ju…
doulikecookiedough Jul 12, 2024
e9b4b24
Reword javadoc for 'HashStoreClient' class
doulikecookiedough Jul 12, 2024
6ad3c01
Re-activate disabled runnable test, update 'putObject' to delete redu…
doulikecookiedough Jul 17, 2024
30d7f88
Rework/optimize 'putObject' routine and update junit tests
doulikecookiedough Jul 17, 2024
8f323f5
Revise error statement in 'putObject' and variable name in intermitte…
doulikecookiedough Jul 17, 2024
9d096f3
Merge pull request #91 from DataONEorg/bug-88-tmpfile-cleanup
doulikecookiedough Jul 17, 2024
6ff1336
Update README.md
doulikecookiedough Jul 17, 2024
8bee29d
Update HashStore interface, rename 'verifyObject' to 'deleteInvalidOb…
doulikecookiedough Jul 17, 2024
8617f17
Merge pull request #93 from DataONEorg/feature-92-deleteinvalidobject
doulikecookiedough Jul 17, 2024
71dc486
Move synchronization code calls into try blocks
doulikecookiedough Jul 19, 2024
28cfa7a
Add missing synchronization for data object cid when data object is a…
doulikecookiedough Jul 19, 2024
b0f86a5
Rename synchronization array from 'objectLockedIds' to 'objectLockedP…
doulikecookiedough Jul 19, 2024
2fc6721
Rename synchronization array from 'metadataLockedIds' to 'metadataLoc…
doulikecookiedough Jul 19, 2024
08f2c79
Rename synchronization array from 'referenceLockedCids' to 'objectLoc…
doulikecookiedough Jul 19, 2024
7aa852d
Add new synchronization code for 'tagObject' which can be called dire…
doulikecookiedough Jul 19, 2024
2ea427b
Revise 'tagObject' unexpected exception process to release locks befo…
doulikecookiedough Jul 19, 2024
38d0924
Check 'deleteInvalidObject' for when ObjectMetadata passed does not i…
doulikecookiedough Jul 19, 2024
f76a13c
Rename FileHashStoreUtility 'checkForEmptyString' to 'checkForEmptyAn…
doulikecookiedough Jul 19, 2024
b044728
Rework FileHashStoreUtility 'deleteListItems' method to attempt to de…
doulikecookiedough Jul 19, 2024
8442d66
Add logic to Public API store methods to try-finally .close the suppl…
doulikecookiedough Jul 19, 2024
2cbec48
Refactor 'deleteMetadata' with logic to revert the process if there i…
doulikecookiedough Jul 19, 2024
9f3dac9
Clean up code for recently reworked deleteMetadata process
doulikecookiedough Jul 19, 2024
489f4db
Merge pull request #94 from DataONEorg/feature-57-delobjref-jingcrch
doulikecookiedough Jul 19, 2024
1a12765
Revert process to restore metadata documents from 'deleteMetadata' me…
doulikecookiedough Jul 19, 2024
f28b522
Add revert metadata deletion process to 'syncRenameMetadataDocForDele…
doulikecookiedough Jul 19, 2024
2012a2a
Add guard rails to 'syncRenameMetadataDocForDeletion' and new junit t…
doulikecookiedough Jul 19, 2024
24315f0
Create new package 'hashstoreconverter' and add new class 'FileHashSt…
doulikecookiedough Jul 24, 2024
8ceec6c
Add 'FileHashStoreLinks' constructor, new junit test class 'FileHashS…
doulikecookiedough Jul 25, 2024
713bda8
Add logging module to 'FileHashStoreLinks'
doulikecookiedough Jul 25, 2024
e3b4016
Change access modifier to public for 'enum DefaultHashAlgorithms' in …
doulikecookiedough Jul 26, 2024
f7e3b91
Rename 'FileHashStoreLinksInitTest' class to 'FileHashStoreLinks', ad…
doulikecookiedough Jul 26, 2024
55f3677
Clean up code: remove unused imports
doulikecookiedough Jul 26, 2024
79b29da
Add new method 'storeHardLink' to 'FileHashStoreLinks', new accessor …
doulikecookiedough Jul 26, 2024
745adac
Clean up 'FileHashStoreLinks' class, remove unused variables
doulikecookiedough Jul 26, 2024
0c7a630
Add missing logging statement for 'storeHardLink'
doulikecookiedough Jul 26, 2024
c5e37b2
Add missing class javadoc for 'FileHashStoreLinks'
doulikecookiedough Jul 26, 2024
ad09376
Fix wording in javadoc
doulikecookiedough Jul 26, 2024
e9310ea
Add new HashStoreConverter class, public convert method and todo items
doulikecookiedough Jul 28, 2024
7cfa4f5
Clean-up code in 'HashStoreConverter' and add missing javadocs
doulikecookiedough Jul 29, 2024
641a73d
Add new 'HashstoreConverter' test class
doulikecookiedough Jul 29, 2024
06a9eab
Catch and swallow 'FileAlreadyExistsException' in 'storeHardLink' and…
doulikecookiedough Jul 29, 2024
4f3e8fb
Add new junit test for 'HashStoreConverter' convert method
doulikecookiedough Jul 29, 2024
51b3c5a
Revise 'HashStoreConverter' javadocs to improve clarity
doulikecookiedough Jul 29, 2024
d9747d7
Update javadoc for 'HashStoreConverter'
doulikecookiedough Jul 29, 2024
4a02ffb
Remove unused imports
doulikecookiedough Jul 29, 2024
123d714
Further revise javadocs
doulikecookiedough Jul 29, 2024
d102c24
Cleanup and remove redundant junit tests, add missing javadocs
doulikecookiedough Jul 29, 2024
6f416b3
Refactor 'convert' method to conditionally store the data object or s…
doulikecookiedough Jul 31, 2024
82446b8
Refactor 'convert' method to check for null sysmeta stream (it can ne…
doulikecookiedough Jul 31, 2024
cb803d6
Refactor 'convert' to store sysmeta first, which is a hard requiremen…
doulikecookiedough Jul 31, 2024
0ddde8c
Add missing guard rail to check for null pid in 'convert' method
doulikecookiedough Jul 31, 2024
802912e
Revise 'convert' method by moving boolean directly into if statement
doulikecookiedough Aug 1, 2024
9ed84dc
Extract new public method 'createParentDirectories' from 'FileHashSto…
doulikecookiedough Aug 1, 2024
115199d
Update HashStoreConverter's convert and FileHashStoreLinks' storeHard…
doulikecookiedough Aug 1, 2024
034af73
Clean-up 'convert' method and add new junit tests
doulikecookiedough Aug 1, 2024
9a748d4
Clean-up code for linting warnings, unused imports and redundant vari…
doulikecookiedough Aug 1, 2024
e045597
Clean up javadocs
doulikecookiedough Aug 1, 2024
ac82104
Revert 'convert' operation order back to storing hard link first befo…
doulikecookiedough Aug 2, 2024
41375e0
Update postgres version to 42.7.2 to resolve vulnerability warning
doulikecookiedough Aug 9, 2024
1da579c
Update README.md for clarity
doulikecookiedough Aug 9, 2024
8b8ef2d
Rename 'deleteInvalidObject' method to 'deleteIfInvalidObject' and up…
doulikecookiedough Aug 12, 2024
a306271
Update .idea's .gitignore and 'README.md'
doulikecookiedough Aug 12, 2024
96235b8
Revise javadoc usage of backticks to '{@code ... }'
doulikecookiedough Aug 12, 2024
4d382a5
Update maven and idea settings java target to 17 from 1.8
doulikecookiedough Aug 12, 2024
1f33e7d
Add new junit test to check for when pid is simply a new line
doulikecookiedough Aug 12, 2024
4770050
Refactor FileHashStoreUtility 'checkNotNegativeOrZero' to 'checkPosit…
doulikecookiedough Aug 12, 2024
2fea9ff
Rename logging variable in 'HashStoreRunnable'
doulikecookiedough Aug 12, 2024
e327e91
Clean up 'FileHashStoreUtility' logging and exception statements
doulikecookiedough Aug 12, 2024
a1870cc
Update maven.yml workflow to use JDK 17
doulikecookiedough Aug 12, 2024
b58b26c
Add missing javadocs in 'HashStoreRunnable' class and missing javadocs
doulikecookiedough Aug 12, 2024
9e75b30
Refactor 'FileHashStoreProtected' junit tests to create InputStreams …
doulikecookiedough Aug 12, 2024
58e73ab
Refactor 'FileHashStoreInit' junit tests to create InputStreams in tr…
doulikecookiedough Aug 12, 2024
252cefa
Refactor 'FileHashStoreClient' junit tests to create InputStreams in …
doulikecookiedough Aug 12, 2024
d961d35
Refactor 'HashStore' junit tests to create InputStreams in try statem…
doulikecookiedough Aug 12, 2024
5542a9c
Refactor 'FileHashStoreUtility' class' calculateHexDigest method to u…
doulikecookiedough Aug 12, 2024
1c61165
Refactor 'FileHashStore' to use try statements for automatic resource…
doulikecookiedough Aug 12, 2024
6591f44
Refactor 'FileHashStoreInterface' junit tests to create InputStreams …
doulikecookiedough Aug 13, 2024
dd9a2a7
Add new enum 'HashStoreRefUpdateTypes' and refactor affected code in …
doulikecookiedough Aug 13, 2024
56afebc
Refactor 'updateRefsFile' and 'getHashStoreRefsPath' to require enum …
doulikecookiedough Aug 13, 2024
38ebd81
Rename 'checkForEmptyAndValidString' method to 'checkForNotEmptyAndVa…
doulikecookiedough Aug 13, 2024
d1d2559
Apply autoformatting to 'syncPutObject'
doulikecookiedough Aug 13, 2024
da143f3
Apply autoformatting to 'deleteMetadata'
doulikecookiedough Aug 13, 2024
5309243
Apply autoformatting to 'findObject'
doulikecookiedough Aug 13, 2024
d842a59
Apply autoformatting to 'putObject'
doulikecookiedough Aug 13, 2024
0181107
Apply autoformatting to 'getHashStoreMetadataPath'
doulikecookiedough Aug 13, 2024
b3d0ea1
Remove redundant code in 'getHashStoreRefsPath' method
doulikecookiedough Aug 13, 2024
b884303
Add default case to 'getHashStoreRefsPath'
doulikecookiedough Aug 13, 2024
906ea73
Refactor 'ObjectMetadata' to be a record instead of a custom class, a…
doulikecookiedough Aug 13, 2024
ce07581
Cleanup 'ObjectMetadata' class
doulikecookiedough Aug 13, 2024
5bce0ce
Add new record 'objectInfo', refactor 'findObject' to return an 'obje…
doulikecookiedough Aug 13, 2024
75ba6c0
Refactor 'checkForNotEmptyAndValidString' to call '.isBlank()' instea…
doulikecookiedough Aug 13, 2024
f5ca23d
Refactor 'HashStoreRunnable' run's switch case per formatter suggestion
doulikecookiedough Aug 13, 2024
84846f4
Update README.md
doulikecookiedough Aug 15, 2024
f369441
Update javadocs in 'HashStore' interface
doulikecookiedough Aug 15, 2024
dc6a6fb
Refactor and simplify usage of enum objects 'HashStoreIdTypes' and 'H…
doulikecookiedough Aug 15, 2024
7ba3b73
Add missing javadocs for enum objects to add clarity
doulikecookiedough Aug 15, 2024
1eabe79
Rename 'objectInfo' record to 'ObjectInfo'
doulikecookiedough Aug 15, 2024
0bd9a3f
Rename references of 'deleteInvalidObject' to 'deleteIfInvalidObject'
doulikecookiedough Aug 15, 2024
189eaf3
Refactor 'tagObject' by moving synchronization code to be closer to c…
doulikecookiedough Aug 15, 2024
8ceb641
Refactor 'checkForNotEmptyAndValidString' to get method name via thre…
doulikecookiedough Aug 15, 2024
b94eb2c
Refactor 'ensureNotNull' to get method name via thread and update sig…
doulikecookiedough Aug 15, 2024
4561f79
Refactor 'checkPositive' to get method name via thread and update sig…
doulikecookiedough Aug 15, 2024
962ed5b
Fix typo in 'HashStore' interface
doulikecookiedough Aug 15, 2024
a9fce58
Revise comments in 'tagObject'
doulikecookiedough Aug 15, 2024
6a0c32b
Move synchronized call to within try statement in 'unTagObject' to im…
doulikecookiedough Aug 15, 2024
d61d9c3
Apply IntelliJ automatic formatting to entire codebase for linting co…
doulikecookiedough Aug 16, 2024
21bcd62
Merge pull request #58 from DataONEorg/feature-57-deleteobj-refactor
doulikecookiedough Aug 16, 2024
505d9fd
Merge branch 'feature-57-deleteobj-refactor' into feature-95-hashstor…
doulikecookiedough Aug 16, 2024
8105f33
Merge branch 'develop' into feature-95-hashstore-converter
doulikecookiedough Aug 16, 2024
62d72a1
Make enum 'DefaultHashAlgorithms' and 'HashStoreProperties' public to…
doulikecookiedough Aug 16, 2024
fed0882
Revise 'FileHashStoreLinks' and 'HashStoreConverter' classes based on…
doulikecookiedough Aug 16, 2024
261467b
Refactor 'storeHardLink' method to create InputStream from given file…
doulikecookiedough Aug 19, 2024
349a9fb
Refactor 'FileHashStore' and 'FileHashStoreLinks' to automate the cre…
doulikecookiedough Aug 19, 2024
29680d2
Optimize 'writeToTmpFileAndGenerateChecksums' and 'generateChecksums'…
doulikecookiedough Aug 19, 2024
dc6d84d
Make newly added list 'digestsToCalculate' private
doulikecookiedough Aug 19, 2024
7f2b315
Further optimize code to generate checksums by using try-resources on…
doulikecookiedough Aug 19, 2024
4655402
Fix bug in '...Checksums' optimization by creating a local list and m…
doulikecookiedough Aug 19, 2024
3fcf3e8
Revise and add new junit tests related to '...Checksums' methods
doulikecookiedough Aug 19, 2024
5c69d33
Change previously public access modifiers for FileHashStore class var…
doulikecookiedough Aug 19, 2024
530e48d
Rename 'defaultHexDigestsList' to 'defaultMessageDigestsList' and rev…
doulikecookiedough Aug 19, 2024
0b684e1
Merge pull request #96 from DataONEorg/feature-95-hashstore-converter
doulikecookiedough Aug 19, 2024
5f8941a
Remove unused import in 'HashStoreConverter'
doulikecookiedough Aug 20, 2024
b5ed3b1
Update junit test debug messaging for better accuracy (.getMessage in…
doulikecookiedough Aug 20, 2024
2119efb
Roll back optimizations to the default hash algorithm calculation pro…
doulikecookiedough Aug 20, 2024
14ded55
Re-apply IntelliJ auto formatting
doulikecookiedough Aug 20, 2024
e54e48f
Merge pull request #99 from DataONEorg/bug-98-storeobj-failedtest
doulikecookiedough Aug 20, 2024
87fd9e6
Declare 'NonMatchingChecksumException' in HashStoreConverter's 'conve…
doulikecookiedough Aug 20, 2024
6e41851
Fix inaccurate javadoc for new junit test
doulikecookiedough Aug 20, 2024
8c865a8
Cleanup 'FileHashStoreLinksTest' class
doulikecookiedough Aug 20, 2024
d2044ef
Merge pull request #102 from DataONEorg/feature-101-nmce-declare
doulikecookiedough Aug 20, 2024
893df5e
Remove 'unTagObject' call from 'tagObject' method
doulikecookiedough Aug 27, 2024
2bbdb15
Refactor 'storeHashStoreRefsFiles' to 'unTagObject'
doulikecookiedough Aug 27, 2024
eba6b93
Add new custom exception 'IdentifierNotLockedException'
doulikecookiedough Aug 27, 2024
cb56934
Refactor 'unTagObject' with guard rails to ensure thread safety, revi…
doulikecookiedough Aug 27, 2024
6bb60de
Refactor junit tests for 'unTagObject' after making changes
doulikecookiedough Aug 27, 2024
9d24873
Cleanup code, comments and javadocs
doulikecookiedough Aug 27, 2024
d22659b
Re-add 'static' access modifiers to synchronized methods
doulikecookiedough Aug 27, 2024
06bf22e
Added the code to deploy the jar files to the remote maven repostiory.
taojing2002 Aug 28, 2024
31d20cc
Added two profile to specify the deployment location: local or remote.
taojing2002 Aug 28, 2024
9bd333d
Merge pull request #105 from DataONEorg/feature-104-deploy-repository
taojing2002 Aug 29, 2024
fbe25ae
Fix bug in 'storeHashStoreRefsFiles' where we could unintentionally o…
doulikecookiedough Aug 30, 2024
97d133d
Refactor 'storeHashStoreRefsFiles' to always throw exception if a pid…
doulikecookiedough Aug 30, 2024
b31ae8e
Refactor 'storeHashStoreRefsFiles' exception scenario to include more…
doulikecookiedough Aug 30, 2024
ecd7854
Refactor 'updateRefsFile' so that duplicate values are never added an…
doulikecookiedough Aug 30, 2024
1eda5a5
Adjust 'storeHashStoreRefs' scenario when pid refs doesn't exist but …
doulikecookiedough Aug 30, 2024
8165303
Clean up/optimize 'updateRefsFile' by combining if statements
doulikecookiedough Aug 30, 2024
604e7a5
Refactor 'unTagObject' to proceed with as much of the untagging flow …
doulikecookiedough Aug 30, 2024
650e822
Clean up 'unTagObject' and re-order process to focus on pid-related t…
doulikecookiedough Sep 3, 2024
2421bec
Further clean-up 'unTagObject' to proceed with as much of the untaggi…
doulikecookiedough Sep 3, 2024
eab5016
Revise exception messaging to improve clarity in 'unTagObject'
doulikecookiedough Sep 3, 2024
1fad24e
Add missing javadoc exception in 'findObject'
doulikecookiedough Sep 3, 2024
1ad97c7
Revise 'unTagObject' to check that cid retrieved equals to the cid fr…
doulikecookiedough Sep 4, 2024
bca9f6c
Revise 'unTagObject' OrphanRefsFileException scenario to check cid be…
doulikecookiedough Sep 4, 2024
db0333a
Add additional guard rails for when retrieving/reading cid values, an…
doulikecookiedough Sep 4, 2024
44ff550
Add missing guard rail in 'unTagObjet' PidRefsFileNotFoundException f…
doulikecookiedough Sep 4, 2024
cd119f5
Improve exception messaging in 'unTagObject'
doulikecookiedough Sep 4, 2024
6457087
Revise exception type in 'unTagObject' when cid doesn't match, add to…
doulikecookiedough Sep 5, 2024
f772797
Update and add a new junit for revised exceptions
doulikecookiedough Sep 5, 2024
5a53f98
Refactor 'unTagObject' by extracting method 'addAndRenamePidRefsFileT…
doulikecookiedough Sep 5, 2024
fe772b5
Refactor 'unTagObject' by extracting method 'deleteListOfFilesRenamed…
doulikecookiedough Sep 5, 2024
8264ed6
Refactor 'unTagObject' by extracting method 'removePidFromCidRefsAndD…
doulikecookiedough Sep 5, 2024
919f065
Refactor 'unTagObject' by extracting method 'validateCidAndCheckLocked'
doulikecookiedough Sep 5, 2024
fb9a072
Refactor 'unTagObject' to always confirm cid before proceeding and re…
doulikecookiedough Sep 5, 2024
c2be8e8
Refactor 'unTagObject' further by extracting relevant code to 'remove…
doulikecookiedough Sep 5, 2024
93df442
Rename 'removePidFromCidRefsAndDetermineDeletion' method to 'removePi…
doulikecookiedough Sep 5, 2024
a07b5b3
Rename 'deleteListOfFilesRenamedForDeletion' method to 'deleteMarkedF…
doulikecookiedough Sep 5, 2024
d1e280f
Rename 'addAndRenamePidRefsFileToDeleteList' method to 'markPidRefsFi…
doulikecookiedough Sep 5, 2024
9406648
Rename 'validateCidAndCheckLocked' method to 'validateAndCheckCidLock'
doulikecookiedough Sep 5, 2024
28cc6a5
Change warning log levels to error level for 'unTagObject' related me…
doulikecookiedough Sep 5, 2024
eea90de
Further revise logging levels for 'unTagObject'
doulikecookiedough Sep 5, 2024
4d343cb
Revise inaccurate variable name
doulikecookiedough Sep 5, 2024
18df348
Merge pull request #103 from DataONEorg/bug-97-tagobject-orphan
doulikecookiedough Sep 5, 2024
d2762ca
Update 'pom.xml' hashstore-java version to 1.1.0
doulikecookiedough Nov 7, 2024
c938a9b
Refactor 'generateTmpFile' in 'FileHashStoreUtility' to set 'rw-r----…
doulikecookiedough Nov 7, 2024
9432cc1
Add new junit test for 'storeObject' to confirm that file permissions…
doulikecookiedough Nov 7, 2024
6b71e62
Rename junit test to match method being tested
doulikecookiedough Nov 7, 2024
a1b7f53
Revise new junit tests for tmpFile permissions to be more thorough (c…
doulikecookiedough Nov 7, 2024
73e2d27
Add 'final' to permissions variable in 'generateTmpFile' for clarity
doulikecookiedough Nov 7, 2024
82ed481
Revise javadoc for 'generateTmpFile' and fix minor formatting issue w…
doulikecookiedough Nov 7, 2024
4fc1fce
Merge pull request #109 from DataONEorg/feature-108-tmpfile-permissions
doulikecookiedough Nov 7, 2024
509735d
Revise 'pom.xml' hashstore-java version to '1.1.0-SNAPSHOT'
doulikecookiedough Nov 7, 2024
68c50cb
Revise 'createParentDirectories' method in 'FileHashStoreUtility' to …
doulikecookiedough Nov 13, 2024
024b270
Refactor 'FileHashStore' move method to use 'FileHashStoreUtility.cre…
doulikecookiedough Nov 13, 2024
a71a6bf
Change logging to debug from warn in 'FileHashStore' and 'FileHashSto…
doulikecookiedough Nov 13, 2024
b7fbaa3
Remove unused imports
doulikecookiedough Nov 13, 2024
e8f8f11
Merge pull request #112 from DataONEorg/feature-111-directory-permiss…
doulikecookiedough Nov 13, 2024
0d6bab1
Add human-ness to 'CONTRIBUTING.md'
doulikecookiedough Nov 13, 2024
20a861e
Revise 'README.md' for accuracy and client example
doulikecookiedough Nov 13, 2024
c3f2dc9
Merge pull request #113 from DataONEorg/feature-106-relpep-part1
doulikecookiedough Nov 13, 2024
de06851
Revise 'NonMatchingChecksumException' class to have a 'hexDigests' at…
doulikecookiedough Nov 13, 2024
51a7048
Include hexDigests when 'NonMatchingChecksumException' is thrown in '…
doulikecookiedough Nov 13, 2024
6321475
Add new junit test to confirm hexDigests are included when 'NonMatchi…
doulikecookiedough Nov 13, 2024
1aedf44
Add null check for 'validateTmpObject' method and new junit test
doulikecookiedough Nov 13, 2024
ba90aa4
Add null check for hexDigests in 'storeHardLink' method for 'FileHash…
doulikecookiedough Nov 13, 2024
6d69c68
Merge pull request #115 from DataONEorg/feature-114-nmce-includecheck…
doulikecookiedough Nov 13, 2024
7cad413
Revise junit test for 'NonMatchingCheckException' to also check that …
doulikecookiedough Nov 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,45 @@ and then install or build the package with `mvn install` or `mvn package`, respe

We also maintain a parallel [Python-based version of HashStore](https://github.com/DataONEorg/hashstore).

## HashStore CommandLineTool Usage

```sh

# Step 1: Get HashStore Jar file
$ mvn clean package -Dmaven.test.skip=true

# Get help
$ java -cp ./target/hashstore-1.0-SNAPSHOT.jar org.dataone.hashstore.CommandLineTool -h

# Step 2:
## Create a HashStore (long option)
$ java -cp ./target/hashstore-1.0-SNAPSHOT.jar org.dataone.hashstore.CommandLineTool --createhashstore --storepath=/path/to/store --storedepth=3 --storewidth=2 --storealgo=SHA-256 --storenamespace=http://ns.dataone.org/service/types/v2.0

## Create a HashStore (short option)
$ java -cp ./target/hashstore-1.0-SNAPSHOT.jar org.dataone.hashstore.CommandLineTool -chs -store /path/to/store -dp 3 -wp 2 -ap SHA-256 -nsp http://ns.dataone.org/service/types/v2

# Get the checksum of a data object
$ java -cp ./target/hashstore-1.0-SNAPSHOT.jar org.dataone.hashstore.CommandLineTool -store /path/to/store -getchecksum -pid testpid1 -algo SHA-256

# Store a data object
$ java -cp ./target/hashstore-1.0-SNAPSHOT.jar org.dataone.hashstore.CommandLineTool -store /path/to/store -storeobject -path /path/to/data.ext -pid testpid1

# Store a metadata object
$ java -cp ./target/hashstore-1.0-SNAPSHOT.jar org.dataone.hashstore.CommandLineTool -store /path/to/store -storemetadata -path /path/to/metadata.ext -pid testpid1 -format_id http://ns.dataone.org/service/types/v2

# Retrieve a data object
$ java -cp ./target/hashstore-1.0-SNAPSHOT.jar org.dataone.hashstore.CommandLineTool -store /path/to/store -retrieveobject -pid testpid1

# Retrieve a metadata object
$ java -cp ./target/hashstore-1.0-SNAPSHOT.jar org.dataone.hashstore.CommandLineTool -store /path/to/store -retrievemetadata -pid testpid1 -format_id http://ns.dataone.org/service/types/v2

# Delete a data object
$ java -cp ./target/hashstore-1.0-SNAPSHOT.jar org.dataone.hashstore.CommandLineTool -store /path/to/store -deleteobject -pid testpid1

# Delete a metadata file
$ java -cp ./target/hashstore-1.0-SNAPSHOT.jar org.dataone.hashstore.CommandLineTool -store /path/to/store -deletemetadata -pid testpid1 -format_id http://ns.dataone.org/service/types/v2
```

## License

```txt
Expand Down
112 changes: 94 additions & 18 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
<version>1.0-SNAPSHOT</version>

<name>hashstore</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<url>https://github.com/DataONEorg/hashstore-java</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand All @@ -26,9 +25,20 @@
<version>1.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -39,19 +49,88 @@
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<version>2.12.2</version>
<version>2.15.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.15.2</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.4.3</version>
</dependency>
</dependencies>

<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to
parent pom) -->
<!-- <pluginManagement> -->
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>org.dataone.hashstore.Client</Main-Class>
<Build-Number>${project.version}</Build-Number>
</manifestEntries>
</transformer>
</transformers>
<!--
See https://issues.apache.org/jira/browse/LOG4J2-673
and https://stackoverflow.com/questions/48033792/log4j2-error-statuslogger-unrecognized-conversion-specifier
-->
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>**/Log4j2Plugins.dat</exclude>
</excludes>
</filter>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>default-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- clean lifecycle, see
https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
Expand All @@ -64,17 +143,14 @@
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.0</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<version>3.1.2</version>
<!-- Adjust forkCount to speed up tests if desired -->
<!-- <configuration>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
</configuration> -->
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
Expand All @@ -95,6 +171,6 @@
<version>3.4.2</version>
</plugin>
</plugins>
</pluginManagement>
<!-- </pluginManagement> -->
</build>
</project>
81 changes: 55 additions & 26 deletions src/main/java/org/dataone/hashstore/HashStore.java
doulikecookiedough marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
*/
public interface HashStore {
/**
* The `storeObject` method is responsible for the atomic storage of objects to HashStore
* using a given InputStream and a persistent identifier (pid). Upon successful storage, the
* method returns an 'ObjectInfo' object containing the object's file information, such
* as the id, file size, and hex digest map of algorithms and hex digests/checksums. An
* object is stored once and only once - and `storeObject` also enforces this rule by
* synchronizing multiple calls and rejecting calls to store duplicate objects.
* Atomically stores objects to HashStore using a given InputStream and a persistent
* identifier (pid). Upon successful storage, the method returns an 'ObjectInfo' object
* containing the object's file information, such as the id, file size, and hex digest map
* of algorithms and hex digests/checksums. An object is stored once and only once - and
* `storeObject` also enforces this rule by synchronizing multiple calls and rejecting calls
* to store duplicate objects.
*
* The file's id is determined by calculating the SHA-256 hex digest of the provided pid,
* which is also used as the permanent address of the file. The file's identifier is then
Expand Down Expand Up @@ -60,10 +60,31 @@ ObjectInfo storeObject(
) throws NoSuchAlgorithmException, IOException, PidObjectExistsException, RuntimeException;

/**
* The `storeMetadata` method is responsible for adding/updating metadata (ex. `sysmeta`) to
* the HashStore by using a given InputStream, a persistent identifier (`pid`) and metadata
* format (`formatId`). The permanent address of the stored metadata document is determined
* by calculating the SHA-256 hex digest of the provided `pid` + `formatId`.
* @see #storeObject(InputStream, String, String, String, String, long)
*/
ObjectInfo storeObject(
InputStream object, String pid, String checksum, String checksumAlgorithm
) throws NoSuchAlgorithmException, IOException, PidObjectExistsException, RuntimeException;

/**
* @see #storeObject(InputStream, String, String, String, String, long)
*/
ObjectInfo storeObject(InputStream object, String pid, String additionalAlgorithm)
throws NoSuchAlgorithmException, IOException, PidObjectExistsException,
RuntimeException;

/**
* @see #storeObject(InputStream, String, String, String, String, long)
*/
ObjectInfo storeObject(InputStream object, String pid, long objSize)
throws NoSuchAlgorithmException, IOException, PidObjectExistsException,
RuntimeException;

/**
* Adds/updates metadata (ex. `sysmeta`) to the HashStore by using a given InputStream, a
* persistent identifier (`pid`) and metadata format (`formatId`). The permanent address of
* the stored metadata document is determined by calculating the SHA-256 hex digest of the
* provided `pid` + `formatId`.
*
* Note, multiple calls to store the same metadata content will all be accepted, but is not
* guaranteed to execute sequentially.
Expand All @@ -85,8 +106,14 @@ String storeMetadata(InputStream metadata, String pid, String formatId) throws I
NoSuchAlgorithmException;

/**
* The `retrieveObject` method retrieves an object from HashStore using a given persistent
* identifier (pid).
* @see #storeMetadata(InputStream, String, String)
*/
String storeMetadata(InputStream metadata, String pid) throws IOException,
doulikecookiedough marked this conversation as resolved.
Show resolved Hide resolved
IllegalArgumentException, FileNotFoundException, InterruptedException,
NoSuchAlgorithmException;

/**
* Returns an InputStream to an object from HashStore using a given persistent identifier.
*
* @param pid Authority-based identifier
* @return Object InputStream
Expand All @@ -100,8 +127,8 @@ InputStream retrieveObject(String pid) throws IllegalArgumentException,
FileNotFoundException, IOException, NoSuchAlgorithmException;

/**
* The 'retrieveMetadata' method retrieves the metadata content of a given pid and metadata
* namespace from HashStore.
* Returns an InputStream to the metadata content of a given pid and metadata namespace from
* HashStore.
*
* @param pid Authority-based identifier
* @param formatId Metadata namespace/format
Expand All @@ -112,40 +139,41 @@ InputStream retrieveObject(String pid) throws IllegalArgumentException,
* @throws NoSuchAlgorithmException When algorithm used to calculate metadata address is not
* supported
*/
InputStream retrieveMetadata(String pid, String formatId) throws Exception;
InputStream retrieveMetadata(String pid, String formatId) throws IllegalArgumentException,
FileNotFoundException, IOException, NoSuchAlgorithmException;

/**
* The 'deleteObject' method deletes an object (and its empty subdirectories) permanently
* from HashStore using a given persistent identifier.
* Deletes an object (and its empty subdirectories) permanently from HashStore using a given
* persistent identifier.
*
* @param pid Authority-based identifier
* @return True if successful
* @throws IllegalArgumentException When pid is null or empty
* @throws FileNotFoundException When requested pid has no associated object
* @throws IOException I/O error when deleting empty directories
* @throws NoSuchAlgorithmException When algorithm used to calculate object address is not
* supported
*/
void deleteObject(String pid) throws Exception;
void deleteObject(String pid) throws IllegalArgumentException, FileNotFoundException,
IOException, NoSuchAlgorithmException;

/**
* The 'deleteMetadata' method deletes a metadata document (ex. `sysmeta`) permanently from
* HashStore using a given persistent identifier and its respective metadata namespace.
* Deletes a metadata document (ex. `sysmeta`) permanently from HashStore using a given
* persistent identifier and its respective metadata namespace.
*
* @param pid Authority-based identifier
* @param formatId Metadata namespace/format
* @return True if successfulÏ
* @throws IllegalArgumentException When pid or formatId is null or empty
* @throws FileNotFoundException When requested pid has no metadata
* @throws IOException I/O error when deleting empty directories
* @throws NoSuchAlgorithmException When algorithm used to calculate object address is not
* supported
*/
void deleteMetadata(String pid, String formatId) throws Exception;
void deleteMetadata(String pid, String formatId) throws IllegalArgumentException,
FileNotFoundException, IOException, NoSuchAlgorithmException;

/**
* The 'getHexDigest' method calculates the hex digest of an object that exists in HashStore
* using a given persistent identifier and hash algorithm.
* Calculates the hex digest of an object that exists in HashStore using a given persistent
* identifier and hash algorithm.
*
* @param pid Authority-based identifier
* @param algorithm Algorithm of desired hex digest
Expand All @@ -156,5 +184,6 @@ InputStream retrieveObject(String pid) throws IllegalArgumentException,
* @throws NoSuchAlgorithmException When algorithm used to calculate object address is not
* supported
*/
String getHexDigest(String pid, String algorithm) throws Exception;
String getHexDigest(String pid, String algorithm) throws IllegalArgumentException,
FileNotFoundException, IOException, NoSuchAlgorithmException;
}
Loading