cpee 1.5.24 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (360) 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 +8 -8
  7. data/cockpit/js/details.js +13 -14
  8. data/cockpit/js/instance.js +192 -290
  9. data/cockpit/js/parameters.js +13 -3
  10. data/cockpit/js/ui.js +2 -2
  11. data/cockpit/rngs/attributes.rng +3 -3
  12. data/cockpit/rngs/dataelements.rng +3 -3
  13. data/cockpit/rngs/endpoints.rng +3 -3
  14. data/cockpit/{testsets → templates.legacy}/Async.xml +7 -7
  15. data/cockpit/{testsets → templates.legacy}/BCO.xml +7 -10
  16. data/cockpit/{testsets → templates.legacy}/BCS.xml +7 -10
  17. data/cockpit/{testsets → templates.legacy}/Centurio.xml +6 -6
  18. data/cockpit/{testsets → templates.legacy}/Concurrent.xml +6 -6
  19. data/cockpit/{testsets → templates.legacy}/Coopis Testset.xml +6 -6
  20. data/cockpit/{testsets → templates.legacy}/Endpoints and Data Manipulation.xml +6 -6
  21. data/cockpit/{testsets → templates.legacy}/ICSOC Testset.xml +6 -6
  22. data/cockpit/{testsets → templates.legacy}/Infinity.xml +3 -3
  23. data/cockpit/{testsets → templates.legacy}/Lego Boxer.xml +7 -7
  24. data/cockpit/{testsets → templates.legacy}/Lego Conveyor.xml +7 -7
  25. data/cockpit/{testsets → templates.legacy}/Lego Crane.xml +7 -7
  26. data/cockpit/{testsets → templates.legacy}/Lego Ejector.xml +7 -7
  27. data/cockpit/{testsets → templates.legacy}/Lego Full.xml +7 -7
  28. data/cockpit/{testsets → templates.legacy}/Lego Liddy.xml +7 -7
  29. data/cockpit/{testsets → templates.legacy}/Lego Plate.xml +7 -7
  30. data/cockpit/{testsets → templates.legacy}/Lego Transporter.xml +7 -7
  31. data/cockpit/{testsets → templates.legacy}/Lego_Part_1.xml +7 -7
  32. data/cockpit/{testsets → templates.legacy}/LgLinear.xml +6 -10
  33. data/cockpit/{testsets → templates.legacy}/Linear.xml +7 -7
  34. data/cockpit/{testsets → templates.legacy}/Log.xml +7 -7
  35. data/cockpit/{testsets → templates.legacy}/Mangler 1.xml +6 -6
  36. data/cockpit/{testsets → templates.legacy}/Mangler 2.xml +6 -6
  37. data/cockpit/{testsets → templates.legacy}/Manuel Labels.xml +7 -7
  38. data/cockpit/{testsets → templates.legacy}/Promise.xml +7 -7
  39. data/cockpit/{testsets → templates.legacy}/SOPROMO Test Sonification.xml +6 -6
  40. data/cockpit/{testsets → templates.legacy}/Subprocess.xml +7 -7
  41. data/cockpit/templates.legacy/Syncing P34 1.xml +77 -0
  42. data/cockpit/templates.legacy/Syncing P34 2.xml +77 -0
  43. data/cockpit/templates.legacy/Syncing P34 3.xml +77 -0
  44. data/cockpit/{testsets → templates.legacy}/Syncing P34.xml +8 -11
  45. data/cockpit/{testsets → templates.legacy}/TEST - Bad Loop.xml +6 -6
  46. data/cockpit/{testsets → templates.legacy}/TEST - Wrong Positions.xml +6 -6
  47. data/cockpit/{testsets → templates.legacy}/Take_5.xml +7 -7
  48. data/cockpit/{testsets → templates.legacy}/Update.xml +7 -7
  49. data/cockpit/{testsets → templates.legacy}/Worklist Parallel.xml +7 -7
  50. data/cockpit/{testsets → templates.legacy}/Worklist Test CPEE.xml +7 -7
  51. data/cockpit/{testsets → templates.legacy}/Worklist Test.xml +7 -7
  52. data/cockpit/{testsets → templates.legacy}/Worklist Test2.xml +7 -7
  53. data/cockpit/templates.legacy/convert_cpee2.rb +15 -0
  54. data/cockpit/{testsets → templates.legacy}/convert_preset.rb +0 -0
  55. data/cockpit/{testsets → templates.legacy}/testsets.xml +1 -1
  56. data/cockpit/{testsets → templates.legacy}/transformations.xml +0 -0
  57. data/cockpit/templates/BPM 2020 Manual Adjust.xml +182 -0
  58. data/cockpit/templates/BPM 2020 Solution Baseline.xml +196 -0
  59. data/cockpit/templates/BPM 2020 Solution NN.xml +197 -0
  60. data/cockpit/templates/BPM 2020 Solution View.xml +144 -0
  61. data/cockpit/templates/BPM 2020.xml +26 -0
  62. data/cockpit/templates/Coopis 2010.xml +76 -0
  63. data/cockpit/{testsets/Syncing P34 1.xml → templates/IUPC arXiv:1104.3609 P34 1.xml } +7 -10
  64. data/cockpit/{testsets/Syncing P34 2.xml → templates/IUPC arXiv:1104.3609 P34 2.xml } +7 -10
  65. data/cockpit/{testsets/Syncing P34 3.xml → templates/IUPC arXiv:1104.3609 P34 3.xml } +7 -10
  66. data/cockpit/templates/Worklist.xml +42 -0
  67. data/cockpit/templates/convert_cpee2.rb +15 -0
  68. data/cockpit/themes/compact/rngs/alternative.rng +25 -0
  69. data/cockpit/themes/compact/rngs/call.rng +19 -13
  70. data/cockpit/themes/compact/rngs/callmanipulate.rng +28 -22
  71. data/cockpit/themes/compact/rngs/choose.rng +14 -0
  72. data/cockpit/themes/compact/rngs/critical.rng +5 -0
  73. data/cockpit/themes/compact/rngs/escape.rng +1 -0
  74. data/cockpit/themes/compact/rngs/group.rng +3 -0
  75. data/cockpit/themes/compact/rngs/loop.rng +22 -0
  76. data/cockpit/themes/compact/rngs/manipulate.rng +9 -0
  77. data/cockpit/themes/compact/rngs/otherwise.rng +22 -0
  78. data/cockpit/themes/compact/rngs/parallel.rng +21 -0
  79. data/cockpit/themes/compact/rngs/parallel_branch.rng +8 -0
  80. data/cockpit/themes/compact/rngs/scripts.rng +10 -11
  81. data/cockpit/themes/compact/rngs/stop.rng +5 -0
  82. data/cockpit/themes/compact/rngs/terminate.rng +1 -0
  83. data/cockpit/themes/compact/theme.js +1 -1
  84. data/cockpit/themes/convert_cpee2.rb +8 -0
  85. data/cockpit/themes/default/rngs/alternative.rng +8 -8
  86. data/cockpit/themes/default/rngs/call.rng +84 -48
  87. data/cockpit/themes/default/rngs/callmanipulate.rng +103 -64
  88. data/cockpit/themes/default/rngs/choose.rng +5 -3
  89. data/cockpit/themes/default/rngs/critical.rng +2 -2
  90. data/cockpit/themes/default/rngs/escape.rng +1 -1
  91. data/cockpit/themes/default/rngs/group.rng +3 -3
  92. data/cockpit/themes/default/rngs/loop.rng +8 -8
  93. data/cockpit/themes/default/rngs/manipulate.rng +3 -3
  94. data/cockpit/themes/default/rngs/otherwise.rng +8 -8
  95. data/cockpit/themes/default/rngs/parallel.rng +14 -6
  96. data/cockpit/themes/default/rngs/parallel_branch.rng +2 -2
  97. data/cockpit/themes/default/rngs/scripts.rng +23 -0
  98. data/cockpit/themes/default/rngs/stop.rng +2 -2
  99. data/cockpit/themes/default/rngs/terminate.rng +1 -1
  100. data/cockpit/themes/extended/rngs/alternative.rng +25 -0
  101. data/cockpit/themes/extended/rngs/call.rng +19 -13
  102. data/cockpit/themes/extended/rngs/callmanipulate.rng +28 -22
  103. data/cockpit/themes/extended/rngs/choose.rng +14 -0
  104. data/cockpit/themes/extended/rngs/critical.rng +5 -0
  105. data/cockpit/themes/extended/rngs/escape.rng +1 -0
  106. data/cockpit/themes/extended/rngs/group.rng +3 -0
  107. data/cockpit/themes/extended/rngs/loop.rng +22 -0
  108. data/cockpit/themes/extended/rngs/manipulate.rng +9 -0
  109. data/cockpit/themes/extended/rngs/otherwise.rng +22 -0
  110. data/cockpit/themes/extended/rngs/parallel.rng +21 -0
  111. data/cockpit/themes/extended/rngs/parallel_branch.rng +8 -0
  112. data/cockpit/themes/extended/rngs/scripts.rng +10 -11
  113. data/cockpit/themes/extended/rngs/stop.rng +5 -0
  114. data/cockpit/themes/extended/rngs/terminate.rng +1 -0
  115. data/cockpit/themes/extended/theme.js +14 -28
  116. data/cockpit/themes/model/rngs/alternative.rng +1 -1
  117. data/cockpit/themes/model/rngs/call.rng +16 -16
  118. data/cockpit/themes/model/rngs/callmanipulate.rng +17 -17
  119. data/cockpit/themes/model/rngs/choose.rng +1 -1
  120. data/cockpit/themes/model/rngs/critical.rng +1 -1
  121. data/cockpit/themes/model/rngs/escape.rng +1 -1
  122. data/cockpit/themes/model/rngs/group.rng +1 -1
  123. data/cockpit/themes/model/rngs/loop.rng +1 -1
  124. data/cockpit/themes/model/rngs/manipulate.rng +1 -1
  125. data/cockpit/themes/model/rngs/otherwise.rng +1 -1
  126. data/cockpit/themes/model/rngs/parallel.rng +1 -1
  127. data/cockpit/themes/model/rngs/parallel_branch.rng +1 -1
  128. data/cockpit/themes/model/rngs/scripts.rng +3 -4
  129. data/cockpit/themes/model/rngs/stop.rng +1 -1
  130. data/cockpit/themes/model/rngs/terminate.rng +1 -1
  131. data/cockpit/themes/model/theme.js +8 -7
  132. data/cockpit/themes/packed/rngs/alternative.rng +25 -0
  133. data/cockpit/themes/packed/rngs/call.rng +19 -13
  134. data/cockpit/themes/packed/rngs/callmanipulate.rng +28 -22
  135. data/cockpit/themes/packed/rngs/choose.rng +14 -0
  136. data/cockpit/themes/packed/rngs/critical.rng +5 -0
  137. data/cockpit/themes/packed/rngs/escape.rng +1 -0
  138. data/cockpit/themes/packed/rngs/group.rng +3 -0
  139. data/cockpit/themes/packed/rngs/loop.rng +22 -0
  140. data/cockpit/themes/packed/rngs/manipulate.rng +9 -0
  141. data/cockpit/themes/packed/rngs/otherwise.rng +22 -0
  142. data/cockpit/themes/packed/rngs/parallel.rng +21 -0
  143. data/cockpit/themes/packed/rngs/parallel_branch.rng +8 -0
  144. data/cockpit/themes/packed/rngs/scripts.rng +10 -11
  145. data/cockpit/themes/packed/rngs/stop.rng +5 -0
  146. data/cockpit/themes/packed/rngs/terminate.rng +1 -0
  147. data/cockpit/themes/packed/theme.js +8 -7
  148. data/cockpit/themes/preset/rngs/alternative.rng +25 -0
  149. data/cockpit/themes/preset/rngs/call.rng +19 -13
  150. data/cockpit/themes/preset/rngs/callmanipulate.rng +28 -22
  151. data/cockpit/themes/preset/rngs/choose.rng +14 -0
  152. data/cockpit/themes/preset/rngs/critical.rng +5 -0
  153. data/cockpit/themes/preset/rngs/escape.rng +1 -0
  154. data/cockpit/themes/preset/rngs/group.rng +3 -0
  155. data/cockpit/themes/preset/rngs/loop.rng +22 -0
  156. data/cockpit/themes/preset/rngs/manipulate.rng +9 -0
  157. data/cockpit/themes/preset/rngs/otherwise.rng +22 -0
  158. data/cockpit/themes/preset/rngs/parallel.rng +21 -0
  159. data/cockpit/themes/preset/rngs/parallel_branch.rng +8 -0
  160. data/cockpit/themes/preset/rngs/scripts.rng +10 -11
  161. data/cockpit/themes/preset/rngs/stop.rng +5 -0
  162. data/cockpit/themes/preset/rngs/terminate.rng +1 -0
  163. data/cockpit/themes/preset/theme.js +8 -7
  164. data/cpee.gemspec +10 -11
  165. data/{log/topics.xml → lib/callbacks.xml} +16 -6
  166. data/lib/{engine → callbacks}/callbacks.rng +2 -8
  167. data/lib/cpee.xml +10 -4
  168. data/lib/cpee/attributes_helper.rb +27 -0
  169. data/lib/cpee/controller.rb +113 -596
  170. data/lib/cpee/implementation.rb +166 -191
  171. data/lib/cpee/implementation_callbacks.rb +77 -0
  172. data/lib/cpee/implementation_notifications.rb +189 -0
  173. data/lib/cpee/implementation_properties.rb +711 -0
  174. data/lib/cpee/{callback.rb → message.rb} +20 -18
  175. data/lib/cpee/persistence.rb +135 -0
  176. data/lib/cpee/statemachine.rb +20 -0
  177. data/lib/cpee/transform.rb +95 -0
  178. data/lib/engine.xml +1 -59
  179. data/lib/properties.xml +236 -0
  180. data/lib/properties/arbitrary.rng +26 -0
  181. data/lib/properties/attributes.rng +10 -0
  182. data/lib/properties/dataelements.rng +10 -0
  183. data/lib/properties/description.rng +8 -0
  184. data/lib/properties/dsl.rng +7 -0
  185. data/lib/properties/dslx.rng +8 -0
  186. data/lib/properties/endpoints.rng +10 -0
  187. data/lib/properties/handlerwrapper.rng +9 -0
  188. data/lib/properties/position.rng +15 -0
  189. data/lib/properties/positions.rng +10 -0
  190. data/lib/properties/properties.rng +29 -0
  191. data/lib/properties/set-properties.rng +25 -0
  192. data/lib/properties/set-some-properties.rng +45 -0
  193. data/lib/properties/simple.rng +8 -0
  194. data/lib/properties/state.rng +33 -0
  195. data/lib/properties/status.rng +12 -0
  196. data/lib/properties/t_attributes.rng +7 -0
  197. data/lib/properties/t_dataelements.rng +7 -0
  198. data/lib/properties/t_endpoints.rng +7 -0
  199. data/lib/properties/t_position.rng +7 -0
  200. data/lib/properties/t_positions.rng +7 -0
  201. data/lib/properties/t_simple.rng +7 -0
  202. data/lib/properties/t_status.rng +7 -0
  203. data/lib/properties/t_transformation.rng +7 -0
  204. data/lib/properties/transformation.rng +40 -0
  205. data/server/dev.rb +1 -0
  206. data/server/handlerwrappers/default.rb +40 -38
  207. data/server/resources/backend/README.md +17 -0
  208. data/server/resources/backend/instance.rb +23 -0
  209. data/server/resources/backend/instance.template +19 -0
  210. data/server/resources/backend/opts.yaml +6 -0
  211. data/server/resources/backend/run +33 -0
  212. data/server/resources/notifications/logging/subscription.xml +1 -1
  213. data/server/resources/properties.empty +38 -0
  214. data/server/resources/properties.init +11 -11
  215. data/server/resources/states.dot +19 -0
  216. data/server/resources/states.xml +49 -0
  217. data/server/resources/transformation_dslx.xsl +12 -3
  218. data/server/routing/end.rb +44 -0
  219. data/server/routing/forward-events.rb +59 -0
  220. data/server/routing/forward-votes.rb +108 -0
  221. data/server/routing/persist.rb +155 -0
  222. data/server/server.rb +1 -0
  223. data/tools/cpee +19 -15
  224. metadata +127 -177
  225. data/INSTALL +0 -23
  226. data/cockpit/test.html +0 -40
  227. data/cockpit/themes/compact/rngs/alternative.rng +0 -1
  228. data/cockpit/themes/compact/rngs/choose.rng +0 -1
  229. data/cockpit/themes/compact/rngs/critical.rng +0 -1
  230. data/cockpit/themes/compact/rngs/escape.rng +0 -1
  231. data/cockpit/themes/compact/rngs/group.rng +0 -1
  232. data/cockpit/themes/compact/rngs/loop.rng +0 -1
  233. data/cockpit/themes/compact/rngs/manipulate.rng +0 -1
  234. data/cockpit/themes/compact/rngs/otherwise.rng +0 -1
  235. data/cockpit/themes/compact/rngs/parallel.rng +0 -1
  236. data/cockpit/themes/compact/rngs/parallel_branch.rng +0 -1
  237. data/cockpit/themes/compact/rngs/stop.rng +0 -1
  238. data/cockpit/themes/compact/rngs/terminate.rng +0 -1
  239. data/cockpit/themes/default/rngs/finalize.rng +0 -6
  240. data/cockpit/themes/default/rngs/update.rng +0 -6
  241. data/cockpit/themes/default/theme.js +0 -1286
  242. data/cockpit/themes/extended/rngs/alternative.rng +0 -1
  243. data/cockpit/themes/extended/rngs/choose.rng +0 -1
  244. data/cockpit/themes/extended/rngs/critical.rng +0 -1
  245. data/cockpit/themes/extended/rngs/escape.rng +0 -1
  246. data/cockpit/themes/extended/rngs/group.rng +0 -1
  247. data/cockpit/themes/extended/rngs/loop.rng +0 -1
  248. data/cockpit/themes/extended/rngs/manipulate.rng +0 -1
  249. data/cockpit/themes/extended/rngs/otherwise.rng +0 -1
  250. data/cockpit/themes/extended/rngs/parallel.rng +0 -1
  251. data/cockpit/themes/extended/rngs/parallel_branch.rng +0 -1
  252. data/cockpit/themes/extended/rngs/stop.rng +0 -1
  253. data/cockpit/themes/extended/rngs/terminate.rng +0 -1
  254. data/cockpit/themes/labels/rngs/alternative.rng +0 -25
  255. data/cockpit/themes/labels/rngs/call.rng +0 -81
  256. data/cockpit/themes/labels/rngs/callmanipulate.rng +0 -101
  257. data/cockpit/themes/labels/rngs/choose.rng +0 -12
  258. data/cockpit/themes/labels/rngs/critical.rng +0 -5
  259. data/cockpit/themes/labels/rngs/escape.rng +0 -1
  260. data/cockpit/themes/labels/rngs/finalize.rng +0 -6
  261. data/cockpit/themes/labels/rngs/group.rng +0 -3
  262. data/cockpit/themes/labels/rngs/loop.rng +0 -22
  263. data/cockpit/themes/labels/rngs/manipulate.rng +0 -9
  264. data/cockpit/themes/labels/rngs/otherwise.rng +0 -22
  265. data/cockpit/themes/labels/rngs/parallel.rng +0 -13
  266. data/cockpit/themes/labels/rngs/parallel_branch.rng +0 -8
  267. data/cockpit/themes/labels/rngs/stop.rng +0 -5
  268. data/cockpit/themes/labels/rngs/terminate.rng +0 -1
  269. data/cockpit/themes/labels/rngs/update.rng +0 -6
  270. data/cockpit/themes/labels/symbols/alternative.svg +0 -5
  271. data/cockpit/themes/labels/symbols/arrow.svg +0 -3
  272. data/cockpit/themes/labels/symbols/call.svg +0 -6
  273. data/cockpit/themes/labels/symbols/callmanipulate.svg +0 -8
  274. data/cockpit/themes/labels/symbols/choose.svg +0 -5
  275. data/cockpit/themes/labels/symbols/choose_exclusive.svg +0 -5
  276. data/cockpit/themes/labels/symbols/choose_inclusive.svg +0 -4
  277. data/cockpit/themes/labels/symbols/complex.svg +0 -8
  278. data/cockpit/themes/labels/symbols/critical.svg +0 -4
  279. data/cockpit/themes/labels/symbols/end.svg +0 -3
  280. data/cockpit/themes/labels/symbols/escape.svg +0 -5
  281. data/cockpit/themes/labels/symbols/event_end.svg +0 -3
  282. data/cockpit/themes/labels/symbols/loop.svg +0 -5
  283. data/cockpit/themes/labels/symbols/manipulate.svg +0 -4
  284. data/cockpit/themes/labels/symbols/otherwise.svg +0 -5
  285. data/cockpit/themes/labels/symbols/parallel.svg +0 -5
  286. data/cockpit/themes/labels/symbols/parallel_branch.svg +0 -5
  287. data/cockpit/themes/labels/symbols/parallel_branch_compact.svg +0 -4
  288. data/cockpit/themes/labels/symbols/parallel_branch_event.svg +0 -14
  289. data/cockpit/themes/labels/symbols/parallel_branch_normal.svg +0 -5
  290. data/cockpit/themes/labels/symbols/scripts.svg +0 -4
  291. data/cockpit/themes/labels/symbols/start.svg +0 -3
  292. data/cockpit/themes/labels/symbols/stop.svg +0 -5
  293. data/cockpit/themes/labels/symbols/terminate.svg +0 -4
  294. data/cockpit/themes/packed/rngs/alternative.rng +0 -1
  295. data/cockpit/themes/packed/rngs/choose.rng +0 -1
  296. data/cockpit/themes/packed/rngs/critical.rng +0 -1
  297. data/cockpit/themes/packed/rngs/escape.rng +0 -1
  298. data/cockpit/themes/packed/rngs/group.rng +0 -1
  299. data/cockpit/themes/packed/rngs/loop.rng +0 -1
  300. data/cockpit/themes/packed/rngs/manipulate.rng +0 -1
  301. data/cockpit/themes/packed/rngs/otherwise.rng +0 -1
  302. data/cockpit/themes/packed/rngs/parallel.rng +0 -1
  303. data/cockpit/themes/packed/rngs/parallel_branch.rng +0 -1
  304. data/cockpit/themes/packed/rngs/stop.rng +0 -1
  305. data/cockpit/themes/packed/rngs/terminate.rng +0 -1
  306. data/cockpit/themes/preset/rngs/alternative.rng +0 -1
  307. data/cockpit/themes/preset/rngs/choose.rng +0 -1
  308. data/cockpit/themes/preset/rngs/critical.rng +0 -1
  309. data/cockpit/themes/preset/rngs/escape.rng +0 -1
  310. data/cockpit/themes/preset/rngs/group.rng +0 -1
  311. data/cockpit/themes/preset/rngs/loop.rng +0 -1
  312. data/cockpit/themes/preset/rngs/manipulate.rng +0 -1
  313. data/cockpit/themes/preset/rngs/otherwise.rng +0 -1
  314. data/cockpit/themes/preset/rngs/parallel.rng +0 -1
  315. data/cockpit/themes/preset/rngs/parallel_branch.rng +0 -1
  316. data/cockpit/themes/preset/rngs/stop.rng +0 -1
  317. data/cockpit/themes/preset/rngs/terminate.rng +0 -1
  318. data/lib/cpee/empty_workflow.rb +0 -28
  319. data/lib/cpee/handler_notifications.rb +0 -47
  320. data/lib/cpee/handler_properties.rb +0 -50
  321. data/lib/cpee/instantiation.rb +0 -369
  322. data/lib/cpee/processtransformation/bpel/Repository/booking.bpel +0 -125
  323. data/lib/cpee/processtransformation/bpel/Repository/booking.wsdl +0 -72
  324. data/lib/cpee/processtransformation/bpel/Repository/booking/airline.wsdl +0 -71
  325. data/lib/cpee/processtransformation/bpel/Repository/booking/hotel.wsdl +0 -64
  326. data/lib/cpee/processtransformation/bpel/Repository/booking/report.wsdl +0 -71
  327. data/lib/cpee/processtransformation/bpel/bpel2wee.rb +0 -34
  328. data/lib/cpee/processtransformation/bpel/bpelserver.ru +0 -64
  329. data/lib/cpee/processtransformation/bpel/bpelserver.xml +0 -70
  330. data/lib/cpee/processtransformation/bpel/lib/BPEL_Transform.rb +0 -367
  331. data/lib/cpee/processtransformation/bpmn2.rb +0 -297
  332. data/lib/cpee/processtransformation/cpee.rb +0 -119
  333. data/lib/cpee/processtransformation/structures.rb +0 -465
  334. data/lib/cpee/processtransformation/target.rb +0 -50
  335. data/log/azure.rb +0 -10
  336. data/log/azure_logger.rb +0 -136
  337. data/log/chain.xml +0 -27
  338. data/log/elasticsearch.rb +0 -15
  339. data/log/elasticsearch_logging.rb +0 -377
  340. data/log/legacy/test_es.rb +0 -26
  341. data/log/legacy/test_split.rb +0 -211
  342. data/log/log.xml +0 -13
  343. data/log/non_tamp.rb +0 -156
  344. data/log/sic.rb +0 -63
  345. data/log/template.xes_xml +0 -23
  346. data/log/template.xes_yaml +0 -28
  347. data/log/trace.yaml +0 -17717
  348. data/log/trace_sic.yaml +0 -18343
  349. data/log/xes_xml.rb +0 -121
  350. data/log/xes_yaml.rb +0 -96
  351. data/server/handlerwrappers/soap.rb +0 -146
  352. data/server/resources/notifications/logging/consumer-secret +0 -1
  353. data/server/resources/notifications/logging/producer-secret +0 -1
  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/server/resources/test1.xml +0 -58
  358. data/server/resources/test2.xml +0 -60
  359. data/server/resources/test3.xml +0 -217
  360. data/test/callback.rb +0 -9
@@ -0,0 +1,189 @@
1
+ require 'json'
2
+
3
+ module CPEE
4
+ module Notifications
5
+
6
+ def self::implementation(id,opts)
7
+ Proc.new do
8
+ on resource "notifications" do
9
+ run CPEE::Notifications::Overview if get
10
+ on resource "topics" do
11
+ run CPEE::Notifications::Topics, opts if get
12
+ end
13
+ on resource "subscriptions" do
14
+ run CPEE::Notifications::Subscriptions, id, opts if get
15
+ run CPEE::Notifications::CreateSubscription, id, opts if post 'subscribe'
16
+ on resource do
17
+ run CPEE::Notifications::Subscription, id, opts if get
18
+ run CPEE::Notifications::UpdateSubscription, id, opts if put 'subscribe'
19
+ run CPEE::Notifications::DeleteSubscription, id, opts if delete
20
+ on resource 'sse' do
21
+ run CPEE::Notifications::SSE, id, opts if sse
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+
29
+ class Overview < Riddl::Implementation #{{{
30
+ def response
31
+ Riddl::Parameter::Complex.new("overview","text/xml") do
32
+ <<-END
33
+ <overview xmlns='http://riddl.org/ns/common-patterns/notifications-producer/2.0'>
34
+ <topics/>
35
+ <subscriptions/>
36
+ </overview>
37
+ END
38
+ end
39
+
40
+ end
41
+ end #}}}
42
+
43
+ class Topics < Riddl::Implementation #{{{
44
+ def response
45
+ opts = @a[0]
46
+ Riddl::Parameter::Complex.new("overview","text/xml") do
47
+ File.read(opts[:topics])
48
+ end
49
+ end
50
+ end #}}}
51
+
52
+ class Subscriptions < Riddl::Implementation #{{{
53
+ def response
54
+ id = @a[0]
55
+ opts = @a[1]
56
+ Riddl::Parameter::Complex.new("subscriptions","text/xml") do
57
+ ret = XML::Smart::string <<-END
58
+ <subscriptions xmlns='http://riddl.org/ns/common-patterns/notifications-producer/2.0'/>
59
+ END
60
+ CPEE::Persistence::extract_handlers(id,opts).each do |de|
61
+ ret.root.add('subscription').tap do |n|
62
+ n.attributes['id'] = de[0]
63
+ n.attributes['url'] = de[1] if de[1] && !de[1].empty?
64
+ end
65
+ end
66
+ ret.to_s
67
+ end
68
+ end
69
+ end #}}}
70
+
71
+ class Subscription < Riddl::Implementation #{{{
72
+ def response
73
+ id = @a[0]
74
+ opts = @a[1]
75
+ key = @r[-1]
76
+ Riddl::Parameter::Complex.new("subscriptions","text/xml") do
77
+ ret = XML::Smart::string <<-END
78
+ <subscription xmlns='http://riddl.org/ns/common-patterns/notifications-producer/2.0'/>
79
+ END
80
+ url = CPEE::Persistence::extract_item(id,opts,File.join('handler',key,'url'))
81
+ ret.root.attributes['url'] = url if url && !url.empty?
82
+ items = {}
83
+ CPEE::Persistence::extract_handler(id,opts,key).each do |h|
84
+ t, i, v = h.split('/')
85
+ items[t] ||= []
86
+ items[t] << [i,v]
87
+ end
88
+ items.each do |k,v|
89
+ ret.root.add('topic').tap do |n|
90
+ n.attributes['id'] = k
91
+ v.each do |e|
92
+ n.add *e
93
+ end
94
+ end
95
+ end
96
+ ret.to_s
97
+ end
98
+ end
99
+ end #}}}
100
+
101
+ class CreateSubscription < Riddl::Implementation #{{{
102
+ def response
103
+ id = @a[0]
104
+ opts = @a[1]
105
+ key = Digest::MD5.hexdigest(Kernel::rand().to_s)
106
+
107
+ url = @p[0].name == 'url' ? @p.shift.value : nil
108
+ values = []
109
+ while @p.length > 0
110
+ topic = @p.shift.value
111
+ base = @p.shift
112
+ type = base.name
113
+ values += base.value.split(',').map { |i| File.join(topic,type[0..-2],i) }
114
+ end
115
+ @header = CPEE::Persistence::set_handler(id,opts,key,url,values)
116
+
117
+ Riddl::Parameter::Simple.new('key',key)
118
+ end
119
+ end #}}}
120
+
121
+ class UpdateSubscription < Riddl::Implementation #{{{
122
+ def response
123
+ id = @a[0]
124
+ opts = @a[1]
125
+ key = @r.last
126
+
127
+ url = @p[0].name == 'url' ? @p.shift.value : nil
128
+ values = []
129
+ while @p.length > 0
130
+ topic = @p.shift.value
131
+ base = @p.shift
132
+ type = base.name
133
+ values += base.value.split(',').map { |i| File.join(topic,type[0..-2],i) }
134
+ end
135
+ @header = CPEE::Persistence::set_handler(id,opts,key,url,values,true)
136
+ end
137
+ end #}}}
138
+
139
+ class DeleteSubscription < Riddl::Implementation #{{{
140
+ def self::set(id,opts,key)
141
+ CPEE::Persistence::set_handler(id,opts,key,"",[],true)
142
+ end
143
+
144
+ def response
145
+ id = @a[0]
146
+ opts = @a[1]
147
+ key = @r.last
148
+
149
+ DeleteSubscription::set(id,opts,key)
150
+ nil
151
+ end
152
+ end #}}}
153
+
154
+ class SSE < Riddl::SSEImplementation #{{{
155
+ def onopen
156
+ @id = @a[0]
157
+ @opts = @a[1]
158
+ @key = @r[-2]
159
+ @conn = Redis.new(path: @opts[:redis_path], db: @opts[:redis_db])
160
+ EM.defer do
161
+ @conn.subscribe("forward:#{@id}/#{@key}", "forward-end:#{@id}/#{@key}") do |on|
162
+ on.message do |what, message|
163
+ if what == "forward-end:#{@id}/#{@key}"
164
+ @conn.unsubscribe
165
+ else
166
+ send message
167
+ end
168
+ end
169
+ end
170
+ @conn.close
171
+ end
172
+ EM.defer do
173
+ until closed?
174
+ send_with_id 'hearbeat', '42'
175
+ sleep 10
176
+ end
177
+ end
178
+ end
179
+
180
+ def onclose
181
+ tredis = Redis.new(path: @opts[:redis_path], db: @opts[:redis_db])
182
+ tredis.publish("forward-end:#{@id}/#{@key}",true)
183
+ tredis.close
184
+ DeleteSubscription::set(@id,@opts,@key)
185
+ end
186
+ end #}}}
187
+
188
+ end
189
+ end
@@ -0,0 +1,711 @@
1
+ require_relative 'attributes_helper'
2
+ require_relative 'value_helper'
3
+ require_relative 'transform'
4
+ require 'json'
5
+ require 'erb'
6
+ require 'yaml'
7
+
8
+ module CPEE
9
+ module Properties
10
+
11
+ def self::implementation(id,opts)
12
+ Proc.new do
13
+ run CPEE::Properties::Get, id, opts if get
14
+ run CPEE::Properties::Patch, id, opts if patch 'set-some-properties'
15
+ run CPEE::Properties::Put, id, opts if put 'set-some-properties'
16
+ on resource 'state' do
17
+ run CPEE::Properties::GetStateMachine, id, opts if get 'machine'
18
+ run CPEE::Properties::GetState, id, opts if get
19
+ run CPEE::Properties::PutState, id, opts if put 'state'
20
+ on resource '@changed' do
21
+ run CPEE::Properties::GetStateChanged, id, opts if get
22
+ end
23
+ end
24
+ on resource 'status' do
25
+ run CPEE::Properties::GetStatus, id, opts if get
26
+ run CPEE::Properties::PutStatus, id, opts if put 'status'
27
+ on resource 'id' do
28
+ run CPEE::Properties::GetStatusID, id, opts if get
29
+ end
30
+ on resource 'message' do
31
+ run CPEE::Properties::GetStatusMessage, id, opts if get
32
+ end
33
+ end
34
+ on resource 'handlerwrapper' do
35
+ run CPEE::Properties::GetHandlerWrapper, id, opts if get
36
+ run CPEE::Properties::PutHandlerWrapper, id, opts if put 'handlerwrapper'
37
+ end
38
+ on resource 'positions' do
39
+ run CPEE::Properties::GetPositions, id, opts if get
40
+ run CPEE::Properties::PatchPositions, id, opts if patch 'positions'
41
+ run CPEE::Properties::PutPositions, id, opts if put 'positions'
42
+ run CPEE::Properties::PostPositions, id, opts if post 'position'
43
+ on resource do
44
+ run CPEE::Properties::GetDetail, 'positions', id, opts if get
45
+ run CPEE::Properties::SetDetail, id, opts if put 'detail'
46
+ run CPEE::Properties::DelDetail, id, opts if delete
47
+ on resource '@passthrough' do
48
+ run CPEE::Properties::GetPt, id, opts if get
49
+ end
50
+ end
51
+ end
52
+ %w{dataelements endpoints attributes}.each do |ele|
53
+ on resource ele do
54
+ run CPEE::Properties::GetItems, ele, id, opts if get
55
+ run CPEE::Properties::PatchItems, ele, id, opts if patch ele
56
+ run CPEE::Properties::PutItems, ele, id, opts if put ele
57
+ run CPEE::Properties::PostItem, ele, id, opts if post ele[0..-2]
58
+ on resource do
59
+ run CPEE::Properties::GetItem, ele, id, opts if get
60
+ run CPEE::Properties::SetItem, ele, id, opts if put 'string'
61
+ run CPEE::Properties::DelItem, ele, id, opts if delete
62
+ end
63
+ end
64
+ end
65
+ on resource 'dsl' do
66
+ run CPEE::Properties::GetComplex, 'dsl', 'text/plain', id, opts if get
67
+ end
68
+ on resource 'dslx' do
69
+ run CPEE::Properties::GetComplex, 'dslx', 'text/xml', id, opts if get
70
+ end
71
+ on resource 'description' do
72
+ run CPEE::Properties::GetComplex, 'description', 'text/xml', id, opts if get
73
+ run CPEE::Properties::PutDescription, id, opts if put 'description'
74
+ end
75
+ on resource 'transformation' do
76
+ run CPEE::Properties::GetTransformation, id, opts if get
77
+ run CPEE::Properties::PutTransformation, id, opts if put 'transformation'
78
+ end
79
+ end
80
+ end
81
+
82
+ class Get < Riddl::Implementation #{{{
83
+ def response
84
+ id = @a[0]
85
+ opts = @a[1]
86
+ doc = XML::Smart::open_unprotected(opts[:properties_empty])
87
+ doc.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
88
+ doc.find('/p:properties/p:state').first.text = CPEE::Persistence::extract_item(id,opts,'state')
89
+ doc.find('/p:properties/p:state/@changed').first.value = CPEE::Persistence::extract_item(id,opts,'state/@changed')
90
+ doc.find('/p:properties/p:status/p:id').first.text = CPEE::Persistence::extract_item(id,opts,'status/id')
91
+ doc.find('/p:properties/p:status/p:message').first.text = CPEE::Persistence::extract_item(id,opts,'status/message')
92
+ %w{dataelements endpoints attributes}.each do |item|
93
+ des = doc.find("/p:properties/p:#{item}").first
94
+ CPEE::Persistence::extract_list(id,opts,item).each{ |de| des.add(*de) }
95
+ end
96
+ des = doc.find("/p:properties/p:positions").first
97
+ CPEE::Persistence::extract_set(id,opts,'positions').each do |de|
98
+ node = des.add(*de)
99
+ if pt = CPEE::Persistence::extract_item(id,opts,File.join('positions',de[0],'@passthrough'))
100
+ node.attributes['passthrough'] = pt
101
+ end
102
+ end
103
+ doc.find('/p:properties/p:dsl').first.text = CPEE::Persistence::extract_item(id,opts,'dsl')
104
+ if val = CPEE::Persistence::extract_item(id,opts,'dslx') #{{{
105
+ doc.find('/p:properties/p:dslx').first.add XML::Smart::string(val).root rescue nil
106
+ end #}}}
107
+ if val = CPEE::Persistence::extract_item(id,opts,'description') #{{{
108
+ doc.find('/p:properties/p:description').first.add XML::Smart::string(val).root rescue nil
109
+ end #}}}
110
+ doc.find('/p:properties/p:transformation/p:description').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/description')
111
+ doc.find('/p:properties/p:transformation/p:dataelements').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/dataelements')
112
+ doc.find('/p:properties/p:transformation/p:endpoints').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/endpoints')
113
+ doc.find('/p:properties/p:transformation/p:description/@type').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/description/@type')
114
+ doc.find('/p:properties/p:transformation/p:dataelements/@type').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/dataelements/@type')
115
+ doc.find('/p:properties/p:transformation/p:endpoints/@type').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/endpoints/@type')
116
+ Riddl::Parameter::Complex.new('properties','application/xml',doc.to_s)
117
+ end
118
+ end #}}}
119
+ class Patch < Riddl::Implementation #{{{
120
+ def response
121
+ id = @a[0]
122
+ opts = @a[1]
123
+ if opts[:statemachine].readonly? id
124
+ @status = 400
125
+ else
126
+ doc = XML::Smart::string(@p[0].value.read)
127
+ doc.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
128
+ if (node = doc.find('/p:properties/p:status')).any?
129
+ CPEE::Properties::PutStatus::set id, opts, node.first.dump
130
+ end
131
+ if (node = doc.find('/p:properties/p:handlerwrapper')).any?
132
+ CPEE::Properties::PutHandlerWrapper::set id, opts, node.first.text
133
+ end
134
+
135
+ %w{dataelements endpoints attributes}.each do |item|
136
+ if (node = doc.find('/p:properties/p:' + item)).any?
137
+ CPEE::Properties::PatchItems::set item, id, opts, node.first.dump
138
+ end
139
+ end
140
+
141
+ if (node = doc.find('/p:properties/p:transformation')).any?
142
+ CPEE::Properties::PutTransformation::set id, opts, node.first.dump
143
+ end
144
+ if (node = doc.find('/p:properties/p:description/*')).any?
145
+ CPEE::Properties::PutDescription::set id, opts, node.first.dump
146
+ end
147
+
148
+ if (node = doc.find('/p:properties/p:positions')).any?
149
+ if node.first.find('p:*').any?
150
+ CPEE::Properties::PatchPositions::set id, opts, node.first.dump
151
+ end
152
+ end
153
+
154
+ if (node = doc.find('/p:properties/p:state')).any?
155
+ CPEE::Properties::PutState::run id, opts, node.first.text
156
+ end
157
+ end
158
+ end
159
+ end #}}}
160
+ class Put < Riddl::Implementation #{{{
161
+ def response
162
+ id = @a[0]
163
+ opts = @a[1]
164
+ if opts[:statemachine].readonly? id
165
+ @status = 400
166
+ else
167
+ doc = XML::Smart::string(@p[0].value.read)
168
+ doc.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
169
+ if (node = doc.find('/p:properties/p:status')).any?
170
+ CPEE::Properties::PutStatus::set id, opts, node.first.dump
171
+ end
172
+ if (node = doc.find('/p:properties/p:handlerwrapper')).any?
173
+ CPEE::Properties::PutHandlerWrapper::set id, opts, node.first.text
174
+ end
175
+
176
+ %w{dataelements endpoints attributes}.each do |item|
177
+ if (node = doc.find('/p:properties/p:' + item)).any?
178
+ CPEE::Properties::PutItems::set item, id, opts, node.first.dump
179
+ end
180
+ end
181
+
182
+ if (node = doc.find('/p:properties/p:transformation')).any?
183
+ CPEE::Properties::PutTransformation::set id, opts, node.first.dump
184
+ end
185
+ if (node = doc.find('/p:properties/p:description/*')).any?
186
+ CPEE::Properties::PutDescription::set id, opts, node.first.dump
187
+ end
188
+
189
+ if (node = doc.find('/p:properties/p:positions')).any?
190
+ if node.first.find('p:*').any?
191
+ CPEE::Properties::PutPositions::set id, opts, node.first.dump
192
+ end
193
+ end
194
+
195
+ if (node = doc.find('/p:properties/p:state')).any?
196
+ CPEE::Properties::PutState::run id, opts, node.first.text
197
+ end
198
+ end
199
+ end
200
+ end #}}}
201
+ class GetState < Riddl::Implementation #{{{
202
+ def response
203
+ id = @a[0]
204
+ opts = @a[1]
205
+ Riddl::Parameter::Simple.new('value',CPEE::Persistence::extract_item(id,opts,'state'))
206
+ end
207
+ end #}}}
208
+ class PutState < Riddl::Implementation #{{{
209
+ def self::set(id,opts,state)
210
+ CPEE::Persistence::set_item(id,opts,'state',:state => state, :timestamp => Time.now.xmlschema(3))
211
+ end
212
+
213
+ def self::run(id,opts,state)
214
+ exe = File.join(opts[:instances],id.to_s,File.basename(opts[:backend_run]))
215
+ case state
216
+ when 'running'
217
+ CPEE::Persistence::write_instance id, opts
218
+ pid = Kernel.spawn(exe , :out => exe + '.out', :err => exe + '.err')
219
+ File.write(exe + '.pid',pid)
220
+ Process.detach pid
221
+ when 'stopping'
222
+ pid = File.read(exe + '.pid') rescue nil
223
+ if pid
224
+ Process.kill('HUP', pid.to_i) rescue nil
225
+ end
226
+ else
227
+ ### Most probably this is never needed. Lets see.
228
+ PutState::set id, opts, state
229
+ end
230
+ end
231
+
232
+ def response
233
+ id = @a[0]
234
+ opts = @a[1]
235
+ state = @p[0].value
236
+ if opts[:statemachine].setable? id, state
237
+ PutState::run id, opts, state
238
+ else
239
+ @status = 422
240
+ end
241
+ nil
242
+ end
243
+ end #}}}
244
+ class GetStateMachine < Riddl::Implementation #{{{
245
+ def response
246
+ id = @a[0]
247
+ opts = @a[1]
248
+ Riddl::Parameter::Complex.new('statemachine','text/xml',File.read(opts[:states]))
249
+ end
250
+ end #}}}
251
+ class GetStateChanged < Riddl::Implementation #{{{
252
+ def response
253
+ id = @a[0]
254
+ opts = @a[1]
255
+ Riddl::Parameter::Simple.new('state',CPEE::Persistence::extract_item(id,opts,'state/@changed'))
256
+ end
257
+ end #}}}
258
+ class GetStatus < Riddl::Implementation #{{{
259
+ def response
260
+ id = @a[0]
261
+ opts = @a[1]
262
+ doc = XML::Smart::open_unprotected(opts[:properties_empty])
263
+ doc.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
264
+ des = doc.find('/p:properties/p:status').first
265
+ des.find('p:id').first.text = CPEE::Persistence::extract_item(id,opts,'status/id')
266
+ des.find('p:message').first.text = CPEE::Persistence::extract_item(id,opts,'status/message')
267
+ Riddl::Parameter::Complex.new('status','text/xml',des.to_doc.to_s)
268
+ end
269
+ end #}}}
270
+ class PutStatus < Riddl::Implementation #{{{
271
+ def self::set(id,opts,xml)
272
+ doc = XML::Smart::string(xml)
273
+ doc.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
274
+ CPEE::Persistence::set_item(id,opts,'status',:id => doc.find('string(/p:status/p:id)').to_i, :message => doc.find('string(/p:status/p:message)'))
275
+ end
276
+
277
+ def response
278
+ id = @a[0]
279
+ opts = @a[1]
280
+ if opts[:statemachine].readonly? id
281
+ @status = 422 # semantic error
282
+ else
283
+ PutStatus::set id, opts, @p[0].value.read
284
+ end
285
+ nil
286
+ end
287
+ end #}}}
288
+ class GetStatusID < Riddl::Implementation #{{{
289
+ def response
290
+ id = @a[0]
291
+ opts = @a[1]
292
+ Riddl::Parameter::Simple.new('value',CPEE::Persistence::extract_item(id,opts,'status/id'))
293
+ end
294
+ end #}}}
295
+ class GetStatusMessage < Riddl::Implementation #{{{
296
+ def response
297
+ id = @a[0]
298
+ opts = @a[1]
299
+ Riddl::Parameter::Simple.new('value',CPEE::Persistence::extract_item(id,opts,'status/message'))
300
+ end
301
+ end #}}}
302
+ class GetHandlerWrapper < Riddl::Implementation #{{{
303
+ def response
304
+ id = @a[0]
305
+ opts = @a[1]
306
+ Riddl::Parameter::Simple.new('value',CPEE::Persistence::extract_item(id,opts,'handlerwrapper'))
307
+ end
308
+ end #}}}
309
+ class PutHandlerWrapper < Riddl::Implementation #{{{
310
+ def self::set(id,opts,hw)
311
+ CPEE::Persistence::set_item(id,opts,'handlerwrapper',:handlerwrapper => hw)
312
+ end
313
+ def response
314
+ id = @a[0]
315
+ opts = @a[1]
316
+ if opts[:statemachine].readonly? id
317
+ @status = 423
318
+ else
319
+ PutHandlerWrapper::set(id,opts,@p[0].value)
320
+ end
321
+ nil
322
+ end
323
+ end #}}}
324
+ class GetItems < Riddl::Implementation #{{{
325
+ def response
326
+ item = @a[0]
327
+ id = @a[1]
328
+ opts = @a[2]
329
+ doc = XML::Smart::open_unprotected(opts[:properties_empty])
330
+ doc.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
331
+ des = doc.find("/p:properties/p:#{item}").first
332
+ CPEE::Persistence::extract_list(id,opts,item).each{ |de| des.add(*de) }
333
+ Riddl::Parameter::Complex.new(item,'text/xml',des.to_doc.to_s)
334
+ end
335
+ end #}}}
336
+ class PatchItems < Riddl::Implementation #{{{
337
+ def self::set_hash(item, id, opts, val)
338
+ CPEE::Persistence::set_list(id,opts,item,val)
339
+ end
340
+ def self::set(item, id, opts, xml)
341
+ doc = XML::Smart::string(xml)
342
+ val = doc.find("/*/*").map do |ele|
343
+ [ele.qname.name, ele.text]
344
+ end.to_h
345
+ CPEE::Persistence::set_list(id,opts,item,val)
346
+ end
347
+
348
+ def response
349
+ item = @a[0]
350
+ id = @a[1]
351
+ opts = @a[2]
352
+ if opts[:statemachine].readonly? id
353
+ @status = 423
354
+ else
355
+ begin
356
+ PatchItems::set(item,id,opts,@p[0].value.read)
357
+ rescue
358
+ @status = 400
359
+ end
360
+ end
361
+ nil
362
+ end
363
+ end #}}}
364
+ class PutItems < Riddl::Implementation #{{{
365
+ def self::set(item,id,opts,xml)
366
+ doc = XML::Smart::string(xml)
367
+ val = {}
368
+ doc.find("/*/*").each do |ele|
369
+ val[ele.qname.name] = ele.text unless val.has_key?(ele.qname.name)
370
+ end
371
+ oldkeys = CPEE::Persistence::extract_list(id,opts,item).to_h.keys
372
+ newkeys = val.keys
373
+ del = oldkeys - newkeys
374
+ CPEE::Persistence::set_list(id,opts,item,val,del)
375
+ end
376
+
377
+ def response
378
+ item = @a[0]
379
+ id = @a[1]
380
+ opts = @a[2]
381
+ if opts[:statemachine].readonly? id
382
+ @status = 423
383
+ else
384
+ begin
385
+ PutItems::set(item,id,opts,@p[0].value.read)
386
+ rescue
387
+ @status = 400
388
+ end
389
+ end
390
+ nil
391
+ end
392
+ end #}}}
393
+ class PostItem < Riddl::Implementation #{{{
394
+ def response
395
+ item = @a[0]
396
+ id = @a[1]
397
+ opts = @a[2]
398
+ if opts[:statemachine].readonly? id
399
+ @status = 423
400
+ else
401
+ begin
402
+ doc = XML::Smart::string(@p[0].value.read)
403
+ val = doc.find("/*").map do |ele|
404
+ [ele.qname.name, ele.text]
405
+ end.to_h
406
+ if not CPEE::Persistence::extract_item(id,opts,File.join(@r.first,val.keys.first))
407
+ CPEE::Persistence::set_list(id,opts,item,val)
408
+ Riddl::Parameter::Simple.new('id',val.keys.first)
409
+ else
410
+ @status= 409
411
+ end
412
+ rescue => e
413
+ @status = 400
414
+ end
415
+ end
416
+ nil
417
+ end
418
+ end #}}}
419
+ class GetItem < Riddl::Implementation #{{{
420
+ def response
421
+ item = @a[0]
422
+ id = @a[1]
423
+ opts = @a[2]
424
+ if val = CPEE::Persistence::extract_item(id,opts,@r.join('/'))
425
+ Riddl::Parameter::Simple.new('value',val)
426
+ else
427
+ @status = 404
428
+ end
429
+ end
430
+ end #}}}
431
+ class SetItem < Riddl::Implementation #{{{
432
+ def response
433
+ item = @a[0]
434
+ id = @a[1]
435
+ opts = @a[2]
436
+ val = { @r.last => @p[0].value }
437
+ if CPEE::Persistence::extract_item(id,opts,@r.join('/'))
438
+ CPEE::Persistence::set_list(id,opts,item,val)
439
+ else
440
+ @status = 404
441
+ end
442
+ nil
443
+ end
444
+ end #}}}
445
+ class DelItem < Riddl::Implementation #{{{
446
+ def response
447
+ item = @a[0]
448
+ id = @a[1]
449
+ opts = @a[2]
450
+ val = { @r.last => nil }
451
+ if opts[:statemachine].readonly? id
452
+ @status = 423
453
+ else
454
+ if CPEE::Persistence::extract_item(id,opts,@r.join('/'))
455
+ CPEE::Persistence::set_list(id,opts,item,val,val.keys)
456
+ else
457
+ @status = 404
458
+ end
459
+ end
460
+ nil
461
+ end
462
+ end #}}}
463
+
464
+ class GetComplex < Riddl::Implementation #{{{
465
+ def response
466
+ item = @a[0]
467
+ mime = @a[1]
468
+ id = @a[2]
469
+ opts = @a[3]
470
+ if val = CPEE::Persistence::extract_item(id,opts,@r.join('/'))
471
+ Riddl::Parameter::Complex.new(item,mime,val)
472
+ else
473
+ @status = 404
474
+ end
475
+ end
476
+ end #}}}
477
+
478
+ class GetPositions < Riddl::Implementation #{{{
479
+ def response
480
+ id = @a[0]
481
+ opts = @a[1]
482
+ doc = XML::Smart::open_unprotected(opts[:properties_empty])
483
+ doc.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
484
+ des = doc.find("/p:properties/p:positions").first
485
+ CPEE::Persistence::extract_set(id,opts,'positions').each do |de|
486
+ node = des.add(*de)
487
+ if pt = CPEE::Persistence::extract_item(id,opts,File.join('positions',de[0],'@passthrough'))
488
+ node.attributes['passthrough'] = pt
489
+ end
490
+ end
491
+ Riddl::Parameter::Complex.new('positions','text/xml',des.to_doc.to_s)
492
+ end
493
+ end #}}}
494
+ class PatchPositions < Riddl::Implementation #{{{
495
+ def self::set(id,opts,xml)
496
+ doc = XML::Smart::string(xml)
497
+ content = {}
498
+ doc.find("/*/*").map do |ele|
499
+ val = { 'position' => ele.qname.name }
500
+ val['passthrough'] = ele.attributes['passthrough'] if ele.attributes['passthrough']
501
+ content[ele.text] ||= []
502
+ content[ele.text] << val
503
+ end
504
+ CPEE::Persistence::set_item(id,opts,'position',content)
505
+ end
506
+
507
+ def response
508
+ id = @a[0]
509
+ opts = @a[1]
510
+ if opts[:statemachine].readonly? id
511
+ @status = 423
512
+ else
513
+ begin
514
+ PatchPositions::set(id,opts,@p[0].value.read)
515
+ rescue => e
516
+ @status = 400
517
+ end
518
+ end
519
+ nil
520
+ end
521
+ end #}}}
522
+ class PutPositions < Riddl::Implementation #{{{
523
+ def PutPositions::set(id,opts,xml)
524
+ doc = XML::Smart::string(xml)
525
+ content = {}
526
+ newkeys = []
527
+ doc.find("/*/*").map do |ele|
528
+ val = { 'position' => ele.qname.name }
529
+ val['passthrough'] = ele.attributes['passthrough'] if ele.attributes['passthrough']
530
+ content[ele.text] ||= []
531
+ content[ele.text] << val
532
+ newkeys << ele.qname.name
533
+ end
534
+ oldkeys = CPEE::Persistence::extract_set(id,opts,'positions').to_h.keys
535
+ del = oldkeys - newkeys
536
+ del.each do |key|
537
+ val = { 'position' => key }
538
+ content['unmark'] ||= []
539
+ content['unmark'] << val
540
+ end
541
+ CPEE::Persistence::set_item(id,opts,'position',content)
542
+ end
543
+
544
+ def response
545
+ id = @a[0]
546
+ opts = @a[1]
547
+ if opts[:statemachine].readonly? id
548
+ @status = 423
549
+ else
550
+ begin
551
+ PutPositions::set(id,opts,@p[0].value.read)
552
+ rescue => e
553
+ @status = 400
554
+ end
555
+ end
556
+ nil
557
+ end
558
+ end #}}}
559
+ class PostPositions < Riddl::Implementation #{{{
560
+ def response
561
+ id = @a[0]
562
+ opts = @a[1]
563
+ if opts[:statemachine].readonly? id
564
+ @status = 423
565
+ else
566
+ begin
567
+ doc = XML::Smart::string(@p[0].value.read)
568
+ if not CPEE::Persistence::extract_item(id,opts,File.join('positions',doc.root.qname.name))
569
+ content = {}
570
+ content[doc.root.text] = [{ 'position' => doc.root.qname.name }]
571
+ content[doc.root.text][0]['passthrough'] = doc.root.attributes['passthrough'] if doc.root.attributes['passthrough']
572
+ CPEE::Persistence::set_item(id,opts,'position',content)
573
+ else
574
+ @status= 409
575
+ end
576
+ Riddl::Parameter::Simple.new('id',doc.root.qname.name)
577
+ rescue => e
578
+ @status = 400
579
+ end
580
+ end
581
+ nil
582
+ end
583
+ end #}}}
584
+ class GetDetail < Riddl::Implementation #{{{
585
+ def response
586
+ item = @a[0]
587
+ id = @a[1]
588
+ opts = @a[2]
589
+ if val = CPEE::Persistence::extract_item(id,opts,@r.join('/'))
590
+ Riddl::Parameter::Simple.new('value',val)
591
+ else
592
+ @status = 404
593
+ end
594
+ end
595
+ end #}}}
596
+ class SetDetail < Riddl::Implementation #{{{
597
+ def response
598
+ id = @a[0]
599
+ opts = @a[1]
600
+ if CPEE::Persistence::extract_item(id,opts,@r.join('/'))
601
+ CPEE::Persistence::set_item(id,opts,'position',@p[0].value => [ { 'position' => @r.last } ])
602
+ else
603
+ @status = 404
604
+ end
605
+ nil
606
+ end
607
+ end #}}}
608
+ class DelDetail < Riddl::Implementation #{{{
609
+ def response
610
+ id = @a[0]
611
+ opts = @a[1]
612
+ if CPEE::Persistence::extract_item(id,opts,@r.join('/'))
613
+ CPEE::Persistence::set_position(id,opts,'position','unmark' => [ { 'position' => @r.last } ])
614
+ else
615
+ @status = 404
616
+ end
617
+ nil
618
+ end
619
+ end #}}}
620
+ class GetPt < Riddl::Implementation #{{{
621
+ def response
622
+ id = @a[0]
623
+ opts = @a[1]
624
+ if val = CPEE::Persistence::extract_item(id,opts,@r.join('/'))
625
+ Riddl::Parameter::Simple.new('value',val)
626
+ else
627
+ @status = 404
628
+ end
629
+ end
630
+ end #}}}
631
+
632
+ class PutDescription < Riddl::Implementation #{{{
633
+ def self::set(id,opts,xml)
634
+ dslx, dsl, de, ep = transform(
635
+ xml,
636
+ CPEE::Persistence::extract_item(id,opts,'transformation/description'),
637
+ CPEE::Persistence::extract_item(id,opts,'transformation/description/@type'),
638
+ CPEE::Persistence::extract_item(id,opts,'transformation/dataelements'),
639
+ CPEE::Persistence::extract_item(id,opts,'transformation/dataelements/@type'),
640
+ CPEE::Persistence::extract_item(id,opts,'transformation/endpoints'),
641
+ CPEE::Persistence::extract_item(id,opts,'transformation/endpoints/@type'),
642
+ opts
643
+ )
644
+ CPEE::Persistence::set_item(id,opts,'description',
645
+ :description => xml,
646
+ :dslx => dslx,
647
+ :dsl => dsl
648
+ )
649
+ PatchItems::set_hash('dataelements',id,opts,de) unless de.empty?
650
+ PatchItems::set_hash('dataelements',id,opts,ep) unless ep.empty?
651
+ end
652
+
653
+ def response
654
+ id = @a[0]
655
+ opts = @a[1]
656
+ if opts[:statemachine].readonly? id
657
+ @status = 422 # semantic error
658
+ else
659
+ begin
660
+ PutDescription::set(id,opts,@p[0].value.read)
661
+ rescue
662
+ @status = 400
663
+ end
664
+ end
665
+ nil
666
+ end
667
+ end #}}}
668
+
669
+ class GetTransformation < Riddl::Implementation #{{{
670
+ def response
671
+ id = @a[0]
672
+ opts = @a[1]
673
+ doc = XML::Smart::open_unprotected(opts[:properties_empty])
674
+ doc.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
675
+ des = doc.find('/p:properties/p:transformation').first
676
+ des.find('p:description').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/description')
677
+ des.find('p:dataelements').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/dataelements')
678
+ des.find('p:endpoints').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/endpoints')
679
+ des.find('p:description/@type').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/description/@type')
680
+ des.find('p:dataelements/@type').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/dataelements/@type')
681
+ des.find('p:endpoints/@type').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/endpoints/@type')
682
+ Riddl::Parameter::Complex.new('status','text/xml',des.to_doc.to_s)
683
+ end
684
+ end #}}}
685
+ class PutTransformation < Riddl::Implementation #{{{
686
+ def self::set(id,opts,xml)
687
+ doc = XML::Smart::string(xml)
688
+ doc.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
689
+ CPEE::Persistence::set_item(id,opts,'transformation',
690
+ :description => doc.find('string(/p:transformation/p:description)'),
691
+ :description_type => doc.find('string(/p:transformation/p:description/@type)'),
692
+ :dataelements =>doc.find('string(/p:transformation/p:dataelements)'),
693
+ :dataelements_type => doc.find('string(/p:transformation/p:dataelements/@type)'),
694
+ :endpoints =>doc.find('string(/p:transformation/p:endpoints)'),
695
+ :endpoints_type => doc.find('string(/p:transformation/p:endpoints/@type)')
696
+ )
697
+ end
698
+ def response
699
+ id = @a[0]
700
+ opts = @a[1]
701
+ if opts[:statemachine].readonly? id
702
+ @status = 422 # semantic error
703
+ else
704
+ PutTransformation::set(id,opts,@p[0].value.read)
705
+ end
706
+ nil
707
+ end
708
+ end #}}}
709
+
710
+ end
711
+ end