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

Minting Handles For Datasets #3146

Closed
wants to merge 17 commits into from
Closed
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
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -22,4 +22,6 @@ scripts/api/py_api_wrapper/local-data/*
doc/sphinx-guides/build
faces-config.NavData
src/main/java/BuildNumber.properties
scripts/installer/dvinstall.zip
scripts/installer/dvinstall/
/nbproject/
10 changes: 5 additions & 5 deletions doc/sphinx-guides/source/installation/config.rst
Expand Up @@ -86,9 +86,9 @@ Non-superusers who are not "Admin" on the root dataverse will not be able to to
Persistent Identifiers and Publishing Datasets
++++++++++++++++++++++++++++++++++++++++++++++

Persistent identifiers are a required and integral part of the Dataverse platform. They provide a URL that is guaranteed to resolve to the datasets they represent. Dataverse currently supports creating identifiers using DOI and additionally displaying identifiers created using HDL. By default and for testing convenience, the installer configures a temporary DOI test namespace through EZID. This is sufficient to create and publish datasets but they are not citable nor guaranteed to be preserved. To properly configure persistent identifiers for a production installation, an account and associated namespace must be acquired for a fee from one of two DOI providers: EZID (http://ezid.cdlib.org) or DataCite (https://www.datacite.org). Once account credentials and DOI namespace have been acquired, please complete the following identifier configuration parameters:
Persistent identifiers are a required and integral part of the Dataverse platform. They provide a URL that is guaranteed to resolve to the datasets they represent. Dataverse currently supports creating identifiers using DOI and HDL. By default and for testing convenience, the installer configures a temporary DOI test namespace through EZID. This is sufficient to create and publish datasets but they are not citable nor guaranteed to be preserved. To properly configure persistent identifiers for a production installation, an account and associated namespace must be acquired for a fee from a DOI or HDL provider: EZID (http://ezid.cdlib.org), DataCite (https://www.datacite.org) (https://www.handle.net). Once account credentials and namespace have been acquired, please complete the following identifier configuration parameters:

JVM Options: :ref:`doi.baseurlstring`, :ref:`doi.username`, :ref:`doi.password`
JVM Options: :ref:`doi.baseurlstring`, :ref:`doi.username`, :ref:`doi.password`, :ref:`dataverse.handlenet.admcredfile`, :ref:`dataverse.handlenet.admprivphrase`

Database Settings: :ref:`:DoiProvider <:DoiProvider>`, :ref:`:Protocol <:Protocol>`, :ref:`:Authority <:Authority>`, :ref:`:DoiSeparator <:DoiSeparator>`

Expand Down Expand Up @@ -218,11 +218,11 @@ Used in conjuction with ``doi.baseurlstring``.
dataverse.handlenet.admcredfile
+++++++++++++++++++++++++++++++

For Handle support (not fully developed).
For Handle support, typically the full path to handle/svr_1/admpriv.bin

dataverse.handlenet.admprivphrase
+++++++++++++++++++++++++++++++++
For Handle support (not fully developed).
For Handle support.

Database Settings
-----------------
Expand Down Expand Up @@ -416,7 +416,7 @@ The relative path URL to which users will be sent after signup. The default sett
The location of your TwoRavens installation. Activation of TwoRavens also requires the setting below, ``TwoRavensTabularView``

:TwoRavensTabularView
+++++++++++++++++++++
+++++++++++++++++++

Set ``TwoRavensTabularView`` to true to allow a user to view tabular files via the TwoRavens application. This boolean affects whether a user will see the "Explore" button.

Expand Down
@@ -0,0 +1,112 @@
package edu.harvard.iq.dataverse;

import edu.harvard.iq.dataverse.settings.SettingsServiceBean;
import edu.harvard.iq.dataverse.util.SystemConfig;

import javax.ejb.EJB;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;

public abstract class AbstractPersistentIdRegistrationServiceBean implements PersistentIdRegistrationServiceBean {

private static final Logger logger = Logger.getLogger(AbstractPersistentIdRegistrationServiceBean.class.getCanonicalName());

@EJB
DataverseServiceBean dataverseService;
@EJB
SettingsServiceBean settingsService;
@EJB
SystemConfig systemConfig;

@Override
public String getIdentifierForLookup(String protocol, String authority, String separator, String identifier) {
logger.log(Level.FINE,"getIdentifierForLookup");
return protocol + ":" + authority + separator + identifier;
}

@Override
public HashMap<String, String> getMetadataFromStudyForCreateIndicator(Dataset datasetIn) {
logger.log(Level.FINE,"getMetadataFromStudyForCreateIndicator");
HashMap<String, String> metadata = new HashMap<>();

String authorString = datasetIn.getLatestVersion().getAuthorsStr();

if (authorString.isEmpty()) {
authorString = ":unav";
}

String producerString = dataverseService.findRootDataverse().getName() + " Dataverse";

if (producerString.isEmpty()) {
producerString = ":unav";
}
metadata.put("datacite.creator", authorString);
metadata.put("datacite.title", datasetIn.getLatestVersion().getTitle());
metadata.put("datacite.publisher", producerString);
metadata.put("datacite.publicationyear", generateYear());
metadata.put("_target", getTargetUrl(datasetIn));
return metadata;
}

protected HashMap<String, String> getUpdateMetadataFromDataset(Dataset datasetIn) {
logger.log(Level.FINE,"getUpdateMetadataFromDataset");
HashMap<String, String> metadata = new HashMap<>();

String authorString = datasetIn.getLatestVersion().getAuthorsStr();

if (authorString.isEmpty()) {
authorString = ":unav";
}

String producerString = dataverseService.findRootDataverse().getName() + " Dataverse";

if(producerString.isEmpty()) {
producerString = ":unav";
}
metadata.put("datacite.creator", authorString);
metadata.put("datacite.title", datasetIn.getLatestVersion().getTitle());
metadata.put("datacite.publisher", producerString);

return metadata;
}

@Override
public HashMap<String, String> getMetadataFromDatasetForTargetURL(Dataset datasetIn) {
logger.log(Level.FINE,"getMetadataFromDatasetForTargetURL");
HashMap<String, String> metadata = new HashMap<>();
metadata.put("_target", getTargetUrl(datasetIn));
return metadata;
}

protected String getTargetUrl(Dataset datasetIn) {
logger.log(Level.FINE,"getTargetUrl");
return systemConfig.getDataverseSiteUrl() + Dataset.TARGET_URL + datasetIn.getGlobalId();
}

@Override
public String getIdentifierFromDataset(Dataset dataset) {
logger.log(Level.FINE,"getIdentifierFromDataset");
return dataset.getGlobalId();
}

private String generateYear()
{
StringBuilder guid = new StringBuilder();

// Create a calendar to get the date formatted properly
String[] ids = TimeZone.getAvailableIDs(-8 * 60 * 60 * 1000);
SimpleTimeZone pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids[0]);
pdt.setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
pdt.setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
Calendar calendar = new GregorianCalendar(pdt);
Date trialTime = new Date();
calendar.setTime(trialTime);
guid.append(calendar.get(Calendar.YEAR));

return guid.toString();
}

@Override
public void postDeleteCleanup(final Dataset doomed){}
}