|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.bsf.util.BSFEngineImpl | +--com.ibm.bsf.engines.rexx.RexxEngine
This class manages the calls from Java via JNI to Rexx or Object Rexx using the RexxSAA interface.
RexxEngine.java - this class makes (Object) Rexx available to IBM's BeanScriptingFramework (BSF) Copyright (C) 2001, 2002, 2003 Rony G. Flatscher This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The following URL may be available for further information: http://www.gnu.org/copyleft/lesser.html
Field Summary | |
private java.lang.String |
lastScriptCode
Stores the script code supplied with eval(), exec(), apply(), in order to be able to locate the code in call(). |
private com.ibm.bsf.engines.rexx.RexxAndJava |
rexxInterface
Allows using the Rexx interpreter from Java. |
Fields inherited from class com.ibm.bsf.util.BSFEngineImpl |
classLoader, classPath, debug, debugStream, declaredBeans, lang, mgr, tempDir |
Constructor Summary | |
RexxEngine()
|
Method Summary | |
java.lang.Object |
apply(java.lang.String source,
int lineNo,
int columnNo,
java.lang.Object oscript,
java.util.Vector vArgNames,
java.util.Vector vArgs)
Applies (evaluates) a piece of Rexx code (can be a whole program as well) with Java-supplied arguments and returns the result. |
private java.lang.Object[] |
args2RexxString(java.lang.Object o)
Turns received object either into a String, if object is a primitive type or a Java wrapper class for primitive types. |
java.lang.Object |
call(java.lang.Object object,
java.lang.String name,
java.lang.Object[] args)
Deprecated. " This call(...) method may be enhanced in the future, once an openly
defined and available interface to the OO-part of Object Rexx is made
available by IBM. Then the argument "object " would denote
an Object Rexx object, the argument "name " the name of one of its methods
and the argument "args " the arguments for the method.
If possible at all, use method apply(...)
instead. |
java.lang.Object |
eval(java.lang.String source,
int lineNo,
int columnNo,
java.lang.Object oscript)
Evaluates (executes) a piece of Rexx code (can be a whole program as well) without any Java-supplied arguments and returns the result. |
protected com.ibm.bsf.engines.rexx.RexxAndJava |
getRexxInterface()
|
void |
initialize(com.ibm.bsf.BSFManager mgr,
java.lang.String lang,
java.util.Vector declaredBeans)
Initializes the Rexx engine and causes the external functions 'BSF' and 'BSFPollEvents' to be registered with the Rexx interpreter. |
Methods inherited from class com.ibm.bsf.util.BSFEngineImpl |
compileApply, compileExpr, compileScript, declareBean, exec, propertyChange, setDebug, terminate, undeclareBean |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private com.ibm.bsf.engines.rexx.RexxAndJava rexxInterface
private java.lang.String lastScriptCode
Constructor Detail |
public RexxEngine()
Method Detail |
protected com.ibm.bsf.engines.rexx.RexxAndJava getRexxInterface()
public void initialize(com.ibm.bsf.BSFManager mgr, java.lang.String lang, java.util.Vector declaredBeans) throws com.ibm.bsf.BSFException
initialize
in interface com.ibm.bsf.BSFEngine
initialize
in class com.ibm.bsf.util.BSFEngineImpl
com.ibm.bsf.BSFException
public java.lang.Object eval(java.lang.String source, int lineNo, int columnNo, java.lang.Object oscript) throws com.ibm.bsf.BSFException
eval
in interface com.ibm.bsf.BSFEngine
eval
in class com.ibm.bsf.util.BSFEngineImpl
source
- if set to RexxAndJava.EVENT_TEXT
,
then oscript
is put into the event queue
to be polled by Rexx. If this text starts with the
string "/*2*/"
it is
put into the alarm (highest dispatch) level vector, if it starts with the
string "/*0*/"
it is
put into the batch (lowest dispatch) level vector,
else it is put into the normal level vector.lineNo
- not used.columnNo
- not used.oscript
- the String version of this object [using toString()]
represents the Rexx code to be executed.
Its statements are delimited with a ';' or a
CR (carriage-return) and/or LF (line-feed).
null
.
com.ibm.bsf.BSFException
public java.lang.Object call(java.lang.Object object, java.lang.String name, java.lang.Object[] args) throws com.ibm.bsf.BSFException
call(...)
method may be enhanced in the future, once an openly
defined and available interface to the OO-part of Object Rexx is made
available by IBM. Then the argument "object
" would denote
an Object Rexx object, the argument "name
" the name of one of its methods
and the argument "args
" the arguments for the method.
apply(...)
instead.
[Hint: This follows after learning how Xalan is employing BSF: it first calls "exec()" and then "call()", hence "call()" does not receive the source to be executed.]
call
in interface com.ibm.bsf.BSFEngine
call
in class com.ibm.bsf.util.BSFEngineImpl
object
- not used.name
- not used.args
- arguments to be passed to Rexx.
null
.
com.ibm.bsf.BSFException
public java.lang.Object apply(java.lang.String source, int lineNo, int columnNo, java.lang.Object oscript, java.util.Vector vArgNames, java.util.Vector vArgs) throws com.ibm.bsf.BSFException
apply
in interface com.ibm.bsf.BSFEngine
apply
in class com.ibm.bsf.util.BSFEngineImpl
source
- not used.lineNo
- not used.columnNo
- not used.oscript
- the String version of this object [using toString()]
represents the Rexx code to be executed.
Its statements are delimited with a ';' or a
an LF (line-feed, "0x0a"), preceeded by an
optional CR (carriage-return, "0x0d").vArgNames
- not used.vArgs
- arguments to be passed to Rexx.
null
.
com.ibm.bsf.BSFException
private java.lang.Object[] args2RexxString(java.lang.Object o)
null
will get returned as null, hence no String
representation is returned instead; this way the Rexx ARG()
function can be used to determine, if such an argument was omitted or not.
(2003-01-06, ---rgf).
- Parameters:
o
- object to be turned into a String or a Bean.
- Returns:
- a two-dimensional array of Object. The element with index 0 indicates whether
a Bean had to be created (
Boolean.TRUE
or Boolean.FALSE
),
the second element with index 1 represents the object as a String or null
if the received object is null
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |