AVM JavaScript integration refactored to use new Spring bean config pattern (as per recent HEAD merge changes)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4313 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2006-11-08 14:14:30 +00:00
parent d8d3756507
commit a157e79f42
4 changed files with 26 additions and 13 deletions

View File

@@ -19,27 +19,29 @@ package org.alfresco.repo.jscript;
import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
import org.alfresco.service.cmr.avm.AVMService;
import org.mozilla.javascript.Scriptable;
/**
* Helper to access AVM nodes from a script context.
*
* @author Kevin Roast
*/
public final class AVM implements Scopeable
public final class AVM extends BaseScriptImplementation implements Scopeable
{
/** Repository Service Registry */
private ServiceRegistry services;
/** Root scope for this object */
private Scriptable scope;
private AVMService avmService;
private ServiceRegistry services;
/**
* Constructor
* Set the service registry
*
* @param serviceRegistry the service registry
*/
public AVM(ServiceRegistry services)
public void setServiceRegistry(ServiceRegistry serviceRegistry)
{
this.services = services;
this.avmService = services.getAVMService();
this.services = serviceRegistry;
}
/**
@@ -63,7 +65,7 @@ public final class AVM implements Scopeable
if (store != null && store.length() != 0)
{
String rootPath = store + ':' + getWebappsFolderPath();
AVMNodeDescriptor nodeDesc = this.avmService.lookup(-1, rootPath);
AVMNodeDescriptor nodeDesc = this.services.getAVMService().lookup(-1, rootPath);
if (nodeDesc != null)
{
rootNode = new AVMNode(AVMNodeConverter.ToNodeRef(-1, rootPath), this.services, null, this.scope);
@@ -84,7 +86,7 @@ public final class AVM implements Scopeable
AVMNode node = null;
if (path != null && path.length() != 0)
{
AVMNodeDescriptor nodeDesc = this.avmService.lookup(-1, path);
AVMNodeDescriptor nodeDesc = this.services.getAVMService().lookup(-1, path);
if (nodeDesc != null)
{
node = new AVMNode(AVMNodeConverter.ToNodeRef(-1, path), this.services, null, this.scope);

View File

@@ -27,6 +27,9 @@ import org.alfresco.service.cmr.repository.TemplateImageResolver;
import org.mozilla.javascript.Scriptable;
/**
* Represents a AVM specific node in the Script context. Provides specific implementations
* of AVM specific methods such as copy, move, rename etc.
*
* @author Kevin Roast
*/
public class AVMNode extends Node

View File

@@ -235,7 +235,6 @@ public class RhinoScriptService implements ScriptService
{
model.put(script.getScriptName(), script);
}
model.put("avm", new AVM(services));
// insert supplied object model into root of the default scope
for (String key : model.keySet())