|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.byteman.rule.Rule
public class Rule
A rule ties together an event, condition and action. It also maintains a TypeGroup identifying type information derived from these components.
Field Summary | |
---|---|
private java.util.List<java.lang.reflect.Field> |
accessibleFields
a list of field objects used by compiled code to enable rule code to access non-public fields |
private java.util.List<java.lang.reflect.Method> |
accessibleMethods
a list of method objects used by compiled code to enable rule code to access non-public methods |
private Action |
action
the parsed condition derived from the script for this rule |
private Bindings |
bindings
the set of bindings derived from the event supplemented, post type checking, with bindings derived from the trigger method. |
private boolean |
checked
flag set to true only after the rule has been type checked |
private boolean |
checkFailed
flag set to true only after the rule has been type checked successfully |
private Condition |
condition
the parsed condition derived from the script for this rule |
private static boolean |
debugParse
flag true if debugging of rule parsing is desired and false if it should not be performed |
private Event |
event
the parsed event derived from the script for this rule |
private java.lang.Class |
helperClass
a helper class which defines the builtin methods available to this rule -- by default Helper |
private java.lang.Class |
helperImplementationClass
an extension of the helper class which implements the methods of interface RuleHelper -- by default InterpretedHelper. |
private HelperManager |
helperManager
lifecycle event manager for rule helpers |
private java.lang.String |
key
the key under which this rule is indexed in the rule key map. |
private java.lang.ClassLoader |
loader
the class loader for the target class |
private java.lang.String |
name
the name of this rule supplied in the rule script |
private static int |
nextId
a counter used to ensure rule identifiers are unique |
private Type |
returnType
return type of the rule's trigger method |
private static java.util.HashMap<java.lang.String,Rule> |
ruleKeyMap
a hash map used to identify rules from their keys |
private RuleScript |
ruleScript
the script defining this rule |
private int |
triggerAccess
the access mode for the target method defined using flag bits defined in the asm Opcodes class. |
private java.lang.String |
triggerClass
the fully qualified name of the class to which this rule has been attached by the code transformation package. |
private java.lang.String |
triggerDescriptor
the descriptor of the trigger method in which a trigger call for this rule has been inserted by the code transformation package. |
private java.lang.String[] |
triggerExceptions
the name sof all the exceptions declared by the trigger method in which a trigger call for this rule has been inserted by the code transformation package. |
private java.lang.String |
triggerMethod
the name of the trigger method in which a trigger call for this rule has been inserted by the code transformation package, not including the descriptor component. |
private TypeGroup |
typeGroup
the set of types employed by the rule, inlcuding types referenced by abbreviated name (without mentioning the package), array type sand/or their base types and standard builtin types. |
Constructor Summary | |
---|---|
private |
Rule(RuleScript ruleScript,
java.lang.ClassLoader loader,
HelperManager helperManager)
|
Method Summary | |
---|---|
int |
addAccessibleField(java.lang.reflect.Field field)
|
int |
addAccessibleMethod(java.lang.reflect.Method method)
|
void |
compile()
install helper class used to execute this rule. |
private static boolean |
compileRules()
|
static Rule |
create(RuleScript ruleScript,
java.lang.ClassLoader loader,
HelperManager helperManager)
|
static boolean |
disableTriggers()
disable triggering of rules inside the current thread. |
static boolean |
disableTriggersInternal()
disable triggering of rules inside the current thread. |
static boolean |
enableTriggers()
enable triggering of rules inside the current thread. |
static boolean |
enableTriggersInternal()
enable triggering of rules inside the current thread n.b. |
private boolean |
ensureTypeCheckedCompiled()
typecheck and then compile this rule unless either action has been tried before |
private void |
execute(java.lang.Object recipient,
java.lang.Object[] args)
forward an execute request to a helper instance associated with the rule |
static void |
execute(java.lang.String key,
java.lang.Object recipient,
java.lang.Object[] args)
forward an execute request a rule identified by its unique key |
java.lang.Object |
getAccessibleField(java.lang.Object owner,
int fieldIndex)
|
Action |
getAction()
|
Bindings |
getBindings()
|
Condition |
getCondition()
|
Event |
getEvent()
|
java.lang.String |
getFile()
retrieve the name of the file containing this rule |
java.lang.Class |
getHelperClass()
a getter allowing the helper class for the rule to be identified |
java.lang.String |
getKey()
called when a trigger is compiled for the rule to provide a String key which can be used at execution time to obtain a handle on the rule instance |
int |
getLine()
retrieve the start line for the rule |
java.lang.ClassLoader |
getLoader()
get the class loader of the target class for the rule |
java.lang.String |
getName()
|
Type |
getReturnType()
|
java.lang.String |
getTargetClass()
|
Location |
getTargetLocation()
|
java.lang.String |
getTargetMethod()
|
java.lang.String |
getTriggerClass()
|
java.lang.String |
getTriggerDescriptor()
|
java.lang.String |
getTriggerMethod()
|
TypeGroup |
getTypeGroup()
|
private void |
installed()
method called when the rule has been successfully injected into a class, type checked and compiled. |
private void |
installParameters(boolean isStatic,
java.lang.String className)
|
java.lang.Object |
invokeAccessibleMethod(java.lang.Object target,
java.lang.Object[] args,
int methodIndex)
|
boolean |
isChecked()
has this rule been typechecked and/or compiled |
boolean |
isCheckedOk()
has this rule been typechecked and compiled without error. |
boolean |
isCheckFailed()
has this rule failed to typecheck or compile |
private boolean |
isCompileToBytecode()
should rules be compiled to bytecode |
boolean |
isInterface()
|
boolean |
isOverride()
|
static boolean |
isTriggeringEnabled()
check if triggering of rules is enabled inside the current thread |
java.lang.String |
lookupKey()
return the key under which this rule has been indexed in the rule key map |
private static int |
nextId()
a method to return the next available counter for use in constructing a key for the rule |
void |
purge()
delete any reference to the rule from the rule map |
void |
setAccessibleField(java.lang.Object owner,
java.lang.Object value,
int fieldIndex)
|
void |
setAction(java.lang.String actionSpec)
|
void |
setCondition(java.lang.String conditionSpec)
|
void |
setEvent(java.lang.String eventSpec)
|
void |
setTypeInfo(java.lang.String className,
int access,
java.lang.String methodName,
java.lang.String desc,
java.lang.String[] exceptions)
|
java.lang.String |
toString()
generate a string representation of the rule |
void |
typeCheck()
type check this rule |
private void |
uninstalled()
method called when the rule has been uninstalled after previously being successfully injected into a class, type checked and compiled. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private RuleScript ruleScript
private java.lang.String name
private java.lang.ClassLoader loader
private Event event
private Condition condition
private Action action
private Bindings bindings
private java.lang.String triggerClass
private java.lang.String triggerMethod
private java.lang.String triggerDescriptor
private java.lang.String[] triggerExceptions
private int triggerAccess
private TypeGroup typeGroup
private boolean checked
private boolean checkFailed
private Type returnType
private java.lang.String key
private HelperManager helperManager
private java.util.List<java.lang.reflect.Field> accessibleFields
private java.util.List<java.lang.reflect.Method> accessibleMethods
private static java.util.HashMap<java.lang.String,Rule> ruleKeyMap
private static int nextId
private java.lang.Class helperClass
private java.lang.Class helperImplementationClass
private static boolean debugParse
Constructor Detail |
---|
private Rule(RuleScript ruleScript, java.lang.ClassLoader loader, HelperManager helperManager) throws ParseException, TypeException, CompileException
ParseException
TypeException
CompileException
Method Detail |
---|
public TypeGroup getTypeGroup()
public Bindings getBindings()
public java.lang.String getName()
public java.lang.String getTargetClass()
public java.lang.String getTargetMethod()
public Location getTargetLocation()
public boolean isOverride()
public boolean isInterface()
public int getLine()
public java.lang.String getFile()
public Event getEvent()
public Condition getCondition()
public Action getAction()
public java.lang.String getTriggerClass()
public java.lang.String getTriggerMethod()
public java.lang.String getTriggerDescriptor()
public Type getReturnType()
public java.lang.ClassLoader getLoader()
public static Rule create(RuleScript ruleScript, java.lang.ClassLoader loader, HelperManager helperManager) throws ParseException, TypeException, CompileException
ParseException
TypeException
CompileException
public void setEvent(java.lang.String eventSpec) throws ParseException, TypeException
ParseException
TypeException
public void setCondition(java.lang.String conditionSpec) throws ParseException, TypeException
ParseException
TypeException
public void setAction(java.lang.String actionSpec) throws ParseException, TypeException
ParseException
TypeException
public void setTypeInfo(java.lang.String className, int access, java.lang.String methodName, java.lang.String desc, java.lang.String[] exceptions)
public boolean isChecked()
public boolean isCheckFailed()
public boolean isCheckedOk()
public static boolean disableTriggersInternal()
public static boolean enableTriggersInternal()
public static boolean disableTriggers()
public static boolean enableTriggers()
public static boolean isTriggeringEnabled()
private boolean ensureTypeCheckedCompiled()
public void typeCheck() throws TypeException
TypeException
- if the ruele contains type errorspublic void compile() throws CompileException
CompileException
- if the rule cannot be compiledprivate boolean isCompileToBytecode()
private void installParameters(boolean isStatic, java.lang.String className) throws TypeException
TypeException
public static void execute(java.lang.String key, java.lang.Object recipient, java.lang.Object[] args) throws ExecuteException
key
- a string key identifying the rule instance to be firedrecipient
- the recipient of the method from which execution of the rule was
triggered or null if it was a static methodargs
- the arguments of the method from which execution of the rule was
triggered
ExecuteException
private void execute(java.lang.Object recipient, java.lang.Object[] args) throws ExecuteException
recipient
- the recipient of the method from which execution of this rule was
triggered or null if it was a static methodargs
- the arguments of the method from which execution of this rule was
triggered
ExecuteException
public java.lang.String getKey()
public java.lang.String lookupKey()
public void purge()
private static int nextId()
private static boolean compileRules()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.Class getHelperClass()
private void installed()
private void uninstalled()
public int addAccessibleField(java.lang.reflect.Field field)
public int addAccessibleMethod(java.lang.reflect.Method method)
public java.lang.Object getAccessibleField(java.lang.Object owner, int fieldIndex) throws ExecuteException
ExecuteException
public void setAccessibleField(java.lang.Object owner, java.lang.Object value, int fieldIndex) throws ExecuteException
ExecuteException
public java.lang.Object invokeAccessibleMethod(java.lang.Object target, java.lang.Object[] args, int methodIndex)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |