ruote 2.3.0.1 → 2.3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.txt +23 -0
- data/CREDITS.txt +4 -0
- data/LICENSE.txt +1 -1
- data/lib/ruote.rb +2 -0
- data/lib/ruote/context.rb +2 -1
- data/lib/ruote/dashboard.rb +169 -13
- data/lib/ruote/dboard/mutation.rb +282 -0
- data/lib/ruote/dboard/process_error.rb +1 -1
- data/lib/ruote/dboard/process_status.rb +61 -48
- data/lib/ruote/engine.rb +1 -1
- data/lib/ruote/exp/command.rb +1 -1
- data/lib/ruote/exp/commanded.rb +1 -1
- data/lib/ruote/exp/condition.rb +2 -1
- data/lib/ruote/exp/fe_add_branches.rb +1 -1
- data/lib/ruote/exp/fe_apply.rb +1 -1
- data/lib/ruote/exp/fe_await.rb +97 -48
- data/lib/ruote/exp/fe_cancel_process.rb +1 -1
- data/lib/ruote/exp/fe_command.rb +2 -3
- data/lib/ruote/exp/fe_concurrence.rb +162 -66
- data/lib/ruote/exp/fe_concurrent_iterator.rb +25 -7
- data/lib/ruote/exp/fe_cron.rb +1 -1
- data/lib/ruote/exp/fe_cursor.rb +10 -11
- data/lib/ruote/exp/fe_define.rb +1 -1
- data/lib/ruote/exp/fe_echo.rb +1 -1
- data/lib/ruote/exp/fe_equals.rb +1 -1
- data/lib/ruote/exp/fe_error.rb +1 -1
- data/lib/ruote/exp/fe_filter.rb +1 -1
- data/lib/ruote/exp/fe_forget.rb +1 -1
- data/lib/ruote/exp/fe_given.rb +1 -1
- data/lib/ruote/exp/fe_if.rb +87 -7
- data/lib/ruote/exp/fe_inc.rb +1 -1
- data/lib/ruote/exp/fe_iterator.rb +1 -1
- data/lib/ruote/exp/fe_listen.rb +1 -1
- data/lib/ruote/exp/fe_lose.rb +1 -1
- data/lib/ruote/exp/fe_noop.rb +1 -1
- data/lib/ruote/exp/fe_on_error.rb +1 -1
- data/lib/ruote/exp/fe_once.rb +1 -1
- data/lib/ruote/exp/fe_participant.rb +49 -16
- data/lib/ruote/exp/fe_read.rb +1 -1
- data/lib/ruote/exp/fe_redo.rb +1 -1
- data/lib/ruote/exp/fe_ref.rb +1 -1
- data/lib/ruote/exp/fe_registerp.rb +1 -1
- data/lib/ruote/exp/fe_reserve.rb +1 -1
- data/lib/ruote/exp/fe_restore.rb +1 -7
- data/lib/ruote/exp/fe_save.rb +1 -1
- data/lib/ruote/exp/fe_sequence.rb +1 -1
- data/lib/ruote/exp/fe_set.rb +1 -1
- data/lib/ruote/exp/fe_stall.rb +1 -1
- data/lib/ruote/exp/fe_subprocess.rb +1 -1
- data/lib/ruote/exp/fe_that.rb +1 -1
- data/lib/ruote/exp/fe_undo.rb +1 -1
- data/lib/ruote/exp/fe_unregisterp.rb +1 -1
- data/lib/ruote/exp/fe_wait.rb +1 -1
- data/lib/ruote/exp/flow_expression.rb +117 -8
- data/lib/ruote/exp/iterator.rb +1 -1
- data/lib/ruote/exp/ro_attributes.rb +1 -1
- data/lib/ruote/exp/ro_filters.rb +1 -1
- data/lib/ruote/exp/ro_on_x.rb +4 -2
- data/lib/ruote/exp/ro_persist.rb +1 -1
- data/lib/ruote/exp/ro_timers.rb +1 -1
- data/lib/ruote/exp/ro_variables.rb +1 -1
- data/lib/ruote/extract.rb +125 -0
- data/lib/ruote/fei.rb +10 -73
- data/lib/ruote/id/mnemo_wfid_generator.rb +1 -1
- data/lib/ruote/id/wfid_generator.rb +1 -1
- data/lib/ruote/log/default_history.rb +17 -3
- data/lib/ruote/log/fancy_printing.rb +12 -32
- data/lib/ruote/log/storage_history.rb +1 -1
- data/lib/ruote/log/wait_logger.rb +15 -7
- data/lib/ruote/merge.rb +123 -0
- data/lib/ruote/observer.rb +1 -1
- data/lib/ruote/part/block_participant.rb +1 -1
- data/lib/ruote/part/code_participant.rb +1 -1
- data/lib/ruote/part/engine_participant.rb +1 -1
- data/lib/ruote/part/local_participant.rb +9 -1
- data/lib/ruote/part/no_op_participant.rb +1 -1
- data/lib/ruote/part/null_participant.rb +1 -1
- data/lib/ruote/part/participant.rb +1 -1
- data/lib/ruote/part/rev_participant.rb +1 -1
- data/lib/ruote/part/smtp_participant.rb +1 -1
- data/lib/ruote/part/storage_participant.rb +18 -1
- data/lib/ruote/part/template.rb +1 -1
- data/lib/ruote/reader.rb +1 -1
- data/lib/ruote/reader/json.rb +1 -1
- data/lib/ruote/reader/radial.rb +4 -4
- data/lib/ruote/reader/ruby_dsl.rb +1 -1
- data/lib/ruote/reader/xml.rb +1 -1
- data/lib/ruote/receiver/base.rb +13 -1
- data/lib/ruote/storage/base.rb +8 -14
- data/lib/ruote/storage/composite_storage.rb +1 -1
- data/lib/ruote/storage/fs_storage.rb +1 -1
- data/lib/ruote/storage/hash_storage.rb +2 -1
- data/lib/ruote/svc/dispatch_pool.rb +29 -18
- data/lib/ruote/svc/dollar_sub.rb +5 -8
- data/lib/ruote/svc/error_handler.rb +1 -1
- data/lib/ruote/svc/expression_map.rb +1 -1
- data/lib/ruote/svc/participant_list.rb +8 -5
- data/lib/ruote/svc/tracker.rb +154 -56
- data/lib/ruote/svc/treechecker.rb +1 -1
- data/lib/ruote/tree_dot.rb +1 -1
- data/lib/ruote/util/deep.rb +4 -2
- data/lib/ruote/util/filter.rb +1 -1
- data/lib/ruote/util/hashdot.rb +1 -1
- data/lib/ruote/util/look.rb +1 -1
- data/lib/ruote/util/lookup.rb +1 -1
- data/lib/ruote/util/misc.rb +51 -1
- data/lib/ruote/util/mpatch.rb +1 -1
- data/lib/ruote/util/ometa.rb +1 -1
- data/lib/ruote/util/subprocess.rb +1 -1
- data/lib/ruote/util/time.rb +3 -3
- data/lib/ruote/util/tree.rb +43 -4
- data/lib/ruote/version.rb +2 -2
- data/lib/ruote/worker.rb +30 -18
- data/lib/ruote/workitem.rb +1 -1
- data/ruote.gemspec +6 -2
- data/test/functional/base.rb +0 -1
- data/test/functional/concurrent_base.rb +1 -1
- data/test/functional/eft_14_cursor.rb +42 -52
- data/test/functional/eft_16_if.rb +24 -16
- data/test/functional/eft_18_concurrent_iterator.rb +31 -1
- data/test/functional/eft_6_concurrence.rb +149 -34
- data/test/functional/ft_10_dollar.rb +14 -30
- data/test/functional/ft_12_launchitem.rb +15 -0
- data/test/functional/ft_1_process_status.rb +62 -13
- data/test/functional/ft_20_storage_participant.rb +25 -0
- data/test/functional/ft_38_participant_more.rb +1 -1
- data/test/functional/ft_42_storage_copy.rb +1 -3
- data/test/functional/ft_43_participant_on_reply.rb +63 -5
- data/test/functional/ft_66_flank.rb +41 -0
- data/test/functional/ft_6_on_cancel.rb +9 -18
- data/test/functional/ft_71_retries.rb +25 -12
- data/test/functional/ft_79_attach.rb +138 -0
- data/test/functional/ft_7_tags.rb +27 -0
- data/test/functional/ft_80_pause_on_apply.rb +64 -0
- data/test/functional/ft_81_mutation.rb +417 -0
- data/test/functional/ft_82_await_attribute.rb +84 -0
- data/test/functional/ft_83_trackers.rb +79 -0
- data/test/functional/storage.rb +3 -4
- data/test/unit/ut_12_wait_logger.rb +41 -3
- data/test/unit/ut_15_util.rb +30 -0
- data/test/unit/ut_17_merge.rb +54 -53
- data/test/unit/ut_1_fei.rb +2 -2
- data/test/unit/ut_24_radial_reader.rb +7 -0
- data/test/unit/ut_26_deep.rb +14 -0
- data/test/unit/ut_5_tree.rb +38 -28
- metadata +206 -169
- data/couch_url.txt +0 -1
- data/lib/ruote/exp/merge.rb +0 -134
data/lib/ruote/exp/fe_cron.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2005-
|
2
|
+
# Copyright (c) 2005-2013, 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
|
data/lib/ruote/exp/fe_cursor.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2005-
|
2
|
+
# Copyright (c) 2005-2013, 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
|
@@ -304,17 +304,16 @@ module Ruote::Exp
|
|
304
304
|
|
305
305
|
tree_children.each_with_index do |c, i|
|
306
306
|
|
307
|
-
|
308
|
-
|
309
|
-
|
307
|
+
found = [
|
308
|
+
c[0], # exp_name
|
309
|
+
c[1]['ref'], # ref
|
310
|
+
c[1]['tag'], # tag
|
311
|
+
(c[1].find { |k, v| v.nil? } || []).first # participant 'xxx'
|
312
|
+
].find do |v|
|
313
|
+
v ? (dsub(v, workitem) == arg) : false
|
314
|
+
end
|
310
315
|
|
311
|
-
|
312
|
-
tag = dsub(tag, workitem) if tag
|
313
|
-
|
314
|
-
next if exp_name != arg && ref != arg && tag != arg
|
315
|
-
|
316
|
-
pos = i
|
317
|
-
break
|
316
|
+
if found then pos = i; break; end
|
318
317
|
end
|
319
318
|
|
320
319
|
pos ? pos : position
|
data/lib/ruote/exp/fe_define.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2005-
|
2
|
+
# Copyright (c) 2005-2013, 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
|
data/lib/ruote/exp/fe_echo.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2005-
|
2
|
+
# Copyright (c) 2005-2013, 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
|
data/lib/ruote/exp/fe_equals.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2005-
|
2
|
+
# Copyright (c) 2005-2013, 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
|
data/lib/ruote/exp/fe_error.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2005-
|
2
|
+
# Copyright (c) 2005-2013, 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
|
data/lib/ruote/exp/fe_filter.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2005-
|
2
|
+
# Copyright (c) 2005-2013, 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
|
data/lib/ruote/exp/fe_forget.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2005-
|
2
|
+
# Copyright (c) 2005-2013, 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
|
data/lib/ruote/exp/fe_given.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2005-
|
2
|
+
# Copyright (c) 2005-2013, 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
|
data/lib/ruote/exp/fe_if.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2005-
|
2
|
+
# Copyright (c) 2005-2013, 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
|
@@ -26,20 +26,100 @@
|
|
26
26
|
module Ruote::Exp
|
27
27
|
|
28
28
|
#
|
29
|
-
#
|
29
|
+
# The 'if' construct found in many programming languages.
|
30
|
+
#
|
31
|
+
# == _if ?
|
32
|
+
#
|
33
|
+
# Why the "_if" in all the examples below? Well, all the examples are using
|
34
|
+
# the Ruby DSL, using 'if' alone isn't possible, the Ruby parser would think
|
35
|
+
# it's the Ruby's own if...
|
36
|
+
#
|
37
|
+
# But process definitions written in Radial
|
38
|
+
# (see http://jmettraux.github.com/2012-09-03-ruote-2.3.0.html) don't have
|
39
|
+
# this restriction:
|
40
|
+
#
|
41
|
+
# if '${customer} == fred'
|
42
|
+
# salesman_henry # then clause
|
43
|
+
# salesman_josh # else clause
|
44
|
+
#
|
45
|
+
# == then / else clauses
|
46
|
+
#
|
47
|
+
# The 'if' expression accepts two or three children branches, in pseudo-code
|
48
|
+
# it looks like:
|
49
|
+
#
|
50
|
+
# _if do
|
51
|
+
# <condition>
|
52
|
+
# <then clause>
|
53
|
+
# end
|
54
|
+
#
|
55
|
+
# # or
|
56
|
+
#
|
57
|
+
# _if <condition> do
|
58
|
+
# <then clause>
|
59
|
+
# end
|
60
|
+
#
|
61
|
+
# # or
|
62
|
+
#
|
63
|
+
# _if do
|
64
|
+
# <condition>
|
65
|
+
# <then clause>
|
66
|
+
# <else clause>
|
67
|
+
# end
|
68
|
+
#
|
69
|
+
# # or
|
70
|
+
#
|
71
|
+
# _if <condition> do
|
72
|
+
# <then clause>
|
73
|
+
# <else clause>
|
74
|
+
# end
|
75
|
+
#
|
76
|
+
# This piece of process definition:
|
77
|
+
#
|
78
|
+
# _if '${customer} == fred' do
|
79
|
+
# salesman_henry
|
80
|
+
# salesman_josh
|
81
|
+
# end
|
82
|
+
#
|
83
|
+
# is thus interpreted as:
|
84
|
+
#
|
85
|
+
# _if '${customer} == fred' do
|
86
|
+
# salesman_henry # then clause
|
87
|
+
# salesman_josh # else clause
|
88
|
+
# end
|
89
|
+
#
|
90
|
+
# If the intent was to express a sequence henry - josh, it should be
|
91
|
+
# written as:
|
92
|
+
#
|
93
|
+
# _if '${customer} == fred' do
|
94
|
+
# sequence do # then clause
|
95
|
+
# salesman_henry
|
96
|
+
# salesman_josh
|
97
|
+
# end
|
98
|
+
# end
|
99
|
+
#
|
100
|
+
# Note this can be alternatively written as:
|
101
|
+
#
|
102
|
+
# sequence :if => '${customer} == fred' do
|
103
|
+
# salesman_henry
|
104
|
+
# salesman_josh
|
105
|
+
# end
|
106
|
+
#
|
107
|
+
# == examples
|
108
|
+
#
|
109
|
+
# Here are some examples:
|
30
110
|
#
|
31
111
|
# _if do
|
32
112
|
# equals :field_value => 'customer', :other_value => 'British Petroleum'
|
33
113
|
# participant :ref => 'Allister'
|
34
114
|
# end
|
35
115
|
#
|
36
|
-
# and
|
116
|
+
# and:
|
37
117
|
#
|
38
118
|
# _if :test => '${f:customer} == British Petroleum' do
|
39
119
|
# participant :ref => 'Allister'
|
40
120
|
# end
|
41
121
|
#
|
42
|
-
# An else clause is accepted
|
122
|
+
# An else clause is accepted:
|
43
123
|
#
|
44
124
|
# _if do
|
45
125
|
# equals :field_value => 'customer', :other_value => 'British Petroleum'
|
@@ -47,14 +127,14 @@ module Ruote::Exp
|
|
47
127
|
# participant :ref => 'Bernardo'
|
48
128
|
# end
|
49
129
|
#
|
50
|
-
# or
|
130
|
+
# or:
|
51
131
|
#
|
52
132
|
# _if :test => '${f:customer} == British Petroleum' do
|
53
133
|
# participant :ref => 'Allister'
|
54
134
|
# participant :ref => 'Bernardo'
|
55
135
|
# end
|
56
136
|
#
|
57
|
-
# Note that any expression accepts an :if attribute
|
137
|
+
# Note that any expression accepts an :if attribute:
|
58
138
|
#
|
59
139
|
# participant :ref => 'Al', :if => '${f:customer} == British Petroleum'
|
60
140
|
#
|
@@ -68,7 +148,7 @@ module Ruote::Exp
|
|
68
148
|
# subprocess 'regular_course'
|
69
149
|
# end
|
70
150
|
#
|
71
|
-
# When using Ruby to generate the process definition tree, you can simply do
|
151
|
+
# When using Ruby to generate the process definition tree, you can simply do:
|
72
152
|
#
|
73
153
|
# _if '${f:customer.name} == Fred' do
|
74
154
|
# subprocess 'premium_course'
|
data/lib/ruote/exp/fe_inc.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2005-
|
2
|
+
# Copyright (c) 2005-2013, 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
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2005-
|
2
|
+
# Copyright (c) 2005-2013, 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
|
data/lib/ruote/exp/fe_listen.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2005-
|
2
|
+
# Copyright (c) 2005-2013, 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
|
data/lib/ruote/exp/fe_lose.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2005-
|
2
|
+
# Copyright (c) 2005-2013, 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
|
data/lib/ruote/exp/fe_noop.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2005-
|
2
|
+
# Copyright (c) 2005-2013, 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
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2005-
|
2
|
+
# Copyright (c) 2005-2013, 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
|
data/lib/ruote/exp/fe_once.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2005-
|
2
|
+
# Copyright (c) 2005-2013, 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
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2005-
|
2
|
+
# Copyright (c) 2005-2013, 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
|
@@ -144,12 +144,7 @@ module Ruote::Exp
|
|
144
144
|
#
|
145
145
|
# trigger on_apply if the participant sports it
|
146
146
|
|
147
|
-
|
148
|
-
h.participant, :if_respond_to? => :on_apply)
|
149
|
-
|
150
|
-
Ruote.participant_send(
|
151
|
-
pa, :on_apply, 'workitem' => Ruote::Workitem.new(h.applied_workitem)
|
152
|
-
) if pa
|
147
|
+
trigger_callback(:on_apply, h.applied_workitem)
|
153
148
|
|
154
149
|
#
|
155
150
|
# dispatch to participant
|
@@ -202,15 +197,7 @@ module Ruote::Exp
|
|
202
197
|
|
203
198
|
def reply(workitem)
|
204
199
|
|
205
|
-
|
206
|
-
h.participant ||
|
207
|
-
@context.plist.lookup_info(h.participant_name, workitem)
|
208
|
-
|
209
|
-
pa = @context.plist.instantiate(pinfo, :if_respond_to? => :on_reply)
|
210
|
-
|
211
|
-
Ruote.participant_send(
|
212
|
-
pa, :on_reply, 'workitem' => Ruote::Workitem.new(workitem)
|
213
|
-
) if pa
|
200
|
+
trigger_callback(:on_reply, workitem)
|
214
201
|
|
215
202
|
super(workitem)
|
216
203
|
end
|
@@ -222,8 +209,54 @@ module Ruote::Exp
|
|
222
209
|
super(workitem)
|
223
210
|
end
|
224
211
|
|
212
|
+
# Overrides FlowExpression#handle_on_error. Attempts to call a
|
213
|
+
# potential #on_error method in the participant implementation.
|
214
|
+
#
|
215
|
+
# If that method exists and returns something true-ish, will not call
|
216
|
+
# the super #handle_on_error, it will directly reply to the parent.
|
217
|
+
#
|
218
|
+
def handle_on_error(msg, err)
|
219
|
+
|
220
|
+
r = trigger_callback(:on_error, msg, err)
|
221
|
+
|
222
|
+
if r
|
223
|
+
reply_to_parent(msg['workitem'])
|
224
|
+
true # yes, we've dealt with the error.
|
225
|
+
else
|
226
|
+
super(msg, err)
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
225
230
|
protected
|
226
231
|
|
232
|
+
# Used to trigger #on_apply, #on_reply, #on_cancel and #on_error in
|
233
|
+
# the participant implementation.
|
234
|
+
#
|
235
|
+
def trigger_callback(meth, wi_or_msg, err=nil)
|
236
|
+
|
237
|
+
wi, msg, err = if err
|
238
|
+
[ wi_or_msg['workitem'], wi_or_msg, err ]
|
239
|
+
elsif wi_or_msg['workitem']
|
240
|
+
[ wi_or_msg['workitem'], wi_or_msg, nil ]
|
241
|
+
else
|
242
|
+
[ wi_or_msg, nil, nil ]
|
243
|
+
end
|
244
|
+
|
245
|
+
pinfo =
|
246
|
+
h.participant ||
|
247
|
+
@context.plist.lookup_info(h.participant_name, wi)
|
248
|
+
|
249
|
+
pa = @context.plist.instantiate(pinfo, :if_respond_to? => meth)
|
250
|
+
|
251
|
+
return nil unless pa
|
252
|
+
|
253
|
+
args = { 'workitem' => Ruote::Workitem.new(wi) }
|
254
|
+
args['error'] = err if err
|
255
|
+
args['msg'] = msg if msg
|
256
|
+
|
257
|
+
Ruote.participant_send(pa, meth, args)
|
258
|
+
end
|
259
|
+
|
227
260
|
# Once the dispatching work (done by the dispatch pool) is done, a
|
228
261
|
# 'dispatched' msg is sent, we have to flag the participant expression
|
229
262
|
# as 'dispatched' => true
|
data/lib/ruote/exp/fe_read.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2005-
|
2
|
+
# Copyright (c) 2005-2013, 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
|
data/lib/ruote/exp/fe_redo.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2005-
|
2
|
+
# Copyright (c) 2005-2013, 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
|
data/lib/ruote/exp/fe_ref.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2005-
|
2
|
+
# Copyright (c) 2005-2013, 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
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2005-
|
2
|
+
# Copyright (c) 2005-2013, 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
|
data/lib/ruote/exp/fe_reserve.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2005-
|
2
|
+
# Copyright (c) 2005-2013, 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
|
data/lib/ruote/exp/fe_restore.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2005-
|
2
|
+
# Copyright (c) 2005-2013, 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
|
@@ -23,9 +23,6 @@
|
|
23
23
|
#++
|
24
24
|
|
25
25
|
|
26
|
-
require 'ruote/exp/merge'
|
27
|
-
|
28
|
-
|
29
26
|
module Ruote::Exp
|
30
27
|
|
31
28
|
#
|
@@ -55,9 +52,6 @@ module Ruote::Exp
|
|
55
52
|
#
|
56
53
|
class RestoreExpression < FlowExpression
|
57
54
|
|
58
|
-
include MergeMixin
|
59
|
-
# still have to implement something about merge...
|
60
|
-
|
61
55
|
names :restore, :set_fields
|
62
56
|
|
63
57
|
def apply
|