Package com.volantis.xml.expression

Examples of com.volantis.xml.expression.InternalExpressionContext


    public void iterate(DynamicProcess dynamicProcess)
            throws SAXException {
       
        XMLPipelineContext pipelineContext =
                dynamicProcess.getPipeline().getPipelineContext();
        InternalExpressionContext expressionContext =
                (InternalExpressionContext)
                pipelineContext.getExpressionContext();

        PipelinePlayer player = recording.createPlayer();

        // Push a new scope to contain the variable and shadow any variable
        // with the same name.
        expressionContext.pushBlockScope();

        // Push a new position scope to track the iteration position
        expressionContext.pushPositionScope();
        PositionScope pc = expressionContext.getPositionScope();

        // Declare an unitialized variable.
        InternalExpressionScope scope = (InternalExpressionScope)
                expressionContext.getCurrentScope();
        Variable variable = scope.declareVariable(variableName);

        // Iterate over the sequence.
        int length = sequence.getLength();

        for (int i = 1; i <= length; i += 1) {
            // Increment to the next position in the sequence
            pc.increment();

            // Get the item.
            try {
                variable.setValue(sequence.getItem(i));
            } catch (SequenceIndexOutOfBoundsException e) {
                throw new ExtendedSAXException(e);
            }

            // Replay the events through the dynamic process.
            player.play(dynamicProcess);
        }

        // Make sure to pop the scope for tracking position the one that
        // contains the variable.
        expressionContext.popPositionScope();
        expressionContext.popBlockScope();
    }
View Full Code Here


            DynamicProcess dynamicProcess, ExpandedName expandedName,
            Attributes attributes) throws SAXException {

        XMLPipelineContext context =
                dynamicProcess.getPipeline().getPipelineContext();
        InternalExpressionContext expressionContext =
                (InternalExpressionContext)
                context.getExpressionContext();

        // The iterator that is returned.
        EndElementAction action;

        // Evaluate the in expression to a sequence.
        String inExpression = attributes.getValue("in");
        final Sequence sequence = evaluateExpression(expressionContext, inExpression);
        int length = sequence.getLength();
        if (length == 0) {
            // The sequence is empty so there is nothing to do so just skip
            // the body and do not create an iterator.
            context.getFlowControlManager().exitCurrentElement();
            action = EndElementAction.DO_NOTHING;
        } else {

            // Resolve the variable name into an ExpandedName, if the variable
            // name does not have a prefix then it belongs in no namespace,
            // rather than the default namespace.
            String variableName = attributes.getValue("variable");
            QName variableQName = new ImmutableQName(variableName);
            final ExpandedName variableExpandedName =
                    context.getNamespacePrefixTracker()
                    .resolveQName(variableQName, null);

            // If the sequence only has a single value in then it is not
            // necessary to store the body away to be evaluated multiple times.
            if (length == 1) {

                // Create a new block scope to contain the variable.
                expressionContext.pushBlockScope();

                // Create a variable in the current stack frame.
                try {
                    expressionContext.getCurrentScope()
                            .declareVariable(variableExpandedName,
                                    sequence.getItem(1));
                } catch (SequenceIndexOutOfBoundsException e) {
                    throw new ExtendedSAXException(e);
                }
View Full Code Here

    public void doAction(DynamicProcess dynamicProcess)
            throws SAXException {

        XMLPipelineContext pipelineContext =
                dynamicProcess.getPipeline().getPipelineContext();
        InternalExpressionContext expressionContext =
                (InternalExpressionContext)
                pipelineContext.getExpressionContext();

        expressionContext.popBlockScope();
    }
View Full Code Here

TOP

Related Classes of com.volantis.xml.expression.InternalExpressionContext

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.