-
Notifications
You must be signed in to change notification settings - Fork 16
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
Rewrite LocalFileSystem storage plugin WAS Replace FileCopy with new class using Java nio2 libraries (RSS022-23) #372
Comments
I was about to send an email but that's probably better to put it here. I've been looking at the DataVault code and I'm confused: Also I manage to get the app running on the vagrant but is there a way to login for testing? |
Hi William, FileCopy is a modified version of the Apache Commons IO code to allow the progress of the file copies (e.g. bytes, files and directories) to be reported. Here's the original commit that added the code: Essentially there's a "Progress" object that is used to periodically send events back to the broker via the message queue about how the file copy is progressing. The actual mechanism of copying the files is unchanged from the Apache implementation (so that's what I think you'll need to look at). There are some default usernames in the database for testing e.g. "user1" / "password1" which you can try. For a real implementation the user authentication is expected to come from web server pre-authentication (e.g. Shibboleth or CAS). |
I have made the changes to use java.nio.file.Files.copy(Path source, Path target, CopyOption... options) but it still copy a file instead of a link. I think the reason is that the gov.loc.repository.bagit.impl.PreBagImpl.makeBagInPlace(...) is also using the org.apache.commons.io.FileUtils to copy the files ( see source) So, the bagit object will also have to be updated to use the nio2 function. |
I've created a new class to replace the |
I'm fixing it step by step and just found out that |
This is just a commit of my progress with the issue to share changes made to the bagit library.
The current LocalFileSystem plugin doesn't preserve Unix links (symbolic and hard). It uses a modified version of Apache FileUtils called FileCopy which should be replaced with the Java nio2 libraries...
https://docs.oracle.com/javase/tutorial/essential/io/copy.html.
Note that the reason there is a bespoke version of FileUtils is that it was changed to incorporate progress monitoring in the form of the Progress object. This will also need to be included in the new replacement class.
The text was updated successfully, but these errors were encountered: