cpee-logging-xes-yaml 1.3.31 → 1.5.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 84cb7628234c99607565dcf4a9de5131daada8bb1da09f5c04ab81afb599552c
4
- data.tar.gz: 41188414f1a414f86f49d1480648f08b867a81a16277dec1278215eef2faecd0
3
+ metadata.gz: 67349c15e1ff6d822febc79b960677462af169351a9b51c2cd44d55108e7d648
4
+ data.tar.gz: 363d7980e7e6c545bab3012471bd710b90b4e72b3601a6f7acccaceba9681503
5
5
  SHA512:
6
- metadata.gz: f725d428357ac622f44da51c4a74321d13dc0be7efa51bfb2134decf298b3438b16b2dcb0f361a18d4fc73f30d08600a4b8fd1288e4a17643bded61bca76451e
7
- data.tar.gz: abff6758b78d981b3efa34a61e9ba8a3ad82b6f31193b414d137eff5f6e454e18bb7c30cb6460a55960313466565b26901d14400d4d83a5a20892b06eacfee77
6
+ metadata.gz: b45a7d336194bcc4fcd797762dcfd8b01f07576beec18f32d6815702058013963270b88b0c589da51f435058bd0e104d89fbdac80d3247eaa2410c936aa25236
7
+ data.tar.gz: e4b0e88672ff0221fecbc8821a12b1bb3776386b27c3d1fd02f9645d86fd8612b004799892ff4e0a5f170d5ea2c69175083b09f25d7d22950e2fc14bf2f2a005
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cpee-logging-xes-yaml"
3
- s.version = "1.3.31"
3
+ s.version = "1.5.0"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3.0-or-later"
6
6
  s.summary = "Logging for the cloud process execution engine (cpee.org)"
@@ -0,0 +1,36 @@
1
+ <!--
2
+ This file is part of CPEE-LOGGING-XES-YAML.
3
+
4
+ CPEE-LOGGING-XES-YAML is free software: you can redistribute it and/or modify
5
+ it under the terms of the GNU Lesser General Public License as published by the Free
6
+ Software Foundation, either version 3 of the License, or (at your option) any
7
+ later version.
8
+
9
+ CPEE-LOGGING-XES-YAML is distributed in the hope that it will be useful, but
10
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
12
+ more details.
13
+
14
+ You should have received a copy of the GNU Lesser General Public License along with
15
+ CPEE-LOGGING-XES-YAML (file LICENSE in the main directory). If not, see
16
+ <http://www.gnu.org/licenses/>.
17
+ -->
18
+
19
+ <description datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" xmlns="http://riddl.org/ns/description/1.0" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:doc="http://cpee.org/ns/documentation">
20
+
21
+ <message name="yaml">
22
+ <parameter name="log" mimetype="text/yaml"/>
23
+ </message>
24
+ <message name="xml">
25
+ <parameter name="log" mimetype="application/xml"/>
26
+ </message>
27
+
28
+ <resource>
29
+ <resource relative="[a-f0-9-]+.xes.yaml">
30
+ <get out="yaml"/>
31
+ </resource>
32
+ <resource relative="[a-f0-9-]+.xes.xml">
33
+ <get out="xml"/>
34
+ </resource>
35
+ </resource>
36
+ </description>
@@ -14,7 +14,6 @@
14
14
  # CPEE-LOGGING-XES-YAML (file LICENSE in the main directory). If not, see
15
15
  # <http://www.gnu.org/licenses/>.
16
16
 
17
- require 'rubygems'
18
17
  require 'redis'
19
18
  require 'json'
20
19
  require 'yaml'
@@ -26,7 +25,71 @@ require_relative 'tools'
26
25
  module CPEE
27
26
  module Logging
28
27
 
29
- SERVER = File.expand_path(File.join(__dir__,'logging.xml'))
28
+ SERVER = File.expand_path(File.join(__dir__,'implementation.xml'))
29
+
30
+ class HeaderAndFile #{{{
31
+ def initialize(header, io)
32
+ @header = header
33
+ @io = io
34
+ @position = 0
35
+ end
36
+
37
+ def read(length = nil, outbuf = nil)
38
+ if @position < @header.bytesize
39
+ data = read_header(length)
40
+
41
+ if length && data.bytesize < length
42
+ remaining_length = length - data.bytesize
43
+ file_data = @io.read
44
+ data << file_data if file_data
45
+ end
46
+ else
47
+ data = @io.read(length)
48
+ end
49
+
50
+ return data.nil? || data.empty? && length ? nil : append_to_outbuf(data, outbuf)
51
+ end
52
+
53
+ def rewind
54
+ @io&.rewind
55
+ @position = 0 # returning position is the way rewind does it
56
+ end
57
+
58
+ def close
59
+ @io&.close
60
+ @io = nil
61
+ end
62
+
63
+ def read_header(length)
64
+ chunk = if length
65
+ @header.byteslice(@position, length)
66
+ else
67
+ @header.byteslice(@position..-1)
68
+ end
69
+ @position += chunk.bytesize
70
+ chunk
71
+ end
72
+ private :read_header
73
+
74
+ def append_to_outbuf(data, outbuf)
75
+ outbuf ? outbuf.replace(data || '') : data
76
+ end
77
+ private :append_to_outbuf
78
+ end #}}}
79
+
80
+ class DownloadYAML < Riddl::Implementation
81
+ def response
82
+ opts = @a[0]
83
+ fname = File.join(opts[:log_dir],@r[-1])
84
+ if File.exist?(fname)
85
+ io = File.open fname
86
+ header = File.read(fname.sub(/yaml$/,'header')) if File.exist?(fname.sub(/yaml$/,'header'))
87
+ Riddl::Parameter::Complex::new('log','text/yaml',HeaderAndFile.new(header || '',File.open(fname)))
88
+ else
89
+ @status = 404
90
+ end
91
+ end
92
+ end
30
93
 
31
94
  class Handler < Riddl::Implementation
32
95
  def response
@@ -36,7 +99,8 @@ module CPEE
36
99
  event_name = @p[2].value
37
100
  payload = @p[3].value.read
38
101
 
39
- unless File.exist? File.join(opts[:log_dir],@h['CPEE_INSTANCE_UUID'] + '.xes.yaml')
102
+ ### we write headers into its own file. If race condition at first, no problemo
103
+ unless File.exist? File.join(opts[:log_dir],@h['CPEE_INSTANCE_UUID'] + '.xes.header')
40
104
  notification = JSON.parse(payload)
41
105
  log = YAML::load(File.read(opts[:template]))
42
106
  log['log']['trace']['concept:name'] ||= notification['instance']
@@ -47,7 +111,7 @@ module CPEE
47
111
  log['log']['trace']['cpee:parent_instance_model'] ||= notification.dig('content','attributes','parent_instance_model') if notification.dig('content','attributes','parent_instance_model')
48
112
  log['log']['trace']['cpee:parent_instance_task_id'] ||= notification.dig('content','attributes','parent_instance_task_id') if notification.dig('content','attributes','parent_instance_task_id')
49
113
  log['log']['trace']['cpee:parent_instance_task_label'] ||= notification.dig('content','attributes','parent_instance_task_label') if notification.dig('content','attributes','parent_instance_task_label')
50
- File.open(File.join(opts[:log_dir],@h['CPEE_INSTANCE_UUID']+'.xes.yaml'),'w'){|f| f.puts log.to_yaml}
114
+ File.open(File.join(opts[:log_dir],@h['CPEE_INSTANCE_UUID']+'.xes.header'),'w'){|f| f.puts log.to_yaml}
51
115
  end
52
116
 
53
117
  EM.defer do
@@ -76,7 +140,7 @@ module CPEE
76
140
  class Topics < Riddl::Implementation #{{{
77
141
  def response
78
142
  opts = @a[0]
79
- Riddl::Parameter::Complex.new("overview","text/xml") do
143
+ Riddl::Parameter::Complex.new('overview','text/xml') do
80
144
  File.read(opts[:topics])
81
145
  end
82
146
  end
@@ -85,7 +149,7 @@ module CPEE
85
149
  class Subscriptions < Riddl::Implementation #{{{
86
150
  def response
87
151
  opts = @a[0]
88
- Riddl::Parameter::Complex.new("subscriptions","text/xml") do
152
+ Riddl::Parameter::Complex.new('subscriptions','text/xml') do
89
153
  ret = XML::Smart::string <<-END
90
154
  <subscriptions xmlns='http://riddl.org/ns/common-patterns/notifications-producer/2.0'/>
91
155
  END
@@ -108,7 +172,7 @@ module CPEE
108
172
  id = @r[-1]
109
173
  doc = XML::Smart::open_unprotected(File.join(opts[:notifications_dir],id,'subscription.xml'))
110
174
  doc.root.attributes['id'] = id
111
- Riddl::Parameter::Complex.new("subscriptions","text/xml",doc.to_s)
175
+ Riddl::Parameter::Complex.new('subscriptions','text/xml',doc.to_s)
112
176
  end
113
177
  end #}}}
114
178
 
@@ -119,6 +183,8 @@ module CPEE
119
183
  opts[:topics] ||= File.expand_path(File.join(__dir__,'topics.xml'))
120
184
  opts[:subscriptions] = {}
121
185
 
186
+ opts[:sse_keepalive_frequency] ||= 10
187
+
122
188
  Dir.glob(File.join(opts[:notifications_dir],'*','subscription.xml')).each do |f|
123
189
  XML::Smart::open_unprotected(f) do |doc|
124
190
  doc.register_namespace :p, 'http://riddl.org/ns/common-patterns/notifications-producer/2.0'
@@ -132,16 +198,24 @@ module CPEE
132
198
  end
133
199
 
134
200
  Proc.new do
201
+ interface 'access' do
202
+ on resource '[a-f0-9-]+.xes.yaml' do
203
+ run DownloadYAML, opts if get
204
+ end
205
+ on resource '[a-f0-9-]+.xes.xml' do
206
+ run DownloadXML, opts if get
207
+ end
208
+ end
135
209
  interface 'events' do
136
210
  run Handler, opts if post 'event'
137
211
  end
138
212
  interface 'notifications' do
139
- on resource "notifications" do
213
+ on resource 'notifications' do
140
214
  run Overview if get
141
- on resource "topics" do
215
+ on resource 'topics' do
142
216
  run Topics, opts if get
143
217
  end
144
- on resource "subscriptions" do
218
+ on resource 'subscriptions' do
145
219
  run Subscriptions, opts if get
146
220
  run CreateSubscription, opts if post 'create_subscription'
147
221
  on resource do
@@ -23,9 +23,15 @@
23
23
  <interface name="notifications">
24
24
  <xi:include href="http://www.riddl.org/ns/common-patterns/notifications-producer/2.0/producer.xml"/>
25
25
  </interface>
26
+ <interface name="access">
27
+ <xi:include href="access.xml"/>
28
+ </interface>
26
29
 
27
30
  <facade>
28
31
  <tile>
32
+ <layer name="access">
33
+ <apply-to>/logs</apply-to>
34
+ </layer>
29
35
  <layer name="events">
30
36
  <apply-to>/</apply-to>
31
37
  </layer>
@@ -81,13 +81,15 @@ module CPEE
81
81
  opts[:subscriptions].each do |e,urls|
82
82
  if e == topic + '/' + event_name
83
83
  urls.each do |url|
84
- client = Riddl::Client.new(url)
85
- client.post [
86
- Riddl::Parameter::Simple::new('type','event'),
87
- Riddl::Parameter::Simple::new('topic',topic),
88
- Riddl::Parameter::Simple::new('event',event_name),
89
- Riddl::Parameter::Complex::new('notification','application/json',payload)
90
- ]
84
+ EM.defer do
85
+ client = Riddl::Client.new(url)
86
+ client.post [
87
+ Riddl::Parameter::Simple::new('type','event'),
88
+ Riddl::Parameter::Simple::new('topic',topic),
89
+ Riddl::Parameter::Simple::new('event',event_name),
90
+ Riddl::Parameter::Complex::new('notification','application/json',payload)
91
+ ]
92
+ end
91
93
  end
92
94
  end
93
95
  end
@@ -112,53 +114,6 @@ module CPEE
112
114
  end
113
115
  end
114
116
 
115
- def self::extract_probes(where,xml)
116
- XML::Smart::string(xml) do |doc|
117
- doc.register_namespace 'd', 'http://cpee.org/ns/description/1.0'
118
- doc.find('//d:call | //d:manipulate').each do |c|
119
- File.unlink(where + '_' + c.attributes['id'] + '.probe') rescue nil
120
- c.find('d:annotations/d:_context_data_analysis/d:probes[d:probe]').each do |p|
121
- File.write(where + '_' + c.attributes['id'] + '.probe', p.dump)
122
- end
123
- end
124
- end
125
- end
126
-
127
- def self::extract_annotations(where,xml)
128
- ret = {}
129
- XML::Smart::string(xml) do |doc|
130
- doc.register_namespace 'd', 'http://cpee.org/ns/description/1.0'
131
- doc.find('/d:description | //d:call | //d:manipulate').each do |c|
132
- tid = c.attributes['id'] || 'complex'
133
- fname = where + '_' + tid + '.anno'
134
- nset = if tid == 'complex'
135
- c.find('d:*[starts-with(name(),"_")]')
136
- else
137
- c.find('d:annotations')
138
- end
139
- nset.each do |p|
140
- anno = p.dump
141
- ret[tid] ||= []
142
- ret[tid] << anno
143
- end
144
- if ret[tid]
145
- if ret[tid].length > 1
146
- ret[tid] = "<annotations xmlns=\"http://cpee.org/ns/description/1.0\">\n" +
147
- ret[tid].join("\n") + "\n" +
148
- '</annotations>'
149
- else
150
- ret[tid] = ret[tid][0]
151
- end
152
- hash = Digest::SHA1.hexdigest(ret[tid])
153
- if !File.exist?(fname) || (File.exist?(fname) && File.read(fname) != hash)
154
- File.write(fname,hash)
155
- end
156
- end
157
- end
158
- end
159
- ret
160
- end
161
-
162
117
  def self::extract_result(result)
163
118
  ret = result.map do |res|
164
119
  if res['mimetype'].nil?
@@ -196,35 +151,9 @@ module CPEE
196
151
  e.backtrace[0].gsub(/(\w+):(\d+):in.*/,'Probe ' + pid + ' Line \2: ') + e.message
197
152
  end
198
153
 
199
- def self::persist_values(where,values)
200
- unless File.exist?(where)
201
- File.write(where,'{}')
202
- end
203
- f = File.open(where,'r+')
204
- f.flock(File::LOCK_EX)
205
- json = JSON::load(f) || {}
206
- json.merge!(values)
207
- f.rewind
208
- f.truncate(0)
209
- f.write(JSON.generate(json))
210
- f.flock(File::LOCK_UN)
211
- f.close
212
- end
213
- def self::load_values(where)
214
- ret = nil
215
- File.open(where,'r') do |f|
216
- f.flock(File::LOCK_EX)
217
- ret = JSON::load(f)
218
- f.flock(File::LOCK_UN)
219
- end
220
- ret
221
- end
222
-
223
154
  def self::forward(opts,topic,event_name,payload)
224
155
  if topic == 'state' && event_name == 'change'
225
156
  self::notify(opts,topic,event_name,payload)
226
- elsif topic == 'state' && event_name == 'change'
227
- self::notify(opts,topic,event_name,payload)
228
157
  elsif topic == 'gateway' && event_name == 'join'
229
158
  self::notify(opts,topic,event_name,payload)
230
159
  end
@@ -236,7 +165,6 @@ module CPEE
236
165
  return unless instance
237
166
 
238
167
  log_dir = opts[:log_dir]
239
- template = opts[:template]
240
168
 
241
169
  instancenr = notification['instance']
242
170
  content = notification['content']
@@ -247,29 +175,6 @@ module CPEE
247
175
  parameters = content['parameters']
248
176
  receiving = content['received']
249
177
 
250
- if content['dslx']
251
- CPEE::Logging::extract_probes(File.join(log_dir,instance),content['dslx'])
252
- CPEE::Logging::extract_annotations(File.join(log_dir,instance),content['dslx']).each do |k,v|
253
- so = Marshal.load(Marshal.dump(notification))
254
- so['content'].delete('dslx')
255
- so['content'].delete('dsl')
256
- so['content'].delete('description')
257
- so['content']['annotation'] = v
258
- so['content']['activity'] = k
259
- so['topic'] = 'annotation'
260
- so['name'] = 'change'
261
- EM.defer do
262
- self::notify(opts,'annotation','change',so.to_json)
263
- end
264
- end
265
- end
266
-
267
- if topic == 'dataelements' && event_name == 'change'
268
- if content['changed']&.any?
269
- CPEE::Logging::persist_values(File.join(log_dir,instance + '.data.json'),content['values'])
270
- end
271
- end
272
-
273
178
  event = {}
274
179
  event['concept:instance'] = instancenr
275
180
  event['concept:name'] = content['label'] if content['label']
@@ -299,78 +204,79 @@ module CPEE
299
204
  unless parameters['arguments']&.nil?
300
205
  event['data'] = parameters['arguments']
301
206
  end if parameters
302
- if content['changed']&.any?
207
+ if (event_name == 'modify' || event_name == 'change') && content['values']&.any?
303
208
  event['data'] = content['values'].map do |k,v|
304
209
  { 'name' => k, 'value' => v }
305
210
  end
211
+ end
306
212
 
307
- fname = File.join(log_dir,instance + '_' + event['id:id'] + '.probe')
308
- dname = File.join(log_dir,instance + '.data.json')
213
+ if topic == 'task' && event_name == 'probe'
214
+ rs = WEEL::ReadStructure.new(content['data'],{},{},{})
215
+ rc = CPEE::Logging::extract_result(receiving) if receiving && !receiving.empty?
216
+ te = event.dup
309
217
 
310
- # Handle intrinsic data probes
311
- if File.exist?(fname)
312
- rs = WEEL::ReadStructure.new(File.exist?(dname) ? CPEE::Logging::load_values(dname) : {},{},{},{})
313
- XML::Smart::open_unprotected(fname) do |doc|
314
- doc.register_namespace 'd', 'http://cpee.org/ns/description/1.0'
315
- doc.find('//d:probe[d:extractor_type="intrinsic"]').each do |p|
316
- pid = p.find('string(d:id)')
317
- source = p.find('string(d:source)')
318
- val = CPEE::Logging::extract_val(rs,p.find('string(d:extractor_code)'),pid,nil) rescue nil
319
- # Do not add datastream entries if the dataprobes return nil
320
- if val != nil
321
- event['stream:datastream'] ||= []
322
- CPEE::Logging::merge_val(event['stream:datastream'],val,pid,source)
323
- end
218
+ content['probes'].each do |p|
219
+
220
+ if p.dig('probe','extractor_type') == 'intrinsic'
221
+ pid = p.dig('probe','id')
222
+ source = p.dig('probe','source')
223
+ val = CPEE::Logging::extract_val(rs,p.dig('probe','extractor_code'),pid,nil) rescue nil
224
+ # Do not add datastream entries if the dataprobes return nil
225
+ if val != nil
226
+ event['stream:datastream'] ||= []
227
+ CPEE::Logging::merge_val(event['stream:datastream'],val,pid,source)
324
228
  end
325
- end
326
- if event['stream:datastream'] && event['stream:datastream'].any?
327
- notification['datastream'] = event['stream:datastream']
328
- EM.defer do
329
- notification['topic'] = 'stream'
330
- notification['name'] = 'extraction'
331
- self::notify(opts,'stream','extraction',notification.to_json)
229
+ if event['stream:datastream'] && event['stream:datastream'].any?
230
+ EM.defer do
231
+ self::notify(
232
+ opts,
233
+ 'stream',
234
+ 'extraction',
235
+ notification.merge(
236
+ 'topic'=>'stream',
237
+ 'name'=>'extraction',
238
+ 'datastream'=>event['stream:datastream']
239
+ ).to_json
240
+ )
241
+ end
332
242
  end
333
243
  end
334
- end
335
- end
336
- # Handle extrinsic data probes
337
- if topic == 'activity' && event_name == 'receiving' && receiving && !receiving.empty?
338
- fname = File.join(log_dir,instance + '_' + event['id:id'] + '.probe')
339
- dname = File.join(log_dir,instance + '.data.json')
340
-
341
- if File.exist?(fname)
342
- te = event.dup
343
244
 
344
- rs = WEEL::ReadStructure.new(File.exist?(dname) ? CPEE::Logging::load_values(dname) : {},{},{},{})
345
- XML::Smart::open_unprotected(fname) do |doc|
346
- doc.register_namespace 'd', 'http://cpee.org/ns/description/1.0'
347
- if doc.find('//d:probe/d:extractor_type[.="extrinsic"]').any?
348
- rc = CPEE::Logging::extract_result(receiving)
349
- doc.find('//d:probe[d:extractor_type="extrinsic"]').each do |p|
350
- pid = p.find('string(d:id)')
245
+ if receiving && !receiving.empty?
246
+ if p.dig('probe','extractor_type') == 'extrinsic'
247
+ pid = p.dig('probe','id')
248
+ source = p.dig('probe','source')
249
+ val = CPEE::Logging::extract_val(rs,p.dig('probe','extractor_code'),pid,rc) rescue nil
250
+ # Do not add datastream entries if the dataprobes return nil
251
+ if val != nil
351
252
  te['stream:datastream'] ||= []
352
- val = CPEE::Logging::extract_val(rs,p.find('string(d:extractor_code)'),pid,rc) rescue nil
353
- if not val.nil?
354
- # Do not add datastream entries if the dataprobes return nil
355
- CPEE::Logging::merge_val(te['stream:datastream'],val,pid,p.find('string(d:source)'))
253
+ CPEE::Logging::merge_val(te['stream:datastream'],val,pid,source)
254
+ end
255
+ if te['stream:datastream'] && te['stream:datastream'].any?
256
+ te['cpee:lifecycle:transition'] = 'stream/data'
257
+ File.open(File.join(log_dir,instance+'.xes.yaml'),'a') do |f|
258
+ f << {'event' => te}.to_yaml
259
+ end
260
+ EM.defer do
261
+ self::notify(
262
+ opts,
263
+ 'stream',
264
+ 'extraction',
265
+ notification.merge(
266
+ 'topic'=>'stream',
267
+ 'name'=>'extraction',
268
+ 'datastream'=>te['stream:datastream']
269
+ ).to_json
270
+ )
356
271
  end
357
272
  end
358
273
  end
359
274
  end
360
- if te['stream:datastream'] && te['stream:datastream'].any?
361
- te['cpee:lifecycle:transition'] = 'stream/data'
362
- File.open(File.join(log_dir,instance+'.xes.yaml'),'a') do |f|
363
- f << {'event' => te}.to_yaml
364
- end
365
- notification['datastream'] = te['stream:datastream']
366
- EM.defer do
367
- notification['topic'] = 'stream'
368
- notification['name'] = 'extraction'
369
- self::notify(opts,'stream','extraction',notification.to_json)
370
- end
371
- end
275
+
372
276
  end
277
+
373
278
  end
279
+
374
280
  if receiving && !receiving.empty?
375
281
  event['data'] = receiving
376
282
  end
data/server/log CHANGED
@@ -17,7 +17,7 @@
17
17
  # <http://www.gnu.org/licenses/>.
18
18
 
19
19
  require 'rubygems'
20
- require 'cpee-logging-xes-yaml/logging'
20
+ require 'cpee-logging-xes-yaml/implementation'
21
21
 
22
22
  options = {
23
23
  :host => 'localhost',
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/ruby
2
+ #
3
+ # This file is part of CPEE-LOGGING-XES-YAML.
4
+ #
5
+ # CPEE-LOGGING-XES-YAML is free software: you can redistribute it and/or modify it
6
+ # under the terms of the GNU Lesser General Public License as published by the Free
7
+ # Software Foundation, either version 3 of the License, or (at your option) any
8
+ # later version.
9
+ #
10
+ # CPEE-LOGGING-XES-YAML is distributed in the hope that it will be useful, but
11
+ # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
+ # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
13
+ # more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public License along with
16
+ # CPEE-LOGGING-XES-YAML (file LICENSE in the main directory). If not, see
17
+ # <http://www.gnu.org/licenses/>.
18
+
19
+ path = ARGV.shift()
20
+ lookup_lines = ARGV.shift().to_i()
21
+ regexes = ARGV
22
+ regexes.map!() { |el| el.gsub("\\n","\n") }
23
+
24
+ dir = Dir.open(File.join(path))
25
+ children = dir.children()
26
+ #pp children.length()
27
+ #pp children.filter() { |el| el.include?('.xes.yaml') }.length()
28
+ #pp children.filter() { |el| el.include?('.xes.shift.yaml') }.length()
29
+ #pp children.filter() { |el| el.include?('data.json') }.length()
30
+ #pp children.filter() { |el| el.include?('.anno') }.length()
31
+ #pp children.filter() { |el| el.include?('.probe') }.length()
32
+ #pp children.filter() { |el| el.include?('.branches.json') }.length()
33
+ #pp children.filter() { |el| el.include?('.shift.json') }.length()
34
+ children.filter!() { |el| el.end_with?('.xes.yaml') }
35
+ children.each() { |filename|
36
+ begin
37
+ file = File.open(File.join(path,filename))
38
+ lookup_lines.times() {
39
+ line = file.readline()
40
+ regexes.each() { |regex|
41
+ #pp regex
42
+ if(line.include?(regex)) then
43
+ puts "#{filename} matches '#{regex.gsub("\n","\\n")}' in line '#{line.gsub("\n","\\n")}' (file last modified: #{file.stat().mtime()})"
44
+ break
45
+ end
46
+ }
47
+ }
48
+ rescue Exception => e
49
+ #pp "Problem opening or reading file: #{e} -> go to next file"
50
+ #pp filename
51
+ next
52
+ ensure
53
+ file.close()
54
+ end
55
+ }
56
+ dir.close()
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cpee-logging-xes-yaml
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.31
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen eTM Mangler
@@ -105,13 +105,15 @@ files:
105
105
  - README.md
106
106
  - Rakefile
107
107
  - cpee-logging-xes-yaml.gemspec
108
- - lib/cpee-logging-xes-yaml/logging.rb
109
- - lib/cpee-logging-xes-yaml/logging.xml
108
+ - lib/cpee-logging-xes-yaml/access.xml
109
+ - lib/cpee-logging-xes-yaml/implementation.rb
110
+ - lib/cpee-logging-xes-yaml/implementation.xml
110
111
  - lib/cpee-logging-xes-yaml/template.xes_yaml
111
112
  - lib/cpee-logging-xes-yaml/tools.rb
112
113
  - lib/cpee-logging-xes-yaml/topics.xml
113
114
  - server/log
114
115
  - tools/cpee-logging-xes-yaml
116
+ - tools/cpee-logging-xes-yaml-finder
115
117
  homepage: http://cpee.org/
116
118
  licenses:
117
119
  - LGPL-3.0-or-later