Added updatePrototypes() method to ScriptingEngine interface.

This commit is contained in:
hns 2002-06-21 15:28:40 +00:00
parent e47b5ca388
commit f3e9f21bb3
3 changed files with 29 additions and 10 deletions

View file

@ -92,6 +92,9 @@ public final class RequestEvaluator implements Runnable {
int tries = 0; int tries = 0;
boolean done = false; boolean done = false;
String error = null; String error = null;
scriptingEngine.updatePrototypes ();
while (!done) { while (!done) {
currentElement = null; currentElement = null;
@ -184,7 +187,6 @@ public final class RequestEvaluator implements Runnable {
if (currentElement != null) { if (currentElement != null) {
// add to requestPath array // add to requestPath array
requestPath.add (currentElement); requestPath.add (currentElement);
String pt = app.getPrototypeName (currentElement);
} }
} }
} }
@ -325,6 +327,8 @@ public final class RequestEvaluator implements Runnable {
globals.put ("res", res); globals.put ("res", res);
globals.put ("app", app); globals.put ("app", app);
scriptingEngine.updatePrototypes ();
scriptingEngine.enterContext (globals); scriptingEngine.enterContext (globals);
currentElement = root; currentElement = root;
@ -377,6 +381,8 @@ public final class RequestEvaluator implements Runnable {
} }
} }
scriptingEngine.updatePrototypes ();
// avoid going into transaction if called function doesn't exist // avoid going into transaction if called function doesn't exist
boolean functionexists = true; boolean functionexists = true;
functionexists = scriptingEngine.hasFunction (thisObject, method); functionexists = scriptingEngine.hasFunction (thisObject, method);

View file

@ -15,10 +15,17 @@ import java.io.File;
*/ */
public interface ScriptingEngine { public interface ScriptingEngine {
/**
* This method is called before an execution context for a request
* evaluation is entered to let the Engine know it should update
* its prototype information
*/
public void updatePrototypes ();
/** /**
* This method is called when an execution context for a request * This method is called when an execution context for a request
* evaluation is entered. The globals parameter contains the global values * evaluation is entered. The globals parameter contains the global values
* to be applied during this executino context. * to be applied during this execution context.
*/ */
public void enterContext (HashMap globals) throws ScriptingException; public void enterContext (HashMap globals) throws ScriptingException;

View file

@ -249,13 +249,11 @@ public final class FesiEvaluator implements ScriptingEngine {
} }
} }
/** /**
* This method is called when an execution context for a request * This method is called before an execution context is entered to let the
* evaluation is entered. The globals parameter contains the global values * engine know it should update its prototype information.
* to be applied during this executino context.
*/ */
public void enterContext (HashMap globals) throws ScriptingException { public void updatePrototypes () {
// first loop through existing prototypes and update them if necessary // first loop through existing prototypes and update them if necessary
for (Enumeration e=prototypes.elements(); e.hasMoreElements(); ) { for (Enumeration e=prototypes.elements(); e.hasMoreElements(); ) {
TypeInfo info = (TypeInfo) e.nextElement (); TypeInfo info = (TypeInfo) e.nextElement ();
@ -272,6 +270,14 @@ public final class FesiEvaluator implements ScriptingEngine {
} }
} }
} }
}
/**
* This method is called when an execution context for a request
* evaluation is entered. The globals parameter contains the global values
* to be applied during this execution context.
*/
public void enterContext (HashMap globals) throws ScriptingException {
// set globals on the global object // set globals on the global object
if (globals != null && globals != lastGlobals) { if (globals != null && globals != lastGlobals) {
// loop through global vars and set them // loop through global vars and set them