alt.jiapi
Class InstrumentationDescriptor

java.lang.Object
  extended by alt.jiapi.InstrumentationDescriptor

public class InstrumentationDescriptor
extends java.lang.Object

This class holds information needed by the instrumentation process. It has a List of Instrumentations. The Instrumentations define the instrumentation function.

InstrumentationDescriptor holds those Instrumentations which use the same Rules. Rules define which classes is to be instrumented.

Version:
$Revision: 1.15 $ $Date: 2004/08/11 10:12:31 $
Author:
Mika Riekkinen, Joni Suominen
See Also:
Instrumentation

Constructor Summary
InstrumentationDescriptor()
           
 
Method Summary
 void addExclusionRule(java.lang.String rule)
          Adds an exclusion rule to this descriptor.
 void addInclusionRule(java.lang.String rule)
          Adds a rule to this descriptor.
 void addInstrumentor(Instrumentor instrumentor)
          Adds a new chain.
 java.util.Set getExclusionsRules()
          Gets the inclusion rules of this descriptor.
 java.util.Set getInclusionsRules()
          Gets the inclusion rules of this descriptor.
 java.util.List getInstrumentors()
          Gets all the Instrumentations.
 boolean match(java.lang.String className)
          Check whether the given className matches any of given rules.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InstrumentationDescriptor

public InstrumentationDescriptor()
Method Detail

addExclusionRule

public void addExclusionRule(java.lang.String rule)
                      throws JiapiException
Adds an exclusion rule to this descriptor. When choosing whether a class/method is to be insturmented, if exclusion rule matches, that class/method will be skipped from instrumentation.

In general Exclusion rules are more powerful than inclusion rules. That is, if for some reason two similar rules are assigned to both exclusion and inclusion rules, exclusion rule will win.

Parameters:
rule - A Exclusion rule, that is to be added to this descriptor
Throws:
JiapiException - thrown if there's a syntax error in rule

addInclusionRule

public void addInclusionRule(java.lang.String rule)
                      throws JiapiException
Adds a rule to this descriptor. Each Instrumentor - Patch pair is joined with this rule. When instrumenting, if inclusion rule matches a class/method that is loaded by the ClassLoader, Instrumentors, that are registered to this descriptor by addBinding(Instrumentor, Patch) are called with bytecode, that reflects the method. Instrumentor is then supposed to modify that class somehow.

Format of the rule is the same, as fully qualified Java package/class/method names. For example, following are valid rules:

Parameters:
rule - A Inclusion rule, that is to be added to this descriptor
Throws:
JiapiException - thrown if there's a syntax error in rule

addInstrumentor

public void addInstrumentor(Instrumentor instrumentor)
Adds a new chain.

Parameters:
i - Instrumentor that is used in instrumenting
patch - Patch, which is associated with the Instrumentor given

getExclusionsRules

public java.util.Set getExclusionsRules()
Gets the inclusion rules of this descriptor.

Returns:
a Set of inclusion rules

getInclusionsRules

public java.util.Set getInclusionsRules()
Gets the inclusion rules of this descriptor.

Returns:
a Set of inclusion rules

getInstrumentors

public java.util.List getInstrumentors()
Gets all the Instrumentations.

Returns:
An ordered List of Instrumentations.

match

public boolean match(java.lang.String className)
Check whether the given className matches any of given rules. Excplicit exclusion rules win if they are more significant than inclusion rules.

Parameters:
className - a class name

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2001. Documenation generated August 26 2011.