pione 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/History.txt +11 -0
- data/LICENSE.txt +1 -1
- data/README.md +1 -1
- data/bin/pione-log +5 -0
- data/example/CountChar/CountChar.pione +1 -1
- data/example/SieveOfEratosthenes/SieveOfEratosthenes.pione +39 -38
- data/lib/pione.rb +14 -35
- data/lib/pione/agent/input-generator.rb +38 -40
- data/lib/pione/agent/logger.rb +52 -19
- data/lib/pione/agent/rule-provider.rb +5 -8
- data/lib/pione/agent/task-worker.rb +25 -32
- data/lib/pione/agent/tuple-space-client.rb +22 -14
- data/lib/pione/command.rb +21 -0
- data/lib/pione/command/basic-command.rb +267 -84
- data/lib/pione/command/child-process.rb +21 -18
- data/lib/pione/command/daemon-process.rb +9 -8
- data/lib/pione/command/front-owner-command.rb +8 -25
- data/lib/pione/command/pione-broker.rb +27 -24
- data/lib/pione/command/pione-clean.rb +6 -6
- data/lib/pione/command/pione-client.rb +143 -128
- data/lib/pione/command/pione-log.rb +61 -0
- data/lib/pione/command/pione-relay-account-db.rb +40 -38
- data/lib/pione/command/pione-relay-client-db.rb +38 -42
- data/lib/pione/command/pione-relay.rb +19 -20
- data/lib/pione/command/pione-syntax-checker.rb +70 -45
- data/lib/pione/command/pione-task-worker.rb +56 -66
- data/lib/pione/command/pione-tuple-space-provider.rb +36 -45
- data/lib/pione/command/pione-tuple-space-receiver.rb +34 -32
- data/lib/pione/command/pione-tuple-space-viewer.rb +63 -47
- data/lib/pione/location.rb +10 -0
- data/lib/pione/location/basic-location.rb +272 -0
- data/lib/pione/location/dropbox-location.rb +139 -0
- data/lib/pione/location/ftp-location.rb +156 -0
- data/lib/pione/location/local-location.rb +116 -0
- data/lib/pione/log.rb +10 -0
- data/lib/pione/log/domain-info.rb +72 -0
- data/lib/pione/log/process-log.rb +176 -0
- data/lib/pione/log/process-record.rb +189 -0
- data/lib/pione/log/xes-log.rb +105 -0
- data/lib/pione/model/assignment.rb +88 -80
- data/lib/pione/model/binary-operator.rb +74 -68
- data/lib/pione/model/block.rb +218 -207
- data/lib/pione/model/boolean.rb +123 -112
- data/lib/pione/model/call-rule.rb +72 -65
- data/lib/pione/model/data-expr.rb +596 -290
- data/lib/pione/model/float.rb +108 -103
- data/lib/pione/model/integer.rb +133 -129
- data/lib/pione/model/message.rb +79 -72
- data/lib/pione/model/package.rb +42 -38
- data/lib/pione/model/parameters.rb +265 -236
- data/lib/pione/model/rule-expr.rb +247 -242
- data/lib/pione/model/rule-io.rb +137 -133
- data/lib/pione/model/rule.rb +307 -292
- data/lib/pione/model/string.rb +110 -99
- data/lib/pione/model/variable-table.rb +300 -271
- data/lib/pione/model/variable.rb +88 -83
- data/lib/pione/option.rb +13 -0
- data/lib/pione/option/child-process-option.rb +19 -0
- data/lib/pione/{command-option → option}/common-option.rb +6 -5
- data/lib/pione/option/option-interface.rb +73 -0
- data/lib/pione/{command-option → option}/presence-notifier-option.rb +4 -3
- data/lib/pione/option/task-worker-owner-option.rb +24 -0
- data/lib/pione/{command-option → option}/tuple-space-provider-option.rb +6 -4
- data/lib/pione/option/tuple-space-provider-owner-option.rb +18 -0
- data/lib/pione/option/tuple-space-receiver-option.rb +8 -0
- data/lib/pione/parser/common-parser.rb +3 -2
- data/lib/pione/parser/expr-parser.rb +6 -1
- data/lib/pione/patch/em-ftpd-patch.rb +21 -0
- data/lib/pione/patch/rinda-patch.rb +31 -23
- data/lib/pione/rule-handler/action-handler.rb +35 -25
- data/lib/pione/rule-handler/basic-handler.rb +92 -18
- data/lib/pione/rule-handler/flow-handler.rb +104 -98
- data/lib/pione/rule-handler/root-handler.rb +11 -0
- data/lib/pione/system/common.rb +10 -0
- data/lib/pione/system/file-cache.rb +103 -84
- data/lib/pione/system/global.rb +67 -12
- data/lib/pione/system/init.rb +20 -0
- data/lib/pione/transformer/expr-transformer.rb +6 -1
- data/lib/pione/tuple-space/data-finder.rb +33 -6
- data/lib/pione/tuple-space/tuple-space-receiver.rb +4 -3
- data/lib/pione/tuple-space/tuple-space-server-interface.rb +58 -13
- data/lib/pione/tuple-space/tuple-space-server.rb +13 -11
- data/lib/pione/tuple-space/update-criteria.rb +8 -7
- data/lib/pione/tuple/base-location-tuple.rb +9 -0
- data/lib/pione/tuple/basic-tuple.rb +7 -7
- data/lib/pione/tuple/data-tuple.rb +5 -2
- data/lib/pione/tuple/lift-tuple.rb +14 -0
- data/lib/pione/tuple/rule-tuple.rb +1 -1
- data/lib/pione/tuple/task-tuple.rb +5 -1
- data/lib/pione/version.rb +1 -1
- data/pione.gemspec +5 -1
- data/test/location/spec_basic-location.rb +35 -0
- data/test/location/spec_ftp-location.rb +100 -0
- data/test/location/spec_local-location.rb +99 -0
- data/test/log/data/sample.log +1003 -0
- data/test/log/spec_xes-log.rb +11 -0
- data/test/model/spec_data-expr.rb +249 -6
- data/test/model/spec_data-expr.yml +45 -0
- data/test/parser/spec_expr-parser.yml +4 -0
- data/test/spec_data-finder.rb +13 -7
- data/test/spec_data-finder.yml +42 -13
- data/test/system/spec_file-cache.rb +39 -0
- data/test/test-util.rb +226 -1
- data/test/transformer/spec_expr-transformer.rb +12 -1
- metadata +107 -24
- data/bin/pione-search-log +0 -30
- data/lib/pione/command-option/basic-option.rb +0 -42
- data/lib/pione/command-option/child-process-option.rb +0 -17
- data/lib/pione/command-option/daemon-option.rb +0 -12
- data/lib/pione/command-option/task-worker-owner-option.rb +0 -17
- data/lib/pione/command-option/tuple-space-provider-owner-option.rb +0 -16
- data/lib/pione/command-option/tuple-space-receiver-option.rb +0 -12
- data/lib/pione/command/tuple-space-provider-owner.rb +0 -6
- data/lib/pione/resource/basic-resource.rb +0 -92
- data/lib/pione/resource/dropbox-resource.rb +0 -106
- data/lib/pione/resource/ftp.rb +0 -84
- data/lib/pione/resource/local.rb +0 -113
- data/lib/pione/tuple/base-uri-tuple.rb +0 -9
- data/lib/pione/tuple/shift-tuple.rb +0 -13
- data/lib/pione/util/log.rb +0 -79
- data/test/spec_resource.rb +0 -73
@@ -1,245 +1,250 @@
|
|
1
|
-
module Pione
|
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
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
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
|
-
|
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
|
-
|
158
|
-
@right
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
1
|
+
module Pione
|
2
|
+
module Model
|
3
|
+
# Rule representation in the flow element context.
|
4
|
+
class RuleExpr < BasicModel
|
5
|
+
set_pione_model_type TypeRuleExpr
|
6
|
+
|
7
|
+
attr_reader :package
|
8
|
+
attr_reader :name
|
9
|
+
attr_reader :params
|
10
|
+
attr_reader :input_ticket_expr
|
11
|
+
attr_reader :output_ticket_expr
|
12
|
+
|
13
|
+
# Create a rule expression.
|
14
|
+
#
|
15
|
+
# @param package [String]
|
16
|
+
# package name
|
17
|
+
# @param name [String]
|
18
|
+
# rule name
|
19
|
+
# @param params [Parameters]
|
20
|
+
# parameters
|
21
|
+
# @param input_ticket_expr [TicketExpr]
|
22
|
+
# input ticket condition
|
23
|
+
# @param output_ticket_expr [TicketExpr]
|
24
|
+
# output ticket condition
|
25
|
+
def initialize(package, name, params, input_ticket_expr, output_ticket_expr)
|
26
|
+
@package = package
|
27
|
+
@name = name
|
28
|
+
@params = params
|
29
|
+
@input_ticket_expr = input_ticket_expr
|
30
|
+
@output_ticket_expr = output_ticket_expr
|
31
|
+
super()
|
32
|
+
end
|
33
|
+
|
34
|
+
# Return rule path form.
|
35
|
+
#
|
36
|
+
# @return [String]
|
37
|
+
# rule path string
|
38
|
+
def path
|
39
|
+
"&%s:%s" % [@package.name, @name]
|
40
|
+
end
|
41
|
+
|
42
|
+
# FIXME
|
43
|
+
def rule_path
|
44
|
+
raise UnboundVariableError.new(self) if @package.include_variable?
|
45
|
+
"&%s:%s" % [@package.name, @name]
|
46
|
+
end
|
47
|
+
|
48
|
+
# @api private
|
49
|
+
def task_id_string
|
50
|
+
"RuleExpr<%s,#{@name}>" % [@package.task_id_string]
|
51
|
+
end
|
52
|
+
|
53
|
+
# @api private
|
54
|
+
def textize
|
55
|
+
"rule_expr(%s,\"%s\")" % [@package.textize, @name]
|
56
|
+
end
|
57
|
+
|
58
|
+
# Create a new rule expression with adding the ticket expression as input
|
59
|
+
# condition.
|
60
|
+
#
|
61
|
+
# @param ticket_expr [TicketExpr]
|
62
|
+
# ticket expression as additional input condition
|
63
|
+
# @return [RuleExpr]
|
64
|
+
# new rule expression
|
65
|
+
def add_input_ticket_expr(ticket_expr)
|
66
|
+
return self.class.new(@package, @name, @params, @input_ticket_expr + ticket_expr, @output_ticket_expr)
|
67
|
+
end
|
68
|
+
|
69
|
+
# Create a new rule expression with adding the ticket expression as output
|
70
|
+
# condition.
|
71
|
+
#
|
72
|
+
# @param ticket_expr [TicketExpr]
|
73
|
+
# ticket expression as additional output condition
|
74
|
+
# @return [RuleExpr]
|
75
|
+
# new rule expression
|
76
|
+
def add_output_ticket_expr(ticket_expr)
|
77
|
+
return self.class.new(@package, @name, @params, @input_ticket_expr, @output_ticket_expr + ticket_expr)
|
78
|
+
end
|
79
|
+
|
80
|
+
# Sets a package name and returns a new expression.
|
81
|
+
#
|
82
|
+
# @param [String] package
|
83
|
+
# package name
|
84
|
+
# @return [RuleExpr]
|
85
|
+
# new rule expression with the package name
|
86
|
+
def set_package(package)
|
87
|
+
return self.class.new(package, @name, @params, @input_ticket_expr, @output_ticket_expr)
|
88
|
+
end
|
89
|
+
|
90
|
+
# Set parameters and returns a new expression.
|
91
|
+
#
|
92
|
+
# @param params [Parameters]
|
93
|
+
# parameters
|
94
|
+
# @return [RuleExpr]
|
95
|
+
# new rule expression with the parameters
|
96
|
+
def set_params(params)
|
97
|
+
return self.class.new(@package, @name, params, @input_ticket_expr, @output_ticket_expr)
|
98
|
+
end
|
99
|
+
|
100
|
+
# Evaluate the object with the variable table.
|
101
|
+
#
|
102
|
+
# @param vtable [VariableTable]
|
103
|
+
# variable table for evaluation
|
104
|
+
# @return [BasicModel]
|
105
|
+
# evaluation result
|
106
|
+
def eval(vtable)
|
107
|
+
return self.class.new(
|
108
|
+
@package.eval(vtable),
|
109
|
+
@name,
|
110
|
+
@params.eval(vtable),
|
111
|
+
@input_ticket_expr.eval(vtable),
|
112
|
+
@output_ticket_expr.eval(vtable)
|
113
|
+
)
|
114
|
+
end
|
115
|
+
|
116
|
+
# Return true if the package or parameters include variables.
|
117
|
+
#
|
118
|
+
# @return [Boolean]
|
119
|
+
# true if the package or parameters include variables
|
120
|
+
def include_variable?
|
121
|
+
[ @package.include_variable?,
|
122
|
+
@params.include_variable?,
|
123
|
+
@input_ticket_expr.include_variable?,
|
124
|
+
@output_ticket_expr.include_variable?
|
125
|
+
].any?
|
126
|
+
end
|
127
|
+
|
128
|
+
# @api private
|
129
|
+
def ==(other)
|
130
|
+
return false unless other.kind_of?(self.class)
|
131
|
+
return false unless @package = other.package
|
132
|
+
return false unless @name == other.name
|
133
|
+
return false unless @params == other.params
|
134
|
+
return true
|
135
|
+
end
|
136
|
+
alias :eql? :"=="
|
137
|
+
|
138
|
+
# @api private
|
139
|
+
def hash
|
140
|
+
@package.hash + @name.hash + @params.hash
|
141
|
+
end
|
142
|
+
|
143
|
+
# Return a set that contains self as a single element.
|
144
|
+
#
|
145
|
+
# @return [Set<RuleExpr>]
|
146
|
+
# a set that contains self
|
147
|
+
def to_set
|
148
|
+
Set.new([self])
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
class CompositionalRuleExpr < RuleExpr
|
153
|
+
# Create a new compositional rule expression. This consists from left and
|
154
|
+
# right child expressions.
|
155
|
+
#
|
156
|
+
# @param left [RuleExpr]
|
157
|
+
# left expression
|
158
|
+
# @param right [RuleExpr]
|
159
|
+
# right expression
|
160
|
+
def initialize(left, right)
|
161
|
+
@left = left
|
162
|
+
@right = right
|
163
|
+
end
|
164
|
+
|
165
|
+
# Create a new compositioanl rule expression with adding the ticket
|
166
|
+
# expression as input condition of left expression.
|
167
|
+
#
|
168
|
+
# @param ticket_expr [TicketExpr]
|
169
|
+
# ticket expression as additional input condition
|
170
|
+
# @return [CompositionalRuleExpr]
|
171
|
+
# new rule expression
|
172
|
+
def add_input_ticket_expr(ticket_expr)
|
173
|
+
return self.class.new(@left.add_input_ticket_expr(ticket_expr), @right)
|
174
|
+
end
|
175
|
+
|
176
|
+
# Create a new compositional rule expression with adding the ticket
|
177
|
+
# expression as output condition of right expression.
|
178
|
+
#
|
179
|
+
# @param ticket_expr [TicketExpr]
|
180
|
+
# ticket expression as additional output condition
|
181
|
+
# @return [CompositionalRuleExpr]
|
182
|
+
# new rule expression
|
183
|
+
def add_output_ticket_expr(ticket_expr)
|
184
|
+
return self.class.new(@left, @right.add_output_ticket_expr(ticket_expr))
|
185
|
+
end
|
186
|
+
|
187
|
+
# Evaluate left and right expressions with the variable table.
|
188
|
+
#
|
189
|
+
# @param [VariableTable] vtable
|
190
|
+
# variable table for evaluation
|
191
|
+
# @return [CompositionalRuleExpr]
|
192
|
+
# evaluation result
|
193
|
+
def eval(vtable)
|
194
|
+
return self.class.new(@left.eval(vtable), @right.eval(vtable))
|
195
|
+
end
|
196
|
+
|
197
|
+
# @api private
|
198
|
+
def ==(other)
|
199
|
+
return false unless other.kind_of?(self.class)
|
200
|
+
return to_set == other.to_set
|
201
|
+
end
|
202
|
+
alias :eql? :"=="
|
203
|
+
|
204
|
+
# @api private
|
205
|
+
def hash
|
206
|
+
@left.hash + @right.hash
|
207
|
+
end
|
208
|
+
|
209
|
+
# Return a set that contains all rule expressions of left and right.
|
210
|
+
#
|
211
|
+
# @return [Set<RuleExpr>]
|
212
|
+
# a set that contains all rule expressions of left and right
|
213
|
+
def to_set
|
214
|
+
@left.to_set + @right.to_set
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
TypeRuleExpr.instance_eval do
|
219
|
+
define_pione_method("==", [TypeRuleExpr], TypeBoolean) do |rec, other|
|
220
|
+
PioneBoolean.new(
|
221
|
+
rec.package == other.package &&
|
222
|
+
rec.name == other.name &&
|
223
|
+
rec.params == other.params)
|
224
|
+
end
|
225
|
+
|
226
|
+
define_pione_method("!=", [TypeRuleExpr], TypeBoolean) do |rec, other|
|
227
|
+
PioneBoolean.not(rec.call_pione_method("==", other))
|
228
|
+
end
|
229
|
+
|
230
|
+
define_pione_method("params", [TypeParameters], TypeRuleExpr) do |rec, params|
|
231
|
+
rec.set_params(params)
|
232
|
+
end
|
233
|
+
|
234
|
+
define_pione_method("as_string", [], TypeString) do |rec|
|
235
|
+
PioneString.new(rec.name)
|
236
|
+
end
|
237
|
+
|
238
|
+
define_pione_method("==>", [TypeTicketExpr], TypeRuleExpr) do |rec, ticket_expr|
|
239
|
+
rec.add_output_ticket_expr(ticket_expr)
|
240
|
+
end
|
241
|
+
|
242
|
+
define_pione_method(">>>", [TypeRuleExpr], TypeRuleExpr) do |rec, other|
|
243
|
+
ticket_expr = TicketExpr.new([rec.path])
|
244
|
+
left = rec.add_output_ticket_expr(ticket_expr)
|
245
|
+
right = other.add_input_ticket_expr(ticket_expr)
|
246
|
+
CompositionalRuleExpr.new(left, right)
|
247
|
+
end
|
243
248
|
end
|
244
249
|
end
|
245
250
|
end
|