<?xml version="1.0" encoding="UTF-8"?>

<!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

   $Header:$
 -->

<!--
  This file defines the shape of the NetUI framework XML configuration file.  If defined, this file should
  be placed in a web application's WEB-INF/beehive-netui-config.xml file.
-->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://beehive.apache.org/netui/2004/server/config"
            xmlns:netui="http://beehive.apache.org/netui/2004/server/config"
            elementFormDefault="qualified">

    <xsd:element name="netui-config">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="expression-languages" type="netui:expression-languages" minOccurs="1" maxOccurs="1"/>
                <xsd:element name="pageflow-action-interceptors" type="netui:pageflow-action-interceptors" minOccurs="0" maxOccurs="1"/>
                <xsd:element name="pageflow-handlers" type="netui:pageflow-handlers" minOccurs="0" maxOccurs="1"/>
                <xsd:element name="pageflow-config" type="netui:pageflow-config" minOccurs="0" maxOccurs="1"/>
                <xsd:element name="pageflow-factories" type="netui:pageflow-factories" minOccurs="0" maxOccurs="1"/>
                <xsd:element name="default-shared-flow-refs" type="netui:default-shared-flow-refs" minOccurs="0" maxOccurs="1"/>
                <xsd:element name="type-converters" type="netui:type-converters" minOccurs="0" maxOccurs="1"/>
                <xsd:element name="jsp-tag-config" type="netui:jsp-tag-config" minOccurs="0" maxOccurs="1"/>
                <xsd:element name="url-config" type="netui:url-config" minOccurs="0" maxOccurs="1"/>               
                <xsd:element name="iterator-factories" type="netui:iterator-factories" minOccurs="0" maxOccurs="1"/>
                <xsd:element name="request-interceptors" type="netui:request-interceptors" minOccurs="0" maxOccurs="1"/>
                <xsd:element name="prefix-handlers" type="netui:prefix-handlers" minOccurs="0" maxOccurs="1" />
                <xsd:element name="catalog" type="netui:catalog" minOccurs="0" maxOccurs="1"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>

    <xsd:complexType name="custom-property">
        <xsd:sequence>
            <xsd:element name="name" type="xsd:string" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="value" type="xsd:string" minOccurs="1" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>
    
    <xsd:complexType name="interceptor">
        <xsd:sequence>
            <xsd:element name="interceptor-class" type="xsd:string" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="custom-property" type="netui:custom-property" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>
    
    <xsd:complexType name="simple-action-interceptor">
        <xsd:sequence>
            <xsd:element name="intercept-path" type="xsd:string" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="after-action" type="xsd:boolean" minOccurs="0" maxOccurs="1" default="false"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="request-interceptors">
        <xsd:sequence>
            <xsd:element name="global" minOccurs="0" maxOccurs="1">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element name="request-interceptor" type="netui:interceptor" minOccurs="0" maxOccurs="unbounded"/>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>
    
    <xsd:complexType name="pageflow-action-interceptors">
        <xsd:sequence>
            <xsd:element name="global" minOccurs="0" maxOccurs="1">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element name="simple-action-interceptor" type="netui:simple-action-interceptor" minOccurs="0" maxOccurs="unbounded"/>
                        <xsd:element name="action-interceptor" type="netui:interceptor" minOccurs="0" maxOccurs="unbounded"/>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
            <xsd:element name="per-pageflow" minOccurs="0" maxOccurs="unbounded">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element name="pageflow-uri" type="xsd:string" minOccurs="1" maxOccurs="1"/>
                        <xsd:element name="simple-action-interceptor" type="netui:simple-action-interceptor" minOccurs="0" maxOccurs="unbounded"/>
                        <xsd:element name="action-interceptor" type="netui:interceptor" minOccurs="0" maxOccurs="unbounded"/>
                        <xsd:element name="per-action" minOccurs="0" maxOccurs="unbounded">
                            <xsd:complexType>
                                <xsd:sequence>
                                    <xsd:element name="action-name" type="xsd:string" minOccurs="1" maxOccurs="1"/>
                                    <xsd:element name="simple-action-interceptor" type="netui:simple-action-interceptor" minOccurs="0" maxOccurs="unbounded"/>
                                    <xsd:element name="action-interceptor" type="netui:interceptor" minOccurs="0" maxOccurs="unbounded"/>
                                </xsd:sequence>
                            </xsd:complexType>
                        </xsd:element>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>
	
    <xsd:complexType name="handler">
        <xsd:sequence>
            <xsd:element name="handler-class" type="xsd:string" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="custom-property" type="netui:custom-property" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>
    
    <xsd:complexType name="pageflow-handlers">
        <xsd:sequence>
            <xsd:element name="action-forward-handler" type="netui:handler" minOccurs="0" maxOccurs="unbounded"/>
            <xsd:element name="exceptions-handler" type="netui:handler" minOccurs="0" maxOccurs="unbounded"/>
            <xsd:element name="forward-redirect-handler" type="netui:handler" minOccurs="0" maxOccurs="unbounded"/>
            <xsd:element name="login-handler" type="netui:handler" minOccurs="0" maxOccurs="unbounded"/>
            <xsd:element name="storage-handler" type="netui:handler" minOccurs="0" maxOccurs="unbounded"/>
            <xsd:element name="reloadable-class-handler" type="netui:handler" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>
    
    <xsd:complexType name="module-config-locators">
        <xsd:sequence>
            <xsd:element name="module-config-locator" minOccurs="0" maxOccurs="unbounded">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element name="description" type="xsd:string" minOccurs="0" maxOccurs="1"/>
                        <xsd:element name="locator-class" type="xsd:string" minOccurs="1" maxOccurs="1"/>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>
	
    <xsd:complexType name="pageflow-config">
        <xsd:sequence>
            <xsd:element name="enable-self-nesting" type="xsd:boolean" minOccurs="0" maxOccurs="1" default="false"/>
            <xsd:element name="max-forwards-per-request" type="xsd:int" minOccurs="0" maxOccurs="1" default="25"/>
            <xsd:element name="max-nesting-stack-depth" type="xsd:int" minOccurs="0" maxOccurs="1" default="10"/> 
            <xsd:element name="ensure-secure-forwards" type="xsd:boolean" minOccurs="0" maxOccurs="1" default="false"/> 
            <xsd:element name="throw-session-expired-exception" type="xsd:boolean" minOccurs="0" maxOccurs="1" default="true"/>
            <xsd:element name="multipart-handler" minOccurs="0" maxOccurs="1" default="disabled">
                <xsd:simpleType>
                    <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="disabled"/>
                        <xsd:enumeration value="memory"/>
                        <xsd:enumeration value="disk"/>
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:element>
            <xsd:element name="prevent-cache" minOccurs="0" maxOccurs="1" default="default">
                <xsd:simpleType>
                    <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="default"/>
                        <xsd:enumeration value="always"/>
                        <xsd:enumeration value="inDevMode"/>
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:element>
            <xsd:element name="module-config-locators" type="netui:module-config-locators" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>
    
    <xsd:complexType name="pageflow-factory">
        <xsd:sequence>
            <xsd:element name="factory-class" type="xsd:string" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="custom-property" type="netui:custom-property" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>
    
    <xsd:complexType name="pageflow-factories">
        <xsd:sequence>
            <xsd:element name="flowcontroller-factory" type="netui:pageflow-factory" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="faces-backing-bean-factory" type="netui:pageflow-factory" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>
    
    <xsd:complexType name="shared-flow-ref">
        <xsd:sequence>
           <xsd:element name="name" type="xsd:string" minOccurs="1" maxOccurs="1"/>
           <xsd:element name="type" type="xsd:string" minOccurs="1" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>
    
    <xsd:complexType name="default-shared-flow-refs">
        <xsd:sequence>
            <xsd:element name="shared-flow-ref" type="netui:shared-flow-ref" minOccurs="1" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>
    
    <xsd:complexType name="jsp-tag-config">
        <xsd:sequence>
            <xsd:element name="doctype" minOccurs="0" maxOccurs="1" default="html4-loose-quirks">
                <xsd:simpleType>
                    <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="html4-loose"/>
                        <xsd:enumeration value="html4-loose-quirks"/>
                        <xsd:enumeration value="xhtml1-transitional"/>
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:element>
            <xsd:element name="id-javascript" minOccurs="0" maxOccurs="1" default="default">
                <xsd:simpleType>
                    <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="default"/>
                        <!--
                        This flag will turn on Legacy JavaScript support for id and name attributes.
                        When this is set the default tag JavaScript will also be output.
                        -->
                        <xsd:enumeration value="legacy"/>
                        <!--
                        This flag will make Legacy JavaScript support the only type of JavaScript
                        output for id and name attributes.
                        -->
                        <xsd:enumeration value="legacyOnly"/>
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:element>
            <xsd:element name="tree-image-location" type="xsd:string" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="tree-renderer-class" type="xsd:string" minOccurs="0" maxOccurs="1" default=""/>
        </xsd:sequence>
    </xsd:complexType>
    
    <xsd:complexType name="url-config">
        <xsd:sequence>
            <xsd:element name="url-encode-urls" type="xsd:boolean" minOccurs="0" maxOccurs="1" default="true"/>
            <xsd:element name="html-amp-entity" type="xsd:boolean" minOccurs="0" maxOccurs="1" default="true"/>
            <xsd:element name="templated-url-formatter-class" type="xsd:string" minOccurs="0" maxOccurs="1" default="org.apache.beehive.netui.pageflow.internal.DefaultTemplatedURLFormatter"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="type-converters">
        <xsd:sequence>
            <xsd:element name="type-converter" minOccurs="0" maxOccurs="unbounded">
                <xsd:complexType>
                <xsd:sequence>
                    <xsd:element name="type" type="xsd:string" minOccurs="1" maxOccurs="1"/>
                    <xsd:element name="converter-class" type="xsd:string" minOccurs="1" maxOccurs="1"/>
                </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="iterator-factories">
        <xsd:sequence>
            <xsd:element name="iterator-factory" minOccurs="0" maxOccurs="unbounded">
                <xsd:complexType>
                <xsd:sequence>
                    <xsd:element name="name" type="xsd:string" minOccurs="1" maxOccurs="1"/>
                    <xsd:element name="factory-class" type="xsd:string" minOccurs="1" maxOccurs="1"/>
                </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="expression-languages">
        <xsd:sequence>
            <xsd:element name="default-language" type="xsd:string" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="expression-language" minOccurs="1" maxOccurs="unbounded">
                <xsd:complexType>
                <xsd:sequence>
                    <xsd:element name="name" type="xsd:string" minOccurs="1" maxOccurs="1"/>
                    <xsd:element name="factory-class" type="xsd:string" minOccurs="1" maxOccurs="1"/>
                    <xsd:element name="binding-contexts" type="netui:binding-contexts" minOccurs="0" maxOccurs="1"/>
                </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="binding-contexts">
        <xsd:sequence>
            <xsd:element name="binding-context" minOccurs="0" maxOccurs="unbounded">
                <xsd:complexType>
                <xsd:sequence>
                    <xsd:element name="name" type="xsd:string" minOccurs="1" maxOccurs="1"/>
                    <xsd:element name="factory-class" type="xsd:string" minOccurs="1" maxOccurs="1"/>
                </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="prefix-handlers">
        <xsd:sequence>
            <xsd:element name="prefix-handler" minOccurs="0" maxOccurs="unbounded">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element name="name" type="xsd:string" minOccurs="1" maxOccurs="1"/>
                        <xsd:element name="handler-class" type="xsd:string" minOccurs="1" maxOccurs="1"/>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <!--
    Definition of a chain implementation for NetUI.  Chains and commands are defined as part
    of a "catalog" of such items.
     -->
    <xsd:complexType name="catalog">
        <xsd:sequence>
            <xsd:element name="chain" type="netui:chain" minOccurs="0" maxOccurs="unbounded"/>
            <xsd:element name="command" type="netui:command" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
        <xsd:attribute name="name" type="xsd:string"/>
    </xsd:complexType>

    <xsd:complexType name="chain">
        <xsd:sequence>
            <xsd:element name="command" type="netui:command" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
        <xsd:attribute name="name" type="xsd:string"/>
    </xsd:complexType>

    <xsd:complexType name="command">
        <xsd:sequence>
            <xsd:element name="id" type="xsd:string" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="command-class" type="xsd:string" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="custom-property" type="netui:custom-property" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>

</xsd:schema>
