Use handle.original.prefixes

This commit is contained in:
Terry Brady
2016-08-16 13:17:38 -07:00
parent c061898b07
commit 351b03a87b
3 changed files with 18 additions and 13 deletions

View File

@@ -78,7 +78,7 @@ public class VersionedHandleIdentifierProvider extends IdentifierProvider {
return false;
}
// return true if handle has valid starting pattern
if (identifier.startsWith(prefix)
if (identifier.startsWith(prefix + "/")
|| identifier.startsWith(canonicalPrefix)
|| identifier.startsWith("hdl:")
|| identifier.startsWith("info:hdl")
@@ -87,13 +87,15 @@ public class VersionedHandleIdentifierProvider extends IdentifierProvider {
{
return true;
}
// return true if base prefix matches in case of multi-instance deployment with derived prefixes demarcated by a dot "."
if(prefix.contains(".")) {
String[] splitPrefix = prefix.split("\\.");
if(splitPrefix.length > 1 && identifier.startsWith(splitPrefix[0])) {
//Check additional prefixes supported in the config file
String[] additionalPrefixes = DSpaceServicesFactory.getInstance().getConfigurationService().getArrayProperty("handle.additional.prefixes");
for(String additionalPrefix: additionalPrefixes) {
if (identifier.startsWith(additionalPrefix + "/")) {
return true;
}
}
// otherwise, assume invalid handle
return false;
}