changeset 222:84a6382b49c8

resources schema in progress
author sergey
date Mon, 27 Aug 2012 17:28:32 +0400
parents e997e6fbac0b
children edf011437be8
files _test/Resources/resources.xsd _test/Resources/sample.xml
diffstat 2 files changed, 46 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/_test/Resources/resources.xsd	Fri Aug 24 16:24:14 2012 +0400
+++ b/_test/Resources/resources.xsd	Mon Aug 27 17:28:32 2012 +0400
@@ -5,16 +5,16 @@
 	<element name="resources">
 		<complexType>
 			<sequence>
-				<element name="root" type="tns:restResource" />
+				<element name="root" type="tns:resourceContract" />
 				<element name="typeMap" minOccurs="0">
 					<complexType>
 						<sequence>
-							<element name="item" maxOccurs="unbounded">
+							<element name="contract" maxOccurs="unbounded">
 								<complexType>
 									<complexContent>
-										<extension base="tns:restResource">
+										<extension base="tns:resourceContract">
 											<sequence></sequence>
-											<attribute name="type" type="string">
+											<attribute name="type" type="string" use="required">
 											</attribute>
 										</extension>
 									</complexContent>
@@ -30,7 +30,7 @@
 								<complexType>
 									<complexContent>
 										<extension base="tns:resourceLocator">
-											<attribute name="name" />
+											<attribute name="name" type="string" />
 										</extension>
 									</complexContent>
 								</complexType>
@@ -45,9 +45,9 @@
 			<field xpath="@ref" />
 		</keyref>
 		<key name="locator-key">
-            <selector xpath="tns:locators/tns:locator" />
-            <field xpath="@name" />
-        </key>
+			<selector xpath="tns:locators/tns:locator" />
+			<field xpath="@name" />
+		</key>
 	</element>
 
 	<!-- abstract types -->
@@ -55,25 +55,31 @@
 	<complexType name="abstractTransformation" abstract="true" />
 	<complexType name="abstractResult" abstract="true" />
 
-	<complexType name="restResource">
+	<complexType name="resourceContract">
 		<sequence>
-			<element name="get" type="tns:restOperation" minOccurs="0" />
-			<element name="post" type="tns:restOperation" minOccurs="0" />
-			<element name="put" type="tns:restOperation" minOccurs="0" />
-			<element name="delete" type="tns:restOperation" minOccurs="0" />
-			<element name="resource" maxOccurs="unbounded"
-				minOccurs="0" >
+			<group ref="tns:restOperations"></group>
+			<element name="resource" maxOccurs="unbounded" minOccurs="0">
 				<complexType>
-				    <complexContent>
-				        <extension base="tns:restResource">
-				        </extension>
-				    </complexContent>
+					<sequence>
+						<element name="contract" type="tns:resourceContract" />
+					</sequence>
+					<attribute name="name" type="string" />
 				</complexType>
-				</element>
+			</element>
 		</sequence>
 	</complexType>
 
-	<complexType name="restOperation">
+	<group name="restOperations">
+		<sequence>
+			<element name="get" type="tns:operationContract" minOccurs="0" />
+			<element name="post" type="tns:operationContract" minOccurs="0" />
+			<element name="put" type="tns:operationContract" minOccurs="0" />
+			<element name="delete" type="tns:operationContract"
+				minOccurs="0" />
+		</sequence>
+	</group>
+
+	<complexType name="operationContract">
 		<sequence>
 			<element name="bind" type="tns:methodBinding" />
 			<element name="parameters" type="tns:transformation"
@@ -87,7 +93,7 @@
 			<element name="var" type="tns:bindingVariable" minOccurs="0"
 				maxOccurs="unbounded" />
 		</sequence>
-		<attribute name="text" type="string" use="required" />
+		<attribute name="bind" type="string" use="required" />
 	</complexType>
 
 	<complexType name="bindingVariable">
@@ -119,7 +125,7 @@
 		</restriction>
 	</simpleType>
 
-	<complexType name="redirectResult">
+	<complexType name="redirectResponse">
 		<complexContent>
 			<extension base="tns:abstractResult">
 				<choice>
--- a/_test/Resources/sample.xml	Fri Aug 24 16:24:14 2012 +0400
+++ b/_test/Resources/sample.xml	Mon Aug 27 17:28:32 2012 +0400
@@ -4,35 +4,40 @@
 	xsi:schemaLocation="http://implab.org/schemas/resources resources.xsd ">
 	<root>
 		<get>
-			<bind text="model" />
+			<bind bind="model" />
 		</get>
 
 		<resource name="projects">
 		    <contract>
 		      <get>
-		          <bind text="parent.model.projects" />
+		          <bind bind="parent.model.projects" />
 		      </get>
 		      <post>
-		          <bind text="parent.model.CreateProject($form)">
-		              <var name="form" text="request"/>
+		          <bind bind="parent.model.CreateProject($form)">
+		              <var name="form" bind="request"/>
 		          </bind>
+		          <response xsi:type="redirectResponse">
+		              <locatorRef ref="relative-locator"/>
+		          </response>
 		      </post>
 		    </contract>
+		    
+		    <resource match="(\w+)">
+		    
+		    </resource>
 		</resource>
 	</root>
 	<typeMap>
-		<item></item>
-		<item></item>
 	</typeMap>
 	<locators>
-		<locator name="relative">
-			<var name="id" text="model.id" />
-			<var name="parent" text="parent.location" />
+		<locator name="relative-locator">
+			<var name="id" bind="model.id" />
+			<var name="parent" bind="parent.location" />
 			<template>$parent/$id</template>
 		</locator>
-		<locator name="projects">
-			<var name="id" text="model.id" />
-			<var name="projects" text="application.locate('projects')" />
+		<locator name="projects-locator">
+			<var name="id" bind="model.id" />
+			<var name="projects" bind="application.locate('projects')" />
 			<template>$projects/$id</template>
 		</locator>
 	</locators>