mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-14 21:43:11 +00:00
Remove long-deprecated ConfigurationManager.
This commit is contained in:
@@ -22,11 +22,11 @@ import org.dspace.content.Item;
|
||||
import org.dspace.content.MetadataSchemaEnum;
|
||||
import org.dspace.content.MetadataValue;
|
||||
import org.dspace.content.service.ItemService;
|
||||
import org.dspace.core.ConfigurationManager;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.LogManager;
|
||||
import org.dspace.handle.service.HandleService;
|
||||
import org.dspace.services.ConfigurationService;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
import org.dspace.versioning.Version;
|
||||
import org.dspace.versioning.VersionHistory;
|
||||
@@ -46,7 +46,8 @@ public class VersionedHandleIdentifierProvider extends IdentifierProvider {
|
||||
/**
|
||||
* log4j category
|
||||
*/
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(VersionedHandleIdentifierProvider.class);
|
||||
private static final Logger log
|
||||
= org.apache.logging.log4j.LogManager.getLogger(VersionedHandleIdentifierProvider.class);
|
||||
|
||||
/**
|
||||
* Prefix registered to no one
|
||||
@@ -110,7 +111,7 @@ public class VersionedHandleIdentifierProvider extends IdentifierProvider {
|
||||
if (dso instanceof Item) {
|
||||
populateHandleMetadata(context, (Item) dso, id);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (IOException | SQLException | AuthorizeException e) {
|
||||
log.error(LogManager.getHeader(context, "Error while attempting to create handle",
|
||||
"Item id: " + (dso != null ? dso.getID() : "")), e);
|
||||
throw new RuntimeException(
|
||||
@@ -261,7 +262,7 @@ public class VersionedHandleIdentifierProvider extends IdentifierProvider {
|
||||
public void reserve(Context context, DSpaceObject dso, String identifier) {
|
||||
try {
|
||||
handleService.createHandle(context, dso, identifier);
|
||||
} catch (Exception e) {
|
||||
} catch (IllegalStateException | SQLException e) {
|
||||
log.error(
|
||||
LogManager.getHeader(context, "Error while attempting to create handle", "Item id: " + dso.getID()), e);
|
||||
throw new RuntimeException("Error while attempting to create identifier for Item id: " + dso.getID());
|
||||
@@ -295,7 +296,7 @@ public class VersionedHandleIdentifierProvider extends IdentifierProvider {
|
||||
handleId = createNewIdentifier(context, dso, null);
|
||||
}
|
||||
return handleId;
|
||||
} catch (Exception e) {
|
||||
} catch (SQLException | AuthorizeException e) {
|
||||
log.error(
|
||||
LogManager.getHeader(context, "Error while attempting to create handle", "Item id: " + dso.getID()), e);
|
||||
throw new RuntimeException("Error while attempting to create identifier for Item id: " + dso.getID());
|
||||
@@ -307,7 +308,7 @@ public class VersionedHandleIdentifierProvider extends IdentifierProvider {
|
||||
// We can do nothing with this, return null
|
||||
try {
|
||||
return handleService.resolveToObject(context, identifier);
|
||||
} catch (Exception e) {
|
||||
} catch (IllegalStateException | SQLException e) {
|
||||
log.error(LogManager.getHeader(context, "Error while resolving handle to item", "handle: " + identifier),
|
||||
e);
|
||||
}
|
||||
@@ -356,7 +357,9 @@ public class VersionedHandleIdentifierProvider extends IdentifierProvider {
|
||||
* @return configured prefix or "123456789"
|
||||
*/
|
||||
public static String getPrefix() {
|
||||
String prefix = ConfigurationManager.getProperty("handle.prefix");
|
||||
ConfigurationService configurationService
|
||||
= DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||
String prefix = configurationService.getProperty("handle.prefix");
|
||||
if (null == prefix) {
|
||||
prefix = EXAMPLE_PREFIX; // XXX no good way to exit cleanly
|
||||
log.error("handle.prefix is not configured; using " + prefix);
|
||||
|
Reference in New Issue
Block a user