Examples of TreeProcessor


Examples of org.apache.cocoon.components.treeprocessor.TreeProcessor

      throws Exception {

        Map objectModel = env.getObjectModel();

        String resolvedSource = this.source.resolve(context, objectModel);
        TreeProcessor processor = getProcessor(resolvedSource);

        String resolvedPrefix = this.prefix.resolve(context, objectModel);

        String oldPrefix = env.getURIPrefix();
        String oldURI    = env.getURI();
        String oldContext   = env.getContext();
        try {
            env.changeContext(resolvedPrefix, resolvedSource);

            if (context.isBuildingPipelineOnly()) {
                // Propagate pipelines
                ProcessingPipeline pp = processor.buildPipeline(env);
                if ( pp != null ) {
                    context.setProcessingPipeline( pp );
                    return true;
                } else {
                    return false;
                }
            } else {
                // Processor will create its own pipelines
                return processor.process(env);
            }
        } finally {
            // Restore context
      env.setContext(oldPrefix, oldURI, oldContext);
View Full Code Here

Examples of org.apache.cocoon.components.treeprocessor.TreeProcessor

        }
    }

    private synchronized TreeProcessor getProcessor(String source) throws Exception {

        TreeProcessor processor = (TreeProcessor)processors.get(source);

        if (processor == null) {
            // Handle directory mounts
            String actualSource;
            if (source.charAt(source.length() - 1) == '/') {
View Full Code Here

Examples of org.apache.cocoon.components.treeprocessor.TreeProcessor

      throws Exception {

        Map objectModel = env.getObjectModel();

        String resolvedSource = this.source.resolve(context, objectModel);
        TreeProcessor processor = getProcessor(resolvedSource);

        String resolvedPrefix = this.prefix.resolve(context, objectModel);

        String oldPrefix = env.getURIPrefix();
        String oldURI    = env.getURI();
        String oldContext   = env.getContext();
        try {
            env.changeContext(resolvedPrefix, resolvedSource);

            if (context.isBuildingPipelineOnly()) {
                // Propagate pipelines
                ProcessingPipeline pp = processor.buildPipeline(env);
                if ( pp != null ) {
                    context.setProcessingPipeline( pp );
                    return true;
                } else {
                    return false;
                }
            } else {
                // Processor will create its own pipelines
                return processor.process(env);
            }
        } finally {
            // Restore context
      env.setContext(oldPrefix, oldURI, oldContext);
View Full Code Here

Examples of org.apache.cocoon.components.treeprocessor.TreeProcessor

        }
    }

    private synchronized TreeProcessor getProcessor(String source) throws Exception {

        TreeProcessor processor = (TreeProcessor)processors.get(source);

        if (processor == null) {
            // Handle directory mounts
            String actualSource;
            if (source.charAt(source.length() - 1) == '/') {
View Full Code Here

Examples of org.apache.cocoon.components.treeprocessor.TreeProcessor

                (ServiceManager) this.cocoonBeanFactory.getBean(AvalonUtils.SERVICE_MANAGER_ROLE);

            // create the tree processor
            Processor processor;
            try {
                processor = new TreeProcessor();
                ContainerUtil.service(processor, serviceManager);
                ContainerUtil.configure(processor, config);
                ContainerUtil.initialize(processor);
            } catch (Exception e) {
                throw new BeanCreationException("Could not create TreeProcessor", e);
View Full Code Here

Examples of org.apache.cocoon.components.treeprocessor.TreeProcessor

        // Handle directory mounts
        if (resolvedSource.charAt(resolvedSource.length() - 1) == '/') {
            resolvedSource = resolvedSource + "sitemap.xmap";
        }

        TreeProcessor processor = getProcessor(resolvedSource, resolvedPrefix);

        // Save context
        String oldPrefix = env.getURIPrefix();
        String oldURI    = env.getURI();
        Object oldPassThrough = env.getAttribute(COCOON_PASS_THROUGH);
        env.setAttribute(COCOON_PASS_THROUGH, this.passThrough);

        try {
            processor.getEnvironmentHelper().changeContext(env);

            if (context.isBuildingPipelineOnly()) {
                // Propagate pipelines
                Processor.InternalPipelineDescription pp = processor.buildPipeline(env);
                if (pp != null) {
                    context.setInternalPipelineDescription(pp);
                    return true;
                }

                return false;
            }

            // Processor will create its own pipelines
            return processor.process(env);
        } catch(Exception e) {
            // Wrap with our location
            throw ProcessingException.throwLocated("Sitemap: error when calling sub-sitemap", e, getLocation());

        } finally {
View Full Code Here

Examples of org.apache.cocoon.components.treeprocessor.TreeProcessor

    }

    private synchronized TreeProcessor getProcessor(String source, String prefix)
    throws Exception {

        TreeProcessor processor = (TreeProcessor) processors.get(source);
        if (processor == null) {
            processor = this.parentProcessor.createChildProcessor(source, this.checkReload, prefix);

            // Associate to the original source
            processors.put(source, processor);
View Full Code Here

Examples of org.apache.cocoon.components.treeprocessor.TreeProcessor

        List mapStack = context.getMapStack();
        Map objectModel = env.getObjectModel();

        String resolvedSource = this.source.resolve(context, objectModel);
        TreeProcessor processor = (TreeProcessor)processors.get(resolvedSource);
        if (processor == null) {
            processor = getProcessor(env, resolvedSource);
        }

        String resolvedPrefix = this.prefix.resolve(context, objectModel);

        String oldPrefix = env.getURIPrefix();
        String oldURI    = env.getURI();
        try {
            env.changeContext(resolvedPrefix, resolvedSource);

            if (context.isInternalRequest()) {
                // Propagate pipelines
                return processor.process(env, context.getStreamPipeline(), context.getEventPipeline());
            } else {
                // Processor will create its own pipelines
                return processor.process(env);
            }

        } finally {
            // Restore context
            env.setContext(oldPrefix, oldURI);
View Full Code Here

Examples of org.apache.cocoon.components.treeprocessor.TreeProcessor

        }
    }

    private synchronized TreeProcessor getProcessor(Environment env, String source) throws Exception {

        TreeProcessor processor = (TreeProcessor)processors.get(source);

        if (processor == null) {

            // Handle directory mounts
            String actualSource;
View Full Code Here

Examples of org.apache.cocoon.components.treeprocessor.TreeProcessor

        String resolvedPrefix = this.prefix.resolve(context, objectModel);

        if (resolvedSource.length() == 0) {
            throw new ProcessingException("Source of mount statement is empty");
        }
        TreeProcessor processor = getProcessor(resolvedSource);

        // Save context
        String oldPrefix = env.getURIPrefix();
        String oldURI    = env.getURI();
        String oldContext   = env.getContext();
        Object oldPassThrough = env.getAttribute(COCOON_PASS_THROUGH);
        env.setAttribute(COCOON_PASS_THROUGH, this.passThrough);

        boolean pipelineWasBuilt = false;

        try {
            env.changeContext(resolvedPrefix, resolvedSource);

            if (context.isBuildingPipelineOnly()) {
                // Propagate pipelines
                ProcessingPipeline pp = processor.buildPipeline(env);
                if (pp != null) {
                    context.setProcessingPipeline( pp );
                    pipelineWasBuilt = true;
                }
            } else {
                // Processor will create its own pipelines
                pipelineWasBuilt = processor.process(env);
            }
        } catch(Exception e) {
            // Wrap with our location
            throw ProcessingException.throwLocated("Sitemap: error when calling sub-sitemap", e, getLocation());
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.