Minor typo with major impact: I meant BSF not BSH. Sorry!

Shash Chatterjee wrote:
If it is useful for anybody, in Keel (http://www.keelframework.org) we have an Avalon script service, with two implementations of the service interface: Jelly and BSH (I have tested JavaScript, NetRexx, and TCL). I have attached the service interface.

This interface (as I would expect other similar services to do), exposes arbitrary objects to the underlying script engine. Leo's concern in a separate post about the script causing havoc is very valid, depends on what is exposed!

On a separate but related topic, we seem to have the same needs and
also reinventing the wheel, given the number of Jelly service implementations we have. This is at least one of the major issues that COP was intended to solve, or so I thought! We talk about component repositories, but I think something that might help is an Avalon/Apache hosted project of Avalon service interfaces (roles), that could then be augmented with a directory that would point to all the available implementations. There are a plethora of "lightweight" IOC containers that can manage different components with varied configuration (i.e. instantiate a bean, provide different config to each instance), which Avalon can do as well. But Avalon containers are among a much smaller set that allow looking up of multiple implementations of the same interface, as well as configuring them differently. We should take more advantage of that, and avoid 1:1 relationships of interfaces/implementations.


Shash

Stephen McConnell wrote:



David Worms wrote:

I have an updated version of jelly working inside Merlin. I'll be happy to share it. From what I remember, I haven't changed the code, just added meta information, separated in to maven project (api/impl) and added a simple test to it.




How about we put it in the sandbox?
I'd like to take a loook at it.

Steve.



------------------------------------------------------------------------

/*
 * Copyright (c) 2002, The Keel Group, Ltd. All rights reserved.
 *
 * This software is made available under the terms of the license found
 * in the LICENSE file, included with this source code. The license can
 * also be found at:
 * http://www.keelframework.net/LICENSE
 */
package org.keel.services.script;

/**
* This is the interface for services that are able to execute some form * of an interpreted scripting language. Java objects can be passed
* to the script from Keel services, and visa-versa.
* * @version $Revision: 1.2 $ $Date: 2003/07/03 15:49:32 $
* @author Shash Chatterjee
* Created on Jun 14, 2003
*/
public interface Script {
/**
* The Avalon role name for the Script service
*/ public static String ROLE = Script.class.getName();
/**
* Expose a Java object to the script context
* @param o The object to expose
* @param name The name the object will be referred to by
* @throws ScriptException Error when the object cannot be exposed
*/
public void expose(Object o, String name) throws ScriptException;
/**
* Expose a java object to the script context, with a scoped name
* @param o The object to expose
* @param name The name the object will be referred to by
* @param scope The scope for the name
* @throws ScriptException Error when the object cannot be exposed
*/
public void expose(Object o, String name, String scope) throws ScriptException;
/**
* Get an object from the script context
* @param name The name of the object to retrieve
* @return The retrieved object
* @throws ScriptException Error when the object cannot be retrieved
*/
public Object retrieve(String name) throws ScriptException;
/**
* Get an object from the script context, with a scoped name
* @param name The name of the object to retrieve
* @param scope The scope for the name
* @return The retrieved object
* @throws ScriptException Error when the object cannot be retrieved
*/
public Object retrieve(String name, String scope) throws ScriptException;
/**
* Delete an object from the script context
* @param name The name of the object to delete
* @throws ScriptException Error when the object cannot be deleted
*/
public void remove(String name) throws ScriptException;
/**
* Delete an object from the script context, with a scoped name * @param name The name of the object to delete
* @param scope The scope for the name
* @throws ScriptException Error when the object cannot be deleted
*/
public void remove(String name, String scope) throws ScriptException;
/**
* Run the script in the named file
* @param script The file name of the script
* @throws ScriptException Error from the scripting engine
*/
public void execute(String script) throws ScriptException ;


}



------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to