Package org.jboss.byteman.rule.helper
Class InterpretedHelper
- java.lang.Object
-
- org.jboss.byteman.rule.helper.Helper
-
- org.jboss.byteman.rule.helper.InterpretedHelper
-
- All Implemented Interfaces:
HelperAdapter
public class InterpretedHelper extends Helper implements HelperAdapter
Implementation of RuleHelper which extends the functionality of the standard helper class, Helper, by adding the methods required to implement interface RuleHelper. It provides an implementation which executes rules by interpreting the rule tree. Any rule which employs the standard helper type checks built in method calls against class Helper. However, the interpreter assumes that the helper object implements InterpretedHelper. When a rule is compiled class Helper is extended with a generated class CompiledHelper<NNN> which also implements interface RuleHelper. The implementation of the execute method is generated by translating the parse tree to bytecode. Builtin calls are translated to calls of methods defined by class Helper. A rule can also specify its own helper class in order to provide its own set of builtin operations. The helper class does not implement interface RuleHelper. Instead the compilation process will generate a subclass of the user-defined helper class which provides an appropriate implementation for the RuleHelper methods, including an implementation of the execute method dreived from the rule parse tree. As in the default case, builtin calls are translated to calls of methods defined by the helper class.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.HashMap<java.lang.String,java.lang.Object>
bindingMap
-
Constructor Summary
Constructors Constructor Description InterpretedHelper(Rule rule)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
bind()
void
execute(java.lang.Object recipient, java.lang.Object[] args)
install values into the bindings map and then call the execute0 method to actually execute the ruleprotected void
execute0()
basic implementation of rule executionprivate void
fire()
java.lang.Object
getAccessibleField(java.lang.Object owner, int fieldIndex)
java.lang.Object
getBinding(java.lang.String name)
java.lang.String
getName()
java.lang.Object
invokeAccessibleMethod(java.lang.Object target, java.lang.Object[] args, int methodIndex)
void
setAccessibleField(java.lang.Object owner, java.lang.Object value, int fieldIndex)
void
setBinding(java.lang.String name, java.lang.Object value)
private boolean
test()
-
Methods inherited from class org.jboss.byteman.rule.helper.Helper
activated, addCountDown, callerCheck, callerEquals, callerEquals, callerEquals, callerEquals, callerEquals, callerEquals, callerEquals, callerEquals, callerEquals, callerMatches, callerMatches, callerMatches, callerMatches, callerMatches, callerMatches, callerMatches, callerMatches, callerMatches, clear, clearLinks, clearLinks, closeTrace, countDown, createCountDown, createCounter, createCounter, createJoin, createLinkMap, createRendezvous, createRendezvous, createTimer, deactivated, debug, decrementCounter, delay, deleteCounter, deleteLinkMap, deleteRendezvous, deleteTimer, err, errTraceException, flag, flagged, formatAllStacks, formatAllStacks, formatAllStacks, formatAllStacks, formatStack, formatStack, formatStack, formatStack, formatStackBetween, formatStackBetween, formatStackBetween, formatStackBetween, formatStackBetween, formatStackBetween, formatStackBetweenMatches, formatStackBetweenMatches, formatStackBetweenMatches, formatStackBetweenMatches, formatStackBetweenMatches, formatStackBetweenMatches, formatStackMatching, formatStackMatching, formatStackMatching, formatStackMatching, formatStackMatching, formatStackMatching, formatStackRange, formatThreadStack, formatThreadStack, formatThreadStack, formatThreadStack, getCountDown, getElapsedTimeFromTimer, getObjectSize, getRendezvous, getStack, incrementCounter, incrementCounter, installed, isCountDown, isJoin, isRendezvous, joinEnlist, joinWait, joinWait, killJVM, killJVM, killThread, link, link, linked, linked, linkNames, linkNames, linkValues, linkValues, matchIndex, noisy, noisyTraceException, openTrace, openTrace, out, outTraceException, printFrame, printlnFrame, readCounter, readCounter, rendezvous, rendezvous, resetTimer, setTriggering, signalKill, signalKill, signalThrow, signalThrow, signalWake, signalWake, toString, trace, trace, traceAllStacks, traceAllStacks, traceAllStacks, traceAllStacks, traceAllStacks, traceAllStacks, traceClose, traceln, traceln, traceOpen, traceOpen, traceStack, traceStack, traceStack, traceStack, traceStack, traceStack, traceStackBetween, traceStackBetween, traceStackBetween, traceStackBetween, traceStackBetween, traceStackBetween, traceStackBetween, traceStackBetween, traceStackBetween, traceStackBetweenMatches, traceStackBetweenMatches, traceStackBetweenMatches, traceStackBetweenMatches, traceStackBetweenMatches, traceStackBetweenMatches, traceStackBetweenMatches, traceStackBetweenMatches, traceStackBetweenMatches, traceStackMatching, traceStackMatching, traceStackMatching, traceStackMatching, traceStackMatching, traceStackMatching, traceStackMatching, traceStackMatching, traceStackMatching, traceStackRange, traceThreadStack, traceThreadStack, traceThreadStack, traceThreadStack, traceThreadStack, traceThreadStack, triggerIndex, uninstalled, unlink, unlink, verbose, verboseTraceException, waitFor, waitFor, waiting
-
-
-
-
Constructor Detail
-
InterpretedHelper
public InterpretedHelper(Rule rule)
-
-
Method Detail
-
execute
public void execute(java.lang.Object recipient, java.lang.Object[] args) throws ExecuteException
install values into the bindings map and then call the execute0 method to actually execute the rule- Specified by:
execute
in interfaceHelperAdapter
- Parameters:
recipient
- target of trigger method or null if it is staticargs
- array to pass current values and return new values for data local to the trigger method- Throws:
ExecuteException
-
execute0
protected void execute0() throws ExecuteException
basic implementation of rule execution- Throws:
ExecuteException
- if an exception occurs during execution of the rule
-
setBinding
public void setBinding(java.lang.String name, java.lang.Object value)
- Specified by:
setBinding
in interfaceHelperAdapter
-
getBinding
public java.lang.Object getBinding(java.lang.String name)
- Specified by:
getBinding
in interfaceHelperAdapter
-
bind
private void bind() throws ExecuteException
- Throws:
ExecuteException
-
test
private boolean test() throws ExecuteException
- Throws:
ExecuteException
-
fire
private void fire() throws ExecuteException
- Throws:
ExecuteException
-
getName
public java.lang.String getName()
- Specified by:
getName
in interfaceHelperAdapter
-
getAccessibleField
public java.lang.Object getAccessibleField(java.lang.Object owner, int fieldIndex)
- Specified by:
getAccessibleField
in interfaceHelperAdapter
-
setAccessibleField
public void setAccessibleField(java.lang.Object owner, java.lang.Object value, int fieldIndex)
- Specified by:
setAccessibleField
in interfaceHelperAdapter
-
invokeAccessibleMethod
public java.lang.Object invokeAccessibleMethod(java.lang.Object target, java.lang.Object[] args, int methodIndex)
- Specified by:
invokeAccessibleMethod
in interfaceHelperAdapter
-
-