cpee-logging-xes-yaml 1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/AUTHORS +2 -0
- data/LICENSE +165 -0
- data/README.md +74 -0
- data/Rakefile +21 -0
- data/cpee-logging-xes-yaml.gemspec +26 -0
- data/lib/cpee-logging-xes-yaml/logging.rb +116 -0
- data/lib/cpee-logging-xes-yaml/logging.xml +13 -0
- data/lib/cpee-logging-xes-yaml/template.xes_yaml +28 -0
- data/server/log +18 -0
- data/tools/cpee-logging-xes-yaml +49 -0
- data/tools/sic.rb +64 -0
- metadata +103 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: da7a05239a1da8c1c5385237edd86c5e416d5890547fd887fa58afcec6964e0f
|
4
|
+
data.tar.gz: 4af562158950e42d15f8ae2cc109849785601f1f8a13b75714f8f4769f8de584
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a05b38fe0f0e2626130393e87d210c9fbe2312583dd1aa9c56953696cbed4d31a59a6989c2e8bab050dac150ef2fefbf87c6dfef6662a245333da5cb9222bcb7
|
7
|
+
data.tar.gz: c79d798d6a1aa42e4731a8feb637a49027811d7a7509bb47c0ae1af5b2dc1c6b2cf67f8af100e78715fe4506ba9ab92cb6939f54691991dca40ba6e8f1e8d2c0
|
data/AUTHORS
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
2
|
+
Version 3, 29 June 2007
|
3
|
+
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
6
|
+
of this license document, but changing it is not allowed.
|
7
|
+
|
8
|
+
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
11
|
+
License, supplemented by the additional permissions listed below.
|
12
|
+
|
13
|
+
0. Additional Definitions.
|
14
|
+
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
17
|
+
General Public License.
|
18
|
+
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
20
|
+
other than an Application or a Combined Work as defined below.
|
21
|
+
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
25
|
+
of using an interface provided by the Library.
|
26
|
+
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
28
|
+
Application with the Library. The particular version of the Library
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
30
|
+
Version".
|
31
|
+
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
35
|
+
based on the Application, and not on the Linked Version.
|
36
|
+
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
38
|
+
object code and/or source code for the Application, including any data
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
41
|
+
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
43
|
+
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
46
|
+
|
47
|
+
2. Conveying Modified Versions.
|
48
|
+
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
51
|
+
that uses the facility (other than as an argument passed when the
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
53
|
+
version:
|
54
|
+
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
56
|
+
ensure that, in the event an Application does not supply the
|
57
|
+
function or data, the facility still operates, and performs
|
58
|
+
whatever part of its purpose remains meaningful, or
|
59
|
+
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
61
|
+
this License applicable to that copy.
|
62
|
+
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
64
|
+
|
65
|
+
The object code form of an Application may incorporate material from
|
66
|
+
a header file that is part of the Library. You may convey such object
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
68
|
+
material is not limited to numerical parameters, data structure
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
71
|
+
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
73
|
+
Library is used in it and that the Library and its use are
|
74
|
+
covered by this License.
|
75
|
+
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
77
|
+
document.
|
78
|
+
|
79
|
+
4. Combined Works.
|
80
|
+
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
82
|
+
taken together, effectively do not restrict modification of the
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
85
|
+
the following:
|
86
|
+
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
88
|
+
the Library is used in it and that the Library and its use are
|
89
|
+
covered by this License.
|
90
|
+
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
92
|
+
document.
|
93
|
+
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
95
|
+
execution, include the copyright notice for the Library among
|
96
|
+
these notices, as well as a reference directing the user to the
|
97
|
+
copies of the GNU GPL and this license document.
|
98
|
+
|
99
|
+
d) Do one of the following:
|
100
|
+
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
102
|
+
License, and the Corresponding Application Code in a form
|
103
|
+
suitable for, and under terms that permit, the user to
|
104
|
+
recombine or relink the Application with a modified version of
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
107
|
+
Corresponding Source.
|
108
|
+
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
111
|
+
a copy of the Library already present on the user's computer
|
112
|
+
system, and (b) will operate properly with a modified version
|
113
|
+
of the Library that is interface-compatible with the Linked
|
114
|
+
Version.
|
115
|
+
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
117
|
+
be required to provide such information under section 6 of the
|
118
|
+
GNU GPL, and only to the extent that such information is
|
119
|
+
necessary to install and execute a modified version of the
|
120
|
+
Combined Work produced by recombining or relinking the
|
121
|
+
Application with a modified version of the Linked Version. (If
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
126
|
+
for conveying Corresponding Source.)
|
127
|
+
|
128
|
+
5. Combined Libraries.
|
129
|
+
|
130
|
+
You may place library facilities that are a work based on the
|
131
|
+
Library side by side in a single library together with other library
|
132
|
+
facilities that are not Applications and are not covered by this
|
133
|
+
License, and convey such a combined library under terms of your
|
134
|
+
choice, if you do both of the following:
|
135
|
+
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
137
|
+
on the Library, uncombined with any other library facilities,
|
138
|
+
conveyed under the terms of this License.
|
139
|
+
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
141
|
+
is a work based on the Library, and explaining where to find the
|
142
|
+
accompanying uncombined form of the same work.
|
143
|
+
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
145
|
+
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
148
|
+
versions will be similar in spirit to the present version, but may
|
149
|
+
differ in detail to address new problems or concerns.
|
150
|
+
|
151
|
+
Each version is given a distinguishing version number. If the
|
152
|
+
Library as you received it specifies that a certain numbered version
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
154
|
+
applies to it, you have the option of following the terms and
|
155
|
+
conditions either of that published version or of any later version
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
160
|
+
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
164
|
+
permanent authorization for you to choose that version for the
|
165
|
+
Library.
|
data/README.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# CPEE Logging XES YAML
|
2
|
+
|
3
|
+
To install the logging service go to the commandline
|
4
|
+
|
5
|
+
```bash
|
6
|
+
gem install cpee-logging-xes-yaml
|
7
|
+
cpee-logging-xes-yaml log
|
8
|
+
cd log
|
9
|
+
./log start
|
10
|
+
```
|
11
|
+
|
12
|
+
The service is running under port 9299. If this port has to be changed (or the
|
13
|
+
host, or local-only access, ...), create a file log.conf and add one
|
14
|
+
or many of the following yaml keys:
|
15
|
+
|
16
|
+
```yaml
|
17
|
+
:port: 9250
|
18
|
+
:host: cpee.org
|
19
|
+
:bind: 127.0.0.1
|
20
|
+
:log_dir: /var/log/cpee
|
21
|
+
```
|
22
|
+
|
23
|
+
To connec the cpee to the log, one of two things can be done: (1) add a handler to
|
24
|
+
a testset/template:
|
25
|
+
|
26
|
+
```xml
|
27
|
+
<handlers>
|
28
|
+
<handler url="http://localhost:9299/">
|
29
|
+
<events topic="activity">calling,receiving,done</events>
|
30
|
+
<events topic="dataelements">change</events>
|
31
|
+
<events topic="endpoints">change</events>
|
32
|
+
<events topic="attributes">change</events>
|
33
|
+
<events topic="task">instantiation</events>
|
34
|
+
</handler>
|
35
|
+
</handlers>
|
36
|
+
```
|
37
|
+
|
38
|
+
(2) add a default handler to the cpee by adding
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
Riddl::Server.new(CPEE::SERVER, options) do
|
42
|
+
...
|
43
|
+
@riddl_opts[:notifications_init] = File.join(__dir__,'resources','notifications')
|
44
|
+
...
|
45
|
+
use CPEE::implementation(@riddl_opts)
|
46
|
+
end.loop!
|
47
|
+
```
|
48
|
+
|
49
|
+
to the server (or alternatively to a log.conf with :notification_init
|
50
|
+
beeing a top-level yaml key). Then add a subscription file to
|
51
|
+
notifications/logging/subscription.xml
|
52
|
+
|
53
|
+
```xml
|
54
|
+
<subscription xmlns="http://riddl.org/ns/common-patterns/notifications-producer/2.0" url="http://localhost:9299/">
|
55
|
+
<topic id="activity">
|
56
|
+
<event>calling</event>
|
57
|
+
<event>receiving</event>
|
58
|
+
<event>done</event>
|
59
|
+
</topic>
|
60
|
+
<topic id="dataelements">
|
61
|
+
<event>change</event>
|
62
|
+
</topic>
|
63
|
+
<topic id="endpoints">
|
64
|
+
<event>change</event>
|
65
|
+
</topic>
|
66
|
+
<topic id="attributes">
|
67
|
+
<event>change</event>
|
68
|
+
</topic>
|
69
|
+
<topic id="task">
|
70
|
+
<event>instantiation</event>
|
71
|
+
</topic>
|
72
|
+
</subscription>
|
73
|
+
```
|
74
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rubygems/package_task'
|
3
|
+
|
4
|
+
spec = eval(File.read('cpee-logging-xes-yaml.gemspec'))
|
5
|
+
Gem::PackageTask.new(spec) do |pkg|
|
6
|
+
pkg.need_zip = true
|
7
|
+
pkg.need_tar = true
|
8
|
+
FileUtils.mkdir 'pkg' rescue nil
|
9
|
+
FileUtils.rm_rf Dir.glob('pkg/*')
|
10
|
+
FileUtils.ln_sf "#{pkg.name}.gem", "pkg/#{spec.name}.gem"
|
11
|
+
end
|
12
|
+
|
13
|
+
task :default => [:gem]
|
14
|
+
|
15
|
+
task :push => :gem do |r|
|
16
|
+
`gem push pkg/cpee-logging-xes-yaml.gem`
|
17
|
+
end
|
18
|
+
|
19
|
+
task :install => :gem do |r|
|
20
|
+
`gem install pkg/cpee-logging-xes-yaml.gem`
|
21
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "cpee-logging-xes-yaml"
|
3
|
+
s.version = "1.0"
|
4
|
+
s.platform = Gem::Platform::RUBY
|
5
|
+
s.license = "LGPL-3.0"
|
6
|
+
s.summary = "Logging for the cloud process execution engine (cpee.org)"
|
7
|
+
|
8
|
+
s.description = "see http://cpee.org"
|
9
|
+
|
10
|
+
s.files = Dir['{server/**/*,tools/**/*,lib/**/*}'] + %w(LICENSE Rakefile cpee-logging-xes-yaml.gemspec README.md AUTHORS)
|
11
|
+
s.require_path = 'lib'
|
12
|
+
s.extra_rdoc_files = ['README.md']
|
13
|
+
s.bindir = 'tools'
|
14
|
+
s.executables = ['cpee-logging-xes-yaml']
|
15
|
+
|
16
|
+
s.required_ruby_version = '>=2.4.0'
|
17
|
+
|
18
|
+
s.authors = ['Juergen eTM Mangler']
|
19
|
+
|
20
|
+
s.email = 'juergen.mangler@gmail.com'
|
21
|
+
s.homepage = 'http://cpee.org/'
|
22
|
+
|
23
|
+
s.add_runtime_dependency 'riddl', '~> 0.99'
|
24
|
+
s.add_runtime_dependency 'json', '~> 2.1'
|
25
|
+
s.add_runtime_dependency 'cpee', '~> 1', '>= 1.5'
|
26
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
# This file is part of CPEE-LOGGING-XES-YAML.
|
2
|
+
#
|
3
|
+
# CPEE-LOGGING-XES-YAML is free software: you can redistribute it and/or modify it
|
4
|
+
# under the terms of the GNU General Public License as published by the Free
|
5
|
+
# Software Foundation, either version 3 of the License, or (at your option) any
|
6
|
+
# later version.
|
7
|
+
#
|
8
|
+
# CPEE-LOGGING-XES-YAML is distributed in the hope that it will be useful, but
|
9
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
11
|
+
# more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License along with
|
14
|
+
# CPEE-LOGGING-XES-YAML (file LICENSE in the main directory). If not, see
|
15
|
+
# <http://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
require 'rubygems'
|
18
|
+
require 'redis'
|
19
|
+
require 'json'
|
20
|
+
require 'yaml'
|
21
|
+
require 'riddl/server'
|
22
|
+
require 'time'
|
23
|
+
|
24
|
+
module CPEE
|
25
|
+
module Logging
|
26
|
+
|
27
|
+
SERVER = File.expand_path(File.join(__dir__,'logging.xml'))
|
28
|
+
|
29
|
+
class Handler < Riddl::Implementation #{{{
|
30
|
+
def doc(topic,event_name,log_dir,template,notification)
|
31
|
+
instance = notification['instance-uuid']
|
32
|
+
return unless instance
|
33
|
+
|
34
|
+
instancenr = notification['instance']
|
35
|
+
content = notification['content']
|
36
|
+
activity = content['activity']
|
37
|
+
parameters = content['parameters']
|
38
|
+
receiving = content['received']
|
39
|
+
|
40
|
+
log = YAML::load(File.read(template))
|
41
|
+
log["log"]["trace"]["concept:name"] ||= instancenr
|
42
|
+
log["log"]["trace"]["cpee:name"] ||= notification['instance-name'] if notification['instance-name']
|
43
|
+
log["log"]["trace"]["cpee:instance"] ||= instance
|
44
|
+
File.open(File.join(log_dir,instance+'.xes.yaml'),'w'){|f| f.puts log.to_yaml} unless File.exists? File.join(log_dir,instance+'.xes.yaml')
|
45
|
+
event = {}
|
46
|
+
event["concept:instance"] = instancenr
|
47
|
+
event["concept:name"] = content["label"] if content["label"]
|
48
|
+
if notification["endpoint"]
|
49
|
+
event["concept:endpoint"] = content["endpoint"]
|
50
|
+
end
|
51
|
+
event["id:id"] = (activity.nil? || activity == "") ? 'external' : activity
|
52
|
+
event["cpee:activity"] = event["id:id"]
|
53
|
+
event["cpee:activity_uuid"] = content['activity-uuid'] if content['activity-uuid']
|
54
|
+
event["cpee:instance"] = instance
|
55
|
+
case event_name
|
56
|
+
when 'receiving', 'change', 'instantiation'
|
57
|
+
event["lifecycle:transition"] = "unknown"
|
58
|
+
when 'done'
|
59
|
+
event["lifecycle:transition"] = "complete"
|
60
|
+
else
|
61
|
+
event["lifecycle:transition"] = "start"
|
62
|
+
end
|
63
|
+
event["cpee:lifecycle:transition"] = "#{topic}/#{event_name}"
|
64
|
+
data_send = ((parameters["arguments"].nil? ? [] : parameters["arguments"]) rescue [])
|
65
|
+
event["data"] = {"data_send" => data_send} unless data_send.empty?
|
66
|
+
if content['changed']&.any?
|
67
|
+
if event.has_key? "data"
|
68
|
+
event["data"]["data_changed"] ||= content['changed']
|
69
|
+
else
|
70
|
+
event["data"] = {"data_changer" => content['changed']}
|
71
|
+
end
|
72
|
+
end
|
73
|
+
if content['values']&.any?
|
74
|
+
if event.has_key? "data"
|
75
|
+
event["data"]["data_values"] ||= content['values']
|
76
|
+
else
|
77
|
+
event["data"] = {"data_values" => content['values']}
|
78
|
+
end
|
79
|
+
end
|
80
|
+
if receiving && !receiving.empty?
|
81
|
+
if event.has_key? "data"
|
82
|
+
event["data"]["data_received"] ||= receiving
|
83
|
+
else
|
84
|
+
event["data"] = {"data_receiver" => receiving}
|
85
|
+
end
|
86
|
+
end
|
87
|
+
event["time:timestamp"]= event['cpee:timestamp'] || Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z")
|
88
|
+
File.open(File.join(log_dir,instance+'.xes.yaml'),'a') do |f|
|
89
|
+
f << {'event' => event}.to_yaml
|
90
|
+
end
|
91
|
+
nil
|
92
|
+
end
|
93
|
+
|
94
|
+
def response
|
95
|
+
topic = @p[1].value
|
96
|
+
event_name = @p[2].value
|
97
|
+
log_dir = @a[0]
|
98
|
+
template = @a[1]
|
99
|
+
notification = JSON.parse(@p[3].value.read)
|
100
|
+
doc topic, event_name, log_dir, template, notification
|
101
|
+
end
|
102
|
+
end #}}}
|
103
|
+
|
104
|
+
def self::implementation(opts)
|
105
|
+
opts[:log_dir] ||= File.join(__dir__,'logs')
|
106
|
+
opts[:template] ||= File.join(__dir__,'template.xes_yaml')
|
107
|
+
|
108
|
+
Proc.new do
|
109
|
+
interface 'events' do
|
110
|
+
run Handler, opts[:log_dir], opts[:template] if post 'event'
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
116
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<declaration xmlns="http://riddl.org/ns/declaration/1.0" xmlns:xi="http://www.w3.org/2001/XInclude">
|
2
|
+
<interface name="events">
|
3
|
+
<xi:include href="http://www.riddl.org/ns/common-patterns/notifications-consumer/2.0/consumer.xml"/>
|
4
|
+
</interface>
|
5
|
+
|
6
|
+
<facade>
|
7
|
+
<tile>
|
8
|
+
<layer name="events">
|
9
|
+
<apply-to>/</apply-to>
|
10
|
+
</layer>
|
11
|
+
</tile>
|
12
|
+
</facade>
|
13
|
+
</declaration>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
log:
|
3
|
+
extension:
|
4
|
+
time: http://www.xes-standard.org/time.xesext
|
5
|
+
concept: http://www.xes-standard.org/concept.xesext
|
6
|
+
organisational: http://www.xes-standard.org/org.xesext
|
7
|
+
lifecycle: http://www.xes-standard.org/lifecycle.xesext
|
8
|
+
cpee: http://cpee.org/cpee.xesext
|
9
|
+
global:
|
10
|
+
trace:
|
11
|
+
concept:name: __INVALID__
|
12
|
+
cpee:name: __INVALID__
|
13
|
+
event:
|
14
|
+
concept:instance: -1
|
15
|
+
concept:name: __INVALID__
|
16
|
+
concept:endpoint: ''
|
17
|
+
id:id: ''
|
18
|
+
cpee:uuid: ''
|
19
|
+
lifecycle:transition: complete
|
20
|
+
cpee:lifecycle:transition: activity/calling
|
21
|
+
time:timestamp: ''
|
22
|
+
classifier:
|
23
|
+
Data: data_send data_received data_changed data_values
|
24
|
+
Data_Received: data_receiver
|
25
|
+
Data_Send: data_send
|
26
|
+
Data_Changed: data_changer
|
27
|
+
Data_Values: data_values
|
28
|
+
trace: {}
|
data/server/log
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
require 'rubygems'
|
3
|
+
require 'cpee-logging-xes-yaml/logging'
|
4
|
+
|
5
|
+
options = {
|
6
|
+
:host => 'localhost',
|
7
|
+
:port => 9299,
|
8
|
+
:secure => false
|
9
|
+
}
|
10
|
+
|
11
|
+
Riddl::Server.new(CPEE::Logging::SERVER, options) do
|
12
|
+
accessible_description true
|
13
|
+
cross_site_xhr true
|
14
|
+
|
15
|
+
@riddl_opts[:log_dir] ||= File.join(__dir__,'logs')
|
16
|
+
|
17
|
+
use CPEE::Logging::implementation(@riddl_opts)
|
18
|
+
end.loop!
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
curpath = __dir__
|
3
|
+
require 'rubygems'
|
4
|
+
require 'optparse'
|
5
|
+
require 'fileutils'
|
6
|
+
require 'xml/smart'
|
7
|
+
|
8
|
+
def wrap(s, width=78, indent=18)
|
9
|
+
lines = []
|
10
|
+
line, s = s[0..indent-2], s[indent..-1]
|
11
|
+
s.split(/\n/).each do |ss|
|
12
|
+
ss.split(/[ \t]+/).each do |word|
|
13
|
+
if line.size + word.size >= width
|
14
|
+
lines << line
|
15
|
+
line = (" " * (indent)) + word
|
16
|
+
else
|
17
|
+
line << " " << word
|
18
|
+
end
|
19
|
+
end
|
20
|
+
lines << line if line
|
21
|
+
line = (" " * (indent-1))
|
22
|
+
end
|
23
|
+
return lines.join "\n"
|
24
|
+
end
|
25
|
+
|
26
|
+
ARGV.options { |opt|
|
27
|
+
opt.summary_indent = ' ' * 2
|
28
|
+
opt.summary_width = 15
|
29
|
+
opt.banner = "Usage:\n#{opt.summary_indent}#{File.basename($0)} [DIR]\n"
|
30
|
+
opt.on("Options:")
|
31
|
+
opt.on("--help", "-h", "This text") { puts opt; exit }
|
32
|
+
opt.on("")
|
33
|
+
opt.on(wrap("[DIR] scaffolds a sample logging service. Add a handler to a cpee instance to experience the pleasure."))
|
34
|
+
opt.parse!
|
35
|
+
}
|
36
|
+
if (ARGV.length != 1)
|
37
|
+
puts ARGV.options
|
38
|
+
exit
|
39
|
+
else
|
40
|
+
p1 = ARGV[0]
|
41
|
+
end
|
42
|
+
|
43
|
+
if !File.exists?(p1)
|
44
|
+
FileUtils.cp_r(File.join(curpath,'..','server'),p1)
|
45
|
+
FileUtils.mkdir(File.join(p1,'logs')) rescue nil
|
46
|
+
|
47
|
+
else
|
48
|
+
puts 'Directory already exists.'
|
49
|
+
end
|
data/tools/sic.rb
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
require 'yaml'
|
3
|
+
require 'typhoeus'
|
4
|
+
require 'stringio'
|
5
|
+
require 'xml/smart'
|
6
|
+
|
7
|
+
def follow(fname,io,deep=0)
|
8
|
+
if ARGV[1] == 'copy'
|
9
|
+
File.write(File.basename(fname,'.xes.yaml') + '.xes.yaml',io.read)
|
10
|
+
io.rewind
|
11
|
+
end
|
12
|
+
YAML.load_stream(io) do |e|
|
13
|
+
if name = e.dig('log','trace','cpee:name')
|
14
|
+
puts " " * deep + name + " (#{File.basename(fname,'.xes.yaml')}) - #{e.dig('log','trace','concept:name')}"
|
15
|
+
end
|
16
|
+
if e.dig('event','concept:endpoint') == 'https://centurio.work/flow/start/url/' && e.dig('event','cpee:lifecycle:transition') == 'task/instantiation'
|
17
|
+
base = e.dig('event','data','data_receiver')
|
18
|
+
val = base.dig('CPEE-INSTANCE') rescue nil
|
19
|
+
if val.nil?
|
20
|
+
val = File.basename(base)
|
21
|
+
end
|
22
|
+
uuid = base.dig('CPEE-INSTANCE-UUID') rescue nil
|
23
|
+
unless uuid
|
24
|
+
res = Typhoeus.get(File.join('https://centurio.work/flow/engine/',val,'/properties/values/attributes/uuid/'))
|
25
|
+
if res.success?
|
26
|
+
uuid = XML::Smart.string(res.body).find('string(/*)')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
react File.dirname(fname) + "/#{uuid}.xes.yaml",deep + 2
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def react(name,deep=0)
|
35
|
+
if name.nil?
|
36
|
+
help
|
37
|
+
elsif name =~ /^https?:\/\//
|
38
|
+
res = Typhoeus.get(name)
|
39
|
+
if res.success?
|
40
|
+
file = Tempfile.new('sic')
|
41
|
+
file.write(res.body)
|
42
|
+
file.rewind
|
43
|
+
follow name, file, deep
|
44
|
+
file.close
|
45
|
+
file.unlink
|
46
|
+
end
|
47
|
+
elsif File.exists? name
|
48
|
+
follow name, File.open(name), deep
|
49
|
+
else
|
50
|
+
help
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def help
|
55
|
+
puts 'Views or copies log file trees to current directory.'
|
56
|
+
puts
|
57
|
+
puts ' View: sic.rb https://centurio.work/log/865916c6-2b18-4e9d-81d4-0fab0df248f4.xes.yaml'
|
58
|
+
puts ' Copy: sic.rb https://centurio.work/log/865916c6-2b18-4e9d-81d4-0fab0df248f4.xes.yaml copy'
|
59
|
+
puts ' Copy: sic.rb ~/Projects/cpee/log/logs/865916c6-2b18-4e9d-81d4-0fab0df248f4.xes.yaml copy'
|
60
|
+
puts ' View: sic.rb 865916c6-2b18-4e9d-81d4-0fab0df248f4.xes.yaml'
|
61
|
+
true
|
62
|
+
end
|
63
|
+
|
64
|
+
react(ARGV[0]) || help
|
metadata
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cpee-logging-xes-yaml
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '1.0'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Juergen eTM Mangler
|
8
|
+
autorequire:
|
9
|
+
bindir: tools
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-10-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: riddl
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.99'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.99'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: json
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: cpee
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1'
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '1.5'
|
51
|
+
type: :runtime
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - "~>"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '1'
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '1.5'
|
61
|
+
description: see http://cpee.org
|
62
|
+
email: juergen.mangler@gmail.com
|
63
|
+
executables:
|
64
|
+
- cpee-logging-xes-yaml
|
65
|
+
extensions: []
|
66
|
+
extra_rdoc_files:
|
67
|
+
- README.md
|
68
|
+
files:
|
69
|
+
- AUTHORS
|
70
|
+
- LICENSE
|
71
|
+
- README.md
|
72
|
+
- Rakefile
|
73
|
+
- cpee-logging-xes-yaml.gemspec
|
74
|
+
- lib/cpee-logging-xes-yaml/logging.rb
|
75
|
+
- lib/cpee-logging-xes-yaml/logging.xml
|
76
|
+
- lib/cpee-logging-xes-yaml/template.xes_yaml
|
77
|
+
- server/log
|
78
|
+
- tools/cpee-logging-xes-yaml
|
79
|
+
- tools/sic.rb
|
80
|
+
homepage: http://cpee.org/
|
81
|
+
licenses:
|
82
|
+
- LGPL-3.0
|
83
|
+
metadata: {}
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options: []
|
86
|
+
require_paths:
|
87
|
+
- lib
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: 2.4.0
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
requirements: []
|
99
|
+
rubygems_version: 3.1.2
|
100
|
+
signing_key:
|
101
|
+
specification_version: 4
|
102
|
+
summary: Logging for the cloud process execution engine (cpee.org)
|
103
|
+
test_files: []
|