Package com.volantis.xml.pipeline.sax

Examples of com.volantis.xml.pipeline.sax.XMLPipelineContext


        } catch (MalformedURLException e) {
            fail("Could not construct a java.net.URL instance");
        }
       
        // ensure the pipeline context has a current base uri
        XMLPipelineContext context
                = process.getPipeline().getPipelineContext();
        context.pushBaseURI(baseURI.toExternalForm());

        String localName = "localName";
        String namespaceURI = "";
        String qName = localName;               
       
View Full Code Here


        // call setDocumentLocator()
        process.setDocumentLocator(locator);
        process.startDocument();
       
        // get hold of the pipeline context
        XMLPipelineContext context
                = process.getPipeline().getPipelineContext();
       
        // ensure that the XMLPipelineContext has a current locator and
        // base uri
        assertNotNull(
                "XMLPipelineContext should have a non null current locator",
                context.getCurrentLocator());

        assertNotNull(
                "XMLPipelineContext should have a non null current base URI",
                context.getCurrentBaseURI());
       
        // invoke the method that is being tested
        process.endDocument();
       
        // ensure that the pipeline context has had both the current locator
        // and base uri popped off.
        assertNull("endDocument should pop the current locator",
                   context.getCurrentLocator());

        assertNull("endDocument should pop the current base uri",
                   context.getCurrentBaseURI());
       
        // ensure that the event is not forwarded to the next process
        next.assertEndDocumentNotInvoked();
    }
View Full Code Here

       
        // invoke the method that is being tested
        process.startPrefixMapping(prefix, namespace);

        // get hold of the pipeline context
        XMLPipelineContext context
                = process.getPipeline().getPipelineContext();
       
        // ensure that the pipeline contexts NamespacePrefixTracker has
        // been updated       
        NamespacePrefixTracker tracker = context.getNamespacePrefixTracker();

        assertEquals("NamespacePrefixTracker was not updated with the " +
                     "startPrefixMapping event",
                     namespace,
                     tracker.getNamespaceURI(prefix));      
View Full Code Here

        // set the next process
        XMLProcessTestable next = new XMLProcessTestable();
        process.setNextProcess(next);

        // get hold of the pipeline context
        XMLPipelineContext context
                = process.getPipeline().getPipelineContext();
       
        // Update pipeline contexts NamespacePrefixTracker with a prefix
        // and namespace pair
        NamespacePrefixTracker tracker = context.getNamespacePrefixTracker();
        tracker.startPrefixMapping(prefix, namespace);

        assertEquals("NamespacePrefixTracker was not updated with the " +
                     "startPrefixMapping event",
                     namespace,
View Full Code Here

     * @throws SAXException If there was a problem.
     */
    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.
View Full Code Here

    // Javadoc inherited.
    public Object startElement(
            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);
                }

                // Remember to pop the block scope off after the content has
                // been processed.
                action = new PopBlockScopeAction();

            } else {

                // Make the dynamic process pass the element contents straight
                // through without evaluating them so that they can be recprded
                // and evaluated for each value of the variable. The dynamic
                // process will automatically come out of pass through mode
                // once it sees the matching end element event.
                dynamicProcess.passThroughElementContents();

                XMLPipelineFactory factory = context.getPipelineFactory();
                final PipelineRecorder recorder =
                        factory.createPipelineRecorder();
                recorder.startRecording(dynamicProcess.getPipeline());

                final XMLProcess process = recorder.getRecordingProcess();
View Full Code Here

    // Javadoc inherited.
    public void doAction(DynamicProcess dynamicProcess)
            throws SAXException {

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

        expressionContext.popBlockScope();
    }
View Full Code Here

                DynamicProcessConfiguration.class,
                dynamicConfig);
       
        // create a XMLPipelineContext
        EnvironmentInteraction interaction = null;
        XMLPipelineContext context = factory.createPipelineContext(
                    pipelineConfiguration,
                    interaction);

        // create a pipeline
        XMLPipeline pipeline = factory.createDynamicPipeline(context);
View Full Code Here

        attrs.setValue("portType", thePortType);
        attrs.setValue("operation", theOperationName);

        process.processAttributes(attrs);

        XMLPipelineContext context = process.getPipelineContext();
        Operation operation = (Operation) context.getProperty(Operation.class);

        assertNotNull(operation);

        assertEquals(theWsdl, operation.retrieveWSDLURI());
        assertEquals(thePortType, operation.getPortType());
View Full Code Here

                DynamicProcessConfiguration.class,
                dynamicConfig);
       
        // create a XMLPipelineContext
        EnvironmentInteraction interaction = null;
        XMLPipelineContext context = factory.createPipelineContext(
                pipelineConfiguration,
                interaction);

        // create a pipeline
        XMLPipeline pipeline = factory.createDynamicPipeline(context);
View Full Code Here

TOP

Related Classes of com.volantis.xml.pipeline.sax.XMLPipelineContext

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.