-
Notifications
You must be signed in to change notification settings - Fork 22
Issue #1181 doi configuration per community #1370
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
base: clarin-v7
Are you sure you want to change the base?
Changes from 14 commits
a65fc06
04f0d34
b12db6e
6bd2ed6
c723d7f
ab4e5cf
7ad1693
29c49d5
bd5a7d5
1648a9c
732e053
2f3234a
a001cfb
bbd324f
51a4ae8
a7fe6fa
e17bb31
de3af45
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| /** | ||
| * The contents of this file are subject to the license and copyright | ||
| * detailed in the LICENSE and NOTICE files at the root of the source | ||
| * tree and available online at | ||
| * | ||
| * http://www.dspace.org/license/ | ||
| */ | ||
| package org.dspace.identifier; | ||
|
|
||
| import java.util.HashSet; | ||
| import java.util.Set; | ||
|
|
||
| import org.apache.logging.log4j.LogManager; | ||
| import org.apache.logging.log4j.Logger; | ||
| import org.dspace.identifier.doi.ClarinDataCiteConnector; | ||
|
|
||
| /** | ||
| * DOI identifier provider for CLARIN communities. | ||
| * It uses the ClarinDataCiteConnector to connect to DataCite and requires the DOI prefix | ||
| * and the list of CLARIN community IDs to be configured. | ||
| * | ||
| * @author Milan Kuchtiak (kuchtiak@ufal.mff.cuni.cz) | ||
| */ | ||
| public class ClarinCommunityDOIIdentifierProvider extends VersionedDOIIdentifierProvider { | ||
|
|
||
| private static final Logger log = LogManager.getLogger(ClarinCommunityDOIIdentifierProvider.class); | ||
|
|
||
| private String doiPrefix; | ||
|
|
||
| private String namespaceSeparator; | ||
|
|
||
| private Set<String> communities = new HashSet<>(); | ||
|
|
||
| public void init() { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pushing username/password/prefix onto the connector at Since |
||
| if (!(this.connector instanceof ClarinDataCiteConnector)) { | ||
| throw new IllegalStateException("ClarinCommunityDOIIdentifierProvider requires ClarinDataCiteConnector"); | ||
| } | ||
| if (doiPrefix == null) { | ||
| throw new IllegalStateException("No DOI prefix configured for ClarinCommunityDOIIdentifierProvider"); | ||
| } | ||
| if (namespaceSeparator == null) { | ||
| namespaceSeparator = ""; | ||
| } | ||
|
|
||
| ClarinDataCiteConnector dataCiteConnector = (ClarinDataCiteConnector) this.connector; | ||
|
|
||
| dataCiteConnector.setDoiPrefix(doiPrefix); | ||
|
|
||
|
kuchtiak-ufal marked this conversation as resolved.
|
||
| String username = this.configurationService.getProperty("identifier.doi." + doiPrefix + ".user"); | ||
| if (username == null) { | ||
| log.error("No username configured for DOI prefix '{}'", doiPrefix); | ||
| throw new IllegalStateException("No username configured for DOI prefix '" + doiPrefix + "'"); | ||
| } | ||
| dataCiteConnector.setUsername(username); | ||
|
|
||
| String password = this.configurationService.getProperty("identifier.doi." + doiPrefix + ".password"); | ||
| if (password == null) { | ||
| log.error("No password configured for DOI prefix '{}'", doiPrefix); | ||
| throw new IllegalStateException("No password configured for DOI prefix '" + doiPrefix + "'"); | ||
| } | ||
| dataCiteConnector.setPassword(password); | ||
| } | ||
|
|
||
| public void setDoiPrefix(String doiPrefix) { | ||
| this.doiPrefix = doiPrefix; | ||
| } | ||
|
|
||
| public void setNamespaceSeparator(String namespaceSeparator) { | ||
| this.namespaceSeparator = namespaceSeparator; | ||
| } | ||
|
|
||
| public void setCommunities(Set<String> communities) { | ||
| this.communities = communities; | ||
| } | ||
|
|
||
| @Override | ||
| protected String getPrefix() { | ||
| return this.doiPrefix; | ||
| } | ||
|
|
||
| @Override | ||
| protected String getNamespaceSeparator() { | ||
| return this.namespaceSeparator; | ||
| } | ||
|
|
||
| Set<String> getCommunities() { | ||
| return this.communities; | ||
| } | ||
|
|
||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.