riddl 0.101.24 → 0.105

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/examples/declaration-server-distributed/declaration.rb +1 -1
  3. data/examples/declaration-server-distributed/declaration.xml +4 -4
  4. data/examples/declaration-server-distributed/main.rb +4 -4
  5. data/examples/declaration-server-distributed/properties.rb +5 -5
  6. data/examples/declaration-server-distributed/xsloverlay.rb +1 -1
  7. data/examples/declaration-server-hybrid/declaration.rb +6 -6
  8. data/examples/declaration-server-hybrid/declaration.xml +2 -2
  9. data/examples/declaration-server-hybrid/xsloverlay.rb +1 -1
  10. data/examples/declaration-server-local/declaration.rb +5 -5
  11. data/examples/declaration-test/main.rb +5 -5
  12. data/examples/downloadify/client.rb +1 -1
  13. data/examples/downloadify/server.rb +2 -2
  14. data/examples/flickr/declaration.xml +1 -1
  15. data/examples/helloworld/declaration-definition_goal.xml +1 -3
  16. data/examples/helloworld/description.xml +5 -7
  17. data/examples/library/description.xml +5 -5
  18. data/examples/library/server.rb +1 -1
  19. data/examples/notifications/producer.rb +3 -3
  20. data/examples/properties/server.properties.xml +1 -1
  21. data/lib/ruby/riddl/handlers/plain-type.rb +7 -6
  22. data/lib/ruby/riddl/ns/common-patterns/notifications-consumer/2.0/consumer.xml +12 -12
  23. data/lib/ruby/riddl/protocols/http/parser.rb +12 -5
  24. data/lib/ruby/riddl/server.rb +11 -1
  25. data/lib/ruby/riddl/wrapper.rb +12 -5
  26. data/ns/common-patterns/notifications-consumer/2.0/consumer.xml +12 -12
  27. data/riddl.gemspec +3 -3
  28. data/test/smartrunner.rb +21 -14
  29. data/test/tc_declaration-distributed.rb +1 -0
  30. data/test/tc_websocket.rb +16 -15
  31. metadata +8 -19
  32. data/examples/properties/properties.schema.xsl +0 -1
  33. data/examples/xmpp/blather/description.xml +0 -981
  34. data/examples/xmpp/blather/direct.rb +0 -44
  35. data/examples/xmpp/blather/load.rb +0 -18
  36. data/examples/xmpp/blather/pp.rb +0 -40
  37. data/examples/xmpp/blather/test.rb +0 -32
  38. data/examples/xmpp/client.rb +0 -20
  39. data/examples/xmpp/description.rb +0 -17
  40. data/examples/xmpp/properties.xml +0 -1
  41. data/examples/xmpp/server.properties.schema +0 -34
  42. data/examples/xmpp/server.properties.xml +0 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8146e33ab4394adfcca6eb52a85976fcabe760c92d1fe6ed427896cf8d57851
4
- data.tar.gz: e5bc04599b3ab8d652d215844236e025c6a12f3db32e5e08182bc05554f39ca5
3
+ metadata.gz: 5a9281315099f1f79cb26e07966c0b5ca62e1b453212d14bb1bc0dfb7fdc8e10
4
+ data.tar.gz: c8ecbfea56bb9ef33309fac83d12be4903c0542dfefca7f65b1743d092816b45
5
5
  SHA512:
6
- metadata.gz: c2d6c172ebefae37bec3811baa828e6f58c2306920752a0ddd7ef614641a205609f40cf7310157e47785797dff4c6560d9b54595f765fd83fe490d2253ae3967
7
- data.tar.gz: 37f5ff14b5263614f184d803b0eb613208d7f8d1eafd4c9bde080c9946017a19f9719832f1218921745a85d894ca5c92e76370e9f818b8be3ebe6de73f28237b
6
+ metadata.gz: b0d30308234141020cc251d1f9031b4f70c95aeb20b95d6f16a06f6d918ff939c2166926825d3ec50c5de98eae20e23e324d5568f51a73412ae40f53d1d0b551
7
+ data.tar.gz: 87cab038380f1e5a7414c8444b7bc836db31ed9007f4bf8c5a7cef32e5a4e821c4633bad4a4fcdcb107c024951bd54bab7550a238dca314f2f5c8962fd42dd0f
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/ruby
2
2
  require File.expand_path(File.dirname(__FILE__) + '/../../lib/ruby/riddl/server')
3
3
 
4
- Riddl::Server.new(File.dirname(__FILE__) + '/declaration.xml', :port => 9297).loop!
4
+ Riddl::Server.new(File.dirname(__FILE__) + '/declaration.xml', :port => 9004).loop!
@@ -1,13 +1,13 @@
1
1
  <declaration xmlns="http://riddl.org/ns/declaration/1.0" xmlns:xi="http://www.w3.org/2001/XInclude">
2
- <interface name="main" location="http://localhost:9296">
2
+ <interface name="main" location="http://localhost:9003">
3
3
  <xi:include href="main.xml"/>
4
4
  </interface>
5
- <interface name="properties" location="http://localhost:9295">
5
+ <interface name="properties" location="http://localhost:9002">
6
6
  <xi:include href="properties.xml"/>
7
7
  </interface>
8
- <interface name="xsloverlay" location='http://localhost:9294'>
8
+ <interface name="xsloverlay" location='http://localhost:9001'>
9
9
  <xi:include href="xsloverlay.xml"/>
10
- </interface>
10
+ </interface>
11
11
 
12
12
  <facade>
13
13
  <tile>
@@ -20,16 +20,16 @@ class Info < Riddl::Implementation
20
20
  end
21
21
  end
22
22
 
23
- Riddl::Server.new(File.dirname(__FILE__) + '/main.xml', :port => 9296) do
23
+ Riddl::Server.new(File.dirname(__FILE__) + '/main.xml', :port => 9003) do
24
24
  on resource do
25
25
  run Riddl::Utils::FileServe, 'instances/instances.xml' if get '*'
26
26
  on resource do
27
27
  run Info if get
28
- end
28
+ end
29
29
  on resource 'xsls' do
30
30
  on resource do
31
31
  run Riddl::Utils::FileServe, "xsls" if get
32
- end
33
- end
32
+ end
33
+ end
34
34
  end
35
35
  end.loop!
@@ -3,17 +3,17 @@ require 'pp'
3
3
  require File.expand_path(File.dirname(__FILE__) + '/../../lib/ruby/riddl/server')
4
4
  require File.expand_path(File.dirname(__FILE__) + '/../../lib/ruby/riddl/utils/properties')
5
5
 
6
- Riddl::Server.new(File.dirname(__FILE__) + '/properties.xml', :port => 9295) do
6
+ Riddl::Server.new(File.dirname(__FILE__) + '/properties.xml', :port => 9002) do
7
7
  on resource do |r|
8
8
  ### header RIDDL_DECLARATION_PATH holds the full path used in the declaration
9
9
  ### from there we get the instance, which is not present in the path used for properties
10
10
  properties = if r[:h]['RIDDL_DECLARATION_PATH']
11
11
  @riddl_opts[:basepath] + '/instances/' + r[:h]['RIDDL_DECLARATION_PATH'].split('/')[1] + '/properties.xml'
12
- else
12
+ else
13
13
  @riddl_opts[:basepath] + '/instances/1/properties.xml'
14
- end
15
- backend = Riddl::Utils::Properties::Backend.new(
16
- @riddl_opts[:basepath] + '/instances/properties.schema',
14
+ end
15
+ backend = Riddl::Utils::Properties::Backend.new(
16
+ @riddl_opts[:basepath] + '/instances/properties.schema',
17
17
  properties
18
18
  )
19
19
 
@@ -3,7 +3,7 @@ require 'pp'
3
3
  require File.expand_path(File.dirname(__FILE__) + '/../../lib/ruby/riddl/server')
4
4
  require File.expand_path(File.dirname(__FILE__) + '/../../lib/ruby/riddl/utils/xsloverlay')
5
5
 
6
- Riddl::Server.new(File.dirname(__FILE__) + '/xsloverlay.xml', :port => 9294) do
6
+ Riddl::Server.new(File.dirname(__FILE__) + '/xsloverlay.xml', :port => 9001) do
7
7
  on resource do
8
8
  run Riddl::Utils::XSLOverlay, "/xsls/instances.xsl" if get && declaration_resource == '/'
9
9
  run Riddl::Utils::XSLOverlay, "/xsls/info.xsl" if get && declaration_resource == '/{}'
@@ -21,25 +21,25 @@ class Info < Riddl::Implementation
21
21
  end
22
22
  end
23
23
 
24
- Riddl::Server.new(File.dirname(__FILE__) + '/declaration.xml', :port => 9297) do
24
+ Riddl::Server.new(File.dirname(__FILE__) + '/declaration.xml', :port => 9002) do
25
25
  accessible_description true
26
26
 
27
27
  interface 'main' do
28
28
  run Riddl::Utils::FileServe, 'instances/instances.xml' if get '*'
29
29
  on resource do
30
30
  run Info if get
31
- end
31
+ end
32
32
  on resource 'xsls' do
33
33
  on resource do
34
34
  run Riddl::Utils::FileServe, "xsls" if get
35
- end
36
- end
35
+ end
36
+ end
37
37
  end
38
38
 
39
39
  interface 'properties' do |r|
40
40
  properties = @riddl_opts[:basepath] + '/instances/' + r[:h]['RIDDL_DECLARATION_PATH'].split('/')[1] + '/properties.xml'
41
- backend = Riddl::Utils::Properties::Backend.new(
42
- @riddl_opts[:basepath] + '/instances/properties.schema',
41
+ backend = Riddl::Utils::Properties::Backend.new(
42
+ @riddl_opts[:basepath] + '/instances/properties.schema',
43
43
  properties
44
44
  )
45
45
 
@@ -5,9 +5,9 @@
5
5
  <interface name="properties">
6
6
  <xi:include href="properties.xml"/>
7
7
  </interface>
8
- <interface name="xsloverlay" location='http://localhost:9294'>
8
+ <interface name="xsloverlay" location='http://localhost:9001'>
9
9
  <xi:include href="xsloverlay.xml"/>
10
- </interface>
10
+ </interface>
11
11
 
12
12
  <facade>
13
13
  <tile>
@@ -3,7 +3,7 @@ require 'pp'
3
3
  require File.expand_path(File.dirname(__FILE__) + '/../../lib/ruby/riddl/server')
4
4
  require File.expand_path(File.dirname(__FILE__) + '/../../lib/ruby/riddl/utils/xsloverlay')
5
5
 
6
- Riddl::Server.new(File.dirname(__FILE__) + '/xsloverlay.xml', :port => 9294) do
6
+ Riddl::Server.new(File.dirname(__FILE__) + '/xsloverlay.xml', :port => 9001) do
7
7
  # accessible_description true
8
8
 
9
9
  on resource do
@@ -5,12 +5,12 @@ require File.expand_path(File.dirname(__FILE__) + '/../../lib/ruby/riddl/utils/p
5
5
  require File.expand_path(File.dirname(__FILE__) + '/../../lib/ruby/riddl/utils/xsloverlay')
6
6
  require File.expand_path(File.dirname(__FILE__) + '/../../lib/ruby/riddl/utils/fileserve')
7
7
 
8
- Riddl::Server.new(File.dirname(__FILE__) + '/declaration.xml', :port => 9292) do
8
+ Riddl::Server.new(File.dirname(__FILE__) + '/declaration.xml', :port => 9001) do
9
9
  accessible_description true
10
10
 
11
- backend = Riddl::Utils::Properties::Backend.new(
12
- @riddl_opts[:basepath] + '/server.properties.schema',
13
- @riddl_opts[:basepath] + '/server.properties.xml'
11
+ backend = Riddl::Utils::Properties::Backend.new(
12
+ @riddl_opts[:basepath] + '/server.properties.schema',
13
+ @riddl_opts[:basepath] + '/server.properties.xml'
14
14
  )
15
15
 
16
16
  interface 'main' do
@@ -20,7 +20,7 @@ Riddl::Server.new(File.dirname(__FILE__) + '/declaration.xml', :port => 9292) do
20
20
  interface 'xsls' do |r|
21
21
  on resource do
22
22
  run Riddl::Utils::FileServe, "xsls" if get
23
- end
23
+ end
24
24
  end
25
25
 
26
26
  interface 'xsloverlay' do
@@ -7,24 +7,24 @@ class A < Riddl::Implementation
7
7
  def response
8
8
  Riddl::Parameter::Simple.new("x","1")
9
9
  end
10
- end
10
+ end
11
11
  class B < Riddl::Implementation
12
12
  def response
13
13
  Riddl::Parameter::Simple.new("y","1")
14
14
  end
15
- end
15
+ end
16
16
  class C < Riddl::Implementation
17
17
  def response
18
18
  Riddl::Parameter::Simple.new("z","1")
19
19
  end
20
- end
20
+ end
21
21
  class S < Riddl::Implementation
22
22
  def response
23
23
  @p # return input parameters unchanged
24
24
  end
25
- end
25
+ end
26
26
 
27
- Riddl::Server.new("main.xml", :port => 9201) do
27
+ Riddl::Server.new("main.xml", :port => 9001) do
28
28
  process_out false
29
29
  logger Riddl::CommonLogger.new("Main","main.log")
30
30
  on resource do
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/ruby
2
2
  require File.expand_path(File.dirname(__FILE__) + '/../../lib/ruby/riddl/server')
3
3
 
4
- srv = Riddl::Client.interface("http://localhost:9299","server.declaration.xml")
4
+ srv = Riddl::Client.interface("http://localhost:9001","server.declaration.xml")
5
5
 
6
6
  status, ret = srv.resource('/test.txt').post [
7
7
  Riddl::Parameter::Simple.new("mimetype","text/plain"),
@@ -2,13 +2,13 @@
2
2
  require File.expand_path(File.dirname(__FILE__) + '/../../lib/ruby/riddl/server')
3
3
  require File.expand_path(File.dirname(__FILE__) + '/../../lib/ruby/riddl/downloadify')
4
4
 
5
- Riddl::Server.new(::File.dirname(__FILE__) + '/server.declaration.xml', :port => 9299) do
5
+ Riddl::Server.new(::File.dirname(__FILE__) + '/server.declaration.xml', :port => 9001) do
6
6
  accessible_description true
7
7
 
8
8
  interface "main" do
9
9
  end
10
10
 
11
- interface "downloadify" do
11
+ interface "downloadify" do
12
12
  on resource do
13
13
  run Riddl::Utils::Downloadify if get 'dfin'
14
14
  run Riddl::Utils::Downloadify if post 'dfin'
@@ -2,7 +2,7 @@
2
2
  <interface name="main" location="http://api.flickr.com/services">
3
3
  <xi:include href="Flickr/flickr.xml"/>
4
4
  </interface>
5
- <interface name="exif" location="http://localhost:9292">
5
+ <interface name="exif" location="http://localhost:9001">
6
6
  <xi:include href="Exif/exif.xml"/>
7
7
  </interface>
8
8
 
@@ -2,9 +2,7 @@
2
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
3
  <message name="hello">
4
4
  <parameter name="return" mimetype="text/plain" handler="http://riddl.org/ns/handlers/plain-type">
5
- <plain type="string">
6
- <param name="pattern">hello .+</param>
7
- </plain>
5
+ <pattern>hello .+</pattern>
8
6
  </parameter>
9
7
  </message>
10
8
  <message name="hello-form">
@@ -2,9 +2,7 @@
2
2
 
3
3
  <message name="hello">
4
4
  <parameter name="return" mimetype="text/plain" handler="http://riddl.org/ns/handlers/plain-type">
5
- <plain type="string">
6
- <param name="pattern">hello .+</param>
7
- </plain>
5
+ <pattern>hello .+</pattern>
8
6
  </parameter>
9
7
  </message>
10
8
  <message name="hello-form">
@@ -22,15 +20,15 @@
22
20
  <parameter name="type" type="string">
23
21
  <choice>
24
22
  <value>html</value>
25
- </choice>
26
- </parameter>
23
+ </choice>
24
+ </parameter>
27
25
  </message>
28
26
 
29
27
  <resource>
30
28
  <post in="hello"/>
31
29
  <post in="hello-form"/>
32
30
  <get in="*" out="hello-form"/>
33
- <get in="type-html" out="hello-list-html"/>
31
+ <get in="type-html" out="hello-list-html"/>
34
32
  <resource>
35
33
  <get in="*" out="hello"/>
36
34
  <put in="hello" out="hello"/>
@@ -43,5 +41,5 @@
43
41
  <post in="hello"/>
44
42
  </resource>
45
43
  </resource>
46
-
44
+
47
45
  </description>
@@ -4,7 +4,7 @@
4
4
  <!--header name="Library" type="positiveInteger"/-->
5
5
  <oneOrMore>
6
6
  <parameter name="author" type="string"/>
7
- </oneOrMore>
7
+ </oneOrMore>
8
8
  <parameter name="title" type="string"/>
9
9
  </message>
10
10
  <message name="list-of-books">
@@ -13,9 +13,9 @@
13
13
  </parameter>
14
14
  </message>
15
15
  <message name="book-description-form">
16
- <oneOrMore>
16
+ <oneOrMore>
17
17
  <parameter name="author" type="string"/>
18
- </oneOrMore>
18
+ </oneOrMore>
19
19
  <parameter name="title" type="string"/>
20
20
  </message>
21
21
  <message name="book-description">
@@ -25,7 +25,7 @@
25
25
  </message>
26
26
  <message name="book-id">
27
27
  <parameter name="book-id" mimetype="text/plain" handler="http://riddl.org/ns/handlers/plain-type">
28
- <plain type="positiveInteger"/>
28
+ <pattern>\d+</pattern>
29
29
  </parameter>
30
30
  </message>
31
31
 
@@ -75,6 +75,6 @@
75
75
  <resource relative="about">
76
76
  <get in="*" out="main-output"/>
77
77
  </resource>
78
- </resource>
78
+ </resource>
79
79
 
80
80
  </description>
@@ -34,7 +34,7 @@ class BookDescription < Riddl::Implementation
34
34
  end
35
35
  end
36
36
 
37
- Riddl::Server.new(File.dirname(__FILE__) + '/description.xml', :port => 9292, :bind => '::') do
37
+ Riddl::Server.new(File.dirname(__FILE__) + '/description.xml', :port => 9001, :bind => '::') do
38
38
  accessible_description true
39
39
 
40
40
  on resource do
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../lib/ruby/riddl/server'
3
3
  require File.expand_path(File.dirname(__FILE__) + '/../../lib/ruby/riddl/utils/fileserve')
4
4
  require File.expand_path(File.dirname(__FILE__) + '/../../lib/ruby/riddl/utils/notifications_producer')
5
5
 
6
- Riddl::Server.new(::File.dirname(__FILE__) + '/producer.declaration.xml', :port => 9291) do
6
+ Riddl::Server.new(::File.dirname(__FILE__) + '/producer.declaration.xml', :port => 9001) do
7
7
  accessible_description true
8
8
  backend = Riddl::Utils::Notifications::Producer::Backend.new(
9
9
  ::File.dirname(__FILE__) + '/topics.xml',
@@ -14,7 +14,7 @@ Riddl::Server.new(::File.dirname(__FILE__) + '/producer.declaration.xml', :port
14
14
  run Riddl::Utils::FileServe, "implementation/index.html" if get
15
15
  on resource 'oliver' do
16
16
  run Riddl::Utils::FileServe, "implementation/oliver.html" if get
17
- end
17
+ end
18
18
  on resource 'juergen' do
19
19
  run Riddl::Utils::FileServe, "implementation/juergen.html" if get
20
20
  end
@@ -22,5 +22,5 @@ Riddl::Server.new(::File.dirname(__FILE__) + '/producer.declaration.xml', :port
22
22
 
23
23
  interface 'main' do |r|
24
24
  use Riddl::Utils::Notifications::Producer::implementation(backend,nil,@riddl_opts[:mode])
25
- end
25
+ end
26
26
  end.loop!
@@ -11,6 +11,6 @@
11
11
  </endpoints>
12
12
  <handlerwrapper>Test</handlerwrapper>
13
13
  <description>lala</description>
14
- <state>stopped</state>
14
+ <state changed="2020-10-01T20:41:21+02:00">stopped</state>
15
15
  <transformation>xxx</transformation>
16
16
  </properties>
@@ -4,18 +4,19 @@ module Riddl
4
4
  def self::handle(what,hinfo)
5
5
  if what.class == Riddl::Parameter::Tempfile
6
6
  w = what.read
7
- else
7
+ else
8
8
  w = what
9
- end
9
+ end
10
10
  begin
11
- re = Regexp.new(hinfo)
12
- rescue
11
+ hi = XML::Smart::string(hinfo)
12
+ re = Regexp.new(hi.root.text)
13
+ rescue
13
14
  return false
14
15
  end
15
16
  w =~ re
16
17
  end
17
18
  end
18
- end
19
- end
19
+ end
20
+ end
20
21
 
21
22
  Riddl::Handlers::add("http://riddl.org/ns/handlers/plain-type",Riddl::Handlers::PlainType)
@@ -30,18 +30,18 @@
30
30
  </message>
31
31
 
32
32
  <message name="acknowledgment">
33
- <optional>
34
- <choice>
35
- <parameter name="continue" type="string">
36
- <choice>
37
- <value>true</value>
38
- <value>false</value>
39
- <value>callback</value>
40
- </choice>
41
- </parameter>
42
- <parameter name="continue" mimetype="text/plain"/>
43
- </choice>
44
- </optional>
33
+ <choice>
34
+ <parameter name="continue" type="string">
35
+ <choice>
36
+ <value>true</value>
37
+ <value>false</value>
38
+ <value>callback</value>
39
+ </choice>
40
+ </parameter>
41
+ <parameter name="continue" mimetype="text/plain" handler="http://riddl.org/ns/handlers/plain-type">
42
+ <pattern>^(true|false|callback)$</pattern>
43
+ </parameter>
44
+ </choice>
45
45
  </message>
46
46
 
47
47
  <resource pattern="http://riddl.org/ns/common-patterns/notifications-consumer/2.0">
@@ -34,9 +34,16 @@ module Riddl
34
34
  body = ''
35
35
  end
36
36
 
37
- if content_length == 0 && name == ''
37
+ if content_length == 0
38
+ bufsize = 16384
39
+ until input.eof?
40
+ c = input.read(bufsize)
41
+ raise EOFError, "bad content body" if c.nil? || c.empty?
42
+ body << c
43
+ content_length -= c.size
44
+ end
38
45
  body << input.read
39
- else
46
+ else
40
47
  bufsize = 16384
41
48
  until content_length <= 0
42
49
  c = input.read(bufsize < content_length ? bufsize : content_length)
@@ -131,7 +138,7 @@ module Riddl
131
138
  @params << Parameter::Complex.new(name, ctype, body, filename, head)
132
139
  elsif !filename && ctype
133
140
  body.rewind
134
-
141
+
135
142
  # Generic multipart cases, not coming from a form
136
143
  @params << Parameter::Complex.new(name, ctype, body, nil, head)
137
144
  else
@@ -170,7 +177,7 @@ module Riddl
170
177
  elsif FORM_CONTENT_TYPES.include?(media_type)
171
178
  # sub is a fix for Safari Ajax postings that always append \0
172
179
  parse_nested_query(input.read.sub(/\0\z/, ''),:body)
173
- else
180
+ else
174
181
  parse_content(input,content_type,content_length.to_i,content_disposition||'',content_id||'',riddl_type||'')
175
182
  end
176
183
 
@@ -187,4 +194,4 @@ module Riddl
187
194
  end
188
195
  end
189
196
  end
190
- end
197
+ end