cpee 2.1.135 → 2.1.139
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 +4 -4
- data/README.md +1 -1
- data/cockpit/compliance-view.html +11 -19
- data/cockpit/compliance.html +11 -19
- data/cockpit/css/llm.css +3 -3
- data/cockpit/css/llmmodel.css +140 -0
- data/cockpit/css/model.css +0 -1
- data/cockpit/css/ui.css +13 -7
- data/cockpit/css/wfadaptor.css +15 -10
- data/cockpit/edit.html +11 -19
- data/cockpit/graph.html +8 -13
- data/cockpit/index.html +11 -19
- data/cockpit/js/details.js +27 -10
- data/cockpit/js/instance.js +219 -206
- data/cockpit/js/llm-ui-bubble.js +36 -0
- data/cockpit/js/llm-ui-status.js +34 -0
- data/cockpit/js/llm-ui.js +87 -0
- data/cockpit/js/llm.js +469 -121
- data/cockpit/js/parameters.js +45 -14
- data/cockpit/js/wfadaptor.js +402 -77
- data/cockpit/llm.html +16 -21
- data/cockpit/llmmodel.html +17 -23
- data/cockpit/model.html +8 -15
- data/cockpit/only_llm.html +14 -19
- data/cockpit/themes/THEMES.MD +4 -0
- data/cockpit/themes/base.js +1 -1
- data/cockpit/themes/packed/theme.js +3 -0
- data/cockpit/themes/presetlr/rngs/alternative.rng +28 -0
- data/cockpit/themes/presetlr/rngs/call.rng +249 -0
- data/cockpit/themes/presetlr/rngs/callmanipulate.rng +281 -0
- data/cockpit/themes/presetlr/rngs/choose.rng +27 -0
- data/cockpit/themes/presetlr/rngs/closed_loop.rng +62 -0
- data/cockpit/themes/presetlr/rngs/closed_loop_cancel.rng +5 -0
- data/cockpit/themes/presetlr/rngs/closed_loop_control.rng +31 -0
- data/cockpit/themes/presetlr/rngs/closed_loop_measuring.rng +12 -0
- data/cockpit/themes/presetlr/rngs/critical.rng +8 -0
- data/cockpit/themes/presetlr/rngs/escape.rng +5 -0
- data/cockpit/themes/presetlr/rngs/group.rng +3 -0
- data/cockpit/themes/presetlr/rngs/loop.rng +40 -0
- data/cockpit/themes/presetlr/rngs/manipulate.rng +76 -0
- data/cockpit/themes/presetlr/rngs/otherwise.rng +25 -0
- data/cockpit/themes/presetlr/rngs/parallel.rng +24 -0
- data/cockpit/themes/presetlr/rngs/parallel_branch.rng +5 -0
- data/cockpit/themes/presetlr/rngs/scripts.rng +23 -0
- data/cockpit/themes/presetlr/rngs/start.rng +143 -0
- data/cockpit/themes/presetlr/rngs/stop.rng +5 -0
- data/cockpit/themes/presetlr/rngs/terminate.rng +8 -0
- data/cockpit/themes/presetlr/rngs/wait_for_signal.rng +8 -0
- data/cockpit/themes/presetlr/symbols/alternative.svg +19 -0
- data/cockpit/themes/presetlr/symbols/arrow.svg +1 -0
- data/cockpit/themes/presetlr/symbols/call.svg +1 -0
- data/cockpit/themes/presetlr/symbols/call_sensor.svg +1 -0
- data/cockpit/themes/presetlr/symbols/callmanipulate.svg +1 -0
- data/cockpit/themes/presetlr/symbols/callmanipulate_sensor.svg +1 -0
- data/cockpit/themes/presetlr/symbols/callmanipulate_sensor_signal.svg +1 -0
- data/cockpit/themes/presetlr/symbols/callmanipulate_signal.svg +1 -0
- data/cockpit/themes/presetlr/symbols/choose.svg +15 -0
- data/cockpit/themes/presetlr/symbols/choose_exclusive.svg +15 -0
- data/cockpit/themes/presetlr/symbols/choose_exclusive_finish.svg +1 -0
- data/cockpit/themes/presetlr/symbols/choose_inclusive.svg +13 -0
- data/cockpit/themes/presetlr/symbols/choose_inclusive_finish.svg +1 -0
- data/cockpit/themes/presetlr/symbols/closed_loop.svg +1 -0
- data/cockpit/themes/presetlr/symbols/closed_loop_cancel.svg +1 -0
- data/cockpit/themes/presetlr/symbols/closed_loop_control.svg +1 -0
- data/cockpit/themes/presetlr/symbols/closed_loop_measuring.svg +1 -0
- data/cockpit/themes/presetlr/symbols/complex.svg +1 -0
- data/cockpit/themes/presetlr/symbols/critical.svg +1 -0
- data/cockpit/themes/presetlr/symbols/delete.svg +1 -0
- data/cockpit/themes/presetlr/symbols/end.svg +1 -0
- data/cockpit/themes/presetlr/symbols/escape.svg +1 -0
- data/cockpit/themes/presetlr/symbols/event_end.svg +1 -0
- data/cockpit/themes/presetlr/symbols/event_start.svg +1 -0
- data/cockpit/themes/presetlr/symbols/loop.svg +15 -0
- data/cockpit/themes/presetlr/symbols/loop_end.svg +15 -0
- data/cockpit/themes/presetlr/symbols/loop_end_pre.svg +15 -0
- data/cockpit/themes/presetlr/symbols/manipulate.svg +1 -0
- data/cockpit/themes/presetlr/symbols/mark.svg +1 -0
- data/cockpit/themes/presetlr/symbols/otherwise.svg +7 -0
- data/cockpit/themes/presetlr/symbols/parallel.svg +1 -0
- data/cockpit/themes/presetlr/symbols/parallel_branch.svg +7 -0
- data/cockpit/themes/presetlr/symbols/parallel_branch_event.svg +14 -0
- data/cockpit/themes/presetlr/symbols/parallel_branch_event_rev.svg +11 -0
- data/cockpit/themes/presetlr/symbols/parallel_branch_normal.svg +7 -0
- data/cockpit/themes/presetlr/symbols/parallel_eventbased_exclusive.svg +1 -0
- data/cockpit/themes/presetlr/symbols/parallel_eventbased_parallel.svg +1 -0
- data/cockpit/themes/presetlr/symbols/scripts.svg +1 -0
- data/cockpit/themes/presetlr/symbols/start.svg +1 -0
- data/cockpit/themes/presetlr/symbols/start_event.svg +1 -0
- data/cockpit/themes/presetlr/symbols/stop.svg +1 -0
- data/cockpit/themes/presetlr/symbols/terminate.svg +1 -0
- data/cockpit/themes/presetlr/symbols/wait_for_signal.svg +1 -0
- data/cockpit/themes/presetlr/theme.js +54 -0
- data/cockpit/themes/wellformed/rngs/alternative.rng +28 -0
- data/cockpit/themes/wellformed/rngs/call.rng +249 -0
- data/cockpit/themes/wellformed/rngs/callmanipulate.rng +281 -0
- data/cockpit/themes/wellformed/rngs/choose.rng +27 -0
- data/cockpit/themes/wellformed/rngs/closed_loop.rng +62 -0
- data/cockpit/themes/wellformed/rngs/closed_loop_cancel.rng +5 -0
- data/cockpit/themes/wellformed/rngs/closed_loop_control.rng +31 -0
- data/cockpit/themes/wellformed/rngs/closed_loop_measuring.rng +12 -0
- data/cockpit/themes/wellformed/rngs/critical.rng +8 -0
- data/cockpit/themes/wellformed/rngs/escape.rng +5 -0
- data/cockpit/themes/wellformed/rngs/group.rng +3 -0
- data/cockpit/themes/wellformed/rngs/loop.rng +40 -0
- data/cockpit/themes/wellformed/rngs/manipulate.rng +76 -0
- data/cockpit/themes/wellformed/rngs/otherwise.rng +25 -0
- data/cockpit/themes/wellformed/rngs/parallel.rng +24 -0
- data/cockpit/themes/wellformed/rngs/parallel_branch.rng +5 -0
- data/cockpit/themes/wellformed/rngs/scripts.rng +23 -0
- data/cockpit/themes/wellformed/rngs/start.rng +143 -0
- data/cockpit/themes/wellformed/rngs/stop.rng +5 -0
- data/cockpit/themes/wellformed/rngs/terminate.rng +8 -0
- data/cockpit/themes/wellformed/rngs/wait_for_signal.rng +8 -0
- data/cockpit/themes/wellformed/symbols/alternative.svg +1 -0
- data/cockpit/themes/wellformed/symbols/arrow.svg +1 -0
- data/cockpit/themes/wellformed/symbols/call.svg +1 -0
- data/cockpit/themes/wellformed/symbols/call_sensor.svg +1 -0
- data/cockpit/themes/wellformed/symbols/callmanipulate.svg +1 -0
- data/cockpit/themes/wellformed/symbols/callmanipulate_sensor.svg +1 -0
- data/cockpit/themes/wellformed/symbols/callmanipulate_sensor_signal.svg +1 -0
- data/cockpit/themes/wellformed/symbols/callmanipulate_signal.svg +1 -0
- data/cockpit/themes/wellformed/symbols/choose.svg +1 -0
- data/cockpit/themes/wellformed/symbols/choose_exclusive.svg +1 -0
- data/cockpit/themes/wellformed/symbols/choose_exclusive_finish.svg +1 -0
- data/cockpit/themes/wellformed/symbols/choose_inclusive.svg +1 -0
- data/cockpit/themes/wellformed/symbols/choose_inclusive_finish.svg +1 -0
- data/cockpit/themes/wellformed/symbols/closed_loop.svg +1 -0
- data/cockpit/themes/wellformed/symbols/closed_loop_cancel.svg +1 -0
- data/cockpit/themes/wellformed/symbols/closed_loop_control.svg +1 -0
- data/cockpit/themes/wellformed/symbols/closed_loop_measuring.svg +1 -0
- data/cockpit/themes/wellformed/symbols/complex.svg +1 -0
- data/cockpit/themes/wellformed/symbols/critical.svg +1 -0
- data/cockpit/themes/wellformed/symbols/delete.svg +1 -0
- data/cockpit/themes/wellformed/symbols/end.svg +1 -0
- data/cockpit/themes/wellformed/symbols/escape.svg +1 -0
- data/cockpit/themes/wellformed/symbols/event_end.svg +1 -0
- data/cockpit/themes/wellformed/symbols/event_start.svg +6 -0
- data/cockpit/themes/wellformed/symbols/loop.svg +1 -0
- data/cockpit/themes/wellformed/symbols/loop_end.svg +1 -0
- data/cockpit/themes/wellformed/symbols/manipulate.svg +1 -0
- data/cockpit/themes/wellformed/symbols/mark.svg +1 -0
- data/cockpit/themes/wellformed/symbols/otherwise.svg +1 -0
- data/cockpit/themes/wellformed/symbols/parallel.svg +1 -0
- data/cockpit/themes/wellformed/symbols/parallel_branch.svg +1 -0
- data/cockpit/themes/wellformed/symbols/parallel_branch_event.svg +1 -0
- data/cockpit/themes/wellformed/symbols/parallel_branch_event_rev.svg +11 -0
- data/cockpit/themes/wellformed/symbols/parallel_branch_normal.svg +1 -0
- data/cockpit/themes/wellformed/symbols/parallel_eventbased_exclusive.svg +1 -0
- data/cockpit/themes/wellformed/symbols/parallel_eventbased_parallel.svg +1 -0
- data/cockpit/themes/wellformed/symbols/scripts.svg +1 -0
- data/cockpit/themes/wellformed/symbols/start.svg +1 -0
- data/cockpit/themes/wellformed/symbols/start_event.svg +1 -0
- data/cockpit/themes/wellformed/symbols/stop.svg +1 -0
- data/cockpit/themes/wellformed/symbols/terminate.svg +1 -0
- data/cockpit/themes/wellformed/symbols/wait_for_signal.svg +1 -0
- data/cockpit/themes/wellformed/theme.js +32 -0
- data/cockpit/track.html +8 -13
- data/cpee.gemspec +3 -3
- data/lib/callbacks/callbacks.rng +4 -4
- data/lib/callbacks.xml +4 -4
- data/lib/cpee/constants.rb +4 -4
- data/lib/cpee/fail.rb +4 -4
- data/lib/cpee/implementation.rb +10 -4
- data/lib/cpee/implementation_callbacks.rb +6 -6
- data/lib/cpee/implementation_notifications.rb +8 -5
- data/lib/cpee/implementation_properties.rb +132 -12
- data/lib/cpee/json_pointer.rb +110 -0
- data/lib/cpee/message.rb +26 -6
- data/lib/cpee/persistence.rb +10 -4
- data/lib/cpee/redis.rb +12 -4
- data/lib/cpee/statemachine.rb +4 -4
- data/lib/cpee/value_helper.rb +4 -4
- data/lib/cpee.xml +4 -4
- data/lib/engine/executionhandler-list.rng +4 -4
- data/lib/engine/instance-info.rng +4 -4
- data/lib/engine/instances.rng +4 -4
- data/lib/engine.xml +4 -4
- data/lib/properties/t_dslx.rng +356 -0
- data/lib/properties/transformation.rng +14 -0
- data/lib/properties.xml +5 -4
- data/server/executionhandlers/eval/backend/opts.yaml +1 -1
- data/server/executionhandlers/eval/connection.rb +16 -7
- data/server/executionhandlers/eval/execution.rb +4 -4
- data/server/executionhandlers/ruby/backend/opts.yaml +1 -1
- data/server/executionhandlers/ruby/connection.rb +17 -9
- data/server/executionhandlers/ruby/controller.rb +21 -6
- data/server/executionhandlers/ruby/dsl_to_dslx.xsl +6 -2
- data/server/executionhandlers/ruby/execution.rb +4 -4
- data/server/resources/properties.empty +5 -4
- data/server/resources/properties.init +5 -4
- data/server/resources/topics.xml +4 -4
- data/server/routing/end.pid +1 -1
- data/server/routing/end.rb +4 -4
- data/server/routing/forward-events-00.pid +1 -1
- data/server/routing/forward-events.rb +34 -23
- data/server/routing/forward-votes.pid +1 -1
- data/server/routing/forward-votes.rb +60 -47
- data/server/routing/persist.pid +1 -1
- data/server/routing/persist.rb +53 -30
- data/tools/server/cpee +1 -1
- data/tools/server/resources/properties.init +4 -4
- metadata +142 -5
- data/cockpit/CPEE.xml +0 -8
- data/cockpit/Signavio.xml +0 -8
- data/cockpit/transformations.xml +0 -4
- /data/{COPYING → LICENSE} +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
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
|
-
# of the GNU General Public License as published by the Free Software Foundation,
|
|
4
|
+
# of the GNU Lesser 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
|
-
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
9
|
+
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
10
10
|
#
|
|
11
|
-
# You should have received a copy of the GNU General Public License along with
|
|
12
|
-
# CPEE (file
|
|
11
|
+
# You should have received a copy of the GNU Lesser General Public License along with
|
|
12
|
+
# CPEE (file LICENSE in the main directory). If not, see
|
|
13
13
|
# <http://www.gnu.org/licenses/>.
|
|
14
14
|
|
|
15
15
|
require 'json'
|
|
@@ -160,7 +160,7 @@ module CPEE
|
|
|
160
160
|
opts[:redis]
|
|
161
161
|
)
|
|
162
162
|
elsif CPEE::Persistence::extract_item(id,opts,"callbacks/#{callback}/type") == 'vote'
|
|
163
|
-
if @p.length == 1 && @p[0].name == 'continue' && @p[0].class == Riddl::Parameter::
|
|
163
|
+
if @p.length == 1 && (@p[0].name == 'continue' || (@p[0].name == '' && @p[0].class == Riddl::Parameter::Complex))
|
|
164
164
|
CPEE::Message::send(
|
|
165
165
|
:'vote-response',
|
|
166
166
|
callback,
|
|
@@ -168,7 +168,7 @@ module CPEE
|
|
|
168
168
|
id,
|
|
169
169
|
{},
|
|
170
170
|
{},
|
|
171
|
-
@p[0].value,
|
|
171
|
+
@p[0].class == Riddl::Parameter::Simple ? @p[0].value : @p[0].value.read,
|
|
172
172
|
opts[:redis]
|
|
173
173
|
)
|
|
174
174
|
else
|
|
@@ -1,15 +1,15 @@
|
|
|
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
|
-
# of the GNU General Public License as published by the Free Software Foundation,
|
|
4
|
+
# of the GNU Lesser 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
|
-
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
9
|
+
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
10
10
|
#
|
|
11
|
-
# You should have received a copy of the GNU General Public License along with
|
|
12
|
-
# CPEE (file
|
|
11
|
+
# You should have received a copy of the GNU Lesser General Public License along with
|
|
12
|
+
# CPEE (file LICENSE in the main directory). If not, see
|
|
13
13
|
# <http://www.gnu.org/licenses/>.
|
|
14
14
|
|
|
15
15
|
require 'json'
|
|
@@ -201,7 +201,10 @@ module CPEE
|
|
|
201
201
|
if pat == 'forward:*'
|
|
202
202
|
id, key = what.match(/forward:([^\/]+)\/(.+)/).captures
|
|
203
203
|
if sse = opts.dig(:sse_connections,id,key)
|
|
204
|
-
|
|
204
|
+
# message is "seq,sseq {json}"; numbers go into the standard SSE id field (lastEventId), data stays pure json
|
|
205
|
+
# riddl's send_with_id(field,value) writes "field: value\n\n", so id and data are combined into one event
|
|
206
|
+
index = message.index(' ')
|
|
207
|
+
sse.send_with_id 'id', message[0...index] + "\ndata: " + message[index+1..-1]
|
|
205
208
|
else
|
|
206
209
|
DeleteSubscription::set(id,opts,key)
|
|
207
210
|
end
|
|
@@ -1,15 +1,15 @@
|
|
|
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
|
-
# of the GNU General Public License as published by the Free Software Foundation,
|
|
4
|
+
# of the GNU Lesser 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
|
-
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
9
|
+
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
10
10
|
#
|
|
11
|
-
# You should have received a copy of the GNU General Public License along with
|
|
12
|
-
# CPEE (file
|
|
11
|
+
# You should have received a copy of the GNU Lesser General Public License along with
|
|
12
|
+
# CPEE (file LICENSE in the main directory). If not, see
|
|
13
13
|
# <http://www.gnu.org/licenses/>.
|
|
14
14
|
|
|
15
15
|
require_relative 'fail'
|
|
@@ -139,6 +139,8 @@ module CPEE
|
|
|
139
139
|
doc.find('/p:properties/p:transformation/p:description/@type').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/description/@type')
|
|
140
140
|
doc.find('/p:properties/p:transformation/p:dataelements/@type').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/dataelements/@type')
|
|
141
141
|
doc.find('/p:properties/p:transformation/p:endpoints/@type').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/endpoints/@type')
|
|
142
|
+
doc.find('/p:properties/p:transformation/p:dslx').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/dslx') || ''
|
|
143
|
+
doc.find('/p:properties/p:transformation/p:dslx/@type').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/dslx/@type') || 'copy' # instances from before dslx backtransformation
|
|
142
144
|
Riddl::Parameter::Complex.new('properties','application/xml',doc.to_s)
|
|
143
145
|
end
|
|
144
146
|
end #}}}
|
|
@@ -164,14 +166,14 @@ module CPEE
|
|
|
164
166
|
end
|
|
165
167
|
end
|
|
166
168
|
|
|
167
|
-
%w{dataelements documents endpoints
|
|
169
|
+
%w{dataelements documents endpoints attributes}.each do |item|
|
|
168
170
|
if (node = doc.find('/p:properties/p:' + item)).any?
|
|
169
171
|
CPEE::Properties::PatchItems::set item, id, opts, node.first.dump
|
|
170
172
|
end
|
|
171
173
|
end
|
|
172
174
|
|
|
173
175
|
if (node = doc.find('/p:properties/p:transformation')).any?
|
|
174
|
-
CPEE::Properties::PutTransformation::set id, opts, node.first.dump
|
|
176
|
+
CPEE::Properties::PutTransformation::set id, opts, node.first.dump, doc.find('/p:properties/p:description/*').empty?
|
|
175
177
|
end
|
|
176
178
|
if (node = doc.find('/p:properties/p:description/*')).any?
|
|
177
179
|
CPEE::Properties::PutDescription::set id, opts, node.first.dump
|
|
@@ -206,7 +208,7 @@ module CPEE
|
|
|
206
208
|
end
|
|
207
209
|
|
|
208
210
|
if (node = doc.find('/*/p:transformation')).any?
|
|
209
|
-
CPEE::Properties::PutTransformation::set id, opts, node.first.dump
|
|
211
|
+
CPEE::Properties::PutTransformation::set id, opts, node.first.dump, doc.find('/*/p:description/*').empty?
|
|
210
212
|
end
|
|
211
213
|
if (node = doc.find('/*/p:description/*')).any?
|
|
212
214
|
CPEE::Properties::PutDescription::set id, opts, node.first.dump
|
|
@@ -530,6 +532,7 @@ module CPEE
|
|
|
530
532
|
id = @a[2]
|
|
531
533
|
opts = @a[3]
|
|
532
534
|
if val = CPEE::Persistence::extract_item(id,opts,@r.join('/'))
|
|
535
|
+
mime = 'text/plain' if mime == 'text/xml' && (XML::Smart::string(val) rescue nil).nil? # a description can be any model type, e.g. text
|
|
533
536
|
Riddl::Parameter::Complex.new(item,mime,val)
|
|
534
537
|
else
|
|
535
538
|
@status = 404
|
|
@@ -798,6 +801,49 @@ module CPEE
|
|
|
798
801
|
[dslx, dsl, de, ep]
|
|
799
802
|
end #}}}
|
|
800
803
|
|
|
804
|
+
def self::backtransform(xml,dslx,tdslx,tdslxtype) #{{{
|
|
805
|
+
# description from a directly set dslx, nil means keep the current description
|
|
806
|
+
case tdslxtype
|
|
807
|
+
when 'rest'
|
|
808
|
+
return nil if tdslx.nil? || tdslx.empty?
|
|
809
|
+
srv = Riddl::Client.new(tdslx)
|
|
810
|
+
status, res = srv.post [
|
|
811
|
+
Riddl::Parameter::Complex.new("description","text/xml",dslx), # the service distinguishes directions by path, e.g. /bpmn2/cpee/
|
|
812
|
+
Riddl::Parameter::Simple.new("type","description")
|
|
813
|
+
]
|
|
814
|
+
if status >= 200 && status < 300
|
|
815
|
+
res[0].value.read
|
|
816
|
+
else
|
|
817
|
+
raise 'Could not backtransform dslx'
|
|
818
|
+
end
|
|
819
|
+
when 'xslt'
|
|
820
|
+
return nil if tdslx.nil? || tdslx.empty?
|
|
821
|
+
trans = XML::Smart::open_unprotected(tdslx)
|
|
822
|
+
XML::Smart::string(dslx).transform_with(trans).to_s
|
|
823
|
+
when 'none'
|
|
824
|
+
nil
|
|
825
|
+
else # copy, or instances from before dslx backtransformation
|
|
826
|
+
xml
|
|
827
|
+
end
|
|
828
|
+
end #}}}
|
|
829
|
+
|
|
830
|
+
def self::backtransform_async(id,opts,dslx,tdslx,tdslxtype) #{{{
|
|
831
|
+
change_uuid = Digest::SHA1.hexdigest(dslx)
|
|
832
|
+
Thread.new do
|
|
833
|
+
attrs = CPEE::Persistence::extract_list(id,opts,'attributes').to_h
|
|
834
|
+
begin
|
|
835
|
+
description = PutDescription::backtransform(dslx,dslx,tdslx,tdslxtype)
|
|
836
|
+
unless description.nil?
|
|
837
|
+
CPEE::Message::send(:event,'description/sync',File.join(opts[:url],'/'),id,attrs['uuid'],attrs['info'],{ :change_uuid => change_uuid, :description => description },opts[:redis])
|
|
838
|
+
end
|
|
839
|
+
rescue => e # description stays as it is
|
|
840
|
+
puts e.message
|
|
841
|
+
puts e.backtrace
|
|
842
|
+
CPEE::Message::send(:event,'description/error',File.join(opts[:url],'/'),id,attrs['uuid'],attrs['info'],{ :message => 'backtransformation failed: ' + e.message, :change_uuid => change_uuid, :attributes => attrs },opts[:redis])
|
|
843
|
+
end
|
|
844
|
+
end
|
|
845
|
+
end #}}}
|
|
846
|
+
|
|
801
847
|
def self::set(id,opts,xml,exposition=[],copy=false)
|
|
802
848
|
dslx, dsl, de, ep = if copy
|
|
803
849
|
PutDescription::transform(
|
|
@@ -826,19 +872,37 @@ module CPEE
|
|
|
826
872
|
opts
|
|
827
873
|
)
|
|
828
874
|
end
|
|
875
|
+
tdslx = CPEE::Persistence::extract_item(id,opts,'transformation/dslx')
|
|
876
|
+
tdslxtype = CPEE::Persistence::extract_item(id,opts,'transformation/dslx/@type')
|
|
877
|
+
description = if copy && tdslxtype == 'rest'
|
|
878
|
+
nil # slow (e.g. bpmn layout), done after storing, see backtransform_async
|
|
879
|
+
elsif copy
|
|
880
|
+
begin
|
|
881
|
+
PutDescription::backtransform(xml,dslx,tdslx,tdslxtype)
|
|
882
|
+
rescue => e # dslx is stored anyway, description stays as it is
|
|
883
|
+
puts e.message
|
|
884
|
+
puts e.backtrace
|
|
885
|
+
nil
|
|
886
|
+
end
|
|
887
|
+
else
|
|
888
|
+
xml
|
|
889
|
+
end
|
|
890
|
+
description ||= CPEE::Persistence::extract_item(id,opts,'description') || ''
|
|
829
891
|
attrs = CPEE::Persistence::extract_list(id,opts,'attributes').to_h
|
|
830
892
|
dos = CPEE::Persistence::extract_list(id,opts,'documents').to_h
|
|
831
893
|
change_uuid = Digest::SHA1.hexdigest(dslx)
|
|
832
894
|
CPEE::Persistence::set_item(id,opts,'description',
|
|
833
|
-
:description =>
|
|
895
|
+
:description => description,
|
|
834
896
|
:dslx => dslx,
|
|
835
897
|
:change_uuid => change_uuid,
|
|
898
|
+
:change_pending => copy && tdslxtype == 'rest', # description follows with description/sync
|
|
836
899
|
:dsl => dsl,
|
|
837
900
|
:dataelements => CPEE::Persistence::extract_list(id,opts,'dataelements').to_h,
|
|
838
901
|
:documents => dos,
|
|
839
902
|
:endpoints => CPEE::Persistence::extract_list(id,opts,'endpoints').to_h,
|
|
840
903
|
:attributes => attrs
|
|
841
904
|
)
|
|
905
|
+
PutDescription::backtransform_async(id,opts,dslx,tdslx,tdslxtype) if copy && tdslxtype == 'rest'
|
|
842
906
|
PatchItems::set_hash('dataelements',id,opts,de) unless de.empty?
|
|
843
907
|
PatchItems::set_hash('endpoints',id,opts,ep) unless ep.empty?
|
|
844
908
|
exposition.each do |exp|
|
|
@@ -851,6 +915,16 @@ module CPEE
|
|
|
851
915
|
end
|
|
852
916
|
end
|
|
853
917
|
|
|
918
|
+
def self::validate(xml,opts) # dslx against t_dslx.rng, returns the errors
|
|
919
|
+
errors = []
|
|
920
|
+
begin
|
|
921
|
+
XML::Smart::string(xml).validate_against(XML::Smart::open_unprotected(opts[:dslx_rng])) { |e| errors << e.message.strip }
|
|
922
|
+
rescue => e # not even well-formed
|
|
923
|
+
errors << e.message.strip
|
|
924
|
+
end
|
|
925
|
+
errors
|
|
926
|
+
end
|
|
927
|
+
|
|
854
928
|
def response
|
|
855
929
|
id = @a[0]
|
|
856
930
|
opts = @a[1]
|
|
@@ -860,9 +934,17 @@ module CPEE
|
|
|
860
934
|
elsif opts[:statemachine].final? id
|
|
861
935
|
@status = 410
|
|
862
936
|
else
|
|
937
|
+
# force-encoding because johannes managed to sneak in ascii special characters. why the browser is not sanitizing it is beyond me.
|
|
938
|
+
xml = @p[0].value.read.force_encoding('UTF-8')
|
|
939
|
+
errors = copy ? PutDescription::validate(xml,opts) : [] # copy: dslx, a description can be any model type
|
|
940
|
+
if errors.any?
|
|
941
|
+
attrs = CPEE::Persistence::extract_list(id,opts,'attributes').to_h
|
|
942
|
+
CPEE::Message::send(:event,'description/error',File.join(opts[:url],'/'),id,attrs['uuid'],attrs['info'],{ :message => errors.join("\n"), :errors => errors, :attributes => attrs },opts[:redis])
|
|
943
|
+
@status = 422
|
|
944
|
+
return Riddl::Parameter::Complex.new('error','text/plain',errors.join("\n"))
|
|
945
|
+
end
|
|
863
946
|
begin
|
|
864
|
-
|
|
865
|
-
PutDescription::set(id,opts,@p[0].value.read.force_encoding('UTF-8'),@p[1..-1],copy)
|
|
947
|
+
PutDescription::set(id,opts,xml,@p[1..-1],copy)
|
|
866
948
|
rescue => e
|
|
867
949
|
puts e.message
|
|
868
950
|
puts e.backtrace
|
|
@@ -886,20 +968,58 @@ module CPEE
|
|
|
886
968
|
des.find('p:description/@type').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/description/@type')
|
|
887
969
|
des.find('p:dataelements/@type').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/dataelements/@type')
|
|
888
970
|
des.find('p:endpoints/@type').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/endpoints/@type')
|
|
971
|
+
des.find('p:dslx').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/dslx') || ''
|
|
972
|
+
des.find('p:dslx/@type').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/dslx/@type') || 'copy' # instances from before dslx backtransformation
|
|
889
973
|
Riddl::Parameter::Complex.new('status','text/xml',des.to_doc.to_s)
|
|
890
974
|
end
|
|
891
975
|
end #}}}
|
|
892
976
|
class PutTransformation < Riddl::Implementation #{{{
|
|
893
|
-
def self::set(id,opts,xml)
|
|
977
|
+
def self::set(id,opts,xml,backtrans=true)
|
|
894
978
|
doc = XML::Smart::string(xml)
|
|
895
979
|
doc.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
|
|
980
|
+
tdslx = doc.find('string(/p:transformation/p:dslx)')
|
|
981
|
+
tdslxtype = (t = doc.find('string(/p:transformation/p:dslx/@type)')).empty? ? 'copy' : t # optional, missing means copy
|
|
982
|
+
changed = tdslx != (CPEE::Persistence::extract_item(id,opts,'transformation/dslx') || '') ||
|
|
983
|
+
tdslxtype != (CPEE::Persistence::extract_item(id,opts,'transformation/dslx/@type') || 'copy')
|
|
984
|
+
dslx = CPEE::Persistence::extract_item(id,opts,'dslx')
|
|
985
|
+
dslx = nil if dslx&.empty?
|
|
896
986
|
CPEE::Persistence::set_item(id,opts,'transformation',
|
|
897
987
|
:description => doc.find('string(/p:transformation/p:description)'),
|
|
898
988
|
:description_type => doc.find('string(/p:transformation/p:description/@type)'),
|
|
899
989
|
:dataelements =>doc.find('string(/p:transformation/p:dataelements)'),
|
|
900
990
|
:dataelements_type => doc.find('string(/p:transformation/p:dataelements/@type)'),
|
|
901
991
|
:endpoints =>doc.find('string(/p:transformation/p:endpoints)'),
|
|
902
|
-
:endpoints_type => doc.find('string(/p:transformation/p:endpoints/@type)')
|
|
992
|
+
:endpoints_type => doc.find('string(/p:transformation/p:endpoints/@type)'),
|
|
993
|
+
:dslx => tdslx,
|
|
994
|
+
:dslx_type => tdslxtype,
|
|
995
|
+
:change_uuid => dslx ? Digest::SHA1.hexdigest(dslx) : nil,
|
|
996
|
+
:change_pending => backtrans && changed && tdslxtype == 'rest' && !dslx.nil? # description follows with description/sync
|
|
997
|
+
)
|
|
998
|
+
PutTransformation::backtransform(id,opts,tdslx,tdslxtype) if backtrans && changed
|
|
999
|
+
end
|
|
1000
|
+
def self::backtransform(id,opts,tdslx,tdslxtype)
|
|
1001
|
+
# the description has to follow the new transformation. the new values are passed
|
|
1002
|
+
# directly, as redis is only updated asynchronously by persist.rb
|
|
1003
|
+
dslx = CPEE::Persistence::extract_item(id,opts,'dslx')
|
|
1004
|
+
return if dslx.nil? || dslx.empty?
|
|
1005
|
+
return PutDescription::backtransform_async(id,opts,dslx,tdslx,tdslxtype) if tdslxtype == 'rest'
|
|
1006
|
+
description = begin
|
|
1007
|
+
PutDescription::backtransform(dslx,dslx,tdslx,tdslxtype)
|
|
1008
|
+
rescue => e # description stays as it is
|
|
1009
|
+
puts e.message
|
|
1010
|
+
puts e.backtrace
|
|
1011
|
+
nil
|
|
1012
|
+
end
|
|
1013
|
+
return if description.nil?
|
|
1014
|
+
CPEE::Persistence::set_item(id,opts,'description',
|
|
1015
|
+
:description => description,
|
|
1016
|
+
:dslx => dslx,
|
|
1017
|
+
:change_uuid => Digest::SHA1.hexdigest(dslx),
|
|
1018
|
+
:dsl => CPEE::Persistence::extract_item(id,opts,'dsl'),
|
|
1019
|
+
:dataelements => CPEE::Persistence::extract_list(id,opts,'dataelements').to_h,
|
|
1020
|
+
:documents => CPEE::Persistence::extract_list(id,opts,'documents').to_h,
|
|
1021
|
+
:endpoints => CPEE::Persistence::extract_list(id,opts,'endpoints').to_h,
|
|
1022
|
+
:attributes => CPEE::Persistence::extract_list(id,opts,'attributes').to_h
|
|
903
1023
|
)
|
|
904
1024
|
end
|
|
905
1025
|
def response
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# This file is part of CPEE.
|
|
2
|
+
#
|
|
3
|
+
# CPEE is free software: you can redistribute it and/or modify it under the terms
|
|
4
|
+
# of the GNU Lesser General Public License as published by the Free Software Foundation,
|
|
5
|
+
# either version 3 of the License, or (at your option) any later version.
|
|
6
|
+
#
|
|
7
|
+
# CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
8
|
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
9
|
+
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
10
|
+
#
|
|
11
|
+
# You should have received a copy of the GNU Lesser General Public License along with
|
|
12
|
+
# CPEE (file LICENSE in the main directory). If not, see
|
|
13
|
+
# <http://www.gnu.org/licenses/>.
|
|
14
|
+
|
|
15
|
+
require 'ostruct'
|
|
16
|
+
|
|
17
|
+
module CPEE
|
|
18
|
+
|
|
19
|
+
module JSONPointer
|
|
20
|
+
|
|
21
|
+
def self::parse(pointer) #{{{
|
|
22
|
+
raise ArgumentError, "invalid JSON pointer #{pointer.inspect}" unless pointer.is_a?(String) && pointer.start_with?('/')
|
|
23
|
+
pointer[1..-1].split('/',-1).map { |s| s.gsub('~1','/').gsub('~0','~') }
|
|
24
|
+
end #}}}
|
|
25
|
+
|
|
26
|
+
def self::symbolize(value) #{{{
|
|
27
|
+
case value
|
|
28
|
+
when Hash; value.each_with_object({}) { |(k,v),h| h[k.to_sym] = symbolize(v) }
|
|
29
|
+
when Array; value.map { |v| symbolize(v) }
|
|
30
|
+
else value
|
|
31
|
+
end
|
|
32
|
+
end #}}}
|
|
33
|
+
|
|
34
|
+
def self::container?(node) #{{{
|
|
35
|
+
node.is_a?(Hash) || node.is_a?(Array) || node.is_a?(OpenStruct)
|
|
36
|
+
end #}}}
|
|
37
|
+
|
|
38
|
+
def self::array_index(node, seg) #{{{
|
|
39
|
+
return node.length if seg == '-'
|
|
40
|
+
raise ArgumentError, "invalid array index #{seg.inspect}" unless seg =~ /\A(0|[1-9]\d*)\z/
|
|
41
|
+
i = seg.to_i
|
|
42
|
+
raise ArgumentError, "array index #{i} out of range" if i > node.length
|
|
43
|
+
i
|
|
44
|
+
end #}}}
|
|
45
|
+
|
|
46
|
+
def self::get(node, seg) #{{{
|
|
47
|
+
case node
|
|
48
|
+
when Hash
|
|
49
|
+
node.key?(seg.to_sym) ? node[seg.to_sym] : node[seg]
|
|
50
|
+
when Array
|
|
51
|
+
node[array_index(node, seg)]
|
|
52
|
+
when OpenStruct
|
|
53
|
+
node[seg.to_sym]
|
|
54
|
+
end
|
|
55
|
+
end #}}}
|
|
56
|
+
|
|
57
|
+
def self::put(node, seg, value) #{{{
|
|
58
|
+
case node
|
|
59
|
+
when Hash
|
|
60
|
+
node[node.key?(seg) && !node.key?(seg.to_sym) ? seg : seg.to_sym] = value
|
|
61
|
+
when Array
|
|
62
|
+
node[array_index(node, seg)] = value
|
|
63
|
+
when OpenStruct
|
|
64
|
+
node[seg.to_sym] = value
|
|
65
|
+
end
|
|
66
|
+
end #}}}
|
|
67
|
+
|
|
68
|
+
def self::argument(value) #{{{
|
|
69
|
+
return value unless value.is_a?(Hash)
|
|
70
|
+
(defined?(::ParaStruct) ? ::ParaStruct : OpenStruct).new(:name => value[:name].to_s.to_sym, :value => value[:value])
|
|
71
|
+
end #}}}
|
|
72
|
+
|
|
73
|
+
# /arguments/<name>/... -> /arguments/<index>/value/... (argument is created if missing)
|
|
74
|
+
def self::argument_by_name(root, segs) #{{{
|
|
75
|
+
return segs unless segs.length >= 2 && segs[0] == 'arguments' && segs[1] !~ /\A(\d+|-)\z/
|
|
76
|
+
args = (get(root, 'arguments') || []).dup
|
|
77
|
+
put(root, 'arguments', args)
|
|
78
|
+
idx = args.index { |a| a.respond_to?(:name) && a.name.to_s == segs[1] }
|
|
79
|
+
if idx.nil?
|
|
80
|
+
args << argument(:name => segs[1], :value => nil)
|
|
81
|
+
idx = args.length - 1
|
|
82
|
+
end
|
|
83
|
+
['arguments', idx.to_s, 'value'] + segs[2..-1]
|
|
84
|
+
end #}}}
|
|
85
|
+
|
|
86
|
+
# containers on the path are copied before writing, only root is modified in place
|
|
87
|
+
def self::set(root, pointer, value) #{{{
|
|
88
|
+
raise ArgumentError, 'root is not a Hash' unless root.is_a?(Hash)
|
|
89
|
+
segs = argument_by_name(root, parse(pointer))
|
|
90
|
+
value = symbolize(value)
|
|
91
|
+
value = value.to_s.sub(/^:/,'').to_sym if segs == ['method'] && !value.nil?
|
|
92
|
+
value = argument(value) if segs.length == 2 && segs[0] == 'arguments'
|
|
93
|
+
value = value.map { |a| argument(a) } if segs == ['arguments'] && value.is_a?(Array)
|
|
94
|
+
|
|
95
|
+
node = root
|
|
96
|
+
segs[0..-2].each do |seg|
|
|
97
|
+
child = get(node, seg)
|
|
98
|
+
child = {} if child.nil?
|
|
99
|
+
raise ArgumentError, "#{pointer}: #{seg.inspect} is not a container" unless container?(child)
|
|
100
|
+
child = child.dup
|
|
101
|
+
put(node, seg, child)
|
|
102
|
+
node = child
|
|
103
|
+
end
|
|
104
|
+
put(node, segs.last, value)
|
|
105
|
+
root
|
|
106
|
+
end #}}}
|
|
107
|
+
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
end
|
data/lib/cpee/message.rb
CHANGED
|
@@ -1,20 +1,38 @@
|
|
|
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
|
-
# of the GNU General Public License as published by the Free Software Foundation,
|
|
4
|
+
# of the GNU Lesser 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
|
-
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
9
|
+
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
10
10
|
#
|
|
11
|
-
# You should have received a copy of the GNU General Public License along with
|
|
12
|
-
# CPEE (file
|
|
11
|
+
# You should have received a copy of the GNU Lesser General Public License along with
|
|
12
|
+
# CPEE (file LICENSE in the main directory). If not, see
|
|
13
13
|
# <http://www.gnu.org/licenses/>.
|
|
14
14
|
|
|
15
|
+
require 'digest/sha1'
|
|
16
|
+
require_relative 'redis'
|
|
17
|
+
|
|
15
18
|
module CPEE
|
|
16
19
|
|
|
17
20
|
module Message
|
|
21
|
+
# INCR the per-instance sequence and PUBLISH in one round trip. The seq is
|
|
22
|
+
# appended to the prefix ("instance,uuid,seq {json}") so that routing
|
|
23
|
+
# workers can read it without parsing the JSON, and added to the JSON for
|
|
24
|
+
# consumers that only see the body. The payload is always a JSON object.
|
|
25
|
+
# Only count while the instance exists (KEYS[2] is its state), so late
|
|
26
|
+
# messages for a deleted instance do not recreate the counter (seq 0).
|
|
27
|
+
# INCR keeps the TTL that DeleteInstance set while the key expires.
|
|
28
|
+
SEQ_PUBLISH = <<~LUA.freeze
|
|
29
|
+
local s = 0
|
|
30
|
+
if redis.call('EXISTS', KEYS[2]) == 1 then s = redis.call('INCR', KEYS[1]) end
|
|
31
|
+
redis.call('PUBLISH', ARGV[1], ARGV[2] .. ',' .. s .. ' ' .. string.sub(ARGV[3], 1, -2) .. ',"seq":' .. s .. '}')
|
|
32
|
+
return s
|
|
33
|
+
LUA
|
|
34
|
+
SEQ_PUBLISH_SHA = Digest::SHA1.hexdigest(SEQ_PUBLISH).freeze
|
|
35
|
+
|
|
18
36
|
@@mutex = Mutex.new
|
|
19
37
|
@@who = 'cpee'
|
|
20
38
|
@@type = 'instance'
|
|
@@ -35,7 +53,7 @@ module CPEE
|
|
|
35
53
|
end #}}}
|
|
36
54
|
|
|
37
55
|
def self::set_workers(workers)
|
|
38
|
-
@@tworkers = (workers < 1
|
|
56
|
+
@@tworkers = (workers < 1 || workers > 99 ? 1 : workers).freeze
|
|
39
57
|
@@last = -1
|
|
40
58
|
end
|
|
41
59
|
|
|
@@ -77,7 +95,9 @@ module CPEE
|
|
|
77
95
|
payload["#{@@type}-uuid"] = instance_uuid if instance_uuid
|
|
78
96
|
payload["#{@@type}-name"] = instance_name if instance_name
|
|
79
97
|
|
|
80
|
-
|
|
98
|
+
keys = ["#{@@type}:#{instance}/seq", "#{@@type}:#{instance}/state"]
|
|
99
|
+
argv = ["#{type}:#{target}:#{event}", "#{instance},#{instance_uuid}", JSON::generate(payload)]
|
|
100
|
+
CPEE::redis_script(backend, SEQ_PUBLISH_SHA, SEQ_PUBLISH, keys, argv)
|
|
81
101
|
end
|
|
82
102
|
|
|
83
103
|
def self::send_url(type, event, cpee, content={}, backend)
|
data/lib/cpee/persistence.rb
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
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
|
-
# of the GNU General Public License as published by the Free Software Foundation,
|
|
4
|
+
# of the GNU Lesser 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
|
-
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
9
|
+
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
10
10
|
#
|
|
11
|
-
# You should have received a copy of the GNU General Public License along with
|
|
12
|
-
# CPEE (file
|
|
11
|
+
# You should have received a copy of the GNU Lesser General Public License along with
|
|
12
|
+
# CPEE (file LICENSE in the main directory). If not, see
|
|
13
13
|
# <http://www.gnu.org/licenses/>.
|
|
14
14
|
|
|
15
15
|
require 'msgpack'
|
|
@@ -183,6 +183,7 @@ module CPEE
|
|
|
183
183
|
res += Persistence::keys_extract_name(opts,id,'handlers')
|
|
184
184
|
hnd.each do |h|
|
|
185
185
|
res << File.join(h,'url')
|
|
186
|
+
res << File.join(h,'seq')
|
|
186
187
|
res += Persistence::keys_extract_set_raw(opts,h)
|
|
187
188
|
end
|
|
188
189
|
cbs = Persistence::keys_extract_set(opts,id,'callbacks')
|
|
@@ -197,18 +198,23 @@ module CPEE
|
|
|
197
198
|
end
|
|
198
199
|
res += Persistence::keys_extract_name(opts,id,'dsl')
|
|
199
200
|
res += Persistence::keys_extract_name(opts,id,'dslx')
|
|
201
|
+
res += Persistence::keys_extract_name(opts,id,'dslx','@change_uuid')
|
|
200
202
|
res += Persistence::keys_extract_name(opts,id,'status','message')
|
|
201
203
|
res += Persistence::keys_extract_name(opts,id,'status','id')
|
|
202
204
|
res += Persistence::keys_extract_name(opts,id,'executionhandler')
|
|
203
205
|
res += Persistence::keys_extract_name(opts,id,'description')
|
|
206
|
+
res += Persistence::keys_extract_name(opts,id,'description','@change_uuid')
|
|
204
207
|
res += Persistence::keys_extract_name(opts,id,'state')
|
|
205
208
|
res += Persistence::keys_extract_name(opts,id,'state','@changed')
|
|
209
|
+
res += Persistence::keys_extract_name(opts,id,'seq')
|
|
206
210
|
res += Persistence::keys_extract_name(opts,id,'transformation','endpoints')
|
|
207
211
|
res += Persistence::keys_extract_name(opts,id,'transformation','endpoints','@type')
|
|
208
212
|
res += Persistence::keys_extract_name(opts,id,'transformation','description')
|
|
209
213
|
res += Persistence::keys_extract_name(opts,id,'transformation','description','@type')
|
|
210
214
|
res += Persistence::keys_extract_name(opts,id,'transformation','dataelements')
|
|
211
215
|
res += Persistence::keys_extract_name(opts,id,'transformation','dataelements','@type')
|
|
216
|
+
res += Persistence::keys_extract_name(opts,id,'transformation','dslx')
|
|
217
|
+
res += Persistence::keys_extract_name(opts,id,'transformation','dslx','@type')
|
|
212
218
|
res
|
|
213
219
|
end
|
|
214
220
|
|
data/lib/cpee/redis.rb
CHANGED
|
@@ -1,21 +1,29 @@
|
|
|
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
|
-
# of the GNU General Public License as published by the Free Software Foundation,
|
|
4
|
+
# of the GNU Lesser 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
|
-
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
9
|
+
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
10
10
|
#
|
|
11
|
-
# You should have received a copy of the GNU General Public License along with
|
|
12
|
-
# CPEE (file
|
|
11
|
+
# You should have received a copy of the GNU Lesser General Public License along with
|
|
12
|
+
# CPEE (file LICENSE in the main directory). If not, see
|
|
13
13
|
# <http://www.gnu.org/licenses/>.
|
|
14
14
|
|
|
15
15
|
require 'redis'
|
|
16
16
|
require 'uri'
|
|
17
17
|
|
|
18
18
|
module CPEE
|
|
19
|
+
# run a lua script by its sha (cached in redis), send the full script only if redis does not know it (yet)
|
|
20
|
+
def self::redis_script(backend,sha,script,keys,argv)
|
|
21
|
+
backend.evalsha(sha, keys: keys, argv: argv)
|
|
22
|
+
rescue Redis::CommandError => e
|
|
23
|
+
raise unless e.message.start_with?('NOSCRIPT')
|
|
24
|
+
backend.eval(script, keys: keys, argv: argv)
|
|
25
|
+
end
|
|
26
|
+
|
|
19
27
|
def self::redis_connect(opts,name=nil)
|
|
20
28
|
if opts[:redis_cmd].nil?
|
|
21
29
|
begin
|
data/lib/cpee/statemachine.rb
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
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
|
-
# of the GNU General Public License as published by the Free Software Foundation,
|
|
4
|
+
# of the GNU Lesser 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
|
-
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
9
|
+
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
10
10
|
#
|
|
11
|
-
# You should have received a copy of the GNU General Public License along with
|
|
12
|
-
# CPEE (file
|
|
11
|
+
# You should have received a copy of the GNU Lesser General Public License along with
|
|
12
|
+
# CPEE (file LICENSE in the main directory). If not, see
|
|
13
13
|
# <http://www.gnu.org/licenses/>.
|
|
14
14
|
|
|
15
15
|
module CPEE
|
data/lib/cpee/value_helper.rb
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
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
|
-
# of the GNU General Public License as published by the Free Software Foundation,
|
|
4
|
+
# of the GNU Lesser 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
|
-
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
9
|
+
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
10
10
|
#
|
|
11
|
-
# You should have received a copy of the GNU General Public License along with
|
|
12
|
-
# CPEE (file
|
|
11
|
+
# You should have received a copy of the GNU Lesser General Public License along with
|
|
12
|
+
# CPEE (file LICENSE in the main directory). If not, see
|
|
13
13
|
# <http://www.gnu.org/licenses/>.
|
|
14
14
|
|
|
15
15
|
require 'json'
|
data/lib/cpee.xml
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
This file is part of CPEE.
|
|
3
3
|
|
|
4
4
|
CPEE is free software: you can redistribute it and/or modify it under the terms
|
|
5
|
-
of the GNU General Public License as published by the Free Software Foundation,
|
|
5
|
+
of the GNU Lesser General Public License as published by the Free Software Foundation,
|
|
6
6
|
either version 3 of the License, or (at your option) any later version.
|
|
7
7
|
|
|
8
8
|
CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
9
9
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
10
|
-
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
10
|
+
PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
11
11
|
|
|
12
|
-
You should have received a copy of the GNU General Public License along with
|
|
13
|
-
CPEE (file
|
|
12
|
+
You should have received a copy of the GNU Lesser General Public License along with
|
|
13
|
+
CPEE (file LICENSE in the main directory). If not, see
|
|
14
14
|
<http://www.gnu.org/licenses/>.
|
|
15
15
|
-->
|
|
16
16
|
|