Package xbird.xquery.expr.opt

Examples of xbird.xquery.expr.opt.ShippedVariable


        final ArrayList<ShippedVariable> shippedVars = new ArrayList<ShippedVariable>(4);
        ShippedVariableCollector collector = new ShippedVariableCollector(shippedVars);
        collector.visit(_queryExpr, null);
        final int numVars = shippedVars.size();
        for(int i = 0; i < numVars; i++) {
            ShippedVariable sv = shippedVars.get(i);
            prepareVariablesToShip(svRequest, sv, contextSeq, dynEnv);
        }

        final List<String> endpoints = getEndpoints(_endpoint, contextSeq, dynEnv);
        final int numEndpoints = endpoints.size();
View Full Code Here


        public XQExpression visit(VarRef ref, XQueryContext ctxt) throws XQueryException {
            Variable var = ref.getValue();
            if(!var.isInsideRemoteExpr()) {
                if(var.isAnalyzed()) {
                    var.staticAnalysis(_statEnv);
                    ShippedVariable shippedVar = new ShippedVariable(var, _counter++);
                    _variablesHolder.add(shippedVar);
                    ref.setValue(shippedVar);
                }
            }
            return ref;
View Full Code Here

        @Override
        public XQExpression visit(VarRef ref, XQueryContext ctxt) throws XQueryException {
            final Variable var = ref.getValue();
            if(var instanceof ShippedVariable) {
                ShippedVariable shippedVar = (ShippedVariable) var;
                int shippedId = shippedVar.getIdentifier();
                ShippedVariable original = _variablesHolder.get(shippedId);
                XQExpression originalExpr = original.getValue();
                shippedVar.setValue(originalExpr);
                shippedVar.setLocal(true);
            }
            return ref;
        }
View Full Code Here

    private void prepareVariablesToShip(QueryRequest request, ValueSequence contextSeq, DynamicContext dynEnv)
            throws XQueryException {
        if(thirdParam != null) {
            final List<ShippedVariable> vars = new ArrayList<ShippedVariable>(4);
            if(thirdParam instanceof VarRef) {
                final ShippedVariable shiped = wrapVariableToShip(request, (VarRef) thirdParam, contextSeq, dynEnv);
                vars.add(shiped);
            } else if(thirdParam instanceof SequenceExpression) {
                final SequenceExpression seq = (SequenceExpression) thirdParam;
                final List<XQExpression> exprs = seq.getExpressions();
                for(XQExpression e : exprs) {
                    if(e instanceof VarRef) {
                        final ShippedVariable shiped = wrapVariableToShip(request, (VarRef) e, contextSeq, dynEnv);
                        vars.add(shiped);
                    }
                }
            }
            final int varsSize = vars.size();
View Full Code Here

        Sequence result = var.getResult();
        if(result == null) {
            result = var.eval(contextSeq, dynEnv);
        }
        ReturnType rettype = request.getReturnType();
        final ShippedVariable shiped;
        if(ENV_NOWRAP_VARSHIP || !rettype.isRemoteSequnece()) {
            shiped = new ShippedVariable(varname, new MarshalledSequence(result, dynEnv));
        } else {
            final RemoteSequenceProxy proxy = new RemoteSequenceProxy(result, request);
            try {
                UnicastRemoteObject.exportObject(proxy, 0, TimeoutSocketProdiver.createClientSocketFactory(), TimeoutSocketProdiver.createServerSocketFactory());
            } catch (RemoteException e) {
                throw new XQueryException("failed exporting variable: " + varname, e);
            }
            RemoteSequence remote = new RemoteSequence(proxy, result.getType());
            shiped = new ShippedVariable(varname, remote);
        }
        return shiped;
    }
View Full Code Here

TOP

Related Classes of xbird.xquery.expr.opt.ShippedVariable

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.