public class RuleScript
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private boolean |
deleted
this is set to true if the rule is dynamically deleted or updated so as to inhibit execution of
trigger code between the delete/update and recompilation/reinstatement of the affected bytecode.
|
private java.lang.String |
file
the name of the file from which the rule has been loaded, if defined, or some suitable dummy string if it
was noti obtained from a file
|
private boolean |
isInterface
true if the target is an interface or false if the target is a class, in the former case the
rule should be injected into methods of classes which implement the interface.
|
private boolean |
isOverride
true if the rule should be injected into overriding implementations of the target method false
if it should only be injected into the implementation defined by the target class or, in the
case of an interface rule, by the class directly implementing the target interface
|
private int |
line
the line number at which the rule text starts
|
private java.lang.String |
name
the name of the rule from which this scritp is derived
|
private java.lang.String |
ruleText
the text of the rule's BIND IF and DO clauses which are parsed using a grammar based parser
|
private java.lang.String |
targetClass
the name supplied in the CLASS or INTERFACE clause of the rule identifying which class(es)
triggers should be injected into
|
private java.lang.String |
targetHelper
the name of a class whose public instance methods define the built-in methods available for use
in the rule body
|
private Location |
targetLocation
identifies the location in the method if the trigger point at which the rule code should be injected.
|
private java.lang.String |
targetMethod
the name of the method of the target class or interface into which the rule should be injected
|
private java.util.List<Transform> |
transformed
a list of records identifying contexts in which the rule has been applied.
|
Constructor and Description |
---|
RuleScript(java.lang.String name,
java.lang.String targetClass,
boolean isInterface,
boolean isOverride,
java.lang.String targetMethod,
java.lang.String targetHelper,
Location targetLocation,
java.lang.String ruleText,
int line,
java.lang.String file)
standard constructor for a rule
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getFile() |
int |
getLine() |
java.lang.String |
getName() |
java.lang.String |
getRuleText() |
java.lang.String |
getTargetClass() |
java.lang.String |
getTargetHelper() |
Location |
getTargetLocation() |
java.lang.String |
getTargetMethod() |
java.util.List<Transform> |
getTransformed()
getter for list of transforms applied for this script.
|
int |
getTransformedCount()
return a count of the number of transforms applied for this script.
|
boolean |
hasTransform(java.lang.Class<?> clazz)
check whether a rule has been used to transform a specific class.
|
boolean |
isDeleted()
called when indexing a script to ensure that it has not already been deleted.
|
boolean |
isInterface() |
boolean |
isOverride() |
void |
purge()
uninstall any rules associated with this script.
|
void |
recordCompile(java.lang.String triggerClass,
java.lang.ClassLoader loader,
boolean successful,
java.lang.String detail)
record the fact that a rule has been compiled with or without success
|
boolean |
recordFailedTransform(java.lang.ClassLoader loader,
java.lang.String internalClassName,
java.lang.Throwable th)
record the fact that an error was thrown when attempting to transform a given class using this rule script
|
boolean |
recordMethodTransform(java.lang.ClassLoader loader,
java.lang.String internalClassName,
java.lang.String triggerMethodName,
java.lang.String desc,
Rule rule)
record the fact that a trigger call has been successfully installed into bytecode associated with a specific
class and loader and a corresponding rule instance been installed
|
boolean |
recordTransform(java.lang.ClassLoader loader,
java.lang.String internalClassName,
java.lang.String triggerMethodName,
java.lang.String desc,
Rule rule,
java.lang.Throwable th)
record the fact that a trigger call has failed to install into bytecode associated with a specific
class and loader
|
boolean |
setDeleted()
invoked by the scriptmanager when a rule is redefined to inhibit further transformations via this script
|
java.lang.String |
toString() |
void |
writeTo(java.io.PrintWriter writer) |
private java.lang.String name
private java.lang.String targetClass
private boolean isInterface
private java.lang.String targetMethod
private boolean isOverride
private java.lang.String targetHelper
private Location targetLocation
private java.lang.String ruleText
private boolean deleted
private int line
private java.lang.String file
private java.util.List<Transform> transformed
public RuleScript(java.lang.String name, java.lang.String targetClass, boolean isInterface, boolean isOverride, java.lang.String targetMethod, java.lang.String targetHelper, Location targetLocation, java.lang.String ruleText, int line, java.lang.String file)
name
- targetClass
- isInterface
- isOverride
- targetMethod
- targetHelper
- targetLocation
- ruleText
- line
- file
- public java.lang.String getName()
public java.lang.String getTargetClass()
public boolean isInterface()
public java.lang.String getTargetHelper()
public java.lang.String getTargetMethod()
public boolean isOverride()
public Location getTargetLocation()
public java.lang.String getRuleText()
public int getLine()
public java.lang.String getFile()
public java.util.List<Transform> getTransformed()
public int getTransformedCount()
public boolean setDeleted()
public boolean isDeleted()
public boolean recordFailedTransform(java.lang.ClassLoader loader, java.lang.String internalClassName, java.lang.Throwable th)
loader
- internalClassName
- public boolean recordMethodTransform(java.lang.ClassLoader loader, java.lang.String internalClassName, java.lang.String triggerMethodName, java.lang.String desc, Rule rule)
loader
- internalClassName
- public boolean recordTransform(java.lang.ClassLoader loader, java.lang.String internalClassName, java.lang.String triggerMethodName, java.lang.String desc, Rule rule, java.lang.Throwable th)
loader
- the loader of the class being transformedinternalClassName
- the internal name of the class being transformedth
- throwable generated during the attempt to parse the rule text or inject code at the trigger pointpublic boolean hasTransform(java.lang.Class<?> clazz)
clazz
- the class for which a transform is being sought.public void recordCompile(java.lang.String triggerClass, java.lang.ClassLoader loader, boolean successful, java.lang.String detail)
triggerClass
- the name of the trigger class to which the rule is attachedloader
- the classloader of the trigger classsuccessful
- true if the rule compiled successfully and false if it suffered from parse,
type or compile errorspublic void purge()
public java.lang.String toString()
toString
in class java.lang.Object
public void writeTo(java.io.PrintWriter writer)