cpee 2.0.21 → 2.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/cockpit/CPEE.xml +8 -0
  3. data/cockpit/Signavio.xml +8 -0
  4. data/cockpit/css/model.css +2 -0
  5. data/cockpit/css/replay.css +55 -0
  6. data/cockpit/css/ui.css +29 -5
  7. data/cockpit/edit.html +263 -0
  8. data/cockpit/graph.html +3 -3
  9. data/cockpit/index.html +11 -8
  10. data/cockpit/js/details.js +0 -1
  11. data/cockpit/js/edit.js +32 -0
  12. data/cockpit/js/instance.js +52 -52
  13. data/cockpit/js/model.js +6 -36
  14. data/cockpit/js/parameters.js +9 -4
  15. data/cockpit/js/replay.js +40 -0
  16. data/cockpit/js/ui.js +7 -0
  17. data/cockpit/model.html +8 -4
  18. data/cockpit/replay.html +53 -0
  19. data/cockpit/templates/Coopis 2010.xml +1 -1
  20. data/cockpit/templates/IUPC arXiv:1104.3609 P34 1.xml +1 -1
  21. data/cockpit/templates/IUPC arXiv:1104.3609 P34 2.xml +1 -1
  22. data/cockpit/templates/IUPC arXiv:1104.3609 P34 3.xml +1 -1
  23. data/cockpit/templates/Track Test Local.xml +6 -2
  24. data/cockpit/templates/Track Test.xml +5 -1
  25. data/cockpit/templates/UR-VUE 2020 Manual Adjust.xml +5 -1
  26. data/cockpit/templates/UR-VUE 2020 Solution Baseline.xml +8 -4
  27. data/cockpit/templates/UR-VUE 2020 Solution NN.xml +8 -4
  28. data/cockpit/templates/UR-VUE 2020 Solution View.xml +8 -4
  29. data/cockpit/templates/UR-VUE 2020.xml +8 -4
  30. data/cockpit/templates/instantiate.local/Take_Sub.xml +1 -1
  31. data/cockpit/themes/compact/rngs/call.rng +93 -41
  32. data/cockpit/themes/compact/rngs/callmanipulate.rng +113 -40
  33. data/cockpit/themes/compact/theme.js +57 -25
  34. data/cockpit/themes/{diana → control}/rngs/alternative.rng +0 -0
  35. data/cockpit/themes/control/rngs/call.rng +174 -0
  36. data/cockpit/themes/control/rngs/callmanipulate.rng +218 -0
  37. data/cockpit/themes/{diana → control}/rngs/choose.rng +0 -0
  38. data/cockpit/themes/{diana → control}/rngs/closed_loop.rng +0 -0
  39. data/cockpit/themes/{diana → control}/rngs/closed_loop_cancel.rng +0 -0
  40. data/cockpit/themes/{diana → control}/rngs/closed_loop_control.rng +0 -0
  41. data/cockpit/themes/{diana → control}/rngs/closed_loop_measuring.rng +0 -0
  42. data/cockpit/themes/{diana → control}/rngs/critical.rng +0 -0
  43. data/cockpit/themes/{diana → control}/rngs/escape.rng +0 -0
  44. data/cockpit/themes/{diana → control}/rngs/group.rng +0 -0
  45. data/cockpit/themes/{diana → control}/rngs/loop.rng +0 -0
  46. data/cockpit/themes/{diana → control}/rngs/manipulate.rng +0 -0
  47. data/cockpit/themes/{diana → control}/rngs/otherwise.rng +0 -0
  48. data/cockpit/themes/{diana → control}/rngs/parallel.rng +0 -0
  49. data/cockpit/themes/{diana → control}/rngs/parallel_branch.rng +0 -0
  50. data/cockpit/themes/{diana → control}/rngs/scripts.rng +0 -0
  51. data/cockpit/themes/{diana → control}/rngs/stop.rng +0 -0
  52. data/cockpit/themes/{diana → control}/rngs/terminate.rng +0 -0
  53. data/cockpit/themes/{diana → control}/symbols/alternative.svg +0 -0
  54. data/cockpit/themes/{diana → control}/symbols/arrow.svg +0 -0
  55. data/cockpit/themes/{diana → control}/symbols/call.svg +0 -0
  56. data/cockpit/themes/{diana → control}/symbols/callmanipulate.svg +0 -0
  57. data/cockpit/themes/{diana → control}/symbols/choose.svg +0 -0
  58. data/cockpit/themes/{diana → control}/symbols/choose_exclusive.svg +0 -0
  59. data/cockpit/themes/{diana → control}/symbols/choose_inclusive.svg +0 -0
  60. data/cockpit/themes/{diana → control}/symbols/closed_loop.svg +0 -0
  61. data/cockpit/themes/{diana → control}/symbols/closed_loop_cancel.svg +0 -0
  62. data/cockpit/themes/{diana → control}/symbols/closed_loop_control.svg +0 -0
  63. data/cockpit/themes/{diana → control}/symbols/closed_loop_measuring.svg +0 -0
  64. data/cockpit/themes/{diana → control}/symbols/complex.svg +0 -0
  65. data/cockpit/themes/{diana → control}/symbols/critical.svg +0 -0
  66. data/cockpit/themes/{diana → control}/symbols/end.svg +0 -0
  67. data/cockpit/themes/{diana → control}/symbols/escape.svg +0 -0
  68. data/cockpit/themes/{diana → control}/symbols/event_end.svg +0 -0
  69. data/cockpit/themes/{diana → control}/symbols/loop.svg +0 -0
  70. data/cockpit/themes/{diana → control}/symbols/manipulate.svg +0 -0
  71. data/cockpit/themes/{diana → control}/symbols/otherwise.svg +0 -0
  72. data/cockpit/themes/{diana → control}/symbols/parallel.svg +0 -0
  73. data/cockpit/themes/{diana → control}/symbols/parallel_branch.svg +0 -0
  74. data/cockpit/themes/{diana → control}/symbols/parallel_branch_compact.svg +0 -0
  75. data/cockpit/themes/{diana → control}/symbols/parallel_branch_event.svg +0 -0
  76. data/cockpit/themes/{diana → control}/symbols/parallel_branch_normal.svg +0 -0
  77. data/cockpit/themes/{diana → control}/symbols/scripts.svg +0 -0
  78. data/cockpit/themes/{diana → control}/symbols/start.svg +0 -0
  79. data/cockpit/themes/{diana → control}/symbols/stop.svg +0 -0
  80. data/cockpit/themes/{diana → control}/symbols/terminate.svg +0 -0
  81. data/cockpit/themes/{diana → control}/theme.js +74 -28
  82. data/cockpit/themes/default/rngs/call.rng +93 -41
  83. data/cockpit/themes/default/rngs/callmanipulate.rng +113 -40
  84. data/cockpit/themes/default/theme.js +1318 -0
  85. data/cockpit/themes/extended/rngs/call.rng +93 -41
  86. data/cockpit/themes/extended/rngs/callmanipulate.rng +113 -40
  87. data/cockpit/themes/extended/theme.js +50 -19
  88. data/cockpit/themes/model/rngs/call.rng +21 -20
  89. data/cockpit/themes/model/rngs/callmanipulate.rng +23 -22
  90. data/cockpit/themes/model/theme.js +51 -20
  91. data/cockpit/themes/packed/rngs/call.rng +93 -41
  92. data/cockpit/themes/packed/rngs/callmanipulate.rng +113 -40
  93. data/cockpit/themes/packed/theme.js +50 -19
  94. data/cockpit/themes/preset/rngs/call.rng +93 -41
  95. data/cockpit/themes/preset/rngs/callmanipulate.rng +113 -40
  96. data/cockpit/themes/preset/theme.js +49 -18
  97. data/cockpit/track.html +3 -10
  98. data/cockpit/transformations.xml +4 -0
  99. data/cpee.gemspec +2 -2
  100. data/lib/callbacks.xml +5 -0
  101. data/lib/cpee/controller.rb +30 -28
  102. data/lib/cpee/implementation_callbacks.rb +60 -0
  103. data/lib/cpee/implementation_notifications.rb +6 -2
  104. data/server/handlerwrappers/default.rb +17 -5
  105. data/server/resources/notifications/logging/subscription.xml +6 -0
  106. data/server/resources/transformation_dslx.xsl +1 -1
  107. data/server/routing/end.pid +1 -0
  108. data/server/routing/end.rb +1 -0
  109. data/server/routing/forward-events.pid +1 -0
  110. data/server/routing/forward-votes.pid +1 -0
  111. data/server/routing/forward-votes.rb +6 -5
  112. data/server/routing/persist.pid +1 -0
  113. data/server/routing/persist.rb +4 -4
  114. data/server/server.pid +1 -0
  115. metadata +63 -50
  116. data/cockpit/edit.html +0 -1
  117. data/cockpit/themes/diana/rngs/call.rng +0 -122
  118. data/cockpit/themes/diana/rngs/callmanipulate.rng +0 -145
@@ -49,6 +49,16 @@ function WFAdaptorManifestation(adaptor) {
49
49
  });
50
50
  return svgid;
51
51
  }; //}}}
52
+ //{{{ Return the json for all marked tasks
53
+ this.marked_text = function(){
54
+ var nodes = [];
55
+ var markymark = _.uniq(self.marked());
56
+ $(markymark).each(function(key,svgid){
57
+ var node = self.adaptor.description.get_node_by_svg_id(svgid);
58
+ nodes.push($(node).serializePrettyXML());
59
+ });
60
+ return JSON.stringify(nodes);
61
+ }; //}}}
52
62
  //{{{ Render the details from rng (right hand side of graph tab)
53
63
  this.update_details = function(svgid){
54
64
  var tab = $('#dat_details');
@@ -76,35 +86,46 @@ function WFAdaptorManifestation(adaptor) {
76
86
  }; //}}}
77
87
 
78
88
  function copyOrMove(menu,group,xml_node,mode) { //{{{
79
- var markymark = _.uniq(self.marked());
89
+ var nodes = localStorage.getItem('marked');
90
+
91
+ if (typeof(nodes) != "string") { return; }
92
+
93
+ nodes = JSON.parse(nodes);
94
+ $(nodes).each(function(key,str) {
95
+ nodes[key] = $X(str);;
96
+ });
97
+
80
98
  var check1 = [];
81
99
  var check2 = [];
82
- $(markymark).each(function(key,svgid){
83
- var node = self.adaptor.description.get_node_by_svg_id(svgid);
100
+ $(nodes).each(function(key,node){
84
101
  check1.push($(node).attr('svg-type'));
85
102
  });
86
103
  $(group).each(function(key,value){
87
104
  check2.push(value.type);
88
105
  });
89
106
 
90
- if (markymark.length > 0 && _.uniq(check1).length == _.intersection(check1,check2).length) {
91
- var nodes = [];
92
- $(markymark).each(function(key,svgid){
93
- var node = self.adaptor.description.get_node_by_svg_id(svgid);
94
- nodes.unshift(node);
95
- });
96
-
107
+ if (nodes.length > 0 && _.uniq(check1).length == _.intersection(check1,check2).length) {
108
+ if (myid == localStorage.getItem('marked_from')) {
109
+ $(nodes).each(function(key,node){
110
+ nodes[key] = self.adaptor.description.get_node_by_svg_id($(node).attr('svg-id'));
111
+ });
112
+ }
113
+ nodes.reverse();
97
114
  var iconm = self.resources['arrow'].clone();
98
115
  var iconc = self.resources['arrow'].clone();
99
116
  iconm.children('.rfill').addClass('menu');
117
+ if (myid == localStorage.getItem('marked_from')) {
118
+ menu.push(
119
+ {
120
+ 'label': '<em>Move Marked Elements</em>',
121
+ 'function_call': mode,
122
+ 'menu_icon': iconm,
123
+ 'type': undefined,
124
+ 'params': [nodes, xml_node]
125
+ }
126
+ );
127
+ }
100
128
  menu.push(
101
- {
102
- 'label': '<em>Move Marked Elements</em>',
103
- 'function_call': mode,
104
- 'menu_icon': iconm,
105
- 'type': undefined,
106
- 'params': [nodes, xml_node]
107
- },
108
129
  {
109
130
  'label': '<em>Copy Marked Elements</em>',
110
131
  'function_call': mode,
@@ -223,10 +244,20 @@ function WFAdaptorManifestation(adaptor) {
223
244
  tab.empty();
224
245
  var vtarget = self.adaptor.illustrator.get_node_by_svg_id(svgid);
225
246
  if (vtarget.length > 0) {
226
- vtarget.parents('g.element[element-id]').toggleClass('marked');
247
+ var vt = vtarget.parents('g.element[element-id]');
248
+ vt.toggleClass('marked');
249
+ if (vt.hasClass('marked')) {
250
+ localStorage.setItem('marked',self.marked_text());
251
+ localStorage.setItem('marked_from',myid);
252
+ } else {
253
+ localStorage.removeItem('marked');
254
+ localStorage.removeItem('marked_from');
255
+ }
227
256
  }
228
257
  } else {
229
258
  self.adaptor.illustrator.get_elements().removeClass('marked');
259
+ localStorage.removeItem('marked');
260
+ localStorage.removeItem('marked_from');
230
261
 
231
262
  var vtarget = self.adaptor.illustrator.get_node_by_svg_id(svgid);
232
263
  if (vtarget.length > 0) {
data/cockpit/track.html CHANGED
@@ -37,11 +37,11 @@
37
37
 
38
38
  <script type="text/javascript" src="/js_libs/relaxngui.js"></script>
39
39
 
40
- <script type="text/javascript" src="/js_libs/ui.js"></script>
40
+ <script type="text/javascript" src="/js_libs/uidash.js"></script>
41
41
  <script type="text/javascript" src="/js_libs/custommenu.js"></script>
42
42
 
43
43
  <link rel="stylesheet" href="/js_libs/custommenu.css" type="text/css"/>
44
- <link rel="stylesheet" href="/js_libs/ui.css" type="text/css"/>
44
+ <link rel="stylesheet" href="/js_libs/uidash.css" type="text/css"/>
45
45
 
46
46
  <link rel="stylesheet" href="/js_libs/relaxngui.css" type="text/css"/>
47
47
 
@@ -58,7 +58,7 @@
58
58
  <link rel="stylesheet" href="css/ui.css" type="text/css"/>
59
59
  <link rel="stylesheet" href="css/track.css" type="text/css"/>
60
60
  </head>
61
- <body data-base-port="8298" data-res-port="9303" data-theme-base="themes" is="x-ui">
61
+ <body data-base-port="8298" data-res-port="9303" data-theme-base="themes" is="x-ui-">
62
62
  <div class='hidden' id='relaxngworker'></div>
63
63
  <div id="trackfull">
64
64
  <div id='graphcolumn'>
@@ -111,13 +111,6 @@
111
111
  </svg>
112
112
  </button>
113
113
  <span id="state_extended">
114
- <button name="state_replay" title='replay'>
115
- <svg viewBox="0 -1.5 7 12" width="10" height="16">
116
- <path
117
- style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
118
- d="m -0.24999978,8.9999993 c 0,-2.7488167 0,-5.4976332 0,-8.24644997 C 1.1183278,0.76955385 2.4884861,0.71666052 3.8555376,0.79065567 4.5083287,0.83810218 5.2238942,1.0790874 5.5755039,1.7307256 6.1661398,2.7080902 6.0299484,4.2180754 5.1108772,4.9019222 4.7622397,5.1617467 4.3480204,5.2956156 3.9336064,5.3605366 4.9287868,5.9394132 5.4254071,7.0996814 6.0167729,8.0858876 6.1549588,8.3769029 6.4657247,8.7723933 6.5,8.9999999 c -0.5944185,0 -1.1888371,0 -1.7832559,0 C 4.0758679,7.9893475 3.4946311,6.9294648 2.7923497,5.9678488 2.4230355,5.5319748 1.8508715,5.5458842 1.3513114,5.5576027 c -0.1507526,-0.00412 -0.044576,0.272902 -0.076255,0.3990664 0,1.0144436 0,2.028887 0,3.0433307 -0.50835205,-3e-7 -1.01670555,8e-7 -1.52505618,-5e-7 z M 1.2750578,4.2411336 C 2.111059,4.2189781 2.9581852,4.3060525 3.7849326,4.1387394 4.4863715,3.8915585 4.5732952,2.6432813 3.9026802,2.2941453 3.5098807,2.068434 3.050719,2.1857044 2.6267379,2.1489138 c -0.4505578,-0.00242 -0.90112,0.00147 -1.3516801,-3.456e-4 0,0.6975176 0,1.3950347 0,2.0925522 z"
119
- </svg>
120
- </button>
121
114
  <button name="state_abandon" title='abandon'>
122
115
  <svg viewBox="0 -1.5 7 12" width="10" height="16">
123
116
  <path
@@ -0,0 +1,4 @@
1
+ <transformations>
2
+ <transformation>CPEE</transformation>
3
+ <transformation>Signavio</transformation>
4
+ </transformations>
data/cpee.gemspec CHANGED
@@ -1,13 +1,13 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cpee"
3
- s.version = "2.0.21"
3
+ s.version = "2.0.26"
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.org). If you just need workflow execution, without a rest service exposing it, then use WEEL."
7
7
 
8
8
  s.description = "see http://cpee.org"
9
9
 
10
- s.files = Dir['{example/**/*,server/**/*,tools/**/*,tools/archive,lib/**/*,cockpit/**/*,cockpit/themes/*/*/*,contrib/logo*,contrib/Screen*}'] - Dir['{server/instances/**/*,cockpit/js_libs/**/*,server/redis*}'] + %w(COPYING FEATURES.md INSTALL.md Rakefile cpee.gemspec README.md AUTHORS)
10
+ s.files = Dir['{example/**/*,server/**/*,tools/**/*,tools/archive,lib/**/*,cockpit/**/*,cockpit/templates/.templates.xml,cockpit/templates/.transformations.xml,cockpit/templates/.Signavio.xml,cockpit/templates/.CPEE.xml,cockpit/*.html,cockpit/themes/*/*,cockpit/themes/*/*/*,contrib/logo*,contrib/Screen*}'] - Dir['{server/instances/**/*,cockpit/js_libs/**/*,server/redis*}'] + %w(COPYING FEATURES.md INSTALL.md Rakefile cpee.gemspec README.md AUTHORS)
11
11
  s.require_path = 'lib'
12
12
  s.extra_rdoc_files = ['README.md']
13
13
  s.bindir = 'tools'
data/lib/callbacks.xml CHANGED
@@ -20,11 +20,16 @@
20
20
  <xi:include href="callbacks/callbacks.rng"/>
21
21
  </parameter>
22
22
  </message>
23
+ <message name="callback">
24
+ <parameter name="callback" mimetype="application/json"/>
25
+ </message>
23
26
 
24
27
  <resource>
25
28
  <doc:documentation>xb</doc:documentation>
26
29
  <get in="*" out="callbacks"/>
27
30
  <resource>
31
+ <get out="callback"/>
32
+ <delete/>
28
33
  <put in="*"/>
29
34
  </resource>
30
35
  </resource>
@@ -52,6 +52,34 @@ module CPEE
52
52
  @opts = opts
53
53
  @instance = nil
54
54
  @loop_guard = {}
55
+
56
+ @callback_keys = {}
57
+ @psredis = @opts[:redis_dyn].call
58
+
59
+ Thread.new do
60
+ @psredis.psubscribe('callback-response:*','callback-end:*') do |on|
61
+ on.pmessage do |pat, what, message|
62
+ if pat == 'callback-response:*' && @callback_keys.has_key?(what[18..-1])
63
+ index = message.index(' ')
64
+ mess = message[index+1..-1]
65
+ instance = message[0...index]
66
+ m = JSON.parse(mess)
67
+ resp = []
68
+ m['content']['values'].each do |e|
69
+ if e[1][0] == 'simple'
70
+ resp << Riddl::Parameter::Simple.new(e[0],e[1][1])
71
+ elsif e[1][0] == 'complex'
72
+ resp << Riddl::Parameter::Complex.new(e[0],e[1][1],File.open(e[1][2]))
73
+ end
74
+ end
75
+ @callback_keys[what[18..-1]].send(:callback,resp,m['content']['headers'])
76
+ end
77
+ if pat == 'callback-end:*'
78
+ @callback_keys.delete(what[13..-1])
79
+ end
80
+ end
81
+ end
82
+ end
55
83
  end
56
84
 
57
85
  attr_reader :id
@@ -139,7 +167,7 @@ module CPEE
139
167
  @votes += votes
140
168
  psredis = @opts[:redis_dyn].call
141
169
  collect = []
142
- psredis.subscribe(votes.map{|e| ['vote-response:' + e.to_s, 'vote-end:' + e.to_s] }.flatten) do |on|
170
+ psredis.subscribe(votes.map{|e| ['vote-response:' + e.to_s] }.flatten) do |on|
143
171
  on.message do |what, message|
144
172
  index = message.index(' ')
145
173
  mess = message[index+1..-1]
@@ -160,33 +188,7 @@ module CPEE
160
188
 
161
189
  def callback(hw,key,content)
162
190
  CPEE::Message::send(:callback,'activity/content',base,@id,uuid,info,content.merge(:key => key),@redis)
163
-
164
- psredis = @opts[:redis_dyn].call
165
- response = nil
166
- Thread.new do
167
- psredis.subscribe('callback-response:' + key, 'callback-end:' + key) do |on|
168
- on.message do |what, message|
169
- if what == 'callback-response:' + key
170
- index = message.index(' ')
171
- mess = message[index+1..-1]
172
- instance = message[0...index]
173
- m = JSON.parse(mess)
174
- resp = []
175
- m['content']['values'].each do |e|
176
- if e[1][0] == 'simple'
177
- resp << Riddl::Parameter::Simple.new(e[0],e[1][1])
178
- elsif e[1][0] == 'complex'
179
- resp << Riddl::Parameter::Complex.new(e[0],e[1][1],File.open(e[1][2]))
180
- end
181
- end
182
- hw.send(:callback,resp,m['content']['headers'])
183
- end
184
- if what == 'callback-end:' + key
185
- psredis.unsubscribe
186
- end
187
- end
188
- end
189
- end
191
+ @callback_keys[key] = hw
190
192
  end
191
193
 
192
194
  def cancel_callback(key)
@@ -7,6 +7,8 @@ module CPEE
7
7
  Proc.new do
8
8
  run CPEE::Callbacks::Callbacks, id, opts if get
9
9
  on resource do
10
+ run CPEE::Callbacks::GetCallback, id, opts if get
11
+ run CPEE::Callbacks::DelCallback, id, opts if delete
10
12
  run CPEE::Callbacks::ExCallback, id, opts if put
11
13
  end
12
14
  end
@@ -26,6 +28,64 @@ module CPEE
26
28
  ret.to_s
27
29
  end
28
30
  end
31
+ end # }}}
32
+
33
+ class GetCallback < Riddl::Implementation #{{{
34
+ def response
35
+ id = @a[0]
36
+ opts = @a[1]
37
+ callback = @r[-1]
38
+
39
+ if opts[:redis].sismember("instance:#{id}/callbacks",callback)
40
+ res = {}
41
+ res[:uuid] = opts[:redis].get("instance:#{id}/callback/#{callback}/uuid")
42
+ res[:type] = opts[:redis].get("instance:#{id}/callback/#{callback}/type")
43
+ res[:position] = opts[:redis].get("instance:#{id}/callback/#{callback}/position")
44
+ res[:label] = opts[:redis].get("instance:#{id}/callback/#{callback}/label")
45
+ if sub = opts[:redis].get("instance:#{id}/callback/#{callback}/subscription")
46
+ res[:subscription] = sub
47
+ end
48
+
49
+ Riddl::Parameter::Complex.new("callback","application/json",JSON.generate(res))
50
+ else
51
+ @status = 404
52
+ end
53
+ end
54
+ end #}}}
55
+
56
+ class DelCallback < Riddl::Implementation #{{{
57
+ def response
58
+ id = @a[0]
59
+ opts = @a[1]
60
+ callback = @r[-1]
61
+
62
+ if opts[:redis].get("instance:#{id}/callback/#{callback}/type") == 'callback'
63
+ CPEE::Message::send(
64
+ :'callback-end',
65
+ callback,
66
+ opts[:url],
67
+ id,
68
+ {},
69
+ {},
70
+ {},
71
+ opts[:redis]
72
+ )
73
+ elsif opts[:redis].get("instance:#{id}/callback/#{callback}/type") == 'vote'
74
+ CPEE::Message::send(
75
+ :'vote-response',
76
+ callback,
77
+ opts[:url],
78
+ id,
79
+ {},
80
+ {},
81
+ 'true',
82
+ opts[:redis]
83
+ )
84
+ else
85
+ @status = 404
86
+ end
87
+ nil
88
+ end
29
89
  end #}}}
30
90
 
31
91
  class ExCallback < Riddl::Implementation #{{{
@@ -169,8 +169,12 @@ module CPEE
169
169
  conn.psubscribe('forward:*','event:state/change') do |on|
170
170
  on.pmessage do |pat, what, message|
171
171
  if pat == 'forward:*'
172
- _, id, key = what.match(/forward(-end)?:([^\/]+)\/(.+)/).captures
173
- opts.dig(:sse_connections,id.to_i,key)&.send message
172
+ id, key = what.match(/forward:([^\/]+)\/(.+)/).captures
173
+ if sse = opts.dig(:sse_connections,id.to_i,key)
174
+ sse.send message
175
+ else
176
+ DeleteSubscription::set(id,opts,key)
177
+ end
174
178
  elsif pat == 'event:state/change'
175
179
  mess = JSON.parse(message[message.index(' ')+1..-1])
176
180
  state = mess.dig('content','state')
@@ -50,10 +50,12 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
50
50
  @handler_returnOptions = nil
51
51
  @handler_activity_uuid = Digest::MD5.hexdigest(Kernel::rand().to_s)
52
52
  @label = ''
53
+ @guard_files = []
54
+ @guard_items = []
53
55
  end # }}}
54
56
 
55
57
  def prepare(readonly, endpoints, parameters, replay=false) #{{{
56
- if replay
58
+ if replay && @controller.attributes[:replayer]
57
59
  @handler_endpoint = @controller.attributes[:replayer]
58
60
  else
59
61
  @handler_endpoint = endpoints.is_a?(Array) ? endpoints.map{ |ep| readonly.endpoints[ep] }.compact : readonly.endpoints[endpoints]
@@ -99,7 +101,7 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
99
101
  params << Riddl::Header.new("CPEE-CALLBACK-ID",callback)
100
102
  params << Riddl::Header.new("CPEE-ACTIVITY",@handler_position)
101
103
  params << Riddl::Header.new("CPEE-LABEL",@label||'')
102
- params << Riddl::Header.new("CPEE-REPLAY",@controller.attributes['replayer_args'])
104
+ params << Riddl::Header.new("CPEE-REPLAY",@controller.attributes['replayer_target']) if @controller.attributes[:replayer] && @controller.attributes['replayer_target']
103
105
  @controller.attributes.each do |key,value|
104
106
  params << Riddl::Header.new("CPEE-ATTR-#{key.to_s.gsub(/_/,'-')}",value)
105
107
  end
@@ -109,8 +111,8 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
109
111
 
110
112
  client = Riddl::Client.new(tendpoint)
111
113
 
112
- @controller.callback(self,callback,:'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position)
113
114
  @handler_passthrough = callback
115
+ @controller.callback(self,callback,:'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position)
114
116
 
115
117
  status, result, headers = client.request type => params
116
118
  if status < 200 || status >= 300
@@ -261,8 +263,8 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
261
263
 
262
264
  def callback(result=nil,options={})
263
265
  @controller.notify("activity/receiving", :'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position, :endpoint => @handler_endpoint, :received => structurize_result(result), :sensors => @sensors, :aggregators => @aggregators, :costs => @costs)
264
- result = simplify_result(result)
265
- @handler_returnValue = result
266
+ @guard_files += result
267
+ @handler_returnValue = simplify_result(result)
266
268
  @handler_returnOptions = options
267
269
  if options['CPEE_UPDATE']
268
270
  if options['CPEE_UPDATE_STATUS']
@@ -280,6 +282,16 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
280
282
  end
281
283
  end
282
284
 
285
+ def mem_guard() #{{{
286
+ @guard_files.each do |p|
287
+ if p&.respond_to?(:close)
288
+ p.close
289
+ elsif p&.value&.respond_to?(:close)
290
+ p.value.close
291
+ end
292
+ end
293
+ end #}}}
294
+
283
295
  def test_condition(mr,code)
284
296
  res = mr.instance_eval(code)
285
297
  @controller.notify("condition/eval", :instance_uuid => @controller.uuid, :code => code, :condition => (res ? "true" : "false"))
@@ -16,4 +16,10 @@
16
16
  <topic id="task">
17
17
  <event>instantiation</event>
18
18
  </topic>
19
+ <topic id="state">
20
+ <event>change</event>
21
+ </topic>
22
+ <topic id="description">
23
+ <event>change</event>
24
+ </topic>
19
25
  </subscription>
@@ -509,7 +509,7 @@
509
509
  <xsl:when test="child::node()[not(self::text())]">
510
510
  <!-- FUUUU, there is probably much more TODO. Updated Matthias und Juergen, we tested for ing-opcua/execute -->
511
511
  <xsl:choose>
512
- <xsl:when test="child::* and name(child::*)=concat(name(.),'_item') 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">
513
513
  <xsl:text>"[ </xsl:text>
514
514
  <xsl:apply-templates select="*" mode="JSONArrayItem"/>
515
515
  <xsl:text>]"</xsl:text>
@@ -0,0 +1 @@
1
+ 592867
@@ -46,6 +46,7 @@ Daemonite.new do |opts|
46
46
  multi.del("instance:#{instance}/callback/#{key}/label")
47
47
  multi.del("instance:#{instance}/callback/#{key}/position")
48
48
  multi.del("instance:#{instance}/callback/#{key}/type")
49
+ multi.del("instance:#{instance}/callback/#{key}/subscription")
49
50
  end
50
51
  rescue => e
51
52
  puts e.message
@@ -0,0 +1 @@
1
+ 592855
@@ -0,0 +1 @@
1
+ 592859