<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xmlns:tns="http://tomcat.apache.org/VWAR" xmlns="http://tomcat.apache.org/VWAR"
  targetNamespace="http://tomcat.apache.org/VWAR" version="1.0.0">
  <xs:element name="application" type="Application">
    <xs:annotation>
      <xs:documentation source="version">1.0.0</xs:documentation>
      <xs:documentation source="description">
        Root element of the user
        configuration file.
      </xs:documentation>
    </xs:annotation>
  </xs:element>

  <xs:simpleType name="Version">
    <xs:restriction base="xs:string">
      <xs:pattern value="\d+\.\d+\.\d+" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="VersionRangeList">
    <xs:list>
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:pattern value="\d+\.\d+\.\d+-\d+" />
        </xs:restriction>
      </xs:simpleType>
    </xs:list>
  </xs:simpleType>

  <xs:complexType name="VerificationMetadata">
    <xs:sequence>
      <xs:element name="text" type="xs:string" minOccurs="1" maxOccurs="1" />
      <xs:element name="signatures" type="Signatures" minOccurs="0" maxOccurs="1" />
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="Signatures">
    <xs:sequence>
      <xs:choice>
        <xs:element name="pgpSignature" type="xs:string" />
      </xs:choice>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="Config">
    <xs:all>
      <xs:element minOccurs="0" name="mavenConfig" type="MavenConfig" />
      <xs:element minOccurs="0" name="permissions">
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="Permissions">
              <xs:sequence>
                <xs:element name="installer" type="Permissions" minOccurs="0" />
                <xs:element name="launcher" type="Permissions" minOccurs="0" />
              </xs:sequence>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>
    </xs:all>
  </xs:complexType>

  <xs:complexType name="Application">
    <xs:sequence>
      <xs:element name="launcher" type="Launcher" />
      <xs:element name="configurations" type="Config" minOccurs="0" />
    </xs:sequence>
    <xs:attribute name="javaSpecificationVersion" type="xs:string" use="required" />
  </xs:complexType>

  <xs:complexType name="ModulePackageName">
    <xs:attribute name="module" type="xs:string" use="required" />
    <xs:attribute name="package" type="xs:string" use="required" />
  </xs:complexType>

  <xs:complexType name="Launcher">
    <xs:sequence>
      <xs:choice>
        <xs:element name="mavenResolver" type="MavenClassType" />
<!--         <xs:element name="urlListResolver" type="URLsClassType" /> -->
      </xs:choice>
      <xs:element name="verificationMetadata" type="VerificationMetadata" minOccurs="0" maxOccurs="1" />
    </xs:sequence>
    <xs:attribute name="privateSystem" type="xs:boolean" use="optional" default="false" />
  </xs:complexType>

  <xs:complexType name="URLsClassType">
    <xs:sequence>
      <xs:element name="url" type="xs:anyURI" minOccurs="0" maxOccurs="unbounded" />
      <xs:element name="addExports" type="ModulePackageName" minOccurs="0" maxOccurs="unbounded" />
      <xs:element name="addOpens" type="ModulePackageName" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="scope" type="Scope" default="PLATFORM" />
  </xs:complexType>

  <xs:simpleType name="Scope">
    <xs:restriction base="xs:string">
      <xs:enumeration value="ATTACHMENT" />
      <xs:enumeration value="PLATFORM" />
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="AddReads">
    <xs:attribute name="source" type="xs:string" use="required" />
    <xs:attribute name="target" type="xs:string" use="required" />
  </xs:complexType>

  <xs:complexType name="AddOpens">
    <xs:attribute name="source" type="xs:string" use="required" />
    <xs:attribute name="pn" type="xs:string" use="required" />
    <xs:attribute name="target" type="xs:string" use="required" />
  </xs:complexType>

  <xs:complexType name="AddExports">
    <xs:attribute name="source" type="xs:string" use="required" />
    <xs:attribute name="pn" type="xs:string" use="required" />
    <xs:attribute name="target" type="xs:string" use="required" />
  </xs:complexType>

  <xs:complexType name="ActivateNamedModules">
    <xs:sequence>
      <xs:element name="addReads" type="AddReads" minOccurs="0" maxOccurs="unbounded" />
      <xs:element name="addExports" type="AddExports" minOccurs="0" maxOccurs="unbounded" />
      <xs:element name="addOpens" type="AddOpens" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="AddBeforeParent">
  </xs:complexType>

  <xs:complexType name="ModifyLoadedDependency">
    <xs:sequence>
      <xs:element name="addBeforeParent" type="AddBeforeParent" minOccurs="0" maxOccurs="1" />
      <xs:element name="addExports" type="ModulePackageName" minOccurs="0" maxOccurs="unbounded" />
      <xs:element name="addOpens" type="ModulePackageName" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="groupId" type="xs:string" use="required" />
    <xs:attribute name="artifactId" type="xs:string" use="required" />
  </xs:complexType>

  <xs:complexType name="AttachDependencies">
    <xs:sequence>
      <xs:element name="activateNamedModules" type="ActivateNamedModules" minOccurs="0" maxOccurs="1" />
      <xs:element name="modifyLoadedDependency" type="ModifyLoadedDependency" minOccurs="0" maxOccurs="unbounded" />
      <xs:element name="modifyScope" type="ModifyScope" minOccurs="0" maxOccurs="unbounded" />
      <xs:element name="excludeWithParents" type="ExceptIn" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="mode" type="Mode" default="FIXED_DEPENDENCIES" />
    <xs:attribute name="scope" type="Scope" default="PLATFORM" />
    <xs:attribute name="excludeJarsFromTomcatLoader" type="xs:boolean" default="true" />
  </xs:complexType>

  <xs:complexType name="MavenClassType">
    <xs:sequence>
      <xs:element name="attachDependencies" type="AttachDependencies" minOccurs="0" />
    </xs:sequence>
    <xs:attribute name="groupId" type="xs:string" use="required" />
    <xs:attribute name="artifactId" type="xs:string" use="required" />
    <xs:attribute name="version" type="xs:string" use="required" />
    <xs:attribute name="classifier" type="xs:string" use="optional" />
  </xs:complexType>

  <xs:simpleType name="Mode">
    <xs:restriction base="xs:string">
      <xs:enumeration value="CLASSPATH" />
      <xs:enumeration value="FIXED_DEPENDENCIES" />
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="ModifyScope">
    <xs:attribute name="groupId" type="xs:string" use="required" />
    <xs:attribute name="artifactId" type="xs:string" use="required" />
    <xs:attribute name="scope" type="Scope" use="required" />
  </xs:complexType>

  <xs:complexType name="AddDependency">
    <xs:attribute name="groupId" type="xs:string" use="required" />
    <xs:attribute name="artifactId" type="xs:string" use="required" />
    <xs:attribute name="version" type="xs:string" use="required" />
  </xs:complexType>

  <xs:complexType name="ModifyDependency">
    <xs:sequence>
      <xs:element name="patch" type="AddDependency" minOccurs="0" />
      <xs:element name="addDependency" type="AddDependency" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="groupId" type="xs:string" use="required" />
    <xs:attribute name="artifactId" type="xs:string" use="required" />
  </xs:complexType>

  <xs:complexType name="ExceptIn">
    <xs:attribute name="groupId" type="xs:string" use="required" />
    <xs:attribute name="artifactId" type="xs:string" use="required" />
  </xs:complexType>

  <xs:complexType name="ReplaceDependency">
    <xs:sequence>
      <xs:element name="exceptIn" type="ExceptIn" minOccurs="0" maxOccurs="unbounded" />
      <xs:element name="addDependency" type="AddDependency" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="groupId" type="xs:string" use="required" />
    <xs:attribute name="artifactId" type="xs:string" use="required" />
  </xs:complexType>

  <xs:complexType name="AdditionalRepository">
    <xs:attribute name="id" type="xs:string" use="required" />
    <xs:attribute name="layout" type="xs:string" />
    <xs:attribute name="url" type="xs:anyURI" use="required" />
  </xs:complexType>

  <xs:complexType name="MavenConfig">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element name="modifyDependency" type="ModifyDependency" />
      <xs:element name="replaceDependency" type="ReplaceDependency" />
      <xs:element name="additionalRepository" type="AdditionalRepository" />
    </xs:choice>
    <xs:attribute name="superPomRepositoriesUsed" type="xs:boolean" use="optional" default="true" />
    <xs:attribute name="pomRepositoriesIgnored" type="xs:boolean" use="optional" default="false" />
  </xs:complexType>

  <xs:complexType name="Permissions">
    <xs:sequence>
      <xs:element name="permission" type="Permission" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="Permission">
    <xs:attribute name="type" type="xs:string" use="required" />
    <xs:attribute name="name" type="xs:string" use="optional" />
    <xs:attribute name="actions" type="xs:string" use="optional" />
  </xs:complexType>

</xs:schema>
