Package org.apache.shale.clay.parser.builder.chain

Examples of org.apache.shale.clay.parser.builder.chain.BuilderRuleContext


     * @param node the markup node
     * @return builder that handles the node
     */
    public static Builder getRenderer(Node node) {

        BuilderRuleContext context = new BuilderRuleContext();
        context.setNode(node);
        try {
            Catalog catalog = getCatalog();

            Command command = null;
            if (node.getQname() == null) {
                command = catalog.getCommand(Globals.FIND_DEFAULT_BUILDER_COMMAND_NAME);
            } else {
                String prefix = node.getQname();
                String uri = node.getNamespaceURI(prefix);
                if (uri != null) {
                    command = catalog.getCommand(uri);
                    if (command == null) {
                        FacesContext facesContext = FacesContext.getCurrentInstance();
                        if (facesContext != null) {
                            facesContext.getExternalContext().getRequestMap()
                            .put(Globals.CLAY_CUSTOM_BUILDER_XMLNS, uri);
                        }

                        command = catalog.getCommand(Globals.FIND_UNKNOWN_BUILDER_COMMAND_NAME);
                    }
                } else {
                    command = catalog.getCommand(Globals.FIND_UNKNOWN_BUILDER_COMMAND_NAME);
                }

            }

            command.execute(context);

        } catch (Exception e) {
            log.error(e);
            throw new RuntimeException(e);
        }

        return context.getBuilder();
    }
View Full Code Here

TOP

Related Classes of org.apache.shale.clay.parser.builder.chain.BuilderRuleContext

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.