/** * Allows the user to set specific attributes on the underlying implementation. * * @param name The name of the attribute. For Saxon this must be one of the names defined in * {@link FeatureKeys} * @param value The value of the attribute. * @exception IllegalArgumentException thrown if the underlying implementation doesn't recognize * the attribute. */ public void setAttribute(String name, Object value) { if (name.equals(FeatureKeys.CONFIGURATION)) { config = (Configuration) value; } else { if (config == null) { config = new Configuration(); } config.setConfigurationProperty(name, value); } }
public XQueryExecutor(TraceExtension traceExtension) { this.traceExtension = traceExtension; Configuration configuration = Configuration.newConfiguration(); if (!traceExtension.allowsOptimization()) { configuration.setConfigurationProperty(OPTIMIZATION_LEVEL, String.valueOf(NO_OPTIMIZATION)); } configuration.setModuleURIResolver(new ClasspathModuleUriResolver()); Processor processor = new Processor(configuration); xQueryCompiler = processor.newXQueryCompiler(); StaticQueryContext staticQueryContext = xQueryCompiler.getUnderlyingStaticContext(); staticQueryContext.setCodeInjector(traceExtension.getTraceCodeInjector()); }