org.jboss.byteman.rule.helper
Class InterpretedHelper

java.lang.Object
  extended by org.jboss.byteman.rule.helper.Helper
      extended by 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 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
protected  java.util.HashMap<java.lang.String,java.lang.Object> bindingMap
           
 
Fields inherited from class org.jboss.byteman.rule.helper.Helper
rule
 
Constructor Summary
InterpretedHelper(Rule rule)
           
 
Method Summary
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 rule
protected  void execute0()
          basic implementation of rule execution
private  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, closeTrace, countDown, createCountDown, createCounter, createCounter, createJoin, createRendezvous, createRendezvous, createTimer, deactivated, debug, decrementCounter, delay, deleteCounter, deleteRendezvous, deleteTimer, flag, flagged, formatStack, formatStack, formatStack, formatStack, formatStackBetween, formatStackBetween, formatStackBetween, formatStackBetween, formatStackBetween, formatStackBetween, formatStackBetweenMatches, formatStackBetweenMatches, formatStackBetweenMatches, formatStackBetweenMatches, formatStackBetweenMatches, formatStackBetweenMatches, formatStackMatching, formatStackMatching, formatStackMatching, formatStackMatching, formatStackMatching, formatStackMatching, formatStackRange, getCountDown, getElapsedTimeFromTimer, getRendezvous, getStack, incrementCounter, incrementCounter, installed, isCountDown, isJoin, isRendezvous, joinEnlist, joinWait, killJVM, killJVM, killThread, matchIndex, openTrace, openTrace, printFrame, printlnFrame, readCounter, readCounter, rendezvous, resetTimer, setTriggering, signalKill, signalKill, signalThrow, signalThrow, signalWake, signalWake, toString, trace, trace, 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, triggerIndex, uninstalled, waitFor, waitFor, waiting
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

bindingMap

protected java.util.HashMap<java.lang.String,java.lang.Object> bindingMap
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 interface HelperAdapter
Parameters:
recipient -
args -
Throws:
ExecuteException

execute0

protected void execute0()
                 throws ExecuteException
basic implementation of rule execution

Throws:
ExecuteException

setBinding

public void setBinding(java.lang.String name,
                       java.lang.Object value)
Specified by:
setBinding in interface HelperAdapter

getBinding

public java.lang.Object getBinding(java.lang.String name)
Specified by:
getBinding in interface HelperAdapter

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 interface HelperAdapter

getAccessibleField

public java.lang.Object getAccessibleField(java.lang.Object owner,
                                           int fieldIndex)
Specified by:
getAccessibleField in interface HelperAdapter

setAccessibleField

public void setAccessibleField(java.lang.Object owner,
                               java.lang.Object value,
                               int fieldIndex)
Specified by:
setAccessibleField in interface HelperAdapter

invokeAccessibleMethod

public java.lang.Object invokeAccessibleMethod(java.lang.Object target,
                                               java.lang.Object[] args,
                                               int methodIndex)
Specified by:
invokeAccessibleMethod in interface HelperAdapter