openwferu 0.9.7 → 0.9.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. data/examples/engine_template.rb +182 -0
  2. data/examples/openwferu.rb +6 -7
  3. data/lib/openwfe/contextual.rb +8 -6
  4. data/lib/openwfe/engine/engine.rb +49 -14
  5. data/lib/openwfe/expool/expressionpool.rb +48 -17
  6. data/lib/openwfe/expool/history.rb +64 -14
  7. data/lib/openwfe/expool/journal.rb +66 -28
  8. data/lib/openwfe/expool/journal_replay.rb +190 -48
  9. data/lib/openwfe/expool/wfidgen.rb +51 -6
  10. data/lib/openwfe/expressions/condition.rb +49 -5
  11. data/lib/openwfe/expressions/environment.rb +9 -37
  12. data/lib/openwfe/expressions/expressionmap.rb +15 -1
  13. data/lib/openwfe/expressions/fe_concurrence.rb +4 -4
  14. data/lib/openwfe/expressions/fe_cron.rb +1 -5
  15. data/lib/openwfe/expressions/fe_do.rb +96 -26
  16. data/lib/openwfe/expressions/fe_equals.rb +190 -0
  17. data/lib/openwfe/expressions/fe_fqv.rb +25 -7
  18. data/lib/openwfe/expressions/fe_if.rb +262 -0
  19. data/lib/openwfe/expressions/fe_iterator.rb +3 -4
  20. data/lib/openwfe/expressions/fe_losfor.rb +0 -1
  21. data/lib/openwfe/expressions/fe_misc.rb +4 -5
  22. data/lib/openwfe/expressions/fe_participant.rb +2 -3
  23. data/lib/openwfe/expressions/fe_raw.rb +71 -31
  24. data/lib/openwfe/expressions/fe_reserve.rb +141 -0
  25. data/lib/openwfe/expressions/fe_sequence.rb +0 -1
  26. data/lib/openwfe/expressions/fe_sleep.rb +3 -58
  27. data/lib/openwfe/expressions/fe_subprocess.rb +6 -5
  28. data/lib/openwfe/expressions/fe_value.rb +20 -121
  29. data/lib/openwfe/expressions/fe_wait.rb +79 -0
  30. data/lib/openwfe/expressions/fe_when.rb +31 -96
  31. data/lib/openwfe/expressions/flowexpression.rb +112 -19
  32. data/lib/openwfe/expressions/raw_prog.rb +8 -116
  33. data/lib/openwfe/expressions/simplerep.rb +197 -0
  34. data/lib/openwfe/expressions/time.rb +266 -0
  35. data/lib/openwfe/expressions/timeout.rb +2 -2
  36. data/lib/openwfe/flowexpressionid.rb +22 -0
  37. data/lib/openwfe/listeners/socketlisteners.rb +15 -1
  38. data/lib/openwfe/participants/participantmap.rb +12 -1
  39. data/lib/openwfe/participants/participants.rb +7 -1
  40. data/lib/openwfe/rudefinitions.rb +1 -6
  41. data/lib/openwfe/service.rb +8 -0
  42. data/lib/openwfe/util/irb.rb +86 -0
  43. data/lib/openwfe/util/ometa.rb +3 -3
  44. data/lib/openwfe/util/safe.rb +26 -34
  45. data/lib/openwfe/util/scheduler.rb +133 -76
  46. data/lib/openwfe/utils.rb +1 -1
  47. data/lib/openwfe/version.rb +2 -2
  48. data/lib/openwfe/workitem.rb +38 -0
  49. data/lib/openwfe/worklist/storeparticipant.rb +27 -2
  50. data/test/console_test.rb +15 -0
  51. data/test/flowtestbase.rb +20 -28
  52. data/test/ft_12_blockparticipant.rb +24 -0
  53. data/test/ft_14b_subprocess.rb +18 -0
  54. data/test/ft_22_history.rb +22 -1
  55. data/test/ft_23_when.rb +29 -2
  56. data/test/ft_23b_when.rb +17 -0
  57. data/test/ft_23c_wait.rb +87 -0
  58. data/test/ft_2_concurrence.rb +15 -14
  59. data/test/ft_2b_concurrence.rb +4 -4
  60. data/test/ft_32_journal.rb +29 -6
  61. data/test/ft_32b_journal.rb +76 -0
  62. data/test/ft_36_subprocids.rb +96 -0
  63. data/test/ft_37_pnames.rb +55 -0
  64. data/test/ft_38_tag.rb +128 -0
  65. data/test/ft_39_reserve.rb +119 -0
  66. data/test/ft_3_equals.rb +20 -1
  67. data/test/ft_40_defined.rb +72 -0
  68. data/test/ft_41_case.rb +124 -0
  69. data/test/ft_4_misc.rb +17 -0
  70. data/test/ft_5_time.rb +15 -20
  71. data/test/ft_7_lose.rb +2 -3
  72. data/test/ft_8_forget.rb +1 -1
  73. data/test/ft_tests.rb +9 -0
  74. data/test/hparticipant_test.rb +47 -1
  75. data/test/nut_0_irb.rb +20 -0
  76. data/test/raw_prog_test.rb +6 -0
  77. data/test/safely_test.rb +31 -41
  78. data/test/wfid_test.rb +43 -0
  79. metadata +21 -4
  80. data/lib/openwfe/expressions/fe_utils.rb +0 -151
data/test/wfid_test.rb CHANGED
@@ -14,6 +14,8 @@
14
14
  require 'test/unit'
15
15
 
16
16
  require 'openwfe/utils'
17
+ require 'openwfe/workitem'
18
+ require 'openwfe/engine/engine'
17
19
  require 'openwfe/expool/wfidgen'
18
20
 
19
21
 
@@ -121,4 +123,45 @@ class WfidTest < Test::Unit::TestCase
121
123
  #puts OpenWFE::KotobaWfidGenerator.to_time(kid)
122
124
  end
123
125
 
126
+
127
+ #
128
+ # test FieldWfidGenerator
129
+
130
+ class MyEngine < OpenWFE::Engine
131
+
132
+ def build_wfid_generator
133
+
134
+ g = FieldWfidGenerator.new(
135
+ S_WFID_GENERATOR, @application_context, "wfid")
136
+ end
137
+ end
138
+
139
+ class MyProcDef < OpenWFE::ProcessDefinition
140
+ sequence do
141
+ # do nothing
142
+ end
143
+ end
144
+
145
+ def test_field_wfid
146
+
147
+ eng = MyEngine.new
148
+
149
+ li = OpenWFE::LaunchItem.new(MyProcDef)
150
+ li.wfid = "toto"
151
+ fei = eng.launch(li)
152
+
153
+ assert_equal fei.wfid, "toto"
154
+
155
+ li = OpenWFE::LaunchItem.new(MyProcDef)
156
+ fei = eng.launch(li)
157
+
158
+ #puts fei.wfid
159
+
160
+ assert_not_equal fei.wfid, "toto"
161
+
162
+ t = OpenWFE::KotobaWfidGenerator.to_time(fei.wfid)
163
+
164
+ assert t.is_a?(Time)
165
+ end
166
+
124
167
  end
metadata CHANGED
@@ -3,13 +3,13 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: openwferu
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.9.7
7
- date: 2007-03-23 00:00:00 +09:00
6
+ version: 0.9.8
7
+ date: 2007-04-04 00:00:00 +09:00
8
8
  summary: an open source ruby workflow and bpm engine
9
9
  require_paths:
10
10
  - lib
11
11
  email: john at openwfe dot org
12
- homepage: http://rubyforge.org/projects/openwferu
12
+ homepage: http://openwferu.rubyforge.org
13
13
  rubyforge_project:
14
14
  description:
15
15
  autorequire: openwferu
@@ -72,21 +72,26 @@ files:
72
72
  - lib/openwfe/expressions/fe_cursor.rb
73
73
  - lib/openwfe/expressions/fe_define.rb
74
74
  - lib/openwfe/expressions/fe_do.rb
75
+ - lib/openwfe/expressions/fe_equals.rb
75
76
  - lib/openwfe/expressions/fe_fqv.rb
77
+ - lib/openwfe/expressions/fe_if.rb
76
78
  - lib/openwfe/expressions/fe_iterator.rb
77
79
  - lib/openwfe/expressions/fe_losfor.rb
78
80
  - lib/openwfe/expressions/fe_misc.rb
79
81
  - lib/openwfe/expressions/fe_participant.rb
80
82
  - lib/openwfe/expressions/fe_raw.rb
83
+ - lib/openwfe/expressions/fe_reserve.rb
81
84
  - lib/openwfe/expressions/fe_sequence.rb
82
85
  - lib/openwfe/expressions/fe_sleep.rb
83
86
  - lib/openwfe/expressions/fe_subprocess.rb
84
- - lib/openwfe/expressions/fe_utils.rb
85
87
  - lib/openwfe/expressions/fe_value.rb
88
+ - lib/openwfe/expressions/fe_wait.rb
86
89
  - lib/openwfe/expressions/fe_when.rb
87
90
  - lib/openwfe/expressions/flowexpression.rb
88
91
  - lib/openwfe/expressions/raw_prog.rb
89
92
  - lib/openwfe/expressions/raw_xml.rb
93
+ - lib/openwfe/expressions/simplerep.rb
94
+ - lib/openwfe/expressions/time.rb
90
95
  - lib/openwfe/expressions/timeout.rb
91
96
  - lib/openwfe/expressions/wtemplate.rb
92
97
  - lib/openwfe/listeners/listener.rb
@@ -114,6 +119,7 @@ files:
114
119
  - lib/openwfe/tools/flowtracer.rb
115
120
  - lib/openwfe/util/csvtable.rb
116
121
  - lib/openwfe/util/dollar.rb
122
+ - lib/openwfe/util/irb.rb
117
123
  - lib/openwfe/util/kotoba.rb
118
124
  - lib/openwfe/util/lru.rb
119
125
  - lib/openwfe/util/observable.rb
@@ -125,6 +131,7 @@ files:
125
131
  - lib/openwfe/util/sqs.rb
126
132
  - lib/openwfe/worklist/storeparticipant.rb
127
133
  - test/atom_test.rb
134
+ - test/console_test.rb
128
135
  - test/cron_test.rb
129
136
  - test/cronline_test.rb
130
137
  - test/csv_test.rb
@@ -157,6 +164,7 @@ files:
157
164
  - test/ft_22_history.rb
158
165
  - test/ft_23_when.rb
159
166
  - test/ft_23b_when.rb
167
+ - test/ft_23c_wait.rb
160
168
  - test/ft_24_def.rb
161
169
  - test/ft_25_cancel.rb
162
170
  - test/ft_26_load.rb
@@ -169,10 +177,17 @@ files:
169
177
  - test/ft_30_socketlistener.rb
170
178
  - test/ft_31_flowname.rb
171
179
  - test/ft_32_journal.rb
180
+ - test/ft_32b_journal.rb
172
181
  - test/ft_33_description.rb
173
182
  - test/ft_34_cancelwfid.rb
174
183
  - test/ft_35_localdefs.rb
184
+ - test/ft_36_subprocids.rb
185
+ - test/ft_37_pnames.rb
186
+ - test/ft_38_tag.rb
187
+ - test/ft_39_reserve.rb
175
188
  - test/ft_3_equals.rb
189
+ - test/ft_40_defined.rb
190
+ - test/ft_41_case.rb
176
191
  - test/ft_4_misc.rb
177
192
  - test/ft_5_time.rb
178
193
  - test/ft_6_lambda.rb
@@ -186,6 +201,7 @@ files:
186
201
  - test/kotoba_test.rb
187
202
  - test/lru_test.rb
188
203
  - test/misc_test.rb
204
+ - test/nut_0_irb.rb
189
205
  - test/param_test.rb
190
206
  - test/rake_qtest.rb
191
207
  - test/rake_test.rb
@@ -205,6 +221,7 @@ files:
205
221
  - test/timeout_test.rb
206
222
  - test/wfid_test.rb
207
223
  - test/wi_test.rb
224
+ - examples/engine_template.rb
208
225
  - examples/flowtracing.rb
209
226
  - examples/homeworkreview.rb
210
227
  - examples/mano_tracker.rb
@@ -1,151 +0,0 @@
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/util/dollar'
44
- require 'openwfe/expressions/fe_raw'
45
-
46
- #
47
- # a few help methods for expressions
48
-
49
- module OpenWFE
50
-
51
- #
52
- # Returns the text stored as the children of the given expression
53
- #
54
- def OpenWFE.fetch_text_content (expression, workitem, escape=false)
55
-
56
- text = ""
57
-
58
- expression.children.each do |child|
59
- if child.kind_of?(RawExpression)
60
- text << child.fei.to_s
61
- else
62
- text << child.to_s
63
- end
64
- #text << "\n"
65
- end
66
-
67
- text = dosub(text, expression, workitem) \
68
- unless escape
69
-
70
- return text
71
- end
72
-
73
- #
74
- # looks up for 'value', 'variable-value' and then for 'field-value'
75
- # if necessary.
76
- #
77
- def OpenWFE.lookup_value (flow_expression, workitem, prefix='')
78
-
79
- return OpenWFE\
80
- .lookup_vf_attribute(flow_expression, workitem, 'value', prefix)
81
- end
82
-
83
- #
84
- # looks up for 'ref', 'variable-ref' and then for 'field-ref'
85
- # if necessary.
86
- #
87
- def OpenWFE.lookup_ref (flow_expression, workitem, prefix='')
88
-
89
- return OpenWFE\
90
- .lookup_vf_attribute(flow_expression, workitem, 'ref', prefix)
91
- end
92
-
93
- #
94
- # Looks up for value attributes like 'field-ref' or 'variable-value'
95
- #
96
- def OpenWFE.lookup_vf_attribute \
97
- (flow_expression, workitem, att_name, prefix='')
98
-
99
- prefix = "#{prefix.to_s}-" if prefix != ''
100
-
101
- v = flow_expression.lookup_attribute("#{prefix}#{att_name}", workitem)
102
-
103
- return v if v
104
-
105
- v = flow_expression\
106
- .lookup_attribute("#{prefix}variable-#{att_name}", workitem)
107
-
108
- return flow_expression.lookup_variable(v) if v
109
-
110
- v = flow_expression\
111
- .lookup_attribute("#{prefix}field-#{att_name}", workitem)
112
-
113
- return workitem.attributes[v] if v
114
-
115
- return nil
116
- end
117
-
118
- #
119
- # Looks up for a value, a variable or a field (in that order).
120
- #
121
- #def OpenWFE.lookup_vvf_attribute (flow_expression, workitem, prefix)
122
- # raise "missing prefix" unless prefix
123
- # v = flow_expression.lookup_attribute("#{prefix}-value", workitem)
124
- # return v if v
125
- # v = flow_expression.lookup_attribute("#{prefix}-variable", workitem)
126
- # return flow_expression.lookup_variable(v) if v
127
- # v = flow_expression.lookup_attribute("#{prefix}-field", workitem)
128
- # return workitem.attributes[v] if v
129
- # return nil
130
- #end
131
-
132
- #
133
- # sets the '__result__' field of the workitem
134
- #
135
- def OpenWFE.set_result (workitem, result)
136
-
137
- workitem.attributes[FIELD_RESULT] = result
138
- end
139
-
140
- #
141
- # Just a shortcut (for consistency) of
142
- #
143
- # workitem.attributes["__result__"]
144
- #
145
- def OpenWFE.get_result (workitem)
146
-
147
- workitem.attributes[FIELD_RESULT]
148
- end
149
-
150
- end
151
-