openwferu 0.9.16 → 0.9.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (184) hide show
  1. data/examples/about_state.rb +81 -0
  2. data/examples/engine_template.rb +7 -0
  3. data/lib/openwfe/contextual.rb +2 -2
  4. data/lib/openwfe/def.rb +2 -3
  5. data/lib/openwfe/{util/schedulers.rb → engine.rb} +3 -39
  6. data/lib/openwfe/engine/engine.rb +202 -251
  7. data/lib/openwfe/engine/process_status.rb +359 -0
  8. data/lib/openwfe/expool/errorjournal.rb +6 -6
  9. data/lib/openwfe/expool/expressionpool.rb +161 -239
  10. data/lib/openwfe/expool/expstorage.rb +185 -55
  11. data/lib/openwfe/expool/journal.rb +1 -2
  12. data/lib/openwfe/expool/parser.rb +233 -0
  13. data/lib/openwfe/expool/threadedexpstorage.rb +6 -18
  14. data/lib/openwfe/expool/wfidgen.rb +25 -7
  15. data/lib/openwfe/expool/yamlexpstorage.rb +60 -37
  16. data/lib/openwfe/expressions/condition.rb +49 -12
  17. data/lib/openwfe/expressions/environment.rb +45 -15
  18. data/lib/openwfe/expressions/expressionmap.rb +39 -19
  19. data/lib/openwfe/expressions/fe_concurrence.rb +24 -13
  20. data/lib/openwfe/expressions/fe_cron.rb +19 -18
  21. data/lib/openwfe/expressions/fe_cursor.rb +69 -28
  22. data/lib/openwfe/expressions/fe_define.rb +4 -1
  23. data/lib/openwfe/expressions/fe_do.rb +1 -3
  24. data/lib/openwfe/expressions/fe_equals.rb +131 -20
  25. data/lib/openwfe/expressions/fe_fqv.rb +27 -3
  26. data/lib/openwfe/expressions/fe_iterator.rb +14 -7
  27. data/lib/openwfe/expressions/fe_listen.rb +7 -2
  28. data/lib/openwfe/expressions/fe_misc.rb +187 -20
  29. data/lib/openwfe/expressions/fe_participant.rb +8 -7
  30. data/lib/openwfe/expressions/fe_reserve.rb +105 -33
  31. data/lib/openwfe/expressions/fe_save.rb +55 -5
  32. data/lib/openwfe/expressions/{fe_value.rb → fe_set.rb} +6 -82
  33. data/lib/openwfe/expressions/fe_sleep.rb +25 -15
  34. data/lib/openwfe/expressions/fe_subprocess.rb +2 -2
  35. data/lib/openwfe/expressions/fe_wait.rb +3 -2
  36. data/lib/openwfe/expressions/fe_when.rb +7 -15
  37. data/lib/openwfe/expressions/flowexpression.rb +90 -49
  38. data/lib/openwfe/expressions/merge.rb +7 -1
  39. data/lib/openwfe/expressions/raw.rb +261 -63
  40. data/lib/openwfe/expressions/{raw_prog.rb → rprocdef.rb} +94 -179
  41. data/lib/openwfe/expressions/time.rb +36 -12
  42. data/lib/openwfe/expressions/timeout.rb +9 -7
  43. data/lib/openwfe/expressions/value.rb +126 -0
  44. data/lib/openwfe/flowexpressionid.rb +52 -22
  45. data/lib/openwfe/listeners/listeners.rb +3 -3
  46. data/lib/openwfe/listeners/socketlisteners.rb +8 -5
  47. data/lib/openwfe/logging.rb +6 -3
  48. data/lib/openwfe/omixins.rb +8 -6
  49. data/lib/openwfe/orest/xmlcodec.rb +16 -12
  50. data/lib/openwfe/participants.rb +38 -0
  51. data/lib/openwfe/participants/participant.rb +1 -1
  52. data/lib/openwfe/participants/participantmap.rb +24 -10
  53. data/lib/openwfe/participants/participants.rb +4 -3
  54. data/lib/openwfe/participants/soapparticipants.rb +1 -1
  55. data/lib/openwfe/participants/socketparticipants.rb +1 -1
  56. data/lib/openwfe/rudefinitions.rb +7 -5
  57. data/lib/openwfe/storage/yamlcustom.rb +10 -10
  58. data/lib/openwfe/storage/yamlfilestorage.rb +12 -12
  59. data/lib/openwfe/tools/flowtracer.rb +6 -5
  60. data/lib/openwfe/util/dollar.rb +42 -85
  61. data/lib/openwfe/util/ometa.rb +1 -3
  62. data/lib/openwfe/util/workqueue.rb +1 -1
  63. data/lib/openwfe/utils.rb +33 -11
  64. data/lib/openwfe/version.rb +2 -2
  65. data/lib/openwfe/workitem.rb +76 -14
  66. data/lib/openwfe/worklist/storelocks.rb +9 -4
  67. data/lib/openwfe/worklist/storeparticipant.rb +1 -1
  68. data/test/back_0916_test.rb +101 -0
  69. data/test/bm/ft_26_load.rb +1 -1
  70. data/test/bm/ft_26b_load.rb +1 -1
  71. data/test/bm/ft_26c_load.rb +3 -2
  72. data/test/bm/ft_26d_load.rb +97 -0
  73. data/test/bm/ft_recu.rb +71 -0
  74. data/test/concurrence_test.rb +1 -1
  75. data/test/condition_test.rb +152 -0
  76. data/test/description_test.rb +12 -7
  77. data/test/eno_test.rb +1 -1
  78. data/test/expool_20031219_0916.tgz +0 -0
  79. data/test/fe_lookup_att_test.rb +1 -1
  80. data/test/fei_test.rb +16 -0
  81. data/test/file_persistence_test.rb +8 -12
  82. data/test/filep_cancel_test.rb +116 -0
  83. data/test/flowtestbase.rb +47 -25
  84. data/test/ft_0.rb +1 -1
  85. data/test/ft_10_loop.rb +29 -14
  86. data/test/{ft_10b_loop2.rb → ft_10b_loop.rb} +2 -11
  87. data/test/ft_11_ppd.rb +6 -17
  88. data/test/ft_11b_ppd.rb +1 -4
  89. data/test/ft_12_blockparticipant.rb +1 -1
  90. data/test/ft_13_eno.rb +1 -1
  91. data/test/ft_15_iterator.rb +1 -1
  92. data/test/ft_15b_iterator.rb +1 -1
  93. data/test/ft_17_condition.rb +6 -6
  94. data/test/ft_18_pname.rb +1 -1
  95. data/test/ft_20_cron.rb +1 -1
  96. data/test/ft_21_cron.rb +6 -4
  97. data/test/ft_22_history.rb +1 -1
  98. data/test/ft_23_when.rb +1 -1
  99. data/test/ft_23b_when.rb +18 -6
  100. data/test/ft_23c_wait.rb +8 -6
  101. data/test/ft_25_cancel.rb +7 -5
  102. data/test/ft_27_getflowpos.rb +22 -17
  103. data/test/ft_28_fileparticipant.rb +1 -2
  104. data/test/ft_2_concurrence.rb +1 -1
  105. data/test/ft_2b_concurrence.rb +25 -20
  106. data/test/ft_30_socketlistener.rb +0 -3
  107. data/test/ft_34_cancelwfid.rb +9 -9
  108. data/test/ft_35_localdefs.rb +0 -1
  109. data/test/ft_36_subprocids.rb +6 -6
  110. data/test/ft_38_tag.rb +3 -2
  111. data/test/ft_38b_tag.rb +229 -0
  112. data/test/ft_39_reserve.rb +3 -18
  113. data/test/ft_39b_reserve.rb +34 -5
  114. data/test/ft_3b_lookup_vf.rb +83 -0
  115. data/test/ft_40_defined.rb +2 -11
  116. data/test/ft_42_environments.rb +4 -6
  117. data/test/ft_44b_restore.rb +88 -22
  118. data/test/ft_45_citerator.rb +57 -11
  119. data/test/ft_49_condition.rb +4 -2
  120. data/test/ft_4_misc.rb +24 -3
  121. data/test/ft_50_xml_attribute.rb +17 -20
  122. data/test/ft_54_listen.rb +1 -1
  123. data/test/ft_54b_listen.rb +2 -2
  124. data/test/ft_56_timeout.rb +8 -1
  125. data/test/ft_57_a.rb +10 -10
  126. data/test/ft_59_ps.rb +49 -16
  127. data/test/ft_60_ecancel.rb +52 -10
  128. data/test/ft_63_pause.rb +8 -8
  129. data/test/ft_65_stringlaunch.rb +4 -6
  130. data/test/ft_67_schedlaunch.rb +4 -4
  131. data/test/ft_69_cancelmissing.rb +4 -2
  132. data/test/ft_70_lookupvar.rb +2 -2
  133. data/test/ft_72_lookup_processes.rb +2 -2
  134. data/test/ft_73_cancel_sub.rb +8 -8
  135. data/test/ft_77_segments.rb +38 -0
  136. data/test/ft_78_eval.rb +154 -0
  137. data/test/ft_79_tticket.rb +185 -0
  138. data/test/ft_80_spname.rb +95 -0
  139. data/test/ft_81_exp.rb +64 -0
  140. data/test/ft_82_trecu.rb +48 -0
  141. data/test/ft_83_badpause.rb +62 -0
  142. data/test/ft_84_updateexp.rb +125 -0
  143. data/test/ft_9b_cursor.rb +105 -0
  144. data/test/ft_tests.rb +14 -1
  145. data/test/hash_test.rb +7 -7
  146. data/test/hparticipant_test.rb +4 -4
  147. data/test/lookup_vf_test.rb +94 -0
  148. data/test/misc_test.rb +5 -3
  149. data/test/orest_test.rb +4 -3
  150. data/test/param_test.rb +12 -16
  151. data/test/participant_test.rb +36 -0
  152. data/test/pending.rb +10 -10
  153. data/test/rake_ltest.rb +1 -10
  154. data/test/rake_qtest.rb +7 -6
  155. data/test/raw_prog_test.rb +89 -121
  156. data/test/restart_cron_test.rb +84 -36
  157. data/test/restart_paused_test.rb +100 -0
  158. data/test/restart_sleep_test.rb +1 -1
  159. data/test/restart_tests.rb +1 -0
  160. data/test/restart_when_test.rb +33 -22
  161. data/test/ruby_procdef_test.rb +19 -18
  162. data/test/sec_test.rb +74 -35
  163. data/test/storage_test.rb +44 -0
  164. data/test/test.rb +3 -0
  165. data/test/timeout_test.rb +7 -18
  166. data/test/wfid_test.rb +2 -1
  167. data/test/wi_test.rb +29 -18
  168. metadata +121 -57
  169. data/lib/openwfe/expressions/raw_xml.rb +0 -176
  170. data/lib/openwfe/expressions/simplerep.rb +0 -266
  171. data/lib/openwfe/util/kotoba.rb +0 -236
  172. data/lib/openwfe/util/lru.rb +0 -171
  173. data/lib/openwfe/util/otime.rb +0 -246
  174. data/lib/openwfe/util/safe.rb +0 -160
  175. data/lib/openwfe/util/scheduler.rb +0 -1158
  176. data/test/cron_test.rb +0 -113
  177. data/test/cronline_test.rb +0 -60
  178. data/test/dollar_test.rb +0 -90
  179. data/test/kotoba_test.rb +0 -72
  180. data/test/lru_test.rb +0 -79
  181. data/test/safely_test.rb +0 -84
  182. data/test/scheduler_1_test.rb +0 -88
  183. data/test/scheduler_test.rb +0 -363
  184. data/test/time_test.rb +0 -84
@@ -1,6 +1,6 @@
1
1
  #
2
2
  #--
3
- # Copyright (c) 2007, John Mettraux, OpenWFE.org
3
+ # Copyright (c) 2007-2008, John Mettraux, OpenWFE.org
4
4
  # All rights reserved.
5
5
  #
6
6
  # Redistribution and use in source and binary forms, with or without
@@ -37,8 +37,7 @@
37
37
  # John Mettraux at openwfe.org
38
38
  #
39
39
 
40
- require 'openwfe/util/otime'
41
- require 'openwfe/util/scheduler'
40
+ require 'rufus/otime'
42
41
 
43
42
 
44
43
  #
@@ -52,7 +51,7 @@ module OpenWFE
52
51
  # to mix it in into ParticipantExpression and WhenExpression.
53
52
  #
54
53
  module TimeoutMixin
55
- include Schedulable
54
+ include Rufus::Schedulable
56
55
 
57
56
  attr_accessor \
58
57
  :timeout_at,
@@ -70,7 +69,7 @@ module OpenWFE
70
69
  timeout = lookup_attribute(timeout_attname, @applied_workitem)
71
70
  return unless timeout
72
71
 
73
- timeout = OpenWFE::parse_time_string(timeout)
72
+ timeout = Rufus::parse_time_string(timeout)
74
73
  @timeout_at = Time.new.to_f + timeout
75
74
  end
76
75
 
@@ -92,7 +91,7 @@ module OpenWFE
92
91
  to_reschedule(get_scheduler)
93
92
  end
94
93
 
95
- #
94
+ #--
96
95
  # Overrides the parent method to make sure a potential
97
96
  # timeout schedules gets removed.
98
97
  #
@@ -103,11 +102,13 @@ module OpenWFE
103
102
  # unschedule_timeout()
104
103
  # super(workitem)
105
104
  #end
105
+ #++
106
106
 
107
107
  #
108
108
  # Places a "__timed_out__" field in the workitem.
109
109
  #
110
110
  def set_timedout_flag (workitem)
111
+
111
112
  workitem.attributes["__timed_out__"] = "true"
112
113
  end
113
114
 
@@ -115,6 +116,7 @@ module OpenWFE
115
116
  # Removes any "__timed_out__" field in the workitem.
116
117
  #
117
118
  def remove_timedout_flag (workitem)
119
+
118
120
  workitem.attributes.delete("__timed_out__")
119
121
  end
120
122
 
@@ -144,7 +146,7 @@ module OpenWFE
144
146
 
145
147
  ldebug do
146
148
  "to_reschedule() will timeout at " +
147
- "#{OpenWFE::to_iso8601_date(@timeout_at)}" +
149
+ "#{Rufus::to_iso8601_date(@timeout_at)}" +
148
150
  " @timeout_job_id is #{@timeout_job_id}" +
149
151
  " (oid #{object_id})"
150
152
  end
@@ -0,0 +1,126 @@
1
+ #
2
+ #--
3
+ # Copyright (c) 2006-2008, 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
+
34
+ #
35
+ # "made in Japan"
36
+ #
37
+ # John Mettraux at openwfe.org
38
+ #
39
+
40
+ module OpenWFE
41
+
42
+ #
43
+ # A small mixin providing value for looking up the attributes
44
+ # variable/var/v and field/fld/f.
45
+ #
46
+ module ValueMixin
47
+
48
+ #
49
+ # Expressions that include the ValueMixin let it gather values and
50
+ # then, in their reply() methods do the job with the values.
51
+ # The gathering task is performed by the ValueMixin.
52
+ #
53
+ def apply (workitem)
54
+
55
+ escape = lookup_boolean_attribute('escape', workitem, false)
56
+
57
+ if @children.length < 1
58
+
59
+ workitem.attributes[FIELD_RESULT] =
60
+ lookup_value workitem, :escape => escape
61
+
62
+ reply workitem
63
+ return
64
+ end
65
+
66
+ child = @children[0]
67
+
68
+ if child.kind_of?(OpenWFE::FlowExpressionId)
69
+
70
+ handle_child child, workitem
71
+ return
72
+ end
73
+
74
+ workitem.attributes[FIELD_RESULT] =
75
+ fetch_text_content workitem, escape
76
+
77
+ reply workitem
78
+ end
79
+
80
+ def lookup_variable_attribute (workitem)
81
+
82
+ lookup [ "variable", "var", "v" ], workitem
83
+ end
84
+
85
+ def lookup_field_attribute (workitem)
86
+
87
+ lookup [ "field", "fld", "f" ], workitem
88
+ end
89
+
90
+ protected
91
+
92
+ def handle_child (child, workitem)
93
+
94
+ raw_child, _fei = get_expression_pool.fetch(child)
95
+
96
+ if raw_child.is_definition?
97
+
98
+ #body_fei = get_expression_pool.evaluate child, workitem
99
+ #workitem.attributes[FIELD_RESULT] = body_fei
100
+
101
+ workitem.attributes[FIELD_RESULT] = raw_child
102
+ #
103
+ # storing the child raw expression
104
+
105
+ reply workitem
106
+ else
107
+
108
+ get_expression_pool.apply raw_child, workitem
109
+ end
110
+ end
111
+
112
+ private
113
+
114
+ def lookup (name_array, workitem)
115
+
116
+ name_array.each do |n|
117
+ v = lookup_string_attribute n, workitem
118
+ return v if v
119
+ end
120
+
121
+ nil
122
+ end
123
+ end
124
+
125
+ end
126
+
@@ -1,6 +1,6 @@
1
1
  #
2
2
  #--
3
- # Copyright (c) 2005-2007, John Mettraux, OpenWFE.org
3
+ # Copyright (c) 2005-2008, John Mettraux, OpenWFE.org
4
4
  # All rights reserved.
5
5
  #
6
6
  # Redistribution and use in source and binary forms, with or without
@@ -67,19 +67,29 @@ module OpenWFE
67
67
 
68
68
  FIELDS.each { |f| attr_accessor f }
69
69
 
70
- #
71
- # A shortcut for fei.workflow_instance_id.
72
- # There's also fei.parent_wfid.
73
- #
74
- alias :wfid :workflow_instance_id
75
- alias :wfid= :workflow_instance_id=
76
70
  alias :expid :expression_id
77
71
  alias :expid= :expression_id=
78
72
 
79
73
  alias :expname :expression_name
74
+ alias :wfurl :workflow_definition_url
80
75
  alias :wfname :workflow_definition_name
81
76
  alias :wfrevision :workflow_definition_revision
82
77
 
78
+ #
79
+ # This method return @workflow_instance_id. If parent is set to
80
+ # true, if will return the same result as
81
+ # parent_workflow_instance_id().
82
+ #
83
+ def wfid (parent=false)
84
+
85
+ if parent
86
+ parent_workflow_instance_id
87
+ else
88
+ workflow_instance_id
89
+ end
90
+ end
91
+ alias :wfid= :workflow_instance_id=
92
+
83
93
  #
84
94
  # the old 'initial_engine_id' is now deprecated, the methods
85
95
  # are still around though.
@@ -97,7 +107,7 @@ module OpenWFE
97
107
  # Overrides the classical to_s()
98
108
  #
99
109
  def to_s
100
- "(fei #{@owfe_version} #{@engine_id} #{@workflow_definition_url} #{@workflow_definition_name} #{@workflow_definition_revision} #{@workflow_instance_id} #{@expression_name} #{@expression_id})"
110
+ "(fei #{@owfe_version} #{@engine_id} #{wfurl} #{wfname} #{wfrevision} #{wfid} #{expname} #{expid})"
101
111
  end
102
112
 
103
113
  #
@@ -105,9 +115,7 @@ module OpenWFE
105
115
  #
106
116
  def to_h
107
117
 
108
- h = {}
109
- FIELDS.each { |f| h[f] = instance_eval("@#{f.to_s}") }
110
- h
118
+ FIELDS.inject({}) { |r, f| r[f] = instance_eval("@#{f.to_s}"); r }
111
119
  end
112
120
 
113
121
  #
@@ -115,14 +123,15 @@ module OpenWFE
115
123
  #
116
124
  def FlowExpressionId.from_h (h)
117
125
 
118
- fei = FlowExpressionId.new
119
- FIELDS.each { |f| fei.instance_variable_set("@#{f}", h[f]) }
120
- fei
126
+ FIELDS.inject FlowExpressionId.new do |fei, f|
127
+ fei.instance_variable_set("@#{f}", h[f] || h[f.to_s])
128
+ fei
129
+ end
121
130
  end
122
131
 
123
- def hash ()
132
+ def hash
124
133
 
125
- to_s().hash()
134
+ to_s.hash
126
135
  end
127
136
 
128
137
  def == (other)
@@ -178,14 +187,14 @@ module OpenWFE
178
187
  alias eql? ==
179
188
 
180
189
  def to_debug_s
181
- "(fei #{@workflow_definition_name} #{@workflow_definition_revision} #{@workflow_instance_id} #{@expression_id} #{@expression_name})"
190
+ "(fei #{wfname} #{wfrevision} #{wfid} #{expid} #{expname})"
182
191
  end
183
192
 
184
193
  #
185
194
  # Returns a very short string representation (fei wfid expid expname).
186
195
  #
187
196
  def to_short_s
188
- "(fei #{@workflow_instance_id} #{@expression_id} #{@expression_name})"
197
+ "(fei #{wfid} #{expid} #{expname})"
189
198
  end
190
199
 
191
200
  #
@@ -197,7 +206,19 @@ module OpenWFE
197
206
  def to_web_s
198
207
 
199
208
  eid = expid.gsub("\.", "_")
200
- URI.escape("#{workflow_instance_id}__#{eid}")
209
+
210
+ URI.escape "#{wfid}__#{eid}"
211
+ end
212
+
213
+ #
214
+ # Splits the web fei into the workflow instance id and the expression
215
+ # id.
216
+ #
217
+ def self.split_web_s (s)
218
+
219
+ i = s.rindex("__")
220
+
221
+ [ s[0..i-1], s[i+2..-1].gsub("\_", ".") ]
201
222
  end
202
223
 
203
224
  #
@@ -216,9 +237,7 @@ module OpenWFE
216
237
  #
217
238
  def parent_workflow_instance_id
218
239
 
219
- i = workflow_instance_id.index(".")
220
- return workflow_instance_id unless i
221
- workflow_instance_id[0..i-1]
240
+ FlowExpressionId.to_parent_wfid workflow_instance_id
222
241
  end
223
242
 
224
243
  alias :parent_wfid :parent_workflow_instance_id
@@ -315,6 +334,17 @@ module OpenWFE
315
334
 
316
335
  to_fei string
317
336
  end
337
+
338
+ #
339
+ # If wfid is already a 'parent wfid' (no sub id), returns it. Else
340
+ # returns the parent wfid (whatever is before the first ".").
341
+ #
342
+ def self.to_parent_wfid (wfid)
343
+
344
+ i = wfid.index(".")
345
+ return wfid unless i
346
+ wfid[0..i-1]
347
+ end
318
348
  end
319
349
 
320
350
  end
@@ -1,6 +1,6 @@
1
1
  #
2
2
  #--
3
- # Copyright (c) 2007, John Mettraux, OpenWFE.org
3
+ # Copyright (c) 2007-2008, John Mettraux, OpenWFE.org
4
4
  # All rights reserved.
5
5
  #
6
6
  # Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,6 @@ require 'fileutils'
43
43
 
44
44
  require 'openwfe/service'
45
45
  require 'openwfe/rudefinitions'
46
- require 'openwfe/util/scheduler'
47
46
  require 'openwfe/listeners/listener'
48
47
 
49
48
 
@@ -68,7 +67,8 @@ module OpenWFE
68
67
  # then YAML.
69
68
  #
70
69
  class FileListener < Service
71
- include WorkItemListener, Schedulable
70
+ include WorkItemListener
71
+ include Rufus::Schedulable
72
72
 
73
73
  attr_reader :workdir
74
74
 
@@ -1,6 +1,6 @@
1
1
  #
2
2
  #--
3
- # Copyright (c) 2007, John Mettraux, OpenWFE.org
3
+ # Copyright (c) 2007-2008, John Mettraux, OpenWFE.org
4
4
  # All rights reserved.
5
5
  #
6
6
  # Redistribution and use in source and binary forms, with or without
@@ -90,7 +90,7 @@ module OpenWFE
90
90
  @server = TCPServer.new(iface, port)
91
91
 
92
92
  @thread = OpenWFE.call_in_thread(@service_name, self) do
93
- listen()
93
+ listen
94
94
  end
95
95
  end
96
96
 
@@ -179,7 +179,7 @@ module OpenWFE
179
179
 
180
180
  linfo { "listen() listening on #{@server.addr.join(' ')}" }
181
181
 
182
- while true
182
+ loop do
183
183
 
184
184
  socket = nil
185
185
 
@@ -210,7 +210,7 @@ module OpenWFE
210
210
  end
211
211
 
212
212
  data = ""
213
- while true
213
+ loop do
214
214
  s = socket.gets
215
215
  break unless s
216
216
  data += s
@@ -240,7 +240,10 @@ module OpenWFE
240
240
  begin
241
241
 
242
242
  #result = get_engine.reply(wi)
243
- result = handle_item(wi)
243
+ #result = handle_item(wi)
244
+ handle_item wi
245
+
246
+ result = "<ok-reply/>"
244
247
 
245
248
  ldebug { "handle_socket() result is >>#{result}<<" }
246
249
 
@@ -1,6 +1,6 @@
1
1
  #
2
2
  #--
3
- # Copyright (c) 2006-2007, John Mettraux, OpenWFE.org
3
+ # Copyright (c) 2006-2008, John Mettraux, OpenWFE.org
4
4
  # All rights reserved.
5
5
  #
6
6
  # Redistribution and use in source and binary forms, with or without
@@ -80,6 +80,7 @@ module OpenWFE
80
80
  # A simplification of caller_to_s for direct usage when debugging
81
81
  #
82
82
  def ldebug_callstack (msg, max_lines=nil)
83
+
83
84
  ldebug { "#{msg}\n" + OpenWFE::caller_to_s(9, max_lines) }
84
85
  end
85
86
 
@@ -101,12 +102,14 @@ module OpenWFE
101
102
  end
102
103
 
103
104
  def log_prepare (message)
105
+
104
106
  return log_author() unless message
105
- return "#{log_author} - #{message}"
107
+ "#{log_author} - #{message}"
106
108
  end
107
109
 
108
110
  def log_author
109
- if respond_to? :service_name
111
+
112
+ if respond_to?(:service_name)
110
113
  "#{self.class} '#{self.service_name}'"
111
114
  else
112
115
  "#{self.class}"