NOTE: This code is experimental at the moment, and may not function correctly. Furthermore, String specs described below, might change without a notice.General format of the chainSpec String is :
instrumentorSpec (| instrumentorSpec)*
Each instrumentorSpec represents an Instrumentor in chain that is to be created. First instrumentor(Spec) in chainSpec forward its output to the next instrumentor(Spec) and so on. '|' character acts as a marker between instrumentorSpecs. One may think that marker as a pipe marker in some operating system shells. Format of the instrumentorSpec is :
instrumentorSymbol(#childSymbol(#childHint)?)?
instrumentorSymbol is a symbolic name of the Instrumentor to be used. It may be a fully qualified class name of the Instrumentor, or it may be its symbolic equivalence. SymbolMap is used to map symbolic names to class names.childSymbol has a similar way of instantiating child; It could be a fully qualified class name or its symbolic name from SymbolMap. If child cannot be instantiated, it is considered to be an instance of String. In that case, child hints make no sense.
Instrumentor gets its child associated with itself through constructor. Reflection API, Constructor
in particular, is used to instantiate Instrumentor.
childHint is passed to child the same way, as child gets passed to Instrumentor. Trough Constructor. This version supports only integer hints. Child is looked for a field named 'childHint'. If one is found, it is assumed, that there is a Constructor with same type as its argument.
Future versions of this class might slightly modify format described above. More childHint types might be added if there is need for one. and different ways of passing childHints and childs to their parents. Like java beans style get/set methods.
Samples:
@see SymbolMap @author Mika Riekkinen, Joni Suominen @version $Revision: 1.5 $ $Date: 2004/03/15 14:47:53 $"GrepInstrumentor#MethodCallStrategy | HeadInstrumentor | MethodCallInstrumentor#DummyHook"
If the default SymbolMap is used, chainSpec above would generate a chain with instrumentors added to it in the following order:Resulting chain would instrument its input so, that a call is being made to DummyHook before a method call is being made.
- Instatiate
alt.jiapi.instrumentor.GrepInstrumentor
withalt.jiapi.instrumentor.MethodCallStrategy
as its argument. This instrumentor is put first in the chain.alt.jiapi.instrumentor.HeadInstrumentor
is instatiated, and added to chain.alt.jiapi.instrumentor.MethodCallInstrumentor
is instatiated with and instance ofDummyHook
as its constructor argument. It is then added to chain.
|
|