ruote 2.1.11 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. data/CHANGELOG.txt +60 -0
  2. data/CREDITS.txt +22 -4
  3. data/LICENSE.txt +1 -1
  4. data/README.rdoc +6 -7
  5. data/Rakefile +58 -59
  6. data/TODO.txt +137 -65
  7. data/couch_url.txt +1 -0
  8. data/jruby_issue.txt +32 -0
  9. data/lib/ruote.rb +1 -1
  10. data/lib/ruote/context.rb +12 -10
  11. data/lib/ruote/engine.rb +280 -145
  12. data/lib/ruote/engine/process_error.rb +5 -5
  13. data/lib/ruote/engine/process_status.rb +47 -28
  14. data/lib/ruote/exp/command.rb +7 -10
  15. data/lib/ruote/exp/commanded.rb +2 -2
  16. data/lib/ruote/exp/condition.rb +130 -43
  17. data/lib/ruote/exp/fe_add_branches.rb +2 -2
  18. data/lib/ruote/exp/fe_apply.rb +1 -1
  19. data/lib/ruote/exp/fe_cancel_process.rb +3 -3
  20. data/lib/ruote/exp/fe_command.rb +3 -3
  21. data/lib/ruote/exp/fe_concurrence.rb +4 -4
  22. data/lib/ruote/exp/fe_concurrent_iterator.rb +17 -5
  23. data/lib/ruote/exp/fe_cron.rb +3 -3
  24. data/lib/ruote/exp/fe_cursor.rb +5 -5
  25. data/lib/ruote/exp/fe_define.rb +3 -3
  26. data/lib/ruote/exp/fe_echo.rb +3 -3
  27. data/lib/ruote/exp/fe_equals.rb +2 -2
  28. data/lib/ruote/exp/fe_error.rb +2 -2
  29. data/lib/ruote/exp/fe_filter.rb +519 -0
  30. data/lib/ruote/exp/fe_forget.rb +9 -2
  31. data/lib/ruote/exp/fe_given.rb +154 -0
  32. data/lib/ruote/exp/fe_if.rb +16 -13
  33. data/lib/ruote/exp/fe_inc.rb +3 -3
  34. data/lib/ruote/exp/fe_iterator.rb +4 -4
  35. data/lib/ruote/exp/fe_let.rb +75 -0
  36. data/lib/ruote/exp/fe_listen.rb +68 -12
  37. data/lib/ruote/exp/fe_lose.rb +110 -0
  38. data/lib/ruote/exp/fe_noop.rb +1 -1
  39. data/lib/ruote/exp/{fe_when.rb → fe_once.rb} +25 -21
  40. data/lib/ruote/exp/fe_participant.rb +14 -17
  41. data/lib/ruote/exp/fe_redo.rb +10 -6
  42. data/lib/ruote/exp/fe_ref.rb +1 -1
  43. data/lib/ruote/exp/fe_registerp.rb +112 -0
  44. data/lib/ruote/exp/fe_reserve.rb +3 -3
  45. data/lib/ruote/exp/fe_restore.rb +2 -2
  46. data/lib/ruote/exp/fe_save.rb +2 -2
  47. data/lib/ruote/exp/fe_sequence.rb +3 -4
  48. data/lib/ruote/exp/fe_set.rb +16 -7
  49. data/lib/ruote/exp/fe_subprocess.rb +23 -1
  50. data/lib/ruote/exp/fe_that.rb +92 -0
  51. data/lib/ruote/exp/fe_undo.rb +3 -3
  52. data/lib/ruote/exp/fe_unregisterp.rb +71 -0
  53. data/lib/ruote/exp/fe_wait.rb +2 -2
  54. data/lib/ruote/exp/flowexpression.rb +153 -78
  55. data/lib/ruote/exp/iterator.rb +2 -2
  56. data/lib/ruote/exp/merge.rb +2 -2
  57. data/lib/ruote/exp/ro_attributes.rb +14 -12
  58. data/lib/ruote/exp/ro_filters.rb +136 -0
  59. data/lib/ruote/exp/ro_persist.rb +51 -35
  60. data/lib/ruote/exp/ro_variables.rb +18 -27
  61. data/lib/ruote/fei.rb +73 -33
  62. data/lib/ruote/id/mnemo_wfid_generator.rb +1 -1
  63. data/lib/ruote/id/wfid_generator.rb +11 -4
  64. data/lib/ruote/log/default_history.rb +122 -0
  65. data/lib/ruote/log/pretty.rb +36 -8
  66. data/lib/ruote/log/storage_history.rb +37 -5
  67. data/lib/ruote/log/test_logger.rb +26 -24
  68. data/lib/ruote/log/wait_logger.rb +5 -3
  69. data/lib/ruote/part/block_participant.rb +22 -11
  70. data/lib/ruote/part/engine_participant.rb +6 -7
  71. data/lib/ruote/part/local_participant.rb +6 -12
  72. data/lib/ruote/part/no_op_participant.rb +4 -4
  73. data/lib/ruote/part/null_participant.rb +4 -4
  74. data/lib/ruote/part/smtp_participant.rb +4 -4
  75. data/lib/ruote/part/storage_participant.rb +40 -20
  76. data/lib/ruote/part/template.rb +4 -4
  77. data/lib/ruote/participant.rb +0 -1
  78. data/lib/ruote/{parser.rb → reader.rb} +30 -25
  79. data/lib/ruote/{parser → reader}/ruby_dsl.rb +28 -11
  80. data/lib/ruote/{parser → reader}/xml.rb +6 -5
  81. data/lib/ruote/receiver/base.rb +35 -13
  82. data/lib/ruote/storage/base.rb +20 -18
  83. data/lib/ruote/storage/composite_storage.rb +10 -10
  84. data/lib/ruote/storage/fs_storage.rb +17 -10
  85. data/lib/ruote/storage/hash_storage.rb +29 -18
  86. data/lib/ruote/svc/dispatch_pool.rb +41 -14
  87. data/lib/ruote/svc/dollar_sub.rb +50 -17
  88. data/lib/ruote/svc/error_handler.rb +19 -11
  89. data/lib/ruote/svc/expression_map.rb +4 -4
  90. data/lib/ruote/svc/participant_list.rb +105 -100
  91. data/lib/ruote/svc/tracker.rb +58 -18
  92. data/lib/ruote/svc/treechecker.rb +51 -24
  93. data/lib/ruote/tree_dot.rb +4 -4
  94. data/lib/ruote/util/filter.rb +440 -0
  95. data/lib/ruote/util/hashdot.rb +4 -4
  96. data/lib/ruote/util/look.rb +2 -6
  97. data/lib/ruote/util/lookup.rb +9 -7
  98. data/lib/ruote/util/misc.rb +40 -8
  99. data/lib/ruote/util/ometa.rb +1 -1
  100. data/lib/ruote/util/serializer.rb +4 -4
  101. data/lib/ruote/util/subprocess.rb +29 -9
  102. data/lib/ruote/util/time.rb +4 -4
  103. data/lib/ruote/util/tree.rb +3 -3
  104. data/lib/ruote/version.rb +2 -2
  105. data/lib/ruote/worker.rb +55 -32
  106. data/lib/ruote/workitem.rb +64 -11
  107. data/ruote.gemspec +31 -302
  108. data/test/bm/launch_bench.rb +37 -0
  109. data/test/functional/base.rb +60 -18
  110. data/test/functional/concurrent_base.rb +2 -2
  111. data/test/functional/ct_0_concurrence.rb +1 -1
  112. data/test/functional/ct_1_iterator.rb +1 -1
  113. data/test/functional/ct_2_cancel.rb +1 -1
  114. data/test/functional/eft_0_process_definition.rb +2 -2
  115. data/test/functional/eft_10_cancel_process.rb +1 -1
  116. data/test/functional/eft_11_wait.rb +19 -11
  117. data/test/functional/eft_12_listen.rb +79 -13
  118. data/test/functional/eft_13_iterator.rb +13 -10
  119. data/test/functional/eft_14_cursor.rb +98 -9
  120. data/test/functional/eft_15_loop.rb +6 -4
  121. data/test/functional/eft_16_if.rb +12 -0
  122. data/test/functional/eft_18_concurrent_iterator.rb +31 -32
  123. data/test/functional/eft_19_reserve.rb +4 -4
  124. data/test/functional/eft_1_echo.rb +9 -0
  125. data/test/functional/eft_20_save.rb +4 -4
  126. data/test/functional/{eft_28_when.rb → eft_28_once.rb} +33 -7
  127. data/test/functional/eft_30_ref.rb +17 -2
  128. data/test/functional/eft_31_registerp.rb +130 -0
  129. data/test/functional/eft_32_lose.rb +93 -0
  130. data/test/functional/eft_33_let.rb +31 -0
  131. data/test/functional/eft_34_given.rb +123 -0
  132. data/test/functional/eft_35_filter.rb +269 -0
  133. data/test/functional/eft_3_participant.rb +4 -6
  134. data/test/functional/eft_4_set.rb +16 -2
  135. data/test/functional/eft_5_subprocess.rb +2 -4
  136. data/test/functional/eft_6_concurrence.rb +29 -29
  137. data/test/functional/eft_8_undo.rb +39 -3
  138. data/test/functional/eft_9_redo.rb +94 -2
  139. data/test/functional/ft_10_dollar.rb +81 -2
  140. data/test/functional/ft_11_recursion.rb +13 -17
  141. data/test/functional/ft_12_launchitem.rb +9 -5
  142. data/test/functional/ft_13_variables.rb +7 -9
  143. data/test/functional/ft_14_re_apply.rb +6 -9
  144. data/test/functional/ft_15_timeout.rb +18 -18
  145. data/test/functional/ft_16_participant_params.rb +1 -3
  146. data/test/functional/ft_17_conditional.rb +25 -2
  147. data/test/functional/ft_18_kill.rb +65 -12
  148. data/test/functional/ft_1_process_status.rb +147 -71
  149. data/test/functional/ft_20_storage_participant.rb +0 -1
  150. data/test/functional/ft_21_forget.rb +82 -1
  151. data/test/functional/{ft_24_block_participants.rb → ft_24_block_participant.rb} +42 -11
  152. data/test/functional/ft_25_receiver.rb +47 -17
  153. data/test/functional/{ft_26_participant_timeout.rb → ft_26_participant_rtimeout.rb} +56 -19
  154. data/test/functional/ft_29_part_template.rb +6 -5
  155. data/test/functional/ft_2_errors.rb +21 -37
  156. data/test/functional/ft_30_smtp_participant.rb +1 -1
  157. data/test/functional/ft_31_part_blocking.rb +8 -6
  158. data/test/functional/ft_34_cursor_rewind.rb +13 -10
  159. data/test/functional/ft_35_add_service.rb +1 -1
  160. data/test/functional/ft_36_storage_history.rb +24 -1
  161. data/test/functional/ft_37_default_history.rb +109 -0
  162. data/test/functional/ft_38_participant_more.rb +10 -10
  163. data/test/functional/ft_39_wait_for.rb +12 -9
  164. data/test/functional/ft_3_participant_registration.rb +111 -32
  165. data/test/functional/ft_40_wait_logger.rb +2 -1
  166. data/test/functional/ft_41_participants.rb +30 -4
  167. data/test/functional/ft_43_participant_on_reply.rb +6 -23
  168. data/test/functional/ft_45_participant_accept.rb +4 -4
  169. data/test/functional/ft_46_launch_single.rb +36 -2
  170. data/test/functional/ft_47_wfid_generator.rb +54 -0
  171. data/test/functional/ft_48_lose.rb +112 -0
  172. data/test/functional/ft_49_engine_on_error.rb +201 -0
  173. data/test/functional/ft_4_cancel.rb +66 -6
  174. data/test/functional/ft_50_engine_config.rb +22 -0
  175. data/test/functional/ft_51_misc.rb +67 -0
  176. data/test/functional/ft_52_case.rb +134 -0
  177. data/test/functional/ft_53_engine_on_terminate.rb +95 -0
  178. data/test/functional/ft_54_patterns.rb +104 -0
  179. data/test/functional/{ft_37_engine_participant.rb → ft_55_engine_participant.rb} +4 -5
  180. data/test/functional/ft_56_filter_attribute.rb +259 -0
  181. data/test/functional/ft_5_on_error.rb +77 -30
  182. data/test/functional/ft_6_on_cancel.rb +66 -11
  183. data/test/functional/ft_7_tags.rb +94 -5
  184. data/test/functional/ft_8_participant_consumption.rb +36 -5
  185. data/test/functional/ft_9_subprocesses.rb +10 -10
  186. data/test/functional/rt_1_listen.rb +3 -3
  187. data/test/functional/{rt_3_when.rb → rt_3_once.rb} +4 -4
  188. data/test/functional/storage_helper.rb +15 -13
  189. data/test/functional/test.rb +1 -3
  190. data/test/test_helper.rb +0 -8
  191. data/test/unit/storage.rb +154 -10
  192. data/test/unit/{ut_0_ruby_parser.rb → ut_0_ruby_reader.rb} +61 -11
  193. data/test/unit/ut_11_lookup.rb +7 -0
  194. data/test/unit/ut_13_serializer.rb +1 -1
  195. data/test/unit/ut_15_util.rb +23 -0
  196. data/test/unit/{ut_16_parser.rb → ut_16_reader.rb} +11 -13
  197. data/test/unit/ut_1_fei.rb +57 -10
  198. data/test/unit/ut_20_composite_storage.rb +25 -11
  199. data/test/unit/ut_21_participant_list.rb +47 -0
  200. data/test/unit/ut_22_filter.rb +903 -0
  201. data/test/unit/ut_3_wait_logger.rb +2 -6
  202. data/test/unit/ut_6_condition.rb +164 -17
  203. data/test/unit/ut_7_workitem.rb +28 -0
  204. data/test/unit/ut_8_tree_to_dot.rb +1 -1
  205. data/test/unit/{ut_9_xml_parser.rb → ut_9_xml_reader.rb} +5 -5
  206. metadata +108 -84
  207. data/.gitignore +0 -4
  208. data/examples/barley.rb +0 -391
  209. data/examples/flickr_report.rb +0 -107
  210. data/examples/pong.rb +0 -37
  211. data/examples/ruote_quickstart.rb +0 -43
  212. data/examples/web_first_page.rb +0 -68
  213. data/lib/ruote/part/hash_participant.rb +0 -91
  214. data/test/README.rdoc +0 -15
  215. data/test/functional/crunner.sh +0 -19
  216. data/test/pdef.xml +0 -7
  217. data/test/unit/ut_2_wfidgen.rb +0 -21
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2005-2010, John Mettraux, jmettraux@gmail.com
2
+ # Copyright (c) 2005-2011, John Mettraux, jmettraux@gmail.com
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy
5
5
  # of this software and associated documentation files (the "Software"), to deal
@@ -32,11 +32,23 @@ module Ruote
32
32
  # HashStorage. It will fill up your memory... Keeping history for a
33
33
  # transient ruote is a bit overkill (IMHO).
34
34
  #
35
+ # == using the StorageHistory
36
+ #
37
+ # engine.add_service(
38
+ # 'history', 'ruote/log/storage_history', 'Ruote::StorageHistory')
39
+ #
40
+ # # ...
41
+ #
42
+ # process_history = engine.history.by_wfid(wfid0)
43
+ #
44
+ # Note that, by default, the history is an in-memory history (and it is
45
+ # useless when there are multiple workers).
46
+ #
35
47
  class StorageHistory
36
48
 
37
49
  DATE_REGEX = /!(\d{4}-\d{2}-\d{2})!/
38
50
 
39
- def initialize (context, options={})
51
+ def initialize(context, options={})
40
52
 
41
53
  @context = context
42
54
  @options = options
@@ -50,7 +62,22 @@ module Ruote
50
62
  end
51
63
  end
52
64
 
53
- def by_process (wfid)
65
+ # Returns all the wfids for which there are history items (msgs) stored.
66
+ #
67
+ def wfids
68
+
69
+ wfids = @context.storage.ids('history').collect { |id|
70
+ id.split('!').last
71
+ }.uniq.sort
72
+
73
+ wfids.delete('no_wfid')
74
+
75
+ wfids
76
+ end
77
+
78
+ # Returns all the msgs for a given wfid (process instance id).
79
+ #
80
+ def by_process(wfid)
54
81
 
55
82
  @context.storage.get_many('history', wfid)
56
83
  end
@@ -73,7 +100,12 @@ module Ruote
73
100
  [ first, last ]
74
101
  end
75
102
 
76
- def by_date (date)
103
+ # Returns all the history events for a given day.
104
+ #
105
+ # Takes as argument whatever is a datetime when turned to a string and
106
+ # parsed.
107
+ #
108
+ def by_date(date)
77
109
 
78
110
  date = Time.parse(date.to_s).strftime('%Y-%m-%d')
79
111
 
@@ -97,7 +129,7 @@ module Ruote
97
129
  # This is the method called by the workqueue. Incoming engine events
98
130
  # are 'processed' here.
99
131
  #
100
- def notify (msg)
132
+ def notify(msg)
101
133
 
102
134
  msg = msg.dup
103
135
  # a shallow copy is sufficient
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2005-2010, John Mettraux, jmettraux@gmail.com
2
+ # Copyright (c) 2005-2011, John Mettraux, jmettraux@gmail.com
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy
5
5
  # of this software and associated documentation files (the "Software"), to deal
@@ -36,7 +36,7 @@ module Ruote
36
36
 
37
37
  attr_accessor :noisy
38
38
 
39
- def initialize (context)
39
+ def initialize(context)
40
40
 
41
41
  @context = context
42
42
 
@@ -61,7 +61,7 @@ module Ruote
61
61
  @noisy = false
62
62
  end
63
63
 
64
- def notify (msg)
64
+ def notify(msg)
65
65
 
66
66
  puts(pretty_print(msg)) if @noisy
67
67
 
@@ -84,7 +84,7 @@ module Ruote
84
84
  # while the first thread is waiting, the first thread's
85
85
  # interests are lost and the first thread will never wake up.
86
86
  #
87
- def wait_for (interests)
87
+ def wait_for(interests)
88
88
 
89
89
  @waiting << [ Thread.current, interests ]
90
90
 
@@ -104,12 +104,12 @@ module Ruote
104
104
  @seen.collect { |msg| pretty_print(msg) }.join("\n")
105
105
  end
106
106
 
107
- def color= (c)
107
+ def color=(c)
108
108
 
109
109
  @color = c
110
110
  end
111
111
 
112
- def self.pp (msg)
112
+ def self.pp(msg)
113
113
 
114
114
  @logger ||= TestLogger.new(nil)
115
115
  puts @logger.send(:pretty_print, msg)
@@ -126,7 +126,7 @@ module Ruote
126
126
  end
127
127
  end
128
128
 
129
- def check_msg (msg)
129
+ def check_msg(msg)
130
130
 
131
131
  wakeup = []
132
132
 
@@ -158,38 +158,40 @@ module Ruote
158
158
  # Returns true if all interests being waited for have been satisfied,
159
159
  # false otherwise.
160
160
  #
161
- def matches (interests, msg)
161
+ def matches(interests, msg)
162
162
 
163
163
  action = msg['action']
164
164
 
165
165
  interests.each do |interest|
166
166
 
167
- satisfied = if interest == :inactive
167
+ satisfied = case interest
168
168
 
169
- (FINAL_ACTIONS.include?(action) && @context.worker.inactive?)
169
+ when :inactive
170
170
 
171
- elsif interest == :empty
171
+ (FINAL_ACTIONS.include?(action) && @context.worker.inactive?)
172
172
 
173
- (action == 'terminated' && @context.storage.empty?('expressions'))
173
+ when :empty
174
174
 
175
- elsif interest.is_a?(Symbol) # participant
175
+ (action == 'terminated' && @context.storage.empty?('expressions'))
176
176
 
177
- (action == 'dispatch' && msg['participant_name'] == interest.to_s)
177
+ when Symbol
178
178
 
179
- elsif interest.is_a?(Fixnum)
179
+ (action == 'dispatch' && msg['participant_name'] == interest.to_s)
180
180
 
181
- interests.delete(interest)
181
+ when Fixnum
182
182
 
183
- if (interest > 1)
184
- interests << (interest - 1)
185
- false
186
- else
187
- true
188
- end
183
+ interests.delete(interest)
189
184
 
190
- else # wfid
185
+ if (interest > 1)
186
+ interests << (interest - 1)
187
+ false
188
+ else
189
+ true
190
+ end
191
191
 
192
- (FINAL_ACTIONS.include?(action) && msg['wfid'] == interest)
192
+ else # wfid
193
+
194
+ (FINAL_ACTIONS.include?(action) && msg['wfid'] == interest)
193
195
  end
194
196
 
195
197
  interests.delete(interest) if satisfied
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2005-2010, John Mettraux, jmettraux@gmail.com
2
+ # Copyright (c) 2005-2011, John Mettraux, jmettraux@gmail.com
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy
5
5
  # of this software and associated documentation files (the "Software"), to deal
@@ -30,11 +30,13 @@ module Ruote
30
30
  #
31
31
  # A helper logger for quickstart examples.
32
32
  #
33
+ # Keeps a maximum of 147 messages.
34
+ #
33
35
  class WaitLogger < TestLogger
34
36
 
35
37
  attr_accessor :noisy
36
38
 
37
- def initialize (context)
39
+ def initialize(context)
38
40
 
39
41
  @context = context
40
42
  @color = 33
@@ -48,7 +50,7 @@ module Ruote
48
50
  @waiting = []
49
51
  end
50
52
 
51
- def notify (msg)
53
+ def notify(msg)
52
54
 
53
55
  puts(pretty_print(msg)) if @noisy
54
56
 
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2005-2010, John Mettraux, jmettraux@gmail.com
2
+ # Copyright (c) 2005-2011, John Mettraux, jmettraux@gmail.com
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy
5
5
  # of this software and associated documentation files (the "Software"), to deal
@@ -67,35 +67,46 @@ module Ruote
67
67
  include LocalParticipant
68
68
 
69
69
  attr_accessor :context
70
- attr_accessor :do_not_thread
71
70
 
72
- def initialize (block, opts)
71
+ def initialize(opts)
73
72
 
74
73
  @opts = opts
75
- @block = block
76
- @do_not_thread = false
77
74
  end
78
75
 
79
- def consume (workitem)
76
+ def do_not_thread
80
77
 
81
- r = if @block.arity == 1
78
+ @opts['do_not_thread']
79
+ end
80
+
81
+ def consume(workitem)
82
+
83
+ block = @opts['block']
84
+
85
+ @context.treechecker.block_check(block)
86
+ # raises in case of 'security' violation
87
+
88
+ #block = eval(block, @context.send(:binding))
89
+ # doesn't work with ruby 1.9.2-p136
90
+ block = eval(block, @context.instance_eval { binding })
91
+ # works OK with ruby 1.8.7-249 and 1.9.2-p136
92
+
93
+ r = if block.arity == 1
82
94
 
83
- @block.call(workitem)
95
+ block.call(workitem)
84
96
  else
85
97
 
86
- @block.call(
98
+ block.call(
87
99
  workitem, Ruote::Exp::FlowExpression.fetch(@context, workitem.h.fei))
88
100
  end
89
101
 
90
102
  if r != nil && r != workitem
91
- #workitem.result = r
92
103
  workitem.result = (Rufus::Json.dup(r) rescue nil)
93
104
  end
94
105
 
95
106
  reply_to_engine(workitem)
96
107
  end
97
108
 
98
- def cancel (fei, flavour)
109
+ def cancel(fei, flavour)
99
110
 
100
111
  # do nothing
101
112
  end
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2005-2010, John Mettraux, jmettraux@gmail.com
2
+ # Copyright (c) 2005-2011, John Mettraux, jmettraux@gmail.com
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy
5
5
  # of this software and associated documentation files (the "Software"), to deal
@@ -105,7 +105,7 @@ module Ruote
105
105
 
106
106
  include LocalParticipant
107
107
 
108
- def initialize (opts)
108
+ def initialize(opts)
109
109
 
110
110
  if pa = opts['storage_path']
111
111
  require pa
@@ -118,7 +118,7 @@ module Ruote
118
118
  @storage = Ruote.constantize(kl).new(opts['storage_args'])
119
119
  end
120
120
 
121
- def consume (workitem)
121
+ def consume(workitem)
122
122
 
123
123
  wi = workitem.to_h
124
124
  fexp = Ruote::Exp::FlowExpression.fetch(@context, wi['fei'])
@@ -129,7 +129,6 @@ module Ruote
129
129
  @storage.put_msg(
130
130
  'launch',
131
131
  'wfid' => wi['fei']['wfid'],
132
- 'sub_wfid' => fexp.get_next_sub_wfid,
133
132
  'parent_id' => forget ? nil : wi['fei'],
134
133
  'tree' => determine_tree(fexp, params),
135
134
  'workitem' => wi,
@@ -142,7 +141,7 @@ module Ruote
142
141
  # is unpersisted immediately
143
142
  end
144
143
 
145
- def cancel (fei, flavour)
144
+ def cancel(fei, flavour)
146
145
 
147
146
  exps = @storage.get_many('expressions', /^0![^!]+!#{fei.wfid}$/)
148
147
 
@@ -158,7 +157,7 @@ module Ruote
158
157
  # participant expression will NOT reply to its parent
159
158
  end
160
159
 
161
- def reply (fei, workitem)
160
+ def reply(fei, workitem)
162
161
 
163
162
  @storage.put_msg(
164
163
  'reply',
@@ -168,7 +167,7 @@ module Ruote
168
167
 
169
168
  protected
170
169
 
171
- def determine_tree (fexp, params)
170
+ def determine_tree(fexp, params)
172
171
 
173
172
  pdef = params['def'] || params['pdef'] || params['tree']
174
173
 
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2005-2010, John Mettraux, jmettraux@gmail.com
2
+ # Copyright (c) 2005-2011, John Mettraux, jmettraux@gmail.com
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy
5
5
  # of this software and associated documentation files (the "Software"), to deal
@@ -51,7 +51,7 @@ module Ruote
51
51
  #
52
52
  # Without one of those options, the method is a "reject".
53
53
  #
54
- def re_dispatch (workitem, opts={})
54
+ def re_dispatch(workitem, opts={})
55
55
 
56
56
  msg = {
57
57
  'action' => 'dispatch',
@@ -82,11 +82,11 @@ module Ruote
82
82
  # class RetryParticipant
83
83
  # include Ruote::LocalParticipant
84
84
  #
85
- # def initialize (opts)
85
+ # def initialize(opts)
86
86
  # @opts = opts
87
87
  # end
88
88
  #
89
- # def consume (workitem)
89
+ # def consume(workitem)
90
90
  # begin
91
91
  # do_the_job
92
92
  # reply(workitem)
@@ -95,7 +95,7 @@ module Ruote
95
95
  # end
96
96
  # end
97
97
  #
98
- # def cancel (fei, flavour)
98
+ # def cancel(fei, flavour)
99
99
  # unschedule_re_dispatch(fei)
100
100
  # end
101
101
  # end
@@ -103,7 +103,7 @@ module Ruote
103
103
  # Note how unschedule_re_dispatch is used in the cancel method. Warning,
104
104
  # this example could loop forever...
105
105
  #
106
- def unschedule_re_dispatch (fei)
106
+ def unschedule_re_dispatch(fei)
107
107
 
108
108
  fexp = Ruote::Exp::FlowExpression.fetch(
109
109
  @context, Ruote::FlowExpressionId.extract_h(fei))
@@ -113,12 +113,6 @@ module Ruote
113
113
  end
114
114
  end
115
115
 
116
- # WARNING : this method is only for 'stateless' participants, ie
117
- # participants that are registered in the engine by passing their class
118
- # and a set of options, like in
119
- #
120
- # engine.register_participant 'alpha', MyParticipant, 'info' => 'none'
121
- #
122
116
  # This reject method replaces the workitem in the [internal] message queue
123
117
  # of the ruote engine (since it's a local participant, it has access to
124
118
  # the storage and it's thus easy).
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2005-2010, John Mettraux, jmettraux@gmail.com
2
+ # Copyright (c) 2005-2011, John Mettraux, jmettraux@gmail.com
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy
5
5
  # of this software and associated documentation files (the "Software"), to deal
@@ -38,7 +38,7 @@ module Ruote
38
38
 
39
39
  include LocalParticipant
40
40
 
41
- def initialize (opts=nil)
41
+ def initialize(opts=nil)
42
42
 
43
43
  @items = {}
44
44
  end
@@ -46,12 +46,12 @@ module Ruote
46
46
  #
47
47
  # No operation : simply replies immediately to the engine.
48
48
  #
49
- def consume (workitem)
49
+ def consume(workitem)
50
50
 
51
51
  reply_to_engine(workitem)
52
52
  end
53
53
 
54
- def cancel (fei, flavour)
54
+ def cancel(fei, flavour)
55
55
 
56
56
  # nothing to do
57
57
  end
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2005-2010, John Mettraux, jmettraux@gmail.com
2
+ # Copyright (c) 2005-2011, John Mettraux, jmettraux@gmail.com
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy
5
5
  # of this software and associated documentation files (the "Software"), to deal
@@ -37,17 +37,17 @@ module Ruote
37
37
 
38
38
  include LocalParticipant
39
39
 
40
- def initialize (opts=nil)
40
+ def initialize(opts=nil)
41
41
  end
42
42
 
43
43
  # Does nothing, discards the workitem it receives.
44
44
  #
45
- def consume (workitem)
45
+ def consume(workitem)
46
46
  end
47
47
 
48
48
  # Does nothing.
49
49
  #
50
- def cancel (fei, flavour)
50
+ def cancel(fei, flavour)
51
51
  end
52
52
  end
53
53
  end