cpee 1.4.7 → 1.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/cpee.gemspec +1 -1
- data/lib/cpee/controller.rb +41 -7
- data/lib/cpee/handler_properties.rb +9 -9
- data/lib/cpee/instantiation.rb +12 -6
- data/lib/instantiation.xml +1 -0
- data/log/elasticsearch.rb +120 -0
- data/log/logs/1/test +1 -0
- data/log/xes_yaml.rb +3 -20
- data/server/handlerwrappers/default.rb +10 -10
- data/server/instances/1/properties.xml +34 -122
- data/server/instances/10/notifications/182434032285ca1d06a8b6554b8889c8/consumer-secret +1 -0
- data/server/instances/10/notifications/182434032285ca1d06a8b6554b8889c8/producer-secret +1 -0
- data/server/instances/{76/notifications/a59df784fab648f5327915fc6cf012ab → 10/notifications/182434032285ca1d06a8b6554b8889c8}/subscription.xml +6 -21
- data/server/instances/10/notifications/512a3785631a5245dbb45fa150ea72ed/consumer-secret +1 -0
- data/server/instances/10/notifications/512a3785631a5245dbb45fa150ea72ed/producer-secret +1 -0
- data/server/instances/10/notifications/512a3785631a5245dbb45fa150ea72ed/subscription.xml +6 -0
- data/server/instances/10/properties.xml +141 -127
- data/server/instances/11/properties.xml +162 -179
- data/server/instances/12/properties.xml +163 -87
- data/server/instances/13/properties.xml +131 -2002
- data/server/instances/14/properties.xml +9 -2044
- data/server/instances/15/properties.xml +8 -2039
- data/server/instances/16/properties.xml +8 -2069
- data/server/instances/17/properties.xml +11 -2065
- data/server/instances/18/properties.xml +10 -2109
- data/server/instances/19/properties.xml +5 -90
- data/server/instances/2/properties.xml +10 -135
- data/server/instances/20/properties.xml +169 -9
- data/server/instances/21/properties.xml +122 -82
- data/server/instances/22/properties.xml +53 -2042
- data/server/instances/23/properties.xml +75 -68
- data/server/instances/24/properties.xml +82 -2033
- data/server/instances/25/properties.xml +121 -37
- data/server/instances/26/properties.xml +9 -9
- data/server/instances/27/properties.xml +48 -2044
- data/server/instances/28/properties.xml +83 -2058
- data/server/instances/29/properties.xml +83 -2072
- data/server/instances/3/properties.xml +76 -211
- data/server/instances/30/properties.xml +293 -112
- data/server/instances/31/properties.xml +332 -9
- data/server/instances/313/notifications/crisp/consumer-secret +1 -0
- data/server/instances/313/notifications/crisp/producer-secret +1 -0
- data/server/instances/313/notifications/crisp/subscription.xml +7 -0
- data/server/instances/313/notifications/logging/consumer-secret +1 -0
- data/server/instances/313/notifications/logging/producer-secret +1 -0
- data/server/instances/313/notifications/logging/subscription.xml +7 -0
- data/server/instances/313/notifications/logging_yaml/consumer-secret +1 -0
- data/server/instances/313/notifications/logging_yaml/producer-secret +1 -0
- data/server/instances/313/notifications/logging_yaml/subscription.xml +7 -0
- data/server/instances/313/properties.xml +524 -0
- data/server/instances/32/properties.xml +582 -65
- data/server/instances/33/properties.xml +113 -99
- data/server/instances/4/properties.xml +92 -9
- data/server/instances/5/properties.xml +49 -1505
- data/server/instances/6/properties.xml +186 -11
- data/server/instances/662/notifications/crisp/consumer-secret +1 -0
- data/server/instances/662/notifications/crisp/producer-secret +1 -0
- data/server/instances/662/notifications/crisp/subscription.xml +7 -0
- data/server/instances/662/notifications/logging/consumer-secret +1 -0
- data/server/instances/662/notifications/logging/producer-secret +1 -0
- data/server/instances/662/notifications/logging/subscription.xml +7 -0
- data/server/instances/662/notifications/logging_yaml/consumer-secret +1 -0
- data/server/instances/662/notifications/logging_yaml/producer-secret +1 -0
- data/server/instances/662/notifications/logging_yaml/subscription.xml +7 -0
- data/server/instances/662/properties.xml +427 -0
- data/server/instances/{46 → 663}/properties.xml +1 -1
- data/server/instances/664/properties.xml +425 -0
- data/server/instances/665/properties.xml +425 -0
- data/server/instances/666/properties.xml +427 -0
- data/server/instances/667/properties.xml +427 -0
- data/server/instances/668/properties.xml +425 -0
- data/server/instances/669/properties.xml +425 -0
- data/server/instances/670/properties.xml +31 -0
- data/server/instances/{75 → 671}/properties.xml +12 -12
- data/server/instances/672/properties.xml +199 -0
- data/server/instances/673/properties.xml +52 -0
- data/server/instances/7/properties.xml +82 -1691
- data/server/instances/8/properties.xml +53 -1738
- data/server/instances/9/properties.xml +95 -680
- metadata +42 -52
- data/server/instances/34/properties.xml +0 -183
- data/server/instances/35/properties.xml +0 -183
- data/server/instances/36/properties.xml +0 -185
- data/server/instances/37/properties.xml +0 -183
- data/server/instances/38/properties.xml +0 -183
- data/server/instances/39/properties.xml +0 -183
- data/server/instances/40/properties.xml +0 -183
- data/server/instances/41/properties.xml +0 -183
- data/server/instances/42/properties.xml +0 -183
- data/server/instances/43/properties.xml +0 -183
- data/server/instances/44/properties.xml +0 -183
- data/server/instances/45/properties.xml +0 -185
- data/server/instances/47/properties.xml +0 -185
- data/server/instances/48/properties.xml +0 -185
- data/server/instances/49/properties.xml +0 -185
- data/server/instances/50/properties.xml +0 -183
- data/server/instances/51/properties.xml +0 -183
- data/server/instances/52/properties.xml +0 -2129
- data/server/instances/53/properties.xml +0 -2129
- data/server/instances/54/properties.xml +0 -319
- data/server/instances/55/properties.xml +0 -2114
- data/server/instances/56/properties.xml +0 -2114
- data/server/instances/57/properties.xml +0 -2119
- data/server/instances/58/properties.xml +0 -2119
- data/server/instances/59/properties.xml +0 -2119
- data/server/instances/60/properties.xml +0 -2119
- data/server/instances/61/properties.xml +0 -2114
- data/server/instances/62/properties.xml +0 -2116
- data/server/instances/63/properties.xml +0 -2116
- data/server/instances/64/properties.xml +0 -2116
- data/server/instances/65/properties.xml +0 -76
- data/server/instances/66/properties.xml +0 -97
- data/server/instances/67/properties.xml +0 -184
- data/server/instances/68/properties.xml +0 -158
- data/server/instances/69/properties.xml +0 -156
- data/server/instances/70/properties.xml +0 -156
- data/server/instances/71/properties.xml +0 -156
- data/server/instances/72/properties.xml +0 -156
- data/server/instances/73/properties.xml +0 -156
- data/server/instances/74/properties.xml +0 -156
- data/server/instances/76/notifications/a59df784fab648f5327915fc6cf012ab/consumer-secret +0 -1
- data/server/instances/76/notifications/a59df784fab648f5327915fc6cf012ab/producer-secret +0 -1
- data/server/instances/76/properties.xml +0 -156
- data/server/resources/base.xml +0 -78
- data/server/resources/test.rb +0 -19
- data/server/resources/test.xml +0 -33
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 416188034ef7c0020c76c14841e2aab9556634ae
|
|
4
|
+
data.tar.gz: d2ceda09e62188498ee0e565733007bcd90397f2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a0fb17d5cbcad12b931b0cb378f9d50092792bdd8c98808f07540e8fabf4a6515e8462d39eea1408eb4efd7534443cfae12d95b6afce16f41c712f1739eb1aa9
|
|
7
|
+
data.tar.gz: 4d91c2f7a529aa8f5b44a11a6003bf817f16decc39dc4a7709262f4e04c6a1be8b495a7632733564388d312ed7accc8d4dcc1f5e9539b4d3625e2f922c9786b4
|
data/cpee.gemspec
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = "cpee"
|
|
3
|
-
s.version = "1.4.
|
|
3
|
+
s.version = "1.4.8"
|
|
4
4
|
s.platform = Gem::Platform::RUBY
|
|
5
5
|
s.license = "LGPL-3.0"
|
|
6
6
|
s.summary = "Preliminary release of cloud process execution engine (cpee). If you just need workflow execution, without a rest/xmpp service exposing it, then use WEEL"
|
data/lib/cpee/controller.rb
CHANGED
|
@@ -22,7 +22,7 @@ require ::File.dirname(__FILE__) + '/empty_workflow'
|
|
|
22
22
|
|
|
23
23
|
module CPEE
|
|
24
24
|
|
|
25
|
-
class ValueHelper
|
|
25
|
+
class ValueHelper #{{{
|
|
26
26
|
def self::generate(value)
|
|
27
27
|
if [String, Integer, Float, TrueClass, FalseClass, Date].include? value.class
|
|
28
28
|
value.to_s
|
|
@@ -49,7 +49,32 @@ module CPEE
|
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
|
-
end
|
|
52
|
+
end #}}}
|
|
53
|
+
|
|
54
|
+
class AttributesHelper #{{{
|
|
55
|
+
def translate(__attributes__,__dataelements__,__endpoints__)
|
|
56
|
+
@data = WEEL::ReadHash.new(__dataelements__)
|
|
57
|
+
@endpoints = WEEL::ReadHash.new(__endpoints__)
|
|
58
|
+
@attributes = WEEL::ReadHash.new(__attributes__)
|
|
59
|
+
__attributes__.transform_values do |v|
|
|
60
|
+
v.gsub(/(!(attributes|data|endpoints)\.[\w_]+)/) do |m|
|
|
61
|
+
eval(m[1..-1])
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def data
|
|
67
|
+
@data
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def endpoints
|
|
71
|
+
@endpoints
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def attributes
|
|
75
|
+
@attributes
|
|
76
|
+
end
|
|
77
|
+
end #}}}
|
|
53
78
|
|
|
54
79
|
class Controller
|
|
55
80
|
|
|
@@ -63,6 +88,7 @@ module CPEE
|
|
|
63
88
|
@callbacks = {}
|
|
64
89
|
@positions = []
|
|
65
90
|
@attributes = {}
|
|
91
|
+
@attributes_helper = AttributesHelper.new
|
|
66
92
|
@thread = nil
|
|
67
93
|
@mutex = Mutex.new
|
|
68
94
|
@opts = opts
|
|
@@ -138,6 +164,10 @@ module CPEE
|
|
|
138
164
|
x.class == String ? x : x.pretty_inspect
|
|
139
165
|
end
|
|
140
166
|
|
|
167
|
+
def attributes_translated
|
|
168
|
+
@attributes_helper.translate(attributes,dataelements,endpoints)
|
|
169
|
+
end
|
|
170
|
+
|
|
141
171
|
def host
|
|
142
172
|
@opts[:host]
|
|
143
173
|
end
|
|
@@ -145,7 +175,7 @@ module CPEE
|
|
|
145
175
|
@opts[:url]
|
|
146
176
|
end
|
|
147
177
|
def instance_url
|
|
148
|
-
|
|
178
|
+
File.join(@opts[:url].to_s,@id.to_s)
|
|
149
179
|
end
|
|
150
180
|
def base
|
|
151
181
|
base_url
|
|
@@ -153,6 +183,12 @@ module CPEE
|
|
|
153
183
|
def instance
|
|
154
184
|
instance_url
|
|
155
185
|
end
|
|
186
|
+
def endpoints
|
|
187
|
+
@instance.endpoints
|
|
188
|
+
end
|
|
189
|
+
def dataelements
|
|
190
|
+
@instance.data
|
|
191
|
+
end
|
|
156
192
|
|
|
157
193
|
def sim # {{{
|
|
158
194
|
@thread.join if !@thread.nil? && @thread.alive?
|
|
@@ -191,9 +227,6 @@ module CPEE
|
|
|
191
227
|
def finalize_if_finished
|
|
192
228
|
if @instance.state == :finished
|
|
193
229
|
@instance = nil
|
|
194
|
-
@notifications.subscriptions.keys.each do |key|
|
|
195
|
-
unserialize_notifications!(:del,key)
|
|
196
|
-
end
|
|
197
230
|
end
|
|
198
231
|
end
|
|
199
232
|
|
|
@@ -316,7 +349,7 @@ module CPEE
|
|
|
316
349
|
def unserialize_attributes! #{{{
|
|
317
350
|
@attributes = {}
|
|
318
351
|
@properties.data.find("/p:properties/p:attributes/p:*").map do |ele|
|
|
319
|
-
@attributes[ele.qname.name] = ele.text
|
|
352
|
+
@attributes[ele.qname.name.to_sym] = ele.text
|
|
320
353
|
end
|
|
321
354
|
uuid = @properties.data.find("/p:properties/p:attributes/p:uuid")
|
|
322
355
|
if uuid.empty? || uuid.length != 1 || @properties.data.find("/p:properties/p:attributes/p:uuid[.=\"#{@uuid}\"]").empty?
|
|
@@ -515,6 +548,7 @@ module CPEE
|
|
|
515
548
|
|
|
516
549
|
def notify(what,content={})# {{{
|
|
517
550
|
item = @events[what]
|
|
551
|
+
|
|
518
552
|
if item
|
|
519
553
|
item.each do |ke,ur|
|
|
520
554
|
Thread.new(ke,ur) do |key,url|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# This file is part of CPEE.
|
|
2
|
-
#
|
|
2
|
+
#
|
|
3
3
|
# CPEE is free software: you can redistribute it and/or modify it under the terms
|
|
4
4
|
# of the GNU General Public License as published by the Free Software Foundation,
|
|
5
5
|
# either version 3 of the License, or (at your option) any later version.
|
|
6
|
-
#
|
|
6
|
+
#
|
|
7
7
|
# CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
8
8
|
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
9
9
|
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
10
|
-
#
|
|
10
|
+
#
|
|
11
11
|
# You should have received a copy of the GNU General Public License along with
|
|
12
12
|
# CPEE (file COPYING in the main directory). If not, see
|
|
13
13
|
# <http://www.gnu.org/licenses/>.
|
|
@@ -25,19 +25,19 @@ class PropertiesHandler < Riddl::Utils::Properties::HandlerBase
|
|
|
25
25
|
end
|
|
26
26
|
when 'endpoints'
|
|
27
27
|
@data.unserialize_endpoints!
|
|
28
|
-
@data.notify('endpoints/change', :instance => @data.instance)
|
|
28
|
+
@data.notify('endpoints/change', :label => 'external', :instance => @data.instance, :instance_name => @data.info, :instance_uuid => @data.uuid, :changed => @data.endpoints.keys, :values => @data.endpoints)
|
|
29
29
|
when 'dataelements'
|
|
30
30
|
@data.unserialize_dataelements!
|
|
31
|
-
@data.notify('dataelements/change', :instance => @data.instance)
|
|
31
|
+
@data.notify('dataelements/change', :label => 'external', :instance => @data.instance, :instance_name => @data.info, :instance_uuid => @data.uuid, :changed => @data.dataelements.keys, :values => @data.dataelements)
|
|
32
32
|
when 'attributes'
|
|
33
33
|
@data.unserialize_attributes!
|
|
34
|
-
@data.notify('attributes/change', :instance => @data.instance)
|
|
35
|
-
when 'positions'
|
|
34
|
+
@data.notify('attributes/change', :label => 'external', :instance => @data.instance, :instance_name => @data.info, :instance_uuid => @data.uuid, :changed => @data.attributes.keys, :values => @data.attributes)
|
|
35
|
+
when 'positions'
|
|
36
36
|
@data.unserialize_positions!
|
|
37
37
|
@data.notify('position/change', :instance => @data.instance)
|
|
38
|
-
when 'transformation'
|
|
38
|
+
when 'transformation'
|
|
39
39
|
@data.notify('transformation/change', :instance => @data.instance)
|
|
40
|
-
when 'state'
|
|
40
|
+
when 'state'
|
|
41
41
|
@data.unserialize_state!
|
|
42
42
|
else
|
|
43
43
|
nil
|
data/lib/cpee/instantiation.rb
CHANGED
|
@@ -24,7 +24,7 @@ module CPEE
|
|
|
24
24
|
SERVER = File.expand_path(__dir__ + '/../instantiation.xml')
|
|
25
25
|
|
|
26
26
|
module Helpers #{{{
|
|
27
|
-
def load_testset(tdoc,cpee) #{{{
|
|
27
|
+
def load_testset(tdoc,cpee,name=nil) #{{{
|
|
28
28
|
ins = -1
|
|
29
29
|
XML::Smart.string(tdoc) do |doc|
|
|
30
30
|
doc.register_namespace 'desc', 'http://cpee.org/ns/description/1.0'
|
|
@@ -32,6 +32,12 @@ module CPEE
|
|
|
32
32
|
|
|
33
33
|
srv = Riddl::Client.new(cpee, cpee + "?riddl-description")
|
|
34
34
|
res = srv.resource("/")
|
|
35
|
+
if name
|
|
36
|
+
doc.find("/testset/attributes/prop:info").each do |e|
|
|
37
|
+
e.text = name
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
35
41
|
status, response = res.post Riddl::Parameter::Simple.new("info",doc.find("string(/testset/attributes/prop:info)"))
|
|
36
42
|
|
|
37
43
|
if status == 200
|
|
@@ -129,19 +135,19 @@ module CPEE
|
|
|
129
135
|
|
|
130
136
|
def response
|
|
131
137
|
cpee = @a[0]
|
|
132
|
-
status, res = Riddl::Client.new(@p[
|
|
138
|
+
status, res = Riddl::Client.new(@p[2].value).get
|
|
133
139
|
tdoc = if status >= 200 && status < 300
|
|
134
140
|
res[0].value.read
|
|
135
141
|
else
|
|
136
142
|
(@status = 500) && return
|
|
137
143
|
end
|
|
138
144
|
|
|
139
|
-
if (instance = load_testset(tdoc,cpee)) == -1
|
|
145
|
+
if (instance = load_testset(tdoc,cpee,@p[0].value)) == -1
|
|
140
146
|
@status = 500
|
|
141
147
|
else
|
|
142
|
-
handle_data cpee, instance, @p[
|
|
143
|
-
handle_waiting cpee, instance, @p[
|
|
144
|
-
handle_starting cpee, instance, @p[
|
|
148
|
+
handle_data cpee, instance, @p[3]&.value
|
|
149
|
+
handle_waiting cpee, instance, @p[1].value
|
|
150
|
+
handle_starting cpee, instance, @p[1].value
|
|
145
151
|
return Riddl::Parameter::Simple.new("url",cpee + instance)
|
|
146
152
|
end
|
|
147
153
|
end
|
data/lib/instantiation.xml
CHANGED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
#!/usr/bin/ruby
|
|
2
|
+
require 'pp'
|
|
3
|
+
require 'json'
|
|
4
|
+
require 'yaml'
|
|
5
|
+
require 'rubygems'
|
|
6
|
+
require 'riddl/server'
|
|
7
|
+
require 'riddl/utils/fileserve'
|
|
8
|
+
require 'json'
|
|
9
|
+
require 'time'
|
|
10
|
+
|
|
11
|
+
require 'faraday'
|
|
12
|
+
require 'elasticsearch'
|
|
13
|
+
require 'logger'
|
|
14
|
+
|
|
15
|
+
class Logging < Riddl::Implementation #{{{
|
|
16
|
+
def doc(topic,event_name,esc,template,instancenr,notification)
|
|
17
|
+
uuid = notification['instance_uuid']
|
|
18
|
+
return unless uuid
|
|
19
|
+
|
|
20
|
+
activity = notification['activity']
|
|
21
|
+
parameters = notification['parameters']
|
|
22
|
+
receiving = notification['received']
|
|
23
|
+
|
|
24
|
+
log = YAML::load(File.read(template))
|
|
25
|
+
log["log"]["trace"]["concept:name"] ||= instancenr.to_i
|
|
26
|
+
log["log"]["trace"]["cpee:name"] ||= notification['instance_name'] if notification["instance_name"]
|
|
27
|
+
log["log"]["trace"]["cpee:uuid"] ||= notification['instance_uuid'] if notification["instance_uuid"]
|
|
28
|
+
unless esc.indices.exists? index: 'trace'
|
|
29
|
+
esc.indices.create index: 'trace', body: {
|
|
30
|
+
"mappings" => {
|
|
31
|
+
"entry" => {
|
|
32
|
+
"properties" => {
|
|
33
|
+
"concept:name" => {
|
|
34
|
+
"type" => "integer"
|
|
35
|
+
},
|
|
36
|
+
"cpee:name" => {
|
|
37
|
+
"type" => "text"
|
|
38
|
+
},
|
|
39
|
+
"cpee:uuid": {
|
|
40
|
+
"type" => "text"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
esc.index index: 'trace', type: 'entry', id: log["log"]["trace"]["cpee:uuid"], body: log["log"]["trace"]
|
|
49
|
+
p notification['attributes']
|
|
50
|
+
|
|
51
|
+
event = {}
|
|
52
|
+
event["trace:id"] = instancenr
|
|
53
|
+
event["concept:name"] = notification["label"] if notification["label"]
|
|
54
|
+
if notification["endpoint"]
|
|
55
|
+
event["concept:endpoint"] = notification["endpoint"]
|
|
56
|
+
end
|
|
57
|
+
event["id:id"] = (activity.nil? || activity == "") ? 'external' : activity
|
|
58
|
+
event["cpee:uuid"] = notification['instance_uuid'] if notification["instance_uuid"]
|
|
59
|
+
case event_name
|
|
60
|
+
when 'receiving', 'change'
|
|
61
|
+
event["lifecycle:transition"] = "unknown"
|
|
62
|
+
when 'done'
|
|
63
|
+
event["lifecycle:transition"] = "complete"
|
|
64
|
+
else
|
|
65
|
+
event["lifecycle:transition"] = "start"
|
|
66
|
+
end
|
|
67
|
+
event["cpee:lifecycle:transition"] = "#{topic}/#{event_name}"
|
|
68
|
+
data_send = ((parameters["arguments"].nil? ? [] : parameters["arguments"]) rescue [])
|
|
69
|
+
event["list"] = {"data_send" => data_send} unless data_send.empty?
|
|
70
|
+
if notification['changed']&.any?
|
|
71
|
+
if event.has_key? "list"
|
|
72
|
+
event["list"]["data_changed"] ||= notification['changed']
|
|
73
|
+
else
|
|
74
|
+
event["list"] = {"data_changer" => notification['changed']}
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
if notification['values']&.any?
|
|
78
|
+
if event.has_key? "list"
|
|
79
|
+
event["list"]["data_values"] ||= notification['values']
|
|
80
|
+
else
|
|
81
|
+
event["list"] = {"data_values" => notification['values']}
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
if receiving&.any?
|
|
85
|
+
if event.has_key? "list"
|
|
86
|
+
event["list"]["data_received"] ||= receiving
|
|
87
|
+
else
|
|
88
|
+
event["list"] = {"data_receiver" => receiving}
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
event["time:timestamp"]= Time.now.iso8601
|
|
92
|
+
|
|
93
|
+
iname = "instance_" + notification['instance_name'].downcase.gsub(/[^a-z]/,'_')
|
|
94
|
+
esc.indices.create index: iname rescue nil
|
|
95
|
+
esc.index index: iname, type: 'entry', body: event
|
|
96
|
+
nil
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def response
|
|
100
|
+
topic = @p[1].value
|
|
101
|
+
event_name = @p[2].value
|
|
102
|
+
esc = @a[0]
|
|
103
|
+
template = @a[1]
|
|
104
|
+
instancenr = @h['CPEE_INSTANCE'].split('/').last
|
|
105
|
+
notification = JSON.parse(@p[3].value)
|
|
106
|
+
doc topic, event_name, esc, template, instancenr, notification
|
|
107
|
+
end
|
|
108
|
+
end #}}}
|
|
109
|
+
|
|
110
|
+
Riddl::Server.new(File.join(__dir__,'/log.xml'), :host => 'localhost', :port => 9307) do
|
|
111
|
+
accessible_description true
|
|
112
|
+
cross_site_xhr true
|
|
113
|
+
@riddl_opts[:template] ||= File.join(__dir__,'template.xes_yaml')
|
|
114
|
+
@riddl_opts[:esc] = Elasticsearch::Client.new hosts: ['localhost:8400']
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
interface 'events' do
|
|
118
|
+
run Logging, @riddl_opts[:esc], @riddl_opts[:template] if post 'event'
|
|
119
|
+
end
|
|
120
|
+
end.loop!
|
data/log/logs/1/test
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
test
|
data/log/xes_yaml.rb
CHANGED
|
@@ -26,10 +26,9 @@ class Logging < Riddl::Implementation #{{{
|
|
|
26
26
|
event["concept:name"] = notification["label"] if notification["label"]
|
|
27
27
|
if notification["endpoint"]
|
|
28
28
|
event["concept:endpoint"] = notification["endpoint"]
|
|
29
|
-
else
|
|
30
|
-
event["concept:name"] = 'Script Task'
|
|
31
29
|
end
|
|
32
|
-
event["id:id"] = activity
|
|
30
|
+
event["id:id"] = (activity.nil? || activity == "") ? 'external' : activity
|
|
31
|
+
event["cpee:uuid"] = notification['instance_uuid'] if notification["instance_uuid"]
|
|
33
32
|
case event_name
|
|
34
33
|
when 'receiving', 'change'
|
|
35
34
|
event["lifecycle:transition"] = "unknown"
|
|
@@ -66,25 +65,9 @@ class Logging < Riddl::Implementation #{{{
|
|
|
66
65
|
File.open(File.join(log_dir,uuid+'.xes.yaml'),'a') do |f|
|
|
67
66
|
f << {'event' => event}.to_yaml
|
|
68
67
|
end
|
|
68
|
+
nil
|
|
69
69
|
end
|
|
70
70
|
|
|
71
|
-
def rec_unjson(value,list,key)
|
|
72
|
-
case value
|
|
73
|
-
when Array then
|
|
74
|
-
li = list.add 'list', :key => key
|
|
75
|
-
value.each_with_index do |v,k|
|
|
76
|
-
rec_unjson(v,li,k)
|
|
77
|
-
end
|
|
78
|
-
when Hash then
|
|
79
|
-
li = list.add 'list', :key => key
|
|
80
|
-
value.each do |k,v|
|
|
81
|
-
rec_unjson(v,li,k)
|
|
82
|
-
end
|
|
83
|
-
else
|
|
84
|
-
list.add 'string', :key => key, :value => value
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
|
|
88
71
|
def response
|
|
89
72
|
topic = @p[1].value
|
|
90
73
|
event_name = @p[2].value
|
|
@@ -46,7 +46,7 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
|
|
|
46
46
|
|
|
47
47
|
def activity_handle(passthrough, parameters) # {{{
|
|
48
48
|
@label = parameters[:label]
|
|
49
|
-
@controller.notify("activity/calling", :instance => @controller.instance, :instance_uuid => @controller.uuid, :label => @label, :instance_name => @controller.info, :activity => @handler_position, :passthrough => passthrough, :endpoint => @handler_endpoint, :parameters => parameters, :time=>Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"))
|
|
49
|
+
@controller.notify("activity/calling", :instance => @controller.instance, :instance_uuid => @controller.uuid, :label => @label, :instance_name => @controller.info, :activity => @handler_position, :passthrough => passthrough, :endpoint => @handler_endpoint, :parameters => parameters, :time=>Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"), :attributes => @controller.attributes_translated)
|
|
50
50
|
if passthrough.nil?
|
|
51
51
|
params = []
|
|
52
52
|
callback = Digest::MD5.hexdigest(Kernel::rand().to_s)
|
|
@@ -65,7 +65,7 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
|
|
|
65
65
|
params << Riddl::Header.new("CPEE-ACTIVITY",@handler_position)
|
|
66
66
|
params << Riddl::Header.new("CPEE-LABEL",parameters[:label]||'')
|
|
67
67
|
@controller.attributes.each do |key,value|
|
|
68
|
-
params << Riddl::Header.new("CPEE-ATTR-#{key.gsub(/_/,'-')}",value)
|
|
68
|
+
params << Riddl::Header.new("CPEE-ATTR-#{key.to_s.gsub(/_/,'-')}",value)
|
|
69
69
|
end
|
|
70
70
|
|
|
71
71
|
type = parameters[:method] || 'post'
|
|
@@ -107,28 +107,28 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
|
|
|
107
107
|
end # }}}
|
|
108
108
|
|
|
109
109
|
def inform_activity_done # {{{
|
|
110
|
-
@controller.notify("activity/done", :endpoint => @handler_endpoint, :instance => @controller.instance, :label => @label, :instance_name => @controller.info, :instance_uuid => @controller.uuid, :activity => @handler_position, :time=>Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"))
|
|
110
|
+
@controller.notify("activity/done", :endpoint => @handler_endpoint, :instance => @controller.instance, :label => @label, :instance_name => @controller.info, :instance_uuid => @controller.uuid, :activity => @handler_position, :time=>Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"), :attributes => @controller.attributes_translated)
|
|
111
111
|
end # }}}
|
|
112
112
|
def inform_activity_manipulate # {{{
|
|
113
|
-
@controller.notify("activity/manipulating", :endpoint => @handler_endpoint, :instance => @controller.instance, :label => @label, :instance_name => @controller.info, :instance_uuid => @controller.uuid, :activity => @handler_position, :time=>Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"))
|
|
113
|
+
@controller.notify("activity/manipulating", :endpoint => @handler_endpoint, :instance => @controller.instance, :label => @label, :instance_name => @controller.info, :instance_uuid => @controller.uuid, :activity => @handler_position, :time=>Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"), :attributes => @controller.attributes_translated)
|
|
114
114
|
end # }}}
|
|
115
115
|
def inform_activity_failed(err) # {{{
|
|
116
116
|
puts err.message
|
|
117
117
|
puts err.backtrace
|
|
118
|
-
@controller.notify("activity/failed", :endpoint => @handler_endpoint, :label => @label, :instance_name => @controller.info, :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position, :message => err.message, :line => err.backtrace[0].match(/(.*?):(\d+):/)[2], :where => err.backtrace[0].match(/(.*?):(\d+):/)[1], :time=>Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"))
|
|
118
|
+
@controller.notify("activity/failed", :endpoint => @handler_endpoint, :label => @label, :instance_name => @controller.info, :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position, :message => err.message, :line => err.backtrace[0].match(/(.*?):(\d+):/)[2], :where => err.backtrace[0].match(/(.*?):(\d+):/)[1], :time=>Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"), :attributes => @controller.attributes_translated)
|
|
119
119
|
end # }}}
|
|
120
120
|
def inform_manipulate_change(status,changed_dataelements,changed_endpoints,dataelements,endpoints) # {{{
|
|
121
121
|
unless status.nil?
|
|
122
122
|
@controller.serialize_status!
|
|
123
|
-
@controller.notify("status/change", :endpoint => @handler_endpoint, :label => @label, :instance_name => @controller.info, :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position, :id => status.id, :message => status.message)
|
|
123
|
+
@controller.notify("status/change", :endpoint => @handler_endpoint, :label => @label, :instance_name => @controller.info, :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position, :id => status.id, :message => status.message, :attributes => @controller.attributes_translated)
|
|
124
124
|
end
|
|
125
125
|
unless changed_dataelements.nil?
|
|
126
126
|
@controller.serialize_dataelements!
|
|
127
|
-
@controller.notify("dataelements/change", :endpoint => @handler_endpoint, :label => @label, :instance_name => @controller.info, :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position, :changed => changed_dataelements, :values => dataelements)
|
|
127
|
+
@controller.notify("dataelements/change", :endpoint => @handler_endpoint, :label => @label, :instance_name => @controller.info, :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position, :changed => changed_dataelements, :values => dataelements, :attributes => @controller.attributes_translated)
|
|
128
128
|
end
|
|
129
129
|
unless changed_endpoints.nil?
|
|
130
130
|
@controller.serialize_endpoints!
|
|
131
|
-
@controller.notify("endpoints/change", :endpoint => @handler_endpoint, :label => @label, :instance_name => @controller.info, :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position, :changed => changed_endpoints, :values => endpoints)
|
|
131
|
+
@controller.notify("endpoints/change", :endpoint => @handler_endpoint, :label => @label, :instance_name => @controller.info, :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position, :changed => changed_endpoints, :values => endpoints, :attributes => @controller.attributes_translated)
|
|
132
132
|
end
|
|
133
133
|
end # }}}
|
|
134
134
|
|
|
@@ -197,12 +197,12 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
|
|
|
197
197
|
end
|
|
198
198
|
|
|
199
199
|
def callback(result=nil,options={})
|
|
200
|
-
@controller.notify("activity/receiving", :instance => @controller.instance, :label => @label, :instance_name => @controller.info, :instance_uuid => @controller.uuid, :activity => @handler_position, :endpoint => @handler_endpoint, :received => structurize_result(result), :time=>Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"))
|
|
200
|
+
@controller.notify("activity/receiving", :instance => @controller.instance, :label => @label, :instance_name => @controller.info, :instance_uuid => @controller.uuid, :activity => @handler_position, :endpoint => @handler_endpoint, :received => structurize_result(result), :time=>Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"), :attributes => @controller.attributes_translated)
|
|
201
201
|
result = simplify_result(result)
|
|
202
202
|
if options['CPEE_UPDATE']
|
|
203
203
|
@handler_returnValue = result
|
|
204
204
|
if options['CPEE_UPDATE_STATUS']
|
|
205
|
-
@controller.notify("activity/status", :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position, :endpoint => @handler_endpoint, :status => options['CPEE_UPDATE_STATUS'], :time=>Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"))
|
|
205
|
+
@controller.notify("activity/status", :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position, :endpoint => @handler_endpoint, :status => options['CPEE_UPDATE_STATUS'], :time=>Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"), :attributes => @controller.attributes_translated)
|
|
206
206
|
end
|
|
207
207
|
@handler_continue.continue WEEL::Signal::Again
|
|
208
208
|
else
|