|
@@ -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: Mon Jun 11 09:14:38 2018
|
|
|
+Date: Mon Jun 11 09:54:06 2018
|
|
|
|
|
|
Model author: Yentl Van Tendeloo
|
|
|
Model name: MvK Server
|
|
@@ -509,6 +509,7 @@ class Modelverse(RuntimeClassBase):
|
|
|
|
|
|
# state /initialized/behaviour/wait_for_action/megamodelling
|
|
|
self.states["/initialized/behaviour/wait_for_action/megamodelling"] = State(105, "/initialized/behaviour/wait_for_action/megamodelling", self)
|
|
|
+ self.states["/initialized/behaviour/wait_for_action/megamodelling"].setEnter(self._initialized_behaviour_wait_for_action_megamodelling_enter)
|
|
|
|
|
|
# state /initialized/behaviour/wait_for_action/service
|
|
|
self.states["/initialized/behaviour/wait_for_action/service"] = State(106, "/initialized/behaviour/wait_for_action/service", self)
|
|
@@ -1611,6 +1612,7 @@ class Modelverse(RuntimeClassBase):
|
|
|
_initialized_behaviour_wait_for_action_modelling_recognized_manual_0.setGuard(self._initialized_behaviour_wait_for_action_modelling_recognized_manual_0_guard)
|
|
|
self.states["/initialized/behaviour/wait_for_action/modelling/recognized/manual"].addTransition(_initialized_behaviour_wait_for_action_modelling_recognized_manual_0)
|
|
|
_initialized_behaviour_wait_for_action_modelling_recognized_manual_1 = Transition(self, self.states["/initialized/behaviour/wait_for_action/modelling/recognized/manual"], [self.states["/initialized/behaviour/leaving_manual"]])
|
|
|
+ _initialized_behaviour_wait_for_action_modelling_recognized_manual_1.setAction(self._initialized_behaviour_wait_for_action_modelling_recognized_manual_1_exec)
|
|
|
_initialized_behaviour_wait_for_action_modelling_recognized_manual_1.setTrigger(None)
|
|
|
_initialized_behaviour_wait_for_action_modelling_recognized_manual_1.setGuard(self._initialized_behaviour_wait_for_action_modelling_recognized_manual_1_guard)
|
|
|
self.states["/initialized/behaviour/wait_for_action/modelling/recognized/manual"].addTransition(_initialized_behaviour_wait_for_action_modelling_recognized_manual_1)
|
|
@@ -1649,21 +1651,6 @@ class Modelverse(RuntimeClassBase):
|
|
|
_initialized_behaviour_going_manual_OK_0.setTrigger(None)
|
|
|
_initialized_behaviour_going_manual_OK_0.setGuard(self._initialized_behaviour_going_manual_OK_0_guard)
|
|
|
self.states["/initialized/behaviour/going_manual/OK"].addTransition(_initialized_behaviour_going_manual_OK_0)
|
|
|
- _initialized_behaviour_going_manual_OK_1 = Transition(self, self.states["/initialized/behaviour/going_manual/OK"], [self.states["/initialized/behaviour/wait_for_action/megamodelling"]])
|
|
|
- _initialized_behaviour_going_manual_OK_1.setAction(self._initialized_behaviour_going_manual_OK_1_exec)
|
|
|
- _initialized_behaviour_going_manual_OK_1.setTrigger(None)
|
|
|
- _initialized_behaviour_going_manual_OK_1.setGuard(self._initialized_behaviour_going_manual_OK_1_guard)
|
|
|
- self.states["/initialized/behaviour/going_manual/OK"].addTransition(_initialized_behaviour_going_manual_OK_1)
|
|
|
- _initialized_behaviour_going_manual_OK_2 = Transition(self, self.states["/initialized/behaviour/going_manual/OK"], [self.states["/initialized/behaviour/wait_for_action/megamodelling"]])
|
|
|
- _initialized_behaviour_going_manual_OK_2.setAction(self._initialized_behaviour_going_manual_OK_2_exec)
|
|
|
- _initialized_behaviour_going_manual_OK_2.setTrigger(None)
|
|
|
- _initialized_behaviour_going_manual_OK_2.setGuard(self._initialized_behaviour_going_manual_OK_2_guard)
|
|
|
- self.states["/initialized/behaviour/going_manual/OK"].addTransition(_initialized_behaviour_going_manual_OK_2)
|
|
|
- _initialized_behaviour_going_manual_OK_3 = Transition(self, self.states["/initialized/behaviour/going_manual/OK"], [self.states["/initialized/behaviour/wait_for_action/megamodelling"]])
|
|
|
- _initialized_behaviour_going_manual_OK_3.setAction(self._initialized_behaviour_going_manual_OK_3_exec)
|
|
|
- _initialized_behaviour_going_manual_OK_3.setTrigger(None)
|
|
|
- _initialized_behaviour_going_manual_OK_3.setGuard(self._initialized_behaviour_going_manual_OK_3_guard)
|
|
|
- self.states["/initialized/behaviour/going_manual/OK"].addTransition(_initialized_behaviour_going_manual_OK_3)
|
|
|
|
|
|
# transition /initialized/behaviour/going_scripted
|
|
|
_initialized_behaviour_going_scripted_0 = Transition(self, self.states["/initialized/behaviour/going_scripted"], [self.states["/initialized/behaviour/wait_for_action/modelling/recognized/scripted"]])
|
|
@@ -1928,6 +1915,23 @@ class Modelverse(RuntimeClassBase):
|
|
|
_initialized_behaviour_wait_for_action_modelling_recognized_23.setTrigger(None)
|
|
|
_initialized_behaviour_wait_for_action_modelling_recognized_23.setGuard(self._initialized_behaviour_wait_for_action_modelling_recognized_23_guard)
|
|
|
self.states["/initialized/behaviour/wait_for_action/modelling/recognized"].addTransition(_initialized_behaviour_wait_for_action_modelling_recognized_23)
|
|
|
+
|
|
|
+ # transition /initialized/behaviour/going_manual
|
|
|
+ _initialized_behaviour_going_manual_0 = Transition(self, self.states["/initialized/behaviour/going_manual"], [self.states["/initialized/behaviour/wait_for_action/megamodelling"]])
|
|
|
+ _initialized_behaviour_going_manual_0.setAction(self._initialized_behaviour_going_manual_0_exec)
|
|
|
+ _initialized_behaviour_going_manual_0.setTrigger(None)
|
|
|
+ _initialized_behaviour_going_manual_0.setGuard(self._initialized_behaviour_going_manual_0_guard)
|
|
|
+ self.states["/initialized/behaviour/going_manual"].addTransition(_initialized_behaviour_going_manual_0)
|
|
|
+ _initialized_behaviour_going_manual_1 = Transition(self, self.states["/initialized/behaviour/going_manual"], [self.states["/initialized/behaviour/wait_for_action/megamodelling"]])
|
|
|
+ _initialized_behaviour_going_manual_1.setAction(self._initialized_behaviour_going_manual_1_exec)
|
|
|
+ _initialized_behaviour_going_manual_1.setTrigger(None)
|
|
|
+ _initialized_behaviour_going_manual_1.setGuard(self._initialized_behaviour_going_manual_1_guard)
|
|
|
+ self.states["/initialized/behaviour/going_manual"].addTransition(_initialized_behaviour_going_manual_1)
|
|
|
+ _initialized_behaviour_going_manual_2 = Transition(self, self.states["/initialized/behaviour/going_manual"], [self.states["/initialized/behaviour/wait_for_action/megamodelling"]])
|
|
|
+ _initialized_behaviour_going_manual_2.setAction(self._initialized_behaviour_going_manual_2_exec)
|
|
|
+ _initialized_behaviour_going_manual_2.setTrigger(None)
|
|
|
+ _initialized_behaviour_going_manual_2.setGuard(self._initialized_behaviour_going_manual_2_guard)
|
|
|
+ self.states["/initialized/behaviour/going_manual"].addTransition(_initialized_behaviour_going_manual_2)
|
|
|
|
|
|
def _initialized_enter(self):
|
|
|
self.raiseInternalEvent(Event("ready", None, []))
|
|
@@ -2140,10 +2144,14 @@ class Modelverse(RuntimeClassBase):
|
|
|
def _initialized_behaviour_operations_service_stop_enter(self):
|
|
|
self.raiseInternalEvent(Event("request", None, [['service_stop']]))
|
|
|
|
|
|
+ def _initialized_behaviour_wait_for_action_megamodelling_enter(self):
|
|
|
+ print("Entered megamodelling with operation: " + str(self.actions))
|
|
|
+
|
|
|
def _initialized_behaviour_going_manual_init_enter(self):
|
|
|
self.current_model = self.actions[0]["parameters"][0]
|
|
|
|
|
|
def _initialized_behaviour_going_manual_search_enter(self):
|
|
|
+ print("Search")
|
|
|
self.raiseInternalEvent(Event("request", None, [['model_types', self.current_model]]))
|
|
|
|
|
|
def _initialized_behaviour_going_manual_OK_enter(self):
|
|
@@ -2409,6 +2417,7 @@ class Modelverse(RuntimeClassBase):
|
|
|
|
|
|
def _initialized_behaviour_wait_for_action_modelling_recognized_22_exec(self, parameters):
|
|
|
self.load_action()
|
|
|
+ print("Load all_instances for " + str(self.parameters))
|
|
|
|
|
|
def _initialized_behaviour_wait_for_action_modelling_recognized_22_guard(self, parameters):
|
|
|
return self.expect_action('all_instances')
|
|
@@ -2419,6 +2428,28 @@ class Modelverse(RuntimeClassBase):
|
|
|
def _initialized_behaviour_wait_for_action_modelling_recognized_23_guard(self, parameters):
|
|
|
return self.expect_action('exit_save')
|
|
|
|
|
|
+ def _initialized_behaviour_going_manual_0_exec(self, parameters):
|
|
|
+ self.raiseInternalEvent(Event("exception", None, ['UnknownLocation', 'No such location: ' + self.responses.pop(0)]))
|
|
|
+ self.actions.pop(0)
|
|
|
+
|
|
|
+ def _initialized_behaviour_going_manual_0_guard(self, parameters):
|
|
|
+ return self.expect_response_partial('Location not found: ', pop=False)
|
|
|
+
|
|
|
+ def _initialized_behaviour_going_manual_1_exec(self, parameters):
|
|
|
+ self.raiseInternalEvent(Event("exception", None, ['ReadPermissionDenied', 'No permission to read model ' + self.responses.pop(0)]))
|
|
|
+ self.actions.pop(0)
|
|
|
+
|
|
|
+ def _initialized_behaviour_going_manual_1_guard(self, parameters):
|
|
|
+ return self.expect_response_partial('Read permission denied to: ', pop=False)
|
|
|
+
|
|
|
+ def _initialized_behaviour_going_manual_2_exec(self, parameters):
|
|
|
+ self.raiseInternalEvent(Event("exception", None, ['UnknownMetamodellingHierarchy', 'Conformance relation not found']))
|
|
|
+ self.responses.pop(0)
|
|
|
+ self.actions.pop(0)
|
|
|
+
|
|
|
+ def _initialized_behaviour_going_manual_2_guard(self, parameters):
|
|
|
+ return self.expect_response_partial('Conformance hierarchy unknown for: ', pop=False)
|
|
|
+
|
|
|
def _init_0_exec(self, parameters):
|
|
|
instance = parameters[0]
|
|
|
self.http_clients.append(instance)
|
|
@@ -3338,6 +3369,9 @@ class Modelverse(RuntimeClassBase):
|
|
|
def _initialized_behaviour_wait_for_action_modelling_recognized_manual_0_guard(self, parameters):
|
|
|
return self.expect_action('exit')
|
|
|
|
|
|
+ def _initialized_behaviour_wait_for_action_modelling_recognized_manual_1_exec(self, parameters):
|
|
|
+ print("Switching to normal for model " + str(self.actions[0]))
|
|
|
+
|
|
|
def _initialized_behaviour_wait_for_action_modelling_recognized_manual_1_guard(self, parameters):
|
|
|
return self.actions and self.actions[0]['name'] in self.modelling_operations and self.actions[0]['parameters'][0] != self.current_model
|
|
|
|
|
@@ -3349,6 +3383,7 @@ class Modelverse(RuntimeClassBase):
|
|
|
|
|
|
def _initialized_behaviour_wait_for_action_modelling_recognized_scripted_1_exec(self, parameters):
|
|
|
self.load_action()
|
|
|
+ print("INTERFACE")
|
|
|
self.raiseInternalEvent(Event("exception", None, ['InterfaceMismatch', 'Operation cannot be executed in this context']))
|
|
|
|
|
|
def _initialized_behaviour_wait_for_action_modelling_recognized_scripted_1_guard(self, parameters):
|
|
@@ -3369,28 +3404,6 @@ class Modelverse(RuntimeClassBase):
|
|
|
def _initialized_behaviour_going_manual_OK_0_guard(self, parameters):
|
|
|
return self.expect_response('Model loaded, ready for commands!', pop=True)
|
|
|
|
|
|
- def _initialized_behaviour_going_manual_OK_1_exec(self, parameters):
|
|
|
- self.raiseInternalEvent(Event("exception", None, ['UnknownLocation', 'No such location: ' + self.responses.pop(0)]))
|
|
|
- self.actions.pop(0)
|
|
|
-
|
|
|
- def _initialized_behaviour_going_manual_OK_1_guard(self, parameters):
|
|
|
- return self.expect_response_partial('Location not found: ', pop=False)
|
|
|
-
|
|
|
- def _initialized_behaviour_going_manual_OK_2_exec(self, parameters):
|
|
|
- self.raiseInternalEvent(Event("exception", None, ['ReadPermissionDenied', 'No permission to read model ' + self.responses.pop(0)]))
|
|
|
- self.actions.pop(0)
|
|
|
-
|
|
|
- def _initialized_behaviour_going_manual_OK_2_guard(self, parameters):
|
|
|
- return self.expect_response_partial('Read permission denied to: ', pop=False)
|
|
|
-
|
|
|
- def _initialized_behaviour_going_manual_OK_3_exec(self, parameters):
|
|
|
- self.raiseInternalEvent(Event("exception", None, ['UnknownMetamodellingHierarchy', 'Conformance relation not found']))
|
|
|
- self.responses.pop(0)
|
|
|
- self.actions.pop(0)
|
|
|
-
|
|
|
- def _initialized_behaviour_going_manual_OK_3_guard(self, parameters):
|
|
|
- return self.expect_response_partial('Conformance hierarchy unknown for: ', pop=False)
|
|
|
-
|
|
|
def _initialized_behaviour_leaving_manual_0_guard(self, parameters):
|
|
|
return self.expect_response('Success', pop=True)
|
|
|
|