|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface EventSpecification
Defines the interface to be implemented by classes which supply a
specification of events to be produced by a
SemanticEventDispatcher
.
Nested Class Summary | |
---|---|
static class |
EventSpecification.CallType
Type-safe enumeration for the invoke instructions. |
static class |
EventSpecification.FieldType
Type-safe enumeration for the field related instructions. |
static class |
EventSpecification.MethodAction
Type-safe enumeration for the method entry and exit events. |
static class |
EventSpecification.MonitorType
Type-safe enumeration for the monitor events. |
Field Summary | |
---|---|
static int |
FIELD_WITNESS_NONE
Bitmask which indicates that no events should be witnessed for a field. |
static int |
FIELD_WITNESS_READ
Bitmask to check the bit specifying that read events should be witnessed for a field. |
static int |
FIELD_WITNESS_WRITE
Bitmask to check the bit specifying that write events should be witnessed for a field. |
Method Summary | |
---|---|
EventSpecification |
deserialize(java.io.DataInputStream stream)
Deserializes the specification from binary data. |
java.util.Set |
getModuleClasses(boolean asStrings)
Gets the set of classes comprising the module. |
java.util.Set |
getSystemClasses(boolean asStrings)
Gets the set of classes comprising the entire system. |
void |
serialize(java.io.DataOutputStream stream)
Serializes the specification as binary data. |
boolean |
useCallInterceptor(org.apache.bcel.generic.InvokeInstruction call,
org.apache.bcel.generic.ConstantPoolGen cpg)
Checks whether a method call should be observed using an "interceptor" that can provide additional data about the call. |
boolean |
witnessAnyMonitor(EventSpecification.MonitorType type,
org.apache.bcel.generic.MethodGen inMethod)
Checks whether any monitor events of a given type occurring in a given location are included in the specification. |
boolean |
witnessCall(org.apache.bcel.generic.InvokeInstruction call,
org.apache.bcel.generic.ConstantPoolGen cpg,
org.apache.bcel.generic.MethodGen inMethod)
Checks whether a method call in a given location is included in the specification. |
boolean |
witnessCatch(java.lang.String exceptionClass)
Checks whether the catching of an exception of a given class is included in the specification; that is, there is some location at which catching an exception of the given class is considered an observable event. |
boolean |
witnessCatch(java.lang.String exceptionClass,
org.apache.bcel.generic.MethodGen inMethod)
Checks whether the catching of an exception of a given class at a given location is included in the specification. |
boolean |
witnessConstructorEntry(org.apache.bcel.generic.MethodGen mg)
Checks whether entry into a constructor is included in the specification. |
boolean |
witnessConstructorExit(org.apache.bcel.generic.MethodGen mg)
Checks whether exit from a constructor is included in the specification. |
boolean |
witnessField(org.apache.bcel.generic.FieldInstruction fi,
org.apache.bcel.generic.ConstantPoolGen cpg,
org.apache.bcel.generic.MethodGen inMethod)
Checks whether the field referenced by a field instruction in a given location is part of the specification and should be witnessed. |
int |
witnessField(java.lang.String fieldName,
boolean isStatic)
Checks whether a named field is included in the specification. |
boolean |
witnessField(java.lang.String fieldName,
EventSpecification.FieldType fType,
java.lang.String className,
java.lang.String methodName,
java.lang.String signature)
Checks whether a field event occurring in a given location is included in the specification. |
boolean |
witnessMethodEntry(org.apache.bcel.generic.MethodGen mg)
Checks whether entry into a method is included in the specification. |
boolean |
witnessMethodExit(org.apache.bcel.generic.MethodGen mg)
Checks whether exit from a method is included in the specification. |
boolean |
witnessMonitor(java.lang.String className,
EventSpecification.MonitorType type)
Checks whether events associated with monitors on instances of a given class should be witnessed. |
boolean |
witnessNewObject(java.lang.String newClass,
org.apache.bcel.generic.MethodGen inMethod)
Checks whether an allocation of a class by a NEW instruction in a given location should be witnessed (is part of the specification). |
boolean |
witnessStaticInitializerEntry(java.lang.String className)
Checks whether entry into a static intializer is included in the specification. |
boolean |
witnessThrow(java.lang.String exceptionClass)
Checks whether the throwing of an exception of a given class is included in the specification; that is, there is some location from which throwing an exception of the given class is considered an observable event. |
boolean |
witnessThrow(java.lang.String exceptionClass,
java.lang.String className,
java.lang.String methodName,
java.lang.String signature)
Checks whether the throwing of an exception of a given class from a given location is included in the specification. |
Field Detail |
---|
static final int FIELD_WITNESS_NONE
static final int FIELD_WITNESS_READ
static final int FIELD_WITNESS_WRITE
Method Detail |
---|
java.util.Set getSystemClasses(boolean asStrings)
asStrings
- Specifies whether the returned set should directly
contain the class names as strings. If false
, the set
will contain ProgramUnit
s containing the
classes.
java.util.Set getModuleClasses(boolean asStrings)
asStrings
- Specifies whether the returned set should directly
contain the class names as strings. If false
, the set
will contain ProgramUnit
s containing the
classes.
boolean witnessNewObject(java.lang.String newClass, org.apache.bcel.generic.MethodGen inMethod)
newClass
- Name of the class to check for inclusion.inMethod
- Method in which the NEW instruction is executed.
true
if the NEW instruction is included in the
specification and should be observed.boolean witnessField(org.apache.bcel.generic.FieldInstruction fi, org.apache.bcel.generic.ConstantPoolGen cpg, org.apache.bcel.generic.MethodGen inMethod)
fi
- Field instruction to be checked for inclusion in the
specification.cpg
- Constant pool for the class containing the instruction.inMethod
- Method in which the field instruction is executed.
true
if the field is part of the specification.boolean witnessField(java.lang.String fieldName, EventSpecification.FieldType fType, java.lang.String className, java.lang.String methodName, java.lang.String signature)
fieldName
- Fully qualified name of the field to be checked for
inclusion in the specification.fType
- Type of the field to be checked for inclusion.className
- Name of the class in which the field instruction
is executed.methodName
- Name of the the method in which the field
instruction is executed.signature
- JDI-style signature of the method in which the
instruction is executed.
true
if the specified field event occurring in
the given method should be observed.int witnessField(java.lang.String fieldName, boolean isStatic)
This method is permitted to be heuristic, in the sense that it may in some circumstances indicate that a field is observable in some way when in fact it is not. A correct response should be attempted on a best-effort basis.
fieldName
- Fully qualified name of the field to be checked for
inclusion in the specification.isStatic
- Specifies whether it is a static field.
boolean witnessCall(org.apache.bcel.generic.InvokeInstruction call, org.apache.bcel.generic.ConstantPoolGen cpg, org.apache.bcel.generic.MethodGen inMethod)
call
- Invoke instruction to be checked for exclusion in the
specification.cpg
- Constant pool for the class containing the invoke instruction.inMethod
- Method in which the call is executed.
true
if the call is to a method included in the
specification.boolean useCallInterceptor(org.apache.bcel.generic.InvokeInstruction call, org.apache.bcel.generic.ConstantPoolGen cpg)
The principle benefit of witnessing a call using an interceptor
is that the values of the arguments to the method can be obtained.
Important information can be obtained about calls for which subsequent
EventListener.virtualMethodEnterEvent(sofya.ed.semantic.EventListener.ThreadData, sofya.ed.semantic.EventListener.ObjectData, sofya.ed.semantic.EventListener.MethodData)
s cannot be raised, either
because it is not possible (such as with native
methods),
or desirable (such as with Thread.start()
or
Thread.join()
methods). However, there is considerable
extra cost and potential interference associated with an interceptor,
so they generally should not be used for other method calls.
call
- Invoke instruction to be checked for observation using
an interceptor.cpg
- Constant pool for the class containing the invoke instruction.
true
if the call is to a method that should be
witnessed using an interceptor.boolean witnessConstructorEntry(org.apache.bcel.generic.MethodGen mg)
mg
- Constructor to be checked for inclusion in the
specification.
true
if entry into the constructor is included
in the specification.boolean witnessConstructorExit(org.apache.bcel.generic.MethodGen mg)
mg
- Constructor to be checked for inclusion in the
specification.
true
if exit from the constructor is included
in the specification.boolean witnessMethodEntry(org.apache.bcel.generic.MethodGen mg)
This query treats interface methods as virtual methods since they are also dynamically bound, a behavior that distinguishes this query from the call invocation events where interface method calls and other virtual calls are treated as distinct events.
mg
- Virtual method to be checked for inclusion in the
specification.
true
if entry into the virtual method is included
in the specification.boolean witnessMethodExit(org.apache.bcel.generic.MethodGen mg)
This query treats interface methods as virtual methods since they are also dynamically bound, a behavior that distinguishes this query from the call invocation events where interface method calls and other virtual calls are treated as distinct events.
mg
- Virtual method to be checked for inclusion in the
specification.
true
if exit from the virtual method is included
in the specification.boolean witnessAnyMonitor(EventSpecification.MonitorType type, org.apache.bcel.generic.MethodGen inMethod)
This is a helper method which is used by the instrumentor to optimize away the associated instrumentation if no monitor events of a certain type are to be witnessed at all.
type
- Monitor event type for which the check should be performed.inMethod
- Method in which the monitor events are executed.
true
if monitor events of the specified type
may be witnessed, false
otherwise.boolean witnessMonitor(java.lang.String className, EventSpecification.MonitorType type)
className
- Fully qualified name of the class to be checked for
monitor event inclusion in the specification.type
- Type of monitor event.
true
if the given monitor events should be
witnessed for monitors on instances of the given class,
false
otherwise.boolean witnessThrow(java.lang.String exceptionClass, java.lang.String className, java.lang.String methodName, java.lang.String signature)
exceptionClass
- Fully qualified name of the exception class
to be checked for inclusion in the specification.className
- Name of the class in which the throw occurs.methodName
- Name of the the method in which the throw occurs.signature
- JDI-style signature of the method in which the
throw occurs.
true
if the throwing of the given exception
from the specified location should be observed, false
otherwise.boolean witnessThrow(java.lang.String exceptionClass)
exceptionClass
- Fully qualified name of the exception class
to be checked for inclusion in the specification.
true
if the throwing of the given exception
from some location in the program should be observed,
false
otherwise.boolean witnessCatch(java.lang.String exceptionClass, org.apache.bcel.generic.MethodGen inMethod)
exceptionClass
- Fully qualified name of the exception class
to be checked for inclusion in the specification.inMethod
- Method in which the catch occurs.
true
if the catching of the given exception
at the specified location should be observed, false
otherwise.boolean witnessCatch(java.lang.String exceptionClass)
exceptionClass
- Fully qualified name of the exception class
to be checked for inclusion in the specification.
true
if the catching of the given exception
at some location in the program should be observed,
false
otherwise.boolean witnessStaticInitializerEntry(java.lang.String className)
className
- Fully qualified name of the class containing
the static initializer to be checked for inclusion in the
specification.
true
if entry into the static initializer is
included in the specification.void serialize(java.io.DataOutputStream stream) throws java.io.IOException
stream
- Stream to which the specification is serialized.
java.io.IOException
- On any I/O error that prevents serialization.EventSpecification deserialize(java.io.DataInputStream stream) throws java.io.IOException
An instance of the class will need to be instantiated first, likely by reflection. If called on an existing instance, that specification will be destroyed (overwritten).
stream
- Stream from which the specification is deserialized.
java.io.IOException
- On any I/O error that prevents deserialization.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |