StaticContext context = new StaticContext(user);
StaticContext context = new StaticContext(broker);
	protected Value doQuery(		User user,		String xpath,		DocumentSet docs,		NodeSet contextSet,		Hashtable namespaces)		throws Exception {		StaticContext context = new StaticContext(user);		Map.Entry entry;		for (Iterator i = namespaces.entrySet().iterator(); i.hasNext();) {			entry = (Map.Entry) i.next();			context.declareNamespace(				(String) entry.getKey(),				(String) entry.getValue());		}		XPathLexer2 lexer = new XPathLexer2(new StringReader(xpath));		XPathParser2 parser = new XPathParser2(lexer);		XPathTreeParser2 treeParser = new XPathTreeParser2(brokerPool, context);		parser.xpath();		if (parser.foundErrors()) {			throw new EXistException(parser.getErrorMessage());		}		AST ast = parser.getAST();		LOG.debug("generated AST: " + ast.toStringTree());		PathExpr expr = new PathExpr(brokerPool);		treeParser.xpath(ast, expr);		if (treeParser.foundErrors()) {			throw new EXistException(treeParser.getErrorMessage());		}		LOG.info("query: " + xpath);		long start = System.currentTimeMillis();		DocumentSet ndocs =			(docs == null ? expr.preselect() : expr.preselect(docs));		if (ndocs.getLength() == 0)			return null;		LOG.info(			"pre-select took " + (System.currentTimeMillis() - start) + "ms.");		Value result = expr.eval(context, ndocs, contextSet, null);		LOG.info("query took " + (System.currentTimeMillis() - start) + "ms.");		return result;	}