Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

COSMOS Design 197833

Design Discussion for 197833: Need an XML schema for the assembly XML

XML Schema for COSMOS DC framework

This design document addresses COSMOS Bugzilla enhancement request 197833.


Change History:

Joel Hawkins 9/05/2007 Initial version

Overview

The COSMOS Data Collection component needs an XML Schema definition for constructing and validating Assembly specifications. The creation of such a schema well enable tooling as well as providing an additional mechanism to ensure that only correctly specified assemblies are deployed.

Some concern has been raised over the complexity of the implicit assembly construction, namely the fact that component relationships are specified using a nesting structure. While this nested structure allows for very general specification of component relationships, for many cases a simpler - more linear model is appropriate. COSMOS should support both models in order to ease adoption without sacrificing power and flexibility.

Implementation Stages and Corporate Use Cases

Convert to the new Schema in iteration 6. Implement tooling under the Management Enablement project at some point in the future.

Terminologies/Acronyms

The terminologies/acronyms below are commonly used throughout this document. The list below defines each term:

PIPELINED ASSEMBLY: An assembly specified by a root component and a linear sequence of components forming one single straight path through the assembly

MULTIPLEXED PIPELINED ASSEMBLY: An assembly specified by a root component and a set channels, each comprised of linear sequence of components forming single straight paths through the assembly

NESTED ASSEMBLY: An assembly specified by a root component which an arbitrary number of child components, each of which may contain an arbitrary number of child components, ad nauseum.

Use Cases

Use Case 1. Nested Descriptors

<?xml version="1.0" encoding="UTF-8"?>
<!--
 *  Test configuration for outbound pipeline
 -->
<cosmos:context xmlns:cosmos="http://www.eclipse.org/xmlns/cosmos/1.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
	xmlns:test="http://www.eclipse.org/xmlns/cosmos/test/1.0 org/eclipse/cosmos/dc/tests/xml/configs/CosmosTestBinding.xsd " 
	xsi:schemaLocation="http://www.eclipse.org/xmlns/cosmos/1.0 CosmosDataCollectionAssembly.xsd "	
	name="TestNestedQuery" id="http://MySpecialURI/TestNestedQuery">
	<query cosmos:factory="TestQuery" cosmos:optimizable="true">
		<filter cosmos:factory="TestFilter" cosmos:optimizable="false">
			<test:binding/>
				<transform cosmos:factory="TestTransform" cosmos:optimizable="false">
					<test:binding/>
				<response cosmos:factory="TestResponse" cosmos:optimizable="true">
					<test:binding/>
				</response>
			</transform>
			<transform cosmos:factory="TestTransformBranch" cosmos:optimizable="false">
				<test:binding/>
				<response cosmos:factory="TestResponse" cosmos:optimizable="true">
					<test:binding/>
				</response>
			</transform>
		</filter>
	</query>    
</context>

Use Case 2. PipeLine Descriptors

Link to Hubert's discussion of pipelines.

<?xml version="1.0" encoding="UTF-8"?>
<!--
 *  Test configuration for outbound pipeline
 -->
<cosmos:context xmlns:cosmos="http://www.eclipse.org/xmlns/cosmos/1.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
	xmlns:test="http://www.eclipse.org/xmlns/cosmos/test/1.0 org/eclipse/cosmos/dc/tests/xml/configs/CosmosTestBinding.xsd " 
	xsi:schemaLocation="http://www.eclipse.org/xmlns/cosmos/1.0 CosmosDataCollectionAssembly.xsd "	
	name="TestChannel" id="http://MySpecialURI/TestChannel">
	<cosmos:channel>
	<cosmos:query factory="TestQueryFactory" optimizable="true">
		<test:binding/>
	</cosmos:query>
		<cosmos:transform factory="TestTransformFactory" optimizable="false">
			<test:binding/>
		</cosmos:transform>
			<cosmos:response factory="TestResponseFactory" optimizable="true">
				<test:binding/>
			</cosmos:response>
	</cosmos:channel>   
</cosmos:context>
<?xml version="1.0" encoding="UTF-8"?>
<!--
 *  Test configuration for outbound pipeline
 -->
<cosmos:context xmlns:cosmos="http://www.eclipse.org/xmlns/cosmos/1.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
	xmlns:test="http://www.eclipse.org/xmlns/cosmos/test/1.0 org/eclipse/cosmos/dc/tests/xml/configs/CosmosTestBinding.xsd " 
	xsi:schemaLocation="http://www.eclipse.org/xmlns/cosmos/1.0 CosmosDataCollectionAssembly.xsd "	
	name="TestMultiplex" id="http://MySpecialURI/TestMultiplex">
	<cosmos:multiplex>
	<cosmos:source factory="TestSourceFactory" optimizable="true">
		<test:binding/>
	</cosmos:source>
	<cosmos:channel>
		<cosmos:transform factory="TestTransformFactory" optimizable="false">
			<test:binding/>
		</cosmos:transform>
			<cosmos:sink factory="TestSinkFactory" optimizable="true">
				<test:binding/>
			</cosmos:sink>
	</cosmos:channel>
	<cosmos:channel>
		<cosmos:filter factory="TestFilterFactory" optimizable="false">
			<test:binding/>
		</cosmos:filter>
			<cosmos:sink factory="TestSinkFactory" optimizable="true">
				<test:binding/>
			</cosmos:sink>
	</cosmos:channel>
	</cosmos:multiplex>   
</cosmos:context>

External Interfaces

The following is the proposed Schema:

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
	targetNamespace="http://www.eclipse.org/xmlns/cosmos/1.0"
	xmlns:tns="http://www.eclipse.org/xmlns/cosmos/1.0"
	elementFormDefault="qualified">

	<!-- The base type must specify a binding. Sadly, XML Schema does not allow us to place 
		restrictions on the 'any' element, therefore we can't enforce the inclusion of a binding
		element from an arbitrary schema. 
	-->
	<include schemaLocation="CosmosDataCollectionTypes.xsd"></include>
	
	<complexType name="ComponentBaseType" abstract="true">
		<sequence>
			<any minOccurs="1" maxOccurs="1" namespace="##other"
				processContents="lax">
			</any>
			<element ref="tns:ComponentBase" maxOccurs="unbounded"
				minOccurs="0">
			</element>
		</sequence>
		<attribute name="factory" use="required" type="string"></attribute>
		<attribute name="optimizable" type="string" default="true"></attribute>
	</complexType>

	<complexType name="SourceType">
		<complexContent>
			<extension base="tns:ComponentBaseType">

				<choice>
					<element ref="tns:dataSource"></element>
					<element ref="tns:dataSourceRef"></element>
				</choice>
			</extension>
		</complexContent>
	</complexType>

	<complexType name="FilterType">
		<complexContent>
			<extension base="tns:ComponentBaseType"></extension>
		</complexContent>
	</complexType>

	<complexType name="SinkType">
		<complexContent>
			<restriction base="tns:ComponentBaseType">
				<sequence>
					<any minOccurs="1" maxOccurs="1" namespace="##other"
						processContents="lax">
					</any>

					<choice>
						<element ref="tns:keySet"></element>
						<element ref="tns:keySetRef"></element>
					</choice>
				</sequence>
				<attribute name="factory" type="string"
					use="required">
				</attribute>
			</restriction>
		</complexContent>
	</complexType>

	<complexType name="TransformType">
		<complexContent>
			<extension base="tns:ComponentBaseType"></extension>
		</complexContent>
	</complexType>

	<complexType name="ResponseType">
		<complexContent>
			<restriction base="tns:ComponentBaseType">
				<sequence>
					<any minOccurs="1" maxOccurs="1" namespace="##other"
						processContents="lax">
					</any>
				</sequence>
				<attribute name="factory" type="string"
					use="required">
				</attribute>
			</restriction>
		</complexContent>
	</complexType>

	<complexType name="QueryType">
		<complexContent>
			<extension base="tns:ComponentBaseType"></extension>
		</complexContent>
	</complexType>

	<complexType name="ContextType">
		<choice>
			<element ref="tns:query"></element>
			<element ref="tns:source"></element>
			<element ref="tns:channel"></element>
			<element ref="tns:multiplex"></element>
		</choice>
		<attribute name="name" type="string" use="required"></attribute>
		<attribute name="id" type="anyURI" use="required"></attribute>
		<attribute name="buffersize" type="int"></attribute>
	</complexType>


	<complexType name="MutliplexType">
		<choice>
			<sequence>
				<element ref="tns:source" />
				<element name="channel"
					type="tns:MultiplexSourceChannelType" minOccurs="1"
					maxOccurs="unbounded" />
			</sequence>
			<sequence>
				<element ref="tns:query" />
				<element name="channel"
					type="tns:MultiplexQueryChannelType" minOccurs="1"
					maxOccurs="unbounded" />
			</sequence>
		</choice>
	</complexType>

	<complexType name="MultiplexSourceChannelType">
		<sequence>
			<element ref="tns:transform" maxOccurs="1" minOccurs="0"></element>
			<element ref="tns:filter" maxOccurs="1" minOccurs="0"></element>
			<element ref="tns:transform" maxOccurs="1" minOccurs="0"></element>
			<element ref="tns:sink" maxOccurs="1" minOccurs="0"></element>
		</sequence>
	</complexType>

	<complexType name="MultiplexQueryChannelType">
		<sequence>
			<element ref="tns:transform" maxOccurs="1" minOccurs="0"></element>
			<element ref="tns:filter" maxOccurs="1" minOccurs="0"></element>
			<element ref="tns:transform" maxOccurs="1" minOccurs="0"></element>
			<element ref="tns:response" maxOccurs="1" minOccurs="1"></element>
		</sequence>
	</complexType>

	<complexType name="ChannelType">
		<sequence>
			<choice>
				<sequence>
					<element ref="tns:source" maxOccurs="1"
						minOccurs="1">
					</element>
					<element ref="tns:transform" maxOccurs="1"
						minOccurs="0">
					</element>
					<element ref="tns:filter" maxOccurs="1"
						minOccurs="0">
					</element>
					<element ref="tns:transform" maxOccurs="1"
						minOccurs="0">
					</element>
					<element ref="tns:sink" maxOccurs="1"
						minOccurs="0">
					</element>
				</sequence>
				<sequence>
					<element ref="tns:query" maxOccurs="1"
						minOccurs="1">
					</element>
					<element ref="tns:transform" maxOccurs="1"
						minOccurs="0">
					</element>
					<element ref="tns:filter" maxOccurs="1"
						minOccurs="0">
					</element>
					<element ref="tns:transform" maxOccurs="1"
						minOccurs="0">
					</element>
					<element ref="tns:response" maxOccurs="1"
						minOccurs="0">
					</element>
				</sequence>
			</choice>
		</sequence>
	</complexType>

	<element name="filter" type="tns:FilterType"
		substitutionGroup="tns:ComponentBase">
	</element>

	<element name="query" type="tns:QueryType"></element>

	<element name="response" type="tns:ResponseType"
		substitutionGroup="tns:ComponentBase">
	</element>

	<element name="sink" type="tns:SinkType"
		substitutionGroup="tns:ComponentBase">
	</element>

	<element name="source" type="tns:SourceType"></element>

	<element name="transform" type="tns:TransformType"
		substitutionGroup="tns:ComponentBase">
	</element>

	<element name="context" type="tns:ContextType"></element>

	<element name="ComponentBase" type="tns:ComponentBaseType"></element>

	<element name="channel" type="tns:ChannelType"></element>

	<element name="multiplex" type="tns:MutliplexType"></element>

</schema>

Framework Implementation Details

Assembly parsing is handled by the runtime, and uses the XmlUtils.createDocument(InputStream stream) method. This method does not do schema validation. The runtime should support a configuration options to do schema validation on loading, which may be defaulted to 'false' initially.

Assembly loading is handled in the AbstractContext.load(Document doc) method. This method will be extended to handle conversion of the Pipelined and Multiplex Pipelined specifications into the same internal format that is used by the existing Nested assembly type, as both cases are just special forms of a generic tree structure.

Notes

Support for declarative registration? How to handle registration of data sets/etc. - use SML fragments? Interaction with DataBroker design Default setting for schema validation.


Back to the top