cpee 1.5.20 → 2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{FEATURES → FEATURES.md} +7 -6
- data/INSTALL.md +1 -0
- data/{README → README.md} +3 -3
- data/Rakefile +1 -0
- data/cockpit/index.html +8 -8
- data/cockpit/js/details.js +13 -14
- data/cockpit/js/instance.js +192 -290
- data/cockpit/js/parameters.js +13 -3
- data/cockpit/js/ui.js +2 -2
- data/cockpit/rngs/attributes.rng +3 -3
- data/cockpit/rngs/dataelements.rng +3 -3
- data/cockpit/rngs/endpoints.rng +3 -3
- data/cockpit/{testsets → templates.legacy}/Async.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/BCO.xml +7 -10
- data/cockpit/{testsets → templates.legacy}/BCS.xml +7 -10
- data/cockpit/{testsets → templates.legacy}/Centurio.xml +6 -6
- data/cockpit/{testsets → templates.legacy}/Concurrent.xml +6 -6
- data/cockpit/{testsets → templates.legacy}/Coopis Testset.xml +6 -6
- data/cockpit/{testsets → templates.legacy}/Endpoints and Data Manipulation.xml +6 -6
- data/cockpit/{testsets → templates.legacy}/ICSOC Testset.xml +6 -6
- data/cockpit/{testsets → templates.legacy}/Infinity.xml +3 -3
- data/cockpit/{testsets → templates.legacy}/Lego Boxer.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Lego Conveyor.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Lego Crane.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Lego Ejector.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Lego Full.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Lego Liddy.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Lego Plate.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Lego Transporter.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Lego_Part_1.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/LgLinear.xml +6 -10
- data/cockpit/{testsets → templates.legacy}/Linear.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Log.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Mangler 1.xml +6 -6
- data/cockpit/{testsets → templates.legacy}/Mangler 2.xml +6 -6
- data/cockpit/{testsets → templates.legacy}/Manuel Labels.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Promise.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/SOPROMO Test Sonification.xml +6 -6
- data/cockpit/{testsets → templates.legacy}/Subprocess.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Syncing P34 1.xml +8 -11
- data/cockpit/{testsets → templates.legacy}/Syncing P34 2.xml +8 -11
- data/cockpit/{testsets → templates.legacy}/Syncing P34 3.xml +8 -11
- data/cockpit/{testsets → templates.legacy}/Syncing P34.xml +8 -11
- data/cockpit/{testsets → templates.legacy}/TEST - Bad Loop.xml +6 -6
- data/cockpit/{testsets → templates.legacy}/TEST - Wrong Positions.xml +6 -6
- data/cockpit/{testsets → templates.legacy}/Take_5.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Update.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Worklist Parallel.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Worklist Test CPEE.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Worklist Test.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Worklist Test2.xml +7 -7
- data/cockpit/templates.legacy/convert_cpee2.rb +15 -0
- data/cockpit/{testsets → templates.legacy}/convert_preset.rb +0 -0
- data/cockpit/{testsets → templates.legacy}/testsets.xml +1 -1
- data/cockpit/{testsets → templates.legacy}/transformations.xml +0 -0
- data/cockpit/templates/BPM 2020 Manual Adjust.xml +182 -0
- data/cockpit/templates/BPM 2020 Solution Baseline.xml +196 -0
- data/cockpit/templates/BPM 2020 Solution NN.xml +197 -0
- data/cockpit/templates/BPM 2020 Solution View.xml +144 -0
- data/cockpit/templates/BPM 2020.xml +26 -0
- data/cockpit/templates/Coopis 2010.xml +85 -0
- data/cockpit/templates/IUPC arXiv:1104.3609 P34 1.xml +77 -0
- data/cockpit/templates/IUPC arXiv:1104.3609 P34 2.xml +77 -0
- data/cockpit/templates/IUPC arXiv:1104.3609 P34 3.xml +77 -0
- data/cockpit/templates/Worklist.xml +42 -0
- data/cockpit/templates/convert_cpee2.rb +15 -0
- data/cockpit/themes/compact/rngs/alternative.rng +25 -0
- data/cockpit/themes/compact/rngs/call.rng +20 -14
- data/cockpit/themes/compact/rngs/callmanipulate.rng +28 -22
- data/cockpit/themes/compact/rngs/choose.rng +14 -0
- data/cockpit/themes/compact/rngs/critical.rng +5 -0
- data/cockpit/themes/compact/rngs/escape.rng +1 -0
- data/cockpit/themes/compact/rngs/group.rng +3 -0
- data/cockpit/themes/compact/rngs/loop.rng +22 -0
- data/cockpit/themes/compact/rngs/manipulate.rng +9 -0
- data/cockpit/themes/compact/rngs/otherwise.rng +22 -0
- data/cockpit/themes/compact/rngs/parallel.rng +21 -0
- data/cockpit/themes/compact/rngs/parallel_branch.rng +8 -0
- data/cockpit/themes/compact/rngs/scripts.rng +10 -11
- data/cockpit/themes/compact/rngs/stop.rng +5 -0
- data/cockpit/themes/compact/rngs/terminate.rng +1 -0
- data/cockpit/themes/compact/theme.js +1 -1
- data/cockpit/themes/convert_cpee2.rb +8 -0
- data/cockpit/themes/default/rngs/alternative.rng +8 -8
- data/cockpit/themes/default/rngs/call.rng +85 -49
- data/cockpit/themes/default/rngs/callmanipulate.rng +103 -64
- data/cockpit/themes/default/rngs/choose.rng +5 -3
- data/cockpit/themes/default/rngs/critical.rng +2 -2
- data/cockpit/themes/default/rngs/escape.rng +1 -1
- data/cockpit/themes/default/rngs/group.rng +3 -3
- data/cockpit/themes/default/rngs/loop.rng +8 -8
- data/cockpit/themes/default/rngs/manipulate.rng +3 -3
- data/cockpit/themes/default/rngs/otherwise.rng +8 -8
- data/cockpit/themes/default/rngs/parallel.rng +14 -6
- data/cockpit/themes/default/rngs/parallel_branch.rng +2 -2
- data/cockpit/themes/default/rngs/scripts.rng +23 -0
- data/cockpit/themes/default/rngs/stop.rng +2 -2
- data/cockpit/themes/default/rngs/terminate.rng +1 -1
- data/cockpit/themes/extended/rngs/alternative.rng +25 -0
- data/cockpit/themes/extended/rngs/call.rng +20 -14
- data/cockpit/themes/extended/rngs/callmanipulate.rng +28 -22
- data/cockpit/themes/extended/rngs/choose.rng +14 -0
- data/cockpit/themes/extended/rngs/critical.rng +5 -0
- data/cockpit/themes/extended/rngs/escape.rng +1 -0
- data/cockpit/themes/extended/rngs/group.rng +3 -0
- data/cockpit/themes/extended/rngs/loop.rng +22 -0
- data/cockpit/themes/extended/rngs/manipulate.rng +9 -0
- data/cockpit/themes/extended/rngs/otherwise.rng +22 -0
- data/cockpit/themes/extended/rngs/parallel.rng +21 -0
- data/cockpit/themes/extended/rngs/parallel_branch.rng +8 -0
- data/cockpit/themes/extended/rngs/scripts.rng +10 -11
- data/cockpit/themes/extended/rngs/stop.rng +5 -0
- data/cockpit/themes/extended/rngs/terminate.rng +1 -0
- data/cockpit/themes/extended/theme.js +14 -28
- data/cockpit/themes/model/rngs/alternative.rng +1 -1
- data/cockpit/themes/model/rngs/call.rng +16 -16
- data/cockpit/themes/model/rngs/callmanipulate.rng +17 -17
- data/cockpit/themes/model/rngs/choose.rng +1 -1
- data/cockpit/themes/model/rngs/critical.rng +1 -1
- data/cockpit/themes/model/rngs/escape.rng +1 -1
- data/cockpit/themes/model/rngs/group.rng +1 -1
- data/cockpit/themes/model/rngs/loop.rng +1 -1
- data/cockpit/themes/model/rngs/manipulate.rng +1 -1
- data/cockpit/themes/model/rngs/otherwise.rng +1 -1
- data/cockpit/themes/model/rngs/parallel.rng +1 -1
- data/cockpit/themes/model/rngs/parallel_branch.rng +1 -1
- data/cockpit/themes/model/rngs/scripts.rng +3 -4
- data/cockpit/themes/model/rngs/stop.rng +1 -1
- data/cockpit/themes/model/rngs/terminate.rng +1 -1
- data/cockpit/themes/model/theme.js +8 -7
- data/cockpit/themes/packed/rngs/alternative.rng +25 -0
- data/cockpit/themes/packed/rngs/call.rng +20 -14
- data/cockpit/themes/packed/rngs/callmanipulate.rng +28 -22
- data/cockpit/themes/packed/rngs/choose.rng +14 -0
- data/cockpit/themes/packed/rngs/critical.rng +5 -0
- data/cockpit/themes/packed/rngs/escape.rng +1 -0
- data/cockpit/themes/packed/rngs/group.rng +3 -0
- data/cockpit/themes/packed/rngs/loop.rng +22 -0
- data/cockpit/themes/packed/rngs/manipulate.rng +9 -0
- data/cockpit/themes/packed/rngs/otherwise.rng +22 -0
- data/cockpit/themes/packed/rngs/parallel.rng +21 -0
- data/cockpit/themes/packed/rngs/parallel_branch.rng +8 -0
- data/cockpit/themes/packed/rngs/scripts.rng +10 -11
- data/cockpit/themes/packed/rngs/stop.rng +5 -0
- data/cockpit/themes/packed/rngs/terminate.rng +1 -0
- data/cockpit/themes/packed/theme.js +8 -7
- data/cockpit/themes/preset/rngs/alternative.rng +25 -0
- data/cockpit/themes/preset/rngs/call.rng +20 -14
- data/cockpit/themes/preset/rngs/callmanipulate.rng +28 -22
- data/cockpit/themes/preset/rngs/choose.rng +14 -0
- data/cockpit/themes/preset/rngs/critical.rng +5 -0
- data/cockpit/themes/preset/rngs/escape.rng +1 -0
- data/cockpit/themes/preset/rngs/group.rng +3 -0
- data/cockpit/themes/preset/rngs/loop.rng +22 -0
- data/cockpit/themes/preset/rngs/manipulate.rng +9 -0
- data/cockpit/themes/preset/rngs/otherwise.rng +22 -0
- data/cockpit/themes/preset/rngs/parallel.rng +21 -0
- data/cockpit/themes/preset/rngs/parallel_branch.rng +8 -0
- data/cockpit/themes/preset/rngs/scripts.rng +10 -11
- data/cockpit/themes/preset/rngs/stop.rng +5 -0
- data/cockpit/themes/preset/rngs/terminate.rng +1 -0
- data/cockpit/themes/preset/theme.js +8 -7
- data/cpee.gemspec +9 -9
- data/{log/topics.xml → lib/callbacks.xml} +16 -6
- data/lib/{engine → callbacks}/callbacks.rng +2 -8
- data/lib/cpee.xml +10 -4
- data/lib/cpee/attributes_helper.rb +27 -0
- data/lib/cpee/controller.rb +113 -596
- data/lib/cpee/implementation.rb +152 -191
- data/lib/cpee/implementation_callbacks.rb +77 -0
- data/lib/cpee/implementation_notifications.rb +189 -0
- data/lib/cpee/implementation_properties.rb +707 -0
- data/lib/cpee/{callback.rb → message.rb} +20 -18
- data/lib/cpee/persistence.rb +135 -0
- data/lib/cpee/statemachine.rb +20 -0
- data/lib/cpee/transform.rb +95 -0
- data/lib/engine.xml +1 -59
- data/lib/properties.xml +236 -0
- data/lib/properties/arbitrary.rng +26 -0
- data/lib/properties/attributes.rng +10 -0
- data/lib/properties/dataelements.rng +10 -0
- data/lib/properties/description.rng +8 -0
- data/lib/properties/dsl.rng +7 -0
- data/lib/properties/dslx.rng +8 -0
- data/lib/properties/endpoints.rng +10 -0
- data/lib/properties/handlerwrapper.rng +9 -0
- data/lib/properties/position.rng +15 -0
- data/lib/properties/positions.rng +10 -0
- data/lib/properties/properties.rng +29 -0
- data/lib/properties/set-properties.rng +25 -0
- data/lib/properties/set-some-properties.rng +45 -0
- data/lib/properties/simple.rng +8 -0
- data/lib/properties/state.rng +33 -0
- data/lib/properties/status.rng +12 -0
- data/lib/properties/t_attributes.rng +7 -0
- data/lib/properties/t_dataelements.rng +7 -0
- data/lib/properties/t_endpoints.rng +7 -0
- data/lib/properties/t_position.rng +7 -0
- data/lib/properties/t_positions.rng +7 -0
- data/lib/properties/t_simple.rng +7 -0
- data/lib/properties/t_status.rng +7 -0
- data/lib/properties/t_transformation.rng +7 -0
- data/lib/properties/transformation.rng +40 -0
- data/server/dev.rb +1 -0
- data/server/handlerwrappers/default.rb +40 -34
- data/server/resources/backend/README.md +17 -0
- data/server/resources/backend/instance.rb +23 -0
- data/server/resources/backend/instance.template +19 -0
- data/server/resources/backend/opts.yaml +6 -0
- data/server/resources/backend/run +29 -0
- data/server/resources/notifications/logging/subscription.xml +1 -1
- data/server/resources/properties.empty +38 -0
- data/server/resources/properties.init +11 -11
- data/server/resources/states.dot +19 -0
- data/server/resources/states.xml +49 -0
- data/server/resources/transformation_dslx.xsl +3 -0
- data/server/routing/end.rb +44 -0
- data/server/routing/forward-events.rb +59 -0
- data/server/routing/forward-votes.rb +108 -0
- data/server/routing/persist.rb +155 -0
- data/server/server.rb +1 -0
- data/tools/cpee +19 -15
- metadata +126 -156
- data/INSTALL +0 -23
- data/cockpit/test.html +0 -40
- data/cockpit/themes/compact/rngs/alternative.rng +0 -1
- data/cockpit/themes/compact/rngs/choose.rng +0 -1
- data/cockpit/themes/compact/rngs/critical.rng +0 -1
- data/cockpit/themes/compact/rngs/escape.rng +0 -1
- data/cockpit/themes/compact/rngs/group.rng +0 -1
- data/cockpit/themes/compact/rngs/loop.rng +0 -1
- data/cockpit/themes/compact/rngs/manipulate.rng +0 -1
- data/cockpit/themes/compact/rngs/otherwise.rng +0 -1
- data/cockpit/themes/compact/rngs/parallel.rng +0 -1
- data/cockpit/themes/compact/rngs/parallel_branch.rng +0 -1
- data/cockpit/themes/compact/rngs/stop.rng +0 -1
- data/cockpit/themes/compact/rngs/terminate.rng +0 -1
- data/cockpit/themes/default/rngs/finalize.rng +0 -6
- data/cockpit/themes/default/rngs/update.rng +0 -6
- data/cockpit/themes/default/theme.js +0 -1286
- data/cockpit/themes/extended/rngs/alternative.rng +0 -1
- data/cockpit/themes/extended/rngs/choose.rng +0 -1
- data/cockpit/themes/extended/rngs/critical.rng +0 -1
- data/cockpit/themes/extended/rngs/escape.rng +0 -1
- data/cockpit/themes/extended/rngs/group.rng +0 -1
- data/cockpit/themes/extended/rngs/loop.rng +0 -1
- data/cockpit/themes/extended/rngs/manipulate.rng +0 -1
- data/cockpit/themes/extended/rngs/otherwise.rng +0 -1
- data/cockpit/themes/extended/rngs/parallel.rng +0 -1
- data/cockpit/themes/extended/rngs/parallel_branch.rng +0 -1
- data/cockpit/themes/extended/rngs/stop.rng +0 -1
- data/cockpit/themes/extended/rngs/terminate.rng +0 -1
- data/cockpit/themes/labels/rngs/alternative.rng +0 -25
- data/cockpit/themes/labels/rngs/call.rng +0 -81
- data/cockpit/themes/labels/rngs/callmanipulate.rng +0 -101
- data/cockpit/themes/labels/rngs/choose.rng +0 -12
- data/cockpit/themes/labels/rngs/critical.rng +0 -5
- data/cockpit/themes/labels/rngs/escape.rng +0 -1
- data/cockpit/themes/labels/rngs/finalize.rng +0 -6
- data/cockpit/themes/labels/rngs/group.rng +0 -3
- data/cockpit/themes/labels/rngs/loop.rng +0 -22
- data/cockpit/themes/labels/rngs/manipulate.rng +0 -9
- data/cockpit/themes/labels/rngs/otherwise.rng +0 -22
- data/cockpit/themes/labels/rngs/parallel.rng +0 -13
- data/cockpit/themes/labels/rngs/parallel_branch.rng +0 -8
- data/cockpit/themes/labels/rngs/stop.rng +0 -5
- data/cockpit/themes/labels/rngs/terminate.rng +0 -1
- data/cockpit/themes/labels/rngs/update.rng +0 -6
- data/cockpit/themes/labels/symbols/alternative.svg +0 -5
- data/cockpit/themes/labels/symbols/arrow.svg +0 -3
- data/cockpit/themes/labels/symbols/call.svg +0 -6
- data/cockpit/themes/labels/symbols/callmanipulate.svg +0 -8
- data/cockpit/themes/labels/symbols/choose.svg +0 -5
- data/cockpit/themes/labels/symbols/choose_exclusive.svg +0 -5
- data/cockpit/themes/labels/symbols/choose_inclusive.svg +0 -4
- data/cockpit/themes/labels/symbols/complex.svg +0 -8
- data/cockpit/themes/labels/symbols/critical.svg +0 -4
- data/cockpit/themes/labels/symbols/end.svg +0 -3
- data/cockpit/themes/labels/symbols/escape.svg +0 -5
- data/cockpit/themes/labels/symbols/event_end.svg +0 -3
- data/cockpit/themes/labels/symbols/loop.svg +0 -5
- data/cockpit/themes/labels/symbols/manipulate.svg +0 -4
- data/cockpit/themes/labels/symbols/otherwise.svg +0 -5
- data/cockpit/themes/labels/symbols/parallel.svg +0 -5
- data/cockpit/themes/labels/symbols/parallel_branch.svg +0 -5
- data/cockpit/themes/labels/symbols/parallel_branch_compact.svg +0 -4
- data/cockpit/themes/labels/symbols/parallel_branch_event.svg +0 -14
- data/cockpit/themes/labels/symbols/parallel_branch_normal.svg +0 -5
- data/cockpit/themes/labels/symbols/scripts.svg +0 -4
- data/cockpit/themes/labels/symbols/start.svg +0 -3
- data/cockpit/themes/labels/symbols/stop.svg +0 -5
- data/cockpit/themes/labels/symbols/terminate.svg +0 -4
- data/cockpit/themes/packed/rngs/alternative.rng +0 -1
- data/cockpit/themes/packed/rngs/choose.rng +0 -1
- data/cockpit/themes/packed/rngs/critical.rng +0 -1
- data/cockpit/themes/packed/rngs/escape.rng +0 -1
- data/cockpit/themes/packed/rngs/group.rng +0 -1
- data/cockpit/themes/packed/rngs/loop.rng +0 -1
- data/cockpit/themes/packed/rngs/manipulate.rng +0 -1
- data/cockpit/themes/packed/rngs/otherwise.rng +0 -1
- data/cockpit/themes/packed/rngs/parallel.rng +0 -1
- data/cockpit/themes/packed/rngs/parallel_branch.rng +0 -1
- data/cockpit/themes/packed/rngs/stop.rng +0 -1
- data/cockpit/themes/packed/rngs/terminate.rng +0 -1
- data/cockpit/themes/preset/rngs/alternative.rng +0 -1
- data/cockpit/themes/preset/rngs/choose.rng +0 -1
- data/cockpit/themes/preset/rngs/critical.rng +0 -1
- data/cockpit/themes/preset/rngs/escape.rng +0 -1
- data/cockpit/themes/preset/rngs/group.rng +0 -1
- data/cockpit/themes/preset/rngs/loop.rng +0 -1
- data/cockpit/themes/preset/rngs/manipulate.rng +0 -1
- data/cockpit/themes/preset/rngs/otherwise.rng +0 -1
- data/cockpit/themes/preset/rngs/parallel.rng +0 -1
- data/cockpit/themes/preset/rngs/parallel_branch.rng +0 -1
- data/cockpit/themes/preset/rngs/stop.rng +0 -1
- data/cockpit/themes/preset/rngs/terminate.rng +0 -1
- data/lib/cpee/empty_workflow.rb +0 -28
- data/lib/cpee/handler_notifications.rb +0 -47
- data/lib/cpee/handler_properties.rb +0 -50
- data/lib/cpee/instantiation.rb +0 -368
- data/lib/cpee/processtransformation/bpel/Repository/booking.bpel +0 -125
- data/lib/cpee/processtransformation/bpel/Repository/booking.wsdl +0 -72
- data/lib/cpee/processtransformation/bpel/Repository/booking/airline.wsdl +0 -71
- data/lib/cpee/processtransformation/bpel/Repository/booking/hotel.wsdl +0 -64
- data/lib/cpee/processtransformation/bpel/Repository/booking/report.wsdl +0 -71
- data/lib/cpee/processtransformation/bpel/bpel2wee.rb +0 -34
- data/lib/cpee/processtransformation/bpel/bpelserver.ru +0 -64
- data/lib/cpee/processtransformation/bpel/bpelserver.xml +0 -70
- data/lib/cpee/processtransformation/bpel/lib/BPEL_Transform.rb +0 -367
- data/lib/cpee/processtransformation/bpmn2.rb +0 -297
- data/lib/cpee/processtransformation/cpee.rb +0 -119
- data/lib/cpee/processtransformation/structures.rb +0 -465
- data/lib/cpee/processtransformation/target.rb +0 -50
- data/log/azure.rb +0 -10
- data/log/azure_logger.rb +0 -136
- data/log/chain.xml +0 -27
- data/log/elasticsearch.rb +0 -15
- data/log/elasticsearch_logging.rb +0 -377
- data/log/legacy/test_es.rb +0 -26
- data/log/legacy/test_split.rb +0 -211
- data/log/log.xml +0 -13
- data/log/non_tamp.rb +0 -156
- data/log/sic.rb +0 -63
- data/log/template.xes_xml +0 -23
- data/log/template.xes_yaml +0 -28
- data/log/trace.yaml +0 -17717
- data/log/trace_sic.yaml +0 -18343
- data/log/xes_xml.rb +0 -121
- data/log/xes_yaml.rb +0 -96
- data/server/handlerwrappers/soap.rb +0 -146
- data/server/resources/notifications/logging/consumer-secret +0 -1
- data/server/resources/notifications/logging/producer-secret +0 -1
- data/server/resources/properties.schema.active +0 -139
- data/server/resources/properties.schema.finished +0 -139
- data/server/resources/properties.schema.inactive +0 -136
- data/server/resources/test1.xml +0 -58
- data/server/resources/test2.xml +0 -60
- data/server/resources/test3.xml +0 -217
- data/test/callback.rb +0 -9
data/lib/cpee/implementation.rb
CHANGED
@@ -13,39 +13,70 @@
|
|
13
13
|
# <http://www.gnu.org/licenses/>.
|
14
14
|
|
15
15
|
require 'fileutils'
|
16
|
+
require 'redis'
|
16
17
|
require 'riddl/server'
|
17
18
|
require 'riddl/client'
|
18
|
-
|
19
|
-
|
20
|
-
require_relative '
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
def to_json(*a)
|
25
|
-
table.to_json
|
26
|
-
end
|
27
|
-
end
|
28
|
-
def →(a); ParaStruct.new(a); end
|
29
|
-
def ⭐(a); ParaStruct.new(a); end
|
19
|
+
require_relative 'message'
|
20
|
+
require_relative 'persistence'
|
21
|
+
require_relative 'statemachine'
|
22
|
+
require_relative 'implementation_properties'
|
23
|
+
require_relative 'implementation_notifications'
|
24
|
+
require_relative 'implementation_callbacks'
|
30
25
|
|
31
26
|
module CPEE
|
32
27
|
|
33
28
|
SERVER = File.expand_path(File.join(__dir__,'..','cpee.xml'))
|
34
|
-
|
29
|
+
PROPERTIES_PATHS_FULL = %w{
|
30
|
+
/p:properties/p:handlerwrapper
|
31
|
+
/p:properties/p:positions/p:*
|
32
|
+
/p:properties/p:positions/p:*/@*
|
33
|
+
/p:properties/p:dataelements/p:*
|
34
|
+
/p:properties/p:endpoints/p:*
|
35
|
+
/p:properties/p:attributes/p:*
|
36
|
+
/p:properties/p:transformation/p:*
|
37
|
+
/p:properties/p:transformation/p:*/@*
|
38
|
+
/p:properties/p:description
|
39
|
+
/p:properties/p:dslx
|
40
|
+
/p:properties/p:dsl
|
41
|
+
/p:properties/p:status/p:id
|
42
|
+
/p:properties/p:status/p:message
|
43
|
+
/p:properties/p:state/@changed
|
44
|
+
/p:properties/p:state
|
45
|
+
}
|
46
|
+
PROPERTIES_PATHS_INDEX_UNORDERED = %w{
|
47
|
+
/p:properties/p:positions/p:*
|
48
|
+
}
|
49
|
+
PROPERTIES_PATHS_INDEX_ORDERED = %w{
|
50
|
+
/p:properties/p:dataelements/p:*
|
51
|
+
/p:properties/p:endpoints/p:*
|
52
|
+
/p:properties/p:attributes/p:*
|
53
|
+
}
|
35
54
|
def self::implementation(opts)
|
36
55
|
opts[:instances] ||= File.expand_path(File.join(__dir__,'..','..','server','instances'))
|
37
56
|
opts[:global_handlerwrappers] ||= File.expand_path(File.join(__dir__,'..','..','server','handlerwrappers'))
|
38
57
|
opts[:handlerwrappers] ||= ''
|
39
58
|
opts[:topics] ||= File.expand_path(File.join(__dir__,'..','..','server','resources','topics.xml'))
|
40
59
|
opts[:properties_init] ||= File.expand_path(File.join(__dir__,'..','..','server','resources','properties.init'))
|
41
|
-
opts[:
|
42
|
-
opts[:properties_schema_finished] ||= File.expand_path(File.join(__dir__,'..','..','server','resources','properties.schema.finished'))
|
43
|
-
opts[:properties_schema_inactive] ||= File.expand_path(File.join(__dir__,'..','..','server','resources','properties.schema.inactive'))
|
60
|
+
opts[:properties_empty] ||= File.expand_path(File.join(__dir__,'..','..','server','resources','properties.empty'))
|
44
61
|
opts[:transformation_dslx] ||= File.expand_path(File.join(__dir__,'..','..','server','resources','transformation_dslx.xsl'))
|
45
62
|
opts[:transformation_service] ||= File.expand_path(File.join(__dir__,'..','..','server','resources','transformation.xml'))
|
46
63
|
opts[:empty_dslx] ||= File.expand_path(File.join(__dir__,'..','..','server','resources','empty_dslx.xml'))
|
47
64
|
opts[:notifications_init] ||= File.expand_path(File.join(__dir__,'..','..','server','resources','notifications'))
|
65
|
+
opts[:states] ||= File.expand_path(File.join(__dir__,'..','..','server','resources','states.xml'))
|
66
|
+
opts[:backend_run] ||= File.expand_path(File.join(__dir__,'..','..','server','resources','backend','run'))
|
67
|
+
opts[:backend_template] ||= File.expand_path(File.join(__dir__,'..','..','server','resources','backend','instance.template'))
|
68
|
+
opts[:backend_opts] ||= 'opts.yaml'
|
69
|
+
opts[:watchdog_frequency] ||= 7
|
70
|
+
opts[:watchdog_start_off] ||= false
|
71
|
+
opts[:backend_instance] ||= 'instance.rb'
|
48
72
|
opts[:infinite_loop_stop] ||= 10000
|
73
|
+
opts[:redis_path] ||= '/tmp/redis.sock'
|
74
|
+
opts[:redis_db] ||= 3
|
75
|
+
|
76
|
+
opts[:redis] = Redis.new(path: opts[:redis_path], db: opts[:redis_db])
|
77
|
+
opts[:statemachine] = CPEE::StateMachine.new opts[:states], %w{running simulating replaying finishing stopping abandoned finished} do |id|
|
78
|
+
opts[:redis].get("instance:#{id}/state")
|
79
|
+
end
|
49
80
|
|
50
81
|
opts[:runtime_cmds] << [
|
51
82
|
"startclean", "Delete instances before starting.", Proc.new { |status|
|
@@ -56,94 +87,80 @@ module CPEE
|
|
56
87
|
]
|
57
88
|
|
58
89
|
Proc.new do
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
end
|
90
|
+
parallel do
|
91
|
+
CPEE::watch_services(@riddl_opts[:watchdog_start_off])
|
92
|
+
EM.add_periodic_timer(@riddl_opts[:watchdog_frequency]) do
|
93
|
+
CPEE::watch_services(@riddl_opts[:watchdog_start_off])
|
94
|
+
end
|
95
|
+
end
|
96
|
+
cleanup do
|
97
|
+
CPEE::cleanup_services(@riddl_opts[:watchdog_start_off])
|
98
|
+
end
|
65
99
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
100
|
+
interface 'main' do
|
101
|
+
run CPEE::Instances, opts if get '*'
|
102
|
+
run CPEE::NewInstance, opts if post 'instance-new'
|
103
|
+
on resource '\d+' do |r|
|
104
|
+
run CPEE::Info, opts if get
|
105
|
+
run CPEE::DeleteInstance, opts if delete
|
106
|
+
end
|
70
107
|
end
|
71
108
|
|
72
109
|
interface 'properties' do |r|
|
73
110
|
id = r[:h]['RIDDL_DECLARATION_PATH'].split('/')[1].to_i
|
74
|
-
use
|
111
|
+
use CPEE::Properties::implementation(id.to_i, opts)
|
75
112
|
end
|
76
113
|
|
77
|
-
interface '
|
78
|
-
|
79
|
-
|
80
|
-
run CPEE::NewXMLInstance, controller, opts if post 'instance-new-xml'
|
81
|
-
on resource do |r|
|
82
|
-
run CPEE::Info, controller if get
|
83
|
-
run CPEE::DeleteInstance, controller, opts if delete
|
84
|
-
on resource 'console' do
|
85
|
-
run CPEE::ConsoleUI, controller if get
|
86
|
-
run CPEE::Console, controller if get 'cmdin'
|
87
|
-
end
|
88
|
-
on resource 'callbacks' do
|
89
|
-
run CPEE::Callbacks, controller, opts if get
|
90
|
-
on resource do
|
91
|
-
run CPEE::ExCallback, controller if get || put || post || delete
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
114
|
+
interface 'notifications' do |r|
|
115
|
+
id = r[:h]['RIDDL_DECLARATION_PATH'].split('/')[1].to_i
|
116
|
+
use CPEE::Notifications::implementation(id.to_i, opts)
|
95
117
|
end
|
96
118
|
|
97
|
-
interface '
|
119
|
+
interface 'callbacks' do |r|
|
98
120
|
id = r[:h]['RIDDL_DECLARATION_PATH'].split('/')[1].to_i
|
99
|
-
use
|
121
|
+
use CPEE::Callbacks::implementation(id.to_i, opts)
|
100
122
|
end
|
101
123
|
end
|
102
124
|
end
|
103
125
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
end
|
126
|
+
def self::watch_services(watchdog_start_off)
|
127
|
+
return if watchdog_start_off
|
128
|
+
EM.defer do
|
129
|
+
Dir[File.join(__dir__,'..','..','server','routing','*.rb')].each do |s|
|
130
|
+
s = s.sub(/\.rb$/,'')
|
131
|
+
pid = (File.read(s + '.pid').to_i rescue nil)
|
132
|
+
if (pid.nil? || !(Process.kill(0, pid) rescue false)) && !File.exist?(s + '.lock')
|
133
|
+
system "#{s}.rb restart 1>/dev/null 2>&1"
|
134
|
+
puts "➡ Service #{File.basename(s,'.rb')} started ..."
|
135
|
+
end
|
136
|
+
end
|
116
137
|
end
|
117
|
-
end
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
return
|
127
|
-
end
|
128
|
-
Riddl::Parameter::Complex.new("info","text/xml") do
|
129
|
-
cb = XML::Smart::string("<callbacks details='#{opts[:mode]}'/>")
|
130
|
-
if opts[:mode] == :debug
|
131
|
-
controller[id].callbacks.each do |k,v|
|
132
|
-
cb.root.add("callback",{"id" => k},"[#{v.protocol.to_s}] #{v.info}")
|
133
|
-
end
|
134
|
-
end
|
135
|
-
cb.to_s
|
138
|
+
end
|
139
|
+
def self::cleanup_services(watchdog_start_off)
|
140
|
+
return if watchdog_start_off
|
141
|
+
Dir[File.join(__dir__,'..','..','server','routing','*.rb')].each do |s|
|
142
|
+
s = s.sub(/\.rb$/,'')
|
143
|
+
pid = (File.read(s + '.pid').to_i rescue nil)
|
144
|
+
if !pid.nil? || (Process.kill(0, pid) rescue false)
|
145
|
+
system "#{s}.rb stop 1>/dev/null 2>&1"
|
146
|
+
puts "➡ Service #{File.basename(s,'.rb')} stopped ..."
|
136
147
|
end
|
137
148
|
end
|
138
|
-
end
|
149
|
+
end
|
139
150
|
|
140
151
|
class Instances < Riddl::Implementation #{{{
|
141
152
|
def response
|
142
|
-
|
153
|
+
redis = @a[0][:redis]
|
143
154
|
Riddl::Parameter::Complex.new("wis","text/xml") do
|
144
155
|
ins = XML::Smart::string('<instances/>')
|
145
|
-
|
146
|
-
|
156
|
+
redis.zrevrange('instances',0,-1).each do |instance|
|
157
|
+
statekey = "instance:#{instance}/state"
|
158
|
+
attributes = "instance:#{instance}/attributes/"
|
159
|
+
info = redis.get(attributes + 'info')
|
160
|
+
uuid = redis.get(attributes + 'uuid')
|
161
|
+
state = redis.get(statekey)
|
162
|
+
state_changed = redis.get(File.join(statekey,'@changed'))
|
163
|
+
ins.root.add('instance', info, 'uuid' => uuid, 'id' => instance, 'state' => state, 'state_changed' => state_changed )
|
147
164
|
end
|
148
165
|
ins.to_s
|
149
166
|
end
|
@@ -151,70 +168,68 @@ module CPEE
|
|
151
168
|
end #}}}
|
152
169
|
|
153
170
|
class NewInstance < Riddl::Implementation #{{{
|
154
|
-
def
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
while true
|
161
|
-
id += 1
|
162
|
-
unless Dir.exists? opts[:instances] + "/#{id}"
|
163
|
-
Dir.mkdir(opts[:instances] + "/#{id}") rescue nil
|
164
|
-
break
|
165
|
-
end
|
171
|
+
def path(e)
|
172
|
+
ret = []
|
173
|
+
until e.qname.name == 'properties'
|
174
|
+
ret << (e.class == XML::Smart::Dom::Attribute ? '@' : '') + e.qname.name
|
175
|
+
e = e.parent
|
166
176
|
end
|
167
|
-
|
168
|
-
controller[id] = Controller.new(id,opts)
|
169
|
-
controller[id].info = name
|
170
|
-
controller[id].state_change!
|
171
|
-
|
172
|
-
@headers << Riddl::Header.new("CPEE-INSTANCE", controller[id].instance)
|
173
|
-
@headers << Riddl::Header.new("CPEE-INSTANCE-URL", controller[id].instance_url)
|
174
|
-
@headers << Riddl::Header.new("CPEE-INSTANCE-UUID", controller[id].uuid)
|
175
|
-
|
176
|
-
Riddl::Parameter::Simple.new("id", id)
|
177
|
+
File.join(*ret.reverse)
|
177
178
|
end
|
178
|
-
end #}}}
|
179
|
-
class NewXMLInstance < Riddl::Implementation #{{{
|
180
|
-
def response
|
181
|
-
controller = @a[0]
|
182
|
-
opts = @a[1]
|
183
|
-
xml = @p[0].value.read
|
184
|
-
id = controller.keys.sort.last.to_i
|
185
179
|
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
180
|
+
def response
|
181
|
+
opts = @a[0]
|
182
|
+
redis = opts[:redis]
|
183
|
+
doc = XML::Smart::open_unprotected(opts[:properties_init])
|
184
|
+
doc.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
|
185
|
+
name = @p[0].value
|
186
|
+
id = redis.zcount('instances','-inf','+inf').to_i + 1
|
187
|
+
uuid = SecureRandom.uuid
|
188
|
+
instance = 'instance:' + id.to_s
|
189
|
+
redis.multi do |multi|
|
190
|
+
multi.zadd('instances',id,id)
|
191
|
+
doc.root.find(PROPERTIES_PATHS_FULL.join(' | ')).each do |e|
|
192
|
+
if e.class == XML::Smart::Dom::Element && e.element_only?
|
193
|
+
val = e.find('*').map { |f| f.dump }.join
|
194
|
+
multi.set(File.join(instance, path(e)), val)
|
195
|
+
else
|
196
|
+
multi.set(File.join(instance, path(e)), e.text)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
doc.root.find(PROPERTIES_PATHS_INDEX_UNORDERED.join(' | ')).each do |e|
|
200
|
+
p = path(e)
|
201
|
+
multi.sadd(File.join(instance, File.dirname(p)), File.basename(p))
|
192
202
|
end
|
203
|
+
doc.root.find(PROPERTIES_PATHS_INDEX_ORDERED.join(' | ')).each_with_index do |e,i|
|
204
|
+
p = path(e)
|
205
|
+
multi.zadd(File.join(instance, File.dirname(p)), i, File.basename(p))
|
206
|
+
end
|
207
|
+
multi.set(File.join(instance, 'attributes', 'uuid'), SecureRandom.uuid)
|
208
|
+
multi.zadd(File.join(instance, 'attributes'), -2, 'uuid')
|
209
|
+
multi.set(File.join(instance, 'attributes', 'info'), name)
|
210
|
+
multi.zadd(File.join(instance, 'attributes'), -1, 'info')
|
211
|
+
multi.set(File.join(instance, 'state', '@changed'), Time.now.xmlschema(3))
|
193
212
|
end
|
194
|
-
File.write(File.join(opts[:instances].to_s,id.to_s,'properties.xml'),xml)
|
195
|
-
|
196
|
-
controller[id] = Controller.new(id,opts)
|
197
|
-
controller[id].state_change!
|
198
213
|
|
199
|
-
@headers << Riddl::Header.new("CPEE-INSTANCE",
|
200
|
-
@headers << Riddl::Header.new("CPEE-INSTANCE-URL",
|
201
|
-
@headers << Riddl::Header.new("CPEE-INSTANCE-UUID",
|
214
|
+
@headers << Riddl::Header.new("CPEE-INSTANCE", id.to_s)
|
215
|
+
@headers << Riddl::Header.new("CPEE-INSTANCE-URL", File.join(opts[:url].to_s,id.to_s))
|
216
|
+
@headers << Riddl::Header.new("CPEE-INSTANCE-UUID", uuid)
|
202
217
|
|
203
|
-
Riddl::Parameter::Simple.new("id", id)
|
218
|
+
Riddl::Parameter::Simple.new("id", id.to_s)
|
204
219
|
end
|
205
220
|
end #}}}
|
206
221
|
|
207
222
|
class Info < Riddl::Implementation #{{{
|
208
223
|
def response
|
209
|
-
|
224
|
+
opts = @a[0]
|
210
225
|
id = @r[0].to_i
|
211
|
-
unless
|
212
|
-
@status =
|
226
|
+
unless opts[:redis].exists?("instance:#{id}/state")
|
227
|
+
@status = 404
|
213
228
|
return
|
214
229
|
end
|
215
230
|
Riddl::Parameter::Complex.new("info","text/xml") do
|
216
231
|
i = XML::Smart::string <<-END
|
217
|
-
<info instance='#{
|
232
|
+
<info instance='#{id}'>
|
218
233
|
<notifications/>
|
219
234
|
<properties/>
|
220
235
|
<callbacks/>
|
@@ -225,73 +240,19 @@ module CPEE
|
|
225
240
|
end
|
226
241
|
end #}}}
|
227
242
|
|
228
|
-
class ConsoleUI < Riddl::Implementation #{{{
|
229
|
-
def response
|
230
|
-
controller = @a[0]
|
231
|
-
id = @r[0].to_i
|
232
|
-
unless controller[id]
|
233
|
-
@status = 400
|
234
|
-
return
|
235
|
-
end
|
236
|
-
Riddl::Parameter::Complex.new("res","text/html") do
|
237
|
-
<<-END
|
238
|
-
<!DOCTYPE html>
|
239
|
-
<html>
|
240
|
-
<head>
|
241
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
242
|
-
<title>Instance Web Console</title>
|
243
|
-
<style type="text/css">
|
244
|
-
[contenteditable] { display: inline; }
|
245
|
-
[contenteditable]:focus { outline: 0px solid transparent; }
|
246
|
-
body{ font-family: Courier,Courier New,Monospace}
|
247
|
-
</style>
|
248
|
-
<script type="text/javascript" src="//#{controller[id].host}/js_libs/jquery.min.js"></script>
|
249
|
-
<script type="text/javascript" src="//#{controller[id].host}/js_libs/ansi_up.js"></script>
|
250
|
-
<script type="text/javascript" src="//#{controller[id].host}/js_libs/console.js"></script>
|
251
|
-
</head>
|
252
|
-
<body>
|
253
|
-
<p>Instance Web Console. Type "help" to get started.</p>
|
254
|
-
<div class="console-line" id="console-template" style="display: none">
|
255
|
-
<strong>console$ </strong><div class='edit' contenteditable="true" ></div>
|
256
|
-
</div>
|
257
|
-
<div class="console-line">
|
258
|
-
<strong>console$ </strong><div class='edit' contenteditable="true"></div>
|
259
|
-
</div>
|
260
|
-
</body>
|
261
|
-
</html>
|
262
|
-
END
|
263
|
-
end
|
264
|
-
end
|
265
|
-
end #}}}
|
266
|
-
class Console < Riddl::Implementation #{{{
|
267
|
-
def response
|
268
|
-
controller = @a[0]
|
269
|
-
id = @r[0].to_i
|
270
|
-
unless controller[id]
|
271
|
-
@status = 400
|
272
|
-
return
|
273
|
-
end
|
274
|
-
Riddl::Parameter::Complex.new("res","text/plain") do
|
275
|
-
begin
|
276
|
-
controller[id].console(@p[0].value)
|
277
|
-
rescue => e
|
278
|
-
e.message
|
279
|
-
end
|
280
|
-
end
|
281
|
-
end
|
282
|
-
end #}}}
|
283
|
-
|
284
243
|
class DeleteInstance < Riddl::Implementation #{{{
|
285
244
|
def response
|
286
|
-
|
287
|
-
|
245
|
+
opts = @a[0]
|
246
|
+
redis = opts[:redis]
|
288
247
|
id = @r[0].to_i
|
289
|
-
unless
|
290
|
-
@status =
|
248
|
+
unless redis.exists("instance:#{id}/state")
|
249
|
+
@status = 404
|
291
250
|
return
|
292
251
|
end
|
293
|
-
|
294
|
-
|
252
|
+
redis.multi do |multi|
|
253
|
+
multi.del redis.keys("instance:#{id}/*").to_a
|
254
|
+
multi.zrem 'instances', id
|
255
|
+
end
|
295
256
|
end
|
296
257
|
end #}}}
|
297
258
|
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module CPEE
|
4
|
+
module Callbacks
|
5
|
+
|
6
|
+
def self::implementation(id,opts)
|
7
|
+
Proc.new do
|
8
|
+
run CPEE::Callbacks::Callbacks, id, opts if get
|
9
|
+
on resource do
|
10
|
+
run CPEE::Callbacks::ExCallback, id, opts if put
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class Callbacks < Riddl::Implementation #{{{
|
16
|
+
def response
|
17
|
+
id = @a[0]
|
18
|
+
opts = @a[1]
|
19
|
+
Riddl::Parameter::Complex.new("callbacks","text/xml") do
|
20
|
+
ret = XML::Smart::string <<-END
|
21
|
+
<callbacks/>
|
22
|
+
END
|
23
|
+
CPEE::Persistence::extract_set(id,opts,'callbacks').each do |de|
|
24
|
+
ret.root.add('callback', de[1], :id => de[0])
|
25
|
+
end
|
26
|
+
ret.to_s
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end #}}}
|
30
|
+
|
31
|
+
class ExCallback < Riddl::Implementation #{{{
|
32
|
+
def response
|
33
|
+
id = @a[0]
|
34
|
+
opts = @a[1]
|
35
|
+
callback = @r[-1]
|
36
|
+
|
37
|
+
if opts[:redis].get("instance:#{id}/callback/#{callback}/type") == 'callback'
|
38
|
+
ret = {}
|
39
|
+
ret['values'] = @p.map{ |e|
|
40
|
+
[e.name, e.class == Riddl::Parameter::Simple ? [:simple,e.value] : [:complex,e.mimetype,e.value.path] ]
|
41
|
+
}
|
42
|
+
ret['headers'] = @h
|
43
|
+
|
44
|
+
CPEE::Message::send(
|
45
|
+
:'callback-response',
|
46
|
+
callback,
|
47
|
+
opts[:url],
|
48
|
+
id,
|
49
|
+
{},
|
50
|
+
{},
|
51
|
+
ret,
|
52
|
+
opts[:redis]
|
53
|
+
)
|
54
|
+
elsif opts[:redis].get("instance:#{id}/callback/#{callback}/type") == 'vote'
|
55
|
+
if @p.length == 1 && @p[0].name == 'continue' && @p[0].class == Riddl::Parameter::Simple
|
56
|
+
CPEE::Message::send(
|
57
|
+
:'vote-response',
|
58
|
+
callback,
|
59
|
+
opts[:url],
|
60
|
+
id,
|
61
|
+
{},
|
62
|
+
{},
|
63
|
+
@p[0].value,
|
64
|
+
opts[:redis]
|
65
|
+
)
|
66
|
+
else
|
67
|
+
@status = 400
|
68
|
+
end
|
69
|
+
else
|
70
|
+
@status = 503
|
71
|
+
end
|
72
|
+
nil
|
73
|
+
end
|
74
|
+
end #}}}
|
75
|
+
|
76
|
+
end
|
77
|
+
end
|