public
Description: RESTful workflow / bpm engine based on Rack and OpenWFEru
Homepage: http://openwferu.rubyforge.org
Clone URL: git://github.com/jmettraux/ruote-rest.git
implemented /errors (and various cleanups)
jmettraux (author)
Sun Jun 01 21:09:55 -0700 2008
commit  d0a653ee0b5facef7baa77463abcf8aa6252fb26
tree    eec423a199b22a324ccdebd4c244f7e77724d08e
parent  ad84e92471a361f77753bfe0526db61b6c6c088f
...
8
9
10
 
 
 
 
 
 
...
8
9
10
11
12
13
14
15
16
0
@@ -8,3 +8,9 @@
0
 - - .*
0
   - OpenWFE::Extras::ActiveParticipant
0
   -
0
+- - ""
0
+ - OpenWFE::Extras::ActiveParticipant
0
+ -
0
+- - .*
0
+ - OpenWFE::Extras::ActiveParticipant
0
+ -
...
2
3
4
5
6
 
 
7
8
 
9
10
11
12
13
 
 
 
 
14
15
 
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 
 
 
 
 
 
 
 
 
 
 
30
31
32
...
43
44
45
46
 
47
48
 
49
50
 
51
52
53
...
57
58
59
60
 
61
62
63
 
 
64
65
 
66
67
68
 
 
69
70
 
71
72
73
74
75
76
77
78
79
80
 
 
 
 
 
 
 
 
 
81
82
83
...
85
86
87
88
 
89
90
91
92
 
 
 
93
94
 
95
96
97
...
100
101
102
103
104
105
106
 
 
 
 
107
108
109
...
113
114
115
116
 
117
118
119
120
 
 
 
121
122
 
123
124
125
126
 
 
 
127
128
 
129
130
...
2
3
4
 
 
5
6
7
 
8
9
 
 
 
 
10
11
12
13
14
 
15
16
17
18
 
 
 
 
 
 
 
 
 
 
 
19
20
21
22
23
24
25
26
27
28
29
30
31
32
...
43
44
45
 
46
47
 
48
49
 
50
51
52
53
...
57
58
59
 
60
61
 
 
62
63
64
 
65
66
 
 
67
68
69
 
70
71
 
 
 
 
 
 
 
 
 
72
73
74
75
76
77
78
79
80
81
82
83
...
85
86
87
 
88
89
 
 
 
90
91
92
93
 
94
95
96
97
...
100
101
102
 
 
 
 
103
104
105
106
107
108
109
...
113
114
115
 
116
117
 
 
 
118
119
120
121
 
122
123
 
 
 
124
125
126
127
 
128
129
130
0
@@ -2,31 +2,31 @@
0
 #--
0
 # Copyright (c) 2008, John Mettraux, OpenWFE.org
0
 # All rights reserved.
0
-#
0
-# Redistribution and use in source and binary forms, with or without
0
+#
0
+# Redistribution and use in source and binary forms, with or without
0
 # modification, are permitted provided that the following conditions are met:
0
-#
0
+#
0
 # . Redistributions of source code must retain the above copyright notice, this
0
-# list of conditions and the following disclaimer.
0
-#
0
-# . Redistributions in binary form must reproduce the above copyright notice,
0
-# this list of conditions and the following disclaimer in the documentation
0
+# list of conditions and the following disclaimer.
0
+#
0
+# . Redistributions in binary form must reproduce the above copyright notice,
0
+# this list of conditions and the following disclaimer in the documentation
0
 # and/or other materials provided with the distribution.
0
-#
0
+#
0
 # . Neither the name of the "OpenWFE" nor the names of its contributors may be
0
 # used to endorse or promote products derived from this software without
0
 # specific prior written permission.
0
-#
0
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0
+#
0
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0
 # POSSIBILITY OF SUCH DAMAGE.
0
 #++
0
 #
0
@@ -43,11 +43,11 @@
0
 #
0
 def rparse (type)
0
 
0
- representation = request.env["rack.input"].read
0
+ representation = request.env["rack.input"].read
0
 
0
- format = determine_in_format
0
+ format = determine_in_format
0
 
0
- send "parse_#{type}_#{format}", representation
0
+ send "parse_#{type}_#{format}", representation
0
 end
0
 
0
 #
0
@@ -57,27 +57,27 @@ end
0
 #
0
 def rrender (type, object, options={})
0
 
0
- format, ctype = determine_out_format options
0
+ format, ctype = determine_out_format options
0
 
0
- ctype = "text/plain" if params[:plain]
0
- # useful for debugging
0
+ ctype = "text/plain" if params[:plain]
0
+ # useful for debugging
0
 
0
- response.status = options.delete(:status) || 200
0
+ response.status = options.delete(:status) || 200
0
 
0
- header 'Content-Type' => ctype
0
- options.each { |k, v| header(k => v) }
0
+ header 'Content-Type' => ctype
0
+ options.each { |k, v| header(k => v) }
0
 
0
- method_name = "render_#{type}_#{format}"
0
+ method_name = "render_#{type}_#{format}"
0
 
0
- send method_name, object
0
- #begin
0
- # send method_name, object
0
- #rescue Exception => e
0
- # puts e
0
- # #puts e.backtrace
0
- # header 'Content-Type' => 'application/xml'
0
- # send "render_#{type}_xml", object
0
- #end
0
+ send method_name, object
0
+ #begin
0
+ # send method_name, object
0
+ #rescue Exception => e
0
+ # puts e
0
+ # #puts e.backtrace
0
+ # header 'Content-Type' => 'application/xml'
0
+ # send "render_#{type}_xml", object
0
+ #end
0
 end
0
 
0
 #
0
@@ -85,13 +85,13 @@ end
0
 #
0
 def determine_in_format
0
 
0
- ct = request.env['CONTENT_TYPE']
0
+ ct = request.env['CONTENT_TYPE']
0
 
0
- return "form" if ct.index("form-")
0
- return "json" if ct.index("application/json")
0
- return "yaml" if ct.index("application/yaml")
0
+ return "form" if ct.index("form-")
0
+ return "json" if ct.index("application/json")
0
+ return "yaml" if ct.index("application/yaml")
0
 
0
- "xml"
0
+ "xml"
0
 end
0
 
0
 
0
@@ -100,10 +100,10 @@ end
0
 #
0
 FORMATS = {
0
 
0
- :xml => [ "xml", "application/xml" ],
0
- :html => [ "html", "text/html" ],
0
- :json => [ "json", "application/json" ],
0
- :yaml => [ "yaml", "application/yaml" ]
0
+ :xml => [ "xml", "application/xml" ],
0
+ :html => [ "html", "text/html" ],
0
+ :json => [ "json", "application/json" ],
0
+ :yaml => [ "yaml", "application/yaml" ]
0
 
0
 } unless defined?(FORMATS)
0
 
0
@@ -113,18 +113,18 @@ FORMATS = {
0
 #
0
 def determine_out_format (options)
0
 
0
- f = options[:format] || params["format"]
0
+ f = options[:format] || params["format"]
0
 
0
- return FORMATS[:xml] if f == "xml"
0
- return FORMATS[:json] if f == "json"
0
- return FORMATS[:yaml] if f == "yaml"
0
+ return FORMATS[:xml] if f == "xml"
0
+ return FORMATS[:json] if f == "json"
0
+ return FORMATS[:yaml] if f == "yaml"
0
 
0
- accept = request.env['HTTP_ACCEPT'] || ""
0
+ accept = request.env['HTTP_ACCEPT'] || ""
0
 
0
- return FORMATS[:html] if accept.index("text/html")
0
- return FORMATS[:yaml] if accept.index("yaml")
0
- return FORMATS[:json] if accept.index("json")
0
+ return FORMATS[:html] if accept.index("text/html")
0
+ return FORMATS[:yaml] if accept.index("yaml")
0
+ return FORMATS[:json] if accept.index("json")
0
 
0
- FORMATS[:xml]
0
+ FORMATS[:xml]
0
 end
0
 
...
2
3
4
5
6
 
 
7
8
 
9
10
11
12
13
 
 
 
 
14
15
 
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 
 
 
 
 
 
 
 
 
 
 
30
31
32
...
43
44
45
46
 
47
48
 
49
50
51
52
53
 
 
54
55
56
57
58
59
 
 
60
61
62
63
 
64
65
 
66
67
 
68
69
 
70
71
72
...
75
76
77
78
 
79
80
81
...
83
84
85
86
 
87
88
89
...
2
3
4
 
 
5
6
7
 
8
9
 
 
 
 
10
11
12
13
14
 
15
16
17
18
 
 
 
 
 
 
 
 
 
 
 
19
20
21
22
23
24
25
26
27
28
29
30
31
32
...
43
44
45
 
46
47
 
48
49
50
51
 
 
52
53
54
55
56
57
 
 
58
59
60
61
62
 
63
64
 
65
66
 
67
68
 
69
70
71
72
...
75
76
77
 
78
79
80
81
...
83
84
85
 
86
87
88
89
0
@@ -2,31 +2,31 @@
0
 #--
0
 # Copyright (c) 2008, John Mettraux, OpenWFE.org
0
 # All rights reserved.
0
-#
0
-# Redistribution and use in source and binary forms, with or without
0
+#
0
+# Redistribution and use in source and binary forms, with or without
0
 # modification, are permitted provided that the following conditions are met:
0
-#
0
+#
0
 # . Redistributions of source code must retain the above copyright notice, this
0
-# list of conditions and the following disclaimer.
0
-#
0
-# . Redistributions in binary form must reproduce the above copyright notice,
0
-# this list of conditions and the following disclaimer in the documentation
0
+# list of conditions and the following disclaimer.
0
+#
0
+# . Redistributions in binary form must reproduce the above copyright notice,
0
+# this list of conditions and the following disclaimer in the documentation
0
 # and/or other materials provided with the distribution.
0
-#
0
+#
0
 # . Neither the name of the "OpenWFE" nor the names of its contributors may be
0
 # used to endorse or promote products derived from this software without
0
 # specific prior written permission.
0
-#
0
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0
+#
0
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0
 # POSSIBILITY OF SUCH DAMAGE.
0
 #++
0
 #
0
@@ -43,30 +43,30 @@ require 'cgi'
0
 #
0
 # swap from dots to underscores
0
 #
0
-# swapdots "0_0_1" # => "0.0.1"
0
+# swapdots "0_0_1" # => "0.0.1"
0
 #
0
-# swapdots "0.0.1" # => "0_0_1"
0
+# swapdots "0.0.1" # => "0_0_1"
0
 #
0
 def swapdots (s)
0
 
0
- return s.gsub(/\./, '_') if s.index(".")
0
- s.gsub(/\_/, '.')
0
+ return s.gsub(/\./, '_') if s.index(".")
0
+ s.gsub(/\_/, '.')
0
 end
0
 
0
 
0
 #
0
-# render_time(workitem, :dispatch_time)
0
-# # => Sat Mar 1 20:29:44 2008 (1d16h18m)
0
+# render_time(workitem, :dispatch_time)
0
+# # => Sat Mar 1 20:29:44 2008 (1d16h18m)
0
 #
0
 def display_time (object, accessor)
0
 
0
- t = object.send accessor
0
+ t = object.send accessor
0
 
0
- return "" unless t
0
+ return "" unless t
0
 
0
- d = Time.now - t
0
+ d = Time.now - t
0
 
0
- "#{t.ctime} (#{Rufus::to_duration_string(d, :drop_seconds => true)})"
0
+ "#{t.ctime} (#{Rufus::to_duration_string(d, :drop_seconds => true)})"
0
 end
0
 
0
 #
0
@@ -75,7 +75,7 @@ end
0
 #
0
 def uri_escape (s)
0
 
0
- CGI.escape(s).gsub(/\./, '%2E')
0
+ CGI.escape(s).gsub(/\./, '%2E')
0
 end
0
 
0
 #--
0
@@ -83,7 +83,7 @@ end
0
 # as well.
0
 #
0
 #def uri_unescape (s)
0
-# CGI.unescape s
0
+# CGI.unescape s
0
 #end
0
 #++
0
 
...
2
3
4
5
6
 
 
7
8
 
9
10
11
12
13
 
 
 
 
14
15
 
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 
 
 
 
 
 
 
 
 
 
 
30
31
32
...
46
47
48
49
 
50
51
52
53
 
 
54
 
55
56
 
57
58
59
60
 
 
61
 
62
63
 
64
65
 
66
67
 
68
69
 
70
71
 
72
73
74
75
76
 
 
77
78
 
79
80
81
82
83
84
 
85
86
 
 
 
 
87
88
89
 
 
90
91
92
93
 
94
95
 
 
96
97
98
 
 
99
100
 
101
102
103
104
 
 
 
 
105
 
106
107
 
108
109
110
111
 
 
 
112
113
114
...
2
3
4
 
 
5
6
7
 
8
9
 
 
 
 
10
11
12
13
14
 
15
16
17
18
 
 
 
 
 
 
 
 
 
 
 
19
20
21
22
23
24
25
26
27
28
29
30
31
32
...
46
47
48
 
49
50
 
 
 
51
52
53
54
55
 
56
57
 
 
 
58
59
60
61
62
 
63
64
 
65
66
 
67
68
 
69
70
 
71
72
 
 
 
 
73
74
75
 
76
77
 
 
 
 
 
78
79
 
80
81
82
83
84
85
 
86
87
88
 
 
 
89
90
 
91
92
93
94
 
95
96
97
 
98
99
 
 
 
100
101
102
103
104
105
106
 
107
108
 
 
 
109
110
111
112
113
114
0
@@ -2,31 +2,31 @@
0
 #--
0
 # Copyright (c) 2008, John Mettraux, OpenWFE.org
0
 # All rights reserved.
0
-#
0
-# Redistribution and use in source and binary forms, with or without
0
+#
0
+# Redistribution and use in source and binary forms, with or without
0
 # modification, are permitted provided that the following conditions are met:
0
-#
0
+#
0
 # . Redistributions of source code must retain the above copyright notice, this
0
-# list of conditions and the following disclaimer.
0
-#
0
-# . Redistributions in binary form must reproduce the above copyright notice,
0
-# this list of conditions and the following disclaimer in the documentation
0
+# list of conditions and the following disclaimer.
0
+#
0
+# . Redistributions in binary form must reproduce the above copyright notice,
0
+# this list of conditions and the following disclaimer in the documentation
0
 # and/or other materials provided with the distribution.
0
-#
0
+#
0
 # . Neither the name of the "OpenWFE" nor the names of its contributors may be
0
 # used to endorse or promote products derived from this software without
0
 # specific prior written permission.
0
-#
0
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0
+#
0
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0
 # POSSIBILITY OF SUCH DAMAGE.
0
 #++
0
 #
0
@@ -46,69 +46,69 @@ require 'openwfe/extras/participants/activeparticipants'
0
 #
0
 module Participants
0
 
0
- def self.load_all
0
+ def self.load_all
0
 
0
- File.open filename do |f|
0
- YAML.load f
0
- end
0
+ File.open filename do |f|
0
+ YAML.load f
0
     end
0
+ end
0
 
0
- def self.save (participants)
0
+ def self.save (participants)
0
 
0
- File.open filename, 'w' do |f|
0
- f.puts YAML.dump(participants)
0
- end
0
+ File.open filename, 'w' do |f|
0
+ f.puts YAML.dump(participants)
0
     end
0
+ end
0
 
0
- def self.add (pregex, classname, *args)
0
+ def self.add (pregex, classname, *args)
0
 
0
- register pregex, classname, *args
0
+ register pregex, classname, *args
0
 
0
- participants = load_all
0
+ participants = load_all
0
 
0
- pregex = pregex.source if pregex.is_a?(Regexp)
0
+ pregex = pregex.source if pregex.is_a?(Regexp)
0
 
0
- participants << [ pregex, classname, *args ]
0
+ participants << [ pregex, classname, *args ]
0
 
0
- save participants
0
- end
0
-
0
- def self.register (pregex, classname, args)
0
+ save participants
0
+ end
0
 
0
- clazz = classname.constantize # thanks activesupport
0
+ def self.register (pregex, classname, args)
0
 
0
- participant = if args
0
- clazz.new args
0
- else
0
- clazz.new
0
- end
0
+ clazz = classname.constantize # thanks activesupport
0
 
0
- $engine.register_participant pregex, participant
0
+ participant = if args
0
+ clazz.new args
0
+ else
0
+ clazz.new
0
     end
0
 
0
- def self.remove (pregex)
0
+ $engine.register_participant pregex, participant
0
+ end
0
 
0
- part = $engine.list_participants.find do |pr, pa|
0
- pr == pregex
0
- end
0
+ def self.remove (pregex)
0
 
0
- $engine.list_participants.delete part
0
+ part = $engine.list_participants.find do |pr, pa|
0
+ pr == pregex
0
     end
0
 
0
- def self.init_all
0
+ $engine.list_participants.delete part
0
+ end
0
 
0
- ps = load_all
0
+ def self.init_all
0
 
0
- ps.each do |pregex, classname, args|
0
- register pregex, classname, args
0
- end
0
+ ps = load_all
0
+
0
+ ps.each do |pregex, classname, args|
0
+ register pregex, classname, args
0
     end
0
+ end
0
 
0
- protected
0
+ protected
0
 
0
- def self.filename
0
- "conf/participants_#{Sinatra.application.options.env}.yaml"
0
- end
0
+ def self.filename
0
+ "conf/participants_#{Sinatra.application.options.env}.yaml"
0
+ end
0
 
0
 end
0
 
...
2
3
4
5
6
 
 
7
8
 
9
10
11
12
13
 
 
 
 
14
15
 
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 
 
 
 
 
 
 
 
 
 
 
30
31
32
...
43
44
45
46
47
48
49
50
51
52
 
 
 
 
 
53
54
55
 
56
57
58
 
 
59
60
 
61
 
 
 
62
63
64
...
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
97
98
99
100
101
102
103
104
105
 
 
 
 
 
 
106
107
108
 
 
109
110
111
112
113
114
115
116
 
 
 
 
117
118
 
119
120
121
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
123
...
2
3
4
 
 
5
6
7
 
8
9
 
 
 
 
10
11
12
13
14
 
15
16
17
18
 
 
 
 
 
 
 
 
 
 
 
19
20
21
22
23
24
25
26
27
28
29
30
31
32
...
43
44
45
 
 
 
 
 
 
 
46
47
48
49
50
51
 
 
52
53
 
 
54
55
56
 
57
58
59
60
61
62
63
64
...
67
68
69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
 
 
 
 
 
 
113
114
115
116
117
118
119
 
 
120
121
122
123
124
125
 
 
 
 
126
127
128
129
130
 
131
132
 
 
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
0
@@ -2,31 +2,31 @@
0
 #--
0
 # Copyright (c) 2008, John Mettraux, OpenWFE.org
0
 # All rights reserved.
0
-#
0
-# Redistribution and use in source and binary forms, with or without
0
+#
0
+# Redistribution and use in source and binary forms, with or without
0
 # modification, are permitted provided that the following conditions are met:
0
-#
0
+#
0
 # . Redistributions of source code must retain the above copyright notice, this
0
-# list of conditions and the following disclaimer.
0
-#
0
-# . Redistributions in binary form must reproduce the above copyright notice,
0
-# this list of conditions and the following disclaimer in the documentation
0
+# list of conditions and the following disclaimer.
0
+#
0
+# . Redistributions in binary form must reproduce the above copyright notice,
0
+# this list of conditions and the following disclaimer in the documentation
0
 # and/or other materials provided with the distribution.
0
-#
0
+#
0
 # . Neither the name of the "OpenWFE" nor the names of its contributors may be
0
 # used to endorse or promote products derived from this software without
0
 # specific prior written permission.
0
-#
0
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0
+#
0
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0
 # POSSIBILITY OF SUCH DAMAGE.
0
 #++
0
 #
0
@@ -43,22 +43,22 @@
0
 #
0
 class Rack::Request
0
 
0
- #
0
- # request.link(:expressions, "abc", "0_0_1")
0
- # #=> "http://example.org:4567/expressions/abc/0_0_1"
0
- #
0
- def link (*args)
0
-
0
- base = "#{scheme}://#{host}"
0
+ #
0
+ # request.link(:expressions, "abc", "0_0_1")
0
+ # #=> "http://example.org:4567/expressions/abc/0_0_1"
0
+ #
0
+ def link (*args)
0
 
0
- if (scheme == 'https' && port != 443) ||
0
- (scheme == 'http' && port != 80)
0
+ base = "#{scheme}://#{host}"
0
 
0
- base << ":#{port}"
0
- end
0
+ if (scheme == 'https' && port != 443) ||
0
+ (scheme == 'http' && port != 80)
0
 
0
- base + "/" + args.collect {|a| a.to_s }.join("/")
0
+ base << ":#{port}"
0
     end
0
+
0
+ base + "/" + args.collect {|a| a.to_s }.join("/")
0
+ end
0
 end
0
 
0
 #
0
@@ -67,57 +67,91 @@ end
0
 
0
 class OpenWFE::FlowExpressionId
0
 
0
- #
0
- # Returns the relative link to the expression pointed at by this
0
- # FlowExpressionId.
0
- #
0
- # fei.link
0
- # # => "/expressions/{wfid}/{expid}"
0
- #
0
- # fei.link(request)
0
- # # => "http://host:port/expressions/{wfid}/{expid}"
0
- #
0
- # fei.link(request, 'smurfs')
0
- # # => "http://host:port/smurfs/{wfid}/{expid}"
0
- #
0
- # fei.link(nil, 'smurfs')
0
- # # => "smurfs/{wfid}/{expid}"
0
- #
0
- def link (req=nil, resource_name='expressions')
0
-
0
- ei = swapdots self.expid
0
-
0
- return req.link(resource_name, wfid, ei) if req
0
-
0
- env = self.expname == "environment" ? "e" : ""
0
-
0
- "/#{resource_name}/#{wfid}/#{ei}#{env}"
0
- end
0
+ #
0
+ # Returns the relative link to the expression pointed at by this
0
+ # FlowExpressionId.
0
+ #
0
+ # fei.link
0
+ # # => "/expressions/{wfid}/{expid}"
0
+ #
0
+ # fei.link(request)
0
+ # # => "http://host:port/expressions/{wfid}/{expid}"
0
+ #
0
+ # fei.link(request, 'smurfs')
0
+ # # => "http://host:port/smurfs/{wfid}/{expid}"
0
+ #
0
+ # fei.link(nil, 'smurfs')
0
+ # # => "smurfs/{wfid}/{expid}"
0
+ #
0
+ def link (req=nil, resource_name='expressions')
0
+
0
+ ei = swapdots self.expid
0
+
0
+ return req.link(resource_name, wfid, ei) if req
0
+
0
+ env = self.expname == "environment" ? "e" : ""
0
+
0
+ "/#{resource_name}/#{wfid}/#{ei}#{env}"
0
+ end
0
+end
0
+
0
+class OpenWFE::ProcessStatus
0
+
0
+ #
0
+ # Returns the 'ruote-rest' link for this ProcessError instance
0
+ #
0
+ def link (request=nil)
0
+
0
+ return request.link(:processes, wfid) if request
0
+
0
+ "/processes/#{wfid}"
0
+ end
0
 end
0
 
0
 class OpenWFE::FlowExpression
0
 
0
- #
0
- # a shortcut for
0
- #
0
- # self.fei.link(req)
0
- #
0
- def link (req=nil)
0
+ #
0
+ # a shortcut for
0
+ #
0
+ # self.fei.link(req)
0
+ #
0
+ def link (request=nil)
0
 
0
- self.fei.link(req)
0
- end
0
+ self.fei.link(request)
0
+ end
0
 end
0
 
0
 class OpenWFE::InFlowWorkItem
0
 
0
- #
0
- # Returns the 'ruote-rest' link for this workitem
0
- #
0
- def link (request=nil)
0
+ #
0
+ # Returns the 'ruote-rest' link for this workitem
0
+ #
0
+ def link (request=nil)
0
 
0
- return request.link(:workitems, db_id) if request
0
+ return request.link(:workitems, db_id) if request
0
 
0
- "/workitems/#{db_id}"
0
- end
0
+ "/workitems/#{db_id}"
0
+ end
0
+end
0
+
0
+class OpenWFE::ProcessError
0
+
0
+ def error_id
0
+
0
+ swapdots(fei.expid) +
0
+ "_" +
0
+ Rufus::Mnemo.from_integer(date.to_i.abs)
0
+ # 2008 AD, but what about 2008 BC ?
0
+ end
0
+
0
+ #
0
+ # Returns the 'ruote-rest' link for this ProcessError instance