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
@@ -53,6 +53,8 @@ module OpenWFE
53
53
  class Environment < FlowExpression
54
54
  include Schedulable
55
55
 
56
+ names :environment
57
+
56
58
  attr_accessor \
57
59
  :variables
58
60
 
@@ -66,13 +68,13 @@ module OpenWFE
66
68
 
67
69
  def [] (key)
68
70
 
69
- if OpenWFE::starts_with(key, "//")
70
- return get_expression_pool()\
71
- .get_engine_environment()[key[2..-1]]
72
- end
73
- if OpenWFE::starts_with(key, "/")
74
- return get_root_environment()[key[1..-1]]
75
- end
71
+ #if OpenWFE::starts_with(key, "//")
72
+ # return get_expression_pool()\
73
+ # .get_engine_environment()[key[2..-1]]
74
+ #end
75
+ #if OpenWFE::starts_with(key, "/")
76
+ # return get_root_environment()[key[1..-1]]
77
+ #end
76
78
 
77
79
  value = @variables[key]
78
80
 
@@ -80,39 +82,44 @@ module OpenWFE
80
82
  if @variables.has_key?(key) or is_engine_environment?
81
83
  #if value or is_engine_environment?
82
84
 
83
- return get_parent()[key] if @parent_id
85
+ return get_parent[key] if @parent_id
84
86
 
85
- return get_expression_pool().fetch_engine_environment()[key]
87
+ return get_expression_pool.fetch_engine_environment[key]
86
88
  end
87
89
 
88
90
  def []= (key, value)
89
91
 
90
- if OpenWFE::starts_with(key, "//")
91
- key = key[2..-1]
92
- get_expression_pool().fetch_engine_environment()[key] = value
93
- elsif OpenWFE::starts_with(key, "/")
94
- key = key[1..-1]
95
- get_root_environment()[key] = value
96
- else
97
- @variables[key] = value
98
- store_itself()
99
-
100
- #ldebug { "[]= #{@fei.to_debug_s} : '#{key}' -> '#{value}'" }
101
- end
92
+ #if OpenWFE::starts_with(key, "//")
93
+ # key = key[2..-1]
94
+ # get_expression_pool().fetch_engine_environment()[key] = value
95
+ #elsif OpenWFE::starts_with(key, "/")
96
+ # key = key[1..-1]
97
+ # get_root_environment()[key] = value
98
+ #else
99
+ # @variables[key] = value
100
+ # store_itself()
101
+ # #ldebug { "[]= #{@fei.to_debug_s} : '#{key}' -> '#{value}'" }
102
+ #end
103
+
104
+ @variables[key] = value
105
+ store_itself()
102
106
  end
103
107
 
104
108
  def delete (key)
105
109
 
106
- if OpenWFE::starts_with(key, "//")
107
- key = key[2..-1]
108
- get_expression_pool().fetch_engine_environment().delete(key)
109
- elsif OpenWFE::starts_with(key, "/")
110
- key = key[1..-1]
111
- get_root_environment().delete(key)
112
- else
113
- @variables.delete(key)
114
- store_itself()
115
- end
110
+ #if OpenWFE::starts_with(key, "//")
111
+ # key = key[2..-1]
112
+ # get_expression_pool().fetch_engine_environment().delete(key)
113
+ #elsif OpenWFE::starts_with(key, "/")
114
+ # key = key[1..-1]
115
+ # get_root_environment().delete(key)
116
+ #else
117
+ # @variables.delete(key)
118
+ # store_itself()
119
+ #end
120
+
121
+ @variables.delete key
122
+ store_itself()
116
123
  end
117
124
 
118
125
  #
@@ -167,13 +174,16 @@ module OpenWFE
167
174
  store_itself()
168
175
  end
169
176
 
170
- protected
177
+ #
178
+ # Returns the top environment for the process instance.
179
+ #
180
+ def get_root_environment ()
181
+
182
+ #ldebug { "get_root_environment()\n#{self}" }
171
183
 
172
- def get_root_environment ()
173
- #ldebug { "get_root_environment()\n#{self}" }
174
- return self if not @parent_id
175
- return get_parent().get_root_environment()
176
- end
184
+ return self if not @parent_id
185
+ return get_parent().get_root_environment()
186
+ end
177
187
  end
178
188
 
179
189
  end
@@ -39,7 +39,7 @@
39
39
  # John Mettraux at openwfe.org
40
40
  #
41
41
 
42
- require 'openwfe/service'
42
+ #require 'openwfe/util/model'
43
43
  require 'openwfe/expressions/environment'
44
44
  require 'openwfe/expressions/fe_define'
45
45
  require 'openwfe/expressions/fe_misc'
@@ -48,7 +48,9 @@ require 'openwfe/expressions/fe_sequence'
48
48
  require 'openwfe/expressions/fe_subprocess'
49
49
  require 'openwfe/expressions/fe_concurrence'
50
50
  require 'openwfe/expressions/fe_participant'
51
- require 'openwfe/expressions/fe_time'
51
+ require 'openwfe/expressions/fe_sleep'
52
+ require 'openwfe/expressions/fe_cron'
53
+ require 'openwfe/expressions/fe_when'
52
54
  require 'openwfe/expressions/fe_losfor'
53
55
  require 'openwfe/expressions/fe_cursor'
54
56
  require 'openwfe/expressions/fe_iterator'
@@ -62,69 +64,52 @@ module OpenWFE
62
64
  # The mapping between expression names like 'sequence', 'participant', etc
63
65
  # and classes like 'ParticipantExpression', 'SequenceExpression', etc.
64
66
  #
65
- class ExpressionMap < Service
67
+ class ExpressionMap
66
68
 
67
- def initialize (serviceName, applicationContext)
68
- super(serviceName, applicationContext)
69
+ def initialize ()
69
70
 
70
- @map = {}
71
- @sync_map = {}
71
+ super
72
72
 
73
- @map["process-definition"] = DefineExpression
74
- @map["workflow-definition"] = DefineExpression
75
- @map["define"] = DefineExpression
73
+ @expressions = {}
76
74
 
77
- @map["sequence"] = SequenceExpression
78
- @map["participant"] = ParticipantExpression
75
+ register DefineExpression
79
76
 
80
- @map["concurrence"] = ConcurrenceExpression
81
- @sync_map["generic"] = GenericSyncExpression
77
+ register SequenceExpression
78
+ register ParticipantExpression
82
79
 
83
- @map["subprocess"] = SubProcessRefExpression
80
+ register ConcurrenceExpression
81
+ register GenericSyncExpression
84
82
 
85
- @map["set"] = SetValueExpression
86
- @map["unset"] = UnsetValueExpression
83
+ register SubProcessRefExpression
87
84
 
88
- @map["if"] = IfExpression
89
- @map["equals"] = EqualsExpression
85
+ register SetValueExpression
86
+ register UnsetValueExpression
90
87
 
91
- @map["sleep"] = SleepExpression
92
- @map["cron"] = CronExpression
93
- @map["when"] = WhenExpression
88
+ register IfExpression
89
+ register EqualsExpression
94
90
 
95
- @map["reval"] = RevalExpression
96
- @map["print"] = PrintExpression
91
+ register SleepExpression
92
+ register CronExpression
93
+ register WhenExpression
97
94
 
98
- @map["lose"] = LoseExpression
99
- @map["forget"] = ForgetExpression
95
+ register RevalExpression
96
+ register PrintExpression
100
97
 
101
- @map["cursor"] = CursorExpression
102
- @map["loop"] = LoopExpression
98
+ register LoseExpression
99
+ register ForgetExpression
103
100
 
104
- @map["back"] = CursorCommandExpression
105
- @map["skip"] = CursorCommandExpression
106
- @map["break"] = CursorCommandExpression
107
- @map["cancel"] = CursorCommandExpression
108
- @map["rewind"] = CursorCommandExpression
109
- @map["continue"] = CursorCommandExpression
101
+ register CursorExpression
102
+ register LoopExpression
110
103
 
111
- @map["iterator"] = IteratorExpression
104
+ register CursorCommandExpression
112
105
 
113
- @map["field"] = FqvExpression
114
- @map["quote"] = FqvExpression
115
- @map["variable"] = FqvExpression
116
- @map["f"] = FqvExpression
117
- @map["q"] = FqvExpression
118
- @map["v"] = FqvExpression
106
+ register IteratorExpression
119
107
 
120
- #@map["do"] = DoExpression
121
- #@map["undo"] = UndoExpression
122
- #@map["redo"] = RedoExpression
108
+ register FqvExpression
123
109
 
124
- @map["cancel-process"] = CancelProcessExpression
125
- #@map["cancel"] = CancelExpression
110
+ register CancelProcessExpression
126
111
 
127
- @map["environment"] = Environment
112
+ register Environment
128
113
  #
129
114
  # only used by get_expression_names()
130
115
  end
@@ -133,31 +118,27 @@ module OpenWFE
133
118
  # Returns the expression class corresponding to the given
134
119
  # expression name
135
120
  #
136
- def get_class (expressionname)
137
- return @map[expressionname]
121
+ def get_class (expression_name)
122
+
123
+ expression_name = OpenWFE::symbol_to_name(expression_name)
124
+
125
+ @expressions[expression_name]
138
126
  end
139
127
 
140
- def get_sync_class (expressionname)
141
- return @sync_map[expressionname]
128
+ def get_sync_class (expression_name)
129
+
130
+ get_class(expression_name)
142
131
  end
143
132
 
144
133
  #
145
134
  # Returns true if the given expression name ('sequence',
146
135
  # 'process-definition', ...) is a DefineExpression.
147
136
  #
148
- def is_definition? (expressionname)
149
- c = get_class(expressionname)
150
- return \
151
- (c == OpenWFE::DefineExpression or
152
- c == OpenWFE::SetValueExpression)
153
- end
137
+ def is_definition? (expression_name)
154
138
 
155
- #
156
- # Returns the list of expression names registered in this
157
- # expression map.
158
- #
159
- def expression_names
160
- return @map.keys
139
+ c = get_class(expression_name)
140
+
141
+ c == DefineExpression
161
142
  end
162
143
 
163
144
  #
@@ -165,12 +146,37 @@ module OpenWFE
165
146
  # from the given expression_class.
166
147
  #
167
148
  def get_expression_names (expression_class)
149
+
150
+ return expression_class.expression_names \
151
+ if expression_class.method_defined? :expression_names
152
+
168
153
  names = []
169
- @map.each do |name, exp_class|
170
- names << name \
171
- if exp_class.ancestors.include? expression_class
154
+ @expressions.each do |k, v|
155
+ names << k if v.ancestors.include? expression_class
156
+ end
157
+ names
158
+ end
159
+
160
+ #
161
+ # Registers an Expression class within this expression map.
162
+ # This method is usually never called from out of the ExpressionMap
163
+ # class, but, who knows, it could prove useful one day as a 'public'
164
+ # method.
165
+ #
166
+ def register (expression_class)
167
+
168
+ expression_class.expression_names.each do |name|
169
+ name = OpenWFE::to_dash(name)
170
+ @expressions[name] = expression_class
171
+ end
172
+ end
173
+
174
+ def to_s
175
+ s = ""
176
+ @expressions.keys.sort.each do |name|
177
+ s << "- '#{name}' -> '#{@expressions[name].to_s}'\n"
172
178
  end
173
- return names
179
+ s
174
180
  end
175
181
  end
176
182
 
@@ -78,6 +78,8 @@ module OpenWFE
78
78
  class CancelProcessExpression < FlowExpression
79
79
  include ConditionMixin
80
80
 
81
+ names :cancel_process, :cancel_flow
82
+
81
83
  #
82
84
  # apply / reply
83
85
 
@@ -130,6 +130,8 @@ module OpenWFE
130
130
  class ConcurrenceExpression < SequenceExpression
131
131
  include ConditionMixin
132
132
 
133
+ names :concurrence
134
+
133
135
  attr_accessor \
134
136
  :sync_expression
135
137
 
@@ -190,11 +192,20 @@ module OpenWFE
190
192
  # A base for sync expressions, currently empty.
191
193
  # That may change.
192
194
  #
193
- class SyncExpression
195
+ class SyncExpression < ObjectWithMeta
194
196
 
195
197
  def initialize()
196
198
  super()
197
199
  end
200
+
201
+ def self.names (*exp_names)
202
+ exp_names = exp_names.collect do |n|
203
+ n.to_s
204
+ end
205
+ meta_def :expression_names do
206
+ exp_names
207
+ end
208
+ end
198
209
  end
199
210
 
200
211
  #
@@ -203,6 +214,8 @@ module OpenWFE
203
214
  #
204
215
  class GenericSyncExpression < SyncExpression
205
216
 
217
+ names :generic
218
+
206
219
  attr_accessor \
207
220
  :remaining_children,
208
221
  :count,
@@ -0,0 +1,186 @@
1
+ #
2
+ #--
3
+ # Copyright (c) 2006-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/rudefinitions'
43
+ require 'openwfe/utils'
44
+ require 'openwfe/util/otime'
45
+ require 'openwfe/util/scheduler'
46
+ require 'openwfe/expressions/fe_sleep'
47
+
48
+
49
+ #
50
+ # expressions like 'sleep' and 'cron'
51
+ #
52
+
53
+ module OpenWFE
54
+
55
+ #
56
+ # Scheduling subprocesses for repeating execution
57
+ #
58
+ # <cron tab="0 9-17 * * mon-fri" name="//reminder">
59
+ # <send-reminder/>
60
+ # </cron>
61
+ #
62
+ # In this short process definition snippet, the subprocess "send-reminder"
63
+ # will get triggered once per hour (minute 0) from 0900 to 1700 and
64
+ # this, from monday to friday.
65
+ #
66
+ # The 'name' of the cron indicates also at which level the cron should
67
+ # be bound. A double slash means the cron is bound at engine level (and
68
+ # will continue until it is unbound, as long as the engine is up, if the
69
+ # engine is a persisted one, the cron will continue when the engine
70
+ # restarts).
71
+ #
72
+ class CronExpression < TimeExpression
73
+
74
+ names :cron
75
+
76
+ attr_accessor \
77
+ :raw_child, :tab, :name, :counter
78
+
79
+ def apply (workitem)
80
+
81
+ @counter = 0
82
+
83
+ if @children.size < 1
84
+ reply_to_parent(workitem)
85
+ return
86
+ end
87
+
88
+ @applied_workitem = workitem.dup
89
+ @applied_workitem.flow_expression_id = nil
90
+
91
+ @tab = lookup_attribute(:tab, workitem)
92
+ @name = lookup_attribute(:name, workitem)
93
+
94
+ @raw_child, _fei = get_expression_pool.fetch(@children[0])
95
+ @raw_child.parent_id = nil
96
+
97
+ clean_children()
98
+
99
+ @children = nil
100
+
101
+ #
102
+ # schedule self
103
+
104
+ reschedule(get_scheduler)
105
+
106
+ #
107
+ # store self as a variable
108
+ # (have to do it after the reschedule, so that the schedule
109
+ # info is stored within the variable)
110
+
111
+ set_variable(@name, self) if @name
112
+
113
+ #
114
+ # resume flow
115
+
116
+ reply_to_parent(workitem)
117
+ end
118
+
119
+ def reply (workitem)
120
+ # discard silently... should never get called though
121
+ end
122
+
123
+ #def cancel ()
124
+ #end
125
+ #
126
+ # implemented in parent TimeExpression class
127
+
128
+ #
129
+ # This is the method called each time, the scheduler triggers
130
+ # this cron. The contained segment of process will get
131
+ # executed.
132
+ #
133
+ def trigger (params)
134
+ #
135
+ # launch raw child
136
+
137
+ ldebug { "trigger() cron : #{@fei.to_debug_s}" }
138
+
139
+ @raw_child.application_context = @application_context
140
+
141
+ begin
142
+
143
+ get_expression_pool.launch_template(
144
+ @fei.wfid, @counter, @raw_child, @applied_workitem.dup)
145
+
146
+ #
147
+ # update count and store self
148
+
149
+ @counter += 1
150
+
151
+ set_variable(@name, self) if @name
152
+
153
+ rescue
154
+ lerror do
155
+ "trigger() cron caught exception\n"+
156
+ OpenWFE::exception_to_s($!)
157
+ end
158
+ end
159
+ end
160
+
161
+ #
162
+ # This method is called at the first schedule of this expression
163
+ # or each time the engine is restarted and this expression has
164
+ # to be rescheduled.
165
+ #
166
+ def reschedule (scheduler)
167
+
168
+ #return unless @applied_workitem
169
+
170
+ @scheduler_job_id = @name.dup
171
+
172
+ @scheduler_job_id = "#{@fei.wfid}__#{@scheduler_job_id}" \
173
+ if not OpenWFE::starts_with(@name, "//")
174
+
175
+ get_scheduler.schedule(@tab, @scheduler_job_id, self, nil)
176
+
177
+ ldebug { "reschedule() job id is '#{@scheduler_job_id}'" }
178
+
179
+ #store_itself()
180
+ #
181
+ # done by the containing environment itself
182
+ end
183
+ end
184
+
185
+ end
186
+
@@ -69,6 +69,8 @@ module OpenWFE
69
69
  #
70
70
  class CursorExpression < WithTemplateExpression
71
71
 
72
+ names :cursor
73
+
72
74
  attr_accessor \
73
75
  :loop_id,
74
76
  :current_child_id,
@@ -213,6 +215,8 @@ module OpenWFE
213
215
  #
214
216
  class LoopExpression < CursorExpression
215
217
 
218
+ names :loop
219
+
216
220
  def is_loop
217
221
  return true
218
222
  end
@@ -224,6 +228,8 @@ module OpenWFE
224
228
  class CursorCommandExpression < FlowExpression
225
229
  include ConditionMixin
226
230
 
231
+ names :back, :skip, :continue, :break, :cancel, :rewind
232
+
227
233
  def apply (workitem)
228
234
 
229
235
  conditional = eval_condition(:if, workitem)
@@ -47,6 +47,8 @@ module OpenWFE
47
47
 
48
48
  class DefineExpression < FlowExpression
49
49
 
50
+ names :define, :process_definition, :workflow_definition
51
+
50
52
  def evaluate (workitem)
51
53
 
52
54
  #ldebug { "evaluate() #{@fei.to_s}" }
@@ -54,6 +54,8 @@ module OpenWFE
54
54
  #
55
55
  class FqvExpression < FlowExpression
56
56
 
57
+ names :f, :q, :v, :field, :quote, :variable
58
+
57
59
  #
58
60
  # apply / reply
59
61
 
@@ -64,6 +64,8 @@ module OpenWFE
64
64
  #
65
65
  class IteratorExpression < WithTemplateExpression
66
66
 
67
+ names :iterator
68
+
67
69
  attr_accessor \
68
70
  :iterator
69
71
 
@@ -52,6 +52,8 @@ module OpenWFE
52
52
  #
53
53
  class LoseExpression < FlowExpression
54
54
 
55
+ names :lose
56
+
55
57
  def apply (workitem)
56
58
  get_expression_pool.apply(children[0], workitem) \
57
59
  if (@children and @children.length > 0)
@@ -68,6 +70,8 @@ module OpenWFE
68
70
  #
69
71
  class ForgetExpression < FlowExpression
70
72
 
73
+ names :forget
74
+
71
75
  def apply (workitem)
72
76
 
73
77
  if (@children and @children.length > 0)
@@ -48,6 +48,8 @@ module OpenWFE
48
48
 
49
49
  class PrintExpression < FlowExpression
50
50
 
51
+ names :print
52
+
51
53
  #
52
54
  # apply / reply
53
55
 
@@ -80,10 +82,16 @@ module OpenWFE
80
82
  # Evals some Ruby code contained within the process definition
81
83
  # or within the workitem.
82
84
  #
83
- # The code is evaluated at a SAFE level of 1.
85
+ # The code is evaluated at a SAFE level of 3.
86
+ #
87
+ # If the :ruby_eval_allowed isn't set to true
88
+ # (<tt>engine.application_context[:ruby_eval_allowed] = true</tt>), this
89
+ # expression will throw an exception at apply.
84
90
  #
85
91
  class RevalExpression < FlowExpression
86
92
 
93
+ names :reval
94
+
87
95
  #
88
96
  # See for an explanation on Ruby safety levels :
89
97
  # http://www.rubycentral.com/book/taint.html
@@ -92,6 +100,13 @@ module OpenWFE
92
100
 
93
101
  def apply (workitem)
94
102
 
103
+ if @application_context[:ruby_eval_allowed] != true
104
+ #lwarn { "apply() :ruby_eval_allowed not set to true" }
105
+ #reply_to_parent(workitem)
106
+ #return
107
+ raise "evaluation of ruby code is not allowed"
108
+ end
109
+
95
110
  escape = lookup_boolean_attribute('escape', workitem, false)
96
111
 
97
112
  code = OpenWFE::lookup_vf_attribute(self, workitem, 'code')