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
@@ -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
|
-
|
71
|
-
|
72
|
-
end
|
73
|
-
if OpenWFE::starts_with(key, "/")
|
74
|
-
|
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
|
85
|
+
return get_parent[key] if @parent_id
|
84
86
|
|
85
|
-
return get_expression_pool
|
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
|
-
|
92
|
-
|
93
|
-
elsif OpenWFE::starts_with(key, "/")
|
94
|
-
|
95
|
-
|
96
|
-
else
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
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
|
-
|
108
|
-
|
109
|
-
elsif OpenWFE::starts_with(key, "/")
|
110
|
-
|
111
|
-
|
112
|
-
else
|
113
|
-
|
114
|
-
|
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
|
-
|
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
|
-
|
173
|
-
|
174
|
-
|
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/
|
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/
|
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
|
67
|
+
class ExpressionMap
|
66
68
|
|
67
|
-
def initialize (
|
68
|
-
super(serviceName, applicationContext)
|
69
|
+
def initialize ()
|
69
70
|
|
70
|
-
|
71
|
-
@sync_map = {}
|
71
|
+
super
|
72
72
|
|
73
|
-
@
|
74
|
-
@map["workflow-definition"] = DefineExpression
|
75
|
-
@map["define"] = DefineExpression
|
73
|
+
@expressions = {}
|
76
74
|
|
77
|
-
|
78
|
-
@map["participant"] = ParticipantExpression
|
75
|
+
register DefineExpression
|
79
76
|
|
80
|
-
|
81
|
-
|
77
|
+
register SequenceExpression
|
78
|
+
register ParticipantExpression
|
82
79
|
|
83
|
-
|
80
|
+
register ConcurrenceExpression
|
81
|
+
register GenericSyncExpression
|
84
82
|
|
85
|
-
|
86
|
-
@map["unset"] = UnsetValueExpression
|
83
|
+
register SubProcessRefExpression
|
87
84
|
|
88
|
-
|
89
|
-
|
85
|
+
register SetValueExpression
|
86
|
+
register UnsetValueExpression
|
90
87
|
|
91
|
-
|
92
|
-
|
93
|
-
@map["when"] = WhenExpression
|
88
|
+
register IfExpression
|
89
|
+
register EqualsExpression
|
94
90
|
|
95
|
-
|
96
|
-
|
91
|
+
register SleepExpression
|
92
|
+
register CronExpression
|
93
|
+
register WhenExpression
|
97
94
|
|
98
|
-
|
99
|
-
|
95
|
+
register RevalExpression
|
96
|
+
register PrintExpression
|
100
97
|
|
101
|
-
|
102
|
-
|
98
|
+
register LoseExpression
|
99
|
+
register ForgetExpression
|
103
100
|
|
104
|
-
|
105
|
-
|
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
|
-
|
104
|
+
register CursorCommandExpression
|
112
105
|
|
113
|
-
|
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
|
-
|
121
|
-
#@map["undo"] = UndoExpression
|
122
|
-
#@map["redo"] = RedoExpression
|
108
|
+
register FqvExpression
|
123
109
|
|
124
|
-
|
125
|
-
#@map["cancel"] = CancelExpression
|
110
|
+
register CancelProcessExpression
|
126
111
|
|
127
|
-
|
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 (
|
137
|
-
|
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 (
|
141
|
-
|
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? (
|
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
|
-
|
157
|
-
|
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
|
-
@
|
170
|
-
names <<
|
171
|
-
|
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
|
-
|
179
|
+
s
|
174
180
|
end
|
175
181
|
end
|
176
182
|
|
@@ -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)
|
@@ -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
|
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')
|