cpee 1.5.22 → 1.5.27

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/cockpit/index.html +2 -2
  3. data/cockpit/js/instance.js +6 -6
  4. data/cockpit/rngs/attributes.rng +2 -2
  5. data/cockpit/rngs/dataelements.rng +2 -2
  6. data/cockpit/rngs/endpoints.rng +2 -2
  7. data/cockpit/{testsets → templates.legacy}/Async.xml +0 -0
  8. data/cockpit/{testsets → templates.legacy}/BCO.xml +0 -0
  9. data/cockpit/{testsets → templates.legacy}/BCS.xml +0 -0
  10. data/cockpit/{testsets → templates.legacy}/Centurio.xml +0 -0
  11. data/cockpit/{testsets → templates.legacy}/Concurrent.xml +0 -0
  12. data/cockpit/testsets/Coopis Testset.xml b/data/cockpit/templates.legacy/Coopis → Testset.xml +0 -0
  13. data/cockpit/testsets/Endpoints and Data Manipulation.xml b/data/cockpit/templates.legacy/Endpoints and Data → Manipulation.xml +0 -0
  14. data/cockpit/testsets/ICSOC Testset.xml b/data/cockpit/templates.legacy/ICSOC → Testset.xml +0 -0
  15. data/cockpit/{testsets → templates.legacy}/Infinity.xml +0 -0
  16. data/cockpit/testsets/Lego Boxer.xml b/data/cockpit/templates.legacy/Lego → Boxer.xml +0 -0
  17. data/cockpit/testsets/Lego Conveyor.xml b/data/cockpit/templates.legacy/Lego → Conveyor.xml +0 -0
  18. data/cockpit/testsets/Lego Crane.xml b/data/cockpit/templates.legacy/Lego → Crane.xml +0 -0
  19. data/cockpit/testsets/Lego Ejector.xml b/data/cockpit/templates.legacy/Lego → Ejector.xml +0 -0
  20. data/cockpit/testsets/Lego Full.xml b/data/cockpit/templates.legacy/Lego → Full.xml +0 -0
  21. data/cockpit/testsets/Lego Liddy.xml b/data/cockpit/templates.legacy/Lego → Liddy.xml +0 -0
  22. data/cockpit/testsets/Lego Plate.xml b/data/cockpit/templates.legacy/Lego → Plate.xml +0 -0
  23. data/cockpit/testsets/Lego Transporter.xml b/data/cockpit/templates.legacy/Lego → Transporter.xml +0 -0
  24. data/cockpit/{testsets → templates.legacy}/Lego_Part_1.xml +0 -0
  25. data/cockpit/{testsets → templates.legacy}/LgLinear.xml +0 -0
  26. data/cockpit/{testsets → templates.legacy}/Linear.xml +0 -0
  27. data/cockpit/{testsets → templates.legacy}/Log.xml +0 -0
  28. data/cockpit/testsets/Mangler 1.xml b/data/cockpit/templates.legacy/Mangler → 1.xml +0 -0
  29. data/cockpit/testsets/Mangler 2.xml b/data/cockpit/templates.legacy/Mangler → 2.xml +0 -0
  30. data/cockpit/testsets/Manuel Labels.xml b/data/cockpit/templates.legacy/Manuel → Labels.xml +0 -0
  31. data/cockpit/{testsets → templates.legacy}/Promise.xml +0 -0
  32. data/cockpit/testsets/SOPROMO Test Sonification.xml b/data/cockpit/templates.legacy/SOPROMO Test → Sonification.xml +0 -0
  33. data/cockpit/testsets/Syncing P34 1.xml b/data/cockpit/templates.legacy/Syncing P34 → 1.xml +0 -0
  34. data/cockpit/testsets/Syncing P34 2.xml b/data/cockpit/templates.legacy/Syncing P34 → 2.xml +0 -0
  35. data/cockpit/testsets/Syncing P34 3.xml b/data/cockpit/templates.legacy/Syncing P34 → 3.xml +0 -0
  36. data/cockpit/testsets/Syncing P34.xml b/data/cockpit/templates.legacy/Syncing → P34.xml +0 -0
  37. data/cockpit/testsets/TEST - Bad Loop.xml b/data/cockpit/templates.legacy/TEST - Bad → Loop.xml +0 -0
  38. data/cockpit/testsets/TEST - Wrong Positions.xml b/data/cockpit/templates.legacy/TEST - Wrong → Positions.xml +0 -0
  39. data/cockpit/{testsets → templates.legacy}/Update.xml +0 -0
  40. data/cockpit/testsets/Worklist Parallel.xml b/data/cockpit/templates.legacy/Worklist → Parallel.xml +0 -0
  41. data/cockpit/testsets/Worklist Test CPEE.xml b/data/cockpit/templates.legacy/Worklist Test → CPEE.xml +0 -0
  42. data/cockpit/testsets/Worklist Test.xml b/data/cockpit/templates.legacy/Worklist → Test.xml +0 -0
  43. data/cockpit/testsets/Worklist Test2.xml b/data/cockpit/templates.legacy/Worklist → Test2.xml +0 -0
  44. data/cockpit/{testsets → templates.legacy}/convert_preset.rb +0 -0
  45. data/cockpit/{testsets → templates.legacy}/testsets.xml +0 -0
  46. data/cockpit/{testsets → templates.legacy}/transformations.xml +0 -0
  47. data/cockpit/templates/BPM 2020 Manual Adjust.xml +235 -0
  48. data/cockpit/templates/BPM 2020 Solution Baseline.xml +250 -0
  49. data/cockpit/templates/BPM 2020 Solution NN.xml +243 -0
  50. data/cockpit/templates/BPM 2020 Solution View.xml +200 -0
  51. data/cockpit/templates/BPM 2020.xml +15 -0
  52. data/cockpit/templates/Coopis 2010.xml +76 -0
  53. data/cockpit/templates/IUPC arXiv:1104.3609 P34 1.xml +80 -0
  54. data/cockpit/templates/IUPC arXiv:1104.3609 P34 2.xml +80 -0
  55. data/cockpit/templates/IUPC arXiv:1104.3609 P34 3.xml +80 -0
  56. data/cockpit/{testsets/Take_5.xml → templates/Worklist.xml} +15 -21
  57. data/cockpit/templates/convert_preset.rb +32 -0
  58. data/cockpit/templates/testsets.xml +11 -0
  59. data/cockpit/templates/transformations.xml +4 -0
  60. data/cockpit/themes/compact/rngs/call.rng +6 -0
  61. data/cockpit/themes/compact/rngs/callmanipulate.rng +6 -0
  62. data/cockpit/themes/compact/theme.js +1 -1
  63. data/cockpit/themes/default/theme.js +1 -1
  64. data/cockpit/themes/extended/rngs/call.rng +6 -0
  65. data/cockpit/themes/extended/rngs/callmanipulate.rng +6 -0
  66. data/cockpit/themes/extended/theme.js +7 -22
  67. data/cockpit/themes/model/theme.js +1 -1
  68. data/cockpit/themes/packed/rngs/call.rng +6 -0
  69. data/cockpit/themes/packed/rngs/callmanipulate.rng +6 -0
  70. data/cockpit/themes/packed/theme.js +1 -1
  71. data/cockpit/themes/preset/rngs/call.rng +6 -0
  72. data/cockpit/themes/preset/rngs/callmanipulate.rng +6 -0
  73. data/cockpit/themes/preset/theme.js +1 -1
  74. data/cpee.gemspec +1 -1
  75. data/lib/cpee/controller.rb +1 -1
  76. data/lib/cpee/instantiation.rb +9 -8
  77. data/log/sic.rb +1 -0
  78. data/server/handlerwrappers/default.rb +1 -1
  79. data/server/resources/transformation_dslx.xsl +12 -5
  80. data/server/transformation_dslx.xsl +790 -0
  81. data/tools/instantiation/instantiation +1 -0
  82. data/tools/server/server.rb +1 -0
  83. metadata +56 -51
  84. data/cockpit/test.html +0 -40
  85. data/cockpit/testsets/Subprocess.xml +0 -56
  86. data/server/resources/notifications/logging/consumer-secret +0 -1
  87. data/server/resources/notifications/logging/producer-secret +0 -1
  88. data/server/resources/notifications/logging/subscription.xml +0 -19
  89. data/server/resources/test1.xml +0 -58
  90. data/server/resources/test2.xml +0 -60
  91. data/server/resources/test3.xml +0 -217
@@ -65,7 +65,7 @@ function WFAdaptorManifestation(adaptor) {
65
65
  var schema = save['endpoints_cache'][$(node).attr('endpoint')].schema.documentElement;
66
66
  $(rng).find(' > element[name="parameters"] > element[name="arguments"]').replaceWith($(schema).clone());
67
67
  }
68
- if (save['endpoints_list'][$(node).attr('endpoint')] && !save['endpoints_list'][$(node).attr('endpoint')].startsWith('http')) {
68
+ if (save['endpoints_list'][$(node).attr('endpoint')] && (!save['endpoints_list'][$(node).attr('endpoint')].startsWith('http') || save['endpoints_list'][$(node).attr('endpoint')].match(/^https?-/))) {
69
69
  $(rng).find(' > element[name="parameters"] > element[name="method"]').remove();
70
70
  }
71
71
  save['details'] = new RelaxNGui(rng,tab,self.adaptor.description.context_eval,true);
@@ -65,7 +65,7 @@ function WFAdaptorManifestation(adaptor) {
65
65
  var schema = save['endpoints_cache'][$(node).attr('endpoint')].schema.documentElement;
66
66
  $(rng).find(' > element[name="parameters"] > element[name="arguments"]').replaceWith($(schema).clone());
67
67
  }
68
- if (save['endpoints_list'][$(node).attr('endpoint')] && !save['endpoints_list'][$(node).attr('endpoint')].startsWith('http')) {
68
+ if (save['endpoints_list'][$(node).attr('endpoint')] && (!save['endpoints_list'][$(node).attr('endpoint')].startsWith('http') || save['endpoints_list'][$(node).attr('endpoint')].match(/^https?-/))) {
69
69
  $(rng).find(' > element[name="parameters"] > element[name="method"]').remove();
70
70
  }
71
71
  save['details'] = new RelaxNGui(rng,tab,self.adaptor.description.context_eval,true);
@@ -92,6 +92,12 @@
92
92
  </element>
93
93
  <element name="annotations" rngui:header="Annotations">
94
94
  <element name="_timing" rngui:header="Timing" rngui:fold="closed">
95
+ <element name="_timing_wait" rngui:label='ω - Wait'>
96
+ <data type='float' rngui:label='[0,1]' rngui:default='0.5'/>
97
+ </element>
98
+ <element name="_timing_threshold" rngui:label='κ - Threshold'>
99
+ <data type='float' rngui:label='[0,3,n]' rngui:default='3'/>
100
+ </element>
95
101
  <element name="_timing_min" rngui:label='Min in min'>
96
102
  <data type='float' rngui:label='Minutes'/>
97
103
  </element>
@@ -115,6 +115,12 @@
115
115
  </element>
116
116
  <element name="annotations" rngui:header="Annotations">
117
117
  <element name="_timing" rngui:header="Timing" rngui:fold="closed">
118
+ <element name="_timing_wait" rngui:label='ω - Wait'>
119
+ <data type='float' rngui:label='[0,1]'/>
120
+ </element>
121
+ <element name="_timing_threshold" rngui:label='κ - Threshold'>
122
+ <data type='float' rngui:label='[0,3,n]'/>
123
+ </element>
118
124
  <element name="_timing_min" rngui:label='Min in min'>
119
125
  <data type='float' rngui:label='Minutes'/>
120
126
  </element>
@@ -65,7 +65,7 @@ function WFAdaptorManifestation(adaptor) {
65
65
  var schema = save['endpoints_cache'][$(node).attr('endpoint')].schema.documentElement;
66
66
  $(rng).find(' > element[name="parameters"] > element[name="arguments"]').replaceWith($(schema).clone());
67
67
  }
68
- if (save['endpoints_list'][$(node).attr('endpoint')] && !save['endpoints_list'][$(node).attr('endpoint')].startsWith('http')) {
68
+ if (save['endpoints_list'][$(node).attr('endpoint')] && (!save['endpoints_list'][$(node).attr('endpoint')].startsWith('http') || save['endpoints_list'][$(node).attr('endpoint')].match(/^https?-/))) {
69
69
  $(rng).find(' > element[name="parameters"] > element[name="method"]').remove();
70
70
  }
71
71
  save['details'] = new RelaxNGui(rng,tab,self.adaptor.description.context_eval,true);
@@ -264,33 +264,18 @@ function WFAdaptorManifestation(adaptor) {
264
264
  'label': function(node){
265
265
  var rep = $('body').attr('current-resources');
266
266
  var ep = self.endpoints[$(node).attr('endpoint')];
267
- var avg = $('_timing_avg',$(node).children('annotations')).text();
267
+ var wait = $('_timing_wait',$(node).children('annotations')).text();
268
+ var threshold = $('_timing_threshold',$(node).children('annotations')).text();
268
269
  var lab = $('> label',$(node).children('parameters')).text().replace(/^['"]/,'').replace(/['"]$/,'');
269
270
  var ret = [ { column: 'ID', value: $(node).attr('id') } ];
270
271
  if (lab != '') {
271
272
  ret.unshift( { column: 'Label', value: lab } );
272
273
  }
273
- if (ep != undefined) {
274
- var lnd = $(node).attr('endpoint');
275
- ret.push({ column: 'Resource', value: lnd });
276
- if (save['endpoints_cache'][lnd] && save['endpoints_cache'][lnd].properties) {
277
- var prop = save['endpoints_cache'][lnd].properties;
278
- if (prop.resource) {
279
- if (prop.resource == 'exclusive' && prop.lock) {
280
- ret.push({ column: 'RP', value: prop.resource + ' (' + prop.lock + ')' });
281
- } else {
282
- ret.push({ column: 'RP', value: prop.resource });
283
- }
284
- }
285
- if (prop.alternatives) {
286
- ret.push({ column: 'R#', value: prop.alternatives.length + 1});
287
- } else {
288
- ret.push({ column: 'R#', value: '1' });
289
- }
290
- }
274
+ if (wait != '') {
275
+ ret.push({ column: 'Wait', value: 'ω = ' + wait });
291
276
  }
292
- if (avg != '') {
293
- ret.push({ column: 'Average', value: avg + 'min' });
277
+ if (threshold != '') {
278
+ ret.push({ column: 'Threshold', value: = ' + threshold });
294
279
  }
295
280
  return ret;
296
281
  },
@@ -65,7 +65,7 @@ function WFAdaptorManifestation(adaptor) {
65
65
  var schema = save['endpoints_cache'][$(node).attr('endpoint')].schema.documentElement;
66
66
  $(rng).find(' > element[name="parameters"] > element[name="arguments"]').replaceWith($(schema).clone());
67
67
  }
68
- if (save['endpoints_list'][$(node).attr('endpoint')] && !save['endpoints_list'][$(node).attr('endpoint')].startsWith('http')) {
68
+ if (save['endpoints_list'][$(node).attr('endpoint')] && (!save['endpoints_list'][$(node).attr('endpoint')].startsWith('http') || save['endpoints_list'][$(node).attr('endpoint')].match(/^https?-/))) {
69
69
  $(rng).find(' > element[name="parameters"] > element[name="method"]').remove();
70
70
  }
71
71
  save['details'] = new RelaxNGui(rng,tab,self.adaptor.description.context_eval,true);
@@ -92,6 +92,12 @@
92
92
  </element>
93
93
  <element name="annotations" rngui:header="Annotations">
94
94
  <element name="_timing" rngui:header="Timing" rngui:fold="closed">
95
+ <element name="_timing_wait" rngui:label='ω - Wait'>
96
+ <data type='float' rngui:label='[0,1]' rngui:default='0.5'/>
97
+ </element>
98
+ <element name="_timing_threshold" rngui:label='κ - Threshold'>
99
+ <data type='float' rngui:label='[0,3,n]' rngui:default='3'/>
100
+ </element>
95
101
  <element name="_timing_min" rngui:label='Min in min'>
96
102
  <data type='float' rngui:label='Minutes'/>
97
103
  </element>
@@ -115,6 +115,12 @@
115
115
  </element>
116
116
  <element name="annotations" rngui:header="Annotations">
117
117
  <element name="_timing" rngui:header="Timing" rngui:fold="closed">
118
+ <element name="_timing_wait" rngui:label='ω - Wait'>
119
+ <data type='float' rngui:label='[0,1]'/>
120
+ </element>
121
+ <element name="_timing_threshold" rngui:label='κ - Threshold'>
122
+ <data type='float' rngui:label='[0,3,n]'/>
123
+ </element>
118
124
  <element name="_timing_min" rngui:label='Min in min'>
119
125
  <data type='float' rngui:label='Minutes'/>
120
126
  </element>
@@ -65,7 +65,7 @@ function WFAdaptorManifestation(adaptor) {
65
65
  var schema = save['endpoints_cache'][$(node).attr('endpoint')].schema.documentElement;
66
66
  $(rng).find(' > element[name="parameters"] > element[name="arguments"]').replaceWith($(schema).clone());
67
67
  }
68
- if (save['endpoints_list'][$(node).attr('endpoint')] && !save['endpoints_list'][$(node).attr('endpoint')].startsWith('http')) {
68
+ if (save['endpoints_list'][$(node).attr('endpoint')] && (!save['endpoints_list'][$(node).attr('endpoint')].startsWith('http') || save['endpoints_list'][$(node).attr('endpoint')].match(/^https?-/))) {
69
69
  $(rng).find(' > element[name="parameters"] > element[name="method"]').remove();
70
70
  }
71
71
  save['details'] = new RelaxNGui(rng,tab,self.adaptor.description.context_eval,true);
@@ -92,6 +92,12 @@
92
92
  </element>
93
93
  <element name="annotations" rngui:header="Annotations">
94
94
  <element name="_timing" rngui:header="Timing" rngui:fold="closed">
95
+ <element name="_timing_wait" rngui:label='ω - Wait'>
96
+ <data type='float' rngui:label='[0,1]' rngui:default='0.5'/>
97
+ </element>
98
+ <element name="_timing_threshold" rngui:label='κ - Threshold'>
99
+ <data type='float' rngui:label='[0,3,n]' rngui:default='3'/>
100
+ </element>
95
101
  <element name="_timing_min" rngui:label='Min in min'>
96
102
  <data type='float' rngui:label='Minutes'/>
97
103
  </element>
@@ -115,6 +115,12 @@
115
115
  </element>
116
116
  <element name="annotations" rngui:header="Annotations">
117
117
  <element name="_timing" rngui:header="Timing" rngui:fold="closed">
118
+ <element name="_timing_wait" rngui:label='ω - Wait'>
119
+ <data type='float' rngui:label='[0,1]'/>
120
+ </element>
121
+ <element name="_timing_threshold" rngui:label='κ - Threshold'>
122
+ <data type='float' rngui:label='[0,3,n]'/>
123
+ </element>
118
124
  <element name="_timing_min" rngui:label='Min in min'>
119
125
  <data type='float' rngui:label='Minutes'/>
120
126
  </element>
@@ -65,7 +65,7 @@ function WFAdaptorManifestation(adaptor) {
65
65
  var schema = save['endpoints_cache'][$(node).attr('endpoint')].schema.documentElement;
66
66
  $(rng).find(' > element[name="parameters"] > element[name="arguments"]').replaceWith($(schema).clone());
67
67
  }
68
- if (save['endpoints_list'][$(node).attr('endpoint')] && !save['endpoints_list'][$(node).attr('endpoint')].startsWith('http')) {
68
+ if (save['endpoints_list'][$(node).attr('endpoint')] && (!save['endpoints_list'][$(node).attr('endpoint')].startsWith('http') || save['endpoints_list'][$(node).attr('endpoint')].match(/^https?-/))) {
69
69
  $(rng).find(' > element[name="parameters"] > element[name="method"]').remove();
70
70
  }
71
71
  save['details'] = new RelaxNGui(rng,tab,self.adaptor.description.context_eval,true);
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cpee"
3
- s.version = "1.5.22"
3
+ s.version = "1.5.27"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3.0"
6
6
  s.summary = "Preliminary release of cloud process execution engine (cpee). If you just need workflow execution, without a rest/xmpp service exposing it, then use WEEL"
@@ -373,7 +373,7 @@ module CPEE
373
373
  node = doc.find("/p:properties/p:state").first
374
374
  state = node.text
375
375
  end
376
- if call_vote("state/change", :instance => @id, :info => info, :state => state)
376
+ if call_vote("state/change", :instance => @id, :info => info, :state => state, :attributes => attributes_translated)
377
377
  case state
378
378
  when 'stopping'
379
379
  stop
@@ -34,7 +34,7 @@ module CPEE
34
34
  doc.register_namespace 'desc', 'http://cpee.org/ns/description/1.0'
35
35
  doc.register_namespace 'prop', 'http://riddl.org/ns/common-patterns/properties/1.0'
36
36
 
37
- srv = Riddl::Client.new(cpee, cpee + "?riddl-description")
37
+ srv = Riddl::Client.new(cpee, File.join(cpee,'?riddl-description'))
38
38
  res = srv.resource("/")
39
39
  if name
40
40
  doc.find("/testset/attributes/prop:info").each do |e|
@@ -109,7 +109,7 @@ module CPEE
109
109
 
110
110
  if cb
111
111
  cbk = SecureRandom.uuid
112
- srv = Riddl::Client.new(cpee, cpee + "?riddl-description")
112
+ srv = Riddl::Client.new(cpee, File.join(cpee,'?riddl-description'))
113
113
  status, response = srv.resource("/#{instance}/notifications/subscriptions/").post [
114
114
  Riddl::Parameter::Simple.new("url",File.join(selfurl,'callback',cbk)),
115
115
  Riddl::Parameter::Simple.new("topic","state"),
@@ -126,7 +126,7 @@ module CPEE
126
126
  private :handle_waiting
127
127
  def handle_starting(cpee,instance,behavior) #{{{
128
128
  if behavior =~ /_running$/
129
- srv = Riddl::Client.new(cpee, cpee + "?riddl-description")
129
+ srv = Riddl::Client.new(cpee, File.join(cpee,'?riddl-description'))
130
130
  res = srv.resource("/#{instance}/properties/values")
131
131
  status, response = res.put [
132
132
  Riddl::Parameter::Simple.new('name', 'state'),
@@ -141,7 +141,7 @@ module CPEE
141
141
  JSON::parse(data).each do |k,v|
142
142
  content.root.add(k,v)
143
143
  end
144
- srv = Riddl::Client.new(cpee, cpee + "?riddl-description")
144
+ srv = Riddl::Client.new(cpee, File.join(cpee,'?riddl-description'))
145
145
  res = srv.resource("/#{instance}/properties/values/dataelements/")
146
146
  status, response = res.patch [
147
147
  Riddl::Parameter::Complex.new('content','text/xml',content.to_s)
@@ -154,7 +154,7 @@ module CPEE
154
154
  JSON::parse(data).each do |k,v|
155
155
  content.root.add(k,v)
156
156
  end
157
- srv = Riddl::Client.new(cpee, cpee + "?riddl-description")
157
+ srv = Riddl::Client.new(cpee, File.join(cpee,'?riddl-description'))
158
158
  res = srv.resource("/#{instance}/properties/values/endpoints/")
159
159
  status, response = res.patch [
160
160
  Riddl::Parameter::Complex.new('content','text/xml',content.to_s)
@@ -280,7 +280,7 @@ module CPEE
280
280
  cblist = @a[2]
281
281
  instance = @p[1].value
282
282
 
283
- srv = Riddl::Client.new(cpee, cpee + "?riddl-description")
283
+ srv = Riddl::Client.new(cpee, File.join(cpee,'?riddl-description'))
284
284
  res = srv.resource("/#{instance}/properties/values/attributes/uuid")
285
285
  status, response = res.get
286
286
 
@@ -296,7 +296,6 @@ module CPEE
296
296
 
297
297
  class ContinueTask < Riddl::Implementation #{{{
298
298
  def response
299
- cpee = @h['X_CPEE'] || @a[0]
300
299
  cblist = @a[1]
301
300
  topic = @p[1].value
302
301
  event_name = @p[2].value
@@ -305,6 +304,8 @@ module CPEE
305
304
  key = @r.last
306
305
  cb, condition, instance, uuid, instance_url = cblist.lrange(key,0,-1)
307
306
 
307
+ cpee = File.dirname(instance_url)
308
+
308
309
  orisend = {
309
310
  'CPEE-INSTANCE' => instance,
310
311
  'CPEE-INSTANCE-URL' => instance_url,
@@ -315,7 +316,7 @@ module CPEE
315
316
 
316
317
  if notification['state'] == condition
317
318
  cblist.del(key)
318
- srv = Riddl::Client.new(cpee, cpee + "?riddl-description")
319
+ srv = Riddl::Client.new(cpee, File.join(cpee,'?riddl-description'))
319
320
  res = srv.resource("/#{instance}/properties/values/dataelements")
320
321
  status, response = res.get
321
322
  if status >= 200 && status < 300
data/log/sic.rb CHANGED
@@ -58,6 +58,7 @@ def help
58
58
  puts ' Copy: sic.rb https://centurio.work/log/865916c6-2b18-4e9d-81d4-0fab0df248f4.xes.yaml copy'
59
59
  puts ' Copy: sic.rb ~/Projects/cpee/log/logs/865916c6-2b18-4e9d-81d4-0fab0df248f4.xes.yaml copy'
60
60
  puts ' View: sic.rb 865916c6-2b18-4e9d-81d4-0fab0df248f4.xes.yaml'
61
+ true
61
62
  end
62
63
 
63
64
  react(ARGV[0]) || help
@@ -16,7 +16,7 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
16
16
  def self::inform_state_change(arguments,newstate) # {{{
17
17
  controller = arguments[0]
18
18
  controller.serialize_state!
19
- controller.notify("state/change", :instance => controller.instance, :instance_uuid => controller.uuid, :state => newstate, :timestamp => Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"))
19
+ controller.notify("state/change", :instance => controller.instance, :instance_uuid => controller.uuid, :state => newstate, :timestamp => Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"), :attributes => controller.attributes_translated)
20
20
  controller.finalize_if_finished
21
21
  end # }}}
22
22
  def self::inform_syntax_error(arguments,err,code)# {{{
@@ -390,9 +390,7 @@
390
390
  <xsl:text>]</xsl:text>
391
391
  </xsl:when>
392
392
  <xsl:when test="count(*) &gt; 0 and name()='report'">
393
- <xsl:text>[</xsl:text>
394
393
  <xsl:apply-templates select="d:*" mode="plainmulti"/>
395
- <xsl:text>]</xsl:text>
396
394
  </xsl:when>
397
395
  <xsl:when test="count(*) &gt; 0 and not(name()='arguments')">
398
396
  <xsl:text>{</xsl:text>
@@ -509,11 +507,11 @@
509
507
  <xsl:text>nil</xsl:text>
510
508
  </xsl:when>
511
509
  <xsl:when test="child::node()[not(self::text())]">
512
- <!-- FUUUU, there is probably much more TODO -->
510
+ <!-- FUUUU, there is probably much more TODO. Updated Matthias und Juergen, we tested for ing-opcua/execute -->
513
511
  <xsl:choose>
514
- <xsl:when test="child::*/child::* and count(child::*[not(name()=name(../child::*[1]))])=0">
512
+ <xsl:when test="child::* and name(child::*)=concat(name(.),'_item') and count(child::*[not(name()=name(../child::*[1]))])=0">
515
513
  <xsl:text>"[ </xsl:text>
516
- <xsl:apply-templates select="*" mode="JSON"/>
514
+ <xsl:apply-templates select="*" mode="JSONArrayItem"/>
517
515
  <xsl:text>]"</xsl:text>
518
516
  </xsl:when>
519
517
  <xsl:otherwise>
@@ -657,6 +655,15 @@
657
655
  <xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>
658
656
  </xsl:choose>
659
657
  </xsl:template>
658
+ <xsl:template match="*" mode="JSONArrayItem">
659
+ <xsl:call-template name="JSONProperties">
660
+ <xsl:with-param name="parent" select="'Yes'"></xsl:with-param>
661
+ </xsl:call-template>
662
+ <xsl:choose>
663
+ <xsl:when test="following-sibling::*">, </xsl:when>
664
+ <xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>
665
+ </xsl:choose>
666
+ </xsl:template>
660
667
 
661
668
  <!-- JSON Object Properties -->
662
669
  <xsl:template name="JSONProperties">
@@ -0,0 +1,790 @@
1
+ <?xml version="1.0"?>
2
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:d="http://cpee.org/ns/description/1.0" xmlns:str="http://exslt.org/strings" version="1.0">
3
+ <xsl:output method="text"/>
4
+ <xsl:strip-space elements="*"/>
5
+ <xsl:variable name="myspacemultiplier">2</xsl:variable>
6
+ <xsl:template match="/">
7
+ <xsl:apply-templates select="//d:description"/>
8
+ </xsl:template>
9
+ <xsl:template match="//d:description">
10
+ <xsl:apply-templates>
11
+ <xsl:with-param name="myspace">
12
+ <xsl:value-of select="-1*$myspacemultiplier"/>
13
+ </xsl:with-param>
14
+ </xsl:apply-templates>
15
+ </xsl:template>
16
+ <xsl:template match="*">
17
+ <xsl:param name="myspace"/>
18
+ <xsl:call-template name="print-space">
19
+ <xsl:with-param name="i">1</xsl:with-param>
20
+ <xsl:with-param name="count">
21
+ <xsl:value-of select="$myspace+$myspacemultiplier"/>
22
+ </xsl:with-param>
23
+ </xsl:call-template>
24
+ <xsl:if test="name()='call' or name()='manipulate'">
25
+ <xsl:value-of select="name()"/>
26
+ <xsl:text> :</xsl:text>
27
+ <xsl:value-of select="@id"/>
28
+ </xsl:if>
29
+ <xsl:if test="name()='call'">
30
+ <xsl:text>, </xsl:text>
31
+ <xsl:choose>
32
+ <xsl:when test="count(str:tokenize(@endpoint,' ')) &gt; 1">
33
+ <xsl:text>[</xsl:text>
34
+ <xsl:for-each select="str:tokenize(@endpoint,' ')">
35
+ <xsl:if test="position() &gt;1">, </xsl:if>
36
+ <xsl:text>:</xsl:text>
37
+ <xsl:value-of select="."/>
38
+ </xsl:for-each>
39
+ <xsl:text>]</xsl:text>
40
+ </xsl:when>
41
+ <xsl:when test="count(str:tokenize(@endpoint,' ')) = 0">
42
+ <xsl:text>nil</xsl:text>
43
+ </xsl:when>
44
+ <xsl:otherwise>
45
+ <xsl:text>:</xsl:text>
46
+ <xsl:value-of select="@endpoint"/>
47
+ </xsl:otherwise>
48
+ </xsl:choose>
49
+ <xsl:text>, parameters: { </xsl:text>
50
+ <xsl:apply-templates select="d:parameters"/>
51
+ <xsl:text> }</xsl:text>
52
+ <xsl:if test="(d:finalize or d:code/d:finalize) and (d:finalize/text() or d:code/d:finalize/text())">
53
+ <xsl:text>, finalize: &lt;&lt;-END</xsl:text>
54
+ </xsl:if>
55
+ <xsl:if test="(d:update or d:code/d:update) and (d:update/text() or d:code/d:update/text())">
56
+ <xsl:text>, update: &lt;&lt;-END</xsl:text>
57
+ </xsl:if>
58
+ <xsl:if test="(d:prepare or d:code/d:prepare) and (d:prepare/text() or d:code/d:prepare/text())">
59
+ <xsl:text>, prepare: &lt;&lt;-END</xsl:text>
60
+ </xsl:if>
61
+ <xsl:if test="(d:rescue or d:code/d:rescue) and (d:rescue/text() or d:code/d:rescue/text())">
62
+ <xsl:text>, salvage: &lt;&lt;-END</xsl:text>
63
+ </xsl:if>
64
+ <xsl:apply-templates select="d:finalize | d:code/d:finalize" mode="part-of-call">
65
+ <xsl:with-param name="myspace">
66
+ <xsl:value-of select="$myspace"/>
67
+ </xsl:with-param>
68
+ </xsl:apply-templates>
69
+ <xsl:apply-templates select="d:update | d:code/d:update" mode="part-of-call">
70
+ <xsl:with-param name="myspace">
71
+ <xsl:value-of select="$myspace"/>
72
+ </xsl:with-param>
73
+ </xsl:apply-templates>
74
+ <xsl:apply-templates select="d:prepare | d:code/d:prepare" mode="part-of-call">
75
+ <xsl:with-param name="myspace">
76
+ <xsl:value-of select="$myspace"/>
77
+ </xsl:with-param>
78
+ </xsl:apply-templates>
79
+ <xsl:apply-templates select="d:rescue | d:code/d:rescue" mode="part-of-call">
80
+ <xsl:with-param name="myspace">
81
+ <xsl:value-of select="$myspace"/>
82
+ </xsl:with-param>
83
+ </xsl:apply-templates>
84
+ <xsl:call-template name="print-newline"/>
85
+ </xsl:if>
86
+ <xsl:if test="name()='manipulate'">
87
+ <xsl:if test="@label">
88
+ <xsl:text>, { :label => "</xsl:text>
89
+ <xsl:value-of select="@label"/>
90
+ <xsl:text>" }</xsl:text>
91
+ </xsl:if>
92
+ <xsl:call-template name="print-mcontent">
93
+ <xsl:with-param name="myspace">
94
+ <xsl:value-of select="$myspace"/>
95
+ </xsl:with-param>
96
+ </xsl:call-template>
97
+ <xsl:call-template name="print-newline"/>
98
+ </xsl:if>
99
+ <xsl:if test="name()='terminate'">
100
+ <xsl:text>terminate</xsl:text>
101
+ <xsl:call-template name="print-newline"/>
102
+ </xsl:if>
103
+ <xsl:if test="name()='stop'">
104
+ <xsl:text>stop :</xsl:text>
105
+ <xsl:value-of select="@id"/>
106
+ <xsl:call-template name="print-newline"/>
107
+ </xsl:if>
108
+ <xsl:if test="name()='escape'">
109
+ <xsl:text>escape</xsl:text>
110
+ <xsl:call-template name="print-newline"/>
111
+ </xsl:if>
112
+ <xsl:if test="name()='parallel'">
113
+ <xsl:text>parallel</xsl:text>
114
+ <xsl:if test="@wait">
115
+ <xsl:text> :wait =&gt; </xsl:text>
116
+ <xsl:value-of select="@wait"/>
117
+ </xsl:if>
118
+ <xsl:text> do</xsl:text>
119
+ <xsl:call-template name="print-newline"/>
120
+ <xsl:apply-templates>
121
+ <xsl:with-param name="myspace">
122
+ <xsl:value-of select="$myspace+$myspacemultiplier"/>
123
+ </xsl:with-param>
124
+ </xsl:apply-templates>
125
+ <xsl:call-template name="print-space">
126
+ <xsl:with-param name="i">1</xsl:with-param>
127
+ <xsl:with-param name="count">
128
+ <xsl:value-of select="$myspace+$myspacemultiplier"/>
129
+ </xsl:with-param>
130
+ </xsl:call-template>
131
+ <xsl:text>end</xsl:text>
132
+ <xsl:call-template name="print-newline"/>
133
+ </xsl:if>
134
+ <xsl:if test="name()='loop'">
135
+ <xsl:text>loop </xsl:text>
136
+ <xsl:if test="@mode='pre_test'">
137
+ <xsl:choose>
138
+ <xsl:when test="@language='application/x-ruby'">
139
+ <xsl:text>pre_test{</xsl:text>
140
+ <xsl:value-of select="@condition"/>
141
+ <xsl:text>} </xsl:text>
142
+ </xsl:when>
143
+ <xsl:otherwise>
144
+ <xsl:text>pre_test("</xsl:text>
145
+ <xsl:value-of select="str:replace(str:replace(@condition,'\','\\'),'&quot;','\&quot;')"/>
146
+ <xsl:text>")</xsl:text>
147
+ </xsl:otherwise>
148
+ </xsl:choose>
149
+ </xsl:if>
150
+ <xsl:if test="@mode='post_test'">
151
+ <xsl:choose>
152
+ <xsl:when test="@language='application/x-ruby'">
153
+ <xsl:text>post_test{</xsl:text>
154
+ <xsl:value-of select="@condition"/>
155
+ <xsl:text>} </xsl:text>
156
+ </xsl:when>
157
+ <xsl:otherwise>
158
+ <xsl:text>post_test("</xsl:text>
159
+ <xsl:value-of select="str:replace(str:replace(@condition,'\','\\'),'&quot;','\&quot;')"/>
160
+ <xsl:text>")</xsl:text>
161
+ </xsl:otherwise>
162
+ </xsl:choose>
163
+ </xsl:if>
164
+ <xsl:for-each select="@*[not(name()='language' or name()='mode' or name()='condition' or name()='svg-label')]">
165
+ <xsl:text>, :</xsl:text>
166
+ <xsl:value-of select="name(.)"/>
167
+ <xsl:text> => "</xsl:text>
168
+ <xsl:value-of select="."/>
169
+ <xsl:text>"</xsl:text>
170
+ </xsl:for-each>
171
+ <xsl:text> do</xsl:text>
172
+ <xsl:call-template name="print-newline"/>
173
+ <xsl:apply-templates>
174
+ <xsl:with-param name="myspace">
175
+ <xsl:value-of select="$myspace+$myspacemultiplier"/>
176
+ </xsl:with-param>
177
+ </xsl:apply-templates>
178
+ <xsl:call-template name="print-space">
179
+ <xsl:with-param name="i">1</xsl:with-param>
180
+ <xsl:with-param name="count">
181
+ <xsl:value-of select="$myspace+$myspacemultiplier"/>
182
+ </xsl:with-param>
183
+ </xsl:call-template>
184
+ <xsl:text>end</xsl:text>
185
+ <xsl:call-template name="print-newline"/>
186
+ </xsl:if>
187
+ <xsl:if test="name()='choose'">
188
+ <xsl:text>choose </xsl:text>
189
+ <xsl:choose>
190
+ <xsl:when test="@mode='exclusive'">
191
+ <xsl:text>:exclusive</xsl:text>
192
+ </xsl:when>
193
+ <xsl:otherwise>
194
+ <xsl:text>:inclusive</xsl:text>
195
+ </xsl:otherwise>
196
+ </xsl:choose>
197
+ <xsl:text> do</xsl:text>
198
+ <xsl:call-template name="print-newline"/>
199
+ <xsl:apply-templates>
200
+ <xsl:with-param name="myspace">
201
+ <xsl:value-of select="$myspace+$myspacemultiplier"/>
202
+ </xsl:with-param>
203
+ </xsl:apply-templates>
204
+ <xsl:call-template name="print-space">
205
+ <xsl:with-param name="i">1</xsl:with-param>
206
+ <xsl:with-param name="count">
207
+ <xsl:value-of select="$myspace+$myspacemultiplier"/>
208
+ </xsl:with-param>
209
+ </xsl:call-template>
210
+ <xsl:text>end</xsl:text>
211
+ <xsl:call-template name="print-newline"/>
212
+ </xsl:if>
213
+ <xsl:if test="name()='group'">
214
+ <xsl:apply-templates>
215
+ <xsl:with-param name="myspace">
216
+ <xsl:value-of select="$myspace+$myspacemultiplier"/>
217
+ </xsl:with-param>
218
+ </xsl:apply-templates>
219
+ <xsl:call-template name="print-newline"/>
220
+ </xsl:if>
221
+ <xsl:if test="name()='critical'">
222
+ <xsl:text>critical :</xsl:text>
223
+ <xsl:value-of select="@sid"/>
224
+ <xsl:text> do</xsl:text>
225
+ <xsl:call-template name="print-newline"/>
226
+ <xsl:apply-templates>
227
+ <xsl:with-param name="myspace">
228
+ <xsl:value-of select="$myspace+$myspacemultiplier"/>
229
+ </xsl:with-param>
230
+ </xsl:apply-templates>
231
+ <xsl:call-template name="print-space">
232
+ <xsl:with-param name="i">1</xsl:with-param>
233
+ <xsl:with-param name="count">
234
+ <xsl:value-of select="$myspace+$myspacemultiplier"/>
235
+ </xsl:with-param>
236
+ </xsl:call-template>
237
+ <xsl:text>end</xsl:text>
238
+ <xsl:call-template name="print-newline"/>
239
+ </xsl:if>
240
+ </xsl:template>
241
+ <xsl:template match="d:alternative">
242
+ <xsl:param name="myspace"/>
243
+ <xsl:call-template name="print-space">
244
+ <xsl:with-param name="i">1</xsl:with-param>
245
+ <xsl:with-param name="count">
246
+ <xsl:value-of select="$myspace+$myspacemultiplier"/>
247
+ </xsl:with-param>
248
+ </xsl:call-template>
249
+ <xsl:text>alternative </xsl:text>
250
+ <xsl:choose>
251
+ <xsl:when test="@language='application/x-ruby'">
252
+ <xsl:text>test{</xsl:text>
253
+ <xsl:value-of select="@condition"/>
254
+ <xsl:text>}</xsl:text>
255
+ </xsl:when>
256
+ <xsl:otherwise>
257
+ <xsl:text>test("</xsl:text>
258
+ <xsl:value-of select="str:replace(str:replace(@condition,'\','\\'),'&quot;','\&quot;')"/>
259
+ <xsl:text>")</xsl:text>
260
+ </xsl:otherwise>
261
+ </xsl:choose>
262
+ <xsl:for-each select="@*[not(name()='language' or name()='condition' or name()='svg-label')]">
263
+ <xsl:text>, :</xsl:text>
264
+ <xsl:value-of select="name(.)"/>
265
+ <xsl:text> => "</xsl:text>
266
+ <xsl:value-of select="."/>
267
+ <xsl:text>"</xsl:text>
268
+ </xsl:for-each>
269
+ <xsl:text> do</xsl:text>
270
+ <xsl:call-template name="print-newline"/>
271
+ <xsl:apply-templates>
272
+ <xsl:with-param name="myspace">
273
+ <xsl:value-of select="$myspace+$myspacemultiplier"/>
274
+ </xsl:with-param>
275
+ </xsl:apply-templates>
276
+ <xsl:call-template name="print-space">
277
+ <xsl:with-param name="i">1</xsl:with-param>
278
+ <xsl:with-param name="count">
279
+ <xsl:value-of select="$myspace+$myspacemultiplier"/>
280
+ </xsl:with-param>
281
+ </xsl:call-template>
282
+ <xsl:text>end</xsl:text>
283
+ <xsl:call-template name="print-newline"/>
284
+ </xsl:template>
285
+ <xsl:template match="d:otherwise">
286
+ <xsl:param name="myspace"/>
287
+ <xsl:if test="*">
288
+ <xsl:call-template name="print-space">
289
+ <xsl:with-param name="i">1</xsl:with-param>
290
+ <xsl:with-param name="count">
291
+ <xsl:value-of select="$myspace+$myspacemultiplier"/>
292
+ </xsl:with-param>
293
+ </xsl:call-template>
294
+ <xsl:text>otherwise </xsl:text>
295
+ <xsl:for-each select="@*[not(name()='language' or name()='condition' or name()='svg-label')]">
296
+ <xsl:if test="position() &gt;1">, </xsl:if>
297
+ <xsl:text>:</xsl:text>
298
+ <xsl:value-of select="name(.)"/>
299
+ <xsl:text> => "</xsl:text>
300
+ <xsl:value-of select="."/>
301
+ <xsl:text>"</xsl:text>
302
+ </xsl:for-each>
303
+ <xsl:text> do</xsl:text>
304
+ <xsl:call-template name="print-newline"/>
305
+ <xsl:apply-templates>
306
+ <xsl:with-param name="myspace">
307
+ <xsl:value-of select="$myspace+$myspacemultiplier"/>
308
+ </xsl:with-param>
309
+ </xsl:apply-templates>
310
+ <xsl:call-template name="print-space">
311
+ <xsl:with-param name="i">1</xsl:with-param>
312
+ <xsl:with-param name="count">
313
+ <xsl:value-of select="$myspace+$myspacemultiplier"/>
314
+ </xsl:with-param>
315
+ </xsl:call-template>
316
+ <xsl:text>end</xsl:text>
317
+ <xsl:call-template name="print-newline"/>
318
+ </xsl:if>
319
+ </xsl:template>
320
+ <xsl:template match="d:parallel_branch">
321
+ <xsl:param name="myspace"/>
322
+ <xsl:call-template name="print-space">
323
+ <xsl:with-param name="i">1</xsl:with-param>
324
+ <xsl:with-param name="count">
325
+ <xsl:value-of select="$myspace+$myspacemultiplier"/>
326
+ </xsl:with-param>
327
+ </xsl:call-template>
328
+ <xsl:text>parallel_branch</xsl:text>
329
+ <xsl:if test="@pass">
330
+ <xsl:text> </xsl:text>
331
+ <xsl:value-of select="@pass"/>
332
+ </xsl:if>
333
+ <xsl:text> do</xsl:text>
334
+ <xsl:if test="@local">
335
+ <xsl:text> |</xsl:text>
336
+ <xsl:value-of select="@local"/>
337
+ <xsl:text>|</xsl:text>
338
+ </xsl:if>
339
+ <xsl:call-template name="print-newline"/>
340
+ <xsl:apply-templates>
341
+ <xsl:with-param name="myspace">
342
+ <xsl:value-of select="$myspace+$myspacemultiplier"/>
343
+ </xsl:with-param>
344
+ </xsl:apply-templates>
345
+ <xsl:call-template name="print-space">
346
+ <xsl:with-param name="i">1</xsl:with-param>
347
+ <xsl:with-param name="count">
348
+ <xsl:value-of select="$myspace+$myspacemultiplier"/>
349
+ </xsl:with-param>
350
+ </xsl:call-template>
351
+ <xsl:text>end</xsl:text>
352
+ <xsl:call-template name="print-newline"/>
353
+ </xsl:template>
354
+ <xsl:template match="d:parameters">
355
+ <xsl:apply-templates select="d:label" mode="parameter"/>
356
+ <xsl:apply-templates select="d:*[not(name()='label')]" mode="parameter"/>
357
+ </xsl:template>
358
+ <xsl:template match="d:label" mode="parameter">
359
+ <xsl:text>:</xsl:text>
360
+ <xsl:value-of select="name()"/>
361
+ <xsl:text> =&gt; "</xsl:text>
362
+ <xsl:value-of select="str:replace(str:replace(text(),'\','\\'),'&quot;','\&quot;')"/>
363
+ <xsl:text>"</xsl:text>
364
+ </xsl:template>
365
+ <xsl:template match="d:*[not(name()='label')]" mode="parameter">
366
+ <xsl:if test="count(preceding-sibling::*) &gt; 0">, </xsl:if>
367
+ <xsl:text>:</xsl:text>
368
+ <xsl:value-of select="name()"/>
369
+ <xsl:text> =&gt; </xsl:text>
370
+
371
+ <xsl:choose>
372
+ <xsl:when test="count(*) &gt; 0 and name()='arguments'">
373
+ <xsl:text>[</xsl:text>
374
+ <xsl:apply-templates select="d:*" mode="sub"/>
375
+ <xsl:text>]</xsl:text>
376
+ </xsl:when>
377
+ <xsl:when test="count(*) &gt; 0 and name()='sensors'">
378
+ <xsl:text>[</xsl:text>
379
+ <xsl:apply-templates select="d:*" mode="plainmulti"/>
380
+ <xsl:text>]</xsl:text>
381
+ </xsl:when>
382
+ <xsl:when test="count(*) &gt; 0 and name()='aggregators'">
383
+ <xsl:text>[</xsl:text>
384
+ <xsl:apply-templates select="d:*" mode="plainmulti"/>
385
+ <xsl:text>]</xsl:text>
386
+ </xsl:when>
387
+ <xsl:when test="count(*) &gt; 0 and name()='costs'">
388
+ <xsl:text>[</xsl:text>
389
+ <xsl:apply-templates select="d:*" mode="plainmulti"/>
390
+ <xsl:text>]</xsl:text>
391
+ </xsl:when>
392
+ <xsl:when test="count(*) &gt; 0 and name()='report'">
393
+ <xsl:apply-templates select="d:*" mode="plainmulti"/>
394
+ </xsl:when>
395
+ <xsl:when test="count(*) &gt; 0 and not(name()='arguments')">
396
+ <xsl:text>{</xsl:text>
397
+ <xsl:apply-templates select="d:*" mode="parameter"/>
398
+ <xsl:text>}</xsl:text>
399
+ </xsl:when>
400
+ <xsl:when test="not(node())">
401
+ <xsl:text>nil</xsl:text>
402
+ </xsl:when>
403
+ <xsl:otherwise>
404
+ <xsl:value-of select="text()"/>
405
+ </xsl:otherwise>
406
+ </xsl:choose>
407
+ </xsl:template>
408
+ <xsl:template match="d:*" mode="plain">
409
+ <xsl:if test="count(preceding-sibling::*) &gt; 0">, </xsl:if>
410
+ <xsl:text>:</xsl:text>
411
+ <xsl:value-of select="name()"/>
412
+ <xsl:text> =&gt; </xsl:text>
413
+ <xsl:choose>
414
+ <xsl:when test="count(*) &gt; 0 and count(*) = count(*[name()=name(../*[1])])">
415
+ <xsl:text>[</xsl:text>
416
+ <xsl:apply-templates select="d:*" mode="plainmulti"/>
417
+ <xsl:text>]</xsl:text>
418
+ </xsl:when>
419
+ <xsl:when test="count(*) &gt; 0">
420
+ <xsl:text>{</xsl:text>
421
+ <xsl:apply-templates select="d:*" mode="plain"/>
422
+ <xsl:text>}</xsl:text>
423
+ </xsl:when>
424
+ <xsl:when test="not(node())">
425
+ <xsl:text>nil</xsl:text>
426
+ </xsl:when>
427
+ <xsl:otherwise>
428
+ <xsl:choose>
429
+ <xsl:when test="substring(text(),1,1) = '!'">
430
+ <xsl:value-of select="substring(text(),2)"/>
431
+ </xsl:when>
432
+ <xsl:otherwise>
433
+ <xsl:text>"</xsl:text>
434
+ <xsl:value-of select="str:replace(str:replace(text(),'\','\\'),'&quot;','\&quot;')"/>
435
+ <xsl:text>"</xsl:text>
436
+ </xsl:otherwise>
437
+ </xsl:choose>
438
+ </xsl:otherwise>
439
+ </xsl:choose>
440
+ </xsl:template>
441
+ <xsl:template match="d:*" mode="plainmulti">
442
+ <xsl:if test="count(preceding-sibling::*) &gt; 0">, </xsl:if>
443
+ <xsl:text>{ </xsl:text>
444
+ <xsl:text>:</xsl:text>
445
+ <xsl:value-of select="name()"/>
446
+ <xsl:text> =&gt; </xsl:text>
447
+ <xsl:choose>
448
+ <xsl:when test="count(*) &gt; 0">
449
+ <xsl:text>{</xsl:text>
450
+ <xsl:apply-templates select="d:*" mode="plain"/>
451
+ <xsl:text>}</xsl:text>
452
+ </xsl:when>
453
+ <xsl:when test="not(node())">
454
+ <xsl:text>nil</xsl:text>
455
+ </xsl:when>
456
+ <xsl:otherwise>
457
+ <xsl:choose>
458
+ <xsl:when test="substring(text(),1,1) = '!'">
459
+ <xsl:value-of select="substring(text(),2)"/>
460
+ </xsl:when>
461
+ <xsl:otherwise>
462
+ <xsl:text>"</xsl:text>
463
+ <xsl:value-of select="str:replace(str:replace(text(),'\','\\'),'&quot;','\&quot;')"/>
464
+ <xsl:text>"</xsl:text>
465
+ </xsl:otherwise>
466
+ </xsl:choose>
467
+ </xsl:otherwise>
468
+ </xsl:choose>
469
+ <xsl:text> }</xsl:text>
470
+ </xsl:template>
471
+ <xsl:template name="format-name">
472
+ <xsl:param name="tname"/>
473
+ <xsl:choose>
474
+ <xsl:when test="contains($tname,'-')">
475
+ <xsl:text>'</xsl:text>
476
+ <xsl:value-of select="$tname"/>
477
+ <xsl:text>'</xsl:text>
478
+ </xsl:when>
479
+ <xsl:otherwise>
480
+ <xsl:value-of select="$tname"/>
481
+ </xsl:otherwise>
482
+ </xsl:choose>
483
+ </xsl:template>
484
+ <xsl:template match="d:*" mode="sub">
485
+ <xsl:if test="count(preceding-sibling::*) &gt; 0">, </xsl:if>
486
+ <xsl:text>⭐(</xsl:text>
487
+ <xsl:text>:name =&gt; :</xsl:text>
488
+ <xsl:choose>
489
+ <xsl:when test="substring(name(),1,1) = '_'">
490
+ <xsl:call-template name="format-name">
491
+ <xsl:with-param name="tname">
492
+ <xsl:value-of select="substring(name(),2)"/>
493
+ </xsl:with-param>
494
+ </xsl:call-template>
495
+ </xsl:when>
496
+ <xsl:otherwise>
497
+ <xsl:call-template name="format-name">
498
+ <xsl:with-param name="tname">
499
+ <xsl:value-of select="name()"/>
500
+ </xsl:with-param>
501
+ </xsl:call-template>
502
+ </xsl:otherwise>
503
+ </xsl:choose>
504
+ <xsl:text>, :value =&gt; -&gt;{ </xsl:text>
505
+ <xsl:choose>
506
+ <xsl:when test="not(node())">
507
+ <xsl:text>nil</xsl:text>
508
+ </xsl:when>
509
+ <xsl:when test="child::node()[not(self::text())]">
510
+ <!-- FUUUU, there is probably much more TODO. Updated Matthias und Juergen, we tested for ing-opcua/execute -->
511
+ <xsl:choose>
512
+ <xsl:when test="child::* and name(child::*)=concat(name(.),'_item') and count(child::*[not(name()=name(../child::*[1]))])=0">
513
+ <xsl:text>"[ </xsl:text>
514
+ <xsl:apply-templates select="*" mode="JSONArrayItem"/>
515
+ <xsl:text>]"</xsl:text>
516
+ </xsl:when>
517
+ <xsl:otherwise>
518
+ <xsl:text>"{ </xsl:text>
519
+ <xsl:apply-templates select="*" mode="JSONSUB"/>
520
+ <xsl:text>}"</xsl:text>
521
+ </xsl:otherwise>
522
+ </xsl:choose>
523
+ </xsl:when>
524
+ <xsl:otherwise>
525
+ <xsl:choose>
526
+ <xsl:when test="substring(text(),1,1) = '!'">
527
+ <xsl:value-of select="substring(text(),2)"/>
528
+ </xsl:when>
529
+ <xsl:otherwise>
530
+ <xsl:text>"</xsl:text>
531
+ <xsl:value-of select="str:replace(str:replace(text(),'\','\\'),'&quot;','\&quot;')"/>
532
+ <xsl:text>"</xsl:text>
533
+ </xsl:otherwise>
534
+ </xsl:choose>
535
+ </xsl:otherwise>
536
+ </xsl:choose>
537
+ <xsl:text> }</xsl:text>
538
+ <xsl:for-each select="@*">
539
+ <xsl:text>, :</xsl:text>
540
+ <xsl:value-of select="name()"/>
541
+ <xsl:text> =&gt; "</xsl:text>
542
+ <xsl:value-of select="string(.)"/>
543
+ <xsl:text>"</xsl:text>
544
+ </xsl:for-each>
545
+ <xsl:text>)</xsl:text>
546
+ </xsl:template>
547
+
548
+ <xsl:template match="d:finalize | d:update | d:prepare | d:rescue" mode="part-of-call">
549
+ <xsl:param name="myspace"/>
550
+ <xsl:call-template name="print-content">
551
+ <xsl:with-param name="myspace">
552
+ <xsl:value-of select="$myspace"/>
553
+ </xsl:with-param>
554
+ </xsl:call-template>
555
+ </xsl:template>
556
+ <xsl:template name="print-content">
557
+ <xsl:param name="myspace"/>
558
+ <xsl:if test="text()">
559
+ <xsl:for-each select="str:tokenize(text(), '&#x0A;')">
560
+ <xsl:value-of select="concat('&#x0A;',concat(str:padding($myspace+$myspacemultiplier+$myspacemultiplier),str:replace(str:replace(str:replace(string(.),'\','\\'),'&quot;','\&quot;'),'#','\#')))" />
561
+ </xsl:for-each>
562
+ <xsl:call-template name="print-newline"/>
563
+ <xsl:call-template name="print-space">
564
+ <xsl:with-param name="i">1</xsl:with-param>
565
+ <xsl:with-param name="count">
566
+ <xsl:value-of select="$myspace+$myspacemultiplier"/>
567
+ </xsl:with-param>
568
+ </xsl:call-template>
569
+ <xsl:text>END</xsl:text>
570
+ </xsl:if>
571
+ </xsl:template>
572
+ <xsl:template name="print-mcontent">
573
+ <xsl:param name="myspace"/>
574
+ <xsl:if test="text()">
575
+ <xsl:choose>
576
+ <xsl:when test="@language='application/x-ruby'">
577
+ <xsl:text> do </xsl:text>
578
+ <xsl:if test="@output">
579
+ <xsl:text>|</xsl:text>
580
+ <xsl:value-of select="@output"/>
581
+ <xsl:text>|</xsl:text>
582
+ </xsl:if>
583
+ </xsl:when>
584
+ <xsl:otherwise>
585
+ <xsl:text>, &lt;&lt;-END</xsl:text>
586
+ </xsl:otherwise>
587
+ </xsl:choose>
588
+ <xsl:for-each select="str:tokenize(text(), '&#x0A;')">
589
+ <xsl:value-of select="concat('&#x0A;',concat(str:padding($myspace+$myspacemultiplier+$myspacemultiplier),str:replace(str:replace(str:replace(string(.),'\','\\'),'&quot;','\&quot;'),'#','\#')))" />
590
+ </xsl:for-each>
591
+ <xsl:call-template name="print-newline"/>
592
+ <xsl:call-template name="print-space">
593
+ <xsl:with-param name="i">1</xsl:with-param>
594
+ <xsl:with-param name="count">
595
+ <xsl:value-of select="$myspace+$myspacemultiplier"/>
596
+ </xsl:with-param>
597
+ </xsl:call-template>
598
+ <xsl:choose>
599
+ <xsl:when test="@language='application/x-ruby'">
600
+ <xsl:text>end</xsl:text>
601
+ </xsl:when>
602
+ <xsl:otherwise>
603
+ <xsl:text>END</xsl:text>
604
+ </xsl:otherwise>
605
+ </xsl:choose>
606
+ </xsl:if>
607
+ </xsl:template>
608
+ <xsl:template name="print-space">
609
+ <xsl:param name="i"/>
610
+ <xsl:param name="count"/>
611
+ <xsl:if test="$i &lt;= $count">
612
+ <xsl:text> </xsl:text>
613
+ <xsl:call-template name="print-space">
614
+ <xsl:with-param name="i">
615
+ <xsl:value-of select="$i + 1"/>
616
+ </xsl:with-param>
617
+ <xsl:with-param name="count">
618
+ <xsl:value-of select="$count"/>
619
+ </xsl:with-param>
620
+ </xsl:call-template>
621
+ </xsl:if>
622
+ </xsl:template>
623
+ <xsl:template name="print-newline">
624
+ <xsl:text>
625
+ </xsl:text>
626
+ </xsl:template>
627
+
628
+ <!-- JSON Element -->
629
+ <xsl:template match="*" mode="JSON">
630
+ <xsl:call-template name="JSONProperties"/>
631
+ <xsl:choose>
632
+ <xsl:when test="following-sibling::*">, </xsl:when>
633
+ <xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>
634
+ </xsl:choose>
635
+ </xsl:template>
636
+
637
+ <xsl:template match="*" mode="JSONSUB">
638
+ <xsl:text>\"</xsl:text>
639
+ <xsl:value-of select="name()"/>
640
+ <xsl:text>\": </xsl:text>
641
+ <xsl:call-template name="JSONProperties">
642
+ <xsl:with-param name="parent" select="'Yes'"></xsl:with-param>
643
+ </xsl:call-template>
644
+ <xsl:choose>
645
+ <xsl:when test="following-sibling::*">, </xsl:when>
646
+ <xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>
647
+ </xsl:choose>
648
+ </xsl:template>
649
+
650
+ <!-- JSON Array Element -->
651
+ <xsl:template match="*" mode="JSONArrayElement">
652
+ <xsl:call-template name="JSONProperties"/>
653
+ <xsl:choose>
654
+ <xsl:when test="following-sibling::*">, </xsl:when>
655
+ <xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>
656
+ </xsl:choose>
657
+ </xsl:template>
658
+ <xsl:template match="*" mode="JSONArrayItem">
659
+ <xsl:call-template name="JSONProperties">
660
+ <xsl:with-param name="parent" select="'Yes'"></xsl:with-param>
661
+ </xsl:call-template>
662
+ <xsl:choose>
663
+ <xsl:when test="following-sibling::*">, </xsl:when>
664
+ <xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>
665
+ </xsl:choose>
666
+ </xsl:template>
667
+
668
+ <!-- JSON Object Properties -->
669
+ <xsl:template name="JSONProperties">
670
+ <xsl:param name="parent"></xsl:param>
671
+ <xsl:variable name="childName" select="name(*[1])"/>
672
+ <xsl:choose>
673
+ <xsl:when test="not(*|@*)">
674
+ <xsl:choose>
675
+ <xsl:when test="$parent='Yes'">
676
+ <xsl:choose>
677
+ <xsl:when test="string(number(.)) = .">
678
+ <xsl:value-of select="."/>
679
+ </xsl:when>
680
+ <xsl:otherwise>
681
+ <xsl:choose>
682
+ <xsl:when test="substring(.,1,1) = '!'">
683
+ <xsl:text>#{</xsl:text>
684
+ <xsl:value-of select="str:replace(str:replace(substring(.,2),'\','\\'),'&quot;','\\\&quot;')"/>
685
+ <xsl:text>.to_json}</xsl:text>
686
+ </xsl:when>
687
+ <xsl:otherwise>
688
+ <xsl:text>\"</xsl:text>
689
+ <xsl:value-of select="str:replace(str:replace(.,'\','\\'),'&quot;','\\\&quot;')"/>
690
+ <xsl:text>\"</xsl:text>
691
+ </xsl:otherwise>
692
+ </xsl:choose>
693
+ </xsl:otherwise>
694
+ </xsl:choose>
695
+ </xsl:when>
696
+ <xsl:otherwise>
697
+ <xsl:text>\"</xsl:text>
698
+ <xsl:value-of select="name()"/>
699
+ <xsl:text>\": </xsl:text>
700
+ <xsl:choose>
701
+ <xsl:when test="string(number(.)) = .">
702
+ <xsl:value-of select="."/>
703
+ </xsl:when>
704
+ <xsl:otherwise>
705
+ <xsl:text>\"</xsl:text>
706
+ <xsl:choose>
707
+ <xsl:when test="substring(.,1,1) = '!'">
708
+ <xsl:text>#{</xsl:text>
709
+ <xsl:value-of select="str:replace(str:replace(substring(.,2),'\','\\'),'&quot;','\\\&quot;')"/>
710
+ <xsl:text>}</xsl:text>
711
+ </xsl:when>
712
+ <xsl:otherwise>
713
+ <xsl:value-of select="str:replace(str:replace(.,'\','\\'),'&quot;','\\\&quot;')"/>
714
+ </xsl:otherwise>
715
+ </xsl:choose>
716
+ <xsl:text>\"</xsl:text>
717
+ </xsl:otherwise>
718
+ </xsl:choose>
719
+ </xsl:otherwise>
720
+ </xsl:choose>
721
+ </xsl:when>
722
+ <xsl:when test="count(*[name()=$childName]) > 1">
723
+ <xsl:text>{ \"</xsl:text>
724
+ <xsl:value-of select="$childName"/>
725
+ <xsl:text>\": [ </xsl:text>
726
+ <xsl:apply-templates select="*" mode="JSONArrayElement"/>
727
+ <xsl:text>] }</xsl:text>
728
+ </xsl:when>
729
+ <xsl:otherwise>
730
+ <xsl:if test="text()[normalize-space(.)]">
731
+ <xsl:text>[ </xsl:text>
732
+ </xsl:if>
733
+ <xsl:text>{ </xsl:text>
734
+ <xsl:apply-templates select="@*" mode="JSONSUB"/>
735
+ <xsl:apply-templates select="*" mode="JSONSUB"/>
736
+ <xsl:text>}</xsl:text>
737
+ <xsl:if test="text()[normalize-space(.)]">
738
+ <xsl:text>, </xsl:text>
739
+ <xsl:text>\"</xsl:text>
740
+ <xsl:choose>
741
+ <xsl:when test="substring(.,1,1) = '!'">
742
+ <xsl:text>#{</xsl:text>
743
+ <xsl:value-of select="str:replace(str:replace(substring(.,2),'\','\\'),'&quot;','\\\&quot;')"/>
744
+ <xsl:text>}</xsl:text>
745
+ </xsl:when>
746
+ <xsl:otherwise>
747
+ <xsl:value-of select="str:replace(str:replace(.,'\','\\'),'&quot;','\\\&quot;')"/>
748
+ </xsl:otherwise>
749
+ </xsl:choose>
750
+ <xsl:text>\"</xsl:text>
751
+ <xsl:text>]</xsl:text>
752
+ </xsl:if>
753
+ </xsl:otherwise>
754
+ </xsl:choose>
755
+ </xsl:template>
756
+
757
+ <!-- JSON Attribute Property -->
758
+ <xsl:template match="@*" mode="JSONSUB">
759
+ <xsl:text>\"@</xsl:text>
760
+ <xsl:value-of select="name()"/>
761
+ <xsl:text>\": </xsl:text>
762
+ <xsl:choose>
763
+ <xsl:when test="number(.) = .">
764
+ <xsl:value-of select="."/>
765
+ </xsl:when>
766
+ <xsl:otherwise>
767
+ <xsl:text>\"</xsl:text>
768
+ <xsl:choose>
769
+ <xsl:when test="substring(.,1,1) = '!'">
770
+ <xsl:text>#{</xsl:text>
771
+ <xsl:value-of select="str:replace(str:replace(substring(.,2),'\','\\'),'&quot;','\\\&quot;')"/>
772
+ <xsl:text>}</xsl:text>
773
+ </xsl:when>
774
+ <xsl:otherwise>
775
+ <xsl:value-of select="str:replace(str:replace(.,'\','\\'),'&quot;','\\\&quot;')"/>
776
+ </xsl:otherwise>
777
+ </xsl:choose>
778
+ <xsl:text>\"</xsl:text>
779
+ </xsl:otherwise>
780
+ </xsl:choose>
781
+ <xsl:choose>
782
+ <xsl:when test="not(position() = last())">
783
+ <xsl:text>, </xsl:text>
784
+ </xsl:when>
785
+ <xsl:otherwise>
786
+ <xsl:text> </xsl:text>
787
+ </xsl:otherwise>
788
+ </xsl:choose>
789
+ </xsl:template>
790
+ </xsl:stylesheet>