| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
package net.sf.saxon.expr.flwor; |
| 9 |
|
| 10 |
import net.sf.saxon.Controller; |
| 11 |
import net.sf.saxon.expr.XPathContext; |
| 12 |
import net.sf.saxon.trans.XPathException; |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
public class TraceClausePush extends TuplePush { |
| 20 |
|
| 21 |
private TuplePush destination; |
| 22 |
TraceClause traceClause; |
| 23 |
private Clause baseClause; |
| 24 |
|
| 25 |
public TraceClausePush(TuplePush destination, TraceClause traceClause, Clause baseClause) { |
| 26 |
this.destination = destination; |
| 27 |
this.traceClause = traceClause; |
| 28 |
this.baseClause = baseClause; |
| 29 |
} |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
@Override |
| 35 |
public void processTuple(XPathContext context) throws XPathException { |
| 36 |
Controller controller = context.getController(); |
| 37 |
if (controller.isTracing()) { |
| 38 |
ClauseInfo baseInfo = new ClauseInfo(baseClause); |
| 39 |
baseInfo.setNamespaceResolver(traceClause.getNamespaceResolver()); |
| 40 |
controller.getTraceListener().enter(baseInfo, context); |
| 41 |
destination.processTuple(context); |
| 42 |
controller.getTraceListener().leave(baseInfo); |
| 43 |
} else { |
| 44 |
destination.processTuple(context); |
| 45 |
} |
| 46 |
} |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
@Override |
| 52 |
public void close() throws XPathException { |
| 53 |
destination.close(); |
| 54 |
} |
| 55 |
} |
| 56 |
|