openwferu 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,144 @@
1
+ #
2
+ #--
3
+ # Copyright (c) 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$
34
+ #
35
+
36
+ #
37
+ # "made in Japan"
38
+ #
39
+ # John Mettraux at openwfe.org
40
+ #
41
+
42
+ #
43
+ # this participant requires atom-tools from
44
+ #
45
+ # http://code.necronomicorp.com/trac/atom-tools
46
+ #
47
+ # The license is X11/MIT
48
+ #
49
+
50
+ require 'monitor'
51
+
52
+ require 'rubygems'
53
+ require 'atom/collection'
54
+
55
+ require 'openwfe/participants/participants'
56
+
57
+
58
+ module OpenWFE
59
+
60
+ #
61
+ # Stores the incoming workitem into an 'atom feed'
62
+ #
63
+ # An example :
64
+ # <tt>
65
+ # feed0 = AtomParticipant.new(
66
+ # 20,
67
+ # """
68
+ # <p>
69
+ # <h1>${f:colour}</h1>
70
+ # </p>
71
+ # """)
72
+ # </tt>
73
+ #
74
+ class AtomParticipant < LocalParticipant
75
+ include MonitorMixin
76
+
77
+ attr_accessor \
78
+ :content_type # blocks may manipulate them
79
+
80
+ def initialize (max_item_count, template=nil, &block)
81
+
82
+ super()
83
+
84
+ @template = template
85
+ @max_item_count = max_item_count
86
+ @block_template = block
87
+
88
+ @feed = Atom::Collection.new("http://localhost")
89
+ @content_type = "xhtml"
90
+ end
91
+
92
+ def consume (workitem)
93
+
94
+ e = Atom::Entry.new
95
+
96
+ e.id = \
97
+ "#{workitem.fei.workflow_instance_id}--" +
98
+ "#{workitem.fei.expression_id}"
99
+
100
+ e.title = workitem.atom_entry_title
101
+ e.content = render(workitem)
102
+
103
+ e.content["type"] = @content_type
104
+
105
+ @feed << e
106
+
107
+ @feed = @feed[0, @max_item_count] \
108
+ if @feed.length > @max_item_count
109
+
110
+ publish(workitem)
111
+
112
+ reply_to_engine(workitem)
113
+ end
114
+
115
+ protected
116
+
117
+ def render (workitem)
118
+
119
+ fe = get_flow_expression(workitem)
120
+
121
+ template = if @block_template
122
+ @block_template.call(fe, self, workitem)
123
+ else
124
+ @template
125
+ end
126
+
127
+ return OpenWFE::dosub(template, fe, workitem)
128
+ end
129
+
130
+ #
131
+ # For the moment, just dumps the feed into a file.
132
+ #
133
+ def publish (workitem)
134
+ synchronize do
135
+ filename = "atom_#{workitem.participant_name}.xml"
136
+ f = File.open(filename, "w")
137
+ f << @feed.to_s
138
+ f.close()
139
+ end
140
+ end
141
+ end
142
+
143
+ end
144
+
@@ -0,0 +1,73 @@
1
+ #
2
+ #--
3
+ # Copyright (c) 2007, Alain Hoang, 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
+ #
36
+ # "made in Japan"
37
+ #
38
+ # Alain Hoang at openwfe.org
39
+ #
40
+
41
+ require 'net/smtp'
42
+
43
+ module OpenWFE
44
+
45
+
46
+ #
47
+ # This participant is used to send an email notification
48
+ class EmailNotificationParticipant < LocalParticipant
49
+
50
+ # Create a new email notification participant. Requires
51
+ # a mail server, port, a from address, and a mail message template
52
+ def initialize (smtp_server, smtp_port, from_address, template)
53
+ @smtp_server = smtp_server
54
+ @smtp_port = smtp_port
55
+ @from_address = from_address
56
+ @template = template
57
+ end
58
+
59
+ def consume (workitem)
60
+ fe = get_flow_expression(workitem)
61
+ to_address = workitem.email_target
62
+ # 1. Expand variables
63
+ msg = OpenWFE::dosub(@template, fe, workitem)
64
+ # 2. Send message
65
+ Net::SMTP.start(@smtp_server, @smtp_port) do |smtp|
66
+ smtp.send_message(msg, @from_address, to_address)
67
+ end
68
+ # 3. Reply to engine
69
+ reply_to_engine(workitem)
70
+ end
71
+
72
+ end
73
+ end
@@ -0,0 +1,85 @@
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/contextual'
43
+ require 'openwfe/rudefinitions'
44
+
45
+
46
+ module OpenWFE
47
+
48
+ #
49
+ # The 'participant' concept is displayed as a module, so that
50
+ # other pieces of code may easily 'mix it in'.
51
+ #
52
+ module Participant
53
+ include Contextual
54
+
55
+ #
56
+ # A participant will be receiving workitems via this method.
57
+ # It may also receive cancelitems via this method.
58
+ # If the participant provides a cancel(cancelitem) method, cancel
59
+ # items will be fed to this cancel() and not to consume().
60
+ #
61
+ def consume (workitem)
62
+ end
63
+
64
+ #
65
+ # (optional)
66
+ #
67
+ #def cancel (cancelitem)
68
+ #end
69
+
70
+ #
71
+ # Returns the FlowExpression instance that triggered this
72
+ # participant.
73
+ # A ParticipantExpression instance will most likely be returned.
74
+ #
75
+ def get_flow_expression (workitem)
76
+
77
+ return nil if not @application_context
78
+
79
+ @application_context[S_EXPRESSION_POOL]\
80
+ .fetch_expression(workitem.flow_expression_id)
81
+ end
82
+ end
83
+
84
+ end
85
+
@@ -1,6 +1,6 @@
1
1
  #
2
- #<tt>
3
- # Copyright (c) 2006, John Mettraux, OpenWFE.org
2
+ #--
3
+ # Copyright (c) 2006-2007, John Mettraux, OpenWFE.org
4
4
  # All rights reserved.
5
5
  #
6
6
  # Redistribution and use in source and binary forms, with or without
@@ -28,7 +28,7 @@
28
28
  # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29
29
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
30
  # POSSIBILITY OF SUCH DAMAGE.
31
- #</tt>
31
+ #++
32
32
  #
33
33
  # $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
34
34
  #
@@ -39,12 +39,17 @@
39
39
  # John Mettraux at openwfe.org
40
40
  #
41
41
 
42
- require 'workitem'
43
- require 'ru/service'
42
+ require 'openwfe/workitem'
43
+ require 'openwfe/service'
44
44
 
45
+ include OpenWFE
45
46
 
46
- module OpenWFEru
47
47
 
48
+ module OpenWFE
49
+
50
+ #
51
+ # A very simple directory of participants
52
+ #
48
53
  class ParticipantMap < Service
49
54
 
50
55
  attr_accessor \
@@ -56,7 +61,20 @@ module OpenWFEru
56
61
  @participants = []
57
62
  end
58
63
 
59
- def register_participant (regex, participant)
64
+ #
65
+ # Adds a participant to this map.
66
+ # This method is called by the engine's own register_participant()
67
+ # method.
68
+ #
69
+ def register_participant (regex, participant=nil, &block)
70
+
71
+ if not participant
72
+
73
+ raise "please provide a participant instance or a block" \
74
+ if not block
75
+
76
+ participant = BlockParticipant.new(block)
77
+ end
60
78
 
61
79
  regex = Regexp.new(regex) if not regex.kind_of? Regexp
62
80
 
@@ -65,15 +83,24 @@ module OpenWFEru
65
83
  @participants << [ regex, participant ]
66
84
  end
67
85
 
86
+ #
87
+ # Looks up a participant given a participant_name.
88
+ # Will return the first participant whose name matches.
89
+ #
68
90
  def lookup_participant (participant_name)
69
91
 
70
92
  @participants.each do |tuple|
71
93
  return tuple[1] if tuple[0].match(participant_name)
72
94
  end
73
-
74
95
  return nil
75
96
  end
76
97
 
98
+ #
99
+ # Dispatches to the given participant.
100
+ # The workitem will be fed to the consume() method of that participant.
101
+ # If it's a cancelitem and the participant has a cancel() method,
102
+ # it will get called instead.
103
+ #
77
104
  def dispatch (participant_name, workitem)
78
105
 
79
106
  participant = lookup_participant(participant_name)
@@ -81,13 +108,14 @@ module OpenWFEru
81
108
  raise "Didn't find participant named '#{participant_name}'" \
82
109
  if not participant
83
110
 
84
- workitem.participantName = participant_name
111
+ workitem.participant_name = participant_name
85
112
 
86
- if workitem.kind_of? OpenWFE::CancelItem
113
+ if workitem.kind_of? CancelItem and participant.respond_to? :cancel
87
114
  participant.cancel(workitem)
88
- else
89
- participant.consume(workitem)
115
+ return
90
116
  end
117
+
118
+ participant.consume(workitem)
91
119
  end
92
120
  end
93
121
 
@@ -1,6 +1,6 @@
1
1
  #
2
- #<tt>
3
- # Copyright (c) 2006, John Mettraux, OpenWFE.org
2
+ #--
3
+ # Copyright (c) 2006-2007, John Mettraux, OpenWFE.org
4
4
  # All rights reserved.
5
5
  #
6
6
  # Redistribution and use in source and binary forms, with or without
@@ -28,7 +28,7 @@
28
28
  # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29
29
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
30
  # POSSIBILITY OF SUCH DAMAGE.
31
- #</tt>
31
+ #++
32
32
  #
33
33
  # $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
34
34
  #
@@ -39,21 +39,21 @@
39
39
  # John Mettraux at openwfe.org
40
40
  #
41
41
 
42
- require 'ru/participant'
43
- require 'ru/rudefinitions'
42
+ require 'openwfe/rudefinitions'
43
+ require 'openwfe/participants/participant'
44
44
 
45
45
 
46
46
  #
47
47
  # some base participant implementations
48
-
49
- module OpenWFEru
48
+ #
49
+ module OpenWFE
50
50
 
51
51
  class LocalParticipant
52
- include Participant
52
+ include Participant, OwfeServiceLocator
53
53
 
54
54
  def reply_to_engine (workitem)
55
- @application_context[S_EXPRESSION_POOL]\
56
- .reply(workitem.lastExpressionId, workitem)
55
+
56
+ get_expression_pool.reply(workitem.last_expression_id, workitem)
57
57
  end
58
58
  end
59
59
 
@@ -64,13 +64,42 @@ module OpenWFEru
64
64
  tracer = @application_context['__tracer']
65
65
 
66
66
  if tracer
67
- tracer << workitem.participantName
67
+ tracer << workitem.participant_name
68
68
  else
69
- puts workitem.participantName
69
+ puts workitem.participant_name
70
70
  end
71
71
 
72
72
  reply_to_engine(workitem)
73
73
  end
74
74
  end
75
+
76
+ #
77
+ # This participant is used by the register_participant() method of
78
+ # Engine class.
79
+ #
80
+ # <tt>
81
+ # engine.register_participant("the_boss") do |workitem|
82
+ # puts "the boss received a workitem"
83
+ # end
84
+ # </tt>
85
+ #
86
+ # After the block executes, the BlockParticipant immediately replies
87
+ # to the engine.
88
+ #
89
+ class BlockParticipant < LocalParticipant
90
+
91
+ def initialize (block)
92
+ @block = block
93
+ end
94
+
95
+ def consume (workitem)
96
+
97
+ @block.call workitem
98
+
99
+ reply_to_engine(workitem) \
100
+ if workitem.kind_of? InFlowWorkItem
101
+ # else it's a cancel item
102
+ end
103
+ end
75
104
  end
76
105