<?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="http://schemas.webs.idu.de/cardo3/Monitor" elementFormDefault="qualified" xmlns="http://schemas.webs.idu.de/cardo3/Monitor" xmlns:mstns="http://schemas.webs.idu.de/cardo3/cardo3api" xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<!--
	 Konfiguration für Versenden von E-Mails
	 -->
	<xs:complexType name="MailNotificationConfigurationType">
		<xs:sequence>
			<xs:choice minOccurs="0" maxOccurs="1">
				<xs:element name="MailServer" type="xs:string" maxOccurs="1" minOccurs="0" nillable="false">
					<xs:annotation>
						<xs:documentation>
							Adresse des E-Mail Servers.
						</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="MailServerConfig">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="Adress" type="xs:string" minOccurs="1" maxOccurs="1"/>
							<xs:element name="Port" type="xs:int" minOccurs="1" maxOccurs="1"/>
							<xs:element name="AllowSSL" type="xs:boolean" minOccurs="1" maxOccurs="1"/>
							<xs:element name="UserName" type="xs:string" minOccurs="0" maxOccurs="1" />
							<xs:element name="Password" type="PasswordStringType" minOccurs="0" maxOccurs="1" />
						</xs:sequence>
					</xs:complexType>
				</xs:element>
			</xs:choice>
			<xs:element name="Recipients" type="xs:string" maxOccurs="unbounded" minOccurs="0" nillable="false">
				<xs:annotation>
					<xs:documentation>
						E-Mail Adressen der Empfänger.
					</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="Sender" type="xs:string" maxOccurs="1" minOccurs="1" nillable="false">
			</xs:element>
			<xs:element name="SecondsBetweenNextMail" type="xs:int" maxOccurs="1" minOccurs="1" nillable="false" default="20">
				<xs:annotation>
					<xs:documentation>
						Anzahl der Sekunden, die gewartet werden muss, bis die nächste E-Mail versendet wird.
					</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
	<xs:simpleType name="timeoutRestrictionMillisecondsType">
		<xs:restriction base="xs:int">
			<xs:maxInclusive value="3600000"/>
			<xs:minInclusive value="1000" />
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="timeoutRestrictionMinutesType">
		<xs:restriction base="xs:int">
			<xs:maxInclusive value="2880"/>
			<xs:minInclusive value="5" />
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="GlobalQueueWatchMode">
		<xs:restriction base="xs:string">
			<xs:enumeration value="Auto">
			</xs:enumeration>
			<xs:enumeration value="Always">
			</xs:enumeration>
			<xs:enumeration value="Never">
			</xs:enumeration>
		</xs:restriction>
	</xs:simpleType>
	<xs:complexType name="IwanLogConfigType">
		<xs:sequence>
			<xs:element name="WakeUpMilliseconds" type="timeoutRestrictionMillisecondsType" maxOccurs="1" minOccurs="1" nillable="false" default="30000">
				<xs:annotation>
					<xs:documentation>
						Gibt an, alle wie viel Millisekunden der Monitor das Mapserver-Logfile analysieren soll.
						Der Standardwert sind 30 Sekunden.
					</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="MapServerServiceUrl" type="xs:string" nillable="false" maxOccurs="1" minOccurs="0">
				<xs:annotation>
					<xs:documentation>
						Hier muss die Dienste-URL für den net2 Ordner des Mapservers angegeben werden.
						Bsp.: http://localhost:8280/cardo/net2.
						Wenn zusätzlich cardo Instanzen überwacht werden, kann die URL auch über den cardo Service bezogen werden, eine Angabe
						ist dann an dieser Stelle nicht erforderlich.
					</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
	<!--
		Konfiguration für eine cardo Instanz um das Schreiben der Iwan Log's in die Cardo Log's zu aktivieren
	-->
	<xs:complexType name="IwanToCardoLogWriterConfigType">
		<xs:sequence>
			<xs:element name="WakeUpMilliseconds" type="timeoutRestrictionMillisecondsType">
				<xs:annotation>
					<xs:documentation>
						Gibt an, alle wie viel Millisekunden der Monitor das Mapserver-Logfile analysieren soll.
						Der Standardwert sind 60 Sekunden.
					</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
		<xs:attribute name="enabled" type="xs:boolean" default="true">
			<xs:annotation>
				<xs:documentation>Gibt an, ob die Überwachung aktiviert ist oder nicht.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>
	<!--
		Konfiguration für ÜBerwachung des Zustands einer cardo Instanz
	-->
	<xs:complexType name="CardoHealthCheckConfigType">
		<xs:sequence>
			<xs:element name="WakeUpMilliseconds" type="timeoutRestrictionMillisecondsType">
				<xs:annotation>
					<xs:documentation>
						Gibt an, alle wie viel Millisekunden der Monitor die cardo Instanz anpingen soll.
						Der Standardwert sind 60 Sekunden.
					</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
		<xs:attribute name="enabled" type="xs:boolean" default="true">
			<xs:annotation>
				<xs:documentation>Gibt an, ob die Überwachung aktiviert ist oder nicht.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>

	<!--
		Für Unterelemente der CardoTriggerConfigType 
	-->
	<xs:complexType name="TriggerBaseType" abstract="false">
		<xs:sequence>
			<xs:element name="WakeUpMinutes" type="timeoutRestrictionMinutesType" maxOccurs="1" minOccurs="0">
				<xs:annotation>
					<xs:documentation>
						Gibt an, alle wie viel Minuten der Monitor Batch aufrufen soll. Wenn hier nicht definiert, dann wird das WakeUpMinutes verwendet.
					</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
		<xs:attribute name="enabled" type="xs:boolean" default="true">
			<xs:annotation>
				<xs:documentation>Gibt an, ob das Feature aktiviert ist oder nicht.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>
	<xs:complexType name="PasswordStringType">
		<xs:simpleContent>
			<xs:extension base="xs:string">
				<xs:attribute name="isEncrypted" type="xs:boolean"></xs:attribute>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<!--
		Konfiguration für ÜBerwachung des Zustands einer cardo Instanz
	-->
	<xs:complexType name="CardoTriggerConfigType">
		<xs:sequence>
			<xs:element name="WakeUpMinutes" type="timeoutRestrictionMinutesType" default="30">
				<xs:annotation>
					<xs:documentation>
						Gibt an, alle wie viel Minuten der Monitor die cardo Instanz anpingen soll.
						Der Standardwert sind 30 Minuten.
					</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="cardo3RootUrl" type="xs:string" minOccurs="0" maxOccurs="1" nillable="1">
				<xs:annotation>
					<xs:documentation>
						Wenn die Dienste-URL der Monitor-Konfiguration auf cardo.Map zeigt, muss
						hier die URL zum Root der cardo3 Anwendung eingetragen werden.
						Bsp.: http://localhost:90/
					</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="cardo3UserName" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false">
				<xs:annotation>
					<xs:documentation>
						Der Benutzername für cardo3, der für die Ausführung des Batches verwendet werden soll. Wenn nicht angegeben, dann wird die Account verwendet, unter dem der Prozess akutell läuft..
						Für Windows-Auth empfehlen wir, einen Benutzer SYSTEM_CARDO_LOCAL_TRUSTED_USER anzulegen und den Monitor unter diesem Account laufen zu lassen.
						Für Basic-Auth sollten Sie immer SYSTEM_CARDO_LOCAL_TRUSTED_USER verwenden, für diesen ist kein Kennwort erforderlich.
						Hinweis: Verwenden Sie die Schreibweise "benutzer@domäne.de" statt "benutzer\domäne" für Domänenkonten.
						
					 Ist der Wert leer, wird eine Windows-Auth verwendet. der Account ist dann der Dienste-Account.
					</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="cardo3UserPassword" minOccurs="0" maxOccurs="1" nillable="false" type="PasswordStringType">
				<xs:annotation>
					<xs:documentation>
						Wenn ein Benutzer angegeben wurden (und nicht der SYSTEM_CARDO_LOCAL_TRUSTED_USER) dann muss hier das Kennwort hinterlegt werden.
					</xs:documentation>
				</xs:annotation>
			</xs:element>

			<xs:element name="ShadowCopiesBatch" type="TriggerBaseType" minOccurs="0" maxOccurs="1">
				<xs:annotation>
					<xs:documentation>
						Aktiviert die Aktualisierung der Schatten-Kopien.
					</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="OrfBatch" type="TriggerBaseType" minOccurs="0" maxOccurs="1">
				<xs:annotation>
					<xs:documentation>
						Aktiviert die Aktualisierung der Orf Einträge. Eine Lizenz für das Modul muss vorhanden sein, zudem muss der für Trigger eingetragene Benutzer SU sein.
					</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="ExportToCswBatch" type="TriggerBaseType" minOccurs="0" maxOccurs="1">
				<xs:annotation>
					<xs:documentation>
						Aktiviert den Export der Metadaten zu einem CSW. Eine Lizenz für das Modul muss vorhanden sein, zudem muss der für Trigger eingetragene Benutzer SU sein.
					</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="TaskSchedulerBatch" type="TriggerBaseType" minOccurs="0" maxOccurs="1">
				<xs:annotation>
					<xs:documentation>
						Weitere in cardo integrierte Zeit-Ereignisse. Standard ist 15min + aktiviert.
					</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
		<xs:attribute name="enabled" type="xs:boolean" default="true">
			<xs:annotation>
				<xs:documentation>Gibt an, ob das Feature aktiviert ist oder nicht.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>
	<xs:complexType name="CardoMonitorConfigType">
		<xs:sequence>
			<xs:element name="WatchGlobalQueueMode" type="GlobalQueueWatchMode" maxOccurs="1" minOccurs="1" nillable="false">
				<xs:annotation>
					<xs:documentation>
						Gibt an, ob in jedem Fall die Überwachung der Cluster-Member von dieser Monitorinstanz ausgeführt werden soll.
						Ist hier Auto angegeben, werden die Cluster-Member überwacht, wenn mind. einer der CardoMonitorServicesUrl ein Cluster-Member ist.
					</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="MessageCollectionDurationMillisecondsLocalQueue" type="timeoutRestrictionMillisecondsType" maxOccurs="1" minOccurs="1" nillable="false" default="10000">
				<xs:annotation>
					<xs:documentation>
						Die Dauer in Millisekunden, die nach der letzten Nachricht gewartet werden soll, bis die Cache - Events
						weitergeleitet werden. Der Standardwert ist 10sek. (10000 ms).
						Innerhalb dieses Zeitraumes werden die Nachrichten gesammelt, Duplikate werden entfernt.
						Hier wird der Timeout für die lokale Queue festgelegt.
					</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="MessageCollectionDurationMillisecondsGlobalQueue" type="timeoutRestrictionMillisecondsType" maxOccurs="1" minOccurs="1" nillable="false" default="10000">
				<xs:annotation>
					<xs:documentation>
						Die Dauer in Millisekunden die nach der letzten Nachricht gewartet werden soll, bis die Cache - Events
						weitergeleitet werden. Der Standardwert ist 10sek. (10000 ms).
						Innerhalb dieses Zeitraumes werden die Nachrichten gesammelt, Duplikate werden entfernt.
						Hier wird der Timeout für die globale Queue festgelegt.
					</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="CardoMonitorServicesUrl" nillable="false" maxOccurs="unbounded" minOccurs="0">
				<xs:annotation>
					<xs:documentation>
						Definiert eine cardo Instanz für die Überwachung.
					</xs:documentation>
				</xs:annotation>
				<xs:complexType>
					<xs:sequence>
						<xs:element name="ServiceUrl" type="xs:string" nillable="false" maxOccurs="1" minOccurs="1">
							<xs:annotation>
								<xs:documentation>
									Hier muss die Dienste-URL für den MonitorService hinterlegt werden. Die Dienste-URL muss vollständig angegeben werden.
									Bsp.: http://localhost:90/net3/public/services/MonitorServiceServices.asmx
								</xs:documentation>
							</xs:annotation>
						</xs:element>
						<xs:element name="IwanToCardoLogWriterConfig" type="IwanToCardoLogWriterConfigType" nillable="false" maxOccurs="1" minOccurs="0">
							<xs:annotation>
								<xs:documentation>
									Um das Übertragen der Details der Mapserver Logs als Zusammenfassung in die cardo3 Datenbank zu schreiben, kann dieses Element aktiviert werden.
									Hinweis: Dies ist nur sinnvoll, wenn der Monitor auf dem gleichen Rechner wie die cardo Instanz läuft.
								</xs:documentation>
							</xs:annotation>
						</xs:element>
						<xs:element name="CheckHealtyState" type="CardoHealthCheckConfigType" nillable="false" maxOccurs="1" minOccurs="0">
							<xs:annotation>
								<xs:documentation>
									Wenn der Gesundheitszustand einer cardo Instanz überwacht werden soll, kann hier die Konfiguration erfolgen.
								</xs:documentation>
							</xs:annotation>
						</xs:element>
						<xs:element name="TriggerBatchEvents" type="CardoTriggerConfigType" nillable="false" maxOccurs="1" minOccurs="0">
							<xs:annotation>
								<xs:documentation>
									Löst zeitgesteuert Batch-Ereignisse aus. Z.B. für das Modul c2c, die Dienste-URL muss dabei auf cardo3 zeigen.
								</xs:documentation>
							</xs:annotation>
						</xs:element>
						<xs:element name="Cardo4KeepAlive" minOccurs="0" maxOccurs="1">
							<xs:complexType>
								<xs:sequence>
									<xs:element name="cardo4SiteName" minOccurs="0" maxOccurs="1" default="net4" type="xs:string">
										<xs:annotation>
											<xs:documentation>Der Name der cardo4 Seite unterhalb der cardo Site, normalerweise Net4</xs:documentation>
										</xs:annotation>
									</xs:element>
								</xs:sequence>
								<xs:attribute name="enable" default="true" type="xs:boolean"/>
								<xs:attribute name="useDefaultCredential" use="required" type="xs:boolean">
									<xs:annotation>
										<xs:documentation>
											Wenn true, dann Windows-Auth, sonst immer der LOCAL_TRUSTED_USER
										</xs:documentation>
									</xs:annotation>
								</xs:attribute>
							</xs:complexType>
						</xs:element>

					</xs:sequence>
					<xs:attribute name="watchMapserverLog" type="xs:boolean" use="required" />
					<xs:attribute name="watchCacheMessages" type="xs:boolean" use="required" />
				</xs:complexType>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
	<!--
	Gesamtkonfigurationselement für den Monitor-Dienst
	-->
	<xs:element name="MonitorConfiguration">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="GlobalEmailConfiguration" type="MailNotificationConfigurationType" maxOccurs="1" minOccurs="0" nillable="false">
					<xs:annotation>
						<xs:documentation>
							Globale Definition für die E-Mail Konfiguration. Fehler und Statusmeldungen werden dann per E-Mail zugestellt.
						</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="IwanLogMonitorConfiguration" type="IwanLogConfigType" minOccurs="1" maxOccurs="1" nillable="false" />
				<xs:element name="CardoInstancesToMonitor" type="CardoMonitorConfigType" minOccurs="0" maxOccurs="1" nillable="false" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
</xs:schema>