openwferu 0.9.16 → 0.9.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (184) hide show
  1. data/examples/about_state.rb +81 -0
  2. data/examples/engine_template.rb +7 -0
  3. data/lib/openwfe/contextual.rb +2 -2
  4. data/lib/openwfe/def.rb +2 -3
  5. data/lib/openwfe/{util/schedulers.rb → engine.rb} +3 -39
  6. data/lib/openwfe/engine/engine.rb +202 -251
  7. data/lib/openwfe/engine/process_status.rb +359 -0
  8. data/lib/openwfe/expool/errorjournal.rb +6 -6
  9. data/lib/openwfe/expool/expressionpool.rb +161 -239
  10. data/lib/openwfe/expool/expstorage.rb +185 -55
  11. data/lib/openwfe/expool/journal.rb +1 -2
  12. data/lib/openwfe/expool/parser.rb +233 -0
  13. data/lib/openwfe/expool/threadedexpstorage.rb +6 -18
  14. data/lib/openwfe/expool/wfidgen.rb +25 -7
  15. data/lib/openwfe/expool/yamlexpstorage.rb +60 -37
  16. data/lib/openwfe/expressions/condition.rb +49 -12
  17. data/lib/openwfe/expressions/environment.rb +45 -15
  18. data/lib/openwfe/expressions/expressionmap.rb +39 -19
  19. data/lib/openwfe/expressions/fe_concurrence.rb +24 -13
  20. data/lib/openwfe/expressions/fe_cron.rb +19 -18
  21. data/lib/openwfe/expressions/fe_cursor.rb +69 -28
  22. data/lib/openwfe/expressions/fe_define.rb +4 -1
  23. data/lib/openwfe/expressions/fe_do.rb +1 -3
  24. data/lib/openwfe/expressions/fe_equals.rb +131 -20
  25. data/lib/openwfe/expressions/fe_fqv.rb +27 -3
  26. data/lib/openwfe/expressions/fe_iterator.rb +14 -7
  27. data/lib/openwfe/expressions/fe_listen.rb +7 -2
  28. data/lib/openwfe/expressions/fe_misc.rb +187 -20
  29. data/lib/openwfe/expressions/fe_participant.rb +8 -7
  30. data/lib/openwfe/expressions/fe_reserve.rb +105 -33
  31. data/lib/openwfe/expressions/fe_save.rb +55 -5
  32. data/lib/openwfe/expressions/{fe_value.rb → fe_set.rb} +6 -82
  33. data/lib/openwfe/expressions/fe_sleep.rb +25 -15
  34. data/lib/openwfe/expressions/fe_subprocess.rb +2 -2
  35. data/lib/openwfe/expressions/fe_wait.rb +3 -2
  36. data/lib/openwfe/expressions/fe_when.rb +7 -15
  37. data/lib/openwfe/expressions/flowexpression.rb +90 -49
  38. data/lib/openwfe/expressions/merge.rb +7 -1
  39. data/lib/openwfe/expressions/raw.rb +261 -63
  40. data/lib/openwfe/expressions/{raw_prog.rb → rprocdef.rb} +94 -179
  41. data/lib/openwfe/expressions/time.rb +36 -12
  42. data/lib/openwfe/expressions/timeout.rb +9 -7
  43. data/lib/openwfe/expressions/value.rb +126 -0
  44. data/lib/openwfe/flowexpressionid.rb +52 -22
  45. data/lib/openwfe/listeners/listeners.rb +3 -3
  46. data/lib/openwfe/listeners/socketlisteners.rb +8 -5
  47. data/lib/openwfe/logging.rb +6 -3
  48. data/lib/openwfe/omixins.rb +8 -6
  49. data/lib/openwfe/orest/xmlcodec.rb +16 -12
  50. data/lib/openwfe/participants.rb +38 -0
  51. data/lib/openwfe/participants/participant.rb +1 -1
  52. data/lib/openwfe/participants/participantmap.rb +24 -10
  53. data/lib/openwfe/participants/participants.rb +4 -3
  54. data/lib/openwfe/participants/soapparticipants.rb +1 -1
  55. data/lib/openwfe/participants/socketparticipants.rb +1 -1
  56. data/lib/openwfe/rudefinitions.rb +7 -5
  57. data/lib/openwfe/storage/yamlcustom.rb +10 -10
  58. data/lib/openwfe/storage/yamlfilestorage.rb +12 -12
  59. data/lib/openwfe/tools/flowtracer.rb +6 -5
  60. data/lib/openwfe/util/dollar.rb +42 -85
  61. data/lib/openwfe/util/ometa.rb +1 -3
  62. data/lib/openwfe/util/workqueue.rb +1 -1
  63. data/lib/openwfe/utils.rb +33 -11
  64. data/lib/openwfe/version.rb +2 -2
  65. data/lib/openwfe/workitem.rb +76 -14
  66. data/lib/openwfe/worklist/storelocks.rb +9 -4
  67. data/lib/openwfe/worklist/storeparticipant.rb +1 -1
  68. data/test/back_0916_test.rb +101 -0
  69. data/test/bm/ft_26_load.rb +1 -1
  70. data/test/bm/ft_26b_load.rb +1 -1
  71. data/test/bm/ft_26c_load.rb +3 -2
  72. data/test/bm/ft_26d_load.rb +97 -0
  73. data/test/bm/ft_recu.rb +71 -0
  74. data/test/concurrence_test.rb +1 -1
  75. data/test/condition_test.rb +152 -0
  76. data/test/description_test.rb +12 -7
  77. data/test/eno_test.rb +1 -1
  78. data/test/expool_20031219_0916.tgz +0 -0
  79. data/test/fe_lookup_att_test.rb +1 -1
  80. data/test/fei_test.rb +16 -0
  81. data/test/file_persistence_test.rb +8 -12
  82. data/test/filep_cancel_test.rb +116 -0
  83. data/test/flowtestbase.rb +47 -25
  84. data/test/ft_0.rb +1 -1
  85. data/test/ft_10_loop.rb +29 -14
  86. data/test/{ft_10b_loop2.rb → ft_10b_loop.rb} +2 -11
  87. data/test/ft_11_ppd.rb +6 -17
  88. data/test/ft_11b_ppd.rb +1 -4
  89. data/test/ft_12_blockparticipant.rb +1 -1
  90. data/test/ft_13_eno.rb +1 -1
  91. data/test/ft_15_iterator.rb +1 -1
  92. data/test/ft_15b_iterator.rb +1 -1
  93. data/test/ft_17_condition.rb +6 -6
  94. data/test/ft_18_pname.rb +1 -1
  95. data/test/ft_20_cron.rb +1 -1
  96. data/test/ft_21_cron.rb +6 -4
  97. data/test/ft_22_history.rb +1 -1
  98. data/test/ft_23_when.rb +1 -1
  99. data/test/ft_23b_when.rb +18 -6
  100. data/test/ft_23c_wait.rb +8 -6
  101. data/test/ft_25_cancel.rb +7 -5
  102. data/test/ft_27_getflowpos.rb +22 -17
  103. data/test/ft_28_fileparticipant.rb +1 -2
  104. data/test/ft_2_concurrence.rb +1 -1
  105. data/test/ft_2b_concurrence.rb +25 -20
  106. data/test/ft_30_socketlistener.rb +0 -3
  107. data/test/ft_34_cancelwfid.rb +9 -9
  108. data/test/ft_35_localdefs.rb +0 -1
  109. data/test/ft_36_subprocids.rb +6 -6
  110. data/test/ft_38_tag.rb +3 -2
  111. data/test/ft_38b_tag.rb +229 -0
  112. data/test/ft_39_reserve.rb +3 -18
  113. data/test/ft_39b_reserve.rb +34 -5
  114. data/test/ft_3b_lookup_vf.rb +83 -0
  115. data/test/ft_40_defined.rb +2 -11
  116. data/test/ft_42_environments.rb +4 -6
  117. data/test/ft_44b_restore.rb +88 -22
  118. data/test/ft_45_citerator.rb +57 -11
  119. data/test/ft_49_condition.rb +4 -2
  120. data/test/ft_4_misc.rb +24 -3
  121. data/test/ft_50_xml_attribute.rb +17 -20
  122. data/test/ft_54_listen.rb +1 -1
  123. data/test/ft_54b_listen.rb +2 -2
  124. data/test/ft_56_timeout.rb +8 -1
  125. data/test/ft_57_a.rb +10 -10
  126. data/test/ft_59_ps.rb +49 -16
  127. data/test/ft_60_ecancel.rb +52 -10
  128. data/test/ft_63_pause.rb +8 -8
  129. data/test/ft_65_stringlaunch.rb +4 -6
  130. data/test/ft_67_schedlaunch.rb +4 -4
  131. data/test/ft_69_cancelmissing.rb +4 -2
  132. data/test/ft_70_lookupvar.rb +2 -2
  133. data/test/ft_72_lookup_processes.rb +2 -2
  134. data/test/ft_73_cancel_sub.rb +8 -8
  135. data/test/ft_77_segments.rb +38 -0
  136. data/test/ft_78_eval.rb +154 -0
  137. data/test/ft_79_tticket.rb +185 -0
  138. data/test/ft_80_spname.rb +95 -0
  139. data/test/ft_81_exp.rb +64 -0
  140. data/test/ft_82_trecu.rb +48 -0
  141. data/test/ft_83_badpause.rb +62 -0
  142. data/test/ft_84_updateexp.rb +125 -0
  143. data/test/ft_9b_cursor.rb +105 -0
  144. data/test/ft_tests.rb +14 -1
  145. data/test/hash_test.rb +7 -7
  146. data/test/hparticipant_test.rb +4 -4
  147. data/test/lookup_vf_test.rb +94 -0
  148. data/test/misc_test.rb +5 -3
  149. data/test/orest_test.rb +4 -3
  150. data/test/param_test.rb +12 -16
  151. data/test/participant_test.rb +36 -0
  152. data/test/pending.rb +10 -10
  153. data/test/rake_ltest.rb +1 -10
  154. data/test/rake_qtest.rb +7 -6
  155. data/test/raw_prog_test.rb +89 -121
  156. data/test/restart_cron_test.rb +84 -36
  157. data/test/restart_paused_test.rb +100 -0
  158. data/test/restart_sleep_test.rb +1 -1
  159. data/test/restart_tests.rb +1 -0
  160. data/test/restart_when_test.rb +33 -22
  161. data/test/ruby_procdef_test.rb +19 -18
  162. data/test/sec_test.rb +74 -35
  163. data/test/storage_test.rb +44 -0
  164. data/test/test.rb +3 -0
  165. data/test/timeout_test.rb +7 -18
  166. data/test/wfid_test.rb +2 -1
  167. data/test/wi_test.rb +29 -18
  168. metadata +121 -57
  169. data/lib/openwfe/expressions/raw_xml.rb +0 -176
  170. data/lib/openwfe/expressions/simplerep.rb +0 -266
  171. data/lib/openwfe/util/kotoba.rb +0 -236
  172. data/lib/openwfe/util/lru.rb +0 -171
  173. data/lib/openwfe/util/otime.rb +0 -246
  174. data/lib/openwfe/util/safe.rb +0 -160
  175. data/lib/openwfe/util/scheduler.rb +0 -1158
  176. data/test/cron_test.rb +0 -113
  177. data/test/cronline_test.rb +0 -60
  178. data/test/dollar_test.rb +0 -90
  179. data/test/kotoba_test.rb +0 -72
  180. data/test/lru_test.rb +0 -79
  181. data/test/safely_test.rb +0 -84
  182. data/test/scheduler_1_test.rb +0 -88
  183. data/test/scheduler_test.rb +0 -363
  184. data/test/time_test.rb +0 -84
@@ -1,6 +1,6 @@
1
1
  #
2
2
  #--
3
- # Copyright (c) 2006-2007, John Mettraux, OpenWFE.org
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
@@ -37,15 +37,10 @@
37
37
  # John Mettraux at openwfe.org
38
38
  #
39
39
 
40
- require 'openwfe/util/otime'
41
- require 'openwfe/util/scheduler'
40
+ require 'rufus/otime'
42
41
  require 'openwfe/expressions/time'
43
42
 
44
43
 
45
- #
46
- # just the 'sleep' expression
47
- #
48
-
49
44
  module OpenWFE
50
45
 
51
46
  #
@@ -60,12 +55,26 @@ module OpenWFE
60
55
  # will wait for 10 minutes and 12 seconds before sending a workitem
61
56
  # to participant 'alpha'.
62
57
  #
58
+ # In a Ruby process definition, that might look like :
59
+ #
60
+ # sleep :for => "3m"
61
+ # sleep "3m"
62
+ # #
63
+ # # both meaning 'sleep for 3 minutes'
64
+ #
65
+ # sleep :until => "Mon Dec 03 10:41:58 +0900 2007"
66
+ # #
67
+ # # sleep until the given point in time
68
+ #
69
+ # If the 'until' attribute points to a time in the past, the sleep
70
+ # expression will simply let the process resume.
71
+ #
72
+ #
63
73
  class SleepExpression < TimeExpression
64
74
 
65
75
  names :sleep
66
76
 
67
- attr_accessor \
68
- :awakening_time
77
+ attr_accessor :awakening_time
69
78
 
70
79
  def apply (workitem)
71
80
 
@@ -81,19 +90,20 @@ module OpenWFE
81
90
  tuntil = nil
82
91
 
83
92
  if suntil
93
+
84
94
  tuntil = suntil
95
+
85
96
  elsif sfor
86
- tfor = OpenWFE::parse_time_string(sfor)
97
+
98
+ tfor = Rufus::parse_time_string(sfor)
87
99
  #ldebug { "apply() tfor is '#{tfor}'" }
88
100
  tuntil = Time.new.to_f + tfor
89
101
  end
90
102
 
91
103
  #ldebug { "apply() tuntil is '#{tuntil}'" }
92
104
 
93
- if not tuntil
94
- reply_to_parent(workitem)
95
- return
96
- end
105
+ return reply_to_parent(workitem) \
106
+ if not tuntil
97
107
 
98
108
  @awakening_time = tuntil
99
109
  @applied_workitem = workitem.dup
@@ -131,7 +141,7 @@ module OpenWFE
131
141
  ldebug do
132
142
  "[re]schedule() " +
133
143
  "will sleep until '#{@awakening_time}' " +
134
- "(#{OpenWFE::to_iso8601_date(@awakening_time)})"
144
+ "(#{Rufus::to_iso8601_date(@awakening_time)})"
135
145
  end
136
146
 
137
147
  @scheduler_job_id = "sleep_#{self.fei.to_s}"
@@ -1,6 +1,6 @@
1
1
  #
2
2
  #--
3
- # Copyright (c) 2006-2007, John Mettraux, OpenWFE.org
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
@@ -140,7 +140,7 @@ module OpenWFE
140
140
  #puts " ... values are #{params.values.join(', ')}"
141
141
 
142
142
  sub_fei = get_expression_pool.launch_template(
143
- requester, get_next_sub_id, template, workitem, params)
143
+ requester, nil, get_next_sub_id, template, workitem, params)
144
144
 
145
145
  if forget
146
146
  reply_to_parent(workitem.dup)
@@ -37,7 +37,8 @@
37
37
  # John Mettraux at openwfe.org
38
38
  #
39
39
 
40
- require 'openwfe/expressions/time'
40
+ #require 'openwfe/expressions/time'
41
+ require 'openwfe/expressions/fe_when'
41
42
 
42
43
 
43
44
  module OpenWFE
@@ -64,7 +65,7 @@ module OpenWFE
64
65
  # expressed directly in Ruby evaluates to true.
65
66
  #
66
67
  # 'wait' is different than 'when' : when it times out (if a timeout is set,
67
- # the block ceases and the flow resumes. On a timeout, 'when' will not
68
+ # the wait ceases and the flow resumes. On a timeout, 'when' will not
68
69
  # execute its nested 'consequence' child.
69
70
  #
70
71
  class WaitExpression < WaitingExpression
@@ -1,6 +1,6 @@
1
1
  #
2
2
  #--
3
- # Copyright (c) 2006-2007, John Mettraux, OpenWFE.org
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
@@ -38,8 +38,6 @@
38
38
  #
39
39
 
40
40
  require 'openwfe/utils'
41
- require 'openwfe/util/otime'
42
- require 'openwfe/util/scheduler'
43
41
  require 'openwfe/expressions/time'
44
42
  require 'openwfe/expressions/timeout'
45
43
  require 'openwfe/expressions/condition'
@@ -102,14 +100,10 @@ module OpenWFE
102
100
  :consequence_triggered,
103
101
  :condition_sub_id
104
102
 
105
- DEFAULT_FREQUENCY = "10s"
106
-
107
103
  def apply (workitem)
108
104
 
109
- if @children.size < 1
110
- reply_to_parent workitem
111
- return
112
- end
105
+ return reply_to_parent(workitem) \
106
+ if @children.size < 1
113
107
 
114
108
  @condition_sub_id = -1
115
109
  @consequence_triggered = false
@@ -123,10 +117,8 @@ module OpenWFE
123
117
  # "reply() @consequence_triggered is '#{@consequence_triggered}'"
124
118
  #end
125
119
 
126
- if @consequence_triggered
127
- reply_to_parent(workitem)
128
- return
129
- end
120
+ return reply_to_parent(workitem) \
121
+ if @consequence_triggered
130
122
 
131
123
  super workitem
132
124
  end
@@ -137,12 +129,12 @@ module OpenWFE
137
129
 
138
130
  @consequence_triggered = true
139
131
 
140
- store_itself()
132
+ store_itself
141
133
 
142
134
  i = 1
143
135
  i = 0 if @children.size == 1
144
136
 
145
- get_expression_pool.apply(@children[i], workitem)
137
+ get_expression_pool.apply @children[i], workitem
146
138
  end
147
139
  end
148
140
 
@@ -1,6 +1,6 @@
1
1
  #
2
2
  #--
3
- # Copyright (c) 2006-2007, John Mettraux, OpenWFE.org
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
@@ -111,32 +111,46 @@ module OpenWFE
111
111
  #
112
112
  attr_accessor :apply_time
113
113
 
114
+ #
115
+ # Used by raw expressions to store the not yet interpreted branches
116
+ # of a process, used by other expressions to store their
117
+ # representation at 'eval time'.
118
+ #
119
+ attr_accessor :raw_representation
120
+
114
121
 
115
- def initialize (fei, parent_id, env_id, app_context, attributes)
122
+ #
123
+ # The classical no-params constructors.
124
+ #
125
+ def initialize
116
126
 
117
- super()
127
+ super
118
128
  #
119
129
  # very necessary as this class includes the MonitorMixin
130
+ end
120
131
 
121
- @fei = fei
122
- @parent_id = parent_id
123
- @environment_id = env_id
124
- @application_context = app_context
125
- @attributes = attributes
132
+ #
133
+ # Builds a new instance of an expression
134
+ #
135
+ def self.new_exp (fei, parent_id, env_id, app_context, attributes)
126
136
 
127
- @children = []
137
+ e = self.new
128
138
 
129
- @apply_time = nil
139
+ e.fei = fei
140
+ e.parent_id = parent_id
141
+ e.environment_id = env_id
142
+ e.application_context = app_context
143
+ e.attributes = attributes
130
144
 
131
- #ldebug do
132
- # "initialize()\n"+
133
- # "self : #{@fei}\n"+
134
- # "parent : #{@parent_id}"
135
- #end
145
+ e.children = []
146
+ e.apply_time = nil
147
+
148
+ e
136
149
  end
137
150
 
138
- #
151
+ #--
139
152
  # the two most important methods for flow expressions
153
+ #++
140
154
 
141
155
  #
142
156
  # this default implementation immediately replies to the
@@ -153,7 +167,7 @@ module OpenWFE
153
167
  #
154
168
  def reply (workitem)
155
169
 
156
- reply_to_parent(workitem)
170
+ reply_to_parent workitem
157
171
  end
158
172
 
159
173
  #
@@ -164,7 +178,7 @@ module OpenWFE
164
178
  #
165
179
  def reply_to_parent (workitem)
166
180
 
167
- get_expression_pool.reply_to_parent(self, workitem)
181
+ get_expression_pool.reply_to_parent self, workitem
168
182
  end
169
183
 
170
184
  #
@@ -182,8 +196,8 @@ module OpenWFE
182
196
 
183
197
  next if child.kind_of?(String)
184
198
 
185
- i = get_expression_pool().cancel(child)
186
- inflowitem = i unless inflowitem
199
+ i = get_expression_pool.cancel child
200
+ inflowitem ||= i
187
201
  end
188
202
 
189
203
  inflowitem
@@ -214,6 +228,7 @@ module OpenWFE
214
228
 
215
229
  ldebug { "store_itself() for #{@fei.to_debug_s}" }
216
230
  #ldebug { "store_itself() \n#{OpenWFE::caller_to_s(0, 6)}" }
231
+
217
232
  get_expression_pool.update self
218
233
  end
219
234
 
@@ -225,13 +240,7 @@ module OpenWFE
225
240
  #
226
241
  def get_environment
227
242
 
228
- #return nil if not @environment_id
229
- #env, fei = get_expression_pool().fetch(@environment_id)
230
- #env
231
-
232
- env = fetch_environment
233
- env = get_expression_pool.fetch_engine_environment unless env
234
- env
243
+ fetch_environment || get_expression_pool.fetch_engine_environment
235
244
  end
236
245
 
237
246
  #
@@ -257,7 +266,7 @@ module OpenWFE
257
266
  # Just fetches the environment for this expression.
258
267
  #
259
268
  def fetch_environment
260
-
269
+
261
270
  get_expression_pool.fetch_expression @environment_id
262
271
  end
263
272
 
@@ -287,7 +296,7 @@ module OpenWFE
287
296
  # " env #{vi.to_debug_s}"
288
297
  #end
289
298
 
290
- ei == vi
299
+ (ei == vi)
291
300
  end
292
301
 
293
302
  #
@@ -295,7 +304,7 @@ module OpenWFE
295
304
  #
296
305
  def paused?
297
306
 
298
- lookup_variable(VAR_PAUSED) == true
307
+ (lookup_variable(VAR_PAUSED) == true)
299
308
  end
300
309
 
301
310
  #
@@ -327,6 +336,9 @@ module OpenWFE
327
336
  #
328
337
  def lookup_variable (varname)
329
338
 
339
+ #puts "lv : #{varname}"
340
+ #puts OpenWFE.caller_to_s(0, 5)
341
+
330
342
  env, var = lookup_environment(varname)
331
343
  env[var]
332
344
  end
@@ -364,6 +376,8 @@ module OpenWFE
364
376
  #
365
377
  def lookup_attribute (attname, workitem, options={})
366
378
 
379
+ #p attname
380
+
367
381
  default = options[:default]
368
382
  escape = options[:escape]
369
383
 
@@ -437,7 +451,7 @@ module OpenWFE
437
451
  attname = OpenWFE::symbol_to_name(attname) \
438
452
  if attname.kind_of?(Symbol)
439
453
 
440
- @attributes[attname] != nil
454
+ (@attributes[attname] != nil)
441
455
  end
442
456
 
443
457
  #
@@ -512,19 +526,27 @@ module OpenWFE
512
526
  parent_fei = nil
513
527
  parent = nil
514
528
 
515
- parent, _fei = get_expression_pool().fetch(@parent_id) \
529
+ parent, _fei = get_expression_pool.fetch(@parent_id) \
516
530
  if @parent_id
517
531
 
518
532
  parent_fei = parent.environment_id if parent
519
533
 
520
- env = Environment.new(
534
+ env = Environment.new_env(
521
535
  @environment_id, parent_fei, nil, @application_context, nil)
522
536
 
523
- env.variables.merge!(initial_vars) if initial_vars
537
+ env.variables.merge! initial_vars if initial_vars
538
+
539
+ env[@fei.wfname] = self.raw_representation \
540
+ if (not @parent_id) and (self.is_a?(RawExpression))
541
+ #
542
+ # keeping track of the raw representation
543
+ # of the top expression (for top recursion)
524
544
 
525
545
  ldebug { "new_environment() is #{env.fei.to_debug_s}" }
526
546
 
527
- env.store_itself()
547
+ env.store_itself
548
+
549
+ env
528
550
  end
529
551
 
530
552
  #
@@ -580,7 +602,7 @@ module OpenWFE
580
602
 
581
603
  #
582
604
  # Used like the classical Ruby synchronize, but as the OpenWFE
583
- # expression pool manages its own set of monitores, it's one of those
605
+ # expression pool manages its own set of monitors, it's one of those
584
606
  # monitors that is used. But the synchronize code looks like the class
585
607
  # just included the MonitorMixin. No hassle.
586
608
  #
@@ -603,12 +625,18 @@ module OpenWFE
603
625
  text = ""
604
626
 
605
627
  children.each do |child|
606
- if child.kind_of?(RawExpression)
628
+
629
+ if child.is_a?(RawExpression)
630
+
607
631
  text << child.fei.to_s
608
- elsif child.kind_of?(FlowExpressionId)
632
+
633
+ elsif child.is_a?(FlowExpressionId)
634
+
609
635
  text << get_expression_pool\
610
636
  .fetch_expression(child).raw_representation.to_s
637
+
611
638
  else
639
+
612
640
  text << child.to_s
613
641
  end
614
642
  end
@@ -627,9 +655,8 @@ module OpenWFE
627
655
  #
628
656
  def lookup_value (workitem, options={})
629
657
 
630
- v = lookup_vf_attribute(workitem, 'value', options)
631
- v = lookup_vf_attribute(workitem, 'val', options) unless v
632
- v
658
+ lookup_vf_attribute(workitem, 'value', options) ||
659
+ lookup_vf_attribute(workitem, 'val', options)
633
660
  end
634
661
 
635
662
  #
@@ -638,7 +665,7 @@ module OpenWFE
638
665
  #
639
666
  def lookup_ref (workitem, prefix='')
640
667
 
641
- ref = lookup_vf_attribute(workitem, 'ref', :prefix => prefix)
668
+ ref = lookup_vf_attribute workitem, 'ref', :prefix => prefix
642
669
  return ref.to_s if ref
643
670
  nil
644
671
  end
@@ -648,23 +675,37 @@ module OpenWFE
648
675
  #
649
676
  def lookup_vf_attribute (workitem, att_name, options={})
650
677
 
678
+ att_name = att_name.to_s
679
+
651
680
  prefix = options[:prefix] || ''
652
- prefix = "#{prefix.to_s}-" if prefix != ''
681
+ prefix = prefix.to_s
682
+
683
+ dash = (att_name.size > 0 and prefix.size > 0) ? "-" : ""
653
684
 
654
685
  v = lookup_attribute(
655
- "#{prefix}#{att_name}", workitem, options)
686
+ "#{prefix}#{dash}#{att_name}", workitem, options)
687
+
688
+ att_name = "-#{att_name}" if att_name.size > 0
689
+ prefix = "#{prefix}-" if prefix.size > 0
656
690
 
657
691
  return v if v
658
692
 
659
693
  v = lookup_attribute(
660
- "#{prefix}variable-#{att_name}", workitem, options)
694
+ "#{prefix}variable#{att_name}", workitem, options) ||
695
+ lookup_attribute(
696
+ "#{prefix}var#{att_name}", workitem, options) ||
697
+ lookup_attribute(
698
+ "#{prefix}v#{att_name}", workitem, options)
661
699
 
662
700
  return lookup_variable(v) if v
663
701
 
664
- v = lookup_attribute(
665
- "#{prefix}field-#{att_name}", workitem, options)
702
+ f = lookup_attribute(
703
+ "#{prefix}field#{att_name}", workitem, options) ||
704
+ lookup_attribute(
705
+ "#{prefix}f#{att_name}", workitem, options)
666
706
 
667
- return workitem.attributes[v] if v
707
+ #return workitem.attributes[f] if f
708
+ return workitem.attributes[f.to_s] if f
668
709
 
669
710
  nil
670
711
  end
@@ -743,7 +784,7 @@ module OpenWFE
743
784
  ]
744
785
  end
745
786
 
746
- [ get_environment, varname]
787
+ [ get_environment, varname ]
747
788
  end
748
789
 
749
790
  #