pione 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. data/.gitignore +2 -1
  2. data/History.txt +11 -0
  3. data/LICENSE.txt +1 -1
  4. data/README.md +1 -1
  5. data/bin/pione-log +5 -0
  6. data/example/CountChar/CountChar.pione +1 -1
  7. data/example/SieveOfEratosthenes/SieveOfEratosthenes.pione +39 -38
  8. data/lib/pione.rb +14 -35
  9. data/lib/pione/agent/input-generator.rb +38 -40
  10. data/lib/pione/agent/logger.rb +52 -19
  11. data/lib/pione/agent/rule-provider.rb +5 -8
  12. data/lib/pione/agent/task-worker.rb +25 -32
  13. data/lib/pione/agent/tuple-space-client.rb +22 -14
  14. data/lib/pione/command.rb +21 -0
  15. data/lib/pione/command/basic-command.rb +267 -84
  16. data/lib/pione/command/child-process.rb +21 -18
  17. data/lib/pione/command/daemon-process.rb +9 -8
  18. data/lib/pione/command/front-owner-command.rb +8 -25
  19. data/lib/pione/command/pione-broker.rb +27 -24
  20. data/lib/pione/command/pione-clean.rb +6 -6
  21. data/lib/pione/command/pione-client.rb +143 -128
  22. data/lib/pione/command/pione-log.rb +61 -0
  23. data/lib/pione/command/pione-relay-account-db.rb +40 -38
  24. data/lib/pione/command/pione-relay-client-db.rb +38 -42
  25. data/lib/pione/command/pione-relay.rb +19 -20
  26. data/lib/pione/command/pione-syntax-checker.rb +70 -45
  27. data/lib/pione/command/pione-task-worker.rb +56 -66
  28. data/lib/pione/command/pione-tuple-space-provider.rb +36 -45
  29. data/lib/pione/command/pione-tuple-space-receiver.rb +34 -32
  30. data/lib/pione/command/pione-tuple-space-viewer.rb +63 -47
  31. data/lib/pione/location.rb +10 -0
  32. data/lib/pione/location/basic-location.rb +272 -0
  33. data/lib/pione/location/dropbox-location.rb +139 -0
  34. data/lib/pione/location/ftp-location.rb +156 -0
  35. data/lib/pione/location/local-location.rb +116 -0
  36. data/lib/pione/log.rb +10 -0
  37. data/lib/pione/log/domain-info.rb +72 -0
  38. data/lib/pione/log/process-log.rb +176 -0
  39. data/lib/pione/log/process-record.rb +189 -0
  40. data/lib/pione/log/xes-log.rb +105 -0
  41. data/lib/pione/model/assignment.rb +88 -80
  42. data/lib/pione/model/binary-operator.rb +74 -68
  43. data/lib/pione/model/block.rb +218 -207
  44. data/lib/pione/model/boolean.rb +123 -112
  45. data/lib/pione/model/call-rule.rb +72 -65
  46. data/lib/pione/model/data-expr.rb +596 -290
  47. data/lib/pione/model/float.rb +108 -103
  48. data/lib/pione/model/integer.rb +133 -129
  49. data/lib/pione/model/message.rb +79 -72
  50. data/lib/pione/model/package.rb +42 -38
  51. data/lib/pione/model/parameters.rb +265 -236
  52. data/lib/pione/model/rule-expr.rb +247 -242
  53. data/lib/pione/model/rule-io.rb +137 -133
  54. data/lib/pione/model/rule.rb +307 -292
  55. data/lib/pione/model/string.rb +110 -99
  56. data/lib/pione/model/variable-table.rb +300 -271
  57. data/lib/pione/model/variable.rb +88 -83
  58. data/lib/pione/option.rb +13 -0
  59. data/lib/pione/option/child-process-option.rb +19 -0
  60. data/lib/pione/{command-option → option}/common-option.rb +6 -5
  61. data/lib/pione/option/option-interface.rb +73 -0
  62. data/lib/pione/{command-option → option}/presence-notifier-option.rb +4 -3
  63. data/lib/pione/option/task-worker-owner-option.rb +24 -0
  64. data/lib/pione/{command-option → option}/tuple-space-provider-option.rb +6 -4
  65. data/lib/pione/option/tuple-space-provider-owner-option.rb +18 -0
  66. data/lib/pione/option/tuple-space-receiver-option.rb +8 -0
  67. data/lib/pione/parser/common-parser.rb +3 -2
  68. data/lib/pione/parser/expr-parser.rb +6 -1
  69. data/lib/pione/patch/em-ftpd-patch.rb +21 -0
  70. data/lib/pione/patch/rinda-patch.rb +31 -23
  71. data/lib/pione/rule-handler/action-handler.rb +35 -25
  72. data/lib/pione/rule-handler/basic-handler.rb +92 -18
  73. data/lib/pione/rule-handler/flow-handler.rb +104 -98
  74. data/lib/pione/rule-handler/root-handler.rb +11 -0
  75. data/lib/pione/system/common.rb +10 -0
  76. data/lib/pione/system/file-cache.rb +103 -84
  77. data/lib/pione/system/global.rb +67 -12
  78. data/lib/pione/system/init.rb +20 -0
  79. data/lib/pione/transformer/expr-transformer.rb +6 -1
  80. data/lib/pione/tuple-space/data-finder.rb +33 -6
  81. data/lib/pione/tuple-space/tuple-space-receiver.rb +4 -3
  82. data/lib/pione/tuple-space/tuple-space-server-interface.rb +58 -13
  83. data/lib/pione/tuple-space/tuple-space-server.rb +13 -11
  84. data/lib/pione/tuple-space/update-criteria.rb +8 -7
  85. data/lib/pione/tuple/base-location-tuple.rb +9 -0
  86. data/lib/pione/tuple/basic-tuple.rb +7 -7
  87. data/lib/pione/tuple/data-tuple.rb +5 -2
  88. data/lib/pione/tuple/lift-tuple.rb +14 -0
  89. data/lib/pione/tuple/rule-tuple.rb +1 -1
  90. data/lib/pione/tuple/task-tuple.rb +5 -1
  91. data/lib/pione/version.rb +1 -1
  92. data/pione.gemspec +5 -1
  93. data/test/location/spec_basic-location.rb +35 -0
  94. data/test/location/spec_ftp-location.rb +100 -0
  95. data/test/location/spec_local-location.rb +99 -0
  96. data/test/log/data/sample.log +1003 -0
  97. data/test/log/spec_xes-log.rb +11 -0
  98. data/test/model/spec_data-expr.rb +249 -6
  99. data/test/model/spec_data-expr.yml +45 -0
  100. data/test/parser/spec_expr-parser.yml +4 -0
  101. data/test/spec_data-finder.rb +13 -7
  102. data/test/spec_data-finder.yml +42 -13
  103. data/test/system/spec_file-cache.rb +39 -0
  104. data/test/test-util.rb +226 -1
  105. data/test/transformer/spec_expr-transformer.rb +12 -1
  106. metadata +107 -24
  107. data/bin/pione-search-log +0 -30
  108. data/lib/pione/command-option/basic-option.rb +0 -42
  109. data/lib/pione/command-option/child-process-option.rb +0 -17
  110. data/lib/pione/command-option/daemon-option.rb +0 -12
  111. data/lib/pione/command-option/task-worker-owner-option.rb +0 -17
  112. data/lib/pione/command-option/tuple-space-provider-owner-option.rb +0 -16
  113. data/lib/pione/command-option/tuple-space-receiver-option.rb +0 -12
  114. data/lib/pione/command/tuple-space-provider-owner.rb +0 -6
  115. data/lib/pione/resource/basic-resource.rb +0 -92
  116. data/lib/pione/resource/dropbox-resource.rb +0 -106
  117. data/lib/pione/resource/ftp.rb +0 -84
  118. data/lib/pione/resource/local.rb +0 -113
  119. data/lib/pione/tuple/base-uri-tuple.rb +0 -9
  120. data/lib/pione/tuple/shift-tuple.rb +0 -13
  121. data/lib/pione/util/log.rb +0 -79
  122. data/test/spec_resource.rb +0 -73
@@ -1,106 +1,111 @@
1
- module Pione::Model
2
- # PioneFloat represents float values in PIONE system.
3
- class PioneFloat < BasicModel
4
- set_pione_model_type TypeFloat
5
-
6
- attr_reader :value
7
-
8
- # Creates a float value in PIONE system.
9
- # @param [Float] value
10
- # value in ruby
11
- def initialize(value)
12
- @value = value
13
- super()
14
- end
15
-
16
- # @api private
17
- def textize
18
- "#PioneFloat{%s}" % @value
19
- end
20
-
21
- # Returns ruby's value.
22
- # @return [Float]
23
- # ruby's value
24
- def to_ruby
25
- return @value
26
- end
27
-
28
- # @api private
29
- def ==(other)
30
- return false unless other.kind_of?(self.class)
31
- @value == other.value
32
- end
33
-
34
- alias :eql? :"=="
35
-
36
- # @api private
37
- def hash
38
- @value.hash
39
- end
40
- end
41
-
42
- TypeFloat.instance_eval do
43
- # Returns true if the other equals self.
44
- # @return [PioneBoolean]
45
- # true if the other equals self
46
- define_pione_method("==", [TypeFloat], TypeBoolean) do |rec, other|
47
- PioneBoolean.new(rec.value == other.value)
48
- end
49
-
50
- define_pione_method("!=", [TypeFloat], TypeBoolean) do |rec, other|
51
- PioneBoolean.not(rec.call_pione_method("==", other))
52
- end
53
-
54
- define_pione_method(">", [TypeFloat], TypeBoolean) do |rec, other|
55
- PioneBoolean.new(rec.value > other.value)
56
- end
57
-
58
- define_pione_method(">=", [TypeFloat], TypeBoolean) do |rec, other|
59
- PioneBoolean.or(rec.call_pione_method(">", other),
60
- rec.call_pione_method("==", other))
61
- end
62
-
63
- define_pione_method("<", [TypeFloat], TypeBoolean) do |rec, other|
64
- PioneBoolean.new(rec.value < other.value)
65
- end
66
-
67
- define_pione_method("<=", [TypeFloat], TypeBoolean) do |rec, other|
68
- PioneBoolean.or(rec.call_pione_method("<", other),
69
- rec.call_pione_method("==", other))
70
- end
71
-
72
- define_pione_method("+", [TypeFloat], TypeFloat) do |rec, other|
73
- PioneFloat.new(rec.value + other.value)
74
- end
75
-
76
- define_pione_method("-", [TypeFloat], TypeFloat) do |rec, other|
77
- PioneFloat.new(rec.value - other.value)
78
- end
79
-
80
- define_pione_method("*", [TypeFloat], TypeFloat) do |rec, other|
81
- PioneFloat.new(rec.value * other.value)
82
- end
83
-
84
- define_pione_method("%", [TypeFloat], TypeFloat) do |rec, other|
85
- # TODO: zero division error
86
- PioneFloat.new(rec.value % other.value)
87
- end
88
-
89
- define_pione_method("/", [TypeFloat], TypeFloat) do |rec, other|
90
- # TODO: zero division error
91
- PioneFloat.new(rec.value / other.value)
92
- end
93
-
94
- define_pione_method("as_string", [], TypeString) do |rec|
95
- PioneString.new(rec.value.to_s)
96
- end
97
-
98
- define_pione_method("as_int", [], TypeInteger) do |rec|
99
- PioneInteger.new(rec.value.to_i)
100
- end
101
-
102
- define_pione_method("as_float", [], TypeFloat) do |rec|
103
- rec
1
+ module Pione
2
+ module Model
3
+ # PioneFloat represents float values in PIONE system.
4
+ class PioneFloat < BasicModel
5
+ set_pione_model_type TypeFloat
6
+
7
+ attr_reader :value
8
+
9
+ # Create a float value in PIONE system.
10
+ #
11
+ # @param value [Float]
12
+ # value in ruby
13
+ def initialize(value)
14
+ @value = value
15
+ super()
16
+ end
17
+
18
+ # @api private
19
+ def textize
20
+ "#PioneFloat{%s}" % @value
21
+ end
22
+
23
+ # Return ruby's value.
24
+ #
25
+ # @return [Float]
26
+ # ruby's value
27
+ def to_ruby
28
+ return @value
29
+ end
30
+
31
+ # @api private
32
+ def ==(other)
33
+ return false unless other.kind_of?(self.class)
34
+ @value == other.value
35
+ end
36
+
37
+ alias :eql? :"=="
38
+
39
+ # @api private
40
+ def hash
41
+ @value.hash
42
+ end
43
+ end
44
+
45
+ TypeFloat.instance_eval do
46
+ # Return true if the other equals self.
47
+ #
48
+ # @return [PioneBoolean]
49
+ # true if the other equals self
50
+ define_pione_method("==", [TypeFloat], TypeBoolean) do |rec, other|
51
+ PioneBoolean.new(rec.value == other.value)
52
+ end
53
+
54
+ define_pione_method("!=", [TypeFloat], TypeBoolean) do |rec, other|
55
+ PioneBoolean.not(rec.call_pione_method("==", other))
56
+ end
57
+
58
+ define_pione_method(">", [TypeFloat], TypeBoolean) do |rec, other|
59
+ PioneBoolean.new(rec.value > other.value)
60
+ end
61
+
62
+ define_pione_method(">=", [TypeFloat], TypeBoolean) do |rec, other|
63
+ PioneBoolean.or(rec.call_pione_method(">", other),
64
+ rec.call_pione_method("==", other))
65
+ end
66
+
67
+ define_pione_method("<", [TypeFloat], TypeBoolean) do |rec, other|
68
+ PioneBoolean.new(rec.value < other.value)
69
+ end
70
+
71
+ define_pione_method("<=", [TypeFloat], TypeBoolean) do |rec, other|
72
+ PioneBoolean.or(rec.call_pione_method("<", other),
73
+ rec.call_pione_method("==", other))
74
+ end
75
+
76
+ define_pione_method("+", [TypeFloat], TypeFloat) do |rec, other|
77
+ PioneFloat.new(rec.value + other.value)
78
+ end
79
+
80
+ define_pione_method("-", [TypeFloat], TypeFloat) do |rec, other|
81
+ PioneFloat.new(rec.value - other.value)
82
+ end
83
+
84
+ define_pione_method("*", [TypeFloat], TypeFloat) do |rec, other|
85
+ PioneFloat.new(rec.value * other.value)
86
+ end
87
+
88
+ define_pione_method("%", [TypeFloat], TypeFloat) do |rec, other|
89
+ # TODO: zero division error
90
+ PioneFloat.new(rec.value % other.value)
91
+ end
92
+
93
+ define_pione_method("/", [TypeFloat], TypeFloat) do |rec, other|
94
+ # TODO: zero division error
95
+ PioneFloat.new(rec.value / other.value)
96
+ end
97
+
98
+ define_pione_method("as_string", [], TypeString) do |rec|
99
+ PioneString.new(rec.value.to_s)
100
+ end
101
+
102
+ define_pione_method("as_int", [], TypeInteger) do |rec|
103
+ PioneInteger.new(rec.value.to_i)
104
+ end
105
+
106
+ define_pione_method("as_float", [], TypeFloat) do |rec|
107
+ rec
108
+ end
104
109
  end
105
110
  end
106
111
  end
@@ -1,132 +1,136 @@
1
- module Pione::Model
2
- # PioneInteger represents integer value in PIONE system.
3
- class PioneInteger < BasicModel
4
- set_pione_model_type TypeInteger
5
-
6
- attr_reader :value
7
-
8
- # Creates a integer value in PIONE system.
9
- # @param [Integer] value
10
- # value in ruby
11
- def initialize(value)
12
- @value = value
13
- super()
14
- end
15
-
16
- # @api private
17
- def task_id_string
18
- "Integer<#{@value}>"
19
- end
20
-
21
- # @api private
22
- def textize
23
- @value.to_s
24
- end
25
-
26
- # Returns the ruby's value.
27
- # @return [Integer]
28
- # ruby's value
29
- def to_ruby
30
- return @value
31
- end
32
-
33
- # @api private
34
- def ==(other)
35
- return false unless other.kind_of?(self.class)
36
- @value == other.value
37
- end
38
-
39
- alias :eql? :"=="
40
-
41
- # @api private
42
- def hash
43
- @value.hash
44
- end
45
-
46
- # @api private
47
- def inspect
48
- "#<Pione::Model::PioneInteger @value=%s>" % @value.inspect
49
- end
50
-
51
- # @api private
52
- alias :to_s :inspect
53
- end
54
-
55
- TypeInteger.instance_eval do
56
- define_pione_method("==", [TypeInteger], TypeBoolean) do |rec, other|
57
- PioneBoolean.new(rec.value == other.value)
58
- end
59
-
60
- define_pione_method("!=", [TypeInteger], TypeBoolean) do |rec, other|
61
- PioneBoolean.not(rec.call_pione_method("==", other))
62
- end
63
-
64
- define_pione_method(">", [TypeInteger], TypeBoolean) do |rec, other|
65
- PioneBoolean.new(rec.value > other.value)
66
- end
67
-
68
- define_pione_method(">=", [TypeInteger], TypeBoolean) do |rec, other|
69
- PioneBoolean.or(rec.call_pione_method(">", other),
70
- rec.call_pione_method("==", other))
71
- end
72
-
73
- define_pione_method("<", [TypeInteger], TypeBoolean) do |rec, other|
74
- PioneBoolean.new(rec.value < other.value)
75
- end
76
-
77
- define_pione_method("<=", [TypeInteger], TypeBoolean) do |rec, other|
78
- PioneBoolean.or(rec.call_pione_method("<", other),
79
- rec.call_pione_method("==", other))
80
- end
81
-
82
- define_pione_method("+", [TypeInteger], TypeInteger) do |rec, other|
83
- PioneInteger.new(rec.value + other.value)
84
- end
85
-
86
- define_pione_method("-", [TypeInteger], TypeInteger) do |rec, other|
87
- PioneInteger.new(rec.value - other.value)
88
- end
89
-
90
- define_pione_method("*", [TypeInteger], TypeInteger) do |rec, other|
91
- PioneInteger.new(rec.value * other.value)
92
- end
93
-
94
- define_pione_method("%", [TypeInteger], TypeInteger) do |rec, other|
95
- # TODO: zero division error
96
- PioneInteger.new(rec.value % other.value)
97
- end
98
-
99
- define_pione_method("/", [TypeInteger], TypeInteger) do |rec, other|
100
- # TODO: zero division error
101
- PioneInteger.new(rec.value / other.value)
102
- end
103
-
104
- define_pione_method("as_string", [], TypeString) do |rec|
105
- PioneString.new(rec.value.to_s)
106
- end
107
-
108
- define_pione_method("as_int", [], TypeInteger) do |rec|
109
- rec
110
- end
111
-
112
- define_pione_method("as_float", [], TypeFloat) do |rec|
113
- PioneFloat.new(rec.value.to_f)
114
- end
115
-
116
- define_pione_method("next", [], TypeInteger) do |rec|
117
- PioneInteger.new(rec.value.next)
118
- end
119
-
120
- define_pione_method("prev", [], TypeInteger) do |rec|
121
- PioneInteger.new(rec.value.pred)
122
- end
123
-
124
- define_pione_method("even?", [], TypeBoolean) do |rec|
125
- PioneBoolean.new(rec.value.even?)
126
- end
127
-
128
- define_pione_method("odd?", [], TypeBoolean) do |rec|
129
- PioneBoolean.new(rec.value.odd?)
1
+ module Pione
2
+ module Model
3
+ # PioneInteger represents integer value in PIONE system.
4
+ class PioneInteger < BasicModel
5
+ set_pione_model_type TypeInteger
6
+
7
+ attr_reader :value
8
+
9
+ # Create a integer value in PIONE system.
10
+ #
11
+ # @param value [Integer]
12
+ # value in ruby
13
+ def initialize(value)
14
+ @value = value
15
+ super()
16
+ end
17
+
18
+ # @api private
19
+ def task_id_string
20
+ "Integer<#{@value}>"
21
+ end
22
+
23
+ # @api private
24
+ def textize
25
+ @value.to_s
26
+ end
27
+
28
+ # Return the ruby's value.
29
+ #
30
+ # @return [Integer]
31
+ # ruby's value
32
+ def to_ruby
33
+ return @value
34
+ end
35
+
36
+ # @api private
37
+ def ==(other)
38
+ return false unless other.kind_of?(self.class)
39
+ @value == other.value
40
+ end
41
+
42
+ alias :eql? :"=="
43
+
44
+ # @api private
45
+ def hash
46
+ @value.hash
47
+ end
48
+
49
+ # @api private
50
+ def inspect
51
+ "#<Pione::Model::PioneInteger @value=%s>" % @value.inspect
52
+ end
53
+
54
+ # @api private
55
+ alias :to_s :inspect
56
+ end
57
+
58
+ TypeInteger.instance_eval do
59
+ define_pione_method("==", [TypeInteger], TypeBoolean) do |rec, other|
60
+ PioneBoolean.new(rec.value == other.value)
61
+ end
62
+
63
+ define_pione_method("!=", [TypeInteger], TypeBoolean) do |rec, other|
64
+ PioneBoolean.not(rec.call_pione_method("==", other))
65
+ end
66
+
67
+ define_pione_method(">", [TypeInteger], TypeBoolean) do |rec, other|
68
+ PioneBoolean.new(rec.value > other.value)
69
+ end
70
+
71
+ define_pione_method(">=", [TypeInteger], TypeBoolean) do |rec, other|
72
+ PioneBoolean.or(rec.call_pione_method(">", other),
73
+ rec.call_pione_method("==", other))
74
+ end
75
+
76
+ define_pione_method("<", [TypeInteger], TypeBoolean) do |rec, other|
77
+ PioneBoolean.new(rec.value < other.value)
78
+ end
79
+
80
+ define_pione_method("<=", [TypeInteger], TypeBoolean) do |rec, other|
81
+ PioneBoolean.or(rec.call_pione_method("<", other),
82
+ rec.call_pione_method("==", other))
83
+ end
84
+
85
+ define_pione_method("+", [TypeInteger], TypeInteger) do |rec, other|
86
+ PioneInteger.new(rec.value + other.value)
87
+ end
88
+
89
+ define_pione_method("-", [TypeInteger], TypeInteger) do |rec, other|
90
+ PioneInteger.new(rec.value - other.value)
91
+ end
92
+
93
+ define_pione_method("*", [TypeInteger], TypeInteger) do |rec, other|
94
+ PioneInteger.new(rec.value * other.value)
95
+ end
96
+
97
+ define_pione_method("%", [TypeInteger], TypeInteger) do |rec, other|
98
+ # TODO: zero division error
99
+ PioneInteger.new(rec.value % other.value)
100
+ end
101
+
102
+ define_pione_method("/", [TypeInteger], TypeInteger) do |rec, other|
103
+ # TODO: zero division error
104
+ PioneInteger.new(rec.value / other.value)
105
+ end
106
+
107
+ define_pione_method("as_string", [], TypeString) do |rec|
108
+ PioneString.new(rec.value.to_s)
109
+ end
110
+
111
+ define_pione_method("as_int", [], TypeInteger) do |rec|
112
+ rec
113
+ end
114
+
115
+ define_pione_method("as_float", [], TypeFloat) do |rec|
116
+ PioneFloat.new(rec.value.to_f)
117
+ end
118
+
119
+ define_pione_method("next", [], TypeInteger) do |rec|
120
+ PioneInteger.new(rec.value.next)
121
+ end
122
+
123
+ define_pione_method("prev", [], TypeInteger) do |rec|
124
+ PioneInteger.new(rec.value.pred)
125
+ end
126
+
127
+ define_pione_method("even?", [], TypeBoolean) do |rec|
128
+ PioneBoolean.new(rec.value.even?)
129
+ end
130
+
131
+ define_pione_method("odd?", [], TypeBoolean) do |rec|
132
+ PioneBoolean.new(rec.value.odd?)
133
+ end
130
134
  end
131
135
  end
132
136
  end