Fix for ETHREEOH-100, cleanup to some webscripts as ETHREEOH-100 now fixed.

Basic "people" API for FreeMarker - just getPerson() and getGroup() currently.
Template cache size and delay now configurable in RepositoryTemplateProcessor (like they already are in PresentationTemplateProcessor) - related default cache size tweaks.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13788 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2009-03-31 19:42:31 +00:00
parent dbec12a9c7
commit 2c43d8eb06
7 changed files with 122 additions and 101 deletions

View File

@@ -64,11 +64,14 @@ public class RepositoryTemplateProcessor extends FreeMarkerProcessor
protected String defaultEncoding;
protected Configuration templateConfig;
protected FreeMarkerProcessor freeMarkerProcessor;
private int updateDelay = 0;
private int cacheSize = 512;
/* (non-Javadoc)
* @see org.alfresco.repo.template.FreeMarkerProcessor#setDefaultEncoding(java.lang.String)
*/
@Override
public void setDefaultEncoding(String defaultEncoding)
{
this.defaultEncoding = defaultEncoding;
@@ -81,6 +84,25 @@ public class RepositoryTemplateProcessor extends FreeMarkerProcessor
{
return this.defaultEncoding;
}
/**
* @param updateDelay the time in seconds between checks on the modified date for cached templates
*/
public void setUpdateDelay(int updateDelay)
{
this.updateDelay = updateDelay;
}
/**
* @param cacheSize the size of the MRU template cache, default is 256
*/
public void setCacheSize(int cacheSize)
{
if (cacheSize >= 0)
{
this.cacheSize = cacheSize;
}
}
/**
* @param searchPath
@@ -151,9 +173,9 @@ public class RepositoryTemplateProcessor extends FreeMarkerProcessor
Configuration config = new Configuration();
// setup template cache
config.setCacheStorage(new MruCacheStorage(20, 100));
config.setTemplateUpdateDelay(0);
config.setCacheStorage(new MruCacheStorage(this.cacheSize, this.cacheSize << 1));
config.setTemplateUpdateDelay(updateDelay);
// setup template loaders
List<TemplateLoader> loaders = new ArrayList<TemplateLoader>();
for (Store apiStore : searchPath.getStores())