mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-16 14:33:09 +00:00
Fix more API classes using comma-separated configs (and ensure they all use 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 (ArrayUtils.isEmpty(engineURLs))
|
||||||
if (engineURLProp != null)
|
|
||||||
{
|
|
||||||
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.hooser.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
|
||||||
@@ -117,6 +119,10 @@ public class DSpaceAIPDisseminator extends AbstractMETSDisseminator
|
|||||||
protected List<String> filterBundles = new ArrayList<String>();
|
protected List<String> filterBundles = new ArrayList<String>();
|
||||||
// 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,
|
||||||
@@ -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()]);
|
||||||
|
@@ -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);
|
||||||
|
|
||||||
|
for(String ckey : propertyNames)
|
||||||
{
|
{
|
||||||
String ckey = ((String) propertyNames.nextElement()).trim();
|
if (ckey.endsWith(".class"))
|
||||||
|
|
||||||
if (ckey.startsWith(PROP_PFX) && ckey.endsWith(".class"))
|
|
||||||
{
|
{
|
||||||
String name = ckey.substring(PROP_PFX.length(), ckey
|
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
|
||||||
|
@@ -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)
|
||||||
|
@@ -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);
|
||||||
@@ -313,7 +310,6 @@ public class MARC21InitialArticleWord extends InitialArticleWord
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user