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

Skip bothering to register the global identifiers for datafiles... #4948

Merged
merged 3 commits into from
Aug 15, 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
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,29 @@ private void publicizeExternalIdentifier(Dataset dataset, CommandContext ctxt) t
if (idServiceBean != null) {
List<String> args = idServiceBean.getProviderInformation();
try {
//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());
String currentGlobalIdProtocol = ctxt.settings().getValueForKey(SettingsServiceBean.Key.Protocol, "");
String dataFilePIDFormat = ctxt.settings().getValueForKey(SettingsServiceBean.Key.DataFilePIDFormat, "DEPENDENT");
// 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")) {
//A false return value indicates a failure in calling the service
if (!idServiceBean.publicizeIdentifier(df)) throw new Exception();
df.setGlobalIdCreateTime(getTimestamp());
df.setIdentifierRegistered(true);
for (DataFile df : dataset.getFiles()) {
logger.log(Level.FINE, "registering global id for file {0}", df.getId());
//A false return value indicates a failure in calling the service
if (!idServiceBean.publicizeIdentifier(df)) {
throw new Exception();
}
df.setGlobalIdCreateTime(getTimestamp());
df.setIdentifierRegistered(true);
}
}
if (!idServiceBean.publicizeIdentifier(dataset)) {
throw new Exception();
}
if (!idServiceBean.publicizeIdentifier(dataset)) throw new Exception();
dataset.setGlobalIdCreateTime(new Date()); // TODO these two methods should be in the responsibility of the idServiceBean.
dataset.setIdentifierRegistered(true);
} catch (Throwable e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,20 @@ public PublishDatasetResult execute(CommandContext ctxt) throws CommandException
return new PublishDatasetResult(theDataset, false);

} else {
//if there are more than required size files then call Finalize asychronously (default is 10)
if (theDataset.getFiles().size() > ctxt.systemConfig().getPIDAsynchRegFileCount()) {
// 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 we are registering file-level identifiers, and there are more
// than the configured limit number of files, then call Finalize
// asychronously (default is 10)
String currentGlobalIdProtocol = ctxt.settings().getValueForKey(SettingsServiceBean.Key.Protocol, "");
String dataFilePIDFormat = ctxt.settings().getValueForKey(SettingsServiceBean.Key.DataFilePIDFormat, "DEPENDENT");
boolean registerGlobalIdsForFiles = currentGlobalIdProtocol.equals(theDataset.getProtocol()) || dataFilePIDFormat.equals("INDEPENDENT");

if (theDataset.getFiles().size() > ctxt.systemConfig().getPIDAsynchRegFileCount() && registerGlobalIdsForFiles) {
String info = "Adding File PIDs asynchronously";
AuthenticatedUser user = request.getAuthenticatedUser();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,9 @@ Whether Harvesting (OAI) service is enabled
*/
PVCustomPasswordResetAlertMessage,
/*
String to describe DOI format for data files. Default is INDEPENDENT. (That is independent
from the Dataset DOI
If 'DEPENEDENT' then the DOI will be the Dataset DOI plus a file DOI with a slash in between.
String to describe DOI format for data files. Default is DEPENDENT.
'DEPENEDENT' means the DOI will be the Dataset DOI plus a file DOI with a slash in between.
'INDEPENDENT' means a new global id, completely independent from the dataset-level global id.
*/
DataFilePIDFormat,
/*
Expand Down