|
Buju 0.4 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectbiz.bbeans.buju.BInterpreter
A wrapper for the Java interpreter engine.
| Constructor Summary | |
BInterpreter(String initScript)
Create a private (non-shared) interpreter with the given initial script. |
|
BInterpreter(String initScript,
boolean shared)
Create a shared or private interpreter with the given initial script. |
|
| Method Summary | |
Object |
eval(String line)
Evaluate the line of script. |
Object |
eval(String line,
long timeout)
Evaluate the line of script. |
Interpreter |
getInterpreter()
Get the interpreter engine wrapped by this BInterpreter. |
Map |
getProperties()
Get the properties Map. |
boolean |
isLocked()
Get the locked state of this interpreter. |
boolean |
isShared()
Get the immutable shared state of this interpreter. |
void |
lock(long timeout)
Lock this interpreter. |
void |
pop()
Pop the last-in namespace from the namespace stack and set it on the interpreter. |
void |
push()
Push the current namespace of the interpreter onto the namespace stack, and create and set a new child namespace for the interpreter. |
void |
set(String name,
Object val)
Set the named variable to the given value in the interpreter's current namespace. |
void |
unlock(long timeout)
Unlock this interpreter. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public BInterpreter(String initScript)
throws EvalError
initScript - Initial script for the interpreter to evaluate.
EvalError - If the initial script does not evaluate
properly.
public BInterpreter(String initScript,
boolean shared)
throws EvalError
initScript - Initial script for the interpreter to evaluate.shared - True if shared, false if private. Shared interpreters
check locks before doing an evaluation.
EvalError - If the initial script does not evaluate
properly.| Method Detail |
public Interpreter getInterpreter()
public boolean isShared()
public boolean isLocked()
public void lock(long timeout)
throws InterruptedException
timeout - Time in milleseconds to wait before
interrupting a block due to inability of the thread
to lock the interpreter. A value of zero
will never interrupt a blocked thread, potentially leaving
it blocked forever. Any negative value will interrupt
the blocked thread immediately.
InterruptedException - If the lock is unavailable
longer than the specified timeout period.
public void unlock(long timeout)
throws InterruptedException
timeout - Time in milleseconds to wait before
interrupting a block due to inability of the thread
to lock the interpreter. A value of zero
will never interrupt the thread, potentially leaving
it blocked forever. Any negative value will interrupt
the blocked thread immediately.
InterruptedException - If the lock is unavailable
longer than the specified timeout period.
public Object eval(String line)
throws EvalError,
InterruptedException
line - Line of script.
EvalError - If the script has an evaluation problem.
InterruptedException - If this interpreter is locked
by another thread.
public Object eval(String line,
long timeout)
throws EvalError,
InterruptedException
line - Line of script.timeout - Time in milleseconds to wait before
interrupting a block due to inability of the thread
lock the interpreter. A value of zero
will never interrupt the thread, potentially leaving
it blocked forever. Any negative value will interrupt
the blocked thread immediately.
InterruptedException - If the lock is unavailable
longer than the specified timeout period.
EvalError - If the script has an evaluation problem.
InterruptedException - If the timeout expires before
the thread can lock the interpreter.
public void set(String name,
Object val)
throws EvalError,
IllegalStateException
name - Name of the variable.val - Value of the variable.
EvalError - If the evaluation has a problem.
IllegalStateException - If the interpreter is shared.public Map getProperties()
public void push()
public void pop()
|
Buju 0.4 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||