Package org.apache.cocoon.components.treeprocessor

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


    for (int i = 0; i < childConfigs.length; i++) {

      Configuration childConfig = childConfigs[i];
      if (isChild(childConfig)) {

        ProcessingNodeBuilder builder = this.treeBuilder.createNodeBuilder(childConfig);
        if (builder instanceof HandleErrorsNodeBuilder) {
          handler = (HandleErrorsNode)builder.buildNode(childConfig);
        } else {
          // Regular builder
          children.add(builder.buildNode(childConfig));
        }
      }
    }
        if (children.size() == 0) {
            String msg = "There must be at least one pipeline at " + config.getLocation();
View Full Code Here


            Configuration childConfig = childConfigs[i];
            if (!isChild(childConfig)) {
                continue childLoop;
            }

            ProcessingNodeBuilder builder = this.treeBuilder.createNodeBuilder(childConfig);

            if (builder instanceof HandleErrorsNodeBuilder) {
                // Error handler : check type
                HandleErrorsNode handler = (HandleErrorsNode)builder.buildNode(childConfig);
                int type = handler.getStatusCode();

                if ( (type == 404 && error404Handler != null) ||
                     (type == 500 && error500Handler != null) ) {
                    String msg = "Duplicate handle-errors at " + handler.getLocation();
                    getLogger().error(msg);
                    throw new ConfigurationException(msg);
                }

                if (type == 404) {
                    error404Handler = handler;
                } else if (type == 500) {
                    error500Handler = handler;
                } else {
                    String msg = "Unkown handle-errors type (" + type + ") at " + handler.getLocation();
                    getLogger().error(msg);
                    throw new ConfigurationException(msg);
                }

            } else {
                // Regular builder
                children.add(builder.buildNode(childConfig));
            }
        }

        node.setChildren(toNodeArray(children));
        node.set404Handler(error404Handler);
View Full Code Here

       
        // Start by explicitely ordered children
        for (int i = 0; i < orderedNames.length; i++) {
            Configuration childConfig = config.getChild(orderedNames[i], false);
            if (childConfig != null) {
                ProcessingNodeBuilder builder = this.treeBuilder.createNodeBuilder(childConfig);
                // Don't build them since "pipelines" is not present in this list
                builder.buildNode(childConfig);
            }
        }
       
        ProcessingNode pipelines = null;

        // Now build all those that have no particular order
        Configuration[] childConfigs = config.getChildren();
       
        loop: for (int i = 0; i < childConfigs.length; i++) {
           
            Configuration childConfig = childConfigs[i];
            if (isChild(childConfig)) {
                // Is it in the ordered list ?
                for (int j = 0; j < orderedNames.length; j++) {
                    if (orderedNames[j].equals(childConfig.getName())) {
                        // yep : already built above
                        continue loop;
                    }
                }
               
                ProcessingNodeBuilder builder = this.treeBuilder.createNodeBuilder(childConfig);
                ProcessingNode node = builder.buildNode(childConfig);
                if (node instanceof PipelinesNode) {
                    if (pipelines != null) {
                        String msg = "Only one 'pipelines' is allowed, at " + childConfig.getLocation();
                        throw new ConfigurationException(msg);
                    }
View Full Code Here

    for (int i = 0; i < childConfigs.length; i++) {

      Configuration childConfig = childConfigs[i];
      if (isChild(childConfig)) {

        ProcessingNodeBuilder builder = this.treeBuilder.createNodeBuilder(childConfig);
        if (builder instanceof HandleErrorsNodeBuilder) {
          handler = (HandleErrorsNode)builder.buildNode(childConfig);
        } else {
          // Regular builder
          children.add(builder.buildNode(childConfig));
        }
      }
    }
        if (children.size() == 0) {
            String msg = "There must be at least one pipeline at " + config.getLocation();
View Full Code Here

        for (int i = 0; i < childConfigs.length; i++) {

            Configuration childConfig = childConfigs[i];
            if (isChild(childConfig)) {

                ProcessingNodeBuilder builder = this.treeBuilder.createNodeBuilder(childConfig);
                if (builder instanceof HandleErrorsNodeBuilder) {
                    // Error handler : check type
                    HandleErrorsNode handler = (HandleErrorsNode)builder.buildNode(childConfig);
                    int status = handler.getStatusCode();

          switch(status) {
              case -1: // main handler (needs generator)
                  if (mainHandler != null) {
                      throw new ConfigurationException("Duplicate <handle-errors> at " + handler.getLocation());
                  } else if (error500Handler != null || error404Handler != null) {
                      throw new ConfigurationException("Cannot mix <handle-errors> with and without 'type' attribute at " +
                          handler.getLocation());
                  } else {
                      mainHandler = handler;
                  }
              break;
             
              case 404:
                  if (error404Handler != null) {
                      throw new ConfigurationException("Duplicate <handle-errors type='404' at " + handler.getLocation());
                  } else if(mainHandler != null) {
                                throw new ConfigurationException("Cannot mix <handle-errors> with and without 'type' attribute at " +
                                    handler.getLocation());
                  } else {
                      error404Handler = handler;
                  }
              break;
             
              case 500:
                if (error500Handler != null) {
                                throw new ConfigurationException("Duplicate <handle-errors type='500' at " + handler.getLocation());
                } else if (mainHandler != null) {
                                throw new ConfigurationException("Cannot mix <handle-errors> with and without 'type' attribute at " +
                                    handler.getLocation());
                            } else {
                                error500Handler = handler;
                            }
              break;
             
              default:
                throw new ConfigurationException("Unknown handle-errors type (" + type + ") at " + handler.getLocation());
          }
                } else {
                    // Regular builder
                    children.add(builder.buildNode(childConfig));
                }
            }
        }
        node.setChildren(toNodeArray(children));
        node.set404Handler(error404Handler);
View Full Code Here

    for (int i = 0; i < childConfigs.length; i++) {

      Configuration childConfig = childConfigs[i];
      if (isChild(childConfig)) {

        ProcessingNodeBuilder builder = this.treeBuilder.createNodeBuilder(childConfig);
        if (builder instanceof HandleErrorsNodeBuilder) {
          handler = (HandleErrorsNode)builder.buildNode(childConfig);
        } else {
          // Regular builder
          children.add(builder.buildNode(childConfig));
        }
      }
    }
        if (children.size() == 0) {
            String msg = "There must be at least one pipeline at " + config.getLocation();
View Full Code Here

        List children = new ArrayList();
        for (int i = 0; i < childConfigs.length; i++) {
            Configuration childConfig = childConfigs[i];
            if (isChild(childConfig)) {

                ProcessingNodeBuilder builder = this.treeBuilder.createNodeBuilder(childConfig);
                if (builder instanceof HandleErrorsNodeBuilder) {
                    if (handler != null) {
                        throw new ConfigurationException("Duplicate <handle-errors> at " + handler.getLocation());
                    }

                    // Error handler : check type
                    handler = (HandleErrorsNode) builder.buildNode(childConfig);
                } else {
                    // Regular builder
                    children.add(builder.buildNode(childConfig));
                }
            }
        }

        node.setChildren(toNodeArray(children));
View Full Code Here

        for (int i = 0; i < childConfigs.length; i++) {
            Configuration childConfig = childConfigs[i];
            if (isChild(childConfig)) {

                ProcessingNodeBuilder builder = this.treeBuilder.createNodeBuilder(childConfig);
                if (builder instanceof HandleErrorsNodeBuilder) {
                    handler = (HandleErrorsNode)builder.buildNode(childConfig);
                } else {
                    // Regular builder
                    children.add(builder.buildNode(childConfig));
                }
            }
        }

        if (children.size() == 0) {
View Full Code Here

        if (getLogger().isDebugEnabled()) {
            getLogger().debug("Creating node builder for " + nodeName);
        }

        ProcessingNodeBuilder builder;
        builder = (ProcessingNodeBuilder) this.itsBuilders.getBuilder(nodeName);

        builder.setBuilder(this);

        if (builder instanceof LinkedProcessingNodeBuilder) {
            this.linkedBuilders.add(builder);
        }
View Full Code Here

     * up. Can be overriden by subclasses to perform pre/post tree creation
     * operations.
     */
    protected ProcessingNode createTree(Configuration tree) throws Exception {
        // Create a node builder from the top-level element
        ProcessingNodeBuilder rootBuilder = createNodeBuilder(tree);

        // Build the whole tree (with an empty buildModel)
        return rootBuilder.buildNode(tree);
    }
View Full Code Here

TOP

Related Classes of org.apache.cocoon.components.treeprocessor.ProcessingNodeBuilder

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.