mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
[DS-3953] Expose list of metadata namespace files as configuration.
This commit is contained in:
@@ -8,10 +8,17 @@
|
||||
package org.dspace.storage.rdbms;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.TransformerException;
|
||||
|
||||
import org.dspace.administer.MetadataImporter;
|
||||
import org.dspace.administer.RegistryImportException;
|
||||
import org.dspace.administer.RegistryLoader;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.NonUniqueMetadataException;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.services.ConfigurationService;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
@@ -21,6 +28,7 @@ import org.flywaydb.core.api.MigrationInfo;
|
||||
import org.flywaydb.core.api.callback.FlywayCallback;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* This is a FlywayCallback class which automatically updates the
|
||||
@@ -49,7 +57,7 @@ public class DatabaseRegistryUpdater implements FlywayCallback {
|
||||
private static final Logger log = LoggerFactory.getLogger(DatabaseRegistryUpdater.class);
|
||||
|
||||
/**
|
||||
* Method to actually update our registries from latest configs
|
||||
* Method to actually update our registries from latest configuration files.
|
||||
*/
|
||||
private void updateRegistries() {
|
||||
ConfigurationService config = DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||
@@ -63,28 +71,32 @@ public class DatabaseRegistryUpdater implements FlywayCallback {
|
||||
+ "registries" + File.separator;
|
||||
|
||||
// Load updates to Bitstream format registry (if any)
|
||||
log.info("Updating Bitstream Format Registry based on " + base + "bitstream-formats.xml");
|
||||
log.info("Updating Bitstream Format Registry based on {}bitstream-formats.xml", base);
|
||||
RegistryLoader.loadBitstreamFormats(context, base + "bitstream-formats.xml");
|
||||
|
||||
// Load updates to Metadata schema registries (if any)
|
||||
log.info("Updating Metadata Registries based on metadata type configs in " + base);
|
||||
MetadataImporter.loadRegistry(base + "dublin-core-types.xml", true);
|
||||
MetadataImporter.loadRegistry(base + "dcterms-types.xml", true);
|
||||
MetadataImporter.loadRegistry(base + "local-types.xml", true);
|
||||
MetadataImporter.loadRegistry(base + "eperson-types.xml", true);
|
||||
MetadataImporter.loadRegistry(base + "sword-metadata.xml", true);
|
||||
log.info("Updating Metadata Registries based on metadata type configs in {}", base);
|
||||
for (String namespaceFile: config.getArrayProperty("registry.metadata.load")) {
|
||||
log.info("Reading {}", namespaceFile);
|
||||
MetadataImporter.loadRegistry(base + namespaceFile, true);
|
||||
}
|
||||
|
||||
// Check if XML Workflow is enabled in workflow.cfg
|
||||
if (WorkflowServiceFactory.getInstance().getWorkflowService() instanceof XmlWorkflowService) {
|
||||
// If so, load in the workflow metadata types as well
|
||||
MetadataImporter.loadRegistry(base + "workflow-types.xml", true);
|
||||
String workflowTypes = "workflow-types.xml";
|
||||
log.info("Reading {}", workflowTypes);
|
||||
MetadataImporter.loadRegistry(base + workflowTypes, true);
|
||||
}
|
||||
|
||||
context.restoreAuthSystemState();
|
||||
// Commit changes and close context
|
||||
context.complete();
|
||||
log.info("All Bitstream Format Regitry and Metadata Registry updates were completed.");
|
||||
} catch (Exception e) {
|
||||
} catch (IOException | SQLException | ParserConfigurationException
|
||||
| TransformerException | RegistryImportException
|
||||
| AuthorizeException | NonUniqueMetadataException
|
||||
| SAXException e) {
|
||||
log.error("Error attempting to update Bitstream Format and/or Metadata Registries", e);
|
||||
throw new RuntimeException("Error attempting to update Bitstream Format and/or Metadata Registries", e);
|
||||
} finally {
|
||||
|
@@ -751,6 +751,15 @@ org.dspace.app.batchitemimport.work.dir = ${dspace.dir}/imports
|
||||
# XSL file configured by: crosswalk.dissemination.DataCite.stylesheet file.)
|
||||
#identifier.doi.ezid.publisher = a publisher
|
||||
|
||||
##### Registry Loader #####
|
||||
# Metadata namespaces.
|
||||
registry.metadata.load = dublin-core-types.xml
|
||||
registry.metadata.load = dcterms-types.xml
|
||||
registry.metadata.load = local-types.xml
|
||||
registry.metadata.load = eperson-types.xml
|
||||
registry.metadata.load = sword-metadata.xml
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------#
|
||||
#--------------JSPUI & XMLUI CONFIGURATIONS---------------------#
|
||||
|
Reference in New Issue
Block a user