cpee 1.5.20 → 2.0

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/{testsets → templates.legacy}/Syncing P34 1.xml +8 -11
  42. data/cockpit/{testsets → templates.legacy}/Syncing P34 2.xml +8 -11
  43. data/cockpit/{testsets → templates.legacy}/Syncing P34 3.xml +8 -11
  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 +85 -0
  63. data/cockpit/templates/IUPC arXiv:1104.3609 P34 1.xml +77 -0
  64. data/cockpit/templates/IUPC arXiv:1104.3609 P34 2.xml +77 -0
  65. data/cockpit/templates/IUPC arXiv:1104.3609 P34 3.xml +77 -0
  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 +20 -14
  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 +85 -49
  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 +20 -14
  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 +20 -14
  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 +20 -14
  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 +9 -9
  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 +152 -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 +707 -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 -34
  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 +29 -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 +3 -0
  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 +126 -156
  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 -368
  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,707 @@
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
+ CPEE::Properties::PatchPositions::set id, opts, node.first.dump
150
+ end
151
+
152
+ if (node = doc.find('/p:properties/p:state')).any?
153
+ CPEE::Properties::PutState::run id, opts, node.first.text
154
+ end
155
+ end
156
+ end
157
+ end #}}}
158
+ class Put < Riddl::Implementation #{{{
159
+ def response
160
+ id = @a[0]
161
+ opts = @a[1]
162
+ if opts[:statemachine].readonly? id
163
+ @status = 400
164
+ else
165
+ doc = XML::Smart::string(@p[0].value.read)
166
+ doc.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
167
+ if (node = doc.find('/p:properties/p:status')).any?
168
+ CPEE::Properties::PutStatus::set id, opts, node.first.dump
169
+ end
170
+ if (node = doc.find('/p:properties/p:handlerwrapper')).any?
171
+ CPEE::Properties::PutHandlerWrapper::set id, opts, node.first.text
172
+ end
173
+
174
+ %w{dataelements endpoints attributes}.each do |item|
175
+ if (node = doc.find('/p:properties/p:' + item)).any?
176
+ CPEE::Properties::PutItems::set item, id, opts, node.first.dump
177
+ end
178
+ end
179
+
180
+ if (node = doc.find('/p:properties/p:transformation')).any?
181
+ CPEE::Properties::PutTransformation::set id, opts, node.first.dump
182
+ end
183
+ if (node = doc.find('/p:properties/p:description/*')).any?
184
+ CPEE::Properties::PutDescription::set id, opts, node.first.dump
185
+ end
186
+
187
+ if (node = doc.find('/p:properties/p:positions')).any?
188
+ CPEE::Properties::PutPositions::set id, opts, node.first.dump
189
+ end
190
+
191
+ if (node = doc.find('/p:properties/p:state')).any?
192
+ CPEE::Properties::PutState::run id, opts, node.first.text
193
+ end
194
+ end
195
+ end
196
+ end #}}}
197
+ class GetState < Riddl::Implementation #{{{
198
+ def response
199
+ id = @a[0]
200
+ opts = @a[1]
201
+ Riddl::Parameter::Simple.new('value',CPEE::Persistence::extract_item(id,opts,'state'))
202
+ end
203
+ end #}}}
204
+ class PutState < Riddl::Implementation #{{{
205
+ def self::set(id,opts,state)
206
+ CPEE::Persistence::set_item(id,opts,'state',:state => state, :timestamp => Time.now.xmlschema(3))
207
+ end
208
+
209
+ def self::run(id,opts,state)
210
+ exe = File.join(opts[:instances],id.to_s,File.basename(opts[:backend_run]))
211
+ case state
212
+ when 'running'
213
+ CPEE::Persistence::write_instance id, opts
214
+ pid = Kernel.spawn(exe , :out => exe + '.out', :err => exe + '.err')
215
+ File.write(exe + '.pid',pid)
216
+ Process.detach pid
217
+ when 'stopping'
218
+ pid = File.read(exe + '.pid') rescue nil
219
+ if pid
220
+ Process.kill('HUP', pid.to_i) rescue nil
221
+ end
222
+ else
223
+ ### Most probably this is never needed. Lets see.
224
+ PutState::set id, opts, state
225
+ end
226
+ end
227
+
228
+ def response
229
+ id = @a[0]
230
+ opts = @a[1]
231
+ state = @p[0].value
232
+ if opts[:statemachine].setable? id, state
233
+ PutState::run id, opts, state
234
+ else
235
+ @status = 422
236
+ end
237
+ nil
238
+ end
239
+ end #}}}
240
+ class GetStateMachine < Riddl::Implementation #{{{
241
+ def response
242
+ id = @a[0]
243
+ opts = @a[1]
244
+ Riddl::Parameter::Complex.new('statemachine','text/xml',File.read(opts[:states]))
245
+ end
246
+ end #}}}
247
+ class GetStateChanged < Riddl::Implementation #{{{
248
+ def response
249
+ id = @a[0]
250
+ opts = @a[1]
251
+ Riddl::Parameter::Simple.new('state',CPEE::Persistence::extract_item(id,opts,'state/@changed'))
252
+ end
253
+ end #}}}
254
+ class GetStatus < Riddl::Implementation #{{{
255
+ def response
256
+ id = @a[0]
257
+ opts = @a[1]
258
+ doc = XML::Smart::open_unprotected(opts[:properties_empty])
259
+ doc.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
260
+ des = doc.find('/p:properties/p:status').first
261
+ des.find('p:id').first.text = CPEE::Persistence::extract_item(id,opts,'status/id')
262
+ des.find('p:message').first.text = CPEE::Persistence::extract_item(id,opts,'status/message')
263
+ Riddl::Parameter::Complex.new('status','text/xml',des.to_doc.to_s)
264
+ end
265
+ end #}}}
266
+ class PutStatus < Riddl::Implementation #{{{
267
+ def self::set(id,opts,xml)
268
+ doc = XML::Smart::string(xml)
269
+ doc.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
270
+ 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)'))
271
+ end
272
+
273
+ def response
274
+ id = @a[0]
275
+ opts = @a[1]
276
+ if opts[:statemachine].readonly? id
277
+ @status = 422 # semantic error
278
+ else
279
+ PutStatus::set id, opts, @p[0].value.read
280
+ end
281
+ nil
282
+ end
283
+ end #}}}
284
+ class GetStatusID < Riddl::Implementation #{{{
285
+ def response
286
+ id = @a[0]
287
+ opts = @a[1]
288
+ Riddl::Parameter::Simple.new('value',CPEE::Persistence::extract_item(id,opts,'status/id'))
289
+ end
290
+ end #}}}
291
+ class GetStatusMessage < Riddl::Implementation #{{{
292
+ def response
293
+ id = @a[0]
294
+ opts = @a[1]
295
+ Riddl::Parameter::Simple.new('value',CPEE::Persistence::extract_item(id,opts,'status/message'))
296
+ end
297
+ end #}}}
298
+ class GetHandlerWrapper < Riddl::Implementation #{{{
299
+ def response
300
+ id = @a[0]
301
+ opts = @a[1]
302
+ Riddl::Parameter::Simple.new('value',CPEE::Persistence::extract_item(id,opts,'handlerwrapper'))
303
+ end
304
+ end #}}}
305
+ class PutHandlerWrapper < Riddl::Implementation #{{{
306
+ def self::set(id,opts,hw)
307
+ CPEE::Persistence::set_item(id,opts,'handlerwrapper',:handlerwrapper => hw)
308
+ end
309
+ def response
310
+ id = @a[0]
311
+ opts = @a[1]
312
+ if opts[:statemachine].readonly? id
313
+ @status = 423
314
+ else
315
+ PutHandlerWrapper::set(id,opts,@p[0].value)
316
+ end
317
+ nil
318
+ end
319
+ end #}}}
320
+ class GetItems < Riddl::Implementation #{{{
321
+ def response
322
+ item = @a[0]
323
+ id = @a[1]
324
+ opts = @a[2]
325
+ doc = XML::Smart::open_unprotected(opts[:properties_empty])
326
+ doc.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
327
+ des = doc.find("/p:properties/p:#{item}").first
328
+ CPEE::Persistence::extract_list(id,opts,item).each{ |de| des.add(*de) }
329
+ Riddl::Parameter::Complex.new(item,'text/xml',des.to_doc.to_s)
330
+ end
331
+ end #}}}
332
+ class PatchItems < Riddl::Implementation #{{{
333
+ def self::set_hash(item, id, opts, val)
334
+ CPEE::Persistence::set_list(id,opts,item,val)
335
+ end
336
+ def self::set(item, id, opts, xml)
337
+ doc = XML::Smart::string(xml)
338
+ val = doc.find("/*/*").map do |ele|
339
+ [ele.qname.name, ele.text]
340
+ end.to_h
341
+ CPEE::Persistence::set_list(id,opts,item,val)
342
+ end
343
+
344
+ def response
345
+ item = @a[0]
346
+ id = @a[1]
347
+ opts = @a[2]
348
+ if opts[:statemachine].readonly? id
349
+ @status = 423
350
+ else
351
+ begin
352
+ PatchItems::set(item,id,opts,@p[0].value.read)
353
+ rescue
354
+ @status = 400
355
+ end
356
+ end
357
+ nil
358
+ end
359
+ end #}}}
360
+ class PutItems < Riddl::Implementation #{{{
361
+ def self::set(item,id,opts,xml)
362
+ doc = XML::Smart::string(xml)
363
+ val = {}
364
+ doc.find("/*/*").each do |ele|
365
+ val[ele.qname.name] = ele.text unless val.has_key?(ele.qname.name)
366
+ end
367
+ oldkeys = CPEE::Persistence::extract_list(id,opts,item).to_h.keys
368
+ newkeys = val.keys
369
+ del = oldkeys - newkeys
370
+ CPEE::Persistence::set_list(id,opts,item,val,del)
371
+ end
372
+
373
+ def response
374
+ item = @a[0]
375
+ id = @a[1]
376
+ opts = @a[2]
377
+ if opts[:statemachine].readonly? id
378
+ @status = 423
379
+ else
380
+ begin
381
+ PutItems::set(item,id,opts,@p[0].value.read)
382
+ rescue
383
+ @status = 400
384
+ end
385
+ end
386
+ nil
387
+ end
388
+ end #}}}
389
+ class PostItem < Riddl::Implementation #{{{
390
+ def response
391
+ item = @a[0]
392
+ id = @a[1]
393
+ opts = @a[2]
394
+ if opts[:statemachine].readonly? id
395
+ @status = 423
396
+ else
397
+ begin
398
+ doc = XML::Smart::string(@p[0].value.read)
399
+ val = doc.find("/*").map do |ele|
400
+ [ele.qname.name, ele.text]
401
+ end.to_h
402
+ if not CPEE::Persistence::extract_item(id,opts,File.join(@r.first,val.keys.first))
403
+ CPEE::Persistence::set_list(id,opts,item,val)
404
+ Riddl::Parameter::Simple.new('id',val.keys.first)
405
+ else
406
+ @status= 409
407
+ end
408
+ rescue => e
409
+ @status = 400
410
+ end
411
+ end
412
+ nil
413
+ end
414
+ end #}}}
415
+ class GetItem < Riddl::Implementation #{{{
416
+ def response
417
+ item = @a[0]
418
+ id = @a[1]
419
+ opts = @a[2]
420
+ if val = CPEE::Persistence::extract_item(id,opts,@r.join('/'))
421
+ Riddl::Parameter::Simple.new('value',val)
422
+ else
423
+ @status = 404
424
+ end
425
+ end
426
+ end #}}}
427
+ class SetItem < Riddl::Implementation #{{{
428
+ def response
429
+ item = @a[0]
430
+ id = @a[1]
431
+ opts = @a[2]
432
+ val = { @r.last => @p[0].value }
433
+ if CPEE::Persistence::extract_item(id,opts,@r.join('/'))
434
+ CPEE::Persistence::set_list(id,opts,item,val)
435
+ else
436
+ @status = 404
437
+ end
438
+ nil
439
+ end
440
+ end #}}}
441
+ class DelItem < Riddl::Implementation #{{{
442
+ def response
443
+ item = @a[0]
444
+ id = @a[1]
445
+ opts = @a[2]
446
+ val = { @r.last => nil }
447
+ if opts[:statemachine].readonly? id
448
+ @status = 423
449
+ else
450
+ if CPEE::Persistence::extract_item(id,opts,@r.join('/'))
451
+ CPEE::Persistence::set_list(id,opts,item,val,val.keys)
452
+ else
453
+ @status = 404
454
+ end
455
+ end
456
+ nil
457
+ end
458
+ end #}}}
459
+
460
+ class GetComplex < Riddl::Implementation #{{{
461
+ def response
462
+ item = @a[0]
463
+ mime = @a[1]
464
+ id = @a[2]
465
+ opts = @a[3]
466
+ if val = CPEE::Persistence::extract_item(id,opts,@r.join('/'))
467
+ Riddl::Parameter::Complex.new(item,mime,val)
468
+ else
469
+ @status = 404
470
+ end
471
+ end
472
+ end #}}}
473
+
474
+ class GetPositions < Riddl::Implementation #{{{
475
+ def response
476
+ id = @a[0]
477
+ opts = @a[1]
478
+ doc = XML::Smart::open_unprotected(opts[:properties_empty])
479
+ doc.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
480
+ des = doc.find("/p:properties/p:positions").first
481
+ CPEE::Persistence::extract_set(id,opts,'positions').each do |de|
482
+ node = des.add(*de)
483
+ if pt = CPEE::Persistence::extract_item(id,opts,File.join('positions',de[0],'@passthrough'))
484
+ node.attributes['passthrough'] = pt
485
+ end
486
+ end
487
+ Riddl::Parameter::Complex.new('positions','text/xml',des.to_doc.to_s)
488
+ end
489
+ end #}}}
490
+ class PatchPositions < Riddl::Implementation #{{{
491
+ def self::set(id,opts,xml)
492
+ doc = XML::Smart::string(xml)
493
+ content = {}
494
+ doc.find("/*/*").map do |ele|
495
+ val = { 'position' => ele.qname.name }
496
+ val['passthrough'] = ele.attributes['passthrough'] if ele.attributes['passthrough']
497
+ content[ele.text] ||= []
498
+ content[ele.text] << val
499
+ end
500
+ CPEE::Persistence::set_item(id,opts,'position',content)
501
+ end
502
+
503
+ def response
504
+ id = @a[0]
505
+ opts = @a[1]
506
+ if opts[:statemachine].readonly? id
507
+ @status = 423
508
+ else
509
+ begin
510
+ PatchPositions::set(id,opts,@p[0].value.read)
511
+ rescue => e
512
+ @status = 400
513
+ end
514
+ end
515
+ nil
516
+ end
517
+ end #}}}
518
+ class PutPositions < Riddl::Implementation #{{{
519
+ def PutPositions::set(id,opts,xml)
520
+ doc = XML::Smart::string(xml)
521
+ content = {}
522
+ newkeys = []
523
+ doc.find("/*/*").map do |ele|
524
+ val = { 'position' => ele.qname.name }
525
+ val['passthrough'] = ele.attributes['passthrough'] if ele.attributes['passthrough']
526
+ content[ele.text] ||= []
527
+ content[ele.text] << val
528
+ newkeys << ele.qname.name
529
+ end
530
+ oldkeys = CPEE::Persistence::extract_set(id,opts,'positions').to_h.keys
531
+ del = oldkeys - newkeys
532
+ del.each do |key|
533
+ val = { 'position' => key }
534
+ content['unmark'] ||= []
535
+ content['unmark'] << val
536
+ end
537
+ CPEE::Persistence::set_item(id,opts,'position',content)
538
+ end
539
+
540
+ def response
541
+ id = @a[0]
542
+ opts = @a[1]
543
+ if opts[:statemachine].readonly? id
544
+ @status = 423
545
+ else
546
+ begin
547
+ PutPositions::set(id,opts,@p[0].value.read)
548
+ rescue => e
549
+ @status = 400
550
+ end
551
+ end
552
+ nil
553
+ end
554
+ end #}}}
555
+ class PostPositions < Riddl::Implementation #{{{
556
+ def response
557
+ id = @a[0]
558
+ opts = @a[1]
559
+ if opts[:statemachine].readonly? id
560
+ @status = 423
561
+ else
562
+ begin
563
+ doc = XML::Smart::string(@p[0].value.read)
564
+ if not CPEE::Persistence::extract_item(id,opts,File.join('positions',doc.root.qname.name))
565
+ content = {}
566
+ content[doc.root.text] = [{ 'position' => doc.root.qname.name }]
567
+ content[doc.root.text][0]['passthrough'] = doc.root.attributes['passthrough'] if doc.root.attributes['passthrough']
568
+ CPEE::Persistence::set_item(id,opts,'position',content)
569
+ else
570
+ @status= 409
571
+ end
572
+ Riddl::Parameter::Simple.new('id',doc.root.qname.name)
573
+ rescue => e
574
+ @status = 400
575
+ end
576
+ end
577
+ nil
578
+ end
579
+ end #}}}
580
+ class GetDetail < Riddl::Implementation #{{{
581
+ def response
582
+ item = @a[0]
583
+ id = @a[1]
584
+ opts = @a[2]
585
+ if val = CPEE::Persistence::extract_item(id,opts,@r.join('/'))
586
+ Riddl::Parameter::Simple.new('value',val)
587
+ else
588
+ @status = 404
589
+ end
590
+ end
591
+ end #}}}
592
+ class SetDetail < Riddl::Implementation #{{{
593
+ def response
594
+ id = @a[0]
595
+ opts = @a[1]
596
+ if CPEE::Persistence::extract_item(id,opts,@r.join('/'))
597
+ CPEE::Persistence::set_item(id,opts,'position',@p[0].value => [ { 'position' => @r.last } ])
598
+ else
599
+ @status = 404
600
+ end
601
+ nil
602
+ end
603
+ end #}}}
604
+ class DelDetail < Riddl::Implementation #{{{
605
+ def response
606
+ id = @a[0]
607
+ opts = @a[1]
608
+ if CPEE::Persistence::extract_item(id,opts,@r.join('/'))
609
+ CPEE::Persistence::set_position(id,opts,'position','unmark' => [ { 'position' => @r.last } ])
610
+ else
611
+ @status = 404
612
+ end
613
+ nil
614
+ end
615
+ end #}}}
616
+ class GetPt < Riddl::Implementation #{{{
617
+ def response
618
+ id = @a[0]
619
+ opts = @a[1]
620
+ if val = CPEE::Persistence::extract_item(id,opts,@r.join('/'))
621
+ Riddl::Parameter::Simple.new('value',val)
622
+ else
623
+ @status = 404
624
+ end
625
+ end
626
+ end #}}}
627
+
628
+ class PutDescription < Riddl::Implementation #{{{
629
+ def self::set(id,opts,xml)
630
+ dslx, dsl, de, ep = transform(
631
+ xml,
632
+ CPEE::Persistence::extract_item(id,opts,'transformation/description'),
633
+ CPEE::Persistence::extract_item(id,opts,'transformation/description/@type'),
634
+ CPEE::Persistence::extract_item(id,opts,'transformation/dataelements'),
635
+ CPEE::Persistence::extract_item(id,opts,'transformation/dataelements/@type'),
636
+ CPEE::Persistence::extract_item(id,opts,'transformation/endpoints'),
637
+ CPEE::Persistence::extract_item(id,opts,'transformation/endpoints/@type'),
638
+ opts
639
+ )
640
+ CPEE::Persistence::set_item(id,opts,'description',
641
+ :description => xml,
642
+ :dslx => dslx,
643
+ :dsl => dsl
644
+ )
645
+ PatchItems::set_hash('dataelements',id,opts,de) unless de.empty?
646
+ PatchItems::set_hash('dataelements',id,opts,ep) unless ep.empty?
647
+ end
648
+
649
+ def response
650
+ id = @a[0]
651
+ opts = @a[1]
652
+ if opts[:statemachine].readonly? id
653
+ @status = 422 # semantic error
654
+ else
655
+ begin
656
+ PutDescription::set(id,opts,@p[0].value.read)
657
+ rescue
658
+ @status = 400
659
+ end
660
+ end
661
+ nil
662
+ end
663
+ end #}}}
664
+
665
+ class GetTransformation < Riddl::Implementation #{{{
666
+ def response
667
+ id = @a[0]
668
+ opts = @a[1]
669
+ doc = XML::Smart::open_unprotected(opts[:properties_empty])
670
+ doc.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
671
+ des = doc.find('/p:properties/p:transformation').first
672
+ des.find('p:description').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/description')
673
+ des.find('p:dataelements').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/dataelements')
674
+ des.find('p:endpoints').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/endpoints')
675
+ des.find('p:description/@type').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/description/@type')
676
+ des.find('p:dataelements/@type').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/dataelements/@type')
677
+ des.find('p:endpoints/@type').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/endpoints/@type')
678
+ Riddl::Parameter::Complex.new('status','text/xml',des.to_doc.to_s)
679
+ end
680
+ end #}}}
681
+ class PutTransformation < Riddl::Implementation #{{{
682
+ def self::set(id,opts,xml)
683
+ doc = XML::Smart::string(xml)
684
+ doc.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
685
+ CPEE::Persistence::set_item(id,opts,'transformation',
686
+ :description => doc.find('string(/p:transformation/p:description)'),
687
+ :description_type => doc.find('string(/p:transformation/p:description/@type)'),
688
+ :dataelements =>doc.find('string(/p:transformation/p:dataelements)'),
689
+ :dataelements_type => doc.find('string(/p:transformation/p:dataelements/@type)'),
690
+ :endpoints =>doc.find('string(/p:transformation/p:endpoints)'),
691
+ :endpoints_type => doc.find('string(/p:transformation/p:endpoints/@type)')
692
+ )
693
+ end
694
+ def response
695
+ id = @a[0]
696
+ opts = @a[1]
697
+ if opts[:statemachine].readonly? id
698
+ @status = 422 # semantic error
699
+ else
700
+ PutTransformation::set(id,opts,@p[0].value.read)
701
+ end
702
+ nil
703
+ end
704
+ end #}}}
705
+
706
+ end
707
+ end