|
@@ -1,7 +1,7 @@
|
|
|
"""
|
|
|
Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
|
|
|
|
|
|
-Date: Thu Jun 7 16:08:00 2018
|
|
|
+Date: Thu Jun 7 16:50:26 2018
|
|
|
|
|
|
Model author: Yentl Van Tendeloo
|
|
|
Model name: MvK Server
|
|
@@ -1798,6 +1798,11 @@ class Modelverse(RuntimeClassBase):
|
|
|
_initialized_behaviour_operations_16.setTrigger(None)
|
|
|
_initialized_behaviour_operations_16.setGuard(self._initialized_behaviour_operations_16_guard)
|
|
|
self.states["/initialized/behaviour/operations"].addTransition(_initialized_behaviour_operations_16)
|
|
|
+ _initialized_behaviour_operations_17 = Transition(self, self.states["/initialized/behaviour/operations"], [self.states["/initialized/behaviour/wait_for_action/history"]])
|
|
|
+ _initialized_behaviour_operations_17.setAction(self._initialized_behaviour_operations_17_exec)
|
|
|
+ _initialized_behaviour_operations_17.setTrigger(None)
|
|
|
+ _initialized_behaviour_operations_17.setGuard(self._initialized_behaviour_operations_17_guard)
|
|
|
+ self.states["/initialized/behaviour/operations"].addTransition(_initialized_behaviour_operations_17)
|
|
|
|
|
|
# transition /initialized/behaviour/wait_for_action
|
|
|
_initialized_behaviour_wait_for_action_0 = Transition(self, self.states["/initialized/behaviour/wait_for_action"], [self.states["/initialized/behaviour/wait_for_action/history"]])
|
|
@@ -2188,83 +2193,89 @@ class Modelverse(RuntimeClassBase):
|
|
|
return self.expect_response_partial('Attribute exists: ', pop=False)
|
|
|
|
|
|
def _initialized_behaviour_operations_4_exec(self, parameters):
|
|
|
- self.raiseInternalEvent(Event("exception", None, ['ElementExists', self.split_response(self.responses.pop(0))[0]]))
|
|
|
+ self.raiseInternalEvent(Event("exception", None, ['UnknownM3', self.split_response(self.responses.pop(0))[0]]))
|
|
|
|
|
|
def _initialized_behaviour_operations_4_guard(self, parameters):
|
|
|
- return self.expect_response_partial('Element exists: ', pop=False)
|
|
|
+ return self.expect_response_partial('Type is not typed by formalisms/SimpleClassDiagrams: ', pop=False)
|
|
|
|
|
|
def _initialized_behaviour_operations_5_exec(self, parameters):
|
|
|
- self.raiseInternalEvent(Event("exception", None, ['ReadPermissionDenied', self.split_response(self.responses.pop(0))[0]]))
|
|
|
+ self.raiseInternalEvent(Event("exception", None, ['ElementExists', self.split_response(self.responses.pop(0))[0]]))
|
|
|
|
|
|
def _initialized_behaviour_operations_5_guard(self, parameters):
|
|
|
- return self.expect_response_partial('Read permission denied to: ', pop=False)
|
|
|
+ return self.expect_response_partial('Element exists: ', pop=False)
|
|
|
|
|
|
def _initialized_behaviour_operations_6_exec(self, parameters):
|
|
|
- self.raiseInternalEvent(Event("exception", None, ['WritePermissionDenied', self.split_response(self.responses.pop(0))[0]]))
|
|
|
+ self.raiseInternalEvent(Event("exception", None, ['ReadPermissionDenied', self.split_response(self.responses.pop(0))[0]]))
|
|
|
|
|
|
def _initialized_behaviour_operations_6_guard(self, parameters):
|
|
|
- return self.expect_response_partial('Write permission denied to: ', pop=False)
|
|
|
+ return self.expect_response_partial('Read permission denied to: ', pop=False)
|
|
|
|
|
|
def _initialized_behaviour_operations_7_exec(self, parameters):
|
|
|
- self.raiseInternalEvent(Event("exception", None, ['WritePermissionDenied', self.current_model]))
|
|
|
+ self.raiseInternalEvent(Event("exception", None, ['WritePermissionDenied', self.split_response(self.responses.pop(0))[0]]))
|
|
|
|
|
|
def _initialized_behaviour_operations_7_guard(self, parameters):
|
|
|
- return self.expect_response('Write permission denied', pop=True)
|
|
|
+ return self.expect_response_partial('Write permission denied to: ', pop=False)
|
|
|
|
|
|
def _initialized_behaviour_operations_8_exec(self, parameters):
|
|
|
- self.raiseInternalEvent(Event("exception", None, ['ExecutePermissionDenied', self.split_response(self.responses.pop(0))[0]]))
|
|
|
+ self.raiseInternalEvent(Event("exception", None, ['WritePermissionDenied', self.current_model]))
|
|
|
|
|
|
def _initialized_behaviour_operations_8_guard(self, parameters):
|
|
|
- return self.expect_response_partial('Execute permission denied to: ', pop=False)
|
|
|
+ return self.expect_response('Write permission denied', pop=True)
|
|
|
|
|
|
def _initialized_behaviour_operations_9_exec(self, parameters):
|
|
|
- self.raiseInternalEvent(Event("exception", None, ['GroupPermissionDenied', self.split_response(self.responses.pop(0))[0]]))
|
|
|
+ self.raiseInternalEvent(Event("exception", None, ['ExecutePermissionDenied', self.split_response(self.responses.pop(0))[0]]))
|
|
|
|
|
|
def _initialized_behaviour_operations_9_guard(self, parameters):
|
|
|
- return self.expect_response_partial('Group permission denied to: ', pop=False)
|
|
|
+ return self.expect_response_partial('Execute permission denied to: ', pop=False)
|
|
|
|
|
|
def _initialized_behaviour_operations_10_exec(self, parameters):
|
|
|
- self.raiseInternalEvent(Event("exception", None, ['UserPermissionDenied', self.split_response(self.responses.pop(0))[0]]))
|
|
|
+ self.raiseInternalEvent(Event("exception", None, ['GroupPermissionDenied', self.split_response(self.responses.pop(0))[0]]))
|
|
|
|
|
|
def _initialized_behaviour_operations_10_guard(self, parameters):
|
|
|
- return self.expect_response_partial('User permission denied to: ', pop=False)
|
|
|
+ return self.expect_response_partial('Group permission denied to: ', pop=False)
|
|
|
|
|
|
def _initialized_behaviour_operations_11_exec(self, parameters):
|
|
|
- self.raiseInternalEvent(Event("exception", None, ['AdminPermissionDenied', 'Admin permissions are required for this operation!']))
|
|
|
+ self.raiseInternalEvent(Event("exception", None, ['UserPermissionDenied', self.split_response(self.responses.pop(0))[0]]))
|
|
|
|
|
|
def _initialized_behaviour_operations_11_guard(self, parameters):
|
|
|
- return self.expect_response_partial('Admin permission denied', pop=True)
|
|
|
+ return self.expect_response_partial('User permission denied to: ', pop=False)
|
|
|
|
|
|
def _initialized_behaviour_operations_12_exec(self, parameters):
|
|
|
- self.raiseInternalEvent(Event("exception", None, ['InterfaceMismatch', self.split_response(self.responses.pop(0))[0]]))
|
|
|
+ self.raiseInternalEvent(Event("exception", None, ['AdminPermissionDenied', 'Admin permissions are required for this operation!']))
|
|
|
|
|
|
def _initialized_behaviour_operations_12_guard(self, parameters):
|
|
|
- return self.expect_response_partial('Incorrect format: ', pop=False)
|
|
|
+ return self.expect_response_partial('Admin permission denied', pop=True)
|
|
|
|
|
|
def _initialized_behaviour_operations_13_exec(self, parameters):
|
|
|
- self.raiseInternalEvent(Event("exception", None, ['UnknownElement', self.split_response(self.responses.pop(0))[0]]))
|
|
|
+ self.raiseInternalEvent(Event("exception", None, ['InterfaceMismatch', self.split_response(self.responses.pop(0))[0]]))
|
|
|
|
|
|
def _initialized_behaviour_operations_13_guard(self, parameters):
|
|
|
- return self.expect_response_partial('Element not found: ', pop=False)
|
|
|
+ return self.expect_response_partial('Incorrect format: ', pop=False)
|
|
|
|
|
|
def _initialized_behaviour_operations_14_exec(self, parameters):
|
|
|
- self.raiseInternalEvent(Event("exception", None, ['UnknownLocation', self.split_response(self.responses.pop(0))[0]]))
|
|
|
+ self.raiseInternalEvent(Event("exception", None, ['UnknownElement', self.split_response(self.responses.pop(0))[0]]))
|
|
|
|
|
|
def _initialized_behaviour_operations_14_guard(self, parameters):
|
|
|
- return self.expect_response_partial('Location not found: ', pop=False)
|
|
|
+ return self.expect_response_partial('Element not found: ', pop=False)
|
|
|
|
|
|
def _initialized_behaviour_operations_15_exec(self, parameters):
|
|
|
- self.raiseInternalEvent(Event("exception", None, ['UnknownMetamodellingHierarchy', 'Metamodelling hierarchy could not be resolved or automatically inferred: there is no typing relation between your specified model and metamodel (%s)' % self.responses.pop(0)]))
|
|
|
+ self.raiseInternalEvent(Event("exception", None, ['UnknownLocation', self.split_response(self.responses.pop(0))[0]]))
|
|
|
|
|
|
def _initialized_behaviour_operations_15_guard(self, parameters):
|
|
|
- return self.expect_response_partial('Conformance hierarchy unknown for: ', pop=False)
|
|
|
+ return self.expect_response_partial('Location not found: ', pop=False)
|
|
|
|
|
|
def _initialized_behaviour_operations_16_exec(self, parameters):
|
|
|
+ self.raiseInternalEvent(Event("exception", None, ['UnknownMetamodellingHierarchy', 'Metamodelling hierarchy could not be resolved or automatically inferred: there is no typing relation between your specified model and metamodel (%s)' % self.responses.pop(0)]))
|
|
|
+
|
|
|
+ def _initialized_behaviour_operations_16_guard(self, parameters):
|
|
|
+ return self.expect_response_partial('Conformance hierarchy unknown for: ', pop=False)
|
|
|
+
|
|
|
+ def _initialized_behaviour_operations_17_exec(self, parameters):
|
|
|
#print("Unknown Error: " + self.responses[0])
|
|
|
pass
|
|
|
self.raiseInternalEvent(Event("exception", None, ['UnknownError', 'Error: %s' % self.responses.pop(0)]))
|
|
|
|
|
|
- def _initialized_behaviour_operations_16_guard(self, parameters):
|
|
|
+ def _initialized_behaviour_operations_17_guard(self, parameters):
|
|
|
return self.expect_response_partial('', pop=False)
|
|
|
|
|
|
def _initialized_behaviour_wait_for_action_0_exec(self, parameters):
|
|
@@ -2452,6 +2463,7 @@ class Modelverse(RuntimeClassBase):
|
|
|
#print("Got input (%s): %s" % (self.taskname, data))
|
|
|
if self.taskname == "task_manager":
|
|
|
self.controller.taskname = self.taskname = json.loads(data)
|
|
|
+ print("Got taskname: " + data)
|
|
|
else:
|
|
|
self.responses.append(json.loads(data))
|
|
|
self.big_step.outputEventOM(Event("narrow_cast", None, [self, self.http_clients[1], Event("HTTP_input", None, [urlencode({"op": "get_output", "taskname": self.taskname}), "parent"])]))
|
|
@@ -2465,6 +2477,7 @@ class Modelverse(RuntimeClassBase):
|
|
|
#print("Got input (%s): %s" % (self.taskname, data))
|
|
|
if self.taskname == "task_manager":
|
|
|
self.controller.taskname = self.taskname = json.loads(data)
|
|
|
+ print("Got taskname: " + data)
|
|
|
else:
|
|
|
self.responses.append(json.loads(data))
|
|
|
self.big_step.outputEventOM(Event("narrow_cast", None, [self, self.http_clients[1], Event("HTTP_input", None, [urlencode({"op": "get_output", "taskname": self.taskname}), "parent"])]))
|
|
@@ -2475,6 +2488,7 @@ class Modelverse(RuntimeClassBase):
|
|
|
|
|
|
def _initialized_behaviour_init_connect_http_client_0_exec(self, parameters):
|
|
|
self.big_step.outputEventOM(Event("narrow_cast", None, [self, self.http_clients[self.i], Event("connect", None, [self.address, self.timeout])]))
|
|
|
+ print("CONNECT HTTP")
|
|
|
|
|
|
def _initialized_behaviour_init_connect_http_client_0_guard(self, parameters):
|
|
|
return self.i < 2
|
|
@@ -2487,12 +2501,14 @@ class Modelverse(RuntimeClassBase):
|
|
|
|
|
|
def _initialized_behaviour_init_waiting_http_client_0_exec(self, parameters):
|
|
|
self.i += 1
|
|
|
+ print("Got first HTTP ready")
|
|
|
|
|
|
def _initialized_behaviour_init_waiting_http_client_0_guard(self, parameters):
|
|
|
return self.i == 0
|
|
|
|
|
|
def _initialized_behaviour_init_waiting_http_client_1_exec(self, parameters):
|
|
|
self.i += 1
|
|
|
+ print("RAISE get output")
|
|
|
self.big_step.outputEventOM(Event("narrow_cast", None, [self, self.http_clients[1], Event("HTTP_input", None, [urlencode({"op": "get_output", "taskname": self.taskname}), "parent"])]))
|
|
|
|
|
|
def _initialized_behaviour_init_waiting_http_client_1_guard(self, parameters):
|
|
@@ -3580,6 +3596,7 @@ class HTTPClient(RuntimeClassBase):
|
|
|
|
|
|
# transition /connecting/cooldown
|
|
|
_connecting_cooldown_0 = Transition(self, self.states["/connecting/cooldown"], [self.states["/connecting/connecting"]])
|
|
|
+ _connecting_cooldown_0.setAction(self._connecting_cooldown_0_exec)
|
|
|
_connecting_cooldown_0.setTrigger(Event("_1after"))
|
|
|
self.states["/connecting/cooldown"].addTransition(_connecting_cooldown_0)
|
|
|
|
|
@@ -3654,6 +3671,7 @@ class HTTPClient(RuntimeClassBase):
|
|
|
|
|
|
def _connecting_connecting_enter(self):
|
|
|
self.big_step.outputEvent(Event("connect_socket", "socket_out", [self.socket, self.address]))
|
|
|
+ print("Connecting ...")
|
|
|
|
|
|
def _connecting_cooldown_enter(self):
|
|
|
self.addTimer(1, 0.1)
|
|
@@ -3694,6 +3712,9 @@ class HTTPClient(RuntimeClassBase):
|
|
|
socket = parameters[0]
|
|
|
return self.socket == socket
|
|
|
|
|
|
+ def _connecting_cooldown_0_exec(self, parameters):
|
|
|
+ print("COOLDOWN")
|
|
|
+
|
|
|
def _connected_listening_listen_0_exec(self, parameters):
|
|
|
socket = parameters[0]
|
|
|
data = parameters[1]
|