Class 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.
    • Constructor Detail

      • TraceEventMulticaster

        protected TraceEventMulticaster​(TraceListener a,
                                        TraceListener b)
        Creates an event multicaster instance which chains listener-a with listener-b.
        Parameters:
        a - listener-a
        b - 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 interface TraceListener
        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 interface TraceListener
        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 interface TraceListener
      • 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 interface TraceListener
        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 trace
        context - the XPath evaluation context
      • leave

        public void leave​(Traceable element)
        Called after an element of the stylesheet got processed
        Specified by:
        leave in interface TraceListener
        Parameters:
        element -
      • startCurrentItem

        public void startCurrentItem​(Item item)
        Called when an item becomes current
        Specified by:
        startCurrentItem in interface TraceListener
        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 interface TraceListener
        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 interface TraceListener
      • 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 selected
        mode -
        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-a
        b - 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-l
        oldl - 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-a
        b - 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 from
        oldl - the listener being removed