<?xml version="1.0" encoding="UTF-8" ?>
<schema
	targetNamespace="http://www.eclipse.org/hyades/schema/Sensor.xsd"
	xmlns:Sensor="http://www.eclipse.org/hyades/schema/Sensor.xsd"
	xmlns:pu="http://www.eclipse.org/hyades/schema/ProcessUnit.xsd"
	xmlns:xs="http://www.w3.org/2001/XMLSchema"
	xmlns="http://www.w3.org/2001/XMLSchema"
	elementFormDefault="qualified">
	<annotation>
	  <documentation xml:lang="en">
	    Copyright (c) 2003 Hyades project.
		All rights reserved.   This program and the accompanying materials
		are made available under the terms of the Common Public License v1.0
		which accompanies this distribution, and is available at
		http://www.eclipse.org/legal/cpl-v10.html
	  </documentation>
	</annotation>
	<import
		namespace="http://www.eclipse.org/hyades/schema/ProcessUnit.xsd"
		schemaLocation="ProcessUnit.xsd" />
   <!-- Sensor
		A sensor consists of some space control related attributes and a single specific sensor implementation.
		A sensor is a processing unit aka component and has those implied attributes as well.
		maximumBlocking is used ot determine hwo many records can be passed out of the sensor. For example a value of 5
		implies that 5 or less records can be provided in one call to a sensor. This is an important tuning feature
		because large blocks reduce context flow overhead, yet also often require more memory.
	-->
	<complexType name="SensorConfigType">
		<choice>
			<element
				name="SingleFileSensor"
				type="Sensor:SingleFileSensorType"
				maxOccurs="1"
				minOccurs="1" />
			<element
				name="AdapterCBESensor"
				type="Sensor:AdapterCBESensorType"
				maxOccurs="1"
				minOccurs="1" />
			<element
				name="StaticParserSensor"
				type="Sensor:StaticParserSensorType"
				maxOccurs="1"
				minOccurs="1" />
		</choice>
		<attributeGroup ref="pu:ProcessUnitAttributes" />
		<attribute
			name="type"
			type="Sensor:SensorType"
			use="required" />
		<attribute
			name="maximumBlocking"
			type="string"
			use="required" />
	</complexType>
	<attributeGroup name="SensorAttributes">
		<annotation>
			<documentation>
				This is a group of attributes that are common to some of the sensors.
			</documentation>
		</annotation>
		<attribute
			name="directory"
			type="string"
			use="required">
			<annotation>
				<documentation>
					The directory path of the input file that will be
					read.
				</documentation>
			</annotation>
		</attribute>			
		<attribute
			name="fileName"
			type="string"
			use="required">
			<annotation>
				<documentation>
					The name of the input file that will be
					read.
				</documentation>
			</annotation>
		</attribute>
	</attributeGroup>
	
	
	<complexType name="SensorPropertyType">
		<annotation>
			<documentation>
				A generic sensor configuration property. 
			</documentation>
		</annotation>
		<attribute
			name="propertyName"
			type="string"
			use="required" />
		<attribute
			name="propertyValue"
			type="string"
			use="required" />
	</complexType>
	
	
	<complexType name="SensorBaseType">
		<annotation>
			<documentation>
				The sensor base type that contains a sequence of zero or more properties. 
			</documentation>
		</annotation>
		<sequence>
   			<element name="SensorProperty" type="Sensor:SensorPropertyType" maxOccurs="unbounded" minOccurs="0"/>
  		</sequence>
  	</complexType>
	
	
	<complexType name="AdapterCBESensorType">
		<annotation>
			<documentation>
				This is a special sensor because it is monitoring the adapter itself. It also takes CBEs as input in order
				to minumize processing costs of the adpator itself. It has no special configuration.
			</documentation>
		</annotation>
		<complexContent>
			<extension base="Sensor:SensorBaseType">
			</extension>
		</complexContent>
	</complexType>
	
	
	
	<complexType name="SingleFileSensorType">
		<annotation>
			<documentation>
				A single file sensor monitors a given file in a given directory. If a converter is provided
				it is used to preprocess the entire file as it existed before reading it.
			</documentation>
		</annotation>
		<complexContent>
			<extension base="Sensor:SensorBaseType">
				
				<attributeGroup ref="Sensor:SensorAttributes" />
				<attribute
					name="converter"
					type="string"
					use="optional" />
				<attribute
					name="shell"
					type="string"
					use="optional" />
			</extension>
		</complexContent>
	</complexType>
	
	
	
	<complexType name="StaticParserSensorType">
		<annotation>
			<documentation>
				A sensor that runs a static parser to parse a log file.
			</documentation>
		</annotation>
		<complexContent>
			<extension base="Sensor:SensorBaseType">
				
				<attributeGroup ref="Sensor:SensorAttributes"/>
				<attribute
					name="parserClassName"
					type="string"
					use="required">
					<annotation>
						<documentation>
							The full class name of the static parser that will
							be executed.  The name must include the package.
						</documentation>
					</annotation>
				</attribute>	
				
			</extension>
		</complexContent>
	</complexType>
	
	
	<!-- Sensor Type
		This list is a place to list the possible Sensor types that are known and can be configured.
	-->
	<simpleType name="SensorType">
		<annotation>
			<documentation>
				The basic sensor types that are understood
			</documentation>
		</annotation>
		<restriction base="NCName">
			<!--
				A simple sensor to monitor the adpator itself
			-->
			<enumeration value="AdapterCBESensor" />
			<!--
				A simple sensor to monitor a single file
			-->
			<enumeration value="SingleFileSensor" />
			<!--
				A sensor to run a static parser against a log file
			-->
			<enumeration value="StaticParserSensor" />
			<!--
				The role of undeclared component role is to allow a context to exploit components not as yet standardized.
			-->
			<enumeration value="undeclared" />
		</restriction>
	</simpleType>
</schema>
