jakarta-bsf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Winga...@schneider.com
Subject Re: NetRexx 2.x / BSF2.3 issue getting "current" BSFManager instance...
Date Tue, 14 Jan 2003 18:33:53 GMT

Dankeschon!!!!!!

Sorry for being so thick; I was having code-caching problems
earlier:   Changes to my little hello.nrx were not being recognized,
so I'd gotten into the habit of compiling .nrx changes using NetRexxC.
(This actually exacerbated my problem, because now when using
a "script" parm like "rules.CheckForDuplicates()" I may actually be
getting to this thru the default classLoader, NOT BSF!!!!)

It did not occur to me that compilation using the DOS shell harness
would be quite a different process than the BSF framework which obviously
(in retrospect)  must wrap some code around it before it translates the
script.
I did get your example to work quite easily w/ this tip, which led me to
fixing
my own scripts.

I do have two remaining questions though, if your patience hasn't worn too
thin:

Q1: In order to get my stuff to work, I more or less had to follow your
example, in which
       the source and script/expr args to the exec/eval methods on
BSFManager contain
       exactly the same text.  In fact, I can pass any "foo.bar" type
string as source, and
       whether there is a foo.bar file or not the method will succeed /
fail just the
       same.   Am I missing something?  What I'd hoped to be able to do was
something
       like:

      bsfManager.exec("netrexx", "aWholeLibraryOfRexxCode.nrx", 0, 0,
"aSingleMethod");

      Or perhaps:

      bsfManager.exec("netrexx", "aWholeLibraryOfRexxCode.nrx",
startOfMethod, endOfMethod, "aSingleMethod");

     In reality, it seems like only the first and last arguments actually
do anything????

Q2: Again, in your opinion what are the advantages of ObjectRexx vs.
NetRexx?  Keep in mind that I
     am looking for a scripting language as accessible to business-side
users as possible, so stuff like
     "better support for polymorphism...." is probably not that germane.

TIA, Keith
------------------------------------
W. Keith Wingate
Schneider Logistics
708-647-4346
WingateK@Schneider.com



                                                                                         
                               
                    "Rony G. Flatscher"                                                  
                               
                    <Rony.Flatscher@wu-w       To:     Bean Scripting Framework users <bsf-user@jakarta.apache.org>
     
                    ien.ac.at>                 cc:                                    
                                  
                                               Fax to:                                   
                               
                    01/14/2003 06:03 AM        Subject:     Re: NetRexx 2.x / BSF2.3 issue
getting "current" BSFManager  
                    Please respond to           instance...                              
                               
                    "Bean Scripting                                                      
                               
                    Framework users"                                                     
                               
                                                                                         
                               
                                                                                         
                               




Keith:

>C:\wkw\work\RexxRules\bsf-2.3.0\UIsample>NetRexxC ui.nrx
>
O.K., I see: this cannot work! You are invoking you are trying to
compile the NetRexx program yourself., which leads to this particular
error.

Instead, you must invoke the NetRexx program directly from Java via BSF!
The NetRexx support of BSF should take care of compiling your NetRexx
program and making the object "bsf" available to the NetRexx program!

>NetRexx portable processor, version 2.02
>Copyright (c) IBM Corporation, 2001.  All rights reserved.
>Program ui.nrx
>  6 +++ p = java.awt.Panel bsf.lookupBean("centerPanel");
>    +++                    ^^^
>    +++ Error: The method 'bsf.lookupBean(java.lang.String)' cannot be
>found in
>class 'ui' or a superclass
>Compilation of 'ui.nrx' failed [one error]
>
Yup, the object "bsf" should be brought in by BSF and therefore  be
implicitly available to your NetRexx program.

>This is one of the specific cases of my general problem:  I can't seem to
>get a reference to the "running" BSF environment from within the script,
>and
>any successful attempts to do so (e.g. bsf=BSFManager()) put me at
>cross-purposes with what I'm trying to accomplish.  Am I missing some
>import
>or something?  I don't see how this could be, since the "static" (not in a
>Java
>sense) import would somehow have to reference this dynamic, runtime object
>which represents the thing that gets created in my Java code when I
>instantiate a BSFManager.
>
Well, if you instantiate a BSFManager the next step would be to load a
particular programming language engine, which in turn you would give the
source code of a NetRexx program to be executed.

For this reason, if you wish to run the supplied sample, you first need
to compile the Java program ("ScriptedUI.java", but adapt it to the
Apache package name first!), e.g. "javac ScriptedUI.java" and make sure
that the Apache bsf-package is in the classpath. After that you start
the compiled Java program and give it as an argument the name of that
file which contains the script in source code, hence:

>Enclosed you'll find a little archive with a sample using a
>NetRexx-script. The sample stems from the IBM distribution, so you would
>need to change the "bsf" package name to Apache's. After recompiling the
>Java-file, you should be able to enter the following:
>
>    java ScriptedUI ui.nrx
>
>which then should create an awt-frame on the Java side and let the
>NetRexx script edit that window from NetRexx.
>
Maybe, you give it one more try?

Regards,

---rony




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






Mime
View raw message