openwferu 0.9.6 → 0.9.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. data/bin/validate-workflow.rb +1 -0
  2. data/examples/openwferu.rb +57 -0
  3. data/lib/openwfe/contextual.rb +2 -0
  4. data/lib/openwfe/engine/engine.rb +109 -17
  5. data/lib/openwfe/engine/file_persisted_engine.rb +11 -1
  6. data/lib/openwfe/exceptions.rb +53 -0
  7. data/lib/openwfe/expool/expressionpool.rb +195 -137
  8. data/lib/openwfe/expool/journal.rb +175 -0
  9. data/lib/openwfe/expool/journal_replay.rb +121 -0
  10. data/lib/openwfe/expool/wfidgen.rb +318 -0
  11. data/lib/openwfe/expool/yamlexpstorage.rb +23 -54
  12. data/lib/openwfe/expressions/condition.rb +14 -2
  13. data/lib/openwfe/expressions/environment.rb +47 -37
  14. data/lib/openwfe/expressions/expressionmap.rb +73 -67
  15. data/lib/openwfe/expressions/fe_cancel.rb +2 -0
  16. data/lib/openwfe/expressions/fe_concurrence.rb +14 -1
  17. data/lib/openwfe/expressions/fe_cron.rb +186 -0
  18. data/lib/openwfe/expressions/fe_cursor.rb +6 -0
  19. data/lib/openwfe/expressions/fe_define.rb +2 -0
  20. data/lib/openwfe/expressions/fe_fqv.rb +2 -0
  21. data/lib/openwfe/expressions/fe_iterator.rb +2 -0
  22. data/lib/openwfe/expressions/fe_losfor.rb +4 -0
  23. data/lib/openwfe/expressions/fe_misc.rb +16 -1
  24. data/lib/openwfe/expressions/fe_participant.rb +7 -0
  25. data/lib/openwfe/expressions/fe_raw.rb +125 -8
  26. data/lib/openwfe/expressions/fe_sequence.rb +2 -0
  27. data/lib/openwfe/expressions/fe_sleep.rb +213 -0
  28. data/lib/openwfe/expressions/fe_subprocess.rb +2 -0
  29. data/lib/openwfe/expressions/fe_value.rb +8 -0
  30. data/lib/openwfe/expressions/fe_when.rb +205 -0
  31. data/lib/openwfe/expressions/flowexpression.rb +62 -9
  32. data/lib/openwfe/expressions/raw_prog.rb +147 -45
  33. data/lib/openwfe/expressions/raw_xml.rb +50 -5
  34. data/lib/openwfe/expressions/timeout.rb +32 -5
  35. data/lib/openwfe/flowexpressionid.rb +6 -4
  36. data/lib/openwfe/listeners/listeners.rb +4 -3
  37. data/lib/openwfe/listeners/socketlisteners.rb +30 -4
  38. data/lib/openwfe/logging.rb +9 -1
  39. data/lib/openwfe/participants/participants.rb +9 -9
  40. data/lib/openwfe/participants/socketparticipants.rb +41 -8
  41. data/lib/openwfe/rudefinitions.rb +21 -0
  42. data/lib/openwfe/storage/yamlextras.rb +115 -0
  43. data/lib/openwfe/storage/yamlfilestorage.rb +23 -4
  44. data/lib/openwfe/util/csvtable.rb +76 -6
  45. data/lib/openwfe/util/dollar.rb +5 -0
  46. data/lib/openwfe/util/kotoba.rb +236 -0
  47. data/lib/openwfe/util/ometa.rb +64 -0
  48. data/lib/openwfe/util/safe.rb +2 -0
  49. data/lib/openwfe/util/scheduler.rb +58 -11
  50. data/lib/openwfe/utils.rb +27 -0
  51. data/lib/openwfe/version.rb +1 -1
  52. data/lib/openwfe/worklist/storeparticipant.rb +2 -3
  53. data/test/csv_test.rb +57 -0
  54. data/test/expmap_test.rb +54 -0
  55. data/test/file_persistence_test.rb +9 -9
  56. data/test/flowtestbase.rb +19 -1
  57. data/test/ft_11_ppd.rb +18 -0
  58. data/test/ft_15_iterator.rb +27 -0
  59. data/test/ft_23b_when.rb +2 -2
  60. data/test/ft_27_getflowpos.rb +19 -9
  61. data/test/ft_29_httprb.rb +31 -2
  62. data/test/ft_30_socketlistener.rb +3 -5
  63. data/test/ft_31_flowname.rb +40 -0
  64. data/test/ft_32_journal.rb +60 -0
  65. data/test/ft_33_description.rb +100 -0
  66. data/test/ft_34_cancelwfid.rb +69 -0
  67. data/test/ft_35_localdefs.rb +63 -0
  68. data/test/ft_7_lose.rb +0 -61
  69. data/test/ft_7b_lose.rb +85 -0
  70. data/test/ft_tests.rb +49 -0
  71. data/test/kotoba_test.rb +72 -0
  72. data/test/misc_test.rb +4 -12
  73. data/test/param_test.rb +284 -0
  74. data/test/rake_qtest.rb +13 -35
  75. data/test/rake_test.rb +2 -3
  76. data/test/raw_prog_test.rb +9 -7
  77. data/test/restart_cron_test.rb +9 -5
  78. data/test/restart_sleep_test.rb +104 -0
  79. data/test/restart_tests.rb +15 -0
  80. data/test/restart_when_test.rb +105 -0
  81. data/test/scheduler_test.rb +2 -2
  82. data/test/sec_test.rb +163 -0
  83. data/test/wfid_test.rb +69 -13
  84. metadata +31 -16
  85. data/lib/openwfe/expressions/fe_time.rb +0 -454
  86. data/test/restart_test.rb +0 -79
@@ -0,0 +1,121 @@
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 'openwfe/flowexpressionid'
43
+
44
+
45
+ module OpenWFE
46
+
47
+ #
48
+ # Keeping a replayable track of the events in an OpenWFEru engine
49
+ #
50
+ module JournalReplay
51
+
52
+ def replay (file_path)
53
+
54
+ events = File.open(file_path) do |f|
55
+ s = YAML.load_stream f
56
+ s.documents
57
+ end
58
+
59
+ #
60
+ # what to do with Sleep and When ?
61
+
62
+ events = events[0..-20]
63
+
64
+ participants = {}
65
+
66
+ seen = {}
67
+ static = []
68
+ events.reverse.each do |e|
69
+
70
+ etype = e[0]
71
+ fei = e[2]
72
+
73
+ next if etype == :apply
74
+ next if etype == :reply
75
+ next if etype == :reply_to_parent
76
+ next if seen[fei]
77
+
78
+ seen[fei] = true
79
+
80
+ next if etype == :remove
81
+
82
+ static << e
83
+
84
+ participants[fei] = true \
85
+ if e[3].is_a? OpenWFE::ParticipantExpression
86
+ end
87
+
88
+ seen = {}
89
+ dynamic = []
90
+ events.reverse.each do |e|
91
+ etype = e[0]
92
+ fei = e[2]
93
+ next if etype == :update
94
+ next if etype == :remove
95
+ #next if etype == :reply_to_parent
96
+ next if seen[fei]
97
+ next unless participants[fei]
98
+ seen[fei] = true
99
+ dynamic << e
100
+ end
101
+
102
+ puts
103
+ puts "static :"
104
+ static.each do |e|
105
+ puts " - #{e[0]} #{e[2].to_short_s}"
106
+ end
107
+
108
+ puts
109
+ puts "participants :"
110
+ participants.each do |fei, v|
111
+ puts " - #{fei.to_short_s}"
112
+ end
113
+
114
+ puts
115
+ puts "dynamic :"
116
+ dynamic.each do |e|
117
+ puts " - #{e[0]} #{e[2].to_short_s}"
118
+ end
119
+ end
120
+ end
121
+ end
@@ -0,0 +1,318 @@
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 'thread'
43
+
44
+ require 'openwfe/service'
45
+ require 'openwfe/rudefinitions'
46
+ require 'openwfe/util/kotoba'
47
+
48
+
49
+ module OpenWFE
50
+
51
+ #
52
+ # This default wfid generator outputs a long integer as a String.
53
+ # The last given id (in order to prevent clocks being put back) is
54
+ # stored in the work directory in the file "wfidgen.last"
55
+ #
56
+ class DefaultWfidGenerator < Service
57
+
58
+ def initialize (service_name, application_context)
59
+ super
60
+
61
+ @last = -1
62
+ @mutex = Mutex.new
63
+
64
+ @last_fn = OpenWFE::get_work_directory + '/wfidgen.last'
65
+
66
+ load_last()
67
+
68
+ @last_f = File.open(@last_fn, "w")
69
+ end
70
+
71
+ #
72
+ # Returns a new workflow instance id
73
+ #
74
+ def generate
75
+ wfid = nil
76
+ @mutex.synchronize do
77
+ wfid = now
78
+ wfid = @last + 1 if wfid <= @last
79
+ @last = wfid
80
+ save_last
81
+ end
82
+ to_string(wfid)
83
+ end
84
+
85
+ #
86
+ # The actual job of turning the numeric result into a String.
87
+ # This method is overriden in extension of this class.
88
+ #
89
+ def to_string (numeric_id)
90
+ numeric_id.to_s
91
+ end
92
+
93
+ #
94
+ # Is a simple call to OpenWFE::split_wfid()
95
+ #
96
+ def split_wfid (wfid)
97
+ OpenWFE.split_wfid(wfid)
98
+ end
99
+
100
+ #
101
+ # This method is called by OpenWFE::split_wfid() when it has detected
102
+ # a wfid following this 'defaut' scheme.
103
+ #
104
+ def self.split_wfid (wfid)
105
+ r = []
106
+ 0.upto(wfid.length-1) do |i|
107
+ r << wfid[i, 1]
108
+ end
109
+ r
110
+ end
111
+
112
+ #
113
+ # Stops this service.
114
+ # In this particular implementation, makes sure the "wfidgen.last"
115
+ # file is closed.
116
+ #
117
+ def stop
118
+ @last_f.close
119
+ end
120
+
121
+ protected
122
+
123
+ def now
124
+ wfid = Time.now.to_f * 1000 * 10
125
+ wfid.to_i
126
+ end
127
+
128
+ def save_last
129
+ @last_f.pos = 0
130
+ @last_f.puts @last
131
+ end
132
+
133
+ def load_last
134
+ @mutex.synchronize do
135
+
136
+ if File.exist?(@last_fn)
137
+ begin
138
+ s = File.open(@last_fn, "r+") do |f|
139
+ f.readline
140
+ end
141
+ @last = Integer(s)
142
+ #puts @last
143
+ rescue Exception => e
144
+ #puts
145
+ #puts e.to_s
146
+ end
147
+ end
148
+
149
+ n = now
150
+
151
+ @last = n if (not @last) or (@last < n)
152
+ end
153
+ end
154
+ end
155
+
156
+ #
157
+ # This extension of DefaultWfidGenerator produces ids like
158
+ # "20070318-jonowoguya" or "20071224-jesoshimoha" that are a bit
159
+ # easier to grasp than full integer wfids.
160
+ #
161
+ class KotobaWfidGenerator < DefaultWfidGenerator
162
+
163
+ #
164
+ # Overrides the to_string() method of the DefaultWfidGenerator,
165
+ #
166
+ def to_string (numeric_id)
167
+
168
+ self.class.to_string(numeric_id)
169
+ end
170
+
171
+ #
172
+ # That's here that the numeric wfid gets turned into a 'kotoba'.
173
+ # A static method easily accessible by any.
174
+ #
175
+ def self.to_string (numeric_id)
176
+
177
+ i = numeric_id % (10 * 1000 * 60 * 60 * 24)
178
+ t = Time.now.gmtime
179
+
180
+ s = sprintf "%4d%02d%02d", t.year, t.month, t.day
181
+ s << "-"
182
+ s << Kotoba::from_integer(i)
183
+ s
184
+ end
185
+
186
+ #
187
+ # This method is called by OpenWFE::split_wfid() when it has detected
188
+ # a wfid following the 'kotoba' scheme.
189
+ # Returns the 'kotoba' wfid split into its syllables
190
+ #
191
+ def self.split_wfid (wfid)
192
+ Kotoba::split(wfid[9..-1])
193
+ end
194
+
195
+ #
196
+ # Turns a KotobaWfidGenerator produced wfid into a UTC date.
197
+ #
198
+ def self.to_time (wfid)
199
+
200
+ year = wfid[0, 4]
201
+ month = wfid[4, 2]
202
+ day = wfid[6, 2]
203
+
204
+ s = wfid[9..-1]
205
+
206
+ i = Kotoba::to_integer(s)
207
+
208
+ hour = (i / (10000 * 60 * 60)) % 24
209
+ min = (i / (10000 * 60)) % 60
210
+ sec = (i / 10000) % 60
211
+ usec = (i * 100) % 1000000
212
+
213
+ #puts "hms #{hour} #{min} #{sec} #{usec}"
214
+
215
+ Time.utc(year, month, day, hour, min, sec, usec)
216
+ end
217
+
218
+ def self.from_time (t)
219
+ to_string (t.to_f * 10 * 1000).to_i
220
+ end
221
+ end
222
+
223
+ #
224
+ # A wfid generator that uses any underlying "uuidgen" command it might
225
+ # find.
226
+ # By default, it favours "uuidgen -t".
227
+ #
228
+ # You can specifying a command by passing a :uuid_command param in the
229
+ # application context, or simply by overriding the generate() method.
230
+ #
231
+ class UuidWfidGenerator < Service
232
+
233
+ COMMANDS = [
234
+ "uuidgen -t",
235
+ "uuidgen"
236
+ ]
237
+
238
+ def initialize (service_name, application_context)
239
+
240
+ super
241
+
242
+ @command = @application_context[:uuid_command] \
243
+ if @application_context
244
+
245
+ unless @command
246
+ COMMANDS.each do |c|
247
+ c = "#{c} 2> /dev/null"
248
+ s = `#{c}`
249
+ h = s[0, 8].hex
250
+ if h > 0
251
+ @command = c
252
+ break
253
+ end
254
+ end
255
+ end
256
+
257
+ raise "no command found for generating an uuid found..." \
258
+ unless @command
259
+
260
+ linfo { "new() command that will be used : '#{@command}'" }
261
+ end
262
+
263
+ #
264
+ # Generates a brand new UUID
265
+ #
266
+ def generate
267
+ return `#{@command}`.chomp
268
+ end
269
+
270
+ #
271
+ # Is a simple call to OpenWFE::split_wfid()
272
+ #
273
+ def split_wfid (wfid)
274
+ OpenWFE.split_wfid(wfid)
275
+ end
276
+
277
+ #
278
+ # This method is called by OpenWFE::split_wfid() when it has detected
279
+ # a wfid that is a UUID.
280
+ #
281
+ # Splits the first part of the uuid (will be used for the
282
+ # expression storage directory structure).
283
+ #
284
+ def self.split_wfid (wfid)
285
+ s = wfid[0, 8]
286
+ a = []
287
+ 4.times do |i|
288
+ a << s[i*2, 2]
289
+ end
290
+ a
291
+ end
292
+ end
293
+
294
+ #
295
+ # "module methods"
296
+ #
297
+
298
+ SPLIT_MAP = {
299
+ "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}" => UuidWfidGenerator,
300
+ "[0-9]{8}-[a-z]*" => KotobaWfidGenerator
301
+ }
302
+
303
+ #
304
+ # This method should be able to split any wfid whose scheme is implemented
305
+ # here.
306
+ #
307
+ def OpenWFE.split_wfid (wfid)
308
+ SPLIT_MAP.each do |regex, clazz|
309
+ return clazz.split_wfid(wfid) if wfid.match(regex)
310
+ end
311
+ #
312
+ # else
313
+ #
314
+ DefaultWfidGenerator.split_wfid(wfid)
315
+ end
316
+
317
+ end
318
+
@@ -42,6 +42,7 @@
42
42
 
43
43
  require 'openwfe/utils'
44
44
  require 'openwfe/rudefinitions'
45
+ require 'openwfe/storage/yamlextras'
45
46
  require 'openwfe/storage/yamlfilestorage'
46
47
 
47
48
  require 'openwfe/expressions/flowexpression'
@@ -55,42 +56,6 @@ require 'openwfe/expressions/raw_xml'
55
56
 
56
57
  module OpenWFE
57
58
 
58
- #
59
- # reopening some classes in order to facilitate their
60
- # yaml serialization
61
- #
62
-
63
- #
64
- # opening for tuning yaml persistence
65
- #
66
- class FlowExpression
67
-
68
- def to_yaml_properties
69
-
70
- l = super()
71
-
72
- l.delete("@application_context")
73
-
74
- l.delete("@timeout_job_id")
75
- l.delete("@scheduler_job_id")
76
- #
77
- # scheduler ids should not get persisted
78
-
79
- return l
80
- end
81
- end
82
-
83
- #
84
- # opening for tuning yaml persistence
85
- #
86
- class XmlRawExpression
87
- def to_yaml_properties
88
- l = super()
89
- l.delete("@raw_representation")
90
- return l
91
- end
92
- end
93
-
94
59
  #
95
60
  # yaml expression storage
96
61
  #
@@ -99,12 +64,13 @@ module OpenWFE
99
64
 
100
65
  def initialize (service_name, application_context)
101
66
 
102
- path = if (@application_context)
103
- @application_context[:work_directory]
104
- else
105
- DEFAULT_WORK_DIRECTORY
106
- end
107
- path = path + '/expool'
67
+ #path = if (@application_context)
68
+ # @application_context[:work_directory]
69
+ #else
70
+ # DEFAULT_WORK_DIRECTORY
71
+ #end
72
+ #path = path + '/expool'
73
+ path = OpenWFE::get_work_directory + '/expool'
108
74
 
109
75
  super(service_name, application_context, path)
110
76
 
@@ -182,11 +148,13 @@ module OpenWFE
182
148
  if fei.workflow_instance_id == "0"
183
149
 
184
150
  wfid = fei.parent_workflow_instance_id
151
+
152
+ #a_wfid = OpenWFE::split_wfid(wfid)
153
+ a_wfid = get_wfid_generator.split_wfid(wfid)
185
154
 
186
155
  @basepath +
187
- #wfid[-3, 1] + "/" +
188
- wfid[-2, 1] + "/" +
189
- wfid[-1, 1] + "/" +
156
+ a_wfid[-2] + "/" +
157
+ a_wfid[-1] + "/" +
190
158
  fei.workflow_instance_id + "__" +
191
159
  fei.expression_id + "_" +
192
160
  fei.expression_name + ".yaml"
@@ -209,6 +177,10 @@ module OpenWFE
209
177
  #
210
178
  class ThreadedYamlFileExpressionStorage < YamlFileExpressionStorage
211
179
 
180
+ FREQ = "400" # milliseconds
181
+ #
182
+ # the frequency at which the event queue should be processed
183
+
212
184
  def initialize (service_name, application_context)
213
185
 
214
186
  super
@@ -216,9 +188,9 @@ module OpenWFE
216
188
  @events = {}
217
189
  @op_count = 0
218
190
 
219
- @stopped = false
220
-
221
191
  start_processing_thread()
192
+ #
193
+ # which sets @thread_id
222
194
  end
223
195
 
224
196
  #
@@ -226,7 +198,7 @@ module OpenWFE
226
198
  #
227
199
  def stop
228
200
 
229
- @stopped = true
201
+ get_scheduler.unschedule(@thread_id) if @thread_id
230
202
 
231
203
  process_queue()
232
204
  #
@@ -258,12 +230,9 @@ module OpenWFE
258
230
  protected
259
231
 
260
232
  def start_processing_thread
261
- Thread.new do
262
- while true
263
- sleep(0.33)
264
- break if @stopped
265
- process_queue()
266
- end
233
+
234
+ @thread_id = get_scheduler.schedule_every(FREQ) do
235
+ process_queue()
267
236
  end
268
237
  end
269
238
 
@@ -39,6 +39,8 @@
39
39
  # John Mettraux at openwfe.org
40
40
  #
41
41
 
42
+ require 'openwfe/util/safe'
43
+
42
44
 
43
45
  module OpenWFE
44
46
 
@@ -65,7 +67,8 @@ module OpenWFE
65
67
  rconditional = lookup_attribute("r"+attname.to_s, workitem)
66
68
 
67
69
  if rconditional and not conditional
68
- return instance_eval(rconditional)
70
+ #return instance_eval(rconditional)
71
+ return do_eval(rconditional)
69
72
  end
70
73
 
71
74
  return nil unless conditional
@@ -80,7 +83,8 @@ module OpenWFE
80
83
 
81
84
  ldebug { "eval_condition() 2 for '#{conditional}'" }
82
85
 
83
- result = instance_eval(conditional)
86
+ #result = instance_eval(conditional)
87
+ result = do_eval(conditional)
84
88
 
85
89
  ldebug { "eval_condition() 3 result is '#{result}'" }
86
90
 
@@ -114,6 +118,14 @@ module OpenWFE
114
118
  string[i+2..-1].strip +
115
119
  '"'
116
120
  end
121
+
122
+ #
123
+ # Runs the given given within an instance_eval() at a $SAFE
124
+ # level of 3.
125
+ #
126
+ def do_eval (s)
127
+ OpenWFE::instance_eval_safely(self, s, 3)
128
+ end
117
129
  end
118
130
 
119
131
  end