cpee-instantiation 1.0.11 → 1.0.14

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: fa7ec4be09e6574d2b06d3f63119403dd07d1bfd1f5c91b74e070a0168a73c92
4
- data.tar.gz: 5557f2f30a55365b9ffe235cf025ed4c90bddfaa72d5a125da419b89eed83772
3
+ metadata.gz: 3fe76889766f1a2333a1cf46f15b9edc35742ff55f2abbc5afadf59e4222ee00
4
+ data.tar.gz: 4e92630e731a9b196415c69dbd647145fda7a76873e6c8f8a7afb738cb563692
5
5
  SHA512:
6
- metadata.gz: 934220dc9cd7953028f9ec8c32fc77046380eb54a8ca6d5566e40a0450c4045a3a101a8cf14f988ddeb5e1d068a0a6945333d63c02d053c02c3fcb7383267401
7
- data.tar.gz: 55a39d02d5614c6a2cf1af1b59cc71b8e8544c002d28eb3de6da89bf3938d0f9c6a05e3db9b8f4c0b481067a0ca58e25929246674066cb2f4e084d8f254558dd
6
+ metadata.gz: 551718de37d55ab2795370c873d310067e010877cfd915554cd34470fdcbd710c01b0afca5d50827e0098e33037bc3dc7f30147b6413c266932b189eaf31ccae
7
+ data.tar.gz: 01c916c086d25d62e1ce5c0e63d2455d082dc8da74c3ec000a66c1c915f9dd47b0db0499effc1bc306ac411f9e8dfc969e7bb2307d47ebc63101e06a48d6f0f1
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cpee-instantiation"
3
- s.version = "1.0.11"
3
+ s.version = "1.0.14"
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)"
@@ -84,7 +84,6 @@ module CPEE
84
84
  end
85
85
  parts << Riddl::Parameter::Simple.new('url', s.attributes['url'])
86
86
  s.find('sub:topic').each do |t|
87
- p s.find('sub:event').map{ |e| e.text }
88
87
  if (evs = t.find('sub:event').map{ |e| e.text }.join(',')).length > 0
89
88
  parts << Riddl::Parameter::Simple.new('topic', t.attributes['id'])
90
89
  parts << Riddl::Parameter::Simple.new('events', evs)
@@ -137,7 +136,7 @@ module CPEE
137
136
  if data && !data.empty?
138
137
  content = XML::Smart.string('<dataelements xmlns="http://cpee.org/ns/properties/2.0"/>')
139
138
  JSON::parse(data).each do |k,v|
140
- content.root.add(k,v)
139
+ content.root.add(k,CPEE::ValueHelper::generate(v))
141
140
  end
142
141
  srv = Riddl::Client.new(cpee, File.join(cpee,'?riddl-description'))
143
142
  res = srv.resource("/#{instance}/properties/dataelements/")
@@ -159,6 +158,19 @@ module CPEE
159
158
  ]
160
159
  end rescue nil
161
160
  end #}}}
161
+ def handle_attributes(cpee,instance,data) #{{{
162
+ if data && !data.empty?
163
+ content = XML::Smart.string('<attributes xmlns="http://cpee.org/ns/properties/2.0"/>')
164
+ JSON::parse(data).each do |k,v|
165
+ content.root.add(k,v)
166
+ end
167
+ srv = Riddl::Client.new(cpee, File.join(cpee,'?riddl-description'))
168
+ res = srv.resource("/#{instance}/properties/attributes/")
169
+ status, response = res.patch [
170
+ Riddl::Parameter::Complex.new('attributes','text/xml',content.to_s)
171
+ ]
172
+ end rescue nil
173
+ end #}}}
162
174
  end #}}}
163
175
 
164
176
  class InstantiateGit < Riddl::Implementation #{{{
@@ -180,9 +192,15 @@ module CPEE
180
192
  @status = 500
181
193
  else
182
194
  EM.defer do
183
- handle_data cpee, instance, @p[4]&.value if @p[4]&.name == 'init'
184
- handle_endpoints cpee, instance, @p[4]&.value if @p[4]&.name == 'endpoints'
185
- handle_endpoints cpee, instance, @p[5]&.value if @p[5]&.name == 'endpoints'
195
+ if x = @p.find{ |e| e.name == 'init' }&.value
196
+ handle_data cpee, instance, x
197
+ end
198
+ if x = @p.find{ |e| e.name == 'endpoints' }&.value
199
+ handle_endpoints cpee, instance, x
200
+ end
201
+ if x = @p.find{ |e| e.name == 'attributes' }&.value
202
+ handle_attributes cpee, instance, x
203
+ end
186
204
 
187
205
  handle_waiting cpee, instance, uuid, @p[0].value, selfurl, cblist
188
206
  handle_starting cpee, instance, @p[0].value
@@ -223,9 +241,15 @@ module CPEE
223
241
  @status = 500
224
242
  else
225
243
  EM.defer do
226
- handle_data cpee, instance, @p[2]&.value if @p[2]&.name == 'init'
227
- handle_endpoints cpee, instance, @p[2]&.value if @p[2]&.name == 'endpoints'
228
- handle_endpoints cpee, instance, @p[3]&.value if @p[3]&.name == 'endpoints'
244
+ if x = @p.find{ |e| e.name == 'init' }&.value
245
+ handle_data cpee, instance, x
246
+ end
247
+ if x = @p.find{ |e| e.name == 'endpoints' }&.value
248
+ handle_endpoints cpee, instance, x
249
+ end
250
+ if x = @p.find{ |e| e.name == 'attributes' }&.value
251
+ handle_attributes cpee, instance, x
252
+ end
229
253
 
230
254
  handle_waiting cpee, instance, uuid, @p[0].value, selfurl, cblist
231
255
  handle_starting cpee, instance, @p[0].value
@@ -385,7 +409,7 @@ module CPEE
385
409
  run InstantiateGit, opts[:cpee], opts[:self], opts[:cblist] if post 'git'
386
410
  end
387
411
  on resource 'instance' do
388
- run HandleInstance, opts[:cpee] if post 'instance'
412
+ run HandleInstance, opts[:cpee], opts[:self], opts[:cblist] if post 'instance'
389
413
  end
390
414
  on resource 'callback' do
391
415
  on resource do
@@ -33,6 +33,9 @@
33
33
  <optional>
34
34
  <parameter name="endpoints" type="string"/>
35
35
  </optional>
36
+ <optional>
37
+ <parameter name="attributes" type="string"/>
38
+ </optional>
36
39
  <optional>
37
40
  <parameter name="customization" type="string"/>
38
41
  </optional>
@@ -53,6 +56,9 @@
53
56
  <optional>
54
57
  <parameter name="endpoints" type="string"/>
55
58
  </optional>
59
+ <optional>
60
+ <parameter name="attributes" type="string"/>
61
+ </optional>
56
62
  <optional>
57
63
  <parameter name="customization" type="string"/>
58
64
  </optional>
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.11
4
+ version: 1.0.14
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-11-23 00:00:00.000000000 Z
11
+ date: 2022-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: riddl
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
110
  requirements: []
111
- rubygems_version: 3.2.22
111
+ rubygems_version: 3.3.7
112
112
  signing_key:
113
113
  specification_version: 4
114
114
  summary: Subprocess instantiation service for the cloud process execution engine (cpee.org)