cpee 1.4.25 → 1.4.26

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.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/cockpit/graph.html +0 -5
  3. data/cockpit/js/instance.js +111 -89
  4. data/cockpit/js/ui.js +8 -4
  5. data/cpee.gemspec +1 -1
  6. data/lib/cpee/implementation.rb +1 -1
  7. data/lib/cpee/instantiation.rb +4 -4
  8. data/server/instances/100/notifications/logging/consumer-secret +1 -0
  9. data/server/instances/100/notifications/logging/producer-secret +1 -0
  10. data/server/instances/100/notifications/logging/subscription.xml +19 -0
  11. data/server/instances/100/properties.xml +31 -0
  12. data/server/instances/101/notifications/logging/consumer-secret +1 -0
  13. data/server/instances/101/notifications/logging/producer-secret +1 -0
  14. data/server/instances/101/notifications/logging/subscription.xml +19 -0
  15. data/server/instances/101/properties.xml +31 -0
  16. data/server/instances/102/notifications/logging/consumer-secret +1 -0
  17. data/server/instances/102/notifications/logging/producer-secret +1 -0
  18. data/server/instances/102/notifications/logging/subscription.xml +19 -0
  19. data/server/instances/102/properties.xml +31 -0
  20. data/server/instances/103/notifications/logging/consumer-secret +1 -0
  21. data/server/instances/103/notifications/logging/producer-secret +1 -0
  22. data/server/instances/103/notifications/logging/subscription.xml +19 -0
  23. data/server/instances/103/properties.xml +118 -0
  24. data/server/instances/99/notifications/logging/consumer-secret +1 -0
  25. data/server/instances/99/notifications/logging/producer-secret +1 -0
  26. data/server/instances/99/notifications/logging/subscription.xml +19 -0
  27. data/server/instances/99/properties.xml +156 -0
  28. data/server/server.pid +1 -1
  29. data/tools/cpee +50 -30
  30. metadata +22 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ca2a44922e2de76c9cf66c26fa64d0e0c0083125f2f95871347282c606af0360
4
- data.tar.gz: 2c369db3a8e67ec3fa5760365e151266ecbc185ef94c272984e67d14d6d7b919
3
+ metadata.gz: 8bfdf2f4eb0e174cde8d67c2551f1bb0753cae717b687f3f45079845d6823639
4
+ data.tar.gz: bbbfab5e578ac3e9bd68c3845fb17632f467460d83fc6a04f908bf8b3311ad5b
5
5
  SHA512:
6
- metadata.gz: c64b33cc05bb31975974cd57d36fb2ef6ef84e61760aa62542c65a49e84c1fcf786428f19ac722970ffbe944c98a63ecf9767d632bb50eba7555923e7b06057e
7
- data.tar.gz: c5963c5c45e8d3a329c14f1c8f2dacd36fc747fc5e9614a6715c83fcd713711fc60460b43fb2b113a51866daa1d0e1597cd04b70e6c1fd5760f95c84ee7209d7
6
+ metadata.gz: 37c394dcfb064c1c7c840d9b55bf8475ad8be8c7981fed8af8cedf92c018f7347569ed982b615180aaac105b35268181d8dc3198f4ab9d5d8d1241f936d0a750
7
+ data.tar.gz: 91e7605015c0b37494a8fc7ac64a760bc268cede9f68abac2540e14315abe1aa9e678419205b65b644632c06996183abdf8b82bdec28cd2b63d903412d809417
@@ -57,11 +57,6 @@
57
57
  <link rel="stylesheet" href="css/ui.css" type="text/css"/>
58
58
  </head>
59
59
  <body data-base-port="8298" data-res-port="9303" data-theme-base="themes" is="x-ui">
60
- <div class='hidden'>
61
- <input name="repo-url" type="text" value=""/>
62
- <input name="base-url" type="text" value=""/>
63
- <input name="instance-url" type="text" value=""/>
64
- </div>
65
60
  <div id='graphcolumn' style='overflow: auto'>
66
61
  <svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:x="http://www.w3.org/1999/xlink" id='graphcanvas' width='1' height='1'></svg>
67
62
  </div>
@@ -63,8 +63,8 @@ var sub_less = 'topic' + '=' + 'activity' + '&' +// {{{
63
63
  'events' + '=' + 'change';// }}}
64
64
 
65
65
  function cockpit() { //{{{
66
- $("button[name=base]").click(function(){ create_instance(null,false); });
67
- $("button[name=instance]").click(function(){ ui_activate_tab("#tabinstance"); monitor_instance(false,false); });
66
+ $("button[name=base]").click(function(){ create_instance($("input[name=base-url]").val(),null,false,false); });
67
+ $("button[name=instance]").click(function(){ ui_activate_tab("#tabinstance"); monitor_instance($("input[name=instance-url]").val(),$("input[name=repo-url]").val(),false,false); });
68
68
  $("button[name=loadtestset]").click(function(e){new CustomMenu(e).menu($('#predefinedtestsets'),function(){ load_testset(false) } ); });
69
69
  $("button[name=loadtestsetfile]").click(load_testsetfile);
70
70
  $("button[name=loadmodelfile]").click(load_modelfile);
@@ -89,7 +89,6 @@ function cockpit() { //{{{
89
89
  ui_toggle_vis_tab($('#parameters'));
90
90
  }
91
91
  if (q.monitor && q.load) {
92
- $("input[name=instance-url]").val(q.monitor);
93
92
  if (q.load.match(/https?:\/\//)) {
94
93
  $("#predefinedtestsets").attr('data-other',q.load);
95
94
  } else {
@@ -98,7 +97,7 @@ function cockpit() { //{{{
98
97
  });
99
98
  }
100
99
  ui_activate_tab("#tabexecution");
101
- monitor_instance(true,false);
100
+ monitor_instance(q.monitor,$("body").attr('current-repo'),true,false);
102
101
  } else if (q.load) {
103
102
  if (q.load.match(/https?:\/\//)) {
104
103
  $("#predefinedtestsets").attr('data-other',q.load);
@@ -108,14 +107,13 @@ function cockpit() { //{{{
108
107
  });
109
108
  }
110
109
  ui_activate_tab("#tabexecution");
111
- create_instance(q.load,false);
112
- } else if (q.new || q.new == "" || q.load == "") {
110
+ create_instance($("body").attr('current-base'),q.load,true,false);
111
+ } else if (q.new || q.new == "") {
113
112
  ui_activate_tab("#tabinstance");
114
- create_instance("Plain Instance",false);
113
+ create_instance($("body").attr('current-base'),"Plain Instance",false,false);
115
114
  } else if (q.monitor) {
116
- $("input[name=instance-url]").val(q.monitor);
117
115
  ui_activate_tab("#tabexecution");
118
- monitor_instance(false,false);
116
+ monitor_instance(q.monitor,$("body").attr('current-repo'),false,false);
119
117
  } else if (q.exec) {
120
118
  if (q.exec.match(/https?:\/\//)) {
121
119
  $("#predefinedtestsets").attr('data-other',q.load);
@@ -125,7 +123,7 @@ function cockpit() { //{{{
125
123
  });
126
124
  }
127
125
  ui_activate_tab("#tabexecution");
128
- create_instance(q.exec,true);
126
+ create_instance($("body").attr('current-base'),q.exec,true,true);
129
127
  }
130
128
  }
131
129
  });
@@ -141,13 +139,12 @@ function cockpit() { //{{{
141
139
  });
142
140
  } //}}}
143
141
 
144
- function sanitize_url(it) { //{{{
145
- var url = it.val();
142
+ function sanitize_url(url) { //{{{
146
143
  var lastChar = url.substr(url.length - 1)
147
144
  if (lastChar != '/') {
148
- it.val(url + '/');
145
+ url = (url + '/');
149
146
  }
150
- return it.val();
147
+ return url;
151
148
  }
152
149
  //}}}
153
150
  function check_subscription() { // {{{
@@ -181,19 +178,23 @@ function check_subscription() { // {{{
181
178
  }
182
179
  }// }}}
183
180
 
184
- function create_instance(ask,exec) {// {{{
185
- var info = ask ? ask: prompt("Instance info?", "Enter info here");
181
+ function create_instance(base,name,load,exec) {// {{{
182
+ var info = name ? name : prompt("Instance info?", "Enter info here");
186
183
  if (info != null) {
187
184
  if (info.match(/\S/)) {
188
- var base = $("input[name=base-url]").val();
189
185
  $.ajax({
190
186
  type: "POST",
191
187
  url: base,
192
188
  dataType: "text",
193
189
  data: "info=" + info,
194
190
  success: function(res){
195
- $("input[name=instance-url]").val((base + "//" + res + "/").replace(/\/+/g,"/").replace(/:\//,"://"));
196
- if (ask) monitor_instance(true,exec);
191
+ var iu = (base + "//" + res + "/").replace(/\/+/g,"/").replace(/:\//,"://");
192
+ if (name) {
193
+ monitor_instance(iu,$("body").attr('current-repo'),load,exec);
194
+ } else {
195
+ $("body").attr('current-instance', sanitize_url(iu));
196
+ $("input[name=instance-url]").val(iu);
197
+ }
197
198
  },
198
199
  error: function(a,b,c) {
199
200
  alert("No CPEE running.");
@@ -229,9 +230,7 @@ function websocket() { //{{{
229
230
  case 'attributes':
230
231
  monitor_instance_values("attributes");
231
232
  monitor_instance_transformation();
232
- if (suspended_monitoring) {
233
- suspended_monitoring = false;
234
- } else {
233
+ if (!suspended_monitoring) { // or else it would load twice, because dsl changes also
235
234
  monitor_graph_change(true);
236
235
  }
237
236
  break;
@@ -268,15 +267,18 @@ function websocket() { //{{{
268
267
  monitor_instance_state();
269
268
  } //}}}
270
269
 
271
- function monitor_instance(load,exec) {// {{{
272
- var url = sanitize_url($("input[name=instance-url]"));
273
- sanitize_url($("input[name=base-url]"));
274
- var rep = sanitize_url($("input[name=repo-url]"));
270
+ function monitor_instance(cin,rep,load,exec) {// {{{
271
+ $("body").attr('current-instance',sanitize_url(cin));
272
+ $("body").attr('current-repo', sanitize_url(rep));
275
273
 
274
+ $("input[name=instance-url]").val($("body").attr('current-instance'));
275
+ $("input[name=repo-url]").val($("body").attr('current-repo'));
276
276
 
277
277
  $('.tabbehind button').hide();
278
278
  $('#dat_details').empty();
279
279
 
280
+ url = $("body").attr('current-instance');
281
+
280
282
  $.ajax({
281
283
  type: "GET",
282
284
  url: url + "/properties/schema/",
@@ -285,9 +287,6 @@ function monitor_instance(load,exec) {// {{{
285
287
  $("ui-resizehandle.hidden").removeClass("hidden");
286
288
  $("ui-tabbed ui-tab.hidden, ui-rest ui-tab.hidden").removeClass("hidden");
287
289
 
288
- $("body").attr('current-instance',url);
289
- $("body").attr('current-repo',rep);
290
-
291
290
  // Change url to return to current instance when reloading
292
291
  $("#current-instance").text(url);
293
292
  $("#current-instance").attr('href',url);
@@ -332,6 +331,8 @@ function monitor_instance(load,exec) {// {{{
332
331
  function monitor_instance_values(val) {// {{{
333
332
  var url = $('body').attr('current-instance');
334
333
  var rep = $('body').attr('current-repo');
334
+ var bas = $('body').attr('current-base');
335
+
335
336
  $.ajax({
336
337
  type: "GET",
337
338
  url: url + "/properties/values/" + val + "/",
@@ -517,6 +518,10 @@ function monitor_instance_state_change(notification) { //{{{
517
518
  if (notification == "ready" || notification == "stopped" || notification == "running") {
518
519
  $("#state button").removeAttr('disabled');
519
520
  }
521
+ // sometimes, out of sheer network routingness, stopping comes after stopped, which fucks the UI hard
522
+ // thus, we are having none of it
523
+ if (notification == 'stopping' && save['state'] == 'stopped')
524
+ return;
520
525
  if (notification != save['state']) {
521
526
  save['state'] = notification;
522
527
 
@@ -726,29 +731,31 @@ function save_svg() {// {{{
726
731
  }
727
732
  });
728
733
  }// }}}
729
- function set_testset(testset,exec) {// {{{
734
+ async function set_testset(testset,exec) {// {{{
730
735
  var url = $('body').attr('current-instance');
731
736
  suspended_monitoring = true;
732
737
 
733
- $.ajax({
734
- type: "GET",
735
- url: url + "/notifications/subscriptions/",
736
- success: function(res){
738
+ var promises = [];
739
+
740
+ promises.push(
741
+ $.ajax({
742
+ type: "GET",
743
+ url: url + "/notifications/subscriptions/",
744
+ error: report_failure
745
+ }).then(async function(res) {
737
746
  var rcount = 0;
738
747
  var values = $("subscriptions > subscription[url]",res);
739
748
  var vals = [];
740
749
  values.each(function(){
741
750
  vals.push($(this).attr('url'));
742
751
  });
743
- load_testset_handlers(url,testset,vals);
744
- },
745
- error: report_failure
746
- });
747
-
748
- load_testset_dataelements(url,testset);
749
- load_testset_attributes(url,testset);
750
- load_testset_endpoints(url,testset);
751
- load_testset_pos(url,testset);
752
+ await load_testset_handlers(url,testset,vals);
753
+ })
754
+ )
755
+ promises.push(load_testset_dataelements(url,testset));
756
+ promises.push(load_testset_attributes(url,testset));
757
+ promises.push(load_testset_endpoints(url,testset));
758
+ promises.push(load_testset_pos(url,testset));
752
759
 
753
760
  if ($("testset > transformation",testset).length > 0) {
754
761
  var ser = '';
@@ -756,20 +763,24 @@ function set_testset(testset,exec) {// {{{
756
763
  ser += $(this).serializeXML() + "\n";
757
764
  });
758
765
  var val = "<content>" + ser + "</content>";
759
- $.ajax({
760
- type: "PUT",
761
- url: url + "/properties/values/transformation",
762
- data: ({content: val}),
763
- success: function() {
764
- load_testset_des(url,testset);
765
- },
766
- error: report_failure
767
- });
766
+ promises.push(
767
+ $.ajax({
768
+ type: "PUT",
769
+ url: url + "/properties/values/transformation",
770
+ data: ({content: val}),
771
+ error: report_failure
772
+ }).then(async function(){
773
+ await load_testset_des(url,testset);
774
+ })
775
+ );
768
776
  } else {
769
- load_testset_des(url,testset);
777
+ promises.push(load_testset_des(url,testset));
770
778
  }
771
779
 
772
- load_testset_hw(url,testset);
780
+ promises.push(load_testset_hw(url,testset));
781
+ await Promise.all(promises);
782
+ suspended_monitoring = false;
783
+
773
784
  $.ajax({
774
785
  type: "GET",
775
786
  url: url + "/properties/values/state/",
@@ -781,8 +792,7 @@ function set_testset(testset,exec) {// {{{
781
792
  data: ({value: res}),
782
793
  error: report_failure,
783
794
  success: function(res){
784
- // use promises you filthy animal
785
- if (exec) setTimeout(start_instance,2000);
795
+ if (exec) start_instance();
786
796
  }
787
797
  });
788
798
  }
@@ -892,51 +902,56 @@ function load_modeltype() {// {{{
892
902
  });
893
903
  }// }}}
894
904
 
895
- function load_des(url,model) { //{{{
905
+ async function load_des(url,model) { //{{{
896
906
  model = model.replace(/<\?[^\?]+\?>/,'');
897
907
  var val = "<content>" + model + "</content>";
898
- $.ajax({
908
+ return $.ajax({
899
909
  type: "PUT",
900
910
  url: url + "/properties/values/description",
901
911
  data: ({content: val}),
902
912
  error: report_failure
903
913
  });
904
- } //}}}
914
+ } //}}}
905
915
 
906
- function load_testset_des(url,testset) {// {{{
916
+ async function load_testset_des(url,testset) {// {{{
907
917
  if ($("testset > description",testset).length == 0) { return; }
908
918
  var ser = '';
909
919
  $("testset > description > *",testset).each(function(){
910
920
  ser += $(this).serializeXML() + "\n";
911
921
  });
912
- load_des(url,ser);
922
+ return load_des(url,ser);
913
923
  } // }}}
914
- function load_testset_hw(url,testset) {// {{{
924
+ async function load_testset_hw(url,testset) {// {{{
925
+ var promises = [];
915
926
  $("testset > handlerwrapper",testset).each(function(){
916
927
  var val = $(this).text();
917
- $.ajax({
918
- type: "PUT",
919
- url: url + "/properties/values/handlerwrapper",
920
- data: ({value: val}),
921
- error: report_failure
922
- });
928
+ promises.push(
929
+ $.ajax({
930
+ type: "PUT",
931
+ url: url + "/properties/values/handlerwrapper",
932
+ data: ({value: val}),
933
+ error: report_failure
934
+ })
935
+ );
923
936
  });
937
+ return Promise.all(promises);
924
938
  } // }}}
925
- function load_testset_dataelements(url,testset) {// {{{
939
+ async function load_testset_dataelements(url,testset) {// {{{
926
940
  if ($("testset > dataelements",testset).length == 0) { return; }
927
941
  var ser = '';
928
942
  $("testset > dataelements > *",testset).each(function(){
929
943
  ser += $(this).serializeXML() + "\n";
930
944
  });
931
945
  var val = "<content>" + ser + "</content>";
932
- $.ajax({
946
+ return $.ajax({
933
947
  type: "PUT",
934
948
  url: url + "/properties/values/dataelements",
935
949
  data: ({content: val}),
936
950
  error: report_failure
937
951
  });
938
952
  }// }}}
939
- function load_testset_attributes(url,testset) {// {{{
953
+ async function load_testset_attributes(url,testset) {// {{{
954
+ var promises = [];
940
955
  if ($("testset > attributes",testset).length == 0) { return; }
941
956
  var ser = '';
942
957
  $.ajax({
@@ -950,37 +965,40 @@ function load_testset_attributes(url,testset) {// {{{
950
965
  ser += $(this).serializeXML() + "\n";
951
966
  });
952
967
  var val = "<content>" + ser + "</content>";
953
- $.ajax({
954
- type: "PUT",
955
- url: url + "/properties/values/attributes",
956
- data: ({content: val}),
957
- error: report_failure
958
- });
968
+ promises.push(
969
+ $.ajax({
970
+ type: "PUT",
971
+ url: url + "/properties/values/attributes",
972
+ data: ({content: val}),
973
+ error: report_failure
974
+ })
975
+ );
959
976
  }
960
977
  });
978
+ return Promise.all(promises);
961
979
  }// }}}
962
- function load_testset_endpoints(url,testset) {// {{{
980
+ async function load_testset_endpoints(url,testset) {// {{{
963
981
  if ($("testset > endpoints",testset).length == 0) { return; }
964
982
  var ser = '';
965
983
  $("testset > endpoints > *",testset).each(function(){
966
984
  ser += $(this).serializeXML() + "\n";
967
985
  });
968
986
  var val = "<content>" + ser + "</content>";
969
- $.ajax({
987
+ return $.ajax({
970
988
  type: "PUT",
971
989
  url: url + "/properties/values/endpoints/",
972
990
  data: ({content: val}),
973
991
  error: report_failure
974
992
  });
975
993
  }// }}}
976
- function load_testset_pos(url,testset) {// {{{
994
+ async function load_testset_pos(url,testset) {// {{{
977
995
  if ($("testset > positions",testset).length == 0) { return; }
978
996
  var ser = '';
979
997
  $("testset > positions > *",testset).each(function(){
980
998
  ser += $(this).serializeXML() + "\n";
981
999
  });
982
1000
  var val = "<content>" + ser + "</content>";
983
- $.ajax({
1001
+ return $.ajax({
984
1002
  type: "PUT",
985
1003
  url: url + "/properties/values/positions/",
986
1004
  data: ({content: val}),
@@ -988,8 +1006,9 @@ function load_testset_pos(url,testset) {// {{{
988
1006
  error: report_failure
989
1007
  });
990
1008
  }// }}}
991
- function load_testset_handlers(url,testset,vals) {// {{{
992
- $("testset > handlers > *",testset).each(function(){
1009
+ async function load_testset_handlers(url,testset,vals) {// {{{
1010
+ var promises = [];
1011
+ $("testset > handlers > *",testset).each(async function(){
993
1012
  var han = this;
994
1013
  var suburl = $(han).attr('url');
995
1014
  if ($.inArray(suburl,vals) == -1) {
@@ -998,13 +1017,16 @@ function load_testset_handlers(url,testset,vals) {// {{{
998
1017
  inp += "&topic=" + $(this).attr('topic');
999
1018
  inp += "&" + this.nodeName + "=" + $(this).text();
1000
1019
  });
1001
- $.ajax({
1002
- type: "POST",
1003
- url: url + "/notifications/subscriptions/",
1004
- data: inp
1005
- });
1020
+ promises.push(
1021
+ $.ajax({
1022
+ type: "POST",
1023
+ url: url + "/notifications/subscriptions/",
1024
+ data: inp
1025
+ })
1026
+ )
1006
1027
  }
1007
1028
  });
1029
+ return Promise.all(promises);
1008
1030
  }// }}}
1009
1031
 
1010
1032
  function format_visual_add(what,cls) {//{{{
@@ -1025,7 +1047,7 @@ function format_visual_remove(what,cls) {//{{{
1025
1047
  }//}}}
1026
1048
 
1027
1049
  function scroll_into_view(what) { //{{{
1028
- var tcontainer = $('#graphcolumn')[0];
1050
+ var tcontainer = $('#graphcanvas').parent()[0];
1029
1051
  if ($('g[element-id="' + what + '"]').length > 0) {
1030
1052
  var telement = $('g[element-id="' + what + '"]')[0].getBBox().y;
1031
1053
  if (tcontainer.scrollTop > telement) {
@@ -20,18 +20,22 @@ $(document).ready(function() {
20
20
  success: function(res){
21
21
  $("input[name=repo-url]").val(res['repo-url']);
22
22
  $("input[name=base-url]").val(res['base-url']);
23
+ $("body").attr('current-repo',res['repo-url']);
24
+ $("body").attr('current-base',res['base-url']);
23
25
  $("body").attr('current-testsets',res['testsets-url']);
24
26
  cockpit();
25
27
  },
26
28
  error: function(){
27
29
  $("body").attr('current-testsets','testsets/');
28
30
  if (location.protocol.match(/^file/)) {
29
- $("input[name=base-url]").val("http://localhost:" + $('body').data('base-port'));
30
- $("input[name=repo-url]").val("http://localhost:" + $('body').data('res-port'));
31
+ $("body").attr('current-repo',"http://localhost:" + $('body').data('res-port'));
32
+ $("body").attr('current-base',"http://localhost:" + $('body').data('base-port'));
31
33
  } else {
32
- $("input[name=base-url]").val(location.protocol + "//" + location.hostname + ":" + $('body').data('base-port'));
33
- $("input[name=repo-url]").val(location.protocol + "//" + location.hostname + ":" + $('body').data('res-port'));
34
+ $("body").attr('current-repo',location.protocol + "//" + location.hostname + ":" + $('body').data('res-port'));
35
+ $("body").attr('current-base',location.protocol + "//" + location.hostname + ":" + $('body').data('base-port'));
34
36
  }
37
+ $("input[name=repo-url]").val($("body").attr('current-repo'));
38
+ $("input[name=base-url]").val($("body").attr('current-base'));
35
39
  cockpit();
36
40
  }
37
41
  });
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cpee"
3
- s.version = "1.4.25"
3
+ s.version = "1.4.26"
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). If you just need workflow execution, without a rest/xmpp service exposing it, then use WEEL"
@@ -142,7 +142,7 @@ module CPEE
142
142
  Riddl::Parameter::Complex.new("wis","text/xml") do
143
143
  ins = XML::Smart::string('<instances/>')
144
144
  controller.sort{|a,b| b[0] <=> a[0] }.each do |k,v|
145
- ins.root.add('instance', v.info, 'uuid' => v.uuid, 'id' => k, 'state' => v.state, 'state_changed' => v.state_changed )
145
+ ins.root.add('instance', v.info, 'uuid' => v.uuid, 'id' => k, 'state' => v.state, 'state_changed' => v.state_changed ) unless v.nil?
146
146
  end
147
147
  ins.to_s
148
148
  end
@@ -137,7 +137,7 @@ module CPEE
137
137
  include Helpers
138
138
 
139
139
  def response
140
- cpee = @a[0]
140
+ cpee = @h['X_CPEE'] || @a[0]
141
141
  selfurl = @a[1]
142
142
  cblist = @a[2]
143
143
  status, res = Riddl::Client.new(@p[2].value).get
@@ -170,7 +170,7 @@ module CPEE
170
170
  include Helpers
171
171
 
172
172
  def response
173
- cpee = @a[0]
173
+ cpee = @h['X_CPEE'] || @a[0]
174
174
  behavior = @a[1] ? 'fork_ready' : @p[0].value
175
175
  data = @a[1] ? 0 : 1
176
176
  selfurl = @a[2]
@@ -203,7 +203,7 @@ module CPEE
203
203
  include Helpers
204
204
 
205
205
  def response
206
- cpee = @a[0]
206
+ cpee = @h['X_CPEE'] || @a[0]
207
207
  selfurl = @a[1]
208
208
  cblist = @a[2]
209
209
  instance = @p[1].value
@@ -224,7 +224,7 @@ module CPEE
224
224
 
225
225
  class ContinueTask < Riddl::Implementation #{{{
226
226
  def response
227
- cpee = @a[0]
227
+ cpee = @h['X_CPEE'] || @a[0]
228
228
  cblist = @a[1]
229
229
  topic = @p[1].value
230
230
  event_name = @p[2].value
@@ -0,0 +1 @@
1
+ f7c77861ac613eeac8fb9829c9a545a2
@@ -0,0 +1 @@
1
+ 2a24d172b1aeb05fe94fdc5e095dec32
@@ -0,0 +1,19 @@
1
+ <subscription xmlns="http://riddl.org/ns/common-patterns/notifications-producer/1.0" url="http://localhost:9299/">
2
+ <topic id="activity">
3
+ <event>calling</event>
4
+ <event>receiving</event>
5
+ <event>done</event>
6
+ </topic>
7
+ <topic id="dataelements">
8
+ <event>change</event>
9
+ </topic>
10
+ <topic id="endpoints">
11
+ <event>change</event>
12
+ </topic>
13
+ <topic id="attributes">
14
+ <event>change</event>
15
+ </topic>
16
+ <topic id="task">
17
+ <event>instantiation</event>
18
+ </topic>
19
+ </subscription>
@@ -0,0 +1,31 @@
1
+ <properties xmlns="http://riddl.org/ns/common-patterns/properties/1.0">
2
+ <attributes>
3
+ <uuid>c0638af8-c554-4953-bfab-e778c80f3661</uuid>
4
+ <info>Enter info here</info>
5
+ <modeltype>CPEE</modeltype>
6
+ <theme>default</theme>
7
+ </attributes>
8
+ <state changed="2019-03-22T15:05:20+01:00">ready</state>
9
+ <handlerwrapper>DefaultHandlerWrapper</handlerwrapper>
10
+ <positions/>
11
+ <dataelements/>
12
+ <endpoints>
13
+ <timeout>http://gruppe.wst.univie.ac.at/~mangler/services/timeout.php</timeout>
14
+ </endpoints>
15
+ <dsl/>
16
+ <dslx>
17
+ <description xmlns="http://cpee.org/ns/description/1.0"/>
18
+ </dslx>
19
+ <status>
20
+ <id>0</id>
21
+ <message>undefined</message>
22
+ </status>
23
+ <description>
24
+ <description xmlns="http://cpee.org/ns/description/1.0"/>
25
+ </description>
26
+ <transformation>
27
+ <description type="copy"/>
28
+ <dataelements type="none"/>
29
+ <endpoints type="none"/>
30
+ </transformation>
31
+ </properties>
@@ -0,0 +1 @@
1
+ f7c77861ac613eeac8fb9829c9a545a2
@@ -0,0 +1 @@
1
+ 2a24d172b1aeb05fe94fdc5e095dec32
@@ -0,0 +1,19 @@
1
+ <subscription xmlns="http://riddl.org/ns/common-patterns/notifications-producer/1.0" url="http://localhost:9299/">
2
+ <topic id="activity">
3
+ <event>calling</event>
4
+ <event>receiving</event>
5
+ <event>done</event>
6
+ </topic>
7
+ <topic id="dataelements">
8
+ <event>change</event>
9
+ </topic>
10
+ <topic id="endpoints">
11
+ <event>change</event>
12
+ </topic>
13
+ <topic id="attributes">
14
+ <event>change</event>
15
+ </topic>
16
+ <topic id="task">
17
+ <event>instantiation</event>
18
+ </topic>
19
+ </subscription>
@@ -0,0 +1,31 @@
1
+ <properties xmlns="http://riddl.org/ns/common-patterns/properties/1.0">
2
+ <attributes>
3
+ <uuid>8d15136d-89b0-4823-ba76-9ae329f213e7</uuid>
4
+ <info>Enter info here</info>
5
+ <modeltype>CPEE</modeltype>
6
+ <theme>default</theme>
7
+ </attributes>
8
+ <state changed="2019-03-25T19:57:35+01:00">ready</state>
9
+ <handlerwrapper>DefaultHandlerWrapper</handlerwrapper>
10
+ <positions/>
11
+ <dataelements/>
12
+ <endpoints>
13
+ <timeout>http://gruppe.wst.univie.ac.at/~mangler/services/timeout.php</timeout>
14
+ </endpoints>
15
+ <dsl/>
16
+ <dslx>
17
+ <description xmlns="http://cpee.org/ns/description/1.0"/>
18
+ </dslx>
19
+ <status>
20
+ <id>0</id>
21
+ <message>undefined</message>
22
+ </status>
23
+ <description>
24
+ <description xmlns="http://cpee.org/ns/description/1.0"/>
25
+ </description>
26
+ <transformation>
27
+ <description type="copy"/>
28
+ <dataelements type="none"/>
29
+ <endpoints type="none"/>
30
+ </transformation>
31
+ </properties>
@@ -0,0 +1 @@
1
+ f7c77861ac613eeac8fb9829c9a545a2
@@ -0,0 +1 @@
1
+ 2a24d172b1aeb05fe94fdc5e095dec32
@@ -0,0 +1,19 @@
1
+ <subscription xmlns="http://riddl.org/ns/common-patterns/notifications-producer/1.0" url="http://localhost:9299/">
2
+ <topic id="activity">
3
+ <event>calling</event>
4
+ <event>receiving</event>
5
+ <event>done</event>
6
+ </topic>
7
+ <topic id="dataelements">
8
+ <event>change</event>
9
+ </topic>
10
+ <topic id="endpoints">
11
+ <event>change</event>
12
+ </topic>
13
+ <topic id="attributes">
14
+ <event>change</event>
15
+ </topic>
16
+ <topic id="task">
17
+ <event>instantiation</event>
18
+ </topic>
19
+ </subscription>
@@ -0,0 +1,31 @@
1
+ <properties xmlns="http://riddl.org/ns/common-patterns/properties/1.0">
2
+ <attributes>
3
+ <uuid>7e9e36e0-f270-46c2-be9a-b81dd35c4fd1</uuid>
4
+ <info>Enter info here</info>
5
+ <modeltype>CPEE</modeltype>
6
+ <theme>default</theme>
7
+ </attributes>
8
+ <state changed="2019-03-25T20:04:36+01:00">ready</state>
9
+ <handlerwrapper>DefaultHandlerWrapper</handlerwrapper>
10
+ <positions/>
11
+ <dataelements/>
12
+ <endpoints>
13
+ <timeout>http://gruppe.wst.univie.ac.at/~mangler/services/timeout.php</timeout>
14
+ </endpoints>
15
+ <dsl/>
16
+ <dslx>
17
+ <description xmlns="http://cpee.org/ns/description/1.0"/>
18
+ </dslx>
19
+ <status>
20
+ <id>0</id>
21
+ <message>undefined</message>
22
+ </status>
23
+ <description>
24
+ <description xmlns="http://cpee.org/ns/description/1.0"/>
25
+ </description>
26
+ <transformation>
27
+ <description type="copy"/>
28
+ <dataelements type="none"/>
29
+ <endpoints type="none"/>
30
+ </transformation>
31
+ </properties>
@@ -0,0 +1 @@
1
+ f7c77861ac613eeac8fb9829c9a545a2
@@ -0,0 +1 @@
1
+ 2a24d172b1aeb05fe94fdc5e095dec32
@@ -0,0 +1,19 @@
1
+ <subscription xmlns="http://riddl.org/ns/common-patterns/notifications-producer/1.0" url="http://localhost:9299/">
2
+ <topic id="activity">
3
+ <event>calling</event>
4
+ <event>receiving</event>
5
+ <event>done</event>
6
+ </topic>
7
+ <topic id="dataelements">
8
+ <event>change</event>
9
+ </topic>
10
+ <topic id="endpoints">
11
+ <event>change</event>
12
+ </topic>
13
+ <topic id="attributes">
14
+ <event>change</event>
15
+ </topic>
16
+ <topic id="task">
17
+ <event>instantiation</event>
18
+ </topic>
19
+ </subscription>
@@ -0,0 +1,118 @@
1
+ <properties xmlns="http://riddl.org/ns/common-patterns/properties/1.0">
2
+ <attributes>
3
+ <uuid>dd2b893a-b45b-4c73-af7d-bc2a8fc7b752</uuid>
4
+ <info>Linear</info>
5
+ <modeltype>CPEE</modeltype>
6
+ <theme>default</theme>
7
+ </attributes>
8
+ <state changed="2019-03-25T20:19:31+01:00">finished</state>
9
+ <handlerwrapper>DefaultHandlerWrapper</handlerwrapper>
10
+ <positions/>
11
+ <dataelements>
12
+ <x>a2,a3,</x>
13
+ </dataelements>
14
+ <endpoints>
15
+ <timeout>http://gruppe.wst.univie.ac.at/~mangler/services/timeout.php</timeout>
16
+ </endpoints>
17
+ <dsl>call :a1, :timeout, parameters: { :label =&gt; "Step 1", :method =&gt; :post, :arguments =&gt; [⭐(:name =&gt; :timeout, :value =&gt; "2")] }, finalize: &lt;&lt;-END
18
+ data.x += \"a1,\"
19
+ END
20
+ call :a2, :timeout, parameters: { :label =&gt; "Step 2", :method =&gt; :post, :arguments =&gt; [⭐(:name =&gt; :timeout, :value =&gt; "4")] }, finalize: &lt;&lt;-END
21
+ data.x += \"a2,\"
22
+ END
23
+ call :a3, :timeout, parameters: { :label =&gt; "Step 3", :method =&gt; :post, :arguments =&gt; [⭐(:name =&gt; :timeout, :value =&gt; "4")] }, finalize: &lt;&lt;-END
24
+ data.x += \"a3,\"
25
+ END
26
+ </dsl>
27
+ <dslx>
28
+ <description xmlns="http://cpee.org/ns/description/1.0">
29
+ <!--{{{-->
30
+ <call id="a1" endpoint="timeout">
31
+ <parameters>
32
+ <!--{{{-->
33
+ <label>Step 1</label>
34
+ <method>:post</method>
35
+ <arguments>
36
+ <timeout>2</timeout>
37
+ </arguments>
38
+ </parameters>
39
+ <!--}}}-->
40
+ <finalize output="result">data.x += "a1,"</finalize>
41
+ </call>
42
+ <call id="a2" endpoint="timeout">
43
+ <parameters>
44
+ <!--{{{-->
45
+ <label>Step 2</label>
46
+ <method>:post</method>
47
+ <arguments>
48
+ <timeout>4</timeout>
49
+ </arguments>
50
+ </parameters>
51
+ <!--}}}-->
52
+ <finalize output="result">data.x += "a2,"</finalize>
53
+ </call>
54
+ <call id="a3" endpoint="timeout">
55
+ <parameters>
56
+ <!--{{{-->
57
+ <label>Step 3</label>
58
+ <method>:post</method>
59
+ <arguments>
60
+ <timeout>4</timeout>
61
+ </arguments>
62
+ </parameters>
63
+ <!--}}}-->
64
+ <finalize output="result">data.x += "a3,"</finalize>
65
+ </call>
66
+ </description>
67
+ </dslx>
68
+ <status>
69
+ <id>0</id>
70
+ <message>undefined</message>
71
+ </status>
72
+ <description>
73
+ <description xmlns="http://cpee.org/ns/description/1.0">
74
+ <!--{{{-->
75
+ <call id="a1" endpoint="timeout">
76
+ <parameters>
77
+ <!--{{{-->
78
+ <label>Step 1</label>
79
+ <method>:post</method>
80
+ <arguments>
81
+ <timeout>2</timeout>
82
+ </arguments>
83
+ </parameters>
84
+ <!--}}}-->
85
+ <finalize output="result">data.x += "a1,"</finalize>
86
+ </call>
87
+ <call id="a2" endpoint="timeout">
88
+ <parameters>
89
+ <!--{{{-->
90
+ <label>Step 2</label>
91
+ <method>:post</method>
92
+ <arguments>
93
+ <timeout>4</timeout>
94
+ </arguments>
95
+ </parameters>
96
+ <!--}}}-->
97
+ <finalize output="result">data.x += "a2,"</finalize>
98
+ </call>
99
+ <call id="a3" endpoint="timeout">
100
+ <parameters>
101
+ <!--{{{-->
102
+ <label>Step 3</label>
103
+ <method>:post</method>
104
+ <arguments>
105
+ <timeout>4</timeout>
106
+ </arguments>
107
+ </parameters>
108
+ <!--}}}-->
109
+ <finalize output="result">data.x += "a3,"</finalize>
110
+ </call>
111
+ </description>
112
+ </description>
113
+ <transformation>
114
+ <description type="copy"/>
115
+ <dataelements type="rest"/>
116
+ <endpoints type="rest"/>
117
+ </transformation>
118
+ </properties>
@@ -0,0 +1 @@
1
+ f7c77861ac613eeac8fb9829c9a545a2
@@ -0,0 +1 @@
1
+ 2a24d172b1aeb05fe94fdc5e095dec32
@@ -0,0 +1,19 @@
1
+ <subscription xmlns="http://riddl.org/ns/common-patterns/notifications-producer/1.0" url="http://localhost:9299/">
2
+ <topic id="activity">
3
+ <event>calling</event>
4
+ <event>receiving</event>
5
+ <event>done</event>
6
+ </topic>
7
+ <topic id="dataelements">
8
+ <event>change</event>
9
+ </topic>
10
+ <topic id="endpoints">
11
+ <event>change</event>
12
+ </topic>
13
+ <topic id="attributes">
14
+ <event>change</event>
15
+ </topic>
16
+ <topic id="task">
17
+ <event>instantiation</event>
18
+ </topic>
19
+ </subscription>
@@ -0,0 +1,156 @@
1
+ <properties xmlns="http://riddl.org/ns/common-patterns/properties/1.0">
2
+ <attributes>
3
+ <uuid>5db66753-618f-4006-80f2-fab5de741cd5</uuid>
4
+ <info>Enter info here</info>
5
+ <modeltype>CPEE</modeltype>
6
+ <theme>default</theme>
7
+ </attributes>
8
+ <state changed="2019-03-22T14:18:29+01:00">ready</state>
9
+ <handlerwrapper>DefaultHandlerWrapper</handlerwrapper>
10
+ <positions/>
11
+ <dataelements>
12
+ <persons>3</persons>
13
+ <card>Visa_12345</card>
14
+ <airline>null</airline>
15
+ <hotels>[]</hotels>
16
+ <from>Vienna</from>
17
+ <to>Prague</to>
18
+ <costs>0</costs>
19
+ </dataelements>
20
+ <endpoints>
21
+ <bookAir>http://gruppe.wst.univie.ac.at/~mangler/services/airline.php</bookAir>
22
+ <bookHotel>http://gruppe.wst.univie.ac.at/~mangler/services/hotel.php</bookHotel>
23
+ <approve>http://gruppe.wst.univie.ac.at/~mangler/services/approval.php</approve>
24
+ </endpoints>
25
+ <dsl>call :a1, :bookAir, parameters: { :label =&gt; "Book Airline", :method =&gt; :post, :arguments =&gt; [⭐(:name =&gt; :from, :value =&gt; "data.from"), ⭐(:name =&gt; :to, :value =&gt; "data.to"), ⭐(:name =&gt; :persons, :value =&gt; "data.persons")] }, finalize: &lt;&lt;-END
26
+ data.airline = result.value('id')
27
+ data.costs += result.value('costs').to_f
28
+ status.update 1, 'Hotel'
29
+ END
30
+ parallel do
31
+ loop pre_test("data.persons &gt; 0") do
32
+ parallel_branch data.persons do |p|
33
+ call :a2, :bookHotel, parameters: { :label =&gt; "Book Hotel", :method =&gt; :post, :arguments =&gt; [⭐(:name =&gt; :to, :value =&gt; "data.to")] }, finalize: &lt;&lt;-END
34
+ data.hotels &lt;&lt; result.value('id')
35
+ data.costs += result.value('costs').to_f
36
+ END
37
+ end
38
+ manipulate :a3, &lt;&lt;-END
39
+ data.persons -= 1
40
+ END
41
+ end
42
+ end
43
+ choose :inclusive do
44
+ alternative test("data.costs &gt; 700") do
45
+ call :a4, :approve, parameters: { :label =&gt; "Approve Hotel", :method =&gt; :post, :arguments =&gt; [⭐(:name =&gt; :costs, :value =&gt; "data.costs")] }
46
+ end
47
+ end
48
+ </dsl>
49
+ <dslx>
50
+ <description xmlns="http://cpee.org/ns/description/1.0">
51
+ <call id="a1" endpoint="bookAir">
52
+ <parameters>
53
+ <label>Book Airline</label>
54
+ <method>:post</method>
55
+ <arguments>
56
+ <from>data.from</from>
57
+ <to>data.to</to>
58
+ <persons>data.persons</persons>
59
+ </arguments>
60
+ </parameters>
61
+ <finalize output="result">data.airline = result.value('id')
62
+ data.costs += result.value('costs').to_f
63
+ status.update 1, 'Hotel'</finalize>
64
+ </call>
65
+ <parallel>
66
+ <loop mode="pre_test" condition="data.persons &gt; 0">
67
+ <parallel_branch pass="data.persons" local="p">
68
+ <call id="a2" endpoint="bookHotel">
69
+ <parameters>
70
+ <label>Book Hotel</label>
71
+ <method>:post</method>
72
+ <arguments>
73
+ <to>data.to</to>
74
+ </arguments>
75
+ </parameters>
76
+ <finalize output="result">data.hotels &lt;&lt; result.value('id')
77
+ data.costs += result.value('costs').to_f</finalize>
78
+ </call>
79
+ </parallel_branch>
80
+ <manipulate id="a3">data.persons -= 1</manipulate>
81
+ </loop>
82
+ </parallel>
83
+ <choose mode="inclusive">
84
+ <alternative condition="data.costs &gt; 700">
85
+ <call id="a4" endpoint="approve">
86
+ <parameters>
87
+ <label>Approve Hotel</label>
88
+ <method>:post</method>
89
+ <arguments>
90
+ <costs>data.costs</costs>
91
+ </arguments>
92
+ </parameters>
93
+ </call>
94
+ </alternative>
95
+ </choose>
96
+ </description>
97
+ </dslx>
98
+ <status>
99
+ <id>0</id>
100
+ <message>undefined</message>
101
+ </status>
102
+ <description>
103
+ <description xmlns="http://cpee.org/ns/description/1.0">
104
+ <call id="a1" endpoint="bookAir">
105
+ <parameters>
106
+ <label>Book Airline</label>
107
+ <method>:post</method>
108
+ <arguments>
109
+ <from>data.from</from>
110
+ <to>data.to</to>
111
+ <persons>data.persons</persons>
112
+ </arguments>
113
+ </parameters>
114
+ <finalize output="result">data.airline = result.value('id')
115
+ data.costs += result.value('costs').to_f
116
+ status.update 1, 'Hotel'</finalize>
117
+ </call>
118
+ <parallel>
119
+ <loop mode="pre_test" condition="data.persons &gt; 0">
120
+ <parallel_branch pass="data.persons" local="p">
121
+ <call id="a2" endpoint="bookHotel">
122
+ <parameters>
123
+ <label>Book Hotel</label>
124
+ <method>:post</method>
125
+ <arguments>
126
+ <to>data.to</to>
127
+ </arguments>
128
+ </parameters>
129
+ <finalize output="result">data.hotels &lt;&lt; result.value('id')
130
+ data.costs += result.value('costs').to_f</finalize>
131
+ </call>
132
+ </parallel_branch>
133
+ <manipulate id="a3">data.persons -= 1</manipulate>
134
+ </loop>
135
+ </parallel>
136
+ <choose mode="inclusive">
137
+ <alternative condition="data.costs &gt; 700">
138
+ <call id="a4" endpoint="approve">
139
+ <parameters>
140
+ <label>Approve Hotel</label>
141
+ <method>:post</method>
142
+ <arguments>
143
+ <costs>data.costs</costs>
144
+ </arguments>
145
+ </parameters>
146
+ </call>
147
+ </alternative>
148
+ </choose>
149
+ </description>
150
+ </description>
151
+ <transformation>
152
+ <description type="copy"/>
153
+ <dataelements type="rest"/>
154
+ <endpoints type="rest"/>
155
+ </transformation>
156
+ </properties>
@@ -1 +1 @@
1
- 9783
1
+ 1876
data/tools/cpee CHANGED
@@ -49,7 +49,7 @@ ARGV.options { |opt|
49
49
  }
50
50
  if (ARGV.length == 0) ||
51
51
  (ARGV.length == 1 && ARGV[0] != 'ui') ||
52
- (ARGV.length == 2 && %w(abandon delete! cpui new).include?(ARGV[1])) ||
52
+ (ARGV.length == 2 && !(%w(abandon delete! cpui new).include?(ARGV[0]))) ||
53
53
  (ARGV.length == 3 && ARGV[0] != 'archive') ||
54
54
  (ARGV.length > 3)
55
55
  puts ARGV.options
@@ -76,30 +76,39 @@ elsif command == 'inst'
76
76
  puts 'Directory already exists.'
77
77
  end
78
78
  elsif command == 'archive'
79
- res = Typhoeus.get(File.join(p2,'/'))
80
- if res.success?
81
- if res.headers['Content-Type'] =~ /^(text|application)\/xml/
82
- XML::Smart.string(res.response_body) do |doc|
83
- if doc.root.qname.to_s == "instances"
84
- doc.root.children.each do |i|
85
- if ["finished","abandoned"].include?(i.attributes['state'])
86
- prop = Typhoeus.get(File.join(p2,i.attributes['id'],'properties','/'))
87
- if prop.success?
88
- File.write(File.join(p1,i.attributes['uuid'] + '.xml'),prop.response_body) if prop.headers['Content-Type'] =~ /^(text|application)\/xml/
89
- Typhoeus.delete(File.join(p2,i.attributes['id'],'/'))
79
+ base = File.dirname(p2)
80
+ names = []
81
+ if File.basename(p2) =~ /(\d+)-(\d+)/
82
+ names = ($1.to_i..$2.to_i).to_a
83
+ else
84
+ names << File.basename(p2)
85
+ end
86
+ names.each do |name|
87
+ res = Typhoeus.get(File.join(base,name.to_s,'/'))
88
+ if res.success?
89
+ if res.headers['Content-Type'] =~ /^(text|application)\/xml/
90
+ XML::Smart.string(res.response_body) do |doc|
91
+ if doc.root.qname.to_s == "instances"
92
+ doc.root.children.each do |i|
93
+ if ["finished","abandoned"].include?(i.attributes['state'])
94
+ prop = Typhoeus.get(File.join(base,name.to_s,i.attributes['id'],'properties','/'))
95
+ if prop.success?
96
+ File.write(File.join(p1,i.attributes['uuid'] + '.xml'),prop.response_body) if prop.headers['Content-Type'] =~ /^(text|application)\/xml/
97
+ Typhoeus.delete(File.join(base,name.to_s,i.attributes['id'],'/'))
98
+ end
90
99
  end
91
100
  end
92
- end
93
- elsif doc.root.qname.to_s == "info"
94
- prop = Typhoeus.get(File.join(p2,'properties','/'))
95
- if prop.success?
96
- xprop = XML::Smart::string(prop.response_body)
97
- xprop.register_namespace 'p', 'http://riddl.org/ns/common-patterns/properties/1.0'
98
- if ["finished","abandoned"].include?(xprop.find("string(/p:properties/p:state)"))
99
- uuid = xprop.find("string(/p:properties/p:attributes/p:uuid)")
100
- id = File.basename(p2)
101
- File.write(File.join(p1,uuid + '.xml'),prop.response_body) if prop.headers['Content-Type'] =~ /^(text|application)\/xml/
102
- Typhoeus.delete(File.join(p2,'/'))
101
+ elsif doc.root.qname.to_s == "info"
102
+ prop = Typhoeus.get(File.join(base,name.to_s,'properties','/'))
103
+ if prop.success?
104
+ xprop = XML::Smart::string(prop.response_body)
105
+ xprop.register_namespace 'p', 'http://riddl.org/ns/common-patterns/properties/1.0'
106
+ if ["finished","abandoned"].include?(xprop.find("string(/p:properties/p:state)"))
107
+ uuid = xprop.find("string(/p:properties/p:attributes/p:uuid)")
108
+ id = name.to_s
109
+ File.write(File.join(p1,uuid + '.xml'),prop.response_body) if prop.headers['Content-Type'] =~ /^(text|application)\/xml/
110
+ Typhoeus.delete(File.join(base,name.to_s,'/'))
111
+ end
103
112
  end
104
113
  end
105
114
  end
@@ -107,13 +116,24 @@ elsif command == 'archive'
107
116
  end
108
117
  end
109
118
  elsif command == 'abandon'
110
- res = Typhoeus.get(File.join(p1,'properties','values','state','/'))
111
- if res.success?
112
- case res.response_body
113
- when "ready", "stopped" then
114
- Typhoeus.put(File.join(p1,'properties','values','state','/'), headers: {'Content-Type' => 'application/x-www-form-urlencoded'}, body: "value=abandoned")
115
- when "running" then
116
- Typhoeus.put(File.join(p1,'properties','values','state','/'), headers: {'Content-Type' => 'application/x-www-form-urlencoded'}, body: "value=stopped")
119
+ base = File.dirname(p1)
120
+ names = []
121
+ if File.basename(p1) =~ /(\d+)-(\d+)/
122
+ names = ($1.to_i..$2.to_i).to_a
123
+ else
124
+ names << File.basename(p1)
125
+ end
126
+ names.each do |name|
127
+ res = Typhoeus.get(File.join(base,name.to_s,'properties','values','state','/'))
128
+ if res.success?
129
+ case res.response_body
130
+ when "ready", "stopped" then
131
+ Typhoeus.put(File.join(base,name.to_s,'properties','values','state','/'), headers: {'Content-Type' => 'application/x-www-form-urlencoded'}, body: "value=abandoned")
132
+ when "running" then
133
+ Typhoeus.put(File.join(base,name.to_s,'properties','values','state','/'), headers: {'Content-Type' => 'application/x-www-form-urlencoded'}, body: "value=stopped")
134
+ sleep 1
135
+ Typhoeus.put(File.join(base,name.to_s,'properties','values','state','/'), headers: {'Content-Type' => 'application/x-www-form-urlencoded'}, body: "value=abandoned")
136
+ end
117
137
  end
118
138
  end
119
139
  elsif command == 'delete!'
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: 1.4.25
4
+ version: 1.4.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen eTM Mangler
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: tools
13
13
  cert_chain: []
14
- date: 2019-03-21 00:00:00.000000000 Z
14
+ date: 2019-04-08 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: riddl
@@ -343,6 +343,22 @@ files:
343
343
  - server/instances/10/notifications/logging/producer-secret
344
344
  - server/instances/10/notifications/logging/subscription.xml
345
345
  - server/instances/10/properties.xml
346
+ - server/instances/100/notifications/logging/consumer-secret
347
+ - server/instances/100/notifications/logging/producer-secret
348
+ - server/instances/100/notifications/logging/subscription.xml
349
+ - server/instances/100/properties.xml
350
+ - server/instances/101/notifications/logging/consumer-secret
351
+ - server/instances/101/notifications/logging/producer-secret
352
+ - server/instances/101/notifications/logging/subscription.xml
353
+ - server/instances/101/properties.xml
354
+ - server/instances/102/notifications/logging/consumer-secret
355
+ - server/instances/102/notifications/logging/producer-secret
356
+ - server/instances/102/notifications/logging/subscription.xml
357
+ - server/instances/102/properties.xml
358
+ - server/instances/103/notifications/logging/consumer-secret
359
+ - server/instances/103/notifications/logging/producer-secret
360
+ - server/instances/103/notifications/logging/subscription.xml
361
+ - server/instances/103/properties.xml
346
362
  - server/instances/11/notifications/logging/consumer-secret
347
363
  - server/instances/11/notifications/logging/producer-secret
348
364
  - server/instances/11/notifications/logging/subscription.xml
@@ -862,6 +878,10 @@ files:
862
878
  - server/instances/98/notifications/logging/producer-secret
863
879
  - server/instances/98/notifications/logging/subscription.xml
864
880
  - server/instances/98/properties.xml
881
+ - server/instances/99/notifications/logging/consumer-secret
882
+ - server/instances/99/notifications/logging/producer-secret
883
+ - server/instances/99/notifications/logging/subscription.xml
884
+ - server/instances/99/properties.xml
865
885
  - server/resources/empty_dslx.xml
866
886
  - server/resources/notifications/logging/consumer-secret
867
887
  - server/resources/notifications/logging/producer-secret