Mercurial > pub > Impl
changeset 224:e6c050db7d98
resources schema update
author | sergey |
---|---|
date | Wed, 29 Aug 2012 17:28:13 +0400 |
parents | edf011437be8 |
children | a1e868b0fba9 |
files | _test/Resources/resources.xsd _test/Resources/sample.xml |
diffstat | 2 files changed, 52 insertions(+), 78 deletions(-) [+] |
line wrap: on
line diff
--- a/_test/Resources/resources.xsd Tue Aug 28 17:29:42 2012 +0400 +++ b/_test/Resources/resources.xsd Wed Aug 29 17:28:13 2012 +0400 @@ -13,25 +13,8 @@ <complexType> <complexContent> <extension base="tns:ResourceContract"> - <all> - <element name="modelType" type="tns:ClassName" /> - </all> <attribute name="id" type="string" /> - </extension> - </complexContent> - </complexType> - </element> - </sequence> - </complexType> - </element> - <element name="locators" minOccurs="0"> - <complexType> - <sequence> - <element name="locator" maxOccurs="unbounded"> - <complexType> - <complexContent> - <extension base="tns:ResourceLocator"> - <attribute name="name" type="string" /> + <attribute name="modelType" type="tns:ClassName"/> </extension> </complexContent> </complexType> @@ -41,14 +24,6 @@ </element> </sequence> </complexType> - <keyref name="locator-key-ref" refer="tns:locator-key"> - <selector xpath=".//tns:response/tns:locatorRef" /> - <field xpath="@ref" /> - </keyref> - <key name="locator-key"> - <selector xpath="tns:locators/tns:locator" /> - <field xpath="@name" /> - </key> </element> <!-- abstract types --> @@ -101,8 +76,14 @@ <complexContent> <extension base="tns:MethodBinding"> <sequence> - <element name="response" type="tns:AbstractResult" - minOccurs="0" /> + <element name="response" minOccurs="0"> + <complexType> + <choice> + <element name="redirect" type="tns:RedirectResponse" /> + <element name="transform" type="tns:Transformation"/> + </choice> + </complexType> + </element> </sequence> </extension> </complexContent> @@ -118,24 +99,24 @@ </complexType> <complexType name="BindingVariable"> - <complexContent> - <extension base="tns:MethodBinding"> - <attribute name="name" type="string" /> - </extension> - </complexContent> + <choice> + <element name="bind" type="tns:MethodBinding" /> + <element name="transform" type="tns:Transformation" /> + </choice> + <attribute name="name" type="tns:IdentifierName" use="required" /> </complexType> - <complexType name="transformation"> - <attribute name="class" type="string" /> + <complexType name="Transformation"> + <sequence> + <element name="target" type="tns:MethodBinding" minOccurs="0"/> + <element name="transform" type="tns:Transformation" minOccurs="0"/> + </sequence> + <attribute name="class" type="tns:ClassName" use="required" /> </complexType> <complexType name="ResourceLocator"> - <sequence> - <element name="var" type="tns:BindingVariable" minOccurs="0" - maxOccurs="unbounded" /> - <element name="template" type="string" /> - </sequence> + <attribute name="locator" type="string" use="required" /> </complexType> <simpleType name="RedirectCodes"> @@ -149,15 +130,10 @@ <complexType name="RedirectResponse"> <complexContent> <extension base="tns:AbstractResult"> - <choice> - <element name="locator" type="tns:ResourceLocator" /> - <element name="locatorRef"> - <complexType> - <attribute name="ref" type="string" /> - </complexType> - </element> + <sequence> + <element name="location" type="tns:ResourceLocator" /> <element name="status" type="tns:RedirectCodes" minOccurs="0" /> - </choice> + </sequence> </extension> </complexContent> </complexType> @@ -168,4 +144,10 @@ </restriction> </simpleType> + <simpleType name="IdentifierName"> + <restriction base="string"> + <pattern value="\w+" /> + </restriction> + </simpleType> + </schema> \ No newline at end of file
--- a/_test/Resources/sample.xml Tue Aug 28 17:29:42 2012 +0400 +++ b/_test/Resources/sample.xml Wed Aug 29 17:28:13 2012 +0400 @@ -7,53 +7,45 @@ <resource> <name>projects</name> - <model expr="model"/> + <model expr="model" /> <get expr="model.projects" /> <post expr="model.CreateProject(project)"> - <var name="project" expr="BindModel()"/> - <response xsi:type="RedirectResponse"> - <locatorRef ref="projects-locator" /> + <var name="project"> + <transform class="IMPL::Web::Transform::BindModel" /> + </var> + <response> + <redirect> + <location locator="projects-locator" /> + </redirect> </response> </post> <resource> <match>(\w+)</match> - <model expr="model.GetProject(resourceId)"/> - - <get expr="model"/> + <model expr="model.GetProject(resourceId)" /> + + <get expr="model" /> <put expr="model.update(data)"> </put> - + <resource> - <name>library</name> - <model expr="model"/> - <get expr="model"/> + <name>library</name> + <model expr="model" /> + <get expr="model" /> </resource> <resource> - <name>sources</name> - <model expr="model"/> - <get expr="model"/> + <name>sources</name> + <model expr="model" /> + <get expr="model" /> </resource> </resource> </resource> </root> <contracts> - <contract id="project-contract"> - <modelType>Benzin::Model::Project</modelType> - <get/> - </contract> + <contract id="project-contract"> + <modelType>Benzin::Model::Project</modelType> + <get expr="model"/> + </contract> </contracts> - <locators> - <locator name="relative-locator"> - <var name="id" expr="model.id" /> - <var name="parent" expr="parent.location" /> - <template>$parent/$id</template> - </locator> - <locator name="projects-locator"> - <var name="id" expr="model.id" /> - <var name="projects" expr="application.locate('projects')" /> - <template>$projects/$id</template> - </locator> - </locators> </resources> \ No newline at end of file