mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 15:03:18 +00:00
Merge pull request #1317 from tdonohue/DS-3075
DS-3075: Comma-separated configurations now need to be loaded via getArrayProperty()
This commit is contained in:
@@ -14,11 +14,15 @@ import org.dspace.content.Collection;
|
|||||||
import org.dspace.content.Community;
|
import org.dspace.content.Community;
|
||||||
import org.dspace.content.DSpaceObject;
|
import org.dspace.content.DSpaceObject;
|
||||||
import org.dspace.content.Item;
|
import org.dspace.content.Item;
|
||||||
import org.dspace.core.*;
|
import org.dspace.core.Constants;
|
||||||
|
import org.dspace.core.Context;
|
||||||
|
import org.dspace.core.SelfNamedPlugin;
|
||||||
|
import org.dspace.core.factory.CoreServiceFactory;
|
||||||
import org.dspace.handle.factory.HandleServiceFactory;
|
import org.dspace.handle.factory.HandleServiceFactory;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.dspace.core.factory.CoreServiceFactory;
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
|
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MediaFilterManager is the class that invokes the media/format filters over the
|
* MediaFilterManager is the class that invokes the media/format filters over the
|
||||||
@@ -40,7 +44,6 @@ public class MediaFilterCLITool {
|
|||||||
//suffix (in dspace.cfg) for input formats supported by each filter
|
//suffix (in dspace.cfg) for input formats supported by each filter
|
||||||
private static final String INPUT_FORMATS_SUFFIX = "inputFormats";
|
private static final String INPUT_FORMATS_SUFFIX = "inputFormats";
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] argv) throws Exception
|
public static void main(String[] argv) throws Exception
|
||||||
{
|
{
|
||||||
// set headless for non-gui workstations
|
// set headless for non-gui workstations
|
||||||
@@ -162,8 +165,7 @@ public class MediaFilterCLITool {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//retrieve list of all enabled media filter plugins!
|
//retrieve list of all enabled media filter plugins!
|
||||||
String enabledPlugins = ConfigurationManager.getProperty(MEDIA_FILTER_PLUGINS_KEY);
|
filterNames = DSpaceServicesFactory.getInstance().getConfigurationService().getArrayProperty(MEDIA_FILTER_PLUGINS_KEY);
|
||||||
filterNames = enabledPlugins.split(",\\s*");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MediaFilterService mediaFilterService = MediaFilterServiceFactory.getInstance().getMediaFilterService();
|
MediaFilterService mediaFilterService = MediaFilterServiceFactory.getInstance().getMediaFilterService();
|
||||||
@@ -210,13 +212,14 @@ public class MediaFilterCLITool {
|
|||||||
// filter.<class-name>.<plugin-name>.inputFormats
|
// filter.<class-name>.<plugin-name>.inputFormats
|
||||||
//For other MediaFilters, format of key is:
|
//For other MediaFilters, format of key is:
|
||||||
// filter.<class-name>.inputFormats
|
// filter.<class-name>.inputFormats
|
||||||
String formats = ConfigurationManager.getProperty(
|
String[] formats =
|
||||||
|
DSpaceServicesFactory.getInstance().getConfigurationService().getArrayProperty(
|
||||||
FILTER_PREFIX + "." + filterClassName +
|
FILTER_PREFIX + "." + filterClassName +
|
||||||
(pluginName!=null ? "." + pluginName : "") +
|
(pluginName!=null ? "." + pluginName : "") +
|
||||||
"." + INPUT_FORMATS_SUFFIX);
|
"." + INPUT_FORMATS_SUFFIX);
|
||||||
|
|
||||||
//add to internal map of filters to supported formats
|
//add to internal map of filters to supported formats
|
||||||
if (formats != null)
|
if (ArrayUtils.isNotEmpty(formats))
|
||||||
{
|
{
|
||||||
//For SelfNamedPlugins, map key is:
|
//For SelfNamedPlugins, map key is:
|
||||||
// <class-name><separator><plugin-name>
|
// <class-name><separator><plugin-name>
|
||||||
@@ -224,7 +227,7 @@ public class MediaFilterCLITool {
|
|||||||
// <class-name>
|
// <class-name>
|
||||||
filterFormats.put(filterClassName +
|
filterFormats.put(filterClassName +
|
||||||
(pluginName!=null ? MediaFilterService.FILTER_PLUGIN_SEPARATOR + pluginName : ""),
|
(pluginName!=null ? MediaFilterService.FILTER_PLUGIN_SEPARATOR + pluginName : ""),
|
||||||
Arrays.asList(formats.split(",[\\s]*")));
|
Arrays.asList(formats));
|
||||||
}
|
}
|
||||||
}//end if filter!=null
|
}//end if filter!=null
|
||||||
}//end for
|
}//end for
|
||||||
|
@@ -28,6 +28,7 @@ import org.apache.commons.cli.Options;
|
|||||||
import org.apache.commons.cli.ParseException;
|
import org.apache.commons.cli.ParseException;
|
||||||
import org.apache.commons.cli.PosixParser;
|
import org.apache.commons.cli.PosixParser;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.dspace.content.Collection;
|
import org.dspace.content.Collection;
|
||||||
import org.dspace.content.Community;
|
import org.dspace.content.Community;
|
||||||
@@ -36,9 +37,10 @@ import org.dspace.content.factory.ContentServiceFactory;
|
|||||||
import org.dspace.content.service.CollectionService;
|
import org.dspace.content.service.CollectionService;
|
||||||
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.core.LogManager;
|
import org.dspace.core.LogManager;
|
||||||
|
import org.dspace.services.ConfigurationService;
|
||||||
|
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Command-line utility for generating HTML and Sitemaps.org protocol Sitemaps.
|
* Command-line utility for generating HTML and Sitemaps.org protocol Sitemaps.
|
||||||
@@ -54,6 +56,7 @@ public class GenerateSitemaps
|
|||||||
private static final CommunityService communityService = ContentServiceFactory.getInstance().getCommunityService();
|
private static final CommunityService communityService = ContentServiceFactory.getInstance().getCommunityService();
|
||||||
private static final CollectionService collectionService = ContentServiceFactory.getInstance().getCollectionService();
|
private static final CollectionService collectionService = ContentServiceFactory.getInstance().getCollectionService();
|
||||||
private static final ItemService itemService = ContentServiceFactory.getInstance().getItemService();
|
private static final ItemService itemService = ContentServiceFactory.getInstance().getItemService();
|
||||||
|
private static final ConfigurationService configurationService = DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception
|
public static void main(String[] args) throws Exception
|
||||||
{
|
{
|
||||||
@@ -157,14 +160,14 @@ public class GenerateSitemaps
|
|||||||
public static void generateSitemaps(boolean makeHTMLMap,
|
public static void generateSitemaps(boolean makeHTMLMap,
|
||||||
boolean makeSitemapOrg) throws SQLException, IOException
|
boolean makeSitemapOrg) throws SQLException, IOException
|
||||||
{
|
{
|
||||||
String sitemapStem = ConfigurationManager.getProperty("dspace.url")
|
String sitemapStem = configurationService.getProperty("dspace.url")
|
||||||
+ "/sitemap";
|
+ "/sitemap";
|
||||||
String htmlMapStem = ConfigurationManager.getProperty("dspace.url")
|
String htmlMapStem = configurationService.getProperty("dspace.url")
|
||||||
+ "/htmlmap";
|
+ "/htmlmap";
|
||||||
String handleURLStem = ConfigurationManager.getProperty("dspace.url")
|
String handleURLStem = configurationService.getProperty("dspace.url")
|
||||||
+ "/handle/";
|
+ "/handle/";
|
||||||
|
|
||||||
File outputDir = new File(ConfigurationManager.getProperty("sitemap.dir"));
|
File outputDir = new File(configurationService.getProperty("sitemap.dir"));
|
||||||
if (!outputDir.exists() && !outputDir.mkdir())
|
if (!outputDir.exists() && !outputDir.mkdir())
|
||||||
{
|
{
|
||||||
log.error("Unable to create output directory");
|
log.error("Unable to create output directory");
|
||||||
@@ -264,17 +267,10 @@ public class GenerateSitemaps
|
|||||||
public static void pingConfiguredSearchEngines()
|
public static void pingConfiguredSearchEngines()
|
||||||
throws UnsupportedEncodingException
|
throws UnsupportedEncodingException
|
||||||
{
|
{
|
||||||
String engineURLProp = ConfigurationManager
|
String[] engineURLs = configurationService
|
||||||
.getProperty("sitemap.engineurls");
|
.getArrayProperty("sitemap.engineurls");
|
||||||
String engineURLs[] = null;
|
|
||||||
|
|
||||||
if (engineURLProp != null)
|
if (ArrayUtils.isEmpty(engineURLs))
|
||||||
{
|
|
||||||
engineURLs = engineURLProp.trim().split("\\s*,\\s*");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (engineURLProp == null || engineURLs == null
|
|
||||||
|| engineURLs.length == 0 || engineURLs[0].trim().equals(""))
|
|
||||||
{
|
{
|
||||||
log.warn("No search engine URLs configured to ping");
|
log.warn("No search engine URLs configured to ping");
|
||||||
return;
|
return;
|
||||||
@@ -309,17 +305,17 @@ public class GenerateSitemaps
|
|||||||
throws MalformedURLException, UnsupportedEncodingException
|
throws MalformedURLException, UnsupportedEncodingException
|
||||||
{
|
{
|
||||||
// Set up HTTP proxy
|
// Set up HTTP proxy
|
||||||
if ((StringUtils.isNotBlank(ConfigurationManager.getProperty("http.proxy.host")))
|
if ((StringUtils.isNotBlank(configurationService.getProperty("http.proxy.host")))
|
||||||
&& (StringUtils.isNotBlank(ConfigurationManager.getProperty("http.proxy.port"))))
|
&& (StringUtils.isNotBlank(configurationService.getProperty("http.proxy.port"))))
|
||||||
{
|
{
|
||||||
System.setProperty("proxySet", "true");
|
System.setProperty("proxySet", "true");
|
||||||
System.setProperty("proxyHost", ConfigurationManager
|
System.setProperty("proxyHost", configurationService
|
||||||
.getProperty("http.proxy.host"));
|
.getProperty("http.proxy.host"));
|
||||||
System.getProperty("proxyPort", ConfigurationManager
|
System.getProperty("proxyPort", configurationService
|
||||||
.getProperty("http.proxy.port"));
|
.getProperty("http.proxy.port"));
|
||||||
}
|
}
|
||||||
|
|
||||||
String sitemapURL = ConfigurationManager.getProperty("dspace.url")
|
String sitemapURL = configurationService.getProperty("dspace.url")
|
||||||
+ "/sitemap";
|
+ "/sitemap";
|
||||||
|
|
||||||
URL url = new URL(engineURL + URLEncoder.encode(sitemapURL, "UTF-8"));
|
URL url = new URL(engineURL + URLEncoder.encode(sitemapURL, "UTF-8"));
|
||||||
|
@@ -50,6 +50,8 @@ import com.sun.syndication.io.SyndFeedOutput;
|
|||||||
import com.sun.syndication.io.FeedException;
|
import com.sun.syndication.io.FeedException;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
import org.dspace.services.ConfigurationService;
|
||||||
|
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoke ROME library to assemble a generic model of a syndication
|
* Invoke ROME library to assemble a generic model of a syndication
|
||||||
@@ -83,38 +85,43 @@ public class SyndicationFeed
|
|||||||
protected String defaultTitleField = "dc.title";
|
protected String defaultTitleField = "dc.title";
|
||||||
protected String defaultAuthorField = "dc.contributor.author";
|
protected String defaultAuthorField = "dc.contributor.author";
|
||||||
protected String defaultDateField = "dc.date.issued";
|
protected String defaultDateField = "dc.date.issued";
|
||||||
private static String defaultDescriptionFields = "dc.description.abstract, dc.description, dc.title.alternative, dc.title";
|
private static final String[] defaultDescriptionFields = new String[]{"dc.description.abstract", "dc.description", "dc.title.alternative", "dc.title"};
|
||||||
protected String defaultExternalMedia = "dc.source.uri";
|
protected String defaultExternalMedia = "dc.source.uri";
|
||||||
|
|
||||||
|
private final ConfigurationService configurationService =
|
||||||
|
DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||||
|
|
||||||
// metadata field for Item title in entry:
|
// metadata field for Item title in entry:
|
||||||
protected String titleField =
|
protected String titleField =
|
||||||
getDefaultedConfiguration("webui.feed.item.title", defaultTitleField);
|
configurationService.getProperty("webui.feed.item.title", defaultTitleField);
|
||||||
|
|
||||||
// metadata field for Item publication date in entry:
|
// metadata field for Item publication date in entry:
|
||||||
protected String dateField =
|
protected String dateField =
|
||||||
getDefaultedConfiguration("webui.feed.item.date", defaultDateField);
|
configurationService.getProperty("webui.feed.item.date", defaultDateField);
|
||||||
|
|
||||||
// metadata field for Item description in entry:
|
// metadata field for Item description in entry:
|
||||||
private static String descriptionFields[] =
|
private static final String descriptionFields[] =
|
||||||
getDefaultedConfiguration("webui.feed.item.description", defaultDescriptionFields).split("\\s*,\\s*");
|
DSpaceServicesFactory.getInstance().getConfigurationService().getArrayProperty("webui.feed.item.description", defaultDescriptionFields);
|
||||||
|
|
||||||
protected String authorField =
|
protected String authorField =
|
||||||
getDefaultedConfiguration("webui.feed.item.author", defaultAuthorField);
|
configurationService.getProperty("webui.feed.item.author", defaultAuthorField);
|
||||||
|
|
||||||
// metadata field for Podcast external media source url
|
// metadata field for Podcast external media source url
|
||||||
protected String externalSourceField = getDefaultedConfiguration("webui.feed.podcast.sourceuri", defaultExternalMedia);
|
protected String externalSourceField =
|
||||||
|
configurationService.getProperty("webui.feed.podcast.sourceuri", defaultExternalMedia);
|
||||||
|
|
||||||
// metadata field for Item dc:creator field in entry's DCModule (no default)
|
// metadata field for Item dc:creator field in entry's DCModule (no default)
|
||||||
protected String dcCreatorField = ConfigurationManager.getProperty("webui.feed.item.dc.creator");
|
protected String dcCreatorField = configurationService.getProperty("webui.feed.item.dc.creator");
|
||||||
|
|
||||||
// metadata field for Item dc:date field in entry's DCModule (no default)
|
// metadata field for Item dc:date field in entry's DCModule (no default)
|
||||||
protected String dcDateField = ConfigurationManager.getProperty("webui.feed.item.dc.date");
|
protected String dcDateField = configurationService.getProperty("webui.feed.item.dc.date");
|
||||||
|
|
||||||
// metadata field for Item dc:author field in entry's DCModule (no default)
|
// metadata field for Item dc:author field in entry's DCModule (no default)
|
||||||
protected String dcDescriptionField = ConfigurationManager.getProperty("webui.feed.item.dc.description");
|
protected String dcDescriptionField = configurationService.getProperty("webui.feed.item.dc.description");
|
||||||
|
|
||||||
// List of available mimetypes that we'll add to podcast feed. Multiple values separated by commas
|
// List of available mimetypes that we'll add to podcast feed. Multiple values separated by commas
|
||||||
protected String podcastableMIMETypes = getDefaultedConfiguration("webui.feed.podcast.mimetypes", "audio/x-mpeg");
|
protected String[] podcastableMIMETypes =
|
||||||
|
configurationService.getArrayProperty("webui.feed.podcast.mimetypes", new String[]{"audio/x-mpeg"});
|
||||||
|
|
||||||
// -------- Instance variables:
|
// -------- Instance variables:
|
||||||
|
|
||||||
@@ -374,7 +381,7 @@ public class SyndicationFeed
|
|||||||
List<Bitstream> bits = bunds.get(0).getBitstreams();
|
List<Bitstream> bits = bunds.get(0).getBitstreams();
|
||||||
for (Bitstream bit : bits) {
|
for (Bitstream bit : bits) {
|
||||||
String mime = bit.getFormat(context).getMIMEType();
|
String mime = bit.getFormat(context).getMIMEType();
|
||||||
if (podcastableMIMETypes.contains(mime)) {
|
if (ArrayUtils.contains(podcastableMIMETypes,mime)) {
|
||||||
SyndEnclosure enc = new SyndEnclosureImpl();
|
SyndEnclosure enc = new SyndEnclosureImpl();
|
||||||
enc.setType(bit.getFormat(context).getMIMEType());
|
enc.setType(bit.getFormat(context).getMIMEType());
|
||||||
enc.setLength(bit.getSize());
|
enc.setLength(bit.getSize());
|
||||||
|
@@ -93,7 +93,7 @@ public class IPAuthentication implements AuthenticationMethod
|
|||||||
|
|
||||||
if (nameParts.length == 2)
|
if (nameParts.length == 2)
|
||||||
{
|
{
|
||||||
addMatchers(nameParts[1], DSpaceServicesFactory.getInstance().getConfigurationService().getProperty(propName));
|
addMatchers(nameParts[1], DSpaceServicesFactory.getInstance().getConfigurationService().getArrayProperty(propName));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -111,11 +111,9 @@ public class IPAuthentication implements AuthenticationMethod
|
|||||||
* @param ipRanges
|
* @param ipRanges
|
||||||
* IP ranges
|
* IP ranges
|
||||||
*/
|
*/
|
||||||
protected void addMatchers(String groupName, String ipRanges)
|
protected void addMatchers(String groupName, String[] ipRanges)
|
||||||
{
|
{
|
||||||
String[] ranges = ipRanges.split("\\s*,\\s*");
|
for (String entry : ipRanges)
|
||||||
|
|
||||||
for (String entry : ranges)
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@@ -30,11 +30,11 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import org.apache.commons.collections.ListUtils;
|
import org.apache.commons.collections.ListUtils;
|
||||||
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.dspace.authenticate.factory.AuthenticateServiceFactory;
|
import org.dspace.authenticate.factory.AuthenticateServiceFactory;
|
||||||
import org.dspace.authenticate.service.AuthenticationService;
|
import org.dspace.authenticate.service.AuthenticationService;
|
||||||
import org.dspace.authorize.AuthorizeException;
|
import org.dspace.authorize.AuthorizeException;
|
||||||
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;
|
||||||
@@ -42,6 +42,8 @@ import org.dspace.eperson.Group;
|
|||||||
import org.dspace.eperson.factory.EPersonServiceFactory;
|
import org.dspace.eperson.factory.EPersonServiceFactory;
|
||||||
import org.dspace.eperson.service.EPersonService;
|
import org.dspace.eperson.service.EPersonService;
|
||||||
import org.dspace.eperson.service.GroupService;
|
import org.dspace.eperson.service.GroupService;
|
||||||
|
import org.dspace.services.ConfigurationService;
|
||||||
|
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implicit authentication method that gets credentials from the X.509 client
|
* Implicit authentication method that gets credentials from the X.509 client
|
||||||
@@ -118,6 +120,8 @@ public class X509Authentication implements AuthenticationMethod
|
|||||||
protected AuthenticationService authenticationService = AuthenticateServiceFactory.getInstance().getAuthenticationService();
|
protected AuthenticationService authenticationService = AuthenticateServiceFactory.getInstance().getAuthenticationService();
|
||||||
protected EPersonService ePersonService = EPersonServiceFactory.getInstance().getEPersonService();
|
protected EPersonService ePersonService = EPersonServiceFactory.getInstance().getEPersonService();
|
||||||
protected GroupService groupService = EPersonServiceFactory.getInstance().getGroupService();
|
protected GroupService groupService = EPersonServiceFactory.getInstance().getGroupService();
|
||||||
|
protected ConfigurationService configurationService =
|
||||||
|
DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -127,21 +131,23 @@ public class X509Authentication implements AuthenticationMethod
|
|||||||
*/
|
*/
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
|
ConfigurationService configurationService =
|
||||||
|
DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||||
/*
|
/*
|
||||||
* allow identification of alternative entry points for certificate
|
* allow identification of alternative entry points for certificate
|
||||||
* authentication when selected by the user rather than implicitly.
|
* authentication when selected by the user rather than implicitly.
|
||||||
*/
|
*/
|
||||||
loginPageTitle = ConfigurationManager
|
loginPageTitle = configurationService
|
||||||
.getProperty("authentication-x509", "chooser.title.key");
|
.getProperty("authentication-x509.chooser.title.key");
|
||||||
loginPageURL = ConfigurationManager
|
loginPageURL = configurationService
|
||||||
.getProperty("authentication-x509", "chooser.uri");
|
.getProperty("authentication-x509.chooser.uri");
|
||||||
|
|
||||||
String keystorePath = ConfigurationManager
|
String keystorePath = configurationService
|
||||||
.getProperty("authentication-x509", "keystore.path");
|
.getProperty("authentication-x509.keystore.path");
|
||||||
String keystorePassword = ConfigurationManager
|
String keystorePassword = configurationService
|
||||||
.getProperty("authentication-x509", "keystore.password");
|
.getProperty("authentication-x509.keystore.password");
|
||||||
String caCertPath = ConfigurationManager
|
String caCertPath = configurationService
|
||||||
.getProperty("authentication-x509", "ca.cert");
|
.getProperty("authentication-x509.ca.cert");
|
||||||
|
|
||||||
// First look for keystore full of trusted certs.
|
// First look for keystore full of trusted certs.
|
||||||
if (keystorePath != null)
|
if (keystorePath != null)
|
||||||
@@ -386,8 +392,8 @@ public class X509Authentication implements AuthenticationMethod
|
|||||||
public boolean canSelfRegister(Context context, HttpServletRequest request,
|
public boolean canSelfRegister(Context context, HttpServletRequest request,
|
||||||
String username) throws SQLException
|
String username) throws SQLException
|
||||||
{
|
{
|
||||||
return ConfigurationManager
|
return configurationService
|
||||||
.getBooleanProperty("authentication-x509", "autoregister");
|
.getBooleanProperty("authentication-x509.autoregister");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -428,17 +434,14 @@ public class X509Authentication implements AuthenticationMethod
|
|||||||
{
|
{
|
||||||
List<String> groupNames = new ArrayList<String>();
|
List<String> groupNames = new ArrayList<String>();
|
||||||
|
|
||||||
String x509GroupConfig = null;
|
String[] groups = configurationService
|
||||||
x509GroupConfig = ConfigurationManager
|
.getArrayProperty("authentication-x509.groups");
|
||||||
.getProperty("authentication-x509", "groups");
|
|
||||||
|
|
||||||
if (null != x509GroupConfig && !"".equals(x509GroupConfig))
|
if(ArrayUtils.isNotEmpty(groups))
|
||||||
{
|
{
|
||||||
String[] groups = x509GroupConfig.split("\\s*,\\s*");
|
for (String group : groups)
|
||||||
|
|
||||||
for (int i = 0; i < groups.length; i++)
|
|
||||||
{
|
{
|
||||||
groupNames.add(groups[i].trim());
|
groupNames.add(group.trim());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -69,7 +69,6 @@ import org.dspace.content.crosswalk.StreamDisseminationCrosswalk;
|
|||||||
import org.dspace.content.factory.ContentServiceFactory;
|
import org.dspace.content.factory.ContentServiceFactory;
|
||||||
import org.dspace.content.service.BitstreamService;
|
import org.dspace.content.service.BitstreamService;
|
||||||
import org.dspace.content.service.SiteService;
|
import org.dspace.content.service.SiteService;
|
||||||
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.LogManager;
|
import org.dspace.core.LogManager;
|
||||||
@@ -78,6 +77,8 @@ import org.dspace.core.factory.CoreServiceFactory;
|
|||||||
import org.dspace.core.service.PluginService;
|
import org.dspace.core.service.PluginService;
|
||||||
import org.dspace.license.factory.LicenseServiceFactory;
|
import org.dspace.license.factory.LicenseServiceFactory;
|
||||||
import org.dspace.license.service.CreativeCommonsService;
|
import org.dspace.license.service.CreativeCommonsService;
|
||||||
|
import org.dspace.services.ConfigurationService;
|
||||||
|
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
import org.jdom.Namespace;
|
import org.jdom.Namespace;
|
||||||
import org.jdom.output.Format;
|
import org.jdom.output.Format;
|
||||||
@@ -128,6 +129,7 @@ public abstract class AbstractMETSDisseminator
|
|||||||
protected final BitstreamService bitstreamService = ContentServiceFactory.getInstance().getBitstreamService();
|
protected final BitstreamService bitstreamService = ContentServiceFactory.getInstance().getBitstreamService();
|
||||||
protected final SiteService siteService = ContentServiceFactory.getInstance().getSiteService();
|
protected final SiteService siteService = ContentServiceFactory.getInstance().getSiteService();
|
||||||
protected final CreativeCommonsService creativeCommonsService = LicenseServiceFactory.getInstance().getCreativeCommonsService();
|
protected final CreativeCommonsService creativeCommonsService = LicenseServiceFactory.getInstance().getCreativeCommonsService();
|
||||||
|
protected final ConfigurationService configurationService = DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||||
|
|
||||||
// for gensym()
|
// for gensym()
|
||||||
protected int idCounter = 1;
|
protected int idCounter = 1;
|
||||||
@@ -1498,7 +1500,7 @@ public abstract class AbstractMETSDisseminator
|
|||||||
}
|
}
|
||||||
if (handle != null)
|
if (handle != null)
|
||||||
{
|
{
|
||||||
return ConfigurationManager
|
return configurationService
|
||||||
.getProperty("dspace.url")
|
.getProperty("dspace.url")
|
||||||
+ "/bitstream/"
|
+ "/bitstream/"
|
||||||
+ handle
|
+ handle
|
||||||
@@ -1510,7 +1512,7 @@ public abstract class AbstractMETSDisseminator
|
|||||||
else
|
else
|
||||||
{ //no Handle assigned, so persistent(-ish) URI for bitstream is
|
{ //no Handle assigned, so persistent(-ish) URI for bitstream is
|
||||||
// Format: {site-base-url}/retrieve/{bitstream-internal-id}
|
// Format: {site-base-url}/retrieve/{bitstream-internal-id}
|
||||||
return ConfigurationManager
|
return configurationService
|
||||||
.getProperty("dspace.url")
|
.getProperty("dspace.url")
|
||||||
+ "/retrieve/"
|
+ "/retrieve/"
|
||||||
+ String.valueOf(bitstream.getID());
|
+ String.valueOf(bitstream.getID());
|
||||||
|
@@ -25,7 +25,6 @@ import org.dspace.content.Collection;
|
|||||||
import org.dspace.content.Community;
|
import org.dspace.content.Community;
|
||||||
import org.dspace.content.crosswalk.CrosswalkException;
|
import org.dspace.content.crosswalk.CrosswalkException;
|
||||||
import org.dspace.core.Constants;
|
import org.dspace.core.Constants;
|
||||||
import org.dspace.core.ConfigurationManager;
|
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
|
|
||||||
import edu.harvard.hul.ois.mets.Agent;
|
import edu.harvard.hul.ois.mets.Agent;
|
||||||
@@ -41,7 +40,10 @@ import edu.harvard.hul.ois.mets.Type;
|
|||||||
import edu.harvard.hul.ois.mets.helper.MetsException;
|
import edu.harvard.hul.ois.mets.helper.MetsException;
|
||||||
import edu.harvard.hul.ois.mets.helper.PCData;
|
import edu.harvard.hul.ois.mets.helper.PCData;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
import org.dspace.core.Utils;
|
import org.dspace.core.Utils;
|
||||||
|
import org.dspace.services.ConfigurationService;
|
||||||
|
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subclass of the METS packager framework to disseminate a DSpace
|
* Subclass of the METS packager framework to disseminate a DSpace
|
||||||
@@ -118,6 +120,10 @@ public class DSpaceAIPDisseminator extends AbstractMETSDisseminator
|
|||||||
// Whether 'filterBundles' specifies an exclusion list (default) or inclusion list.
|
// Whether 'filterBundles' specifies an exclusion list (default) or inclusion list.
|
||||||
protected boolean excludeBundles = true;
|
protected boolean excludeBundles = true;
|
||||||
|
|
||||||
|
protected ConfigurationService configurationService =
|
||||||
|
DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disseminate(Context context, DSpaceObject dso,
|
public void disseminate(Context context, DSpaceObject dso,
|
||||||
PackageParameters params, File pkgFile)
|
PackageParameters params, File pkgFile)
|
||||||
@@ -257,17 +263,14 @@ public class DSpaceAIPDisseminator extends AbstractMETSDisseminator
|
|||||||
public String [] getDmdTypes(Context context, DSpaceObject dso, PackageParameters params)
|
public String [] getDmdTypes(Context context, DSpaceObject dso, PackageParameters params)
|
||||||
throws SQLException, IOException, AuthorizeException
|
throws SQLException, IOException, AuthorizeException
|
||||||
{
|
{
|
||||||
String dmdTypes = ConfigurationManager.getProperty("aip.disseminate.dmd");
|
String[] dmdTypes = configurationService.getArrayProperty("aip.disseminate.dmd");
|
||||||
if (dmdTypes == null)
|
if (ArrayUtils.isEmpty(dmdTypes))
|
||||||
{
|
{
|
||||||
String result[] = new String[2];
|
return new String[] { "MODS","DIM"};
|
||||||
result[0] = "MODS";
|
|
||||||
result[1] = "DIM";
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return dmdTypes.split("\\s*,\\s*");
|
return dmdTypes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,14 +292,12 @@ public class DSpaceAIPDisseminator extends AbstractMETSDisseminator
|
|||||||
public String[] getTechMdTypes(Context context, DSpaceObject dso, PackageParameters params)
|
public String[] getTechMdTypes(Context context, DSpaceObject dso, PackageParameters params)
|
||||||
throws SQLException, IOException, AuthorizeException
|
throws SQLException, IOException, AuthorizeException
|
||||||
{
|
{
|
||||||
String techTypes = ConfigurationManager.getProperty("aip.disseminate.techMD");
|
String[] techTypes = configurationService.getArrayProperty("aip.disseminate.techMD");
|
||||||
if (techTypes == null)
|
if (ArrayUtils.isEmpty(techTypes))
|
||||||
{
|
{
|
||||||
if (dso.getType() == Constants.BITSTREAM)
|
if (dso.getType() == Constants.BITSTREAM)
|
||||||
{
|
{
|
||||||
String result[] = new String[1];
|
return new String[]{"PREMIS"};
|
||||||
result[0] = "PREMIS";
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -305,7 +306,7 @@ public class DSpaceAIPDisseminator extends AbstractMETSDisseminator
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return techTypes.split("\\s*,\\s*");
|
return techTypes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -331,16 +332,14 @@ public class DSpaceAIPDisseminator extends AbstractMETSDisseminator
|
|||||||
public String[] getSourceMdTypes(Context context, DSpaceObject dso, PackageParameters params)
|
public String[] getSourceMdTypes(Context context, DSpaceObject dso, PackageParameters params)
|
||||||
throws SQLException, IOException, AuthorizeException
|
throws SQLException, IOException, AuthorizeException
|
||||||
{
|
{
|
||||||
String sourceTypes = ConfigurationManager.getProperty("aip.disseminate.sourceMD");
|
String[] sourceTypes = configurationService.getArrayProperty("aip.disseminate.sourceMD");
|
||||||
if (sourceTypes == null)
|
if (ArrayUtils.isEmpty(sourceTypes))
|
||||||
{
|
{
|
||||||
String result[] = new String[1];
|
return new String[] {"AIP-TECHMD"};
|
||||||
result[0] = "AIP-TECHMD";
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return sourceTypes.split("\\s*,\\s*");
|
return sourceTypes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -362,14 +361,14 @@ public class DSpaceAIPDisseminator extends AbstractMETSDisseminator
|
|||||||
public String[] getDigiprovMdTypes(Context context, DSpaceObject dso, PackageParameters params)
|
public String[] getDigiprovMdTypes(Context context, DSpaceObject dso, PackageParameters params)
|
||||||
throws SQLException, IOException, AuthorizeException
|
throws SQLException, IOException, AuthorizeException
|
||||||
{
|
{
|
||||||
String dpTypes = ConfigurationManager.getProperty("aip.disseminate.digiprovMD");
|
String[] dpTypes = configurationService.getArrayProperty("aip.disseminate.digiprovMD");
|
||||||
if (dpTypes == null)
|
if (ArrayUtils.isEmpty(dpTypes))
|
||||||
{
|
{
|
||||||
return new String[0];
|
return new String[0];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return dpTypes.split("\\s*,\\s*");
|
return dpTypes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -394,10 +393,10 @@ public class DSpaceAIPDisseminator extends AbstractMETSDisseminator
|
|||||||
{
|
{
|
||||||
|
|
||||||
List<String> result = new ArrayList<String>();
|
List<String> result = new ArrayList<String>();
|
||||||
String rTypes = ConfigurationManager.getProperty("aip.disseminate.rightsMD");
|
String[] rTypes = configurationService.getArrayProperty("aip.disseminate.rightsMD");
|
||||||
|
|
||||||
//If unspecified in configuration file, add default settings
|
//If unspecified in configuration file, add default settings
|
||||||
if (rTypes == null)
|
if (ArrayUtils.isEmpty(rTypes))
|
||||||
{
|
{
|
||||||
// Licenses only apply to an Item
|
// Licenses only apply to an Item
|
||||||
if (dso.getType() == Constants.ITEM)
|
if (dso.getType() == Constants.ITEM)
|
||||||
@@ -424,7 +423,7 @@ public class DSpaceAIPDisseminator extends AbstractMETSDisseminator
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return rTypes.split("\\s*,\\s*");
|
return rTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result.toArray(new String[result.size()]);
|
return result.toArray(new String[result.size()]);
|
||||||
|
@@ -11,15 +11,17 @@ import org.apache.log4j.Logger;
|
|||||||
import org.dspace.content.MetadataValue;
|
import org.dspace.content.MetadataValue;
|
||||||
import org.dspace.content.DSpaceObject;
|
import org.dspace.content.DSpaceObject;
|
||||||
import org.dspace.content.Item;
|
import org.dspace.content.Item;
|
||||||
import org.dspace.core.ConfigurationManager;
|
|
||||||
import org.dspace.curate.AbstractCurationTask;
|
import org.dspace.curate.AbstractCurationTask;
|
||||||
import org.dspace.curate.Curator;
|
import org.dspace.curate.Curator;
|
||||||
import org.dspace.curate.Distributive;
|
import org.dspace.curate.Distributive;
|
||||||
|
import org.dspace.services.ConfigurationService;
|
||||||
|
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MicrosoftTranslator translates stuff
|
* MicrosoftTranslator translates stuff
|
||||||
*
|
*
|
||||||
@@ -43,6 +45,9 @@ public abstract class AbstractTranslator extends AbstractCurationTask
|
|||||||
|
|
||||||
protected List<String> results = new ArrayList<String>();
|
protected List<String> results = new ArrayList<String>();
|
||||||
|
|
||||||
|
private final transient ConfigurationService configurationService
|
||||||
|
= DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(Curator curator, String taskId) throws IOException
|
public void init(Curator curator, String taskId) throws IOException
|
||||||
@@ -50,12 +55,10 @@ public abstract class AbstractTranslator extends AbstractCurationTask
|
|||||||
super.init(curator, taskId);
|
super.init(curator, taskId);
|
||||||
|
|
||||||
// Load configuration
|
// Load configuration
|
||||||
authLang = ConfigurationManager.getProperty("default.locale");
|
authLang = configurationService.getProperty("default.locale");
|
||||||
authLangField = ConfigurationManager.getProperty(PLUGIN_PREFIX, "field.language");
|
authLangField = configurationService.getProperty(PLUGIN_PREFIX + ".field.language");
|
||||||
String toTranslateStr = ConfigurationManager.getProperty(PLUGIN_PREFIX, "field.targets");
|
String[] toTranslate = configurationService.getArrayProperty(PLUGIN_PREFIX + ".field.targets");
|
||||||
String langsStr = ConfigurationManager.getProperty(PLUGIN_PREFIX, "language.targets");
|
String[] langs = configurationService.getArrayProperty(PLUGIN_PREFIX + ".language.targets");
|
||||||
toTranslate = toTranslateStr.split(",");
|
|
||||||
langs = langsStr.split(",");
|
|
||||||
|
|
||||||
if(!(toTranslate.length > 0 && langs.length > 0))
|
if(!(toTranslate.length > 0 && langs.length > 0))
|
||||||
{
|
{
|
||||||
|
@@ -25,7 +25,6 @@ import org.dspace.authorize.AuthorizeException;
|
|||||||
import org.dspace.content.*;
|
import org.dspace.content.*;
|
||||||
import org.dspace.content.factory.ContentServiceFactory;
|
import org.dspace.content.factory.ContentServiceFactory;
|
||||||
import org.dspace.content.service.BitstreamService;
|
import org.dspace.content.service.BitstreamService;
|
||||||
import org.dspace.core.ConfigurationManager;
|
|
||||||
import org.dspace.curate.AbstractCurationTask;
|
import org.dspace.curate.AbstractCurationTask;
|
||||||
import org.dspace.curate.Curator;
|
import org.dspace.curate.Curator;
|
||||||
import org.dspace.curate.Suspendable;
|
import org.dspace.curate.Suspendable;
|
||||||
@@ -74,10 +73,10 @@ public class ClamScan extends AbstractCurationTask
|
|||||||
public void init(Curator curator, String taskId) throws IOException
|
public void init(Curator curator, String taskId) throws IOException
|
||||||
{
|
{
|
||||||
super.init(curator, taskId);
|
super.init(curator, taskId);
|
||||||
host = ConfigurationManager.getProperty(PLUGIN_PREFIX, "service.host");
|
host = configurationService.getProperty(PLUGIN_PREFIX + ".service.host");
|
||||||
port = ConfigurationManager.getIntProperty(PLUGIN_PREFIX, "service.port");
|
port = configurationService.getIntProperty(PLUGIN_PREFIX + ".service.port");
|
||||||
timeout = ConfigurationManager.getIntProperty(PLUGIN_PREFIX, "socket.timeout");
|
timeout = configurationService.getIntProperty(PLUGIN_PREFIX + ".socket.timeout");
|
||||||
failfast = ConfigurationManager.getBooleanProperty(PLUGIN_PREFIX, "scan.failfast");
|
failfast = configurationService.getBooleanProperty(PLUGIN_PREFIX + ".scan.failfast");
|
||||||
bitstreamService = ContentServiceFactory.getInstance().getBitstreamService();
|
bitstreamService = ContentServiceFactory.getInstance().getBitstreamService();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -48,7 +48,6 @@ import org.xml.sax.SAXException;
|
|||||||
import org.dspace.authorize.AuthorizeException;
|
import org.dspace.authorize.AuthorizeException;
|
||||||
import org.dspace.content.DSpaceObject;
|
import org.dspace.content.DSpaceObject;
|
||||||
import org.dspace.content.Item;
|
import org.dspace.content.Item;
|
||||||
import org.dspace.core.ConfigurationManager;
|
|
||||||
import org.dspace.core.Constants;
|
import org.dspace.core.Constants;
|
||||||
import org.dspace.curate.AbstractCurationTask;
|
import org.dspace.curate.AbstractCurationTask;
|
||||||
import org.dspace.curate.Curator;
|
import org.dspace.curate.Curator;
|
||||||
@@ -167,7 +166,7 @@ public class MetadataWebService extends AbstractCurationTask implements Namespac
|
|||||||
@Override
|
@Override
|
||||||
public void init(Curator curator, String taskId) throws IOException {
|
public void init(Curator curator, String taskId) throws IOException {
|
||||||
super.init(curator, taskId);
|
super.init(curator, taskId);
|
||||||
lang = ConfigurationManager.getProperty("default.language");
|
lang = configurationService.getProperty("default.language");
|
||||||
String fldSep = taskProperty("separator");
|
String fldSep = taskProperty("separator");
|
||||||
fieldSeparator = (fldSep != null) ? fldSep : " ";
|
fieldSeparator = (fldSep != null) ? fldSep : " ";
|
||||||
urlTemplate = taskProperty("template");
|
urlTemplate = taskProperty("template");
|
||||||
@@ -177,7 +176,7 @@ public class MetadataWebService extends AbstractCurationTask implements Namespac
|
|||||||
lookupField = parsed[0];
|
lookupField = parsed[0];
|
||||||
lookupTransform = parsed[1];
|
lookupTransform = parsed[1];
|
||||||
dataList = new ArrayList<DataInfo>();
|
dataList = new ArrayList<DataInfo>();
|
||||||
for (String entry : taskProperty("datamap").split(",")) {
|
for (String entry : taskArrayProperty("datamap")) {
|
||||||
entry = entry.trim();
|
entry = entry.trim();
|
||||||
String src = entry;
|
String src = entry;
|
||||||
String mapping = null;
|
String mapping = null;
|
||||||
|
@@ -11,8 +11,8 @@ import java.io.IOException;
|
|||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.dspace.content.Collection;
|
import org.dspace.content.Collection;
|
||||||
@@ -22,11 +22,12 @@ import org.dspace.content.Item;
|
|||||||
import org.dspace.content.factory.ContentServiceFactory;
|
import org.dspace.content.factory.ContentServiceFactory;
|
||||||
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.Constants;
|
import org.dspace.core.Constants;
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
import org.dspace.handle.factory.HandleServiceFactory;
|
import org.dspace.handle.factory.HandleServiceFactory;
|
||||||
import org.dspace.handle.service.HandleService;
|
import org.dspace.handle.service.HandleService;
|
||||||
|
import org.dspace.services.ConfigurationService;
|
||||||
|
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AbstractCurationTask encapsulates a few common patterns of task use,
|
* AbstractCurationTask encapsulates a few common patterns of task use,
|
||||||
@@ -40,14 +41,12 @@ public abstract class AbstractCurationTask implements CurationTask
|
|||||||
protected Curator curator = null;
|
protected Curator curator = null;
|
||||||
// curator-assigned taskId
|
// curator-assigned taskId
|
||||||
protected String taskId = null;
|
protected String taskId = null;
|
||||||
// optional task configuration properties
|
|
||||||
private Properties taskProps = null;
|
|
||||||
// logger
|
// logger
|
||||||
private static Logger log = Logger.getLogger(AbstractCurationTask.class);
|
private static Logger log = Logger.getLogger(AbstractCurationTask.class);
|
||||||
protected CommunityService communityService;
|
protected CommunityService communityService;
|
||||||
protected ItemService itemService;
|
protected ItemService itemService;
|
||||||
protected HandleService handleService;
|
protected HandleService handleService;
|
||||||
|
protected ConfigurationService configurationService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(Curator curator, String taskId) throws IOException
|
public void init(Curator curator, String taskId) throws IOException
|
||||||
@@ -57,6 +56,7 @@ public abstract class AbstractCurationTask implements CurationTask
|
|||||||
communityService = ContentServiceFactory.getInstance().getCommunityService();
|
communityService = ContentServiceFactory.getInstance().getCommunityService();
|
||||||
itemService = ContentServiceFactory.getInstance().getItemService();
|
itemService = ContentServiceFactory.getInstance().getItemService();
|
||||||
handleService = HandleServiceFactory.getInstance().getHandleService();
|
handleService = HandleServiceFactory.getInstance().getHandleService();
|
||||||
|
configurationService = DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -235,29 +235,15 @@ public abstract class AbstractCurationTask implements CurationTask
|
|||||||
*/
|
*/
|
||||||
protected String taskProperty(String name)
|
protected String taskProperty(String name)
|
||||||
{
|
{
|
||||||
if (taskProps == null)
|
// If a taskID/Name is specified, prepend it on the configuration name
|
||||||
|
if(StringUtils.isNotBlank(taskId))
|
||||||
{
|
{
|
||||||
// load properties
|
return configurationService.getProperty(taskId + "." + name);
|
||||||
taskProps = new Properties();
|
}
|
||||||
StringBuilder modName = new StringBuilder();
|
else
|
||||||
for (String segment : taskId.split("\\."))
|
|
||||||
{
|
{
|
||||||
// load property segments if present
|
return configurationService.getProperty(name);
|
||||||
modName.append(segment);
|
|
||||||
Properties modProps = ConfigurationManager.getProperties(modName.toString());
|
|
||||||
if (modProps != null)
|
|
||||||
{
|
|
||||||
taskProps.putAll(modProps);
|
|
||||||
}
|
}
|
||||||
modName.append(".");
|
|
||||||
}
|
|
||||||
// warn if *no* properties found
|
|
||||||
if (taskProps.size() == 0)
|
|
||||||
{
|
|
||||||
log.warn("Warning: No configuration properties found for task: " + taskId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return taskProps.getProperty(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -274,20 +260,15 @@ public abstract class AbstractCurationTask implements CurationTask
|
|||||||
*/
|
*/
|
||||||
protected int taskIntProperty(String name, int defaultValue)
|
protected int taskIntProperty(String name, int defaultValue)
|
||||||
{
|
{
|
||||||
int intVal = defaultValue;
|
// If a taskID/Name is specified, prepend it on the configuration name
|
||||||
String strVal = taskProperty(name);
|
if(StringUtils.isNotBlank(taskId))
|
||||||
if (strVal != null)
|
|
||||||
{
|
{
|
||||||
try
|
return configurationService.getIntProperty(taskId + "." + name, defaultValue);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
intVal = Integer.parseInt(strVal.trim());
|
return configurationService.getIntProperty(name, defaultValue);
|
||||||
}
|
}
|
||||||
catch(NumberFormatException nfE)
|
|
||||||
{
|
|
||||||
log.warn("Warning: Number format error in module: " + taskId + " property: " + name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return intVal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -304,20 +285,15 @@ public abstract class AbstractCurationTask implements CurationTask
|
|||||||
*/
|
*/
|
||||||
protected long taskLongProperty(String name, long defaultValue)
|
protected long taskLongProperty(String name, long defaultValue)
|
||||||
{
|
{
|
||||||
long longVal = defaultValue;
|
// If a taskID/Name is specified, prepend it on the configuration name
|
||||||
String strVal = taskProperty(name);
|
if(StringUtils.isNotBlank(taskId))
|
||||||
if (strVal != null)
|
|
||||||
{
|
{
|
||||||
try
|
return configurationService.getLongProperty(taskId + "." + name, defaultValue);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
longVal = Long.parseLong(strVal.trim());
|
return configurationService.getLongProperty(name, defaultValue);
|
||||||
}
|
}
|
||||||
catch(NumberFormatException nfE)
|
|
||||||
{
|
|
||||||
log.warn("Warning: Number format error in module: " + taskId + " property: " + name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return longVal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -334,13 +310,37 @@ public abstract class AbstractCurationTask implements CurationTask
|
|||||||
*/
|
*/
|
||||||
protected boolean taskBooleanProperty(String name, boolean defaultValue)
|
protected boolean taskBooleanProperty(String name, boolean defaultValue)
|
||||||
{
|
{
|
||||||
String strVal = taskProperty(name);
|
// If a taskID/Name is specified, prepend it on the configuration name
|
||||||
if (strVal != null)
|
if(StringUtils.isNotBlank(taskId))
|
||||||
{
|
{
|
||||||
strVal = strVal.trim();
|
return configurationService.getBooleanProperty(taskId + "." + name, defaultValue);
|
||||||
return strVal.equalsIgnoreCase("true") ||
|
}
|
||||||
strVal.equalsIgnoreCase("yes");
|
else
|
||||||
|
{
|
||||||
|
return configurationService.getBooleanProperty(name, defaultValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns task configuration Array property value for passed name, else
|
||||||
|
* <code>null</code> if no properties defined or no value for passed key.
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* the property name
|
||||||
|
* @return value
|
||||||
|
* the property value, or null
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
protected String[] taskArrayProperty(String name)
|
||||||
|
{
|
||||||
|
// If a taskID/Name is specified, prepend it on the configuration name
|
||||||
|
if(StringUtils.isNotBlank(taskId))
|
||||||
|
{
|
||||||
|
return configurationService.getArrayProperty(taskId + "." + name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return configurationService.getArrayProperty(name);
|
||||||
}
|
}
|
||||||
return defaultValue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -20,8 +20,8 @@ import java.util.List;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||||
|
|
||||||
import org.dspace.core.ConfigurationManager;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FileTaskQueue provides a TaskQueue implementation based on flat files
|
* FileTaskQueue provides a TaskQueue implementation based on flat files
|
||||||
@@ -33,7 +33,7 @@ public class FileTaskQueue implements TaskQueue
|
|||||||
{
|
{
|
||||||
private static Logger log = Logger.getLogger(TaskQueue.class);
|
private static Logger log = Logger.getLogger(TaskQueue.class);
|
||||||
// base directory for curation task queues
|
// base directory for curation task queues
|
||||||
protected String tqDir = ConfigurationManager.getProperty("curate", "taskqueue.dir");
|
protected String tqDir;
|
||||||
|
|
||||||
// ticket for queue readers
|
// ticket for queue readers
|
||||||
protected long readTicket = -1L;
|
protected long readTicket = -1L;
|
||||||
@@ -42,6 +42,7 @@ public class FileTaskQueue implements TaskQueue
|
|||||||
|
|
||||||
public FileTaskQueue()
|
public FileTaskQueue()
|
||||||
{
|
{
|
||||||
|
tqDir = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("curate.taskqueue.dir");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -23,8 +23,8 @@ import javax.script.ScriptException;
|
|||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.dspace.core.ConfigurationManager;
|
|
||||||
import org.dspace.core.factory.CoreServiceFactory;
|
import org.dspace.core.factory.CoreServiceFactory;
|
||||||
|
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TaskResolver takes a logical name of a curation task and attempts to deliver
|
* TaskResolver takes a logical name of a curation task and attempts to deliver
|
||||||
@@ -71,13 +71,14 @@ public class TaskResolver
|
|||||||
|
|
||||||
// base directory of task scripts & catalog name
|
// base directory of task scripts & catalog name
|
||||||
protected static final String CATALOG = "task.catalog";
|
protected static final String CATALOG = "task.catalog";
|
||||||
protected static final String scriptDir = ConfigurationManager.getProperty("curate", "script.dir");
|
protected final String scriptDir;
|
||||||
|
|
||||||
// catalog of script tasks
|
// catalog of script tasks
|
||||||
protected Properties catalog;
|
protected Properties catalog;
|
||||||
|
|
||||||
public TaskResolver()
|
public TaskResolver()
|
||||||
{
|
{
|
||||||
|
scriptDir = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("curate.script.dir");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -968,14 +968,10 @@ public class SolrServiceImpl implements SearchService, IndexingService {
|
|||||||
|
|
||||||
|
|
||||||
List<String> toProjectionFields = new ArrayList<String>();
|
List<String> toProjectionFields = new ArrayList<String>();
|
||||||
String projectionFieldsString = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("discovery.index.projection");
|
String[] projectionFields = DSpaceServicesFactory.getInstance().getConfigurationService().getArrayProperty("discovery.index.projection");
|
||||||
if(projectionFieldsString != null){
|
if(projectionFields != null){
|
||||||
if(projectionFieldsString.indexOf(",") != -1){
|
for (String field : projectionFields) {
|
||||||
for (int i = 0; i < projectionFieldsString.split(",").length; i++) {
|
toProjectionFields.add(field.trim());
|
||||||
toProjectionFields.add(projectionFieldsString.split(",")[i].trim());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
toProjectionFields.add(projectionFieldsString);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -9,10 +9,11 @@ package org.dspace.event;
|
|||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.Enumeration;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
|
|
||||||
import org.apache.commons.pool2.KeyedObjectPool;
|
import org.apache.commons.pool2.KeyedObjectPool;
|
||||||
import org.apache.commons.pool2.KeyedPooledObjectFactory;
|
import org.apache.commons.pool2.KeyedPooledObjectFactory;
|
||||||
@@ -22,9 +23,10 @@ import org.apache.commons.pool2.impl.DefaultPooledObject;
|
|||||||
import org.apache.commons.pool2.impl.GenericKeyedObjectPool;
|
import org.apache.commons.pool2.impl.GenericKeyedObjectPool;
|
||||||
import org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig;
|
import org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig;
|
||||||
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.event.service.EventService;
|
import org.dspace.event.service.EventService;
|
||||||
|
import org.dspace.services.ConfigurationService;
|
||||||
|
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for managing the content event environment. The EventManager mainly
|
* Class for managing the content event environment. The EventManager mainly
|
||||||
@@ -48,7 +50,10 @@ public class EventServiceImpl implements EventService
|
|||||||
|
|
||||||
protected Map<String, Integer> consumerIndicies = null;
|
protected Map<String, Integer> consumerIndicies = null;
|
||||||
|
|
||||||
protected String CONSUMER_PFX = "event.consumer.";
|
protected String CONSUMER_PFX = "event.consumer";
|
||||||
|
|
||||||
|
private static final ConfigurationService configurationService = DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||||
|
|
||||||
|
|
||||||
protected EventServiceImpl()
|
protected EventServiceImpl()
|
||||||
{
|
{
|
||||||
@@ -140,7 +145,8 @@ public class EventServiceImpl implements EventService
|
|||||||
|
|
||||||
protected void enumerateConsumers()
|
protected void enumerateConsumers()
|
||||||
{
|
{
|
||||||
Enumeration propertyNames = ConfigurationManager.propertyNames();
|
// Get all configs starting with CONSUMER_PFX
|
||||||
|
List<String> propertyNames = configurationService.getPropertyKeys(CONSUMER_PFX);
|
||||||
int bitSetIndex = 0;
|
int bitSetIndex = 0;
|
||||||
|
|
||||||
if (consumerIndicies == null)
|
if (consumerIndicies == null)
|
||||||
@@ -148,13 +154,11 @@ public class EventServiceImpl implements EventService
|
|||||||
consumerIndicies = new HashMap<String, Integer>();
|
consumerIndicies = new HashMap<String, Integer>();
|
||||||
}
|
}
|
||||||
|
|
||||||
while (propertyNames.hasMoreElements())
|
for(String ckey : propertyNames)
|
||||||
{
|
{
|
||||||
String ckey = ((String) propertyNames.nextElement()).trim();
|
if (ckey.endsWith(".class"))
|
||||||
|
|
||||||
if (ckey.startsWith(CONSUMER_PFX) && ckey.endsWith(".class"))
|
|
||||||
{
|
{
|
||||||
String consumerName = ckey.substring(CONSUMER_PFX.length(),
|
String consumerName = ckey.substring(CONSUMER_PFX.length()+1,
|
||||||
ckey.length() - 6);
|
ckey.length() - 6);
|
||||||
|
|
||||||
consumerIndicies.put(consumerName, (Integer) bitSetIndex);
|
consumerIndicies.put(consumerName, (Integer) bitSetIndex);
|
||||||
@@ -167,7 +171,7 @@ public class EventServiceImpl implements EventService
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Prefix of keys in DSpace Configuration
|
// Prefix of keys in DSpace Configuration
|
||||||
private static final String PROP_PFX = "event.dispatcher.";
|
private static final String PROP_PFX = "event.dispatcher";
|
||||||
|
|
||||||
// Cache of event dispatchers, keyed by name, for re-use.
|
// Cache of event dispatchers, keyed by name, for re-use.
|
||||||
protected Map<String, String> dispatchers = new HashMap<String, String>();
|
protected Map<String, String> dispatchers = new HashMap<String, String>();
|
||||||
@@ -201,37 +205,23 @@ public class EventServiceImpl implements EventService
|
|||||||
dispatcher = (Dispatcher) dc.newInstance(args);
|
dispatcher = (Dispatcher) dc.newInstance(args);
|
||||||
|
|
||||||
// OK, now get its list of consumers/filters
|
// OK, now get its list of consumers/filters
|
||||||
String consumerKey = PROP_PFX + dispatcherName
|
String consumerKey = PROP_PFX + "." + dispatcherName
|
||||||
+ ".consumers";
|
+ ".consumers";
|
||||||
String consumerList = ConfigurationManager
|
String[] consumers = configurationService
|
||||||
.getProperty(consumerKey);
|
.getArrayProperty(consumerKey);
|
||||||
if (consumerList == null)
|
if (ArrayUtils.isEmpty(consumers))
|
||||||
{
|
{
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
"No Configuration entry found for consumer list of event Dispatcher: \""
|
"No Configuration entry found for consumer list of event Dispatcher: \""
|
||||||
+ consumerKey + "\"");
|
+ consumerKey + "\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Consumer list format:
|
|
||||||
// <consumer-name>:<mode>, ...
|
|
||||||
String[] consumerStanza = consumerList.trim().split(
|
|
||||||
"\\s*,\\s*");
|
|
||||||
|
|
||||||
// I think this should be a fatal error.. --lcs
|
|
||||||
if (consumerStanza.length < 1)
|
|
||||||
{
|
|
||||||
throw new IllegalStateException(
|
|
||||||
"Cannot initialize Dispatcher, malformed Configuration value for "
|
|
||||||
+ consumerKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
ConsumerProfile consumerProfile = null;
|
ConsumerProfile consumerProfile = null;
|
||||||
|
|
||||||
// parts: 0 is name, part 1 is mode.
|
for (String consumer : consumers)
|
||||||
for (int i = 0; i < consumerStanza.length; i++)
|
|
||||||
{
|
{
|
||||||
consumerProfile = ConsumerProfile
|
consumerProfile = ConsumerProfile
|
||||||
.makeConsumerProfile(consumerStanza[i]);
|
.makeConsumerProfile(consumer);
|
||||||
consumerProfile.getConsumer().initialize();
|
consumerProfile.getConsumer().initialize();
|
||||||
|
|
||||||
dispatcher.addConsumerProfile(consumerProfile);
|
dispatcher.addConsumerProfile(consumerProfile);
|
||||||
@@ -346,16 +336,16 @@ public class EventServiceImpl implements EventService
|
|||||||
*/
|
*/
|
||||||
private void parseEventConfig()
|
private void parseEventConfig()
|
||||||
{
|
{
|
||||||
Enumeration propertyNames = ConfigurationManager.propertyNames();
|
// Get all configs starting with PROP_PFX
|
||||||
while (propertyNames.hasMoreElements())
|
List<String> propertyNames = configurationService.getPropertyKeys(PROP_PFX);
|
||||||
{
|
|
||||||
String ckey = ((String) propertyNames.nextElement()).trim();
|
|
||||||
|
|
||||||
if (ckey.startsWith(PROP_PFX) && ckey.endsWith(".class"))
|
for(String ckey : propertyNames)
|
||||||
{
|
{
|
||||||
String name = ckey.substring(PROP_PFX.length(), ckey
|
if (ckey.endsWith(".class"))
|
||||||
|
{
|
||||||
|
String name = ckey.substring(PROP_PFX.length()+1, ckey
|
||||||
.length() - 6);
|
.length() - 6);
|
||||||
String dispatcherClass = ConfigurationManager
|
String dispatcherClass = configurationService
|
||||||
.getProperty(ckey);
|
.getProperty(ckey);
|
||||||
|
|
||||||
// Can we grab all of the consumers configured for this
|
// Can we grab all of the consumers configured for this
|
||||||
|
@@ -18,7 +18,6 @@ import java.text.SimpleDateFormat;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Enumeration;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@@ -37,7 +36,6 @@ import org.dspace.content.crosswalk.CrosswalkException;
|
|||||||
import org.dspace.content.crosswalk.IngestionCrosswalk;
|
import org.dspace.content.crosswalk.IngestionCrosswalk;
|
||||||
import org.dspace.content.factory.ContentServiceFactory;
|
import org.dspace.content.factory.ContentServiceFactory;
|
||||||
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.Email;
|
import org.dspace.core.Email;
|
||||||
@@ -50,6 +48,8 @@ import org.dspace.handle.service.HandleService;
|
|||||||
import org.dspace.harvest.factory.HarvestServiceFactory;
|
import org.dspace.harvest.factory.HarvestServiceFactory;
|
||||||
import org.dspace.harvest.service.HarvestedCollectionService;
|
import org.dspace.harvest.service.HarvestedCollectionService;
|
||||||
import org.dspace.harvest.service.HarvestedItemService;
|
import org.dspace.harvest.service.HarvestedItemService;
|
||||||
|
import org.dspace.services.ConfigurationService;
|
||||||
|
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||||
import org.jdom.Document;
|
import org.jdom.Document;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
import org.jdom.Namespace;
|
import org.jdom.Namespace;
|
||||||
@@ -90,6 +90,7 @@ public class OAIHarvester {
|
|||||||
protected HarvestedItemService harvestedItemService;
|
protected HarvestedItemService harvestedItemService;
|
||||||
protected WorkspaceItemService workspaceItemService;
|
protected WorkspaceItemService workspaceItemService;
|
||||||
protected PluginService pluginService;
|
protected PluginService pluginService;
|
||||||
|
protected ConfigurationService configurationService;
|
||||||
|
|
||||||
// The collection this harvester instance is dealing with
|
// The collection this harvester instance is dealing with
|
||||||
Collection targetCollection;
|
Collection targetCollection;
|
||||||
@@ -168,20 +169,17 @@ 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 = "oai.harvester.oreSerializationFormat.";
|
String oreString = "oai.harvester.oreSerializationFormat";
|
||||||
|
|
||||||
Enumeration pe = ConfigurationManager.propertyNames("oai");
|
List<String> keys = DSpaceServicesFactory.getInstance().getConfigurationService().getPropertyKeys(oreString);
|
||||||
|
|
||||||
while (pe.hasMoreElements())
|
for(String key : keys)
|
||||||
{
|
{
|
||||||
String key = (String)pe.nextElement();
|
ORESeialKey = key.substring(oreString.length()+1);
|
||||||
if (key.startsWith(oreString)) {
|
ORESerializationString = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty(key);
|
||||||
ORESeialKey = key.substring(oreString.length());
|
|
||||||
ORESerializationString = ConfigurationManager.getProperty("oai", key);
|
|
||||||
|
|
||||||
return Namespace.getNamespace(ORESeialKey, ORESerializationString);
|
return Namespace.getNamespace(ORESeialKey, ORESerializationString);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Fallback if the configuration option is not present
|
// Fallback if the configuration option is not present
|
||||||
return Namespace.getNamespace("ore", ATOM_NS.getURI());
|
return Namespace.getNamespace("ore", ATOM_NS.getURI());
|
||||||
@@ -195,16 +193,14 @@ public class OAIHarvester {
|
|||||||
*/
|
*/
|
||||||
private static Namespace getDMDNamespace(String metadataKey) {
|
private static Namespace getDMDNamespace(String metadataKey) {
|
||||||
String metadataString = null;
|
String metadataString = null;
|
||||||
String metaString = "oai.harvester.metadataformats.";
|
String metaString = "oai.harvester.metadataformats";
|
||||||
|
|
||||||
Enumeration pe = ConfigurationManager.propertyNames("oai");
|
List<String> keys = DSpaceServicesFactory.getInstance().getConfigurationService().getPropertyKeys(metaString);
|
||||||
|
|
||||||
while (pe.hasMoreElements())
|
for(String key : keys)
|
||||||
{
|
{
|
||||||
String key = (String)pe.nextElement();
|
if (key.substring(metaString.length()+1).equals((metadataKey))) {
|
||||||
|
metadataString = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty(key);
|
||||||
if (key.startsWith(metaString) && key.substring(metaString.length()).equals((metadataKey))) {
|
|
||||||
metadataString = ConfigurationManager.getProperty("oai", key);
|
|
||||||
String namespacePiece;
|
String namespacePiece;
|
||||||
if (metadataString.indexOf(',') != -1)
|
if (metadataString.indexOf(',') != -1)
|
||||||
{
|
{
|
||||||
@@ -296,7 +292,7 @@ public class OAIHarvester {
|
|||||||
harvestedCollection.update(ourContext, harvestRow);
|
harvestedCollection.update(ourContext, harvestRow);
|
||||||
|
|
||||||
// expiration timer starts
|
// expiration timer starts
|
||||||
int expirationInterval = ConfigurationManager.getIntProperty("oai", "harvester.threadTimeout");
|
int expirationInterval = configurationService.getIntProperty("oai.harvester.threadTimeout");
|
||||||
if (expirationInterval == 0)
|
if (expirationInterval == 0)
|
||||||
{
|
{
|
||||||
expirationInterval = 24;
|
expirationInterval = 24;
|
||||||
@@ -613,25 +609,22 @@ public class OAIHarvester {
|
|||||||
*/
|
*/
|
||||||
protected String extractHandle(Item item)
|
protected String extractHandle(Item item)
|
||||||
{
|
{
|
||||||
String acceptedHandleServersString = ConfigurationManager.getProperty("oai", "harvester.acceptedHandleServer");
|
String[] acceptedHandleServers = configurationService.getArrayProperty("oai.harvester.acceptedHandleServer");
|
||||||
if (acceptedHandleServersString == null)
|
if (acceptedHandleServers == null)
|
||||||
{
|
{
|
||||||
acceptedHandleServersString = "hdl.handle.net";
|
acceptedHandleServers = new String[]{"hdl.handle.net"};
|
||||||
}
|
}
|
||||||
|
|
||||||
String rejectedHandlePrefixString = ConfigurationManager.getProperty("oai", "harvester.rejectedHandlePrefix");
|
String[] rejectedHandlePrefixes = configurationService.getArrayProperty("oai.harvester.rejectedHandlePrefix");
|
||||||
if (rejectedHandlePrefixString == null)
|
if (rejectedHandlePrefixes == null)
|
||||||
{
|
{
|
||||||
rejectedHandlePrefixString = "123456789";
|
rejectedHandlePrefixes = new String[]{"123456789"};
|
||||||
}
|
}
|
||||||
|
|
||||||
List<MetadataValue> values = itemService.getMetadata(item, "dc", "identifier", Item.ANY, Item.ANY);
|
List<MetadataValue> values = itemService.getMetadata(item, "dc", "identifier", Item.ANY, Item.ANY);
|
||||||
|
|
||||||
if (values.size() > 0 && !acceptedHandleServersString.equals(""))
|
if (values.size() > 0 && acceptedHandleServers != null)
|
||||||
{
|
{
|
||||||
String[] acceptedHandleServers = acceptedHandleServersString.split(",");
|
|
||||||
String[] rejectedHandlePrefixes = rejectedHandlePrefixString.split(",");
|
|
||||||
|
|
||||||
for (MetadataValue value : values)
|
for (MetadataValue value : values)
|
||||||
{
|
{
|
||||||
// 0 1 2 3 4
|
// 0 1 2 3 4
|
||||||
@@ -667,7 +660,7 @@ public class OAIHarvester {
|
|||||||
* @return a string in the format 'yyyy-mm-ddThh:mm:ssZ' and converted to UTC timezone
|
* @return a string in the format 'yyyy-mm-ddThh:mm:ssZ' and converted to UTC timezone
|
||||||
*/
|
*/
|
||||||
private String processDate(Date date) {
|
private String processDate(Date date) {
|
||||||
Integer timePad = ConfigurationManager.getIntProperty("oai", "harvester.timePadding");
|
Integer timePad = configurationService.getIntProperty("oai.harvester.timePadding");
|
||||||
|
|
||||||
if (timePad == 0) {
|
if (timePad == 0) {
|
||||||
timePad = 120;
|
timePad = 120;
|
||||||
@@ -748,7 +741,7 @@ public class OAIHarvester {
|
|||||||
protected void alertAdmin(int status, Exception ex)
|
protected void alertAdmin(int status, Exception ex)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
String recipient = ConfigurationManager.getProperty("alert.recipient");
|
String recipient = configurationService.getProperty("alert.recipient");
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(recipient)) {
|
if (StringUtils.isNotBlank(recipient)) {
|
||||||
Email email = Email.getEmail(I18nUtil.getEmailFilename(Locale.getDefault(), "harvesting_error"));
|
Email email = Email.getEmail(I18nUtil.getEmailFilename(Locale.getDefault(), "harvesting_error"));
|
||||||
|
@@ -18,6 +18,7 @@ import java.util.*;
|
|||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import org.dspace.core.factory.CoreServiceFactory;
|
import org.dspace.core.factory.CoreServiceFactory;
|
||||||
import org.dspace.core.service.PluginService;
|
import org.dspace.core.service.PluginService;
|
||||||
|
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author LINDAT/CLARIN dev team
|
* @author LINDAT/CLARIN dev team
|
||||||
@@ -70,7 +71,7 @@ public class Report {
|
|||||||
// create check list
|
// create check list
|
||||||
public static LinkedHashMap<String, Check> checks() {
|
public static LinkedHashMap<String, Check> checks() {
|
||||||
LinkedHashMap<String, Check> checks = new LinkedHashMap<>();
|
LinkedHashMap<String, Check> checks = new LinkedHashMap<>();
|
||||||
String check_names[] = ConfigurationManager.getProperty("healthcheck", "checks").split(",");
|
String check_names[] = DSpaceServicesFactory.getInstance().getConfigurationService().getArrayProperty("healthcheck.checks");
|
||||||
PluginService pluginService = CoreServiceFactory.getInstance().getPluginService();
|
PluginService pluginService = CoreServiceFactory.getInstance().getPluginService();
|
||||||
for ( String check_name : check_names ) {
|
for ( String check_name : check_names ) {
|
||||||
Check check = (Check) pluginService.getNamedPlugin(
|
Check check = (Check) pluginService.getNamedPlugin(
|
||||||
|
@@ -32,7 +32,8 @@ import org.jdom.JDOMException;
|
|||||||
import org.jdom.input.SAXBuilder;
|
import org.jdom.input.SAXBuilder;
|
||||||
import org.jdom.output.XMLOutputter;
|
import org.jdom.output.XMLOutputter;
|
||||||
|
|
||||||
import org.dspace.core.ConfigurationManager;
|
import org.dspace.services.ConfigurationService;
|
||||||
|
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -45,9 +46,9 @@ public class CCLookup {
|
|||||||
/** log4j logger */
|
/** log4j logger */
|
||||||
private static Logger log = Logger.getLogger(CCLookup.class);
|
private static Logger log = Logger.getLogger(CCLookup.class);
|
||||||
|
|
||||||
private static String cc_root = ConfigurationManager.getProperty("cc.api.rooturl");
|
private String cc_root;
|
||||||
private static String jurisdiction;
|
private String jurisdiction;
|
||||||
private static List<String> lcFilter = new ArrayList<String>();
|
private List<String> lcFilter = new ArrayList<String>();
|
||||||
|
|
||||||
private Document license_doc = null;
|
private Document license_doc = null;
|
||||||
private String rdfString = null;
|
private String rdfString = null;
|
||||||
@@ -58,24 +59,26 @@ public class CCLookup {
|
|||||||
private List<CCLicense> licenses = new ArrayList<CCLicense>();
|
private List<CCLicense> licenses = new ArrayList<CCLicense>();
|
||||||
private List<CCLicenseField> licenseFields = new ArrayList<CCLicenseField>();
|
private List<CCLicenseField> licenseFields = new ArrayList<CCLicenseField>();
|
||||||
|
|
||||||
static {
|
|
||||||
String jurisProp = ConfigurationManager.getProperty("cc.license.jurisdiction");
|
|
||||||
jurisdiction = (jurisProp != null) ? jurisProp : "";
|
|
||||||
|
|
||||||
String filterList = ConfigurationManager.getProperty("cc.license.classfilter");
|
|
||||||
if (filterList != null) {
|
|
||||||
for (String name: filterList.split(",")) {
|
|
||||||
lcFilter.add(name.trim());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new instance with the default web services root.
|
* Constructs a new instance with the default web services root.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public CCLookup() {
|
public CCLookup() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
ConfigurationService configurationService = DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||||
|
|
||||||
|
cc_root = configurationService.getProperty("cc.api.rooturl");
|
||||||
|
|
||||||
|
String jurisProp = configurationService.getProperty("cc.license.jurisdiction");
|
||||||
|
jurisdiction = (jurisProp != null) ? jurisProp : "";
|
||||||
|
|
||||||
|
String[] filters = configurationService.getArrayProperty("cc.license.classfilter");
|
||||||
|
if (filters != null) {
|
||||||
|
for (String name: filters) {
|
||||||
|
lcFilter.add(name.trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -203,29 +203,23 @@ public class MetadataConverterPlugin implements ConverterPlugin
|
|||||||
|
|
||||||
protected Model loadConfiguration()
|
protected Model loadConfiguration()
|
||||||
{
|
{
|
||||||
String mappingPathes = configurationService.getProperty(METADATA_MAPPING_PATH_KEY);
|
InputStream is = null;
|
||||||
if (StringUtils.isEmpty(mappingPathes))
|
Model config = ModelFactory.createDefaultModel();
|
||||||
{
|
String mapping = configurationService.getProperty(METADATA_MAPPING_PATH_KEY);
|
||||||
return null;
|
if (StringUtils.isEmpty(mapping))
|
||||||
}
|
|
||||||
String[] mappings = mappingPathes.split(",\\s*");
|
|
||||||
if (mappings == null || mappings.length == 0)
|
|
||||||
{
|
{
|
||||||
log.error("Cannot find metadata mappings (looking for "
|
log.error("Cannot find metadata mappings (looking for "
|
||||||
+ "property " + METADATA_MAPPING_PATH_KEY + ")!");
|
+ "property " + METADATA_MAPPING_PATH_KEY + ")!");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
InputStream is = null;
|
|
||||||
Model config = ModelFactory.createDefaultModel();
|
|
||||||
for (String mappingPath : mappings)
|
|
||||||
{
|
{
|
||||||
is = FileManager.get().open(mappingPath);
|
is = FileManager.get().open(mapping);
|
||||||
if (is == null)
|
if (is == null)
|
||||||
{
|
{
|
||||||
log.warn("Cannot find file '" + mappingPath + "', ignoring...");
|
log.warn("Cannot find file '" + mapping + "', ignoring...");
|
||||||
}
|
}
|
||||||
config.read(is, "file://" + mappingPath, FileUtils.guessLang(mappingPath));
|
config.read(is, "file://" + mapping, FileUtils.guessLang(mapping));
|
||||||
try {
|
try {
|
||||||
// Make sure that we have an input stream to avoid NullPointer
|
// Make sure that we have an input stream to avoid NullPointer
|
||||||
if(is != null)
|
if(is != null)
|
||||||
|
@@ -11,7 +11,6 @@ import au.com.bytecode.opencsv.CSVReader;
|
|||||||
import au.com.bytecode.opencsv.CSVWriter;
|
import au.com.bytecode.opencsv.CSVWriter;
|
||||||
import com.maxmind.geoip.Location;
|
import com.maxmind.geoip.Location;
|
||||||
import com.maxmind.geoip.LookupService;
|
import com.maxmind.geoip.LookupService;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.lang.ArrayUtils;
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
@@ -39,11 +38,11 @@ import org.dspace.content.Collection;
|
|||||||
import org.dspace.content.factory.ContentServiceFactory;
|
import org.dspace.content.factory.ContentServiceFactory;
|
||||||
import org.dspace.content.service.BitstreamService;
|
import org.dspace.content.service.BitstreamService;
|
||||||
import org.dspace.content.service.DSpaceObjectLegacySupportService;
|
import org.dspace.content.service.DSpaceObjectLegacySupportService;
|
||||||
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.eperson.EPerson;
|
import org.dspace.eperson.EPerson;
|
||||||
import org.dspace.eperson.Group;
|
import org.dspace.eperson.Group;
|
||||||
|
import org.dspace.services.ConfigurationService;
|
||||||
import org.dspace.statistics.service.SolrLoggerService;
|
import org.dspace.statistics.service.SolrLoggerService;
|
||||||
import org.dspace.statistics.util.DnsLookup;
|
import org.dspace.statistics.util.DnsLookup;
|
||||||
import org.dspace.statistics.util.LocationUtils;
|
import org.dspace.statistics.util.LocationUtils;
|
||||||
@@ -90,6 +89,8 @@ public class SolrLoggerServiceImpl implements SolrLoggerService, InitializingBea
|
|||||||
protected BitstreamService bitstreamService;
|
protected BitstreamService bitstreamService;
|
||||||
@Autowired(required = true)
|
@Autowired(required = true)
|
||||||
protected ContentServiceFactory contentServiceFactory;
|
protected ContentServiceFactory contentServiceFactory;
|
||||||
|
@Autowired(required = true)
|
||||||
|
private ConfigurationService configurationService;
|
||||||
|
|
||||||
public static enum StatisticsType {
|
public static enum StatisticsType {
|
||||||
VIEW ("view"),
|
VIEW ("view"),
|
||||||
@@ -114,20 +115,20 @@ public class SolrLoggerServiceImpl implements SolrLoggerService, InitializingBea
|
|||||||
@Override
|
@Override
|
||||||
public void afterPropertiesSet() throws Exception
|
public void afterPropertiesSet() throws Exception
|
||||||
{
|
{
|
||||||
log.info("solr-statistics.spidersfile:" + ConfigurationManager.getProperty("solr-statistics", "spidersfile"));
|
log.info("solr-statistics.spidersfile:" + configurationService.getProperty("solr-statistics.spidersfile"));
|
||||||
log.info("solr-statistics.server:" + ConfigurationManager.getProperty("solr-statistics", "server"));
|
log.info("solr-statistics.server:" + configurationService.getProperty("solr-statistics.server"));
|
||||||
log.info("usage-statistics.dbfile:" + ConfigurationManager.getProperty("usage-statistics", "dbfile"));
|
log.info("usage-statistics.dbfile:" + configurationService.getProperty("usage-statistics.dbfile"));
|
||||||
|
|
||||||
HttpSolrServer server = null;
|
HttpSolrServer server = null;
|
||||||
|
|
||||||
if (ConfigurationManager.getProperty("solr-statistics", "server") != null)
|
if (configurationService.getProperty("solr-statistics.server") != null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
server = new HttpSolrServer(ConfigurationManager.getProperty("solr-statistics", "server"));
|
server = new HttpSolrServer(configurationService.getProperty("solr-statistics.server"));
|
||||||
|
|
||||||
//Attempt to retrieve all the statistic year cores
|
//Attempt to retrieve all the statistic year cores
|
||||||
File solrDir = new File(ConfigurationManager.getProperty("dspace.dir") + "/solr/");
|
File solrDir = new File(configurationService.getProperty("dspace.dir") + File.separator + "solr" + File.separator);
|
||||||
File[] solrCoreFiles = solrDir.listFiles(new FileFilter() {
|
File[] solrCoreFiles = solrDir.listFiles(new FileFilter() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -158,7 +159,7 @@ public class SolrLoggerServiceImpl implements SolrLoggerService, InitializingBea
|
|||||||
|
|
||||||
LookupService service = null;
|
LookupService service = null;
|
||||||
// Get the db file for the location
|
// Get the db file for the location
|
||||||
String dbfile = ConfigurationManager.getProperty("usage-statistics", "dbfile");
|
String dbfile = configurationService.getProperty("usage-statistics.dbfile");
|
||||||
if (dbfile != null)
|
if (dbfile != null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -181,15 +182,7 @@ public class SolrLoggerServiceImpl implements SolrLoggerService, InitializingBea
|
|||||||
}
|
}
|
||||||
locationService = service;
|
locationService = service;
|
||||||
|
|
||||||
if ("true".equals(ConfigurationManager.getProperty("useProxies")))
|
useProxies = configurationService.getBooleanProperty("useProxies");
|
||||||
{
|
|
||||||
useProxies = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
useProxies = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
log.info("useProxies=" + useProxies);
|
log.info("useProxies=" + useProxies);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,7 +280,7 @@ public class SolrLoggerServiceImpl implements SolrLoggerService, InitializingBea
|
|||||||
protected SolrInputDocument getCommonSolrDoc(DSpaceObject dspaceObject, HttpServletRequest request, EPerson currentUser) throws SQLException {
|
protected SolrInputDocument getCommonSolrDoc(DSpaceObject dspaceObject, HttpServletRequest request, EPerson currentUser) throws SQLException {
|
||||||
boolean isSpiderBot = request != null && SpiderDetector.isSpider(request);
|
boolean isSpiderBot = request != null && SpiderDetector.isSpider(request);
|
||||||
if(isSpiderBot &&
|
if(isSpiderBot &&
|
||||||
!ConfigurationManager.getBooleanProperty("usage-statistics", "logBots", true))
|
!configurationService.getBooleanProperty("usage-statistics.logBots", true))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -381,7 +374,7 @@ public class SolrLoggerServiceImpl implements SolrLoggerService, InitializingBea
|
|||||||
protected SolrInputDocument getCommonSolrDoc(DSpaceObject dspaceObject, String ip, String userAgent, String xforwardedfor, EPerson currentUser) throws SQLException {
|
protected SolrInputDocument getCommonSolrDoc(DSpaceObject dspaceObject, String ip, String userAgent, String xforwardedfor, EPerson currentUser) throws SQLException {
|
||||||
boolean isSpiderBot = SpiderDetector.isSpider(ip);
|
boolean isSpiderBot = SpiderDetector.isSpider(ip);
|
||||||
if(isSpiderBot &&
|
if(isSpiderBot &&
|
||||||
!ConfigurationManager.getBooleanProperty("usage-statistics", "logBots", true))
|
!configurationService.getBooleanProperty("usage-statistics.logBots", true))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -1088,14 +1081,14 @@ public class SolrLoggerServiceImpl implements SolrLoggerService, InitializingBea
|
|||||||
// not be influenced
|
// not be influenced
|
||||||
|
|
||||||
// Choose to filter by the Legacy spider IP list (may get too long to properly filter all IP's
|
// Choose to filter by the Legacy spider IP list (may get too long to properly filter all IP's
|
||||||
if(ConfigurationManager.getBooleanProperty("solr-statistics", "query.filter.spiderIp",false))
|
if(configurationService.getBooleanProperty("solr-statistics.query.filter.spiderIp",false))
|
||||||
{
|
{
|
||||||
solrQuery.addFilterQuery(getIgnoreSpiderIPs());
|
solrQuery.addFilterQuery(getIgnoreSpiderIPs());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Choose to filter by isBot field, may be overriden in future
|
// Choose to filter by isBot field, may be overriden in future
|
||||||
// to allow views on stats based on bots.
|
// to allow views on stats based on bots.
|
||||||
if(ConfigurationManager.getBooleanProperty("solr-statistics", "query.filter.isBot",true))
|
if(configurationService.getBooleanProperty("solr-statistics.query.filter.isBot",true))
|
||||||
{
|
{
|
||||||
solrQuery.addFilterQuery("-isBot:true");
|
solrQuery.addFilterQuery("-isBot:true");
|
||||||
}
|
}
|
||||||
@@ -1104,8 +1097,8 @@ public class SolrLoggerServiceImpl implements SolrLoggerService, InitializingBea
|
|||||||
solrQuery.setSortField(sort, (ascending ? SolrQuery.ORDER.asc : SolrQuery.ORDER.desc));
|
solrQuery.setSortField(sort, (ascending ? SolrQuery.ORDER.asc : SolrQuery.ORDER.desc));
|
||||||
}
|
}
|
||||||
|
|
||||||
String bundles;
|
String[] bundles = configurationService.getArrayProperty("solr-statistics.query.filter.bundles");
|
||||||
if((bundles = ConfigurationManager.getProperty("solr-statistics", "query.filter.bundles")) != null && 0 < bundles.length()){
|
if(bundles != null && bundles.length > 0){
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The code below creates a query that will allow only records which do not have a bundlename
|
* The code below creates a query that will allow only records which do not have a bundlename
|
||||||
@@ -1114,11 +1107,10 @@ public class SolrLoggerServiceImpl implements SolrLoggerService, InitializingBea
|
|||||||
StringBuffer bundleQuery = new StringBuffer();
|
StringBuffer bundleQuery = new StringBuffer();
|
||||||
//Also add the possibility that if no bundle name is there these results will also be returned !
|
//Also add the possibility that if no bundle name is there these results will also be returned !
|
||||||
bundleQuery.append("-(bundleName:[* TO *]");
|
bundleQuery.append("-(bundleName:[* TO *]");
|
||||||
String[] split = bundles.split(",");
|
for (int i = 0; i < bundles.length; i++) {
|
||||||
for (int i = 0; i < split.length; i++) {
|
String bundle = bundles[i].trim();
|
||||||
String bundle = split[i].trim();
|
|
||||||
bundleQuery.append("-bundleName:").append(bundle);
|
bundleQuery.append("-bundleName:").append(bundle);
|
||||||
if(i != split.length - 1){
|
if(i != bundles.length - 1){
|
||||||
bundleQuery.append(" AND ");
|
bundleQuery.append(" AND ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1207,7 +1199,7 @@ public class SolrLoggerServiceImpl implements SolrLoggerService, InitializingBea
|
|||||||
yearRangeQuery.add(FacetParams.FACET_MINCOUNT, String.valueOf(1));
|
yearRangeQuery.add(FacetParams.FACET_MINCOUNT, String.valueOf(1));
|
||||||
|
|
||||||
//Create a temp directory to store our files in !
|
//Create a temp directory to store our files in !
|
||||||
File tempDirectory = new File(ConfigurationManager.getProperty("dspace.dir") + File.separator + "temp" + File.separator);
|
File tempDirectory = new File(configurationService.getProperty("dspace.dir") + File.separator + "temp" + File.separator);
|
||||||
tempDirectory.mkdirs();
|
tempDirectory.mkdirs();
|
||||||
|
|
||||||
|
|
||||||
@@ -1292,7 +1284,7 @@ public class SolrLoggerServiceImpl implements SolrLoggerService, InitializingBea
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected HttpSolrServer createCore(HttpSolrServer solr, String coreName) throws IOException, SolrServerException {
|
protected HttpSolrServer createCore(HttpSolrServer solr, String coreName) throws IOException, SolrServerException {
|
||||||
String solrDir = ConfigurationManager.getProperty("dspace.dir") + File.separator + "solr" +File.separator;
|
String solrDir = configurationService.getProperty("dspace.dir") + File.separator + "solr" +File.separator;
|
||||||
String baseSolrUrl = solr.getBaseURL().replace("statistics", "");
|
String baseSolrUrl = solr.getBaseURL().replace("statistics", "");
|
||||||
CoreAdminRequest.Create create = new CoreAdminRequest.Create();
|
CoreAdminRequest.Create create = new CoreAdminRequest.Create();
|
||||||
create.setCoreName(coreName);
|
create.setCoreName(coreName);
|
||||||
@@ -1320,7 +1312,7 @@ public class SolrLoggerServiceImpl implements SolrLoggerService, InitializingBea
|
|||||||
addAdditionalSolrYearCores(query);
|
addAdditionalSolrYearCores(query);
|
||||||
long totalRecords = solr.query(query).getResults().getNumFound();
|
long totalRecords = solr.query(query).getResults().getNumFound();
|
||||||
|
|
||||||
File tempDirectory = new File(ConfigurationManager.getProperty("dspace.dir") + File.separator + "temp" + File.separator);
|
File tempDirectory = new File(configurationService.getProperty("dspace.dir") + File.separator + "temp" + File.separator);
|
||||||
tempDirectory.mkdirs();
|
tempDirectory.mkdirs();
|
||||||
List<File> tempCsvFiles = new ArrayList<File>();
|
List<File> tempCsvFiles = new ArrayList<File>();
|
||||||
for(int i = 0; i < totalRecords; i+=10000){
|
for(int i = 0; i < totalRecords; i+=10000){
|
||||||
@@ -1432,7 +1424,7 @@ public class SolrLoggerServiceImpl implements SolrLoggerService, InitializingBea
|
|||||||
public void exportHits() throws Exception {
|
public void exportHits() throws Exception {
|
||||||
Context context = new Context();
|
Context context = new Context();
|
||||||
|
|
||||||
File tempDirectory = new File(ConfigurationManager.getProperty("dspace.dir") + File.separator + "temp" + File.separator);
|
File tempDirectory = new File(configurationService.getProperty("dspace.dir") + File.separator + "temp" + File.separator);
|
||||||
tempDirectory.mkdirs();
|
tempDirectory.mkdirs();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@@ -18,7 +18,7 @@ import java.util.Set;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import org.dspace.core.ConfigurationManager;
|
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ public class SpiderDetector {
|
|||||||
if (table == null) {
|
if (table == null) {
|
||||||
table = new IPTable();
|
table = new IPTable();
|
||||||
|
|
||||||
String filePath = ConfigurationManager.getProperty("dspace.dir");
|
String filePath = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("dspace.dir");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
File spidersDir = new File(filePath, "config/spiders");
|
File spidersDir = new File(filePath, "config/spiders");
|
||||||
@@ -156,7 +156,7 @@ public class SpiderDetector {
|
|||||||
*/
|
*/
|
||||||
private static void loadPatterns(String directory, List<Pattern> patternList)
|
private static void loadPatterns(String directory, List<Pattern> patternList)
|
||||||
{
|
{
|
||||||
String dspaceHome = ConfigurationManager.getProperty("dspace.dir");
|
String dspaceHome = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("dspace.dir");
|
||||||
File spidersDir = new File(dspaceHome, "config/spiders");
|
File spidersDir = new File(dspaceHome, "config/spiders");
|
||||||
File patternsDir = new File(spidersDir, directory);
|
File patternsDir = new File(spidersDir, directory);
|
||||||
if (patternsDir.exists() && patternsDir.isDirectory())
|
if (patternsDir.exists() && patternsDir.isDirectory())
|
||||||
@@ -296,7 +296,7 @@ public class SpiderDetector {
|
|||||||
|
|
||||||
private static boolean isUseProxies() {
|
private static boolean isUseProxies() {
|
||||||
if(useProxies == null) {
|
if(useProxies == null) {
|
||||||
useProxies = "true".equals(ConfigurationManager.getProperty("useProxies"));
|
useProxies = DSpaceServicesFactory.getInstance().getConfigurationService().getBooleanProperty("useProxies");
|
||||||
}
|
}
|
||||||
|
|
||||||
return useProxies;
|
return useProxies;
|
||||||
|
@@ -10,12 +10,12 @@ package org.dspace.statistics.util;
|
|||||||
import org.apache.commons.cli.*;
|
import org.apache.commons.cli.*;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.apache.tools.ant.taskdefs.Get;
|
import org.apache.tools.ant.taskdefs.Get;
|
||||||
import org.dspace.core.ConfigurationManager;
|
|
||||||
import org.dspace.statistics.factory.StatisticsServiceFactory;
|
import org.dspace.statistics.factory.StatisticsServiceFactory;
|
||||||
import org.dspace.statistics.service.SolrLoggerService;
|
import org.dspace.statistics.service.SolrLoggerService;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to load intermediate statistics files into solr
|
* Class to load intermediate statistics files into solr
|
||||||
@@ -54,7 +54,7 @@ public class StatisticsClient
|
|||||||
|
|
||||||
options.addOption("u", "update-spider-files", false,
|
options.addOption("u", "update-spider-files", false,
|
||||||
"Update Spider IP Files from internet into " +
|
"Update Spider IP Files from internet into " +
|
||||||
ConfigurationManager.getProperty("dspace.dir") + "/config/spiders");
|
DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("dspace.dir") + "/config/spiders");
|
||||||
|
|
||||||
options.addOption("m", "mark-spiders", false, "Update isBot Flag in Solr");
|
options.addOption("m", "mark-spiders", false, "Update isBot Flag in Solr");
|
||||||
options.addOption("f", "delete-spiders-by-flag", false, "Delete Spiders in Solr By isBot Flag");
|
options.addOption("f", "delete-spiders-by-flag", false, "Delete Spiders in Solr By isBot Flag");
|
||||||
@@ -123,23 +123,22 @@ public class StatisticsClient
|
|||||||
System.out.println("Downloading latest spider IP addresses:");
|
System.out.println("Downloading latest spider IP addresses:");
|
||||||
|
|
||||||
// Get the list URLs to download from
|
// Get the list URLs to download from
|
||||||
String urls = ConfigurationManager.getProperty("solr-statistics", "spiderips.urls");
|
String[] urls = DSpaceServicesFactory.getInstance().getConfigurationService().getArrayProperty("solr-statistics.spiderips.urls");
|
||||||
if ((urls == null) || ("".equals(urls)))
|
if((urls == null) || (urls.length==0))
|
||||||
{
|
{
|
||||||
System.err.println(" - Missing setting from dspace.cfg: solr.spiderips.urls");
|
System.err.println(" - Missing setting from dspace.cfg: solr.spiderips.urls");
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the location of spiders directory
|
// Get the location of spiders directory
|
||||||
File spiders = new File(ConfigurationManager.getProperty("dspace.dir"),"config/spiders");
|
File spiders = new File(DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("dspace.dir"),"config/spiders");
|
||||||
|
|
||||||
if (!spiders.exists() && !spiders.mkdirs())
|
if (!spiders.exists() && !spiders.mkdirs())
|
||||||
{
|
{
|
||||||
log.error("Unable to create spiders directory");
|
log.error("Unable to create spiders directory");
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] values = urls.split(",");
|
for (String value : urls)
|
||||||
for (String value : values)
|
|
||||||
{
|
{
|
||||||
value = value.trim();
|
value = value.trim();
|
||||||
System.out.println(" Downloading: " + value);
|
System.out.println(" Downloading: " + value);
|
||||||
|
@@ -12,7 +12,7 @@ import java.util.*;
|
|||||||
|
|
||||||
import org.apache.commons.lang.ArrayUtils;
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.dspace.core.ConfigurationManager;
|
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements MARC 21 standards to disregard initial
|
* Implements MARC 21 standards to disregard initial
|
||||||
@@ -278,18 +278,15 @@ public class MARC21InitialArticleWord extends InitialArticleWord
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Setup default stop words for null languages
|
// Setup default stop words for null languages
|
||||||
String defaultLangs = ConfigurationManager.getProperty("marc21wordfilter.defaultlang");
|
String[] defaultLangs = DSpaceServicesFactory.getInstance().getConfigurationService().getArrayProperty("marc21wordfilter.defaultlang");
|
||||||
if (!StringUtils.isEmpty(defaultLangs))
|
if (ArrayUtils.isNotEmpty(defaultLangs))
|
||||||
{
|
|
||||||
String[] langArr = defaultLangs.split("[, ]+");
|
|
||||||
if (langArr != null && langArr.length > 0)
|
|
||||||
{
|
{
|
||||||
int wordCount = 0;
|
int wordCount = 0;
|
||||||
ArticlesForLang[] afl = new ArticlesForLang[langArr.length];
|
ArticlesForLang[] afl = new ArticlesForLang[defaultLangs.length];
|
||||||
|
|
||||||
for (int idx = 0; idx < afl.length; idx++)
|
for (int idx = 0; idx < afl.length; idx++)
|
||||||
{
|
{
|
||||||
Language l = Language.getLanguage(langArr[idx]);
|
Language l = Language.getLanguage(defaultLangs[idx]);
|
||||||
if (l != null && ianaArticleMap.containsKey(l.IANA))
|
if (l != null && ianaArticleMap.containsKey(l.IANA))
|
||||||
{
|
{
|
||||||
afl[idx] = ianaArticleMap.get(l.IANA);
|
afl[idx] = ianaArticleMap.get(l.IANA);
|
||||||
@@ -315,7 +312,6 @@ public class MARC21InitialArticleWord extends InitialArticleWord
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Wrapper class for inserting word arrays into a map
|
// Wrapper class for inserting word arrays into a map
|
||||||
private static class ArticlesForLang
|
private static class ArticlesForLang
|
||||||
|
@@ -19,10 +19,11 @@ import org.apache.commons.lang.StringUtils;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.dspace.app.webui.json.JSONRequest;
|
import org.dspace.app.webui.json.JSONRequest;
|
||||||
import org.dspace.authorize.AuthorizeException;
|
import org.dspace.authorize.AuthorizeException;
|
||||||
import org.dspace.core.ConfigurationManager;
|
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
import org.dspace.handle.factory.HandleServiceFactory;
|
import org.dspace.handle.factory.HandleServiceFactory;
|
||||||
import org.dspace.handle.service.HandleService;
|
import org.dspace.handle.service.HandleService;
|
||||||
|
import org.dspace.services.ConfigurationService;
|
||||||
|
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
@@ -32,9 +33,11 @@ public class HandleJSONResolver extends JSONRequest
|
|||||||
.getLogger(HandleJSONResolver.class);
|
.getLogger(HandleJSONResolver.class);
|
||||||
|
|
||||||
private HandleService handleService;
|
private HandleService handleService;
|
||||||
|
private ConfigurationService configurationService;
|
||||||
|
|
||||||
public HandleJSONResolver() {
|
public HandleJSONResolver() {
|
||||||
handleService = HandleServiceFactory.getInstance().getHandleService();
|
handleService = HandleServiceFactory.getInstance().getHandleService();
|
||||||
|
configurationService = DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doJSONRequest(Context context, HttpServletRequest request,
|
public void doJSONRequest(Context context, HttpServletRequest request,
|
||||||
@@ -77,11 +80,11 @@ public class HandleJSONResolver extends JSONRequest
|
|||||||
{
|
{
|
||||||
List<String> prefixes = new ArrayList<String>();
|
List<String> prefixes = new ArrayList<String>();
|
||||||
prefixes.add(handleService.getPrefix());
|
prefixes.add(handleService.getPrefix());
|
||||||
String additionalPrefixes = ConfigurationManager
|
String[] additionalPrefixes = configurationService
|
||||||
.getProperty("handle.additional.prefixes");
|
.getArrayProperty("handle.additional.prefixes");
|
||||||
if (StringUtils.isNotBlank(additionalPrefixes))
|
if (additionalPrefixes!=null)
|
||||||
{
|
{
|
||||||
for (String apref : additionalPrefixes.split(","))
|
for (String apref : additionalPrefixes)
|
||||||
{
|
{
|
||||||
prefixes.add(apref.trim());
|
prefixes.add(apref.trim());
|
||||||
}
|
}
|
||||||
@@ -90,7 +93,7 @@ public class HandleJSONResolver extends JSONRequest
|
|||||||
}
|
}
|
||||||
else if (reqPath.startsWith("listhandles/"))
|
else if (reqPath.startsWith("listhandles/"))
|
||||||
{
|
{
|
||||||
if (ConfigurationManager.getBooleanProperty(
|
if (configurationService.getBooleanProperty(
|
||||||
"handle.hide.listhandles", true))
|
"handle.hide.listhandles", true))
|
||||||
{
|
{
|
||||||
resp.sendError(HttpServletResponse.SC_NOT_FOUND);
|
resp.sendError(HttpServletResponse.SC_NOT_FOUND);
|
||||||
|
@@ -23,6 +23,7 @@ import javax.servlet.jsp.JspException;
|
|||||||
import javax.servlet.jsp.JspWriter;
|
import javax.servlet.jsp.JspWriter;
|
||||||
import javax.servlet.jsp.jstl.fmt.LocaleSupport;
|
import javax.servlet.jsp.jstl.fmt.LocaleSupport;
|
||||||
import javax.servlet.jsp.tagext.TagSupport;
|
import javax.servlet.jsp.tagext.TagSupport;
|
||||||
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
@@ -42,10 +43,11 @@ import org.dspace.content.authority.service.MetadataAuthorityService;
|
|||||||
import org.dspace.content.factory.ContentServiceFactory;
|
import org.dspace.content.factory.ContentServiceFactory;
|
||||||
import org.dspace.content.service.BitstreamService;
|
import org.dspace.content.service.BitstreamService;
|
||||||
import org.dspace.content.service.ItemService;
|
import org.dspace.content.service.ItemService;
|
||||||
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.Utils;
|
import org.dspace.core.Utils;
|
||||||
|
import org.dspace.services.ConfigurationService;
|
||||||
|
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||||
import org.dspace.sort.SortOption;
|
import org.dspace.sort.SortOption;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -86,10 +88,10 @@ public class BrowseListTag extends TagSupport
|
|||||||
private boolean disableCrossLinks = false;
|
private boolean disableCrossLinks = false;
|
||||||
|
|
||||||
/** The default fields to be displayed when listing items */
|
/** The default fields to be displayed when listing items */
|
||||||
private static final String DEFAULT_LIST_FIELDS;
|
private static final String[] DEFAULT_LIST_FIELDS;
|
||||||
|
|
||||||
/** The default widths for the columns */
|
/** The default widths for the columns */
|
||||||
private static final String DEFAULT_LIST_WIDTHS;
|
private static final String[] DEFAULT_LIST_WIDTHS;
|
||||||
|
|
||||||
/** The default field which is bound to the browse by date */
|
/** The default field which is bound to the browse by date */
|
||||||
private static String dateField = "dc.date.issued";
|
private static String dateField = "dc.date.issued";
|
||||||
@@ -114,36 +116,39 @@ public class BrowseListTag extends TagSupport
|
|||||||
transient private final BitstreamService bitstreamService
|
transient private final BitstreamService bitstreamService
|
||||||
= ContentServiceFactory.getInstance().getBitstreamService();
|
= ContentServiceFactory.getInstance().getBitstreamService();
|
||||||
|
|
||||||
|
transient private final ConfigurationService configurationService
|
||||||
|
= DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
getThumbSettings();
|
getThumbSettings();
|
||||||
|
|
||||||
if (showThumbs)
|
if (showThumbs)
|
||||||
{
|
{
|
||||||
DEFAULT_LIST_FIELDS = "thumbnail, dc.date.issued(date), dc.title, dc.contributor.*";
|
DEFAULT_LIST_FIELDS = new String[]{"thumbnail", "dc.date.issued(date)", "dc.title", "dc.contributor.*"};
|
||||||
DEFAULT_LIST_WIDTHS = "*, 130, 60%, 40%";
|
DEFAULT_LIST_WIDTHS = new String[]{"*", "130", "60%", "40%"};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DEFAULT_LIST_FIELDS = "dc.date.issued(date), dc.title, dc.contributor.*";
|
DEFAULT_LIST_FIELDS = new String[]{"dc.date.issued(date)", "dc.title", "dc.contributor.*"};
|
||||||
DEFAULT_LIST_WIDTHS = "130, 60%, 40%";
|
DEFAULT_LIST_WIDTHS = new String[]{"130", "60%", "40%"};
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the date and title fields
|
// get the date and title fields
|
||||||
String dateLine = ConfigurationManager.getProperty("webui.browse.index.date");
|
String dateLine = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("webui.browse.index.date");
|
||||||
if (dateLine != null)
|
if (dateLine != null)
|
||||||
{
|
{
|
||||||
dateField = dateLine;
|
dateField = dateLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
String titleLine = ConfigurationManager.getProperty("webui.browse.index.title");
|
String titleLine = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("webui.browse.index.title");
|
||||||
if (titleLine != null)
|
if (titleLine != null)
|
||||||
{
|
{
|
||||||
titleField = titleLine;
|
titleField = titleLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the author truncation config
|
// get the author truncation config
|
||||||
String authorLine = ConfigurationManager.getProperty("webui.browse.author-field");
|
String authorLine = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("webui.browse.author-field");
|
||||||
if (authorLine != null)
|
if (authorLine != null)
|
||||||
{
|
{
|
||||||
authorField = authorLine;
|
authorField = authorLine;
|
||||||
@@ -173,8 +178,8 @@ public class BrowseListTag extends TagSupport
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// get the elements to display
|
// get the elements to display
|
||||||
String browseListLine = null;
|
String[] browseFields = null;
|
||||||
String browseWidthLine = null;
|
String[] browseWidths = null;
|
||||||
|
|
||||||
// As different indexes / sort options may require different columns to be displayed
|
// As different indexes / sort options may require different columns to be displayed
|
||||||
// try to obtain a custom configuration based for the browse that has been performed
|
// try to obtain a custom configuration based for the browse that has been performed
|
||||||
@@ -187,10 +192,10 @@ public class BrowseListTag extends TagSupport
|
|||||||
if (bix != null)
|
if (bix != null)
|
||||||
{
|
{
|
||||||
// First, try to get a configuration for this browse and sort option combined
|
// First, try to get a configuration for this browse and sort option combined
|
||||||
if (so != null && browseListLine == null)
|
if (so != null && ArrayUtils.isEmpty(browseFields))
|
||||||
{
|
{
|
||||||
browseListLine = ConfigurationManager.getProperty("webui.itemlist.browse." + bix.getName() + ".sort." + so.getName() + ".columns");
|
browseFields = configurationService.getArrayProperty("webui.itemlist.browse." + bix.getName() + ".sort." + so.getName() + ".columns");
|
||||||
browseWidthLine = ConfigurationManager.getProperty("webui.itemlist.browse." + bix.getName() + ".sort." + so.getName() + ".widths");
|
browseWidths = configurationService.getArrayProperty("webui.itemlist.browse." + bix.getName() + ".sort." + so.getName() + ".widths");
|
||||||
}
|
}
|
||||||
|
|
||||||
// We haven't got a sort option defined, so get one for the index
|
// We haven't got a sort option defined, so get one for the index
|
||||||
@@ -202,106 +207,72 @@ public class BrowseListTag extends TagSupport
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If no config found, attempt to get one for this sort option
|
// If no config found, attempt to get one for this sort option
|
||||||
if (so != null && browseListLine == null)
|
if (so != null && ArrayUtils.isEmpty(browseFields))
|
||||||
{
|
{
|
||||||
browseListLine = ConfigurationManager.getProperty("webui.itemlist.sort." + so.getName() + ".columns");
|
browseFields = configurationService.getArrayProperty("webui.itemlist.sort." + so.getName() + ".columns");
|
||||||
browseWidthLine = ConfigurationManager.getProperty("webui.itemlist.sort." + so.getName() + ".widths");
|
browseWidths = configurationService.getArrayProperty("webui.itemlist.sort." + so.getName() + ".widths");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no config found, attempt to get one for this browse index
|
// If no config found, attempt to get one for this browse index
|
||||||
if (bix != null && browseListLine == null)
|
if (bix != null && ArrayUtils.isEmpty(browseFields))
|
||||||
{
|
{
|
||||||
browseListLine = ConfigurationManager.getProperty("webui.itemlist.browse." + bix.getName() + ".columns");
|
browseFields = configurationService.getArrayProperty("webui.itemlist.browse." + bix.getName() + ".columns");
|
||||||
browseWidthLine = ConfigurationManager.getProperty("webui.itemlist.browse." + bix.getName() + ".widths");
|
browseWidths = configurationService.getArrayProperty("webui.itemlist.browse." + bix.getName() + ".widths");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no config found, attempt to get a general one, using the sort name
|
// If no config found, attempt to get a general one, using the sort name
|
||||||
if (so != null && browseListLine == null)
|
if (so != null && ArrayUtils.isEmpty(browseFields))
|
||||||
{
|
{
|
||||||
browseListLine = ConfigurationManager.getProperty("webui.itemlist." + so.getName() + ".columns");
|
browseFields = configurationService.getArrayProperty("webui.itemlist." + so.getName() + ".columns");
|
||||||
browseWidthLine = ConfigurationManager.getProperty("webui.itemlist." + so.getName() + ".widths");
|
browseWidths = configurationService.getArrayProperty("webui.itemlist." + so.getName() + ".widths");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no config found, attempt to get a general one, using the index name
|
// If no config found, attempt to get a general one, using the index name
|
||||||
if (bix != null && browseListLine == null)
|
if (bix != null && ArrayUtils.isEmpty(browseFields))
|
||||||
{
|
{
|
||||||
browseListLine = ConfigurationManager.getProperty("webui.itemlist." + bix.getName() + ".columns");
|
browseFields = configurationService.getArrayProperty("webui.itemlist." + bix.getName() + ".columns");
|
||||||
browseWidthLine = ConfigurationManager.getProperty("webui.itemlist." + bix.getName() + ".widths");
|
browseWidths = configurationService.getArrayProperty("webui.itemlist." + bix.getName() + ".widths");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (browseListLine == null)
|
if (ArrayUtils.isEmpty(browseFields))
|
||||||
{
|
{
|
||||||
browseListLine = ConfigurationManager.getProperty("webui.itemlist.columns");
|
browseFields = configurationService.getArrayProperty("webui.itemlist.columns");
|
||||||
browseWidthLine = ConfigurationManager.getProperty("webui.itemlist.widths");
|
browseWidths = configurationService.getArrayProperty("webui.itemlist.widths");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Have we read a field configration from dspace.cfg?
|
// Have we read a field configration from dspace.cfg?
|
||||||
if (browseListLine != null)
|
if (ArrayUtils.isNotEmpty(browseFields))
|
||||||
{
|
{
|
||||||
// If thumbnails are disabled, strip out any thumbnail column from the configuration
|
// If thumbnails are disabled, strip out any thumbnail column from the configuration
|
||||||
if (!showThumbs && browseListLine.contains("thumbnail"))
|
if (!showThumbs)
|
||||||
{
|
{
|
||||||
// Ensure we haven't got any nulls
|
// check if it contains a thumbnail entry
|
||||||
browseListLine = browseListLine == null ? "" : browseListLine;
|
// If so, remove it, and the width associated with it
|
||||||
browseWidthLine = browseWidthLine == null ? "" : browseWidthLine;
|
int thumbnailIndex = ArrayUtils.indexOf(browseFields, "thumbnail");
|
||||||
|
if(thumbnailIndex>=0)
|
||||||
// Tokenize the field and width lines
|
|
||||||
StringTokenizer bllt = new StringTokenizer(browseListLine, ",");
|
|
||||||
StringTokenizer bwlt = new StringTokenizer(browseWidthLine, ",");
|
|
||||||
|
|
||||||
StringBuilder newBLLine = new StringBuilder();
|
|
||||||
StringBuilder newBWLine = new StringBuilder();
|
|
||||||
while (bllt.hasMoreTokens() || bwlt.hasMoreTokens())
|
|
||||||
{
|
{
|
||||||
String browseListTok = bllt.hasMoreTokens() ? bllt.nextToken() : null;
|
browseFields = (String[]) ArrayUtils.remove(browseFields, thumbnailIndex);
|
||||||
String browseWidthTok = bwlt.hasMoreTokens() ? bwlt.nextToken() : null;
|
if(ArrayUtils.isNotEmpty(browseWidths))
|
||||||
|
|
||||||
// Only use the Field and Width tokens, if the field isn't 'thumbnail'
|
|
||||||
if (browseListTok == null || !browseListTok.trim().equals("thumbnail"))
|
|
||||||
{
|
{
|
||||||
if (browseListTok != null)
|
browseWidths = (String[]) ArrayUtils.remove(browseWidths, thumbnailIndex);
|
||||||
{
|
|
||||||
if (newBLLine.length() > 0)
|
|
||||||
{
|
|
||||||
newBLLine.append(",");
|
|
||||||
}
|
|
||||||
|
|
||||||
newBLLine.append(browseListTok);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (browseWidthTok != null)
|
|
||||||
{
|
|
||||||
if (newBWLine.length() > 0)
|
|
||||||
{
|
|
||||||
newBWLine.append(",");
|
|
||||||
}
|
|
||||||
|
|
||||||
newBWLine.append(browseWidthTok);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use the newly built configuration file
|
|
||||||
browseListLine = newBLLine.toString();
|
|
||||||
browseWidthLine = newBWLine.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
browseListLine = DEFAULT_LIST_FIELDS;
|
browseFields = DEFAULT_LIST_FIELDS;
|
||||||
browseWidthLine = DEFAULT_LIST_WIDTHS;
|
browseWidths = DEFAULT_LIST_WIDTHS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Arrays used to hold the information we will require when outputting each row
|
// Arrays used to hold the information we will require when outputting each row
|
||||||
String[] fieldArr = browseListLine == null ? new String[0] : browseListLine.split("\\s*,\\s*");
|
boolean isDate[] = new boolean[browseFields.length];
|
||||||
String[] widthArr = browseWidthLine == null ? new String[0] : browseWidthLine.split("\\s*,\\s*");
|
boolean emph[] = new boolean[browseFields.length];
|
||||||
boolean isDate[] = new boolean[fieldArr.length];
|
boolean isAuthor[] = new boolean[browseFields.length];
|
||||||
boolean emph[] = new boolean[fieldArr.length];
|
boolean viewFull[] = new boolean[browseFields.length];
|
||||||
boolean isAuthor[] = new boolean[fieldArr.length];
|
String[] browseType = new String[browseFields.length];
|
||||||
boolean viewFull[] = new boolean[fieldArr.length];
|
String[] cOddOrEven = new String[browseFields.length];
|
||||||
String[] browseType = new String[fieldArr.length];
|
|
||||||
String[] cOddOrEven = new String[fieldArr.length];
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -309,11 +280,11 @@ public class BrowseListTag extends TagSupport
|
|||||||
CrossLinks cl = new CrossLinks();
|
CrossLinks cl = new CrossLinks();
|
||||||
|
|
||||||
// Get a width for the table
|
// Get a width for the table
|
||||||
String tablewidth = ConfigurationManager.getProperty("webui.itemlist.tablewidth");
|
String tablewidth = configurationService.getProperty("webui.itemlist.tablewidth");
|
||||||
|
|
||||||
// If we have column widths, try to use a fixed layout table - faster for browsers to render
|
// If we have column widths, try to use a fixed layout table - faster for browsers to render
|
||||||
// but not if we have to add an 'edit item' button - we can't know how big it will be
|
// but not if we have to add an 'edit item' button - we can't know how big it will be
|
||||||
if (widthArr.length > 0 && widthArr.length == fieldArr.length && !linkToEdit)
|
if (ArrayUtils.isNotEmpty(browseWidths) && browseWidths.length == browseFields.length && !linkToEdit)
|
||||||
{
|
{
|
||||||
// If the table width has been specified, we can make this a fixed layout
|
// If the table width has been specified, we can make this a fixed layout
|
||||||
if (!StringUtils.isEmpty(tablewidth))
|
if (!StringUtils.isEmpty(tablewidth))
|
||||||
@@ -329,18 +300,18 @@ public class BrowseListTag extends TagSupport
|
|||||||
// Output the known column widths
|
// Output the known column widths
|
||||||
out.print("<colgroup>");
|
out.print("<colgroup>");
|
||||||
|
|
||||||
for (int w = 0; w < widthArr.length; w++)
|
for (int w = 0; w < browseWidths.length; w++)
|
||||||
{
|
{
|
||||||
out.print("<col width=\"");
|
out.print("<col width=\"");
|
||||||
|
|
||||||
// For a thumbnail column of width '*', use the configured max width for thumbnails
|
// For a thumbnail column of width '*', use the configured max width for thumbnails
|
||||||
if (fieldArr[w].equals("thumbnail") && widthArr[w].equals("*"))
|
if (browseFields[w].equals("thumbnail") && browseWidths[w].equals("*"))
|
||||||
{
|
{
|
||||||
out.print(thumbItemListMaxWidth);
|
out.print(thumbItemListMaxWidth);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
out.print(StringUtils.isEmpty(widthArr[w]) ? "*" : widthArr[w]);
|
out.print(StringUtils.isEmpty(browseWidths[w]) ? "*" : browseWidths[w]);
|
||||||
}
|
}
|
||||||
|
|
||||||
out.print("\" />");
|
out.print("\" />");
|
||||||
@@ -360,9 +331,9 @@ public class BrowseListTag extends TagSupport
|
|||||||
// Output the table headers
|
// Output the table headers
|
||||||
out.println("<tr>");
|
out.println("<tr>");
|
||||||
|
|
||||||
for (int colIdx = 0; colIdx < fieldArr.length; colIdx++)
|
for (int colIdx = 0; colIdx < browseFields.length; colIdx++)
|
||||||
{
|
{
|
||||||
String field = fieldArr[colIdx].toLowerCase().trim();
|
String field = browseFields[colIdx].toLowerCase().trim();
|
||||||
cOddOrEven[colIdx] = (((colIdx + 1) % 2) == 0 ? "Odd" : "Even");
|
cOddOrEven[colIdx] = (((colIdx + 1) % 2) == 0 ? "Odd" : "Even");
|
||||||
|
|
||||||
// find out if the field is a date
|
// find out if the field is a date
|
||||||
@@ -373,7 +344,7 @@ public class BrowseListTag extends TagSupport
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Cache any modifications to field
|
// Cache any modifications to field
|
||||||
fieldArr[colIdx] = field;
|
browseFields[colIdx] = field;
|
||||||
|
|
||||||
// find out if this is the author column
|
// find out if this is the author column
|
||||||
if (field.equals(authorField))
|
if (field.equals(authorField))
|
||||||
@@ -440,9 +411,9 @@ public class BrowseListTag extends TagSupport
|
|||||||
// now prepare the XHTML frag for this division
|
// now prepare the XHTML frag for this division
|
||||||
String rOddOrEven;
|
String rOddOrEven;
|
||||||
|
|
||||||
for (int colIdx = 0; colIdx < fieldArr.length; colIdx++)
|
for (int colIdx = 0; colIdx < browseFields.length; colIdx++)
|
||||||
{
|
{
|
||||||
String field = fieldArr[colIdx];
|
String field = browseFields[colIdx];
|
||||||
|
|
||||||
// get the schema and the element qualifier pair
|
// get the schema and the element qualifier pair
|
||||||
// (Note, the schema is not used for anything yet)
|
// (Note, the schema is not used for anything yet)
|
||||||
@@ -773,31 +744,34 @@ public class BrowseListTag extends TagSupport
|
|||||||
/* get the required thumbnail config items */
|
/* get the required thumbnail config items */
|
||||||
private static void getThumbSettings()
|
private static void getThumbSettings()
|
||||||
{
|
{
|
||||||
showThumbs = ConfigurationManager
|
ConfigurationService configurationService =
|
||||||
|
DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||||
|
|
||||||
|
showThumbs = configurationService
|
||||||
.getBooleanProperty("webui.browse.thumbnail.show");
|
.getBooleanProperty("webui.browse.thumbnail.show");
|
||||||
|
|
||||||
if (showThumbs)
|
if (showThumbs)
|
||||||
{
|
{
|
||||||
thumbItemListMaxHeight = ConfigurationManager
|
thumbItemListMaxHeight = configurationService
|
||||||
.getIntProperty("webui.browse.thumbnail.maxheight");
|
.getIntProperty("webui.browse.thumbnail.maxheight");
|
||||||
|
|
||||||
if (thumbItemListMaxHeight == 0)
|
if (thumbItemListMaxHeight == 0)
|
||||||
{
|
{
|
||||||
thumbItemListMaxHeight = ConfigurationManager
|
thumbItemListMaxHeight = configurationService
|
||||||
.getIntProperty("thumbnail.maxheight");
|
.getIntProperty("thumbnail.maxheight");
|
||||||
}
|
}
|
||||||
|
|
||||||
thumbItemListMaxWidth = ConfigurationManager
|
thumbItemListMaxWidth = configurationService
|
||||||
.getIntProperty("webui.browse.thumbnail.maxwidth");
|
.getIntProperty("webui.browse.thumbnail.maxwidth");
|
||||||
|
|
||||||
if (thumbItemListMaxWidth == 0)
|
if (thumbItemListMaxWidth == 0)
|
||||||
{
|
{
|
||||||
thumbItemListMaxWidth = ConfigurationManager
|
thumbItemListMaxWidth = configurationService
|
||||||
.getIntProperty("thumbnail.maxwidth");
|
.getIntProperty("thumbnail.maxwidth");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String linkBehaviour = ConfigurationManager
|
String linkBehaviour = configurationService
|
||||||
.getProperty("webui.browse.thumbnail.linkbehaviour");
|
.getProperty("webui.browse.thumbnail.linkbehaviour");
|
||||||
|
|
||||||
if (linkBehaviour != null && linkBehaviour.equals("bitstream"))
|
if (linkBehaviour != null && linkBehaviour.equals("bitstream"))
|
||||||
|
@@ -23,6 +23,7 @@ import javax.servlet.jsp.JspException;
|
|||||||
import javax.servlet.jsp.JspWriter;
|
import javax.servlet.jsp.JspWriter;
|
||||||
import javax.servlet.jsp.jstl.fmt.LocaleSupport;
|
import javax.servlet.jsp.jstl.fmt.LocaleSupport;
|
||||||
import javax.servlet.jsp.tagext.TagSupport;
|
import javax.servlet.jsp.tagext.TagSupport;
|
||||||
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
@@ -41,10 +42,11 @@ import org.dspace.content.authority.service.MetadataAuthorityService;
|
|||||||
import org.dspace.content.factory.ContentServiceFactory;
|
import org.dspace.content.factory.ContentServiceFactory;
|
||||||
import org.dspace.content.service.BitstreamService;
|
import org.dspace.content.service.BitstreamService;
|
||||||
import org.dspace.content.service.ItemService;
|
import org.dspace.content.service.ItemService;
|
||||||
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.Utils;
|
import org.dspace.core.Utils;
|
||||||
|
import org.dspace.services.ConfigurationService;
|
||||||
|
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||||
import org.dspace.sort.SortOption;
|
import org.dspace.sort.SortOption;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -84,10 +86,10 @@ public class ItemListTag extends TagSupport
|
|||||||
private boolean disableCrossLinks = false;
|
private boolean disableCrossLinks = false;
|
||||||
|
|
||||||
/** The default fields to be displayed when listing items */
|
/** The default fields to be displayed when listing items */
|
||||||
private static final String DEFAULT_LIST_FIELDS;
|
private static final String[] DEFAULT_LIST_FIELDS;
|
||||||
|
|
||||||
/** The default widths for the columns */
|
/** The default widths for the columns */
|
||||||
private static final String DEFAULT_LIST_WIDTHS;
|
private static final String[] DEFAULT_LIST_WIDTHS;
|
||||||
|
|
||||||
/** The default field which is bound to the browse by date */
|
/** The default field which is bound to the browse by date */
|
||||||
private static String dateField = "dc.date.issued";
|
private static String dateField = "dc.date.issued";
|
||||||
@@ -112,35 +114,38 @@ public class ItemListTag extends TagSupport
|
|||||||
private final transient BitstreamService bitstreamService
|
private final transient BitstreamService bitstreamService
|
||||||
= ContentServiceFactory.getInstance().getBitstreamService();
|
= ContentServiceFactory.getInstance().getBitstreamService();
|
||||||
|
|
||||||
|
private final transient ConfigurationService configurationService
|
||||||
|
= DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
getThumbSettings();
|
getThumbSettings();
|
||||||
|
|
||||||
if (showThumbs)
|
if (showThumbs)
|
||||||
{
|
{
|
||||||
DEFAULT_LIST_FIELDS = "thumbnail, dc.date.issued(date), dc.title, dc.contributor.*";
|
DEFAULT_LIST_FIELDS = new String[] {"thumbnail", "dc.date.issued(date)", "dc.title", "dc.contributor.*"};
|
||||||
DEFAULT_LIST_WIDTHS = "*, 130, 60%, 40%";
|
DEFAULT_LIST_WIDTHS = new String[] {"*", "130", "60%", "40%"};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DEFAULT_LIST_FIELDS = "dc.date.issued(date), dc.title, dc.contributor.*";
|
DEFAULT_LIST_FIELDS = new String[] {"dc.date.issued(date)", "dc.title", "dc.contributor.*"};
|
||||||
DEFAULT_LIST_WIDTHS = "130, 60%, 40%";
|
DEFAULT_LIST_WIDTHS = new String[] {"130", "60%", "40%"};
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the date and title fields
|
// get the date and title fields
|
||||||
String dateLine = ConfigurationManager.getProperty("webui.browse.index.date");
|
String dateLine = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("webui.browse.index.date");
|
||||||
if (dateLine != null)
|
if (dateLine != null)
|
||||||
{
|
{
|
||||||
dateField = dateLine;
|
dateField = dateLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
String titleLine = ConfigurationManager.getProperty("webui.browse.index.title");
|
String titleLine = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("webui.browse.index.title");
|
||||||
if (titleLine != null)
|
if (titleLine != null)
|
||||||
{
|
{
|
||||||
titleField = titleLine;
|
titleField = titleLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
String authorLine = ConfigurationManager.getProperty("webui.browse.author-field");
|
String authorLine = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("webui.browse.author-field");
|
||||||
if (authorLine != null)
|
if (authorLine != null)
|
||||||
{
|
{
|
||||||
authorField = authorLine;
|
authorField = authorLine;
|
||||||
@@ -168,96 +173,62 @@ public class ItemListTag extends TagSupport
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get the elements to display
|
// get the elements to display
|
||||||
String configLine = null;
|
String[] browseFields = null;
|
||||||
String widthLine = null;
|
String[] browseWidths = null;
|
||||||
|
|
||||||
if (sortOption != null)
|
if (sortOption != null)
|
||||||
{
|
{
|
||||||
if (configLine == null)
|
if (ArrayUtils.isEmpty(browseFields))
|
||||||
{
|
{
|
||||||
configLine = ConfigurationManager.getProperty("webui.itemlist.sort." + sortOption.getName() + ".columns");
|
browseFields = configurationService.getArrayProperty("webui.itemlist.sort." + sortOption.getName() + ".columns");
|
||||||
widthLine = ConfigurationManager.getProperty("webui.itemlist.sort." + sortOption.getName() + ".widths");
|
browseWidths = configurationService.getArrayProperty("webui.itemlist.sort." + sortOption.getName() + ".widths");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (configLine == null)
|
if (ArrayUtils.isEmpty(browseFields))
|
||||||
{
|
{
|
||||||
configLine = ConfigurationManager.getProperty("webui.itemlist." + sortOption.getName() + ".columns");
|
browseFields = configurationService.getArrayProperty("webui.itemlist." + sortOption.getName() + ".columns");
|
||||||
widthLine = ConfigurationManager.getProperty("webui.itemlist." + sortOption.getName() + ".widths");
|
browseWidths = configurationService.getArrayProperty("webui.itemlist." + sortOption.getName() + ".widths");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (configLine == null)
|
if (ArrayUtils.isEmpty(browseFields))
|
||||||
{
|
{
|
||||||
configLine = ConfigurationManager.getProperty("webui.itemlist.columns");
|
browseFields = configurationService.getArrayProperty("webui.itemlist.columns");
|
||||||
widthLine = ConfigurationManager.getProperty("webui.itemlist.widths");
|
browseWidths = configurationService.getArrayProperty("webui.itemlist.widths");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Have we read a field configration from dspace.cfg?
|
// Have we read a field configration from dspace.cfg?
|
||||||
if (configLine != null)
|
if (ArrayUtils.isNotEmpty(browseFields))
|
||||||
{
|
{
|
||||||
// If thumbnails are disabled, strip out any thumbnail column from the configuration
|
// If thumbnails are disabled, strip out any thumbnail column from the configuration
|
||||||
if (!showThumbs && configLine.contains("thumbnail"))
|
if (!showThumbs)
|
||||||
{
|
{
|
||||||
// Ensure we haven't got any nulls
|
// check if it contains a thumbnail entry
|
||||||
configLine = configLine == null ? "" : configLine;
|
// If so, remove it, and the width associated with it
|
||||||
widthLine = widthLine == null ? "" : widthLine;
|
int thumbnailIndex = ArrayUtils.indexOf(browseFields, "thumbnail");
|
||||||
|
if(thumbnailIndex>=0)
|
||||||
// Tokenize the field and width lines
|
|
||||||
StringTokenizer llt = new StringTokenizer(configLine, ",");
|
|
||||||
StringTokenizer wlt = new StringTokenizer(widthLine, ",");
|
|
||||||
|
|
||||||
StringBuilder newLLine = new StringBuilder();
|
|
||||||
StringBuilder newWLine = new StringBuilder();
|
|
||||||
while (llt.hasMoreTokens() || wlt.hasMoreTokens())
|
|
||||||
{
|
{
|
||||||
String listTok = llt.hasMoreTokens() ? llt.nextToken() : null;
|
browseFields = (String[]) ArrayUtils.remove(browseFields, thumbnailIndex);
|
||||||
String widthTok = wlt.hasMoreTokens() ? wlt.nextToken() : null;
|
if(ArrayUtils.isNotEmpty(browseWidths))
|
||||||
|
|
||||||
// Only use the Field and Width tokens, if the field isn't 'thumbnail'
|
|
||||||
if (listTok == null || !listTok.trim().equals("thumbnail"))
|
|
||||||
{
|
{
|
||||||
if (listTok != null)
|
browseWidths = (String[]) ArrayUtils.remove(browseWidths, thumbnailIndex);
|
||||||
{
|
|
||||||
if (newLLine.length() > 0)
|
|
||||||
{
|
|
||||||
newLLine.append(",");
|
|
||||||
}
|
|
||||||
|
|
||||||
newLLine.append(listTok);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (widthTok != null)
|
|
||||||
{
|
|
||||||
if (newWLine.length() > 0)
|
|
||||||
{
|
|
||||||
newWLine.append(",");
|
|
||||||
}
|
|
||||||
|
|
||||||
newWLine.append(widthTok);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use the newly built configuration file
|
|
||||||
configLine = newLLine.toString();
|
|
||||||
widthLine = newWLine.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
configLine = DEFAULT_LIST_FIELDS;
|
browseFields = DEFAULT_LIST_FIELDS;
|
||||||
widthLine = DEFAULT_LIST_WIDTHS;
|
browseWidths = DEFAULT_LIST_WIDTHS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Arrays used to hold the information we will require when outputting each row
|
// Arrays used to hold the information we will require when outputting each row
|
||||||
String[] fieldArr = configLine == null ? new String[0] : configLine.split("\\s*,\\s*");
|
boolean isDate[] = new boolean[browseFields.length];
|
||||||
String[] widthArr = widthLine == null ? new String[0] : widthLine.split("\\s*,\\s*");
|
boolean emph[] = new boolean[browseFields.length];
|
||||||
boolean isDate[] = new boolean[fieldArr.length];
|
boolean isAuthor[] = new boolean[browseFields.length];
|
||||||
boolean emph[] = new boolean[fieldArr.length];
|
boolean viewFull[] = new boolean[browseFields.length];
|
||||||
boolean isAuthor[] = new boolean[fieldArr.length];
|
String[] browseType = new String[browseFields.length];
|
||||||
boolean viewFull[] = new boolean[fieldArr.length];
|
String[] cOddOrEven = new String[browseFields.length];
|
||||||
String[] browseType = new String[fieldArr.length];
|
|
||||||
String[] cOddOrEven = new String[fieldArr.length];
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -265,11 +236,11 @@ public class ItemListTag extends TagSupport
|
|||||||
CrossLinks cl = new CrossLinks();
|
CrossLinks cl = new CrossLinks();
|
||||||
|
|
||||||
// Get a width for the table
|
// Get a width for the table
|
||||||
String tablewidth = ConfigurationManager.getProperty("webui.itemlist.tablewidth");
|
String tablewidth = configurationService.getProperty("webui.itemlist.tablewidth");
|
||||||
|
|
||||||
// If we have column widths, output a fixed layout table - faster for browsers to render
|
// If we have column widths, output a fixed layout table - faster for browsers to render
|
||||||
// but not if we have to add an 'edit item' button - we can't know how big it will be
|
// but not if we have to add an 'edit item' button - we can't know how big it will be
|
||||||
if (widthArr.length > 0 && widthArr.length == fieldArr.length && !linkToEdit)
|
if (ArrayUtils.isNotEmpty(browseWidths) && browseWidths.length == browseFields.length && !linkToEdit)
|
||||||
{
|
{
|
||||||
// If the table width has been specified, we can make this a fixed layout
|
// If the table width has been specified, we can make this a fixed layout
|
||||||
if (!StringUtils.isEmpty(tablewidth))
|
if (!StringUtils.isEmpty(tablewidth))
|
||||||
@@ -285,18 +256,18 @@ public class ItemListTag extends TagSupport
|
|||||||
// Output the known column widths
|
// Output the known column widths
|
||||||
out.print("<colgroup>");
|
out.print("<colgroup>");
|
||||||
|
|
||||||
for (int w = 0; w < widthArr.length; w++)
|
for (int w = 0; w < browseWidths.length; w++)
|
||||||
{
|
{
|
||||||
out.print("<col width=\"");
|
out.print("<col width=\"");
|
||||||
|
|
||||||
// For a thumbnail column of width '*', use the configured max width for thumbnails
|
// For a thumbnail column of width '*', use the configured max width for thumbnails
|
||||||
if (fieldArr[w].equals("thumbnail") && widthArr[w].equals("*"))
|
if (browseFields[w].equals("thumbnail") && browseWidths[w].equals("*"))
|
||||||
{
|
{
|
||||||
out.print(thumbItemListMaxWidth);
|
out.print(thumbItemListMaxWidth);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
out.print(StringUtils.isEmpty(widthArr[w]) ? "*" : widthArr[w]);
|
out.print(StringUtils.isEmpty(browseWidths[w]) ? "*" : browseWidths[w]);
|
||||||
}
|
}
|
||||||
|
|
||||||
out.print("\" />");
|
out.print("\" />");
|
||||||
@@ -316,9 +287,9 @@ public class ItemListTag extends TagSupport
|
|||||||
// Output the table headers
|
// Output the table headers
|
||||||
out.println("<tr>");
|
out.println("<tr>");
|
||||||
|
|
||||||
for (int colIdx = 0; colIdx < fieldArr.length; colIdx++)
|
for (int colIdx = 0; colIdx < browseFields.length; colIdx++)
|
||||||
{
|
{
|
||||||
String field = fieldArr[colIdx].toLowerCase().trim();
|
String field = browseFields[colIdx].toLowerCase().trim();
|
||||||
cOddOrEven[colIdx] = (((colIdx + 1) % 2) == 0 ? "Odd" : "Even");
|
cOddOrEven[colIdx] = (((colIdx + 1) % 2) == 0 ? "Odd" : "Even");
|
||||||
|
|
||||||
// find out if the field is a date
|
// find out if the field is a date
|
||||||
@@ -329,7 +300,7 @@ public class ItemListTag extends TagSupport
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Cache any modifications to field
|
// Cache any modifications to field
|
||||||
fieldArr[colIdx] = field;
|
browseFields[colIdx] = field;
|
||||||
|
|
||||||
// find out if this is the author column
|
// find out if this is the author column
|
||||||
if (field.equals(authorField))
|
if (field.equals(authorField))
|
||||||
@@ -393,9 +364,9 @@ public class ItemListTag extends TagSupport
|
|||||||
// now prepare the XHTML frag for this division
|
// now prepare the XHTML frag for this division
|
||||||
out.print("<tr>");
|
out.print("<tr>");
|
||||||
|
|
||||||
for (int colIdx = 0; colIdx < fieldArr.length; colIdx++)
|
for (int colIdx = 0; colIdx < browseFields.length; colIdx++)
|
||||||
{
|
{
|
||||||
String field = fieldArr[colIdx];
|
String field = browseFields[colIdx];
|
||||||
|
|
||||||
// get the schema and the element qualifier pair
|
// get the schema and the element qualifier pair
|
||||||
// (Note, the schema is not used for anything yet)
|
// (Note, the schema is not used for anything yet)
|
||||||
@@ -741,31 +712,34 @@ public class ItemListTag extends TagSupport
|
|||||||
/* get the required thumbnail config items */
|
/* get the required thumbnail config items */
|
||||||
private static void getThumbSettings()
|
private static void getThumbSettings()
|
||||||
{
|
{
|
||||||
showThumbs = ConfigurationManager
|
ConfigurationService configurationService =
|
||||||
|
DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||||
|
|
||||||
|
showThumbs = configurationService
|
||||||
.getBooleanProperty("webui.browse.thumbnail.show");
|
.getBooleanProperty("webui.browse.thumbnail.show");
|
||||||
|
|
||||||
if (showThumbs)
|
if (showThumbs)
|
||||||
{
|
{
|
||||||
thumbItemListMaxHeight = ConfigurationManager
|
thumbItemListMaxHeight = configurationService
|
||||||
.getIntProperty("webui.browse.thumbnail.maxheight");
|
.getIntProperty("webui.browse.thumbnail.maxheight");
|
||||||
|
|
||||||
if (thumbItemListMaxHeight == 0)
|
if (thumbItemListMaxHeight == 0)
|
||||||
{
|
{
|
||||||
thumbItemListMaxHeight = ConfigurationManager
|
thumbItemListMaxHeight = configurationService
|
||||||
.getIntProperty("thumbnail.maxheight");
|
.getIntProperty("thumbnail.maxheight");
|
||||||
}
|
}
|
||||||
|
|
||||||
thumbItemListMaxWidth = ConfigurationManager
|
thumbItemListMaxWidth = configurationService
|
||||||
.getIntProperty("webui.browse.thumbnail.maxwidth");
|
.getIntProperty("webui.browse.thumbnail.maxwidth");
|
||||||
|
|
||||||
if (thumbItemListMaxWidth == 0)
|
if (thumbItemListMaxWidth == 0)
|
||||||
{
|
{
|
||||||
thumbItemListMaxWidth = ConfigurationManager
|
thumbItemListMaxWidth = configurationService
|
||||||
.getIntProperty("thumbnail.maxwidth");
|
.getIntProperty("thumbnail.maxwidth");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String linkBehaviour = ConfigurationManager
|
String linkBehaviour = configurationService
|
||||||
.getProperty("webui.browse.thumbnail.linkbehaviour");
|
.getProperty("webui.browse.thumbnail.linkbehaviour");
|
||||||
|
|
||||||
if ("bitstream".equals(linkBehaviour))
|
if ("bitstream".equals(linkBehaviour))
|
||||||
|
@@ -41,7 +41,6 @@ import org.dspace.content.Item;
|
|||||||
import org.dspace.content.factory.ContentServiceFactory;
|
import org.dspace.content.factory.ContentServiceFactory;
|
||||||
import org.dspace.content.service.CollectionService;
|
import org.dspace.content.service.CollectionService;
|
||||||
import org.dspace.content.service.CommunityService;
|
import org.dspace.content.service.CommunityService;
|
||||||
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.LogManager;
|
import org.dspace.core.LogManager;
|
||||||
@@ -49,6 +48,8 @@ import org.dspace.eperson.Group;
|
|||||||
import org.dspace.handle.factory.HandleServiceFactory;
|
import org.dspace.handle.factory.HandleServiceFactory;
|
||||||
import org.dspace.handle.service.HandleService;
|
import org.dspace.handle.service.HandleService;
|
||||||
import org.dspace.search.Harvest;
|
import org.dspace.search.Harvest;
|
||||||
|
import org.dspace.services.ConfigurationService;
|
||||||
|
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||||
import org.dspace.sort.SortException;
|
import org.dspace.sort.SortException;
|
||||||
import org.dspace.sort.SortOption;
|
import org.dspace.sort.SortOption;
|
||||||
|
|
||||||
@@ -74,21 +75,24 @@ public class FeedServlet extends DSpaceServlet
|
|||||||
private static final String clazz = "org.dspace.app.webui.servlet.FeedServlet";
|
private static final String clazz = "org.dspace.app.webui.servlet.FeedServlet";
|
||||||
|
|
||||||
// are syndication feeds enabled?
|
// are syndication feeds enabled?
|
||||||
private static boolean enabled = false;
|
private boolean enabled = false;
|
||||||
// number of DSpace items per feed
|
// number of DSpace items per feed
|
||||||
private static int itemCount = 0;
|
private int itemCount = 0;
|
||||||
// optional cache of feeds
|
// optional cache of feeds
|
||||||
private static Map<String, CacheFeed> feedCache = null;
|
private static Map<String, CacheFeed> feedCache = null;
|
||||||
// maximum size of cache - 0 means caching disabled
|
// maximum size of cache - 0 means caching disabled
|
||||||
private static int cacheSize = 0;
|
private static int cacheSize = 0;
|
||||||
// how many days to keep a feed in cache before checking currency
|
// how many days to keep a feed in cache before checking currency
|
||||||
private static int cacheAge = 0;
|
private int cacheAge = 0;
|
||||||
// supported syndication formats
|
// supported syndication formats
|
||||||
private static List<String> formats = null;
|
private List<String> formats = null;
|
||||||
// Whether to include private items or not
|
// Whether to include private items or not
|
||||||
private static boolean includeAll = true;
|
private boolean includeAll = true;
|
||||||
|
|
||||||
// services API
|
// services API
|
||||||
|
private final transient ConfigurationService configurationService
|
||||||
|
= DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||||
|
|
||||||
private final transient HandleService handleService
|
private final transient HandleService handleService
|
||||||
= HandleServiceFactory.getInstance().getHandleService();
|
= HandleServiceFactory.getInstance().getHandleService();
|
||||||
|
|
||||||
@@ -98,30 +102,29 @@ public class FeedServlet extends DSpaceServlet
|
|||||||
private final transient CollectionService collectionService
|
private final transient CollectionService collectionService
|
||||||
= ContentServiceFactory.getInstance().getCollectionService();
|
= ContentServiceFactory.getInstance().getCollectionService();
|
||||||
|
|
||||||
static
|
public FeedServlet()
|
||||||
{
|
{
|
||||||
enabled = ConfigurationManager.getBooleanProperty("webui.feed.enable");
|
enabled = configurationService.getBooleanProperty("webui.feed.enable");
|
||||||
|
|
||||||
// read rest of config info if enabled
|
// read rest of config info if enabled
|
||||||
if (enabled)
|
if (enabled)
|
||||||
{
|
{
|
||||||
String fmtsStr = ConfigurationManager.getProperty("webui.feed.formats");
|
String[] fmts = configurationService.getArrayProperty("webui.feed.formats");
|
||||||
if ( fmtsStr != null )
|
if ( fmts != null )
|
||||||
{
|
{
|
||||||
formats = new ArrayList<>();
|
formats = new ArrayList<>();
|
||||||
String[] fmts = fmtsStr.split(",");
|
for (String format : fmts)
|
||||||
for (int i = 0; i < fmts.length; i++)
|
|
||||||
{
|
{
|
||||||
formats.add(fmts[i]);
|
formats.add(format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
itemCount = ConfigurationManager.getIntProperty("webui.feed.items");
|
itemCount = configurationService.getIntProperty("webui.feed.items");
|
||||||
cacheSize = ConfigurationManager.getIntProperty("webui.feed.cache.size");
|
cacheSize = configurationService.getIntProperty("webui.feed.cache.size");
|
||||||
if (cacheSize > 0)
|
if (cacheSize > 0)
|
||||||
{
|
{
|
||||||
feedCache = new HashMap<>();
|
feedCache = new HashMap<>();
|
||||||
cacheAge = ConfigurationManager.getIntProperty("webui.feed.cache.age");
|
cacheAge = configurationService.getIntProperty("webui.feed.cache.age");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -131,7 +134,7 @@ public class FeedServlet extends DSpaceServlet
|
|||||||
HttpServletResponse response) throws ServletException, IOException,
|
HttpServletResponse response) throws ServletException, IOException,
|
||||||
SQLException, AuthorizeException
|
SQLException, AuthorizeException
|
||||||
{
|
{
|
||||||
includeAll = ConfigurationManager.getBooleanProperty("harvest.includerestricted.rss", true);
|
includeAll = configurationService.getBooleanProperty("harvest.includerestricted.rss", true);
|
||||||
String path = request.getPathInfo();
|
String path = request.getPathInfo();
|
||||||
String feedType = null;
|
String feedType = null;
|
||||||
String handle = null;
|
String handle = null;
|
||||||
@@ -291,7 +294,7 @@ public class FeedServlet extends DSpaceServlet
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// new method of doing the browse:
|
// new method of doing the browse:
|
||||||
String idx = ConfigurationManager.getProperty("recent.submissions.sort-option");
|
String idx = configurationService.getProperty("recent.submissions.sort-option");
|
||||||
if (idx == null)
|
if (idx == null)
|
||||||
{
|
{
|
||||||
throw new IOException("There is no configuration supplied for: recent.submissions.sort-option");
|
throw new IOException("There is no configuration supplied for: recent.submissions.sort-option");
|
||||||
|
@@ -34,13 +34,14 @@ import org.dspace.content.factory.ContentServiceFactory;
|
|||||||
import org.dspace.content.service.CollectionService;
|
import org.dspace.content.service.CollectionService;
|
||||||
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.core.I18nUtil;
|
import org.dspace.core.I18nUtil;
|
||||||
import org.dspace.core.LogManager;
|
import org.dspace.core.LogManager;
|
||||||
import org.dspace.curate.Curator;
|
import org.dspace.curate.Curator;
|
||||||
import org.dspace.handle.factory.HandleServiceFactory;
|
import org.dspace.handle.factory.HandleServiceFactory;
|
||||||
import org.dspace.handle.service.HandleService;
|
import org.dspace.handle.service.HandleService;
|
||||||
|
import org.dspace.services.ConfigurationService;
|
||||||
|
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -49,22 +50,23 @@ import org.dspace.handle.service.HandleService;
|
|||||||
public class CurateServlet extends DSpaceServlet
|
public class CurateServlet extends DSpaceServlet
|
||||||
{
|
{
|
||||||
// Name of queue used when tasks queued in Admin UI
|
// Name of queue used when tasks queued in Admin UI
|
||||||
private static final String TASK_QUEUE_NAME = ConfigurationManager.getProperty("curate", "ui.queuename");
|
private final String TASK_QUEUE_NAME;
|
||||||
|
|
||||||
// curation status codes in Admin UI: key=status code, value=localized name
|
// curation status codes in Admin UI: key=status code, value=localized name
|
||||||
private static final Map<String, String> statusMessages = new HashMap<>();
|
private final Map<String, String> statusMessages = new HashMap<>();
|
||||||
|
|
||||||
// curation tasks to appear in admin UI: key=taskID, value=friendly name
|
// curation tasks to appear in admin UI: key=taskID, value=friendly name
|
||||||
private static Map<String, String> allTasks = new LinkedHashMap<>();
|
private Map<String, String> allTasks = new LinkedHashMap<>();
|
||||||
|
|
||||||
// named groups which display together in admin UI: key=groupID, value=friendly group name
|
// named groups which display together in admin UI: key=groupID, value=friendly group name
|
||||||
private static Map<String, String> taskGroups = new LinkedHashMap<>();
|
private Map<String, String> taskGroups = new LinkedHashMap<>();
|
||||||
|
|
||||||
// group membership: key=groupID, value=array of taskID
|
// group membership: key=groupID, value=array of taskID
|
||||||
private static Map<String, String[]> groupedTasks = new LinkedHashMap<>();
|
private Map<String, String[]> groupedTasks = new LinkedHashMap<>();
|
||||||
|
|
||||||
static
|
public CurateServlet()
|
||||||
{
|
{
|
||||||
|
TASK_QUEUE_NAME = configurationService.getProperty("curate.ui.queuename");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
setStatusMessages();
|
setStatusMessages();
|
||||||
@@ -93,6 +95,9 @@ public class CurateServlet extends DSpaceServlet
|
|||||||
private final transient HandleService handleService
|
private final transient HandleService handleService
|
||||||
= HandleServiceFactory.getInstance().getHandleService();
|
= HandleServiceFactory.getInstance().getHandleService();
|
||||||
|
|
||||||
|
private final transient ConfigurationService configurationService
|
||||||
|
= DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doDSGet(Context context, HttpServletRequest request,
|
protected void doDSGet(Context context, HttpServletRequest request,
|
||||||
HttpServletResponse response) throws ServletException, IOException,
|
HttpServletResponse response) throws ServletException, IOException,
|
||||||
@@ -318,10 +323,10 @@ public class CurateServlet extends DSpaceServlet
|
|||||||
return curator;
|
return curator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setStatusMessages() throws UnsupportedEncodingException
|
private void setStatusMessages() throws UnsupportedEncodingException
|
||||||
{
|
{
|
||||||
String statusCodes = ConfigurationManager.getProperty("curate", "ui.statusmessages");
|
String[] statusCodes = configurationService.getArrayProperty("curate.ui.statusmessages");
|
||||||
for (String property : statusCodes.split(","))
|
for (String property : statusCodes)
|
||||||
{
|
{
|
||||||
String[] keyValuePair = property.split("=");
|
String[] keyValuePair = property.split("=");
|
||||||
statusMessages.put(URLDecoder.decode(keyValuePair[0].trim(), "UTF-8"),
|
statusMessages.put(URLDecoder.decode(keyValuePair[0].trim(), "UTF-8"),
|
||||||
@@ -329,10 +334,10 @@ public class CurateServlet extends DSpaceServlet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setAllTasks() throws UnsupportedEncodingException
|
private void setAllTasks() throws UnsupportedEncodingException
|
||||||
{
|
{
|
||||||
String properties = ConfigurationManager.getProperty("curate", "ui.tasknames");
|
String[] properties = configurationService.getArrayProperty("curate.ui.tasknames");
|
||||||
for (String property : properties.split(","))
|
for (String property : properties)
|
||||||
{
|
{
|
||||||
String[] keyValuePair = property.split("=");
|
String[] keyValuePair = property.split("=");
|
||||||
allTasks.put(URLDecoder.decode(keyValuePair[0].trim(), "UTF-8"),
|
allTasks.put(URLDecoder.decode(keyValuePair[0].trim(), "UTF-8"),
|
||||||
@@ -340,12 +345,12 @@ public class CurateServlet extends DSpaceServlet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setTaskGroups() throws UnsupportedEncodingException
|
private void setTaskGroups() throws UnsupportedEncodingException
|
||||||
{
|
{
|
||||||
String groups = ConfigurationManager.getProperty("curate", "ui.taskgroups");
|
String[] groups = configurationService.getArrayProperty("curate.ui.taskgroups");
|
||||||
if (groups != null)
|
if (groups != null)
|
||||||
{
|
{
|
||||||
for (String property : groups.split(","))
|
for (String property : groups)
|
||||||
{
|
{
|
||||||
String[] keyValuePair = property.split("=");
|
String[] keyValuePair = property.split("=");
|
||||||
taskGroups.put(URLDecoder.decode(keyValuePair[0].trim(), "UTF-8"),
|
taskGroups.put(URLDecoder.decode(keyValuePair[0].trim(), "UTF-8"),
|
||||||
@@ -354,7 +359,7 @@ public class CurateServlet extends DSpaceServlet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setGroupedTasks() throws UnsupportedEncodingException
|
private void setGroupedTasks() throws UnsupportedEncodingException
|
||||||
{
|
{
|
||||||
if (!taskGroups.isEmpty())
|
if (!taskGroups.isEmpty())
|
||||||
{
|
{
|
||||||
@@ -362,8 +367,7 @@ public class CurateServlet extends DSpaceServlet
|
|||||||
while (iterator.hasNext())
|
while (iterator.hasNext())
|
||||||
{
|
{
|
||||||
String groupID = iterator.next();
|
String groupID = iterator.next();
|
||||||
String memberList = ConfigurationManager.getProperty("curate", "ui.taskgroup" + "." + groupID);
|
String[] members = configurationService.getArrayProperty("curate.ui.taskgroup" + "." + groupID);
|
||||||
String[] members = memberList.split(",");
|
|
||||||
groupedTasks.put(URLDecoder.decode(groupID, "UTF-8"), members);
|
groupedTasks.put(URLDecoder.decode(groupID, "UTF-8"), members);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -401,7 +405,7 @@ public class CurateServlet extends DSpaceServlet
|
|||||||
* @param group the short name / identifier for the group
|
* @param group the short name / identifier for the group
|
||||||
* @return the string of the html option elements
|
* @return the string of the html option elements
|
||||||
*/
|
*/
|
||||||
private static String getTaskSelectOptions(String group)
|
private String getTaskSelectOptions(String group)
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
if (groupedTasks.isEmpty())
|
if (groupedTasks.isEmpty())
|
||||||
|
@@ -8,13 +8,14 @@
|
|||||||
package org.dspace.app.webui.util;
|
package org.dspace.app.webui.util;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.Enumeration;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.dspace.content.Collection;
|
import org.dspace.content.Collection;
|
||||||
import org.dspace.content.Item;
|
import org.dspace.content.Item;
|
||||||
import org.dspace.core.ConfigurationManager;
|
import org.dspace.services.ConfigurationService;
|
||||||
|
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the standard (until 1.4.x) configuration mode based on owning collection handle
|
* This is the standard (until 1.4.x) configuration mode based on owning collection handle
|
||||||
@@ -27,14 +28,18 @@ import org.dspace.core.ConfigurationManager;
|
|||||||
public class CollectionStyleSelection extends AKeyBasedStyleSelection
|
public class CollectionStyleSelection extends AKeyBasedStyleSelection
|
||||||
{
|
{
|
||||||
/** Hashmap of collection Handles to styles to use, from dspace.cfg */
|
/** Hashmap of collection Handles to styles to use, from dspace.cfg */
|
||||||
private static java.util.Map<String, String> styles;
|
private java.util.Map<String, String> styles;
|
||||||
|
|
||||||
/** log4j logger */
|
/** log4j logger */
|
||||||
private static Logger log = Logger.getLogger(CollectionStyleSelection.class);
|
private static Logger log = Logger.getLogger(CollectionStyleSelection.class);
|
||||||
|
|
||||||
|
private final transient ConfigurationService configurationService
|
||||||
|
= DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the style using the owning collection handle
|
* Get the style using the owning collection handle
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String getStyleForItem(Item item) throws SQLException
|
public String getStyleForItem(Item item) throws SQLException
|
||||||
{
|
{
|
||||||
Collection c = item.getOwningCollection();
|
Collection c = item.getOwningCollection();
|
||||||
@@ -57,20 +62,17 @@ public class CollectionStyleSelection extends AKeyBasedStyleSelection
|
|||||||
{
|
{
|
||||||
styles = new HashMap<String, String>();
|
styles = new HashMap<String, String>();
|
||||||
|
|
||||||
Enumeration<String> e = (Enumeration<String>)ConfigurationManager.propertyNames();
|
// Get all properties starting with "webui.itemdisplay"
|
||||||
|
List<String> keys = configurationService.getPropertyKeys("webui.itemdisplay");
|
||||||
|
|
||||||
while (e.hasMoreElements())
|
for(String key: keys)
|
||||||
{
|
{
|
||||||
String key = e.nextElement();
|
if (key.endsWith(".collections"))
|
||||||
|
|
||||||
if (key.startsWith("webui.itemdisplay.")
|
|
||||||
&& key.endsWith(".collections"))
|
|
||||||
{
|
{
|
||||||
String styleName = key.substring("webui.itemdisplay.".length(),
|
String styleName = key.substring("webui.itemdisplay.".length(),
|
||||||
key.length() - ".collections".length());
|
key.length() - ".collections".length());
|
||||||
|
|
||||||
String[] collections = ConfigurationManager.getProperty(key)
|
String[] collections = configurationService.getArrayProperty(key);
|
||||||
.split(",");
|
|
||||||
|
|
||||||
for (int i = 0; i < collections.length; i++)
|
for (int i = 0; i < collections.length; i++)
|
||||||
{
|
{
|
||||||
|
@@ -28,6 +28,7 @@
|
|||||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
|
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
|
||||||
<%@ taglib uri="http://www.dspace.org/dspace-tags.tld" prefix="dspace" %>
|
<%@ taglib uri="http://www.dspace.org/dspace-tags.tld" prefix="dspace" %>
|
||||||
|
|
||||||
|
<%@ page import="org.apache.commons.lang.StringUtils" %>
|
||||||
<%@ page import="org.dspace.app.webui.components.RecentSubmissions" %>
|
<%@ page import="org.dspace.app.webui.components.RecentSubmissions" %>
|
||||||
|
|
||||||
<%@ page import="org.dspace.app.webui.servlet.admin.EditCommunitiesServlet" %>
|
<%@ page import="org.dspace.app.webui.servlet.admin.EditCommunitiesServlet" %>
|
||||||
@@ -36,9 +37,10 @@
|
|||||||
<%@ page import="org.dspace.browse.BrowseInfo" %>
|
<%@ page import="org.dspace.browse.BrowseInfo" %>
|
||||||
<%@ page import="org.dspace.browse.ItemCounter"%>
|
<%@ page import="org.dspace.browse.ItemCounter"%>
|
||||||
<%@ page import="org.dspace.content.*"%>
|
<%@ page import="org.dspace.content.*"%>
|
||||||
<%@ page import="org.dspace.core.ConfigurationManager"%>
|
|
||||||
<%@ page import="org.dspace.core.Utils" %>
|
<%@ page import="org.dspace.core.Utils" %>
|
||||||
<%@ page import="org.dspace.eperson.Group" %>
|
<%@ page import="org.dspace.eperson.Group" %>
|
||||||
|
<%@ page import="org.dspace.services.ConfigurationService" %>
|
||||||
|
<%@ page import="org.dspace.services.factory.DSpaceServicesFactory" %>
|
||||||
<%@ page import="javax.servlet.jsp.jstl.fmt.LocaleSupport" %>
|
<%@ page import="javax.servlet.jsp.jstl.fmt.LocaleSupport" %>
|
||||||
|
|
||||||
<%
|
<%
|
||||||
@@ -89,11 +91,16 @@
|
|||||||
|
|
||||||
Bitstream logo = collection.getLogo();
|
Bitstream logo = collection.getLogo();
|
||||||
|
|
||||||
boolean feedEnabled = ConfigurationManager.getBooleanProperty("webui.feed.enable");
|
ConfigurationService configurationService = DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||||
|
|
||||||
|
boolean feedEnabled = configurationService.getBooleanProperty("webui.feed.enable");
|
||||||
String feedData = "NONE";
|
String feedData = "NONE";
|
||||||
if (feedEnabled)
|
if (feedEnabled)
|
||||||
{
|
{
|
||||||
feedData = "coll:" + ConfigurationManager.getProperty("webui.feed.formats");
|
// FeedData is expected to be a comma separated list
|
||||||
|
String[] formats = configurationService.getArrayProperty("webui.feed.formats");
|
||||||
|
String allFormats = StringUtils.join(formats, ",");
|
||||||
|
feedData = "coll:" + allFormats;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemCounter ic = new ItemCounter(UIUtil.obtainContext(request));
|
ItemCounter ic = new ItemCounter(UIUtil.obtainContext(request));
|
||||||
@@ -110,7 +117,7 @@
|
|||||||
<div class="well">
|
<div class="well">
|
||||||
<div class="row"><div class="col-md-8"><h2><%= name %>
|
<div class="row"><div class="col-md-8"><h2><%= name %>
|
||||||
<%
|
<%
|
||||||
if(ConfigurationManager.getBooleanProperty("webui.strengths.show"))
|
if(configurationService.getBooleanProperty("webui.strengths.show"))
|
||||||
{
|
{
|
||||||
%>
|
%>
|
||||||
: [<%= ic.getCount(collection) %>]
|
: [<%= ic.getCount(collection) %>]
|
||||||
|
@@ -27,6 +27,7 @@
|
|||||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
|
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
|
||||||
<%@ taglib uri="http://www.dspace.org/dspace-tags.tld" prefix="dspace" %>
|
<%@ taglib uri="http://www.dspace.org/dspace-tags.tld" prefix="dspace" %>
|
||||||
|
|
||||||
|
<%@ page import="org.apache.commons.lang.StringUtils" %>
|
||||||
<%@ page import="org.dspace.app.webui.components.RecentSubmissions" %>
|
<%@ page import="org.dspace.app.webui.components.RecentSubmissions" %>
|
||||||
|
|
||||||
<%@ page import="org.dspace.app.webui.servlet.admin.EditCommunitiesServlet" %>
|
<%@ page import="org.dspace.app.webui.servlet.admin.EditCommunitiesServlet" %>
|
||||||
@@ -34,8 +35,9 @@
|
|||||||
<%@ page import="org.dspace.browse.BrowseIndex" %>
|
<%@ page import="org.dspace.browse.BrowseIndex" %>
|
||||||
<%@ page import="org.dspace.browse.ItemCounter" %>
|
<%@ page import="org.dspace.browse.ItemCounter" %>
|
||||||
<%@ page import="org.dspace.content.*" %>
|
<%@ page import="org.dspace.content.*" %>
|
||||||
<%@ page import="org.dspace.core.ConfigurationManager" %>
|
|
||||||
<%@ page import="org.dspace.core.Utils" %>
|
<%@ page import="org.dspace.core.Utils" %>
|
||||||
|
<%@ page import="org.dspace.services.ConfigurationService" %>
|
||||||
|
<%@ page import="org.dspace.services.factory.DSpaceServicesFactory" %>
|
||||||
<%@ page import="javax.servlet.jsp.jstl.fmt.LocaleSupport" %>
|
<%@ page import="javax.servlet.jsp.jstl.fmt.LocaleSupport" %>
|
||||||
|
|
||||||
<%
|
<%
|
||||||
@@ -66,11 +68,16 @@
|
|||||||
String sidebar = comServ.getMetadata(community, "side_bar_text");
|
String sidebar = comServ.getMetadata(community, "side_bar_text");
|
||||||
Bitstream logo = community.getLogo();
|
Bitstream logo = community.getLogo();
|
||||||
|
|
||||||
boolean feedEnabled = ConfigurationManager.getBooleanProperty("webui.feed.enable");
|
ConfigurationService configurationService = DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||||
|
|
||||||
|
boolean feedEnabled = configurationService.getBooleanProperty("webui.feed.enable");
|
||||||
String feedData = "NONE";
|
String feedData = "NONE";
|
||||||
if (feedEnabled)
|
if (feedEnabled)
|
||||||
{
|
{
|
||||||
feedData = "comm:" + ConfigurationManager.getProperty("webui.feed.formats");
|
// FeedData is expected to be a comma separated list
|
||||||
|
String[] formats = configurationService.getArrayProperty("webui.feed.formats");
|
||||||
|
String allFormats = StringUtils.join(formats, ",");
|
||||||
|
feedData = "comm:" + allFormats;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemCounter ic = new ItemCounter(UIUtil.obtainContext(request));
|
ItemCounter ic = new ItemCounter(UIUtil.obtainContext(request));
|
||||||
@@ -83,7 +90,7 @@
|
|||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<h2><%= name %>
|
<h2><%= name %>
|
||||||
<%
|
<%
|
||||||
if(ConfigurationManager.getBooleanProperty("webui.strengths.show"))
|
if(configurationService.getBooleanProperty("webui.strengths.show"))
|
||||||
{
|
{
|
||||||
%>
|
%>
|
||||||
: [<%= ic.getCount(community) %>]
|
: [<%= ic.getCount(community) %>]
|
||||||
@@ -239,7 +246,7 @@
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<%
|
<%
|
||||||
boolean showLogos = ConfigurationManager.getBooleanProperty("jspui.community-home.logos", true);
|
boolean showLogos = configurationService.getBooleanProperty("jspui.community-home.logos", true);
|
||||||
if (subcommunities.size() != 0)
|
if (subcommunities.size() != 0)
|
||||||
{
|
{
|
||||||
%>
|
%>
|
||||||
@@ -267,7 +274,7 @@
|
|||||||
<h4 class="list-group-item-heading"><a href="<%= request.getContextPath() %>/handle/<%= subcommunities.get(j).getHandle() %>">
|
<h4 class="list-group-item-heading"><a href="<%= request.getContextPath() %>/handle/<%= subcommunities.get(j).getHandle() %>">
|
||||||
<%= subcommunities.get(j).getName() %></a>
|
<%= subcommunities.get(j).getName() %></a>
|
||||||
<%
|
<%
|
||||||
if (ConfigurationManager.getBooleanProperty("webui.strengths.show"))
|
if (configurationService.getBooleanProperty("webui.strengths.show"))
|
||||||
{
|
{
|
||||||
%>
|
%>
|
||||||
[<%= ic.getCount(subcommunities.get(j)) %>]
|
[<%= ic.getCount(subcommunities.get(j)) %>]
|
||||||
@@ -323,7 +330,7 @@
|
|||||||
<h4 class="list-group-item-heading"><a href="<%= request.getContextPath() %>/handle/<%= collections.get(i).getHandle() %>">
|
<h4 class="list-group-item-heading"><a href="<%= request.getContextPath() %>/handle/<%= collections.get(i).getHandle() %>">
|
||||||
<%= collections.get(i).getName() %></a>
|
<%= collections.get(i).getName() %></a>
|
||||||
<%
|
<%
|
||||||
if(ConfigurationManager.getBooleanProperty("webui.strengths.show"))
|
if(configurationService.getBooleanProperty("webui.strengths.show"))
|
||||||
{
|
{
|
||||||
%>
|
%>
|
||||||
[<%= ic.getCount(collections.get(i)) %>]
|
[<%= ic.getCount(collections.get(i)) %>]
|
||||||
|
@@ -32,13 +32,15 @@
|
|||||||
<%@ page import="java.util.Locale"%>
|
<%@ page import="java.util.Locale"%>
|
||||||
<%@ page import="javax.servlet.jsp.jstl.core.*" %>
|
<%@ page import="javax.servlet.jsp.jstl.core.*" %>
|
||||||
<%@ page import="javax.servlet.jsp.jstl.fmt.LocaleSupport" %>
|
<%@ page import="javax.servlet.jsp.jstl.fmt.LocaleSupport" %>
|
||||||
|
<%@ page import="org.apache.commons.lang.StringUtils" %>
|
||||||
<%@ page import="org.dspace.core.I18nUtil" %>
|
<%@ page import="org.dspace.core.I18nUtil" %>
|
||||||
<%@ page import="org.dspace.app.webui.util.UIUtil" %>
|
<%@ page import="org.dspace.app.webui.util.UIUtil" %>
|
||||||
<%@ page import="org.dspace.app.webui.components.RecentSubmissions" %>
|
<%@ page import="org.dspace.app.webui.components.RecentSubmissions" %>
|
||||||
<%@ page import="org.dspace.content.Community" %>
|
<%@ page import="org.dspace.content.Community" %>
|
||||||
<%@ page import="org.dspace.core.ConfigurationManager" %>
|
|
||||||
<%@ page import="org.dspace.browse.ItemCounter" %>
|
<%@ page import="org.dspace.browse.ItemCounter" %>
|
||||||
<%@ page import="org.dspace.content.Item" %>
|
<%@ page import="org.dspace.content.Item" %>
|
||||||
|
<%@ page import="org.dspace.services.ConfigurationService" %>
|
||||||
|
<%@ page import="org.dspace.services.factory.DSpaceServicesFactory" %>
|
||||||
|
|
||||||
<%
|
<%
|
||||||
List<Community> communities = (List<Community>) request.getAttribute("communities");
|
List<Community> communities = (List<Community>) request.getAttribute("communities");
|
||||||
@@ -49,11 +51,16 @@
|
|||||||
String topNews = newsService.readNewsFile(LocaleSupport.getLocalizedMessage(pageContext, "news-top.html"));
|
String topNews = newsService.readNewsFile(LocaleSupport.getLocalizedMessage(pageContext, "news-top.html"));
|
||||||
String sideNews = newsService.readNewsFile(LocaleSupport.getLocalizedMessage(pageContext, "news-side.html"));
|
String sideNews = newsService.readNewsFile(LocaleSupport.getLocalizedMessage(pageContext, "news-side.html"));
|
||||||
|
|
||||||
boolean feedEnabled = ConfigurationManager.getBooleanProperty("webui.feed.enable");
|
ConfigurationService configurationService = DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||||
|
|
||||||
|
boolean feedEnabled = configurationService.getBooleanProperty("webui.feed.enable");
|
||||||
String feedData = "NONE";
|
String feedData = "NONE";
|
||||||
if (feedEnabled)
|
if (feedEnabled)
|
||||||
{
|
{
|
||||||
feedData = "ALL:" + ConfigurationManager.getProperty("webui.feed.formats");
|
// FeedData is expected to be a comma separated list
|
||||||
|
String[] formats = configurationService.getArrayProperty("webui.feed.formats");
|
||||||
|
String allFormats = StringUtils.join(formats, ",");
|
||||||
|
feedData = "ALL:" + allFormats;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemCounter ic = new ItemCounter(UIUtil.obtainContext(request));
|
ItemCounter ic = new ItemCounter(UIUtil.obtainContext(request));
|
||||||
@@ -170,7 +177,7 @@ if (communities != null && communities.size() != 0)
|
|||||||
<p><fmt:message key="jsp.home.com2"/></p>
|
<p><fmt:message key="jsp.home.com2"/></p>
|
||||||
<div class="list-group">
|
<div class="list-group">
|
||||||
<%
|
<%
|
||||||
boolean showLogos = ConfigurationManager.getBooleanProperty("jspui.home-page.logos", true);
|
boolean showLogos = configurationService.getBooleanProperty("jspui.home-page.logos", true);
|
||||||
for (Community com : communities)
|
for (Community com : communities)
|
||||||
{
|
{
|
||||||
%><div class="list-group-item row">
|
%><div class="list-group-item row">
|
||||||
@@ -186,7 +193,7 @@ if (communities != null && communities.size() != 0)
|
|||||||
<% } %>
|
<% } %>
|
||||||
<h4 class="list-group-item-heading"><a href="<%= request.getContextPath() %>/handle/<%= com.getHandle() %>"><%= com.getName() %></a>
|
<h4 class="list-group-item-heading"><a href="<%= request.getContextPath() %>/handle/<%= com.getHandle() %>"><%= com.getName() %></a>
|
||||||
<%
|
<%
|
||||||
if (ConfigurationManager.getBooleanProperty("webui.strengths.show"))
|
if (configurationService.getBooleanProperty("webui.strengths.show"))
|
||||||
{
|
{
|
||||||
%>
|
%>
|
||||||
<span class="badge pull-right"><%= ic.getCount(com) %></span>
|
<span class="badge pull-right"><%= ic.getCount(com) %></span>
|
||||||
|
@@ -9,20 +9,19 @@ package org.dspace.sword;
|
|||||||
|
|
||||||
import org.dspace.content.factory.ContentServiceFactory;
|
import org.dspace.content.factory.ContentServiceFactory;
|
||||||
import org.dspace.content.service.BitstreamFormatService;
|
import org.dspace.content.service.BitstreamFormatService;
|
||||||
import org.dspace.core.ConfigurationManager;
|
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
import org.dspace.content.Collection;
|
import org.dspace.content.Collection;
|
||||||
import org.dspace.content.DSpaceObject;
|
import org.dspace.content.DSpaceObject;
|
||||||
import org.dspace.content.Item;
|
import org.dspace.content.Item;
|
||||||
import org.dspace.content.BitstreamFormat;
|
import org.dspace.content.BitstreamFormat;
|
||||||
|
import org.dspace.services.ConfigurationService;
|
||||||
|
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||||
import org.purl.sword.base.SWORDErrorException;
|
import org.purl.sword.base.SWORDErrorException;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
@@ -51,6 +50,9 @@ public class SWORDConfiguration
|
|||||||
protected BitstreamFormatService bitstreamFormatService = ContentServiceFactory
|
protected BitstreamFormatService bitstreamFormatService = ContentServiceFactory
|
||||||
.getInstance().getBitstreamFormatService();
|
.getInstance().getBitstreamFormatService();
|
||||||
|
|
||||||
|
protected ConfigurationService configurationService = DSpaceServicesFactory
|
||||||
|
.getInstance().getConfigurationService();
|
||||||
|
|
||||||
/** whether we can support noOp */
|
/** whether we can support noOp */
|
||||||
private boolean noOp = true;
|
private boolean noOp = true;
|
||||||
|
|
||||||
@@ -85,47 +87,47 @@ public class SWORDConfiguration
|
|||||||
public SWORDConfiguration()
|
public SWORDConfiguration()
|
||||||
{
|
{
|
||||||
// set the max upload size
|
// set the max upload size
|
||||||
int mus = ConfigurationManager
|
int mus = configurationService
|
||||||
.getIntProperty("sword-server", "max-upload-size");
|
.getIntProperty("sword-server.max-upload-size");
|
||||||
if (mus > 0)
|
if (mus > 0)
|
||||||
{
|
{
|
||||||
this.maxUploadSize = mus;
|
this.maxUploadSize = mus;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the mediation value
|
// set the mediation value
|
||||||
this.mediated = ConfigurationManager
|
this.mediated = configurationService
|
||||||
.getBooleanProperty("sword-server", "on-behalf-of.enable");
|
.getBooleanProperty("sword-server.on-behalf-of.enable");
|
||||||
|
|
||||||
// find out if we keep the original as bitstream
|
// find out if we keep the original as bitstream
|
||||||
this.keepOriginal = ConfigurationManager
|
this.keepOriginal = configurationService
|
||||||
.getBooleanProperty("sword-server", "keep-original-package");
|
.getBooleanProperty("sword-server.keep-original-package");
|
||||||
|
|
||||||
// get the sword bundle
|
// get the sword bundle
|
||||||
String bundle = ConfigurationManager
|
String bundle = configurationService
|
||||||
.getProperty("sword-server", "bundle.name");
|
.getProperty("sword-server.bundle.name");
|
||||||
if (bundle != null && "".equals(bundle))
|
if (bundle != null && "".equals(bundle))
|
||||||
{
|
{
|
||||||
this.swordBundle = bundle;
|
this.swordBundle = bundle;
|
||||||
}
|
}
|
||||||
|
|
||||||
// find out if we keep the package as a file in specified directory
|
// find out if we keep the package as a file in specified directory
|
||||||
this.keepPackageOnFailedIngest = ConfigurationManager
|
this.keepPackageOnFailedIngest = configurationService
|
||||||
.getBooleanProperty("sword-server", "keep-package-on-fail",
|
.getBooleanProperty("sword-server.keep-package-on-fail",
|
||||||
false);
|
false);
|
||||||
|
|
||||||
// get directory path and name
|
// get directory path and name
|
||||||
this.failedPackageDir = ConfigurationManager
|
this.failedPackageDir = configurationService
|
||||||
.getProperty("sword-server", "failed-package.dir");
|
.getProperty("sword-server.failed-package.dir");
|
||||||
|
|
||||||
// Get the accepted formats
|
// Get the accepted formats
|
||||||
String acceptsProperty = ConfigurationManager
|
String[] acceptsFormats = configurationService
|
||||||
.getProperty("sword-server", "accepts");
|
.getArrayProperty("sword-server.accepts");
|
||||||
swordaccepts = new ArrayList<String>();
|
swordaccepts = new ArrayList<String>();
|
||||||
if (acceptsProperty == null)
|
if (acceptsFormats == null)
|
||||||
{
|
{
|
||||||
acceptsProperty = "application/zip";
|
acceptsFormats = new String[]{"application/zip"};
|
||||||
}
|
}
|
||||||
for (String element : acceptsProperty.split(","))
|
for (String element : acceptsFormats)
|
||||||
{
|
{
|
||||||
swordaccepts.add(element.trim());
|
swordaccepts.add(element.trim());
|
||||||
}
|
}
|
||||||
@@ -349,31 +351,18 @@ public class SWORDConfiguration
|
|||||||
String handle = col.getHandle();
|
String handle = col.getHandle();
|
||||||
|
|
||||||
// build the holding maps of identifiers and q values
|
// build the holding maps of identifiers and q values
|
||||||
Properties props = ConfigurationManager.getProperties("sword-server");
|
String acceptPackagingPrefix = "sword-server.accept-packaging";
|
||||||
Set keyset = props.keySet();
|
List<String> keys = configurationService.getPropertyKeys(acceptPackagingPrefix);
|
||||||
for (Object keyObj : keyset)
|
for (String key : keys)
|
||||||
{
|
{
|
||||||
String sw = "accept-packaging.";
|
|
||||||
|
|
||||||
if (!(keyObj instanceof String))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
String key = (String) keyObj;
|
|
||||||
|
|
||||||
if (!key.startsWith(sw))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// extract the configuration into the holding Maps
|
// extract the configuration into the holding Maps
|
||||||
String suffix = key.substring(sw.length());
|
String suffix = key.substring(acceptPackagingPrefix.length()+1);
|
||||||
|
|
||||||
String[] bits = suffix.split("\\.");
|
String[] bits = suffix.split("\\.");
|
||||||
if (bits.length == 2)
|
if (bits.length == 2)
|
||||||
{
|
{
|
||||||
// global settings
|
// global settings
|
||||||
String value = props.getProperty(key);
|
String value = configurationService.getProperty(key);
|
||||||
if (bits[1].equals("identifier"))
|
if (bits[1].equals("identifier"))
|
||||||
{
|
{
|
||||||
identifiers.put(bits[0], value);
|
identifiers.put(bits[0], value);
|
||||||
@@ -388,7 +377,7 @@ public class SWORDConfiguration
|
|||||||
if (bits.length == 3 && bits[0].equals(handle))
|
if (bits.length == 3 && bits[0].equals(handle))
|
||||||
{
|
{
|
||||||
// this is configuration for our collection
|
// this is configuration for our collection
|
||||||
String value = props.getProperty(key);
|
String value = configurationService.getProperty(key);
|
||||||
if (bits[2].equals("identifier"))
|
if (bits[2].equals("identifier"))
|
||||||
{
|
{
|
||||||
identifiers.put(bits[1], value);
|
identifiers.put(bits[1], value);
|
||||||
@@ -473,9 +462,9 @@ public class SWORDConfiguration
|
|||||||
public String getTempDir()
|
public String getTempDir()
|
||||||
throws DSpaceSWORDException
|
throws DSpaceSWORDException
|
||||||
{
|
{
|
||||||
return (ConfigurationManager.getProperty("upload.temp.dir") != null)
|
return (configurationService.getProperty("upload.temp.dir") != null)
|
||||||
?
|
?
|
||||||
ConfigurationManager.getProperty("upload.temp.dir") :
|
configurationService.getProperty("upload.temp.dir") :
|
||||||
System.getProperty("java.io.tmpdir");
|
System.getProperty("java.io.tmpdir");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -10,7 +10,6 @@ package org.dspace.sword2;
|
|||||||
import org.dspace.content.Bitstream;
|
import org.dspace.content.Bitstream;
|
||||||
import org.dspace.content.Bundle;
|
import org.dspace.content.Bundle;
|
||||||
import org.dspace.content.Item;
|
import org.dspace.content.Item;
|
||||||
import org.dspace.core.ConfigurationManager;
|
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
import org.swordapp.server.OriginalDeposit;
|
import org.swordapp.server.OriginalDeposit;
|
||||||
import org.swordapp.server.ResourcePart;
|
import org.swordapp.server.ResourcePart;
|
||||||
@@ -22,6 +21,8 @@ import java.util.Date;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
|
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||||
|
|
||||||
public abstract class GenericStatementDisseminator
|
public abstract class GenericStatementDisseminator
|
||||||
implements SwordStatementDisseminator
|
implements SwordStatementDisseminator
|
||||||
@@ -177,15 +178,14 @@ public abstract class GenericStatementDisseminator
|
|||||||
|
|
||||||
private List<String> getIncludeBundles()
|
private List<String> getIncludeBundles()
|
||||||
{
|
{
|
||||||
String cfg = ConfigurationManager
|
String[] bundles = DSpaceServicesFactory.getInstance().getConfigurationService()
|
||||||
.getProperty("swordv2-server", "statement.bundles");
|
.getArrayProperty("swordv2-server.statement.bundles");
|
||||||
if (cfg == null || "".equals(cfg))
|
if (ArrayUtils.isEmpty(bundles))
|
||||||
{
|
{
|
||||||
cfg = "ORIGINAL, SWORD";
|
bundles = new String[] {"ORIGINAL", "SWORD"};
|
||||||
}
|
}
|
||||||
String[] bits = cfg.split(",");
|
|
||||||
List<String> include = new ArrayList<String>();
|
List<String> include = new ArrayList<String>();
|
||||||
for (String bit : bits)
|
for (String bit : bundles)
|
||||||
{
|
{
|
||||||
String bundleName = bit.trim().toUpperCase();
|
String bundleName = bit.trim().toUpperCase();
|
||||||
if (!include.contains(bundleName))
|
if (!include.contains(bundleName))
|
||||||
@@ -198,8 +198,8 @@ public abstract class GenericStatementDisseminator
|
|||||||
|
|
||||||
private String getOriginalDepositsBundle()
|
private String getOriginalDepositsBundle()
|
||||||
{
|
{
|
||||||
String swordBundle = ConfigurationManager
|
String swordBundle = DSpaceServicesFactory.getInstance().getConfigurationService()
|
||||||
.getProperty("swordv2-server", "bundle.name");
|
.getProperty("swordv2-server.bundle.name");
|
||||||
if (swordBundle == null)
|
if (swordBundle == null)
|
||||||
{
|
{
|
||||||
swordBundle = "SWORD";
|
swordBundle = "SWORD";
|
||||||
|
@@ -12,15 +12,17 @@ import org.dspace.authorize.AuthorizeException;
|
|||||||
import org.dspace.content.*;
|
import org.dspace.content.*;
|
||||||
import org.dspace.content.factory.ContentServiceFactory;
|
import org.dspace.content.factory.ContentServiceFactory;
|
||||||
import org.dspace.content.service.WorkspaceItemService;
|
import org.dspace.content.service.WorkspaceItemService;
|
||||||
import org.dspace.core.ConfigurationManager;
|
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
|
import org.dspace.services.ConfigurationService;
|
||||||
|
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||||
import org.swordapp.server.*;
|
import org.swordapp.server.*;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
|
|
||||||
public class SimpleDCEntryIngester extends AbstractSimpleDC
|
public class SimpleDCEntryIngester extends AbstractSimpleDC
|
||||||
implements SwordEntryIngester
|
implements SwordEntryIngester
|
||||||
@@ -31,6 +33,9 @@ public class SimpleDCEntryIngester extends AbstractSimpleDC
|
|||||||
protected WorkspaceItemService workspaceItemService = ContentServiceFactory
|
protected WorkspaceItemService workspaceItemService = ContentServiceFactory
|
||||||
.getInstance().getWorkspaceItemService();
|
.getInstance().getWorkspaceItemService();
|
||||||
|
|
||||||
|
protected ConfigurationService configurationService = DSpaceServicesFactory
|
||||||
|
.getInstance().getConfigurationService();
|
||||||
|
|
||||||
public SimpleDCEntryIngester()
|
public SimpleDCEntryIngester()
|
||||||
{
|
{
|
||||||
this.loadMetadataMaps();
|
this.loadMetadataMaps();
|
||||||
@@ -115,10 +120,9 @@ public class SimpleDCEntryIngester extends AbstractSimpleDC
|
|||||||
private void removeMetadata(Context context, Item item)
|
private void removeMetadata(Context context, Item item)
|
||||||
throws DSpaceSwordException
|
throws DSpaceSwordException
|
||||||
{
|
{
|
||||||
String raw = ConfigurationManager
|
String[] replaceableMetadata = configurationService
|
||||||
.getProperty("swordv2-server", "metadata.replaceable");
|
.getArrayProperty("swordv2-server.metadata.replaceable");
|
||||||
String[] parts = raw.split(",");
|
for (String part : replaceableMetadata)
|
||||||
for (String part : parts)
|
|
||||||
{
|
{
|
||||||
MetadataValueInfo info = this
|
MetadataValueInfo info = this
|
||||||
.makeMetadataValueInfo(part.trim(), null);
|
.makeMetadataValueInfo(part.trim(), null);
|
||||||
@@ -340,12 +344,12 @@ public class SimpleDCEntryIngester extends AbstractSimpleDC
|
|||||||
VerboseDescription verboseDescription)
|
VerboseDescription verboseDescription)
|
||||||
throws DSpaceSwordException
|
throws DSpaceSwordException
|
||||||
{
|
{
|
||||||
String field = ConfigurationManager
|
String field = configurationService
|
||||||
.getProperty("swordv2-server", "updated.field");
|
.getProperty("swordv2-server.updated.field");
|
||||||
if (field == null || "".equals(field))
|
if (StringUtils.isBlank(field))
|
||||||
{
|
{
|
||||||
throw new DSpaceSwordException(
|
throw new DSpaceSwordException(
|
||||||
"No configuration, or configuration is invalid for: sword.updated.field");
|
"No configuration, or configuration is invalid for: swordv2-server.updated.field");
|
||||||
}
|
}
|
||||||
|
|
||||||
MetadataValueInfo info = this.makeMetadataValueInfo(field, null);
|
MetadataValueInfo info = this.makeMetadataValueInfo(field, null);
|
||||||
@@ -389,12 +393,12 @@ public class SimpleDCEntryIngester extends AbstractSimpleDC
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String field = ConfigurationManager
|
String field = configurationService
|
||||||
.getProperty("swordv2-server", "slug.field");
|
.getProperty("swordv2-server.slug.field");
|
||||||
if (field == null || "".equals(field))
|
if (StringUtils.isBlank(field))
|
||||||
{
|
{
|
||||||
throw new DSpaceSwordException(
|
throw new DSpaceSwordException(
|
||||||
"No configuration, or configuration is invalid for: sword.slug.field");
|
"No configuration, or configuration is invalid for: swordv2-server.slug.field");
|
||||||
}
|
}
|
||||||
|
|
||||||
MetadataValueInfo info = this.makeMetadataValueInfo(field, null);
|
MetadataValueInfo info = this.makeMetadataValueInfo(field, null);
|
||||||
|
@@ -7,10 +7,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.dspace.sword2;
|
package org.dspace.sword2;
|
||||||
|
|
||||||
import org.dspace.authenticate.AuthenticationServiceImpl;
|
|
||||||
import org.dspace.authenticate.factory.AuthenticateServiceFactory;
|
import org.dspace.authenticate.factory.AuthenticateServiceFactory;
|
||||||
import org.dspace.authenticate.service.AuthenticationService;
|
import org.dspace.authenticate.service.AuthenticationService;
|
||||||
import org.dspace.authorize.AuthorizeServiceImpl;
|
|
||||||
import org.dspace.authorize.factory.AuthorizeServiceFactory;
|
import org.dspace.authorize.factory.AuthorizeServiceFactory;
|
||||||
import org.dspace.authorize.service.AuthorizeService;
|
import org.dspace.authorize.service.AuthorizeService;
|
||||||
import org.dspace.content.factory.ContentServiceFactory;
|
import org.dspace.content.factory.ContentServiceFactory;
|
||||||
@@ -18,17 +16,17 @@ import org.dspace.content.service.CollectionService;
|
|||||||
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.Context;
|
import org.dspace.core.Context;
|
||||||
import org.dspace.core.ConfigurationManager;
|
|
||||||
import org.dspace.core.LogManager;
|
import org.dspace.core.LogManager;
|
||||||
import org.dspace.core.Constants;
|
import org.dspace.core.Constants;
|
||||||
import org.dspace.authenticate.AuthenticationMethod;
|
import org.dspace.authenticate.AuthenticationMethod;
|
||||||
import org.dspace.eperson.EPerson;
|
import org.dspace.eperson.EPerson;
|
||||||
import org.dspace.eperson.Group;
|
import org.dspace.eperson.Group;
|
||||||
import org.dspace.authorize.AuthorizeException;
|
|
||||||
import org.dspace.content.*;
|
import org.dspace.content.*;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.dspace.eperson.factory.EPersonServiceFactory;
|
import org.dspace.eperson.factory.EPersonServiceFactory;
|
||||||
import org.dspace.eperson.service.EPersonService;
|
import org.dspace.eperson.service.EPersonService;
|
||||||
|
import org.dspace.services.ConfigurationService;
|
||||||
|
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||||
import org.swordapp.server.AuthCredentials;
|
import org.swordapp.server.AuthCredentials;
|
||||||
import org.swordapp.server.SwordAuthException;
|
import org.swordapp.server.SwordAuthException;
|
||||||
import org.swordapp.server.SwordError;
|
import org.swordapp.server.SwordError;
|
||||||
@@ -38,6 +36,7 @@ import java.sql.SQLException;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class offers a thin wrapper for the default DSpace
|
* This class offers a thin wrapper for the default DSpace
|
||||||
@@ -69,6 +68,9 @@ public class SwordAuthenticator
|
|||||||
protected ItemService itemService = ContentServiceFactory.getInstance()
|
protected ItemService itemService = ContentServiceFactory.getInstance()
|
||||||
.getItemService();
|
.getItemService();
|
||||||
|
|
||||||
|
protected ConfigurationService configurationService = DSpaceServicesFactory
|
||||||
|
.getInstance().getConfigurationService();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does the given username and password authenticate for the
|
* Does the given username and password authenticate for the
|
||||||
* given DSpace Context?
|
* given DSpace Context?
|
||||||
@@ -155,14 +157,14 @@ public class SwordAuthenticator
|
|||||||
|
|
||||||
// smooth out the OnBehalfOf request, so that empty strings are
|
// smooth out the OnBehalfOf request, so that empty strings are
|
||||||
// treated as null
|
// treated as null
|
||||||
if ("".equals(obo))
|
if (StringUtils.isBlank(obo))
|
||||||
{
|
{
|
||||||
obo = null;
|
obo = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// first find out if we support on-behalf-of deposit
|
// first find out if we support on-behalf-of deposit
|
||||||
boolean mediated = ConfigurationManager
|
boolean mediated = configurationService
|
||||||
.getBooleanProperty("swordv2-server", "on-behalf-of.enable");
|
.getBooleanProperty("swordv2-server.on-behalf-of.enable", false);
|
||||||
if (!mediated && obo != null)
|
if (!mediated && obo != null)
|
||||||
{
|
{
|
||||||
// user is trying to do a mediated deposit on a repository which does not support it
|
// user is trying to do a mediated deposit on a repository which does not support it
|
||||||
@@ -1002,9 +1004,9 @@ public class SwordAuthenticator
|
|||||||
private boolean allowedToMediate(Context context)
|
private boolean allowedToMediate(Context context)
|
||||||
{
|
{
|
||||||
// get the configuration
|
// get the configuration
|
||||||
String mediatorCfg = ConfigurationManager
|
String[] mediators = configurationService
|
||||||
.getProperty("swordv2-server", "on-behalf-of.update.mediators");
|
.getArrayProperty("swordv2-server.on-behalf-of.update.mediators");
|
||||||
if (mediatorCfg == null)
|
if (mediators == null || mediators.length==0)
|
||||||
{
|
{
|
||||||
// if there's no explicit list of mediators, then anyone can mediate
|
// if there's no explicit list of mediators, then anyone can mediate
|
||||||
return true;
|
return true;
|
||||||
@@ -1019,7 +1021,6 @@ public class SwordAuthenticator
|
|||||||
String email = eperson.getEmail();
|
String email = eperson.getEmail();
|
||||||
String netid = eperson.getNetid();
|
String netid = eperson.getNetid();
|
||||||
|
|
||||||
String[] mediators = mediatorCfg.split(",");
|
|
||||||
for (String mediator : mediators)
|
for (String mediator : mediators)
|
||||||
{
|
{
|
||||||
String m = mediator.trim();
|
String m = mediator.trim();
|
||||||
|
@@ -14,18 +14,17 @@ import org.dspace.content.DSpaceObject;
|
|||||||
import org.dspace.content.Item;
|
import org.dspace.content.Item;
|
||||||
import org.dspace.content.factory.ContentServiceFactory;
|
import org.dspace.content.factory.ContentServiceFactory;
|
||||||
import org.dspace.content.service.BitstreamFormatService;
|
import org.dspace.content.service.BitstreamFormatService;
|
||||||
import org.dspace.core.ConfigurationManager;
|
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
import org.dspace.core.LegacyPluginServiceImpl;
|
|
||||||
import org.jaxen.function.FalseFunction;
|
|
||||||
import org.swordapp.server.SwordConfiguration;
|
import org.swordapp.server.SwordConfiguration;
|
||||||
import org.swordapp.server.SwordError;
|
import org.swordapp.server.SwordError;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import java.util.Set;
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
|
import org.dspace.services.ConfigurationService;
|
||||||
|
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||||
|
|
||||||
public class SwordConfigurationDSpace implements SwordConfiguration
|
public class SwordConfigurationDSpace implements SwordConfiguration
|
||||||
{
|
{
|
||||||
@@ -36,6 +35,9 @@ public class SwordConfigurationDSpace implements SwordConfiguration
|
|||||||
protected BitstreamFormatService bitstreamFormatService = ContentServiceFactory
|
protected BitstreamFormatService bitstreamFormatService = ContentServiceFactory
|
||||||
.getInstance().getBitstreamFormatService();
|
.getInstance().getBitstreamFormatService();
|
||||||
|
|
||||||
|
protected ConfigurationService configurationService = DSpaceServicesFactory
|
||||||
|
.getInstance().getConfigurationService();
|
||||||
|
|
||||||
/** whether we can be verbose */
|
/** whether we can be verbose */
|
||||||
private boolean verbose = true;
|
private boolean verbose = true;
|
||||||
|
|
||||||
@@ -71,59 +73,58 @@ public class SwordConfigurationDSpace implements SwordConfiguration
|
|||||||
public SwordConfigurationDSpace()
|
public SwordConfigurationDSpace()
|
||||||
{
|
{
|
||||||
// set the max upload size
|
// set the max upload size
|
||||||
int mus = ConfigurationManager
|
int mus = configurationService
|
||||||
.getIntProperty("swordv2-server", "max-upload-size");
|
.getIntProperty("swordv2-server.max-upload-size");
|
||||||
if (mus > 0)
|
if (mus > 0)
|
||||||
{
|
{
|
||||||
this.maxUploadSize = mus;
|
this.maxUploadSize = mus;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the mediation value
|
// set the mediation value
|
||||||
this.mediated = ConfigurationManager
|
this.mediated = configurationService
|
||||||
.getBooleanProperty("swordv2-server", "on-behalf-of.enable");
|
.getBooleanProperty("swordv2-server.on-behalf-of.enable", false);
|
||||||
|
|
||||||
// find out if we keep the original as bitstream
|
// find out if we keep the original as bitstream
|
||||||
this.keepOriginal = ConfigurationManager
|
this.keepOriginal = configurationService
|
||||||
.getBooleanProperty("swordv2-server", "keep-original-package");
|
.getBooleanProperty("swordv2-server.keep-original-package");
|
||||||
|
|
||||||
// get the sword bundle
|
// get the sword bundle
|
||||||
String bundle = ConfigurationManager
|
String bundle = configurationService
|
||||||
.getProperty("swordv2-server", "bundle.name");
|
.getProperty("swordv2-server.bundle.name");
|
||||||
if (bundle != null && "".equals(bundle))
|
if (StringUtils.isBlank(bundle))
|
||||||
{
|
{
|
||||||
this.swordBundle = bundle;
|
this.swordBundle = bundle;
|
||||||
}
|
}
|
||||||
|
|
||||||
// find out if we keep the package as a file in specified directory
|
// find out if we keep the package as a file in specified directory
|
||||||
this.keepPackageOnFailedIngest = ConfigurationManager
|
this.keepPackageOnFailedIngest = configurationService
|
||||||
.getBooleanProperty("swordv2-server", "keep-package-on-fail",
|
.getBooleanProperty("swordv2-server.keep-package-on-fail",
|
||||||
false);
|
false);
|
||||||
|
|
||||||
// get directory path and name
|
// get directory path and name
|
||||||
this.failedPackageDir = ConfigurationManager
|
this.failedPackageDir = configurationService
|
||||||
.getProperty("swordv2-server", "failed-package.dir");
|
.getProperty("swordv2-server.failed-package.dir");
|
||||||
|
|
||||||
// Get the accepted formats
|
// Get the accepted formats
|
||||||
String acceptsProperty = ConfigurationManager
|
String[] acceptsFormats = configurationService
|
||||||
.getProperty("swordv2-server", "accepts");
|
.getArrayProperty("swordv2-server.accepts");
|
||||||
swordaccepts = new ArrayList<String>();
|
swordaccepts = new ArrayList<String>();
|
||||||
if (acceptsProperty == null)
|
if (ArrayUtils.isEmpty(acceptsFormats))
|
||||||
{
|
{
|
||||||
acceptsProperty = "application/zip";
|
acceptsFormats = new String[]{"application/zip"};
|
||||||
}
|
}
|
||||||
for (String element : acceptsProperty.split(","))
|
for (String element : acceptsFormats)
|
||||||
{
|
{
|
||||||
swordaccepts.add(element.trim());
|
swordaccepts.add(element.trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
// find out if community deposit is allowed
|
// find out if community deposit is allowed
|
||||||
this.allowCommunityDeposit = ConfigurationManager
|
this.allowCommunityDeposit = configurationService
|
||||||
.getBooleanProperty("swordv2-server",
|
.getBooleanProperty("swordv2-server.allow-community-deposit");
|
||||||
"allow-community-deposit");
|
|
||||||
|
|
||||||
// find out if we keep the package as a file in specified directory
|
// find out if we keep the package as a file in specified directory
|
||||||
this.entryFirst = ConfigurationManager
|
this.entryFirst = configurationService
|
||||||
.getBooleanProperty("swordv2-server", "multipart.entry-first",
|
.getBooleanProperty("swordv2-server.multipart.entry-first",
|
||||||
false);
|
false);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -132,19 +133,11 @@ public class SwordConfigurationDSpace implements SwordConfiguration
|
|||||||
// Utilities
|
// Utilities
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
public String getStringProperty(String module, String propName,
|
public String getStringProperty(String propName,
|
||||||
String defaultValue, String[] allowedValues)
|
String defaultValue, String[] allowedValues)
|
||||||
{
|
{
|
||||||
String cfg;
|
String cfg = configurationService.getProperty(propName);
|
||||||
if (module == null)
|
if (StringUtils.isBlank(cfg))
|
||||||
{
|
|
||||||
cfg = ConfigurationManager.getProperty(propName);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cfg = ConfigurationManager.getProperty(module, propName);
|
|
||||||
}
|
|
||||||
if (cfg == null || "".equals(cfg))
|
|
||||||
{
|
{
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
@@ -170,10 +163,10 @@ public class SwordConfigurationDSpace implements SwordConfiguration
|
|||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStringProperty(String module, String propName,
|
public String getStringProperty(String propName,
|
||||||
String defaultValue)
|
String defaultValue)
|
||||||
{
|
{
|
||||||
return this.getStringProperty(module, propName, defaultValue, null);
|
return this.getStringProperty(propName, defaultValue, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -187,8 +180,7 @@ public class SwordConfigurationDSpace implements SwordConfiguration
|
|||||||
|
|
||||||
public boolean returnStackTraceInError()
|
public boolean returnStackTraceInError()
|
||||||
{
|
{
|
||||||
return ConfigurationManager.getBooleanProperty("swordv2-server",
|
return configurationService.getBooleanProperty("swordv2-server.verbose-description.error.enable");
|
||||||
"verbose-description.error.enable");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean returnErrorBody()
|
public boolean returnErrorBody()
|
||||||
@@ -198,24 +190,24 @@ public class SwordConfigurationDSpace implements SwordConfiguration
|
|||||||
|
|
||||||
public String generator()
|
public String generator()
|
||||||
{
|
{
|
||||||
return this.getStringProperty("swordv2-server", "generator.url",
|
return this.getStringProperty("swordv2-server.generator.url",
|
||||||
DSpaceUriRegistry.DSPACE_SWORD_NS);
|
DSpaceUriRegistry.DSPACE_SWORD_NS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String generatorVersion()
|
public String generatorVersion()
|
||||||
{
|
{
|
||||||
return this.getStringProperty("swordv2-server", "generator.version",
|
return this.getStringProperty("swordv2-server.generator.version",
|
||||||
"2.0");
|
"2.0");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String administratorEmail()
|
public String administratorEmail()
|
||||||
{
|
{
|
||||||
return this.getStringProperty(null, "mail.admin", null);
|
return this.getStringProperty("mail.admin", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAuthType()
|
public String getAuthType()
|
||||||
{
|
{
|
||||||
return this.getStringProperty("swordv2-server", "auth-type", "Basic",
|
return this.getStringProperty("swordv2-server.auth-type", "Basic",
|
||||||
new String[] { "Basic", "None" });
|
new String[] { "Basic", "None" });
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,19 +218,19 @@ public class SwordConfigurationDSpace implements SwordConfiguration
|
|||||||
|
|
||||||
public String getTempDirectory()
|
public String getTempDirectory()
|
||||||
{
|
{
|
||||||
return this.getStringProperty("swordv2-server", "upload.tempdir", null);
|
return this.getStringProperty("swordv2-server.upload.tempdir", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAlternateUrl()
|
public String getAlternateUrl()
|
||||||
{
|
{
|
||||||
return ConfigurationManager
|
return configurationService
|
||||||
.getProperty("swordv2-server", "error.alternate.url");
|
.getProperty("swordv2-server.error.alternate.url");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAlternateUrlContentType()
|
public String getAlternateUrlContentType()
|
||||||
{
|
{
|
||||||
return ConfigurationManager
|
return configurationService
|
||||||
.getProperty("swordv2-server", "error.alternate.content-type");
|
.getProperty("swordv2-server.error.alternate.content-type");
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -255,25 +247,10 @@ public class SwordConfigurationDSpace implements SwordConfiguration
|
|||||||
throws DSpaceSwordException, SwordError
|
throws DSpaceSwordException, SwordError
|
||||||
{
|
{
|
||||||
List<String> dps = new ArrayList<String>();
|
List<String> dps = new ArrayList<String>();
|
||||||
Properties props = ConfigurationManager.getProperties("swordv2-server");
|
List<String> packagingFormats = configurationService.getPropertyKeys("swordv2-server.disseminate-packaging");
|
||||||
Set keyset = props.keySet();
|
for (String key : packagingFormats)
|
||||||
for (Object keyObj : keyset)
|
|
||||||
{
|
{
|
||||||
// start by getting anything that starts with sword.disseminate-packging.
|
String value = configurationService.getProperty(key);
|
||||||
String sw = "disseminate-packaging.";
|
|
||||||
|
|
||||||
if (!(keyObj instanceof String))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
String key = (String) keyObj;
|
|
||||||
|
|
||||||
if (!key.startsWith(sw))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
String value = props.getProperty((key));
|
|
||||||
|
|
||||||
// now we want to ensure that the packaging format we offer has a disseminator
|
// now we want to ensure that the packaging format we offer has a disseminator
|
||||||
// associated with it
|
// associated with it
|
||||||
@@ -517,28 +494,14 @@ public class SwordConfigurationDSpace implements SwordConfiguration
|
|||||||
List<String> aps = new ArrayList<String>();
|
List<String> aps = new ArrayList<String>();
|
||||||
|
|
||||||
// build the holding maps of identifiers
|
// build the holding maps of identifiers
|
||||||
Properties props = ConfigurationManager.getProperties("swordv2-server");
|
String acceptPackagingPrefix = "swordv2-server.accept-packaging.collection";
|
||||||
Set keyset = props.keySet();
|
List<String> acceptFormats = configurationService.getPropertyKeys(acceptPackagingPrefix);
|
||||||
for (Object keyObj : keyset)
|
for (String key : acceptFormats)
|
||||||
{
|
{
|
||||||
// start by getting anything that starts with sword.accept-packaging.collection.
|
|
||||||
String sw = "accept-packaging.collection.";
|
|
||||||
|
|
||||||
if (!(keyObj instanceof String))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
String key = (String) keyObj;
|
|
||||||
|
|
||||||
if (!key.startsWith(sw))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// extract the configuration into the holding Maps
|
// extract the configuration into the holding Maps
|
||||||
|
|
||||||
// the suffix will be [typeid] or [handle].[typeid]
|
// the suffix will be [typeid] or [handle].[typeid]
|
||||||
String suffix = key.substring(sw.length());
|
String suffix = key.substring(acceptPackagingPrefix.length()+1);
|
||||||
|
|
||||||
// is there a handle which represents this collection?
|
// is there a handle which represents this collection?
|
||||||
boolean withHandle = false;
|
boolean withHandle = false;
|
||||||
@@ -557,7 +520,7 @@ public class SwordConfigurationDSpace implements SwordConfiguration
|
|||||||
|
|
||||||
if (withHandle || general)
|
if (withHandle || general)
|
||||||
{
|
{
|
||||||
String value = props.getProperty((key));
|
String value = configurationService.getProperty(key);
|
||||||
aps.add(value);
|
aps.add(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -570,26 +533,12 @@ public class SwordConfigurationDSpace implements SwordConfiguration
|
|||||||
List<String> aps = new ArrayList<String>();
|
List<String> aps = new ArrayList<String>();
|
||||||
|
|
||||||
// build the holding maps of identifiers
|
// build the holding maps of identifiers
|
||||||
Properties props = ConfigurationManager.getProperties("swordv2-server");
|
String acceptPackagingPrefix = "swordv2-server.accept-packaging.item";
|
||||||
Set keyset = props.keySet();
|
List<String> acceptFormats = configurationService.getPropertyKeys(acceptPackagingPrefix);
|
||||||
for (Object keyObj : keyset)
|
for (String key : acceptFormats)
|
||||||
{
|
{
|
||||||
// start by getting anything that starts with sword.accept-packging.collection.
|
|
||||||
String sw = "accept-packaging.item.";
|
|
||||||
|
|
||||||
if (!(keyObj instanceof String))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
String key = (String) keyObj;
|
|
||||||
|
|
||||||
if (!key.startsWith(sw))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// extract the configuration into the holding Maps
|
// extract the configuration into the holding Maps
|
||||||
String value = props.getProperty((key));
|
String value = configurationService.getProperty(key);
|
||||||
aps.add(value);
|
aps.add(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -696,14 +645,14 @@ public class SwordConfigurationDSpace implements SwordConfiguration
|
|||||||
|
|
||||||
public String getStateUri(String state)
|
public String getStateUri(String state)
|
||||||
{
|
{
|
||||||
return ConfigurationManager
|
return configurationService
|
||||||
.getProperty("swordv2-server", "state." + state + ".uri");
|
.getProperty("swordv2-server.state." + state + ".uri");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStateDescription(String state)
|
public String getStateDescription(String state)
|
||||||
{
|
{
|
||||||
return ConfigurationManager.getProperty("swordv2-server",
|
return configurationService
|
||||||
"state." + state + ".description");
|
.getProperty("swordv2-server.state." + state + ".description");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean allowUnauthenticatedMediaAccess()
|
public boolean allowUnauthenticatedMediaAccess()
|
||||||
|
@@ -68,8 +68,8 @@ public class FlowCurationUtils
|
|||||||
{
|
{
|
||||||
if (map.isEmpty())
|
if (map.isEmpty())
|
||||||
{
|
{
|
||||||
String statusCodes = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("curate.ui.statusmessages");
|
String[] statusCodes = DSpaceServicesFactory.getInstance().getConfigurationService().getArrayProperty("curate.ui.statusmessages");
|
||||||
for (String pair : statusCodes.split(","))
|
for (String pair : statusCodes)
|
||||||
{
|
{
|
||||||
String[] parts = pair.split("=");
|
String[] parts = pair.split("=");
|
||||||
map.put(parts[0].trim(), parts[1].trim());
|
map.put(parts[0].trim(), parts[1].trim());
|
||||||
@@ -270,8 +270,7 @@ public class FlowCurationUtils
|
|||||||
|
|
||||||
public static void setAllTasks() throws WingException, UnsupportedEncodingException
|
public static void setAllTasks() throws WingException, UnsupportedEncodingException
|
||||||
{
|
{
|
||||||
String csvList = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("curate." + CURATE_TASK_NAMES);
|
String[] properties = DSpaceServicesFactory.getInstance().getConfigurationService().getArrayProperty("curate." + CURATE_TASK_NAMES);
|
||||||
String[] properties = csvList.split(",");
|
|
||||||
for (String property : properties)
|
for (String property : properties)
|
||||||
{
|
{
|
||||||
//System.out.println("set all tasks and property = " + property + "\n");
|
//System.out.println("set all tasks and property = " + property + "\n");
|
||||||
@@ -283,10 +282,9 @@ public class FlowCurationUtils
|
|||||||
|
|
||||||
public static void setGroups() throws WingException, UnsupportedEncodingException
|
public static void setGroups() throws WingException, UnsupportedEncodingException
|
||||||
{
|
{
|
||||||
String csvList = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("curate." + CURATE_GROUP_NAMES);
|
String[] properties = DSpaceServicesFactory.getInstance().getConfigurationService().getArrayProperty("curate." + CURATE_GROUP_NAMES);
|
||||||
if (csvList != null)
|
if (properties != null)
|
||||||
{
|
{
|
||||||
String[] properties = csvList.split(",");
|
|
||||||
for (String property : properties)
|
for (String property : properties)
|
||||||
{
|
{
|
||||||
String[] keyValuePair = property.split("=");
|
String[] keyValuePair = property.split("=");
|
||||||
@@ -308,8 +306,7 @@ public class FlowCurationUtils
|
|||||||
while (iterator.hasNext())
|
while (iterator.hasNext())
|
||||||
{
|
{
|
||||||
String key = iterator.next();
|
String key = iterator.next();
|
||||||
String csvList = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("curate." + CURATE_GROUP_PREFIX + "." + key);
|
String[] properties = DSpaceServicesFactory.getInstance().getConfigurationService().getArrayProperty("curate." + CURATE_GROUP_PREFIX + "." + key);
|
||||||
String[] properties = csvList.split(",");
|
|
||||||
groupedTasks.put(URLDecoder.decode(key, "UTF-8"), properties);
|
groupedTasks.put(URLDecoder.decode(key, "UTF-8"), properties);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -10,6 +10,7 @@ package org.dspace.app.xmlui.aspect.administrative.item;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
|
|
||||||
import org.dspace.app.xmlui.aspect.submission.submit.AccessStepUtil;
|
import org.dspace.app.xmlui.aspect.submission.submit.AccessStepUtil;
|
||||||
import org.dspace.app.xmlui.cocoon.AbstractDSpaceTransformer;
|
import org.dspace.app.xmlui.cocoon.AbstractDSpaceTransformer;
|
||||||
@@ -64,7 +65,7 @@ public class AddBitstreamForm extends AbstractDSpaceTransformer
|
|||||||
private static final Message T_no_bundles = message("xmlui.administrative.item.AddBitstreamForm.no_bundles");
|
private static final Message T_no_bundles = message("xmlui.administrative.item.AddBitstreamForm.no_bundles");
|
||||||
|
|
||||||
|
|
||||||
private static final String DEFAULT_BUNDLE_LIST = "ORIGINAL, METADATA, THUMBNAIL, LICENSE, CC-LICENSE";
|
private static final String[] DEFAULT_BUNDLE_LIST = new String[]{"ORIGINAL", "METADATA", "THUMBNAIL", "LICENSE", "CC-LICENSE"};
|
||||||
|
|
||||||
private boolean isAdvancedFormEnabled=true;
|
private boolean isAdvancedFormEnabled=true;
|
||||||
|
|
||||||
@@ -102,13 +103,12 @@ public class AddBitstreamForm extends AbstractDSpaceTransformer
|
|||||||
|
|
||||||
// Get the list of bundles to allow the user to upload too. Either use the default
|
// Get the list of bundles to allow the user to upload too. Either use the default
|
||||||
// or one supplied from the dspace.cfg.
|
// or one supplied from the dspace.cfg.
|
||||||
String bundleString = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("xmlui.bundle.upload");
|
String[] bundles = DSpaceServicesFactory.getInstance().getConfigurationService().getArrayProperty("xmlui.bundle.upload");
|
||||||
if (bundleString == null || bundleString.length() == 0)
|
if (ArrayUtils.isEmpty(bundles))
|
||||||
{
|
{
|
||||||
bundleString = DEFAULT_BUNDLE_LIST;
|
bundles = DEFAULT_BUNDLE_LIST;
|
||||||
}
|
}
|
||||||
String[] parts = bundleString.split(",");
|
for (String part : bundles)
|
||||||
for (String part : parts)
|
|
||||||
{
|
{
|
||||||
if (addBundleOption(item, select, part.trim()))
|
if (addBundleOption(item, select, part.trim()))
|
||||||
{
|
{
|
||||||
|
@@ -135,7 +135,7 @@ swordv2-server.keep-original-package = true
|
|||||||
# See the SWORD specification for a detailed explanation of deposit
|
# See the SWORD specification for a detailed explanation of deposit
|
||||||
# On-Behalf-Of another user
|
# On-Behalf-Of another user
|
||||||
#
|
#
|
||||||
swordv2-server.on-behalf-of.enable = true
|
swordv2-server.on-behalf-of.enable = false
|
||||||
#
|
#
|
||||||
# Which user accounts are allowed to do updates on items which already
|
# Which user accounts are allowed to do updates on items which already
|
||||||
# exist in DSpace, on-behalf-of other users?
|
# exist in DSpace, on-behalf-of other users?
|
||||||
@@ -190,7 +190,8 @@ swordv2-server.error.alternate.content-type = text/html
|
|||||||
swordv2-server.generator.version = 2.0
|
swordv2-server.generator.version = 2.0
|
||||||
|
|
||||||
# The form of authentication to use
|
# The form of authentication to use
|
||||||
# This is normally set to 'basic' for HTTP Basic
|
# This is normally set to 'Basic' for HTTP Basic
|
||||||
|
# Other valid values: 'None'
|
||||||
swordv2-server.auth-type = Basic
|
swordv2-server.auth-type = Basic
|
||||||
|
|
||||||
# The location where uploaded files and packages are
|
# The location where uploaded files and packages are
|
||||||
|
Reference in New Issue
Block a user