Examples of XMLPipelineContext


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

    }

    // javadoc inherited from interface
    public void stopProcess() throws SAXException {

        XMLPipelineContext context = getPipelineContext();

        context.setProperty(Message.class, message, false);

        message = null;
    }
View Full Code Here

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

    // javadoc inherited
    public void insert(XMLPipeline target, String parameter)
            throws SAXException {

        XMLPipelineContext context = target.getPipelineContext();

        if (evaluationMode == EvaluationMode.DEFERRED) {

            // Get a new event recorder to be populated with the required
            // events. This is needed because we only want to preprocess
            // the events once, on first use of this value, in DEFERRED mode,
            // thereafter simply replaying these preprocessed events
            XMLPipelineFactory factory = context.getPipelineFactory();
            PipelineRecorder processedEventRecorder =
                    factory.createPipelineRecorder();
            processedEventRecorder.startRecording(target);

            // The following process collects the preprocessed events
            // without permitting the events to be replayed to the rest
            // of the pipeline. This allows the preprocessing to be
            // performed before checking the complexity of the SAX
            // events
            XMLProcess process = processedEventRecorder.getRecordingProcess();

            // Make sure that the pipeline will direct all preprocessed
            // SAX events to the new event recorder
            target.addHeadProcess(process);

            // This will cause the original event recorder to send the
            // original SAX events to the target pipeline which will
            // then preprocess them (we assume) and send them to the
            // event collection process
            try {
                PipelinePlayer player = recording.createPlayer();
                player.play(target.getPipelineProcess());
                recording = processedEventRecorder.stopRecording();
            } finally {
                // Must always remove the collection process so that the
                // pipeline isn't messed up
                target.removeHeadProcess();
            }

            evaluationMode = EvaluationMode.IMMEDIATE;
        }

        // Verify that the event recorder contains compatible markup
        if (complexity != Complexity.COMPLEX) {
            if (evaluationMode == EvaluationMode.REPEATED) {
                // Add a process that will only allow characters and ignorable
                // whitespace events through to perform the complexity testing
                addComplexityChecker(target, parameter);
            } else if (recording.isComplex()) {
                throw new XMLPipelineException("The " + parameter +
                        " value's type is simple but complex markup " +
                        "has been found", null);
            }
        }

        try {
            // Add the dependency information for this value to the pipeline.
            DependencyContext dependencyContext =
                    context.getDependencyContext();
            dependencyContext.addDependency(dependency);

            XMLProcess process;

            // Select the process to which the content should be sent based
View Full Code Here

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

    // rest of javadoc inherited
    public void startElement(String namespace, String localName,
                             String qName, Attributes attributes)
            throws SAXException {

        XMLPipelineContext context = getPipelineContext();

        // All elements should be in a different namespace from the
        // message.
        if (getProcessNamespaceURI().equals(namespace)) {
            Locator locator = context.getCurrentLocator();
            String message = "Message parts must be in a different " +
                    "namespace from the message";
            fatalError(new XMLStreamingException(message, locator));
        }

        if (nestedElementLevel == 0) {
            // This must be the start of a part.();
            currentPart = new Part();
            currentPart.setName(localName);

            // If part namespace is not in the pipeline context then store it.
            Object test = context.getProperty(RequestOperationProcess.
                                              PART_NAMESPACE_URI_KEY);
            if (test == null) {
                context.setProperty(
                        RequestOperationProcess.PART_NAMESPACE_URI_KEY,
                        namespace, false);
            }

            // If part prefix is not in the pipeline context then store it.
            // The namespace and prefix are used to supply the response
            // message parts with namespaces and prefixes.
            if (qName != null) {
                test = context.
                        getProperty(RequestOperationProcess.PART_PREFIX_KEY);

                int colonIndex = qName.indexOf(':');
                if (test == null && colonIndex != -1) {
                    String partPrefix = qName.substring(0, colonIndex);
                    context.setProperty(
                            RequestOperationProcess.PART_PREFIX_KEY,
                            partPrefix, false);
                }
            }
            partValueBuffer = new StringBuffer();
View Full Code Here

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

            throws SAXException {

        // All elements should be in a different namespace from the
        // message.
        if (getProcessNamespaceURI().equals(namespace)) {
            XMLPipelineContext context = getPipelineContext();
            Locator locator = context.getCurrentLocator();
            String message = "Message parts must be in a different " +
                    "namespace from the message";
            fatalError(new XMLStreamingException(message, locator));
        }

        nestedElementLevel--;

        if (nestedElementLevel == 0) {
            // This must be the end of the current part.
            if (!currentPart.getName().equals(localName)) {
                // This should never happen because the document is supposed
                // to be valid before it reaches this process....But just in
                // case.
                XMLPipelineContext context = getPipelineContext();
                Locator locator = context.getCurrentLocator();
                String message = "Parts out of sync. Current part is " +
                        currentPart.getName() + " current endElement is " +
                        localName;
                fatalError(new XMLStreamingException(message, locator));
            }
View Full Code Here

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

    public void characters(char[] buffer, int start, int offset)
            throws SAXException {

        // todo encode the characters
        if (nestedElementLevel == 0 && !isWhitespace(buffer, start, offset)) {
            XMLPipelineContext context = getPipelineContext();
            Locator locator = context.getCurrentLocator();
            String message = "No part seems to be associated with these " +
                    "characters since nestedElementLevel is 0";
            fatalError(new XMLStreamingException(message, locator));
        } else if (nestedElementLevel != 0) {
            partValueBuffer.append(buffer, start, offset);
View Full Code Here

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

            } else {
                // Need the pipeline to be an instance of
                // XMLPipelineProcessImpl but wasn't. Deliver a fatal error
                // down the pipeline.
                XMLPipelineContext context = pipeline.getPipelineContext();
                XMLPipelineException error = new XMLPipelineException(
                        "Expected pipeline to be instance of " +
                        "XMLPipelineProcessImpl, but was " +
                        pipeline.getClass(),
                        context.getCurrentLocator());
                // send the error down the pipeline
                pipeline.getPipelineProcess().fatalError(error);
            }
        }
        // return the process that was added
View Full Code Here

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

            dynamicProcess.removeProcess(process);
        } else {
            // If the process is null and we are in Error Recovery Mode,
            // it's a correct situation - it means we are recovering from an
            // error in our own start element
            XMLPipelineContext context = dynamicProcess.getPipelineContext();
            if (context.inErrorRecoveryMode()) {
                dynamicProcess.removeProcess();
            }
        }
    }
View Full Code Here

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

     * @return the qname as a string
     */
    private String calculateQName(DynamicProcess dynamicProcess,
                                  ExpandedName expandedName) {
        // retrieve the PipelineContext
        XMLPipelineContext context =
                dynamicProcess.getPipeline().getPipelineContext();
        // get hold of the NamespacePrefixTracker so that we can
        // access the registered prefixes
        NamespacePrefixTracker prefixTracker =
                context.getNamespacePrefixTracker();
        // obtain the prefix for the specified namespace URI
        String prefix = prefixTracker.getNamespacePrefix(
                expandedName.getNamespaceURI());
        // local name
        String qName = expandedName.getLocalName();
View Full Code Here

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

     * Performs the actual inclusion
     * @throws SAXException if an error occurs
     */
    public void doIncludeServerResource() throws SAXException {
        // retrieve the pipeline context
        XMLPipelineContext context = getPipelineContext();
        if (!context.inErrorRecoveryMode()) {
            // Get the Servleet request and response from the header
            ServletRequest request = (ServletRequest)context.getProperty(
                    ServletRequest.class);

            ServletResponse response = (ServletResponse)context.getProperty(
                    ServletResponse.class);

            // this process cannot execute with either of these two objects so
            // throw an exception if either one or both is missing
            if (request == null || response == null) {
                Locator locator = context.getCurrentLocator();
                XMLProcessingException xmlException =
                        new XMLProcessingException(
                                "Null request and response objects in context",
                                locator);
                fatalError(xmlException);
View Full Code Here

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

        Map map = null;
        if ((action != null) && (type != null)) {

            // Add the content to the map in the context.
            XMLPipelineContext context = dynamicProcess.getPipelineContext();
            Content content = new Content(type,
                    ContentAction.getContentAction(action));

            map = getContentMap(context);
            map.put(type, content);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.