cpee 2.1.12 → 2.1.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 18b365831308d00c63c51738bb800255bb0fe6813f4cf368e7ec60b32609a2b8
4
- data.tar.gz: a777bc87bcea1990238ff50950a0179c8b9076774496a53ed7bb1eedc2cb875c
3
+ metadata.gz: 49e634c161f11e6701a10d2823b9df0e45375ce9b0808cd90d5d0be60e8583a2
4
+ data.tar.gz: 30888c84a0244ce4cdfa9cf77f5be0637d50717de4b14fe0a51f300a9b151689
5
5
  SHA512:
6
- metadata.gz: 6b4c1476fffb5bfa7b7bbadebc9af1cdf2a8b8703ff15f4378946661613e95be0b3fbf54416637d63e4410f5563a723ca0e91a3fddaaeeb5e60a49e63e82eecd
7
- data.tar.gz: 1f274d19467c64173562ba9d01dd97c192dd1b2a5ce15556d866c00fa0908e13666361b59bda02f5222b04c68a131940ac942b633c4cefcc4bb7e1e240c52873
6
+ metadata.gz: ee8cd1e8a77277bd005e19caf3e6f52b21c9b79d7e29e4fa0072c7b56226fc063e2f1159eae7c1f5eab15f5d29095c39d748dd8d3b3c9872960dc93f09b9d53d
7
+ data.tar.gz: 50622f0ae03580818fa5f33347e1f5227906fd542923e400d50817ad77241fe8257b30fdc1020d4ebc37be977fb3e077321a0532d0ee65fb6c265bdf80d34255
@@ -56,7 +56,7 @@ var sub_more = 'topic' + '=' + 'activity' + '&' +// {{{
56
56
  'events' + '=' + 'instantiation' + '&' +
57
57
  'topic' + '=' + 'transformation' + '&' +
58
58
  'events' + '=' + 'change' + '&' +
59
- 'topic' + '=' + 'connectionwrapper' + '&' +
59
+ 'topic' + '=' + 'executionhandler' + '&' +
60
60
  'events' + '=' + 'error,change' + '&' +
61
61
  'topic' + '=' + 'handlers' + '&' +
62
62
  'events' + '=' + 'change';// }}}
@@ -78,7 +78,7 @@ var sub_less = 'topic' + '=' + 'activity' + '&' +// {{{
78
78
  'events' + '=' + 'instantiation' + '&' +
79
79
  'topic' + '=' + 'transformation' + '&' +
80
80
  'events' + '=' + 'change' + '&' +
81
- 'topic' + '=' + 'connectionwrapper' + '&' +
81
+ 'topic' + '=' + 'executionhandler' + '&' +
82
82
  'events' + '=' + 'error,change' + '&' +
83
83
  'topic' + '=' + 'handlers' + '&' +
84
84
  'events' + '=' + 'change';// }}}
@@ -1366,6 +1366,11 @@ function append_to_log(what,type,message) {//{{{
1366
1366
  message = message.replace(/:\"/g,': "');
1367
1367
  message = message.replace(/:\{/g,': {');
1368
1368
  message = message.replace(/:\[/g,': [');
1369
+ message = message.replace(/&/g, '&');
1370
+ message = message.replace(/</g, '&lt;');
1371
+ message = message.replace(/>/g, '&gt;');
1372
+ message = message.replace(/"/g, '&quot;');
1373
+ message = message.replace(/'/g, '&apos;');
1369
1374
  $("#dat_log").prepend("<tr><td class='fixed'><a title=\"" + d.strftime("[%d/%b/%Y %H:%M:%S]") + "\">D</a></td><td class='fixed'>&#160;-&#160;</td><td class='fixed'><a title=\"" + what + "\">T</a></td><td class='fixed'>&#160;-&#160;</td><td class='fixed'>" + type + "</td><td class='fixed'>&#160;-&#160;</td><td class='long'>" + message + "</td></tr>");
1370
1375
  var dle = $("#dat_log").children();
1371
1376
  if (dle.length > 100) {
data/cpee.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cpee"
3
- s.version = "2.1.12"
3
+ s.version = "2.1.16"
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.org). If you just need workflow execution, without a rest service exposing it, then use WEEL."
@@ -77,7 +77,7 @@ module CPEE
77
77
  opts[:redis_pid] ||= 'redis.pid' # use e.g. /var/run/redis.pid if you do global. Look it up in your redis config
78
78
  opts[:redis_db_name] ||= 'redis.rdb' # use e.g. /var/lib/redis.rdb for global stuff. Look it up in your redis config
79
79
 
80
- CPEE::redis_connect opts
80
+ CPEE::redis_connect opts, 'Server Main'
81
81
 
82
82
  opts[:sse_keepalive_frequency] ||= 10
83
83
  opts[:sse_connections] = {}
@@ -179,7 +179,7 @@ module CPEE
179
179
  end #}}}
180
180
 
181
181
  def self::sse_distributor(opts) #{{{
182
- conn = opts[:redis_dyn].call
182
+ conn = opts[:redis_dyn].call "Server SSE"
183
183
  conn.psubscribe('forward:*','event:state/change') do |on|
184
184
  on.pmessage do |pat, what, message|
185
185
  if pat == 'forward:*'
data/lib/cpee/redis.rb CHANGED
@@ -15,29 +15,30 @@
15
15
  require 'redis'
16
16
 
17
17
  module CPEE
18
- def self::redis_connect(opts)
18
+ def self::redis_connect(opts,name=nil)
19
19
  if opts[:redis_cmd].nil?
20
20
  begin
21
21
  if opts[:redis_path]
22
- opts[:redis_dyn] = Proc.new { Redis.new(path: opts[:redis_path], db: opts[:redis_db]) }
22
+ opts[:redis_dyn] = Proc.new { |name| Redis.new(path: opts[:redis_path], db: opts[:redis_db], id: name.gsub(/[^a-zA-Z0-9]/,'-') ) }
23
23
  elsif opts[:redis_url]
24
- opts[:redis_dyn] = Proc.new { Redis.new(url: opts[:redis_url], db: opts[:redis_db]) }
24
+ opts[:redis_dyn] = Proc.new { |name| Redis.new(url: opts[:redis_url], db: opts[:redis_db], id: name.gsub(/[^a-zA-Z0-9]/,'-') ) }
25
25
  else
26
26
  raise
27
27
  end
28
- opts[:redis] = opts[:redis_dyn].call
28
+ opts[:redis] = opts[:redis_dyn].call name.gsub(/[^a-zA-Z0-9]/,'-')
29
29
  opts[:redis].dbsize
30
30
  rescue
31
31
  puts 'can not connect to redis. check if it is running and cpee is configured correctly ...'
32
32
  exit
33
33
  end
34
34
  else # we always assume file socket if redis is startet locally
35
- opts[:redis_dyn] = Proc.new { Redis.new(path: File.join(opts[:basepath],opts[:redis_path]), db: opts[:redis_db].to_i) }
35
+ opts[:redis_dyn] = Proc.new { |name| Redis.new(path: File.join(opts[:basepath],opts[:redis_path]), db: opts[:redis_db].to_i, id: name.gsub(/[^a-zA-Z0-9]/,'-') ) }
36
36
  tried = false
37
37
  begin
38
- opts[:redis] = opts[:redis_dyn].call
38
+ opts[:redis] = opts[:redis_dyn].call name.gsub(/[^a-zA-Z0-9]/,'-')
39
39
  opts[:redis].dbsize
40
- rescue
40
+ rescue => e
41
+ puts e
41
42
  res = unless tried
42
43
  rcmd = opts[:redis_cmd]
43
44
  rcmd.gsub! /#redis_path#/, File.join(opts[:basepath],opts[:redis_path])
@@ -13,6 +13,7 @@
13
13
  # <http://www.gnu.org/licenses/>.
14
14
 
15
15
  require 'charlock_holmes'
16
+ require 'base64'
16
17
 
17
18
  class ConnectionWrapper < WEEL::ConnectionWrapperBase
18
19
  def self::loop_guard(arguments,id,count) # {{{
@@ -197,11 +198,12 @@ class ConnectionWrapper < WEEL::ConnectionWrapperBase
197
198
  unless status.nil?
198
199
  @controller.notify("status/change", :'activity-uuid' => @handler_activity_uuid, :endpoint => @handler_endpoint, :label => @label, :activity => @handler_position, :id => status.id, :message => status.message)
199
200
  end
200
- unless changed_dataelements.nil?
201
- @controller.notify("dataelements/change", :'activity-uuid' => @handler_activity_uuid, :endpoint => @handler_endpoint, :label => @label, :activity => @handler_position, :changed => changed_dataelements, :values => dataelements)
201
+ unless changed_dataelements.nil? || changed_dataelements.empty?
202
+ de = dataelements.slice(*changed_dataelements).transform_values { |v| detect_encoding(v) == 'UTF-8' ? v : convert_to_base64(v) }
203
+ @controller.notify("dataelements/change", :'activity-uuid' => @handler_activity_uuid, :endpoint => @handler_endpoint, :label => @label, :activity => @handler_position, :changed => changed_dataelements, :values => de)
202
204
  end
203
- unless changed_endpoints.nil?
204
- @controller.notify("endpoints/change", :'activity-uuid' => @handler_activity_uuid, :endpoint => @handler_endpoint, :label => @label, :activity => @handler_position, :changed => changed_endpoints, :values => endpoints)
205
+ unless changed_endpoints.nil? || changed_endpoints.empty?
206
+ @controller.notify("endpoints/change", :'activity-uuid' => @handler_activity_uuid, :endpoint => @handler_endpoint, :label => @label, :activity => @handler_position, :changed => changed_endpoints, :values => endpoints.slice(*changed_endpoints))
205
207
  end
206
208
  end # }}}
207
209
 
@@ -241,12 +243,12 @@ class ConnectionWrapper < WEEL::ConnectionWrapperBase
241
243
  result
242
244
  end
243
245
 
244
- def detected_encoding(text)
246
+ def detect_encoding(text)
245
247
  CharlockHolmes::EncodingDetector.detect(text)[:encoding] || 'ISO-8859-1'
246
248
  end
247
249
 
248
- def convert_to_utf8(text)
249
- CharlockHolmes::Converter.convert(text, detected_encoding(text), "UTF-8")
250
+ def convert_to_base64(text)
251
+ 'data:application/octet-stream;base64,' + Base64::urlsafe_encode64(text)
250
252
  end
251
253
 
252
254
  def structurize_result(result)
@@ -267,7 +269,7 @@ class ConnectionWrapper < WEEL::ConnectionWrapperBase
267
269
  tmp = {
268
270
  'name' => r.name == '' ? 'result' : r.name,
269
271
  'mimetype' => r.mimetype,
270
- 'data' => res
272
+ 'data' => (detect_encoding(res) == 'UTF-8' ? res : convert_to_base64(res))
271
273
  }
272
274
  r.value.rewind
273
275
  tmp
@@ -33,7 +33,7 @@ def ⭐(a); ParaStruct.new(a); end
33
33
 
34
34
  class Controller
35
35
  def initialize(id,dir,opts)
36
- CPEE::redis_connect(opts)
36
+ CPEE::redis_connect(opts,"Instance #{id}")
37
37
 
38
38
  @redis = opts[:redis]
39
39
  @votes = []
@@ -52,7 +52,7 @@ class Controller
52
52
  @loop_guard = {}
53
53
 
54
54
  @callback_keys = {}
55
- @psredis = @opts[:redis_dyn].call
55
+ @psredis = @opts[:redis_dyn].call "Instance #{@id} Callback Response"
56
56
 
57
57
  Thread.new do
58
58
  @psredis.psubscribe('callback-response:*','callback-end:*') do |on|
@@ -163,7 +163,7 @@ class Controller
163
163
 
164
164
  if votes.length > 0
165
165
  @votes += votes
166
- psredis = @opts[:redis_dyn].call
166
+ psredis = @opts[:redis_dyn].call "Instance #{@id} Vote"
167
167
  collect = []
168
168
  psredis.subscribe(votes.map{|e| ['vote-response:' + e.to_s] }.flatten) do |on|
169
169
  on.message do |what, message|
@@ -30,8 +30,8 @@ Daemonite.new do |opts|
30
30
  opts[:redis_path] ||= '/tmp/redis.sock'
31
31
  opts[:redis_db] ||= 1
32
32
 
33
- CPEE::redis_connect opts
34
- opts[:pubsubredis] = opts[:redis_dyn].call
33
+ CPEE::redis_connect opts, 'Server Routing End'
34
+ opts[:pubsubredis] = opts[:redis_dyn].call 'Server Routing End Sub'
35
35
  end
36
36
 
37
37
  run do
@@ -30,8 +30,8 @@ Daemonite.new do |opts|
30
30
  opts[:redis_path] ||= '/tmp/redis.sock'
31
31
  opts[:redis_db] ||= 1
32
32
 
33
- CPEE::redis_connect opts
34
- opts[:pubsubredis] = opts[:redis_dyn].call
33
+ CPEE::redis_connect opts, 'Server Routing Forward Events'
34
+ opts[:pubsubredis] = opts[:redis_dyn].call 'Server Routing Forward Events Sub'
35
35
  end
36
36
 
37
37
  run do
@@ -56,8 +56,8 @@ Daemonite.new do |opts|
56
56
  opts[:redis_path] ||= '/tmp/redis.sock'
57
57
  opts[:redis_db] ||= 1
58
58
 
59
- CPEE::redis_connect opts
60
- opts[:pubsubredis] = opts[:redis_dyn].call
59
+ CPEE::redis_connect opts, 'Server Routing Forward Votes'
60
+ opts[:pubsubredis] = opts[:redis_dyn].call 'Server Routing Forward Votes Sub'
61
61
  end
62
62
 
63
63
  run do
@@ -45,8 +45,8 @@ Daemonite.new do |opts|
45
45
  opts[:redis_path] ||= '/tmp/redis.sock'
46
46
  opts[:redis_db] ||= 1
47
47
 
48
- CPEE::redis_connect opts
49
- opts[:pubsubredis] = opts[:redis_dyn].call
48
+ CPEE::redis_connect opts, 'Server Routing Persist'
49
+ opts[:pubsubredis] = opts[:redis_dyn].call 'Server Routing Persist Sub'
50
50
  end
51
51
 
52
52
  run do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cpee
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.12
4
+ version: 2.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen eTM Mangler