mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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:
@@ -86,6 +86,9 @@ public class RhinoScriptProcessor extends BaseProcessor implements ScriptProcess
|
|||||||
/** Pre initialized non secure scope object. */
|
/** Pre initialized non secure scope object. */
|
||||||
private Scriptable nonSecureScope;
|
private Scriptable nonSecureScope;
|
||||||
|
|
||||||
|
/** Flag to enable or disable runtime script compliation */
|
||||||
|
private boolean compile = true;
|
||||||
|
|
||||||
/** Cache of runtime compiled script instances */
|
/** Cache of runtime compiled script instances */
|
||||||
private final Map<String, Script> scriptCache = new ConcurrentHashMap<String, Script>(256);
|
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;
|
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()
|
* @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
|
// test the cache for a pre-compiled script matching our path
|
||||||
Script script = null;
|
Script script = null;
|
||||||
String path = location.getPath();
|
String path = location.getPath();
|
||||||
if (location.isCachable())
|
if (this.compile && location.isCachable())
|
||||||
{
|
{
|
||||||
script = this.scriptCache.get(path);
|
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
|
// rely on the ConcurrentHashMap impl to deal both with ensuring the safety of the
|
||||||
// underlying structure with asynchronous get/put operations and for fast
|
// underlying structure with asynchronous get/put operations and for fast
|
||||||
// multi-threaded access to the common cache.
|
// multi-threaded access to the common cache.
|
||||||
if (location.isCachable())
|
if (this.compile && location.isCachable())
|
||||||
{
|
{
|
||||||
this.scriptCache.put(path, script);
|
this.scriptCache.put(path, script);
|
||||||
}
|
}
|
||||||
|
@@ -894,7 +894,7 @@ public class ScriptNode implements Serializable, Scopeable, NamespacePrefixResol
|
|||||||
public Scriptable getAspects()
|
public Scriptable getAspects()
|
||||||
{
|
{
|
||||||
Set<QName> aspects = getAspectsSet();
|
Set<QName> aspects = getAspectsSet();
|
||||||
String[] result = new String[aspects.size()];
|
Object[] result = new Object[aspects.size()];
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (QName qname : aspects)
|
for (QName qname : aspects)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user