org.apache.xalan.trace
Class TraceManager

java.lang.Object
  extended by org.apache.xalan.trace.TraceManager

public class TraceManager
extends java.lang.Object

This class manages trace listeners, and acts as an interface for the tracing functionality in Xalan.


Field Summary
private  java.util.Vector m_traceListeners
          List of listeners who are interested in tracing what's being generated.
private  TransformerImpl m_transformer
          A transformer instance
 
Constructor Summary
TraceManager(TransformerImpl transformer)
          Constructor for the trace manager.
 
Method Summary
 void addTraceListener(TraceListener tl)
          Add a trace listener for the purposes of debugging and diagnosis.
 void fireExtensionEndEvent(ExtensionEvent ee)
          Fire an end extension event.
 void fireExtensionEndEvent(java.lang.reflect.Method method, java.lang.Object instance, java.lang.Object[] arguments)
          Fire an end extension event.
 void fireExtensionEvent(ExtensionEvent ee)
          Fire an end extension event.
 void fireExtensionEvent(java.lang.reflect.Method method, java.lang.Object instance, java.lang.Object[] arguments)
          Fire an end extension event.
 void fireGenerateEvent(GenerateEvent te)
          Fire a generate event.
 void fireSelectedEndEvent(EndSelectionEvent se)
          Fire a selection event.
 void fireSelectedEndEvent(int sourceNode, ElemTemplateElement styleNode, java.lang.String attributeName, XPath xpath, XObject selection)
          Fire a selection event.
 void fireSelectedEvent(int sourceNode, ElemTemplateElement styleNode, java.lang.String attributeName, XPath xpath, XObject selection)
          Fire a selection event.
 void fireSelectedEvent(SelectionEvent se)
          Fire a selection event.
 void fireTraceEndEvent(ElemTemplateElement styleNode)
          Fire a end trace event, after all children of an element have been executed.
 void fireTraceEndEvent(TracerEvent te)
          Fire a trace event.
 void fireTraceEvent(ElemTemplateElement styleNode)
          Fire a trace event.
 void fireTraceEvent(TracerEvent te)
          Fire a trace event.
private  org.w3c.dom.Node getDOMNodeFromDTM(int sourceNode)
          Get the DOM Node of the current XPath context, which is possibly null.
 boolean hasTraceListeners()
          Tell if trace listeners are present.
 void removeTraceListener(TraceListener tl)
          Remove a trace listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_transformer

private TransformerImpl m_transformer
A transformer instance


m_traceListeners

private java.util.Vector m_traceListeners
List of listeners who are interested in tracing what's being generated.

Constructor Detail

TraceManager

public TraceManager(TransformerImpl transformer)
Constructor for the trace manager.

Parameters:
transformer - a non-null instance of a transformer
Method Detail

addTraceListener

public void addTraceListener(TraceListener tl)
                      throws java.util.TooManyListenersException
Add a trace listener for the purposes of debugging and diagnosis.

Parameters:
tl - Trace listener to be added.
Throws:
java.util.TooManyListenersException

removeTraceListener

public void removeTraceListener(TraceListener tl)
Remove a trace listener.

Parameters:
tl - Trace listener to be removed.

fireGenerateEvent

public void fireGenerateEvent(GenerateEvent te)
Fire a generate event.

Parameters:
te - Generate Event to fire

hasTraceListeners

public boolean hasTraceListeners()
Tell if trace listeners are present.

Returns:
True if there are trace listeners

fireTraceEvent

public void fireTraceEvent(ElemTemplateElement styleNode)
Fire a trace event.

Parameters:
styleNode - Stylesheet template node

fireTraceEndEvent

public void fireTraceEndEvent(ElemTemplateElement styleNode)
Fire a end trace event, after all children of an element have been executed.

Parameters:
styleNode - Stylesheet template node

fireTraceEndEvent

public void fireTraceEndEvent(TracerEvent te)
Fire a trace event.

Parameters:
te - Trace event to fire

fireTraceEvent

public void fireTraceEvent(TracerEvent te)
Fire a trace event.

Parameters:
te - Trace event to fire

fireSelectedEvent

public void fireSelectedEvent(int sourceNode,
                              ElemTemplateElement styleNode,
                              java.lang.String attributeName,
                              XPath xpath,
                              XObject selection)
                       throws javax.xml.transform.TransformerException
Fire a selection event.

Parameters:
sourceNode - Current source node
styleNode - node in the style tree reference for the event.
attributeName - The attribute name from which the selection is made.
xpath - The XPath that executed the selection.
selection - The result of the selection.
Throws:
javax.xml.transform.TransformerException

fireSelectedEndEvent

public void fireSelectedEndEvent(int sourceNode,
                                 ElemTemplateElement styleNode,
                                 java.lang.String attributeName,
                                 XPath xpath,
                                 XObject selection)
                          throws javax.xml.transform.TransformerException
Fire a selection event.

Parameters:
sourceNode - Current source node
styleNode - node in the style tree reference for the event.
attributeName - The attribute name from which the selection is made.
xpath - The XPath that executed the selection.
selection - The result of the selection.
Throws:
javax.xml.transform.TransformerException

fireSelectedEndEvent

public void fireSelectedEndEvent(EndSelectionEvent se)
                          throws javax.xml.transform.TransformerException
Fire a selection event.

Parameters:
se - Selection event to fire
Throws:
javax.xml.transform.TransformerException

fireSelectedEvent

public void fireSelectedEvent(SelectionEvent se)
                       throws javax.xml.transform.TransformerException
Fire a selection event.

Parameters:
se - Selection event to fire
Throws:
javax.xml.transform.TransformerException

fireExtensionEndEvent

public void fireExtensionEndEvent(java.lang.reflect.Method method,
                                  java.lang.Object instance,
                                  java.lang.Object[] arguments)
Fire an end extension event.

Parameters:
method - The java method about to be executed
instance - The instance the method will be executed on
arguments - Parameters passed to the method.
See Also:
Method.invoke(java.lang.Object, java.lang.Object...)

fireExtensionEvent

public void fireExtensionEvent(java.lang.reflect.Method method,
                               java.lang.Object instance,
                               java.lang.Object[] arguments)
Fire an end extension event.

Parameters:
method - The java method about to be executed
instance - The instance the method will be executed on
arguments - Parameters passed to the method.
See Also:
Method.invoke(java.lang.Object, java.lang.Object...)

fireExtensionEndEvent

public void fireExtensionEndEvent(ExtensionEvent ee)
Fire an end extension event.

Parameters:
ee - the ExtensionEvent to fire
See Also:
Method.invoke(java.lang.Object, java.lang.Object...)

fireExtensionEvent

public void fireExtensionEvent(ExtensionEvent ee)
Fire an end extension event.

Parameters:
ee - the ExtensionEvent to fire
See Also:
Method.invoke(java.lang.Object, java.lang.Object...)

getDOMNodeFromDTM

private org.w3c.dom.Node getDOMNodeFromDTM(int sourceNode)
Get the DOM Node of the current XPath context, which is possibly null.

Parameters:
sourceNode - the handle on the node used by a DTM.