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

Iqss/6489 - Direct uploads to S3 using presigned URLs #6490

Merged
merged 164 commits into from
Mar 23, 2020
Merged
Show file tree
Hide file tree
Changes from 140 commits
Commits
Show all changes
164 commits
Select commit Hold shift + click to select a range
34a2453
typos, fix for empty string
qqmyers Oct 16, 2018
e353ccc
use String return value
qqmyers Oct 16, 2018
7a0f302
filter custom roles
qqmyers Oct 16, 2018
2910168
Don't open input stream when not needed.
qqmyers Nov 12, 2018
7ed30fb
simplify
qqmyers Nov 13, 2018
08a0e7e
add @Override
qqmyers Nov 13, 2018
e5fed4a
override getReadChannel as well
qqmyers Nov 13, 2018
7070e26
Merge tag 'v4.10' into v4.10-tdl
qqmyers Dec 21, 2018
6ea2524
TDL image and release name changes
qqmyers Dec 21, 2018
d7571ac
text changes
qqmyers Dec 21, 2018
7998929
TDRDV-46
qqmyers Dec 26, 2018
247dd32
TDRDV-46
qqmyers Dec 27, 2018
2ddfd84
Merge tag 'v4.16' into v4.16-tdl
qqmyers Sep 26, 2019
1f8b528
TDL custom strings
qqmyers Sep 26, 2019
19ebd02
new fav icons for TDL
qqmyers Oct 3, 2019
4e1327a
more TDL icons
qqmyers Oct 3, 2019
51739f6
Merge pull request #6254 from IQSS/develop
kcondon Oct 3, 2019
c64481f
Merge tag 'v4.17' into v4.17-tdl
qqmyers Oct 10, 2019
18c7f31
Merge tag 'v4.17' into v4.17-tdl
qqmyers Oct 18, 2019
07e6a0a
#6137 make DataCite API URL for MDC configurable
Oct 9, 2019
feac172
doc/install updates for #6137
Oct 9, 2019
3404453
cut/paste issue
Oct 10, 2019
47f2ffe
two commas
qqmyers Oct 21, 2019
a6e657c
add note in admin guide
qqmyers Oct 21, 2019
59519df
consistent naming for jvm option
qqmyers Oct 22, 2019
4c1a2e2
add logging of MDC citation get URL and tweak docs #6137
pdurbin Oct 22, 2019
e1d953c
separate MDC logging and display
Oct 3, 2019
ad784d7
Doc updates for :DisplayMDCMetrics
Oct 3, 2019
29c9bac
use SettingsWrapper per comments
Oct 4, 2019
bdaa0cc
closed ) in docs
djbrooke Oct 4, 2019
110cd1c
remove blank line per comment
qqmyers Oct 7, 2019
c7504b1
Merge branch 'develop' of
qqmyers Oct 24, 2019
f8dada8
Revert "add logging of MDC citation get URL and tweak docs #6137"
qqmyers Oct 24, 2019
5fff437
Revert "consistent naming for jvm option"
qqmyers Oct 24, 2019
77b99f3
Revert "add note in admin guide"
qqmyers Oct 24, 2019
750ed11
Revert "two commas"
qqmyers Oct 24, 2019
88a90fb
Revert "cut/paste issue"
qqmyers Oct 24, 2019
92e5160
Revert "doc/install updates for #6137"
qqmyers Oct 24, 2019
ebff193
Revert "#6137 make DataCite API URL for MDC configurable"
qqmyers Oct 24, 2019
d774717
version update to add -dev
qqmyers Oct 24, 2019
a6600fe
initial presigned upload uri api
qqmyers Oct 24, 2019
ef9190f
adding transfer of file name, mimetype and md5 hash
qqmyers Oct 25, 2019
bc96ef7
update plugin version
qqmyers Oct 25, 2019
95aeea0
using profiles to get correct compile flags
qqmyers Oct 28, 2019
6e0c28e
Merge branch 'v4.17-tdl' of
qqmyers Oct 28, 2019
99c8b25
Merge branch 'develop' of https://github.com/TexasDigitalLibrary/data…
qqmyers Oct 28, 2019
bf504ab
Merge branch 'v4.17-tdl' into develop
qqmyers Oct 28, 2019
bddccd7
add nulls for missing params recently added
qqmyers Oct 28, 2019
b465234
fix logic, adjust indent
qqmyers Oct 30, 2019
4095466
bugfix, pickup bucket from properties
qqmyers Nov 14, 2019
118aa71
Merge pull request #6369 from IQSS/develop
kcondon Nov 14, 2019
a91d370
Merge pull request #6390 from IQSS/develop
kcondon Nov 20, 2019
024e4c8
Merge tag 'v4.18.1' into v4.18.1-tdl
qqmyers Nov 26, 2019
606326f
Merge remote-tracking branch 'IQSS/develop' into IQSS/6138
qqmyers Nov 20, 2019
84297e5
use newer poi
qqmyers Nov 23, 2019
0bd7e22
Merge pull request #6394 from QualitativeDataRepository/IQSS/6389
kcondon Nov 25, 2019
76242e9
Merge pull request #6414 from QualitativeDataRepository/IQSS/6411
kcondon Nov 25, 2019
1ccec27
Handle expired or multiple tokens per user
qqmyers Nov 26, 2019
0b8b2a8
missing keys
qqmyers Dec 4, 2019
08f6849
multistore implementation (built on direct upload)
qqmyers Dec 4, 2019
2d104f6
enforce permissions on upload url
qqmyers Dec 5, 2019
83dcec4
enforce permissions on upload url
qqmyers Dec 5, 2019
5eb7fa8
missing keys
qqmyers Dec 4, 2019
c393181
error msg fix
qqmyers Dec 5, 2019
6c2e220
check if store allows direct upload
qqmyers Dec 5, 2019
08ad964
capture file list in js
qqmyers Dec 5, 2019
43f78ce
toggle auto upload based on directupload property
qqmyers Dec 6, 2019
14e43bd
implement proxying
qqmyers Dec 9, 2019
9c01f28
implement proxy
qqmyers Dec 9, 2019
0fe9918
further updates to direct upload files
qqmyers Dec 9, 2019
518e2d2
add driver to upload url response
qqmyers Dec 13, 2019
076c75a
fix proxy url replacement
qqmyers Dec 13, 2019
2f7102d
single file, no hash upload via GUI minimally working
qqmyers Jan 2, 2020
d8de35f
send ID without dataset path
qqmyers Jan 2, 2020
c1db7a5
add md5
qqmyers Jan 2, 2020
707709f
bug: switch to calling uploadFinished at oncomplete
qqmyers Jan 2, 2020
25c1739
fix exist test for direct access
qqmyers Jan 2, 2020
dd1cca0
debug constraint violations
qqmyers Jan 2, 2020
a02980b
typo, clear file list after upload complete
qqmyers Jan 2, 2020
cafcfee
use new method
qqmyers Jan 2, 2020
8859e1d
catch empty contentType not just null
qqmyers Jan 2, 2020
25da677
List any constraint violations
qqmyers Jan 2, 2020
e07b2df
try adding multifile support, fix repeat uploads
qqmyers Jan 2, 2020
407ed1c
just pop for multifile
qqmyers Jan 2, 2020
36e409f
control store via dataverse.storagedriver param
qqmyers Jan 3, 2020
0911571
fix temporary(which is also final) file delete for direct upload
qqmyers Jan 6, 2020
150d52e
progress bar styling
qqmyers Jan 6, 2020
92dbb2e
remove drag/drop message once file(s) are selected in direct upload
qqmyers Jan 6, 2020
216a7de
bugfix apply styles to progress element to make it appear
qqmyers Jan 6, 2020
6f56da2
bugfix for failing s3 delete
qqmyers Jan 6, 2020
1895611
bugfix - temporarily set datafile owner for location calculation
qqmyers Jan 6, 2020
ca6b4d4
bugfix: use direct storage for delete
qqmyers Jan 6, 2020
db1d985
Merge branch 'multistore' into develop
qqmyers Jan 7, 2020
ff1488e
Merge remote-tracking branch 'IQSS/develop' into develop
qqmyers Jan 7, 2020
a7829c5
Merge branch 'IQSS/6485' into develop
qqmyers Jan 7, 2020
e68c23f
Merge remote-tracking branch 'IQSS/develop' into develop
qqmyers Jan 7, 2020
5d4ce21
cleanup
qqmyers Jan 7, 2020
d72bf84
remove tdl customizations
qqmyers Jan 7, 2020
b9eb0c3
docs
qqmyers Jan 7, 2020
f6af668
pom version
qqmyers Jan 7, 2020
86d7ee6
add tabular and fits metadata processing to direct uploads
qqmyers Jan 8, 2020
b373a72
docs update
qqmyers Jan 8, 2020
93de5ce
fix tests
qqmyers Jan 8, 2020
0cda1d0
test fixes
qqmyers Jan 8, 2020
14c7134
define 'file' store type for default test
qqmyers Jan 8, 2020
d41b27b
broken logic for normal upload
qqmyers Jan 8, 2020
588dec8
fix create mode
qqmyers Jan 30, 2020
06f305d
Merge remote-tracking branch 'IQSS/develop' into IQSS/6489
qqmyers Jan 30, 2020
9812ebc
Merge branch 'IQSS/6485' into IQSS/6489
qqmyers Jan 31, 2020
0125133
Merge branch 'IQSS/6485' into IQSS/6489
qqmyers Feb 5, 2020
3e3f82b
Merge branch 'IQSS/6485' into IQSS/6489
qqmyers Feb 7, 2020
f5d63da
Merge branch 'IQSS/6485' into IQSS/6489
qqmyers Feb 8, 2020
60c7789
Merge branch 'IQSS/6485' into IQSS/6489
qqmyers Feb 11, 2020
d4f84cb
Merge branch 'IQSS/6485' into IQSS/6489
qqmyers Feb 19, 2020
4b0528b
fix merge issue
qqmyers Feb 20, 2020
019862b
direct upload release notes
qqmyers Feb 20, 2020
ddfeb3e
Disallow 'placeholder' storageIO ~clones
qqmyers Feb 21, 2020
de4c5d0
bug fix for exporting
qqmyers Feb 21, 2020
2e5009c
typo
djbrooke Feb 24, 2020
93d325f
Merge remote-tracking branch 'IQSS/develop' into IQSS/6489
qqmyers Feb 26, 2020
e92cf2a
Merge remote-tracking branch 'origin/IQSS/6489' into IQSS/6489
qqmyers Feb 26, 2020
e6aee06
get the effective storage driver
qqmyers Feb 26, 2020
cc3a2fd
Merge remote-tracking branch 'IQSS/develop' into IQSS/6489
qqmyers Feb 26, 2020
447bd27
Merge remote-tracking branch 'IQSS/develop' into IQSS/6489
qqmyers Feb 27, 2020
91f4275
don't wrap file
qqmyers Mar 2, 2020
0052eef
give default selection a value
qqmyers Mar 3, 2020
48d176e
typo
qqmyers Mar 3, 2020
94abdda
use non-null indicator for default
qqmyers Mar 3, 2020
17936da
using S3 tag for temp files
qqmyers Mar 3, 2020
34c8ee2
ignore tag issues on Minio
qqmyers Mar 3, 2020
5c721ff
new progress color
qqmyers Mar 3, 2020
2a78a68
remove obsolete storage default string
qqmyers Mar 3, 2020
66a48ee
remove unused methods and tests of them
qqmyers Mar 4, 2020
560c973
make max file size limit per store
qqmyers Mar 4, 2020
84f57a3
get max file size after dataset is initialized
qqmyers Mar 4, 2020
500094f
remove systemconfig default methods
qqmyers Mar 4, 2020
e7d8d60
Merge remote-tracking branch 'IQSS/develop' into IQSS/6489
qqmyers Mar 4, 2020
9113612
restore test fix
qqmyers Mar 4, 2020
d3c2539
document per store file upload size limits
qqmyers Mar 4, 2020
abbebd8
doc of new features
qqmyers Mar 4, 2020
5cd8744
avoid resetting mimetype for normal upload
qqmyers Mar 5, 2020
d600593
Update 6489-release-notes.md
kcondon Mar 6, 2020
0f4b5f0
Update 6489-release-notes.md
kcondon Mar 6, 2020
e235d8c
initialize storageDriver to null
qqmyers Mar 6, 2020
a8c8e00
set alreadyExists(DVObject) false to allow direct upload
qqmyers Mar 6, 2020
a5dbdf2
Merge remote-tracking branch 'IQSS/develop' into IQSS/6489
qqmyers Mar 6, 2020
aca7fa5
Merge remote-tracking branch 'origin/IQSS/6489' into IQSS/6489
qqmyers Mar 6, 2020
5584adc
remove debug logging
qqmyers Mar 6, 2020
00c62d2
retry to give S3 time to 'index' new objects
qqmyers Mar 12, 2020
2d28a71
cors configuration example
landreev Mar 13, 2020
ab4f6c9
fix duplicate id issue with direct upload
qqmyers Mar 13, 2020
187797f
Merge remote-tracking branch 'origin/IQSS/6489' into IQSS/6489
qqmyers Mar 13, 2020
55abdab
Merge remote-tracking branch 'IQSS/develop' into IQSS/6489
qqmyers Mar 13, 2020
b1221c1
update script with version changes (per discussion)
qqmyers Mar 18, 2020
be03ead
limit parallel requests (to 4 at the moment)
qqmyers Mar 18, 2020
c2cf275
handle progress bars, avoid calling AllUploadsFinished more than once
qqmyers Mar 19, 2020
df5ec27
Add support for drag and drop
qqmyers Mar 19, 2020
f358295
cut/paste error and adding an error handler
qqmyers Mar 20, 2020
3226d43
more error handling
qqmyers Mar 20, 2020
9668c5f
increasing retries and adding logging for testing
qqmyers Mar 20, 2020
21f7361
add error handling and pre/post S3 logging
qqmyers Mar 20, 2020
a15b83d
tighten up on async issues
qqmyers Mar 20, 2020
3a9e811
remove debug log message
qqmyers Mar 20, 2020
29ac854
only warn if a retry occurred
qqmyers Mar 23, 2020
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
4 changes: 0 additions & 4 deletions doc/release-notes/6485-multiple-stores.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,4 @@ Any additional S3 options you have set will need to be replaced as well, followi

Once these options are set, restarting the glassfish service is all that is needed to complete the change.

<<<<<<< HEAD
Note that the "\-Ddataverse.files.directory", if defined, continues to control where temporary files are stored (in the /temp subdir of that directory), independent of the location of any 'file' store defined above.
=======
Note that the "\-Ddataverse.files.directory", if defined, continues to control where temporary files are stored (in the /temp subdir of that directory), independent of the location of any 'file' store defined above.
>>>>>>> branch 'IQSS/6485' of https://github.com/TexasDigitalLibrary/dataverse.git
17 changes: 17 additions & 0 deletions doc/release-notes/6489-release-notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# S3 Direct Upload support

S3 stores can now optionally be configured to support direct upload of files, as one option for supporting upload of larger files.

General information about this capability can be found in the <a href="http://guides.dataverse.org/en/latest/developers/big-data-support.html">Big Data Support Guide</a> with specific information about how to enable it in the <a href="http://guides.dataverse.org/en/latest/installation/config.html">Configuration Guide</a> - File Storage section.

**Upgrade Information:**

Direct upload to S3 is enabled per store by one new jvm option:

./asadmin create-jvm-options "\-Ddataverse.files.<id>.upload-redirect=true"

The existing :MaxFileUploadSizeInBytes property and dataverse.files.<id>.url-expiration-minutes jvm option for the same store also apply to direct upload.

Direct upload via the Dataverse web interface is transparent to the user and handled automatically by the browser. Some minor differences in file upload exist: directly uploaded files are not unzipped and Dataverse does not scan their content to help in assigning a MIME type. Ingest of tabular files and metadata extraction from FITS files will occur, but can be turned off for files above a specified size limit through the new dataverse.files.<id>.ingestsizelimit jvm option.

API calls to support direct upload also exist, and, if direct upload is enabled for a store in Dataverse, the latest DVUploader (v1.0.8) provides a'-directupload' flag that enables its use.
28 changes: 27 additions & 1 deletion doc/sphinx-guides/source/developers/big-data-support.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,33 @@ Big data support is highly experimental. Eventually this content will move to th
.. contents:: |toctitle|
:local:

Various components need to be installed and configured for big data support.
Various components need to be installed and/or configured for big data support.

S3 Direct Upload and Download
-----------------------------

A lightweight option for supporting file sizes beyond a few gigabytes - a size that can cause performance issues when uploaded through the Dataverse server itself - is to configure an S3 store to provide direct upload and download via 'pre-signed URLs'. When these options are configured, file uploads and downloads are made directly to and from a configured S3 store using secure (https) connections that enforce Dataverse's access controls. (The upload and download URLs are signed with a unique key that only allows access for a short time period and Dataverse will only generate such a URL if the user has permission to upload/download the specific file in question.)

This option can handle files >40GB and could be appropriate for files up to a TB. Other options can scale farther, but this option has the advantages that it is simple to configure and does not require any user training - uploads and downloads are done via the same interface as normal uploads to Dataverse.

To configure these options, an administrator must set two JVM options for the Dataverse server using the same process as for other configuration options:

``./asadmin create-jvm-options "-Ddataverse.files.<id>.download-redirect=true"``
``./asadmin create-jvm-options "-Ddataverse.files.<id>.upload-redirect=true"``


With multiple stores configured, it is possible to configure one S3 store with direct upload and/or download to support large files (in general or for specific dataverses) while configuring only direct download, or no direct access for another store.

It is also possible to set file upload size limits per store. See the :MaxFileUploadSizeInBytes setting described in the :doc:`/installation/config` guide.

At present, one potential drawback for direct-upload is that files are only partially 'ingested', tabular and FITS files are processed, but zip files are not unzipped, and the file contents are not inspected to evaluate their mimetype. This could be appropriate for large files, or it may be useful to completely turn off ingest processing for performance reasons (ingest processing requires a copy of the file to be retrieved by Dataverse from the S3 store). A store using direct upload can be configured to disable all ingest processing for files above a given size limit:

``./asadmin create-jvm-options "-Ddataverse.files.<id>.ingestsizelimit=<size in bytes>"``


One additional step that is required to enable direct download to work with previewers is to allow cross site (CORS) requests on your S3 store.

Since the direct upload mechanism creates the final file rather than an intermediate temporary file, user actions, such as neither saving or canceling an upload session before closing the browser page, can leave an abandoned file in the store. The direct upload mechanism attempts to use S3 Tags to aid in identifying/removing such files. Upon upload, files are given a "dv-status":"temp" tag which is removed when the dataset changes are saved and the new file(s) are added in Dataverse. Note that not all S3 implementations support Tags: Minio does not. WIth such stores, direct upload works, but Tags are not used.

Data Capture Module (DCM)
-------------------------
Expand Down
17 changes: 14 additions & 3 deletions doc/sphinx-guides/source/installation/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ If you wish to change which store is used by default, you'll need to delete the

./asadmin $ASADMIN_OPTS delete-jvm-options "-Ddataverse.files.storage-driver-id=file"
./asadmin $ASADMIN_OPTS create-jvm-options "-Ddataverse.files.storage-driver-id=<id>"

It is also possible to set maximum file upload size limits per store. See the :ref:`:MaxFileUploadSizeInBytes` setting below.

File Storage
++++++++++++
Expand Down Expand Up @@ -505,7 +507,9 @@ JVM Option Value Description
dataverse.files.storage-driver-id <id> Enable <id> as the default storage driver. ``file``
dataverse.files.<id>.bucket-name <?> The bucket name. See above. (none)
dataverse.files.<id>.download-redirect ``true``/``false`` Enable direct download or proxy through Dataverse. ``false``
dataverse.files.<id>.url-expiration-minutes <?> If direct downloads: time until links expire. Optional. 60
dataverse.files.<id>.upload-redirect ``true``/``false`` Enable direct upload of files added to a dataset to the S3 store. ``false``
dataverse.files.<id>.ingestsizelimit <size in bytes> Maximum size of directupload files that should be ingested (none)
dataverse.files.<id>.url-expiration-minutes <?> If direct uploads/downloads: time until links expire. Optional. 60
dataverse.files.<id>.custom-endpoint-url <?> Use custom S3 endpoint. Needs URL either with or without protocol. (none)
dataverse.files.<id>.custom-endpoint-region <?> Only used when using custom endpoint. Optional. ``dataverse``
dataverse.files.<id>.path-style-access ``true``/``false`` Use path style buckets instead of subdomains. Optional. ``false``
Expand Down Expand Up @@ -1474,7 +1478,14 @@ Alongside the ``:StatusMessageHeader`` you need to add StatusMessageText for the
:MaxFileUploadSizeInBytes
+++++++++++++++++++++++++

Set `MaxFileUploadSizeInBytes` to "2147483648", for example, to limit the size of files uploaded to 2 GB.
This setting controls the maximum size of uploaded files.
- To have one limit for all stores, set `MaxFileUploadSizeInBytes` to "2147483648", for example, to limit the size of files uploaded to 2 GB:

``curl -X PUT -d 2147483648 http://localhost:8080/api/admin/settings/:MaxFileUploadSizeInBytes``

- To have limits per store with an optional default, use a serialized json object for the value of `MaxFileUploadSizeInBytes` with an entry per store, as in the following example, which maintains a 2 GB default and adds higher limits for stores with ids "fileOne" and "s3".

``curl -X PUT -d '{"default":"2147483648","fileOne":"4000000000","s3":"8000000000"}' http://localhost:8080/api/admin/settings/:MaxFileUploadSizeInBytes``

Notes:

Expand All @@ -1484,7 +1495,7 @@ Notes:

- For larger file upload sizes, you may need to configure your reverse proxy timeout. If using apache2 (httpd) with Shibboleth, add a timeout to the ProxyPass defined in etc/httpd/conf.d/ssl.conf (which is described in the :doc:`/installation/shibboleth` setup).

``curl -X PUT -d 2147483648 http://localhost:8080/api/admin/settings/:MaxFileUploadSizeInBytes``


:ZipDownloadLimit
+++++++++++++++++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1565,7 +1565,6 @@ public void finalizeFileDelete(Long dataFileId, String storageLocation) throws I
throw new IOException("Attempted to permanently delete a physical file still associated with an existing DvObject "
+ "(id: " + dataFileId + ", location: " + storageLocation);
}
logger.info("deleting: " + storageLocation);
StorageIO<DvObject> directStorageAccess = DataAccess.getDirectStorageIO(storageLocation);
directStorageAccess.delete();
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -1774,7 +1774,6 @@ public void updateOwnerDataverse() {
private String init(boolean initFull) {

//System.out.println("_YE_OLDE_QUERY_COUNTER_"); // for debug purposes
this.maxFileUploadSizeInBytes = systemConfig.getMaxFileUploadSize();
setDataverseSiteUrl(systemConfig.getDataverseSiteUrl());

guestbookResponse = new GuestbookResponse();
Expand Down Expand Up @@ -1821,7 +1820,9 @@ private String init(boolean initFull) {
// Set Working Version and Dataset by DatasaetVersion Id
//retrieveDatasetVersionResponse = datasetVersionService.retrieveDatasetVersionByVersionId(versionId);

}
}
this.maxFileUploadSizeInBytes = systemConfig.getMaxFileUploadSizeForStore(dataset.getOwner().getEffectiveStorageDriverId());


if (retrieveDatasetVersionResponse == null) {
return permissionsWrapper.notFound();
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/edu/harvard/iq/dataverse/Dataverse.java
Original file line number Diff line number Diff line change
Expand Up @@ -774,10 +774,17 @@ public String getEffectiveStorageDriverId() {


public String getStorageDriverId() {
if(storageDriver==null) {
return DataAccess.UNDEFINED_STORAGE_DRIVER_IDENTIFIER;
}
return storageDriver;
}

public void setStorageDriverId(String storageDriver) {
this.storageDriver = storageDriver;
if(storageDriver!=null&&storageDriver.equals(DataAccess.UNDEFINED_STORAGE_DRIVER_IDENTIFIER)) {
this.storageDriver=null;
} else {
this.storageDriver = storageDriver;
}
}
}
15 changes: 10 additions & 5 deletions src/main/java/edu/harvard/iq/dataverse/DataversePage.java
Original file line number Diff line number Diff line change
Expand Up @@ -1214,19 +1214,24 @@ public Set<Entry<String, String>> getStorageDriverOptions() {
HashMap<String, String> drivers =new HashMap<String, String>();
drivers.putAll(DataAccess.getStorageDriverLabels());
//Add an entry for the default (inherited from an ancestor or the system default)
drivers.put(getDefaultStorageDriverLabel(), "");
drivers.put(getDefaultStorageDriverLabel(), DataAccess.UNDEFINED_STORAGE_DRIVER_IDENTIFIER);
return drivers.entrySet();
}

public String getDefaultStorageDriverLabel() {
String storageDriverId = DataAccess.DEFAULT_STORAGE_DRIVER_IDENTIFIER;
Dataverse parent = dataverse.getOwner();
boolean fromAncestor=false;
if(parent != null) {
storageDriverId = parent.getEffectiveStorageDriverId();
}
boolean fromAncestor=false;
if(!storageDriverId.equals(DataAccess.DEFAULT_STORAGE_DRIVER_IDENTIFIER)) {
fromAncestor = true;
//recurse dataverse chain to root and if any have a storagedriver set, fromAncestor is true
while(parent!=null) {
if(!parent.getStorageDriverId().equals(DataAccess.UNDEFINED_STORAGE_DRIVER_IDENTIFIER)) {
fromAncestor=true;
break;
}
parent=parent.getOwner();
}
}
String label = DataAccess.getStorageDriverLabelFor(storageDriverId);
if(fromAncestor) {
Expand Down
Loading