<!--

    Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.

    This program and the accompanying materials are made available under the
    terms of the Eclipse Public License v. 2.0, which is available at
    http://www.eclipse.org/legal/epl-2.0.

    This Source Code may also be made available under the following Secondary
    Licenses when the conditions for such availability set forth in the
    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
    version 2 with the GNU Classpath Exception, which is available at
    https://www.gnu.org/software/classpath/license.html.

    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0

-->

<!--


    This program and the accompanying materials are made available under the
    terms of the Eclipse Public License v. 2.0, which is available at
    http://www.eclipse.org/legal/epl-2.0.

    This Source Code may also be made available under the following Secondary
    Licenses when the conditions for such availability set forth in the
    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
    version 2 with the GNU Classpath Exception, which is available at
    https://www.gnu.org/software/classpath/license.html.

    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0

-->

<!ENTITY % boolean "(yes | no | on | off | 1 | 0 | true | false)">


<!-- load balancer Configuration
     Configure load balancer to load balance the request. It contains
     configuration details related to cluster, and
     properties related to load balancer.
-->

<!ELEMENT loadbalancer (cluster*, property*)>

<!--  Cluster Configuration
      Provides configuration information related to all clusters to
      which loadbalancer would route the requests.

      name      identifies the cluster
-->

<!ELEMENT cluster (instance*, web-module*, health-checker?)>
<!ATTLIST cluster name CDATA #REQUIRED>


<!--   Server instance configuration

      name        identifies the server instance within the cluster

      enabled     specifies whether instance is active (enabled)
                  for requests to be load balanced to it.

      disable-timeout-in-minutes  specifies the quiescing timeout interval in
                                  seconds, upon elapse of which load balancer
                                  would close all the open connections related
                                  to the instance being disabled and no further   
                                  requests would be routed to the instance.
                                  Default value would be 31 minutes (i.e. more
                                  than the default session idle timeout which is 
                                  30 minutes).

      listeners      URLs of the listeners. Is a muti-valued, space
                     delimited list of URLs.
                     For example: "http://server1:80 https://server2:80"
-->

<!ELEMENT instance EMPTY>
<!ATTLIST instance   name             CDATA     #REQUIRED
                     enabled          %boolean; "true"
                     disable-timeout-in-minutes  CDATA     "31"
                     listeners        CDATA     #REQUIRED>


<!-- Deployed Web Modules (Applications).

    context-root   context root of the application deployed

    enabled         signifies whether the application is enabled or
                    disabled. Default value would be "true".

    disable-timeout-in-minutes   specifies the quiescing timeout interval after
                                 which no further requests would be sent to the
                                 application that has been disabled. Application
                                 is  identified by the application context root 
                                 as specified in web-module element.
                                 Default value would be 31 minutes (i.e. more
                                 than the default session idle timeout which is
                                 30 minutes).

    error-url                    The URL or the location of the error page which
                                 will be sent to the client in case of error.
-->

<!ELEMENT web-module (idempotent-url-pattern*)>
<!ATTLIST web-module       context-root    CDATA     #REQUIRED
                           enabled         %boolean; "true"
                           disable-timeout-in-minutes CDATA     "31"
                           error-url      CDATA ""  >        
<!-- Idempotent URL Patterns

    url-pattern     URL Pattern of the idempotent requests
    
    no-of-retries   Specifies the number of times the Load Balancer will retry
                    a request that is idempotent.
 
-->

<!ELEMENT idempotent-url-pattern EMPTY>
<!ATTLIST idempotent-url-pattern    url-pattern   CDATA      #REQUIRED
                                    no-of-retries CDATA      "-1">
  
<!-- Health Checker Configuration.

     Each cluster would be configured for a ping based health check
     mechanism.

     url                      URL to ping so as to determine the health state
                              of a listener.

     interval-in-seconds      specifies the interval in seconds at which health
                              checks of unhealthy instances carried out to check
                              if the instances has turned healthy. Default
                              value is "30" seconds. A value of "0" would imply
                              that health check is disabled.

     timeout-in-seconds       timeout interval in seconds within which response
                              should be obtained for a health check request;
                              else the instance would be considered unhealthy.
                              Default value would be "10".
-->

<!ELEMENT health-checker EMPTY>
<!ATTLIST health-checker  url        CDATA               "/"
                          interval-in-seconds   CDATA               "30"
                          timeout-in-seconds    CDATA               "10">


<!-- properties are internal configuaration parameters of LB.

     Name                                       Value

     response-timeout-in-seconds      timeout interval in seconds within which
                                      response should be obtained for a request
                                      load balanced; else the instance would be
                                      considered unhealthy. Default value would
                                      be "60".


     reload-poll-interval-in-seconds  interval in seconds at which load balancer
                                      would detect if loadbalancer.xml timestamp
                                      has changed. If it has change loadbalancer
                                      would reload it. Default value of "0"
                                      would imply that polling is disabled.

     https-routing                    flag ("true" | "false") that determines
                                      whether the load balancer should route the
                                      incoming HTTPS request as HTTPS request to
                                      the instance. Default value would be
                                      "false".

     require-monitor-data             flag ("true" | "false")  that determines
                                      whether monitoring is switched on or not.
                                      Default value would be "false".

-->

<!ELEMENT property (description?)>
<!ATTLIST property        name      CDATA      #REQUIRED
                          value     CDATA      #REQUIRED>


<!-- Textual description of a configured property -->
<!ELEMENT description (#PCDATA)>

