cpee 2.0.30 → 2.1.0

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 (330) hide show
  1. checksums.yaml +4 -4
  2. data/cockpit/js/instance.js +3 -3
  3. data/cockpit/js/wfadaptor.js +2 -0
  4. data/cockpit/templates.legacy/Async.xml +12 -12
  5. data/cockpit/templates.legacy/BCO.xml +9 -11
  6. data/cockpit/templates.legacy/BCS.xml +9 -11
  7. data/cockpit/templates.legacy/Centurio.xml +7 -7
  8. data/cockpit/templates.legacy/Concurrent.xml +7 -7
  9. data/cockpit/templates.legacy/Coopis Testset.xml +7 -7
  10. data/cockpit/templates.legacy/Endpoints and Data Manipulation.xml +6 -7
  11. data/cockpit/templates.legacy/ICSOC Testset.xml +7 -7
  12. data/cockpit/templates.legacy/Infinity.xml +7 -7
  13. data/cockpit/templates.legacy/Lego Boxer.xml +13 -13
  14. data/cockpit/templates.legacy/Lego Conveyor.xml +13 -13
  15. data/cockpit/templates.legacy/Lego Crane.xml +16 -16
  16. data/cockpit/templates.legacy/Lego Ejector.xml +16 -16
  17. data/cockpit/templates.legacy/Lego Full.xml +12 -12
  18. data/cockpit/templates.legacy/Lego Liddy.xml +13 -13
  19. data/cockpit/templates.legacy/Lego Plate.xml +13 -13
  20. data/cockpit/templates.legacy/Lego Transporter.xml +14 -14
  21. data/cockpit/templates.legacy/Lego_Part_1.xml +12 -12
  22. data/cockpit/templates.legacy/LgLinear.xml +7 -10
  23. data/cockpit/templates.legacy/Linear.xml +11 -14
  24. data/cockpit/templates.legacy/Log.xml +11 -12
  25. data/cockpit/templates.legacy/Mangler 1.xml +7 -7
  26. data/cockpit/templates.legacy/Mangler 2.xml +7 -7
  27. data/cockpit/templates.legacy/Manuel Labels.xml +11 -11
  28. data/cockpit/templates.legacy/Promise.xml +30 -30
  29. data/cockpit/templates.legacy/SOPROMO Test Sonification.xml +7 -7
  30. data/cockpit/templates.legacy/Subprocess.xml +15 -15
  31. data/cockpit/templates.legacy/Syncing P34 1.xml +8 -11
  32. data/cockpit/templates.legacy/Syncing P34 2.xml +8 -11
  33. data/cockpit/templates.legacy/Syncing P34 3.xml +8 -11
  34. data/cockpit/templates.legacy/Syncing P34.xml +8 -11
  35. data/cockpit/templates.legacy/TEST - Bad Loop.xml +7 -7
  36. data/cockpit/templates.legacy/TEST - Wrong Positions.xml +7 -7
  37. data/cockpit/templates.legacy/Take_5.xml +14 -14
  38. data/cockpit/templates.legacy/Update.xml +11 -11
  39. data/cockpit/templates.legacy/Worklist Parallel.xml +17 -17
  40. data/cockpit/templates.legacy/Worklist Test CPEE.xml +14 -14
  41. data/cockpit/templates.legacy/Worklist Test.xml +14 -14
  42. data/cockpit/templates.legacy/Worklist Test2.xml +14 -14
  43. data/cockpit/templates/Coopis 2010.xml +8 -8
  44. data/cockpit/templates/IUPC arXiv:1104.3609 P34 1.xml +8 -11
  45. data/cockpit/templates/IUPC arXiv:1104.3609 P34 2.xml +8 -11
  46. data/cockpit/templates/IUPC arXiv:1104.3609 P34 3.xml +8 -11
  47. data/cockpit/templates/Track Test Local.xml +2 -2
  48. data/cockpit/templates/Track Test.xml +1 -1
  49. data/cockpit/templates/UR-VUE 2020 Manual Adjust.xml +1 -1
  50. data/cockpit/templates/UR-VUE 2020 Solution Baseline.xml +1 -1
  51. data/cockpit/templates/UR-VUE 2020 Solution NN.xml +1 -1
  52. data/cockpit/templates/UR-VUE 2020 Solution View.xml +1 -1
  53. data/cockpit/templates/UR-VUE 2020.xml +1 -1
  54. data/cockpit/templates/Worklist.xml +14 -14
  55. data/cockpit/templates/instantiate.local/Take_Sub.xml +2 -2
  56. data/cockpit/templates/instantiate/Take_Perf.xml +1 -1
  57. data/cockpit/templates/instantiate/Take_Sub.xml +2 -2
  58. data/cockpit/templates/instantiate/Take_X.xml +2 -2
  59. data/cockpit/themes/compact/rngs/start.rng +83 -0
  60. data/cockpit/themes/compact/symbols/start.svg +1 -1
  61. data/cockpit/themes/control/rngs/start.rng +83 -0
  62. data/cockpit/themes/control/symbols/start.svg +1 -1
  63. data/cockpit/themes/default/rngs/start.rng +83 -0
  64. data/cockpit/themes/default/symbols/start.svg +1 -1
  65. data/cockpit/themes/default/theme.js +1 -1
  66. data/cockpit/themes/extended/rngs/start.rng +83 -0
  67. data/cockpit/themes/extended/symbols/start.svg +1 -1
  68. data/cockpit/themes/model/symbols/start.svg +1 -1
  69. data/cockpit/themes/packed/rngs/start.rng +83 -0
  70. data/cockpit/themes/packed/symbols/start.svg +1 -1
  71. data/cockpit/themes/preset/rngs/start.rng +83 -0
  72. data/cockpit/themes/preset/symbols/start.svg +1 -1
  73. data/cockpit/themes/preset/theme.js +1 -1
  74. data/cpee.gemspec +2 -2
  75. data/lib/cpee/attributes_helper.rb +14 -0
  76. data/lib/cpee/implementation.rb +10 -8
  77. data/lib/cpee/implementation_callbacks.rb +14 -0
  78. data/lib/cpee/implementation_notifications.rb +14 -0
  79. data/lib/cpee/implementation_properties.rb +128 -24
  80. data/lib/cpee/persistence.rb +0 -27
  81. data/lib/cpee/statemachine.rb +14 -0
  82. data/lib/cpee/value_helper.rb +14 -0
  83. data/lib/properties.xml +4 -4
  84. data/lib/properties/{handlerwrapper.rng → executionhandler.rng} +2 -2
  85. data/lib/properties/properties.rng +2 -2
  86. data/lib/properties/set-properties.rng +2 -2
  87. data/lib/properties/set-some-properties.rng +2 -2
  88. data/server/{resources → executionhandlers/ruby}/backend/README.md +0 -0
  89. data/server/{resources → executionhandlers/ruby}/backend/instance.template +2 -4
  90. data/server/{resources → executionhandlers/ruby}/backend/opts.yaml +2 -2
  91. data/server/executionhandlers/ruby/backend/run +37 -0
  92. data/server/{handlerwrappers/default.rb → executionhandlers/ruby/connection.rb} +3 -3
  93. data/server/executionhandlers/ruby/controller.rb +195 -0
  94. data/server/{resources/transformation_dslx.xsl → executionhandlers/ruby/dsl_to_dslx.xsl} +53 -8
  95. data/server/executionhandlers/ruby/execution.rb +81 -0
  96. data/server/resources/properties.empty +1 -1
  97. data/server/resources/properties.init +1 -1
  98. data/server/resources/topics.xml +2 -2
  99. data/server/routing/persist.rb +3 -3
  100. data/tools/cpee +9 -3
  101. data/tools/server/cpee +1 -1
  102. data/tools/server/resources/properties.init +1 -1
  103. metadata +19 -237
  104. data/cockpit/templates.legacy/convert_cpee2.rb +0 -15
  105. data/lib/cpee/controller.rb +0 -199
  106. data/lib/cpee/transform.rb +0 -95
  107. data/server/resources/backend/instance.rb +0 -23
  108. data/server/resources/backend/run +0 -33
  109. data/server/routing/end.pid +0 -1
  110. data/server/routing/forward-events.pid +0 -1
  111. data/server/routing/forward-votes.pid +0 -1
  112. data/server/routing/persist.pid +0 -1
  113. data/server/server.pid +0 -1
  114. data/tools/test/README +0 -4
  115. data/tools/test/config.json +0 -3
  116. data/tools/test/contrib/graph_example.svg +0 -1166
  117. data/tools/test/contrib/legend.svg +0 -817
  118. data/tools/test/contrib/symbols.svg +0 -224
  119. data/tools/test/contrib/transformation1.xsl +0 -264
  120. data/tools/test/contrib/transformation2.xsl +0 -10
  121. data/tools/test/contrib/tree_example.svg +0 -788
  122. data/tools/test/css/model.css +0 -24
  123. data/tools/test/css/track.css +0 -60
  124. data/tools/test/css/ui.css +0 -214
  125. data/tools/test/css/wfadaptor.css +0 -422
  126. data/tools/test/edit.html +0 -258
  127. data/tools/test/graph.html +0 -69
  128. data/tools/test/index.html +0 -258
  129. data/tools/test/js/details.js +0 -109
  130. data/tools/test/js/instance.js +0 -1344
  131. data/tools/test/js/model.js +0 -41
  132. data/tools/test/js/parameters.js +0 -82
  133. data/tools/test/js/track.js +0 -18
  134. data/tools/test/js/ui.js +0 -104
  135. data/tools/test/js/wfadaptor.js +0 -763
  136. data/tools/test/js_libs.zip +0 -0
  137. data/tools/test/js_libs/Makefile +0 -2
  138. data/tools/test/js_libs/ansi_up.js +0 -333
  139. data/tools/test/js_libs/console.js +0 -80
  140. data/tools/test/js_libs/custommenu.css +0 -84
  141. data/tools/test/js_libs/custommenu.js +0 -104
  142. data/tools/test/js_libs/experiments1/relaxngui.css +0 -185
  143. data/tools/test/js_libs/experiments1/relaxngui.js +0 -488
  144. data/tools/test/js_libs/experiments1/rngtest9.html +0 -60
  145. data/tools/test/js_libs/experiments1/rngtest9.rng +0 -35
  146. data/tools/test/js_libs/experiments1/rngtest9.xml +0 -8
  147. data/tools/test/js_libs/jquery-2.2.4.min.js +0 -4
  148. data/tools/test/js_libs/jquery-3.2.1.min.js +0 -4
  149. data/tools/test/js_libs/jquery-3.3.1.min.js +0 -2
  150. data/tools/test/js_libs/jquery.browser.js +0 -40
  151. data/tools/test/js_libs/jquery.caret.min.js +0 -10
  152. data/tools/test/js_libs/jquery.cookie.js +0 -117
  153. data/tools/test/js_libs/jquery.min.js +0 -1
  154. data/tools/test/js_libs/jquery.svg.min.js +0 -6
  155. data/tools/test/js_libs/jquery.svgdom.min.js +0 -6
  156. data/tools/test/js_libs/markdown.min.js +0 -1
  157. data/tools/test/js_libs/parsequery.js +0 -21
  158. data/tools/test/js_libs/printf.js +0 -368
  159. data/tools/test/js_libs/relaxngui.css +0 -213
  160. data/tools/test/js_libs/relaxngui.js +0 -543
  161. data/tools/test/js_libs/strftime.min.js +0 -1
  162. data/tools/test/js_libs/tests/dataelements.html +0 -59
  163. data/tools/test/js_libs/tests/dataelements.rng +0 -8
  164. data/tools/test/js_libs/tests/dataelements.xml +0 -3
  165. data/tools/test/js_libs/tests/relaxngui.css +0 -203
  166. data/tools/test/js_libs/tests/relaxngui.js +0 -502
  167. data/tools/test/js_libs/tests/rngtest1.html +0 -66
  168. data/tools/test/js_libs/tests/rngtest1.rng +0 -147
  169. data/tools/test/js_libs/tests/rngtest1.xml +0 -13
  170. data/tools/test/js_libs/tests/rngtest2.html +0 -60
  171. data/tools/test/js_libs/tests/rngtest2.rng +0 -6
  172. data/tools/test/js_libs/tests/rngtest2.xml +0 -3
  173. data/tools/test/js_libs/tests/rngtest3.html +0 -60
  174. data/tools/test/js_libs/tests/rngtest3.rng +0 -23
  175. data/tools/test/js_libs/tests/rngtest3.xml +0 -9
  176. data/tools/test/js_libs/tests/rngtest4.html +0 -60
  177. data/tools/test/js_libs/tests/rngtest4.rng +0 -19
  178. data/tools/test/js_libs/tests/rngtest4.xml +0 -12
  179. data/tools/test/js_libs/tests/rngtest5.html +0 -60
  180. data/tools/test/js_libs/tests/rngtest5.rng +0 -75
  181. data/tools/test/js_libs/tests/rngtest5.xml +0 -40
  182. data/tools/test/js_libs/tests/rngtest6.html +0 -60
  183. data/tools/test/js_libs/tests/rngtest6.rng +0 -24
  184. data/tools/test/js_libs/tests/rngtest6.xml +0 -6
  185. data/tools/test/js_libs/tests/rngtest8.html +0 -60
  186. data/tools/test/js_libs/tests/rngtest8.rng +0 -13
  187. data/tools/test/js_libs/tests/rngtest8.xml +0 -2
  188. data/tools/test/js_libs/tests/rngtest9.html +0 -60
  189. data/tools/test/js_libs/tests/rngtest9.rng +0 -31
  190. data/tools/test/js_libs/tests/rngtest9.xml +0 -8
  191. data/tools/test/js_libs/ui.css +0 -333
  192. data/tools/test/js_libs/ui.html +0 -168
  193. data/tools/test/js_libs/ui.js +0 -177
  194. data/tools/test/js_libs/underscore.min.js +0 -27
  195. data/tools/test/js_libs/util.js +0 -81
  196. data/tools/test/js_libs/vkbeautify.0.99.00.beta.js +0 -358
  197. data/tools/test/js_libs/vkbeautify.js +0 -1
  198. data/tools/test/js_libs/webcomponents.min.js +0 -196
  199. data/tools/test/model.html +0 -192
  200. data/tools/test/rngs/attributes.rng +0 -8
  201. data/tools/test/rngs/dataelements.rng +0 -8
  202. data/tools/test/rngs/endpoints.rng +0 -8
  203. data/tools/test/templates.legacy/Async.xml +0 -46
  204. data/tools/test/templates.legacy/BCO.xml +0 -70
  205. data/tools/test/templates.legacy/BCS.xml +0 -70
  206. data/tools/test/templates.legacy/Centurio.xml +0 -75
  207. data/tools/test/templates.legacy/Concurrent.xml +0 -40
  208. data/tools/test/templates.legacy/Coopis Testset.xml +0 -76
  209. data/tools/test/templates.legacy/Endpoints and Data Manipulation.xml +0 -30
  210. data/tools/test/templates.legacy/ICSOC Testset.xml +0 -95
  211. data/tools/test/templates.legacy/Infinity.xml +0 -28
  212. data/tools/test/templates.legacy/Lego Boxer.xml +0 -31
  213. data/tools/test/templates.legacy/Lego Conveyor.xml +0 -31
  214. data/tools/test/templates.legacy/Lego Crane.xml +0 -87
  215. data/tools/test/templates.legacy/Lego Ejector.xml +0 -55
  216. data/tools/test/templates.legacy/Lego Full.xml +0 -142
  217. data/tools/test/templates.legacy/Lego Liddy.xml +0 -40
  218. data/tools/test/templates.legacy/Lego Plate.xml +0 -31
  219. data/tools/test/templates.legacy/Lego Transporter.xml +0 -43
  220. data/tools/test/templates.legacy/Lego_Part_1.xml +0 -85
  221. data/tools/test/templates.legacy/LgLinear.xml +0 -65
  222. data/tools/test/templates.legacy/Linear.xml +0 -77
  223. data/tools/test/templates.legacy/Log.xml +0 -117
  224. data/tools/test/templates.legacy/Mangler 1.xml +0 -87
  225. data/tools/test/templates.legacy/Mangler 2.xml +0 -103
  226. data/tools/test/templates.legacy/Manuel Labels.xml +0 -55
  227. data/tools/test/templates.legacy/Promise.xml +0 -275
  228. data/tools/test/templates.legacy/SOPROMO Test Sonification.xml +0 -83
  229. data/tools/test/templates.legacy/Subprocess.xml +0 -56
  230. data/tools/test/templates.legacy/Syncing P34 1.xml +0 -77
  231. data/tools/test/templates.legacy/Syncing P34 2.xml +0 -77
  232. data/tools/test/templates.legacy/Syncing P34 3.xml +0 -77
  233. data/tools/test/templates.legacy/Syncing P34.xml +0 -77
  234. data/tools/test/templates.legacy/TEST - Bad Loop.xml +0 -173
  235. data/tools/test/templates.legacy/TEST - Wrong Positions.xml +0 -174
  236. data/tools/test/templates.legacy/Take_5.xml +0 -48
  237. data/tools/test/templates.legacy/Update.xml +0 -32
  238. data/tools/test/templates.legacy/Worklist Parallel.xml +0 -104
  239. data/tools/test/templates.legacy/Worklist Test CPEE.xml +0 -40
  240. data/tools/test/templates.legacy/Worklist Test.xml +0 -42
  241. data/tools/test/templates.legacy/Worklist Test2.xml +0 -43
  242. data/tools/test/templates.legacy/convert_cpee2.rb +0 -15
  243. data/tools/test/templates.legacy/convert_preset.rb +0 -32
  244. data/tools/test/templates.legacy/testsets.xml +0 -37
  245. data/tools/test/templates.legacy/transformations.xml +0 -4
  246. data/tools/test/templates/Coopis 2010.xml +0 -76
  247. data/tools/test/templates/IUPC arXiv:1104.3609 P34 1.xml +0 -77
  248. data/tools/test/templates/IUPC arXiv:1104.3609 P34 2.xml +0 -77
  249. data/tools/test/templates/IUPC arXiv:1104.3609 P34 3.xml +0 -77
  250. data/tools/test/templates/Track Test Local.xml +0 -82
  251. data/tools/test/templates/Track Test.xml +0 -82
  252. data/tools/test/templates/UR-VUE 2020 Manual Adjust.xml +0 -182
  253. data/tools/test/templates/UR-VUE 2020 Solution Baseline.xml +0 -203
  254. data/tools/test/templates/UR-VUE 2020 Solution NN.xml +0 -197
  255. data/tools/test/templates/UR-VUE 2020 Solution View.xml +0 -151
  256. data/tools/test/templates/UR-VUE 2020.xml +0 -26
  257. data/tools/test/templates/Worklist.xml +0 -42
  258. data/tools/test/templates/instantiate.local/Take_Sub.xml +0 -59
  259. data/tools/test/templates/instantiate/Take_Perf.xml +0 -46
  260. data/tools/test/templates/instantiate/Take_Sub.xml +0 -58
  261. data/tools/test/templates/instantiate/Take_X.xml +0 -48
  262. data/tools/test/themes/compact/theme.js +0 -1285
  263. data/tools/test/themes/diana/theme.js +0 -1650
  264. data/tools/test/themes/extended/theme.js +0 -1325
  265. data/tools/test/themes/model/rngs/alternative.rng +0 -1
  266. data/tools/test/themes/model/rngs/call.rng +0 -67
  267. data/tools/test/themes/model/rngs/callmanipulate.rng +0 -72
  268. data/tools/test/themes/model/rngs/choose.rng +0 -1
  269. data/tools/test/themes/model/rngs/critical.rng +0 -1
  270. data/tools/test/themes/model/rngs/escape.rng +0 -1
  271. data/tools/test/themes/model/rngs/group.rng +0 -1
  272. data/tools/test/themes/model/rngs/loop.rng +0 -1
  273. data/tools/test/themes/model/rngs/manipulate.rng +0 -1
  274. data/tools/test/themes/model/rngs/otherwise.rng +0 -1
  275. data/tools/test/themes/model/rngs/parallel.rng +0 -1
  276. data/tools/test/themes/model/rngs/parallel_branch.rng +0 -1
  277. data/tools/test/themes/model/rngs/scripts.rng +0 -7
  278. data/tools/test/themes/model/rngs/stop.rng +0 -1
  279. data/tools/test/themes/model/rngs/terminate.rng +0 -1
  280. data/tools/test/themes/model/theme.js +0 -1268
  281. data/tools/test/themes/packed/theme.js +0 -1286
  282. data/tools/test/themes/preset/rngs/alternative.rng +0 -25
  283. data/tools/test/themes/preset/rngs/call.rng +0 -122
  284. data/tools/test/themes/preset/rngs/callmanipulate.rng +0 -145
  285. data/tools/test/themes/preset/rngs/choose.rng +0 -14
  286. data/tools/test/themes/preset/rngs/closed_loop.rng +0 -62
  287. data/tools/test/themes/preset/rngs/closed_loop_cancel.rng +0 -5
  288. data/tools/test/themes/preset/rngs/closed_loop_control.rng +0 -31
  289. data/tools/test/themes/preset/rngs/closed_loop_measuring.rng +0 -12
  290. data/tools/test/themes/preset/rngs/critical.rng +0 -5
  291. data/tools/test/themes/preset/rngs/escape.rng +0 -1
  292. data/tools/test/themes/preset/rngs/group.rng +0 -3
  293. data/tools/test/themes/preset/rngs/loop.rng +0 -22
  294. data/tools/test/themes/preset/rngs/manipulate.rng +0 -9
  295. data/tools/test/themes/preset/rngs/otherwise.rng +0 -22
  296. data/tools/test/themes/preset/rngs/parallel.rng +0 -21
  297. data/tools/test/themes/preset/rngs/parallel_branch.rng +0 -8
  298. data/tools/test/themes/preset/rngs/scripts.rng +0 -23
  299. data/tools/test/themes/preset/rngs/stop.rng +0 -5
  300. data/tools/test/themes/preset/rngs/terminate.rng +0 -1
  301. data/tools/test/themes/preset/symbols/alternative.svg +0 -5
  302. data/tools/test/themes/preset/symbols/arrow.svg +0 -3
  303. data/tools/test/themes/preset/symbols/call.svg +0 -6
  304. data/tools/test/themes/preset/symbols/callmanipulate.svg +0 -8
  305. data/tools/test/themes/preset/symbols/choose.svg +0 -5
  306. data/tools/test/themes/preset/symbols/choose_exclusive.svg +0 -5
  307. data/tools/test/themes/preset/symbols/choose_inclusive.svg +0 -4
  308. data/tools/test/themes/preset/symbols/closed_loop.svg +0 -5
  309. data/tools/test/themes/preset/symbols/closed_loop_cancel.svg +0 -5
  310. data/tools/test/themes/preset/symbols/closed_loop_control.svg +0 -5
  311. data/tools/test/themes/preset/symbols/closed_loop_measuring.svg +0 -6
  312. data/tools/test/themes/preset/symbols/complex.svg +0 -8
  313. data/tools/test/themes/preset/symbols/critical.svg +0 -4
  314. data/tools/test/themes/preset/symbols/end.svg +0 -3
  315. data/tools/test/themes/preset/symbols/escape.svg +0 -5
  316. data/tools/test/themes/preset/symbols/event_end.svg +0 -3
  317. data/tools/test/themes/preset/symbols/loop.svg +0 -5
  318. data/tools/test/themes/preset/symbols/manipulate.svg +0 -4
  319. data/tools/test/themes/preset/symbols/otherwise.svg +0 -5
  320. data/tools/test/themes/preset/symbols/parallel.svg +0 -5
  321. data/tools/test/themes/preset/symbols/parallel_branch.svg +0 -5
  322. data/tools/test/themes/preset/symbols/parallel_branch_compact.svg +0 -4
  323. data/tools/test/themes/preset/symbols/parallel_branch_event.svg +0 -14
  324. data/tools/test/themes/preset/symbols/parallel_branch_normal.svg +0 -5
  325. data/tools/test/themes/preset/symbols/scripts.svg +0 -4
  326. data/tools/test/themes/preset/symbols/start.svg +0 -3
  327. data/tools/test/themes/preset/symbols/stop.svg +0 -5
  328. data/tools/test/themes/preset/symbols/terminate.svg +0 -4
  329. data/tools/test/themes/preset/theme.js +0 -1287
  330. data/tools/test/track.html +0 -142
@@ -15,33 +15,6 @@
15
15
  module CPEE
16
16
 
17
17
  module Persistence
18
- def self::write_instance(id,opts) #{{{
19
- Dir.mkdir(File.join(opts[:instances],id.to_s)) rescue nil
20
- FileUtils.copy(opts[:backend_run],File.join(opts[:instances],id.to_s))
21
- dsl = CPEE::Persistence::extract_item(id,opts,'dsl')
22
- hw = CPEE::Persistence::extract_item(id,opts,'handlerwrapper')
23
- endpoints = CPEE::Persistence::extract_list(id,opts,'endpoints')
24
- dataelements = CPEE::Persistence::extract_list(id,opts,'dataelements')
25
- positions = CPEE::Persistence::extract_set(id,opts,'positions')
26
- positions.map! do |k, v|
27
- [ k, v, CPEE::Persistence::extract_item(id,opts,File.join('positions',k,'@passthrough')) ]
28
- end
29
- File.open(File.join(opts[:instances],id.to_s,opts[:backend_opts]),'w') do |f|
30
- YAML::dump({
31
- :host => opts[:host],
32
- :url => opts[:url],
33
- :redis_url => opts[:redis_url],
34
- :redis_path => File.join(opts[:basepath],opts[:redis_path]),
35
- :redis_db => opts[:redis_db],
36
- :global_handlerwrappers => opts[:global_handlerwrappers],
37
- :handlerwrappers => opts[:handlerwrappers]
38
- },f)
39
- end
40
- template = ERB.new(File.read(opts[:backend_template]), trim_mode: '-')
41
- res = template.result_with_hash(dsl: dsl, handlerwrapper: hw, dataelements: dataelements, endpoints: endpoints, positions: positions)
42
- File.write(File.join(opts[:instances],id.to_s,opts[:backend_instance]),res)
43
- end #}}}
44
-
45
18
  def self::set_list(id,opts,item,values,deleted=[]) #{{{
46
19
  ah = AttributesHelper.new
47
20
  attributes = Persistence::extract_list(id,opts,'attributes').to_h
@@ -1,3 +1,17 @@
1
+ # This file is part of CPEE.
2
+ #
3
+ # CPEE is free software: you can redistribute it and/or modify it under the terms
4
+ # of the GNU General Public License as published by the Free Software Foundation,
5
+ # either version 3 of the License, or (at your option) any later version.
6
+ #
7
+ # CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
8
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
9
+ # PARTICULAR PURPOSE. See the GNU General Public License for more details.
10
+ #
11
+ # You should have received a copy of the GNU General Public License along with
12
+ # CPEE (file COPYING in the main directory). If not, see
13
+ # <http://www.gnu.org/licenses/>.
14
+
1
15
  module CPEE
2
16
 
3
17
  class StateMachine
@@ -1,3 +1,17 @@
1
+ # This file is part of CPEE.
2
+ #
3
+ # CPEE is free software: you can redistribute it and/or modify it under the terms
4
+ # of the GNU General Public License as published by the Free Software Foundation,
5
+ # either version 3 of the License, or (at your option) any later version.
6
+ #
7
+ # CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
8
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
9
+ # PARTICULAR PURPOSE. See the GNU General Public License for more details.
10
+ #
11
+ # You should have received a copy of the GNU General Public License along with
12
+ # CPEE (file COPYING in the main directory). If not, see
13
+ # <http://www.gnu.org/licenses/>.
14
+
1
15
  require 'json'
2
16
  require 'time'
3
17
 
data/lib/properties.xml CHANGED
@@ -63,7 +63,7 @@
63
63
  <parameter name="value" type="string"/>
64
64
  </message> <!--}}}-->
65
65
 
66
- <message name="handlerwrapper"> <!--{{{-->
66
+ <message name="executionhandler"> <!--{{{-->
67
67
  <parameter name="value" type="string">
68
68
  <param name="pattern">[A-Z][a-zA-Z]*</param>
69
69
  </parameter>
@@ -165,9 +165,9 @@
165
165
  <get out="string"/>
166
166
  </resource>
167
167
  </resource> <!--}}}-->
168
- <resource relative="handlerwrapper"> <!--{{{-->
169
- <put in="handlerwrapper"/>
170
- <get out="handlerwrapper"/>
168
+ <resource relative="executionhandler"> <!--{{{-->
169
+ <put in="executionhandler"/>
170
+ <get out="executionhandler"/>
171
171
  </resource> <!--}}}-->
172
172
  <resource relative="positions"> <!--{{{-->
173
173
  <get out="positions"/>
@@ -1,6 +1,6 @@
1
1
  <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
2
- <define name="handlerwrapper">
3
- <element name="handlerwrapper" ns="http://cpee.org/ns/properties/2.0">
2
+ <define name="executionhandler">
3
+ <element name="executionhandler" ns="http://cpee.org/ns/properties/2.0">
4
4
  <data type="string">
5
5
  <param name="pattern">[A-Z][a-zA-Z]*</param>
6
6
  </data>
@@ -1,7 +1,7 @@
1
1
  <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
2
2
  <include href="state.rng"/>
3
3
  <include href="status.rng"/>
4
- <include href="handlerwrapper.rng"/>
4
+ <include href="executionhandler.rng"/>
5
5
  <include href="positions.rng"/>
6
6
  <include href="dataelements.rng"/>
7
7
  <include href="endpoints.rng"/>
@@ -15,7 +15,7 @@
15
15
  <element name="properties" ns="http://cpee.org/ns/properties/2.0">
16
16
  <ref name="state"/>
17
17
  <ref name="status"/>
18
- <ref name="handlerwrapper"/>
18
+ <ref name="executionhandler"/>
19
19
  <ref name="positions"/>
20
20
  <ref name="dataelements"/>
21
21
  <ref name="endpoints"/>
@@ -1,7 +1,7 @@
1
1
  <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
2
2
  <include href="state.rng"/>
3
3
  <include href="status.rng"/>
4
- <include href="handlerwrapper.rng"/>
4
+ <include href="executionhandler.rng"/>
5
5
  <include href="positions.rng"/>
6
6
  <include href="dataelements.rng"/>
7
7
  <include href="endpoints.rng"/>
@@ -13,7 +13,7 @@
13
13
  <element name="properties" ns="http://cpee.org/ns/properties/2.0">
14
14
  <ref name="set-state"/>
15
15
  <ref name="status"/>
16
- <ref name="handlerwrapper"/>
16
+ <ref name="executionhandler"/>
17
17
  <ref name="positions"/>
18
18
  <ref name="dataelements"/>
19
19
  <ref name="endpoints"/>
@@ -1,7 +1,7 @@
1
1
  <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
2
2
  <include href="state.rng"/>
3
3
  <include href="status.rng"/>
4
- <include href="handlerwrapper.rng"/>
4
+ <include href="executionhandler.rng"/>
5
5
  <include href="positions.rng"/>
6
6
  <include href="dataelements.rng"/>
7
7
  <include href="endpoints.rng"/>
@@ -19,7 +19,7 @@
19
19
  <ref name="status"/>
20
20
  </optional>
21
21
  <optional>
22
- <ref name="handlerwrapper"/>
22
+ <ref name="executionhandler"/>
23
23
  </optional>
24
24
  <optional>
25
25
  <ref name="positions"/>
@@ -1,5 +1,5 @@
1
1
  class Instance < WEEL
2
- handlerwrapper <%= handlerwrapper %>
2
+ connectionwrapper ConnectionWrapper
3
3
 
4
4
  <% for key, value in endpoints -%>
5
5
  endpoint :<%= key %> => <%= CPEE::ValueHelper::parse(value).inspect %>
@@ -13,7 +13,5 @@ class Instance < WEEL
13
13
  search <% positions.each_with_index { |de,i| %><%= (i > 0 ? ', ' : '') %>Position.new(:<%= de[0] %>, :<%=de[1] %>, <%= de[2].nil? || de[2].strip.empty? ? 'nil' : '"' + de[2] + '"' %>)<% } %>
14
14
  <% end -%>
15
15
 
16
- control flow do
17
- <%= dsl.strip.gsub(/\n/,"\n ") %>
18
- end
16
+ <%= dsl.strip.gsub(/\n/,"\n ") %>
19
17
  end
@@ -2,5 +2,5 @@
2
2
  :url: http://localhost:8298/
3
3
  :redis_path: /tmp/redis.sock
4
4
  :redis_db: 3
5
- :handlerwrappers: ../../handlerwrappers/
6
-
5
+ :executionhandlers: ../../executionhandlers/
6
+ :executionhandler: ruby
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/ruby
2
+ require 'yaml'
3
+ opts = YAML::load_file(File.join(__dir__,'opts.yaml'))
4
+ opts[:pidf] = __FILE__ + '.pid'
5
+ opts[:pid] = Process.pid
6
+
7
+ global_controller = File.join(opts[:global_executionhandlers],opts[:executionhandler],'controller.rb')
8
+ controller = File.join(opts[:executionhandlers], opts[:executionhandler],'controller.rb')
9
+ if File.exists? global_controller
10
+ require global_controller
11
+ elsif File.exists? controller
12
+ require controller
13
+ end
14
+
15
+ global_connectionhandler = File.join(opts[:global_executionhandlers],opts[:executionhandler],'connection.rb')
16
+ connectionhandler = File.join(opts[:executionhandlers], opts[:executionhandler],'connection.rb')
17
+ if File.exists? global_connectionhandler
18
+ require global_connectionhandler
19
+ elsif File.exists? connectionhandler
20
+ require connectionhandler
21
+ end
22
+
23
+ require_relative 'instance'
24
+ controller = Controller.new(File.basename(__dir__).to_i, __dir__, opts)
25
+ controller.instance = Instance.new controller
26
+
27
+ File.write(opts[:pidf],opts[:pid])
28
+
29
+ %w{TERM HUP INT}.each do |sig|
30
+ Signal.trap(sig) do
31
+ puts "Caught #{sig}!"
32
+ controller.stop
33
+ end
34
+ end
35
+
36
+ controller.start
37
+ File.unlink(opts[:pidf])
@@ -12,7 +12,7 @@
12
12
  # CPEE (file COPYING in the main directory). If not, see
13
13
  # <http://www.gnu.org/licenses/>.
14
14
 
15
- class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
15
+ class ConnectionWrapper < WEEL::ConnectionWrapperBase
16
16
  def self::loop_guard(arguments,id,count) # {{{
17
17
  controller = arguments[0]
18
18
  tsn = Time.now
@@ -30,11 +30,11 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
30
30
  controller = arguments[0]
31
31
  controller.notify("description/error", :message => err.message)
32
32
  end# }}}
33
- def self::inform_handlerwrapper_error(arguments,err) # {{{
33
+ def self::inform_connectionwrapper_error(arguments,err) # {{{
34
34
  controller = arguments[0]
35
35
  p err.message
36
36
  p err.backtrace
37
- controller.notify("handlerwrapper/error", :message => err.message)
37
+ controller.notify("executionhandler/error", :message => err.message)
38
38
  end # }}}
39
39
  def self::inform_position_change(arguments,ipc={}) # {{{
40
40
  controller = arguments[0]
@@ -0,0 +1,195 @@
1
+ # This file is part of CPEE.
2
+ #
3
+ # CPEE is free software: you can redistribute it and/or modify it under the terms
4
+ # of the GNU General Public License as published by the Free Software Foundation,
5
+ # either version 3 of the License, or (at your option) any later version.
6
+ #
7
+ # CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
8
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
9
+ # PARTICULAR PURPOSE. See the GNU General Public License for more details.
10
+ #
11
+ # You should have received a copy of the GNU General Public License along with
12
+ # CPEE (file COPYING in the main directory). If not, see
13
+ # <http://www.gnu.org/licenses/>.
14
+
15
+ require 'weel'
16
+ require 'json'
17
+ require 'redis'
18
+ require 'securerandom'
19
+ require 'riddl/client'
20
+ require 'cpee/value_helper'
21
+ require 'cpee/attributes_helper'
22
+ require 'cpee/message'
23
+ require 'cpee/redis'
24
+
25
+ require 'ostruct'
26
+ class ParaStruct < OpenStruct
27
+ def to_json(*a)
28
+ table.to_json
29
+ end
30
+ end
31
+ def →(a); ParaStruct.new(a); end
32
+ def ⭐(a); ParaStruct.new(a); end
33
+
34
+ class Controller
35
+ def initialize(id,dir,opts)
36
+ CPEE::redis_connect(opts)
37
+
38
+ @redis = opts[:redis]
39
+ @votes = []
40
+
41
+ @id = id
42
+
43
+ @attributes = {}
44
+ @redis.keys("instance:#{id}/attributes/*").each do |key|
45
+ @attributes[File.basename(key)] = @redis.get(key)
46
+ end
47
+
48
+ @attributes_helper = AttributesHelper.new
49
+ @thread = nil
50
+ @opts = opts
51
+ @instance = nil
52
+ @loop_guard = {}
53
+
54
+ @callback_keys = {}
55
+ @psredis = @opts[:redis_dyn].call
56
+
57
+ Thread.new do
58
+ @psredis.psubscribe('callback-response:*','callback-end:*') do |on|
59
+ on.pmessage do |pat, what, message|
60
+ if pat == 'callback-response:*' && @callback_keys.has_key?(what[18..-1])
61
+ index = message.index(' ')
62
+ mess = message[index+1..-1]
63
+ instance = message[0...index]
64
+ m = JSON.parse(mess)
65
+ resp = []
66
+ m['content']['values'].each do |e|
67
+ if e[1][0] == 'simple'
68
+ resp << Riddl::Parameter::Simple.new(e[0],e[1][1])
69
+ elsif e[1][0] == 'complex'
70
+ resp << Riddl::Parameter::Complex.new(e[0],e[1][1],File.open(e[1][2]))
71
+ end
72
+ end
73
+ @callback_keys[what[18..-1]].send(:callback,resp,m['content']['headers'])
74
+ end
75
+ if pat == 'callback-end:*'
76
+ @callback_keys.delete(what[13..-1])
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
82
+
83
+ attr_reader :id
84
+ attr_reader :attributes
85
+ attr_reader :loop_guard
86
+
87
+ def uuid
88
+ @attributes['uuid']
89
+ end
90
+
91
+ def attributes_translated
92
+ @attributes_helper.translate(attributes,dataelements,endpoints)
93
+ end
94
+
95
+ def host
96
+ @opts[:host]
97
+ end
98
+ def base_url
99
+ @opts[:url]
100
+ end
101
+ def instance_url
102
+ File.join(@opts[:url].to_s,@id.to_s)
103
+ end
104
+ def instance_id
105
+ @id
106
+ end
107
+ def base
108
+ base_url
109
+ end
110
+ def instance=(inst)
111
+ @instance = inst
112
+ end
113
+ def endpoints
114
+ @instance.endpoints
115
+ end
116
+ def dataelements
117
+ @instance.data
118
+ end
119
+
120
+ def start
121
+ if vote("state/change", :state => 'running')
122
+ @thread = @instance.start
123
+ @thread.join
124
+ else
125
+ @thread = @instance.stop
126
+ @thread.join
127
+ end
128
+ end
129
+
130
+ def stop
131
+ ### tell the instance to stop
132
+ @instance.stop
133
+ ### end all votes or it will not work
134
+ Thread.new do # doing stuff in trap context is a nono. but in a thread its fine :-)
135
+ @votes.each do |key|
136
+ CPEE::Message::send(:'vote-response',key,base,@id,uuid,info,true,@redis)
137
+ end
138
+ end
139
+ @thread.join if !@thread.nil? && @thread.alive?
140
+ end
141
+
142
+ def info
143
+ @attributes['info']
144
+ end
145
+
146
+ def notify(what,content={})
147
+ content[:attributes] = attributes_translated
148
+ CPEE::Message::send(:event,what,base,@id,uuid,info,content,@redis)
149
+ end
150
+
151
+ def vote(what,content={})
152
+ topic, name = what.split('/')
153
+ handler = File.join(topic,'vote',name)
154
+ votes = []
155
+ @redis.smembers("instance:#{id}/handlers/#{handler}").each do |client|
156
+ voteid = Digest::MD5.hexdigest(Kernel::rand().to_s)
157
+ content[:key] = voteid
158
+ content[:attributes] = attributes_translated
159
+ content[:subscription] = client
160
+ votes << voteid
161
+ CPEE::Message::send(:vote,what,base,@id,uuid,info,content,@redis)
162
+ end
163
+
164
+ if votes.length > 0
165
+ @votes += votes
166
+ psredis = @opts[:redis_dyn].call
167
+ collect = []
168
+ psredis.subscribe(votes.map{|e| ['vote-response:' + e.to_s] }.flatten) do |on|
169
+ on.message do |what, message|
170
+ index = message.index(' ')
171
+ mess = message[index+1..-1]
172
+ m = JSON.parse(mess)
173
+ collect << ((m['content'] == true || m['content'] == 'true') || false)
174
+ @votes.delete m['name']
175
+ cancel_callback m['name']
176
+ if collect.length >= votes.length
177
+ psredis.unsubscribe
178
+ end
179
+ end
180
+ end
181
+ !collect.include?(false)
182
+ else
183
+ true
184
+ end
185
+ end
186
+
187
+ def callback(hw,key,content)
188
+ CPEE::Message::send(:callback,'activity/content',base,@id,uuid,info,content.merge(:key => key),@redis)
189
+ @callback_keys[key] = hw
190
+ end
191
+
192
+ def cancel_callback(key)
193
+ CPEE::Message::send(:'callback-end',key,base,@id,uuid,info,{},@redis)
194
+ end
195
+ end