ovidiu 02/03/15 15:35:19 Modified: src/scratchpad/schecoon/src/org/apache/cocoon/components/flow Interpreter.java Log: Use a list for passing arguments instead of a dictionary. Revision Changes Path 1.3 +47 -12 xml-cocoon2/src/scratchpad/schecoon/src/org/apache/cocoon/components/flow/Interpreter.java Index: Interpreter.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/schecoon/src/org/apache/cocoon/components/flow/Interpreter.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Interpreter.java 14 Mar 2002 20:23:38 -0000 1.2 +++ Interpreter.java 15 Mar 2002 23:35:19 -0000 1.3 @@ -2,7 +2,7 @@ import java.io.InputStream; import java.util.HashMap; -import org.apache.avalon.framework.parameters.Parameters; +import java.util.List; import org.apache.avalon.framework.thread.ThreadSafe; import org.apache.cocoon.components.treeprocessor.InvokeContext; import org.apache.cocoon.environment.Environment; @@ -70,14 +70,33 @@ */ public interface Interpreter { + public static class Argument + { + public String name; + public String value; + + public Argument(String name, String value) + { + this.name = name; + this.value = value; + } + + public String toString() + { + return name + ": " + value; + } + } + public static String ROLE = "org.apache.cocoon.components.flow.Interpreter"; /** - * Load a script from Reader. + * Load a script given its location. * - * @param in a <code>Reader</code> value + * @param in a <code>String</code> value, representing the location + * of the script. + * @exception Exception if an error occurs */ - void readScript(InputStream in) + void readScript(String source) throws Exception; /** @@ -89,23 +108,39 @@ * * The method will execute the named function, which must be defined * in the given language. There is no assumption made on how various - * arguments are passed to the function. A particular language - * implementation may decide to put the environment, request, - * response etc. objects in the dynamic scope available to the - * function at the time of the call. Other implementations may - * decide to pass these as arguments to the called function. + * arguments are passed to the function. + * + * <p>The <code>params</code> argument is a <code>List</code> object + * that contains <code>Interpreter.Argument</code> instances, + * representing the parameters to be passed to the called + * function. An <code>Argument</code> instance is a key-value pair, + * where the key is the name of the parameter, and the value is its + * desired value. Most languages will ignore the name value and + * simply pass to the function, in a positional order, the values of + * the argument. Some languages however can pass the arguments in a + * different order than the original prototype of the function. For + * these languages the ability to associate the actual argument with + * a formal parameter using its name is essential. + * + * <p>A particular language implementation may decide to put the + * environment, request, response etc. objects in the dynamic scope + * available to the function at the time of the call. Other + * implementations may decide to pass these as arguments to the + * called function. * * <p>The current implementation assumes the sitemap implementation * is TreeProcessor. * * @param funName a <code>String</code> value, the name of the * function to call - * @param params a <code>Parameters</code> value, parameters to pass - * to the function. The interpretation of the parameters is left + * @param params a <code>List</code> object whose components are + * CallFunctionNode.Argument instances. The interpretation of the + * parameters is left to the actual implementation of the + * interpreter. * @param env an <code>Environment</code> value * @param ctx an <code>InvokeContext</code> value */ - void callFunction(String funName, Parameters params, + void callFunction(String funName, List params, Environment env, InvokeContext ctx) throws Exception;
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]