openwferu 0.9.1 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. data/{README → README.txt} +16 -13
  2. data/bin/validate-workflow.rb +46 -22
  3. data/examples/README.txt +8 -0
  4. data/examples/homeworkreview.rb +66 -0
  5. data/examples/quotereporter.rb +154 -0
  6. data/lib/{openwferu.rb → openwfe.rb} +6 -8
  7. data/lib/{ru → openwfe}/contextual.rb +11 -3
  8. data/lib/{ru → openwfe/engine}/engine.rb +50 -36
  9. data/lib/{ru/participant.rb → openwfe/engine/file_persisted_engine.rb} +21 -22
  10. data/lib/openwfe/expool/expressionpool.rb +534 -0
  11. data/lib/openwfe/expool/expstorage.rb +184 -0
  12. data/lib/openwfe/expool/journalexpstorage.rb +312 -0
  13. data/lib/openwfe/expool/yamlexpstorage.rb +127 -0
  14. data/lib/{ru → openwfe/expressions}/environment.rb +19 -14
  15. data/lib/{ru → openwfe/expressions}/expressionmap.rb +48 -21
  16. data/lib/{ru → openwfe/expressions}/fe_concurrence.rb +111 -35
  17. data/lib/openwfe/expressions/fe_cursor.rb +236 -0
  18. data/lib/{ru → openwfe/expressions}/fe_define.rb +5 -5
  19. data/lib/openwfe/expressions/fe_fqv.rb +99 -0
  20. data/lib/openwfe/expressions/fe_iterator.rb +182 -0
  21. data/lib/{ru/fe_misc.rb → openwfe/expressions/fe_losfor.rb} +14 -56
  22. data/lib/openwfe/expressions/fe_misc.rb +102 -0
  23. data/lib/{ru → openwfe/expressions}/fe_participant.rb +25 -14
  24. data/lib/{ru → openwfe/expressions}/fe_raw.rb +39 -75
  25. data/lib/{ru/fe_base.rb → openwfe/expressions/fe_sequence.rb} +40 -35
  26. data/lib/{ru → openwfe/expressions}/fe_subprocess.rb +30 -14
  27. data/lib/{ru → openwfe/expressions}/fe_time.rb +59 -31
  28. data/lib/{ru → openwfe/expressions}/fe_utils.rb +42 -26
  29. data/lib/{ru → openwfe/expressions}/fe_value.rb +20 -14
  30. data/lib/openwfe/expressions/flowexpression.rb +434 -0
  31. data/lib/openwfe/expressions/raw_prog.rb +391 -0
  32. data/lib/openwfe/expressions/raw_xml.rb +128 -0
  33. data/lib/openwfe/flowexpressionid.rb +148 -0
  34. data/lib/{ru → openwfe}/logging.rb +10 -6
  35. data/lib/{osocket.rb → openwfe/osocket.rb} +36 -35
  36. data/lib/{otime.rb → openwfe/otime.rb} +71 -21
  37. data/lib/openwfe/participants/atomparticipants.rb +144 -0
  38. data/lib/openwfe/participants/enoparticipant.rb +73 -0
  39. data/lib/openwfe/participants/participant.rb +85 -0
  40. data/lib/{ru → openwfe/participants}/participantmap.rb +40 -12
  41. data/lib/{ru → openwfe/participants}/participants.rb +41 -12
  42. data/lib/openwfe/participants/soapparticipants.rb +96 -0
  43. data/lib/{controlclient.rb → openwfe/rest/controlclient.rb} +12 -13
  44. data/lib/{definitions.rb → openwfe/rest/definitions.rb} +3 -3
  45. data/lib/{exception.rb → openwfe/rest/exception.rb} +3 -3
  46. data/lib/{restclient.rb → openwfe/rest/restclient.rb} +13 -22
  47. data/lib/{worklistclient.rb → openwfe/rest/worklistclient.rb} +33 -46
  48. data/lib/openwfe/rest/xmlcodec.rb +575 -0
  49. data/lib/{ru → openwfe}/rudefinitions.rb +32 -4
  50. data/lib/{ru → openwfe}/service.rb +20 -8
  51. data/lib/openwfe/storage/yamlfilestorage.rb +159 -0
  52. data/lib/{ru → openwfe/util}/dollar.rb +10 -8
  53. data/lib/openwfe/util/lru_cache.rb +149 -0
  54. data/lib/{ru → openwfe/util}/scheduler.rb +18 -10
  55. data/lib/{ru → openwfe/util}/schedulers.rb +7 -7
  56. data/lib/{utils.rb → openwfe/utils.rb} +93 -9
  57. data/lib/openwfe/workitem.rb +366 -0
  58. data/lib/openwfe/worklist/worklists.rb +175 -0
  59. data/test/README.txt +27 -0
  60. data/test/atomtest.rb +99 -0
  61. data/test/crontest.rb +58 -0
  62. data/test/dollartest.rb +3 -3
  63. data/test/feitest.rb +42 -14
  64. data/test/file_persistence_test.rb +93 -0
  65. data/test/flowtestbase.rb +72 -26
  66. data/test/ft_0.rb +1 -97
  67. data/test/ft_0b_sequence.rb +33 -0
  68. data/test/ft_0c_testname.rb +29 -0
  69. data/test/ft_10_loop.rb +48 -0
  70. data/test/ft_11_ppd.rb +292 -0
  71. data/test/ft_12_blockparticipant.rb +45 -0
  72. data/test/ft_13_eno.rb +51 -0
  73. data/test/ft_14_subprocess.rb +90 -0
  74. data/test/ft_14b_subprocess.rb +40 -0
  75. data/test/ft_15_iterator.rb +70 -0
  76. data/test/ft_16_fqv.rb +57 -0
  77. data/test/ft_1_unset.rb +25 -1
  78. data/test/ft_2_concurrence.rb +10 -5
  79. data/test/ft_3_equals.rb +35 -1
  80. data/test/ft_4_misc.rb +16 -1
  81. data/test/ft_5_time.rb +26 -1
  82. data/test/ft_6_lambda.rb +2 -1
  83. data/test/{ft_7_losfor.rb → ft_7_lose.rb} +41 -35
  84. data/test/ft_8_forget.rb +46 -0
  85. data/test/ft_9_cursor.rb +94 -0
  86. data/test/journal_persistence_test.rb +147 -0
  87. data/test/misctest.rb +13 -9
  88. data/test/rake_ptest.rb +18 -0
  89. data/test/rake_qtest.rb +43 -0
  90. data/test/{fulltest.rb → rake_test.rb} +2 -2
  91. data/test/raw_prog_test.rb +236 -0
  92. data/test/rest_test.rb +189 -0
  93. data/test/rutest_utils.rb +1 -1
  94. data/test/timetest.rb +42 -34
  95. metadata +125 -82
  96. data/lib/codec.rb +0 -573
  97. data/lib/flowexpressionid.rb +0 -139
  98. data/lib/ru/expressionpool.rb +0 -382
  99. data/lib/ru/expressionstorage.rb +0 -99
  100. data/lib/ru/flowexpression.rb +0 -272
  101. data/lib/ru/ruutils.rb +0 -70
  102. data/lib/test.rb +0 -222
  103. data/lib/workitem.rb +0 -249
  104. data/test/quicktest.rb +0 -21
@@ -1,139 +0,0 @@
1
- #
2
- #--
3
- # Copyright (c) 2005-2006, 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: workitem.rb 3555 2006-11-13 00:47:53Z jmettraux $
34
- #
35
-
36
- #
37
- # "hecho en Costa Rica"
38
- # enhanced in Japan
39
- #
40
- # john.mettraux@openwfe.org
41
- #
42
-
43
- require 'base64'
44
-
45
- require 'definitions'
46
-
47
-
48
- module OpenWFE
49
-
50
- #
51
- # FlowExpressionId
52
- #
53
- class FlowExpressionId
54
-
55
- attr_accessor \
56
- :owfeVersion, \
57
- :engineId, \
58
- :initialEngineId, \
59
- :workflowDefinitionUrl, \
60
- :workflowDefinitionName, \
61
- :workflowDefinitionRevision, \
62
- :workflowInstanceId, \
63
- :expressionName, \
64
- :expressionId
65
-
66
- #
67
- # overrides the classical to_s()
68
- #
69
- def to_s ()
70
- return "(fei #{@owfeVersion} #{@engineId}/#{@initialEngineId} #{@workflowDefinitionUrl} #{@workflowDefinitionName} #{@workflowDefinitionRevision} #{@workflowInstanceId} #{@expressionName} #{@expressionId})"
71
- end
72
-
73
- #
74
- # This class method parses a string into a FlowExpressionId instance
75
- #
76
- def FlowExpressionId.strToFei (string)
77
-
78
- fei = FlowExpressionId.new()
79
-
80
- ss = string.split(" ")
81
-
82
- fei.owfeVersion = ss[2]
83
-
84
- ssRawEngineId = ss[3].split("/")
85
- fei.engineId= ssRawEngineId[0]
86
- fei.initialEngineId= ssRawEngineId[1]
87
-
88
- fei.workflowDefinitionUrl = ss[4]
89
- fei.workflowDefinitionName = ss[5]
90
- fei.workflowDefinitionRevision = ss[6]
91
- fei.workflowInstanceId = ss[7]
92
- fei.expressionName = ss[8]
93
- fei.expressionId = ss[9]
94
-
95
- return fei
96
- end
97
-
98
- def hash ()
99
- return to_s().hash()
100
- end
101
-
102
- def == (other)
103
- return false if not other.kind_of?(FlowExpressionId)
104
-
105
- @owfeVersion == other.owfeVersion and
106
- @engineId == other.engineId and
107
- @initialEngineId == other.initialEngineId and
108
- @workflowDefinitionUrl == other.workflowDefinitionUrl and
109
- @workflowDefinitionName == other.workflowDefinitionName and
110
- @workflowDefinitionRevision == other.workflowDefinitionRevision and
111
- @workflowInstanceId == other.workflowInstanceId and
112
- @expressionName == other.expressionName and
113
- @expressionId == other.expressionId
114
- end
115
-
116
- def dup
117
- n = FlowExpressionId.new
118
- n.owfeVersion = @owfeVersion.dup
119
- n.engineId = @engineId.dup
120
- n.initialEngineId = @initialEngineId.dup
121
- n.workflowDefinitionUrl = @workflowDefinitionUrl.dup
122
- n.workflowDefinitionName = @workflowDefinitionName.dup
123
- n.workflowDefinitionRevision = @workflowDefinitionRevision.dup
124
- n.workflowInstanceId = @workflowInstanceId.dup
125
- n.expressionName = @expressionName.dup
126
- n.expressionId = @expressionId.dup
127
- return n
128
- end
129
-
130
- alias eql? ==
131
-
132
- alias to_debug_s to_s
133
- #def to_debug_s
134
- # "#{to_s} (h#{hash}) (i#{object_id})"
135
- #end
136
- end
137
-
138
- end
139
-
@@ -1,382 +0,0 @@
1
- #
2
- #--
3
- # Copyright (c) 2006, 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 'uri'
43
- require 'monitor'
44
- require 'net/http'
45
-
46
- require 'flowexpressionid'
47
- require 'ru/service'
48
- require 'ru/environment'
49
- require 'ru/fe_raw'
50
- require 'ru/rudefinitions'
51
-
52
-
53
- module OpenWFEru
54
-
55
- class ExpressionPool < Service
56
- include MonitorMixin
57
-
58
- @@last_given_instance_id = -1
59
- #
60
- # storing at class level the last workflow instance id given
61
-
62
- #def initialize (serviceName, applicationContext)
63
- # super(serviceName, applicationContext)
64
- #end
65
-
66
- #
67
- # Instantiates a workflow definition and launches it.
68
- #
69
- def launch (launchitem)
70
-
71
- wi = build_workitem(launchitem)
72
- xmldef = fetch_definition(launchitem)
73
-
74
- fei = new_fei(launchitem.workflowDefinitionUrl, xmldef)
75
-
76
- rawExpression = RawExpression\
77
- .new(fei, nil, nil, @application_context, xmldef)
78
-
79
- rawExpression.apply(wi)
80
- end
81
-
82
- #
83
- # launches a subprocess
84
- #
85
- def launch_template \
86
- (requesting_expression, template_fei, workitem, params)
87
-
88
- ldebug { "launch() request for #{template_fei.to_debug_s}" }
89
-
90
- rawexp = fetch(template_fei)
91
- rawexp = rawexp.dup()
92
- rawexp.fei = rawexp.fei.dup()
93
-
94
- if requesting_expression.kind_of? OpenWFE::FlowExpressionId
95
- rawexp.parent_id = requesting_expression
96
- rawexp.fei.workflowInstanceId = \
97
- "#{requesting_expression.workflowInstanceId}.0"
98
- elsif requesting_expression.kind_of? String
99
- rawexp.parent_id = nil
100
- rawexp.fei.workflowInstanceId = \
101
- "#{requesting_expression}.0"
102
- else # kind is FlowExpression
103
- rawexp.parent_id = requesting_expression.fei
104
- rawexp.fei.workflowInstanceId = \
105
- "#{requesting_expression.fei.workflowInstanceId}.0"
106
- end
107
-
108
- #ldebug do
109
- # "launch_template() spawning wfid " +
110
- # "#{rawexp.fei.workflowInstanceId.to_s}"
111
- #end
112
-
113
- env = rawexp.new_environment()
114
- params.each { |k, v| env[k] = v } if params
115
- #
116
- # the new scope gets its own environment
117
-
118
- rawexp.store_itself()
119
-
120
- rawexp.apply(workitem)
121
- end
122
-
123
- #
124
- # Evaluates a raw definition expression and
125
- # returns its body fei
126
- #
127
- def evaluate (rawExpression, workitem)
128
- exp = rawExpression.instantiate_real_expression(workitem)
129
- fei = exp.evaluate(workitem)
130
- remove(rawExpression)
131
- return fei
132
- end
133
-
134
- #
135
- # Applies a given expression (id or expression)
136
- #
137
- def apply (exp, workitem)
138
-
139
- exp = fetch(exp) if exp.kind_of? OpenWFE::FlowExpressionId
140
-
141
- ldebug { "apply() #{exp.fei.to_debug_s}" }
142
-
143
- workitem.lastExpressionId = exp.fei
144
-
145
- exp.apply(workitem)
146
- end
147
-
148
- #
149
- # Cancels the given expression
150
- #
151
- def cancel (exp)
152
- exp = fetch(exp) if exp.kind_of? OpenWFE::FlowExpressionId
153
- inflowitem = exp.cancel()
154
- remove(exp)
155
- return inflowitem
156
- end
157
-
158
- #
159
- # Replies to the parent of the given expression.
160
- #
161
- def reply_to_parent (flowExpression, workitem)
162
-
163
- workitem.lastExpressionId = flowExpression.fei
164
-
165
- remove(flowExpression)
166
-
167
- if flowExpression.parent_id
168
- reply(flowExpression.parent_id, workitem)
169
- else
170
- ldebug do
171
- "reply_to_parent() process #{flowExpression.fei.workflowInstanceId} terminated"
172
- #get_expression_storage().to_s
173
- end
174
- end
175
- end
176
-
177
- #
178
- # Triggers the reply expression of the expression given by its id.
179
- #
180
- def reply (flowExpressionId, workitem)
181
-
182
- ldebug { "reply() to #{flowExpressionId.to_debug_s}" }
183
- ldebug { "reply() from #{workitem.last_expression_id}" }
184
-
185
- exp = fetch(flowExpressionId)
186
-
187
- if not exp
188
- #raise \
189
- # "cannot reply to missing expression " +
190
- # flowExpressionId.to_debug_s
191
- lwarn do
192
- "reply() cannot reply to missing "+
193
- flowExpressionId.to_debug_s
194
- end
195
- return
196
- end
197
-
198
- exp.reply(workitem)
199
- end
200
-
201
- #
202
- # Adds or updates a flow expression in this pool
203
- #
204
- def update (flowExpression)
205
-
206
- get_expression_storage()[flowExpression.fei] = flowExpression
207
-
208
- #ldebug do
209
- # "update() sz #{get_expression_storage.length} "+
210
- # "#{flowExpression.fei.to_debug_s}"
211
- #end
212
-
213
- #ldebug do
214
- # "update() sz #{get_expression_storage.length} "+
215
- # "#{flowExpression.fei.to_s}\n"+
216
- # get_expression_storage().to_s
217
- #end
218
-
219
- #ldebug { "update()\n" + get_expression_storage().to_s }
220
- end
221
-
222
- #
223
- # Fetches a flowExpression from the pool
224
- #
225
- def fetch (flowExpressionId)
226
-
227
- exp = get_expression_storage()[flowExpressionId]
228
-
229
- #ldebug { "fetch() did not find #{flowExpressionId.to_debug_s}" } \
230
- # if not exp
231
-
232
- return exp
233
- end
234
-
235
- def fetch_engine_environment ()
236
- synchronize do
237
- eei = engine_environment_id
238
- ee = fetch(eei)
239
-
240
- if not ee
241
- ee = Environment\
242
- .new(eei, nil, nil, @application_context, nil)
243
- ee.store_itself()
244
- end
245
-
246
- ldebug { "fetch_engine_environment() stored new ee" }
247
-
248
- return ee
249
- end
250
- end
251
-
252
- #
253
- # Removes a flow expression from the pool
254
- # (This method is mainly called from the pool itself)
255
- #
256
- def remove (flowExpression)
257
-
258
- if flowExpression.kind_of? OpenWFE::FlowExpressionId
259
- ldebug { "remove() fei #{flowExpression.to_debug_s}" }
260
- flowExpression = fetch(flowExpression)
261
- end
262
-
263
- return if not flowExpression
264
-
265
- ldebug { "remove() fe #{flowExpression.fei.to_debug_s}" }
266
-
267
- #ldebug do
268
- # "remove() #{flowExpression.fei.to_debug_s}"
269
- # #"remove() sz before #{get_expression_storage.length}\n" +
270
- # #get_expression_storage().to_s
271
- #end
272
-
273
- get_expression_storage().delete(flowExpression.fei)
274
-
275
- if flowExpression.owns_its_environment?
276
- remove_environment(flowExpression.environment_id)
277
- end
278
-
279
- #ldebug do
280
- # "remove() sz after #{get_expression_storage.length}\n" +
281
- # get_expression_storage().to_s
282
- #end
283
- end
284
-
285
- def engine_environment_id ()
286
- synchronize do
287
- return @eei if @eei
288
- @eei = OpenWFE::FlowExpressionId.new
289
- @eei.owfeVersion = OPENWFE_VERSION
290
- @eei.engineId = lookup(Engine).service_name
291
- @eei.initialEngineId = @eei.engineId
292
- @eei.workflowDefinitionUrl = 'ee'
293
- @eei.workflowDefinitionName = 'ee'
294
- @eei.workflowDefinitionRevision = '0'
295
- @eei.workflowInstanceId = '0'
296
- @eei.expressionName = EN_ENVIRONMENT
297
- @eei.expressionId = '0'
298
- return @eei
299
- end
300
- end
301
-
302
- def get_expression_storage ()
303
- return @application_context[S_EXPRESSION_STORAGE]
304
- end
305
-
306
- protected
307
-
308
- def evaluate_definition (raw_definition, workitem)
309
- expression = raw_definition.instantiate(workitem)
310
- end
311
-
312
- def remove_environment (environment_id)
313
- env = fetch(environment_id)
314
- env.unbind()
315
- get_expression_storage().delete(environment_id)
316
- end
317
-
318
- def build_workitem (launchitem)
319
-
320
- wi = OpenWFE::InFlowWorkItem.new()
321
-
322
- wi.attributes = launchitem.attributes.dup()
323
-
324
- return wi
325
- end
326
-
327
- def fetch_definition (launchitem)
328
-
329
- wfdUrl = launchitem.workflowDefinitionUrl
330
-
331
- #ldebug { "wfdUrl is '#{wfdUrl}'" }
332
-
333
- sDefinition = nil
334
-
335
- if wfdUrl[0..5] == 'field:'
336
- sDefinition = launchitem.attributes[wfdUrl[6..-1]]
337
- else
338
- sDefinition = NET::HTTP.get(URI.parse(wfdUrl))
339
- end
340
-
341
- #ldebug { "sDefinition is \n#{sDefinition}" }
342
-
343
- return REXML::Document.new(sDefinition).root
344
- end
345
-
346
- def new_fei (flow_url, xml_element)
347
-
348
- fei = OpenWFE::FlowExpressionId.new
349
-
350
- fei.owfeVersion = OPENWFE_VERSION
351
-
352
- fei.engineId = lookup(Engine).service_name
353
- fei.initialEngineId = fei.engineId
354
-
355
- fei.workflowDefinitionUrl = flow_url
356
-
357
- fei.workflowDefinitionName = \
358
- xml_element.attributes['name'].to_str
359
- fei.workflowDefinitionRevision = \
360
- xml_element.attributes['revision'].to_str
361
-
362
- fei.workflowInstanceId = new_workflow_instance_id()
363
-
364
- fei.expressionId = "0"
365
- fei.expressionName = xml_element.name
366
-
367
- return fei
368
- end
369
-
370
- def new_workflow_instance_id ()
371
- synchronize do
372
- wfid = OpenWFE::current_time_millis()
373
- wfid = wfid + 1 if wfid == @@last_given_instance_id
374
- @@last_given_instance_id = wfid
375
- return wfid.to_s
376
- end
377
- end
378
-
379
- end
380
-
381
- end
382
-