<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.ansys.com/ekm"
    xmlns:ekm="http://www.ansys.com/ekm">
    <xsd:annotation>
        <xsd:documentation>
            EKM Configuration Schema

            Copyright (c) 2013 SAS IP, Inc. All rights reserved.

            Defines the various server configuration settings for the
            EKM
        </xsd:documentation>
    </xsd:annotation>

    <xsd:complexType name="Repository">
        <xsd:sequence>
            <xsd:element name="retentionPolicy" type="ekm:SystemRetentionPolicy" />
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="SuperUser">
        <xsd:sequence>
            <xsd:element name="name" type="xsd:string" />
            <xsd:element name="password" type="xsd:string" />
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="CustomRetentionPolicy">
        <xsd:annotation>
            <xsd:documentation>
                Defines the length of time a specific type of object
                will be retained in the repository. expiration is specified in
                days, so 1 would mean one day. This is an int, so 1 day is
                the shortest expiration period you can define
            </xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element name="objectType" type="xsd:string" />
            <xsd:element name="expiration" type="xsd:int" />
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="SystemRetentionPolicy">
        <xsd:annotation>
            <xsd:documentation>
                Defines the system wide retention policy. This includes
                the default number of days an object will be retained as
                well as 0 or more custom settings for specific types of
                objects.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element name="defaultExpiration" type="xsd:float" />
            <xsd:element name="customRetentionSetting"
                type="ekm:CustomRetentionPolicy" minOccurs="0"
                maxOccurs="unbounded" />
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="LocalProcess">
        <xsd:sequence>
            <xsd:element name="dataExtractionTimeout" type="xsd:int"
                default="3600" />
            <xsd:element name="dataExtractionThreads" type="xsd:int"
                default="1" />
            <xsd:element name="maxDataExtractionMemory" type="xsd:int"
                default="16" />
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="InteractiveQueue">
        <xsd:sequence>
            <xsd:element name="name" type="xsd:string" />
            <xsd:element name="os">
                <xsd:simpleType>
                    <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="windows" />
                        <xsd:enumeration value="linux" />
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:element>
            <xsd:element name="scheduler" type="xsd:string" minOccurs="0"/>
            <xsd:element name="schedulerQueue" type="xsd:string" minOccurs="0"/>
            <xsd:element name="remoteType" type="xsd:string" minOccurs="0"/>
            <xsd:element name="jobRoot" type="xsd:string" minOccurs="0"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="EnginFrame">
        <xsd:sequence>
            <xsd:element name="serviceDefinitionFile" type="xsd:string" />
            <xsd:element name="adminUser" type="xsd:string" />
            <xsd:element name="queue" type="ekm:InteractiveQueue" minOccurs="0" maxOccurs="unbounded" />
        </xsd:sequence>
    </xsd:complexType>
	
	<xsd:complexType name="ActLauncherService">
        <xsd:sequence>
            <xsd:element name="host" type="xsd:string" minOccurs="1" maxOccurs="1" />
            <xsd:element name="port" type="xsd:string" minOccurs="1" maxOccurs="1" />
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="ClusterMonitors">
        <xsd:sequence>
            <xsd:element name="clusterMonitor" type="ekm:ClusterMonitor" minOccurs="0" maxOccurs="unbounded" />
        </xsd:sequence>
    </xsd:complexType>    

    <xsd:complexType name="ClusterMonitor">
        <xsd:sequence>
            <xsd:element name="type" type="xsd:string" />
            <xsd:element name="param" minOccurs="0" maxOccurs="unbounded">
                <xsd:complexType>
                    <xsd:attribute name="name" type="xsd:string" use="required" />
                    <xsd:attribute name="value" type="xsd:string" use="required" />
                </xsd:complexType>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="DirectoryList">
        <xsd:sequence>
            <xsd:element name="dir" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="ClientDirectoryMappings">
        <xsd:sequence maxOccurs="unbounded">
          <xsd:element name="clientPath" type="xsd:string"/>
          <xsd:element name="clusterPath" type="xsd:string"/>
        </xsd:sequence>
    </xsd:complexType>
    
    <xsd:complexType name="SolverVersions">
        <xsd:sequence>
            <xsd:element name="version" type="ekm:Version" minOccurs="1" maxOccurs="unbounded" />
        </xsd:sequence>
        <xsd:attribute name="default" type="xsd:string" use="required" />
    </xsd:complexType>
    
    <xsd:complexType name="Version">
        <xsd:sequence>
            <xsd:element name="value" type="xsd:string" />
            <xsd:element name="label" type="xsd:string" />
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="RemoteProcess">
        <xsd:sequence>
            <xsd:element name="jobSourceRootPath" type="xsd:string" />
			<xsd:element name="jobFileSystemHome" minOccurs="0" maxOccurs="1">
                <xsd:simpleType>
                    <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="JobRoot" />
                        <xsd:enumeration value="UserHome" />
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:element>
            <xsd:element name="clusterVisibleDirectories" type="ekm:DirectoryList" />
            <xsd:element name="pathMappings" type="ekm:ClientDirectoryMappings" minOccurs="0" />
            <xsd:element name="rsmWindowsDomain" type="xsd:string" minOccurs="0"/>
            <xsd:element name="jobTemplate" type="xsd:string" minOccurs="0"/>
            <xsd:element name="rsmLauncherURL" type="xsd:string" />
            <xsd:element name="rsmClientTimeout" type="xsd:int" minOccurs="0" />
            <xsd:element name="jobOutputFilename" type="xsd:string" />
            <xsd:element name="dataManagementJreLocation" type="xsd:string" />
            <xsd:element name="dataManagementJarLocation" type="xsd:string" />
            <xsd:element name="enginframe" type="ekm:EnginFrame" minOccurs="0" />
            <xsd:element name="workbenchServerPortRange" type="xsd:string" />
            <xsd:element name="interactiveJobManagerClass" type="xsd:string" minOccurs="0" />
            <xsd:element name="interactiveJobCreationTimeout" type="xsd:int" minOccurs="0" />
            <xsd:element name="clusterMonitors" type="ekm:ClusterMonitors" minOccurs="0" />
            <xsd:element name="solverVersions" type="ekm:SolverVersions" />
            <xsd:element name="emagInstallationDirectory" type="xsd:string" minOccurs="0" />
			<xsd:element name="enableClusterJobNameSpecification" type="xsd:boolean" minOccurs="0" maxOccurs="1"/>
			<xsd:element name="actLauncherService" type="ekm:ActLauncherService" minOccurs="0" />
        </xsd:sequence>
    </xsd:complexType>
    
    <xsd:complexType name="Cache">
        <xsd:sequence>
            <xsd:element name= "size" type="xsd:string" />
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="Email">
        <xsd:sequence>
            <xsd:element name= "mailFromDomain" type="xsd:string" />
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="ScheduledTask">
        <xsd:sequence>
            <xsd:element name="day">
                <xsd:simpleType>
                    <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="Any" />
                        <xsd:enumeration value="Sunday" />
                        <xsd:enumeration value="Monday" />
                        <xsd:enumeration value="Tuesday" />
                        <xsd:enumeration value="Wednesday" />
                        <xsd:enumeration value="Thursday" />
                        <xsd:enumeration value="Friday" />
                        <xsd:enumeration value="Saturday" />
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:element>
            <xsd:element name="hour">
                <xsd:simpleType>
                    <xsd:restriction base="xsd:int">
                        <xsd:minInclusive value="0" />
                        <xsd:maxInclusive value="23" />
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:element>
            <xsd:element name="min" default="0" minOccurs="0">
                <xsd:simpleType>
                    <xsd:restriction base="xsd:int">
                        <xsd:minInclusive value="0" />
                        <xsd:maxInclusive value="59" />
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:element>
            <xsd:element name="dayInterval">
                <xsd:simpleType>
                    <xsd:restriction base="xsd:int">
                        <xsd:minInclusive value="0" />
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:element>
            <xsd:element name="hourInterval" default="0"
                minOccurs="0">
                <xsd:simpleType>
                    <xsd:restriction base="xsd:int">
                        <xsd:minInclusive value="0" />
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:element>
            <xsd:element name="minInterval" default="0"
                minOccurs="0">
                <xsd:simpleType>
                    <xsd:restriction base="xsd:int">
                        <xsd:minInclusive value="0" />
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="FileBackupTaskSettings">
        <xsd:sequence>
            <xsd:element name="compress" type="xsd:boolean"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="FileBackupTask">
        <xsd:complexContent>
            <xsd:extension base="ekm:ScheduledTask">
                <xsd:sequence>
                    <xsd:element name="settings" type="ekm:FileBackupTaskSettings" 
                        minOccurs="0"/>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="ScheduledTasks">
        <xsd:all>
            <xsd:element name="dataStoreGc" type="ekm:ScheduledTask" />
            <xsd:element name="fileBackup" type="ekm:FileBackupTask" />
            <xsd:element name="remoteSync" type="ekm:ScheduledTask" />
            <xsd:element name="recycleBinCleanup" type="ekm:ScheduledTask" />
            <xsd:element name="mail" type="ekm:ScheduledTask" />
            <xsd:element name="purge" type="ekm:ScheduledTask" />
            <xsd:element name="batchJobMonitor" type="ekm:ScheduledTask" />
            <xsd:element name="serverMonitor" type="ekm:ScheduledTask" />
            <xsd:element name="cacheMonitor" type="ekm:ScheduledTask" />
            <xsd:element name="pingServo" type="ekm:ScheduledTask" />
            <xsd:element name="pingUserProxy" type="ekm:ScheduledTask" />
			<xsd:element name="memberCacheUpdate" type="ekm:ScheduledTask" />
        </xsd:all>
    </xsd:complexType>

    <xsd:complexType name="PluginRegistry">
        <xsd:annotation>
            <xsd:documentation>
                Defines the customization settings for the core
                PluginRegistry.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element name="pluginDirectory" type="xsd:string" />
            <xsd:element name="loadAll" type="xsd:boolean" />
            <xsd:element name="plugin" type="xsd:string" minOccurs="0"
                maxOccurs="unbounded" />
            <xsd:element name="pluginSettings" type="ekm:PluginSetting"
                minOccurs="0" maxOccurs="unbounded" />
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="PluginSetting">
        <xsd:sequence>
            <xsd:element name="param" minOccurs="0"
                maxOccurs="unbounded">
                <xsd:complexType>
                    <xsd:attribute name="name" type="xsd:string"
                        use="required" />
                    <xsd:attribute name="value" type="xsd:string"
                        use="required" />
                </xsd:complexType>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="pluginName" type="xsd:string"
            use="required">
        </xsd:attribute>
    </xsd:complexType>

    <xsd:complexType name="DataLink">
        <xsd:all>
            <xsd:element name="openPdmUrl" type="xsd:string" />
            <xsd:element name="openPdmUser" type="xsd:string" />
            <xsd:element name="openPdmPassword" type="xsd:string" />
            <xsd:element name="ekmHostName" type="xsd:string" />
            <xsd:element name="pdmConnector" type="xsd:string" />
            <xsd:element name="pdmHostName" type="xsd:string" />
            <xsd:element name="pdmUser" type="xsd:string" />
            <xsd:element name="pdmPassword" type="xsd:string" />
            <xsd:element name="importStrategy" type="xsd:string" default="InsertUpdate" minOccurs="0"/>
            <xsd:element name="mapping" type="xsd:string" default="0" minOccurs="0"/>
            <xsd:element name="checkForUpdateTimeout" type="xsd:int" default="120" minOccurs="0"/>
        </xsd:all>
    </xsd:complexType>

    <xsd:complexType name="BootStrapper">
        <xsd:all>
            <xsd:element name="confPath" type="xsd:string" minOccurs="0"/>
            <xsd:element name="customBootstrapper" type="xsd:string" minOccurs="0"/>
        </xsd:all>
    </xsd:complexType>

    <xsd:complexType name="Cluster">
        <xsd:all>
            <xsd:element name="type">
                <xsd:simpleType>
                    <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="cluster" />
                        <xsd:enumeration value="local" />
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:element>
            <xsd:element name="cacheConfigFile" type="xsd:string" minOccurs="0"/>
        </xsd:all>
    </xsd:complexType>

    <xsd:complexType name="MemoryLimits">
        <xsd:all>
            <xsd:element name="maxSearchResults" type="xsd:int" />
        </xsd:all>
    </xsd:complexType>

    <xsd:complexType name="MobileConnector">
        <xsd:sequence>
            <xsd:element name="ekmServer" minOccurs="0" maxOccurs="unbounded">
                <xsd:complexType>
                    <xsd:attribute name="serverName" type="xsd:string" use="required" />
                    <xsd:attribute name="serverKey" type="xsd:string" use="required" />
                </xsd:complexType>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="MobileServer">
        <xsd:all>
            <xsd:element name="mobileConnectorUrl" type="xsd:string" />
            <xsd:element name="serverName" type="xsd:string" />
            <xsd:element name="serverKey" type="xsd:string" />
        </xsd:all>
    </xsd:complexType>

    <xsd:complexType name="Module">
        <xsd:attribute name="name" type="xsd:string" use="required" />
        <xsd:attribute name="enabled" type="xsd:boolean" use="required" />
    </xsd:complexType>

    <xsd:complexType name="Modules">
        <xsd:sequence>
            <xsd:element name="module" type="ekm:Module" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="FileTransferService">
        <xsd:sequence>
            <xsd:element name="rootDir" type="xsd:string" minOccurs="1"/>
            <xsd:element name="compressionEnabled" type="xsd:boolean" minOccurs="0"/>
            <xsd:element name="expirationDays" type="xsd:int" minOccurs="0"/>
            <xsd:element name="fileManagerClass" type="xsd:string" minOccurs="0"/>
            <xsd:element name="logLevel" type="xsd:int" minOccurs="0"/>
            <xsd:element name="logLocation" type="xsd:string" minOccurs="0"/>
            <xsd:element name="userAuthentication" type="xsd:string" minOccurs="0"/>
            <xsd:element name="transferBufferSize" type="xsd:int" minOccurs="0"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="CORSConfig">
        <xsd:sequence>
            <xsd:element name="allowedOrigin" type="xsd:string" minOccurs="0"
                maxOccurs="unbounded"/>
            <xsd:element name="allowedMethods" type="xsd:string" minOccurs="0" />
            <xsd:element name="allowedHeaders" type="xsd:string" minOccurs="0" />
            <xsd:element name="maxAge" type="xsd:int" minOccurs="0" />
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="Ldap">
        <xsd:all>
            <xsd:element name="authBindDN" type="xsd:string" minOccurs="0" maxOccurs="1" />
            <xsd:element name="authBindCredential" type="xsd:string" minOccurs="0" maxOccurs="1" />
            <xsd:element name="baseCtxDN" type="xsd:string" minOccurs="1" maxOccurs="1" />
            <xsd:element name="userFilter" type="xsd:string" minOccurs="1" maxOccurs="1" />
            <xsd:element name="ekmUserNameAttribute" type="xsd:string" minOccurs="0" maxOccurs="1" />
            <xsd:element name="ekmFirstNameAttribute" type="xsd:string" minOccurs="0" maxOccurs="1" />
            <xsd:element name="ekmLastNameAttribute" type="xsd:string" minOccurs="0" maxOccurs="1" />
            <xsd:element name="ekmEmailAttribute" type="xsd:string" minOccurs="0" maxOccurs="1" />
            <xsd:element name="ekmTitleAttribute" type="xsd:string" minOccurs="0" maxOccurs="1" />
            <xsd:element name="ekmPhoneAttribute" type="xsd:string" minOccurs="0" maxOccurs="1" />
            <xsd:element name="responseTimeout" type="xsd:string" minOccurs="1" maxOccurs="1" />
            <xsd:element name="searchTimeLimit" type="xsd:string" minOccurs="1" maxOccurs="1" />
            <xsd:element name="secure" type="xsd:string" minOccurs="1" maxOccurs="1" />
            <xsd:element name="secureType" type="xsd:string" minOccurs="1" maxOccurs="1" />
            <xsd:element name="serverHost" type="xsd:string" minOccurs="1" maxOccurs="1" />
            <xsd:element name="serverPort" type="xsd:string" minOccurs="1" maxOccurs="1" />
        </xsd:all>
    </xsd:complexType>

    <xsd:element name="EKM">
        <xsd:complexType>
            <xsd:all>
                <!--  General server settings -->
                <xsd:element name="ekmUrl" type="xsd:string" />
                <xsd:element name="defaultDomain" type="xsd:string" />
                <xsd:element name="defaultRootUser" type="xsd:string" />
                <xsd:element name="repository" type="ekm:Repository" />
                <xsd:element name="modules" type="ekm:Modules" />
                <xsd:element name="localProcess" type="ekm:LocalProcess" />
                <xsd:element name="remoteProcess" type="ekm:RemoteProcess" />
                <xsd:element name="cache" type="ekm:Cache" />
                <xsd:element name="scheduledTasks" type="ekm:ScheduledTasks" />
                <xsd:element name="jobFinisherThreads" type="xsd:int" />
                <xsd:element name="pluginRegistry" type="ekm:PluginRegistry" />
                <xsd:element name="superUser" type="ekm:SuperUser"/>
                <xsd:element name="cluster" type="ekm:Cluster"/>
                <xsd:element name="memoryLimits" type="ekm:MemoryLimits"/>
                <xsd:element name="email" type="ekm:Email" />
                <xsd:element name="maxItemsPerCommit" type="xsd:int"/>

                <!-- Path settings -->
                <xsd:element name="customResourcesPath" type="xsd:string" />

                <!-- File Transfer Service settings -->
                <xsd:element name="fileTransferService" type="ekm:FileTransferService"
                    minOccurs="1" maxOccurs="1" />

                <!--  Optional settings -->
                <xsd:element name="bootstrapper" type="ekm:BootStrapper"
                    minOccurs="0" />
                <xsd:element name="initializer" type="xsd:string"
                    minOccurs="0" />
                <xsd:element name="sessionTimeout" type="xsd:int"
                    minOccurs="0" />
                <xsd:element name="showBetaFeatures" type="xsd:boolean"
                    minOccurs="0" />
                <xsd:element name="enableHtmlApplications" type="xsd:boolean"
                    minOccurs="0" />					
                <xsd:element name="passwordChangeScript" type="xsd:string"
                    minOccurs="0" />
                <xsd:element name="fileBackupPath" type="xsd:string"
                    minOccurs="0" />
                <xsd:element name="dataLink" type="ekm:DataLink"
                    minOccurs="0" />
                <xsd:element name="mobileConnector" type="ekm:MobileConnector"
                    minOccurs="0" />
                <xsd:element name="mobileServer" type="ekm:MobileServer"
                    minOccurs="0" />
                <xsd:element name="modelCacheClass" type="xsd:string"
                    minOccurs="0" />
                <xsd:element name="ldap" type="ekm:Ldap"
                    minOccurs="0" />
                <xsd:element name="CORS" type="ekm:CORSConfig"
                    minOccurs="0" />
            </xsd:all>
        </xsd:complexType>
    </xsd:element>
</xsd:schema>
