Merged V3.2 to HEAD

19216: ENH-506 - allow script compilation to be disabled for repository tier. Fix to unreported issue with return aspect array from a ScriptNode.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19221 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2010-03-11 12:31:51 +00:00
parent 426d419e53
commit e6df53908a
2 changed files with 14 additions and 3 deletions

View File

@@ -86,6 +86,9 @@ public class RhinoScriptProcessor extends BaseProcessor implements ScriptProcess
/** Pre initialized non secure scope object. */
private Scriptable nonSecureScope;
/** Flag to enable or disable runtime script compliation */
private boolean compile = true;
/** Cache of runtime compiled script instances */
private final Map<String, Script> scriptCache = new ConcurrentHashMap<String, Script>(256);
@@ -108,6 +111,14 @@ public class RhinoScriptProcessor extends BaseProcessor implements ScriptProcess
this.storePath = storePath;
}
/**
* @param compile the compile flag to set
*/
public void setCompile(boolean compile)
{
this.compile = compile;
}
/**
* @see org.alfresco.service.cmr.repository.ScriptProcessor#reset()
*/
@@ -126,7 +137,7 @@ public class RhinoScriptProcessor extends BaseProcessor implements ScriptProcess
// test the cache for a pre-compiled script matching our path
Script script = null;
String path = location.getPath();
if (location.isCachable())
if (this.compile && location.isCachable())
{
script = this.scriptCache.get(path);
}
@@ -154,7 +165,7 @@ public class RhinoScriptProcessor extends BaseProcessor implements ScriptProcess
// rely on the ConcurrentHashMap impl to deal both with ensuring the safety of the
// underlying structure with asynchronous get/put operations and for fast
// multi-threaded access to the common cache.
if (location.isCachable())
if (this.compile && location.isCachable())
{
this.scriptCache.put(path, script);
}