Package net.sf.saxon.trace
Class TraceEventMulticaster
- java.lang.Object
-
- net.sf.saxon.trace.TraceEventMulticaster
-
- All Implemented Interfaces:
java.util.EventListener
,TraceListener
public class TraceEventMulticaster extends java.lang.Object implements TraceListener
A class which implements efficient and thread-safe multi-cast event dispatching for the TraceListener evants.
-
-
Field Summary
Fields Modifier and Type Field Description protected TraceListener
a
protected TraceListener
b
-
Constructor Summary
Constructors Modifier Constructor Description protected
TraceEventMulticaster(TraceListener a, TraceListener b)
Creates an event multicaster instance which chains listener-a with listener-b.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TraceListener
add(TraceListener a, TraceListener b)
Adds trace-listener-a with trace-listener-b and returns the resulting multicast listener.protected static TraceListener
addInternal(TraceListener a, TraceListener b)
Returns the resulting multicast listener from adding listener-a and listener-b together.void
close()
Called at endvoid
endCurrentItem(Item item)
Called when an item ceases to be the current itemvoid
endRuleSearch(java.lang.Object rule, SimpleMode mode, Item item)
Called at the end of a rule searchvoid
enter(Traceable element, java.util.Map<java.lang.String,java.lang.Object> properties, XPathContext context)
Called when an element of the stylesheet gets processedvoid
leave(Traceable element)
Called after an element of the stylesheet got processedvoid
open(Controller controller)
Called at startprotected TraceListener
remove(TraceListener oldl)
Removes a listener from this multicaster and returns the resulting multicast listener.static TraceListener
remove(TraceListener l, TraceListener oldl)
Removes the old trace-listener from trace-listener-l and returns the resulting multicast listener.protected static TraceListener
removeInternal(TraceListener l, TraceListener oldl)
Returns the resulting multicast listener after removing the old listener from listener-l.void
setOutputDestination(Logger stream)
Method called to supply the destination for outputvoid
startCurrentItem(Item item)
Called when an item becomes currentvoid
startRuleSearch()
Called at the start of a rule search-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.lib.TraceListener
endRuleSearch
-
-
-
-
Field Detail
-
a
protected final TraceListener a
-
b
protected final TraceListener b
-
-
Constructor Detail
-
TraceEventMulticaster
protected TraceEventMulticaster(TraceListener a, TraceListener b)
Creates an event multicaster instance which chains listener-a with listener-b.- Parameters:
a
- listener-ab
- listener-b
-
-
Method Detail
-
setOutputDestination
public void setOutputDestination(Logger stream)
Description copied from interface:TraceListener
Method called to supply the destination for output- Specified by:
setOutputDestination
in interfaceTraceListener
- Parameters:
stream
- a Logger to which any output produced by the TraceListener should be written
-
remove
protected TraceListener remove(TraceListener oldl)
Removes a listener from this multicaster and returns the resulting multicast listener.- Parameters:
oldl
- the listener to be removed
-
open
public void open(Controller controller)
Called at start- Specified by:
open
in interfaceTraceListener
- Parameters:
controller
- identifies the transformation controller, and provides the listener with access to context and configuration information
-
close
public void close()
Called at end- Specified by:
close
in interfaceTraceListener
-
enter
public void enter(Traceable element, java.util.Map<java.lang.String,java.lang.Object> properties, XPathContext context)
Called when an element of the stylesheet gets processed- Specified by:
enter
in interfaceTraceListener
- Parameters:
element
- gives information about the instruction being executed, and about the context in which it is executed. This object is mutable, so if information from the InstructionInfo is to be retained, it must be copied.properties
- extra information about the instruction to be included in the tracecontext
- the XPath evaluation context
-
leave
public void leave(Traceable element)
Called after an element of the stylesheet got processed- Specified by:
leave
in interfaceTraceListener
- Parameters:
element
-
-
startCurrentItem
public void startCurrentItem(Item item)
Called when an item becomes current- Specified by:
startCurrentItem
in interfaceTraceListener
- Parameters:
item
- the new current item. Item objects are not mutable; it is safe to retain a reference to the Item for later use.
-
endCurrentItem
public void endCurrentItem(Item item)
Called when an item ceases to be the current item- Specified by:
endCurrentItem
in interfaceTraceListener
- Parameters:
item
- the item that was current, whose processing is now complete. This will represent the same underlying item as the corresponding startCurrentItem() call, though it will not necessarily be the same actual object.
-
startRuleSearch
public void startRuleSearch()
Called at the start of a rule search- Specified by:
startRuleSearch
in interfaceTraceListener
-
endRuleSearch
public void endRuleSearch(java.lang.Object rule, SimpleMode mode, Item item)
Called at the end of a rule search- Parameters:
rule
- the rule (or possible built-in ruleset) that has been selectedmode
-item
-
-
add
public static TraceListener add(TraceListener a, TraceListener b)
Adds trace-listener-a with trace-listener-b and returns the resulting multicast listener.- Parameters:
a
- trace-listener-ab
- trace-listener-b
-
remove
public static TraceListener remove(TraceListener l, TraceListener oldl)
Removes the old trace-listener from trace-listener-l and returns the resulting multicast listener.- Parameters:
l
- trace-listener-loldl
- the trace-listener being removed
-
addInternal
protected static TraceListener addInternal(TraceListener a, TraceListener b)
Returns the resulting multicast listener from adding listener-a and listener-b together. If listener-a is null, it returns listener-b; If listener-b is null, it returns listener-a If neither are null, then it creates and returns a new EventMulticaster instance which chains a with b.- Parameters:
a
- event listener-ab
- event listener-b
-
removeInternal
protected static TraceListener removeInternal(TraceListener l, TraceListener oldl)
Returns the resulting multicast listener after removing the old listener from listener-l. If listener-l equals the old listener OR listener-l is null, returns null. Else if listener-l is an instance of SaxonEventMulticaster, then it removes the old listener from it. Else, returns listener l.- Parameters:
l
- the listener being removed fromoldl
- the listener being removed
-
-