cpee 1.4.29 → 1.4.30

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: 69167cf7972c5d782e186b52c9bc447b01ca491c3c711a483d6abf50249d9f46
4
- data.tar.gz: e8354ec5bdd70105d979acf467de51d3368b050add7e86e3e6bf848c789bb89e
3
+ metadata.gz: 3af489d577c4dea65d15939ddba88e8f1ed6782583aa641ca534a38fe83ef310
4
+ data.tar.gz: 05ee4ea40caf21bd323f999dfb7b089312f7bf7502be0b4576b91cf838e16658
5
5
  SHA512:
6
- metadata.gz: 046a33c964cccb7ea6ec83b52abcc2ac9ae44b648c9a45ebf0b8922666493b001df6a6191b0c4cee00720e837cf14d6b171104362aa517223bac393dff4a6079
7
- data.tar.gz: d4ff60f1b32c7df91303848dac2dc410f02f672dd3c4ee4c7459d82a40cb6b74c7b6a8e5fdfa0b00f0670ec545c8682fdfe62000f49e5b87ee9dd7dd6658f6ea
6
+ metadata.gz: a836d6cba5336a23f026fb7a46946f85fa7cace8c3832bdebece0459e683138f7bc6056737eb84cd1231f26d59323500dac1fa8e7aa60b55d17dc65984e1f2d4
7
+ data.tar.gz: 998e48a4b3d21a7afbde101282ed0b3153fad3741a675a604b309dc1c7d53961348f6255e7bf179c719ec68d88bc0d5b54e422a1395539cfc28f7da906622652
@@ -28,6 +28,7 @@
28
28
 
29
29
  #usage {
30
30
  line-height: 2em;
31
+ margin-top: 0.5em;
31
32
  margin-left: 2em;
32
33
  margin-right: 1em;
33
34
  }
@@ -180,7 +180,16 @@
180
180
  <tbody class='exe'>
181
181
  <tr>
182
182
  <td>State:</td>
183
- <td id='state'></td>
183
+ <td id='state'>
184
+ <span id="state_text"></span>
185
+ <span> ⇒ </span>
186
+ <button name="state_start" title='start'>Start</button>
187
+ <button name="state_stop" title='stop'>Stop</button>
188
+ <span> / </span>
189
+ <button name="state_sim" title='simulate'>Sim</button>
190
+ <span> / </span>
191
+ <button name="state_abandon" title='abandon'>Abandon</button>
192
+ </td>
184
193
  </tr>
185
194
  <tr>
186
195
  <td>Continue:</td>
@@ -75,6 +75,10 @@ function cockpit() { //{{{
75
75
  $("button[name=loadmodeltype]").click(function(e){new CustomMenu(e).menu($('#modeltypes'),load_modeltype, $("button[name=loadmodeltype]")); });
76
76
  $("button[name=savetestset]").click(function(){ save_testset(); });
77
77
  $("button[name=savesvg]").click(function(){ save_svg(); });
78
+ $("button[name=state_start]").click(function(){ $(this).attr("disabled","disabled");start_instance(); });
79
+ $("button[name=state_stop]").click(function(){ $(this).attr("disabled","disabled");stop_instance(); });
80
+ $("button[name=state_simulate]").click(function(){ $(this).attr("disabled","disabled");sim_instance(); });
81
+ $("button[name=state_abandon]").click(function(){ aba_instance(); });
78
82
  $("input[name=votecontinue]").click(check_subscription);
79
83
  $("input[name=testsetfile]").change(load_testsetfile_after);
80
84
  $("input[name=modelfile]").change(load_modelfile_after);
@@ -543,9 +547,6 @@ function monitor_instance_state_change(notification) { //{{{
543
547
  if (notification != save['state']) {
544
548
  save['state'] = notification;
545
549
 
546
- var ctv = $("#state");
547
- ctv.empty();
548
-
549
550
  if (notification == "stopped") {
550
551
  monitor_instance_pos();
551
552
  }
@@ -555,9 +556,15 @@ function monitor_instance_state_change(notification) { //{{{
555
556
 
556
557
  var but = "";
557
558
  if (notification == "ready" || notification == "stopped") {
558
- but = " ⇒ <button onclick='$(this).attr(\"disabled\",\"disabled\");start_instance();' title='start'>⏵</button> / <button onclick='$(this).attr(\"disabled\",\"disabled\");sim_instance();' title='simulate'>🎜</button> / <button onclick='aba_instance();' title='abandon'>⛌</button>";
559
+ $("button[name=state_start]").show();
560
+ $("button[name=state_stop]").hide();
561
+ $("button[name=state_sim]").show();
562
+ $("button[name=state_abandon]").show();
559
563
  } else if (notification == "running") {
560
- but = " ⇒ <button onclick='$(this).attr(\"disabled\",\"disabled\");stop_instance();' title='stop'>⏸</button>";
564
+ $("button[name=state_start]").hide();
565
+ $("button[name=state_stop]").show();
566
+ $("button[name=state_sim]").hide();
567
+ $("button[name=state_abandon]").hide();
561
568
  }
562
569
 
563
570
  // disable all input, also check themes
@@ -573,7 +580,7 @@ function monitor_instance_state_change(notification) { //{{{
573
580
  $('#parameters .tabbehind button').show();
574
581
  }
575
582
 
576
- ctv.append(notification + but);
583
+ $("#state_text").text(notification);
577
584
  }
578
585
  } //}}}
579
586
  function monitor_instance_pos_change(notification) {// {{{
@@ -62,7 +62,40 @@
62
62
  <div id="trackfull">
63
63
  <div id='graphcolumn'>
64
64
  <div id="usage">
65
- <span id="title"></span> | <span id='state'></span>
65
+ <span id="title"></span> | <span id='state'>
66
+ <span id="state_text"></span>
67
+ <span> ⇒ </span>
68
+ <button name="state_start" title='start'>
69
+ <svg viewBox="0 -1.5 7 12" width="10" height="16">
70
+ <path
71
+ style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
72
+ d="M 1.1000001e-6,1.0403124e-6 5.0000006e-7,10.583335 6.6145841,5.2916677 Z"/>
73
+ </svg>
74
+ </button>
75
+ <button name="state_stop" title='stop'>
76
+ <svg viewBox="0 -1.5 7 12" width="10" height="16">
77
+ <path
78
+ style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
79
+ d="m 3.9687505,1.3375769 1e-6,7.9374995 2.645832,1e-6 V 1.3375772 Z m -3.96875,0 v 7.9375005 h 2.645833 V 1.3375769 Z"/>
80
+ </svg>
81
+ </button>
82
+ <span> / </span>
83
+ <button name="state_sim" title='simulate'>
84
+ <svg viewBox="0 -1.5 7 12" width="10" height="16">
85
+ <path
86
+ style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
87
+ d="M 0,7.0741552 1.598154,6.8788136 q 0.144277,1.0115903 0.58266,1.4859901 0.443932,0.474402 1.193067,0.474402 0.793528,0 1.193066,-0.418589 0.405089,-0.4255654 0.405089,-0.990661 0,-0.362777 -0.172025,-0.6139303 Q 4.633538,6.5578953 4.211802,6.3695302 3.923247,6.2439536 2.896654,5.9230353 1.575957,5.5114228 1.04324,4.911445 0.294105,4.0672905 0.294105,2.8533821 q 0,-0.7813662 0.349596,-1.4580852 Q 0.998846,0.7116014 1.659195,0.3558006 2.325092,0 3.262898,0 4.794462,0 5.565794,0.8441546 6.342674,1.6883092 6.381518,3.0975591 L 4.73897,3.1882531 Q 4.633538,2.3999106 4.283941,2.0580629 3.939894,1.7092386 3.246251,1.7092386 q -0.71584,0 -1.120927,0.3697537 -0.260811,0.2372006 -0.260811,0.6348602 0,0.3627771 0.244164,0.6209071 0.31075,0.3278947 1.509366,0.6836954 1.198616,0.3558008 1.770178,0.7395073 0.577111,0.3767302 0.898962,1.0394962 0.327399,0.6557896 0.327399,1.6255215 0,0.8790367 -0.388439,1.6464517 -0.388442,0.767412 -1.098732,1.1441413 -0.710291,0.369755 -1.770178,0.369755 -1.542663,0 -2.369485,-0.8929903 Q 0.160924,8.7903717 0,7.0741552 Z"/>
88
+ </svg>
89
+ </button>
90
+ <span> / </span>
91
+ <button name="state_abandon" title='abandon'>
92
+ <svg viewBox="0 -1.5 7 12" width="10" height="16">
93
+ <path
94
+ style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
95
+ d="m 5e-7,1.3229172 h 2.645833 V 5.0000007e-7 h 1.322917 V 1.3229172 h 2.645833 V 2.6458339 H 5e-7 Z m 2.645833,2.6458332 v 3.96875 l 1.322917,10e-8 v -3.96875 z M 5e-7,10.583333 l 6.614584,1e-6 -1e-6,-6.6145835 h -1.322916 v 5.2916667 h -3.96875 V 3.9687505 H 5e-7 Z"/>
96
+ </svg>
97
+ </button>
98
+ </span>
66
99
  </div>
67
100
  <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>
68
101
  </div>
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cpee"
3
- s.version = "1.4.29"
3
+ s.version = "1.4.30"
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"
@@ -26,5 +26,6 @@ Gem::Specification.new do |s|
26
26
  s.add_runtime_dependency 'savon', '~> 2'
27
27
  s.add_runtime_dependency 'highline', '~> 1.6'
28
28
  s.add_runtime_dependency 'json', '~>2.1'
29
+ s.add_runtime_dependency 'opca', '~>0', '>= 0.13'
29
30
  s.add_runtime_dependency 'rubyzip', '~>1.2'
30
31
  end
@@ -12,6 +12,8 @@
12
12
  # CPEE (file COPYING in the main directory). If not, see
13
13
  # <http://www.gnu.org/licenses/>.
14
14
 
15
+ require 'opcua/client'
16
+
15
17
  class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
16
18
  def self::inform_state_change(arguments,newstate) # {{{
17
19
  controller = arguments[0]
@@ -51,54 +53,105 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
51
53
  @sensors = parameters[:sensors]
52
54
  @controller.notify("activity/calling", :instance => @controller.instance, :instance_uuid => @controller.uuid, :label => @label, :instance_name => @controller.info, :activity => @handler_position, :passthrough => passthrough, :endpoint => @handler_endpoint, :parameters => parameters, :timestamp => Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"), :attributes => @controller.attributes_translated)
53
55
  if passthrough.to_s.empty?
54
- params = []
55
- callback = Digest::MD5.hexdigest(Kernel::rand().to_s)
56
- (parameters[:arguments] || []).each do |s|
57
- if s.respond_to?(:mimetype)
58
- params << Riddl::Parameter::Complex.new(s.name.to_s,v.mimetype,v.value)
59
- else
60
- if s.name.to_s =~ /__$/
61
- params << Riddl::Parameter::Simple.new(s.name.to_s.chop.chop,CPEE::ValueHelper::generate(s.value),:query)
56
+ if @handler_endpoint.start_with?('opc.tcp')
57
+ if @handler_endpoint =~ /^opc.tcp.read:\/\/([^\/]+)\/(\d+)\/(.+)/
58
+ nid = $3 == $3.to_i.to_s ? $3.to_i : $3
59
+ ns = $2
60
+ url = 'opc.tcp://' + $1
61
+ client = OPCUA::Client.new(url)
62
+ if (node = client.get ns.to_i, nid)
63
+ result = node.value
62
64
  else
63
- params << Riddl::Parameter::Simple.new(s.name.to_s,CPEE::ValueHelper::generate(s.value))
65
+ raise 'invalid nodeid'
66
+ end
67
+ client.disconnect
68
+ callback [Riddl::Parameter::Simple.new('value',result)], {}
69
+ elsif @handler_endpoint =~ /^opc.tcp.write:\/\/([^\/]+)\/(\d+)\/([^\?]+)(\?value=(.*))?/
70
+ nid = $3 == $3.to_i.to_s ? $3.to_i : $3
71
+ ns = $2
72
+ par = $5
73
+ url = 'opc.tcp://' + $1
74
+ client = OPCUA::Client.new(url)
75
+ if (node = client.get ns.to_i, nid)
76
+ (parameters[:arguments] || [→(:name => 'value', :value => par)] || []).each do |ele|
77
+ what = CPEE::ValueHelper::parse(ele.value)
78
+ node.value = what
79
+ result = what
80
+ end
81
+ else
82
+ raise 'invalid nodeid'
83
+ end
84
+ client.disconnect
85
+ callback [Riddl::Parameter::Simple.new('value',result)], {}
86
+ elsif @handler_endpoint =~ /^opc.tcp.execute:\/\/([^\/]+)\/(\d+)\/([^\?]+)(\?value=(.*))?/
87
+ nid = $3 == $3.to_i.to_s ? $3.to_i : $3
88
+ ns = $2
89
+ par = $5
90
+ url = 'opc.tcp://' + $1
91
+ client = OPCUA::Client.new(url)
92
+ if (node = client.get ns.to_i, nid)
93
+ params = []
94
+ (parameters[:arguments] || []).each do |ele|
95
+ what = CPEE::ValueHelper::parse(ele.value)
96
+ params << what
97
+ end
98
+ result = node.call *params
99
+ else
100
+ raise 'invalid nodeid'
101
+ end
102
+ client.disconnect
103
+ callback [Riddl::Parameter::Simple.new('value',result)], {}
104
+ end
105
+ else
106
+ params = []
107
+ callback = Digest::MD5.hexdigest(Kernel::rand().to_s)
108
+ (parameters[:arguments] || []).each do |s|
109
+ if s.respond_to?(:mimetype)
110
+ params << Riddl::Parameter::Complex.new(s.name.to_s,v.mimetype,v.value)
111
+ else
112
+ if s.name.to_s =~ /__$/
113
+ params << Riddl::Parameter::Simple.new(s.name.to_s.chop.chop,CPEE::ValueHelper::generate(s.value),:query)
114
+ else
115
+ params << Riddl::Parameter::Simple.new(s.name.to_s,CPEE::ValueHelper::generate(s.value))
116
+ end
64
117
  end
65
118
  end
66
- end
67
119
 
68
- params << Riddl::Header.new("CPEE-BASE",@controller.base_url)
69
- params << Riddl::Header.new("CPEE-INSTANCE",@controller.instance)
70
- params << Riddl::Header.new("CPEE-INSTANCE-URL",@controller.instance_url)
71
- params << Riddl::Header.new("CPEE-INSTANCE-UUID",@controller.uuid)
72
- params << Riddl::Header.new("CPEE-CALLBACK",@controller.instance_url + '/callbacks/' + callback)
73
- params << Riddl::Header.new("CPEE-CALLBACK-ID",callback)
74
- params << Riddl::Header.new("CPEE-ACTIVITY",@handler_position)
75
- params << Riddl::Header.new("CPEE-LABEL",parameters[:label]||'')
76
- @controller.attributes.each do |key,value|
77
- params << Riddl::Header.new("CPEE-ATTR-#{key.to_s.gsub(/_/,'-')}",value)
78
- end
120
+ params << Riddl::Header.new("CPEE-BASE",@controller.base_url)
121
+ params << Riddl::Header.new("CPEE-INSTANCE",@controller.instance)
122
+ params << Riddl::Header.new("CPEE-INSTANCE-URL",@controller.instance_url)
123
+ params << Riddl::Header.new("CPEE-INSTANCE-UUID",@controller.uuid)
124
+ params << Riddl::Header.new("CPEE-CALLBACK",@controller.instance_url + '/callbacks/' + callback)
125
+ params << Riddl::Header.new("CPEE-CALLBACK-ID",callback)
126
+ params << Riddl::Header.new("CPEE-ACTIVITY",@handler_position)
127
+ params << Riddl::Header.new("CPEE-LABEL",parameters[:label]||'')
128
+ @controller.attributes.each do |key,value|
129
+ params << Riddl::Header.new("CPEE-ATTR-#{key.to_s.gsub(/_/,'-')}",value)
130
+ end
79
131
 
80
- tendpoint = @handler_endpoint.sub(/^http(s)?-(get|put|post|delete):/,'http\\1:')
81
- type = $2 || parameters[:method] || 'post'
132
+ tendpoint = @handler_endpoint.sub(/^http(s)?-(get|put|post|delete):/,'http\\1:')
133
+ type = $2 || parameters[:method] || 'post'
82
134
 
83
- client = Riddl::Client.new(tendpoint)
135
+ client = Riddl::Client.new(tendpoint)
84
136
 
85
- @controller.callbacks[callback] = CPEE::Callback.new("callback activity: #{@handler_position}",self,:callback,nil,nil,:http)
86
- @handler_passthrough = callback
137
+ @controller.callbacks[callback] = CPEE::Callback.new("callback activity: #{@handler_position}",self,:callback,nil,nil,:http)
138
+ @handler_passthrough = callback
87
139
 
88
- status, result, headers = client.request type => params
140
+ status, result, headers = client.request type => params
89
141
 
90
- raise "Could not #{type || 'post'} #{tendpoint} - status: #{status}: #{result&.dig(0)&.value&.read}" if status < 200 || status >= 300
142
+ raise "Could not #{type || 'post'} #{tendpoint} - status: #{status}: #{result&.dig(0)&.value&.read}" if status < 200 || status >= 300
91
143
 
92
- if headers['CPEE_INSTANTIATION']
93
- @controller.notify("task/instantiation", :instance => @controller.instance, :label => @label, :instance_name => @controller.info, :instance_uuid => @controller.uuid, :activity => @handler_position, :endpoint => @handler_endpoint, :received => CPEE::ValueHelper.parse(headers['CPEE_INSTANTIATION']), :timestamp => Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"), :attributes => @controller.attributes_translated)
94
- end
95
- if headers['CPEE_CALLBACK'] && headers['CPEE_CALLBACK'] == 'true' && result.any?
96
- headers['CPEE_UPDATE'] = true
97
- callback result, headers
98
- elsif headers['CPEE_CALLBACK'] && headers['CPEE_CALLBACK'] == 'true' && result.empty?
99
- # do nothing, later on things will happend
100
- else
101
- callback result
144
+ if headers['CPEE_INSTANTIATION']
145
+ @controller.notify("task/instantiation", :instance => @controller.instance, :label => @label, :instance_name => @controller.info, :instance_uuid => @controller.uuid, :activity => @handler_position, :endpoint => @handler_endpoint, :received => CPEE::ValueHelper.parse(headers['CPEE_INSTANTIATION']), :timestamp => Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z"), :attributes => @controller.attributes_translated)
146
+ end
147
+ if headers['CPEE_CALLBACK'] && headers['CPEE_CALLBACK'] == 'true' && result.any?
148
+ headers['CPEE_UPDATE'] = true
149
+ callback result, headers
150
+ elsif headers['CPEE_CALLBACK'] && headers['CPEE_CALLBACK'] == 'true' && result.empty?
151
+ # do nothing, later on things will happend
152
+ else
153
+ callback result
154
+ end
102
155
  end
103
156
  else
104
157
  @controller.callbacks[passthrough] = CPEE::Callback.new("callback activity: #{@handler_position}",self,:callback,nil,nil,:http)
@@ -445,7 +445,7 @@
445
445
  <xsl:param name="myspace"/>
446
446
  <xsl:if test="text()">
447
447
  <xsl:for-each select="str:tokenize(text(), '&#x0A;')">
448
- <xsl:value-of select="concat('&#x0A;',concat(str:padding($myspace+$myspacemultiplier+$myspacemultiplier),str:replace(str:replace(string(.),'\','\\'),'&quot;','\&quot;')))" />
448
+ <xsl:value-of select="concat('&#x0A;',concat(str:padding($myspace+$myspacemultiplier+$myspacemultiplier),str:replace(str:replace(str:replace(string(.),'\','\\'),'&quot;','\&quot;'),'#','\#')))" />
449
449
  </xsl:for-each>
450
450
  <xsl:call-template name="print-newline"/>
451
451
  <xsl:call-template name="print-space">
@@ -474,7 +474,7 @@
474
474
  </xsl:otherwise>
475
475
  </xsl:choose>
476
476
  <xsl:for-each select="str:tokenize(text(), '&#x0A;')">
477
- <xsl:value-of select="concat('&#x0A;',concat(str:padding($myspace+$myspacemultiplier+$myspacemultiplier),str:replace(str:replace(string(.),'\','\\'),'&quot;','\&quot;')))" />
477
+ <xsl:value-of select="concat('&#x0A;',concat(str:padding($myspace+$myspacemultiplier+$myspacemultiplier),str:replace(str:replace(str:replace(string(.),'\','\\'),'&quot;','\&quot;'),'#','\#')))" />
478
478
  </xsl:for-each>
479
479
  <xsl:call-template name="print-newline"/>
480
480
  <xsl:call-template name="print-space">
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.29
4
+ version: 1.4.30
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-06-18 00:00:00.000000000 Z
14
+ date: 2019-07-12 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: riddl
@@ -83,6 +83,26 @@ dependencies:
83
83
  - - "~>"
84
84
  - !ruby/object:Gem::Version
85
85
  version: '2.1'
86
+ - !ruby/object:Gem::Dependency
87
+ name: opca
88
+ requirement: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - "~>"
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0.13'
96
+ type: :runtime
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0.13'
86
106
  - !ruby/object:Gem::Dependency
87
107
  name: rubyzip
88
108
  requirement: !ruby/object:Gem::Requirement