openwferu 0.9.16 → 0.9.17
Sign up to get free protection for your applications and to get access to all the features.
- data/examples/about_state.rb +81 -0
- data/examples/engine_template.rb +7 -0
- data/lib/openwfe/contextual.rb +2 -2
- data/lib/openwfe/def.rb +2 -3
- data/lib/openwfe/{util/schedulers.rb → engine.rb} +3 -39
- data/lib/openwfe/engine/engine.rb +202 -251
- data/lib/openwfe/engine/process_status.rb +359 -0
- data/lib/openwfe/expool/errorjournal.rb +6 -6
- data/lib/openwfe/expool/expressionpool.rb +161 -239
- data/lib/openwfe/expool/expstorage.rb +185 -55
- data/lib/openwfe/expool/journal.rb +1 -2
- data/lib/openwfe/expool/parser.rb +233 -0
- data/lib/openwfe/expool/threadedexpstorage.rb +6 -18
- data/lib/openwfe/expool/wfidgen.rb +25 -7
- data/lib/openwfe/expool/yamlexpstorage.rb +60 -37
- data/lib/openwfe/expressions/condition.rb +49 -12
- data/lib/openwfe/expressions/environment.rb +45 -15
- data/lib/openwfe/expressions/expressionmap.rb +39 -19
- data/lib/openwfe/expressions/fe_concurrence.rb +24 -13
- data/lib/openwfe/expressions/fe_cron.rb +19 -18
- data/lib/openwfe/expressions/fe_cursor.rb +69 -28
- data/lib/openwfe/expressions/fe_define.rb +4 -1
- data/lib/openwfe/expressions/fe_do.rb +1 -3
- data/lib/openwfe/expressions/fe_equals.rb +131 -20
- data/lib/openwfe/expressions/fe_fqv.rb +27 -3
- data/lib/openwfe/expressions/fe_iterator.rb +14 -7
- data/lib/openwfe/expressions/fe_listen.rb +7 -2
- data/lib/openwfe/expressions/fe_misc.rb +187 -20
- data/lib/openwfe/expressions/fe_participant.rb +8 -7
- data/lib/openwfe/expressions/fe_reserve.rb +105 -33
- data/lib/openwfe/expressions/fe_save.rb +55 -5
- data/lib/openwfe/expressions/{fe_value.rb → fe_set.rb} +6 -82
- data/lib/openwfe/expressions/fe_sleep.rb +25 -15
- data/lib/openwfe/expressions/fe_subprocess.rb +2 -2
- data/lib/openwfe/expressions/fe_wait.rb +3 -2
- data/lib/openwfe/expressions/fe_when.rb +7 -15
- data/lib/openwfe/expressions/flowexpression.rb +90 -49
- data/lib/openwfe/expressions/merge.rb +7 -1
- data/lib/openwfe/expressions/raw.rb +261 -63
- data/lib/openwfe/expressions/{raw_prog.rb → rprocdef.rb} +94 -179
- data/lib/openwfe/expressions/time.rb +36 -12
- data/lib/openwfe/expressions/timeout.rb +9 -7
- data/lib/openwfe/expressions/value.rb +126 -0
- data/lib/openwfe/flowexpressionid.rb +52 -22
- data/lib/openwfe/listeners/listeners.rb +3 -3
- data/lib/openwfe/listeners/socketlisteners.rb +8 -5
- data/lib/openwfe/logging.rb +6 -3
- data/lib/openwfe/omixins.rb +8 -6
- data/lib/openwfe/orest/xmlcodec.rb +16 -12
- data/lib/openwfe/participants.rb +38 -0
- data/lib/openwfe/participants/participant.rb +1 -1
- data/lib/openwfe/participants/participantmap.rb +24 -10
- data/lib/openwfe/participants/participants.rb +4 -3
- data/lib/openwfe/participants/soapparticipants.rb +1 -1
- data/lib/openwfe/participants/socketparticipants.rb +1 -1
- data/lib/openwfe/rudefinitions.rb +7 -5
- data/lib/openwfe/storage/yamlcustom.rb +10 -10
- data/lib/openwfe/storage/yamlfilestorage.rb +12 -12
- data/lib/openwfe/tools/flowtracer.rb +6 -5
- data/lib/openwfe/util/dollar.rb +42 -85
- data/lib/openwfe/util/ometa.rb +1 -3
- data/lib/openwfe/util/workqueue.rb +1 -1
- data/lib/openwfe/utils.rb +33 -11
- data/lib/openwfe/version.rb +2 -2
- data/lib/openwfe/workitem.rb +76 -14
- data/lib/openwfe/worklist/storelocks.rb +9 -4
- data/lib/openwfe/worklist/storeparticipant.rb +1 -1
- data/test/back_0916_test.rb +101 -0
- data/test/bm/ft_26_load.rb +1 -1
- data/test/bm/ft_26b_load.rb +1 -1
- data/test/bm/ft_26c_load.rb +3 -2
- data/test/bm/ft_26d_load.rb +97 -0
- data/test/bm/ft_recu.rb +71 -0
- data/test/concurrence_test.rb +1 -1
- data/test/condition_test.rb +152 -0
- data/test/description_test.rb +12 -7
- data/test/eno_test.rb +1 -1
- data/test/expool_20031219_0916.tgz +0 -0
- data/test/fe_lookup_att_test.rb +1 -1
- data/test/fei_test.rb +16 -0
- data/test/file_persistence_test.rb +8 -12
- data/test/filep_cancel_test.rb +116 -0
- data/test/flowtestbase.rb +47 -25
- data/test/ft_0.rb +1 -1
- data/test/ft_10_loop.rb +29 -14
- data/test/{ft_10b_loop2.rb → ft_10b_loop.rb} +2 -11
- data/test/ft_11_ppd.rb +6 -17
- data/test/ft_11b_ppd.rb +1 -4
- data/test/ft_12_blockparticipant.rb +1 -1
- data/test/ft_13_eno.rb +1 -1
- data/test/ft_15_iterator.rb +1 -1
- data/test/ft_15b_iterator.rb +1 -1
- data/test/ft_17_condition.rb +6 -6
- data/test/ft_18_pname.rb +1 -1
- data/test/ft_20_cron.rb +1 -1
- data/test/ft_21_cron.rb +6 -4
- data/test/ft_22_history.rb +1 -1
- data/test/ft_23_when.rb +1 -1
- data/test/ft_23b_when.rb +18 -6
- data/test/ft_23c_wait.rb +8 -6
- data/test/ft_25_cancel.rb +7 -5
- data/test/ft_27_getflowpos.rb +22 -17
- data/test/ft_28_fileparticipant.rb +1 -2
- data/test/ft_2_concurrence.rb +1 -1
- data/test/ft_2b_concurrence.rb +25 -20
- data/test/ft_30_socketlistener.rb +0 -3
- data/test/ft_34_cancelwfid.rb +9 -9
- data/test/ft_35_localdefs.rb +0 -1
- data/test/ft_36_subprocids.rb +6 -6
- data/test/ft_38_tag.rb +3 -2
- data/test/ft_38b_tag.rb +229 -0
- data/test/ft_39_reserve.rb +3 -18
- data/test/ft_39b_reserve.rb +34 -5
- data/test/ft_3b_lookup_vf.rb +83 -0
- data/test/ft_40_defined.rb +2 -11
- data/test/ft_42_environments.rb +4 -6
- data/test/ft_44b_restore.rb +88 -22
- data/test/ft_45_citerator.rb +57 -11
- data/test/ft_49_condition.rb +4 -2
- data/test/ft_4_misc.rb +24 -3
- data/test/ft_50_xml_attribute.rb +17 -20
- data/test/ft_54_listen.rb +1 -1
- data/test/ft_54b_listen.rb +2 -2
- data/test/ft_56_timeout.rb +8 -1
- data/test/ft_57_a.rb +10 -10
- data/test/ft_59_ps.rb +49 -16
- data/test/ft_60_ecancel.rb +52 -10
- data/test/ft_63_pause.rb +8 -8
- data/test/ft_65_stringlaunch.rb +4 -6
- data/test/ft_67_schedlaunch.rb +4 -4
- data/test/ft_69_cancelmissing.rb +4 -2
- data/test/ft_70_lookupvar.rb +2 -2
- data/test/ft_72_lookup_processes.rb +2 -2
- data/test/ft_73_cancel_sub.rb +8 -8
- data/test/ft_77_segments.rb +38 -0
- data/test/ft_78_eval.rb +154 -0
- data/test/ft_79_tticket.rb +185 -0
- data/test/ft_80_spname.rb +95 -0
- data/test/ft_81_exp.rb +64 -0
- data/test/ft_82_trecu.rb +48 -0
- data/test/ft_83_badpause.rb +62 -0
- data/test/ft_84_updateexp.rb +125 -0
- data/test/ft_9b_cursor.rb +105 -0
- data/test/ft_tests.rb +14 -1
- data/test/hash_test.rb +7 -7
- data/test/hparticipant_test.rb +4 -4
- data/test/lookup_vf_test.rb +94 -0
- data/test/misc_test.rb +5 -3
- data/test/orest_test.rb +4 -3
- data/test/param_test.rb +12 -16
- data/test/participant_test.rb +36 -0
- data/test/pending.rb +10 -10
- data/test/rake_ltest.rb +1 -10
- data/test/rake_qtest.rb +7 -6
- data/test/raw_prog_test.rb +89 -121
- data/test/restart_cron_test.rb +84 -36
- data/test/restart_paused_test.rb +100 -0
- data/test/restart_sleep_test.rb +1 -1
- data/test/restart_tests.rb +1 -0
- data/test/restart_when_test.rb +33 -22
- data/test/ruby_procdef_test.rb +19 -18
- data/test/sec_test.rb +74 -35
- data/test/storage_test.rb +44 -0
- data/test/test.rb +3 -0
- data/test/timeout_test.rb +7 -18
- data/test/wfid_test.rb +2 -1
- data/test/wi_test.rb +29 -18
- metadata +121 -57
- data/lib/openwfe/expressions/raw_xml.rb +0 -176
- data/lib/openwfe/expressions/simplerep.rb +0 -266
- data/lib/openwfe/util/kotoba.rb +0 -236
- data/lib/openwfe/util/lru.rb +0 -171
- data/lib/openwfe/util/otime.rb +0 -246
- data/lib/openwfe/util/safe.rb +0 -160
- data/lib/openwfe/util/scheduler.rb +0 -1158
- data/test/cron_test.rb +0 -113
- data/test/cronline_test.rb +0 -60
- data/test/dollar_test.rb +0 -90
- data/test/kotoba_test.rb +0 -72
- data/test/lru_test.rb +0 -79
- data/test/safely_test.rb +0 -84
- data/test/scheduler_1_test.rb +0 -88
- data/test/scheduler_test.rb +0 -363
- data/test/time_test.rb +0 -84
@@ -61,30 +61,18 @@ module OpenWFE
|
|
61
61
|
|
62
62
|
get_scheduler.unschedule(@thread_id) if @thread_id
|
63
63
|
|
64
|
-
process_queue
|
64
|
+
process_queue
|
65
65
|
#
|
66
66
|
# flush every remaining events (especially the :delete ones)
|
67
67
|
end
|
68
68
|
|
69
|
-
#
|
70
|
-
# calls process_queue() before the call the super class each_of_kind()
|
71
|
-
# method
|
72
|
-
#
|
73
|
-
def each_of_kind (kind, &block)
|
74
|
-
|
75
|
-
#ldebug { "each_of_kind()" }
|
76
|
-
|
77
|
-
process_queue()
|
78
|
-
super
|
79
|
-
end
|
80
|
-
|
81
69
|
#
|
82
70
|
# calls process_queue() before the call the super class each()
|
83
|
-
# method
|
71
|
+
# method.
|
84
72
|
#
|
85
|
-
def
|
73
|
+
def find_expressions (options)
|
86
74
|
|
87
|
-
process_queue
|
75
|
+
process_queue
|
88
76
|
super
|
89
77
|
end
|
90
78
|
|
@@ -179,11 +167,11 @@ module OpenWFE
|
|
179
167
|
|
180
168
|
get_expression_pool.add_observer(:update) do |event, fei, fe|
|
181
169
|
ldebug { ":update for #{fei.to_debug_s}" }
|
182
|
-
queue
|
170
|
+
queue event, fei, fe
|
183
171
|
end
|
184
172
|
get_expression_pool.add_observer(:remove) do |event, fei|
|
185
173
|
ldebug { ":remove for #{fei.to_debug_s}" }
|
186
|
-
queue
|
174
|
+
queue event, fei
|
187
175
|
end
|
188
176
|
end
|
189
177
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
#--
|
3
|
-
# Copyright (c) 2007, John Mettraux, OpenWFE.org
|
3
|
+
# Copyright (c) 2007-2008, John Mettraux, OpenWFE.org
|
4
4
|
# All rights reserved.
|
5
5
|
#
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
@@ -39,9 +39,10 @@
|
|
39
39
|
|
40
40
|
require 'thread'
|
41
41
|
|
42
|
+
require 'rufus/mnemo'
|
43
|
+
|
42
44
|
require 'openwfe/service'
|
43
45
|
require 'openwfe/rudefinitions'
|
44
|
-
require 'openwfe/util/kotoba'
|
45
46
|
|
46
47
|
|
47
48
|
module OpenWFE
|
@@ -54,6 +55,7 @@ module OpenWFE
|
|
54
55
|
class DefaultWfidGenerator < Service
|
55
56
|
|
56
57
|
def initialize (service_name, application_context)
|
58
|
+
|
57
59
|
super
|
58
60
|
|
59
61
|
@last = -1
|
@@ -72,13 +74,16 @@ module OpenWFE
|
|
72
74
|
# The launchitem parameter is not used by this generator.
|
73
75
|
#
|
74
76
|
def generate (launchitem=nil)
|
77
|
+
|
75
78
|
wfid = nil
|
79
|
+
|
76
80
|
@mutex.synchronize do
|
77
81
|
wfid = now
|
78
82
|
wfid = @last + 1 if wfid <= @last
|
79
83
|
@last = wfid
|
80
84
|
save_last
|
81
85
|
end
|
86
|
+
|
82
87
|
to_string(wfid)
|
83
88
|
end
|
84
89
|
|
@@ -87,6 +92,7 @@ module OpenWFE
|
|
87
92
|
# This method is overriden in extension of this class.
|
88
93
|
#
|
89
94
|
def to_string (numeric_id)
|
95
|
+
|
90
96
|
numeric_id.to_s
|
91
97
|
end
|
92
98
|
|
@@ -94,6 +100,7 @@ module OpenWFE
|
|
94
100
|
# Is a simple call to OpenWFE::split_wfid()
|
95
101
|
#
|
96
102
|
def split_wfid (wfid)
|
103
|
+
|
97
104
|
OpenWFE.split_wfid(wfid)
|
98
105
|
end
|
99
106
|
|
@@ -102,10 +109,12 @@ module OpenWFE
|
|
102
109
|
# a wfid following this 'defaut' scheme.
|
103
110
|
#
|
104
111
|
def self.split_wfid (wfid)
|
112
|
+
|
105
113
|
r = []
|
106
114
|
0.upto(wfid.length-1) do |i|
|
107
115
|
r << wfid[i, 1]
|
108
116
|
end
|
117
|
+
|
109
118
|
r
|
110
119
|
end
|
111
120
|
|
@@ -115,6 +124,7 @@ module OpenWFE
|
|
115
124
|
# file is closed.
|
116
125
|
#
|
117
126
|
def stop
|
127
|
+
|
118
128
|
#linfo { "stop() stopping '#{@service_name}'" }
|
119
129
|
@last_f.close if @last_f
|
120
130
|
end
|
@@ -175,6 +185,8 @@ module OpenWFE
|
|
175
185
|
# "20070318-jonowoguya" or "20071224-jesoshimoha" that are a bit
|
176
186
|
# easier to grasp than full integer wfids.
|
177
187
|
#
|
188
|
+
# Now relying on the 'rufus-mnemo' gem.
|
189
|
+
#
|
178
190
|
class KotobaWfidGenerator < DefaultWfidGenerator
|
179
191
|
|
180
192
|
#
|
@@ -196,7 +208,7 @@ module OpenWFE
|
|
196
208
|
|
197
209
|
s = sprintf "%4d%02d%02d", t.year, t.month, t.day
|
198
210
|
s << "-"
|
199
|
-
s <<
|
211
|
+
s << Rufus::Mnemo::from_integer(i)
|
200
212
|
s
|
201
213
|
end
|
202
214
|
|
@@ -206,7 +218,8 @@ module OpenWFE
|
|
206
218
|
# Returns the 'kotoba' wfid split into its syllables
|
207
219
|
#
|
208
220
|
def self.split_wfid (wfid)
|
209
|
-
|
221
|
+
|
222
|
+
Rufus::Mnemo::split(wfid[9..-1])
|
210
223
|
end
|
211
224
|
|
212
225
|
#
|
@@ -220,7 +233,7 @@ module OpenWFE
|
|
220
233
|
|
221
234
|
s = wfid[9..-1]
|
222
235
|
|
223
|
-
i =
|
236
|
+
i = Rufus::Mnemo::to_integer(s)
|
224
237
|
|
225
238
|
hour = (i / (10000 * 60 * 60)) % 24
|
226
239
|
min = (i / (10000 * 60)) % 60
|
@@ -233,6 +246,7 @@ module OpenWFE
|
|
233
246
|
end
|
234
247
|
|
235
248
|
def self.from_time (t)
|
249
|
+
|
236
250
|
to_string(t.to_f * 10 * 1000).to_i
|
237
251
|
end
|
238
252
|
end
|
@@ -250,7 +264,7 @@ module OpenWFE
|
|
250
264
|
|
251
265
|
def initialize (service_name, application_context, field_name)
|
252
266
|
|
253
|
-
super
|
267
|
+
super service_name, application_context
|
254
268
|
|
255
269
|
@field_name = field_name
|
256
270
|
end
|
@@ -316,13 +330,15 @@ module OpenWFE
|
|
316
330
|
# The launchitem parameter is not used by this generator.
|
317
331
|
#
|
318
332
|
def generate (launchitem=nil)
|
319
|
-
|
333
|
+
|
334
|
+
`#{@command}`.chomp
|
320
335
|
end
|
321
336
|
|
322
337
|
#
|
323
338
|
# Is a simple call to OpenWFE::split_wfid()
|
324
339
|
#
|
325
340
|
def split_wfid (wfid)
|
341
|
+
|
326
342
|
OpenWFE.split_wfid(wfid)
|
327
343
|
end
|
328
344
|
|
@@ -334,6 +350,7 @@ module OpenWFE
|
|
334
350
|
# expression storage directory structure).
|
335
351
|
#
|
336
352
|
def self.split_wfid (wfid)
|
353
|
+
|
337
354
|
s = wfid[0, 8]
|
338
355
|
a = []
|
339
356
|
4.times do |i|
|
@@ -357,6 +374,7 @@ module OpenWFE
|
|
357
374
|
# here.
|
358
375
|
#
|
359
376
|
def OpenWFE.split_wfid (wfid)
|
377
|
+
|
360
378
|
SPLIT_MAP.each do |regex, clazz|
|
361
379
|
return clazz.split_wfid(wfid) if wfid.match(regex)
|
362
380
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
#--
|
3
|
-
# Copyright (c) 2006-
|
3
|
+
# Copyright (c) 2006-2008, Nicolas Modryzk and John Mettraux, OpenWFE.org
|
4
4
|
# All rights reserved.
|
5
5
|
#
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
@@ -44,12 +44,13 @@ require 'openwfe/storage/yamlfilestorage'
|
|
44
44
|
require 'openwfe/expool/threadedexpstorage'
|
45
45
|
|
46
46
|
require 'openwfe/expressions/flowexpression'
|
47
|
-
require 'openwfe/expressions/raw_xml'
|
48
|
-
|
47
|
+
#require 'openwfe/expressions/raw_xml'
|
48
|
+
#--
|
49
49
|
# making sure classes in those files are loaded
|
50
50
|
# before their yaml persistence is tuned
|
51
51
|
# (else the reopening of the class is interpreted as
|
52
52
|
# a definition of the class...)
|
53
|
+
#++
|
53
54
|
|
54
55
|
|
55
56
|
module OpenWFE
|
@@ -64,58 +65,75 @@ module OpenWFE
|
|
64
65
|
|
65
66
|
def initialize (service_name, application_context)
|
66
67
|
|
67
|
-
super
|
68
|
+
super service_name, application_context, '/expool'
|
68
69
|
|
69
70
|
observe_expool
|
70
71
|
end
|
71
72
|
|
72
73
|
#
|
73
|
-
#
|
74
|
-
#
|
74
|
+
# Find expressions matching various criteria.
|
75
|
+
# (See Engine#list_process_status for an explanation)
|
75
76
|
#
|
76
|
-
def
|
77
|
+
def find_expressions (options)
|
77
78
|
|
78
|
-
|
79
|
+
wfid_prefix = options[:wfid_prefix]
|
80
|
+
wfid_regex = nil
|
81
|
+
wfid_regex = Regexp.new("^"+wfid_prefix) if wfid_prefix
|
82
|
+
|
83
|
+
options.delete :wfid_prefix
|
84
|
+
# no need to check this in further does_match? calls
|
79
85
|
|
80
|
-
|
86
|
+
result = []
|
81
87
|
|
82
|
-
|
83
|
-
|
88
|
+
each_object_path do |path|
|
89
|
+
|
90
|
+
unless path.match /\/engine_environment.yaml$/
|
91
|
+
a = self.class.split_file_path path
|
92
|
+
next unless a
|
93
|
+
# not an expression file
|
84
94
|
|
85
|
-
|
95
|
+
wfid = a[0]
|
96
|
+
next if wfid_regex and (not wfid_regex.match(wfid))
|
97
|
+
end
|
86
98
|
|
87
|
-
|
99
|
+
fexp = load_object path
|
88
100
|
|
89
|
-
|
101
|
+
next unless does_match?(options, fexp)
|
90
102
|
|
91
|
-
|
103
|
+
result << fexp
|
92
104
|
end
|
105
|
+
|
106
|
+
result
|
93
107
|
end
|
94
108
|
|
95
|
-
|
96
|
-
# "each flow expression" : this method awaits a block then, for
|
97
|
-
# each flow_expression in this storage, calls that block.
|
98
|
-
#
|
99
|
-
# If wfid_prefix is set, only expressions whose wfid (workflow instance
|
100
|
-
# id (process instance id)) will be taken into account.
|
101
|
-
#
|
102
|
-
def each (wfid_prefix=nil, &block)
|
109
|
+
def fetch_root (wfid)
|
103
110
|
|
104
|
-
|
111
|
+
fei = FlowExpressionId.new
|
112
|
+
fei.wfid = wfid
|
113
|
+
fei.expid = "0"
|
114
|
+
fei.expression_name = "process-definition"
|
115
|
+
|
116
|
+
root = self[fei]
|
117
|
+
|
118
|
+
return root if root
|
105
119
|
|
106
|
-
|
120
|
+
#
|
121
|
+
# direct hit missed, scanning...
|
122
|
+
|
123
|
+
each_object_path(compute_dir_path(wfid)) do |p|
|
124
|
+
|
125
|
+
a = self.class.split_file_path p
|
107
126
|
next unless a
|
108
127
|
|
109
|
-
|
110
|
-
next if wfid_prefix and ( ! wfid.match "^#{wfid_prefix}")
|
128
|
+
next unless a[0] == wfid
|
111
129
|
|
112
|
-
|
130
|
+
fexp = load_object p
|
113
131
|
|
114
|
-
|
132
|
+
return fexp if fexp.is_a?(DefineExpression)
|
115
133
|
end
|
116
|
-
end
|
117
134
|
|
118
|
-
|
135
|
+
nil
|
136
|
+
end
|
119
137
|
|
120
138
|
#
|
121
139
|
# Returns a human-readable list of the current YAML file paths.
|
@@ -148,6 +166,15 @@ module OpenWFE
|
|
148
166
|
|
149
167
|
protected
|
150
168
|
|
169
|
+
def compute_dir_path (wfid)
|
170
|
+
|
171
|
+
wfid = FlowExpressionId.to_parent_wfid wfid
|
172
|
+
|
173
|
+
a_wfid = get_wfid_generator.split_wfid wfid
|
174
|
+
|
175
|
+
@basepath + a_wfid[-2] + "/" + a_wfid[-1] + "/"
|
176
|
+
end
|
177
|
+
|
151
178
|
def compute_file_path (fei)
|
152
179
|
|
153
180
|
return @basepath + "/engine_environment.yaml" \
|
@@ -155,11 +182,7 @@ module OpenWFE
|
|
155
182
|
|
156
183
|
wfid = fei.parent_workflow_instance_id
|
157
184
|
|
158
|
-
|
159
|
-
|
160
|
-
@basepath +
|
161
|
-
a_wfid[-2] + "/" +
|
162
|
-
a_wfid[-1] + "/" +
|
185
|
+
compute_dir_path(wfid) +
|
163
186
|
fei.workflow_instance_id + "__" +
|
164
187
|
fei.expression_id + "_" +
|
165
188
|
fei.expression_name + ".yaml"
|
@@ -192,7 +215,7 @@ module OpenWFE
|
|
192
215
|
|
193
216
|
super
|
194
217
|
|
195
|
-
start_processing_thread
|
218
|
+
start_processing_thread
|
196
219
|
#
|
197
220
|
# which sets @thread_id
|
198
221
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
#--
|
3
|
-
# Copyright (c) 2007, John Mettraux, OpenWFE.org
|
3
|
+
# Copyright (c) 2007-2008, John Mettraux, OpenWFE.org
|
4
4
|
# All rights reserved.
|
5
5
|
#
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
@@ -37,7 +37,7 @@
|
|
37
37
|
# John Mettraux at openwfe.org
|
38
38
|
#
|
39
39
|
|
40
|
-
require '
|
40
|
+
require 'rufus/eval' # gem 'rufus-eval'
|
41
41
|
|
42
42
|
|
43
43
|
module OpenWFE
|
@@ -116,34 +116,68 @@ module OpenWFE
|
|
116
116
|
return nil \
|
117
117
|
unless conditional
|
118
118
|
|
119
|
-
ldebug { "do_eval_condition() 0 for
|
119
|
+
ldebug { "do_eval_condition() 0 for >#{conditional}<" }
|
120
120
|
|
121
121
|
conditional = unescape conditional
|
122
122
|
|
123
|
-
ldebug { "do_eval_condition() 1 for
|
123
|
+
ldebug { "do_eval_condition() 1 for >#{conditional}<" }
|
124
|
+
|
125
|
+
r = eval_set conditional
|
126
|
+
return r if r != nil
|
124
127
|
|
125
128
|
begin
|
126
129
|
return to_boolean(do_eval(conditional, workitem))
|
127
130
|
rescue Exception => e
|
128
131
|
# probably needs some quoting...
|
132
|
+
ldebug { "do_eval_condition() e : #{e}" }
|
129
133
|
end
|
130
134
|
|
131
135
|
conditional = do_quote(conditional)
|
132
136
|
|
133
|
-
ldebug { "do_eval_condition() 2 for
|
137
|
+
ldebug { "do_eval_condition() 2 for >#{conditional}<" }
|
134
138
|
|
135
139
|
to_boolean(do_eval(conditional, workitem))
|
136
140
|
end
|
137
141
|
|
142
|
+
SET_REGEX = /(\S*?)( is)?( not)? set$/
|
143
|
+
|
144
|
+
#
|
145
|
+
# Evals the 'x [ is][ not] set' notation...
|
146
|
+
#
|
147
|
+
def eval_set (cond)
|
148
|
+
|
149
|
+
m = SET_REGEX.match cond
|
150
|
+
|
151
|
+
return nil unless m
|
152
|
+
|
153
|
+
val = m[1]
|
154
|
+
n = m[3]
|
155
|
+
|
156
|
+
ldebug do
|
157
|
+
"eval_set() for >#{cond}< "+
|
158
|
+
"m[1] is '#{val}', m[3] is '#{n}'"
|
159
|
+
end
|
160
|
+
|
161
|
+
val = val.strip if val
|
162
|
+
val = (val != nil and val != '')
|
163
|
+
n = (n and n.strip == 'not')
|
164
|
+
|
165
|
+
n ? (not val) : val
|
166
|
+
end
|
167
|
+
|
138
168
|
private
|
139
169
|
|
140
170
|
#
|
141
171
|
# Returns true if result is the "true" String or the true
|
142
172
|
# boolean value. Returns false else.
|
143
173
|
#
|
144
|
-
def to_boolean (
|
145
|
-
|
146
|
-
|
174
|
+
def to_boolean (o)
|
175
|
+
|
176
|
+
ldebug { "to_boolean() o is _#{o}_" }
|
177
|
+
|
178
|
+
#(o == "true" or o == true)
|
179
|
+
o = o.strip if o.is_a?(String)
|
180
|
+
not (o == nil || o == false || o == 'false' || o == '')
|
147
181
|
end
|
148
182
|
|
149
183
|
#
|
@@ -181,6 +215,7 @@ module OpenWFE
|
|
181
215
|
# Returns nil if not operator was found in the string.
|
182
216
|
#
|
183
217
|
def find_operator (string)
|
218
|
+
|
184
219
|
[ "==", "!=", "<=", ">=", "<", ">" ].each do |op|
|
185
220
|
i = string.index op
|
186
221
|
next unless i
|
@@ -191,15 +226,17 @@ module OpenWFE
|
|
191
226
|
|
192
227
|
#
|
193
228
|
# Runs the given given within an instance_eval() at a $SAFE
|
194
|
-
# level of
|
229
|
+
# level of 4.
|
195
230
|
#
|
196
231
|
def do_eval (s, workitem)
|
197
232
|
|
198
|
-
#OpenWFE::instance_eval_safely(self, s, 3)
|
199
|
-
|
200
233
|
wi = workitem
|
201
234
|
fe = self
|
202
|
-
|
235
|
+
#
|
236
|
+
# wi and fe are thus available as well
|
237
|
+
# (as self and workitem)
|
238
|
+
|
239
|
+
Rufus::eval_safely(s, 4, binding())
|
203
240
|
end
|
204
241
|
end
|
205
242
|
|