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
@@ -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
|
@@ -59,6 +59,10 @@ module OpenWFE
|
|
59
59
|
return wiTarget unless wiSource
|
60
60
|
|
61
61
|
return wiSource if override
|
62
|
+
|
63
|
+
#puts "merge()"
|
64
|
+
#puts "merge() source : " + wiSource.attributes.inspect
|
65
|
+
#puts "merge() target : " + wiTarget.attributes.inspect
|
62
66
|
|
63
67
|
wiSource.attributes.each do |k, v|
|
64
68
|
|
@@ -69,6 +73,8 @@ module OpenWFE
|
|
69
73
|
|
70
74
|
wiTarget.attributes[nk] = nv
|
71
75
|
end
|
76
|
+
|
77
|
+
#puts "merge() target after : " + wiTarget.attributes.inspect
|
72
78
|
|
73
79
|
wiTarget
|
74
80
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
#--
|
3
|
-
# Copyright (c) 2006-
|
3
|
+
# Copyright (c) 2006-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
|
@@ -45,32 +45,50 @@ require 'openwfe/rudefinitions'
|
|
45
45
|
module OpenWFE
|
46
46
|
|
47
47
|
#
|
48
|
-
#
|
48
|
+
# A class storing bits (trees) of process definitions just
|
49
49
|
# parsed. Upon application (apply()) these raw expressions get turned
|
50
50
|
# into real expressions.
|
51
|
-
# The first and classical extension of this class is XmlRawExpression.
|
52
51
|
#
|
53
52
|
class RawExpression < FlowExpression
|
54
53
|
|
55
|
-
def initialize (
|
56
|
-
fei, parent_id, env_id, application_context, raw_representation)
|
57
54
|
|
58
|
-
|
55
|
+
def self.new_raw (
|
56
|
+
fei, parent_id, env_id, app_context, raw_representation)
|
59
57
|
|
60
|
-
|
58
|
+
re = self.new
|
61
59
|
|
62
|
-
|
60
|
+
re.fei = fei
|
61
|
+
re.parent_id = parent_id
|
62
|
+
re.environment_id = env_id
|
63
|
+
re.application_context = app_context
|
64
|
+
re.attributes = nil
|
65
|
+
re.children = []
|
66
|
+
re.apply_time = nil
|
63
67
|
|
64
|
-
|
65
|
-
|
66
|
-
# now done in the launch methods of the expression pool
|
68
|
+
re.raw_representation = raw_representation
|
69
|
+
re
|
67
70
|
end
|
68
71
|
|
72
|
+
#--
|
73
|
+
# a duplication method that duplicates everything, except
|
74
|
+
# the application context
|
75
|
+
#
|
76
|
+
#def dup
|
77
|
+
# self.class.new_raw(
|
78
|
+
# @fei.dup,
|
79
|
+
# @parent_id ? @parent_id.dup : nil,
|
80
|
+
# @environment_id ? @environment_id.dup : nil,
|
81
|
+
# @application_context,
|
82
|
+
# raw_representation)
|
83
|
+
#end
|
84
|
+
#alias :fulldup :dup
|
85
|
+
#++
|
86
|
+
|
69
87
|
def instantiate_real_expression (
|
70
88
|
workitem, exp_name=nil, exp_class=nil, attributes=nil)
|
71
89
|
|
72
|
-
exp_name
|
73
|
-
exp_class
|
90
|
+
exp_name ||= expression_name
|
91
|
+
exp_class ||= expression_class
|
74
92
|
|
75
93
|
raise "unknown expression '#{exp_name}'" \
|
76
94
|
unless exp_class
|
@@ -79,22 +97,27 @@ module OpenWFE
|
|
79
97
|
# "instantiate_real_expression() exp_class is #{exp_class}"
|
80
98
|
#end
|
81
99
|
|
82
|
-
attributes
|
100
|
+
attributes ||= raw_representation[1]
|
83
101
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
102
|
+
exp = exp_class.new
|
103
|
+
exp.fei = @fei
|
104
|
+
exp.parent_id = @parent_id
|
105
|
+
exp.environment_id = @environment_id
|
106
|
+
exp.application_context = @application_context
|
107
|
+
exp.attributes = attributes
|
90
108
|
|
91
|
-
|
109
|
+
exp.raw_representation = raw_representation
|
110
|
+
#
|
111
|
+
# keeping track of how the expression look at apply /
|
112
|
+
# instantiation time
|
113
|
+
|
114
|
+
consider_tag workitem, exp
|
92
115
|
|
93
|
-
handle_descriptions
|
116
|
+
handle_descriptions
|
94
117
|
|
95
|
-
|
118
|
+
exp.children = extract_children
|
96
119
|
|
97
|
-
|
120
|
+
exp
|
98
121
|
end
|
99
122
|
|
100
123
|
#
|
@@ -127,24 +150,30 @@ module OpenWFE
|
|
127
150
|
end
|
128
151
|
end
|
129
152
|
|
153
|
+
#--
|
130
154
|
#def reply (workitem)
|
131
155
|
# no implementation necessary
|
132
156
|
#end
|
157
|
+
#++
|
158
|
+
|
159
|
+
def is_definition?
|
133
160
|
|
134
|
-
def is_definition? ()
|
135
161
|
get_expression_map.is_definition?(expression_name())
|
136
162
|
end
|
137
163
|
|
138
|
-
def expression_class
|
164
|
+
def expression_class
|
165
|
+
|
139
166
|
get_expression_map.get_class(expression_name())
|
140
167
|
end
|
141
168
|
|
142
|
-
def definition_name
|
143
|
-
|
169
|
+
def definition_name
|
170
|
+
|
171
|
+
raw_representation[1]['name'].to_s
|
144
172
|
end
|
145
173
|
|
146
|
-
def expression_name
|
147
|
-
|
174
|
+
def expression_name
|
175
|
+
|
176
|
+
raw_representation.first
|
148
177
|
end
|
149
178
|
|
150
179
|
#
|
@@ -153,7 +182,18 @@ module OpenWFE
|
|
153
182
|
# Currently only used by FilterDefinitionExpression.
|
154
183
|
#
|
155
184
|
def load_attributes
|
156
|
-
|
185
|
+
|
186
|
+
@attributes = raw_representation[1]
|
187
|
+
end
|
188
|
+
|
189
|
+
#
|
190
|
+
# This method has been made public in order to have quick look
|
191
|
+
# at the attributes of an expression before it's really
|
192
|
+
# 'instantiated'.
|
193
|
+
#
|
194
|
+
def extract_attributes
|
195
|
+
|
196
|
+
raw_representation[1]
|
157
197
|
end
|
158
198
|
|
159
199
|
protected
|
@@ -172,35 +212,38 @@ module OpenWFE
|
|
172
212
|
p = get_participant_map.lookup_participant(name)
|
173
213
|
end
|
174
214
|
|
175
|
-
if p
|
176
|
-
|
177
|
-
|
178
|
-
nil
|
179
|
-
end
|
215
|
+
return name if p
|
216
|
+
|
217
|
+
nil
|
180
218
|
end
|
181
219
|
|
182
220
|
#
|
183
221
|
# Determines if this raw expression points to a classical
|
184
222
|
# expression, a participant or a subprocess, or nothing at all...
|
185
223
|
#
|
186
|
-
def determine_real_expression
|
224
|
+
def determine_real_expression
|
187
225
|
|
188
226
|
exp_name = expression_name()
|
189
|
-
|
190
227
|
exp_class = expression_class()
|
191
|
-
|
228
|
+
var_value = lookup_variable exp_name
|
229
|
+
attributes = extract_attributes
|
192
230
|
|
193
|
-
var_value
|
194
|
-
|
195
|
-
|
231
|
+
unless var_value
|
232
|
+
#
|
233
|
+
# accomodating "sub_process_name" and "sub-process-name"
|
234
|
+
#
|
235
|
+
alt = OpenWFE::to_underscore exp_name
|
236
|
+
var_value = lookup_variable(alt) if alt != exp_name
|
196
237
|
|
197
|
-
|
198
|
-
attributes = extract_attributes()
|
238
|
+
exp_name = alt if var_value
|
199
239
|
end
|
200
240
|
|
241
|
+
var_value = exp_name \
|
242
|
+
if (not exp_class and not var_value)
|
243
|
+
|
201
244
|
if var_value.is_a?(String)
|
202
245
|
|
203
|
-
participant_name = lookup_participant
|
246
|
+
participant_name = lookup_participant var_value
|
204
247
|
|
205
248
|
if participant_name
|
206
249
|
exp_name = participant_name
|
@@ -245,23 +288,93 @@ module OpenWFE
|
|
245
288
|
unless default
|
246
289
|
end
|
247
290
|
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
291
|
+
def extract_descriptions
|
292
|
+
|
293
|
+
result = []
|
294
|
+
raw_representation.last.each do |child|
|
295
|
+
|
296
|
+
#next unless child.is_a?(SimpleExpRepresentation)
|
297
|
+
next if is_not_a_node?(child)
|
298
|
+
next if child.first.intern != :description
|
299
|
+
|
300
|
+
attributes = child[1]
|
301
|
+
|
302
|
+
lang = attributes[:language]
|
303
|
+
lang = attributes[:lang] unless lang
|
304
|
+
lang = "default" unless lang
|
305
|
+
|
306
|
+
result << [ lang, child.last.first ]
|
307
|
+
end
|
308
|
+
result
|
309
|
+
end
|
310
|
+
|
311
|
+
def extract_children
|
312
|
+
|
313
|
+
i = 0
|
314
|
+
result = []
|
315
|
+
raw_representation.last.each do |child|
|
316
|
+
|
317
|
+
#if child.kind_of?(SimpleExpRepresentation)
|
318
|
+
#if child.kind_of?(Array)
|
319
|
+
if is_not_a_node?(child)
|
320
|
+
|
321
|
+
result << child
|
322
|
+
else
|
323
|
+
|
324
|
+
cname = child.first.intern
|
325
|
+
|
326
|
+
next if cname == :param
|
327
|
+
next if cname == :parameter
|
328
|
+
next if cname == :description
|
329
|
+
|
330
|
+
cfei = @fei.dup
|
331
|
+
cfei.expression_name = child.first
|
332
|
+
cfei.expression_id = "#{cfei.expression_id}.#{i}"
|
333
|
+
|
334
|
+
efei = @environment_id
|
335
|
+
|
336
|
+
rawexp = RawExpression.new_raw(
|
337
|
+
cfei, @fei, efei, @application_context, child)
|
338
|
+
|
339
|
+
get_expression_pool.update rawexp
|
340
|
+
|
341
|
+
i = i + 1
|
342
|
+
|
343
|
+
result << rawexp.fei
|
344
|
+
end
|
345
|
+
end
|
346
|
+
result
|
347
|
+
end
|
348
|
+
|
349
|
+
def extract_parameters
|
350
|
+
|
351
|
+
r = []
|
352
|
+
raw_representation.last.each do |child|
|
353
|
+
|
354
|
+
#next unless child.is_a?(SimpleExpRepresentation)
|
355
|
+
#next unless child.is_a?(Array)
|
356
|
+
next if is_not_a_node?(child)
|
357
|
+
|
358
|
+
name = child.first.to_sym
|
359
|
+
next unless (name == :parameter or name == :param)
|
360
|
+
|
361
|
+
attributes = child[1]
|
362
|
+
|
363
|
+
r << Parameter.new(
|
364
|
+
attributes['field'],
|
365
|
+
attributes['match'],
|
366
|
+
attributes['default'],
|
367
|
+
attributes['type'])
|
368
|
+
end
|
369
|
+
r
|
370
|
+
end
|
371
|
+
|
372
|
+
def is_not_a_node? (child)
|
373
|
+
|
374
|
+
(( ! child.is_a?(Array)) ||
|
375
|
+
child.size != 3 ||
|
376
|
+
( ! child.first.is_a?(String)))
|
377
|
+
end
|
265
378
|
|
266
379
|
#
|
267
380
|
# Expressions can get tagged. Tagged expressions can easily
|
@@ -275,7 +388,7 @@ module OpenWFE
|
|
275
388
|
|
276
389
|
ldebug { "consider_tag() tag is '#{tagname}'" }
|
277
390
|
|
278
|
-
set_variable
|
391
|
+
set_variable tagname, Tag.new(self, workitem)
|
279
392
|
#
|
280
393
|
# keep copy of raw expression and workitem as applied
|
281
394
|
|
@@ -310,6 +423,9 @@ module OpenWFE
|
|
310
423
|
# Encapsulating
|
311
424
|
# <parameter field="x" default="y" type="z" match="m" />
|
312
425
|
#
|
426
|
+
# Somehow I have that : OpenWFEru is not a strongly typed language
|
427
|
+
# ... Anyway I implemented that to please Pat.
|
428
|
+
#
|
313
429
|
class Parameter
|
314
430
|
|
315
431
|
def initialize (field, match, default, type)
|
@@ -391,5 +507,87 @@ module OpenWFE
|
|
391
507
|
end
|
392
508
|
end
|
393
509
|
|
510
|
+
#
|
511
|
+
# This class is only present to ensure that OpenWFEru 0.9.17 can read
|
512
|
+
# previous (<= 0.9.16) expools.
|
513
|
+
#
|
514
|
+
class ProgRawExpression < RawExpression
|
515
|
+
|
516
|
+
def raw_representation
|
517
|
+
|
518
|
+
@raw_representation.to_a
|
519
|
+
end
|
520
|
+
end
|
521
|
+
|
522
|
+
#
|
523
|
+
# This class is only present to ensure that OpenWFEru 0.9.17 can read
|
524
|
+
# previous (<= 0.9.16) expools.
|
525
|
+
#
|
526
|
+
class XmlRawExpression < RawExpression
|
527
|
+
|
528
|
+
def raw_representation
|
529
|
+
|
530
|
+
#SimpleExpRepresentation.from_xml @raw_representation_s
|
531
|
+
DefParser.parse_xml @raw_representation_s
|
532
|
+
end
|
533
|
+
end
|
534
|
+
|
535
|
+
#
|
536
|
+
# This class is only present to ensure that OpenWFEru 0.9.17 can read
|
537
|
+
# previous (<= 0.9.16) expools.
|
538
|
+
#
|
539
|
+
class SimpleExpRepresentation
|
540
|
+
|
541
|
+
def to_a
|
542
|
+
|
543
|
+
children = @children.collect do |c|
|
544
|
+
if c.is_a?(SimpleExpRepresentation)
|
545
|
+
c.to_a
|
546
|
+
else
|
547
|
+
c
|
548
|
+
end
|
549
|
+
end
|
550
|
+
|
551
|
+
a = [ @name, @attributes, children ]
|
552
|
+
end
|
553
|
+
end
|
554
|
+
|
555
|
+
private
|
556
|
+
|
557
|
+
#
|
558
|
+
# OpenWFE process definitions do use some
|
559
|
+
# Ruby keywords... The workaround is to put an underscore
|
560
|
+
# just before the name to 'escape' it.
|
561
|
+
#
|
562
|
+
# 'undo' isn't reserved by Ruby, but lets keep it in line
|
563
|
+
# with 'do' and 'redo' that are.
|
564
|
+
#
|
565
|
+
KEYWORDS = [
|
566
|
+
:if, :do, :redo, :undo, :print, :sleep, :loop, :break, :when
|
567
|
+
#:until, :while
|
568
|
+
]
|
569
|
+
|
570
|
+
#
|
571
|
+
# Ensures the method name is not conflicting with Ruby keywords
|
572
|
+
# and turn dashes to underscores.
|
573
|
+
#
|
574
|
+
def OpenWFE.make_safe (method_name)
|
575
|
+
|
576
|
+
method_name = OpenWFE::to_underscore(method_name)
|
577
|
+
|
578
|
+
return "_" + method_name \
|
579
|
+
if KEYWORDS.include? eval(":"+method_name)
|
580
|
+
|
581
|
+
method_name
|
582
|
+
end
|
583
|
+
|
584
|
+
def OpenWFE.to_expression_name (method_name)
|
585
|
+
|
586
|
+
method_name = method_name.to_s
|
587
|
+
method_name = method_name[1..-1] if method_name[0, 1] == "_"
|
588
|
+
method_name = OpenWFE::to_dash(method_name)
|
589
|
+
method_name
|
590
|
+
end
|
591
|
+
|
394
592
|
end
|
395
593
|
|