DocumentSet docs = broker.getAllDocuments(new DocumentSet()); context.setStaticallyKnownDocuments(docs);
	public org.exist.soap.QueryResponse query(String sessionId, java.lang.String query)		throws java.rmi.RemoteException {		Session session = getSession(sessionId);		QueryResponse resp = new QueryResponse();		resp.setHits(0);		DBBroker broker = null;		try {			query = StringValue.expand(query);			LOG.debug("query: " + query);			broker = pool.get(session.getUser());			XQueryContext context = new XQueryContext(broker);			DocumentSet docs = broker.getAllDocuments(new DocumentSet());			context.setStaticallyKnownDocuments(docs);						XQueryLexer lexer = new XQueryLexer(context, new StringReader(query));			XQueryParser parser = new XQueryParser(lexer);			XQueryTreeParser treeParser = new XQueryTreeParser(context);			parser.xpath();			if (parser.foundErrors()) {				LOG.debug(parser.getErrorMessage());				throw new RemoteException(parser.getErrorMessage());			}			AST ast = parser.getAST();			PathExpr expr = new PathExpr(context);			treeParser.xpath(ast, expr);			if (treeParser.foundErrors()) {				LOG.debug(treeParser.getErrorMessage());				throw new EXistException(treeParser.getErrorMessage());			}			LOG.info("query: " + expr.pprint());			long start = System.currentTimeMillis();			Sequence seq= expr.eval(null, null);			QueryResponseCollection[] collections = null;			if (seq.getLength() > 0 && Type.subTypeOf(seq.getItemType(), Type.NODE))				collections = collectQueryInfo(scanResults(seq));			session.addQueryResult(seq);			resp.setCollections(collections);			resp.setHits(seq.getLength());			resp.setQueryTime(System.currentTimeMillis() - start);			expr.reset();			context.reset();		} catch (Exception e) {			LOG.debug(e.getMessage(), e);			throw new RemoteException("query execution failed: " + e.getMessage());		} finally {			pool.release(broker);		}		return resp;	}