[DS-43] Manakin RSS feed generator cache timeout can't be adjusted - ID: 2593393

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@3623 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Andrea Bollini
2009-03-23 09:03:14 +00:00
parent 3a3090cd98
commit 30812021fa
3 changed files with 37 additions and 8 deletions

View File

@@ -149,6 +149,25 @@ public class ConfigurationManager
* when the property actually is zero, use <code>getProperty</code>. * when the property actually is zero, use <code>getProperty</code>.
*/ */
public static int getIntProperty(String property) 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. <code>default</code> 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
* <code>getProperty</code>.
*/
public static int getIntProperty(String property, int defaultValue)
{ {
if (properties == null) if (properties == null)
{ {
@@ -156,7 +175,7 @@ public class ConfigurationManager
} }
String stringValue = properties.getProperty(property); String stringValue = properties.getProperty(property);
int intValue = 0; int intValue = defaultValue;
if (stringValue != null) if (stringValue != null)
{ {

View File

@@ -139,6 +139,19 @@ public class DSpaceFeedGenerator extends AbstractGenerator
/** number of DSpace items per feed */ /** number of DSpace items per feed */
private static int itemCount = 0; 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 */ /** default fields to display in item description */
private static String defaultDescriptionFields = "dc.description.abstract, dc.description, dc.title.alternative, dc.title"; 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 class FeedValidity extends DSpaceValidity
{ {
private static final long serialVersionUID = 1L; 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 */ /** When the cache's validity expires */
private long expires = 0; private long expires = 0;

View File

@@ -9,6 +9,9 @@
- [2620307] 'ant init_configs' copies wrong dspace.cfg - [2620307] 'ant init_configs' copies wrong dspace.cfg
- [DS-41] Small JSP cleanups - [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) (Stuart Lewis)
- [2057231] Refactor LDAPServlet to use Stackable Authentication - [2057231] Refactor LDAPServlet to use Stackable Authentication
- Enable ldap.login.specialgroup special group for all LDAP users - Enable ldap.login.specialgroup special group for all LDAP users