modelverse.xml 91 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868
  1. <class name="Modelverse">
  2. <relationships>
  3. <association name="http_client" class="HTTPClient" min="2" max="2"/>
  4. </relationships>
  5. <method name="load_action">
  6. <parameter name="context"/>
  7. <body>
  8. action = self.actions[context].pop(0)
  9. self.parameters = action["parameters"]
  10. self.current_ID = action["ID"]
  11. </body>
  12. </method>
  13. <method name="dict_to_list">
  14. <parameter name="d"/>
  15. <body>
  16. l = []
  17. for k, v in d.iteritems():
  18. l.append(k)
  19. l.append(v)
  20. l.append("")
  21. return l
  22. </body>
  23. </method>
  24. <method name="split_response">
  25. <parameter name="response"/>
  26. <body>
  27. splitted = response.strip().split(": ", 1)
  28. if len(splitted) > 1:
  29. return splitted[1].split("\n")
  30. else:
  31. return []
  32. </body>
  33. </method>
  34. <method name="expect_response">
  35. <parameter name="expected"/>
  36. <parameter name="pop" default="True"/>
  37. <body>
  38. if self.responses and self.responses[0] == expected:
  39. if pop:
  40. del self.responses[0]
  41. return True
  42. else:
  43. return False
  44. </body>
  45. </method>
  46. <method name="expect_response_partial">
  47. <parameter name="expected"/>
  48. <parameter name="pop" default="False"/>
  49. <body>
  50. if self.responses and self.responses[0].startswith(expected):
  51. if pop:
  52. del self.responses[0]
  53. return True
  54. else:
  55. return False
  56. </body>
  57. </method>
  58. <method name="expect_action">
  59. <parameter name="context"/>
  60. <parameter name="expected"/>
  61. <body>
  62. if isinstance(expected, list):
  63. return self.actions[context] and self.actions[context][0]["name"] in expected
  64. else:
  65. return self.actions[context] and self.actions[context][0]["name"] == expected
  66. </body>
  67. </method>
  68. <method name="expect_input">
  69. <parameter name="context"/>
  70. <parameter name="expected"/>
  71. <body>
  72. if isinstance(expected, list):
  73. return self.inputs[context] and self.inputs[context][0]["name"] in expected
  74. else:
  75. return self.inputs[context] and self.inputs[context][0]["name"] == expected
  76. </body>
  77. </method>
  78. <constructor>
  79. <body>
  80. self.actions = {None: []}
  81. self.responses = []
  82. self.http_clients = []
  83. self.context = None
  84. self.registered_metamodel = {}
  85. self.inputs = {}
  86. </body>
  87. </constructor>
  88. <scxml initial="init" priority="source_child">
  89. <state id="init">
  90. <onentry>
  91. <raise scope="cd" event="create_instance">
  92. <parameter expr="'http_client'"/>
  93. <parameter expr="'HTTPClient'"/>
  94. </raise>
  95. <raise scope="cd" event="create_instance">
  96. <parameter expr="'http_client'"/>
  97. <parameter expr="'HTTPClient'"/>
  98. </raise>
  99. </onentry>
  100. <transition event="instance_created" target=".">
  101. <parameter name="instance"/>
  102. <script>
  103. self.http_clients.append(instance)
  104. </script>
  105. <raise scope="cd" event="start_instance">
  106. <parameter expr="instance"/>
  107. </raise>
  108. </transition>
  109. <transition cond="len(self.http_clients) == 2" target="../waiting"/>
  110. </state>
  111. <state id="waiting">
  112. <transition event="http_client_initialized" target="../initialized"/>
  113. </state>
  114. <parallel id="initialized">
  115. <onentry>
  116. <raise event="ready"/>
  117. </onentry>
  118. <state id="http_mapper" initial="init">
  119. <state id="init">
  120. <transition event="request" cond="isinstance(value, type([]))" target=".">
  121. <parameter name="value"/>
  122. <raise event="HTTP_input" target="self.http_clients[0]">
  123. <parameter expr='urllib.urlencode({"op": "set_input", "data": json.dumps(value), "taskname": self.taskname})'/>
  124. <parameter expr='None'/>
  125. </raise>
  126. </transition>
  127. <transition event="request" cond="not isinstance(value, type([]))" target=".">
  128. <parameter name="value"/>
  129. <raise event="HTTP_input" target="self.http_clients[0]">
  130. <parameter expr='urllib.urlencode({"op": "set_input", "value": json.dumps(value), "taskname": self.taskname})'/>
  131. <parameter expr='None'/>
  132. </raise>
  133. </transition>
  134. <transition event="request_raw" target=".">
  135. <parameter name="value"/>
  136. <parameter name="taskname"/>
  137. <parameter name="http_client"/>
  138. <raise event="HTTP_input" target="self.http_clients[http_client]">
  139. <parameter expr='urllib.urlencode({"op": "set_input", "value": json.dumps(value), "taskname": taskname})'/>
  140. <parameter expr='"parent"'/>
  141. </raise>
  142. </transition>
  143. <transition event="HTTP_output" target=".">
  144. <parameter name="data"/>
  145. <raise event="HTTP_input" target="self.http_clients[1]">
  146. <parameter expr='urllib.urlencode({"op": "get_output", "taskname": self.taskname})'/>
  147. <parameter expr='"parent"'/>
  148. </raise>
  149. <script>
  150. self.responses.append(json.loads(data))
  151. </script>
  152. </transition>
  153. </state>
  154. </state>
  155. <state id="behaviour" initial="wait_for_action">
  156. <state id="init" initial="connect_http_client">
  157. <onentry>
  158. <script>
  159. self.address, self.timeout = self.parameters
  160. self.address = self.address.rsplit(":", 1)
  161. self.address = (self.address[0], int(self.address[1]))
  162. self.i = 0
  163. self.taskname = str(uuid.uuid4())
  164. </script>
  165. </onentry>
  166. <state id="connect_http_client">
  167. <transition cond="self.i &lt; 2" target="../waiting_http_client">
  168. <raise scope="narrow" target="self.http_clients[self.i]" event="connect">
  169. <parameter expr="self.address"/>
  170. <parameter expr="self.timeout"/>
  171. </raise>
  172. </transition>
  173. <transition cond="self.i == 2" target="../../wait_for_action/connected">
  174. <!-- Start polling for output -->
  175. <raise event="HTTP_input" target="self.http_clients[1]">
  176. <parameter expr='urllib.urlencode({"op": "get_output", "taskname": self.taskname})'/>
  177. <parameter expr='"parent"'/>
  178. </raise>
  179. <!-- Sent out completion -->
  180. <raise event="result">
  181. <parameter expr="[]"/>
  182. </raise>
  183. </transition>
  184. </state>
  185. <state id="waiting_http_client">
  186. <transition event="http_client_ready" target="../wait_for_taskname_ack">
  187. <!-- Request the task to be created -->
  188. <raise event="request_raw">
  189. <parameter expr="self.taskname"/>
  190. <parameter expr="'task_manager'"/>
  191. <parameter expr="self.i"/>
  192. </raise>
  193. <script>
  194. self.i += 1
  195. </script>
  196. </transition>
  197. <transition event="http_client_timeout" target="../../wait_for_action/disconnected">
  198. <raise event="exception">
  199. <parameter expr="'NetworkException'"/>
  200. <parameter expr="'Connection timeout'"/>
  201. </raise>
  202. </transition>
  203. </state>
  204. <state id="wait_for_taskname_ack">
  205. <transition cond="self.expect_response('OK', pop=True)" target="../connect_http_client"/>
  206. </state>
  207. </state>
  208. <state id="login" initial="wait_prompt_1">
  209. <state id="wait_prompt_1">
  210. <transition cond="self.expect_response('Log on as which user?', pop=True)" target="../wait_prompt_2">
  211. <raise event="request">
  212. <parameter expr="self.parameters[0]"/>
  213. </raise>
  214. </transition>
  215. </state>
  216. <state id="wait_prompt_2">
  217. <transition cond="self.expect_response('Password for existing user?', pop=True)" target="../wait_prompt_existing">
  218. <raise event="request">
  219. <parameter expr="self.parameters[1]"/>
  220. </raise>
  221. </transition>
  222. <transition cond="self.expect_response('This is a new user: please give password!', pop=True)" target="../wait_prompt_existing">
  223. <raise event="request">
  224. <parameter expr="self.parameters[1]"/>
  225. </raise>
  226. </transition>
  227. </state>
  228. <state id="wait_prompt_existing">
  229. <transition cond="self.expect_response('Welcome to the Model Management Interface v2.0!', pop=True)" target="../login_ok"/>
  230. <transition cond="self.expect_response('Wrong password!', pop=True)" target="../../wait_for_action/connected">
  231. <raise event="exception">
  232. <parameter expr="'PermissionDenied'"/>
  233. <parameter expr="'Permission denied!'"/>
  234. </raise>
  235. </transition>
  236. </state>
  237. <state id="login_ok">
  238. <transition cond="self.expect_response('Use the \'help\' command for a list of possible commands', pop=True)" target="../../wait_for_action/megamodelling">
  239. <raise event="request">
  240. <parameter expr="'quiet'"/>
  241. </raise>
  242. <raise event="result">
  243. <parameter expr="None"/>
  244. </raise>
  245. </transition>
  246. </state>
  247. </state>
  248. <state id="operations" initial="model_list">
  249. <history id="history" type="deep"/>
  250. <state id="model_list">
  251. <onentry>
  252. <script>
  253. print("DOING model_list")
  254. </script>
  255. <raise event="request">
  256. <parameter expr="['model_list', self.parameters[0]]"/>
  257. </raise>
  258. </onentry>
  259. <transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
  260. <script>
  261. print("Got response to model_list")
  262. </script>
  263. <raise event="result">
  264. <parameter expr="set(self.split_response(self.responses.pop(0)))"/>
  265. </raise>
  266. </transition>
  267. </state>
  268. <state id="model_add" initial="send_metadata">
  269. <state id="send_metadata">
  270. <onentry>
  271. <raise event="request">
  272. <parameter expr="['model_add', self.parameters[1], self.parameters[0], self.parameters[2]]"/>
  273. </raise>
  274. </onentry>
  275. <transition cond="self.expect_response('Success')" target="../../../wait_for_action/history">
  276. <script>
  277. self.registered_metamodel[self.parameters[0]] = self.parameters[1]
  278. </script>
  279. <raise event="result">
  280. <parameter expr="None"/>
  281. </raise>
  282. </transition>
  283. </state>
  284. </state>
  285. <state id="model_delete">
  286. <onentry>
  287. <raise event="request">
  288. <parameter expr="['model_delete', self.parameters[0]]"/>
  289. </raise>
  290. </onentry>
  291. <transition cond="self.expect_response('Success')" target="../../wait_for_action/history">
  292. <raise event="result">
  293. <parameter expr="None"/>
  294. </raise>
  295. </transition>
  296. </state>
  297. <state id="model_list_full">
  298. <onentry>
  299. <raise event="request">
  300. <parameter expr="['model_list_full', self.parameters[0]]"/>
  301. </raise>
  302. </onentry>
  303. <transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
  304. <script>
  305. response = self.split_response(self.responses.pop(0))
  306. result = set()
  307. for res in response:
  308. i = res.split(" ", 3)
  309. result.add((i[3], i[1], i[2], i[0]))
  310. </script>
  311. <raise event="result">
  312. <parameter expr="result"/>
  313. </raise>
  314. </transition>
  315. </state>
  316. <state id="verify">
  317. <onentry>
  318. <raise event="request">
  319. <parameter expr="['verify', self.parameters[0], self.parameters[1]]"/>
  320. </raise>
  321. </onentry>
  322. <transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
  323. <raise event="result">
  324. <parameter expr="self.split_response(self.responses.pop(0))[0]"/>
  325. </raise>
  326. </transition>
  327. </state>
  328. <state id="alter_context">
  329. <transition target="../../wait_for_action/history">
  330. <script>
  331. self.registered_metamodel[self.parameters[0]] = self.parameters[1]
  332. </script>
  333. <raise event="result">
  334. <parameter expr="None"/>
  335. </raise>
  336. </transition>
  337. </state>
  338. <state id="model_upload" initial="send_metadata">
  339. <state id="send_metadata">
  340. <onentry>
  341. <raise event="request">
  342. <parameter expr="['upload']"/>
  343. </raise>
  344. </onentry>
  345. <transition cond="self.expect_response('Waiting for model constructors...')" target="../send_model"/>
  346. </state>
  347. <state id="send_model">
  348. <onentry>
  349. <raise event="request">
  350. <parameter expr="self.parameters[1]"/>
  351. </raise>
  352. </onentry>
  353. <transition cond="self.expect_response('Success')" target="../../../wait_for_action/history">
  354. <raise event="result">
  355. <parameter expr="None"/>
  356. </raise>
  357. </transition>
  358. </state>
  359. </state>
  360. <state id="model_overwrite" initial="send_metadata">
  361. <state id="send_metadata">
  362. <onentry>
  363. <raise event="request">
  364. <parameter expr="['model_overwrite', self.parameters[0], self.registered_metamodel[self.parameters[0]]]"/>
  365. </raise>
  366. </onentry>
  367. <transition cond="self.expect_response('Waiting for model constructors...')" target="../send_model"/>
  368. </state>
  369. <state id="send_model">
  370. <onentry>
  371. <raise event="request">
  372. <parameter expr="self.parameters[1]"/>
  373. </raise>
  374. </onentry>
  375. <transition cond="self.expect_response('Success')" target="../../../wait_for_action/history">
  376. <raise event="result">
  377. <parameter expr="None"/>
  378. </raise>
  379. </transition>
  380. </state>
  381. </state>
  382. <state id="disconnect">
  383. <onentry>
  384. <raise event="request">
  385. <parameter expr="'exit'"/>
  386. </raise>
  387. </onentry>
  388. <transition cond="self.expect_response('Success')" target="../../wait_for_action/finished">
  389. <raise event="result">
  390. <parameter expr="None"/>
  391. </raise>
  392. </transition>
  393. </state>
  394. <state id="user_logout">
  395. <onentry>
  396. <raise event="request">
  397. <parameter expr="'user_logout'"/>
  398. </raise>
  399. </onentry>
  400. <transition cond="self.expect_response('Success')" target="../../wait_for_action/connected">
  401. <raise event="result">
  402. <parameter expr="None"/>
  403. </raise>
  404. </transition>
  405. </state>
  406. <state id="user_delete">
  407. <onentry>
  408. <raise event="request">
  409. <parameter expr="'self-destruct'"/>
  410. </raise>
  411. </onentry>
  412. <transition cond="self.expect_response('Success')" target="../../wait_for_action/finished">
  413. <raise event="result">
  414. <parameter expr="None"/>
  415. </raise>
  416. </transition>
  417. </state>
  418. <state id="model_render">
  419. <onentry>
  420. <raise event="request">
  421. <parameter expr="['model_render', self.parameters[0], self.parameters[1]]"/>
  422. </raise>
  423. </onentry>
  424. <transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
  425. <raise event="result">
  426. <parameter expr="json.loads(self.split_response(self.responses.pop(0))[0])"/>
  427. </raise>
  428. </transition>
  429. </state>
  430. <state id="transformation_between">
  431. <onentry>
  432. <raise event="request">
  433. <parameter expr="['transformation_between', self.parameters[0], self.parameters[1]]"/>
  434. </raise>
  435. </onentry>
  436. <transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
  437. <raise event="result">
  438. <parameter expr="set(self.split_response(self.responses.pop(0)))"/>
  439. </raise>
  440. </transition>
  441. </state>
  442. <state id="store_on_scripted" initial="transformation_add_MT">
  443. <state id="transformation_add_MT" initial="send_metadata">
  444. <state id="send_metadata">
  445. <onentry>
  446. <raise event="request">
  447. <parameter expr="['transformation_add_MT'] + self.dict_to_list(self.parameters[0]) + self.dict_to_list(self.parameters[1]) + [self.parameters[2]]"/>
  448. </raise>
  449. <script>
  450. self.context = str(uuid.uuid4())
  451. self.actions[self.context] = []
  452. self.code = self.parameters[3]
  453. </script>
  454. <raise event="result">
  455. <parameter expr="self.context"/>
  456. </raise>
  457. </onentry>
  458. <transition target="../edit_metamodel"/>
  459. </state>
  460. <state id="edit_metamodel">
  461. <transition cond="self.expect_response('Model loaded, ready for commands!')" target="../../../../going_scripted"/>
  462. <transition cond="self.expect_response('Waiting for model constructors...')" target="../send_model"/>
  463. </state>
  464. <state id="send_model">
  465. <onentry>
  466. <raise event="request">
  467. <parameter expr="self.code"/>
  468. </raise>
  469. </onentry>
  470. <transition cond="self.expect_response('Success')" target="../../../../wait_for_action/megamodelling">
  471. <raise event="result">
  472. <parameter expr="None"/>
  473. </raise>
  474. </transition>
  475. </state>
  476. <transition cond="self.expect_response_partial('', pop=False)" target="../../../wait_for_action/history">
  477. <script>
  478. print("UNKNOWN RESPONSE received: " + str(self.responses.pop(0)))
  479. </script>
  480. </transition>
  481. </state>
  482. <state id="transformation_add_AL" initial="send_metadata">
  483. <state id="send_metadata">
  484. <onentry>
  485. <raise event="request">
  486. <parameter expr="['transformation_add_AL'] + self.dict_to_list(self.parameters[0]) + self.dict_to_list(self.parameters[1]) + [self.parameters[2]]"/>
  487. </raise>
  488. <script>
  489. self.context = str(uuid.uuid4())
  490. self.actions[self.context] = []
  491. self.code = self.parameters[3]
  492. </script>
  493. <raise event="result">
  494. <parameter expr="self.context"/>
  495. </raise>
  496. </onentry>
  497. <transition target="../edit_metamodel"/>
  498. </state>
  499. <state id="edit_metamodel">
  500. <transition cond="self.expect_response('Model loaded, ready for commands!')" target="../../../../going_scripted"/>
  501. <transition cond="self.expect_response('Waiting for code constructors...')" target="../send_model"/>
  502. </state>
  503. <state id="send_model">
  504. <onentry>
  505. <raise event="request">
  506. <parameter expr="self.code"/>
  507. </raise>
  508. </onentry>
  509. <transition cond="self.expect_response('Success')" target="../../../../wait_for_action/megamodelling">
  510. <raise event="result">
  511. <parameter expr="None"/>
  512. </raise>
  513. </transition>
  514. </state>
  515. </state>
  516. <state id="transformation_add_MANUAL" initial="send_metadata">
  517. <state id="send_metadata">
  518. <onentry>
  519. <raise event="request">
  520. <parameter expr="['transformation_add_MANUAL'] + self.dict_to_list(self.parameters[0]) + self.dict_to_list(self.parameters[1]) + [self.parameters[2]]"/>
  521. </raise>
  522. <script>
  523. self.context = str(uuid.uuid4())
  524. self.actions[self.context] = []
  525. </script>
  526. <raise event="result">
  527. <parameter expr="self.context"/>
  528. </raise>
  529. </onentry>
  530. <transition target="../edit_metamodel"/>
  531. </state>
  532. <state id="edit_metamodel">
  533. <transition cond="self.expect_response('Model loaded, ready for commands!')" target="../../../../going_scripted"/>
  534. <transition cond="self.expect_response('Success')" target="../../../../wait_for_action/megamodelling">
  535. <raise event="result">
  536. <parameter expr="None"/>
  537. </raise>
  538. </transition>
  539. </state>
  540. </state>
  541. <state id="transformation_execute_AL" initial="send_operation">
  542. <state id="send_operation">
  543. <onentry>
  544. <raise event="request">
  545. <parameter expr="['transformation_execute', self.parameters[0]] + self.dict_to_list(self.parameters[1]) + self.dict_to_list(self.parameters[2])"/>
  546. </raise>
  547. </onentry>
  548. <transition cond="self.expect_response('Success: ready for AL execution')" target="../dialog">
  549. <script>
  550. self.input_context = str(uuid.uuid4())
  551. self.inputs[self.input_context] = []
  552. </script>
  553. <raise event="result">
  554. <parameter expr="self.input_context"/>
  555. </raise>
  556. </transition>
  557. </state>
  558. <state id="dialog">
  559. <transition cond="self.expect_response('Success', pop=False) or self.expect_response('Failure', pop=False)" target="../../../../wait_for_action/history">
  560. <raise event="result">
  561. <parameter expr="True if self.responses.pop(0) == 'Success' else False"/>
  562. </raise>
  563. </transition>
  564. <transition cond="not (self.expect_response('Success', pop=False) or self.expect_response('Failure', pop=False)) and self.expect_response_partial('', pop=False)" target=".">
  565. <raise event="data_output">
  566. <parameter expr="self.responses.pop(0)"/>
  567. </raise>
  568. </transition>
  569. <transition cond="self.expect_input(self.input_context, 'data_input')" target=".">
  570. <raise event="request">
  571. <parameter expr="self.inputs[self.input_context].pop(0)['parameters']"/>
  572. </raise>
  573. </transition>
  574. </state>
  575. </state>
  576. <state id="transformation_execute_MT" initial="send_operation">
  577. <state id="send_operation">
  578. <onentry>
  579. <raise event="request">
  580. <parameter expr="['transformation_execute', self.parameters[0]] + self.dict_to_list(self.parameters[1]) + self.dict_to_list(self.parameters[2])"/>
  581. </raise>
  582. </onentry>
  583. <transition cond="self.expect_response('Success: ready for MT execution')" target="../dialog">
  584. <script>
  585. self.input_context = str(uuid.uuid4())
  586. self.inputs[self.input_context] = []
  587. </script>
  588. <raise event="result">
  589. <parameter expr="self.input_context"/>
  590. </raise>
  591. </transition>
  592. </state>
  593. <state id="dialog">
  594. <transition cond="self.expect_response('Success', pop=False) or self.expect_response('Failure', pop=False)" target="../../../../wait_for_action/history">
  595. <raise event="result">
  596. <parameter expr="True if self.responses.pop(0) == 'Success' else False"/>
  597. </raise>
  598. </transition>
  599. <transition cond="not (self.expect_response('Success', pop=False) or self.expect_response('Failure', pop=False)) and self.expect_response_partial('', pop=False)" target=".">
  600. <raise event="data_output">
  601. <parameter expr="self.responses.pop(0)"/>
  602. </raise>
  603. </transition>
  604. <transition cond="self.expect_input(self.input_context, 'data_input')" target=".">
  605. <raise event="request">
  606. <parameter expr="self.inputs[self.input_context].pop(0)['parameters']"/>
  607. </raise>
  608. </transition>
  609. </state>
  610. </state>
  611. <state id="transformation_execute_MANUAL" initial="send_metadata">
  612. <state id="send_metadata">
  613. <onentry>
  614. <raise event="request">
  615. <parameter expr="['transformation_execute', self.parameters[0]] + self.dict_to_list(self.parameters[1]) + self.dict_to_list(self.parameters[2])"/>
  616. </raise>
  617. <script>
  618. self.context = str(uuid.uuid4())
  619. self.actions[self.context] = []
  620. </script>
  621. <raise event="result">
  622. <parameter expr="self.context"/>
  623. </raise>
  624. </onentry>
  625. <transition cond="self.expect_response('Success: ready for MANUAL execution')" target="../edit_model"/>
  626. </state>
  627. <state id="edit_model">
  628. <transition cond="self.expect_response_partial('Please perform manual operation ', pop=True)" target="."/>
  629. <transition cond="self.expect_response('Model loaded, ready for commands!')" target="../../../../going_scripted"/>
  630. <transition cond="self.expect_response('Success')" target="../../../../wait_for_action/megamodelling">
  631. <raise event="result">
  632. <parameter expr="True"/>
  633. </raise>
  634. </transition>
  635. </state>
  636. </state>
  637. <state id="process_execute" initial="init">
  638. <state id="init">
  639. <onentry>
  640. <raise event="request">
  641. <parameter expr="['process_execute', self.parameters[0], self.parameters[1]]"/>
  642. </raise>
  643. </onentry>
  644. <transition cond="self.expect_response('Success', pop=True)" target="../executing"/>
  645. </state>
  646. <state id="executing">
  647. <transition cond="self.expect_response_partial('Enacting ModelTransformation', pop=False)" target="../enacting/sc"/>
  648. <transition cond="self.expect_response_partial('Enacting ActionLanguage', pop=False)" target="../enacting/sc"/>
  649. <transition cond="self.expect_response_partial('Enacting ManualOperation', pop=False)" target="../enacting/op"/>
  650. <transition cond="self.expect_response('Success', pop=True)" target="../../../../wait_for_action/megamodelling">
  651. <raise event="result">
  652. <parameter expr="'Finished'"/>
  653. </raise>
  654. </transition>
  655. </state>
  656. <state id="enacting" initial="sc">
  657. <state id="sc" initial="init">
  658. <state id="init">
  659. <transition target="../processing">
  660. <script>
  661. self.input_context = str(uuid.uuid4())
  662. self.inputs[self.input_context] = []
  663. </script>
  664. <raise event="result">
  665. <parameter expr="['SC', self.responses.pop(0).split(': ', 1)[1], self.input_context]"/>
  666. </raise>
  667. </transition>
  668. </state>
  669. <state id="processing">
  670. <transition cond="not (self.expect_response('Success', pop=False) or self.expect_response('Failure', pop=False)) and self.expect_response_partial('', pop=False)" target=".">
  671. <raise event="data_output">
  672. <parameter expr="self.responses.pop(0)"/>
  673. </raise>
  674. </transition>
  675. <transition cond="self.expect_input(self.input_context, 'data_input')" target=".">
  676. <raise event="request">
  677. <parameter expr="self.inputs[self.input_context].pop(0)['parameters']"/>
  678. </raise>
  679. </transition>
  680. </state>
  681. </state>
  682. <state id="op" initial="init">
  683. <state id="init">
  684. <transition target="../processing">
  685. <script>
  686. self.context = str(uuid.uuid4())
  687. self.actions[self.context] = []
  688. </script>
  689. <raise event="result">
  690. <parameter expr="['OP', self.responses.pop(0).split(': ', 1)[1], self.context]"/>
  691. </raise>
  692. </transition>
  693. </state>
  694. <state id="processing">
  695. <transition cond="self.expect_response_partial('Please perform manual operation ', pop=True)" target="."/>
  696. <transition cond="self.expect_response('Model loaded, ready for commands!')" target="../../../../../../going_scripted"/>
  697. </state>
  698. </state>
  699. <transition cond="self.expect_response('Success', pop=True)" target="../executing"/>
  700. <transition cond="self.expect_response('Failure', pop=True)" target="../executing"/>
  701. </state>
  702. </state>
  703. <history id="history" type="deep"/>
  704. </state>
  705. <state id="permission_modify">
  706. <onentry>
  707. <raise event="request">
  708. <parameter expr="['permission_modify', self.parameters[0], self.parameters[1]]"/>
  709. </raise>
  710. </onentry>
  711. <transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
  712. <raise event="result">
  713. <parameter expr="self.responses.pop(0)"/>
  714. </raise>
  715. </transition>
  716. </state>
  717. <state id="permission_owner">
  718. <onentry>
  719. <raise event="request">
  720. <parameter expr="['permission_owner', self.parameters[0], self.parameters[1]]"/>
  721. </raise>
  722. </onentry>
  723. <transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
  724. <raise event="result">
  725. <parameter expr="self.responses.pop(0)"/>
  726. </raise>
  727. </transition>
  728. </state>
  729. <state id="permission_group">
  730. <onentry>
  731. <raise event="request">
  732. <parameter expr="['permission_group', self.parameters[0], self.parameters[1]]"/>
  733. </raise>
  734. </onentry>
  735. <transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
  736. <raise event="result">
  737. <parameter expr="self.responses.pop(0)"/>
  738. </raise>
  739. </transition>
  740. </state>
  741. <state id="group_create">
  742. <onentry>
  743. <raise event="request">
  744. <parameter expr="['group_create', self.parameters[0], self.parameters[1]]"/>
  745. </raise>
  746. </onentry>
  747. <transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
  748. <raise event="result">
  749. <parameter expr="self.responses.pop(0)"/>
  750. </raise>
  751. </transition>
  752. </state>
  753. <state id="group_delete">
  754. <onentry>
  755. <raise event="request">
  756. <parameter expr="['group_delete', self.parameters[0], self.parameters[1]]"/>
  757. </raise>
  758. </onentry>
  759. <transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
  760. <raise event="result">
  761. <parameter expr="self.responses.pop(0)"/>
  762. </raise>
  763. </transition>
  764. </state>
  765. <state id="group_owner_add">
  766. <onentry>
  767. <raise event="request">
  768. <parameter expr="['group_owner_add', self.parameters[0], self.parameters[1]]"/>
  769. </raise>
  770. </onentry>
  771. <transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
  772. <raise event="result">
  773. <parameter expr="self.responses.pop(0)"/>
  774. </raise>
  775. </transition>
  776. </state>
  777. <state id="group_owner_delete">
  778. <onentry>
  779. <raise event="request">
  780. <parameter expr="['group_owner_delete', self.parameters[0], self.parameters[1]]"/>
  781. </raise>
  782. </onentry>
  783. <transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
  784. <raise event="result">
  785. <parameter expr="self.responses.pop(0)"/>
  786. </raise>
  787. </transition>
  788. </state>
  789. <state id="group_join">
  790. <onentry>
  791. <raise event="request">
  792. <parameter expr="['group_join', self.parameters[0], self.parameters[1]]"/>
  793. </raise>
  794. </onentry>
  795. <transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
  796. <raise event="result">
  797. <parameter expr="self.responses.pop(0)"/>
  798. </raise>
  799. </transition>
  800. </state>
  801. <state id="group_kick">
  802. <onentry>
  803. <raise event="request">
  804. <parameter expr="['group_kick', self.parameters[0], self.parameters[1]]"/>
  805. </raise>
  806. </onentry>
  807. <transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
  808. <raise event="result">
  809. <parameter expr="self.responses.pop(0)"/>
  810. </raise>
  811. </transition>
  812. </state>
  813. <state id="group_list">
  814. <onentry>
  815. <raise event="request">
  816. <parameter expr="['group_list', self.parameters[0], self.parameters[1]]"/>
  817. </raise>
  818. </onentry>
  819. <transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
  820. <raise event="result">
  821. <parameter expr="set(self.split_response(self.responses.pop(0)))"/>
  822. </raise>
  823. </transition>
  824. </state>
  825. <state id="admin_promote">
  826. <onentry>
  827. <raise event="request">
  828. <parameter expr="['admin_promote', self.parameters[0], self.parameters[1]]"/>
  829. </raise>
  830. </onentry>
  831. <transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
  832. <raise event="result">
  833. <parameter expr="self.responses.pop(0)"/>
  834. </raise>
  835. </transition>
  836. </state>
  837. <state id="admin_demote">
  838. <onentry>
  839. <raise event="request">
  840. <parameter expr="['admin_demote', self.parameters[0], self.parameters[1]]"/>
  841. </raise>
  842. </onentry>
  843. <transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
  844. <raise event="result">
  845. <parameter expr="self.responses.pop(0)"/>
  846. </raise>
  847. </transition>
  848. </state>
  849. <state id="conformance_delete">
  850. <onentry>
  851. <raise event="request">
  852. <parameter expr="['remove_conformance', self.parameters[0], self.parameters[1]]"/>
  853. </raise>
  854. </onentry>
  855. <transition cond="self.expect_response('Success')" target="../../wait_for_action/history">
  856. <raise event="result">
  857. <parameter expr="None"/>
  858. </raise>
  859. </transition>
  860. </state>
  861. <state id="conformance_add">
  862. <onentry>
  863. <raise event="request">
  864. <parameter expr="['add_conformance', self.parameters[0], self.parameters[1]]"/>
  865. </raise>
  866. </onentry>
  867. <transition cond="self.expect_response('Success')" target="../../wait_for_action/history">
  868. <raise event="result">
  869. <parameter expr="None"/>
  870. </raise>
  871. </transition>
  872. </state>
  873. <state id="folder_create">
  874. <onentry>
  875. <raise event="request">
  876. <parameter expr="['folder_create', self.parameters[0]]"/>
  877. </raise>
  878. </onentry>
  879. <transition cond="self.expect_response('Success')" target="../../wait_for_action/history">
  880. <raise event="result">
  881. <parameter expr="None"/>
  882. </raise>
  883. </transition>
  884. </state>
  885. <state id="model_types">
  886. <onentry>
  887. <raise event="request">
  888. <parameter expr="['model_types', self.parameters[0]]"/>
  889. </raise>
  890. </onentry>
  891. <transition cond="self.expect_response_partial('Success: ')" target="../../wait_for_action/history">
  892. <raise event="result">
  893. <parameter expr="set(self.split_response(self.responses.pop(0)))"/>
  894. </raise>
  895. </transition>
  896. </state>
  897. <state id="element_list">
  898. <onentry>
  899. <raise event="request">
  900. <parameter expr="['list_full']"/>
  901. </raise>
  902. </onentry>
  903. <transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
  904. <script>
  905. responses = self.split_response(self.responses.pop(0))
  906. result = set([tuple([j.strip() for j in i.split(':')]) for i in responses])
  907. </script>
  908. <raise event="result">
  909. <parameter expr="result"/>
  910. </raise>
  911. </transition>
  912. </state>
  913. <state id="element_list_nice">
  914. <onentry>
  915. <raise event="request">
  916. <parameter expr="['JSON']"/>
  917. </raise>
  918. </onentry>
  919. <transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
  920. <raise event="result">
  921. <parameter expr="json.loads(self.split_response(self.responses.pop(0))[0])"/>
  922. </raise>
  923. </transition>
  924. </state>
  925. <state id="types">
  926. <onentry>
  927. <raise event="request">
  928. <parameter expr="['types', self.parameters[1]]"/>
  929. </raise>
  930. </onentry>
  931. <transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
  932. <raise event="result">
  933. <parameter expr="set(self.split_response(self.responses.pop(0)))"/>
  934. </raise>
  935. </transition>
  936. </state>
  937. <state id="types_full">
  938. <onentry>
  939. <raise event="request">
  940. <parameter expr="['types_full', self.parameters[1]]"/>
  941. </raise>
  942. </onentry>
  943. <transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
  944. <raise event="result">
  945. <parameter expr="set(self.split_response(self.responses.pop(0)))"/>
  946. </raise>
  947. </transition>
  948. </state>
  949. <state id="read_info">
  950. <onentry>
  951. <raise event="request">
  952. <parameter expr="['read_info', self.parameters[1]]"/>
  953. </raise>
  954. </onentry>
  955. <transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
  956. <script>
  957. response = self.responses.pop(0).strip()
  958. _, response = response.split(": ", 1)
  959. values = {line.split(": ", 1)[0]: line.split(": ", 1)[1] for line in response.split("\n", 2)}
  960. if "Source" in values:
  961. result = (values["Type"], (values["Source"], values["Destination"]))
  962. else:
  963. result = (values["Type"], None)
  964. </script>
  965. <raise event="result">
  966. <parameter expr="result"/>
  967. </raise>
  968. </transition>
  969. </state>
  970. <state id="read_attrs">
  971. <onentry>
  972. <raise event="request">
  973. <parameter expr="['read_attrs', self.parameters[1]]"/>
  974. </raise>
  975. </onentry>
  976. <transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
  977. <script>
  978. response = self.responses.pop(0).strip()
  979. _, response = response.split(": ", 1)
  980. values = {line.split(": ", 1)[0]: line.split(": ", 1)[1] for line in response.split("\n")}
  981. values = {key: values[key].split(" = ", 1)[1] for key in values}
  982. </script>
  983. <raise event="result">
  984. <parameter expr="values"/>
  985. </raise>
  986. </transition>
  987. </state>
  988. <state id="instantiate" initial="decide_node_or_edge">
  989. <state id="decide_node_or_edge">
  990. <transition cond="self.parameters[2] is None" target="../created">
  991. <raise event="request">
  992. <parameter expr="['instantiate_node', self.parameters[1], self.parameters[3]]"/>
  993. </raise>
  994. </transition>
  995. <transition cond="self.parameters[2] is not None" target="../created">
  996. <raise event="request">
  997. <parameter expr="['instantiate_edge', self.parameters[1], self.parameters[3], self.parameters[2][0], self.parameters[2][1]]"/>
  998. </raise>
  999. </transition>
  1000. </state>
  1001. <state id="created">
  1002. <transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../../wait_for_action/history">
  1003. <raise event="result">
  1004. <parameter expr="self.split_response(self.responses.pop(0))[0]"/>
  1005. </raise>
  1006. </transition>
  1007. </state>
  1008. </state>
  1009. <state id="delete_element">
  1010. <onentry>
  1011. <raise event="request">
  1012. <parameter expr="['delete_element', self.parameters[1]]"/>
  1013. </raise>
  1014. </onentry>
  1015. <transition cond="self.expect_response('Success')" target="../../wait_for_action/history">
  1016. <raise event="result">
  1017. <parameter expr="None"/>
  1018. </raise>
  1019. </transition>
  1020. </state>
  1021. <state id="attr_assign">
  1022. <onentry>
  1023. <raise event="request">
  1024. <parameter expr="['attr_add', self.parameters[1], self.parameters[2], self.parameters[3]]"/>
  1025. </raise>
  1026. </onentry>
  1027. <transition cond="self.expect_response('Success')" target="../../wait_for_action/history">
  1028. <raise event="result">
  1029. <parameter expr="None"/>
  1030. </raise>
  1031. </transition>
  1032. </state>
  1033. <state id="attr_assign_code">
  1034. <onentry>
  1035. <raise event="request">
  1036. <parameter expr="['attr_add_code', self.parameters[1], self.parameters[2], self.parameters[3]]"/>
  1037. </raise>
  1038. </onentry>
  1039. <transition cond="self.expect_response('Success')" target="../../wait_for_action/history">
  1040. <raise event="result">
  1041. <parameter expr="None"/>
  1042. </raise>
  1043. </transition>
  1044. </state>
  1045. <state id="attr_delete">
  1046. <onentry>
  1047. <raise event="request">
  1048. <parameter expr="['attr_delete', self.parameters[1], self.parameters[2]]"/>
  1049. </raise>
  1050. </onentry>
  1051. <transition cond="self.expect_response('Success')" target="../../wait_for_action/history">
  1052. <raise event="result">
  1053. <parameter expr="None"/>
  1054. </raise>
  1055. </transition>
  1056. </state>
  1057. <state id="read_outgoing">
  1058. <onentry>
  1059. <raise event="request">
  1060. <parameter expr="['read_outgoing', self.parameters[1], self.parameters[2]]"/>
  1061. </raise>
  1062. </onentry>
  1063. <transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
  1064. <raise event="result">
  1065. <parameter expr="set(self.split_response(self.responses.pop(0)))"/>
  1066. </raise>
  1067. </transition>
  1068. </state>
  1069. <state id="read_incoming">
  1070. <onentry>
  1071. <raise event="request">
  1072. <parameter expr="['read_incoming', self.parameters[1], self.parameters[2]]"/>
  1073. </raise>
  1074. </onentry>
  1075. <transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
  1076. <raise event="result">
  1077. <parameter expr="set(self.split_response(self.responses.pop(0)))"/>
  1078. </raise>
  1079. </transition>
  1080. </state>
  1081. <state id="read_association_source">
  1082. <onentry>
  1083. <raise event="request">
  1084. <parameter expr="['read_association_source', self.parameters[1]]"/>
  1085. </raise>
  1086. </onentry>
  1087. <transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
  1088. <raise event="result">
  1089. <parameter expr="self.split_response(self.responses.pop(0))"/>
  1090. </raise>
  1091. </transition>
  1092. </state>
  1093. <state id="read_association_destination">
  1094. <onentry>
  1095. <raise event="request">
  1096. <parameter expr="['read_association_destination', self.parameters[1]]"/>
  1097. </raise>
  1098. </onentry>
  1099. <transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
  1100. <raise event="result">
  1101. <parameter expr="self.split_response(self.responses.pop(0))"/>
  1102. </raise>
  1103. </transition>
  1104. </state>
  1105. <state id="connections_between">
  1106. <onentry>
  1107. <raise event="request">
  1108. <parameter expr="['connections_between', self.parameters[1], self.parameters[2]]"/>
  1109. </raise>
  1110. </onentry>
  1111. <transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
  1112. <raise event="result">
  1113. <parameter expr="set(self.split_response(self.responses.pop(0)))"/>
  1114. </raise>
  1115. </transition>
  1116. </state>
  1117. <state id="define_attribute">
  1118. <onentry>
  1119. <raise event="request">
  1120. <parameter expr="['define_attribute', self.parameters[1], self.parameters[2], self.parameters[3]]"/>
  1121. </raise>
  1122. </onentry>
  1123. <transition cond="self.expect_response_partial('Success: ')" target="../../wait_for_action/history">
  1124. <raise event="result">
  1125. <parameter expr="None"/>
  1126. </raise>
  1127. </transition>
  1128. </state>
  1129. <state id="all_instances">
  1130. <onentry>
  1131. <raise event="request">
  1132. <parameter expr="['all_instances', self.parameters[1]]"/>
  1133. </raise>
  1134. </onentry>
  1135. <transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
  1136. <raise event="result">
  1137. <parameter expr="set(self.split_response(self.responses.pop(0)))"/>
  1138. </raise>
  1139. </transition>
  1140. </state>
  1141. <transition cond="self.expect_response_partial('Element not found: ', pop=False)" target="../wait_for_action/history">
  1142. <raise event="exception">
  1143. <parameter expr="'UnknownIdentifier'"/>
  1144. <parameter expr="'Element could not be found'"/>
  1145. </raise>
  1146. <script>
  1147. self.responses.pop(0)
  1148. </script>
  1149. </transition>
  1150. <transition cond="self.expect_response_partial('No conformance relation can be found ', pop=False)" target="../wait_for_action/history">
  1151. <raise event="exception">
  1152. <parameter expr="'UnknownMetamodellingHierarchy'"/>
  1153. <parameter expr="'Conformance relation not found'"/>
  1154. </raise>
  1155. <script>
  1156. self.responses.pop(0)
  1157. </script>
  1158. </transition>
  1159. <transition cond="self.expect_response_partial('', pop=False)" target="../wait_for_action/history">
  1160. <raise event="exception">
  1161. <parameter expr="'UnknownError'"/>
  1162. <parameter expr="'Error: %s' % self.responses.pop(0)"/>
  1163. </raise>
  1164. </transition>
  1165. </state>
  1166. <state id="wait_for_action" initial="disconnected">
  1167. <state id="disconnected">
  1168. <transition cond="self.expect_action(None, 'init')" target="../../init">
  1169. <script>
  1170. self.load_action(None)
  1171. </script>
  1172. </transition>
  1173. </state>
  1174. <state id="connected">
  1175. <transition cond="self.expect_action(None, 'login')" target="../../login">
  1176. <script>
  1177. self.load_action(None)
  1178. </script>
  1179. </transition>
  1180. </state>
  1181. <state id="megamodelling">
  1182. <transition cond="self.expect_action(None, 'model_list')" target="../../operations/model_list">
  1183. <script>
  1184. self.load_action(None)
  1185. </script>
  1186. </transition>
  1187. <transition cond="self.expect_action(None, 'model_add')" target="../../operations/model_add">
  1188. <script>
  1189. self.load_action(None)
  1190. </script>
  1191. </transition>
  1192. <transition cond="self.expect_action(None, 'model_delete')" target="../../operations/model_delete">
  1193. <script>
  1194. self.load_action(None)
  1195. </script>
  1196. </transition>
  1197. <transition cond="self.expect_action(None, 'model_list_full')" target="../../operations/model_list_full">
  1198. <script>
  1199. self.load_action(None)
  1200. </script>
  1201. </transition>
  1202. <transition cond="self.expect_action(None, 'verify')" target="../../operations/verify">
  1203. <script>
  1204. self.load_action(None)
  1205. </script>
  1206. </transition>
  1207. <transition cond="self.expect_action(None, 'alter_context')" target="../../operations/alter_context">
  1208. <script>
  1209. self.load_action(None)
  1210. </script>
  1211. </transition>
  1212. <transition cond="self.expect_action(None, 'model_overwrite')" target="../../operations/model_overwrite">
  1213. <script>
  1214. self.load_action(None)
  1215. </script>
  1216. </transition>
  1217. <transition cond="self.expect_action(None, 'disconnect')" target="../../operations/disconnect">
  1218. <script>
  1219. self.load_action(None)
  1220. </script>
  1221. </transition>
  1222. <transition cond="self.expect_action(None, 'user_logout')" target="../../operations/user_logout">
  1223. <script>
  1224. self.load_action(None)
  1225. </script>
  1226. </transition>
  1227. <transition cond="self.expect_action(None, 'user_delete')" target="../../operations/user_delete">
  1228. <script>
  1229. self.load_action(None)
  1230. </script>
  1231. </transition>
  1232. <transition cond="self.expect_action(None, 'model_render')" target="../../operations/model_render">
  1233. <script>
  1234. self.load_action(None)
  1235. </script>
  1236. </transition>
  1237. <transition cond="self.expect_action(None, 'transformation_between')" target="../../operations/transformation_between">
  1238. <script>
  1239. self.load_action(None)
  1240. </script>
  1241. </transition>
  1242. <transition cond="self.expect_action(None, 'transformation_add_MT')" target="../../operations/store_on_scripted/transformation_add_MT">
  1243. <script>
  1244. self.load_action(None)
  1245. </script>
  1246. </transition>
  1247. <transition cond="self.expect_action(None, 'transformation_add_AL')" target="../../operations/store_on_scripted/transformation_add_AL">
  1248. <script>
  1249. self.load_action(None)
  1250. </script>
  1251. </transition>
  1252. <transition cond="self.expect_action(None, 'transformation_add_MANUAL')" target="../../operations/store_on_scripted/transformation_add_MANUAL">
  1253. <script>
  1254. self.load_action(None)
  1255. </script>
  1256. </transition>
  1257. <transition cond="self.expect_action(None, 'transformation_execute_MT')" target="../../operations/store_on_scripted/transformation_execute_MT">
  1258. <script>
  1259. self.load_action(None)
  1260. </script>
  1261. </transition>
  1262. <transition cond="self.expect_action(None, 'transformation_execute_AL')" target="../../operations/store_on_scripted/transformation_execute_AL">
  1263. <script>
  1264. self.load_action(None)
  1265. </script>
  1266. </transition>
  1267. <transition cond="self.expect_action(None, 'transformation_execute_MANUAL')" target="../../operations/store_on_scripted/transformation_execute_MANUAL">
  1268. <script>
  1269. self.load_action(None)
  1270. </script>
  1271. </transition>
  1272. <transition cond="self.expect_action(None, 'process_execute')" target="../../operations/store_on_scripted/process_execute">
  1273. <script>
  1274. self.load_action(None)
  1275. </script>
  1276. </transition>
  1277. <transition cond="self.expect_action(None, 'permission_modify')" target="../../operations/permission_modify">
  1278. <script>
  1279. self.load_action(None)
  1280. </script>
  1281. </transition>
  1282. <transition cond="self.expect_action(None, 'permission_owner')" target="../../operations/permission_owner">
  1283. <script>
  1284. self.load_action(None)
  1285. </script>
  1286. </transition>
  1287. <transition cond="self.expect_action(None, 'permission_group')" target="../../operations/permission_group">
  1288. <script>
  1289. self.load_action(None)
  1290. </script>
  1291. </transition>
  1292. <transition cond="self.expect_action(None, 'group_create')" target="../../operations/group_create">
  1293. <script>
  1294. self.load_action(None)
  1295. </script>
  1296. </transition>
  1297. <transition cond="self.expect_action(None, 'group_delete')" target="../../operations/group_delete">
  1298. <script>
  1299. self.load_action(None)
  1300. </script>
  1301. </transition>
  1302. <transition cond="self.expect_action(None, 'group_owner_add')" target="../../operations/group_owner_add">
  1303. <script>
  1304. self.load_action(None)
  1305. </script>
  1306. </transition>
  1307. <transition cond="self.expect_action(None, 'group_owner_delete')" target="../../operations/group_owner_delete">
  1308. <script>
  1309. self.load_action(None)
  1310. </script>
  1311. </transition>
  1312. <transition cond="self.expect_action(None, 'group_join')" target="../../operations/group_join">
  1313. <script>
  1314. self.load_action(None)
  1315. </script>
  1316. </transition>
  1317. <transition cond="self.expect_action(None, 'group_kick')" target="../../operations/group_kick">
  1318. <script>
  1319. self.load_action(None)
  1320. </script>
  1321. </transition>
  1322. <transition cond="self.expect_action(None, 'group_list')" target="../../operations/group_list">
  1323. <script>
  1324. self.load_action(None)
  1325. </script>
  1326. </transition>
  1327. <transition cond="self.expect_action(None, 'admin_promote')" target="../../operations/admin_promote">
  1328. <script>
  1329. self.load_action(None)
  1330. </script>
  1331. </transition>
  1332. <transition cond="self.expect_action(None, 'admin_demote')" target="../../operations/admin_demote">
  1333. <script>
  1334. self.load_action(None)
  1335. </script>
  1336. </transition>
  1337. <transition cond="self.expect_action(None, 'conformance_delete')" target="../../operations/conformance_delete">
  1338. <script>
  1339. self.load_action(None)
  1340. </script>
  1341. </transition>
  1342. <transition cond="self.expect_action(None, 'conformance_add')" target="../../operations/conformance_add">
  1343. <script>
  1344. self.load_action(None)
  1345. </script>
  1346. </transition>
  1347. <transition cond="self.expect_action(None, 'folder_create')" target="../../operations/folder_create">
  1348. <script>
  1349. self.load_action(None)
  1350. </script>
  1351. </transition>
  1352. <transition cond="self.expect_action(None, 'model_types')" target="../../operations/model_types">
  1353. <script>
  1354. self.load_action(None)
  1355. </script>
  1356. </transition>
  1357. <transition cond="self.expect_action(None, ['element_list', 'element_list_nice', 'types', 'types_full', 'read_info', 'read_attrs', 'instantiate', 'delete_element', 'attr_assign', 'attr_assign_code', 'attr_delete', 'read_outgoing', 'read_incoming', 'read_association_source', 'read_association_destination', 'connections_between', 'define_attribute', 'all_instances'])" target="../../going_manual"/>
  1358. </state>
  1359. <state id="modelling">
  1360. <state id="recognized" initial="manual">
  1361. <state id="manual">
  1362. <transition cond="self.expect_action(self.context, 'exit')" target="../../../../leaving_manual"/>
  1363. <transition cond="self.actions[self.context] and self.actions[self.context][0]['parameters'][0] != self.current_model" target="../../../../leaving_manual"/>
  1364. </state>
  1365. <state id="scripted">
  1366. <transition cond="self.expect_action(self.context, 'exit')" target="../../../../operations/store_on_scripted/history">
  1367. <raise event="request">
  1368. <parameter expr="'exit'"/>
  1369. </raise>
  1370. </transition>
  1371. </state>
  1372. <transition cond="self.expect_action(self.context, 'element_list')" target="../../../operations/element_list">
  1373. <script>
  1374. self.load_action(self.context)
  1375. </script>
  1376. </transition>
  1377. <transition cond="self.expect_action(self.context, 'element_list_nice')" target="../../../operations/element_list_nice">
  1378. <script>
  1379. self.load_action(self.context)
  1380. </script>
  1381. </transition>
  1382. <transition cond="self.expect_action(self.context, 'types')" target="../../../operations/types">
  1383. <script>
  1384. self.load_action(self.context)
  1385. </script>
  1386. </transition>
  1387. <transition cond="self.expect_action(self.context, 'types_full')" target="../../../operations/types_full">
  1388. <script>
  1389. self.load_action(self.context)
  1390. </script>
  1391. </transition>
  1392. <transition cond="self.expect_action(self.context, 'read_info')" target="../../../operations/read_info">
  1393. <script>
  1394. self.load_action(self.context)
  1395. </script>
  1396. </transition>
  1397. <transition cond="self.expect_action(self.context, 'read_attrs')" target="../../../operations/read_attrs">
  1398. <script>
  1399. self.load_action(self.context)
  1400. </script>
  1401. </transition>
  1402. <transition cond="self.expect_action(self.context, 'instantiate')" target="../../../operations/instantiate">
  1403. <script>
  1404. self.load_action(self.context)
  1405. </script>
  1406. </transition>
  1407. <transition cond="self.expect_action(self.context, 'delete_element')" target="../../../operations/delete_element">
  1408. <script>
  1409. self.load_action(self.context)
  1410. </script>
  1411. </transition>
  1412. <transition cond="self.expect_action(self.context, 'attr_assign')" target="../../../operations/attr_assign">
  1413. <script>
  1414. self.load_action(self.context)
  1415. </script>
  1416. </transition>
  1417. <transition cond="self.expect_action(self.context, 'model_overwrite')" target="../../../operations/model_upload">
  1418. <script>
  1419. self.load_action(self.context)
  1420. </script>
  1421. </transition>
  1422. <transition cond="self.expect_action(self.context, 'attr_assign_code')" target="../../../operations/attr_assign_code">
  1423. <script>
  1424. self.load_action(self.context)
  1425. </script>
  1426. </transition>
  1427. <transition cond="self.expect_action(self.context, 'attr_delete')" target="../../../operations/attr_delete">
  1428. <script>
  1429. self.load_action(self.context)
  1430. </script>
  1431. </transition>
  1432. <transition cond="self.expect_action(self.context, 'read_outgoing')" target="../../../operations/read_outgoing">
  1433. <script>
  1434. self.load_action(self.context)
  1435. </script>
  1436. </transition>
  1437. <transition cond="self.expect_action(self.context, 'read_incoming')" target="../../../operations/read_incoming">
  1438. <script>
  1439. self.load_action(self.context)
  1440. </script>
  1441. </transition>
  1442. <transition cond="self.expect_action(self.context, 'read_association_source')" target="../../../operations/read_association_source">
  1443. <script>
  1444. self.load_action(self.context)
  1445. </script>
  1446. </transition>
  1447. <transition cond="self.expect_action(self.context, 'read_association_destination')" target="../../../operations/read_association_destination">
  1448. <script>
  1449. self.load_action(self.context)
  1450. </script>
  1451. </transition>
  1452. <transition cond="self.expect_action(self.context, 'connections_between')" target="../../../operations/connections_between">
  1453. <script>
  1454. self.load_action(self.context)
  1455. </script>
  1456. </transition>
  1457. <transition cond="self.expect_action(self.context, 'define_attribute')" target="../../../operations/define_attribute">
  1458. <script>
  1459. self.load_action(self.context)
  1460. </script>
  1461. </transition>
  1462. <transition cond="self.expect_action(self.context, 'all_instances')" target="../../../operations/all_instances">
  1463. <script>
  1464. self.load_action(self.context)
  1465. </script>
  1466. </transition>
  1467. </state>
  1468. <transition cond="self.context is not None and self.actions[self.context]" target="../history">
  1469. <script>
  1470. print("Got unexpected operation: " + str(self.actions[self.context].pop(0)))
  1471. </script>
  1472. <raise event="exception">
  1473. <parameter expr="'IllegalContextOperation'"/>
  1474. <parameter expr="'Operation not allowed in a context!'"/>
  1475. </raise>
  1476. </transition>
  1477. <transition cond="self.context is None and self.actions[None]" target="../../leaving_manual"/>
  1478. </state>
  1479. <state id="finished"/>
  1480. <history id="history" type="deep"/>
  1481. <transition cond="self.context is None and self.actions[None]" target="history">
  1482. <script>
  1483. print("Got unknown operation: " + str(self.actions[None].pop(0)))
  1484. </script>
  1485. <raise event="exception">
  1486. <parameter expr="'UnknownOperation'"/>
  1487. <parameter expr="'Operation is unknown'"/>
  1488. </raise>
  1489. </transition>
  1490. </state>
  1491. <state id="going_manual">
  1492. <onentry>
  1493. <script>
  1494. self.context = None
  1495. self.current_model = self.actions[None][0]["parameters"][0]
  1496. </script>
  1497. <raise event="request">
  1498. <parameter expr="['model_modify', self.current_model, self.registered_metamodel[self.current_model]]"/>
  1499. </raise>
  1500. </onentry>
  1501. <transition cond="self.expect_response('Model loaded, ready for commands!', pop=True)" target="../wait_for_action/modelling/recognized/manual"/>
  1502. <transition cond="self.expect_response_partial('No conformance relation can be found ', pop=False)" target="../wait_for_action/megamodelling">
  1503. <raise event="exception">
  1504. <parameter expr="'UnknownMetamodellingHierarchy'"/>
  1505. <parameter expr="'Conformance relation not found'"/>
  1506. </raise>
  1507. <script>
  1508. self.responses.pop(0)
  1509. self.actions[None].pop(0)
  1510. </script>
  1511. </transition>
  1512. </state>
  1513. <state id="going_scripted">
  1514. <onentry>
  1515. <script>
  1516. self.current_model = None
  1517. </script>
  1518. </onentry>
  1519. <transition target="../wait_for_action/modelling/recognized/scripted"/>
  1520. </state>
  1521. <state id="leaving_manual">
  1522. <onentry>
  1523. <raise event="request">
  1524. <parameter expr="'exit'"/>
  1525. </raise>
  1526. </onentry>
  1527. <transition cond="self.expect_response('Success', pop=True)" target="../wait_for_action/megamodelling"/>
  1528. </state>
  1529. </state>
  1530. <state id="queue">
  1531. <state id="queue">
  1532. <transition event="action" target=".">
  1533. <parameter name="action_name"/>
  1534. <parameter name="ID"/>
  1535. <parameter name="context_ID"/>
  1536. <parameter name="parameters"/>
  1537. <script>
  1538. self.actions[context_ID].append({"name": action_name, "ID": ID, "parameters": parameters})
  1539. </script>
  1540. </transition>
  1541. <transition event="result" target=".">
  1542. <parameter name="parameters"/>
  1543. <raise scope="output" event="result" port="action_out">
  1544. <parameter expr="self.current_ID"/>
  1545. <parameter expr="parameters"/>
  1546. </raise>
  1547. <raise scope="broad" event="mv_result">
  1548. <parameter expr="self.current_ID"/>
  1549. <parameter expr="parameters"/>
  1550. </raise>
  1551. </transition>
  1552. <transition event="data_output" target=".">
  1553. <parameter name="parameters"/>
  1554. <raise scope="output" event="data_output" port="action_out">
  1555. <parameter expr="parameters"/>
  1556. </raise>
  1557. <raise scope="broad" event="mv_data_output">
  1558. <parameter expr="parameters"/>
  1559. </raise>
  1560. </transition>
  1561. <transition event="exception" target=".">
  1562. <parameter name="ID"/>
  1563. <parameter name="parameters"/>
  1564. <raise scope="output" event="exception" port="action_out">
  1565. <parameter expr="self.current_ID"/>
  1566. <parameter expr="ID"/>
  1567. <parameter expr="parameters"/>
  1568. </raise>
  1569. <raise scope="broad" event="mv_exception">
  1570. <parameter expr="self.current_ID"/>
  1571. <parameter expr="ID"/>
  1572. <parameter expr="parameters"/>
  1573. </raise>
  1574. </transition>
  1575. <transition event="ready" target=".">
  1576. <raise scope="output" event="ready" port="ready"/>
  1577. <raise scope="broad" event="mv_ready"/>
  1578. </transition>
  1579. <transition event="data_input" target=".">
  1580. <parameter name="value"/>
  1581. <parameter name="context_ID"/>
  1582. <script>
  1583. self.inputs[context_ID].append(value)
  1584. </script>
  1585. </transition>
  1586. </state>
  1587. </state>
  1588. </parallel>
  1589. </scxml>
  1590. </class>