openwferu 0.9.6 → 0.9.7
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/validate-workflow.rb +1 -0
- data/examples/openwferu.rb +57 -0
- data/lib/openwfe/contextual.rb +2 -0
- data/lib/openwfe/engine/engine.rb +109 -17
- data/lib/openwfe/engine/file_persisted_engine.rb +11 -1
- data/lib/openwfe/exceptions.rb +53 -0
- data/lib/openwfe/expool/expressionpool.rb +195 -137
- data/lib/openwfe/expool/journal.rb +175 -0
- data/lib/openwfe/expool/journal_replay.rb +121 -0
- data/lib/openwfe/expool/wfidgen.rb +318 -0
- data/lib/openwfe/expool/yamlexpstorage.rb +23 -54
- data/lib/openwfe/expressions/condition.rb +14 -2
- data/lib/openwfe/expressions/environment.rb +47 -37
- data/lib/openwfe/expressions/expressionmap.rb +73 -67
- data/lib/openwfe/expressions/fe_cancel.rb +2 -0
- data/lib/openwfe/expressions/fe_concurrence.rb +14 -1
- data/lib/openwfe/expressions/fe_cron.rb +186 -0
- data/lib/openwfe/expressions/fe_cursor.rb +6 -0
- data/lib/openwfe/expressions/fe_define.rb +2 -0
- data/lib/openwfe/expressions/fe_fqv.rb +2 -0
- data/lib/openwfe/expressions/fe_iterator.rb +2 -0
- data/lib/openwfe/expressions/fe_losfor.rb +4 -0
- data/lib/openwfe/expressions/fe_misc.rb +16 -1
- data/lib/openwfe/expressions/fe_participant.rb +7 -0
- data/lib/openwfe/expressions/fe_raw.rb +125 -8
- data/lib/openwfe/expressions/fe_sequence.rb +2 -0
- data/lib/openwfe/expressions/fe_sleep.rb +213 -0
- data/lib/openwfe/expressions/fe_subprocess.rb +2 -0
- data/lib/openwfe/expressions/fe_value.rb +8 -0
- data/lib/openwfe/expressions/fe_when.rb +205 -0
- data/lib/openwfe/expressions/flowexpression.rb +62 -9
- data/lib/openwfe/expressions/raw_prog.rb +147 -45
- data/lib/openwfe/expressions/raw_xml.rb +50 -5
- data/lib/openwfe/expressions/timeout.rb +32 -5
- data/lib/openwfe/flowexpressionid.rb +6 -4
- data/lib/openwfe/listeners/listeners.rb +4 -3
- data/lib/openwfe/listeners/socketlisteners.rb +30 -4
- data/lib/openwfe/logging.rb +9 -1
- data/lib/openwfe/participants/participants.rb +9 -9
- data/lib/openwfe/participants/socketparticipants.rb +41 -8
- data/lib/openwfe/rudefinitions.rb +21 -0
- data/lib/openwfe/storage/yamlextras.rb +115 -0
- data/lib/openwfe/storage/yamlfilestorage.rb +23 -4
- data/lib/openwfe/util/csvtable.rb +76 -6
- data/lib/openwfe/util/dollar.rb +5 -0
- data/lib/openwfe/util/kotoba.rb +236 -0
- data/lib/openwfe/util/ometa.rb +64 -0
- data/lib/openwfe/util/safe.rb +2 -0
- data/lib/openwfe/util/scheduler.rb +58 -11
- data/lib/openwfe/utils.rb +27 -0
- data/lib/openwfe/version.rb +1 -1
- data/lib/openwfe/worklist/storeparticipant.rb +2 -3
- data/test/csv_test.rb +57 -0
- data/test/expmap_test.rb +54 -0
- data/test/file_persistence_test.rb +9 -9
- data/test/flowtestbase.rb +19 -1
- data/test/ft_11_ppd.rb +18 -0
- data/test/ft_15_iterator.rb +27 -0
- data/test/ft_23b_when.rb +2 -2
- data/test/ft_27_getflowpos.rb +19 -9
- data/test/ft_29_httprb.rb +31 -2
- data/test/ft_30_socketlistener.rb +3 -5
- data/test/ft_31_flowname.rb +40 -0
- data/test/ft_32_journal.rb +60 -0
- data/test/ft_33_description.rb +100 -0
- data/test/ft_34_cancelwfid.rb +69 -0
- data/test/ft_35_localdefs.rb +63 -0
- data/test/ft_7_lose.rb +0 -61
- data/test/ft_7b_lose.rb +85 -0
- data/test/ft_tests.rb +49 -0
- data/test/kotoba_test.rb +72 -0
- data/test/misc_test.rb +4 -12
- data/test/param_test.rb +284 -0
- data/test/rake_qtest.rb +13 -35
- data/test/rake_test.rb +2 -3
- data/test/raw_prog_test.rb +9 -7
- data/test/restart_cron_test.rb +9 -5
- data/test/restart_sleep_test.rb +104 -0
- data/test/restart_tests.rb +15 -0
- data/test/restart_when_test.rb +105 -0
- data/test/scheduler_test.rb +2 -2
- data/test/sec_test.rb +163 -0
- data/test/wfid_test.rb +69 -13
- metadata +31 -16
- data/lib/openwfe/expressions/fe_time.rb +0 -454
- data/test/restart_test.rb +0 -79
@@ -43,6 +43,7 @@ require 'openwfe/utils'
|
|
43
43
|
require 'openwfe/logging'
|
44
44
|
require 'openwfe/contextual'
|
45
45
|
require 'openwfe/rudefinitions'
|
46
|
+
require 'openwfe/util/ometa'
|
46
47
|
require 'openwfe/util/dollar'
|
47
48
|
|
48
49
|
|
@@ -56,7 +57,7 @@ module OpenWFE
|
|
56
57
|
# The base class for all OpenWFE flow expression classes.
|
57
58
|
# It gathers all the methods for attributes and variable lookup.
|
58
59
|
#
|
59
|
-
class FlowExpression
|
60
|
+
class FlowExpression < ObjectWithMeta
|
60
61
|
include Contextual, Logging, OwfeServiceLocator
|
61
62
|
|
62
63
|
attr_accessor \
|
@@ -214,7 +215,11 @@ module OpenWFE
|
|
214
215
|
# or by // to indicate engine level (global) scope.
|
215
216
|
#
|
216
217
|
def set_variable (varname, value)
|
217
|
-
|
218
|
+
|
219
|
+
#get_environment()[varname] = value
|
220
|
+
|
221
|
+
env, var = lookup_environment(varname)
|
222
|
+
env[var] = value
|
218
223
|
end
|
219
224
|
|
220
225
|
#
|
@@ -226,7 +231,11 @@ module OpenWFE
|
|
226
231
|
# or by // to indicate engine level (global) scope.
|
227
232
|
#
|
228
233
|
def lookup_variable (varname)
|
229
|
-
|
234
|
+
|
235
|
+
#get_environment()[varname]
|
236
|
+
|
237
|
+
env, var = lookup_environment(varname)
|
238
|
+
env[var]
|
230
239
|
end
|
231
240
|
|
232
241
|
#
|
@@ -236,7 +245,11 @@ module OpenWFE
|
|
236
245
|
# or by // to indicate engine level (global) scope.
|
237
246
|
#
|
238
247
|
def delete_variable (varname)
|
239
|
-
|
248
|
+
|
249
|
+
#get_environment().delete(varname)
|
250
|
+
|
251
|
+
env, var = lookup_environment(varname)
|
252
|
+
env.delete var
|
240
253
|
end
|
241
254
|
|
242
255
|
#
|
@@ -258,7 +271,7 @@ module OpenWFE
|
|
258
271
|
#
|
259
272
|
def lookup_attribute (attname, workitem, default=nil)
|
260
273
|
|
261
|
-
attname =
|
274
|
+
attname = OpenWFE::symbol_to_name(attname) \
|
262
275
|
if attname.kind_of? Symbol
|
263
276
|
|
264
277
|
#ldebug { "lookup_attribute() '#{attname}' in #{@fei.to_debug_s}" }
|
@@ -277,6 +290,7 @@ module OpenWFE
|
|
277
290
|
# It's ok to pass a Symbol for the attribute name.
|
278
291
|
#
|
279
292
|
def lookup_boolean_attribute (attname, workitem, default=false)
|
293
|
+
|
280
294
|
value = lookup_attribute(attname, workitem)
|
281
295
|
return default if not value
|
282
296
|
return value.downcase == 'true'
|
@@ -434,12 +448,51 @@ module OpenWFE
|
|
434
448
|
return s
|
435
449
|
end
|
436
450
|
|
451
|
+
#
|
452
|
+
# a nice 'names' tag/method for registering the names of the
|
453
|
+
# Expression classes.
|
454
|
+
#
|
455
|
+
def self.names (*exp_names)
|
456
|
+
exp_names = exp_names.collect do |n|
|
457
|
+
n.to_s
|
458
|
+
end
|
459
|
+
meta_def :expression_names do
|
460
|
+
exp_names
|
461
|
+
end
|
462
|
+
end
|
463
|
+
|
464
|
+
#def self.sync_expression (bool)
|
465
|
+
# meta_def :is_sync_expression? do
|
466
|
+
# bool
|
467
|
+
# end
|
468
|
+
#end
|
469
|
+
#sync_expression false
|
470
|
+
|
437
471
|
protected
|
438
472
|
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
473
|
+
#
|
474
|
+
# If the varname starts with '//' will return the engine
|
475
|
+
# environment and the truncated varname...
|
476
|
+
# If the varname starts with '/' will return the root environment
|
477
|
+
# for the current process instance and the truncated varname...
|
478
|
+
#
|
479
|
+
def lookup_environment (varname)
|
480
|
+
|
481
|
+
if varname[0, 2] == '//'
|
482
|
+
return [
|
483
|
+
get_expression_pool.fetch_engine_environment,
|
484
|
+
varname[2..-1]
|
485
|
+
]
|
486
|
+
end
|
487
|
+
|
488
|
+
if varname[0, 1] == '/'
|
489
|
+
return [
|
490
|
+
get_environment.get_root_environment,
|
491
|
+
varname[1..-1]
|
492
|
+
]
|
493
|
+
end
|
494
|
+
|
495
|
+
return [ get_environment, varname]
|
443
496
|
end
|
444
497
|
end
|
445
498
|
|
@@ -41,6 +41,7 @@
|
|
41
41
|
|
42
42
|
require 'rexml/document'
|
43
43
|
|
44
|
+
require 'openwfe/utils'
|
44
45
|
require 'openwfe/expressions/fe_raw'
|
45
46
|
require 'openwfe/expressions/fe_utils'
|
46
47
|
|
@@ -177,26 +178,37 @@ module OpenWFE
|
|
177
178
|
#
|
178
179
|
class ProcessDefinition
|
179
180
|
|
180
|
-
|
181
|
+
def self.metaclass; class << self; self; end; end
|
181
182
|
|
182
|
-
|
183
|
-
def initialize ()
|
183
|
+
attr_reader :context
|
184
184
|
|
185
|
+
def initialize ()
|
185
186
|
super()
|
186
|
-
|
187
|
-
@top_expressions = []
|
188
|
-
@previous_parent_expression = []
|
187
|
+
@context = Context.new
|
189
188
|
end
|
190
189
|
|
191
190
|
def method_missing (m, *args, &block)
|
192
191
|
|
193
|
-
|
192
|
+
#puts "__i_method_missing >>>#{m}<<<<"
|
193
|
+
|
194
|
+
ProcessDefinition.make_expression(
|
195
|
+
@context,
|
196
|
+
OpenWFE::to_expression_name(m),
|
197
|
+
ProcessDefinition.pack_args(args),
|
198
|
+
&block)
|
199
|
+
end
|
200
|
+
|
201
|
+
def self.method_missing (m, *args, &block)
|
194
202
|
|
195
|
-
|
203
|
+
#puts "__c_method_missing >>>#{m}<<<<"
|
196
204
|
|
197
|
-
|
205
|
+
@ccontext = Context.new() unless @ccontext
|
198
206
|
|
199
|
-
make_expression(
|
207
|
+
ProcessDefinition.make_expression(
|
208
|
+
@ccontext,
|
209
|
+
OpenWFE::to_expression_name(m),
|
210
|
+
ProcessDefinition.pack_args(args),
|
211
|
+
&block)
|
200
212
|
end
|
201
213
|
|
202
214
|
#
|
@@ -207,19 +219,17 @@ module OpenWFE
|
|
207
219
|
raise "make() implementation is missing, please provide one"
|
208
220
|
end
|
209
221
|
|
210
|
-
def make_expression (exp_name, params, &block)
|
211
|
-
|
212
|
-
exp_name = exp_name.to_s
|
222
|
+
def self.make_expression (context, exp_name, params, &block)
|
213
223
|
|
214
224
|
string_child = nil
|
215
|
-
attributes =
|
225
|
+
attributes = OpenWFE::SymbolHash.new
|
216
226
|
|
217
227
|
#puts " ... params.class is #{params.class}"
|
218
228
|
|
219
229
|
if params.kind_of? Hash
|
220
230
|
params.each do |k, v|
|
221
231
|
#attributes[k.to_s] = v.to_s
|
222
|
-
attributes[OpenWFE
|
232
|
+
attributes[OpenWFE::symbol_to_name(k.to_s)] = v.to_s
|
223
233
|
end
|
224
234
|
elsif params
|
225
235
|
string_child = params.to_s
|
@@ -230,30 +240,28 @@ module OpenWFE
|
|
230
240
|
exp.children << string_child \
|
231
241
|
if string_child
|
232
242
|
|
233
|
-
if
|
234
|
-
|
243
|
+
if context.parent_expression
|
244
|
+
#
|
245
|
+
# adding this new expression to its parent
|
246
|
+
#
|
247
|
+
context.parent_expression << exp
|
235
248
|
else
|
236
|
-
|
249
|
+
#
|
250
|
+
# an orphan, a top expression
|
251
|
+
#
|
252
|
+
context.top_expressions << exp
|
237
253
|
end
|
238
254
|
|
239
255
|
return exp if not block
|
240
256
|
|
241
|
-
|
242
|
-
if @parent_expression
|
243
|
-
|
244
|
-
@parent_expression = exp
|
257
|
+
context.push_parent_expression(exp)
|
245
258
|
|
246
259
|
result = block.call
|
247
|
-
|
248
|
-
# puts " ... child is >#{result}<"
|
249
|
-
# exp.children << result
|
250
|
-
#end
|
251
|
-
#exp.children << result \
|
252
|
-
# if result and not result.kind_of? ProgExpRepresentation
|
260
|
+
|
253
261
|
exp.children << result \
|
254
262
|
if result and result.kind_of? String
|
255
263
|
|
256
|
-
|
264
|
+
context.pop_parent_expression
|
257
265
|
|
258
266
|
return exp
|
259
267
|
end
|
@@ -264,16 +272,23 @@ module OpenWFE
|
|
264
272
|
#
|
265
273
|
def ProcessDefinition.do_make ()
|
266
274
|
|
267
|
-
|
268
|
-
exp = pdef.make
|
269
|
-
|
270
|
-
if pdef.top_expressions.size == 1 and \
|
271
|
-
exp.name == "process-definition"
|
275
|
+
context = nil
|
272
276
|
|
273
|
-
|
277
|
+
if @ccontext
|
278
|
+
context = @ccontext
|
279
|
+
else
|
280
|
+
pdef = self.new
|
281
|
+
pdef.make
|
282
|
+
context = pdef.context
|
274
283
|
end
|
275
284
|
|
276
|
-
|
285
|
+
exp = context.top_expression
|
286
|
+
|
287
|
+
return exp if exp
|
288
|
+
|
289
|
+
name, revision =
|
290
|
+
extract_name_and_revision(self.metaclass.to_s[8..-2])
|
291
|
+
|
277
292
|
attributes = {}
|
278
293
|
attributes["name"] = name
|
279
294
|
attributes["revision"] = revision
|
@@ -281,14 +296,14 @@ module OpenWFE
|
|
281
296
|
top_expression = ProgExpRepresentation.new(
|
282
297
|
"process-definition", attributes)
|
283
298
|
|
284
|
-
top_expression.children =
|
299
|
+
top_expression.children = context.top_expressions
|
285
300
|
|
286
|
-
top_expression
|
301
|
+
return top_expression
|
287
302
|
end
|
288
303
|
|
289
304
|
protected
|
290
305
|
|
291
|
-
def pack_args (args)
|
306
|
+
def ProcessDefinition.pack_args (args)
|
292
307
|
return args[0] if args.length == 1
|
293
308
|
a = {}
|
294
309
|
args.each_with_index do |arg, index|
|
@@ -323,6 +338,48 @@ module OpenWFE
|
|
323
338
|
def ProcessDefinition.as_revision (s)
|
324
339
|
s.gsub("_", ".")
|
325
340
|
end
|
341
|
+
|
342
|
+
class Context
|
343
|
+
|
344
|
+
attr_accessor :parent_expression
|
345
|
+
attr_reader :top_expressions, :previous_parent_expressions
|
346
|
+
|
347
|
+
def initialize
|
348
|
+
@parent_expression = nil
|
349
|
+
@top_expressions = []
|
350
|
+
@previous_parent_expressions = []
|
351
|
+
end
|
352
|
+
|
353
|
+
#
|
354
|
+
# puts the current parent expression on top of the 'previous
|
355
|
+
# parent expressions' stack, the current parent expression
|
356
|
+
# is replaced with the supplied parent expression.
|
357
|
+
#
|
358
|
+
def push_parent_expression (exp)
|
359
|
+
@previous_parent_expressions.push(@parent_expression) \
|
360
|
+
if @parent_expression
|
361
|
+
@parent_expression = exp
|
362
|
+
end
|
363
|
+
|
364
|
+
#
|
365
|
+
# Replaces the current parent expression with the one found
|
366
|
+
# on the top of the previous parent expression stack (pop).
|
367
|
+
#
|
368
|
+
def pop_parent_expression
|
369
|
+
@parent_expression = @previous_parent_expressions.pop
|
370
|
+
end
|
371
|
+
|
372
|
+
#
|
373
|
+
# This method returns the top expression among the
|
374
|
+
# top expressions...
|
375
|
+
#
|
376
|
+
def top_expression
|
377
|
+
return nil if @top_expressions.size > 1
|
378
|
+
exp = @top_expressions[0]
|
379
|
+
return exp if exp.name == "process-definition"
|
380
|
+
return nil
|
381
|
+
end
|
382
|
+
end
|
326
383
|
end
|
327
384
|
|
328
385
|
#
|
@@ -348,16 +405,40 @@ module OpenWFE
|
|
348
405
|
protected
|
349
406
|
|
350
407
|
def extract_attributes ()
|
351
|
-
|
408
|
+
raw_representation.attributes
|
409
|
+
end
|
410
|
+
|
411
|
+
def extract_descriptions ()
|
412
|
+
|
413
|
+
result = []
|
414
|
+
raw_representation.children.each do |child|
|
415
|
+
|
416
|
+
next unless child.is_a?(ProgExpRepresentation)
|
417
|
+
next if child.name.intern != :description
|
418
|
+
|
419
|
+
lang = child.attributes[:language]
|
420
|
+
lang = child.attributes[:lang] unless lang
|
421
|
+
lang = "default" unless lang
|
422
|
+
|
423
|
+
result << [ lang, child.children[0] ]
|
424
|
+
end
|
425
|
+
result
|
352
426
|
end
|
353
427
|
|
354
428
|
def extract_children ()
|
355
429
|
|
356
430
|
i = 0
|
357
|
-
|
431
|
+
result = []
|
432
|
+
raw_representation.children.each do |child|
|
358
433
|
|
359
434
|
if child.kind_of? ProgExpRepresentation
|
360
435
|
|
436
|
+
cname = child.name.intern
|
437
|
+
|
438
|
+
next if cname == :param
|
439
|
+
next if cname == :parameter
|
440
|
+
next if cname == :description
|
441
|
+
|
361
442
|
cfei = @fei.dup
|
362
443
|
cfei.expression_name = child.name
|
363
444
|
cfei.expression_id = "#{cfei.expression_id}.#{i}"
|
@@ -371,12 +452,13 @@ module OpenWFE
|
|
371
452
|
|
372
453
|
i = i + 1
|
373
454
|
|
374
|
-
rawexp.fei
|
455
|
+
result << rawexp.fei
|
375
456
|
else
|
376
457
|
|
377
|
-
child
|
458
|
+
result << child
|
378
459
|
end
|
379
460
|
end
|
461
|
+
result
|
380
462
|
end
|
381
463
|
|
382
464
|
def extract_text_children ()
|
@@ -385,6 +467,25 @@ module OpenWFE
|
|
385
467
|
child.to_s
|
386
468
|
end
|
387
469
|
end
|
470
|
+
|
471
|
+
def extract_parameters ()
|
472
|
+
|
473
|
+
r = []
|
474
|
+
raw_representation.children.each do |child|
|
475
|
+
|
476
|
+
next unless child.is_a? ProgExpRepresentation
|
477
|
+
|
478
|
+
name = child.name.intern
|
479
|
+
next unless (name == :parameter or name == :param)
|
480
|
+
|
481
|
+
r << Parameter.new(
|
482
|
+
child.attributes[:field],
|
483
|
+
child.attributes[:match],
|
484
|
+
child.attributes[:default],
|
485
|
+
child.attributes[:type])
|
486
|
+
end
|
487
|
+
r
|
488
|
+
end
|
388
489
|
end
|
389
490
|
|
390
491
|
private
|
@@ -406,15 +507,16 @@ module OpenWFE
|
|
406
507
|
# and turn dashes to underscores.
|
407
508
|
#
|
408
509
|
def OpenWFE.make_safe (method_name)
|
409
|
-
method_name = to_underscore(method_name)
|
510
|
+
method_name = OpenWFE::to_underscore(method_name)
|
410
511
|
return "_" + method_name \
|
411
512
|
if KEYWORDS.include? eval(":"+method_name)
|
412
513
|
return method_name
|
413
514
|
end
|
414
515
|
|
415
516
|
def OpenWFE.to_expression_name (method_name)
|
517
|
+
method_name = method_name.to_s
|
416
518
|
method_name = method_name[1..-1] if method_name[0, 1] == "_"
|
417
|
-
method_name = to_dash(method_name)
|
519
|
+
method_name = OpenWFE::to_dash(method_name)
|
418
520
|
return method_name
|
419
521
|
end
|
420
522
|
|
@@ -66,13 +66,14 @@ module OpenWFE
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def raw_representation
|
69
|
-
|
70
|
-
|
69
|
+
|
70
|
+
unless @raw_representation
|
71
|
+
|
71
72
|
@raw_representation = \
|
72
73
|
REXML::Document.new(@raw_representation_s).root
|
73
74
|
end
|
74
|
-
|
75
|
-
|
75
|
+
|
76
|
+
@raw_representation
|
76
77
|
end
|
77
78
|
|
78
79
|
protected
|
@@ -85,6 +86,23 @@ module OpenWFE
|
|
85
86
|
return result
|
86
87
|
end
|
87
88
|
|
89
|
+
def extract_descriptions ()
|
90
|
+
|
91
|
+
result = []
|
92
|
+
raw_representation.each_child do |child|
|
93
|
+
|
94
|
+
next unless child.is_a?(REXML::Element)
|
95
|
+
next if child.name.intern != :description
|
96
|
+
|
97
|
+
lang = child.attributes["language"]
|
98
|
+
lang = child.attributes["lang"] unless lang
|
99
|
+
lang = "default" unless lang
|
100
|
+
|
101
|
+
result << [ lang, child.children[0] ]
|
102
|
+
end
|
103
|
+
result
|
104
|
+
end
|
105
|
+
|
88
106
|
def extract_children ()
|
89
107
|
|
90
108
|
c = []
|
@@ -94,6 +112,12 @@ module OpenWFE
|
|
94
112
|
|
95
113
|
if elt.kind_of?(REXML::Element)
|
96
114
|
|
115
|
+
ename = elt.name.intern
|
116
|
+
|
117
|
+
next if ename == :param
|
118
|
+
next if ename == :parameter
|
119
|
+
next if ename == :description
|
120
|
+
|
97
121
|
cfei = @fei.dup
|
98
122
|
|
99
123
|
efei = @environment_id
|
@@ -121,11 +145,13 @@ module OpenWFE
|
|
121
145
|
end
|
122
146
|
end
|
123
147
|
|
124
|
-
|
148
|
+
c
|
125
149
|
end
|
126
150
|
|
127
151
|
def extract_text_children ()
|
152
|
+
|
128
153
|
raw_representation.children.collect do |elt|
|
154
|
+
|
129
155
|
next if elt.is_a? REXML::Element
|
130
156
|
next if elt.is_a? REXML::Comment
|
131
157
|
s = elt.to_s.strip
|
@@ -133,6 +159,25 @@ module OpenWFE
|
|
133
159
|
s
|
134
160
|
end
|
135
161
|
end
|
162
|
+
|
163
|
+
def extract_parameters ()
|
164
|
+
|
165
|
+
r = []
|
166
|
+
raw_representation.children.each do |child|
|
167
|
+
|
168
|
+
next unless child.is_a? REXML::Element
|
169
|
+
|
170
|
+
cname = child.name.intern
|
171
|
+
next unless (cname == :param or cname == :parameter)
|
172
|
+
|
173
|
+
r << Parameter.new(
|
174
|
+
child.attributes["field"],
|
175
|
+
child.attributes["match"],
|
176
|
+
child.attributes["default"],
|
177
|
+
child.attributes["type"])
|
178
|
+
end
|
179
|
+
r
|
180
|
+
end
|
136
181
|
end
|
137
182
|
end
|
138
183
|
|
@@ -49,7 +49,6 @@ require 'openwfe/util/scheduler'
|
|
49
49
|
|
50
50
|
module OpenWFE
|
51
51
|
|
52
|
-
|
53
52
|
#
|
54
53
|
# The timeout behaviour is implemented here, making it easy
|
55
54
|
# to mix it in into ParticipantExpression and WhenExpression.
|
@@ -61,6 +60,10 @@ module OpenWFE
|
|
61
60
|
:timeout_at,
|
62
61
|
:timeout_job_id
|
63
62
|
|
63
|
+
#
|
64
|
+
# Looks for the "timeout" attribute in its process definition
|
65
|
+
# and then sets the @timeout_at field (if there is a timeout).
|
66
|
+
#
|
64
67
|
def determine_timeout
|
65
68
|
|
66
69
|
#@timeout_at = nil
|
@@ -73,6 +76,11 @@ module OpenWFE
|
|
73
76
|
@timeout_at = Time.new.to_f + timeout
|
74
77
|
end
|
75
78
|
|
79
|
+
#
|
80
|
+
# Providing a default reschedule() implementation for the expressions
|
81
|
+
# that use this mixin.
|
82
|
+
# This default implementation just reschedules the timeout.
|
83
|
+
#
|
76
84
|
def reschedule (scheduler)
|
77
85
|
to_reschedule(scheduler)
|
78
86
|
end
|
@@ -81,15 +89,24 @@ module OpenWFE
|
|
81
89
|
# Overrides the parent method to make sure a potential
|
82
90
|
# timeout schedules gets removed.
|
83
91
|
#
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
92
|
+
# Well... Leave that to classes that mix this in...
|
93
|
+
# No method override in a mixin...
|
94
|
+
#
|
95
|
+
#def reply_to_parent (workitem)
|
96
|
+
# unschedule_timeout()
|
97
|
+
# super(workitem)
|
98
|
+
#end
|
88
99
|
|
100
|
+
#
|
101
|
+
# Places a "__timed_out__" field in the workitem.
|
102
|
+
#
|
89
103
|
def set_timedout_flag (workitem)
|
90
104
|
workitem.attributes["__timed_out__"] = "true"
|
91
105
|
end
|
92
106
|
|
107
|
+
#
|
108
|
+
# Removes any "__timed_out__" field in the workitem.
|
109
|
+
#
|
93
110
|
def remove_timedout_flag (workitem)
|
94
111
|
workitem.attributes.delete("__timed_out__")
|
95
112
|
end
|
@@ -122,8 +139,18 @@ module OpenWFE
|
|
122
139
|
# done in the including expression
|
123
140
|
end
|
124
141
|
|
142
|
+
#
|
143
|
+
# Unschedules the timeout
|
144
|
+
#
|
125
145
|
def unschedule_timeout ()
|
126
146
|
|
147
|
+
ldebug do
|
148
|
+
"unschedule_timeout() " +
|
149
|
+
"@timeout_job_id is #{@timeout_job_id}"
|
150
|
+
end
|
151
|
+
|
152
|
+
#ldebug_callstack "unschedule_timeout()"
|
153
|
+
|
127
154
|
get_scheduler.unschedule(@timeout_job_id) \
|
128
155
|
if @timeout_job_id
|
129
156
|
end
|
@@ -125,6 +125,10 @@ module OpenWFE
|
|
125
125
|
"(fei #{@workflow_definition_name} #{@workflow_definition_revision} #{@workflow_instance_id} #{@expression_id} #{@expression_name})"
|
126
126
|
end
|
127
127
|
|
128
|
+
def to_short_s
|
129
|
+
"(fei #{@workflow_instance_id} #{@expression_id} #{@expression_name})"
|
130
|
+
end
|
131
|
+
|
128
132
|
#
|
129
133
|
# Returns the workflow instance id without any subflow indices.
|
130
134
|
# For example, if the wfid is "1234.0.1", this method will
|
@@ -148,9 +152,7 @@ module OpenWFE
|
|
148
152
|
|
149
153
|
ss = string.split(" ")
|
150
154
|
|
151
|
-
#require 'pp'
|
152
|
-
#puts
|
153
|
-
#pp ss
|
155
|
+
#require 'pp'; puts; pp ss
|
154
156
|
|
155
157
|
ss = ss[1..-1] if ss[0] == "("
|
156
158
|
|
@@ -170,7 +172,7 @@ module OpenWFE
|
|
170
172
|
fei.expression_id = fei.expression_id[0..-2] \
|
171
173
|
if fei.expression_id[-1, 1] == ")"
|
172
174
|
|
173
|
-
|
175
|
+
fei
|
174
176
|
end
|
175
177
|
end
|
176
178
|
|
@@ -77,9 +77,10 @@ module OpenWFE
|
|
77
77
|
def initialize (service_name, application_context)
|
78
78
|
super
|
79
79
|
|
80
|
-
|
81
|
-
|
82
|
-
|
80
|
+
#@workdir = application_context[:work_directory]
|
81
|
+
#@workdir = OpenWFE::DEFAULT_WORK_DIRECTORY unless @workdir
|
82
|
+
#@workdir += "/in/"
|
83
|
+
@workdir = OpenWFE::get_work_directory + "/in/"
|
83
84
|
|
84
85
|
linfo { "new() workdir is '#{@workdir}'" }
|
85
86
|
end
|