diff --git a/dspace-api/src/main/java/org/dspace/core/ConfigurationManager.java b/dspace-api/src/main/java/org/dspace/core/ConfigurationManager.java index d1f40d59ac..17b0d16335 100644 --- a/dspace-api/src/main/java/org/dspace/core/ConfigurationManager.java +++ b/dspace-api/src/main/java/org/dspace/core/ConfigurationManager.java @@ -149,6 +149,25 @@ public class ConfigurationManager * when the property actually is zero, use getProperty. */ public static int getIntProperty(String property) + { + return getIntProperty(property, 0); + } + + /** + * Get a configuration property as an integer, with default + * + * @param property + * the name of the property + * + * @param defaultValue + * value to return if property is not found or is not an Integer. + * + * @return the value of the property. default is returned if + * the property does not exist or is not an Integer. To differentiate between this case + * and when the property actually is false, use + * getProperty. + */ + public static int getIntProperty(String property, int defaultValue) { if (properties == null) { @@ -156,7 +175,7 @@ public class ConfigurationManager } String stringValue = properties.getProperty(property); - int intValue = 0; + int intValue = defaultValue; if (stringValue != null) { diff --git a/dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/cocoon/DSpaceFeedGenerator.java b/dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/cocoon/DSpaceFeedGenerator.java index 5155fc406c..ae350d8255 100644 --- a/dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/cocoon/DSpaceFeedGenerator.java +++ b/dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/cocoon/DSpaceFeedGenerator.java @@ -139,6 +139,19 @@ public class DSpaceFeedGenerator extends AbstractGenerator /** number of DSpace items per feed */ private static int itemCount = 0; + /** + * How long should RSS feed cache entries be valid? milliseconds * seconds * + * minutes * hours default to 24 hours if config parameter is not present or + * wrong + */ + private static final long CACHE_AGE; + static + { + final String ageCfgName = "webui.feed.cache.age"; + final long ageCfg = ConfigurationManager.getIntProperty(ageCfgName, 24); + CACHE_AGE = 1000 * 60 * 60 * ageCfg; + } + /** default fields to display in item description */ private static String defaultDescriptionFields = "dc.description.abstract, dc.description, dc.title.alternative, dc.title"; @@ -649,13 +662,7 @@ public class DSpaceFeedGenerator extends AbstractGenerator private class FeedValidity extends DSpaceValidity { private static final long serialVersionUID = 1L; - - /** - * How long should the cache assumed to be valid for, - * milliseconds * seconds * minutes * hours - */ - private static final long CACHE_AGE = 1000 * 60 * 60 * 24; - + /** When the cache's validity expires */ private long expires = 0; diff --git a/dspace/CHANGES b/dspace/CHANGES index 0bf22d1ac0..c59fe39406 100644 --- a/dspace/CHANGES +++ b/dspace/CHANGES @@ -9,6 +9,9 @@ - [2620307] 'ant init_configs' copies wrong dspace.cfg - [DS-41] Small JSP cleanups +(Mark Wood / Claudia Juergen / Andrea Bollini) +- [DS-43] Manakin RSS feed generator cache timeout can't be adjusted - ID: 2593393 + (Stuart Lewis) - [2057231] Refactor LDAPServlet to use Stackable Authentication - Enable ldap.login.specialgroup special group for all LDAP users