cpee 2.0 → 2.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97540332122030fa3cc477f5f47bcff6ddbd5f0977a530075c9c901cfdd2d9b1
4
- data.tar.gz: 0a7e55a6145144ab94b304e202b0d550489dd3868b8fa0cf015bf0427c358c50
3
+ metadata.gz: ceb3ebb10b51f80ab5279f9738c67e1b916c06f10b7f30352ba8c2152172fbbd
4
+ data.tar.gz: 48b7e67c715b8ed0a9e5e4fa4cd90786f5cf2096fc1362c0d679c729e0576816
5
5
  SHA512:
6
- metadata.gz: b69f463b07d093c897b2d1b39bbb089b8a9e6e32cd2ae58632111c72b3d9e0c1945f31e67059f524ba2d1b822e84e75b3cbd8150c6849ae52779ac95950aef32
7
- data.tar.gz: ab3ab54ff2bb5956ab00fd1b5bbc1b76258fdd6e3f2b96754131d90ad29a44a36072799e2898b61b1840d87ee238d342dde66e8f94d9f265101355f24878d457
6
+ metadata.gz: 9b1340826747baad2c00ed578b84a87d20d3d6ffb31d7a6cf6f856ba8366686d6c8044faebd819168d36488dc690956ed2c44e38b999f81f6edf83fac86a5c4e
7
+ data.tar.gz: b5744e76d4fa37304555a1fb1678a6181e1bda425e4a5007419214c514af3c78f4bee52adb5623f76a2a84509c7c28ebd2a8ca299b1b1b1c175dec45f047a3d9
@@ -784,7 +784,7 @@ function save_testsetfile() {// {{{
784
784
  var def = new $.Deferred();
785
785
  def.done(function(name,testset) {
786
786
  var ct = new Date();
787
- $('#savetestsetfile').attr('download',name + '_' + ct.strftime("%Y-%m-%dT%H%M%S%z") + '.xml');
787
+ $('#savetestsetfile').attr('download',name + '.xml');
788
788
  $('#savetestsetfile').attr('href','data:application/xml;charset=utf-8;base64,' + $B64(testset.serializePrettyXML()));
789
789
  document.getElementById('savetestsetfile').click();
790
790
  });
@@ -811,6 +811,11 @@ function get_testset(deferred) {// {{{
811
811
  $('testset > dslx',testset).remove();
812
812
  testset.append($X('<transformation xmlns="http://cpee.org/ns/properties/2.0"><description type="copy"/><dataelements type="none"/><endpoints type="none"/></transformation>'));
813
813
  var name = $('testset > attributes > info',testset).text();
814
+ $('[xmlns]',testset).each((idx,ele) => {
815
+ if (ele.parentNode.namespaceURI == ele.getAttribute('xmlns')) {
816
+ ele.removeAttribute('xmlns');
817
+ }
818
+ });
814
819
  deferred.resolve(name,testset);
815
820
  },
816
821
  error: function() { deferred.reject(); report_failure(); }
@@ -33,6 +33,7 @@
33
33
  <script type="text/javascript" src="/js_libs/underscore.min.js"></script>
34
34
  <script type="text/javascript" src="/js_libs/jquery.caret.min.js"></script>
35
35
  <script type="text/javascript" src="/js_libs/jquery.cookie.js"></script>
36
+
36
37
  <script type="text/javascript" src="/js_libs/relaxngui.js"></script>
37
38
 
38
39
  <script type="text/javascript" src="/js_libs/ui.js"></script>
@@ -1,15 +1,6 @@
1
1
  <testset>
2
2
  <positions xmlns="http://cpee.org/ns/properties/2.0"/>
3
3
  <handlerwrapper xmlns="http://cpee.org/ns/properties/2.0">DefaultHandlerWrapper</handlerwrapper>
4
- <handlers>
5
- <handler url="http://localhost:9299/">
6
- <events topic="activity">calling,receiving,done</events>
7
- <events topic="dataelements">change</events>
8
- <events topic="endpoints">change</events>
9
- <events topic="attributes">change</events>
10
- <events topic="task">instantiation</events>
11
- </handler>
12
- </handlers>
13
4
  <dataelements xmlns="http://cpee.org/ns/properties/2.0">
14
5
  <persons>3</persons>
15
6
  <card>Visa_12345</card>
@@ -74,4 +74,4 @@
74
74
  <dataelements type="rest"/>
75
75
  <endpoints type="rest"/>
76
76
  </transformation>
77
- </testset>
77
+ </testset>
@@ -74,4 +74,4 @@
74
74
  <dataelements type="rest"/>
75
75
  <endpoints type="rest"/>
76
76
  </transformation>
77
- </testset>
77
+ </testset>
@@ -74,4 +74,4 @@
74
74
  <dataelements type="rest"/>
75
75
  <endpoints type="rest"/>
76
76
  </transformation>
77
- </testset>
77
+ </testset>
@@ -114,4 +114,4 @@
114
114
  </element>
115
115
  </element>
116
116
  </element>
117
- </element>
117
+ </element>
@@ -114,4 +114,4 @@
114
114
  </element>
115
115
  </element>
116
116
  </element>
117
- </element>
117
+ </element>
@@ -114,4 +114,4 @@
114
114
  </element>
115
115
  </element>
116
116
  </element>
117
- </element>
117
+ </element>
@@ -114,4 +114,4 @@
114
114
  </element>
115
115
  </element>
116
116
  </element>
117
- </element>
117
+ </element>
@@ -114,4 +114,4 @@
114
114
  </element>
115
115
  </element>
116
116
  </element>
117
- </element>
117
+ </element>
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cpee"
3
- s.version = "2.0"
3
+ s.version = "2.0.6"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3.0"
6
6
  s.summary = "Preliminary release of cloud process execution engine (cpee.org). If you just need workflow execution, without a rest service exposing it, then use WEEL."
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
14
14
  s.executables = ['cpee']
15
15
  s.test_files = Dir['{test/*,test/*/tc_*.rb}']
16
16
 
17
- s.required_ruby_version = '>=2.4.0'
17
+ s.required_ruby_version = '>=2.7.0'
18
18
 
19
19
  s.authors = ['Juergen eTM Mangler','Ralph Vigne','Gerhard Stuermer']
20
20
 
@@ -204,6 +204,20 @@ module CPEE
204
204
  p = path(e)
205
205
  multi.zadd(File.join(instance, File.dirname(p)), i, File.basename(p))
206
206
  end
207
+ Dir[File.join(opts[:notifications_init],'*','subscription.xml')].each do |f|
208
+ XML::Smart::open_unprotected(f) do |doc|
209
+ doc.register_namespace 'np', 'http://riddl.org/ns/common-patterns/notifications-producer/2.0'
210
+ key = File.basename(File.dirname(f))
211
+ url = doc.find('string(/np:subscription/@url)')
212
+ multi.sadd("instance:#{id}/handlers",key)
213
+ multi.set("instance:#{id}/handlers/#{key}/url",url)
214
+ doc.find('/np:subscription/np:topic/*').each do |e|
215
+ c = File.join(e.parent.attributes['id'],e.qname.name,e.text)
216
+ multi.sadd("instance:#{id}/handlers/#{key}",c)
217
+ multi.sadd("instance:#{id}/handlers/#{c}",key)
218
+ end
219
+ end rescue nil # all the ones that are not ok, are ignored
220
+ end
207
221
  multi.set(File.join(instance, 'attributes', 'uuid'), SecureRandom.uuid)
208
222
  multi.zadd(File.join(instance, 'attributes'), -2, 'uuid')
209
223
  multi.set(File.join(instance, 'attributes', 'info'), name)
@@ -245,12 +259,13 @@ module CPEE
245
259
  opts = @a[0]
246
260
  redis = opts[:redis]
247
261
  id = @r[0].to_i
248
- unless redis.exists("instance:#{id}/state")
262
+ unless redis.exists?("instance:#{id}/state")
249
263
  @status = 404
250
264
  return
251
265
  end
266
+ empt = redis.keys("instance:#{id}/*").to_a
252
267
  redis.multi do |multi|
253
- multi.del redis.keys("instance:#{id}/*").to_a
268
+ multi.del empt
254
269
  multi.zrem 'instances', id
255
270
  end
256
271
  end
@@ -146,7 +146,9 @@ module CPEE
146
146
  end
147
147
 
148
148
  if (node = doc.find('/p:properties/p:positions')).any?
149
- CPEE::Properties::PatchPositions::set id, opts, node.first.dump
149
+ if node.first.find('p:*').any?
150
+ CPEE::Properties::PatchPositions::set id, opts, node.first.dump
151
+ end
150
152
  end
151
153
 
152
154
  if (node = doc.find('/p:properties/p:state')).any?
@@ -185,7 +187,9 @@ module CPEE
185
187
  end
186
188
 
187
189
  if (node = doc.find('/p:properties/p:positions')).any?
188
- CPEE::Properties::PutPositions::set id, opts, node.first.dump
190
+ if node.first.find('p:*').any?
191
+ CPEE::Properties::PutPositions::set id, opts, node.first.dump
192
+ end
189
193
  end
190
194
 
191
195
  if (node = doc.find('/p:properties/p:state')).any?
@@ -211,13 +215,16 @@ module CPEE
211
215
  case state
212
216
  when 'running'
213
217
  CPEE::Persistence::write_instance id, opts
214
- pid = Kernel.spawn(exe , :out => exe + '.out', :err => exe + '.err')
215
- File.write(exe + '.pid',pid)
218
+ pid = Kernel.spawn(exe , :pgroup => true, :in => '/dev/null', :out => exe + '.out', :err => exe + '.err')
216
219
  Process.detach pid
220
+ File.write(exe + '.pid',pid)
217
221
  when 'stopping'
218
222
  pid = File.read(exe + '.pid') rescue nil
219
- if pid
223
+ if pid && (Process.kill(0, pid.to_i) rescue false)
220
224
  Process.kill('HUP', pid.to_i) rescue nil
225
+ else
226
+ File.unlink(exe + '.pid') rescue nil
227
+ PutState::set id, opts, 'stopped'
221
228
  end
222
229
  else
223
230
  ### Most probably this is never needed. Lets see.
@@ -3,7 +3,11 @@ require 'yaml'
3
3
  opts = YAML::load_file(File.join(__dir__,'opts.yaml'))
4
4
  opts[:pidf] = __FILE__ + '.pid'
5
5
  opts[:pid] = Process.pid
6
- require_relative '../../../lib/cpee/controller'
6
+ if File.exist? '../../../lib/cpee/controller'
7
+ require_relative '../../../lib/cpee/controller'
8
+ else
9
+ require 'cpee/controller'
10
+ end
7
11
 
8
12
  Dir[File.join(opts[:global_handlerwrappers],'*.rb')].each do |h|
9
13
  require h
@@ -22,8 +26,8 @@ File.write(opts[:pidf],opts[:pid])
22
26
  Signal.trap(sig) do
23
27
  puts "Caught #{sig}!"
24
28
  controller.stop
25
- File.unlink(opts[:pidf])
26
29
  end
27
30
  end
28
31
 
29
32
  controller.start
33
+ File.unlink(opts[:pidf])
@@ -507,11 +507,11 @@
507
507
  <xsl:text>nil</xsl:text>
508
508
  </xsl:when>
509
509
  <xsl:when test="child::node()[not(self::text())]">
510
- <!-- FUUUU, there is probably much more TODO -->
510
+ <!-- FUUUU, there is probably much more TODO. Updated Matthias und Juergen, we tested for ing-opcua/execute -->
511
511
  <xsl:choose>
512
- <xsl:when test="child::*/child::* and count(child::*[not(name()=name(../child::*[1]))])=0">
512
+ <xsl:when test="child::* and name(child::*)=concat(name(.),'_item') and count(child::*[not(name()=name(../child::*[1]))])=0">
513
513
  <xsl:text>"[ </xsl:text>
514
- <xsl:apply-templates select="*" mode="JSON"/>
514
+ <xsl:apply-templates select="*" mode="JSONArrayItem"/>
515
515
  <xsl:text>]"</xsl:text>
516
516
  </xsl:when>
517
517
  <xsl:otherwise>
@@ -655,6 +655,15 @@
655
655
  <xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>
656
656
  </xsl:choose>
657
657
  </xsl:template>
658
+ <xsl:template match="*" mode="JSONArrayItem">
659
+ <xsl:call-template name="JSONProperties">
660
+ <xsl:with-param name="parent" select="'Yes'"></xsl:with-param>
661
+ </xsl:call-template>
662
+ <xsl:choose>
663
+ <xsl:when test="following-sibling::*">, </xsl:when>
664
+ <xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>
665
+ </xsl:choose>
666
+ </xsl:template>
658
667
 
659
668
  <!-- JSON Object Properties -->
660
669
  <xsl:template name="JSONProperties">
data/tools/cpee CHANGED
@@ -30,7 +30,7 @@ end
30
30
  ARGV.options { |opt|
31
31
  opt.summary_indent = ' ' * 2
32
32
  opt.summary_width = 15
33
- opt.banner = "Usage:\n#{opt.summary_indent}#{File.basename($0)} [options] ui | cpui DIR | new DIR | archive DIR URL | start URL | delete! URL | abandon URL\n"
33
+ opt.banner = "Usage:\n#{opt.summary_indent}#{File.basename($0)} [options] convert | ui | cpui DIR | new DIR | archive DIR URL | start URL | delete! URL | abandon URL\n"
34
34
  opt.on("Options:")
35
35
  opt.on("--help", "-h", "This text") { puts opt; exit }
36
36
  opt.on("")
@@ -47,10 +47,12 @@ ARGV.options { |opt|
47
47
  opt.on(wrap("[cpui DIR] scaffolds a sample html client. New versions might require manual merging if you changed something."))
48
48
  opt.on("")
49
49
  opt.on(wrap("[ui] starts a simple static web server with the ui on http://localhost:8080. Use [cpui DIR] if you want stuff in apache or nginx."))
50
+ opt.on("")
51
+ opt.on(wrap("[convert] converts all testsets in the current directory to cpee2"))
50
52
  opt.parse!
51
53
  }
52
54
  if (ARGV.length == 0) ||
53
- (ARGV.length == 1 && ARGV[0] != 'ui') ||
55
+ (ARGV.length == 1 && !(%w(ui convert).include?(ARGV[0]))) ||
54
56
  (ARGV.length == 2 && !(%w(abandon start delete! cpui new).include?(ARGV[0]))) ||
55
57
  (ARGV.length == 3 && ARGV[0] != 'archive') ||
56
58
  (ARGV.length > 3)
@@ -99,6 +101,29 @@ elsif command == 'cpui'
99
101
  puts "Directory already exists."
100
102
  end
101
103
  end
104
+ elsif command == 'convert'
105
+ Dir['*.xml'].each do |f|
106
+ XML::Smart.modify(f) do |doc|
107
+ doc.register_namespace 'd', 'http://cpee.org/ns/description/1.0'
108
+ doc.register_namespace 'p', 'http://riddl.org/ns/common-patterns/properties/1.0'
109
+ doc.register_namespace 'x', 'http://cpee.org/ns/properties/2.0'
110
+ if doc.root.qname.name == 'testset'
111
+ doc.root.namespaces[nil] = 'http://cpee.org/ns/properties/2.0'
112
+ doc.root.namespace = nil
113
+
114
+ doc.find('//x:start_url').each do |e|
115
+ e.text = 'https://centurio.work/flow-test/start/url/'
116
+ end rescue nil
117
+ doc.find('//x:start_git').each do |e|
118
+ e.text = 'https://centurio.work/flow-test/start/git/'
119
+ end rescue nil
120
+
121
+ doc.find('//p:*').each do |e|
122
+ e.namespaces.delete_all!
123
+ end rescue nil
124
+ end
125
+ end
126
+ end
102
127
  elsif command == 'archive'
103
128
  p2 = File.join(p2,'*') if p2 =~ /([a-zA-Z]|\/)$/
104
129
  base = File.dirname(p2)
@@ -139,11 +164,12 @@ elsif command == 'archive'
139
164
  prop = Typhoeus.get(File.join(base,name.to_s,'properties','/'))
140
165
  if prop.success?
141
166
  xprop = XML::Smart::string(prop.response_body)
142
- xprop.register_namespace 'p', 'http://riddl.org/ns/common-patterns/properties/1.0'
167
+ xprop.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
143
168
  if ["finished","abandoned"].include?(xprop.find("string(/p:properties/p:state)"))
144
169
  uuid = xprop.find("string(/p:properties/p:attributes/p:uuid)")
145
170
  id = name.to_s
146
171
  File.write(File.join(p1,uuid + '.xml'),prop.response_body) if prop.headers['Content-Type'] =~ /^(text|application)\/xml/
172
+ p File.join(base,name.to_s,'/')
147
173
  Typhoeus.delete(File.join(base,name.to_s,'/'))
148
174
  end
149
175
  end
@@ -220,6 +246,7 @@ elsif command == 'delete!'
220
246
  elsif command == 'new'
221
247
  if !File.exists?(p1)
222
248
  FileUtils.cp_r("#{curpath}/server/",p1)
249
+ FileUtils.cp_r("#{curpath}/archive/",p1)
223
250
  FileUtils.mkdir("#{p1}/instances") rescue nil
224
251
  FileUtils.mkdir("#{p1}/resources") rescue nil
225
252
  FileUtils.mkdir("#{p1}/handlerwrappers") rescue nil
@@ -230,9 +257,6 @@ elsif command == 'new'
230
257
  cont.gsub!(/{CPEEWORKINGDIR}/,"#{File.realpath(p1)}")
231
258
  cont.gsub!(/{CPEESERVER}/,"#{File.realpath(p1)}/server")
232
259
  File.write("#{p1}/#{nam}",cont)
233
- p f
234
- p nam
235
- p "#{p1}/#{nam}"
236
260
  end
237
261
  else
238
262
  puts 'Directory already exists.'
@@ -1,7 +1,19 @@
1
- <subscription xmlns="http://riddl.org/ns/common-patterns/notifications-producer/1.0" url="http://localhost:9300/log">
1
+ <subscription xmlns="http://riddl.org/ns/common-patterns/notifications-producer/2.0" url="http://localhost:9299/">
2
2
  <topic id="activity">
3
3
  <event>calling</event>
4
4
  <event>receiving</event>
5
5
  <event>done</event>
6
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>
7
19
  </subscription>
@@ -2,40 +2,41 @@
2
2
  <!--
3
3
  This file is part of CPEE.
4
4
 
5
- CPEE is free software: you can redistribute it and/or modify it under the terms
6
- of the GNU General Public License as published by the Free Software Foundation,
7
- either version 3 of the License, or (at your option) any later version.
5
+ CPEE is free software: you can redistribute it and/or modify it under the
6
+ terms of the GNU General Public License as published by the Free Software
7
+ Foundation, either version 3 of the License, or (at your option) any later
8
+ version.
8
9
 
9
10
  CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
10
11
  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11
12
  PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
13
 
13
14
  You should have received a copy of the GNU General Public License along with
14
- CPEE (file COPYING in the main directory). If not, see
15
+ CPEE (file COPYING in the main directory). If not, see
15
16
  <http://www.gnu.org/licenses/>.
16
17
  -->
17
18
 
18
- <properties xmlns="http://riddl.org/ns/common-patterns/properties/1.0">
19
- <attributes>
20
- <info/>
21
- <modeltype>CPEE</modeltype>
22
- <theme>default</theme>
23
- </attributes>
24
- <state>ready</state>
19
+ <properties xmlns="http://cpee.org/ns/properties/2.0">
20
+ <state changed="1970-01-01T00:00:00+00:00">ready</state>
21
+ <status>
22
+ <id>0</id>
23
+ <message>undefined</message>
24
+ </status>
25
25
  <handlerwrapper>DefaultHandlerWrapper</handlerwrapper>
26
26
  <positions/>
27
27
  <dataelements/>
28
28
  <endpoints>
29
29
  <timeout>http://gruppe.wst.univie.ac.at/~mangler/services/timeout.php</timeout>
30
30
  </endpoints>
31
+ <attributes>
32
+ <info/>
33
+ <modeltype>CPEE</modeltype>
34
+ <theme>preset</theme>
35
+ </attributes>
31
36
  <dsl/>
32
37
  <dslx>
33
38
  <description xmlns="http://cpee.org/ns/description/1.0"/>
34
39
  </dslx>
35
- <status>
36
- <id>0</id>
37
- <message>undefined</message>
38
- </status>
39
40
  <description>
40
41
  <description xmlns="http://cpee.org/ns/description/1.0"/>
41
42
  </description>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cpee
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.0'
4
+ version: 2.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen eTM Mangler
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: tools
12
12
  cert_chain: []
13
- date: 2020-10-05 00:00:00.000000000 Z
13
+ date: 2020-10-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: riddl
@@ -508,9 +508,6 @@ files:
508
508
  - server/routing/persist.rb
509
509
  - server/server.rb
510
510
  - tools/cpee
511
- - tools/instantiation/instantiation
512
- - tools/server/resources/notifications/logging/consumer-secret
513
- - tools/server/resources/notifications/logging/producer-secret
514
511
  - tools/server/resources/notifications/logging/subscription.xml
515
512
  - tools/server/resources/properties.init
516
513
  - tools/server/server.rb
@@ -526,7 +523,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
526
523
  requirements:
527
524
  - - ">="
528
525
  - !ruby/object:Gem::Version
529
- version: 2.4.0
526
+ version: 2.7.0
530
527
  required_rubygems_version: !ruby/object:Gem::Requirement
531
528
  requirements:
532
529
  - - ">="
@@ -1,23 +0,0 @@
1
- #!/usr/bin/ruby
2
- require 'rubygems'
3
- require 'cpee/instantiation'
4
-
5
- options = {
6
- :host => 'localhost',
7
- :port => 9296,
8
- :secure => false
9
- # :secure_options => {
10
- # :private_key_file => '',
11
- # :cert_chain_file => '',
12
- # :verify_peer => false
13
- # }
14
- }
15
-
16
- Riddl::Server.new(CPEE::Instantiation::SERVER, options) do
17
- accessible_description true
18
- cross_site_xhr true
19
-
20
- @riddl_opts[:cpee] ||= 'http://localhost:8298/'
21
-
22
- use CPEE::Instantiation::implementation(@riddl_opts)
23
- end.loop!
@@ -1 +0,0 @@
1
- f7c77861ac613eeac8fb9829c9a545a2
@@ -1 +0,0 @@
1
- 2a24d172b1aeb05fe94fdc5e095dec32