diff --git a/doc/sphinx-guides/source/installation/config.rst b/doc/sphinx-guides/source/installation/config.rst index 94c16e2f81a..92a04959c64 100644 --- a/doc/sphinx-guides/source/installation/config.rst +++ b/doc/sphinx-guides/source/installation/config.rst @@ -165,6 +165,7 @@ Here are the configuration options for handles: - :ref:`:Authority <:Authority>` - :ref:`:IdentifierGenerationStyle <:IdentifierGenerationStyle>` (optional) - :ref:`:DataFilePIDFormat <:DataFilePIDFormat>` (optional) +- :ref:`:IndependentHandleService <:IndependentHandleService>` (optional) Note: If you are **minting your own handles** and plan to set up your own handle service, please refer to `Handle.Net documentation `_. @@ -1088,6 +1089,14 @@ If you don't want to register file-based PIDs for your installation, set: Note: File-level PID registration was added in 4.9 and is required until version 4.9.3. +:IndependentHandleService ++++++++++++++++++++++++++++ + +Specific for Handle PIDs. Set this setting to true if you want to use a Handle service which is setup to work 'independently' (No communication with the Global Handle Registry). +By default this setting is absent and Dataverse assumes it to be false. + +``curl -X PUT -d 'true' http://localhost:8080/api/admin/settings/:IndependentHandleService`` + :ApplicationTermsOfUse ++++++++++++++++++++++ diff --git a/src/main/java/edu/harvard/iq/dataverse/HandlenetServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/HandlenetServiceBean.java index c13a50d1cf9..0549baaf8ae 100644 --- a/src/main/java/edu/harvard/iq/dataverse/HandlenetServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/HandlenetServiceBean.java @@ -95,7 +95,7 @@ public void reRegisterHandle(DvObject dvObject) { logger.log(Level.INFO, "Re-registering an existing handle id {0}", handle); - String authHandle = getHandleAuthority(dvObject); + String authHandle = getAuthenticationHandle(dvObject); HandleResolver resolver = new HandleResolver(); @@ -148,7 +148,7 @@ public Throwable registerNewHandle(DvObject dvObject) { logger.log(Level.INFO, "Creating NEW handle {0}", handle); - String authHandle = getHandleAuthority(dvObject); + String authHandle = getAuthenticationHandle(dvObject); PublicKeyAuthenticationInfo auth = getAuthInfo(handlePrefix); HandleResolver resolver = new HandleResolver(); @@ -233,7 +233,7 @@ private PublicKeyAuthenticationInfo getAuthInfo(String handlePrefix) { key = readKey(adminCredFile); PrivateKey privkey = null; privkey = readPrivKey(key, adminCredFile); - String authHandle = getHandleAuthority(handlePrefix); + String authHandle = getAuthenticationHandle(handlePrefix); PublicKeyAuthenticationInfo auth = new PublicKeyAuthenticationInfo(Util.encodeString(authHandle), handlenetIndex, privkey); return auth; @@ -308,13 +308,17 @@ private String getDvObjectHandle(DvObject dvObject) { return handle; } - private String getHandleAuthority(DvObject dvObject){ - return getHandleAuthority(dvObject.getAuthority()); + private String getAuthenticationHandle(DvObject dvObject){ + return getAuthenticationHandle(dvObject.getAuthority()); } - private String getHandleAuthority(String handlePrefix) { - logger.log(Level.FINE,"getHandleAuthority"); - return "0.NA/" + handlePrefix; + private String getAuthenticationHandle(String handlePrefix) { + logger.log(Level.FINE,"getAuthenticationHandle"); + if (systemConfig.isIndependentHandleService()) { + return handlePrefix + "/ADMIN"; + } else { + return "0.NA/" + handlePrefix; + } } @Override @@ -355,7 +359,7 @@ public String modifyIdentifierTargetURL(DvObject dvObject) throws Exception { @Override public void deleteIdentifier(DvObject dvObject) throws Exception { String handle = getDvObjectHandle(dvObject); - String authHandle = getAuthHandle(dvObject); + String authHandle = getAuthenticationHandle(dvObject); String adminCredFile = System.getProperty("dataverse.handlenet.admcredfile"); int handlenetIndex = System.getProperty("dataverse.handlenet.index")!=null? Integer.parseInt(System.getProperty("dataverse.handlenet.index")) : 300; @@ -389,11 +393,6 @@ private boolean updateIdentifierStatus(DvObject dvObject, String statusIn) { reRegisterHandle(dvObject); // No Need to register new - this is only called when a handle exists return true; } - - private String getAuthHandle(DvObject dvObject) { - // TODO hack: GNRSServiceBean retrieved this from vdcNetworkService - return "0.NA/" + dvObject.getAuthority(); - } @Override public List getProviderInformation(){ diff --git a/src/main/java/edu/harvard/iq/dataverse/settings/SettingsServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/settings/SettingsServiceBean.java index 0c60708a5a6..cb0a193b5c1 100644 --- a/src/main/java/edu/harvard/iq/dataverse/settings/SettingsServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/settings/SettingsServiceBean.java @@ -366,7 +366,12 @@ Whether Harvesting (OAI) service is enabled * */ FilePIDsEnabled, - + + /** + * Indicates if the Handle service is setup to work 'independently' (No communication with the Global Handle Registry) + */ + IndependentHandleService, + /** * Archiving can be configured by providing an Archiver class name (class must extend AstractSubmitToArchiverCommand) * and a list of settings that should be passed to the Archiver. diff --git a/src/main/java/edu/harvard/iq/dataverse/util/SystemConfig.java b/src/main/java/edu/harvard/iq/dataverse/util/SystemConfig.java index fd059640780..1d980c53bf9 100644 --- a/src/main/java/edu/harvard/iq/dataverse/util/SystemConfig.java +++ b/src/main/java/edu/harvard/iq/dataverse/util/SystemConfig.java @@ -1058,4 +1058,8 @@ public boolean isFilePIDsEnabled() { return settingsService.isTrueForKey(SettingsServiceBean.Key.FilePIDsEnabled, safeDefaultIfKeyNotFound); } + public boolean isIndependentHandleService() { + boolean safeDefaultIfKeyNotFound = false; + return settingsService.isTrueForKey(SettingsServiceBean.Key.IndependentHandleService, safeDefaultIfKeyNotFound); + } }