|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jpos.transaction.participant.BSHMethod
public class BSHMethod
This is a utility class that makes it a bit easier to work with beanshell scripts. Check out the execute methods.
| Constructor Summary | |
|---|---|
BSHMethod(String bshData,
boolean source)
Creates a BSHMethod. |
|
| Method Summary | |
|---|---|
static BSHMethod |
createBshMethod(org.jdom.Element e)
Creates a BSHMethod from a JDom Element. |
Map |
execute(Map arguments,
Collection returnNames)
Sets the given arguments to the Interpreter, evaluates the script and returns a map that has the Strings of the returnNames collection as keys and the objects stored in the variables thus named as values. |
Object |
execute(Map arguments,
String resultName)
Sets the given arguments to the Interpreter, evaluates the script and returns the object stored on the variable named resultName. |
protected bsh.Interpreter |
initInterpreter(Map arguments)
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public BSHMethod(String bshData,
boolean source)
bshData - - May either be the file to source or the script itself to
evaluate.source - - If true indicates that the bshData passed is a file to
source. Otherwise the string itself is evaluated.| Method Detail |
|---|
public static BSHMethod createBshMethod(org.jdom.Element e)
throws FileNotFoundException,
IOException
Example 1 :
<prepare>
import org.jpos.iso.*;
import org.jpos.transaction.*;
msg = context.get("txnRequest");
BaseChannel.getChannel("loop-channel").send(msg);
result=TransactionConstants.PREPARED | TransactionConstants.READONLY;
</prepare>
Example 2 :
<routing file='cfg\files\routing1.bsh' cache='false'/>
FileNotFoundException
IOException
public Object execute(Map arguments,
String resultName)
throws bsh.EvalError,
FileNotFoundException,
IOException
arguments - Parameters to set to the Interpreter. For every
Map.Entry (key, value), interpreter.set(key, value)
is called. All keys must be Strings.returnName - The names of the variables wich`s content is to be
returned.
bsh.EvalError
FileNotFoundException
IOException
public Map execute(Map arguments,
Collection returnNames)
throws bsh.EvalError,
FileNotFoundException,
IOException
arguments - Parameters to set to the Interpreter. For every
Map.Entry (key, value), interpreter.set(key, value)
is called. All keys must be Strings.returnNames - Collection of Strings. The names of the variables
wich`s contents are to be returned.
bsh.EvalError
FileNotFoundException
IOException
protected bsh.Interpreter initInterpreter(Map arguments)
throws bsh.EvalError,
FileNotFoundException,
IOException
bsh.EvalError
FileNotFoundException
IOExceptionpublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||