ruote 0.9.20 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (397) hide show
  1. data/.gitignore +3 -0
  2. data/CHANGELOG.txt +8 -0
  3. data/CREDITS.txt +65 -0
  4. data/LICENSE.txt +21 -0
  5. data/README.rdoc +76 -0
  6. data/Rakefile +68 -0
  7. data/TODO.txt +287 -0
  8. data/examples/flickr_report.rb +108 -0
  9. data/examples/ruote_quickstart.rb +42 -0
  10. data/examples/web_first_page.rb +57 -0
  11. data/lib/ruote.rb +6 -0
  12. data/lib/ruote/context.rb +136 -0
  13. data/lib/ruote/engine.rb +339 -0
  14. data/lib/{openwfe/expressions/merge.rb → ruote/engine/process_error.rb} +35 -24
  15. data/lib/ruote/engine/process_status.rb +236 -0
  16. data/lib/ruote/evt/tracker.rb +110 -0
  17. data/lib/ruote/exp/command.rb +88 -0
  18. data/lib/ruote/exp/commanded.rb +69 -0
  19. data/lib/ruote/exp/condition.rb +120 -0
  20. data/lib/ruote/exp/expression_map.rb +103 -0
  21. data/lib/ruote/exp/fe_add_branches.rb +138 -0
  22. data/lib/ruote/exp/fe_apply.rb +85 -0
  23. data/lib/ruote/exp/fe_cancel_process.rb +74 -0
  24. data/lib/ruote/exp/fe_command.rb +163 -0
  25. data/lib/ruote/exp/fe_concurrence.rb +273 -0
  26. data/lib/ruote/exp/fe_concurrent_iterator.rb +204 -0
  27. data/lib/ruote/exp/fe_cron.rb +141 -0
  28. data/lib/ruote/exp/fe_cursor.rb +270 -0
  29. data/lib/ruote/exp/fe_define.rb +112 -0
  30. data/lib/{openwfe/engine/fs_engine.rb → ruote/exp/fe_echo.rb} +24 -18
  31. data/lib/ruote/exp/fe_equals.rb +115 -0
  32. data/lib/ruote/exp/fe_error.rb +90 -0
  33. data/lib/ruote/exp/fe_forget.rb +81 -0
  34. data/lib/ruote/exp/fe_if.rb +124 -0
  35. data/lib/ruote/exp/fe_inc.rb +205 -0
  36. data/lib/ruote/exp/fe_iterator.rb +193 -0
  37. data/lib/ruote/exp/fe_listen.rb +197 -0
  38. data/lib/{openwfe/engine.rb → ruote/exp/fe_noop.rb} +20 -3
  39. data/lib/ruote/exp/fe_participant.rb +202 -0
  40. data/lib/ruote/exp/fe_redo.rb +83 -0
  41. data/lib/ruote/exp/fe_reserve.rb +126 -0
  42. data/lib/ruote/exp/fe_restore.rb +102 -0
  43. data/lib/ruote/exp/fe_save.rb +79 -0
  44. data/lib/ruote/exp/fe_sequence.rb +60 -0
  45. data/lib/ruote/exp/fe_set.rb +160 -0
  46. data/lib/ruote/exp/fe_subprocess.rb +203 -0
  47. data/lib/{openwfe/expool/errors.rb → ruote/exp/fe_undo.rb} +28 -30
  48. data/lib/ruote/exp/fe_wait.rb +92 -0
  49. data/lib/ruote/exp/fe_when.rb +214 -0
  50. data/lib/ruote/exp/flowexpression.rb +624 -0
  51. data/lib/{openwfe/omixins.rb → ruote/exp/iterator.rb} +41 -23
  52. data/lib/ruote/exp/merge.rb +66 -0
  53. data/lib/{openwfe/util/ometa.rb → ruote/exp/raw.rb} +16 -16
  54. data/lib/ruote/exp/ro_attributes.rb +203 -0
  55. data/lib/ruote/exp/ro_persist.rb +139 -0
  56. data/lib/ruote/exp/ro_variables.rb +192 -0
  57. data/lib/ruote/fei.rb +131 -0
  58. data/lib/{openwfe/version.rb → ruote/id/mnemo_wfid_generator.rb} +17 -3
  59. data/lib/{openwfe/extras/engine/dm_engine.rb → ruote/id/wfid_generator.rb} +34 -22
  60. data/lib/ruote/log/fs_history.rb +181 -0
  61. data/lib/ruote/log/test_logger.rb +254 -0
  62. data/lib/ruote/log/wait_logger.rb +67 -0
  63. data/lib/ruote/parser.rb +205 -0
  64. data/lib/ruote/parser/ruby_dsl.rb +85 -0
  65. data/lib/ruote/parser/xml.rb +92 -0
  66. data/lib/ruote/part/block_participant.rb +101 -0
  67. data/lib/ruote/part/dispatch_pool.rb +84 -0
  68. data/lib/ruote/part/hash_participant.rb +91 -0
  69. data/lib/ruote/part/local_participant.rb +52 -0
  70. data/lib/{openwfe/engine/tc_engine.rb → ruote/part/no_op_participant.rb} +19 -14
  71. data/lib/{openwfe/engine/tt_engine.rb → ruote/part/null_participant.rb} +17 -18
  72. data/lib/ruote/part/participant_list.rb +201 -0
  73. data/lib/ruote/part/smtp_participant.rb +135 -0
  74. data/lib/ruote/part/storage_participant.rb +140 -0
  75. data/lib/{openwfe/util/irb.rb → ruote/part/template.rb} +23 -31
  76. data/lib/ruote/participant.rb +6 -0
  77. data/lib/ruote/receiver/base.rb +73 -0
  78. data/lib/ruote/storage/base.rb +210 -0
  79. data/lib/ruote/storage/fs_storage.rb +89 -0
  80. data/lib/ruote/storage/hash_storage.rb +171 -0
  81. data/lib/ruote/tree_dot.rb +85 -0
  82. data/lib/{openwfe → ruote}/util/dollar.rb +47 -63
  83. data/lib/{openwfe/extras/singlecon.rb → ruote/util/hashdot.rb} +40 -19
  84. data/lib/ruote/util/look.rb +129 -0
  85. data/lib/ruote/util/lookup.rb +92 -0
  86. data/lib/ruote/util/misc.rb +119 -0
  87. data/lib/ruote/util/ometa.rb +55 -0
  88. data/lib/ruote/util/serializer.rb +103 -0
  89. data/lib/ruote/util/time.rb +90 -0
  90. data/lib/ruote/util/tree.rb +58 -0
  91. data/lib/{openwfe → ruote}/util/treechecker.rb +10 -16
  92. data/lib/ruote/worker.rb +375 -0
  93. data/lib/ruote/workitem.rb +176 -0
  94. data/phil.txt +14 -0
  95. data/ruote.gemspec +278 -0
  96. data/test/README.rdoc +15 -0
  97. data/test/bm/ci.rb +55 -0
  98. data/test/bm/ici.rb +71 -0
  99. data/test/bm/juuman.rb +54 -0
  100. data/test/bm/load_26c.rb +25 -7
  101. data/test/bm/mega.rb +64 -0
  102. data/test/bm/seq_thousand.rb +31 -0
  103. data/test/bm/t.rb +35 -0
  104. data/test/functional/base.rb +88 -99
  105. data/test/functional/concurrent_base.rb +91 -0
  106. data/test/functional/crunner.rb +26 -0
  107. data/test/functional/ct_0_concurrence.rb +68 -0
  108. data/test/functional/ct_1_iterator.rb +61 -0
  109. data/test/functional/ct_2_cancel.rb +69 -0
  110. data/test/functional/eft_0_process_definition.rb +46 -15
  111. data/test/functional/eft_10_cancel_process.rb +46 -0
  112. data/test/functional/eft_11_wait.rb +97 -0
  113. data/test/functional/eft_12_listen.rb +271 -0
  114. data/test/functional/eft_13_iterator.rb +267 -0
  115. data/test/functional/eft_14_cursor.rb +278 -0
  116. data/test/functional/eft_15_loop.rb +67 -0
  117. data/test/functional/eft_16_if.rb +171 -0
  118. data/test/functional/eft_17_equals.rb +55 -0
  119. data/test/functional/eft_18_concurrent_iterator.rb +361 -0
  120. data/test/functional/eft_19_reserve.rb +136 -0
  121. data/test/functional/eft_1_echo.rb +59 -0
  122. data/test/functional/eft_20_save.rb +76 -0
  123. data/test/functional/eft_21_restore.rb +61 -0
  124. data/test/functional/eft_22_noop.rb +28 -0
  125. data/test/functional/eft_23_apply.rb +145 -0
  126. data/test/functional/eft_24_add_branches.rb +86 -0
  127. data/test/functional/eft_25_command.rb +28 -0
  128. data/test/functional/eft_26_error.rb +77 -0
  129. data/test/functional/eft_27_inc.rb +279 -0
  130. data/test/functional/eft_28_when.rb +109 -0
  131. data/test/functional/eft_29_cron.rb +64 -0
  132. data/test/functional/eft_2_sequence.rb +38 -27
  133. data/test/functional/eft_3_participant.rb +122 -0
  134. data/test/functional/eft_4_set.rb +230 -0
  135. data/test/functional/eft_5_subprocess.rb +164 -0
  136. data/test/functional/eft_6_concurrence.rb +279 -0
  137. data/test/functional/eft_7_forget.rb +61 -0
  138. data/test/functional/eft_8_undo.rb +78 -0
  139. data/test/functional/eft_9_redo.rb +46 -0
  140. data/test/functional/ft_0_worker.rb +46 -0
  141. data/test/functional/ft_10_dollar.rb +90 -0
  142. data/test/functional/ft_11_recursion.rb +111 -0
  143. data/test/functional/ft_12_launchitem.rb +37 -0
  144. data/test/functional/ft_13_variables.rb +131 -0
  145. data/test/functional/ft_14_re_apply.rb +133 -0
  146. data/test/functional/ft_15_timeout.rb +205 -0
  147. data/test/functional/ft_16_participant_params.rb +47 -0
  148. data/test/functional/ft_17_conditional.rb +76 -0
  149. data/test/functional/ft_18_kill.rb +85 -0
  150. data/test/functional/ft_19_alias.rb +33 -0
  151. data/test/functional/ft_1_process_status.rb +410 -20
  152. data/test/functional/ft_20_storage_participant.rb +46 -0
  153. data/test/functional/ft_21_forget.rb +42 -0
  154. data/test/functional/ft_22_process_definitions.rb +80 -0
  155. data/test/functional/ft_23_load_defs.rb +55 -0
  156. data/test/functional/ft_24_block_participants.rb +59 -0
  157. data/test/functional/ft_25_receiver.rb +87 -0
  158. data/test/functional/ft_26_participant_timeout.rb +49 -0
  159. data/test/functional/ft_27_var_indirection.rb +93 -0
  160. data/test/functional/ft_28_null_noop_participants.rb +51 -0
  161. data/test/functional/ft_29_part_template.rb +78 -0
  162. data/test/functional/ft_2_errors.rb +320 -0
  163. data/test/functional/ft_30_smtp_participant.rb +69 -0
  164. data/test/functional/ft_31_part_blocking.rb +70 -0
  165. data/test/functional/ft_32_history.rb +184 -0
  166. data/test/functional/ft_33_participant_subprocess_priority.rb +32 -0
  167. data/test/functional/ft_34_cursor_rewind.rb +98 -0
  168. data/test/functional/ft_35_add_service.rb +48 -0
  169. data/test/functional/ft_3_participant_registration.rb +107 -0
  170. data/test/functional/ft_4_cancel.rb +72 -0
  171. data/test/functional/ft_5_on_error.rb +155 -0
  172. data/test/functional/ft_6_on_cancel.rb +165 -0
  173. data/test/functional/ft_7_tags.rb +88 -0
  174. data/test/functional/ft_8_participant_consumption.rb +75 -0
  175. data/test/functional/ft_9_subprocesses.rb +145 -0
  176. data/test/functional/restart_base.rb +17 -26
  177. data/test/functional/rt_0_wait.rb +55 -0
  178. data/test/functional/rt_1_listen.rb +56 -0
  179. data/test/functional/rt_2_errors.rb +56 -0
  180. data/test/functional/rt_3_when.rb +70 -0
  181. data/test/functional/rt_4_cron.rb +63 -0
  182. data/test/functional/rt_5_timeout.rb +60 -0
  183. data/test/functional/rtest.rb +8 -0
  184. data/test/functional/storage_helper.rb +79 -0
  185. data/test/functional/test.rb +23 -11
  186. data/test/mpc_test.rb +29 -0
  187. data/test/path_helper.rb +4 -2
  188. data/test/pdef.xml +7 -0
  189. data/test/test_helper.rb +2 -30
  190. data/test/unit/storages.rb +13 -0
  191. data/test/unit/test.rb +2 -11
  192. data/test/unit/ut_0_ruby_parser.rb +120 -0
  193. data/test/unit/ut_11_lookup.rb +51 -0
  194. data/test/unit/ut_13_serializer.rb +65 -0
  195. data/test/unit/ut_14_is_uri.rb +28 -0
  196. data/test/unit/ut_15_util.rb +34 -0
  197. data/test/unit/ut_16_parser.rb +100 -0
  198. data/test/unit/ut_17_storage.rb +122 -0
  199. data/test/unit/ut_1_fei.rb +20 -0
  200. data/test/unit/ut_2_wfidgen.rb +21 -0
  201. data/test/unit/ut_3_wait_logger.rb +41 -0
  202. data/test/unit/ut_4_expmap.rb +20 -0
  203. data/test/unit/ut_5_tree.rb +54 -0
  204. data/test/unit/ut_6_condition.rb +138 -0
  205. data/test/unit/ut_7_workitem.rb +21 -0
  206. data/test/unit/ut_8_tree_to_dot.rb +72 -0
  207. data/test/unit/ut_9_xml_parser.rb +61 -0
  208. metadata +246 -253
  209. data/README.txt +0 -36
  210. data/bin/validate-workflow.rb +0 -89
  211. data/examples/about_state.rb +0 -81
  212. data/examples/bigflow.rb +0 -19
  213. data/examples/csv_weather.rb +0 -23
  214. data/examples/engine_template.rb +0 -222
  215. data/examples/flowtracing.rb +0 -24
  216. data/examples/homeworkreview.rb +0 -68
  217. data/examples/kotoba.rb +0 -22
  218. data/examples/mano_tracker.rb +0 -172
  219. data/examples/openwferu.rb +0 -60
  220. data/examples/quickstart.rb +0 -87
  221. data/examples/quotereporter.rb +0 -150
  222. data/examples/simple.rb +0 -56
  223. data/lib/openwfe.rb +0 -27
  224. data/lib/openwfe/contextual.rb +0 -120
  225. data/lib/openwfe/def.rb +0 -37
  226. data/lib/openwfe/engine/engine.rb +0 -455
  227. data/lib/openwfe/engine/expool_methods.rb +0 -113
  228. data/lib/openwfe/engine/file_persisted_engine.rb +0 -84
  229. data/lib/openwfe/engine/launch_methods.rb +0 -245
  230. data/lib/openwfe/engine/listener_methods.rb +0 -128
  231. data/lib/openwfe/engine/lookup_methods.rb +0 -156
  232. data/lib/openwfe/engine/participant_methods.rb +0 -141
  233. data/lib/openwfe/engine/status_methods.rb +0 -382
  234. data/lib/openwfe/engine/update_exp_methods.rb +0 -119
  235. data/lib/openwfe/expool/def_parser.rb +0 -196
  236. data/lib/openwfe/expool/errorjournal.rb +0 -294
  237. data/lib/openwfe/expool/expool_pause_methods.rb +0 -87
  238. data/lib/openwfe/expool/expressionpool.rb +0 -941
  239. data/lib/openwfe/expool/expstorage.rb +0 -370
  240. data/lib/openwfe/expool/fs_expstorage.rb +0 -302
  241. data/lib/openwfe/expool/history.rb +0 -278
  242. data/lib/openwfe/expool/journal.rb +0 -210
  243. data/lib/openwfe/expool/journal_replay.rb +0 -305
  244. data/lib/openwfe/expool/representation.rb +0 -105
  245. data/lib/openwfe/expool/tc_expstorage.rb +0 -239
  246. data/lib/openwfe/expool/threaded_expstorage.rb +0 -163
  247. data/lib/openwfe/expool/tt_expstorage.rb +0 -55
  248. data/lib/openwfe/expool/wfidgen.rb +0 -370
  249. data/lib/openwfe/expool/yaml_errorjournal.rb +0 -187
  250. data/lib/openwfe/expressions/condition.rb +0 -226
  251. data/lib/openwfe/expressions/environment.rb +0 -232
  252. data/lib/openwfe/expressions/expression_map.rb +0 -248
  253. data/lib/openwfe/expressions/expression_tree.rb +0 -265
  254. data/lib/openwfe/expressions/fe_cancel.rb +0 -89
  255. data/lib/openwfe/expressions/fe_command.rb +0 -237
  256. data/lib/openwfe/expressions/fe_concurrence.rb +0 -599
  257. data/lib/openwfe/expressions/fe_cron.rb +0 -197
  258. data/lib/openwfe/expressions/fe_cursor.rb +0 -200
  259. data/lib/openwfe/expressions/fe_define.rb +0 -146
  260. data/lib/openwfe/expressions/fe_do.rb +0 -181
  261. data/lib/openwfe/expressions/fe_equals.rb +0 -273
  262. data/lib/openwfe/expressions/fe_error.rb +0 -103
  263. data/lib/openwfe/expressions/fe_filter.rb +0 -112
  264. data/lib/openwfe/expressions/fe_filter_definition.rb +0 -151
  265. data/lib/openwfe/expressions/fe_fqv.rb +0 -231
  266. data/lib/openwfe/expressions/fe_http.rb +0 -198
  267. data/lib/openwfe/expressions/fe_if.rb +0 -287
  268. data/lib/openwfe/expressions/fe_iterator.rb +0 -128
  269. data/lib/openwfe/expressions/fe_listen.rb +0 -327
  270. data/lib/openwfe/expressions/fe_losfor.rb +0 -102
  271. data/lib/openwfe/expressions/fe_misc.rb +0 -374
  272. data/lib/openwfe/expressions/fe_participant.rb +0 -231
  273. data/lib/openwfe/expressions/fe_reserve.rb +0 -192
  274. data/lib/openwfe/expressions/fe_save.rb +0 -255
  275. data/lib/openwfe/expressions/fe_sequence.rb +0 -102
  276. data/lib/openwfe/expressions/fe_set.rb +0 -121
  277. data/lib/openwfe/expressions/fe_step.rb +0 -146
  278. data/lib/openwfe/expressions/fe_subprocess.rb +0 -150
  279. data/lib/openwfe/expressions/fe_timeout.rb +0 -107
  280. data/lib/openwfe/expressions/fe_wait.rb +0 -183
  281. data/lib/openwfe/expressions/fe_when.rb +0 -118
  282. data/lib/openwfe/expressions/filter.rb +0 -85
  283. data/lib/openwfe/expressions/flowexpression.rb +0 -872
  284. data/lib/openwfe/expressions/iterator.rb +0 -206
  285. data/lib/openwfe/expressions/raw.rb +0 -330
  286. data/lib/openwfe/expressions/rprocdef.rb +0 -373
  287. data/lib/openwfe/expressions/time.rb +0 -314
  288. data/lib/openwfe/expressions/timeout.rb +0 -184
  289. data/lib/openwfe/expressions/value.rb +0 -100
  290. data/lib/openwfe/extras/engine/ar_engine.rb +0 -58
  291. data/lib/openwfe/extras/engine/db_persisted_engine.rb +0 -74
  292. data/lib/openwfe/extras/expool/ar_expstorage.rb +0 -337
  293. data/lib/openwfe/extras/expool/db_errorjournal.rb +0 -165
  294. data/lib/openwfe/extras/expool/db_expstorage.rb +0 -73
  295. data/lib/openwfe/extras/expool/db_history.rb +0 -163
  296. data/lib/openwfe/extras/expool/dm_expstorage.rb +0 -327
  297. data/lib/openwfe/extras/listeners/jabber_listeners.rb +0 -102
  298. data/lib/openwfe/extras/listeners/jabberlisteners.rb +0 -26
  299. data/lib/openwfe/extras/listeners/sqs_listeners.rb +0 -128
  300. data/lib/openwfe/extras/misc/activityfeed.rb +0 -249
  301. data/lib/openwfe/extras/misc/basecamp.rb +0 -485
  302. data/lib/openwfe/extras/misc/jabber_common.rb +0 -122
  303. data/lib/openwfe/extras/participants/active_participants.rb +0 -724
  304. data/lib/openwfe/extras/participants/active_resource_participants.rb +0 -213
  305. data/lib/openwfe/extras/participants/activeparticipants.rb +0 -3
  306. data/lib/openwfe/extras/participants/ar_participants.rb +0 -285
  307. data/lib/openwfe/extras/participants/atomfeed_participants.rb +0 -158
  308. data/lib/openwfe/extras/participants/atompub_participants.rb +0 -252
  309. data/lib/openwfe/extras/participants/basecamp_participants.rb +0 -73
  310. data/lib/openwfe/extras/participants/decision_participants.rb +0 -113
  311. data/lib/openwfe/extras/participants/jabber_participants.rb +0 -147
  312. data/lib/openwfe/extras/participants/jabberparticipants.rb +0 -3
  313. data/lib/openwfe/extras/participants/sqs_participants.rb +0 -108
  314. data/lib/openwfe/extras/participants/twitter_participants.rb +0 -162
  315. data/lib/openwfe/filterdef.rb +0 -277
  316. data/lib/openwfe/flowexpressionid.rb +0 -396
  317. data/lib/openwfe/listeners/listener.rb +0 -86
  318. data/lib/openwfe/listeners/listeners.rb +0 -135
  319. data/lib/openwfe/logging.rb +0 -108
  320. data/lib/openwfe/participants.rb +0 -5
  321. data/lib/openwfe/participants/mail_participants.rb +0 -216
  322. data/lib/openwfe/participants/participant.rb +0 -142
  323. data/lib/openwfe/participants/participant_map.rb +0 -245
  324. data/lib/openwfe/participants/participants.rb +0 -381
  325. data/lib/openwfe/participants/soap_participants.rb +0 -121
  326. data/lib/openwfe/participants/store_participants.rb +0 -249
  327. data/lib/openwfe/participants/yaml_filestorage.rb +0 -216
  328. data/lib/openwfe/representations.rb +0 -770
  329. data/lib/openwfe/rexml.rb +0 -44
  330. data/lib/openwfe/rudefinitions.rb +0 -114
  331. data/lib/openwfe/service.rb +0 -92
  332. data/lib/openwfe/tools/flowtracer.rb +0 -63
  333. data/lib/openwfe/util/json.rb +0 -55
  334. data/lib/openwfe/util/observable.rb +0 -119
  335. data/lib/openwfe/util/workqueue.rb +0 -125
  336. data/lib/openwfe/util/xml.rb +0 -270
  337. data/lib/openwfe/utils.rb +0 -484
  338. data/lib/openwfe/workitem.rb +0 -541
  339. data/lib/openwfe/worklist/storelocks.rb +0 -277
  340. data/lib/openwfe/worklist/storeparticipant.rb +0 -6
  341. data/lib/openwfe/worklist/worklist.rb +0 -283
  342. data/lib/pooltool.ru +0 -311
  343. data/test/ar_test_connection.rb +0 -63
  344. data/test/bm/fatxml.rb +0 -70
  345. data/test/dm_test_connection.rb +0 -11
  346. data/test/extras/base.rb +0 -3
  347. data/test/extras/et_0_sqs.rb +0 -37
  348. data/test/extras/et_jabber_test.rb +0 -226
  349. data/test/extras/test.rb +0 -16
  350. data/test/functional/db_ft_0_ar_participants.rb +0 -136
  351. data/test/functional/eft_10_unset.rb +0 -60
  352. data/test/functional/eft_11_sleep.rb +0 -95
  353. data/test/functional/eft_12_wait.rb +0 -57
  354. data/test/functional/eft_13_cursor.rb +0 -139
  355. data/test/functional/eft_14_loop.rb +0 -36
  356. data/test/functional/eft_15_undo.rb +0 -77
  357. data/test/functional/eft_16_redo.rb +0 -88
  358. data/test/functional/eft_1_print.rb +0 -57
  359. data/test/functional/eft_3_equals.rb +0 -98
  360. data/test/functional/eft_4_if.rb +0 -96
  361. data/test/functional/eft_5_eval.rb +0 -89
  362. data/test/functional/eft_6_reval.rb +0 -101
  363. data/test/functional/eft_7_exp.rb +0 -47
  364. data/test/functional/eft_8_log.rb +0 -50
  365. data/test/functional/eft_9_set.rb +0 -132
  366. data/test/functional/engine_helper.rb +0 -122
  367. data/test/functional/ft_0_vars_at_launch.rb +0 -27
  368. data/test/functional/ft_2_file_listener.rb +0 -45
  369. data/test/functional/ft_3_on_cancel.rb +0 -171
  370. data/test/functional/ft_4_on_error.rb +0 -220
  371. data/test/functional/ft_5_process_uri.rb +0 -82
  372. data/test/functional/ft_6_process_status.rb +0 -62
  373. data/test/functional/ft_7_parameters.rb +0 -103
  374. data/test/functional/ft_8_dollar.rb +0 -53
  375. data/test/functional/ft_9_register_participants.rb +0 -119
  376. data/test/functional/rft_0_sleep.rb +0 -76
  377. data/test/unit/ut_0_fei.rb +0 -166
  378. data/test/unit/ut_10_lookup_attribute.rb +0 -86
  379. data/test/unit/ut_11_filter.rb +0 -124
  380. data/test/unit/ut_12_conditional.rb +0 -162
  381. data/test/unit/ut_13_xmlutil.rb +0 -57
  382. data/test/unit/ut_14_var_field_lookup.rb +0 -85
  383. data/test/unit/ut_15_fe_att_lookup.rb +0 -55
  384. data/test/unit/ut_16_expstorage_findexp.rb +0 -38
  385. data/test/unit/ut_17_representations.rb +0 -330
  386. data/test/unit/ut_17b_representations_hash.rb +0 -97
  387. data/test/unit/ut_18_store_lock.rb +0 -77
  388. data/test/unit/ut_1_wfid.rb +0 -104
  389. data/test/unit/ut_2_utils.rb +0 -53
  390. data/test/unit/ut_3_expmap.rb +0 -65
  391. data/test/unit/ut_4_fulldup.rb +0 -163
  392. data/test/unit/ut_5_observable.rb +0 -132
  393. data/test/unit/ut_6_treechecker.rb +0 -101
  394. data/test/unit/ut_7_parser_ruby.rb +0 -344
  395. data/test/unit/ut_7b_parser_ruby.rb +0 -56
  396. data/test/unit/ut_8_parser_description.rb +0 -77
  397. data/test/unit/ut_9_workitem.rb +0 -72
@@ -1,872 +0,0 @@
1
- #--
2
- # Copyright (c) 2006-2009, John Mettraux, jmettraux@gmail.com
3
- #
4
- # Permission is hereby granted, free of charge, to any person obtaining a copy
5
- # of this software and associated documentation files (the "Software"), to deal
6
- # in the Software without restriction, including without limitation the rights
7
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- # copies of the Software, and to permit persons to whom the Software is
9
- # furnished to do so, subject to the following conditions:
10
- #
11
- # The above copyright notice and this permission notice shall be included in
12
- # all copies or substantial portions of the Software.
13
- #
14
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
- # THE SOFTWARE.
21
- #
22
- # Made in Japan.
23
- #++
24
-
25
- require 'openwfe/utils'
26
- require 'openwfe/logging'
27
- require 'openwfe/contextual'
28
- require 'openwfe/rudefinitions'
29
- require 'openwfe/util/ometa'
30
- require 'openwfe/util/dollar'
31
- require 'openwfe/expressions/expression_tree'
32
-
33
-
34
- module OpenWFE
35
-
36
- #
37
- # When this variable is set to true (at the process root),
38
- # it means the process is paused.
39
- #
40
- VAR_PAUSED = '/__paused__'
41
-
42
- #
43
- # FlowExpression
44
- #
45
- # The base class for all OpenWFE flow expression classes.
46
- # It gathers all the methods for attributes and variable lookup.
47
- #
48
- class FlowExpression < ObjectWithMeta
49
-
50
- include Contextual
51
- include Logging
52
- include OwfeServiceLocator
53
-
54
- #
55
- # The 'flow expression id' the unique identifier within a
56
- # workflow instance for this expression instance.
57
- #
58
- attr_accessor :fei
59
-
60
- #
61
- # The 'flow expression id' of the parent expression.
62
- # Will yield 'nil' if this expression is the root of its process
63
- # instance.
64
- #
65
- attr_accessor :parent_id
66
-
67
- #
68
- # The 'flow expression id' of the environment this expression works
69
- # with.
70
- #
71
- attr_accessor :environment_id
72
-
73
- #
74
- # The attributes of the expression, as found in the process definition.
75
- #
76
- # <participant ref='toto' timeout='1d10h' />
77
- #
78
- # The attributes will be ref => "toto" and timeout => "1d10h" (yes,
79
- # 'attributes' contains a hash.
80
- #
81
- attr_accessor :attributes
82
-
83
- #
84
- # An array of 'flow expression id' instances. These are the ids of
85
- # the expressions children to this one.
86
- #
87
- # <sequence>
88
- # <participant ref="toto" />
89
- # <participant ref="bert" />
90
- # </sequence>
91
- #
92
- # The expression instance for 'sequence' will hold the feis of toto and
93
- # bert in its children array.
94
- #
95
- attr_accessor :children
96
-
97
- #
98
- # When the FlowExpression instance is applied, this time stamp is set
99
- # to the current date.
100
- #
101
- attr_accessor :apply_time
102
-
103
- #
104
- # Used by raw expressions to store the not yet interpreted branches
105
- # of a process, used by other expressions to store their
106
- # representation at 'eval time'.
107
- #
108
- attr_accessor :raw_representation
109
-
110
- #
111
- # Meant to contain a boolean value. If set to 'true' it means that
112
- # this expression raw_representation has been modified after
113
- # the expression instantiation.
114
- #
115
- # It's used to keep track effectively of in-flight modifications
116
- # of process instances.
117
- #
118
- attr_accessor :raw_rep_updated
119
-
120
- #
121
- # When was this expression last updated ?
122
- #
123
- attr_accessor :updated_at
124
-
125
-
126
- #
127
- # Builds a new instance of an expression
128
- #
129
- def self.new_exp (fei, parent_id, env_id, app_context, attributes)
130
-
131
- e = self.new
132
-
133
- e.fei = fei
134
- e.parent_id = parent_id
135
- e.environment_id = env_id
136
- e.application_context = app_context
137
- e.attributes = attributes
138
-
139
- e.children = []
140
- e.apply_time = nil
141
-
142
- e
143
- end
144
-
145
- #--
146
- # the two most important methods for flow expressions
147
- #++
148
-
149
- #
150
- # this default implementation immediately replies to the
151
- # parent expression
152
- #
153
- def apply (workitem)
154
-
155
- get_parent.reply(workitem) if @parent_id
156
- end
157
-
158
- #
159
- # this default implementation immediately replies to the
160
- # parent expression
161
- #
162
- def reply (workitem)
163
-
164
- reply_to_parent(workitem)
165
- end
166
-
167
- #
168
- # Triggers the reply to the parent expression (of course, via the
169
- # expression pool).
170
- # Expressions do call this method when their job is done and the flow
171
- # should resume without them.
172
- #
173
- def reply_to_parent (workitem)
174
-
175
- get_expression_pool.reply_to_parent(self, workitem)
176
- end
177
-
178
- #
179
- # A default implementation for cancel :
180
- # triggers any registered 'on_cancel' and then cancels all the children
181
- #
182
- # Attempts to return an InFlowWorkItem
183
- #
184
- def cancel
185
-
186
- trigger_on_cancel
187
-
188
- (@children || []).inject(nil) do |workitem, child|
189
-
190
- #wi = child.is_a?(String) ? nil : get_expression_pool.cancel(child)
191
- wi = get_expression_pool.cancel(child)
192
- workitem ||= wi
193
- end
194
- end
195
-
196
- #
197
- # triggers the on_cancel attribute of the expression, if any, and forgets
198
- # it...
199
- #
200
- # makes sure to pass a copy of the cancelled process's variables to the
201
- # on_cancel process/participant if any
202
- #
203
- def trigger_on_cancel
204
-
205
- on_cancel = (self.attributes || {})['on_cancel'] || return
206
-
207
- on_cancel, workitem = on_cancel
208
-
209
- template = lookup_variable(on_cancel) || [ on_cancel, {}, [] ]
210
-
211
- get_expression_pool.launch_subprocess(
212
- self,template, true, workitem, get_environment.lookup_all_variables)
213
- end
214
-
215
- #
216
- # some convenience methods
217
-
218
- #
219
- # Returns the parent expression (not as a FlowExpressionId but directly
220
- # as the FlowExpression instance it is).
221
- #
222
- def get_parent
223
-
224
- get_expression_pool.fetch_expression(@parent_id)
225
- end
226
-
227
- #
228
- # Stores itself in the expression pool.
229
- # It's very important for expressions in persisted context to save
230
- # themselves as soon as their state changed.
231
- # Else this information would be lost at engine restart or
232
- # simply if the expression got swapped out of memory and reloaded later.
233
- #
234
- def store_itself
235
-
236
- #ldebug { "store_itself() for #{@fei.to_debug_s}" }
237
- #ldebug { "store_itself() \n#{OpenWFE::caller_to_s(0, 6)}" }
238
-
239
- get_expression_pool.update(self)
240
- end
241
-
242
- #
243
- # Returns the environment instance this expression uses.
244
- # An environment is a container (a scope) for variables in the process
245
- # definition.
246
- # Environments themselves are FlowExpression instances.
247
- #
248
- def get_environment
249
-
250
- fetch_environment || get_expression_pool.fetch_engine_environment
251
- end
252
-
253
- #
254
- # A shortcut for fetch_environment.get_root_environment
255
- #
256
- # Returns the environment of the top process (the environement
257
- # just before the engine environment in the hierarchy).
258
- #
259
- def get_root_environment
260
-
261
- fetch_environment.get_root_environment
262
- end
263
-
264
- #
265
- # Just fetches the environment for this expression.
266
- #
267
- def fetch_environment
268
-
269
- get_expression_pool.fetch_expression(@environment_id)
270
- end
271
-
272
- #
273
- # Returns true if the expression's environment was generated
274
- # for itself (usually DefineExpression do have such envs)
275
- #
276
- def owns_its_environment?
277
-
278
- return false if not @environment_id
279
-
280
- ei = @fei.dup
281
- vi = @environment_id.dup
282
-
283
- ei.expression_name = 'neutral'
284
- vi.expression_name = 'neutral'
285
-
286
- (ei == vi)
287
- end
288
-
289
- #
290
- # Returns true if this expression belongs to a paused flow
291
- #
292
- def paused?
293
-
294
- get_expression_pool.is_paused?(self)
295
- end
296
-
297
- #
298
- # Sets a variable in the current environment. Is usually
299
- # called by the 'set' expression.
300
- #
301
- # The variable name may be prefixed by / to indicate process level scope
302
- # or by // to indicate engine level (global) scope.
303
- #
304
- def set_variable (varname, value)
305
-
306
- env, var = lookup_environment(varname)
307
- env[var] = value
308
- end
309
-
310
- alias :sv :set_variable
311
-
312
- #
313
- # Looks up the value of a variable in the current environment.
314
- # If not found locally will lookup at the process level and even
315
- # further in the engine scope.
316
- #
317
- # The variable name may be prefixed by / to indicate process level scope
318
- # or by // to indicate engine level (global) scope.
319
- #
320
- def lookup_variable (varname)
321
-
322
- env, var = lookup_environment(varname)
323
- env[var]
324
- end
325
-
326
- alias :lv :lookup_variable
327
-
328
- #
329
- # Returns a stack of variable values, from here down to the engine
330
- # environment.
331
- #
332
- # A stack is simply an array whose first value is the local value and
333
- # the last value, the value registered in the engine env (if any is
334
- # registered there).
335
- #
336
- def lookup_variable_stack (varname)
337
-
338
- get_environment.lookup_variable_stack(varname)
339
- end
340
-
341
- #
342
- # Unsets a variable in the current environment.
343
- #
344
- # The variable name may be prefixed by / to indicate process level scope
345
- # or by // to indicate engine level (global) scope.
346
- #
347
- def delete_variable (varname)
348
-
349
- env, var = lookup_environment(varname)
350
- env.delete(var)
351
- end
352
-
353
- alias :unset_variable :delete_variable
354
-
355
- #
356
- # Looks up the value for an attribute of this expression.
357
- #
358
- # if the expression is
359
- #
360
- # <participant ref="toto" />
361
- #
362
- # then
363
- #
364
- # participant_expression.lookup_attribute("toto", wi)
365
- #
366
- # will yield "toto"
367
- #
368
- # The various methods for looking up attributes do perform dollar
369
- # variable substitution.
370
- # It's ok to pass a Symbol for the attribute name.
371
- #
372
- def lookup_attribute (attname, workitem, options={})
373
-
374
- default = options[:default]
375
- escape = options[:escape]
376
- tostring = options[:to_s]
377
-
378
- attname = OpenWFE.symbol_to_name(attname) if attname.kind_of?(Symbol)
379
-
380
- text = @attributes[attname]
381
-
382
- text = if text == nil
383
-
384
- default
385
-
386
- elsif escape == true
387
-
388
- text
389
-
390
- else
391
-
392
- OpenWFE.dosub(text, self, workitem)
393
- end
394
-
395
- text = text.to_s if text and tostring
396
-
397
- text
398
- end
399
-
400
- #
401
- # Returns the attribute value as a String (or nil if it's not found).
402
- #
403
- def lookup_string_attribute (attname, workitem, options={})
404
-
405
- result = lookup_attribute(attname, workitem, options)
406
- result = result.to_s if result
407
- result
408
- end
409
-
410
- #
411
- # Like lookup_attribute() but returns the value downcased [
412
- # (and stripped).
413
- # Returns nil if no such attribute was found.
414
- #
415
- def lookup_downcase_attribute (attname, workitem, options={})
416
-
417
- result = lookup_string_attribute(attname, workitem, options)
418
- result = result.strip.downcase if result
419
- result
420
- end
421
-
422
- #
423
- # Returns the value of the attribute as a Symbol.
424
- # Returns nil if there is no attribute under the given name.
425
- #
426
- def lookup_sym_attribute (attname, workitem, options={})
427
-
428
- result = lookup_downcase_attribute(attname, workitem, options)
429
- result = result.to_sym if result
430
- result
431
- end
432
-
433
- #
434
- # A convenience method for looking up a boolean value.
435
- # It's ok to pass a Symbol for the attribute name.
436
- #
437
- def lookup_boolean_attribute (attname, workitem, default=false)
438
-
439
- result = lookup_downcase_attribute(attname, workitem)
440
- return default if result == nil
441
-
442
- (result == 'true')
443
- end
444
-
445
- #
446
- # looks up an attribute, if it's an array, returns it. Else
447
- # (probably a string) will split it (comma) and return it
448
- # (each element trimmed).
449
- #
450
- def lookup_array_attribute (attname, workitem, options={})
451
-
452
- tostring = options.delete(:to_s)
453
-
454
- v = lookup_attribute(attname, workitem, options)
455
-
456
- return nil unless v
457
-
458
- v = v.to_s.split(',').collect { |e| e.strip } \
459
- unless v.is_a?(Array)
460
-
461
- v = v.collect { |e| e.to_s } \
462
- if tostring
463
-
464
- v
465
- end
466
-
467
- #
468
- # Returns true if the expression has the given attribute.
469
- # The attname parameter can be a String or a Symbol.
470
- #
471
- def has_attribute (attname)
472
-
473
- attname = OpenWFE::symbol_to_name(attname) if attname.is_a?(Symbol)
474
-
475
- (@attributes[attname] != nil)
476
- end
477
-
478
- #
479
- # Returns a hash of all the FlowExpression attributes with their
480
- # values having undergone dollar variable substitution.
481
- # If the _attributes parameter is set (to an Array instance) then
482
- # only the attributes named in that list will be looked up.
483
- #
484
- # It's ok to pass an array of Symbol instances for the attributes
485
- # parameter.
486
- #
487
- def lookup_attributes (workitem, _attributes=nil)
488
-
489
- return {} unless @attributes
490
-
491
- (_attributes || @attributes.keys).inject({}) do |r, k|
492
-
493
- k = k.to_s
494
- v = @attributes[k]
495
-
496
- r[k] = OpenWFE::dosub v, self, workitem
497
-
498
- r
499
- end
500
- end
501
-
502
- #
503
- # creates a new environment just for this expression
504
- #
505
- def new_environment (initial_vars=nil)
506
-
507
- @environment_id = @fei.dup
508
- @environment_id.expression_name = EN_ENVIRONMENT
509
-
510
- parent_fei = nil
511
- parent = nil
512
-
513
- parent, _fei = get_expression_pool.fetch(@parent_id) \
514
- if @parent_id
515
-
516
- parent_fei = parent.environment_id if parent
517
-
518
- env = Environment.new_env(
519
- @environment_id, parent_fei, nil, @application_context, nil)
520
-
521
- env.variables.merge!(initial_vars) if initial_vars
522
-
523
- env[@fei.wfname] = self.raw_representation \
524
- if (not @parent_id) and (self.is_a?(RawExpression))
525
- #
526
- # keeping track of the raw representation
527
- # of the top expression (for top recursion)
528
-
529
- env.store_itself
530
-
531
- env
532
- end
533
-
534
- #
535
- # This method is called in expressionpool.forget(). It duplicates
536
- # the expression's current environment (deep copy) and attaches
537
- # it as the expression own environment.
538
- # Returns the duplicated environment.
539
- #
540
- def dup_environment
541
-
542
- env = fetch_environment
543
- env = env.dup
544
- env.fei = @fei.dup
545
- env.fei.expression_name = EN_ENVIRONMENT
546
- @environment_id = env.fei
547
-
548
- env.store_itself
549
- end
550
-
551
- #
552
- # Takes care of removing all the children of this expression, if any.
553
- #
554
- def clean_children
555
-
556
- return unless @children
557
-
558
- @children.each do |child_fei|
559
- #next unless child.is_a?(FlowExpressionId)
560
- get_expression_pool.remove(child_fei)
561
- end
562
- end
563
-
564
- #
565
- # Removes a child from the expression children list.
566
- #
567
- def remove_child (child_fei)
568
-
569
- i = @children.index(child_fei)
570
-
571
- return unless i
572
-
573
- @children.delete_at(i)
574
- raw_children.delete_at(i)
575
- @raw_rep_updated = true
576
-
577
- store_itself
578
- end
579
-
580
- #
581
- # Currently only used by dollar.rb and its ${r:some_ruby_code},
582
- # returns the binding in this flow expression.
583
- #
584
- def get_binding
585
-
586
- binding()
587
- end
588
-
589
- #
590
- # Returns the text stored among the children
591
- #
592
- def fetch_text_content (workitem, escape=false)
593
-
594
- text = (children || raw_children).inject('') do |r, child|
595
-
596
- r << child.to_s
597
- end
598
-
599
- return nil if text == ''
600
-
601
- escape ? text : OpenWFE::dosub(text, self, workitem)
602
- end
603
-
604
- #
605
- # looks up for 'value', 'variable-value' and then for 'field-value'
606
- # if necessary.
607
- #
608
- def lookup_value (workitem, options={})
609
-
610
- lookup_vf_attribute(workitem, 'value', options) ||
611
- lookup_vf_attribute(workitem, 'val', options)
612
- end
613
-
614
- #
615
- # looks up for 'ref', 'variable-ref' and then for 'field-ref'
616
- # if necessary.
617
- #
618
- def lookup_ref (workitem, prefix='')
619
-
620
- ref = lookup_vf_attribute(workitem, 'ref', :prefix => prefix)
621
- ref ? ref.to_s : nil
622
- end
623
-
624
- #
625
- # Looks up for value attributes like 'field-ref' or 'variable-value'
626
- #
627
- def lookup_vf_attribute (workitem, att_name, options={})
628
-
629
- att_name = att_name.to_s
630
-
631
- prefix = options[:prefix] || ''
632
- prefix = prefix.to_s
633
-
634
- dash = (att_name.size > 0 and prefix.size > 0) ? '-' : ''
635
-
636
- v = lookup_attribute("#{prefix}#{dash}#{att_name}", workitem, options)
637
-
638
- att_name = "-#{att_name}" if att_name.size > 0
639
- prefix = "#{prefix}-" if prefix.size > 0
640
-
641
- return v if v
642
-
643
- v = lookup_attribute(
644
- "#{prefix}variable#{att_name}", workitem, options) ||
645
- lookup_attribute(
646
- "#{prefix}var#{att_name}", workitem, options) ||
647
- lookup_attribute(
648
- "#{prefix}v#{att_name}", workitem, options)
649
-
650
- return lookup_variable(v) if v
651
-
652
- f = lookup_attribute(
653
- "#{prefix}field#{att_name}", workitem, options) ||
654
- lookup_attribute(
655
- "#{prefix}f#{att_name}", workitem, options)
656
-
657
- f ? workitem.attributes[f.to_s] : nil
658
- end
659
-
660
- #
661
- # Since OpenWFEru 0.9.17, each expression keeps his @raw_representation
662
- # this is a shortcut for exp.raw_representation[2]
663
- #
664
- def raw_children
665
-
666
- @raw_representation[2]
667
- end
668
-
669
- #
670
- # Returns a list of children that are expressions (arrays)
671
- #
672
- def raw_expression_children
673
-
674
- @raw_representation[2].select { |c| c.is_a?(Array) }
675
- end
676
-
677
- #
678
- # Returns true if the current expression has no expression among its
679
- # [raw] children.
680
- #
681
- def has_no_expression_child
682
-
683
- (first_expression_child == nil)
684
- end
685
-
686
- #
687
- # Returns the index of the first child that is an expression.
688
- #
689
- def first_expression_child
690
-
691
- @raw_representation[2].find { |c| c.is_a?(Array) }
692
- end
693
-
694
- #
695
- # Returns the next sub process id available (this counter
696
- # is stored in the process environment under the key :next_sub_id)
697
- #
698
- def get_next_sub_id
699
-
700
- env = get_root_environment
701
-
702
- c = nil
703
-
704
- c = env.variables[:next_sub_id]
705
- n = if c
706
- c + 1
707
- else
708
- c = 0
709
- 1
710
- end
711
- env.variables[:next_sub_id] = n
712
- env.store_itself
713
-
714
- c
715
- end
716
-
717
- #
718
- # Given a child index (in the raw_children list/array), applies that
719
- # child.
720
- #
721
- # Does the bulk work of preparing the children and applying it (also
722
- # cares about registering the child in the @children array).
723
- #
724
- def apply_child (child_index, workitem)
725
-
726
- child_index, child = if child_index.is_a?(Integer)
727
- [ child_index, raw_children[child_index] ]
728
- else
729
- [ raw_children.index(child_index), child_index ]
730
- end
731
-
732
- get_expression_pool.tlaunch_child(
733
- self, child, child_index, workitem, :register_child => true)
734
- end
735
-
736
- #
737
- # Some eye candy
738
- #
739
- def to_s
740
-
741
- s = "* #{@fei.to_debug_s} [#{self.class.name}]"
742
-
743
- s << "\n `--p--> #{@parent_id.to_debug_s}" \
744
- if @parent_id
745
-
746
- s << "\n `--e--> #{@environment_id.to_debug_s}" \
747
- if @environment_id
748
-
749
- return s unless @children
750
-
751
- @children.each do |c|
752
- sc = if c.kind_of?(OpenWFE::FlowExpressionId)
753
- c.to_debug_s
754
- else
755
- ">#{c.to_s}<"
756
- end
757
- s << "\n `--c--> #{sc}"
758
- end
759
-
760
- s
761
- end
762
-
763
- #
764
- # a nice 'names' tag/method for registering the names of the
765
- # Expression classes.
766
- #
767
- def self.names (*exp_names)
768
-
769
- exp_names = exp_names.collect do |n|
770
- n.to_s
771
- end
772
- meta_def :expression_names do
773
- exp_names
774
- end
775
- end
776
-
777
- #
778
- # Returns true if the expression class is a 'definition'.
779
- #
780
- def self.is_definition?
781
- false
782
- end
783
- def self.is_definition
784
- meta_def :is_definition? do
785
- true
786
- end
787
- end
788
-
789
- #
790
- # Returns true if the expression with the given fei is an ancestor
791
- # of this expression.
792
- #
793
- def descendant_of? (fei)
794
-
795
- #p [ :d_of?, "#{@fei.wfid} #{@fei.expid}", "#{fei.wfid} #{fei.expid}" ]
796
-
797
- return false if @parent_id == nil
798
- return true if @parent_id == fei
799
- return true if fei.ancestor_of?(@fei) # shortcut
800
-
801
- get_expression_pool.fetch_expression(@parent_id).descendant_of?(fei)
802
- end
803
-
804
- def marshal_dump #:nodoc#
805
- iv = instance_variables
806
- iv.delete('@application_context')
807
- iv.inject({}) { |h, vn| h[vn] = instance_variable_get(vn); h }
808
- end
809
-
810
- def marshal_load (s) #:nodoc#
811
- s.each { |k, v| instance_variable_set(k, v) }
812
- end
813
-
814
- def to_yaml_properties #:nodoc#
815
- l = super
816
- l.delete('@application_context')
817
- l
818
- end
819
-
820
- protected
821
-
822
- #
823
- # Initializes the @children member array.
824
- #
825
- # Used by 'concurrence' for example.
826
- #
827
- def extract_children
828
- i = 0
829
- @children = []
830
- raw_representation.last.each do |child|
831
- if OpenWFE::ExpressionTree.is_not_a_node?(child)
832
- @children << child
833
- else
834
- cname = child.first.intern
835
- next if cname == :param
836
- next if cname == :parameter
837
- #next if cname == :description
838
- cfei = @fei.dup
839
- cfei.expression_name = child.first
840
- cfei.expression_id = "#{cfei.expression_id}.#{i}"
841
- efei = @environment_id
842
- rawexp = RawExpression.new_raw(
843
- cfei, @fei, efei, @application_context, OpenWFE::fulldup(child))
844
- get_expression_pool.update(rawexp)
845
- i += 1
846
- @children << rawexp.fei
847
- end
848
- end
849
- end
850
-
851
- #
852
- # If the varname starts with '//' will return the engine
853
- # environment and the truncated varname...
854
- # If the varname starts with '/' will return the root environment
855
- # for the current process instance and the truncated varname...
856
- #
857
- def lookup_environment (varname)
858
-
859
- return [
860
- get_expression_pool.fetch_engine_environment, varname[2..-1]
861
- ] if varname[0, 2] == '//'
862
-
863
- return [
864
- get_environment.get_root_environment, varname[1..-1]
865
- ] if varname[0, 1] == '/'
866
-
867
- [ get_environment, varname ]
868
- end
869
- end
870
-
871
- end
872
-