openwferu 0.9.3 → 0.9.4
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.
- data/examples/flowtracing.rb +22 -0
- data/lib/openwfe/contextual.rb +5 -2
- data/lib/openwfe/def.rb +47 -0
- data/lib/openwfe/engine/engine.rb +1 -1
- data/lib/openwfe/engine/file_persisted_engine.rb +3 -5
- data/lib/openwfe/expool/expressionpool.rb +45 -6
- data/lib/openwfe/expool/history.rb +117 -0
- data/lib/openwfe/expool/yamlexpstorage.rb +21 -4
- data/lib/openwfe/expressions/environment.rb +3 -0
- data/lib/openwfe/expressions/expressionmap.rb +1 -0
- data/lib/openwfe/expressions/fe_concurrence.rb +22 -12
- data/lib/openwfe/expressions/fe_iterator.rb +3 -1
- data/lib/openwfe/expressions/fe_participant.rb +1 -4
- data/lib/openwfe/expressions/fe_raw.rb +2 -2
- data/lib/openwfe/expressions/fe_time.rb +184 -10
- data/lib/openwfe/expressions/fe_utils.rb +10 -0
- data/lib/openwfe/expressions/flowexpression.rb +3 -1
- data/lib/openwfe/expressions/raw_prog.rb +1 -1
- data/lib/openwfe/expressions/timeout.rb +47 -13
- data/lib/openwfe/flowexpressionid.rb +9 -1
- data/lib/openwfe/participants/csvparticipant.rb +127 -0
- data/lib/openwfe/participants/participant.rb +1 -0
- data/lib/openwfe/participants/participants.rb +26 -3
- data/lib/openwfe/rest/controlclient.rb +3 -3
- data/lib/openwfe/rest/worklistclient.rb +6 -8
- data/lib/openwfe/rest/xmlcodec.rb +6 -6
- data/lib/openwfe/rudefinitions.rb +6 -13
- data/lib/openwfe/storage/yamlfilestorage.rb +1 -1
- data/lib/openwfe/tools/flowtracer.rb +80 -0
- data/lib/openwfe/util/csvtable.rb +378 -0
- data/lib/openwfe/util/dollar.rb +24 -7
- data/lib/openwfe/util/observable.rb +82 -0
- data/lib/openwfe/util/scheduler.rb +14 -0
- data/lib/openwfe/utils.rb +64 -0
- data/lib/openwfe/version.rb +38 -0
- data/lib/openwfe/workitem.rb +53 -0
- data/lib/openwfe/worklist/storeparticipant.rb +19 -4
- data/test/csv_test.rb +285 -0
- data/test/fei_test.rb +1 -1
- data/test/file_persistence_test.rb +2 -2
- data/test/flowtestbase.rb +10 -3
- data/test/ft_0.rb +0 -7
- data/test/ft_0d_participant.rb +29 -0
- data/test/ft_11_ppd.rb +26 -1
- data/test/ft_12_blockparticipant.rb +28 -1
- data/test/ft_19_csv.rb +64 -0
- data/test/ft_20_cron.rb +60 -0
- data/test/ft_21_cron.rb +48 -0
- data/test/ft_22_history.rb +68 -0
- data/test/ft_23_when.rb +50 -0
- data/test/ft_23b_when.rb +45 -0
- data/test/ft_24_def.rb +47 -0
- data/test/ft_9_cursor.rb +20 -0
- data/test/rake_qtest.rb +7 -0
- data/test/rake_test.rb +3 -0
- data/test/timeout_test.rb +46 -4
- data/test/wi_test.rb +66 -0
- metadata +21 -3
- data/test/rake_ptest.rb +0 -18
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# a little script that traces the flow given as input
|
4
|
+
#
|
5
|
+
|
6
|
+
require 'openwfe/expressions/raw_prog'
|
7
|
+
require 'openwfe/tools/flowtracer'
|
8
|
+
|
9
|
+
class MyProcessDefinition < OpenWFE::ProcessDefinition
|
10
|
+
def make
|
11
|
+
process_definition :name => "mpd", :revision => "0" do
|
12
|
+
sequence do
|
13
|
+
participant "alpha"
|
14
|
+
set :field => "toto", :value => "toto value"
|
15
|
+
participant "bravo"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
OpenWFE::trace_flow(MyProcessDefinition)
|
22
|
+
|
data/lib/openwfe/contextual.rb
CHANGED
@@ -68,10 +68,13 @@ module OpenWFE
|
|
68
68
|
#
|
69
69
|
# Use reflection to instantiate the new service,and
|
70
70
|
# add it to the application context
|
71
|
+
# The service_name can be a String or a Symbol (which will be
|
72
|
+
# turned into a String).
|
71
73
|
#
|
72
74
|
def init_service (service_name, service_class)
|
73
|
-
|
74
|
-
|
75
|
+
|
76
|
+
@application_context[service_name.to_s] =
|
77
|
+
service_class.new(service_name, @application_context)
|
75
78
|
end
|
76
79
|
|
77
80
|
end
|
data/lib/openwfe/def.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
#
|
2
|
+
#--
|
3
|
+
# Copyright (c) 2007, John Mettraux, OpenWFE.org
|
4
|
+
# All rights reserved.
|
5
|
+
#
|
6
|
+
# Redistribution and use in source and binary forms, with or without
|
7
|
+
# modification, are permitted provided that the following conditions are met:
|
8
|
+
#
|
9
|
+
# . Redistributions of source code must retain the above copyright notice, this
|
10
|
+
# list of conditions and the following disclaimer.
|
11
|
+
#
|
12
|
+
# . Redistributions in binary form must reproduce the above copyright notice,
|
13
|
+
# this list of conditions and the following disclaimer in the documentation
|
14
|
+
# and/or other materials provided with the distribution.
|
15
|
+
#
|
16
|
+
# . Neither the name of the "OpenWFE" nor the names of its contributors may be
|
17
|
+
# used to endorse or promote products derived from this software without
|
18
|
+
# specific prior written permission.
|
19
|
+
#
|
20
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
21
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
22
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
23
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
24
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
25
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
26
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
27
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
28
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
29
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
30
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
31
|
+
#++
|
32
|
+
#
|
33
|
+
# $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
|
34
|
+
#
|
35
|
+
|
36
|
+
#
|
37
|
+
# just a redirection
|
38
|
+
#
|
39
|
+
# require 'openwfe/def'
|
40
|
+
#
|
41
|
+
# being shorter and easier to remember than
|
42
|
+
#
|
43
|
+
# require 'openwfe/expressions/raw_prog'
|
44
|
+
#
|
45
|
+
|
46
|
+
require 'openwfe/expressions/raw_prog'
|
47
|
+
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
#--
|
3
|
-
# Copyright (c) 2006-2007, Nicolas Modryzk, OpenWFE.org
|
3
|
+
# Copyright (c) 2006-2007, 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
|
@@ -52,14 +52,12 @@ module OpenWFE
|
|
52
52
|
class FilePersistedEngine < Engine
|
53
53
|
|
54
54
|
#
|
55
|
-
#
|
55
|
+
# Overrides the method already found in Engine with a persisted
|
56
56
|
# expression storage
|
57
57
|
#
|
58
58
|
def build_expression_storage ()
|
59
|
-
#FileExpressionStorage \
|
60
|
-
# .new(S_EXPRESSION_STORAGE, @application_context, ENV['HOME'])
|
61
59
|
|
62
|
-
@application_context[:
|
60
|
+
@application_context[:work_directory] = "./work"
|
63
61
|
|
64
62
|
init_service(S_EXPRESSION_STORAGE, YamlFileExpressionStorage)
|
65
63
|
end
|
@@ -51,6 +51,7 @@ require 'openwfe/rudefinitions'
|
|
51
51
|
require 'openwfe/flowexpressionid'
|
52
52
|
require 'openwfe/util/stoppable'
|
53
53
|
require 'openwfe/util/lru_cache'
|
54
|
+
require 'openwfe/util/observable'
|
54
55
|
require 'openwfe/expressions/environment'
|
55
56
|
require 'openwfe/expressions/raw_xml'
|
56
57
|
|
@@ -122,7 +123,12 @@ module OpenWFE
|
|
122
123
|
# expressions.
|
123
124
|
#
|
124
125
|
class ExpressionPool
|
125
|
-
include
|
126
|
+
include \
|
127
|
+
ServiceMixin,
|
128
|
+
MonitorMixin,
|
129
|
+
OwfeServiceLocator,
|
130
|
+
Stoppable,
|
131
|
+
Observable
|
126
132
|
|
127
133
|
@@last_given_instance_id = -1
|
128
134
|
#
|
@@ -136,6 +142,8 @@ module OpenWFE
|
|
136
142
|
|
137
143
|
@monitors = MonitorProvider.new(application_context)
|
138
144
|
|
145
|
+
@observers = {}
|
146
|
+
|
139
147
|
reschedule_a_bit_later
|
140
148
|
end
|
141
149
|
|
@@ -145,6 +153,8 @@ module OpenWFE
|
|
145
153
|
def stop
|
146
154
|
# would an alias be better ?
|
147
155
|
do_stop
|
156
|
+
|
157
|
+
onotify :stop
|
148
158
|
end
|
149
159
|
|
150
160
|
#
|
@@ -161,6 +171,8 @@ module OpenWFE
|
|
161
171
|
#
|
162
172
|
def launch (launchitem)
|
163
173
|
|
174
|
+
onotify :launch, launchitem.workflow_definition_url
|
175
|
+
|
164
176
|
rawExpression = buildRawExpression(launchitem)
|
165
177
|
|
166
178
|
wi = build_workitem(launchitem)
|
@@ -188,6 +200,8 @@ module OpenWFE
|
|
188
200
|
|
189
201
|
ldebug { "launch_template() request for #{rawexp.fei.to_debug_s}" }
|
190
202
|
|
203
|
+
onotify :launch_template, rawexp.fei
|
204
|
+
|
191
205
|
rawexp = rawexp.dup()
|
192
206
|
rawexp.fei = rawexp.fei.dup()
|
193
207
|
|
@@ -226,8 +240,12 @@ module OpenWFE
|
|
226
240
|
|
227
241
|
rawexp.store_itself()
|
228
242
|
|
243
|
+
workitem.flow_expression_id = rawexp.fei
|
244
|
+
|
229
245
|
rawexp.apply(workitem)
|
230
246
|
|
247
|
+
# why not : launch in a thread and reply immediately
|
248
|
+
|
231
249
|
return workitem.flow_expression_id
|
232
250
|
end
|
233
251
|
|
@@ -249,16 +267,18 @@ module OpenWFE
|
|
249
267
|
|
250
268
|
exp, fei = fetch(exp)
|
251
269
|
|
252
|
-
ldebug { "apply() '#{fei}' (#{fei.class})" }
|
270
|
+
#ldebug { "apply() '#{fei}' (#{fei.class})" }
|
253
271
|
|
254
272
|
if not exp
|
255
273
|
lwarn { "apply() cannot apply missing #{fei.to_debug_s}" }
|
256
274
|
return
|
257
275
|
end
|
258
276
|
|
259
|
-
ldebug { "apply() #{fei.to_debug_s}" }
|
277
|
+
#ldebug { "apply() #{fei.to_debug_s}" }
|
278
|
+
|
279
|
+
onotify :apply, fei, workitem
|
260
280
|
|
261
|
-
workitem.
|
281
|
+
workitem.flow_expression_id = exp.fei
|
262
282
|
|
263
283
|
exp.apply(workitem)
|
264
284
|
end
|
@@ -277,6 +297,8 @@ module OpenWFE
|
|
277
297
|
|
278
298
|
ldebug { "cancel() for #{fei.to_debug_s}" }
|
279
299
|
|
300
|
+
onotify :cancel, fei
|
301
|
+
|
280
302
|
inflowitem = exp.cancel()
|
281
303
|
remove(exp)
|
282
304
|
|
@@ -293,6 +315,8 @@ module OpenWFE
|
|
293
315
|
|
294
316
|
return if not exp
|
295
317
|
|
318
|
+
onotify :forget, fei
|
319
|
+
|
296
320
|
exp.parent_id = GONE_PARENT_ID
|
297
321
|
exp.store_itself()
|
298
322
|
end
|
@@ -306,6 +330,8 @@ module OpenWFE
|
|
306
330
|
|
307
331
|
workitem.last_expression_id = fei
|
308
332
|
|
333
|
+
onotify :reply_to_parent, fei, workitem
|
334
|
+
|
309
335
|
#remove(exp, workitem)
|
310
336
|
remove(exp)
|
311
337
|
|
@@ -347,6 +373,8 @@ module OpenWFE
|
|
347
373
|
return
|
348
374
|
end
|
349
375
|
|
376
|
+
onotify :reply, fei, workitem
|
377
|
+
|
350
378
|
exp.reply(workitem)
|
351
379
|
end
|
352
380
|
|
@@ -355,6 +383,8 @@ module OpenWFE
|
|
355
383
|
#
|
356
384
|
def update (flowExpression)
|
357
385
|
|
386
|
+
onotify :update, flowExpression.fei, flowExpression
|
387
|
+
|
358
388
|
get_expression_storage()[flowExpression.fei] = flowExpression
|
359
389
|
end
|
360
390
|
|
@@ -422,6 +452,8 @@ module OpenWFE
|
|
422
452
|
|
423
453
|
ldebug { "remove() fe #{fei.to_debug_s}" }
|
424
454
|
|
455
|
+
onotify :remove, fei
|
456
|
+
|
425
457
|
synchronize do
|
426
458
|
|
427
459
|
@monitors.delete(fei)
|
@@ -462,6 +494,8 @@ module OpenWFE
|
|
462
494
|
|
463
495
|
ldebug { "reschedule() for #{fe.fei.to_debug_s}..." }
|
464
496
|
|
497
|
+
onotify :reschedule, fe.fei
|
498
|
+
|
465
499
|
fe.reschedule(get_scheduler)
|
466
500
|
end
|
467
501
|
|
@@ -478,7 +512,7 @@ module OpenWFE
|
|
478
512
|
synchronize do
|
479
513
|
return @eei if @eei
|
480
514
|
@eei = FlowExpressionId.new
|
481
|
-
@eei.owfe_version =
|
515
|
+
@eei.owfe_version = OPENWFERU_VERSION
|
482
516
|
@eei.engine_id = get_engine.service_name
|
483
517
|
@eei.initial_engine_id = @eei.engine_id
|
484
518
|
@eei.workflow_definition_url = 'ee'
|
@@ -517,8 +551,13 @@ module OpenWFE
|
|
517
551
|
end
|
518
552
|
|
519
553
|
def remove_environment (environment_id)
|
554
|
+
|
555
|
+
ldebug { "remove_environment() #{environment_id.to_debug_s}" }
|
556
|
+
|
520
557
|
env, fei = fetch(environment_id)
|
558
|
+
|
521
559
|
env.unbind()
|
560
|
+
|
522
561
|
get_expression_storage().delete(environment_id)
|
523
562
|
end
|
524
563
|
|
@@ -586,7 +625,7 @@ module OpenWFE
|
|
586
625
|
|
587
626
|
fei = FlowExpressionId.new
|
588
627
|
|
589
|
-
fei.owfe_version =
|
628
|
+
fei.owfe_version = OPENWFERU_VERSION
|
590
629
|
fei.engine_id = get_engine.service_name
|
591
630
|
fei.initial_engine_id = fei.engine_id
|
592
631
|
fei.workflow_definition_url = flow_url
|
@@ -0,0 +1,117 @@
|
|
1
|
+
#
|
2
|
+
#--
|
3
|
+
# Copyright (c) 2007, John Mettraux, OpenWFE.org
|
4
|
+
# All rights reserved.
|
5
|
+
#
|
6
|
+
# Redistribution and use in source and binary forms, with or without
|
7
|
+
# modification, are permitted provided that the following conditions are met:
|
8
|
+
#
|
9
|
+
# . Redistributions of source code must retain the above copyright notice, this
|
10
|
+
# list of conditions and the following disclaimer.
|
11
|
+
#
|
12
|
+
# . Redistributions in binary form must reproduce the above copyright notice,
|
13
|
+
# this list of conditions and the following disclaimer in the documentation
|
14
|
+
# and/or other materials provided with the distribution.
|
15
|
+
#
|
16
|
+
# . Neither the name of the "OpenWFE" nor the names of its contributors may be
|
17
|
+
# used to endorse or promote products derived from this software without
|
18
|
+
# specific prior written permission.
|
19
|
+
#
|
20
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
21
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
22
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
23
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
24
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
25
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
26
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
27
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
28
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
29
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
30
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
31
|
+
#++
|
32
|
+
#
|
33
|
+
# $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
|
34
|
+
#
|
35
|
+
|
36
|
+
#
|
37
|
+
# "made in Japan"
|
38
|
+
#
|
39
|
+
# John Mettraux at openwfe.org
|
40
|
+
#
|
41
|
+
|
42
|
+
#require 'monitor'
|
43
|
+
|
44
|
+
require 'openwfe/service'
|
45
|
+
require 'openwfe/rudefinitions'
|
46
|
+
|
47
|
+
|
48
|
+
module OpenWFE
|
49
|
+
|
50
|
+
#
|
51
|
+
# The base implementation for History modules
|
52
|
+
#
|
53
|
+
module HistoryMixin
|
54
|
+
include ServiceMixin, OwfeServiceLocator
|
55
|
+
|
56
|
+
def service_init (service_name, application_context)
|
57
|
+
|
58
|
+
super
|
59
|
+
|
60
|
+
get_expression_pool.add_observer(:all) do |event, *args|
|
61
|
+
log(event, *args)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def log (event, *args)
|
66
|
+
raise NotImplementedError.new(
|
67
|
+
"please provide an implementation of log(e, fei, wi)")
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
#
|
72
|
+
# The simplest implementation, stores all history entries in memory.
|
73
|
+
#
|
74
|
+
# DO NOT USE IN PRODUCTION, it will trigger an 'out of memory' error
|
75
|
+
# sooner or later.
|
76
|
+
#
|
77
|
+
# Is only used for unit testing purposes.
|
78
|
+
#
|
79
|
+
class InMemoryHistory
|
80
|
+
include HistoryMixin
|
81
|
+
|
82
|
+
attr_reader :entries
|
83
|
+
|
84
|
+
def initialize (service_name, application_context)
|
85
|
+
|
86
|
+
super()
|
87
|
+
|
88
|
+
@entries = []
|
89
|
+
|
90
|
+
service_init(service_name, application_context)
|
91
|
+
end
|
92
|
+
|
93
|
+
def log (event, *args)
|
94
|
+
msg = ""
|
95
|
+
msg << event.to_s
|
96
|
+
|
97
|
+
msg << " #{args[0].to_s}" \
|
98
|
+
if args.length > 0
|
99
|
+
|
100
|
+
#msg << " #{args[1].to_s}" \
|
101
|
+
# if args.length > 1
|
102
|
+
|
103
|
+
@entries << msg
|
104
|
+
end
|
105
|
+
|
106
|
+
def to_s
|
107
|
+
s = ""
|
108
|
+
@entries.each do |entry|
|
109
|
+
s << entry.to_s
|
110
|
+
s << "\n"
|
111
|
+
end
|
112
|
+
s
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|
117
|
+
|
@@ -62,16 +62,27 @@ module OpenWFE
|
|
62
62
|
# yaml serialization
|
63
63
|
#
|
64
64
|
|
65
|
+
#
|
65
66
|
# opening for tuning yaml persistence
|
66
67
|
#
|
67
68
|
class FlowExpression
|
69
|
+
|
68
70
|
def to_yaml_properties
|
71
|
+
|
69
72
|
l = super()
|
73
|
+
|
70
74
|
l.delete("@application_context")
|
75
|
+
|
76
|
+
l.delete("@timeout_job_id")
|
77
|
+
l.delete("@scheduler_job_id")
|
78
|
+
#
|
79
|
+
# scheduler ids should not get persisted
|
80
|
+
|
71
81
|
return l
|
72
82
|
end
|
73
83
|
end
|
74
84
|
|
85
|
+
#
|
75
86
|
# opening for tuning yaml persistence
|
76
87
|
#
|
77
88
|
class XmlRawExpression
|
@@ -89,12 +100,15 @@ module OpenWFE
|
|
89
100
|
include OwfeServiceLocator
|
90
101
|
|
91
102
|
def initialize (service_name, application_context)
|
103
|
+
|
92
104
|
path = if (@application_context)
|
93
|
-
@application_context[:
|
105
|
+
@application_context[:work_directory]
|
94
106
|
else
|
95
|
-
|
107
|
+
DEFAULT_WORK_DIRECTORY
|
96
108
|
end
|
97
|
-
|
109
|
+
path = path + '/expool'
|
110
|
+
|
111
|
+
super(service_name, application_context, path)
|
98
112
|
end
|
99
113
|
|
100
114
|
#
|
@@ -123,9 +137,10 @@ module OpenWFE
|
|
123
137
|
end
|
124
138
|
|
125
139
|
def to_s
|
140
|
+
|
126
141
|
s = "\n\n==== #{self.class} ===="
|
127
142
|
s << "\n"
|
128
|
-
|
143
|
+
each_object_path do |path|
|
129
144
|
s << path
|
130
145
|
s << "\n"
|
131
146
|
end
|
@@ -152,10 +167,12 @@ module OpenWFE
|
|
152
167
|
end
|
153
168
|
|
154
169
|
def matches (path, exp_names)
|
170
|
+
|
155
171
|
exp_names.each do |exp_name|
|
156
172
|
return true \
|
157
173
|
if OpenWFE::ends_with(path, "_#{exp_name}.yaml")
|
158
174
|
end
|
175
|
+
|
159
176
|
return false
|
160
177
|
end
|
161
178
|
|
@@ -124,6 +124,9 @@ module OpenWFE
|
|
124
124
|
def unbind ()
|
125
125
|
|
126
126
|
@variables.each do |key, value|
|
127
|
+
|
128
|
+
ldebug { "unbind() '#{key}' => #{value.class}" }
|
129
|
+
|
127
130
|
if value.kind_of? FlowExpressionId
|
128
131
|
get_expression_pool().remove(value)
|
129
132
|
elsif value.kind_of? FlowExpression
|
@@ -57,11 +57,10 @@ module OpenWFE
|
|
57
57
|
|
58
58
|
def apply (workitem)
|
59
59
|
|
60
|
-
sync = lookup_attribute(
|
61
|
-
sync = "generic" if not sync
|
60
|
+
sync = lookup_attribute(:sync, workitem, :generic)
|
62
61
|
|
63
62
|
@sync_expression = \
|
64
|
-
get_expression_map().get_sync_class(sync).new(
|
63
|
+
get_expression_map().get_sync_class(sync).new(self, workitem)
|
65
64
|
|
66
65
|
@children.each do |child|
|
67
66
|
@sync_expression.add_child(child)
|
@@ -132,15 +131,15 @@ module OpenWFE
|
|
132
131
|
:cancel_remaining,
|
133
132
|
:unready_queue
|
134
133
|
|
135
|
-
def initialize (
|
134
|
+
def initialize (synchable, workitem)
|
136
135
|
|
137
136
|
super()
|
138
137
|
|
139
138
|
@remaining_children = []
|
140
139
|
@reply_count = 0
|
141
140
|
|
142
|
-
@count = determine_count(
|
143
|
-
@cancel_remaining =
|
141
|
+
@count = determine_count(synchable, workitem)
|
142
|
+
@cancel_remaining = cancel_remaining?(synchable, workitem)
|
144
143
|
|
145
144
|
@unready_queue = []
|
146
145
|
end
|
@@ -213,7 +212,15 @@ module OpenWFE
|
|
213
212
|
if @count > 0 and @reply_count >= @count
|
214
213
|
treat_remaining_children(synchable)
|
215
214
|
synchable.reply_to_parent(workitem)
|
215
|
+
return
|
216
216
|
end
|
217
|
+
|
218
|
+
synchable.store_itself()
|
219
|
+
|
220
|
+
#synchable.ldebug do
|
221
|
+
# "#{self.class}.do_reply() not replying to parent "+
|
222
|
+
# "#{workitem.last_expression_id.to_debug_s}"
|
223
|
+
#end
|
217
224
|
end
|
218
225
|
|
219
226
|
def treat_remaining_children (synchable)
|
@@ -237,14 +244,17 @@ module OpenWFE
|
|
237
244
|
end
|
238
245
|
end
|
239
246
|
|
240
|
-
def
|
241
|
-
|
242
|
-
|
243
|
-
|
247
|
+
def cancel_remaining? (synchable_expression, workitem)
|
248
|
+
|
249
|
+
s = synchable_expression.lookup_attribute(
|
250
|
+
:remaining, workitem, :cancel)
|
251
|
+
|
252
|
+
return s == :cancel.to_s
|
244
253
|
end
|
245
254
|
|
246
|
-
def determine_count (
|
247
|
-
|
255
|
+
def determine_count (synchable_expression, workitem)
|
256
|
+
|
257
|
+
s = synchable_expression.lookup_attribute(:count, workitem)
|
248
258
|
return -1 if not s
|
249
259
|
i = s.to_i
|
250
260
|
return -1 if i < 1
|
@@ -116,7 +116,9 @@ module OpenWFE
|
|
116
116
|
.lookup_attribute(:to_variable, workitem)
|
117
117
|
|
118
118
|
@value_separator = iterator_expression\
|
119
|
-
.lookup_attribute(:value_separator, workitem
|
119
|
+
.lookup_attribute(:value_separator, workitem)
|
120
|
+
|
121
|
+
@value_separator = /,\s*/ unless @value_separator
|
120
122
|
|
121
123
|
@counter = 0
|
122
124
|
|
@@ -77,6 +77,7 @@ module OpenWFE
|
|
77
77
|
unless @participant_name
|
78
78
|
|
79
79
|
determine_timeout()
|
80
|
+
reschedule(get_scheduler)
|
80
81
|
|
81
82
|
store_itself()
|
82
83
|
|
@@ -95,10 +96,6 @@ module OpenWFE
|
|
95
96
|
|
96
97
|
wi = super()
|
97
98
|
|
98
|
-
if @scheduler_job_id
|
99
|
-
get_scheduler.unschedule(@scheduler_job_id)
|
100
|
-
end
|
101
|
-
|
102
99
|
return wi unless @applied_workitem
|
103
100
|
|
104
101
|
#
|
@@ -100,7 +100,7 @@ module OpenWFE
|
|
100
100
|
|
101
101
|
exp_name = expression_name()
|
102
102
|
|
103
|
-
exp_class =
|
103
|
+
exp_class = expression_class()
|
104
104
|
attributes = nil
|
105
105
|
|
106
106
|
template = lookup_variable(exp_name)
|
@@ -108,7 +108,7 @@ module OpenWFE
|
|
108
108
|
# is it a subprocess ?
|
109
109
|
|
110
110
|
template = get_participant_map.lookup_participant(exp_name) \
|
111
|
-
|
111
|
+
if (not template) and (not exp_class)
|
112
112
|
#
|
113
113
|
# is it a directly a participant ?
|
114
114
|
|