Package com.volantis.xml.pipeline.sax.impl.dynamic

Examples of com.volantis.xml.pipeline.sax.impl.dynamic.ContextManagerProcess


    }

    // javadoc ineherited
    public XMLProcess createContextUpdatingProcess() {

        return new ContextManagerProcess();
    }
View Full Code Here


    // Javadoc inherited.
    public void play(XMLProcess process) throws SAXException {

        XMLPipeline pipeline = process.getPipeline();

        ContextManagerProcess cup = new ContextManagerProcess();
        cup.setPipeline(pipeline);

        cup.setNextProcess(process);
        cup.startProcess();

        XMLPipelineContext context = pipeline.getPipelineContext();
        Locator playLocator = player.getLocator();
        context.pushLocator(playLocator);
        manager = context.getFlowControlManager();
        try {
            player.setContentHandler(cup);
            player.setFlowController(this);
            player.play();
        } catch (SAXException x) {
            // Catching, logging and re-throwing because this exception may get lost
            // in case of IllegalStateException thrown inside finally
            logger.error(x);
            throw x;
        } finally {
            manager = null;

            Locator poppedLocator = (Locator) context.popLocator();
            if (poppedLocator != playLocator) {
                if (logger.isDebugEnabled()) {
                    String pushed = (null != playLocator) ? playLocator.getPublicId() : "null";
                    String popped = (null != poppedLocator) ? poppedLocator.getPublicId() : "null";
                    logger.debug("Popped locator does not match pushed locator." +
                            " Pushed: " + pushed +
                            " Popped: " + popped);
                }
                throw new IllegalStateException(
                        "Popped locator does not match pushed locator");
            }
        }
        // TODO: move it to finally or explain why this is not inside finally
        cup.stopProcess();
    }
View Full Code Here

    // Javadoc inherited.
    public void play(XMLProcess process) throws SAXException {

        XMLPipeline pipeline = process.getPipeline();

        ContextManagerProcess cup = new ContextManagerProcess();
        cup.setPipeline(pipeline);

        cup.setNextProcess(process);
        cup.startProcess();

        XMLPipelineContext context = pipeline.getPipelineContext();
        Locator playLocator = player.getLocator();
        context.pushLocator(playLocator);
        manager = context.getFlowControlManager();
        try {
            player.setContentHandler(cup);
            player.setFlowController(this);
            player.play();
        } catch (SAXException x) {
            // Catching, logging and re-throwing because this exception may get lost
            // in case of IllegalStateException thrown inside finally
            logger.error(x);
            throw x;
        } finally {
            manager = null;

            Locator poppedLocator = (Locator) context.popLocator();
            if (poppedLocator != playLocator) {
                if (logger.isDebugEnabled()) {
                    String pushed = (null != playLocator) ? playLocator.getPublicId() : "null";
                    String popped = (null != poppedLocator) ? poppedLocator.getPublicId() : "null";
                    logger.debug("Popped locator does not match pushed locator." +
                            " Pushed: " + pushed +
                            " Popped: " + popped);
                }
                throw new IllegalStateException(
                        "Popped locator does not match pushed locator");
            }
        }
        // TODO: move it to finally or explain why this is not inside finally
        cup.stopProcess();
    }
View Full Code Here

            if (value instanceof Element) {
                // This is a DOM Element. Use DOMToSAX.
                Node node = (Node)value;
                DOMToSAX dom2SAX = new DOMToSAX(node);

                ContextManagerProcess cup = new ContextManagerProcess(true);
                cup.setPipeline(getPipeline());
                cup.setNextProcess(consumer);
                dom2SAX.setContentHandler(cup);

                dom2SAX.parse();
            } else {
                // Just a bunch of characters.
View Full Code Here

        XMLPipelineContext context = getPipelineContext();
        if (!context.inErrorRecoveryMode()) {
            // run through the list of Transformer handlers and set up the
            // transformations

            XMLProcess cup = new ContextManagerProcess(true);
            cup.setPipeline(getPipeline());
            final XMLProcess next = getNextProcess();
            setNextProcess(cup);
            cup.setNextProcess(next);

            TransformerHandler transformerHandler = null;
            ContentHandler handler = getNextProcess();
            for (int i = templatesList.size() - 1; i >= 0; i--) {
                Templates templates = (Templates) templatesList.get(i);
View Full Code Here

        super(name);
    }

    // javadoc inherited
    protected XMLProcess createTestableProcess() {
        ContextManagerProcess process = new ContextManagerProcess();
        initializeProcess(process);
        return process;
    }
View Full Code Here

        ContextAnnotatingProcess cap = new ContextAnnotatingProcess();
        initializeProcess(cap);
        cap.setNextProcess(consumer);

        ContextManagerProcess cmp = new ContextManagerProcess();
        cmp.setPipeline(cap.getPipeline());
        cmp.setNextProcess(cap);

        XMLReader reader = XMLReaderFactory.createXMLReader(false);
        reader.setContentHandler(cmp);

        reader.parse(inputSource);
View Full Code Here

TOP

Related Classes of com.volantis.xml.pipeline.sax.impl.dynamic.ContextManagerProcess

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.