riddl 0.99.109 → 0.99.111

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2da031ad0aa59f0bec0e69bbe8e50dfccce913a6
4
- data.tar.gz: 71239caa3baf80a4f45c4fa7acbb84238ad198b6
3
+ metadata.gz: cd715a102e43838a13d1a8afe207ffb2283f1669
4
+ data.tar.gz: 6dfe6e5dfb436212f8f46a20e53237e770dcb792
5
5
  SHA512:
6
- metadata.gz: 591d8d2106d582a18d139c6fd1faf974814d66008c1c763a58e70236e5ec47630238ce18bc88a441a7db7191016dc7c3fda9b78149e01eaed0b7618518a3e301
7
- data.tar.gz: b5dbd477183569ecf0e28410307b51f834bcc2cf8fc0dc8cc440a99ade9e4417c33393e7350bce75b2e9517c196b9a84f668cfd52b30cb9d275b1decd38bc47d
6
+ metadata.gz: 7f7a0a7295fed1bac22002b7495e97d628eaffa6c0a135882b1f7c920d2b63e01d30a2c198ab814351f6f5c52ba7264e0938878a2ca2a5892e6bc76df3b6d4fa
7
+ data.tar.gz: ddf4344367c7838d51ceed0833016fd94641183d1a45979e52c09fd0342655f935a6b799c3bca476bb49aae36dc74a98531d44f349d6c5c69ac76c3595430af8
data/lib/riddl/client.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require 'rubygems'
2
2
  require 'net/https'
3
- require 'socket'
4
3
  require 'eventmachine'
5
4
  require 'em-websocket-client'
6
5
  require 'blather/client/client'
@@ -322,20 +321,30 @@ unless Module.constants.include?('CLIENT_INCLUDED')
322
321
  http.set_debug_output @options[:debug]
323
322
  end
324
323
  http.start do
325
- http.request(req) do |resp|
326
- res = resp
327
- bs = Parameter::Tempfile.new("RiddlBody")
328
- res.read_body(bs)
329
- bs.rewind
330
- response = Riddl::Protocols::HTTP::Parser.new(
331
- "",
332
- bs,
333
- res['CONTENT-TYPE'],
334
- res['CONTENT-LENGTH'],
335
- res['CONTENT-DISPOSITION'],
336
- res['CONTENT-ID'],
337
- res['RIDDL-TYPE']
338
- ).params
324
+ retrycount = 0
325
+ begin
326
+ http.request(req) do |resp|
327
+ res = resp
328
+ bs = Parameter::Tempfile.new("RiddlBody")
329
+ res.read_body(bs)
330
+ bs.rewind
331
+ response = Riddl::Protocols::HTTP::Parser.new(
332
+ "",
333
+ bs,
334
+ res['CONTENT-TYPE'],
335
+ res['CONTENT-LENGTH'],
336
+ res['CONTENT-DISPOSITION'],
337
+ res['CONTENT-ID'],
338
+ res['RIDDL-TYPE']
339
+ ).params
340
+ end
341
+ rescue => e
342
+ retrycount += 1
343
+ if retrycount < 4
344
+ retry
345
+ else
346
+ raise Riddl::ConnectionError, "#{url.host}:#{url.port}/#{url.path} not reachable - #{e.message}."
347
+ end
339
348
  end
340
349
  end
341
350
  response_headers = {}
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0"?>
2
+ <description xmlns="http://riddl.org/ns/description/1.0" xmlns:xi="http://www.w3.org/2001/XInclude" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
+ <message name="riddl-description-response">
4
+ <parameter name="riddl-description" mimetype="text/xml"/>
5
+ </message>
6
+ <message name="riddl-resource-description-request">
7
+ <parameter name="riddl-resource-description" type="string"/>
8
+ </message>
9
+ <resource>
10
+ <get in="riddl-resource-description-request" out="riddl-description-response"/>
11
+ </resource>
12
+ </description>
@@ -53,6 +53,11 @@
53
53
  <attribute name="name">
54
54
  <ref name="riddl-datatype-name"/>
55
55
  </attribute>
56
+ <optional>
57
+ <attribute name="everywhere">
58
+ <data type="boolean"/>
59
+ </attribute>
60
+ </optional>
56
61
  <zeroOrMore>
57
62
  <element name="apply-to">
58
63
  <ref name="riddl-datatype-pathtemplate"/>
data/lib/riddl/server.rb CHANGED
@@ -253,8 +253,13 @@ module Riddl
253
253
  @riddl_status = 501 # not implemented?!
254
254
  end
255
255
  else
256
- if get 'riddl-description-request'
257
- run Riddl::Utils::Description::XML, @riddl_description_string
256
+ if !@riddl_message.nil? && @riddl_message.in.name == 'riddl-description-request' && @riddl_method == 'get' && '/' + @riddl_info[:s].join('/') == '/'
257
+ run Riddl::Utils::Description::RDR, @riddl_description_string
258
+ elsif !@riddl_message.nil? && @riddl_message.in.name == 'riddl-resource-description-request' && @riddl_method == 'get'
259
+ @riddl_path = File.dirname('/' + @riddl_info[:s].join('/')).gsub(/\/+/,'/')
260
+ on resource File.basename('/' + @riddl_info[:s].join('/')).gsub(/\/+/,'/') do
261
+ run Riddl::Utils::Description::RDR, @riddl.resource_description(@riddl_matching_path[0])
262
+ end
258
263
  else
259
264
  if @riddl.description?
260
265
  instance_exec(@riddl_info, &@riddl_interfaces[nil])
@@ -459,7 +464,6 @@ module Riddl
459
464
 
460
465
  @riddl_path << (@riddl_path == '/' ? resource : '/' + resource)
461
466
 
462
-
463
467
  ### only descend when there is a possibility that it holds the right path
464
468
  rp = @riddl_path.sub(/\//,'').split('/')
465
469
 
@@ -4,7 +4,7 @@ module Riddl
4
4
  module Utils
5
5
  module Description
6
6
 
7
- class XML < Riddl::Implementation
7
+ class RDR < Riddl::Implementation
8
8
  def response
9
9
  return Riddl::Parameter::Complex.new("riddl-description","text/xml",@a[0])
10
10
  end
data/lib/riddl/wrapper.rb CHANGED
@@ -56,6 +56,7 @@ module Riddl
56
56
  DESCRIPTION_FILE = "#{File.dirname(__FILE__)}/ns/description/#{VERSION_MAJOR}.#{VERSION_MINOR}/description.rng"
57
57
  DECLARATION_FILE = "#{File.dirname(__FILE__)}/ns/declaration/#{VERSION_MAJOR}.#{VERSION_MINOR}/declaration.rng"
58
58
  RIDDL_DESCRIPTION_SHOW = "#{File.dirname(__FILE__)}/ns/common-patterns/riddl-description/show.xml"
59
+ RIDDL_DESCRIPTION_RESOURCE_SHOW = "#{File.dirname(__FILE__)}/ns/common-patterns/riddl-description/resource-show.xml"
59
60
  COMMON = "datatypeLibrary=\"http://www.w3.org/2001/XMLSchema-datatypes\" xmlns=\"#{DESCRIPTION}\" xmlns:xi=\"http://www.w3.org/2001/XInclude\""
60
61
  CHECK = "<element name=\"check\" datatypeLibrary=\"http://www.w3.org/2001/XMLSchema-datatypes\" xmlns=\"http://relaxng.org/ns/structure/1.0\"><data/></element>"
61
62
  #}}}
@@ -99,13 +100,21 @@ module Riddl
99
100
  @doc.register_namespace 'dec', DECLARATION
100
101
  if @is_description && get_description
101
102
  rds = XML::Smart::open_unprotected(RIDDL_DESCRIPTION_SHOW)
103
+ rrds = XML::Smart::open_unprotected(RIDDL_DESCRIPTION_RESOUCE_SHOW)
102
104
  @doc.root.prepend rds.find('/xmlns:description/xmlns:message')
103
- r = @doc.find("/des:description/des:resource")
104
- r.first.prepend rds.find('/xmlns:description/xmlns:resource/*') unless r.empty?
105
+ @doc.root.prepend rrds.find('/xmlns:description/xmlns:message')
106
+ @doc.find("/des:description/des:resource").each do |r|
107
+ r.first.prepend rds.find('/xmlns:description/xmlns:resource/*')
108
+ end
109
+ @doc.find("/des:description//des:resource").each do |r|
110
+ r.first.prepend rrds.find('/xmlns:description/xmlns:resource/*')
111
+ end
105
112
  end
106
113
  if @is_declaration && get_description
107
114
  @doc.root.prepend("dec:interface",:name=>"riddldescription").add XML::Smart::open_unprotected(RIDDL_DESCRIPTION_SHOW).root
108
- @doc.root.find("dec:facade").first.append('dec:tile').append("layer",:name =>"riddldescription")
115
+ @doc.root.prepend("dec:interface",:name=>"riddlresourcedescription").add XML::Smart::open_unprotected(RIDDL_DESCRIPTION_RESOURCE_SHOW).root
116
+ @doc.root.find("dec:facade").first.append('dec:tile').append("layer",:name => "riddldescription")
117
+ @doc.root.find("dec:facade").first.append('dec:tile').append("layer",:name => "riddlresourcedescription",:everywhere => 'true')
109
118
  end
110
119
 
111
120
  @declaration = @description = nil
@@ -114,7 +123,7 @@ module Riddl
114
123
 
115
124
  def declaration
116
125
  #{{{
117
- if @is_declaration
126
+ if @declaration.nil? && @is_declaration
118
127
  @declaration = Riddl::Wrapper::Declaration.new(@doc)
119
128
  end
120
129
  @declaration
@@ -123,7 +132,7 @@ module Riddl
123
132
 
124
133
  def description
125
134
  #{{{
126
- if @is_description
135
+ if @description.nil? && @is_description
127
136
  @description = Riddl::Wrapper::Description.new(@doc)
128
137
  end
129
138
  @description
@@ -138,6 +147,12 @@ module Riddl
138
147
  nil
139
148
  end #}}}
140
149
 
150
+ def resource_description(path)
151
+ req = @description.get_resource(path).description_xml if @is_description
152
+ req = @declaration.get_resource(path).description_xml if @is_declaration
153
+ req.to_s
154
+ end
155
+
141
156
  def io_messages(path,operation,params,headers)
142
157
  #{{{
143
158
  description
@@ -74,19 +74,30 @@ module Riddl
74
74
  apply_to = layer.find("dec:apply-to")
75
75
  block = layer.find("dec:block")
76
76
 
77
+ everywhere = layer.attributes['everywhere'] == 'true'
77
78
  lname = layer.attributes['name']
78
79
  lpath, des = @interfaces[lname]
79
80
  desres = des.find("des:resource").first
80
- if apply_to.empty?
81
- int = Interface.new(lname,"/",lpath,"/",des)
82
- rec = desres.attributes['recursive']
83
- til.add_description(des,desres,"/",index,int,block,rec)
81
+ if everywhere
82
+ @tiles.map do |til| # extract all currently existing paths for all tiles
83
+ rpaths(til.resource,'').map{|a,b| a}
84
+ end.flatten.uniq.each do |path| # apply current to all paths
85
+ int = Interface.new(lname,path,lpath,"/",des)
86
+ rec = desres.attributes['recursive']
87
+ til.add_description(des,desres,path,index,int,block,rec)
88
+ end
84
89
  else
85
- apply_to.each do |at|
86
- int = Interface.new(lname,at.to_s,lpath,"/",des)
87
- til.add_description(des,desres,at.to_s,index,int,block)
90
+ if apply_to.empty?
91
+ int = Interface.new(lname,"/",lpath,"/",des)
92
+ rec = desres.attributes['recursive']
93
+ til.add_description(des,desres,"/",index,int,block,rec)
94
+ else
95
+ apply_to.each do |at|
96
+ int = Interface.new(lname,at.to_s,lpath,"/",des)
97
+ til.add_description(des,desres,at.to_s,index,int,block)
98
+ end
88
99
  end
89
- end
100
+ end
90
101
  end
91
102
  til.compose!
92
103
  end
@@ -19,6 +19,7 @@ module Riddl
19
19
  t = mess.content.dup
20
20
  name = mess.name
21
21
  name += '_' while names.include?(name)
22
+ names << name
22
23
  t.root.attributes['name'] = name
23
24
  messages_result << t.root.dump + "\n"
24
25
  end
@@ -224,6 +224,46 @@ module Riddl
224
224
  end
225
225
  private :add_to_path_and_split
226
226
 
227
+ def description_xml
228
+ collect = ''
229
+ messages = {}
230
+ messages_result = ''
231
+
232
+ if @composition.any?
233
+ @composition.each do |k,v|
234
+ v.each do |e|
235
+ collect << if e.result.class==Riddl::Wrapper::Description::RequestInOut
236
+ messages[e.result.in.hash] = e.result.in
237
+ messages[e.result.out.hash] = e.result.out if e.result.out
238
+ " <#{k} in=\"#{e.result.in.name}\"#{e.result.out.nil? ? '' : " out=\"#{e.result.out.name}\""}/>\n"
239
+ elsif e.result.class==Riddl::Wrapper::Description::RequestTransformation
240
+ ' '
241
+ elsif e.result.class==Riddl::Wrapper::Description::RequestStarOut
242
+ messages[e.result.out.hash] = e.result.out if e.result.out
243
+ " <#{k} in=\"*\" out=\"#{e.result.out.name}\"/>\n"
244
+ elsif e.result.class==Riddl::Wrapper::Description::RequestPass
245
+ ' '
246
+ elsif e.result.class==Riddl::Wrapper::Description::WebSocket
247
+ " <websocket/>\n"
248
+ else
249
+ ''
250
+ end
251
+ end
252
+ end
253
+ end
254
+
255
+ names = []
256
+ messages.each do |hash,mess|
257
+ t = mess.content.dup
258
+ name = mess.name
259
+ name += '_' while names.include?(name)
260
+ names << name
261
+ t.root.attributes['name'] = name
262
+ messages_result << t.root.dump + "\n"
263
+ end
264
+ XML::Smart.string("<description #{Riddl::Wrapper::COMMON}>\n\n" + messages_result.gsub(/^/,' ') + "\n <resource>\n" + collect + " </resource>\n</description>").to_s
265
+ end
266
+
227
267
  # add requests helper methods
228
268
  #{{{
229
269
  def add_request_in_out(index,interface,des,method,min,mout)
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0"?>
2
+ <description xmlns="http://riddl.org/ns/description/1.0" xmlns:xi="http://www.w3.org/2001/XInclude" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
+ <message name="riddl-description-response">
4
+ <parameter name="riddl-description" mimetype="text/xml"/>
5
+ </message>
6
+ <message name="riddl-resource-description-request">
7
+ <parameter name="riddl-resource-description" type="string"/>
8
+ </message>
9
+ <resource>
10
+ <get in="riddl-resource-description-request" out="riddl-description-response"/>
11
+ </resource>
12
+ </description>
@@ -53,6 +53,11 @@
53
53
  <attribute name="name">
54
54
  <ref name="riddl-datatype-name"/>
55
55
  </attribute>
56
+ <optional>
57
+ <attribute name="everywhere">
58
+ <data type="boolean"/>
59
+ </attribute>
60
+ </optional>
56
61
  <zeroOrMore>
57
62
  <element name="apply-to">
58
63
  <ref name="riddl-datatype-pathtemplate"/>
data/riddl.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "riddl"
3
- s.version = "0.99.109"
3
+ s.version = "0.99.111"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3"
6
6
  s.summary = "restful interface description and declaration language: tools and client/server libs"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riddl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.99.109
4
+ version: 0.99.111
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen eTM Mangler
8
8
  autorequire:
9
9
  bindir: tools
10
10
  cert_chain: []
11
- date: 2013-07-03 00:00:00.000000000 Z
11
+ date: 2013-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xml-smart
@@ -149,8 +149,8 @@ files:
149
149
  - lib/riddl/ns/common/relaxng.rng
150
150
  - lib/riddl/ns/common/datatypes-1_0.rng
151
151
  - lib/riddl/ns/description/1.0/description.rng
152
- - lib/riddl/ns/common-patterns/riddl-description/properties.xml
153
152
  - lib/riddl/ns/common-patterns/riddl-description/show.xml
153
+ - lib/riddl/ns/common-patterns/riddl-description/resource-show.xml
154
154
  - lib/riddl/ns/common-patterns/properties/1.0/properties.xml
155
155
  - lib/riddl/ns/common-patterns/properties/1.0/properties.schema.xsl
156
156
  - lib/riddl/ns/common-patterns/properties/1.0/properties.schema.schema
@@ -169,8 +169,8 @@ files:
169
169
  - ns/common/relaxng.rng
170
170
  - ns/common/datatypes-1_0.rng
171
171
  - ns/description/1.0/description.rng
172
- - ns/common-patterns/riddl-description/properties.xml
173
172
  - ns/common-patterns/riddl-description/show.xml
173
+ - ns/common-patterns/riddl-description/resource-show.xml
174
174
  - ns/common-patterns/properties/1.0/properties.xml
175
175
  - ns/common-patterns/properties/1.0/properties.schema.xsl
176
176
  - ns/common-patterns/properties/1.0/properties.schema.schema
@@ -1,150 +0,0 @@
1
- <description datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" xmlns="http://riddl.org/ns/description/1.0" xmlns:xi="http://www.w3.org/2001/XInclude">
2
-
3
- <message name="value">
4
- <choice>
5
- <parameter name="value" mimetype="text/xml" handler="http://riddl.org/ns/handlers/relaxng">
6
- <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" ns="http://riddl.org/ns/common-patterns/properties/1.0">
7
- <start>
8
- <choice>
9
- <element name="value">
10
- <ref name="value"/>
11
- </element>
12
- <element name="not-existing">
13
- <empty/>
14
- </element>
15
- </choice>
16
- </start>
17
-
18
- <define name="value">
19
- <zeroOrMore>
20
- <choice>
21
- <text/>
22
- <ref name="any"/>
23
- </choice>
24
- </zeroOrMore>
25
- </define>
26
-
27
- <define name="any">
28
- <element>
29
- <anyName/>
30
- <zeroOrMore>
31
- <attribute>
32
- <anyName/>
33
- </attribute>
34
- </zeroOrMore>
35
- <ref name="value"/>
36
- </element>
37
- </define>
38
-
39
- </grammar>
40
- </parameter>
41
- <parameter name="value" type="string"/>
42
-
43
- <parameter name="content" mimetype="text/xml"/>
44
- <parameter name="content" mimetype="text/plain"/>
45
- </choice>
46
- </message>
47
-
48
- <message name="resource-document">
49
- <parameter name="document" mimetype="text/xml"/>
50
- </message>
51
- <message name="resource-document-schema">
52
- <parameter name="document-schema" mimetype="text/xml"/>
53
- </message>
54
-
55
- <message name="properties">
56
- <oneOrMore>
57
- <parameter name="name" type="string"/>
58
- <choice>
59
- <parameter name="value" type="string"/>
60
- <parameter name="value" mimetype="text/plain"/>
61
- <parameter name="content" mimetype="text/xml"/> <!-- add everything inside the root tag -->
62
- <parameter name="content" type="string"/> <!-- add everything inside the root tag -->
63
- </choice>
64
- </oneOrMore>
65
- </message>
66
-
67
- <message name="propertylist">
68
- <parameter name="properties" mimetype="text/xml" handler="http://riddl.org/ns/handlers/relaxng">
69
- <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" ns="http://riddl.org/ns/common-patterns/properties/1.0">
70
- <start>
71
- <element name="properties">
72
- <zeroOrMore>
73
- <ref name="property"/>
74
- </zeroOrMore>
75
- </element>
76
- </start>
77
-
78
- <define name="property">
79
- <element>
80
- <anyName/>
81
- <data type="string"/>
82
- </element>
83
- </define>
84
-
85
- </grammar>
86
- </parameter>
87
- </message>
88
- <message name="addcontent">
89
- <choice>
90
- <parameter name="value" type="string"/>
91
- <parameter name="value" mimetype="text/xml"/>
92
- </choice>
93
- </message>
94
- <message name="updcontent">
95
- <choice>
96
- <parameter name="value" type="string"/>
97
- <parameter name="value" mimetype="text/plain"/>
98
- <parameter name="content" mimetype="text/xml"/> <!-- add everything inside the root tag -->
99
- <parameter name="content" type="string"/> <!-- add everything inside the root tag -->
100
- </choice>
101
- </message>
102
- <message name="property">
103
- <parameter name="name" type="string">
104
- <param name="pattern">[a-zA-Z_][a-zA-Z0-9_]*</param>
105
- </parameter>
106
- <choice>
107
- <parameter name="value" type="string"/>
108
- <parameter name="value" mimetype="text/plain"/>
109
- <parameter name="content" mimetype="text/xml"/> <!-- add everything inside the root tag -->
110
- <parameter name="content" type="string"/> <!-- add everything inside the root tag -->
111
- </choice>
112
- </message>
113
- <message name="query">
114
- <parameter name="query" type="string"/>
115
- </message>
116
-
117
- <resource pattern="http://riddl.org/ns/common-patterns/properties/1.0">
118
- <get in="*" out="resource-document"/>
119
- <get in="query" out="value"/>
120
- <resource relative="schema">
121
- <get in="*" out="resource-document-schema"/>
122
- <resource relative="rng">
123
- <get in="*" out="resource-document-schema"/>
124
- </resource>
125
- <resource relative="xsd">
126
- <get in="*" out="resource-document-schema"/>
127
- </resource>
128
- </resource>
129
- <resource relative="values">
130
- <get in="*" out="propertylist"/>
131
- <post in="property"/>
132
- <put in="properties"/>
133
- <resource>
134
- <get in="*" out="value"/>
135
- <delete in="*"/>
136
- <post in="addcontent"/>
137
- <put in="updcontent"/>
138
- <resource>
139
- <get in="*" out="value"/>
140
- <put in="updcontent"/>
141
- <delete in="*"/>
142
- <resource recursive='true'>
143
- <get in="*" out="value"/>
144
- </resource>
145
- </resource>
146
- </resource>
147
- </resource>
148
- </resource>
149
-
150
- </description>
@@ -1,150 +0,0 @@
1
- <description datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" xmlns="http://riddl.org/ns/description/1.0" xmlns:xi="http://www.w3.org/2001/XInclude">
2
-
3
- <message name="value">
4
- <choice>
5
- <parameter name="value" mimetype="text/xml" handler="http://riddl.org/ns/handlers/relaxng">
6
- <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" ns="http://riddl.org/ns/common-patterns/properties/1.0">
7
- <start>
8
- <choice>
9
- <element name="value">
10
- <ref name="value"/>
11
- </element>
12
- <element name="not-existing">
13
- <empty/>
14
- </element>
15
- </choice>
16
- </start>
17
-
18
- <define name="value">
19
- <zeroOrMore>
20
- <choice>
21
- <text/>
22
- <ref name="any"/>
23
- </choice>
24
- </zeroOrMore>
25
- </define>
26
-
27
- <define name="any">
28
- <element>
29
- <anyName/>
30
- <zeroOrMore>
31
- <attribute>
32
- <anyName/>
33
- </attribute>
34
- </zeroOrMore>
35
- <ref name="value"/>
36
- </element>
37
- </define>
38
-
39
- </grammar>
40
- </parameter>
41
- <parameter name="value" type="string"/>
42
-
43
- <parameter name="content" mimetype="text/xml"/>
44
- <parameter name="content" mimetype="text/plain"/>
45
- </choice>
46
- </message>
47
-
48
- <message name="resource-document">
49
- <parameter name="document" mimetype="text/xml"/>
50
- </message>
51
- <message name="resource-document-schema">
52
- <parameter name="document-schema" mimetype="text/xml"/>
53
- </message>
54
-
55
- <message name="properties">
56
- <oneOrMore>
57
- <parameter name="name" type="string"/>
58
- <choice>
59
- <parameter name="value" type="string"/>
60
- <parameter name="value" mimetype="text/plain"/>
61
- <parameter name="content" mimetype="text/xml"/> <!-- add everything inside the root tag -->
62
- <parameter name="content" type="string"/> <!-- add everything inside the root tag -->
63
- </choice>
64
- </oneOrMore>
65
- </message>
66
-
67
- <message name="propertylist">
68
- <parameter name="properties" mimetype="text/xml" handler="http://riddl.org/ns/handlers/relaxng">
69
- <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" ns="http://riddl.org/ns/common-patterns/properties/1.0">
70
- <start>
71
- <element name="properties">
72
- <zeroOrMore>
73
- <ref name="property"/>
74
- </zeroOrMore>
75
- </element>
76
- </start>
77
-
78
- <define name="property">
79
- <element>
80
- <anyName/>
81
- <data type="string"/>
82
- </element>
83
- </define>
84
-
85
- </grammar>
86
- </parameter>
87
- </message>
88
- <message name="addcontent">
89
- <choice>
90
- <parameter name="value" type="string"/>
91
- <parameter name="value" mimetype="text/xml"/>
92
- </choice>
93
- </message>
94
- <message name="updcontent">
95
- <choice>
96
- <parameter name="value" type="string"/>
97
- <parameter name="value" mimetype="text/plain"/>
98
- <parameter name="content" mimetype="text/xml"/> <!-- add everything inside the root tag -->
99
- <parameter name="content" type="string"/> <!-- add everything inside the root tag -->
100
- </choice>
101
- </message>
102
- <message name="property">
103
- <parameter name="name" type="string">
104
- <param name="pattern">[a-zA-Z_][a-zA-Z0-9_]*</param>
105
- </parameter>
106
- <choice>
107
- <parameter name="value" type="string"/>
108
- <parameter name="value" mimetype="text/plain"/>
109
- <parameter name="content" mimetype="text/xml"/> <!-- add everything inside the root tag -->
110
- <parameter name="content" type="string"/> <!-- add everything inside the root tag -->
111
- </choice>
112
- </message>
113
- <message name="query">
114
- <parameter name="query" type="string"/>
115
- </message>
116
-
117
- <resource pattern="http://riddl.org/ns/common-patterns/properties/1.0">
118
- <get in="*" out="resource-document"/>
119
- <get in="query" out="value"/>
120
- <resource relative="schema">
121
- <get in="*" out="resource-document-schema"/>
122
- <resource relative="rng">
123
- <get in="*" out="resource-document-schema"/>
124
- </resource>
125
- <resource relative="xsd">
126
- <get in="*" out="resource-document-schema"/>
127
- </resource>
128
- </resource>
129
- <resource relative="values">
130
- <get in="*" out="propertylist"/>
131
- <post in="property"/>
132
- <put in="properties"/>
133
- <resource>
134
- <get in="*" out="value"/>
135
- <delete in="*"/>
136
- <post in="addcontent"/>
137
- <put in="updcontent"/>
138
- <resource>
139
- <get in="*" out="value"/>
140
- <put in="updcontent"/>
141
- <delete in="*"/>
142
- <resource recursive='true'>
143
- <get in="*" out="value"/>
144
- </resource>
145
- </resource>
146
- </resource>
147
- </resource>
148
- </resource>
149
-
150
- </description>