Skip to content

Instantly share code, notes, and snippets.

@mdoering
Last active August 29, 2015 14:11
Show Gist options
  • Save mdoering/a48969081957c13b4d36 to your computer and use it in GitHub Desktop.
Save mdoering/a48969081957c13b4d36 to your computer and use it in GitHub Desktop.
package org.gbif.registry.doi;
import org.gbif.api.model.common.DOI;
import org.gbif.doi.metadata.datacite.DataCiteMetadata;
import java.util.UUID;
/**
* Registry internal service that guarantees to issue unique new DOIs and deals with scheduling
* DOI metadata updates and registration via RabbitMQ.
*/
public interface DoiGenerator {
/**
* Generates a new unique GBIF dataset DOI.
* The new DOI is unknown to DataCite still and only lives in the GBIF registry which guarantees it to be unique.
* @return the new DOI
*/
DOI newDatasetDOI();
/**
* Generates a new unique GBIF download DOI.
* The new DOI is unknown to DataCite still and only lives in the GBIF registry which guarantees it to be unique.
* @return the new DOI
*/
DOI newDownloadDOI();
/**
* Schedules a DOI metadata update with DataCite and registers the DOI if needed.
* For subsequent calls with the same DOI only the metadata in DataCite will be updated.
* If it is called for the very first time the DOI will also be properly registered with DataCite.
*
* @param doi the GBIF DOI to register
* @param metadata the metadata to post to datacite. Mandatory fields are validated immediately
* @param datasetKey the dataset key to derive the target URL from
*
* @throws IllegalArgumentException in case the metadata is missing mandatory fields or the DOI is not a GBIF one
*/
void register(DOI doi, DataCiteMetadata metadata, UUID datasetKey) throws IllegalArgumentException;
/**
* Schedules a DOI metadata update with DataCite and registers the DOI if needed.
* For subsequent calls with the same DOI only the metadata in DataCite will be updated.
* If it is called for the very first time the DOI will also be properly registered with DataCite.
*
* @param doi the GBIF DOI to register
* @param metadata the metadata to post to datacite. Mandatory fields are validated immediately
* @param downloadKey the download key to derive the target URL from
*
* @throws IllegalArgumentException in case the metadata is missing mandatory fields or the DOI is not a GBIF one
*/
void register(DOI doi, DataCiteMetadata metadata, String downloadKey) throws IllegalArgumentException;
}
@timrobertson100
Copy link

Is there any reason not to do this more generically?

DOI newDOI();
void register(DOI doi, DataCiteMetadata metadata, URI target);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment