cpee 1.5.25 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (357) hide show
  1. checksums.yaml +4 -4
  2. data/{FEATURES → FEATURES.md} +7 -6
  3. data/INSTALL.md +1 -0
  4. data/{README → README.md} +3 -3
  5. data/Rakefile +1 -0
  6. data/cockpit/index.html +7 -7
  7. data/cockpit/js/details.js +13 -14
  8. data/cockpit/js/instance.js +191 -284
  9. data/cockpit/js/parameters.js +13 -3
  10. data/cockpit/js/ui.js +2 -2
  11. data/cockpit/model.html +1 -0
  12. data/cockpit/rngs/attributes.rng +1 -1
  13. data/cockpit/rngs/dataelements.rng +1 -1
  14. data/cockpit/rngs/endpoints.rng +1 -1
  15. data/cockpit/templates.legacy/Async.xml +7 -7
  16. data/cockpit/templates.legacy/BCO.xml +7 -10
  17. data/cockpit/templates.legacy/BCS.xml +7 -10
  18. data/cockpit/templates.legacy/Centurio.xml +6 -6
  19. data/cockpit/templates.legacy/Concurrent.xml +6 -6
  20. data/cockpit/templates.legacy/Coopis Testset.xml +6 -6
  21. data/cockpit/templates.legacy/Endpoints and Data Manipulation.xml +6 -6
  22. data/cockpit/templates.legacy/ICSOC Testset.xml +6 -6
  23. data/cockpit/templates.legacy/Infinity.xml +3 -3
  24. data/cockpit/templates.legacy/Lego Boxer.xml +7 -7
  25. data/cockpit/templates.legacy/Lego Conveyor.xml +7 -7
  26. data/cockpit/templates.legacy/Lego Crane.xml +7 -7
  27. data/cockpit/templates.legacy/Lego Ejector.xml +7 -7
  28. data/cockpit/templates.legacy/Lego Full.xml +7 -7
  29. data/cockpit/templates.legacy/Lego Liddy.xml +7 -7
  30. data/cockpit/templates.legacy/Lego Plate.xml +7 -7
  31. data/cockpit/templates.legacy/Lego Transporter.xml +7 -7
  32. data/cockpit/templates.legacy/Lego_Part_1.xml +7 -7
  33. data/cockpit/templates.legacy/LgLinear.xml +6 -10
  34. data/cockpit/templates.legacy/Linear.xml +7 -7
  35. data/cockpit/templates.legacy/Log.xml +7 -7
  36. data/cockpit/templates.legacy/Mangler 1.xml +6 -6
  37. data/cockpit/templates.legacy/Mangler 2.xml +6 -6
  38. data/cockpit/templates.legacy/Manuel Labels.xml +7 -7
  39. data/cockpit/templates.legacy/Promise.xml +7 -7
  40. data/cockpit/templates.legacy/SOPROMO Test Sonification.xml +6 -6
  41. data/cockpit/templates.legacy/Subprocess.xml +56 -0
  42. data/cockpit/templates.legacy/Syncing P34 1.xml +8 -11
  43. data/cockpit/templates.legacy/Syncing P34 2.xml +8 -11
  44. data/cockpit/templates.legacy/Syncing P34 3.xml +8 -11
  45. data/cockpit/templates.legacy/Syncing P34.xml +8 -11
  46. data/cockpit/templates.legacy/TEST - Bad Loop.xml +6 -6
  47. data/cockpit/templates.legacy/TEST - Wrong Positions.xml +6 -6
  48. data/cockpit/templates.legacy/Take_5.xml +48 -0
  49. data/cockpit/templates.legacy/Update.xml +7 -7
  50. data/cockpit/templates.legacy/Worklist Parallel.xml +7 -7
  51. data/cockpit/templates.legacy/Worklist Test CPEE.xml +7 -7
  52. data/cockpit/templates.legacy/Worklist Test.xml +7 -7
  53. data/cockpit/templates.legacy/Worklist Test2.xml +7 -7
  54. data/cockpit/templates.legacy/convert_cpee2.rb +15 -0
  55. data/cockpit/templates.legacy/testsets.xml +1 -1
  56. data/cockpit/templates/BPM 2020 Manual Adjust.xml +18 -71
  57. data/cockpit/templates/BPM 2020 Solution Baseline.xml +17 -71
  58. data/cockpit/templates/BPM 2020 Solution NN.xml +25 -71
  59. data/cockpit/templates/BPM 2020 Solution View.xml +15 -71
  60. data/cockpit/templates/BPM 2020.xml +17 -6
  61. data/cockpit/templates/Coopis 2010.xml +7 -7
  62. data/cockpit/templates/IUPC arXiv:1104.3609 P34 1.xml +7 -10
  63. data/cockpit/templates/IUPC arXiv:1104.3609 P34 2.xml +7 -10
  64. data/cockpit/templates/IUPC arXiv:1104.3609 P34 3.xml +7 -10
  65. data/cockpit/templates/Worklist.xml +7 -7
  66. data/cockpit/templates/convert_cpee2.rb +15 -0
  67. data/cockpit/themes/compact/rngs/alternative.rng +25 -0
  68. data/cockpit/themes/compact/rngs/call.rng +17 -17
  69. data/cockpit/themes/compact/rngs/callmanipulate.rng +26 -26
  70. data/cockpit/themes/compact/rngs/choose.rng +14 -0
  71. data/cockpit/themes/compact/rngs/critical.rng +5 -0
  72. data/cockpit/themes/compact/rngs/escape.rng +1 -0
  73. data/cockpit/themes/compact/rngs/group.rng +3 -0
  74. data/cockpit/themes/compact/rngs/loop.rng +22 -0
  75. data/cockpit/themes/compact/rngs/manipulate.rng +9 -0
  76. data/cockpit/themes/compact/rngs/otherwise.rng +22 -0
  77. data/cockpit/themes/compact/rngs/parallel.rng +21 -0
  78. data/cockpit/themes/compact/rngs/parallel_branch.rng +8 -0
  79. data/cockpit/themes/compact/rngs/scripts.rng +10 -11
  80. data/cockpit/themes/compact/rngs/stop.rng +5 -0
  81. data/cockpit/themes/compact/rngs/terminate.rng +1 -0
  82. data/cockpit/themes/convert_cpee2.rb +8 -0
  83. data/cockpit/themes/default/rngs/alternative.rng +8 -8
  84. data/cockpit/themes/default/rngs/call.rng +84 -48
  85. data/cockpit/themes/default/rngs/callmanipulate.rng +103 -64
  86. data/cockpit/themes/default/rngs/choose.rng +5 -3
  87. data/cockpit/themes/default/rngs/critical.rng +2 -2
  88. data/cockpit/themes/default/rngs/escape.rng +1 -1
  89. data/cockpit/themes/default/rngs/group.rng +3 -3
  90. data/cockpit/themes/default/rngs/loop.rng +8 -8
  91. data/cockpit/themes/default/rngs/manipulate.rng +3 -3
  92. data/cockpit/themes/default/rngs/otherwise.rng +8 -8
  93. data/cockpit/themes/default/rngs/parallel.rng +14 -6
  94. data/cockpit/themes/default/rngs/parallel_branch.rng +2 -2
  95. data/cockpit/themes/default/rngs/scripts.rng +23 -0
  96. data/cockpit/themes/default/rngs/stop.rng +2 -2
  97. data/cockpit/themes/default/rngs/terminate.rng +1 -1
  98. data/cockpit/themes/extended/rngs/alternative.rng +25 -0
  99. data/cockpit/themes/extended/rngs/call.rng +17 -17
  100. data/cockpit/themes/extended/rngs/callmanipulate.rng +26 -26
  101. data/cockpit/themes/extended/rngs/choose.rng +14 -0
  102. data/cockpit/themes/extended/rngs/critical.rng +5 -0
  103. data/cockpit/themes/extended/rngs/escape.rng +1 -0
  104. data/cockpit/themes/extended/rngs/group.rng +3 -0
  105. data/cockpit/themes/extended/rngs/loop.rng +22 -0
  106. data/cockpit/themes/extended/rngs/manipulate.rng +9 -0
  107. data/cockpit/themes/extended/rngs/otherwise.rng +22 -0
  108. data/cockpit/themes/extended/rngs/parallel.rng +21 -0
  109. data/cockpit/themes/extended/rngs/parallel_branch.rng +8 -0
  110. data/cockpit/themes/extended/rngs/scripts.rng +10 -11
  111. data/cockpit/themes/extended/rngs/stop.rng +5 -0
  112. data/cockpit/themes/extended/rngs/terminate.rng +1 -0
  113. data/cockpit/themes/extended/theme.js +7 -6
  114. data/cockpit/themes/model/rngs/alternative.rng +1 -1
  115. data/cockpit/themes/model/rngs/call.rng +16 -16
  116. data/cockpit/themes/model/rngs/callmanipulate.rng +17 -17
  117. data/cockpit/themes/model/rngs/choose.rng +1 -1
  118. data/cockpit/themes/model/rngs/critical.rng +1 -1
  119. data/cockpit/themes/model/rngs/escape.rng +1 -1
  120. data/cockpit/themes/model/rngs/group.rng +1 -1
  121. data/cockpit/themes/model/rngs/loop.rng +1 -1
  122. data/cockpit/themes/model/rngs/manipulate.rng +1 -1
  123. data/cockpit/themes/model/rngs/otherwise.rng +1 -1
  124. data/cockpit/themes/model/rngs/parallel.rng +1 -1
  125. data/cockpit/themes/model/rngs/parallel_branch.rng +1 -1
  126. data/cockpit/themes/model/rngs/scripts.rng +3 -4
  127. data/cockpit/themes/model/rngs/stop.rng +1 -1
  128. data/cockpit/themes/model/rngs/terminate.rng +1 -1
  129. data/cockpit/themes/model/theme.js +7 -6
  130. data/cockpit/themes/packed/rngs/alternative.rng +25 -0
  131. data/cockpit/themes/packed/rngs/call.rng +17 -17
  132. data/cockpit/themes/packed/rngs/callmanipulate.rng +26 -26
  133. data/cockpit/themes/packed/rngs/choose.rng +14 -0
  134. data/cockpit/themes/packed/rngs/critical.rng +5 -0
  135. data/cockpit/themes/packed/rngs/escape.rng +1 -0
  136. data/cockpit/themes/packed/rngs/group.rng +3 -0
  137. data/cockpit/themes/packed/rngs/loop.rng +22 -0
  138. data/cockpit/themes/packed/rngs/manipulate.rng +9 -0
  139. data/cockpit/themes/packed/rngs/otherwise.rng +22 -0
  140. data/cockpit/themes/packed/rngs/parallel.rng +21 -0
  141. data/cockpit/themes/packed/rngs/parallel_branch.rng +8 -0
  142. data/cockpit/themes/packed/rngs/scripts.rng +10 -11
  143. data/cockpit/themes/packed/rngs/stop.rng +5 -0
  144. data/cockpit/themes/packed/rngs/terminate.rng +1 -0
  145. data/cockpit/themes/packed/theme.js +7 -6
  146. data/cockpit/themes/preset/rngs/alternative.rng +25 -0
  147. data/cockpit/themes/preset/rngs/call.rng +17 -17
  148. data/cockpit/themes/preset/rngs/callmanipulate.rng +26 -26
  149. data/cockpit/themes/preset/rngs/choose.rng +14 -0
  150. data/cockpit/themes/preset/rngs/critical.rng +5 -0
  151. data/cockpit/themes/preset/rngs/escape.rng +1 -0
  152. data/cockpit/themes/preset/rngs/group.rng +3 -0
  153. data/cockpit/themes/preset/rngs/loop.rng +22 -0
  154. data/cockpit/themes/preset/rngs/manipulate.rng +9 -0
  155. data/cockpit/themes/preset/rngs/otherwise.rng +22 -0
  156. data/cockpit/themes/preset/rngs/parallel.rng +21 -0
  157. data/cockpit/themes/preset/rngs/parallel_branch.rng +8 -0
  158. data/cockpit/themes/preset/rngs/scripts.rng +10 -11
  159. data/cockpit/themes/preset/rngs/stop.rng +5 -0
  160. data/cockpit/themes/preset/rngs/terminate.rng +1 -0
  161. data/cockpit/themes/preset/theme.js +7 -6
  162. data/cpee.gemspec +10 -11
  163. data/{log/topics.xml → lib/callbacks.xml} +16 -6
  164. data/lib/{engine → callbacks}/callbacks.rng +2 -8
  165. data/lib/cpee.xml +10 -4
  166. data/lib/cpee/attributes_helper.rb +27 -0
  167. data/lib/cpee/controller.rb +113 -596
  168. data/lib/cpee/implementation.rb +167 -191
  169. data/lib/cpee/implementation_callbacks.rb +77 -0
  170. data/lib/cpee/implementation_notifications.rb +189 -0
  171. data/lib/cpee/implementation_properties.rb +714 -0
  172. data/lib/cpee/{callback.rb → message.rb} +20 -18
  173. data/lib/cpee/persistence.rb +135 -0
  174. data/lib/cpee/statemachine.rb +20 -0
  175. data/lib/cpee/transform.rb +95 -0
  176. data/lib/engine.xml +1 -59
  177. data/lib/properties.xml +236 -0
  178. data/lib/properties/arbitrary.rng +26 -0
  179. data/lib/properties/attributes.rng +10 -0
  180. data/lib/properties/dataelements.rng +10 -0
  181. data/lib/properties/description.rng +8 -0
  182. data/lib/properties/dsl.rng +7 -0
  183. data/lib/properties/dslx.rng +8 -0
  184. data/lib/properties/endpoints.rng +10 -0
  185. data/lib/properties/handlerwrapper.rng +9 -0
  186. data/lib/properties/position.rng +15 -0
  187. data/lib/properties/positions.rng +10 -0
  188. data/lib/properties/properties.rng +29 -0
  189. data/lib/properties/set-properties.rng +25 -0
  190. data/lib/properties/set-some-properties.rng +45 -0
  191. data/lib/properties/simple.rng +8 -0
  192. data/lib/properties/state.rng +33 -0
  193. data/lib/properties/status.rng +12 -0
  194. data/lib/properties/t_attributes.rng +7 -0
  195. data/lib/properties/t_dataelements.rng +7 -0
  196. data/lib/properties/t_endpoints.rng +7 -0
  197. data/lib/properties/t_position.rng +7 -0
  198. data/lib/properties/t_positions.rng +7 -0
  199. data/lib/properties/t_simple.rng +7 -0
  200. data/lib/properties/t_status.rng +7 -0
  201. data/lib/properties/t_transformation.rng +7 -0
  202. data/lib/properties/transformation.rng +40 -0
  203. data/server/dev.rb +1 -0
  204. data/server/handlerwrappers/default.rb +40 -38
  205. data/server/resources/backend/README.md +17 -0
  206. data/server/resources/backend/instance.rb +23 -0
  207. data/server/resources/backend/instance.template +19 -0
  208. data/server/resources/backend/opts.yaml +6 -0
  209. data/server/resources/backend/run +33 -0
  210. data/server/resources/notifications/logging/subscription.xml +19 -0
  211. data/server/resources/properties.empty +38 -0
  212. data/server/resources/properties.init +11 -11
  213. data/server/resources/states.dot +19 -0
  214. data/server/resources/states.xml +49 -0
  215. data/server/resources/transformation_dslx.xsl +12 -3
  216. data/server/routing/end.rb +44 -0
  217. data/server/routing/forward-events.rb +59 -0
  218. data/server/routing/forward-votes.rb +108 -0
  219. data/server/routing/persist.rb +155 -0
  220. data/server/server.rb +1 -0
  221. data/tools/cpee +46 -15
  222. data/tools/instantiation/instantiation +0 -1
  223. data/tools/server/server.rb +0 -1
  224. metadata +78 -132
  225. data/INSTALL +0 -23
  226. data/cockpit/templates/convert_preset.rb +0 -32
  227. data/cockpit/templates/testsets.xml +0 -11
  228. data/cockpit/templates/transformations.xml +0 -4
  229. data/cockpit/themes/compact/rngs/alternative.rng +0 -1
  230. data/cockpit/themes/compact/rngs/choose.rng +0 -1
  231. data/cockpit/themes/compact/rngs/critical.rng +0 -1
  232. data/cockpit/themes/compact/rngs/escape.rng +0 -1
  233. data/cockpit/themes/compact/rngs/group.rng +0 -1
  234. data/cockpit/themes/compact/rngs/loop.rng +0 -1
  235. data/cockpit/themes/compact/rngs/manipulate.rng +0 -1
  236. data/cockpit/themes/compact/rngs/otherwise.rng +0 -1
  237. data/cockpit/themes/compact/rngs/parallel.rng +0 -1
  238. data/cockpit/themes/compact/rngs/parallel_branch.rng +0 -1
  239. data/cockpit/themes/compact/rngs/stop.rng +0 -1
  240. data/cockpit/themes/compact/rngs/terminate.rng +0 -1
  241. data/cockpit/themes/default/rngs/finalize.rng +0 -6
  242. data/cockpit/themes/default/rngs/update.rng +0 -6
  243. data/cockpit/themes/default/theme.js +0 -1286
  244. data/cockpit/themes/extended/rngs/alternative.rng +0 -1
  245. data/cockpit/themes/extended/rngs/choose.rng +0 -1
  246. data/cockpit/themes/extended/rngs/critical.rng +0 -1
  247. data/cockpit/themes/extended/rngs/escape.rng +0 -1
  248. data/cockpit/themes/extended/rngs/group.rng +0 -1
  249. data/cockpit/themes/extended/rngs/loop.rng +0 -1
  250. data/cockpit/themes/extended/rngs/manipulate.rng +0 -1
  251. data/cockpit/themes/extended/rngs/otherwise.rng +0 -1
  252. data/cockpit/themes/extended/rngs/parallel.rng +0 -1
  253. data/cockpit/themes/extended/rngs/parallel_branch.rng +0 -1
  254. data/cockpit/themes/extended/rngs/stop.rng +0 -1
  255. data/cockpit/themes/extended/rngs/terminate.rng +0 -1
  256. data/cockpit/themes/labels/rngs/alternative.rng +0 -25
  257. data/cockpit/themes/labels/rngs/call.rng +0 -81
  258. data/cockpit/themes/labels/rngs/callmanipulate.rng +0 -101
  259. data/cockpit/themes/labels/rngs/choose.rng +0 -12
  260. data/cockpit/themes/labels/rngs/critical.rng +0 -5
  261. data/cockpit/themes/labels/rngs/escape.rng +0 -1
  262. data/cockpit/themes/labels/rngs/finalize.rng +0 -6
  263. data/cockpit/themes/labels/rngs/group.rng +0 -3
  264. data/cockpit/themes/labels/rngs/loop.rng +0 -22
  265. data/cockpit/themes/labels/rngs/manipulate.rng +0 -9
  266. data/cockpit/themes/labels/rngs/otherwise.rng +0 -22
  267. data/cockpit/themes/labels/rngs/parallel.rng +0 -13
  268. data/cockpit/themes/labels/rngs/parallel_branch.rng +0 -8
  269. data/cockpit/themes/labels/rngs/stop.rng +0 -5
  270. data/cockpit/themes/labels/rngs/terminate.rng +0 -1
  271. data/cockpit/themes/labels/rngs/update.rng +0 -6
  272. data/cockpit/themes/labels/symbols/alternative.svg +0 -5
  273. data/cockpit/themes/labels/symbols/arrow.svg +0 -3
  274. data/cockpit/themes/labels/symbols/call.svg +0 -6
  275. data/cockpit/themes/labels/symbols/callmanipulate.svg +0 -8
  276. data/cockpit/themes/labels/symbols/choose.svg +0 -5
  277. data/cockpit/themes/labels/symbols/choose_exclusive.svg +0 -5
  278. data/cockpit/themes/labels/symbols/choose_inclusive.svg +0 -4
  279. data/cockpit/themes/labels/symbols/complex.svg +0 -8
  280. data/cockpit/themes/labels/symbols/critical.svg +0 -4
  281. data/cockpit/themes/labels/symbols/end.svg +0 -3
  282. data/cockpit/themes/labels/symbols/escape.svg +0 -5
  283. data/cockpit/themes/labels/symbols/event_end.svg +0 -3
  284. data/cockpit/themes/labels/symbols/loop.svg +0 -5
  285. data/cockpit/themes/labels/symbols/manipulate.svg +0 -4
  286. data/cockpit/themes/labels/symbols/otherwise.svg +0 -5
  287. data/cockpit/themes/labels/symbols/parallel.svg +0 -5
  288. data/cockpit/themes/labels/symbols/parallel_branch.svg +0 -5
  289. data/cockpit/themes/labels/symbols/parallel_branch_compact.svg +0 -4
  290. data/cockpit/themes/labels/symbols/parallel_branch_event.svg +0 -14
  291. data/cockpit/themes/labels/symbols/parallel_branch_normal.svg +0 -5
  292. data/cockpit/themes/labels/symbols/scripts.svg +0 -4
  293. data/cockpit/themes/labels/symbols/start.svg +0 -3
  294. data/cockpit/themes/labels/symbols/stop.svg +0 -5
  295. data/cockpit/themes/labels/symbols/terminate.svg +0 -4
  296. data/cockpit/themes/packed/rngs/alternative.rng +0 -1
  297. data/cockpit/themes/packed/rngs/choose.rng +0 -1
  298. data/cockpit/themes/packed/rngs/critical.rng +0 -1
  299. data/cockpit/themes/packed/rngs/escape.rng +0 -1
  300. data/cockpit/themes/packed/rngs/group.rng +0 -1
  301. data/cockpit/themes/packed/rngs/loop.rng +0 -1
  302. data/cockpit/themes/packed/rngs/manipulate.rng +0 -1
  303. data/cockpit/themes/packed/rngs/otherwise.rng +0 -1
  304. data/cockpit/themes/packed/rngs/parallel.rng +0 -1
  305. data/cockpit/themes/packed/rngs/parallel_branch.rng +0 -1
  306. data/cockpit/themes/packed/rngs/stop.rng +0 -1
  307. data/cockpit/themes/packed/rngs/terminate.rng +0 -1
  308. data/cockpit/themes/preset/rngs/alternative.rng +0 -1
  309. data/cockpit/themes/preset/rngs/choose.rng +0 -1
  310. data/cockpit/themes/preset/rngs/critical.rng +0 -1
  311. data/cockpit/themes/preset/rngs/escape.rng +0 -1
  312. data/cockpit/themes/preset/rngs/group.rng +0 -1
  313. data/cockpit/themes/preset/rngs/loop.rng +0 -1
  314. data/cockpit/themes/preset/rngs/manipulate.rng +0 -1
  315. data/cockpit/themes/preset/rngs/otherwise.rng +0 -1
  316. data/cockpit/themes/preset/rngs/parallel.rng +0 -1
  317. data/cockpit/themes/preset/rngs/parallel_branch.rng +0 -1
  318. data/cockpit/themes/preset/rngs/stop.rng +0 -1
  319. data/cockpit/themes/preset/rngs/terminate.rng +0 -1
  320. data/lib/cpee/empty_workflow.rb +0 -28
  321. data/lib/cpee/handler_notifications.rb +0 -47
  322. data/lib/cpee/handler_properties.rb +0 -50
  323. data/lib/cpee/instantiation.rb +0 -369
  324. data/lib/cpee/processtransformation/bpel/Repository/booking.bpel +0 -125
  325. data/lib/cpee/processtransformation/bpel/Repository/booking.wsdl +0 -72
  326. data/lib/cpee/processtransformation/bpel/Repository/booking/airline.wsdl +0 -71
  327. data/lib/cpee/processtransformation/bpel/Repository/booking/hotel.wsdl +0 -64
  328. data/lib/cpee/processtransformation/bpel/Repository/booking/report.wsdl +0 -71
  329. data/lib/cpee/processtransformation/bpel/bpel2wee.rb +0 -34
  330. data/lib/cpee/processtransformation/bpel/bpelserver.ru +0 -64
  331. data/lib/cpee/processtransformation/bpel/bpelserver.xml +0 -70
  332. data/lib/cpee/processtransformation/bpel/lib/BPEL_Transform.rb +0 -367
  333. data/lib/cpee/processtransformation/bpmn2.rb +0 -297
  334. data/lib/cpee/processtransformation/cpee.rb +0 -119
  335. data/lib/cpee/processtransformation/structures.rb +0 -465
  336. data/lib/cpee/processtransformation/target.rb +0 -50
  337. data/log/azure.rb +0 -10
  338. data/log/azure_logger.rb +0 -136
  339. data/log/chain.xml +0 -27
  340. data/log/elasticsearch.rb +0 -15
  341. data/log/elasticsearch_logging.rb +0 -377
  342. data/log/legacy/test_es.rb +0 -26
  343. data/log/legacy/test_split.rb +0 -211
  344. data/log/log.xml +0 -13
  345. data/log/non_tamp.rb +0 -156
  346. data/log/sic.rb +0 -64
  347. data/log/template.xes_xml +0 -23
  348. data/log/template.xes_yaml +0 -28
  349. data/log/trace.yaml +0 -17717
  350. data/log/trace_sic.yaml +0 -18343
  351. data/log/xes_xml.rb +0 -121
  352. data/log/xes_yaml.rb +0 -96
  353. data/server/handlerwrappers/soap.rb +0 -146
  354. data/server/resources/properties.schema.active +0 -139
  355. data/server/resources/properties.schema.finished +0 -139
  356. data/server/resources/properties.schema.inactive +0 -136
  357. data/test/callback.rb +0 -9
@@ -13,39 +13,70 @@
13
13
  # <http://www.gnu.org/licenses/>.
14
14
 
15
15
  require 'fileutils'
16
+ require 'redis'
16
17
  require 'riddl/server'
17
18
  require 'riddl/client'
18
- require 'riddl/utils/notifications_producer'
19
- require 'riddl/utils/properties'
20
- require_relative 'controller'
21
-
22
- require 'ostruct'
23
- class ParaStruct < OpenStruct
24
- def to_json(*a)
25
- table.to_json
26
- end
27
- end
28
- def →(a); ParaStruct.new(a); end
29
- def ⭐(a); ParaStruct.new(a); end
19
+ require_relative 'message'
20
+ require_relative 'persistence'
21
+ require_relative 'statemachine'
22
+ require_relative 'implementation_properties'
23
+ require_relative 'implementation_notifications'
24
+ require_relative 'implementation_callbacks'
30
25
 
31
26
  module CPEE
32
27
 
33
28
  SERVER = File.expand_path(File.join(__dir__,'..','cpee.xml'))
34
-
29
+ PROPERTIES_PATHS_FULL = %w{
30
+ /p:properties/p:handlerwrapper
31
+ /p:properties/p:positions/p:*
32
+ /p:properties/p:positions/p:*/@*
33
+ /p:properties/p:dataelements/p:*
34
+ /p:properties/p:endpoints/p:*
35
+ /p:properties/p:attributes/p:*
36
+ /p:properties/p:transformation/p:*
37
+ /p:properties/p:transformation/p:*/@*
38
+ /p:properties/p:description
39
+ /p:properties/p:dslx
40
+ /p:properties/p:dsl
41
+ /p:properties/p:status/p:id
42
+ /p:properties/p:status/p:message
43
+ /p:properties/p:state/@changed
44
+ /p:properties/p:state
45
+ }
46
+ PROPERTIES_PATHS_INDEX_UNORDERED = %w{
47
+ /p:properties/p:positions/p:*
48
+ }
49
+ PROPERTIES_PATHS_INDEX_ORDERED = %w{
50
+ /p:properties/p:dataelements/p:*
51
+ /p:properties/p:endpoints/p:*
52
+ /p:properties/p:attributes/p:*
53
+ }
35
54
  def self::implementation(opts)
36
55
  opts[:instances] ||= File.expand_path(File.join(__dir__,'..','..','server','instances'))
37
56
  opts[:global_handlerwrappers] ||= File.expand_path(File.join(__dir__,'..','..','server','handlerwrappers'))
38
57
  opts[:handlerwrappers] ||= ''
39
58
  opts[:topics] ||= File.expand_path(File.join(__dir__,'..','..','server','resources','topics.xml'))
40
59
  opts[:properties_init] ||= File.expand_path(File.join(__dir__,'..','..','server','resources','properties.init'))
41
- opts[:properties_schema_active] ||= File.expand_path(File.join(__dir__,'..','..','server','resources','properties.schema.active'))
42
- opts[:properties_schema_finished] ||= File.expand_path(File.join(__dir__,'..','..','server','resources','properties.schema.finished'))
43
- opts[:properties_schema_inactive] ||= File.expand_path(File.join(__dir__,'..','..','server','resources','properties.schema.inactive'))
60
+ opts[:properties_empty] ||= File.expand_path(File.join(__dir__,'..','..','server','resources','properties.empty'))
44
61
  opts[:transformation_dslx] ||= File.expand_path(File.join(__dir__,'..','..','server','resources','transformation_dslx.xsl'))
45
62
  opts[:transformation_service] ||= File.expand_path(File.join(__dir__,'..','..','server','resources','transformation.xml'))
46
63
  opts[:empty_dslx] ||= File.expand_path(File.join(__dir__,'..','..','server','resources','empty_dslx.xml'))
47
64
  opts[:notifications_init] ||= File.expand_path(File.join(__dir__,'..','..','server','resources','notifications'))
65
+ opts[:states] ||= File.expand_path(File.join(__dir__,'..','..','server','resources','states.xml'))
66
+ opts[:backend_run] ||= File.expand_path(File.join(__dir__,'..','..','server','resources','backend','run'))
67
+ opts[:backend_template] ||= File.expand_path(File.join(__dir__,'..','..','server','resources','backend','instance.template'))
68
+ opts[:backend_opts] ||= 'opts.yaml'
69
+ opts[:watchdog_frequency] ||= 7
70
+ opts[:watchdog_start_off] ||= false
71
+ opts[:backend_instance] ||= 'instance.rb'
48
72
  opts[:infinite_loop_stop] ||= 10000
73
+ opts[:redis_path] ||= '/tmp/redis.sock'
74
+ opts[:redis_db] ||= 3
75
+
76
+ opts[:redis] = Redis.new(path: opts[:redis_path], db: opts[:redis_db])
77
+ opts[:statemachine] = CPEE::StateMachine.new opts[:states], %w{running simulating replaying finishing stopping abandoned finished} do |id|
78
+ opts[:redis].get("instance:#{id}/state")
79
+ end
49
80
 
50
81
  opts[:runtime_cmds] << [
51
82
  "startclean", "Delete instances before starting.", Proc.new { |status|
@@ -56,94 +87,80 @@ module CPEE
56
87
  ]
57
88
 
58
89
  Proc.new do
59
- Dir[opts[:global_handlerwrappers] + "/*.rb"].each do |h|
60
- require h
61
- end unless opts[:global_handlerwrappers].strip == ''
62
- Dir[opts[:handlerwrappers] + "/*.rb"].each do |h|
63
- require h
64
- end unless opts[:handlerwrappers].strip == ''
90
+ parallel do
91
+ CPEE::watch_services(@riddl_opts[:watchdog_start_off])
92
+ EM.add_periodic_timer(@riddl_opts[:watchdog_frequency]) do
93
+ CPEE::watch_services(@riddl_opts[:watchdog_start_off])
94
+ end
95
+ end
96
+ cleanup do
97
+ CPEE::cleanup_services(@riddl_opts[:watchdog_start_off])
98
+ end
65
99
 
66
- controller = {}
67
- Dir[File.join(opts[:instances],'*','properties.xml')].each do |e|
68
- id = ::File::basename(::File::dirname(e))
69
- (controller[id.to_i] = (Controller.new(id,opts)) rescue nil)
100
+ interface 'main' do
101
+ run CPEE::Instances, opts if get '*'
102
+ run CPEE::NewInstance, opts if post 'instance-new'
103
+ on resource '\d+' do |r|
104
+ run CPEE::Info, opts if get
105
+ run CPEE::DeleteInstance, opts if delete
106
+ end
70
107
  end
71
108
 
72
109
  interface 'properties' do |r|
73
110
  id = r[:h]['RIDDL_DECLARATION_PATH'].split('/')[1].to_i
74
- use Riddl::Utils::Properties::implementation(controller[id].properties, PropertiesHandler.new(controller[id]), opts[:mode]) if controller[id]
111
+ use CPEE::Properties::implementation(id.to_i, opts)
75
112
  end
76
113
 
77
- interface 'main' do
78
- run CPEE::Instances, controller if get '*'
79
- run CPEE::NewInstance, controller, opts if post 'instance-new'
80
- run CPEE::NewXMLInstance, controller, opts if post 'instance-new-xml'
81
- on resource do |r|
82
- run CPEE::Info, controller if get
83
- run CPEE::DeleteInstance, controller, opts if delete
84
- on resource 'console' do
85
- run CPEE::ConsoleUI, controller if get
86
- run CPEE::Console, controller if get 'cmdin'
87
- end
88
- on resource 'callbacks' do
89
- run CPEE::Callbacks, controller, opts if get
90
- on resource do
91
- run CPEE::ExCallback, controller if get || put || post || delete
92
- end
93
- end
94
- end
114
+ interface 'notifications' do |r|
115
+ id = r[:h]['RIDDL_DECLARATION_PATH'].split('/')[1].to_i
116
+ use CPEE::Notifications::implementation(id.to_i, opts)
95
117
  end
96
118
 
97
- interface 'notifications' do |r|
119
+ interface 'callbacks' do |r|
98
120
  id = r[:h]['RIDDL_DECLARATION_PATH'].split('/')[1].to_i
99
- use Riddl::Utils::Notifications::Producer::implementation(controller[id].notifications, NotificationsHandler.new(controller[id]), opts[:mode]) if controller[id]
121
+ use CPEE::Callbacks::implementation(id.to_i, opts)
100
122
  end
101
123
  end
102
124
  end
103
125
 
104
- class ExCallback < Riddl::Implementation #{{{
105
- def response
106
- controller = @a[0]
107
- id = @r[0].to_i
108
- callback = @r[2]
109
- controller[id].mutex.synchronize do
110
- if controller[id].callbacks.has_key?(callback)
111
- controller[id].callbacks[callback].callback(@p,@h)
112
- else
113
- @status = 503
114
- end
115
- end
126
+ def self::watch_services(watchdog_start_off)
127
+ return if watchdog_start_off
128
+ EM.defer do
129
+ Dir[File.join(__dir__,'..','..','server','routing','*.rb')].each do |s|
130
+ s = s.sub(/\.rb$/,'')
131
+ pid = (File.read(s + '.pid').to_i rescue nil)
132
+ if (pid.nil? || !(Process.kill(0, pid) rescue false)) && !File.exist?(s + '.lock')
133
+ system "#{s}.rb restart 1>/dev/null 2>&1"
134
+ puts "➡ Service #{File.basename(s,'.rb')} started ..."
135
+ end
136
+ end
116
137
  end
117
- end #}}}
118
-
119
- class Callbacks < Riddl::Implementation #{{{
120
- def response
121
- controller = @a[0]
122
- opts = @a[1]
123
- id = @r[0].to_i
124
- unless controller[id]
125
- @status = 400
126
- return
127
- end
128
- Riddl::Parameter::Complex.new("info","text/xml") do
129
- cb = XML::Smart::string("<callbacks details='#{opts[:mode]}'/>")
130
- if opts[:mode] == :debug
131
- controller[id].callbacks.each do |k,v|
132
- cb.root.add("callback",{"id" => k},"[#{v.protocol.to_s}] #{v.info}")
133
- end
134
- end
135
- cb.to_s
138
+ end
139
+ def self::cleanup_services(watchdog_start_off)
140
+ return if watchdog_start_off
141
+ Dir[File.join(__dir__,'..','..','server','routing','*.rb')].each do |s|
142
+ s = s.sub(/\.rb$/,'')
143
+ pid = (File.read(s + '.pid').to_i rescue nil)
144
+ if !pid.nil? || (Process.kill(0, pid) rescue false)
145
+ system "#{s}.rb stop 1>/dev/null 2>&1"
146
+ puts "➡ Service #{File.basename(s,'.rb')} stopped ..."
136
147
  end
137
148
  end
138
- end #}}}
149
+ end
139
150
 
140
151
  class Instances < Riddl::Implementation #{{{
141
152
  def response
142
- controller = @a[0]
153
+ redis = @a[0][:redis]
143
154
  Riddl::Parameter::Complex.new("wis","text/xml") do
144
155
  ins = XML::Smart::string('<instances/>')
145
- controller.sort{|a,b| b[0] <=> a[0] }.each do |k,v|
146
- ins.root.add('instance', v.info, 'uuid' => v.uuid, 'id' => k, 'state' => v.state, 'state_changed' => v.state_changed ) unless v.nil?
156
+ redis.zrevrange('instances',0,-1).each do |instance|
157
+ statekey = "instance:#{instance}/state"
158
+ attributes = "instance:#{instance}/attributes/"
159
+ info = redis.get(attributes + 'info')
160
+ uuid = redis.get(attributes + 'uuid')
161
+ state = redis.get(statekey)
162
+ state_changed = redis.get(File.join(statekey,'@changed'))
163
+ ins.root.add('instance', info, 'uuid' => uuid, 'id' => instance, 'state' => state, 'state_changed' => state_changed )
147
164
  end
148
165
  ins.to_s
149
166
  end
@@ -151,70 +168,82 @@ module CPEE
151
168
  end #}}}
152
169
 
153
170
  class NewInstance < Riddl::Implementation #{{{
154
- def response
155
- controller = @a[0]
156
- opts = @a[1]
157
- name = @p[0].value
158
- id = controller.keys.sort.last.to_i
159
-
160
- while true
161
- id += 1
162
- unless Dir.exists? opts[:instances] + "/#{id}"
163
- Dir.mkdir(opts[:instances] + "/#{id}") rescue nil
164
- break
165
- end
171
+ def path(e)
172
+ ret = []
173
+ until e.qname.name == 'properties'
174
+ ret << (e.class == XML::Smart::Dom::Attribute ? '@' : '') + e.qname.name
175
+ e = e.parent
166
176
  end
167
-
168
- controller[id] = Controller.new(id,opts)
169
- controller[id].info = name
170
- controller[id].state_change!
171
-
172
- @headers << Riddl::Header.new("CPEE-INSTANCE", controller[id].instance)
173
- @headers << Riddl::Header.new("CPEE-INSTANCE-URL", controller[id].instance_url)
174
- @headers << Riddl::Header.new("CPEE-INSTANCE-UUID", controller[id].uuid)
175
-
176
- Riddl::Parameter::Simple.new("id", id)
177
+ File.join(*ret.reverse)
177
178
  end
178
- end #}}}
179
- class NewXMLInstance < Riddl::Implementation #{{{
180
- def response
181
- controller = @a[0]
182
- opts = @a[1]
183
- xml = @p[0].value.read
184
- id = controller.keys.sort.last.to_i
185
-
186
179
 
187
- while true
188
- id += 1
189
- unless Dir.exists? opts[:instances] + "/#{id}"
190
- Dir.mkdir(opts[:instances] + "/#{id}") rescue nil
191
- break
180
+ def response
181
+ opts = @a[0]
182
+ redis = opts[:redis]
183
+ doc = XML::Smart::open_unprotected(opts[:properties_init])
184
+ doc.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
185
+ name = @p[0].value
186
+ id = redis.zcount('instances','-inf','+inf').to_i + 1
187
+ uuid = SecureRandom.uuid
188
+ instance = 'instance:' + id.to_s
189
+ redis.multi do |multi|
190
+ multi.zadd('instances',id,id)
191
+ doc.root.find(PROPERTIES_PATHS_FULL.join(' | ')).each do |e|
192
+ if e.class == XML::Smart::Dom::Element && e.element_only?
193
+ val = e.find('*').map { |f| f.dump }.join
194
+ multi.set(File.join(instance, path(e)), val)
195
+ else
196
+ multi.set(File.join(instance, path(e)), e.text)
197
+ end
198
+ end
199
+ doc.root.find(PROPERTIES_PATHS_INDEX_UNORDERED.join(' | ')).each do |e|
200
+ p = path(e)
201
+ multi.sadd(File.join(instance, File.dirname(p)), File.basename(p))
202
+ end
203
+ doc.root.find(PROPERTIES_PATHS_INDEX_ORDERED.join(' | ')).each_with_index do |e,i|
204
+ p = path(e)
205
+ multi.zadd(File.join(instance, File.dirname(p)), i, File.basename(p))
192
206
  end
207
+ Dir[File.join(opts[:notifications_init],'*','subscription.xml')].each do |f|
208
+ XML::Smart::open_unprotected(f) do |doc|
209
+ doc.register_namespace 'np', 'http://riddl.org/ns/common-patterns/notifications-producer/2.0'
210
+ key = File.basename(File.dirname(f))
211
+ url = doc.find('string(/np:subscription/@url)')
212
+ multi.sadd("instance:#{id}/handlers",key)
213
+ multi.set("instance:#{id}/handlers/#{key}/url",url)
214
+ doc.find('/np:subscription/np:topic/*').each do |e|
215
+ c = File.join(e.parent.attributes['id'],e.qname.name,e.text)
216
+ multi.sadd("instance:#{id}/handlers/#{key}",c)
217
+ multi.sadd("instance:#{id}/handlers/#{c}",key)
218
+ end
219
+ end rescue nil # all the ones that are not ok, are ignored
220
+ end
221
+ multi.set(File.join(instance, 'attributes', 'uuid'), SecureRandom.uuid)
222
+ multi.zadd(File.join(instance, 'attributes'), -2, 'uuid')
223
+ multi.set(File.join(instance, 'attributes', 'info'), name)
224
+ multi.zadd(File.join(instance, 'attributes'), -1, 'info')
225
+ multi.set(File.join(instance, 'state', '@changed'), Time.now.xmlschema(3))
193
226
  end
194
- File.write(File.join(opts[:instances].to_s,id.to_s,'properties.xml'),xml)
195
227
 
196
- controller[id] = Controller.new(id,opts)
197
- controller[id].state_change!
228
+ @headers << Riddl::Header.new("CPEE-INSTANCE", id.to_s)
229
+ @headers << Riddl::Header.new("CPEE-INSTANCE-URL", File.join(opts[:url].to_s,id.to_s))
230
+ @headers << Riddl::Header.new("CPEE-INSTANCE-UUID", uuid)
198
231
 
199
- @headers << Riddl::Header.new("CPEE-INSTANCE", controller[id].instance)
200
- @headers << Riddl::Header.new("CPEE-INSTANCE-URL", controller[id].instance_url)
201
- @headers << Riddl::Header.new("CPEE-INSTANCE-UUID", controller[id].uuid)
202
-
203
- Riddl::Parameter::Simple.new("id", id)
232
+ Riddl::Parameter::Simple.new("id", id.to_s)
204
233
  end
205
234
  end #}}}
206
235
 
207
236
  class Info < Riddl::Implementation #{{{
208
237
  def response
209
- controller = @a[0]
238
+ opts = @a[0]
210
239
  id = @r[0].to_i
211
- unless controller[id]
212
- @status = 400
240
+ unless opts[:redis].exists?("instance:#{id}/state")
241
+ @status = 404
213
242
  return
214
243
  end
215
244
  Riddl::Parameter::Complex.new("info","text/xml") do
216
245
  i = XML::Smart::string <<-END
217
- <info instance='#{@r[0]}'>
246
+ <info instance='#{id}'>
218
247
  <notifications/>
219
248
  <properties/>
220
249
  <callbacks/>
@@ -225,73 +254,20 @@ module CPEE
225
254
  end
226
255
  end #}}}
227
256
 
228
- class ConsoleUI < Riddl::Implementation #{{{
229
- def response
230
- controller = @a[0]
231
- id = @r[0].to_i
232
- unless controller[id]
233
- @status = 400
234
- return
235
- end
236
- Riddl::Parameter::Complex.new("res","text/html") do
237
- <<-END
238
- <!DOCTYPE html>
239
- <html>
240
- <head>
241
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
242
- <title>Instance Web Console</title>
243
- <style type="text/css">
244
- [contenteditable] { display: inline; }
245
- [contenteditable]:focus { outline: 0px solid transparent; }
246
- body{ font-family: Courier,Courier New,Monospace}
247
- </style>
248
- <script type="text/javascript" src="//#{controller[id].host}/js_libs/jquery.min.js"></script>
249
- <script type="text/javascript" src="//#{controller[id].host}/js_libs/ansi_up.js"></script>
250
- <script type="text/javascript" src="//#{controller[id].host}/js_libs/console.js"></script>
251
- </head>
252
- <body>
253
- <p>Instance Web Console. Type "help" to get started.</p>
254
- <div class="console-line" id="console-template" style="display: none">
255
- <strong>console$&nbsp;</strong><div class='edit' contenteditable="true" ></div>
256
- </div>
257
- <div class="console-line">
258
- <strong>console$&nbsp;</strong><div class='edit' contenteditable="true"></div>
259
- </div>
260
- </body>
261
- </html>
262
- END
263
- end
264
- end
265
- end #}}}
266
- class Console < Riddl::Implementation #{{{
267
- def response
268
- controller = @a[0]
269
- id = @r[0].to_i
270
- unless controller[id]
271
- @status = 400
272
- return
273
- end
274
- Riddl::Parameter::Complex.new("res","text/plain") do
275
- begin
276
- controller[id].console(@p[0].value)
277
- rescue => e
278
- e.message
279
- end
280
- end
281
- end
282
- end #}}}
283
-
284
257
  class DeleteInstance < Riddl::Implementation #{{{
285
258
  def response
286
- controller = @a[0]
287
- opts = @a[1]
259
+ opts = @a[0]
260
+ redis = opts[:redis]
288
261
  id = @r[0].to_i
289
- unless controller[id]
290
- @status = 400
262
+ unless redis.exists?("instance:#{id}/state")
263
+ @status = 404
291
264
  return
292
265
  end
293
- controller.delete(id)
294
- FileUtils.rm_r(opts[:instances] + "/#{@r[0]}")
266
+ empt = redis.keys("instance:#{id}/*").to_a
267
+ redis.multi do |multi|
268
+ multi.del empt
269
+ multi.zrem 'instances', id
270
+ end
295
271
  end
296
272
  end #}}}
297
273
 
@@ -0,0 +1,77 @@
1
+ require 'json'
2
+
3
+ module CPEE
4
+ module Callbacks
5
+
6
+ def self::implementation(id,opts)
7
+ Proc.new do
8
+ run CPEE::Callbacks::Callbacks, id, opts if get
9
+ on resource do
10
+ run CPEE::Callbacks::ExCallback, id, opts if put
11
+ end
12
+ end
13
+ end
14
+
15
+ class Callbacks < Riddl::Implementation #{{{
16
+ def response
17
+ id = @a[0]
18
+ opts = @a[1]
19
+ Riddl::Parameter::Complex.new("callbacks","text/xml") do
20
+ ret = XML::Smart::string <<-END
21
+ <callbacks/>
22
+ END
23
+ CPEE::Persistence::extract_set(id,opts,'callbacks').each do |de|
24
+ ret.root.add('callback', de[1], :id => de[0])
25
+ end
26
+ ret.to_s
27
+ end
28
+ end
29
+ end #}}}
30
+
31
+ class ExCallback < Riddl::Implementation #{{{
32
+ def response
33
+ id = @a[0]
34
+ opts = @a[1]
35
+ callback = @r[-1]
36
+
37
+ if opts[:redis].get("instance:#{id}/callback/#{callback}/type") == 'callback'
38
+ ret = {}
39
+ ret['values'] = @p.map{ |e|
40
+ [e.name, e.class == Riddl::Parameter::Simple ? [:simple,e.value] : [:complex,e.mimetype,e.value.path] ]
41
+ }
42
+ ret['headers'] = @h
43
+
44
+ CPEE::Message::send(
45
+ :'callback-response',
46
+ callback,
47
+ opts[:url],
48
+ id,
49
+ {},
50
+ {},
51
+ ret,
52
+ opts[:redis]
53
+ )
54
+ elsif opts[:redis].get("instance:#{id}/callback/#{callback}/type") == 'vote'
55
+ if @p.length == 1 && @p[0].name == 'continue' && @p[0].class == Riddl::Parameter::Simple
56
+ CPEE::Message::send(
57
+ :'vote-response',
58
+ callback,
59
+ opts[:url],
60
+ id,
61
+ {},
62
+ {},
63
+ @p[0].value,
64
+ opts[:redis]
65
+ )
66
+ else
67
+ @status = 400
68
+ end
69
+ else
70
+ @status = 503
71
+ end
72
+ nil
73
+ end
74
+ end #}}}
75
+
76
+ end
77
+ end