jakarta-bsf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From orlikow...@apache.org
Subject cvs commit: jakarta-bsf/src/org/apache/bsf/util BSFEngineImpl.java BSFEventProcessor.java BSFFunctions.java EngineUtils.java
Date Thu, 10 Jul 2003 05:33:38 GMT
orlikowski    2003/07/09 22:33:38

  Modified:    samples/calc TestCalc.java
               samples/jsplike JSPLikeInJavaScript.java
                        JSPLikeInNetRexx.java
               samples/scriptedui ScriptedUI.java
               samples/xsl TableFiller.java
               src/org/apache/bsf BSFEngine.java BSFManager.java Main.java
               src/org/apache/bsf/engines/jacl JaclEngine.java
               src/org/apache/bsf/engines/java JavaEngine.java
               src/org/apache/bsf/engines/javaclass JavaClassEngine.java
               src/org/apache/bsf/engines/javascript JavaScriptEngine.java
               src/org/apache/bsf/engines/jpython JPythonEngine.java
               src/org/apache/bsf/engines/jython JythonEngine.java
               src/org/apache/bsf/engines/netrexx NetRexxEngine.java
               src/org/apache/bsf/engines/xslt XSLTEngine.java
               src/org/apache/bsf/util BSFEngineImpl.java
                        BSFEventProcessor.java BSFFunctions.java
                        EngineUtils.java
  Log:
  Reverting change to parameter lists; list discussion indicates that
  info desired would be necessary for any sort of error reporting.
  Deprecation of API reverted.
  
  Revision  Changes    Path
  1.3       +1 -1      jakarta-bsf/samples/calc/TestCalc.java
  
  Index: TestCalc.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bsf/samples/calc/TestCalc.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestCalc.java	8 Jul 2003 14:29:31 -0000	1.2
  +++ TestCalc.java	10 Jul 2003 05:33:36 -0000	1.3
  @@ -31,7 +31,7 @@
       manager.declareBean("frame", this, this.getClass());
       try
       {
  -     manager.exec(manager.getLangFromFilename(fileName), 
  +     manager.exec(manager.getLangFromFilename(fileName), fileName, 0, 0, 
                    IOUtils.getStringFromReader(new FileReader(fileName)));
       }catch(BSFException e )
       {
  
  
  
  1.3       +7 -6      jakarta-bsf/samples/jsplike/JSPLikeInJavaScript.java
  
  Index: JSPLikeInJavaScript.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bsf/samples/jsplike/JSPLikeInJavaScript.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JSPLikeInJavaScript.java	8 Jul 2003 14:29:31 -0000	1.2
  +++ JSPLikeInJavaScript.java	10 Jul 2003 05:33:36 -0000	1.3
  @@ -43,23 +43,24 @@
       System.out.println ("<head><title>JSPLike</title></head>");
       System.out.println ("<body>");
       
  -    result = js.eval ("var response = bsf.lookupBean (\"response\");" +
  +    result = js.eval ("", 0, 0,
  +		      "var response = bsf.lookupBean (\"response\");" +
   		      "var startDate = new java.util.Date ();" +
   		      "var startDateStr = startDate + \"\";");
       System.out.print ("<h1>Welcome at ");
  -    result = js.eval ("startDateStr");
  +    result = js.eval ("", 0, 0,"startDateStr");
       System.out.println (result + "</h1>");
       System.out.println ("stuff");
       System.out.print ("Response bean's length is: ");
  -    result = js.eval ("response.length() + \"\"");
  +    result = js.eval ("", 0, 0,"response.length() + \"\"");
       System.out.println (result);
       System.out.print ("Response bean's uppercase value is: ");
  -    result = js.eval ("response.toUpperCase() + \"\"");
  +    result = js.eval ("", 0, 0,"response.toUpperCase() + \"\"");
       System.out.println (result);
  -    result = js.eval ("var endDate = new java.util.Date ();" +
  +    result = js.eval ("", 0, 0,"var endDate = new java.util.Date ();" +
   		      "var endDateStr = endDate + \"\";");
       System.out.print ("<h5>Page generation done at ");
  -    result = js.eval ("endDateStr");
  +    result = js.eval ("", 0, 0,"endDateStr");
       System.out.println (result + "</h5>");
       System.out.println ("</body>");
       System.out.println ("</html>");
  
  
  
  1.3       +5 -5      jakarta-bsf/samples/jsplike/JSPLikeInNetRexx.java
  
  Index: JSPLikeInNetRexx.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bsf/samples/jsplike/JSPLikeInNetRexx.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JSPLikeInNetRexx.java	8 Jul 2003 14:29:31 -0000	1.2
  +++ JSPLikeInNetRexx.java	10 Jul 2003 05:33:36 -0000	1.3
  @@ -40,7 +40,7 @@
     public JSPLikeInNetRexx () throws BSFException {
       rexx = mgr.loadScriptingEngine ("netrexx");
   
  -    System.out.println("<!- Using "+rexx.eval ("Version")+" ->");
  +    System.out.println("<!- Using "+rexx.eval ("", 0, 0,"Version")+" ->");
       
       // first register the response bean into the runtime 
       mgr.registerBean ("response", new String ("howdy-doody"));
  @@ -52,18 +52,18 @@
       System.out.println ("<body>");
       
       System.out.print ("<h1>Welcome at ");
  -    result = rexx.eval ("java.util.Date().toString()");
  +    result = rexx.eval ("", 0, 0,"java.util.Date().toString()");
       System.out.println (result + "</h1>");
       System.out.println ("stuff");
       System.out.print ("Response bean's length is: ");
  -    result = rexx.eval ("java.lang.Integer((java.lang.String " +
  +    result = rexx.eval ("", 0, 0,"java.lang.Integer((java.lang.String " +
                                    "bsf.lookupBean('response')).length)");
       System.out.println (result);
       System.out.print ("Response bean's uppercase value is: ");
  -    result = rexx.eval ("(java.lang.String bsf.lookupBean('response')).toUpperCase()");
  +    result = rexx.eval ("", 0, 0,"(java.lang.String bsf.lookupBean('response')).toUpperCase()");
       System.out.println (result);
       System.out.print ("<h5>Page generation done at ");
  -    result = rexx.eval ("java.util.Date().toString()");
  +    result = rexx.eval ("", 0, 0,"java.util.Date().toString()");
       System.out.println (result + "</h5>");
       System.out.println ("</body>");
       System.out.println ("</html>");
  
  
  
  1.3       +1 -1      jakarta-bsf/samples/scriptedui/ScriptedUI.java
  
  Index: ScriptedUI.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bsf/samples/scriptedui/ScriptedUI.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ScriptedUI.java	8 Jul 2003 14:29:31 -0000	1.2
  +++ ScriptedUI.java	10 Jul 2003 05:33:37 -0000	1.3
  @@ -32,7 +32,7 @@
         FileReader in = new FileReader (fileName);
         String script = IOUtils.getStringFromReader (in);
   
  -      mgr.exec (language, script);
  +      mgr.exec (language, fileName, -1, -1, script);
       } catch (BSFException e) {
         System.err.println ("Ouch: " + e.getMessage ());
         e.printStackTrace ();
  
  
  
  1.3       +1 -1      jakarta-bsf/samples/xsl/TableFiller.java
  
  Index: TableFiller.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bsf/samples/xsl/TableFiller.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TableFiller.java	8 Jul 2003 14:29:31 -0000	1.2
  +++ TableFiller.java	10 Jul 2003 05:33:37 -0000	1.3
  @@ -45,7 +45,7 @@
       // load and run the xsl file to fill in the table. Note that we're
       // running the xsl script for its side effect of filling in the table
       // and so we don't care what the resulting document is.
  -    mgr.exec ("xslt", 
  +    mgr.exec ("xslt", xslfilename, 0, 0, 
   	      IOUtils.getStringFromReader (new FileReader (xslfilename)));
   
       // display the frame
  
  
  
  1.3       +69 -23    jakarta-bsf/src/org/apache/bsf/BSFEngine.java
  
  Index: BSFEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bsf/src/org/apache/bsf/BSFEngine.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BSFEngine.java	8 Jul 2003 02:56:49 -0000	1.2
  +++ BSFEngine.java	10 Jul 2003 05:33:37 -0000	1.3
  @@ -84,28 +84,37 @@
   public interface BSFEngine extends PropertyChangeListener {
   	
   	/**
  -	 * This is used by an application to invoke an anonymous function. 
  -     * An anonymous function is a multi-line script which when evaluated will
  +	 * This is used by an application to invoke an anonymous function. An
  +	 * anonymous function is a multi-line script which when evaluated will
   	 * produce a value. These are separated from expressions and scripts
   	 * because the prior are spsed to be good 'ol expressions and scripts
   	 * are not value returning. We allow anonymous functions to have parameters
   	 * as well for completeness.
   	 *
  +	 * @param source   (context info) the source of this expression
  +	 *                 (e.g., filename)
  +	 * @param lineNo   (context info) the line number in source for expr
  +	 * @param columnNo (context info) the column number in source for expr
   	 * @param funcBody the multi-line, value returning script to evaluate
   	 * @param paramNames the names of the parameters above assumes
   	 * @param arguments values of the above parameters
   	 *
   	 * @exception BSFException if anything goes wrong while doin' it.
   	 */
  -	public Object apply(Object funcBody, Vector paramNames, Vector arguments)
  +	public Object apply(
  +		String source,
  +		int lineNo,
  +		int columnNo,
  +		Object funcBody,
  +		Vector paramNames,
  +		Vector arguments)
   		throws BSFException;
   	/**
   	 * This is used by an application to call into the scripting engine
  -	 * to make a function/method call.
  -     * The "object" argument is the object whose method is to be called, 
  -     * if that applies. For non-OO languages, this is typically ignored 
  -     * and should be given as null. For pretend-OO languages such as VB,
  -     * this would be the (String) name of the object.
  +	 * to make a function/method call. The "object" argument is the object
  +	 * whose method is to be called, if that applies. For non-OO languages,
  +	 * this is typically ignored and should be given as null. For pretend-OO
  +	 * languages such as VB, this would be the (String) name of the object.
   	 * The arguments are given in the args array.
   	 *
   	 * @param object object on which to make the call
  @@ -118,9 +127,13 @@
   	public Object call(Object object, String name, Object[] args)
   		throws BSFException;
   	/**
  -	 * This is used by an application to compile an anonymous function. 
  -     * See comments in apply() for more details.
  +	 * This is used by an application to compile an anonymous function. See
  +	 * comments in apply for more hdetails.
   	 *
  +	 * @param source   (context info) the source of this expression
  +	 *                 (e.g., filename)
  +	 * @param lineNo   (context info) the line number in source for expr
  +	 * @param columnNo (context info) the column number in source for expr
   	 * @param funcBody the multi-line, value returning script to evaluate
   	 * @param paramNames the names of the parameters above assumes
   	 * @param arguments values of the above parameters
  @@ -129,6 +142,9 @@
   	 * @exception BSFException if anything goes wrong while doin' it.
   	 */
   	public void compileApply(
  +		String source,
  +		int lineNo,
  +		int columnNo,
   		Object funcBody,
   		Vector paramNames,
   		Vector arguments,
  @@ -139,30 +155,48 @@
   	 * The expr may be string or some other type, depending on the language.
   	 * The generated code is dumped into the <tt>CodeBuffer</tt>.
   	 *
  +	 * @param source   (context info) the source of this expression
  +	 *                 (e.g., filename)
  +	 * @param lineNo   (context info) the line number in source for expr
  +	 * @param columnNo (context info) the column number in source for expr
   	 * @param expr     the expression to compile
   	 * @param cb       the CodeBuffer to compile into
   	 *
   	 * @exception BSFException if anything goes wrong while compiling a
   	 *            BSFException is thrown. The reason indicates the problem.
   	 */
  -	public void compileExpr(Object expr, CodeBuffer cb)
  +	public void compileExpr(
  +		String source,
  +		int lineNo,
  +		int columnNo,
  +		Object expr,
  +		CodeBuffer cb)
   		throws BSFException;
   	/**
  -	 * This is used by an application to compile some script. 
  -     * The script may be string or some other type, depending on the
  +	 * This is used by an application to compile some script. The
  +	 * script may be string or some other type, depending on the
   	 * language. The generated code is dumped into the <tt>CodeBuffer</tt>.
   	 *
  +	 * @param source   (context info) the source of this script
  +	 *                 (e.g., filename)
  +	 * @param lineNo   (context info) the line number in source for script
  +	 * @param columnNo (context info) the column number in source for script
   	 * @param script   the script to compile
   	 * @param cb       the CodeBuffer to compile into
   	 *
   	 * @exception BSFException if anything goes wrong while compiling a
   	 *            BSFException is thrown. The reason indicates the problem.
   	 */
  -	public void compileScript(Object script, CodeBuffer cb)
  +	public void compileScript(
  +		String source,
  +		int lineNo,
  +		int columnNo,
  +		Object script,
  +		CodeBuffer cb)
   		throws BSFException;
   	/**
  -	 * Declare a bean after the engine has been started.
  -     * Declared beans are beans that are named and which the engine must make available
  +	 * Declare a bean after the engine has been started. Declared beans
  +	 * are beans that are named and which the engine must make available
   	 * to the scripts it runs in the most first class way possible.
   	 *
   	 * @param bean the bean to declare
  @@ -171,29 +205,39 @@
   	 */
   	public void declareBean(BSFDeclaredBean bean) throws BSFException;
   	/**
  -	 * This is used by an application to evaluate an expression.
  -     * The expression may be string or some other type, depending on the
  +	 * This is used by an application to evaluate an expression. The
  +	 * expression may be string or some other type, depending on the
   	 * language. (For example, for BML it'll be an org.w3c.dom.Element
   	 * object.)
   	 *
  +	 * @param source   (context info) the source of this expression
  +	 *                 (e.g., filename)
  +	 * @param lineNo   (context info) the line number in source for expr
  +	 * @param columnNo (context info) the column number in source for expr
   	 * @param expr     the expression to evaluate
   	 *
   	 * @exception BSFException if anything goes wrong while eval'ing a
   	 *            BSFException is thrown. The reason indicates the problem.
   	 */
  -	public Object eval(Object expr) throws BSFException;
  +	public Object eval(String source, int lineNo, int columnNo, Object expr)
  +		throws BSFException;
   	/**
  -	 * This is used by an application to execute some script.
  -     * The expression may be string or some other type, depending on the
  +	 * This is used by an application to execute some script. The
  +	 * expression may be string or some other type, depending on the
   	 * language. Returns nothing but if something goes wrong it excepts
   	 * (of course).
   	 *
  +	 * @param source   (context info) the source of this expression
  +	 *                 (e.g., filename)
  +	 * @param lineNo   (context info) the line number in source for expr
  +	 * @param columnNo (context info) the column number in source for expr
   	 * @param script   the script to execute
   	 *
   	 * @exception BSFException if anything goes wrong while exec'ing a
   	 *            BSFException is thrown. The reason indicates the problem.
   	 */
  -	public void exec(Object script) throws BSFException;
  +	public void exec(String source, int lineNo, int columnNo, Object script)
  +		throws BSFException;
       /**
        * This is used by an application to execute some script, as though
        * one were interacting with the language in an interactive session. 
  @@ -210,7 +254,9 @@
        * @exception BSFException if anything goes wrong while exec'ing a
        *            BSFException is thrown. The reason indicates the problem.
        */
  -    public void iexec(Object script) throws BSFException;
  +    public void iexec(String source, int lineNo, int columnNo, Object script)
  +        throws BSFException;
  +
   	/**
   	 * This method is used to initialize the engine right after construction.
   	 * This method will be called before any calls to eval or call. At this
  
  
  
  1.4       +106 -219  jakarta-bsf/src/org/apache/bsf/BSFManager.java
  
  Index: BSFManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bsf/src/org/apache/bsf/BSFManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BSFManager.java	8 Jul 2003 18:57:19 -0000	1.3
  +++ BSFManager.java	10 Jul 2003 05:33:37 -0000	1.4
  @@ -129,14 +129,14 @@
               ResourceBundle rb =
                   ResourceBundle.getBundle("org.apache.bsf.Languages");
               Enumeration keys = rb.getKeys();
  -
  +            
               while (keys.hasMoreElements()) {
                   String key = (String) keys.nextElement();
                   String value = rb.getString(key);
  -
  +                
                   StringTokenizer tokens = new StringTokenizer(value, ",");
                   String className = (String) tokens.nextToken();
  -
  +                
                   // get the extensions for this language
                   String exts = (String) tokens.nextToken();
                   StringTokenizer st = new StringTokenizer(exts, "|");
  @@ -144,7 +144,7 @@
                   for (int i = 0; st.hasMoreTokens(); i++) {
                       extensions[i] = ((String) st.nextToken()).trim();
                   }
  -
  +                
                   registerScriptingEngine(key, className, extensions);
               }
           }
  @@ -167,16 +167,15 @@
        * parameters and return the resulting value.
        *
        * @param lang language identifier
  -     * @param source <b>ignored</b>
  -     * @param lineNo <b>ignored</b>
  -     * @param columnNo <b>ignored</b>
  +     * @param source (context info) the source of this expression
  +     (e.g., filename)
  +     * @param lineNo (context info) the line number in source for expr
  +     * @param columnNo (context info) the column number in source for expr
        * @param funcBody the multi-line, value returning script to evaluate
        * @param paramNames the names of the parameters above assumes
        * @param arguments values of the above parameters
        *
        * @exception BSFException if anything goes wrong while running the script
  -     *
  -     * @deprecated use the four-arg version instead.
        */
       public Object apply(String lang,
                           String source,
  @@ -186,26 +185,9 @@
                           Vector paramNames,
                           Vector arguments)
           throws BSFException {
  -
  -        return apply(lang, funcBody, paramNames, arguments);
  -    }
  -
  -    /**
  -     * Apply the given anonymous function of the given language to the given
  -     * parameters and return the resulting value.
  -     *
  -     * @param lang language identifier
  -     * @param funcBody the multi-line, value returning script to evaluate
  -     * @param paramNames the names of the parameters above assumes
  -     * @param arguments values of the above parameters
  -     *
  -     * @exception BSFException if anything goes wrong while running the script
  -     */
  -    public Object apply(String lang, Object funcBody, Vector paramNames,
  -                        Vector arguments)
  -        throws BSFException {
  -
           final BSFEngine e = loadScriptingEngine(lang);
  +        final String sourcef = source;
  +        final int lineNof = lineNo, columnNof = columnNo;
           final Object funcBodyf = funcBody;
           final Vector paramNamesf = paramNames;
           final Vector argumentsf = arguments;
  @@ -214,10 +196,11 @@
           try {
               final Object resultf = 
                   AccessController.doPrivileged(new PrivilegedExceptionAction() {
  -                    public Object run() throws Exception {
  -                        return e.apply(funcBodyf, paramNamesf, argumentsf);
  -                    }
  -                });
  +                        public Object run() throws Exception {
  +                            return e.apply(sourcef, lineNof, columnNof, 
  +                                           funcBodyf, paramNamesf, argumentsf);
  +                        }
  +                    });
               result = resultf;
           }
           catch (PrivilegedActionException prive) {
  @@ -232,17 +215,16 @@
        * language to the given parameters into the given <tt>CodeBuffer</tt>.
        *
        * @param lang language identifier
  -     * @param source <b>ignored</b>
  -     * @param lineNo <b>ignored</b>
  -     * @param columnNo <b>ignored</b>
  +     * @param source (context info) the source of this expression
  +     (e.g., filename)
  +     * @param lineNo (context info) the line number in source for expr
  +     * @param columnNo (context info) the column number in source for expr
        * @param funcBody the multi-line, value returning script to evaluate
        * @param paramNames the names of the parameters above assumes
        * @param arguments values of the above parameters
        * @param cb       code buffer to compile into
        *
        * @exception BSFException if anything goes wrong while running the script
  -     *
  -     * @deprecated use the five-arg version instead.
        */
       public void compileApply(String lang,
                                String source,
  @@ -253,40 +235,23 @@
                                Vector arguments,
                                CodeBuffer cb)
           throws BSFException {
  -
  -        compileApply(lang, funcBody, paramNames, arguments, cb);
  -    }
  -
  -    /**
  -     * Compile the application of the given anonymous function of the given
  -     * language to the given parameters into the given <tt>CodeBuffer</tt>.
  -     *
  -     * @param lang language identifier
  -     * @param funcBody the multi-line, value returning script to evaluate
  -     * @param paramNames the names of the parameters above assumes
  -     * @param arguments values of the above parameters
  -     * @param cb       code buffer to compile into
  -     *
  -     * @exception BSFException if anything goes wrong while running the script
  -     */
  -    public void compileApply(String lang, Object funcBody, Vector paramNames,
  -                             Vector arguments, CodeBuffer cb)
  -        throws BSFException {
  -
           final BSFEngine e = loadScriptingEngine(lang);
  +        final String sourcef = source;
  +        final int lineNof = lineNo, columnNof = columnNo;
           final Object funcBodyf = funcBody;
           final Vector paramNamesf = paramNames;
           final Vector argumentsf = arguments;
           final CodeBuffer cbf = cb;
  -
  +        
           try {
               AccessController.doPrivileged(new PrivilegedExceptionAction() {
  -                public Object run() throws Exception {
  -                    e.compileApply(funcBodyf, paramNamesf, 
  -                                   argumentsf, cbf);
  -                    return null;
  -                }
  -            });
  +                    public Object run() throws Exception {
  +                        e.compileApply(sourcef, lineNof, columnNof, 
  +                                       funcBodyf, paramNamesf, 
  +                                       argumentsf, cbf);
  +                        return null;
  +                    }
  +                });
           }
           catch (PrivilegedActionException prive) {
               throw (BSFException) prive.getException();
  @@ -298,15 +263,14 @@
        * <tt>CodeBuffer</tt>.
        *
        * @param lang     language identifier
  -     * @param source   <b>ignored</b>
  -     * @param lineNo   <b>ignored</b>
  -     * @param columnNo <b>ignored</b>
  +     * @param source   (context info) the source of this expression
  +     (e.g., filename)
  +     * @param lineNo   (context info) the line number in source for expr
  +     * @param columnNo (context info) the column number in source for expr
        * @param expr     the expression to compile
        * @param cb       code buffer to compile into
        *
        * @exception BSFException if any error while compiling the expression
  -     *
  -     * @deprecated use the three-arg version instead.
        */
       public void compileExpr(String lang,
                               String source,
  @@ -315,34 +279,19 @@
                               Object expr,
                               CodeBuffer cb)
           throws BSFException {
  -
  -        compileExpr(lang, expr, cb);
  -    }
  -
  -    /**
  -     * Compile the given expression of the given language into the given 
  -     * <tt>CodeBuffer</tt>.
  -     *
  -     * @param lang     language identifier
  -     * @param expr     the expression to compile
  -     * @param cb       code buffer to compile into
  -     *
  -     * @exception BSFException if any error while compiling the expression
  -     */
  -    public void compileExpr(String lang, Object expr, CodeBuffer cb)
  -        throws BSFException {
  -
           final BSFEngine e = loadScriptingEngine(lang);
  +        final String sourcef = source;
  +        final int lineNof = lineNo, columnNof = columnNo;
           final Object exprf = expr;
           final CodeBuffer cbf = cb;
   
           try {
               AccessController.doPrivileged(new PrivilegedExceptionAction() {
  -                public Object run() throws Exception {
  -                    e.compileExpr(exprf, cbf);
  -                    return null;
  -                }
  -            });
  +                    public Object run() throws Exception {
  +                        e.compileExpr(sourcef, lineNof, columnNof, exprf, cbf);
  +                        return null;
  +                    }
  +                });
           }
           catch (PrivilegedActionException prive) {
               throw (BSFException) prive.getException();
  @@ -354,15 +303,14 @@
        * <tt>CodeBuffer</tt>.
        *
        * @param lang     language identifier
  -     * @param source   <b>ignored</b>
  -     * @param lineNo   <b>ignored</b>
  -     * @param columnNo <b>ignored</b>
  +     * @param source   (context info) the source of this script
  +     (e.g., filename)
  +     * @param lineNo   (context info) the line number in source for script
  +     * @param columnNo (context info) the column number in source for script
        * @param script   the script to compile
        * @param cb       code buffer to compile into
        *
        * @exception BSFException if any error while compiling the script
  -     *
  -     * @deprecated use the three-arg version instead.
        */
       public void compileScript(String lang,
                                 String source,
  @@ -371,34 +319,20 @@
                                 Object script,
                                 CodeBuffer cb)
           throws BSFException {
  -
  -        compileScript(lang, script, cb);
  -    }
  -
  -    /**
  -     * Compile the given script of the given language into the given 
  -     * <tt>CodeBuffer</tt>.
  -     *
  -     * @param lang     language identifier
  -     * @param script   the script to compile
  -     * @param cb       code buffer to compile into
  -     *
  -     * @exception BSFException if any error while compiling the script
  -     */
  -    public void compileScript(String lang, Object script, CodeBuffer cb)
  -        throws BSFException {
  -
           final BSFEngine e = loadScriptingEngine(lang);
  +        final String sourcef = source;
  +        final int lineNof = lineNo, columnNof = columnNo;
           final Object scriptf = script;
           final CodeBuffer cbf = cb;
   
           try {
               AccessController.doPrivileged(new PrivilegedExceptionAction() {
  -                public Object run() throws Exception {
  -                    e.compileScript(scriptf, cbf);
  -                    return null;
  -                }
  -            });
  +                    public Object run() throws Exception {
  +                        e.compileScript(sourcef, lineNof, columnNof, 
  +                                        scriptf, cbf);
  +                        return null;
  +                    }
  +                });
           }
           catch (PrivilegedActionException prive) {
               throw (BSFException) prive.getException();
  @@ -406,13 +340,12 @@
       }
   
       /**
  -     * Declare a bean. 
  -     * The difference between declaring and registering is that engines are
  -     * spsed to make declared beans "pre-available" in the scripts as far as
  -     * possible. That is, if a script author needs a registered bean, he needs
  -     * to look it up in some way. However if he needs a declared bean, the
  -     * language has the responsibility to make those beans avaialable
  -     * "automatically."
  +     * Declare a bean. The difference between declaring and registering 
  +     * is that engines are spsed to make declared beans "pre-available"
  +     * in the scripts as far as possible. That is, if a script author
  +     * needs a registered bean, he needs to look it up in some way. However
  +     * if he needs a declared bean, the language has the responsibility to
  +     * make those beans avaialable "automatically."
        * <p>
        * When a bean is declared it is automatically registered as well
        * so that any declared bean can be gotton to by looking it up as well.
  @@ -438,7 +371,6 @@
        */
       public void declareBean(String beanName, Object bean, Class type)
           throws BSFException {
  -
           registerBean(beanName, bean);
   
           BSFDeclaredBean tempBean = new BSFDeclaredBean(beanName, bean, type);
  @@ -457,14 +389,13 @@
        * resulting value.
        *
        * @param lang language identifier
  -     * @param source <b>ignored</b>
  -     * @param lineNo <b>ignored</b>
  -     * @param columnNo <b>ignored</b>
  +     * @param source (context info) the source of this expression
  +     (e.g., filename)
  +     * @param lineNo (context info) the line number in source for expr
  +     * @param columnNo (context info) the column number in source for expr
        * @param expr the expression to evaluate
        *
        * @exception BSFException if anything goes wrong while running the script
  -     *
  -     * @deprecated use the two-arg version instead.
        */
       public Object eval(String lang,
                          String source,
  @@ -472,33 +403,19 @@
                          int columnNo,
                          Object expr)
           throws BSFException {
  -     
  -        return eval(lang, expr);
  -    }
  -
  -    /**
  -     * Evaluate the given expression of the given language and return the
  -     * resulting value.
  -     *
  -     * @param lang language identifier
  -     * @param expr the expression to evaluate
  -     *
  -     * @exception BSFException if anything goes wrong while running the script
  -     */
  -    public Object eval(String lang, Object expr)
  -        throws BSFException {
  -
           final BSFEngine e = loadScriptingEngine(lang);
  +        final String sourcef = source;
  +        final int lineNof = lineNo, columnNof = columnNo;
           final Object exprf = expr;
           Object result = null;
  -
  +        
           try {
               final Object resultf =
                   AccessController.doPrivileged(new PrivilegedExceptionAction() {
  -                    public Object run() throws Exception {
  -                        return e.eval(exprf);
  -                    }
  -                });
  +                        public Object run() throws Exception {
  +                            return e.eval(sourcef, lineNof, columnNof, exprf);
  +                        }
  +                    });
               result = resultf;
           }
           catch (PrivilegedActionException prive) {
  @@ -519,14 +436,13 @@
        * Execute the given script of the given language.
        *
        * @param lang     language identifier
  -     * @param source   <b>ignored</b>
  -     * @param lineNo   <b>ignored</b>
  -     * @param columnNo <b>ignored</b>
  +     * @param source   (context info) the source of this expression
  +     (e.g., filename)
  +     * @param lineNo   (context info) the line number in source for expr
  +     * @param columnNo (context info) the column number in source for expr
        * @param script   the script to execute
        *
        * @exception BSFException if anything goes wrong while running the script
  -     *
  -     * @deprecated use the two-arg version instead.
        */
       public void exec(String lang,
                        String source,
  @@ -534,31 +450,18 @@
                        int columnNo,
                        Object script)
           throws BSFException {
  -
  -        exec(lang, script);
  -    }
  -
  -    /**
  -     * Execute the given script of the given language.
  -     *
  -     * @param lang     language identifier
  -     * @param script   the script to execute
  -     *
  -     * @exception BSFException if anything goes wrong while running the script
  -     */
  -    public void exec(String lang, Object script)
  -        throws BSFException {
  -
           final BSFEngine e = loadScriptingEngine(lang);
  +        final String sourcef = source;
  +        final int lineNof = lineNo, columnNof = columnNo;
           final Object scriptf = script;
   
           try {
               AccessController.doPrivileged(new PrivilegedExceptionAction() {
  -                public Object run() throws Exception {
  -                    e.exec(scriptf);
  -                    return null;
  -                }
  -            });
  +                    public Object run() throws Exception {
  +                        e.exec(sourcef, lineNof, columnNof, scriptf);
  +                        return null;
  +                    }
  +                });
           }
           catch (PrivilegedActionException prive) {
               throw (BSFException) prive.getException();
  @@ -570,47 +473,32 @@
        * emulate an interactive session w/ the language.
        *
        * @param lang     language identifier
  -     * @param source   <b>ignored</b>
  -     * @param lineNo   <b>ignored</b>
  -     * @param columnNo <b>ignored</b>
  +     * @param source   (context info) the source of this expression 
  +     *                 (e.g., filename)
  +     * @param lineNo   (context info) the line number in source for expr
  +     * @param columnNo (context info) the column number in source for expr
        * @param script   the script to execute
        *
        * @exception BSFException if anything goes wrong while running the script
  -     *
  -     * @deprecated use the two-arg version instead.
        */
       public void iexec(String lang,
  -                      String source,
  -                      int lineNo,
  -                      int columnNo,
  -                      Object script)
  -        throws BSFException {
  -
  -        iexec(lang, script);
  -    }
  -
  -    /**
  -     * Execute the given script of the given language, attempting to
  -     * emulate an interactive session w/ the language.
  -     *
  -     * @param lang     language identifier
  -     * @param script   the script to execute
  -     *
  -     * @exception BSFException if anything goes wrong while running the script
  -     */
  -    public void iexec(String lang, Object script)
  +                     String source,
  +                     int lineNo,
  +                     int columnNo,
  +                     Object script)
           throws BSFException {
  -
           final BSFEngine e = loadScriptingEngine(lang);
  +        final String sourcef = source;
  +        final int lineNof = lineNo, columnNof = columnNo;
           final Object scriptf = script;
   
           try {
               AccessController.doPrivileged(new PrivilegedExceptionAction() {
  -                public Object run() throws Exception {
  -                    e.iexec(scriptf);
  -                    return null;
  -                }
  -            });
  +                    public Object run() throws Exception {
  +                        e.iexec(sourcef, lineNof, columnNof, scriptf);
  +                        return null;
  +                    }
  +                });
           }
           catch (PrivilegedActionException prive) {
               throw (BSFException) prive.getException();
  @@ -653,7 +541,6 @@
        */
       public static String getLangFromFilename(String fileName) 
           throws BSFException {
  -
           int dotIndex = fileName.lastIndexOf(".");
   
           if (dotIndex != -1) {
  @@ -687,7 +574,7 @@
                   }
                   if (loops == 0) lang = langval;
               }
  -
  +            
               if (lang != null && lang != "") {
                   return lang;
               }
  @@ -744,21 +631,21 @@
        *            exception is passed on as well.
        */
       public BSFEngine loadScriptingEngine(String lang) throws BSFException {
  -        // If already loaded, return it 
  +        // if its already loaded return that
           BSFEngine eng = (BSFEngine) loadedEngines.get(lang);
           if (eng != null) {
               return eng;
           }
   
  -        // Is it a registered language?
  +        // is it a registered language?
           String engineClassName = (String) registeredEngines.get(lang);
           if (engineClassName == null) {
               throw new BSFException(BSFException.REASON_UNKNOWN_LANGUAGE,
                                      "unsupported language: " + lang);
           }
   
  -        // Create the engine and initialize it. Throw exception in case
  -        // of failure.
  +        // create the engine and initialize it. if anything goes wrong
  +        // except.
           try {
               Class engineClass =
                   (classLoader == null)
  @@ -769,18 +656,18 @@
               final String langf = lang;
               final Vector dbf = declaredBeans;
               AccessController.doPrivileged(new PrivilegedExceptionAction() {
  -                public Object run() throws Exception {
  -                    engf.initialize(thisf, langf, dbf);
  -                    return null;
  -                }
  -            });
  +                    public Object run() throws Exception {
  +                        engf.initialize(thisf, langf, dbf);
  +                        return null;
  +                    }
  +                });
               eng = engf;
               loadedEngines.put(lang, eng);
               pcs.addPropertyChangeListener(eng);
               return eng;
           } 
           catch (PrivilegedActionException prive) {
  -            throw (BSFException) prive.getException();
  +                throw (BSFException) prive.getException();
           }
           catch (Throwable t) {
               throw new BSFException(BSFException.REASON_OTHER_ERROR,
  
  
  
  1.3       +5 -2      jakarta-bsf/src/org/apache/bsf/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bsf/src/org/apache/bsf/Main.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Main.java	8 Jul 2003 02:56:49 -0000	1.2
  +++ Main.java	10 Jul 2003 05:33:37 -0000	1.3
  @@ -140,16 +140,19 @@
   				cb.setClassName(outClassName);
   				mgr.compileScript(
   					language,
  +					inFileName,
  +					0,
  +					0,
   					IOUtils.getStringFromReader(in),
   					cb);
   				cb.print(pw, true);
   				out.close();
   			} else
   				if (mode.equals(ARG_VAL_EXEC)) {
  -					mgr.exec(language, IOUtils.getStringFromReader(in));
  +					mgr.exec(language, inFileName, 0, 0, IOUtils.getStringFromReader(in));
   				} else /* eval */ {
   					Object obj =
  -                                            mgr.eval(language, IOUtils.getStringFromReader(in));
  +                                            mgr.eval(language, inFileName, 0, 0, IOUtils.getStringFromReader(in));
                                           
   					// Try to display the result.
                                           
  
  
  
  1.3       +2 -1      jakarta-bsf/src/org/apache/bsf/engines/jacl/JaclEngine.java
  
  Index: JaclEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bsf/src/org/apache/bsf/engines/jacl/JaclEngine.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JaclEngine.java	8 Jul 2003 02:56:49 -0000	1.2
  +++ JaclEngine.java	10 Jul 2003 05:33:37 -0000	1.3
  @@ -105,7 +105,8 @@
      * This is used by an application to evaluate a string containing
      * some expression.
      */
  -  public Object eval (Object oscript) throws BSFException {
  +  public Object eval (String source, int lineNo, int columnNo, 
  +		      Object oscript) throws BSFException {
   	String script = oscript.toString ();
   	try {
   	  interp.eval (script);
  
  
  
  1.3       +4 -2      jakarta-bsf/src/org/apache/bsf/engines/java/JavaEngine.java
  
  Index: JavaEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bsf/src/org/apache/bsf/engines/java/JavaEngine.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JavaEngine.java	8 Jul 2003 02:56:50 -0000	1.2
  +++ JavaEngine.java	10 Jul 2003 05:33:37 -0000	1.3
  @@ -155,7 +155,8 @@
   	throw new BSFException (BSFException.REASON_UNSUPPORTED_FEATURE,
   			    "call() is not currently supported by JavaEngine");
     }
  -  public void compileScript (Object script, CodeBuffer cb) throws BSFException {
  +  public void compileScript (String source, int lineNo, int columnNo,
  +		  Object script, CodeBuffer cb) throws BSFException {
   	ObjInfo oldRet = cb.getFinalServiceMethodStatement ();
   
   	if (oldRet != null && oldRet.isExecutable ()) {
  @@ -182,7 +183,8 @@
      * We will attempt to use it, then if necessary fall back on invoking
      * javac via the command line.
      */
  -  public Object eval (Object oscript) throws BSFException
  +  public Object eval (String source, int lineNo, int columnNo, 
  +		      Object oscript) throws BSFException
     {
   	if (debug)
   	{
  
  
  
  1.3       +2 -1      jakarta-bsf/src/org/apache/bsf/engines/javaclass/JavaClassEngine.java
  
  Index: JavaClassEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bsf/src/org/apache/bsf/engines/javaclass/JavaClassEngine.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JavaClassEngine.java	8 Jul 2003 02:56:50 -0000	1.2
  +++ JavaClassEngine.java	10 Jul 2003 05:33:37 -0000	1.3
  @@ -105,7 +105,8 @@
      * This is used by an application to evaluate an object containing
      * some expression - clearly not possible for compiled code ..
      */
  -  public Object eval (Object oscript) throws BSFException {
  +  public Object eval (String source, int lineNo, int columnNo, 
  +		      Object oscript) throws BSFException {
   	throw new BSFException (BSFException.REASON_UNSUPPORTED_FEATURE,
   			    "Java bytecode engine can't evaluate expressions");
     }
  
  
  
  1.6       +4 -2      jakarta-bsf/src/org/apache/bsf/engines/javascript/JavaScriptEngine.java
  
  Index: JavaScriptEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bsf/src/org/apache/bsf/engines/javascript/JavaScriptEngine.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- JavaScriptEngine.java	9 Jul 2003 16:12:51 -0000	1.5
  +++ JavaScriptEngine.java	10 Jul 2003 05:33:37 -0000	1.6
  @@ -155,11 +155,12 @@
        * This is used by an application to evaluate a string containing
        * some expression.
        */
  -    public Object eval(Object oscript)
  +    public Object eval(String source, int lineNo, int columnNo, Object oscript)
           throws BSFException {
   
           String scriptText = oscript.toString();
           Object retval = null;
  +        Script script;
           Context cx;
   
           try {
  @@ -172,7 +173,8 @@
               cx.setDebugger(null, null);
   
               retval = cx.evaluateString(global, scriptText,
  -                                       null, 1, null);
  +                                       source, lineNo,
  +                                       null);
   
               if (retval instanceof NativeJavaObject)
                   retval = ((NativeJavaObject) retval).unwrap();
  
  
  
  1.3       +4 -2      jakarta-bsf/src/org/apache/bsf/engines/jpython/JPythonEngine.java
  
  Index: JPythonEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bsf/src/org/apache/bsf/engines/jpython/JPythonEngine.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JPythonEngine.java	8 Jul 2003 02:56:50 -0000	1.2
  +++ JPythonEngine.java	10 Jul 2003 05:33:37 -0000	1.3
  @@ -108,7 +108,8 @@
     /**
      * Evaluate an expression.
      */
  -  public Object eval (Object script) throws BSFException {
  +  public Object eval (String source, int lineNo, int columnNo, 
  +		      Object script) throws BSFException {
   	try {
   	  Object result = interp.eval (script.toString ());
   	  if (result != null && result instanceof PyJavaInstance)
  @@ -122,7 +123,8 @@
     /**
      * Execute a script. 
      */
  -  public void exec (Object script) throws BSFException {
  +  public void exec (String source, int lineNo, int columnNo,
  +		    Object script) throws BSFException {
   	try {
   	  interp.exec (script.toString ());
   	} catch (PyException e) {
  
  
  
  1.3       +8 -4      jakarta-bsf/src/org/apache/bsf/engines/jython/JythonEngine.java
  
  Index: JythonEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bsf/src/org/apache/bsf/engines/jython/JythonEngine.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JythonEngine.java	8 Jul 2003 02:56:50 -0000	1.2
  +++ JythonEngine.java	10 Jul 2003 05:33:37 -0000	1.3
  @@ -113,7 +113,8 @@
      * Evaluate an anonymous function (differs from eval() in that apply() 
      * handles multiple lines).
      */
  -  public Object apply (Object funcBody, Vector paramNames,
  +  public Object apply (String source, int lineNo, int columnNo, 
  +                       Object funcBody, Vector paramNames,
                          Vector arguments) throws BSFException {
         try {
             /* We wrapper the original script in a function definition, and
  @@ -147,7 +148,8 @@
     /**
      * Evaluate an expression.
      */
  -  public Object eval (Object script) throws BSFException {
  +  public Object eval (String source, int lineNo, int columnNo, 
  +		      Object script) throws BSFException {
   	try {
   	  Object result = interp.eval (script.toString ());
   	  if (result != null && result instanceof PyJavaInstance)
  @@ -162,7 +164,8 @@
     /**
      * Execute a script. 
      */
  -  public void exec (Object script) throws BSFException {
  +  public void exec (String source, int lineNo, int columnNo,
  +		    Object script) throws BSFException {
   	try {
   	  interp.exec (script.toString ());
   	} catch (PyException e) {
  @@ -174,7 +177,8 @@
     /**
      * Execute script code, emulating console interaction.
      */
  -  public void iexec (Object script) throws BSFException {
  +  public void iexec (String source, int lineNo, int columnNo,
  +                     Object script) throws BSFException {
         try {
             if (interp.buffer.length() > 0)
                 interp.buffer.append("\n");
  
  
  
  1.3       +407 -407  jakarta-bsf/src/org/apache/bsf/engines/netrexx/NetRexxEngine.java
  
  Index: NetRexxEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bsf/src/org/apache/bsf/engines/netrexx/NetRexxEngine.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- NetRexxEngine.java	8 Jul 2003 02:56:50 -0000	1.2
  +++ NetRexxEngine.java	10 Jul 2003 05:33:37 -0000	1.3
  @@ -107,417 +107,417 @@
    * @author  Joe Kesselman
    * @author  Sanjiva Weerawarana
    */
  -public class NetRexxEngine extends BSFEngineImpl {
  -    BSFFunctions mgrfuncs;
  -    private boolean bsfHandleCreated = false;
  -    static Hashtable codeToClass = new Hashtable();
  -    static String serializeCompilation = "";
  -    static String placeholder = "$$CLASSNAME$$";
  -    String minorPrefix;
  -
  -    /**
  -     * Create a scratchfile, open it for writing, return its name.
  -     * Relies on the filesystem to provide us with uniqueness testing.
  -     * NOTE THAT uniqueFileOffset continues to count; we don't want to
  -     * risk reusing a classname we have previously loaded in this session
  -     * even if the classfile has been deleted.
  -     *
  -     * I've made the offset static, due to concerns about reuse/reentrancy
  -     * of the NetRexx engine.
  -     */
  -    private static int uniqueFileOffset = 0;
  -
  -    private class GeneratedFile {
  -        File file = null;
  -        FileOutputStream fos = null;
  -        String className = null;
  -
  -        GeneratedFile (File file,FileOutputStream fos,String className) {
  -            this.file = file;
  -            this.fos = fos;
  -            this.className = className;
  -        }
  -    }
  -
  -    // rexxclass used to be an instance variable, on the theory that
  -    // each NetRexxEngine was an instance of a specific script.
  -    // BSF is currently reusing Engines, so caching the class
  -    // no longer makes sense.
  -    // Class rexxclass;
  -
  -    /**
  -     * Constructor.
  -     */
  -    public NetRexxEngine () {
  -        /*
  -           The following line is intended to cause the constructor to
  -           throw a NoClassDefFoundError if the NetRexxC.zip dependency
  -           is not resolved.
  -
  -           If this line was not here, the problem would not surface until
  -           the actual processing of a script. We want to know all is well
  -           at the time the engine is instantiated, not when we attempt to
  -           process a script.
  -           */
  -
  -        new netrexx.lang.BadArgumentException();
  -    }
  -
  -    /**
  -     * Return an object from an extension.
  -     * @param Object object from which to call our static method
  -     * @param method The name of the method to call.
  -     * @param args an array of arguments to be
  -     * passed to the extension, which may be either
  -     * Vectors of Nodes, or Strings.
  -     */
  -    public Object call (Object object,String method, Object[] args) 
  -        throws BSFException {
  -
  -        throw new BSFException(BSFException.REASON_UNSUPPORTED_FEATURE,
  -                               "NetRexx doesn't currently support call()",
  -                               null);
  -    }
  -
  -    /**
  -     * Invoke a static method.
  -     * @param rexxclass Class to invoke the method against
  -     * @param method The name of the method to call.
  -     * @param args an array of arguments to be
  -     * passed to the extension, which may be either
  -     * Vectors of Nodes, or Strings.
  -     */
  -    Object callStatic(Class rexxclass, String method, Object[] args) 
  -        throws BSFException {
  -
  -        //***** ISSUE: Currently supports only static methods
  -        Object retval = null;
  -        try
  -        {
  -            if (rexxclass != null)
  -            {
  -                //***** This should call the lookup used in BML, for typesafety
  -                Class[] argtypes=new Class[args.length];
  -                for(int i=0;i<args.length;++i)
  -                    argtypes[i]=args[i].getClass();
  -
  -                Method m=MethodUtils.getMethod(rexxclass, method, argtypes);
  -                retval=m.invoke(null,args);
  -            }
  -            else
  -            {
  -                DebugLog.stderrPrintln ("NetRexxEngine: ERROR: rexxclass==null!", 
  -                                        DebugLog.BSF_LOG_L3);
  -            }
  -        }
  -        catch(Exception e)
  -        {
  -            e.printStackTrace ();
  -            if (e instanceof InvocationTargetException)
  -            {
  -                Throwable t = ((InvocationTargetException)e).getTargetException ();
  -                t.printStackTrace ();
  -            }
  -            throw new BSFException (BSFException.REASON_IO_ERROR,
  -                                    e.getMessage (), e);
  -        }
  -        return retval;
  -    }
  -
  -    public void declareBean (BSFDeclaredBean bean) throws BSFException {}
  -    
  -    /**
  -     * Override impl of execute.
  -     * In NetRexx, methods which do not wish to return a value should be
  -     * invoked via exec, which will cause them to be generated without the
  -     * "returns" clause. Those which wish to return a value should call eval
  -     * instead. which will add "returns java.lang.Object" to the header.
  -     *
  -     * Note: It would be nice to have the "real" return type avaialable, so
  -     * we could do something more type-safe than Object, and so we could
  -     * return primitive types without having to enclose them in their
  -     * object wrappers. BSF does not currently support that concept.
  -     */
  -    public Object eval (Object script) throws BSFException {
  -        return execEvalShared(script, true);
  -    }
  - 
  -    /**
  -     * Override impl of execute.
  -     * In NetRexx, methods which do not wish to return a value should be
  -     * invoked via exec, which will cause them to be generated without the
  -     * "returns" clause. Those which wish to return a value should call eval
  -     * instead. which will add "returns java.lang.Object" to the header.
  -     */
  -    public void exec (Object script) throws BSFException {
  -        execEvalShared(script, false);
  -    }
  -
  -    /**
  -     * This is shared code for the exec() and eval() operations.
  -     * It will evaluate a string containing a NetRexx method body -- which may
  -     * be as simple as a single return statement. It should store the "bsf"
  -     * handle where the script can get to it, for callback purposes.
  -     * <p>
  -     * Note that NetRexx compilation imposes serious overhead -- 11 seconds for
  -     * the first compile, about 3 thereafter -- but in exchange you get
  -     * Java-like speeds once the classes have been created (minus the cache
  -     * lookup cost).
  -     * <p>
  -     * Nobody knows whether javac is threadsafe.
  -     * I'm going to serialize access to the compilers to protect it.
  -     */
  -    public Object execEvalShared (Object oscript,boolean returnsObject)
  -        throws BSFException {
  -
  -        Object retval=null;
  -        String classname=null;
  -        GeneratedFile gf=null;
  -
  -        // Moved into the exec process; see comment above.
  -        Class rexxclass=null;
  -
  -        String basescript=oscript.toString();
  -        String script=basescript; // May be altered by $$CLASSNAME$$ expansion
  -
  -        try {
  -            // Do we already have a class exactly matching this code?
  -            rexxclass=(Class)codeToClass.get(basescript);
  -
  -            if(rexxclass!=null)
  -            {
  -                DebugLog.debugPrintln ("NetRexxEngine: Found pre-compiled class" +
  -                                       " for script '" + basescript + "'", DebugLog.BSF_LOG_L3);
  -                classname=rexxclass.getName();
  -            }
  -            else
  -            {
  -                gf=openUniqueFile(tempDir,"BSFNetRexx",".nrx");
  -                if(gf==null)
  -                    throw new BSFException("couldn't create NetRexx scratchfile");
  -
  -                // Obtain classname
  -                classname=gf.className;
  -
  -                // Decide whether to declare a return type
  -                String returnsDecl="";
  -                if(returnsObject)
  -                    returnsDecl="returns java.lang.Object";
  -
  -                // Write the kluge header to the file.
  -                // ***** By doing so we give up the ability to use Property blocks.
  -                gf.fos.write(("class "+classname+";\n")
  -                             .getBytes());
  -                gf.fos.write(
  -                             ("method BSFNetRexxEngineEntry(bsf=org.apache.bsf.util.BSFFunctions) "+
  -                              " public static "+returnsDecl+";\n")
  -                             .getBytes());
  -
  -                // Edit the script to replace placeholder with the generated
  -                // classname. Note that this occurs _after_ the cache was
  -                // checked!
  -                int startpoint, endpoint;
  -                if((startpoint=script.indexOf(placeholder))>=0)
  -                {
  -                    StringBuffer changed=new StringBuffer();
  -                    for(;
  -                        startpoint>=0;
  -                        startpoint=script.indexOf(placeholder,startpoint))
  -                    {
  -                        changed.setLength(0);   // Reset for 2nd pass or later
  -                        if(startpoint>0)
  -                            changed.append(script.substring(0,startpoint));
  -                        changed.append(classname);
  -                        endpoint=startpoint+placeholder.length();
  -                        if(endpoint<script.length())
  -                            changed.append(script.substring(endpoint));
  -                        script=changed.toString();
  +public class NetRexxEngine extends BSFEngineImpl
  +{
  +	BSFFunctions mgrfuncs;
  +	private boolean bsfHandleCreated = false;
  +	static Hashtable codeToClass=new Hashtable();
  +	static String serializeCompilation="";
  +	static String placeholder="$$CLASSNAME$$";
  +	String minorPrefix;
  +  
  +	/**
  +	 * Create a scratchfile, open it for writing, return its name.
  +	 * Relies on the filesystem to provide us with uniqueness testing.
  +	 * NOTE THAT uniqueFileOffset continues to count; we don't want to
  +	 * risk reusing a classname we have previously loaded in this session
  +	 * even if the classfile has been deleted.
  +	 *
  +	 * I've made the offset static, due to concerns about reuse/reentrancy
  +	 * of the NetRexx engine.
  +	 */
  +  private static int uniqueFileOffset=0;
  +  private class GeneratedFile 
  +  {
  +	File file=null;
  +	FileOutputStream fos=null;
  +	String className=null;
  +	GeneratedFile(File file,FileOutputStream fos,String className) 
  +	  {
  +		  this.file=file;
  +		  this.fos=fos;
  +		  this.className=className;
  +	  }
  +  }
  +	
  +	// rexxclass used to be an instance variable, on the theory that
  +	// each NetRexxEngine was an instance of a specific script.
  +	// BSF is currently reusing Engines, so caching the class
  +	// no longer makes sense.
  +	// Class rexxclass;
  +	
  +	/**
  +	 * Constructor.
  +	 */
  +	public NetRexxEngine ()
  +	{
  +		/*
  +		  The following line is intended to cause the constructor to
  +		  throw a NoClassDefFoundError if the NetRexxC.zip dependency
  +		  is not resolved.
  +		  
  +		  If this line was not here, the problem would not surface until
  +		  the actual processing of a script. We want to know all is well
  +		  at the time the engine is instantiated, not when we attempt to
  +		  process a script.
  +		  */
  +		
  +		new netrexx.lang.BadArgumentException();
  +	}
  +	/**
  +	 * Return an object from an extension.
  +	 * @param Object object from which to call our static method
  +	 * @param method The name of the method to call.
  +	 * @param args an array of arguments to be
  +	 * passed to the extension, which may be either
  +	 * Vectors of Nodes, or Strings.
  +	 */
  +	public Object call (Object object,String method, Object[] args) 
  +	throws BSFException
  +	{
  +		throw new BSFException(BSFException.REASON_UNSUPPORTED_FEATURE,
  +							   "NetRexx doesn't currently support call()",
  +							   null);
  +	}
  +	/**
  +	 * Invoke a static method.
  +	 * @param rexxclass Class to invoke the method against
  +	 * @param method The name of the method to call.
  +	 * @param args an array of arguments to be
  +	 * passed to the extension, which may be either
  +	 * Vectors of Nodes, or Strings.
  +	 */
  +	Object callStatic(Class rexxclass, String method, Object[] args) 
  +	throws BSFException
  +	{
  +		//***** ISSUE: Currently supports only static methods
  +		Object retval = null;
  +		try
  +		{
  +			if (rexxclass != null)
  +			{
  +				//***** This should call the lookup used in BML, for typesafety
  +				Class[] argtypes=new Class[args.length];
  +				for(int i=0;i<args.length;++i)
  +					argtypes[i]=args[i].getClass();
  +				
  +				Method m=MethodUtils.getMethod(rexxclass, method, argtypes);
  +				retval=m.invoke(null,args);
  +			}
  +			else
  +			{
  +				DebugLog.stderrPrintln ("NetRexxEngine: ERROR: rexxclass==null!", DebugLog.BSF_LOG_L3);
  +			}
  +		}
  +		catch(Exception e)
  +		{
  +			e.printStackTrace ();
  +			if (e instanceof InvocationTargetException)
  +			{
  +				Throwable t = ((InvocationTargetException)e).getTargetException ();
  +				t.printStackTrace ();
  +			}
  +			throw new BSFException (BSFException.REASON_IO_ERROR,
  +									e.getMessage (),
  +									e);
  +		}
  +		return retval;
  +	}
  +	public void declareBean (BSFDeclaredBean bean) throws BSFException {}
  +	/**
  +	 * Override impl of execute. In NetRexx, methods which do not wish
  +	 * to return a value should be invoked via exec, which will cause them
  +	 * to be generated without the "returns" clause.
  +	 * Those which wish to return a value should call eval instead.
  +	 * which will add "returns java.lang.Object" to the header.
  +	 *
  +	 * Note: It would be nice to have the "real" return type avaialable, so
  +	 * we could do something more type-safe than Object, and so we could
  +	 * return primitive types without having to enclose them in their
  +	 * object wrappers. BSF does not currently support that concept.
  +	 */
  +	public Object eval (String source, int lineNo, int columnNo,
  +					Object script)
  +	throws BSFException
  +	{
  +		return execEvalShared(source, lineNo, columnNo, script,true);
  +	}
  +	/**
  +	 * Override impl of execute. In NetRexx, methods which do not wish
  +	 * to return a value should be invoked via exec, which will cause them
  +	 * to be generated without the "returns" clause.
  +	 * Those which wish to return a value should call eval instead.
  +	 * which will add "returns java.lang.Object" to the header.
  +	 */
  +	public void exec (String source, int lineNo, int columnNo,
  +				  Object script)
  +	throws BSFException
  +	{
  +		 execEvalShared(source, lineNo, columnNo, script,false);
  +	}
  +	/**
  +	 * This is shared code for the exec() and eval() operations. It will
  +	 * evaluate a string containing a NetRexx method body -- which may be
  +	 * as simple as a single return statement.
  +	 * It should store the "bsf" handle where the
  +	 * script can get to it, for callback purposes.
  +	 * <p>
  +	 * Note that NetRexx compilation imposes serious overhead -- 11 seconds for
  +	 * the first compile, about 3 thereafter -- but in exchange you get
  +	 * Java-like speeds once the classes have been created (minus the cache
  +	 * lookup cost).
  +	 * <p>
  +	 * Nobody knows whether javac is threadsafe.
  +	 * I'm going to serialize access to the compilers to protect it.
  +	 */
  +	public Object execEvalShared (String source, int lineNo, int columnNo, 
  +							  Object oscript,boolean returnsObject)
  +	throws BSFException
  +	{
  +		Object retval=null;
  +		String classname=null;
  +		GeneratedFile gf=null;
  +		
  +		// Moved into the exec process; see comment above.
  +		Class rexxclass=null;
  +		
  +		String basescript=oscript.toString();
  +		String script=basescript; // May be altered by $$CLASSNAME$$ expansion
  +		
  +		try {
  +                    // Do we already have a class exactly matching this code?
  +                    rexxclass=(Class)codeToClass.get(basescript);
  +                    
  +                    if(rexxclass!=null)
  +			{
  +                            DebugLog.debugPrintln ("NetRexxEngine: Found pre-compiled class" +
  +                                                   " for script '" + basescript + "'", DebugLog.BSF_LOG_L3);
  +                            classname=rexxclass.getName();
  +			}
  +                    else
  +			{
  +                            gf=openUniqueFile(tempDir,"BSFNetRexx",".nrx");
  +                            if(gf==null)
  +                                throw new BSFException("couldn't create NetRexx scratchfile");
  +                            
  +                            // Obtain classname
  +                            classname=gf.className;
  +                            
  +                            // Decide whether to declare a return type
  +                            String returnsDecl="";
  +                            if(returnsObject)
  +                                returnsDecl="returns java.lang.Object";
  +                            
  +                            // Write the kluge header to the file.
  +                            // ***** By doing so we give up the ability to use Property blocks.
  +                            gf.fos.write(("class "+classname+";\n")
  +                                         .getBytes());
  +                            gf.fos.write(
  +                                         ("method BSFNetRexxEngineEntry(bsf=org.apache.bsf.util.BSFFunctions) "+
  +                                          " public static "+returnsDecl+";\n")
  +								 .getBytes());
  +				
  +                            // Edit the script to replace placeholder with the generated
  +                            // classname. Note that this occurs _after_ the cache was
  +                            // checked!
  +                            int startpoint,endpoint;
  +                            if((startpoint=script.indexOf(placeholder))>=0)
  +				{
  +                                    StringBuffer changed=new StringBuffer();
  +                                    for(;
  +                                        startpoint>=0;
  +                                        startpoint=script.indexOf(placeholder,startpoint))
  +					{
  +                                            changed.setLength(0);   // Reset for 2nd pass or later
  +                                            if(startpoint>0)
  +                                                changed.append(script.substring(0,startpoint));
  +                                            changed.append(classname);
  +                                            endpoint=startpoint+placeholder.length();
  +                                            if(endpoint<script.length())
  +                                                changed.append(script.substring(endpoint));
  +                                            script=changed.toString();
  +					}
  +				}
  +                            
  +                            BSFDeclaredBean tempBean;
  +                            String          className;
  +                            
  +                            for (int i = 0; i < declaredBeans.size (); i++)
  +				{
  +                                    tempBean  = (BSFDeclaredBean) declaredBeans.elementAt (i);
  +                                    className = StringUtils.getClassName (tempBean.type);
  +                                    
  +                                    gf.fos.write ((tempBean.name + " =" + className + "   bsf.lookupBean(\"" +
  +                                                   tempBean.name + "\");").getBytes());
  +				}
  +                            
  +                            if(returnsObject)
  +                                gf.fos.write("return ".getBytes());
  +                            
  +                            // Copy the input to the file.
  +                            // Assumes all available -- probably mistake, but same as
  +                            // other engines.
  +                            gf.fos.write(script.getBytes());
  +                            gf.fos.close();
  +                            
  +                            DebugLog.debugPrintln ("NetRexxEngine: wrote temp file " + 
  +                                                   gf.file.getPath () + ", now compiling", DebugLog.BSF_LOG_L3);
  +                            
  +                            // Compile through Java to .class file
  +                    String command=gf.file.getPath(); //classname;
  +                    if (DebugLog.getLogLevel() >= 3) {
  +                        command += " -verbose4";
  +                    } else {
  +                        command += " -noverbose";
  +                        command += " -noconsole";
                       }
  -                }
  -
  -                BSFDeclaredBean tempBean;
  -                String          className;
  +                    
  +                    netrexx.lang.Rexx cmdline= new netrexx.lang.Rexx(command);
  +                    int retValue;
  +                    
  +                    // May not be threadsafe. Serialize access on static object:
  +                    synchronized(serializeCompilation)
  +                        {
  +                            // compile to a .java file
  +                            retValue =
  +                                COM.ibm.netrexx.process.NetRexxC.main(cmdline,
  +                                                                      new PrintWriter(DebugLog.getDebugStream()));
  +                        }
  +
  +				// Check if there were errors while compiling the Rexx code.
  +				if (retValue == 2)
  +				{
  +				  throw new BSFException(BSFException.REASON_EXECUTION_ERROR,
  +										 "There were NetRexx errors.");
  +				}
  +
  +				// Load class.
  +                                DebugLog.debugPrintln ("NetRexxEngine: loading class "+classname, DebugLog.BSF_LOG_L3);
  +				rexxclass=EngineUtils.loadClass (mgr, classname);
  +
  +				// Stash class for reuse
  +				codeToClass.put(basescript,rexxclass);
  +                        }
   
  -                for (int i = 0; i < declaredBeans.size (); i++)
  -                {
  -                    tempBean  = (BSFDeclaredBean) declaredBeans.elementAt (i);
  -                    className = StringUtils.getClassName (tempBean.type);
  -
  -                    gf.fos.write ((tempBean.name + " =" + className + "   bsf.lookupBean(\"" +
  -                                   tempBean.name + "\");").getBytes());
  +			Object[] args={mgrfuncs};
  +			retval=callStatic(rexxclass, "BSFNetRexxEngineEntry",args);
                   }
  -
  -                if(returnsObject)
  -                    gf.fos.write("return ".getBytes());
  -
  -                // Copy the input to the file.
  -                // Assumes all available -- probably mistake, but same as
  -                // other engines.
  -                gf.fos.write(script.getBytes());
  -                gf.fos.close();
  -
  -                DebugLog.debugPrintln ("NetRexxEngine: wrote temp file " + 
  -                                       gf.file.getPath () + ", now compiling",
  -                                       DebugLog.BSF_LOG_L3);
  -
  -                // Compile through Java to .class file
  -                String command=gf.file.getPath(); //classname;
  -                if (DebugLog.getLogLevel() >= 3) {
  -                    command += " -verbose4";
  -                } else {
  -                    command += " -noverbose";
  -                    command += " -noconsole";
  -                }
  -
  -                netrexx.lang.Rexx cmdline= new netrexx.lang.Rexx(command);
  -                int retValue;
  -
  -                // May not be threadsafe. Serialize access on static object:
  -                synchronized(serializeCompilation)
  -                {
  -                    // compile to a .java file
  -                    retValue =
  -                        COM.ibm.netrexx.process.NetRexxC.main(cmdline,
  -                                                              new PrintWriter(DebugLog.getDebugStream()));
  -                }
  -
  -                // Check if there were errors while compiling the Rexx code.
  -                if (retValue == 2)
  -                {
  -                    throw new BSFException(BSFException.REASON_EXECUTION_ERROR,
  -                                           "There were NetRexx errors.");
  -                }
  -
  -                // Load class.
  -                DebugLog.debugPrintln ("NetRexxEngine: loading class "+classname,
  -                                       DebugLog.BSF_LOG_L3);
  -                rexxclass=EngineUtils.loadClass (mgr, classname);
  -
  -                // Stash class for reuse
  -                codeToClass.put(basescript,rexxclass);
  -            }
  -
  -            Object[] args={mgrfuncs};
  -            retval=callStatic(rexxclass, "BSFNetRexxEngineEntry",args);
  -        }
  -        catch (BSFException e)
  -        {
  -            // Just forward the exception on.
  -            throw e;
  -        }
  -        catch(Exception e)
  -        {
  -            e.printStackTrace ();
  -            if (e instanceof InvocationTargetException)
  -            {
  -                Throwable t = ((InvocationTargetException)e).getTargetException ();
  -                t.printStackTrace ();
  -            }
  -            throw new BSFException (BSFException.REASON_IO_ERROR,
  -                                    e.getMessage (), e);
  -        }
  -        finally
  -        {
  -            // Cleanup: delete the .nrx and .class files
  -            // (if any) generated by NetRexx Trace requests.
  -
  -            if(gf!=null && gf.file!=null && gf.file.exists())
  -                gf.file.delete();  // .nrx file
  -
  -            if(classname!=null)
  -            {
  -                // Generated src
  -                File file=new File(tempDir+File.separatorChar+classname+".java");
  -                if(file.exists())
  -                    file.delete();
  -
  -                // Generated class
  -                file=new File(classname+".class");
  -                if(file.exists())
  -                    file.delete();
  -
  -                // Can this be done without disrupting trace?
  -                file=new File(tempDir+File.separatorChar+classname+".crossref");
  -                if(file.exists())
  -                    file.delete();
  -
  -                // Search for and clean up minor classes, classname$xxx.class
  -                file=new File(tempDir);
  -                minorPrefix=classname+"$"; // Indirect arg to filter
  -                String[] minor_classfiles=
  -                    file.list(
  -                              // ANONYMOUS CLASS for filter:
  -                              new FilenameFilter()
  -                              {
  -                                  // Starts with classname$ and ends with .class
  -                                  public boolean accept(File dir,String name)
  -                                  {
  -                                      return
  -                        (0==name.indexOf(minorPrefix))
  -                        &&
  -                        (name.lastIndexOf(".class")==name.length()-6)
  -                        ;
  -                                  }
  -                              }
  -                             );
  -                if(minor_classfiles!=null)
  -                    for(int i=minor_classfiles.length;i>0;)
  +                catch (BSFException e)
                       {
  -                        file=new File(minor_classfiles[--i]);
  -                        file.delete();
  +                        // Just forward the exception on.
  +                        throw e;
                       }
  -            }
  -        }
  -
  -        return retval;
  -    }
  -
  -    public void initialize(BSFManager mgr, String lang,Vector declaredBeans)
  -        throws BSFException {
  -
  -        super.initialize(mgr, lang, declaredBeans);
  -        mgrfuncs = new BSFFunctions (mgr, this);
  -    }
  -
  -    private GeneratedFile openUniqueFile(String directory, String prefix,
  -                                         String suffix) {
  -        File file=null,obj=null;
  -        FileOutputStream fos=null;
  -        int max=1000;           // Don't try forever
  -        GeneratedFile gf=null;
  -        int i;
  -        String className = null;
  -        for(i=max,++uniqueFileOffset;
  -            fos==null && i>0;
  -            --i,++uniqueFileOffset)     
  -        {
  -            // Probably a timing hazard here... ***************
  -            try
  -            {
  -                className = prefix+uniqueFileOffset;
  -                file=new File(directory+File.separatorChar+className+suffix);
  -                obj=new File(directory+File.separatorChar+className+".class");
  -                if(file!=null && !file.exists() & obj!=null & !obj.exists())
  -                    fos=new FileOutputStream(file);
  -            }
  -            catch(Exception e)
  -            {
  -                // File could not be opened for write, or Security Exception
  -                // was thrown. If someone else created the file before we could
  -                // open it, that's probably a threading conflict and we don't
  -                // bother reporting it.
  -                if(!file.exists())
  -                {
  -                    DebugLog.stderrPrintln("openUniqueFile: unexpected "+e, DebugLog.BSF_LOG_L0);
  -                }
  -            }
  -        }
  -        if(fos==null)
  -            DebugLog.stderrPrintln("openUniqueFile: Failed "+max+"attempts.", DebugLog.BSF_LOG_L0);
  -        else
  -            gf=new GeneratedFile(file,fos,className);
  -        return gf;
  -    }
  +                catch(Exception e)
  +                    {
  +			e.printStackTrace ();
  +			if (e instanceof InvocationTargetException)
  +			{
  +				Throwable t = ((InvocationTargetException)e).getTargetException ();
  +				t.printStackTrace ();
  +			}
  +			throw new BSFException (BSFException.REASON_IO_ERROR,
  +									e.getMessage (), e);
  +		}
  +		finally
  +		{
  +			// Cleanup: delete the .nrx and .class files
  +			// (if any) generated by NetRexx Trace requests.
  +			
  +			if(gf!=null && gf.file!=null && gf.file.exists())
  +				gf.file.delete();  // .nrx file
  +			
  +			if(classname!=null)
  +			{
  +				// Generated src
  +				File file=new File(tempDir+File.separatorChar+classname+".java");
  +				if(file.exists())
  +					file.delete();
  +				
  +				// Generated class
  +				file=new File(classname+".class");
  +				if(file.exists())
  +					file.delete();
  +				
  +				// Can this be done without disrupting trace?
  +				file=new File(tempDir+File.separatorChar+classname+".crossref");
  +				if(file.exists())
  +					file.delete();
  +				
  +				// Search for and clean up minor classes, classname$xxx.class
  +				file=new File(tempDir);
  +				minorPrefix=classname+"$"; // Indirect arg to filter
  +				String[] minor_classfiles=
  +					file.list(
  +						// ANONYMOUS CLASS for filter:
  +						new FilenameFilter()
  +						{
  +							// Starts with classname$ and ends with .class
  +							public boolean accept(File dir,String name)
  +							{
  +								return
  +									(0==name.indexOf(minorPrefix))
  +									&&
  +									(name.lastIndexOf(".class")==name.length()-6)
  +									;
  +							}
  +						}
  +						);
  +				if(minor_classfiles!=null)
  +					for(int i=minor_classfiles.length;i>0;)
  +					{
  +						file=new File(minor_classfiles[--i]);
  +						file.delete();
  +					}
  +			}
  +		}
  +		
  +		return retval;
  +	}
  +	public void initialize(BSFManager mgr, String lang,Vector declaredBeans)
  +	throws BSFException
  +	{
  +		super.initialize(mgr, lang, declaredBeans);
  +		mgrfuncs = new BSFFunctions (mgr, this);
  +	}
  +private GeneratedFile openUniqueFile(String directory,String prefix,String suffix)
  +	{
  +		File file=null,obj=null;
  +		FileOutputStream fos=null;
  +		int max=1000;           // Don't try forever
  +		GeneratedFile gf=null;
  +		int i;
  +		String className = null;
  +		for(i=max,++uniqueFileOffset;
  +			fos==null && i>0;
  +			--i,++uniqueFileOffset)     
  +		{
  +			// Probably a timing hazard here... ***************
  +			try
  +				{
  +					className = prefix+uniqueFileOffset;
  +					file=new File(directory+File.separatorChar+className+suffix);
  +					obj=new File(directory+File.separatorChar+className+".class");
  +					if(file!=null && !file.exists() & obj!=null & !obj.exists())
  +						fos=new FileOutputStream(file);
  +				}
  +			catch(Exception e)
  +				{
  +					// File could not be opened for write, or Security Exception
  +					// was thrown. If someone else created the file before we could
  +					// open it, that's probably a threading conflict and we don't
  +					// bother reporting it.
  +					if(!file.exists())
  +					{
  +						DebugLog.stderrPrintln("openUniqueFile: unexpected "+e, DebugLog.BSF_LOG_L0);
  +					}
  +				}
  +		}
  +		if(fos==null)
  +			DebugLog.stderrPrintln("openUniqueFile: Failed "+max+"attempts.", DebugLog.BSF_LOG_L0);
  +		else
  +			gf=new GeneratedFile(file,fos,className);
  +		return gf;
  +	}
   
  -    public void undeclareBean (BSFDeclaredBean bean) throws BSFException {}
  +	public void undeclareBean (BSFDeclaredBean bean) throws BSFException {}
   }
  
  
  
  1.3       +6 -5      jakarta-bsf/src/org/apache/bsf/engines/xslt/XSLTEngine.java
  
  Index: XSLTEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bsf/src/org/apache/bsf/engines/xslt/XSLTEngine.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XSLTEngine.java	8 Jul 2003 02:56:50 -0000	1.2
  +++ XSLTEngine.java	10 Jul 2003 05:33:37 -0000	1.3
  @@ -111,7 +111,8 @@
        * Evaluate an expression. In this case, an expression is assumed
        * to be a stylesheet of the template style (see the XSLT spec).
        */
  -    public Object eval (Object oscript) throws BSFException {
  +    public Object eval (String source, int lineNo, int columnNo, 
  +                        Object oscript) throws BSFException {
   	// get the style base URI (the place from where Xerces XSLT will
   	// look for imported/included files and referenced docs): if a
   	// bean named "xslt:styleBaseURI" is registered, then cvt it
  @@ -207,10 +208,10 @@
       /**
        * Initialize the engine.
        */
  -    public void initialize (BSFManager mgr, String lang, Vector declaredBeans)
  -        throws BSFException {
  -        
  -        super.initialize (mgr, lang, declaredBeans);
  +    public void initialize (BSFManager mgr, String lang,
  +                            Vector declaredBeans) throws BSFException {
  +	super.initialize (mgr, lang, declaredBeans);
  +
           tFactory = TransformerFactory.newInstance();
       }
   
  
  
  
  1.3       +23 -23    jakarta-bsf/src/org/apache/bsf/util/BSFEngineImpl.java
  
  Index: BSFEngineImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bsf/src/org/apache/bsf/util/BSFEngineImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BSFEngineImpl.java	8 Jul 2003 02:56:50 -0000	1.2
  +++ BSFEngineImpl.java	10 Jul 2003 05:33:37 -0000	1.3
  @@ -80,30 +80,31 @@
       protected ClassLoader classLoader;
   
       /**
  -     * Default impl of apply - calls eval ignoring parameters and returns
  +     * Default impl of apply - calls eval ignorning parameters and returns
        * the result.
        */
  -    public Object apply(Object funcBody, Vector paramNames, Vector arguments)
  +    public Object apply(String source, int lineNo, int columnNo, 
  +                        Object funcBody, Vector paramNames, Vector arguments)
           throws BSFException {
  -
  -        return eval(funcBody);
  +        return eval(source, lineNo, columnNo, funcBody);
       }
   
       /**
  -     * Default impl of compileApply - calls compileExpr ignoring parameters.
  +     * Default impl of compileApply - calls compileExpr ignorning parameters.
        */
  -    public void compileApply(Object funcBody, Vector paramNames, 
  +    public void compileApply(String source, int lineNo, int columnNo,
  +                             Object funcBody, Vector paramNames, 
                                Vector arguments, CodeBuffer cb)
           throws BSFException {
  -
  -        compileExpr(funcBody, cb);
  +        compileExpr(source, lineNo, columnNo, funcBody, cb);
       }
   
       /**
        * Default impl of compileExpr - generates code that'll create a new
        * manager, evaluate the expression, and return the value.
        */
  -    public void compileExpr(Object expr, CodeBuffer cb) throws BSFException {
  +    public void compileExpr(String source, int lineNo, int columnNo,
  +                            Object expr, CodeBuffer cb) throws BSFException {
           ObjInfo bsfInfo = cb.getSymbol("bsf");
           
           if (bsfInfo == null) {
  @@ -114,7 +115,8 @@
           }
   
           String evalString = bsfInfo.objName + ".eval(\"" + lang + "\", ";
  -        evalString += StringUtils.lineSeparator;
  +        evalString += "request.getRequestURI(), " + lineNo + ", " + columnNo;
  +        evalString += "," + StringUtils.lineSeparator;
           evalString += StringUtils.getSafeString(expr.toString()) + ")";
   
           ObjInfo oldRet = cb.getFinalServiceMethodStatement();
  @@ -133,9 +135,9 @@
        * Default impl of compileScript - generates code that'll create a new
        * manager, and execute the script.
        */
  -    public void compileScript(Object script, CodeBuffer cb) 
  +    public void compileScript(String source, int lineNo, int columnNo,
  +                              Object script, CodeBuffer cb) 
           throws BSFException {
  -
           ObjInfo bsfInfo = cb.getSymbol("bsf");
           
           if (bsfInfo == null) {
  @@ -146,7 +148,8 @@
           }
   
           String execString = bsfInfo.objName + ".exec(\"" + lang + "\", ";
  -        execString += StringUtils.lineSeparator;
  +        execString += "request.getRequestURI(), " + lineNo + ", " + columnNo;
  +        execString += "," + StringUtils.lineSeparator;
           execString += StringUtils.getSafeString(script.toString()) + ")";
   
           ObjInfo oldRet = cb.getFinalServiceMethodStatement();
  @@ -169,26 +172,23 @@
       /**
        * Default impl of execute - calls eval and ignores the result.
        */
  -    public void exec(Object script)
  +    public void exec(String source, int lineNo, int columnNo, Object script)
           throws BSFException {
  -
  -        eval(script);
  +        eval(source, lineNo, columnNo, script);
       }
   
       /**
        * Default impl of interactive execution - calls eval and ignores the result.
        */
  -    public void iexec(Object script)
  +    public void iexec(String source, int lineNo, int columnNo, Object script)
           throws BSFException {
  -
  -        eval(script);
  +        eval(source, lineNo, columnNo, script);
       }
   
       /**
  -     * Initialize the engine; called right after construction by 
  -     * the manager. 
  -     * Declared beans are simply kept in a vector and that's it. Subclasses
  -     * must do whatever they want with it.
  +     * initialize the engine; called right after construction by 
  +     * the manager. Declared beans are simply kept in a vector and
  +     * that's it. Subclasses must do whatever they want with it.
        */
       public void initialize(BSFManager mgr, String lang, Vector declaredBeans)
           throws BSFException {
  
  
  
  1.3       +8 -2      jakarta-bsf/src/org/apache/bsf/util/BSFEventProcessor.java
  
  Index: BSFEventProcessor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bsf/src/org/apache/bsf/util/BSFEventProcessor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BSFEventProcessor.java	8 Jul 2003 02:56:50 -0000	1.2
  +++ BSFEventProcessor.java	10 Jul 2003 05:33:37 -0000	1.3
  @@ -69,6 +69,9 @@
     BSFEngine engine;
     BSFManager manager;
     String filter;
  +  String source;
  +  int lineNo;
  +  int columnNo;
     Object script;
   
     /**
  @@ -76,11 +79,14 @@
      * public use.
      */
     BSFEventProcessor (BSFEngine engine, BSFManager manager, String filter,
  -		     Object script)
  +		     String source, int lineNo, int columnNo, Object script)
   	   throws BSFException {
   	this.engine = engine;
   	this.manager = manager;
   	this.filter = filter;
  +	this.source = source;
  +	this.lineNo = lineNo;
  +	this.columnNo = columnNo;
   	this.script = script;
     }
     //////////////////////////////////////////////////////////////////////////
  @@ -119,6 +125,6 @@
   	}
   
   	// run the script
  -	engine.exec (script);
  +	engine.exec (source, lineNo, columnNo, script);
     }
   }
  
  
  
  1.3       +1 -1      jakarta-bsf/src/org/apache/bsf/util/BSFFunctions.java
  
  Index: BSFFunctions.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bsf/src/org/apache/bsf/util/BSFFunctions.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BSFFunctions.java	8 Jul 2003 02:56:50 -0000	1.2
  +++ BSFFunctions.java	10 Jul 2003 05:33:37 -0000	1.3
  @@ -78,7 +78,7 @@
   				String filter, Object script)
   	   throws BSFException {
   	EngineUtils.addEventListener (src, eventSetName, filter, engine, 
  -				  mgr, script);
  +				  mgr, "<event-binding>", 0, 0, script);
     }
     public  Object lookupBean (String name) {
   	return mgr.lookupBean (name);
  
  
  
  1.3       +8 -3      jakarta-bsf/src/org/apache/bsf/util/EngineUtils.java
  
  Index: EngineUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bsf/src/org/apache/bsf/util/EngineUtils.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- EngineUtils.java	8 Jul 2003 02:56:50 -0000	1.2
  +++ EngineUtils.java	10 Jul 2003 05:33:37 -0000	1.3
  @@ -86,16 +86,21 @@
        * @param filter       filter for events
        * @param engine       BSFEngine which can run this script
        * @param manager      BSFManager of the above engine
  +     * @param source       (context info) the source of this expression 
  +     *                                    (e.g., filename)
  +     * @param lineNo       (context info) the line number in source for expr
  +     * @param columnNo     (context info) the column number in source for expr
        * @param script       the script to execute when the event occurs
        *
        * @exception BSFException if anything goes wrong while running the script
        */
       public static void addEventListener (Object bean, String eventSetName,
                                            String filter, BSFEngine engine, 
  -                                         BSFManager manager, Object script)
  -        throws BSFException {
  -
  +                                         BSFManager manager, String source,
  +                                         int lineNo, int columnNo, 
  +                                         Object script) throws BSFException {
           BSFEventProcessor ep = new BSFEventProcessor (engine, manager, filter,
  +                                                      source, lineNo, columnNo,
                                                         script);
           
           try {
  
  
  

Mime
View raw message