Package com.volantis.xml.pipeline.sax

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


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

        XMLPipelineContext context = dynamicProcess.getPipelineContext();

        TryModel model = (TryModel) context.findObject(TryProcess.class);
        model.startBlock(element);

        dynamicProcess.addErrorRecoveryPoint();

        return model;
View Full Code Here


            ExpandedName element,
            Object object)
            throws SAXException {
        // retrieve the pipeline context so that we can determine if
        // the pipeline is in error recovery mode.
        XMLPipelineContext context = dynamicProcess.getPipelineContext();

        // determine if we are in error recovery mode before the superclasses
        // endElement is invoked as the error recovery mode is reset whenever
        // the attempt operation process is removed from the pipeline.
        boolean inErrorRecoveryMode = context.inErrorRecoveryMode();

        TryModel model = (TryModel) object;
        model.endBlock(this.element);

        // if attempt succeeded (ie the pipeline was not in error recovery
        // mode) then exit the current element, skipping any alternative
        // operations.
        if (!inErrorRecoveryMode) {
            context.getFlowControlManager().exitCurrentElement();
        }
    }
View Full Code Here

    // javadoc inherited
    public void setPipeline(XMLPipeline pipeline) {
        super.setPipeline(pipeline);

        XMLPipelineContext context = getPipelineContext();
        dependencyContext = context.getDependencyContext();
    }
View Full Code Here

    public void startBlock(Element element)
            throws SAXException {

        startElement(element);

        XMLPipelineContext context = getPipelineContext();
        recoveryPoint = context.addRecoveryPoint();
        XMLPipelineProcess pipeline =
                (XMLPipelineProcess) getPipeline().getPipelineProcess();
        XMLPipelineFactory factory = context.getPipelineFactory();
        recorder = factory.createPipelineRecorder();
        recorder.startRecording(pipeline);
        contentHandler = recorder.getRecordingHandler();
    }
View Full Code Here

        contentHandler = recorder.getRecordingHandler();
    }

    // Javadoc inherited.
    public void endBlock(Element element) throws SAXException {
        XMLPipelineContext context = getPipelineContext();
        if (!inErrorRecoveryMode) {

            // There was no error encountered during the processing of this
            // block of content.
            //
            // Propagate the dependencies upwards.
            dependencyContext.propagateDependencies();

            // Play the content back.
            PipelineRecording recording = recorder.stopRecording();
            PipelinePlayer player = recording.createPlayer();
            player.play(getNextProcess());

            // Remove the recovery point and keep the changes that have been
            // made to the pipeline context.
            context.removeRecoveryPoint(recoveryPoint, true);

            clearExceptions();

        } else {

            // An error occurred in this block.
            //
            // Discard all the changes made to the context since the recovery
            // point was created.
            context.removeRecoveryPoint(recoveryPoint, false);

            // Exit error recovery mode so that the next block can be tried.
            context.exitErrorRecoveryMode();

            // There was an error in the content so discard the dependencies.
            dependencyContext.clearDependencies();
        }
View Full Code Here

            logger.debug("An error was encountered. " +
                    "Invoking error recovery", exception);
        }
        inErrorRecoveryMode = true;
        listener.startErrorRecovery();
        XMLPipelineContext context = getPipelineContext();
        context.enterErrorRecoveryMode();
        if (logger.isDebugEnabled()) {
            logger.debug("Attempt failed ", exception);
        }

        addException(exception);
View Full Code Here

            throws SAXException {

        XMLProcess removed = removeProcess();
        // check that the correct process was removed.
        if (expected != removed) {
            XMLPipelineContext context = getPipelineContext();
            XMLPipelineException error = new XMLPipelineException(
                    "Expected to remove process " + expected +
                    "from the pipeline, but actually removed " + removed,
                    context.getCurrentLocator());
            // send the error down the pipeline
            fatalError(error);
        }
    }
View Full Code Here

    // Javadoc inherited.
    public Object startElement(
            DynamicProcess dynamicProcess, ExpandedName element,
            Attributes attributes) throws SAXException {

        XMLPipelineContext pipelineContext = dynamicProcess.getPipelineContext();
        ExpressionContext context = pipelineContext.getExpressionContext();

        // Get the expr attribute.
        String expr = attributes.getValue("expr");
        if (expr == null) {
            forwardError(dynamicProcess,
                    "'expr' attribute must be specified on " + element);
        } else {
            ExpressionFactory factory = ExpressionFactory.getDefaultInstance();
            ExpressionParser parser = factory.createExpressionParser();
            try {
                // Parse, and evaluate the expression.
                Expression expression = parser.parse(expr);
                Value value = expression.evaluate(context);

                // Stream the value's contents into the process following the
                // dynamic process. Don't do it into the dynamic process as
                // that will cause any markup to get reevaluated.
                value.streamContents(getTargetProcess(dynamicProcess));

            } catch (ExpressionException e) {
                dynamicProcess.fatalError(new XMLPipelineException(
                        "Error parsing '" + expr +
                        "' from expr attribute on " + element,
                        pipelineContext.getCurrentLocator(), e));
            }
        }

        return null;
    }
View Full Code Here

                                       Attributes attributes)
                throws SAXException {
        XMLProcess process = null;
        // we only add a process if the "active" attribute is set to true
        // and a DebugOutputFilesPrefix has been set on the pipeline context.
        XMLPipelineContext context =
                    dynamicProcess.getPipeline().getPipelineContext();
        String suffix = attributes.getValue(FILE_SUFFIX_ATTRIBUTE);
        String logFilePath =
                SerializeRule.calculateLogFilePath(context, suffix);
        boolean isActive = Boolean.valueOf(attributes.getValue(
View Full Code Here

            }
        });
        dynamicProcess.addProcess(process);

        TryModel model = process;
        XMLPipelineContext context = dynamicProcess.getPipelineContext();
        context.pushObject(model, false);

        model.startTry();

        return process;
    }
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.