From bsf-userricharddavis@example.net Mon May 01 21:26:07 2006
Return-Path: <bsf-userricharddavis@example.net>
Delivered-To: richarddavis@example.net
Received: (qmail 44377 invoked from network); 1 May 2006 21:26:07 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155)
  by minotaur.apache.org with SMTP; 1 May 2006 21:26:07 -0000
Received: (qmail 51291 invoked by uid 500); 1 May 2006 21:26:07 -0000
Delivered-To: richarddavis@example.net
Received: (qmail 51268 invoked by uid 500); 1 May 2006 21:26:06 -0000
Mailing-List: contact richarddavis@example.net; run by ezmlm
Precedence: bulk
List-Unsubscribe: <mailto:richarddavis@example.net>
List-Help: <mailto:richarddavis@example.net>
List-Post: <mailto:richarddavis@example.net>
List-Id: "Bean Scripting Framework users" <bsf-user.jakarta.apache.org>
Reply-To: "Bean Scripting Framework users" <richarddavis@example.net>
Delivered-To: mailing list richarddavis@example.net
Received: (qmail 51241 invoked by uid 99); 1 May 2006 21:26:06 -0000
Received: from asf.osuosl.org (HELO asf.osuosl.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 May 2006 14:26:06 -0700
X-ASF-Spam-Status: No, hits=0.0 required=10.0
	tests=HTML_MESSAGE
X-Spam-Check-By: apache.org
Received-SPF: pass (asf.osuosl.org: local policy)
Received: from [83.161.120.155] (HELO mis011-1.exch011.intermedia.net) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 May 2006 14:26:05 -0700
Received: from ehost011-3.exch011.intermedia.net ([83.161.120.155]) by mis011-1.exch011.intermedia.net with Microsoft SMTPSVC817.673.5111);
	 Mon, 1 May 2006 14:24:34 -0700
X-MimeOLE: Produced By Microsoft Exchange V6.5
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: multipart/alternative;
	boundary="----_=_NextPart_001_01C66D65.A38C8B8D"
Subject: BSF integration sample code - ?
Date: Mon, 1 May 2006 14:24:32 -0700
Message-ID: <richarddavis@example.net>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: BSF integration sample code - ?
Thread-Index: AcZtZaOMIAQ6lIRBSsmUnqVgR0ljWA==
From: "Dmitry Goldenberg" <richarddavis@example.net>
To: <richarddavis@example.net>
X-OriginalArrivalTime: 01 May 2006 21:24:34.0065 (UTC) FILETIME=[A4344010:01C66D65]
X-Virus-Checked: Checked by ClamAV on apache.org
X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N

------_=_NextPart_001_01C66D65.A38C8B8D
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello,
=20
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?
=20
Thanks,
- Dmitry

------_=_NextPart_001_01C66D65.A38C8B8D--

From bsf-userricharddavis@example.net Mon May 01 21:36:11 2006
Return-Path: <bsf-userricharddavis@example.net>
Delivered-To: richarddavis@example.net
Received: (qmail 47511 invoked from network); 1 May 2006 21:36:10 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155)
  by minotaur.apache.org with SMTP; 1 May 2006 21:36:10 -0000
Received: (qmail 70485 invoked by uid 500); 1 May 2006 21:36:10 -0000
Delivered-To: richarddavis@example.net
Received: (qmail 70474 invoked by uid 500); 1 May 2006 21:36:10 -0000
Mailing-List: contact richarddavis@example.net; run by ezmlm
Precedence: bulk
List-Unsubscribe: <mailto:richarddavis@example.net>
List-Help: <mailto:richarddavis@example.net>
List-Post: <mailto:richarddavis@example.net>
List-Id: "Bean Scripting Framework users" <bsf-user.jakarta.apache.org>
Reply-To: "Bean Scripting Framework users" <richarddavis@example.net>
Delivered-To: mailing list richarddavis@example.net
Received: (qmail 70463 invoked by uid 99); 1 May 2006 21:36:09 -0000
Received: from asf.osuosl.org (HELO asf.osuosl.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 May 2006 14:36:09 -0700
X-ASF-Spam-Status: No, hits=0.0 required=10.0
	tests=
X-Spam-Check-By: apache.org
Received-SPF: pass (asf.osuosl.org: local policy)
Received: from [83.161.120.155] (HELO sslmail2.wu-wien.ac.at) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 May 2006 14:36:08 -0700
Received: from [83.161.120.155] (chello062178130228.6.13.wu-wien.teleweb.at [83.161.120.155])
	(authenticated bits=0)
	by sslmail2.wu-wien.ac.at (8.13.3/8.13.1) with ESMTP id k41LZhU1086963
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT)
	for <richarddavis@example.net>; Mon, 1 May 2006 23:35:44 +0200 (CEST)
	(envelope-from richarddavis@example.net)
Message-ID: <richarddavis@example.net>
Date: Mon, 01 May 2006 23:35:37 +0200
From: "Rony G. Flatscher" <richarddavis@example.net>
User-Agent: Thunderbird 83.161.120.155 (Windows/20060308)
MIME-Version: 1.0
To: Bean Scripting Framework users <richarddavis@example.net>
Subject: Re: BSF integration sample code - ?
References: <richarddavis@example.net>
In-Reply-To: <richarddavis@example.net>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-WU-wumi-status: clean v4.4.00/v4752 sslmail2 world 21c873fa41159e0413009f5c265cea46
X-Virus-Checked: Checked by ClamAV on apache.org
X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N

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: richarddavis@example.net
For additional commands, e-mail: richarddavis@example.net


From bsf-userricharddavis@example.net Mon May 01 21:48:54 2006
Return-Path: <bsf-userricharddavis@example.net>
Delivered-To: richarddavis@example.net
Received: (qmail 55160 invoked from network); 1 May 2006 21:48:54 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155)
  by minotaur.apache.org with SMTP; 1 May 2006 21:48:54 -0000
Received: (qmail 96862 invoked by uid 500); 1 May 2006 21:48:53 -0000
Delivered-To: richarddavis@example.net
Received: (qmail 96849 invoked by uid 500); 1 May 2006 21:48:53 -0000
Mailing-List: contact richarddavis@example.net; run by ezmlm
Precedence: bulk
List-Unsubscribe: <mailto:richarddavis@example.net>
List-Help: <mailto:richarddavis@example.net>
List-Post: <mailto:richarddavis@example.net>
List-Id: "Bean Scripting Framework users" <bsf-user.jakarta.apache.org>
Reply-To: "Bean Scripting Framework users" <richarddavis@example.net>
Delivered-To: mailing list richarddavis@example.net
Received: (qmail 96838 invoked by uid 99); 1 May 2006 21:48:53 -0000
Received: from asf.osuosl.org (HELO asf.osuosl.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 May 2006 14:48:53 -0700
X-ASF-Spam-Status: No, hits=0.0 required=10.0
	tests=
X-Spam-Check-By: apache.org
Received-SPF: pass (asf.osuosl.org: local policy)
Received: from [83.161.120.155] (HELO e2k3fes01.celosis.com) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 May 2006 14:48:51 -0700
Received: from 01EXCH2K3.celosis.com ([83.161.120.155]) by e2k3fes01.celosis.com with Microsoft SMTPSVC(6.0.3790.0);
	 Mon, 1 May 2006 14:48:51 -0700
X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Subject: RE: BSF integration sample code - ?
Date: Mon, 1 May 2006 14:48:51 -0700
Message-ID: <richarddavis@example.net>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: BSF integration sample code - ?
Thread-Index: AcZtZ1Oi3eix4/gbSxqp89DDmYUhRgAACzog
From: "Jaime Garza" <richarddavis@example.net>
To: "Bean Scripting Framework users" <richarddavis@example.net>
X-OriginalArrivalTime: 01 May 2006 21:48:51.0825 (UTC) FILETIME=[0918C610:01C66D69]
X-Virus-Checked: Checked by ClamAV on apache.org
X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N

The only thing I would add to Rony's answer is the capability to declare
"Beans" into your language, and the automatic loading of certain
"predefined" languages, so the call to load the scripting engine may not
be even needed.  To declare beans you create a java class with standard
getters and setters and other additional methods.  The getter/setter
combinations work like properties in your language, and your methods can
be called as functions.  I usually do javascript and BeanShell
integrations and I can use these properties as if they were variables,
and call the other methods in my declared beans as function calls, plus
these two languages would be preloaded if you drop the right jar in the
class path.  The biggest trick is finding the right jar to drop with
your integration, and it is usually a really simple google search.

The function to declare these beans is  BSFManager.declareBean and with
that you are set.  That is pretty much all the work needed for a very
basic integration.

- Jaime

-----Original Message-----
From: Rony G. Flatscher [mailto:richarddavis@example.net]=20
Sent: Monday, May 01, 2006 2:36 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?
>  =20
Not sure, what you are looking for, here's a minimal Java program=20
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  =3D new BSFManager ();
      BSFEngine  rexx =3D mgr.loadScriptingEngine("rexx");
      String     rexxCode =3D "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=20
<http://www.ooRexx.org>, and the BSF4Rexx-package containing the latest=20
build of the BSF-package including the Rexx-language at=20
<http://wi.wu-wien.ac.at/rgf/rexx/bsf4rexx/current/>: please read=20
carefully the readmeBSF.txt-file!).

Hope that helps,

---rony


---------------------------------------------------------------------
To unsubscribe, e-mail: richarddavis@example.net
For additional commands, e-mail: richarddavis@example.net


---------------------------------------------------------------------
To unsubscribe, e-mail: richarddavis@example.net
For additional commands, e-mail: richarddavis@example.net


From bsf-userricharddavis@example.net Mon May 01 21:50:00 2006
Return-Path: <bsf-userricharddavis@example.net>
Delivered-To: richarddavis@example.net
Received: (qmail 55533 invoked from network); 1 May 2006 21:50:00 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155)
  by minotaur.apache.org with SMTP; 1 May 2006 21:50:00 -0000
Received: (qmail 97393 invoked by uid 500); 1 May 2006 21:50:00 -0000
Delivered-To: richarddavis@example.net
Received: (qmail 97373 invoked by uid 500); 1 May 2006 21:50:00 -0000
Mailing-List: contact richarddavis@example.net; run by ezmlm
Precedence: bulk
List-Unsubscribe: <mailto:richarddavis@example.net>
List-Help: <mailto:richarddavis@example.net>
List-Post: <mailto:richarddavis@example.net>
List-Id: "Bean Scripting Framework users" <bsf-user.jakarta.apache.org>
Reply-To: "Bean Scripting Framework users" <richarddavis@example.net>
Delivered-To: mailing list richarddavis@example.net
Received: (qmail 97345 invoked by uid 99); 1 May 2006 21:50:00 -0000
Received: from asf.osuosl.org (HELO asf.osuosl.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 May 2006 14:49:59 -0700
X-ASF-Spam-Status: No, hits=0.0 required=10.0
	tests=
X-Spam-Check-By: apache.org
Received-SPF: pass (asf.osuosl.org: local policy)
Received: from [83.161.120.155] (HELO mis011-1.exch011.intermedia.net) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 May 2006 14:49:58 -0700
Received: from ehost011-3.exch011.intermedia.net ([83.161.120.155]) by mis011-1.exch011.intermedia.net with Microsoft SMTPSVC817.673.5111);
	 Mon, 1 May 2006 14:48:26 -0700
X-MimeOLE: Produced By Microsoft Exchange V6.5
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: multipart/mixed;
	boundary="----_=_NextPart_001_01C66D68.F93DB21D"
Subject: RE: BSF integration sample code - ?
Date: Mon, 1 May 2006 14:46:42 -0700
Message-ID: <richarddavis@example.net>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: <richarddavis@example.net>
Thread-Topic: BSF integration sample code - ?
Thread-Index: AcZtZxyBMtJRWxZzTwucI/SHIPAldAAAZ/JN
References: <richarddavis@example.net> <richarddavis@example.net>
From: "Dmitry Goldenberg" <richarddavis@example.net>
To: "Bean Scripting Framework users" <richarddavis@example.net>
X-OriginalArrivalTime: 01 May 2006 21:48:26.0627 (UTC) FILETIME=[FA13DD30:01C66D68]
X-Virus-Checked: Checked by ClamAV on apache.org
X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N

------_=_NextPart_001_01C66D68.F93DB21D
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Rony,
=20
This helps a lot, thanks.  Where can I see the listing of all the =
language identifiers?  So far, I've found "javascript" and "rexx"...
=20
Also, is there a snippet to see how Java code is called from inside of a =
script?
=20
Thanks,
- Dmitry
=20
=20

________________________________

From: Rony G. Flatscher [mailto:richarddavis@example.net]
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?
> =20
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  =3D new BSFManager ();
      BSFEngine  rexx =3D mgr.loadScriptingEngine("rexx");
      String     rexxCode =3D "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: richarddavis@example.net
For additional commands, e-mail: richarddavis@example.net





------_=_NextPart_001_01C66D68.F93DB21D
Content-Type: text/plain; charset=us-ascii

---------------------------------------------------------------------
To unsubscribe, e-mail: richarddavis@example.net
For additional commands, e-mail: richarddavis@example.net
------_=_NextPart_001_01C66D68.F93DB21D--

From bsf-userricharddavis@example.net Mon May 01 21:57:18 2006
Return-Path: <bsf-userricharddavis@example.net>
Delivered-To: richarddavis@example.net
Received: (qmail 58195 invoked from network); 1 May 2006 21:57:18 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155)
  by minotaur.apache.org with SMTP; 1 May 2006 21:57:18 -0000
Received: (qmail 5224 invoked by uid 500); 1 May 2006 21:57:17 -0000
Delivered-To: richarddavis@example.net
Received: (qmail 5212 invoked by uid 500); 1 May 2006 21:57:17 -0000
Mailing-List: contact richarddavis@example.net; run by ezmlm
Precedence: bulk
List-Unsubscribe: <mailto:richarddavis@example.net>
List-Help: <mailto:richarddavis@example.net>
List-Post: <mailto:richarddavis@example.net>
List-Id: "Bean Scripting Framework users" <bsf-user.jakarta.apache.org>
Reply-To: "Bean Scripting Framework users" <richarddavis@example.net>
Delivered-To: mailing list richarddavis@example.net
Received: (qmail 5201 invoked by uid 99); 1 May 2006 21:57:17 -0000
Received: from asf.osuosl.org (HELO asf.osuosl.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 May 2006 14:57:17 -0700
X-ASF-Spam-Status: No, hits=0.0 required=10.0
	tests=
X-Spam-Check-By: apache.org
Received-SPF: pass (asf.osuosl.org: local policy)
Received: from [83.161.120.155] (HELO mis011-1.exch011.intermedia.net) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 May 2006 14:57:15 -0700
Received: from ehost011-3.exch011.intermedia.net ([83.161.120.155]) by mis011-1.exch011.intermedia.net with Microsoft SMTPSVC817.673.5111);
	 Mon, 1 May 2006 14:55:43 -0700
X-MimeOLE: Produced By Microsoft Exchange V6.5
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: multipart/mixed;
	boundary="----_=_NextPart_001_01C66D69.FDD30961"
Subject: RE: BSF integration sample code - ?
Date: Mon, 1 May 2006 14:52:49 -0700
Message-ID: <richarddavis@example.net>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: <richarddavis@example.net>
Thread-Topic: BSF integration sample code - ?
Thread-Index: AcZtZ1Oi3eix4/gbSxqp89DDmYUhRgAACzogAACFhUU=
References: <richarddavis@example.net>
From: "Dmitry Goldenberg" <richarddavis@example.net>
To: "Bean Scripting Framework users" <richarddavis@example.net>
X-OriginalArrivalTime: 01 May 2006 21:55:43.0862 (UTC) FILETIME=[FEB0A160:01C66D69]
X-Virus-Checked: Checked by ClamAV on apache.org
X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N

------_=_NextPart_001_01C66D69.FDD30961
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Thanks, Jaime.
=20
Well, let's say I have a set of Java API's as follows:
=20
public List<String> getItemNames(String arg1, String arg2);
public Item findItem(String arg1);
=20
on my class MyEngine.  I imagine I'd need to do a declareBean on =
MyEngine.  But what do I do inside my scripts to execute these two =
methods and process their results?  Say, in JavaScript or Jython?
=20
Thanks.
- Dmitry

________________________________

From: Jaime Garza [mailto:richarddavis@example.net]
Sent: Mon 5/1/2006 5:48 PM
To: Bean Scripting Framework users
Subject: RE: BSF integration sample code - ?



The only thing I would add to Rony's answer is the capability to declare
"Beans" into your language, and the automatic loading of certain
"predefined" languages, so the call to load the scripting engine may not
be even needed.  To declare beans you create a java class with standard
getters and setters and other additional methods.  The getter/setter
combinations work like properties in your language, and your methods can
be called as functions.  I usually do javascript and BeanShell
integrations and I can use these properties as if they were variables,
and call the other methods in my declared beans as function calls, plus
these two languages would be preloaded if you drop the right jar in the
class path.  The biggest trick is finding the right jar to drop with
your integration, and it is usually a really simple google search.

The function to declare these beans is  BSFManager.declareBean and with
that you are set.  That is pretty much all the work needed for a very
basic integration.

- Jaime

-----Original Message-----
From: Rony G. Flatscher [mailto:richarddavis@example.net]
Sent: Monday, May 01, 2006 2:36 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?
> =20
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  =3D new BSFManager ();
      BSFEngine  rexx =3D mgr.loadScriptingEngine("rexx");
      String     rexxCode =3D "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: richarddavis@example.net
For additional commands, e-mail: richarddavis@example.net


---------------------------------------------------------------------
To unsubscribe, e-mail: richarddavis@example.net
For additional commands, e-mail: richarddavis@example.net





------_=_NextPart_001_01C66D69.FDD30961
Content-Type: text/plain; charset=us-ascii

---------------------------------------------------------------------
To unsubscribe, e-mail: richarddavis@example.net
For additional commands, e-mail: richarddavis@example.net
------_=_NextPart_001_01C66D69.FDD30961--

From bsf-userricharddavis@example.net Mon May 01 22:16:14 2006
Return-Path: <bsf-userricharddavis@example.net>
Delivered-To: richarddavis@example.net
Received: (qmail 66701 invoked from network); 1 May 2006 22:16:14 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155)
  by minotaur.apache.org with SMTP; 1 May 2006 22:16:14 -0000
Received: (qmail 20182 invoked by uid 500); 1 May 2006 22:16:14 -0000
Delivered-To: richarddavis@example.net
Received: (qmail 20169 invoked by uid 500); 1 May 2006 22:16:14 -0000
Mailing-List: contact richarddavis@example.net; run by ezmlm
Precedence: bulk
List-Unsubscribe: <mailto:richarddavis@example.net>
List-Help: <mailto:richarddavis@example.net>
List-Post: <mailto:richarddavis@example.net>
List-Id: "Bean Scripting Framework users" <bsf-user.jakarta.apache.org>
Reply-To: "Bean Scripting Framework users" <richarddavis@example.net>
Delivered-To: mailing list richarddavis@example.net
Received: (qmail 20158 invoked by uid 99); 1 May 2006 22:16:14 -0000
Received: from asf.osuosl.org (HELO asf.osuosl.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 May 2006 15:16:14 -0700
X-ASF-Spam-Status: No, hits=0.0 required=10.0
	tests=
X-Spam-Check-By: apache.org
Received-SPF: pass (asf.osuosl.org: local policy)
Received: from [83.161.120.155] (HELO sslmail2.wu-wien.ac.at) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 May 2006 15:16:13 -0700
Received: from [83.161.120.155] (chello062178130228.6.13.wu-wien.teleweb.at [83.161.120.155])
	(authenticated bits=0)
	by sslmail2.wu-wien.ac.at (8.13.3/8.13.1) with ESMTP id k41MFlm0090563
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT)
	for <richarddavis@example.net>; Tue, 2 May 2006 00:15:47 +0200 (CEST)
	(envelope-from richarddavis@example.net)
Message-ID: <richarddavis@example.net>
Date: Tue, 02 May 2006 00:15:41 +0200
From: "Rony G. Flatscher" <richarddavis@example.net>
User-Agent: Thunderbird 83.161.120.155 (Windows/20060308)
MIME-Version: 1.0
To: Bean Scripting Framework users <richarddavis@example.net>
Subject: A sample employing declareBean and interacting with it from JavaScript
 and others ... (Re: BSF integration sample code - ?
References: <richarddavis@example.net> <richarddavis@example.net>
In-Reply-To: <richarddavis@example.net>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-WU-wumi-status: clean v4.4.00/v4752 sslmail2 world 8353b1e736052099eba949b5cdf439bc
X-Virus-Checked: Checked by ClamAV on apache.org
X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N

Hi Dimitry,

Dmitry Goldenberg wrote:
> Thanks, Jaime.
>  
> Well, let's say I have a set of Java API's as follows:
>   
Why not use one of the samples coming with BSF(4Rexx) demonstrating what 
you are looking for ?

After compiling the following Java-program ("javac ScriptedUI.java"), 
you can invoke it by supplying the filename containing the script (which 
could be in any of the BSF supported script engines, inferred from the 
filetype), e.g.:

java ScriptedUI ui.js
java ScriptedUI ui.rex


----------------- cut here (ScriptedUI.java) -----------------
/* This example shows how a Java app can allow a script to customize
   a UI */

import java.awt.*;
import java.awt.event.*;
import java.io.*;

import org.apache.bsf.*;
import org.apache.bsf.util.*;

public class ScriptedUI {
  BSFManager mgr = new BSFManager ();

  public ScriptedUI (String fileName) {
    Frame f = new Frame ("Application's Main Frame");
    f.addWindowListener (new WindowAdapter () {
      public void windowClosing (WindowEvent e) {
	System.exit (0);
      }
    });

    Panel p = new Panel ();
    f.add ("Center", p);
    f.add ("North", new Button ("North Button"));
    f.add ("South", new Button ("South Button"));

    mgr.registerBean ("centerPanel", p);  // register panel (will be looked up by script)

    // exec script engine code to do its thing for this
    try {
      String language = BSFManager.getLangFromFilename (fileName);
      FileReader in = new FileReader (fileName);
      String script = IOUtils.getStringFromReader (in);

      mgr.exec (language, fileName, -1, -1, script);
    } catch (BSFException e) {
      System.err.println ("Ouch: " + e.getMessage ());
      e.printStackTrace ();
    } catch (IOException e) {
      System.err.println ("Ouch: " + e.getMessage ());
      e.printStackTrace ();
    }

    // now pack and show the frame
    f.pack ();
    f.show ();
  }

  public static void main (String[] args) throws Exception {
    if (args.length != 1) {
      System.err.println ("Usage: java ScriptedUI filename");
      System.err.println ("       where filename is the name of the script");
      System.exit (1);
    }
    new ScriptedUI (args[0]);
  }
}
----------------- cut here -----------------


This is the JavaScript version:

----------------- cut here (ui.js) -----------------
/* pick up the center panel bean */
p = bsf.lookupBean ("centerPanel");       /* get Panel object from the BSFRegistry */

/* set the layout manager to border */
p.setLayout (new java.awt.BorderLayout ());

/* add a few things */
p.add ("Center", new java.awt.Label ("Middle from JavaScript"));
p.add ("North", new java.awt.TextField ("north text from JavaScript"));
p.add ("South", new java.awt.TextField ("south text from JavaScript"));
p.add ("East", new java.awt.Button ("inner east from JavaScript"));
p.add ("West", new java.awt.Button ("inner west from JavaScript"));

/* configure p a bit */
p.setBackground (java.awt.Color.red);

/* configure the frame that p is in */
f = p.getParent ();
f.setTitle ("Hello from JavaScript (title reset from JavaScript)");
----------------- cut here -----------------


This is the ooRexx-version:

----------------- cut here (ui.rex) -----------------
p = .bsf~bsf.lookupBean("centerPanel")  -- reference the entry in BSF registry, put there by
                                        -- the Java program "ScriptedUI.class"

/* set the layout manager to border */
p~setLayout(.bsf~new("java.awt.BorderLayout"))

/* add a few things */
p~add("Center", .bsf~new("java.awt.Label",     "Middle from Object Rexx"))
p~add("North",  .bsf~new("java.awt.TextField", "North text from Object Rexx"))
p~add("South",  .bsf~new("java.awt.TextField", "South text from Object Rexx"))
p~add("East",   .bsf~new("java.awt.Button",    "Inner east text from Object Rexx"))
p~add("West",   .bsf~new("java.awt.Button",    "Inner west text from Object Rexx"))

/* configure p a bit */
p~setBackground(.bsf~bsf.getStaticValue("java.awt.Color", "green"))

/* configure the frame that p is in */
f=p~getParent
f~setTitle("Hello from Object REXX (title reset from Object Rexx)")

888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4requires BSF.CLS    -- get Object Rexx wrapper support for BSF
----------------- cut here -----------------


Hope that helps,

---rony


---------------------------------------------------------------------
To unsubscribe, e-mail: richarddavis@example.net
For additional commands, e-mail: richarddavis@example.net


From bsf-userricharddavis@example.net Tue May 02 13:50:22 2006
Return-Path: <bsf-userricharddavis@example.net>
Delivered-To: richarddavis@example.net
Received: (qmail 15240 invoked from network); 2 May 2006 13:49:42 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155)
  by minotaur.apache.org with SMTP; 2 May 2006 13:49:42 -0000
Received: (qmail 53349 invoked by uid 500); 2 May 2006 13:49:01 -0000
Delivered-To: richarddavis@example.net
Received: (qmail 53317 invoked by uid 500); 2 May 2006 13:49:00 -0000
Mailing-List: contact richarddavis@example.net; run by ezmlm
Precedence: bulk
List-Unsubscribe: <mailto:richarddavis@example.net>
List-Help: <mailto:richarddavis@example.net>
List-Post: <mailto:richarddavis@example.net>
List-Id: "Bean Scripting Framework users" <bsf-user.jakarta.apache.org>
Reply-To: "Bean Scripting Framework users" <richarddavis@example.net>
Delivered-To: mailing list richarddavis@example.net
Received: (qmail 53306 invoked by uid 99); 2 May 2006 13:49:00 -0000
Received: from asf.osuosl.org (HELO asf.osuosl.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 May 2006 06:49:00 -0700
X-ASF-Spam-Status: No, hits=0.0 required=10.0
	tests=
X-Spam-Check-By: apache.org
Received-SPF: pass (asf.osuosl.org: local policy)
Received: from [83.161.120.155] (HELO mis011-2.exch011.intermedia.net) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 May 2006 06:48:59 -0700
Received: from ehost011-3.exch011.intermedia.net ([83.161.120.155]) by mis011-2.exch011.intermedia.net with Microsoft SMTPSVC817.673.5111);
	 Tue, 2 May 2006 06:47:27 -0700
X-MimeOLE: Produced By Microsoft Exchange V6.5
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: multipart/mixed;
	boundary="----_=_NextPart_001_01C66DEE.F2312941"
Subject: RE: A sample employing declareBean and interacting with it from JavaScript and others ... (Re: BSF integration sample code - ?
Date: Tue, 2 May 2006 06:46:31 -0700
Message-ID: <richarddavis@example.net>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: <richarddavis@example.net>
Thread-Topic: A sample employing declareBean and interacting with it from JavaScript and others ... (Re: BSF integration sample code - ?
Thread-Index: AcZtbLJKb6+UttVXRFyHL52KF/W97wAgh+pD
References: <richarddavis@example.net> <richarddavis@example.net> <richarddavis@example.net>
From: "Dmitry Goldenberg" <richarddavis@example.net>
To: "Bean Scripting Framework users" <richarddavis@example.net>
X-OriginalArrivalTime: 02 May 2006 13:47:27.0127 (UTC) FILETIME=[F2E36270:01C66DEE]
X-Virus-Checked: Checked by ClamAV on apache.org
X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N

------_=_NextPart_001_01C66DEE.F2312941
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Rony,
=20
This rocks!  I wonder if it may be worthwhile publishing this code (and =
the other sample) on the BSF site ??

________________________________

From: Rony G. Flatscher [mailto:richarddavis@example.net]
Sent: Mon 5/1/2006 6:15 PM
To: Bean Scripting Framework users
Subject: A sample employing declareBean and interacting with it from =
JavaScript and others ... (Re: BSF integration sample code - ?



Hi Dimitry,

Dmitry Goldenberg wrote:
> Thanks, Jaime.
>=20
> Well, let's say I have a set of Java API's as follows:
> =20
Why not use one of the samples coming with BSF(4Rexx) demonstrating what
you are looking for ?

After compiling the following Java-program ("javac ScriptedUI.java"),
you can invoke it by supplying the filename containing the script (which
could be in any of the BSF supported script engines, inferred from the
filetype), e.g.:

java ScriptedUI ui.js
java ScriptedUI ui.rex


----------------- cut here (ScriptedUI.java) -----------------
/* This example shows how a Java app can allow a script to customize
   a UI */

import java.awt.*;
import java.awt.event.*;
import java.io.*;

import org.apache.bsf.*;
import org.apache.bsf.util.*;

public class ScriptedUI {
  BSFManager mgr =3D new BSFManager ();

  public ScriptedUI (String fileName) {
    Frame f =3D new Frame ("Application's Main Frame");
    f.addWindowListener (new WindowAdapter () {
      public void windowClosing (WindowEvent e) {
        System.exit (0);
      }
    });

    Panel p =3D new Panel ();
    f.add ("Center", p);
    f.add ("North", new Button ("North Button"));
    f.add ("South", new Button ("South Button"));

    mgr.registerBean ("centerPanel", p);  // register panel (will be =
looked up by script)

    // exec script engine code to do its thing for this
    try {
      String language =3D BSFManager.getLangFromFilename (fileName);
      FileReader in =3D new FileReader (fileName);
      String script =3D IOUtils.getStringFromReader (in);

      mgr.exec (language, fileName, -1, -1, script);
    } catch (BSFException e) {
      System.err.println ("Ouch: " + e.getMessage ());
      e.printStackTrace ();
    } catch (IOException e) {
      System.err.println ("Ouch: " + e.getMessage ());
      e.printStackTrace ();
    }

    // now pack and show the frame
    f.pack ();
    f.show ();
  }

  public static void main (String[] args) throws Exception {
    if (args.length !=3D 1) {
      System.err.println ("Usage: java ScriptedUI filename");
      System.err.println ("       where filename is the name of the =
script");
      System.exit (1);
    }
    new ScriptedUI (args[0]);
  }
}
----------------- cut here -----------------


This is the JavaScript version:

----------------- cut here (ui.js) -----------------
/* pick up the center panel bean */
p =3D bsf.lookupBean ("centerPanel");       /* get Panel object from the =
BSFRegistry */

/* set the layout manager to border */
p.setLayout (new java.awt.BorderLayout ());

/* add a few things */
p.add ("Center", new java.awt.Label ("Middle from JavaScript"));
p.add ("North", new java.awt.TextField ("north text from JavaScript"));
p.add ("South", new java.awt.TextField ("south text from JavaScript"));
p.add ("East", new java.awt.Button ("inner east from JavaScript"));
p.add ("West", new java.awt.Button ("inner west from JavaScript"));

/* configure p a bit */
p.setBackground (java.awt.Color.red);

/* configure the frame that p is in */
f =3D p.getParent ();
f.setTitle ("Hello from JavaScript (title reset from JavaScript)");
----------------- cut here -----------------


This is the ooRexx-version:

----------------- cut here (ui.rex) -----------------
p =3D .bsf~bsf.lookupBean("centerPanel")  -- reference the entry in BSF =
registry, put there by
                                        -- the Java program =
"ScriptedUI.class"

/* set the layout manager to border */
p~setLayout(.bsf~new("java.awt.BorderLayout"))

/* add a few things */
p~add("Center", .bsf~new("java.awt.Label",     "Middle from Object =
Rexx"))
p~add("North",  .bsf~new("java.awt.TextField", "North text from Object =
Rexx"))
p~add("South",  .bsf~new("java.awt.TextField", "South text from Object =
Rexx"))
p~add("East",   .bsf~new("java.awt.Button",    "Inner east text from =
Object Rexx"))
p~add("West",   .bsf~new("java.awt.Button",    "Inner west text from =
Object Rexx"))

/* configure p a bit */
p~setBackground(.bsf~bsf.getStaticValue("java.awt.Color", "green"))

/* configure the frame that p is in */
f=3Dp~getParent
f~setTitle("Hello from Object REXX (title reset from Object Rexx)")

888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4requires BSF.CLS    -- get Object Rexx wrapper support for BSF
----------------- cut here -----------------


Hope that helps,

---rony


---------------------------------------------------------------------
To unsubscribe, e-mail: richarddavis@example.net
For additional commands, e-mail: richarddavis@example.net





------_=_NextPart_001_01C66DEE.F2312941
Content-Type: text/plain; charset=us-ascii

---------------------------------------------------------------------
To unsubscribe, e-mail: richarddavis@example.net
For additional commands, e-mail: richarddavis@example.net
------_=_NextPart_001_01C66DEE.F2312941--

From bsf-userricharddavis@example.net Wed May 24 20:17:37 2006
Return-Path: <bsf-userricharddavis@example.net>
Delivered-To: richarddavis@example.net
Received: (qmail 74006 invoked from network); 24 May 2006 20:17:37 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155)
  by minotaur.apache.org with SMTP; 24 May 2006 20:17:37 -0000
Received: (qmail 26444 invoked by uid 500); 24 May 2006 20:17:37 -0000
Delivered-To: richarddavis@example.net
Received: (qmail 26276 invoked by uid 500); 24 May 2006 20:17:36 -0000
Mailing-List: contact richarddavis@example.net; run by ezmlm
Precedence: bulk
List-Unsubscribe: <mailto:richarddavis@example.net>
List-Help: <mailto:richarddavis@example.net>
List-Post: <mailto:richarddavis@example.net>
List-Id: "Bean Scripting Framework users" <bsf-user.jakarta.apache.org>
Reply-To: "Bean Scripting Framework users" <richarddavis@example.net>
Delivered-To: mailing list richarddavis@example.net
Received: (qmail 26264 invoked by uid 99); 24 May 2006 20:17:36 -0000
Received: from asf.osuosl.org (HELO asf.osuosl.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 May 2006 13:17:36 -0700
X-ASF-Spam-Status: No, hits=0.0 required=10.0
	tests=HTML_MESSAGE
X-Spam-Check-By: apache.org
Received-SPF: pass (asf.osuosl.org: local policy)
Received: from [83.161.120.155] (HELO mis011-1.exch011.intermedia.net) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 May 2006 13:17:35 -0700
Received: from ehost011-3.exch011.intermedia.net ([83.161.120.155]) by mis011-1.exch011.intermedia.net with Microsoft SMTPSVC817.673.5111);
	 Wed, 24 May 2006 13:15:37 -0700
X-MimeOLE: Produced By Microsoft Exchange V6.5
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: multipart/alternative;
	boundary="----_=_NextPart_001_01C67F6E.D17EF254"
Subject: Can the implicit "bsf" variable be renamed ?
Date: Wed, 24 May 2006 13:15:36 -0700
Message-ID: <richarddavis@example.net>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: Can the implicit "bsf" variable be renamed ?
Thread-Index: AcZ/btFphcTiy19SQ06vU5xvBdhisA==
From: "Dmitry Goldenberg" <richarddavis@example.net>
To: <richarddavis@example.net>
X-OriginalArrivalTime: 24 May 2006 20:15:37.0131 (UTC) FILETIME=[D1E677B0:01C67F6E]
X-Virus-Checked: Checked by ClamAV on apache.org
X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N

------_=_NextPart_001_01C67F6E.D17EF254
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Folks,
=20
Is there any way to rename the implicit 'bsf' variable available to the =
bsf script authors?
=20
Also, is there a summary of all the methods (besides lookupBean) =
available on it?
=20
How does one go about adding new methods on the bsf object - is that =
even an option?
=20
Thanks,
=20
- Dmitry

------_=_NextPart_001_01C67F6E.D17EF254--

From bsf-userricharddavis@example.net Tue May 30 10:19:09 2006
Return-Path: <bsf-userricharddavis@example.net>
Delivered-To: richarddavis@example.net
Received: (qmail 40319 invoked from network); 30 May 2006 10:19:09 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155)
  by minotaur.apache.org with SMTP; 30 May 2006 10:19:09 -0000
Received: (qmail 92331 invoked by uid 500); 30 May 2006 10:19:05 -0000
Delivered-To: richarddavis@example.net
Received: (qmail 92270 invoked by uid 500); 30 May 2006 10:19:05 -0000
Mailing-List: contact richarddavis@example.net; run by ezmlm
Precedence: bulk
List-Unsubscribe: <mailto:richarddavis@example.net>
List-Help: <mailto:richarddavis@example.net>
List-Post: <mailto:richarddavis@example.net>
List-Id: "Bean Scripting Framework users" <bsf-user.jakarta.apache.org>
Reply-To: "Bean Scripting Framework users" <richarddavis@example.net>
Delivered-To: mailing list richarddavis@example.net
Received: (qmail 92227 invoked by uid 99); 30 May 2006 10:19:04 -0000
Received: from asf.osuosl.org (HELO asf.osuosl.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 May 2006 03:19:04 -0700
X-ASF-Spam-Status: No, hits=0.0 required=10.0
	tests=
X-Spam-Check-By: apache.org
Received-SPF: pass (asf.osuosl.org: local policy)
Received: from [83.161.120.155] (HELO sslmail2.wu-wien.ac.at) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 May 2006 03:19:04 -0700
Received: from [83.161.120.155] (abt-wi-027.wu-wien.ac.at [83.161.120.155])
	(authenticated bits=0)
	by sslmail2.wu-wien.ac.at (8.13.3/8.13.1) with ESMTP id k4UAIbRG035846
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT)
	for <richarddavis@example.net>; Tue, 30 May 2006 12:18:37 +0200 (CEST)
	(envelope-from richarddavis@example.net)
Message-ID: <richarddavis@example.net>
Date: Tue, 30 May 2006 12:18:35 +0200
From: "Rony G. Flatscher" <richarddavis@example.net>
User-Agent: Thunderbird 83.161.120.155 (Windows/20060308)
MIME-Version: 1.0
To: Bean Scripting Framework users <richarddavis@example.net>
Subject: Re: Can the implicit "bsf" variable be renamed ?
References: <richarddavis@example.net>
In-Reply-To: <richarddavis@example.net>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-WU-wumi-status: clean v4.4.00/v4772 sslmail2 world 0449f86140a894c0199f4af5cd3013f4
X-Virus-Checked: Checked by ClamAV on apache.org
X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N

Hi Dimitry,
> Is there any way to rename the implicit 'bsf' variable available to the bsf script authors?
>   
Yes. What language? If JavaScript, then lookup 
org.apache.bsf.engines.javascript.initialize(...) ...
>  Also, is there a summary of all the methods (besides lookupBean) available on it?
>   
What do you mean by that (you should have all the BSFEngine methods 
available)?
>  How does one go about adding new methods on the bsf object - is that even an option?
>   
What would you like to achieve?

In principle: you can add whatever you wish. Just extend the current 
implementation of the scripting engine you use and add addtional methods 
there. You need to look up the source code of "your" BSF engine to learn 
about it.

Hope that helps,

---rony



---------------------------------------------------------------------
To unsubscribe, e-mail: richarddavis@example.net
For additional commands, e-mail: richarddavis@example.net



{'source': 'Apache Software Foundation Public Mail Archives'}