You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bsf-user@jakarta.apache.org by Dmitry Goldenberg <dm...@weblayers.com> on 2006/05/01 23:24:32 UTC

BSF integration sample code - ?

Hello,
 
I am new to BSF. Can anyone point me at any BSF integration samples as far as the usage of BSFManager/BSFEngine classes is concerned?
 
Thanks,
- Dmitry

RE: BSF integration sample code - ?

Posted by Dmitry Goldenberg <dm...@weblayers.com>.
Rony,
 
This helps a lot, thanks.  Where can I see the listing of all the language identifiers?  So far, I've found "javascript" and "rexx"...
 
Also, is there a snippet to see how Java code is called from inside of a script?
 
Thanks,
- Dmitry
 
 

________________________________

From: Rony G. Flatscher [mailto:Rony.Flatscher@wu-wien.ac.at]
Sent: Mon 5/1/2006 5:35 PM
To: Bean Scripting Framework users
Subject: Re: BSF integration sample code - ?



Hi Dimitry,
> I am new to BSF. Can anyone point me at any BSF integration samples as far as the usage of BSFManager/BSFEngine classes is concerned?
>  
Not sure, what you are looking for, here's a minimal Java program
employing BSF (to invoke a scripting language interpreter to execute the
supplied program).

------------- cut here -------------
import com.ibm.bsf.*;   // BSF support
import java.io.*;       // exception handling

public class TestSimpleExec {

  public static void main (String[] args) throws IOException
  {
    try {
      BSFManager mgr  = new BSFManager ();
      BSFEngine  rexx = mgr.loadScriptingEngine("rexx");
      String     rexxCode = "SAY 'Rexx was here!'";

      rexx.exec ("rexx", 0, 0, rexxCode);

    } catch (BSFException e) { e.printStackTrace(); }
  }
}
------------- cut here -------------


The above works with Rexx (if interested, get ooRexx from
<http://www.ooRexx.org>, and the BSF4Rexx-package containing the latest
build of the BSF-package including the Rexx-language at
<http://wi.wu-wien.ac.at/rgf/rexx/bsf4rexx/current/>: please read
carefully the readmeBSF.txt-file!).

Hope that helps,

---rony


---------------------------------------------------------------------
To unsubscribe, e-mail: bsf-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bsf-user-help@jakarta.apache.org





Re: BSF integration sample code - ?

Posted by "Rony G. Flatscher" <Ro...@wu-wien.ac.at>.
Hi Dimitry,
> I am new to BSF. Can anyone point me at any BSF integration samples as far as the usage of BSFManager/BSFEngine classes is concerned?
>   
Not sure, what you are looking for, here's a minimal Java program 
employing BSF (to invoke a scripting language interpreter to execute the 
supplied program).

------------- cut here -------------
import com.ibm.bsf.*;   // BSF support
import java.io.*;       // exception handling

public class TestSimpleExec {

  public static void main (String[] args) throws IOException
  {
    try {
      BSFManager mgr  = new BSFManager ();
      BSFEngine  rexx = mgr.loadScriptingEngine("rexx");
      String     rexxCode = "SAY 'Rexx was here!'";

      rexx.exec ("rexx", 0, 0, rexxCode);

    } catch (BSFException e) { e.printStackTrace(); }
  }
}
------------- cut here -------------


The above works with Rexx (if interested, get ooRexx from 
<http://www.ooRexx.org>, and the BSF4Rexx-package containing the latest 
build of the BSF-package including the Rexx-language at 
<http://wi.wu-wien.ac.at/rgf/rexx/bsf4rexx/current/>: please read 
carefully the readmeBSF.txt-file!).

Hope that helps,

---rony


---------------------------------------------------------------------
To unsubscribe, e-mail: bsf-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bsf-user-help@jakarta.apache.org