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

File PID enable & disable documentation #4929 #5007

Merged
merged 2 commits into from
Aug 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions doc/sphinx-guides/source/installation/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,12 @@ Otherwise, if ``:DataFilePIDFormat`` is set to *INDEPENDENT*, then each file wil

Note that in either case, when using the ``sequentialNumber`` option, datasets and files share the same database sequence that was created as part of the setup described in ``:IdentifierGenerationStyle`` above.

:FilePIDsEnabled
++++++++++++++++

Enable/disable the publishing of file based PIDs for the whole installation. This is enabled by default

``curl -X PUT -d 'true' http://localhost:8080/api/admin/settings/:FilePIDsEnabled``

:ApplicationTermsOfUse
++++++++++++++++++++++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,18 @@ private void publicizeExternalIdentifier(Dataset dataset, CommandContext ctxt) t
try {
String currentGlobalIdProtocol = ctxt.settings().getValueForKey(SettingsServiceBean.Key.Protocol, "");
String dataFilePIDFormat = ctxt.settings().getValueForKey(SettingsServiceBean.Key.DataFilePIDFormat, "DEPENDENT");
boolean isFilePIDsEnabled = ctxt.systemConfig().isFilePIDsEnabled();
// We will skip trying to register the global identifiers for datafiles
// if "dependent" file-level identifiers are requested, AND the naming
// protocol of the dataset global id is different from the
// one currently configured for the Dataverse. This is to specifically
// address the issue with the datasets with handle ids registered,
// that are currently configured to use DOI.
if (currentGlobalIdProtocol.equals(protocol) || dataFilePIDFormat.equals("INDEPENDENT")) {//TODO(pm) - check authority too
// ...
// Additionaly in 4.9.3 we have added a system variable to disable
// registering file PIDs on the installation level.
if ((currentGlobalIdProtocol.equals(protocol) || dataFilePIDFormat.equals("INDEPENDENT"))//TODO(pm) - check authority too
&& isFilePIDsEnabled) {
//A false return value indicates a failure in calling the service
for (DataFile df : dataset.getFiles()) {
logger.log(Level.FINE, "registering global id for file {0}", df.getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,18 @@ public PublishDatasetResult execute(CommandContext ctxt) throws CommandException
// If we are registering file-level identifiers, and there are more
// than the configured limit number of files, then call Finalize
// asychronously (default is 10)
// ...
// Additionaly in 4.9.3 we have added a system variable to disable
// registering file PIDs on the installation level.
String currentGlobalIdProtocol = ctxt.settings().getValueForKey(SettingsServiceBean.Key.Protocol, "");
String currentGlobalAuthority= ctxt.settings().getValueForKey(SettingsServiceBean.Key.Authority, "");
String dataFilePIDFormat = ctxt.settings().getValueForKey(SettingsServiceBean.Key.DataFilePIDFormat, "DEPENDENT");
boolean registerGlobalIdsForFiles = currentGlobalIdProtocol.equals(theDataset.getProtocol()) || dataFilePIDFormat.equals("INDEPENDENT"); // note that despite its name, the FinalizeDatasetPublicationComment in the else branch will still try to register, so this logic is duplicated there
if ( registerGlobalIdsForFiles )
{
registerGlobalIdsForFiles = currentGlobalAuthority.equals( theDataset.getAuthority() );
boolean registerGlobalIdsForFiles =
(currentGlobalIdProtocol.equals(theDataset.getProtocol()) || dataFilePIDFormat.equals("INDEPENDENT"))
&& ctxt.systemConfig().isFilePIDsEnabled();

if ( registerGlobalIdsForFiles ){
registerGlobalIdsForFiles = currentGlobalAuthority.equals( theDataset.getAuthority() );
}

if (theDataset.getFiles().size() > ctxt.systemConfig().getPIDAsynchRegFileCount() && registerGlobalIdsForFiles) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,11 @@ Whether Harvesting (OAI) service is enabled
/*
Number for the minimum number of files to send PID registration to asynchronous workflow
*/
PIDAsynchRegFileCount
PIDAsynchRegFileCount,
/**
*
*/
FilePIDsEnabled
;

@Override
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/edu/harvard/iq/dataverse/util/SystemConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -999,4 +999,9 @@ public int getPIDAsynchRegFileCount() {
return retVal;
}

public boolean isFilePIDsEnabled() {
boolean safeDefaultIfKeyNotFound = true;
return settingsService.isTrueForKey(SettingsServiceBean.Key.FilePIDsEnabled, safeDefaultIfKeyNotFound);
}

}