mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-12 12:33:18 +00:00
Update multivalued properties to use getArrayProperty from ConfigurationService. Update specific config names based on renamed config keys.
This commit is contained in:
@@ -11,15 +11,18 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import org.dspace.authority.AuthorityValue;
|
import org.dspace.authority.AuthorityValue;
|
||||||
import org.dspace.authority.factory.AuthorityServiceFactory;
|
import org.dspace.authority.factory.AuthorityServiceFactory;
|
||||||
import org.dspace.authority.service.AuthorityValueService;
|
import org.dspace.authority.service.AuthorityValueService;
|
||||||
import org.dspace.content.*;
|
|
||||||
import org.dspace.content.Collection;
|
import org.dspace.content.Collection;
|
||||||
|
import org.dspace.content.Item;
|
||||||
|
import org.dspace.content.MetadataField;
|
||||||
|
import org.dspace.content.MetadataSchema;
|
||||||
|
import org.dspace.content.MetadataValue;
|
||||||
import org.dspace.content.factory.ContentServiceFactory;
|
import org.dspace.content.factory.ContentServiceFactory;
|
||||||
import org.dspace.content.service.ItemService;
|
import org.dspace.content.service.ItemService;
|
||||||
import org.dspace.content.service.MetadataFieldService;
|
import org.dspace.content.service.MetadataFieldService;
|
||||||
import org.dspace.content.service.MetadataSchemaService;
|
import org.dspace.content.service.MetadataSchemaService;
|
||||||
import org.dspace.content.authority.Choices;
|
import org.dspace.content.authority.Choices;
|
||||||
import org.dspace.core.ConfigurationManager;
|
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
|
import org.dspace.utils.DSpace;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
@@ -268,14 +271,11 @@ public class DSpaceCSV implements Serializable
|
|||||||
|
|
||||||
// Set the metadata fields to ignore
|
// Set the metadata fields to ignore
|
||||||
ignore = new HashMap<>();
|
ignore = new HashMap<>();
|
||||||
String toIgnore = ConfigurationManager.getProperty("bulkedit", "ignore-on-export");
|
|
||||||
if ((toIgnore == null) || ("".equals(toIgnore.trim())))
|
// Specify default values
|
||||||
{
|
String[] defaultValues = new String[]{"dc.date.accessioned, dc.date.available, " +
|
||||||
// Set a default value
|
"dc.date.updated, dc.description.provenance"};
|
||||||
toIgnore = "dc.date.accessioned, dc.date.available, " +
|
String[] toIgnoreArray = new DSpace().getConfigurationService().getArrayProperty("bulkedit.ignore-on-export", defaultValues);
|
||||||
"dc.date.updated, dc.description.provenance";
|
|
||||||
}
|
|
||||||
String[] toIgnoreArray = toIgnore.split(",");
|
|
||||||
for (String toIgnoreString : toIgnoreArray)
|
for (String toIgnoreString : toIgnoreArray)
|
||||||
{
|
{
|
||||||
if (!"".equals(toIgnoreString.trim()))
|
if (!"".equals(toIgnoreString.trim()))
|
||||||
@@ -310,7 +310,7 @@ public class DSpaceCSV implements Serializable
|
|||||||
private void setValueSeparator()
|
private void setValueSeparator()
|
||||||
{
|
{
|
||||||
// Get the value separator
|
// Get the value separator
|
||||||
valueSeparator = ConfigurationManager.getProperty("bulkedit", "valueseparator");
|
valueSeparator = new DSpace().getConfigurationService().getProperty("bulkedit.valueseparator");
|
||||||
if ((valueSeparator != null) && (!"".equals(valueSeparator.trim())))
|
if ((valueSeparator != null) && (!"".equals(valueSeparator.trim())))
|
||||||
{
|
{
|
||||||
valueSeparator = valueSeparator.trim();
|
valueSeparator = valueSeparator.trim();
|
||||||
@@ -339,7 +339,7 @@ public class DSpaceCSV implements Serializable
|
|||||||
private void setFieldSeparator()
|
private void setFieldSeparator()
|
||||||
{
|
{
|
||||||
// Get the value separator
|
// Get the value separator
|
||||||
fieldSeparator = ConfigurationManager.getProperty("bulkedit", "fieldseparator");
|
fieldSeparator =new DSpace().getConfigurationService().getProperty("bulkedit.fieldseparator");
|
||||||
if ((fieldSeparator != null) && (!"".equals(fieldSeparator.trim())))
|
if ((fieldSeparator != null) && (!"".equals(fieldSeparator.trim())))
|
||||||
{
|
{
|
||||||
fieldSeparator = fieldSeparator.trim();
|
fieldSeparator = fieldSeparator.trim();
|
||||||
@@ -381,7 +381,7 @@ public class DSpaceCSV implements Serializable
|
|||||||
private void setAuthoritySeparator()
|
private void setAuthoritySeparator()
|
||||||
{
|
{
|
||||||
// Get the value separator
|
// Get the value separator
|
||||||
authoritySeparator = ConfigurationManager.getProperty("bulkedit", "authorityseparator");
|
authoritySeparator = new DSpace().getConfigurationService().getProperty("bulkedit.authorityseparator");
|
||||||
if ((authoritySeparator != null) && (!"".equals(authoritySeparator.trim())))
|
if ((authoritySeparator != null) && (!"".equals(authoritySeparator.trim())))
|
||||||
{
|
{
|
||||||
authoritySeparator = authoritySeparator.trim();
|
authoritySeparator = authoritySeparator.trim();
|
||||||
|
@@ -10,18 +10,17 @@ package org.dspace.app.mediafilter;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
import org.dspace.app.mediafilter.service.MediaFilterService;
|
import org.dspace.app.mediafilter.service.MediaFilterService;
|
||||||
import org.dspace.authorize.service.AuthorizeService;
|
import org.dspace.authorize.service.AuthorizeService;
|
||||||
import org.dspace.content.*;
|
import org.dspace.content.*;
|
||||||
import org.dspace.content.Collection;
|
import org.dspace.content.Collection;
|
||||||
import org.dspace.content.service.*;
|
import org.dspace.content.service.*;
|
||||||
import org.dspace.core.ConfigurationManager;
|
|
||||||
import org.dspace.core.Constants;
|
import org.dspace.core.Constants;
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
import org.dspace.core.SelfNamedPlugin;
|
import org.dspace.core.SelfNamedPlugin;
|
||||||
import org.dspace.eperson.Group;
|
import org.dspace.eperson.Group;
|
||||||
import org.dspace.eperson.service.GroupService;
|
import org.dspace.eperson.service.GroupService;
|
||||||
|
import org.dspace.services.ConfigurationService;
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
@@ -52,6 +51,8 @@ public class MediaFilterServiceImpl implements MediaFilterService, InitializingB
|
|||||||
protected GroupService groupService;
|
protected GroupService groupService;
|
||||||
@Autowired(required = true)
|
@Autowired(required = true)
|
||||||
protected ItemService itemService;
|
protected ItemService itemService;
|
||||||
|
@Autowired(required = true)
|
||||||
|
protected ConfigurationService configurationService;
|
||||||
|
|
||||||
protected int max2Process = Integer.MAX_VALUE; // maximum number items to process
|
protected int max2Process = Integer.MAX_VALUE; // maximum number items to process
|
||||||
|
|
||||||
@@ -74,7 +75,7 @@ public class MediaFilterServiceImpl implements MediaFilterService, InitializingB
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterPropertiesSet() throws Exception {
|
public void afterPropertiesSet() throws Exception {
|
||||||
String publicPermissionFilters = ConfigurationManager.getProperty("filter.org.dspace.app.mediafilter.publicPermission");
|
String publicPermissionFilters = configurationService.getProperty("filter.org.dspace.app.mediafilter.publicPermission");
|
||||||
if(publicPermissionFilters != null) {
|
if(publicPermissionFilters != null) {
|
||||||
String[] publicPermisionFiltersArray = publicPermissionFilters.split(",");
|
String[] publicPermisionFiltersArray = publicPermissionFilters.split(",");
|
||||||
for(String filter : publicPermisionFiltersArray) {
|
for(String filter : publicPermisionFiltersArray) {
|
||||||
|
@@ -13,7 +13,6 @@ import org.dspace.core.Context;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
@@ -34,12 +33,14 @@ import org.jdom.output.XMLOutputter;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.dspace.content.DSpaceObject;
|
import org.dspace.content.DSpaceObject;
|
||||||
import org.dspace.core.ConfigurationManager;
|
|
||||||
|
|
||||||
import com.sun.syndication.feed.module.opensearch.OpenSearchModule;
|
import com.sun.syndication.feed.module.opensearch.OpenSearchModule;
|
||||||
import com.sun.syndication.feed.module.opensearch.entity.OSQuery;
|
import com.sun.syndication.feed.module.opensearch.entity.OSQuery;
|
||||||
import com.sun.syndication.feed.module.opensearch.impl.OpenSearchModuleImpl;
|
import com.sun.syndication.feed.module.opensearch.impl.OpenSearchModuleImpl;
|
||||||
import com.sun.syndication.io.FeedException;
|
import com.sun.syndication.io.FeedException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import org.dspace.services.ConfigurationService;
|
||||||
|
import org.dspace.utils.DSpace;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility Class with static methods for producing OpenSearch-compliant search results,
|
* Utility Class with static methods for producing OpenSearch-compliant search results,
|
||||||
@@ -83,21 +84,19 @@ public class OpenSearchServiceImpl implements OpenSearchService, InitializingBea
|
|||||||
@Override
|
@Override
|
||||||
public void afterPropertiesSet() throws Exception
|
public void afterPropertiesSet() throws Exception
|
||||||
{
|
{
|
||||||
enabled = ConfigurationManager.getBooleanProperty("websvc.opensearch.enable");
|
ConfigurationService config = new DSpace().getConfigurationService();
|
||||||
svcUrl = ConfigurationManager.getProperty("dspace.url") + "/" +
|
enabled = config.getBooleanProperty("websvc.opensearch.enable");
|
||||||
ConfigurationManager.getProperty("websvc.opensearch.svccontext");
|
svcUrl = config.getProperty("dspace.url") + "/" +
|
||||||
uiUrl = ConfigurationManager.getProperty("dspace.url") + "/" +
|
config.getProperty("websvc.opensearch.svccontext");
|
||||||
ConfigurationManager.getProperty("websvc.opensearch.uicontext");
|
uiUrl = config.getProperty("dspace.url") + "/" +
|
||||||
|
config.getProperty("websvc.opensearch.uicontext");
|
||||||
|
|
||||||
// read rest of config info if enabled
|
// read rest of config info if enabled
|
||||||
formats = new ArrayList<String>();
|
formats = new ArrayList<String>();
|
||||||
if (enabled)
|
if (enabled)
|
||||||
{
|
{
|
||||||
String fmtsStr = ConfigurationManager.getProperty("websvc.opensearch.formats");
|
String[] fmts = config.getArrayProperty("websvc.opensearch.formats");
|
||||||
if ( fmtsStr != null )
|
formats = Arrays.asList(fmts);
|
||||||
{
|
|
||||||
Collections.addAll(formats, fmtsStr.split(","));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,31 +214,33 @@ public class OpenSearchServiceImpl implements OpenSearchService, InitializingBea
|
|||||||
*/
|
*/
|
||||||
protected org.jdom.Document getServiceDocument(String scope)
|
protected org.jdom.Document getServiceDocument(String scope)
|
||||||
{
|
{
|
||||||
|
ConfigurationService config = new DSpace().getConfigurationService();
|
||||||
|
|
||||||
Namespace ns = Namespace.getNamespace(osNs);
|
Namespace ns = Namespace.getNamespace(osNs);
|
||||||
Element root = new Element("OpenSearchDescription", ns);
|
Element root = new Element("OpenSearchDescription", ns);
|
||||||
root.addContent(new Element("ShortName", ns).setText(ConfigurationManager.getProperty("websvc.opensearch.shortname")));
|
root.addContent(new Element("ShortName", ns).setText(config.getProperty("websvc.opensearch.shortname")));
|
||||||
root.addContent(new Element("LongName", ns).setText(ConfigurationManager.getProperty("websvc.opensearch.longname")));
|
root.addContent(new Element("LongName", ns).setText(config.getProperty("websvc.opensearch.longname")));
|
||||||
root.addContent(new Element("Description", ns).setText(ConfigurationManager.getProperty("websvc.opensearch.description")));
|
root.addContent(new Element("Description", ns).setText(config.getProperty("websvc.opensearch.description")));
|
||||||
root.addContent(new Element("InputEncoding", ns).setText("UTF-8"));
|
root.addContent(new Element("InputEncoding", ns).setText("UTF-8"));
|
||||||
root.addContent(new Element("OutputEncoding", ns).setText("UTF-8"));
|
root.addContent(new Element("OutputEncoding", ns).setText("UTF-8"));
|
||||||
// optional elements
|
// optional elements
|
||||||
String sample = ConfigurationManager.getProperty("websvc.opensearch.samplequery");
|
String sample = config.getProperty("websvc.opensearch.samplequery");
|
||||||
if (sample != null && sample.length() > 0)
|
if (sample != null && sample.length() > 0)
|
||||||
{
|
{
|
||||||
Element sq = new Element("Query", ns).setAttribute("role", "example");
|
Element sq = new Element("Query", ns).setAttribute("role", "example");
|
||||||
root.addContent(sq.setAttribute("searchTerms", sample));
|
root.addContent(sq.setAttribute("searchTerms", sample));
|
||||||
}
|
}
|
||||||
String tags = ConfigurationManager.getProperty("websvc.opensearch.tags");
|
String tags = config.getProperty("websvc.opensearch.tags");
|
||||||
if (tags != null && tags.length() > 0)
|
if (tags != null && tags.length() > 0)
|
||||||
{
|
{
|
||||||
root.addContent(new Element("Tags", ns).setText(tags));
|
root.addContent(new Element("Tags", ns).setText(tags));
|
||||||
}
|
}
|
||||||
String contact = ConfigurationManager.getProperty("mail.admin");
|
String contact = config.getProperty("mail.admin");
|
||||||
if (contact != null && contact.length() > 0)
|
if (contact != null && contact.length() > 0)
|
||||||
{
|
{
|
||||||
root.addContent(new Element("Contact", ns).setText(contact));
|
root.addContent(new Element("Contact", ns).setText(contact));
|
||||||
}
|
}
|
||||||
String faviconUrl = ConfigurationManager.getProperty("websvc.opensearch.faviconurl");
|
String faviconUrl = config.getProperty("websvc.opensearch.faviconurl");
|
||||||
if (faviconUrl != null && faviconUrl.length() > 0)
|
if (faviconUrl != null && faviconUrl.length() > 0)
|
||||||
{
|
{
|
||||||
String dim = String.valueOf(16);
|
String dim = String.valueOf(16);
|
||||||
|
@@ -8,7 +8,11 @@
|
|||||||
package org.dspace.authenticate;
|
package org.dspace.authenticate;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@@ -22,6 +26,7 @@ import org.dspace.eperson.EPerson;
|
|||||||
import org.dspace.eperson.Group;
|
import org.dspace.eperson.Group;
|
||||||
import org.dspace.eperson.factory.EPersonServiceFactory;
|
import org.dspace.eperson.factory.EPersonServiceFactory;
|
||||||
import org.dspace.eperson.service.GroupService;
|
import org.dspace.eperson.service.GroupService;
|
||||||
|
import org.dspace.utils.DSpace;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds users to special groups based on IP address. Configuration parameter
|
* Adds users to special groups based on IP address. Configuration parameter
|
||||||
@@ -80,24 +85,20 @@ public class IPAuthentication implements AuthenticationMethod
|
|||||||
ipMatcherGroupNames = new HashMap<>();
|
ipMatcherGroupNames = new HashMap<>();
|
||||||
groupService = EPersonServiceFactory.getInstance().getGroupService();
|
groupService = EPersonServiceFactory.getInstance().getGroupService();
|
||||||
|
|
||||||
Enumeration e = ConfigurationManager.propertyNames("authentication-ip");
|
List<String> propNames = new DSpace().getConfigurationService().getPropertyKeys("authentication-ip");
|
||||||
|
|
||||||
while (e.hasMoreElements())
|
for(String propName : propNames)
|
||||||
{
|
{
|
||||||
String propName = (String) e.nextElement();
|
String[] nameParts = propName.split("\\.");
|
||||||
if (propName.startsWith("ip."))
|
|
||||||
{
|
|
||||||
String[] nameParts = propName.split("\\.");
|
|
||||||
|
|
||||||
if (nameParts.length == 2)
|
if (nameParts.length == 2)
|
||||||
{
|
{
|
||||||
addMatchers(nameParts[1], ConfigurationManager.getProperty("authentication-ip", propName));
|
addMatchers(nameParts[1], new DSpace().getConfigurationService().getProperty(propName));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log.warn("Malformed configuration property name: "
|
log.warn("Malformed configuration property name: "
|
||||||
+ propName);
|
+ propName);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,12 +16,12 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
|
|
||||||
import org.apache.commons.collections.ListUtils;
|
import org.apache.commons.collections.ListUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.dspace.core.ConfigurationManager;
|
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
import org.dspace.core.LogManager;
|
import org.dspace.core.LogManager;
|
||||||
import org.dspace.eperson.EPerson;
|
import org.dspace.eperson.EPerson;
|
||||||
import org.dspace.eperson.Group;
|
import org.dspace.eperson.Group;
|
||||||
import org.dspace.eperson.factory.EPersonServiceFactory;
|
import org.dspace.eperson.factory.EPersonServiceFactory;
|
||||||
|
import org.dspace.utils.DSpace;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A stackable authentication method
|
* A stackable authentication method
|
||||||
@@ -66,8 +66,8 @@ public class PasswordAuthentication
|
|||||||
throws SQLException
|
throws SQLException
|
||||||
{
|
{
|
||||||
// Is there anything set in domain.valid?
|
// Is there anything set in domain.valid?
|
||||||
String domains = ConfigurationManager.getProperty("authentication-password", "domain.valid");
|
String[] domains = new DSpace().getConfigurationService().getArrayProperty("authentication-password.domain.valid");
|
||||||
if ((domains == null) || (domains.trim().equals("")))
|
if ((domains == null) || (domains.length==0))
|
||||||
{
|
{
|
||||||
// No conditions set, so must be able to self register
|
// No conditions set, so must be able to self register
|
||||||
return true;
|
return true;
|
||||||
@@ -75,12 +75,11 @@ public class PasswordAuthentication
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Itterate through all domains
|
// Itterate through all domains
|
||||||
String[] options = domains.trim().split(",");
|
|
||||||
String check;
|
String check;
|
||||||
email = email.trim().toLowerCase();
|
email = email.trim().toLowerCase();
|
||||||
for (int i = 0; i < options.length; i++)
|
for (int i = 0; i < domains.length; i++)
|
||||||
{
|
{
|
||||||
check = options[i].trim().toLowerCase();
|
check = domains[i].trim().toLowerCase();
|
||||||
if (email.endsWith(check))
|
if (email.endsWith(check))
|
||||||
{
|
{
|
||||||
// A match, so we can register this user
|
// A match, so we can register this user
|
||||||
@@ -139,7 +138,7 @@ public class PasswordAuthentication
|
|||||||
{
|
{
|
||||||
if (EPersonServiceFactory.getInstance().getEPersonService().getPasswordHash(context.getCurrentUser()) != null && !EPersonServiceFactory.getInstance().getEPersonService().getPasswordHash(context.getCurrentUser()).toString().equals(""))
|
if (EPersonServiceFactory.getInstance().getEPersonService().getPasswordHash(context.getCurrentUser()) != null && !EPersonServiceFactory.getInstance().getEPersonService().getPasswordHash(context.getCurrentUser()).toString().equals(""))
|
||||||
{
|
{
|
||||||
String groupName = ConfigurationManager.getProperty("authentication-password", "login.specialgroup");
|
String groupName = new DSpace().getConfigurationService().getProperty("authentication-password.login.specialgroup");
|
||||||
if ((groupName != null) && (!groupName.trim().equals("")))
|
if ((groupName != null) && (!groupName.trim().equals("")))
|
||||||
{
|
{
|
||||||
Group specialGroup = EPersonServiceFactory.getInstance().getGroupService().findByName(context, groupName);
|
Group specialGroup = EPersonServiceFactory.getInstance().getGroupService().findByName(context, groupName);
|
||||||
|
@@ -25,8 +25,9 @@ import org.xml.sax.InputSource;
|
|||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.dspace.core.ConfigurationManager;
|
|
||||||
import org.dspace.core.SelfNamedPlugin;
|
import org.dspace.core.SelfNamedPlugin;
|
||||||
|
import org.dspace.services.ConfigurationService;
|
||||||
|
import org.dspace.utils.DSpace;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ChoiceAuthority source that reads the JSPUI-style hierarchical vocabularies
|
* ChoiceAuthority source that reads the JSPUI-style hierarchical vocabularies
|
||||||
@@ -94,7 +95,7 @@ public class DSpaceControlledVocabulary extends SelfNamedPlugin implements Choic
|
|||||||
return name.endsWith(".xml");
|
return name.endsWith(".xml");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String vocabulariesPath = ConfigurationManager.getProperty("dspace.dir")
|
String vocabulariesPath = new DSpace().getConfigurationService().getProperty("dspace.dir")
|
||||||
+ "/config/controlled-vocabularies/";
|
+ "/config/controlled-vocabularies/";
|
||||||
String[] xmlFiles = (new File(vocabulariesPath)).list(new xmlFilter());
|
String[] xmlFiles = (new File(vocabulariesPath)).list(new xmlFilter());
|
||||||
List<String> names = new ArrayList<String>();
|
List<String> names = new ArrayList<String>();
|
||||||
@@ -111,13 +112,15 @@ public class DSpaceControlledVocabulary extends SelfNamedPlugin implements Choic
|
|||||||
{
|
{
|
||||||
if (vocabulary == null)
|
if (vocabulary == null)
|
||||||
{
|
{
|
||||||
|
ConfigurationService config = new DSpace().getConfigurationService();
|
||||||
|
|
||||||
log.info("Initializing " + this.getClass().getName());
|
log.info("Initializing " + this.getClass().getName());
|
||||||
vocabularyName = this.getPluginInstanceName();
|
vocabularyName = this.getPluginInstanceName();
|
||||||
String vocabulariesPath = ConfigurationManager.getProperty("dspace.dir") + "/config/controlled-vocabularies/";
|
String vocabulariesPath = config.getProperty("dspace.dir") + "/config/controlled-vocabularies/";
|
||||||
String configurationPrefix = "vocabulary.plugin." + vocabularyName;
|
String configurationPrefix = "vocabulary.plugin." + vocabularyName;
|
||||||
storeHierarchy = ConfigurationManager.getBooleanProperty(configurationPrefix + ".hierarchy.store", storeHierarchy);
|
storeHierarchy = config.getBooleanProperty(configurationPrefix + ".hierarchy.store", storeHierarchy);
|
||||||
suggestHierarchy = ConfigurationManager.getBooleanProperty(configurationPrefix + ".hierarchy.suggest", suggestHierarchy);
|
suggestHierarchy = config.getBooleanProperty(configurationPrefix + ".hierarchy.suggest", suggestHierarchy);
|
||||||
String configuredDelimiter = ConfigurationManager.getProperty(configurationPrefix + ".delimiter");
|
String configuredDelimiter = config.getProperty(configurationPrefix + ".delimiter");
|
||||||
if (configuredDelimiter != null)
|
if (configuredDelimiter != null)
|
||||||
{
|
{
|
||||||
hierarchyDelimiter = configuredDelimiter.replaceAll("(^\"|\"$)","");
|
hierarchyDelimiter = configuredDelimiter.replaceAll("(^\"|\"$)","");
|
||||||
|
@@ -51,9 +51,9 @@ public abstract class AbstractTranslator extends AbstractCurationTask
|
|||||||
|
|
||||||
// Load configuration
|
// Load configuration
|
||||||
authLang = ConfigurationManager.getProperty("default.locale");
|
authLang = ConfigurationManager.getProperty("default.locale");
|
||||||
authLangField = ConfigurationManager.getProperty(PLUGIN_PREFIX, "translate.field.language");
|
authLangField = ConfigurationManager.getProperty(PLUGIN_PREFIX, "field.language");
|
||||||
String toTranslateStr = ConfigurationManager.getProperty(PLUGIN_PREFIX, "translate.field.targets");
|
String toTranslateStr = ConfigurationManager.getProperty(PLUGIN_PREFIX, "field.targets");
|
||||||
String langsStr = ConfigurationManager.getProperty(PLUGIN_PREFIX, "translate.language.targets");
|
String langsStr = ConfigurationManager.getProperty(PLUGIN_PREFIX, "language.targets");
|
||||||
toTranslate = toTranslateStr.split(",");
|
toTranslate = toTranslateStr.split(",");
|
||||||
langs = langsStr.split(",");
|
langs = langsStr.split(",");
|
||||||
|
|
||||||
@@ -184,7 +184,7 @@ public abstract class AbstractTranslator extends AbstractCurationTask
|
|||||||
/*
|
/*
|
||||||
* Override this method in your translator
|
* Override this method in your translator
|
||||||
* Only needed to set key, etc.
|
* Only needed to set key, etc.
|
||||||
* apiKey = ConfigurationManager.getProperty(PLUGIN_PREFIX, "translate.api.key.[service]");
|
* apiKey = ConfigurationManager.getProperty(PLUGIN_PREFIX, "translator.api.key.[service]");
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
@@ -23,10 +23,10 @@ import org.dspace.content.Collection;
|
|||||||
import org.dspace.content.service.BitstreamService;
|
import org.dspace.content.service.BitstreamService;
|
||||||
import org.dspace.content.service.CommunityService;
|
import org.dspace.content.service.CommunityService;
|
||||||
import org.dspace.content.service.ItemService;
|
import org.dspace.content.service.ItemService;
|
||||||
import org.dspace.core.ConfigurationManager;
|
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
import org.dspace.disseminate.service.CitationDocumentService;
|
import org.dspace.disseminate.service.CitationDocumentService;
|
||||||
import org.dspace.handle.service.HandleService;
|
import org.dspace.handle.service.HandleService;
|
||||||
|
import org.dspace.services.ConfigurationService;
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
@@ -70,22 +70,10 @@ public class CitationDocumentServiceImpl implements CitationDocumentService, Ini
|
|||||||
*/
|
*/
|
||||||
protected final Set<String> SVG_MIMES = new HashSet<String>();
|
protected final Set<String> SVG_MIMES = new HashSet<String>();
|
||||||
|
|
||||||
/**
|
|
||||||
* Comma separated list of collections handles to enable citation for.
|
|
||||||
* webui.citation.enabled_collections, default empty/none. ex: =1811/123, 1811/345
|
|
||||||
*/
|
|
||||||
protected String citationEnabledCollections = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Comma separated list of community handles to enable citation for.
|
|
||||||
* webui.citation.enabled_communties, default empty/none. ex: =1811/123, 1811/345
|
|
||||||
*/
|
|
||||||
protected String citationEnabledCommunities = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of all enabled collections, inherited/determined for those under communities.
|
* List of all enabled collections, inherited/determined for those under communities.
|
||||||
*/
|
*/
|
||||||
protected ArrayList<String> citationEnabledCollectionsList;
|
protected List<String> citationEnabledCollectionsList;
|
||||||
|
|
||||||
protected File tempDir;
|
protected File tempDir;
|
||||||
|
|
||||||
@@ -102,6 +90,8 @@ public class CitationDocumentServiceImpl implements CitationDocumentService, Ini
|
|||||||
protected CommunityService communityService;
|
protected CommunityService communityService;
|
||||||
@Autowired(required = true)
|
@Autowired(required = true)
|
||||||
protected ItemService itemService;
|
protected ItemService itemService;
|
||||||
|
@Autowired(required = true)
|
||||||
|
protected ConfigurationService configurationService;
|
||||||
|
|
||||||
@Autowired(required = true)
|
@Autowired(required = true)
|
||||||
protected HandleService handleService;
|
protected HandleService handleService;
|
||||||
@@ -130,27 +120,22 @@ public class CitationDocumentServiceImpl implements CitationDocumentService, Ini
|
|||||||
|
|
||||||
|
|
||||||
//Load enabled collections
|
//Load enabled collections
|
||||||
citationEnabledCollections = ConfigurationManager.getProperty("disseminate-citation", "enabled_collections");
|
String[] citationEnabledCollections = configurationService.getArrayProperty("citation-page.enabled_collections");
|
||||||
citationEnabledCollectionsList = new ArrayList<String>();
|
citationEnabledCollectionsList = Arrays.asList(citationEnabledCollections);
|
||||||
if(citationEnabledCollections != null && citationEnabledCollections.length() > 0) {
|
|
||||||
String[] collectionChunks = citationEnabledCollections.split(",");
|
|
||||||
for(String collectionString : collectionChunks) {
|
|
||||||
citationEnabledCollectionsList.add(collectionString.trim());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//Load enabled communities, and add to collection-list
|
//Load enabled communities, and add to collection-list
|
||||||
citationEnabledCommunities = ConfigurationManager.getProperty("disseminate-citation", "enabled_communities");
|
String[] citationEnabledCommunities = configurationService.getArrayProperty("citation-page.enabled_communities");
|
||||||
if(citationEnabledCollectionsList == null) {
|
if(citationEnabledCollectionsList == null) {
|
||||||
citationEnabledCollectionsList = new ArrayList<String>();
|
citationEnabledCollectionsList = new ArrayList<String>();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(citationEnabledCommunities != null && citationEnabledCommunities.length() > 0) {
|
if(citationEnabledCommunities != null && citationEnabledCommunities.length > 0)
|
||||||
try {
|
{
|
||||||
String[] communityChunks = citationEnabledCommunities.split(",");
|
Context context = null;
|
||||||
for(String communityString : communityChunks) {
|
try
|
||||||
Context context = new Context();
|
{
|
||||||
|
context = new Context();
|
||||||
|
for(String communityString : citationEnabledCommunities) {
|
||||||
DSpaceObject dsoCommunity = handleService.resolveToObject(context, communityString.trim());
|
DSpaceObject dsoCommunity = handleService.resolveToObject(context, communityString.trim());
|
||||||
if(dsoCommunity instanceof Community) {
|
if(dsoCommunity instanceof Community) {
|
||||||
Community community = (Community)dsoCommunity;
|
Community community = (Community)dsoCommunity;
|
||||||
@@ -162,38 +147,39 @@ public class CitationDocumentServiceImpl implements CitationDocumentService, Ini
|
|||||||
} else {
|
} else {
|
||||||
log.error("Invalid community for citation.enabled_communities, value:" + communityString.trim());
|
log.error("Invalid community for citation.enabled_communities, value:" + communityString.trim());
|
||||||
}
|
}
|
||||||
context.abort();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
if (context!=null)
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configurable text/fields, we'll set sane defaults
|
// Configurable text/fields, we'll set sane defaults
|
||||||
String header1Config = ConfigurationManager.getProperty("disseminate-citation", "header1");
|
String header1Config = configurationService.getProperty("citation-page.header1");
|
||||||
if(StringUtils.isNotBlank(header1Config)) {
|
if(StringUtils.isNotBlank(header1Config)) {
|
||||||
header1 = header1Config.split(",");
|
header1 = header1Config.split(",");
|
||||||
} else {
|
} else {
|
||||||
header1 = new String[]{"DSpace Institution", ""};
|
header1 = new String[]{"DSpace Institution", ""};
|
||||||
}
|
}
|
||||||
|
|
||||||
String header2Config = ConfigurationManager.getProperty("disseminate-citation", "header2");
|
String header2Config = configurationService.getProperty("citation-page.header2");
|
||||||
if(StringUtils.isNotBlank(header2Config)) {
|
if(StringUtils.isNotBlank(header2Config)) {
|
||||||
header2 = header2Config.split(",");
|
header2 = header2Config.split(",");
|
||||||
} else {
|
} else {
|
||||||
header2 = new String[]{"DSpace Repository", "http://dspace.org"};
|
header2 = new String[]{"DSpace Repository", "http://dspace.org"};
|
||||||
}
|
}
|
||||||
|
|
||||||
String fieldsConfig = ConfigurationManager.getProperty("disseminate-citation", "fields");
|
String fieldsConfig = configurationService.getProperty("citation-page.fields");
|
||||||
if(StringUtils.isNotBlank(fieldsConfig)) {
|
if(StringUtils.isNotBlank(fieldsConfig)) {
|
||||||
fields = fieldsConfig.split(",");
|
fields = fieldsConfig.split(",");
|
||||||
} else {
|
} else {
|
||||||
fields = new String[]{"dc.date.issued", "dc.title", "dc.creator", "dc.contributor.author", "dc.publisher", "_line_", "dc.identifier.citation", "dc.identifier.uri"};
|
fields = new String[]{"dc.date.issued", "dc.title", "dc.creator", "dc.contributor.author", "dc.publisher", "_line_", "dc.identifier.citation", "dc.identifier.uri"};
|
||||||
}
|
}
|
||||||
|
|
||||||
String footerConfig = ConfigurationManager.getProperty("disseminate-citation", "footer");
|
String footerConfig = configurationService.getProperty("citation-page.footer");
|
||||||
if(StringUtils.isNotBlank(footerConfig)) {
|
if(StringUtils.isNotBlank(footerConfig)) {
|
||||||
footer = footerConfig;
|
footer = footerConfig;
|
||||||
} else {
|
} else {
|
||||||
@@ -201,7 +187,7 @@ public class CitationDocumentServiceImpl implements CitationDocumentService, Ini
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Ensure a temp directory is available
|
//Ensure a temp directory is available
|
||||||
String tempDirString = ConfigurationManager.getProperty("dspace.dir") + "/temp";
|
String tempDirString = configurationService.getProperty("dspace.dir") + File.pathSeparator + "temp";
|
||||||
tempDir = new File(tempDirString);
|
tempDir = new File(tempDirString);
|
||||||
if(!tempDir.exists()) {
|
if(!tempDir.exists()) {
|
||||||
boolean success = tempDir.mkdir();
|
boolean success = tempDir.mkdir();
|
||||||
@@ -218,13 +204,13 @@ public class CitationDocumentServiceImpl implements CitationDocumentService, Ini
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Boolean to determine is citation-functionality is enabled globally for entire site.
|
* Boolean to determine is citation-functionality is enabled globally for entire site.
|
||||||
* config/module/disseminate-citation: enable_globally, default false. true=on, false=off
|
* config/module/citation-page: enable_globally, default false. true=on, false=off
|
||||||
*/
|
*/
|
||||||
protected Boolean citationEnabledGlobally = null;
|
protected Boolean citationEnabledGlobally = null;
|
||||||
|
|
||||||
protected boolean isCitationEnabledGlobally() {
|
protected boolean isCitationEnabledGlobally() {
|
||||||
if(citationEnabledGlobally == null) {
|
if(citationEnabledGlobally == null) {
|
||||||
citationEnabledGlobally = ConfigurationManager.getBooleanProperty("disseminate-citation", "enable_globally", false);
|
citationEnabledGlobally = configurationService.getBooleanProperty("citation-page.enable_globally", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return citationEnabledGlobally;
|
return citationEnabledGlobally;
|
||||||
@@ -277,7 +263,7 @@ public class CitationDocumentServiceImpl implements CitationDocumentService, Ini
|
|||||||
|
|
||||||
protected Boolean isCitationFirstPage() {
|
protected Boolean isCitationFirstPage() {
|
||||||
if(citationAsFirstPage == null) {
|
if(citationAsFirstPage == null) {
|
||||||
citationAsFirstPage = ConfigurationManager.getBooleanProperty("disseminate-citation", "citation_as_first_page", true);
|
citationAsFirstPage = configurationService.getBooleanProperty("citation-page.citation_as_first_page", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return citationAsFirstPage;
|
return citationAsFirstPage;
|
||||||
|
@@ -98,12 +98,12 @@ public class OAIHarvester {
|
|||||||
Context ourContext;
|
Context ourContext;
|
||||||
|
|
||||||
// Namespace used by the ORE serialization format
|
// Namespace used by the ORE serialization format
|
||||||
// Set in dspace.cfg as harvester.oai.oreSerializationFormat.{ORESerialKey} = {ORESerialNS}
|
// Set in dspace.cfg as oai.harvester.oreSerializationFormat.{ORESerialKey} = {ORESerialNS}
|
||||||
private Namespace ORESerialNS;
|
private Namespace ORESerialNS;
|
||||||
private String ORESerialKey;
|
private String ORESerialKey;
|
||||||
|
|
||||||
// Namespace of the descriptive metadata that should be harvested in addition to the ORE
|
// Namespace of the descriptive metadata that should be harvested in addition to the ORE
|
||||||
// Set in dspace.cfg as harvester.oai.metadataformats.{MetadataKey} = {MetadataNS},{Display Name}
|
// Set in dspace.cfg as oai.harvester.metadataformats.{MetadataKey} = {MetadataNS},{Display Name}
|
||||||
private Namespace metadataNS;
|
private Namespace metadataNS;
|
||||||
private String metadataKey;
|
private String metadataKey;
|
||||||
|
|
||||||
@@ -153,7 +153,7 @@ public class OAIHarvester {
|
|||||||
metadataNS = OAIHarvester.getDMDNamespace(metadataKey);
|
metadataNS = OAIHarvester.getDMDNamespace(metadataKey);
|
||||||
|
|
||||||
if (metadataNS == null) {
|
if (metadataNS == null) {
|
||||||
log.error("No matching metadata namespace found for \"" + metadataKey + "\", see oai.cfg option \"harvester.oai.metadataformats.{MetadataKey} = {MetadataNS},{Display Name}\"");
|
log.error("No matching metadata namespace found for \"" + metadataKey + "\", see oai.cfg option \"oai.harvester.metadataformats.{MetadataKey} = {MetadataNS},{Display Name}\"");
|
||||||
throw new HarvestingException("Metadata declaration not found");
|
throw new HarvestingException("Metadata declaration not found");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -166,7 +166,7 @@ public class OAIHarvester {
|
|||||||
private static Namespace getORENamespace() {
|
private static Namespace getORENamespace() {
|
||||||
String ORESerializationString = null;
|
String ORESerializationString = null;
|
||||||
String ORESeialKey = null;
|
String ORESeialKey = null;
|
||||||
String oreString = "harvester.oai.oreSerializationFormat.";
|
String oreString = "oai.harvester.oreSerializationFormat.";
|
||||||
|
|
||||||
Enumeration pe = ConfigurationManager.propertyNames("oai");
|
Enumeration pe = ConfigurationManager.propertyNames("oai");
|
||||||
|
|
||||||
@@ -193,7 +193,7 @@ public class OAIHarvester {
|
|||||||
*/
|
*/
|
||||||
private static Namespace getDMDNamespace(String metadataKey) {
|
private static Namespace getDMDNamespace(String metadataKey) {
|
||||||
String metadataString = null;
|
String metadataString = null;
|
||||||
String metaString = "harvester.oai.metadataformats.";
|
String metaString = "oai.harvester.metadataformats.";
|
||||||
|
|
||||||
Enumeration pe = ConfigurationManager.propertyNames("oai");
|
Enumeration pe = ConfigurationManager.propertyNames("oai");
|
||||||
|
|
||||||
|
@@ -240,12 +240,11 @@ public class RDFConfiguration {
|
|||||||
*/
|
*/
|
||||||
public static String[] loadConfigurationArray(String key)
|
public static String[] loadConfigurationArray(String key)
|
||||||
{
|
{
|
||||||
String value = (new DSpace()).getConfigurationService().getProperty(key);
|
ConfigurationService config = new DSpace().getConfigurationService();
|
||||||
if (StringUtils.isEmpty(value))
|
if(config.hasProperty(key))
|
||||||
{
|
return config.getArrayProperty(key);
|
||||||
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
|
||||||
return value.split(",\\s*");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -12,8 +12,9 @@ import java.sql.Connection;
|
|||||||
|
|
||||||
import org.dspace.administer.MetadataImporter;
|
import org.dspace.administer.MetadataImporter;
|
||||||
import org.dspace.administer.RegistryLoader;
|
import org.dspace.administer.RegistryLoader;
|
||||||
import org.dspace.core.ConfigurationManager;
|
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
|
import org.dspace.services.ConfigurationService;
|
||||||
|
import org.dspace.utils.DSpace;
|
||||||
import org.flywaydb.core.api.MigrationInfo;
|
import org.flywaydb.core.api.MigrationInfo;
|
||||||
import org.flywaydb.core.api.callback.FlywayCallback;
|
import org.flywaydb.core.api.callback.FlywayCallback;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -44,13 +45,14 @@ public class DatabaseRegistryUpdater implements FlywayCallback
|
|||||||
*/
|
*/
|
||||||
private void updateRegistries()
|
private void updateRegistries()
|
||||||
{
|
{
|
||||||
|
ConfigurationService config = new DSpace().getConfigurationService();
|
||||||
Context context = null;
|
Context context = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
context = new Context();
|
context = new Context();
|
||||||
context.turnOffAuthorisationSystem();
|
context.turnOffAuthorisationSystem();
|
||||||
|
|
||||||
String base = ConfigurationManager.getProperty("dspace.dir")
|
String base = config.getProperty("dspace.dir")
|
||||||
+ File.separator + "config" + File.separator
|
+ File.separator + "config" + File.separator
|
||||||
+ "registries" + File.separator;
|
+ "registries" + File.separator;
|
||||||
|
|
||||||
@@ -67,7 +69,8 @@ public class DatabaseRegistryUpdater implements FlywayCallback
|
|||||||
MetadataImporter.loadRegistry(base + "sword-metadata.xml", true);
|
MetadataImporter.loadRegistry(base + "sword-metadata.xml", true);
|
||||||
|
|
||||||
// Check if XML Workflow is enabled in workflow.cfg
|
// Check if XML Workflow is enabled in workflow.cfg
|
||||||
if (ConfigurationManager.getProperty("workflow", "workflow.framework").equals("xmlworkflow"))
|
String framework = config.getProperty("workflow.framework");
|
||||||
|
if (framework!=null && framework.equals("xmlworkflow"))
|
||||||
{
|
{
|
||||||
// If so, load in the workflow metadata types as well
|
// If so, load in the workflow metadata types as well
|
||||||
MetadataImporter.loadRegistry(base + "workflow-types.xml", true);
|
MetadataImporter.loadRegistry(base + "workflow-types.xml", true);
|
||||||
|
@@ -26,10 +26,10 @@ import javax.sql.DataSource;
|
|||||||
import org.apache.commons.dbcp2.BasicDataSource;
|
import org.apache.commons.dbcp2.BasicDataSource;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.dspace.core.ConfigurationManager;
|
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
import org.dspace.discovery.IndexingService;
|
import org.dspace.discovery.IndexingService;
|
||||||
import org.dspace.discovery.SearchServiceException;
|
import org.dspace.discovery.SearchServiceException;
|
||||||
|
import org.dspace.services.ConfigurationService;
|
||||||
import org.dspace.utils.DSpace;
|
import org.dspace.utils.DSpace;
|
||||||
import org.flywaydb.core.Flyway;
|
import org.flywaydb.core.Flyway;
|
||||||
import org.flywaydb.core.api.FlywayException;
|
import org.flywaydb.core.api.FlywayException;
|
||||||
@@ -62,7 +62,7 @@ public class DatabaseUtils
|
|||||||
// When this temp file exists, the "checkReindexDiscovery()" method will auto-reindex Discovery
|
// When this temp file exists, the "checkReindexDiscovery()" method will auto-reindex Discovery
|
||||||
// Reindex flag file is at [dspace]/solr/search/conf/reindex.flag
|
// Reindex flag file is at [dspace]/solr/search/conf/reindex.flag
|
||||||
// See also setReindexDiscovery()/getReindexDiscover()
|
// See also setReindexDiscovery()/getReindexDiscover()
|
||||||
private static final String reindexDiscoveryFilePath = ConfigurationManager.getProperty("dspace.dir") +
|
private static final String reindexDiscoveryFilePath = new DSpace().getConfigurationService().getProperty("dspace.dir") +
|
||||||
File.separator + "solr" +
|
File.separator + "solr" +
|
||||||
File.separator + "search" +
|
File.separator + "search" +
|
||||||
File.separator + "conf" +
|
File.separator + "conf" +
|
||||||
@@ -79,6 +79,8 @@ public class DatabaseUtils
|
|||||||
*/
|
*/
|
||||||
public static void main(String[] argv)
|
public static void main(String[] argv)
|
||||||
{
|
{
|
||||||
|
ConfigurationService config = new DSpace().getConfigurationService();
|
||||||
|
|
||||||
// Usage checks
|
// Usage checks
|
||||||
if (argv.length < 1)
|
if (argv.length < 1)
|
||||||
{
|
{
|
||||||
@@ -370,6 +372,8 @@ public class DatabaseUtils
|
|||||||
*/
|
*/
|
||||||
private synchronized static Flyway setupFlyway(DataSource datasource)
|
private synchronized static Flyway setupFlyway(DataSource datasource)
|
||||||
{
|
{
|
||||||
|
ConfigurationService config = new DSpace().getConfigurationService();
|
||||||
|
|
||||||
if (flywaydb==null)
|
if (flywaydb==null)
|
||||||
{
|
{
|
||||||
try(Connection connection = datasource.getConnection())
|
try(Connection connection = datasource.getConnection())
|
||||||
@@ -391,7 +395,7 @@ public class DatabaseUtils
|
|||||||
// (We skip this for H2 as it's only used for unit testing)
|
// (We skip this for H2 as it's only used for unit testing)
|
||||||
if(!dbType.equals(DBMS_H2))
|
if(!dbType.equals(DBMS_H2))
|
||||||
{
|
{
|
||||||
scriptLocations.add("filesystem:" + ConfigurationManager.getProperty("dspace.dir") +
|
scriptLocations.add("filesystem:" + config.getProperty("dspace.dir") +
|
||||||
"/etc/" + dbType);
|
"/etc/" + dbType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -405,7 +409,8 @@ public class DatabaseUtils
|
|||||||
// Special scenario: If XMLWorkflows are enabled, we need to run its migration(s)
|
// Special scenario: If XMLWorkflows are enabled, we need to run its migration(s)
|
||||||
// as it REQUIRES database schema changes. XMLWorkflow uses Java migrations
|
// as it REQUIRES database schema changes. XMLWorkflow uses Java migrations
|
||||||
// which first check whether the XMLWorkflow tables already exist
|
// which first check whether the XMLWorkflow tables already exist
|
||||||
if (ConfigurationManager.getProperty("workflow", "workflow.framework").equals("xmlworkflow"))
|
String framework = config.getProperty("workflow.framework");
|
||||||
|
if (framework!=null && framework.equals("xmlworkflow"))
|
||||||
{
|
{
|
||||||
scriptLocations.add("classpath:org.dspace.storage.rdbms.xmlworkflow");
|
scriptLocations.add("classpath:org.dspace.storage.rdbms.xmlworkflow");
|
||||||
}
|
}
|
||||||
@@ -1025,7 +1030,7 @@ public class DatabaseUtils
|
|||||||
// If we don't know our schema, let's try the schema in the DSpace configuration
|
// If we don't know our schema, let's try the schema in the DSpace configuration
|
||||||
if(StringUtils.isBlank(schema))
|
if(StringUtils.isBlank(schema))
|
||||||
{
|
{
|
||||||
schema = canonicalize(connection, ConfigurationManager.getProperty("db.schema"));
|
schema = canonicalize(connection, new DSpace().getConfigurationService().getProperty("db.schema"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Still blank? Ok, we'll find a "sane" default based on the DB type
|
// Still blank? Ok, we'll find a "sane" default based on the DB type
|
||||||
|
@@ -18,7 +18,7 @@ import org.dspace.app.xmlui.wing.Message;
|
|||||||
import org.dspace.app.xmlui.wing.WingException;
|
import org.dspace.app.xmlui.wing.WingException;
|
||||||
import org.dspace.app.xmlui.wing.element.*;
|
import org.dspace.app.xmlui.wing.element.*;
|
||||||
import org.dspace.authorize.AuthorizeException;
|
import org.dspace.authorize.AuthorizeException;
|
||||||
import org.dspace.core.ConfigurationManager;
|
import org.dspace.utils.DSpace;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -93,8 +93,7 @@ public class SelectTargetTransformer extends AbstractDSpaceTransformer
|
|||||||
List targetDetails = main.addList("target_details",List.TYPE_FORM);
|
List targetDetails = main.addList("target_details",List.TYPE_FORM);
|
||||||
|
|
||||||
Select source = targetDetails.addItem().addSelect("url");
|
Select source = targetDetails.addItem().addSelect("url");
|
||||||
String targetsString = ConfigurationManager.getProperty("sword-client", "targets");
|
String[] targets = new DSpace().getConfigurationService().getArrayProperty("sword-client.targets");
|
||||||
String[] targets = targetsString.split(",");
|
|
||||||
for (String target : targets)
|
for (String target : targets)
|
||||||
{
|
{
|
||||||
if ((urlValue != null) && (urlValue.length() > 0) && (urlValue.equals(target)))
|
if ((urlValue != null) && (urlValue.length() > 0) && (urlValue.equals(target)))
|
||||||
|
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
package org.dspace.sword.client;
|
package org.dspace.sword.client;
|
||||||
|
|
||||||
import org.dspace.core.ConfigurationManager;
|
|
||||||
import org.purl.sword.base.Collection;
|
import org.purl.sword.base.Collection;
|
||||||
import org.purl.sword.base.ServiceDocument;
|
import org.purl.sword.base.ServiceDocument;
|
||||||
import org.purl.sword.base.SwordAcceptPackaging;
|
import org.purl.sword.base.SwordAcceptPackaging;
|
||||||
@@ -17,6 +16,7 @@ import org.purl.sword.base.Workspace;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import org.dspace.utils.DSpace;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User: Robin Taylor
|
* User: Robin Taylor
|
||||||
@@ -56,8 +56,7 @@ public class ServiceDocumentHelper {
|
|||||||
|
|
||||||
public static String[] getCommonFileTypes(ServiceDocument serviceDoc, String location)
|
public static String[] getCommonFileTypes(ServiceDocument serviceDoc, String location)
|
||||||
{
|
{
|
||||||
String FTsString = ConfigurationManager.getProperty("sword-client", "file-types");
|
String[] clientFTsArray = new DSpace().getConfigurationService().getArrayProperty("sword-client.file-types");
|
||||||
String[] clientFTsArray = FTsString.split(",");
|
|
||||||
List<String> clientFTs = Arrays.asList(clientFTsArray);
|
List<String> clientFTs = Arrays.asList(clientFTsArray);
|
||||||
|
|
||||||
List<String> commonFTs = new ArrayList<String>();
|
List<String> commonFTs = new ArrayList<String>();
|
||||||
@@ -77,8 +76,7 @@ public class ServiceDocumentHelper {
|
|||||||
|
|
||||||
public static String[] getCommonPackageFormats(ServiceDocument serviceDoc, String location)
|
public static String[] getCommonPackageFormats(ServiceDocument serviceDoc, String location)
|
||||||
{
|
{
|
||||||
String PFsString = ConfigurationManager.getProperty("sword-client", "package-formats");
|
String[] clientPFsArray = new DSpace().getConfigurationService().getArrayProperty("sword-client.package-formats");
|
||||||
String[] clientPFsArray = PFsString.split(",");
|
|
||||||
List<String> clientPFs = Arrays.asList(clientPFsArray);
|
List<String> clientPFs = Arrays.asList(clientPFsArray);
|
||||||
|
|
||||||
List<String> commonPFs = new ArrayList<String>();
|
List<String> commonPFs = new ArrayList<String>();
|
||||||
|
Reference in New Issue
Block a user