Package xbird.engine.request

Examples of xbird.engine.request.QueryRequest


    @Test(dataProvider = "scenario01", invocationCount = 20, threadPoolSize = 20)
    public void scenario01(String remoteEndpoint, String fileName) throws FileNotFoundException,
            IOException, XQueryException {
        XQEngine engine = new XQEngineClient(remoteEndpoint);
        String query = IOUtils.toString(new FileInputStream(fileName));
        QueryRequest request = new QueryRequest(query, ReturnType.ASYNC_REMOTE_SEQUENCE);
        Sequence<Item> resultSeq = (Sequence<Item>) engine.execute(request);
        Writer writer = new NoopWriter();
        SAXWriter saxwr = new SAXWriter(writer, "UTF-8");
        Serializer ser = new SAXSerializer(saxwr, writer);
        ser.emit(resultSeq);
View Full Code Here


        final Request request = rc.getRequest();
        final Signature rsig = request.getSignature();
        if(rsig != Signature.QUERY) {
            throw new IllegalStateException("Illegal command is passed to QueryProcessor: " + rsig);
        }
        final QueryRequest queryRequest = (QueryRequest) request;
        final String query = queryRequest.getQuery();
        if(query == null) {
            throw new IllegalStateException("query was null for: " + queryRequest);
        }

        // load shipped variables
        final XQueryModule module = new XQueryModule();
        final ShippedVariable[] vars = queryRequest.getShippedVariables();
        if(vars != null) {
            for(ShippedVariable var : vars) {
                try {
                    module.putVariable(var.getVarName(), var);
                } catch (XQueryException e) {
                    throw new RemoteException("failed to declare shipped variable: " + var, e);
                }
            }
        }

        final XQueryProcessor proccessor = new XQueryProcessor(module);
        try {
            proccessor.parse(query, queryRequest.getBaseUri());
        } catch (XQueryException e) {
            LOG.error("parse failed: \n" + query, e);
            rc.setFault(e);
            _resHandler.onResponse(rc);
            return;
View Full Code Here

        stdbuf.append(" - free(init): " + StringUtils.displayBytesSize(free));
        final StopWatch sw = new StopWatch("[Xbird] " + queryFile);
        queryFile = XMARK_HOME + '/' + queryFile;

        XQEngine engine = new XQEngineClient("//" + bindHost + ":1099/xbird/srv-01");
        QueryRequest request1 = new QueryRequest(IOUtils.toString(new FileInputStream(queryFile)), ReturnType.REMOTE_SEQUENCE);
        request1.setBaseUri(new File(queryFile).toURI());
        Object result1 = engine.execute(request1);
        RemoteSequence remoteSequence = (RemoteSequence) result1;

        StringWriter res_sw = new StringWriter();
        Serializer ser = new SAXSerializer(new SAXWriter(res_sw), res_sw);
View Full Code Here

TOP

Related Classes of xbird.engine.request.QueryRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.