cpee-instantiation 1.0.7 → 1.0.11

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
  SHA256:
3
- metadata.gz: 9efdce12606b0b4a2dcc8edb56a511a8b4392afa1de52d55df1d89f7037ad96d
4
- data.tar.gz: b7ddc4881dadce16e7dfd2da9db9c0bd68c8b70dfe9dc8c8180a3cef75f1dcee
3
+ metadata.gz: fa7ec4be09e6574d2b06d3f63119403dd07d1bfd1f5c91b74e070a0168a73c92
4
+ data.tar.gz: 5557f2f30a55365b9ffe235cf025ed4c90bddfaa72d5a125da419b89eed83772
5
5
  SHA512:
6
- metadata.gz: 4b65153017b9a2f2c7853e0d7ec658cba83b6e3eabe79425b3166ca818ae8a0f61ee36242c9b5cf080db41938b55c7652e6e37765c47b2fb282656fe25ad5ae6
7
- data.tar.gz: 7b1a05794b4f6df41298f01ade332459806e613989f70f35c58b9786b86b7e38d9added2762b1bafe432de625910d25625d3bf1c27860180afec09730cdaeea9
6
+ metadata.gz: 934220dc9cd7953028f9ec8c32fc77046380eb54a8ca6d5566e40a0450c4045a3a101a8cf14f988ddeb5e1d068a0a6945333d63c02d053c02c3fcb7383267401
7
+ data.tar.gz: 55a39d02d5614c6a2cf1af1b59cc71b8e8544c002d28eb3de6da89bf3938d0f9c6a05e3db9b8f4c0b481067a0ca58e25929246674066cb2f4e084d8f254558dd
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cpee-instantiation"
3
- s.version = "1.0.7"
3
+ s.version = "1.0.11"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3.0"
6
6
  s.summary = "Subprocess instantiation service for the cloud process execution engine (cpee.org)"
@@ -23,5 +23,5 @@ Gem::Specification.new do |s|
23
23
  s.add_runtime_dependency 'riddl', '~> 0.99'
24
24
  s.add_runtime_dependency 'json', '~> 2.1'
25
25
  s.add_runtime_dependency 'redis', '~> 4.1'
26
- s.add_runtime_dependency 'cpee', '~> 2.1'
26
+ s.add_runtime_dependency 'cpee', '~> 2.1', '>= 2.1.4'
27
27
  end
@@ -36,6 +36,7 @@ module CPEE
36
36
  XML::Smart.string(tdoc) do |doc|
37
37
  doc.register_namespace 'desc', 'http://cpee.org/ns/description/1.0'
38
38
  doc.register_namespace 'prop', 'http://cpee.org/ns/properties/2.0'
39
+ doc.register_namespace 'sub', 'http://riddl.org/ns/common-patterns/notifications-producer/2.0'
39
40
 
40
41
  srv = Riddl::Client.new(cpee, File.join(cpee,'?riddl-description'))
41
42
  res = srv.resource('/')
@@ -75,19 +76,26 @@ module CPEE
75
76
  inp.root.add(ele.first) if ele.any?
76
77
  end
77
78
  res = srv.resource("/#{ins}/properties").put Riddl::Parameter::Complex.new('properties','application/xml',inp.to_s)
78
- doc.find('/*/prop:handlers/prop:handler').each do |han|
79
- url = han.attributes['url']
80
- inp = 'url=' + URI.encode_www_form_component(url)
81
- inp = inp + '&topic=' + han.children.first.attributes['topic']
82
- inp = inp + '&' + han.children.first.qname.to_s + '=' + han.children.first.to_s
83
- status,body = Riddl::Client::new(cpee+ins+'/notifications/subscriptions/').post(
84
- [
85
- Riddl::Parameter::Simple.new('url',han.attributes['url']),
86
- Riddl::Parameter::Simple.new('topic',han.children.first.attributes['topic']),
87
- Riddl::Parameter::Simple.new(han.children.first.qname.to_s,han.children.first.to_s)
88
- ]
89
- )
90
- end
79
+ # TODO new versions
80
+ doc.find('/*/sub:subscriptions/sub:subscription').each do |s|
81
+ parts = []
82
+ if id = s.attributes['id']
83
+ parts << Riddl::Parameter::Simple.new('id', id)
84
+ end
85
+ parts << Riddl::Parameter::Simple.new('url', s.attributes['url'])
86
+ s.find('sub:topic').each do |t|
87
+ p s.find('sub:event').map{ |e| e.text }
88
+ if (evs = t.find('sub:event').map{ |e| e.text }.join(',')).length > 0
89
+ parts << Riddl::Parameter::Simple.new('topic', t.attributes['id'])
90
+ parts << Riddl::Parameter::Simple.new('events', evs)
91
+ end
92
+ if (vos = t.find('sub:vote').map{ |e| e.text }.join(',')).length > 0
93
+ parts << Riddl::Parameter::Simple.new('topic', t.attributes['id'])
94
+ parts << Riddl::Parameter::Simple.new('votes', vos)
95
+ end
96
+ end
97
+ status,body = Riddl::Client::new(cpee+ins+'/notifications/subscriptions/').post parts
98
+ end rescue nil # in case just no subs are there
91
99
  end
92
100
  end
93
101
  [ins, uuid]
@@ -285,19 +293,29 @@ module CPEE
285
293
  cblist = @a[2]
286
294
  instance = @p[1].value
287
295
 
288
- srv = Riddl::Client.new(cpee, File.join(cpee,'?riddl-description'))
289
- res = srv.resource("/#{instance}/properties/attributes/uuid")
296
+ srv = Riddl::Client.new(cpee)
297
+ res = srv.resource("/#{instance}/properties/attributes/uuid/")
290
298
  status, response = res.get
291
299
 
292
300
  if status >= 200 && status < 300
293
- uuid = XML::Smart::string(response.first.value).root.text
301
+ uuid = response.first.value
294
302
  handle_data cpee, instance, @p[2]&.value
295
303
  handle_waiting cpee, instance, uuid, @p[0].value, selfurl, cblist
296
304
  handle_starting cpee, instance, @p[0].value
305
+
306
+ send = {
307
+ 'CPEE-INSTANCE' => instance,
308
+ 'CPEE-INSTANCE-URL' => File.join(cpee,instance),
309
+ 'CPEE-INSTANCE-UUID' => uuid,
310
+ 'CPEE-BEHAVIOR' => @p[0].value
311
+ }
312
+
297
313
  if @p[0].value =~ /^wait/
298
314
  @headers << Riddl::Header.new('CPEE-CALLBACK','true')
299
315
  end
300
- return Riddl::Parameter::Simple.new("url",cpee + instance)
316
+ Riddl::Parameter::Complex.new('instance','application/json',JSON::generate(send))
317
+ else
318
+ @status = 500
301
319
  end
302
320
  end
303
321
  end #}}}
@@ -30,7 +30,7 @@ ARGV.options { |opt|
30
30
  opt.on("Options:")
31
31
  opt.on("--help", "-h", "This text") { puts opt; exit }
32
32
  opt.on("")
33
- opt.on(wrap("[DIR] scaffolds a sample instantiation service. Post a testset to a model to keep going in one operation."))
33
+ opt.on(wrap("[DIR] scaffolds a sample instantiation service. Post a testset to a model to keep going in one operation."))
34
34
  opt.parse!
35
35
  }
36
36
  if (ARGV.length != 1)
@@ -40,8 +40,10 @@ else
40
40
  p1 = ARGV[0]
41
41
  end
42
42
 
43
+ insta = "#{curpath}/../server/"
43
44
  if !File.exists?(p1)
44
- FileUtils.cp_r("#{curpath}/../server/",p1)
45
+ FileUtils.cp_r(insta,p1)
45
46
  else
46
- puts 'Directory already exists.'
47
+ FileUtils.cp_r(Dir.glob(File.join(insta,'*')).delete_if{|e| e =~ /\.conf/ },p1,remove_destination: true)
48
+ puts 'Directory already exists, updating ...'
47
49
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cpee-instantiation
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.11
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: 2021-05-19 00:00:00.000000000 Z
11
+ date: 2021-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: riddl
@@ -59,6 +59,9 @@ dependencies:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '2.1'
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: 2.1.4
62
65
  type: :runtime
63
66
  prerelease: false
64
67
  version_requirements: !ruby/object:Gem::Requirement
@@ -66,6 +69,9 @@ dependencies:
66
69
  - - "~>"
67
70
  - !ruby/object:Gem::Version
68
71
  version: '2.1'
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 2.1.4
69
75
  description: see http://cpee.org
70
76
  email: juergen.mangler@gmail.com
71
77
  executables:
@@ -102,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
108
  - !ruby/object:Gem::Version
103
109
  version: '0'
104
110
  requirements: []
105
- rubygems_version: 3.1.4
111
+ rubygems_version: 3.2.22
106
112
  signing_key:
107
113
  specification_version: 4
108
114
  summary: Subprocess instantiation service for the cloud process execution engine (cpee.org)