@Override public void processTuple(XPathContext context) throws XPathException { Controller controller = context.getController(); if (controller.isTracing()) { ClauseInfo baseInfo = new ClauseInfo(baseClause); baseInfo.setNamespaceResolver(traceClause.getNamespaceResolver()); controller.getTraceListener().enter(baseInfo, context); destination.processTuple(context); controller.getTraceListener().leave(baseInfo); } else { destination.processTuple(context); } }
@Override public void processTuple(XPathContext context) throws XPathException { Controller controller = context.getController(); if (controller.isTracing()) { ClauseInfo baseInfo = new ClauseInfo(baseClause); baseInfo.setNamespaceResolver(traceClause.getNamespaceResolver()); controller.getTraceListener().enter(baseInfo, context); destination.processTuple(context); controller.getTraceListener().leave(baseInfo); } else { destination.processTuple(context); } }
/** * Return an Iterator to iterate over the values of a sequence. The value of every * expression can be regarded as a sequence, so this method is supported for all * expressions. This default implementation handles iteration for expressions that * return singleton values: for non-singleton expressions, the subclass must * provide its own implementation. * * @exception net.sf.saxon.trans.XPathException if any dynamic error occurs evaluating the * expression * @param context supplies the context for evaluation * @return a SequenceIterator that can be used to iterate over the result * of the expression */ public SequenceIterator iterate(XPathContext context) throws XPathException { Controller controller = context.getController(); if (controller.isTracing()) { controller.getTraceListener().enter(getInstructionInfo(), context); } SequenceIterator result = child.iterate(context); if (controller.isTracing()) { controller.getTraceListener().leave(getInstructionInfo()); } return result; }
/** * Evaluate an updating expression, adding the results to a Pending Update List. * The default implementation of this method, which is used for non-updating expressions, * throws an UnsupportedOperationException * * @param context the XPath dynamic evaluation context * @param pul the pending update list to which the results should be written */ public void evaluatePendingUpdates(XPathContext context, PendingUpdateList pul) throws XPathException { Controller controller = context.getController(); assert controller != null; if (controller.isTracing()) { controller.getTraceListener().enter(getInstructionInfo(), context); } getChild().evaluatePendingUpdates(context, pul); if (controller.isTracing()) { controller.getTraceListener().leave(getInstructionInfo()); } }
/** * Evaluate an updating expression, adding the results to a Pending Update List. * The default implementation of this method, which is used for non-updating expressions, * throws an UnsupportedOperationException * * @param context the XPath dynamic evaluation context * @param pul the pending update list to which the results should be written */ public void evaluatePendingUpdates(XPathContext context, PendingUpdateList pul) throws XPathException { Controller controller = context.getController(); assert controller != null; if (controller.isTracing()) { controller.getTraceListener().enter(getInstructionInfo(), context); } getChild().evaluatePendingUpdates(context, pul); if (controller.isTracing()) { controller.getTraceListener().leave(getInstructionInfo()); } }
/** * Return an Iterator to iterate over the values of a sequence. The value of every * expression can be regarded as a sequence, so this method is supported for all * expressions. This default implementation handles iteration for expressions that * return singleton values: for non-singleton expressions, the subclass must * provide its own implementation. * * @param context supplies the context for evaluation * @return a SequenceIterator that can be used to iterate over the result * of the expression * @throws net.sf.saxon.trans.XPathException * if any dynamic error occurs evaluating the * expression */ /*@NotNull*/ public SequenceIterator<?> iterate(XPathContext context) throws XPathException { Controller controller = context.getController(); assert controller != null; if (controller.isTracing()) { controller.getTraceListener().enter(getInstructionInfo(), context); } SequenceIterator result = getChild().iterate(context); if (controller.isTracing()) { controller.getTraceListener().leave(getInstructionInfo()); } return result; }
/** * Return an Iterator to iterate over the values of a sequence. The value of every * expression can be regarded as a sequence, so this method is supported for all * expressions. This default implementation handles iteration for expressions that * return singleton values: for non-singleton expressions, the subclass must * provide its own implementation. * * @param context supplies the context for evaluation * @return a SequenceIterator that can be used to iterate over the result * of the expression * @throws net.sf.saxon.trans.XPathException * if any dynamic error occurs evaluating the * expression */ /*@NotNull*/ public SequenceIterator<?> iterate(XPathContext context) throws XPathException { Controller controller = context.getController(); assert controller != null; if (controller.isTracing()) { controller.getTraceListener().enter(getInstructionInfo(), context); } SequenceIterator result = getChild().iterate(context); if (controller.isTracing()) { controller.getTraceListener().leave(getInstructionInfo()); } return result; }
/** * Evaluate an expression as a single item. This always returns either a single Item or * null (denoting the empty sequence). No conversion is done. This method should not be * used unless the static type of the expression is a subtype of "item" or "item?": that is, * it should not be called if the expression may return a sequence. There is no guarantee that * this condition will be detected. * * @param context The context in which the expression is to be evaluated * @return the node or atomic value that results from evaluating the * expression; or null to indicate that the result is an empty * sequence * @throws net.sf.saxon.trans.XPathException * if any dynamic error occurs evaluating the * expression */ public Item evaluateItem(XPathContext context) throws XPathException { Controller controller = context.getController(); assert controller != null; if (controller.isTracing()) { controller.getTraceListener().enter(getInstructionInfo(), context); } Item result = getChild().evaluateItem(context); if (controller.isTracing()) { controller.getTraceListener().leave(getInstructionInfo()); } return result; }
/** * Move on to the next tuple. Before returning, this method must set all the variables corresponding * to the "returned" tuple in the local stack frame associated with the context object * * @param context the dynamic evaluation context * @return true if another tuple has been generated; false if the tuple stream is exhausted. If the * method returns false, the values of the local variables corresponding to this tuple stream * are undefined. */ @Override public boolean nextTuple(XPathContext context) throws XPathException { Controller controller = context.getController(); if (controller.isTracing()) { ClauseInfo baseInfo = new ClauseInfo(baseClause); baseInfo.setNamespaceResolver(traceClause.getNamespaceResolver()); controller.getTraceListener().enter(baseInfo, context); boolean b = base.nextTuple(context); controller.getTraceListener().leave(baseInfo); return b; } else { return base.nextTuple(context); } }
/** * Move on to the next tuple. Before returning, this method must set all the variables corresponding * to the "returned" tuple in the local stack frame associated with the context object * * @param context the dynamic evaluation context * @return true if another tuple has been generated; false if the tuple stream is exhausted. If the * method returns false, the values of the local variables corresponding to this tuple stream * are undefined. */ @Override public boolean nextTuple(XPathContext context) throws XPathException { Controller controller = context.getController(); if (controller.isTracing()) { ClauseInfo baseInfo = new ClauseInfo(baseClause); baseInfo.setNamespaceResolver(traceClause.getNamespaceResolver()); controller.getTraceListener().enter(baseInfo, context); boolean b = base.nextTuple(context); controller.getTraceListener().leave(baseInfo); return b; } else { return base.nextTuple(context); } }
private void notifyListener(String label, Value val, XPathContext context) { InstructionDetails info = (InstructionDetails)getInstructionInfo(); info.setConstructType(Location.TRACE_CALL); info.setNamespaceResolver(resolver); info.setProperty("label", label); info.setProperty("value", val); TraceListener listener = context.getController().getTraceListener(); listener.enter(info, context); listener.leave(info); }
private void notifyListener(String label, Value val, XPathContext context) { InstructionDetails info = (InstructionDetails)getInstructionInfo(); info.setConstructType(Location.TRACE_CALL); info.setNamespaceResolver(resolver); info.setProperty("label", label); info.setProperty("value", val); TraceListener listener = context.getController().getTraceListener(); listener.enter(info, context); listener.leave(info); }
/** * Execute this instruction, with the possibility of returning tail calls if there are any. * This outputs the trace information via the registered TraceListener, * and invokes the instruction being traced. * @param context the dynamic execution context * @return either null, or a tail call that the caller must invoke on return * @throws net.sf.saxon.trans.XPathException */ public TailCall processLeavingTail(XPathContext context) throws XPathException { Controller controller = context.getController(); TraceListener listener = controller.getTraceListener(); if (controller.isTracing()) { listener.enter(getInstructionInfo(), context); } // Don't attempt tail call optimization when tracing, the results are too confusing child.process(context); if (controller.isTracing()) { listener.leave(getInstructionInfo()); } return null; }
/** * Execute this instruction, with the possibility of returning tail calls if there are any. * This outputs the trace information via the registered TraceListener, * and invokes the instruction being traced. * @param context the dynamic execution context * @return either null, or a tail call that the caller must invoke on return * @throws net.sf.saxon.trans.XPathException */ public TailCall processLeavingTail(XPathContext context) throws XPathException { Controller controller = context.getController(); TraceListener listener = controller.getTraceListener(); if (controller.isTracing()) { listener.enter(getInstructionInfo(), context); } // Don't attempt tail call optimization when tracing, the results are too confusing child.process(context); if (controller.isTracing()) { listener.leave(getInstructionInfo()); } return null; }
/** * Run the query returning the results as an EventIterator * * @param controller The Controller used to run the query * @param dynamicEnv the XQuery dynamic context for evaluating the query * @return an EventIterator representing the results of the query as a sequence of events */ public EventIterator iterateEvents(Controller controller, DynamicQueryContext dynamicEnv) throws XPathException { if (isUpdating) { throw new XPathException("Cannot call iterateEvents() on an updating query"); } initializeController(dynamicEnv, controller); XPathContextMajor context = initialContext(dynamicEnv, controller); // In tracing/debugging mode, evaluate all the global variables first if (controller.getTraceListener() != null) { controller.preEvaluateGlobals(context); } context.openStackFrame(stackFrameMap); final Configuration config = executable.getConfiguration(); EventIterator ei = expression.iterateEvents(context); //ei = new TracingEventIterator(EventStackIterator.flatten(ei)); return new ComplexContentProcessor(config, ei); }
public void notifyListener(String label, Sequence<?> val, SourceLocator loc, XPathContext context) { InstructionDetails info = new InstructionDetails(); info.setConstructType(LocationKind.TRACE_CALL); info.setLineNumber(loc.getLineNumber()); info.setSystemId(loc.getSystemId()); info.setProperty("label", label); info.setProperty("value", val); TraceListener listener = context.getController().getTraceListener(); listener.enter(info, context); listener.leave(info); }
public void notifyListener(String label, Sequence<?> val, SourceLocator loc, XPathContext context) { InstructionDetails info = new InstructionDetails(); info.setConstructType(LocationKind.TRACE_CALL); info.setLineNumber(loc.getLineNumber()); info.setSystemId(loc.getSystemId()); info.setProperty("label", label); info.setProperty("value", val); TraceListener listener = context.getController().getTraceListener(); listener.enter(info, context); listener.leave(info); }
private void notifyListener(String label, Value val, XPathContext context) { InstructionDetails info = new InstructionDetails(); info.setConstructType(Location.TRACE_CALL); info.setLineNumber(getLineNumber()); info.setSystemId(getSystemId()); info.setProperty("label", label); info.setProperty("value", val); TraceListener listener = context.getController().getTraceListener(); listener.enter(info, context); listener.leave(info); }
/** * Execute this instruction, with the possibility of returning tail calls if there are any. * This outputs the trace information via the registered TraceListener, * and invokes the instruction being traced. * * @param context the dynamic execution context * @return either null, or a tail call that the caller must invoke on return * @throws net.sf.saxon.trans.XPathException * */ public TailCall processLeavingTail(XPathContext context) throws XPathException { Controller controller = context.getController(); assert controller != null; TraceListener listener = controller.getTraceListener(); if (controller.isTracing()) { assert listener != null; listener.enter(getInstructionInfo(), context); } // Don't attempt tail call optimization when tracing, the results are too confusing getChild().process(context); if (controller.isTracing()) { assert listener != null; listener.leave(getInstructionInfo()); } return null; }
public TailCall processLeavingTail(XPathContext context) throws XPathException { Controller controller = context.getController(); assert controller != null; PipelineConfiguration pipe = context.getReceiver().getPipelineConfiguration(); GroupIterator groupIterator = getGroupIterator(context); XPathContextMajor c2 = context.newContext(); c2.setOrigin(this); FocusIterator focusIterator = c2.trackFocus(groupIterator); c2.setCurrentGroupIterator(groupIterator); c2.setCurrentTemplateRule(null); pipe.setXPathContext(c2); if (controller.isTracing()) { TraceListener listener = controller.getTraceListener(); assert listener != null; Item item; while ((item = focusIterator.next()) != null) { listener.startCurrentItem(item); getActionExpression().process(c2); listener.endCurrentItem(item); } } else { while (focusIterator.next() != null) { getActionExpression().process(c2); } } pipe.setXPathContext(context); return null; }