Template extension spring configuration support

- similar pattern to existing script bean extension support
 - new root model helper objects and custom methods can be added via spring configuration
Cleanup of script extension spring support
Fix to thread safety of configured script extension beans that use the Scopable interface

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5369 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2007-03-09 12:30:34 +00:00
parent e4e89f4db1
commit 9323a8cd7a
24 changed files with 363 additions and 151 deletions

View File

@@ -26,23 +26,19 @@ package org.alfresco.repo.jscript;
import org.alfresco.config.JNDIConstants;
import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
import org.alfresco.service.ServiceRegistry;
import org.mozilla.javascript.Scriptable;
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
/**
* Helper to access AVM nodes from a script context.
*
* @author Kevin Roast
*/
public final class AVM extends BaseScriptImplementation implements Scopeable
public final class AVM extends BaseScopableScriptImplementation
{
/** Repository Service Registry */
private ServiceRegistry services;
/** Root scope for this object */
private Scriptable scope;
/**
* Set the service registry
*
@@ -53,14 +49,6 @@ public final class AVM extends BaseScriptImplementation implements Scopeable
this.services = serviceRegistry;
}
/**
* @see org.alfresco.repo.jscript.Scopeable#setScope(org.mozilla.javascript.Scriptable)
*/
public void setScope(Scriptable scope)
{
this.scope = scope;
}
/**
* Return an AVM Node representing the public store root folder.
*
@@ -77,7 +65,7 @@ public final class AVM extends BaseScriptImplementation implements Scopeable
AVMNodeDescriptor nodeDesc = this.services.getAVMService().lookup(-1, rootPath);
if (nodeDesc != null)
{
rootNode = new AVMNode(AVMNodeConverter.ToNodeRef(-1, rootPath), this.services, this.scope);
rootNode = new AVMNode(AVMNodeConverter.ToNodeRef(-1, rootPath), this.services, getScope());
}
}
return rootNode;
@@ -98,7 +86,7 @@ public final class AVM extends BaseScriptImplementation implements Scopeable
AVMNodeDescriptor nodeDesc = this.services.getAVMService().lookup(-1, path);
if (nodeDesc != null)
{
node = new AVMNode(AVMNodeConverter.ToNodeRef(-1, path), this.services, this.scope);
node = new AVMNode(AVMNodeConverter.ToNodeRef(-1, path), this.services, getScope());
}
}
return node;